agent-afk 5.303.0 → 5.303.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/agent/daemon/scheduler.d.ts +2 -0
  2. package/dist/agent/daemon/scheduler.execute-agent-task.d.ts +9 -0
  3. package/dist/agent/daemon.d.ts +1 -0
  4. package/dist/agent/dag-subagent.d.ts +3 -0
  5. package/dist/agent/dag-subagent.dispatch.d.ts +3 -0
  6. package/dist/agent/dag-subagent.recovery.d.ts +4 -0
  7. package/dist/agent/model-limits.d.ts +2 -2
  8. package/dist/agent/providers/openai-compatible/catalog-awareness.d.ts +14 -0
  9. package/dist/agent/providers/openai-compatible/models-catalog.d.ts +11 -0
  10. package/dist/agent/providers/openai-compatible/query/context-overflow.d.ts +1 -1
  11. package/dist/agent/providers/openai-compatible/query/context-pressure.d.ts +4 -0
  12. package/dist/agent/providers/openai-compatible/query/turn-iteration.d.ts +2 -1
  13. package/dist/agent/providers/shared/context-pressure.d.ts +7 -0
  14. package/dist/agent/providers/shared/sleep-with-abort.d.ts +3 -1
  15. package/dist/agent/session/ledger-lifecycle.d.ts +1 -1
  16. package/dist/agent/session-ledger-project.d.ts +1 -0
  17. package/dist/agent/session-ledger.d.ts +1 -1
  18. package/dist/agent/tools/compose-agent-resolve.d.ts +1 -0
  19. package/dist/agent/tools/compose-node-results.d.ts +14 -0
  20. package/dist/agent/tools/subagent-executor.notices.d.ts +4 -0
  21. package/dist/agent/trace/emit.d.ts +2 -1
  22. package/dist/agent/trace/events.d.ts +6 -0
  23. package/dist/agent/trace/events.session-phase.d.ts +6 -0
  24. package/dist/agent/trace/index.d.ts +3 -6
  25. package/dist/agent/trace/types.session-phase.d.ts +1 -1
  26. package/dist/cli/commands/daemon-session-persist.d.ts +5 -0
  27. package/dist/cli/session-autosave.d.ts +26 -0
  28. package/dist/cli/slash/types.d.ts +1 -1
  29. package/dist/cli.mjs +420 -415
  30. package/dist/config/env.d.ts +16 -0
  31. package/dist/config/env.model.d.ts +16 -0
  32. package/dist/index.mjs +156 -155
  33. package/dist/telegram.mjs +188 -185
  34. package/dist/web-server/session-name-head.d.ts +2 -0
  35. package/dist/web-server/session-owner.autosave.d.ts +5 -0
  36. package/dist/web-server/session-owner.d.ts +1 -0
  37. package/dist/web-ui-assets/assets/{index-CcN04Dl-.js → index-Bs_yATUj.js} +3 -3
  38. package/dist/web-ui-assets/assets/{index-HrybHVLc.js → index-DoLWZ4qo.js} +1 -1
  39. package/dist/web-ui-assets/index.html +1 -1
  40. package/package.json +3 -3
@@ -301,7 +301,7 @@ Error generating stack: `+i.message+`
301
301
  *
302
302
  * This source code is licensed under the ISC license.
303
303
  * See the LICENSE file in the root directory of this source tree.
304
- */const bm=Ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ex(t){var r,a,u="";if(typeof t=="string"||typeof t=="number")u+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(r=0;r<o;r++)t[r]&&(a=ex(t[r]))&&(u&&(u+=" "),u+=a)}else for(a in t)t[a]&&(u&&(u+=" "),u+=a);return u}function Sk(){for(var t,r,a=0,u="",o=arguments.length;a<o;a++)(t=arguments[a])&&(r=ex(t))&&(u&&(u+=" "),u+=r);return u}const wk=(t,r)=>{const a=new Array(t.length+r.length);for(let u=0;u<t.length;u++)a[u]=t[u];for(let u=0;u<r.length;u++)a[t.length+u]=r[u];return a},kk=(t,r)=>({classGroupId:t,validator:r}),tx=(t=new Map,r=null,a)=>({nextPart:t,validators:r,classGroupId:a}),fs="-",A0=[],Ek="arbitrary..",Ck=t=>{const r=Nk(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:u}=t;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Tk(c);const m=c.split(fs),h=m[0]===""&&m.length>1?1:0;return nx(m,h,r)},getConflictingClassGroupIds:(c,m)=>{if(m){const h=u[c],g=a[c];return h?g?wk(g,h):h:g||A0}return a[c]||A0}}},nx=(t,r,a)=>{if(t.length-r===0)return a.classGroupId;const o=t[r],f=a.nextPart.get(o);if(f){const g=nx(t,r+1,f);if(g)return g}const c=a.validators;if(c===null)return;const m=r===0?t.join(fs):t.slice(r).join(fs),h=c.length;for(let g=0;g<h;g++){const y=c[g];if(y.validator(m))return y.classGroupId}},Tk=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=t.slice(1,-1),a=r.indexOf(":"),u=r.slice(0,a);return u?Ek+u:void 0})(),Nk=t=>{const{theme:r,classGroups:a}=t;return Ak(a,r)},Ak=(t,r)=>{const a=tx();for(const u in t){const o=t[u];xm(o,a,u,r)}return a},xm=(t,r,a,u)=>{const o=t.length;for(let f=0;f<o;f++){const c=t[f];jk(c,r,a,u)}},jk=(t,r,a,u)=>{if(typeof t=="string"){_k(t,r,a);return}if(typeof t=="function"){zk(t,r,a,u);return}Ok(t,r,a,u)},_k=(t,r,a)=>{const u=t===""?r:lx(r,t);u.classGroupId=a},zk=(t,r,a,u)=>{if(Mk(t)){xm(t(u),r,a,u);return}r.validators===null&&(r.validators=[]),r.validators.push(kk(a,t))},Ok=(t,r,a,u)=>{const o=Object.entries(t),f=o.length;for(let c=0;c<f;c++){const[m,h]=o[c];xm(h,lx(r,m),a,u)}},lx=(t,r)=>{let a=t;const u=r.split(fs),o=u.length;for(let f=0;f<o;f++){const c=u[f];let m=a.nextPart.get(c);m||(m=tx(),a.nextPart.set(c,m)),a=m}return a},Mk=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Dk=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,a=Object.create(null),u=Object.create(null);const o=(f,c)=>{a[f]=c,r++,r>t&&(r=0,u=a,a=Object.create(null))};return{get(f){let c=a[f];if(c!==void 0)return c;if((c=u[f])!==void 0)return o(f,c),c},set(f,c){f in a?a[f]=c:o(f,c)}}},Hd="!",j0=":",Rk=[],_0=(t,r,a,u,o)=>({modifiers:t,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:u,isExternal:o}),Lk=t=>{const{prefix:r,experimentalParseClassName:a}=t;let u=o=>{const f=[];let c=0,m=0,h=0,g;const y=o.length;for(let T=0;T<y;T++){const j=o[T];if(c===0&&m===0){if(j===j0){f.push(o.slice(h,T)),h=T+1;continue}if(j==="/"){g=T;continue}}j==="["?c++:j==="]"?c--:j==="("?m++:j===")"&&m--}const p=f.length===0?o:o.slice(h);let v=p,S=!1;p.endsWith(Hd)?(v=p.slice(0,-1),S=!0):p.startsWith(Hd)&&(v=p.slice(1),S=!0);const E=g&&g>h?g-h:void 0;return _0(f,S,v,E)};if(r){const o=r+j0,f=u;u=c=>c.startsWith(o)?f(c.slice(o.length)):_0(Rk,!1,c,void 0,!0)}if(a){const o=u;u=f=>a({className:f,parseClassName:o})}return u},Uk=t=>{const r=new Map;return t.orderSensitiveModifiers.forEach((a,u)=>{r.set(a,1e6+u)}),a=>{const u=[];let o=[];for(let f=0;f<a.length;f++){const c=a[f],m=c[0]==="[",h=r.has(c);m||h?(o.length>0&&(o.sort(),u.push(...o),o=[]),u.push(c)):o.push(c)}return o.length>0&&(o.sort(),u.push(...o)),u}},Bk=t=>({cache:Dk(t.cacheSize),parseClassName:Lk(t),sortModifiers:Uk(t),postfixLookupClassGroupIds:Hk(t),...Ck(t)}),Hk=t=>{const r=Object.create(null),a=t.postfixLookupClassGroups;if(a)for(let u=0;u<a.length;u++)r[a[u]]=!0;return r},qk=/\s+/,Ik=(t,r)=>{const{parseClassName:a,getClassGroupId:u,getConflictingClassGroupIds:o,sortModifiers:f,postfixLookupClassGroupIds:c}=r,m=[],h=t.trim().split(qk);let g="";for(let y=h.length-1;y>=0;y-=1){const p=h[y],{isExternal:v,modifiers:S,hasImportantModifier:E,baseClassName:T,maybePostfixModifierPosition:j}=a(p);if(v){g=p+(g.length>0?" "+g:g);continue}let A=!!j,D;if(A){const F=T.substring(0,j);D=u(F);const q=D&&c[D]?u(T):void 0;q&&q!==D&&(D=q,A=!1)}else D=u(T);if(!D){if(!A){g=p+(g.length>0?" "+g:g);continue}if(D=u(T),!D){g=p+(g.length>0?" "+g:g);continue}A=!1}const L=S.length===0?"":S.length===1?S[0]:f(S).join(":"),P=E?L+Hd:L,W=P+D;if(m.indexOf(W)>-1)continue;m.push(W);const M=o(D,A);for(let F=0;F<M.length;++F){const q=M[F];m.push(P+q)}g=p+(g.length>0?" "+g:g)}return g},Vk=(...t)=>{let r=0,a,u,o="";for(;r<t.length;)(a=t[r++])&&(u=rx(a))&&(o&&(o+=" "),o+=u);return o},rx=t=>{if(typeof t=="string")return t;let r,a="";for(let u=0;u<t.length;u++)t[u]&&(r=rx(t[u]))&&(a&&(a+=" "),a+=r);return a},Yk=(t,...r)=>{let a,u,o,f;const c=h=>{const g=r.reduce((y,p)=>p(y),t());return a=Bk(g),u=a.cache.get,o=a.cache.set,f=m,m(h)},m=h=>{const g=u(h);if(g)return g;const y=Ik(h,a);return o(h,y),y};return f=c,(...h)=>f(Vk(...h))},Gk=[],yt=t=>{const r=a=>a[t]||Gk;return r.isThemeGetter=!0,r.themeKey=t,r},ax=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ix=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Zk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Kk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lr=t=>Fk.test(t),De=t=>!!t&&!Number.isNaN(Number(t)),Jn=t=>!!t&&Number.isInteger(Number(t)),ad=t=>t.endsWith("%")&&De(t.slice(0,-1)),wl=t=>Xk.test(t),ux=()=>!0,Jk=t=>Qk.test(t)&&!Zk.test(t),vm=()=>!1,$k=t=>Kk.test(t),Wk=t=>Pk.test(t),eE=t=>!pe(t)&&!ge(t),tE=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),nE=t=>ir(t,cx,vm),pe=t=>ax.test(t),zr=t=>ir(t,fx,Jk),z0=t=>ir(t,cE,De),lE=t=>ir(t,mx,ux),rE=t=>ir(t,dx,vm),O0=t=>ir(t,ox,vm),aE=t=>ir(t,sx,Wk),Fo=t=>ir(t,hx,$k),ge=t=>ix.test(t),Zi=t=>Hr(t,fx),iE=t=>Hr(t,dx),M0=t=>Hr(t,ox),uE=t=>Hr(t,cx),oE=t=>Hr(t,sx),Xo=t=>Hr(t,hx,!0),sE=t=>Hr(t,mx,!0),ir=(t,r,a)=>{const u=ax.exec(t);return u?u[1]?r(u[1]):a(u[2]):!1},Hr=(t,r,a=!1)=>{const u=ix.exec(t);return u?u[1]?r(u[1]):a:!1},ox=t=>t==="position"||t==="percentage",sx=t=>t==="image"||t==="url",cx=t=>t==="length"||t==="size"||t==="bg-size",fx=t=>t==="length",cE=t=>t==="number",dx=t=>t==="family-name",mx=t=>t==="number"||t==="weight",hx=t=>t==="shadow",fE=()=>{const t=yt("color"),r=yt("font"),a=yt("text"),u=yt("font-weight"),o=yt("tracking"),f=yt("leading"),c=yt("breakpoint"),m=yt("container"),h=yt("spacing"),g=yt("radius"),y=yt("shadow"),p=yt("inset-shadow"),v=yt("text-shadow"),S=yt("drop-shadow"),E=yt("blur"),T=yt("perspective"),j=yt("aspect"),A=yt("ease"),D=yt("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ge,pe],M=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],q=()=>[ge,pe,h],ie=()=>[lr,"full","auto",...q()],H=()=>[Jn,"none","subgrid",ge,pe],ne=()=>["auto",{span:["full",Jn,ge,pe]},Jn,ge,pe],J=()=>[Jn,"auto",ge,pe],ve=()=>["auto","min","max","fr",ge,pe],se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...q()],le=()=>[lr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],de=()=>[m,lr,"screen","full","dvw","lvw","svw","min","max","fit",...q()],je=()=>[lr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],C=()=>[t,ge,pe],Xe=()=>[...P(),M0,O0,{position:[ge,pe]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",uE,nE,{size:[ge,pe]}],z=()=>[ad,Zi,zr],I=()=>["","none","full",g,ge,pe],$=()=>["",De,Zi,zr],ae=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[De,ad,M0,O0],Ce=()=>["","none",E,ge,pe],me=()=>["none",De,ge,pe],Se=()=>["none",De,ge,pe],Rt=()=>[De,ge,pe],Bn=()=>[lr,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wl],breakpoint:[wl],color:[ux],container:[wl],"drop-shadow":[wl],ease:["in","out","in-out"],font:[eE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wl],shadow:[wl],spacing:["px",De],text:[wl],"text-shadow":[wl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",lr,pe,ge,j]}],container:["container"],"container-type":[{"@container":["","normal","size",ge,pe]}],"container-named":[tE],columns:[{columns:[De,"auto",pe,ge,m]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ie()}],"inset-x":[{"inset-x":ie()}],"inset-y":[{"inset-y":ie()}],start:[{"inset-s":ie(),start:ie()}],end:[{"inset-e":ie(),end:ie()}],"inset-bs":[{"inset-bs":ie()}],"inset-be":[{"inset-be":ie()}],top:[{top:ie()}],right:[{right:ie()}],bottom:[{bottom:ie()}],left:[{left:ie()}],visibility:["visible","invisible","collapse"],z:[{z:[Jn,"auto",ge,pe]}],basis:[{basis:[lr,"full","auto",m,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[De,lr,"auto","initial","none",pe]}],grow:[{grow:["",De,ge,pe]}],shrink:[{shrink:["",De,ge,pe]}],order:[{order:[Jn,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:ne()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:ne()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ve()}],"auto-rows":[{"auto-rows":ve()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...se(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...se()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":se()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...je()]}],"min-block-size":[{"min-block":["auto",...je()]}],"max-block-size":[{"max-block":["none",...je()]}],w:[{w:[m,"screen",...le()]}],"min-w":[{"min-w":[m,"screen","none",...le()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[c]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh","none",...le()]}],"font-size":[{text:["base",a,Zi,zr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,sE,lE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ad,pe]}],"font-family":[{font:[iE,rE,r]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ge,pe]}],"line-clamp":[{"line-clamp":[De,"none",ge,z0]}],leading:[{leading:["none",f,...q()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[De,"from-font","auto",ge,zr]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[De,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"tab-size":[{tab:[Jn,ge,pe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Xe()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Jn,ge,pe],radial:["",ge,pe],conic:["",Jn,ge,pe]},oE,aE]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-bs":[{"border-bs":C()}],"border-color-be":[{"border-be":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[De,ge,pe]}],"outline-w":[{outline:["",De,Zi,zr]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","inner","none",y,Xo,Fo]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",p,Xo,Fo]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[De,zr]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",v,Xo,Fo]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[De,ge,pe]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[De]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[De]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Xe()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:Ce()}],brightness:[{brightness:[De,ge,pe]}],contrast:[{contrast:[De,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",S,Xo,Fo]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",De,ge,pe]}],"hue-rotate":[{"hue-rotate":[De,ge,pe]}],invert:[{invert:["",De,ge,pe]}],saturate:[{saturate:[De,ge,pe]}],sepia:[{sepia:["",De,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[De,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[De,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",De,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[De,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",De,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[De,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[De,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",De,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[De,"initial",ge,pe]}],ease:[{ease:["linear","initial",A,ge,pe]}],delay:[{delay:[De,ge,pe]}],animate:[{animate:["none",D,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,ge,pe]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:Rt()}],"skew-x":[{"skew-x":Rt()}],"skew-y":[{"skew-y":Rt()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Bn()}],"translate-x":[{"translate-x":Bn()}],"translate-y":[{"translate-y":Bn()}],"translate-z":[{"translate-z":Bn()}],"translate-none":["translate-none"],zoom:[{zoom:[Jn,ge,pe]}],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":C()}],"scrollbar-track-color":[{"scrollbar-track":C()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mbs":[{"scroll-mbs":q()}],"scroll-mbe":[{"scroll-mbe":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pbs":[{"scroll-pbs":q()}],"scroll-pbe":[{"scroll-pbe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[De,Zi,zr,z0]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dE=Yk(fE);function oe(...t){return dE(Sk(t))}const mE={"needs-input":{label:"Needs Input",className:"bg-status-blocked/20 text-status-blocked border-status-blocked/30"},active:{label:"Running",className:"bg-status-running/20 text-status-running border-status-running/30",pulse:!0},completed:{label:"Done",className:"bg-muted text-muted-foreground border-border"}};function hE(t,r){return r.has(t.id)?"needs-input":t.mode==="live"||t.alive?"active":"completed"}function pE({status:t,className:r}){const a=mE[t];return b.jsxs("span",{className:oe("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium",a.className,r),children:[a.pulse&&b.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-current"}),a.label]})}function gE(t){const r=Date.now(),a=new Date(t).getTime(),u=Math.floor((r-a)/1e3);if(u<60)return"just now";const o=Math.floor(u/60);if(o<60)return`${o}m ago`;const f=Math.floor(o/60);if(f<24)return`${f}h ago`;const c=Math.floor(f/24);return c<7?`${c}d ago`:new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function yE(t){const r=t.replace(/\/+$/,"").split("/");return r[r.length-1]??t}function bE({session:t,pendingSessionIds:r,selected:a,onSelect:u}){const o=hE(t,r),f=t.title??"Untitled session";return b.jsxs("button",{onClick:()=>u(t.id),className:oe("flex w-full flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors","hover:bg-accent/50",a?"border-brand/50 bg-brand/5":"border-transparent"),children:[b.jsxs("div",{className:"flex items-start justify-between gap-2",children:[b.jsx("span",{className:"line-clamp-2 text-sm font-medium leading-snug",children:f}),b.jsx(pE,{status:o,className:"shrink-0"})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.model&&b.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px]",children:t.model}),t.cwd&&b.jsx("span",{className:"truncate font-mono text-[10px]",title:t.cwd,children:yE(t.cwd)}),b.jsx("span",{className:"ml-auto shrink-0",children:t.updatedAt?gE(t.updatedAt):""})]})]})}const xE=[{id:"sessions",label:"Sessions",icon:b.jsx(sk,{className:"size-4"})},{id:"memory",label:"Memory",icon:b.jsx(pm,{className:"size-4"})},{id:"schedules",label:"Schedules",icon:b.jsx(Jw,{className:"size-4"})},{id:"jobs",label:"Jobs",icon:b.jsx(Qb,{className:"size-4"})},{id:"settings",label:"Settings",icon:b.jsx(Jb,{className:"size-4"})}];function vE({sessions:t,pendingSessionIds:r,selectedSessionId:a,onSelectSession:u,activeNav:o,onNavChange:f,collapsed:c,onToggleCollapse:m}){return b.jsxs("aside",{className:oe("flex h-full shrink-0 flex-col border-r bg-card transition-[width] duration-200",c?"w-14":"w-72"),children:[b.jsxs("div",{className:"flex h-12 items-center justify-between border-b px-3",children:[!c&&b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("img",{src:"/brand-mark.svg",alt:"AFK",width:24,height:24}),b.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"AFK"})]}),b.jsx("button",{onClick:m,className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:c?"Expand sidebar":"Collapse sidebar",children:c?b.jsx(dk,{className:"size-4"}):b.jsx(fk,{className:"size-4"})})]}),b.jsx("nav",{className:"flex flex-col gap-0.5 p-2",children:xE.map(h=>b.jsxs("button",{onClick:()=>f(h.id),className:oe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",o===h.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),title:c?h.label:void 0,children:[h.icon,!c&&b.jsx("span",{children:h.label})]},h.id))}),o==="sessions"&&!c&&b.jsx("div",{className:"flex-1 overflow-y-auto border-t px-2 py-2",children:t.length===0?b.jsx("p",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:"No sessions found"}):b.jsx("div",{className:"flex flex-col gap-0.5",children:t.map(h=>b.jsx(bE,{session:h,pendingSessionIds:r,selected:a===h.id,onSelect:u},h.id))})})]})}var D0=1,SE=.9,wE=.8,kE=.17,id=.1,ud=.999,EE=.9999,CE=.99,TE=/[\\\/_+.#"@\[\(\{&]/,NE=/[\\\/_+.#"@\[\(\{&]/g,AE=/[\s-]/,px=/[\s-]/g;function qd(t,r,a,u,o,f,c){if(f===r.length)return o===t.length?D0:CE;var m=`${o},${f}`;if(c[m]!==void 0)return c[m];for(var h=u.charAt(f),g=a.indexOf(h,o),y=0,p,v,S,E;g>=0;)p=qd(t,r,a,u,g+1,f+1,c),p>y&&(g===o?p*=D0:TE.test(t.charAt(g-1))?(p*=wE,S=t.slice(o,g-1).match(NE),S&&o>0&&(p*=Math.pow(ud,S.length))):AE.test(t.charAt(g-1))?(p*=SE,E=t.slice(o,g-1).match(px),E&&o>0&&(p*=Math.pow(ud,E.length))):(p*=kE,o>0&&(p*=Math.pow(ud,g-o))),t.charAt(g)!==r.charAt(f)&&(p*=EE)),(p<id&&a.charAt(g-1)===u.charAt(f+1)||u.charAt(f+1)===u.charAt(f)&&a.charAt(g-1)!==u.charAt(f))&&(v=qd(t,r,a,u,g+1,f+2,c),v*id>p&&(p=v*id)),p>y&&(y=p),g=a.indexOf(h,g+1);return c[m]=y,y}function R0(t){return t.toLowerCase().replace(px," ")}function jE(t,r,a){return t=a&&a.length>0?`${t+" "+a.join(" ")}`:t,qd(t,r,R0(t),R0(r),0,0,{})}var _E=Object.defineProperty,Za=(t,r)=>_E(t,"name",{value:r,configurable:!0}),gx=!!(typeof window<"u"&&window.document&&window.document.createElement);function Dr(t,r,{checkForDefaultPrevented:a=!0}={}){return Za(function(o){if(t==null||t(o),a===!1||!o||!o.defaultPrevented)return r==null?void 0:r(o)},"handleEvent")}Za(Dr,"composeEventHandlers");function zE(t){var r;if(!gx)throw new Error("Cannot access window outside of the DOM");return((r=t==null?void 0:t.ownerDocument)==null?void 0:r.defaultView)??window}Za(zE,"getOwnerWindow");function Id(t){if(!gx)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}Za(Id,"getOwnerDocument");function yx(t,r=!1){const{activeElement:a}=Id(t);if(!(a!=null&&a.nodeName))return null;if(bx(a)&&a.contentDocument)return yx(a.contentDocument.body,r);if(r){const u=a.getAttribute("aria-activedescendant");if(u){const o=Id(a).getElementById(u);if(o)return o}}return a}Za(yx,"getActiveElement");function bx(t){return t.tagName==="IFRAME"}Za(bx,"isFrame");var OE=Object.defineProperty,Sm=(t,r)=>OE(t,"name",{value:r,configurable:!0});function Vd(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}Sm(Vd,"setRef");function Lr(...t){return r=>{let a=!1;const u=t.map(o=>{const f=Vd(o,r);return!a&&typeof f=="function"&&(a=!0),f});if(a)return()=>{for(let o=0;o<u.length;o++){const f=u[o];typeof f=="function"?f():Vd(t[o],null)}}}}Sm(Lr,"composeRefs");function Ka(...t){return w.useCallback(Lr(...t),t)}Sm(Ka,"useComposedRefs");var ME=Object.defineProperty,Tn=(t,r)=>ME(t,"name",{value:r,configurable:!0});function DE(t,r){const a=w.createContext(r);a.displayName=t+"Context";const u=Tn(f=>{const{children:c,...m}=f,h=w.useMemo(()=>m,Object.values(m));return b.jsx(a.Provider,{value:h,children:c})},"Provider");u.displayName=t+"Provider";function o(f,c={}){const{optional:m=!1}=c,h=w.useContext(a);if(h)return h;if(r!==void 0)return r;if(!m)throw new Error(`\`${f}\` must be used within \`${t}\``)}return Tn(o,"useContext"),[u,o]}Tn(DE,"createContext");function xx(t,r=[]){let a=[];function u(f,c){const m=w.createContext(c);m.displayName=f+"Context";const h=a.length;a=[...a,c];const g=Tn(p=>{var A;const{scope:v,children:S,...E}=p,T=((A=v==null?void 0:v[t])==null?void 0:A[h])||m,j=w.useMemo(()=>E,Object.values(E));return b.jsx(T.Provider,{value:j,children:S})},"Provider");g.displayName=f+"Provider";function y(p,v,S={}){var A;const{optional:E=!1}=S,T=((A=v==null?void 0:v[t])==null?void 0:A[h])||m,j=w.useContext(T);if(j)return j;if(c!==void 0)return c;if(!E)throw new Error(`\`${p}\` must be used within \`${f}\``)}return Tn(y,"useContext"),[g,y]}Tn(u,"createContext");const o=Tn(()=>{const f=a.map(c=>w.createContext(c));return Tn(function(m){const h=(m==null?void 0:m[t])||f;return w.useMemo(()=>({[`__scope${t}`]:{...m,[t]:h}}),[m,h])},"useScope")},"createScope");return o.scopeName=t,[u,vx(o,...r)]}Tn(xx,"createContextScope");function vx(...t){const r=t[0];if(t.length===1)return r;const a=Tn(()=>{const u=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Tn(function(f){const c=u.reduce((m,{useScope:h,scopeName:g})=>{const p=h(f)[`__scope${g}`];return{...m,...p}},{});return w.useMemo(()=>({[`__scope${r.scopeName}`]:c}),[c])},"useComposedScopes")},"createScope");return a.scopeName=r.scopeName,a}Tn(vx,"composeContextScopes");var Fa=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},RE=Object.defineProperty,LE=(t,r)=>RE(t,"name",{value:r,configurable:!0}),UE=cu[" useId ".trim().toString()]||(()=>{}),BE=0;function tl(t){const[r,a]=w.useState(UE());return Fa(()=>{t||a(u=>u??String(BE++))},[t]),t||(r?`radix-${r}`:"")}LE(tl,"useId");var HE=Object.defineProperty,qE=(t,r)=>HE(t,"name",{value:r,configurable:!0}),L0=cu[" useEffectEvent ".trim().toString()],U0=cu[" useInsertionEffect ".trim().toString()];function Sx(t){if(typeof L0=="function")return L0(t);const r=w.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof U0=="function"?U0(()=>{r.current=t}):Fa(()=>{r.current=t}),w.useMemo(()=>((...a)=>{var u;return(u=r.current)==null?void 0:u.call(r,...a)}),[])}qE(Sx,"useEffectEvent");var IE=Object.defineProperty,fu=(t,r)=>IE(t,"name",{value:r,configurable:!0}),VE=cu[" useInsertionEffect ".trim().toString()]||Fa;function wx({prop:t,defaultProp:r,onChange:a=fu(()=>{},"onChange"),caller:u}){const[o,f,c]=kx({defaultProp:r,onChange:a}),m=t!==void 0,h=m?t:o,g=w.useCallback(y=>{var p;if(m){const v=Ex(y)?y(t):y;v!==t&&((p=c.current)==null||p.call(c,v))}else f(y)},[m,t,f,c]);return[h,g]}fu(wx,"useControllableState");function kx({defaultProp:t,onChange:r}){const[a,u]=w.useState(t),o=w.useRef(a),f=w.useRef(r);return VE(()=>{f.current=r},[r]),w.useEffect(()=>{var c;o.current!==a&&((c=f.current)==null||c.call(f,a),o.current=a)},[a,o]),[a,u,f]}fu(kx,"useUncontrolledState");function Ex(t){return typeof t=="function"}fu(Ex,"isFunction");var B0=Symbol("RADIX:SYNC_STATE");function YE(t,r,a,u){const{prop:o,defaultProp:f,onChange:c,caller:m}=r,h=o!==void 0,g=Sx(c),y=[{...a,state:f}];u&&y.push(u);const[p,v]=w.useReducer((j,A)=>{if(A.type===B0)return{...j,state:A.state};const D=t(j,A);return h&&!Object.is(D.state,j.state)&&g(D.state),D},...y),S=p.state,E=w.useRef(S);w.useEffect(()=>{E.current!==S&&(E.current=S,h||g(S))},[S,E,h]);const T=w.useMemo(()=>o!==void 0?{...p,state:o}:p,[p,o]);return w.useEffect(()=>{h&&!Object.is(o,p.state)&&v({type:B0,state:o})},[o,p.state,h]),[T,v]}fu(YE,"useControllableStateReducer");var Cx=Gb(),GE=Object.defineProperty,Un=(t,r)=>GE(t,"name",{value:r,configurable:!0});function wm(t){const r=w.forwardRef((a,u)=>{let{children:o,...f}=a,c=null,m=!1;const h=[];Yd(o)&&typeof Qo=="function"&&(o=Qo(o._payload)),w.Children.forEach(o,v=>{var S;if(jx(v)){m=!0;const E=v;let T="child"in E.props?E.props.child:E.props.children;Yd(T)&&typeof Qo=="function"&&(T=Qo(T._payload)),c=XE(E,T),h.push((S=c==null?void 0:c.props)==null?void 0:S.children)}else h.push(v)}),c?c=w.cloneElement(c,void 0,h):!m&&w.Children.count(o)===1&&w.isValidElement(o)&&(c=o);const g=c?Ax(c):void 0,y=Ka(u,g);if(!c){if(o||o===0)throw new Error(m?KE(t):ZE(t));return o}const p=Nx(f,c.props??{});return c.type!==w.Fragment&&(p.ref=u?y:g),w.cloneElement(c,p)});return r.displayName=`${t}.Slot`,r}Un(wm,"createSlot");var Tx=Symbol.for("radix.slottable");function FE(t){const r=Un(a=>"child"in a?a.children(a.child):a.children,"Slottable");return r.displayName=`${t}.Slottable`,r.__radixId=Tx,r}Un(FE,"createSlottable");var XE=Un((t,r)=>{if("child"in t.props){const a=t.props.child;return w.isValidElement(a)?w.cloneElement(a,void 0,t.props.children(a.props.children)):null}return w.isValidElement(r)?r:null},"getSlottableElementFromSlottable");function Nx(t,r){const a={...r};for(const u in r){const o=t[u],f=r[u];/^on[A-Z]/.test(u)?o&&f?a[u]=(...m)=>{const h=f(...m);return o(...m),h}:o&&(a[u]=o):u==="style"?a[u]={...o,...f}:u==="className"&&(a[u]=[o,f].filter(Boolean).join(" "))}return{...t,...a}}Un(Nx,"mergeProps");function Ax(t){var u,o;let r=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}Un(Ax,"getElementRef");function jx(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Tx}Un(jx,"isSlottable");var QE=Symbol.for("react.lazy");function Yd(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===QE&&"_payload"in t&&_x(t._payload)}Un(Yd,"isLazyComponent");function _x(t){return typeof t=="object"&&t!==null&&"then"in t}Un(_x,"isPromiseLike");var ZE=Un(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),KE=Un(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Qo=cu[" use ".trim().toString()],PE=Object.defineProperty,JE=(t,r)=>PE(t,"name",{value:r,configurable:!0}),$E=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nn=$E.reduce((t,r)=>{const a=wm(`Primitive.${r}`),u=w.forwardRef((o,f)=>{const{asChild:c,...m}=o,h=c?a:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(h,{...m,ref:f})});return u.displayName=`Primitive.${r}`,{...t,[r]:u}},{});function zx(t,r){t&&Cx.flushSync(()=>t.dispatchEvent(r))}JE(zx,"dispatchDiscreteCustomEvent");var WE=Object.defineProperty,eC=(t,r)=>WE(t,"name",{value:r,configurable:!0});function Xa(t){const r=w.useRef(t);return w.useEffect(()=>{r.current=t}),w.useMemo(()=>((...a)=>{var u;return(u=r.current)==null?void 0:u.call(r,...a)}),[])}eC(Xa,"useCallbackRef");var tC=Object.defineProperty,wt=(t,r)=>tC(t,"name",{value:r,configurable:!0}),Gd="dismissableLayer.update",nC="dismissableLayer.pointerDownOutside",lC="dismissableLayer.focusOutside",H0,Ox=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),rC=w.forwardRef(wt(function(r,a){const{disableOutsidePointerEvents:u=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:m,onInteractOutside:h,onDismiss:g,...y}=r,p=w.useContext(Ox),[v,S]=w.useState(null),E=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,T]=w.useState({}),j=Ka(a,S),A=Array.from(p.layers),[D]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),L=D?A.indexOf(D):-1,P=v?A.indexOf(v):-1,W=p.layersWithOutsidePointerEventsDisabled.size>0,M=P>=L,F=w.useRef(!1),q=Dx(J=>{c==null||c(J),h==null||h(J),J.defaultPrevented||g==null||g()},{ownerDocument:E,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:F,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(J=>{if(!(J instanceof Node))return!1;const ve=[...p.branches].some(se=>se.contains(J));return M&&!ve},[p.branches,M])}),ie=Rx(J=>{if(o&&F.current)return;const ve=J.target;[...p.branches].some(te=>te.contains(ve))||(m==null||m(J),h==null||h(J),J.defaultPrevented||g==null||g())},E),H=v?P===A.length-1:!1,ne=Xa(J=>{J.key==="Escape"&&(f==null||f(J),!J.defaultPrevented&&g&&(J.preventDefault(),g()))});return w.useEffect(()=>{if(H)return E.addEventListener("keydown",ne,{capture:!0}),()=>E.removeEventListener("keydown",ne,{capture:!0})},[E,H,ne]),w.useEffect(()=>{if(v)return u&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(H0=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),Fd(),()=>{u&&(p.layersWithOutsidePointerEventsDisabled.delete(v),p.layersWithOutsidePointerEventsDisabled.size===0&&(E.body.style.pointerEvents=H0))}},[v,E,u,p]),w.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),Fd())},[v,p]),w.useEffect(()=>{const J=wt(()=>T({}),"handleUpdate");return document.addEventListener(Gd,J),()=>document.removeEventListener(Gd,J)},[]),b.jsx(Nn.div,{...y,ref:j,style:{pointerEvents:W?M?"auto":"none":void 0,...r.style},onFocusCapture:Dr(r.onFocusCapture,ie.onFocusCapture),onBlurCapture:Dr(r.onBlurCapture,ie.onBlurCapture),onPointerDownCapture:Dr(r.onPointerDownCapture,q.onPointerDownCapture)})},"DismissableLayer"));function Mx(){const t=w.useContext(Ox),[r,a]=w.useState(null);return w.useEffect(()=>{if(r)return t.dismissableSurfaces.add(r),()=>{t.dismissableSurfaces.delete(r)}},[r,t.dismissableSurfaces]),a}wt(Mx,"useDismissableLayerSurface");var aC=wt(()=>!0,"IS_TRUE");function Dx(t,r){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:f,shouldHandlePointerDownOutside:c=aC}=r,m=Xa(t),h=w.useRef(!1),g=w.useRef(!1),y=w.useRef(new Map),p=w.useRef(()=>{});return w.useEffect(()=>{function v(){g.current=!1,o.current=!1,y.current.clear()}wt(v,"resetOutsideInteraction");function S(){return Array.from(y.current.values()).some(Boolean)}wt(S,"isOutsideInteractionIntercepted");function E(L){if(!g.current)return;const P=L.target;P instanceof Node&&[...f].some(M=>M.contains(P))||y.current.set(L.type,!0),L.type==="click"&&window.setTimeout(()=>{g.current&&p.current()},0)}wt(E,"handleInteractionCapture");function T(L){g.current&&y.current.set(L.type,!1)}wt(T,"handleInteractionBubble");const j=wt(L=>{if(L.target&&!h.current){let P=function(){a.removeEventListener("click",p.current);const M=S();v(),M||km(nC,m,W,{discrete:!0})};if(wt(P,"handleAndDispatchPointerDownOutsideEvent"),!c(L.target)){a.removeEventListener("click",p.current),v(),h.current=!1;return}const W={originalEvent:L};g.current=!0,o.current=u&&L.button===0,y.current.clear(),!u||L.button!==0?P():(a.removeEventListener("click",p.current),p.current=P,a.addEventListener("click",p.current,{once:!0}))}else a.removeEventListener("click",p.current),v();h.current=!1},"handlePointerDown"),A=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const L of A)a.addEventListener(L,E,!0),a.addEventListener(L,T);const D=window.setTimeout(()=>{a.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(D),a.removeEventListener("pointerdown",j),a.removeEventListener("click",p.current);for(const L of A)a.removeEventListener(L,E,!0),a.removeEventListener(L,T)}},[a,m,u,o,f,c]),{onPointerDownCapture:wt(()=>h.current=!0,"onPointerDownCapture")}}wt(Dx,"usePointerDownOutside");function Rx(t,r=globalThis==null?void 0:globalThis.document){const a=Xa(t),u=w.useRef(!1);return w.useEffect(()=>{const o=wt(f=>{f.target&&!u.current&&km(lC,a,{originalEvent:f},{discrete:!1})},"handleFocus");return r.addEventListener("focusin",o),()=>r.removeEventListener("focusin",o)},[r,a]),{onFocusCapture:wt(()=>u.current=!0,"onFocusCapture"),onBlurCapture:wt(()=>u.current=!1,"onBlurCapture")}}wt(Rx,"useFocusOutside");function Fd(){const t=new CustomEvent(Gd);document.dispatchEvent(t)}wt(Fd,"dispatchUpdate");function km(t,r,a,{discrete:u}){const o=a.originalEvent.target,f=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:a});r&&o.addEventListener(t,r,{once:!0}),u?zx(o,f):o.dispatchEvent(f)}wt(km,"handleAndDispatchCustomEvent");var iC=Object.defineProperty,Vt=(t,r)=>iC(t,"name",{value:r,configurable:!0}),od="focusScope.autoFocusOnMount",sd="focusScope.autoFocusOnUnmount",q0={bubbles:!1,cancelable:!0},uC=w.forwardRef(Vt(function(r,a){const{loop:u=!1,trapped:o=!1,onMountAutoFocus:f,onUnmountAutoFocus:c,...m}=r,[h,g]=w.useState(null),y=Xa(f),p=Xa(c),v=w.useRef(null),S=Ka(a,g),E=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(o){let j=function(P){if(E.paused||!h)return;const W=P.target;h.contains(W)?v.current=W:kl(v.current,{select:!0})},A=function(P){if(E.paused||!h)return;const W=P.relatedTarget;W!==null&&(h.contains(W)||kl(v.current,{select:!0}))},D=function(P){if(document.activeElement===document.body)for(const M of P)M.removedNodes.length>0&&kl(h)};Vt(j,"handleFocusIn"),Vt(A,"handleFocusOut"),Vt(D,"handleMutations"),document.addEventListener("focusin",j),document.addEventListener("focusout",A);const L=new MutationObserver(D);return h&&L.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",A),L.disconnect()}}},[o,h,E.paused]),w.useEffect(()=>{if(h){I0.add(E);const j=document.activeElement;if(!h.contains(j)){const D=new CustomEvent(od,q0);h.addEventListener(od,y),h.dispatchEvent(D),D.defaultPrevented||(Lx(Ix(Em(h)),{select:!0}),document.activeElement===j&&kl(h))}return()=>{h.removeEventListener(od,y),setTimeout(()=>{const D=new CustomEvent(sd,q0);h.addEventListener(sd,p),h.dispatchEvent(D),D.defaultPrevented||kl(j??document.body,{select:!0}),h.removeEventListener(sd,p),I0.remove(E)},0)}}},[h,y,p,E]);const T=w.useCallback(j=>{if(!u&&!o||E.paused)return;const A=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(A&&D){const L=j.currentTarget,[P,W]=Ux(L);P&&W?!j.shiftKey&&D===W?(j.preventDefault(),u&&kl(P,{select:!0})):j.shiftKey&&D===P&&(j.preventDefault(),u&&kl(W,{select:!0})):D===L&&j.preventDefault()}},[u,o,E.paused]);return b.jsx(Nn.div,{tabIndex:-1,...m,ref:S,onKeyDown:T})},"FocusScope"));function Lx(t,{select:r=!1}={}){const a=document.activeElement;for(const u of t)if(kl(u,{select:r}),document.activeElement!==a)return}Vt(Lx,"focusFirst");function Ux(t){const r=Em(t),a=Xd(r,t),u=Xd(r.reverse(),t);return[a,u]}Vt(Ux,"getTabbableEdges");function Em(t){const r=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Vt(u=>{const o=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||o?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;a.nextNode();)r.push(a.currentNode);return r}Vt(Em,"getTabbableCandidates");function Xd(t,r){const a=typeof r.checkVisibility=="function"&&r.checkVisibility({checkVisibilityCSS:!0});for(const u of t)if(!(a?!u.checkVisibility({checkVisibilityCSS:!0}):Bx(u,{upTo:r})))return u}Vt(Xd,"findVisible");function Bx(t,{upTo:r}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(r!==void 0&&t===r)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Vt(Bx,"isHidden");function Hx(t){return t instanceof HTMLInputElement&&"select"in t}Vt(Hx,"isSelectableInput");function kl(t,{select:r=!1}={}){if(t&&t.focus){const a=document.activeElement;t.focus({preventScroll:!0}),t!==a&&Hx(t)&&r&&t.select()}}Vt(kl,"focus");var I0=qx();function qx(){let t=[];return{add(r){const a=t[0];r!==a&&(a==null||a.pause()),t=Qd(t,r),t.unshift(r)},remove(r){var a;t=Qd(t,r),(a=t[0])==null||a.resume()}}}Vt(qx,"createFocusScopesStack");function Qd(t,r){const a=[...t],u=a.indexOf(r);return u!==-1&&a.splice(u,1),a}Vt(Qd,"arrayRemove");function Ix(t){return t.filter(r=>r.tagName!=="A")}Vt(Ix,"removeLinks");var oC=Object.defineProperty,sC=(t,r)=>oC(t,"name",{value:r,configurable:!0}),cC=w.forwardRef(sC(function(r,a){var h;const{container:u,...o}=r,[f,c]=w.useState(!1);Fa(()=>c(!0),[]);const m=u||f&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return m?Cx.createPortal(b.jsx(Nn.div,{...o,ref:a}),m):null},"Portal")),fC=Object.defineProperty,El=(t,r)=>fC(t,"name",{value:r,configurable:!0});function Vx(t,r){return w.useReducer((a,u)=>r[a][u]??a,t)}El(Vx,"useStateMachine");var Cm=El(t=>{const{present:r,children:a}=t,u=Yx(r),o=typeof a=="function"?a({present:u.isPresent}):w.Children.only(a),f=Gx(u.ref,Fx(o));return typeof a=="function"||u.isPresent?w.cloneElement(o,{ref:f}):null},"Presence");function Yx(t){const[r,a]=w.useState(),u=w.useRef(null),o=w.useRef(t),f=w.useRef("none"),c=w.useRef(void 0),m=t?"mounted":"unmounted",[h,g]=Vx(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{h==="mounted"?(f.current=c.current??Ha(u.current),c.current=void 0):f.current="none"},[h]),Fa(()=>{const y=u.current,p=o.current;if(p!==t){const S=f.current,E=Ha(y);t?(c.current=E,g("MOUNT")):E==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(p&&S!==E?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,g]),Fa(()=>{if(r){let y;const p=r.ownerDocument.defaultView??window,v=El(E=>{const j=Ha(u.current).includes(CSS.escape(E.animationName));if(E.target===r&&j&&(g("ANIMATION_END"),!o.current)){const A=r.style.animationFillMode;r.style.animationFillMode="forwards",y=p.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=A)})}},"handleAnimationEnd"),S=El(E=>{E.target===r&&(f.current=Ha(u.current))},"handleAnimationStart");return r.addEventListener("animationstart",S),r.addEventListener("animationcancel",v),r.addEventListener("animationend",v),()=>{p.clearTimeout(y),r.removeEventListener("animationstart",S),r.removeEventListener("animationcancel",v),r.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[r,g]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:w.useCallback(y=>{if(y){const p=getComputedStyle(y);u.current=p,c.current=Ha(p)}else u.current=null;a(y)},[])}}El(Yx,"usePresence");function Zd(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}El(Zd,"setRef");function Gx(...t){const r=w.useRef(t);return r.current=t,w.useCallback(a=>{const u=r.current;let o=!1;const f=u.map(c=>{const m=Zd(c,a);return!o&&typeof m=="function"&&(o=!0),m});if(o)return()=>{for(let c=0;c<f.length;c++){const m=f[c];typeof m=="function"?m():Zd(u[c],null)}}},[])}El(Gx,"useStableComposedRefs");function Ha(t){return(t==null?void 0:t.animationName)||"none"}El(Ha,"getAnimationName");function Fx(t){var u,o;let r=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}El(Fx,"getElementRef");var dC=Object.defineProperty,Tm=(t,r)=>dC(t,"name",{value:r,configurable:!0}),Zo=0,$n=null;function mC(t){return Nm(),t.children}Tm(mC,"FocusGuards");function Nm(){w.useEffect(()=>{$n||($n={start:Kd(),end:Kd()});const{start:t,end:r}=$n;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==r&&document.body.insertAdjacentElement("beforeend",r),Zo++,()=>{Zo===1&&($n==null||$n.start.remove(),$n==null||$n.end.remove(),$n=null),Zo=Math.max(0,Zo-1)}},[])}Tm(Nm,"useFocusGuards");function Kd(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}Tm(Kd,"createFocusGuard");var el=function(){return el=Object.assign||function(r){for(var a,u=1,o=arguments.length;u<o;u++){a=arguments[u];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(r[f]=a[f])}return r},el.apply(this,arguments)};function Xx(t,r){var a={};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&r.indexOf(u)<0&&(a[u]=t[u]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,u=Object.getOwnPropertySymbols(t);o<u.length;o++)r.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(t,u[o])&&(a[u[o]]=t[u[o]]);return a}function hC(t,r,a){if(a||arguments.length===2)for(var u=0,o=r.length,f;u<o;u++)(f||!(u in r))&&(f||(f=Array.prototype.slice.call(r,0,u)),f[u]=r[u]);return t.concat(f||Array.prototype.slice.call(r))}var os="right-scroll-bar-position",ss="width-before-scroll-bar",pC="with-scroll-bars-hidden",gC="--removed-body-scroll-bar-size";function cd(t,r){return typeof t=="function"?t(r):t&&(t.current=r),t}function yC(t,r){var a=w.useState(function(){return{value:t,callback:r,facade:{get current(){return a.value},set current(u){var o=a.value;o!==u&&(a.value=u,a.callback(u,o))}}}})[0];return a.callback=r,a.facade}var bC=typeof window<"u"?w.useLayoutEffect:w.useEffect,V0=new WeakMap;function xC(t,r){var a=yC(null,function(u){return t.forEach(function(o){return cd(o,u)})});return bC(function(){var u=V0.get(a);if(u){var o=new Set(u),f=new Set(t),c=a.current;o.forEach(function(m){f.has(m)||cd(m,null)}),f.forEach(function(m){o.has(m)||cd(m,c)})}V0.set(a,t)},[t]),a}function vC(t){return t}function SC(t,r){r===void 0&&(r=vC);var a=[],u=!1,o={read:function(){if(u)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:t},useMedium:function(f){var c=r(f,u);return a.push(c),function(){a=a.filter(function(m){return m!==c})}},assignSyncMedium:function(f){for(u=!0;a.length;){var c=a;a=[],c.forEach(f)}a={push:function(m){return f(m)},filter:function(){return a}}},assignMedium:function(f){u=!0;var c=[];if(a.length){var m=a;a=[],m.forEach(f),c=a}var h=function(){var y=c;c=[],y.forEach(f)},g=function(){return Promise.resolve().then(h)};g(),a={push:function(y){c.push(y),g()},filter:function(y){return c=c.filter(y),a}}}};return o}function wC(t){t===void 0&&(t={});var r=SC(null);return r.options=el({async:!0,ssr:!1},t),r}var Qx=function(t){var r=t.sideCar,a=Xx(t,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var u=r.read();if(!u)throw new Error("Sidecar medium not found");return w.createElement(u,el({},a))};Qx.isSideCarExport=!0;function kC(t,r){return t.useMedium(r),Qx}var Zx=wC(),fd=function(){},ys=w.forwardRef(function(t,r){var a=w.useRef(null),u=w.useState({onScrollCapture:fd,onWheelCapture:fd,onTouchMoveCapture:fd}),o=u[0],f=u[1],c=t.forwardProps,m=t.children,h=t.className,g=t.removeScrollBar,y=t.enabled,p=t.shards,v=t.sideCar,S=t.noRelative,E=t.noIsolation,T=t.inert,j=t.allowPinchZoom,A=t.as,D=A===void 0?"div":A,L=t.gapMode,P=Xx(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=v,M=xC([a,r]),F=el(el({},P),o);return w.createElement(w.Fragment,null,y&&w.createElement(W,{sideCar:Zx,removeScrollBar:g,shards:p,noRelative:S,noIsolation:E,inert:T,setCallbacks:f,allowPinchZoom:!!j,lockRef:a,gapMode:L}),c?w.cloneElement(w.Children.only(m),el(el({},F),{ref:M})):w.createElement(D,el({},F,{className:h,ref:M}),m))});ys.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ys.classNames={fullWidth:ss,zeroRight:os};var EC=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CC(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var r=EC();return r&&t.setAttribute("nonce",r),t}function TC(t,r){t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r))}function NC(t){var r=document.head||document.getElementsByTagName("head")[0];r.appendChild(t)}var AC=function(){var t=0,r=null;return{add:function(a){t==0&&(r=CC())&&(TC(r,a),NC(r)),t++},remove:function(){t--,!t&&r&&(r.parentNode&&r.parentNode.removeChild(r),r=null)}}},jC=function(){var t=AC();return function(r,a){w.useEffect(function(){return t.add(r),function(){t.remove()}},[r&&a])}},Kx=function(){var t=jC(),r=function(a){var u=a.styles,o=a.dynamic;return t(u,o),null};return r},_C={left:0,top:0,right:0,gap:0},dd=function(t){return parseInt(t||"",10)||0},zC=function(t){var r=window.getComputedStyle(document.body),a=r[t==="padding"?"paddingLeft":"marginLeft"],u=r[t==="padding"?"paddingTop":"marginTop"],o=r[t==="padding"?"paddingRight":"marginRight"];return[dd(a),dd(u),dd(o)]},OC=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return _C;var r=zC(t),a=document.documentElement.clientWidth,u=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,u-a+r[2]-r[0])}},MC=Kx(),Ga="data-scroll-locked",DC=function(t,r,a,u){var o=t.left,f=t.top,c=t.right,m=t.gap;return a===void 0&&(a="margin"),`
304
+ */const bm=Ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ex(t){var r,a,u="";if(typeof t=="string"||typeof t=="number")u+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(r=0;r<o;r++)t[r]&&(a=ex(t[r]))&&(u&&(u+=" "),u+=a)}else for(a in t)t[a]&&(u&&(u+=" "),u+=a);return u}function Sk(){for(var t,r,a=0,u="",o=arguments.length;a<o;a++)(t=arguments[a])&&(r=ex(t))&&(u&&(u+=" "),u+=r);return u}const wk=(t,r)=>{const a=new Array(t.length+r.length);for(let u=0;u<t.length;u++)a[u]=t[u];for(let u=0;u<r.length;u++)a[t.length+u]=r[u];return a},kk=(t,r)=>({classGroupId:t,validator:r}),tx=(t=new Map,r=null,a)=>({nextPart:t,validators:r,classGroupId:a}),fs="-",A0=[],Ek="arbitrary..",Ck=t=>{const r=Nk(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:u}=t;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Tk(c);const m=c.split(fs),h=m[0]===""&&m.length>1?1:0;return nx(m,h,r)},getConflictingClassGroupIds:(c,m)=>{if(m){const h=u[c],g=a[c];return h?g?wk(g,h):h:g||A0}return a[c]||A0}}},nx=(t,r,a)=>{if(t.length-r===0)return a.classGroupId;const o=t[r],f=a.nextPart.get(o);if(f){const g=nx(t,r+1,f);if(g)return g}const c=a.validators;if(c===null)return;const m=r===0?t.join(fs):t.slice(r).join(fs),h=c.length;for(let g=0;g<h;g++){const y=c[g];if(y.validator(m))return y.classGroupId}},Tk=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=t.slice(1,-1),a=r.indexOf(":"),u=r.slice(0,a);return u?Ek+u:void 0})(),Nk=t=>{const{theme:r,classGroups:a}=t;return Ak(a,r)},Ak=(t,r)=>{const a=tx();for(const u in t){const o=t[u];xm(o,a,u,r)}return a},xm=(t,r,a,u)=>{const o=t.length;for(let f=0;f<o;f++){const c=t[f];jk(c,r,a,u)}},jk=(t,r,a,u)=>{if(typeof t=="string"){_k(t,r,a);return}if(typeof t=="function"){zk(t,r,a,u);return}Ok(t,r,a,u)},_k=(t,r,a)=>{const u=t===""?r:lx(r,t);u.classGroupId=a},zk=(t,r,a,u)=>{if(Mk(t)){xm(t(u),r,a,u);return}r.validators===null&&(r.validators=[]),r.validators.push(kk(a,t))},Ok=(t,r,a,u)=>{const o=Object.entries(t),f=o.length;for(let c=0;c<f;c++){const[m,h]=o[c];xm(h,lx(r,m),a,u)}},lx=(t,r)=>{let a=t;const u=r.split(fs),o=u.length;for(let f=0;f<o;f++){const c=u[f];let m=a.nextPart.get(c);m||(m=tx(),a.nextPart.set(c,m)),a=m}return a},Mk=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Dk=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,a=Object.create(null),u=Object.create(null);const o=(f,c)=>{a[f]=c,r++,r>t&&(r=0,u=a,a=Object.create(null))};return{get(f){let c=a[f];if(c!==void 0)return c;if((c=u[f])!==void 0)return o(f,c),c},set(f,c){f in a?a[f]=c:o(f,c)}}},Hd="!",j0=":",Rk=[],_0=(t,r,a,u,o)=>({modifiers:t,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:u,isExternal:o}),Lk=t=>{const{prefix:r,experimentalParseClassName:a}=t;let u=o=>{const f=[];let c=0,m=0,h=0,g;const y=o.length;for(let T=0;T<y;T++){const j=o[T];if(c===0&&m===0){if(j===j0){f.push(o.slice(h,T)),h=T+1;continue}if(j==="/"){g=T;continue}}j==="["?c++:j==="]"?c--:j==="("?m++:j===")"&&m--}const p=f.length===0?o:o.slice(h);let v=p,S=!1;p.endsWith(Hd)?(v=p.slice(0,-1),S=!0):p.startsWith(Hd)&&(v=p.slice(1),S=!0);const E=g&&g>h?g-h:void 0;return _0(f,S,v,E)};if(r){const o=r+j0,f=u;u=c=>c.startsWith(o)?f(c.slice(o.length)):_0(Rk,!1,c,void 0,!0)}if(a){const o=u;u=f=>a({className:f,parseClassName:o})}return u},Uk=t=>{const r=new Map;return t.orderSensitiveModifiers.forEach((a,u)=>{r.set(a,1e6+u)}),a=>{const u=[];let o=[];for(let f=0;f<a.length;f++){const c=a[f],m=c[0]==="[",h=r.has(c);m||h?(o.length>0&&(o.sort(),u.push(...o),o=[]),u.push(c)):o.push(c)}return o.length>0&&(o.sort(),u.push(...o)),u}},Bk=t=>({cache:Dk(t.cacheSize),parseClassName:Lk(t),sortModifiers:Uk(t),postfixLookupClassGroupIds:Hk(t),...Ck(t)}),Hk=t=>{const r=Object.create(null),a=t.postfixLookupClassGroups;if(a)for(let u=0;u<a.length;u++)r[a[u]]=!0;return r},qk=/\s+/,Ik=(t,r)=>{const{parseClassName:a,getClassGroupId:u,getConflictingClassGroupIds:o,sortModifiers:f,postfixLookupClassGroupIds:c}=r,m=[],h=t.trim().split(qk);let g="";for(let y=h.length-1;y>=0;y-=1){const p=h[y],{isExternal:v,modifiers:S,hasImportantModifier:E,baseClassName:T,maybePostfixModifierPosition:j}=a(p);if(v){g=p+(g.length>0?" "+g:g);continue}let A=!!j,D;if(A){const F=T.substring(0,j);D=u(F);const q=D&&c[D]?u(T):void 0;q&&q!==D&&(D=q,A=!1)}else D=u(T);if(!D){if(!A){g=p+(g.length>0?" "+g:g);continue}if(D=u(T),!D){g=p+(g.length>0?" "+g:g);continue}A=!1}const L=S.length===0?"":S.length===1?S[0]:f(S).join(":"),P=E?L+Hd:L,W=P+D;if(m.indexOf(W)>-1)continue;m.push(W);const M=o(D,A);for(let F=0;F<M.length;++F){const q=M[F];m.push(P+q)}g=p+(g.length>0?" "+g:g)}return g},Vk=(...t)=>{let r=0,a,u,o="";for(;r<t.length;)(a=t[r++])&&(u=rx(a))&&(o&&(o+=" "),o+=u);return o},rx=t=>{if(typeof t=="string")return t;let r,a="";for(let u=0;u<t.length;u++)t[u]&&(r=rx(t[u]))&&(a&&(a+=" "),a+=r);return a},Yk=(t,...r)=>{let a,u,o,f;const c=h=>{const g=r.reduce((y,p)=>p(y),t());return a=Bk(g),u=a.cache.get,o=a.cache.set,f=m,m(h)},m=h=>{const g=u(h);if(g)return g;const y=Ik(h,a);return o(h,y),y};return f=c,(...h)=>f(Vk(...h))},Gk=[],yt=t=>{const r=a=>a[t]||Gk;return r.isThemeGetter=!0,r.themeKey=t,r},ax=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ix=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Zk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Kk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lr=t=>Fk.test(t),De=t=>!!t&&!Number.isNaN(Number(t)),Jn=t=>!!t&&Number.isInteger(Number(t)),ad=t=>t.endsWith("%")&&De(t.slice(0,-1)),wl=t=>Xk.test(t),ux=()=>!0,Jk=t=>Qk.test(t)&&!Zk.test(t),vm=()=>!1,$k=t=>Kk.test(t),Wk=t=>Pk.test(t),eE=t=>!pe(t)&&!ge(t),tE=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),nE=t=>ir(t,cx,vm),pe=t=>ax.test(t),zr=t=>ir(t,fx,Jk),z0=t=>ir(t,cE,De),lE=t=>ir(t,mx,ux),rE=t=>ir(t,dx,vm),O0=t=>ir(t,ox,vm),aE=t=>ir(t,sx,Wk),Fo=t=>ir(t,hx,$k),ge=t=>ix.test(t),Zi=t=>Hr(t,fx),iE=t=>Hr(t,dx),M0=t=>Hr(t,ox),uE=t=>Hr(t,cx),oE=t=>Hr(t,sx),Xo=t=>Hr(t,hx,!0),sE=t=>Hr(t,mx,!0),ir=(t,r,a)=>{const u=ax.exec(t);return u?u[1]?r(u[1]):a(u[2]):!1},Hr=(t,r,a=!1)=>{const u=ix.exec(t);return u?u[1]?r(u[1]):a:!1},ox=t=>t==="position"||t==="percentage",sx=t=>t==="image"||t==="url",cx=t=>t==="length"||t==="size"||t==="bg-size",fx=t=>t==="length",cE=t=>t==="number",dx=t=>t==="family-name",mx=t=>t==="number"||t==="weight",hx=t=>t==="shadow",fE=()=>{const t=yt("color"),r=yt("font"),a=yt("text"),u=yt("font-weight"),o=yt("tracking"),f=yt("leading"),c=yt("breakpoint"),m=yt("container"),h=yt("spacing"),g=yt("radius"),y=yt("shadow"),p=yt("inset-shadow"),v=yt("text-shadow"),S=yt("drop-shadow"),E=yt("blur"),T=yt("perspective"),j=yt("aspect"),A=yt("ease"),D=yt("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ge,pe],M=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],q=()=>[ge,pe,h],ie=()=>[lr,"full","auto",...q()],H=()=>[Jn,"none","subgrid",ge,pe],ne=()=>["auto",{span:["full",Jn,ge,pe]},Jn,ge,pe],J=()=>[Jn,"auto",ge,pe],ve=()=>["auto","min","max","fr",ge,pe],se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...q()],le=()=>[lr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],de=()=>[m,lr,"screen","full","dvw","lvw","svw","min","max","fit",...q()],je=()=>[lr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],C=()=>[t,ge,pe],Xe=()=>[...P(),M0,O0,{position:[ge,pe]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",uE,nE,{size:[ge,pe]}],z=()=>[ad,Zi,zr],I=()=>["","none","full",g,ge,pe],$=()=>["",De,Zi,zr],ae=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[De,ad,M0,O0],Ce=()=>["","none",E,ge,pe],me=()=>["none",De,ge,pe],Se=()=>["none",De,ge,pe],Rt=()=>[De,ge,pe],Bn=()=>[lr,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wl],breakpoint:[wl],color:[ux],container:[wl],"drop-shadow":[wl],ease:["in","out","in-out"],font:[eE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wl],shadow:[wl],spacing:["px",De],text:[wl],"text-shadow":[wl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",lr,pe,ge,j]}],container:["container"],"container-type":[{"@container":["","normal","size",ge,pe]}],"container-named":[tE],columns:[{columns:[De,"auto",pe,ge,m]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ie()}],"inset-x":[{"inset-x":ie()}],"inset-y":[{"inset-y":ie()}],start:[{"inset-s":ie(),start:ie()}],end:[{"inset-e":ie(),end:ie()}],"inset-bs":[{"inset-bs":ie()}],"inset-be":[{"inset-be":ie()}],top:[{top:ie()}],right:[{right:ie()}],bottom:[{bottom:ie()}],left:[{left:ie()}],visibility:["visible","invisible","collapse"],z:[{z:[Jn,"auto",ge,pe]}],basis:[{basis:[lr,"full","auto",m,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[De,lr,"auto","initial","none",pe]}],grow:[{grow:["",De,ge,pe]}],shrink:[{shrink:["",De,ge,pe]}],order:[{order:[Jn,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:ne()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:ne()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ve()}],"auto-rows":[{"auto-rows":ve()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...se(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...se()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":se()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...je()]}],"min-block-size":[{"min-block":["auto",...je()]}],"max-block-size":[{"max-block":["none",...je()]}],w:[{w:[m,"screen",...le()]}],"min-w":[{"min-w":[m,"screen","none",...le()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[c]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh","none",...le()]}],"font-size":[{text:["base",a,Zi,zr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,sE,lE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ad,pe]}],"font-family":[{font:[iE,rE,r]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ge,pe]}],"line-clamp":[{"line-clamp":[De,"none",ge,z0]}],leading:[{leading:["none",f,...q()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[De,"from-font","auto",ge,zr]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[De,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"tab-size":[{tab:[Jn,ge,pe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Xe()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Jn,ge,pe],radial:["",ge,pe],conic:["",Jn,ge,pe]},oE,aE]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-bs":[{"border-bs":C()}],"border-color-be":[{"border-be":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[De,ge,pe]}],"outline-w":[{outline:["",De,Zi,zr]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","inner","none",y,Xo,Fo]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",p,Xo,Fo]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[De,zr]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",v,Xo,Fo]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[De,ge,pe]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[De]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[De]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Xe()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:Ce()}],brightness:[{brightness:[De,ge,pe]}],contrast:[{contrast:[De,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",S,Xo,Fo]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",De,ge,pe]}],"hue-rotate":[{"hue-rotate":[De,ge,pe]}],invert:[{invert:["",De,ge,pe]}],saturate:[{saturate:[De,ge,pe]}],sepia:[{sepia:["",De,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[De,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[De,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",De,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[De,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",De,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[De,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[De,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",De,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[De,"initial",ge,pe]}],ease:[{ease:["linear","initial",A,ge,pe]}],delay:[{delay:[De,ge,pe]}],animate:[{animate:["none",D,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,ge,pe]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:Rt()}],"skew-x":[{"skew-x":Rt()}],"skew-y":[{"skew-y":Rt()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Bn()}],"translate-x":[{"translate-x":Bn()}],"translate-y":[{"translate-y":Bn()}],"translate-z":[{"translate-z":Bn()}],"translate-none":["translate-none"],zoom:[{zoom:[Jn,ge,pe]}],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":C()}],"scrollbar-track-color":[{"scrollbar-track":C()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mbs":[{"scroll-mbs":q()}],"scroll-mbe":[{"scroll-mbe":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pbs":[{"scroll-pbs":q()}],"scroll-pbe":[{"scroll-pbe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[De,Zi,zr,z0]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dE=Yk(fE);function oe(...t){return dE(Sk(t))}const mE={"needs-input":{label:"Needs Input",className:"bg-status-blocked/20 text-status-blocked border-status-blocked/30"},active:{label:"Running",className:"bg-status-running/20 text-status-running border-status-running/30",pulse:!0},completed:{label:"Done",className:"bg-muted text-muted-foreground border-border"}};function hE(t,r){return r.has(t.id)?"needs-input":t.mode==="live"||t.alive?"active":"completed"}function pE({status:t,className:r}){const a=mE[t];return b.jsxs("span",{className:oe("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium",a.className,r),children:[a.pulse&&b.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-current"}),a.label]})}function gE(t){const r=Date.now(),a=new Date(t).getTime(),u=Math.floor((r-a)/1e3);if(u<60)return"just now";const o=Math.floor(u/60);if(o<60)return`${o}m ago`;const f=Math.floor(o/60);if(f<24)return`${f}h ago`;const c=Math.floor(f/24);return c<7?`${c}d ago`:new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function yE(t){const r=t.replace(/\/+$/,"").split("/");return r[r.length-1]??t}function bE({session:t,pendingSessionIds:r,selected:a,onSelect:u}){const o=hE(t,r),f=t.title??(t.mode==="live"?"New session":"Untitled session");return b.jsxs("button",{onClick:()=>u(t.id),className:oe("flex w-full flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors","hover:bg-accent/50",a?"border-brand/50 bg-brand/5":"border-transparent"),children:[b.jsxs("div",{className:"flex items-start justify-between gap-2",children:[b.jsx("span",{className:"line-clamp-2 text-sm font-medium leading-snug",children:f}),b.jsx(pE,{status:o,className:"shrink-0"})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.model&&b.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px]",children:t.model}),t.cwd&&b.jsx("span",{className:"truncate font-mono text-[10px]",title:t.cwd,children:yE(t.cwd)}),b.jsx("span",{className:"ml-auto shrink-0",children:t.updatedAt?gE(t.updatedAt):""})]})]})}const xE=[{id:"sessions",label:"Sessions",icon:b.jsx(sk,{className:"size-4"})},{id:"memory",label:"Memory",icon:b.jsx(pm,{className:"size-4"})},{id:"schedules",label:"Schedules",icon:b.jsx(Jw,{className:"size-4"})},{id:"jobs",label:"Jobs",icon:b.jsx(Qb,{className:"size-4"})},{id:"settings",label:"Settings",icon:b.jsx(Jb,{className:"size-4"})}];function vE({sessions:t,pendingSessionIds:r,selectedSessionId:a,onSelectSession:u,activeNav:o,onNavChange:f,collapsed:c,onToggleCollapse:m}){return b.jsxs("aside",{className:oe("flex h-full shrink-0 flex-col border-r bg-card transition-[width] duration-200",c?"w-14":"w-72"),children:[b.jsxs("div",{className:"flex h-12 items-center justify-between border-b px-3",children:[!c&&b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("img",{src:"/brand-mark.svg",alt:"AFK",width:24,height:24}),b.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"AFK"})]}),b.jsx("button",{onClick:m,className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:c?"Expand sidebar":"Collapse sidebar",children:c?b.jsx(dk,{className:"size-4"}):b.jsx(fk,{className:"size-4"})})]}),b.jsx("nav",{className:"flex flex-col gap-0.5 p-2",children:xE.map(h=>b.jsxs("button",{onClick:()=>f(h.id),className:oe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",o===h.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),title:c?h.label:void 0,children:[h.icon,!c&&b.jsx("span",{children:h.label})]},h.id))}),o==="sessions"&&!c&&b.jsx("div",{className:"flex-1 overflow-y-auto border-t px-2 py-2",children:t.length===0?b.jsx("p",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:"No sessions found"}):b.jsx("div",{className:"flex flex-col gap-0.5",children:t.map(h=>b.jsx(bE,{session:h,pendingSessionIds:r,selected:a===h.id,onSelect:u},h.id))})})]})}var D0=1,SE=.9,wE=.8,kE=.17,id=.1,ud=.999,EE=.9999,CE=.99,TE=/[\\\/_+.#"@\[\(\{&]/,NE=/[\\\/_+.#"@\[\(\{&]/g,AE=/[\s-]/,px=/[\s-]/g;function qd(t,r,a,u,o,f,c){if(f===r.length)return o===t.length?D0:CE;var m=`${o},${f}`;if(c[m]!==void 0)return c[m];for(var h=u.charAt(f),g=a.indexOf(h,o),y=0,p,v,S,E;g>=0;)p=qd(t,r,a,u,g+1,f+1,c),p>y&&(g===o?p*=D0:TE.test(t.charAt(g-1))?(p*=wE,S=t.slice(o,g-1).match(NE),S&&o>0&&(p*=Math.pow(ud,S.length))):AE.test(t.charAt(g-1))?(p*=SE,E=t.slice(o,g-1).match(px),E&&o>0&&(p*=Math.pow(ud,E.length))):(p*=kE,o>0&&(p*=Math.pow(ud,g-o))),t.charAt(g)!==r.charAt(f)&&(p*=EE)),(p<id&&a.charAt(g-1)===u.charAt(f+1)||u.charAt(f+1)===u.charAt(f)&&a.charAt(g-1)!==u.charAt(f))&&(v=qd(t,r,a,u,g+1,f+2,c),v*id>p&&(p=v*id)),p>y&&(y=p),g=a.indexOf(h,g+1);return c[m]=y,y}function R0(t){return t.toLowerCase().replace(px," ")}function jE(t,r,a){return t=a&&a.length>0?`${t+" "+a.join(" ")}`:t,qd(t,r,R0(t),R0(r),0,0,{})}var _E=Object.defineProperty,Za=(t,r)=>_E(t,"name",{value:r,configurable:!0}),gx=!!(typeof window<"u"&&window.document&&window.document.createElement);function Dr(t,r,{checkForDefaultPrevented:a=!0}={}){return Za(function(o){if(t==null||t(o),a===!1||!o||!o.defaultPrevented)return r==null?void 0:r(o)},"handleEvent")}Za(Dr,"composeEventHandlers");function zE(t){var r;if(!gx)throw new Error("Cannot access window outside of the DOM");return((r=t==null?void 0:t.ownerDocument)==null?void 0:r.defaultView)??window}Za(zE,"getOwnerWindow");function Id(t){if(!gx)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}Za(Id,"getOwnerDocument");function yx(t,r=!1){const{activeElement:a}=Id(t);if(!(a!=null&&a.nodeName))return null;if(bx(a)&&a.contentDocument)return yx(a.contentDocument.body,r);if(r){const u=a.getAttribute("aria-activedescendant");if(u){const o=Id(a).getElementById(u);if(o)return o}}return a}Za(yx,"getActiveElement");function bx(t){return t.tagName==="IFRAME"}Za(bx,"isFrame");var OE=Object.defineProperty,Sm=(t,r)=>OE(t,"name",{value:r,configurable:!0});function Vd(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}Sm(Vd,"setRef");function Lr(...t){return r=>{let a=!1;const u=t.map(o=>{const f=Vd(o,r);return!a&&typeof f=="function"&&(a=!0),f});if(a)return()=>{for(let o=0;o<u.length;o++){const f=u[o];typeof f=="function"?f():Vd(t[o],null)}}}}Sm(Lr,"composeRefs");function Ka(...t){return w.useCallback(Lr(...t),t)}Sm(Ka,"useComposedRefs");var ME=Object.defineProperty,Tn=(t,r)=>ME(t,"name",{value:r,configurable:!0});function DE(t,r){const a=w.createContext(r);a.displayName=t+"Context";const u=Tn(f=>{const{children:c,...m}=f,h=w.useMemo(()=>m,Object.values(m));return b.jsx(a.Provider,{value:h,children:c})},"Provider");u.displayName=t+"Provider";function o(f,c={}){const{optional:m=!1}=c,h=w.useContext(a);if(h)return h;if(r!==void 0)return r;if(!m)throw new Error(`\`${f}\` must be used within \`${t}\``)}return Tn(o,"useContext"),[u,o]}Tn(DE,"createContext");function xx(t,r=[]){let a=[];function u(f,c){const m=w.createContext(c);m.displayName=f+"Context";const h=a.length;a=[...a,c];const g=Tn(p=>{var A;const{scope:v,children:S,...E}=p,T=((A=v==null?void 0:v[t])==null?void 0:A[h])||m,j=w.useMemo(()=>E,Object.values(E));return b.jsx(T.Provider,{value:j,children:S})},"Provider");g.displayName=f+"Provider";function y(p,v,S={}){var A;const{optional:E=!1}=S,T=((A=v==null?void 0:v[t])==null?void 0:A[h])||m,j=w.useContext(T);if(j)return j;if(c!==void 0)return c;if(!E)throw new Error(`\`${p}\` must be used within \`${f}\``)}return Tn(y,"useContext"),[g,y]}Tn(u,"createContext");const o=Tn(()=>{const f=a.map(c=>w.createContext(c));return Tn(function(m){const h=(m==null?void 0:m[t])||f;return w.useMemo(()=>({[`__scope${t}`]:{...m,[t]:h}}),[m,h])},"useScope")},"createScope");return o.scopeName=t,[u,vx(o,...r)]}Tn(xx,"createContextScope");function vx(...t){const r=t[0];if(t.length===1)return r;const a=Tn(()=>{const u=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Tn(function(f){const c=u.reduce((m,{useScope:h,scopeName:g})=>{const p=h(f)[`__scope${g}`];return{...m,...p}},{});return w.useMemo(()=>({[`__scope${r.scopeName}`]:c}),[c])},"useComposedScopes")},"createScope");return a.scopeName=r.scopeName,a}Tn(vx,"composeContextScopes");var Fa=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},RE=Object.defineProperty,LE=(t,r)=>RE(t,"name",{value:r,configurable:!0}),UE=cu[" useId ".trim().toString()]||(()=>{}),BE=0;function tl(t){const[r,a]=w.useState(UE());return Fa(()=>{t||a(u=>u??String(BE++))},[t]),t||(r?`radix-${r}`:"")}LE(tl,"useId");var HE=Object.defineProperty,qE=(t,r)=>HE(t,"name",{value:r,configurable:!0}),L0=cu[" useEffectEvent ".trim().toString()],U0=cu[" useInsertionEffect ".trim().toString()];function Sx(t){if(typeof L0=="function")return L0(t);const r=w.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof U0=="function"?U0(()=>{r.current=t}):Fa(()=>{r.current=t}),w.useMemo(()=>((...a)=>{var u;return(u=r.current)==null?void 0:u.call(r,...a)}),[])}qE(Sx,"useEffectEvent");var IE=Object.defineProperty,fu=(t,r)=>IE(t,"name",{value:r,configurable:!0}),VE=cu[" useInsertionEffect ".trim().toString()]||Fa;function wx({prop:t,defaultProp:r,onChange:a=fu(()=>{},"onChange"),caller:u}){const[o,f,c]=kx({defaultProp:r,onChange:a}),m=t!==void 0,h=m?t:o,g=w.useCallback(y=>{var p;if(m){const v=Ex(y)?y(t):y;v!==t&&((p=c.current)==null||p.call(c,v))}else f(y)},[m,t,f,c]);return[h,g]}fu(wx,"useControllableState");function kx({defaultProp:t,onChange:r}){const[a,u]=w.useState(t),o=w.useRef(a),f=w.useRef(r);return VE(()=>{f.current=r},[r]),w.useEffect(()=>{var c;o.current!==a&&((c=f.current)==null||c.call(f,a),o.current=a)},[a,o]),[a,u,f]}fu(kx,"useUncontrolledState");function Ex(t){return typeof t=="function"}fu(Ex,"isFunction");var B0=Symbol("RADIX:SYNC_STATE");function YE(t,r,a,u){const{prop:o,defaultProp:f,onChange:c,caller:m}=r,h=o!==void 0,g=Sx(c),y=[{...a,state:f}];u&&y.push(u);const[p,v]=w.useReducer((j,A)=>{if(A.type===B0)return{...j,state:A.state};const D=t(j,A);return h&&!Object.is(D.state,j.state)&&g(D.state),D},...y),S=p.state,E=w.useRef(S);w.useEffect(()=>{E.current!==S&&(E.current=S,h||g(S))},[S,E,h]);const T=w.useMemo(()=>o!==void 0?{...p,state:o}:p,[p,o]);return w.useEffect(()=>{h&&!Object.is(o,p.state)&&v({type:B0,state:o})},[o,p.state,h]),[T,v]}fu(YE,"useControllableStateReducer");var Cx=Gb(),GE=Object.defineProperty,Un=(t,r)=>GE(t,"name",{value:r,configurable:!0});function wm(t){const r=w.forwardRef((a,u)=>{let{children:o,...f}=a,c=null,m=!1;const h=[];Yd(o)&&typeof Qo=="function"&&(o=Qo(o._payload)),w.Children.forEach(o,v=>{var S;if(jx(v)){m=!0;const E=v;let T="child"in E.props?E.props.child:E.props.children;Yd(T)&&typeof Qo=="function"&&(T=Qo(T._payload)),c=XE(E,T),h.push((S=c==null?void 0:c.props)==null?void 0:S.children)}else h.push(v)}),c?c=w.cloneElement(c,void 0,h):!m&&w.Children.count(o)===1&&w.isValidElement(o)&&(c=o);const g=c?Ax(c):void 0,y=Ka(u,g);if(!c){if(o||o===0)throw new Error(m?KE(t):ZE(t));return o}const p=Nx(f,c.props??{});return c.type!==w.Fragment&&(p.ref=u?y:g),w.cloneElement(c,p)});return r.displayName=`${t}.Slot`,r}Un(wm,"createSlot");var Tx=Symbol.for("radix.slottable");function FE(t){const r=Un(a=>"child"in a?a.children(a.child):a.children,"Slottable");return r.displayName=`${t}.Slottable`,r.__radixId=Tx,r}Un(FE,"createSlottable");var XE=Un((t,r)=>{if("child"in t.props){const a=t.props.child;return w.isValidElement(a)?w.cloneElement(a,void 0,t.props.children(a.props.children)):null}return w.isValidElement(r)?r:null},"getSlottableElementFromSlottable");function Nx(t,r){const a={...r};for(const u in r){const o=t[u],f=r[u];/^on[A-Z]/.test(u)?o&&f?a[u]=(...m)=>{const h=f(...m);return o(...m),h}:o&&(a[u]=o):u==="style"?a[u]={...o,...f}:u==="className"&&(a[u]=[o,f].filter(Boolean).join(" "))}return{...t,...a}}Un(Nx,"mergeProps");function Ax(t){var u,o;let r=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}Un(Ax,"getElementRef");function jx(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Tx}Un(jx,"isSlottable");var QE=Symbol.for("react.lazy");function Yd(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===QE&&"_payload"in t&&_x(t._payload)}Un(Yd,"isLazyComponent");function _x(t){return typeof t=="object"&&t!==null&&"then"in t}Un(_x,"isPromiseLike");var ZE=Un(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),KE=Un(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Qo=cu[" use ".trim().toString()],PE=Object.defineProperty,JE=(t,r)=>PE(t,"name",{value:r,configurable:!0}),$E=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nn=$E.reduce((t,r)=>{const a=wm(`Primitive.${r}`),u=w.forwardRef((o,f)=>{const{asChild:c,...m}=o,h=c?a:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(h,{...m,ref:f})});return u.displayName=`Primitive.${r}`,{...t,[r]:u}},{});function zx(t,r){t&&Cx.flushSync(()=>t.dispatchEvent(r))}JE(zx,"dispatchDiscreteCustomEvent");var WE=Object.defineProperty,eC=(t,r)=>WE(t,"name",{value:r,configurable:!0});function Xa(t){const r=w.useRef(t);return w.useEffect(()=>{r.current=t}),w.useMemo(()=>((...a)=>{var u;return(u=r.current)==null?void 0:u.call(r,...a)}),[])}eC(Xa,"useCallbackRef");var tC=Object.defineProperty,wt=(t,r)=>tC(t,"name",{value:r,configurable:!0}),Gd="dismissableLayer.update",nC="dismissableLayer.pointerDownOutside",lC="dismissableLayer.focusOutside",H0,Ox=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),rC=w.forwardRef(wt(function(r,a){const{disableOutsidePointerEvents:u=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:m,onInteractOutside:h,onDismiss:g,...y}=r,p=w.useContext(Ox),[v,S]=w.useState(null),E=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,T]=w.useState({}),j=Ka(a,S),A=Array.from(p.layers),[D]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),L=D?A.indexOf(D):-1,P=v?A.indexOf(v):-1,W=p.layersWithOutsidePointerEventsDisabled.size>0,M=P>=L,F=w.useRef(!1),q=Dx(J=>{c==null||c(J),h==null||h(J),J.defaultPrevented||g==null||g()},{ownerDocument:E,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:F,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(J=>{if(!(J instanceof Node))return!1;const ve=[...p.branches].some(se=>se.contains(J));return M&&!ve},[p.branches,M])}),ie=Rx(J=>{if(o&&F.current)return;const ve=J.target;[...p.branches].some(te=>te.contains(ve))||(m==null||m(J),h==null||h(J),J.defaultPrevented||g==null||g())},E),H=v?P===A.length-1:!1,ne=Xa(J=>{J.key==="Escape"&&(f==null||f(J),!J.defaultPrevented&&g&&(J.preventDefault(),g()))});return w.useEffect(()=>{if(H)return E.addEventListener("keydown",ne,{capture:!0}),()=>E.removeEventListener("keydown",ne,{capture:!0})},[E,H,ne]),w.useEffect(()=>{if(v)return u&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(H0=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),Fd(),()=>{u&&(p.layersWithOutsidePointerEventsDisabled.delete(v),p.layersWithOutsidePointerEventsDisabled.size===0&&(E.body.style.pointerEvents=H0))}},[v,E,u,p]),w.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),Fd())},[v,p]),w.useEffect(()=>{const J=wt(()=>T({}),"handleUpdate");return document.addEventListener(Gd,J),()=>document.removeEventListener(Gd,J)},[]),b.jsx(Nn.div,{...y,ref:j,style:{pointerEvents:W?M?"auto":"none":void 0,...r.style},onFocusCapture:Dr(r.onFocusCapture,ie.onFocusCapture),onBlurCapture:Dr(r.onBlurCapture,ie.onBlurCapture),onPointerDownCapture:Dr(r.onPointerDownCapture,q.onPointerDownCapture)})},"DismissableLayer"));function Mx(){const t=w.useContext(Ox),[r,a]=w.useState(null);return w.useEffect(()=>{if(r)return t.dismissableSurfaces.add(r),()=>{t.dismissableSurfaces.delete(r)}},[r,t.dismissableSurfaces]),a}wt(Mx,"useDismissableLayerSurface");var aC=wt(()=>!0,"IS_TRUE");function Dx(t,r){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:f,shouldHandlePointerDownOutside:c=aC}=r,m=Xa(t),h=w.useRef(!1),g=w.useRef(!1),y=w.useRef(new Map),p=w.useRef(()=>{});return w.useEffect(()=>{function v(){g.current=!1,o.current=!1,y.current.clear()}wt(v,"resetOutsideInteraction");function S(){return Array.from(y.current.values()).some(Boolean)}wt(S,"isOutsideInteractionIntercepted");function E(L){if(!g.current)return;const P=L.target;P instanceof Node&&[...f].some(M=>M.contains(P))||y.current.set(L.type,!0),L.type==="click"&&window.setTimeout(()=>{g.current&&p.current()},0)}wt(E,"handleInteractionCapture");function T(L){g.current&&y.current.set(L.type,!1)}wt(T,"handleInteractionBubble");const j=wt(L=>{if(L.target&&!h.current){let P=function(){a.removeEventListener("click",p.current);const M=S();v(),M||km(nC,m,W,{discrete:!0})};if(wt(P,"handleAndDispatchPointerDownOutsideEvent"),!c(L.target)){a.removeEventListener("click",p.current),v(),h.current=!1;return}const W={originalEvent:L};g.current=!0,o.current=u&&L.button===0,y.current.clear(),!u||L.button!==0?P():(a.removeEventListener("click",p.current),p.current=P,a.addEventListener("click",p.current,{once:!0}))}else a.removeEventListener("click",p.current),v();h.current=!1},"handlePointerDown"),A=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const L of A)a.addEventListener(L,E,!0),a.addEventListener(L,T);const D=window.setTimeout(()=>{a.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(D),a.removeEventListener("pointerdown",j),a.removeEventListener("click",p.current);for(const L of A)a.removeEventListener(L,E,!0),a.removeEventListener(L,T)}},[a,m,u,o,f,c]),{onPointerDownCapture:wt(()=>h.current=!0,"onPointerDownCapture")}}wt(Dx,"usePointerDownOutside");function Rx(t,r=globalThis==null?void 0:globalThis.document){const a=Xa(t),u=w.useRef(!1);return w.useEffect(()=>{const o=wt(f=>{f.target&&!u.current&&km(lC,a,{originalEvent:f},{discrete:!1})},"handleFocus");return r.addEventListener("focusin",o),()=>r.removeEventListener("focusin",o)},[r,a]),{onFocusCapture:wt(()=>u.current=!0,"onFocusCapture"),onBlurCapture:wt(()=>u.current=!1,"onBlurCapture")}}wt(Rx,"useFocusOutside");function Fd(){const t=new CustomEvent(Gd);document.dispatchEvent(t)}wt(Fd,"dispatchUpdate");function km(t,r,a,{discrete:u}){const o=a.originalEvent.target,f=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:a});r&&o.addEventListener(t,r,{once:!0}),u?zx(o,f):o.dispatchEvent(f)}wt(km,"handleAndDispatchCustomEvent");var iC=Object.defineProperty,Vt=(t,r)=>iC(t,"name",{value:r,configurable:!0}),od="focusScope.autoFocusOnMount",sd="focusScope.autoFocusOnUnmount",q0={bubbles:!1,cancelable:!0},uC=w.forwardRef(Vt(function(r,a){const{loop:u=!1,trapped:o=!1,onMountAutoFocus:f,onUnmountAutoFocus:c,...m}=r,[h,g]=w.useState(null),y=Xa(f),p=Xa(c),v=w.useRef(null),S=Ka(a,g),E=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(o){let j=function(P){if(E.paused||!h)return;const W=P.target;h.contains(W)?v.current=W:kl(v.current,{select:!0})},A=function(P){if(E.paused||!h)return;const W=P.relatedTarget;W!==null&&(h.contains(W)||kl(v.current,{select:!0}))},D=function(P){if(document.activeElement===document.body)for(const M of P)M.removedNodes.length>0&&kl(h)};Vt(j,"handleFocusIn"),Vt(A,"handleFocusOut"),Vt(D,"handleMutations"),document.addEventListener("focusin",j),document.addEventListener("focusout",A);const L=new MutationObserver(D);return h&&L.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",A),L.disconnect()}}},[o,h,E.paused]),w.useEffect(()=>{if(h){I0.add(E);const j=document.activeElement;if(!h.contains(j)){const D=new CustomEvent(od,q0);h.addEventListener(od,y),h.dispatchEvent(D),D.defaultPrevented||(Lx(Ix(Em(h)),{select:!0}),document.activeElement===j&&kl(h))}return()=>{h.removeEventListener(od,y),setTimeout(()=>{const D=new CustomEvent(sd,q0);h.addEventListener(sd,p),h.dispatchEvent(D),D.defaultPrevented||kl(j??document.body,{select:!0}),h.removeEventListener(sd,p),I0.remove(E)},0)}}},[h,y,p,E]);const T=w.useCallback(j=>{if(!u&&!o||E.paused)return;const A=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(A&&D){const L=j.currentTarget,[P,W]=Ux(L);P&&W?!j.shiftKey&&D===W?(j.preventDefault(),u&&kl(P,{select:!0})):j.shiftKey&&D===P&&(j.preventDefault(),u&&kl(W,{select:!0})):D===L&&j.preventDefault()}},[u,o,E.paused]);return b.jsx(Nn.div,{tabIndex:-1,...m,ref:S,onKeyDown:T})},"FocusScope"));function Lx(t,{select:r=!1}={}){const a=document.activeElement;for(const u of t)if(kl(u,{select:r}),document.activeElement!==a)return}Vt(Lx,"focusFirst");function Ux(t){const r=Em(t),a=Xd(r,t),u=Xd(r.reverse(),t);return[a,u]}Vt(Ux,"getTabbableEdges");function Em(t){const r=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Vt(u=>{const o=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||o?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;a.nextNode();)r.push(a.currentNode);return r}Vt(Em,"getTabbableCandidates");function Xd(t,r){const a=typeof r.checkVisibility=="function"&&r.checkVisibility({checkVisibilityCSS:!0});for(const u of t)if(!(a?!u.checkVisibility({checkVisibilityCSS:!0}):Bx(u,{upTo:r})))return u}Vt(Xd,"findVisible");function Bx(t,{upTo:r}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(r!==void 0&&t===r)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Vt(Bx,"isHidden");function Hx(t){return t instanceof HTMLInputElement&&"select"in t}Vt(Hx,"isSelectableInput");function kl(t,{select:r=!1}={}){if(t&&t.focus){const a=document.activeElement;t.focus({preventScroll:!0}),t!==a&&Hx(t)&&r&&t.select()}}Vt(kl,"focus");var I0=qx();function qx(){let t=[];return{add(r){const a=t[0];r!==a&&(a==null||a.pause()),t=Qd(t,r),t.unshift(r)},remove(r){var a;t=Qd(t,r),(a=t[0])==null||a.resume()}}}Vt(qx,"createFocusScopesStack");function Qd(t,r){const a=[...t],u=a.indexOf(r);return u!==-1&&a.splice(u,1),a}Vt(Qd,"arrayRemove");function Ix(t){return t.filter(r=>r.tagName!=="A")}Vt(Ix,"removeLinks");var oC=Object.defineProperty,sC=(t,r)=>oC(t,"name",{value:r,configurable:!0}),cC=w.forwardRef(sC(function(r,a){var h;const{container:u,...o}=r,[f,c]=w.useState(!1);Fa(()=>c(!0),[]);const m=u||f&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return m?Cx.createPortal(b.jsx(Nn.div,{...o,ref:a}),m):null},"Portal")),fC=Object.defineProperty,El=(t,r)=>fC(t,"name",{value:r,configurable:!0});function Vx(t,r){return w.useReducer((a,u)=>r[a][u]??a,t)}El(Vx,"useStateMachine");var Cm=El(t=>{const{present:r,children:a}=t,u=Yx(r),o=typeof a=="function"?a({present:u.isPresent}):w.Children.only(a),f=Gx(u.ref,Fx(o));return typeof a=="function"||u.isPresent?w.cloneElement(o,{ref:f}):null},"Presence");function Yx(t){const[r,a]=w.useState(),u=w.useRef(null),o=w.useRef(t),f=w.useRef("none"),c=w.useRef(void 0),m=t?"mounted":"unmounted",[h,g]=Vx(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{h==="mounted"?(f.current=c.current??Ha(u.current),c.current=void 0):f.current="none"},[h]),Fa(()=>{const y=u.current,p=o.current;if(p!==t){const S=f.current,E=Ha(y);t?(c.current=E,g("MOUNT")):E==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(p&&S!==E?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,g]),Fa(()=>{if(r){let y;const p=r.ownerDocument.defaultView??window,v=El(E=>{const j=Ha(u.current).includes(CSS.escape(E.animationName));if(E.target===r&&j&&(g("ANIMATION_END"),!o.current)){const A=r.style.animationFillMode;r.style.animationFillMode="forwards",y=p.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=A)})}},"handleAnimationEnd"),S=El(E=>{E.target===r&&(f.current=Ha(u.current))},"handleAnimationStart");return r.addEventListener("animationstart",S),r.addEventListener("animationcancel",v),r.addEventListener("animationend",v),()=>{p.clearTimeout(y),r.removeEventListener("animationstart",S),r.removeEventListener("animationcancel",v),r.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[r,g]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:w.useCallback(y=>{if(y){const p=getComputedStyle(y);u.current=p,c.current=Ha(p)}else u.current=null;a(y)},[])}}El(Yx,"usePresence");function Zd(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}El(Zd,"setRef");function Gx(...t){const r=w.useRef(t);return r.current=t,w.useCallback(a=>{const u=r.current;let o=!1;const f=u.map(c=>{const m=Zd(c,a);return!o&&typeof m=="function"&&(o=!0),m});if(o)return()=>{for(let c=0;c<f.length;c++){const m=f[c];typeof m=="function"?m():Zd(u[c],null)}}},[])}El(Gx,"useStableComposedRefs");function Ha(t){return(t==null?void 0:t.animationName)||"none"}El(Ha,"getAnimationName");function Fx(t){var u,o;let r=(u=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}El(Fx,"getElementRef");var dC=Object.defineProperty,Tm=(t,r)=>dC(t,"name",{value:r,configurable:!0}),Zo=0,$n=null;function mC(t){return Nm(),t.children}Tm(mC,"FocusGuards");function Nm(){w.useEffect(()=>{$n||($n={start:Kd(),end:Kd()});const{start:t,end:r}=$n;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==r&&document.body.insertAdjacentElement("beforeend",r),Zo++,()=>{Zo===1&&($n==null||$n.start.remove(),$n==null||$n.end.remove(),$n=null),Zo=Math.max(0,Zo-1)}},[])}Tm(Nm,"useFocusGuards");function Kd(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}Tm(Kd,"createFocusGuard");var el=function(){return el=Object.assign||function(r){for(var a,u=1,o=arguments.length;u<o;u++){a=arguments[u];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(r[f]=a[f])}return r},el.apply(this,arguments)};function Xx(t,r){var a={};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&r.indexOf(u)<0&&(a[u]=t[u]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,u=Object.getOwnPropertySymbols(t);o<u.length;o++)r.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(t,u[o])&&(a[u[o]]=t[u[o]]);return a}function hC(t,r,a){if(a||arguments.length===2)for(var u=0,o=r.length,f;u<o;u++)(f||!(u in r))&&(f||(f=Array.prototype.slice.call(r,0,u)),f[u]=r[u]);return t.concat(f||Array.prototype.slice.call(r))}var os="right-scroll-bar-position",ss="width-before-scroll-bar",pC="with-scroll-bars-hidden",gC="--removed-body-scroll-bar-size";function cd(t,r){return typeof t=="function"?t(r):t&&(t.current=r),t}function yC(t,r){var a=w.useState(function(){return{value:t,callback:r,facade:{get current(){return a.value},set current(u){var o=a.value;o!==u&&(a.value=u,a.callback(u,o))}}}})[0];return a.callback=r,a.facade}var bC=typeof window<"u"?w.useLayoutEffect:w.useEffect,V0=new WeakMap;function xC(t,r){var a=yC(null,function(u){return t.forEach(function(o){return cd(o,u)})});return bC(function(){var u=V0.get(a);if(u){var o=new Set(u),f=new Set(t),c=a.current;o.forEach(function(m){f.has(m)||cd(m,null)}),f.forEach(function(m){o.has(m)||cd(m,c)})}V0.set(a,t)},[t]),a}function vC(t){return t}function SC(t,r){r===void 0&&(r=vC);var a=[],u=!1,o={read:function(){if(u)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:t},useMedium:function(f){var c=r(f,u);return a.push(c),function(){a=a.filter(function(m){return m!==c})}},assignSyncMedium:function(f){for(u=!0;a.length;){var c=a;a=[],c.forEach(f)}a={push:function(m){return f(m)},filter:function(){return a}}},assignMedium:function(f){u=!0;var c=[];if(a.length){var m=a;a=[],m.forEach(f),c=a}var h=function(){var y=c;c=[],y.forEach(f)},g=function(){return Promise.resolve().then(h)};g(),a={push:function(y){c.push(y),g()},filter:function(y){return c=c.filter(y),a}}}};return o}function wC(t){t===void 0&&(t={});var r=SC(null);return r.options=el({async:!0,ssr:!1},t),r}var Qx=function(t){var r=t.sideCar,a=Xx(t,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var u=r.read();if(!u)throw new Error("Sidecar medium not found");return w.createElement(u,el({},a))};Qx.isSideCarExport=!0;function kC(t,r){return t.useMedium(r),Qx}var Zx=wC(),fd=function(){},ys=w.forwardRef(function(t,r){var a=w.useRef(null),u=w.useState({onScrollCapture:fd,onWheelCapture:fd,onTouchMoveCapture:fd}),o=u[0],f=u[1],c=t.forwardProps,m=t.children,h=t.className,g=t.removeScrollBar,y=t.enabled,p=t.shards,v=t.sideCar,S=t.noRelative,E=t.noIsolation,T=t.inert,j=t.allowPinchZoom,A=t.as,D=A===void 0?"div":A,L=t.gapMode,P=Xx(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=v,M=xC([a,r]),F=el(el({},P),o);return w.createElement(w.Fragment,null,y&&w.createElement(W,{sideCar:Zx,removeScrollBar:g,shards:p,noRelative:S,noIsolation:E,inert:T,setCallbacks:f,allowPinchZoom:!!j,lockRef:a,gapMode:L}),c?w.cloneElement(w.Children.only(m),el(el({},F),{ref:M})):w.createElement(D,el({},F,{className:h,ref:M}),m))});ys.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ys.classNames={fullWidth:ss,zeroRight:os};var EC=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CC(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var r=EC();return r&&t.setAttribute("nonce",r),t}function TC(t,r){t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r))}function NC(t){var r=document.head||document.getElementsByTagName("head")[0];r.appendChild(t)}var AC=function(){var t=0,r=null;return{add:function(a){t==0&&(r=CC())&&(TC(r,a),NC(r)),t++},remove:function(){t--,!t&&r&&(r.parentNode&&r.parentNode.removeChild(r),r=null)}}},jC=function(){var t=AC();return function(r,a){w.useEffect(function(){return t.add(r),function(){t.remove()}},[r&&a])}},Kx=function(){var t=jC(),r=function(a){var u=a.styles,o=a.dynamic;return t(u,o),null};return r},_C={left:0,top:0,right:0,gap:0},dd=function(t){return parseInt(t||"",10)||0},zC=function(t){var r=window.getComputedStyle(document.body),a=r[t==="padding"?"paddingLeft":"marginLeft"],u=r[t==="padding"?"paddingTop":"marginTop"],o=r[t==="padding"?"paddingRight":"marginRight"];return[dd(a),dd(u),dd(o)]},OC=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return _C;var r=zC(t),a=document.documentElement.clientWidth,u=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,u-a+r[2]-r[0])}},MC=Kx(),Ga="data-scroll-locked",DC=function(t,r,a,u){var o=t.left,f=t.top,c=t.right,m=t.gap;return a===void 0&&(a="margin"),`
305
305
  .`.concat(pC,` {
306
306
  overflow: hidden `).concat(u,`;
307
307
  padding-right: `).concat(m,"px ").concat(u,`;
@@ -371,10 +371,10 @@ Error generating stack: `+i.message+`
371
371
  `))+1))}const c="#".repeat(o),m=a.enter("headingAtx"),h=a.enter("phrasing");f.move(c+" ");let g=a.containerPhrasing(t,{before:"# ",after:`
372
372
  `,...f.current()});return/^[\t ]/.test(g)&&(g=su(g.charCodeAt(0))+g.slice(1)),g=g?c+" "+g:c,a.options.closeAtx&&(g+=" "+c),h(),m(),g}f1.peek=V5;function f1(t){return t.value||""}function V5(){return"<"}d1.peek=Y5;function d1(t,r,a,u){const o=Xm(a),f=o==='"'?"Quote":"Apostrophe",c=a.enter("image");let m=a.enter("label");const h=a.createTracker(u);let g=h.move("![");return g+=h.move(a.safe(t.alt,{before:g,after:"]",...h.current()})),g+=h.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),g+=h.move("<"),g+=h.move(a.safe(t.url,{before:g,after:">",...h.current()})),g+=h.move(">")):(m=a.enter("destinationRaw"),g+=h.move(a.safe(t.url,{before:g,after:t.title?" ":")",...h.current()}))),m(),t.title&&(m=a.enter(`title${f}`),g+=h.move(" "+o),g+=h.move(a.safe(t.title,{before:g,after:o,...h.current()})),g+=h.move(o),m()),g+=h.move(")"),c(),g}function Y5(){return"!"}m1.peek=G5;function m1(t,r,a,u){const o=t.referenceType,f=a.enter("imageReference");let c=a.enter("label");const m=a.createTracker(u);let h=m.move("![");const g=a.safe(t.alt,{before:h,after:"]",...m.current()});h+=m.move(g+"]["),c();const y=a.stack;a.stack=[],c=a.enter("reference");const p=a.safe(a.associationId(t),{before:h,after:"]",...m.current()});return c(),a.stack=y,f(),o==="full"||!g||g!==p?h+=m.move(p+"]"):o==="shortcut"?h=h.slice(0,-1):h+=m.move("]"),h}function G5(){return"!"}h1.peek=F5;function h1(t,r,a){let u=t.value||"",o="`",f=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(u);)o+="`";for(/[^ \r\n]/.test(u)&&(/^[ \r\n]/.test(u)&&/[ \r\n]$/.test(u)||/^`|`$/.test(u))&&(u=" "+u+" ");++f<a.unsafe.length;){const c=a.unsafe[f],m=a.compilePattern(c);let h;if(c.atBreak)for(;h=m.exec(u);){let g=h.index;u.charCodeAt(g)===10&&u.charCodeAt(g-1)===13&&g--,u=u.slice(0,g)+" "+u.slice(h.index+1)}}return o+u+o}function F5(){return"`"}function p1(t,r){const a=Um(t);return!!(!r.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(a===t.url||"mailto:"+a===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}g1.peek=X5;function g1(t,r,a,u){const o=Xm(a),f=o==='"'?"Quote":"Apostrophe",c=a.createTracker(u);let m,h;if(p1(t,a)){const y=a.stack;a.stack=[],m=a.enter("autolink");let p=c.move("<");return p+=c.move(a.containerPhrasing(t,{before:p,after:">",...c.current()})),p+=c.move(">"),m(),a.stack=y,p}m=a.enter("link"),h=a.enter("label");let g=c.move("[");return g+=c.move(a.containerPhrasing(t,{before:g,after:"](",...c.current()})),g+=c.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=a.enter("destinationLiteral"),g+=c.move("<"),g+=c.move(a.safe(t.url,{before:g,after:">",...c.current()})),g+=c.move(">")):(h=a.enter("destinationRaw"),g+=c.move(a.safe(t.url,{before:g,after:t.title?" ":")",...c.current()}))),h(),t.title&&(h=a.enter(`title${f}`),g+=c.move(" "+o),g+=c.move(a.safe(t.title,{before:g,after:o,...c.current()})),g+=c.move(o),h()),g+=c.move(")"),m(),g}function X5(t,r,a){return p1(t,a)?"<":"["}y1.peek=Q5;function y1(t,r,a,u){const o=t.referenceType,f=a.enter("linkReference");let c=a.enter("label");const m=a.createTracker(u);let h=m.move("[");const g=a.containerPhrasing(t,{before:h,after:"]",...m.current()});h+=m.move(g+"]["),c();const y=a.stack;a.stack=[],c=a.enter("reference");const p=a.safe(a.associationId(t),{before:h,after:"]",...m.current()});return c(),a.stack=y,f(),o==="full"||!g||g!==p?h+=m.move(p+"]"):o==="shortcut"?h=h.slice(0,-1):h+=m.move("]"),h}function Q5(){return"["}function Qm(t){const r=t.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function Z5(t){const r=Qm(t),a=t.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function K5(t){const r=t.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function b1(t){const r=t.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function P5(t,r,a,u){const o=a.enter("list"),f=a.bulletCurrent;let c=t.ordered?K5(a):Qm(a);const m=t.ordered?c==="."?")":".":Z5(a);let h=r&&a.bulletLastUsed?c===a.bulletLastUsed:!1;if(!t.ordered){const y=t.children?t.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(h=!0),b1(a)===c&&y){let p=-1;for(;++p<t.children.length;){const v=t.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(c=m),a.bulletCurrent=c;const g=a.containerFlow(t,u);return a.bulletLastUsed=c,a.bulletCurrent=f,o(),g}function J5(t){const r=t.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function $5(t,r,a,u){const o=J5(a);let f=a.bulletCurrent||Qm(a);r&&r.type==="list"&&r.ordered&&(f=(typeof r.start=="number"&&r.start>-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(t))+f);let c=f.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||t.spread))&&(c=Math.ceil(c/4)*4);const m=a.createTracker(u);m.move(f+" ".repeat(c-f.length)),m.shift(c);const h=a.enter("listItem"),g=a.indentLines(a.containerFlow(t,m.current()),y);return h(),g;function y(p,v,S){return v?(S?"":" ".repeat(c))+p:(S?f:f+" ".repeat(c-f.length))+p}}function W5(t,r,a,u){const o=a.enter("paragraph"),f=a.enter("phrasing"),c=a.containerPhrasing(t,u);return f(),o(),c}const e_=ws(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function t_(t,r,a,u){return(t.children.some(function(c){return e_(c)})?a.containerPhrasing:a.containerFlow).call(a,t,u)}function n_(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}x1.peek=l_;function x1(t,r,a,u){const o=n_(a),f=a.enter("strong"),c=a.createTracker(u),m=c.move(o+o);let h=c.move(a.containerPhrasing(t,{after:o,before:m,...c.current()}));const g=h.charCodeAt(0),y=ps(u.before.charCodeAt(u.before.length-1),g,o);y.inside&&(h=su(g)+h.slice(1));const p=h.charCodeAt(h.length-1),v=ps(u.after.charCodeAt(0),p,o);v.inside&&(h=h.slice(0,-1)+su(p));const S=c.move(o+o);return f(),a.attentionEncodeSurroundingInfo={after:v.outside,before:y.outside},m+h+S}function l_(t,r,a){return a.options.strong||"*"}function r_(t,r,a,u){return a.safe(t.value,u)}function a_(t){const r=t.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function i_(t,r,a){const u=(b1(a)+(a.options.ruleSpaces?" ":"")).repeat(a_(a));return a.options.ruleSpaces?u.slice(0,-1):u}const v1={blockquote:j5,break:Rb,code:R5,definition:U5,emphasis:c1,hardBreak:Rb,heading:I5,html:f1,image:d1,imageReference:m1,inlineCode:h1,link:g1,linkReference:y1,list:P5,listItem:$5,paragraph:W5,root:t_,strong:x1,text:r_,thematicBreak:i_};function u_(){return{enter:{table:o_,tableData:Lb,tableHeader:Lb,tableRow:c_},exit:{codeText:f_,table:s_,tableData:Md,tableHeader:Md,tableRow:Md}}}function o_(t){const r=t._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},t),this.data.inTable=!0}function s_(t){this.exit(t),this.data.inTable=void 0}function c_(t){this.enter({type:"tableRow",children:[]},t)}function Md(t){this.exit(t)}function Lb(t){this.enter({type:"tableCell",children:[]},t)}function f_(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,d_));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(t)}function d_(t,r){return r==="|"?r:t}function m_(t){const r=t||{},a=r.tableCellPadding,u=r.tablePipeAlign,o=r.stringLength,f=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
373
373
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:c,tableCell:h,tableRow:m}};function c(S,E,T,j){return g(y(S,T,j),S.align)}function m(S,E,T,j){const A=p(S,T,j),D=g([A]);return D.slice(0,D.indexOf(`
374
- `))}function h(S,E,T,j){const A=T.enter("tableCell"),D=T.enter("phrasing"),L=T.containerPhrasing(S,{...j,before:f,after:f});return D(),A(),L}function g(S,E){return N5(S,{align:E,alignDelimiters:u,padding:a,stringLength:o})}function y(S,E,T){const j=S.children;let A=-1;const D=[],L=E.enter("table");for(;++A<j.length;)D[A]=p(j[A],E,T);return L(),D}function p(S,E,T){const j=S.children;let A=-1;const D=[],L=E.enter("tableRow");for(;++A<j.length;)D[A]=h(j[A],S,E,T);return L(),D}function v(S,E,T){let j=v1.inlineCode(S,E,T);return T.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function h_(){return{exit:{taskListCheckValueChecked:Ub,taskListCheckValueUnchecked:Ub,paragraph:g_}}}function p_(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:y_}}}function Ub(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function g_(t){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const u=a.children[0];if(u&&u.type==="text"){const o=r.children;let f=-1,c;for(;++f<o.length;){const m=o[f];if(m.type==="paragraph"){c=m;break}}c===a&&(u.value=u.value.slice(1),u.value.length===0?a.children.shift():a.position&&u.position&&typeof u.position.start.offset=="number"&&(u.position.start.column++,u.position.start.offset++,a.position.start=Object.assign({},u.position.start)))}}this.exit(t)}function y_(t,r,a,u){const o=t.children[0],f=typeof t.checked=="boolean"&&o&&o.type==="paragraph",c="["+(t.checked?"x":" ")+"] ",m=a.createTracker(u);f&&m.move(c);let h=v1.listItem(t,r,a,{...u,...m.current()});return f&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),h;function g(y){return y+c}}function b_(){return[Pj(),y5(),S5(),u_(),h_()]}function x_(t){return{extensions:[Jj(),b5(t),w5(),m_(t),p_()]}}const v_={tokenize:T_,partial:!0},S1={tokenize:N_,partial:!0},w1={tokenize:A_,partial:!0},k1={tokenize:j_,partial:!0},S_={tokenize:__,partial:!0},E1={name:"wwwAutolink",tokenize:E_,previous:T1},C1={name:"protocolAutolink",tokenize:C_,previous:N1},Tl={name:"emailAutolink",tokenize:k_,previous:A1},nl={};function w_(){return{text:nl}}let Or=48;for(;Or<123;)nl[Or]=Tl,Or++,Or===58?Or=65:Or===91&&(Or=97);nl[43]=Tl;nl[45]=Tl;nl[46]=Tl;nl[95]=Tl;nl[72]=[Tl,C1];nl[104]=[Tl,C1];nl[87]=[Tl,E1];nl[119]=[Tl,E1];function k_(t,r,a){const u=this;let o,f;return c;function c(p){return!fm(p)||!A1.call(u,u.previous)||Zm(u.events)?a(p):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(p))}function m(p){return fm(p)?(t.consume(p),m):p===64?(t.consume(p),h):a(p)}function h(p){return p===46?t.check(S_,y,g)(p):p===45||p===95||Mt(p)?(f=!0,t.consume(p),h):y(p)}function g(p){return t.consume(p),o=!0,h}function y(p){return f&&o&&It(u.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(p)):a(p)}}function E_(t,r,a){const u=this;return o;function o(c){return c!==87&&c!==119||!T1.call(u,u.previous)||Zm(u.events)?a(c):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(v_,t.attempt(S1,t.attempt(w1,f),a),a)(c))}function f(c){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(c)}}function C_(t,r,a){const u=this;let o="",f=!1;return c;function c(p){return(p===72||p===104)&&N1.call(u,u.previous)&&!Zm(u.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(p),t.consume(p),m):a(p)}function m(p){if(It(p)&&o.length<5)return o+=String.fromCodePoint(p),t.consume(p),m;if(p===58){const v=o.toLowerCase();if(v==="http"||v==="https")return t.consume(p),h}return a(p)}function h(p){return p===47?(t.consume(p),f?g:(f=!0,h)):a(p)}function g(p){return p===null||ds(p)||tt(p)||Br(p)||xs(p)?a(p):t.attempt(S1,t.attempt(w1,y),a)(p)}function y(p){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(p)}}function T_(t,r,a){let u=0;return o;function o(c){return(c===87||c===119)&&u<3?(u++,t.consume(c),o):c===46&&u===3?(t.consume(c),f):a(c)}function f(c){return c===null?a(c):r(c)}}function N_(t,r,a){let u,o,f;return c;function c(g){return g===46||g===95?t.check(k1,h,m)(g):g===null||tt(g)||Br(g)||g!==45&&xs(g)?h(g):(f=!0,t.consume(g),c)}function m(g){return g===95?u=!0:(o=u,u=void 0),t.consume(g),c}function h(g){return o||u||!f?a(g):r(g)}}function A_(t,r){let a=0,u=0;return o;function o(c){return c===40?(a++,t.consume(c),o):c===41&&u<a?f(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?t.check(k1,r,f)(c):c===null||tt(c)||Br(c)?r(c):(t.consume(c),o)}function f(c){return c===41&&u++,t.consume(c),o}}function j_(t,r,a){return u;function u(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),u):m===38?(t.consume(m),f):m===93?(t.consume(m),o):m===60||m===null||tt(m)||Br(m)?r(m):a(m)}function o(m){return m===null||m===40||m===91||tt(m)||Br(m)?r(m):u(m)}function f(m){return It(m)?c(m):a(m)}function c(m){return m===59?(t.consume(m),u):It(m)?(t.consume(m),c):a(m)}}function __(t,r,a){return u;function u(f){return t.consume(f),o}function o(f){return Mt(f)?a(f):r(f)}}function T1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||tt(t)}function N1(t){return!It(t)}function A1(t){return!(t===47||fm(t))}function fm(t){return t===43||t===45||t===46||t===95||Mt(t)}function Zm(t){let r=t.length,a=!1;for(;r--;){const u=t[r][1];if((u.type==="labelLink"||u.type==="labelImage")&&!u._balanced){a=!0;break}if(u._gfmAutolinkLiteralWalkedInto){a=!1;break}}return t.length>0&&!a&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const z_={tokenize:H_,partial:!0};function O_(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:L_,continuation:{tokenize:U_},exit:B_}},text:{91:{name:"gfmFootnoteCall",tokenize:R_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:M_,resolveTo:D_}}}}function M_(t,r,a){const u=this;let o=u.events.length;const f=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c;for(;o--;){const h=u.events[o][1];if(h.type==="labelImage"){c=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return m;function m(h){if(!c||!c._balanced)return a(h);const g=Ln(u.sliceSerialize({start:c.end,end:u.now()}));return g.codePointAt(0)!==94||!f.includes(g.slice(1))?a(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),r(h))}}function D_(t,r){let a=t.length;for(;a--;)if(t[a][1].type==="labelImage"&&t[a][0]==="enter"){t[a][1];break}t[a+1][1].type="data",t[a+3][1].type="gfmFootnoteCallLabelMarker";const u={type:"gfmFootnoteCall",start:Object.assign({},t[a+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[a+3][1].end),end:Object.assign({},t[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const f={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},m=[t[a+1],t[a+2],["enter",u,r],t[a+3],t[a+4],["enter",o,r],["exit",o,r],["enter",f,r],["enter",c,r],["exit",c,r],["exit",f,r],t[t.length-2],t[t.length-1],["exit",u,r]];return t.splice(a,t.length-a+1,...m),t}function R_(t,r,a){const u=this,o=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let f=0,c;return m;function m(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),h}function h(p){return p!==94?a(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",g)}function g(p){if(f>999||p===93&&!c||p===null||p===91||tt(p))return a(p);if(p===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return o.includes(Ln(u.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):a(p)}return tt(p)||(c=!0),f++,t.consume(p),p===92?y:g}function y(p){return p===91||p===92||p===93?(t.consume(p),f++,g):g(p)}}function L_(t,r,a){const u=this,o=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let f,c=0,m;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",y):a(E)}function y(E){if(c>999||E===93&&!m||E===null||E===91||tt(E))return a(E);if(E===93){t.exit("chunkString");const T=t.exit("gfmFootnoteDefinitionLabelString");return f=Ln(u.sliceSerialize(T)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return tt(E)||(m=!0),c++,t.consume(E),E===92?p:y}function p(E){return E===91||E===92||E===93?(t.consume(E),c++,y):y(E)}function v(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),o.includes(f)||o.push(f),Ie(t,S,"gfmFootnoteDefinitionWhitespace")):a(E)}function S(E){return r(E)}}function U_(t,r,a){return t.check(hu,r,t.attempt(z_,r,a))}function B_(t){t.exit("gfmFootnoteDefinition")}function H_(t,r,a){const u=this;return Ie(t,o,"gfmFootnoteDefinitionIndent",5);function o(f){const c=u.events[u.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?r(f):a(f)}}function q_(t){let a=(t||{}).singleTilde;const u={name:"strikethrough",tokenize:f,resolveAll:o};return a==null&&(a=!0),{text:{126:u},insideSpan:{null:[u]},attentionMarkers:{null:[126]}};function o(c,m){let h=-1;for(;++h<c.length;)if(c[h][0]==="enter"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._close){let g=h;for(;g--;)if(c[g][0]==="exit"&&c[g][1].type==="strikethroughSequenceTemporary"&&c[g][1]._open&&c[h][1].end.offset-c[h][1].start.offset===c[g][1].end.offset-c[g][1].start.offset){c[h][1].type="strikethroughSequence",c[g][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[g][1].start),end:Object.assign({},c[h][1].end)},p={type:"strikethroughText",start:Object.assign({},c[g][1].end),end:Object.assign({},c[h][1].start)},v=[["enter",y,m],["enter",c[g][1],m],["exit",c[g][1],m],["enter",p,m]],S=m.parser.constructs.insideSpan.null;S&&mn(v,v.length,0,vs(S,c.slice(g+1,h),m)),mn(v,v.length,0,[["exit",p,m],["enter",c[h][1],m],["exit",c[h][1],m],["exit",y,m]]),mn(c,g-1,h-g+3,v),h=g+v.length-2;break}}for(h=-1;++h<c.length;)c[h][1].type==="strikethroughSequenceTemporary"&&(c[h][1].type="data");return c}function f(c,m,h){const g=this.previous,y=this.events;let p=0;return v;function v(E){return g===126&&y[y.length-1][1].type!=="characterEscape"?h(E):(c.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const T=Qa(g);if(E===126)return p>1?h(E):(c.consume(E),p++,S);if(p<2&&!a)return h(E);const j=c.exit("strikethroughSequenceTemporary"),A=Qa(E);return j._open=!A||A===2&&!!T,j._close=!T||T===2&&!!A,m(E)}}}class I_{constructor(){this.map=[]}add(r,a,u){V_(this,r,a,u)}consume(r){if(this.map.sort(function(f,c){return f[0]-c[0]}),this.map.length===0)return;let a=this.map.length;const u=[];for(;a>0;)a-=1,u.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];u.push(r.slice()),r.length=0;let o=u.pop();for(;o;){for(const f of o)r.push(f);o=u.pop()}this.map.length=0}}function V_(t,r,a,u){let o=0;if(!(a===0&&u.length===0)){for(;o<t.map.length;){if(t.map[o][0]===r){t.map[o][1]+=a,t.map[o][2].push(...u);return}o+=1}t.map.push([r,a,u])}}function Y_(t,r){let a=!1;const u=[];for(;r<t.length;){const o=t[r];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&u.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[r-1][1].type==="tableDelimiterMarker"){const f=u.length-1;u[f]=u[f]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);r+=1}return u}function G_(){return{flow:{null:{name:"table",tokenize:F_,resolveAll:X_}}}}function F_(t,r,a){const u=this;let o=0,f=0,c;return m;function m(H){let ne=u.events.length-1;for(;ne>-1;){const se=u.events[ne][1].type;if(se==="lineEnding"||se==="linePrefix")ne--;else break}const J=ne>-1?u.events[ne][1].type:null,ve=J==="tableHead"||J==="tableRow"?M:h;return ve===M&&u.parser.lazy[u.now().line]?a(H):ve(H)}function h(H){return t.enter("tableHead"),t.enter("tableRow"),g(H)}function g(H){return H===124||(c=!0,f+=1),y(H)}function y(H){return H===null?a(H):we(H)?f>1?(f=0,u.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),S):a(H):Ue(H)?Ie(t,y,"whitespace")(H):(f+=1,c&&(c=!1,o+=1),H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),c=!0,y):(t.enter("data"),p(H)))}function p(H){return H===null||H===124||tt(H)?(t.exit("data"),y(H)):(t.consume(H),H===92?v:p)}function v(H){return H===92||H===124?(t.consume(H),p):p(H)}function S(H){return u.interrupt=!1,u.parser.lazy[u.now().line]?a(H):(t.enter("tableDelimiterRow"),c=!1,Ue(H)?Ie(t,E,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?j(H):H===124?(c=!0,t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),T):W(H)}function T(H){return Ue(H)?Ie(t,j,"whitespace")(H):j(H)}function j(H){return H===58?(f+=1,c=!0,t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),A):H===45?(f+=1,A(H)):H===null||we(H)?P(H):W(H)}function A(H){return H===45?(t.enter("tableDelimiterFiller"),D(H)):W(H)}function D(H){return H===45?(t.consume(H),D):H===58?(c=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),L):(t.exit("tableDelimiterFiller"),L(H))}function L(H){return Ue(H)?Ie(t,P,"whitespace")(H):P(H)}function P(H){return H===124?E(H):H===null||we(H)?!c||o!==f?W(H):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(H)):W(H)}function W(H){return a(H)}function M(H){return t.enter("tableRow"),F(H)}function F(H){return H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),F):H===null||we(H)?(t.exit("tableRow"),r(H)):Ue(H)?Ie(t,F,"whitespace")(H):(t.enter("data"),q(H))}function q(H){return H===null||H===124||tt(H)?(t.exit("data"),F(H)):(t.consume(H),H===92?ie:q)}function ie(H){return H===92||H===124?(t.consume(H),q):q(H)}}function X_(t,r){let a=-1,u=!0,o=0,f=[0,0,0,0],c=[0,0,0,0],m=!1,h=0,g,y,p;const v=new I_;for(;++a<t.length;){const S=t[a],E=S[1];S[0]==="enter"?E.type==="tableHead"?(m=!1,h!==0&&(Bb(v,r,h,g,y),y=void 0,h=0),g={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(a,0,[["enter",g,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(u=!0,p=void 0,f=[0,0,0,0],c=[0,a+1,0,0],m&&(m=!1,y={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(a,0,[["enter",y,r]])),o=E.type==="tableDelimiterRow"?2:y?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(u=!1,c[2]===0&&(f[1]!==0&&(c[0]=c[1],p=ls(v,r,f,o,void 0,p),f=[0,0,0,0]),c[2]=a)):E.type==="tableCellDivider"&&(u?u=!1:(f[1]!==0&&(c[0]=c[1],p=ls(v,r,f,o,void 0,p)),f=c,c=[f[1],a,0,0])):E.type==="tableHead"?(m=!0,h=a):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=a,f[1]!==0?(c[0]=c[1],p=ls(v,r,f,o,a,p)):c[1]!==0&&(p=ls(v,r,c,o,a,p)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=a)}for(h!==0&&Bb(v,r,h,g,y),v.consume(r.events),a=-1;++a<r.events.length;){const S=r.events[a];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=Y_(r.events,a))}return t}function ls(t,r,a,u,o,f){const c=u===1?"tableHeader":u===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(f.end=Object.assign({},Va(r.events,a[0])),t.add(a[0],0,[["exit",f,r]]));const h=Va(r.events,a[1]);if(f={type:c,start:Object.assign({},h),end:Object.assign({},h)},t.add(a[1],0,[["enter",f,r]]),a[2]!==0){const g=Va(r.events,a[2]),y=Va(r.events,a[3]),p={type:m,start:Object.assign({},g),end:Object.assign({},y)};if(t.add(a[2],0,[["enter",p,r]]),u!==2){const v=r.events[a[2]],S=r.events[a[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",a[3]>a[2]+1){const E=a[2]+1,T=a[3]-a[2]-1;t.add(E,T,[])}}t.add(a[3]+1,0,[["exit",p,r]])}return o!==void 0&&(f.end=Object.assign({},Va(r.events,o)),t.add(o,0,[["exit",f,r]]),f=void 0),f}function Bb(t,r,a,u,o){const f=[],c=Va(r.events,a);o&&(o.end=Object.assign({},c),f.push(["exit",o,r])),u.end=Object.assign({},c),f.push(["exit",u,r]),t.add(a+1,0,f)}function Va(t,r){const a=t[r],u=a[0]==="enter"?"start":"end";return a[1][u]}const Q_={name:"tasklistCheck",tokenize:K_};function Z_(){return{text:{91:Q_}}}function K_(t,r,a){const u=this;return o;function o(h){return u.previous!==null||!u._gfmTasklistFirstContentOfListItem?a(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),f)}function f(h){return tt(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),c):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),c):a(h)}function c(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):a(h)}function m(h){return we(h)?r(h):Ue(h)?t.check({tokenize:P_},r,a)(h):a(h)}}function P_(t,r,a){return Ie(t,u,"whitespace");function u(o){return o===null?a(o):r(o)}}function J_(t){return Bv([w_(),O_(),q_(t),G_(),Z_()])}const $_={};function W_(t){const r=this,a=t||$_,u=r.data(),o=u.micromarkExtensions||(u.micromarkExtensions=[]),f=u.fromMarkdownExtensions||(u.fromMarkdownExtensions=[]),c=u.toMarkdownExtensions||(u.toMarkdownExtensions=[]);o.push(J_(a)),f.push(b_()),c.push(x_(a))}const ez="modulepreload",tz=function(t){return"/"+t},Hb={},Km=function(r,a,u){let o=Promise.resolve();if(a&&a.length>0){let c=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=c(a.map(g=>{if(g=tz(g),g in Hb)return;Hb[g]=!0;const y=g.endsWith(".css"),p=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${p}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":ez,y||(v.as="script"),v.crossOrigin="",v.href=g,h&&v.setAttribute("nonce",h),document.head.appendChild(v),y)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${g}`)))})}))}function f(c){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=c,window.dispatchEvent(m),!m.defaultPrevented)throw c}return o.then(c=>{for(const m of c||[])m.status==="rejected"&&f(m.reason);return r().catch(f)})};let Dd=null;const Rd=new Map;function j1(){return Dd||(Dd=Km(async()=>{const{createHighlighter:t}=await import("./index-HrybHVLc.js");return{createHighlighter:t}},[]).then(({createHighlighter:t})=>t({themes:["github-dark"],langs:["plaintext"]}))),Dd}function nz(t){const r=Rd.get(t);if(r)return r;const a=Km(()=>import("./index-HrybHVLc.js"),[]).then(async({bundledLanguages:u,isSpecialLang:o})=>{if(o(t))return;const f=u[t];if(!f)throw new Error(`unknown lang: ${t}`);const c=await j1();c.getLoadedLanguages().includes(t)||await c.loadLanguage(f)}).catch(u=>{throw Rd.delete(t),u});return Rd.set(t,a),a}function lz({code:t,language:r}){const[a,u]=w.useState(null),[o,f]=w.useState(0),[c,m]=w.useState(!1),h=w.useRef(null);w.useEffect(()=>{let y=!1;async function p(){const v=await j1();if(y)return;let S="plaintext";if(r){const{isSpecialLang:E}=await Km(async()=>{const{isSpecialLang:j}=await import("./index-HrybHVLc.js");return{isSpecialLang:j}},[]),T=v.getLoadedLanguages();E(r)||T.includes(r)?S=r:(nz(r).then(()=>{y||f(j=>j+1)}).catch(()=>{}),S="plaintext")}try{const E=v.codeToHtml(t,{lang:S,theme:"github-dark"});y||u(E)}catch{}}return u(null),p().catch(()=>{}),()=>{y=!0}},[t,r,o]),w.useEffect(()=>()=>{h.current!==null&&clearTimeout(h.current)},[]);const g=w.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{m(!0),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>m(!1),2e3)}).catch(()=>{})},[t]);return b.jsxs("div",{className:"relative group rounded-md bg-secondary overflow-hidden mb-2",children:[r&&b.jsx("div",{className:"text-[10px] text-muted-foreground px-3 pt-1.5 select-none",children:r}),b.jsx("button",{onClick:g,"aria-label":"Copy code",className:"absolute top-1.5 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded p-1 text-muted-foreground hover:text-foreground hover:bg-white/10",children:c?b.jsx(gm,{size:13,strokeWidth:2.5}):b.jsx(Kb,{size:13,strokeWidth:2})}),a!==null?b.jsx("div",{className:"overflow-x-auto text-xs leading-5 [&>pre]:p-3 [&>pre]:m-0 [&>pre]:bg-transparent! [&>pre]:font-mono",dangerouslySetInnerHTML:{__html:a}}):b.jsx("pre",{className:"overflow-x-auto p-3 font-mono text-xs leading-5 text-foreground",children:b.jsx("code",{children:t})})]})}const rz={h1:({children:t})=>b.jsx("h1",{className:"mb-3 text-xl font-bold",children:t}),h2:({children:t})=>b.jsx("h2",{className:"mb-2 text-lg font-semibold",children:t}),h3:({children:t})=>b.jsx("h3",{className:"mb-1.5 text-base font-semibold",children:t}),p:({children:t})=>b.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),ul:({children:t})=>b.jsx("ul",{className:"mb-2 ml-4 list-disc space-y-0.5",children:t}),ol:({children:t})=>b.jsx("ol",{className:"mb-2 ml-4 list-decimal space-y-0.5",children:t}),li:({children:t})=>b.jsx("li",{className:"text-sm",children:t}),blockquote:({children:t})=>b.jsx("blockquote",{className:"mb-2 border-l-2 border-brand/50 pl-3 italic text-muted-foreground",children:t}),a:({href:t,children:r})=>t&&/^(https?:\/\/|\/(?!\/)|#)/i.test(t)?b.jsx("a",{href:t,className:"text-brand underline underline-offset-2 hover:text-brand/80",target:"_blank",rel:"noopener noreferrer",children:r}):b.jsx("span",{className:"text-muted-foreground",children:r}),strong:({children:t})=>b.jsx("strong",{className:"font-semibold text-foreground",children:t}),em:({children:t})=>b.jsx("em",{className:"italic text-muted-foreground",children:t}),hr:()=>b.jsx("hr",{className:"my-3 border-border"}),table:({children:t})=>b.jsx("div",{className:"mb-2 overflow-x-auto rounded border border-border",children:b.jsx("table",{className:"w-full text-sm",children:t})}),thead:({children:t})=>b.jsx("thead",{className:"bg-secondary text-secondary-foreground",children:t}),th:({children:t})=>b.jsx("th",{className:"px-3 py-1.5 text-left font-medium",children:t}),td:({children:t})=>b.jsx("td",{className:"border-t border-border px-3 py-1.5",children:t}),code:({children:t,className:r})=>{var u;return((u=/language-(\w+)/.exec(r??""))==null?void 0:u[1])?b.jsx("code",{className:oe("text-xs",r),children:t}):b.jsx("code",{className:"rounded bg-secondary px-1 py-0.5 font-mono text-[11px] text-foreground",children:t})},pre:({children:t})=>{var o,f,c;const r=t,a=(f=/language-(\w+)/.exec(((o=r==null?void 0:r.props)==null?void 0:o.className)??""))==null?void 0:f[1],u=String(((c=r==null?void 0:r.props)==null?void 0:c.children)??"").replace(/\n$/,"");return b.jsx(lz,{code:u,language:a})}};function _1({text:t,className:r}){return b.jsx("div",{className:oe("text-sm text-foreground",r),children:b.jsx(qj,{remarkPlugins:[W_],components:rz,children:t})})}function az(){return b.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})}const iz=/^[ \t]*(`{3,}|~{4,})/;function uz(t,r){if(r>=t.length)return r;const a=t.lastIndexOf(`
374
+ `))}function h(S,E,T,j){const A=T.enter("tableCell"),D=T.enter("phrasing"),L=T.containerPhrasing(S,{...j,before:f,after:f});return D(),A(),L}function g(S,E){return N5(S,{align:E,alignDelimiters:u,padding:a,stringLength:o})}function y(S,E,T){const j=S.children;let A=-1;const D=[],L=E.enter("table");for(;++A<j.length;)D[A]=p(j[A],E,T);return L(),D}function p(S,E,T){const j=S.children;let A=-1;const D=[],L=E.enter("tableRow");for(;++A<j.length;)D[A]=h(j[A],S,E,T);return L(),D}function v(S,E,T){let j=v1.inlineCode(S,E,T);return T.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function h_(){return{exit:{taskListCheckValueChecked:Ub,taskListCheckValueUnchecked:Ub,paragraph:g_}}}function p_(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:y_}}}function Ub(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function g_(t){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const u=a.children[0];if(u&&u.type==="text"){const o=r.children;let f=-1,c;for(;++f<o.length;){const m=o[f];if(m.type==="paragraph"){c=m;break}}c===a&&(u.value=u.value.slice(1),u.value.length===0?a.children.shift():a.position&&u.position&&typeof u.position.start.offset=="number"&&(u.position.start.column++,u.position.start.offset++,a.position.start=Object.assign({},u.position.start)))}}this.exit(t)}function y_(t,r,a,u){const o=t.children[0],f=typeof t.checked=="boolean"&&o&&o.type==="paragraph",c="["+(t.checked?"x":" ")+"] ",m=a.createTracker(u);f&&m.move(c);let h=v1.listItem(t,r,a,{...u,...m.current()});return f&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),h;function g(y){return y+c}}function b_(){return[Pj(),y5(),S5(),u_(),h_()]}function x_(t){return{extensions:[Jj(),b5(t),w5(),m_(t),p_()]}}const v_={tokenize:T_,partial:!0},S1={tokenize:N_,partial:!0},w1={tokenize:A_,partial:!0},k1={tokenize:j_,partial:!0},S_={tokenize:__,partial:!0},E1={name:"wwwAutolink",tokenize:E_,previous:T1},C1={name:"protocolAutolink",tokenize:C_,previous:N1},Tl={name:"emailAutolink",tokenize:k_,previous:A1},nl={};function w_(){return{text:nl}}let Or=48;for(;Or<123;)nl[Or]=Tl,Or++,Or===58?Or=65:Or===91&&(Or=97);nl[43]=Tl;nl[45]=Tl;nl[46]=Tl;nl[95]=Tl;nl[72]=[Tl,C1];nl[104]=[Tl,C1];nl[87]=[Tl,E1];nl[119]=[Tl,E1];function k_(t,r,a){const u=this;let o,f;return c;function c(p){return!fm(p)||!A1.call(u,u.previous)||Zm(u.events)?a(p):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(p))}function m(p){return fm(p)?(t.consume(p),m):p===64?(t.consume(p),h):a(p)}function h(p){return p===46?t.check(S_,y,g)(p):p===45||p===95||Mt(p)?(f=!0,t.consume(p),h):y(p)}function g(p){return t.consume(p),o=!0,h}function y(p){return f&&o&&It(u.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(p)):a(p)}}function E_(t,r,a){const u=this;return o;function o(c){return c!==87&&c!==119||!T1.call(u,u.previous)||Zm(u.events)?a(c):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(v_,t.attempt(S1,t.attempt(w1,f),a),a)(c))}function f(c){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(c)}}function C_(t,r,a){const u=this;let o="",f=!1;return c;function c(p){return(p===72||p===104)&&N1.call(u,u.previous)&&!Zm(u.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(p),t.consume(p),m):a(p)}function m(p){if(It(p)&&o.length<5)return o+=String.fromCodePoint(p),t.consume(p),m;if(p===58){const v=o.toLowerCase();if(v==="http"||v==="https")return t.consume(p),h}return a(p)}function h(p){return p===47?(t.consume(p),f?g:(f=!0,h)):a(p)}function g(p){return p===null||ds(p)||tt(p)||Br(p)||xs(p)?a(p):t.attempt(S1,t.attempt(w1,y),a)(p)}function y(p){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(p)}}function T_(t,r,a){let u=0;return o;function o(c){return(c===87||c===119)&&u<3?(u++,t.consume(c),o):c===46&&u===3?(t.consume(c),f):a(c)}function f(c){return c===null?a(c):r(c)}}function N_(t,r,a){let u,o,f;return c;function c(g){return g===46||g===95?t.check(k1,h,m)(g):g===null||tt(g)||Br(g)||g!==45&&xs(g)?h(g):(f=!0,t.consume(g),c)}function m(g){return g===95?u=!0:(o=u,u=void 0),t.consume(g),c}function h(g){return o||u||!f?a(g):r(g)}}function A_(t,r){let a=0,u=0;return o;function o(c){return c===40?(a++,t.consume(c),o):c===41&&u<a?f(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?t.check(k1,r,f)(c):c===null||tt(c)||Br(c)?r(c):(t.consume(c),o)}function f(c){return c===41&&u++,t.consume(c),o}}function j_(t,r,a){return u;function u(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),u):m===38?(t.consume(m),f):m===93?(t.consume(m),o):m===60||m===null||tt(m)||Br(m)?r(m):a(m)}function o(m){return m===null||m===40||m===91||tt(m)||Br(m)?r(m):u(m)}function f(m){return It(m)?c(m):a(m)}function c(m){return m===59?(t.consume(m),u):It(m)?(t.consume(m),c):a(m)}}function __(t,r,a){return u;function u(f){return t.consume(f),o}function o(f){return Mt(f)?a(f):r(f)}}function T1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||tt(t)}function N1(t){return!It(t)}function A1(t){return!(t===47||fm(t))}function fm(t){return t===43||t===45||t===46||t===95||Mt(t)}function Zm(t){let r=t.length,a=!1;for(;r--;){const u=t[r][1];if((u.type==="labelLink"||u.type==="labelImage")&&!u._balanced){a=!0;break}if(u._gfmAutolinkLiteralWalkedInto){a=!1;break}}return t.length>0&&!a&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const z_={tokenize:H_,partial:!0};function O_(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:L_,continuation:{tokenize:U_},exit:B_}},text:{91:{name:"gfmFootnoteCall",tokenize:R_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:M_,resolveTo:D_}}}}function M_(t,r,a){const u=this;let o=u.events.length;const f=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c;for(;o--;){const h=u.events[o][1];if(h.type==="labelImage"){c=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return m;function m(h){if(!c||!c._balanced)return a(h);const g=Ln(u.sliceSerialize({start:c.end,end:u.now()}));return g.codePointAt(0)!==94||!f.includes(g.slice(1))?a(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),r(h))}}function D_(t,r){let a=t.length;for(;a--;)if(t[a][1].type==="labelImage"&&t[a][0]==="enter"){t[a][1];break}t[a+1][1].type="data",t[a+3][1].type="gfmFootnoteCallLabelMarker";const u={type:"gfmFootnoteCall",start:Object.assign({},t[a+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[a+3][1].end),end:Object.assign({},t[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const f={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},m=[t[a+1],t[a+2],["enter",u,r],t[a+3],t[a+4],["enter",o,r],["exit",o,r],["enter",f,r],["enter",c,r],["exit",c,r],["exit",f,r],t[t.length-2],t[t.length-1],["exit",u,r]];return t.splice(a,t.length-a+1,...m),t}function R_(t,r,a){const u=this,o=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let f=0,c;return m;function m(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),h}function h(p){return p!==94?a(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",g)}function g(p){if(f>999||p===93&&!c||p===null||p===91||tt(p))return a(p);if(p===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return o.includes(Ln(u.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):a(p)}return tt(p)||(c=!0),f++,t.consume(p),p===92?y:g}function y(p){return p===91||p===92||p===93?(t.consume(p),f++,g):g(p)}}function L_(t,r,a){const u=this,o=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let f,c=0,m;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",y):a(E)}function y(E){if(c>999||E===93&&!m||E===null||E===91||tt(E))return a(E);if(E===93){t.exit("chunkString");const T=t.exit("gfmFootnoteDefinitionLabelString");return f=Ln(u.sliceSerialize(T)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return tt(E)||(m=!0),c++,t.consume(E),E===92?p:y}function p(E){return E===91||E===92||E===93?(t.consume(E),c++,y):y(E)}function v(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),o.includes(f)||o.push(f),Ie(t,S,"gfmFootnoteDefinitionWhitespace")):a(E)}function S(E){return r(E)}}function U_(t,r,a){return t.check(hu,r,t.attempt(z_,r,a))}function B_(t){t.exit("gfmFootnoteDefinition")}function H_(t,r,a){const u=this;return Ie(t,o,"gfmFootnoteDefinitionIndent",5);function o(f){const c=u.events[u.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?r(f):a(f)}}function q_(t){let a=(t||{}).singleTilde;const u={name:"strikethrough",tokenize:f,resolveAll:o};return a==null&&(a=!0),{text:{126:u},insideSpan:{null:[u]},attentionMarkers:{null:[126]}};function o(c,m){let h=-1;for(;++h<c.length;)if(c[h][0]==="enter"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._close){let g=h;for(;g--;)if(c[g][0]==="exit"&&c[g][1].type==="strikethroughSequenceTemporary"&&c[g][1]._open&&c[h][1].end.offset-c[h][1].start.offset===c[g][1].end.offset-c[g][1].start.offset){c[h][1].type="strikethroughSequence",c[g][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[g][1].start),end:Object.assign({},c[h][1].end)},p={type:"strikethroughText",start:Object.assign({},c[g][1].end),end:Object.assign({},c[h][1].start)},v=[["enter",y,m],["enter",c[g][1],m],["exit",c[g][1],m],["enter",p,m]],S=m.parser.constructs.insideSpan.null;S&&mn(v,v.length,0,vs(S,c.slice(g+1,h),m)),mn(v,v.length,0,[["exit",p,m],["enter",c[h][1],m],["exit",c[h][1],m],["exit",y,m]]),mn(c,g-1,h-g+3,v),h=g+v.length-2;break}}for(h=-1;++h<c.length;)c[h][1].type==="strikethroughSequenceTemporary"&&(c[h][1].type="data");return c}function f(c,m,h){const g=this.previous,y=this.events;let p=0;return v;function v(E){return g===126&&y[y.length-1][1].type!=="characterEscape"?h(E):(c.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const T=Qa(g);if(E===126)return p>1?h(E):(c.consume(E),p++,S);if(p<2&&!a)return h(E);const j=c.exit("strikethroughSequenceTemporary"),A=Qa(E);return j._open=!A||A===2&&!!T,j._close=!T||T===2&&!!A,m(E)}}}class I_{constructor(){this.map=[]}add(r,a,u){V_(this,r,a,u)}consume(r){if(this.map.sort(function(f,c){return f[0]-c[0]}),this.map.length===0)return;let a=this.map.length;const u=[];for(;a>0;)a-=1,u.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];u.push(r.slice()),r.length=0;let o=u.pop();for(;o;){for(const f of o)r.push(f);o=u.pop()}this.map.length=0}}function V_(t,r,a,u){let o=0;if(!(a===0&&u.length===0)){for(;o<t.map.length;){if(t.map[o][0]===r){t.map[o][1]+=a,t.map[o][2].push(...u);return}o+=1}t.map.push([r,a,u])}}function Y_(t,r){let a=!1;const u=[];for(;r<t.length;){const o=t[r];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&u.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[r-1][1].type==="tableDelimiterMarker"){const f=u.length-1;u[f]=u[f]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);r+=1}return u}function G_(){return{flow:{null:{name:"table",tokenize:F_,resolveAll:X_}}}}function F_(t,r,a){const u=this;let o=0,f=0,c;return m;function m(H){let ne=u.events.length-1;for(;ne>-1;){const se=u.events[ne][1].type;if(se==="lineEnding"||se==="linePrefix")ne--;else break}const J=ne>-1?u.events[ne][1].type:null,ve=J==="tableHead"||J==="tableRow"?M:h;return ve===M&&u.parser.lazy[u.now().line]?a(H):ve(H)}function h(H){return t.enter("tableHead"),t.enter("tableRow"),g(H)}function g(H){return H===124||(c=!0,f+=1),y(H)}function y(H){return H===null?a(H):we(H)?f>1?(f=0,u.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),S):a(H):Ue(H)?Ie(t,y,"whitespace")(H):(f+=1,c&&(c=!1,o+=1),H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),c=!0,y):(t.enter("data"),p(H)))}function p(H){return H===null||H===124||tt(H)?(t.exit("data"),y(H)):(t.consume(H),H===92?v:p)}function v(H){return H===92||H===124?(t.consume(H),p):p(H)}function S(H){return u.interrupt=!1,u.parser.lazy[u.now().line]?a(H):(t.enter("tableDelimiterRow"),c=!1,Ue(H)?Ie(t,E,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?j(H):H===124?(c=!0,t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),T):W(H)}function T(H){return Ue(H)?Ie(t,j,"whitespace")(H):j(H)}function j(H){return H===58?(f+=1,c=!0,t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),A):H===45?(f+=1,A(H)):H===null||we(H)?P(H):W(H)}function A(H){return H===45?(t.enter("tableDelimiterFiller"),D(H)):W(H)}function D(H){return H===45?(t.consume(H),D):H===58?(c=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),L):(t.exit("tableDelimiterFiller"),L(H))}function L(H){return Ue(H)?Ie(t,P,"whitespace")(H):P(H)}function P(H){return H===124?E(H):H===null||we(H)?!c||o!==f?W(H):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(H)):W(H)}function W(H){return a(H)}function M(H){return t.enter("tableRow"),F(H)}function F(H){return H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),F):H===null||we(H)?(t.exit("tableRow"),r(H)):Ue(H)?Ie(t,F,"whitespace")(H):(t.enter("data"),q(H))}function q(H){return H===null||H===124||tt(H)?(t.exit("data"),F(H)):(t.consume(H),H===92?ie:q)}function ie(H){return H===92||H===124?(t.consume(H),q):q(H)}}function X_(t,r){let a=-1,u=!0,o=0,f=[0,0,0,0],c=[0,0,0,0],m=!1,h=0,g,y,p;const v=new I_;for(;++a<t.length;){const S=t[a],E=S[1];S[0]==="enter"?E.type==="tableHead"?(m=!1,h!==0&&(Bb(v,r,h,g,y),y=void 0,h=0),g={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(a,0,[["enter",g,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(u=!0,p=void 0,f=[0,0,0,0],c=[0,a+1,0,0],m&&(m=!1,y={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(a,0,[["enter",y,r]])),o=E.type==="tableDelimiterRow"?2:y?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(u=!1,c[2]===0&&(f[1]!==0&&(c[0]=c[1],p=ls(v,r,f,o,void 0,p),f=[0,0,0,0]),c[2]=a)):E.type==="tableCellDivider"&&(u?u=!1:(f[1]!==0&&(c[0]=c[1],p=ls(v,r,f,o,void 0,p)),f=c,c=[f[1],a,0,0])):E.type==="tableHead"?(m=!0,h=a):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=a,f[1]!==0?(c[0]=c[1],p=ls(v,r,f,o,a,p)):c[1]!==0&&(p=ls(v,r,c,o,a,p)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=a)}for(h!==0&&Bb(v,r,h,g,y),v.consume(r.events),a=-1;++a<r.events.length;){const S=r.events[a];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=Y_(r.events,a))}return t}function ls(t,r,a,u,o,f){const c=u===1?"tableHeader":u===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(f.end=Object.assign({},Va(r.events,a[0])),t.add(a[0],0,[["exit",f,r]]));const h=Va(r.events,a[1]);if(f={type:c,start:Object.assign({},h),end:Object.assign({},h)},t.add(a[1],0,[["enter",f,r]]),a[2]!==0){const g=Va(r.events,a[2]),y=Va(r.events,a[3]),p={type:m,start:Object.assign({},g),end:Object.assign({},y)};if(t.add(a[2],0,[["enter",p,r]]),u!==2){const v=r.events[a[2]],S=r.events[a[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",a[3]>a[2]+1){const E=a[2]+1,T=a[3]-a[2]-1;t.add(E,T,[])}}t.add(a[3]+1,0,[["exit",p,r]])}return o!==void 0&&(f.end=Object.assign({},Va(r.events,o)),t.add(o,0,[["exit",f,r]]),f=void 0),f}function Bb(t,r,a,u,o){const f=[],c=Va(r.events,a);o&&(o.end=Object.assign({},c),f.push(["exit",o,r])),u.end=Object.assign({},c),f.push(["exit",u,r]),t.add(a+1,0,f)}function Va(t,r){const a=t[r],u=a[0]==="enter"?"start":"end";return a[1][u]}const Q_={name:"tasklistCheck",tokenize:K_};function Z_(){return{text:{91:Q_}}}function K_(t,r,a){const u=this;return o;function o(h){return u.previous!==null||!u._gfmTasklistFirstContentOfListItem?a(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),f)}function f(h){return tt(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),c):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),c):a(h)}function c(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):a(h)}function m(h){return we(h)?r(h):Ue(h)?t.check({tokenize:P_},r,a)(h):a(h)}}function P_(t,r,a){return Ie(t,u,"whitespace");function u(o){return o===null?a(o):r(o)}}function J_(t){return Bv([w_(),O_(),q_(t),G_(),Z_()])}const $_={};function W_(t){const r=this,a=t||$_,u=r.data(),o=u.micromarkExtensions||(u.micromarkExtensions=[]),f=u.fromMarkdownExtensions||(u.fromMarkdownExtensions=[]),c=u.toMarkdownExtensions||(u.toMarkdownExtensions=[]);o.push(J_(a)),f.push(b_()),c.push(x_(a))}const ez="modulepreload",tz=function(t){return"/"+t},Hb={},Km=function(r,a,u){let o=Promise.resolve();if(a&&a.length>0){let c=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=c(a.map(g=>{if(g=tz(g),g in Hb)return;Hb[g]=!0;const y=g.endsWith(".css"),p=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${p}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":ez,y||(v.as="script"),v.crossOrigin="",v.href=g,h&&v.setAttribute("nonce",h),document.head.appendChild(v),y)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${g}`)))})}))}function f(c){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=c,window.dispatchEvent(m),!m.defaultPrevented)throw c}return o.then(c=>{for(const m of c||[])m.status==="rejected"&&f(m.reason);return r().catch(f)})};let Dd=null;const Rd=new Map;function j1(){return Dd||(Dd=Km(async()=>{const{createHighlighter:t}=await import("./index-DoLWZ4qo.js");return{createHighlighter:t}},[]).then(({createHighlighter:t})=>t({themes:["github-dark"],langs:["plaintext"]}))),Dd}function nz(t){const r=Rd.get(t);if(r)return r;const a=Km(()=>import("./index-DoLWZ4qo.js"),[]).then(async({bundledLanguages:u,isSpecialLang:o})=>{if(o(t))return;const f=u[t];if(!f)throw new Error(`unknown lang: ${t}`);const c=await j1();c.getLoadedLanguages().includes(t)||await c.loadLanguage(f)}).catch(u=>{throw Rd.delete(t),u});return Rd.set(t,a),a}function lz({code:t,language:r}){const[a,u]=w.useState(null),[o,f]=w.useState(0),[c,m]=w.useState(!1),h=w.useRef(null);w.useEffect(()=>{let y=!1;async function p(){const v=await j1();if(y)return;let S="plaintext";if(r){const{isSpecialLang:E}=await Km(async()=>{const{isSpecialLang:j}=await import("./index-DoLWZ4qo.js");return{isSpecialLang:j}},[]),T=v.getLoadedLanguages();E(r)||T.includes(r)?S=r:(nz(r).then(()=>{y||f(j=>j+1)}).catch(()=>{}),S="plaintext")}try{const E=v.codeToHtml(t,{lang:S,theme:"github-dark"});y||u(E)}catch{}}return u(null),p().catch(()=>{}),()=>{y=!0}},[t,r,o]),w.useEffect(()=>()=>{h.current!==null&&clearTimeout(h.current)},[]);const g=w.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{m(!0),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>m(!1),2e3)}).catch(()=>{})},[t]);return b.jsxs("div",{className:"relative group rounded-md bg-secondary overflow-hidden mb-2",children:[r&&b.jsx("div",{className:"text-[10px] text-muted-foreground px-3 pt-1.5 select-none",children:r}),b.jsx("button",{onClick:g,"aria-label":"Copy code",className:"absolute top-1.5 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded p-1 text-muted-foreground hover:text-foreground hover:bg-white/10",children:c?b.jsx(gm,{size:13,strokeWidth:2.5}):b.jsx(Kb,{size:13,strokeWidth:2})}),a!==null?b.jsx("div",{className:"overflow-x-auto text-xs leading-5 [&>pre]:p-3 [&>pre]:m-0 [&>pre]:bg-transparent! [&>pre]:font-mono",dangerouslySetInnerHTML:{__html:a}}):b.jsx("pre",{className:"overflow-x-auto p-3 font-mono text-xs leading-5 text-foreground",children:b.jsx("code",{children:t})})]})}const rz={h1:({children:t})=>b.jsx("h1",{className:"mb-3 text-xl font-bold",children:t}),h2:({children:t})=>b.jsx("h2",{className:"mb-2 text-lg font-semibold",children:t}),h3:({children:t})=>b.jsx("h3",{className:"mb-1.5 text-base font-semibold",children:t}),p:({children:t})=>b.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),ul:({children:t})=>b.jsx("ul",{className:"mb-2 ml-4 list-disc space-y-0.5",children:t}),ol:({children:t})=>b.jsx("ol",{className:"mb-2 ml-4 list-decimal space-y-0.5",children:t}),li:({children:t})=>b.jsx("li",{className:"text-sm",children:t}),blockquote:({children:t})=>b.jsx("blockquote",{className:"mb-2 border-l-2 border-brand/50 pl-3 italic text-muted-foreground",children:t}),a:({href:t,children:r})=>t&&/^(https?:\/\/|\/(?!\/)|#)/i.test(t)?b.jsx("a",{href:t,className:"text-brand underline underline-offset-2 hover:text-brand/80",target:"_blank",rel:"noopener noreferrer",children:r}):b.jsx("span",{className:"text-muted-foreground",children:r}),strong:({children:t})=>b.jsx("strong",{className:"font-semibold text-foreground",children:t}),em:({children:t})=>b.jsx("em",{className:"italic text-muted-foreground",children:t}),hr:()=>b.jsx("hr",{className:"my-3 border-border"}),table:({children:t})=>b.jsx("div",{className:"mb-2 overflow-x-auto rounded border border-border",children:b.jsx("table",{className:"w-full text-sm",children:t})}),thead:({children:t})=>b.jsx("thead",{className:"bg-secondary text-secondary-foreground",children:t}),th:({children:t})=>b.jsx("th",{className:"px-3 py-1.5 text-left font-medium",children:t}),td:({children:t})=>b.jsx("td",{className:"border-t border-border px-3 py-1.5",children:t}),code:({children:t,className:r})=>{var u;return((u=/language-(\w+)/.exec(r??""))==null?void 0:u[1])?b.jsx("code",{className:oe("text-xs",r),children:t}):b.jsx("code",{className:"rounded bg-secondary px-1 py-0.5 font-mono text-[11px] text-foreground",children:t})},pre:({children:t})=>{var o,f,c;const r=t,a=(f=/language-(\w+)/.exec(((o=r==null?void 0:r.props)==null?void 0:o.className)??""))==null?void 0:f[1],u=String(((c=r==null?void 0:r.props)==null?void 0:c.children)??"").replace(/\n$/,"");return b.jsx(lz,{code:u,language:a})}};function _1({text:t,className:r}){return b.jsx("div",{className:oe("text-sm text-foreground",r),children:b.jsx(qj,{remarkPlugins:[W_],components:rz,children:t})})}function az(){return b.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})}const iz=/^[ \t]*(`{3,}|~{4,})/;function uz(t,r){if(r>=t.length)return r;const a=t.lastIndexOf(`
375
375
  `,r-1)+1,u=t.slice(a,r);if(iz.test(u)){const o=t.indexOf(`
376
376
  `,r);return o===-1?t.length:o+1}return r}function oz({text:t,isStreaming:r,speed:a=80,onComplete:u}){const o=w.useRef(0),[f,c]=w.useState(0),m=w.useRef(null),h=w.useRef(null),g=w.useRef(!1),y=w.useRef(u);w.useEffect(()=>{y.current=u},[u]);const p=w.useRef(a);w.useEffect(()=>{p.current=a});const v=!r&&o.current===0&&t.length>0,S=w.useCallback(()=>{if(m.current!==null)return;function A(D){var H;const L=h.current??D,P=D-L;h.current=D;const W=p.current/1e3,M=Math.max(1,Math.floor(W*P)),F=o.current,q=t.length;if(F<q){const ne=Math.min(F+M,q),J=uz(t,ne);o.current=J,c(J)}if(o.current>=t.length&&!r){m.current=null,h.current=null,g.current||(g.current=!0,(H=y.current)==null||H.call(y));return}m.current=requestAnimationFrame(A)}m.current=requestAnimationFrame(A)},[t,r]);w.useEffect(()=>{var A;if(v){o.current=t.length,c(t.length),g.current||(g.current=!0,(A=y.current)==null||A.call(y));return}return(o.current<t.length||r)&&S(),()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}},[t,r,v]);const E=v?t.length:f,T=t.slice(0,E),j=E<t.length||r;return b.jsxs("span",{className:"streaming-text-root",children:[b.jsx(_1,{text:T}),j&&b.jsx(az,{})]})}function z1({kind:t,text:r,className:a}){const[u,o]=w.useState(!1),f=w.useRef(null);w.useEffect(()=>()=>{f.current!==null&&clearTimeout(f.current)},[]);function c(){navigator.clipboard.writeText(r).then(()=>{o(!0),f.current!==null&&clearTimeout(f.current),f.current=setTimeout(()=>o(!1),2e3)}).catch(()=>{})}return b.jsx("div",{className:oe("absolute top-1 right-1","opacity-0 group-hover:opacity-100 transition-opacity duration-150",a),children:b.jsx("div",{className:"flex items-center gap-0.5 rounded-md border border-border bg-card px-1 py-0.5 shadow-sm",children:t==="assistant"&&b.jsx(sz,{onClick:c,title:u?"Copied!":"Copy",children:u?b.jsx(gm,{className:"h-3.5 w-3.5 text-status-running"}):b.jsx(Kb,{className:"h-3.5 w-3.5"})})})})}function sz({onClick:t,title:r,children:a}){return b.jsx("button",{type:"button",onClick:t,title:r,className:"h-6 w-6 rounded flex items-center justify-center hover:bg-secondary text-muted-foreground hover:text-foreground transition-colors",children:a})}function O1({text:t}){return b.jsxs("div",{className:"group relative flex flex-col items-end gap-1",children:[b.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-muted-foreground/50",children:"You"}),b.jsx("p",{className:"max-w-2xl text-sm leading-relaxed text-foreground whitespace-pre-wrap text-right",children:t}),b.jsx(z1,{kind:"user",text:t})]})}function M1({text:t,isStreaming:r=!1}){return b.jsxs("div",{className:"group relative flex flex-col gap-1",children:[b.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-brand/60",children:"Agent"}),b.jsx("div",{className:"max-w-3xl",children:r?b.jsx(oz,{text:t,isStreaming:!0}):b.jsx(_1,{text:t})}),b.jsx(z1,{kind:"assistant",text:t})]})}function D1({message:t}){return b.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-3",children:[b.jsx(Zb,{className:"mt-0.5 h-4 w-4 shrink-0 text-status-failed"}),b.jsx("p",{className:"text-sm leading-relaxed text-status-failed",children:t})]})}function R1({text:t}){return b.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[b.jsx(Pb,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),b.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}function L1({item:t}){return b.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-1.5",children:[b.jsx("span",{className:"text-[10px] text-muted-foreground",children:"BG"}),b.jsx("span",{className:"text-xs text-foreground",children:t.label}),b.jsx("span",{className:oe("ml-auto font-mono text-[10px] capitalize",t.status==="completed"?"text-status-running":"",t.status==="failed"?"text-status-failed":"",t.status==="running"?"text-status-blocked":""),children:t.status})]})}function cz(t){const r=[];let a=0;for(;a<t.length;){const u=t[a];if(u===void 0){a++;continue}if(u.kind!=="subagent"){r.push({kind:"item",item:u}),a++;continue}const o=[];for(;a<t.length;){const f=t[a];if(f===void 0||f.kind!=="subagent")break;o.push(f),a++}r.push({kind:"subagent-group",items:o,id:o[0].id})}return r}function fz(t,r=!1){switch(t.kind){case"user":return b.jsx(O1,{text:t.text});case"assistant":return b.jsx(M1,{text:t.text,isStreaming:r});case"thinking":return b.jsx(dv,{text:t.text});case"tool":return b.jsx(ZT,{...t});case"error":return b.jsx(D1,{message:t.message});case"notice":return b.jsx(R1,{text:t.text});case"bg_job":return b.jsx(L1,{item:t});case"subagent":return null}}function dz(t,r=!1){switch(t.kind){case"user":return b.jsx(O1,{text:t.text});case"assistant":return b.jsx(M1,{text:t.text,isStreaming:r});case"thinking":return b.jsx(dv,{text:t.text});case"error":return b.jsx(D1,{message:t.message});case"notice":return b.jsx(R1,{text:t.text});case"bg_job":return b.jsx(L1,{item:t});default:return null}}function mz({sessionId:t,...r}){return b.jsx(pv.Provider,{value:t??null,children:b.jsx(hz,{...r})})}function hz({items:t,totals:r,spineMode:a=!0,turnActive:u=!1}){const o=w.useMemo(()=>cz(t),[t]),f=NN(t),c=w.useMemo(()=>{var h;for(let g=t.length-1;g>=0;g--)if(((h=t[g])==null?void 0:h.kind)==="assistant")return t[g].id;return null},[t]),m=w.useCallback((h,g)=>{const y=h.kind==="user"&&g>0,p=u&&h.id===c;return b.jsxs("div",{children:[y&&b.jsx("div",{className:"my-6 border-t border-border/40","aria-hidden":"true"}),b.jsx("div",{className:"py-2 px-1",children:dz(h,p)})]},h.id)},[u,c]);return b.jsxs("div",{className:"flex flex-col gap-0 max-w-4xl mx-auto w-full",children:[r&&b.jsx(bv,{totals:r,className:"sticky top-0 z-10 mb-4 rounded-md border border-border bg-card px-3 py-1.5"}),t.length===0?b.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:"No transcript items yet."}):a?b.jsx(TN,{slots:f,renderTextItem:m}):o.map((h,g)=>{if(h.kind==="item"){const{item:p}=h,v=p.kind==="user"&&g>0,S=u&&p.id===c;return b.jsxs("div",{children:[v&&b.jsx("div",{className:"my-6 border-t border-border/40","aria-hidden":"true"}),b.jsx("div",{className:"py-2 px-1",children:fz(p,S)})]},p.id)}const y=lN(h.items);return b.jsx("div",{className:"py-2 px-1",children:b.jsx(eN,{roots:y})},h.id)})]})}const pz={preference:"Preference",convention:"Convention",decision:"Decision",learning:"Learning"};function gz({type:t}){return b.jsx("span",{className:oe("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",t==="fact"?"bg-blue-500/15 text-blue-400":"bg-violet-500/15 text-violet-400"),children:t})}function yz({category:t}){return t?b.jsx("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-zinc-700 text-zinc-300",children:pz[t]??t}):null}function bz({result:t}){const r=t.content.length>200?t.content.slice(0,200)+"…":t.content,a=t.created_at?new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null;return b.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900 p-3 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[b.jsx(gz,{type:t.type}),b.jsx(yz,{category:t.category}),a&&b.jsx("span",{className:"text-xs text-zinc-500 ml-auto",children:a})]}),b.jsx("p",{className:"text-sm text-zinc-300 leading-relaxed whitespace-pre-wrap break-words",children:r})]})}function xz({pct:t,truncated:r}){const a=Math.min(t,100),u=t>=100?"bg-red-500":t>=80?"bg-amber-400":"bg-accent";return b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("div",{className:"flex-1 h-2 rounded-full bg-zinc-800 overflow-hidden",children:b.jsx("div",{className:oe("h-full rounded-full transition-all",u),style:{width:`${a}%`}})}),r&&b.jsx("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-amber-400/15 text-amber-400",children:"Truncated"})]})}function vz({hot:t}){if(!t)return null;const{content:r,usage:a}=t;return b.jsxs("section",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"HOT Memory"}),b.jsxs("span",{className:"text-xs text-zinc-500",children:[a.tokens.toLocaleString()," / ",a.maxTokens.toLocaleString()," tokens"]})]}),b.jsx(xz,{pct:a.pct,truncated:a.truncated}),r?b.jsx("pre",{className:"rounded-md border border-zinc-800 bg-zinc-950 p-3 text-xs text-zinc-300 font-mono overflow-x-auto whitespace-pre-wrap max-h-48",children:r}):b.jsx("p",{className:"text-xs text-zinc-500 italic",children:"No hot memory loaded."})]})}const Sz=[{value:"",label:"All Categories"},{value:"preference",label:"Preference"},{value:"convention",label:"Convention"},{value:"decision",label:"Decision"},{value:"learning",label:"Learning"}];function wz(){const[t,r]=w.useState(null),[a,u]=w.useState(""),[o,f]=w.useState(""),[c,m]=w.useState(null),[h,g]=w.useState(!1),[y,p]=w.useState(null);w.useEffect(()=>{it("/api/memory/hot").then(r).catch(()=>{})},[]);const v=w.useCallback(async S=>{S.preventDefault(),g(!0),p(null);try{const E=new URLSearchParams({q:a,limit:"20"});o&&E.set("category",o);const T=await it(`/api/memory/search?${E.toString()}`);m(T.results)}catch(E){p(E instanceof Error?E.message:"Search failed")}finally{g(!1)}},[a,o]);return b.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[b.jsx(vz,{hot:t}),b.jsxs("section",{className:"space-y-3",children:[b.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Search Memory"}),b.jsxs("form",{onSubmit:v,className:"flex gap-2 flex-wrap",children:[b.jsx("input",{type:"text",value:a,onChange:S=>u(S.target.value),placeholder:"FTS5 query…",className:"flex-1 min-w-0 rounded-md border border-zinc-700 bg-zinc-900 px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-accent"}),b.jsx("select",{value:o,onChange:S=>f(S.target.value),className:"rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-100 focus:outline-none focus:ring-1 focus:ring-accent",children:Sz.map(S=>b.jsx("option",{value:S.value,children:S.label},S.value))}),b.jsx("button",{type:"submit",disabled:h,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50 hover:opacity-90 transition-opacity",children:h?"Searching…":"Search"})]}),y&&b.jsx("p",{className:"text-xs text-red-400",children:y}),c!==null&&b.jsx("div",{className:"space-y-2",children:c.length===0?b.jsx("p",{className:"text-sm text-zinc-500 italic text-center py-6",children:"No results found."}):c.map(S=>b.jsx(bz,{result:S},`${S.type}-${S.created_at}-${S.content.slice(0,32)}`))})]})]})}const kz={success:{label:"Success",className:"bg-status-done/20 text-status-done border-status-done/30"},error:{label:"Error",className:"bg-status-failed/20 text-status-failed border-status-failed/30"},skipped:{label:"Skipped",className:"bg-muted text-muted-foreground border-border"}};function Ez(t){if(t<1e3)return`${t}ms`;const r=Math.floor(t/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`}function Cz(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Tz({schedule:t,onClose:r}){const[a,u]=w.useState([]),[o,f]=w.useState(!0),[c,m]=w.useState(null);return w.useEffect(()=>{let h=!1;return f(!0),m(null),it(`/api/schedules/${t.id}/history`).then(g=>{h||u(g.history)}).catch(g=>{h||m(g instanceof Error?g.message:"Failed to load history")}).finally(()=>{h||f(!1)}),()=>{h=!0}},[t.id]),w.useEffect(()=>{const h=g=>{g.key==="Escape"&&r()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r]),b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&r()},children:b.jsxs("div",{className:"flex max-h-[80vh] w-full max-w-lg flex-col rounded-xl border border-border bg-card shadow-xl",children:[b.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:[b.jsxs("div",{children:[b.jsx("h2",{className:"text-sm font-semibold",children:t.name}),b.jsx("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t.cron})]}),b.jsx("button",{onClick:r,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":"Close",children:"✕"})]}),b.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-3",children:[o&&b.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading history…"}),c&&b.jsx("p",{className:"py-8 text-center text-sm text-status-failed",children:c}),!o&&!c&&a.length===0&&b.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No runs recorded yet."}),!o&&!c&&a.length>0&&b.jsx("ul",{className:"space-y-2",children:a.map((h,g)=>{const y=kz[h.status];return b.jsxs("li",{className:"flex items-start gap-3 rounded-lg border border-border bg-background/50 px-4 py-3",children:[b.jsx("span",{className:oe("mt-0.5 shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium",y.className),children:y.label}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:Cz(h.triggeredAt)}),b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:Ez(h.durationMs)})]}),h.errorMessage&&b.jsx("p",{className:"mt-1 truncate font-mono text-xs text-status-failed",children:h.errorMessage})]})]},`${h.taskId}-${h.triggeredAt}-${g}`)})})]})]})})}function Nz({status:t}){return t?b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:oe("size-2 rounded-full",t.running?"animate-pulse bg-status-done":"bg-status-failed")}),b.jsx("span",{className:"text-sm text-muted-foreground",children:t.running?`Running${t.tasks!=null?` (${t.tasks} task${t.tasks!==1?"s":""})`:""}`:"Stopped"})]}):null}function U1({checked:t,onChange:r,disabled:a}){return b.jsx("button",{role:"switch","aria-checked":t,onClick:u=>{u.stopPropagation(),r()},disabled:a,className:oe("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent","transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",t?"bg-brand":"bg-muted"),children:b.jsx("span",{className:oe("block size-4 rounded-full bg-white shadow transition-transform",t?"translate-x-4":"translate-x-0")})})}function Az({schedule:t,onToggle:r,onDelete:a,onShowHistory:u}){const[o,f]=w.useState(!1),[c,m]=w.useState(!1),h=async()=>{f(!0),await r(t.id).finally(()=>f(!1))},g=async p=>{p.stopPropagation(),window.confirm(`Delete schedule "${t.name}"? This cannot be undone.`)&&(m(!0),await a(t.id).finally(()=>m(!1)))},y=t.trigger==="both"?"cron + session start":t.trigger??"cron";return b.jsxs("div",{className:oe("group flex cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4","transition-colors hover:border-brand/40 hover:bg-accent/30",!t.enabled&&"opacity-60"),onClick:()=>u(t),children:[b.jsxs("div",{className:"flex items-start justify-between gap-3",children:[b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("p",{className:"truncate text-sm font-semibold",children:t.name}),b.jsx("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t.cron})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b.jsx(U1,{checked:t.enabled,onChange:()=>{h()},disabled:o}),b.jsx("button",{onClick:g,disabled:c,"aria-label":`Delete schedule ${t.name}`,className:oe("flex size-7 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-destructive/20 hover:text-status-failed","disabled:cursor-not-allowed disabled:opacity-40"),children:"🗑"})]})]}),b.jsx("code",{className:"block truncate rounded-md bg-secondary px-3 py-2 font-mono text-xs text-secondary-foreground",children:t.command}),b.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[b.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 capitalize",children:y}),t.notifyOn&&t.notifyOn!=="never"&&b.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5",children:["notify: ",t.notifyOn]}),b.jsx("span",{className:"ml-auto",children:"Click for history"})]})]})}const jz={name:"",command:"",cron:"",trigger:"cron",notifyOn:"failure",enabled:!0};function _z({onCreated:t,onCancel:r}){const[a,u]=w.useState(jz),[o,f]=w.useState(!1),[c,m]=w.useState(null),h=async p=>{if(p.preventDefault(),m(null),!a.name.trim()){m("Name is required.");return}if(!a.command.trim()){m("Command is required.");return}if(!a.cron.trim()){m("Cron expression is required.");return}f(!0);try{const v=await it("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});t(v.schedule,v.syncNote)}catch(v){m(v instanceof Error?v.message:"Failed to create schedule.")}finally{f(!1)}},g=(p,v)=>b.jsxs("div",{className:"flex flex-col gap-1",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:p}),v]}),y=oe("h-8 rounded-md border border-border bg-card px-3 text-sm","placeholder:text-muted-foreground/50","focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50");return b.jsxs("form",{onSubmit:p=>{h(p)},className:"flex flex-col gap-4 rounded-xl border border-brand/40 bg-card p-4",children:[b.jsx("p",{className:"text-sm font-semibold",children:"New Schedule"}),b.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[g("Name *",b.jsx("input",{type:"text",className:y,placeholder:"e.g. Nightly cleanup",value:a.name,onChange:p=>u(v=>({...v,name:p.target.value})),required:!0,disabled:o})),g("Cron expression *",b.jsx("input",{type:"text",className:oe(y,"font-mono"),placeholder:"0 2 * * *",value:a.cron,onChange:p=>u(v=>({...v,cron:p.target.value})),required:!0,disabled:o}))]}),g("Command *",b.jsx("input",{type:"text",className:oe(y,"font-mono"),placeholder:"/my-skill --auto",value:a.command,onChange:p=>u(v=>({...v,command:p.target.value})),required:!0,disabled:o})),b.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[g("Trigger",b.jsxs("select",{className:y,value:a.trigger,onChange:p=>u(v=>({...v,trigger:p.target.value})),disabled:o,children:[b.jsx("option",{value:"cron",children:"cron"}),b.jsx("option",{value:"sessionstart",children:"session start"}),b.jsx("option",{value:"both",children:"both"})]})),g("Notify on",b.jsxs("select",{className:y,value:a.notifyOn,onChange:p=>u(v=>({...v,notifyOn:p.target.value})),disabled:o,children:[b.jsx("option",{value:"failure",children:"failure"}),b.jsx("option",{value:"always",children:"always"}),b.jsx("option",{value:"never",children:"never"})]})),b.jsxs("div",{className:"flex flex-col gap-1",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Enabled"}),b.jsx("div",{className:"flex h-8 items-center",children:b.jsx(U1,{checked:a.enabled,onChange:()=>u(p=>({...p,enabled:!p.enabled})),disabled:o})})]})]}),c&&b.jsx("p",{className:"rounded-md border border-status-failed/30 bg-status-failed/10 px-3 py-2 text-xs text-status-failed",children:c}),b.jsxs("div",{className:"flex items-center justify-end gap-2",children:[b.jsx("button",{type:"button",onClick:r,disabled:o,className:oe("h-8 rounded-md px-3 text-sm text-muted-foreground","hover:bg-accent hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50"),children:"Cancel"}),b.jsx("button",{type:"submit",disabled:o,className:oe("h-8 rounded-md bg-brand px-4 text-sm font-medium text-white","hover:bg-brand/90","disabled:cursor-not-allowed disabled:opacity-50"),children:o?"Creating…":"Create"})]})]})}function zz(){const[t,r]=w.useState([]),[a,u]=w.useState(null),[o,f]=w.useState(!0),[c,m]=w.useState(null),[h,g]=w.useState(null),[y,p]=w.useState(!1),[v,S]=w.useState(null);w.useEffect(()=>{let A=!1;return f(!0),m(null),Promise.all([it("/api/schedules"),it("/api/daemon/status")]).then(([D,L])=>{A||(r(D.schedules),u(L))}).catch(D=>{A||m(D instanceof Error?D.message:"Failed to load schedules")}).finally(()=>{A||f(!1)}),()=>{A=!0}},[]);const E=w.useCallback(async A=>{const D=await it(`/api/schedules/${A}/toggle`,{method:"POST"});r(L=>L.map(P=>P.id===A?{...P,enabled:D.enabled}:P)),D.syncNote&&(S(D.syncNote),setTimeout(()=>S(null),8e3))},[]),T=w.useCallback(async A=>{await it(`/api/schedules/${A}`,{method:"DELETE"}),r(D=>D.filter(L=>L.id!==A))},[]),j=w.useCallback((A,D)=>{r(L=>[...L,A]),p(!1),D&&(S(D),setTimeout(()=>S(null),8e3))},[]);return o?b.jsx("div",{className:"flex flex-1 items-center justify-center",children:b.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading schedules…"})}):b.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("h1",{className:"text-base font-semibold",children:"Schedules"}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(Nz,{status:a}),b.jsx("button",{onClick:()=>p(A=>!A),className:oe("h-7 rounded-md px-3 text-xs font-medium",y?"bg-muted text-muted-foreground hover:bg-muted/80":"bg-brand text-white hover:bg-brand/90"),children:y?"Cancel":"+ New Schedule"})]})]}),y&&b.jsx(_z,{onCreated:j,onCancel:()=>p(!1)}),v&&b.jsx("p",{className:"rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-3 text-sm text-yellow-700 dark:text-yellow-400",children:v}),c&&b.jsx("p",{className:"rounded-lg border border-status-failed/30 bg-status-failed/10 px-4 py-3 text-sm text-status-failed",children:c}),!c&&t.length===0&&!y&&b.jsx("p",{className:"mt-8 text-center text-sm text-muted-foreground",children:"No schedules configured."}),b.jsx("div",{className:"grid gap-3",children:t.map(A=>b.jsx(Az,{schedule:A,onToggle:E,onDelete:T,onShowHistory:g},A.id))}),h&&b.jsx(Tz,{schedule:h,onClose:()=>g(null)})]})}function Oz(t,r){const a=(r??Date.now())-t;if(a<1e3)return`${a}ms`;const u=Math.floor(a/1e3);if(u<60)return`${u}s`;const o=Math.floor(u/60);return o<60?`${o}m ${u%60}s`:`${Math.floor(o/60)}h ${o%60}m`}function Mz(t){const r=Math.floor((Date.now()-t)/1e3);if(r<60)return`${r}s ago`;const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const u=Math.floor(a/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}function Dz(t){const r=t.lastIndexOf("/");return r!==-1?t.slice(r+1):t}const Rz={running:"bg-green-500/20 text-green-400 border border-green-500/30",completed:"bg-blue-500/20 text-blue-400 border border-blue-500/30",failed:"bg-red-500/20 text-red-400 border border-red-500/30",cancelled:"bg-neutral-500/20 text-neutral-400 border border-neutral-500/30"};function rs(t){return t.status!=="running"}function Lz({status:t}){return b.jsxs("span",{className:oe("inline-flex items-center gap-1.5 rounded px-1.5 py-0.5 text-xs font-medium",Rz[t]),children:[t==="running"&&b.jsx("span",{className:"size-1.5 rounded-full bg-green-400 animate-pulse"}),t]})}function qb({job:t,now:r,onCancel:a}){const[u,o]=w.useState(!1),[f,c]=w.useState(!1),[m,h]=w.useState(null),g=Oz(t.startedAt,t.status==="running"?r:t.endedAt),y=Mz(t.startedAt),p=u?ym:gs,v=async S=>{S.stopPropagation(),h(null),c(!0);try{await a(t.jobId)}catch(E){h(E instanceof Error?E.message:String(E))}finally{c(!1)}};return b.jsxs("div",{className:"rounded-lg border border-neutral-800 bg-neutral-900 overflow-hidden",children:[b.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),o(E=>!E))},className:"w-full text-left px-4 py-3 flex flex-col gap-2 hover:bg-neutral-800/50 transition-colors cursor-pointer",children:[b.jsxs("div",{className:"flex items-start justify-between gap-2",children:[b.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[b.jsx(p,{className:"size-3.5 shrink-0 text-neutral-500"}),b.jsx("span",{className:"text-sm font-medium text-neutral-100 truncate",children:t.label||t.jobId})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsx(Lz,{status:t.status}),t.status==="running"&&b.jsxs("button",{type:"button",onClick:v,disabled:f,"aria-label":`Cancel job ${t.jobId}`,className:oe("flex items-center gap-1 rounded px-1.5 py-0.5 text-xs","text-neutral-500 hover:text-red-400 hover:bg-red-500/10","disabled:opacity-40 transition-colors"),children:[b.jsx(bm,{className:"size-3"}),f?"Cancelling…":"Cancel"]})]})]}),b.jsxs("div",{className:"flex items-center gap-3 text-xs text-neutral-500 pl-5",children:[b.jsx("span",{className:"font-mono bg-neutral-800 rounded px-1.5 py-0.5 text-neutral-300",children:Dz(t.model)}),b.jsx("span",{children:g}),b.jsx("span",{children:y})]}),(t.status==="failed"||t.status==="cancelled")&&t.stopReason&&b.jsxs("div",{className:"pl-5 text-xs text-neutral-500",children:[b.jsx("span",{className:"text-neutral-600",children:"reason:"})," ",b.jsx("span",{className:"font-mono text-neutral-400 line-clamp-2",title:t.stopReason,children:t.stopReason})]}),m&&b.jsx("p",{className:"pl-5 text-xs text-red-400",title:m,children:m.length>200?m.slice(0,200)+"…":m})]}),u&&b.jsxs("div",{className:"border-t border-neutral-800 px-4 py-3 bg-neutral-950 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs",children:[b.jsx(Rn,{label:"Job ID",value:t.jobId,mono:!0}),b.jsx(Rn,{label:"Subagent ID",value:t.subagentId,mono:!0}),b.jsx(Rn,{label:"Model",value:t.model,mono:!0}),b.jsx(Rn,{label:"Status",value:t.status}),b.jsx(Rn,{label:"Started",value:new Date(t.startedAt).toLocaleString()}),t.endedAt!==void 0&&b.jsx(Rn,{label:"Ended",value:new Date(t.endedAt).toLocaleString()}),b.jsx(Rn,{label:"Duration",value:g}),t.parentSessionId&&b.jsx(Rn,{label:"Parent session",value:t.parentSessionId,mono:!0}),t.stopReason&&b.jsx(Rn,{label:"Stop reason",value:t.stopReason.length>200?t.stopReason.slice(0,200)+"…":t.stopReason,mono:!0}),b.jsx(Rn,{label:"Prompt hash",value:t.promptHash,mono:!0}),b.jsx(Rn,{label:"Schema version",value:String(t.schemaVersion)})]})]})}function Rn({label:t,value:r,mono:a=!1}){return b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-neutral-600 whitespace-nowrap",children:t}),b.jsx("span",{className:oe("text-neutral-300 break-all",a&&"font-mono"),children:r})]})}function Ib({label:t,count:r}){return b.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-neutral-500 uppercase tracking-wider",children:[b.jsx("span",{children:t}),b.jsx("span",{className:"rounded-full bg-neutral-800 px-1.5 py-0.5 text-neutral-400 normal-case",children:r})]})}function Uz(){const[t,r]=w.useState([]),[a,u]=w.useState(!0),[o,f]=w.useState(null),[c,m]=w.useState(()=>Date.now()),h=w.useRef(null),g=w.useCallback((E=!1)=>{E||u(!0),f(null),it("/api/bg-jobs").then(({jobs:T})=>r([...T].sort((j,A)=>A.startedAt-j.startedAt))).catch(T=>f(T instanceof Error?T.message:String(T))).finally(()=>{E||u(!1)})},[]);w.useEffect(()=>{g()},[g]),w.useEffect(()=>{const E=t.some(T=>!rs(T));return E&&!h.current&&(h.current=setInterval(()=>g(!0),5e3)),!E&&h.current&&(clearInterval(h.current),h.current=null),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[t,g]),w.useEffect(()=>{if(!t.some(j=>!rs(j)))return;const T=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(T)},[t]);const y=w.useCallback(async E=>{await it(`/api/bg-jobs/${encodeURIComponent(E)}/cancel`,{method:"POST"}),r(T=>T.map(j=>j.jobId===E?{...j,status:"cancelled"}:j))},[]),p=t.filter(E=>E.status==="running"),v=t.filter(E=>rs(E)),S=t.some(E=>!rs(E));return b.jsxs("div",{className:"flex flex-col gap-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-neutral-200",children:[b.jsx(Qb,{className:"size-4 text-neutral-400"}),"Background Jobs",S&&b.jsx("span",{className:"text-xs font-normal text-neutral-500",children:"(auto-refreshing)"})]}),b.jsxs("button",{onClick:()=>g(),disabled:a,className:"flex items-center gap-1.5 rounded px-2 py-1 text-xs text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800 disabled:opacity-50 transition-colors",children:[b.jsx(yk,{className:oe("size-3",a&&"animate-spin")}),"Refresh"]})]}),o&&b.jsx("p",{className:"rounded border border-red-900/40 bg-red-950/30 px-3 py-2 text-xs text-red-400",children:o}),!a&&t.length===0&&!o&&b.jsx("p",{className:"text-sm text-neutral-500 text-center py-8",children:"No background jobs"}),p.length>0&&b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx(Ib,{label:"Running",count:p.length}),p.map(E=>b.jsx(qb,{job:E,now:c,onCancel:y},E.jobId))]}),v.length>0&&b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx(Ib,{label:"Settled",count:v.length}),v.map(E=>b.jsx(qb,{job:E,now:c,onCancel:y},E.jobId))]})]})}function eu({icon:t,title:r,children:a}){return b.jsxs("section",{className:"space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(t,{className:"size-4 text-muted-foreground"}),b.jsx("h2",{className:"text-sm font-semibold",children:r})]}),b.jsx("div",{className:"rounded-xl border border-border bg-card",children:a})]})}function Kt({label:t,value:r,mono:a=!1,last:u=!1}){return b.jsxs("div",{className:oe("flex items-center justify-between gap-4 px-4 py-2.5",!u&&"border-b border-border"),children:[b.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:t}),b.jsx("span",{className:oe("min-w-0 truncate text-right text-xs",a?"font-mono text-zinc-300":"text-zinc-200"),children:r})]})}function Bz({model:t,last:r}){return b.jsxs("div",{className:oe("flex items-center justify-between gap-4 px-4 py-2.5",!r&&"border-b border-border"),children:[b.jsx("span",{className:"text-xs text-zinc-200",children:t.label}),b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id})]})}const Vb=[{keys:"⌘K",description:"Open command palette"},{keys:"⌘1",description:"Go to Sessions"},{keys:"⌘2",description:"Go to Memory"},{keys:"⌘3",description:"Go to Schedules"},{keys:"⌘4",description:"Go to Background Jobs"}];function Hz({keys:t,description:r,last:a}){return b.jsxs("div",{className:oe("flex items-center justify-between gap-4 px-4 py-2.5",!a&&"border-b border-border"),children:[b.jsx("span",{className:"text-xs text-zinc-200",children:r}),b.jsx("kbd",{className:"rounded border border-border bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:t})]})}function qz({status:t}){return t?b.jsxs("span",{className:"flex items-center gap-1.5",children:[b.jsx("span",{className:oe("size-1.5 rounded-full",t.running?"animate-pulse bg-status-done":"bg-status-failed")}),b.jsx("span",{className:oe("text-xs",t.running?"text-zinc-200":"text-muted-foreground"),children:t.running?`Running${t.tasks!=null?` · ${t.tasks} task${t.tasks!==1?"s":""}`:""}`:"Stopped"})]}):b.jsx("span",{className:"text-xs text-muted-foreground",children:"–"})}function Iz(){var o;const[t,r]=w.useState({config:null,models:null,daemon:null,configError:null,modelsError:null,daemonError:null});w.useEffect(()=>{let f=!1;const c=m=>m instanceof Error?m.message:"Failed to load";return Promise.all([it("/api/config").then(m=>({ok:!0,config:m}),m=>({ok:!1,error:c(m)})),it("/api/models").then(m=>({ok:!0,models:m.models}),m=>({ok:!1,error:c(m)})),it("/api/daemon/status").then(m=>({ok:!0,daemon:m}),m=>({ok:!1,error:c(m)}))]).then(([m,h,g])=>{f||r({config:m.ok?m.config:null,configError:m.ok?null:m.error,models:h.ok?h.models:null,modelsError:h.ok?null:h.error,daemon:g.ok?g.daemon:null,daemonError:g.ok?null:g.error})}).catch(()=>{}),()=>{f=!0}},[]);const a=t.config,u=b.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"});return b.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-y-auto p-4",children:[b.jsxs(eu,{icon:Pb,title:"About",children:[b.jsx(Kt,{label:"AFK version",value:a?a.version:u,mono:!0}),b.jsx(Kt,{label:"Node.js",value:a?a.nodeVersion:u,mono:!0}),b.jsx(Kt,{label:"App",value:"AFK Dashboard",last:!0})]}),b.jsxs(eu,{icon:nk,title:"Model",children:[b.jsx(Kt,{label:"Default model",value:a?a.model:u,mono:!0}),t.modelsError?b.jsx("div",{className:"px-4 py-3 text-xs text-status-failed",children:t.modelsError}):t.models===null?b.jsx(Kt,{label:"Available tiers",value:u,last:!0}):t.models.length===0?b.jsx(Kt,{label:"Available tiers",value:"None listed",last:!0}):t.models.map((f,c)=>{var m;return b.jsx(Bz,{model:f,last:c===(((m=t.models)==null?void 0:m.length)??0)-1},f.id)})]}),b.jsxs(eu,{icon:rk,title:"Paths",children:[b.jsx(Kt,{label:"AFK home",value:a?a.afkHome:u,mono:!0}),b.jsx(Kt,{label:"State dir",value:a?a.stateDir:u,mono:!0}),b.jsx(Kt,{label:"Config dir",value:a?a.configDir:u,mono:!0,last:!0})]}),b.jsxs(eu,{icon:Ya,title:"Web Server",children:[b.jsx(Kt,{label:"Host",value:a?a.webHost:u,mono:!0}),b.jsx(Kt,{label:"Port",value:a?String(a.webPort):u,mono:!0}),b.jsx(Kt,{label:"Daemon",value:b.jsx(qz,{status:t.daemon})}),!t.daemonError&&b.jsx(Kt,{label:"Tasks scheduled",value:((o=t.daemon)==null?void 0:o.tasks)!=null?String(t.daemon.tasks):"–",last:!0}),t.daemonError&&b.jsx(Kt,{label:"Daemon error",value:t.daemonError,last:!0})]}),b.jsx(eu,{icon:ak,title:"Keyboard Shortcuts",children:Vb.map((f,c)=>b.jsx(Hz,{keys:f.keys,description:f.description,last:c===Vb.length-1},f.keys))})]})}function dm(t){return t.startsWith("/")?t.slice(1):t}function B1(t){return`/${dm(t)}`}function H1(t,r){return dm(t).startsWith(dm(r))}function Vz({query:t,commands:r,onSelect:a,visible:u}){const[o,f]=w.useState(0),c=w.useRef(null),m=r.filter(h=>H1(h.name,t)).slice(0,8);return w.useEffect(()=>{f(0)},[t]),w.useEffect(()=>{var g;const h=(g=c.current)==null?void 0:g.children[o];h==null||h.scrollIntoView({block:"nearest"})},[o]),!u||m.length===0?null:b.jsx("ul",{ref:c,role:"listbox","aria-label":"Slash commands",className:oe("absolute bottom-full left-0 mb-1 w-full max-h-56 overflow-y-auto","rounded-lg border border-border bg-popover shadow-lg z-50","text-sm"),children:m.map((h,g)=>b.jsxs("li",{role:"option","aria-selected":g===o,className:oe("flex items-baseline gap-2 px-3 py-2 cursor-pointer select-none",g===o?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onMouseEnter:()=>f(g),onMouseDown:y=>{y.preventDefault(),a(h.name)},children:[b.jsx("span",{className:"font-mono font-semibold shrink-0",children:B1(h.name)}),b.jsx("span",{className:"text-muted-foreground truncate",children:h.summary})]},h.name))})}function Yz(t,r,a,u,o,f,c){return!r||a===0?!1:t.key==="ArrowDown"?(o((u+1)%a),!0):t.key==="ArrowUp"?(o((u-1+a)%a),!0):t.key==="Enter"?(f(u),!0):t.key==="Escape"?(c(),!0):!1}function Gz(t){const r=t.trim();return r?r.startsWith("/")||r.startsWith("./")||r.startsWith("~/")||/^[\w.]/.test(r):!1}function Fz({onInsert:t}){const[r,a]=w.useState(!1),[u,o]=w.useState(""),[f,c]=w.useState(!1),m=w.useRef(null),h=w.useRef(null),g=w.useRef(null),y=w.useCallback(()=>{a(!1),c(!1),o("")},[]),p=w.useCallback(()=>{var S;const v=u.trim();if(!Gz(v)){c(!0),(S=m.current)==null||S.focus();return}t(`@${v}`),y()},[u,t,y]);return w.useEffect(()=>{r&&requestAnimationFrame(()=>{var v;return(v=m.current)==null?void 0:v.focus()})},[r]),w.useEffect(()=>{if(!r)return;function v(S){const E=S.target;h.current&&!h.current.contains(E)&&g.current&&!g.current.contains(E)&&y()}return document.addEventListener("click",v,{capture:!0}),()=>document.removeEventListener("click",v,{capture:!0})},[r,y]),b.jsxs("div",{className:"relative",children:[b.jsx("button",{ref:g,type:"button",onClick:()=>r?y():a(!0),"aria-label":"Insert file reference","aria-expanded":r,className:oe("flex h-8 w-8 items-center justify-center rounded-md text-sm","transition-colors hover:bg-accent hover:text-accent-foreground",r&&"bg-accent text-accent-foreground"),title:"Insert @file reference",children:b.jsx(lk,{className:"h-4 w-4"})}),r&&b.jsxs("div",{ref:h,role:"dialog","aria-label":"Insert file path",className:oe("absolute bottom-full left-0 mb-2 w-72 rounded-lg border","bg-popover p-3 shadow-lg animate-fade-in"),children:[b.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:["Type a file path. ",b.jsx("code",{className:"text-[10px]",children:"@~/file.ts"})," or"," ",b.jsx("code",{className:"text-[10px]",children:"@src/file.ts"})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx("input",{ref:m,type:"text",value:u,onChange:v=>{o(v.target.value),c(!1)},onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),p()),v.key==="Escape"&&y()},placeholder:"src/foo.ts or ~/file.ts",autoComplete:"off",spellCheck:!1,className:oe("flex-1 rounded-md border bg-secondary px-2 py-1 text-sm","placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",f&&"border-destructive")}),b.jsx("button",{type:"button",onClick:p,className:oe("rounded-md bg-primary px-3 py-1 text-sm font-medium","text-primary-foreground hover:bg-primary/90"),children:"Add"})]}),f&&b.jsx("p",{className:"mt-1 text-xs text-destructive",children:"Enter a valid file path."})]})]})}const Xz=[{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"},{id:"opus",label:"Opus"}],Qz="sonnet";function Zz({onSelect:t,current:r,className:a}){const[u,o]=w.useState(Xz),f=w.useRef(!1);w.useEffect(()=>{let h=!1;return it("/api/models").then(g=>{!h&&g.models.length>0&&o(g.models)}).catch(()=>{}),()=>{h=!0}},[]);const c=r??Qz;w.useEffect(()=>{f.current||(f.current=!0,t(c))},[t,c]);const m=w.useCallback(h=>{t(h.target.value)},[t]);return b.jsxs("div",{className:oe("relative inline-flex items-center",a),children:[b.jsx("select",{value:c,onChange:m,"aria-label":"Model",className:oe("appearance-none rounded-md border bg-secondary pl-2 pr-7 py-1","text-xs font-medium text-secondary-foreground","cursor-pointer focus:outline-none focus:ring-1 focus:ring-ring"),children:u.map(h=>b.jsx("option",{value:h.id,children:h.label},h.id))}),b.jsx(ym,{className:"pointer-events-none absolute right-1.5 h-3 w-3 text-muted-foreground"})]})}function Kz({queue:t}){const{entries:r,moveItemUp:a,moveItemDown:u,removeItem:o,editItem:f}=t;return r.length===0?null:b.jsxs("div",{className:"flex flex-col gap-1 border-b border-border/50 px-3 py-2",children:[b.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:["Queued (",r.length,")"]}),r.map((c,m)=>b.jsx(Pz,{text:c.text,isFirst:m===0,isLast:m===r.length-1,onMoveUp:()=>a(m),onMoveDown:()=>u(m),onRemove:()=>o(m),onEdit:h=>f(m,h)},c.id))]})}function Pz({text:t,isFirst:r,isLast:a,onMoveUp:u,onMoveDown:o,onRemove:f,onEdit:c}){const[m,h]=w.useState(!1),[g,y]=w.useState(t),p=w.useRef(null);w.useEffect(()=>{var T;m&&((T=p.current)==null||T.focus())},[m]);const v=w.useCallback(()=>{y(t),h(!0)},[t]),S=w.useCallback(()=>{const T=g.trim();T&&T!==t&&c(T),h(!1)},[g,t,c]),E=w.useCallback(()=>{h(!1),y(t)},[t]);return b.jsxs("div",{className:oe("group flex items-center gap-1.5 rounded-md border border-border/50","bg-secondary/50 px-2 py-1 text-sm animate-fade-in"),children:[m?b.jsx("input",{ref:p,type:"text",value:g,onChange:T=>y(T.target.value),onKeyDown:T=>{T.key==="Enter"&&S(),T.key==="Escape"&&E()},onBlur:S,className:oe("min-w-0 flex-1 bg-transparent text-sm","focus:outline-none")}):b.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground/80",children:t}),b.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 group-hover:opacity-100",children:[m?b.jsx(tu,{label:"Confirm edit",onClick:S,children:b.jsx(gm,{className:"h-3 w-3"})}):b.jsx(tu,{label:"Edit",onClick:v,children:b.jsx(mk,{className:"h-3 w-3"})}),b.jsx(tu,{label:"Move up",onClick:u,disabled:r,children:b.jsx(Zw,{className:"h-3 w-3"})}),b.jsx(tu,{label:"Move down",onClick:o,disabled:a,children:b.jsx(Xb,{className:"h-3 w-3"})}),b.jsx(tu,{label:"Remove",onClick:f,destructive:!0,children:b.jsx(bm,{className:"h-3 w-3"})})]})]})}function tu({label:t,onClick:r,disabled:a,destructive:u,children:o}){return b.jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":t,title:t,className:oe("flex h-5 w-5 items-center justify-center rounded","transition-colors",a?"cursor-not-allowed opacity-30":u?"hover:bg-destructive/20 hover:text-destructive":"hover:bg-accent hover:text-accent-foreground"),children:o})}let lu=null;function Jz(){lu=null}async function $z(){return lu||(lu=(await it("/api/commands")).commands,lu)}function Wz(t){return t.startsWith("/")&&t.indexOf(" ")===-1?t.slice(1):null}function eO({sessionId:t,sessionMode:r,isBusy:a,queue:u,onModelSelect:o,currentModel:f}){const[c,m]=w.useState(""),[h,g]=w.useState(!1),[y,p]=w.useState([]),[v,S]=w.useState(0),E=w.useRef(null),T=r==="readonly",j=Wz(c),A=j!==null&&y.length>0,D=A?y.filter(q=>H1(q.name,j)).slice(0,8):[];w.useEffect(()=>{const q=()=>{document.visibilityState==="visible"&&Jz()};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[]),w.useEffect(()=>{const q=E.current;if(!q)return;q.style.height="auto";const H=(parseInt(getComputedStyle(q).lineHeight)||20)*5;q.style.height=`${Math.min(q.scrollHeight,H)}px`},[c]),w.useEffect(()=>{j!==null&&$z().then(p).catch(()=>{})},[j]);const L=w.useCallback(async()=>{const q=c.trim();if(!(!q||h||T)){g(!0);try{await it(`/api/sessions/${t}/prompt`,{method:"POST",body:JSON.stringify({text:q})}),m("")}catch{}finally{g(!1)}}},[c,h,T,t]),P=w.useCallback(async()=>{try{await it(`/api/sessions/${t}/interrupt`,{method:"POST"})}catch{}},[t]),W=w.useCallback(q=>{var ie;m(`${B1(q)} `),S(0),(ie=E.current)==null||ie.focus()},[]),M=w.useCallback(q=>{if(Yz(q,A,D.length,v,S,H=>{const ne=D[H];ne&&W(ne.name)},()=>m(H=>H))){q.preventDefault();return}if(q.key==="Enter"&&!q.shiftKey)if(q.preventDefault(),a&&u){const H=c.trim();H&&(u.enqueue(H),m(""))}else L()},[A,D,v,W,L,a,c,u]),F=w.useCallback(q=>{const ie=E.current;if(!ie){m(X=>X+" "+q+" ");return}const H=ie.selectionStart??ie.value.length,ne=ie.selectionEnd??H,J=ie.value.slice(0,H),ve=ie.value.slice(ne),se=J.length>0&&!/\s$/.test(J)?" ":"",te=J+se+q+" "+ve;m(te),requestAnimationFrame(()=>{const X=H+se.length+q.length+1;ie.setSelectionRange(X,X),ie.focus()})},[]);return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"pointer-events-none h-8 bg-gradient-to-t from-background/80 to-transparent"}),b.jsxs("div",{className:oe("relative flex flex-col gap-2","border-t border-border/50 px-4 py-3","backdrop-blur-xl bg-background/80","shadow-[0_-4px_16px_-4px_rgba(0,0,0,0.1)]",T&&"opacity-50"),children:[u&&b.jsx(Kz,{queue:u}),b.jsx(Vz,{query:j??"",commands:y,onSelect:W,visible:A}),b.jsxs("div",{className:"flex items-end gap-2",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[b.jsx(Fz,{onInsert:F}),o&&b.jsx(Zz,{onSelect:o,current:f})]}),b.jsx("textarea",{ref:E,rows:1,value:c,disabled:T||h,onChange:q=>m(q.target.value),onKeyDown:M,placeholder:T?"Read-only session":"Send a message… (/ for commands)",className:oe("flex-1 resize-none rounded-xl border border-input bg-background","px-3 py-2 text-sm leading-5 shadow-sm","placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed")}),a?b.jsx("button",{onClick:()=>void P(),title:"Stop",className:"shrink-0 flex items-center justify-center h-9 w-9 rounded-lg bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:b.jsx($b,{className:"h-4 w-4 fill-current"})}):b.jsx("button",{onClick:()=>void L(),disabled:!c.trim()||h||T,title:"Send",className:oe("shrink-0 flex items-center justify-center h-9 w-9 rounded-lg","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-40 disabled:cursor-not-allowed"),children:b.jsx(bk,{className:"h-4 w-4"})})]})]})]})}async function tO(t){await it("/api/approve",{method:"POST",body:JSON.stringify(t)})}function nO({approval:t,onAnswered:r}){const{id:a,request:u}=t,[o,f]=w.useState(typeof u.questionDefault=="string"?u.questionDefault:""),[c,m]=w.useState(!1),[h,g]=w.useState(null),y=async(v,S)=>{m(!0),g(null);try{await tO({requestId:a,response:{action:v,content:S}}),r()}catch{g("Failed to submit — try again")}finally{m(!1)}},p=u.type??"confirm";return b.jsxs("div",{className:oe("rounded-lg border-2 border-yellow-500/60 bg-yellow-500/5 p-3 text-sm","flex flex-col gap-2"),children:[b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx(vk,{className:"h-4 w-4 text-yellow-500 mt-0.5 shrink-0"}),b.jsxs("div",{className:"flex-1 min-w-0",children:[u.title&&b.jsx("p",{className:"font-semibold text-foreground",children:u.title}),u.message&&b.jsx("p",{className:"text-muted-foreground",children:u.message}),u.description&&b.jsx("p",{className:"text-muted-foreground/80 text-xs mt-0.5",children:u.description})]}),b.jsx("button",{onClick:()=>void y("decline"),disabled:c,className:"shrink-0 text-muted-foreground hover:text-foreground",title:"Dismiss",children:b.jsx(bm,{className:"h-4 w-4"})})]}),p==="text"&&b.jsxs("div",{className:"flex gap-2",children:[b.jsx("input",{type:"text",value:o,onChange:v=>f(v.target.value),disabled:c,className:oe("flex-1 rounded border border-input bg-background px-2 py-1 text-sm","focus:outline-none focus:ring-1 focus:ring-ring")}),b.jsx(as,{onClick:()=>void y("accept",{text:o}),disabled:c,label:"Submit",variant:"primary"})]}),p==="confirm"&&b.jsxs("div",{className:"flex gap-2 justify-end",children:[b.jsx(as,{onClick:()=>void y("decline"),disabled:c,label:"No",variant:"ghost"}),b.jsx(as,{onClick:()=>void y("accept"),disabled:c,label:"Yes",variant:"primary"})]}),(p==="choice"||p==="multi_choice")&&b.jsx("div",{className:"flex flex-wrap gap-1.5",children:(u.choices??[]).map(v=>b.jsx(as,{onClick:()=>void y("accept",{choice:v}),disabled:c,label:v,variant:"outline"},v))}),h&&b.jsx("p",{className:"text-xs text-red-400",children:h})]})}function as({onClick:t,disabled:r,label:a,variant:u}){return b.jsx("button",{onClick:t,disabled:r,className:oe("rounded px-3 py-1 text-xs font-medium transition-colors disabled:opacity-50",u==="primary"&&"bg-primary text-primary-foreground hover:bg-primary/90",u==="ghost"&&"text-muted-foreground hover:text-foreground hover:bg-accent",u==="outline"&&"border border-border hover:bg-accent"),children:a})}function lO({approvals:t,onDismiss:r}){const[a,u]=w.useState(new Set),o=t.filter(c=>!a.has(c.id));if(o.length===0)return null;const f=c=>{u(m=>new Set([...m,c])),r==null||r()};return b.jsx("div",{className:"flex flex-col gap-2",children:o.map(c=>b.jsx(nO,{approval:c,onAnswered:()=>f(c.id)},c.id))})}function rO({open:t,onClose:r,children:a}){return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:oe("fixed inset-0 z-40 bg-black/50 transition-opacity duration-200 md:hidden",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:r,"aria-hidden":"true"}),b.jsx("div",{className:oe("fixed inset-y-0 left-0 z-50 w-64 bg-sidebar transition-transform duration-200 ease-in-out md:hidden",t?"translate-x-0":"-translate-x-full"),role:"dialog","aria-modal":"true",children:a})]})}function aO({onClick:t,className:r}){return b.jsx("button",{onClick:t,className:oe("inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-muted hover:text-foreground md:hidden",r),"aria-label":"Open sidebar",children:b.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:b.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}const iO=w.createContext(null),uO={success:"bg-green-600 text-white",error:"bg-red-600 text-white",info:"bg-muted text-muted-foreground border border-border"};function oO({children:t}){const[r,a]=w.useState([]),u=w.useRef(0),o=w.useCallback((f,c="info")=>{const m=++u.current;a(h=>[...h.slice(-2),{id:m,message:f,type:c}]),setTimeout(()=>{a(h=>h.filter(g=>g.id!==m))},3e3)},[]);return b.jsxs(iO.Provider,{value:{toast:o},children:[t,b.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 pointer-events-none","aria-live":"polite","aria-label":"Notifications",children:r.map(f=>b.jsx("div",{className:oe("pointer-events-auto max-w-sm rounded-lg px-4 py-3 text-sm shadow-lg animate-slide-in-right",uO[f.type]),children:f.message},f.id))})]})}const sO=1e4;function cO(){const[t,r]=w.useState([]),[a,u]=w.useState(!0),[o,f]=w.useState(null),c=w.useRef(void 0),m=w.useCallback(async()=>{try{const h=await it("/api/sessions");r(fO(h.sessions)),f(null)}catch(h){f(h instanceof Error?h.message:"Failed to fetch sessions")}finally{u(!1)}},[]);return w.useEffect(()=>(m(),c.current=setInterval(()=>void m(),sO),()=>clearInterval(c.current)),[m]),{sessions:t,loading:a,error:o,refresh:m}}function fO(t){return[...t].sort((r,a)=>{const u=Yb(r)?1:0,o=Yb(a)?1:0;if(u!==o)return o-u;const f=r.updatedAt?new Date(r.updatedAt).getTime():0;return(a.updatedAt?new Date(a.updatedAt).getTime():0)-f})}function Yb(t){return t.mode==="live"||t.alive===!0}const dO=1e3;function mO(){const[t,r]=w.useState([]),a=w.useRef(void 0),u=w.useCallback(async()=>{try{const f=await it("/api/pending");r(f.pending)}catch{}},[]);w.useEffect(()=>(u(),a.current=setInterval(()=>void u(),dO),()=>clearInterval(a.current)),[u]);const o=new Set(t.map(f=>f.sessionId).filter(f=>!!f));return{approvals:t,pendingSessionIds:o}}const hO=15e3,pO=500;function gO(t){const a=t.replace(/\r\n/g,`
377
377
  `).split(`
378
378
 
379
379
  `),u=a.pop()??"",o=[];for(const f of a){if(f.trim()==="")continue;let c,m;for(const h of f.split(`
380
- `))h.startsWith("id: ")?c=h.slice(4):h.startsWith("id:")?c=h.slice(3).trimStart():h.startsWith("data: ")?m=h.slice(6):h.startsWith("data:")&&(m=h.slice(5).trimStart());m!==void 0&&o.push({id:c,data:m})}return{events:o,remainder:u}}function yO(t){return typeof t=="object"&&t!==null&&t.end===!0}function bO(t){const[r,a]=w.useState([]),[u,o]=w.useState("connecting"),[f,c]=w.useState(null),m=w.useRef(void 0),h=w.useRef(void 0),g=w.useRef(0),y=w.useRef(!1);return w.useEffect(()=>{if(t===null){a([]),o("connecting"),c(null);return}const p=t;a([]),c(null),y.current=!1,h.current=void 0,g.current=0;async function v(){if(y.current)return;o(g.current===0?"connecting":"reconnecting");let S=!1;const E=new AbortController;m.current=E;const T=mv(),j={};T&&(j.authorization=`Bearer ${T}`),h.current!==void 0&&(j["last-event-id"]=h.current);try{const L=await fetch(`/api/sessions/${encodeURIComponent(p)}/stream`,{headers:j,signal:E.signal});if(!L.ok){if(L.status===401||L.status===403||L.status===404){y.current=!0;const F=L.status===401?"unauthorized":L.status===403?"forbidden":"not-found";c(F),o("closed");return}throw new Error(`stream ${L.status}`)}if(L.body===null)throw new Error("stream: no body");g.current=0,o("open");const P=L.body.getReader(),W=new TextDecoder;let M="";e:for(;;){const{done:F,value:q}=await P.read();if(y.current||F)break;M+=W.decode(q,{stream:!0});const{events:ie,remainder:H}=gO(M);M=H;for(const ne of ie){ne.id!==void 0&&(h.current=ne.id);let J;try{J=JSON.parse(ne.data)}catch{continue}if(yO(J)){S=!0,y.current=!0;break e}a(ve=>[...ve,J])}}}catch(L){if(L instanceof DOMException&&L.name==="AbortError")return}if(y.current){S&&o("ended");return}g.current+=1;const A=.75+Math.random()*.5,D=Math.min(pO*2**(g.current-1),hO)*A;setTimeout(()=>void v(),D)}return v(),()=>{var S;y.current=!0,(S=m.current)==null||S.abort(),o("closed")}},[t]),{events:r,status:u,error:f}}const Ld={costUsd:0,durationMs:0,turns:0};function xO(t){const{events:r,status:a,error:u}=bO(t),[o,f]=w.useState([]),[c,m]=w.useState(Ld),[h,g]=w.useState(!1),[y,p]=w.useState(0),v=w.useRef(new Map),S=w.useRef(new Map);w.useEffect(()=>{RT(),v.current=new Map,S.current=new Map,f([]),m(Ld),g(!1),p(0)},[t]);const E=w.useRef(0);return w.useEffect(()=>{const T=r.slice(E.current);if(T.length===0)return;E.current=r.length;const j=v.current,A=[];let D=Ld,L=!1,P=null,W=0;for(const M of T){const F=M,q=F.record??M,ie=F.replay===!0;q.kind==="user"?P=!0:(q.kind==="done"||q.kind==="error")&&(P=!1),q.kind==="done"&&!ie&&(W+=1),D=IT(D,q);const H=qT(q,j,S.current);H!==void 0?A.push(H):(q.kind==="tool_result"||q.kind==="subagent_lifecycle")&&(L=!0)}A.length>0?f(M=>[...M,...A]):L&&f(M=>[...M]),(D.costUsd!==0||D.durationMs!==0||D.turns!==0)&&m(M=>({costUsd:M.costUsd+D.costUsd,durationMs:M.durationMs+D.durationMs,turns:M.turns+D.turns,inputTokens:(M.inputTokens??0)+(D.inputTokens??0),outputTokens:(M.outputTokens??0)+(D.outputTokens??0),cacheReadTokens:(M.cacheReadTokens??0)+(D.cacheReadTokens??0)})),P!==null&&g(P),W>0&&p(M=>M+W)},[r]),w.useEffect(()=>{E.current=0},[t]),{items:o,totals:c,status:a,error:u,turnActive:h,liveTurns:y}}const vO=50,SO=200;function wO(){const t=w.useRef(null),[r,a]=w.useState(!0),[u,o]=w.useState(!1);w.useEffect(()=>{const c=t.current;if(c===null)return;function m(){if(c===null)return;const h=c.scrollHeight-c.scrollTop-c.clientHeight;a(h<=vO),o(h>SO)}return c.addEventListener("scroll",m,{passive:!0}),()=>c.removeEventListener("scroll",m)},[]);const f=w.useCallback(()=>{const c=t.current;c!==null&&(c.scrollTop=c.scrollHeight)},[]);return{containerRef:t,scrollToBottom:f,isPinned:r,showScrollButton:u}}function Es(t,r){return Number.isInteger(r)&&r>=0&&r<t.length}function kO(t,r){if(!Es(t,r)||r===0)return t.slice();const a=t.slice(),u=a[r-1],o=a[r];return u===void 0||o===void 0?t.slice():(a[r-1]=o,a[r]=u,a)}function EO(t,r){if(!Es(t,r)||r===t.length-1)return t.slice();const a=t.slice(),u=a[r+1],o=a[r];return u===void 0||o===void 0?t.slice():(a[r+1]=o,a[r]=u,a)}function CO(t,r){if(!Es(t,r))return t.slice();const a=t.slice();return a.splice(r,1),a}function TO(t,r,a){if(!Es(t,r))return t.slice();const u=t.slice();return u[r]={...u[r],text:a},u}function NO({submit:t,isLive:r}){const[a,u]=w.useState([]),o=w.useRef(!1),f=w.useRef(0),c=w.useRef([]),m=w.useCallback(E=>{const T=f.current++,j=[...c.current,{id:T,text:E}];c.current=j,u(j)},[]),h=w.useCallback(E=>{const T=kO(c.current,E);c.current=T,u(T)},[]),g=w.useCallback(E=>{const T=EO(c.current,E);c.current=T,u(T)},[]),y=w.useCallback(E=>{const T=CO(c.current,E);c.current=T,u(T)},[]),p=w.useCallback((E,T)=>{const j=TO(c.current,E,T);c.current=j,u(j)},[]),v=w.useCallback(()=>{c.current=[],u([])},[]),S=w.useCallback(async()=>{if(o.current||!r)return;const E=c.current[0];if(E===void 0)return;const T=E.id,j=E.text;o.current=!0,t(j).then(()=>{const A=c.current.filter(D=>D.id!==T);c.current=A,u(A)}).catch(()=>{}).finally(()=>{o.current=!1})},[t,r]);return{entries:a,enqueue:m,moveItemUp:h,moveItemDown:g,removeItem:y,editItem:p,clear:v,flush:S}}function AO(){return b.jsx(oO,{children:b.jsx(jO,{})})}function jO(){const{sessions:t,loading:r}=cO(),{approvals:a,pendingSessionIds:u}=mO(),[o,f]=w.useState("sessions"),[c,m]=w.useState(null),[h,g]=w.useState(!1),[y,p]=w.useState(!1),v=t.find(le=>le.id===c),{items:S,totals:E,status:T,turnActive:j,liveTurns:A}=xO(c),{containerRef:D,scrollToBottom:L,isPinned:P,showScrollButton:W}=wO();w.useEffect(()=>{P&&L()},[S.length,P,L]);const M=le=>{f(le),p(!1)},F=le=>{m(le),p(!1)},q=j,[ie,H]=w.useState("sonnet"),ne=w.useCallback(async()=>{try{const le=await it("/api/sessions",{method:"POST"});m(le.session.id)}catch{}},[]),J=w.useRef(null),ve=w.useCallback(async le=>{if(!c)throw new Error("no session");const de=new AbortController;J.current=de,await it(`/api/sessions/${c}/prompt`,{method:"POST",body:JSON.stringify({text:le}),signal:de.signal})},[c]),se=NO({submit:ve,isLive:(v==null?void 0:v.mode)==="live"}),te=w.useRef(0);w.useEffect(()=>{var le;(le=J.current)==null||le.abort(),J.current=null,se.clear(),te.current=0},[c]),w.useEffect(()=>{A>te.current&&se.flush(),te.current=A},[A,se.flush]);const X=b.jsx(vE,{sessions:t,pendingSessionIds:u,selectedSessionId:c,onSelectSession:F,activeNav:o,onNavChange:M,collapsed:h,onToggleCollapse:()=>g(le=>!le)});return b.jsxs("div",{className:"flex h-screen overflow-hidden",children:[b.jsx(NT,{onNavigate:M}),b.jsx(jT,{onNavigate:M}),b.jsx("div",{className:"hidden md:block",children:X}),b.jsx(rO,{open:y,onClose:()=>p(!1),children:X}),b.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("header",{className:"flex h-12 shrink-0 items-center justify-between border-b px-4",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(aO,{className:"md:hidden",onClick:()=>p(!0)}),b.jsxs("h1",{className:"text-sm font-medium text-muted-foreground",children:[o==="sessions"&&"Sessions",o==="memory"&&"Memory",o==="schedules"&&"Schedules",o==="jobs"&&"Background Jobs",o==="settings"&&"Settings"]}),o==="sessions"&&v&&b.jsx(zO,{status:T})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[o==="sessions"&&b.jsx("button",{onClick:()=>void ne(),title:"New Session",className:"flex items-center justify-center h-7 w-7 rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",children:b.jsx(gk,{className:"h-4 w-4"})}),o==="sessions"&&v&&b.jsx(bv,{totals:E}),b.jsx("kbd",{className:"hidden rounded border bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground sm:inline-block",children:"⌘K"})]})]}),b.jsxs("div",{className:"relative flex flex-1 flex-col overflow-hidden",children:[W&&o==="sessions"&&b.jsxs("button",{onClick:L,className:"animate-fade-in fixed bottom-24 left-1/2 z-20 -translate-x-1/2 flex items-center gap-1.5 rounded-full bg-brand px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-lg hover:bg-brand/90 transition-colors",children:[b.jsx(Xb,{className:"size-3"}),"New messages"]}),b.jsxs("div",{ref:D,className:"relative flex flex-1 flex-col overflow-y-auto",children:[b.jsxs("div",{className:"flex-1",children:[o==="sessions"&&b.jsx(_O,{loading:r,sessions:t,selectedSession:v,items:S,totals:E,status:T,turnActive:j}),o==="memory"&&b.jsx(wz,{}),o==="schedules"&&b.jsx(zz,{}),o==="jobs"&&b.jsx(Uz,{}),o==="settings"&&b.jsx(Iz,{})]}),o==="sessions"&&v&&v.mode==="live"&&b.jsxs("div",{className:"shrink-0",children:[a.length>0&&b.jsx(lO,{approvals:a}),b.jsx(eO,{sessionId:v.id,sessionMode:v.mode,isBusy:q,queue:se,onModelSelect:H,currentModel:ie})]})]})]})]})]})}function _O({loading:t,sessions:r,selectedSession:a,items:u,totals:o,status:f,turnActive:c}){return t&&!r.length?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[b.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-current border-t-transparent"}),b.jsx("span",{className:"text-sm",children:"Loading sessions..."})]})}):!t&&r.length===0?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsxs("p",{className:"text-sm",children:["No sessions found. Start one with"," ",b.jsx("code",{className:"rounded bg-secondary px-1 font-mono",children:"afk web"})]})}):a&&u.length>0?b.jsx(mz,{sessionId:a.id,items:u,totals:o,turnActive:c}):a?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsx("div",{className:"flex flex-col items-center gap-2",children:f==="connecting"||f==="reconnecting"?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"size-5 animate-spin rounded-full border-2 border-current border-t-transparent"}),b.jsx("span",{className:"text-sm",children:"Connecting to session..."})]}):b.jsx("span",{className:"text-sm",children:"No transcript data"})})}):b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:"Select a session from the sidebar"})})}function zO({status:t}){return t==="open"?b.jsx("span",{className:"size-2 rounded-full bg-status-running",title:"Live"}):t==="connecting"||t==="reconnecting"?b.jsx("span",{className:"size-2 animate-pulse rounded-full bg-status-blocked",title:t}):t==="ended"?b.jsx("span",{className:"size-2 rounded-full bg-muted-foreground",title:"Session ended"}):null}const q1=document.getElementById("root");if(!q1)throw new Error("Root element #root not found");Gw.createRoot(q1).render(b.jsx(w.StrictMode,{children:b.jsx(AO,{})}));export{Km as _,AN as a,GN as b,Ob as c,qN as f,YN as h,Om as s,MN as w};
380
+ `))h.startsWith("id: ")?c=h.slice(4):h.startsWith("id:")?c=h.slice(3).trimStart():h.startsWith("data: ")?m=h.slice(6):h.startsWith("data:")&&(m=h.slice(5).trimStart());m!==void 0&&o.push({id:c,data:m})}return{events:o,remainder:u}}function yO(t){return typeof t=="object"&&t!==null&&t.end===!0}function bO(t){const[r,a]=w.useState([]),[u,o]=w.useState("connecting"),[f,c]=w.useState(null),m=w.useRef(void 0),h=w.useRef(void 0),g=w.useRef(0),y=w.useRef(!1);return w.useEffect(()=>{if(t===null){a([]),o("connecting"),c(null);return}const p=t;a([]),c(null),y.current=!1,h.current=void 0,g.current=0;async function v(){if(y.current)return;o(g.current===0?"connecting":"reconnecting");let S=!1;const E=new AbortController;m.current=E;const T=mv(),j={};T&&(j.authorization=`Bearer ${T}`),h.current!==void 0&&(j["last-event-id"]=h.current);try{const L=await fetch(`/api/sessions/${encodeURIComponent(p)}/stream`,{headers:j,signal:E.signal});if(!L.ok){if(L.status===401||L.status===403||L.status===404){y.current=!0;const F=L.status===401?"unauthorized":L.status===403?"forbidden":"not-found";c(F),o("closed");return}throw new Error(`stream ${L.status}`)}if(L.body===null)throw new Error("stream: no body");g.current=0,o("open");const P=L.body.getReader(),W=new TextDecoder;let M="";e:for(;;){const{done:F,value:q}=await P.read();if(y.current||F)break;M+=W.decode(q,{stream:!0});const{events:ie,remainder:H}=gO(M);M=H;for(const ne of ie){ne.id!==void 0&&(h.current=ne.id);let J;try{J=JSON.parse(ne.data)}catch{continue}if(yO(J)){S=!0,y.current=!0;break e}a(ve=>[...ve,J])}}}catch(L){if(L instanceof DOMException&&L.name==="AbortError")return}if(y.current){S&&o("ended");return}g.current+=1;const A=.75+Math.random()*.5,D=Math.min(pO*2**(g.current-1),hO)*A;setTimeout(()=>void v(),D)}return v(),()=>{var S;y.current=!0,(S=m.current)==null||S.abort(),o("closed")}},[t]),{events:r,status:u,error:f}}const Ld={costUsd:0,durationMs:0,turns:0};function xO(t){const{events:r,status:a,error:u}=bO(t),[o,f]=w.useState([]),[c,m]=w.useState(Ld),[h,g]=w.useState(!1),[y,p]=w.useState(0),v=w.useRef(new Map),S=w.useRef(new Map);w.useEffect(()=>{RT(),v.current=new Map,S.current=new Map,f([]),m(Ld),g(!1),p(0)},[t]);const E=w.useRef(0);return w.useEffect(()=>{const T=r.slice(E.current);if(T.length===0)return;E.current=r.length;const j=v.current,A=[];let D=Ld,L=!1,P=null,W=0;for(const M of T){const F=M,q=F.record??M,ie=F.replay===!0;q.kind==="user"?P=!0:(q.kind==="done"||q.kind==="error")&&(P=!1),q.kind==="done"&&!ie&&(W+=1),D=IT(D,q);const H=qT(q,j,S.current);H!==void 0?A.push(H):(q.kind==="tool_result"||q.kind==="subagent_lifecycle")&&(L=!0)}A.length>0?f(M=>[...M,...A]):L&&f(M=>[...M]),(D.costUsd!==0||D.durationMs!==0||D.turns!==0)&&m(M=>({costUsd:M.costUsd+D.costUsd,durationMs:M.durationMs+D.durationMs,turns:M.turns+D.turns,inputTokens:(M.inputTokens??0)+(D.inputTokens??0),outputTokens:(M.outputTokens??0)+(D.outputTokens??0),cacheReadTokens:(M.cacheReadTokens??0)+(D.cacheReadTokens??0)})),P!==null&&g(P),W>0&&p(M=>M+W)},[r]),w.useEffect(()=>{E.current=0},[t]),{items:o,totals:c,status:a,error:u,turnActive:h,liveTurns:y}}const vO=50,SO=200;function wO(){const t=w.useRef(null),[r,a]=w.useState(!0),[u,o]=w.useState(!1);w.useEffect(()=>{const c=t.current;if(c===null)return;function m(){if(c===null)return;const h=c.scrollHeight-c.scrollTop-c.clientHeight;a(h<=vO),o(h>SO)}return c.addEventListener("scroll",m,{passive:!0}),()=>c.removeEventListener("scroll",m)},[]);const f=w.useCallback(()=>{const c=t.current;c!==null&&(c.scrollTop=c.scrollHeight)},[]);return{containerRef:t,scrollToBottom:f,isPinned:r,showScrollButton:u}}function Es(t,r){return Number.isInteger(r)&&r>=0&&r<t.length}function kO(t,r){if(!Es(t,r)||r===0)return t.slice();const a=t.slice(),u=a[r-1],o=a[r];return u===void 0||o===void 0?t.slice():(a[r-1]=o,a[r]=u,a)}function EO(t,r){if(!Es(t,r)||r===t.length-1)return t.slice();const a=t.slice(),u=a[r+1],o=a[r];return u===void 0||o===void 0?t.slice():(a[r+1]=o,a[r]=u,a)}function CO(t,r){if(!Es(t,r))return t.slice();const a=t.slice();return a.splice(r,1),a}function TO(t,r,a){if(!Es(t,r))return t.slice();const u=t.slice();return u[r]={...u[r],text:a},u}function NO({submit:t,isLive:r}){const[a,u]=w.useState([]),o=w.useRef(!1),f=w.useRef(0),c=w.useRef([]),m=w.useCallback(E=>{const T=f.current++,j=[...c.current,{id:T,text:E}];c.current=j,u(j)},[]),h=w.useCallback(E=>{const T=kO(c.current,E);c.current=T,u(T)},[]),g=w.useCallback(E=>{const T=EO(c.current,E);c.current=T,u(T)},[]),y=w.useCallback(E=>{const T=CO(c.current,E);c.current=T,u(T)},[]),p=w.useCallback((E,T)=>{const j=TO(c.current,E,T);c.current=j,u(j)},[]),v=w.useCallback(()=>{c.current=[],u([])},[]),S=w.useCallback(async()=>{if(o.current||!r)return;const E=c.current[0];if(E===void 0)return;const T=E.id,j=E.text;o.current=!0,t(j).then(()=>{const A=c.current.filter(D=>D.id!==T);c.current=A,u(A)}).catch(()=>{}).finally(()=>{o.current=!1})},[t,r]);return{entries:a,enqueue:m,moveItemUp:h,moveItemDown:g,removeItem:y,editItem:p,clear:v,flush:S}}function AO(){return b.jsx(oO,{children:b.jsx(jO,{})})}function jO(){const{sessions:t,loading:r}=cO(),{approvals:a,pendingSessionIds:u}=mO(),[o,f]=w.useState("sessions"),[c,m]=w.useState(null),[h,g]=w.useState(!1),[y,p]=w.useState(!1),v=t.find(le=>le.id===c),{items:S,totals:E,status:T,turnActive:j,liveTurns:A}=xO(c),{containerRef:D,scrollToBottom:L,isPinned:P,showScrollButton:W}=wO();w.useEffect(()=>{P&&L()},[S.length,P,L]);const M=le=>{f(le),p(!1)},F=le=>{m(le),p(!1)},q=j,[ie,H]=w.useState("sonnet"),ne=w.useCallback(async()=>{try{const le=await it("/api/sessions",{method:"POST"});m(le.session.id)}catch{}},[]),J=w.useRef(null),ve=w.useCallback(async le=>{if(!c)throw new Error("no session");const de=new AbortController;J.current=de,await it(`/api/sessions/${c}/prompt`,{method:"POST",body:JSON.stringify({text:le}),signal:de.signal})},[c]),se=NO({submit:ve,isLive:(v==null?void 0:v.mode)==="live"}),te=w.useRef(0);w.useEffect(()=>{var le;(le=J.current)==null||le.abort(),J.current=null,se.clear(),te.current=0},[c]),w.useEffect(()=>{A>te.current&&se.flush(),te.current=A},[A,se.flush]);const X=b.jsx(vE,{sessions:t,pendingSessionIds:u,selectedSessionId:c,onSelectSession:F,activeNav:o,onNavChange:M,collapsed:h,onToggleCollapse:()=>g(le=>!le)});return b.jsxs("div",{className:"flex h-screen overflow-hidden",children:[b.jsx(NT,{onNavigate:M}),b.jsx(jT,{onNavigate:M}),b.jsx("div",{className:"hidden md:block",children:X}),b.jsx(rO,{open:y,onClose:()=>p(!1),children:X}),b.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("header",{className:"flex h-12 shrink-0 items-center justify-between border-b px-4",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(aO,{className:"md:hidden",onClick:()=>p(!0)}),b.jsxs("h1",{className:"text-sm font-medium text-muted-foreground",children:[o==="sessions"&&"Sessions",o==="memory"&&"Memory",o==="schedules"&&"Schedules",o==="jobs"&&"Background Jobs",o==="settings"&&"Settings"]}),o==="sessions"&&v&&b.jsx(zO,{status:T})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[o==="sessions"&&b.jsx("button",{onClick:()=>void ne(),title:"New Session",className:"flex items-center justify-center h-7 w-7 rounded-md hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",children:b.jsx(gk,{className:"h-4 w-4"})}),o==="sessions"&&v&&b.jsx(bv,{totals:E}),b.jsx("kbd",{className:"hidden rounded border bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground sm:inline-block",children:"⌘K"})]})]}),b.jsxs("div",{className:"relative flex flex-1 flex-col overflow-hidden",children:[W&&o==="sessions"&&b.jsxs("button",{onClick:L,className:"animate-fade-in fixed bottom-24 left-1/2 z-20 -translate-x-1/2 flex items-center gap-1.5 rounded-full bg-brand px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-lg hover:bg-brand/90 transition-colors",children:[b.jsx(Xb,{className:"size-3"}),"New messages"]}),b.jsxs("div",{ref:D,className:"relative flex flex-1 flex-col overflow-y-auto",children:[b.jsxs("div",{className:"flex-1",children:[o==="sessions"&&b.jsx(_O,{loading:r,sessions:t,selectedSession:v,items:S,totals:E,status:T,turnActive:j}),o==="memory"&&b.jsx(wz,{}),o==="schedules"&&b.jsx(zz,{}),o==="jobs"&&b.jsx(Uz,{}),o==="settings"&&b.jsx(Iz,{})]}),o==="sessions"&&v&&v.mode==="live"&&b.jsxs("div",{className:"shrink-0",children:[a.length>0&&b.jsx(lO,{approvals:a}),b.jsx(eO,{sessionId:v.id,sessionMode:v.mode,isBusy:q,queue:se,onModelSelect:H,currentModel:ie})]})]})]})]})]})}function _O({loading:t,sessions:r,selectedSession:a,items:u,totals:o,status:f,turnActive:c}){return t&&!r.length?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[b.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-current border-t-transparent"}),b.jsx("span",{className:"text-sm",children:"Loading sessions..."})]})}):!t&&r.length===0?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsxs("p",{className:"text-sm",children:["No sessions found. Start one with"," ",b.jsx("code",{className:"rounded bg-secondary px-1 font-mono",children:"afk web"})]})}):a&&u.length>0?b.jsx(mz,{sessionId:a.id,items:u,totals:o,turnActive:c}):a?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsx("div",{className:"flex flex-col items-center gap-2",children:f==="connecting"||f==="reconnecting"?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"size-5 animate-spin rounded-full border-2 border-current border-t-transparent"}),b.jsx("span",{className:"text-sm",children:"Connecting to session..."})]}):a.mode==="live"?b.jsx("span",{className:"text-sm",children:"New session. Send a message to start."}):b.jsx("span",{className:"text-sm",children:"No transcript data"})})}):b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:"Select a session from the sidebar"})})}function zO({status:t}){return t==="open"?b.jsx("span",{className:"size-2 rounded-full bg-status-running",title:"Live"}):t==="connecting"||t==="reconnecting"?b.jsx("span",{className:"size-2 animate-pulse rounded-full bg-status-blocked",title:t}):t==="ended"?b.jsx("span",{className:"size-2 rounded-full bg-muted-foreground",title:"Session ended"}):null}const q1=document.getElementById("root");if(!q1)throw new Error("Root element #root not found");Gw.createRoot(q1).render(b.jsx(w.StrictMode,{children:b.jsx(AO,{})}));export{Km as _,AN as a,GN as b,Ob as c,qN as f,YN as h,Om as s,MN as w};