@lovelybunch/api 1.0.69-alpha.4 → 1.0.69-alpha.5

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.
@@ -581,7 +581,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
581
581
 
582
582
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
583
583
 
584
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},$$="DialogDescriptionWarning",z$=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pO($$).contentName}}.`;return C.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Zv=eO,mO=nO,Qv=aO,wd=sO,Cd=iO,Td=lO,Ad=uO,tm=hO;const gO=Zv,G$=Qv,bO=C.forwardRef(({className:e,...t},n)=>r.jsx(wd,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));bO.displayName=wd.displayName;const q$=ic("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Jv=C.forwardRef(({side:e="right",className:t,children:n,...a},s)=>r.jsxs(G$,{children:[r.jsx(bO,{}),r.jsxs(Cd,{ref:s,className:Ne(q$({side:e}),t),...a,children:[n,r.jsxs(tm,{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-secondary",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jv.displayName=Cd.displayName;const ey=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",e),...t});ey.displayName="SheetHeader";const ty=C.forwardRef(({className:e,...t},n)=>r.jsx(Td,{ref:n,className:Ne("text-lg font-semibold text-foreground",e),...t}));ty.displayName=Td.displayName;const xO=C.forwardRef(({className:e,...t},n)=>r.jsx(Ad,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));xO.displayName=Ad.displayName;function L2({className:e,...t}){return r.jsx("div",{className:Ne("animate-pulse rounded-md bg-muted",e),...t})}const W$=["top","right","bottom","left"],Ai=Math.min,ea=Math.max,fp=Math.round,Sf=Math.floor,Xa=e=>({x:e,y:e}),V$={left:"right",right:"left",bottom:"top",top:"bottom"},Y$={start:"end",end:"start"};function Dx(e,t,n){return ea(e,Ai(t,n))}function Ns(e,t){return typeof e=="function"?e(t):e}function ks(e){return e.split("-")[0]}function cc(e){return e.split("-")[1]}function ny(e){return e==="x"?"y":"x"}function ry(e){return e==="y"?"height":"width"}const K$=new Set(["top","bottom"]);function Va(e){return K$.has(ks(e))?"y":"x"}function ay(e){return ny(Va(e))}function X$(e,t,n){n===void 0&&(n=!1);const a=cc(e),s=ay(e),o=ry(s);let u=s==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(u=pp(u)),[u,pp(u)]}function Z$(e){const t=pp(e);return[Ix(e),t,Ix(t)]}function Ix(e){return e.replace(/start|end/g,t=>Y$[t])}const j2=["left","right"],M2=["right","left"],Q$=["top","bottom"],J$=["bottom","top"];function ez(e,t,n){switch(e){case"top":case"bottom":return n?t?M2:j2:t?j2:M2;case"left":case"right":return t?Q$:J$;default:return[]}}function tz(e,t,n,a){const s=cc(e);let o=ez(ks(e),n==="start",a);return s&&(o=o.map(u=>u+"-"+s),t&&(o=o.concat(o.map(Ix)))),o}function pp(e){return e.replace(/left|right|bottom|top/g,t=>V$[t])}function nz(e){return{top:0,right:0,bottom:0,left:0,...e}}function vO(e){return typeof e!="number"?nz(e):{top:e,right:e,bottom:e,left:e}}function mp(e){const{x:t,y:n,width:a,height:s}=e;return{width:a,height:s,top:n,left:t,right:t+a,bottom:n+s,x:t,y:n}}function F2(e,t,n){let{reference:a,floating:s}=e;const o=Va(t),u=ay(t),c=ry(u),d=ks(t),h=o==="y",p=a.x+a.width/2-s.width/2,m=a.y+a.height/2-s.height/2,b=a[c]/2-s[c]/2;let v;switch(d){case"top":v={x:p,y:a.y-s.height};break;case"bottom":v={x:p,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:m};break;case"left":v={x:a.x-s.width,y:m};break;default:v={x:a.x,y:a.y}}switch(cc(t)){case"start":v[u]-=b*(n&&h?-1:1);break;case"end":v[u]+=b*(n&&h?-1:1);break}return v}const rz=async(e,t,n)=>{const{placement:a="bottom",strategy:s="absolute",middleware:o=[],platform:u}=n,c=o.filter(Boolean),d=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=F2(h,a,d),b=a,v={},w=0;for(let S=0;S<c.length;S++){const{name:g,fn:y}=c[S],{x:_,y:E,data:T,reset:N}=await y({x:p,y:m,initialPlacement:a,placement:b,strategy:s,middlewareData:v,rects:h,platform:u,elements:{reference:e,floating:t}});p=_??p,m=E??m,v={...v,[g]:{...v[g],...T}},N&&w<=50&&(w++,typeof N=="object"&&(N.placement&&(b=N.placement),N.rects&&(h=N.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):N.rects),{x:p,y:m}=F2(h,b,d)),S=-1)}return{x:p,y:m,placement:b,strategy:s,middlewareData:v}};async function rd(e,t){var n;t===void 0&&(t={});const{x:a,y:s,platform:o,rects:u,elements:c,strategy:d}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:b=!1,padding:v=0}=Ns(t,e),w=vO(v),g=c[b?m==="floating"?"reference":"floating":m],y=mp(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:h,rootBoundary:p,strategy:d})),_=m==="floating"?{x:a,y:s,width:u.floating.width,height:u.floating.height}:u.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),T=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},N=mp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:E,strategy:d}):_);return{top:(y.top-N.top+w.top)/T.y,bottom:(N.bottom-y.bottom+w.bottom)/T.y,left:(y.left-N.left+w.left)/T.x,right:(N.right-y.right+w.right)/T.x}}const az=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:s,rects:o,platform:u,elements:c,middlewareData:d}=t,{element:h,padding:p=0}=Ns(e,t)||{};if(h==null)return{};const m=vO(p),b={x:n,y:a},v=ay(s),w=ry(v),S=await u.getDimensions(h),g=v==="y",y=g?"top":"left",_=g?"bottom":"right",E=g?"clientHeight":"clientWidth",T=o.reference[w]+o.reference[v]-b[v]-o.floating[w],N=b[v]-o.reference[v],k=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let L=k?k[E]:0;(!L||!await(u.isElement==null?void 0:u.isElement(k)))&&(L=c.floating[E]||o.floating[w]);const R=T/2-N/2,j=L/2-S[w]/2-1,M=Ai(m[y],j),B=Ai(m[_],j),H=M,P=L-S[w]-B,$=L/2-S[w]/2+R,ee=Dx(H,$,P),U=!d.arrow&&cc(s)!=null&&$!==ee&&o.reference[w]/2-($<H?M:B)-S[w]/2<0,J=U?$<H?$-H:$-P:0;return{[v]:b[v]+J,data:{[v]:ee,centerOffset:$-ee-J,...U&&{alignmentOffset:J}},reset:U}}}),sz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:s,middlewareData:o,rects:u,initialPlacement:c,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...g}=Ns(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=ks(s),_=Va(c),E=ks(c)===c,T=await(d.isRTL==null?void 0:d.isRTL(h.floating)),N=b||(E||!S?[pp(c)]:Z$(c)),k=w!=="none";!b&&k&&N.push(...tz(c,S,w,T));const L=[c,...N],R=await rd(t,g),j=[];let M=((a=o.flip)==null?void 0:a.overflows)||[];if(p&&j.push(R[y]),m){const $=X$(s,u,T);j.push(R[$[0]],R[$[1]])}if(M=[...M,{placement:s,overflows:j}],!j.every($=>$<=0)){var B,H;const $=(((B=o.flip)==null?void 0:B.index)||0)+1,ee=L[$];if(ee&&(!(m==="alignment"?_!==Va(ee):!1)||M.every(X=>Va(X.placement)===_?X.overflows[0]>0:!0)))return{data:{index:$,overflows:M},reset:{placement:ee}};let U=(H=M.filter(J=>J.overflows[0]<=0).sort((J,X)=>J.overflows[1]-X.overflows[1])[0])==null?void 0:H.placement;if(!U)switch(v){case"bestFit":{var P;const J=(P=M.filter(X=>{if(k){const F=Va(X.placement);return F===_||F==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(F=>F>0).reduce((F,O)=>F+O,0)]).sort((X,F)=>X[1]-F[1])[0])==null?void 0:P[0];J&&(U=J);break}case"initialPlacement":U=c;break}if(s!==U)return{reset:{placement:U}}}return{}}}};function P2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function B2(e){return W$.some(t=>e[t]>=0)}const iz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...s}=Ns(e,t);switch(a){case"referenceHidden":{const o=await rd(t,{...s,elementContext:"reference"}),u=P2(o,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:B2(u)}}}case"escaped":{const o=await rd(t,{...s,altBoundary:!0}),u=P2(o,n.floating);return{data:{escapedOffsets:u,escaped:B2(u)}}}default:return{}}}}},yO=new Set(["left","top"]);async function oz(e,t){const{placement:n,platform:a,elements:s}=e,o=await(a.isRTL==null?void 0:a.isRTL(s.floating)),u=ks(n),c=cc(n),d=Va(n)==="y",h=yO.has(u)?-1:1,p=o&&d?-1:1,m=Ns(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof w=="number"&&(v=c==="end"?w*-1:w),d?{x:v*p,y:b*h}:{x:b*h,y:v*p}}const lz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:s,y:o,placement:u,middlewareData:c}=t,d=await oz(t,e);return u===((n=c.offset)==null?void 0:n.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:s+d.x,y:o+d.y,data:{...d,placement:u}}}}},cz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:s}=t,{mainAxis:o=!0,crossAxis:u=!1,limiter:c={fn:g=>{let{x:y,y:_}=g;return{x:y,y:_}}},...d}=Ns(e,t),h={x:n,y:a},p=await rd(t,d),m=Va(ks(s)),b=ny(m);let v=h[b],w=h[m];if(o){const g=b==="y"?"top":"left",y=b==="y"?"bottom":"right",_=v+p[g],E=v-p[y];v=Dx(_,v,E)}if(u){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",_=w+p[g],E=w-p[y];w=Dx(_,w,E)}const S=c.fn({...t,[b]:v,[m]:w});return{...S,data:{x:S.x-n,y:S.y-a,enabled:{[b]:o,[m]:u}}}}}},uz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:s,rects:o,middlewareData:u}=t,{offset:c=0,mainAxis:d=!0,crossAxis:h=!0}=Ns(e,t),p={x:n,y:a},m=Va(s),b=ny(m);let v=p[b],w=p[m];const S=Ns(c,t),g=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(d){const E=b==="y"?"height":"width",T=o.reference[b]-o.floating[E]+g.mainAxis,N=o.reference[b]+o.reference[E]-g.mainAxis;v<T?v=T:v>N&&(v=N)}if(h){var y,_;const E=b==="y"?"width":"height",T=yO.has(ks(s)),N=o.reference[m]-o.floating[E]+(T&&((y=u.offset)==null?void 0:y[m])||0)+(T?0:g.crossAxis),k=o.reference[m]+o.reference[E]+(T?0:((_=u.offset)==null?void 0:_[m])||0)-(T?g.crossAxis:0);w<N?w=N:w>k&&(w=k)}return{[b]:v,[m]:w}}}},dz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:s,rects:o,platform:u,elements:c}=t,{apply:d=()=>{},...h}=Ns(e,t),p=await rd(t,h),m=ks(s),b=cc(s),v=Va(s)==="y",{width:w,height:S}=o.floating;let g,y;m==="top"||m==="bottom"?(g=m,y=b===(await(u.isRTL==null?void 0:u.isRTL(c.floating))?"start":"end")?"left":"right"):(y=m,g=b==="end"?"top":"bottom");const _=S-p.top-p.bottom,E=w-p.left-p.right,T=Ai(S-p[g],_),N=Ai(w-p[y],E),k=!t.middlewareData.shift;let L=T,R=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=E),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(L=_),k&&!b){const M=ea(p.left,0),B=ea(p.right,0),H=ea(p.top,0),P=ea(p.bottom,0);v?R=w-2*(M!==0||B!==0?M+B:ea(p.left,p.right)):L=S-2*(H!==0||P!==0?H+P:ea(p.top,p.bottom))}await d({...t,availableWidth:R,availableHeight:L});const j=await u.getDimensions(c.floating);return w!==j.width||S!==j.height?{reset:{rects:!0}}:{}}}};function nm(){return typeof window<"u"}function uc(e){return EO(e)?(e.nodeName||"").toLowerCase():"#document"}function na(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function es(e){var t;return(t=(EO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EO(e){return nm()?e instanceof Node||e instanceof na(e).Node:!1}function Da(e){return nm()?e instanceof Element||e instanceof na(e).Element:!1}function Qa(e){return nm()?e instanceof HTMLElement||e instanceof na(e).HTMLElement:!1}function U2(e){return!nm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof na(e).ShadowRoot}const hz=new Set(["inline","contents"]);function Nd(e){const{overflow:t,overflowX:n,overflowY:a,display:s}=Ia(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!hz.has(s)}const fz=new Set(["table","td","th"]);function pz(e){return fz.has(uc(e))}const mz=[":popover-open",":modal"];function rm(e){return mz.some(t=>{try{return e.matches(t)}catch{return!1}})}const gz=["transform","translate","scale","rotate","perspective"],bz=["transform","translate","scale","rotate","perspective","filter"],xz=["paint","layout","strict","content"];function sy(e){const t=iy(),n=Da(e)?Ia(e):e;return gz.some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bz.some(a=>(n.willChange||"").includes(a))||xz.some(a=>(n.contain||"").includes(a))}function vz(e){let t=Ni(e);for(;Qa(t)&&!zl(t);){if(sy(t))return t;if(rm(t))return null;t=Ni(t)}return null}function iy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yz=new Set(["html","body","#document"]);function zl(e){return yz.has(uc(e))}function Ia(e){return na(e).getComputedStyle(e)}function am(e){return Da(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ni(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U2(e)&&e.host||es(e);return U2(t)?t.host:t}function _O(e){const t=Ni(e);return zl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qa(t)&&Nd(t)?t:_O(t)}function ad(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=_O(e),o=s===((a=e.ownerDocument)==null?void 0:a.body),u=na(s);if(o){const c=Ox(u);return t.concat(u,u.visualViewport||[],Nd(s)?s:[],c&&n?ad(c):[])}return t.concat(s,ad(s,[],n))}function Ox(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function SO(e){const t=Ia(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const s=Qa(e),o=s?e.offsetWidth:n,u=s?e.offsetHeight:a,c=fp(n)!==o||fp(a)!==u;return c&&(n=o,a=u),{width:n,height:a,$:c}}function oy(e){return Da(e)?e:e.contextElement}function Ll(e){const t=oy(e);if(!Qa(t))return Xa(1);const n=t.getBoundingClientRect(),{width:a,height:s,$:o}=SO(t);let u=(o?fp(n.width):n.width)/a,c=(o?fp(n.height):n.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!c||!Number.isFinite(c))&&(c=1),{x:u,y:c}}const Ez=Xa(0);function wO(e){const t=na(e);return!iy()||!t.visualViewport?Ez:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _z(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==na(e)?!1:t}function mo(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=oy(e);let u=Xa(1);t&&(a?Da(a)&&(u=Ll(a)):u=Ll(e));const c=_z(o,n,a)?wO(o):Xa(0);let d=(s.left+c.x)/u.x,h=(s.top+c.y)/u.y,p=s.width/u.x,m=s.height/u.y;if(o){const b=na(o),v=a&&Da(a)?na(a):a;let w=b,S=Ox(w);for(;S&&a&&v!==w;){const g=Ll(S),y=S.getBoundingClientRect(),_=Ia(S),E=y.left+(S.clientLeft+parseFloat(_.paddingLeft))*g.x,T=y.top+(S.clientTop+parseFloat(_.paddingTop))*g.y;d*=g.x,h*=g.y,p*=g.x,m*=g.y,d+=E,h+=T,w=na(S),S=Ox(w)}}return mp({width:p,height:m,x:d,y:h})}function ly(e,t){const n=am(e).scrollLeft;return t?t.left+n:mo(es(e)).left+n}function CO(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=a.left+t.scrollLeft-(n?0:ly(e,a)),o=a.top+t.scrollTop;return{x:s,y:o}}function Sz(e){let{elements:t,rect:n,offsetParent:a,strategy:s}=e;const o=s==="fixed",u=es(a),c=t?rm(t.floating):!1;if(a===u||c&&o)return n;let d={scrollLeft:0,scrollTop:0},h=Xa(1);const p=Xa(0),m=Qa(a);if((m||!m&&!o)&&((uc(a)!=="body"||Nd(u))&&(d=am(a)),Qa(a))){const v=mo(a);h=Ll(a),p.x=v.x+a.clientLeft,p.y=v.y+a.clientTop}const b=u&&!m&&!o?CO(u,d,!0):Xa(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+b.x,y:n.y*h.y-d.scrollTop*h.y+p.y+b.y}}function wz(e){return Array.from(e.getClientRects())}function Cz(e){const t=es(e),n=am(e),a=e.ownerDocument.body,s=ea(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=ea(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+ly(e);const c=-n.scrollTop;return Ia(a).direction==="rtl"&&(u+=ea(t.clientWidth,a.clientWidth)-s),{width:s,height:o,x:u,y:c}}function Tz(e,t){const n=na(e),a=es(e),s=n.visualViewport;let o=a.clientWidth,u=a.clientHeight,c=0,d=0;if(s){o=s.width,u=s.height;const h=iy();(!h||h&&t==="fixed")&&(c=s.offsetLeft,d=s.offsetTop)}return{width:o,height:u,x:c,y:d}}const Az=new Set(["absolute","fixed"]);function Nz(e,t){const n=mo(e,!0,t==="fixed"),a=n.top+e.clientTop,s=n.left+e.clientLeft,o=Qa(e)?Ll(e):Xa(1),u=e.clientWidth*o.x,c=e.clientHeight*o.y,d=s*o.x,h=a*o.y;return{width:u,height:c,x:d,y:h}}function H2(e,t,n){let a;if(t==="viewport")a=Tz(e,n);else if(t==="document")a=Cz(es(e));else if(Da(t))a=Nz(t,n);else{const s=wO(e);a={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return mp(a)}function TO(e,t){const n=Ni(e);return n===t||!Da(n)||zl(n)?!1:Ia(n).position==="fixed"||TO(n,t)}function kz(e,t){const n=t.get(e);if(n)return n;let a=ad(e,[],!1).filter(c=>Da(c)&&uc(c)!=="body"),s=null;const o=Ia(e).position==="fixed";let u=o?Ni(e):e;for(;Da(u)&&!zl(u);){const c=Ia(u),d=sy(u);!d&&c.position==="fixed"&&(s=null),(o?!d&&!s:!d&&c.position==="static"&&!!s&&Az.has(s.position)||Nd(u)&&!d&&TO(e,u))?a=a.filter(p=>p!==u):s=c,u=Ni(u)}return t.set(e,a),a}function Rz(e){let{element:t,boundary:n,rootBoundary:a,strategy:s}=e;const u=[...n==="clippingAncestors"?rm(t)?[]:kz(t,this._c):[].concat(n),a],c=u[0],d=u.reduce((h,p)=>{const m=H2(t,p,s);return h.top=ea(m.top,h.top),h.right=Ai(m.right,h.right),h.bottom=Ai(m.bottom,h.bottom),h.left=ea(m.left,h.left),h},H2(t,c,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Dz(e){const{width:t,height:n}=SO(e);return{width:t,height:n}}function Iz(e,t,n){const a=Qa(t),s=es(t),o=n==="fixed",u=mo(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const d=Xa(0);function h(){d.x=ly(s)}if(a||!a&&!o)if((uc(t)!=="body"||Nd(s))&&(c=am(t)),a){const v=mo(t,!0,o,t);d.x=v.x+t.clientLeft,d.y=v.y+t.clientTop}else s&&h();o&&!a&&s&&h();const p=s&&!a&&!o?CO(s,c):Xa(0),m=u.left+c.scrollLeft-d.x-p.x,b=u.top+c.scrollTop-d.y-p.y;return{x:m,y:b,width:u.width,height:u.height}}function N0(e){return Ia(e).position==="static"}function $2(e,t){if(!Qa(e)||Ia(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return es(e)===n&&(n=n.ownerDocument.body),n}function AO(e,t){const n=na(e);if(rm(e))return n;if(!Qa(e)){let s=Ni(e);for(;s&&!zl(s);){if(Da(s)&&!N0(s))return s;s=Ni(s)}return n}let a=$2(e,t);for(;a&&pz(a)&&N0(a);)a=$2(a,t);return a&&zl(a)&&N0(a)&&!sy(a)?n:a||vz(e)||n}const Oz=async function(e){const t=this.getOffsetParent||AO,n=this.getDimensions,a=await n(e.floating);return{reference:Iz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Lz(e){return Ia(e).direction==="rtl"}const jz={convertOffsetParentRelativeRectToViewportRelativeRect:Sz,getDocumentElement:es,getClippingRect:Rz,getOffsetParent:AO,getElementRects:Oz,getClientRects:wz,getDimensions:Dz,getScale:Ll,isElement:Da,isRTL:Lz};function NO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Mz(e,t){let n=null,a;const s=es(e);function o(){var c;clearTimeout(a),(c=n)==null||c.disconnect(),n=null}function u(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),o();const h=e.getBoundingClientRect(),{left:p,top:m,width:b,height:v}=h;if(c||t(),!b||!v)return;const w=Sf(m),S=Sf(s.clientWidth-(p+b)),g=Sf(s.clientHeight-(m+v)),y=Sf(p),E={rootMargin:-w+"px "+-S+"px "+-g+"px "+-y+"px",threshold:ea(0,Ai(1,d))||1};let T=!0;function N(k){const L=k[0].intersectionRatio;if(L!==d){if(!T)return u();L?u(!1,L):a=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!NO(h,e.getBoundingClientRect())&&u(),T=!1}try{n=new IntersectionObserver(N,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return u(!0),o}function Fz(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=a,h=oy(e),p=s||o?[...h?ad(h):[],...ad(t)]:[];p.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const m=h&&c?Mz(h,n):null;let b=-1,v=null;u&&(v=new ResizeObserver(y=>{let[_]=y;_&&_.target===h&&v&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var E;(E=v)==null||E.observe(t)})),n()}),h&&!d&&v.observe(h),v.observe(t));let w,S=d?mo(e):null;d&&g();function g(){const y=mo(e);S&&!NO(S,y)&&n(),S=y,w=requestAnimationFrame(g)}return n(),()=>{var y;p.forEach(_=>{s&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),m?.(),(y=v)==null||y.disconnect(),v=null,d&&cancelAnimationFrame(w)}}const Pz=lz,Bz=cz,Uz=sz,Hz=dz,$z=iz,z2=az,zz=uz,Gz=(e,t,n)=>{const a=new Map,s={platform:jz,...n},o={...s.platform,_c:a};return rz(e,t,{...s,platform:o})};var qz=typeof document<"u",Wz=function(){},Vf=qz?C.useLayoutEffect:Wz;function gp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,a,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!gp(e[a],t[a]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,s[a]))return!1;for(a=n;a--!==0;){const o=s[a];if(!(o==="_owner"&&e.$$typeof)&&!gp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function kO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G2(e,t){const n=kO(e);return Math.round(t*n)/n}function k0(e){const t=C.useRef(e);return Vf(()=>{t.current=e}),t}function Vz(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:s,elements:{reference:o,floating:u}={},transform:c=!0,whileElementsMounted:d,open:h}=e,[p,m]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=C.useState(a);gp(b,a)||v(a);const[w,S]=C.useState(null),[g,y]=C.useState(null),_=C.useCallback(X=>{X!==k.current&&(k.current=X,S(X))},[]),E=C.useCallback(X=>{X!==L.current&&(L.current=X,y(X))},[]),T=o||w,N=u||g,k=C.useRef(null),L=C.useRef(null),R=C.useRef(p),j=d!=null,M=k0(d),B=k0(s),H=k0(h),P=C.useCallback(()=>{if(!k.current||!L.current)return;const X={placement:t,strategy:n,middleware:b};B.current&&(X.platform=B.current),Gz(k.current,L.current,X).then(F=>{const O={...F,isPositioned:H.current!==!1};$.current&&!gp(R.current,O)&&(R.current=O,nc.flushSync(()=>{m(O)}))})},[b,t,n,B,H]);Vf(()=>{h===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,m(X=>({...X,isPositioned:!1})))},[h]);const $=C.useRef(!1);Vf(()=>($.current=!0,()=>{$.current=!1}),[]),Vf(()=>{if(T&&(k.current=T),N&&(L.current=N),T&&N){if(M.current)return M.current(T,N,P);P()}},[T,N,P,M,j]);const ee=C.useMemo(()=>({reference:k,floating:L,setReference:_,setFloating:E}),[_,E]),U=C.useMemo(()=>({reference:T,floating:N}),[T,N]),J=C.useMemo(()=>{const X={position:n,left:0,top:0};if(!U.floating)return X;const F=G2(U.floating,p.x),O=G2(U.floating,p.y);return c?{...X,transform:"translate("+F+"px, "+O+"px)",...kO(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:O}},[n,c,U.floating,p.x,p.y]);return C.useMemo(()=>({...p,update:P,refs:ee,elements:U,floatingStyles:J}),[p,P,ee,U,J])}const Yz=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:s}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?z2({element:a.current,padding:s}).fn(n):{}:a?z2({element:a,padding:s}).fn(n):{}}}},Kz=(e,t)=>({...Pz(e),options:[e,t]}),Xz=(e,t)=>({...Bz(e),options:[e,t]}),Zz=(e,t)=>({...zz(e),options:[e,t]}),Qz=(e,t)=>({...Uz(e),options:[e,t]}),Jz=(e,t)=>({...Hz(e),options:[e,t]}),eG=(e,t)=>({...$z(e),options:[e,t]}),tG=(e,t)=>({...Yz(e),options:[e,t]});var nG="Arrow",RO=C.forwardRef((e,t)=>{const{children:n,width:a=10,height:s=5,...o}=e;return r.jsx(lt.svg,{...o,ref:t,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});RO.displayName=nG;var rG=RO;function cy(e){const[t,n]=C.useState(void 0);return nr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,c;if("borderBoxSize"in o){const d=o.borderBoxSize,h=Array.isArray(d)?d[0]:d;u=h.inlineSize,c=h.blockSize}else u=e.offsetWidth,c=e.offsetHeight;n({width:u,height:c})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var uy="Popper",[DO,dc]=Rr(uy),[aG,IO]=DO(uy),OO=e=>{const{__scopePopper:t,children:n}=e,[a,s]=C.useState(null);return r.jsx(aG,{scope:t,anchor:a,onAnchorChange:s,children:n})};OO.displayName=uy;var LO="PopperAnchor",jO=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...s}=e,o=IO(LO,n),u=C.useRef(null),c=Et(t,u),d=C.useRef(null);return C.useEffect(()=>{const h=d.current;d.current=a?.current||u.current,h!==d.current&&o.onAnchorChange(d.current)}),a?null:r.jsx(lt.div,{...s,ref:c})});jO.displayName=LO;var dy="PopperContent",[sG,iG]=DO(dy),MO=C.forwardRef((e,t)=>{const{__scopePopper:n,side:a="bottom",sideOffset:s=0,align:o="center",alignOffset:u=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:w,...S}=e,g=IO(dy,n),[y,_]=C.useState(null),E=Et(t,K=>_(K)),[T,N]=C.useState(null),k=cy(T),L=k?.width??0,R=k?.height??0,j=a+(o!=="center"?"-"+o:""),M=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},B=Array.isArray(h)?h:[h],H=B.length>0,P={padding:M,boundary:B.filter(lG),altBoundary:H},{refs:$,floatingStyles:ee,placement:U,isPositioned:J,middlewareData:X}=Vz({strategy:"fixed",placement:j,whileElementsMounted:(...K)=>Fz(...K,{animationFrame:v==="always"}),elements:{reference:g.anchor},middleware:[Kz({mainAxis:s+R,alignmentAxis:u}),d&&Xz({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Zz():void 0,...P}),d&&Qz({...P}),Jz({...P,apply:({elements:K,rects:G,availableWidth:Y,availableHeight:oe})=>{const{width:ie,height:de}=G.reference,Te=K.floating.style;Te.setProperty("--radix-popper-available-width",`${Y}px`),Te.setProperty("--radix-popper-available-height",`${oe}px`),Te.setProperty("--radix-popper-anchor-width",`${ie}px`),Te.setProperty("--radix-popper-anchor-height",`${de}px`)}}),T&&tG({element:T,padding:c}),cG({arrowWidth:L,arrowHeight:R}),b&&eG({strategy:"referenceHidden",...P})]}),[F,O]=BO(U),V=kn(w);nr(()=>{J&&V?.()},[J,V]);const te=X.arrow?.x,q=X.arrow?.y,W=X.arrow?.centerOffset!==0,[ae,ne]=C.useState();return nr(()=>{y&&ne(window.getComputedStyle(y).zIndex)},[y]),r.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:J?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(sG,{scope:n,placedSide:F,onArrowChange:N,arrowX:te,arrowY:q,shouldHideArrow:W,children:r.jsx(lt.div,{"data-side":F,"data-align":O,...S,ref:E,style:{...S.style,animation:J?void 0:"none"}})})})});MO.displayName=dy;var FO="PopperArrow",oG={top:"bottom",right:"left",bottom:"top",left:"right"},PO=C.forwardRef(function(t,n){const{__scopePopper:a,...s}=t,o=iG(FO,a),u=oG[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(rG,{...s,ref:n,style:{...s.style,display:"block"}})})});PO.displayName=FO;function lG(e){return e!==null}var cG=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:a,middlewareData:s}=t,u=s.arrow?.centerOffset!==0,c=u?0:e.arrowWidth,d=u?0:e.arrowHeight,[h,p]=BO(n),m={start:"0%",center:"50%",end:"100%"}[p],b=(s.arrow?.x??0)+c/2,v=(s.arrow?.y??0)+d/2;let w="",S="";return h==="bottom"?(w=u?m:`${b}px`,S=`${-d}px`):h==="top"?(w=u?m:`${b}px`,S=`${a.floating.height+d}px`):h==="right"?(w=`${-d}px`,S=u?m:`${v}px`):h==="left"&&(w=`${a.floating.width+d}px`,S=u?m:`${v}px`),{data:{x:w,y:S}}}});function BO(e){const[t,n="center"]=e.split("-");return[t,n]}var hy=OO,fy=jO,py=MO,my=PO,[sm,Jue]=Rr("Tooltip",[dc]),im=dc(),UO="TooltipProvider",uG=700,Lx="tooltip.open",[dG,gy]=sm(UO),HO=e=>{const{__scopeTooltip:t,delayDuration:n=uG,skipDelayDuration:a=300,disableHoverableContent:s=!1,children:o}=e,u=C.useRef(!0),c=C.useRef(!1),d=C.useRef(0);return C.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),r.jsx(dG,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(d.current),u.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:C.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:o})};HO.displayName=UO;var sd="Tooltip",[hG,om]=sm(sd),$O=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:s,onOpenChange:o,disableHoverableContent:u,delayDuration:c}=e,d=gy(sd,e.__scopeTooltip),h=im(t),[p,m]=C.useState(null),b=ka(),v=C.useRef(0),w=u??d.disableHoverableContent,S=c??d.delayDuration,g=C.useRef(!1),[y,_]=Za({prop:a,defaultProp:s??!1,onChange:L=>{L?(d.onOpen(),document.dispatchEvent(new CustomEvent(Lx))):d.onClose(),o?.(L)},caller:sd}),E=C.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),T=C.useCallback(()=>{window.clearTimeout(v.current),v.current=0,g.current=!1,_(!0)},[_]),N=C.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_(!1)},[_]),k=C.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{g.current=!0,_(!0),v.current=0},S)},[S,_]);return C.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),r.jsx(hy,{...h,children:r.jsx(hG,{scope:t,contentId:b,open:y,stateAttribute:E,trigger:p,onTriggerChange:m,onTriggerEnter:C.useCallback(()=>{d.isOpenDelayedRef.current?k():T()},[d.isOpenDelayedRef,k,T]),onTriggerLeave:C.useCallback(()=>{w?N():(window.clearTimeout(v.current),v.current=0)},[N,w]),onOpen:T,onClose:N,disableHoverableContent:w,children:n})})};$O.displayName=sd;var jx="TooltipTrigger",zO=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,s=om(jx,n),o=gy(jx,n),u=im(n),c=C.useRef(null),d=Et(t,c,s.onTriggerChange),h=C.useRef(!1),p=C.useRef(!1),m=C.useCallback(()=>h.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),r.jsx(fy,{asChild:!0,...u,children:r.jsx(lt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...a,ref:d,onPointerMove:We(e.onPointerMove,b=>{b.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:We(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:We(e.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:We(e.onFocus,()=>{h.current||s.onOpen()}),onBlur:We(e.onBlur,s.onClose),onClick:We(e.onClick,s.onClose)})})});zO.displayName=jx;var fG="TooltipPortal",[ede,pG]=sm(fG,{forceMount:void 0}),Gl="TooltipContent",GO=C.forwardRef((e,t)=>{const n=pG(Gl,e.__scopeTooltip),{forceMount:a=n.forceMount,side:s="top",...o}=e,u=om(Gl,e.__scopeTooltip);return r.jsx(ur,{present:a||u.open,children:u.disableHoverableContent?r.jsx(qO,{side:s,...o,ref:t}):r.jsx(mG,{side:s,...o,ref:t})})}),mG=C.forwardRef((e,t)=>{const n=om(Gl,e.__scopeTooltip),a=gy(Gl,e.__scopeTooltip),s=C.useRef(null),o=Et(t,s),[u,c]=C.useState(null),{trigger:d,onClose:h}=n,p=s.current,{onPointerInTransitChange:m}=a,b=C.useCallback(()=>{c(null),m(!1)},[m]),v=C.useCallback((w,S)=>{const g=w.currentTarget,y={x:w.clientX,y:w.clientY},_=yG(y,g.getBoundingClientRect()),E=EG(y,_),T=_G(S.getBoundingClientRect()),N=wG([...E,...T]);c(N),m(!0)},[m]);return C.useEffect(()=>()=>b(),[b]),C.useEffect(()=>{if(d&&p){const w=g=>v(g,p),S=g=>v(g,d);return d.addEventListener("pointerleave",w),p.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",S)}}},[d,p,v,b]),C.useEffect(()=>{if(u){const w=S=>{const g=S.target,y={x:S.clientX,y:S.clientY},_=d?.contains(g)||p?.contains(g),E=!SG(y,u);_?b():E&&(b(),h())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[d,p,u,h,b]),r.jsx(qO,{...e,ref:o})}),[gG,bG]=sm(sd,{isInside:!1}),xG=BD("TooltipContent"),qO=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:u,...c}=e,d=om(Gl,n),h=im(n),{onClose:p}=d;return C.useEffect(()=>(document.addEventListener(Lx,p),()=>document.removeEventListener(Lx,p)),[p]),C.useEffect(()=>{if(d.trigger){const m=b=>{b.target?.contains(d.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[d.trigger,p]),r.jsx(sc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:r.jsxs(py,{"data-state":d.stateAttribute,...h,...c,ref:t,style:{...c.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:[r.jsx(xG,{children:a}),r.jsx(gG,{scope:n,isInside:!0,children:r.jsx(p7,{id:d.contentId,role:"tooltip",children:s||a})})]})})});GO.displayName=Gl;var WO="TooltipArrow",vG=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,s=im(n);return bG(WO,n).isInside?null:r.jsx(my,{...s,...a,ref:t})});vG.displayName=WO;function yG(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,a,s,o)){case o:return"left";case s:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function EG(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function _G(e){const{top:t,right:n,bottom:a,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:a},{x:s,y:a}]}function SG(e,t){const{x:n,y:a}=e;let s=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const c=t[o],d=t[u],h=c.x,p=c.y,m=d.x,b=d.y;p>a!=b>a&&n<(m-h)*(a-p)/(b-p)+h&&(s=!s)}return s}function wG(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),CG(t)}function CG(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const s=e[a];for(;t.length>=2;){const o=t[t.length-1],u=t[t.length-2];if((o.x-u.x)*(s.y-u.y)>=(o.y-u.y)*(s.x-u.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const s=e[a];for(;n.length>=2;){const o=n[n.length-1],u=n[n.length-2];if((o.x-u.x)*(s.y-u.y)>=(o.y-u.y)*(s.x-u.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var TG=HO,AG=$O,NG=zO,VO=GO;const kG=TG,RG=AG,DG=NG,YO=C.forwardRef(({className:e,sideOffset:t=4,...n},a)=>r.jsx(VO,{ref:a,sideOffset:t,className:Ne("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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),...n}));YO.displayName=VO.displayName;const IG="sidebar_state",OG=3600*24*7,LG="16rem",jG="18rem",MG="3rem",FG="b",KO=C.createContext(null);function lm(){const e=C.useContext(KO);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const XO=C.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:a,style:s,children:o,...u},c)=>{const d=UI(),[h,p]=C.useState(!1),[m,b]=C.useState(e),v=t??m,w=C.useCallback(_=>{const E=typeof _=="function"?_(v):_;n?n(E):b(E),document.cookie=`${IG}=${E}; path=/; max-age=${OG}`},[n,v]),S=C.useCallback(()=>d?p(_=>!_):w(_=>!_),[d,w,p]);C.useEffect(()=>{const _=E=>{E.key===FG&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),S())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[S]);const g=v?"expanded":"collapsed",y=C.useMemo(()=>({state:g,open:v,setOpen:w,isMobile:d,openMobile:h,setOpenMobile:p,toggleSidebar:S}),[g,v,w,d,h,p,S]);return r.jsx(KO.Provider,{value:y,children:r.jsx(kG,{delayDuration:0,children:r.jsx("div",{style:{"--sidebar-width":LG,"--sidebar-width-icon":MG,...s},className:Ne("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",a),ref:c,...u,children:o})})})});XO.displayName="SidebarProvider";const ZO=C.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:a,children:s,...o},u)=>{const{isMobile:c,state:d,openMobile:h,setOpenMobile:p}=lm();return n==="none"?r.jsx("div",{className:Ne("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",a),ref:u,...o,children:s}):c?r.jsx(gO,{open:h,onOpenChange:p,...o,children:r.jsxs(Jv,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":jG},side:e,children:[r.jsxs(ey,{className:"sr-only",children:[r.jsx(ty,{children:"Sidebar"}),r.jsx(xO,{children:"Displays the mobile sidebar."})]}),r.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):r.jsxs("div",{ref:u,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":e,children:[r.jsx("div",{className:Ne("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),r.jsx("div",{className:Ne("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...o,children:r.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:s})})]})});ZO.displayName="Sidebar";const QO=C.forwardRef(({className:e,onClick:t,...n},a)=>{const{toggleSidebar:s}=lm();return r.jsxs(se,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Ne("h-7 w-7",e),onClick:o=>{t?.(o),s()},...n,children:[r.jsx(p9,{}),r.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});QO.displayName="SidebarTrigger";const PG=C.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:a}=lm();return r.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:Ne("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});PG.displayName="SidebarRail";const JO=C.forwardRef(({className:e,...t},n)=>r.jsx("main",{ref:n,className:Ne("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));JO.displayName="SidebarInset";const BG=C.forwardRef(({className:e,...t},n)=>r.jsx(je,{ref:n,"data-sidebar":"input",className:Ne("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));BG.displayName="SidebarInput";const e3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"header",className:Ne("flex flex-col gap-2 p-2",e),...t}));e3.displayName="SidebarHeader";const t3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"footer",className:Ne("flex flex-col gap-2 p-2",e),...t}));t3.displayName="SidebarFooter";const UG=C.forwardRef(({className:e,...t},n)=>r.jsx(Ar,{ref:n,"data-sidebar":"separator",className:Ne("mx-2 w-auto bg-sidebar-border",e),...t}));UG.displayName="SidebarSeparator";const n3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"content",className:Ne("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));n3.displayName="SidebarContent";const Yf=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"group",className:Ne("relative flex w-full min-w-0 flex-col p-2",e),...t}));Yf.displayName="SidebarGroup";const Kf=C.forwardRef(({className:e,asChild:t=!1,...n},a)=>{const s=t?ac:"div";return r.jsx(s,{ref:a,"data-sidebar":"group-label",className:Ne("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});Kf.displayName="SidebarGroupLabel";const HG=C.forwardRef(({className:e,asChild:t=!1,...n},a)=>{const s=t?ac:"button";return r.jsx(s,{ref:a,"data-sidebar":"group-action",className:Ne("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});HG.displayName="SidebarGroupAction";const Xf=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"group-content",className:Ne("w-full text-sm",e),...t}));Xf.displayName="SidebarGroupContent";const Al=C.forwardRef(({className:e,...t},n)=>r.jsx("ul",{ref:n,"data-sidebar":"menu",className:Ne("flex w-full min-w-0 flex-col gap-1",e),...t}));Al.displayName="SidebarMenu";const Nl=C.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Ne("group/menu-item relative",e),...t}));Nl.displayName="SidebarMenuItem";const $G=ic("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),kl=C.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:a="default",tooltip:s,className:o,...u},c)=>{const d=e?ac:"button",{isMobile:h,state:p}=lm(),m=r.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":a,"data-active":t,className:Ne($G({variant:n,size:a}),o),...u});return s?(typeof s=="string"&&(s={children:s}),r.jsxs(RG,{children:[r.jsx(DG,{asChild:!0,children:m}),r.jsx(YO,{side:"right",align:"center",hidden:p!=="collapsed"||h,...s})]})):m});kl.displayName="SidebarMenuButton";const zG=C.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...a},s)=>{const o=t?ac:"button";return r.jsx(o,{ref:s,"data-sidebar":"menu-action",className:Ne("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...a})});zG.displayName="SidebarMenuAction";const Mx=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Ne("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-full px-1.5 text-xs font-semibold tabular-nums shadow-sm","transition-all duration-200 ease-in-out hover:scale-110","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Mx.displayName="SidebarMenuBadge";const GG=C.forwardRef(({className:e,showIcon:t=!1,...n},a)=>{const s=C.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return r.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:Ne("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&r.jsx(L2,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),r.jsx(L2,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});GG.displayName="SidebarMenuSkeleton";const qG=C.forwardRef(({className:e,...t},n)=>r.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Ne("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));qG.displayName="SidebarMenuSub";const WG=C.forwardRef(({...e},t)=>r.jsx("li",{ref:t,...e}));WG.displayName="SidebarMenuSubItem";const VG=C.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:a,...s},o)=>{const u=e?ac:"a";return r.jsx(u,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Ne("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...s})});VG.displayName="SidebarMenuSubButton";const YG="1.0.69-alpha.4",KG={version:YG};function XG({className:e}){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[r.jsx("path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4"}),r.jsx("path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3"}),r.jsx("path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35"}),r.jsx("path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14"})]})}const ZG=[{title:"Home",url:"/",icon:zU},{title:"Proposals",url:"/proposals",icon:$u},{title:"Agents",url:"/agents",icon:xr},{title:"Code",url:"/code",icon:yi},{title:"Utilities",url:"/utilities",icon:SI}],QG=[{title:"Overview",url:"/context/project",icon:xa},{title:"Architecture",url:"/context/architecture",icon:fo},{title:"Knowledge",url:"/context/knowledge",icon:Z7},{title:"Resources",url:"/resources",icon:Kp}],JG=[{title:"Source Control",url:"/git",icon:vi},{title:"Terminal",url:"/terminal",icon:Ts},{title:"Schedule",url:"/schedule",icon:$f},{title:"Identity",url:"/identity",icon:qU}],eq=[{title:"Documentation",url:"https://docs.coconut.dev/",icon:h9,external:!0},{title:"Settings",url:"/settings",icon:$l}];function tq(){const{badges:e}=Ed();return r.jsxs(ZO,{className:"bg-sidebar border-r border-sidebar-border",children:[r.jsx(e3,{children:r.jsx(Al,{children:r.jsx(Nl,{children:r.jsx(kl,{size:"lg",asChild:!0,className:"[&>svg]:!size-8",children:r.jsxs(rt,{to:"/",children:[r.jsx(XG,{className:"size-8"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsxs("span",{className:"font-semibold",children:[r.jsx("span",{className:"bg-gradient-to-r from-amber-500 via-orange-500 to-yellow-600 bg-clip-text text-transparent",children:"Coconut"}),r.jsx("span",{children:" Studio"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",KG.version]})]})]})})})})}),r.jsxs(n3,{children:[r.jsxs(Yf,{children:[r.jsx(Kf,{children:"Main"}),r.jsx(Xf,{children:r.jsx(Al,{children:ZG.map(t=>r.jsxs(Nl,{children:[r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})}),t.title==="Code"&&e.codeSessions>0&&r.jsx(Mx,{className:"bg-blue-600 text-white dark:bg-blue-500",children:e.codeSessions})]},t.title))})})]}),r.jsxs(Yf,{children:[r.jsx(Kf,{children:"Project"}),r.jsx(Xf,{children:r.jsx(Al,{children:QG.map(t=>r.jsx(Nl,{children:r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})})},t.title))})})]}),r.jsxs(Yf,{children:[r.jsx(Kf,{children:"System"}),r.jsx(Xf,{children:r.jsx(Al,{children:JG.map(t=>{let n=0;return t.title==="Source Control"&&e.gitChanges>0?n=e.gitChanges:t.title==="Terminal"&&e.terminalSessions>0?n=e.terminalSessions:t.title==="Schedule"&&e.runningScheduledJobs>0&&(n=e.runningScheduledJobs),r.jsxs(Nl,{children:[r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})}),n>0&&r.jsx(Mx,{className:"bg-blue-600 text-white dark:bg-blue-500",children:n})]},t.title)})})})]})]}),r.jsx(t3,{children:r.jsx(Al,{children:eq.map(t=>r.jsx(Nl,{children:r.jsx(kl,{asChild:!0,children:t.external?r.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]}):r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})})},t.title))})})]})}function Fx(e,[t,n]){return Math.min(n,Math.max(t,e))}var nq=C.createContext(void 0);function hc(e){const t=C.useContext(nq);return e||t||"ltr"}function by(e){const t=C.useRef({value:e,previous:e});return C.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var rq=[" ","Enter","ArrowUp","ArrowDown"],aq=[" ","Enter"],go="Select",[cm,um,sq]=zp(go),[fc,tde]=Rr(go,[sq,dc]),dm=dc(),[iq,Oi]=fc(go),[oq,lq]=fc(go),r3=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:s,onOpenChange:o,value:u,defaultValue:c,onValueChange:d,dir:h,name:p,autoComplete:m,disabled:b,required:v,form:w}=e,S=dm(t),[g,y]=C.useState(null),[_,E]=C.useState(null),[T,N]=C.useState(!1),k=hc(h),[L,R]=Za({prop:a,defaultProp:s??!1,onChange:o,caller:go}),[j,M]=Za({prop:u,defaultProp:c,onChange:d,caller:go}),B=C.useRef(null),H=g?w||!!g.closest("form"):!0,[P,$]=C.useState(new Set),ee=Array.from(P).map(U=>U.props.value).join(";");return r.jsx(hy,{...S,children:r.jsxs(iq,{required:v,scope:t,trigger:g,onTriggerChange:y,valueNode:_,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:N,contentId:ka(),value:j,onValueChange:M,open:L,onOpenChange:R,dir:k,triggerPointerDownPosRef:B,disabled:b,children:[r.jsx(cm.Provider,{scope:t,children:r.jsx(oq,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(U=>{$(J=>new Set(J).add(U))},[]),onNativeOptionRemove:C.useCallback(U=>{$(J=>{const X=new Set(J);return X.delete(U),X})},[]),children:n})}),H?r.jsxs(A3,{"aria-hidden":!0,required:v,tabIndex:-1,name:p,autoComplete:m,value:j,onChange:U=>M(U.target.value),disabled:b,form:w,children:[j===void 0?r.jsx("option",{value:""}):null,Array.from(P)]},ee):null]})})};r3.displayName=go;var a3="SelectTrigger",s3=C.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...s}=e,o=dm(n),u=Oi(a3,n),c=u.disabled||a,d=Et(t,u.onTriggerChange),h=um(n),p=C.useRef("touch"),[m,b,v]=k3(S=>{const g=h().filter(E=>!E.disabled),y=g.find(E=>E.value===u.value),_=R3(g,S,y);_!==void 0&&u.onValueChange(_.value)}),w=S=>{c||(u.onOpenChange(!0),v()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return r.jsx(fy,{asChild:!0,...o,children:r.jsx(lt.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":N3(u.value)?"":void 0,...s,ref:d,onClick:We(s.onClick,S=>{S.currentTarget.focus(),p.current!=="mouse"&&w(S)}),onPointerDown:We(s.onPointerDown,S=>{p.current=S.pointerType;const g=S.target;g.hasPointerCapture(S.pointerId)&&g.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:We(s.onKeyDown,S=>{const g=m.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(g&&S.key===" ")&&rq.includes(S.key)&&(w(),S.preventDefault())})})})});s3.displayName=a3;var i3="SelectValue",o3=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:u="",...c}=e,d=Oi(i3,n),{onValueNodeHasChildrenChange:h}=d,p=o!==void 0,m=Et(t,d.onValueNodeChange);return nr(()=>{h(p)},[h,p]),r.jsx(lt.span,{...c,ref:m,style:{pointerEvents:"none"},children:N3(d.value)?r.jsx(r.Fragment,{children:u}):o})});o3.displayName=i3;var cq="SelectIcon",l3=C.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...s}=e;return r.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:a||"▼"})});l3.displayName=cq;var uq="SelectPortal",c3=e=>r.jsx(_d,{asChild:!0,...e});c3.displayName=uq;var bo="SelectContent",u3=C.forwardRef((e,t)=>{const n=Oi(bo,e.__scopeSelect),[a,s]=C.useState();if(nr(()=>{s(new DocumentFragment)},[]),!n.open){const o=a;return o?nc.createPortal(r.jsx(d3,{scope:e.__scopeSelect,children:r.jsx(cm.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(h3,{...e,ref:t})});u3.displayName=bo;var Ta=10,[d3,Li]=fc(bo),dq="SelectContentImpl",hq=ho("SelectContent.RemoveScroll"),h3=C.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:u,side:c,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:b,collisionPadding:v,sticky:w,hideWhenDetached:S,avoidCollisions:g,...y}=e,_=Oi(bo,n),[E,T]=C.useState(null),[N,k]=C.useState(null),L=Et(t,K=>T(K)),[R,j]=C.useState(null),[M,B]=C.useState(null),H=um(n),[P,$]=C.useState(!1),ee=C.useRef(!1);C.useEffect(()=>{if(E)return Vv(E)},[E]),Wv();const U=C.useCallback(K=>{const[G,...Y]=H().map(de=>de.ref.current),[oe]=Y.slice(-1),ie=document.activeElement;for(const de of K)if(de===ie||(de?.scrollIntoView({block:"nearest"}),de===G&&N&&(N.scrollTop=0),de===oe&&N&&(N.scrollTop=N.scrollHeight),de?.focus(),document.activeElement!==ie))return},[H,N]),J=C.useCallback(()=>U([R,E]),[U,R,E]);C.useEffect(()=>{P&&J()},[P,J]);const{onOpenChange:X,triggerPointerDownPosRef:F}=_;C.useEffect(()=>{if(E){let K={x:0,y:0};const G=oe=>{K={x:Math.abs(Math.round(oe.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(oe.pageY)-(F.current?.y??0))}},Y=oe=>{K.x<=10&&K.y<=10?oe.preventDefault():E.contains(oe.target)||X(!1),document.removeEventListener("pointermove",G),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",Y,{capture:!0})}}},[E,X,F]),C.useEffect(()=>{const K=()=>X(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[X]);const[O,V]=k3(K=>{const G=H().filter(ie=>!ie.disabled),Y=G.find(ie=>ie.ref.current===document.activeElement),oe=R3(G,K,Y);oe&&setTimeout(()=>oe.ref.current.focus())}),te=C.useCallback((K,G,Y)=>{const oe=!ee.current&&!Y;(_.value!==void 0&&_.value===G||oe)&&(j(K),oe&&(ee.current=!0))},[_.value]),q=C.useCallback(()=>E?.focus(),[E]),W=C.useCallback((K,G,Y)=>{const oe=!ee.current&&!Y;(_.value!==void 0&&_.value===G||oe)&&B(K)},[_.value]),ae=a==="popper"?Px:f3,ne=ae===Px?{side:c,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:b,collisionPadding:v,sticky:w,hideWhenDetached:S,avoidCollisions:g}:{};return r.jsx(d3,{scope:n,content:E,viewport:N,onViewportChange:k,itemRefCallback:te,selectedItem:R,onItemLeave:q,itemTextRefCallback:W,focusSelectedItem:J,selectedItemText:M,position:a,isPositioned:P,searchRef:O,children:r.jsx(Jp,{as:hq,allowPinchZoom:!0,children:r.jsx(Zp,{asChild:!0,trapped:_.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:We(s,K=>{_.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:r.jsx(sc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:r.jsx(ae,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:K=>K.preventDefault(),...y,...ne,onPlaced:()=>$(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:We(y.onKeyDown,K=>{const G=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!G&&K.key.length===1&&V(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let oe=H().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(K.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ie=K.target,de=oe.indexOf(ie);oe=oe.slice(de+1)}setTimeout(()=>U(oe)),K.preventDefault()}})})})})})})});h3.displayName=dq;var fq="SelectItemAlignedPosition",f3=C.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...s}=e,o=Oi(bo,n),u=Li(bo,n),[c,d]=C.useState(null),[h,p]=C.useState(null),m=Et(t,L=>p(L)),b=um(n),v=C.useRef(!1),w=C.useRef(!0),{viewport:S,selectedItem:g,selectedItemText:y,focusSelectedItem:_}=u,E=C.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&h&&S&&g&&y){const L=o.trigger.getBoundingClientRect(),R=h.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(o.dir!=="rtl"){const ie=M.left-R.left,de=j.left-ie,Te=L.left-de,Ce=L.width+Te,Ve=Math.max(Ce,R.width),nt=window.innerWidth-Ta,Ie=Fx(de,[Ta,Math.max(Ta,nt-Ve)]);c.style.minWidth=Ce+"px",c.style.left=Ie+"px"}else{const ie=R.right-M.right,de=window.innerWidth-j.right-ie,Te=window.innerWidth-L.right-de,Ce=L.width+Te,Ve=Math.max(Ce,R.width),nt=window.innerWidth-Ta,Ie=Fx(de,[Ta,Math.max(Ta,nt-Ve)]);c.style.minWidth=Ce+"px",c.style.right=Ie+"px"}const B=b(),H=window.innerHeight-Ta*2,P=S.scrollHeight,$=window.getComputedStyle(h),ee=parseInt($.borderTopWidth,10),U=parseInt($.paddingTop,10),J=parseInt($.borderBottomWidth,10),X=parseInt($.paddingBottom,10),F=ee+U+P+X+J,O=Math.min(g.offsetHeight*5,F),V=window.getComputedStyle(S),te=parseInt(V.paddingTop,10),q=parseInt(V.paddingBottom,10),W=L.top+L.height/2-Ta,ae=H-W,ne=g.offsetHeight/2,K=g.offsetTop+ne,G=ee+U+K,Y=F-G;if(G<=W){const ie=B.length>0&&g===B[B.length-1].ref.current;c.style.bottom="0px";const de=h.clientHeight-S.offsetTop-S.offsetHeight,Te=Math.max(ae,ne+(ie?q:0)+de+J),Ce=G+Te;c.style.height=Ce+"px"}else{const ie=B.length>0&&g===B[0].ref.current;c.style.top="0px";const Te=Math.max(W,ee+S.offsetTop+(ie?te:0)+ne)+Y;c.style.height=Te+"px",S.scrollTop=G-W+S.offsetTop}c.style.margin=`${Ta}px 0`,c.style.minHeight=O+"px",c.style.maxHeight=H+"px",a?.(),requestAnimationFrame(()=>v.current=!0)}},[b,o.trigger,o.valueNode,c,h,S,g,y,o.dir,a]);nr(()=>E(),[E]);const[T,N]=C.useState();nr(()=>{h&&N(window.getComputedStyle(h).zIndex)},[h]);const k=C.useCallback(L=>{L&&w.current===!0&&(E(),_?.(),w.current=!1)},[E,_]);return r.jsx(mq,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:v,onScrollButtonChange:k,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:r.jsx(lt.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});f3.displayName=fq;var pq="SelectPopperPosition",Px=C.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=Ta,...o}=e,u=dm(n);return r.jsx(py,{...u,...o,ref:t,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Px.displayName=pq;var[mq,xy]=fc(bo,{}),Bx="SelectViewport",p3=C.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...s}=e,o=Li(Bx,n),u=xy(Bx,n),c=Et(t,o.onViewportChange),d=C.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),r.jsx(cm.Slot,{scope:n,children:r.jsx(lt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:We(s.onScroll,h=>{const p=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:b}=u;if(b?.current&&m){const v=Math.abs(d.current-p.scrollTop);if(v>0){const w=window.innerHeight-Ta*2,S=parseFloat(m.style.minHeight),g=parseFloat(m.style.height),y=Math.max(S,g);if(y<w){const _=y+v,E=Math.min(w,_),T=_-E;m.style.height=E+"px",m.style.bottom==="0px"&&(p.scrollTop=T>0?T:0,m.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});p3.displayName=Bx;var m3="SelectGroup",[gq,bq]=fc(m3),xq=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=ka();return r.jsx(gq,{scope:n,id:s,children:r.jsx(lt.div,{role:"group","aria-labelledby":s,...a,ref:t})})});xq.displayName=m3;var g3="SelectLabel",b3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=bq(g3,n);return r.jsx(lt.div,{id:s.id,...a,ref:t})});b3.displayName=g3;var bp="SelectItem",[vq,x3]=fc(bp),v3=C.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:s=!1,textValue:o,...u}=e,c=Oi(bp,n),d=Li(bp,n),h=c.value===a,[p,m]=C.useState(o??""),[b,v]=C.useState(!1),w=Et(t,_=>d.itemRefCallback?.(_,a,s)),S=ka(),g=C.useRef("touch"),y=()=>{s||(c.onValueChange(a),c.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(vq,{scope:n,value:a,disabled:s,textId:S,isSelected:h,onItemTextChange:C.useCallback(_=>{m(E=>E||(_?.textContent??"").trim())},[]),children:r.jsx(cm.ItemSlot,{scope:n,value:a,disabled:s,textValue:p,children:r.jsx(lt.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:w,onFocus:We(u.onFocus,()=>v(!0)),onBlur:We(u.onBlur,()=>v(!1)),onClick:We(u.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:We(u.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:We(u.onPointerDown,_=>{g.current=_.pointerType}),onPointerMove:We(u.onPointerMove,_=>{g.current=_.pointerType,s?d.onItemLeave?.():g.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:We(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:We(u.onKeyDown,_=>{d.searchRef?.current!==""&&_.key===" "||(aq.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});v3.displayName=bp;var Fu="SelectItemText",y3=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:s,...o}=e,u=Oi(Fu,n),c=Li(Fu,n),d=x3(Fu,n),h=lq(Fu,n),[p,m]=C.useState(null),b=Et(t,y=>m(y),d.onItemTextChange,y=>c.itemTextRefCallback?.(y,d.value,d.disabled)),v=p?.textContent,w=C.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:S,onNativeOptionRemove:g}=h;return nr(()=>(S(w),()=>g(w)),[S,g,w]),r.jsxs(r.Fragment,{children:[r.jsx(lt.span,{id:d.textId,...o,ref:b}),d.isSelected&&u.valueNode&&!u.valueNodeHasChildren?nc.createPortal(o.children,u.valueNode):null]})});y3.displayName=Fu;var E3="SelectItemIndicator",_3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return x3(E3,n).isSelected?r.jsx(lt.span,{"aria-hidden":!0,...a,ref:t}):null});_3.displayName=E3;var Ux="SelectScrollUpButton",S3=C.forwardRef((e,t)=>{const n=Li(Ux,e.__scopeSelect),a=xy(Ux,e.__scopeSelect),[s,o]=C.useState(!1),u=Et(t,a.onScrollButtonChange);return nr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=d.scrollTop>0;o(h)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(C3,{...e,ref:u,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});S3.displayName=Ux;var Hx="SelectScrollDownButton",w3=C.forwardRef((e,t)=>{const n=Li(Hx,e.__scopeSelect),a=xy(Hx,e.__scopeSelect),[s,o]=C.useState(!1),u=Et(t,a.onScrollButtonChange);return nr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<h;o(p)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(C3,{...e,ref:u,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});w3.displayName=Hx;var C3=C.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...s}=e,o=Li("SelectScrollButton",n),u=C.useRef(null),c=um(n),d=C.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return C.useEffect(()=>()=>d(),[d]),nr(()=>{c().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(lt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:We(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(a,50))}),onPointerMove:We(s.onPointerMove,()=>{o.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(a,50))}),onPointerLeave:We(s.onPointerLeave,()=>{d()})})}),yq="SelectSeparator",T3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return r.jsx(lt.div,{"aria-hidden":!0,...a,ref:t})});T3.displayName=yq;var $x="SelectArrow",Eq=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=dm(n),o=Oi($x,n),u=Li($x,n);return o.open&&u.position==="popper"?r.jsx(my,{...s,...a,ref:t}):null});Eq.displayName=$x;var _q="SelectBubbleInput",A3=C.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const s=C.useRef(null),o=Et(a,s),u=by(t);return C.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(u!==t&&p){const m=new Event("change",{bubbles:!0});p.call(c,t),c.dispatchEvent(m)}},[u,t]),r.jsx(lt.select,{...n,style:{...zD,...n.style},ref:o,defaultValue:t})});A3.displayName=_q;function N3(e){return e===""||e===void 0}function k3(e){const t=kn(e),n=C.useRef(""),a=C.useRef(0),s=C.useCallback(u=>{const c=n.current+u;t(c),(function d(h){n.current=h,window.clearTimeout(a.current),h!==""&&(a.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),o=C.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,s,o]}function R3(e,t,n){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let u=Sq(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==n));const d=u.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function Sq(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var wq=r3,D3=s3,Cq=o3,Tq=l3,Aq=c3,I3=u3,Nq=p3,O3=b3,L3=v3,kq=y3,Rq=_3,j3=S3,M3=w3,F3=T3;const en=wq,tn=Cq,Xt=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(D3,{ref:a,className:Ne("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(Tq,{asChild:!0,children:r.jsx(Na,{className:"h-4 w-4 opacity-50"})})]}));Xt.displayName=D3.displayName;const P3=C.forwardRef(({className:e,...t},n)=>r.jsx(j3,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Wp,{className:"h-4 w-4"})}));P3.displayName=j3.displayName;const B3=C.forwardRef(({className:e,...t},n)=>r.jsx(M3,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Na,{className:"h-4 w-4"})}));B3.displayName=M3.displayName;const Zt=C.forwardRef(({className:e,children:t,position:n="popper",...a},s)=>r.jsx(Aq,{children:r.jsxs(I3,{ref:s,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...a,children:[r.jsx(P3,{}),r.jsx(Nq,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(B3,{})]})}));Zt.displayName=I3.displayName;const Dq=C.forwardRef(({className:e,...t},n)=>r.jsx(O3,{ref:n,className:Ne("px-2 py-1.5 text-sm font-semibold",e),...t}));Dq.displayName=O3.displayName;const Me=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(L3,{ref:a,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Rq,{children:r.jsx(So,{className:"h-4 w-4"})})}),r.jsx(kq,{children:t})]}));Me.displayName=L3.displayName;const Iq=C.forwardRef(({className:e,...t},n)=>r.jsx(F3,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));Iq.displayName=F3.displayName;const $n=Zv,xp=mO,Oq=Qv,U3=C.forwardRef(({className:e,...t},n)=>r.jsx(wd,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));U3.displayName=wd.displayName;const Dn=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(Oq,{children:[r.jsx(U3,{}),r.jsxs(Cd,{ref:a,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg 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%] sm:rounded-lg",e),...n,children:[t,r.jsxs(tm,{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:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Dn.displayName=Cd.displayName;const Cn=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Cn.displayName="DialogHeader";const Tr=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Tr.displayName="DialogFooter";const Tn=C.forwardRef(({className:e,...t},n)=>r.jsx(Td,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",e),...t}));Tn.displayName=Td.displayName;const Hn=C.forwardRef(({className:e,...t},n)=>r.jsx(Ad,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Hn.displayName=Ad.displayName;var hm="Checkbox",[Lq,nde]=Rr(hm),[jq,vy]=Lq(hm);function Mq(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:s,disabled:o,form:u,name:c,onCheckedChange:d,required:h,value:p="on",internal_do_not_use_render:m}=e,[b,v]=Za({prop:n,defaultProp:s??!1,onChange:d,caller:hm}),[w,S]=C.useState(null),[g,y]=C.useState(null),_=C.useRef(!1),E=w?!!u||!!w.closest("form"):!0,T={checked:b,disabled:o,setChecked:v,control:w,setControl:S,name:c,form:u,value:p,hasConsumerStoppedPropagationRef:_,required:h,defaultChecked:wi(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:y};return r.jsx(jq,{scope:t,...T,children:Fq(m)?m(T):a})}var H3="CheckboxTrigger",$3=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},s)=>{const{control:o,value:u,disabled:c,checked:d,required:h,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:b,isFormControl:v,bubbleInput:w}=vy(H3,e),S=Et(s,p),g=C.useRef(d);return C.useEffect(()=>{const y=o?.form;if(y){const _=()=>m(g.current);return y.addEventListener("reset",_),()=>y.removeEventListener("reset",_)}},[o,m]),r.jsx(lt.button,{type:"button",role:"checkbox","aria-checked":wi(d)?"mixed":d,"aria-required":h,"data-state":V3(d),"data-disabled":c?"":void 0,disabled:c,value:u,...a,ref:S,onKeyDown:We(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:We(n,y=>{m(_=>wi(_)?!0:!_),w&&v&&(b.current=y.isPropagationStopped(),b.current||y.stopPropagation())})})});$3.displayName=H3;var yy=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:s,defaultChecked:o,required:u,disabled:c,value:d,onCheckedChange:h,form:p,...m}=e;return r.jsx(Mq,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:u,onCheckedChange:h,name:a,form:p,value:d,internal_do_not_use_render:({isFormControl:b})=>r.jsxs(r.Fragment,{children:[r.jsx($3,{...m,ref:t,__scopeCheckbox:n}),b&&r.jsx(W3,{__scopeCheckbox:n})]})})});yy.displayName=hm;var z3="CheckboxIndicator",G3=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...s}=e,o=vy(z3,n);return r.jsx(ur,{present:a||wi(o.checked)||o.checked===!0,children:r.jsx(lt.span,{"data-state":V3(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});G3.displayName=z3;var q3="CheckboxBubbleInput",W3=C.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:u,required:c,disabled:d,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=vy(q3,e),w=Et(n,v),S=by(o),g=cy(a);C.useEffect(()=>{const _=b;if(!_)return;const E=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(E,"checked").set,k=!s.current;if(S!==o&&N){const L=new Event("click",{bubbles:k});_.indeterminate=wi(o),N.call(_,wi(o)?!1:o),_.dispatchEvent(L)}},[b,S,o,s]);const y=C.useRef(wi(o)?!1:o);return r.jsx(lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??y.current,required:c,disabled:d,name:h,value:p,form:m,...t,tabIndex:-1,ref:w,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});W3.displayName=q3;function Fq(e){return typeof e=="function"}function wi(e){return e==="indeterminate"}function V3(e){return wi(e)?"indeterminate":e?"checked":"unchecked"}const ma=C.forwardRef(({className:e,...t},n)=>r.jsx(yy,{ref:n,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(G3,{className:Ne("flex items-center justify-center text-current"),children:r.jsx(So,{className:"h-4 w-4"})})}));ma.displayName=yy.displayName;const Ci=C.forwardRef(({className:e,onCheckedChange:t,onChange:n,...a},s)=>{const o=u=>{n?.(u),t?.(u.target.checked)};return r.jsxs("label",{className:Ne("relative inline-flex cursor-pointer",e),children:[r.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:o,ref:s,...a}),r.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),r.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});Ci.displayName="Switch";function Pq(e,t){return C.useReducer((n,a)=>t[n][a]??n,e)}var Ey="ScrollArea",[Y3,rde]=Rr(Ey),[Bq,ya]=Y3(Ey),K3=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:a="hover",dir:s,scrollHideDelay:o=600,...u}=e,[c,d]=C.useState(null),[h,p]=C.useState(null),[m,b]=C.useState(null),[v,w]=C.useState(null),[S,g]=C.useState(null),[y,_]=C.useState(0),[E,T]=C.useState(0),[N,k]=C.useState(!1),[L,R]=C.useState(!1),j=Et(t,B=>d(B)),M=hc(s);return r.jsx(Bq,{scope:n,type:a,dir:M,scrollHideDelay:o,scrollArea:c,viewport:h,onViewportChange:p,content:m,onContentChange:b,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:N,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:g,scrollbarYEnabled:L,onScrollbarYEnabledChange:R,onCornerWidthChange:_,onCornerHeightChange:T,children:r.jsx(lt.div,{dir:M,...u,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});K3.displayName=Ey;var X3="ScrollAreaViewport",Z3=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:a,nonce:s,...o}=e,u=ya(X3,n),c=C.useRef(null),d=Et(t,c,u.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(lt.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});Z3.displayName=X3;var ts="ScrollAreaScrollbar",_y=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:u}=s,c=e.orientation==="horizontal";return C.useEffect(()=>(c?o(!0):u(!0),()=>{c?o(!1):u(!1)}),[c,o,u]),s.type==="hover"?r.jsx(Uq,{...a,ref:t,forceMount:n}):s.type==="scroll"?r.jsx(Hq,{...a,ref:t,forceMount:n}):s.type==="auto"?r.jsx(Q3,{...a,ref:t,forceMount:n}):s.type==="always"?r.jsx(Sy,{...a,ref:t}):null});_y.displayName=ts;var Uq=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),[o,u]=C.useState(!1);return C.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),u(!0)},p=()=>{d=window.setTimeout(()=>u(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",p),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",p)}}},[s.scrollArea,s.scrollHideDelay]),r.jsx(ur,{present:n||o,children:r.jsx(Q3,{"data-state":o?"visible":"hidden",...a,ref:t})})}),Hq=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),o=e.orientation==="horizontal",u=pm(()=>d("SCROLL_END"),100),[c,d]=Pq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),C.useEffect(()=>{const h=s.viewport,p=o?"scrollLeft":"scrollTop";if(h){let m=h[p];const b=()=>{const v=h[p];m!==v&&(d("SCROLL"),u()),m=v};return h.addEventListener("scroll",b),()=>h.removeEventListener("scroll",b)}},[s.viewport,o,d,u]),r.jsx(ur,{present:n||c!=="hidden",children:r.jsx(Sy,{"data-state":c==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:We(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:We(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Q3=C.forwardRef((e,t)=>{const n=ya(ts,e.__scopeScrollArea),{forceMount:a,...s}=e,[o,u]=C.useState(!1),c=e.orientation==="horizontal",d=pm(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,p=n.viewport.offsetHeight<n.viewport.scrollHeight;u(c?h:p)}},10);return ql(n.viewport,d),ql(n.content,d),r.jsx(ur,{present:a||o,children:r.jsx(Sy,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Sy=C.forwardRef((e,t)=>{const{orientation:n="vertical",...a}=e,s=ya(ts,e.__scopeScrollArea),o=C.useRef(null),u=C.useRef(0),[c,d]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=rL(c.viewport,c.content),p={...a,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:b=>o.current=b,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:b=>u.current=b};function m(b,v){return Vq(b,u.current,c,v)}return n==="horizontal"?r.jsx($q,{...p,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const b=s.viewport.scrollLeft,v=q2(b,c,s.dir);o.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollLeft=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollLeft=m(b,s.dir))}}):n==="vertical"?r.jsx(zq,{...p,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const b=s.viewport.scrollTop,v=q2(b,c);o.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollTop=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollTop=m(b))}}):null}),$q=C.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...s}=e,o=ya(ts,e.__scopeScrollArea),[u,c]=C.useState(),d=C.useRef(null),h=Et(t,d,o.onScrollbarXChange);return C.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),r.jsx(eL,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":fm(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(o.viewport){const b=o.viewport.scrollLeft+p.deltaX;e.onWheelScroll(b),sL(b,m)&&p.preventDefault()}},onResize:()=>{d.current&&o.viewport&&u&&a({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yp(u.paddingLeft),paddingEnd:yp(u.paddingRight)}})}})}),zq=C.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...s}=e,o=ya(ts,e.__scopeScrollArea),[u,c]=C.useState(),d=C.useRef(null),h=Et(t,d,o.onScrollbarYChange);return C.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),r.jsx(eL,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":fm(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(o.viewport){const b=o.viewport.scrollTop+p.deltaY;e.onWheelScroll(b),sL(b,m)&&p.preventDefault()}},onResize:()=>{d.current&&o.viewport&&u&&a({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yp(u.paddingTop),paddingEnd:yp(u.paddingBottom)}})}})}),[Gq,J3]=Y3(ts),eL=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:a,hasThumb:s,onThumbChange:o,onThumbPointerUp:u,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:p,onResize:m,...b}=e,v=ya(ts,n),[w,S]=C.useState(null),g=Et(t,j=>S(j)),y=C.useRef(null),_=C.useRef(""),E=v.viewport,T=a.content-a.viewport,N=kn(p),k=kn(d),L=pm(m,10);function R(j){if(y.current){const M=j.clientX-y.current.left,B=j.clientY-y.current.top;h({x:M,y:B})}}return C.useEffect(()=>{const j=M=>{const B=M.target;w?.contains(B)&&N(M,T)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[E,w,T,N]),C.useEffect(k,[a,k]),ql(w,L),ql(v.content,L),r.jsx(Gq,{scope:n,scrollbar:w,hasThumb:s,onThumbChange:kn(o),onThumbPointerUp:kn(u),onThumbPositionChange:k,onThumbPointerDown:kn(c),children:r.jsx(lt.div,{...b,ref:g,style:{position:"absolute",...b.style},onPointerDown:We(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),y.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),R(j))}),onPointerMove:We(e.onPointerMove,R),onPointerUp:We(e.onPointerUp,j=>{const M=j.target;M.hasPointerCapture(j.pointerId)&&M.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=_.current,v.viewport&&(v.viewport.style.scrollBehavior=""),y.current=null})})})}),vp="ScrollAreaThumb",tL=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=J3(vp,e.__scopeScrollArea);return r.jsx(ur,{present:n||s.hasThumb,children:r.jsx(qq,{ref:t,...a})})}),qq=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:a,...s}=e,o=ya(vp,n),u=J3(vp,n),{onThumbPositionChange:c}=u,d=Et(t,m=>u.onThumbChange(m)),h=C.useRef(void 0),p=pm(()=>{h.current&&(h.current(),h.current=void 0)},100);return C.useEffect(()=>{const m=o.viewport;if(m){const b=()=>{if(p(),!h.current){const v=Yq(m,c);h.current=v,c()}};return c(),m.addEventListener("scroll",b),()=>m.removeEventListener("scroll",b)}},[o.viewport,p,c]),r.jsx(lt.div,{"data-state":u.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:We(e.onPointerDownCapture,m=>{const v=m.target.getBoundingClientRect(),w=m.clientX-v.left,S=m.clientY-v.top;u.onThumbPointerDown({x:w,y:S})}),onPointerUp:We(e.onPointerUp,u.onThumbPointerUp)})});tL.displayName=vp;var wy="ScrollAreaCorner",nL=C.forwardRef((e,t)=>{const n=ya(wy,e.__scopeScrollArea),a=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&a?r.jsx(Wq,{...e,ref:t}):null});nL.displayName=wy;var Wq=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,...a}=e,s=ya(wy,n),[o,u]=C.useState(0),[c,d]=C.useState(0),h=!!(o&&c);return ql(s.scrollbarX,()=>{const p=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(p),d(p)}),ql(s.scrollbarY,()=>{const p=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(p),u(p)}),h?r.jsx(lt.div,{...a,ref:t,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function yp(e){return e?parseInt(e,10):0}function rL(e,t){const n=e/t;return isNaN(n)?0:n}function fm(e){const t=rL(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-n)*t;return Math.max(a,18)}function Vq(e,t,n,a="ltr"){const s=fm(n),o=s/2,u=t||o,c=s-u,d=n.scrollbar.paddingStart+u,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,p=n.content-n.viewport,m=a==="ltr"?[0,p]:[p*-1,0];return aL([d,h],m)(e)}function q2(e,t,n="ltr"){const a=fm(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,u=t.content-t.viewport,c=o-a,d=n==="ltr"?[0,u]:[u*-1,0],h=Fx(e,d);return aL([0,u],[0,c])(h)}function aL(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function sL(e,t){return e>0&&e<t}var Yq=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},a=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},u=n.left!==o.left,c=n.top!==o.top;(u||c)&&t(),n=o,a=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(a)};function pm(e,t){const n=kn(e),a=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(a.current),[]),C.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(n,t)},[n,t])}function ql(e,t){const n=kn(t);nr(()=>{let a=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(a),s.unobserve(e)}}},[e,n])}var iL=K3,Kq=Z3,Xq=nL;const Oa=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(iL,{ref:a,className:Ne("relative overflow-hidden",e),...n,children:[r.jsx(Kq,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(oL,{}),r.jsx(Xq,{})]}));Oa.displayName=iL.displayName;const oL=C.forwardRef(({className:e,orientation:t="vertical",...n},a)=>r.jsx(_y,{ref:a,orientation:t,className:Ne("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(tL,{className:"relative flex-1 rounded-full bg-border"})}));oL.displayName=_y.displayName;function id(e){const t=[],n=String(e||"");let a=n.indexOf(","),s=0,o=!1;for(;!o;){a===-1&&(a=n.length,o=!0);const u=n.slice(s,a).trim();(u||!o)&&t.push(u),s=a+1,a=n.indexOf(",",s)}return t}function mm(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zq=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qq=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jq={};function W2(e,t){return(Jq.jsx?Qq:Zq).test(e)}const eW=/[ \t\n\f\r]/g;function kd(e){return typeof e=="object"?e.type==="text"?V2(e.value):!1:V2(e)}function V2(e){return e.replace(eW,"")===""}let Rd=class{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}};Rd.prototype.normal={};Rd.prototype.property={};Rd.prototype.space=void 0;function lL(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Rd(n,a,t)}function od(e){return e.toLowerCase()}let Hr=class{constructor(t,n){this.attribute=n,this.property=t}};Hr.prototype.attribute="";Hr.prototype.booleanish=!1;Hr.prototype.boolean=!1;Hr.prototype.commaOrSpaceSeparated=!1;Hr.prototype.commaSeparated=!1;Hr.prototype.defined=!1;Hr.prototype.mustUseProperty=!1;Hr.prototype.number=!1;Hr.prototype.overloadedBoolean=!1;Hr.prototype.property="";Hr.prototype.spaceSeparated=!1;Hr.prototype.space=void 0;let tW=0;const Nt=wo(),Bn=wo(),zx=wo(),Ge=wo(),fn=wo(),jl=wo(),Qr=wo();function wo(){return 2**++tW}const Gx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Nt,booleanish:Bn,commaOrSpaceSeparated:Qr,commaSeparated:jl,number:Ge,overloadedBoolean:zx,spaceSeparated:fn},Symbol.toStringTag,{value:"Module"})),R0=Object.keys(Gx);let Cy=class extends Hr{constructor(t,n,a,s){let o=-1;if(super(t,n),Y2(this,"space",s),typeof a=="number")for(;++o<R0.length;){const u=R0[o];Y2(this,R0[o],(a&Gx[u])===Gx[u])}}};Cy.prototype.defined=!0;function Y2(e,t,n){n&&(e[t]=n)}function pc(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new Cy(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[od(a)]=a,n[od(o.attribute)]=a}return new Rd(t,n,e.space)}const cL=pc({properties:{ariaActiveDescendant:null,ariaAtomic:Bn,ariaAutoComplete:null,ariaBusy:Bn,ariaChecked:Bn,ariaColCount:Ge,ariaColIndex:Ge,ariaColSpan:Ge,ariaControls:fn,ariaCurrent:null,ariaDescribedBy:fn,ariaDetails:null,ariaDisabled:Bn,ariaDropEffect:fn,ariaErrorMessage:null,ariaExpanded:Bn,ariaFlowTo:fn,ariaGrabbed:Bn,ariaHasPopup:null,ariaHidden:Bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fn,ariaLevel:Ge,ariaLive:null,ariaModal:Bn,ariaMultiLine:Bn,ariaMultiSelectable:Bn,ariaOrientation:null,ariaOwns:fn,ariaPlaceholder:null,ariaPosInSet:Ge,ariaPressed:Bn,ariaReadOnly:Bn,ariaRelevant:null,ariaRequired:Bn,ariaRoleDescription:fn,ariaRowCount:Ge,ariaRowIndex:Ge,ariaRowSpan:Ge,ariaSelected:Bn,ariaSetSize:Ge,ariaSort:null,ariaValueMax:Ge,ariaValueMin:Ge,ariaValueNow:Ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function uL(e,t){return t in e?e[t]:t}function dL(e,t){return uL(e,t.toLowerCase())}const nW=pc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jl,acceptCharset:fn,accessKey:fn,action:null,allow:null,allowFullScreen:Nt,allowPaymentRequest:Nt,allowUserMedia:Nt,alt:null,as:null,async:Nt,autoCapitalize:null,autoComplete:fn,autoFocus:Nt,autoPlay:Nt,blocking:fn,capture:null,charSet:null,checked:Nt,cite:null,className:fn,cols:Ge,colSpan:null,content:null,contentEditable:Bn,controls:Nt,controlsList:fn,coords:Ge|jl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Nt,defer:Nt,dir:null,dirName:null,disabled:Nt,download:zx,draggable:Bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Nt,formTarget:null,headers:fn,height:Ge,hidden:zx,high:Ge,href:null,hrefLang:null,htmlFor:fn,httpEquiv:fn,id:null,imageSizes:null,imageSrcSet:null,inert:Nt,inputMode:null,integrity:null,is:null,isMap:Nt,itemId:null,itemProp:fn,itemRef:fn,itemScope:Nt,itemType:fn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Nt,low:Ge,manifest:null,max:null,maxLength:Ge,media:null,method:null,min:null,minLength:Ge,multiple:Nt,muted:Nt,name:null,nonce:null,noModule:Nt,noValidate:Nt,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:Nt,optimum:Ge,pattern:null,ping:fn,placeholder:null,playsInline:Nt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Nt,referrerPolicy:null,rel:fn,required:Nt,reversed:Nt,rows:Ge,rowSpan:Ge,sandbox:fn,scope:null,scoped:Nt,seamless:Nt,selected:Nt,shadowRootClonable:Nt,shadowRootDelegatesFocus:Nt,shadowRootMode:null,shape:null,size:Ge,sizes:null,slot:null,span:Ge,spellCheck:Bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ge,step:null,style:null,tabIndex:Ge,target:null,title:null,translate:null,type:null,typeMustMatch:Nt,useMap:null,value:Bn,width:Ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fn,axis:null,background:null,bgColor:null,border:Ge,borderColor:null,bottomMargin:Ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Nt,declare:Nt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ge,leftMargin:Ge,link:null,longDesc:null,lowSrc:null,marginHeight:Ge,marginWidth:Ge,noResize:Nt,noHref:Nt,noShade:Nt,noWrap:Nt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ge,rules:null,scheme:null,scrolling:Bn,standby:null,summary:null,text:null,topMargin:Ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Nt,disableRemotePlayback:Nt,prefix:null,property:null,results:Ge,security:null,unselectable:null},space:"html",transform:dL}),rW=pc({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:Qr,accentHeight:Ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ge,amplitude:Ge,arabicForm:null,ascent:Ge,attributeName:null,attributeType:null,azimuth:Ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ge,by:null,calcMode:null,capHeight:Ge,className:fn,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:Ge,diffuseConstant:Ge,direction:null,display:null,dur:null,divisor:Ge,dominantBaseline:null,download:Nt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ge,enableBackground:null,end:null,event:null,exponent:Ge,externalResourcesRequired:null,fill:null,fillOpacity:Ge,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:jl,g2:jl,glyphName:jl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ge,horizOriginX:Ge,horizOriginY:Ge,id:null,ideographic:Ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ge,k:Ge,k1:Ge,k2:Ge,k3:Ge,k4:Ge,kernelMatrix:Qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ge,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:Ge,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:Ge,overlineThickness:Ge,paintOrder:null,panose1:null,path:null,pathLength:Ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ge,pointsAtY:Ge,pointsAtZ:Ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qr,rev:Qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qr,requiredFeatures:Qr,requiredFonts:Qr,requiredFormats:Qr,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:Ge,specularExponent:Ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ge,strikethroughThickness:Ge,string:null,stroke:null,strokeDashArray:Qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ge,strokeOpacity:Ge,strokeWidth:null,style:null,surfaceScale:Ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qr,tabIndex:Ge,tableValues:null,target:null,targetX:Ge,targetY:Ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ge,underlineThickness:Ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ge,values:null,vAlphabetic:Ge,vMathematical:Ge,vectorEffect:null,vHanging:Ge,vIdeographic:Ge,version:null,vertAdvY:Ge,vertOriginX:Ge,vertOriginY:Ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uL}),hL=pc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),fL=pc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dL}),pL=pc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),aW={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"},sW=/[A-Z]/g,K2=/-[a-z]/g,iW=/^data[-\w.:]+$/i;function Dd(e,t){const n=od(t);let a=t,s=Hr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iW.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(K2,lW);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!K2.test(o)){let u=o.replace(sW,oW);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=Cy}return new s(a,t)}function oW(e){return"-"+e.toLowerCase()}function lW(e){return e.charAt(1).toUpperCase()}const mc=lL([cL,nW,hL,fL,pL],"html"),Us=lL([cL,rW,hL,fL,pL],"svg");function ld(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function gm(e){return e.join(" ").trim()}var El={},D0,X2;function cW(){if(X2)return D0;X2=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
584
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},$$="DialogDescriptionWarning",z$=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pO($$).contentName}}.`;return C.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Zv=eO,mO=nO,Qv=aO,wd=sO,Cd=iO,Td=lO,Ad=uO,tm=hO;const gO=Zv,G$=Qv,bO=C.forwardRef(({className:e,...t},n)=>r.jsx(wd,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));bO.displayName=wd.displayName;const q$=ic("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Jv=C.forwardRef(({side:e="right",className:t,children:n,...a},s)=>r.jsxs(G$,{children:[r.jsx(bO,{}),r.jsxs(Cd,{ref:s,className:Ne(q$({side:e}),t),...a,children:[n,r.jsxs(tm,{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-secondary",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jv.displayName=Cd.displayName;const ey=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",e),...t});ey.displayName="SheetHeader";const ty=C.forwardRef(({className:e,...t},n)=>r.jsx(Td,{ref:n,className:Ne("text-lg font-semibold text-foreground",e),...t}));ty.displayName=Td.displayName;const xO=C.forwardRef(({className:e,...t},n)=>r.jsx(Ad,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));xO.displayName=Ad.displayName;function L2({className:e,...t}){return r.jsx("div",{className:Ne("animate-pulse rounded-md bg-muted",e),...t})}const W$=["top","right","bottom","left"],Ai=Math.min,ea=Math.max,fp=Math.round,Sf=Math.floor,Xa=e=>({x:e,y:e}),V$={left:"right",right:"left",bottom:"top",top:"bottom"},Y$={start:"end",end:"start"};function Dx(e,t,n){return ea(e,Ai(t,n))}function Ns(e,t){return typeof e=="function"?e(t):e}function ks(e){return e.split("-")[0]}function cc(e){return e.split("-")[1]}function ny(e){return e==="x"?"y":"x"}function ry(e){return e==="y"?"height":"width"}const K$=new Set(["top","bottom"]);function Va(e){return K$.has(ks(e))?"y":"x"}function ay(e){return ny(Va(e))}function X$(e,t,n){n===void 0&&(n=!1);const a=cc(e),s=ay(e),o=ry(s);let u=s==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(u=pp(u)),[u,pp(u)]}function Z$(e){const t=pp(e);return[Ix(e),t,Ix(t)]}function Ix(e){return e.replace(/start|end/g,t=>Y$[t])}const j2=["left","right"],M2=["right","left"],Q$=["top","bottom"],J$=["bottom","top"];function ez(e,t,n){switch(e){case"top":case"bottom":return n?t?M2:j2:t?j2:M2;case"left":case"right":return t?Q$:J$;default:return[]}}function tz(e,t,n,a){const s=cc(e);let o=ez(ks(e),n==="start",a);return s&&(o=o.map(u=>u+"-"+s),t&&(o=o.concat(o.map(Ix)))),o}function pp(e){return e.replace(/left|right|bottom|top/g,t=>V$[t])}function nz(e){return{top:0,right:0,bottom:0,left:0,...e}}function vO(e){return typeof e!="number"?nz(e):{top:e,right:e,bottom:e,left:e}}function mp(e){const{x:t,y:n,width:a,height:s}=e;return{width:a,height:s,top:n,left:t,right:t+a,bottom:n+s,x:t,y:n}}function F2(e,t,n){let{reference:a,floating:s}=e;const o=Va(t),u=ay(t),c=ry(u),d=ks(t),h=o==="y",p=a.x+a.width/2-s.width/2,m=a.y+a.height/2-s.height/2,b=a[c]/2-s[c]/2;let v;switch(d){case"top":v={x:p,y:a.y-s.height};break;case"bottom":v={x:p,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:m};break;case"left":v={x:a.x-s.width,y:m};break;default:v={x:a.x,y:a.y}}switch(cc(t)){case"start":v[u]-=b*(n&&h?-1:1);break;case"end":v[u]+=b*(n&&h?-1:1);break}return v}const rz=async(e,t,n)=>{const{placement:a="bottom",strategy:s="absolute",middleware:o=[],platform:u}=n,c=o.filter(Boolean),d=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=F2(h,a,d),b=a,v={},w=0;for(let S=0;S<c.length;S++){const{name:g,fn:y}=c[S],{x:_,y:E,data:T,reset:N}=await y({x:p,y:m,initialPlacement:a,placement:b,strategy:s,middlewareData:v,rects:h,platform:u,elements:{reference:e,floating:t}});p=_??p,m=E??m,v={...v,[g]:{...v[g],...T}},N&&w<=50&&(w++,typeof N=="object"&&(N.placement&&(b=N.placement),N.rects&&(h=N.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):N.rects),{x:p,y:m}=F2(h,b,d)),S=-1)}return{x:p,y:m,placement:b,strategy:s,middlewareData:v}};async function rd(e,t){var n;t===void 0&&(t={});const{x:a,y:s,platform:o,rects:u,elements:c,strategy:d}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:b=!1,padding:v=0}=Ns(t,e),w=vO(v),g=c[b?m==="floating"?"reference":"floating":m],y=mp(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:h,rootBoundary:p,strategy:d})),_=m==="floating"?{x:a,y:s,width:u.floating.width,height:u.floating.height}:u.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),T=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},N=mp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:E,strategy:d}):_);return{top:(y.top-N.top+w.top)/T.y,bottom:(N.bottom-y.bottom+w.bottom)/T.y,left:(y.left-N.left+w.left)/T.x,right:(N.right-y.right+w.right)/T.x}}const az=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:s,rects:o,platform:u,elements:c,middlewareData:d}=t,{element:h,padding:p=0}=Ns(e,t)||{};if(h==null)return{};const m=vO(p),b={x:n,y:a},v=ay(s),w=ry(v),S=await u.getDimensions(h),g=v==="y",y=g?"top":"left",_=g?"bottom":"right",E=g?"clientHeight":"clientWidth",T=o.reference[w]+o.reference[v]-b[v]-o.floating[w],N=b[v]-o.reference[v],k=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let L=k?k[E]:0;(!L||!await(u.isElement==null?void 0:u.isElement(k)))&&(L=c.floating[E]||o.floating[w]);const R=T/2-N/2,j=L/2-S[w]/2-1,M=Ai(m[y],j),B=Ai(m[_],j),H=M,P=L-S[w]-B,$=L/2-S[w]/2+R,ee=Dx(H,$,P),U=!d.arrow&&cc(s)!=null&&$!==ee&&o.reference[w]/2-($<H?M:B)-S[w]/2<0,J=U?$<H?$-H:$-P:0;return{[v]:b[v]+J,data:{[v]:ee,centerOffset:$-ee-J,...U&&{alignmentOffset:J}},reset:U}}}),sz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:s,middlewareData:o,rects:u,initialPlacement:c,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...g}=Ns(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=ks(s),_=Va(c),E=ks(c)===c,T=await(d.isRTL==null?void 0:d.isRTL(h.floating)),N=b||(E||!S?[pp(c)]:Z$(c)),k=w!=="none";!b&&k&&N.push(...tz(c,S,w,T));const L=[c,...N],R=await rd(t,g),j=[];let M=((a=o.flip)==null?void 0:a.overflows)||[];if(p&&j.push(R[y]),m){const $=X$(s,u,T);j.push(R[$[0]],R[$[1]])}if(M=[...M,{placement:s,overflows:j}],!j.every($=>$<=0)){var B,H;const $=(((B=o.flip)==null?void 0:B.index)||0)+1,ee=L[$];if(ee&&(!(m==="alignment"?_!==Va(ee):!1)||M.every(X=>Va(X.placement)===_?X.overflows[0]>0:!0)))return{data:{index:$,overflows:M},reset:{placement:ee}};let U=(H=M.filter(J=>J.overflows[0]<=0).sort((J,X)=>J.overflows[1]-X.overflows[1])[0])==null?void 0:H.placement;if(!U)switch(v){case"bestFit":{var P;const J=(P=M.filter(X=>{if(k){const F=Va(X.placement);return F===_||F==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(F=>F>0).reduce((F,O)=>F+O,0)]).sort((X,F)=>X[1]-F[1])[0])==null?void 0:P[0];J&&(U=J);break}case"initialPlacement":U=c;break}if(s!==U)return{reset:{placement:U}}}return{}}}};function P2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function B2(e){return W$.some(t=>e[t]>=0)}const iz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...s}=Ns(e,t);switch(a){case"referenceHidden":{const o=await rd(t,{...s,elementContext:"reference"}),u=P2(o,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:B2(u)}}}case"escaped":{const o=await rd(t,{...s,altBoundary:!0}),u=P2(o,n.floating);return{data:{escapedOffsets:u,escaped:B2(u)}}}default:return{}}}}},yO=new Set(["left","top"]);async function oz(e,t){const{placement:n,platform:a,elements:s}=e,o=await(a.isRTL==null?void 0:a.isRTL(s.floating)),u=ks(n),c=cc(n),d=Va(n)==="y",h=yO.has(u)?-1:1,p=o&&d?-1:1,m=Ns(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof w=="number"&&(v=c==="end"?w*-1:w),d?{x:v*p,y:b*h}:{x:b*h,y:v*p}}const lz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:s,y:o,placement:u,middlewareData:c}=t,d=await oz(t,e);return u===((n=c.offset)==null?void 0:n.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:s+d.x,y:o+d.y,data:{...d,placement:u}}}}},cz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:s}=t,{mainAxis:o=!0,crossAxis:u=!1,limiter:c={fn:g=>{let{x:y,y:_}=g;return{x:y,y:_}}},...d}=Ns(e,t),h={x:n,y:a},p=await rd(t,d),m=Va(ks(s)),b=ny(m);let v=h[b],w=h[m];if(o){const g=b==="y"?"top":"left",y=b==="y"?"bottom":"right",_=v+p[g],E=v-p[y];v=Dx(_,v,E)}if(u){const g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",_=w+p[g],E=w-p[y];w=Dx(_,w,E)}const S=c.fn({...t,[b]:v,[m]:w});return{...S,data:{x:S.x-n,y:S.y-a,enabled:{[b]:o,[m]:u}}}}}},uz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:s,rects:o,middlewareData:u}=t,{offset:c=0,mainAxis:d=!0,crossAxis:h=!0}=Ns(e,t),p={x:n,y:a},m=Va(s),b=ny(m);let v=p[b],w=p[m];const S=Ns(c,t),g=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(d){const E=b==="y"?"height":"width",T=o.reference[b]-o.floating[E]+g.mainAxis,N=o.reference[b]+o.reference[E]-g.mainAxis;v<T?v=T:v>N&&(v=N)}if(h){var y,_;const E=b==="y"?"width":"height",T=yO.has(ks(s)),N=o.reference[m]-o.floating[E]+(T&&((y=u.offset)==null?void 0:y[m])||0)+(T?0:g.crossAxis),k=o.reference[m]+o.reference[E]+(T?0:((_=u.offset)==null?void 0:_[m])||0)-(T?g.crossAxis:0);w<N?w=N:w>k&&(w=k)}return{[b]:v,[m]:w}}}},dz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:s,rects:o,platform:u,elements:c}=t,{apply:d=()=>{},...h}=Ns(e,t),p=await rd(t,h),m=ks(s),b=cc(s),v=Va(s)==="y",{width:w,height:S}=o.floating;let g,y;m==="top"||m==="bottom"?(g=m,y=b===(await(u.isRTL==null?void 0:u.isRTL(c.floating))?"start":"end")?"left":"right"):(y=m,g=b==="end"?"top":"bottom");const _=S-p.top-p.bottom,E=w-p.left-p.right,T=Ai(S-p[g],_),N=Ai(w-p[y],E),k=!t.middlewareData.shift;let L=T,R=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=E),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(L=_),k&&!b){const M=ea(p.left,0),B=ea(p.right,0),H=ea(p.top,0),P=ea(p.bottom,0);v?R=w-2*(M!==0||B!==0?M+B:ea(p.left,p.right)):L=S-2*(H!==0||P!==0?H+P:ea(p.top,p.bottom))}await d({...t,availableWidth:R,availableHeight:L});const j=await u.getDimensions(c.floating);return w!==j.width||S!==j.height?{reset:{rects:!0}}:{}}}};function nm(){return typeof window<"u"}function uc(e){return EO(e)?(e.nodeName||"").toLowerCase():"#document"}function na(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function es(e){var t;return(t=(EO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EO(e){return nm()?e instanceof Node||e instanceof na(e).Node:!1}function Da(e){return nm()?e instanceof Element||e instanceof na(e).Element:!1}function Qa(e){return nm()?e instanceof HTMLElement||e instanceof na(e).HTMLElement:!1}function U2(e){return!nm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof na(e).ShadowRoot}const hz=new Set(["inline","contents"]);function Nd(e){const{overflow:t,overflowX:n,overflowY:a,display:s}=Ia(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!hz.has(s)}const fz=new Set(["table","td","th"]);function pz(e){return fz.has(uc(e))}const mz=[":popover-open",":modal"];function rm(e){return mz.some(t=>{try{return e.matches(t)}catch{return!1}})}const gz=["transform","translate","scale","rotate","perspective"],bz=["transform","translate","scale","rotate","perspective","filter"],xz=["paint","layout","strict","content"];function sy(e){const t=iy(),n=Da(e)?Ia(e):e;return gz.some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bz.some(a=>(n.willChange||"").includes(a))||xz.some(a=>(n.contain||"").includes(a))}function vz(e){let t=Ni(e);for(;Qa(t)&&!zl(t);){if(sy(t))return t;if(rm(t))return null;t=Ni(t)}return null}function iy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yz=new Set(["html","body","#document"]);function zl(e){return yz.has(uc(e))}function Ia(e){return na(e).getComputedStyle(e)}function am(e){return Da(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ni(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U2(e)&&e.host||es(e);return U2(t)?t.host:t}function _O(e){const t=Ni(e);return zl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qa(t)&&Nd(t)?t:_O(t)}function ad(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=_O(e),o=s===((a=e.ownerDocument)==null?void 0:a.body),u=na(s);if(o){const c=Ox(u);return t.concat(u,u.visualViewport||[],Nd(s)?s:[],c&&n?ad(c):[])}return t.concat(s,ad(s,[],n))}function Ox(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function SO(e){const t=Ia(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const s=Qa(e),o=s?e.offsetWidth:n,u=s?e.offsetHeight:a,c=fp(n)!==o||fp(a)!==u;return c&&(n=o,a=u),{width:n,height:a,$:c}}function oy(e){return Da(e)?e:e.contextElement}function Ll(e){const t=oy(e);if(!Qa(t))return Xa(1);const n=t.getBoundingClientRect(),{width:a,height:s,$:o}=SO(t);let u=(o?fp(n.width):n.width)/a,c=(o?fp(n.height):n.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!c||!Number.isFinite(c))&&(c=1),{x:u,y:c}}const Ez=Xa(0);function wO(e){const t=na(e);return!iy()||!t.visualViewport?Ez:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _z(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==na(e)?!1:t}function mo(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=oy(e);let u=Xa(1);t&&(a?Da(a)&&(u=Ll(a)):u=Ll(e));const c=_z(o,n,a)?wO(o):Xa(0);let d=(s.left+c.x)/u.x,h=(s.top+c.y)/u.y,p=s.width/u.x,m=s.height/u.y;if(o){const b=na(o),v=a&&Da(a)?na(a):a;let w=b,S=Ox(w);for(;S&&a&&v!==w;){const g=Ll(S),y=S.getBoundingClientRect(),_=Ia(S),E=y.left+(S.clientLeft+parseFloat(_.paddingLeft))*g.x,T=y.top+(S.clientTop+parseFloat(_.paddingTop))*g.y;d*=g.x,h*=g.y,p*=g.x,m*=g.y,d+=E,h+=T,w=na(S),S=Ox(w)}}return mp({width:p,height:m,x:d,y:h})}function ly(e,t){const n=am(e).scrollLeft;return t?t.left+n:mo(es(e)).left+n}function CO(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=a.left+t.scrollLeft-(n?0:ly(e,a)),o=a.top+t.scrollTop;return{x:s,y:o}}function Sz(e){let{elements:t,rect:n,offsetParent:a,strategy:s}=e;const o=s==="fixed",u=es(a),c=t?rm(t.floating):!1;if(a===u||c&&o)return n;let d={scrollLeft:0,scrollTop:0},h=Xa(1);const p=Xa(0),m=Qa(a);if((m||!m&&!o)&&((uc(a)!=="body"||Nd(u))&&(d=am(a)),Qa(a))){const v=mo(a);h=Ll(a),p.x=v.x+a.clientLeft,p.y=v.y+a.clientTop}const b=u&&!m&&!o?CO(u,d,!0):Xa(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+b.x,y:n.y*h.y-d.scrollTop*h.y+p.y+b.y}}function wz(e){return Array.from(e.getClientRects())}function Cz(e){const t=es(e),n=am(e),a=e.ownerDocument.body,s=ea(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=ea(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+ly(e);const c=-n.scrollTop;return Ia(a).direction==="rtl"&&(u+=ea(t.clientWidth,a.clientWidth)-s),{width:s,height:o,x:u,y:c}}function Tz(e,t){const n=na(e),a=es(e),s=n.visualViewport;let o=a.clientWidth,u=a.clientHeight,c=0,d=0;if(s){o=s.width,u=s.height;const h=iy();(!h||h&&t==="fixed")&&(c=s.offsetLeft,d=s.offsetTop)}return{width:o,height:u,x:c,y:d}}const Az=new Set(["absolute","fixed"]);function Nz(e,t){const n=mo(e,!0,t==="fixed"),a=n.top+e.clientTop,s=n.left+e.clientLeft,o=Qa(e)?Ll(e):Xa(1),u=e.clientWidth*o.x,c=e.clientHeight*o.y,d=s*o.x,h=a*o.y;return{width:u,height:c,x:d,y:h}}function H2(e,t,n){let a;if(t==="viewport")a=Tz(e,n);else if(t==="document")a=Cz(es(e));else if(Da(t))a=Nz(t,n);else{const s=wO(e);a={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return mp(a)}function TO(e,t){const n=Ni(e);return n===t||!Da(n)||zl(n)?!1:Ia(n).position==="fixed"||TO(n,t)}function kz(e,t){const n=t.get(e);if(n)return n;let a=ad(e,[],!1).filter(c=>Da(c)&&uc(c)!=="body"),s=null;const o=Ia(e).position==="fixed";let u=o?Ni(e):e;for(;Da(u)&&!zl(u);){const c=Ia(u),d=sy(u);!d&&c.position==="fixed"&&(s=null),(o?!d&&!s:!d&&c.position==="static"&&!!s&&Az.has(s.position)||Nd(u)&&!d&&TO(e,u))?a=a.filter(p=>p!==u):s=c,u=Ni(u)}return t.set(e,a),a}function Rz(e){let{element:t,boundary:n,rootBoundary:a,strategy:s}=e;const u=[...n==="clippingAncestors"?rm(t)?[]:kz(t,this._c):[].concat(n),a],c=u[0],d=u.reduce((h,p)=>{const m=H2(t,p,s);return h.top=ea(m.top,h.top),h.right=Ai(m.right,h.right),h.bottom=Ai(m.bottom,h.bottom),h.left=ea(m.left,h.left),h},H2(t,c,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Dz(e){const{width:t,height:n}=SO(e);return{width:t,height:n}}function Iz(e,t,n){const a=Qa(t),s=es(t),o=n==="fixed",u=mo(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const d=Xa(0);function h(){d.x=ly(s)}if(a||!a&&!o)if((uc(t)!=="body"||Nd(s))&&(c=am(t)),a){const v=mo(t,!0,o,t);d.x=v.x+t.clientLeft,d.y=v.y+t.clientTop}else s&&h();o&&!a&&s&&h();const p=s&&!a&&!o?CO(s,c):Xa(0),m=u.left+c.scrollLeft-d.x-p.x,b=u.top+c.scrollTop-d.y-p.y;return{x:m,y:b,width:u.width,height:u.height}}function N0(e){return Ia(e).position==="static"}function $2(e,t){if(!Qa(e)||Ia(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return es(e)===n&&(n=n.ownerDocument.body),n}function AO(e,t){const n=na(e);if(rm(e))return n;if(!Qa(e)){let s=Ni(e);for(;s&&!zl(s);){if(Da(s)&&!N0(s))return s;s=Ni(s)}return n}let a=$2(e,t);for(;a&&pz(a)&&N0(a);)a=$2(a,t);return a&&zl(a)&&N0(a)&&!sy(a)?n:a||vz(e)||n}const Oz=async function(e){const t=this.getOffsetParent||AO,n=this.getDimensions,a=await n(e.floating);return{reference:Iz(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Lz(e){return Ia(e).direction==="rtl"}const jz={convertOffsetParentRelativeRectToViewportRelativeRect:Sz,getDocumentElement:es,getClippingRect:Rz,getOffsetParent:AO,getElementRects:Oz,getClientRects:wz,getDimensions:Dz,getScale:Ll,isElement:Da,isRTL:Lz};function NO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Mz(e,t){let n=null,a;const s=es(e);function o(){var c;clearTimeout(a),(c=n)==null||c.disconnect(),n=null}function u(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),o();const h=e.getBoundingClientRect(),{left:p,top:m,width:b,height:v}=h;if(c||t(),!b||!v)return;const w=Sf(m),S=Sf(s.clientWidth-(p+b)),g=Sf(s.clientHeight-(m+v)),y=Sf(p),E={rootMargin:-w+"px "+-S+"px "+-g+"px "+-y+"px",threshold:ea(0,Ai(1,d))||1};let T=!0;function N(k){const L=k[0].intersectionRatio;if(L!==d){if(!T)return u();L?u(!1,L):a=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!NO(h,e.getBoundingClientRect())&&u(),T=!1}try{n=new IntersectionObserver(N,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return u(!0),o}function Fz(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=a,h=oy(e),p=s||o?[...h?ad(h):[],...ad(t)]:[];p.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const m=h&&c?Mz(h,n):null;let b=-1,v=null;u&&(v=new ResizeObserver(y=>{let[_]=y;_&&_.target===h&&v&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var E;(E=v)==null||E.observe(t)})),n()}),h&&!d&&v.observe(h),v.observe(t));let w,S=d?mo(e):null;d&&g();function g(){const y=mo(e);S&&!NO(S,y)&&n(),S=y,w=requestAnimationFrame(g)}return n(),()=>{var y;p.forEach(_=>{s&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),m?.(),(y=v)==null||y.disconnect(),v=null,d&&cancelAnimationFrame(w)}}const Pz=lz,Bz=cz,Uz=sz,Hz=dz,$z=iz,z2=az,zz=uz,Gz=(e,t,n)=>{const a=new Map,s={platform:jz,...n},o={...s.platform,_c:a};return rz(e,t,{...s,platform:o})};var qz=typeof document<"u",Wz=function(){},Vf=qz?C.useLayoutEffect:Wz;function gp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,a,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!gp(e[a],t[a]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,s[a]))return!1;for(a=n;a--!==0;){const o=s[a];if(!(o==="_owner"&&e.$$typeof)&&!gp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function kO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G2(e,t){const n=kO(e);return Math.round(t*n)/n}function k0(e){const t=C.useRef(e);return Vf(()=>{t.current=e}),t}function Vz(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:s,elements:{reference:o,floating:u}={},transform:c=!0,whileElementsMounted:d,open:h}=e,[p,m]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=C.useState(a);gp(b,a)||v(a);const[w,S]=C.useState(null),[g,y]=C.useState(null),_=C.useCallback(X=>{X!==k.current&&(k.current=X,S(X))},[]),E=C.useCallback(X=>{X!==L.current&&(L.current=X,y(X))},[]),T=o||w,N=u||g,k=C.useRef(null),L=C.useRef(null),R=C.useRef(p),j=d!=null,M=k0(d),B=k0(s),H=k0(h),P=C.useCallback(()=>{if(!k.current||!L.current)return;const X={placement:t,strategy:n,middleware:b};B.current&&(X.platform=B.current),Gz(k.current,L.current,X).then(F=>{const O={...F,isPositioned:H.current!==!1};$.current&&!gp(R.current,O)&&(R.current=O,nc.flushSync(()=>{m(O)}))})},[b,t,n,B,H]);Vf(()=>{h===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,m(X=>({...X,isPositioned:!1})))},[h]);const $=C.useRef(!1);Vf(()=>($.current=!0,()=>{$.current=!1}),[]),Vf(()=>{if(T&&(k.current=T),N&&(L.current=N),T&&N){if(M.current)return M.current(T,N,P);P()}},[T,N,P,M,j]);const ee=C.useMemo(()=>({reference:k,floating:L,setReference:_,setFloating:E}),[_,E]),U=C.useMemo(()=>({reference:T,floating:N}),[T,N]),J=C.useMemo(()=>{const X={position:n,left:0,top:0};if(!U.floating)return X;const F=G2(U.floating,p.x),O=G2(U.floating,p.y);return c?{...X,transform:"translate("+F+"px, "+O+"px)",...kO(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:O}},[n,c,U.floating,p.x,p.y]);return C.useMemo(()=>({...p,update:P,refs:ee,elements:U,floatingStyles:J}),[p,P,ee,U,J])}const Yz=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:s}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?z2({element:a.current,padding:s}).fn(n):{}:a?z2({element:a,padding:s}).fn(n):{}}}},Kz=(e,t)=>({...Pz(e),options:[e,t]}),Xz=(e,t)=>({...Bz(e),options:[e,t]}),Zz=(e,t)=>({...zz(e),options:[e,t]}),Qz=(e,t)=>({...Uz(e),options:[e,t]}),Jz=(e,t)=>({...Hz(e),options:[e,t]}),eG=(e,t)=>({...$z(e),options:[e,t]}),tG=(e,t)=>({...Yz(e),options:[e,t]});var nG="Arrow",RO=C.forwardRef((e,t)=>{const{children:n,width:a=10,height:s=5,...o}=e;return r.jsx(lt.svg,{...o,ref:t,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});RO.displayName=nG;var rG=RO;function cy(e){const[t,n]=C.useState(void 0);return nr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,c;if("borderBoxSize"in o){const d=o.borderBoxSize,h=Array.isArray(d)?d[0]:d;u=h.inlineSize,c=h.blockSize}else u=e.offsetWidth,c=e.offsetHeight;n({width:u,height:c})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var uy="Popper",[DO,dc]=Rr(uy),[aG,IO]=DO(uy),OO=e=>{const{__scopePopper:t,children:n}=e,[a,s]=C.useState(null);return r.jsx(aG,{scope:t,anchor:a,onAnchorChange:s,children:n})};OO.displayName=uy;var LO="PopperAnchor",jO=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...s}=e,o=IO(LO,n),u=C.useRef(null),c=Et(t,u),d=C.useRef(null);return C.useEffect(()=>{const h=d.current;d.current=a?.current||u.current,h!==d.current&&o.onAnchorChange(d.current)}),a?null:r.jsx(lt.div,{...s,ref:c})});jO.displayName=LO;var dy="PopperContent",[sG,iG]=DO(dy),MO=C.forwardRef((e,t)=>{const{__scopePopper:n,side:a="bottom",sideOffset:s=0,align:o="center",alignOffset:u=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:w,...S}=e,g=IO(dy,n),[y,_]=C.useState(null),E=Et(t,K=>_(K)),[T,N]=C.useState(null),k=cy(T),L=k?.width??0,R=k?.height??0,j=a+(o!=="center"?"-"+o:""),M=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},B=Array.isArray(h)?h:[h],H=B.length>0,P={padding:M,boundary:B.filter(lG),altBoundary:H},{refs:$,floatingStyles:ee,placement:U,isPositioned:J,middlewareData:X}=Vz({strategy:"fixed",placement:j,whileElementsMounted:(...K)=>Fz(...K,{animationFrame:v==="always"}),elements:{reference:g.anchor},middleware:[Kz({mainAxis:s+R,alignmentAxis:u}),d&&Xz({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Zz():void 0,...P}),d&&Qz({...P}),Jz({...P,apply:({elements:K,rects:G,availableWidth:Y,availableHeight:oe})=>{const{width:ie,height:de}=G.reference,Te=K.floating.style;Te.setProperty("--radix-popper-available-width",`${Y}px`),Te.setProperty("--radix-popper-available-height",`${oe}px`),Te.setProperty("--radix-popper-anchor-width",`${ie}px`),Te.setProperty("--radix-popper-anchor-height",`${de}px`)}}),T&&tG({element:T,padding:c}),cG({arrowWidth:L,arrowHeight:R}),b&&eG({strategy:"referenceHidden",...P})]}),[F,O]=BO(U),V=kn(w);nr(()=>{J&&V?.()},[J,V]);const te=X.arrow?.x,q=X.arrow?.y,W=X.arrow?.centerOffset!==0,[ae,ne]=C.useState();return nr(()=>{y&&ne(window.getComputedStyle(y).zIndex)},[y]),r.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:J?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(sG,{scope:n,placedSide:F,onArrowChange:N,arrowX:te,arrowY:q,shouldHideArrow:W,children:r.jsx(lt.div,{"data-side":F,"data-align":O,...S,ref:E,style:{...S.style,animation:J?void 0:"none"}})})})});MO.displayName=dy;var FO="PopperArrow",oG={top:"bottom",right:"left",bottom:"top",left:"right"},PO=C.forwardRef(function(t,n){const{__scopePopper:a,...s}=t,o=iG(FO,a),u=oG[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(rG,{...s,ref:n,style:{...s.style,display:"block"}})})});PO.displayName=FO;function lG(e){return e!==null}var cG=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:a,middlewareData:s}=t,u=s.arrow?.centerOffset!==0,c=u?0:e.arrowWidth,d=u?0:e.arrowHeight,[h,p]=BO(n),m={start:"0%",center:"50%",end:"100%"}[p],b=(s.arrow?.x??0)+c/2,v=(s.arrow?.y??0)+d/2;let w="",S="";return h==="bottom"?(w=u?m:`${b}px`,S=`${-d}px`):h==="top"?(w=u?m:`${b}px`,S=`${a.floating.height+d}px`):h==="right"?(w=`${-d}px`,S=u?m:`${v}px`):h==="left"&&(w=`${a.floating.width+d}px`,S=u?m:`${v}px`),{data:{x:w,y:S}}}});function BO(e){const[t,n="center"]=e.split("-");return[t,n]}var hy=OO,fy=jO,py=MO,my=PO,[sm,Jue]=Rr("Tooltip",[dc]),im=dc(),UO="TooltipProvider",uG=700,Lx="tooltip.open",[dG,gy]=sm(UO),HO=e=>{const{__scopeTooltip:t,delayDuration:n=uG,skipDelayDuration:a=300,disableHoverableContent:s=!1,children:o}=e,u=C.useRef(!0),c=C.useRef(!1),d=C.useRef(0);return C.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),r.jsx(dG,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(d.current),u.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:C.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:o})};HO.displayName=UO;var sd="Tooltip",[hG,om]=sm(sd),$O=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:s,onOpenChange:o,disableHoverableContent:u,delayDuration:c}=e,d=gy(sd,e.__scopeTooltip),h=im(t),[p,m]=C.useState(null),b=ka(),v=C.useRef(0),w=u??d.disableHoverableContent,S=c??d.delayDuration,g=C.useRef(!1),[y,_]=Za({prop:a,defaultProp:s??!1,onChange:L=>{L?(d.onOpen(),document.dispatchEvent(new CustomEvent(Lx))):d.onClose(),o?.(L)},caller:sd}),E=C.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),T=C.useCallback(()=>{window.clearTimeout(v.current),v.current=0,g.current=!1,_(!0)},[_]),N=C.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_(!1)},[_]),k=C.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{g.current=!0,_(!0),v.current=0},S)},[S,_]);return C.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),r.jsx(hy,{...h,children:r.jsx(hG,{scope:t,contentId:b,open:y,stateAttribute:E,trigger:p,onTriggerChange:m,onTriggerEnter:C.useCallback(()=>{d.isOpenDelayedRef.current?k():T()},[d.isOpenDelayedRef,k,T]),onTriggerLeave:C.useCallback(()=>{w?N():(window.clearTimeout(v.current),v.current=0)},[N,w]),onOpen:T,onClose:N,disableHoverableContent:w,children:n})})};$O.displayName=sd;var jx="TooltipTrigger",zO=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,s=om(jx,n),o=gy(jx,n),u=im(n),c=C.useRef(null),d=Et(t,c,s.onTriggerChange),h=C.useRef(!1),p=C.useRef(!1),m=C.useCallback(()=>h.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),r.jsx(fy,{asChild:!0,...u,children:r.jsx(lt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...a,ref:d,onPointerMove:We(e.onPointerMove,b=>{b.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:We(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:We(e.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:We(e.onFocus,()=>{h.current||s.onOpen()}),onBlur:We(e.onBlur,s.onClose),onClick:We(e.onClick,s.onClose)})})});zO.displayName=jx;var fG="TooltipPortal",[ede,pG]=sm(fG,{forceMount:void 0}),Gl="TooltipContent",GO=C.forwardRef((e,t)=>{const n=pG(Gl,e.__scopeTooltip),{forceMount:a=n.forceMount,side:s="top",...o}=e,u=om(Gl,e.__scopeTooltip);return r.jsx(ur,{present:a||u.open,children:u.disableHoverableContent?r.jsx(qO,{side:s,...o,ref:t}):r.jsx(mG,{side:s,...o,ref:t})})}),mG=C.forwardRef((e,t)=>{const n=om(Gl,e.__scopeTooltip),a=gy(Gl,e.__scopeTooltip),s=C.useRef(null),o=Et(t,s),[u,c]=C.useState(null),{trigger:d,onClose:h}=n,p=s.current,{onPointerInTransitChange:m}=a,b=C.useCallback(()=>{c(null),m(!1)},[m]),v=C.useCallback((w,S)=>{const g=w.currentTarget,y={x:w.clientX,y:w.clientY},_=yG(y,g.getBoundingClientRect()),E=EG(y,_),T=_G(S.getBoundingClientRect()),N=wG([...E,...T]);c(N),m(!0)},[m]);return C.useEffect(()=>()=>b(),[b]),C.useEffect(()=>{if(d&&p){const w=g=>v(g,p),S=g=>v(g,d);return d.addEventListener("pointerleave",w),p.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",S)}}},[d,p,v,b]),C.useEffect(()=>{if(u){const w=S=>{const g=S.target,y={x:S.clientX,y:S.clientY},_=d?.contains(g)||p?.contains(g),E=!SG(y,u);_?b():E&&(b(),h())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[d,p,u,h,b]),r.jsx(qO,{...e,ref:o})}),[gG,bG]=sm(sd,{isInside:!1}),xG=BD("TooltipContent"),qO=C.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:u,...c}=e,d=om(Gl,n),h=im(n),{onClose:p}=d;return C.useEffect(()=>(document.addEventListener(Lx,p),()=>document.removeEventListener(Lx,p)),[p]),C.useEffect(()=>{if(d.trigger){const m=b=>{b.target?.contains(d.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[d.trigger,p]),r.jsx(sc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:r.jsxs(py,{"data-state":d.stateAttribute,...h,...c,ref:t,style:{...c.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:[r.jsx(xG,{children:a}),r.jsx(gG,{scope:n,isInside:!0,children:r.jsx(p7,{id:d.contentId,role:"tooltip",children:s||a})})]})})});GO.displayName=Gl;var WO="TooltipArrow",vG=C.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,s=im(n);return bG(WO,n).isInside?null:r.jsx(my,{...s,...a,ref:t})});vG.displayName=WO;function yG(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,a,s,o)){case o:return"left";case s:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function EG(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function _G(e){const{top:t,right:n,bottom:a,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:a},{x:s,y:a}]}function SG(e,t){const{x:n,y:a}=e;let s=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const c=t[o],d=t[u],h=c.x,p=c.y,m=d.x,b=d.y;p>a!=b>a&&n<(m-h)*(a-p)/(b-p)+h&&(s=!s)}return s}function wG(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),CG(t)}function CG(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const s=e[a];for(;t.length>=2;){const o=t[t.length-1],u=t[t.length-2];if((o.x-u.x)*(s.y-u.y)>=(o.y-u.y)*(s.x-u.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const s=e[a];for(;n.length>=2;){const o=n[n.length-1],u=n[n.length-2];if((o.x-u.x)*(s.y-u.y)>=(o.y-u.y)*(s.x-u.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var TG=HO,AG=$O,NG=zO,VO=GO;const kG=TG,RG=AG,DG=NG,YO=C.forwardRef(({className:e,sideOffset:t=4,...n},a)=>r.jsx(VO,{ref:a,sideOffset:t,className:Ne("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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),...n}));YO.displayName=VO.displayName;const IG="sidebar_state",OG=3600*24*7,LG="16rem",jG="18rem",MG="3rem",FG="b",KO=C.createContext(null);function lm(){const e=C.useContext(KO);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const XO=C.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:a,style:s,children:o,...u},c)=>{const d=UI(),[h,p]=C.useState(!1),[m,b]=C.useState(e),v=t??m,w=C.useCallback(_=>{const E=typeof _=="function"?_(v):_;n?n(E):b(E),document.cookie=`${IG}=${E}; path=/; max-age=${OG}`},[n,v]),S=C.useCallback(()=>d?p(_=>!_):w(_=>!_),[d,w,p]);C.useEffect(()=>{const _=E=>{E.key===FG&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),S())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[S]);const g=v?"expanded":"collapsed",y=C.useMemo(()=>({state:g,open:v,setOpen:w,isMobile:d,openMobile:h,setOpenMobile:p,toggleSidebar:S}),[g,v,w,d,h,p,S]);return r.jsx(KO.Provider,{value:y,children:r.jsx(kG,{delayDuration:0,children:r.jsx("div",{style:{"--sidebar-width":LG,"--sidebar-width-icon":MG,...s},className:Ne("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",a),ref:c,...u,children:o})})})});XO.displayName="SidebarProvider";const ZO=C.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:a,children:s,...o},u)=>{const{isMobile:c,state:d,openMobile:h,setOpenMobile:p}=lm();return n==="none"?r.jsx("div",{className:Ne("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",a),ref:u,...o,children:s}):c?r.jsx(gO,{open:h,onOpenChange:p,...o,children:r.jsxs(Jv,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":jG},side:e,children:[r.jsxs(ey,{className:"sr-only",children:[r.jsx(ty,{children:"Sidebar"}),r.jsx(xO,{children:"Displays the mobile sidebar."})]}),r.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):r.jsxs("div",{ref:u,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":e,children:[r.jsx("div",{className:Ne("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),r.jsx("div",{className:Ne("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...o,children:r.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:s})})]})});ZO.displayName="Sidebar";const QO=C.forwardRef(({className:e,onClick:t,...n},a)=>{const{toggleSidebar:s}=lm();return r.jsxs(se,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Ne("h-7 w-7",e),onClick:o=>{t?.(o),s()},...n,children:[r.jsx(p9,{}),r.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});QO.displayName="SidebarTrigger";const PG=C.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:a}=lm();return r.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:Ne("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});PG.displayName="SidebarRail";const JO=C.forwardRef(({className:e,...t},n)=>r.jsx("main",{ref:n,className:Ne("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));JO.displayName="SidebarInset";const BG=C.forwardRef(({className:e,...t},n)=>r.jsx(je,{ref:n,"data-sidebar":"input",className:Ne("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));BG.displayName="SidebarInput";const e3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"header",className:Ne("flex flex-col gap-2 p-2",e),...t}));e3.displayName="SidebarHeader";const t3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"footer",className:Ne("flex flex-col gap-2 p-2",e),...t}));t3.displayName="SidebarFooter";const UG=C.forwardRef(({className:e,...t},n)=>r.jsx(Ar,{ref:n,"data-sidebar":"separator",className:Ne("mx-2 w-auto bg-sidebar-border",e),...t}));UG.displayName="SidebarSeparator";const n3=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"content",className:Ne("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));n3.displayName="SidebarContent";const Yf=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"group",className:Ne("relative flex w-full min-w-0 flex-col p-2",e),...t}));Yf.displayName="SidebarGroup";const Kf=C.forwardRef(({className:e,asChild:t=!1,...n},a)=>{const s=t?ac:"div";return r.jsx(s,{ref:a,"data-sidebar":"group-label",className:Ne("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});Kf.displayName="SidebarGroupLabel";const HG=C.forwardRef(({className:e,asChild:t=!1,...n},a)=>{const s=t?ac:"button";return r.jsx(s,{ref:a,"data-sidebar":"group-action",className:Ne("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});HG.displayName="SidebarGroupAction";const Xf=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"group-content",className:Ne("w-full text-sm",e),...t}));Xf.displayName="SidebarGroupContent";const Al=C.forwardRef(({className:e,...t},n)=>r.jsx("ul",{ref:n,"data-sidebar":"menu",className:Ne("flex w-full min-w-0 flex-col gap-1",e),...t}));Al.displayName="SidebarMenu";const Nl=C.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Ne("group/menu-item relative",e),...t}));Nl.displayName="SidebarMenuItem";const $G=ic("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),kl=C.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:a="default",tooltip:s,className:o,...u},c)=>{const d=e?ac:"button",{isMobile:h,state:p}=lm(),m=r.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":a,"data-active":t,className:Ne($G({variant:n,size:a}),o),...u});return s?(typeof s=="string"&&(s={children:s}),r.jsxs(RG,{children:[r.jsx(DG,{asChild:!0,children:m}),r.jsx(YO,{side:"right",align:"center",hidden:p!=="collapsed"||h,...s})]})):m});kl.displayName="SidebarMenuButton";const zG=C.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...a},s)=>{const o=t?ac:"button";return r.jsx(o,{ref:s,"data-sidebar":"menu-action",className:Ne("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...a})});zG.displayName="SidebarMenuAction";const Mx=C.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Ne("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-full px-1.5 text-xs font-semibold tabular-nums shadow-sm","transition-all duration-200 ease-in-out hover:scale-110","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Mx.displayName="SidebarMenuBadge";const GG=C.forwardRef(({className:e,showIcon:t=!1,...n},a)=>{const s=C.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return r.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:Ne("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&r.jsx(L2,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),r.jsx(L2,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});GG.displayName="SidebarMenuSkeleton";const qG=C.forwardRef(({className:e,...t},n)=>r.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Ne("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));qG.displayName="SidebarMenuSub";const WG=C.forwardRef(({...e},t)=>r.jsx("li",{ref:t,...e}));WG.displayName="SidebarMenuSubItem";const VG=C.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:a,...s},o)=>{const u=e?ac:"a";return r.jsx(u,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Ne("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...s})});VG.displayName="SidebarMenuSubButton";const YG="1.0.69-alpha.5",KG={version:YG};function XG({className:e}){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[r.jsx("path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4"}),r.jsx("path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3"}),r.jsx("path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35"}),r.jsx("path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14"})]})}const ZG=[{title:"Home",url:"/",icon:zU},{title:"Proposals",url:"/proposals",icon:$u},{title:"Agents",url:"/agents",icon:xr},{title:"Code",url:"/code",icon:yi},{title:"Utilities",url:"/utilities",icon:SI}],QG=[{title:"Overview",url:"/context/project",icon:xa},{title:"Architecture",url:"/context/architecture",icon:fo},{title:"Knowledge",url:"/context/knowledge",icon:Z7},{title:"Resources",url:"/resources",icon:Kp}],JG=[{title:"Source Control",url:"/git",icon:vi},{title:"Terminal",url:"/terminal",icon:Ts},{title:"Schedule",url:"/schedule",icon:$f},{title:"Identity",url:"/identity",icon:qU}],eq=[{title:"Documentation",url:"https://docs.coconut.dev/",icon:h9,external:!0},{title:"Settings",url:"/settings",icon:$l}];function tq(){const{badges:e}=Ed();return r.jsxs(ZO,{className:"bg-sidebar border-r border-sidebar-border",children:[r.jsx(e3,{children:r.jsx(Al,{children:r.jsx(Nl,{children:r.jsx(kl,{size:"lg",asChild:!0,className:"[&>svg]:!size-8",children:r.jsxs(rt,{to:"/",children:[r.jsx(XG,{className:"size-8"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsxs("span",{className:"font-semibold",children:[r.jsx("span",{className:"bg-gradient-to-r from-amber-500 via-orange-500 to-yellow-600 bg-clip-text text-transparent",children:"Coconut"}),r.jsx("span",{children:" Studio"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",KG.version]})]})]})})})})}),r.jsxs(n3,{children:[r.jsxs(Yf,{children:[r.jsx(Kf,{children:"Main"}),r.jsx(Xf,{children:r.jsx(Al,{children:ZG.map(t=>r.jsxs(Nl,{children:[r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})}),t.title==="Code"&&e.codeSessions>0&&r.jsx(Mx,{className:"bg-blue-600 text-white dark:bg-blue-500",children:e.codeSessions})]},t.title))})})]}),r.jsxs(Yf,{children:[r.jsx(Kf,{children:"Project"}),r.jsx(Xf,{children:r.jsx(Al,{children:QG.map(t=>r.jsx(Nl,{children:r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})})},t.title))})})]}),r.jsxs(Yf,{children:[r.jsx(Kf,{children:"System"}),r.jsx(Xf,{children:r.jsx(Al,{children:JG.map(t=>{let n=0;return t.title==="Source Control"&&e.gitChanges>0?n=e.gitChanges:t.title==="Terminal"&&e.terminalSessions>0?n=e.terminalSessions:t.title==="Schedule"&&e.runningScheduledJobs>0&&(n=e.runningScheduledJobs),r.jsxs(Nl,{children:[r.jsx(kl,{asChild:!0,children:r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})}),n>0&&r.jsx(Mx,{className:"bg-blue-600 text-white dark:bg-blue-500",children:n})]},t.title)})})})]})]}),r.jsx(t3,{children:r.jsx(Al,{children:eq.map(t=>r.jsx(Nl,{children:r.jsx(kl,{asChild:!0,children:t.external?r.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]}):r.jsxs(rt,{to:t.url,children:[r.jsx(t.icon,{}),r.jsx("span",{children:t.title})]})})},t.title))})})]})}function Fx(e,[t,n]){return Math.min(n,Math.max(t,e))}var nq=C.createContext(void 0);function hc(e){const t=C.useContext(nq);return e||t||"ltr"}function by(e){const t=C.useRef({value:e,previous:e});return C.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var rq=[" ","Enter","ArrowUp","ArrowDown"],aq=[" ","Enter"],go="Select",[cm,um,sq]=zp(go),[fc,tde]=Rr(go,[sq,dc]),dm=dc(),[iq,Oi]=fc(go),[oq,lq]=fc(go),r3=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:s,onOpenChange:o,value:u,defaultValue:c,onValueChange:d,dir:h,name:p,autoComplete:m,disabled:b,required:v,form:w}=e,S=dm(t),[g,y]=C.useState(null),[_,E]=C.useState(null),[T,N]=C.useState(!1),k=hc(h),[L,R]=Za({prop:a,defaultProp:s??!1,onChange:o,caller:go}),[j,M]=Za({prop:u,defaultProp:c,onChange:d,caller:go}),B=C.useRef(null),H=g?w||!!g.closest("form"):!0,[P,$]=C.useState(new Set),ee=Array.from(P).map(U=>U.props.value).join(";");return r.jsx(hy,{...S,children:r.jsxs(iq,{required:v,scope:t,trigger:g,onTriggerChange:y,valueNode:_,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:N,contentId:ka(),value:j,onValueChange:M,open:L,onOpenChange:R,dir:k,triggerPointerDownPosRef:B,disabled:b,children:[r.jsx(cm.Provider,{scope:t,children:r.jsx(oq,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(U=>{$(J=>new Set(J).add(U))},[]),onNativeOptionRemove:C.useCallback(U=>{$(J=>{const X=new Set(J);return X.delete(U),X})},[]),children:n})}),H?r.jsxs(A3,{"aria-hidden":!0,required:v,tabIndex:-1,name:p,autoComplete:m,value:j,onChange:U=>M(U.target.value),disabled:b,form:w,children:[j===void 0?r.jsx("option",{value:""}):null,Array.from(P)]},ee):null]})})};r3.displayName=go;var a3="SelectTrigger",s3=C.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...s}=e,o=dm(n),u=Oi(a3,n),c=u.disabled||a,d=Et(t,u.onTriggerChange),h=um(n),p=C.useRef("touch"),[m,b,v]=k3(S=>{const g=h().filter(E=>!E.disabled),y=g.find(E=>E.value===u.value),_=R3(g,S,y);_!==void 0&&u.onValueChange(_.value)}),w=S=>{c||(u.onOpenChange(!0),v()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return r.jsx(fy,{asChild:!0,...o,children:r.jsx(lt.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":N3(u.value)?"":void 0,...s,ref:d,onClick:We(s.onClick,S=>{S.currentTarget.focus(),p.current!=="mouse"&&w(S)}),onPointerDown:We(s.onPointerDown,S=>{p.current=S.pointerType;const g=S.target;g.hasPointerCapture(S.pointerId)&&g.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:We(s.onKeyDown,S=>{const g=m.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(g&&S.key===" ")&&rq.includes(S.key)&&(w(),S.preventDefault())})})})});s3.displayName=a3;var i3="SelectValue",o3=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:u="",...c}=e,d=Oi(i3,n),{onValueNodeHasChildrenChange:h}=d,p=o!==void 0,m=Et(t,d.onValueNodeChange);return nr(()=>{h(p)},[h,p]),r.jsx(lt.span,{...c,ref:m,style:{pointerEvents:"none"},children:N3(d.value)?r.jsx(r.Fragment,{children:u}):o})});o3.displayName=i3;var cq="SelectIcon",l3=C.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...s}=e;return r.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:a||"▼"})});l3.displayName=cq;var uq="SelectPortal",c3=e=>r.jsx(_d,{asChild:!0,...e});c3.displayName=uq;var bo="SelectContent",u3=C.forwardRef((e,t)=>{const n=Oi(bo,e.__scopeSelect),[a,s]=C.useState();if(nr(()=>{s(new DocumentFragment)},[]),!n.open){const o=a;return o?nc.createPortal(r.jsx(d3,{scope:e.__scopeSelect,children:r.jsx(cm.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(h3,{...e,ref:t})});u3.displayName=bo;var Ta=10,[d3,Li]=fc(bo),dq="SelectContentImpl",hq=ho("SelectContent.RemoveScroll"),h3=C.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:u,side:c,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:b,collisionPadding:v,sticky:w,hideWhenDetached:S,avoidCollisions:g,...y}=e,_=Oi(bo,n),[E,T]=C.useState(null),[N,k]=C.useState(null),L=Et(t,K=>T(K)),[R,j]=C.useState(null),[M,B]=C.useState(null),H=um(n),[P,$]=C.useState(!1),ee=C.useRef(!1);C.useEffect(()=>{if(E)return Vv(E)},[E]),Wv();const U=C.useCallback(K=>{const[G,...Y]=H().map(de=>de.ref.current),[oe]=Y.slice(-1),ie=document.activeElement;for(const de of K)if(de===ie||(de?.scrollIntoView({block:"nearest"}),de===G&&N&&(N.scrollTop=0),de===oe&&N&&(N.scrollTop=N.scrollHeight),de?.focus(),document.activeElement!==ie))return},[H,N]),J=C.useCallback(()=>U([R,E]),[U,R,E]);C.useEffect(()=>{P&&J()},[P,J]);const{onOpenChange:X,triggerPointerDownPosRef:F}=_;C.useEffect(()=>{if(E){let K={x:0,y:0};const G=oe=>{K={x:Math.abs(Math.round(oe.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(oe.pageY)-(F.current?.y??0))}},Y=oe=>{K.x<=10&&K.y<=10?oe.preventDefault():E.contains(oe.target)||X(!1),document.removeEventListener("pointermove",G),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",Y,{capture:!0})}}},[E,X,F]),C.useEffect(()=>{const K=()=>X(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[X]);const[O,V]=k3(K=>{const G=H().filter(ie=>!ie.disabled),Y=G.find(ie=>ie.ref.current===document.activeElement),oe=R3(G,K,Y);oe&&setTimeout(()=>oe.ref.current.focus())}),te=C.useCallback((K,G,Y)=>{const oe=!ee.current&&!Y;(_.value!==void 0&&_.value===G||oe)&&(j(K),oe&&(ee.current=!0))},[_.value]),q=C.useCallback(()=>E?.focus(),[E]),W=C.useCallback((K,G,Y)=>{const oe=!ee.current&&!Y;(_.value!==void 0&&_.value===G||oe)&&B(K)},[_.value]),ae=a==="popper"?Px:f3,ne=ae===Px?{side:c,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:b,collisionPadding:v,sticky:w,hideWhenDetached:S,avoidCollisions:g}:{};return r.jsx(d3,{scope:n,content:E,viewport:N,onViewportChange:k,itemRefCallback:te,selectedItem:R,onItemLeave:q,itemTextRefCallback:W,focusSelectedItem:J,selectedItemText:M,position:a,isPositioned:P,searchRef:O,children:r.jsx(Jp,{as:hq,allowPinchZoom:!0,children:r.jsx(Zp,{asChild:!0,trapped:_.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:We(s,K=>{_.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:r.jsx(sc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:r.jsx(ae,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:K=>K.preventDefault(),...y,...ne,onPlaced:()=>$(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:We(y.onKeyDown,K=>{const G=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!G&&K.key.length===1&&V(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let oe=H().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(K.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ie=K.target,de=oe.indexOf(ie);oe=oe.slice(de+1)}setTimeout(()=>U(oe)),K.preventDefault()}})})})})})})});h3.displayName=dq;var fq="SelectItemAlignedPosition",f3=C.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...s}=e,o=Oi(bo,n),u=Li(bo,n),[c,d]=C.useState(null),[h,p]=C.useState(null),m=Et(t,L=>p(L)),b=um(n),v=C.useRef(!1),w=C.useRef(!0),{viewport:S,selectedItem:g,selectedItemText:y,focusSelectedItem:_}=u,E=C.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&h&&S&&g&&y){const L=o.trigger.getBoundingClientRect(),R=h.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(o.dir!=="rtl"){const ie=M.left-R.left,de=j.left-ie,Te=L.left-de,Ce=L.width+Te,Ve=Math.max(Ce,R.width),nt=window.innerWidth-Ta,Ie=Fx(de,[Ta,Math.max(Ta,nt-Ve)]);c.style.minWidth=Ce+"px",c.style.left=Ie+"px"}else{const ie=R.right-M.right,de=window.innerWidth-j.right-ie,Te=window.innerWidth-L.right-de,Ce=L.width+Te,Ve=Math.max(Ce,R.width),nt=window.innerWidth-Ta,Ie=Fx(de,[Ta,Math.max(Ta,nt-Ve)]);c.style.minWidth=Ce+"px",c.style.right=Ie+"px"}const B=b(),H=window.innerHeight-Ta*2,P=S.scrollHeight,$=window.getComputedStyle(h),ee=parseInt($.borderTopWidth,10),U=parseInt($.paddingTop,10),J=parseInt($.borderBottomWidth,10),X=parseInt($.paddingBottom,10),F=ee+U+P+X+J,O=Math.min(g.offsetHeight*5,F),V=window.getComputedStyle(S),te=parseInt(V.paddingTop,10),q=parseInt(V.paddingBottom,10),W=L.top+L.height/2-Ta,ae=H-W,ne=g.offsetHeight/2,K=g.offsetTop+ne,G=ee+U+K,Y=F-G;if(G<=W){const ie=B.length>0&&g===B[B.length-1].ref.current;c.style.bottom="0px";const de=h.clientHeight-S.offsetTop-S.offsetHeight,Te=Math.max(ae,ne+(ie?q:0)+de+J),Ce=G+Te;c.style.height=Ce+"px"}else{const ie=B.length>0&&g===B[0].ref.current;c.style.top="0px";const Te=Math.max(W,ee+S.offsetTop+(ie?te:0)+ne)+Y;c.style.height=Te+"px",S.scrollTop=G-W+S.offsetTop}c.style.margin=`${Ta}px 0`,c.style.minHeight=O+"px",c.style.maxHeight=H+"px",a?.(),requestAnimationFrame(()=>v.current=!0)}},[b,o.trigger,o.valueNode,c,h,S,g,y,o.dir,a]);nr(()=>E(),[E]);const[T,N]=C.useState();nr(()=>{h&&N(window.getComputedStyle(h).zIndex)},[h]);const k=C.useCallback(L=>{L&&w.current===!0&&(E(),_?.(),w.current=!1)},[E,_]);return r.jsx(mq,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:v,onScrollButtonChange:k,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:r.jsx(lt.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});f3.displayName=fq;var pq="SelectPopperPosition",Px=C.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=Ta,...o}=e,u=dm(n);return r.jsx(py,{...u,...o,ref:t,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Px.displayName=pq;var[mq,xy]=fc(bo,{}),Bx="SelectViewport",p3=C.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...s}=e,o=Li(Bx,n),u=xy(Bx,n),c=Et(t,o.onViewportChange),d=C.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),r.jsx(cm.Slot,{scope:n,children:r.jsx(lt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:We(s.onScroll,h=>{const p=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:b}=u;if(b?.current&&m){const v=Math.abs(d.current-p.scrollTop);if(v>0){const w=window.innerHeight-Ta*2,S=parseFloat(m.style.minHeight),g=parseFloat(m.style.height),y=Math.max(S,g);if(y<w){const _=y+v,E=Math.min(w,_),T=_-E;m.style.height=E+"px",m.style.bottom==="0px"&&(p.scrollTop=T>0?T:0,m.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});p3.displayName=Bx;var m3="SelectGroup",[gq,bq]=fc(m3),xq=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=ka();return r.jsx(gq,{scope:n,id:s,children:r.jsx(lt.div,{role:"group","aria-labelledby":s,...a,ref:t})})});xq.displayName=m3;var g3="SelectLabel",b3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=bq(g3,n);return r.jsx(lt.div,{id:s.id,...a,ref:t})});b3.displayName=g3;var bp="SelectItem",[vq,x3]=fc(bp),v3=C.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:s=!1,textValue:o,...u}=e,c=Oi(bp,n),d=Li(bp,n),h=c.value===a,[p,m]=C.useState(o??""),[b,v]=C.useState(!1),w=Et(t,_=>d.itemRefCallback?.(_,a,s)),S=ka(),g=C.useRef("touch"),y=()=>{s||(c.onValueChange(a),c.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(vq,{scope:n,value:a,disabled:s,textId:S,isSelected:h,onItemTextChange:C.useCallback(_=>{m(E=>E||(_?.textContent??"").trim())},[]),children:r.jsx(cm.ItemSlot,{scope:n,value:a,disabled:s,textValue:p,children:r.jsx(lt.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:w,onFocus:We(u.onFocus,()=>v(!0)),onBlur:We(u.onBlur,()=>v(!1)),onClick:We(u.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:We(u.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:We(u.onPointerDown,_=>{g.current=_.pointerType}),onPointerMove:We(u.onPointerMove,_=>{g.current=_.pointerType,s?d.onItemLeave?.():g.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:We(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:We(u.onKeyDown,_=>{d.searchRef?.current!==""&&_.key===" "||(aq.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});v3.displayName=bp;var Fu="SelectItemText",y3=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:s,...o}=e,u=Oi(Fu,n),c=Li(Fu,n),d=x3(Fu,n),h=lq(Fu,n),[p,m]=C.useState(null),b=Et(t,y=>m(y),d.onItemTextChange,y=>c.itemTextRefCallback?.(y,d.value,d.disabled)),v=p?.textContent,w=C.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:S,onNativeOptionRemove:g}=h;return nr(()=>(S(w),()=>g(w)),[S,g,w]),r.jsxs(r.Fragment,{children:[r.jsx(lt.span,{id:d.textId,...o,ref:b}),d.isSelected&&u.valueNode&&!u.valueNodeHasChildren?nc.createPortal(o.children,u.valueNode):null]})});y3.displayName=Fu;var E3="SelectItemIndicator",_3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return x3(E3,n).isSelected?r.jsx(lt.span,{"aria-hidden":!0,...a,ref:t}):null});_3.displayName=E3;var Ux="SelectScrollUpButton",S3=C.forwardRef((e,t)=>{const n=Li(Ux,e.__scopeSelect),a=xy(Ux,e.__scopeSelect),[s,o]=C.useState(!1),u=Et(t,a.onScrollButtonChange);return nr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=d.scrollTop>0;o(h)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(C3,{...e,ref:u,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});S3.displayName=Ux;var Hx="SelectScrollDownButton",w3=C.forwardRef((e,t)=>{const n=Li(Hx,e.__scopeSelect),a=xy(Hx,e.__scopeSelect),[s,o]=C.useState(!1),u=Et(t,a.onScrollButtonChange);return nr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<h;o(p)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(C3,{...e,ref:u,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});w3.displayName=Hx;var C3=C.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...s}=e,o=Li("SelectScrollButton",n),u=C.useRef(null),c=um(n),d=C.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return C.useEffect(()=>()=>d(),[d]),nr(()=>{c().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(lt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:We(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(a,50))}),onPointerMove:We(s.onPointerMove,()=>{o.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(a,50))}),onPointerLeave:We(s.onPointerLeave,()=>{d()})})}),yq="SelectSeparator",T3=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return r.jsx(lt.div,{"aria-hidden":!0,...a,ref:t})});T3.displayName=yq;var $x="SelectArrow",Eq=C.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,s=dm(n),o=Oi($x,n),u=Li($x,n);return o.open&&u.position==="popper"?r.jsx(my,{...s,...a,ref:t}):null});Eq.displayName=$x;var _q="SelectBubbleInput",A3=C.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const s=C.useRef(null),o=Et(a,s),u=by(t);return C.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(u!==t&&p){const m=new Event("change",{bubbles:!0});p.call(c,t),c.dispatchEvent(m)}},[u,t]),r.jsx(lt.select,{...n,style:{...zD,...n.style},ref:o,defaultValue:t})});A3.displayName=_q;function N3(e){return e===""||e===void 0}function k3(e){const t=kn(e),n=C.useRef(""),a=C.useRef(0),s=C.useCallback(u=>{const c=n.current+u;t(c),(function d(h){n.current=h,window.clearTimeout(a.current),h!==""&&(a.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),o=C.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,s,o]}function R3(e,t,n){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let u=Sq(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==n));const d=u.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function Sq(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var wq=r3,D3=s3,Cq=o3,Tq=l3,Aq=c3,I3=u3,Nq=p3,O3=b3,L3=v3,kq=y3,Rq=_3,j3=S3,M3=w3,F3=T3;const en=wq,tn=Cq,Xt=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(D3,{ref:a,className:Ne("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(Tq,{asChild:!0,children:r.jsx(Na,{className:"h-4 w-4 opacity-50"})})]}));Xt.displayName=D3.displayName;const P3=C.forwardRef(({className:e,...t},n)=>r.jsx(j3,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Wp,{className:"h-4 w-4"})}));P3.displayName=j3.displayName;const B3=C.forwardRef(({className:e,...t},n)=>r.jsx(M3,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Na,{className:"h-4 w-4"})}));B3.displayName=M3.displayName;const Zt=C.forwardRef(({className:e,children:t,position:n="popper",...a},s)=>r.jsx(Aq,{children:r.jsxs(I3,{ref:s,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...a,children:[r.jsx(P3,{}),r.jsx(Nq,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(B3,{})]})}));Zt.displayName=I3.displayName;const Dq=C.forwardRef(({className:e,...t},n)=>r.jsx(O3,{ref:n,className:Ne("px-2 py-1.5 text-sm font-semibold",e),...t}));Dq.displayName=O3.displayName;const Me=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(L3,{ref:a,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Rq,{children:r.jsx(So,{className:"h-4 w-4"})})}),r.jsx(kq,{children:t})]}));Me.displayName=L3.displayName;const Iq=C.forwardRef(({className:e,...t},n)=>r.jsx(F3,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));Iq.displayName=F3.displayName;const $n=Zv,xp=mO,Oq=Qv,U3=C.forwardRef(({className:e,...t},n)=>r.jsx(wd,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));U3.displayName=wd.displayName;const Dn=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(Oq,{children:[r.jsx(U3,{}),r.jsxs(Cd,{ref:a,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg 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%] sm:rounded-lg",e),...n,children:[t,r.jsxs(tm,{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:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Dn.displayName=Cd.displayName;const Cn=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Cn.displayName="DialogHeader";const Tr=({className:e,...t})=>r.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Tr.displayName="DialogFooter";const Tn=C.forwardRef(({className:e,...t},n)=>r.jsx(Td,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",e),...t}));Tn.displayName=Td.displayName;const Hn=C.forwardRef(({className:e,...t},n)=>r.jsx(Ad,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Hn.displayName=Ad.displayName;var hm="Checkbox",[Lq,nde]=Rr(hm),[jq,vy]=Lq(hm);function Mq(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:s,disabled:o,form:u,name:c,onCheckedChange:d,required:h,value:p="on",internal_do_not_use_render:m}=e,[b,v]=Za({prop:n,defaultProp:s??!1,onChange:d,caller:hm}),[w,S]=C.useState(null),[g,y]=C.useState(null),_=C.useRef(!1),E=w?!!u||!!w.closest("form"):!0,T={checked:b,disabled:o,setChecked:v,control:w,setControl:S,name:c,form:u,value:p,hasConsumerStoppedPropagationRef:_,required:h,defaultChecked:wi(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:y};return r.jsx(jq,{scope:t,...T,children:Fq(m)?m(T):a})}var H3="CheckboxTrigger",$3=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},s)=>{const{control:o,value:u,disabled:c,checked:d,required:h,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:b,isFormControl:v,bubbleInput:w}=vy(H3,e),S=Et(s,p),g=C.useRef(d);return C.useEffect(()=>{const y=o?.form;if(y){const _=()=>m(g.current);return y.addEventListener("reset",_),()=>y.removeEventListener("reset",_)}},[o,m]),r.jsx(lt.button,{type:"button",role:"checkbox","aria-checked":wi(d)?"mixed":d,"aria-required":h,"data-state":V3(d),"data-disabled":c?"":void 0,disabled:c,value:u,...a,ref:S,onKeyDown:We(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:We(n,y=>{m(_=>wi(_)?!0:!_),w&&v&&(b.current=y.isPropagationStopped(),b.current||y.stopPropagation())})})});$3.displayName=H3;var yy=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:s,defaultChecked:o,required:u,disabled:c,value:d,onCheckedChange:h,form:p,...m}=e;return r.jsx(Mq,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:u,onCheckedChange:h,name:a,form:p,value:d,internal_do_not_use_render:({isFormControl:b})=>r.jsxs(r.Fragment,{children:[r.jsx($3,{...m,ref:t,__scopeCheckbox:n}),b&&r.jsx(W3,{__scopeCheckbox:n})]})})});yy.displayName=hm;var z3="CheckboxIndicator",G3=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...s}=e,o=vy(z3,n);return r.jsx(ur,{present:a||wi(o.checked)||o.checked===!0,children:r.jsx(lt.span,{"data-state":V3(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});G3.displayName=z3;var q3="CheckboxBubbleInput",W3=C.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:u,required:c,disabled:d,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=vy(q3,e),w=Et(n,v),S=by(o),g=cy(a);C.useEffect(()=>{const _=b;if(!_)return;const E=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(E,"checked").set,k=!s.current;if(S!==o&&N){const L=new Event("click",{bubbles:k});_.indeterminate=wi(o),N.call(_,wi(o)?!1:o),_.dispatchEvent(L)}},[b,S,o,s]);const y=C.useRef(wi(o)?!1:o);return r.jsx(lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??y.current,required:c,disabled:d,name:h,value:p,form:m,...t,tabIndex:-1,ref:w,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});W3.displayName=q3;function Fq(e){return typeof e=="function"}function wi(e){return e==="indeterminate"}function V3(e){return wi(e)?"indeterminate":e?"checked":"unchecked"}const ma=C.forwardRef(({className:e,...t},n)=>r.jsx(yy,{ref:n,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(G3,{className:Ne("flex items-center justify-center text-current"),children:r.jsx(So,{className:"h-4 w-4"})})}));ma.displayName=yy.displayName;const Ci=C.forwardRef(({className:e,onCheckedChange:t,onChange:n,...a},s)=>{const o=u=>{n?.(u),t?.(u.target.checked)};return r.jsxs("label",{className:Ne("relative inline-flex cursor-pointer",e),children:[r.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:o,ref:s,...a}),r.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),r.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});Ci.displayName="Switch";function Pq(e,t){return C.useReducer((n,a)=>t[n][a]??n,e)}var Ey="ScrollArea",[Y3,rde]=Rr(Ey),[Bq,ya]=Y3(Ey),K3=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:a="hover",dir:s,scrollHideDelay:o=600,...u}=e,[c,d]=C.useState(null),[h,p]=C.useState(null),[m,b]=C.useState(null),[v,w]=C.useState(null),[S,g]=C.useState(null),[y,_]=C.useState(0),[E,T]=C.useState(0),[N,k]=C.useState(!1),[L,R]=C.useState(!1),j=Et(t,B=>d(B)),M=hc(s);return r.jsx(Bq,{scope:n,type:a,dir:M,scrollHideDelay:o,scrollArea:c,viewport:h,onViewportChange:p,content:m,onContentChange:b,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:N,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:g,scrollbarYEnabled:L,onScrollbarYEnabledChange:R,onCornerWidthChange:_,onCornerHeightChange:T,children:r.jsx(lt.div,{dir:M,...u,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});K3.displayName=Ey;var X3="ScrollAreaViewport",Z3=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:a,nonce:s,...o}=e,u=ya(X3,n),c=C.useRef(null),d=Et(t,c,u.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(lt.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});Z3.displayName=X3;var ts="ScrollAreaScrollbar",_y=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:u}=s,c=e.orientation==="horizontal";return C.useEffect(()=>(c?o(!0):u(!0),()=>{c?o(!1):u(!1)}),[c,o,u]),s.type==="hover"?r.jsx(Uq,{...a,ref:t,forceMount:n}):s.type==="scroll"?r.jsx(Hq,{...a,ref:t,forceMount:n}):s.type==="auto"?r.jsx(Q3,{...a,ref:t,forceMount:n}):s.type==="always"?r.jsx(Sy,{...a,ref:t}):null});_y.displayName=ts;var Uq=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),[o,u]=C.useState(!1);return C.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),u(!0)},p=()=>{d=window.setTimeout(()=>u(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",p),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",p)}}},[s.scrollArea,s.scrollHideDelay]),r.jsx(ur,{present:n||o,children:r.jsx(Q3,{"data-state":o?"visible":"hidden",...a,ref:t})})}),Hq=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=ya(ts,e.__scopeScrollArea),o=e.orientation==="horizontal",u=pm(()=>d("SCROLL_END"),100),[c,d]=Pq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),C.useEffect(()=>{const h=s.viewport,p=o?"scrollLeft":"scrollTop";if(h){let m=h[p];const b=()=>{const v=h[p];m!==v&&(d("SCROLL"),u()),m=v};return h.addEventListener("scroll",b),()=>h.removeEventListener("scroll",b)}},[s.viewport,o,d,u]),r.jsx(ur,{present:n||c!=="hidden",children:r.jsx(Sy,{"data-state":c==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:We(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:We(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Q3=C.forwardRef((e,t)=>{const n=ya(ts,e.__scopeScrollArea),{forceMount:a,...s}=e,[o,u]=C.useState(!1),c=e.orientation==="horizontal",d=pm(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,p=n.viewport.offsetHeight<n.viewport.scrollHeight;u(c?h:p)}},10);return ql(n.viewport,d),ql(n.content,d),r.jsx(ur,{present:a||o,children:r.jsx(Sy,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Sy=C.forwardRef((e,t)=>{const{orientation:n="vertical",...a}=e,s=ya(ts,e.__scopeScrollArea),o=C.useRef(null),u=C.useRef(0),[c,d]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=rL(c.viewport,c.content),p={...a,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:b=>o.current=b,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:b=>u.current=b};function m(b,v){return Vq(b,u.current,c,v)}return n==="horizontal"?r.jsx($q,{...p,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const b=s.viewport.scrollLeft,v=q2(b,c,s.dir);o.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollLeft=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollLeft=m(b,s.dir))}}):n==="vertical"?r.jsx(zq,{...p,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const b=s.viewport.scrollTop,v=q2(b,c);o.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollTop=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollTop=m(b))}}):null}),$q=C.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...s}=e,o=ya(ts,e.__scopeScrollArea),[u,c]=C.useState(),d=C.useRef(null),h=Et(t,d,o.onScrollbarXChange);return C.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),r.jsx(eL,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":fm(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(o.viewport){const b=o.viewport.scrollLeft+p.deltaX;e.onWheelScroll(b),sL(b,m)&&p.preventDefault()}},onResize:()=>{d.current&&o.viewport&&u&&a({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yp(u.paddingLeft),paddingEnd:yp(u.paddingRight)}})}})}),zq=C.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...s}=e,o=ya(ts,e.__scopeScrollArea),[u,c]=C.useState(),d=C.useRef(null),h=Et(t,d,o.onScrollbarYChange);return C.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),r.jsx(eL,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":fm(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(o.viewport){const b=o.viewport.scrollTop+p.deltaY;e.onWheelScroll(b),sL(b,m)&&p.preventDefault()}},onResize:()=>{d.current&&o.viewport&&u&&a({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yp(u.paddingTop),paddingEnd:yp(u.paddingBottom)}})}})}),[Gq,J3]=Y3(ts),eL=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:a,hasThumb:s,onThumbChange:o,onThumbPointerUp:u,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:p,onResize:m,...b}=e,v=ya(ts,n),[w,S]=C.useState(null),g=Et(t,j=>S(j)),y=C.useRef(null),_=C.useRef(""),E=v.viewport,T=a.content-a.viewport,N=kn(p),k=kn(d),L=pm(m,10);function R(j){if(y.current){const M=j.clientX-y.current.left,B=j.clientY-y.current.top;h({x:M,y:B})}}return C.useEffect(()=>{const j=M=>{const B=M.target;w?.contains(B)&&N(M,T)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[E,w,T,N]),C.useEffect(k,[a,k]),ql(w,L),ql(v.content,L),r.jsx(Gq,{scope:n,scrollbar:w,hasThumb:s,onThumbChange:kn(o),onThumbPointerUp:kn(u),onThumbPositionChange:k,onThumbPointerDown:kn(c),children:r.jsx(lt.div,{...b,ref:g,style:{position:"absolute",...b.style},onPointerDown:We(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),y.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),R(j))}),onPointerMove:We(e.onPointerMove,R),onPointerUp:We(e.onPointerUp,j=>{const M=j.target;M.hasPointerCapture(j.pointerId)&&M.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=_.current,v.viewport&&(v.viewport.style.scrollBehavior=""),y.current=null})})})}),vp="ScrollAreaThumb",tL=C.forwardRef((e,t)=>{const{forceMount:n,...a}=e,s=J3(vp,e.__scopeScrollArea);return r.jsx(ur,{present:n||s.hasThumb,children:r.jsx(qq,{ref:t,...a})})}),qq=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:a,...s}=e,o=ya(vp,n),u=J3(vp,n),{onThumbPositionChange:c}=u,d=Et(t,m=>u.onThumbChange(m)),h=C.useRef(void 0),p=pm(()=>{h.current&&(h.current(),h.current=void 0)},100);return C.useEffect(()=>{const m=o.viewport;if(m){const b=()=>{if(p(),!h.current){const v=Yq(m,c);h.current=v,c()}};return c(),m.addEventListener("scroll",b),()=>m.removeEventListener("scroll",b)}},[o.viewport,p,c]),r.jsx(lt.div,{"data-state":u.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:We(e.onPointerDownCapture,m=>{const v=m.target.getBoundingClientRect(),w=m.clientX-v.left,S=m.clientY-v.top;u.onThumbPointerDown({x:w,y:S})}),onPointerUp:We(e.onPointerUp,u.onThumbPointerUp)})});tL.displayName=vp;var wy="ScrollAreaCorner",nL=C.forwardRef((e,t)=>{const n=ya(wy,e.__scopeScrollArea),a=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&a?r.jsx(Wq,{...e,ref:t}):null});nL.displayName=wy;var Wq=C.forwardRef((e,t)=>{const{__scopeScrollArea:n,...a}=e,s=ya(wy,n),[o,u]=C.useState(0),[c,d]=C.useState(0),h=!!(o&&c);return ql(s.scrollbarX,()=>{const p=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(p),d(p)}),ql(s.scrollbarY,()=>{const p=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(p),u(p)}),h?r.jsx(lt.div,{...a,ref:t,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function yp(e){return e?parseInt(e,10):0}function rL(e,t){const n=e/t;return isNaN(n)?0:n}function fm(e){const t=rL(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-n)*t;return Math.max(a,18)}function Vq(e,t,n,a="ltr"){const s=fm(n),o=s/2,u=t||o,c=s-u,d=n.scrollbar.paddingStart+u,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,p=n.content-n.viewport,m=a==="ltr"?[0,p]:[p*-1,0];return aL([d,h],m)(e)}function q2(e,t,n="ltr"){const a=fm(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,u=t.content-t.viewport,c=o-a,d=n==="ltr"?[0,u]:[u*-1,0],h=Fx(e,d);return aL([0,u],[0,c])(h)}function aL(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function sL(e,t){return e>0&&e<t}var Yq=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},a=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},u=n.left!==o.left,c=n.top!==o.top;(u||c)&&t(),n=o,a=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(a)};function pm(e,t){const n=kn(e),a=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(a.current),[]),C.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(n,t)},[n,t])}function ql(e,t){const n=kn(t);nr(()=>{let a=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(a),s.unobserve(e)}}},[e,n])}var iL=K3,Kq=Z3,Xq=nL;const Oa=C.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(iL,{ref:a,className:Ne("relative overflow-hidden",e),...n,children:[r.jsx(Kq,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(oL,{}),r.jsx(Xq,{})]}));Oa.displayName=iL.displayName;const oL=C.forwardRef(({className:e,orientation:t="vertical",...n},a)=>r.jsx(_y,{ref:a,orientation:t,className:Ne("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(tL,{className:"relative flex-1 rounded-full bg-border"})}));oL.displayName=_y.displayName;function id(e){const t=[],n=String(e||"");let a=n.indexOf(","),s=0,o=!1;for(;!o;){a===-1&&(a=n.length,o=!0);const u=n.slice(s,a).trim();(u||!o)&&t.push(u),s=a+1,a=n.indexOf(",",s)}return t}function mm(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zq=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qq=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jq={};function W2(e,t){return(Jq.jsx?Qq:Zq).test(e)}const eW=/[ \t\n\f\r]/g;function kd(e){return typeof e=="object"?e.type==="text"?V2(e.value):!1:V2(e)}function V2(e){return e.replace(eW,"")===""}let Rd=class{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}};Rd.prototype.normal={};Rd.prototype.property={};Rd.prototype.space=void 0;function lL(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Rd(n,a,t)}function od(e){return e.toLowerCase()}let Hr=class{constructor(t,n){this.attribute=n,this.property=t}};Hr.prototype.attribute="";Hr.prototype.booleanish=!1;Hr.prototype.boolean=!1;Hr.prototype.commaOrSpaceSeparated=!1;Hr.prototype.commaSeparated=!1;Hr.prototype.defined=!1;Hr.prototype.mustUseProperty=!1;Hr.prototype.number=!1;Hr.prototype.overloadedBoolean=!1;Hr.prototype.property="";Hr.prototype.spaceSeparated=!1;Hr.prototype.space=void 0;let tW=0;const Nt=wo(),Bn=wo(),zx=wo(),Ge=wo(),fn=wo(),jl=wo(),Qr=wo();function wo(){return 2**++tW}const Gx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Nt,booleanish:Bn,commaOrSpaceSeparated:Qr,commaSeparated:jl,number:Ge,overloadedBoolean:zx,spaceSeparated:fn},Symbol.toStringTag,{value:"Module"})),R0=Object.keys(Gx);let Cy=class extends Hr{constructor(t,n,a,s){let o=-1;if(super(t,n),Y2(this,"space",s),typeof a=="number")for(;++o<R0.length;){const u=R0[o];Y2(this,R0[o],(a&Gx[u])===Gx[u])}}};Cy.prototype.defined=!0;function Y2(e,t,n){n&&(e[t]=n)}function pc(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new Cy(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[od(a)]=a,n[od(o.attribute)]=a}return new Rd(t,n,e.space)}const cL=pc({properties:{ariaActiveDescendant:null,ariaAtomic:Bn,ariaAutoComplete:null,ariaBusy:Bn,ariaChecked:Bn,ariaColCount:Ge,ariaColIndex:Ge,ariaColSpan:Ge,ariaControls:fn,ariaCurrent:null,ariaDescribedBy:fn,ariaDetails:null,ariaDisabled:Bn,ariaDropEffect:fn,ariaErrorMessage:null,ariaExpanded:Bn,ariaFlowTo:fn,ariaGrabbed:Bn,ariaHasPopup:null,ariaHidden:Bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fn,ariaLevel:Ge,ariaLive:null,ariaModal:Bn,ariaMultiLine:Bn,ariaMultiSelectable:Bn,ariaOrientation:null,ariaOwns:fn,ariaPlaceholder:null,ariaPosInSet:Ge,ariaPressed:Bn,ariaReadOnly:Bn,ariaRelevant:null,ariaRequired:Bn,ariaRoleDescription:fn,ariaRowCount:Ge,ariaRowIndex:Ge,ariaRowSpan:Ge,ariaSelected:Bn,ariaSetSize:Ge,ariaSort:null,ariaValueMax:Ge,ariaValueMin:Ge,ariaValueNow:Ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function uL(e,t){return t in e?e[t]:t}function dL(e,t){return uL(e,t.toLowerCase())}const nW=pc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jl,acceptCharset:fn,accessKey:fn,action:null,allow:null,allowFullScreen:Nt,allowPaymentRequest:Nt,allowUserMedia:Nt,alt:null,as:null,async:Nt,autoCapitalize:null,autoComplete:fn,autoFocus:Nt,autoPlay:Nt,blocking:fn,capture:null,charSet:null,checked:Nt,cite:null,className:fn,cols:Ge,colSpan:null,content:null,contentEditable:Bn,controls:Nt,controlsList:fn,coords:Ge|jl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Nt,defer:Nt,dir:null,dirName:null,disabled:Nt,download:zx,draggable:Bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Nt,formTarget:null,headers:fn,height:Ge,hidden:zx,high:Ge,href:null,hrefLang:null,htmlFor:fn,httpEquiv:fn,id:null,imageSizes:null,imageSrcSet:null,inert:Nt,inputMode:null,integrity:null,is:null,isMap:Nt,itemId:null,itemProp:fn,itemRef:fn,itemScope:Nt,itemType:fn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Nt,low:Ge,manifest:null,max:null,maxLength:Ge,media:null,method:null,min:null,minLength:Ge,multiple:Nt,muted:Nt,name:null,nonce:null,noModule:Nt,noValidate:Nt,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:Nt,optimum:Ge,pattern:null,ping:fn,placeholder:null,playsInline:Nt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Nt,referrerPolicy:null,rel:fn,required:Nt,reversed:Nt,rows:Ge,rowSpan:Ge,sandbox:fn,scope:null,scoped:Nt,seamless:Nt,selected:Nt,shadowRootClonable:Nt,shadowRootDelegatesFocus:Nt,shadowRootMode:null,shape:null,size:Ge,sizes:null,slot:null,span:Ge,spellCheck:Bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ge,step:null,style:null,tabIndex:Ge,target:null,title:null,translate:null,type:null,typeMustMatch:Nt,useMap:null,value:Bn,width:Ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fn,axis:null,background:null,bgColor:null,border:Ge,borderColor:null,bottomMargin:Ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Nt,declare:Nt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ge,leftMargin:Ge,link:null,longDesc:null,lowSrc:null,marginHeight:Ge,marginWidth:Ge,noResize:Nt,noHref:Nt,noShade:Nt,noWrap:Nt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ge,rules:null,scheme:null,scrolling:Bn,standby:null,summary:null,text:null,topMargin:Ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Nt,disableRemotePlayback:Nt,prefix:null,property:null,results:Ge,security:null,unselectable:null},space:"html",transform:dL}),rW=pc({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:Qr,accentHeight:Ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ge,amplitude:Ge,arabicForm:null,ascent:Ge,attributeName:null,attributeType:null,azimuth:Ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ge,by:null,calcMode:null,capHeight:Ge,className:fn,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:Ge,diffuseConstant:Ge,direction:null,display:null,dur:null,divisor:Ge,dominantBaseline:null,download:Nt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ge,enableBackground:null,end:null,event:null,exponent:Ge,externalResourcesRequired:null,fill:null,fillOpacity:Ge,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:jl,g2:jl,glyphName:jl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ge,horizOriginX:Ge,horizOriginY:Ge,id:null,ideographic:Ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ge,k:Ge,k1:Ge,k2:Ge,k3:Ge,k4:Ge,kernelMatrix:Qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ge,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:Ge,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:Ge,overlineThickness:Ge,paintOrder:null,panose1:null,path:null,pathLength:Ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ge,pointsAtY:Ge,pointsAtZ:Ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qr,rev:Qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qr,requiredFeatures:Qr,requiredFonts:Qr,requiredFormats:Qr,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:Ge,specularExponent:Ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ge,strikethroughThickness:Ge,string:null,stroke:null,strokeDashArray:Qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ge,strokeOpacity:Ge,strokeWidth:null,style:null,surfaceScale:Ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qr,tabIndex:Ge,tableValues:null,target:null,targetX:Ge,targetY:Ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ge,underlineThickness:Ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ge,values:null,vAlphabetic:Ge,vMathematical:Ge,vectorEffect:null,vHanging:Ge,vIdeographic:Ge,version:null,vertAdvY:Ge,vertOriginX:Ge,vertOriginY:Ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uL}),hL=pc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),fL=pc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dL}),pL=pc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),aW={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"},sW=/[A-Z]/g,K2=/-[a-z]/g,iW=/^data[-\w.:]+$/i;function Dd(e,t){const n=od(t);let a=t,s=Hr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iW.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(K2,lW);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!K2.test(o)){let u=o.replace(sW,oW);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=Cy}return new s(a,t)}function oW(e){return"-"+e.toLowerCase()}function lW(e){return e.charAt(1).toUpperCase()}const mc=lL([cL,nW,hL,fL,pL],"html"),Us=lL([cL,rW,hL,fL,pL],"svg");function ld(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function gm(e){return e.join(" ").trim()}var El={},D0,X2;function cW(){if(X2)return D0;X2=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
585
585
  `,h="/",p="*",m="",b="comment",v="declaration";D0=function(S,g){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];g=g||{};var y=1,_=1;function E(P){var $=P.match(t);$&&(y+=$.length);var ee=P.lastIndexOf(d);_=~ee?P.length-ee:_+P.length}function T(){var P={line:y,column:_};return function($){return $.position=new N(P),R(),$}}function N(P){this.start=P,this.end={line:y,column:_},this.source=g.source}N.prototype.content=S;function k(P){var $=new Error(g.source+":"+y+":"+_+": "+P);if($.reason=P,$.filename=g.source,$.line=y,$.column=_,$.source=S,!g.silent)throw $}function L(P){var $=P.exec(S);if($){var ee=$[0];return E(ee),S=S.slice(ee.length),$}}function R(){L(n)}function j(P){var $;for(P=P||[];$=M();)$!==!1&&P.push($);return P}function M(){var P=T();if(!(h!=S.charAt(0)||p!=S.charAt(1))){for(var $=2;m!=S.charAt($)&&(p!=S.charAt($)||h!=S.charAt($+1));)++$;if($+=2,m===S.charAt($-1))return k("End of comment missing");var ee=S.slice(2,$-2);return _+=2,E(ee),S=S.slice($),_+=2,P({type:b,comment:ee})}}function B(){var P=T(),$=L(a);if($){if(M(),!L(s))return k("property missing ':'");var ee=L(o),U=P({type:v,property:w($[0].replace(e,m)),value:ee?w(ee[0].replace(e,m)):m});return L(u),U}}function H(){var P=[];j(P);for(var $;$=B();)$!==!1&&(P.push($),j(P));return P}return R(),H()};function w(S){return S?S.replace(c,m):m}return D0}var Z2;function uW(){if(Z2)return El;Z2=1;var e=El&&El.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(El,"__esModule",{value:!0}),El.default=n;var t=e(cW());function n(a,s){var o=null;if(!a||typeof a!="string")return o;var u=(0,t.default)(a),c=typeof s=="function";return u.forEach(function(d){if(d.type==="declaration"){var h=d.property,p=d.value;c?s(h,p,d):p&&(o=o||{},o[h]=p)}}),o}return El}var Au={},Q2;function dW(){if(Q2)return Au;Q2=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},u=function(h,p){return p.toUpperCase()},c=function(h,p){return"".concat(p,"-")},d=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,c):h=h.replace(a,c),h.replace(t,u))};return Au.camelCase=d,Au}var Nu,J2;function hW(){if(J2)return Nu;J2=1;var e=Nu&&Nu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(uW()),n=dW();function a(s,o){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(c,d){c&&d&&(u[(0,n.camelCase)(c,o)]=d)}),u}return a.default=a,Nu=a,Nu}var fW=hW();const pW=Zl(fW),bm=mL("end"),ns=mL("start");function mL(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function gL(e){const t=ns(e),n=bm(e);if(t&&n)return{start:t,end:n}}function zu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ek(e.position):"start"in e||"end"in e?ek(e):"line"in e||"column"in e?qx(e):""}function qx(e){return tk(e&&e.line)+":"+tk(e&&e.column)}function ek(e){return qx(e&&e.start)+"-"+qx(e&&e.end)}function tk(e){return e&&typeof e=="number"?e:1}class dr extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(u=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const d=a.indexOf(":");d===-1?o.ruleId=a:(o.source=a.slice(0,d),o.ruleId=a.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=zu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}dr.prototype.file="";dr.prototype.name="";dr.prototype.reason="";dr.prototype.message="";dr.prototype.stack="";dr.prototype.column=void 0;dr.prototype.line=void 0;dr.prototype.ancestors=void 0;dr.prototype.cause=void 0;dr.prototype.fatal=void 0;dr.prototype.place=void 0;dr.prototype.ruleId=void 0;dr.prototype.source=void 0;const Ty={}.hasOwnProperty,mW=new Map,gW=/[A-Z]/g,bW=new Set(["table","tbody","thead","tfoot","tr"]),xW=new Set(["td","th"]),bL="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xL(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=TW(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=CW(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Us:mc,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=vL(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function vL(e,t,n){if(t.type==="element")return vW(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return yW(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _W(e,t,n);if(t.type==="mdxjsEsm")return EW(e,t);if(t.type==="root")return SW(e,t,n);if(t.type==="text")return wW(e,t)}function vW(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=Us,e.schema=s),e.ancestors.push(t);const o=EL(e,t.tagName,!1),u=AW(e,t);let c=Ny(e,t);return bW.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!kd(d):!0})),yL(e,u,o,t),Ay(u,c),e.ancestors.pop(),e.schema=a,e.create(t,o,u,n)}function yW(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}cd(e,t.position)}function EW(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cd(e,t.position)}function _W(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=Us,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:EL(e,t.name,!0),u=NW(e,t),c=Ny(e,t);return yL(e,u,o,t),Ay(u,c),e.ancestors.pop(),e.schema=a,e.create(t,o,u,n)}function SW(e,t,n){const a={};return Ay(a,Ny(e,t)),e.create(t,e.Fragment,a,n)}function wW(e,t){return t.value}function yL(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function Ay(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function CW(e,t,n){return a;function a(s,o,u,c){const h=Array.isArray(u.children)?n:t;return c?h(o,u,c):h(o,u)}}function TW(e,t){return n;function n(a,s,o,u){const c=Array.isArray(o.children),d=ns(a);return t(s,o,u,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function AW(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&Ty.call(t.properties,s)){const o=kW(e,s,t.properties[s]);if(o){const[u,c]=o;e.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&xW.has(t.tagName)?a=c:n[u]=c}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function NW(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const u=o.expression;u.type;const c=u.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else cd(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const c=a.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else cd(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function Ny(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:mW;for(;++a<t.children.length;){const o=t.children[a];let u;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const h=s.get(d)||0;u=d+"-"+h,s.set(d,h+1)}}const c=vL(e,o,u);c!==void 0&&n.push(c)}return n}function kW(e,t,n){const a=Dd(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?mm(n):gm(n)),a.property==="style"){let s=typeof n=="object"?n:RW(e,String(n));return e.stylePropertyNameCase==="css"&&(s=DW(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?aW[a.property]||a.property:a.attribute,n]}}function RW(e,t){try{return pW(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new dr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=bL+"#cannot-parse-style-attribute",s}}function EL(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,u;for(;++o<s.length;){const c=W2(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};u=u?{type:"MemberExpression",object:u,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}a=u}else a=W2(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return Ty.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);cd(e)}function cd(e,t){const n=new dr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=bL+"#cannot-handle-mdx-estrees-without-createevaluater",n}function DW(e){const t={};let n;for(n in e)Ty.call(e,n)&&(t[IW(n)]=e[n]);return t}function IW(e){let t=e.replace(gW,OW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function OW(e){return"-"+e.toLowerCase()}const Ml={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"]},LW={};function ky(e,t){const n=LW,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _L(e,a,s)}function _L(e,t,n){if(jW(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return nk(e.children,t,n)}return Array.isArray(e)?nk(e,t,n):""}function nk(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=_L(e[s],t,n);return a.join("")}function jW(e){return!!(e&&typeof e=="object")}const rk=document.createElement("i");function ud(e){const t="&"+e+";";rk.innerHTML=t;const n=rk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ra(e,t,n,a){const s=e.length;let o=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)u=Array.from(a),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<a.length;)u=a.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function fa(e,t){return e.length>0?(ra(e,e.length,0,t),e):t}const ak={}.hasOwnProperty;function SL(e){const t={};let n=-1;for(;++n<e.length;)MW(t,e[n]);return t}function MW(e,t){let n;for(n in t){const s=(ak.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){ak.call(s,u)||(s[u]=[]);const c=o[u];FW(s[u],Array.isArray(c)?c:c?[c]:[])}}}function FW(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);ra(e,0,0,a)}function wL(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ra(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sr=ji(/[A-Za-z]/),br=ji(/[\dA-Za-z]/),PW=ji(/[#-'*+\--9=?A-Z^-~]/);function Ep(e){return e!==null&&(e<32||e===127)}const Wx=ji(/\d/),BW=ji(/[\dA-Fa-f]/),UW=ji(/[!-/:-@[-`{-~]/);function mt(e){return e!==null&&e<-2}function dn(e){return e!==null&&(e<0||e===32)}function Ut(e){return e===-2||e===-1||e===32}const xm=ji(new RegExp("\\p{P}|\\p{S}","u")),xo=ji(/\s/);function ji(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function gc(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&br(e.charCodeAt(n+1))&&br(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(u=String.fromCharCode(o,c),s=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(a,n),encodeURIComponent(u)),a=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function qt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(d){return Ut(d)?(e.enter(n),c(d)):t(d)}function c(d){return Ut(d)&&o++<s?(e.consume(d),c):(e.exit(n),t(d))}}const HW={tokenize:$W};function $W(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),qt(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),o(c)}function o(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,u(c)}function u(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return mt(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),u)}}const zW={tokenize:GW},sk={tokenize:qW};function GW(e){const t=this,n=[];let a=0,s,o,u;return c;function c(E){if(a<n.length){const T=n[a];return t.containerState=T[1],e.attempt(T[0].continuation,d,h)(E)}return h(E)}function d(E){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&_();const T=t.events.length;let N=T,k;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){k=t.events[N][1].end;break}y(a);let L=T;for(;L<t.events.length;)t.events[L][1].end={...k},L++;return ra(t.events,N+1,0,t.events.slice(T)),t.events.length=L,h(E)}return c(E)}function h(E){if(a===n.length){if(!s)return b(E);if(s.currentConstruct&&s.currentConstruct.concrete)return w(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(sk,p,m)(E)}function p(E){return s&&_(),y(a),b(E)}function m(E){return t.parser.lazy[t.now().line]=a!==n.length,u=t.now().offset,w(E)}function b(E){return t.containerState={},e.attempt(sk,v,w)(E)}function v(E){return a++,n.push([t.currentConstruct,t.containerState]),b(E)}function w(E){if(E===null){s&&_(),y(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),S(E)}function S(E){if(E===null){g(e.exit("chunkFlow"),!0),y(0),e.consume(E);return}return mt(E)?(e.consume(E),g(e.exit("chunkFlow")),a=0,t.interrupt=void 0,c):(e.consume(E),S)}function g(E,T){const N=t.sliceStream(E);if(T&&N.push(null),E.previous=o,o&&(o.next=E),o=E,s.defineSkip(E.start),s.write(N),t.parser.lazy[E.start.line]){let k=s.events.length;for(;k--;)if(s.events[k][1].start.offset<u&&(!s.events[k][1].end||s.events[k][1].end.offset>u))return;const L=t.events.length;let R=L,j,M;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(j){M=t.events[R][1].end;break}j=!0}for(y(a),k=L;k<t.events.length;)t.events[k][1].end={...M},k++;ra(t.events,R+1,0,t.events.slice(L)),t.events.length=k}}function y(E){let T=n.length;for(;T-- >E;){const N=n[T];t.containerState=N[1],N[0].exit.call(t,e)}n.length=E}function _(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function qW(e,t,n){return qt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wl(e){if(e===null||dn(e)||xo(e))return 1;if(xm(e))return 2}function vm(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Vx={name:"attention",resolveAll:WW,tokenize:VW};function WW(e,t){let n=-1,a,s,o,u,c,d,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[a][1].end},b={...e[n][1].start};ik(m,-d),ik(b,d),u={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[a][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:d>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...u.start},end:{...c.end}},e[a][1].end={...u.start},e[n][1].start={...c.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=fa(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=fa(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",o,t]]),h=fa(h,vm(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=fa(h,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=fa(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ra(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function VW(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=Wl(a);let o;return u;function u(d){return o=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===o)return e.consume(d),c;const h=e.exit("attentionSequence"),p=Wl(d),m=!p||p===2&&s||n.includes(d),b=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?m:m&&(s||!b)),h._close=!!(o===42?b:b&&(p||!m)),t(d)}}function ik(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YW={name:"autolink",tokenize:KW};function KW(e,t,n){let a=0;return s;function s(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return Sr(v)?(e.consume(v),u):v===64?n(v):h(v)}function u(v){return v===43||v===45||v===46||br(v)?(a=1,c(v)):h(v)}function c(v){return v===58?(e.consume(v),a=0,d):(v===43||v===45||v===46||br(v))&&a++<32?(e.consume(v),c):(a=0,h(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Ep(v)?n(v):(e.consume(v),d)}function h(v){return v===64?(e.consume(v),p):PW(v)?(e.consume(v),h):n(v)}function p(v){return br(v)?m(v):n(v)}function m(v){return v===46?(e.consume(v),a=0,p):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):b(v)}function b(v){if((v===45||br(v))&&a++<63){const w=v===45?b:m;return e.consume(v),w}return n(v)}}const Id={partial:!0,tokenize:XW};function XW(e,t,n){return a;function a(o){return Ut(o)?qt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||mt(o)?t(o):n(o)}}const CL={continuation:{tokenize:QW},exit:JW,name:"blockQuote",tokenize:ZW};function ZW(e,t,n){const a=this;return s;function s(u){if(u===62){const c=a.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return Ut(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function QW(e,t,n){const a=this;return s;function s(u){return Ut(u)?qt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(CL,t,n)(u)}}function JW(e){e.exit("blockQuote")}const TL={name:"characterEscape",tokenize:eV};function eV(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return UW(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const AL={name:"characterReference",tokenize:tV};function tV(e,t,n){const a=this;let s=0,o,u;return c;function c(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,u=br,p(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=BW,p):(e.enter("characterReferenceValue"),o=7,u=Wx,p(m))}function p(m){if(m===59&&s){const b=e.exit("characterReferenceValue");return u===br&&!ud(a.sliceSerialize(b))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&s++<o?(e.consume(m),p):n(m)}}const ok={partial:!0,tokenize:rV},lk={concrete:!0,name:"codeFenced",tokenize:nV};function nV(e,t,n){const a=this,s={partial:!0,tokenize:N};let o=0,u=0,c;return d;function d(k){return h(k)}function h(k){const L=a.events[a.events.length-1];return o=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,c=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(k)}function p(k){return k===c?(u++,e.consume(k),p):u<3?n(k):(e.exit("codeFencedFenceSequence"),Ut(k)?qt(e,m,"whitespace")(k):m(k))}function m(k){return k===null||mt(k)?(e.exit("codeFencedFence"),a.interrupt?t(k):e.check(ok,S,T)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===null||mt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(k)):Ut(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qt(e,v,"whitespace")(k)):k===96&&k===c?n(k):(e.consume(k),b)}function v(k){return k===null||mt(k)?m(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(k))}function w(k){return k===null||mt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(k)):k===96&&k===c?n(k):(e.consume(k),w)}function S(k){return e.attempt(s,T,g)(k)}function g(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),y}function y(k){return o>0&&Ut(k)?qt(e,_,"linePrefix",o+1)(k):_(k)}function _(k){return k===null||mt(k)?e.check(ok,S,T)(k):(e.enter("codeFlowValue"),E(k))}function E(k){return k===null||mt(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),E)}function T(k){return e.exit("codeFenced"),t(k)}function N(k,L,R){let j=0;return M;function M(ee){return k.enter("lineEnding"),k.consume(ee),k.exit("lineEnding"),B}function B(ee){return k.enter("codeFencedFence"),Ut(ee)?qt(k,H,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):H(ee)}function H(ee){return ee===c?(k.enter("codeFencedFenceSequence"),P(ee)):R(ee)}function P(ee){return ee===c?(j++,k.consume(ee),P):j>=u?(k.exit("codeFencedFenceSequence"),Ut(ee)?qt(k,$,"whitespace")(ee):$(ee)):R(ee)}function $(ee){return ee===null||mt(ee)?(k.exit("codeFencedFence"),L(ee)):R(ee)}}}function rV(e,t,n){const a=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}const I0={name:"codeIndented",tokenize:sV},aV={partial:!0,tokenize:iV};function sV(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),qt(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?d(h):mt(h)?e.attempt(aV,u,d)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||mt(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),c)}function d(h){return e.exit("codeIndented"),t(h)}}function iV(e,t,n){const a=this;return s;function s(u){return a.parser.lazy[a.now().line]?n(u):mt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):qt(e,o,"linePrefix",5)(u)}function o(u){const c=a.events[a.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):mt(u)?s(u):n(u)}}const oV={name:"codeText",previous:cV,resolve:lV,tokenize:uV};function lV(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function cV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uV(e,t,n){let a=0,s,o;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),a++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(o=e.enter("codeTextSequence"),s=0,p(m)):mt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||mt(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),h)}function p(m){return m===96?(e.consume(m),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(o.type="codeTextData",h(m))}}class dV{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&ku(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ku(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ku(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ku(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ku(this.left,n.reverse())}}}function ku(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function NL(e){const t={};let n=-1,a,s,o,u,c,d,h;const p=new dV(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=a[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,hV(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(u=p.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(a[1].end={...p.get(s)[1].start},c=p.slice(s,n),c.unshift(a),p.splice(s,n-s+1,c))}}return ra(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function hV(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let u=n._tokenizer;u||(u=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const c=u.events,d=[],h={};let p,m,b=-1,v=n,w=0,S=0;const g=[S];for(;v;){for(;e.get(++s)[1]!==v;);o.push(s),v._tokenizer||(p=a.sliceStream(v),v.next||p.push(null),m&&u.defineSkip(v.start),v._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(p),v._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=v,v=v.next}for(v=n;++b<c.length;)c[b][0]==="exit"&&c[b-1][0]==="enter"&&c[b][1].type===c[b-1][1].type&&c[b][1].start.line!==c[b][1].end.line&&(S=b+1,g.push(S),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(u.events=[],v?(v._tokenizer=void 0,v.previous=void 0):g.pop(),b=g.length;b--;){const y=c.slice(g[b],g[b+1]),_=o.pop();d.push([_,_+y.length-1]),e.splice(_,2,y)}for(d.reverse(),b=-1;++b<d.length;)h[w+d[b][0]]=w+d[b][1],w+=d[b][1]-d[b][0]-1;return h}const fV={resolve:mV,tokenize:gV},pV={partial:!0,tokenize:bV};function mV(e){return NL(e),e}function gV(e,t){let n;return a;function a(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?o(c):mt(c)?e.check(pV,u,o)(c):(e.consume(c),s)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function u(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function bV(e,t,n){const a=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),qt(e,o,"linePrefix")}function o(u){if(u===null||mt(u))return n(u);const c=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):e.interrupt(a.parser.constructs.flow,n,t)(u)}}function kL(e,t,n,a,s,o,u,c,d){const h=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(y){return y===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(y),e.exit(o),b):y===null||y===32||y===41||Ep(y)?n(y):(e.enter(a),e.enter(u),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(y))}function b(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===62?(e.exit("chunkString"),e.exit(c),b(y)):y===null||y===60||mt(y)?n(y):(e.consume(y),y===92?w:v)}function w(y){return y===60||y===62||y===92?(e.consume(y),v):v(y)}function S(y){return!p&&(y===null||y===41||dn(y))?(e.exit("chunkString"),e.exit(c),e.exit(u),e.exit(a),t(y)):p<h&&y===40?(e.consume(y),p++,S):y===41?(e.consume(y),p--,S):y===null||y===32||y===40||Ep(y)?n(y):(e.consume(y),y===92?g:S)}function g(y){return y===40||y===41||y===92?(e.consume(y),S):S(y)}}function RL(e,t,n,a,s,o){const u=this;let c=0,d;return h;function h(v){return e.enter(a),e.enter(s),e.consume(v),e.exit(s),e.enter(o),p}function p(v){return c>999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?n(v):v===93?(e.exit(o),e.enter(s),e.consume(v),e.exit(s),e.exit(a),t):mt(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===null||v===91||v===93||mt(v)||c++>999?(e.exit("chunkString"),p(v)):(e.consume(v),d||(d=!Ut(v)),v===92?b:m)}function b(v){return v===91||v===92||v===93?(e.consume(v),c++,m):m(v)}}function DL(e,t,n,a,s,o){let u;return c;function c(b){return b===34||b===39||b===40?(e.enter(a),e.enter(s),e.consume(b),e.exit(s),u=b===40?41:b,d):n(b)}function d(b){return b===u?(e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):(e.enter(o),h(b))}function h(b){return b===u?(e.exit(o),d(u)):b===null?n(b):mt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),qt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===u||b===null||mt(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?m:p)}function m(b){return b===u||b===92?(e.consume(b),p):p(b)}}function Gu(e,t){let n;return a;function a(s){return mt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):Ut(s)?qt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const xV={name:"definition",tokenize:yV},vV={partial:!0,tokenize:EV};function yV(e,t,n){const a=this;let s;return o;function o(v){return e.enter("definition"),u(v)}function u(v){return RL.call(a,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Ra(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):n(v)}function d(v){return dn(v)?Gu(e,h)(v):h(v)}function h(v){return kL(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(vV,m,m)(v)}function m(v){return Ut(v)?qt(e,b,"whitespace")(v):b(v)}function b(v){return v===null||mt(v)?(e.exit("definition"),a.parser.defined.push(s),t(v)):n(v)}}function EV(e,t,n){return a;function a(c){return dn(c)?Gu(e,s)(c):n(c)}function s(c){return DL(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Ut(c)?qt(e,u,"whitespace")(c):u(c)}function u(c){return c===null||mt(c)?t(c):n(c)}}const _V={name:"hardBreakEscape",tokenize:SV};function SV(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return mt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const wV={name:"headingAtx",resolve:CV,tokenize:TV};function CV(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},ra(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function TV(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&a++<6?(e.consume(p),u):p===null||dn(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||mt(p)?(e.exit("atxHeading"),t(p)):Ut(p)?qt(e,c,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function h(p){return p===null||p===35||dn(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),h)}}const AV=["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"],ck=["pre","script","style","textarea"],NV={concrete:!0,name:"htmlFlow",resolveTo:DV,tokenize:IV},kV={partial:!0,tokenize:LV},RV={partial:!0,tokenize:OV};function DV(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function IV(e,t,n){const a=this;let s,o,u,c,d;return h;function h(q){return p(q)}function p(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),m}function m(q){return q===33?(e.consume(q),b):q===47?(e.consume(q),o=!0,S):q===63?(e.consume(q),s=3,a.interrupt?t:O):Sr(q)?(e.consume(q),u=String.fromCharCode(q),g):n(q)}function b(q){return q===45?(e.consume(q),s=2,v):q===91?(e.consume(q),s=5,c=0,w):Sr(q)?(e.consume(q),s=4,a.interrupt?t:O):n(q)}function v(q){return q===45?(e.consume(q),a.interrupt?t:O):n(q)}function w(q){const W="CDATA[";return q===W.charCodeAt(c++)?(e.consume(q),c===W.length?a.interrupt?t:H:w):n(q)}function S(q){return Sr(q)?(e.consume(q),u=String.fromCharCode(q),g):n(q)}function g(q){if(q===null||q===47||q===62||dn(q)){const W=q===47,ae=u.toLowerCase();return!W&&!o&&ck.includes(ae)?(s=1,a.interrupt?t(q):H(q)):AV.includes(u.toLowerCase())?(s=6,W?(e.consume(q),y):a.interrupt?t(q):H(q)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(q):o?_(q):E(q))}return q===45||br(q)?(e.consume(q),u+=String.fromCharCode(q),g):n(q)}function y(q){return q===62?(e.consume(q),a.interrupt?t:H):n(q)}function _(q){return Ut(q)?(e.consume(q),_):M(q)}function E(q){return q===47?(e.consume(q),M):q===58||q===95||Sr(q)?(e.consume(q),T):Ut(q)?(e.consume(q),E):M(q)}function T(q){return q===45||q===46||q===58||q===95||br(q)?(e.consume(q),T):N(q)}function N(q){return q===61?(e.consume(q),k):Ut(q)?(e.consume(q),N):E(q)}function k(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),d=q,L):Ut(q)?(e.consume(q),k):R(q)}function L(q){return q===d?(e.consume(q),d=null,j):q===null||mt(q)?n(q):(e.consume(q),L)}function R(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||dn(q)?N(q):(e.consume(q),R)}function j(q){return q===47||q===62||Ut(q)?E(q):n(q)}function M(q){return q===62?(e.consume(q),B):n(q)}function B(q){return q===null||mt(q)?H(q):Ut(q)?(e.consume(q),B):n(q)}function H(q){return q===45&&s===2?(e.consume(q),U):q===60&&s===1?(e.consume(q),J):q===62&&s===4?(e.consume(q),V):q===63&&s===3?(e.consume(q),O):q===93&&s===5?(e.consume(q),F):mt(q)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(kV,te,P)(q)):q===null||mt(q)?(e.exit("htmlFlowData"),P(q)):(e.consume(q),H)}function P(q){return e.check(RV,$,te)(q)}function $(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),ee}function ee(q){return q===null||mt(q)?P(q):(e.enter("htmlFlowData"),H(q))}function U(q){return q===45?(e.consume(q),O):H(q)}function J(q){return q===47?(e.consume(q),u="",X):H(q)}function X(q){if(q===62){const W=u.toLowerCase();return ck.includes(W)?(e.consume(q),V):H(q)}return Sr(q)&&u.length<8?(e.consume(q),u+=String.fromCharCode(q),X):H(q)}function F(q){return q===93?(e.consume(q),O):H(q)}function O(q){return q===62?(e.consume(q),V):q===45&&s===2?(e.consume(q),O):H(q)}function V(q){return q===null||mt(q)?(e.exit("htmlFlowData"),te(q)):(e.consume(q),V)}function te(q){return e.exit("htmlFlow"),t(q)}}function OV(e,t,n){const a=this;return s;function s(u){return mt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}function LV(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Id,t,n)}}const jV={name:"htmlText",tokenize:MV};function MV(e,t,n){const a=this;let s,o,u;return c;function c(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),h):O===47?(e.consume(O),N):O===63?(e.consume(O),E):Sr(O)?(e.consume(O),R):n(O)}function h(O){return O===45?(e.consume(O),p):O===91?(e.consume(O),o=0,w):Sr(O)?(e.consume(O),_):n(O)}function p(O){return O===45?(e.consume(O),v):n(O)}function m(O){return O===null?n(O):O===45?(e.consume(O),b):mt(O)?(u=m,J(O)):(e.consume(O),m)}function b(O){return O===45?(e.consume(O),v):m(O)}function v(O){return O===62?U(O):O===45?b(O):m(O)}function w(O){const V="CDATA[";return O===V.charCodeAt(o++)?(e.consume(O),o===V.length?S:w):n(O)}function S(O){return O===null?n(O):O===93?(e.consume(O),g):mt(O)?(u=S,J(O)):(e.consume(O),S)}function g(O){return O===93?(e.consume(O),y):S(O)}function y(O){return O===62?U(O):O===93?(e.consume(O),y):S(O)}function _(O){return O===null||O===62?U(O):mt(O)?(u=_,J(O)):(e.consume(O),_)}function E(O){return O===null?n(O):O===63?(e.consume(O),T):mt(O)?(u=E,J(O)):(e.consume(O),E)}function T(O){return O===62?U(O):E(O)}function N(O){return Sr(O)?(e.consume(O),k):n(O)}function k(O){return O===45||br(O)?(e.consume(O),k):L(O)}function L(O){return mt(O)?(u=L,J(O)):Ut(O)?(e.consume(O),L):U(O)}function R(O){return O===45||br(O)?(e.consume(O),R):O===47||O===62||dn(O)?j(O):n(O)}function j(O){return O===47?(e.consume(O),U):O===58||O===95||Sr(O)?(e.consume(O),M):mt(O)?(u=j,J(O)):Ut(O)?(e.consume(O),j):U(O)}function M(O){return O===45||O===46||O===58||O===95||br(O)?(e.consume(O),M):B(O)}function B(O){return O===61?(e.consume(O),H):mt(O)?(u=B,J(O)):Ut(O)?(e.consume(O),B):j(O)}function H(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),s=O,P):mt(O)?(u=H,J(O)):Ut(O)?(e.consume(O),H):(e.consume(O),$)}function P(O){return O===s?(e.consume(O),s=void 0,ee):O===null?n(O):mt(O)?(u=P,J(O)):(e.consume(O),P)}function $(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||dn(O)?j(O):(e.consume(O),$)}function ee(O){return O===47||O===62||dn(O)?j(O):n(O)}function U(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function J(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),X}function X(O){return Ut(O)?qt(e,F,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):F(O)}function F(O){return e.enter("htmlTextData"),u(O)}}const Ry={name:"labelEnd",resolveAll:UV,resolveTo:HV,tokenize:$V},FV={tokenize:zV},PV={tokenize:GV},BV={tokenize:qV};function UV(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&ra(e,0,e.length,n),e}function HV(e,t){let n=e.length,a=0,s,o,u,c;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(u=n);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[u-2][1].start}};return c=[["enter",d,t],["enter",h,t]],c=fa(c,e.slice(o+1,o+a+3)),c=fa(c,[["enter",p,t]]),c=fa(c,vm(t.parser.constructs.insideSpan.null,e.slice(o+a+4,u-3),t)),c=fa(c,[["exit",p,t],e[u-2],e[u-1],["exit",h,t]]),c=fa(c,e.slice(u+1)),c=fa(c,[["exit",d,t]]),ra(e,o,e.length,c),e}function $V(e,t,n){const a=this;let s=a.events.length,o,u;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return c;function c(b){return o?o._inactive?m(b):(u=a.parser.defined.includes(Ra(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):n(b)}function d(b){return b===40?e.attempt(FV,p,u?p:m)(b):b===91?e.attempt(PV,p,u?h:m)(b):u?p(b):m(b)}function h(b){return e.attempt(BV,p,m)(b)}function p(b){return t(b)}function m(b){return o._balanced=!0,n(b)}}function zV(e,t,n){return a;function a(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return dn(m)?Gu(e,o)(m):o(m)}function o(m){return m===41?p(m):kL(e,u,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return dn(m)?Gu(e,d)(m):p(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?DL(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function h(m){return dn(m)?Gu(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function GV(e,t,n){const a=this;return s;function s(c){return RL.call(a,e,o,u,"reference","referenceMarker","referenceString")(c)}function o(c){return a.parser.defined.includes(Ra(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function u(c){return n(c)}}function qV(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const WV={name:"labelStartImage",resolveAll:Ry.resolveAll,tokenize:VV};function VV(e,t,n){const a=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),u):n(c)}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const YV={name:"labelStartLink",resolveAll:Ry.resolveAll,tokenize:KV};function KV(e,t,n){const a=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):t(u)}}const O0={name:"lineEnding",tokenize:XV};function XV(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),qt(e,t,"linePrefix")}}const Zf={name:"thematicBreak",tokenize:ZV};function ZV(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,c(h)}function c(h){return h===s?(e.enter("thematicBreakSequence"),d(h)):a>=3&&(h===null||mt(h))?(e.exit("thematicBreak"),t(h)):n(h)}function d(h){return h===s?(e.consume(h),a++,d):(e.exit("thematicBreakSequence"),Ut(h)?qt(e,c,"whitespace")(h):c(h))}}const Pr={continuation:{tokenize:tY},exit:rY,name:"list",tokenize:eY},QV={partial:!0,tokenize:aY},JV={partial:!0,tokenize:nY};function eY(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return c;function c(v){const w=a.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!a.containerState.marker||v===a.containerState.marker:Wx(v)){if(a.containerState.type||(a.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Zf,n,h)(v):h(v);if(!a.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return n(v)}function d(v){return Wx(v)&&++u<10?(e.consume(v),d):(!a.interrupt||u<2)&&(a.containerState.marker?v===a.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),h(v)):n(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||v,e.check(Id,a.interrupt?n:p,e.attempt(QV,b,m))}function p(v){return a.containerState.initialBlankLine=!0,o++,b(v)}function m(v){return Ut(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):n(v)}function b(v){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function tY(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Id,s,o);function s(c){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,qt(e,t,"listItemIndent",a.containerState.size+1)(c)}function o(c){return a.containerState.furtherBlankLines||!Ut(c)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,u(c)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(JV,t,u)(c))}function u(c){return a.containerState._closeFlow=!0,a.interrupt=void 0,qt(e,e.attempt(Pr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nY(e,t,n){const a=this;return qt(e,s,"listItemIndent",a.containerState.size+1);function s(o){const u=a.events[a.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===a.containerState.size?t(o):n(o)}}function rY(e){e.exit(this.containerState.type)}function aY(e,t,n){const a=this;return qt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const u=a.events[a.events.length-1];return!Ut(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const uk={name:"setextUnderline",resolveTo:sY,tokenize:iY};function sY(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",u,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=u,e.push(["exit",u,t]),e}function iY(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,m;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){m=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||m)?(e.enter("setextHeadingLine"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ut(h)?qt(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||mt(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const oY={tokenize:lY};function lY(e){const t=this,n=e.attempt(Id,a,e.attempt(this.parser.constructs.flowInitial,s,qt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(fV,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cY={resolveAll:OL()},uY=IL("string"),dY=IL("text");function IL(e){return{resolveAll:OL(e==="text"?hY:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,u,c);return u;function u(p){return h(p)?o(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),d)}function h(p){if(p===null)return!0;const m=s[p];let b=-1;if(m)for(;++b<m.length;){const v=m[b];if(!v.previous||v.previous.call(a,a.previous))return!0}return!1}}}function OL(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function hY(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,u=-1,c=0,d;for(;o--;){const h=s[o];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)c++,u--;if(u)break;u=-1}else if(h===-2)d=!0,c++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const h={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:a.start._bufferIndex+u,_index:a.start._index+o,line:a.end.line,column:a.end.column-c,offset:a.end.offset-c},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const fY={42:Pr,43:Pr,45:Pr,48:Pr,49:Pr,50:Pr,51:Pr,52:Pr,53:Pr,54:Pr,55:Pr,56:Pr,57:Pr,62:CL},pY={91:xV},mY={[-2]:I0,[-1]:I0,32:I0},gY={35:wV,42:Zf,45:[uk,Zf],60:NV,61:uk,95:Zf,96:lk,126:lk},bY={38:AL,92:TL},xY={[-5]:O0,[-4]:O0,[-3]:O0,33:WV,38:AL,42:Vx,60:[YW,jV],91:YV,92:[_V,TL],93:Ry,95:Vx,96:oV},vY={null:[Vx,cY]},yY={null:[42,95]},EY={null:[]},_Y=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:yY,contentInitial:pY,disable:EY,document:fY,flow:gY,flowInitial:mY,insideSpan:vY,string:bY,text:xY},Symbol.toStringTag,{value:"Module"}));function SY(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let u=[],c=[];const d={attempt:L(N),check:L(k),consume:_,enter:E,exit:T,interrupt:L(k,{interrupt:!0})},h={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:m};let p=t.tokenize.call(h,d);return t.resolveAll&&o.push(t),h;function m(B){return u=fa(u,B),g(),u[u.length-1]!==null?[]:(R(t,0),h.events=vm(o,h.events,h),h.events)}function b(B,H){return CY(v(B),H)}function v(B){return wY(u,B)}function w(){const{_bufferIndex:B,_index:H,line:P,column:$,offset:ee}=a;return{_bufferIndex:B,_index:H,line:P,column:$,offset:ee}}function S(B){s[B.line]=B.column,M()}function g(){let B;for(;a._index<u.length;){const H=u[a._index];if(typeof H=="string")for(B=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===B&&a._bufferIndex<H.length;)y(H.charCodeAt(a._bufferIndex));else y(H)}}function y(B){p=p(B)}function _(B){mt(B)?(a.line++,a.column=1,a.offset+=B===-3?2:1,M()):B!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===u[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=B}function E(B,H){const P=H||{};return P.type=B,P.start=w(),h.events.push(["enter",P,h]),c.push(P),P}function T(B){const H=c.pop();return H.end=w(),h.events.push(["exit",H,h]),H}function N(B,H){R(B,H.from)}function k(B,H){H.restore()}function L(B,H){return P;function P($,ee,U){let J,X,F,O;return Array.isArray($)?te($):"tokenize"in $?te([$]):V($);function V(ne){return K;function K(G){const Y=G!==null&&ne[G],oe=G!==null&&ne.null,ie=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return te(ie)(G)}}function te(ne){return J=ne,X=0,ne.length===0?U:q(ne[X])}function q(ne){return K;function K(G){return O=j(),F=ne,ne.partial||(h.currentConstruct=ne),ne.name&&h.parser.constructs.disable.null.includes(ne.name)?ae():ne.tokenize.call(H?Object.assign(Object.create(h),H):h,d,W,ae)(G)}}function W(ne){return B(F,O),ee}function ae(ne){return O.restore(),++X<J.length?q(J[X]):U}}}function R(B,H){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&ra(h.events,H,h.events.length-H,B.resolve(h.events.slice(H),h)),B.resolveTo&&(h.events=B.resolveTo(h.events,h))}function j(){const B=w(),H=h.previous,P=h.currentConstruct,$=h.events.length,ee=Array.from(c);return{from:$,restore:U};function U(){a=B,h.previous=H,h.currentConstruct=P,h.events.length=$,c=ee,M()}}function M(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function wY(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(a,o)];else{if(u=e.slice(n,s),a>-1){const c=u[0];typeof c=="string"?u[0]=c.slice(a):u.shift()}o>0&&u.push(e[s].slice(0,o))}return u}function CY(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
586
586
  `;break}case-3:{u=`\r
587
587
  `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(o)}s=o===-2,a.push(u)}return a.join("")}function TY(e){const a={constructs:SL([_Y,...(e||{}).extensions||[]]),content:s(HW),defined:[],document:s(zW),flow:s(oY),lazy:{},string:s(uY),text:s(dY)};return a;function s(o){return u;function u(c){return SY(a,o,c)}}}function AY(e){for(;!NL(e););return e}const dk=/[\0\t\n\r]/g;function NY(){let e=1,t="",n=!0,a;return s;function s(o,u,c){const d=[];let h,p,m,b,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),m=0,t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(dk.lastIndex=m,h=dk.exec(o),b=h&&h.index!==void 0?h.index:o.length,v=o.charCodeAt(b),!h){t=o.slice(m);break}if(v===10&&m===b&&a)d.push(-3),a=void 0;else switch(a&&(d.push(-5),a=void 0),m<b&&(d.push(o.slice(m,b)),e+=b-m),v){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:a=!0,e=1}m=b+1}return c&&(a&&d.push(-5),t&&d.push(t),d.push(null)),d}}const kY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RY(e){return e.replace(kY,DY)}function DY(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return wL(n.slice(o?2:1),o?16:10)}return ud(n)||e}const LL={}.hasOwnProperty;function IY(e,t,n){return typeof t!="string"&&(n=t,t=void 0),OY(n)(AY(TY(n).document().write(NY()(e,t,!0))))}function OY(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(kt),autolinkProtocol:j,autolinkEmail:j,atxHeading:o(Ve),blockQuote:o(oe),characterEscape:j,characterReference:j,codeFenced:o(ie),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(ie,u),codeText:o(de,u),codeTextData:j,data:j,codeFlowValue:j,definition:o(Te),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(Ce),hardBreakEscape:o(nt),hardBreakTrailing:o(nt),htmlFlow:o(Ie,u),htmlFlowData:j,htmlText:o(Ie,u),htmlTextData:j,image:o($t),label:u,link:o(kt),listItem:o(nn),listItemValue:b,listOrdered:o(St,m),listUnordered:o(St),paragraph:o(Mt),reference:q,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(Ve),strong:o(wt),thematicBreak:o(Ae)},exit:{atxHeading:d(),atxHeadingSequence:N,autolink:d(),autolinkEmail:Y,autolinkProtocol:G,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:ne,characterReference:K,codeFenced:d(g),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:w,codeFlowValue:M,codeIndented:d(y),codeText:d(ee),codeTextData:M,data:M,definition:d(),definitionDestinationString:T,definitionLabelString:_,definitionTitleString:E,emphasis:d(),hardBreakEscape:d(H),hardBreakTrailing:d(H),htmlFlow:d(P),htmlFlowData:M,htmlText:d($),htmlTextData:M,image:d(J),label:F,labelText:X,lineEnding:B,link:d(U),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:W,resourceDestinationString:O,resourceTitleString:V,resource:te,setextHeading:d(R),setextHeadingLineSequence:L,setextHeadingText:k,strong:d(),thematicBreak:d()}};jL(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(fe){let _e={type:"root",children:[]};const Pe={stack:[_e],tokenStack:[],config:t,enter:c,exit:h,buffer:u,resume:p,data:n},Qe=[];let ut=-1;for(;++ut<fe.length;)if(fe[ut][1].type==="listOrdered"||fe[ut][1].type==="listUnordered")if(fe[ut][0]==="enter")Qe.push(ut);else{const Wt=Qe.pop();ut=s(fe,Wt,ut)}for(ut=-1;++ut<fe.length;){const Wt=t[fe[ut][0]];LL.call(Wt,fe[ut][1].type)&&Wt[fe[ut][1].type].call(Object.assign({sliceSerialize:fe[ut][2].sliceSerialize},Pe),fe[ut][1])}if(Pe.tokenStack.length>0){const Wt=Pe.tokenStack[Pe.tokenStack.length-1];(Wt[1]||hk).call(Pe,void 0,Wt[0])}for(_e.position={start:pi(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:pi(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},ut=-1;++ut<t.transforms.length;)_e=t.transforms[ut](_e)||_e;return _e}function s(fe,_e,Pe){let Qe=_e-1,ut=-1,Wt=!1,ht,on,On,Ue;for(;++Qe<=Pe;){const Xe=fe[Qe];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?ut++:ut--,Ue=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(ht&&!Ue&&!ut&&!On&&(On=Qe),Ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ue=void 0}if(!ut&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||ut===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(ht){let yt=Qe;for(on=void 0;yt--;){const ft=fe[yt];if(ft[1].type==="lineEnding"||ft[1].type==="lineEndingBlank"){if(ft[0]==="exit")continue;on&&(fe[on][1].type="lineEndingBlank",Wt=!0),ft[1].type="lineEnding",on=yt}else if(!(ft[1].type==="linePrefix"||ft[1].type==="blockQuotePrefix"||ft[1].type==="blockQuotePrefixWhitespace"||ft[1].type==="blockQuoteMarker"||ft[1].type==="listItemIndent"))break}On&&(!on||On<on)&&(ht._spread=!0),ht.end=Object.assign({},on?fe[on][1].start:Xe[1].end),fe.splice(on||Qe,0,["exit",ht,Xe[2]]),Qe++,Pe++}if(Xe[1].type==="listItemPrefix"){const yt={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};ht=yt,fe.splice(Qe,0,["enter",yt,Xe[2]]),Qe++,Pe++,On=void 0,Ue=!0}}}return fe[_e][1]._spread=Wt,Pe}function o(fe,_e){return Pe;function Pe(Qe){c.call(this,fe(Qe),Qe),_e&&_e.call(this,Qe)}}function u(){this.stack.push({type:"fragment",children:[]})}function c(fe,_e,Pe){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([_e,Pe||void 0]),fe.position={start:pi(_e.start),end:void 0}}function d(fe){return _e;function _e(Pe){fe&&fe.call(this,Pe),h.call(this,Pe)}}function h(fe,_e){const Pe=this.stack.pop(),Qe=this.tokenStack.pop();if(Qe)Qe[0].type!==fe.type&&(_e?_e.call(this,fe,Qe[0]):(Qe[1]||hk).call(this,fe,Qe[0]));else throw new Error("Cannot close `"+fe.type+"` ("+zu({start:fe.start,end:fe.end})+"): it’s not open");Pe.position.end=pi(fe.end)}function p(){return ky(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function b(fe){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=fe}function w(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=fe}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe.replace(/(\r?\n|\r)$/g,"")}function _(fe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Ra(this.sliceSerialize(fe)).toLowerCase()}function E(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function T(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function N(fe){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Pe=this.sliceSerialize(fe).length;_e.depth=Pe}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function L(fe){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function j(fe){const Pe=this.stack[this.stack.length-1].children;let Qe=Pe[Pe.length-1];(!Qe||Qe.type!=="text")&&(Qe=gn(),Qe.position={start:pi(fe.start),end:void 0},Pe.push(Qe)),this.stack.push(Qe)}function M(fe){const _e=this.stack.pop();_e.value+=this.sliceSerialize(fe),_e.position.end=pi(fe.end)}function B(fe){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=_e.children[_e.children.length-1];Pe.position.end=pi(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(j.call(this,fe),M.call(this,fe))}function H(){this.data.atHardBreak=!0}function P(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function $(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function ee(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.value=fe}function U(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function J(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=_e,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function X(fe){const _e=this.sliceSerialize(fe),Pe=this.stack[this.stack.length-2];Pe.label=RY(_e),Pe.identifier=Ra(_e).toLowerCase()}function F(){const fe=this.stack[this.stack.length-1],_e=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Qe=fe.children;Pe.children=Qe}else Pe.alt=_e}function O(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.url=fe}function V(){const fe=this.resume(),_e=this.stack[this.stack.length-1];_e.title=fe}function te(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function W(fe){const _e=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=_e,Pe.identifier=Ra(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function ae(fe){this.data.characterReferenceType=fe.type}function ne(fe){const _e=this.sliceSerialize(fe),Pe=this.data.characterReferenceType;let Qe;Pe?(Qe=wL(_e,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Qe=ud(_e);const ut=this.stack[this.stack.length-1];ut.value+=Qe}function K(fe){const _e=this.stack.pop();_e.position.end=pi(fe.end)}function G(fe){M.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(fe)}function Y(fe){M.call(this,fe);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(fe)}function oe(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function Ve(){return{type:"heading",depth:0,children:[]}}function nt(){return{type:"break"}}function Ie(){return{type:"html",value:""}}function $t(){return{type:"image",title:null,url:"",alt:null}}function kt(){return{type:"link",title:null,url:"",children:[]}}function St(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function nn(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Mt(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function gn(){return{type:"text",value:""}}function Ae(){return{type:"thematicBreak"}}}function pi(e){return{line:e.line,column:e.column,offset:e.offset}}function jL(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?jL(e,a):LY(e,a)}}function LY(e,t){let n;for(n in t)if(LL.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function hk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+zu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+zu({start:t.start,end:t.end})+") is still open")}function ML(e){const t=this;t.parser=n;function n(a){return IY(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function jY(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function MY(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -846,7 +846,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
846
846
  `,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(d||(c.C0=d={})),(function(m){m.PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ"})(h||(c.C1=h={})),(function(m){m.ST=`${d.ESC}\\`})(p||(c.C1_ESCAPED=p={}))},7399:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const h=d(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};c.evaluateKeyboardEvent=function(m,b,v,w){const S={type:0,cancel:!1,key:void 0},g=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?S.key=b?h.C0.ESC+"OA":h.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?S.key=b?h.C0.ESC+"OD":h.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?S.key=b?h.C0.ESC+"OC":h.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(S.key=b?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:S.key=m.ctrlKey?"\b":h.C0.DEL,m.altKey&&(S.key=h.C0.ESC+S.key);break;case 9:if(m.shiftKey){S.key=h.C0.ESC+"[Z";break}S.key=h.C0.HT,S.cancel=!0;break;case 13:S.key=m.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,S.cancel=!0;break;case 27:S.key=h.C0.ESC,m.altKey&&(S.key=h.C0.ESC+h.C0.ESC),S.cancel=!0;break;case 37:if(m.metaKey)break;g?(S.key=h.C0.ESC+"[1;"+(g+1)+"D",S.key===h.C0.ESC+"[1;3D"&&(S.key=h.C0.ESC+(v?"b":"[1;5D"))):S.key=b?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(m.metaKey)break;g?(S.key=h.C0.ESC+"[1;"+(g+1)+"C",S.key===h.C0.ESC+"[1;3C"&&(S.key=h.C0.ESC+(v?"f":"[1;5C"))):S.key=b?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(m.metaKey)break;g?(S.key=h.C0.ESC+"[1;"+(g+1)+"A",v||S.key!==h.C0.ESC+"[1;3A"||(S.key=h.C0.ESC+"[1;5A")):S.key=b?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(m.metaKey)break;g?(S.key=h.C0.ESC+"[1;"+(g+1)+"B",v||S.key!==h.C0.ESC+"[1;3B"||(S.key=h.C0.ESC+"[1;5B")):S.key=b?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(S.key=h.C0.ESC+"[2~");break;case 46:S.key=g?h.C0.ESC+"[3;"+(g+1)+"~":h.C0.ESC+"[3~";break;case 36:S.key=g?h.C0.ESC+"[1;"+(g+1)+"H":b?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:S.key=g?h.C0.ESC+"[1;"+(g+1)+"F":b?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:m.shiftKey?S.type=2:m.ctrlKey?S.key=h.C0.ESC+"[5;"+(g+1)+"~":S.key=h.C0.ESC+"[5~";break;case 34:m.shiftKey?S.type=3:m.ctrlKey?S.key=h.C0.ESC+"[6;"+(g+1)+"~":S.key=h.C0.ESC+"[6~";break;case 112:S.key=g?h.C0.ESC+"[1;"+(g+1)+"P":h.C0.ESC+"OP";break;case 113:S.key=g?h.C0.ESC+"[1;"+(g+1)+"Q":h.C0.ESC+"OQ";break;case 114:S.key=g?h.C0.ESC+"[1;"+(g+1)+"R":h.C0.ESC+"OR";break;case 115:S.key=g?h.C0.ESC+"[1;"+(g+1)+"S":h.C0.ESC+"OS";break;case 116:S.key=g?h.C0.ESC+"[15;"+(g+1)+"~":h.C0.ESC+"[15~";break;case 117:S.key=g?h.C0.ESC+"[17;"+(g+1)+"~":h.C0.ESC+"[17~";break;case 118:S.key=g?h.C0.ESC+"[18;"+(g+1)+"~":h.C0.ESC+"[18~";break;case 119:S.key=g?h.C0.ESC+"[19;"+(g+1)+"~":h.C0.ESC+"[19~";break;case 120:S.key=g?h.C0.ESC+"[20;"+(g+1)+"~":h.C0.ESC+"[20~";break;case 121:S.key=g?h.C0.ESC+"[21;"+(g+1)+"~":h.C0.ESC+"[21~";break;case 122:S.key=g?h.C0.ESC+"[23;"+(g+1)+"~":h.C0.ESC+"[23~";break;case 123:S.key=g?h.C0.ESC+"[24;"+(g+1)+"~":h.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(v&&!w||!m.altKey||m.metaKey)!v||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?S.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(S.key=h.C0.US),m.key==="@"&&(S.key=h.C0.NUL)):m.keyCode===65&&(S.type=1);else{const y=p[m.keyCode],_=y?.[m.shiftKey?1:0];if(_)S.key=h.C0.ESC+_;else if(m.keyCode>=65&&m.keyCode<=90){const E=m.ctrlKey?m.keyCode-64:m.keyCode+32;let T=String.fromCharCode(E);m.shiftKey&&(T=T.toUpperCase()),S.key=h.C0.ESC+T}else if(m.keyCode===32)S.key=h.C0.ESC+(m.ctrlKey?h.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let E=m.code.slice(3,4);m.shiftKey||(E=E.toLowerCase()),S.key=h.C0.ESC+E,S.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?S.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?S.key=h.C0.NUL:m.keyCode>=51&&m.keyCode<=55?S.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?S.key=h.C0.DEL:m.keyCode===219?S.key=h.C0.ESC:m.keyCode===220?S.key=h.C0.FS:m.keyCode===221&&(S.key=h.C0.GS)}return S}},482:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},c.utf32ToString=function(d,h=0,p=d.length){let m="";for(let b=h;b<p;++b){let v=d[b];v>65535?(v-=65536,m+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):m+=String.fromCharCode(v)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,h){const p=d.length;if(!p)return 0;let m=0,b=0;if(this._interim){const v=d.charCodeAt(b++);56320<=v&&v<=57343?h[m++]=1024*(this._interim-55296)+v-56320+65536:(h[m++]=this._interim,h[m++]=v),this._interim=0}for(let v=b;v<p;++v){const w=d.charCodeAt(v);if(55296<=w&&w<=56319){if(++v>=p)return this._interim=w,m;const S=d.charCodeAt(v);56320<=S&&S<=57343?h[m++]=1024*(w-55296)+S-56320+65536:(h[m++]=w,h[m++]=S)}else w!==65279&&(h[m++]=w)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,h){const p=d.length;if(!p)return 0;let m,b,v,w,S=0,g=0,y=0;if(this.interim[0]){let T=!1,N=this.interim[0];N&=(224&N)==192?31:(240&N)==224?15:7;let k,L=0;for(;(k=63&this.interim[++L])&&L<4;)N<<=6,N|=k;const R=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,j=R-L;for(;y<j;){if(y>=p)return 0;if(k=d[y++],(192&k)!=128){y--,T=!0;break}this.interim[L++]=k,N<<=6,N|=63&k}T||(R===2?N<128?y--:h[S++]=N:R===3?N<2048||N>=55296&&N<=57343||N===65279||(h[S++]=N):N<65536||N>1114111||(h[S++]=N)),this.interim.fill(0)}const _=p-4;let E=y;for(;E<p;){for(;!(!(E<_)||128&(m=d[E])||128&(b=d[E+1])||128&(v=d[E+2])||128&(w=d[E+3]));)h[S++]=m,h[S++]=b,h[S++]=v,h[S++]=w,E+=4;if(m=d[E++],m<128)h[S++]=m;else if((224&m)==192){if(E>=p)return this.interim[0]=m,S;if(b=d[E++],(192&b)!=128){E--;continue}if(g=(31&m)<<6|63&b,g<128){E--;continue}h[S++]=g}else if((240&m)==224){if(E>=p)return this.interim[0]=m,S;if(b=d[E++],(192&b)!=128){E--;continue}if(E>=p)return this.interim[0]=m,this.interim[1]=b,S;if(v=d[E++],(192&v)!=128){E--;continue}if(g=(15&m)<<12|(63&b)<<6|63&v,g<2048||g>=55296&&g<=57343||g===65279)continue;h[S++]=g}else if((248&m)==240){if(E>=p)return this.interim[0]=m,S;if(b=d[E++],(192&b)!=128){E--;continue}if(E>=p)return this.interim[0]=m,this.interim[1]=b,S;if(v=d[E++],(192&v)!=128){E--;continue}if(E>=p)return this.interim[0]=m,this.interim[1]=b,this.interim[2]=v,S;if(w=d[E++],(192&w)!=128){E--;continue}if(g=(7&m)<<18|(63&b)<<12|(63&v)<<6|63&w,g<65536||g>1114111)continue;h[S++]=g}}return S}}},225:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const h=d(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let b;c.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let v=0;v<p.length;++v)b.fill(0,p[v][0],p[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?b[v]:(function(w,S){let g,y=0,_=S.length-1;if(w<S[0][0]||w>S[_][1])return!1;for(;_>=y;)if(g=y+_>>1,w>S[g][1])y=g+1;else{if(!(w<S[g][0]))return!0;_=g-1}return!1})(v,m)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let S=this.wcwidth(v),g=S===0&&w!==0;if(g){const y=h.UnicodeService.extractWidth(w);y===0?g=!1:y>S&&(S=y)}return h.UnicodeService.createPropertyValue(0,S,g)}}},5981:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const h=d(8460),p=d(844);class m extends p.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const S=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],y=this._action(g,w);if(y){const E=T=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,T))):this._innerWrite(S,T);return void y.catch((T=>(queueMicrotask((()=>{throw T})),Promise.resolve(!1)))).then(E)}const _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}c.WriteBuffer=m},5941:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function p(m,b){const v=m.toString(16),w=v.length<2?"0"+v:v;switch(b){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}c.parseColor=function(m){if(!m)return;let b=m.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const v=d.exec(b);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),h.exec(b)&&[3,6,9,12].includes(b.length))){const v=b.length/3,w=[0,0,0];for(let S=0;S<3;++S){const g=parseInt(b.slice(v*S,v*S+v),16);w[S]=v===1?g<<4:v===2?g:v===3?g>>4:g>>8}return w}},c.toRgbString=function(m,b=16){const[v,w,S]=m;return`rgb:${p(v,b)}/${p(w,b)}/${p(S,b)}`}},5770:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const h=d(482),p=d(8742),m=d(5770),b=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(w,S){this._handlers[w]===void 0&&(this._handlers[w]=[]);const g=this._handlers[w];return g.push(S),{dispose:()=>{const y=g.indexOf(S);y!==-1&&g.splice(y,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(w,S){if(this.reset(),this._ident=w,this._active=this._handlers[w]||b,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(w,S,g){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(w,S,g);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(w,S,g))}unhook(w,S=!0){if(this._active.length){let g=!1,y=this._active.length-1,_=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,g=S,_=this._stack.fallThrough,this._stack.paused=!1),!_&&g===!1){for(;y>=0&&(g=this._active[y].unhook(w),g!==!0);y--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,g;y--}for(;y>=0;y--)if(g=this._active[y].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",w);this._active=b,this._ident=0}};const v=new p.Params;v.addParam(0),c.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,S,g){this._hitLimit||(this._data+=(0,h.utf32ToString)(w,S,g),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let S=!1;if(this._hitLimit)S=!1;else if(w&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((g=>(this._params=v,this._data="",this._hitLimit=!1,g)));return this._params=v,this._data="",this._hitLimit=!1,S}}},2015:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const h=d(844),p=d(8742),m=d(6242),b=d(6351);class v{constructor(y){this.table=new Uint8Array(y)}setDefault(y,_){this.table.fill(y<<4|_)}add(y,_,E,T){this.table[_<<8|y]=E<<4|T}addMany(y,_,E,T){for(let N=0;N<y.length;N++)this.table[_<<8|y[N]]=E<<4|T}}c.TransitionTable=v;const w=160;c.VT500_TRANSITION_TABLE=(function(){const g=new v(4095),y=Array.apply(null,Array(256)).map(((L,R)=>R)),_=(L,R)=>y.slice(L,R),E=_(32,127),T=_(0,24);T.push(25),T.push.apply(T,_(28,32));const N=_(0,14);let k;for(k in g.setDefault(1,0),g.addMany(E,0,2,0),N)g.addMany([24,26,153,154],k,3,0),g.addMany(_(128,144),k,3,0),g.addMany(_(144,152),k,3,0),g.add(156,k,0,0),g.add(27,k,11,1),g.add(157,k,4,8),g.addMany([152,158,159],k,0,7),g.add(155,k,11,3),g.add(144,k,11,9);return g.addMany(T,0,3,0),g.addMany(T,1,3,1),g.add(127,1,0,1),g.addMany(T,8,0,8),g.addMany(T,3,3,3),g.add(127,3,0,3),g.addMany(T,4,3,4),g.add(127,4,0,4),g.addMany(T,6,3,6),g.addMany(T,5,3,5),g.add(127,5,0,5),g.addMany(T,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(E,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(_(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(E,7,0,7),g.addMany(T,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(_(64,127),3,7,0),g.addMany(_(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(_(48,60),4,8,4),g.addMany(_(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(_(32,64),6,0,6),g.add(127,6,0,6),g.addMany(_(64,127),6,0,0),g.addMany(_(32,48),3,9,5),g.addMany(_(32,48),5,9,5),g.addMany(_(48,64),5,0,6),g.addMany(_(64,127),5,7,0),g.addMany(_(32,48),4,9,5),g.addMany(_(32,48),1,9,2),g.addMany(_(32,48),2,9,2),g.addMany(_(48,127),2,10,0),g.addMany(_(48,80),1,10,0),g.addMany(_(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(_(96,127),1,10,0),g.add(80,1,11,9),g.addMany(T,9,0,9),g.add(127,9,0,9),g.addMany(_(28,32),9,0,9),g.addMany(_(32,48),9,9,12),g.addMany(_(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(T,11,0,11),g.addMany(_(32,128),11,0,11),g.addMany(_(28,32),11,0,11),g.addMany(T,10,0,10),g.add(127,10,0,10),g.addMany(_(28,32),10,0,10),g.addMany(_(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(_(32,48),10,9,12),g.addMany(T,12,0,12),g.add(127,12,0,12),g.addMany(_(28,32),12,0,12),g.addMany(_(32,48),12,9,12),g.addMany(_(48,64),12,0,11),g.addMany(_(64,127),12,12,13),g.addMany(_(64,127),10,12,13),g.addMany(_(64,127),9,12,13),g.addMany(T,13,13,13),g.addMany(E,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(w,0,2,0),g.add(w,8,5,8),g.add(w,6,0,6),g.add(w,11,0,11),g.add(w,13,13,13),g})();class S extends h.Disposable{constructor(y=c.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(_,E,T)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,E)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,_=[64,126]){let E=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(E=y.prefix.charCodeAt(0),E&&60>E||E>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let N=0;N<y.intermediates.length;++N){const k=y.intermediates.charCodeAt(N);if(32>k||k>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");E<<=8,E|=k}}if(y.final.length!==1)throw new Error("final must be a single byte");const T=y.final.charCodeAt(0);if(_[0]>T||T>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return E<<=8,E|=T,E}identToString(y){const _=[];for(;y;)_.push(String.fromCharCode(255&y)),y>>=8;return _.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,_){const E=this._identifier(y,[48,126]);this._escHandlers[E]===void 0&&(this._escHandlers[E]=[]);const T=this._escHandlers[E];return T.push(_),{dispose:()=>{const N=T.indexOf(_);N!==-1&&T.splice(N,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,_){this._executeHandlers[y.charCodeAt(0)]=_}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,_){const E=this._identifier(y);this._csiHandlers[E]===void 0&&(this._csiHandlers[E]=[]);const T=this._csiHandlers[E];return T.push(_),{dispose:()=>{const N=T.indexOf(_);N!==-1&&T.splice(N,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,_){return this._dcsParser.registerHandler(this._identifier(y),_)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,_){return this._oscParser.registerHandler(y,_)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(y,_,E,T,N){this._parseStack.state=y,this._parseStack.handlers=_,this._parseStack.handlerPos=E,this._parseStack.transition=T,this._parseStack.chunkPos=N}parse(y,_,E){let T,N=0,k=0,L=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,L=this._parseStack.chunkPos+1;else{if(E===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const R=this._parseStack.handlers;let j=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(E===!1&&j>-1){for(;j>=0&&(T=R[j](this._params),T!==!0);j--)if(T instanceof Promise)return this._parseStack.handlerPos=j,T}this._parseStack.handlers=[];break;case 4:if(E===!1&&j>-1){for(;j>=0&&(T=R[j](),T!==!0);j--)if(T instanceof Promise)return this._parseStack.handlerPos=j,T}this._parseStack.handlers=[];break;case 6:if(N=y[this._parseStack.chunkPos],T=this._dcsParser.unhook(N!==24&&N!==26,E),T)return T;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(N=y[this._parseStack.chunkPos],T=this._oscParser.end(N!==24&&N!==26,E),T)return T;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,L=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let R=L;R<_;++R){switch(N=y[R],k=this._transitions.table[this.currentState<<8|(N<160?N:w)],k>>4){case 2:for(let P=R+1;;++P){if(P>=_||(N=y[P])<32||N>126&&N<w){this._printHandler(y,R,P),R=P-1;break}if(++P>=_||(N=y[P])<32||N>126&&N<w){this._printHandler(y,R,P),R=P-1;break}if(++P>=_||(N=y[P])<32||N>126&&N<w){this._printHandler(y,R,P),R=P-1;break}if(++P>=_||(N=y[P])<32||N>126&&N<w){this._printHandler(y,R,P),R=P-1;break}}break;case 3:this._executeHandlers[N]?this._executeHandlers[N]():this._executeHandlerFb(N),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:R,code:N,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const j=this._csiHandlers[this._collect<<8|N];let M=j?j.length-1:-1;for(;M>=0&&(T=j[M](this._params),T!==!0);M--)if(T instanceof Promise)return this._preserveStack(3,j,M,k,R),T;M<0&&this._csiHandlerFb(this._collect<<8|N,this._params),this.precedingJoinState=0;break;case 8:do switch(N){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(N-48)}while(++R<_&&(N=y[R])>47&&N<60);R--;break;case 9:this._collect<<=8,this._collect|=N;break;case 10:const B=this._escHandlers[this._collect<<8|N];let H=B?B.length-1:-1;for(;H>=0&&(T=B[H](),T!==!0);H--)if(T instanceof Promise)return this._preserveStack(4,B,H,k,R),T;H<0&&this._escHandlerFb(this._collect<<8|N),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|N,this._params);break;case 13:for(let P=R+1;;++P)if(P>=_||(N=y[P])===24||N===26||N===27||N>127&&N<w){this._dcsParser.put(y,R,P),R=P-1;break}break;case 14:if(T=this._dcsParser.unhook(N!==24&&N!==26),T)return this._preserveStack(6,[],0,k,R),T;N===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let P=R+1;;P++)if(P>=_||(N=y[P])<32||N>127&&N<w){this._oscParser.put(y,R,P),R=P-1;break}break;case 6:if(T=this._oscParser.end(N!==24&&N!==26),T)return this._preserveStack(5,[],0,k,R),T;N===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&k}}}c.EscapeSequenceParser=S},6242:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const h=d(5770),p=d(482),m=[];c.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,v){this._handlers[b]===void 0&&(this._handlers[b]=[]);const w=this._handlers[b];return w.push(v),{dispose:()=>{const S=w.indexOf(v);S!==-1&&w.splice(S,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,v,w){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(b,v,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(b,v,w))}start(){this.reset(),this._state=1}put(b,v,w){if(this._state!==3){if(this._state===1)for(;v<w;){const S=b[v++];if(S===59){this._state=2,this._start();break}if(S<48||57<S)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+S-48}this._state===2&&w-v>0&&this._put(b,v,w)}}end(b,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,S=this._active.length-1,g=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,w=v,g=this._stack.fallThrough,this._stack.paused=!1),!g&&w===!1){for(;S>=0&&(w=this._active[S].end(b),w!==!0);S--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,w;S--}for(;S>=0;S--)if(w=this._active[S].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",b);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,v,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(b,v,w),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let v=!1;if(this._hitLimit)v=!1;else if(b&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const d=2147483647;class h{static fromArray(m){const b=new h;if(!m.length)return b;for(let v=Array.isArray(m[0])?1:0;v<m.length;++v){const w=m[v];if(Array.isArray(w))for(let S=0;S<w.length;++S)b.addSubParam(w[S]);else b.addParam(w)}return b}constructor(m=32,b=32){if(this.maxLength=m,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new h(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let b=0;b<this.length;++b){m.push(this.params[b]);const v=this._subParamsIdx[b]>>8,w=255&this._subParamsIdx[b];w-v>0&&m.push(Array.prototype.slice.call(this._subParams,v,w))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>d?d:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>d?d:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const b=this._subParamsIdx[m]>>8,v=255&this._subParamsIdx[m];return v-b>0?this._subParams.subarray(b,v):null}getSubParamsAll(){const m={};for(let b=0;b<this.length;++b){const v=this._subParamsIdx[b]>>8,w=255&this._subParamsIdx[b];w-v>0&&(m[b]=this._subParams.slice(v,w))}return m}addDigit(m){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[b-1];v[b-1]=~w?Math.min(10*w+m,d):m}}c.Params=h},5741:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,h){const p={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(p),h.dispose=()=>this._wrappedAddonDispose(p),h.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let h=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===d){h=p;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(h,1)}}},8771:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const h=d(3785),p=d(511);c.BufferApiView=class{constructor(m,b){this._buffer=m,this.type=b}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const b=this._buffer.lines.get(m);if(b)return new h.BufferLineApiView(b)}getNullCell(){return new p.CellData}}},3785:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const h=d(511);c.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,m){if(!(p<0||p>=this._line.length))return m?(this._line.loadCell(p,m),m):this._line.loadCell(p,new h.CellData)}translateToString(p,m,b){return this._line.translateToString(p,m,b)}}},8285:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const h=d(8771),p=d(8460),m=d(844);class b extends m.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=b},7975:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,h){return this._core.registerCsiHandler(d,(p=>h(p.toArray())))}addCsiHandler(d,h){return this.registerCsiHandler(d,h)}registerDcsHandler(d,h){return this._core.registerDcsHandler(d,((p,m)=>h(p,m.toArray())))}addDcsHandler(d,h){return this.registerDcsHandler(d,h)}registerEscHandler(d,h){return this._core.registerEscHandler(d,h)}addEscHandler(d,h){return this.registerEscHandler(d,h)}registerOscHandler(d,h){return this._core.registerOscHandler(d,h)}addOscHandler(d,h){return this.registerOscHandler(d,h)}}},7090:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(u,c,d){var h=this&&this.__decorate||function(g,y,_,E){var T,N=arguments.length,k=N<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,_):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(g,y,_,E);else for(var L=g.length-1;L>=0;L--)(T=g[L])&&(k=(N<3?T(k):N>3?T(y,_,k):T(y,_))||k);return N>3&&k&&Object.defineProperty(y,_,k),k},p=this&&this.__param||function(g,y){return function(_,E){y(_,E,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),b=d(844),v=d(5295),w=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let S=c.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(g,this))}resize(g,y){this.cols=g,this.rows=y,this.buffers.resize(g,y),this._onResize.fire({cols:g,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,y=!1){const _=this.buffer;let E;E=this._cachedBlankLine,E&&E.length===this.cols&&E.getFg(0)===g.fg&&E.getBg(0)===g.bg||(E=_.getBlankLine(g,y),this._cachedBlankLine=E),E.isWrapped=y;const T=_.ybase+_.scrollTop,N=_.ybase+_.scrollBottom;if(_.scrollTop===0){const k=_.lines.isFull;N===_.lines.length-1?k?_.lines.recycle().copyFrom(E):_.lines.push(E.clone()):_.lines.splice(N+1,0,E.clone()),k?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const k=N-T+1;_.lines.shiftElements(T+1,k-1,-1),_.lines.set(N,E.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(g,y,_){const E=this.buffer;if(g<0){if(E.ydisp===0)return;this.isUserScrolling=!0}else g+E.ydisp>=E.ybase&&(this.isUserScrolling=!1);const T=E.ydisp;E.ydisp=Math.max(Math.min(E.ydisp+g,E.ybase),0),T!==E.ydisp&&(y||this._onScroll.fire(E.ydisp))}};c.BufferService=S=h([p(0,w.IOptionsService)],S)},7994:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,h){this._charsets[d]=h,this.glevel===d&&(this.charset=h)}}},1753:function(u,c,d){var h=this&&this.__decorate||function(E,T,N,k){var L,R=arguments.length,j=R<3?T:k===null?k=Object.getOwnPropertyDescriptor(T,N):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,T,N,k);else for(var M=E.length-1;M>=0;M--)(L=E[M])&&(j=(R<3?L(j):R>3?L(T,N,j):L(T,N))||j);return R>3&&j&&Object.defineProperty(T,N,j),j},p=this&&this.__param||function(E,T){return function(N,k){T(N,k,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=d(2585),b=d(8460),v=d(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:E=>E.button!==4&&E.action===1&&(E.ctrl=!1,E.alt=!1,E.shift=!1,!0)},VT200:{events:19,restrict:E=>E.action!==32},DRAG:{events:23,restrict:E=>E.action!==32||E.button!==3},ANY:{events:31,restrict:E=>!0}};function S(E,T){let N=(E.ctrl?16:0)|(E.shift?4:0)|(E.alt?8:0);return E.button===4?(N|=64,N|=E.action):(N|=3&E.button,4&E.button&&(N|=64),8&E.button&&(N|=128),E.action===32?N|=32:E.action!==0||T||(N|=3)),N}const g=String.fromCharCode,y={DEFAULT:E=>{const T=[S(E,!1)+32,E.col+32,E.row+32];return T[0]>255||T[1]>255||T[2]>255?"":`\x1B[M${g(T[0])}${g(T[1])}${g(T[2])}`},SGR:E=>{const T=E.action===0&&E.button!==4?"m":"M";return`\x1B[<${S(E,!0)};${E.col};${E.row}${T}`},SGR_PIXELS:E=>{const T=E.action===0&&E.button!==4?"m":"M";return`\x1B[<${S(E,!0)};${E.x};${E.y}${T}`}};let _=c.CoreMouseService=class extends v.Disposable{constructor(E,T){super(),this._bufferService=E,this._coreService=T,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const N of Object.keys(w))this.addProtocol(N,w[N]);for(const N of Object.keys(y))this.addEncoding(N,y[N]);this.reset()}addProtocol(E,T){this._protocols[E]=T}addEncoding(E,T){this._encodings[E]=T}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(E){if(!this._protocols[E])throw new Error(`unknown protocol "${E}"`);this._activeProtocol=E,this._onProtocolChange.fire(this._protocols[E].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(E){if(!this._encodings[E])throw new Error(`unknown encoding "${E}"`);this._activeEncoding=E}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(E){if(E.col<0||E.col>=this._bufferService.cols||E.row<0||E.row>=this._bufferService.rows||E.button===4&&E.action===32||E.button===3&&E.action!==32||E.button!==4&&(E.action===2||E.action===3)||(E.col++,E.row++,E.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,E,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(E))return!1;const T=this._encodings[this._activeEncoding](E);return T&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(T):this._coreService.triggerDataEvent(T,!0)),this._lastEvent=E,!0}explainEvents(E){return{down:!!(1&E),up:!!(2&E),drag:!!(4&E),move:!!(8&E),wheel:!!(16&E)}}_equalEvents(E,T,N){if(N){if(E.x!==T.x||E.y!==T.y)return!1}else if(E.col!==T.col||E.row!==T.row)return!1;return E.button===T.button&&E.action===T.action&&E.ctrl===T.ctrl&&E.alt===T.alt&&E.shift===T.shift}};c.CoreMouseService=_=h([p(0,m.IBufferService),p(1,m.ICoreService)],_)},6975:function(u,c,d){var h=this&&this.__decorate||function(_,E,T,N){var k,L=arguments.length,R=L<3?E:N===null?N=Object.getOwnPropertyDescriptor(E,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,E,T,N);else for(var j=_.length-1;j>=0;j--)(k=_[j])&&(R=(L<3?k(R):L>3?k(E,T,R):k(E,T))||R);return L>3&&R&&Object.defineProperty(E,T,R),R},p=this&&this.__param||function(_,E){return function(T,N){E(T,N,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),b=d(8460),v=d(844),w=d(2585),S=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=c.CoreService=class extends v.Disposable{constructor(_,E,T){super(),this._bufferService=_,this._logService=E,this._optionsService=T,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(S),this.decPrivateModes=(0,m.clone)(g)}reset(){this.modes=(0,m.clone)(S),this.decPrivateModes=(0,m.clone)(g)}triggerDataEvent(_,E=!1){if(this._optionsService.rawOptions.disableStdin)return;const T=this._bufferService.buffer;E&&this._optionsService.rawOptions.scrollOnUserInput&&T.ybase!==T.ydisp&&this._onRequestScrollToBottom.fire(),E&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((N=>N.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((E=>E.charCodeAt(0))))),this._onBinary.fire(_))}};c.CoreService=y=h([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],y)},9074:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const h=d(8055),p=d(8460),m=d(844),b=d(6106);let v=0,w=0;class S extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((_=>_?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const E=new g(_);if(E){const T=E.marker.onDispose((()=>E.dispose()));E.onDispose((()=>{E&&(this._decorations.delete(E)&&this._onDecorationRemoved.fire(E),T.dispose())})),this._decorations.insert(E),this._onDecorationRegistered.fire(E)}return E}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,E,T){let N=0,k=0;for(const L of this._decorations.getKeyIterator(E))N=L.options.x??0,k=N+(L.options.width??1),_>=N&&_<k&&(!T||(L.options.layer??"bottom")===T)&&(yield L)}forEachDecorationAtCell(_,E,T,N){this._decorations.forEachByKey(E,(k=>{v=k.options.x??0,w=v+(k.options.width??1),_>=v&&_<w&&(!T||(k.options.layer??"bottom")===T)&&N(k)}))}}c.DecorationService=S;class g extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(_){super(),this.options=_,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=_.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const h=d(2585),p=d(8343);class m{constructor(...v){this._entries=new Map;for(const[w,S]of v)this.set(w,S)}set(v,w){const S=this._entries.get(v);return this._entries.set(v,w),S}forEach(v){for(const[w,S]of this._entries.entries())v(w,S)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(h.IInstantiationService,this)}setService(b,v){this._services.set(b,v)}getService(b){return this._services.get(b)}createInstance(b,...v){const w=(0,p.getServiceDependencies)(b).sort(((y,_)=>y.index-_.index)),S=[];for(const y of w){const _=this._services.get(y.id);if(!_)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${y.id}.`);S.push(_)}const g=w.length>0?w[0].index:v.length;if(v.length!==g)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${g+1} conflicts with ${v.length} static arguments`);return new b(...v,...S)}}},7866:function(u,c,d){var h=this&&this.__decorate||function(g,y,_,E){var T,N=arguments.length,k=N<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,_):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(g,y,_,E);else for(var L=g.length-1;L>=0;L--)(T=g[L])&&(k=(N<3?T(k):N>3?T(y,_,k):T(y,_))||k);return N>3&&k&&Object.defineProperty(y,_,k),k},p=this&&this.__param||function(g,y){return function(_,E){y(_,E,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),b=d(2585),v={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let w,S=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let y=0;y<g.length;y++)typeof g[y]=="function"&&(g[y]=g[y]())}_log(g,y,_){this._evalLazyOptionalParams(_),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,..._)}trace(g,...y){this._logLevel<=b.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,g,y)}debug(g,...y){this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,g,y)}info(g,...y){this._logLevel<=b.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,g,y)}warn(g,...y){this._logLevel<=b.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,g,y)}error(g,...y){this._logLevel<=b.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,g,y)}};c.LogService=S=h([p(0,b.IOptionsService)],S),c.setTraceLogger=function(g){w=g},c.traceCall=function(g,y,_){if(typeof _.value!="function")throw new Error("not supported");const E=_.value;_.value=function(...T){if(w.logLevel!==b.LogLevelEnum.TRACE)return E.apply(this,T);w.trace(`GlyphRenderer#${E.name}(${T.map((k=>JSON.stringify(k))).join(", ")})`);const N=E.apply(this,T);return w.trace(`GlyphRenderer#${E.name} return`,N),N}}},7302:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const h=d(8460),p=d(844),m=d(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends p.Disposable{constructor(S){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...c.DEFAULT_OPTIONS};for(const y in S)if(y in g)try{const _=S[y];g[y]=this._sanitizeAndValidateOption(y,_)}catch(_){console.error(_)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,g){return this.onOptionChange((y=>{y===S&&g(this.rawOptions[S])}))}onMultipleOptionChange(S,g){return this.onOptionChange((y=>{S.indexOf(y)!==-1&&g()}))}_setupOptions(){const S=y=>{if(!(y in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},g=(y,_)=>{if(!(y in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);_=this._sanitizeAndValidateOption(y,_),this.rawOptions[y]!==_&&(this.rawOptions[y]=_,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const _={get:S.bind(this,y),set:g.bind(this,y)};Object.defineProperty(this.options,y,_)}}_sanitizeAndValidateOption(S,g){switch(S){case"cursorStyle":if(g||(g=c.DEFAULT_OPTIONS[S]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${S}`);break;case"wordSeparator":g||(g=c.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=b.includes(g)?g:c.DEFAULT_OPTIONS[S];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${S} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${S} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}c.OptionsService=v},2660:function(u,c,d){var h=this&&this.__decorate||function(v,w,S,g){var y,_=arguments.length,E=_<3?w:g===null?g=Object.getOwnPropertyDescriptor(w,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(v,w,S,g);else for(var T=v.length-1;T>=0;T--)(y=v[T])&&(E=(_<3?y(E):_>3?y(w,S,E):y(w,S))||E);return _>3&&E&&Object.defineProperty(w,S,E),E},p=this&&this.__param||function(v,w){return function(S,g){w(S,g,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let b=c.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const T=w.addMarker(w.ybase+w.y),N={data:v,id:this._nextId++,lines:[T]};return T.onDispose((()=>this._removeMarkerFromLink(N,T))),this._dataByLinkId.set(N.id,N),N.id}const S=v,g=this._getEntryIdKey(S),y=this._entriesWithId.get(g);if(y)return this.addLineToLink(y.id,w.ybase+w.y),y.id;const _=w.addMarker(w.ybase+w.y),E={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(E,_))),this._entriesWithId.set(E.key,E),this._dataByLinkId.set(E.id,E),E.id}addLineToLink(v,w){const S=this._dataByLinkId.get(v);if(S&&S.lines.every((g=>g.line!==w))){const g=this._bufferService.buffer.addMarker(w);S.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(S,g)))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const S=v.lines.indexOf(w);S!==-1&&(v.lines.splice(S,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};c.OscLinkService=b=h([p(0,m.IBufferService)],b)},8343:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const d="di$target",h="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(p){return p[h]||[]},c.createDecorator=function(p){if(c.serviceRegistry.has(p))return c.serviceRegistry.get(p);const m=function(b,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,g,y){g[d]===g?g[h].push({id:S,index:y}):(g[h]=[{id:S,index:y}],g[d]=g)})(m,b,w)};return m.toString=()=>p,c.serviceRegistry.set(p,m),m}},2585:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const h=d(8343);var p;c.IBufferService=(0,h.createDecorator)("BufferService"),c.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),c.ICoreService=(0,h.createDecorator)("CoreService"),c.ICharsetService=(0,h.createDecorator)("CharsetService"),c.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(p||(c.LogLevelEnum=p={})),c.ILogService=(0,h.createDecorator)("LogService"),c.IOptionsService=(0,h.createDecorator)("OptionsService"),c.IOscLinkService=(0,h.createDecorator)("OscLinkService"),c.IUnicodeService=(0,h.createDecorator)("UnicodeService"),c.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const h=d(8460),p=d(225);class m{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,S=!1){return(16777215&v)<<3|(3&w)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const v=new p.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,S=0;const g=v.length;for(let y=0;y<g;++y){let _=v.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=g)return w+this.wcwidth(_);const N=v.charCodeAt(y);56320<=N&&N<=57343?_=1024*(_-55296)+N-56320+65536:w+=this.wcwidth(N)}const E=this.charProperties(_,S);let T=m.extractWidth(E);m.extractShouldJoin(E)&&(T-=m.extractWidth(S)),w+=T,S=E}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}c.UnicodeService=m}},a={};function s(u){var c=a[u];if(c!==void 0)return c.exports;var d=a[u]={exports:{}};return n[u].call(d.exports,d,d.exports,s),d.exports}var o={};return(()=>{var u=o;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const c=s(9042),d=s(3236),h=s(844),p=s(5741),m=s(8285),b=s(7975),v=s(7090),w=["cols","rows"];class S extends h.Disposable{constructor(y){super(),this._core=this.register(new d.Terminal(y)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const _=T=>this._core.options[T],E=(T,N)=>{this._checkReadonlyOptions(T),this._core.options[T]=N};for(const T in this._core.options){const N={get:_.bind(this,T),set:E.bind(this,T)};Object.defineProperty(this._publicOptions,T,N)}}_checkReadonlyOptions(y){if(w.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const y=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const _ in y)this._publicOptions[_]=y[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,_=!0){this._core.input(y,_)}resize(y,_){this._verifyIntegers(y,_),this._core.resize(y,_)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,_,E){this._verifyIntegers(y,_,E),this._core.select(y,_,E)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,_){this._verifyIntegers(y,_),this._core.selectLines(y,_)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,_){this._core.write(y,_)}writeln(y,_){this._core.write(y),this._core.write(`\r
847
847
  `,_)}paste(y){this._core.paste(y)}refresh(y,_){this._verifyIntegers(y,_),this._core.refresh(y,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return c}_verifyIntegers(...y){for(const _ of y)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const _ of y)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}u.Terminal=S})(),o})()))})(ux)),ux.exports}var KM=Rce(),dx={exports:{}},ZR;function Dce(){return ZR||(ZR=1,(function(e,t){(function(n,a){e.exports=a()})(self,(()=>(()=>{var n={};return(()=>{var a=n;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const o=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(o._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,o=s._renderService.dimensions;if(o.css.cell.width===0||o.css.cell.height===0)return;const u=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),d=parseInt(c.getPropertyValue("height")),h=Math.max(0,parseInt(c.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),m=d-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),b=h-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-u;return{cols:Math.max(2,Math.floor(b/o.css.cell.width)),rows:Math.max(1,Math.floor(m/o.css.cell.height))}}}})(),n})()))})(dx)),dx.exports}var XM=Dce();function ZM({sessionId:e,className:t,heightPx:n=160,maxScrollback:a=200}){const s=C.useRef(null),o=C.useRef(null),u=C.useRef(null),c=C.useRef(null),[d,h]=C.useState(!0),p=C.useRef([]),m=C.useRef(null);return C.useEffect(()=>{const b=s.current;if(!b||!e)return;const v=new KM.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(a,1e3)),fontSize:12,fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',theme:{background:"#1e1e1e",foreground:"#d4d4d4",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"}}),w=new XM.FitAddon;v.loadAddon(w),v.open(b),b.style.height=`${n}px`,o.current=v,u.current=w;const S=()=>{try{const N=b.getBoundingClientRect();N.width>8&&N.height>8&&w.fit()}catch{}};S();const g=new ResizeObserver(()=>S());g.observe(b);const y=()=>{document.visibilityState==="visible"&&setTimeout(S,50)};document.addEventListener("visibilitychange",y);const _=new WebSocket(`${jD}/ws/terminal-preview/${e}`);c.current=_,_.onopen=()=>h(!1);const E=()=>{m.current=null;const N=p.current;if(N.length){p.current=[];try{v.write(N.join(""))}catch{}}},T=()=>{m.current===null&&(m.current=requestAnimationFrame(E))};return _.onmessage=N=>{let k;try{k=JSON.parse(N.data)}catch{return}if(k?.type==="snapshot"){if(v.reset(),p.current=[],k.data)try{v.write(k.data)}catch{}S()}else k?.type==="data"&&k.data&&(p.current.push(String(k.data)),T())},_.onclose=()=>{},_.onerror=()=>{},()=>{g.disconnect(),document.removeEventListener("visibilitychange",y);try{_.close()}catch{}m.current!==null&&cancelAnimationFrame(m.current),m.current=null,p.current=[],v.dispose()}},[e,n,a]),r.jsxs("div",{className:`relative w-full ${t||""}`.trim(),children:[d&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:r.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),r.jsx("div",{ref:s,className:"border border-muted rounded overflow-hidden"})]})}function Ice(){const e=zn(),{sessions:t,loading:n,error:a,refreshSessions:s,createSession:o,destroySession:u}=Qm(),{toast:c}=In(),[d,h]=C.useState(""),[p,m]=C.useState(!1),[b,v]=C.useState(!1),[w,S]=C.useState([]),[,g]=C.useState(null),y=M=>{const B=Date.now(),H=new Date(M).getTime(),P=Math.max(0,Math.floor((B-H)/1e3));if(P<60)return`${P}s ago`;const $=Math.floor(P/60);if($<60)return`${$}m ago`;const ee=Math.floor($/60);return ee<24?`${ee}h ago`:`${Math.floor(ee/24)}d ago`};C.useEffect(()=>{s()},[s]),C.useEffect(()=>{try{const M=localStorage.getItem("terminal.commandHistory");M&&S(JSON.parse(M))}catch{}},[]);const _=M=>{M&&(S(B=>{const H=[M,...B.filter(P=>P!==M)].slice(0,5);try{localStorage.setItem("terminal.commandHistory",JSON.stringify(H))}catch{}return H}),g(null))},E=t.filter(M=>!M.proposalId?.startsWith("cp-")).sort((M,B)=>new Date(B.lastActivity).getTime()-new Date(M.lastActivity).getTime()),[T,N]=C.useState({}),k=async()=>{const M=`session-${Date.now()}`;await o(M,!1)&&(c({title:"New terminal started",description:`${M}`}),e(`/terminal/${M}`))},L=async()=>{const M=d.trim();if(!M)return;const B=`session-${Date.now()}`;m(!0);try{await o(B,!1,M)?(_(M),c({title:"Session started",description:`${B}`}),e(`/terminal/${B}`)):c({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{m(!1)}},R=async()=>{const M=d.trim();if(!M)return;const B=`session-${Date.now()}`;v(!0);try{await o(B,!1,M)?(_(M),setTimeout(()=>s(),150),h(""),c({title:"Started in background",description:`${B}`,action:r.jsx(Gv,{altText:"Open session",onClick:()=>e(`/terminal/${B}`),children:"Open"})})):c({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{v(!1)}},j=async M=>{await u(M)?(c({title:"Session closed",description:M}),setTimeout(()=>s(),100)):c({title:"Failed to close session",description:M,variant:"destructive"})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{className:"h-6 w-6"}),r.jsx("h1",{className:"text-2xl font-bold",children:"Terminal"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs(se,{variant:"outline",onClick:()=>s(),disabled:n,children:[r.jsx(Ti,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})})]}),a&&r.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:r.jsx("div",{className:"text-red-600",children:a})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),n?r.jsx("div",{className:"space-y-2",children:[...Array(2)].map((M,B)=>r.jsx(De,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),r.jsxs("div",{children:[r.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),r.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),r.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},B))}):E.length===0?r.jsx(De,{className:"p-4",children:r.jsx("div",{className:"text-sm text-muted-foreground",children:"No active sessions."})}):r.jsx("div",{className:"space-y-2",children:E.slice(0,10).map(M=>r.jsxs(De,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:M.proposalId}),r.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",M.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",y(M.lastActivity)]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`flex items-center gap-1 ${M.connected?"text-green-600":"text-gray-400"}`,title:M.connected?"Connected":"Disconnected",children:r.jsx("div",{className:`w-2 h-2 rounded-full ${M.connected?"bg-green-500":"bg-gray-400"}`})}),r.jsx(se,{size:"sm",variant:"outline",onClick:()=>e(`/terminal/${M.proposalId}`),children:"Open"}),r.jsx(se,{size:"icon",variant:"destructive",onClick:()=>j(M.id),title:"Close session","aria-label":"Close session",children:r.jsx(Cr,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"mt-2 flex justify-center",children:r.jsx(se,{size:"icon",variant:"ghost",className:"h-6 w-6 text-muted-foreground",onClick:()=>{N(B=>({...B,[M.id]:!B[M.id]}))},"aria-label":T[M.id]?"Hide preview":"Show preview",title:T[M.id]?"Hide preview":"Show preview",children:T[M.id]?r.jsx(Wp,{className:"h-4 w-4"}):r.jsx(Na,{className:"h-4 w-4"})})}),T[M.id]&&r.jsx("div",{className:"mt-2 w-full",children:r.jsx(ZM,{sessionId:M.id,heightPx:160,maxScrollback:200})})]},M.id))})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"New Terminal"}),r.jsx("div",{className:"grid grid-cols-1 gap-4",children:r.jsx(De,{children:r.jsx(Fe,{className:"py-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium",children:"New Terminal"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Start a fresh interactive session"})]}),r.jsxs(se,{onClick:k,disabled:n,children:[r.jsx(Ts,{className:"h-4 w-4 mr-2"})," New Terminal"]})]})})})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Run Custom Command"}),r.jsx(De,{children:r.jsxs(Fe,{className:"py-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{value:d,onChange:M=>h(M.target.value),onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),M.shiftKey?R():L()):M.key==="ArrowUp"?(M.preventDefault(),g(B=>{const H=B===null?0:Math.min((B??0)+1,w.length-1),P=w[H];return P&&h(P),H})):M.key==="ArrowDown"&&(M.preventDefault(),g(B=>{if(B===null)return null;const H=B-1;if(H<0)return h(""),null;const P=w[H];return P&&h(P),H}))},placeholder:"npm run dev",className:"flex-1 h-9 rounded-md border px-3 text-sm bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400"}),r.jsxs(se,{onClick:R,variant:"secondary",disabled:n||!d.trim()||b||p,children:[b?r.jsx(cn,{className:"h-4 w-4 animate-spin"}):r.jsx(hI,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-1",children:"Run in background"})]}),r.jsxs(se,{onClick:L,disabled:n||!d.trim()||p||b,children:[p?r.jsx(cn,{className:"h-4 w-4 animate-spin mr-2"}):r.jsx(Si,{className:"h-4 w-4 mr-2"}),"Run"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Enter to Run • Shift+Enter to Run in background"})]})})]})]})}var eC="Radio",[Oce,QM]=Rr(eC),[Lce,jce]=Oce(eC),JM=C.forwardRef((e,t)=>{const{__scopeRadio:n,name:a,checked:s=!1,required:o,disabled:u,value:c="on",onCheck:d,form:h,...p}=e,[m,b]=C.useState(null),v=Et(t,g=>b(g)),w=C.useRef(!1),S=m?h||!!m.closest("form"):!0;return r.jsxs(Lce,{scope:n,checked:s,disabled:u,children:[r.jsx(lt.button,{type:"button",role:"radio","aria-checked":s,"data-state":r5(s),"data-disabled":u?"":void 0,disabled:u,value:c,...p,ref:v,onClick:We(e.onClick,g=>{s||d?.(),S&&(w.current=g.isPropagationStopped(),w.current||g.stopPropagation())})}),S&&r.jsx(n5,{control:m,bubbles:!w.current,name:a,value:c,checked:s,required:o,disabled:u,form:h,style:{transform:"translateX(-100%)"}})]})});JM.displayName=eC;var e5="RadioIndicator",t5=C.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:a,...s}=e,o=jce(e5,n);return r.jsx(ur,{present:a||o.checked,children:r.jsx(lt.span,{"data-state":r5(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});t5.displayName=e5;var Mce="RadioBubbleInput",n5=C.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...s},o)=>{const u=C.useRef(null),c=Et(u,o),d=by(n),h=cy(t);return C.useEffect(()=>{const p=u.current;if(!p)return;const m=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(m,"checked").set;if(d!==n&&v){const w=new Event("click",{bubbles:a});v.call(p,n),p.dispatchEvent(w)}},[d,n,a]),r.jsx(lt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});n5.displayName=Mce;function r5(e){return e?"checked":"unchecked"}var Fce=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Jm="RadioGroup",[Pce,dde]=Rr(Jm,[bc,QM]),a5=bc(),s5=QM(),[Bce,Uce]=Pce(Jm),i5=C.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:u=!1,disabled:c=!1,orientation:d,dir:h,loop:p=!0,onValueChange:m,...b}=e,v=a5(n),w=hc(h),[S,g]=Za({prop:o,defaultProp:s??null,onChange:m,caller:Jm});return r.jsx(Bce,{scope:n,name:a,required:u,disabled:c,value:S,onValueChange:g,children:r.jsx($y,{asChild:!0,...v,orientation:d,dir:w,loop:p,children:r.jsx(lt.div,{role:"radiogroup","aria-required":u,"aria-orientation":d,"data-disabled":c?"":void 0,dir:w,...b,ref:t})})})});i5.displayName=Jm;var o5="RadioGroupItem",l5=C.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...s}=e,o=Uce(o5,n),u=o.disabled||a,c=a5(n),d=s5(n),h=C.useRef(null),p=Et(t,h),m=o.value===s.value,b=C.useRef(!1);return C.useEffect(()=>{const v=S=>{Fce.includes(S.key)&&(b.current=!0)},w=()=>b.current=!1;return document.addEventListener("keydown",v),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",v),document.removeEventListener("keyup",w)}},[]),r.jsx(zy,{asChild:!0,...c,focusable:!u,active:m,children:r.jsx(JM,{disabled:u,required:o.required,checked:m,...d,...s,name:o.name,ref:p,onCheck:()=>o.onValueChange(s.value),onKeyDown:We(v=>{v.key==="Enter"&&v.preventDefault()}),onFocus:We(s.onFocus,()=>{b.current&&h.current?.click()})})})});l5.displayName=o5;var Hce="RadioGroupIndicator",c5=C.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...a}=e,s=s5(n);return r.jsx(t5,{...s,...a,ref:t})});c5.displayName=Hce;var u5=i5,d5=l5,$ce=c5;const tC=C.forwardRef(({className:e,...t},n)=>r.jsx(u5,{className:Ne("grid gap-2",e),...t,ref:n}));tC.displayName=u5.displayName;const Hl=C.forwardRef(({className:e,...t},n)=>r.jsx(d5,{ref:n,className:Ne("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:r.jsx($ce,{className:"flex items-center justify-center",children:r.jsx(fI,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Hl.displayName=d5.displayName;var hx={exports:{}},QR;function zce(){return QR||(QR=1,(function(e,t){(function(n,a){e.exports=a()})(self,(()=>(()=>{var n={6:(u,c)=>{function d(p){try{const m=new URL(p),b=m.password&&m.username?`${m.protocol}//${m.username}:${m.password}@${m.host}`:m.username?`${m.protocol}//${m.username}@${m.host}`:`${m.protocol}//${m.host}`;return p.toLocaleLowerCase().startsWith(b.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(p,m,b,v={}){this._terminal=p,this._regex=m,this._handler=b,this._options=v}provideLinks(p,m){const b=h.computeLink(p,this._regex,this._terminal,this._handler);m(this._addCallbacks(b))}_addCallbacks(p){return p.map((m=>(m.leave=this._options.leave,m.hover=(b,v)=>{if(this._options.hover){const{range:w}=m;this._options.hover(b,v,w)}},m)))}};class h{static computeLink(m,b,v,w){const S=new RegExp(b.source,(b.flags||"")+"g"),[g,y]=h._getWindowedLineStrings(m-1,v),_=g.join("");let E;const T=[];for(;E=S.exec(_);){const N=E[0];if(!d(N))continue;const[k,L]=h._mapStrIdx(v,y,0,E.index),[R,j]=h._mapStrIdx(v,k,L,N.length);if(k===-1||L===-1||R===-1||j===-1)continue;const M={start:{x:L+1,y:k+1},end:{x:j,y:R+1}};T.push({range:M,text:N,activate:w})}return T}static _getWindowedLineStrings(m,b){let v,w=m,S=m,g=0,y="";const _=[];if(v=b.buffer.active.getLine(m)){const E=v.translateToString(!0);if(v.isWrapped&&E[0]!==" "){for(g=0;(v=b.buffer.active.getLine(--w))&&g<2048&&(y=v.translateToString(!0),g+=y.length,_.push(y),v.isWrapped&&y.indexOf(" ")===-1););_.reverse()}for(_.push(E),g=0;(v=b.buffer.active.getLine(++S))&&v.isWrapped&&g<2048&&(y=v.translateToString(!0),g+=y.length,_.push(y),y.indexOf(" ")===-1););}return[_,w]}static _mapStrIdx(m,b,v,w){const S=m.buffer.active,g=S.getNullCell();let y=v;for(;w;){const _=S.getLine(b);if(!_)return[-1,-1];for(let E=y;E<_.length;++E){_.getCell(E,g);const T=g.getChars();if(g.getWidth()&&(w-=T.length||1,E===_.length-1&&T==="")){const N=S.getLine(b+1);N&&N.isWrapped&&(N.getCell(0,g),g.getWidth()===2&&(w+=1))}if(w<0)return[b,E]}b++,y=0}return[b,y]}}c.LinkComputer=h}},a={};function s(u){var c=a[u];if(c!==void 0)return c.exports;var d=a[u]={exports:{}};return n[u](d,d.exports,s),d.exports}var o={};return(()=>{var u=o;Object.defineProperty(u,"__esModule",{value:!0}),u.WebLinksAddon=void 0;const c=s(6),d=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function h(p,m){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}u.WebLinksAddon=class{constructor(p=h,m={}){this._handler=p,this._options=m}activate(p){this._terminal=p;const m=this._options,b=m.urlRegex||d;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,b,this._handler,m))}dispose(){this._linkProvider?.dispose()}}})(),o})()))})(hx)),hx.exports}var Gce=zce();const qce=[{label:"Save to knowledge base",command:"Save this to the knowledge base (.nut/context/knowledge/) using the following schema as reference .nut/.schema/knowledge.schema.md",description:"Save content to knowledge base with schema reference"},{label:"Update project document",command:"Update the project document (.nut/context/project.md) using the following schema as reference .nut/.schema/project.schema.md",description:"Update project.md using schema reference"},{label:"Update architecture document",command:"Update the architecture document (.nut/context/architecture.md) using the following schema as reference .nut/.schema/architecture.schema.md",description:"Update architecture.md using schema reference"}];function Wce({onJumpToBottom:e,onSnippet:t,onSendKey:n}){return r.jsxs("div",{className:"w-full border-t border-gray-700/50 bg-[#252525] px-4 py-2.5 flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[e&&r.jsxs(se,{variant:"outline",size:"sm",onClick:e,className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",title:"Jump to bottom and set focus",children:[r.jsx(H7,{className:"h-3.5 w-3.5 mr-1.5"}),"Jump to Bottom"]}),t&&r.jsxs(Vl,{children:[r.jsx(Yl,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",className:"h-8 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] text-gray-200 hover:text-white transition-colors",children:[r.jsx(Y7,{className:"h-3.5 w-3.5 mr-1.5"}),"Snippets"]})}),r.jsxs(vo,{align:"start",className:"w-72",children:[r.jsx(yo,{children:"Command Snippets"}),r.jsx(Eo,{}),qce.map((a,s)=>r.jsxs(Zy,{onClick:()=>t(a.command),className:"cursor-pointer flex flex-col items-start py-2",children:[r.jsx("span",{className:"font-medium",children:a.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono mt-0.5",children:a.command})]},s))]})]})]}),n&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(""),className:"h-8 px-2.5 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-red-900/40 hover:border-red-700 text-gray-200 hover:text-red-300 font-mono transition-colors",title:"Send Ctrl+C (interrupt)",children:r.jsx("kbd",{className:"text-xs",children:"Ctrl+C"})}),r.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(""),className:"h-8 px-2.5 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white font-mono transition-colors",title:"Send Ctrl+Z (suspend)",children:r.jsx("kbd",{className:"text-xs",children:"Ctrl+Z"})}),r.jsx(se,{variant:"outline",size:"sm",onClick:()=>n("\x1B"),className:"h-8 px-2.5 text-xs bg-[#2d2d2d] border-gray-600 hover:bg-[#3d3d3d] hover:border-gray-500 text-gray-200 hover:text-white font-mono transition-colors",title:"Send Escape key",children:r.jsx("kbd",{className:"text-xs",children:"Esc"})})]})]})}function Vce({sessionId:e,onResize:t,onDestroy:n,pendingCommand:a,onCommandExecuted:s,showToolbar:o=!0,onSnippet:u}){const c=C.useRef(null),d=C.useRef(null),h=C.useRef(null),p=C.useRef(null),[m,b]=C.useState(!1),[v,w]=C.useState(null),[S,g]=C.useState(!0),y=C.useRef(0),_=5,E=C.useRef(null),T=C.useRef(null),N=C.useRef(a??null),k=C.useRef(!1),L=C.useRef(null),R=C.useRef(s),j=C.useRef(n),M=C.useRef(t);C.useEffect(()=>{R.current=s},[s]),C.useEffect(()=>{j.current=n},[n]),C.useEffect(()=>{M.current=t},[t]);const B=C.useCallback(ee=>{!N.current||k.current||(L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{if(!N.current||k.current){L.current=null;return}p.current?.readyState===WebSocket.OPEN&&(p.current.send(JSON.stringify({type:"input",data:N.current+"\r"})),k.current=!0,R.current?.()),L.current=null},ee))},[]);C.useEffect(()=>{if(N.current=a??null,k.current=!1,!N.current){L.current!==null&&(window.clearTimeout(L.current),L.current=null);return}const ee=p.current?.readyState===WebSocket.OPEN;return B(ee?200:800),()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)}},[a,e,B]),C.useEffect(()=>{b(!1),g(!0),w(null)},[e]),C.useEffect(()=>{if(!c.current||!e)return;const ee=ie=>{const de=ie.getBoundingClientRect();return de.width>0&&de.height>0},U=new KM.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',convertEol:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",selectionBackground:"#264f78",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"}}),J=new XM.FitAddon,X=new Gce.WebLinksAddon;U.loadAddon(J),U.loadAddon(X),U.open(c.current),d.current=U,h.current=J;let F=null,O=null;const V=()=>{if(!U||!U.element||!U.element.parentElement)return;const ie=U.cols??0,de=U.rows??0;if(ie>0&&de>0){p.current?.readyState===WebSocket.OPEN&&p.current.send(JSON.stringify({type:"resize",cols:ie,rows:de}));const Te=M.current;Te&&Te(ie,de)}},te=()=>{const ie=c.current;if(ie&&ee(ie)&&!(!U||!U.element||!U.element.parentElement))try{const de=ie.getBoundingClientRect();if(de.width<10||de.height<10)return;J.fit(),V()}catch(de){console.warn("xterm fit() failed, will retry if needed:",de)}},q=()=>{F&&cancelAnimationFrame(F),F=requestAnimationFrame(()=>{te()})},W=()=>{if(!e)return;E.current&&(window.clearTimeout(E.current),E.current=null);const ie=`${jD}/ws/terminal/${e}`,de=new WebSocket(ie);return p.current=de,de.onopen=()=>{b(!0),w(null),y.current=0,console.log("Terminal WebSocket connected"),T.current&&window.clearInterval(T.current),T.current=window.setInterval(()=>{de.readyState===WebSocket.OPEN&&de.send(JSON.stringify({type:"keepalive"}))},120*1e3),q(),setTimeout(()=>{g(!1),q(),setTimeout(()=>q(),50),setTimeout(()=>q(),150)},400),B(1200)},de.onmessage=Te=>{try{const Ce=JSON.parse(Te.data);switch(Ce.type){case"snapshot":if(typeof Ce.data=="string"&&Ce.data.length&&d.current){const Ve=d.current;Ve.write(Ce.data,()=>{Ve.scrollToBottom()})}break;case"data":if(d.current){const Ve=d.current,nt=Ve.buffer.active.viewportY+Ve.rows>=Ve.buffer.active.baseY+Ve.buffer.active.cursorY;Ve.write(Ce.data,()=>{nt&&Ve.scrollToBottom()})}break;case"exit":d.current&&d.current.write(`\r
848
848
  \x1B[31mProcess exited with code ${Ce.exitCode}\x1B[0m\r
849
- `),j.current?.();break}}catch(Ce){console.error("Error parsing WebSocket message:",Ce)}},de.onclose=Te=>{if(b(!1),console.log("Terminal WebSocket disconnected",Te.code,Te.reason),T.current&&(window.clearInterval(T.current),T.current=null),Te.code!==1e3&&y.current<_&&e){y.current++;const Ce=Math.min(1e3*Math.pow(2,y.current-1),1e4);console.log(`Attempting to reconnect (${y.current}/${_}) in ${Ce}ms`),E.current=window.setTimeout(()=>{W()},Ce)}else y.current>=_&&w("Connection lost. Please refresh the page to reconnect.")},de.onerror=Te=>{console.error("Terminal WebSocket error:",Te),y.current===0&&w("WebSocket connection failed")},de};W(),U.onData(ie=>{p.current?.readyState===WebSocket.OPEN&&p.current.send(JSON.stringify({type:"input",data:ie}))});const ae=()=>{q()},ne=new ResizeObserver(ae);c.current&&ne.observe(c.current),window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae);const K=()=>{document.visibilityState==="visible"&&(O&&clearTimeout(O),O=window.setTimeout(()=>{q()},50))};document.addEventListener("visibilitychange",K);let G=0;const Y=20,oe=()=>{const ie=c.current;if(ie){if(ee(ie)){te();return}G+=1,G<Y?F=requestAnimationFrame(oe):O=window.setTimeout(()=>{te()},100)}};return F=requestAnimationFrame(oe),()=>{ne.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),document.removeEventListener("visibilitychange",K),F&&cancelAnimationFrame(F),O&&clearTimeout(O),E.current&&(window.clearTimeout(E.current),E.current=null),T.current&&(window.clearInterval(T.current),T.current=null),p.current?.readyState===WebSocket.OPEN&&p.current.close(),L.current!==null&&(window.clearTimeout(L.current),L.current=null),U.dispose()}},[e,B]);const H=C.useCallback(()=>{d.current&&(d.current.scrollToBottom(),d.current.focus())},[]),P=C.useCallback(ee=>{p.current?.readyState===WebSocket.OPEN&&(p.current.send(JSON.stringify({type:"input",data:ee})),d.current&&d.current.focus())},[]),$=C.useCallback(ee=>{p.current?.readyState===WebSocket.OPEN&&(p.current.send(JSON.stringify({type:"input",data:ee})),d.current&&d.current.focus())},[]);return v?r.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),r.jsx("div",{className:"text-red-500 text-sm mt-1",children:v})]})}):r.jsxs("div",{className:"relative h-full flex flex-col bg-[#1e1e1e] overflow-hidden",children:[!m&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1e1e1e] bg-opacity-95 z-10 backdrop-blur-sm",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),r.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),m&&S&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1e1e1e] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),r.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),r.jsx("div",{ref:c,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),o&&r.jsx(Wce,{onJumpToBottom:H,onSnippet:u||P,onSendKey:$})]})}const Yce="Consult the schema references in .nut/.schema (proposal.schema.md, project.schema.md, architecture.schema.md, agent.schema.md, knowledge.schema.md) so any updates you make follow the documented structure and include complete arrays for plan steps, dependencies, tags, labels, and comments.",Kce="Use .nut/context/project.md and .nut/context/architecture.md for reference.";function nC(e,t,n){const a=[`Review .nut/proposals/${e}.md and begin implementing.`,"Update the assignment to yourself (Coconut AI), the implementation steps (updated as you progress), and set the status upon completion to Code Complete.","Use .nut/context/project.md and .nut/context/architecture.md for reference and make any logical updates to those files upon completion of the proposal too.",Yce,`Lastly, please add notable comments to the proposal (.nut/proposals/${e}.md) from your chain-of-thought upon completion, particularly for ideas for future suggestions and/or improvements related to the proposal or wider project.`];return t.length>0&&a.push(`Please also use these agents: ${t.join(", ")}`),n&&n.trim()&&a.push(`Additional instruction: ${n.trim()}`),a}function rC(e,t){const n=[];return n.push(Kce),e.length>0&&n.push(`Please use these agents: ${e.join(", ")}`),t&&t.trim()&&n.push(`Additional instruction: ${t.trim()}`),n}const JR=e=>{const t=e.selectedAgentIds.map(h=>`.nut/agents/${h}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" "),s=[e.automationEnabled?"--dangerously-skip-permissions":""].filter(Boolean).join(" "),o=e.selectedMcpServers.map(h=>`'${h.replace(/'/g,"'\\''")}'`).join(","),u=[JSON.stringify(a)].concat(s?[JSON.stringify("--dangerously-skip-permissions")]:[]);return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${o}]);const c=require('./.nut/mcp/config.json');const o={mcpServers:Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)))};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('claude',[${u.join(",")}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Xce=e=>{const t=e.selectedAgentIds.map(c=>`.nut/agents/${c}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" ");return`node -e "${`const fs=require('fs'),path=require('path'),{spawn}=require('child_process');const s=new Set([${e.selectedMcpServers.map(c=>`'${c.replace(/'/g,"'\\''")}'`).join(",")}]);const c=require('./.nut/mcp/config.json');const geminiPath=path.join(require('os').homedir(),'.gemini','settings.json');let settings={};try{settings=JSON.parse(fs.readFileSync(geminiPath,'utf8'))}catch(e){}settings.mcpServers=Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)));fs.writeFileSync(geminiPath,JSON.stringify(settings,null,2));const p=spawn('gemini',['-i',${JSON.stringify(a)}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Zce=e=>{const t=e.selectedAgentIds.map(c=>`.nut/agents/${c}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" ");return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${e.selectedMcpServers.map(c=>`'${c.replace(/'/g,"'\\''")}'`).join(",")}]);const c=require('./.nut/mcp/config.json');const o={mcpServers:Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)))};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('codex',[${JSON.stringify(a)}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Qce=e=>e?Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]:[];function Jce(){const{proposalId:e}=tc(),t=kr(),n=zn(),{toast:a}=In(),s=e?.startsWith("session-"),o=C.useMemo(()=>!!e&&e.startsWith("cp-"),[e]),u=C.useMemo(()=>!!e&&e.startsWith("ag-"),[e]),c=C.useMemo(()=>u&&e?e.replace("ag-","")+".md":null,[u,e]),{sessions:d,loading:h,error:p,createSession:m,destroySession:b,refreshSessions:v}=Qm(),[w,S]=C.useState([]),[g,y]=C.useState(null),[_,E]=C.useState(!1),[T,N]=C.useState(null),[k,L]=C.useState("claude"),[R,j]=C.useState(!1),[M,B]=C.useState("claude"),[H,P]=C.useState([]),[$,ee]=C.useState([]),[U,J]=C.useState([]),[X,F]=C.useState([]),[O,V]=C.useState(!1),[te,q]=C.useState(""),[W,ae]=C.useState(!1),[ne,K]=C.useState({}),[G,Y]=C.useState(null),oe=C.useRef([]),[ie,de]=C.useState("current"),[Te,Ce]=C.useState("main"),Ve=C.useMemo(()=>e?`terminal.cp.config.${e}`:null,[e]);C.useEffect(()=>{if(!(!o&&!u||!Ve))try{const Ae=localStorage.getItem(Ve);if(Ae){const fe=JSON.parse(Ae);fe.cliAgent&&B(fe.cliAgent),Array.isArray(fe.selectedMcpServers)&&ee(fe.selectedMcpServers),Array.isArray(fe.selectedAgentIds)&&F(fe.selectedAgentIds),typeof fe.automationEnabled=="boolean"&&V(fe.automationEnabled),typeof fe.customInstruction=="string"&&q(fe.customInstruction),typeof fe.createWorktree=="boolean"&&ae(fe.createWorktree),fe.branchMode&&de(fe.branchMode)}}catch{console.error("Failed to load config",Ve)}},[o,u,Ve]);const nt=C.useCallback(()=>{if(!Ve)return;const Ae={cliAgent:M,selectedMcpServers:$,selectedAgentIds:X,automationEnabled:O,customInstruction:te,createWorktree:W,branchMode:ie};try{localStorage.setItem(Ve,JSON.stringify(Ae))}catch{console.error("Failed to persist config",Ve)}},[Ve,M,$,X,O,te,W,ie]),Ie=Ae=>`feat/cp-${Ae.startsWith("cp-")?Ae.slice(3):Ae}`,$t=async Ae=>{try{const fe=Ie(Ae),Pe=await(await fetch(`${Re}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:fe,from:Te})})).json();if(!Pe.success){const Qe=Pe.error?.message||"Unknown error";return a({title:"Branch creation failed",description:Qe,variant:"destructive"}),!1}return a({title:"Branch created",description:`Created branch: ${fe}`}),!0}catch{return a({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},kt=async Ae=>{try{const fe=Ie(Ae),Pe=await(await fetch(`${Re}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:fe,from:Te})})).json();if(!Pe.success){const Qe=Pe.error?.message||"Unknown error";return a({title:"Worktree creation failed",description:Qe,variant:"destructive"}),!1}return a({title:"Worktree created",description:`Created branch: ${fe}`}),!0}catch{return a({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};C.useEffect(()=>{(o||u)&&e&&(async()=>{try{const fe=await fetch(`${Re}/api/v1/git/status`);if(fe.ok){const Pe=await fe.json();Pe?.success&&Pe.data?.branch&&Ce(Pe.data.branch)}const _e=await fetch(`${Re}/api/v1/mcp`);if(_e.ok){const Pe=await _e.json();Pe?.success&&Array.isArray(Pe.servers)&&(P(Pe.servers),ee(Qe=>Qe.filter(ut=>Pe.servers.includes(ut))),Pe.mcpServers&&typeof Pe.mcpServers=="object"&&K(Pe.mcpServers))}}catch(fe){console.error("Failed to load MCP servers",fe)}try{const fe=await fetch(`${Re}/api/v1/agents`);if(fe.ok){const _e=await fe.json(),Qe=(Array.isArray(_e?.documents)?_e.documents:[]).map(ut=>({id:ut.filename,name:ut?.metadata?.name||ut.title||ut.filename,tools:Qce(ut?.metadata?.tools)}));J(Qe),F(ut=>{const Wt=ut.filter(ht=>Qe.some(on=>on.id===ht));if(u&&c&&Wt.length===0){const ht=Qe.find(on=>on.id===c);if(ht)return[ht.id]}return Wt})}}catch(fe){console.error("Failed to load agents",fe)}})()},[o,u,e,c]),C.useEffect(()=>{const Ae=oe.current,fe=X.filter(_e=>!Ae.includes(_e));fe.length>0&&ee(_e=>{const Pe=new Set(_e),Qe=H.length>0?new Set(H):void 0;return fe.forEach(ut=>{const Wt=U.find(ht=>ht.id===ut);Wt&&Wt.tools.forEach(ht=>{(!Qe||Qe.has(ht))&&Pe.add(ht)})}),Array.from(Pe)}),oe.current=X},[X,U,H]),C.useEffect(()=>{e&&v(e)},[e,v]),C.useEffect(()=>{if(!e)return;const fe=d.filter(_e=>_e.proposalId===e).map(_e=>_e.id);S(fe),!g&&fe.length>0&&y(fe[0]),g&&!fe.includes(g)&&y(fe.length>0?fe[0]:null)},[d,e,g]);const St=async Ae=>{if(!e)return;const fe=Ae||void 0,_e=await m(e,_,fe);_e&&(y(_e),!fe&&Ae&&N(Ae),setTimeout(()=>v(e),100))},nn=Ae=>{const _e={proposalId:e,contextType:o?"change-proposal":u?"agent":"general",selectedMcpServers:$,selectedAgentIds:X,automationEnabled:O,customInstruction:te};switch(Ae){case"claude":return JR(_e);case"gemini":return Xce(_e);case"codex":return Zce(_e);default:return JR(_e)}},Mt=async()=>{o&&e&&(ie==="new-branch"?await $t(e)||console.warn("Branch creation failed, continuing with terminal creation"):ie==="new-worktree"&&(await kt(e)||console.warn("Worktree creation failed, continuing with terminal creation"))),o&&W&&ie==="current"&&e&&(await kt(e)||console.warn("Worktree creation failed, continuing with terminal creation"));const fe=nn(o||u?M:k);await St(fe)},wt=async Ae=>{if(await b(Ae)&&g===Ae){const _e=w.filter(Pe=>Pe!==Ae);y(_e.length>0?_e[0]:null)}},gn=Ae=>{wt(Ae)};return e?r.jsxs("div",{className:"flex flex-col h-full",children:[s&&w.length===0&&e&&r.jsx(eue,{proposalId:e,onStart:St,locationSearch:t.search}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:o||u?r.jsx(yi,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):r.jsx(Ts,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:s?"Terminal":"Coding Agent Session"}),!s&&r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:e}),s&&r.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",e,")"]})]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center space-x-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg border",children:[r.jsx(ma,{id:"enable-logging",checked:_,onCheckedChange:Ae=>E(Ae===!0)}),r.jsx("label",{htmlFor:"enable-logging",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Log sessions"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>e&&v(e),disabled:h,className:"bg-white dark:bg-gray-800",children:[r.jsx(Ti,{className:`h-4 w-4 ${h?"animate-spin":""}`}),"Refresh"]}),!s&&!o&&!u&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(en,{value:k,onValueChange:L,children:[r.jsx(Xt,{className:"w-24",children:r.jsx(tn,{})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code"}),r.jsx(Me,{value:"gemini",children:"Google Gemini"}),r.jsx(Me,{value:"codex",children:"OpenAI Codex"})]})]}),r.jsxs(se,{onClick:Mt,disabled:h,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Si,{className:"h-4 w-4 mr-2"}),"Start Coding"]})]}),!o&&!u&&r.jsxs(se,{onClick:()=>St(),disabled:h,size:"sm",children:[r.jsx(un,{className:"h-4 w-4 mr-2"}),"New Terminal"]})]})]})]}),p&&r.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:r.jsx(Cr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),r.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:p})]})}),w.length>0&&r.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:w.map(Ae=>{const fe=d.find(Pe=>Pe.id===Ae),_e=g===Ae;return r.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${_e?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>y(Ae),children:[r.jsx("div",{className:`p-1.5 rounded-md ${_e?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:r.jsx(Ts,{className:`h-3.5 w-3.5 ${_e?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),r.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",Ae.split("-").slice(-1)[0].substring(0,6)]}),r.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${fe?.connected?"bg-green-500":"bg-gray-400"}`}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:Pe=>{Pe.stopPropagation(),wt(Ae)},children:r.jsx(Cr,{className:"h-3 w-3"})})]},Ae)})}),r.jsx("div",{className:"flex-1 min-h-0",children:w.length===0?r.jsx(De,{className:"h-full border-0 shadow-lg",children:r.jsx(Fe,{className:"flex items-center justify-center h-full p-8",children:r.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[r.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:o||u?r.jsx(yi,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):r.jsx(Ts,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Coding Agent"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:s?"Create a new terminal session":`Configure the agent to start working on ${e}.`}),r.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!s&&!o&&!u&&r.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[r.jsxs("div",{className:"w-full space-y-3",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),r.jsxs(en,{value:k,onValueChange:L,children:[r.jsx(Xt,{className:"w-full h-11 bg-white dark:bg-gray-800",children:r.jsx(tn,{})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code (default)"}),r.jsx(Me,{value:"gemini",children:"Google Gemini"}),r.jsx(Me,{value:"codex",children:"OpenAI Codex"})]})]})]}),r.jsxs(se,{onClick:Mt,disabled:h,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[r.jsx(Si,{className:"h-5 w-5 mr-2"}),"Start Coding"]}),r.jsxs("div",{className:"flex items-center gap-3 w-full",children:[r.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),r.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),r.jsxs(se,{onClick:()=>St(),disabled:h,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[r.jsx(un,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!s&&(o||u)&&r.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[r.jsxs("div",{className:"flex gap-3 w-full",children:[r.jsxs(se,{variant:"outline",onClick:()=>j(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[r.jsx($l,{className:"h-5 w-5 mr-2"}),"Configure"]}),r.jsxs(se,{onClick:Mt,disabled:h,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[r.jsx(Si,{className:"h-5 w-5 mr-2"}),"Start Coding"]})]}),r.jsxs("div",{className:"w-full space-y-3",children:[r.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Current Configuration"}),r.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yi,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Coding Agent:"}),r.jsx("span",{className:"font-mono text-sm",children:M==="claude"?"Claude Code":M.charAt(0).toUpperCase()+M.slice(1)})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(xr,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Custom Agents:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:X.length?X.map(Ae=>{const fe=U.find(_e=>_e.id===Ae);return r.jsx(ot,{variant:"secondary",className:"font-mono text-xs",children:fe?.name||Ae},Ae)}):r.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fo,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:$.length?$.map(Ae=>r.jsx(ot,{variant:"secondary",className:"font-mono text-xs",children:Ae},Ae)):r.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wI,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Automation:"}),r.jsx("span",{className:"font-mono text-sm",children:O?"Enabled":"Disabled"})]}),o&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Na,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),r.jsx("span",{className:"font-mono text-sm",children:ie==="current"?`Current (${Te})`:ie==="new-branch"?`New branch (${Ie(e||"")})`:`New worktree (${Ie(e||"")})`})]})]}),te&&r.jsxs("div",{className:"text-left text-sm bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[r.jsxs("div",{className:"font-medium text-blue-700 dark:text-blue-300 mb-1 flex items-center gap-2",children:[r.jsx(b2,{className:"h-3.5 w-3.5"}),"Custom Instructions"]}),r.jsx("div",{className:"text-gray-700 dark:text-gray-300 font-mono",children:te})]})]})]}),s&&r.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:r.jsxs(se,{onClick:()=>St(),disabled:h,className:"w-full h-11 text-base font-medium",size:"lg",children:[r.jsx(un,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):g?r.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:r.jsx(Vce,{sessionId:g,onDestroy:()=>gn(g),pendingCommand:T,onCommandExecuted:()=>N(null),showToolbar:!0})}):null}),r.jsx($n,{open:R,onOpenChange:j,children:r.jsxs(Dn,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Cn,{children:[r.jsx(Tn,{children:"Configure Coding Agent"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the coding agent's capabilities and configure it's environment."})]}),r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(yi,{className:"h-4 w-4"}),"Coding Agent"]}),r.jsxs(en,{value:M,onValueChange:Ae=>B(Ae),children:[r.jsx(Xt,{className:"w-full",children:r.jsx(tn,{placeholder:"Select coding agent"})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code"}),r.jsx(Me,{value:"gemini",children:"Gemini"}),r.jsx(Me,{value:"codex",children:"Codex"})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(xr,{className:"h-4 w-4"}),"Custom Agents"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[X.length," of ",U.length," selected"]})]}),r.jsxs(Vl,{children:[r.jsx(Yl,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"w-full justify-between",children:[X.length===0?"Select agents...":X.length===U.length?"All agents selected":`${X.length} agent${X.length!==1?"s":""} selected`,r.jsx(Na,{className:"h-4 w-4 opacity-50"})]})}),r.jsxs(vo,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[r.jsxs(yo,{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Available Agents"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),F(U.map(fe=>fe.id))},children:"All"}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),F([])},children:"None"})]})]}),r.jsx(Eo,{}),U.length===0?r.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No agents found"}):U.map(Ae=>r.jsx(md,{checked:X.includes(Ae.id),onCheckedChange:fe=>{F(_e=>fe?_e.includes(Ae.id)?_e:[..._e,Ae.id]:_e.filter(Pe=>Pe!==Ae.id))},children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{children:Ae.name}),Ae.tools.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",Ae.tools.join(", ")]}),Ae.tools.length===0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},Ae.id))]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(fo,{className:"h-4 w-4"}),"MCP Servers"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[$.length," of ",H.length," selected"]})]}),r.jsxs(Vl,{children:[r.jsx(Yl,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"w-full justify-between",children:[$.length===0?"Select MCP servers...":$.length===H.length?"All servers selected":`${$.length} server${$.length!==1?"s":""} selected`,r.jsx(Na,{className:"h-4 w-4 opacity-50"})]})}),r.jsxs(vo,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[r.jsxs(yo,{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Available Servers"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),ee(H)},children:"All"}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),ee([])},children:"None"})]})]}),r.jsx(Eo,{}),H.length===0?r.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):H.map(Ae=>r.jsx(md,{checked:$.includes(Ae),onCheckedChange:fe=>{ee(_e=>fe?_e.includes(Ae)?_e:[..._e,Ae]:_e.filter(Pe=>Pe!==Ae))},children:Ae},Ae))]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(b2,{className:"h-4 w-4"}),"Additional instructions"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[te.length,"/500"]})]}),r.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the coding agent...",value:te,onChange:Ae=>q(Ae.target.value),rows:3}),te.length>500&&r.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[r.jsx(ma,{id:"automation",checked:O,onCheckedChange:Ae=>V(Ae===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400"}),r.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in containers only)"})]}),o&&r.jsx(Jw,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(ve,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),r.jsxs(tC,{value:ie,onValueChange:Ae=>de(Ae),children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"current",id:"branch-current"}),r.jsxs(ve,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Te}),")"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"new-branch",id:"branch-new"}),r.jsxs(ve,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Ie(e||"")})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"new-worktree",id:"branch-worktree"}),r.jsxs(ve,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Ie(e||"")})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(se,{variant:"outline",onClick:()=>j(!1),children:"Close"}),r.jsx(se,{onClick:()=>{if(te.length>500){Y("Please shorten the custom instruction to 500 characters.");return}Y(null),nt(),j(!1)},children:"Save"})]}),G&&r.jsx("div",{className:"text-xs text-red-600 text-right",children:G})]})]})})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Proposal ID"}),r.jsx(se,{onClick:()=>n("/proposals"),className:"mt-4",children:"Back to Proposals"})]})})}function eue({proposalId:e,onStart:t,locationSearch:n}){return C.useEffect(()=>{if(!e)return;const a=new URLSearchParams(n);if(!a.has("autostart"))return;const s=`terminal.autostart.${e}`;if(sessionStorage.getItem(s)==="done")return;sessionStorage.setItem(s,"done");const u=a.get("run")||void 0;t(u||void 0)},[e]),null}let Cl;async function tue(){if(Cl!==void 0)return Cl;try{const e=await fetch(`${Re}/api/v1/config`);if(!e.ok)return Cl=null,null;const n=(await e.json())?.data||{},a=n?.coconut?.id||n?.cloud?.coconutId||n?.cloud?.coconut_id;return Cl=typeof a=="string"&&a.trim()?a.trim():null,Cl}catch(e){return console.error("[github-token] Failed to load Coconut ID",e),Cl=null,null}}async function nue(e){const t=await fetch(`${MB}/api/v1/git/token`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({coconutId:e})});if(!t.ok){let o="Failed to request GitHub token from control plane";if(t.status===401||t.status===403)throw new Error("Please sign in to app.coconut.dev and then retry the action.");try{const u=await t.json();o=u?.error?.message||u?.message||o}catch{}throw new Error(o)}const n=await t.json(),a=n?.token||n?.data?.token,s=n?.expiresAt||n?.data?.expiresAt;if(!a||!s)throw new Error("Control plane response missing token or expiresAt");return{token:a,expiresAt:s}}async function rue(e,t){const n=await fetch(`${Re}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,expiresAt:t})}),a=await n.json().catch(()=>({}));if(!n.ok||!a?.success){const s=a?.error?.message||"Failed to store GitHub token on Coconut";throw new Error(s)}}async function h5(){const e=await tue();if(!e)throw new Error("Coconut ID not configured. Reconnect via Settings → Git.");const{token:t,expiresAt:n}=await nue(e);return await rue(t,n),{tokenFetched:!0,message:n}}function aue(){const e=zn(),{loading:t,createSession:n,refreshSessions:a}=Qm(),{toast:s}=In(),{refresh:o}=Ed(),[u,c]=C.useState(!1),[d,h]=C.useState(!1),[,p]=C.useState([]),[m,b]=C.useState({}),[v,w]=C.useState(null),[S,g]=C.useState(""),[y,_]=C.useState(!1),[E,T]=C.useState(!1),[N,k]=C.useState(!1),[L,R]=C.useState(null),[j,M]=C.useState("github"),[B,H]=C.useState(!1),[P,$]=C.useState(!1);C.useEffect(()=>{try{const W=localStorage.getItem("terminal.commandHistory");W&&p(JSON.parse(W))}catch{}},[]),C.useEffect(()=>{(async()=>{try{const ae=await fetch(`${Re}/api/v1/context/architecture`);if(!ae.ok)return;const ne=await ae.json();ne?.success&&ne?.document?.metadata?.commands&&b(ne.document.metadata.commands)}catch{}})()},[]),C.useEffect(()=>{ee()},[]);const ee=async()=>{_(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/status`)).json();ae?.success&&w(ae.data)}catch{}finally{_(!1)}},U=C.useCallback(async()=>{try{const ae=await(await fetch(`${Re}/api/v1/git/auth-status`)).json();ae?.success&&R(ae.data)}catch(W){console.error("Failed to load git auth status",W),R(null)}},[]);C.useEffect(()=>{U()},[U]),C.useEffect(()=>{(async()=>{try{const ne=await(await fetch(`${Re}/api/v1/git/settings`)).json();ne?.success&&ne.data?.authMode&&M(ne.data.authMode)}catch(ae){console.error("Failed to load git settings",ae)}})()},[]);const J=C.useCallback(async()=>{if(j!=="github"||L?.provider!=="github")return!0;const W=s({title:"Fetching GitHub token",description:"Contacting control plane…"});try{const{message:ae}=await h5();return s({title:"GitHub token ready",description:ae?`Valid until ${new Date(ae).toLocaleString()}`:"Token fetched successfully."}),R(ne=>({...ne,authenticated:!0,error:void 0,expiresAt:ae??ne?.expiresAt,provider:"github"})),!0}catch(ae){return s({title:"GitHub token unavailable",description:ae?.message?`${ae.message} Visit Settings → Git to reconnect.`:"Visit Settings → Git to reconnect.",variant:"destructive"}),!1}finally{W?.dismiss?.()}},[j,L?.provider,s]),X=W=>{W&&p(ae=>{const ne=[W,...ae.filter(K=>K!==W)].slice(0,5);try{localStorage.setItem("terminal.commandHistory",JSON.stringify(ne))}catch{}return ne})},F=async()=>{if(!(!S.trim()||!v||v.changes.length===0)){T(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/commits`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:S})})).json();if(!ae.success)throw new Error(ae.error?.message||"Commit failed");s({title:"Changes saved!",description:"Your work has been committed successfully"}),g(""),await ee(),await o()}catch(W){s({title:"Failed to save changes",description:W.message||"Please try again",variant:"destructive"})}finally{T(!1)}}},O=async()=>{if(!(j==="github"&&L?.provider==="github"&&!await J())){k(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/push`,{method:"POST"})).json();if(!ae.success)throw new Error(ae.error?.message||"Push failed");s({title:"Uploaded successfully!",description:"Your changes are now on the server"}),await ee()}catch(W){s({title:"Upload failed",description:W.message||"Please check your connection",variant:"destructive"})}finally{k(!1),await U()}}},V=async()=>{$(!0);try{const W=`discard-${Date.now()}`;if(await n(W,!1,"git reset --hard && git clean -fd"))s({title:"All changes discarded",description:"Your workspace has been reset"}),H(!1),await ee(),await o();else throw new Error("Failed to discard changes")}catch(W){s({title:"Failed to discard changes",description:W.message||"Please try again",variant:"destructive"})}finally{$(!1)}},te=async W=>{const ae=(W||"").trim();if(!ae)return;const ne=`session-${Date.now()}`;c(!0);try{await n(ne,!1,ae)?(X(ae),s({title:"Session started",description:`${ne}`}),e(`/terminal/${ne}`)):s({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{c(!1)}},q=async W=>{const ae=(W||"").trim();if(!ae)return;const ne=`session-${Date.now()}`;h(!0);try{await n(ne,!1,ae)?(X(ae),setTimeout(()=>a(),150),s({title:"Started in background",description:`${ne}`,action:r.jsx(Gv,{altText:"Open session",onClick:()=>e(`/terminal/${ne}`),children:"Open"})})):s({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{h(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(SI,{className:"h-6 w-6"}),r.jsx("h1",{className:"text-2xl font-bold",children:"Utilities"})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Quick Commands"}),r.jsxs(De,{children:[r.jsx(Ze,{className:"pb-2",children:r.jsx(et,{className:"text-sm font-medium text-gray-600",children:"Actions"})}),r.jsx(Fe,{children:m&&Object.keys(m).length>0&&r.jsx("div",{className:"space-y-2",children:r.jsx("div",{className:"rounded-md border divide-y",children:Object.entries(m).map(([W,ae])=>r.jsxs("div",{className:"flex items-center gap-3 p-2",children:[r.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium truncate",children:W}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsx("span",{className:"truncate max-w-full",children:r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-xs",children:ae})})]}),r.jsxs(se,{onClick:()=>q(ae),variant:"secondary",size:"sm",disabled:t||d||u,title:"Run in background",children:[r.jsx(hI,{className:"h-4 w-4 mr-1"})," Run in background"]}),r.jsxs(se,{onClick:()=>te(ae),size:"sm",disabled:t||u||d,title:"Run",children:[r.jsx(Si,{className:"h-4 w-4 mr-1"})," Run"]})]},W))})})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Quick Commit"}),r.jsxs(De,{children:[r.jsx(Ze,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(et,{className:"text-sm font-medium text-gray-600",children:"Save Your Work"}),r.jsx(se,{variant:"ghost",size:"sm",onClick:ee,disabled:y,children:r.jsx(Ti,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]})}),r.jsxs(Fe,{children:[r.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Quickly save and upload your changes. Think of this like saving your work to the cloud - your changes will be stored safely and shared with your team."," ",r.jsx(rt,{to:"/git",className:"text-primary hover:underline font-medium",children:"Need more control? Visit the full Git section →"})]}),y?r.jsxs("div",{className:"text-center py-6 text-sm text-muted-foreground",children:[r.jsx(cn,{className:"h-5 w-5 animate-spin mx-auto mb-2"}),"Loading..."]}):v?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Working on:"}),r.jsx("span",{className:"font-mono font-semibold text-sm",children:v.branch})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[v.changes.length>0&&r.jsxs("span",{className:"px-2 py-1 rounded-full bg-blue-500/10 text-blue-600 font-medium",children:[v.changes.length," change",v.changes.length!==1?"s":""]}),v.ahead>0&&r.jsxs("span",{className:"px-2 py-1 rounded-full bg-amber-500/10 text-amber-600 font-medium",children:[v.ahead," unpushed"]}),v.changes.length>0&&r.jsx(rt,{to:"/git",className:"text-primary hover:underline font-medium",children:"View all"})]})]}),v.changes.length>0||v.ahead>0?r.jsx(r.Fragment,{children:r.jsxs("div",{className:"space-y-3",children:[v.changes.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Describe what you changed"}),r.jsx(je,{placeholder:"Updated the homepage, fixed login bug, etc.",value:S,onChange:W=>g(W.target.value),onKeyDown:W=>{W.key==="Enter"&&S.trim()&&!E&&F()},className:"w-full"})]}),r.jsxs("div",{className:"flex gap-2",children:[v.changes.length>0&&r.jsxs(se,{onClick:F,disabled:!S.trim()||E,className:"flex-1",children:[r.jsx(Cx,{className:"h-4 w-4 mr-2"}),E?"Saving...":"Save Changes"]}),v.ahead>0&&r.jsxs(se,{onClick:O,disabled:N,variant:v.changes.length>0?"secondary":"default",className:"flex-1",children:[r.jsx(_I,{className:"h-4 w-4 mr-2"}),N?"Uploading...":"Upload to Server"]})]}),v.changes.length>0&&r.jsx("div",{className:"pt-2 border-t",children:r.jsxs(se,{onClick:()=>H(!0),variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive hover:bg-destructive/10",children:[r.jsx(lr,{className:"h-3.5 w-3.5 mr-2"}),"Discard All Changes"]})})]})}):r.jsxs("div",{className:"text-center py-6 rounded-lg bg-muted/20",children:[r.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"✨ All caught up!"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"No changes to save right now"})]})]}):r.jsx("div",{className:"text-center py-6 rounded-lg bg-muted/20",children:r.jsx("div",{className:"text-sm text-muted-foreground",children:"Git not available or not in a repository"})})]})]})]}),r.jsx(Ri,{open:B,onOpenChange:H,children:r.jsxs(Rs,{children:[r.jsxs(Ds,{children:[r.jsxs(Os,{className:"flex items-center gap-2",children:[r.jsx(G9,{className:"h-5 w-5 text-destructive"}),"Discard All Changes?"]}),r.jsxs(Ls,{className:"space-y-2",children:[r.jsx("p",{children:"This will permanently delete all your unsaved work and cannot be undone."}),r.jsx("p",{className:"font-medium",children:"Are you absolutely sure you want to do this?"})]})]}),r.jsxs(Is,{children:[r.jsx(Ms,{disabled:P,children:"Cancel"}),r.jsx(js,{onClick:V,disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Discarding...":"Yes, Discard Everything"})]})]})})]})}function sue(){const e=zn(),{sessions:t,loading:n,error:a,refreshSessions:s}=Qm(),[o,u]=C.useState([]),[c,d]=C.useState(!0),[h,p]=C.useState({}),m=w=>{const S=Date.now(),g=new Date(w).getTime(),y=Math.max(0,Math.floor((S-g)/1e3));if(y<60)return`${y}s ago`;const _=Math.floor(y/60);if(_<60)return`${_}m ago`;const E=Math.floor(_/60);return E<24?`${E}h ago`:`${Math.floor(E/24)}d ago`};C.useEffect(()=>{(async()=>{try{const S=await fetch(`${Re}/api/v1/proposals`);if(S.ok){const g=await S.json(),y=g.data||g;u(Array.isArray(y)?y:[])}}catch(S){console.error("Error loading proposals:",S)}finally{d(!1)}})()},[]),C.useEffect(()=>{s()},[s]);const b=C.useMemo(()=>t.filter(w=>w.proposalId?.startsWith("cp-")||w.proposalId?.startsWith("ag-")).sort((w,S)=>new Date(S.lastActivity).getTime()-new Date(w.lastActivity).getTime()),[t]),v=C.useMemo(()=>o.filter(w=>w.status==="approved"||w.status==="code-complete").sort((w,S)=>new Date(S.metadata.createdAt).getTime()-new Date(w.metadata.createdAt).getTime()).slice(0,10),[o]);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yi,{className:"h-6 w-6"}),r.jsx("h1",{className:"text-2xl font-bold",children:"Code"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs(se,{variant:"outline",onClick:()=>s(),disabled:n,children:[r.jsx(Ti,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})})]}),a&&r.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:r.jsx("div",{className:"text-red-600",children:a})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),n?r.jsx("div",{className:"space-y-2",children:[...Array(2)].map((w,S)=>r.jsx(De,{className:"p-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),r.jsxs("div",{children:[r.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),r.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),r.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},S))}):b.length===0?r.jsx(De,{className:"p-4",children:r.jsx("div",{className:"text-sm text-muted-foreground",children:"No active sessions"})}):r.jsx("div",{className:"space-y-2",children:b.slice(0,10).map(w=>r.jsxs(De,{className:"p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:w.proposalId}),r.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",w.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",m(w.lastActivity)]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`flex items-center gap-1 ${w.connected?"text-green-600":"text-gray-400"}`,title:w.connected?"Connected":"Disconnected",children:r.jsx("div",{className:`w-2 h-2 rounded-full ${w.connected?"bg-green-500":"bg-gray-400"}`})}),r.jsx(se,{size:"sm",variant:"outline",onClick:()=>e(`/terminal/${w.proposalId}`),children:"Open"})]})]}),h[w.id]&&r.jsx("div",{className:"mt-2 w-full",children:r.jsx(ZM,{sessionId:w.id,heightPx:160,maxScrollback:200})}),r.jsx("div",{className:"mt-2 flex justify-center",children:r.jsx(se,{size:"icon",variant:"ghost",className:"h-6 w-6 text-muted-foreground",onClick:()=>{p(S=>({...S,[w.id]:!S[w.id]}))},"aria-label":h[w.id]?"Hide preview":"Show preview",title:h[w.id]?"Hide preview":"Show preview",children:h[w.id]?r.jsx(Wp,{className:"h-4 w-4"}):r.jsx(Na,{className:"h-4 w-4"})})})]},w.id))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Recent Approved / Code Complete Proposals"}),c?r.jsx("div",{className:"space-y-3",children:[...Array(3)].map((w,S)=>r.jsx(De,{children:r.jsx(Ze,{className:"py-3",children:r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),r.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},S))}):v.length===0?r.jsx(De,{children:r.jsx(Fe,{className:"flex items-center justify-center py-6",children:r.jsx("div",{className:"text-center text-sm text-gray-500",children:"No approved or code complete proposals found"})})}):r.jsx("div",{className:"space-y-2",children:v.map(w=>r.jsx(De,{className:"hover:shadow-sm transition-shadow",children:r.jsx(Fe,{className:"py-4",children:r.jsx("div",{className:"flex justify-between items-start gap-4",children:r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(et,{className:"text-base leading-tight",children:w.intent}),r.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[w.priority&&r.jsx(ot,{variant:w.priority==="high"||w.priority==="critical"?"destructive":w.priority==="medium"?"secondary":"outline",className:"text-xs",children:w.priority}),r.jsx(ot,{variant:"default",className:"text-xs",children:w.status})]})]}),w.content&&r.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[w.content.split(`
849
+ `),j.current?.();break}}catch(Ce){console.error("Error parsing WebSocket message:",Ce)}},de.onclose=Te=>{if(b(!1),console.log("Terminal WebSocket disconnected",Te.code,Te.reason),T.current&&(window.clearInterval(T.current),T.current=null),Te.code!==1e3&&y.current<_&&e){y.current++;const Ce=Math.min(1e3*Math.pow(2,y.current-1),1e4);console.log(`Attempting to reconnect (${y.current}/${_}) in ${Ce}ms`),E.current=window.setTimeout(()=>{W()},Ce)}else y.current>=_&&w("Connection lost. Please refresh the page to reconnect.")},de.onerror=Te=>{console.error("Terminal WebSocket error:",Te),y.current===0&&w("WebSocket connection failed")},de};W(),U.onData(ie=>{p.current?.readyState===WebSocket.OPEN&&p.current.send(JSON.stringify({type:"input",data:ie}))});const ae=()=>{q()},ne=new ResizeObserver(ae);c.current&&ne.observe(c.current),window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae);const K=()=>{document.visibilityState==="visible"&&(O&&clearTimeout(O),O=window.setTimeout(()=>{q()},50))};document.addEventListener("visibilitychange",K);let G=0;const Y=20,oe=()=>{const ie=c.current;if(ie){if(ee(ie)){te();return}G+=1,G<Y?F=requestAnimationFrame(oe):O=window.setTimeout(()=>{te()},100)}};return F=requestAnimationFrame(oe),()=>{ne.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),document.removeEventListener("visibilitychange",K),F&&cancelAnimationFrame(F),O&&clearTimeout(O),E.current&&(window.clearTimeout(E.current),E.current=null),T.current&&(window.clearInterval(T.current),T.current=null),p.current?.readyState===WebSocket.OPEN&&p.current.close(),L.current!==null&&(window.clearTimeout(L.current),L.current=null),U.dispose()}},[e,B]);const H=C.useCallback(()=>{d.current&&(d.current.scrollToBottom(),d.current.focus())},[]),P=C.useCallback(ee=>{p.current?.readyState===WebSocket.OPEN&&(p.current.send(JSON.stringify({type:"input",data:ee})),d.current&&d.current.focus())},[]),$=C.useCallback(ee=>{p.current?.readyState===WebSocket.OPEN&&(p.current.send(JSON.stringify({type:"input",data:ee})),d.current&&d.current.focus())},[]);return v?r.jsx("div",{className:"flex items-center justify-center h-full bg-red-50 border border-red-200 rounded-lg",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-red-600 font-medium",children:"Terminal Connection Error"}),r.jsx("div",{className:"text-red-500 text-sm mt-1",children:v})]})}):r.jsxs("div",{className:"relative h-full flex flex-col bg-[#1e1e1e] overflow-hidden",children:[!m&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1e1e1e] bg-opacity-95 z-10 backdrop-blur-sm",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),r.jsx("div",{className:"text-gray-300 mt-2",children:"Connecting to terminal..."})]})}),m&&S&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#1e1e1e] bg-opacity-50 z-10 transition-opacity duration-300 backdrop-blur-sm",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-pulse rounded-full h-6 w-6 bg-blue-500 mx-auto"}),r.jsx("div",{className:"text-gray-300 text-sm mt-2",children:"Loading terminal..."})]})}),r.jsx("div",{ref:c,className:"flex-1 w-full overflow-hidden",style:{minHeight:"400px"}}),o&&r.jsx(Wce,{onJumpToBottom:H,onSnippet:u||P,onSendKey:$})]})}const Yce="Consult the schema references in .nut/.schema (proposal.schema.md, project.schema.md, architecture.schema.md, agent.schema.md, knowledge.schema.md) so any updates you make follow the documented structure and include complete arrays for plan steps, dependencies, tags, labels, and comments.",Kce="Use .nut/context/project.md and .nut/context/architecture.md for reference.";function nC(e,t,n){const a=[`Review .nut/proposals/${e}.md and begin implementing.`,"Update the assignment to yourself (Coconut AI), the implementation steps (updated as you progress), and set the status upon completion to Code Complete.","Use .nut/context/project.md and .nut/context/architecture.md for reference and make any logical updates to those files upon completion of the proposal too.",Yce,`Lastly, please add notable comments to the proposal (.nut/proposals/${e}.md) from your chain-of-thought upon completion, particularly for ideas for future suggestions and/or improvements related to the proposal or wider project.`];return t.length>0&&a.push(`Please also use these agents: ${t.join(", ")}`),n&&n.trim()&&a.push(`Additional instruction: ${n.trim()}`),a}function rC(e,t){const n=[];return n.push(Kce),e.length>0&&n.push(`Please use these agents: ${e.join(", ")}`),t&&t.trim()&&n.push(`Additional instruction: ${t.trim()}`),n}const JR=e=>{const t=e.selectedAgentIds.map(h=>`.nut/agents/${h}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" "),s=[e.automationEnabled?"--dangerously-skip-permissions":""].filter(Boolean).join(" "),o=e.selectedMcpServers.map(h=>`'${h.replace(/'/g,"'\\''")}'`).join(","),u=[JSON.stringify(a)].concat(s?[JSON.stringify("--dangerously-skip-permissions")]:[]);return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${o}]);const c=require('./.nut/mcp/config.json');const o={mcpServers:Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)))};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('claude',[${u.join(",")}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Xce=e=>{const t=e.selectedAgentIds.map(c=>`.nut/agents/${c}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" ");return`node -e "${`const fs=require('fs'),path=require('path'),{spawn}=require('child_process');const s=new Set([${e.selectedMcpServers.map(c=>`'${c.replace(/'/g,"'\\''")}'`).join(",")}]);const c=require('./.nut/mcp/config.json');const geminiPath=path.join(require('os').homedir(),'.gemini','settings.json');let settings={};try{settings=JSON.parse(fs.readFileSync(geminiPath,'utf8'))}catch(e){}settings.mcpServers=Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)));fs.writeFileSync(geminiPath,JSON.stringify(settings,null,2));const p=spawn('gemini',['-i',${JSON.stringify(a)}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Zce=e=>{const t=e.selectedAgentIds.map(c=>`.nut/agents/${c}`),a=(e.contextType==="change-proposal"?nC(e.proposalId,t,e.customInstruction):rC(t,e.customInstruction)).join(" ");return`node -e "${`const fs=require('fs'),{spawn}=require('child_process');const s=new Set([${e.selectedMcpServers.map(c=>`'${c.replace(/'/g,"'\\''")}'`).join(",")}]);const c=require('./.nut/mcp/config.json');const o={mcpServers:Object.fromEntries(Object.entries(c.mcpServers||{}).filter(([k])=>s.has(k)))};fs.writeFileSync('.mcp.json',JSON.stringify(o,null,2));const p=spawn('codex',[${JSON.stringify(a)}],{stdio:'inherit'});p.on('exit',code=>process.exit(code));`.replace(/"/g,'\\"')}"`},Qce=e=>e?Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]:[];function Jce(){const{proposalId:e}=tc(),t=kr(),n=zn(),{toast:a}=In(),s=e?.startsWith("session-"),o=C.useMemo(()=>!!e&&e.startsWith("cp-"),[e]),u=C.useMemo(()=>!!e&&e.startsWith("ag-"),[e]),c=C.useMemo(()=>u&&e?e.replace("ag-","")+".md":null,[u,e]),{sessions:d,loading:h,error:p,createSession:m,destroySession:b,refreshSessions:v}=Qm(),[w,S]=C.useState([]),[g,y]=C.useState(null),[_,E]=C.useState(!1),[T,N]=C.useState(null),[k,L]=C.useState("claude"),[R,j]=C.useState(!1),[M,B]=C.useState("claude"),[H,P]=C.useState([]),[$,ee]=C.useState([]),[U,J]=C.useState([]),[X,F]=C.useState([]),[O,V]=C.useState(!1),[te,q]=C.useState(""),[W,ae]=C.useState(!1),[ne,K]=C.useState({}),[G,Y]=C.useState(null),oe=C.useRef([]),[ie,de]=C.useState("current"),[Te,Ce]=C.useState("main"),Ve=C.useMemo(()=>e?`terminal.cp.config.${e}`:null,[e]);C.useEffect(()=>{if(!(!o&&!u||!Ve))try{const Ae=localStorage.getItem(Ve);if(Ae){const fe=JSON.parse(Ae);fe.cliAgent&&B(fe.cliAgent),Array.isArray(fe.selectedMcpServers)&&ee(fe.selectedMcpServers),Array.isArray(fe.selectedAgentIds)&&F(fe.selectedAgentIds),typeof fe.automationEnabled=="boolean"&&V(fe.automationEnabled),typeof fe.customInstruction=="string"&&q(fe.customInstruction),typeof fe.createWorktree=="boolean"&&ae(fe.createWorktree),fe.branchMode&&de(fe.branchMode)}}catch{console.error("Failed to load config",Ve)}},[o,u,Ve]);const nt=C.useCallback(()=>{if(!Ve)return;const Ae={cliAgent:M,selectedMcpServers:$,selectedAgentIds:X,automationEnabled:O,customInstruction:te,createWorktree:W,branchMode:ie};try{localStorage.setItem(Ve,JSON.stringify(Ae))}catch{console.error("Failed to persist config",Ve)}},[Ve,M,$,X,O,te,W,ie]),Ie=Ae=>`feat/cp-${Ae.startsWith("cp-")?Ae.slice(3):Ae}`,$t=async Ae=>{try{const fe=Ie(Ae),Pe=await(await fetch(`${Re}/api/v1/git/branches`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:fe,from:Te})})).json();if(!Pe.success){const Qe=Pe.error?.message||"Unknown error";return a({title:"Branch creation failed",description:Qe,variant:"destructive"}),!1}return a({title:"Branch created",description:`Created branch: ${fe}`}),!0}catch{return a({title:"Branch creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}},kt=async Ae=>{try{const fe=Ie(Ae),Pe=await(await fetch(`${Re}/api/v1/git/worktrees`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:fe,from:Te})})).json();if(!Pe.success){const Qe=Pe.error?.message||"Unknown error";return a({title:"Worktree creation failed",description:Qe,variant:"destructive"}),!1}return a({title:"Worktree created",description:`Created branch: ${fe}`}),!0}catch{return a({title:"Worktree creation failed",description:"Network error or invalid response",variant:"destructive"}),!1}};C.useEffect(()=>{(o||u)&&e&&(async()=>{try{const fe=await fetch(`${Re}/api/v1/git/status`);if(fe.ok){const Pe=await fe.json();Pe?.success&&Pe.data?.branch&&Ce(Pe.data.branch)}const _e=await fetch(`${Re}/api/v1/mcp`);if(_e.ok){const Pe=await _e.json();Pe?.success&&Array.isArray(Pe.servers)&&(P(Pe.servers),ee(Qe=>Qe.filter(ut=>Pe.servers.includes(ut))),Pe.mcpServers&&typeof Pe.mcpServers=="object"&&K(Pe.mcpServers))}}catch(fe){console.error("Failed to load MCP servers",fe)}try{const fe=await fetch(`${Re}/api/v1/agents`);if(fe.ok){const _e=await fe.json(),Qe=(Array.isArray(_e?.documents)?_e.documents:[]).map(ut=>({id:ut.filename,name:ut?.metadata?.name||ut.title||ut.filename,tools:Qce(ut?.metadata?.tools)}));J(Qe),F(ut=>{const Wt=ut.filter(ht=>Qe.some(on=>on.id===ht));if(u&&c&&Wt.length===0){const ht=Qe.find(on=>on.id===c);if(ht)return[ht.id]}return Wt})}}catch(fe){console.error("Failed to load agents",fe)}})()},[o,u,e,c]),C.useEffect(()=>{const Ae=oe.current,fe=X.filter(_e=>!Ae.includes(_e));fe.length>0&&ee(_e=>{const Pe=new Set(_e),Qe=H.length>0?new Set(H):void 0;return fe.forEach(ut=>{const Wt=U.find(ht=>ht.id===ut);Wt&&Wt.tools.forEach(ht=>{(!Qe||Qe.has(ht))&&Pe.add(ht)})}),Array.from(Pe)}),oe.current=X},[X,U,H]),C.useEffect(()=>{e&&v(e)},[e,v]),C.useEffect(()=>{if(!e)return;const fe=d.filter(_e=>_e.proposalId===e).map(_e=>_e.id);S(fe),!g&&fe.length>0&&y(fe[0]),g&&!fe.includes(g)&&y(fe.length>0?fe[0]:null)},[d,e,g]);const St=async Ae=>{if(!e)return;const fe=Ae||void 0,_e=await m(e,_,fe);_e&&(y(_e),!fe&&Ae&&N(Ae),setTimeout(()=>v(e),100))},nn=Ae=>{const _e={proposalId:e,contextType:o?"change-proposal":u?"agent":"general",selectedMcpServers:$,selectedAgentIds:X,automationEnabled:O,customInstruction:te};switch(Ae){case"claude":return JR(_e);case"gemini":return Xce(_e);case"codex":return Zce(_e);default:return JR(_e)}},Mt=async()=>{o&&e&&(ie==="new-branch"?await $t(e)||console.warn("Branch creation failed, continuing with terminal creation"):ie==="new-worktree"&&(await kt(e)||console.warn("Worktree creation failed, continuing with terminal creation"))),o&&W&&ie==="current"&&e&&(await kt(e)||console.warn("Worktree creation failed, continuing with terminal creation"));const fe=nn(o||u?M:k);await St(fe)},wt=async Ae=>{if(await b(Ae)&&g===Ae){const _e=w.filter(Pe=>Pe!==Ae);y(_e.length>0?_e[0]:null)}},gn=Ae=>{wt(Ae)};return e?r.jsxs("div",{className:"flex flex-col h-full",children:[s&&w.length===0&&e&&r.jsx(eue,{proposalId:e,onStart:St,locationSearch:t.search}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-lg",children:o||u?r.jsx(yi,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):r.jsx(Ts,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:s?"Terminal":"Coding Agent Session"}),!s&&r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:e}),s&&r.jsxs("span",{className:"text-sm text-gray-500 font-mono",children:["(",e,")"]})]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center space-x-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg border",children:[r.jsx(ma,{id:"enable-logging",checked:_,onCheckedChange:Ae=>E(Ae===!0)}),r.jsx("label",{htmlFor:"enable-logging",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Log sessions"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>e&&v(e),disabled:h,className:"bg-white dark:bg-gray-800",children:[r.jsx(Ti,{className:`h-4 w-4 ${h?"animate-spin":""}`}),"Refresh"]}),!s&&!o&&!u&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(en,{value:k,onValueChange:L,children:[r.jsx(Xt,{className:"w-24",children:r.jsx(tn,{})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code"}),r.jsx(Me,{value:"gemini",children:"Google Gemini"}),r.jsx(Me,{value:"codex",children:"OpenAI Codex"})]})]}),r.jsxs(se,{onClick:Mt,disabled:h,size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Si,{className:"h-4 w-4 mr-2"}),"Start Coding"]})]}),!o&&!u&&r.jsxs(se,{onClick:()=>St(),disabled:h,size:"sm",children:[r.jsx(un,{className:"h-4 w-4 mr-2"}),"New Terminal"]})]})]})]}),p&&r.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-1.5 bg-red-100 dark:bg-red-900/40 rounded-lg flex-shrink-0",children:r.jsx(Cr,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),r.jsx("div",{className:"text-red-800 dark:text-red-200 text-sm font-medium",children:p})]})}),w.length>0&&r.jsx("div",{className:"flex items-center gap-1 border-b dark:border-gray-700",children:w.map(Ae=>{const fe=d.find(Pe=>Pe.id===Ae),_e=g===Ae;return r.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 border-b-1 cursor-pointer rounded-t-lg transition-all duration-200 ${_e?"border-gray-400 bg-white dark:bg-gray-800 dark:border-gray-500 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800 hover:border-gray-300"}`,onClick:()=>y(Ae),children:[r.jsx("div",{className:`p-1.5 rounded-md ${_e?"bg-gray-200 dark:bg-gray-700":"bg-gray-100 dark:bg-gray-700"}`,children:r.jsx(Ts,{className:`h-3.5 w-3.5 ${_e?"text-gray-700 dark:text-gray-300":"text-gray-600 dark:text-gray-400"}`})}),r.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Terminal ",Ae.split("-").slice(-1)[0].substring(0,6)]}),r.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${fe?.connected?"bg-green-500":"bg-gray-400"}`}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-md opacity-60 hover:opacity-100 transition-opacity",onClick:Pe=>{Pe.stopPropagation(),wt(Ae)},children:r.jsx(Cr,{className:"h-3 w-3"})})]},Ae)})}),r.jsx("div",{className:"flex-1 min-h-0",children:w.length===0?r.jsx(De,{className:"h-full border-0 shadow-lg",children:r.jsx(Fe,{className:"flex items-center justify-center h-full p-8",children:r.jsxs("div",{className:"text-center w-full max-w-[33vw] min-w-[400px]",children:[r.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full w-fit mx-auto mb-2",children:o||u?r.jsx(yi,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"}):r.jsx(Ts,{className:"h-8 w-8 text-gray-600 dark:text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Prepare Coding Agent"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6 leading-relaxed",children:s?"Create a new terminal session":`Configure the agent to start working on ${e}.`}),r.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!s&&!o&&!u&&r.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[r.jsxs("div",{className:"w-full space-y-3",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Choose your AI agent"}),r.jsxs(en,{value:k,onValueChange:L,children:[r.jsx(Xt,{className:"w-full h-11 bg-white dark:bg-gray-800",children:r.jsx(tn,{})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code (default)"}),r.jsx(Me,{value:"gemini",children:"Google Gemini"}),r.jsx(Me,{value:"codex",children:"OpenAI Codex"})]})]})]}),r.jsxs(se,{onClick:Mt,disabled:h,className:"bg-green-600 hover:bg-green-700 w-full h-11 text-base font-medium",size:"lg",children:[r.jsx(Si,{className:"h-5 w-5 mr-2"}),"Start Coding"]}),r.jsxs("div",{className:"flex items-center gap-3 w-full",children:[r.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"}),r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"or"}),r.jsx("div",{className:"flex-1 h-px bg-gray-300 dark:bg-gray-600"})]}),r.jsxs(se,{onClick:()=>St(),disabled:h,variant:"outline",className:"w-full h-11 bg-white dark:bg-gray-800",size:"lg",children:[r.jsx(un,{className:"h-5 w-5 mr-2"}),"New Terminal"]})]}),!s&&(o||u)&&r.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:[r.jsxs("div",{className:"flex gap-3 w-full",children:[r.jsxs(se,{variant:"outline",onClick:()=>j(!0),className:"flex-1 h-11 bg-white dark:bg-gray-800",size:"lg",children:[r.jsx($l,{className:"h-5 w-5 mr-2"}),"Configure"]}),r.jsxs(se,{onClick:Mt,disabled:h,className:"flex-1 bg-green-600 hover:bg-green-700 h-11 text-base font-medium",size:"lg",children:[r.jsx(Si,{className:"h-5 w-5 mr-2"}),"Start Coding"]})]}),r.jsxs("div",{className:"w-full space-y-3",children:[r.jsx("div",{className:"text-xs uppercase font-semibold text-gray-500 dark:text-gray-400",children:"Current Configuration"}),r.jsxs("div",{className:"text-left text-sm text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yi,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Coding Agent:"}),r.jsx("span",{className:"font-mono text-sm",children:M==="claude"?"Claude Code":M.charAt(0).toUpperCase()+M.slice(1)})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(xr,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Custom Agents:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:X.length?X.map(Ae=>{const fe=U.find(_e=>_e.id===Ae);return r.jsx(ot,{variant:"secondary",className:"font-mono text-xs",children:fe?.name||Ae},Ae)}):r.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fo,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400 mt-0.5"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"MCP Servers:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:$.length?$.map(Ae=>r.jsx(ot,{variant:"secondary",className:"font-mono text-xs",children:Ae},Ae)):r.jsx("span",{className:"font-mono text-sm text-gray-500",children:"None"})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wI,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Automation:"}),r.jsx("span",{className:"font-mono text-sm",children:O?"Enabled":"Disabled"})]}),o&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Na,{className:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:"Branch:"}),r.jsx("span",{className:"font-mono text-sm",children:ie==="current"?`Current (${Te})`:ie==="new-branch"?`New branch (${Ie(e||"")})`:`New worktree (${Ie(e||"")})`})]})]}),te&&r.jsxs("div",{className:"text-left text-sm bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[r.jsxs("div",{className:"font-medium text-blue-700 dark:text-blue-300 mb-1 flex items-center gap-2",children:[r.jsx(b2,{className:"h-3.5 w-3.5"}),"Custom Instructions"]}),r.jsx("div",{className:"text-gray-700 dark:text-gray-300 font-mono",children:te})]})]})]}),s&&r.jsx("div",{className:"p-6 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-900 w-full",children:r.jsxs(se,{onClick:()=>St(),disabled:h,className:"w-full h-11 text-base font-medium",size:"lg",children:[r.jsx(un,{className:"h-5 w-5 mr-2"}),"New Terminal"]})})]})]})})}):g?r.jsx("div",{className:"h-full overflow-hidden rounded-b-lg",children:r.jsx(Vce,{sessionId:g,onDestroy:()=>gn(g),pendingCommand:T,onCommandExecuted:()=>N(null),showToolbar:!0})}):null}),r.jsx($n,{open:R,onOpenChange:j,children:r.jsxs(Dn,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Cn,{children:[r.jsx(Tn,{children:"Configure Coding Agent"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Customize the coding agent's capabilities and configure it's environment."})]}),r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(yi,{className:"h-4 w-4"}),"Coding Agent"]}),r.jsxs(en,{value:M,onValueChange:Ae=>B(Ae),children:[r.jsx(Xt,{className:"w-full",children:r.jsx(tn,{placeholder:"Select coding agent"})}),r.jsxs(Zt,{children:[r.jsx(Me,{value:"claude",children:"Claude Code"}),r.jsx(Me,{value:"gemini",children:"Gemini"}),r.jsx(Me,{value:"codex",children:"Codex"})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(xr,{className:"h-4 w-4"}),"Custom Agents"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[X.length," of ",U.length," selected"]})]}),r.jsxs(Vl,{children:[r.jsx(Yl,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"w-full justify-between",children:[X.length===0?"Select agents...":X.length===U.length?"All agents selected":`${X.length} agent${X.length!==1?"s":""} selected`,r.jsx(Na,{className:"h-4 w-4 opacity-50"})]})}),r.jsxs(vo,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[r.jsxs(yo,{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Available Agents"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),F(U.map(fe=>fe.id))},children:"All"}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),F([])},children:"None"})]})]}),r.jsx(Eo,{}),U.length===0?r.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No agents found"}):U.map(Ae=>r.jsx(md,{checked:X.includes(Ae.id),onCheckedChange:fe=>{F(_e=>fe?_e.includes(Ae.id)?_e:[..._e,Ae.id]:_e.filter(Pe=>Pe!==Ae.id))},children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{children:Ae.name}),Ae.tools.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP servers: ",Ae.tools.join(", ")]}),Ae.tools.length===0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Inherits available MCP servers"})]})},Ae.id))]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(fo,{className:"h-4 w-4"}),"MCP Servers"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[$.length," of ",H.length," selected"]})]}),r.jsxs(Vl,{children:[r.jsx(Yl,{asChild:!0,children:r.jsxs(se,{variant:"outline",className:"w-full justify-between",children:[$.length===0?"Select MCP servers...":$.length===H.length?"All servers selected":`${$.length} server${$.length!==1?"s":""} selected`,r.jsx(Na,{className:"h-4 w-4 opacity-50"})]})}),r.jsxs(vo,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[r.jsxs(yo,{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Available Servers"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),ee(H)},children:"All"}),r.jsx(se,{size:"sm",variant:"ghost",className:"h-5 px-1 text-xs",onClick:Ae=>{Ae.preventDefault(),ee([])},children:"None"})]})]}),r.jsx(Eo,{}),H.length===0?r.jsx("div",{className:"px-2 py-1.5 text-sm text-gray-500",children:"No MCP servers found"}):H.map(Ae=>r.jsx(md,{checked:$.includes(Ae),onCheckedChange:fe=>{ee(_e=>fe?_e.includes(Ae)?_e:[..._e,Ae]:_e.filter(Pe=>Pe!==Ae))},children:Ae},Ae))]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(b2,{className:"h-4 w-4"}),"Additional instructions"]}),r.jsxs("div",{className:"text-xs text-gray-500",children:[te.length,"/500"]})]}),r.jsx("textarea",{className:"w-full min-h-[80px] rounded-md border p-3 text-sm bg-gray-50 dark:bg-gray-900/50 border-gray-300 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 resize-none",placeholder:"Add specific instructions to guide the coding agent...",value:te,onChange:Ae=>q(Ae.target.value),rows:3}),te.length>500&&r.jsx("div",{className:"text-xs text-red-600 mt-1",children:"Custom instruction is too long (max 500 characters)"})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-amber-50/50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800",children:[r.jsx(ma,{id:"automation",checked:O,onCheckedChange:Ae=>V(Ae===!0),className:"data-[state=checked]:bg-red-600 data-[state=checked]:border-red-600 data-[state=checked]:text-white border-red-400"}),r.jsx("label",{htmlFor:"automation",className:"text-sm font-medium text-red-600 dark:text-red-400 cursor-pointer",children:"Full environment access (recommended in containers only)"})]}),o&&r.jsx(Jw,{title:"Advanced Settings",description:"Configure branch and worktree options",defaultOpen:!1,children:r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(ve,{className:"text-sm font-medium mb-3 block",children:"Branch Management"}),r.jsxs(tC,{value:ie,onValueChange:Ae=>de(Ae),children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"current",id:"branch-current"}),r.jsxs(ve,{htmlFor:"branch-current",className:"cursor-pointer font-normal",children:["Stay on current branch (",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Te}),")"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"new-branch",id:"branch-new"}),r.jsxs(ve,{htmlFor:"branch-new",className:"cursor-pointer font-normal",children:["Create new branch: ",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Ie(e||"")})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Hl,{value:"new-worktree",id:"branch-worktree"}),r.jsxs(ve,{htmlFor:"branch-worktree",className:"cursor-pointer font-normal",children:["Create new worktree: ",r.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:Ie(e||"")})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(se,{variant:"outline",onClick:()=>j(!1),children:"Close"}),r.jsx(se,{onClick:()=>{if(te.length>500){Y("Please shorten the custom instruction to 500 characters.");return}Y(null),nt(),j(!1)},children:"Save"})]}),G&&r.jsx("div",{className:"text-xs text-red-600 text-right",children:G})]})]})})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-red-600 font-medium",children:"Invalid Proposal ID"}),r.jsx(se,{onClick:()=>n("/proposals"),className:"mt-4",children:"Back to Proposals"})]})})}function eue({proposalId:e,onStart:t,locationSearch:n}){return C.useEffect(()=>{if(!e)return;const a=new URLSearchParams(n);if(!a.has("autostart"))return;const s=`terminal.autostart.${e}`;if(sessionStorage.getItem(s)==="done")return;sessionStorage.setItem(s,"done");const u=a.get("run")||void 0;t(u||void 0)},[e]),null}let Cl;async function tue(){if(Cl!==void 0)return Cl;try{const e=await fetch(`${Re}/api/v1/config`);if(!e.ok)return Cl=null,null;const n=(await e.json())?.data||{},a=n?.coconut?.id||n?.cloud?.coconutId||n?.cloud?.coconut_id;return Cl=typeof a=="string"&&a.trim()?a.trim():null,Cl}catch(e){return console.error("[github-token] Failed to load Coconut ID",e),Cl=null,null}}async function nue(e){const t=await fetch(`${MB}/api/v1/git/token`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({coconutId:e})});if(!t.ok){let o="Failed to request GitHub token from control plane";if(t.status===401||t.status===403)throw new Error("Please sign in to app.coconut.dev and then retry the action.");try{const u=await t.json();o=u?.error?.message||u?.message||o}catch{}throw new Error(o)}const n=await t.json(),a=n?.token||n?.data?.token,s=n?.expiresAt||n?.data?.expiresAt;if(!a||!s)throw new Error("Control plane response missing token or expiresAt");return{token:a,expiresAt:s}}async function rue(e,t){const n=await fetch(`${Re}/api/v1/git/providers/github/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,expiresAt:t})}),a=await n.json().catch(()=>({}));if(!n.ok||!a?.success){const s=a?.error?.message||"Failed to store GitHub token on Coconut";throw new Error(s)}}async function h5(){const e=await tue();if(!e)throw new Error("Coconut ID not configured. Reconnect via Settings → Git.");const{token:t,expiresAt:n}=await nue(e);return await rue(t,n),{tokenFetched:!0,message:n}}function aue(){const e=zn(),{loading:t,createSession:n,refreshSessions:a}=Qm(),{toast:s}=In(),{refresh:o}=Ed(),[u,c]=C.useState(!1),[d,h]=C.useState(!1),[,p]=C.useState([]),[m,b]=C.useState({}),[v,w]=C.useState(null),[S,g]=C.useState(""),[y,_]=C.useState(!1),[E,T]=C.useState(!1),[N,k]=C.useState(!1),[L,R]=C.useState(null),[j,M]=C.useState("github"),[B,H]=C.useState(!1),[P,$]=C.useState(!1);C.useEffect(()=>{try{const W=localStorage.getItem("terminal.commandHistory");W&&p(JSON.parse(W))}catch{}},[]),C.useEffect(()=>{(async()=>{try{const ae=await fetch(`${Re}/api/v1/context/architecture`);if(!ae.ok)return;const ne=await ae.json();ne?.success&&ne?.document?.metadata?.commands&&b(ne.document.metadata.commands)}catch{}})()},[]),C.useEffect(()=>{ee()},[]);const ee=async()=>{_(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/status`)).json();ae?.success&&w(ae.data)}catch{}finally{_(!1)}},U=C.useCallback(async()=>{try{const ae=await(await fetch(`${Re}/api/v1/git/auth-status`)).json();ae?.success&&R(ae.data)}catch(W){console.error("Failed to load git auth status",W),R(null)}},[]);C.useEffect(()=>{U()},[U]),C.useEffect(()=>{(async()=>{try{const ne=await(await fetch(`${Re}/api/v1/git/settings`)).json();ne?.success&&ne.data?.authMode&&M(ne.data.authMode)}catch(ae){console.error("Failed to load git settings",ae)}})()},[]);const J=C.useCallback(async()=>{if(j!=="github"||L?.provider!=="github")return!0;const W=s({title:"Fetching GitHub token",description:"Contacting control plane…"});try{const{message:ae}=await h5();return s({title:"GitHub token ready",description:ae?`Valid until ${new Date(ae).toLocaleString()}`:"Token fetched successfully."}),R(ne=>({...ne,authenticated:!0,error:void 0,expiresAt:ae??ne?.expiresAt,provider:"github"})),!0}catch(ae){return s({title:"GitHub token unavailable",description:ae?.message?`${ae.message} Visit Settings → Git to reconnect.`:"Visit Settings → Git to reconnect.",variant:"destructive"}),!1}finally{W?.dismiss?.()}},[j,L?.provider,s]),X=W=>{W&&p(ae=>{const ne=[W,...ae.filter(K=>K!==W)].slice(0,5);try{localStorage.setItem("terminal.commandHistory",JSON.stringify(ne))}catch{}return ne})},F=async()=>{if(!(!S.trim()||!v||v.changes.length===0)){T(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/commits`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:S})})).json();if(!ae.success)throw new Error(ae.error?.message||"Commit failed");s({title:"Changes saved!",description:"Your work has been committed successfully"}),g(""),await ee(),await o()}catch(W){s({title:"Failed to save changes",description:W.message||"Please try again",variant:"destructive"})}finally{T(!1)}}},O=async()=>{if(!(j==="github"&&L?.provider==="github"&&!await J())){k(!0);try{const ae=await(await fetch(`${Re}/api/v1/git/push`,{method:"POST"})).json();if(!ae.success)throw new Error(ae.error?.message||"Push failed");s({title:"Uploaded successfully!",description:"Your changes are now on the server"}),await ee()}catch(W){s({title:"Upload failed",description:W.message||"Please check your connection",variant:"destructive"})}finally{k(!1),await U()}}},V=async()=>{$(!0);try{const W=`discard-${Date.now()}`;if(await n(W,!1,"git reset --hard && git clean -fd"))s({title:"All changes discarded",description:"Your workspace has been reset"}),H(!1),await ee(),await o();else throw new Error("Failed to discard changes")}catch(W){s({title:"Failed to discard changes",description:W.message||"Please try again",variant:"destructive"})}finally{$(!1)}},te=async W=>{const ae=(W||"").trim();if(!ae)return;const ne=`session-${Date.now()}`;c(!0);try{await n(ne,!1,ae)?(X(ae),s({title:"Session started",description:`${ne}`}),e(`/terminal/${ne}`)):s({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{c(!1)}},q=async W=>{const ae=(W||"").trim();if(!ae)return;const ne=`session-${Date.now()}`;h(!0);try{await n(ne,!1,ae)?(X(ae),setTimeout(()=>a(),150),s({title:"Started in background",description:`${ne}`,action:r.jsx(Gv,{altText:"Open session",onClick:()=>e(`/terminal/${ne}`),children:"Open"})})):s({title:"Failed to start",description:"See error above",variant:"destructive"})}finally{h(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(SI,{className:"h-6 w-6"}),r.jsx("h1",{className:"text-2xl font-bold",children:"Utilities"})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Quick Commands"}),r.jsxs(De,{children:[r.jsx(Ze,{className:"pb-2",children:r.jsx(et,{className:"text-sm font-medium text-gray-600",children:"Actions"})}),r.jsx(Fe,{children:m&&Object.keys(m).length>0&&r.jsx("div",{className:"space-y-2",children:r.jsx("div",{className:"rounded-md border divide-y",children:Object.entries(m).map(([W,ae])=>r.jsxs("div",{className:"flex items-center gap-3 p-2",children:[r.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium truncate",children:W}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsx("span",{className:"truncate max-w-full",children:r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-xs",children:ae})})]}),r.jsxs(se,{onClick:()=>q(ae),variant:"secondary",size:"sm",disabled:t||d||u,title:"Run in background",children:[r.jsx(hI,{className:"h-4 w-4 mr-1"})," Run in background"]}),r.jsxs(se,{onClick:()=>te(ae),size:"sm",disabled:t||u||d,title:"Run",children:[r.jsx(Si,{className:"h-4 w-4 mr-1"})," Run"]})]},W))})})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Quick Commit"}),r.jsxs(De,{children:[r.jsx(Ze,{className:"pb-3",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(se,{variant:"ghost",size:"sm",onClick:ee,disabled:y,children:r.jsx(Ti,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})})}),r.jsxs(Fe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r.jsx(rt,{to:"/git",className:"text-primary hover:underline font-medium",children:"Need more control? Go to Source Control →"})}),y?r.jsxs("div",{className:"text-center py-6 text-sm text-muted-foreground",children:[r.jsx(cn,{className:"h-5 w-5 animate-spin mx-auto mb-2"}),"Loading..."]}):v?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Working on:"}),r.jsx("span",{className:"font-mono font-semibold text-sm",children:v.branch})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[v.changes.length>0&&r.jsxs("span",{className:"px-2 py-1 rounded-full bg-blue-500/10 text-blue-600 font-medium",children:[v.changes.length," change",v.changes.length!==1?"s":""]}),v.ahead>0&&r.jsxs("span",{className:"px-2 py-1 rounded-full bg-amber-500/10 text-amber-600 font-medium",children:[v.ahead," unpushed"]}),v.changes.length>0&&r.jsx(rt,{to:"/git",className:"text-primary hover:underline font-medium",children:"View all"})]})]}),v.changes.length>0||v.ahead>0?r.jsx(r.Fragment,{children:r.jsxs("div",{className:"space-y-3",children:[v.changes.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Describe what you changed"}),r.jsx(je,{placeholder:"Updated the homepage, fixed login bug, etc.",value:S,onChange:W=>g(W.target.value),onKeyDown:W=>{W.key==="Enter"&&S.trim()&&!E&&F()},className:"w-full"})]}),r.jsxs("div",{className:"flex gap-2",children:[v.changes.length>0&&r.jsxs(se,{onClick:F,disabled:!S.trim()||E,className:"flex-1",children:[r.jsx(Cx,{className:"h-4 w-4 mr-2"}),E?"Saving...":"Save Changes"]}),v.ahead>0&&r.jsxs(se,{onClick:O,disabled:N,variant:v.changes.length>0?"secondary":"default",className:"flex-1",children:[r.jsx(_I,{className:"h-4 w-4 mr-2"}),N?"Uploading...":"Upload to Server"]})]}),v.changes.length>0&&r.jsx("div",{className:"pt-2 border-t",children:r.jsxs(se,{onClick:()=>H(!0),variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive hover:bg-destructive/10",children:[r.jsx(lr,{className:"h-3.5 w-3.5 mr-2"}),"Discard All Changes"]})})]})}):r.jsxs("div",{className:"text-center py-6 rounded-lg bg-muted/20",children:[r.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"✨ All caught up!"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"No changes to save right now"})]})]}):r.jsx("div",{className:"text-center py-6 rounded-lg bg-muted/20",children:r.jsx("div",{className:"text-sm text-muted-foreground",children:"Git not available or not in a repository"})})]})]})]}),r.jsx(Ri,{open:B,onOpenChange:H,children:r.jsxs(Rs,{children:[r.jsxs(Ds,{children:[r.jsxs(Os,{className:"flex items-center gap-2",children:[r.jsx(G9,{className:"h-5 w-5 text-destructive"}),"Discard All Changes?"]}),r.jsxs(Ls,{className:"space-y-2",children:[r.jsx("p",{children:"This will permanently delete all your unsaved work and cannot be undone."}),r.jsx("p",{className:"font-medium",children:"Are you absolutely sure you want to do this?"})]})]}),r.jsxs(Is,{children:[r.jsx(Ms,{disabled:P,children:"Cancel"}),r.jsx(js,{onClick:V,disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Discarding...":"Yes, Discard Everything"})]})]})})]})}function sue(){const e=zn(),{sessions:t,loading:n,error:a,refreshSessions:s}=Qm(),[o,u]=C.useState([]),[c,d]=C.useState(!0),[h,p]=C.useState({}),m=w=>{const S=Date.now(),g=new Date(w).getTime(),y=Math.max(0,Math.floor((S-g)/1e3));if(y<60)return`${y}s ago`;const _=Math.floor(y/60);if(_<60)return`${_}m ago`;const E=Math.floor(_/60);return E<24?`${E}h ago`:`${Math.floor(E/24)}d ago`};C.useEffect(()=>{(async()=>{try{const S=await fetch(`${Re}/api/v1/proposals`);if(S.ok){const g=await S.json(),y=g.data||g;u(Array.isArray(y)?y:[])}}catch(S){console.error("Error loading proposals:",S)}finally{d(!1)}})()},[]),C.useEffect(()=>{s()},[s]);const b=C.useMemo(()=>t.filter(w=>w.proposalId?.startsWith("cp-")||w.proposalId?.startsWith("ag-")).sort((w,S)=>new Date(S.lastActivity).getTime()-new Date(w.lastActivity).getTime()),[t]),v=C.useMemo(()=>o.filter(w=>w.status==="approved"||w.status==="code-complete").sort((w,S)=>new Date(S.metadata.createdAt).getTime()-new Date(w.metadata.createdAt).getTime()).slice(0,10),[o]);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yi,{className:"h-6 w-6"}),r.jsx("h1",{className:"text-2xl font-bold",children:"Code"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs(se,{variant:"outline",onClick:()=>s(),disabled:n,children:[r.jsx(Ti,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})})]}),a&&r.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:r.jsx("div",{className:"text-red-600",children:a})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Sessions"}),n?r.jsx("div",{className:"space-y-2",children:[...Array(2)].map((w,S)=>r.jsx(De,{className:"p-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-4 w-4 rounded bg-muted animate-pulse"}),r.jsxs("div",{children:[r.jsx("div",{className:"h-4 w-40 bg-muted rounded animate-pulse mb-2"}),r.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse"})]})]}),r.jsx("div",{className:"h-6 w-20 bg-muted rounded animate-pulse"})]})},S))}):b.length===0?r.jsx(De,{className:"p-4",children:r.jsx("div",{className:"text-sm text-muted-foreground",children:"No active sessions"})}):r.jsx("div",{className:"space-y-2",children:b.slice(0,10).map(w=>r.jsxs(De,{className:"p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:w.proposalId}),r.jsxs("div",{className:"text-xs text-gray-500",children:["Session ",w.id.split("-").slice(-1)[0].substring(0,8)," • Last activity ",m(w.lastActivity)]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`flex items-center gap-1 ${w.connected?"text-green-600":"text-gray-400"}`,title:w.connected?"Connected":"Disconnected",children:r.jsx("div",{className:`w-2 h-2 rounded-full ${w.connected?"bg-green-500":"bg-gray-400"}`})}),r.jsx(se,{size:"sm",variant:"outline",onClick:()=>e(`/terminal/${w.proposalId}`),children:"Open"})]})]}),h[w.id]&&r.jsx("div",{className:"mt-2 w-full",children:r.jsx(ZM,{sessionId:w.id,heightPx:160,maxScrollback:200})}),r.jsx("div",{className:"mt-2 flex justify-center",children:r.jsx(se,{size:"icon",variant:"ghost",className:"h-6 w-6 text-muted-foreground",onClick:()=>{p(S=>({...S,[w.id]:!S[w.id]}))},"aria-label":h[w.id]?"Hide preview":"Show preview",title:h[w.id]?"Hide preview":"Show preview",children:h[w.id]?r.jsx(Wp,{className:"h-4 w-4"}):r.jsx(Na,{className:"h-4 w-4"})})})]},w.id))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Recent Approved / Code Complete Proposals"}),c?r.jsx("div",{className:"space-y-3",children:[...Array(3)].map((w,S)=>r.jsx(De,{children:r.jsx(Ze,{className:"py-3",children:r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"h-4 bg-muted rounded w-2/3 animate-pulse"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"})]}),r.jsx("div",{className:"h-5 bg-muted rounded w-16 animate-pulse"})]})})},S))}):v.length===0?r.jsx(De,{children:r.jsx(Fe,{className:"flex items-center justify-center py-6",children:r.jsx("div",{className:"text-center text-sm text-gray-500",children:"No approved or code complete proposals found"})})}):r.jsx("div",{className:"space-y-2",children:v.map(w=>r.jsx(De,{className:"hover:shadow-sm transition-shadow",children:r.jsx(Fe,{className:"py-4",children:r.jsx("div",{className:"flex justify-between items-start gap-4",children:r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(et,{className:"text-base leading-tight",children:w.intent}),r.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[w.priority&&r.jsx(ot,{variant:w.priority==="high"||w.priority==="critical"?"destructive":w.priority==="medium"?"secondary":"outline",className:"text-xs",children:w.priority}),r.jsx(ot,{variant:"default",className:"text-xs",children:w.status})]})]}),w.content&&r.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[w.content.split(`
850
850
  `).slice(0,2).join(" ").substring(0,150),w.content.length>150?"...":""]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"text-xs text-muted-foreground",children:[w.id," • by ",w.author.name," • ",new Date(w.metadata.createdAt).toLocaleDateString()]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:"ghost",size:"sm",onClick:()=>e(`/proposals/${w.id}`),className:"h-7 px-2 text-xs",children:[r.jsx(xa,{className:"h-3 w-3 mr-1"})," View"]}),r.jsxs(se,{variant:"ghost",size:"sm",onClick:()=>e(`/proposals/${w.id}/edit`),className:"h-7 px-2 text-xs",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"})," Edit"]}),r.jsxs(se,{variant:"secondary",size:"sm",onClick:()=>e(`/terminal/${w.id}`),className:"h-7 px-3 text-xs",children:[r.jsx(Ts,{className:"h-3 w-3 mr-1"})," Code"]})]})]})]})})})},w.id))})]})]})}async function Di(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}if(document.execCommand){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{const n=document.execCommand("copy");if(document.body.removeChild(t),!n)throw new Error("execCommand failed")}catch{throw document.body.removeChild(t),new Error("Fallback copy failed")}return}throw new Error("Clipboard API not available")}const aC="https://registry.coconut.dev";async function f5(e){const t=e.startsWith("http")?e:`${aC}${e}`,n=await fetch(t,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!n.ok)throw new Error(`Failed to fetch registry resource: ${n.status}`);return n.json()}async function iue(e){const t=`/registry/${e}/root.json`;return f5(t)}async function p5(e){return f5(e)}const oue="Browse Registry",lue="Import";function m5({open:e,categoryId:t,onOpenChange:n,title:a=oue,confirmLabel:s=lue,filterTags:o,onConfirm:u,getDetail:c,renderPreview:d}){const[h,p]=C.useState([]),[m,b]=C.useState(!1),[v,w]=C.useState(null),[S,g]=C.useState(null),[y,_]=C.useState({}),[E,T]=C.useState(!1),[N,k]=C.useState(null),[L,R]=C.useState(""),[j,M]=C.useState(!1);C.useEffect(()=>{if(!e)return;b(!0),w(null),g(null),k(null),T(!1),_({}),R("");const U=Array.isArray(t)?t:[t];Promise.all(U.map(J=>iue(J))).then(J=>{const X=J.flatMap(F=>F.elements??[]);p(X)}).catch(J=>{console.error("Failed to load registry category",J),p([]),w("Failed to load registry entries")}).finally(()=>b(!1))},[e,t]);const B=C.useMemo(()=>{let U=h;if(o&&o.length>0&&(U=U.filter(X=>{const F=X.tags??[];return o.some(O=>F.some(V=>V.toLowerCase()===O.toLowerCase()))})),!L.trim())return U;const J=L.trim().toLowerCase();return U.filter(X=>[X.name,X.description,X.preview,...X.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(J))},[h,L,o]),H=C.useMemo(()=>S?h.find(U=>U.id===S)??null:null,[h,S]),P=C.useMemo(()=>S?y[S]?.detail??null:null,[S,y]),$=async U=>{if(g(U.id),k(null),!y?.[U.id]?.detail){T(!0);try{const J=await c(U);_(X=>({...X??{},[U.id]:{detail:J,fetchedAt:Date.now()}}))}catch(J){console.error("Failed to load registry element detail",J),k("Unable to load detail for this entry")}finally{T(!1)}}},ee=async()=>{if(!(!H||!P)){M(!0);try{await u(H,P),n(!1)}catch(U){console.error("Failed to import registry element",U)}finally{M(!1)}}};return r.jsx($n,{open:e,onOpenChange:n,children:r.jsxs(Dn,{className:"max-w-5xl h-[80vh] flex flex-col",children:[r.jsx(Cn,{children:r.jsx(Tn,{children:a})}),r.jsx("div",{className:"flex flex-col gap-4",children:r.jsxs("div",{className:"relative",children:[r.jsx($v,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(je,{value:L,onChange:U=>R(U.target.value),placeholder:"Search registry entries",className:"pl-9"})]})}),r.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[r.jsx("div",{className:"w-1/3 border-r pr-3",children:m?r.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[r.jsx(cn,{className:"h-4 w-4 animate-spin mr-2"}),"Loading entries…"]}):v?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:v}):B.length===0?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"No entries found"}):r.jsx(Oa,{className:"h-full",children:r.jsx("div",{className:"space-y-1 pb-4",children:B.map(U=>r.jsxs("button",{onClick:()=>$(U),className:Ne("w-full rounded-md border border-transparent p-3 text-left transition-colors hover:border-border hover:bg-muted/40",S===U.id&&"border-primary bg-muted"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium",children:U.name}),r.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:U.description||U.preview})]}),U.version&&r.jsxs(ot,{variant:"outline",className:"text-[10px] font-medium uppercase",children:["v",U.version]})]}),U.tags&&U.tags.length>0&&r.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[U.tags.slice(0,4).map(J=>r.jsx(ot,{variant:"secondary",className:"text-[10px] font-normal",children:J},J)),U.tags.length>4&&r.jsxs(ot,{variant:"outline",className:"text-[10px] font-normal",children:["+",U.tags.length-4]})]})]},U.id))})})}),r.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:E?r.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[r.jsx(cn,{className:"h-5 w-5 animate-spin mr-2"}),"Loading detail…"]}):N?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:N}):H?r.jsx("div",{className:"h-full overflow-hidden",children:d(H,P)}):r.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an entry to preview"})})]}),r.jsxs(Tr,{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:H?`Selected: ${H.name}`:"No entry selected"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(se,{variant:"outline",onClick:()=>n(!1),disabled:j,children:"Cancel"}),r.jsx(se,{onClick:ee,disabled:!H||!P||j,children:j?"Importing…":s})]})]})]})})}const cue=["color","tools","createdAt","updatedAt","version","focusAreas","contextPreferences","tags"];function eD(e){if(e){if(Array.isArray(e)){const t=e.map(n=>{if(typeof n=="string")return n.trim();if(typeof n=="number")return`${n}`}).filter(n=>typeof n=="string"&&n.length>0);return t.length>0?t:void 0}if(typeof e=="string"){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}}}function uue(e,t){const n=[];if(e.content&&typeof e.content=="object")for(const o of Object.values(e.content))typeof o=="string"&&o.trim().length>0&&n.push(o.trim());const a=[];return a.push(`# ${t}`),e.description?.trim()&&a.push(e.description.trim()),[...a,...n].join(`
851
851
 
852
852
  `).trim()}function tD(e,t){const n=e.name||t.name,a=t.description||e.description||"",s={registryId:e.id,registryEndpoint:e.endpoint,registrySource:aC,author:e.author};for(const o of cue){const u=t[o];if(u!==void 0)if(o==="tools"||o==="focusAreas"||o==="contextPreferences"||o==="tags"){const c=eD(u);c&&(s[o]=c)}else s[o]=u}!s.version&&e.version&&(s.version=e.version),s.color||(s.color="blue"),!s.tags&&e.tags&&(s.tags=eD(e.tags));for(const[o,u]of Object.entries(s))u==null&&delete s[o];return{name:n,description:a,content:uue(t,n),metadata:Object.keys(s).length>0?s:void 0}}function nD({open:e,onOpenChange:t,onImport:n}){return r.jsx(m5,{open:e,onOpenChange:t,categoryId:"agents",title:"Coconut Registry – Agents",confirmLabel:"Import Agent",getDetail:a=>p5(a.endpoint),renderPreview:(a,s)=>{if(!s)return r.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an agent to preview"});const o=tD(a,s),u=o.metadata??{},c=typeof u.version=="string"?u.version:void 0,d=Array.isArray(a.tags)?a.tags:[],h=Array.isArray(u.tools)?u.tools.filter(m=>typeof m=="string"):[],p=Array.isArray(u.focusAreas)?u.focusAreas.filter(m=>typeof m=="string"):[];return r.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:r.jsx(Oa,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:a.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]}),c&&r.jsxs(ot,{variant:"outline",children:["v",c]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",r.jsx("span",{className:"font-mono",children:a.id})]}),d.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(m=>r.jsx(ot,{variant:"secondary",children:m},m))}),h.length>0&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"font-medium",children:"Tools:"}),h.map(m=>r.jsx(ot,{variant:"outline",children:m},m))]}),p.length>0&&r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-sm font-medium",children:"Focus Areas"}),r.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground",children:p.map(m=>r.jsx("li",{children:m},m))})]})]}),r.jsx(Ja,{className:"[&_.prose]:max-w-none",children:o.content})]})})})},onConfirm:async(a,s)=>{const o=tD(a,s);await n({summary:a,detail:s,payload:o})}})}const due=e=>e?Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]:[];function hue(){const[e,t]=C.useState([]),[n,a]=C.useState(!0),[s,o]=C.useState({}),[u,c]=C.useState(!1),[d,h]=C.useState(!1),{toast:p}=In(),m=C.useCallback(async()=>{a(!0);try{const w=await fetch(`${Re}/api/v1/agents`);if(!w.ok)throw new Error("Failed to load agents");const S=await w.json();t(Array.isArray(S.documents)?S.documents:[])}catch(w){console.error("Failed to load agents:",w),t([])}finally{a(!1)}},[]);C.useEffect(()=>{m()},[m]);const b=async w=>{const S=`.nut/agents/${w}`;try{await Di(S),o(g=>({...g,[w]:!0})),setTimeout(()=>{o(g=>({...g,[w]:!1}))},2e3),p({title:"Path copied!",description:`Copied ${S} to clipboard`})}catch(g){console.error("Failed to copy path:",g),p({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},v=C.useCallback(async({payload:w})=>{let S=!1;h(!0);try{const g=await fetch(`${Re}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w.name,description:w.description,content:w.content,metadata:w.metadata})});let y=null;try{y=await g.json()}catch(E){console.error("Failed to parse registry import response:",E)}if(!(g.ok&&y?.success)){const T=(typeof y?.error=="string"?y.error:y?.error?.message)||g.statusText||"Failed to import agent from registry";throw p({title:"Failed to import agent",description:T,variant:"destructive"}),S=!0,new Error(T)}p({title:"Agent imported",description:`${w.name} is now available in Coconut`}),await m()}catch(g){if(!S){const y=g instanceof Error&&g.message?g.message:"Failed to import agent from registry";p({title:"Failed to import agent",description:y,variant:"destructive"})}throw g}finally{h(!1)}},[m,p]);return n?r.jsx("div",{className:"space-y-6",children:r.jsx(De,{children:r.jsx(Fe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-center",children:[r.jsx(cn,{className:"h-8 w-8 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents..."})]})})})}):e.length===0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage agents for your development workflows"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",onClick:()=>c(!0),disabled:d,children:[r.jsx(cp,{className:"h-4 w-4"}),"Registry"]}),r.jsx(se,{asChild:!0,children:r.jsxs(rt,{to:"/agents/new",children:[r.jsx(un,{className:"w-4 h-4"}),"Create New"]})})]})]}),r.jsx(De,{children:r.jsx(Fe,{className:"pt-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(xr,{className:"mx-auto h-12 w-12 text-muted-foreground"}),r.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Agents Found"}),r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agent documents will appear here once they are created in .nut/agents/"})]})})})]}),r.jsx(nD,{open:u,onOpenChange:c,onImport:v})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Agents"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage agents for your development workflows"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{variant:"outline",onClick:()=>c(!0),disabled:d,children:[r.jsx(cp,{className:"h-4 w-4"}),"Registry"]}),r.jsx(se,{asChild:!0,children:r.jsxs(rt,{to:"/agents/new",children:[r.jsx(un,{className:"w-4 h-4"}),"Create New"]})})]})]}),r.jsx("div",{className:"grid gap-4",children:e.map(w=>{const S=due(w.metadata.tools);return r.jsx(rt,{to:`/agents/${w.filename.replace(".md","")}`,className:"block",children:r.jsxs(De,{className:"group hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:[r.jsx(Ze,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(et,{className:"text-lg",children:w.title}),r.jsx(se,{variant:"ghost",size:"sm",onClick:g=>{g.preventDefault(),b(w.filename)},className:"h-6 w-6 p-0 hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy file path to clipboard",children:s[w.filename]?r.jsx(So,{className:"w-3 h-3 text-green-600"}):r.jsx(Ps,{className:"w-3 h-3"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground font-mono bg-muted/50 px-2 py-1 rounded inline-block cursor-pointer hover:bg-muted/70 transition-colors",onClick:g=>{g.preventDefault(),b(w.filename)},title:"Click to copy file path to clipboard",children:[".nut/agents/",w.filename]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(EI,{className:"w-3 h-3"}),w.metadata.color||"blue"]}),S.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(xr,{className:"w-3 h-3"}),S.join(", ")]})]})]}),w.metadata.color&&r.jsx(ot,{variant:"secondary",className:`bg-${w.metadata.color}-100 text-${w.metadata.color}-800`,children:w.metadata.color})]})}),r.jsx(Fe,{children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:w.metadata.description})})})})]})},w.filename)})})]}),r.jsx(nD,{open:u,onOpenChange:c,onImport:v})]})}const fue=e=>e?Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]:[];function pue(){const e=tc(),t=zn(),[n,a]=C.useState(null),[s,o]=C.useState(!0),[u,c]=C.useState(null);C.useEffect(()=>{async function p(){try{o(!0);const b=await(await fetch(`${Re}/api/v1/agents/${e.id}`)).json();b.success?a(b.document):c(b.error||"Failed to fetch agent")}catch(m){c(m instanceof Error?m.message:"Unknown error")}finally{o(!1)}}e.id&&p()},[e.id]);const d=async()=>{if(!(!n||!confirm("Are you sure you want to delete this agent?")))try{const m=await(await fetch(`${Re}/api/v1/agents/${n.filename.replace(".md","")}`,{method:"DELETE"})).json();m.success?t("/agents"):c(m.error?.message||"Failed to delete agent")}catch(p){c(p instanceof Error?p.message:"Unknown error")}};if(s)return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"h-8 bg-muted rounded w-64 animate-pulse"}),r.jsx("div",{className:"h-4 bg-muted rounded w-32 animate-pulse mt-2"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(se,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:r.jsx(rt,{to:"/agents",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(tr,{className:"h-4 w-4"})})})})]}),r.jsx(De,{children:r.jsxs(Ze,{children:[r.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"}),r.jsx("div",{className:"h-4 bg-muted rounded w-64 animate-pulse"})]})})]});if(u||!n)return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Agent Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:"The requested agent could not be found"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(se,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:r.jsx(rt,{to:"/agents",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(tr,{className:"h-4 w-4"})})})})]}),r.jsx(De,{children:r.jsx(Fe,{className:"pt-6",children:r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-destructive",children:u||"Agent not found"})})})})]});const h=fue(n.metadata.tools);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center gap-4",children:r.jsx("div",{children:r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:n.metadata.name})})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(se,{variant:"ghost",size:"sm",asChild:!0,children:r.jsx(rt,{to:"/agents",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(tr,{className:"h-4 w-4"})})}),r.jsx(se,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs(rt,{to:`/agents/${n.filename.replace(".md","")}/edit`,children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Edit"]})}),r.jsxs(se,{variant:"outline",size:"sm",onClick:d,children:[r.jsx(lr,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(De,{children:[r.jsx(Ze,{children:r.jsx(et,{children:"Description"})}),r.jsx(Fe,{children:r.jsx("p",{children:n.metadata.description})})]}),n.content&&r.jsxs(De,{children:[r.jsxs(Ze,{children:[r.jsx(et,{children:"Instructions"}),r.jsx(jt,{children:"System prompt and behavior instructions for this agent"})]}),r.jsx(Fe,{children:r.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted p-4 rounded-md",children:n.content})})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(De,{children:[r.jsx(Ze,{children:r.jsx(et,{children:"Agent Actions"})}),r.jsx(Fe,{className:"space-y-2",children:r.jsx(se,{variant:"default",className:"w-full justify-start",asChild:!0,children:r.jsxs(rt,{to:`/terminal/ag-${n.filename.replace(".md","")}`,children:[r.jsx(xr,{className:"h-4 w-4 mr-2"}),"Prepare Agent"]})})})]}),r.jsxs(De,{children:[r.jsx(Ze,{children:r.jsx(et,{children:"Information"})}),r.jsxs(Fe,{className:"space-y-2",children:[n.metadata.color&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Color"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.metadata.color})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Tools"}),h.length>0?r.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:h.map(p=>r.jsx(ot,{variant:"secondary",children:p},p))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No specific tools configured - inherits all tools"})]})]})]})]})]})]})}function mue(){const e=zn(),[t,n]=C.useState(!1),[a,s]=C.useState(null),[o,u]=C.useState(""),[c,d]=C.useState(""),[h,p]=C.useState([]),[m,b]=C.useState(""),[v,w]=C.useState([]),[S,g]=C.useState(!0);C.useEffect(()=>{let E=!0;return(async()=>{g(!0);try{const N=await fetch(`${Re}/api/v1/mcp`);if(!N.ok)throw new Error("Failed to fetch MCP servers");const k=await N.json();if(!k?.success||!Array.isArray(k.servers)){E&&w([]);return}const L=k.mcpServers&&typeof k.mcpServers=="object"?k.mcpServers:{},R=k.servers.map(j=>{const M=L[j]??{};return{name:j,enabled:M?.enabled!==!1,description:typeof M?.description=="string"?M.description:void 0}});E&&(w(R),p(j=>j.filter(M=>R.some(B=>B.name===M))))}catch(N){console.error("Failed to load MCP servers",N),E&&w([])}finally{E&&g(!1)}})(),()=>{E=!1}},[]);const y=E=>{p(h.filter(T=>T!==E))},_=async E=>{if(E.preventDefault(),!o.trim()||!c.trim()){s("Name and description are required");return}try{n(!0),s(null);const T={name:o.trim(),description:c.trim(),content:m.trim()||"",metadata:{tools:h.length>0?h:void 0}},k=await(await fetch(`${Re}/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})).json();k.success?e("/agents"):s(k.error?.message||"Failed to create agent")}catch(T){s(T instanceof Error?T.message:"Unknown error")}finally{n(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(se,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs(rt,{to:"/agents",children:[r.jsx(tr,{className:"h-4 w-4 mr-2"}),"Back to Agents"]})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Create New Agent"}),r.jsx("p",{className:"text-muted-foreground",children:"Define an AI agent for automated development workflows"})]})]}),r.jsxs(De,{children:[r.jsx(Ze,{children:r.jsxs(et,{className:"flex items-center gap-2",children:[r.jsx(xr,{className:"h-5 w-5"}),"Agent Configuration"]})}),r.jsx(Fe,{children:r.jsxs("form",{onSubmit:_,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"name",children:"Name *"}),r.jsx(je,{id:"name",placeholder:"e.g., code-reviewer",value:o,onChange:E=>u(E.target.value),disabled:t})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"description",children:"Description *"}),r.jsx(je,{id:"description",placeholder:"When should this agent be invoked?",value:c,onChange:E=>d(E.target.value),disabled:t})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{children:"Tools (Optional)"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this agent should be able to use. Leave empty to inherit all available servers."}),r.jsx("div",{className:"space-y-2",children:S?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):v.length===0?r.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):v.map(E=>r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[r.jsx(ma,{checked:h.includes(E.name),onCheckedChange:T=>{p(N=>T===!0?N.includes(E.name)?N:[...N,E.name]:N.filter(k=>k!==E.name))},disabled:t||!E.enabled}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("span",{className:"text-sm font-medium",children:[E.name,!E.enabled&&r.jsx(ot,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:E.enabled?E.description||"Enabled MCP server":"Enable this server in Settings to allow agents to use it"})]})]},E.name))}),h.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:h.map(E=>r.jsxs(ot,{variant:"secondary",className:"flex items-center gap-1",children:[E,r.jsx("button",{type:"button",onClick:()=>y(E),className:"ml-1 hover:text-destructive",disabled:t,children:r.jsx(Cr,{className:"h-3 w-3"})})]},E))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"content",children:"Agent Instructions (Optional)"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"System prompt or instructions for this agent's behavior."}),r.jsx(wr,{id:"content",placeholder:"You are a code review agent that focuses on...",value:m,onChange:E=>b(E.target.value),rows:8,disabled:t})]}),a&&r.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:a}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(se,{type:"button",variant:"outline",asChild:!0,disabled:t,children:r.jsx(rt,{to:"/agents",children:"Cancel"})}),r.jsx(se,{type:"submit",disabled:t,children:t?"Creating...":"Create Agent"})]})]})})]})]})}function gue(){const{id:e}=tc(),t=zn(),[n,a]=C.useState(!0),[s,o]=C.useState(!1),[u,c]=C.useState(null),[d,h]=C.useState(""),[p,m]=C.useState(""),[b,v]=C.useState(""),[w,S]=C.useState([]),[g,y]=C.useState(""),[_,E]=C.useState([]),[T,N]=C.useState(!0),k=j=>{if(!j)return[];if(Array.isArray(j)){const M=j.filter(B=>typeof B=="string").map(B=>B.trim()).filter(Boolean);return Array.from(new Set(M))}return typeof j=="string"?Array.from(new Set(j.split(",").map(M=>M.trim()).filter(Boolean))):[]};C.useEffect(()=>{async function j(){try{a(!0);const B=await(await fetch(`${Re}/api/v1/agents/${e}`)).json();if(!B.success)throw new Error(B.error||"Failed to load agent");const H=B.document;h(H.filename),m(H.metadata.name||""),v(H.metadata.description||""),y(H.content||""),S(k(H.metadata.tools))}catch(M){const B=M instanceof Error?M.message:"Failed to load agent";c(B)}finally{a(!1)}}e&&j()},[e]),C.useEffect(()=>{let j=!0;return(async()=>{N(!0);try{const B=await fetch(`${Re}/api/v1/mcp`);if(!B.ok)throw new Error("Failed to fetch MCP servers");const H=await B.json();if(!H?.success||!Array.isArray(H.servers)){j&&E([]);return}const P=H.mcpServers&&typeof H.mcpServers=="object"?H.mcpServers:{},$=H.servers.map(ee=>{const U=P[ee]??{};return{name:ee,enabled:U?.enabled!==!1,description:typeof U?.description=="string"?U.description:void 0}});j&&E($)}catch(B){console.error("Failed to load MCP servers",B),j&&E([])}finally{j&&N(!1)}})(),()=>{j=!1}},[]);const L=j=>{S(M=>M.filter(B=>B!==j))},R=async j=>{if(j.preventDefault(),!p.trim()||!b.trim()){c("Name and description are required");return}try{o(!0),c(null);const M={name:p.trim(),description:b.trim(),content:g,metadata:{tools:w.length?w:void 0}},H=await(await fetch(`${Re}/api/v1/agents/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)})).json();if(!H.success)throw new Error(H.error||"Failed to update agent");const $=H.document.filename.replace(/\.md$/,"");t(`/agents/${$}`)}catch(M){const B=M instanceof Error?M.message:"Failed to update agent";c(B)}finally{o(!1)}};return n?r.jsx("div",{className:"space-y-6",children:r.jsx(De,{children:r.jsx(Fe,{className:"pt-6",children:"Loading agent..."})})}):u?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),r.jsx("p",{className:"text-muted-foreground",children:"Unable to load agent"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(se,{variant:"ghost",size:"sm",asChild:!0,children:r.jsx(rt,{to:`/agents/${e}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(tr,{className:"h-4 w-4"})})})})]}),r.jsx(De,{children:r.jsx(Fe,{className:"pt-6",children:r.jsx("div",{className:"text-destructive",children:u})})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Agent"}),r.jsxs("p",{className:"text-muted-foreground",children:["File: ",d]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(se,{variant:"ghost",size:"sm",asChild:!0,children:r.jsx(rt,{to:`/agents/${e}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(tr,{className:"h-4 w-4"})})})})]}),r.jsxs(De,{children:[r.jsx(Ze,{children:r.jsxs(et,{className:"flex items-center gap-2",children:[r.jsx(xr,{className:"h-5 w-5"}),"Agent Configuration"]})}),r.jsx(Fe,{children:r.jsxs("form",{onSubmit:R,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"name",children:"Name *"}),r.jsx(je,{id:"name",value:p,onChange:j=>m(j.target.value),disabled:s})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"description",children:"Description *"}),r.jsx(je,{id:"description",value:b,onChange:j=>v(j.target.value),disabled:s})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{children:"Tools (Optional)"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this agent should be able to use. Leave empty to inherit all available servers."}),r.jsx("div",{className:"space-y-2",children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers…"}):_.length===0?r.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):_.map(j=>r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[r.jsx(ma,{checked:w.includes(j.name),onCheckedChange:M=>{S(B=>M===!0?B.includes(j.name)?B:[...B,j.name]:B.filter(H=>H!==j.name))},disabled:s||!j.enabled}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("span",{className:"text-sm font-medium",children:[j.name,!j.enabled&&r.jsx(ot,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:j.enabled?j.description||"Enabled MCP server":"Enable this server in Settings to allow agents to use it"})]})]},j.name))}),w.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(j=>r.jsxs(ot,{variant:"secondary",className:"flex items-center gap-1",children:[j,r.jsx("button",{type:"button",onClick:()=>L(j),className:"ml-1 hover:text-destructive",disabled:s,children:r.jsx(Cr,{className:"h-3 w-3"})})]},j))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"content",children:"Agent Instructions (Optional)"}),r.jsx(wr,{id:"content",value:g,onChange:j=>y(j.target.value),rows:8,disabled:s})]}),u&&r.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:u}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(se,{type:"button",variant:"outline",asChild:!0,disabled:s,children:r.jsx(rt,{to:`/agents/${e}`,children:"Cancel"})}),r.jsx(se,{type:"submit",disabled:s,children:s?"Saving...":"Save Changes"})]})]})})]})]})}function bue(){const[e,t]=C.useState([]),[n,a]=C.useState(!0),[s,o]=C.useState(!1),[u,c]=C.useState(""),[d,h]=C.useState(!1),[p,m]=C.useState(""),[b,v]=C.useState(""),w=C.useRef(null),{toast:S}=In();C.useEffect(()=>{g()},[]);const g=async()=>{try{a(!0);const M=await(await fetch(`${Re}/api/v1/resources`)).json();M.success&&t(M.data||[])}catch(j){console.error("Failed to fetch resources:",j)}finally{a(!1)}},y=async j=>{if(j.length!==0){o(!0);try{for(const M of Array.from(j)){const B=new FormData;if(B.append("file",M),B.append("tags",p),B.append("description",b),!(await fetch(`${Re}/api/v1/resources`,{method:"POST",body:B})).ok)throw new Error("Upload failed")}m(""),v(""),h(!1),await g()}catch(M){console.error("Upload failed:",M)}finally{o(!1)}}},_=async j=>{if(confirm("Are you sure you want to delete this resource?"))try{(await fetch(`${Re}/api/v1/resources/${j}`,{method:"DELETE"})).ok&&await g()}catch(M){console.error("Failed to delete resource:",M)}},E=async j=>{try{const M=`.nut/resources/files/${j.path}`;await Di(M),S({title:"Path copied!",description:`Copied ${M} to clipboard`})}catch(M){console.error("Failed to copy path:",M),S({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},T=j=>{if(j===0)return"0 B";const M=1024,B=["B","KB","MB","GB"],H=Math.floor(Math.log(j)/Math.log(M));return parseFloat((j/Math.pow(M,H)).toFixed(2))+" "+B[H]},N=j=>j.startsWith("image/")?r.jsx(VU,{className:"h-4 w-4"}):j.includes("text")||j.includes("document")?r.jsx(xa,{className:"h-4 w-4"}):r.jsx(wx,{className:"h-4 w-4"}),k=e.filter(j=>{if(!u)return!0;const M=u.toLowerCase();return j.name.toLowerCase().includes(M)||j.metadata.description?.toLowerCase().includes(M)||j.metadata.tags?.some(B=>B.toLowerCase().includes(M))}),L=j=>{j.preventDefault(),j.stopPropagation()},R=j=>{j.preventDefault(),j.stopPropagation(),j.dataTransfer.files&&j.dataTransfer.files.length>0&&y(j.dataTransfer.files)};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Resources"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage files and resources for your project"})]}),r.jsxs(se,{onClick:()=>h(!d),children:[r.jsx(un,{className:"mr-2 h-4 w-4"}),"Add Resource"]})]}),d&&r.jsxs(De,{children:[r.jsxs(Ze,{children:[r.jsx(et,{children:"Upload Resource"}),r.jsx(jt,{children:"Add files to your project resources"})]}),r.jsxs(Fe,{className:"space-y-4",children:[r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-muted-foreground/50 transition-colors",onDragOver:L,onDrop:R,onClick:()=>w.current?.click(),children:[r.jsx(_I,{className:"mx-auto h-8 w-8 text-muted-foreground"}),r.jsx("p",{className:"mt-2 text-sm font-medium",children:"Drop files here or click to browse"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Support for images, documents, and other files"})]}),r.jsx("input",{ref:w,type:"file",multiple:!0,className:"hidden",onChange:j=>j.target.files&&y(j.target.files)}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(je,{id:"tags",placeholder:"design, wireframes, mockups",value:p,onChange:j=>m(j.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ve,{htmlFor:"description",children:"Description"}),r.jsx(wr,{id:"description",placeholder:"Brief description of this resource...",value:b,onChange:j=>v(j.target.value)})]})]})]})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx($v,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(je,{placeholder:"Search resources...",value:u,onChange:j=>c(j.target.value),className:"pl-8"})]})}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:n?Array.from({length:6}).map((j,M)=>r.jsxs(De,{className:"animate-pulse",children:[r.jsxs(Ze,{children:[r.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]}),r.jsx(Fe,{children:r.jsx("div",{className:"h-20 bg-muted rounded"})})]},M)):k.length>0?k.map(j=>r.jsxs(De,{className:"hover:shadow-lg transition-shadow",children:[r.jsxs(Ze,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[N(j.type),r.jsx(et,{className:"text-sm font-medium truncate",children:j.name})]}),r.jsxs(jt,{className:"text-xs",children:[T(j.size)," • ",new Date(j.uploadedAt).toLocaleDateString()]}),r.jsxs("div",{className:"flex justify-end space-x-1 mt-2",children:[r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>E(j),title:"Copy path to clipboard",children:r.jsx(Ps,{className:"h-3 w-3"})}),r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>window.open(`${Re}/api/v1/resources/${j.id}?download=true`),children:r.jsx(Hv,{className:"h-3 w-3"})}),r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_(j.id),children:r.jsx(lr,{className:"h-3 w-3"})})]})]}),r.jsxs(Fe,{className:"pt-0",children:[j.type.startsWith("image/")&&j.thumbnailPath&&r.jsx("div",{className:"mb-3",children:r.jsx("img",{src:`${Re}/api/v1/resources/${j.id}/thumbnail`,alt:j.name,className:"w-full h-32 object-cover rounded-md border",onError:M=>{M.currentTarget.style.display="none"}})}),j.metadata.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:j.metadata.description}),j.metadata.tags&&j.metadata.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:j.metadata.tags.map(M=>r.jsx(ot,{variant:"secondary",className:"text-xs",children:M},M))})]})]},j.id)):r.jsx("div",{className:"col-span-full",children:r.jsx(De,{children:r.jsxs(Fe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Kp,{className:"h-12 w-12 text-muted-foreground/50"}),r.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No resources yet"}),r.jsx("p",{className:"mt-2 text-sm text-muted-foreground text-center max-w-sm",children:"Upload files to get started. Resources can be referenced by LLMs and team members for enhanced context."}),r.jsxs(se,{className:"mt-4",onClick:()=>h(!0),children:[r.jsx(un,{className:"mr-2 h-4 w-4"}),"Add First Resource"]})]})})})}),s&&r.jsx("div",{className:"fixed bottom-4 right-4 bg-background border rounded-lg shadow-lg p-4",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary"}),r.jsx("span",{className:"text-sm",children:"Uploading files..."})]})})]})}const xue=["createdAt","updatedAt","version","tags"];function rD(e){if(e){if(Array.isArray(e)){const t=e.map(n=>{if(typeof n=="string")return n.trim();if(typeof n=="number")return`${n}`}).filter(n=>typeof n=="string"&&n.length>0);return t.length>0?t:void 0}if(typeof e=="string"){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}}}function vue(e,t){const n=[];if(e.content&&typeof e.content=="object")for(const o of Object.values(e.content))typeof o=="string"&&o.trim().length>0&&n.push(o.trim());const a=[];return a.push(`# ${t}`),e.description?.trim()&&a.push(e.description.trim()),[...a,...n].join(`