kanna-code 0.1.2 → 0.1.4

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.
@@ -97,7 +97,7 @@ Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}
97
97
  `)},$x=function(){var e=parseInt(document.body.getAttribute(ji)||"0",10);return isFinite(e)?e:0},aA=function(){S.useEffect(function(){return document.body.setAttribute(ji,($x()+1).toString()),function(){var e=$x()-1;e<=0?document.body.removeAttribute(ji):document.body.setAttribute(ji,e.toString())}},[])},oA=function(e){var r=e.noRelative,l=e.noImportant,i=e.gapMode,o=i===void 0?"margin":i;aA();var u=S.useMemo(function(){return rA(o)},[o]);return S.createElement(lA,{styles:iA(u,!r,o,l?"":"!important")})},Xd=!1;if(typeof window<"u")try{var Ls=Object.defineProperty({},"passive",{get:function(){return Xd=!0,!0}});window.addEventListener("test",Ls,Ls),window.removeEventListener("test",Ls,Ls)}catch{Xd=!1}var Si=Xd?{passive:!1}:!1,sA=function(e){return e.tagName==="TEXTAREA"},s0=function(e,r){if(!(e instanceof Element))return!1;var l=window.getComputedStyle(e);return l[r]!=="hidden"&&!(l.overflowY===l.overflowX&&!sA(e)&&l[r]==="visible")},uA=function(e){return s0(e,"overflowY")},cA=function(e){return s0(e,"overflowX")},Xx=function(e,r){var l=r.ownerDocument,i=r;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var o=u0(e,i);if(o){var u=c0(e,i),c=u[1],f=u[2];if(c>f)return!0}i=i.parentNode}while(i&&i!==l.body);return!1},fA=function(e){var r=e.scrollTop,l=e.scrollHeight,i=e.clientHeight;return[r,l,i]},dA=function(e){var r=e.scrollLeft,l=e.scrollWidth,i=e.clientWidth;return[r,l,i]},u0=function(e,r){return e==="v"?uA(r):cA(r)},c0=function(e,r){return e==="v"?fA(r):dA(r)},hA=function(e,r){return e==="h"&&r==="rtl"?-1:1},mA=function(e,r,l,i,o){var u=hA(e,window.getComputedStyle(r).direction),c=u*i,f=l.target,d=r.contains(f),m=!1,g=c>0,y=0,b=0;do{if(!f)break;var v=c0(e,f),k=v[0],C=v[1],A=v[2],N=C-A-u*k;(k||N)&&u0(e,f)&&(y+=N,b+=k);var O=f.parentNode;f=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!d&&f!==document.body||d&&(r.contains(f)||r===f));return(g&&Math.abs(y)<1||!g&&Math.abs(b)<1)&&(m=!0),m},Bs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qx=function(e){return[e.deltaX,e.deltaY]},Zx=function(e){return e&&"current"in e?e.current:e},pA=function(e,r){return e[0]===r[0]&&e[1]===r[1]},gA=function(e){return`
98
98
  .block-interactivity-`.concat(e,` {pointer-events: none;}
99
99
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
- `)},yA=0,ki=[];function xA(e){var r=S.useRef([]),l=S.useRef([0,0]),i=S.useRef(),o=S.useState(yA++)[0],u=S.useState(o0)[0],c=S.useRef(e);S.useEffect(function(){c.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var C=HN([e.lockRef.current],(e.shards||[]).map(Zx),!0).filter(Boolean);return C.forEach(function(A){return A.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),C.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var f=S.useCallback(function(C,A){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!c.current.allowPinchZoom;var N=Bs(C),O=l.current,_="deltaX"in C?C.deltaX:O[0]-N[0],U="deltaY"in C?C.deltaY:O[1]-N[1],F,z=C.target,B=Math.abs(_)>Math.abs(U)?"h":"v";if("touches"in C&&B==="h"&&z.type==="range")return!1;var $=window.getSelection(),ae=$&&$.anchorNode,P=ae?ae===z||ae.contains(z):!1;if(P)return!1;var re=Xx(B,z);if(!re)return!0;if(re?F=B:(F=B==="v"?"h":"v",re=Xx(B,z)),!re)return!1;if(!i.current&&"changedTouches"in C&&(_||U)&&(i.current=F),!F)return!0;var le=i.current||F;return mA(le,A,C,le==="h"?_:U)},[]),d=S.useCallback(function(C){var A=C;if(!(!ki.length||ki[ki.length-1]!==u)){var N="deltaY"in A?Qx(A):Bs(A),O=r.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&pA(F.delta,N)})[0];if(O&&O.should){A.cancelable&&A.preventDefault();return}if(!O){var _=(c.current.shards||[]).map(Zx).filter(Boolean).filter(function(F){return F.contains(A.target)}),U=_.length>0?f(A,_[0]):!c.current.noIsolation;U&&A.cancelable&&A.preventDefault()}}},[]),m=S.useCallback(function(C,A,N,O){var _={name:C,delta:A,target:N,should:O,shadowParent:bA(N)};r.current.push(_),setTimeout(function(){r.current=r.current.filter(function(U){return U!==_})},1)},[]),g=S.useCallback(function(C){l.current=Bs(C),i.current=void 0},[]),y=S.useCallback(function(C){m(C.type,Qx(C),C.target,f(C,e.lockRef.current))},[]),b=S.useCallback(function(C){m(C.type,Bs(C),C.target,f(C,e.lockRef.current))},[]);S.useEffect(function(){return ki.push(u),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:b}),document.addEventListener("wheel",d,Si),document.addEventListener("touchmove",d,Si),document.addEventListener("touchstart",g,Si),function(){ki=ki.filter(function(C){return C!==u}),document.removeEventListener("wheel",d,Si),document.removeEventListener("touchmove",d,Si),document.removeEventListener("touchstart",g,Si)}},[]);var v=e.removeScrollBar,k=e.inert;return S.createElement(S.Fragment,null,k?S.createElement(u,{styles:gA(o)}):null,v?S.createElement(oA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bA(e){for(var r=null;e!==null;)e instanceof ShadowRoot&&(r=e.host,e=e.host),e=e.parentNode;return r}const vA=XN(a0,xA);var Th=S.forwardRef(function(e,r){return S.createElement(wu,Bn({},e,{ref:r,sideCar:vA}))});Th.classNames=wu.classNames;var wA=function(e){if(typeof document>"u")return null;var r=Array.isArray(e)?e[0]:e;return r.ownerDocument.body},Ci=new WeakMap,Us=new WeakMap,Hs={},gd=0,f0=function(e){return e&&(e.host||f0(e.parentNode))},SA=function(e,r){return r.map(function(l){if(e.contains(l))return l;var i=f0(l);return i&&e.contains(i)?i:(console.error("aria-hidden",l,"in not contained inside",e,". Doing nothing"),null)}).filter(function(l){return!!l})},kA=function(e,r,l,i){var o=SA(r,Array.isArray(e)?e:[e]);Hs[l]||(Hs[l]=new WeakMap);var u=Hs[l],c=[],f=new Set,d=new Set(o),m=function(y){!y||f.has(y)||(f.add(y),m(y.parentNode))};o.forEach(m);var g=function(y){!y||d.has(y)||Array.prototype.forEach.call(y.children,function(b){if(f.has(b))g(b);else try{var v=b.getAttribute(i),k=v!==null&&v!=="false",C=(Ci.get(b)||0)+1,A=(u.get(b)||0)+1;Ci.set(b,C),u.set(b,A),c.push(b),C===1&&k&&Us.set(b,!0),A===1&&b.setAttribute(l,"true"),k||b.setAttribute(i,"true")}catch(N){console.error("aria-hidden: cannot operate on ",b,N)}})};return g(r),f.clear(),gd++,function(){c.forEach(function(y){var b=Ci.get(y)-1,v=u.get(y)-1;Ci.set(y,b),u.set(y,v),b||(Us.has(y)||y.removeAttribute(i),Us.delete(y)),v||y.removeAttribute(l)}),gd--,gd||(Ci=new WeakMap,Ci=new WeakMap,Us=new WeakMap,Hs={})}},d0=function(e,r,l){l===void 0&&(l="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),o=wA(e);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),kA(i,o,l,"aria-hidden")):function(){return null}},Su="Dialog",[h0]=xu(Su),[CA,An]=h0(Su),m0=e=>{const{__scopeDialog:r,children:l,open:i,defaultOpen:o,onOpenChange:u,modal:c=!0}=e,f=S.useRef(null),d=S.useRef(null),[m,g]=Nh({prop:i,defaultProp:o??!1,onChange:u,caller:Su});return x.jsx(CA,{scope:r,triggerRef:f,contentRef:d,contentId:Xa(),titleId:Xa(),descriptionId:Xa(),open:m,onOpenChange:g,onOpenToggle:S.useCallback(()=>g(y=>!y),[g]),modal:c,children:l})};m0.displayName=Su;var p0="DialogTrigger",EA=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(p0,l),u=an(r,o.triggerRef);return x.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Mh(o.open),...i,ref:u,onClick:yt(e.onClick,o.onOpenToggle)})});EA.displayName=p0;var _h="DialogPortal",[NA,g0]=h0(_h,{forceMount:void 0}),y0=e=>{const{__scopeDialog:r,forceMount:l,children:i,container:o}=e,u=An(_h,r);return x.jsx(NA,{scope:r,forceMount:l,children:S.Children.map(i,c=>x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:c})}))})};y0.displayName=_h;var tu="DialogOverlay",x0=S.forwardRef((e,r)=>{const l=g0(tu,e.__scopeDialog),{forceMount:i=l.forceMount,...o}=e,u=An(tu,e.__scopeDialog);return u.modal?x.jsx(nl,{present:i||u.open,children:x.jsx(jA,{...o,ref:r})}):null});x0.displayName=tu;var AA=Ah("DialogOverlay.RemoveScroll"),jA=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(tu,l);return x.jsx(Th,{as:AA,allowPinchZoom:!0,shards:[o.contentRef],children:x.jsx(_t.div,{"data-state":Mh(o.open),...i,ref:r,style:{pointerEvents:"auto",...i.style}})})}),Tl="DialogContent",b0=S.forwardRef((e,r)=>{const l=g0(Tl,e.__scopeDialog),{forceMount:i=l.forceMount,...o}=e,u=An(Tl,e.__scopeDialog);return x.jsx(nl,{present:i||u.open,children:u.modal?x.jsx(TA,{...o,ref:r}):x.jsx(_A,{...o,ref:r})})});b0.displayName=Tl;var TA=S.forwardRef((e,r)=>{const l=An(Tl,e.__scopeDialog),i=S.useRef(null),o=an(r,l.contentRef,i);return S.useEffect(()=>{const u=i.current;if(u)return d0(u)},[]),x.jsx(v0,{...e,ref:o,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(e.onCloseAutoFocus,u=>{var c;u.preventDefault(),(c=l.triggerRef.current)==null||c.focus()}),onPointerDownOutside:yt(e.onPointerDownOutside,u=>{const c=u.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&u.preventDefault()}),onFocusOutside:yt(e.onFocusOutside,u=>u.preventDefault())})}),_A=S.forwardRef((e,r)=>{const l=An(Tl,e.__scopeDialog),i=S.useRef(!1),o=S.useRef(!1);return x.jsx(v0,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,u),u.defaultPrevented||(i.current||(f=l.triggerRef.current)==null||f.focus(),u.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:u=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=u.target;((m=l.triggerRef.current)==null?void 0:m.contains(c))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&o.current&&u.preventDefault()}})}),v0=S.forwardRef((e,r)=>{const{__scopeDialog:l,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:u,...c}=e,f=An(Tl,l),d=S.useRef(null),m=an(r,d);return r0(),x.jsxs(x.Fragment,{children:[x.jsx(jh,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:u,children:x.jsx(bu,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Mh(f.open),...c,ref:m,onDismiss:()=>f.onOpenChange(!1)})}),x.jsxs(x.Fragment,{children:[x.jsx(RA,{titleId:f.titleId}),x.jsx(OA,{contentRef:d,descriptionId:f.descriptionId})]})]})}),Rh="DialogTitle",w0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(Rh,l);return x.jsx(_t.h2,{id:o.titleId,...i,ref:r})});w0.displayName=Rh;var S0="DialogDescription",k0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(S0,l);return x.jsx(_t.p,{id:o.descriptionId,...i,ref:r})});k0.displayName=S0;var C0="DialogClose",E0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(C0,l);return x.jsx(_t.button,{type:"button",...i,ref:r,onClick:yt(e.onClick,()=>o.onOpenChange(!1))})});E0.displayName=C0;function Mh(e){return e?"open":"closed"}var N0="DialogTitleWarning",[S6,A0]=aN(N0,{contentName:Tl,titleName:Rh,docsSlug:"dialog"}),RA=({titleId:e})=>{const r=A0(N0),l=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.
100
+ `)},yA=0,ki=[];function xA(e){var r=S.useRef([]),l=S.useRef([0,0]),i=S.useRef(),o=S.useState(yA++)[0],u=S.useState(o0)[0],c=S.useRef(e);S.useEffect(function(){c.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var C=HN([e.lockRef.current],(e.shards||[]).map(Zx),!0).filter(Boolean);return C.forEach(function(A){return A.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),C.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var f=S.useCallback(function(C,A){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!c.current.allowPinchZoom;var N=Bs(C),O=l.current,_="deltaX"in C?C.deltaX:O[0]-N[0],U="deltaY"in C?C.deltaY:O[1]-N[1],F,z=C.target,B=Math.abs(_)>Math.abs(U)?"h":"v";if("touches"in C&&B==="h"&&z.type==="range")return!1;var $=window.getSelection(),ae=$&&$.anchorNode,P=ae?ae===z||ae.contains(z):!1;if(P)return!1;var re=Xx(B,z);if(!re)return!0;if(re?F=B:(F=B==="v"?"h":"v",re=Xx(B,z)),!re)return!1;if(!i.current&&"changedTouches"in C&&(_||U)&&(i.current=F),!F)return!0;var le=i.current||F;return mA(le,A,C,le==="h"?_:U)},[]),d=S.useCallback(function(C){var A=C;if(!(!ki.length||ki[ki.length-1]!==u)){var N="deltaY"in A?Qx(A):Bs(A),O=r.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&pA(F.delta,N)})[0];if(O&&O.should){A.cancelable&&A.preventDefault();return}if(!O){var _=(c.current.shards||[]).map(Zx).filter(Boolean).filter(function(F){return F.contains(A.target)}),U=_.length>0?f(A,_[0]):!c.current.noIsolation;U&&A.cancelable&&A.preventDefault()}}},[]),m=S.useCallback(function(C,A,N,O){var _={name:C,delta:A,target:N,should:O,shadowParent:bA(N)};r.current.push(_),setTimeout(function(){r.current=r.current.filter(function(U){return U!==_})},1)},[]),g=S.useCallback(function(C){l.current=Bs(C),i.current=void 0},[]),y=S.useCallback(function(C){m(C.type,Qx(C),C.target,f(C,e.lockRef.current))},[]),b=S.useCallback(function(C){m(C.type,Bs(C),C.target,f(C,e.lockRef.current))},[]);S.useEffect(function(){return ki.push(u),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:b}),document.addEventListener("wheel",d,Si),document.addEventListener("touchmove",d,Si),document.addEventListener("touchstart",g,Si),function(){ki=ki.filter(function(C){return C!==u}),document.removeEventListener("wheel",d,Si),document.removeEventListener("touchmove",d,Si),document.removeEventListener("touchstart",g,Si)}},[]);var v=e.removeScrollBar,k=e.inert;return S.createElement(S.Fragment,null,k?S.createElement(u,{styles:gA(o)}):null,v?S.createElement(oA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bA(e){for(var r=null;e!==null;)e instanceof ShadowRoot&&(r=e.host,e=e.host),e=e.parentNode;return r}const vA=XN(a0,xA);var Th=S.forwardRef(function(e,r){return S.createElement(wu,Bn({},e,{ref:r,sideCar:vA}))});Th.classNames=wu.classNames;var wA=function(e){if(typeof document>"u")return null;var r=Array.isArray(e)?e[0]:e;return r.ownerDocument.body},Ci=new WeakMap,Us=new WeakMap,Hs={},gd=0,f0=function(e){return e&&(e.host||f0(e.parentNode))},SA=function(e,r){return r.map(function(l){if(e.contains(l))return l;var i=f0(l);return i&&e.contains(i)?i:(console.error("aria-hidden",l,"in not contained inside",e,". Doing nothing"),null)}).filter(function(l){return!!l})},kA=function(e,r,l,i){var o=SA(r,Array.isArray(e)?e:[e]);Hs[l]||(Hs[l]=new WeakMap);var u=Hs[l],c=[],f=new Set,d=new Set(o),m=function(y){!y||f.has(y)||(f.add(y),m(y.parentNode))};o.forEach(m);var g=function(y){!y||d.has(y)||Array.prototype.forEach.call(y.children,function(b){if(f.has(b))g(b);else try{var v=b.getAttribute(i),k=v!==null&&v!=="false",C=(Ci.get(b)||0)+1,A=(u.get(b)||0)+1;Ci.set(b,C),u.set(b,A),c.push(b),C===1&&k&&Us.set(b,!0),A===1&&b.setAttribute(l,"true"),k||b.setAttribute(i,"true")}catch(N){console.error("aria-hidden: cannot operate on ",b,N)}})};return g(r),f.clear(),gd++,function(){c.forEach(function(y){var b=Ci.get(y)-1,v=u.get(y)-1;Ci.set(y,b),u.set(y,v),b||(Us.has(y)||y.removeAttribute(i),Us.delete(y)),v||y.removeAttribute(l)}),gd--,gd||(Ci=new WeakMap,Ci=new WeakMap,Us=new WeakMap,Hs={})}},d0=function(e,r,l){l===void 0&&(l="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),o=wA(e);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),kA(i,o,l,"aria-hidden")):function(){return null}},Su="Dialog",[h0]=xu(Su),[CA,An]=h0(Su),m0=e=>{const{__scopeDialog:r,children:l,open:i,defaultOpen:o,onOpenChange:u,modal:c=!0}=e,f=S.useRef(null),d=S.useRef(null),[m,g]=Nh({prop:i,defaultProp:o??!1,onChange:u,caller:Su});return x.jsx(CA,{scope:r,triggerRef:f,contentRef:d,contentId:Xa(),titleId:Xa(),descriptionId:Xa(),open:m,onOpenChange:g,onOpenToggle:S.useCallback(()=>g(y=>!y),[g]),modal:c,children:l})};m0.displayName=Su;var p0="DialogTrigger",EA=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(p0,l),u=an(r,o.triggerRef);return x.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Mh(o.open),...i,ref:u,onClick:yt(e.onClick,o.onOpenToggle)})});EA.displayName=p0;var _h="DialogPortal",[NA,g0]=h0(_h,{forceMount:void 0}),y0=e=>{const{__scopeDialog:r,forceMount:l,children:i,container:o}=e,u=An(_h,r);return x.jsx(NA,{scope:r,forceMount:l,children:S.Children.map(i,c=>x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:c})}))})};y0.displayName=_h;var tu="DialogOverlay",x0=S.forwardRef((e,r)=>{const l=g0(tu,e.__scopeDialog),{forceMount:i=l.forceMount,...o}=e,u=An(tu,e.__scopeDialog);return u.modal?x.jsx(nl,{present:i||u.open,children:x.jsx(jA,{...o,ref:r})}):null});x0.displayName=tu;var AA=Ah("DialogOverlay.RemoveScroll"),jA=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(tu,l);return x.jsx(Th,{as:AA,allowPinchZoom:!0,shards:[o.contentRef],children:x.jsx(_t.div,{"data-state":Mh(o.open),...i,ref:r,style:{pointerEvents:"auto",...i.style}})})}),Tl="DialogContent",b0=S.forwardRef((e,r)=>{const l=g0(Tl,e.__scopeDialog),{forceMount:i=l.forceMount,...o}=e,u=An(Tl,e.__scopeDialog);return x.jsx(nl,{present:i||u.open,children:u.modal?x.jsx(TA,{...o,ref:r}):x.jsx(_A,{...o,ref:r})})});b0.displayName=Tl;var TA=S.forwardRef((e,r)=>{const l=An(Tl,e.__scopeDialog),i=S.useRef(null),o=an(r,l.contentRef,i);return S.useEffect(()=>{const u=i.current;if(u)return d0(u)},[]),x.jsx(v0,{...e,ref:o,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(e.onCloseAutoFocus,u=>{var c;u.preventDefault(),(c=l.triggerRef.current)==null||c.focus()}),onPointerDownOutside:yt(e.onPointerDownOutside,u=>{const c=u.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&u.preventDefault()}),onFocusOutside:yt(e.onFocusOutside,u=>u.preventDefault())})}),_A=S.forwardRef((e,r)=>{const l=An(Tl,e.__scopeDialog),i=S.useRef(!1),o=S.useRef(!1);return x.jsx(v0,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,u),u.defaultPrevented||(i.current||(f=l.triggerRef.current)==null||f.focus(),u.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:u=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=u.target;((m=l.triggerRef.current)==null?void 0:m.contains(c))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&o.current&&u.preventDefault()}})}),v0=S.forwardRef((e,r)=>{const{__scopeDialog:l,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:u,...c}=e,f=An(Tl,l),d=S.useRef(null),m=an(r,d);return r0(),x.jsxs(x.Fragment,{children:[x.jsx(jh,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:u,children:x.jsx(bu,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Mh(f.open),...c,ref:m,onDismiss:()=>f.onOpenChange(!1)})}),x.jsxs(x.Fragment,{children:[x.jsx(RA,{titleId:f.titleId}),x.jsx(OA,{contentRef:d,descriptionId:f.descriptionId})]})]})}),Rh="DialogTitle",w0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(Rh,l);return x.jsx(_t.h2,{id:o.titleId,...i,ref:r})});w0.displayName=Rh;var S0="DialogDescription",k0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(S0,l);return x.jsx(_t.p,{id:o.descriptionId,...i,ref:r})});k0.displayName=S0;var C0="DialogClose",E0=S.forwardRef((e,r)=>{const{__scopeDialog:l,...i}=e,o=An(C0,l);return x.jsx(_t.button,{type:"button",...i,ref:r,onClick:yt(e.onClick,()=>o.onOpenChange(!1))})});E0.displayName=C0;function Mh(e){return e?"open":"closed"}var N0="DialogTitleWarning",[E6,A0]=aN(N0,{contentName:Tl,titleName:Rh,docsSlug:"dialog"}),RA=({titleId:e})=>{const r=A0(N0),l=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.
101
101
 
102
102
  If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.
103
103
 
@@ -381,38 +381,38 @@ For more information, see https://radix-ui.com/primitives/docs/components/${r.do
381
381
  *
382
382
  * This source code is licensed under the ISC license.
383
383
  * See the LICENSE file in the root directory of this source tree.
384
- */const dT=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],H0=Se("zap",dT),P0=zA,hT=DA,q0=S.forwardRef(({className:e,...r},l)=>x.jsx(j0,{ref:l,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));q0.displayName=j0.displayName;const mT={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Uh=S.forwardRef(({className:e,children:r,size:l="md",...i},o)=>x.jsxs(hT,{children:[x.jsx(q0,{}),x.jsxs(T0,{ref:o,className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",mT[l],e),...i,children:[r,x.jsxs(UA,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[x.jsx(so,{className:"h-4 w-4"}),x.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Uh.displayName=T0.displayName;function F0({className:e,...r}){return x.jsx(LA,{className:xe("text-lg font-medium leading-none tracking-tight",e),...r})}function pT({className:e,...r}){return x.jsx(BA,{className:xe("text-sm text-muted-foreground",e),...r})}function V0({className:e,...r}){return x.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...r})}function I0({className:e,...r}){return x.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...r})}const G0=S.createContext(null);function gT({children:e}){const[r,l]=S.useState(null),[i,o]=S.useState(""),u=S.useRef(null);S.useEffect(()=>{(r==null?void 0:r.kind)==="prompt"&&(o(r.options.initialValue??""),setTimeout(()=>{var g,y;(g=u.current)==null||g.focus(),(y=u.current)==null||y.select()},0))},[r]);const c=S.useCallback(()=>{l(null),o("")},[]),f=S.useCallback(g=>new Promise(y=>{l({kind:"confirm",options:g,resolve:y})}),[]),d=S.useCallback(g=>new Promise(y=>{l({kind:"prompt",options:g,resolve:y})}),[]),m=S.useMemo(()=>({confirm:f,prompt:d}),[f,d]);return x.jsxs(G0.Provider,{value:m,children:[e,x.jsx(P0,{open:r!==null,onOpenChange:g=>{g||!r||(r.kind==="confirm"?r.resolve(!1):r.resolve(null),c())},children:x.jsx(Uh,{size:"sm",children:r?x.jsxs(x.Fragment,{children:[x.jsxs(V0,{className:"space-y-4",children:[x.jsx(F0,{children:r.options.title}),r.options.description?x.jsx(pT,{children:r.options.description}):null,r.kind==="prompt"?x.jsx("input",{ref:u,type:"text",value:i,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),r.resolve(i.trim()||null),c())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:r.options.placeholder}):null]}),x.jsxs(I0,{children:[x.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>{r.kind==="confirm"?r.resolve(!1):r.resolve(null),c()},children:r.options.cancelLabel??"Cancel"}),x.jsx(qe,{variant:r.kind==="confirm"?r.options.confirmVariant??"default":"secondary",size:"sm",onClick:()=>{r.kind==="confirm"?r.resolve(!0):r.resolve(i.trim()||null),c()},disabled:r.kind==="prompt"&&!i.trim(),children:r.options.confirmLabel??"Confirm"})]})]}):null})})]})}function yT(){const e=S.useContext(G0);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const xT=["top","right","bottom","left"],Jr=Math.min,nn=Math.max,ru=Math.round,Ps=Math.floor,Pn=e=>({x:e,y:e}),bT={left:"right",right:"left",bottom:"top",top:"bottom"};function Zd(e,r,l){return nn(e,Jr(r,l))}function mr(e,r){return typeof e=="function"?e(r):e}function pr(e){return e.split("-")[0]}function Pi(e){return e.split("-")[1]}function Hh(e){return e==="x"?"y":"x"}function Ph(e){return e==="y"?"height":"width"}function Un(e){const r=e[0];return r==="t"||r==="b"?"y":"x"}function qh(e){return Hh(Un(e))}function vT(e,r,l){l===void 0&&(l=!1);const i=Pi(e),o=qh(e),u=Ph(o);let c=o==="x"?i===(l?"end":"start")?"right":"left":i==="start"?"bottom":"top";return r.reference[u]>r.floating[u]&&(c=lu(c)),[c,lu(c)]}function wT(e){const r=lu(e);return[Kd(e),r,Kd(r)]}function Kd(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const tb=["left","right"],nb=["right","left"],ST=["top","bottom"],kT=["bottom","top"];function CT(e,r,l){switch(e){case"top":case"bottom":return l?r?nb:tb:r?tb:nb;case"left":case"right":return r?ST:kT;default:return[]}}function ET(e,r,l,i){const o=Pi(e);let u=CT(pr(e),l==="start",i);return o&&(u=u.map(c=>c+"-"+o),r&&(u=u.concat(u.map(Kd)))),u}function lu(e){const r=pr(e);return bT[r]+e.slice(r.length)}function NT(e){return{top:0,right:0,bottom:0,left:0,...e}}function Y0(e){return typeof e!="number"?NT(e):{top:e,right:e,bottom:e,left:e}}function iu(e){const{x:r,y:l,width:i,height:o}=e;return{width:i,height:o,top:l,left:r,right:r+i,bottom:l+o,x:r,y:l}}function rb(e,r,l){let{reference:i,floating:o}=e;const u=Un(r),c=qh(r),f=Ph(c),d=pr(r),m=u==="y",g=i.x+i.width/2-o.width/2,y=i.y+i.height/2-o.height/2,b=i[f]/2-o[f]/2;let v;switch(d){case"top":v={x:g,y:i.y-o.height};break;case"bottom":v={x:g,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y};break;case"left":v={x:i.x-o.width,y};break;default:v={x:i.x,y:i.y}}switch(Pi(r)){case"start":v[c]-=b*(l&&m?-1:1);break;case"end":v[c]+=b*(l&&m?-1:1);break}return v}async function AT(e,r){var l;r===void 0&&(r={});const{x:i,y:o,platform:u,rects:c,elements:f,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:g="viewport",elementContext:y="floating",altBoundary:b=!1,padding:v=0}=mr(r,e),k=Y0(v),A=f[b?y==="floating"?"reference":"floating":y],N=iu(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(A)))==null||l?A:A.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(f.floating)),boundary:m,rootBoundary:g,strategy:d})),O=y==="floating"?{x:i,y:o,width:c.floating.width,height:c.floating.height}:c.reference,_=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f.floating)),U=await(u.isElement==null?void 0:u.isElement(_))?await(u.getScale==null?void 0:u.getScale(_))||{x:1,y:1}:{x:1,y:1},F=iu(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:O,offsetParent:_,strategy:d}):O);return{top:(N.top-F.top+k.top)/U.y,bottom:(F.bottom-N.bottom+k.bottom)/U.y,left:(N.left-F.left+k.left)/U.x,right:(F.right-N.right+k.right)/U.x}}const jT=50,TT=async(e,r,l)=>{const{placement:i="bottom",strategy:o="absolute",middleware:u=[],platform:c}=l,f=c.detectOverflow?c:{...c,detectOverflow:AT},d=await(c.isRTL==null?void 0:c.isRTL(r));let m=await c.getElementRects({reference:e,floating:r,strategy:o}),{x:g,y}=rb(m,i,d),b=i,v=0;const k={};for(let C=0;C<u.length;C++){const A=u[C];if(!A)continue;const{name:N,fn:O}=A,{x:_,y:U,data:F,reset:z}=await O({x:g,y,initialPlacement:i,placement:b,strategy:o,middlewareData:k,rects:m,platform:f,elements:{reference:e,floating:r}});g=_??g,y=U??y,k[N]={...k[N],...F},z&&v<jT&&(v++,typeof z=="object"&&(z.placement&&(b=z.placement),z.rects&&(m=z.rects===!0?await c.getElementRects({reference:e,floating:r,strategy:o}):z.rects),{x:g,y}=rb(m,b,d)),C=-1)}return{x:g,y,placement:b,strategy:o,middlewareData:k}},_T=e=>({name:"arrow",options:e,async fn(r){const{x:l,y:i,placement:o,rects:u,platform:c,elements:f,middlewareData:d}=r,{element:m,padding:g=0}=mr(e,r)||{};if(m==null)return{};const y=Y0(g),b={x:l,y:i},v=qh(o),k=Ph(v),C=await c.getDimensions(m),A=v==="y",N=A?"top":"left",O=A?"bottom":"right",_=A?"clientHeight":"clientWidth",U=u.reference[k]+u.reference[v]-b[v]-u.floating[k],F=b[v]-u.reference[v],z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let B=z?z[_]:0;(!B||!await(c.isElement==null?void 0:c.isElement(z)))&&(B=f.floating[_]||u.floating[k]);const $=U/2-F/2,ae=B/2-C[k]/2-1,P=Jr(y[N],ae),re=Jr(y[O],ae),le=P,se=B-C[k]-re,J=B/2-C[k]/2+$,Z=Zd(le,J,se),D=!d.arrow&&Pi(o)!=null&&J!==Z&&u.reference[k]/2-(J<le?P:re)-C[k]/2<0,X=D?J<le?J-le:J-se:0;return{[v]:b[v]+X,data:{[v]:Z,centerOffset:J-Z-X,...D&&{alignmentOffset:X}},reset:D}}}),RT=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(r){var l,i;const{placement:o,middlewareData:u,rects:c,initialPlacement:f,platform:d,elements:m}=r,{mainAxis:g=!0,crossAxis:y=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:C=!0,...A}=mr(e,r);if((l=u.arrow)!=null&&l.alignmentOffset)return{};const N=pr(o),O=Un(f),_=pr(f)===f,U=await(d.isRTL==null?void 0:d.isRTL(m.floating)),F=b||(_||!C?[lu(f)]:wT(f)),z=k!=="none";!b&&z&&F.push(...ET(f,C,k,U));const B=[f,...F],$=await d.detectOverflow(r,A),ae=[];let P=((i=u.flip)==null?void 0:i.overflows)||[];if(g&&ae.push($[N]),y){const J=vT(o,c,U);ae.push($[J[0]],$[J[1]])}if(P=[...P,{placement:o,overflows:ae}],!ae.every(J=>J<=0)){var re,le;const J=(((re=u.flip)==null?void 0:re.index)||0)+1,Z=B[J];if(Z&&(!(y==="alignment"?O!==Un(Z):!1)||P.every(ne=>Un(ne.placement)===O?ne.overflows[0]>0:!0)))return{data:{index:J,overflows:P},reset:{placement:Z}};let D=(le=P.filter(X=>X.overflows[0]<=0).sort((X,ne)=>X.overflows[1]-ne.overflows[1])[0])==null?void 0:le.placement;if(!D)switch(v){case"bestFit":{var se;const X=(se=P.filter(ne=>{if(z){const ie=Un(ne.placement);return ie===O||ie==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(ie=>ie>0).reduce((ie,j)=>ie+j,0)]).sort((ne,ie)=>ne[1]-ie[1])[0])==null?void 0:se[0];X&&(D=X);break}case"initialPlacement":D=f;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function lb(e,r){return{top:e.top-r.height,right:e.right-r.width,bottom:e.bottom-r.height,left:e.left-r.width}}function ib(e){return xT.some(r=>e[r]>=0)}const MT=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(r){const{rects:l,platform:i}=r,{strategy:o="referenceHidden",...u}=mr(e,r);switch(o){case"referenceHidden":{const c=await i.detectOverflow(r,{...u,elementContext:"reference"}),f=lb(c,l.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:ib(f)}}}case"escaped":{const c=await i.detectOverflow(r,{...u,altBoundary:!0}),f=lb(c,l.floating);return{data:{escapedOffsets:f,escaped:ib(f)}}}default:return{}}}}},$0=new Set(["left","top"]);async function OT(e,r){const{placement:l,platform:i,elements:o}=e,u=await(i.isRTL==null?void 0:i.isRTL(o.floating)),c=pr(l),f=Pi(l),d=Un(l)==="y",m=$0.has(c)?-1:1,g=u&&d?-1:1,y=mr(r,e);let{mainAxis:b,crossAxis:v,alignmentAxis:k}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return f&&typeof k=="number"&&(v=f==="end"?k*-1:k),d?{x:v*g,y:b*m}:{x:b*m,y:v*g}}const zT=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(r){var l,i;const{x:o,y:u,placement:c,middlewareData:f}=r,d=await OT(r,e);return c===((l=f.offset)==null?void 0:l.placement)&&(i=f.arrow)!=null&&i.alignmentOffset?{}:{x:o+d.x,y:u+d.y,data:{...d,placement:c}}}}},DT=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(r){const{x:l,y:i,placement:o,platform:u}=r,{mainAxis:c=!0,crossAxis:f=!1,limiter:d={fn:N=>{let{x:O,y:_}=N;return{x:O,y:_}}},...m}=mr(e,r),g={x:l,y:i},y=await u.detectOverflow(r,m),b=Un(pr(o)),v=Hh(b);let k=g[v],C=g[b];if(c){const N=v==="y"?"top":"left",O=v==="y"?"bottom":"right",_=k+y[N],U=k-y[O];k=Zd(_,k,U)}if(f){const N=b==="y"?"top":"left",O=b==="y"?"bottom":"right",_=C+y[N],U=C-y[O];C=Zd(_,C,U)}const A=d.fn({...r,[v]:k,[b]:C});return{...A,data:{x:A.x-l,y:A.y-i,enabled:{[v]:c,[b]:f}}}}}},LT=function(e){return e===void 0&&(e={}),{options:e,fn(r){const{x:l,y:i,placement:o,rects:u,middlewareData:c}=r,{offset:f=0,mainAxis:d=!0,crossAxis:m=!0}=mr(e,r),g={x:l,y:i},y=Un(o),b=Hh(y);let v=g[b],k=g[y];const C=mr(f,r),A=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(d){const _=b==="y"?"height":"width",U=u.reference[b]-u.floating[_]+A.mainAxis,F=u.reference[b]+u.reference[_]-A.mainAxis;v<U?v=U:v>F&&(v=F)}if(m){var N,O;const _=b==="y"?"width":"height",U=$0.has(pr(o)),F=u.reference[y]-u.floating[_]+(U&&((N=c.offset)==null?void 0:N[y])||0)+(U?0:A.crossAxis),z=u.reference[y]+u.reference[_]+(U?0:((O=c.offset)==null?void 0:O[y])||0)-(U?A.crossAxis:0);k<F?k=F:k>z&&(k=z)}return{[b]:v,[y]:k}}}},BT=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(r){var l,i;const{placement:o,rects:u,platform:c,elements:f}=r,{apply:d=()=>{},...m}=mr(e,r),g=await c.detectOverflow(r,m),y=pr(o),b=Pi(o),v=Un(o)==="y",{width:k,height:C}=u.floating;let A,N;y==="top"||y==="bottom"?(A=y,N=b===(await(c.isRTL==null?void 0:c.isRTL(f.floating))?"start":"end")?"left":"right"):(N=y,A=b==="end"?"top":"bottom");const O=C-g.top-g.bottom,_=k-g.left-g.right,U=Jr(C-g[A],O),F=Jr(k-g[N],_),z=!r.middlewareData.shift;let B=U,$=F;if((l=r.middlewareData.shift)!=null&&l.enabled.x&&($=_),(i=r.middlewareData.shift)!=null&&i.enabled.y&&(B=O),z&&!b){const P=nn(g.left,0),re=nn(g.right,0),le=nn(g.top,0),se=nn(g.bottom,0);v?$=k-2*(P!==0||re!==0?P+re:nn(g.left,g.right)):B=C-2*(le!==0||se!==0?le+se:nn(g.top,g.bottom))}await d({...r,availableWidth:$,availableHeight:B});const ae=await c.getDimensions(f.floating);return k!==ae.width||C!==ae.height?{reset:{rects:!0}}:{}}}};function Cu(){return typeof window<"u"}function qi(e){return X0(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var r;return(e==null||(r=e.ownerDocument)==null?void 0:r.defaultView)||window}function Vn(e){var r;return(r=(X0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:r.documentElement}function X0(e){return Cu()?e instanceof Node||e instanceof rn(e).Node:!1}function Cn(e){return Cu()?e instanceof Element||e instanceof rn(e).Element:!1}function gr(e){return Cu()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function ab(e){return!Cu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}function uo(e){const{overflow:r,overflowX:l,overflowY:i,display:o}=En(e);return/auto|scroll|overlay|hidden|clip/.test(r+i+l)&&o!=="inline"&&o!=="contents"}function UT(e){return/^(table|td|th)$/.test(qi(e))}function Eu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const HT=/transform|translate|scale|rotate|perspective|filter/,PT=/paint|layout|strict|content/,Nl=e=>!!e&&e!=="none";let xd;function Fh(e){const r=Cn(e)?En(e):e;return Nl(r.transform)||Nl(r.translate)||Nl(r.scale)||Nl(r.rotate)||Nl(r.perspective)||!Vh()&&(Nl(r.backdropFilter)||Nl(r.filter))||HT.test(r.willChange||"")||PT.test(r.contain||"")}function qT(e){let r=Wr(e);for(;gr(r)&&!Mi(r);){if(Fh(r))return r;if(Eu(r))return null;r=Wr(r)}return null}function Vh(){return xd==null&&(xd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xd}function Mi(e){return/^(html|body|#document)$/.test(qi(e))}function En(e){return rn(e).getComputedStyle(e)}function Nu(e){return Cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wr(e){if(qi(e)==="html")return e;const r=e.assignedSlot||e.parentNode||ab(e)&&e.host||Vn(e);return ab(r)?r.host:r}function Q0(e){const r=Wr(e);return Mi(r)?e.ownerDocument?e.ownerDocument.body:e.body:gr(r)&&uo(r)?r:Q0(r)}function eo(e,r,l){var i;r===void 0&&(r=[]),l===void 0&&(l=!0);const o=Q0(e),u=o===((i=e.ownerDocument)==null?void 0:i.body),c=rn(o);if(u){const f=Jd(c);return r.concat(c,c.visualViewport||[],uo(o)?o:[],f&&l?eo(f):[])}else return r.concat(o,eo(o,[],l))}function Jd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Z0(e){const r=En(e);let l=parseFloat(r.width)||0,i=parseFloat(r.height)||0;const o=gr(e),u=o?e.offsetWidth:l,c=o?e.offsetHeight:i,f=ru(l)!==u||ru(i)!==c;return f&&(l=u,i=c),{width:l,height:i,$:f}}function Ih(e){return Cn(e)?e:e.contextElement}function Ti(e){const r=Ih(e);if(!gr(r))return Pn(1);const l=r.getBoundingClientRect(),{width:i,height:o,$:u}=Z0(r);let c=(u?ru(l.width):l.width)/i,f=(u?ru(l.height):l.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const FT=Pn(0);function K0(e){const r=rn(e);return!Vh()||!r.visualViewport?FT:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function VT(e,r,l){return r===void 0&&(r=!1),!l||r&&l!==rn(e)?!1:r}function Rl(e,r,l,i){r===void 0&&(r=!1),l===void 0&&(l=!1);const o=e.getBoundingClientRect(),u=Ih(e);let c=Pn(1);r&&(i?Cn(i)&&(c=Ti(i)):c=Ti(e));const f=VT(u,l,i)?K0(u):Pn(0);let d=(o.left+f.x)/c.x,m=(o.top+f.y)/c.y,g=o.width/c.x,y=o.height/c.y;if(u){const b=rn(u),v=i&&Cn(i)?rn(i):i;let k=b,C=Jd(k);for(;C&&i&&v!==k;){const A=Ti(C),N=C.getBoundingClientRect(),O=En(C),_=N.left+(C.clientLeft+parseFloat(O.paddingLeft))*A.x,U=N.top+(C.clientTop+parseFloat(O.paddingTop))*A.y;d*=A.x,m*=A.y,g*=A.x,y*=A.y,d+=_,m+=U,k=rn(C),C=Jd(k)}}return iu({width:g,height:y,x:d,y:m})}function Au(e,r){const l=Nu(e).scrollLeft;return r?r.left+l:Rl(Vn(e)).left+l}function J0(e,r){const l=e.getBoundingClientRect(),i=l.left+r.scrollLeft-Au(e,l),o=l.top+r.scrollTop;return{x:i,y:o}}function IT(e){let{elements:r,rect:l,offsetParent:i,strategy:o}=e;const u=o==="fixed",c=Vn(i),f=r?Eu(r.floating):!1;if(i===c||f&&u)return l;let d={scrollLeft:0,scrollTop:0},m=Pn(1);const g=Pn(0),y=gr(i);if((y||!y&&!u)&&((qi(i)!=="body"||uo(c))&&(d=Nu(i)),y)){const v=Rl(i);m=Ti(i),g.x=v.x+i.clientLeft,g.y=v.y+i.clientTop}const b=c&&!y&&!u?J0(c,d):Pn(0);return{width:l.width*m.x,height:l.height*m.y,x:l.x*m.x-d.scrollLeft*m.x+g.x+b.x,y:l.y*m.y-d.scrollTop*m.y+g.y+b.y}}function GT(e){return Array.from(e.getClientRects())}function YT(e){const r=Vn(e),l=Nu(e),i=e.ownerDocument.body,o=nn(r.scrollWidth,r.clientWidth,i.scrollWidth,i.clientWidth),u=nn(r.scrollHeight,r.clientHeight,i.scrollHeight,i.clientHeight);let c=-l.scrollLeft+Au(e);const f=-l.scrollTop;return En(i).direction==="rtl"&&(c+=nn(r.clientWidth,i.clientWidth)-o),{width:o,height:u,x:c,y:f}}const ob=25;function $T(e,r){const l=rn(e),i=Vn(e),o=l.visualViewport;let u=i.clientWidth,c=i.clientHeight,f=0,d=0;if(o){u=o.width,c=o.height;const g=Vh();(!g||g&&r==="fixed")&&(f=o.offsetLeft,d=o.offsetTop)}const m=Au(i);if(m<=0){const g=i.ownerDocument,y=g.body,b=getComputedStyle(y),v=g.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,k=Math.abs(i.clientWidth-y.clientWidth-v);k<=ob&&(u-=k)}else m<=ob&&(u+=m);return{width:u,height:c,x:f,y:d}}function XT(e,r){const l=Rl(e,!0,r==="fixed"),i=l.top+e.clientTop,o=l.left+e.clientLeft,u=gr(e)?Ti(e):Pn(1),c=e.clientWidth*u.x,f=e.clientHeight*u.y,d=o*u.x,m=i*u.y;return{width:c,height:f,x:d,y:m}}function sb(e,r,l){let i;if(r==="viewport")i=$T(e,l);else if(r==="document")i=YT(Vn(e));else if(Cn(r))i=XT(r,l);else{const o=K0(e);i={x:r.x-o.x,y:r.y-o.y,width:r.width,height:r.height}}return iu(i)}function W0(e,r){const l=Wr(e);return l===r||!Cn(l)||Mi(l)?!1:En(l).position==="fixed"||W0(l,r)}function QT(e,r){const l=r.get(e);if(l)return l;let i=eo(e,[],!1).filter(f=>Cn(f)&&qi(f)!=="body"),o=null;const u=En(e).position==="fixed";let c=u?Wr(e):e;for(;Cn(c)&&!Mi(c);){const f=En(c),d=Fh(c);!d&&f.position==="fixed"&&(o=null),(u?!d&&!o:!d&&f.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||uo(c)&&!d&&W0(e,c))?i=i.filter(g=>g!==c):o=f,c=Wr(c)}return r.set(e,i),i}function ZT(e){let{element:r,boundary:l,rootBoundary:i,strategy:o}=e;const c=[...l==="clippingAncestors"?Eu(r)?[]:QT(r,this._c):[].concat(l),i],f=sb(r,c[0],o);let d=f.top,m=f.right,g=f.bottom,y=f.left;for(let b=1;b<c.length;b++){const v=sb(r,c[b],o);d=nn(v.top,d),m=Jr(v.right,m),g=Jr(v.bottom,g),y=nn(v.left,y)}return{width:m-y,height:g-d,x:y,y:d}}function KT(e){const{width:r,height:l}=Z0(e);return{width:r,height:l}}function JT(e,r,l){const i=gr(r),o=Vn(r),u=l==="fixed",c=Rl(e,!0,u,r);let f={scrollLeft:0,scrollTop:0};const d=Pn(0);function m(){d.x=Au(o)}if(i||!i&&!u)if((qi(r)!=="body"||uo(o))&&(f=Nu(r)),i){const v=Rl(r,!0,u,r);d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}else o&&m();u&&!i&&o&&m();const g=o&&!i&&!u?J0(o,f):Pn(0),y=c.left+f.scrollLeft-d.x-g.x,b=c.top+f.scrollTop-d.y-g.y;return{x:y,y:b,width:c.width,height:c.height}}function bd(e){return En(e).position==="static"}function ub(e,r){if(!gr(e)||En(e).position==="fixed")return null;if(r)return r(e);let l=e.offsetParent;return Vn(e)===l&&(l=l.ownerDocument.body),l}function e1(e,r){const l=rn(e);if(Eu(e))return l;if(!gr(e)){let o=Wr(e);for(;o&&!Mi(o);){if(Cn(o)&&!bd(o))return o;o=Wr(o)}return l}let i=ub(e,r);for(;i&&UT(i)&&bd(i);)i=ub(i,r);return i&&Mi(i)&&bd(i)&&!Fh(i)?l:i||qT(e)||l}const WT=async function(e){const r=this.getOffsetParent||e1,l=this.getDimensions,i=await l(e.floating);return{reference:JT(e.reference,await r(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function e_(e){return En(e).direction==="rtl"}const t_={convertOffsetParentRelativeRectToViewportRelativeRect:IT,getDocumentElement:Vn,getClippingRect:ZT,getOffsetParent:e1,getElementRects:WT,getClientRects:GT,getDimensions:KT,getScale:Ti,isElement:Cn,isRTL:e_};function t1(e,r){return e.x===r.x&&e.y===r.y&&e.width===r.width&&e.height===r.height}function n_(e,r){let l=null,i;const o=Vn(e);function u(){var f;clearTimeout(i),(f=l)==null||f.disconnect(),l=null}function c(f,d){f===void 0&&(f=!1),d===void 0&&(d=1),u();const m=e.getBoundingClientRect(),{left:g,top:y,width:b,height:v}=m;if(f||r(),!b||!v)return;const k=Ps(y),C=Ps(o.clientWidth-(g+b)),A=Ps(o.clientHeight-(y+v)),N=Ps(g),_={rootMargin:-k+"px "+-C+"px "+-A+"px "+-N+"px",threshold:nn(0,Jr(1,d))||1};let U=!0;function F(z){const B=z[0].intersectionRatio;if(B!==d){if(!U)return c();B?c(!1,B):i=setTimeout(()=>{c(!1,1e-7)},1e3)}B===1&&!t1(m,e.getBoundingClientRect())&&c(),U=!1}try{l=new IntersectionObserver(F,{..._,root:o.ownerDocument})}catch{l=new IntersectionObserver(F,_)}l.observe(e)}return c(!0),u}function r_(e,r,l,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,m=Ih(e),g=o||u?[...m?eo(m):[],...r?eo(r):[]]:[];g.forEach(N=>{o&&N.addEventListener("scroll",l,{passive:!0}),u&&N.addEventListener("resize",l)});const y=m&&f?n_(m,l):null;let b=-1,v=null;c&&(v=new ResizeObserver(N=>{let[O]=N;O&&O.target===m&&v&&r&&(v.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var _;(_=v)==null||_.observe(r)})),l()}),m&&!d&&v.observe(m),r&&v.observe(r));let k,C=d?Rl(e):null;d&&A();function A(){const N=Rl(e);C&&!t1(C,N)&&l(),C=N,k=requestAnimationFrame(A)}return l(),()=>{var N;g.forEach(O=>{o&&O.removeEventListener("scroll",l),u&&O.removeEventListener("resize",l)}),y==null||y(),(N=v)==null||N.disconnect(),v=null,d&&cancelAnimationFrame(k)}}const l_=zT,i_=DT,a_=RT,o_=BT,s_=MT,cb=_T,u_=LT,c_=(e,r,l)=>{const i=new Map,o={platform:t_,...l},u={...o.platform,_c:i};return TT(e,r,{...o,platform:u})};var f_=typeof document<"u",d_=function(){},Ks=f_?S.useLayoutEffect:d_;function au(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(typeof e=="function"&&e.toString()===r.toString())return!0;let l,i,o;if(e&&r&&typeof e=="object"){if(Array.isArray(e)){if(l=e.length,l!==r.length)return!1;for(i=l;i--!==0;)if(!au(e[i],r[i]))return!1;return!0}if(o=Object.keys(e),l=o.length,l!==Object.keys(r).length)return!1;for(i=l;i--!==0;)if(!{}.hasOwnProperty.call(r,o[i]))return!1;for(i=l;i--!==0;){const u=o[i];if(!(u==="_owner"&&e.$$typeof)&&!au(e[u],r[u]))return!1}return!0}return e!==e&&r!==r}function n1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fb(e,r){const l=n1(e);return Math.round(r*l)/l}function vd(e){const r=S.useRef(e);return Ks(()=>{r.current=e}),r}function h_(e){e===void 0&&(e={});const{placement:r="bottom",strategy:l="absolute",middleware:i=[],platform:o,elements:{reference:u,floating:c}={},transform:f=!0,whileElementsMounted:d,open:m}=e,[g,y]=S.useState({x:0,y:0,strategy:l,placement:r,middlewareData:{},isPositioned:!1}),[b,v]=S.useState(i);au(b,i)||v(i);const[k,C]=S.useState(null),[A,N]=S.useState(null),O=S.useCallback(ne=>{ne!==z.current&&(z.current=ne,C(ne))},[]),_=S.useCallback(ne=>{ne!==B.current&&(B.current=ne,N(ne))},[]),U=u||k,F=c||A,z=S.useRef(null),B=S.useRef(null),$=S.useRef(g),ae=d!=null,P=vd(d),re=vd(o),le=vd(m),se=S.useCallback(()=>{if(!z.current||!B.current)return;const ne={placement:r,strategy:l,middleware:b};re.current&&(ne.platform=re.current),c_(z.current,B.current,ne).then(ie=>{const j={...ie,isPositioned:le.current!==!1};J.current&&!au($.current,j)&&($.current=j,kh.flushSync(()=>{y(j)}))})},[b,r,l,re,le]);Ks(()=>{m===!1&&$.current.isPositioned&&($.current.isPositioned=!1,y(ne=>({...ne,isPositioned:!1})))},[m]);const J=S.useRef(!1);Ks(()=>(J.current=!0,()=>{J.current=!1}),[]),Ks(()=>{if(U&&(z.current=U),F&&(B.current=F),U&&F){if(P.current)return P.current(U,F,se);se()}},[U,F,se,P,ae]);const Z=S.useMemo(()=>({reference:z,floating:B,setReference:O,setFloating:_}),[O,_]),D=S.useMemo(()=>({reference:U,floating:F}),[U,F]),X=S.useMemo(()=>{const ne={position:l,left:0,top:0};if(!D.floating)return ne;const ie=fb(D.floating,g.x),j=fb(D.floating,g.y);return f?{...ne,transform:"translate("+ie+"px, "+j+"px)",...n1(D.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:ie,top:j}},[l,f,D.floating,g.x,g.y]);return S.useMemo(()=>({...g,update:se,refs:Z,elements:D,floatingStyles:X}),[g,se,Z,D,X])}const m_=e=>{function r(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:e,fn(l){const{element:i,padding:o}=typeof e=="function"?e(l):e;return i&&r(i)?i.current!=null?cb({element:i.current,padding:o}).fn(l):{}:i?cb({element:i,padding:o}).fn(l):{}}}},p_=(e,r)=>{const l=l_(e);return{name:l.name,fn:l.fn,options:[e,r]}},g_=(e,r)=>{const l=i_(e);return{name:l.name,fn:l.fn,options:[e,r]}},y_=(e,r)=>({fn:u_(e).fn,options:[e,r]}),x_=(e,r)=>{const l=a_(e);return{name:l.name,fn:l.fn,options:[e,r]}},b_=(e,r)=>{const l=o_(e);return{name:l.name,fn:l.fn,options:[e,r]}},v_=(e,r)=>{const l=s_(e);return{name:l.name,fn:l.fn,options:[e,r]}},w_=(e,r)=>{const l=m_(e);return{name:l.name,fn:l.fn,options:[e,r]}};var S_="Arrow",r1=S.forwardRef((e,r)=>{const{children:l,width:i=10,height:o=5,...u}=e;return x.jsx(_t.svg,{...u,ref:r,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?l:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});r1.displayName=S_;var k_=r1;function C_(e){const[r,l]=S.useState(void 0);return Zr(()=>{if(e){l({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const u=o[0];let c,f;if("borderBoxSize"in u){const d=u.borderBoxSize,m=Array.isArray(d)?d[0]:d;c=m.inlineSize,f=m.blockSize}else c=e.offsetWidth,f=e.offsetHeight;l({width:c,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else l(void 0)},[e]),r}var Gh="Popper",[l1,ju]=xu(Gh),[E_,i1]=l1(Gh),a1=e=>{const{__scopePopper:r,children:l}=e,[i,o]=S.useState(null);return x.jsx(E_,{scope:r,anchor:i,onAnchorChange:o,children:l})};a1.displayName=Gh;var o1="PopperAnchor",s1=S.forwardRef((e,r)=>{const{__scopePopper:l,virtualRef:i,...o}=e,u=i1(o1,l),c=S.useRef(null),f=an(r,c),d=S.useRef(null);return S.useEffect(()=>{const m=d.current;d.current=(i==null?void 0:i.current)||c.current,m!==d.current&&u.onAnchorChange(d.current)}),i?null:x.jsx(_t.div,{...o,ref:f})});s1.displayName=o1;var Yh="PopperContent",[N_,A_]=l1(Yh),u1=S.forwardRef((e,r)=>{var Ce,Ue,ve,at,dt,At;const{__scopePopper:l,side:i="bottom",sideOffset:o=0,align:u="center",alignOffset:c=0,arrowPadding:f=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:k,...C}=e,A=i1(Yh,l),[N,O]=S.useState(null),_=an(r,wt=>O(wt)),[U,F]=S.useState(null),z=C_(U),B=(z==null?void 0:z.width)??0,$=(z==null?void 0:z.height)??0,ae=i+(u!=="center"?"-"+u:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},re=Array.isArray(m)?m:[m],le=re.length>0,se={padding:P,boundary:re.filter(T_),altBoundary:le},{refs:J,floatingStyles:Z,placement:D,isPositioned:X,middlewareData:ne}=h_({strategy:"fixed",placement:ae,whileElementsMounted:(...wt)=>r_(...wt,{animationFrame:v==="always"}),elements:{reference:A.anchor},middleware:[p_({mainAxis:o+$,alignmentAxis:c}),d&&g_({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?y_():void 0,...se}),d&&x_({...se}),b_({...se,apply:({elements:wt,rects:ht,availableWidth:jn,availableHeight:Tn})=>{const{width:xr,height:br}=ht.reference,$t=wt.floating.style;$t.setProperty("--radix-popper-available-width",`${jn}px`),$t.setProperty("--radix-popper-available-height",`${Tn}px`),$t.setProperty("--radix-popper-anchor-width",`${xr}px`),$t.setProperty("--radix-popper-anchor-height",`${br}px`)}}),U&&w_({element:U,padding:f}),__({arrowWidth:B,arrowHeight:$}),b&&v_({strategy:"referenceHidden",...se})]}),[ie,j]=d1(D),R=Ri(k);Zr(()=>{X&&(R==null||R())},[X,R]);const G=(Ce=ne.arrow)==null?void 0:Ce.x,T=(Ue=ne.arrow)==null?void 0:Ue.y,ue=((ve=ne.arrow)==null?void 0:ve.centerOffset)!==0,[de,ce]=S.useState();return Zr(()=>{N&&ce(window.getComputedStyle(N).zIndex)},[N]),x.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:X?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(at=ne.transformOrigin)==null?void 0:at.x,(dt=ne.transformOrigin)==null?void 0:dt.y].join(" "),...((At=ne.hide)==null?void 0:At.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:x.jsx(N_,{scope:l,placedSide:ie,onArrowChange:F,arrowX:G,arrowY:T,shouldHideArrow:ue,children:x.jsx(_t.div,{"data-side":ie,"data-align":j,...C,ref:_,style:{...C.style,animation:X?void 0:"none"}})})})});u1.displayName=Yh;var c1="PopperArrow",j_={top:"bottom",right:"left",bottom:"top",left:"right"},f1=S.forwardRef(function(r,l){const{__scopePopper:i,...o}=r,u=A_(c1,i),c=j_[u.placedSide];return x.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:x.jsx(k_,{...o,ref:l,style:{...o.style,display:"block"}})})});f1.displayName=c1;function T_(e){return e!==null}var __=e=>({name:"transformOrigin",options:e,fn(r){var A,N,O;const{placement:l,rects:i,middlewareData:o}=r,c=((A=o.arrow)==null?void 0:A.centerOffset)!==0,f=c?0:e.arrowWidth,d=c?0:e.arrowHeight,[m,g]=d1(l),y={start:"0%",center:"50%",end:"100%"}[g],b=(((N=o.arrow)==null?void 0:N.x)??0)+f/2,v=(((O=o.arrow)==null?void 0:O.y)??0)+d/2;let k="",C="";return m==="bottom"?(k=c?y:`${b}px`,C=`${-d}px`):m==="top"?(k=c?y:`${b}px`,C=`${i.floating.height+d}px`):m==="right"?(k=`${-d}px`,C=c?y:`${v}px`):m==="left"&&(k=`${i.floating.width+d}px`,C=c?y:`${v}px`),{data:{x:k,y:C}}}});function d1(e){const[r,l="center"]=e.split("-");return[r,l]}var h1=a1,$h=s1,m1=u1,p1=f1,R_=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),M_="VisuallyHidden",g1=S.forwardRef((e,r)=>x.jsx(_t.span,{...e,ref:r,style:{...R_,...e.style}}));g1.displayName=M_;var O_=g1,[Tu]=xu("Tooltip",[ju]),_u=ju(),y1="TooltipProvider",z_=700,Wd="tooltip.open",[D_,Xh]=Tu(y1),x1=e=>{const{__scopeTooltip:r,delayDuration:l=z_,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:u}=e,c=S.useRef(!0),f=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),x.jsx(D_,{scope:r,isOpenDelayedRef:c,delayDuration:l,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,i)},[i]),isPointerInTransitRef:f,onPointerInTransitChange:S.useCallback(m=>{f.current=m},[]),disableHoverableContent:o,children:u})};x1.displayName=y1;var to="Tooltip",[L_,co]=Tu(to),b1=e=>{const{__scopeTooltip:r,children:l,open:i,defaultOpen:o,onOpenChange:u,disableHoverableContent:c,delayDuration:f}=e,d=Xh(to,e.__scopeTooltip),m=_u(r),[g,y]=S.useState(null),b=Xa(),v=S.useRef(0),k=c??d.disableHoverableContent,C=f??d.delayDuration,A=S.useRef(!1),[N,O]=Nh({prop:i,defaultProp:o??!1,onChange:B=>{B?(d.onOpen(),document.dispatchEvent(new CustomEvent(Wd))):d.onClose(),u==null||u(B)},caller:to}),_=S.useMemo(()=>N?A.current?"delayed-open":"instant-open":"closed",[N]),U=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,A.current=!1,O(!0)},[O]),F=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O(!1)},[O]),z=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{A.current=!0,O(!0),v.current=0},C)},[C,O]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),x.jsx(h1,{...m,children:x.jsx(L_,{scope:r,contentId:b,open:N,stateAttribute:_,trigger:g,onTriggerChange:y,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?z():U()},[d.isOpenDelayedRef,z,U]),onTriggerLeave:S.useCallback(()=>{k?F():(window.clearTimeout(v.current),v.current=0)},[F,k]),onOpen:U,onClose:F,disableHoverableContent:k,children:l})})};b1.displayName=to;var eh="TooltipTrigger",v1=S.forwardRef((e,r)=>{const{__scopeTooltip:l,...i}=e,o=co(eh,l),u=Xh(eh,l),c=_u(l),f=S.useRef(null),d=an(r,f,o.onTriggerChange),m=S.useRef(!1),g=S.useRef(!1),y=S.useCallback(()=>m.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),x.jsx($h,{asChild:!0,...c,children:x.jsx(_t.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:d,onPointerMove:yt(e.onPointerMove,b=>{b.pointerType!=="touch"&&!g.current&&!u.isPointerInTransitRef.current&&(o.onTriggerEnter(),g.current=!0)}),onPointerLeave:yt(e.onPointerLeave,()=>{o.onTriggerLeave(),g.current=!1}),onPointerDown:yt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:yt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:yt(e.onBlur,o.onClose),onClick:yt(e.onClick,o.onClose)})})});v1.displayName=eh;var Qh="TooltipPortal",[B_,U_]=Tu(Qh,{forceMount:void 0}),w1=e=>{const{__scopeTooltip:r,forceMount:l,children:i,container:o}=e,u=co(Qh,r);return x.jsx(B_,{scope:r,forceMount:l,children:x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:i})})})};w1.displayName=Qh;var Oi="TooltipContent",S1=S.forwardRef((e,r)=>{const l=U_(Oi,e.__scopeTooltip),{forceMount:i=l.forceMount,side:o="top",...u}=e,c=co(Oi,e.__scopeTooltip);return x.jsx(nl,{present:i||c.open,children:c.disableHoverableContent?x.jsx(k1,{side:o,...u,ref:r}):x.jsx(H_,{side:o,...u,ref:r})})}),H_=S.forwardRef((e,r)=>{const l=co(Oi,e.__scopeTooltip),i=Xh(Oi,e.__scopeTooltip),o=S.useRef(null),u=an(r,o),[c,f]=S.useState(null),{trigger:d,onClose:m}=l,g=o.current,{onPointerInTransitChange:y}=i,b=S.useCallback(()=>{f(null),y(!1)},[y]),v=S.useCallback((k,C)=>{const A=k.currentTarget,N={x:k.clientX,y:k.clientY},O=I_(N,A.getBoundingClientRect()),_=G_(N,O),U=Y_(C.getBoundingClientRect()),F=X_([..._,...U]);f(F),y(!0)},[y]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(d&&g){const k=A=>v(A,g),C=A=>v(A,d);return d.addEventListener("pointerleave",k),g.addEventListener("pointerleave",C),()=>{d.removeEventListener("pointerleave",k),g.removeEventListener("pointerleave",C)}}},[d,g,v,b]),S.useEffect(()=>{if(c){const k=C=>{const A=C.target,N={x:C.clientX,y:C.clientY},O=(d==null?void 0:d.contains(A))||(g==null?void 0:g.contains(A)),_=!$_(N,c);O?b():_&&(b(),m())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[d,g,c,m,b]),x.jsx(k1,{...e,ref:u})}),[P_,q_]=Tu(to,{isInside:!1}),F_=mN("TooltipContent"),k1=S.forwardRef((e,r)=>{const{__scopeTooltip:l,children:i,"aria-label":o,onEscapeKeyDown:u,onPointerDownOutside:c,...f}=e,d=co(Oi,l),m=_u(l),{onClose:g}=d;return S.useEffect(()=>(document.addEventListener(Wd,g),()=>document.removeEventListener(Wd,g)),[g]),S.useEffect(()=>{if(d.trigger){const y=b=>{const v=b.target;v!=null&&v.contains(d.trigger)&&g()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[d.trigger,g]),x.jsx(bu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:y=>y.preventDefault(),onDismiss:g,children:x.jsxs(m1,{"data-state":d.stateAttribute,...m,...f,ref:r,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[x.jsx(F_,{children:i}),x.jsx(P_,{scope:l,isInside:!0,children:x.jsx(O_,{id:d.contentId,role:"tooltip",children:o||i})})]})})});S1.displayName=Oi;var C1="TooltipArrow",V_=S.forwardRef((e,r)=>{const{__scopeTooltip:l,...i}=e,o=_u(l);return q_(C1,l).isInside?null:x.jsx(p1,{...o,...i,ref:r})});V_.displayName=C1;function I_(e,r){const l=Math.abs(r.top-e.y),i=Math.abs(r.bottom-e.y),o=Math.abs(r.right-e.x),u=Math.abs(r.left-e.x);switch(Math.min(l,i,o,u)){case u:return"left";case o:return"right";case l:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function G_(e,r,l=5){const i=[];switch(r){case"top":i.push({x:e.x-l,y:e.y+l},{x:e.x+l,y:e.y+l});break;case"bottom":i.push({x:e.x-l,y:e.y-l},{x:e.x+l,y:e.y-l});break;case"left":i.push({x:e.x+l,y:e.y-l},{x:e.x+l,y:e.y+l});break;case"right":i.push({x:e.x-l,y:e.y-l},{x:e.x-l,y:e.y+l});break}return i}function Y_(e){const{top:r,right:l,bottom:i,left:o}=e;return[{x:o,y:r},{x:l,y:r},{x:l,y:i},{x:o,y:i}]}function $_(e,r){const{x:l,y:i}=e;let o=!1;for(let u=0,c=r.length-1;u<r.length;c=u++){const f=r[u],d=r[c],m=f.x,g=f.y,y=d.x,b=d.y;g>i!=b>i&&l<(y-m)*(i-g)/(b-g)+m&&(o=!o)}return o}function X_(e){const r=e.slice();return r.sort((l,i)=>l.x<i.x?-1:l.x>i.x?1:l.y<i.y?-1:l.y>i.y?1:0),Q_(r)}function Q_(e){if(e.length<=1)return e.slice();const r=[];for(let i=0;i<e.length;i++){const o=e[i];for(;r.length>=2;){const u=r[r.length-1],c=r[r.length-2];if((u.x-c.x)*(o.y-c.y)>=(u.y-c.y)*(o.x-c.x))r.pop();else break}r.push(o)}r.pop();const l=[];for(let i=e.length-1;i>=0;i--){const o=e[i];for(;l.length>=2;){const u=l[l.length-1],c=l[l.length-2];if((u.x-c.x)*(o.y-c.y)>=(u.y-c.y)*(o.x-c.x))l.pop();else break}l.push(o)}return l.pop(),r.length===1&&l.length===1&&r[0].x===l[0].x&&r[0].y===l[0].y?r:r.concat(l)}var Z_=x1,K_=b1,J_=v1,W_=w1,E1=S1;const eR=Z_,ou=K_,su=J_,no=S.forwardRef(({className:e,sideOffset:r=4,...l},i)=>x.jsx(W_,{children:x.jsx(E1,{ref:i,sideOffset:r,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...l})}));no.displayName=E1.displayName;const zt="Kanna",db="kanna",tR="[kanna]",nR=`~/${zt}`;function qs(e){return e?`${db} ${e}`:db}const rR={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function lR({value:e,onValueChange:r,options:l,size:i="md",className:o,optionClassName:u}){return x.jsx("div",{className:xe("inline-flex items-center rounded-full border border-border p-0.5 ",o),children:l.map(c=>{const f=c.value===e,d=c.icon,m=d?S.isValidElement(d)?d:(()=>{const y=d;return x.jsx(y,{className:i==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,g=x.jsxs("button",{type:"button",onClick:()=>r(c.value),disabled:c.disabled,"aria-pressed":f,className:xe("rounded-full border transition-colors",d?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",rR[i],f?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",c.disabled&&"opacity-50 pointer-events-none",u),children:[m,x.jsx("span",{children:c.label})]},c.value);return c.tooltip?x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:g}),x.jsx(no,{children:c.tooltip})]},c.value):g})})}function iR(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function N1({open:e,onOpenChange:r,onConfirm:l}){const[i,o]=S.useState("new"),[u,c]=S.useState(""),[f,d]=S.useState(""),m=S.useRef(null),g=S.useRef(null);S.useEffect(()=>{e&&(o("new"),c(""),d(""),setTimeout(()=>{var A;return(A=m.current)==null?void 0:A.focus()},0))},[e]),S.useEffect(()=>{e&&setTimeout(()=>{var A,N;i==="new"?(A=m.current)==null||A.focus():(N=g.current)==null||N.focus()},0)},[i,e]);const y=iR(u),b=y?`${nR}/${y}`:"",v=f.trim(),k=i==="new"?!!y:!!v,C=()=>{if(k){if(i==="new")l({mode:"new",localPath:b,title:u.trim()});else{const A=v.split("/").pop()||v;l({mode:"existing",localPath:v,title:A})}r(!1)}};return x.jsx(P0,{open:e,onOpenChange:r,children:x.jsxs(Uh,{size:"sm",children:[x.jsxs(V0,{className:"space-y-4",children:[x.jsx(F0,{children:"Add Project"}),x.jsx(lR,{value:i,onValueChange:o,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full",optionClassName:"flex-1 justify-center"}),i==="new"?x.jsxs("div",{className:"space-y-2",children:[x.jsx("input",{ref:m,type:"text",value:u,onChange:A=>c(A.target.value),onKeyDown:A=>{A.key==="Enter"&&C(),A.key==="Escape"&&r(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"Project name"}),b&&x.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:b})]}):x.jsxs("div",{className:"space-y-2",children:[x.jsx("input",{ref:g,type:"text",value:f,onChange:A=>d(A.target.value),onKeyDown:A=>{A.key==="Enter"&&C(),A.key==="Escape"&&r(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"~/Projects/my-app"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),x.jsxs(I0,{children:[x.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),x.jsx(qe,{variant:"secondary",size:"sm",onClick:C,disabled:!k,children:"Create"})]})]})})}const Ru=({children:e,className:r,shimmerWidth:l=100,animate:i=!0,...o})=>x.jsx("span",{style:{"--shiny-width":`${Math.min(l,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",i?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],r),...o,children:e}),aR=new Set(["starting","running"]);function oR({chat:e,activeChatId:r,onSelectChat:l,onDeleteChat:i}){return x.jsxs("div",{"data-chat-id":Bx(e.chatId),className:xe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-md cursor-pointer border-border/0 hover:border-border hover:bg-muted active:bg-muted border transition-colors",r===Bx(e.chatId)?"bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>l(e.chatId),children:[aR.has(e.status)?x.jsx(zl,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?x.jsx("div",{className:"relative ",children:x.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[x.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),x.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,x.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?x.jsx(Ru,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),x.jsx(qe,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-100 md:opacity-0 md:group-hover:opacity-100 cursor-pointer rounded-sm hover:!bg-transparent",onClick:o=>{o.stopPropagation(),i(e.chatId)},title:"Delete chat",children:x.jsx(so,{className:"size-3.5"})})]},e._id)}function jl(e){return e.split(/[\s_-]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" ")}function A1(e){return e.split("/").pop()||e}var Mu="Popover",[j1]=xu(Mu,[ju]),fo=ju(),[sR,rl]=j1(Mu),T1=e=>{const{__scopePopover:r,children:l,open:i,defaultOpen:o,onOpenChange:u,modal:c=!1}=e,f=fo(r),d=S.useRef(null),[m,g]=S.useState(!1),[y,b]=Nh({prop:i,defaultProp:o??!1,onChange:u,caller:Mu});return x.jsx(h1,{...f,children:x.jsx(sR,{scope:r,contentId:Xa(),triggerRef:d,open:y,onOpenChange:b,onOpenToggle:S.useCallback(()=>b(v=>!v),[b]),hasCustomAnchor:m,onCustomAnchorAdd:S.useCallback(()=>g(!0),[]),onCustomAnchorRemove:S.useCallback(()=>g(!1),[]),modal:c,children:l})})};T1.displayName=Mu;var _1="PopoverAnchor",uR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(_1,l),u=fo(l),{onCustomAnchorAdd:c,onCustomAnchorRemove:f}=o;return S.useEffect(()=>(c(),()=>f()),[c,f]),x.jsx($h,{...u,...i,ref:r})});uR.displayName=_1;var R1="PopoverTrigger",M1=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(R1,l),u=fo(l),c=an(r,o.triggerRef),f=x.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":B1(o.open),...i,ref:c,onClick:yt(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?f:x.jsx($h,{asChild:!0,...u,children:f})});M1.displayName=R1;var Zh="PopoverPortal",[cR,fR]=j1(Zh,{forceMount:void 0}),O1=e=>{const{__scopePopover:r,forceMount:l,children:i,container:o}=e,u=rl(Zh,r);return x.jsx(cR,{scope:r,forceMount:l,children:x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:i})})})};O1.displayName=Zh;var zi="PopoverContent",z1=S.forwardRef((e,r)=>{const l=fR(zi,e.__scopePopover),{forceMount:i=l.forceMount,...o}=e,u=rl(zi,e.__scopePopover);return x.jsx(nl,{present:i||u.open,children:u.modal?x.jsx(hR,{...o,ref:r}):x.jsx(mR,{...o,ref:r})})});z1.displayName=zi;var dR=Ah("PopoverContent.RemoveScroll"),hR=S.forwardRef((e,r)=>{const l=rl(zi,e.__scopePopover),i=S.useRef(null),o=an(r,i),u=S.useRef(!1);return S.useEffect(()=>{const c=i.current;if(c)return d0(c)},[]),x.jsx(Th,{as:dR,allowPinchZoom:!0,children:x.jsx(D1,{...e,ref:o,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(e.onCloseAutoFocus,c=>{var f;c.preventDefault(),u.current||(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:yt(e.onPointerDownOutside,c=>{const f=c.detail.originalEvent,d=f.button===0&&f.ctrlKey===!0,m=f.button===2||d;u.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:yt(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),mR=S.forwardRef((e,r)=>{const l=rl(zi,e.__scopePopover),i=S.useRef(!1),o=S.useRef(!1);return x.jsx(D1,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,u),u.defaultPrevented||(i.current||(f=l.triggerRef.current)==null||f.focus(),u.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:u=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=u.target;((m=l.triggerRef.current)==null?void 0:m.contains(c))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&o.current&&u.preventDefault()}})}),D1=S.forwardRef((e,r)=>{const{__scopePopover:l,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:m,onInteractOutside:g,...y}=e,b=rl(zi,l),v=fo(l);return r0(),x.jsx(jh,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:u,children:x.jsx(bu,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:g,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:m,onDismiss:()=>b.onOpenChange(!1),children:x.jsx(m1,{"data-state":B1(b.open),role:"dialog",id:b.contentId,...v,...y,ref:r,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L1="PopoverClose",pR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(L1,l);return x.jsx(_t.button,{type:"button",...i,ref:r,onClick:yt(e.onClick,()=>o.onOpenChange(!1))})});pR.displayName=L1;var gR="PopoverArrow",yR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=fo(l);return x.jsx(p1,{...o,...i,ref:r})});yR.displayName=gR;function B1(e){return e?"open":"closed"}var xR=T1,bR=M1,vR=O1,U1=z1;const H1=xR,P1=bR,Kh=S.forwardRef(({className:e,align:r="center",sideOffset:l=4,...i},o)=>x.jsx(vR,{children:x.jsx(U1,{ref:o,align:r,sideOffset:l,className:xe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));Kh.displayName=U1.displayName;function wR({onRemove:e}){const[r,l]=S.useState(!1);return x.jsxs(H1,{open:r,onOpenChange:l,children:[x.jsx(P1,{asChild:!0,children:x.jsx(qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 absolute right-6 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",onClick:i=>i.stopPropagation(),children:x.jsx(Nj,{className:"h-4 w-4 text-slate-500 dark:text-slate-400"})})}),x.jsx(Kh,{align:"end",className:"p-1 w-auto min-w-[170px]",children:x.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!1),e()},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg text-left transition-colors text-destructive dark:text-red-400 hover:bg-destructive/10 dark:hover:bg-red-500/20",children:[x.jsx(uT,{className:"h-4 w-4"}),x.jsx("span",{className:"text-xs font-medium",children:"Remove Project"})]})})]})}function SR({projectGroups:e,collapsedSections:r,expandedGroups:l,onToggleSection:i,onToggleExpandedGroup:o,renderChatRow:u,chatsPerProject:c,onNewLocalChat:f,onRemoveProject:d,isConnected:m,startingLocalPath:g}){return x.jsx(x.Fragment,{children:e.map(({groupKey:y,localPath:b,chats:v})=>{const k=l.has(y),C=k?v:v.slice(0,c),A=v.length>c;return x.jsxs("div",{className:"group/section",children:[x.jsxs("div",{className:"sticky top-0 bg-background dark:bg-card z-10 relative pl-2.5 pr-3 py-2 pt-3 cursor-pointer flex items-center justify-between",onClick:()=>i(y),children:[x.jsxs("div",{className:"flex items-center gap-2",children:[r.has(y)?x.jsx(O0,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500"}):x.jsx(M0,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500"}),x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:A1(b)})}),x.jsx(no,{side:"right",sideOffset:4,children:b})]}),x.jsx(Kr,{className:xe("size-3.5 translate-y-[1px] text-slate-400 transition-all duration-200",r.has(y)?"opacity-100":"rotate-90 opacity-0 group-hover/section:opacity-100")})]}),d?x.jsx(wR,{onRemove:()=>d(y)}):null,f&&x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsx(qe,{variant:"ghost",size:"icon",className:xe("h-5.5 w-5.5 absolute right-0 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!m||g===b)&&"opacity-50 cursor-not-allowed"),disabled:!m||g===b,onClick:N=>{N.stopPropagation(),f(b)},children:g===b?x.jsx(zl,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):x.jsx(Dh,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),x.jsx(no,{side:"right",sideOffset:4,children:m?"New chat":`Start ${zt} to connect`})]})]}),!r.has(y)&&x.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[C.map(u),A&&x.jsx("button",{onClick:()=>o(y),className:"pl-3 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:k?"Show less":`Show more (${v.length-c})`})]})]},y)})})}function kR({data:e,activeChatId:r,connectionStatus:l,ready:i,open:o,collapsed:u,showMobileOpenButton:c,onOpen:f,onClose:d,onCollapse:m,onExpand:g,onCreateChat:y,onCreateProject:b,onDeleteChat:v,onRemoveProject:k}){const C=Fn(),A=xh(),N=S.useRef(null),[O,_]=S.useState(new Set),[U,F]=S.useState(new Set),[z,B]=S.useState(!1),$=10,ae=S.useMemo(()=>new Map(e.projectGroups.map(ie=>[ie.localPath,ie.groupKey])),[e.projectGroups]),P=S.useMemo(()=>e.projectGroups.reduce((ie,j)=>ie+j.chats.length,0),[e.projectGroups]),re=S.useCallback(ie=>{_(j=>{const R=new Set(j);return R.has(ie)?R.delete(ie):R.add(ie),R})},[]),le=S.useCallback(ie=>{F(j=>{const R=new Set(j);return R.has(ie)?R.delete(ie):R.add(ie),R})},[]),se=S.useCallback(ie=>x.jsx(oR,{chat:ie,activeChatId:r,onSelectChat:j=>A(`/chat/${j}`),onDeleteChat:()=>v(ie)},ie._id),[r,A,v]);S.useEffect(()=>{!r||!N.current||requestAnimationFrame(()=>{const ie=N.current,j=ie==null?void 0:ie.querySelector(`[data-chat-id="${r}"]`);if(!j||!ie)return;const R=j.getBoundingClientRect(),G=ie.getBoundingClientRect();if(R.top<G.top+38){const T=R.top-G.top+ie.scrollTop;ie.scrollTo({top:T-38,behavior:"smooth"})}else if(R.bottom>G.bottom){const T=R.top+R.height/2-G.top+ie.scrollTop,ue=ie.clientHeight/2;ie.scrollTo({top:T-ue,behavior:"smooth"})}})},[r,P]);const J=P>0,Z=C.pathname==="/projects",D=l==="connecting"||!i,X=D?"Connecting":l==="connected"?"Connected":"Disconnected",ne=l==="connected"?"bg-emerald-500":"bg-amber-500";return x.jsxs(x.Fragment,{children:[!o&&c&&x.jsx(qe,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:f,children:x.jsx(z0,{className:"h-5 w-5"})}),u&&Z&&x.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:x.jsxs("div",{className:"flex items-center gap-1",children:[x.jsx(Qa,{className:"size-6 text-logo"}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:g,title:"Expand sidebar",children:x.jsx(Qd,{className:"h-5 w-5"})})]})}),x.jsxs("div",{"data-sidebar":"open",className:xe("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-2 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",o?"flex":"hidden md:flex",u&&"md:hidden"),children:[x.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[x.jsxs("div",{className:"group/sidebar-header flex items-center gap-2",children:[x.jsxs("button",{type:"button",onClick:m,title:"Collapse sidebar",className:"hidden md:flex relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[x.jsx(Qa,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-header:opacity-0 group-hover/sidebar-header:scale-0"}),x.jsx(Qd,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-header:opacity-100 group-hover/sidebar-header:scale-80 hover:opacity-50"})]}),x.jsx(Qa,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),x.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:zt})]}),x.jsxs("div",{className:"flex items-center",children:[x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>B(!0),title:"New project",children:x.jsx(U0,{className:"size-4"})}),x.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden",onClick:d,children:x.jsx(so,{className:"h-5 w-5"})})]})]}),x.jsx("div",{ref:N,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:x.jsxs("div",{className:"pb-2 px-2 pt-1.5",children:[!J&&D?x.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(ie=>x.jsxs("div",{className:"space-y-2 animate-pulse",children:[x.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),x.jsx("div",{className:"space-y-1",children:[0,1,2].map(j=>x.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[x.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),x.jsx("div",{className:xe("h-3.5 rounded bg-muted",j===0?"w-32":j===1?"w-40":"w-28")})]},j))})]},ie))}):null,!J&&!D&&e.projectGroups.length===0?x.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,x.jsx(SR,{projectGroups:e.projectGroups,collapsedSections:O,expandedGroups:U,onToggleSection:re,onToggleExpandedGroup:le,renderChatRow:se,chatsPerProject:$,onNewLocalChat:ie=>{const j=ae.get(ie);j&&y(j)},onRemoveProject:k,isConnected:l==="connected"})]})}),x.jsx("div",{className:"border-t border-border p-2",children:x.jsx("button",{type:"button",onClick:()=>{A("/projects"),d()},className:xe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",Z?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:x.jsxs("div",{className:"flex items- justify-between gap-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Oh,{className:"h-4 w-4 text-muted-foreground"}),x.jsx("span",{className:"text-sm",children:"Projects"})]}),x.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[x.jsx("span",{children:X}),D?x.jsx(zl,{className:"h-2 w-2 animate-spin"}):x.jsx("span",{className:xe("h-2 w-2 rounded-full",ne)})]})]})})})]}),x.jsx(N1,{open:z,onOpenChange:B,onConfirm:b}),o?x.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:d}):null]})}const q1=S.forwardRef(({className:e,...r},l)=>x.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:xe("flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),ref:l,...r}));q1.displayName="Textarea";function CR(){const[e,r]=S.useState(()=>{if(typeof window>"u")return!1;const l=navigator.standalone===!0,i=window.matchMedia("(display-mode: standalone)").matches;return l||i});return S.useEffect(()=>{const l=window.matchMedia("(display-mode: standalone)"),i=o=>{r(o.matches||navigator.standalone===!0)};return l.addEventListener("change",i),()=>l.removeEventListener("change",i)},[]),e}const hb=e=>{let r;const l=new Set,i=(m,g)=>{const y=typeof m=="function"?m(r):m;if(!Object.is(y,r)){const b=r;r=g??(typeof y!="object"||y===null)?y:Object.assign({},r,y),l.forEach(v=>v(r,b))}},o=()=>r,f={setState:i,getState:o,getInitialState:()=>d,subscribe:m=>(l.add(m),()=>l.delete(m))},d=r=e(i,o,f);return f},ER=(e=>e?hb(e):hb),NR=e=>e;function AR(e,r=NR){const l=Ya.useSyncExternalStore(e.subscribe,Ya.useCallback(()=>r(e.getState()),[e,r]),Ya.useCallback(()=>r(e.getInitialState()),[e,r]));return Ya.useDebugValue(l),l}const jR=e=>{const r=ER(e),l=i=>AR(r,i);return Object.assign(l,r),l},F1=(e=>jR);function TR(e,r){let l;try{l=e()}catch{return}return{getItem:o=>{var u;const c=d=>d===null?null:JSON.parse(d,void 0),f=(u=l.getItem(o))!=null?u:null;return f instanceof Promise?f.then(c):c(f)},setItem:(o,u)=>l.setItem(o,JSON.stringify(u,void 0)),removeItem:o=>l.removeItem(o)}}const th=e=>r=>{try{const l=e(r);return l instanceof Promise?l:{then(i){return th(i)(l)},catch(i){return this}}}catch(l){return{then(i){return this},catch(i){return th(i)(l)}}}},_R=(e,r)=>(l,i,o)=>{let u={storage:TR(()=>window.localStorage),partialize:A=>A,version:0,merge:(A,N)=>({...N,...A}),...r},c=!1,f=0;const d=new Set,m=new Set;let g=u.storage;if(!g)return e((...A)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),l(...A)},i,o);const y=()=>{const A=u.partialize({...i()});return g.setItem(u.name,{state:A,version:u.version})},b=o.setState;o.setState=(A,N)=>(b(A,N),y());const v=e((...A)=>(l(...A),y()),i,o);o.getInitialState=()=>v;let k;const C=()=>{var A,N;if(!g)return;const O=++f;c=!1,d.forEach(U=>{var F;return U((F=i())!=null?F:v)});const _=((N=u.onRehydrateStorage)==null?void 0:N.call(u,(A=i())!=null?A:v))||void 0;return th(g.getItem.bind(g))(u.name).then(U=>{if(U)if(typeof U.version=="number"&&U.version!==u.version){if(u.migrate){const F=u.migrate(U.state,U.version);return F instanceof Promise?F.then(z=>[!0,z]):[!0,F]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,U.state];return[!1,void 0]}).then(U=>{var F;if(O!==f)return;const[z,B]=U;if(k=u.merge(B,(F=i())!=null?F:v),l(k,!0),z)return y()}).then(()=>{O===f&&(_==null||_(k,void 0),k=i(),c=!0,m.forEach(U=>U(k)))}).catch(U=>{O===f&&(_==null||_(void 0,U))})};return o.persist={setOptions:A=>{u={...u,...A},A.storage&&(g=A.storage)},clearStorage:()=>{g==null||g.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>C(),hasHydrated:()=>c,onHydrate:A=>(d.add(A),()=>{d.delete(A)}),onFinishHydration:A=>(m.add(A),()=>{m.delete(A)})},u.skipHydration||C(),k||v},V1=_R,RR=F1()(V1((e,r)=>({drafts:{},setDraft:(l,i)=>e(o=>{if(!i){const{[l]:u,...c}=o.drafts;return{drafts:c}}return{drafts:{...o.drafts,[l]:i}}}),clearDraft:l=>e(i=>{const{[l]:o,...u}=i.drafts;return{drafts:u}}),getDraft:l=>r().drafts[l]??""}),{name:"chat-input-drafts"})),I1=F1()(V1(e=>({model:"opus",effort:"high",planMode:!1,setModel:r=>e(l=>r!=="opus"&&l.effort==="max"?{model:r,effort:"high"}:{model:r}),setEffort:r=>e({effort:r}),setPlanMode:r=>e({planMode:r})}),{name:"chat-preferences"}));function dr({onClick:e,selected:r,icon:l,label:i,description:o,disabled:u}){return x.jsxs("button",{onClick:e,disabled:u,className:xe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",r?"bg-muted border-border":"hover:opacity-60",u&&"opacity-40 cursor-not-allowed"),children:[l,x.jsxs("div",{children:[x.jsx("div",{className:"text-sm font-medium",children:i}),x.jsx("div",{className:"text-xs text-muted-foreground",children:o})]})]})}function wd({trigger:e,triggerClassName:r,children:l}){return x.jsxs(H1,{children:[x.jsx(P1,{asChild:!0,children:x.jsx("button",{className:xe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",r),children:e})}),x.jsx(Kh,{align:"center",className:"w-64 p-1",children:x.jsx("div",{className:"space-y-1",children:l})})]})}const MR={opus:zh,sonnet:H0,haiku:R0},OR={opus:"Opus",sonnet:"Sonnet",haiku:"Haiku"},zR={low:"Low",medium:"Medium",high:"High",max:"Max"},DR=S.memo(function({onSubmit:r,onCancel:l,disabled:i,canCancel:o,chatId:u}){const{getDraft:c,setDraft:f,clearDraft:d}=RR(),{model:m,effort:g,planMode:y,setModel:b,setEffort:v,setPlanMode:k}=I1(),[C,A]=S.useState(()=>u?c(u):""),N=S.useRef(null),O=CR(),_=S.useCallback(()=>{const B=N.current;B&&(B.style.height="auto",B.style.height=`${B.scrollHeight}px`)},[]);S.useEffect(()=>{_()},[C,_]),S.useEffect(()=>(window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)),[_]),S.useEffect(()=>{var B;(B=N.current)==null||B.focus()},[u]);async function U(){if(!C.trim())return;const B=C;A(""),u&&d(u),N.current&&(N.current.style.height="auto");try{await r(B,{model:m,effort:g,planMode:y})}catch($){console.error("[ChatInput] Submit failed:",$),A(B),u&&f(u,B)}}function F(B){if(B.key==="Tab"&&B.shiftKey){B.preventDefault(),k(!y);return}if(B.key==="Escape"&&o){B.preventDefault(),l==null||l();return}const $="ontouchstart"in window||navigator.maxTouchPoints>0;B.key==="Enter"&&!B.shiftKey&&!o&&!$&&(B.preventDefault(),U())}const z=MR[m];return x.jsxs("div",{className:xe("p-3 pt-0 md:pb-2",O&&"px-5 pb-5"),children:[x.jsxs("div",{className:"flex items-end gap-2 max-w-[840px] mx-auto border dark:bg-card/40 backdrop-blur-lg border-border rounded-[29px] pr-1.5",children:[x.jsx(q1,{ref:N,placeholder:"Ask something...",value:C,autoFocus:!0,rows:1,onChange:B=>{A(B.target.value),u&&f(u,B.target.value),_()},onKeyDown:F,disabled:i,className:"flex-1 text-base p-3 md:p-4 pl-4.5 md:pl-6 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),x.jsx(qe,{type:"button",onPointerDown:B=>{B.preventDefault(),o?l==null||l():!i&&C.trim()&&U()},disabled:!o&&(i||!C.trim()),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 mb-1 -mr-0.5 md:mr-0 md:mb-1.5 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:o?x.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):x.jsx(KA,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),x.jsxs("div",{className:"flex justify-center items-center gap-0.5 max-w-[840px] mx-auto mt-2 animate-fade-in",children:[x.jsxs(wd,{trigger:x.jsxs(x.Fragment,{children:[x.jsx(z,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:OR[m]})]}),children:[x.jsx(dr,{onClick:()=>b("opus"),selected:m==="opus",icon:x.jsx(zh,{className:"h-4 w-4 text-muted-foreground"}),label:"Opus",description:"Highest capability, deep reasoning"}),x.jsx(dr,{onClick:()=>b("sonnet"),selected:m==="sonnet",icon:x.jsx(H0,{className:"h-4 w-4 text-muted-foreground"}),label:"Sonnet",description:"Balanced speed and intelligence"}),x.jsx(dr,{onClick:()=>b("haiku"),selected:m==="haiku",icon:x.jsx(R0,{className:"h-4 w-4 text-muted-foreground"}),label:"Haiku",description:"Fastest responses, lightweight tasks"})]}),x.jsxs(wd,{trigger:x.jsxs(x.Fragment,{children:[x.jsx(Pa,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:zR[g]})]}),triggerClassName:g==="max"?"text-amber-400 dark:text-amber-300":void 0,children:[x.jsx(dr,{onClick:()=>v("low"),selected:g==="low",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Low",description:"Minimal thinking, fastest responses"}),x.jsx(dr,{onClick:()=>v("medium"),selected:g==="medium",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Medium",description:"Moderate thinking for typical tasks"}),x.jsx(dr,{onClick:()=>v("high"),selected:g==="high",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"High",description:"Deep reasoning for complex problems"}),x.jsx(dr,{onClick:()=>v("max"),selected:g==="max",disabled:m!=="opus",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Max",description:m!=="opus"?"Only available with Opus":"Maximum effort, deepest reasoning"})]}),x.jsxs(wd,{trigger:y?x.jsxs(x.Fragment,{children:[x.jsx(nu,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:"Plan Mode"})]}):x.jsxs(x.Fragment,{children:[x.jsx(Wx,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:"Full Access"})]}),triggerClassName:y?"text-blue-400 dark:text-blue-300":void 0,children:[x.jsx(dr,{onClick:()=>k(!1),selected:!y,icon:x.jsx(Wx,{className:"h-4 w-4 text-muted-foreground"}),label:"Full Access",description:"Claude can read and edit files"}),x.jsx(dr,{onClick:()=>k(!0),selected:y,icon:x.jsx(nu,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan Mode",description:"Claude can only read, not edit"}),x.jsxs("p",{className:"text-xs text-muted-foreground/90 px-2 py-2",children:["Press ",x.jsx("kbd",{className:"px-1 mx-0.5 py-0.5 text-[12px] bg-muted/90 rounded font-mono",children:"shift+tab"})," to toggle"]})]})]})]})}),G1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("bg-card text-card-foreground",e),...r}));G1.displayName="Card";const Y1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("flex flex-col space-y-1.5 p-2",e),...r}));Y1.displayName="CardHeader";const LR=S.forwardRef(({className:e,...r},l)=>x.jsx("h3",{ref:l,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...r}));LR.displayName="CardTitle";const BR=S.forwardRef(({className:e,...r},l)=>x.jsx("p",{ref:l,className:xe("text-sm text-muted-foreground",e),...r}));BR.displayName="CardDescription";const $1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("p-6 pt-0",e),...r}));$1.displayName="CardContent";const UR=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("flex items-center p-6 pt-0",e),...r}));UR.displayName="CardFooter";function HR({sidebarCollapsed:e,onOpenSidebar:r,onExpandSidebar:l,onNewChat:i,localPath:o,onOpenExternal:u}){return x.jsx(Y1,{className:xe("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 pr-4 border-border/0 md:pb-0 flex items-center justify-center","backdrop-blur-lg md:backdrop-blur-none bg-gradient-to-b from-background md:from-transparent border-b border-x-0 md:border-x border-border md:border-none"),children:x.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[x.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 border-l border-border/0",children:[x.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden",onClick:r,children:x.jsx(z0,{className:"h-5 w-5"})}),e&&x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex items-center justify-center w-[40px] h-[40px]",children:x.jsx(Qa,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),x.jsx(qe,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:l,title:"Expand sidebar",children:x.jsx(Qd,{className:"h-5 w-5"})})]}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:i,title:"Compose",children:x.jsx(Dh,{className:"h-5 w-5"})})]}),x.jsx("div",{className:"flex-1 min-w-0"}),x.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:o&&u&&x.jsxs(x.Fragment,{children:[x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_finder"),title:"Open in Finder",className:"border border-border/0",children:x.jsx(M0,{className:"h-4.5 w-4.5"})}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_terminal"),title:"Open in Terminal",className:"border border-border/0",children:x.jsx(Lh,{className:"h-4.5 w-4.5"})}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_editor"),title:"Open in Cursor",className:"border border-border/0",children:x.jsx(bj,{className:"h-4.5 w-4.5"})})]})})]})})}const nh={Task:nu,TaskOutput:nu,Bash:Lh,Glob:yd,Grep:yd,ExitPlanMode:eb,Read:Mj,Edit:jj,Write:_j,NotebookEdit:B0,WebFetch:GA,TodoWrite:aj,WebSearch:yd,KillShell:lT,AskUserQuestion:D0,Skill:zh,EnterPlanMode:eb},X1=oT;function Q1(e){return nh[e]?nh[e]:/^mcp__db__.+_query$/.test(e)?Cj:e==="mcp__lever__show_chart"?nj:X1}function ll({children:e,className:r}){return x.jsx("div",{className:xe("flex gap-3 justify-start items-center",r),children:e})}function PR({children:e,className:r}){return x.jsx("div",{className:xe("flex items-center gap-1.5 text-xs",r),children:e})}function el({children:e,className:r}){return x.jsx("span",{className:xe("font-medium text-foreground/80",r),children:e})}function qR({children:e}){return x.jsx("span",{className:"text-muted-foreground",children:e})}function Ou({children:e,expandedContent:r,defaultExpanded:l=!1}){const[i,o]=S.useState(l);return x.jsxs("div",{className:"flex flex-col w-full",children:[x.jsxs("button",{onClick:()=>o(!i),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${i?"":"hover:opacity-60 transition-opacity"}`,children:[x.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),x.jsx(Kr,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${i?"rotate-90 opacity-100":""}`})]}),i&&r]})}function qa({label:e,children:r,copyText:l}){const[i,o]=S.useState(!1),u=l??uu(r),c=S.useCallback(async()=>{await navigator.clipboard.writeText(u),o(!0),setTimeout(()=>o(!1),2e3)},[u]);return x.jsxs("div",{children:[x.jsx("span",{className:"font-medium text-muted-foreground",children:e}),x.jsxs("div",{className:"relative group/codeblock",children:[x.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:r}),x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-2.5 right-1.5 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!i&&"hover:text-foreground",i&&"hover:!bg-transparent hover:!border-transparent"),onClick:c,children:i?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})]})]})}function Z1({children:e,icon:r,className:l}){return x.jsxs("span",{className:xe("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",l),children:[r&&x.jsx(r,{className:"h-3 w-3 text-muted-foreground"}),e]})}function zu({children:e,className:r}){return x.jsxs("div",{className:xe("grid grid-cols-[auto_1fr] gap-2 min-w-0",r),children:[x.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:x.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),x.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function uu(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(uu).join("");if(e&&typeof e=="object"&&"props"in e){const r=e.props;return uu(r.children)}return""}const Du={pre:({children:e,...r})=>{const[l,i]=S.useState(!1),o=uu(e),u=async()=>{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),2e3)};return x.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[x.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...r,children:e}),x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!l&&"hover:text-foreground",l&&"hover:!bg-transparent hover:!border-transparent"),onClick:u,children:l?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})]})},code:({children:e,className:r,...l})=>r?x.jsx("code",{className:"block text-xs whitespace-pre",...l,children:e}):x.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...l,children:e}),table:({children:e,...r})=>x.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:x.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...r,children:e})}),tbody:({children:e,...r})=>x.jsx("tbody",{className:"divide-y divide-border",...r,children:e}),th:({children:e,...r})=>x.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...r,children:e}),td:({children:e,...r})=>x.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...r,children:e}),p:({children:e,...r})=>x.jsx("p",{className:"break-words",...r,children:e}),a:({children:e,...r})=>x.jsx("a",{className:"transition-all underline decoration-2 text-orange-500 decoration-orange-500/50 hover:text-orange-500/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...r,children:e})},rh={...Du,h1:({children:e})=>x.jsx("h1",{className:"text-2xl font-bold mt-6 mb-4 first:mt-0",children:e}),h2:({children:e})=>x.jsx("h2",{className:"text-xl font-semibold mt-5 mb-3 first:mt-0",children:e}),h3:({children:e})=>x.jsx("h3",{className:"text-lg font-semibold mt-4 mb-2 first:mt-0",children:e}),h4:({children:e})=>x.jsx("h4",{className:"text-base font-semibold mt-3 mb-2 first:mt-0",children:e}),h5:({children:e})=>x.jsx("h5",{className:"text-sm font-semibold mt-3 mb-1 first:mt-0",children:e}),h6:({children:e})=>x.jsx("h6",{className:"text-sm font-medium mt-3 mb-1 first:mt-0",children:e})},FR={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function VR({status:e}){const r=(e?FR[e]:void 0)||"Processing...",l=e==="failed";return x.jsx(ll,{className:"ml-[1px]",children:x.jsxs(PR,{children:[l?x.jsx(so,{className:"size-4.5 text-red-500"}):x.jsx(zl,{className:"size-4.5 animate-spin text-muted-icon"}),x.jsx(Ru,{className:"ml-[1px] text-sm",shimmerWidth:44,children:r})]})})}const K1=S.forwardRef(({className:e,children:r,...l},i)=>x.jsx("div",{ref:i,className:xe("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...l,children:r}));K1.displayName="ScrollArea";function IR(e,r){const l={};return(e[e.length-1]===""?[...e,""]:e).join((l.padRight?" ":"")+","+(l.padLeft===!1?"":" ")).trim()}const GR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$R={};function mb(e,r){return($R.jsx?YR:GR).test(e)}const XR=/[ \t\n\f\r]/g;function QR(e){return typeof e=="object"?e.type==="text"?pb(e.value):!1:pb(e)}function pb(e){return e.replace(XR,"")===""}class ho{constructor(r,l,i){this.normal=l,this.property=r,i&&(this.space=i)}}ho.prototype.normal={};ho.prototype.property={};ho.prototype.space=void 0;function J1(e,r){const l={},i={};for(const o of e)Object.assign(l,o.property),Object.assign(i,o.normal);return new ho(l,i,r)}function lh(e){return e.toLowerCase()}class Yt{constructor(r,l){this.attribute=l,this.property=r}}Yt.prototype.attribute="";Yt.prototype.booleanish=!1;Yt.prototype.boolean=!1;Yt.prototype.commaOrSpaceSeparated=!1;Yt.prototype.commaSeparated=!1;Yt.prototype.defined=!1;Yt.prototype.mustUseProperty=!1;Yt.prototype.number=!1;Yt.prototype.overloadedBoolean=!1;Yt.prototype.property="";Yt.prototype.spaceSeparated=!1;Yt.prototype.space=void 0;let ZR=0;const Te=Dl(),ft=Dl(),ih=Dl(),oe=Dl(),Ke=Dl(),_i=Dl(),tn=Dl();function Dl(){return 2**++ZR}const ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:ft,commaOrSpaceSeparated:tn,commaSeparated:_i,number:oe,overloadedBoolean:ih,spaceSeparated:Ke},Symbol.toStringTag,{value:"Module"})),Sd=Object.keys(ah);class Jh extends Yt{constructor(r,l,i,o){let u=-1;if(super(r,l),gb(this,"space",o),typeof i=="number")for(;++u<Sd.length;){const c=Sd[u];gb(this,Sd[u],(i&ah[c])===ah[c])}}}Jh.prototype.defined=!0;function gb(e,r,l){l&&(e[r]=l)}function Fi(e){const r={},l={};for(const[i,o]of Object.entries(e.properties)){const u=new Jh(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),r[i]=u,l[lh(i)]=i,l[lh(u.attribute)]=i}return new ho(r,l,e.space)}const W1=Fi({properties:{ariaActiveDescendant:null,ariaAtomic:ft,ariaAutoComplete:null,ariaBusy:ft,ariaChecked:ft,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:Ke,ariaCurrent:null,ariaDescribedBy:Ke,ariaDetails:null,ariaDisabled:ft,ariaDropEffect:Ke,ariaErrorMessage:null,ariaExpanded:ft,ariaFlowTo:Ke,ariaGrabbed:ft,ariaHasPopup:null,ariaHidden:ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ke,ariaLevel:oe,ariaLive:null,ariaModal:ft,ariaMultiLine:ft,ariaMultiSelectable:ft,ariaOrientation:null,ariaOwns:Ke,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:ft,ariaReadOnly:ft,ariaRelevant:null,ariaRequired:ft,ariaRoleDescription:Ke,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:ft,ariaSetSize:oe,ariaSort:null,ariaValueMax:oe,ariaValueMin:oe,ariaValueNow:oe,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function ew(e,r){return r in e?e[r]:r}function tw(e,r){return ew(e,r.toLowerCase())}const KR=Fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_i,acceptCharset:Ke,accessKey:Ke,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ke,autoFocus:Te,autoPlay:Te,blocking:Ke,capture:null,charSet:null,checked:Te,cite:null,className:Ke,cols:oe,colSpan:null,content:null,contentEditable:ft,controls:Te,controlsList:Ke,coords:oe|_i,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:ih,draggable:ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ke,height:oe,hidden:ih,high:oe,href:null,hrefLang:null,htmlFor:Ke,httpEquiv:Ke,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ke,itemRef:Ke,itemScope:Te,itemType:Ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,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:Te,optimum:oe,pattern:null,ping:Ke,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ke,required:Te,reversed:Te,rows:oe,rowSpan:oe,sandbox:Ke,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oe,step:null,style:null,tabIndex:oe,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:ft,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ke,axis:null,background:null,bgColor:null,border:oe,borderColor:null,bottomMargin:oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:ft,standby:null,summary:null,text:null,topMargin:oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:tw}),JR=Fi({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",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:tn,accentHeight:oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oe,amplitude:oe,arabicForm:null,ascent:oe,attributeName:null,attributeType:null,azimuth:oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oe,by:null,calcMode:null,capHeight:oe,className:Ke,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:oe,diffuseConstant:oe,direction:null,display:null,dur:null,divisor:oe,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:oe,enableBackground:null,end:null,event:null,exponent:oe,externalResourcesRequired:null,fill:null,fillOpacity:oe,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:_i,g2:_i,glyphName:_i,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oe,horizOriginX:oe,horizOriginY:oe,id:null,ideographic:oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oe,k:oe,k1:oe,k2:oe,k3:oe,k4:oe,kernelMatrix:tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oe,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:oe,overlineThickness:oe,paintOrder:null,panose1:null,path:null,pathLength:oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tn,rev:tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tn,requiredFeatures:tn,requiredFonts:tn,requiredFormats:tn,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:oe,specularExponent:oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oe,strikethroughThickness:oe,string:null,stroke:null,strokeDashArray:tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oe,strokeOpacity:oe,strokeWidth:null,style:null,surfaceScale:oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tn,tabIndex:oe,tableValues:null,target:null,targetX:oe,targetY:oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oe,underlineThickness:oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oe,values:null,vAlphabetic:oe,vMathematical:oe,vectorEffect:null,vHanging:oe,vIdeographic:oe,version:null,vertAdvY:oe,vertOriginX:oe,vertOriginY:oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ew}),nw=Fi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),rw=Fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:tw}),lw=Fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),WR={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"},e4=/[A-Z]/g,yb=/-[a-z]/g,t4=/^data[-\w.:]+$/i;function n4(e,r){const l=lh(r);let i=r,o=Yt;if(l in e.normal)return e.property[e.normal[l]];if(l.length>4&&l.slice(0,4)==="data"&&t4.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(yb,l4);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!yb.test(u)){let c=u.replace(e4,r4);c.charAt(0)!=="-"&&(c="-"+c),r="data"+c}}o=Jh}return new o(i,r)}function r4(e){return"-"+e.toLowerCase()}function l4(e){return e.charAt(1).toUpperCase()}const i4=J1([W1,KR,nw,rw,lw],"html"),Wh=J1([W1,JR,nw,rw,lw],"svg");function a4(e){return e.join(" ").trim()}var Ei={},kd,xb;function o4(){if(xb)return kd;xb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,l=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
385
- `,m="/",g="*",y="",b="comment",v="declaration";function k(A,N){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];N=N||{};var O=1,_=1;function U(J){var Z=J.match(r);Z&&(O+=Z.length);var D=J.lastIndexOf(d);_=~D?J.length-D:_+J.length}function F(){var J={line:O,column:_};return function(Z){return Z.position=new z(J),ae(),Z}}function z(J){this.start=J,this.end={line:O,column:_},this.source=N.source}z.prototype.content=A;function B(J){var Z=new Error(N.source+":"+O+":"+_+": "+J);if(Z.reason=J,Z.filename=N.source,Z.line=O,Z.column=_,Z.source=A,!N.silent)throw Z}function $(J){var Z=J.exec(A);if(Z){var D=Z[0];return U(D),A=A.slice(D.length),Z}}function ae(){$(l)}function P(J){var Z;for(J=J||[];Z=re();)Z!==!1&&J.push(Z);return J}function re(){var J=F();if(!(m!=A.charAt(0)||g!=A.charAt(1))){for(var Z=2;y!=A.charAt(Z)&&(g!=A.charAt(Z)||m!=A.charAt(Z+1));)++Z;if(Z+=2,y===A.charAt(Z-1))return B("End of comment missing");var D=A.slice(2,Z-2);return _+=2,U(D),A=A.slice(Z),_+=2,J({type:b,comment:D})}}function le(){var J=F(),Z=$(i);if(Z){if(re(),!$(o))return B("property missing ':'");var D=$(u),X=J({type:v,property:C(Z[0].replace(e,y)),value:D?C(D[0].replace(e,y)):y});return $(c),X}}function se(){var J=[];P(J);for(var Z;Z=le();)Z!==!1&&(J.push(Z),P(J));return J}return ae(),se()}function C(A){return A?A.replace(f,y):y}return kd=k,kd}var bb;function s4(){if(bb)return Ei;bb=1;var e=Ei&&Ei.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.default=l;const r=e(o4());function l(i,o){let u=null;if(!i||typeof i!="string")return u;const c=(0,r.default)(i),f=typeof o=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:g}=d;f?o(m,g,d):g&&(u=u||{},u[m]=g)}),u}return Ei}var Fa={},vb;function u4(){if(vb)return Fa;vb=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,l=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(m){return!m||l.test(m)||e.test(m)},c=function(m,g){return g.toUpperCase()},f=function(m,g){return"".concat(g,"-")},d=function(m,g){return g===void 0&&(g={}),u(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(o,f):m=m.replace(i,f),m.replace(r,c))};return Fa.camelCase=d,Fa}var Va,wb;function c4(){if(wb)return Va;wb=1;var e=Va&&Va.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=e(s4()),l=u4();function i(o,u){var c={};return!o||typeof o!="string"||(0,r.default)(o,function(f,d){f&&d&&(c[(0,l.camelCase)(f,u)]=d)}),c}return i.default=i,Va=i,Va}var f4=c4();const d4=pu(f4),iw=aw("end"),em=aw("start");function aw(e){return r;function r(l){const i=l&&l.position&&l.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function h4(e){const r=em(e),l=iw(e);if(r&&l)return{start:r,end:l}}function Za(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Sb(e.position):"start"in e||"end"in e?Sb(e):"line"in e||"column"in e?oh(e):""}function oh(e){return kb(e&&e.line)+":"+kb(e&&e.column)}function Sb(e){return oh(e&&e.start)+"-"+oh(e&&e.end)}function kb(e){return e&&typeof e=="number"?e:1}class Rt extends Error{constructor(r,l,i){super(),typeof l=="string"&&(i=l,l=void 0);let o="",u={},c=!1;if(l&&("line"in l&&"column"in l?u={place:l}:"start"in l&&"end"in l?u={place:l}:"type"in l?u={ancestors:[l],place:l.position}:u={...l}),typeof r=="string"?o=r:!u.cause&&r&&(c=!0,o=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?u.ruleId=i:(u.source=i.slice(0,d),u.ruleId=i.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=Za(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Rt.prototype.file="";Rt.prototype.name="";Rt.prototype.reason="";Rt.prototype.message="";Rt.prototype.stack="";Rt.prototype.column=void 0;Rt.prototype.line=void 0;Rt.prototype.ancestors=void 0;Rt.prototype.cause=void 0;Rt.prototype.fatal=void 0;Rt.prototype.place=void 0;Rt.prototype.ruleId=void 0;Rt.prototype.source=void 0;const tm={}.hasOwnProperty,m4=new Map,p4=/[A-Z]/g,g4=new Set(["table","tbody","thead","tfoot","tr"]),y4=new Set(["td","th"]),ow="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function x4(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const l=r.filePath||void 0;let i;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=N4(l,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=E4(l,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:i,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Wh:i4,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=sw(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function sw(e,r,l){if(r.type==="element")return b4(e,r,l);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return v4(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return S4(e,r,l);if(r.type==="mdxjsEsm")return w4(e,r);if(r.type==="root")return k4(e,r,l);if(r.type==="text")return C4(e,r)}function b4(e,r,l){const i=e.schema;let o=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Wh,e.schema=o),e.ancestors.push(r);const u=cw(e,r.tagName,!1),c=A4(e,r);let f=rm(e,r);return g4.has(r.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!QR(d):!0})),uw(e,c,u,r),nm(c,f),e.ancestors.pop(),e.schema=i,e.create(r,u,c,l)}function v4(e,r){if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}ro(e,r.position)}function w4(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);ro(e,r.position)}function S4(e,r,l){const i=e.schema;let o=i;r.name==="svg"&&i.space==="html"&&(o=Wh,e.schema=o),e.ancestors.push(r);const u=r.name===null?e.Fragment:cw(e,r.name,!0),c=j4(e,r),f=rm(e,r);return uw(e,c,u,r),nm(c,f),e.ancestors.pop(),e.schema=i,e.create(r,u,c,l)}function k4(e,r,l){const i={};return nm(i,rm(e,r)),e.create(r,e.Fragment,i,l)}function C4(e,r){return r.value}function uw(e,r,l,i){typeof l!="string"&&l!==e.Fragment&&e.passNode&&(r.node=i)}function nm(e,r){if(r.length>0){const l=r.length>1?r:r[0];l&&(e.children=l)}}function E4(e,r,l){return i;function i(o,u,c,f){const m=Array.isArray(c.children)?l:r;return f?m(u,c,f):m(u,c)}}function N4(e,r){return l;function l(i,o,u,c){const f=Array.isArray(u.children),d=em(i);return r(o,u,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function A4(e,r){const l={};let i,o;for(o in r.properties)if(o!=="children"&&tm.call(r.properties,o)){const u=T4(e,o,r.properties[o]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&y4.has(r.tagName)?i=f:l[c]=f}}if(i){const u=l.style||(l.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return l}function j4(e,r){const l={};for(const i of r.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(l,e.evaluater.evaluateExpression(f.argument))}else ro(e,r.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else ro(e,r.position);else u=i.value===null?!0:i.value;l[o]=u}return l}function rm(e,r){const l=[];let i=-1;const o=e.passKeys?new Map:m4;for(;++i<r.children.length;){const u=r.children[i];let c;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const m=o.get(d)||0;c=d+"-"+m,o.set(d,m+1)}}const f=sw(e,u,c);f!==void 0&&l.push(f)}return l}function T4(e,r,l){const i=n4(e.schema,r);if(!(l==null||typeof l=="number"&&Number.isNaN(l))){if(Array.isArray(l)&&(l=i.commaSeparated?IR(l):a4(l)),i.property==="style"){let o=typeof l=="object"?l:_4(e,String(l));return e.stylePropertyNameCase==="css"&&(o=R4(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?WR[i.property]||i.property:i.attribute,l]}}function _4(e,r){try{return d4(r,{reactCompat:!0})}catch(l){if(e.ignoreInvalidStyle)return{};const i=l,o=new Rt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=ow+"#cannot-parse-style-attribute",o}}function cw(e,r,l){let i;if(!l)i={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let u=-1,c;for(;++u<o.length;){const f=mb(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}i=c}else i=mb(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const o=i.value;return tm.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);ro(e)}function ro(e,r){const l=new Rt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=ow+"#cannot-handle-mdx-estrees-without-createevaluater",l}function R4(e){const r={};let l;for(l in e)tm.call(e,l)&&(r[M4(l)]=e[l]);return r}function M4(e){let r=e.replace(p4,O4);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function O4(e){return"-"+e.toLowerCase()}const Cd={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"]},z4={};function lm(e,r){const l=z4,i=typeof l.includeImageAlt=="boolean"?l.includeImageAlt:!0,o=typeof l.includeHtml=="boolean"?l.includeHtml:!0;return fw(e,i,o)}function fw(e,r,l){if(D4(e)){if("value"in e)return e.type==="html"&&!l?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Cb(e.children,r,l)}return Array.isArray(e)?Cb(e,r,l):""}function Cb(e,r,l){const i=[];let o=-1;for(;++o<e.length;)i[o]=fw(e[o],r,l);return i.join("")}function D4(e){return!!(e&&typeof e=="object")}const Eb=document.createElement("i");function im(e){const r="&"+e+";";Eb.innerHTML=r;const l=Eb.textContent;return l.charCodeAt(l.length-1)===59&&e!=="semi"||l===r?!1:l}function ln(e,r,l,i){const o=e.length;let u=0,c;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,l=l>0?l:0,i.length<1e4)c=Array.from(i),c.unshift(r,l),e.splice(...c);else for(l&&e.splice(r,l);u<i.length;)c=i.slice(u,u+1e4),c.unshift(r,0),e.splice(...c),u+=1e4,r+=1e4}function yn(e,r){return e.length>0?(ln(e,e.length,0,r),e):r}const Nb={}.hasOwnProperty;function dw(e){const r={};let l=-1;for(;++l<e.length;)L4(r,e[l]);return r}function L4(e,r){let l;for(l in r){const o=(Nb.call(e,l)?e[l]:void 0)||(e[l]={}),u=r[l];let c;if(u)for(c in u){Nb.call(o,c)||(o[c]=[]);const f=u[c];B4(o[c],Array.isArray(f)?f:f?[f]:[])}}}function B4(e,r){let l=-1;const i=[];for(;++l<r.length;)(r[l].add==="after"?e:i).push(r[l]);ln(e,0,0,i)}function hw(e,r){const l=Number.parseInt(e,r);return l<9||l===11||l>13&&l<32||l>126&&l<160||l>55295&&l<57344||l>64975&&l<65008||(l&65535)===65535||(l&65535)===65534||l>1114111?"�":String.fromCodePoint(l)}function kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dt=il(/[A-Za-z]/),Tt=il(/[\dA-Za-z]/),U4=il(/[#-'*+\--9=?A-Z^-~]/);function cu(e){return e!==null&&(e<32||e===127)}const sh=il(/\d/),H4=il(/[\dA-Fa-f]/),P4=il(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const Lu=il(new RegExp("\\p{P}|\\p{S}","u")),Ml=il(/\s/);function il(e){return r;function r(l){return l!==null&&l>-1&&e.test(String.fromCharCode(l))}}function Vi(e){const r=[];let l=-1,i=0,o=0;for(;++l<e.length;){const u=e.charCodeAt(l);let c="";if(u===37&&Tt(e.charCodeAt(l+1))&&Tt(e.charCodeAt(l+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(l+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),o=1):c="�"}else c=String.fromCharCode(u);c&&(r.push(e.slice(i,l),encodeURIComponent(c)),i=l+o+1,c=""),o&&(l+=o,o=0)}return r.join("")+e.slice(i)}function Be(e,r,l,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(d){return Oe(d)?(e.enter(l),f(d)):r(d)}function f(d){return Oe(d)&&u++<o?(e.consume(d),f):(e.exit(l),r(d))}}const q4={tokenize:F4};function F4(e){const r=e.attempt(this.parser.constructs.contentInitial,i,o);let l;return r;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Be(e,r,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const d=e.enter("chunkText",{contentType:"text",previous:l});return l&&(l.next=d),l=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return we(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const V4={tokenize:I4},Ab={tokenize:G4};function I4(e){const r=this,l=[];let i=0,o,u,c;return f;function f(_){if(i<l.length){const U=l[i];return r.containerState=U[1],e.attempt(U[0].continuation,d,m)(_)}return m(_)}function d(_){if(i++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&O();const U=r.events.length;let F=U,z;for(;F--;)if(r.events[F][0]==="exit"&&r.events[F][1].type==="chunkFlow"){z=r.events[F][1].end;break}N(i);let B=U;for(;B<r.events.length;)r.events[B][1].end={...z},B++;return ln(r.events,F+1,0,r.events.slice(U)),r.events.length=B,m(_)}return f(_)}function m(_){if(i===l.length){if(!o)return b(_);if(o.currentConstruct&&o.currentConstruct.concrete)return k(_);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Ab,g,y)(_)}function g(_){return o&&O(),N(i),b(_)}function y(_){return r.parser.lazy[r.now().line]=i!==l.length,c=r.now().offset,k(_)}function b(_){return r.containerState={},e.attempt(Ab,v,k)(_)}function v(_){return i++,l.push([r.currentConstruct,r.containerState]),b(_)}function k(_){if(_===null){o&&O(),N(0),e.consume(_);return}return o=o||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){A(e.exit("chunkFlow"),!0),N(0),e.consume(_);return}return we(_)?(e.consume(_),A(e.exit("chunkFlow")),i=0,r.interrupt=void 0,f):(e.consume(_),C)}function A(_,U){const F=r.sliceStream(_);if(U&&F.push(null),_.previous=u,u&&(u.next=_),u=_,o.defineSkip(_.start),o.write(F),r.parser.lazy[_.start.line]){let z=o.events.length;for(;z--;)if(o.events[z][1].start.offset<c&&(!o.events[z][1].end||o.events[z][1].end.offset>c))return;const B=r.events.length;let $=B,ae,P;for(;$--;)if(r.events[$][0]==="exit"&&r.events[$][1].type==="chunkFlow"){if(ae){P=r.events[$][1].end;break}ae=!0}for(N(i),z=B;z<r.events.length;)r.events[z][1].end={...P},z++;ln(r.events,$+1,0,r.events.slice(B)),r.events.length=z}}function N(_){let U=l.length;for(;U-- >_;){const F=l[U];r.containerState=F[1],F[0].exit.call(r,e)}l.length=_}function O(){o.write([null]),u=void 0,o=void 0,r.containerState._closeFlow=void 0}}function G4(e,r,l){return Be(e,e.attempt(this.parser.constructs.document,r,l),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Di(e){if(e===null||Ze(e)||Ml(e))return 1;if(Lu(e))return 2}function Bu(e,r,l){const i=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!i.includes(u)&&(r=u(r,l),i.push(u))}return r}const uh={name:"attention",resolveAll:Y4,tokenize:$4};function Y4(e,r){let l=-1,i,o,u,c,f,d,m,g;for(;++l<e.length;)if(e[l][0]==="enter"&&e[l][1].type==="attentionSequence"&&e[l][1]._close){for(i=l;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&r.sliceSerialize(e[i][1]).charCodeAt(0)===r.sliceSerialize(e[l][1]).charCodeAt(0)){if((e[i][1]._close||e[l][1]._open)&&(e[l][1].end.offset-e[l][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[l][1].end.offset-e[l][1].start.offset)%3))continue;d=e[i][1].end.offset-e[i][1].start.offset>1&&e[l][1].end.offset-e[l][1].start.offset>1?2:1;const y={...e[i][1].end},b={...e[l][1].start};jb(y,-d),jb(b,d),c={type:d>1?"strongSequence":"emphasisSequence",start:y,end:{...e[i][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[l][1].start},end:b},u={type:d>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[l][1].start}},o={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[i][1].end={...c.start},e[l][1].start={...f.end},m=[],e[i][1].end.offset-e[i][1].start.offset&&(m=yn(m,[["enter",e[i][1],r],["exit",e[i][1],r]])),m=yn(m,[["enter",o,r],["enter",c,r],["exit",c,r],["enter",u,r]]),m=yn(m,Bu(r.parser.constructs.insideSpan.null,e.slice(i+1,l),r)),m=yn(m,[["exit",u,r],["enter",f,r],["exit",f,r],["exit",o,r]]),e[l][1].end.offset-e[l][1].start.offset?(g=2,m=yn(m,[["enter",e[l][1],r],["exit",e[l][1],r]])):g=0,ln(e,i-1,l-i+3,m),l=i+m.length-g-2;break}}for(l=-1;++l<e.length;)e[l][1].type==="attentionSequence"&&(e[l][1].type="data");return e}function $4(e,r){const l=this.parser.constructs.attentionMarkers.null,i=this.previous,o=Di(i);let u;return c;function c(d){return u=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===u)return e.consume(d),f;const m=e.exit("attentionSequence"),g=Di(d),y=!g||g===2&&o||l.includes(d),b=!o||o===2&&g||l.includes(i);return m._open=!!(u===42?y:y&&(o||!b)),m._close=!!(u===42?b:b&&(g||!y)),r(d)}}function jb(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const X4={name:"autolink",tokenize:Q4};function Q4(e,r,l){let i=0;return o;function o(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return Dt(v)?(e.consume(v),c):v===64?l(v):m(v)}function c(v){return v===43||v===45||v===46||Tt(v)?(i=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),i=0,d):(v===43||v===45||v===46||Tt(v))&&i++<32?(e.consume(v),f):(i=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):v===null||v===32||v===60||cu(v)?l(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),g):U4(v)?(e.consume(v),m):l(v)}function g(v){return Tt(v)?y(v):l(v)}function y(v){return v===46?(e.consume(v),i=0,g):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):b(v)}function b(v){if((v===45||Tt(v))&&i++<63){const k=v===45?b:y;return e.consume(v),k}return l(v)}}const mo={partial:!0,tokenize:Z4};function Z4(e,r,l){return i;function i(u){return Oe(u)?Be(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||we(u)?r(u):l(u)}}const mw={continuation:{tokenize:J4},exit:W4,name:"blockQuote",tokenize:K4};function K4(e,r,l){const i=this;return o;function o(c){if(c===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return l(c)}function u(c){return Oe(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(c))}}function J4(e,r,l){const i=this;return o;function o(c){return Oe(c)?Be(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(mw,r,l)(c)}}function W4(e){e.exit("blockQuote")}const pw={name:"characterEscape",tokenize:eM};function eM(e,r,l){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return P4(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):l(u)}}const gw={name:"characterReference",tokenize:tM};function tM(e,r,l){const i=this;let o=0,u,c;return f;function f(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),d}function d(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,c=Tt,g(y))}function m(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=H4,g):(e.enter("characterReferenceValue"),u=7,c=sh,g(y))}function g(y){if(y===59&&o){const b=e.exit("characterReferenceValue");return c===Tt&&!im(i.sliceSerialize(b))?l(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return c(y)&&o++<u?(e.consume(y),g):l(y)}}const Tb={partial:!0,tokenize:rM},_b={concrete:!0,name:"codeFenced",tokenize:nM};function nM(e,r,l){const i=this,o={partial:!0,tokenize:F};let u=0,c=0,f;return d;function d(z){return m(z)}function m(z){const B=i.events[i.events.length-1];return u=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(z)}function g(z){return z===f?(c++,e.consume(z),g):c<3?l(z):(e.exit("codeFencedFenceSequence"),Oe(z)?Be(e,y,"whitespace")(z):y(z))}function y(z){return z===null||we(z)?(e.exit("codeFencedFence"),i.interrupt?r(z):e.check(Tb,C,U)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||we(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(z)):Oe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,v,"whitespace")(z)):z===96&&z===f?l(z):(e.consume(z),b)}function v(z){return z===null||we(z)?y(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||we(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(z)):z===96&&z===f?l(z):(e.consume(z),k)}function C(z){return e.attempt(o,U,A)(z)}function A(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return u>0&&Oe(z)?Be(e,O,"linePrefix",u+1)(z):O(z)}function O(z){return z===null||we(z)?e.check(Tb,C,U)(z):(e.enter("codeFlowValue"),_(z))}function _(z){return z===null||we(z)?(e.exit("codeFlowValue"),O(z)):(e.consume(z),_)}function U(z){return e.exit("codeFenced"),r(z)}function F(z,B,$){let ae=0;return P;function P(Z){return z.enter("lineEnding"),z.consume(Z),z.exit("lineEnding"),re}function re(Z){return z.enter("codeFencedFence"),Oe(Z)?Be(z,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):le(Z)}function le(Z){return Z===f?(z.enter("codeFencedFenceSequence"),se(Z)):$(Z)}function se(Z){return Z===f?(ae++,z.consume(Z),se):ae>=c?(z.exit("codeFencedFenceSequence"),Oe(Z)?Be(z,J,"whitespace")(Z):J(Z)):$(Z)}function J(Z){return Z===null||we(Z)?(z.exit("codeFencedFence"),B(Z)):$(Z)}}}function rM(e,r,l){const i=this;return o;function o(c){return c===null?l(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return i.parser.lazy[i.now().line]?l(c):r(c)}}const Ed={name:"codeIndented",tokenize:iM},lM={partial:!0,tokenize:aM};function iM(e,r,l){const i=this;return o;function o(m){return e.enter("codeIndented"),Be(e,u,"linePrefix",5)(m)}function u(m){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(m):l(m)}function c(m){return m===null?d(m):we(m)?e.attempt(lM,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||we(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),r(m)}}function aM(e,r,l){const i=this;return o;function o(c){return i.parser.lazy[i.now().line]?l(c):we(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):Be(e,u,"linePrefix",5)(c)}function u(c){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?r(c):we(c)?o(c):l(c)}}const oM={name:"codeText",previous:uM,resolve:sM,tokenize:cM};function sM(e){let r=e.length-4,l=3,i,o;if((e[l][1].type==="lineEnding"||e[l][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(i=l;++i<r;)if(e[i][1].type==="codeTextData"){e[l][1].type="codeTextPadding",e[r][1].type="codeTextPadding",l+=2,r-=2;break}}for(i=l-1,r++;++i<=r;)o===void 0?i!==r&&e[i][1].type!=="lineEnding"&&(o=i):(i===r||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),r-=i-o-2,i=o+2),o=void 0);return e}function uM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cM(e,r,l){let i=0,o,u;return c;function c(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),i++,f):(e.exit("codeTextSequence"),d(y))}function d(y){return y===null?l(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),d):y===96?(u=e.enter("codeTextSequence"),o=0,g(y)):we(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||we(y)?(e.exit("codeTextData"),d(y)):(e.consume(y),m)}function g(y){return y===96?(e.consume(y),o++,g):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),r(y)):(u.type="codeTextData",m(y))}}class fM{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,l){const i=l??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(r,i):r>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(r,l,i){const o=l||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&Ia(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Ia(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ia(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const l=this.left.splice(r,Number.POSITIVE_INFINITY);Ia(this.right,l.reverse())}else{const l=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ia(this.left,l.reverse())}}}function Ia(e,r){let l=0;if(r.length<1e4)e.push(...r);else for(;l<r.length;)e.push(...r.slice(l,l+1e4)),l+=1e4}function yw(e){const r={};let l=-1,i,o,u,c,f,d,m;const g=new fM(e);for(;++l<g.length;){for(;l in r;)l=r[l];if(i=g.get(l),l&&i[1].type==="chunkFlow"&&g.get(l-1)[1].type==="listItemPrefix"&&(d=i[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(r,dM(g,l)),l=r[l],m=!0);else if(i[1]._container){for(u=l,o=void 0;u--;)if(c=g.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},f=g.slice(o,l),f.unshift(i),g.splice(o,l-o+1,f))}}return ln(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!m}function dM(e,r){const l=e.get(r)[1],i=e.get(r)[2];let o=r-1;const u=[];let c=l._tokenizer;c||(c=i.parser[l.contentType](l.start),l._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let g,y,b=-1,v=l,k=0,C=0;const A=[C];for(;v;){for(;e.get(++o)[1]!==v;);u.push(o),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=l;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(C=b+1,A.push(C),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):A.pop(),b=A.length;b--;){const N=f.slice(A[b],A[b+1]),O=u.pop();d.push([O,O+N.length-1]),e.splice(O,2,N)}for(d.reverse(),b=-1;++b<d.length;)m[k+d[b][0]]=k+d[b][1],k+=d[b][1]-d[b][0]-1;return m}const hM={resolve:pM,tokenize:gM},mM={partial:!0,tokenize:yM};function pM(e){return yw(e),e}function gM(e,r){let l;return i;function i(f){return e.enter("content"),l=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):we(f)?e.check(mM,c,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),r(f)}function c(f){return e.consume(f),e.exit("chunkContent"),l.next=e.enter("chunkContent",{contentType:"content",previous:l}),l=l.next,o}}function yM(e,r,l){const i=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Be(e,u,"linePrefix")}function u(c){if(c===null||we(c))return l(c);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?r(c):e.interrupt(i.parser.constructs.flow,l,r)(c)}}function xw(e,r,l,i,o,u,c,f,d){const m=d||Number.POSITIVE_INFINITY;let g=0;return y;function y(N){return N===60?(e.enter(i),e.enter(o),e.enter(u),e.consume(N),e.exit(u),b):N===null||N===32||N===41||cu(N)?l(N):(e.enter(i),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(N))}function b(N){return N===62?(e.enter(u),e.consume(N),e.exit(u),e.exit(o),e.exit(i),r):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(e.exit("chunkString"),e.exit(f),b(N)):N===null||N===60||we(N)?l(N):(e.consume(N),N===92?k:v)}function k(N){return N===60||N===62||N===92?(e.consume(N),v):v(N)}function C(N){return!g&&(N===null||N===41||Ze(N))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(i),r(N)):g<m&&N===40?(e.consume(N),g++,C):N===41?(e.consume(N),g--,C):N===null||N===32||N===40||cu(N)?l(N):(e.consume(N),N===92?A:C)}function A(N){return N===40||N===41||N===92?(e.consume(N),C):C(N)}}function bw(e,r,l,i,o,u){const c=this;let f=0,d;return m;function m(v){return e.enter(i),e.enter(o),e.consume(v),e.exit(o),e.enter(u),g}function g(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?l(v):v===93?(e.exit(u),e.enter(o),e.consume(v),e.exit(o),e.exit(i),r):we(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||we(v)||f++>999?(e.exit("chunkString"),g(v)):(e.consume(v),d||(d=!Oe(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(e.consume(v),f++,y):y(v)}}function vw(e,r,l,i,o,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(o),e.consume(b),e.exit(o),c=b===40?41:b,d):l(b)}function d(b){return b===c?(e.enter(o),e.consume(b),e.exit(o),e.exit(i),r):(e.enter(u),m(b))}function m(b){return b===c?(e.exit(u),d(c)):b===null?l(b):we(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Be(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||we(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?y:g)}function y(b){return b===c||b===92?(e.consume(b),g):g(b)}}function Ka(e,r){let l;return i;function i(o){return we(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l=!0,i):Oe(o)?Be(e,i,l?"linePrefix":"lineSuffix")(o):r(o)}}const xM={name:"definition",tokenize:vM},bM={partial:!0,tokenize:wM};function vM(e,r,l){const i=this;let o;return u;function u(v){return e.enter("definition"),c(v)}function c(v){return bw.call(i,e,f,l,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return o=kn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):l(v)}function d(v){return Ze(v)?Ka(e,m)(v):m(v)}function m(v){return xw(e,g,l,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return e.attempt(bM,y,y)(v)}function y(v){return Oe(v)?Be(e,b,"whitespace")(v):b(v)}function b(v){return v===null||we(v)?(e.exit("definition"),i.parser.defined.push(o),r(v)):l(v)}}function wM(e,r,l){return i;function i(f){return Ze(f)?Ka(e,o)(f):l(f)}function o(f){return vw(e,u,l,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Oe(f)?Be(e,c,"whitespace")(f):c(f)}function c(f){return f===null||we(f)?r(f):l(f)}}const SM={name:"hardBreakEscape",tokenize:kM};function kM(e,r,l){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return we(u)?(e.exit("hardBreakEscape"),r(u)):l(u)}}const CM={name:"headingAtx",resolve:EM,tokenize:NM};function EM(e,r){let l=e.length-2,i=3,o,u;return e[i][1].type==="whitespace"&&(i+=2),l-2>i&&e[l][1].type==="whitespace"&&(l-=2),e[l][1].type==="atxHeadingSequence"&&(i===l-1||l-4>i&&e[l-2][1].type==="whitespace")&&(l-=i+1===l?2:4),l>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[l][1].end},u={type:"chunkText",start:e[i][1].start,end:e[l][1].end,contentType:"text"},ln(e,i,l-i+1,[["enter",o,r],["enter",u,r],["exit",u,r],["exit",o,r]])),e}function NM(e,r,l){let i=0;return o;function o(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&i++<6?(e.consume(g),c):g===null||Ze(g)?(e.exit("atxHeadingSequence"),f(g)):l(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||we(g)?(e.exit("atxHeading"),r(g)):Oe(g)?Be(e,f,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),f(g))}function m(g){return g===null||g===35||Ze(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),m)}}const AM=["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"],Rb=["pre","script","style","textarea"],jM={concrete:!0,name:"htmlFlow",resolveTo:RM,tokenize:MM},TM={partial:!0,tokenize:zM},_M={partial:!0,tokenize:OM};function RM(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function MM(e,r,l){const i=this;let o,u,c,f,d;return m;function m(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),y}function y(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),u=!0,C):T===63?(e.consume(T),o=3,i.interrupt?r:j):Dt(T)?(e.consume(T),c=String.fromCharCode(T),A):l(T)}function b(T){return T===45?(e.consume(T),o=2,v):T===91?(e.consume(T),o=5,f=0,k):Dt(T)?(e.consume(T),o=4,i.interrupt?r:j):l(T)}function v(T){return T===45?(e.consume(T),i.interrupt?r:j):l(T)}function k(T){const ue="CDATA[";return T===ue.charCodeAt(f++)?(e.consume(T),f===ue.length?i.interrupt?r:le:k):l(T)}function C(T){return Dt(T)?(e.consume(T),c=String.fromCharCode(T),A):l(T)}function A(T){if(T===null||T===47||T===62||Ze(T)){const ue=T===47,de=c.toLowerCase();return!ue&&!u&&Rb.includes(de)?(o=1,i.interrupt?r(T):le(T)):AM.includes(c.toLowerCase())?(o=6,ue?(e.consume(T),N):i.interrupt?r(T):le(T)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?l(T):u?O(T):_(T))}return T===45||Tt(T)?(e.consume(T),c+=String.fromCharCode(T),A):l(T)}function N(T){return T===62?(e.consume(T),i.interrupt?r:le):l(T)}function O(T){return Oe(T)?(e.consume(T),O):P(T)}function _(T){return T===47?(e.consume(T),P):T===58||T===95||Dt(T)?(e.consume(T),U):Oe(T)?(e.consume(T),_):P(T)}function U(T){return T===45||T===46||T===58||T===95||Tt(T)?(e.consume(T),U):F(T)}function F(T){return T===61?(e.consume(T),z):Oe(T)?(e.consume(T),F):_(T)}function z(T){return T===null||T===60||T===61||T===62||T===96?l(T):T===34||T===39?(e.consume(T),d=T,B):Oe(T)?(e.consume(T),z):$(T)}function B(T){return T===d?(e.consume(T),d=null,ae):T===null||we(T)?l(T):(e.consume(T),B)}function $(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ze(T)?F(T):(e.consume(T),$)}function ae(T){return T===47||T===62||Oe(T)?_(T):l(T)}function P(T){return T===62?(e.consume(T),re):l(T)}function re(T){return T===null||we(T)?le(T):Oe(T)?(e.consume(T),re):l(T)}function le(T){return T===45&&o===2?(e.consume(T),D):T===60&&o===1?(e.consume(T),X):T===62&&o===4?(e.consume(T),R):T===63&&o===3?(e.consume(T),j):T===93&&o===5?(e.consume(T),ie):we(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(TM,G,se)(T)):T===null||we(T)?(e.exit("htmlFlowData"),se(T)):(e.consume(T),le)}function se(T){return e.check(_M,J,G)(T)}function J(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),Z}function Z(T){return T===null||we(T)?se(T):(e.enter("htmlFlowData"),le(T))}function D(T){return T===45?(e.consume(T),j):le(T)}function X(T){return T===47?(e.consume(T),c="",ne):le(T)}function ne(T){if(T===62){const ue=c.toLowerCase();return Rb.includes(ue)?(e.consume(T),R):le(T)}return Dt(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ne):le(T)}function ie(T){return T===93?(e.consume(T),j):le(T)}function j(T){return T===62?(e.consume(T),R):T===45&&o===2?(e.consume(T),j):le(T)}function R(T){return T===null||we(T)?(e.exit("htmlFlowData"),G(T)):(e.consume(T),R)}function G(T){return e.exit("htmlFlow"),r(T)}}function OM(e,r,l){const i=this;return o;function o(c){return we(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):l(c)}function u(c){return i.parser.lazy[i.now().line]?l(c):r(c)}}function zM(e,r,l){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(mo,r,l)}}const DM={name:"htmlText",tokenize:LM};function LM(e,r,l){const i=this;let o,u,c;return f;function f(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),d}function d(j){return j===33?(e.consume(j),m):j===47?(e.consume(j),F):j===63?(e.consume(j),_):Dt(j)?(e.consume(j),$):l(j)}function m(j){return j===45?(e.consume(j),g):j===91?(e.consume(j),u=0,k):Dt(j)?(e.consume(j),O):l(j)}function g(j){return j===45?(e.consume(j),v):l(j)}function y(j){return j===null?l(j):j===45?(e.consume(j),b):we(j)?(c=y,X(j)):(e.consume(j),y)}function b(j){return j===45?(e.consume(j),v):y(j)}function v(j){return j===62?D(j):j===45?b(j):y(j)}function k(j){const R="CDATA[";return j===R.charCodeAt(u++)?(e.consume(j),u===R.length?C:k):l(j)}function C(j){return j===null?l(j):j===93?(e.consume(j),A):we(j)?(c=C,X(j)):(e.consume(j),C)}function A(j){return j===93?(e.consume(j),N):C(j)}function N(j){return j===62?D(j):j===93?(e.consume(j),N):C(j)}function O(j){return j===null||j===62?D(j):we(j)?(c=O,X(j)):(e.consume(j),O)}function _(j){return j===null?l(j):j===63?(e.consume(j),U):we(j)?(c=_,X(j)):(e.consume(j),_)}function U(j){return j===62?D(j):_(j)}function F(j){return Dt(j)?(e.consume(j),z):l(j)}function z(j){return j===45||Tt(j)?(e.consume(j),z):B(j)}function B(j){return we(j)?(c=B,X(j)):Oe(j)?(e.consume(j),B):D(j)}function $(j){return j===45||Tt(j)?(e.consume(j),$):j===47||j===62||Ze(j)?ae(j):l(j)}function ae(j){return j===47?(e.consume(j),D):j===58||j===95||Dt(j)?(e.consume(j),P):we(j)?(c=ae,X(j)):Oe(j)?(e.consume(j),ae):D(j)}function P(j){return j===45||j===46||j===58||j===95||Tt(j)?(e.consume(j),P):re(j)}function re(j){return j===61?(e.consume(j),le):we(j)?(c=re,X(j)):Oe(j)?(e.consume(j),re):ae(j)}function le(j){return j===null||j===60||j===61||j===62||j===96?l(j):j===34||j===39?(e.consume(j),o=j,se):we(j)?(c=le,X(j)):Oe(j)?(e.consume(j),le):(e.consume(j),J)}function se(j){return j===o?(e.consume(j),o=void 0,Z):j===null?l(j):we(j)?(c=se,X(j)):(e.consume(j),se)}function J(j){return j===null||j===34||j===39||j===60||j===61||j===96?l(j):j===47||j===62||Ze(j)?ae(j):(e.consume(j),J)}function Z(j){return j===47||j===62||Ze(j)?ae(j):l(j)}function D(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),r):l(j)}function X(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),ne}function ne(j){return Oe(j)?Be(e,ie,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):ie(j)}function ie(j){return e.enter("htmlTextData"),c(j)}}const am={name:"labelEnd",resolveAll:PM,resolveTo:qM,tokenize:FM},BM={tokenize:VM},UM={tokenize:IM},HM={tokenize:GM};function PM(e){let r=-1;const l=[];for(;++r<e.length;){const i=e[r][1];if(l.push(e[r]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",r+=o}}return e.length!==l.length&&ln(e,0,e.length,l),e}function qM(e,r){let l=e.length,i=0,o,u,c,f;for(;l--;)if(o=e[l][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[l][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[l][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=l,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(c=l);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,r],["enter",m,r]],f=yn(f,e.slice(u+1,u+i+3)),f=yn(f,[["enter",g,r]]),f=yn(f,Bu(r.parser.constructs.insideSpan.null,e.slice(u+i+4,c-3),r)),f=yn(f,[["exit",g,r],e[c-2],e[c-1],["exit",m,r]]),f=yn(f,e.slice(c+1)),f=yn(f,[["exit",d,r]]),ln(e,u,e.length,f),e}function FM(e,r,l){const i=this;let o=i.events.length,u,c;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){u=i.events[o][1];break}return f;function f(b){return u?u._inactive?y(b):(c=i.parser.defined.includes(kn(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):l(b)}function d(b){return b===40?e.attempt(BM,g,c?g:y)(b):b===91?e.attempt(UM,g,c?m:y)(b):c?g(b):y(b)}function m(b){return e.attempt(HM,g,y)(b)}function g(b){return r(b)}function y(b){return u._balanced=!0,l(b)}}function VM(e,r,l){return i;function i(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Ze(y)?Ka(e,u)(y):u(y)}function u(y){return y===41?g(y):xw(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function c(y){return Ze(y)?Ka(e,d)(y):g(y)}function f(y){return l(y)}function d(y){return y===34||y===39||y===40?vw(e,m,l,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function m(y){return Ze(y)?Ka(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),r):l(y)}}function IM(e,r,l){const i=this;return o;function o(f){return bw.call(i,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return i.parser.defined.includes(kn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?r(f):l(f)}function c(f){return l(f)}}function GM(e,r,l){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):l(u)}}const YM={name:"labelStartImage",resolveAll:am.resolveAll,tokenize:$M};function $M(e,r,l){const i=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):l(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?l(f):r(f)}}const XM={name:"labelStartLink",resolveAll:am.resolveAll,tokenize:QM};function QM(e,r,l){const i=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?l(c):r(c)}}const Nd={name:"lineEnding",tokenize:ZM};function ZM(e,r){return l;function l(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Be(e,r,"linePrefix")}}const Js={name:"thematicBreak",tokenize:KM};function KM(e,r,l){let i=0,o;return u;function u(m){return e.enter("thematicBreak"),c(m)}function c(m){return o=m,f(m)}function f(m){return m===o?(e.enter("thematicBreakSequence"),d(m)):i>=3&&(m===null||we(m))?(e.exit("thematicBreak"),r(m)):l(m)}function d(m){return m===o?(e.consume(m),i++,d):(e.exit("thematicBreakSequence"),Oe(m)?Be(e,f,"whitespace")(m):f(m))}}const Gt={continuation:{tokenize:tO},exit:rO,name:"list",tokenize:eO},JM={partial:!0,tokenize:lO},WM={partial:!0,tokenize:nO};function eO(e,r,l){const i=this,o=i.events[i.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return f;function f(v){const k=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:sh(v)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Js,l,m)(v):m(v);if(!i.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return l(v)}function d(v){return sh(v)&&++c<10?(e.consume(v),d):(!i.interrupt||c<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):l(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,e.check(mo,i.interrupt?l:g,e.attempt(JM,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return Oe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):l(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(v)}}function tO(e,r,l){const i=this;return i.containerState._closeFlow=void 0,e.check(mo,o,u);function o(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Be(e,r,"listItemIndent",i.containerState.size+1)(f)}function u(f){return i.containerState.furtherBlankLines||!Oe(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,c(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(WM,r,c)(f))}function c(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,Be(e,e.attempt(Gt,r,l),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function nO(e,r,l){const i=this;return Be(e,o,"listItemIndent",i.containerState.size+1);function o(u){const c=i.events[i.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===i.containerState.size?r(u):l(u)}}function rO(e){e.exit(this.containerState.type)}function lO(e,r,l){const i=this;return Be(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const c=i.events[i.events.length-1];return!Oe(u)&&c&&c[1].type==="listItemPrefixWhitespace"?r(u):l(u)}}const Mb={name:"setextUnderline",resolveTo:iO,tokenize:aO};function iO(e,r){let l=e.length,i,o,u;for(;l--;)if(e[l][0]==="enter"){if(e[l][1].type==="content"){i=l;break}e[l][1].type==="paragraph"&&(o=l)}else e[l][1].type==="content"&&e.splice(l,1),!u&&e[l][1].type==="definition"&&(u=l);const c={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",c,r]),e.splice(u+1,0,["exit",e[i][1],r]),e[i][1].end={...e[u][1].end}):e[i][1]=c,e.push(["exit",c,r]),e}function aO(e,r,l){const i=this;let o;return u;function u(m){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(e.enter("setextHeadingLine"),o=m,c(m)):l(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===o?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),Oe(m)?Be(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||we(m)?(e.exit("setextHeadingLine"),r(m)):l(m)}}const oO={tokenize:sO};function sO(e){const r=this,l=e.attempt(mo,i,e.attempt(this.parser.constructs.flowInitial,o,Be(e,e.attempt(this.parser.constructs.flow,o,e.attempt(hM,o)),"linePrefix")));return l;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,l}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,l}}const uO={resolveAll:Sw()},cO=ww("string"),fO=ww("text");function ww(e){return{resolveAll:Sw(e==="text"?dO:void 0),tokenize:r};function r(l){const i=this,o=this.parser.constructs[e],u=l.attempt(o,c,f);return c;function c(g){return m(g)?u(g):f(g)}function f(g){if(g===null){l.consume(g);return}return l.enter("data"),l.consume(g),d}function d(g){return m(g)?(l.exit("data"),u(g)):(l.consume(g),d)}function m(g){if(g===null)return!0;const y=o[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function Sw(e){return r;function r(l,i){let o=-1,u;for(;++o<=l.length;)u===void 0?l[o]&&l[o][1].type==="data"&&(u=o,o++):(!l[o]||l[o][1].type!=="data")&&(o!==u+2&&(l[u][1].end=l[o-1][1].end,l.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(l,i):l}}function dO(e,r){let l=0;for(;++l<=e.length;)if((l===e.length||e[l][1].type==="lineEnding")&&e[l-1][1].type==="data"){const i=e[l-1][1],o=r.sliceStream(i);let u=o.length,c=-1,f=0,d;for(;u--;){const m=o[u];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){u++;break}}if(r._contentTypeTextTrailing&&l===e.length&&(f=0),f){const m={type:l===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:i.start._bufferIndex+c,_index:i.start._index+u,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...m.start},i.start.offset===i.end.offset?Object.assign(i,m):(e.splice(l,0,["enter",m,r],["exit",m,r]),l+=2)}l++}return e}const hO={42:Gt,43:Gt,45:Gt,48:Gt,49:Gt,50:Gt,51:Gt,52:Gt,53:Gt,54:Gt,55:Gt,56:Gt,57:Gt,62:mw},mO={91:xM},pO={[-2]:Ed,[-1]:Ed,32:Ed},gO={35:CM,42:Js,45:[Mb,Js],60:jM,61:Mb,95:Js,96:_b,126:_b},yO={38:gw,92:pw},xO={[-5]:Nd,[-4]:Nd,[-3]:Nd,33:YM,38:gw,42:uh,60:[X4,DM],91:XM,92:[SM,pw],93:am,95:uh,96:oM},bO={null:[uh,uO]},vO={null:[42,95]},wO={null:[]},SO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vO,contentInitial:mO,disable:wO,document:hO,flow:gO,flowInitial:pO,insideSpan:bO,string:yO,text:xO},Symbol.toStringTag,{value:"Module"}));function kO(e,r,l){let i={_bufferIndex:-1,_index:0,line:l&&l.line||1,column:l&&l.column||1,offset:l&&l.offset||0};const o={},u=[];let c=[],f=[];const d={attempt:B(F),check:B(z),consume:O,enter:_,exit:U,interrupt:B(z,{interrupt:!0})},m={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=r.tokenize.call(m,d);return r.resolveAll&&u.push(r),m;function y(re){return c=yn(c,re),A(),c[c.length-1]!==null?[]:($(r,0),m.events=Bu(u,m.events,m),m.events)}function b(re,le){return EO(v(re),le)}function v(re){return CO(c,re)}function k(){const{_bufferIndex:re,_index:le,line:se,column:J,offset:Z}=i;return{_bufferIndex:re,_index:le,line:se,column:J,offset:Z}}function C(re){o[re.line]=re.column,P()}function A(){let re;for(;i._index<c.length;){const le=c[i._index];if(typeof le=="string")for(re=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===re&&i._bufferIndex<le.length;)N(le.charCodeAt(i._bufferIndex));else N(le)}}function N(re){g=g(re)}function O(re){we(re)?(i.line++,i.column=1,i.offset+=re===-3?2:1,P()):re!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===c[i._index].length&&(i._bufferIndex=-1,i._index++)),m.previous=re}function _(re,le){const se=le||{};return se.type=re,se.start=k(),m.events.push(["enter",se,m]),f.push(se),se}function U(re){const le=f.pop();return le.end=k(),m.events.push(["exit",le,m]),le}function F(re,le){$(re,le.from)}function z(re,le){le.restore()}function B(re,le){return se;function se(J,Z,D){let X,ne,ie,j;return Array.isArray(J)?G(J):"tokenize"in J?G([J]):R(J);function R(ce){return Ce;function Ce(Ue){const ve=Ue!==null&&ce[Ue],at=Ue!==null&&ce.null,dt=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(at)?at:at?[at]:[]];return G(dt)(Ue)}}function G(ce){return X=ce,ne=0,ce.length===0?D:T(ce[ne])}function T(ce){return Ce;function Ce(Ue){return j=ae(),ie=ce,ce.partial||(m.currentConstruct=ce),ce.name&&m.parser.constructs.disable.null.includes(ce.name)?de():ce.tokenize.call(le?Object.assign(Object.create(m),le):m,d,ue,de)(Ue)}}function ue(ce){return re(ie,j),Z}function de(ce){return j.restore(),++ne<X.length?T(X[ne]):D}}}function $(re,le){re.resolveAll&&!u.includes(re)&&u.push(re),re.resolve&&ln(m.events,le,m.events.length-le,re.resolve(m.events.slice(le),m)),re.resolveTo&&(m.events=re.resolveTo(m.events,m))}function ae(){const re=k(),le=m.previous,se=m.currentConstruct,J=m.events.length,Z=Array.from(f);return{from:J,restore:D};function D(){i=re,m.previous=le,m.currentConstruct=se,m.events.length=J,f=Z,P()}}function P(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function CO(e,r){const l=r.start._index,i=r.start._bufferIndex,o=r.end._index,u=r.end._bufferIndex;let c;if(l===o)c=[e[l].slice(i,u)];else{if(c=e.slice(l,o),i>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(i):c.shift()}u>0&&c.push(e[o].slice(0,u))}return c}function EO(e,r){let l=-1;const i=[];let o;for(;++l<e.length;){const u=e[l];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
384
+ */const dT=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],H0=Se("zap",dT),P0=zA,hT=DA,q0=S.forwardRef(({className:e,...r},l)=>x.jsx(j0,{ref:l,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));q0.displayName=j0.displayName;const mT={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Uh=S.forwardRef(({className:e,children:r,size:l="md",...i},o)=>x.jsxs(hT,{children:[x.jsx(q0,{}),x.jsxs(T0,{ref:o,className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",mT[l],e),...i,children:[r,x.jsxs(UA,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[x.jsx(so,{className:"h-4 w-4"}),x.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Uh.displayName=T0.displayName;function F0({className:e,...r}){return x.jsx(LA,{className:xe("text-lg font-medium leading-none tracking-tight",e),...r})}function pT({className:e,...r}){return x.jsx(BA,{className:xe("text-sm text-muted-foreground",e),...r})}function V0({className:e,...r}){return x.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...r})}function I0({className:e,...r}){return x.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...r})}const G0=S.createContext(null);function gT({children:e}){const[r,l]=S.useState(null),[i,o]=S.useState(""),u=S.useRef(null);S.useEffect(()=>{(r==null?void 0:r.kind)==="prompt"&&(o(r.options.initialValue??""),setTimeout(()=>{var g,y;(g=u.current)==null||g.focus(),(y=u.current)==null||y.select()},0))},[r]);const c=S.useCallback(()=>{l(null),o("")},[]),f=S.useCallback(g=>new Promise(y=>{l({kind:"confirm",options:g,resolve:y})}),[]),d=S.useCallback(g=>new Promise(y=>{l({kind:"prompt",options:g,resolve:y})}),[]),m=S.useMemo(()=>({confirm:f,prompt:d}),[f,d]);return x.jsxs(G0.Provider,{value:m,children:[e,x.jsx(P0,{open:r!==null,onOpenChange:g=>{g||!r||(r.kind==="confirm"?r.resolve(!1):r.resolve(null),c())},children:x.jsx(Uh,{size:"sm",children:r?x.jsxs(x.Fragment,{children:[x.jsxs(V0,{className:"space-y-4",children:[x.jsx(F0,{children:r.options.title}),r.options.description?x.jsx(pT,{children:r.options.description}):null,r.kind==="prompt"?x.jsx("input",{ref:u,type:"text",value:i,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),r.resolve(i.trim()||null),c())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:r.options.placeholder}):null]}),x.jsxs(I0,{children:[x.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>{r.kind==="confirm"?r.resolve(!1):r.resolve(null),c()},children:r.options.cancelLabel??"Cancel"}),x.jsx(qe,{variant:r.kind==="confirm"?r.options.confirmVariant??"default":"secondary",size:"sm",onClick:()=>{r.kind==="confirm"?r.resolve(!0):r.resolve(i.trim()||null),c()},disabled:r.kind==="prompt"&&!i.trim(),children:r.options.confirmLabel??"Confirm"})]})]}):null})})]})}function yT(){const e=S.useContext(G0);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const xT=["top","right","bottom","left"],Jr=Math.min,nn=Math.max,ru=Math.round,Ps=Math.floor,Pn=e=>({x:e,y:e}),bT={left:"right",right:"left",bottom:"top",top:"bottom"};function Zd(e,r,l){return nn(e,Jr(r,l))}function mr(e,r){return typeof e=="function"?e(r):e}function pr(e){return e.split("-")[0]}function Pi(e){return e.split("-")[1]}function Hh(e){return e==="x"?"y":"x"}function Ph(e){return e==="y"?"height":"width"}function Un(e){const r=e[0];return r==="t"||r==="b"?"y":"x"}function qh(e){return Hh(Un(e))}function vT(e,r,l){l===void 0&&(l=!1);const i=Pi(e),o=qh(e),u=Ph(o);let c=o==="x"?i===(l?"end":"start")?"right":"left":i==="start"?"bottom":"top";return r.reference[u]>r.floating[u]&&(c=lu(c)),[c,lu(c)]}function wT(e){const r=lu(e);return[Kd(e),r,Kd(r)]}function Kd(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const tb=["left","right"],nb=["right","left"],ST=["top","bottom"],kT=["bottom","top"];function CT(e,r,l){switch(e){case"top":case"bottom":return l?r?nb:tb:r?tb:nb;case"left":case"right":return r?ST:kT;default:return[]}}function ET(e,r,l,i){const o=Pi(e);let u=CT(pr(e),l==="start",i);return o&&(u=u.map(c=>c+"-"+o),r&&(u=u.concat(u.map(Kd)))),u}function lu(e){const r=pr(e);return bT[r]+e.slice(r.length)}function NT(e){return{top:0,right:0,bottom:0,left:0,...e}}function Y0(e){return typeof e!="number"?NT(e):{top:e,right:e,bottom:e,left:e}}function iu(e){const{x:r,y:l,width:i,height:o}=e;return{width:i,height:o,top:l,left:r,right:r+i,bottom:l+o,x:r,y:l}}function rb(e,r,l){let{reference:i,floating:o}=e;const u=Un(r),c=qh(r),f=Ph(c),d=pr(r),m=u==="y",g=i.x+i.width/2-o.width/2,y=i.y+i.height/2-o.height/2,b=i[f]/2-o[f]/2;let v;switch(d){case"top":v={x:g,y:i.y-o.height};break;case"bottom":v={x:g,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y};break;case"left":v={x:i.x-o.width,y};break;default:v={x:i.x,y:i.y}}switch(Pi(r)){case"start":v[c]-=b*(l&&m?-1:1);break;case"end":v[c]+=b*(l&&m?-1:1);break}return v}async function AT(e,r){var l;r===void 0&&(r={});const{x:i,y:o,platform:u,rects:c,elements:f,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:g="viewport",elementContext:y="floating",altBoundary:b=!1,padding:v=0}=mr(r,e),k=Y0(v),A=f[b?y==="floating"?"reference":"floating":y],N=iu(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(A)))==null||l?A:A.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(f.floating)),boundary:m,rootBoundary:g,strategy:d})),O=y==="floating"?{x:i,y:o,width:c.floating.width,height:c.floating.height}:c.reference,_=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f.floating)),U=await(u.isElement==null?void 0:u.isElement(_))?await(u.getScale==null?void 0:u.getScale(_))||{x:1,y:1}:{x:1,y:1},F=iu(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:O,offsetParent:_,strategy:d}):O);return{top:(N.top-F.top+k.top)/U.y,bottom:(F.bottom-N.bottom+k.bottom)/U.y,left:(N.left-F.left+k.left)/U.x,right:(F.right-N.right+k.right)/U.x}}const jT=50,TT=async(e,r,l)=>{const{placement:i="bottom",strategy:o="absolute",middleware:u=[],platform:c}=l,f=c.detectOverflow?c:{...c,detectOverflow:AT},d=await(c.isRTL==null?void 0:c.isRTL(r));let m=await c.getElementRects({reference:e,floating:r,strategy:o}),{x:g,y}=rb(m,i,d),b=i,v=0;const k={};for(let C=0;C<u.length;C++){const A=u[C];if(!A)continue;const{name:N,fn:O}=A,{x:_,y:U,data:F,reset:z}=await O({x:g,y,initialPlacement:i,placement:b,strategy:o,middlewareData:k,rects:m,platform:f,elements:{reference:e,floating:r}});g=_??g,y=U??y,k[N]={...k[N],...F},z&&v<jT&&(v++,typeof z=="object"&&(z.placement&&(b=z.placement),z.rects&&(m=z.rects===!0?await c.getElementRects({reference:e,floating:r,strategy:o}):z.rects),{x:g,y}=rb(m,b,d)),C=-1)}return{x:g,y,placement:b,strategy:o,middlewareData:k}},_T=e=>({name:"arrow",options:e,async fn(r){const{x:l,y:i,placement:o,rects:u,platform:c,elements:f,middlewareData:d}=r,{element:m,padding:g=0}=mr(e,r)||{};if(m==null)return{};const y=Y0(g),b={x:l,y:i},v=qh(o),k=Ph(v),C=await c.getDimensions(m),A=v==="y",N=A?"top":"left",O=A?"bottom":"right",_=A?"clientHeight":"clientWidth",U=u.reference[k]+u.reference[v]-b[v]-u.floating[k],F=b[v]-u.reference[v],z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let B=z?z[_]:0;(!B||!await(c.isElement==null?void 0:c.isElement(z)))&&(B=f.floating[_]||u.floating[k]);const $=U/2-F/2,ae=B/2-C[k]/2-1,P=Jr(y[N],ae),re=Jr(y[O],ae),le=P,se=B-C[k]-re,J=B/2-C[k]/2+$,Z=Zd(le,J,se),D=!d.arrow&&Pi(o)!=null&&J!==Z&&u.reference[k]/2-(J<le?P:re)-C[k]/2<0,X=D?J<le?J-le:J-se:0;return{[v]:b[v]+X,data:{[v]:Z,centerOffset:J-Z-X,...D&&{alignmentOffset:X}},reset:D}}}),RT=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(r){var l,i;const{placement:o,middlewareData:u,rects:c,initialPlacement:f,platform:d,elements:m}=r,{mainAxis:g=!0,crossAxis:y=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:C=!0,...A}=mr(e,r);if((l=u.arrow)!=null&&l.alignmentOffset)return{};const N=pr(o),O=Un(f),_=pr(f)===f,U=await(d.isRTL==null?void 0:d.isRTL(m.floating)),F=b||(_||!C?[lu(f)]:wT(f)),z=k!=="none";!b&&z&&F.push(...ET(f,C,k,U));const B=[f,...F],$=await d.detectOverflow(r,A),ae=[];let P=((i=u.flip)==null?void 0:i.overflows)||[];if(g&&ae.push($[N]),y){const J=vT(o,c,U);ae.push($[J[0]],$[J[1]])}if(P=[...P,{placement:o,overflows:ae}],!ae.every(J=>J<=0)){var re,le;const J=(((re=u.flip)==null?void 0:re.index)||0)+1,Z=B[J];if(Z&&(!(y==="alignment"?O!==Un(Z):!1)||P.every(ne=>Un(ne.placement)===O?ne.overflows[0]>0:!0)))return{data:{index:J,overflows:P},reset:{placement:Z}};let D=(le=P.filter(X=>X.overflows[0]<=0).sort((X,ne)=>X.overflows[1]-ne.overflows[1])[0])==null?void 0:le.placement;if(!D)switch(v){case"bestFit":{var se;const X=(se=P.filter(ne=>{if(z){const ie=Un(ne.placement);return ie===O||ie==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(ie=>ie>0).reduce((ie,j)=>ie+j,0)]).sort((ne,ie)=>ne[1]-ie[1])[0])==null?void 0:se[0];X&&(D=X);break}case"initialPlacement":D=f;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function lb(e,r){return{top:e.top-r.height,right:e.right-r.width,bottom:e.bottom-r.height,left:e.left-r.width}}function ib(e){return xT.some(r=>e[r]>=0)}const MT=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(r){const{rects:l,platform:i}=r,{strategy:o="referenceHidden",...u}=mr(e,r);switch(o){case"referenceHidden":{const c=await i.detectOverflow(r,{...u,elementContext:"reference"}),f=lb(c,l.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:ib(f)}}}case"escaped":{const c=await i.detectOverflow(r,{...u,altBoundary:!0}),f=lb(c,l.floating);return{data:{escapedOffsets:f,escaped:ib(f)}}}default:return{}}}}},$0=new Set(["left","top"]);async function OT(e,r){const{placement:l,platform:i,elements:o}=e,u=await(i.isRTL==null?void 0:i.isRTL(o.floating)),c=pr(l),f=Pi(l),d=Un(l)==="y",m=$0.has(c)?-1:1,g=u&&d?-1:1,y=mr(r,e);let{mainAxis:b,crossAxis:v,alignmentAxis:k}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return f&&typeof k=="number"&&(v=f==="end"?k*-1:k),d?{x:v*g,y:b*m}:{x:b*m,y:v*g}}const zT=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(r){var l,i;const{x:o,y:u,placement:c,middlewareData:f}=r,d=await OT(r,e);return c===((l=f.offset)==null?void 0:l.placement)&&(i=f.arrow)!=null&&i.alignmentOffset?{}:{x:o+d.x,y:u+d.y,data:{...d,placement:c}}}}},DT=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(r){const{x:l,y:i,placement:o,platform:u}=r,{mainAxis:c=!0,crossAxis:f=!1,limiter:d={fn:N=>{let{x:O,y:_}=N;return{x:O,y:_}}},...m}=mr(e,r),g={x:l,y:i},y=await u.detectOverflow(r,m),b=Un(pr(o)),v=Hh(b);let k=g[v],C=g[b];if(c){const N=v==="y"?"top":"left",O=v==="y"?"bottom":"right",_=k+y[N],U=k-y[O];k=Zd(_,k,U)}if(f){const N=b==="y"?"top":"left",O=b==="y"?"bottom":"right",_=C+y[N],U=C-y[O];C=Zd(_,C,U)}const A=d.fn({...r,[v]:k,[b]:C});return{...A,data:{x:A.x-l,y:A.y-i,enabled:{[v]:c,[b]:f}}}}}},LT=function(e){return e===void 0&&(e={}),{options:e,fn(r){const{x:l,y:i,placement:o,rects:u,middlewareData:c}=r,{offset:f=0,mainAxis:d=!0,crossAxis:m=!0}=mr(e,r),g={x:l,y:i},y=Un(o),b=Hh(y);let v=g[b],k=g[y];const C=mr(f,r),A=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(d){const _=b==="y"?"height":"width",U=u.reference[b]-u.floating[_]+A.mainAxis,F=u.reference[b]+u.reference[_]-A.mainAxis;v<U?v=U:v>F&&(v=F)}if(m){var N,O;const _=b==="y"?"width":"height",U=$0.has(pr(o)),F=u.reference[y]-u.floating[_]+(U&&((N=c.offset)==null?void 0:N[y])||0)+(U?0:A.crossAxis),z=u.reference[y]+u.reference[_]+(U?0:((O=c.offset)==null?void 0:O[y])||0)-(U?A.crossAxis:0);k<F?k=F:k>z&&(k=z)}return{[b]:v,[y]:k}}}},BT=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(r){var l,i;const{placement:o,rects:u,platform:c,elements:f}=r,{apply:d=()=>{},...m}=mr(e,r),g=await c.detectOverflow(r,m),y=pr(o),b=Pi(o),v=Un(o)==="y",{width:k,height:C}=u.floating;let A,N;y==="top"||y==="bottom"?(A=y,N=b===(await(c.isRTL==null?void 0:c.isRTL(f.floating))?"start":"end")?"left":"right"):(N=y,A=b==="end"?"top":"bottom");const O=C-g.top-g.bottom,_=k-g.left-g.right,U=Jr(C-g[A],O),F=Jr(k-g[N],_),z=!r.middlewareData.shift;let B=U,$=F;if((l=r.middlewareData.shift)!=null&&l.enabled.x&&($=_),(i=r.middlewareData.shift)!=null&&i.enabled.y&&(B=O),z&&!b){const P=nn(g.left,0),re=nn(g.right,0),le=nn(g.top,0),se=nn(g.bottom,0);v?$=k-2*(P!==0||re!==0?P+re:nn(g.left,g.right)):B=C-2*(le!==0||se!==0?le+se:nn(g.top,g.bottom))}await d({...r,availableWidth:$,availableHeight:B});const ae=await c.getDimensions(f.floating);return k!==ae.width||C!==ae.height?{reset:{rects:!0}}:{}}}};function Cu(){return typeof window<"u"}function qi(e){return X0(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var r;return(e==null||(r=e.ownerDocument)==null?void 0:r.defaultView)||window}function Vn(e){var r;return(r=(X0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:r.documentElement}function X0(e){return Cu()?e instanceof Node||e instanceof rn(e).Node:!1}function Cn(e){return Cu()?e instanceof Element||e instanceof rn(e).Element:!1}function gr(e){return Cu()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function ab(e){return!Cu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}function uo(e){const{overflow:r,overflowX:l,overflowY:i,display:o}=En(e);return/auto|scroll|overlay|hidden|clip/.test(r+i+l)&&o!=="inline"&&o!=="contents"}function UT(e){return/^(table|td|th)$/.test(qi(e))}function Eu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const HT=/transform|translate|scale|rotate|perspective|filter/,PT=/paint|layout|strict|content/,Nl=e=>!!e&&e!=="none";let xd;function Fh(e){const r=Cn(e)?En(e):e;return Nl(r.transform)||Nl(r.translate)||Nl(r.scale)||Nl(r.rotate)||Nl(r.perspective)||!Vh()&&(Nl(r.backdropFilter)||Nl(r.filter))||HT.test(r.willChange||"")||PT.test(r.contain||"")}function qT(e){let r=Wr(e);for(;gr(r)&&!Mi(r);){if(Fh(r))return r;if(Eu(r))return null;r=Wr(r)}return null}function Vh(){return xd==null&&(xd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xd}function Mi(e){return/^(html|body|#document)$/.test(qi(e))}function En(e){return rn(e).getComputedStyle(e)}function Nu(e){return Cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wr(e){if(qi(e)==="html")return e;const r=e.assignedSlot||e.parentNode||ab(e)&&e.host||Vn(e);return ab(r)?r.host:r}function Q0(e){const r=Wr(e);return Mi(r)?e.ownerDocument?e.ownerDocument.body:e.body:gr(r)&&uo(r)?r:Q0(r)}function eo(e,r,l){var i;r===void 0&&(r=[]),l===void 0&&(l=!0);const o=Q0(e),u=o===((i=e.ownerDocument)==null?void 0:i.body),c=rn(o);if(u){const f=Jd(c);return r.concat(c,c.visualViewport||[],uo(o)?o:[],f&&l?eo(f):[])}else return r.concat(o,eo(o,[],l))}function Jd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Z0(e){const r=En(e);let l=parseFloat(r.width)||0,i=parseFloat(r.height)||0;const o=gr(e),u=o?e.offsetWidth:l,c=o?e.offsetHeight:i,f=ru(l)!==u||ru(i)!==c;return f&&(l=u,i=c),{width:l,height:i,$:f}}function Ih(e){return Cn(e)?e:e.contextElement}function Ti(e){const r=Ih(e);if(!gr(r))return Pn(1);const l=r.getBoundingClientRect(),{width:i,height:o,$:u}=Z0(r);let c=(u?ru(l.width):l.width)/i,f=(u?ru(l.height):l.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const FT=Pn(0);function K0(e){const r=rn(e);return!Vh()||!r.visualViewport?FT:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function VT(e,r,l){return r===void 0&&(r=!1),!l||r&&l!==rn(e)?!1:r}function Rl(e,r,l,i){r===void 0&&(r=!1),l===void 0&&(l=!1);const o=e.getBoundingClientRect(),u=Ih(e);let c=Pn(1);r&&(i?Cn(i)&&(c=Ti(i)):c=Ti(e));const f=VT(u,l,i)?K0(u):Pn(0);let d=(o.left+f.x)/c.x,m=(o.top+f.y)/c.y,g=o.width/c.x,y=o.height/c.y;if(u){const b=rn(u),v=i&&Cn(i)?rn(i):i;let k=b,C=Jd(k);for(;C&&i&&v!==k;){const A=Ti(C),N=C.getBoundingClientRect(),O=En(C),_=N.left+(C.clientLeft+parseFloat(O.paddingLeft))*A.x,U=N.top+(C.clientTop+parseFloat(O.paddingTop))*A.y;d*=A.x,m*=A.y,g*=A.x,y*=A.y,d+=_,m+=U,k=rn(C),C=Jd(k)}}return iu({width:g,height:y,x:d,y:m})}function Au(e,r){const l=Nu(e).scrollLeft;return r?r.left+l:Rl(Vn(e)).left+l}function J0(e,r){const l=e.getBoundingClientRect(),i=l.left+r.scrollLeft-Au(e,l),o=l.top+r.scrollTop;return{x:i,y:o}}function IT(e){let{elements:r,rect:l,offsetParent:i,strategy:o}=e;const u=o==="fixed",c=Vn(i),f=r?Eu(r.floating):!1;if(i===c||f&&u)return l;let d={scrollLeft:0,scrollTop:0},m=Pn(1);const g=Pn(0),y=gr(i);if((y||!y&&!u)&&((qi(i)!=="body"||uo(c))&&(d=Nu(i)),y)){const v=Rl(i);m=Ti(i),g.x=v.x+i.clientLeft,g.y=v.y+i.clientTop}const b=c&&!y&&!u?J0(c,d):Pn(0);return{width:l.width*m.x,height:l.height*m.y,x:l.x*m.x-d.scrollLeft*m.x+g.x+b.x,y:l.y*m.y-d.scrollTop*m.y+g.y+b.y}}function GT(e){return Array.from(e.getClientRects())}function YT(e){const r=Vn(e),l=Nu(e),i=e.ownerDocument.body,o=nn(r.scrollWidth,r.clientWidth,i.scrollWidth,i.clientWidth),u=nn(r.scrollHeight,r.clientHeight,i.scrollHeight,i.clientHeight);let c=-l.scrollLeft+Au(e);const f=-l.scrollTop;return En(i).direction==="rtl"&&(c+=nn(r.clientWidth,i.clientWidth)-o),{width:o,height:u,x:c,y:f}}const ob=25;function $T(e,r){const l=rn(e),i=Vn(e),o=l.visualViewport;let u=i.clientWidth,c=i.clientHeight,f=0,d=0;if(o){u=o.width,c=o.height;const g=Vh();(!g||g&&r==="fixed")&&(f=o.offsetLeft,d=o.offsetTop)}const m=Au(i);if(m<=0){const g=i.ownerDocument,y=g.body,b=getComputedStyle(y),v=g.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,k=Math.abs(i.clientWidth-y.clientWidth-v);k<=ob&&(u-=k)}else m<=ob&&(u+=m);return{width:u,height:c,x:f,y:d}}function XT(e,r){const l=Rl(e,!0,r==="fixed"),i=l.top+e.clientTop,o=l.left+e.clientLeft,u=gr(e)?Ti(e):Pn(1),c=e.clientWidth*u.x,f=e.clientHeight*u.y,d=o*u.x,m=i*u.y;return{width:c,height:f,x:d,y:m}}function sb(e,r,l){let i;if(r==="viewport")i=$T(e,l);else if(r==="document")i=YT(Vn(e));else if(Cn(r))i=XT(r,l);else{const o=K0(e);i={x:r.x-o.x,y:r.y-o.y,width:r.width,height:r.height}}return iu(i)}function W0(e,r){const l=Wr(e);return l===r||!Cn(l)||Mi(l)?!1:En(l).position==="fixed"||W0(l,r)}function QT(e,r){const l=r.get(e);if(l)return l;let i=eo(e,[],!1).filter(f=>Cn(f)&&qi(f)!=="body"),o=null;const u=En(e).position==="fixed";let c=u?Wr(e):e;for(;Cn(c)&&!Mi(c);){const f=En(c),d=Fh(c);!d&&f.position==="fixed"&&(o=null),(u?!d&&!o:!d&&f.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||uo(c)&&!d&&W0(e,c))?i=i.filter(g=>g!==c):o=f,c=Wr(c)}return r.set(e,i),i}function ZT(e){let{element:r,boundary:l,rootBoundary:i,strategy:o}=e;const c=[...l==="clippingAncestors"?Eu(r)?[]:QT(r,this._c):[].concat(l),i],f=sb(r,c[0],o);let d=f.top,m=f.right,g=f.bottom,y=f.left;for(let b=1;b<c.length;b++){const v=sb(r,c[b],o);d=nn(v.top,d),m=Jr(v.right,m),g=Jr(v.bottom,g),y=nn(v.left,y)}return{width:m-y,height:g-d,x:y,y:d}}function KT(e){const{width:r,height:l}=Z0(e);return{width:r,height:l}}function JT(e,r,l){const i=gr(r),o=Vn(r),u=l==="fixed",c=Rl(e,!0,u,r);let f={scrollLeft:0,scrollTop:0};const d=Pn(0);function m(){d.x=Au(o)}if(i||!i&&!u)if((qi(r)!=="body"||uo(o))&&(f=Nu(r)),i){const v=Rl(r,!0,u,r);d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}else o&&m();u&&!i&&o&&m();const g=o&&!i&&!u?J0(o,f):Pn(0),y=c.left+f.scrollLeft-d.x-g.x,b=c.top+f.scrollTop-d.y-g.y;return{x:y,y:b,width:c.width,height:c.height}}function bd(e){return En(e).position==="static"}function ub(e,r){if(!gr(e)||En(e).position==="fixed")return null;if(r)return r(e);let l=e.offsetParent;return Vn(e)===l&&(l=l.ownerDocument.body),l}function e1(e,r){const l=rn(e);if(Eu(e))return l;if(!gr(e)){let o=Wr(e);for(;o&&!Mi(o);){if(Cn(o)&&!bd(o))return o;o=Wr(o)}return l}let i=ub(e,r);for(;i&&UT(i)&&bd(i);)i=ub(i,r);return i&&Mi(i)&&bd(i)&&!Fh(i)?l:i||qT(e)||l}const WT=async function(e){const r=this.getOffsetParent||e1,l=this.getDimensions,i=await l(e.floating);return{reference:JT(e.reference,await r(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function e_(e){return En(e).direction==="rtl"}const t_={convertOffsetParentRelativeRectToViewportRelativeRect:IT,getDocumentElement:Vn,getClippingRect:ZT,getOffsetParent:e1,getElementRects:WT,getClientRects:GT,getDimensions:KT,getScale:Ti,isElement:Cn,isRTL:e_};function t1(e,r){return e.x===r.x&&e.y===r.y&&e.width===r.width&&e.height===r.height}function n_(e,r){let l=null,i;const o=Vn(e);function u(){var f;clearTimeout(i),(f=l)==null||f.disconnect(),l=null}function c(f,d){f===void 0&&(f=!1),d===void 0&&(d=1),u();const m=e.getBoundingClientRect(),{left:g,top:y,width:b,height:v}=m;if(f||r(),!b||!v)return;const k=Ps(y),C=Ps(o.clientWidth-(g+b)),A=Ps(o.clientHeight-(y+v)),N=Ps(g),_={rootMargin:-k+"px "+-C+"px "+-A+"px "+-N+"px",threshold:nn(0,Jr(1,d))||1};let U=!0;function F(z){const B=z[0].intersectionRatio;if(B!==d){if(!U)return c();B?c(!1,B):i=setTimeout(()=>{c(!1,1e-7)},1e3)}B===1&&!t1(m,e.getBoundingClientRect())&&c(),U=!1}try{l=new IntersectionObserver(F,{..._,root:o.ownerDocument})}catch{l=new IntersectionObserver(F,_)}l.observe(e)}return c(!0),u}function r_(e,r,l,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,m=Ih(e),g=o||u?[...m?eo(m):[],...r?eo(r):[]]:[];g.forEach(N=>{o&&N.addEventListener("scroll",l,{passive:!0}),u&&N.addEventListener("resize",l)});const y=m&&f?n_(m,l):null;let b=-1,v=null;c&&(v=new ResizeObserver(N=>{let[O]=N;O&&O.target===m&&v&&r&&(v.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var _;(_=v)==null||_.observe(r)})),l()}),m&&!d&&v.observe(m),r&&v.observe(r));let k,C=d?Rl(e):null;d&&A();function A(){const N=Rl(e);C&&!t1(C,N)&&l(),C=N,k=requestAnimationFrame(A)}return l(),()=>{var N;g.forEach(O=>{o&&O.removeEventListener("scroll",l),u&&O.removeEventListener("resize",l)}),y==null||y(),(N=v)==null||N.disconnect(),v=null,d&&cancelAnimationFrame(k)}}const l_=zT,i_=DT,a_=RT,o_=BT,s_=MT,cb=_T,u_=LT,c_=(e,r,l)=>{const i=new Map,o={platform:t_,...l},u={...o.platform,_c:i};return TT(e,r,{...o,platform:u})};var f_=typeof document<"u",d_=function(){},Ks=f_?S.useLayoutEffect:d_;function au(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(typeof e=="function"&&e.toString()===r.toString())return!0;let l,i,o;if(e&&r&&typeof e=="object"){if(Array.isArray(e)){if(l=e.length,l!==r.length)return!1;for(i=l;i--!==0;)if(!au(e[i],r[i]))return!1;return!0}if(o=Object.keys(e),l=o.length,l!==Object.keys(r).length)return!1;for(i=l;i--!==0;)if(!{}.hasOwnProperty.call(r,o[i]))return!1;for(i=l;i--!==0;){const u=o[i];if(!(u==="_owner"&&e.$$typeof)&&!au(e[u],r[u]))return!1}return!0}return e!==e&&r!==r}function n1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fb(e,r){const l=n1(e);return Math.round(r*l)/l}function vd(e){const r=S.useRef(e);return Ks(()=>{r.current=e}),r}function h_(e){e===void 0&&(e={});const{placement:r="bottom",strategy:l="absolute",middleware:i=[],platform:o,elements:{reference:u,floating:c}={},transform:f=!0,whileElementsMounted:d,open:m}=e,[g,y]=S.useState({x:0,y:0,strategy:l,placement:r,middlewareData:{},isPositioned:!1}),[b,v]=S.useState(i);au(b,i)||v(i);const[k,C]=S.useState(null),[A,N]=S.useState(null),O=S.useCallback(ne=>{ne!==z.current&&(z.current=ne,C(ne))},[]),_=S.useCallback(ne=>{ne!==B.current&&(B.current=ne,N(ne))},[]),U=u||k,F=c||A,z=S.useRef(null),B=S.useRef(null),$=S.useRef(g),ae=d!=null,P=vd(d),re=vd(o),le=vd(m),se=S.useCallback(()=>{if(!z.current||!B.current)return;const ne={placement:r,strategy:l,middleware:b};re.current&&(ne.platform=re.current),c_(z.current,B.current,ne).then(ie=>{const j={...ie,isPositioned:le.current!==!1};J.current&&!au($.current,j)&&($.current=j,kh.flushSync(()=>{y(j)}))})},[b,r,l,re,le]);Ks(()=>{m===!1&&$.current.isPositioned&&($.current.isPositioned=!1,y(ne=>({...ne,isPositioned:!1})))},[m]);const J=S.useRef(!1);Ks(()=>(J.current=!0,()=>{J.current=!1}),[]),Ks(()=>{if(U&&(z.current=U),F&&(B.current=F),U&&F){if(P.current)return P.current(U,F,se);se()}},[U,F,se,P,ae]);const Z=S.useMemo(()=>({reference:z,floating:B,setReference:O,setFloating:_}),[O,_]),D=S.useMemo(()=>({reference:U,floating:F}),[U,F]),X=S.useMemo(()=>{const ne={position:l,left:0,top:0};if(!D.floating)return ne;const ie=fb(D.floating,g.x),j=fb(D.floating,g.y);return f?{...ne,transform:"translate("+ie+"px, "+j+"px)",...n1(D.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:ie,top:j}},[l,f,D.floating,g.x,g.y]);return S.useMemo(()=>({...g,update:se,refs:Z,elements:D,floatingStyles:X}),[g,se,Z,D,X])}const m_=e=>{function r(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:e,fn(l){const{element:i,padding:o}=typeof e=="function"?e(l):e;return i&&r(i)?i.current!=null?cb({element:i.current,padding:o}).fn(l):{}:i?cb({element:i,padding:o}).fn(l):{}}}},p_=(e,r)=>{const l=l_(e);return{name:l.name,fn:l.fn,options:[e,r]}},g_=(e,r)=>{const l=i_(e);return{name:l.name,fn:l.fn,options:[e,r]}},y_=(e,r)=>({fn:u_(e).fn,options:[e,r]}),x_=(e,r)=>{const l=a_(e);return{name:l.name,fn:l.fn,options:[e,r]}},b_=(e,r)=>{const l=o_(e);return{name:l.name,fn:l.fn,options:[e,r]}},v_=(e,r)=>{const l=s_(e);return{name:l.name,fn:l.fn,options:[e,r]}},w_=(e,r)=>{const l=m_(e);return{name:l.name,fn:l.fn,options:[e,r]}};var S_="Arrow",r1=S.forwardRef((e,r)=>{const{children:l,width:i=10,height:o=5,...u}=e;return x.jsx(_t.svg,{...u,ref:r,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?l:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});r1.displayName=S_;var k_=r1;function C_(e){const[r,l]=S.useState(void 0);return Zr(()=>{if(e){l({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const u=o[0];let c,f;if("borderBoxSize"in u){const d=u.borderBoxSize,m=Array.isArray(d)?d[0]:d;c=m.inlineSize,f=m.blockSize}else c=e.offsetWidth,f=e.offsetHeight;l({width:c,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else l(void 0)},[e]),r}var Gh="Popper",[l1,ju]=xu(Gh),[E_,i1]=l1(Gh),a1=e=>{const{__scopePopper:r,children:l}=e,[i,o]=S.useState(null);return x.jsx(E_,{scope:r,anchor:i,onAnchorChange:o,children:l})};a1.displayName=Gh;var o1="PopperAnchor",s1=S.forwardRef((e,r)=>{const{__scopePopper:l,virtualRef:i,...o}=e,u=i1(o1,l),c=S.useRef(null),f=an(r,c),d=S.useRef(null);return S.useEffect(()=>{const m=d.current;d.current=(i==null?void 0:i.current)||c.current,m!==d.current&&u.onAnchorChange(d.current)}),i?null:x.jsx(_t.div,{...o,ref:f})});s1.displayName=o1;var Yh="PopperContent",[N_,A_]=l1(Yh),u1=S.forwardRef((e,r)=>{var Ce,Ue,ve,at,dt,At;const{__scopePopper:l,side:i="bottom",sideOffset:o=0,align:u="center",alignOffset:c=0,arrowPadding:f=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:k,...C}=e,A=i1(Yh,l),[N,O]=S.useState(null),_=an(r,wt=>O(wt)),[U,F]=S.useState(null),z=C_(U),B=(z==null?void 0:z.width)??0,$=(z==null?void 0:z.height)??0,ae=i+(u!=="center"?"-"+u:""),P=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},re=Array.isArray(m)?m:[m],le=re.length>0,se={padding:P,boundary:re.filter(T_),altBoundary:le},{refs:J,floatingStyles:Z,placement:D,isPositioned:X,middlewareData:ne}=h_({strategy:"fixed",placement:ae,whileElementsMounted:(...wt)=>r_(...wt,{animationFrame:v==="always"}),elements:{reference:A.anchor},middleware:[p_({mainAxis:o+$,alignmentAxis:c}),d&&g_({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?y_():void 0,...se}),d&&x_({...se}),b_({...se,apply:({elements:wt,rects:ht,availableWidth:jn,availableHeight:Tn})=>{const{width:xr,height:br}=ht.reference,$t=wt.floating.style;$t.setProperty("--radix-popper-available-width",`${jn}px`),$t.setProperty("--radix-popper-available-height",`${Tn}px`),$t.setProperty("--radix-popper-anchor-width",`${xr}px`),$t.setProperty("--radix-popper-anchor-height",`${br}px`)}}),U&&w_({element:U,padding:f}),__({arrowWidth:B,arrowHeight:$}),b&&v_({strategy:"referenceHidden",...se})]}),[ie,j]=d1(D),R=Ri(k);Zr(()=>{X&&(R==null||R())},[X,R]);const G=(Ce=ne.arrow)==null?void 0:Ce.x,T=(Ue=ne.arrow)==null?void 0:Ue.y,ue=((ve=ne.arrow)==null?void 0:ve.centerOffset)!==0,[de,ce]=S.useState();return Zr(()=>{N&&ce(window.getComputedStyle(N).zIndex)},[N]),x.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:X?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(at=ne.transformOrigin)==null?void 0:at.x,(dt=ne.transformOrigin)==null?void 0:dt.y].join(" "),...((At=ne.hide)==null?void 0:At.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:x.jsx(N_,{scope:l,placedSide:ie,onArrowChange:F,arrowX:G,arrowY:T,shouldHideArrow:ue,children:x.jsx(_t.div,{"data-side":ie,"data-align":j,...C,ref:_,style:{...C.style,animation:X?void 0:"none"}})})})});u1.displayName=Yh;var c1="PopperArrow",j_={top:"bottom",right:"left",bottom:"top",left:"right"},f1=S.forwardRef(function(r,l){const{__scopePopper:i,...o}=r,u=A_(c1,i),c=j_[u.placedSide];return x.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:x.jsx(k_,{...o,ref:l,style:{...o.style,display:"block"}})})});f1.displayName=c1;function T_(e){return e!==null}var __=e=>({name:"transformOrigin",options:e,fn(r){var A,N,O;const{placement:l,rects:i,middlewareData:o}=r,c=((A=o.arrow)==null?void 0:A.centerOffset)!==0,f=c?0:e.arrowWidth,d=c?0:e.arrowHeight,[m,g]=d1(l),y={start:"0%",center:"50%",end:"100%"}[g],b=(((N=o.arrow)==null?void 0:N.x)??0)+f/2,v=(((O=o.arrow)==null?void 0:O.y)??0)+d/2;let k="",C="";return m==="bottom"?(k=c?y:`${b}px`,C=`${-d}px`):m==="top"?(k=c?y:`${b}px`,C=`${i.floating.height+d}px`):m==="right"?(k=`${-d}px`,C=c?y:`${v}px`):m==="left"&&(k=`${i.floating.width+d}px`,C=c?y:`${v}px`),{data:{x:k,y:C}}}});function d1(e){const[r,l="center"]=e.split("-");return[r,l]}var h1=a1,$h=s1,m1=u1,p1=f1,R_=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),M_="VisuallyHidden",g1=S.forwardRef((e,r)=>x.jsx(_t.span,{...e,ref:r,style:{...R_,...e.style}}));g1.displayName=M_;var O_=g1,[Tu]=xu("Tooltip",[ju]),_u=ju(),y1="TooltipProvider",z_=700,Wd="tooltip.open",[D_,Xh]=Tu(y1),x1=e=>{const{__scopeTooltip:r,delayDuration:l=z_,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:u}=e,c=S.useRef(!0),f=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),x.jsx(D_,{scope:r,isOpenDelayedRef:c,delayDuration:l,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,i)},[i]),isPointerInTransitRef:f,onPointerInTransitChange:S.useCallback(m=>{f.current=m},[]),disableHoverableContent:o,children:u})};x1.displayName=y1;var to="Tooltip",[L_,co]=Tu(to),b1=e=>{const{__scopeTooltip:r,children:l,open:i,defaultOpen:o,onOpenChange:u,disableHoverableContent:c,delayDuration:f}=e,d=Xh(to,e.__scopeTooltip),m=_u(r),[g,y]=S.useState(null),b=Xa(),v=S.useRef(0),k=c??d.disableHoverableContent,C=f??d.delayDuration,A=S.useRef(!1),[N,O]=Nh({prop:i,defaultProp:o??!1,onChange:B=>{B?(d.onOpen(),document.dispatchEvent(new CustomEvent(Wd))):d.onClose(),u==null||u(B)},caller:to}),_=S.useMemo(()=>N?A.current?"delayed-open":"instant-open":"closed",[N]),U=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,A.current=!1,O(!0)},[O]),F=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O(!1)},[O]),z=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{A.current=!0,O(!0),v.current=0},C)},[C,O]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),x.jsx(h1,{...m,children:x.jsx(L_,{scope:r,contentId:b,open:N,stateAttribute:_,trigger:g,onTriggerChange:y,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?z():U()},[d.isOpenDelayedRef,z,U]),onTriggerLeave:S.useCallback(()=>{k?F():(window.clearTimeout(v.current),v.current=0)},[F,k]),onOpen:U,onClose:F,disableHoverableContent:k,children:l})})};b1.displayName=to;var eh="TooltipTrigger",v1=S.forwardRef((e,r)=>{const{__scopeTooltip:l,...i}=e,o=co(eh,l),u=Xh(eh,l),c=_u(l),f=S.useRef(null),d=an(r,f,o.onTriggerChange),m=S.useRef(!1),g=S.useRef(!1),y=S.useCallback(()=>m.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),x.jsx($h,{asChild:!0,...c,children:x.jsx(_t.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:d,onPointerMove:yt(e.onPointerMove,b=>{b.pointerType!=="touch"&&!g.current&&!u.isPointerInTransitRef.current&&(o.onTriggerEnter(),g.current=!0)}),onPointerLeave:yt(e.onPointerLeave,()=>{o.onTriggerLeave(),g.current=!1}),onPointerDown:yt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:yt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:yt(e.onBlur,o.onClose),onClick:yt(e.onClick,o.onClose)})})});v1.displayName=eh;var Qh="TooltipPortal",[B_,U_]=Tu(Qh,{forceMount:void 0}),w1=e=>{const{__scopeTooltip:r,forceMount:l,children:i,container:o}=e,u=co(Qh,r);return x.jsx(B_,{scope:r,forceMount:l,children:x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:i})})})};w1.displayName=Qh;var Oi="TooltipContent",S1=S.forwardRef((e,r)=>{const l=U_(Oi,e.__scopeTooltip),{forceMount:i=l.forceMount,side:o="top",...u}=e,c=co(Oi,e.__scopeTooltip);return x.jsx(nl,{present:i||c.open,children:c.disableHoverableContent?x.jsx(k1,{side:o,...u,ref:r}):x.jsx(H_,{side:o,...u,ref:r})})}),H_=S.forwardRef((e,r)=>{const l=co(Oi,e.__scopeTooltip),i=Xh(Oi,e.__scopeTooltip),o=S.useRef(null),u=an(r,o),[c,f]=S.useState(null),{trigger:d,onClose:m}=l,g=o.current,{onPointerInTransitChange:y}=i,b=S.useCallback(()=>{f(null),y(!1)},[y]),v=S.useCallback((k,C)=>{const A=k.currentTarget,N={x:k.clientX,y:k.clientY},O=I_(N,A.getBoundingClientRect()),_=G_(N,O),U=Y_(C.getBoundingClientRect()),F=X_([..._,...U]);f(F),y(!0)},[y]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(d&&g){const k=A=>v(A,g),C=A=>v(A,d);return d.addEventListener("pointerleave",k),g.addEventListener("pointerleave",C),()=>{d.removeEventListener("pointerleave",k),g.removeEventListener("pointerleave",C)}}},[d,g,v,b]),S.useEffect(()=>{if(c){const k=C=>{const A=C.target,N={x:C.clientX,y:C.clientY},O=(d==null?void 0:d.contains(A))||(g==null?void 0:g.contains(A)),_=!$_(N,c);O?b():_&&(b(),m())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[d,g,c,m,b]),x.jsx(k1,{...e,ref:u})}),[P_,q_]=Tu(to,{isInside:!1}),F_=mN("TooltipContent"),k1=S.forwardRef((e,r)=>{const{__scopeTooltip:l,children:i,"aria-label":o,onEscapeKeyDown:u,onPointerDownOutside:c,...f}=e,d=co(Oi,l),m=_u(l),{onClose:g}=d;return S.useEffect(()=>(document.addEventListener(Wd,g),()=>document.removeEventListener(Wd,g)),[g]),S.useEffect(()=>{if(d.trigger){const y=b=>{const v=b.target;v!=null&&v.contains(d.trigger)&&g()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[d.trigger,g]),x.jsx(bu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:y=>y.preventDefault(),onDismiss:g,children:x.jsxs(m1,{"data-state":d.stateAttribute,...m,...f,ref:r,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[x.jsx(F_,{children:i}),x.jsx(P_,{scope:l,isInside:!0,children:x.jsx(O_,{id:d.contentId,role:"tooltip",children:o||i})})]})})});S1.displayName=Oi;var C1="TooltipArrow",V_=S.forwardRef((e,r)=>{const{__scopeTooltip:l,...i}=e,o=_u(l);return q_(C1,l).isInside?null:x.jsx(p1,{...o,...i,ref:r})});V_.displayName=C1;function I_(e,r){const l=Math.abs(r.top-e.y),i=Math.abs(r.bottom-e.y),o=Math.abs(r.right-e.x),u=Math.abs(r.left-e.x);switch(Math.min(l,i,o,u)){case u:return"left";case o:return"right";case l:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function G_(e,r,l=5){const i=[];switch(r){case"top":i.push({x:e.x-l,y:e.y+l},{x:e.x+l,y:e.y+l});break;case"bottom":i.push({x:e.x-l,y:e.y-l},{x:e.x+l,y:e.y-l});break;case"left":i.push({x:e.x+l,y:e.y-l},{x:e.x+l,y:e.y+l});break;case"right":i.push({x:e.x-l,y:e.y-l},{x:e.x-l,y:e.y+l});break}return i}function Y_(e){const{top:r,right:l,bottom:i,left:o}=e;return[{x:o,y:r},{x:l,y:r},{x:l,y:i},{x:o,y:i}]}function $_(e,r){const{x:l,y:i}=e;let o=!1;for(let u=0,c=r.length-1;u<r.length;c=u++){const f=r[u],d=r[c],m=f.x,g=f.y,y=d.x,b=d.y;g>i!=b>i&&l<(y-m)*(i-g)/(b-g)+m&&(o=!o)}return o}function X_(e){const r=e.slice();return r.sort((l,i)=>l.x<i.x?-1:l.x>i.x?1:l.y<i.y?-1:l.y>i.y?1:0),Q_(r)}function Q_(e){if(e.length<=1)return e.slice();const r=[];for(let i=0;i<e.length;i++){const o=e[i];for(;r.length>=2;){const u=r[r.length-1],c=r[r.length-2];if((u.x-c.x)*(o.y-c.y)>=(u.y-c.y)*(o.x-c.x))r.pop();else break}r.push(o)}r.pop();const l=[];for(let i=e.length-1;i>=0;i--){const o=e[i];for(;l.length>=2;){const u=l[l.length-1],c=l[l.length-2];if((u.x-c.x)*(o.y-c.y)>=(u.y-c.y)*(o.x-c.x))l.pop();else break}l.push(o)}return l.pop(),r.length===1&&l.length===1&&r[0].x===l[0].x&&r[0].y===l[0].y?r:r.concat(l)}var Z_=x1,K_=b1,J_=v1,W_=w1,E1=S1;const eR=Z_,ou=K_,su=J_,no=S.forwardRef(({className:e,sideOffset:r=4,...l},i)=>x.jsx(W_,{children:x.jsx(E1,{ref:i,sideOffset:r,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...l})}));no.displayName=E1.displayName;const tR="0.1.4",nR={version:tR},zt="Kanna",db="kanna",rR=`kanna/${nR.version}`,lR="[kanna]",iR=`~/${zt}`;function qs(e){return e?`${db} ${e}`:db}const aR={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function oR({value:e,onValueChange:r,options:l,size:i="md",className:o,optionClassName:u}){return x.jsx("div",{className:xe("inline-flex items-center rounded-full border border-border p-0.5 ",o),children:l.map(c=>{const f=c.value===e,d=c.icon,m=d?S.isValidElement(d)?d:(()=>{const y=d;return x.jsx(y,{className:i==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,g=x.jsxs("button",{type:"button",onClick:()=>r(c.value),disabled:c.disabled,"aria-pressed":f,className:xe("rounded-full border transition-colors",d?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",aR[i],f?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",c.disabled&&"opacity-50 pointer-events-none",u),children:[m,x.jsx("span",{children:c.label})]},c.value);return c.tooltip?x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:g}),x.jsx(no,{children:c.tooltip})]},c.value):g})})}function sR(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function N1({open:e,onOpenChange:r,onConfirm:l}){const[i,o]=S.useState("new"),[u,c]=S.useState(""),[f,d]=S.useState(""),m=S.useRef(null),g=S.useRef(null);S.useEffect(()=>{e&&(o("new"),c(""),d(""),setTimeout(()=>{var A;return(A=m.current)==null?void 0:A.focus()},0))},[e]),S.useEffect(()=>{e&&setTimeout(()=>{var A,N;i==="new"?(A=m.current)==null||A.focus():(N=g.current)==null||N.focus()},0)},[i,e]);const y=sR(u),b=y?`${iR}/${y}`:"",v=f.trim(),k=i==="new"?!!y:!!v,C=()=>{if(k){if(i==="new")l({mode:"new",localPath:b,title:u.trim()});else{const A=v.split("/").pop()||v;l({mode:"existing",localPath:v,title:A})}r(!1)}};return x.jsx(P0,{open:e,onOpenChange:r,children:x.jsxs(Uh,{size:"sm",children:[x.jsxs(V0,{className:"space-y-4",children:[x.jsx(F0,{children:"Add Project"}),x.jsx(oR,{value:i,onValueChange:o,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full",optionClassName:"flex-1 justify-center"}),i==="new"?x.jsxs("div",{className:"space-y-2",children:[x.jsx("input",{ref:m,type:"text",value:u,onChange:A=>c(A.target.value),onKeyDown:A=>{A.key==="Enter"&&C(),A.key==="Escape"&&r(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"Project name"}),b&&x.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:b})]}):x.jsxs("div",{className:"space-y-2",children:[x.jsx("input",{ref:g,type:"text",value:f,onChange:A=>d(A.target.value),onKeyDown:A=>{A.key==="Enter"&&C(),A.key==="Escape"&&r(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"~/Projects/my-app"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),x.jsxs(I0,{children:[x.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"}),x.jsx(qe,{variant:"secondary",size:"sm",onClick:C,disabled:!k,children:"Create"})]})]})})}const Ru=({children:e,className:r,shimmerWidth:l=100,animate:i=!0,...o})=>x.jsx("span",{style:{"--shiny-width":`${Math.min(l,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",i?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],r),...o,children:e}),uR=new Set(["starting","running"]);function cR({chat:e,activeChatId:r,onSelectChat:l,onDeleteChat:i}){return x.jsxs("div",{"data-chat-id":Bx(e.chatId),className:xe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-md cursor-pointer border-border/0 hover:border-border hover:bg-muted active:bg-muted border transition-colors",r===Bx(e.chatId)?"bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>l(e.chatId),children:[uR.has(e.status)?x.jsx(zl,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?x.jsx("div",{className:"relative ",children:x.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[x.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),x.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,x.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?x.jsx(Ru,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),x.jsx(qe,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-100 md:opacity-0 md:group-hover:opacity-100 cursor-pointer rounded-sm hover:!bg-transparent",onClick:o=>{o.stopPropagation(),i(e.chatId)},title:"Delete chat",children:x.jsx(so,{className:"size-3.5"})})]},e._id)}function jl(e){return e.split(/[\s_-]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" ")}function A1(e){return e.split("/").pop()||e}var Mu="Popover",[j1]=xu(Mu,[ju]),fo=ju(),[fR,rl]=j1(Mu),T1=e=>{const{__scopePopover:r,children:l,open:i,defaultOpen:o,onOpenChange:u,modal:c=!1}=e,f=fo(r),d=S.useRef(null),[m,g]=S.useState(!1),[y,b]=Nh({prop:i,defaultProp:o??!1,onChange:u,caller:Mu});return x.jsx(h1,{...f,children:x.jsx(fR,{scope:r,contentId:Xa(),triggerRef:d,open:y,onOpenChange:b,onOpenToggle:S.useCallback(()=>b(v=>!v),[b]),hasCustomAnchor:m,onCustomAnchorAdd:S.useCallback(()=>g(!0),[]),onCustomAnchorRemove:S.useCallback(()=>g(!1),[]),modal:c,children:l})})};T1.displayName=Mu;var _1="PopoverAnchor",dR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(_1,l),u=fo(l),{onCustomAnchorAdd:c,onCustomAnchorRemove:f}=o;return S.useEffect(()=>(c(),()=>f()),[c,f]),x.jsx($h,{...u,...i,ref:r})});dR.displayName=_1;var R1="PopoverTrigger",M1=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(R1,l),u=fo(l),c=an(r,o.triggerRef),f=x.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":B1(o.open),...i,ref:c,onClick:yt(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?f:x.jsx($h,{asChild:!0,...u,children:f})});M1.displayName=R1;var Zh="PopoverPortal",[hR,mR]=j1(Zh,{forceMount:void 0}),O1=e=>{const{__scopePopover:r,forceMount:l,children:i,container:o}=e,u=rl(Zh,r);return x.jsx(hR,{scope:r,forceMount:l,children:x.jsx(nl,{present:l||u.open,children:x.jsx(vu,{asChild:!0,container:o,children:i})})})};O1.displayName=Zh;var zi="PopoverContent",z1=S.forwardRef((e,r)=>{const l=mR(zi,e.__scopePopover),{forceMount:i=l.forceMount,...o}=e,u=rl(zi,e.__scopePopover);return x.jsx(nl,{present:i||u.open,children:u.modal?x.jsx(gR,{...o,ref:r}):x.jsx(yR,{...o,ref:r})})});z1.displayName=zi;var pR=Ah("PopoverContent.RemoveScroll"),gR=S.forwardRef((e,r)=>{const l=rl(zi,e.__scopePopover),i=S.useRef(null),o=an(r,i),u=S.useRef(!1);return S.useEffect(()=>{const c=i.current;if(c)return d0(c)},[]),x.jsx(Th,{as:pR,allowPinchZoom:!0,children:x.jsx(D1,{...e,ref:o,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(e.onCloseAutoFocus,c=>{var f;c.preventDefault(),u.current||(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:yt(e.onPointerDownOutside,c=>{const f=c.detail.originalEvent,d=f.button===0&&f.ctrlKey===!0,m=f.button===2||d;u.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:yt(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),yR=S.forwardRef((e,r)=>{const l=rl(zi,e.__scopePopover),i=S.useRef(!1),o=S.useRef(!1);return x.jsx(D1,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,u),u.defaultPrevented||(i.current||(f=l.triggerRef.current)==null||f.focus(),u.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:u=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=u.target;((m=l.triggerRef.current)==null?void 0:m.contains(c))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&o.current&&u.preventDefault()}})}),D1=S.forwardRef((e,r)=>{const{__scopePopover:l,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:m,onInteractOutside:g,...y}=e,b=rl(zi,l),v=fo(l);return r0(),x.jsx(jh,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:u,children:x.jsx(bu,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:g,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:m,onDismiss:()=>b.onOpenChange(!1),children:x.jsx(m1,{"data-state":B1(b.open),role:"dialog",id:b.contentId,...v,...y,ref:r,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L1="PopoverClose",xR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=rl(L1,l);return x.jsx(_t.button,{type:"button",...i,ref:r,onClick:yt(e.onClick,()=>o.onOpenChange(!1))})});xR.displayName=L1;var bR="PopoverArrow",vR=S.forwardRef((e,r)=>{const{__scopePopover:l,...i}=e,o=fo(l);return x.jsx(p1,{...o,...i,ref:r})});vR.displayName=bR;function B1(e){return e?"open":"closed"}var wR=T1,SR=M1,kR=O1,U1=z1;const H1=wR,P1=SR,Kh=S.forwardRef(({className:e,align:r="center",sideOffset:l=4,...i},o)=>x.jsx(kR,{children:x.jsx(U1,{ref:o,align:r,sideOffset:l,className:xe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));Kh.displayName=U1.displayName;function CR({onRemove:e}){const[r,l]=S.useState(!1);return x.jsxs(H1,{open:r,onOpenChange:l,children:[x.jsx(P1,{asChild:!0,children:x.jsx(qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 absolute right-6 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",onClick:i=>i.stopPropagation(),children:x.jsx(Nj,{className:"h-4 w-4 text-slate-500 dark:text-slate-400"})})}),x.jsx(Kh,{align:"end",className:"p-1 w-auto min-w-[170px]",children:x.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!1),e()},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg text-left transition-colors text-destructive dark:text-red-400 hover:bg-destructive/10 dark:hover:bg-red-500/20",children:[x.jsx(uT,{className:"h-4 w-4"}),x.jsx("span",{className:"text-xs font-medium",children:"Remove Project"})]})})]})}function ER({projectGroups:e,collapsedSections:r,expandedGroups:l,onToggleSection:i,onToggleExpandedGroup:o,renderChatRow:u,chatsPerProject:c,onNewLocalChat:f,onRemoveProject:d,isConnected:m,startingLocalPath:g}){return x.jsx(x.Fragment,{children:e.map(({groupKey:y,localPath:b,chats:v})=>{const k=l.has(y),C=k?v:v.slice(0,c),A=v.length>c;return x.jsxs("div",{className:"group/section",children:[x.jsxs("div",{className:"sticky top-0 bg-background dark:bg-card z-10 relative pl-2.5 pr-3 py-2 pt-3 cursor-pointer flex items-center justify-between",onClick:()=>i(y),children:[x.jsxs("div",{className:"flex items-center gap-2",children:[r.has(y)?x.jsx(O0,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500"}):x.jsx(M0,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500"}),x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:A1(b)})}),x.jsx(no,{side:"right",sideOffset:4,children:b})]}),x.jsx(Kr,{className:xe("size-3.5 translate-y-[1px] text-slate-400 transition-all duration-200",r.has(y)?"opacity-100":"rotate-90 opacity-0 group-hover/section:opacity-100")})]}),d?x.jsx(CR,{onRemove:()=>d(y)}):null,f&&x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsx(qe,{variant:"ghost",size:"icon",className:xe("h-5.5 w-5.5 absolute right-0 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!m||g===b)&&"opacity-50 cursor-not-allowed"),disabled:!m||g===b,onClick:N=>{N.stopPropagation(),f(b)},children:g===b?x.jsx(zl,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):x.jsx(Dh,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),x.jsx(no,{side:"right",sideOffset:4,children:m?"New chat":`Start ${zt} to connect`})]})]}),!r.has(y)&&x.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[C.map(u),A&&x.jsx("button",{onClick:()=>o(y),className:"pl-3 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:k?"Show less":`Show more (${v.length-c})`})]})]},y)})})}function NR({data:e,activeChatId:r,connectionStatus:l,ready:i,open:o,collapsed:u,showMobileOpenButton:c,onOpen:f,onClose:d,onCollapse:m,onExpand:g,onCreateChat:y,onCreateProject:b,onDeleteChat:v,onRemoveProject:k}){const C=Fn(),A=xh(),N=S.useRef(null),[O,_]=S.useState(new Set),[U,F]=S.useState(new Set),[z,B]=S.useState(!1),$=10,ae=S.useMemo(()=>new Map(e.projectGroups.map(ie=>[ie.localPath,ie.groupKey])),[e.projectGroups]),P=S.useMemo(()=>e.projectGroups.reduce((ie,j)=>ie+j.chats.length,0),[e.projectGroups]),re=S.useCallback(ie=>{_(j=>{const R=new Set(j);return R.has(ie)?R.delete(ie):R.add(ie),R})},[]),le=S.useCallback(ie=>{F(j=>{const R=new Set(j);return R.has(ie)?R.delete(ie):R.add(ie),R})},[]),se=S.useCallback(ie=>x.jsx(cR,{chat:ie,activeChatId:r,onSelectChat:j=>A(`/chat/${j}`),onDeleteChat:()=>v(ie)},ie._id),[r,A,v]);S.useEffect(()=>{!r||!N.current||requestAnimationFrame(()=>{const ie=N.current,j=ie==null?void 0:ie.querySelector(`[data-chat-id="${r}"]`);if(!j||!ie)return;const R=j.getBoundingClientRect(),G=ie.getBoundingClientRect();if(R.top<G.top+38){const T=R.top-G.top+ie.scrollTop;ie.scrollTo({top:T-38,behavior:"smooth"})}else if(R.bottom>G.bottom){const T=R.top+R.height/2-G.top+ie.scrollTop,ue=ie.clientHeight/2;ie.scrollTo({top:T-ue,behavior:"smooth"})}})},[r,P]);const J=P>0,Z=C.pathname==="/projects",D=l==="connecting"||!i,X=D?"Connecting":l==="connected"?"Connected":"Disconnected",ne=l==="connected"?"bg-emerald-500":"bg-amber-500";return x.jsxs(x.Fragment,{children:[!o&&c&&x.jsx(qe,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:f,children:x.jsx(z0,{className:"h-5 w-5"})}),u&&Z&&x.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:x.jsxs("div",{className:"flex items-center gap-1",children:[x.jsx(Qa,{className:"size-6 text-logo"}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:g,title:"Expand sidebar",children:x.jsx(Qd,{className:"h-5 w-5"})})]})}),x.jsxs("div",{"data-sidebar":"open",className:xe("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-2 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",o?"flex":"hidden md:flex",u&&"md:hidden"),children:[x.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[x.jsxs("div",{className:"group/sidebar-header flex items-center gap-2",children:[x.jsxs("button",{type:"button",onClick:m,title:"Collapse sidebar",className:"hidden md:flex relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[x.jsx(Qa,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-header:opacity-0 group-hover/sidebar-header:scale-0"}),x.jsx(Qd,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-header:opacity-100 group-hover/sidebar-header:scale-80 hover:opacity-50"})]}),x.jsx(Qa,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),x.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:zt})]}),x.jsxs("div",{className:"flex items-center",children:[x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>B(!0),title:"New project",children:x.jsx(U0,{className:"size-4"})}),x.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden",onClick:d,children:x.jsx(so,{className:"h-5 w-5"})})]})]}),x.jsx("div",{ref:N,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:x.jsxs("div",{className:"pb-2 px-2 pt-1.5",children:[!J&&D?x.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(ie=>x.jsxs("div",{className:"space-y-2 animate-pulse",children:[x.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),x.jsx("div",{className:"space-y-1",children:[0,1,2].map(j=>x.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[x.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),x.jsx("div",{className:xe("h-3.5 rounded bg-muted",j===0?"w-32":j===1?"w-40":"w-28")})]},j))})]},ie))}):null,!J&&!D&&e.projectGroups.length===0?x.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,x.jsx(ER,{projectGroups:e.projectGroups,collapsedSections:O,expandedGroups:U,onToggleSection:re,onToggleExpandedGroup:le,renderChatRow:se,chatsPerProject:$,onNewLocalChat:ie=>{const j=ae.get(ie);j&&y(j)},onRemoveProject:k,isConnected:l==="connected"})]})}),x.jsx("div",{className:"border-t border-border p-2",children:x.jsx("button",{type:"button",onClick:()=>{A("/projects"),d()},className:xe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",Z?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:x.jsxs("div",{className:"flex items- justify-between gap-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Oh,{className:"h-4 w-4 text-muted-foreground"}),x.jsx("span",{className:"text-sm",children:"Projects"})]}),x.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[x.jsx("span",{children:X}),D?x.jsx(zl,{className:"h-2 w-2 animate-spin"}):x.jsx("span",{className:xe("h-2 w-2 rounded-full",ne)})]})]})})})]}),x.jsx(N1,{open:z,onOpenChange:B,onConfirm:b}),o?x.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:d}):null]})}const q1=S.forwardRef(({className:e,...r},l)=>x.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:xe("flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),ref:l,...r}));q1.displayName="Textarea";function AR(){const[e,r]=S.useState(()=>{if(typeof window>"u")return!1;const l=navigator.standalone===!0,i=window.matchMedia("(display-mode: standalone)").matches;return l||i});return S.useEffect(()=>{const l=window.matchMedia("(display-mode: standalone)"),i=o=>{r(o.matches||navigator.standalone===!0)};return l.addEventListener("change",i),()=>l.removeEventListener("change",i)},[]),e}const hb=e=>{let r;const l=new Set,i=(m,g)=>{const y=typeof m=="function"?m(r):m;if(!Object.is(y,r)){const b=r;r=g??(typeof y!="object"||y===null)?y:Object.assign({},r,y),l.forEach(v=>v(r,b))}},o=()=>r,f={setState:i,getState:o,getInitialState:()=>d,subscribe:m=>(l.add(m),()=>l.delete(m))},d=r=e(i,o,f);return f},jR=(e=>e?hb(e):hb),TR=e=>e;function _R(e,r=TR){const l=Ya.useSyncExternalStore(e.subscribe,Ya.useCallback(()=>r(e.getState()),[e,r]),Ya.useCallback(()=>r(e.getInitialState()),[e,r]));return Ya.useDebugValue(l),l}const RR=e=>{const r=jR(e),l=i=>_R(r,i);return Object.assign(l,r),l},F1=(e=>RR);function MR(e,r){let l;try{l=e()}catch{return}return{getItem:o=>{var u;const c=d=>d===null?null:JSON.parse(d,void 0),f=(u=l.getItem(o))!=null?u:null;return f instanceof Promise?f.then(c):c(f)},setItem:(o,u)=>l.setItem(o,JSON.stringify(u,void 0)),removeItem:o=>l.removeItem(o)}}const th=e=>r=>{try{const l=e(r);return l instanceof Promise?l:{then(i){return th(i)(l)},catch(i){return this}}}catch(l){return{then(i){return this},catch(i){return th(i)(l)}}}},OR=(e,r)=>(l,i,o)=>{let u={storage:MR(()=>window.localStorage),partialize:A=>A,version:0,merge:(A,N)=>({...N,...A}),...r},c=!1,f=0;const d=new Set,m=new Set;let g=u.storage;if(!g)return e((...A)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),l(...A)},i,o);const y=()=>{const A=u.partialize({...i()});return g.setItem(u.name,{state:A,version:u.version})},b=o.setState;o.setState=(A,N)=>(b(A,N),y());const v=e((...A)=>(l(...A),y()),i,o);o.getInitialState=()=>v;let k;const C=()=>{var A,N;if(!g)return;const O=++f;c=!1,d.forEach(U=>{var F;return U((F=i())!=null?F:v)});const _=((N=u.onRehydrateStorage)==null?void 0:N.call(u,(A=i())!=null?A:v))||void 0;return th(g.getItem.bind(g))(u.name).then(U=>{if(U)if(typeof U.version=="number"&&U.version!==u.version){if(u.migrate){const F=u.migrate(U.state,U.version);return F instanceof Promise?F.then(z=>[!0,z]):[!0,F]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,U.state];return[!1,void 0]}).then(U=>{var F;if(O!==f)return;const[z,B]=U;if(k=u.merge(B,(F=i())!=null?F:v),l(k,!0),z)return y()}).then(()=>{O===f&&(_==null||_(k,void 0),k=i(),c=!0,m.forEach(U=>U(k)))}).catch(U=>{O===f&&(_==null||_(void 0,U))})};return o.persist={setOptions:A=>{u={...u,...A},A.storage&&(g=A.storage)},clearStorage:()=>{g==null||g.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>C(),hasHydrated:()=>c,onHydrate:A=>(d.add(A),()=>{d.delete(A)}),onFinishHydration:A=>(m.add(A),()=>{m.delete(A)})},u.skipHydration||C(),k||v},V1=OR,zR=F1()(V1((e,r)=>({drafts:{},setDraft:(l,i)=>e(o=>{if(!i){const{[l]:u,...c}=o.drafts;return{drafts:c}}return{drafts:{...o.drafts,[l]:i}}}),clearDraft:l=>e(i=>{const{[l]:o,...u}=i.drafts;return{drafts:u}}),getDraft:l=>r().drafts[l]??""}),{name:"chat-input-drafts"})),I1=F1()(V1(e=>({model:"opus",effort:"high",planMode:!1,setModel:r=>e(l=>r!=="opus"&&l.effort==="max"?{model:r,effort:"high"}:{model:r}),setEffort:r=>e({effort:r}),setPlanMode:r=>e({planMode:r})}),{name:"chat-preferences"}));function dr({onClick:e,selected:r,icon:l,label:i,description:o,disabled:u}){return x.jsxs("button",{onClick:e,disabled:u,className:xe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",r?"bg-muted border-border":"hover:opacity-60",u&&"opacity-40 cursor-not-allowed"),children:[l,x.jsxs("div",{children:[x.jsx("div",{className:"text-sm font-medium",children:i}),x.jsx("div",{className:"text-xs text-muted-foreground",children:o})]})]})}function wd({trigger:e,triggerClassName:r,children:l}){return x.jsxs(H1,{children:[x.jsx(P1,{asChild:!0,children:x.jsx("button",{className:xe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",r),children:e})}),x.jsx(Kh,{align:"center",className:"w-64 p-1",children:x.jsx("div",{className:"space-y-1",children:l})})]})}const DR={opus:zh,sonnet:H0,haiku:R0},LR={opus:"Opus",sonnet:"Sonnet",haiku:"Haiku"},BR={low:"Low",medium:"Medium",high:"High",max:"Max"},UR=S.memo(function({onSubmit:r,onCancel:l,disabled:i,canCancel:o,chatId:u}){const{getDraft:c,setDraft:f,clearDraft:d}=zR(),{model:m,effort:g,planMode:y,setModel:b,setEffort:v,setPlanMode:k}=I1(),[C,A]=S.useState(()=>u?c(u):""),N=S.useRef(null),O=AR(),_=S.useCallback(()=>{const B=N.current;B&&(B.style.height="auto",B.style.height=`${B.scrollHeight}px`)},[]);S.useEffect(()=>{_()},[C,_]),S.useEffect(()=>(window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)),[_]),S.useEffect(()=>{var B;(B=N.current)==null||B.focus()},[u]);async function U(){if(!C.trim())return;const B=C;A(""),u&&d(u),N.current&&(N.current.style.height="auto");try{await r(B,{model:m,effort:g,planMode:y})}catch($){console.error("[ChatInput] Submit failed:",$),A(B),u&&f(u,B)}}function F(B){if(B.key==="Tab"&&B.shiftKey){B.preventDefault(),k(!y);return}if(B.key==="Escape"&&o){B.preventDefault(),l==null||l();return}const $="ontouchstart"in window||navigator.maxTouchPoints>0;B.key==="Enter"&&!B.shiftKey&&!o&&!$&&(B.preventDefault(),U())}const z=DR[m];return x.jsxs("div",{className:xe("p-3 pt-0 md:pb-2",O&&"px-5 pb-5"),children:[x.jsxs("div",{className:"flex items-end gap-2 max-w-[840px] mx-auto border dark:bg-card/40 backdrop-blur-lg border-border rounded-[29px] pr-1.5",children:[x.jsx(q1,{ref:N,placeholder:"Ask something...",value:C,autoFocus:!0,rows:1,onChange:B=>{A(B.target.value),u&&f(u,B.target.value),_()},onKeyDown:F,disabled:i,className:"flex-1 text-base p-3 md:p-4 pl-4.5 md:pl-6 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),x.jsx(qe,{type:"button",onPointerDown:B=>{B.preventDefault(),o?l==null||l():!i&&C.trim()&&U()},disabled:!o&&(i||!C.trim()),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 mb-1 -mr-0.5 md:mr-0 md:mb-1.5 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:o?x.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):x.jsx(KA,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),x.jsxs("div",{className:"flex justify-center items-center gap-0.5 max-w-[840px] mx-auto mt-2 animate-fade-in",children:[x.jsxs(wd,{trigger:x.jsxs(x.Fragment,{children:[x.jsx(z,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:LR[m]})]}),children:[x.jsx(dr,{onClick:()=>b("opus"),selected:m==="opus",icon:x.jsx(zh,{className:"h-4 w-4 text-muted-foreground"}),label:"Opus",description:"Highest capability, deep reasoning"}),x.jsx(dr,{onClick:()=>b("sonnet"),selected:m==="sonnet",icon:x.jsx(H0,{className:"h-4 w-4 text-muted-foreground"}),label:"Sonnet",description:"Balanced speed and intelligence"}),x.jsx(dr,{onClick:()=>b("haiku"),selected:m==="haiku",icon:x.jsx(R0,{className:"h-4 w-4 text-muted-foreground"}),label:"Haiku",description:"Fastest responses, lightweight tasks"})]}),x.jsxs(wd,{trigger:x.jsxs(x.Fragment,{children:[x.jsx(Pa,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:BR[g]})]}),triggerClassName:g==="max"?"text-amber-400 dark:text-amber-300":void 0,children:[x.jsx(dr,{onClick:()=>v("low"),selected:g==="low",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Low",description:"Minimal thinking, fastest responses"}),x.jsx(dr,{onClick:()=>v("medium"),selected:g==="medium",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Medium",description:"Moderate thinking for typical tasks"}),x.jsx(dr,{onClick:()=>v("high"),selected:g==="high",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"High",description:"Deep reasoning for complex problems"}),x.jsx(dr,{onClick:()=>v("max"),selected:g==="max",disabled:m!=="opus",icon:x.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"}),label:"Max",description:m!=="opus"?"Only available with Opus":"Maximum effort, deepest reasoning"})]}),x.jsxs(wd,{trigger:y?x.jsxs(x.Fragment,{children:[x.jsx(nu,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:"Plan Mode"})]}):x.jsxs(x.Fragment,{children:[x.jsx(Wx,{className:"h-3.5 w-3.5"}),x.jsx("span",{children:"Full Access"})]}),triggerClassName:y?"text-blue-400 dark:text-blue-300":void 0,children:[x.jsx(dr,{onClick:()=>k(!1),selected:!y,icon:x.jsx(Wx,{className:"h-4 w-4 text-muted-foreground"}),label:"Full Access",description:"Claude can read and edit files"}),x.jsx(dr,{onClick:()=>k(!0),selected:y,icon:x.jsx(nu,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan Mode",description:"Claude can only read, not edit"}),x.jsxs("p",{className:"text-xs text-muted-foreground/90 px-2 py-2",children:["Press ",x.jsx("kbd",{className:"px-1 mx-0.5 py-0.5 text-[12px] bg-muted/90 rounded font-mono",children:"shift+tab"})," to toggle"]})]})]})]})}),G1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("bg-card text-card-foreground",e),...r}));G1.displayName="Card";const Y1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("flex flex-col space-y-1.5 p-2",e),...r}));Y1.displayName="CardHeader";const HR=S.forwardRef(({className:e,...r},l)=>x.jsx("h3",{ref:l,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...r}));HR.displayName="CardTitle";const PR=S.forwardRef(({className:e,...r},l)=>x.jsx("p",{ref:l,className:xe("text-sm text-muted-foreground",e),...r}));PR.displayName="CardDescription";const $1=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("p-6 pt-0",e),...r}));$1.displayName="CardContent";const qR=S.forwardRef(({className:e,...r},l)=>x.jsx("div",{ref:l,className:xe("flex items-center p-6 pt-0",e),...r}));qR.displayName="CardFooter";function FR({sidebarCollapsed:e,onOpenSidebar:r,onExpandSidebar:l,onNewChat:i,localPath:o,onOpenExternal:u}){return x.jsx(Y1,{className:xe("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 pr-4 border-border/0 md:pb-0 flex items-center justify-center","backdrop-blur-lg md:backdrop-blur-none bg-gradient-to-b from-background md:from-transparent border-b border-x-0 md:border-x border-border md:border-none"),children:x.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[x.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 border-l border-border/0",children:[x.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden",onClick:r,children:x.jsx(z0,{className:"h-5 w-5"})}),e&&x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex items-center justify-center w-[40px] h-[40px]",children:x.jsx(Qa,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),x.jsx(qe,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:l,title:"Expand sidebar",children:x.jsx(Qd,{className:"h-5 w-5"})})]}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:i,title:"Compose",children:x.jsx(Dh,{className:"h-5 w-5"})})]}),x.jsx("div",{className:"flex-1 min-w-0"}),x.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:o&&u&&x.jsxs(x.Fragment,{children:[x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_finder"),title:"Open in Finder",className:"border border-border/0",children:x.jsx(M0,{className:"h-4.5 w-4.5"})}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_terminal"),title:"Open in Terminal",className:"border border-border/0",children:x.jsx(Lh,{className:"h-4.5 w-4.5"})}),x.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>u("open_editor"),title:"Open in Cursor",className:"border border-border/0",children:x.jsx(bj,{className:"h-4.5 w-4.5"})})]})})]})})}const nh={Task:nu,TaskOutput:nu,Bash:Lh,Glob:yd,Grep:yd,ExitPlanMode:eb,Read:Mj,Edit:jj,Write:_j,NotebookEdit:B0,WebFetch:GA,TodoWrite:aj,WebSearch:yd,KillShell:lT,AskUserQuestion:D0,Skill:zh,EnterPlanMode:eb},X1=oT;function Q1(e){return nh[e]?nh[e]:/^mcp__db__.+_query$/.test(e)?Cj:e==="mcp__lever__show_chart"?nj:X1}function ll({children:e,className:r}){return x.jsx("div",{className:xe("flex gap-3 justify-start items-center",r),children:e})}function VR({children:e,className:r}){return x.jsx("div",{className:xe("flex items-center gap-1.5 text-xs",r),children:e})}function el({children:e,className:r}){return x.jsx("span",{className:xe("font-medium text-foreground/80",r),children:e})}function IR({children:e}){return x.jsx("span",{className:"text-muted-foreground",children:e})}function Ou({children:e,expandedContent:r,defaultExpanded:l=!1}){const[i,o]=S.useState(l);return x.jsxs("div",{className:"flex flex-col w-full",children:[x.jsxs("button",{onClick:()=>o(!i),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${i?"":"hover:opacity-60 transition-opacity"}`,children:[x.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),x.jsx(Kr,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${i?"rotate-90 opacity-100":""}`})]}),i&&r]})}function qa({label:e,children:r,copyText:l}){const[i,o]=S.useState(!1),u=l??uu(r),c=S.useCallback(async()=>{await navigator.clipboard.writeText(u),o(!0),setTimeout(()=>o(!1),2e3)},[u]);return x.jsxs("div",{children:[x.jsx("span",{className:"font-medium text-muted-foreground",children:e}),x.jsxs("div",{className:"relative group/codeblock",children:[x.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:r}),x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-2.5 right-1.5 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!i&&"hover:text-foreground",i&&"hover:!bg-transparent hover:!border-transparent"),onClick:c,children:i?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})]})]})}function Z1({children:e,icon:r,className:l}){return x.jsxs("span",{className:xe("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",l),children:[r&&x.jsx(r,{className:"h-3 w-3 text-muted-foreground"}),e]})}function zu({children:e,className:r}){return x.jsxs("div",{className:xe("grid grid-cols-[auto_1fr] gap-2 min-w-0",r),children:[x.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:x.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),x.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function uu(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(uu).join("");if(e&&typeof e=="object"&&"props"in e){const r=e.props;return uu(r.children)}return""}const Du={pre:({children:e,...r})=>{const[l,i]=S.useState(!1),o=uu(e),u=async()=>{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),2e3)};return x.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[x.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...r,children:e}),x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!l&&"hover:text-foreground",l&&"hover:!bg-transparent hover:!border-transparent"),onClick:u,children:l?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})]})},code:({children:e,className:r,...l})=>r?x.jsx("code",{className:"block text-xs whitespace-pre",...l,children:e}):x.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...l,children:e}),table:({children:e,...r})=>x.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:x.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...r,children:e})}),tbody:({children:e,...r})=>x.jsx("tbody",{className:"divide-y divide-border",...r,children:e}),th:({children:e,...r})=>x.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...r,children:e}),td:({children:e,...r})=>x.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...r,children:e}),p:({children:e,...r})=>x.jsx("p",{className:"break-words",...r,children:e}),a:({children:e,...r})=>x.jsx("a",{className:"transition-all underline decoration-2 text-orange-500 decoration-orange-500/50 hover:text-orange-500/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...r,children:e})},rh={...Du,h1:({children:e})=>x.jsx("h1",{className:"text-2xl font-bold mt-6 mb-4 first:mt-0",children:e}),h2:({children:e})=>x.jsx("h2",{className:"text-xl font-semibold mt-5 mb-3 first:mt-0",children:e}),h3:({children:e})=>x.jsx("h3",{className:"text-lg font-semibold mt-4 mb-2 first:mt-0",children:e}),h4:({children:e})=>x.jsx("h4",{className:"text-base font-semibold mt-3 mb-2 first:mt-0",children:e}),h5:({children:e})=>x.jsx("h5",{className:"text-sm font-semibold mt-3 mb-1 first:mt-0",children:e}),h6:({children:e})=>x.jsx("h6",{className:"text-sm font-medium mt-3 mb-1 first:mt-0",children:e})},GR={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function YR({status:e}){const r=(e?GR[e]:void 0)||"Processing...",l=e==="failed";return x.jsx(ll,{className:"ml-[1px]",children:x.jsxs(VR,{children:[l?x.jsx(so,{className:"size-4.5 text-red-500"}):x.jsx(zl,{className:"size-4.5 animate-spin text-muted-icon"}),x.jsx(Ru,{className:"ml-[1px] text-sm",shimmerWidth:44,children:r})]})})}const K1=S.forwardRef(({className:e,children:r,...l},i)=>x.jsx("div",{ref:i,className:xe("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...l,children:r}));K1.displayName="ScrollArea";function $R(e,r){const l={};return(e[e.length-1]===""?[...e,""]:e).join((l.padRight?" ":"")+","+(l.padLeft===!1?"":" ")).trim()}const XR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZR={};function mb(e,r){return(ZR.jsx?QR:XR).test(e)}const KR=/[ \t\n\f\r]/g;function JR(e){return typeof e=="object"?e.type==="text"?pb(e.value):!1:pb(e)}function pb(e){return e.replace(KR,"")===""}class ho{constructor(r,l,i){this.normal=l,this.property=r,i&&(this.space=i)}}ho.prototype.normal={};ho.prototype.property={};ho.prototype.space=void 0;function J1(e,r){const l={},i={};for(const o of e)Object.assign(l,o.property),Object.assign(i,o.normal);return new ho(l,i,r)}function lh(e){return e.toLowerCase()}class Yt{constructor(r,l){this.attribute=l,this.property=r}}Yt.prototype.attribute="";Yt.prototype.booleanish=!1;Yt.prototype.boolean=!1;Yt.prototype.commaOrSpaceSeparated=!1;Yt.prototype.commaSeparated=!1;Yt.prototype.defined=!1;Yt.prototype.mustUseProperty=!1;Yt.prototype.number=!1;Yt.prototype.overloadedBoolean=!1;Yt.prototype.property="";Yt.prototype.spaceSeparated=!1;Yt.prototype.space=void 0;let WR=0;const Te=Dl(),ft=Dl(),ih=Dl(),oe=Dl(),Ke=Dl(),_i=Dl(),tn=Dl();function Dl(){return 2**++WR}const ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:ft,commaOrSpaceSeparated:tn,commaSeparated:_i,number:oe,overloadedBoolean:ih,spaceSeparated:Ke},Symbol.toStringTag,{value:"Module"})),Sd=Object.keys(ah);class Jh extends Yt{constructor(r,l,i,o){let u=-1;if(super(r,l),gb(this,"space",o),typeof i=="number")for(;++u<Sd.length;){const c=Sd[u];gb(this,Sd[u],(i&ah[c])===ah[c])}}}Jh.prototype.defined=!0;function gb(e,r,l){l&&(e[r]=l)}function Fi(e){const r={},l={};for(const[i,o]of Object.entries(e.properties)){const u=new Jh(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),r[i]=u,l[lh(i)]=i,l[lh(u.attribute)]=i}return new ho(r,l,e.space)}const W1=Fi({properties:{ariaActiveDescendant:null,ariaAtomic:ft,ariaAutoComplete:null,ariaBusy:ft,ariaChecked:ft,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:Ke,ariaCurrent:null,ariaDescribedBy:Ke,ariaDetails:null,ariaDisabled:ft,ariaDropEffect:Ke,ariaErrorMessage:null,ariaExpanded:ft,ariaFlowTo:Ke,ariaGrabbed:ft,ariaHasPopup:null,ariaHidden:ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ke,ariaLevel:oe,ariaLive:null,ariaModal:ft,ariaMultiLine:ft,ariaMultiSelectable:ft,ariaOrientation:null,ariaOwns:Ke,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:ft,ariaReadOnly:ft,ariaRelevant:null,ariaRequired:ft,ariaRoleDescription:Ke,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:ft,ariaSetSize:oe,ariaSort:null,ariaValueMax:oe,ariaValueMin:oe,ariaValueNow:oe,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function ew(e,r){return r in e?e[r]:r}function tw(e,r){return ew(e,r.toLowerCase())}const e4=Fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_i,acceptCharset:Ke,accessKey:Ke,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ke,autoFocus:Te,autoPlay:Te,blocking:Ke,capture:null,charSet:null,checked:Te,cite:null,className:Ke,cols:oe,colSpan:null,content:null,contentEditable:ft,controls:Te,controlsList:Ke,coords:oe|_i,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:ih,draggable:ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ke,height:oe,hidden:ih,high:oe,href:null,hrefLang:null,htmlFor:Ke,httpEquiv:Ke,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ke,itemRef:Ke,itemScope:Te,itemType:Ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,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:Te,optimum:oe,pattern:null,ping:Ke,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ke,required:Te,reversed:Te,rows:oe,rowSpan:oe,sandbox:Ke,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oe,step:null,style:null,tabIndex:oe,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:ft,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ke,axis:null,background:null,bgColor:null,border:oe,borderColor:null,bottomMargin:oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:ft,standby:null,summary:null,text:null,topMargin:oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:tw}),t4=Fi({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",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:tn,accentHeight:oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oe,amplitude:oe,arabicForm:null,ascent:oe,attributeName:null,attributeType:null,azimuth:oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oe,by:null,calcMode:null,capHeight:oe,className:Ke,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:oe,diffuseConstant:oe,direction:null,display:null,dur:null,divisor:oe,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:oe,enableBackground:null,end:null,event:null,exponent:oe,externalResourcesRequired:null,fill:null,fillOpacity:oe,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:_i,g2:_i,glyphName:_i,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oe,horizOriginX:oe,horizOriginY:oe,id:null,ideographic:oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oe,k:oe,k1:oe,k2:oe,k3:oe,k4:oe,kernelMatrix:tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oe,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:oe,overlineThickness:oe,paintOrder:null,panose1:null,path:null,pathLength:oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tn,rev:tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tn,requiredFeatures:tn,requiredFonts:tn,requiredFormats:tn,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:oe,specularExponent:oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oe,strikethroughThickness:oe,string:null,stroke:null,strokeDashArray:tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oe,strokeOpacity:oe,strokeWidth:null,style:null,surfaceScale:oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tn,tabIndex:oe,tableValues:null,target:null,targetX:oe,targetY:oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oe,underlineThickness:oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oe,values:null,vAlphabetic:oe,vMathematical:oe,vectorEffect:null,vHanging:oe,vIdeographic:oe,version:null,vertAdvY:oe,vertOriginX:oe,vertOriginY:oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ew}),nw=Fi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),rw=Fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:tw}),lw=Fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),n4={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"},r4=/[A-Z]/g,yb=/-[a-z]/g,l4=/^data[-\w.:]+$/i;function i4(e,r){const l=lh(r);let i=r,o=Yt;if(l in e.normal)return e.property[e.normal[l]];if(l.length>4&&l.slice(0,4)==="data"&&l4.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(yb,o4);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!yb.test(u)){let c=u.replace(r4,a4);c.charAt(0)!=="-"&&(c="-"+c),r="data"+c}}o=Jh}return new o(i,r)}function a4(e){return"-"+e.toLowerCase()}function o4(e){return e.charAt(1).toUpperCase()}const s4=J1([W1,e4,nw,rw,lw],"html"),Wh=J1([W1,t4,nw,rw,lw],"svg");function u4(e){return e.join(" ").trim()}var Ei={},kd,xb;function c4(){if(xb)return kd;xb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,l=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
385
+ `,m="/",g="*",y="",b="comment",v="declaration";function k(A,N){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];N=N||{};var O=1,_=1;function U(J){var Z=J.match(r);Z&&(O+=Z.length);var D=J.lastIndexOf(d);_=~D?J.length-D:_+J.length}function F(){var J={line:O,column:_};return function(Z){return Z.position=new z(J),ae(),Z}}function z(J){this.start=J,this.end={line:O,column:_},this.source=N.source}z.prototype.content=A;function B(J){var Z=new Error(N.source+":"+O+":"+_+": "+J);if(Z.reason=J,Z.filename=N.source,Z.line=O,Z.column=_,Z.source=A,!N.silent)throw Z}function $(J){var Z=J.exec(A);if(Z){var D=Z[0];return U(D),A=A.slice(D.length),Z}}function ae(){$(l)}function P(J){var Z;for(J=J||[];Z=re();)Z!==!1&&J.push(Z);return J}function re(){var J=F();if(!(m!=A.charAt(0)||g!=A.charAt(1))){for(var Z=2;y!=A.charAt(Z)&&(g!=A.charAt(Z)||m!=A.charAt(Z+1));)++Z;if(Z+=2,y===A.charAt(Z-1))return B("End of comment missing");var D=A.slice(2,Z-2);return _+=2,U(D),A=A.slice(Z),_+=2,J({type:b,comment:D})}}function le(){var J=F(),Z=$(i);if(Z){if(re(),!$(o))return B("property missing ':'");var D=$(u),X=J({type:v,property:C(Z[0].replace(e,y)),value:D?C(D[0].replace(e,y)):y});return $(c),X}}function se(){var J=[];P(J);for(var Z;Z=le();)Z!==!1&&(J.push(Z),P(J));return J}return ae(),se()}function C(A){return A?A.replace(f,y):y}return kd=k,kd}var bb;function f4(){if(bb)return Ei;bb=1;var e=Ei&&Ei.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.default=l;const r=e(c4());function l(i,o){let u=null;if(!i||typeof i!="string")return u;const c=(0,r.default)(i),f=typeof o=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:g}=d;f?o(m,g,d):g&&(u=u||{},u[m]=g)}),u}return Ei}var Fa={},vb;function d4(){if(vb)return Fa;vb=1,Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,l=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(m){return!m||l.test(m)||e.test(m)},c=function(m,g){return g.toUpperCase()},f=function(m,g){return"".concat(g,"-")},d=function(m,g){return g===void 0&&(g={}),u(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(o,f):m=m.replace(i,f),m.replace(r,c))};return Fa.camelCase=d,Fa}var Va,wb;function h4(){if(wb)return Va;wb=1;var e=Va&&Va.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=e(f4()),l=d4();function i(o,u){var c={};return!o||typeof o!="string"||(0,r.default)(o,function(f,d){f&&d&&(c[(0,l.camelCase)(f,u)]=d)}),c}return i.default=i,Va=i,Va}var m4=h4();const p4=pu(m4),iw=aw("end"),em=aw("start");function aw(e){return r;function r(l){const i=l&&l.position&&l.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function g4(e){const r=em(e),l=iw(e);if(r&&l)return{start:r,end:l}}function Za(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Sb(e.position):"start"in e||"end"in e?Sb(e):"line"in e||"column"in e?oh(e):""}function oh(e){return kb(e&&e.line)+":"+kb(e&&e.column)}function Sb(e){return oh(e&&e.start)+"-"+oh(e&&e.end)}function kb(e){return e&&typeof e=="number"?e:1}class Rt extends Error{constructor(r,l,i){super(),typeof l=="string"&&(i=l,l=void 0);let o="",u={},c=!1;if(l&&("line"in l&&"column"in l?u={place:l}:"start"in l&&"end"in l?u={place:l}:"type"in l?u={ancestors:[l],place:l.position}:u={...l}),typeof r=="string"?o=r:!u.cause&&r&&(c=!0,o=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?u.ruleId=i:(u.source=i.slice(0,d),u.ruleId=i.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=Za(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Rt.prototype.file="";Rt.prototype.name="";Rt.prototype.reason="";Rt.prototype.message="";Rt.prototype.stack="";Rt.prototype.column=void 0;Rt.prototype.line=void 0;Rt.prototype.ancestors=void 0;Rt.prototype.cause=void 0;Rt.prototype.fatal=void 0;Rt.prototype.place=void 0;Rt.prototype.ruleId=void 0;Rt.prototype.source=void 0;const tm={}.hasOwnProperty,y4=new Map,x4=/[A-Z]/g,b4=new Set(["table","tbody","thead","tfoot","tr"]),v4=new Set(["td","th"]),ow="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function w4(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const l=r.filePath||void 0;let i;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=T4(l,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=j4(l,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:i,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Wh:s4,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=sw(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function sw(e,r,l){if(r.type==="element")return S4(e,r,l);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return k4(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return E4(e,r,l);if(r.type==="mdxjsEsm")return C4(e,r);if(r.type==="root")return N4(e,r,l);if(r.type==="text")return A4(e,r)}function S4(e,r,l){const i=e.schema;let o=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Wh,e.schema=o),e.ancestors.push(r);const u=cw(e,r.tagName,!1),c=_4(e,r);let f=rm(e,r);return b4.has(r.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!JR(d):!0})),uw(e,c,u,r),nm(c,f),e.ancestors.pop(),e.schema=i,e.create(r,u,c,l)}function k4(e,r){if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}ro(e,r.position)}function C4(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);ro(e,r.position)}function E4(e,r,l){const i=e.schema;let o=i;r.name==="svg"&&i.space==="html"&&(o=Wh,e.schema=o),e.ancestors.push(r);const u=r.name===null?e.Fragment:cw(e,r.name,!0),c=R4(e,r),f=rm(e,r);return uw(e,c,u,r),nm(c,f),e.ancestors.pop(),e.schema=i,e.create(r,u,c,l)}function N4(e,r,l){const i={};return nm(i,rm(e,r)),e.create(r,e.Fragment,i,l)}function A4(e,r){return r.value}function uw(e,r,l,i){typeof l!="string"&&l!==e.Fragment&&e.passNode&&(r.node=i)}function nm(e,r){if(r.length>0){const l=r.length>1?r:r[0];l&&(e.children=l)}}function j4(e,r,l){return i;function i(o,u,c,f){const m=Array.isArray(c.children)?l:r;return f?m(u,c,f):m(u,c)}}function T4(e,r){return l;function l(i,o,u,c){const f=Array.isArray(u.children),d=em(i);return r(o,u,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function _4(e,r){const l={};let i,o;for(o in r.properties)if(o!=="children"&&tm.call(r.properties,o)){const u=M4(e,o,r.properties[o]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&v4.has(r.tagName)?i=f:l[c]=f}}if(i){const u=l.style||(l.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return l}function R4(e,r){const l={};for(const i of r.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(l,e.evaluater.evaluateExpression(f.argument))}else ro(e,r.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else ro(e,r.position);else u=i.value===null?!0:i.value;l[o]=u}return l}function rm(e,r){const l=[];let i=-1;const o=e.passKeys?new Map:y4;for(;++i<r.children.length;){const u=r.children[i];let c;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const m=o.get(d)||0;c=d+"-"+m,o.set(d,m+1)}}const f=sw(e,u,c);f!==void 0&&l.push(f)}return l}function M4(e,r,l){const i=i4(e.schema,r);if(!(l==null||typeof l=="number"&&Number.isNaN(l))){if(Array.isArray(l)&&(l=i.commaSeparated?$R(l):u4(l)),i.property==="style"){let o=typeof l=="object"?l:O4(e,String(l));return e.stylePropertyNameCase==="css"&&(o=z4(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?n4[i.property]||i.property:i.attribute,l]}}function O4(e,r){try{return p4(r,{reactCompat:!0})}catch(l){if(e.ignoreInvalidStyle)return{};const i=l,o=new Rt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=ow+"#cannot-parse-style-attribute",o}}function cw(e,r,l){let i;if(!l)i={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let u=-1,c;for(;++u<o.length;){const f=mb(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}i=c}else i=mb(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const o=i.value;return tm.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);ro(e)}function ro(e,r){const l=new Rt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=ow+"#cannot-handle-mdx-estrees-without-createevaluater",l}function z4(e){const r={};let l;for(l in e)tm.call(e,l)&&(r[D4(l)]=e[l]);return r}function D4(e){let r=e.replace(x4,L4);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function L4(e){return"-"+e.toLowerCase()}const Cd={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"]},B4={};function lm(e,r){const l=B4,i=typeof l.includeImageAlt=="boolean"?l.includeImageAlt:!0,o=typeof l.includeHtml=="boolean"?l.includeHtml:!0;return fw(e,i,o)}function fw(e,r,l){if(U4(e)){if("value"in e)return e.type==="html"&&!l?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Cb(e.children,r,l)}return Array.isArray(e)?Cb(e,r,l):""}function Cb(e,r,l){const i=[];let o=-1;for(;++o<e.length;)i[o]=fw(e[o],r,l);return i.join("")}function U4(e){return!!(e&&typeof e=="object")}const Eb=document.createElement("i");function im(e){const r="&"+e+";";Eb.innerHTML=r;const l=Eb.textContent;return l.charCodeAt(l.length-1)===59&&e!=="semi"||l===r?!1:l}function ln(e,r,l,i){const o=e.length;let u=0,c;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,l=l>0?l:0,i.length<1e4)c=Array.from(i),c.unshift(r,l),e.splice(...c);else for(l&&e.splice(r,l);u<i.length;)c=i.slice(u,u+1e4),c.unshift(r,0),e.splice(...c),u+=1e4,r+=1e4}function yn(e,r){return e.length>0?(ln(e,e.length,0,r),e):r}const Nb={}.hasOwnProperty;function dw(e){const r={};let l=-1;for(;++l<e.length;)H4(r,e[l]);return r}function H4(e,r){let l;for(l in r){const o=(Nb.call(e,l)?e[l]:void 0)||(e[l]={}),u=r[l];let c;if(u)for(c in u){Nb.call(o,c)||(o[c]=[]);const f=u[c];P4(o[c],Array.isArray(f)?f:f?[f]:[])}}}function P4(e,r){let l=-1;const i=[];for(;++l<r.length;)(r[l].add==="after"?e:i).push(r[l]);ln(e,0,0,i)}function hw(e,r){const l=Number.parseInt(e,r);return l<9||l===11||l>13&&l<32||l>126&&l<160||l>55295&&l<57344||l>64975&&l<65008||(l&65535)===65535||(l&65535)===65534||l>1114111?"�":String.fromCodePoint(l)}function kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dt=il(/[A-Za-z]/),Tt=il(/[\dA-Za-z]/),q4=il(/[#-'*+\--9=?A-Z^-~]/);function cu(e){return e!==null&&(e<32||e===127)}const sh=il(/\d/),F4=il(/[\dA-Fa-f]/),V4=il(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const Lu=il(new RegExp("\\p{P}|\\p{S}","u")),Ml=il(/\s/);function il(e){return r;function r(l){return l!==null&&l>-1&&e.test(String.fromCharCode(l))}}function Vi(e){const r=[];let l=-1,i=0,o=0;for(;++l<e.length;){const u=e.charCodeAt(l);let c="";if(u===37&&Tt(e.charCodeAt(l+1))&&Tt(e.charCodeAt(l+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(l+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),o=1):c="�"}else c=String.fromCharCode(u);c&&(r.push(e.slice(i,l),encodeURIComponent(c)),i=l+o+1,c=""),o&&(l+=o,o=0)}return r.join("")+e.slice(i)}function Be(e,r,l,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(d){return Oe(d)?(e.enter(l),f(d)):r(d)}function f(d){return Oe(d)&&u++<o?(e.consume(d),f):(e.exit(l),r(d))}}const I4={tokenize:G4};function G4(e){const r=e.attempt(this.parser.constructs.contentInitial,i,o);let l;return r;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Be(e,r,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const d=e.enter("chunkText",{contentType:"text",previous:l});return l&&(l.next=d),l=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return we(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const Y4={tokenize:$4},Ab={tokenize:X4};function $4(e){const r=this,l=[];let i=0,o,u,c;return f;function f(_){if(i<l.length){const U=l[i];return r.containerState=U[1],e.attempt(U[0].continuation,d,m)(_)}return m(_)}function d(_){if(i++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&O();const U=r.events.length;let F=U,z;for(;F--;)if(r.events[F][0]==="exit"&&r.events[F][1].type==="chunkFlow"){z=r.events[F][1].end;break}N(i);let B=U;for(;B<r.events.length;)r.events[B][1].end={...z},B++;return ln(r.events,F+1,0,r.events.slice(U)),r.events.length=B,m(_)}return f(_)}function m(_){if(i===l.length){if(!o)return b(_);if(o.currentConstruct&&o.currentConstruct.concrete)return k(_);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Ab,g,y)(_)}function g(_){return o&&O(),N(i),b(_)}function y(_){return r.parser.lazy[r.now().line]=i!==l.length,c=r.now().offset,k(_)}function b(_){return r.containerState={},e.attempt(Ab,v,k)(_)}function v(_){return i++,l.push([r.currentConstruct,r.containerState]),b(_)}function k(_){if(_===null){o&&O(),N(0),e.consume(_);return}return o=o||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){A(e.exit("chunkFlow"),!0),N(0),e.consume(_);return}return we(_)?(e.consume(_),A(e.exit("chunkFlow")),i=0,r.interrupt=void 0,f):(e.consume(_),C)}function A(_,U){const F=r.sliceStream(_);if(U&&F.push(null),_.previous=u,u&&(u.next=_),u=_,o.defineSkip(_.start),o.write(F),r.parser.lazy[_.start.line]){let z=o.events.length;for(;z--;)if(o.events[z][1].start.offset<c&&(!o.events[z][1].end||o.events[z][1].end.offset>c))return;const B=r.events.length;let $=B,ae,P;for(;$--;)if(r.events[$][0]==="exit"&&r.events[$][1].type==="chunkFlow"){if(ae){P=r.events[$][1].end;break}ae=!0}for(N(i),z=B;z<r.events.length;)r.events[z][1].end={...P},z++;ln(r.events,$+1,0,r.events.slice(B)),r.events.length=z}}function N(_){let U=l.length;for(;U-- >_;){const F=l[U];r.containerState=F[1],F[0].exit.call(r,e)}l.length=_}function O(){o.write([null]),u=void 0,o=void 0,r.containerState._closeFlow=void 0}}function X4(e,r,l){return Be(e,e.attempt(this.parser.constructs.document,r,l),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Di(e){if(e===null||Ze(e)||Ml(e))return 1;if(Lu(e))return 2}function Bu(e,r,l){const i=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!i.includes(u)&&(r=u(r,l),i.push(u))}return r}const uh={name:"attention",resolveAll:Q4,tokenize:Z4};function Q4(e,r){let l=-1,i,o,u,c,f,d,m,g;for(;++l<e.length;)if(e[l][0]==="enter"&&e[l][1].type==="attentionSequence"&&e[l][1]._close){for(i=l;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&r.sliceSerialize(e[i][1]).charCodeAt(0)===r.sliceSerialize(e[l][1]).charCodeAt(0)){if((e[i][1]._close||e[l][1]._open)&&(e[l][1].end.offset-e[l][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[l][1].end.offset-e[l][1].start.offset)%3))continue;d=e[i][1].end.offset-e[i][1].start.offset>1&&e[l][1].end.offset-e[l][1].start.offset>1?2:1;const y={...e[i][1].end},b={...e[l][1].start};jb(y,-d),jb(b,d),c={type:d>1?"strongSequence":"emphasisSequence",start:y,end:{...e[i][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[l][1].start},end:b},u={type:d>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[l][1].start}},o={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[i][1].end={...c.start},e[l][1].start={...f.end},m=[],e[i][1].end.offset-e[i][1].start.offset&&(m=yn(m,[["enter",e[i][1],r],["exit",e[i][1],r]])),m=yn(m,[["enter",o,r],["enter",c,r],["exit",c,r],["enter",u,r]]),m=yn(m,Bu(r.parser.constructs.insideSpan.null,e.slice(i+1,l),r)),m=yn(m,[["exit",u,r],["enter",f,r],["exit",f,r],["exit",o,r]]),e[l][1].end.offset-e[l][1].start.offset?(g=2,m=yn(m,[["enter",e[l][1],r],["exit",e[l][1],r]])):g=0,ln(e,i-1,l-i+3,m),l=i+m.length-g-2;break}}for(l=-1;++l<e.length;)e[l][1].type==="attentionSequence"&&(e[l][1].type="data");return e}function Z4(e,r){const l=this.parser.constructs.attentionMarkers.null,i=this.previous,o=Di(i);let u;return c;function c(d){return u=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===u)return e.consume(d),f;const m=e.exit("attentionSequence"),g=Di(d),y=!g||g===2&&o||l.includes(d),b=!o||o===2&&g||l.includes(i);return m._open=!!(u===42?y:y&&(o||!b)),m._close=!!(u===42?b:b&&(g||!y)),r(d)}}function jb(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const K4={name:"autolink",tokenize:J4};function J4(e,r,l){let i=0;return o;function o(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return Dt(v)?(e.consume(v),c):v===64?l(v):m(v)}function c(v){return v===43||v===45||v===46||Tt(v)?(i=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),i=0,d):(v===43||v===45||v===46||Tt(v))&&i++<32?(e.consume(v),f):(i=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):v===null||v===32||v===60||cu(v)?l(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),g):q4(v)?(e.consume(v),m):l(v)}function g(v){return Tt(v)?y(v):l(v)}function y(v){return v===46?(e.consume(v),i=0,g):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):b(v)}function b(v){if((v===45||Tt(v))&&i++<63){const k=v===45?b:y;return e.consume(v),k}return l(v)}}const mo={partial:!0,tokenize:W4};function W4(e,r,l){return i;function i(u){return Oe(u)?Be(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||we(u)?r(u):l(u)}}const mw={continuation:{tokenize:tM},exit:nM,name:"blockQuote",tokenize:eM};function eM(e,r,l){const i=this;return o;function o(c){if(c===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return l(c)}function u(c){return Oe(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(c))}}function tM(e,r,l){const i=this;return o;function o(c){return Oe(c)?Be(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(mw,r,l)(c)}}function nM(e){e.exit("blockQuote")}const pw={name:"characterEscape",tokenize:rM};function rM(e,r,l){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return V4(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):l(u)}}const gw={name:"characterReference",tokenize:lM};function lM(e,r,l){const i=this;let o=0,u,c;return f;function f(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),d}function d(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,c=Tt,g(y))}function m(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=F4,g):(e.enter("characterReferenceValue"),u=7,c=sh,g(y))}function g(y){if(y===59&&o){const b=e.exit("characterReferenceValue");return c===Tt&&!im(i.sliceSerialize(b))?l(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return c(y)&&o++<u?(e.consume(y),g):l(y)}}const Tb={partial:!0,tokenize:aM},_b={concrete:!0,name:"codeFenced",tokenize:iM};function iM(e,r,l){const i=this,o={partial:!0,tokenize:F};let u=0,c=0,f;return d;function d(z){return m(z)}function m(z){const B=i.events[i.events.length-1];return u=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(z)}function g(z){return z===f?(c++,e.consume(z),g):c<3?l(z):(e.exit("codeFencedFenceSequence"),Oe(z)?Be(e,y,"whitespace")(z):y(z))}function y(z){return z===null||we(z)?(e.exit("codeFencedFence"),i.interrupt?r(z):e.check(Tb,C,U)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||we(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(z)):Oe(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,v,"whitespace")(z)):z===96&&z===f?l(z):(e.consume(z),b)}function v(z){return z===null||we(z)?y(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||we(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(z)):z===96&&z===f?l(z):(e.consume(z),k)}function C(z){return e.attempt(o,U,A)(z)}function A(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return u>0&&Oe(z)?Be(e,O,"linePrefix",u+1)(z):O(z)}function O(z){return z===null||we(z)?e.check(Tb,C,U)(z):(e.enter("codeFlowValue"),_(z))}function _(z){return z===null||we(z)?(e.exit("codeFlowValue"),O(z)):(e.consume(z),_)}function U(z){return e.exit("codeFenced"),r(z)}function F(z,B,$){let ae=0;return P;function P(Z){return z.enter("lineEnding"),z.consume(Z),z.exit("lineEnding"),re}function re(Z){return z.enter("codeFencedFence"),Oe(Z)?Be(z,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):le(Z)}function le(Z){return Z===f?(z.enter("codeFencedFenceSequence"),se(Z)):$(Z)}function se(Z){return Z===f?(ae++,z.consume(Z),se):ae>=c?(z.exit("codeFencedFenceSequence"),Oe(Z)?Be(z,J,"whitespace")(Z):J(Z)):$(Z)}function J(Z){return Z===null||we(Z)?(z.exit("codeFencedFence"),B(Z)):$(Z)}}}function aM(e,r,l){const i=this;return o;function o(c){return c===null?l(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return i.parser.lazy[i.now().line]?l(c):r(c)}}const Ed={name:"codeIndented",tokenize:sM},oM={partial:!0,tokenize:uM};function sM(e,r,l){const i=this;return o;function o(m){return e.enter("codeIndented"),Be(e,u,"linePrefix",5)(m)}function u(m){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(m):l(m)}function c(m){return m===null?d(m):we(m)?e.attempt(oM,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||we(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),r(m)}}function uM(e,r,l){const i=this;return o;function o(c){return i.parser.lazy[i.now().line]?l(c):we(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):Be(e,u,"linePrefix",5)(c)}function u(c){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?r(c):we(c)?o(c):l(c)}}const cM={name:"codeText",previous:dM,resolve:fM,tokenize:hM};function fM(e){let r=e.length-4,l=3,i,o;if((e[l][1].type==="lineEnding"||e[l][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(i=l;++i<r;)if(e[i][1].type==="codeTextData"){e[l][1].type="codeTextPadding",e[r][1].type="codeTextPadding",l+=2,r-=2;break}}for(i=l-1,r++;++i<=r;)o===void 0?i!==r&&e[i][1].type!=="lineEnding"&&(o=i):(i===r||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),r-=i-o-2,i=o+2),o=void 0);return e}function dM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hM(e,r,l){let i=0,o,u;return c;function c(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),i++,f):(e.exit("codeTextSequence"),d(y))}function d(y){return y===null?l(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),d):y===96?(u=e.enter("codeTextSequence"),o=0,g(y)):we(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||we(y)?(e.exit("codeTextData"),d(y)):(e.consume(y),m)}function g(y){return y===96?(e.consume(y),o++,g):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),r(y)):(u.type="codeTextData",m(y))}}class mM{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,l){const i=l??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(r,i):r>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(r,l,i){const o=l||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&Ia(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Ia(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ia(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const l=this.left.splice(r,Number.POSITIVE_INFINITY);Ia(this.right,l.reverse())}else{const l=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ia(this.left,l.reverse())}}}function Ia(e,r){let l=0;if(r.length<1e4)e.push(...r);else for(;l<r.length;)e.push(...r.slice(l,l+1e4)),l+=1e4}function yw(e){const r={};let l=-1,i,o,u,c,f,d,m;const g=new mM(e);for(;++l<g.length;){for(;l in r;)l=r[l];if(i=g.get(l),l&&i[1].type==="chunkFlow"&&g.get(l-1)[1].type==="listItemPrefix"&&(d=i[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(r,pM(g,l)),l=r[l],m=!0);else if(i[1]._container){for(u=l,o=void 0;u--;)if(c=g.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},f=g.slice(o,l),f.unshift(i),g.splice(o,l-o+1,f))}}return ln(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!m}function pM(e,r){const l=e.get(r)[1],i=e.get(r)[2];let o=r-1;const u=[];let c=l._tokenizer;c||(c=i.parser[l.contentType](l.start),l._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let g,y,b=-1,v=l,k=0,C=0;const A=[C];for(;v;){for(;e.get(++o)[1]!==v;);u.push(o),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=l;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(C=b+1,A.push(C),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):A.pop(),b=A.length;b--;){const N=f.slice(A[b],A[b+1]),O=u.pop();d.push([O,O+N.length-1]),e.splice(O,2,N)}for(d.reverse(),b=-1;++b<d.length;)m[k+d[b][0]]=k+d[b][1],k+=d[b][1]-d[b][0]-1;return m}const gM={resolve:xM,tokenize:bM},yM={partial:!0,tokenize:vM};function xM(e){return yw(e),e}function bM(e,r){let l;return i;function i(f){return e.enter("content"),l=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):we(f)?e.check(yM,c,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),r(f)}function c(f){return e.consume(f),e.exit("chunkContent"),l.next=e.enter("chunkContent",{contentType:"content",previous:l}),l=l.next,o}}function vM(e,r,l){const i=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Be(e,u,"linePrefix")}function u(c){if(c===null||we(c))return l(c);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?r(c):e.interrupt(i.parser.constructs.flow,l,r)(c)}}function xw(e,r,l,i,o,u,c,f,d){const m=d||Number.POSITIVE_INFINITY;let g=0;return y;function y(N){return N===60?(e.enter(i),e.enter(o),e.enter(u),e.consume(N),e.exit(u),b):N===null||N===32||N===41||cu(N)?l(N):(e.enter(i),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(N))}function b(N){return N===62?(e.enter(u),e.consume(N),e.exit(u),e.exit(o),e.exit(i),r):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(e.exit("chunkString"),e.exit(f),b(N)):N===null||N===60||we(N)?l(N):(e.consume(N),N===92?k:v)}function k(N){return N===60||N===62||N===92?(e.consume(N),v):v(N)}function C(N){return!g&&(N===null||N===41||Ze(N))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(i),r(N)):g<m&&N===40?(e.consume(N),g++,C):N===41?(e.consume(N),g--,C):N===null||N===32||N===40||cu(N)?l(N):(e.consume(N),N===92?A:C)}function A(N){return N===40||N===41||N===92?(e.consume(N),C):C(N)}}function bw(e,r,l,i,o,u){const c=this;let f=0,d;return m;function m(v){return e.enter(i),e.enter(o),e.consume(v),e.exit(o),e.enter(u),g}function g(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?l(v):v===93?(e.exit(u),e.enter(o),e.consume(v),e.exit(o),e.exit(i),r):we(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||we(v)||f++>999?(e.exit("chunkString"),g(v)):(e.consume(v),d||(d=!Oe(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(e.consume(v),f++,y):y(v)}}function vw(e,r,l,i,o,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(o),e.consume(b),e.exit(o),c=b===40?41:b,d):l(b)}function d(b){return b===c?(e.enter(o),e.consume(b),e.exit(o),e.exit(i),r):(e.enter(u),m(b))}function m(b){return b===c?(e.exit(u),d(c)):b===null?l(b):we(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Be(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||we(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?y:g)}function y(b){return b===c||b===92?(e.consume(b),g):g(b)}}function Ka(e,r){let l;return i;function i(o){return we(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l=!0,i):Oe(o)?Be(e,i,l?"linePrefix":"lineSuffix")(o):r(o)}}const wM={name:"definition",tokenize:kM},SM={partial:!0,tokenize:CM};function kM(e,r,l){const i=this;let o;return u;function u(v){return e.enter("definition"),c(v)}function c(v){return bw.call(i,e,f,l,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return o=kn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):l(v)}function d(v){return Ze(v)?Ka(e,m)(v):m(v)}function m(v){return xw(e,g,l,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return e.attempt(SM,y,y)(v)}function y(v){return Oe(v)?Be(e,b,"whitespace")(v):b(v)}function b(v){return v===null||we(v)?(e.exit("definition"),i.parser.defined.push(o),r(v)):l(v)}}function CM(e,r,l){return i;function i(f){return Ze(f)?Ka(e,o)(f):l(f)}function o(f){return vw(e,u,l,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Oe(f)?Be(e,c,"whitespace")(f):c(f)}function c(f){return f===null||we(f)?r(f):l(f)}}const EM={name:"hardBreakEscape",tokenize:NM};function NM(e,r,l){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return we(u)?(e.exit("hardBreakEscape"),r(u)):l(u)}}const AM={name:"headingAtx",resolve:jM,tokenize:TM};function jM(e,r){let l=e.length-2,i=3,o,u;return e[i][1].type==="whitespace"&&(i+=2),l-2>i&&e[l][1].type==="whitespace"&&(l-=2),e[l][1].type==="atxHeadingSequence"&&(i===l-1||l-4>i&&e[l-2][1].type==="whitespace")&&(l-=i+1===l?2:4),l>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[l][1].end},u={type:"chunkText",start:e[i][1].start,end:e[l][1].end,contentType:"text"},ln(e,i,l-i+1,[["enter",o,r],["enter",u,r],["exit",u,r],["exit",o,r]])),e}function TM(e,r,l){let i=0;return o;function o(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&i++<6?(e.consume(g),c):g===null||Ze(g)?(e.exit("atxHeadingSequence"),f(g)):l(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||we(g)?(e.exit("atxHeading"),r(g)):Oe(g)?Be(e,f,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),f(g))}function m(g){return g===null||g===35||Ze(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),m)}}const _M=["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"],Rb=["pre","script","style","textarea"],RM={concrete:!0,name:"htmlFlow",resolveTo:zM,tokenize:DM},MM={partial:!0,tokenize:BM},OM={partial:!0,tokenize:LM};function zM(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function DM(e,r,l){const i=this;let o,u,c,f,d;return m;function m(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),y}function y(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),u=!0,C):T===63?(e.consume(T),o=3,i.interrupt?r:j):Dt(T)?(e.consume(T),c=String.fromCharCode(T),A):l(T)}function b(T){return T===45?(e.consume(T),o=2,v):T===91?(e.consume(T),o=5,f=0,k):Dt(T)?(e.consume(T),o=4,i.interrupt?r:j):l(T)}function v(T){return T===45?(e.consume(T),i.interrupt?r:j):l(T)}function k(T){const ue="CDATA[";return T===ue.charCodeAt(f++)?(e.consume(T),f===ue.length?i.interrupt?r:le:k):l(T)}function C(T){return Dt(T)?(e.consume(T),c=String.fromCharCode(T),A):l(T)}function A(T){if(T===null||T===47||T===62||Ze(T)){const ue=T===47,de=c.toLowerCase();return!ue&&!u&&Rb.includes(de)?(o=1,i.interrupt?r(T):le(T)):_M.includes(c.toLowerCase())?(o=6,ue?(e.consume(T),N):i.interrupt?r(T):le(T)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?l(T):u?O(T):_(T))}return T===45||Tt(T)?(e.consume(T),c+=String.fromCharCode(T),A):l(T)}function N(T){return T===62?(e.consume(T),i.interrupt?r:le):l(T)}function O(T){return Oe(T)?(e.consume(T),O):P(T)}function _(T){return T===47?(e.consume(T),P):T===58||T===95||Dt(T)?(e.consume(T),U):Oe(T)?(e.consume(T),_):P(T)}function U(T){return T===45||T===46||T===58||T===95||Tt(T)?(e.consume(T),U):F(T)}function F(T){return T===61?(e.consume(T),z):Oe(T)?(e.consume(T),F):_(T)}function z(T){return T===null||T===60||T===61||T===62||T===96?l(T):T===34||T===39?(e.consume(T),d=T,B):Oe(T)?(e.consume(T),z):$(T)}function B(T){return T===d?(e.consume(T),d=null,ae):T===null||we(T)?l(T):(e.consume(T),B)}function $(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ze(T)?F(T):(e.consume(T),$)}function ae(T){return T===47||T===62||Oe(T)?_(T):l(T)}function P(T){return T===62?(e.consume(T),re):l(T)}function re(T){return T===null||we(T)?le(T):Oe(T)?(e.consume(T),re):l(T)}function le(T){return T===45&&o===2?(e.consume(T),D):T===60&&o===1?(e.consume(T),X):T===62&&o===4?(e.consume(T),R):T===63&&o===3?(e.consume(T),j):T===93&&o===5?(e.consume(T),ie):we(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(MM,G,se)(T)):T===null||we(T)?(e.exit("htmlFlowData"),se(T)):(e.consume(T),le)}function se(T){return e.check(OM,J,G)(T)}function J(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),Z}function Z(T){return T===null||we(T)?se(T):(e.enter("htmlFlowData"),le(T))}function D(T){return T===45?(e.consume(T),j):le(T)}function X(T){return T===47?(e.consume(T),c="",ne):le(T)}function ne(T){if(T===62){const ue=c.toLowerCase();return Rb.includes(ue)?(e.consume(T),R):le(T)}return Dt(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ne):le(T)}function ie(T){return T===93?(e.consume(T),j):le(T)}function j(T){return T===62?(e.consume(T),R):T===45&&o===2?(e.consume(T),j):le(T)}function R(T){return T===null||we(T)?(e.exit("htmlFlowData"),G(T)):(e.consume(T),R)}function G(T){return e.exit("htmlFlow"),r(T)}}function LM(e,r,l){const i=this;return o;function o(c){return we(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):l(c)}function u(c){return i.parser.lazy[i.now().line]?l(c):r(c)}}function BM(e,r,l){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(mo,r,l)}}const UM={name:"htmlText",tokenize:HM};function HM(e,r,l){const i=this;let o,u,c;return f;function f(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),d}function d(j){return j===33?(e.consume(j),m):j===47?(e.consume(j),F):j===63?(e.consume(j),_):Dt(j)?(e.consume(j),$):l(j)}function m(j){return j===45?(e.consume(j),g):j===91?(e.consume(j),u=0,k):Dt(j)?(e.consume(j),O):l(j)}function g(j){return j===45?(e.consume(j),v):l(j)}function y(j){return j===null?l(j):j===45?(e.consume(j),b):we(j)?(c=y,X(j)):(e.consume(j),y)}function b(j){return j===45?(e.consume(j),v):y(j)}function v(j){return j===62?D(j):j===45?b(j):y(j)}function k(j){const R="CDATA[";return j===R.charCodeAt(u++)?(e.consume(j),u===R.length?C:k):l(j)}function C(j){return j===null?l(j):j===93?(e.consume(j),A):we(j)?(c=C,X(j)):(e.consume(j),C)}function A(j){return j===93?(e.consume(j),N):C(j)}function N(j){return j===62?D(j):j===93?(e.consume(j),N):C(j)}function O(j){return j===null||j===62?D(j):we(j)?(c=O,X(j)):(e.consume(j),O)}function _(j){return j===null?l(j):j===63?(e.consume(j),U):we(j)?(c=_,X(j)):(e.consume(j),_)}function U(j){return j===62?D(j):_(j)}function F(j){return Dt(j)?(e.consume(j),z):l(j)}function z(j){return j===45||Tt(j)?(e.consume(j),z):B(j)}function B(j){return we(j)?(c=B,X(j)):Oe(j)?(e.consume(j),B):D(j)}function $(j){return j===45||Tt(j)?(e.consume(j),$):j===47||j===62||Ze(j)?ae(j):l(j)}function ae(j){return j===47?(e.consume(j),D):j===58||j===95||Dt(j)?(e.consume(j),P):we(j)?(c=ae,X(j)):Oe(j)?(e.consume(j),ae):D(j)}function P(j){return j===45||j===46||j===58||j===95||Tt(j)?(e.consume(j),P):re(j)}function re(j){return j===61?(e.consume(j),le):we(j)?(c=re,X(j)):Oe(j)?(e.consume(j),re):ae(j)}function le(j){return j===null||j===60||j===61||j===62||j===96?l(j):j===34||j===39?(e.consume(j),o=j,se):we(j)?(c=le,X(j)):Oe(j)?(e.consume(j),le):(e.consume(j),J)}function se(j){return j===o?(e.consume(j),o=void 0,Z):j===null?l(j):we(j)?(c=se,X(j)):(e.consume(j),se)}function J(j){return j===null||j===34||j===39||j===60||j===61||j===96?l(j):j===47||j===62||Ze(j)?ae(j):(e.consume(j),J)}function Z(j){return j===47||j===62||Ze(j)?ae(j):l(j)}function D(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),r):l(j)}function X(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),ne}function ne(j){return Oe(j)?Be(e,ie,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):ie(j)}function ie(j){return e.enter("htmlTextData"),c(j)}}const am={name:"labelEnd",resolveAll:VM,resolveTo:IM,tokenize:GM},PM={tokenize:YM},qM={tokenize:$M},FM={tokenize:XM};function VM(e){let r=-1;const l=[];for(;++r<e.length;){const i=e[r][1];if(l.push(e[r]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",r+=o}}return e.length!==l.length&&ln(e,0,e.length,l),e}function IM(e,r){let l=e.length,i=0,o,u,c,f;for(;l--;)if(o=e[l][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[l][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[l][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=l,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(c=l);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,r],["enter",m,r]],f=yn(f,e.slice(u+1,u+i+3)),f=yn(f,[["enter",g,r]]),f=yn(f,Bu(r.parser.constructs.insideSpan.null,e.slice(u+i+4,c-3),r)),f=yn(f,[["exit",g,r],e[c-2],e[c-1],["exit",m,r]]),f=yn(f,e.slice(c+1)),f=yn(f,[["exit",d,r]]),ln(e,u,e.length,f),e}function GM(e,r,l){const i=this;let o=i.events.length,u,c;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){u=i.events[o][1];break}return f;function f(b){return u?u._inactive?y(b):(c=i.parser.defined.includes(kn(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):l(b)}function d(b){return b===40?e.attempt(PM,g,c?g:y)(b):b===91?e.attempt(qM,g,c?m:y)(b):c?g(b):y(b)}function m(b){return e.attempt(FM,g,y)(b)}function g(b){return r(b)}function y(b){return u._balanced=!0,l(b)}}function YM(e,r,l){return i;function i(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Ze(y)?Ka(e,u)(y):u(y)}function u(y){return y===41?g(y):xw(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function c(y){return Ze(y)?Ka(e,d)(y):g(y)}function f(y){return l(y)}function d(y){return y===34||y===39||y===40?vw(e,m,l,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function m(y){return Ze(y)?Ka(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),r):l(y)}}function $M(e,r,l){const i=this;return o;function o(f){return bw.call(i,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return i.parser.defined.includes(kn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?r(f):l(f)}function c(f){return l(f)}}function XM(e,r,l){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):l(u)}}const QM={name:"labelStartImage",resolveAll:am.resolveAll,tokenize:ZM};function ZM(e,r,l){const i=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):l(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?l(f):r(f)}}const KM={name:"labelStartLink",resolveAll:am.resolveAll,tokenize:JM};function JM(e,r,l){const i=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?l(c):r(c)}}const Nd={name:"lineEnding",tokenize:WM};function WM(e,r){return l;function l(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Be(e,r,"linePrefix")}}const Js={name:"thematicBreak",tokenize:eO};function eO(e,r,l){let i=0,o;return u;function u(m){return e.enter("thematicBreak"),c(m)}function c(m){return o=m,f(m)}function f(m){return m===o?(e.enter("thematicBreakSequence"),d(m)):i>=3&&(m===null||we(m))?(e.exit("thematicBreak"),r(m)):l(m)}function d(m){return m===o?(e.consume(m),i++,d):(e.exit("thematicBreakSequence"),Oe(m)?Be(e,f,"whitespace")(m):f(m))}}const Gt={continuation:{tokenize:lO},exit:aO,name:"list",tokenize:rO},tO={partial:!0,tokenize:oO},nO={partial:!0,tokenize:iO};function rO(e,r,l){const i=this,o=i.events[i.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return f;function f(v){const k=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:sh(v)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Js,l,m)(v):m(v);if(!i.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return l(v)}function d(v){return sh(v)&&++c<10?(e.consume(v),d):(!i.interrupt||c<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):l(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,e.check(mo,i.interrupt?l:g,e.attempt(tO,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return Oe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):l(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(v)}}function lO(e,r,l){const i=this;return i.containerState._closeFlow=void 0,e.check(mo,o,u);function o(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Be(e,r,"listItemIndent",i.containerState.size+1)(f)}function u(f){return i.containerState.furtherBlankLines||!Oe(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,c(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(nO,r,c)(f))}function c(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,Be(e,e.attempt(Gt,r,l),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function iO(e,r,l){const i=this;return Be(e,o,"listItemIndent",i.containerState.size+1);function o(u){const c=i.events[i.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===i.containerState.size?r(u):l(u)}}function aO(e){e.exit(this.containerState.type)}function oO(e,r,l){const i=this;return Be(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const c=i.events[i.events.length-1];return!Oe(u)&&c&&c[1].type==="listItemPrefixWhitespace"?r(u):l(u)}}const Mb={name:"setextUnderline",resolveTo:sO,tokenize:uO};function sO(e,r){let l=e.length,i,o,u;for(;l--;)if(e[l][0]==="enter"){if(e[l][1].type==="content"){i=l;break}e[l][1].type==="paragraph"&&(o=l)}else e[l][1].type==="content"&&e.splice(l,1),!u&&e[l][1].type==="definition"&&(u=l);const c={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",c,r]),e.splice(u+1,0,["exit",e[i][1],r]),e[i][1].end={...e[u][1].end}):e[i][1]=c,e.push(["exit",c,r]),e}function uO(e,r,l){const i=this;let o;return u;function u(m){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(e.enter("setextHeadingLine"),o=m,c(m)):l(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===o?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),Oe(m)?Be(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||we(m)?(e.exit("setextHeadingLine"),r(m)):l(m)}}const cO={tokenize:fO};function fO(e){const r=this,l=e.attempt(mo,i,e.attempt(this.parser.constructs.flowInitial,o,Be(e,e.attempt(this.parser.constructs.flow,o,e.attempt(gM,o)),"linePrefix")));return l;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,l}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,l}}const dO={resolveAll:Sw()},hO=ww("string"),mO=ww("text");function ww(e){return{resolveAll:Sw(e==="text"?pO:void 0),tokenize:r};function r(l){const i=this,o=this.parser.constructs[e],u=l.attempt(o,c,f);return c;function c(g){return m(g)?u(g):f(g)}function f(g){if(g===null){l.consume(g);return}return l.enter("data"),l.consume(g),d}function d(g){return m(g)?(l.exit("data"),u(g)):(l.consume(g),d)}function m(g){if(g===null)return!0;const y=o[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function Sw(e){return r;function r(l,i){let o=-1,u;for(;++o<=l.length;)u===void 0?l[o]&&l[o][1].type==="data"&&(u=o,o++):(!l[o]||l[o][1].type!=="data")&&(o!==u+2&&(l[u][1].end=l[o-1][1].end,l.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(l,i):l}}function pO(e,r){let l=0;for(;++l<=e.length;)if((l===e.length||e[l][1].type==="lineEnding")&&e[l-1][1].type==="data"){const i=e[l-1][1],o=r.sliceStream(i);let u=o.length,c=-1,f=0,d;for(;u--;){const m=o[u];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){u++;break}}if(r._contentTypeTextTrailing&&l===e.length&&(f=0),f){const m={type:l===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:i.start._bufferIndex+c,_index:i.start._index+u,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...m.start},i.start.offset===i.end.offset?Object.assign(i,m):(e.splice(l,0,["enter",m,r],["exit",m,r]),l+=2)}l++}return e}const gO={42:Gt,43:Gt,45:Gt,48:Gt,49:Gt,50:Gt,51:Gt,52:Gt,53:Gt,54:Gt,55:Gt,56:Gt,57:Gt,62:mw},yO={91:wM},xO={[-2]:Ed,[-1]:Ed,32:Ed},bO={35:AM,42:Js,45:[Mb,Js],60:RM,61:Mb,95:Js,96:_b,126:_b},vO={38:gw,92:pw},wO={[-5]:Nd,[-4]:Nd,[-3]:Nd,33:QM,38:gw,42:uh,60:[K4,UM],91:KM,92:[EM,pw],93:am,95:uh,96:cM},SO={null:[uh,dO]},kO={null:[42,95]},CO={null:[]},EO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kO,contentInitial:yO,disable:CO,document:gO,flow:bO,flowInitial:xO,insideSpan:SO,string:vO,text:wO},Symbol.toStringTag,{value:"Module"}));function NO(e,r,l){let i={_bufferIndex:-1,_index:0,line:l&&l.line||1,column:l&&l.column||1,offset:l&&l.offset||0};const o={},u=[];let c=[],f=[];const d={attempt:B(F),check:B(z),consume:O,enter:_,exit:U,interrupt:B(z,{interrupt:!0})},m={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=r.tokenize.call(m,d);return r.resolveAll&&u.push(r),m;function y(re){return c=yn(c,re),A(),c[c.length-1]!==null?[]:($(r,0),m.events=Bu(u,m.events,m),m.events)}function b(re,le){return jO(v(re),le)}function v(re){return AO(c,re)}function k(){const{_bufferIndex:re,_index:le,line:se,column:J,offset:Z}=i;return{_bufferIndex:re,_index:le,line:se,column:J,offset:Z}}function C(re){o[re.line]=re.column,P()}function A(){let re;for(;i._index<c.length;){const le=c[i._index];if(typeof le=="string")for(re=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===re&&i._bufferIndex<le.length;)N(le.charCodeAt(i._bufferIndex));else N(le)}}function N(re){g=g(re)}function O(re){we(re)?(i.line++,i.column=1,i.offset+=re===-3?2:1,P()):re!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===c[i._index].length&&(i._bufferIndex=-1,i._index++)),m.previous=re}function _(re,le){const se=le||{};return se.type=re,se.start=k(),m.events.push(["enter",se,m]),f.push(se),se}function U(re){const le=f.pop();return le.end=k(),m.events.push(["exit",le,m]),le}function F(re,le){$(re,le.from)}function z(re,le){le.restore()}function B(re,le){return se;function se(J,Z,D){let X,ne,ie,j;return Array.isArray(J)?G(J):"tokenize"in J?G([J]):R(J);function R(ce){return Ce;function Ce(Ue){const ve=Ue!==null&&ce[Ue],at=Ue!==null&&ce.null,dt=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(at)?at:at?[at]:[]];return G(dt)(Ue)}}function G(ce){return X=ce,ne=0,ce.length===0?D:T(ce[ne])}function T(ce){return Ce;function Ce(Ue){return j=ae(),ie=ce,ce.partial||(m.currentConstruct=ce),ce.name&&m.parser.constructs.disable.null.includes(ce.name)?de():ce.tokenize.call(le?Object.assign(Object.create(m),le):m,d,ue,de)(Ue)}}function ue(ce){return re(ie,j),Z}function de(ce){return j.restore(),++ne<X.length?T(X[ne]):D}}}function $(re,le){re.resolveAll&&!u.includes(re)&&u.push(re),re.resolve&&ln(m.events,le,m.events.length-le,re.resolve(m.events.slice(le),m)),re.resolveTo&&(m.events=re.resolveTo(m.events,m))}function ae(){const re=k(),le=m.previous,se=m.currentConstruct,J=m.events.length,Z=Array.from(f);return{from:J,restore:D};function D(){i=re,m.previous=le,m.currentConstruct=se,m.events.length=J,f=Z,P()}}function P(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function AO(e,r){const l=r.start._index,i=r.start._bufferIndex,o=r.end._index,u=r.end._bufferIndex;let c;if(l===o)c=[e[l].slice(i,u)];else{if(c=e.slice(l,o),i>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(i):c.shift()}u>0&&c.push(e[o].slice(0,u))}return c}function jO(e,r){let l=-1;const i=[];let o;for(;++l<e.length;){const u=e[l];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
386
386
  `;break}case-3:{c=`\r
387
- `;break}case-2:{c=r?" ":" ";break}case-1:{if(!r&&o)continue;c=" ";break}default:c=String.fromCharCode(u)}o=u===-2,i.push(c)}return i.join("")}function NO(e){const i={constructs:dw([SO,...(e||{}).extensions||[]]),content:o(q4),defined:[],document:o(V4),flow:o(oO),lazy:{},string:o(cO),text:o(fO)};return i;function o(u){return c;function c(f){return kO(i,u,f)}}}function AO(e){for(;!yw(e););return e}const Ob=/[\0\t\n\r]/g;function jO(){let e=1,r="",l=!0,i;return o;function o(u,c,f){const d=[];let m,g,y,b,v;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),y=0,r="",l&&(u.charCodeAt(0)===65279&&y++,l=void 0);y<u.length;){if(Ob.lastIndex=y,m=Ob.exec(u),b=m&&m.index!==void 0?m.index:u.length,v=u.charCodeAt(b),!m){r=u.slice(y);break}if(v===10&&y===b&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),y<b&&(d.push(u.slice(y,b)),e+=b-y),v){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}y=b+1}return f&&(i&&d.push(-5),r&&d.push(r),d.push(null)),d}}const TO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _O(e){return e.replace(TO,RO)}function RO(e,r,l){if(r)return r;if(l.charCodeAt(0)===35){const o=l.charCodeAt(1),u=o===120||o===88;return hw(l.slice(u?2:1),u?16:10)}return im(l)||e}const kw={}.hasOwnProperty;function MO(e,r,l){return r&&typeof r=="object"&&(l=r,r=void 0),OO(l)(AO(NO(l).document().write(jO()(e,r,!0))))}function OO(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u($t),autolinkProtocol:ae,autolinkEmail:ae,atxHeading:u(jn),blockQuote:u(at),characterEscape:ae,characterReference:ae,codeFenced:u(dt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(dt,c),codeText:u(At,c),codeTextData:ae,data:ae,codeFlowValue:ae,definition:u(wt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ht),hardBreakEscape:u(Tn),hardBreakTrailing:u(Tn),htmlFlow:u(xr,c),htmlFlowData:ae,htmlText:u(xr,c),htmlTextData:ae,image:u(br),label:c,link:u($t),listItem:u(al),listItemValue:b,listOrdered:u(vr,y),listUnordered:u(vr),paragraph:u(Ii),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(jn),strong:u(Ll),thematicBreak:u(Bl)},exit:{atxHeading:d(),atxHeadingSequence:F,autolink:d(),autolinkEmail:ve,autolinkProtocol:Ue,blockQuote:d(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ce,characterReference:Ce,codeFenced:d(A),codeFencedFence:C,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:P,codeIndented:d(N),codeText:d(Z),codeTextData:P,data:P,definition:d(),definitionDestinationString:U,definitionLabelString:O,definitionTitleString:_,emphasis:d(),hardBreakEscape:d(le),hardBreakTrailing:d(le),htmlFlow:d(se),htmlFlowData:P,htmlText:d(J),htmlTextData:P,image:d(X),label:ie,labelText:ne,lineEnding:re,link:d(D),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ue,resourceDestinationString:j,resourceTitleString:R,resource:G,setextHeading:d($),setextHeadingLineSequence:B,setextHeadingText:z,strong:d(),thematicBreak:d()}};Cw(r,(e||{}).mdastExtensions||[]);const l={};return i;function i(H){let K={type:"root",children:[]};const fe={stack:[K],tokenStack:[],config:r,enter:f,exit:m,buffer:c,resume:g,data:l},ge=[];let Ee=-1;for(;++Ee<H.length;)if(H[Ee][1].type==="listOrdered"||H[Ee][1].type==="listUnordered")if(H[Ee][0]==="enter")ge.push(Ee);else{const Lt=ge.pop();Ee=o(H,Lt,Ee)}for(Ee=-1;++Ee<H.length;){const Lt=r[H[Ee][0]];kw.call(Lt,H[Ee][1].type)&&Lt[H[Ee][1].type].call(Object.assign({sliceSerialize:H[Ee][2].sliceSerialize},fe),H[Ee][1])}if(fe.tokenStack.length>0){const Lt=fe.tokenStack[fe.tokenStack.length-1];(Lt[1]||zb).call(fe,void 0,Lt[0])}for(K.position={start:Xr(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Xr(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<r.transforms.length;)K=r.transforms[Ee](K)||K;return K}function o(H,K,fe){let ge=K-1,Ee=-1,Lt=!1,Gn,Mt,mt,Bt;for(;++ge<=fe;){const Xe=H[ge];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?Ee++:Ee--,Bt=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Gn&&!Bt&&!Ee&&!mt&&(mt=ge),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!Ee&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||Ee===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Gn){let wr=ge;for(Mt=void 0;wr--;){const bn=H[wr];if(bn[1].type==="lineEnding"||bn[1].type==="lineEndingBlank"){if(bn[0]==="exit")continue;Mt&&(H[Mt][1].type="lineEndingBlank",Lt=!0),bn[1].type="lineEnding",Mt=wr}else if(!(bn[1].type==="linePrefix"||bn[1].type==="blockQuotePrefix"||bn[1].type==="blockQuotePrefixWhitespace"||bn[1].type==="blockQuoteMarker"||bn[1].type==="listItemIndent"))break}mt&&(!Mt||mt<Mt)&&(Gn._spread=!0),Gn.end=Object.assign({},Mt?H[Mt][1].start:Xe[1].end),H.splice(Mt||ge,0,["exit",Gn,Xe[2]]),ge++,fe++}if(Xe[1].type==="listItemPrefix"){const wr={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Gn=wr,H.splice(ge,0,["enter",wr,Xe[2]]),ge++,fe++,mt=void 0,Bt=!0}}}return H[K][1]._spread=Lt,fe}function u(H,K){return fe;function fe(ge){f.call(this,H(ge),ge),K&&K.call(this,ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(H,K,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([K,fe||void 0]),H.position={start:Xr(K.start),end:void 0}}function d(H){return K;function K(fe){H&&H.call(this,fe),m.call(this,fe)}}function m(H,K){const fe=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==H.type&&(K?K.call(this,H,ge[0]):(ge[1]||zb).call(this,H,ge[0]));else throw new Error("Cannot close `"+H.type+"` ("+Za({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Xr(H.end)}function g(){return lm(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(H){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function v(){const H=this.resume(),K=this.stack[this.stack.length-1];K.lang=H}function k(){const H=this.resume(),K=this.stack[this.stack.length-1];K.meta=H}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function A(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H.replace(/(\r?\n|\r)$/g,"")}function O(H){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.label=K,fe.identifier=kn(this.sliceSerialize(H)).toLowerCase()}function _(){const H=this.resume(),K=this.stack[this.stack.length-1];K.title=H}function U(){const H=this.resume(),K=this.stack[this.stack.length-1];K.url=H}function F(H){const K=this.stack[this.stack.length-1];if(!K.depth){const fe=this.sliceSerialize(H).length;K.depth=fe}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function B(H){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function ae(H){const fe=this.stack[this.stack.length-1].children;let ge=fe[fe.length-1];(!ge||ge.type!=="text")&&(ge=xt(),ge.position={start:Xr(H.start),end:void 0},fe.push(ge)),this.stack.push(ge)}function P(H){const K=this.stack.pop();K.value+=this.sliceSerialize(H),K.position.end=Xr(H.end)}function re(H){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=K.children[K.children.length-1];fe.position.end=Xr(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(K.type)&&(ae.call(this,H),P.call(this,H))}function le(){this.data.atHardBreak=!0}function se(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function J(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function Z(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function D(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=K,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function X(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=K,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ne(H){const K=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=_O(K),fe.identifier=kn(K).toLowerCase()}function ie(){const H=this.stack[this.stack.length-1],K=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ge=H.children;fe.children=ge}else fe.alt=K}function j(){const H=this.resume(),K=this.stack[this.stack.length-1];K.url=H}function R(){const H=this.resume(),K=this.stack[this.stack.length-1];K.title=H}function G(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ue(H){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.label=K,fe.identifier=kn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function de(H){this.data.characterReferenceType=H.type}function ce(H){const K=this.sliceSerialize(H),fe=this.data.characterReferenceType;let ge;fe?(ge=hw(K,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=im(K);const Ee=this.stack[this.stack.length-1];Ee.value+=ge}function Ce(H){const K=this.stack.pop();K.position.end=Xr(H.end)}function Ue(H){P.call(this,H);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(H)}function ve(H){P.call(this,H);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(H)}function at(){return{type:"blockquote",children:[]}}function dt(){return{type:"code",lang:null,meta:null,value:""}}function At(){return{type:"inlineCode",value:""}}function wt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ht(){return{type:"emphasis",children:[]}}function jn(){return{type:"heading",depth:0,children:[]}}function Tn(){return{type:"break"}}function xr(){return{type:"html",value:""}}function br(){return{type:"image",title:null,url:"",alt:null}}function $t(){return{type:"link",title:null,url:"",children:[]}}function vr(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function al(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function Ii(){return{type:"paragraph",children:[]}}function Ll(){return{type:"strong",children:[]}}function xt(){return{type:"text",value:""}}function Bl(){return{type:"thematicBreak"}}}function Xr(e){return{line:e.line,column:e.column,offset:e.offset}}function Cw(e,r){let l=-1;for(;++l<r.length;){const i=r[l];Array.isArray(i)?Cw(e,i):zO(e,i)}}function zO(e,r){let l;for(l in r)if(kw.call(r,l))switch(l){case"canContainEols":{const i=r[l];i&&e[l].push(...i);break}case"transforms":{const i=r[l];i&&e[l].push(...i);break}case"enter":case"exit":{const i=r[l];i&&Object.assign(e[l],i);break}}}function zb(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Za({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Za({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Za({start:r.start,end:r.end})+") is still open")}function DO(e){const r=this;r.parser=l;function l(i){return MO(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function LO(e,r){const l={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,l),e.applyData(r,l)}function BO(e,r){const l={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,l),[e.applyData(r,l),{type:"text",value:`
388
- `}]}function UO(e,r){const l=r.value?r.value+`
389
- `:"",i={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:l}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function HO(e,r){const l={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function PO(e,r){const l={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function qO(e,r){const l=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(r.identifier).toUpperCase(),o=Vi(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let c,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(i,f);const d={type:"element",tagName:"a",properties:{href:"#"+l+"fn-"+o,id:l+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(r,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,m),e.applyData(r,m)}function FO(e,r){const l={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function VO(e,r){if(e.options.allowDangerousHtml){const l={type:"raw",value:r.value};return e.patch(r,l),e.applyData(r,l)}}function Ew(e,r){const l=r.referenceType;let i="]";if(l==="collapsed"?i+="[]":l==="full"&&(i+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+i}];const o=e.all(r),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const c=o[o.length-1];return c&&c.type==="text"?c.value+=i:o.push({type:"text",value:i}),o}function IO(e,r){const l=String(r.identifier).toUpperCase(),i=e.definitionById.get(l);if(!i)return Ew(e,r);const o={src:Vi(i.url||""),alt:r.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(r,u),e.applyData(r,u)}function GO(e,r){const l={src:Vi(r.url)};r.alt!==null&&r.alt!==void 0&&(l.alt=r.alt),r.title!==null&&r.title!==void 0&&(l.title=r.title);const i={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,i),e.applyData(r,i)}function YO(e,r){const l={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,l);const i={type:"element",tagName:"code",properties:{},children:[l]};return e.patch(r,i),e.applyData(r,i)}function $O(e,r){const l=String(r.identifier).toUpperCase(),i=e.definitionById.get(l);if(!i)return Ew(e,r);const o={href:Vi(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function XO(e,r){const l={href:Vi(r.url)};r.title!==null&&r.title!==void 0&&(l.title=r.title);const i={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function QO(e,r,l){const i=e.all(r),o=l?ZO(l):Nw(r),u={},c=[];if(typeof r.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
387
+ `;break}case-2:{c=r?" ":" ";break}case-1:{if(!r&&o)continue;c=" ";break}default:c=String.fromCharCode(u)}o=u===-2,i.push(c)}return i.join("")}function TO(e){const i={constructs:dw([EO,...(e||{}).extensions||[]]),content:o(I4),defined:[],document:o(Y4),flow:o(cO),lazy:{},string:o(hO),text:o(mO)};return i;function o(u){return c;function c(f){return NO(i,u,f)}}}function _O(e){for(;!yw(e););return e}const Ob=/[\0\t\n\r]/g;function RO(){let e=1,r="",l=!0,i;return o;function o(u,c,f){const d=[];let m,g,y,b,v;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),y=0,r="",l&&(u.charCodeAt(0)===65279&&y++,l=void 0);y<u.length;){if(Ob.lastIndex=y,m=Ob.exec(u),b=m&&m.index!==void 0?m.index:u.length,v=u.charCodeAt(b),!m){r=u.slice(y);break}if(v===10&&y===b&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),y<b&&(d.push(u.slice(y,b)),e+=b-y),v){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}y=b+1}return f&&(i&&d.push(-5),r&&d.push(r),d.push(null)),d}}const MO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OO(e){return e.replace(MO,zO)}function zO(e,r,l){if(r)return r;if(l.charCodeAt(0)===35){const o=l.charCodeAt(1),u=o===120||o===88;return hw(l.slice(u?2:1),u?16:10)}return im(l)||e}const kw={}.hasOwnProperty;function DO(e,r,l){return r&&typeof r=="object"&&(l=r,r=void 0),LO(l)(_O(TO(l).document().write(RO()(e,r,!0))))}function LO(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u($t),autolinkProtocol:ae,autolinkEmail:ae,atxHeading:u(jn),blockQuote:u(at),characterEscape:ae,characterReference:ae,codeFenced:u(dt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(dt,c),codeText:u(At,c),codeTextData:ae,data:ae,codeFlowValue:ae,definition:u(wt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ht),hardBreakEscape:u(Tn),hardBreakTrailing:u(Tn),htmlFlow:u(xr,c),htmlFlowData:ae,htmlText:u(xr,c),htmlTextData:ae,image:u(br),label:c,link:u($t),listItem:u(al),listItemValue:b,listOrdered:u(vr,y),listUnordered:u(vr),paragraph:u(Ii),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(jn),strong:u(Ll),thematicBreak:u(Bl)},exit:{atxHeading:d(),atxHeadingSequence:F,autolink:d(),autolinkEmail:ve,autolinkProtocol:Ue,blockQuote:d(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ce,characterReference:Ce,codeFenced:d(A),codeFencedFence:C,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:P,codeIndented:d(N),codeText:d(Z),codeTextData:P,data:P,definition:d(),definitionDestinationString:U,definitionLabelString:O,definitionTitleString:_,emphasis:d(),hardBreakEscape:d(le),hardBreakTrailing:d(le),htmlFlow:d(se),htmlFlowData:P,htmlText:d(J),htmlTextData:P,image:d(X),label:ie,labelText:ne,lineEnding:re,link:d(D),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ue,resourceDestinationString:j,resourceTitleString:R,resource:G,setextHeading:d($),setextHeadingLineSequence:B,setextHeadingText:z,strong:d(),thematicBreak:d()}};Cw(r,(e||{}).mdastExtensions||[]);const l={};return i;function i(H){let K={type:"root",children:[]};const fe={stack:[K],tokenStack:[],config:r,enter:f,exit:m,buffer:c,resume:g,data:l},ge=[];let Ee=-1;for(;++Ee<H.length;)if(H[Ee][1].type==="listOrdered"||H[Ee][1].type==="listUnordered")if(H[Ee][0]==="enter")ge.push(Ee);else{const Lt=ge.pop();Ee=o(H,Lt,Ee)}for(Ee=-1;++Ee<H.length;){const Lt=r[H[Ee][0]];kw.call(Lt,H[Ee][1].type)&&Lt[H[Ee][1].type].call(Object.assign({sliceSerialize:H[Ee][2].sliceSerialize},fe),H[Ee][1])}if(fe.tokenStack.length>0){const Lt=fe.tokenStack[fe.tokenStack.length-1];(Lt[1]||zb).call(fe,void 0,Lt[0])}for(K.position={start:Xr(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Xr(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<r.transforms.length;)K=r.transforms[Ee](K)||K;return K}function o(H,K,fe){let ge=K-1,Ee=-1,Lt=!1,Gn,Mt,mt,Bt;for(;++ge<=fe;){const Xe=H[ge];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?Ee++:Ee--,Bt=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Gn&&!Bt&&!Ee&&!mt&&(mt=ge),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!Ee&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||Ee===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Gn){let wr=ge;for(Mt=void 0;wr--;){const bn=H[wr];if(bn[1].type==="lineEnding"||bn[1].type==="lineEndingBlank"){if(bn[0]==="exit")continue;Mt&&(H[Mt][1].type="lineEndingBlank",Lt=!0),bn[1].type="lineEnding",Mt=wr}else if(!(bn[1].type==="linePrefix"||bn[1].type==="blockQuotePrefix"||bn[1].type==="blockQuotePrefixWhitespace"||bn[1].type==="blockQuoteMarker"||bn[1].type==="listItemIndent"))break}mt&&(!Mt||mt<Mt)&&(Gn._spread=!0),Gn.end=Object.assign({},Mt?H[Mt][1].start:Xe[1].end),H.splice(Mt||ge,0,["exit",Gn,Xe[2]]),ge++,fe++}if(Xe[1].type==="listItemPrefix"){const wr={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Gn=wr,H.splice(ge,0,["enter",wr,Xe[2]]),ge++,fe++,mt=void 0,Bt=!0}}}return H[K][1]._spread=Lt,fe}function u(H,K){return fe;function fe(ge){f.call(this,H(ge),ge),K&&K.call(this,ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(H,K,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([K,fe||void 0]),H.position={start:Xr(K.start),end:void 0}}function d(H){return K;function K(fe){H&&H.call(this,fe),m.call(this,fe)}}function m(H,K){const fe=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==H.type&&(K?K.call(this,H,ge[0]):(ge[1]||zb).call(this,H,ge[0]));else throw new Error("Cannot close `"+H.type+"` ("+Za({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Xr(H.end)}function g(){return lm(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(H){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function v(){const H=this.resume(),K=this.stack[this.stack.length-1];K.lang=H}function k(){const H=this.resume(),K=this.stack[this.stack.length-1];K.meta=H}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function A(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H.replace(/(\r?\n|\r)$/g,"")}function O(H){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.label=K,fe.identifier=kn(this.sliceSerialize(H)).toLowerCase()}function _(){const H=this.resume(),K=this.stack[this.stack.length-1];K.title=H}function U(){const H=this.resume(),K=this.stack[this.stack.length-1];K.url=H}function F(H){const K=this.stack[this.stack.length-1];if(!K.depth){const fe=this.sliceSerialize(H).length;K.depth=fe}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function B(H){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function ae(H){const fe=this.stack[this.stack.length-1].children;let ge=fe[fe.length-1];(!ge||ge.type!=="text")&&(ge=xt(),ge.position={start:Xr(H.start),end:void 0},fe.push(ge)),this.stack.push(ge)}function P(H){const K=this.stack.pop();K.value+=this.sliceSerialize(H),K.position.end=Xr(H.end)}function re(H){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=K.children[K.children.length-1];fe.position.end=Xr(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(K.type)&&(ae.call(this,H),P.call(this,H))}function le(){this.data.atHardBreak=!0}function se(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function J(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function Z(){const H=this.resume(),K=this.stack[this.stack.length-1];K.value=H}function D(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=K,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function X(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=K,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ne(H){const K=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=OO(K),fe.identifier=kn(K).toLowerCase()}function ie(){const H=this.stack[this.stack.length-1],K=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ge=H.children;fe.children=ge}else fe.alt=K}function j(){const H=this.resume(),K=this.stack[this.stack.length-1];K.url=H}function R(){const H=this.resume(),K=this.stack[this.stack.length-1];K.title=H}function G(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ue(H){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.label=K,fe.identifier=kn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function de(H){this.data.characterReferenceType=H.type}function ce(H){const K=this.sliceSerialize(H),fe=this.data.characterReferenceType;let ge;fe?(ge=hw(K,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=im(K);const Ee=this.stack[this.stack.length-1];Ee.value+=ge}function Ce(H){const K=this.stack.pop();K.position.end=Xr(H.end)}function Ue(H){P.call(this,H);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(H)}function ve(H){P.call(this,H);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(H)}function at(){return{type:"blockquote",children:[]}}function dt(){return{type:"code",lang:null,meta:null,value:""}}function At(){return{type:"inlineCode",value:""}}function wt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ht(){return{type:"emphasis",children:[]}}function jn(){return{type:"heading",depth:0,children:[]}}function Tn(){return{type:"break"}}function xr(){return{type:"html",value:""}}function br(){return{type:"image",title:null,url:"",alt:null}}function $t(){return{type:"link",title:null,url:"",children:[]}}function vr(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function al(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function Ii(){return{type:"paragraph",children:[]}}function Ll(){return{type:"strong",children:[]}}function xt(){return{type:"text",value:""}}function Bl(){return{type:"thematicBreak"}}}function Xr(e){return{line:e.line,column:e.column,offset:e.offset}}function Cw(e,r){let l=-1;for(;++l<r.length;){const i=r[l];Array.isArray(i)?Cw(e,i):BO(e,i)}}function BO(e,r){let l;for(l in r)if(kw.call(r,l))switch(l){case"canContainEols":{const i=r[l];i&&e[l].push(...i);break}case"transforms":{const i=r[l];i&&e[l].push(...i);break}case"enter":case"exit":{const i=r[l];i&&Object.assign(e[l],i);break}}}function zb(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Za({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Za({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Za({start:r.start,end:r.end})+") is still open")}function UO(e){const r=this;r.parser=l;function l(i){return DO(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function HO(e,r){const l={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,l),e.applyData(r,l)}function PO(e,r){const l={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,l),[e.applyData(r,l),{type:"text",value:`
388
+ `}]}function qO(e,r){const l=r.value?r.value+`
389
+ `:"",i={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:l}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function FO(e,r){const l={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function VO(e,r){const l={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function IO(e,r){const l=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(r.identifier).toUpperCase(),o=Vi(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let c,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(i,f);const d={type:"element",tagName:"a",properties:{href:"#"+l+"fn-"+o,id:l+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(r,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,m),e.applyData(r,m)}function GO(e,r){const l={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function YO(e,r){if(e.options.allowDangerousHtml){const l={type:"raw",value:r.value};return e.patch(r,l),e.applyData(r,l)}}function Ew(e,r){const l=r.referenceType;let i="]";if(l==="collapsed"?i+="[]":l==="full"&&(i+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+i}];const o=e.all(r),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const c=o[o.length-1];return c&&c.type==="text"?c.value+=i:o.push({type:"text",value:i}),o}function $O(e,r){const l=String(r.identifier).toUpperCase(),i=e.definitionById.get(l);if(!i)return Ew(e,r);const o={src:Vi(i.url||""),alt:r.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(r,u),e.applyData(r,u)}function XO(e,r){const l={src:Vi(r.url)};r.alt!==null&&r.alt!==void 0&&(l.alt=r.alt),r.title!==null&&r.title!==void 0&&(l.title=r.title);const i={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,i),e.applyData(r,i)}function QO(e,r){const l={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,l);const i={type:"element",tagName:"code",properties:{},children:[l]};return e.patch(r,i),e.applyData(r,i)}function ZO(e,r){const l=String(r.identifier).toUpperCase(),i=e.definitionById.get(l);if(!i)return Ew(e,r);const o={href:Vi(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function KO(e,r){const l={href:Vi(r.url)};r.title!==null&&r.title!==void 0&&(l.title=r.title);const i={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function JO(e,r,l){const i=e.all(r),o=l?WO(l):Nw(r),u={},c=[];if(typeof r.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
390
390
  `}),g.type==="element"&&g.tagName==="p"&&!o?c.push(...g.children):c.push(g)}const d=i[i.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
391
- `});const m={type:"element",tagName:"li",properties:u,children:c};return e.patch(r,m),e.applyData(r,m)}function ZO(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const l=e.children;let i=-1;for(;!r&&++i<l.length;)r=Nw(l[i])}return r}function Nw(e){const r=e.spread;return r??e.children.length>1}function KO(e,r){const l={},i=e.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(l.start=r.start);++o<i.length;){const c=i[o];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){l.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:l,children:e.wrap(i,!0)};return e.patch(r,u),e.applyData(r,u)}function JO(e,r){const l={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function WO(e,r){const l={type:"root",children:e.wrap(e.all(r))};return e.patch(r,l),e.applyData(r,l)}function e3(e,r){const l={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function t3(e,r){const l=e.all(r),i=l.shift(),o=[];if(i){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(r.children[0],c),o.push(c)}if(l.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(l,!0)},f=em(r.children[1]),d=iw(r.children[r.children.length-1]);f&&d&&(c.position={start:f,end:d}),o.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(r,u),e.applyData(r,u)}function n3(e,r,l){const i=l?l.children:void 0,u=(i?i.indexOf(r):1)===0?"th":"td",c=l&&l.type==="table"?l.align:void 0,f=c?c.length:r.children.length;let d=-1;const m=[];for(;++d<f;){const y=r.children[d],b={},v=c?c[d]:void 0;v&&(b.align=v);let k={type:"element",tagName:u,properties:b,children:[]};y&&(k.children=e.all(y),e.patch(y,k),k=e.applyData(y,k)),m.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(r,g),e.applyData(r,g)}function r3(e,r){const l={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}const Db=9,Lb=32;function l3(e){const r=String(e),l=/\r?\n|\r/g;let i=l.exec(r),o=0;const u=[];for(;i;)u.push(Bb(r.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=l.exec(r);return u.push(Bb(r.slice(o),o>0,!1)),u.join("")}function Bb(e,r,l){let i=0,o=e.length;if(r){let u=e.codePointAt(i);for(;u===Db||u===Lb;)i++,u=e.codePointAt(i)}if(l){let u=e.codePointAt(o-1);for(;u===Db||u===Lb;)o--,u=e.codePointAt(o-1)}return o>i?e.slice(i,o):""}function i3(e,r){const l={type:"text",value:l3(String(r.value))};return e.patch(r,l),e.applyData(r,l)}function a3(e,r){const l={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,l),e.applyData(r,l)}const o3={blockquote:LO,break:BO,code:UO,delete:HO,emphasis:PO,footnoteReference:qO,heading:FO,html:VO,imageReference:IO,image:GO,inlineCode:YO,linkReference:$O,link:XO,listItem:QO,list:KO,paragraph:JO,root:WO,strong:e3,table:t3,tableCell:r3,tableRow:n3,text:i3,thematicBreak:a3,toml:Fs,yaml:Fs,definition:Fs,footnoteDefinition:Fs};function Fs(){}const Aw=-1,Uu=0,Ja=1,fu=2,om=3,sm=4,um=5,cm=6,jw=7,Tw=8,Ub=typeof self=="object"?self:globalThis,s3=(e,r)=>{const l=(o,u)=>(e.set(u,o),o),i=o=>{if(e.has(o))return e.get(o);const[u,c]=r[o];switch(u){case Uu:case Aw:return l(c,o);case Ja:{const f=l([],o);for(const d of c)f.push(i(d));return f}case fu:{const f=l({},o);for(const[d,m]of c)f[i(d)]=i(m);return f}case om:return l(new Date(c),o);case sm:{const{source:f,flags:d}=c;return l(new RegExp(f,d),o)}case um:{const f=l(new Map,o);for(const[d,m]of c)f.set(i(d),i(m));return f}case cm:{const f=l(new Set,o);for(const d of c)f.add(i(d));return f}case jw:{const{name:f,message:d}=c;return l(new Ub[f](d),o)}case Tw:return l(BigInt(c),o);case"BigInt":return l(Object(BigInt(c)),o);case"ArrayBuffer":return l(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return l(new DataView(f),c)}}return l(new Ub[u](c),o)};return i},Hb=e=>s3(new Map,e)(0),Ni="",{toString:u3}={},{keys:c3}=Object,Ga=e=>{const r=typeof e;if(r!=="object"||!e)return[Uu,r];const l=u3.call(e).slice(8,-1);switch(l){case"Array":return[Ja,Ni];case"Object":return[fu,Ni];case"Date":return[om,Ni];case"RegExp":return[sm,Ni];case"Map":return[um,Ni];case"Set":return[cm,Ni];case"DataView":return[Ja,l]}return l.includes("Array")?[Ja,l]:l.includes("Error")?[jw,l]:[fu,l]},Vs=([e,r])=>e===Uu&&(r==="function"||r==="symbol"),f3=(e,r,l,i)=>{const o=(c,f)=>{const d=i.push(c)-1;return l.set(f,d),d},u=c=>{if(l.has(c))return l.get(c);let[f,d]=Ga(c);switch(f){case Uu:{let g=c;switch(d){case"bigint":f=Tw,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return o([Aw],c)}return o([f,g],c)}case Ja:{if(d){let b=c;return d==="DataView"?b=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(b=new Uint8Array(c)),o([d,[...b]],c)}const g=[],y=o([f,g],c);for(const b of c)g.push(u(b));return y}case fu:{if(d)switch(d){case"BigInt":return o([d,c.toString()],c);case"Boolean":case"Number":case"String":return o([d,c.valueOf()],c)}if(r&&"toJSON"in c)return u(c.toJSON());const g=[],y=o([f,g],c);for(const b of c3(c))(e||!Vs(Ga(c[b])))&&g.push([u(b),u(c[b])]);return y}case om:return o([f,c.toISOString()],c);case sm:{const{source:g,flags:y}=c;return o([f,{source:g,flags:y}],c)}case um:{const g=[],y=o([f,g],c);for(const[b,v]of c)(e||!(Vs(Ga(b))||Vs(Ga(v))))&&g.push([u(b),u(v)]);return y}case cm:{const g=[],y=o([f,g],c);for(const b of c)(e||!Vs(Ga(b)))&&g.push(u(b));return y}}const{message:m}=c;return o([f,{name:d,message:m}],c)};return u},Pb=(e,{json:r,lossy:l}={})=>{const i=[];return f3(!(r||l),!!r,new Map,i)(e),i},du=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Hb(Pb(e,r)):structuredClone(e):(e,r)=>Hb(Pb(e,r));function d3(e,r){const l=[{type:"text",value:"↩"}];return r>1&&l.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),l}function h3(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function m3(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=e.options.footnoteBackContent||d3,i=e.options.footnoteBackLabel||h3,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const g=e.all(m),y=String(m.identifier).toUpperCase(),b=Vi(y.toLowerCase());let v=0;const k=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++v<=C;){k.length>0&&k.push({type:"text",value:" "});let O=typeof l=="string"?l:l(d,v);typeof O=="string"&&(O={type:"text",value:O}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(d,v),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const A=g[g.length-1];if(A&&A.type==="element"&&A.tagName==="p"){const O=A.children[A.children.length-1];O&&O.type==="text"?O.value+=" ":A.children.push({type:"text",value:" "}),A.children.push(...k)}else g.push(...k);const N={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(m,N),f.push(N)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...du(c),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
391
+ `});const m={type:"element",tagName:"li",properties:u,children:c};return e.patch(r,m),e.applyData(r,m)}function WO(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const l=e.children;let i=-1;for(;!r&&++i<l.length;)r=Nw(l[i])}return r}function Nw(e){const r=e.spread;return r??e.children.length>1}function e3(e,r){const l={},i=e.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(l.start=r.start);++o<i.length;){const c=i[o];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){l.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:l,children:e.wrap(i,!0)};return e.patch(r,u),e.applyData(r,u)}function t3(e,r){const l={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function n3(e,r){const l={type:"root",children:e.wrap(e.all(r))};return e.patch(r,l),e.applyData(r,l)}function r3(e,r){const l={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function l3(e,r){const l=e.all(r),i=l.shift(),o=[];if(i){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(r.children[0],c),o.push(c)}if(l.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(l,!0)},f=em(r.children[1]),d=iw(r.children[r.children.length-1]);f&&d&&(c.position={start:f,end:d}),o.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(r,u),e.applyData(r,u)}function i3(e,r,l){const i=l?l.children:void 0,u=(i?i.indexOf(r):1)===0?"th":"td",c=l&&l.type==="table"?l.align:void 0,f=c?c.length:r.children.length;let d=-1;const m=[];for(;++d<f;){const y=r.children[d],b={},v=c?c[d]:void 0;v&&(b.align=v);let k={type:"element",tagName:u,properties:b,children:[]};y&&(k.children=e.all(y),e.patch(y,k),k=e.applyData(y,k)),m.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(r,g),e.applyData(r,g)}function a3(e,r){const l={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}const Db=9,Lb=32;function o3(e){const r=String(e),l=/\r?\n|\r/g;let i=l.exec(r),o=0;const u=[];for(;i;)u.push(Bb(r.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=l.exec(r);return u.push(Bb(r.slice(o),o>0,!1)),u.join("")}function Bb(e,r,l){let i=0,o=e.length;if(r){let u=e.codePointAt(i);for(;u===Db||u===Lb;)i++,u=e.codePointAt(i)}if(l){let u=e.codePointAt(o-1);for(;u===Db||u===Lb;)o--,u=e.codePointAt(o-1)}return o>i?e.slice(i,o):""}function s3(e,r){const l={type:"text",value:o3(String(r.value))};return e.patch(r,l),e.applyData(r,l)}function u3(e,r){const l={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,l),e.applyData(r,l)}const c3={blockquote:HO,break:PO,code:qO,delete:FO,emphasis:VO,footnoteReference:IO,heading:GO,html:YO,imageReference:$O,image:XO,inlineCode:QO,linkReference:ZO,link:KO,listItem:JO,list:e3,paragraph:t3,root:n3,strong:r3,table:l3,tableCell:a3,tableRow:i3,text:s3,thematicBreak:u3,toml:Fs,yaml:Fs,definition:Fs,footnoteDefinition:Fs};function Fs(){}const Aw=-1,Uu=0,Ja=1,fu=2,om=3,sm=4,um=5,cm=6,jw=7,Tw=8,Ub=typeof self=="object"?self:globalThis,f3=(e,r)=>{const l=(o,u)=>(e.set(u,o),o),i=o=>{if(e.has(o))return e.get(o);const[u,c]=r[o];switch(u){case Uu:case Aw:return l(c,o);case Ja:{const f=l([],o);for(const d of c)f.push(i(d));return f}case fu:{const f=l({},o);for(const[d,m]of c)f[i(d)]=i(m);return f}case om:return l(new Date(c),o);case sm:{const{source:f,flags:d}=c;return l(new RegExp(f,d),o)}case um:{const f=l(new Map,o);for(const[d,m]of c)f.set(i(d),i(m));return f}case cm:{const f=l(new Set,o);for(const d of c)f.add(i(d));return f}case jw:{const{name:f,message:d}=c;return l(new Ub[f](d),o)}case Tw:return l(BigInt(c),o);case"BigInt":return l(Object(BigInt(c)),o);case"ArrayBuffer":return l(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return l(new DataView(f),c)}}return l(new Ub[u](c),o)};return i},Hb=e=>f3(new Map,e)(0),Ni="",{toString:d3}={},{keys:h3}=Object,Ga=e=>{const r=typeof e;if(r!=="object"||!e)return[Uu,r];const l=d3.call(e).slice(8,-1);switch(l){case"Array":return[Ja,Ni];case"Object":return[fu,Ni];case"Date":return[om,Ni];case"RegExp":return[sm,Ni];case"Map":return[um,Ni];case"Set":return[cm,Ni];case"DataView":return[Ja,l]}return l.includes("Array")?[Ja,l]:l.includes("Error")?[jw,l]:[fu,l]},Vs=([e,r])=>e===Uu&&(r==="function"||r==="symbol"),m3=(e,r,l,i)=>{const o=(c,f)=>{const d=i.push(c)-1;return l.set(f,d),d},u=c=>{if(l.has(c))return l.get(c);let[f,d]=Ga(c);switch(f){case Uu:{let g=c;switch(d){case"bigint":f=Tw,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return o([Aw],c)}return o([f,g],c)}case Ja:{if(d){let b=c;return d==="DataView"?b=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(b=new Uint8Array(c)),o([d,[...b]],c)}const g=[],y=o([f,g],c);for(const b of c)g.push(u(b));return y}case fu:{if(d)switch(d){case"BigInt":return o([d,c.toString()],c);case"Boolean":case"Number":case"String":return o([d,c.valueOf()],c)}if(r&&"toJSON"in c)return u(c.toJSON());const g=[],y=o([f,g],c);for(const b of h3(c))(e||!Vs(Ga(c[b])))&&g.push([u(b),u(c[b])]);return y}case om:return o([f,c.toISOString()],c);case sm:{const{source:g,flags:y}=c;return o([f,{source:g,flags:y}],c)}case um:{const g=[],y=o([f,g],c);for(const[b,v]of c)(e||!(Vs(Ga(b))||Vs(Ga(v))))&&g.push([u(b),u(v)]);return y}case cm:{const g=[],y=o([f,g],c);for(const b of c)(e||!Vs(Ga(b)))&&g.push(u(b));return y}}const{message:m}=c;return o([f,{name:d,message:m}],c)};return u},Pb=(e,{json:r,lossy:l}={})=>{const i=[];return m3(!(r||l),!!r,new Map,i)(e),i},du=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Hb(Pb(e,r)):structuredClone(e):(e,r)=>Hb(Pb(e,r));function p3(e,r){const l=[{type:"text",value:"↩"}];return r>1&&l.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),l}function g3(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function y3(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=e.options.footnoteBackContent||p3,i=e.options.footnoteBackLabel||g3,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const g=e.all(m),y=String(m.identifier).toUpperCase(),b=Vi(y.toLowerCase());let v=0;const k=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++v<=C;){k.length>0&&k.push({type:"text",value:" "});let O=typeof l=="string"?l:l(d,v);typeof O=="string"&&(O={type:"text",value:O}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(d,v),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const A=g[g.length-1];if(A&&A.type==="element"&&A.tagName==="p"){const O=A.children[A.children.length-1];O&&O.type==="text"?O.value+=" ":A.children.push({type:"text",value:" "}),A.children.push(...k)}else g.push(...k);const N={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(m,N),f.push(N)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...du(c),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
392
392
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
393
- `}]}}const Hu=(function(e){if(e==null)return x3;if(typeof e=="function")return Pu(e);if(typeof e=="object")return Array.isArray(e)?p3(e):g3(e);if(typeof e=="string")return y3(e);throw new Error("Expected function, string, or object as test")});function p3(e){const r=[];let l=-1;for(;++l<e.length;)r[l]=Hu(e[l]);return Pu(i);function i(...o){let u=-1;for(;++u<r.length;)if(r[u].apply(this,o))return!0;return!1}}function g3(e){const r=e;return Pu(l);function l(i){const o=i;let u;for(u in e)if(o[u]!==r[u])return!1;return!0}}function y3(e){return Pu(r);function r(l){return l&&l.type===e}}function Pu(e){return r;function r(l,i,o){return!!(b3(l)&&e.call(this,l,typeof i=="number"?i:void 0,o||void 0))}}function x3(){return!0}function b3(e){return e!==null&&typeof e=="object"&&"type"in e}const _w=[],v3=!0,ch=!1,w3="skip";function Rw(e,r,l,i){let o;typeof r=="function"&&typeof l!="function"?(i=l,l=r):o=r;const u=Hu(o),c=i?-1:1;f(e,void 0,[])();function f(d,m,g){const y=d&&typeof d=="object"?d:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=_w,k,C,A;if((!r||u(d,m,g[g.length-1]||void 0))&&(v=S3(l(d,g)),v[0]===ch))return v;if("children"in d&&d.children){const N=d;if(N.children&&v[0]!==w3)for(C=(i?N.children.length:-1)+c,A=g.concat(N);C>-1&&C<N.children.length;){const O=N.children[C];if(k=f(O,C,A)(),k[0]===ch)return k;C=typeof k[1]=="number"?k[1]:C+c}}return v}}}function S3(e){return Array.isArray(e)?e:typeof e=="number"?[v3,e]:e==null?_w:[e]}function fm(e,r,l,i){let o,u,c;typeof r=="function"&&typeof l!="function"?(u=void 0,c=r,o=l):(u=r,c=l,o=i),Rw(e,u,f,o);function f(d,m){const g=m[m.length-1],y=g?g.children.indexOf(d):void 0;return c(d,y,g)}}const fh={}.hasOwnProperty,k3={};function C3(e,r){const l=r||k3,i=new Map,o=new Map,u=new Map,c={...o3,...l.handlers},f={all:m,applyData:N3,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:c,one:d,options:l,patch:E3,wrap:j3};return fm(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),f;function d(g,y){const b=g.type,v=f.handlers[b];if(fh.call(f.handlers,b)&&v)return v(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:C,...A}=g,N=du(A);return N.children=f.all(g),N}return du(g)}return(f.options.unknownHandler||A3)(f,g,y)}function m(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const k=f.one(b[v],g);if(k){if(v&&b[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=qb(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=qb(C.value))}Array.isArray(k)?y.push(...k):y.push(k)}}}return y}}function E3(e,r){e.position&&(r.position=h4(e))}function N3(e,r){let l=r;if(e&&e.data){const i=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(l.type==="element")l.tagName=i;else{const c="children"in l?l.children:[l];l={type:"element",tagName:i,properties:{},children:c}}l.type==="element"&&u&&Object.assign(l.properties,du(u)),"children"in l&&l.children&&o!==null&&o!==void 0&&(l.children=o)}return l}function A3(e,r){const l=r.data||{},i="value"in r&&!(fh.call(l,"hProperties")||fh.call(l,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function j3(e,r){const l=[];let i=-1;for(r&&l.push({type:"text",value:`
393
+ `}]}}const Hu=(function(e){if(e==null)return w3;if(typeof e=="function")return Pu(e);if(typeof e=="object")return Array.isArray(e)?x3(e):b3(e);if(typeof e=="string")return v3(e);throw new Error("Expected function, string, or object as test")});function x3(e){const r=[];let l=-1;for(;++l<e.length;)r[l]=Hu(e[l]);return Pu(i);function i(...o){let u=-1;for(;++u<r.length;)if(r[u].apply(this,o))return!0;return!1}}function b3(e){const r=e;return Pu(l);function l(i){const o=i;let u;for(u in e)if(o[u]!==r[u])return!1;return!0}}function v3(e){return Pu(r);function r(l){return l&&l.type===e}}function Pu(e){return r;function r(l,i,o){return!!(S3(l)&&e.call(this,l,typeof i=="number"?i:void 0,o||void 0))}}function w3(){return!0}function S3(e){return e!==null&&typeof e=="object"&&"type"in e}const _w=[],k3=!0,ch=!1,C3="skip";function Rw(e,r,l,i){let o;typeof r=="function"&&typeof l!="function"?(i=l,l=r):o=r;const u=Hu(o),c=i?-1:1;f(e,void 0,[])();function f(d,m,g){const y=d&&typeof d=="object"?d:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=_w,k,C,A;if((!r||u(d,m,g[g.length-1]||void 0))&&(v=E3(l(d,g)),v[0]===ch))return v;if("children"in d&&d.children){const N=d;if(N.children&&v[0]!==C3)for(C=(i?N.children.length:-1)+c,A=g.concat(N);C>-1&&C<N.children.length;){const O=N.children[C];if(k=f(O,C,A)(),k[0]===ch)return k;C=typeof k[1]=="number"?k[1]:C+c}}return v}}}function E3(e){return Array.isArray(e)?e:typeof e=="number"?[k3,e]:e==null?_w:[e]}function fm(e,r,l,i){let o,u,c;typeof r=="function"&&typeof l!="function"?(u=void 0,c=r,o=l):(u=r,c=l,o=i),Rw(e,u,f,o);function f(d,m){const g=m[m.length-1],y=g?g.children.indexOf(d):void 0;return c(d,y,g)}}const fh={}.hasOwnProperty,N3={};function A3(e,r){const l=r||N3,i=new Map,o=new Map,u=new Map,c={...c3,...l.handlers},f={all:m,applyData:T3,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:c,one:d,options:l,patch:j3,wrap:R3};return fm(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),f;function d(g,y){const b=g.type,v=f.handlers[b];if(fh.call(f.handlers,b)&&v)return v(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:C,...A}=g,N=du(A);return N.children=f.all(g),N}return du(g)}return(f.options.unknownHandler||_3)(f,g,y)}function m(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const k=f.one(b[v],g);if(k){if(v&&b[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=qb(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=qb(C.value))}Array.isArray(k)?y.push(...k):y.push(k)}}}return y}}function j3(e,r){e.position&&(r.position=g4(e))}function T3(e,r){let l=r;if(e&&e.data){const i=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(l.type==="element")l.tagName=i;else{const c="children"in l?l.children:[l];l={type:"element",tagName:i,properties:{},children:c}}l.type==="element"&&u&&Object.assign(l.properties,du(u)),"children"in l&&l.children&&o!==null&&o!==void 0&&(l.children=o)}return l}function _3(e,r){const l=r.data||{},i="value"in r&&!(fh.call(l,"hProperties")||fh.call(l,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function R3(e,r){const l=[];let i=-1;for(r&&l.push({type:"text",value:`
394
394
  `});++i<e.length;)i&&l.push({type:"text",value:`
395
395
  `}),l.push(e[i]);return r&&e.length>0&&l.push({type:"text",value:`
396
- `}),l}function qb(e){let r=0,l=e.charCodeAt(r);for(;l===9||l===32;)r++,l=e.charCodeAt(r);return e.slice(r)}function Fb(e,r){const l=C3(e,r),i=l.one(e,void 0),o=m3(l),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
397
- `},o),u}function T3(e,r){return e&&"run"in e?async function(l,i){const o=Fb(l,{file:i,...r});await e.run(o,i)}:function(l,i){return Fb(l,{file:i,...e||r})}}function Vb(e){if(e)throw e}var Ad,Ib;function _3(){if(Ib)return Ad;Ib=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,l=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):r.call(m)==="[object Array]"},u=function(m){if(!m||r.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!y)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},c=function(m,g){l&&g.name==="__proto__"?l(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},f=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(i)return i(m,g).value}else return;return m[g]};return Ad=function d(){var m,g,y,b,v,k,C=arguments[0],A=1,N=arguments.length,O=!1;for(typeof C=="boolean"&&(O=C,C=arguments[1]||{},A=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});A<N;++A)if(m=arguments[A],m!=null)for(g in m)y=f(C,g),b=f(m,g),C!==b&&(O&&b&&(u(b)||(v=o(b)))?(v?(v=!1,k=y&&o(y)?y:[]):k=y&&u(y)?y:{},c(C,{name:g,newValue:d(O,k,b)})):typeof b<"u"&&c(C,{name:g,newValue:b}));return C},Ad}var R3=_3();const jd=pu(R3);function dh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function M3(){const e=[],r={run:l,use:i};return r;function l(...o){let u=-1;const c=o.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...o);function f(d,...m){const g=e[++u];let y=-1;if(d){c(d);return}for(;++y<o.length;)(m[y]===null||m[y]===void 0)&&(m[y]=o[y]);o=m,g?O3(g,f)(...m):c(null,...m)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),r}}function O3(e,r){let l;return i;function i(...c){const f=e.length>c.length;let d;f&&c.push(o);try{d=e.apply(this,c)}catch(m){const g=m;if(f&&l)throw g;return o(g)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,o):d instanceof Error?o(d):u(d))}function o(c,...f){l||(l=!0,r(c,...f))}function u(c){o(null,c)}}const Ln={basename:z3,dirname:D3,extname:L3,join:B3,sep:"/"};function z3(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');po(e);let l=0,i=-1,o=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){l=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":e.slice(l,i)}if(r===e)return"";let c=-1,f=r.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){l=o+1;break}}else c<0&&(u=!0,c=o+1),f>-1&&(e.codePointAt(o)===r.codePointAt(f--)?f<0&&(i=o):(f=-1,i=c));return l===i?i=c:i<0&&(i=e.length),e.slice(l,i)}function D3(e){if(po(e),e.length===0)return".";let r=-1,l=e.length,i;for(;--l;)if(e.codePointAt(l)===47){if(i){r=l;break}}else i||(i=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function L3(e){po(e);let r=e.length,l=-1,i=0,o=-1,u=0,c;for(;r--;){const f=e.codePointAt(r);if(f===47){if(c){i=r+1;break}continue}l<0&&(c=!0,l=r+1),f===46?o<0?o=r:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||l<0||u===0||u===1&&o===l-1&&o===i+1?"":e.slice(o,l)}function B3(...e){let r=-1,l;for(;++r<e.length;)po(e[r]),e[r]&&(l=l===void 0?e[r]:l+"/"+e[r]);return l===void 0?".":U3(l)}function U3(e){po(e);const r=e.codePointAt(0)===47;let l=H3(e,!r);return l.length===0&&!r&&(l="."),l.length>0&&e.codePointAt(e.length-1)===47&&(l+="/"),r?"/"+l:l}function H3(e,r){let l="",i=0,o=-1,u=0,c=-1,f,d;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(o===c-1||u===1))if(o!==c-1&&u===2){if(l.length<2||i!==2||l.codePointAt(l.length-1)!==46||l.codePointAt(l.length-2)!==46){if(l.length>2){if(d=l.lastIndexOf("/"),d!==l.length-1){d<0?(l="",i=0):(l=l.slice(0,d),i=l.length-1-l.lastIndexOf("/")),o=c,u=0;continue}}else if(l.length>0){l="",i=0,o=c,u=0;continue}}r&&(l=l.length>0?l+"/..":"..",i=2)}else l.length>0?l+="/"+e.slice(o+1,c):l=e.slice(o+1,c),i=c-o-1;o=c,u=0}else f===46&&u>-1?u++:u=-1}return l}function po(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const P3={cwd:q3};function q3(){return"/"}function hh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function F3(e){if(typeof e=="string")e=new URL(e);else if(!hh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return V3(e)}function V3(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const r=e.pathname;let l=-1;for(;++l<r.length;)if(r.codePointAt(l)===37&&r.codePointAt(l+1)===50){const i=r.codePointAt(l+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(r)}const Td=["history","path","basename","stem","extname","dirname"];class Mw{constructor(r){let l;r?hh(r)?l={path:r}:typeof r=="string"||I3(r)?l={value:r}:l=r:l={},this.cwd="cwd"in l?"":P3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Td.length;){const u=Td[i];u in l&&l[u]!==void 0&&l[u]!==null&&(this[u]=u==="history"?[...l[u]]:l[u])}let o;for(o in l)Td.includes(o)||(this[o]=l[o])}get basename(){return typeof this.path=="string"?Ln.basename(this.path):void 0}set basename(r){Rd(r,"basename"),_d(r,"basename"),this.path=Ln.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Ln.dirname(this.path):void 0}set dirname(r){Gb(this.basename,"dirname"),this.path=Ln.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Ln.extname(this.path):void 0}set extname(r){if(_d(r,"extname"),Gb(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ln.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){hh(r)&&(r=F3(r)),Rd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Ln.basename(this.path,this.extname):void 0}set stem(r){Rd(r,"stem"),_d(r,"stem"),this.path=Ln.join(this.dirname||"",r+(this.extname||""))}fail(r,l,i){const o=this.message(r,l,i);throw o.fatal=!0,o}info(r,l,i){const o=this.message(r,l,i);return o.fatal=void 0,o}message(r,l,i){const o=new Rt(r,l,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function _d(e,r){if(e&&e.includes(Ln.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Ln.sep+"`")}function Rd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Gb(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function I3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const G3=(function(e){const i=this.constructor.prototype,o=i[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),Y3={}.hasOwnProperty;class dm extends G3{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=M3()}copy(){const r=new dm;let l=-1;for(;++l<this.attachers.length;){const i=this.attachers[l];r.use(...i)}return r.data(jd(!0,{},this.namespace)),r}data(r,l){return typeof r=="string"?arguments.length===2?(zd("data",this.frozen),this.namespace[r]=l,this):Y3.call(this.namespace,r)&&this.namespace[r]||void 0:r?(zd("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[l,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=l.call(r,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const l=Is(r),i=this.parser||this.Parser;return Md("parse",i),i(String(l),l)}process(r,l){const i=this;return this.freeze(),Md("process",this.parser||this.Parser),Od("process",this.compiler||this.Compiler),l?o(void 0,l):new Promise(o);function o(u,c){const f=Is(r),d=i.parse(f);i.run(d,f,function(g,y,b){if(g||!y||!b)return m(g);const v=y,k=i.stringify(v,b);Q3(k)?b.value=k:b.result=k,m(g,b)});function m(g,y){g||!y?c(g):u?u(y):l(void 0,y)}}}processSync(r){let l=!1,i;return this.freeze(),Md("processSync",this.parser||this.Parser),Od("processSync",this.compiler||this.Compiler),this.process(r,o),$b("processSync","process",l),i;function o(u,c){l=!0,Vb(u),i=c}}run(r,l,i){Yb(r),this.freeze();const o=this.transformers;return!i&&typeof l=="function"&&(i=l,l=void 0),i?u(void 0,i):new Promise(u);function u(c,f){const d=Is(l);o.run(r,d,m);function m(g,y,b){const v=y||r;g?f(g):c?c(v):i(void 0,v,b)}}}runSync(r,l){let i=!1,o;return this.run(r,l,u),$b("runSync","run",i),o;function u(c,f){Vb(c),o=f,i=!0}}stringify(r,l){this.freeze();const i=Is(l),o=this.compiler||this.Compiler;return Od("stringify",o),Yb(r),o(r,i)}use(r,...l){const i=this.attachers,o=this.namespace;if(zd("use",this.frozen),r!=null)if(typeof r=="function")d(r,l);else if(typeof r=="object")Array.isArray(r)?f(r):c(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[g,...y]=m;d(g,y)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))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");f(m.plugins),m.settings&&(o.settings=jd(!0,o.settings,m.settings))}function f(m){let g=-1;if(m!=null)if(Array.isArray(m))for(;++g<m.length;){const y=m[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===m){b=y;break}if(b===-1)i.push([m,...g]);else if(g.length>0){let[v,...k]=g;const C=i[b][1];dh(C)&&dh(v)&&(v=jd(!0,C,v)),i[b]=[m,v,...k]}}}}const $3=new dm().freeze();function Md(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Od(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zd(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yb(e){if(!dh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $b(e,r,l){if(!l)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Is(e){return X3(e)?e:new Mw(e)}function X3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Q3(e){return typeof e=="string"||Z3(e)}function Z3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const K3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Xb=[],Qb={allowDangerousHtml:!0},J3=/^(https?|ircs?|mailto|xmpp)$/i,W3=[{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 Li(e){const r=e5(e),l=t5(e);return n5(r.runSync(r.parse(l),l),e)}function e5(e){const r=e.rehypePlugins||Xb,l=e.remarkPlugins||Xb,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qb}:Qb;return $3().use(DO).use(l).use(T3,i).use(r)}function t5(e){const r=e.children||"",l=new Mw;return typeof r=="string"&&(l.value=r),l}function n5(e,r){const l=r.allowedElements,i=r.allowElement,o=r.components,u=r.disallowedElements,c=r.skipHtml,f=r.unwrapDisallowed,d=r.urlTransform||r5;for(const g of W3)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+K3+g.id,void 0);return fm(e,m),x4(e,{Fragment:x.Fragment,components:o,ignoreInvalidStyle:!0,jsx:x.jsx,jsxs:x.jsxs,passKeys:!0,passNode:!0});function m(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return c?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Cd)if(Object.hasOwn(Cd,v)&&Object.hasOwn(g.properties,v)){const k=g.properties[v],C=Cd[v];(C===null||C.includes(g.tagName))&&(g.properties[v]=d(String(k||""),v,g))}}if(g.type==="element"){let v=l?!l.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return f&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function r5(e){const r=e.indexOf(":"),l=e.indexOf("?"),i=e.indexOf("#"),o=e.indexOf("/");return r===-1||o!==-1&&r>o||l!==-1&&r>l||i!==-1&&r>i||J3.test(e.slice(0,r))?e:""}function Zb(e,r){const l=String(e);if(typeof r!="string")throw new TypeError("Expected character");let i=0,o=l.indexOf(r);for(;o!==-1;)i++,o=l.indexOf(r,o+r.length);return i}function l5(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function i5(e,r,l){const o=Hu((l||{}).ignore||[]),u=a5(r);let c=-1;for(;++c<u.length;)Rw(e,"text",f);function f(m,g){let y=-1,b;for(;++y<g.length;){const v=g[y],k=b?b.children:void 0;if(o(v,k?k.indexOf(v):void 0,b))return;b=v}if(b)return d(m,g)}function d(m,g){const y=g[g.length-1],b=u[c][0],v=u[c][1];let k=0;const A=y.children.indexOf(m);let N=!1,O=[];b.lastIndex=0;let _=b.exec(m.value);for(;_;){const U=_.index,F={index:_.index,input:_.input,stack:[...g,m]};let z=v(..._,F);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=U+1:(k!==U&&O.push({type:"text",value:m.value.slice(k,U)}),Array.isArray(z)?O.push(...z):z&&O.push(z),k=U+_[0].length,N=!0),!b.global)break;_=b.exec(m.value)}return N?(k<m.value.length&&O.push({type:"text",value:m.value.slice(k)}),y.children.splice(A,1,...O)):O=[m],A+O.length}}function a5(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const l=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<l.length;){const o=l[i];r.push([o5(o[0]),s5(o[1])])}return r}function o5(e){return typeof e=="string"?new RegExp(l5(e),"g"):e}function s5(e){return typeof e=="function"?e:function(){return e}}const Dd="phrasing",Ld=["autolink","link","image","label"];function u5(){return{transforms:[g5],enter:{literalAutolink:f5,literalAutolinkEmail:Bd,literalAutolinkHttp:Bd,literalAutolinkWww:Bd},exit:{literalAutolink:p5,literalAutolinkEmail:m5,literalAutolinkHttp:d5,literalAutolinkWww:h5}}}function c5(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:":",before:"[ps]",after:"\\/",inConstruct:Dd,notInConstruct:Ld}]}}function f5(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Bd(e){this.config.enter.autolinkProtocol.call(this,e)}function d5(e){this.config.exit.autolinkProtocol.call(this,e)}function h5(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function m5(e){this.config.exit.autolinkEmail.call(this,e)}function p5(e){this.exit(e)}function g5(e){i5(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,y5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),x5]],{ignore:["link","linkReference"]})}function y5(e,r,l,i,o){let u="";if(!Ow(o)||(/^w/i.test(r)&&(l=r+l,r="",u="http://"),!b5(l)))return!1;const c=v5(l+i);if(!c[0])return!1;const f={type:"link",title:null,url:u+r+c[0],children:[{type:"text",value:r+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function x5(e,r,l,i){return!Ow(i,!0)||/[-\d_]$/.test(l)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+l,children:[{type:"text",value:r+"@"+l}]}}function b5(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function v5(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let l=r[0],i=l.indexOf(")");const o=Zb(e,"(");let u=Zb(e,")");for(;i!==-1&&o>u;)e+=l.slice(0,i+1),l=l.slice(i+1),i=l.indexOf(")"),u++;return[e,l]}function Ow(e,r){const l=e.input.charCodeAt(e.index-1);return(e.index===0||Ml(l)||Lu(l))&&(!r||l!==47)}zw.peek=T5;function w5(){this.buffer()}function S5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k5(){this.buffer()}function C5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function E5(e){const r=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=kn(this.sliceSerialize(e)).toLowerCase(),l.label=r}function N5(e){this.exit(e)}function A5(e){const r=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=kn(this.sliceSerialize(e)).toLowerCase(),l.label=r}function j5(e){this.exit(e)}function T5(){return"["}function zw(e,r,l,i){const o=l.createTracker(i);let u=o.move("[^");const c=l.enter("footnoteReference"),f=l.enter("reference");return u+=o.move(l.safe(l.associationId(e),{after:"]",before:u})),f(),c(),u+=o.move("]"),u}function _5(){return{enter:{gfmFootnoteCallString:w5,gfmFootnoteCall:S5,gfmFootnoteDefinitionLabelString:k5,gfmFootnoteDefinition:C5},exit:{gfmFootnoteCallString:E5,gfmFootnoteCall:N5,gfmFootnoteDefinitionLabelString:A5,gfmFootnoteDefinition:j5}}}function R5(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:l,footnoteReference:zw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function l(i,o,u,c){const f=u.createTracker(c);let d=f.move("[^");const m=u.enter("footnoteDefinition"),g=u.enter("label");return d+=f.move(u.safe(u.associationId(i),{before:d,after:"]"})),g(),d+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),d+=f.move((r?`
398
- `:" ")+u.indentLines(u.containerFlow(i,f.current()),r?Dw:M5))),m(),d}}function M5(e,r,l){return r===0?e:Dw(e,r,l)}function Dw(e,r,l){return(l?"":" ")+e}const O5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Lw.peek=U5;function z5(){return{canContainEols:["delete"],enter:{strikethrough:L5},exit:{strikethrough:B5}}}function D5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:O5}],handlers:{delete:Lw}}}function L5(e){this.enter({type:"delete",children:[]},e)}function B5(e){this.exit(e)}function Lw(e,r,l,i){const o=l.createTracker(i),u=l.enter("strikethrough");let c=o.move("~~");return c+=l.containerPhrasing(e,{...o.current(),before:c,after:"~"}),c+=o.move("~~"),u(),c}function U5(){return"~"}function H5(e){return e.length}function P5(e,r){const l=r||{},i=(l.align||[]).concat(),o=l.stringLength||H5,u=[],c=[],f=[],d=[];let m=0,g=-1;for(;++g<e.length;){const C=[],A=[];let N=-1;for(e[g].length>m&&(m=e[g].length);++N<e[g].length;){const O=q5(e[g][N]);if(l.alignDelimiters!==!1){const _=o(O);A[N]=_,(d[N]===void 0||_>d[N])&&(d[N]=_)}C.push(O)}c[g]=C,f[g]=A}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<m;)u[y]=Kb(i[y]);else{const C=Kb(i);for(;++y<m;)u[y]=C}y=-1;const b=[],v=[];for(;++y<m;){const C=u[y];let A="",N="";C===99?(A=":",N=":"):C===108?A=":":C===114&&(N=":");let O=l.alignDelimiters===!1?1:Math.max(1,d[y]-A.length-N.length);const _=A+"-".repeat(O)+N;l.alignDelimiters!==!1&&(O=A.length+O+N.length,O>d[y]&&(d[y]=O),v[y]=O),b[y]=_}c.splice(1,0,b),f.splice(1,0,v),g=-1;const k=[];for(;++g<c.length;){const C=c[g],A=f[g];y=-1;const N=[];for(;++y<m;){const O=C[y]||"";let _="",U="";if(l.alignDelimiters!==!1){const F=d[y]-(A[y]||0),z=u[y];z===114?_=" ".repeat(F):z===99?F%2?(_=" ".repeat(F/2+.5),U=" ".repeat(F/2-.5)):(_=" ".repeat(F/2),U=_):U=" ".repeat(F)}l.delimiterStart!==!1&&!y&&N.push("|"),l.padding!==!1&&!(l.alignDelimiters===!1&&O==="")&&(l.delimiterStart!==!1||y)&&N.push(" "),l.alignDelimiters!==!1&&N.push(_),N.push(O),l.alignDelimiters!==!1&&N.push(U),l.padding!==!1&&N.push(" "),(l.delimiterEnd!==!1||y!==m-1)&&N.push("|")}k.push(l.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return k.join(`
399
- `)}function q5(e){return e==null?"":String(e)}function Kb(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function F5(e,r,l,i){const o=l.enter("blockquote"),u=l.createTracker(i);u.move("> "),u.shift(2);const c=l.indentLines(l.containerFlow(e,u.current()),V5);return o(),c}function V5(e,r,l){return">"+(l?"":" ")+e}function I5(e,r){return Jb(e,r.inConstruct,!0)&&!Jb(e,r.notInConstruct,!1)}function Jb(e,r,l){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return l;let i=-1;for(;++i<r.length;)if(e.includes(r[i]))return!0;return!1}function Wb(e,r,l,i){let o=-1;for(;++o<l.unsafe.length;)if(l.unsafe[o].character===`
400
- `&&I5(l.stack,l.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
401
- `}function G5(e,r){const l=String(e);let i=l.indexOf(r),o=i,u=0,c=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>c&&(c=u):u=1,o=i+r.length,i=l.indexOf(r,o);return c}function Y5(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function $5(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function X5(e,r,l,i){const o=$5(l),u=e.value||"",c=o==="`"?"GraveAccent":"Tilde";if(Y5(e,l)){const y=l.enter("codeIndented"),b=l.indentLines(u,Q5);return y(),b}const f=l.createTracker(i),d=o.repeat(Math.max(G5(u,o)+1,3)),m=l.enter("codeFenced");let g=f.move(d);if(e.lang){const y=l.enter(`codeFencedLang${c}`);g+=f.move(l.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=l.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(l.safe(e.meta,{before:g,after:`
396
+ `}),l}function qb(e){let r=0,l=e.charCodeAt(r);for(;l===9||l===32;)r++,l=e.charCodeAt(r);return e.slice(r)}function Fb(e,r){const l=A3(e,r),i=l.one(e,void 0),o=y3(l),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
397
+ `},o),u}function M3(e,r){return e&&"run"in e?async function(l,i){const o=Fb(l,{file:i,...r});await e.run(o,i)}:function(l,i){return Fb(l,{file:i,...e||r})}}function Vb(e){if(e)throw e}var Ad,Ib;function O3(){if(Ib)return Ad;Ib=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,l=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):r.call(m)==="[object Array]"},u=function(m){if(!m||r.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!y)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},c=function(m,g){l&&g.name==="__proto__"?l(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},f=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(i)return i(m,g).value}else return;return m[g]};return Ad=function d(){var m,g,y,b,v,k,C=arguments[0],A=1,N=arguments.length,O=!1;for(typeof C=="boolean"&&(O=C,C=arguments[1]||{},A=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});A<N;++A)if(m=arguments[A],m!=null)for(g in m)y=f(C,g),b=f(m,g),C!==b&&(O&&b&&(u(b)||(v=o(b)))?(v?(v=!1,k=y&&o(y)?y:[]):k=y&&u(y)?y:{},c(C,{name:g,newValue:d(O,k,b)})):typeof b<"u"&&c(C,{name:g,newValue:b}));return C},Ad}var z3=O3();const jd=pu(z3);function dh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function D3(){const e=[],r={run:l,use:i};return r;function l(...o){let u=-1;const c=o.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...o);function f(d,...m){const g=e[++u];let y=-1;if(d){c(d);return}for(;++y<o.length;)(m[y]===null||m[y]===void 0)&&(m[y]=o[y]);o=m,g?L3(g,f)(...m):c(null,...m)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),r}}function L3(e,r){let l;return i;function i(...c){const f=e.length>c.length;let d;f&&c.push(o);try{d=e.apply(this,c)}catch(m){const g=m;if(f&&l)throw g;return o(g)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,o):d instanceof Error?o(d):u(d))}function o(c,...f){l||(l=!0,r(c,...f))}function u(c){o(null,c)}}const Ln={basename:B3,dirname:U3,extname:H3,join:P3,sep:"/"};function B3(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');po(e);let l=0,i=-1,o=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){l=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":e.slice(l,i)}if(r===e)return"";let c=-1,f=r.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){l=o+1;break}}else c<0&&(u=!0,c=o+1),f>-1&&(e.codePointAt(o)===r.codePointAt(f--)?f<0&&(i=o):(f=-1,i=c));return l===i?i=c:i<0&&(i=e.length),e.slice(l,i)}function U3(e){if(po(e),e.length===0)return".";let r=-1,l=e.length,i;for(;--l;)if(e.codePointAt(l)===47){if(i){r=l;break}}else i||(i=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function H3(e){po(e);let r=e.length,l=-1,i=0,o=-1,u=0,c;for(;r--;){const f=e.codePointAt(r);if(f===47){if(c){i=r+1;break}continue}l<0&&(c=!0,l=r+1),f===46?o<0?o=r:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||l<0||u===0||u===1&&o===l-1&&o===i+1?"":e.slice(o,l)}function P3(...e){let r=-1,l;for(;++r<e.length;)po(e[r]),e[r]&&(l=l===void 0?e[r]:l+"/"+e[r]);return l===void 0?".":q3(l)}function q3(e){po(e);const r=e.codePointAt(0)===47;let l=F3(e,!r);return l.length===0&&!r&&(l="."),l.length>0&&e.codePointAt(e.length-1)===47&&(l+="/"),r?"/"+l:l}function F3(e,r){let l="",i=0,o=-1,u=0,c=-1,f,d;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(o===c-1||u===1))if(o!==c-1&&u===2){if(l.length<2||i!==2||l.codePointAt(l.length-1)!==46||l.codePointAt(l.length-2)!==46){if(l.length>2){if(d=l.lastIndexOf("/"),d!==l.length-1){d<0?(l="",i=0):(l=l.slice(0,d),i=l.length-1-l.lastIndexOf("/")),o=c,u=0;continue}}else if(l.length>0){l="",i=0,o=c,u=0;continue}}r&&(l=l.length>0?l+"/..":"..",i=2)}else l.length>0?l+="/"+e.slice(o+1,c):l=e.slice(o+1,c),i=c-o-1;o=c,u=0}else f===46&&u>-1?u++:u=-1}return l}function po(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const V3={cwd:I3};function I3(){return"/"}function hh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function G3(e){if(typeof e=="string")e=new URL(e);else if(!hh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Y3(e)}function Y3(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const r=e.pathname;let l=-1;for(;++l<r.length;)if(r.codePointAt(l)===37&&r.codePointAt(l+1)===50){const i=r.codePointAt(l+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(r)}const Td=["history","path","basename","stem","extname","dirname"];class Mw{constructor(r){let l;r?hh(r)?l={path:r}:typeof r=="string"||$3(r)?l={value:r}:l=r:l={},this.cwd="cwd"in l?"":V3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Td.length;){const u=Td[i];u in l&&l[u]!==void 0&&l[u]!==null&&(this[u]=u==="history"?[...l[u]]:l[u])}let o;for(o in l)Td.includes(o)||(this[o]=l[o])}get basename(){return typeof this.path=="string"?Ln.basename(this.path):void 0}set basename(r){Rd(r,"basename"),_d(r,"basename"),this.path=Ln.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Ln.dirname(this.path):void 0}set dirname(r){Gb(this.basename,"dirname"),this.path=Ln.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Ln.extname(this.path):void 0}set extname(r){if(_d(r,"extname"),Gb(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ln.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){hh(r)&&(r=G3(r)),Rd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Ln.basename(this.path,this.extname):void 0}set stem(r){Rd(r,"stem"),_d(r,"stem"),this.path=Ln.join(this.dirname||"",r+(this.extname||""))}fail(r,l,i){const o=this.message(r,l,i);throw o.fatal=!0,o}info(r,l,i){const o=this.message(r,l,i);return o.fatal=void 0,o}message(r,l,i){const o=new Rt(r,l,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function _d(e,r){if(e&&e.includes(Ln.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Ln.sep+"`")}function Rd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Gb(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function $3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const X3=(function(e){const i=this.constructor.prototype,o=i[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),Q3={}.hasOwnProperty;class dm extends X3{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=D3()}copy(){const r=new dm;let l=-1;for(;++l<this.attachers.length;){const i=this.attachers[l];r.use(...i)}return r.data(jd(!0,{},this.namespace)),r}data(r,l){return typeof r=="string"?arguments.length===2?(zd("data",this.frozen),this.namespace[r]=l,this):Q3.call(this.namespace,r)&&this.namespace[r]||void 0:r?(zd("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[l,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=l.call(r,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const l=Is(r),i=this.parser||this.Parser;return Md("parse",i),i(String(l),l)}process(r,l){const i=this;return this.freeze(),Md("process",this.parser||this.Parser),Od("process",this.compiler||this.Compiler),l?o(void 0,l):new Promise(o);function o(u,c){const f=Is(r),d=i.parse(f);i.run(d,f,function(g,y,b){if(g||!y||!b)return m(g);const v=y,k=i.stringify(v,b);J3(k)?b.value=k:b.result=k,m(g,b)});function m(g,y){g||!y?c(g):u?u(y):l(void 0,y)}}}processSync(r){let l=!1,i;return this.freeze(),Md("processSync",this.parser||this.Parser),Od("processSync",this.compiler||this.Compiler),this.process(r,o),$b("processSync","process",l),i;function o(u,c){l=!0,Vb(u),i=c}}run(r,l,i){Yb(r),this.freeze();const o=this.transformers;return!i&&typeof l=="function"&&(i=l,l=void 0),i?u(void 0,i):new Promise(u);function u(c,f){const d=Is(l);o.run(r,d,m);function m(g,y,b){const v=y||r;g?f(g):c?c(v):i(void 0,v,b)}}}runSync(r,l){let i=!1,o;return this.run(r,l,u),$b("runSync","run",i),o;function u(c,f){Vb(c),o=f,i=!0}}stringify(r,l){this.freeze();const i=Is(l),o=this.compiler||this.Compiler;return Od("stringify",o),Yb(r),o(r,i)}use(r,...l){const i=this.attachers,o=this.namespace;if(zd("use",this.frozen),r!=null)if(typeof r=="function")d(r,l);else if(typeof r=="object")Array.isArray(r)?f(r):c(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[g,...y]=m;d(g,y)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))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");f(m.plugins),m.settings&&(o.settings=jd(!0,o.settings,m.settings))}function f(m){let g=-1;if(m!=null)if(Array.isArray(m))for(;++g<m.length;){const y=m[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===m){b=y;break}if(b===-1)i.push([m,...g]);else if(g.length>0){let[v,...k]=g;const C=i[b][1];dh(C)&&dh(v)&&(v=jd(!0,C,v)),i[b]=[m,v,...k]}}}}const Z3=new dm().freeze();function Md(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Od(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zd(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yb(e){if(!dh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $b(e,r,l){if(!l)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Is(e){return K3(e)?e:new Mw(e)}function K3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function J3(e){return typeof e=="string"||W3(e)}function W3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Xb=[],Qb={allowDangerousHtml:!0},t5=/^(https?|ircs?|mailto|xmpp)$/i,n5=[{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 Li(e){const r=r5(e),l=l5(e);return i5(r.runSync(r.parse(l),l),e)}function r5(e){const r=e.rehypePlugins||Xb,l=e.remarkPlugins||Xb,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qb}:Qb;return Z3().use(UO).use(l).use(M3,i).use(r)}function l5(e){const r=e.children||"",l=new Mw;return typeof r=="string"&&(l.value=r),l}function i5(e,r){const l=r.allowedElements,i=r.allowElement,o=r.components,u=r.disallowedElements,c=r.skipHtml,f=r.unwrapDisallowed,d=r.urlTransform||a5;for(const g of n5)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+e5+g.id,void 0);return fm(e,m),w4(e,{Fragment:x.Fragment,components:o,ignoreInvalidStyle:!0,jsx:x.jsx,jsxs:x.jsxs,passKeys:!0,passNode:!0});function m(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return c?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Cd)if(Object.hasOwn(Cd,v)&&Object.hasOwn(g.properties,v)){const k=g.properties[v],C=Cd[v];(C===null||C.includes(g.tagName))&&(g.properties[v]=d(String(k||""),v,g))}}if(g.type==="element"){let v=l?!l.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return f&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function a5(e){const r=e.indexOf(":"),l=e.indexOf("?"),i=e.indexOf("#"),o=e.indexOf("/");return r===-1||o!==-1&&r>o||l!==-1&&r>l||i!==-1&&r>i||t5.test(e.slice(0,r))?e:""}function Zb(e,r){const l=String(e);if(typeof r!="string")throw new TypeError("Expected character");let i=0,o=l.indexOf(r);for(;o!==-1;)i++,o=l.indexOf(r,o+r.length);return i}function o5(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function s5(e,r,l){const o=Hu((l||{}).ignore||[]),u=u5(r);let c=-1;for(;++c<u.length;)Rw(e,"text",f);function f(m,g){let y=-1,b;for(;++y<g.length;){const v=g[y],k=b?b.children:void 0;if(o(v,k?k.indexOf(v):void 0,b))return;b=v}if(b)return d(m,g)}function d(m,g){const y=g[g.length-1],b=u[c][0],v=u[c][1];let k=0;const A=y.children.indexOf(m);let N=!1,O=[];b.lastIndex=0;let _=b.exec(m.value);for(;_;){const U=_.index,F={index:_.index,input:_.input,stack:[...g,m]};let z=v(..._,F);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=U+1:(k!==U&&O.push({type:"text",value:m.value.slice(k,U)}),Array.isArray(z)?O.push(...z):z&&O.push(z),k=U+_[0].length,N=!0),!b.global)break;_=b.exec(m.value)}return N?(k<m.value.length&&O.push({type:"text",value:m.value.slice(k)}),y.children.splice(A,1,...O)):O=[m],A+O.length}}function u5(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const l=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<l.length;){const o=l[i];r.push([c5(o[0]),f5(o[1])])}return r}function c5(e){return typeof e=="string"?new RegExp(o5(e),"g"):e}function f5(e){return typeof e=="function"?e:function(){return e}}const Dd="phrasing",Ld=["autolink","link","image","label"];function d5(){return{transforms:[b5],enter:{literalAutolink:m5,literalAutolinkEmail:Bd,literalAutolinkHttp:Bd,literalAutolinkWww:Bd},exit:{literalAutolink:x5,literalAutolinkEmail:y5,literalAutolinkHttp:p5,literalAutolinkWww:g5}}}function h5(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:":",before:"[ps]",after:"\\/",inConstruct:Dd,notInConstruct:Ld}]}}function m5(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Bd(e){this.config.enter.autolinkProtocol.call(this,e)}function p5(e){this.config.exit.autolinkProtocol.call(this,e)}function g5(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function y5(e){this.config.exit.autolinkEmail.call(this,e)}function x5(e){this.exit(e)}function b5(e){s5(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,v5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),w5]],{ignore:["link","linkReference"]})}function v5(e,r,l,i,o){let u="";if(!Ow(o)||(/^w/i.test(r)&&(l=r+l,r="",u="http://"),!S5(l)))return!1;const c=k5(l+i);if(!c[0])return!1;const f={type:"link",title:null,url:u+r+c[0],children:[{type:"text",value:r+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function w5(e,r,l,i){return!Ow(i,!0)||/[-\d_]$/.test(l)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+l,children:[{type:"text",value:r+"@"+l}]}}function S5(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function k5(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let l=r[0],i=l.indexOf(")");const o=Zb(e,"(");let u=Zb(e,")");for(;i!==-1&&o>u;)e+=l.slice(0,i+1),l=l.slice(i+1),i=l.indexOf(")"),u++;return[e,l]}function Ow(e,r){const l=e.input.charCodeAt(e.index-1);return(e.index===0||Ml(l)||Lu(l))&&(!r||l!==47)}zw.peek=M5;function C5(){this.buffer()}function E5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function N5(){this.buffer()}function A5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function j5(e){const r=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=kn(this.sliceSerialize(e)).toLowerCase(),l.label=r}function T5(e){this.exit(e)}function _5(e){const r=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=kn(this.sliceSerialize(e)).toLowerCase(),l.label=r}function R5(e){this.exit(e)}function M5(){return"["}function zw(e,r,l,i){const o=l.createTracker(i);let u=o.move("[^");const c=l.enter("footnoteReference"),f=l.enter("reference");return u+=o.move(l.safe(l.associationId(e),{after:"]",before:u})),f(),c(),u+=o.move("]"),u}function O5(){return{enter:{gfmFootnoteCallString:C5,gfmFootnoteCall:E5,gfmFootnoteDefinitionLabelString:N5,gfmFootnoteDefinition:A5},exit:{gfmFootnoteCallString:j5,gfmFootnoteCall:T5,gfmFootnoteDefinitionLabelString:_5,gfmFootnoteDefinition:R5}}}function z5(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:l,footnoteReference:zw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function l(i,o,u,c){const f=u.createTracker(c);let d=f.move("[^");const m=u.enter("footnoteDefinition"),g=u.enter("label");return d+=f.move(u.safe(u.associationId(i),{before:d,after:"]"})),g(),d+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),d+=f.move((r?`
398
+ `:" ")+u.indentLines(u.containerFlow(i,f.current()),r?Dw:D5))),m(),d}}function D5(e,r,l){return r===0?e:Dw(e,r,l)}function Dw(e,r,l){return(l?"":" ")+e}const L5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Lw.peek=q5;function B5(){return{canContainEols:["delete"],enter:{strikethrough:H5},exit:{strikethrough:P5}}}function U5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:L5}],handlers:{delete:Lw}}}function H5(e){this.enter({type:"delete",children:[]},e)}function P5(e){this.exit(e)}function Lw(e,r,l,i){const o=l.createTracker(i),u=l.enter("strikethrough");let c=o.move("~~");return c+=l.containerPhrasing(e,{...o.current(),before:c,after:"~"}),c+=o.move("~~"),u(),c}function q5(){return"~"}function F5(e){return e.length}function V5(e,r){const l=r||{},i=(l.align||[]).concat(),o=l.stringLength||F5,u=[],c=[],f=[],d=[];let m=0,g=-1;for(;++g<e.length;){const C=[],A=[];let N=-1;for(e[g].length>m&&(m=e[g].length);++N<e[g].length;){const O=I5(e[g][N]);if(l.alignDelimiters!==!1){const _=o(O);A[N]=_,(d[N]===void 0||_>d[N])&&(d[N]=_)}C.push(O)}c[g]=C,f[g]=A}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<m;)u[y]=Kb(i[y]);else{const C=Kb(i);for(;++y<m;)u[y]=C}y=-1;const b=[],v=[];for(;++y<m;){const C=u[y];let A="",N="";C===99?(A=":",N=":"):C===108?A=":":C===114&&(N=":");let O=l.alignDelimiters===!1?1:Math.max(1,d[y]-A.length-N.length);const _=A+"-".repeat(O)+N;l.alignDelimiters!==!1&&(O=A.length+O+N.length,O>d[y]&&(d[y]=O),v[y]=O),b[y]=_}c.splice(1,0,b),f.splice(1,0,v),g=-1;const k=[];for(;++g<c.length;){const C=c[g],A=f[g];y=-1;const N=[];for(;++y<m;){const O=C[y]||"";let _="",U="";if(l.alignDelimiters!==!1){const F=d[y]-(A[y]||0),z=u[y];z===114?_=" ".repeat(F):z===99?F%2?(_=" ".repeat(F/2+.5),U=" ".repeat(F/2-.5)):(_=" ".repeat(F/2),U=_):U=" ".repeat(F)}l.delimiterStart!==!1&&!y&&N.push("|"),l.padding!==!1&&!(l.alignDelimiters===!1&&O==="")&&(l.delimiterStart!==!1||y)&&N.push(" "),l.alignDelimiters!==!1&&N.push(_),N.push(O),l.alignDelimiters!==!1&&N.push(U),l.padding!==!1&&N.push(" "),(l.delimiterEnd!==!1||y!==m-1)&&N.push("|")}k.push(l.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return k.join(`
399
+ `)}function I5(e){return e==null?"":String(e)}function Kb(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function G5(e,r,l,i){const o=l.enter("blockquote"),u=l.createTracker(i);u.move("> "),u.shift(2);const c=l.indentLines(l.containerFlow(e,u.current()),Y5);return o(),c}function Y5(e,r,l){return">"+(l?"":" ")+e}function $5(e,r){return Jb(e,r.inConstruct,!0)&&!Jb(e,r.notInConstruct,!1)}function Jb(e,r,l){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return l;let i=-1;for(;++i<r.length;)if(e.includes(r[i]))return!0;return!1}function Wb(e,r,l,i){let o=-1;for(;++o<l.unsafe.length;)if(l.unsafe[o].character===`
400
+ `&&$5(l.stack,l.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
401
+ `}function X5(e,r){const l=String(e);let i=l.indexOf(r),o=i,u=0,c=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>c&&(c=u):u=1,o=i+r.length,i=l.indexOf(r,o);return c}function Q5(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Z5(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function K5(e,r,l,i){const o=Z5(l),u=e.value||"",c=o==="`"?"GraveAccent":"Tilde";if(Q5(e,l)){const y=l.enter("codeIndented"),b=l.indentLines(u,J5);return y(),b}const f=l.createTracker(i),d=o.repeat(Math.max(X5(u,o)+1,3)),m=l.enter("codeFenced");let g=f.move(d);if(e.lang){const y=l.enter(`codeFencedLang${c}`);g+=f.move(l.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=l.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(l.safe(e.meta,{before:g,after:`
402
402
  `,encode:["`"],...f.current()})),y()}return g+=f.move(`
403
403
  `),u&&(g+=f.move(u+`
404
- `)),g+=f.move(d),m(),g}function Q5(e,r,l){return(l?"":" ")+e}function hm(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Z5(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.enter("definition");let f=l.enter("label");const d=l.createTracker(i);let m=d.move("[");return m+=d.move(l.safe(l.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=l.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(l.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=l.enter("destinationRaw"),m+=d.move(l.safe(e.url,{before:m,after:e.title?" ":`
405
- `,...d.current()}))),f(),e.title&&(f=l.enter(`title${u}`),m+=d.move(" "+o),m+=d.move(l.safe(e.title,{before:m,after:o,...d.current()})),m+=d.move(o),f()),c(),m}function K5(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function lo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hu(e,r,l){const i=Di(e),o=Di(r);return i===void 0?o===void 0?l==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bw.peek=J5;function Bw(e,r,l,i){const o=K5(l),u=l.enter("emphasis"),c=l.createTracker(i),f=c.move(o);let d=c.move(l.containerPhrasing(e,{after:o,before:f,...c.current()}));const m=d.charCodeAt(0),g=hu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(d=lo(m)+d.slice(1));const y=d.charCodeAt(d.length-1),b=hu(i.after.charCodeAt(0),y,o);b.inside&&(d=d.slice(0,-1)+lo(y));const v=c.move(o);return u(),l.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+d+v}function J5(e,r,l){return l.options.emphasis||"*"}function W5(e,r){let l=!1;return fm(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return l=!0,ch}),!!((!e.depth||e.depth<3)&&lm(e)&&(r.options.setext||l))}function ez(e,r,l,i){const o=Math.max(Math.min(6,e.depth||1),1),u=l.createTracker(i);if(W5(e,l)){const g=l.enter("headingSetext"),y=l.enter("phrasing"),b=l.containerPhrasing(e,{...u.current(),before:`
404
+ `)),g+=f.move(d),m(),g}function J5(e,r,l){return(l?"":" ")+e}function hm(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function W5(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.enter("definition");let f=l.enter("label");const d=l.createTracker(i);let m=d.move("[");return m+=d.move(l.safe(l.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=l.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(l.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=l.enter("destinationRaw"),m+=d.move(l.safe(e.url,{before:m,after:e.title?" ":`
405
+ `,...d.current()}))),f(),e.title&&(f=l.enter(`title${u}`),m+=d.move(" "+o),m+=d.move(l.safe(e.title,{before:m,after:o,...d.current()})),m+=d.move(o),f()),c(),m}function ez(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function lo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hu(e,r,l){const i=Di(e),o=Di(r);return i===void 0?o===void 0?l==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bw.peek=tz;function Bw(e,r,l,i){const o=ez(l),u=l.enter("emphasis"),c=l.createTracker(i),f=c.move(o);let d=c.move(l.containerPhrasing(e,{after:o,before:f,...c.current()}));const m=d.charCodeAt(0),g=hu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(d=lo(m)+d.slice(1));const y=d.charCodeAt(d.length-1),b=hu(i.after.charCodeAt(0),y,o);b.inside&&(d=d.slice(0,-1)+lo(y));const v=c.move(o);return u(),l.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+d+v}function tz(e,r,l){return l.options.emphasis||"*"}function nz(e,r){let l=!1;return fm(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return l=!0,ch}),!!((!e.depth||e.depth<3)&&lm(e)&&(r.options.setext||l))}function rz(e,r,l,i){const o=Math.max(Math.min(6,e.depth||1),1),u=l.createTracker(i);if(nz(e,l)){const g=l.enter("headingSetext"),y=l.enter("phrasing"),b=l.containerPhrasing(e,{...u.current(),before:`
406
406
  `,after:`
407
407
  `});return y(),g(),b+`
408
408
  `+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
409
409
  `))+1))}const c="#".repeat(o),f=l.enter("headingAtx"),d=l.enter("phrasing");u.move(c+" ");let m=l.containerPhrasing(e,{before:"# ",after:`
410
- `,...u.current()});return/^[\t ]/.test(m)&&(m=lo(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,l.options.closeAtx&&(m+=" "+c),d(),f(),m}Uw.peek=tz;function Uw(e){return e.value||""}function tz(){return"<"}Hw.peek=nz;function Hw(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.enter("image");let f=l.enter("label");const d=l.createTracker(i);let m=d.move("![");return m+=d.move(l.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=l.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(l.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=l.enter("destinationRaw"),m+=d.move(l.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=l.enter(`title${u}`),m+=d.move(" "+o),m+=d.move(l.safe(e.title,{before:m,after:o,...d.current()})),m+=d.move(o),f()),m+=d.move(")"),c(),m}function nz(){return"!"}Pw.peek=rz;function Pw(e,r,l,i){const o=e.referenceType,u=l.enter("imageReference");let c=l.enter("label");const f=l.createTracker(i);let d=f.move("![");const m=l.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const g=l.stack;l.stack=[],c=l.enter("reference");const y=l.safe(l.associationId(e),{before:d,after:"]",...f.current()});return c(),l.stack=g,u(),o==="full"||!m||m!==y?d+=f.move(y+"]"):o==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function rz(){return"!"}qw.peek=lz;function qw(e,r,l){let i=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<l.unsafe.length;){const c=l.unsafe[u],f=l.compilePattern(c);let d;if(c.atBreak)for(;d=f.exec(i);){let m=d.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(d.index+1)}}return o+i+o}function lz(){return"`"}function Fw(e,r){const l=lm(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(l===e.url||"mailto:"+l===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Vw.peek=iz;function Vw(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.createTracker(i);let f,d;if(Fw(e,l)){const g=l.stack;l.stack=[],f=l.enter("autolink");let y=c.move("<");return y+=c.move(l.containerPhrasing(e,{before:y,after:">",...c.current()})),y+=c.move(">"),f(),l.stack=g,y}f=l.enter("link"),d=l.enter("label");let m=c.move("[");return m+=c.move(l.containerPhrasing(e,{before:m,after:"](",...c.current()})),m+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=l.enter("destinationLiteral"),m+=c.move("<"),m+=c.move(l.safe(e.url,{before:m,after:">",...c.current()})),m+=c.move(">")):(d=l.enter("destinationRaw"),m+=c.move(l.safe(e.url,{before:m,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=l.enter(`title${u}`),m+=c.move(" "+o),m+=c.move(l.safe(e.title,{before:m,after:o,...c.current()})),m+=c.move(o),d()),m+=c.move(")"),f(),m}function iz(e,r,l){return Fw(e,l)?"<":"["}Iw.peek=az;function Iw(e,r,l,i){const o=e.referenceType,u=l.enter("linkReference");let c=l.enter("label");const f=l.createTracker(i);let d=f.move("[");const m=l.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const g=l.stack;l.stack=[],c=l.enter("reference");const y=l.safe(l.associationId(e),{before:d,after:"]",...f.current()});return c(),l.stack=g,u(),o==="full"||!m||m!==y?d+=f.move(y+"]"):o==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function az(){return"["}function mm(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function oz(e){const r=mm(e),l=e.options.bulletOther;if(!l)return r==="*"?"-":"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(l===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+l+"`) to be different");return l}function sz(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Gw(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function uz(e,r,l,i){const o=l.enter("list"),u=l.bulletCurrent;let c=e.ordered?sz(l):mm(l);const f=e.ordered?c==="."?")":".":oz(l);let d=r&&l.bulletLastUsed?c===l.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&l.stack[l.stack.length-1]==="list"&&l.stack[l.stack.length-2]==="listItem"&&l.stack[l.stack.length-3]==="list"&&l.stack[l.stack.length-4]==="listItem"&&l.indexStack[l.indexStack.length-1]===0&&l.indexStack[l.indexStack.length-2]===0&&l.indexStack[l.indexStack.length-3]===0&&(d=!0),Gw(l)===c&&g){let y=-1;for(;++y<e.children.length;){const b=e.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(c=f),l.bulletCurrent=c;const m=l.containerFlow(e,i);return l.bulletLastUsed=c,l.bulletCurrent=u,o(),m}function cz(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function fz(e,r,l,i){const o=cz(l);let u=l.bulletCurrent||mm(l);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(l.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let c=u.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=l.createTracker(i);f.move(u+" ".repeat(c-u.length)),f.shift(c);const d=l.enter("listItem"),m=l.indentLines(l.containerFlow(e,f.current()),g);return d(),m;function g(y,b,v){return b?(v?"":" ".repeat(c))+y:(v?u:u+" ".repeat(c-u.length))+y}}function dz(e,r,l,i){const o=l.enter("paragraph"),u=l.enter("phrasing"),c=l.containerPhrasing(e,i);return u(),o(),c}const hz=Hu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function mz(e,r,l,i){return(e.children.some(function(c){return hz(c)})?l.containerPhrasing:l.containerFlow).call(l,e,i)}function pz(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Yw.peek=gz;function Yw(e,r,l,i){const o=pz(l),u=l.enter("strong"),c=l.createTracker(i),f=c.move(o+o);let d=c.move(l.containerPhrasing(e,{after:o,before:f,...c.current()}));const m=d.charCodeAt(0),g=hu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(d=lo(m)+d.slice(1));const y=d.charCodeAt(d.length-1),b=hu(i.after.charCodeAt(0),y,o);b.inside&&(d=d.slice(0,-1)+lo(y));const v=c.move(o+o);return u(),l.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+d+v}function gz(e,r,l){return l.options.strong||"*"}function yz(e,r,l,i){return l.safe(e.value,i)}function xz(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function bz(e,r,l){const i=(Gw(l)+(l.options.ruleSpaces?" ":"")).repeat(xz(l));return l.options.ruleSpaces?i.slice(0,-1):i}const $w={blockquote:F5,break:Wb,code:X5,definition:Z5,emphasis:Bw,hardBreak:Wb,heading:ez,html:Uw,image:Hw,imageReference:Pw,inlineCode:qw,link:Vw,linkReference:Iw,list:uz,listItem:fz,paragraph:dz,root:mz,strong:Yw,text:yz,thematicBreak:bz};function vz(){return{enter:{table:wz,tableData:ev,tableHeader:ev,tableRow:kz},exit:{codeText:Cz,table:Sz,tableData:Ud,tableHeader:Ud,tableRow:Ud}}}function wz(e){const r=e._align;this.enter({type:"table",align:r.map(function(l){return l==="none"?null:l}),children:[]},e),this.data.inTable=!0}function Sz(e){this.exit(e),this.data.inTable=void 0}function kz(e){this.enter({type:"tableRow",children:[]},e)}function Ud(e){this.exit(e)}function ev(e){this.enter({type:"tableCell",children:[]},e)}function Cz(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,Ez));const l=this.stack[this.stack.length-1];l.type,l.value=r,this.exit(e)}function Ez(e,r){return r==="|"?r:e}function Nz(e){const r=e||{},l=r.tableCellPadding,i=r.tablePipeAlign,o=r.stringLength,u=l?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
410
+ `,...u.current()});return/^[\t ]/.test(m)&&(m=lo(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,l.options.closeAtx&&(m+=" "+c),d(),f(),m}Uw.peek=lz;function Uw(e){return e.value||""}function lz(){return"<"}Hw.peek=iz;function Hw(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.enter("image");let f=l.enter("label");const d=l.createTracker(i);let m=d.move("![");return m+=d.move(l.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=l.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(l.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=l.enter("destinationRaw"),m+=d.move(l.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=l.enter(`title${u}`),m+=d.move(" "+o),m+=d.move(l.safe(e.title,{before:m,after:o,...d.current()})),m+=d.move(o),f()),m+=d.move(")"),c(),m}function iz(){return"!"}Pw.peek=az;function Pw(e,r,l,i){const o=e.referenceType,u=l.enter("imageReference");let c=l.enter("label");const f=l.createTracker(i);let d=f.move("![");const m=l.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const g=l.stack;l.stack=[],c=l.enter("reference");const y=l.safe(l.associationId(e),{before:d,after:"]",...f.current()});return c(),l.stack=g,u(),o==="full"||!m||m!==y?d+=f.move(y+"]"):o==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function az(){return"!"}qw.peek=oz;function qw(e,r,l){let i=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<l.unsafe.length;){const c=l.unsafe[u],f=l.compilePattern(c);let d;if(c.atBreak)for(;d=f.exec(i);){let m=d.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(d.index+1)}}return o+i+o}function oz(){return"`"}function Fw(e,r){const l=lm(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(l===e.url||"mailto:"+l===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Vw.peek=sz;function Vw(e,r,l,i){const o=hm(l),u=o==='"'?"Quote":"Apostrophe",c=l.createTracker(i);let f,d;if(Fw(e,l)){const g=l.stack;l.stack=[],f=l.enter("autolink");let y=c.move("<");return y+=c.move(l.containerPhrasing(e,{before:y,after:">",...c.current()})),y+=c.move(">"),f(),l.stack=g,y}f=l.enter("link"),d=l.enter("label");let m=c.move("[");return m+=c.move(l.containerPhrasing(e,{before:m,after:"](",...c.current()})),m+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=l.enter("destinationLiteral"),m+=c.move("<"),m+=c.move(l.safe(e.url,{before:m,after:">",...c.current()})),m+=c.move(">")):(d=l.enter("destinationRaw"),m+=c.move(l.safe(e.url,{before:m,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=l.enter(`title${u}`),m+=c.move(" "+o),m+=c.move(l.safe(e.title,{before:m,after:o,...c.current()})),m+=c.move(o),d()),m+=c.move(")"),f(),m}function sz(e,r,l){return Fw(e,l)?"<":"["}Iw.peek=uz;function Iw(e,r,l,i){const o=e.referenceType,u=l.enter("linkReference");let c=l.enter("label");const f=l.createTracker(i);let d=f.move("[");const m=l.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const g=l.stack;l.stack=[],c=l.enter("reference");const y=l.safe(l.associationId(e),{before:d,after:"]",...f.current()});return c(),l.stack=g,u(),o==="full"||!m||m!==y?d+=f.move(y+"]"):o==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function uz(){return"["}function mm(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function cz(e){const r=mm(e),l=e.options.bulletOther;if(!l)return r==="*"?"-":"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(l===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+l+"`) to be different");return l}function fz(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Gw(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function dz(e,r,l,i){const o=l.enter("list"),u=l.bulletCurrent;let c=e.ordered?fz(l):mm(l);const f=e.ordered?c==="."?")":".":cz(l);let d=r&&l.bulletLastUsed?c===l.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&l.stack[l.stack.length-1]==="list"&&l.stack[l.stack.length-2]==="listItem"&&l.stack[l.stack.length-3]==="list"&&l.stack[l.stack.length-4]==="listItem"&&l.indexStack[l.indexStack.length-1]===0&&l.indexStack[l.indexStack.length-2]===0&&l.indexStack[l.indexStack.length-3]===0&&(d=!0),Gw(l)===c&&g){let y=-1;for(;++y<e.children.length;){const b=e.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(c=f),l.bulletCurrent=c;const m=l.containerFlow(e,i);return l.bulletLastUsed=c,l.bulletCurrent=u,o(),m}function hz(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function mz(e,r,l,i){const o=hz(l);let u=l.bulletCurrent||mm(l);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(l.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let c=u.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=l.createTracker(i);f.move(u+" ".repeat(c-u.length)),f.shift(c);const d=l.enter("listItem"),m=l.indentLines(l.containerFlow(e,f.current()),g);return d(),m;function g(y,b,v){return b?(v?"":" ".repeat(c))+y:(v?u:u+" ".repeat(c-u.length))+y}}function pz(e,r,l,i){const o=l.enter("paragraph"),u=l.enter("phrasing"),c=l.containerPhrasing(e,i);return u(),o(),c}const gz=Hu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yz(e,r,l,i){return(e.children.some(function(c){return gz(c)})?l.containerPhrasing:l.containerFlow).call(l,e,i)}function xz(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Yw.peek=bz;function Yw(e,r,l,i){const o=xz(l),u=l.enter("strong"),c=l.createTracker(i),f=c.move(o+o);let d=c.move(l.containerPhrasing(e,{after:o,before:f,...c.current()}));const m=d.charCodeAt(0),g=hu(i.before.charCodeAt(i.before.length-1),m,o);g.inside&&(d=lo(m)+d.slice(1));const y=d.charCodeAt(d.length-1),b=hu(i.after.charCodeAt(0),y,o);b.inside&&(d=d.slice(0,-1)+lo(y));const v=c.move(o+o);return u(),l.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+d+v}function bz(e,r,l){return l.options.strong||"*"}function vz(e,r,l,i){return l.safe(e.value,i)}function wz(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function Sz(e,r,l){const i=(Gw(l)+(l.options.ruleSpaces?" ":"")).repeat(wz(l));return l.options.ruleSpaces?i.slice(0,-1):i}const $w={blockquote:G5,break:Wb,code:K5,definition:W5,emphasis:Bw,hardBreak:Wb,heading:rz,html:Uw,image:Hw,imageReference:Pw,inlineCode:qw,link:Vw,linkReference:Iw,list:dz,listItem:mz,paragraph:pz,root:yz,strong:Yw,text:vz,thematicBreak:Sz};function kz(){return{enter:{table:Cz,tableData:ev,tableHeader:ev,tableRow:Nz},exit:{codeText:Az,table:Ez,tableData:Ud,tableHeader:Ud,tableRow:Ud}}}function Cz(e){const r=e._align;this.enter({type:"table",align:r.map(function(l){return l==="none"?null:l}),children:[]},e),this.data.inTable=!0}function Ez(e){this.exit(e),this.data.inTable=void 0}function Nz(e){this.enter({type:"tableRow",children:[]},e)}function Ud(e){this.exit(e)}function ev(e){this.enter({type:"tableCell",children:[]},e)}function Az(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,jz));const l=this.stack[this.stack.length-1];l.type,l.value=r,this.exit(e)}function jz(e,r){return r==="|"?r:e}function Tz(e){const r=e||{},l=r.tableCellPadding,i=r.tablePipeAlign,o=r.stringLength,u=l?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
411
411
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:d,tableRow:f}};function c(v,k,C,A){return m(g(v,C,A),v.align)}function f(v,k,C,A){const N=y(v,C,A),O=m([N]);return O.slice(0,O.indexOf(`
412
- `))}function d(v,k,C,A){const N=C.enter("tableCell"),O=C.enter("phrasing"),_=C.containerPhrasing(v,{...A,before:u,after:u});return O(),N(),_}function m(v,k){return P5(v,{align:k,alignDelimiters:i,padding:l,stringLength:o})}function g(v,k,C){const A=v.children;let N=-1;const O=[],_=k.enter("table");for(;++N<A.length;)O[N]=y(A[N],k,C);return _(),O}function y(v,k,C){const A=v.children;let N=-1;const O=[],_=k.enter("tableRow");for(;++N<A.length;)O[N]=d(A[N],v,k,C);return _(),O}function b(v,k,C){let A=$w.inlineCode(v,k,C);return C.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function Az(){return{exit:{taskListCheckValueChecked:tv,taskListCheckValueUnchecked:tv,paragraph:Tz}}}function jz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_z}}}function tv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Tz(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const l=this.stack[this.stack.length-1];l.type;const i=l.children[0];if(i&&i.type==="text"){const o=r.children;let u=-1,c;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){c=f;break}}c===l&&(i.value=i.value.slice(1),i.value.length===0?l.children.shift():l.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,l.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function _z(e,r,l,i){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=l.createTracker(i);u&&f.move(c);let d=$w.listItem(e,r,l,{...i,...f.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(g){return g+c}}function Rz(){return[u5(),_5(),z5(),vz(),Az()]}function Mz(e){return{extensions:[c5(),R5(e),D5(),Nz(e),jz()]}}const Oz={tokenize:Hz,partial:!0},Xw={tokenize:Pz,partial:!0},Qw={tokenize:qz,partial:!0},Zw={tokenize:Fz,partial:!0},zz={tokenize:Vz,partial:!0},Kw={name:"wwwAutolink",tokenize:Bz,previous:Ww},Jw={name:"protocolAutolink",tokenize:Uz,previous:eS},yr={name:"emailAutolink",tokenize:Lz,previous:tS},In={};function Dz(){return{text:In}}let Al=48;for(;Al<123;)In[Al]=yr,Al++,Al===58?Al=65:Al===91&&(Al=97);In[43]=yr;In[45]=yr;In[46]=yr;In[95]=yr;In[72]=[yr,Jw];In[104]=[yr,Jw];In[87]=[yr,Kw];In[119]=[yr,Kw];function Lz(e,r,l){const i=this;let o,u;return c;function c(y){return!mh(y)||!tS.call(i,i.previous)||pm(i.events)?l(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return mh(y)?(e.consume(y),f):y===64?(e.consume(y),d):l(y)}function d(y){return y===46?e.check(zz,g,m)(y):y===45||y===95||Tt(y)?(u=!0,e.consume(y),d):g(y)}function m(y){return e.consume(y),o=!0,d}function g(y){return u&&o&&Dt(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(y)):l(y)}}function Bz(e,r,l){const i=this;return o;function o(c){return c!==87&&c!==119||!Ww.call(i,i.previous)||pm(i.events)?l(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Oz,e.attempt(Xw,e.attempt(Qw,u),l),l)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(c)}}function Uz(e,r,l){const i=this;let o="",u=!1;return c;function c(y){return(y===72||y===104)&&eS.call(i,i.previous)&&!pm(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):l(y)}function f(y){if(Dt(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),f;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return e.consume(y),d}return l(y)}function d(y){return y===47?(e.consume(y),u?m:(u=!0,d)):l(y)}function m(y){return y===null||cu(y)||Ze(y)||Ml(y)||Lu(y)?l(y):e.attempt(Xw,e.attempt(Qw,g),l)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(y)}}function Hz(e,r,l){let i=0;return o;function o(c){return(c===87||c===119)&&i<3?(i++,e.consume(c),o):c===46&&i===3?(e.consume(c),u):l(c)}function u(c){return c===null?l(c):r(c)}}function Pz(e,r,l){let i,o,u;return c;function c(m){return m===46||m===95?e.check(Zw,d,f)(m):m===null||Ze(m)||Ml(m)||m!==45&&Lu(m)?d(m):(u=!0,e.consume(m),c)}function f(m){return m===95?i=!0:(o=i,i=void 0),e.consume(m),c}function d(m){return o||i||!u?l(m):r(m)}}function qz(e,r){let l=0,i=0;return o;function o(c){return c===40?(l++,e.consume(c),o):c===41&&i<l?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(Zw,r,u)(c):c===null||Ze(c)||Ml(c)?r(c):(e.consume(c),o)}function u(c){return c===41&&i++,e.consume(c),o}}function Fz(e,r,l){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Ze(f)||Ml(f)?r(f):l(f)}function o(f){return f===null||f===40||f===91||Ze(f)||Ml(f)?r(f):i(f)}function u(f){return Dt(f)?c(f):l(f)}function c(f){return f===59?(e.consume(f),i):Dt(f)?(e.consume(f),c):l(f)}}function Vz(e,r,l){return i;function i(u){return e.consume(u),o}function o(u){return Tt(u)?l(u):r(u)}}function Ww(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function eS(e){return!Dt(e)}function tS(e){return!(e===47||mh(e))}function mh(e){return e===43||e===45||e===46||e===95||Tt(e)}function pm(e){let r=e.length,l=!1;for(;r--;){const i=e[r][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){l=!0;break}if(i._gfmAutolinkLiteralWalkedInto){l=!1;break}}return e.length>0&&!l&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),l}const Iz={tokenize:Jz,partial:!0};function Gz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Qz,continuation:{tokenize:Zz},exit:Kz}},text:{91:{name:"gfmFootnoteCall",tokenize:Xz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Yz,resolveTo:$z}}}}function Yz(e,r,l){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c;for(;o--;){const d=i.events[o][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return l(d);const m=kn(i.sliceSerialize({start:c.end,end:i.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?l(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function $z(e,r){let l=e.length;for(;l--;)if(e[l][1].type==="labelImage"&&e[l][0]==="enter"){e[l][1];break}e[l+1][1].type="data",e[l+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[l+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[l+3][1].end),end:Object.assign({},e[l+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[l+1],e[l+2],["enter",i,r],e[l+3],e[l+4],["enter",o,r],["exit",o,r],["enter",u,r],["enter",c,r],["exit",c,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",i,r]];return e.splice(l,e.length-l+1,...f),e}function Xz(e,r,l){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,c;return f;function f(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),d}function d(y){return y!==94?l(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(u>999||y===93&&!c||y===null||y===91||Ze(y))return l(y);if(y===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return o.includes(kn(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):l(y)}return Ze(y)||(c=!0),u++,e.consume(y),y===92?g:m}function g(y){return y===91||y===92||y===93?(e.consume(y),u++,m):m(y)}}function Qz(e,r,l){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,c=0,f;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):l(k)}function g(k){if(c>999||k===93&&!f||k===null||k===91||Ze(k))return l(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=kn(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Ze(k)||(f=!0),c++,e.consume(k),k===92?y:g}function y(k){return k===91||k===92||k===93?(e.consume(k),c++,g):g(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),o.includes(u)||o.push(u),Be(e,v,"gfmFootnoteDefinitionWhitespace")):l(k)}function v(k){return r(k)}}function Zz(e,r,l){return e.check(mo,r,e.attempt(Iz,r,l))}function Kz(e){e.exit("gfmFootnoteDefinition")}function Jz(e,r,l){const i=this;return Be(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const c=i.events[i.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?r(u):l(u)}}function Wz(e){let l=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:o};return l==null&&(l=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},y={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},b=[["enter",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",y,f]],v=f.parser.constructs.insideSpan.null;v&&ln(b,b.length,0,Bu(v,c.slice(m+1,d),f)),ln(b,b.length,0,[["exit",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",g,f]]),ln(c,m-1,d-m+3,b),d=m+b.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function u(c,f,d){const m=this.previous,g=this.events;let y=0;return b;function b(k){return m===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(c.enter("strikethroughSequenceTemporary"),v(k))}function v(k){const C=Di(m);if(k===126)return y>1?d(k):(c.consume(k),y++,v);if(y<2&&!l)return d(k);const A=c.exit("strikethroughSequenceTemporary"),N=Di(k);return A._open=!N||N===2&&!!C,A._close=!C||C===2&&!!N,f(k)}}}class eD{constructor(){this.map=[]}add(r,l,i){tD(this,r,l,i)}consume(r){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let l=this.map.length;const i=[];for(;l>0;)l-=1,i.push(r.slice(this.map[l][0]+this.map[l][1]),this.map[l][2]),r.length=this.map[l][0];i.push(r.slice()),r.length=0;let o=i.pop();for(;o;){for(const u of o)r.push(u);o=i.pop()}this.map.length=0}}function tD(e,r,l,i){let o=0;if(!(l===0&&i.length===0)){for(;o<e.map.length;){if(e.map[o][0]===r){e.map[o][1]+=l,e.map[o][2].push(...i);return}o+=1}e.map.push([r,l,i])}}function nD(e,r){let l=!1;const i=[];for(;r<e.length;){const o=e[r];if(l){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(l=!0);r+=1}return i}function rD(){return{flow:{null:{name:"table",tokenize:lD,resolveAll:iD}}}}function lD(e,r,l){const i=this;let o=0,u=0,c;return f;function f(P){let re=i.events.length-1;for(;re>-1;){const J=i.events[re][1].type;if(J==="lineEnding"||J==="linePrefix")re--;else break}const le=re>-1?i.events[re][1].type:null,se=le==="tableHead"||le==="tableRow"?z:d;return se===z&&i.parser.lazy[i.now().line]?l(P):se(P)}function d(P){return e.enter("tableHead"),e.enter("tableRow"),m(P)}function m(P){return P===124||(c=!0,u+=1),g(P)}function g(P){return P===null?l(P):we(P)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),v):l(P):Oe(P)?Be(e,g,"whitespace")(P):(u+=1,c&&(c=!1,o+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),y(P)))}function y(P){return P===null||P===124||Ze(P)?(e.exit("data"),g(P)):(e.consume(P),P===92?b:y)}function b(P){return P===92||P===124?(e.consume(P),y):y(P)}function v(P){return i.interrupt=!1,i.parser.lazy[i.now().line]?l(P):(e.enter("tableDelimiterRow"),c=!1,Oe(P)?Be(e,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):k(P))}function k(P){return P===45||P===58?A(P):P===124?(c=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),C):F(P)}function C(P){return Oe(P)?Be(e,A,"whitespace")(P):A(P)}function A(P){return P===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),N):P===45?(u+=1,N(P)):P===null||we(P)?U(P):F(P)}function N(P){return P===45?(e.enter("tableDelimiterFiller"),O(P)):F(P)}function O(P){return P===45?(e.consume(P),O):P===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(P))}function _(P){return Oe(P)?Be(e,U,"whitespace")(P):U(P)}function U(P){return P===124?k(P):P===null||we(P)?!c||o!==u?F(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(P)):F(P)}function F(P){return l(P)}function z(P){return e.enter("tableRow"),B(P)}function B(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),B):P===null||we(P)?(e.exit("tableRow"),r(P)):Oe(P)?Be(e,B,"whitespace")(P):(e.enter("data"),$(P))}function $(P){return P===null||P===124||Ze(P)?(e.exit("data"),B(P)):(e.consume(P),P===92?ae:$)}function ae(P){return P===92||P===124?(e.consume(P),$):$(P)}}function iD(e,r){let l=-1,i=!0,o=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,g,y;const b=new eD;for(;++l<e.length;){const v=e[l],k=v[1];v[0]==="enter"?k.type==="tableHead"?(f=!1,d!==0&&(nv(b,r,d,m,g),g=void 0,d=0),m={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(l,0,[["enter",m,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],c=[0,l+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(l,0,[["enter",g,r]])),o=k.type==="tableDelimiterRow"?2:g?3:1):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(i=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],y=Gs(b,r,u,o,void 0,y),u=[0,0,0,0]),c[2]=l)):k.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(c[0]=c[1],y=Gs(b,r,u,o,void 0,y)),u=c,c=[u[1],l,0,0])):k.type==="tableHead"?(f=!0,d=l):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=l,u[1]!==0?(c[0]=c[1],y=Gs(b,r,u,o,l,y)):c[1]!==0&&(y=Gs(b,r,c,o,l,y)),o=0):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=l)}for(d!==0&&nv(b,r,d,m,g),b.consume(r.events),l=-1;++l<r.events.length;){const v=r.events[l];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=nD(r.events,l))}return e}function Gs(e,r,l,i,o,u){const c=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";l[0]!==0&&(u.end=Object.assign({},Ai(r.events,l[0])),e.add(l[0],0,[["exit",u,r]]));const d=Ai(r.events,l[1]);if(u={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(l[1],0,[["enter",u,r]]),l[2]!==0){const m=Ai(r.events,l[2]),g=Ai(r.events,l[3]),y={type:f,start:Object.assign({},m),end:Object.assign({},g)};if(e.add(l[2],0,[["enter",y,r]]),i!==2){const b=r.events[l[2]],v=r.events[l[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",l[3]>l[2]+1){const k=l[2]+1,C=l[3]-l[2]-1;e.add(k,C,[])}}e.add(l[3]+1,0,[["exit",y,r]])}return o!==void 0&&(u.end=Object.assign({},Ai(r.events,o)),e.add(o,0,[["exit",u,r]]),u=void 0),u}function nv(e,r,l,i,o){const u=[],c=Ai(r.events,l);o&&(o.end=Object.assign({},c),u.push(["exit",o,r])),i.end=Object.assign({},c),u.push(["exit",i,r]),e.add(l+1,0,u)}function Ai(e,r){const l=e[r],i=l[0]==="enter"?"start":"end";return l[1][i]}const aD={name:"tasklistCheck",tokenize:sD};function oD(){return{text:{91:aD}}}function sD(e,r,l){const i=this;return o;function o(d){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?l(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return Ze(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):l(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):l(d)}function f(d){return we(d)?r(d):Oe(d)?e.check({tokenize:uD},r,l)(d):l(d)}}function uD(e,r,l){return Be(e,i,"whitespace");function i(o){return o===null?l(o):r(o)}}function cD(e){return dw([Dz(),Gz(),Wz(e),rD(),oD()])}const fD={};function Bi(e){const r=this,l=e||fD,i=r.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),c=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(cD(l)),u.push(Rz()),c.push(Mz(l))}function dD({content:e}){return x.jsx("div",{className:"flex gap-2 justify-end",children:x.jsx("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e})})})}function hD({json:e}){return x.jsx("div",{className:"flex gap-3 justify-start",children:x.jsx("div",{className:"flex-1 max-w-[90%]",children:x.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function nS({title:e,count:r,children:l,badge:i}){const[o,u]=S.useState(!1);return r===0?null:x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[x.jsx(Kr,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),x.jsx("span",{className:"text-muted-foreground font-medium",children:e}),x.jsx("span",{className:"text-muted-foreground/60",children:r}),i]}),o&&x.jsx("div",{className:"ml-5",children:l})]})}function Hd({title:e,items:r,icon:l,getIcon:i}){return r.length===0?null:x.jsx(nS,{title:e,count:r.length,children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(o=>x.jsx(Z1,{icon:i?i(o):l,children:o},o))})})}function mD(e){const r=e.match(/^mcp__([^_]+)__(.+)$/);return r?{server:r[1],tool:r[2]}:null}function rS({status:e}){const r=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return x.jsx("span",{className:xe("inline-block h-2 w-2 rounded-full shrink-0",r)})}function pD(e){switch(e){case"connected":return"Connected";case"failed":return"Failed";case"needs-auth":return"Needs auth";case"pending":return"Connecting...";case"disabled":return"Disabled";default:return e}}function rv({server:e}){const[r,l]=S.useState(!1),i=e.status==="connected";return x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>i&&e.tools.length>0&&l(!r),className:xe("flex items-center gap-1.5",i&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[i&&e.tools.length>0&&x.jsx(Kr,{className:xe("h-3 w-3 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),x.jsx(rS,{status:e.status}),x.jsx("span",{className:"text-muted-foreground font-medium",children:jl(e.name)}),i?x.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):x.jsx("span",{className:"text-muted-foreground/50",children:pD(e.status)})]}),!i&&e.error&&x.jsx("span",{className:"text-destructive ml-5",children:e.error}),r&&e.tools.length>0&&x.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(o=>x.jsx(Z1,{icon:Q1(`mcp__${e.name}__${o}`),children:o},o))})]})}function gD({servers:e}){if(e.length===0)return null;const r=e.filter(o=>o.status==="connected"),l=e.filter(o=>o.status!=="connected"),i=l.length>0?x.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[x.jsx(rS,{status:"failed"}),x.jsxs("span",{className:"text-muted-foreground/60",children:[l.length," disconnected"]})]}):null;return x.jsx(nS,{title:"MCP Servers",count:e.length,badge:i,children:x.jsxs("div",{className:"flex flex-col gap-2",children:[r.map(o=>x.jsx(rv,{server:o},o.name)),l.map(o=>x.jsx(rv,{server:o},o.name))]})})}function yD({rawJson:e}){const[r,l]=S.useState(!1);return x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>l(!r),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[x.jsx(Kr,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),x.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),r&&x.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function xD({message:e,rawJson:r}){const{coreTools:l,mcpServersWithTools:i}=S.useMemo(()=>{const o=new Map,u=[];for(const f of e.tools){const d=mD(f);if(d){const m=o.get(d.server)||[];m.push(d.tool),o.set(d.server,m)}else u.push(f)}const c=e.mcpServers.map(f=>({name:f.name,status:f.status,error:f.error,tools:o.get(f.name)||[]}));return{coreTools:u,mcpServersWithTools:c}},[e.tools,e.mcpServers]);return x.jsx(ll,{children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsxs("div",{className:"flex flex-col gap-3",children:[x.jsx(qR,{children:e.model}),x.jsx(Hd,{title:"Tools",items:l,getIcon:o=>nh[o]??X1}),x.jsx(Hd,{title:"Agents",items:e.agents,icon:Bh}),x.jsx(Hd,{title:"Commands",items:e.slashCommands,icon:eT}),x.jsx(gD,{servers:i}),r&&x.jsx(yD,{rawJson:r})]})}),children:[x.jsx(WA,{className:"h-5 w-5 text-logo"}),x.jsx(el,{children:"Session Started"})]})})}function bD({message:e}){return x.jsx(ll,{className:"hidden",children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[x.jsx("div",{className:"size-5 flex justify-center items-center ",children:x.jsx(Bh,{className:"h-4 w-4 text-muted-foreground"})}),x.jsx(el,{children:"Account"})]})})}function vD({message:e}){return x.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e.text})})}function wD({question:e,currentIndex:r,totalQuestions:l,onBack:i,children:o}){const u=i&&r>0;return x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("div",{className:"relative",children:[x.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[u?x.jsx("button",{onClick:i,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:x.jsx(fj,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):l>1?x.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[r+1," of ",l]}):null,e]}),l>1&&x.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:x.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${r/l*100}%`}})})]}),o]})}function lv({label:e,description:r}){return x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-foreground text-sm",children:e}),r&&x.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r})]})}function lS({selected:e,multiSelect:r,onClick:l}){return x.jsx("button",{type:"button",onClick:l,className:xe("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",r?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",l&&e&&"cursor-pointer"),children:e&&x.jsx(_l,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function SD({option:e,selected:r,multiSelect:l,onClick:i,isLast:o}){const u="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",c=o?"":"border-b border-border";return i?x.jsx("button",{onClick:i,className:xe(u,c,"transition-all cursor-pointer"),children:x.jsxs("div",{className:"flex items-center justify-between gap-3",children:[x.jsx("div",{className:"flex-1 min-w-0",children:x.jsx(lv,{label:e.label,description:e.description})}),x.jsx(lS,{selected:r,multiSelect:l})]})}):x.jsx("div",{className:xe(u,c),children:x.jsx(lv,{label:e.label,description:e.description})})}function kD(e){if(e)try{return JSON.parse(e).answers}catch{return}}function CD({message:e,onSubmit:r,isLatest:l}){var le,se;const i=((le=e.input)==null?void 0:le.questions)||[],o=!!e.result,u=kD(e.result),[c,f]=S.useState(0),[d,m]=S.useState({}),[g,y]=S.useState({}),[b,v]=S.useState(o),k=(J,Z)=>{var ie;const D=(ie=g[J])==null?void 0:ie.trim(),X=d[J]||"",ne=i.find(j=>j.question===J);return ne!=null&&ne.multiSelect?[X,D].filter(Boolean).join(", "):D||X},C=J=>{const Z=d[J.question]||"";return J.multiSelect?Z.split(", ").filter(Boolean):[Z]},A=(J,Z)=>{const D=J.question;if(J.multiSelect){const X=d[D]?d[D].split(", ").filter(Boolean):[],ne=X.includes(Z)?X.filter(ie=>ie!==Z):[...X,Z];m({...d,[D]:ne.join(", ")})}else m({...d,[D]:Z}),y({...g,[D]:""}),c<i.length-1&&setTimeout(()=>f(c+1),150)},N=(J,Z)=>{const D=J.question;y({...g,[D]:Z}),Z&&!J.multiSelect&&m({...d,[D]:""})},O=J=>{J.multiSelect&&g[J.question]&&y({...g,[J.question]:""})},_=i.every(J=>k(J.question).length>0),U=i[c],F=c===i.length-1,z=U&&k(U.question).length>0,B=()=>{c<i.length-1&&f(c+1)},$=()=>{c>0&&f(c-1)},ae=()=>{if(!_)return;const J={};for(const Z of i)J[Z.question]=k(Z.question);m(J),v(!0),r(e.toolId,i,J)};if(b||o){const J=u||d;return x.jsx("div",{className:"w-full",children:x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[x.jsxs("p",{children:["Question",i.length!==1?"s":""]}),x.jsx("p",{className:"",children:"Answers"})]}),i.map((Z,D)=>{const X=J[Z.question]||"",ne=D===i.length-1;return x.jsxs("div",{className:xe("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!ne&&"border-b border-border"),children:[x.jsx("span",{className:"text-sm",children:Z.question}),X&&x.jsx("span",{className:"text-sm font-medium text-right",children:X}),!X&&x.jsx("span",{className:"text-sm font-medium text-right italic",children:"No Response"})]},Z.question)})]})})}if(!l)return x.jsx("div",{className:"w-full py-2",children:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(D0,{className:"h-4 w-4 text-muted-foreground"}),x.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!U)return null;const P=C(U),re=g[U.question]||"";return x.jsxs("div",{className:"w-full space-y-3",children:[x.jsxs(wD,{question:U.question,currentIndex:c,totalQuestions:i.length,onBack:c>0?$:void 0,children:[(se=U.options)==null?void 0:se.map(J=>x.jsx(SD,{option:J,selected:P.includes(J.label),multiSelect:U.multiSelect,onClick:()=>A(U,J.label)},J.label)),x.jsx("div",{className:"transition-all bg-background",children:x.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[x.jsx("input",{type:"text",value:re,onChange:J=>N(U,J.target.value),placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),x.jsx(lS,{selected:!!re,multiSelect:U.multiSelect,onClick:U.multiSelect&&re?()=>O(U):void 0})]})})]}),x.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!F&&z&&(U.multiSelect||!!re)&&x.jsx(qe,{size:"sm",onClick:B,children:"Next"}),F&&x.jsx(qe,{size:"sm",onClick:ae,disabled:!_,className:xe(!_&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function ED({message:e,onConfirm:r}){const l=!!e.result,[i,o]=S.useState(!1),[u,c]=S.useState(!1),[f,d]=S.useState(!1),[m,g]=S.useState(""),y=S.useRef(null),b=e.input;S.useEffect(()=>{f&&y.current&&y.current.focus()},[f]);const v=async()=>{b!=null&&b.plan&&(await navigator.clipboard.writeText(b.plan),c(!0),setTimeout(()=>c(!1),2e3))},k=(()=>{if(!l)return null;try{return JSON.parse(e.result||"{}")}catch{return{}}})();return x.jsxs("div",{className:"flex flex-col gap-3",children:[x.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(b==null?void 0:b.plan)&&x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!u&&"hover:text-foreground",u&&"hover:!bg-transparent hover:!border-transparent"),onClick:v,children:u?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})}),x.jsxs("div",{className:xe("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",l&&!i?"max-h-[min(400px,40vh)] ":"",l?"hover:!pb-[32px]":""),children:[l&&x.jsxs(qe,{variant:"ghost",className:"absolute z-10 bottom-2 pr-2.5 !pl-3.5 h-[34px] inline-flex gap-1 text-sm left-[50%] -translate-x-[50%] text-muted-foreground backdrop-blur-sm hover:text-foreground opacity-0 group-hover/plan:opacity-100 transition-all rounded-full border border-border",onClick:()=>o(!i),children:[i?"Show Less":"Show More",x.jsx(uj,{className:`size-3.5 transition-transform ${i?"rotate-180":""}`})]}),b!=null&&b.plan?x.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:b.plan}),x.jsx("div",{className:"mt-5"})]}):x.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),l?x.jsx("div",{className:"flex justify-end mx-2",children:x.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[x.jsx("em",{children:k!=null&&k.clearContext?"Approved & Cleared Context":k!=null&&k.confirmed?"Approved":k!=null&&k.message?`Adjusted: "${k.message}"`:"Adjusted Plan"}),x.jsx(Sj,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):x.jsxs("div",{className:"flex flex-col gap-3",children:[!f&&x.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[x.jsxs(qe,{size:"sm",onClick:()=>r(e.toolId,!0,!0),className:"rounded-full bg-primary text-background pr-4 md:order-last",children:[x.jsx(lj,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),x.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[x.jsxs(qe,{size:"sm",variant:"outline",onClick:()=>d(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[x.jsx(B0,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),x.jsxs(qe,{size:"sm",variant:"outline",onClick:()=>r(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[x.jsx(_l,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),f&&x.jsxs("div",{className:"flex flex-col gap-2",children:[x.jsx("textarea",{ref:y,value:m,onChange:C=>g(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!C.shiftKey&&m.trim()&&(C.preventDefault(),r(e.toolId,!1,void 0,m.trim())),C.key==="Escape"&&(d(!1),g(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),x.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[x.jsx(qe,{size:"sm",variant:"ghost",onClick:()=>{d(!1),g("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),x.jsxs(qe,{size:"sm",disabled:!m.trim(),onClick:()=>r(e.toolId,!1,void 0,m.trim()),className:"rounded-full bg-primary text-background disabled:opacity-50 disabled:pointer-events-none",children:[x.jsx(Jj,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]})]})}const ND={completed:{Icon:_l,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:zl,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:gj,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function AD({message:e}){const r=e.input.todos??[];return r.length?x.jsx("div",{className:"w-full",children:x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[x.jsx(Uj,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),x.jsx("div",{children:r.map((l,i)=>{const o=i===r.length-1,{Icon:u,iconClass:c,textClass:f}=ND[l.status];return x.jsxs("div",{className:xe("flex items-center gap-3 px-4 py-2.5 bg-background",!o&&"border-b border-border"),children:[x.jsx(u,{className:xe("h-4 w-4 flex-shrink-0",c)}),x.jsx("span",{className:xe("text-sm",f),children:l.status==="in_progress"?l.activeForm:l.content})]},i)})})]})}):null}function Pd(e,r){if(!e)return"";if(r){const l=r.endsWith("/")?r:`${r}/`;if(e.startsWith(l))return e.slice(l.length);if(e===r)return""}return e.replace(/^\/home\/user\/workspace\//,"")}function jD(e,r){if(e){if(r){const l=`${r}/outputs`;if(e.startsWith(l))return e.slice(l.length)}return e.replace(/^\/home\/user\/workspace\/outputs/,"")||void 0}}function TD(e){const r=e.split(`
413
- `),l=/^\s*(\d+)→(.*)$/;return r.map(i=>{const o=i.match(l);return o?{lineNumber:parseInt(o[1],10),content:o[2]}:{lineNumber:null,content:i}})}function _D(e){return e.replace(/<[^>]+>/g,"")}function RD(e,r){const l=e.split(`
412
+ `))}function d(v,k,C,A){const N=C.enter("tableCell"),O=C.enter("phrasing"),_=C.containerPhrasing(v,{...A,before:u,after:u});return O(),N(),_}function m(v,k){return V5(v,{align:k,alignDelimiters:i,padding:l,stringLength:o})}function g(v,k,C){const A=v.children;let N=-1;const O=[],_=k.enter("table");for(;++N<A.length;)O[N]=y(A[N],k,C);return _(),O}function y(v,k,C){const A=v.children;let N=-1;const O=[],_=k.enter("tableRow");for(;++N<A.length;)O[N]=d(A[N],v,k,C);return _(),O}function b(v,k,C){let A=$w.inlineCode(v,k,C);return C.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function _z(){return{exit:{taskListCheckValueChecked:tv,taskListCheckValueUnchecked:tv,paragraph:Mz}}}function Rz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Oz}}}function tv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Mz(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const l=this.stack[this.stack.length-1];l.type;const i=l.children[0];if(i&&i.type==="text"){const o=r.children;let u=-1,c;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){c=f;break}}c===l&&(i.value=i.value.slice(1),i.value.length===0?l.children.shift():l.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,l.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Oz(e,r,l,i){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=l.createTracker(i);u&&f.move(c);let d=$w.listItem(e,r,l,{...i,...f.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(g){return g+c}}function zz(){return[d5(),O5(),B5(),kz(),_z()]}function Dz(e){return{extensions:[h5(),z5(e),U5(),Tz(e),Rz()]}}const Lz={tokenize:Fz,partial:!0},Xw={tokenize:Vz,partial:!0},Qw={tokenize:Iz,partial:!0},Zw={tokenize:Gz,partial:!0},Bz={tokenize:Yz,partial:!0},Kw={name:"wwwAutolink",tokenize:Pz,previous:Ww},Jw={name:"protocolAutolink",tokenize:qz,previous:eS},yr={name:"emailAutolink",tokenize:Hz,previous:tS},In={};function Uz(){return{text:In}}let Al=48;for(;Al<123;)In[Al]=yr,Al++,Al===58?Al=65:Al===91&&(Al=97);In[43]=yr;In[45]=yr;In[46]=yr;In[95]=yr;In[72]=[yr,Jw];In[104]=[yr,Jw];In[87]=[yr,Kw];In[119]=[yr,Kw];function Hz(e,r,l){const i=this;let o,u;return c;function c(y){return!mh(y)||!tS.call(i,i.previous)||pm(i.events)?l(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return mh(y)?(e.consume(y),f):y===64?(e.consume(y),d):l(y)}function d(y){return y===46?e.check(Bz,g,m)(y):y===45||y===95||Tt(y)?(u=!0,e.consume(y),d):g(y)}function m(y){return e.consume(y),o=!0,d}function g(y){return u&&o&&Dt(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(y)):l(y)}}function Pz(e,r,l){const i=this;return o;function o(c){return c!==87&&c!==119||!Ww.call(i,i.previous)||pm(i.events)?l(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Lz,e.attempt(Xw,e.attempt(Qw,u),l),l)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(c)}}function qz(e,r,l){const i=this;let o="",u=!1;return c;function c(y){return(y===72||y===104)&&eS.call(i,i.previous)&&!pm(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):l(y)}function f(y){if(Dt(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),f;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return e.consume(y),d}return l(y)}function d(y){return y===47?(e.consume(y),u?m:(u=!0,d)):l(y)}function m(y){return y===null||cu(y)||Ze(y)||Ml(y)||Lu(y)?l(y):e.attempt(Xw,e.attempt(Qw,g),l)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(y)}}function Fz(e,r,l){let i=0;return o;function o(c){return(c===87||c===119)&&i<3?(i++,e.consume(c),o):c===46&&i===3?(e.consume(c),u):l(c)}function u(c){return c===null?l(c):r(c)}}function Vz(e,r,l){let i,o,u;return c;function c(m){return m===46||m===95?e.check(Zw,d,f)(m):m===null||Ze(m)||Ml(m)||m!==45&&Lu(m)?d(m):(u=!0,e.consume(m),c)}function f(m){return m===95?i=!0:(o=i,i=void 0),e.consume(m),c}function d(m){return o||i||!u?l(m):r(m)}}function Iz(e,r){let l=0,i=0;return o;function o(c){return c===40?(l++,e.consume(c),o):c===41&&i<l?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(Zw,r,u)(c):c===null||Ze(c)||Ml(c)?r(c):(e.consume(c),o)}function u(c){return c===41&&i++,e.consume(c),o}}function Gz(e,r,l){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Ze(f)||Ml(f)?r(f):l(f)}function o(f){return f===null||f===40||f===91||Ze(f)||Ml(f)?r(f):i(f)}function u(f){return Dt(f)?c(f):l(f)}function c(f){return f===59?(e.consume(f),i):Dt(f)?(e.consume(f),c):l(f)}}function Yz(e,r,l){return i;function i(u){return e.consume(u),o}function o(u){return Tt(u)?l(u):r(u)}}function Ww(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function eS(e){return!Dt(e)}function tS(e){return!(e===47||mh(e))}function mh(e){return e===43||e===45||e===46||e===95||Tt(e)}function pm(e){let r=e.length,l=!1;for(;r--;){const i=e[r][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){l=!0;break}if(i._gfmAutolinkLiteralWalkedInto){l=!1;break}}return e.length>0&&!l&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),l}const $z={tokenize:tD,partial:!0};function Xz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Jz,continuation:{tokenize:Wz},exit:eD}},text:{91:{name:"gfmFootnoteCall",tokenize:Kz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Qz,resolveTo:Zz}}}}function Qz(e,r,l){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c;for(;o--;){const d=i.events[o][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return l(d);const m=kn(i.sliceSerialize({start:c.end,end:i.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?l(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function Zz(e,r){let l=e.length;for(;l--;)if(e[l][1].type==="labelImage"&&e[l][0]==="enter"){e[l][1];break}e[l+1][1].type="data",e[l+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[l+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[l+3][1].end),end:Object.assign({},e[l+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[l+1],e[l+2],["enter",i,r],e[l+3],e[l+4],["enter",o,r],["exit",o,r],["enter",u,r],["enter",c,r],["exit",c,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",i,r]];return e.splice(l,e.length-l+1,...f),e}function Kz(e,r,l){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,c;return f;function f(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),d}function d(y){return y!==94?l(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(u>999||y===93&&!c||y===null||y===91||Ze(y))return l(y);if(y===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return o.includes(kn(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):l(y)}return Ze(y)||(c=!0),u++,e.consume(y),y===92?g:m}function g(y){return y===91||y===92||y===93?(e.consume(y),u++,m):m(y)}}function Jz(e,r,l){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,c=0,f;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):l(k)}function g(k){if(c>999||k===93&&!f||k===null||k===91||Ze(k))return l(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=kn(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Ze(k)||(f=!0),c++,e.consume(k),k===92?y:g}function y(k){return k===91||k===92||k===93?(e.consume(k),c++,g):g(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),o.includes(u)||o.push(u),Be(e,v,"gfmFootnoteDefinitionWhitespace")):l(k)}function v(k){return r(k)}}function Wz(e,r,l){return e.check(mo,r,e.attempt($z,r,l))}function eD(e){e.exit("gfmFootnoteDefinition")}function tD(e,r,l){const i=this;return Be(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const c=i.events[i.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?r(u):l(u)}}function nD(e){let l=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:o};return l==null&&(l=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},y={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},b=[["enter",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",y,f]],v=f.parser.constructs.insideSpan.null;v&&ln(b,b.length,0,Bu(v,c.slice(m+1,d),f)),ln(b,b.length,0,[["exit",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",g,f]]),ln(c,m-1,d-m+3,b),d=m+b.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function u(c,f,d){const m=this.previous,g=this.events;let y=0;return b;function b(k){return m===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(c.enter("strikethroughSequenceTemporary"),v(k))}function v(k){const C=Di(m);if(k===126)return y>1?d(k):(c.consume(k),y++,v);if(y<2&&!l)return d(k);const A=c.exit("strikethroughSequenceTemporary"),N=Di(k);return A._open=!N||N===2&&!!C,A._close=!C||C===2&&!!N,f(k)}}}class rD{constructor(){this.map=[]}add(r,l,i){lD(this,r,l,i)}consume(r){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let l=this.map.length;const i=[];for(;l>0;)l-=1,i.push(r.slice(this.map[l][0]+this.map[l][1]),this.map[l][2]),r.length=this.map[l][0];i.push(r.slice()),r.length=0;let o=i.pop();for(;o;){for(const u of o)r.push(u);o=i.pop()}this.map.length=0}}function lD(e,r,l,i){let o=0;if(!(l===0&&i.length===0)){for(;o<e.map.length;){if(e.map[o][0]===r){e.map[o][1]+=l,e.map[o][2].push(...i);return}o+=1}e.map.push([r,l,i])}}function iD(e,r){let l=!1;const i=[];for(;r<e.length;){const o=e[r];if(l){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(l=!0);r+=1}return i}function aD(){return{flow:{null:{name:"table",tokenize:oD,resolveAll:sD}}}}function oD(e,r,l){const i=this;let o=0,u=0,c;return f;function f(P){let re=i.events.length-1;for(;re>-1;){const J=i.events[re][1].type;if(J==="lineEnding"||J==="linePrefix")re--;else break}const le=re>-1?i.events[re][1].type:null,se=le==="tableHead"||le==="tableRow"?z:d;return se===z&&i.parser.lazy[i.now().line]?l(P):se(P)}function d(P){return e.enter("tableHead"),e.enter("tableRow"),m(P)}function m(P){return P===124||(c=!0,u+=1),g(P)}function g(P){return P===null?l(P):we(P)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),v):l(P):Oe(P)?Be(e,g,"whitespace")(P):(u+=1,c&&(c=!1,o+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),y(P)))}function y(P){return P===null||P===124||Ze(P)?(e.exit("data"),g(P)):(e.consume(P),P===92?b:y)}function b(P){return P===92||P===124?(e.consume(P),y):y(P)}function v(P){return i.interrupt=!1,i.parser.lazy[i.now().line]?l(P):(e.enter("tableDelimiterRow"),c=!1,Oe(P)?Be(e,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):k(P))}function k(P){return P===45||P===58?A(P):P===124?(c=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),C):F(P)}function C(P){return Oe(P)?Be(e,A,"whitespace")(P):A(P)}function A(P){return P===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),N):P===45?(u+=1,N(P)):P===null||we(P)?U(P):F(P)}function N(P){return P===45?(e.enter("tableDelimiterFiller"),O(P)):F(P)}function O(P){return P===45?(e.consume(P),O):P===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(P))}function _(P){return Oe(P)?Be(e,U,"whitespace")(P):U(P)}function U(P){return P===124?k(P):P===null||we(P)?!c||o!==u?F(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(P)):F(P)}function F(P){return l(P)}function z(P){return e.enter("tableRow"),B(P)}function B(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),B):P===null||we(P)?(e.exit("tableRow"),r(P)):Oe(P)?Be(e,B,"whitespace")(P):(e.enter("data"),$(P))}function $(P){return P===null||P===124||Ze(P)?(e.exit("data"),B(P)):(e.consume(P),P===92?ae:$)}function ae(P){return P===92||P===124?(e.consume(P),$):$(P)}}function sD(e,r){let l=-1,i=!0,o=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,g,y;const b=new rD;for(;++l<e.length;){const v=e[l],k=v[1];v[0]==="enter"?k.type==="tableHead"?(f=!1,d!==0&&(nv(b,r,d,m,g),g=void 0,d=0),m={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(l,0,[["enter",m,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],c=[0,l+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(l,0,[["enter",g,r]])),o=k.type==="tableDelimiterRow"?2:g?3:1):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(i=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],y=Gs(b,r,u,o,void 0,y),u=[0,0,0,0]),c[2]=l)):k.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(c[0]=c[1],y=Gs(b,r,u,o,void 0,y)),u=c,c=[u[1],l,0,0])):k.type==="tableHead"?(f=!0,d=l):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=l,u[1]!==0?(c[0]=c[1],y=Gs(b,r,u,o,l,y)):c[1]!==0&&(y=Gs(b,r,c,o,l,y)),o=0):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=l)}for(d!==0&&nv(b,r,d,m,g),b.consume(r.events),l=-1;++l<r.events.length;){const v=r.events[l];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=iD(r.events,l))}return e}function Gs(e,r,l,i,o,u){const c=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";l[0]!==0&&(u.end=Object.assign({},Ai(r.events,l[0])),e.add(l[0],0,[["exit",u,r]]));const d=Ai(r.events,l[1]);if(u={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(l[1],0,[["enter",u,r]]),l[2]!==0){const m=Ai(r.events,l[2]),g=Ai(r.events,l[3]),y={type:f,start:Object.assign({},m),end:Object.assign({},g)};if(e.add(l[2],0,[["enter",y,r]]),i!==2){const b=r.events[l[2]],v=r.events[l[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",l[3]>l[2]+1){const k=l[2]+1,C=l[3]-l[2]-1;e.add(k,C,[])}}e.add(l[3]+1,0,[["exit",y,r]])}return o!==void 0&&(u.end=Object.assign({},Ai(r.events,o)),e.add(o,0,[["exit",u,r]]),u=void 0),u}function nv(e,r,l,i,o){const u=[],c=Ai(r.events,l);o&&(o.end=Object.assign({},c),u.push(["exit",o,r])),i.end=Object.assign({},c),u.push(["exit",i,r]),e.add(l+1,0,u)}function Ai(e,r){const l=e[r],i=l[0]==="enter"?"start":"end";return l[1][i]}const uD={name:"tasklistCheck",tokenize:fD};function cD(){return{text:{91:uD}}}function fD(e,r,l){const i=this;return o;function o(d){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?l(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return Ze(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):l(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):l(d)}function f(d){return we(d)?r(d):Oe(d)?e.check({tokenize:dD},r,l)(d):l(d)}}function dD(e,r,l){return Be(e,i,"whitespace");function i(o){return o===null?l(o):r(o)}}function hD(e){return dw([Uz(),Xz(),nD(e),aD(),cD()])}const mD={};function Bi(e){const r=this,l=e||mD,i=r.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),c=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(hD(l)),u.push(zz()),c.push(Dz(l))}function pD({content:e}){return x.jsx("div",{className:"flex gap-2 justify-end",children:x.jsx("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e})})})}function gD({json:e}){return x.jsx("div",{className:"flex gap-3 justify-start",children:x.jsx("div",{className:"flex-1 max-w-[90%]",children:x.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function nS({title:e,count:r,children:l,badge:i}){const[o,u]=S.useState(!1);return r===0?null:x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>u(!o),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[x.jsx(Kr,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),x.jsx("span",{className:"text-muted-foreground font-medium",children:e}),x.jsx("span",{className:"text-muted-foreground/60",children:r}),i]}),o&&x.jsx("div",{className:"ml-5",children:l})]})}function Hd({title:e,items:r,icon:l,getIcon:i}){return r.length===0?null:x.jsx(nS,{title:e,count:r.length,children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(o=>x.jsx(Z1,{icon:i?i(o):l,children:o},o))})})}function yD(e){const r=e.match(/^mcp__([^_]+)__(.+)$/);return r?{server:r[1],tool:r[2]}:null}function rS({status:e}){const r=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return x.jsx("span",{className:xe("inline-block h-2 w-2 rounded-full shrink-0",r)})}function xD(e){switch(e){case"connected":return"Connected";case"failed":return"Failed";case"needs-auth":return"Needs auth";case"pending":return"Connecting...";case"disabled":return"Disabled";default:return e}}function rv({server:e}){const[r,l]=S.useState(!1),i=e.status==="connected";return x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>i&&e.tools.length>0&&l(!r),className:xe("flex items-center gap-1.5",i&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[i&&e.tools.length>0&&x.jsx(Kr,{className:xe("h-3 w-3 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),x.jsx(rS,{status:e.status}),x.jsx("span",{className:"text-muted-foreground font-medium",children:jl(e.name)}),i?x.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):x.jsx("span",{className:"text-muted-foreground/50",children:xD(e.status)})]}),!i&&e.error&&x.jsx("span",{className:"text-destructive ml-5",children:e.error}),r&&e.tools.length>0&&x.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(o=>x.jsx(Z1,{icon:Q1(`mcp__${e.name}__${o}`),children:o},o))})]})}function bD({servers:e}){if(e.length===0)return null;const r=e.filter(o=>o.status==="connected"),l=e.filter(o=>o.status!=="connected"),i=l.length>0?x.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[x.jsx(rS,{status:"failed"}),x.jsxs("span",{className:"text-muted-foreground/60",children:[l.length," disconnected"]})]}):null;return x.jsx(nS,{title:"MCP Servers",count:e.length,badge:i,children:x.jsxs("div",{className:"flex flex-col gap-2",children:[r.map(o=>x.jsx(rv,{server:o},o.name)),l.map(o=>x.jsx(rv,{server:o},o.name))]})})}function vD({rawJson:e}){const[r,l]=S.useState(!1);return x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("button",{onClick:()=>l(!r),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[x.jsx(Kr,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),x.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),r&&x.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function wD({message:e,rawJson:r}){const{coreTools:l,mcpServersWithTools:i}=S.useMemo(()=>{const o=new Map,u=[];for(const f of e.tools){const d=yD(f);if(d){const m=o.get(d.server)||[];m.push(d.tool),o.set(d.server,m)}else u.push(f)}const c=e.mcpServers.map(f=>({name:f.name,status:f.status,error:f.error,tools:o.get(f.name)||[]}));return{coreTools:u,mcpServersWithTools:c}},[e.tools,e.mcpServers]);return x.jsx(ll,{children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsxs("div",{className:"flex flex-col gap-3",children:[x.jsx(IR,{children:e.model}),x.jsx(Hd,{title:"Tools",items:l,getIcon:o=>nh[o]??X1}),x.jsx(Hd,{title:"Agents",items:e.agents,icon:Bh}),x.jsx(Hd,{title:"Commands",items:e.slashCommands,icon:eT}),x.jsx(bD,{servers:i}),r&&x.jsx(vD,{rawJson:r})]})}),children:[x.jsx(WA,{className:"h-5 w-5 text-logo"}),x.jsx(el,{children:"Session Started"})]})})}function SD({message:e}){return x.jsx(ll,{className:"hidden",children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[x.jsx("div",{className:"size-5 flex justify-center items-center ",children:x.jsx(Bh,{className:"h-4 w-4 text-muted-foreground"})}),x.jsx(el,{children:"Account"})]})})}function kD({message:e}){return x.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e.text})})}function CD({question:e,currentIndex:r,totalQuestions:l,onBack:i,children:o}){const u=i&&r>0;return x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("div",{className:"relative",children:[x.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[u?x.jsx("button",{onClick:i,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:x.jsx(fj,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):l>1?x.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[r+1," of ",l]}):null,e]}),l>1&&x.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:x.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${r/l*100}%`}})})]}),o]})}function lv({label:e,description:r}){return x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-foreground text-sm",children:e}),r&&x.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r})]})}function lS({selected:e,multiSelect:r,onClick:l}){return x.jsx("button",{type:"button",onClick:l,className:xe("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",r?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",l&&e&&"cursor-pointer"),children:e&&x.jsx(_l,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function ED({option:e,selected:r,multiSelect:l,onClick:i,isLast:o}){const u="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",c=o?"":"border-b border-border";return i?x.jsx("button",{onClick:i,className:xe(u,c,"transition-all cursor-pointer"),children:x.jsxs("div",{className:"flex items-center justify-between gap-3",children:[x.jsx("div",{className:"flex-1 min-w-0",children:x.jsx(lv,{label:e.label,description:e.description})}),x.jsx(lS,{selected:r,multiSelect:l})]})}):x.jsx("div",{className:xe(u,c),children:x.jsx(lv,{label:e.label,description:e.description})})}function ND(e){if(e)try{return JSON.parse(e).answers}catch{return}}function AD({message:e,onSubmit:r,isLatest:l}){var le,se;const i=((le=e.input)==null?void 0:le.questions)||[],o=!!e.result,u=ND(e.result),[c,f]=S.useState(0),[d,m]=S.useState({}),[g,y]=S.useState({}),[b,v]=S.useState(o),k=(J,Z)=>{var ie;const D=(ie=g[J])==null?void 0:ie.trim(),X=d[J]||"",ne=i.find(j=>j.question===J);return ne!=null&&ne.multiSelect?[X,D].filter(Boolean).join(", "):D||X},C=J=>{const Z=d[J.question]||"";return J.multiSelect?Z.split(", ").filter(Boolean):[Z]},A=(J,Z)=>{const D=J.question;if(J.multiSelect){const X=d[D]?d[D].split(", ").filter(Boolean):[],ne=X.includes(Z)?X.filter(ie=>ie!==Z):[...X,Z];m({...d,[D]:ne.join(", ")})}else m({...d,[D]:Z}),y({...g,[D]:""}),c<i.length-1&&setTimeout(()=>f(c+1),150)},N=(J,Z)=>{const D=J.question;y({...g,[D]:Z}),Z&&!J.multiSelect&&m({...d,[D]:""})},O=J=>{J.multiSelect&&g[J.question]&&y({...g,[J.question]:""})},_=i.every(J=>k(J.question).length>0),U=i[c],F=c===i.length-1,z=U&&k(U.question).length>0,B=()=>{c<i.length-1&&f(c+1)},$=()=>{c>0&&f(c-1)},ae=()=>{if(!_)return;const J={};for(const Z of i)J[Z.question]=k(Z.question);m(J),v(!0),r(e.toolId,i,J)};if(b||o){const J=u||d;return x.jsx("div",{className:"w-full",children:x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[x.jsxs("p",{children:["Question",i.length!==1?"s":""]}),x.jsx("p",{className:"",children:"Answers"})]}),i.map((Z,D)=>{const X=J[Z.question]||"",ne=D===i.length-1;return x.jsxs("div",{className:xe("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!ne&&"border-b border-border"),children:[x.jsx("span",{className:"text-sm",children:Z.question}),X&&x.jsx("span",{className:"text-sm font-medium text-right",children:X}),!X&&x.jsx("span",{className:"text-sm font-medium text-right italic",children:"No Response"})]},Z.question)})]})})}if(!l)return x.jsx("div",{className:"w-full py-2",children:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(D0,{className:"h-4 w-4 text-muted-foreground"}),x.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!U)return null;const P=C(U),re=g[U.question]||"";return x.jsxs("div",{className:"w-full space-y-3",children:[x.jsxs(CD,{question:U.question,currentIndex:c,totalQuestions:i.length,onBack:c>0?$:void 0,children:[(se=U.options)==null?void 0:se.map(J=>x.jsx(ED,{option:J,selected:P.includes(J.label),multiSelect:U.multiSelect,onClick:()=>A(U,J.label)},J.label)),x.jsx("div",{className:"transition-all bg-background",children:x.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[x.jsx("input",{type:"text",value:re,onChange:J=>N(U,J.target.value),placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),x.jsx(lS,{selected:!!re,multiSelect:U.multiSelect,onClick:U.multiSelect&&re?()=>O(U):void 0})]})})]}),x.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!F&&z&&(U.multiSelect||!!re)&&x.jsx(qe,{size:"sm",onClick:B,children:"Next"}),F&&x.jsx(qe,{size:"sm",onClick:ae,disabled:!_,className:xe(!_&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function jD({message:e,onConfirm:r}){const l=!!e.result,[i,o]=S.useState(!1),[u,c]=S.useState(!1),[f,d]=S.useState(!1),[m,g]=S.useState(""),y=S.useRef(null),b=e.input;S.useEffect(()=>{f&&y.current&&y.current.focus()},[f]);const v=async()=>{b!=null&&b.plan&&(await navigator.clipboard.writeText(b.plan),c(!0),setTimeout(()=>c(!1),2e3))},k=(()=>{if(!l)return null;try{return JSON.parse(e.result||"{}")}catch{return{}}})();return x.jsxs("div",{className:"flex flex-col gap-3",children:[x.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(b==null?void 0:b.plan)&&x.jsx(qe,{variant:"ghost",size:"icon",className:xe("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!u&&"hover:text-foreground",u&&"hover:!bg-transparent hover:!border-transparent"),onClick:v,children:u?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})}),x.jsxs("div",{className:xe("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",l&&!i?"max-h-[min(400px,40vh)] ":"",l?"hover:!pb-[32px]":""),children:[l&&x.jsxs(qe,{variant:"ghost",className:"absolute z-10 bottom-2 pr-2.5 !pl-3.5 h-[34px] inline-flex gap-1 text-sm left-[50%] -translate-x-[50%] text-muted-foreground backdrop-blur-sm hover:text-foreground opacity-0 group-hover/plan:opacity-100 transition-all rounded-full border border-border",onClick:()=>o(!i),children:[i?"Show Less":"Show More",x.jsx(uj,{className:`size-3.5 transition-transform ${i?"rotate-180":""}`})]}),b!=null&&b.plan?x.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:b.plan}),x.jsx("div",{className:"mt-5"})]}):x.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),l?x.jsx("div",{className:"flex justify-end mx-2",children:x.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[x.jsx("em",{children:k!=null&&k.clearContext?"Approved & Cleared Context":k!=null&&k.confirmed?"Approved":k!=null&&k.message?`Adjusted: "${k.message}"`:"Adjusted Plan"}),x.jsx(Sj,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):x.jsxs("div",{className:"flex flex-col gap-3",children:[!f&&x.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[x.jsxs(qe,{size:"sm",onClick:()=>r(e.toolId,!0,!0),className:"rounded-full bg-primary text-background pr-4 md:order-last",children:[x.jsx(lj,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),x.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[x.jsxs(qe,{size:"sm",variant:"outline",onClick:()=>d(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[x.jsx(B0,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),x.jsxs(qe,{size:"sm",variant:"outline",onClick:()=>r(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[x.jsx(_l,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),f&&x.jsxs("div",{className:"flex flex-col gap-2",children:[x.jsx("textarea",{ref:y,value:m,onChange:C=>g(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!C.shiftKey&&m.trim()&&(C.preventDefault(),r(e.toolId,!1,void 0,m.trim())),C.key==="Escape"&&(d(!1),g(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),x.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[x.jsx(qe,{size:"sm",variant:"ghost",onClick:()=>{d(!1),g("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),x.jsxs(qe,{size:"sm",disabled:!m.trim(),onClick:()=>r(e.toolId,!1,void 0,m.trim()),className:"rounded-full bg-primary text-background disabled:opacity-50 disabled:pointer-events-none",children:[x.jsx(Jj,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]})]})}const TD={completed:{Icon:_l,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:zl,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:gj,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function _D({message:e}){const r=e.input.todos??[];return r.length?x.jsx("div",{className:"w-full",children:x.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[x.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[x.jsx(Uj,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),x.jsx("div",{children:r.map((l,i)=>{const o=i===r.length-1,{Icon:u,iconClass:c,textClass:f}=TD[l.status];return x.jsxs("div",{className:xe("flex items-center gap-3 px-4 py-2.5 bg-background",!o&&"border-b border-border"),children:[x.jsx(u,{className:xe("h-4 w-4 flex-shrink-0",c)}),x.jsx("span",{className:xe("text-sm",f),children:l.status==="in_progress"?l.activeForm:l.content})]},i)})})]})}):null}function Pd(e,r){if(!e)return"";if(r){const l=r.endsWith("/")?r:`${r}/`;if(e.startsWith(l))return e.slice(l.length);if(e===r)return""}return e.replace(/^\/home\/user\/workspace\//,"")}function RD(e,r){if(e){if(r){const l=`${r}/outputs`;if(e.startsWith(l))return e.slice(l.length)}return e.replace(/^\/home\/user\/workspace\/outputs/,"")||void 0}}function MD(e){const r=e.split(`
413
+ `),l=/^\s*(\d+)→(.*)$/;return r.map(i=>{const o=i.match(l);return o?{lineNumber:parseInt(o[1],10),content:o[2]}:{lineNumber:null,content:i}})}function OD(e){return e.replace(/<[^>]+>/g,"")}function zD(e,r){const l=e.split(`
414
414
  `),i=r.split(`
415
- `),o=MD(l,i),u=OD(l,i,o);return zD(u)}function MD(e,r){const l=e.length,i=r.length,o=Array.from({length:l+1},()=>Array(i+1).fill(0));for(let u=1;u<=l;u++)for(let c=1;c<=i;c++)o[u][c]=e[u-1]===r[c-1]?o[u-1][c-1]+1:Math.max(o[u-1][c],o[u][c-1]);return o}function OD(e,r,l){const i=[];let o=e.length,u=r.length;for(;o>0||u>0;)o>0&&u>0&&e[o-1]===r[u-1]?(i.push({type:"context",text:e[o-1],oldIdx:o,newIdx:u}),o--,u--):u>0&&(o===0||l[o][u-1]>=l[o-1][u])?(i.push({type:"added",text:r[u-1],oldIdx:o,newIdx:u}),u--):(i.push({type:"removed",text:e[o-1],oldIdx:o,newIdx:u}),o--);return i.reverse()}function zD(e){return e.map(r=>{const l=r.type==="removed"?"-":r.type==="added"?"+":" ";return{type:r.type,content:`${l}${r.text}`}})}function qd({content:e,isDiff:r=!1,oldString:l,newString:i}){const o=S.useMemo(()=>r&&l&&i?RD(l,i):[],[r,l,i]),u=S.useMemo(()=>r?[]:TD(e),[e,r]),c=S.useMemo(()=>u.some(f=>f.lineNumber!==null),[u]);return r&&o.length>0?x.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:x.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:x.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:x.jsx("tbody",{children:o.map((f,d)=>{const m=f.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":f.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=f.type==="removed"?"text-red-700 dark:text-red-400":f.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return x.jsxs("tr",{className:m,children:[x.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${f.type==="removed"?"text-red-500/50":f.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:f.type==="removed"?"-":f.type==="added"?"+":" "}),x.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:f.content.slice(1)})]},d)})})})})}):x.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:x.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:x.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:x.jsx("tbody",{children:u.map((f,d)=>x.jsxs("tr",{children:[c&&x.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:f.lineNumber!==null?f.lineNumber:""}),x.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:_D(f.content)})]},d))})})})})}function DD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function iS({message:e,isLoading:r=!1,outputsUrl:l,localPath:i}){var U;const o=e.result!==void 0,u=!o&&r,c=S.useMemo(()=>{if(e.toolName==="Skill")return e.input.skill;if(e.toolName==="Glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolName==="Grep"){const B=e.input.pattern,$=e.input.output_mode;return $==="count"?`Count \`${B}\` occurrences`:$==="content"?`Find \`${B}\` in text`:`Find \`${B}\` in files`}if(e.toolName==="Bash")return`${e.input.description||e.input.command||"Bash"}`;if(e.toolName==="WebSearch")return e.input.query||"Web Search";if(e.toolName==="Read")return`Read ${Pd(e.input.file_path,i)}`;if(e.toolName==="Write")return`Write ${Pd(e.input.file_path,i)}`;if(e.toolName==="Edit")return`Edit ${Pd(e.input.file_path,i)}`;if(e.toolName==="mcp__lever__read_db_context"){const B=e.input.connection_name;return B?`Read ${jl(B)} Context`:"Read DB Context"}if(e.toolName==="mcp__lever__edit_db_context"){const B=e.input.connection_name;return B?`Edit ${jl(B)} Context`:"Edit DB Context"}if(e.toolName==="mcp__lever__write_db_context"){const B=e.input.connection_name;return B?`Update ${jl(B)} Context`:"Update DB Context"}const F=e.toolName.match(/^mcp__db__(.+)_query$/);if(F){const B=e.input.description;return B?`${B} from ${jl(F[1])}`:`Query ${F[1]}`}const z=e.toolName.match(/^mcp__(.+?)__(.+)$/);return z?`${jl(z[2])} from ${jl(z[1])}`:e.input.subagent_type||e.toolName},[e.input,e.toolName,i]),f=S.useMemo(()=>e.input.subagent_type!==void 0,[e.input]),d=S.useMemo(()=>{if(e.toolName==="Skill")return e.input.skill},[e.input,e.toolName]),m=e.toolName==="Bash",g=/^mcp__db__.+_query$/.test(e.toolName),y=e.toolName==="Write",b=e.toolName==="mcp__lever__write_db_context",v=e.toolName==="mcp__lever__edit_db_context",k=e.toolName==="Edit",C=e.toolName==="Read",A=e.toolName==="mcp__lever__read_db_context",{result:N,outputFile:O}=S.useMemo(()=>{let F={};if(typeof e.result=="string")try{F=JSON.parse(e.result)}catch{F={output:e.result}}else F=e.result??{};return{result:F,outputFile:jD(F.fullOutputFile,i)}},[e.result,i]),_=S.useMemo(()=>{if(!A||!e.result)return"";try{const F=typeof e.result=="string"?JSON.parse(e.result):e.result;if(Array.isArray(F))return F.map(z=>z.text).join(`
416
- `)}catch{}return typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)},[e.result,A]);return x.jsx(ll,{className:"w-full",children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-sm",children:x.jsxs("div",{className:"flex flex-col gap-2",children:[b?x.jsxs("div",{children:[x.jsxs("span",{className:"font-medium text-muted-foreground",children:["Context (",(e.input.context.length/1e3).toFixed(1),"/20kb)"]}),x.jsx("div",{className:"my-1 max-h-64 md:max-h-[50vh] overflow-auto rounded-lg border border-border bg-muted p-3 prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:e.input.context})})]}):k?x.jsx(qd,{content:"",isDiff:!0,oldString:e.input.old_string,newString:e.input.new_string}):v?x.jsxs("div",{className:"flex flex-col gap-2",children:[x.jsx(qa,{label:"Find",copyText:e.input.old_string,children:e.input.old_string}),x.jsx(qa,{label:"Replace",copyText:e.input.new_string,children:e.input.new_string})]}):!C&&!y&&x.jsx(qa,{label:m?x.jsxs("span",{className:"flex items-center gap-2 w-full",children:[x.jsx("span",{children:"Command"}),!!e.input.timeout&&x.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeout),"ms"]}),!!e.input.run_in_background&&x.jsx("span",{className:"text-muted-foreground",children:"background"})]}):g?x.jsxs("span",{className:"flex items-center gap-2 w-full",children:[x.jsx("span",{children:"Query"}),!!e.input.timeout&&x.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeout),"s"]})]}):y?"Contents":"Input",copyText:m?e.input.command:g?e.input.query:y?e.input.content:JSON.stringify(e.input,null,2),children:m?e.input.command:g?e.input.query:y?e.input.content:JSON.stringify(e.input,null,2)}),o&&A&&x.jsxs("div",{children:[x.jsxs("span",{className:"font-medium text-muted-foreground",children:["Context (",(_.length/1e3).toFixed(1),"/20kb)"]}),x.jsx("div",{className:"my-1 max-h-64 md:max-h-[50vh] overflow-auto rounded-lg border border-border bg-muted p-3 prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:_})})]}),o&&C&&!e.isError&&x.jsx(qd,{content:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)}),y&&!e.isError&&x.jsx(qd,{content:e.input.content}),o&&!g&&!A&&!C&&!(y&&!e.isError)&&!(k&&!e.isError)&&x.jsx(qa,{label:e.isError?"Error":"Result",copyText:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2),children:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)}),o&&g&&x.jsx(qa,{label:e.isError?"Error":x.jsxs("span",{className:"flex items-center justify-between w-full",children:[x.jsxs("span",{children:["Preview",N.isOutputTruncated?" (~25kb)":""]}),O&&l&&x.jsxs("a",{href:`${l}/api/file?path=${encodeURIComponent(O)}`,download:!0,onClick:F=>F.stopPropagation(),target:"_blank",className:"text-muted-foreground hover:text-foreground transition-colors",children:["Download (",DD(N.fullOutputLength),")"]})]}),copyText:N.output.replaceAll("\\n",`
415
+ `),o=DD(l,i),u=LD(l,i,o);return BD(u)}function DD(e,r){const l=e.length,i=r.length,o=Array.from({length:l+1},()=>Array(i+1).fill(0));for(let u=1;u<=l;u++)for(let c=1;c<=i;c++)o[u][c]=e[u-1]===r[c-1]?o[u-1][c-1]+1:Math.max(o[u-1][c],o[u][c-1]);return o}function LD(e,r,l){const i=[];let o=e.length,u=r.length;for(;o>0||u>0;)o>0&&u>0&&e[o-1]===r[u-1]?(i.push({type:"context",text:e[o-1],oldIdx:o,newIdx:u}),o--,u--):u>0&&(o===0||l[o][u-1]>=l[o-1][u])?(i.push({type:"added",text:r[u-1],oldIdx:o,newIdx:u}),u--):(i.push({type:"removed",text:e[o-1],oldIdx:o,newIdx:u}),o--);return i.reverse()}function BD(e){return e.map(r=>{const l=r.type==="removed"?"-":r.type==="added"?"+":" ";return{type:r.type,content:`${l}${r.text}`}})}function qd({content:e,isDiff:r=!1,oldString:l,newString:i}){const o=S.useMemo(()=>r&&l&&i?zD(l,i):[],[r,l,i]),u=S.useMemo(()=>r?[]:MD(e),[e,r]),c=S.useMemo(()=>u.some(f=>f.lineNumber!==null),[u]);return r&&o.length>0?x.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:x.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:x.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:x.jsx("tbody",{children:o.map((f,d)=>{const m=f.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":f.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",g=f.type==="removed"?"text-red-700 dark:text-red-400":f.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return x.jsxs("tr",{className:m,children:[x.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${f.type==="removed"?"text-red-500/50":f.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:f.type==="removed"?"-":f.type==="added"?"+":" "}),x.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${g}`,children:f.content.slice(1)})]},d)})})})})}):x.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:x.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:x.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:x.jsx("tbody",{children:u.map((f,d)=>x.jsxs("tr",{children:[c&&x.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:f.lineNumber!==null?f.lineNumber:""}),x.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:OD(f.content)})]},d))})})})})}function UD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function iS({message:e,isLoading:r=!1,outputsUrl:l,localPath:i}){var U;const o=e.result!==void 0,u=!o&&r,c=S.useMemo(()=>{if(e.toolName==="Skill")return e.input.skill;if(e.toolName==="Glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolName==="Grep"){const B=e.input.pattern,$=e.input.output_mode;return $==="count"?`Count \`${B}\` occurrences`:$==="content"?`Find \`${B}\` in text`:`Find \`${B}\` in files`}if(e.toolName==="Bash")return`${e.input.description||e.input.command||"Bash"}`;if(e.toolName==="WebSearch")return e.input.query||"Web Search";if(e.toolName==="Read")return`Read ${Pd(e.input.file_path,i)}`;if(e.toolName==="Write")return`Write ${Pd(e.input.file_path,i)}`;if(e.toolName==="Edit")return`Edit ${Pd(e.input.file_path,i)}`;if(e.toolName==="mcp__lever__read_db_context"){const B=e.input.connection_name;return B?`Read ${jl(B)} Context`:"Read DB Context"}if(e.toolName==="mcp__lever__edit_db_context"){const B=e.input.connection_name;return B?`Edit ${jl(B)} Context`:"Edit DB Context"}if(e.toolName==="mcp__lever__write_db_context"){const B=e.input.connection_name;return B?`Update ${jl(B)} Context`:"Update DB Context"}const F=e.toolName.match(/^mcp__db__(.+)_query$/);if(F){const B=e.input.description;return B?`${B} from ${jl(F[1])}`:`Query ${F[1]}`}const z=e.toolName.match(/^mcp__(.+?)__(.+)$/);return z?`${jl(z[2])} from ${jl(z[1])}`:e.input.subagent_type||e.toolName},[e.input,e.toolName,i]),f=S.useMemo(()=>e.input.subagent_type!==void 0,[e.input]),d=S.useMemo(()=>{if(e.toolName==="Skill")return e.input.skill},[e.input,e.toolName]),m=e.toolName==="Bash",g=/^mcp__db__.+_query$/.test(e.toolName),y=e.toolName==="Write",b=e.toolName==="mcp__lever__write_db_context",v=e.toolName==="mcp__lever__edit_db_context",k=e.toolName==="Edit",C=e.toolName==="Read",A=e.toolName==="mcp__lever__read_db_context",{result:N,outputFile:O}=S.useMemo(()=>{let F={};if(typeof e.result=="string")try{F=JSON.parse(e.result)}catch{F={output:e.result}}else F=e.result??{};return{result:F,outputFile:RD(F.fullOutputFile,i)}},[e.result,i]),_=S.useMemo(()=>{if(!A||!e.result)return"";try{const F=typeof e.result=="string"?JSON.parse(e.result):e.result;if(Array.isArray(F))return F.map(z=>z.text).join(`
416
+ `)}catch{}return typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)},[e.result,A]);return x.jsx(ll,{className:"w-full",children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-sm",children:x.jsxs("div",{className:"flex flex-col gap-2",children:[b?x.jsxs("div",{children:[x.jsxs("span",{className:"font-medium text-muted-foreground",children:["Context (",(e.input.context.length/1e3).toFixed(1),"/20kb)"]}),x.jsx("div",{className:"my-1 max-h-64 md:max-h-[50vh] overflow-auto rounded-lg border border-border bg-muted p-3 prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:e.input.context})})]}):k?x.jsx(qd,{content:"",isDiff:!0,oldString:e.input.old_string,newString:e.input.new_string}):v?x.jsxs("div",{className:"flex flex-col gap-2",children:[x.jsx(qa,{label:"Find",copyText:e.input.old_string,children:e.input.old_string}),x.jsx(qa,{label:"Replace",copyText:e.input.new_string,children:e.input.new_string})]}):!C&&!y&&x.jsx(qa,{label:m?x.jsxs("span",{className:"flex items-center gap-2 w-full",children:[x.jsx("span",{children:"Command"}),!!e.input.timeout&&x.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeout),"ms"]}),!!e.input.run_in_background&&x.jsx("span",{className:"text-muted-foreground",children:"background"})]}):g?x.jsxs("span",{className:"flex items-center gap-2 w-full",children:[x.jsx("span",{children:"Query"}),!!e.input.timeout&&x.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeout),"s"]})]}):y?"Contents":"Input",copyText:m?e.input.command:g?e.input.query:y?e.input.content:JSON.stringify(e.input,null,2),children:m?e.input.command:g?e.input.query:y?e.input.content:JSON.stringify(e.input,null,2)}),o&&A&&x.jsxs("div",{children:[x.jsxs("span",{className:"font-medium text-muted-foreground",children:["Context (",(_.length/1e3).toFixed(1),"/20kb)"]}),x.jsx("div",{className:"my-1 max-h-64 md:max-h-[50vh] overflow-auto rounded-lg border border-border bg-muted p-3 prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:rh,children:_})})]}),o&&C&&!e.isError&&x.jsx(qd,{content:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)}),y&&!e.isError&&x.jsx(qd,{content:e.input.content}),o&&!g&&!A&&!C&&!(y&&!e.isError)&&!(k&&!e.isError)&&x.jsx(qa,{label:e.isError?"Error":"Result",copyText:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2),children:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)}),o&&g&&x.jsx(qa,{label:e.isError?"Error":x.jsxs("span",{className:"flex items-center justify-between w-full",children:[x.jsxs("span",{children:["Preview",N.isOutputTruncated?" (~25kb)":""]}),O&&l&&x.jsxs("a",{href:`${l}/api/file?path=${encodeURIComponent(O)}`,download:!0,onClick:F=>F.stopPropagation(),target:"_blank",className:"text-muted-foreground hover:text-foreground transition-colors",children:["Download (",UD(N.fullOutputLength),")"]})]}),copyText:N.output.replaceAll("\\n",`
417
417
  `),children:N.output.replaceAll("\\n",`
418
- `)})]})}),children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return x.jsx(so,{className:"size-4 text-destructive"});if(f)return x.jsx(Bh,{className:"size-4 text-muted-icon"});const F=Q1(e.toolName);return x.jsx(F,{className:"size-4 text-muted-icon"})})()}),x.jsx(el,{className:"text-left transition-opacity duration-200 truncate",children:x.jsx(Ru,{animate:u,shimmerWidth:Math.max(20,((U=d||c)==null?void 0:U.length)??99),children:d||c})})]})})}function LD({message:e}){const r=l=>{if(l<1e3)return`${l}ms`;const i=Math.floor(l/1e3),o=Math.floor(i/3600),u=Math.floor(i%3600/60),c=i%60;return o>0?`${o}h${u>0?` ${u}m`:""}`:u>0?`${u}m${c>0?` ${c}s`:""}`:`${c}s`};return x.jsxs(ll,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[x.jsx("div",{className:"w-full h-[1px] bg-border"}),x.jsxs(el,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",r(e.durationMs)]}),x.jsx("div",{className:"w-full h-[1px] bg-border"})]})}function BD({message:e}){return x.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:x.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[x.jsx(mj,{className:"h-4 w-4 ml-1.5"}),x.jsx("em",{children:"Interrupted"})]})})}function mu({size:e=4}){return x.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[x.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:x.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),x.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function UD(){return x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(mu,{}),x.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),x.jsx(mu,{})]})}function HD(){return x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(mu,{}),x.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),x.jsx(mu,{})]})}function PD({message:e}){return x.jsx(ll,{children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e.summary})})}),children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(L0,{className:"h-4.5 w-4.5 text-muted-foreground"})}),x.jsx(el,{children:"Summarized"})]})})}const qD={compacting:"Compacting..."};function FD({message:e}){const r=qD[e.status]||e.status;return x.jsxs(ll,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(L0,{className:"h-4.5 w-4.5 text-muted-foreground"})}),x.jsx(el,{className:"text-left transition-opacity duration-200 truncate",children:r})]})}const iv={Read:{key:"read",singular:"read",plural:"reads"},Edit:{key:"edit",singular:"edit",plural:"edits"},Write:{key:"write",singular:"write",plural:"writes"},Bash:{key:"bash",singular:"command",plural:"commands"},Grep:{key:"grep",singular:"search",plural:"searches"},Glob:{key:"glob",singular:"glob",plural:"globs"},Task:{key:"task",singular:"agent",plural:"agents"},WebFetch:{key:"webfetch",singular:"fetch",plural:"fetches"},WebSearch:{key:"websearch",singular:"web search",plural:"web searches"},Skill:{key:"skill",singular:"skill",plural:"skills"},TodoWrite:{key:"todo",singular:"todo update",plural:"todo updates"}},VD={key:"dbquery",singular:"query",plural:"queries"},ID={key:"other",singular:"tool call",plural:"tool calls"};function GD(e){return iv[e]?iv[e]:/^mcp__db__.+_query$/.test(e)?VD:ID}function YD(e){const r=new Map,l=[];for(const i of e){const o=i.processed.toolName,u=GD(o),c=r.get(u.key);c?c.count++:(r.set(u.key,{category:u,count:1}),l.push(u.key))}return l.map(i=>{const{category:o,count:u}=r.get(i);return`${u} ${u===1?o.singular:o.plural}`}).join(", ")}function $D({messages:e,isLoading:r,outputsUrl:l,localPath:i}){const[o,u]=S.useState(!1),c=S.useMemo(()=>YD(e),[e]),d=e.some(m=>m.processed.result===void 0)&&r;return x.jsx(ll,{className:"w-full",children:x.jsxs("div",{className:"flex flex-col w-full",children:[x.jsx("button",{onClick:()=>u(!o),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!o&&!d?"hover:opacity-60 transition-opacity":""}`,children:x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(Kr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${o?"rotate-90":""}`})}),x.jsx(el,{className:"text-left",children:x.jsx(Ru,{animate:d,children:c})})]})}),o&&x.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(m=>x.jsx(iS,{message:m.processed,isLoading:r,outputsUrl:l,localPath:i},m.id)),e.length>5&&x.jsx("button",{onClick:()=>u(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(Kr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),x.jsx(el,{className:"text-left",children:"Collapse"})]})})]})]})})}const XD=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function av(e){var l;if(((l=e.processed)==null?void 0:l.kind)!=="tool")return!1;const r=e.processed.toolName;return!XD.has(r)}function QD(e){const r=[];let l=0;for(;l<e.length;){const i=e[l];if(av(i)){const o=[i],u=l;for(l+=1;l<e.length&&av(e[l]);)o.push(e[l]),l+=1;o.length>=2?r.push({type:"tool-group",messages:o,startIndex:u}):r.push({type:"single",message:i,index:u});continue}r.push({type:"single",message:i,index:l}),l+=1}return r}function ZD({messages:e,isLoading:r,localPath:l,latestToolIds:i,onAskUserQuestionSubmit:o,onExitPlanModeConfirm:u}){const c=S.useMemo(()=>QD(e),[e]);function f(d,m){var y,b;if(d.role==="user")return x.jsx(dD,{content:d.content},d.id);const g=d.processed;if(!g)return x.jsx(hD,{json:d.content},d.id);switch(g.kind){case"system":return x.jsx(xD,{message:g,rawJson:d.rawJson},d.id);case"account_info":return e.findIndex(k=>{var C;return((C=k.processed)==null?void 0:C.kind)==="account_info"})===m?x.jsx(bD,{message:g},d.id):null;case"text":return x.jsx(vD,{message:g},d.id);case"tool":return g.toolName==="AskUserQuestion"?x.jsx(CD,{message:g,onSubmit:o,isLatest:g.id===i.AskUserQuestion},d.id):g.toolName==="ExitPlanMode"?x.jsx(ED,{message:g,onConfirm:u,isLatest:g.id===i.ExitPlanMode},d.id):g.toolName==="TodoWrite"?g.id!==i.TodoWrite?null:x.jsx(AD,{message:g},d.id):x.jsx(iS,{message:g,isLoading:r,localPath:l},d.id);case"result":{const v=e[m+1],k=e[m-1];return((y=v==null?void 0:v.processed)==null?void 0:y.kind)==="context_cleared"||((b=k==null?void 0:k.processed)==null?void 0:b.kind)==="context_cleared"?null:x.jsx(LD,{message:g},d.id)}case"interrupted":return x.jsx(BD,{message:g},d.id);case"compact_boundary":return x.jsx(UD,{},d.id);case"context_cleared":return x.jsx(HD,{},d.id);case"compact_summary":return x.jsx(PD,{message:g},d.id);case"status":return m===e.length-1?x.jsx(FD,{message:g},d.id):null}}return x.jsx(x.Fragment,{children:c.map(d=>{if(d.type==="tool-group")return x.jsx("div",{className:"group relative",children:x.jsx($D,{messages:d.messages,isLoading:r,localPath:l})},`group-${d.startIndex}`);const m=f(d.message,d.index);return m?x.jsx("div",{id:`msg-${d.message.id}`,className:"group relative",children:m},d.message.id):null})})}function ov(){var r,l,i;const e=Av();return x.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:x.jsxs(G1,{className:"bg-background flex-1 flex flex-col overflow-hidden border-0 rounded-none relative",children:[x.jsxs($1,{className:"flex-1 p-0 overflow-hidden relative",children:[x.jsx(HR,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,onOpenExternal:o=>{e.handleOpenExternal(o)}}),x.jsx(K1,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"h-full px-4 scroll-pt-[72px]",children:x.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",style:{paddingBottom:e.transcriptPaddingBottom},children:[e.messages.length===0?x.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[40vh] text-muted-foreground gap-4",children:[x.jsx(Qa,{strokeWidth:1.5,className:"size-8 text-muted-foreground"}),x.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs",children:"What are we making?"})]}):x.jsx(ZD,{messages:e.messages,isLoading:e.isProcessing,localPath:(r=e.runtime)==null?void 0:r.localPath,latestToolIds:e.latestToolIds,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?x.jsx(VR,{status:(l=e.runtime)==null?void 0:l.status}):null,e.commandError?x.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null,x.jsx("div",{className:"flex-1 min-h-[10vh]","aria-hidden":"true"})]})}),x.jsx("div",{style:{bottom:e.transcriptPaddingBottom-36},className:xe("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:x.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-white hover:bg-muted border border-border rounded-full aspect-square cursor-pointer text-sm text-primary hover:text-foreground dark:bg-slate-700 dark:hover:bg-slate-600 dark:text-slate-100 dark:border-slate-600",children:x.jsx($A,{className:"h-5 w-5"})})})]}),x.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:x.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:x.jsx(DR,{onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((i=e.runtime)==null?void 0:i.status)==="waiting_for_user",canCancel:e.canCancel,chatId:e.activeChatId},e.activeChatId??"new-chat")})})]})})}function KD({text:e}){const[r,l]=S.useState(!1);async function i(){await navigator.clipboard.writeText(e),l(!0),setTimeout(()=>l(!1),2e3)}return x.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void i(),children:r?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})}function sv({children:e}){return x.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[x.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[x.jsx(Kr,{className:"inline h-4 w-4 opacity-40"}),x.jsx("code",{children:e})]}),x.jsx(KD,{text:e})]})}function Ys({children:e}){return x.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function Fd({children:e}){return x.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function uv({narrow:e=!1,title:r,subtitle:l,icon:i=Oh}){return x.jsxs("div",{className:xe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[x.jsxs("div",{className:xe("flex items-center gap-3 mb-2",e&&"justify-center"),children:[x.jsx("div",{className:"p-2 pl-0 rounded-lg",children:x.jsx(i,{className:"h-6 w-6 text-muted-foreground"})}),x.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:r})]}),x.jsx("p",{className:xe("text-muted-foreground",e&&"mb-10 text-center"),children:l})]})}function Vd({icon:e,title:r,subtitle:l,iconClassName:i}){return x.jsxs("div",{className:"flex flex-col items-center gap-0",children:[x.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:x.jsx(e,{className:i||"h-8 w-8 text-muted-foreground"})}),x.jsx("span",{className:"text-sm font-medium",children:r}),x.jsx("span",{className:"text-xs text-muted-foreground",children:l})]})}function cv(){return x.jsx(QA,{className:"h-4 w-4 text-muted-foreground"})}function fv({number:e,title:r,children:l}){return x.jsx("div",{className:"flex gap-4",children:x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[x.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),x.jsx("h3",{className:"font-medium text-foreground mb-2",children:r})]}),x.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:l})]})})}function JD({localPath:e,loading:r,onClick:l}){return x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsxs("button",{className:xe("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",r&&"opacity-50 cursor-not-allowed"),disabled:r,onClick:l,children:[x.jsx(O0,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),x.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:A1(e)}),r?x.jsx(zl,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):x.jsx(Dh,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),x.jsx(no,{children:x.jsx("p",{children:e})})]})}function WD({connectionStatus:e,ready:r,snapshot:l,startingLocalPath:i,commandError:o,onOpenProject:u,onCreateProject:c}){const[f,d]=S.useState(!1),m=S.useMemo(()=>(l==null?void 0:l.projects)??[],[l==null?void 0:l.projects]),g=e==="connecting"||!r,y=e==="connected"&&r;return x.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[y?x.jsxs(x.Fragment,{children:[x.jsx(uv,{title:(l==null?void 0:l.machine.displayName)??"Local Projects",subtitle:`${zt} is connected, choose a project below to get started.`}),x.jsxs("div",{className:"w-full px-6 mb-10",children:[x.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[x.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),x.jsxs(qe,{variant:"default",size:"sm",onClick:()=>d(!0),children:[x.jsx(U0,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),m.length>0?x.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:m.map(b=>x.jsx(JD,{localPath:b.localPath,loading:i===b.localPath,onClick:()=>{u(b.localPath)}},b.localPath))}):x.jsx(Ys,{children:x.jsx("p",{className:"text-sm text-muted-foreground",children:"No Claude projects discovered yet. Open one with Claude Code or create a new project here."})}),o?x.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:o}):null]})]}):x.jsxs(x.Fragment,{children:[x.jsx(uv,{narrow:!0,icon:Jx,title:g?`Connecting ${zt}`:`Connect ${zt}`,subtitle:g?`${zt} is starting up and loading your local projects.`:`Run ${zt} directly on your machine with full access to your local files and Claude projects.`}),x.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[x.jsx(Fd,{children:"Status"}),x.jsx("div",{className:"mb-8",children:x.jsx(Ys,{children:x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(zl,{className:"h-4 w-4 text-muted-foreground animate-spin"}),x.jsx("span",{className:"text-sm text-muted-foreground",children:g?`Connecting to your local ${zt} server...`:x.jsxs(x.Fragment,{children:["Not connected. Run ",x.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:qs()})," from any terminal on this machine."]})})]})})}),g?null:x.jsxs("div",{className:"mb-10",children:[x.jsx(Fd,{children:"How it works"}),x.jsx(Ys,{children:x.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[x.jsx(Vd,{icon:Lh,title:`${zt} CLI`,subtitle:"On Your Machine"}),x.jsx(cv,{}),x.jsx(Vd,{icon:Oh,title:`${zt} Server`,subtitle:"Local WebSocket"}),x.jsx(cv,{}),x.jsx(Vd,{icon:Jx,title:`${zt} UI`,subtitle:"Project Chat"})]})})]}),g?null:x.jsxs("div",{className:"mb-10",children:[x.jsx(Fd,{children:"Setup"}),x.jsx(Ys,{children:x.jsxs("div",{className:"space-y-4",children:[x.jsxs(fv,{number:1,title:`Start ${zt}`,children:[x.jsx("p",{children:"Run this command in your terminal:"}),x.jsx(sv,{children:qs()})]}),x.jsxs(fv,{number:2,title:"Open the local UI",children:[x.jsxs("p",{children:[zt," serves the app locally and opens the Local Projects page in an app-style browser window."]}),x.jsx(sv,{children:"http://localhost:3210/local"})]}),x.jsxs("div",{className:"mt-8",children:[x.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),x.jsxs("div",{className:"space-y-3 text-sm",children:[x.jsxs("div",{className:"flex gap-4",children:[x.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:qs("").trim()}),x.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),x.jsxs("div",{className:"flex gap-4",children:[x.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:qs("--no-open")}),x.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),x.jsx(N1,{open:f,onOpenChange:d,onConfirm:b=>{c(b)}})]})}function e6(){const e=Av();return x.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:x.jsx(WD,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function t6(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Dn(){return new Date().toISOString()}function n6(e,r){var o,u,c,f;const l=t6(e),i={processed:null,rawJson:l};try{const d=JSON.parse(e);if(d.type==="user_prompt"&&d.content)return{...i,isUserMessage:!0,userContent:d.content};if(d.type==="system"&&d.subtype==="init")return{processed:{id:zn(),kind:"system",model:d.model||"unknown",tools:d.tools||[],agents:d.agents||[],slashCommands:((o=d.slash_commands)==null?void 0:o.filter(m=>!m.startsWith("._")))||[],mcpServers:d.mcp_servers||[],timestamp:Dn()},rawJson:l};if(d.type==="system"&&d.subtype==="account_info")return{processed:{id:zn(),kind:"account_info",accountInfo:d.accountInfo,timestamp:Dn()},rawJson:l};if(d.type==="assistant"&&((u=d.message)!=null&&u.content))for(const m of d.message.content){if(m.type==="text"&&m.text)return{processed:{id:zn(),kind:"text",text:m.text,timestamp:Dn()},rawJson:l};if(m.type==="tool_use"){const g={id:zn(),kind:"tool",toolName:m.name,toolId:m.id,input:m.input||{},timestamp:Dn()};return r.set(m.id,g),{processed:g,rawJson:l}}}if(d.type==="user"&&((c=d.message)!=null&&c.content)){for(const m of d.message.content)if(m.type==="tool_result"&&m.tool_use_id){const g=r.get(m.tool_use_id);if(g)return g.result=m.content||"(empty)",g.isError=m.is_error||!1,r.delete(m.tool_use_id),i}}return d.type==="result"?d.subtype==="cancelled"?{processed:{id:zn(),kind:"interrupted",timestamp:Dn()},rawJson:l}:{processed:{id:zn(),kind:"result",success:!d.is_error,result:d.result||"",durationMs:d.duration_ms||0,costUsd:d.total_cost_usd,timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="status"&&d.status?{processed:{id:zn(),kind:"status",status:d.status,timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="compact_boundary"?{processed:{id:zn(),kind:"compact_boundary",timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="context_cleared"?{processed:{id:zn(),kind:"context_cleared",timestamp:Dn()},rawJson:l}:d.type==="user"&&((f=d.message)==null?void 0:f.role)==="user"&&typeof d.message.content=="string"&&d.message.content.startsWith("This session is being continued")?{processed:{id:zn(),kind:"compact_summary",summary:d.message.content,timestamp:Dn()},rawJson:l}:i}catch{return i}}function r6(e){const r=new Map,l=[];for(const i of e){const{processed:o,rawJson:u,isUserMessage:c,userContent:f}=n6(i.message,r);if(c&&f){l.push({id:i._id,messageId:i.messageId,role:"user",content:f,timestamp:new Date(i.createdAt).toISOString(),hidden:i.hidden});continue}o!==null&&l.push({id:i._id,messageId:i.messageId,role:"assistant",content:u,timestamp:new Date(i.createdAt).toISOString(),processed:o,rawJson:u,hidden:i.hidden})}return l}const l6=["AskUserQuestion","ExitPlanMode","TodoWrite"],i6=new Set(["TodoWrite"]);function a6(e,r){var l;for(let i=e.length-1;i>=0;i-=1){const o=e[i];if(((l=o.processed)==null?void 0:l.kind)!=="tool")continue;const u=o.processed;if(u.toolName===r&&!u.result)return u.id}return null}function o6(e,r){var l;for(let i=e.length-1;i>=0;i-=1){const o=e[i];if(((l=o.processed)==null?void 0:l.kind)!=="tool")continue;const u=o.processed;if(u.toolName===r)return u.id}return null}function s6(e){const r={};for(const l of l6)r[l]=i6.has(l)?o6(e,l):a6(e,l);return r}function u6(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function c6(e){return e==="starting"||e==="running"||e==="waiting_for_user"}class f6{constructor(r){cr(this,"url");cr(this,"ws",null);cr(this,"reconnectTimer",null);cr(this,"reconnectDelayMs",750);cr(this,"subscriptions",new Map);cr(this,"pending",new Map);cr(this,"outboundQueue",[]);cr(this,"statusListeners",new Set);this.url=r,this.connect()}dispose(){var r;this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(r=this.ws)==null||r.close(),this.ws=null;for(const l of this.pending.values())l.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(r){return this.statusListeners.add(r),r(this.getStatus()),()=>{this.statusListeners.delete(r)}}subscribe(r,l){const i=crypto.randomUUID();return this.subscriptions.set(i,{topic:r,listener:l}),this.enqueue({v:1,type:"subscribe",id:i,topic:r}),()=>{this.subscriptions.delete(i),this.enqueue({v:1,type:"unsubscribe",id:i})}}command(r){const l=crypto.randomUUID(),i={v:1,type:"command",id:l,command:r};return new Promise((o,u)=>{this.pending.set(l,{resolve:o,reject:u}),this.enqueue(i)})}connect(){this.emitStatus("connecting"),this.ws=new WebSocket(this.url),this.ws.addEventListener("open",()=>{this.reconnectDelayMs=750,this.emitStatus("connected");for(const[r,l]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:r,topic:l.topic});for(;this.outboundQueue.length>0;){const r=this.outboundQueue.shift();r&&this.sendNow(r)}}),this.ws.addEventListener("message",r=>{let l;try{l=JSON.parse(String(r.data))}catch{return}if(l.type==="snapshot"){const i=this.subscriptions.get(l.id);i==null||i.listener(l.snapshot.data);return}if(l.type==="ack"){const i=this.pending.get(l.id);if(!i)return;this.pending.delete(l.id),i.resolve(l.result);return}if(l.type==="error"){if(!l.id){console.error(tR,l.message);return}const i=this.pending.get(l.id);if(!i)return;this.pending.delete(l.id),i.reject(new Error(l.message))}}),this.ws.addEventListener("close",()=>{this.emitStatus("disconnected");for(const r of this.pending.values())r.reject(new Error("Disconnected"));this.pending.clear(),this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var r,l;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?"connected":((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(r){for(const l of this.statusListeners)l(r)}enqueue(r){var l;if(((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN){this.sendNow(r);return}this.outboundQueue.push(r)}sendNow(r){var l;(l=this.ws)==null||l.send(JSON.stringify(r))}}function d6(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function h6(){const e=S.useRef(null);return e.current||(e.current=new f6(d6())),S.useEffect(()=>{const r=e.current;return()=>{r==null||r.dispose()}},[]),e.current}function m6(e){var Ll,xt,Bl;const r=xh(),l=h6(),i=yT(),[o,u]=S.useState({projectGroups:[]}),[c,f]=S.useState(null),[d,m]=S.useState(null),[g,y]=S.useState("connecting"),[b,v]=S.useState(!1),[k,C]=S.useState(!1),[A,N]=S.useState(!1),[O,_]=S.useState(null),[U,F]=S.useState(!1),[z,B]=S.useState(!1),[$,ae]=S.useState(148),[P,re]=S.useState(!0),[le,se]=S.useState(null),[J,Z]=S.useState(null),[D,X]=S.useState(null),ne=S.useRef(null),ie=S.useRef(null);S.useEffect(()=>l.onStatus(y),[l]),S.useEffect(()=>l.subscribe({type:"sidebar"},H=>{u(H),v(!0),se(null)}),[l]),S.useEffect(()=>l.subscribe({type:"local-projects"},H=>{f(H),C(!0),se(null)}),[l]),S.useEffect(()=>{if(!e){m(null),N(!0);return}return N(!1),l.subscribe({type:"chat",chatId:e},H=>{m(H),N(!0),se(null)})},[e,l]),S.useEffect(()=>{if(O)return;const H=o.projectGroups[0];H&&_(H.groupKey)},[O,o.projectGroups]),S.useEffect(()=>{if(!e||!b||!A)return;if(o.projectGroups.some(K=>K.chats.some(fe=>fe.chatId===e))){D===e&&X(null);return}D!==e&&r("/")},[e,A,r,D,o.projectGroups,b]),S.useEffect(()=>{d&&(_(d.runtime.projectId),D===d.runtime.chatId&&X(null))},[d,D]),S.useLayoutEffect(()=>{const H=ie.current;if(!H)return;const K=new ResizeObserver(()=>{ae(H.getBoundingClientRect().height)});return K.observe(H),ae(H.getBoundingClientRect().height),()=>K.disconnect()},[]);const j=S.useMemo(()=>r6((d==null?void 0:d.messages)??[]),[d==null?void 0:d.messages]),R=S.useMemo(()=>s6(j),[j]),G=(d==null?void 0:d.runtime)??null,T=c6(G==null?void 0:G.status),ue=u6(G==null?void 0:G.status),de=$+48,ce=!P&&j.length>0,Ce=((Ll=c==null?void 0:c.projects[0])==null?void 0:Ll.localPath)??null,Ue=(G==null?void 0:G.localPath)??Ce??((xt=o.projectGroups[0])==null?void 0:xt.localPath),ve=!!(O??(G==null?void 0:G.projectId)??((Bl=o.projectGroups[0])==null?void 0:Bl.groupKey)??Ce);S.useEffect(()=>{const H=ne.current;if(!H)return;H.scrollHeight-H.scrollTop-H.clientHeight<120&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})},[e,j.length,G==null?void 0:G.status]);function at(){const H=ne.current;if(!H)return;const K=H.scrollHeight-H.scrollTop-H.clientHeight;re(K<24)}function dt(){const H=ne.current;H&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})}async function At(H){try{const K=await l.command({type:"chat.create",projectId:H});_(H),X(K.chatId),r(`/chat/${K.chatId}`),F(!1)}catch(K){se(K instanceof Error?K.message:String(K))}}async function wt(H){try{Z(H);const K=await l.command({type:"project.open",localPath:H});_(K.projectId);const fe=await l.command({type:"chat.create",projectId:K.projectId});X(fe.chatId),r(`/chat/${fe.chatId}`),F(!1),se(null)}catch(K){se(K instanceof Error?K.message:String(K))}finally{Z(null)}}async function ht(H){try{Z(H.localPath);const K=await l.command(H.mode==="new"?{type:"project.create",localPath:H.localPath,title:H.title}:{type:"project.open",localPath:H.localPath});_(K.projectId);const fe=await l.command({type:"chat.create",projectId:K.projectId});X(fe.chatId),r(`/chat/${fe.chatId}`),F(!1),se(null)}catch(K){se(K instanceof Error?K.message:String(K))}finally{Z(null)}}async function jn(H,K){var fe;try{let ge=O??((fe=o.projectGroups[0])==null?void 0:fe.groupKey)??null;if(!e&&!ge&&Ce&&(ge=(await l.command({type:"project.open",localPath:Ce})).projectId,_(ge)),!e&&!ge)throw new Error("Open a project first");const Ee=await l.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:ge??void 0,content:H,model:K==null?void 0:K.model,effort:K==null?void 0:K.effort,planMode:K==null?void 0:K.planMode});!e&&Ee.chatId&&(X(Ee.chatId),r(`/chat/${Ee.chatId}`)),se(null)}catch(ge){throw se(ge instanceof Error?ge.message:String(ge)),ge}}async function Tn(){if(e)try{await l.command({type:"chat.cancel",chatId:e})}catch(H){se(H instanceof Error?H.message:String(H))}}async function xr(H){if(await i.confirm({title:"Delete Chat",description:`Delete "${H.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{await l.command({type:"chat.delete",chatId:H.chatId}),H.chatId===e&&r("/")}catch(fe){se(fe instanceof Error?fe.message:String(fe))}}async function br(H){const K=o.projectGroups.find(Ee=>Ee.groupKey===H);if(!K)return;const fe=K.localPath.split("/").filter(Boolean).pop()??K.localPath;if(await i.confirm({title:"Remove Project",description:`Remove "${fe}" from the sidebar? Existing chats will be removed from ${zt}.`,confirmLabel:"Remove",confirmVariant:"destructive"}))try{await l.command({type:"project.remove",projectId:H}),(G==null?void 0:G.projectId)===H&&r("/projects"),se(null)}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}async function $t(H){var fe,ge;const K=(G==null?void 0:G.localPath)??((fe=c==null?void 0:c.projects[0])==null?void 0:fe.localPath)??((ge=o.projectGroups[0])==null?void 0:ge.localPath);if(K)try{await l.command({type:"system.openExternal",action:H,localPath:K})}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}function vr(){var fe,ge;const H=O??((fe=o.projectGroups[0])==null?void 0:fe.groupKey);if(H){At(H);return}const K=(ge=c==null?void 0:c.projects[0])==null?void 0:ge.localPath;if(K){wt(K);return}r("/projects")}async function al(H,K,fe){if(e)try{await l.command({type:"chat.respondTool",chatId:e,toolUseId:H,result:{questions:K,answers:fe}})}catch(ge){se(ge instanceof Error?ge.message:String(ge))}}async function Ii(H,K,fe,ge){if(e){K&&I1.getState().setPlanMode(!1);try{await l.command({type:"chat.respondTool",chatId:e,toolUseId:H,result:{confirmed:K,...fe?{clearContext:!0}:{},...ge?{message:ge}:{}}})}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}}return{activeChatId:e,sidebarData:o,localProjects:c,chatSnapshot:d,connectionStatus:g,sidebarReady:b,localProjectsReady:k,commandError:le,startingLocalPath:J,sidebarOpen:U,sidebarCollapsed:z,scrollRef:ne,inputRef:ie,messages:j,latestToolIds:R,runtime:G,isProcessing:T,canCancel:ue,transcriptPaddingBottom:de,showScrollButton:ce,navbarLocalPath:Ue,hasSelectedProject:ve,openSidebar:()=>F(!0),closeSidebar:()=>F(!1),collapseSidebar:()=>B(!0),expandSidebar:()=>B(!1),updateScrollState:at,scrollToBottom:dt,handleCreateChat:At,handleOpenLocalProject:wt,handleCreateProject:ht,handleSend:jn,handleCancel:Tn,handleDeleteChat:xr,handleRemoveProject:br,handleOpenExternal:$t,handleCompose:vr,handleAskUserQuestion:al,handleExitPlanMode:Ii}}function p6(){const e=Fn(),r=xC(),l=m6(r.chatId??null),i=e.pathname==="/projects";return x.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[x.jsx(kR,{data:l.sidebarData,activeChatId:l.activeChatId,connectionStatus:l.connectionStatus,ready:l.sidebarReady,open:l.sidebarOpen,collapsed:l.sidebarCollapsed,showMobileOpenButton:i,onOpen:l.openSidebar,onClose:l.closeSidebar,onCollapse:l.collapseSidebar,onExpand:l.expandSidebar,onCreateChat:o=>{l.handleCreateChat(o)},onCreateProject:o=>{l.handleCreateProject(o)},onDeleteChat:o=>{l.handleDeleteChat(o)},onRemoveProject:o=>{l.handleRemoveProject(o)}}),x.jsx(MC,{context:l})]})}function g6(){return x.jsx(eR,{children:x.jsx(gT,{children:x.jsx(zC,{children:x.jsxs($a,{element:x.jsx(p6,{}),children:[x.jsx($a,{path:"/",element:x.jsx(ov,{})}),x.jsx($a,{path:"/projects",element:x.jsx(e6,{})}),x.jsx($a,{path:"/chat/:chatId",element:x.jsx(ov,{})})]})})})})}const aS="lever-theme",y6=S.createContext(void 0),x6=e=>e==="light"||e==="dark"||e==="system",oS=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",dv=e=>{if(typeof document>"u")return;const r=e==="system"?oS():e;document.documentElement.classList.toggle("dark",r==="dark")},b6=()=>{if(typeof window>"u")return"system";const e=window.localStorage.getItem(aS);return x6(e)?e:"system"};function v6({children:e}){const[r,l]=S.useState(b6);S.useEffect(()=>{dv(r),typeof window<"u"&&window.localStorage.setItem(aS,r)},[r]),S.useEffect(()=>{if(r!=="system")return;const o=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>dv("system");return o.addEventListener?(o.addEventListener("change",u),()=>o.removeEventListener("change",u)):(o.addListener(u),()=>o.removeListener(u))},[r]);const i=S.useMemo(()=>{const o=r==="system"?oS():r;return{theme:r,resolvedTheme:o,setTheme:l}},[r]);return x.jsx(y6.Provider,{value:i,children:e})}const sS=document.getElementById("root");if(!sS)throw new Error("Missing #root");z2.createRoot(sS).render(x.jsx(S.StrictMode,{children:x.jsx(lE,{children:x.jsx(v6,{children:x.jsx(g6,{})})})}));
418
+ `)})]})}),children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return x.jsx(so,{className:"size-4 text-destructive"});if(f)return x.jsx(Bh,{className:"size-4 text-muted-icon"});const F=Q1(e.toolName);return x.jsx(F,{className:"size-4 text-muted-icon"})})()}),x.jsx(el,{className:"text-left transition-opacity duration-200 truncate",children:x.jsx(Ru,{animate:u,shimmerWidth:Math.max(20,((U=d||c)==null?void 0:U.length)??99),children:d||c})})]})})}function HD({message:e}){const r=l=>{if(l<1e3)return`${l}ms`;const i=Math.floor(l/1e3),o=Math.floor(i/3600),u=Math.floor(i%3600/60),c=i%60;return o>0?`${o}h${u>0?` ${u}m`:""}`:u>0?`${u}m${c>0?` ${c}s`:""}`:`${c}s`};return x.jsxs(ll,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[x.jsx("div",{className:"w-full h-[1px] bg-border"}),x.jsxs(el,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",r(e.durationMs)]}),x.jsx("div",{className:"w-full h-[1px] bg-border"})]})}function PD({message:e}){return x.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:x.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[x.jsx(mj,{className:"h-4 w-4 ml-1.5"}),x.jsx("em",{children:"Interrupted"})]})})}function mu({size:e=4}){return x.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[x.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:x.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),x.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function qD(){return x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(mu,{}),x.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),x.jsx(mu,{})]})}function FD(){return x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(mu,{}),x.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),x.jsx(mu,{})]})}function VD({message:e}){return x.jsx(ll,{children:x.jsxs(Ou,{expandedContent:x.jsx(zu,{className:"my-4 text-xs",children:x.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:x.jsx(Li,{remarkPlugins:[Bi],components:Du,children:e.summary})})}),children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(L0,{className:"h-4.5 w-4.5 text-muted-foreground"})}),x.jsx(el,{children:"Summarized"})]})})}const ID={compacting:"Compacting..."};function GD({message:e}){const r=ID[e.status]||e.status;return x.jsxs(ll,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(L0,{className:"h-4.5 w-4.5 text-muted-foreground"})}),x.jsx(el,{className:"text-left transition-opacity duration-200 truncate",children:r})]})}const iv={Read:{key:"read",singular:"read",plural:"reads"},Edit:{key:"edit",singular:"edit",plural:"edits"},Write:{key:"write",singular:"write",plural:"writes"},Bash:{key:"bash",singular:"command",plural:"commands"},Grep:{key:"grep",singular:"search",plural:"searches"},Glob:{key:"glob",singular:"glob",plural:"globs"},Task:{key:"task",singular:"agent",plural:"agents"},WebFetch:{key:"webfetch",singular:"fetch",plural:"fetches"},WebSearch:{key:"websearch",singular:"web search",plural:"web searches"},Skill:{key:"skill",singular:"skill",plural:"skills"},TodoWrite:{key:"todo",singular:"todo update",plural:"todo updates"}},YD={key:"dbquery",singular:"query",plural:"queries"},$D={key:"other",singular:"tool call",plural:"tool calls"};function XD(e){return iv[e]?iv[e]:/^mcp__db__.+_query$/.test(e)?YD:$D}function QD(e){const r=new Map,l=[];for(const i of e){const o=i.processed.toolName,u=XD(o),c=r.get(u.key);c?c.count++:(r.set(u.key,{category:u,count:1}),l.push(u.key))}return l.map(i=>{const{category:o,count:u}=r.get(i);return`${u} ${u===1?o.singular:o.plural}`}).join(", ")}function ZD({messages:e,isLoading:r,outputsUrl:l,localPath:i}){const[o,u]=S.useState(!1),c=S.useMemo(()=>QD(e),[e]),d=e.some(m=>m.processed.result===void 0)&&r;return x.jsx(ll,{className:"w-full",children:x.jsxs("div",{className:"flex flex-col w-full",children:[x.jsx("button",{onClick:()=>u(!o),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!o&&!d?"hover:opacity-60 transition-opacity":""}`,children:x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(Kr,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${o?"rotate-90":""}`})}),x.jsx(el,{className:"text-left",children:x.jsx(Ru,{animate:d,children:c})})]})}),o&&x.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(m=>x.jsx(iS,{message:m.processed,isLoading:r,outputsUrl:l,localPath:i},m.id)),e.length>5&&x.jsx("button",{onClick:()=>u(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[x.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:x.jsx(Kr,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),x.jsx(el,{className:"text-left",children:"Collapse"})]})})]})]})})}const KD=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function av(e){var l;if(((l=e.processed)==null?void 0:l.kind)!=="tool")return!1;const r=e.processed.toolName;return!KD.has(r)}function JD(e){const r=[];let l=0;for(;l<e.length;){const i=e[l];if(av(i)){const o=[i],u=l;for(l+=1;l<e.length&&av(e[l]);)o.push(e[l]),l+=1;o.length>=2?r.push({type:"tool-group",messages:o,startIndex:u}):r.push({type:"single",message:i,index:u});continue}r.push({type:"single",message:i,index:l}),l+=1}return r}function WD({messages:e,isLoading:r,localPath:l,latestToolIds:i,onAskUserQuestionSubmit:o,onExitPlanModeConfirm:u}){const c=S.useMemo(()=>JD(e),[e]);function f(d,m){var y,b;if(d.role==="user")return x.jsx(pD,{content:d.content},d.id);const g=d.processed;if(!g)return x.jsx(gD,{json:d.content},d.id);switch(g.kind){case"system":return e.findIndex(k=>{var C;return((C=k.processed)==null?void 0:C.kind)==="system"})===m?x.jsx(wD,{message:g,rawJson:d.rawJson},d.id):null;case"account_info":return e.findIndex(k=>{var C;return((C=k.processed)==null?void 0:C.kind)==="account_info"})===m?x.jsx(SD,{message:g},d.id):null;case"text":return x.jsx(kD,{message:g},d.id);case"tool":return g.toolName==="AskUserQuestion"?x.jsx(AD,{message:g,onSubmit:o,isLatest:g.id===i.AskUserQuestion},d.id):g.toolName==="ExitPlanMode"?x.jsx(jD,{message:g,onConfirm:u,isLatest:g.id===i.ExitPlanMode},d.id):g.toolName==="TodoWrite"?g.id!==i.TodoWrite?null:x.jsx(_D,{message:g},d.id):x.jsx(iS,{message:g,isLoading:r,localPath:l},d.id);case"result":{const v=e[m+1],k=e[m-1];return((y=v==null?void 0:v.processed)==null?void 0:y.kind)==="context_cleared"||((b=k==null?void 0:k.processed)==null?void 0:b.kind)==="context_cleared"?null:x.jsx(HD,{message:g},d.id)}case"interrupted":return x.jsx(PD,{message:g},d.id);case"compact_boundary":return x.jsx(qD,{},d.id);case"context_cleared":return x.jsx(FD,{},d.id);case"compact_summary":return x.jsx(VD,{message:g},d.id);case"status":return m===e.length-1?x.jsx(GD,{message:g},d.id):null}}return x.jsx(x.Fragment,{children:c.map(d=>{if(d.type==="tool-group")return x.jsx("div",{className:"group relative",children:x.jsx(ZD,{messages:d.messages,isLoading:r,localPath:l})},`group-${d.startIndex}`);const m=f(d.message,d.index);return m?x.jsx("div",{id:`msg-${d.message.id}`,className:"group relative",children:m},d.message.id):null})})}function ov(){var r,l,i;const e=Av();return x.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:x.jsxs(G1,{className:"bg-background flex-1 flex flex-col overflow-hidden border-0 rounded-none relative",children:[x.jsxs($1,{className:"flex-1 p-0 overflow-hidden relative",children:[x.jsx(FR,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,onOpenExternal:o=>{e.handleOpenExternal(o)}}),x.jsx(K1,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"h-full px-4 scroll-pt-[72px]",children:x.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",style:{paddingBottom:e.transcriptPaddingBottom},children:[e.messages.length===0?x.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[40vh] text-muted-foreground gap-4",children:[x.jsx(Qa,{strokeWidth:1.5,className:"size-8 text-muted-foreground"}),x.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs",children:"What are we making?"})]}):x.jsx(WD,{messages:e.messages,isLoading:e.isProcessing,localPath:(r=e.runtime)==null?void 0:r.localPath,latestToolIds:e.latestToolIds,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?x.jsx(YR,{status:(l=e.runtime)==null?void 0:l.status}):null,e.commandError?x.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null,x.jsx("div",{className:"flex-1 min-h-[10vh]","aria-hidden":"true"})]})}),x.jsx("div",{style:{bottom:e.transcriptPaddingBottom-36},className:xe("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:x.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-white hover:bg-muted border border-border rounded-full aspect-square cursor-pointer text-sm text-primary hover:text-foreground dark:bg-slate-700 dark:hover:bg-slate-600 dark:text-slate-100 dark:border-slate-600",children:x.jsx($A,{className:"h-5 w-5"})})})]}),x.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:x.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:x.jsx(UR,{onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((i=e.runtime)==null?void 0:i.status)==="waiting_for_user",canCancel:e.canCancel,chatId:e.activeChatId},e.activeChatId??"new-chat")})})]})})}function e6({text:e}){const[r,l]=S.useState(!1);async function i(){await navigator.clipboard.writeText(e),l(!0),setTimeout(()=>l(!1),2e3)}return x.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void i(),children:r?x.jsx(_l,{className:"h-4 w-4 text-green-400"}):x.jsx(ku,{className:"h-4 w-4"})})}function sv({children:e}){return x.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[x.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[x.jsx(Kr,{className:"inline h-4 w-4 opacity-40"}),x.jsx("code",{children:e})]}),x.jsx(e6,{text:e})]})}function Ys({children:e}){return x.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function Fd({children:e}){return x.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function uv({narrow:e=!1,title:r,subtitle:l,icon:i=Oh}){return x.jsxs("div",{className:xe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[x.jsxs("div",{className:xe("flex items-center gap-3 mb-2",e&&"justify-center"),children:[x.jsx("div",{className:"p-2 pl-0 rounded-lg",children:x.jsx(i,{className:"h-6 w-6 text-muted-foreground"})}),x.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:r})]}),x.jsx("p",{className:xe("text-muted-foreground",e&&"mb-10 text-center"),children:l})]})}function Vd({icon:e,title:r,subtitle:l,iconClassName:i}){return x.jsxs("div",{className:"flex flex-col items-center gap-0",children:[x.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:x.jsx(e,{className:i||"h-8 w-8 text-muted-foreground"})}),x.jsx("span",{className:"text-sm font-medium",children:r}),x.jsx("span",{className:"text-xs text-muted-foreground",children:l})]})}function cv(){return x.jsx(QA,{className:"h-4 w-4 text-muted-foreground"})}function fv({number:e,title:r,children:l}){return x.jsx("div",{className:"flex gap-4",children:x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[x.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),x.jsx("h3",{className:"font-medium text-foreground mb-2",children:r})]}),x.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:l})]})})}function t6({localPath:e,loading:r,onClick:l}){return x.jsxs(ou,{children:[x.jsx(su,{asChild:!0,children:x.jsxs("button",{className:xe("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",r&&"opacity-50 cursor-not-allowed"),disabled:r,onClick:l,children:[x.jsx(O0,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),x.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:A1(e)}),r?x.jsx(zl,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):x.jsx(Dh,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),x.jsx(no,{children:x.jsx("p",{children:e})})]})}function n6({connectionStatus:e,ready:r,snapshot:l,startingLocalPath:i,commandError:o,onOpenProject:u,onCreateProject:c}){const[f,d]=S.useState(!1),m=S.useMemo(()=>(l==null?void 0:l.projects)??[],[l==null?void 0:l.projects]),g=e==="connecting"||!r,y=e==="connected"&&r;return x.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[y?x.jsxs(x.Fragment,{children:[x.jsx(uv,{title:(l==null?void 0:l.machine.displayName)??"Local Projects",subtitle:`${zt} is connected, choose a project below to get started.`}),x.jsxs("div",{className:"w-full px-6 mb-10",children:[x.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[x.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),x.jsxs(qe,{variant:"default",size:"sm",onClick:()=>d(!0),children:[x.jsx(U0,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),m.length>0?x.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:m.map(b=>x.jsx(t6,{localPath:b.localPath,loading:i===b.localPath,onClick:()=>{u(b.localPath)}},b.localPath))}):x.jsx(Ys,{children:x.jsx("p",{className:"text-sm text-muted-foreground",children:"No Claude projects discovered yet. Open one with Claude Code or create a new project here."})}),o?x.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:o}):null]})]}):x.jsxs(x.Fragment,{children:[x.jsx(uv,{narrow:!0,icon:Jx,title:g?`Connecting ${zt}`:`Connect ${zt}`,subtitle:g?`${zt} is starting up and loading your local projects.`:`Run ${zt} directly on your machine with full access to your local files and Claude projects.`}),x.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[x.jsx(Fd,{children:"Status"}),x.jsx("div",{className:"mb-8",children:x.jsx(Ys,{children:x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(zl,{className:"h-4 w-4 text-muted-foreground animate-spin"}),x.jsx("span",{className:"text-sm text-muted-foreground",children:g?`Connecting to your local ${zt} server...`:x.jsxs(x.Fragment,{children:["Not connected. Run ",x.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:qs()})," from any terminal on this machine."]})})]})})}),g?null:x.jsxs("div",{className:"mb-10",children:[x.jsx(Fd,{children:"How it works"}),x.jsx(Ys,{children:x.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[x.jsx(Vd,{icon:Lh,title:`${zt} CLI`,subtitle:"On Your Machine"}),x.jsx(cv,{}),x.jsx(Vd,{icon:Oh,title:`${zt} Server`,subtitle:"Local WebSocket"}),x.jsx(cv,{}),x.jsx(Vd,{icon:Jx,title:`${zt} UI`,subtitle:"Project Chat"})]})})]}),g?null:x.jsxs("div",{className:"mb-10",children:[x.jsx(Fd,{children:"Setup"}),x.jsx(Ys,{children:x.jsxs("div",{className:"space-y-4",children:[x.jsxs(fv,{number:1,title:`Start ${zt}`,children:[x.jsx("p",{children:"Run this command in your terminal:"}),x.jsx(sv,{children:qs()})]}),x.jsxs(fv,{number:2,title:"Open the local UI",children:[x.jsxs("p",{children:[zt," serves the app locally and opens the Local Projects page in an app-style browser window."]}),x.jsx(sv,{children:"http://localhost:3210/local"})]}),x.jsxs("div",{className:"mt-8",children:[x.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),x.jsxs("div",{className:"space-y-3 text-sm",children:[x.jsxs("div",{className:"flex gap-4",children:[x.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:qs("").trim()}),x.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),x.jsxs("div",{className:"flex gap-4",children:[x.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:qs("--no-open")}),x.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),x.jsx(N1,{open:f,onOpenChange:d,onConfirm:b=>{c(b)}}),x.jsx("div",{className:"py-4 text-center",children:x.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",rR.split("/")[1]]})})]})}function r6(){const e=Av();return x.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:x.jsx(n6,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function l6(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Dn(){return new Date().toISOString()}function i6(e,r){var o,u,c,f;const l=l6(e),i={processed:null,rawJson:l};try{const d=JSON.parse(e);if(d.type==="user_prompt"&&d.content)return{...i,isUserMessage:!0,userContent:d.content};if(d.type==="system"&&d.subtype==="init")return{processed:{id:zn(),kind:"system",model:d.model||"unknown",tools:d.tools||[],agents:d.agents||[],slashCommands:((o=d.slash_commands)==null?void 0:o.filter(m=>!m.startsWith("._")))||[],mcpServers:d.mcp_servers||[],timestamp:Dn()},rawJson:l};if(d.type==="system"&&d.subtype==="account_info")return{processed:{id:zn(),kind:"account_info",accountInfo:d.accountInfo,timestamp:Dn()},rawJson:l};if(d.type==="assistant"&&((u=d.message)!=null&&u.content))for(const m of d.message.content){if(m.type==="text"&&m.text)return{processed:{id:zn(),kind:"text",text:m.text,timestamp:Dn()},rawJson:l};if(m.type==="tool_use"){const g={id:zn(),kind:"tool",toolName:m.name,toolId:m.id,input:m.input||{},timestamp:Dn()};return r.set(m.id,g),{processed:g,rawJson:l}}}if(d.type==="user"&&((c=d.message)!=null&&c.content)){for(const m of d.message.content)if(m.type==="tool_result"&&m.tool_use_id){const g=r.get(m.tool_use_id);if(g)return g.result=m.content||"(empty)",g.isError=m.is_error||!1,r.delete(m.tool_use_id),i}}return d.type==="result"?d.subtype==="cancelled"?{processed:{id:zn(),kind:"interrupted",timestamp:Dn()},rawJson:l}:{processed:{id:zn(),kind:"result",success:!d.is_error,result:d.result||"",durationMs:d.duration_ms||0,costUsd:d.total_cost_usd,timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="status"&&d.status?{processed:{id:zn(),kind:"status",status:d.status,timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="compact_boundary"?{processed:{id:zn(),kind:"compact_boundary",timestamp:Dn()},rawJson:l}:d.type==="system"&&d.subtype==="context_cleared"?{processed:{id:zn(),kind:"context_cleared",timestamp:Dn()},rawJson:l}:d.type==="user"&&((f=d.message)==null?void 0:f.role)==="user"&&typeof d.message.content=="string"&&d.message.content.startsWith("This session is being continued")?{processed:{id:zn(),kind:"compact_summary",summary:d.message.content,timestamp:Dn()},rawJson:l}:i}catch{return i}}function a6(e){const r=new Map,l=[];for(const i of e){const{processed:o,rawJson:u,isUserMessage:c,userContent:f}=i6(i.message,r);if(c&&f){l.push({id:i._id,messageId:i.messageId,role:"user",content:f,timestamp:new Date(i.createdAt).toISOString(),hidden:i.hidden});continue}o!==null&&l.push({id:i._id,messageId:i.messageId,role:"assistant",content:u,timestamp:new Date(i.createdAt).toISOString(),processed:o,rawJson:u,hidden:i.hidden})}return l}const o6=["AskUserQuestion","ExitPlanMode","TodoWrite"],s6=new Set(["TodoWrite"]);function u6(e,r){var l;for(let i=e.length-1;i>=0;i-=1){const o=e[i];if(((l=o.processed)==null?void 0:l.kind)!=="tool")continue;const u=o.processed;if(u.toolName===r&&!u.result)return u.id}return null}function c6(e,r){var l;for(let i=e.length-1;i>=0;i-=1){const o=e[i];if(((l=o.processed)==null?void 0:l.kind)!=="tool")continue;const u=o.processed;if(u.toolName===r)return u.id}return null}function f6(e){const r={};for(const l of o6)r[l]=s6.has(l)?c6(e,l):u6(e,l);return r}function d6(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function h6(e){return e==="starting"||e==="running"||e==="waiting_for_user"}class m6{constructor(r){cr(this,"url");cr(this,"ws",null);cr(this,"reconnectTimer",null);cr(this,"reconnectDelayMs",750);cr(this,"subscriptions",new Map);cr(this,"pending",new Map);cr(this,"outboundQueue",[]);cr(this,"statusListeners",new Set);this.url=r,this.connect()}dispose(){var r;this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(r=this.ws)==null||r.close(),this.ws=null;for(const l of this.pending.values())l.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(r){return this.statusListeners.add(r),r(this.getStatus()),()=>{this.statusListeners.delete(r)}}subscribe(r,l){const i=crypto.randomUUID();return this.subscriptions.set(i,{topic:r,listener:l}),this.enqueue({v:1,type:"subscribe",id:i,topic:r}),()=>{this.subscriptions.delete(i),this.enqueue({v:1,type:"unsubscribe",id:i})}}command(r){const l=crypto.randomUUID(),i={v:1,type:"command",id:l,command:r};return new Promise((o,u)=>{this.pending.set(l,{resolve:o,reject:u}),this.enqueue(i)})}connect(){this.emitStatus("connecting"),this.ws=new WebSocket(this.url),this.ws.addEventListener("open",()=>{this.reconnectDelayMs=750,this.emitStatus("connected");for(const[r,l]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:r,topic:l.topic});for(;this.outboundQueue.length>0;){const r=this.outboundQueue.shift();r&&this.sendNow(r)}}),this.ws.addEventListener("message",r=>{let l;try{l=JSON.parse(String(r.data))}catch{return}if(l.type==="snapshot"){const i=this.subscriptions.get(l.id);i==null||i.listener(l.snapshot.data);return}if(l.type==="ack"){const i=this.pending.get(l.id);if(!i)return;this.pending.delete(l.id),i.resolve(l.result);return}if(l.type==="error"){if(!l.id){console.error(lR,l.message);return}const i=this.pending.get(l.id);if(!i)return;this.pending.delete(l.id),i.reject(new Error(l.message))}}),this.ws.addEventListener("close",()=>{this.emitStatus("disconnected");for(const r of this.pending.values())r.reject(new Error("Disconnected"));this.pending.clear(),this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var r,l;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?"connected":((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(r){for(const l of this.statusListeners)l(r)}enqueue(r){var l;if(((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN){this.sendNow(r);return}this.outboundQueue.push(r)}sendNow(r){var l;(l=this.ws)==null||l.send(JSON.stringify(r))}}function p6(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function g6(){const e=S.useRef(null);return e.current||(e.current=new m6(p6())),S.useEffect(()=>{const r=e.current;return()=>{r==null||r.dispose()}},[]),e.current}function y6(e){var Ll,xt,Bl;const r=xh(),l=g6(),i=yT(),[o,u]=S.useState({projectGroups:[]}),[c,f]=S.useState(null),[d,m]=S.useState(null),[g,y]=S.useState("connecting"),[b,v]=S.useState(!1),[k,C]=S.useState(!1),[A,N]=S.useState(!1),[O,_]=S.useState(null),[U,F]=S.useState(!1),[z,B]=S.useState(!1),[$,ae]=S.useState(148),[P,re]=S.useState(!0),[le,se]=S.useState(null),[J,Z]=S.useState(null),[D,X]=S.useState(null),ne=S.useRef(null),ie=S.useRef(null);S.useEffect(()=>l.onStatus(y),[l]),S.useEffect(()=>l.subscribe({type:"sidebar"},H=>{u(H),v(!0),se(null)}),[l]),S.useEffect(()=>l.subscribe({type:"local-projects"},H=>{f(H),C(!0),se(null)}),[l]),S.useEffect(()=>{if(!e){m(null),N(!0);return}return N(!1),l.subscribe({type:"chat",chatId:e},H=>{m(H),N(!0),se(null)})},[e,l]),S.useEffect(()=>{if(O)return;const H=o.projectGroups[0];H&&_(H.groupKey)},[O,o.projectGroups]),S.useEffect(()=>{if(!e||!b||!A)return;if(o.projectGroups.some(K=>K.chats.some(fe=>fe.chatId===e))){D===e&&X(null);return}D!==e&&r("/")},[e,A,r,D,o.projectGroups,b]),S.useEffect(()=>{d&&(_(d.runtime.projectId),D===d.runtime.chatId&&X(null))},[d,D]),S.useLayoutEffect(()=>{const H=ie.current;if(!H)return;const K=new ResizeObserver(()=>{ae(H.getBoundingClientRect().height)});return K.observe(H),ae(H.getBoundingClientRect().height),()=>K.disconnect()},[]);const j=S.useMemo(()=>a6((d==null?void 0:d.messages)??[]),[d==null?void 0:d.messages]),R=S.useMemo(()=>f6(j),[j]),G=(d==null?void 0:d.runtime)??null,T=h6(G==null?void 0:G.status),ue=d6(G==null?void 0:G.status),de=$+48,ce=!P&&j.length>0,Ce=((Ll=c==null?void 0:c.projects[0])==null?void 0:Ll.localPath)??null,Ue=(G==null?void 0:G.localPath)??Ce??((xt=o.projectGroups[0])==null?void 0:xt.localPath),ve=!!(O??(G==null?void 0:G.projectId)??((Bl=o.projectGroups[0])==null?void 0:Bl.groupKey)??Ce);S.useEffect(()=>{const H=ne.current;if(!H)return;H.scrollHeight-H.scrollTop-H.clientHeight<120&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})},[e,j.length,G==null?void 0:G.status]);function at(){const H=ne.current;if(!H)return;const K=H.scrollHeight-H.scrollTop-H.clientHeight;re(K<24)}function dt(){const H=ne.current;H&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})}async function At(H){try{const K=await l.command({type:"chat.create",projectId:H});_(H),X(K.chatId),r(`/chat/${K.chatId}`),F(!1)}catch(K){se(K instanceof Error?K.message:String(K))}}async function wt(H){try{Z(H);const K=await l.command({type:"project.open",localPath:H});_(K.projectId);const fe=await l.command({type:"chat.create",projectId:K.projectId});X(fe.chatId),r(`/chat/${fe.chatId}`),F(!1),se(null)}catch(K){se(K instanceof Error?K.message:String(K))}finally{Z(null)}}async function ht(H){try{Z(H.localPath);const K=await l.command(H.mode==="new"?{type:"project.create",localPath:H.localPath,title:H.title}:{type:"project.open",localPath:H.localPath});_(K.projectId);const fe=await l.command({type:"chat.create",projectId:K.projectId});X(fe.chatId),r(`/chat/${fe.chatId}`),F(!1),se(null)}catch(K){se(K instanceof Error?K.message:String(K))}finally{Z(null)}}async function jn(H,K){var fe;try{let ge=O??((fe=o.projectGroups[0])==null?void 0:fe.groupKey)??null;if(!e&&!ge&&Ce&&(ge=(await l.command({type:"project.open",localPath:Ce})).projectId,_(ge)),!e&&!ge)throw new Error("Open a project first");const Ee=await l.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:ge??void 0,content:H,model:K==null?void 0:K.model,effort:K==null?void 0:K.effort,planMode:K==null?void 0:K.planMode});!e&&Ee.chatId&&(X(Ee.chatId),r(`/chat/${Ee.chatId}`)),se(null)}catch(ge){throw se(ge instanceof Error?ge.message:String(ge)),ge}}async function Tn(){if(e)try{await l.command({type:"chat.cancel",chatId:e})}catch(H){se(H instanceof Error?H.message:String(H))}}async function xr(H){if(await i.confirm({title:"Delete Chat",description:`Delete "${H.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{await l.command({type:"chat.delete",chatId:H.chatId}),H.chatId===e&&r("/")}catch(fe){se(fe instanceof Error?fe.message:String(fe))}}async function br(H){const K=o.projectGroups.find(Ee=>Ee.groupKey===H);if(!K)return;const fe=K.localPath.split("/").filter(Boolean).pop()??K.localPath;if(await i.confirm({title:"Remove Project",description:`Remove "${fe}" from the sidebar? Existing chats will be removed from ${zt}.`,confirmLabel:"Remove",confirmVariant:"destructive"}))try{await l.command({type:"project.remove",projectId:H}),(G==null?void 0:G.projectId)===H&&r("/projects"),se(null)}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}async function $t(H){var fe,ge;const K=(G==null?void 0:G.localPath)??((fe=c==null?void 0:c.projects[0])==null?void 0:fe.localPath)??((ge=o.projectGroups[0])==null?void 0:ge.localPath);if(K)try{await l.command({type:"system.openExternal",action:H,localPath:K})}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}function vr(){var fe,ge;const H=O??((fe=o.projectGroups[0])==null?void 0:fe.groupKey);if(H){At(H);return}const K=(ge=c==null?void 0:c.projects[0])==null?void 0:ge.localPath;if(K){wt(K);return}r("/projects")}async function al(H,K,fe){if(e)try{await l.command({type:"chat.respondTool",chatId:e,toolUseId:H,result:{questions:K,answers:fe}})}catch(ge){se(ge instanceof Error?ge.message:String(ge))}}async function Ii(H,K,fe,ge){if(e){K&&I1.getState().setPlanMode(!1);try{await l.command({type:"chat.respondTool",chatId:e,toolUseId:H,result:{confirmed:K,...fe?{clearContext:!0}:{},...ge?{message:ge}:{}}})}catch(Ee){se(Ee instanceof Error?Ee.message:String(Ee))}}}return{activeChatId:e,sidebarData:o,localProjects:c,chatSnapshot:d,connectionStatus:g,sidebarReady:b,localProjectsReady:k,commandError:le,startingLocalPath:J,sidebarOpen:U,sidebarCollapsed:z,scrollRef:ne,inputRef:ie,messages:j,latestToolIds:R,runtime:G,isProcessing:T,canCancel:ue,transcriptPaddingBottom:de,showScrollButton:ce,navbarLocalPath:Ue,hasSelectedProject:ve,openSidebar:()=>F(!0),closeSidebar:()=>F(!1),collapseSidebar:()=>B(!0),expandSidebar:()=>B(!1),updateScrollState:at,scrollToBottom:dt,handleCreateChat:At,handleOpenLocalProject:wt,handleCreateProject:ht,handleSend:jn,handleCancel:Tn,handleDeleteChat:xr,handleRemoveProject:br,handleOpenExternal:$t,handleCompose:vr,handleAskUserQuestion:al,handleExitPlanMode:Ii}}function x6(){const e=Fn(),r=xC(),l=y6(r.chatId??null),i=e.pathname==="/projects";return x.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[x.jsx(NR,{data:l.sidebarData,activeChatId:l.activeChatId,connectionStatus:l.connectionStatus,ready:l.sidebarReady,open:l.sidebarOpen,collapsed:l.sidebarCollapsed,showMobileOpenButton:i,onOpen:l.openSidebar,onClose:l.closeSidebar,onCollapse:l.collapseSidebar,onExpand:l.expandSidebar,onCreateChat:o=>{l.handleCreateChat(o)},onCreateProject:o=>{l.handleCreateProject(o)},onDeleteChat:o=>{l.handleDeleteChat(o)},onRemoveProject:o=>{l.handleRemoveProject(o)}}),x.jsx(MC,{context:l})]})}function b6(){return x.jsx(eR,{children:x.jsx(gT,{children:x.jsx(zC,{children:x.jsxs($a,{element:x.jsx(x6,{}),children:[x.jsx($a,{path:"/",element:x.jsx(ov,{})}),x.jsx($a,{path:"/projects",element:x.jsx(r6,{})}),x.jsx($a,{path:"/chat/:chatId",element:x.jsx(ov,{})})]})})})})}const aS="lever-theme",v6=S.createContext(void 0),w6=e=>e==="light"||e==="dark"||e==="system",oS=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",dv=e=>{if(typeof document>"u")return;const r=e==="system"?oS():e;document.documentElement.classList.toggle("dark",r==="dark")},S6=()=>{if(typeof window>"u")return"system";const e=window.localStorage.getItem(aS);return w6(e)?e:"system"};function k6({children:e}){const[r,l]=S.useState(S6);S.useEffect(()=>{dv(r),typeof window<"u"&&window.localStorage.setItem(aS,r)},[r]),S.useEffect(()=>{if(r!=="system")return;const o=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>dv("system");return o.addEventListener?(o.addEventListener("change",u),()=>o.removeEventListener("change",u)):(o.addListener(u),()=>o.removeListener(u))},[r]);const i=S.useMemo(()=>{const o=r==="system"?oS():r;return{theme:r,resolvedTheme:o,setTheme:l}},[r]);return x.jsx(v6.Provider,{value:i,children:e})}const sS=document.getElementById("root");if(!sS)throw new Error("Missing #root");z2.createRoot(sS).render(x.jsx(S.StrictMode,{children:x.jsx(lE,{children:x.jsx(k6,{children:x.jsx(b6,{})})})}));