@goondocks/myco 0.10.0 → 0.11.0

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 (148) hide show
  1. package/CONTRIBUTING.md +3 -19
  2. package/README.md +16 -9
  3. package/dist/{agent-run-CGXF5PPC.js → agent-run-CGM75RS6.js} +4 -4
  4. package/dist/{agent-tasks-T7NVI3R7.js → agent-tasks-3RQKPRSW.js} +4 -4
  5. package/dist/{chunk-ZMW6KQX2.js → chunk-6LL2MQHP.js} +5 -5
  6. package/dist/{chunk-MSXYUXZR.js → chunk-CHG652UO.js} +2 -2
  7. package/dist/{chunk-FMIWFRAM.js → chunk-IXOHLPH7.js} +9 -8
  8. package/dist/chunk-IXOHLPH7.js.map +1 -0
  9. package/dist/{chunk-G2LQBFE3.js → chunk-JYXMRW3T.js} +2 -2
  10. package/dist/chunk-K2UZNK25.js +83 -0
  11. package/dist/chunk-K2UZNK25.js.map +1 -0
  12. package/dist/chunk-LYFDTF7G.js +792 -0
  13. package/dist/chunk-LYFDTF7G.js.map +1 -0
  14. package/dist/{chunk-5PEUFJ6U.js → chunk-QFMBZ72S.js} +24 -8
  15. package/dist/chunk-QFMBZ72S.js.map +1 -0
  16. package/dist/{chunk-YZMNEIFI.js → chunk-YKOEMLJJ.js} +2 -2
  17. package/dist/{chunk-5LPERML5.js → chunk-ZAHDA2PQ.js} +8 -8
  18. package/dist/{cli-6CPFJGRZ.js → cli-FL754H6S.js} +36 -34
  19. package/dist/cli-FL754H6S.js.map +1 -0
  20. package/dist/{client-B27SN5QG.js → client-4NP7ZMLV.js} +3 -3
  21. package/dist/{detect-H5OPI7GD.js → detect-27DN6UTL.js} +3 -3
  22. package/dist/{doctor-RHHWJTMB.js → doctor-OFGWOYBC.js} +18 -24
  23. package/dist/doctor-OFGWOYBC.js.map +1 -0
  24. package/dist/{executor-A5C5KDLP.js → executor-SWXSN7ZC.js} +9 -9
  25. package/dist/{init-ARJROOWV.js → init-JZJJKC4G.js} +37 -56
  26. package/dist/init-JZJJKC4G.js.map +1 -0
  27. package/dist/{init-wizard-XNFOZCEB.js → init-wizard-4VHNOYFO.js} +2 -2
  28. package/dist/{loader-GKXR5ONU.js → loader-DGWP4EFB.js} +4 -4
  29. package/dist/{main-PVX6R3I6.js → main-UBUZTMGV.js} +674 -86
  30. package/dist/main-UBUZTMGV.js.map +1 -0
  31. package/dist/{post-compact-LR3DSGT3.js → post-compact-O7HMEFKP.js} +11 -7
  32. package/dist/post-compact-O7HMEFKP.js.map +1 -0
  33. package/dist/{post-tool-use-SOFVNFU3.js → post-tool-use-OVNMZ3UG.js} +20 -13
  34. package/dist/post-tool-use-OVNMZ3UG.js.map +1 -0
  35. package/dist/{post-tool-use-failure-2CZZZASB.js → post-tool-use-failure-HPXTFYBY.js} +13 -9
  36. package/dist/post-tool-use-failure-HPXTFYBY.js.map +1 -0
  37. package/dist/{pre-compact-3E3D6565.js → pre-compact-JD3D4PBB.js} +10 -6
  38. package/dist/pre-compact-JD3D4PBB.js.map +1 -0
  39. package/dist/{registry-WVZG6R2R.js → registry-33MEKDHT.js} +5 -5
  40. package/dist/remove-XDFMOYUL.js +92 -0
  41. package/dist/remove-XDFMOYUL.js.map +1 -0
  42. package/dist/{restart-XIUFVS33.js → restart-JBAMRKRJ.js} +5 -5
  43. package/dist/{search-VB6Z2ZXV.js → search-43TS5RGA.js} +4 -4
  44. package/dist/{server-AKPBRP6Z.js → server-UBU7NALJ.js} +14 -14
  45. package/dist/{session-UVZS6CY5.js → session-CPBLMD7M.js} +4 -4
  46. package/dist/{session-end-YMQ44U6Z.js → session-end-DUHUYE6J.js} +11 -6
  47. package/dist/session-end-DUHUYE6J.js.map +1 -0
  48. package/dist/{session-start-3754HF3N.js → session-start-I7XM3CME.js} +12 -9
  49. package/dist/{session-start-3754HF3N.js.map → session-start-I7XM3CME.js.map} +1 -1
  50. package/dist/{setup-llm-NWHOPJUV.js → setup-llm-TTHEUWDA.js} +7 -7
  51. package/dist/src/cli.js +1 -1
  52. package/dist/src/daemon/main.js +1 -1
  53. package/dist/src/hooks/post-tool-use.js +1 -1
  54. package/dist/src/hooks/session-end.js +1 -1
  55. package/dist/src/hooks/session-start.js +1 -1
  56. package/dist/src/hooks/stop.js +1 -1
  57. package/dist/src/hooks/user-prompt-submit.js +1 -1
  58. package/dist/src/mcp/server.js +1 -1
  59. package/dist/src/symbionts/manifests/claude-code.yaml +8 -4
  60. package/dist/src/symbionts/manifests/codex.yaml +19 -0
  61. package/dist/src/symbionts/manifests/cursor.yaml +6 -3
  62. package/dist/src/symbionts/manifests/gemini.yaml +20 -0
  63. package/dist/src/symbionts/manifests/vscode-copilot.yaml +17 -0
  64. package/dist/src/symbionts/manifests/windsurf.yaml +16 -0
  65. package/dist/src/symbionts/templates/claude-code/hooks.json +134 -0
  66. package/dist/src/symbionts/templates/claude-code/mcp.json +7 -0
  67. package/dist/src/symbionts/templates/claude-code/settings.json +10 -0
  68. package/dist/src/symbionts/templates/codex/hooks.json +46 -0
  69. package/dist/src/symbionts/templates/codex/mcp.json +6 -0
  70. package/dist/src/symbionts/templates/cursor/mcp.json +7 -0
  71. package/dist/src/symbionts/templates/cursor/settings.json +6 -0
  72. package/dist/src/symbionts/templates/gemini/hooks.json +74 -0
  73. package/dist/src/symbionts/templates/gemini/mcp.json +6 -0
  74. package/dist/src/symbionts/templates/gemini/settings.json +6 -0
  75. package/dist/src/symbionts/templates/instructions-stub.md +9 -0
  76. package/dist/src/symbionts/templates/vscode-copilot/hooks.json +79 -0
  77. package/dist/src/symbionts/templates/vscode-copilot/mcp.json +7 -0
  78. package/dist/src/symbionts/templates/vscode-copilot/settings.json +6 -0
  79. package/dist/src/symbionts/templates/windsurf/hooks.json +22 -0
  80. package/dist/src/symbionts/templates/windsurf/settings.json +6 -0
  81. package/dist/{stats-CDQXOTEC.js → stats-7CE6GEWE.js} +8 -8
  82. package/dist/{stop-WSFGRPXZ.js → stop-BF3AWA7S.js} +16 -10
  83. package/dist/stop-BF3AWA7S.js.map +1 -0
  84. package/dist/{stop-failure-4FR7574F.js → stop-failure-7Q2LQF2R.js} +11 -7
  85. package/dist/stop-failure-7Q2LQF2R.js.map +1 -0
  86. package/dist/{subagent-start-7SGBXJYP.js → subagent-start-QG2J3AN4.js} +11 -7
  87. package/dist/{subagent-start-7SGBXJYP.js.map → subagent-start-QG2J3AN4.js.map} +1 -1
  88. package/dist/subagent-stop-WVA7RDIM.js +32 -0
  89. package/dist/subagent-stop-WVA7RDIM.js.map +1 -0
  90. package/dist/{task-completed-XXPYPSRV.js → task-completed-AQVQ7GFL.js} +12 -8
  91. package/dist/task-completed-AQVQ7GFL.js.map +1 -0
  92. package/dist/{team-XMHYCKFF.js → team-LC3K7UXD.js} +4 -4
  93. package/dist/ui/assets/{index-CPA_uq_j.js → index-UFE9l-Hb.js} +1 -1
  94. package/dist/ui/index.html +1 -1
  95. package/dist/{update-W3UFZU4G.js → update-3EKXZF3H.js} +22 -31
  96. package/dist/update-3EKXZF3H.js.map +1 -0
  97. package/dist/{user-prompt-submit-LSWCYUW3.js → user-prompt-submit-22YQD4XM.js} +14 -7
  98. package/dist/user-prompt-submit-22YQD4XM.js.map +1 -0
  99. package/dist/{verify-O7TQ5DDY.js → verify-DVIWHZXA.js} +3 -3
  100. package/dist/{version-VWWY7SPQ.js → version-VPI6ERF7.js} +2 -2
  101. package/package.json +3 -3
  102. package/skills/rules/SKILL.md +32 -9
  103. package/.claude-plugin/marketplace.json +0 -26
  104. package/.claude-plugin/plugin.json +0 -27
  105. package/dist/chunk-5PEUFJ6U.js.map +0 -1
  106. package/dist/chunk-FMIWFRAM.js.map +0 -1
  107. package/dist/chunk-J4RVYUH4.js +0 -21
  108. package/dist/chunk-J4RVYUH4.js.map +0 -1
  109. package/dist/chunk-WXSJKESH.js +0 -441
  110. package/dist/chunk-WXSJKESH.js.map +0 -1
  111. package/dist/cli-6CPFJGRZ.js.map +0 -1
  112. package/dist/doctor-RHHWJTMB.js.map +0 -1
  113. package/dist/init-ARJROOWV.js.map +0 -1
  114. package/dist/main-PVX6R3I6.js.map +0 -1
  115. package/dist/post-compact-LR3DSGT3.js.map +0 -1
  116. package/dist/post-tool-use-SOFVNFU3.js.map +0 -1
  117. package/dist/post-tool-use-failure-2CZZZASB.js.map +0 -1
  118. package/dist/pre-compact-3E3D6565.js.map +0 -1
  119. package/dist/session-end-YMQ44U6Z.js.map +0 -1
  120. package/dist/stop-WSFGRPXZ.js.map +0 -1
  121. package/dist/stop-failure-4FR7574F.js.map +0 -1
  122. package/dist/subagent-stop-MRVTNX3V.js +0 -28
  123. package/dist/subagent-stop-MRVTNX3V.js.map +0 -1
  124. package/dist/task-completed-XXPYPSRV.js.map +0 -1
  125. package/dist/update-W3UFZU4G.js.map +0 -1
  126. package/dist/user-prompt-submit-LSWCYUW3.js.map +0 -1
  127. /package/dist/{agent-run-CGXF5PPC.js.map → agent-run-CGM75RS6.js.map} +0 -0
  128. /package/dist/{agent-tasks-T7NVI3R7.js.map → agent-tasks-3RQKPRSW.js.map} +0 -0
  129. /package/dist/{chunk-ZMW6KQX2.js.map → chunk-6LL2MQHP.js.map} +0 -0
  130. /package/dist/{chunk-MSXYUXZR.js.map → chunk-CHG652UO.js.map} +0 -0
  131. /package/dist/{chunk-G2LQBFE3.js.map → chunk-JYXMRW3T.js.map} +0 -0
  132. /package/dist/{chunk-YZMNEIFI.js.map → chunk-YKOEMLJJ.js.map} +0 -0
  133. /package/dist/{chunk-5LPERML5.js.map → chunk-ZAHDA2PQ.js.map} +0 -0
  134. /package/dist/{client-B27SN5QG.js.map → client-4NP7ZMLV.js.map} +0 -0
  135. /package/dist/{detect-H5OPI7GD.js.map → detect-27DN6UTL.js.map} +0 -0
  136. /package/dist/{executor-A5C5KDLP.js.map → executor-SWXSN7ZC.js.map} +0 -0
  137. /package/dist/{init-wizard-XNFOZCEB.js.map → init-wizard-4VHNOYFO.js.map} +0 -0
  138. /package/dist/{loader-GKXR5ONU.js.map → loader-DGWP4EFB.js.map} +0 -0
  139. /package/dist/{registry-WVZG6R2R.js.map → registry-33MEKDHT.js.map} +0 -0
  140. /package/dist/{restart-XIUFVS33.js.map → restart-JBAMRKRJ.js.map} +0 -0
  141. /package/dist/{search-VB6Z2ZXV.js.map → search-43TS5RGA.js.map} +0 -0
  142. /package/dist/{server-AKPBRP6Z.js.map → server-UBU7NALJ.js.map} +0 -0
  143. /package/dist/{session-UVZS6CY5.js.map → session-CPBLMD7M.js.map} +0 -0
  144. /package/dist/{setup-llm-NWHOPJUV.js.map → setup-llm-TTHEUWDA.js.map} +0 -0
  145. /package/dist/{stats-CDQXOTEC.js.map → stats-7CE6GEWE.js.map} +0 -0
  146. /package/dist/{team-XMHYCKFF.js.map → team-LC3K7UXD.js.map} +0 -0
  147. /package/dist/{verify-O7TQ5DDY.js.map → verify-DVIWHZXA.js.map} +0 -0
  148. /package/dist/{version-VWWY7SPQ.js.map → version-VPI6ERF7.js.map} +0 -0
@@ -426,7 +426,7 @@ Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}
426
426
 
427
427
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
428
428
 
429
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},M6="DialogDescriptionWarning",O6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hD(M6).contentName}}.`;return j.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},L6=eD,_6=rD,vD=aD,pD=iD,mD=lD,gD=uD,B6=fD;const Ap=L6,P6=_6,yD=j.forwardRef(({className:e,...t},n)=>p.jsx(vD,{ref:n,className:Ae("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));yD.displayName=vD.displayName;const hd=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(P6,{children:[p.jsx(yD,{}),p.jsxs(pD,{ref:r,className:Ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg",e),...n,children:[t,p.jsxs(B6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(rc,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hd.displayName=pD.displayName;function Rp({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}Rp.displayName="DialogHeader";function jp({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}jp.displayName="DialogFooter";const vd=j.forwardRef(({className:e,...t},n)=>p.jsx(mD,{ref:n,className:Ae("text-lg font-serif font-semibold leading-none tracking-tight",e),...t}));vd.displayName=mD.displayName;const A1=j.forwardRef(({className:e,...t},n)=>p.jsx(gD,{ref:n,className:Ae("text-sm text-on-surface-variant",e),...t}));A1.displayName=gD.displayName;const fn=j.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:Ae("flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface","placeholder:text-on-surface-variant/50","focus-visible:outline-none focus-visible:border-primary/40","disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));fn.displayName="Input";var xD="Toggle",bD=j.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=e,[l,o]=Uv({prop:n,onChange:a,defaultProp:r??!1,caller:xD});return p.jsx(Yt.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Wt(e.onClick,()=>{e.disabled||o(!l)})})});bD.displayName=xD;var wD=bD;const z6=Ep("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary",{variants:{variant:{default:"bg-surface-container-high text-on-surface-variant",outline:"border border-input bg-surface-container-high text-on-surface-variant shadow-sm hover:bg-surface-container-high/80 hover:text-on-surface-variant"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),cb=j.forwardRef(({className:e,variant:t,size:n,...r},a)=>p.jsx(wD,{ref:a,className:Ae(z6({variant:t,size:n,className:e})),...r}));cb.displayName=wD.displayName;const I6=Ep("inline-flex items-center rounded-sm px-2 py-0.5 font-sans text-xs font-medium transition-colors",{variants:{variant:{default:"bg-primary/15 text-primary",secondary:"bg-surface-container-high text-on-surface-variant",destructive:"bg-tertiary/15 text-tertiary",warning:"bg-secondary/15 text-secondary",outline:"border border-[var(--ghost-border)] text-on-surface-variant"}},defaultVariants:{variant:"default"}});function Ln({className:e,variant:t,...n}){return p.jsx("div",{className:Ae(I6({variant:t}),e),...n})}const F6=120,q6={session:{label:"Sessions",icon:xp},spore:{label:"Spores",icon:kj},plan:{label:"Plans",icon:qP},prompt_batch:{label:"Prompt Batches",icon:rb},activity:{label:"Activities",icon:rb}};function SD(e){return q6[e]??{label:e,icon:KP}}function U6(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function V6({score:e}){const t=Math.round(e*100);return p.jsxs(Ln,{variant:"outline",className:"shrink-0 text-xs tabular-nums text-on-surface-variant",children:[t,"%"]})}function H6({result:e,onSelect:t,isHighlighted:n}){const{icon:r}=SD(e.type);return p.jsxs("button",{type:"button",onClick:()=>t(e),className:["w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors",n?"bg-surface-container-high text-on-surface":"hover:bg-surface-container-high hover:text-on-surface"].join(" "),children:[p.jsx(r,{className:"h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("span",{className:"text-sm font-medium truncate",children:e.title})}),e.preview&&p.jsx("p",{className:"text-xs text-on-surface-variant mt-0.5 line-clamp-2",children:U6(e.preview,F6)})]}),p.jsx(V6,{score:e.score})]})}function G6({results:e,onSelect:t,highlightedIndex:n}){const r=e.reduce((i,l)=>{const o=l.type??"unknown";return(i[o]??(i[o]=[])).push(l),i},{});let a=0;return p.jsx("div",{className:"py-2 space-y-1",children:Object.entries(r).map(([i,l])=>{const{label:o}=SD(i),f=a;return a+=l.length,p.jsxs("div",{children:[p.jsx("div",{className:"px-3 py-1",children:p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-on-surface-variant",children:o})}),l.map((c,d)=>p.jsx(H6,{result:c,onSelect:t,isHighlighted:n===f+d},c.id))]},i)})})}const $6=2,K6=3e4;function Y6(e,t="semantic"){return Tn({queryKey:["search",e,t],queryFn:({signal:n})=>bt(`/search?q=${encodeURIComponent(e)}&mode=${t}`,{signal:n}),enabled:e.length>$6,staleTime:K6})}const X6=300,Q6=20;function W6(e){switch(e.type){case"session":return`/sessions/${e.id}`;case"spore":return`/mycelium?spore=${encodeURIComponent(e.id)}`;case"plan":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"prompt_batch":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"activity":return e.session_id?`/sessions/${e.session_id}`:"/sessions";default:return"/"}}function Z6({open:e,onOpenChange:t}){const n=Wi(),[r,a]=j.useState(""),[i,l]=j.useState(""),[o,f]=j.useState("semantic"),[c,d]=j.useState(0),v=j.useRef(null);j.useEffect(()=>{const T=setTimeout(()=>{l(r.trim())},X6);return()=>clearTimeout(T)},[r]),j.useEffect(()=>{e&&(a(""),l(""),d(0),setTimeout(()=>{var T;return(T=v.current)==null?void 0:T.focus()},50))},[e]);const{data:m,isLoading:y}=Y6(i,o),x=((m==null?void 0:m.results)??[]).slice(0,Q6);j.useEffect(()=>{d(0)},[x.length,i]);const w=j.useCallback(T=>{const N=W6(T);t(!1),n(N)},[n,t]),S=j.useCallback(T=>{if(x.length!==0){if(T.key==="ArrowDown")T.preventDefault(),d(N=>Math.min(N+1,x.length-1));else if(T.key==="ArrowUp")T.preventDefault(),d(N=>Math.max(N-1,0));else if(T.key==="Enter"){T.preventDefault();const N=x[c];N&&w(N)}}},[x,c,w]),b=i.length>2&&!y&&x.length===0,C=i.length<=2&&!y;return p.jsx(Ap,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"max-w-2xl p-0 gap-0 overflow-hidden",onKeyDown:S,children:[p.jsx(vd,{className:"sr-only",children:"Search vault"}),p.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3",children:[p.jsx(nc,{className:"h-4 w-4 shrink-0 text-on-surface-variant"}),p.jsx(fn,{ref:v,value:r,onChange:T=>a(T.target.value),placeholder:"Search sessions, spores, plans…",className:"border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono"}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p.jsx(cb,{size:"sm",pressed:o==="semantic",onPressedChange:()=>f("semantic"),"aria-label":"Semantic search",title:"Semantic (embedded knowledge)",children:"Semantic"}),p.jsx(cb,{size:"sm",pressed:o==="fts",onPressedChange:()=>f("fts"),"aria-label":"Full-text search",title:"Full text (raw data)",children:"Full Text"})]})]}),p.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[y&&i.length>2&&p.jsx("div",{className:"px-4 py-8 text-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-2 text-on-surface-variant",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-24 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-28 rounded bg-muted animate-pulse"})]})}),C&&p.jsx("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:"Type to search your vault…"}),b&&p.jsxs("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:["No results for ",p.jsxs("span",{className:"font-medium text-on-surface",children:['"',i,'"']})]}),x.length>0&&!y&&p.jsx(G6,{results:x,onSelect:w,highlightedIndex:c})]}),p.jsxs("div",{className:"border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant",children:[p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↑↓"})," navigate"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↵"})," open"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"Esc"})," close"]}),p.jsx("span",{className:"ml-auto",children:(m==null?void 0:m.mode)&&x.length>0&&`${x.length} result${x.length!==1?"s":""} · ${m.mode}`})]})]})})}const J6=[{to:"/",label:"Dashboard",icon:JP},{to:"/sessions",label:"Sessions",icon:xp},{to:"/mycelium",label:"Mycelium",icon:rz},{to:"/agent",label:"Agent",icon:dd},{to:"/settings",label:"Settings",icon:oz},{to:"/operations",label:"Operations",icon:mz},{to:"/team",label:"Team",icon:vz},{to:"/logs",label:"Logs",icon:Tj}],eF=[{value:"default",label:"Default"},{value:"geist-mono",label:"Geist Mono"},{value:"system",label:"System"},{value:"sf-mono",label:"SF Mono"},{value:"fira-code",label:"Fira Code"},{value:"jetbrains-mono",label:"JetBrains"}],ED={compact:.85,normal:1,comfy:1.15},tF={compact:"Compact",normal:"Normal",comfy:"Comfy"},df=["compact","normal","comfy"],yT="myco-ui-sidebar-collapsed",xT=768,CD="myco-ui-density",nF="--density",rF="normal";function aF(){const e=localStorage.getItem(CD);return e&&e in ED?e:rF}function iF(e){const t=ED[e];document.documentElement.style.setProperty(nF,String(t)),document.documentElement.style.fontSize=`calc(14px * ${t})`}function sF(){const[e,t]=j.useState(aF),n=j.useCallback(r=>{localStorage.setItem(CD,r),t(r)},[]);return j.useEffect(()=>{iF(e)},[e]),{density:e,setDensity:n}}function lF(){const[e,t]=j.useState(()=>localStorage.getItem(yT)==="true"),n=j.useCallback(()=>{t(r=>{const a=!r;return localStorage.setItem(yT,String(a)),a})},[]);return{collapsed:e,toggle:n}}function oF(){const[e,t]=j.useState(!1),[n,r]=j.useState(()=>typeof window<"u"&&window.innerWidth<xT);j.useEffect(()=>{const o=window.matchMedia(`(max-width: ${xT-1}px)`),f=c=>{r(c.matches),c.matches||t(!1)};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=Qi();j.useEffect(()=>{t(!1)},[a.pathname]),j.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]);const i=j.useCallback(()=>t(o=>!o),[]),l=j.useCallback(()=>t(!1),[]);return{open:e,isMobile:n,toggle:i,close:l}}const By=["light","dark","system"],uF={light:fz,dark:nz,system:Ej},cF={light:"Light",dark:"Dark",system:"System"};function fF({collapsed:e=!1}){const{theme:t,setTheme:n}=TP(),r=()=>{const l=By.indexOf(t),o=By[(l+1)%By.length];n(o)},a=uF[t]??Ej,i=cF[t]??"System";return p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:r,title:e?`${i} mode`:void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(a,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:i})]})}function dF({collapsed:e=!1}){const{restart:t,isRestarting:n}=x1();return p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>t(),disabled:n,title:e?n?"Restarting...":"Restart Daemon":void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(m1,{className:Ae("h-4 w-4",n&&"animate-spin")}),!e&&p.jsx("span",{children:n?"Restarting...":"Restart Daemon"})]})}function hF(){const{font:e,setFont:t}=DP();return p.jsxs("label",{className:"flex items-center gap-2 px-2 py-1 text-sm text-on-surface-variant hover:text-on-surface cursor-pointer",children:[p.jsx(dz,{className:"h-4 w-4 shrink-0"}),p.jsx("select",{value:e,onChange:n=>t(n.target.value),className:"w-full bg-transparent border-none outline-none cursor-pointer text-sm appearance-none",children:eF.map(n=>p.jsx("option",{value:n.value,children:n.label},n.value))})]})}function vF({density:e,setDensity:t}){const n=df.indexOf(e),r=()=>{const i=df[n-1];n>0&&i!==void 0&&t(i)},a=()=>{const i=df[n+1];n<df.length-1&&i!==void 0&&t(i)};return p.jsxs("div",{className:"flex items-center gap-1 px-3 py-1",children:[p.jsx("button",{onClick:r,disabled:n===0,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Decrease density",children:p.jsx(tz,{className:"h-3 w-3"})}),p.jsx("div",{className:"flex flex-1 justify-center",children:p.jsx("span",{className:"text-xs text-on-surface-variant select-none",children:tF[e]})}),p.jsx("button",{onClick:a,disabled:n===df.length-1,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Increase density",children:p.jsx(iz,{className:"h-3 w-3"})})]})}function bT({collapsed:e,vaultName:t,density:n,setDensity:r,onSearchOpen:a,onCollapseToggle:i,showCollapseToggle:l}){return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Ae("px-4 py-5",e&&"px-2 py-4 flex justify-center"),children:e?p.jsxs("div",{className:"relative flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary",children:"m"}),p.jsx("span",{className:"ml-1 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}):p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),p.jsx("span",{className:"ml-2 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}),t&&p.jsx("span",{className:"font-mono text-xs text-outline uppercase tracking-widest mt-0.5",children:t})]})}),p.jsx("div",{className:"px-2 pt-2 pb-1",children:p.jsxs("button",{type:"button",onClick:a,title:e?"Search (⌘K)":void 0,className:Ae("flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface",e?"justify-center px-2 py-2":"gap-3 px-3 py-2"),children:[p.jsx(nc,{className:"h-4 w-4 shrink-0"}),!e&&p.jsx("span",{className:"flex-1 text-left",children:"Search"}),!e&&p.jsxs("kbd",{className:"text-xs text-on-surface-variant/60 font-mono",children:["⌘","K"]})]})}),p.jsx("nav",{className:"flex-1 space-y-1 px-2 py-2","aria-label":"Main navigation",children:J6.map(o=>p.jsxs(cj,{to:o.to,end:o.to==="/",title:e?o.label:void 0,className:({isActive:f})=>Ae("flex items-center rounded-md text-sm font-medium transition-colors",e?"justify-center px-2 py-2":"gap-3 px-3 py-2",f?"bg-primary/10 text-primary":"text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface"),children:[p.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),!e&&o.label]},o.to))}),p.jsxs("div",{className:Ae("py-3 space-y-1 mt-auto",e?"px-1 flex flex-col items-center":"px-2"),children:[p.jsx(dF,{collapsed:e}),!e&&p.jsx(hF,{}),!e&&p.jsx(vF,{density:n,setDensity:r}),p.jsx(fF,{collapsed:e})]}),l&&i&&p.jsx("div",{className:Ae("px-2 py-2",e&&"flex justify-center"),children:p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:i,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),title:e?"Expand sidebar":"Collapse sidebar",children:[e?p.jsx(Ea,{className:"h-4 w-4"}):p.jsx(h1,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:"Collapse"})]})})]})}function pF(){const{collapsed:e,toggle:t}=lF(),{density:n,setDensity:r}=sF(),{data:a}=Sp(),i=a==null?void 0:a.vault.name,[l,o]=j.useState(!1),f=oF();j.useEffect(()=>{const d=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),o(m=>!m))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),j.useEffect(()=>{if(!f.open)return;const d=v=>{v.key==="Escape"&&(v.preventDefault(),f.close())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[f.open,f.close]);const c=j.useCallback(()=>o(!0),[]);return p.jsxs("div",{className:"flex h-screen bg-background",children:[p.jsx(Z6,{open:l,onOpenChange:o}),f.isMobile&&p.jsxs("div",{className:"fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3",children:[p.jsx("button",{type:"button",onClick:f.toggle,className:"rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":f.open?"Close navigation":"Open navigation",children:f.open?p.jsx(rc,{className:"h-5 w-5"}):p.jsx(ez,{className:"h-5 w-5"})}),p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),i&&p.jsx("span",{className:"font-mono text-[10px] text-outline uppercase tracking-widest",children:i}),p.jsx("button",{type:"button",onClick:c,className:"ml-auto rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":"Search",children:p.jsx(nc,{className:"h-4 w-4"})})]}),f.isMobile&&f.open&&p.jsx("div",{className:"fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-sm transition-opacity",onClick:f.close,"aria-hidden":"true"}),f.isMobile&&p.jsx("aside",{className:Ae("fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out",f.open?"translate-x-0":"-translate-x-full"),children:p.jsx(bT,{collapsed:!1,vaultName:i,density:n,setDensity:r,onSearchOpen:c,showCollapseToggle:!1})}),!f.isMobile&&p.jsx("aside",{className:Ae("flex flex-col bg-surface-container transition-[width] duration-200",e?"w-14":"w-56"),children:p.jsx(bT,{collapsed:e,vaultName:i,density:n,setDensity:r,onSearchOpen:c,onCollapseToggle:t,showCollapseToggle:!0})}),p.jsx("main",{className:Ae("flex-1 overflow-auto bg-surface",f.isMobile&&"pt-12"),"aria-label":"Page content",children:p.jsx(FB,{})})]})}function R1({isLoading:e,error:t,loadingText:n="Loading...",children:r}){return e?p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Qn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:n})]}):t?p.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Zi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to connect to daemon"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:t.message})]}):p.jsx(p.Fragment,{children:r})}const el=60,Su=3600,Df=86400,xa=1e3;function j1(e){if(e<el)return`${Math.floor(e)}s`;if(e<Su)return`${Math.floor(e/el)}m`;if(e<Df){const r=Math.floor(e/Su),a=Math.floor(e%Su/el);return`${r}h ${a}m`}const t=Math.floor(e/Df),n=Math.floor(e%Df/Su);return`${t}d ${n}h`}function D1(e){const t=(Date.now()-new Date(e).getTime())/xa;return t<el?"just now":t<Su?`${Math.floor(t/el)}m ago`:t<Df?`${Math.floor(t/Su)}h ago`:`${Math.floor(t/Df)}d ago`}function oi(e){return D1(new Date(e*xa).toISOString())}function fb(e){return new Date(e*xa).toLocaleString()}function db(e,t){return e?e.length>t?e.slice(0,t)+"…":e:""}function M1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dp(e,t){if(e===null||t===null)return"—";const n=(t-e)*xa;if(n<xa)return`${n}ms`;if(n<el*xa)return`${(n/xa).toFixed(1)}s`;const r=Math.floor(n/(el*xa)),a=Math.floor(n%(el*xa)/xa);return`${r}m ${a}s`}function mF(e){return e===null?"—":e<xa?`${e}ms`:`${(e/xa).toFixed(1)}s`}function Hv(e,t){if(e.trim()==="")return t;const n=Number(e);return Number.isFinite(n)?n:t}function TD(e){return e!==null?oi(e):"—"}const wT=100,gF=1;function yF(e){const{embedded_count:t,total_embeddable:n}=e.embedding;return n===0?wT:Number((t/n*wT).toFixed(gF))}function xF(e){const t=e.agent.last_run_status==="error",n=e.embedding.queue_depth>0||e.unprocessed_batches>0;return t?"Issues detected in the network":n?"Work in progress across the network":"Network Topology Active"}function bF(e){return e.embedding.queue_depth>0||e.unprocessed_batches>0}function wF({active:e}){const t=e?"animate-pulse-slow":"";return p.jsxs("svg",{className:"absolute inset-0 w-full h-full opacity-20 pointer-events-none",viewBox:"0 0 400 300",preserveAspectRatio:"xMidYMid slice",children:[p.jsx("path",{d:"M200,280 Q200,220 200,160",fill:"none",stroke:"var(--primary)",strokeWidth:"2",className:t}),p.jsx("path",{d:"M200,200 Q240,170 280,180",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,170 Q160,140 120,155",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,160 Q230,110 270,90",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M200,160 Q170,110 130,80",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M280,180 Q310,170 340,190",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("path",{d:"M120,155 Q90,145 60,160",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("circle",{cx:"280",cy:"180",r:"3",fill:"var(--primary)",opacity:"0.7"}),p.jsx("circle",{cx:"120",cy:"155",r:"3",fill:"var(--secondary)",opacity:"0.7"}),p.jsx("circle",{cx:"270",cy:"90",r:"2.5",fill:"var(--tertiary)",opacity:"0.6"}),p.jsx("circle",{cx:"130",cy:"80",r:"2.5",fill:"var(--secondary)",opacity:"0.6"}),p.jsx("circle",{cx:"340",cy:"190",r:"2",fill:"var(--tertiary)",opacity:"0.4"}),p.jsx("circle",{cx:"60",cy:"160",r:"2",fill:"var(--primary)",opacity:"0.4"}),p.jsx("circle",{cx:"200",cy:"160",r:"4",fill:"var(--primary)",className:e?"animate-pulse":""})]})}function SF({stats:e}){const t=yF(e),n=xF(e),r=bF(e),a=e.daemon.active_sessions.length,i=j1(e.daemon.uptime_seconds);return p.jsxs("section",{className:"relative flex items-center justify-center rounded-xl overflow-hidden glass-panel border border-outline-variant/10 min-h-[320px]",children:[p.jsx(wF,{active:r}),p.jsxs("div",{className:"text-center relative z-20 space-y-3 py-12",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-on-surface-variant/80",children:n}),p.jsx("h1",{className:"font-serif text-5xl italic text-on-surface drop-shadow-sm",children:"Myco"}),p.jsxs("p",{className:"font-mono text-sm text-outline",children:["Node connectivity at ",t,"% capacity"]}),p.jsxs("div",{className:"flex items-center justify-center gap-6 pt-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-sage shadow-sage-glow animate-pulse"}),p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[a," active ",a===1?"session":"sessions"]})]}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[e.vault.spore_count," spores"]})}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:["uptime ",i]})})]})]})]})}function EF({data:e,width:t=120,height:n=40,className:r}){if(e.length<2)return null;const a=Math.min(...e),l=Math.max(...e)-a||1,o=e.map((d,v)=>({x:v/(e.length-1)*t,y:n-(d-a)/l*n}));let f=`M ${o[0].x} ${o[0].y}`;for(let d=0;d<o.length-1;d++){const v=o[Math.max(0,d-1)],m=o[d],y=o[d+1],x=o[Math.min(o.length-1,d+2)],w=m.x+(y.x-v.x)/6,S=m.y+(y.y-v.y)/6,b=y.x-(x.x-m.x)/6,C=y.y-(x.y-m.y)/6;f+=` C ${w} ${S}, ${b} ${C}, ${y.x} ${y.y}`}const c=`${f} L ${t} ${n} L 0 ${n} Z`;return p.jsxs("svg",{width:t,height:n,className:r,viewBox:`0 0 ${t} ${n}`,children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:"sparkline-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:"0.2"}),p.jsx("stop",{offset:"100%",stopColor:"var(--primary)",stopOpacity:"0"})]})}),p.jsx("path",{d:c,fill:"url(#sparkline-fill)"}),p.jsx("path",{d:f,fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",strokeOpacity:"0.8"})]})}const CF={sage:"border-t-sage",ochre:"border-t-ochre",terracotta:"border-t-terracotta",outline:"border-t-outline"},TF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta",outline:"text-on-surface"};function yn({label:e,value:t,sublabel:n,accent:r,sparklineData:a,className:i,href:l}){const o=Ae("rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80",l&&"cursor-pointer",CF[r],i),f=p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-outline mb-2",children:e}),p.jsxs("div",{className:"flex items-end justify-between gap-2",children:[p.jsx("p",{className:Ae("font-serif text-2xl font-bold",TF[r]),children:t}),a&&a.length>=2&&p.jsx(EF,{data:a,width:80,height:28,className:"opacity-60"})]}),n&&p.jsx("p",{className:"font-mono text-[10px] text-outline mt-1",children:n})]});return l?p.jsx(mp,{to:l,className:Ae(o,"block no-underline"),children:f}):p.jsx("div",{className:o,children:f})}function kF({stats:e}){const t=e.embedding.total_embeddable>0?Math.round(e.embedding.embedded_count/e.embedding.total_embeddable*100):0,n=e.digest.tiers_available.length>0?`${e.digest.tiers_available.length} tiers`:"None",r=e.agent.last_run_at?oi(e.agent.last_run_at):"Never";return p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[p.jsx(yn,{label:"Sessions",value:String(e.vault.session_count),sublabel:`${e.daemon.active_sessions.length} active`,accent:"sage",href:"/sessions"}),p.jsx(yn,{label:"Spores",value:String(e.vault.spore_count),sublabel:`${e.vault.entity_count} entities`,accent:"sage",href:"/mycelium?tab=spores"}),p.jsx(yn,{label:"Embedding",value:`${t}%`,sublabel:`${e.embedding.embedded_count}/${e.embedding.total_embeddable}`,accent:e.embedding.queue_depth>0?"ochre":"sage",href:"/operations"}),p.jsx(yn,{label:"Agent",value:`${e.agent.total_runs}`,sublabel:`last: ${r}`,accent:e.agent.last_run_status==="error"?"terracotta":"outline",href:"/agent"}),p.jsx(yn,{label:"Digest",value:n,sublabel:e.digest.generated_at?oi(e.digest.generated_at):void 0,accent:"outline",href:"/mycelium?tab=digest"}),p.jsx(yn,{label:"Uptime",value:j1(e.daemon.uptime_seconds),sublabel:`v${e.daemon.version}`,accent:"outline"})]})}function kD(e=20){return Fa({queryKey:["activity",e],queryFn:({signal:t})=>bt(`/activity?limit=${e}`,{signal:t}),refetchInterval:ra.STATS,pollCategory:"standard"})}function NF(e){return e==="agent_run"?"ochre":e==="spore"?"sage":e.includes("error")||e.includes("fail")?"terracotta":"sage"}function AF(e){switch(e){case"sage":return{label:"STABLE",dotClass:"bg-sage shadow-sage-glow"};case"ochre":return{label:"ACTIVE",dotClass:"bg-ochre shadow-ochre-glow"};case"terracotta":return{label:"WARNING",dotClass:"bg-terracotta shadow-terracotta-glow"}}}const RF={sage:"border-l-sage",ochre:"border-l-ochre",terracotta:"border-l-terracotta"},jF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},DF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},MF={sage:"border-sage/20",ochre:"border-ochre/20",terracotta:"border-terracotta/20"};function OF(e){return`#${e.slice(-6).toUpperCase()}`}function ST(e){return e.summary}function LF({event:e}){const t=Wi(),n=NF(e.type),r=AF(n),a=oi(e.timestamp),i=e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null;return p.jsxs("div",{className:Ae("p-5 rounded-lg border-l-4 bg-surface-container/60 hover:bg-surface-container-high group hover-lift transition-colors",i&&"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",RF[n]),onClick:()=>i&&t(i),onKeyDown:l=>{i&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i))},tabIndex:i?0:void 0,role:i?"link":void 0,"aria-label":`${ST(e)} - ${r.label} - ${a}`,children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:Ae("font-mono text-xs font-bold",jF[n]),children:OF(e.id)}),p.jsx("h4",{className:"font-serif text-lg text-on-surface leading-tight mt-0.5 truncate",children:ST(e)})]}),p.jsx("div",{className:Ae("w-8 h-8 rounded-full border-2 flex items-center justify-center shrink-0 ml-3",MF[n]),children:p.jsx("div",{className:Ae("w-3.5 h-3.5 rounded-full",r.dotClass)})})]}),p.jsxs("p",{className:"text-xs text-on-surface/60 line-clamp-2 leading-relaxed italic mb-3",children:["> ",e.type.replace(/_/g," ")," event recorded ",a]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("span",{className:Ae("px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono rounded",DF[n]),children:r.label}),p.jsx("span",{className:"px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono text-outline rounded",children:a})]})]})}const ET=6,_F=3;function BF(){return p.jsxs("div",{className:"p-5 rounded-lg border-l-4 border-l-outline-variant/30 bg-surface-container/40 animate-pulse",children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high"}),p.jsx("div",{className:"h-5 w-40 rounded bg-surface-container-high"})]}),p.jsx("div",{className:"w-8 h-8 rounded-full bg-surface-container-high"})]}),p.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-container-high/60 mb-3"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("div",{className:"h-5 w-16 rounded bg-surface-container-high/60"}),p.jsx("div",{className:"h-5 w-12 rounded bg-surface-container-high/60"})]})]})}function PF(){const{data:e,isLoading:t}=kD(ET*2),n=(e??[]).filter(r=>r.type!=="agent_run").slice(0,ET);return p.jsxs("section",{className:"space-y-5",children:[p.jsx("div",{className:"flex items-end justify-between border-b border-outline-variant/10 pb-4",children:p.jsxs("div",{children:[p.jsx("h3",{className:"font-serif text-3xl text-on-surface",children:"Session Pods"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline mt-1",children:"Monitoring concurrent thread activity"})]})}),t?p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:Array.from({length:_F}).map((r,a)=>p.jsx(BF,{},a))}):n.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Cj,{className:"h-10 w-10 text-outline/30"}),p.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3 w-3 rounded-full bg-surface-container border-2 border-surface"})]}),p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No recent activity"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline tracking-wider",children:"Pods appear as sessions and spores are captured"})]}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:n.map(r=>p.jsx(LF,{event:r},r.id))})]})}const zF=ra.STATS,IF=ra.HEALTH,FF=ra.STATS,O1=new Set(["completed","failed","skipped"]),qF=ra.STATS,L1=6e4,UF=50;function ND(e){const t=(e==null?void 0:e.limit)??UF,n=new URLSearchParams;n.set("limit",String(t)),(e==null?void 0:e.offset)!==void 0&&n.set("offset",String(e.offset)),e!=null&&e.search&&n.set("search",e.search),e!=null&&e.status&&n.set("status",e.status),e!=null&&e.task&&n.set("task",e.task);const r=n.toString();return Fa({queryKey:["agent-runs",e],queryFn:({signal:a})=>bt(`/agent/runs?${r}`,{signal:a}),pollCategory:"standard",refetchInterval:zF})}function VF(e){return Tn({queryKey:["agent-run",e],queryFn:({signal:n})=>bt(`/agent/runs/${e}`,{signal:n}),enabled:e!==void 0,refetchInterval:n=>{var a,i;const r=(i=(a=n.state.data)==null?void 0:a.run)==null?void 0:i.status;return r&&O1.has(r)?!1:IF}})}function HF(e,t){const n=t?O1.has(t):!1;return Fa({queryKey:["agent-reports",e],queryFn:({signal:r})=>bt(`/agent/runs/${e}/reports`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:FF})}function GF(e,t){const n=t?O1.has(t):!1;return Fa({queryKey:["agent-turns",e],queryFn:({signal:r})=>bt(`/agent/runs/${e}/turns`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:qF})}function ic(){return Tn({queryKey:["agent-tasks"],queryFn:({signal:e})=>bt("/agent/tasks",{signal:e}),staleTime:L1})}function $F(e){return Tn({queryKey:["agent-task",e],queryFn:({signal:t})=>bt(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:L1})}function KF(){const e=Ca();return vl({mutationFn:({taskId:t,name:n})=>Cr(`/agent/tasks/${t}/copy`,n?{name:n}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function YF(){const e=Ca();return vl({mutationFn:t=>Aj(`/agent/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function XF(e){return Tn({queryKey:["agent-task-yaml",e],queryFn:({signal:t})=>bt(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:L1})}function QF(){const e=Ca();return vl({mutationFn:({taskId:t,yaml:n})=>wp(`/agent/tasks/${t}`,{yaml:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]}),e.invalidateQueries({queryKey:["agent-task"]}),e.invalidateQueries({queryKey:["agent-task-yaml"]})}})}function _1(){const e=Ca();return vl({mutationFn:t=>Cr("/agent/run",t),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-runs"]})}})}function B1(e){return e===null?"—":`$${e.toFixed(4)}`}function P1(e){return e===null?"—":e.toLocaleString()}function AD(e){switch(e){case"completed":return"default";case"running":return"warning";case"failed":return"destructive";default:return"secondary"}}function RD(e){return e===g1?"warning":"secondary"}const jD="Default task";function DD(e,t){if(!e)return jD;const n=t.find(r=>r.name===e);return(n==null?void 0:n.displayName)??e}const WF=5,CT={running:"bg-sage animate-pulse",completed:"bg-sage",failed:"bg-terracotta",skipped:"bg-outline/40",pending:"bg-outline/40"};function ZF({run:e,taskName:t,onClick:n}){const r=CT[e.status]??CT.pending;return p.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-outline-variant/5 last:border-0 cursor-pointer hover:bg-surface-container-high/50 -mx-2 px-2 rounded transition-colors",onClick:n,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n())},role:"link",tabIndex:0,"aria-label":`View run: ${t}`,children:[p.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p.jsx("span",{className:Ae("h-2 w-2 shrink-0 rounded-full",r)}),p.jsx("span",{className:"text-sm text-on-surface truncate",children:t})]}),p.jsxs("div",{className:"flex items-center gap-3 shrink-0 font-mono text-[11px] text-outline",children:[p.jsx("span",{children:e.started_at!==null?oi(e.started_at):"—"}),p.jsx("span",{children:Dp(e.started_at,e.completed_at)})]})]})}function JF(){const{data:e,isLoading:t}=ND({limit:WF}),{data:n}=ic(),r=Wi(),a=(n==null?void 0:n.tasks)??[],i=(e==null?void 0:e.runs)??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"Agent Runs"}),p.jsx(dd,{className:"h-5 w-5 text-outline"})]}),t?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"Loading runs..."}):i.length===0?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"No agent runs yet"}):p.jsx("div",{children:i.map(l=>p.jsx(ZF,{run:l,taskName:DD(l.task,a),onClick:()=>r("/agent")},l.id))})]})}const eq=12,tq=8;function nq(e){return e.includes("error")||e.includes("fail")?"error":e==="agent_run"?"warn":"ok"}const rq={ok:"[OK]",warn:"[WRN]",error:"[ERR]"},aq={ok:"text-sage",warn:"text-ochre",error:"text-terracotta"};function iq(e){return new Date(e*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function sq(e){return e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null}function lq({event:e,onClick:t}){const n=nq(e.type);return p.jsxs("div",{className:Ae("flex gap-4 items-start border-b border-outline-variant/5 pb-2 font-mono text-[11px] transition-all duration-150",t&&"cursor-pointer hover:bg-surface-container-high/50 hover:translate-x-1 -mx-2 px-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"),onClick:t,onKeyDown:t?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())}:void 0,tabIndex:t?0:void 0,role:t?"link":void 0,"aria-label":t?`${e.type.replace(/_/g," ")}: ${e.summary}`:void 0,children:[p.jsx("span",{className:"text-outline shrink-0 tabular-nums",children:iq(e.timestamp)}),p.jsx("span",{className:Ae("shrink-0 font-bold",aq[n]),children:rq[n]}),p.jsx("span",{className:"text-on-surface/70 truncate",children:e.summary})]})}function oq(){const{data:e,isLoading:t}=kD(eq),n=Wi(),r=(e==null?void 0:e.slice(0,tq))??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10 transition-[border-color] duration-200 hover:border-outline-variant/25",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"System Integrity Logs"}),p.jsx("span",{className:"text-[10px] font-mono text-sage px-2 py-1 bg-sage-muted rounded",children:"LIVE"})]}),t?p.jsx("div",{className:"space-y-3",children:[1,2,3].map(a=>p.jsxs("div",{className:"flex gap-4 items-start pb-2 animate-pulse",children:[p.jsx("div",{className:"h-3 w-14 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 flex-1 rounded bg-surface-container-high/40"})]},a))}):r.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[p.jsx(Tj,{className:"h-8 w-8 text-outline/20"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"No log entries yet"})]}):p.jsx("div",{className:"space-y-3",children:r.map(a=>{const i=sq(a);return p.jsx(lq,{event:a,onClick:i?()=>n(i):void 0},a.id)})})]})}function uq(e){const{embedded_count:t,total_embeddable:n}=e.embedding;if(n===0)return"Initializing";const r=t/n;return r>=.95?"Optimal":r>=.7?"Good":"Degraded"}function cq({stats:e}){const t=uq(e);return p.jsxs("div",{className:"flex items-center justify-between px-2 py-3 border-t border-outline-variant/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"font-mono text-[10px] uppercase text-sage",children:["System Connectivity: ",t]}),p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sage animate-pulse"})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:e.vault.name}),p.jsxs("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:["v",e.daemon.version]})]})]})}function fq(){const{data:e,isLoading:t,isError:n,error:r}=Sp();return p.jsx(R1,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Connecting to daemon...",children:e&&p.jsxs("div",{className:"relative min-h-full",children:[p.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.04]",children:p.jsxs("svg",{height:"100%",width:"100%",viewBox:"0 0 800 800",preserveAspectRatio:"none",children:[p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 300 500 200 400C100 300 0 400 0 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 500 500 600 400C700 300 800 400 800 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 500 450 300 400 100",fill:"none",stroke:"#abcfb8",strokeWidth:"1"})]})}),p.jsxs("div",{className:"relative z-10 p-6 lg:p-8 max-w-7xl mx-auto space-y-10",children:[p.jsx(SF,{stats:e}),p.jsx(kF,{stats:e}),p.jsx(PF,{}),p.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsx(JF,{}),p.jsx(oq,{})]}),p.jsx(cq,{stats:e})]})]})})}const dq=Ep("rounded-md transition-colors",{variants:{level:{lowest:"bg-surface-container-lowest",low:"bg-surface-container-low",default:"bg-surface-container",high:"bg-surface-container-high",highest:"bg-surface-container-highest",bright:"bg-surface-bright"},interactive:{true:"cursor-pointer hover-lift hover:brightness-[1.08]",false:""},ghostBorder:{true:"border border-[var(--ghost-border)]",false:""},glass:{true:"backdrop-blur-xl bg-surface-variant/60",false:""},glow:{true:"shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]",false:""}},defaultVariants:{level:"low",interactive:!1,ghostBorder:!1,glass:!1,glow:!1}}),st=j.forwardRef(({className:e,level:t,interactive:n,ghostBorder:r,glass:a,glow:i,...l},o)=>p.jsx("div",{ref:o,className:Ae(dq({level:t,interactive:n,ghostBorder:r,glass:a,glow:i}),e),...l}));st.displayName="Surface";function hq({tabs:e,activeTab:t,onTabChange:n,className:r}){return p.jsx("div",{className:Ae("flex items-center gap-6",r),children:e.map(a=>p.jsx("button",{onClick:()=>n(a.id),className:Ae("pb-2 font-sans text-sm font-medium transition-colors border-b-2",t===a.id?"text-primary border-primary":"text-on-surface-variant border-transparent hover:text-on-surface"),children:a.label},a.id))})}function Gi({title:e,subtitle:t,tabs:n,activeTab:r,onTabChange:a,actions:i,className:l}){return p.jsxs("div",{className:Ae("pb-6",l),children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:e}),t&&p.jsx("p",{className:"mt-1 font-sans text-sm text-on-surface-variant",children:t})]}),i&&p.jsx("div",{className:"flex items-center gap-2",children:i})]}),n&&r&&a&&p.jsx(hq,{tabs:n,activeTab:r,onTabChange:a,className:"mt-4"})]})}function MD({open:e,onOpenChange:t,title:n,description:r,icon:a,meta:i,impact:l,confirmLabel:o="Confirm",variant:f="destructive",onConfirm:c,isPending:d=!1}){var v,m;return p.jsx(Ap,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden",children:[p.jsxs(Rp,{children:[p.jsxs("div",{className:"flex items-center gap-3",children:[a&&p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15",children:a}),p.jsx(vd,{children:n})]}),p.jsx(A1,{children:r})]}),i&&i.length>0&&p.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0",children:(v=i[0])==null?void 0:v.value}),i.length>1&&p.jsx("span",{className:"text-sm font-medium text-on-surface truncate",children:(m=i[1])==null?void 0:m.value})]}),l&&l.length>0&&p.jsx("div",{className:"grid grid-cols-2 gap-2",children:l.map(y=>p.jsxs("div",{className:"rounded-md border border-outline-variant/20 px-3 py-2",children:[p.jsx("div",{className:"font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant",children:y.label}),p.jsx("div",{className:"font-sans text-base font-medium text-on-surface",children:y.value})]},y.label))}),p.jsxs(jp,{children:[p.jsx(Ke,{variant:"secondary",size:"sm",onClick:()=>t(!1),disabled:d,children:"Cancel"}),p.jsxs(Ke,{variant:f,size:"sm",onClick:c,disabled:d,className:"gap-2",children:[d&&p.jsx(Qn,{className:"h-4 w-4 animate-spin"}),o]})]})]})})}function TT(e,[t,n]){return Math.min(n,Math.max(t,e))}function vq(e){const t=e+"CollectionProvider",[n,r]=Cp(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:S,children:b}=w,C=Bi.useRef(null),T=Bi.useRef(new Map).current;return p.jsx(a,{scope:S,itemMap:T,collectionRef:C,children:b})};l.displayName=t;const o=e+"CollectionSlot",f=Uf(o),c=Bi.forwardRef((w,S)=>{const{scope:b,children:C}=w,T=i(o,b),N=Cn(S,T.collectionRef);return p.jsx(f,{ref:N,children:C})});c.displayName=o;const d=e+"CollectionItemSlot",v="data-radix-collection-item",m=Uf(d),y=Bi.forwardRef((w,S)=>{const{scope:b,children:C,...T}=w,N=Bi.useRef(null),A=Cn(S,N),R=i(d,b);return Bi.useEffect(()=>(R.itemMap.set(N,{ref:N,...T}),()=>void R.itemMap.delete(N))),p.jsx(m,{[v]:"",ref:A,children:C})});y.displayName=d;function x(w){const S=i(e+"CollectionConsumer",w);return Bi.useCallback(()=>{const C=S.collectionRef.current;if(!C)return[];const T=Array.from(C.querySelectorAll(`[${v}]`));return Array.from(S.itemMap.values()).sort((R,D)=>T.indexOf(R.ref.current)-T.indexOf(D.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:c,ItemSlot:y},x,r]}var pq=j.createContext(void 0);function mq(e){const t=j.useContext(pq);return e||t||"ltr"}const gq=["top","right","bottom","left"],sl=Math.min,Jr=Math.max,Gv=Math.round,Jh=Math.floor,si=e=>({x:e,y:e}),yq={left:"right",right:"left",bottom:"top",top:"bottom"};function hb(e,t,n){return Jr(e,sl(t,n))}function $i(e,t){return typeof e=="function"?e(t):e}function Ki(e){return e.split("-")[0]}function sc(e){return e.split("-")[1]}function z1(e){return e==="x"?"y":"x"}function I1(e){return e==="y"?"height":"width"}function ri(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function F1(e){return z1(ri(e))}function xq(e,t,n){n===void 0&&(n=!1);const r=sc(e),a=F1(e),i=I1(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=$v(l)),[l,$v(l)]}function bq(e){const t=$v(e);return[vb(e),t,vb(t)]}function vb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kT=["left","right"],NT=["right","left"],wq=["top","bottom"],Sq=["bottom","top"];function Eq(e,t,n){switch(e){case"top":case"bottom":return n?t?NT:kT:t?kT:NT;case"left":case"right":return t?wq:Sq;default:return[]}}function Cq(e,t,n,r){const a=sc(e);let i=Eq(Ki(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(vb)))),i}function $v(e){const t=Ki(e);return yq[t]+e.slice(t.length)}function Tq(e){return{top:0,right:0,bottom:0,left:0,...e}}function OD(e){return typeof e!="number"?Tq(e):{top:e,right:e,bottom:e,left:e}}function Kv(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function AT(e,t,n){let{reference:r,floating:a}=e;const i=ri(t),l=F1(t),o=I1(l),f=Ki(t),c=i==="y",d=r.x+r.width/2-a.width/2,v=r.y+r.height/2-a.height/2,m=r[o]/2-a[o]/2;let y;switch(f){case"top":y={x:d,y:r.y-a.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:v};break;case"left":y={x:r.x-a.width,y:v};break;default:y={x:r.x,y:r.y}}switch(sc(t)){case"start":y[l]-=m*(n&&c?-1:1);break;case"end":y[l]+=m*(n&&c?-1:1);break}return y}async function kq(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:l,elements:o,strategy:f}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:v="floating",altBoundary:m=!1,padding:y=0}=$i(t,e),x=OD(y),S=o[m?v==="floating"?"reference":"floating":v],b=Kv(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(S)))==null||n?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:f})),C=v==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),N=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},A=Kv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:C,offsetParent:T,strategy:f}):C);return{top:(b.top-A.top+x.top)/N.y,bottom:(A.bottom-b.bottom+x.bottom)/N.y,left:(b.left-A.left+x.left)/N.x,right:(A.right-b.right+x.right)/N.x}}const Nq=50,Aq=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,o=l.detectOverflow?l:{...l,detectOverflow:kq},f=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:v}=AT(c,r,f),m=r,y=0;const x={};for(let w=0;w<i.length;w++){const S=i[w];if(!S)continue;const{name:b,fn:C}=S,{x:T,y:N,data:A,reset:R}=await C({x:d,y:v,initialPlacement:r,placement:m,strategy:a,middlewareData:x,rects:c,platform:o,elements:{reference:e,floating:t}});d=T??d,v=N??v,x[b]={...x[b],...A},R&&y<Nq&&(y++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(c=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:d,y:v}=AT(c,m,f)),w=-1)}return{x:d,y:v,placement:m,strategy:a,middlewareData:x}},Rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:o,middlewareData:f}=t,{element:c,padding:d=0}=$i(e,t)||{};if(c==null)return{};const v=OD(d),m={x:n,y:r},y=F1(a),x=I1(y),w=await l.getDimensions(c),S=y==="y",b=S?"top":"left",C=S?"bottom":"right",T=S?"clientHeight":"clientWidth",N=i.reference[x]+i.reference[y]-m[y]-i.floating[x],A=m[y]-i.reference[y],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let D=R?R[T]:0;(!D||!await(l.isElement==null?void 0:l.isElement(R)))&&(D=o.floating[T]||i.floating[x]);const L=N/2-A/2,_=D/2-w[x]/2-1,M=sl(v[b],_),z=sl(v[C],_),P=M,G=D-w[x]-z,I=D/2-w[x]/2+L,F=hb(P,I,G),B=!f.arrow&&sc(a)!=null&&I!==F&&i.reference[x]/2-(I<P?M:z)-w[x]/2<0,H=B?I<P?I-P:I-G:0;return{[y]:m[y]+H,data:{[y]:F,centerOffset:I-F-H,...B&&{alignmentOffset:H}},reset:B}}}),jq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:l,initialPlacement:o,platform:f,elements:c}=t,{mainAxis:d=!0,crossAxis:v=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...S}=$i(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ki(a),C=ri(o),T=Ki(o)===o,N=await(f.isRTL==null?void 0:f.isRTL(c.floating)),A=m||(T||!w?[$v(o)]:bq(o)),R=x!=="none";!m&&R&&A.push(...Cq(o,w,x,N));const D=[o,...A],L=await f.detectOverflow(t,S),_=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&_.push(L[b]),v){const I=xq(a,l,N);_.push(L[I[0]],L[I[1]])}if(M=[...M,{placement:a,overflows:_}],!_.every(I=>I<=0)){var z,P;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,F=D[I];if(F&&(!(v==="alignment"?C!==ri(F):!1)||M.every(Y=>ri(Y.placement)===C?Y.overflows[0]>0:!0)))return{data:{index:I,overflows:M},reset:{placement:F}};let B=(P=M.filter(H=>H.overflows[0]<=0).sort((H,Y)=>H.overflows[1]-Y.overflows[1])[0])==null?void 0:P.placement;if(!B)switch(y){case"bestFit":{var G;const H=(G=M.filter(Y=>{if(R){const Q=ri(Y.placement);return Q===C||Q==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(Q=>Q>0).reduce((Q,V)=>Q+V,0)]).sort((Y,Q)=>Y[1]-Q[1])[0])==null?void 0:G[0];H&&(B=H);break}case"initialPlacement":B=o;break}if(a!==B)return{reset:{placement:B}}}return{}}}};function RT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jT(e){return gq.some(t=>e[t]>=0)}const Dq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=$i(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),o=RT(l,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:jT(o)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),o=RT(l,n.floating);return{data:{escapedOffsets:o,escaped:jT(o)}}}default:return{}}}}},LD=new Set(["left","top"]);async function Mq(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=Ki(n),o=sc(n),f=ri(n)==="y",c=LD.has(l)?-1:1,d=i&&f?-1:1,v=$i(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return o&&typeof x=="number"&&(y=o==="end"?x*-1:x),f?{x:y*d,y:m*c}:{x:m*c,y:y*d}}const Oq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:o}=t,f=await Mq(t,e);return l===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:l}}}}},Lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:i}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:f={fn:b=>{let{x:C,y:T}=b;return{x:C,y:T}}},...c}=$i(e,t),d={x:n,y:r},v=await i.detectOverflow(t,c),m=ri(Ki(a)),y=z1(m);let x=d[y],w=d[m];if(l){const b=y==="y"?"top":"left",C=y==="y"?"bottom":"right",T=x+v[b],N=x-v[C];x=hb(T,x,N)}if(o){const b=m==="y"?"top":"left",C=m==="y"?"bottom":"right",T=w+v[b],N=w-v[C];w=hb(T,w,N)}const S=f.fn({...t,[y]:x,[m]:w});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[y]:l,[m]:o}}}}}},_q=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:o=0,mainAxis:f=!0,crossAxis:c=!0}=$i(e,t),d={x:n,y:r},v=ri(a),m=z1(v);let y=d[m],x=d[v];const w=$i(o,t),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const T=m==="y"?"height":"width",N=i.reference[m]-i.floating[T]+S.mainAxis,A=i.reference[m]+i.reference[T]-S.mainAxis;y<N?y=N:y>A&&(y=A)}if(c){var b,C;const T=m==="y"?"width":"height",N=LD.has(Ki(a)),A=i.reference[v]-i.floating[T]+(N&&((b=l.offset)==null?void 0:b[v])||0)+(N?0:S.crossAxis),R=i.reference[v]+i.reference[T]+(N?0:((C=l.offset)==null?void 0:C[v])||0)-(N?S.crossAxis:0);x<A?x=A:x>R&&(x=R)}return{[m]:y,[v]:x}}}},Bq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:o}=t,{apply:f=()=>{},...c}=$i(e,t),d=await l.detectOverflow(t,c),v=Ki(a),m=sc(a),y=ri(a)==="y",{width:x,height:w}=i.floating;let S,b;v==="top"||v==="bottom"?(S=v,b=m===(await(l.isRTL==null?void 0:l.isRTL(o.floating))?"start":"end")?"left":"right"):(b=v,S=m==="end"?"top":"bottom");const C=w-d.top-d.bottom,T=x-d.left-d.right,N=sl(w-d[S],C),A=sl(x-d[b],T),R=!t.middlewareData.shift;let D=N,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=C),R&&!m){const M=Jr(d.left,0),z=Jr(d.right,0),P=Jr(d.top,0),G=Jr(d.bottom,0);y?L=x-2*(M!==0||z!==0?M+z:Jr(d.left,d.right)):D=w-2*(P!==0||G!==0?P+G:Jr(d.top,d.bottom))}await f({...t,availableWidth:L,availableHeight:D});const _=await l.getDimensions(o.floating);return x!==_.width||w!==_.height?{reset:{rects:!0}}:{}}}};function Mp(){return typeof window<"u"}function lc(e){return _D(e)?(e.nodeName||"").toLowerCase():"#document"}function ea(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fi(e){var t;return(t=(_D(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _D(e){return Mp()?e instanceof Node||e instanceof ea(e).Node:!1}function Ba(e){return Mp()?e instanceof Element||e instanceof ea(e).Element:!1}function Ji(e){return Mp()?e instanceof HTMLElement||e instanceof ea(e).HTMLElement:!1}function DT(e){return!Mp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ea(e).ShadowRoot}function pd(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Pa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function Pq(e){return/^(table|td|th)$/.test(lc(e))}function Op(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zq=/transform|translate|scale|rotate|perspective|filter/,Iq=/paint|layout|strict|content/,Fl=e=>!!e&&e!=="none";let Py;function q1(e){const t=Ba(e)?Pa(e):e;return Fl(t.transform)||Fl(t.translate)||Fl(t.scale)||Fl(t.rotate)||Fl(t.perspective)||!U1()&&(Fl(t.backdropFilter)||Fl(t.filter))||zq.test(t.willChange||"")||Iq.test(t.contain||"")}function Fq(e){let t=ll(e);for(;Ji(t)&&!Yu(t);){if(q1(t))return t;if(Op(t))return null;t=ll(t)}return null}function U1(){return Py==null&&(Py=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Py}function Yu(e){return/^(html|body|#document)$/.test(lc(e))}function Pa(e){return ea(e).getComputedStyle(e)}function Lp(e){return Ba(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ll(e){if(lc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||DT(e)&&e.host||fi(e);return DT(t)?t.host:t}function BD(e){const t=ll(e);return Yu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ji(t)&&pd(t)?t:BD(t)}function Vf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=BD(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=ea(a);if(i){const o=pb(l);return t.concat(l,l.visualViewport||[],pd(a)?a:[],o&&n?Vf(o):[])}else return t.concat(a,Vf(a,[],n))}function pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PD(e){const t=Pa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ji(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,o=Gv(n)!==i||Gv(r)!==l;return o&&(n=i,r=l),{width:n,height:r,$:o}}function V1(e){return Ba(e)?e:e.contextElement}function Ru(e){const t=V1(e);if(!Ji(t))return si(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=PD(t);let l=(i?Gv(n.width):n.width)/r,o=(i?Gv(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!o||!Number.isFinite(o))&&(o=1),{x:l,y:o}}const qq=si(0);function zD(e){const t=ea(e);return!U1()||!t.visualViewport?qq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ea(e)?!1:t}function fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=V1(e);let l=si(1);t&&(r?Ba(r)&&(l=Ru(r)):l=Ru(e));const o=Uq(i,n,r)?zD(i):si(0);let f=(a.left+o.x)/l.x,c=(a.top+o.y)/l.y,d=a.width/l.x,v=a.height/l.y;if(i){const m=ea(i),y=r&&Ba(r)?ea(r):r;let x=m,w=pb(x);for(;w&&r&&y!==x;){const S=Ru(w),b=w.getBoundingClientRect(),C=Pa(w),T=b.left+(w.clientLeft+parseFloat(C.paddingLeft))*S.x,N=b.top+(w.clientTop+parseFloat(C.paddingTop))*S.y;f*=S.x,c*=S.y,d*=S.x,v*=S.y,f+=T,c+=N,x=ea(w),w=pb(x)}}return Kv({width:d,height:v,x:f,y:c})}function _p(e,t){const n=Lp(e).scrollLeft;return t?t.left+n:fo(fi(e)).left+n}function ID(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-_p(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Vq(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=fi(r),o=t?Op(t.floating):!1;if(r===l||o&&i)return n;let f={scrollLeft:0,scrollTop:0},c=si(1);const d=si(0),v=Ji(r);if((v||!v&&!i)&&((lc(r)!=="body"||pd(l))&&(f=Lp(r)),v)){const y=fo(r);c=Ru(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const m=l&&!v&&!i?ID(l,f):si(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-f.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-f.scrollTop*c.y+d.y+m.y}}function Hq(e){return Array.from(e.getClientRects())}function Gq(e){const t=fi(e),n=Lp(e),r=e.ownerDocument.body,a=Jr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Jr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+_p(e);const o=-n.scrollTop;return Pa(r).direction==="rtl"&&(l+=Jr(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:o}}const MT=25;function $q(e,t){const n=ea(e),r=fi(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,o=0,f=0;if(a){i=a.width,l=a.height;const d=U1();(!d||d&&t==="fixed")&&(o=a.offsetLeft,f=a.offsetTop)}const c=_p(r);if(c<=0){const d=r.ownerDocument,v=d.body,m=getComputedStyle(v),y=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-v.clientWidth-y);x<=MT&&(i-=x)}else c<=MT&&(i+=c);return{width:i,height:l,x:o,y:f}}function Kq(e,t){const n=fo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Ji(e)?Ru(e):si(1),l=e.clientWidth*i.x,o=e.clientHeight*i.y,f=a*i.x,c=r*i.y;return{width:l,height:o,x:f,y:c}}function OT(e,t,n){let r;if(t==="viewport")r=$q(e,n);else if(t==="document")r=Gq(fi(e));else if(Ba(t))r=Kq(t,n);else{const a=zD(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Kv(r)}function FD(e,t){const n=ll(e);return n===t||!Ba(n)||Yu(n)?!1:Pa(n).position==="fixed"||FD(n,t)}function Yq(e,t){const n=t.get(e);if(n)return n;let r=Vf(e,[],!1).filter(o=>Ba(o)&&lc(o)!=="body"),a=null;const i=Pa(e).position==="fixed";let l=i?ll(e):e;for(;Ba(l)&&!Yu(l);){const o=Pa(l),f=q1(l);!f&&o.position==="fixed"&&(a=null),(i?!f&&!a:!f&&o.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||pd(l)&&!f&&FD(e,l))?r=r.filter(d=>d!==l):a=o,l=ll(l)}return t.set(e,r),r}function Xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Op(t)?[]:Yq(t,this._c):[].concat(n),r],o=OT(t,l[0],a);let f=o.top,c=o.right,d=o.bottom,v=o.left;for(let m=1;m<l.length;m++){const y=OT(t,l[m],a);f=Jr(y.top,f),c=sl(y.right,c),d=sl(y.bottom,d),v=Jr(y.left,v)}return{width:c-v,height:d-f,x:v,y:f}}function Qq(e){const{width:t,height:n}=PD(e);return{width:t,height:n}}function Wq(e,t,n){const r=Ji(t),a=fi(t),i=n==="fixed",l=fo(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const f=si(0);function c(){f.x=_p(a)}if(r||!r&&!i)if((lc(t)!=="body"||pd(a))&&(o=Lp(t)),r){const y=fo(t,!0,i,t);f.x=y.x+t.clientLeft,f.y=y.y+t.clientTop}else a&&c();i&&!r&&a&&c();const d=a&&!r&&!i?ID(a,o):si(0),v=l.left+o.scrollLeft-f.x-d.x,m=l.top+o.scrollTop-f.y-d.y;return{x:v,y:m,width:l.width,height:l.height}}function zy(e){return Pa(e).position==="static"}function LT(e,t){if(!Ji(e)||Pa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fi(e)===n&&(n=n.ownerDocument.body),n}function qD(e,t){const n=ea(e);if(Op(e))return n;if(!Ji(e)){let a=ll(e);for(;a&&!Yu(a);){if(Ba(a)&&!zy(a))return a;a=ll(a)}return n}let r=LT(e,t);for(;r&&Pq(r)&&zy(r);)r=LT(r,t);return r&&Yu(r)&&zy(r)&&!q1(r)?n:r||Fq(e)||n}const Zq=async function(e){const t=this.getOffsetParent||qD,n=this.getDimensions,r=await n(e.floating);return{reference:Wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jq(e){return Pa(e).direction==="rtl"}const eU={convertOffsetParentRelativeRectToViewportRelativeRect:Vq,getDocumentElement:fi,getClippingRect:Xq,getOffsetParent:qD,getElementRects:Zq,getClientRects:Hq,getDimensions:Qq,getScale:Ru,isElement:Ba,isRTL:Jq};function UD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tU(e,t){let n=null,r;const a=fi(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function l(o,f){o===void 0&&(o=!1),f===void 0&&(f=1),i();const c=e.getBoundingClientRect(),{left:d,top:v,width:m,height:y}=c;if(o||t(),!m||!y)return;const x=Jh(v),w=Jh(a.clientWidth-(d+m)),S=Jh(a.clientHeight-(v+y)),b=Jh(d),T={rootMargin:-x+"px "+-w+"px "+-S+"px "+-b+"px",threshold:Jr(0,sl(1,f))||1};let N=!0;function A(R){const D=R[0].intersectionRatio;if(D!==f){if(!N)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!UD(c,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(A,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(A,T)}n.observe(e)}return l(!0),i}function nU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,c=V1(e),d=a||i?[...c?Vf(c):[],...t?Vf(t):[]]:[];d.forEach(b=>{a&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const v=c&&o?tU(c,n):null;let m=-1,y=null;l&&(y=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&y&&t&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=y)==null||T.observe(t)})),n()}),c&&!f&&y.observe(c),t&&y.observe(t));let x,w=f?fo(e):null;f&&S();function S(){const b=fo(e);w&&!UD(w,b)&&n(),w=b,x=requestAnimationFrame(S)}return n(),()=>{var b;d.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),v==null||v(),(b=y)==null||b.disconnect(),y=null,f&&cancelAnimationFrame(x)}}const rU=Oq,aU=Lq,iU=jq,sU=Bq,lU=Dq,_T=Rq,oU=_q,uU=(e,t,n)=>{const r=new Map,a={platform:eU,...n},i={...a.platform,_c:r};return Aq(e,t,{...a,platform:i})};var cU=typeof document<"u",fU=function(){},Tv=cU?j.useLayoutEffect:fU;function Yv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Yv(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Yv(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function VD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function BT(e,t){const n=VD(e);return Math.round(t*n)/n}function Iy(e){const t=j.useRef(e);return Tv(()=>{t.current=e}),t}function dU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:o=!0,whileElementsMounted:f,open:c}=e,[d,v]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=j.useState(r);Yv(m,r)||y(r);const[x,w]=j.useState(null),[S,b]=j.useState(null),C=j.useCallback(Y=>{Y!==R.current&&(R.current=Y,w(Y))},[]),T=j.useCallback(Y=>{Y!==D.current&&(D.current=Y,b(Y))},[]),N=i||x,A=l||S,R=j.useRef(null),D=j.useRef(null),L=j.useRef(d),_=f!=null,M=Iy(f),z=Iy(a),P=Iy(c),G=j.useCallback(()=>{if(!R.current||!D.current)return;const Y={placement:t,strategy:n,middleware:m};z.current&&(Y.platform=z.current),uU(R.current,D.current,Y).then(Q=>{const V={...Q,isPositioned:P.current!==!1};I.current&&!Yv(L.current,V)&&(L.current=V,fd.flushSync(()=>{v(V)}))})},[m,t,n,z,P]);Tv(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,v(Y=>({...Y,isPositioned:!1})))},[c]);const I=j.useRef(!1);Tv(()=>(I.current=!0,()=>{I.current=!1}),[]),Tv(()=>{if(N&&(R.current=N),A&&(D.current=A),N&&A){if(M.current)return M.current(N,A,G);G()}},[N,A,G,M,_]);const F=j.useMemo(()=>({reference:R,floating:D,setReference:C,setFloating:T}),[C,T]),B=j.useMemo(()=>({reference:N,floating:A}),[N,A]),H=j.useMemo(()=>{const Y={position:n,left:0,top:0};if(!B.floating)return Y;const Q=BT(B.floating,d.x),V=BT(B.floating,d.y);return o?{...Y,transform:"translate("+Q+"px, "+V+"px)",...VD(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:V}},[n,o,B.floating,d.x,d.y]);return j.useMemo(()=>({...d,update:G,refs:F,elements:B,floatingStyles:H}),[d,G,F,B,H])}const hU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_T({element:r.current,padding:a}).fn(n):{}:r?_T({element:r,padding:a}).fn(n):{}}}},vU=(e,t)=>{const n=rU(e);return{name:n.name,fn:n.fn,options:[e,t]}},pU=(e,t)=>{const n=aU(e);return{name:n.name,fn:n.fn,options:[e,t]}},mU=(e,t)=>({fn:oU(e).fn,options:[e,t]}),gU=(e,t)=>{const n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},yU=(e,t)=>{const n=sU(e);return{name:n.name,fn:n.fn,options:[e,t]}},xU=(e,t)=>{const n=lU(e);return{name:n.name,fn:n.fn,options:[e,t]}},bU=(e,t)=>{const n=hU(e);return{name:n.name,fn:n.fn,options:[e,t]}};var wU="Arrow",HD=j.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return p.jsx(Yt.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});HD.displayName=wU;var SU=HD;function EU(e){const[t,n]=j.useState(void 0);return vr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,o;if("borderBoxSize"in i){const f=i.borderBoxSize,c=Array.isArray(f)?f[0]:f;l=c.inlineSize,o=c.blockSize}else l=e.offsetWidth,o=e.offsetHeight;n({width:l,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var H1="Popper",[GD,$D]=Cp(H1),[CU,KD]=GD(H1),YD=e=>{const{__scopePopper:t,children:n}=e,[r,a]=j.useState(null);return p.jsx(CU,{scope:t,anchor:r,onAnchorChange:a,children:n})};YD.displayName=H1;var XD="PopperAnchor",QD=j.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=KD(XD,n),l=j.useRef(null),o=Cn(t,l),f=j.useRef(null);return j.useEffect(()=>{const c=f.current;f.current=(r==null?void 0:r.current)||l.current,c!==f.current&&i.onAnchorChange(f.current)}),r?null:p.jsx(Yt.div,{...a,ref:o})});QD.displayName=XD;var G1="PopperContent",[TU,kU]=GD(G1),WD=j.forwardRef((e,t)=>{var ae,we,fe,J,ne,re;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:o=0,avoidCollisions:f=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:v="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...w}=e,S=KD(G1,n),[b,C]=j.useState(null),T=Cn(t,ge=>C(ge)),[N,A]=j.useState(null),R=EU(N),D=(R==null?void 0:R.width)??0,L=(R==null?void 0:R.height)??0,_=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(c)?c:[c],P=z.length>0,G={padding:M,boundary:z.filter(AU),altBoundary:P},{refs:I,floatingStyles:F,placement:B,isPositioned:H,middlewareData:Y}=dU({strategy:"fixed",placement:_,whileElementsMounted:(...ge)=>nU(...ge,{animationFrame:y==="always"}),elements:{reference:S.anchor},middleware:[vU({mainAxis:a+L,alignmentAxis:l}),f&&pU({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?mU():void 0,...G}),f&&gU({...G}),yU({...G,apply:({elements:ge,rects:ke,availableWidth:Be,availableHeight:lt})=>{const{width:Ze,height:Qe}=ke.reference,qe=ge.floating.style;qe.setProperty("--radix-popper-available-width",`${Be}px`),qe.setProperty("--radix-popper-available-height",`${lt}px`),qe.setProperty("--radix-popper-anchor-width",`${Ze}px`),qe.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),N&&bU({element:N,padding:o}),RU({arrowWidth:D,arrowHeight:L}),m&&xU({strategy:"referenceHidden",...G})]}),[Q,V]=eM(B),q=uo(x);vr(()=>{H&&(q==null||q())},[H,q]);const X=(ae=Y.arrow)==null?void 0:ae.x,U=(we=Y.arrow)==null?void 0:we.y,te=((fe=Y.arrow)==null?void 0:fe.centerOffset)!==0,[ie,oe]=j.useState();return vr(()=>{b&&oe(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:H?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(J=Y.transformOrigin)==null?void 0:J.x,(ne=Y.transformOrigin)==null?void 0:ne.y].join(" "),...((re=Y.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(TU,{scope:n,placedSide:Q,onArrowChange:A,arrowX:X,arrowY:U,shouldHideArrow:te,children:p.jsx(Yt.div,{"data-side":Q,"data-align":V,...w,ref:T,style:{...w.style,animation:H?void 0:"none"}})})})});WD.displayName=G1;var ZD="PopperArrow",NU={top:"bottom",right:"left",bottom:"top",left:"right"},JD=j.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=kU(ZD,r),l=NU[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(SU,{...a,ref:n,style:{...a.style,display:"block"}})})});JD.displayName=ZD;function AU(e){return e!==null}var RU=e=>({name:"transformOrigin",options:e,fn(t){var S,b,C;const{placement:n,rects:r,middlewareData:a}=t,l=((S=a.arrow)==null?void 0:S.centerOffset)!==0,o=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[c,d]=eM(n),v={start:"0%",center:"50%",end:"100%"}[d],m=(((b=a.arrow)==null?void 0:b.x)??0)+o/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+f/2;let x="",w="";return c==="bottom"?(x=l?v:`${m}px`,w=`${-f}px`):c==="top"?(x=l?v:`${m}px`,w=`${r.floating.height+f}px`):c==="right"?(x=`${-f}px`,w=l?v:`${y}px`):c==="left"&&(x=`${r.floating.width+f}px`,w=l?v:`${y}px`),{data:{x,y:w}}}});function eM(e){const[t,n="center"]=e.split("-");return[t,n]}var jU=YD,DU=QD,MU=WD,OU=JD;function LU(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),_U="VisuallyHidden",BU=j.forwardRef((e,t)=>p.jsx(Yt.span,{...e,ref:t,style:{...tM,...e.style}}));BU.displayName=_U;var PU=[" ","Enter","ArrowUp","ArrowDown"],zU=[" ","Enter"],ho="Select",[Bp,Pp,IU]=vq(ho),[oc]=Cp(ho,[IU,$D]),zp=$D(),[FU,pl]=oc(ho),[qU,UU]=oc(ho),nM=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:o,onValueChange:f,dir:c,name:d,autoComplete:v,disabled:m,required:y,form:x}=e,w=zp(t),[S,b]=j.useState(null),[C,T]=j.useState(null),[N,A]=j.useState(!1),R=mq(c),[D,L]=Uv({prop:r,defaultProp:a??!1,onChange:i,caller:ho}),[_,M]=Uv({prop:l,defaultProp:o,onChange:f,caller:ho}),z=j.useRef(null),P=S?x||!!S.closest("form"):!0,[G,I]=j.useState(new Set),F=Array.from(G).map(B=>B.props.value).join(";");return p.jsx(jU,{...w,children:p.jsxs(FU,{required:y,scope:t,trigger:S,onTriggerChange:b,valueNode:C,onValueNodeChange:T,valueNodeHasChildren:N,onValueNodeHasChildrenChange:A,contentId:Nu(),value:_,onValueChange:M,open:D,onOpenChange:L,dir:R,triggerPointerDownPosRef:z,disabled:m,children:[p.jsx(Bp.Provider,{scope:t,children:p.jsx(qU,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(B=>{I(H=>new Set(H).add(B))},[]),onNativeOptionRemove:j.useCallback(B=>{I(H=>{const Y=new Set(H);return Y.delete(B),Y})},[]),children:n})}),P?p.jsxs(SM,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:v,value:_,onChange:B=>M(B.target.value),disabled:m,form:x,children:[_===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},F):null]})})};nM.displayName=ho;var rM="SelectTrigger",aM=j.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=zp(n),l=pl(rM,n),o=l.disabled||r,f=Cn(t,l.onTriggerChange),c=Pp(n),d=j.useRef("touch"),[v,m,y]=CM(w=>{const S=c().filter(T=>!T.disabled),b=S.find(T=>T.value===l.value),C=TM(S,w,b);C!==void 0&&l.onValueChange(C.value)}),x=w=>{o||(l.onOpenChange(!0),y()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return p.jsx(DU,{asChild:!0,...i,children:p.jsx(Yt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":EM(l.value)?"":void 0,...a,ref:f,onClick:Wt(a.onClick,w=>{w.currentTarget.focus(),d.current!=="mouse"&&x(w)}),onPointerDown:Wt(a.onPointerDown,w=>{d.current=w.pointerType;const S=w.target;S.hasPointerCapture(w.pointerId)&&S.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(x(w),w.preventDefault())}),onKeyDown:Wt(a.onKeyDown,w=>{const S=v.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&m(w.key),!(S&&w.key===" ")&&PU.includes(w.key)&&(x(),w.preventDefault())})})})});aM.displayName=rM;var iM="SelectValue",sM=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:l="",...o}=e,f=pl(iM,n),{onValueNodeHasChildrenChange:c}=f,d=i!==void 0,v=Cn(t,f.onValueNodeChange);return vr(()=>{c(d)},[c,d]),p.jsx(Yt.span,{...o,ref:v,style:{pointerEvents:"none"},children:EM(f.value)?p.jsx(p.Fragment,{children:l}):i})});sM.displayName=iM;var VU="SelectIcon",lM=j.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return p.jsx(Yt.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});lM.displayName=VU;var HU="SelectPortal",oM=e=>p.jsx(E1,{asChild:!0,...e});oM.displayName=HU;var vo="SelectContent",uM=j.forwardRef((e,t)=>{const n=pl(vo,e.__scopeSelect),[r,a]=j.useState();if(vr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?fd.createPortal(p.jsx(cM,{scope:e.__scopeSelect,children:p.jsx(Bp.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(fM,{...e,ref:t})});uM.displayName=vo;var ja=10,[cM,ml]=oc(vo),GU="SelectContentImpl",$U=Uf("SelectContent.RemoveScroll"),fM=j.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:l,side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S,...b}=e,C=pl(vo,n),[T,N]=j.useState(null),[A,R]=j.useState(null),D=Cn(t,ae=>N(ae)),[L,_]=j.useState(null),[M,z]=j.useState(null),P=Pp(n),[G,I]=j.useState(!1),F=j.useRef(!1);j.useEffect(()=>{if(T)return Zj(T)},[T]),Vj();const B=j.useCallback(ae=>{const[we,...fe]=P().map(re=>re.ref.current),[J]=fe.slice(-1),ne=document.activeElement;for(const re of ae)if(re===ne||(re==null||re.scrollIntoView({block:"nearest"}),re===we&&A&&(A.scrollTop=0),re===J&&A&&(A.scrollTop=A.scrollHeight),re==null||re.focus(),document.activeElement!==ne))return},[P,A]),H=j.useCallback(()=>B([L,T]),[B,L,T]);j.useEffect(()=>{G&&H()},[G,H]);const{onOpenChange:Y,triggerPointerDownPosRef:Q}=C;j.useEffect(()=>{if(T){let ae={x:0,y:0};const we=J=>{var ne,re;ae={x:Math.abs(Math.round(J.pageX)-(((ne=Q.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(J.pageY)-(((re=Q.current)==null?void 0:re.y)??0))}},fe=J=>{ae.x<=10&&ae.y<=10?J.preventDefault():T.contains(J.target)||Y(!1),document.removeEventListener("pointermove",we),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",fe,{capture:!0})}}},[T,Y,Q]),j.useEffect(()=>{const ae=()=>Y(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[Y]);const[V,q]=CM(ae=>{const we=P().filter(ne=>!ne.disabled),fe=we.find(ne=>ne.ref.current===document.activeElement),J=TM(we,ae,fe);J&&setTimeout(()=>J.ref.current.focus())}),X=j.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&(_(ae),J&&(F.current=!0))},[C.value]),U=j.useCallback(()=>T==null?void 0:T.focus(),[T]),te=j.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&z(ae)},[C.value]),ie=r==="popper"?mb:dM,oe=ie===mb?{side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S}:{};return p.jsx(cM,{scope:n,content:T,viewport:A,onViewportChange:R,itemRefCallback:X,selectedItem:L,onItemLeave:U,itemTextRefCallback:te,focusSelectedItem:H,selectedItemText:M,position:r,isPositioned:G,searchRef:V,children:p.jsx(C1,{as:$U,allowPinchZoom:!0,children:p.jsx(S1,{asChild:!0,trapped:C.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Wt(a,ae=>{var we;(we=C.trigger)==null||we.focus({preventScroll:!0}),ae.preventDefault()}),children:p.jsx(w1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:p.jsx(ie,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ae=>ae.preventDefault(),...b,...oe,onPlaced:()=>I(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Wt(b.onKeyDown,ae=>{const we=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!we&&ae.key.length===1&&q(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let J=P().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const ne=ae.target,re=J.indexOf(ne);J=J.slice(re+1)}setTimeout(()=>B(J)),ae.preventDefault()}})})})})})})});fM.displayName=GU;var KU="SelectItemAlignedPosition",dM=j.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=pl(vo,n),l=ml(vo,n),[o,f]=j.useState(null),[c,d]=j.useState(null),v=Cn(t,D=>d(D)),m=Pp(n),y=j.useRef(!1),x=j.useRef(!0),{viewport:w,selectedItem:S,selectedItemText:b,focusSelectedItem:C}=l,T=j.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&c&&w&&S&&b){const D=i.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),_=i.valueNode.getBoundingClientRect(),M=b.getBoundingClientRect();if(i.dir!=="rtl"){const ne=M.left-L.left,re=_.left-ne,ge=D.left-re,ke=D.width+ge,Be=Math.max(ke,L.width),lt=window.innerWidth-ja,Ze=TT(re,[ja,Math.max(ja,lt-Be)]);o.style.minWidth=ke+"px",o.style.left=Ze+"px"}else{const ne=L.right-M.right,re=window.innerWidth-_.right-ne,ge=window.innerWidth-D.right-re,ke=D.width+ge,Be=Math.max(ke,L.width),lt=window.innerWidth-ja,Ze=TT(re,[ja,Math.max(ja,lt-Be)]);o.style.minWidth=ke+"px",o.style.right=Ze+"px"}const z=m(),P=window.innerHeight-ja*2,G=w.scrollHeight,I=window.getComputedStyle(c),F=parseInt(I.borderTopWidth,10),B=parseInt(I.paddingTop,10),H=parseInt(I.borderBottomWidth,10),Y=parseInt(I.paddingBottom,10),Q=F+B+G+Y+H,V=Math.min(S.offsetHeight*5,Q),q=window.getComputedStyle(w),X=parseInt(q.paddingTop,10),U=parseInt(q.paddingBottom,10),te=D.top+D.height/2-ja,ie=P-te,oe=S.offsetHeight/2,ae=S.offsetTop+oe,we=F+B+ae,fe=Q-we;if(we<=te){const ne=z.length>0&&S===z[z.length-1].ref.current;o.style.bottom="0px";const re=c.clientHeight-w.offsetTop-w.offsetHeight,ge=Math.max(ie,oe+(ne?U:0)+re+H),ke=we+ge;o.style.height=ke+"px"}else{const ne=z.length>0&&S===z[0].ref.current;o.style.top="0px";const ge=Math.max(te,F+w.offsetTop+(ne?X:0)+oe)+fe;o.style.height=ge+"px",w.scrollTop=we-te+w.offsetTop}o.style.margin=`${ja}px 0`,o.style.minHeight=V+"px",o.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[m,i.trigger,i.valueNode,o,c,w,S,b,i.dir,r]);vr(()=>T(),[T]);const[N,A]=j.useState();vr(()=>{c&&A(window.getComputedStyle(c).zIndex)},[c]);const R=j.useCallback(D=>{D&&x.current===!0&&(T(),C==null||C(),x.current=!1)},[T,C]);return p.jsx(XU,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:y,onScrollButtonChange:R,children:p.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:p.jsx(Yt.div,{...a,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});dM.displayName=KU;var YU="SelectPopperPosition",mb=j.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ja,...i}=e,l=zp(n);return p.jsx(MU,{...l,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});mb.displayName=YU;var[XU,$1]=oc(vo,{}),gb="SelectViewport",hM=j.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=ml(gb,n),l=$1(gb,n),o=Cn(t,i.onViewportChange),f=j.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(Bp.Slot,{scope:n,children:p.jsx(Yt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Wt(a.onScroll,c=>{const d=c.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:m}=l;if(m!=null&&m.current&&v){const y=Math.abs(f.current-d.scrollTop);if(y>0){const x=window.innerHeight-ja*2,w=parseFloat(v.style.minHeight),S=parseFloat(v.style.height),b=Math.max(w,S);if(b<x){const C=b+y,T=Math.min(x,C),N=C-T;v.style.height=T+"px",v.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,v.style.justifyContent="flex-end")}}}f.current=d.scrollTop})})})]})});hM.displayName=gb;var vM="SelectGroup",[QU,WU]=oc(vM),ZU=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Nu();return p.jsx(QU,{scope:n,id:a,children:p.jsx(Yt.div,{role:"group","aria-labelledby":a,...r,ref:t})})});ZU.displayName=vM;var pM="SelectLabel",JU=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=WU(pM,n);return p.jsx(Yt.div,{id:a.id,...r,ref:t})});JU.displayName=pM;var Xv="SelectItem",[e8,mM]=oc(Xv),gM=j.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...l}=e,o=pl(Xv,n),f=ml(Xv,n),c=o.value===r,[d,v]=j.useState(i??""),[m,y]=j.useState(!1),x=Cn(t,C=>{var T;return(T=f.itemRefCallback)==null?void 0:T.call(f,C,r,a)}),w=Nu(),S=j.useRef("touch"),b=()=>{a||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(e8,{scope:n,value:r,disabled:a,textId:w,isSelected:c,onItemTextChange:j.useCallback(C=>{v(T=>T||((C==null?void 0:C.textContent)??"").trim())},[]),children:p.jsx(Bp.ItemSlot,{scope:n,value:r,disabled:a,textValue:d,children:p.jsx(Yt.div,{role:"option","aria-labelledby":w,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:x,onFocus:Wt(l.onFocus,()=>y(!0)),onBlur:Wt(l.onBlur,()=>y(!1)),onClick:Wt(l.onClick,()=>{S.current!=="mouse"&&b()}),onPointerUp:Wt(l.onPointerUp,()=>{S.current==="mouse"&&b()}),onPointerDown:Wt(l.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:Wt(l.onPointerMove,C=>{var T;S.current=C.pointerType,a?(T=f.onItemLeave)==null||T.call(f):S.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Wt(l.onPointerLeave,C=>{var T;C.currentTarget===document.activeElement&&((T=f.onItemLeave)==null||T.call(f))}),onKeyDown:Wt(l.onKeyDown,C=>{var N;((N=f.searchRef)==null?void 0:N.current)!==""&&C.key===" "||(zU.includes(C.key)&&b(),C.key===" "&&C.preventDefault())})})})})});gM.displayName=Xv;var Nf="SelectItemText",yM=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,l=pl(Nf,n),o=ml(Nf,n),f=mM(Nf,n),c=UU(Nf,n),[d,v]=j.useState(null),m=Cn(t,b=>v(b),f.onItemTextChange,b=>{var C;return(C=o.itemTextRefCallback)==null?void 0:C.call(o,b,f.value,f.disabled)}),y=d==null?void 0:d.textContent,x=j.useMemo(()=>p.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:S}=c;return vr(()=>(w(x),()=>S(x)),[w,S,x]),p.jsxs(p.Fragment,{children:[p.jsx(Yt.span,{id:f.textId,...i,ref:m}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?fd.createPortal(i.children,l.valueNode):null]})});yM.displayName=Nf;var xM="SelectItemIndicator",bM=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return mM(xM,n).isSelected?p.jsx(Yt.span,{"aria-hidden":!0,...r,ref:t}):null});bM.displayName=xM;var yb="SelectScrollUpButton",t8=j.forwardRef((e,t)=>{const n=ml(yb,e.__scopeSelect),r=$1(yb,e.__scopeSelect),[a,i]=j.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollTop>0;i(c)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(wM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop-f.offsetHeight)}}):null});t8.displayName=yb;var xb="SelectScrollDownButton",n8=j.forwardRef((e,t)=>{const n=ml(xb,e.__scopeSelect),r=$1(xb,e.__scopeSelect),[a,i]=j.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollHeight-f.clientHeight,d=Math.ceil(f.scrollTop)<c;i(d)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(wM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop+f.offsetHeight)}}):null});n8.displayName=xb;var wM=j.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=ml("SelectScrollButton",n),l=j.useRef(null),o=Pp(n),f=j.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return j.useEffect(()=>()=>f(),[f]),vr(()=>{var d;const c=o().find(v=>v.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),p.jsx(Yt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Wt(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Wt(a.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Wt(a.onPointerLeave,()=>{f()})})}),r8="SelectSeparator",a8=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Yt.div,{"aria-hidden":!0,...r,ref:t})});a8.displayName=r8;var bb="SelectArrow",i8=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=zp(n),i=pl(bb,n),l=ml(bb,n);return i.open&&l.position==="popper"?p.jsx(OU,{...a,...r,ref:t}):null});i8.displayName=bb;var s8="SelectBubbleInput",SM=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=j.useRef(null),i=Cn(r,a),l=LU(t);return j.useEffect(()=>{const o=a.current;if(!o)return;const f=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==t&&d){const v=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(v)}},[l,t]),p.jsx(Yt.select,{...n,style:{...tM,...n.style},ref:i,defaultValue:t})});SM.displayName=s8;function EM(e){return e===""||e===void 0}function CM(e){const t=uo(e),n=j.useRef(""),r=j.useRef(0),a=j.useCallback(l=>{const o=n.current+l;t(o),(function f(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>f(""),1e3))})(o)},[t]),i=j.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function TM(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=l8(e,Math.max(i,0));a.length===1&&(l=l.filter(c=>c!==n));const f=l.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}function l8(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var o8=nM,kM=aM,u8=sM,c8=lM,f8=oM,NM=uM,d8=hM,AM=gM,h8=yM,v8=bM;const io=o8,so=u8,tl=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(kM,{ref:r,className:Ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(c8,{asChild:!0,children:p.jsx(_a,{className:"h-4 w-4 opacity-50"})})]}));tl.displayName=kM.displayName;const nl=j.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>p.jsx(f8,{children:p.jsx(NM,{ref:a,className:Ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:p.jsx(d8,{className:Ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));nl.displayName=NM.displayName;const rl=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(AM,{ref:r,className:Ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(v8,{children:p.jsx(gp,{className:"h-4 w-4"})})}),p.jsx(h8,{children:t})]}));rl.displayName=AM.displayName;function K1({searchPlaceholder:e="Search...",searchValue:t,onSearchChange:n,filters:r=[],filterValues:a={},onFilterChange:i}){return p.jsxs(st,{level:"bright",className:"flex items-center gap-3 px-4 py-2 rounded-md",children:[p.jsx(nc,{className:"h-3.5 w-3.5 text-on-surface-variant shrink-0"}),p.jsx(fn,{placeholder:e,value:t,onChange:l=>n(l.target.value),className:"bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1","aria-label":e}),r.map(l=>p.jsx("div",{className:"w-40 shrink-0",children:p.jsxs(io,{value:a[l.key]??"all",onValueChange:o=>i==null?void 0:i(l.key,o),children:[p.jsx(tl,{children:p.jsx(so,{placeholder:l.label})}),p.jsx(nl,{children:l.options.map(o=>p.jsx(rl,{value:o.value,children:o.label},o.value))})]})},l.key))]})}function Ip({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;const i=t>0,l=t+n<e,o=t+1,f=Math.min(t+n,e);return p.jsxs("div",{className:"flex items-center justify-center gap-3 pt-1",children:[p.jsxs(Ke,{variant:"ghost",size:"sm",disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:"gap-1 text-on-surface-variant",children:[p.jsx(h1,{className:"h-4 w-4"}),"Prev"]}),p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:[o,"–",f," of ",e]}),p.jsxs(Ke,{variant:"ghost",size:"sm",disabled:!l,onClick:()=>r(t+n),className:"gap-1 text-on-surface-variant",children:["Next",p.jsx(Ea,{className:"h-4 w-4"})]})]})}const p8=ra.STATS,m8=ra.STATS,g8=ra.STATS,y8=3e4,x8=6e4,b8=1e4,w8=6e4;function S8(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.agent&&t.set("agent",e.agent),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/sessions?${n}`:"/sessions";return Fa({queryKey:["sessions",e],queryFn:({signal:a})=>bt(r,{signal:a}),pollCategory:"standard",refetchInterval:p8})}function E8(e){return Fa({queryKey:["session",e],queryFn:({signal:t})=>bt(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:m8})}function C8(e){return Fa({queryKey:["session-batches",e],queryFn:({signal:t})=>bt(`/sessions/${e}/batches`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:g8})}function T8(e){return Tn({queryKey:["batch-activities",e],queryFn:({signal:t})=>bt(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:y8})}function k8(e){return Tn({queryKey:["session-attachments",e],queryFn:({signal:t})=>bt(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:x8})}function RM(){const e=Ca();return vl({mutationFn:t=>Aj(`/sessions/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]})}})}function jM(e){return Tn({queryKey:["session-impact",e],queryFn:({signal:t})=>bt(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:b8})}function DM(e){return Tn({queryKey:["session-plans",e],queryFn:({signal:t})=>bt(`/sessions/${e}/plans`,{signal:t}),enabled:!!e,staleTime:w8})}const N8=300;function A8(e,t=N8){const[n,r]=j.useState(e);return j.useEffect(()=>{const a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}const Tr="all";function Y1({initialFilters:e}){const[t,n]=j.useState(""),r=A8(t),[a,i]=j.useState(e),[l,o]=j.useState(0),f=j.useCallback((v,m)=>{i(y=>({...y,[v]:m})),o(0)},[]),c=j.useCallback(v=>{n(v),o(0)},[]),d=j.useCallback(v=>{const m=a[v];return m&&m!==Tr?m:void 0},[a]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:a,offset:l,setOffset:o,handleSearchChange:c,handleFilterChange:f,activeFilter:d}}function MM(e){return e==="active"?"active":e==="completed"?"completed":"error"}const R8={active:"bg-primary",completed:"bg-secondary",error:"bg-tertiary"},j8={active:"bg-primary/15 text-primary",completed:"bg-surface-container-high text-on-surface-variant",error:"bg-tertiary/15 text-tertiary"};function D8({status:e}){const t=MM(e);return p.jsx("span",{className:Ae("inline-block h-2 w-2 rounded-full shrink-0",R8[t])})}function OM({status:e}){const t=MM(e),n=e.charAt(0).toUpperCase()+e.slice(1);return p.jsxs("span",{className:Ae("inline-flex items-center gap-1.5 rounded-sm px-2 py-0.5 font-sans text-xs font-medium",j8[t]),children:[p.jsx(D8,{status:e}),n]})}const M8=5,wb=8,O8=12,L8=[{key:"status",label:"Status",options:[{value:Tr,label:"All statuses"},{value:"active",label:"Active"},{value:"completed",label:"Completed"}]},{key:"agent",label:"Agent",options:[{value:Tr,label:"All agents"},{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"}]}];function _8({session:e,onClick:t,onDelete:n}){const r=e.title||e.id.slice(0,wb);return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Session: ${r}`,children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.id.slice(0,O8)})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate block max-w-xs",children:r})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ln,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:e.agent||"unknown"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(OM,{status:e.status})}),p.jsx("td",{className:"px-4 py-3 text-center",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.prompt_count})}),p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.date}),p.jsx("button",{onClick:a=>{a.stopPropagation(),n()},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.stopPropagation()},className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-tertiary/10 hover:text-tertiary transition-all shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tertiary/40","aria-label":`Delete session ${r}`,title:"Delete session",children:p.jsx(qf,{className:"h-3.5 w-3.5"})})]})})]})}function B8(){return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)]",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-40 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high animate-pulse mx-auto"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})})]})}function uu({children:e,className:t}){return p.jsx("th",{className:Ae("px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function P8(){const e=Wi(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=Y1({initialFilters:{status:Tr,agent:Tr}}),[c,d]=j.useState(null),v=RM(),{data:m}=jM((c==null?void 0:c.id)??null),y=f("status"),x=f("agent"),{data:w,isLoading:S,isError:b,error:C}=S8({limit:ni,offset:a,status:y,agent:x,search:n});function T(){c&&v.mutate(c.id,{onSuccess:()=>d(null)})}const N=(w==null?void 0:w.sessions)??[],A=(w==null?void 0:w.total)??0,R=p.jsx(K1,{searchPlaceholder:"Search sessions...",searchValue:t,onSearchChange:l,filters:L8,filterValues:r,onFilterChange:o}),D=p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] bg-surface-container/50",children:[p.jsx(uu,{children:"Session ID"}),p.jsx(uu,{children:"Title"}),p.jsx(uu,{children:"Agent"}),p.jsx(uu,{children:"Status"}),p.jsx(uu,{className:"text-center",children:"Turns"}),p.jsx(uu,{children:"Date"})]})});return b?p.jsxs("div",{children:[p.jsx(Gi,{title:"Session Archive"}),R,p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4",children:[p.jsx(Zi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load sessions"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:C instanceof Error?C.message:"Unknown error"})]})]}):p.jsxs("div",{children:[p.jsx(Gi,{title:"Session Archive",subtitle:S?"Loading...":`${A} session${A!==1?"s":""} captured`}),R,S?p.jsx(st,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full",children:[D,p.jsx("tbody",{children:Array.from({length:M8}).map((L,_)=>p.jsx(B8,{},_))})]})}):N.length===0?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4",children:[p.jsx(xp,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:A===0&&!n&&!y&&!x?"No sessions yet":"No matching sessions"}),A===0&&!n&&!y&&!x&&p.jsx("span",{className:"font-sans text-xs",children:"Sessions appear here as you work with your agent"})]}):p.jsx(st,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full","aria-label":"Session archive",children:[D,p.jsx("tbody",{children:N.map(L=>p.jsx(_8,{session:L,onClick:()=>e(`/sessions/${L.id}`),onDelete:()=>d(L)},L.id))})]})}),p.jsx(Ip,{total:A,offset:a,limit:ni,onPageChange:i}),p.jsx(MD,{open:c!==null,onOpenChange:L=>{L||d(null)},title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:p.jsx(qf,{className:"h-4 w-4 text-tertiary"}),meta:c?[{label:"ID",value:c.id.slice(0,wb)},{label:"Title",value:c.title||c.id.slice(0,wb)}]:[],impact:m?[{label:"Prompts",value:m.promptCount},{label:"Spores",value:m.sporeCount},{label:"Attachments",value:m.attachmentCount},{label:"Graph Edges",value:m.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:T,isPending:v.isPending})]})}function Zt({children:e,className:t}){return p.jsx("div",{className:Ae("font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}const z8=3e5;function I8(){return Tn({queryKey:["symbionts"],queryFn:({signal:e})=>bt("/symbionts",{signal:e}),staleTime:z8})}function F8(e,t,n){const r=e.find(a=>a.name===t);return r?`${r.binary} --resume ${n}`:null}function q8(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,V8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H8={};function PT(e,t){return(H8.jsx?V8:U8).test(e)}const G8=/[ \t\n\f\r]/g;function $8(e){return typeof e=="object"?e.type==="text"?zT(e.value):!1:zT(e)}function zT(e){return e.replace(G8,"")===""}class md{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}md.prototype.normal={};md.prototype.property={};md.prototype.space=void 0;function LM(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new md(n,r,t)}function Sb(e){return e.toLowerCase()}class Ur{constructor(t,n){this.attribute=n,this.property=t}}Ur.prototype.attribute="";Ur.prototype.booleanish=!1;Ur.prototype.boolean=!1;Ur.prototype.commaOrSpaceSeparated=!1;Ur.prototype.commaSeparated=!1;Ur.prototype.defined=!1;Ur.prototype.mustUseProperty=!1;Ur.prototype.number=!1;Ur.prototype.overloadedBoolean=!1;Ur.prototype.property="";Ur.prototype.spaceSeparated=!1;Ur.prototype.space=void 0;let K8=0;const gt=So(),Dn=So(),Eb=So(),Ne=So(),Qt=So(),ju=So(),Wr=So();function So(){return 2**++K8}const Cb=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Dn,commaOrSpaceSeparated:Wr,commaSeparated:ju,number:Ne,overloadedBoolean:Eb,spaceSeparated:Qt},Symbol.toStringTag,{value:"Module"})),Fy=Object.keys(Cb);class X1 extends Ur{constructor(t,n,r,a){let i=-1;if(super(t,n),IT(this,"space",a),typeof r=="number")for(;++i<Fy.length;){const l=Fy[i];IT(this,Fy[i],(r&Cb[l])===Cb[l])}}}X1.prototype.defined=!0;function IT(e,t,n){n&&(e[t]=n)}function uc(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new X1(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Sb(r)]=r,n[Sb(i.attribute)]=r}return new md(t,n,e.space)}const _M=uc({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:Ne,ariaColIndex:Ne,ariaColSpan:Ne,ariaControls:Qt,ariaCurrent:null,ariaDescribedBy:Qt,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:Qt,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:Qt,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qt,ariaLevel:Ne,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:Qt,ariaPlaceholder:null,ariaPosInSet:Ne,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:Qt,ariaRowCount:Ne,ariaRowIndex:Ne,ariaRowSpan:Ne,ariaSelected:Dn,ariaSetSize:Ne,ariaSort:null,ariaValueMax:Ne,ariaValueMin:Ne,ariaValueNow:Ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function BM(e,t){return t in e?e[t]:t}function PM(e,t){return BM(e,t.toLowerCase())}const Y8=uc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ju,acceptCharset:Qt,accessKey:Qt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Qt,autoFocus:gt,autoPlay:gt,blocking:Qt,capture:null,charSet:null,checked:gt,cite:null,className:Qt,cols:Ne,colSpan:null,content:null,contentEditable:Dn,controls:gt,controlsList:Qt,coords:Ne|ju,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:Eb,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Qt,height:Ne,hidden:Eb,high:Ne,href:null,hrefLang:null,htmlFor:Qt,httpEquiv:Qt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Qt,itemRef:Qt,itemScope:gt,itemType:Qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Ne,manifest:null,max:null,maxLength:Ne,media:null,method:null,min:null,minLength:Ne,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:Ne,pattern:null,ping:Qt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Qt,required:gt,reversed:gt,rows:Ne,rowSpan:Ne,sandbox:Qt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Ne,sizes:null,slot:null,span:Ne,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ne,step:null,style:null,tabIndex:Ne,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Dn,width:Ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qt,axis:null,background:null,bgColor:null,border:Ne,borderColor:null,bottomMargin:Ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ne,leftMargin:Ne,link:null,longDesc:null,lowSrc:null,marginHeight:Ne,marginWidth:Ne,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ne,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:Ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Ne,security:null,unselectable:null},space:"html",transform:PM}),X8=uc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wr,accentHeight:Ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ne,amplitude:Ne,arabicForm:null,ascent:Ne,attributeName:null,attributeType:null,azimuth:Ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ne,by:null,calcMode:null,capHeight:Ne,className:Qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ne,diffuseConstant:Ne,direction:null,display:null,dur:null,divisor:Ne,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ne,enableBackground:null,end:null,event:null,exponent:Ne,externalResourcesRequired:null,fill:null,fillOpacity:Ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ju,g2:ju,glyphName:ju,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ne,horizOriginX:Ne,horizOriginY:Ne,id:null,ideographic:Ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ne,k:Ne,k1:Ne,k2:Ne,k3:Ne,k4:Ne,kernelMatrix:Wr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ne,overlineThickness:Ne,paintOrder:null,panose1:null,path:null,pathLength:Ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ne,pointsAtY:Ne,pointsAtZ:Ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wr,rev:Wr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wr,requiredFeatures:Wr,requiredFonts:Wr,requiredFormats:Wr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ne,specularExponent:Ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ne,strikethroughThickness:Ne,string:null,stroke:null,strokeDashArray:Wr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ne,strokeOpacity:Ne,strokeWidth:null,style:null,surfaceScale:Ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wr,tabIndex:Ne,tableValues:null,target:null,targetX:Ne,targetY:Ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ne,underlineThickness:Ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ne,values:null,vAlphabetic:Ne,vMathematical:Ne,vectorEffect:null,vHanging:Ne,vIdeographic:Ne,version:null,vertAdvY:Ne,vertOriginX:Ne,vertOriginY:Ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:BM}),zM=uc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),IM=uc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:PM}),FM=uc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Q8={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},W8=/[A-Z]/g,FT=/-[a-z]/g,Z8=/^data[-\w.:]+$/i;function J8(e,t){const n=Sb(t);let r=t,a=Ur;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Z8.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(FT,tV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!FT.test(i)){let l=i.replace(W8,eV);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=X1}return new a(r,t)}function eV(e){return"-"+e.toLowerCase()}function tV(e){return e.charAt(1).toUpperCase()}const nV=LM([_M,Y8,zM,IM,FM],"html"),Q1=LM([_M,X8,zM,IM,FM],"svg");function rV(e){return e.join(" ").trim()}var cu={},qy,qT;function aV(){if(qT)return qy;qT=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
429
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},M6="DialogDescriptionWarning",O6=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hD(M6).contentName}}.`;return j.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},L6=eD,_6=rD,vD=aD,pD=iD,mD=lD,gD=uD,B6=fD;const Ap=L6,P6=_6,yD=j.forwardRef(({className:e,...t},n)=>p.jsx(vD,{ref:n,className:Ae("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));yD.displayName=vD.displayName;const hd=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(P6,{children:[p.jsx(yD,{}),p.jsxs(pD,{ref:r,className:Ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg",e),...n,children:[t,p.jsxs(B6,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(rc,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));hd.displayName=pD.displayName;function Rp({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}Rp.displayName="DialogHeader";function jp({className:e,...t}){return p.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}jp.displayName="DialogFooter";const vd=j.forwardRef(({className:e,...t},n)=>p.jsx(mD,{ref:n,className:Ae("text-lg font-serif font-semibold leading-none tracking-tight",e),...t}));vd.displayName=mD.displayName;const A1=j.forwardRef(({className:e,...t},n)=>p.jsx(gD,{ref:n,className:Ae("text-sm text-on-surface-variant",e),...t}));A1.displayName=gD.displayName;const fn=j.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:Ae("flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface","placeholder:text-on-surface-variant/50","focus-visible:outline-none focus-visible:border-primary/40","disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));fn.displayName="Input";var xD="Toggle",bD=j.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:a,...i}=e,[l,o]=Uv({prop:n,onChange:a,defaultProp:r??!1,caller:xD});return p.jsx(Yt.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Wt(e.onClick,()=>{e.disabled||o(!l)})})});bD.displayName=xD;var wD=bD;const z6=Ep("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary",{variants:{variant:{default:"bg-surface-container-high text-on-surface-variant",outline:"border border-input bg-surface-container-high text-on-surface-variant shadow-sm hover:bg-surface-container-high/80 hover:text-on-surface-variant"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),cb=j.forwardRef(({className:e,variant:t,size:n,...r},a)=>p.jsx(wD,{ref:a,className:Ae(z6({variant:t,size:n,className:e})),...r}));cb.displayName=wD.displayName;const I6=Ep("inline-flex items-center rounded-sm px-2 py-0.5 font-sans text-xs font-medium transition-colors",{variants:{variant:{default:"bg-primary/15 text-primary",secondary:"bg-surface-container-high text-on-surface-variant",destructive:"bg-tertiary/15 text-tertiary",warning:"bg-secondary/15 text-secondary",outline:"border border-[var(--ghost-border)] text-on-surface-variant"}},defaultVariants:{variant:"default"}});function Ln({className:e,variant:t,...n}){return p.jsx("div",{className:Ae(I6({variant:t}),e),...n})}const F6=120,q6={session:{label:"Sessions",icon:xp},spore:{label:"Spores",icon:kj},plan:{label:"Plans",icon:qP},prompt_batch:{label:"Prompt Batches",icon:rb},activity:{label:"Activities",icon:rb}};function SD(e){return q6[e]??{label:e,icon:KP}}function U6(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function V6({score:e}){const t=Math.round(e*100);return p.jsxs(Ln,{variant:"outline",className:"shrink-0 text-xs tabular-nums text-on-surface-variant",children:[t,"%"]})}function H6({result:e,onSelect:t,isHighlighted:n}){const{icon:r}=SD(e.type);return p.jsxs("button",{type:"button",onClick:()=>t(e),className:["w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors",n?"bg-surface-container-high text-on-surface":"hover:bg-surface-container-high hover:text-on-surface"].join(" "),children:[p.jsx(r,{className:"h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("span",{className:"text-sm font-medium truncate",children:e.title})}),e.preview&&p.jsx("p",{className:"text-xs text-on-surface-variant mt-0.5 line-clamp-2",children:U6(e.preview,F6)})]}),p.jsx(V6,{score:e.score})]})}function G6({results:e,onSelect:t,highlightedIndex:n}){const r=e.reduce((i,l)=>{const o=l.type??"unknown";return(i[o]??(i[o]=[])).push(l),i},{});let a=0;return p.jsx("div",{className:"py-2 space-y-1",children:Object.entries(r).map(([i,l])=>{const{label:o}=SD(i),f=a;return a+=l.length,p.jsxs("div",{children:[p.jsx("div",{className:"px-3 py-1",children:p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-on-surface-variant",children:o})}),l.map((c,d)=>p.jsx(H6,{result:c,onSelect:t,isHighlighted:n===f+d},c.id))]},i)})})}const $6=2,K6=3e4;function Y6(e,t="semantic"){return Tn({queryKey:["search",e,t],queryFn:({signal:n})=>bt(`/search?q=${encodeURIComponent(e)}&mode=${t}`,{signal:n}),enabled:e.length>$6,staleTime:K6})}const X6=300,Q6=20;function W6(e){switch(e.type){case"session":return`/sessions/${e.id}`;case"spore":return`/mycelium?spore=${encodeURIComponent(e.id)}`;case"plan":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"prompt_batch":return e.session_id?`/sessions/${e.session_id}`:"/sessions";case"activity":return e.session_id?`/sessions/${e.session_id}`:"/sessions";default:return"/"}}function Z6({open:e,onOpenChange:t}){const n=Wi(),[r,a]=j.useState(""),[i,l]=j.useState(""),[o,f]=j.useState("semantic"),[c,d]=j.useState(0),v=j.useRef(null);j.useEffect(()=>{const T=setTimeout(()=>{l(r.trim())},X6);return()=>clearTimeout(T)},[r]),j.useEffect(()=>{e&&(a(""),l(""),d(0),setTimeout(()=>{var T;return(T=v.current)==null?void 0:T.focus()},50))},[e]);const{data:m,isLoading:y}=Y6(i,o),x=((m==null?void 0:m.results)??[]).slice(0,Q6);j.useEffect(()=>{d(0)},[x.length,i]);const w=j.useCallback(T=>{const N=W6(T);t(!1),n(N)},[n,t]),S=j.useCallback(T=>{if(x.length!==0){if(T.key==="ArrowDown")T.preventDefault(),d(N=>Math.min(N+1,x.length-1));else if(T.key==="ArrowUp")T.preventDefault(),d(N=>Math.max(N-1,0));else if(T.key==="Enter"){T.preventDefault();const N=x[c];N&&w(N)}}},[x,c,w]),b=i.length>2&&!y&&x.length===0,C=i.length<=2&&!y;return p.jsx(Ap,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"max-w-2xl p-0 gap-0 overflow-hidden",onKeyDown:S,children:[p.jsx(vd,{className:"sr-only",children:"Search vault"}),p.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3",children:[p.jsx(nc,{className:"h-4 w-4 shrink-0 text-on-surface-variant"}),p.jsx(fn,{ref:v,value:r,onChange:T=>a(T.target.value),placeholder:"Search sessions, spores, plans…",className:"border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono"}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p.jsx(cb,{size:"sm",pressed:o==="semantic",onPressedChange:()=>f("semantic"),"aria-label":"Semantic search",title:"Semantic (embedded knowledge)",children:"Semantic"}),p.jsx(cb,{size:"sm",pressed:o==="fts",onPressedChange:()=>f("fts"),"aria-label":"Full-text search",title:"Full text (raw data)",children:"Full Text"})]})]}),p.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[y&&i.length>2&&p.jsx("div",{className:"px-4 py-8 text-center",children:p.jsxs("div",{className:"flex flex-col items-center gap-2 text-on-surface-variant",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-24 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-28 rounded bg-muted animate-pulse"})]})}),C&&p.jsx("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:"Type to search your vault…"}),b&&p.jsxs("div",{className:"px-4 py-8 text-center text-sm text-on-surface-variant",children:["No results for ",p.jsxs("span",{className:"font-medium text-on-surface",children:['"',i,'"']})]}),x.length>0&&!y&&p.jsx(G6,{results:x,onSelect:w,highlightedIndex:c})]}),p.jsxs("div",{className:"border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant",children:[p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↑↓"})," navigate"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"↵"})," open"]}),p.jsxs("span",{children:[p.jsx("kbd",{className:"font-mono",children:"Esc"})," close"]}),p.jsx("span",{className:"ml-auto",children:(m==null?void 0:m.mode)&&x.length>0&&`${x.length} result${x.length!==1?"s":""} · ${m.mode}`})]})]})})}const J6=[{to:"/",label:"Dashboard",icon:JP},{to:"/sessions",label:"Sessions",icon:xp},{to:"/mycelium",label:"Mycelium",icon:rz},{to:"/agent",label:"Agent",icon:dd},{to:"/settings",label:"Settings",icon:oz},{to:"/operations",label:"Operations",icon:mz},{to:"/team",label:"Team",icon:vz},{to:"/logs",label:"Logs",icon:Tj}],eF=[{value:"default",label:"Default"},{value:"geist-mono",label:"Geist Mono"},{value:"system",label:"System"},{value:"sf-mono",label:"SF Mono"},{value:"fira-code",label:"Fira Code"},{value:"jetbrains-mono",label:"JetBrains"}],ED={compact:.85,normal:1,comfy:1.15},tF={compact:"Compact",normal:"Normal",comfy:"Comfy"},df=["compact","normal","comfy"],yT="myco-ui-sidebar-collapsed",xT=768,CD="myco-ui-density",nF="--density",rF="normal";function aF(){const e=localStorage.getItem(CD);return e&&e in ED?e:rF}function iF(e){const t=ED[e];document.documentElement.style.setProperty(nF,String(t)),document.documentElement.style.fontSize=`calc(14px * ${t})`}function sF(){const[e,t]=j.useState(aF),n=j.useCallback(r=>{localStorage.setItem(CD,r),t(r)},[]);return j.useEffect(()=>{iF(e)},[e]),{density:e,setDensity:n}}function lF(){const[e,t]=j.useState(()=>localStorage.getItem(yT)==="true"),n=j.useCallback(()=>{t(r=>{const a=!r;return localStorage.setItem(yT,String(a)),a})},[]);return{collapsed:e,toggle:n}}function oF(){const[e,t]=j.useState(!1),[n,r]=j.useState(()=>typeof window<"u"&&window.innerWidth<xT);j.useEffect(()=>{const o=window.matchMedia(`(max-width: ${xT-1}px)`),f=c=>{r(c.matches),c.matches||t(!1)};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=Qi();j.useEffect(()=>{t(!1)},[a.pathname]),j.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]);const i=j.useCallback(()=>t(o=>!o),[]),l=j.useCallback(()=>t(!1),[]);return{open:e,isMobile:n,toggle:i,close:l}}const By=["light","dark","system"],uF={light:fz,dark:nz,system:Ej},cF={light:"Light",dark:"Dark",system:"System"};function fF({collapsed:e=!1}){const{theme:t,setTheme:n}=TP(),r=()=>{const l=By.indexOf(t),o=By[(l+1)%By.length];n(o)},a=uF[t]??Ej,i=cF[t]??"System";return p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:r,title:e?`${i} mode`:void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(a,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:i})]})}function dF({collapsed:e=!1}){const{restart:t,isRestarting:n}=x1();return p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>t(),disabled:n,title:e?n?"Restarting...":"Restart Daemon":void 0,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),children:[p.jsx(m1,{className:Ae("h-4 w-4",n&&"animate-spin")}),!e&&p.jsx("span",{children:n?"Restarting...":"Restart Daemon"})]})}function hF(){const{font:e,setFont:t}=DP();return p.jsxs("label",{className:"flex items-center gap-2 px-2 py-1 text-sm text-on-surface-variant hover:text-on-surface cursor-pointer",children:[p.jsx(dz,{className:"h-4 w-4 shrink-0"}),p.jsx("select",{value:e,onChange:n=>t(n.target.value),className:"w-full bg-transparent border-none outline-none cursor-pointer text-sm appearance-none",children:eF.map(n=>p.jsx("option",{value:n.value,children:n.label},n.value))})]})}function vF({density:e,setDensity:t}){const n=df.indexOf(e),r=()=>{const i=df[n-1];n>0&&i!==void 0&&t(i)},a=()=>{const i=df[n+1];n<df.length-1&&i!==void 0&&t(i)};return p.jsxs("div",{className:"flex items-center gap-1 px-3 py-1",children:[p.jsx("button",{onClick:r,disabled:n===0,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Decrease density",children:p.jsx(tz,{className:"h-3 w-3"})}),p.jsx("div",{className:"flex flex-1 justify-center",children:p.jsx("span",{className:"text-xs text-on-surface-variant select-none",children:tF[e]})}),p.jsx("button",{onClick:a,disabled:n===df.length-1,className:"rounded p-0.5 text-on-surface-variant hover:text-on-surface disabled:opacity-30","aria-label":"Increase density",children:p.jsx(iz,{className:"h-3 w-3"})})]})}function bT({collapsed:e,vaultName:t,density:n,setDensity:r,onSearchOpen:a,onCollapseToggle:i,showCollapseToggle:l}){return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Ae("px-4 py-5",e&&"px-2 py-4 flex justify-center"),children:e?p.jsxs("div",{className:"relative flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary",children:"m"}),p.jsx("span",{className:"ml-1 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}):p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),p.jsx("span",{className:"ml-2 h-2 w-2 rounded-full bg-on-surface-variant/40"})]}),t&&p.jsx("span",{className:"font-mono text-xs text-outline uppercase tracking-widest mt-0.5",children:t})]})}),p.jsx("div",{className:"px-2 pt-2 pb-1",children:p.jsxs("button",{type:"button",onClick:a,title:e?"Search (⌘K)":void 0,className:Ae("flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface",e?"justify-center px-2 py-2":"gap-3 px-3 py-2"),children:[p.jsx(nc,{className:"h-4 w-4 shrink-0"}),!e&&p.jsx("span",{className:"flex-1 text-left",children:"Search"}),!e&&p.jsxs("kbd",{className:"text-xs text-on-surface-variant/60 font-mono",children:["⌘","K"]})]})}),p.jsx("nav",{className:"flex-1 space-y-1 px-2 py-2","aria-label":"Main navigation",children:J6.map(o=>p.jsxs(cj,{to:o.to,end:o.to==="/",title:e?o.label:void 0,className:({isActive:f})=>Ae("flex items-center rounded-md text-sm font-medium transition-colors",e?"justify-center px-2 py-2":"gap-3 px-3 py-2",f?"bg-primary/10 text-primary":"text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface"),children:[p.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),!e&&o.label]},o.to))}),p.jsxs("div",{className:Ae("py-3 space-y-1 mt-auto",e?"px-1 flex flex-col items-center":"px-2"),children:[p.jsx(dF,{collapsed:e}),!e&&p.jsx(hF,{}),!e&&p.jsx(vF,{density:n,setDensity:r}),p.jsx(fF,{collapsed:e})]}),l&&i&&p.jsx("div",{className:Ae("px-2 py-2",e&&"flex justify-center"),children:p.jsxs(Ke,{variant:"ghost",size:"sm",onClick:i,className:Ae("text-on-surface-variant hover:text-on-surface",e?"w-8 p-0 justify-center":"w-full justify-start gap-2"),title:e?"Expand sidebar":"Collapse sidebar",children:[e?p.jsx(Ea,{className:"h-4 w-4"}):p.jsx(h1,{className:"h-4 w-4"}),!e&&p.jsx("span",{children:"Collapse"})]})})]})}function pF(){const{collapsed:e,toggle:t}=lF(),{density:n,setDensity:r}=sF(),{data:a}=Sp(),i=a==null?void 0:a.vault.name,[l,o]=j.useState(!1),f=oF();j.useEffect(()=>{const d=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),o(m=>!m))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),j.useEffect(()=>{if(!f.open)return;const d=v=>{v.key==="Escape"&&(v.preventDefault(),f.close())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[f.open,f.close]);const c=j.useCallback(()=>o(!0),[]);return p.jsxs("div",{className:"flex h-screen bg-background",children:[p.jsx(Z6,{open:l,onOpenChange:o}),f.isMobile&&p.jsxs("div",{className:"fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3",children:[p.jsx("button",{type:"button",onClick:f.toggle,className:"rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":f.open?"Close navigation":"Open navigation",children:f.open?p.jsx(rc,{className:"h-5 w-5"}):p.jsx(ez,{className:"h-5 w-5"})}),p.jsx("span",{className:"font-serif text-base text-primary tracking-wider",children:"myco"}),i&&p.jsx("span",{className:"font-mono text-[10px] text-outline uppercase tracking-widest",children:i}),p.jsx("button",{type:"button",onClick:c,className:"ml-auto rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface","aria-label":"Search",children:p.jsx(nc,{className:"h-4 w-4"})})]}),f.isMobile&&f.open&&p.jsx("div",{className:"fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-sm transition-opacity",onClick:f.close,"aria-hidden":"true"}),f.isMobile&&p.jsx("aside",{className:Ae("fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out",f.open?"translate-x-0":"-translate-x-full"),children:p.jsx(bT,{collapsed:!1,vaultName:i,density:n,setDensity:r,onSearchOpen:c,showCollapseToggle:!1})}),!f.isMobile&&p.jsx("aside",{className:Ae("flex flex-col bg-surface-container transition-[width] duration-200",e?"w-14":"w-56"),children:p.jsx(bT,{collapsed:e,vaultName:i,density:n,setDensity:r,onSearchOpen:c,onCollapseToggle:t,showCollapseToggle:!0})}),p.jsx("main",{className:Ae("flex-1 overflow-auto bg-surface",f.isMobile&&"pt-12"),"aria-label":"Page content",children:p.jsx(FB,{})})]})}function R1({isLoading:e,error:t,loadingText:n="Loading...",children:r}){return e?p.jsxs("div",{className:"flex h-64 items-center justify-center gap-2 text-on-surface-variant",children:[p.jsx(Qn,{className:"h-5 w-5 animate-spin"}),p.jsx("span",{className:"font-sans text-sm",children:n})]}):t?p.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-2 text-tertiary",children:[p.jsx(Zi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to connect to daemon"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:t.message})]}):p.jsx(p.Fragment,{children:r})}const el=60,Su=3600,Df=86400,xa=1e3;function j1(e){if(e<el)return`${Math.floor(e)}s`;if(e<Su)return`${Math.floor(e/el)}m`;if(e<Df){const r=Math.floor(e/Su),a=Math.floor(e%Su/el);return`${r}h ${a}m`}const t=Math.floor(e/Df),n=Math.floor(e%Df/Su);return`${t}d ${n}h`}function D1(e){const t=(Date.now()-new Date(e).getTime())/xa;return t<el?"just now":t<Su?`${Math.floor(t/el)}m ago`:t<Df?`${Math.floor(t/Su)}h ago`:`${Math.floor(t/Df)}d ago`}function oi(e){return D1(new Date(e*xa).toISOString())}function fb(e){return new Date(e*xa).toLocaleString()}function db(e,t){return e?e.length>t?e.slice(0,t)+"…":e:""}function M1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dp(e,t){if(e===null||t===null)return"—";const n=(t-e)*xa;if(n<xa)return`${n}ms`;if(n<el*xa)return`${(n/xa).toFixed(1)}s`;const r=Math.floor(n/(el*xa)),a=Math.floor(n%(el*xa)/xa);return`${r}m ${a}s`}function mF(e){return e===null?"—":e<xa?`${e}ms`:`${(e/xa).toFixed(1)}s`}function Hv(e,t){if(e.trim()==="")return t;const n=Number(e);return Number.isFinite(n)?n:t}function TD(e){return e!==null?oi(e):"—"}const wT=100,gF=1;function yF(e){const{embedded_count:t,total_embeddable:n}=e.embedding;return n===0?wT:Number((t/n*wT).toFixed(gF))}function xF(e){const t=e.agent.last_run_status==="error",n=e.embedding.queue_depth>0||e.unprocessed_batches>0;return t?"Issues detected in the network":n?"Work in progress across the network":"Network Topology Active"}function bF(e){return e.embedding.queue_depth>0||e.unprocessed_batches>0}function wF({active:e}){const t=e?"animate-pulse-slow":"";return p.jsxs("svg",{className:"absolute inset-0 w-full h-full opacity-20 pointer-events-none",viewBox:"0 0 400 300",preserveAspectRatio:"xMidYMid slice",children:[p.jsx("path",{d:"M200,280 Q200,220 200,160",fill:"none",stroke:"var(--primary)",strokeWidth:"2",className:t}),p.jsx("path",{d:"M200,200 Q240,170 280,180",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,170 Q160,140 120,155",fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",className:t}),p.jsx("path",{d:"M200,160 Q230,110 270,90",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M200,160 Q170,110 130,80",fill:"none",stroke:"var(--secondary)",strokeWidth:"1",className:t}),p.jsx("path",{d:"M280,180 Q310,170 340,190",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("path",{d:"M120,155 Q90,145 60,160",fill:"none",stroke:"var(--tertiary)",strokeWidth:"0.8",opacity:"0.5"}),p.jsx("circle",{cx:"280",cy:"180",r:"3",fill:"var(--primary)",opacity:"0.7"}),p.jsx("circle",{cx:"120",cy:"155",r:"3",fill:"var(--secondary)",opacity:"0.7"}),p.jsx("circle",{cx:"270",cy:"90",r:"2.5",fill:"var(--tertiary)",opacity:"0.6"}),p.jsx("circle",{cx:"130",cy:"80",r:"2.5",fill:"var(--secondary)",opacity:"0.6"}),p.jsx("circle",{cx:"340",cy:"190",r:"2",fill:"var(--tertiary)",opacity:"0.4"}),p.jsx("circle",{cx:"60",cy:"160",r:"2",fill:"var(--primary)",opacity:"0.4"}),p.jsx("circle",{cx:"200",cy:"160",r:"4",fill:"var(--primary)",className:e?"animate-pulse":""})]})}function SF({stats:e}){const t=yF(e),n=xF(e),r=bF(e),a=e.daemon.active_sessions.length,i=j1(e.daemon.uptime_seconds);return p.jsxs("section",{className:"relative flex items-center justify-center rounded-xl overflow-hidden glass-panel border border-outline-variant/10 min-h-[320px]",children:[p.jsx(wF,{active:r}),p.jsxs("div",{className:"text-center relative z-20 space-y-3 py-12",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-on-surface-variant/80",children:n}),p.jsx("h1",{className:"font-serif text-5xl italic text-on-surface drop-shadow-sm",children:"Myco"}),p.jsxs("p",{className:"font-mono text-sm text-outline",children:["Node connectivity at ",t,"% capacity"]}),p.jsxs("div",{className:"flex items-center justify-center gap-6 pt-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-sage shadow-sage-glow animate-pulse"}),p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[a," active ",a===1?"session":"sessions"]})]}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:[e.vault.spore_count," spores"]})}),p.jsx("div",{className:"h-3 w-px bg-outline-variant/30"}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("span",{className:"font-mono text-[11px] text-on-surface/70",children:["uptime ",i]})})]})]})]})}function EF({data:e,width:t=120,height:n=40,className:r}){if(e.length<2)return null;const a=Math.min(...e),l=Math.max(...e)-a||1,o=e.map((d,v)=>({x:v/(e.length-1)*t,y:n-(d-a)/l*n}));let f=`M ${o[0].x} ${o[0].y}`;for(let d=0;d<o.length-1;d++){const v=o[Math.max(0,d-1)],m=o[d],y=o[d+1],x=o[Math.min(o.length-1,d+2)],w=m.x+(y.x-v.x)/6,S=m.y+(y.y-v.y)/6,b=y.x-(x.x-m.x)/6,C=y.y-(x.y-m.y)/6;f+=` C ${w} ${S}, ${b} ${C}, ${y.x} ${y.y}`}const c=`${f} L ${t} ${n} L 0 ${n} Z`;return p.jsxs("svg",{width:t,height:n,className:r,viewBox:`0 0 ${t} ${n}`,children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:"sparkline-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:"0.2"}),p.jsx("stop",{offset:"100%",stopColor:"var(--primary)",stopOpacity:"0"})]})}),p.jsx("path",{d:c,fill:"url(#sparkline-fill)"}),p.jsx("path",{d:f,fill:"none",stroke:"var(--primary)",strokeWidth:"1.5",strokeOpacity:"0.8"})]})}const CF={sage:"border-t-sage",ochre:"border-t-ochre",terracotta:"border-t-terracotta",outline:"border-t-outline"},TF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta",outline:"text-on-surface"};function yn({label:e,value:t,sublabel:n,accent:r,sparklineData:a,className:i,href:l}){const o=Ae("rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80",l&&"cursor-pointer",CF[r],i),f=p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-outline mb-2",children:e}),p.jsxs("div",{className:"flex items-end justify-between gap-2",children:[p.jsx("p",{className:Ae("font-serif text-2xl font-bold",TF[r]),children:t}),a&&a.length>=2&&p.jsx(EF,{data:a,width:80,height:28,className:"opacity-60"})]}),n&&p.jsx("p",{className:"font-mono text-[10px] text-outline mt-1",children:n})]});return l?p.jsx(mp,{to:l,className:Ae(o,"block no-underline"),children:f}):p.jsx("div",{className:o,children:f})}function kF({stats:e}){const t=e.embedding.total_embeddable>0?Math.round(e.embedding.embedded_count/e.embedding.total_embeddable*100):0,n=e.digest.tiers_available.length>0?`${e.digest.tiers_available.length} tiers`:"None",r=e.agent.last_run_at?oi(e.agent.last_run_at):"Never";return p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[p.jsx(yn,{label:"Sessions",value:String(e.vault.session_count),sublabel:`${e.daemon.active_sessions.length} active`,accent:"sage",href:"/sessions"}),p.jsx(yn,{label:"Spores",value:String(e.vault.spore_count),sublabel:`${e.vault.entity_count} entities`,accent:"sage",href:"/mycelium?tab=spores"}),p.jsx(yn,{label:"Embedding",value:`${t}%`,sublabel:`${e.embedding.embedded_count}/${e.embedding.total_embeddable}`,accent:e.embedding.queue_depth>0?"ochre":"sage",href:"/operations"}),p.jsx(yn,{label:"Agent",value:`${e.agent.total_runs}`,sublabel:`last: ${r}`,accent:e.agent.last_run_status==="error"?"terracotta":"outline",href:"/agent"}),p.jsx(yn,{label:"Digest",value:n,sublabel:e.digest.generated_at?oi(e.digest.generated_at):void 0,accent:"outline",href:"/mycelium?tab=digest"}),p.jsx(yn,{label:"Uptime",value:j1(e.daemon.uptime_seconds),sublabel:`v${e.daemon.version}`,accent:"outline"})]})}function kD(e=20){return Fa({queryKey:["activity",e],queryFn:({signal:t})=>bt(`/activity?limit=${e}`,{signal:t}),refetchInterval:ra.STATS,pollCategory:"standard"})}function NF(e){return e==="agent_run"?"ochre":e==="spore"?"sage":e.includes("error")||e.includes("fail")?"terracotta":"sage"}function AF(e){switch(e){case"sage":return{label:"STABLE",dotClass:"bg-sage shadow-sage-glow"};case"ochre":return{label:"ACTIVE",dotClass:"bg-ochre shadow-ochre-glow"};case"terracotta":return{label:"WARNING",dotClass:"bg-terracotta shadow-terracotta-glow"}}}const RF={sage:"border-l-sage",ochre:"border-l-ochre",terracotta:"border-l-terracotta"},jF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},DF={sage:"text-sage",ochre:"text-ochre",terracotta:"text-terracotta"},MF={sage:"border-sage/20",ochre:"border-ochre/20",terracotta:"border-terracotta/20"};function OF(e){return`#${e.slice(-6).toUpperCase()}`}function ST(e){return e.summary}function LF({event:e}){const t=Wi(),n=NF(e.type),r=AF(n),a=oi(e.timestamp),i=e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null;return p.jsxs("div",{className:Ae("p-5 rounded-lg border-l-4 bg-surface-container/60 hover:bg-surface-container-high group hover-lift transition-colors",i&&"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",RF[n]),onClick:()=>i&&t(i),onKeyDown:l=>{i&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i))},tabIndex:i?0:void 0,role:i?"link":void 0,"aria-label":`${ST(e)} - ${r.label} - ${a}`,children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("p",{className:Ae("font-mono text-xs font-bold",jF[n]),children:OF(e.id)}),p.jsx("h4",{className:"font-serif text-lg text-on-surface leading-tight mt-0.5 truncate",children:ST(e)})]}),p.jsx("div",{className:Ae("w-8 h-8 rounded-full border-2 flex items-center justify-center shrink-0 ml-3",MF[n]),children:p.jsx("div",{className:Ae("w-3.5 h-3.5 rounded-full",r.dotClass)})})]}),p.jsxs("p",{className:"text-xs text-on-surface/60 line-clamp-2 leading-relaxed italic mb-3",children:["> ",e.type.replace(/_/g," ")," event recorded ",a]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("span",{className:Ae("px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono rounded",DF[n]),children:r.label}),p.jsx("span",{className:"px-2 py-0.5 bg-surface-container-highest text-[10px] font-mono text-outline rounded",children:a})]})]})}const ET=6,_F=3;function BF(){return p.jsxs("div",{className:"p-5 rounded-lg border-l-4 border-l-outline-variant/30 bg-surface-container/40 animate-pulse",children:[p.jsxs("div",{className:"flex justify-between items-start mb-3",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high"}),p.jsx("div",{className:"h-5 w-40 rounded bg-surface-container-high"})]}),p.jsx("div",{className:"w-8 h-8 rounded-full bg-surface-container-high"})]}),p.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-container-high/60 mb-3"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("div",{className:"h-5 w-16 rounded bg-surface-container-high/60"}),p.jsx("div",{className:"h-5 w-12 rounded bg-surface-container-high/60"})]})]})}function PF(){const{data:e,isLoading:t}=kD(ET*2),n=(e??[]).filter(r=>r.type!=="agent_run").slice(0,ET);return p.jsxs("section",{className:"space-y-5",children:[p.jsx("div",{className:"flex items-end justify-between border-b border-outline-variant/10 pb-4",children:p.jsxs("div",{children:[p.jsx("h3",{className:"font-serif text-3xl text-on-surface",children:"Session Pods"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline mt-1",children:"Monitoring concurrent thread activity"})]})}),t?p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:Array.from({length:_F}).map((r,a)=>p.jsx(BF,{},a))}):n.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Cj,{className:"h-10 w-10 text-outline/30"}),p.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3 w-3 rounded-full bg-surface-container border-2 border-surface"})]}),p.jsx("p",{className:"font-sans text-sm text-on-surface-variant",children:"No recent activity"}),p.jsx("p",{className:"font-mono text-[10px] uppercase text-outline tracking-wider",children:"Pods appear as sessions and spores are captured"})]}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:n.map(r=>p.jsx(LF,{event:r},r.id))})]})}const zF=ra.STATS,IF=ra.HEALTH,FF=ra.STATS,O1=new Set(["completed","failed","skipped"]),qF=ra.STATS,L1=6e4,UF=50;function ND(e){const t=(e==null?void 0:e.limit)??UF,n=new URLSearchParams;n.set("limit",String(t)),(e==null?void 0:e.offset)!==void 0&&n.set("offset",String(e.offset)),e!=null&&e.search&&n.set("search",e.search),e!=null&&e.status&&n.set("status",e.status),e!=null&&e.task&&n.set("task",e.task);const r=n.toString();return Fa({queryKey:["agent-runs",e],queryFn:({signal:a})=>bt(`/agent/runs?${r}`,{signal:a}),pollCategory:"standard",refetchInterval:zF})}function VF(e){return Tn({queryKey:["agent-run",e],queryFn:({signal:n})=>bt(`/agent/runs/${e}`,{signal:n}),enabled:e!==void 0,refetchInterval:n=>{var a,i;const r=(i=(a=n.state.data)==null?void 0:a.run)==null?void 0:i.status;return r&&O1.has(r)?!1:IF}})}function HF(e,t){const n=t?O1.has(t):!1;return Fa({queryKey:["agent-reports",e],queryFn:({signal:r})=>bt(`/agent/runs/${e}/reports`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:FF})}function GF(e,t){const n=t?O1.has(t):!1;return Fa({queryKey:["agent-turns",e],queryFn:({signal:r})=>bt(`/agent/runs/${e}/turns`,{signal:r}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:n?0:qF})}function ic(){return Tn({queryKey:["agent-tasks"],queryFn:({signal:e})=>bt("/agent/tasks",{signal:e}),staleTime:L1})}function $F(e){return Tn({queryKey:["agent-task",e],queryFn:({signal:t})=>bt(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:L1})}function KF(){const e=Ca();return vl({mutationFn:({taskId:t,name:n})=>Cr(`/agent/tasks/${t}/copy`,n?{name:n}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function YF(){const e=Ca();return vl({mutationFn:t=>Aj(`/agent/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]})}})}function XF(e){return Tn({queryKey:["agent-task-yaml",e],queryFn:({signal:t})=>bt(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:L1})}function QF(){const e=Ca();return vl({mutationFn:({taskId:t,yaml:n})=>wp(`/agent/tasks/${t}`,{yaml:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-tasks"]}),e.invalidateQueries({queryKey:["agent-task"]}),e.invalidateQueries({queryKey:["agent-task-yaml"]})}})}function _1(){const e=Ca();return vl({mutationFn:t=>Cr("/agent/run",t),onSuccess:()=>{e.invalidateQueries({queryKey:["agent-runs"]})}})}function B1(e){return e===null?"—":`$${e.toFixed(4)}`}function P1(e){return e===null?"—":e.toLocaleString()}function AD(e){switch(e){case"completed":return"default";case"running":return"warning";case"failed":return"destructive";default:return"secondary"}}function RD(e){return e===g1?"warning":"secondary"}const jD="Default task";function DD(e,t){if(!e)return jD;const n=t.find(r=>r.name===e);return(n==null?void 0:n.displayName)??e}const WF=5,CT={running:"bg-sage animate-pulse",completed:"bg-sage",failed:"bg-terracotta",skipped:"bg-outline/40",pending:"bg-outline/40"};function ZF({run:e,taskName:t,onClick:n}){const r=CT[e.status]??CT.pending;return p.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-outline-variant/5 last:border-0 cursor-pointer hover:bg-surface-container-high/50 -mx-2 px-2 rounded transition-colors",onClick:n,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n())},role:"link",tabIndex:0,"aria-label":`View run: ${t}`,children:[p.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p.jsx("span",{className:Ae("h-2 w-2 shrink-0 rounded-full",r)}),p.jsx("span",{className:"text-sm text-on-surface truncate",children:t})]}),p.jsxs("div",{className:"flex items-center gap-3 shrink-0 font-mono text-[11px] text-outline",children:[p.jsx("span",{children:e.started_at!==null?oi(e.started_at):"—"}),p.jsx("span",{children:Dp(e.started_at,e.completed_at)})]})]})}function JF(){const{data:e,isLoading:t}=ND({limit:WF}),{data:n}=ic(),r=Wi(),a=(n==null?void 0:n.tasks)??[],i=(e==null?void 0:e.runs)??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"Agent Runs"}),p.jsx(dd,{className:"h-5 w-5 text-outline"})]}),t?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"Loading runs..."}):i.length===0?p.jsx("div",{className:"font-mono text-[11px] text-outline py-4",children:"No agent runs yet"}):p.jsx("div",{children:i.map(l=>p.jsx(ZF,{run:l,taskName:DD(l.task,a),onClick:()=>r("/agent")},l.id))})]})}const eq=12,tq=8;function nq(e){return e.includes("error")||e.includes("fail")?"error":e==="agent_run"?"warn":"ok"}const rq={ok:"[OK]",warn:"[WRN]",error:"[ERR]"},aq={ok:"text-sage",warn:"text-ochre",error:"text-terracotta"};function iq(e){return new Date(e*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function sq(e){return e.type==="session"?`/sessions/${e.id}`:e.type==="agent_run"?"/agent":e.type==="spore"?"/mycelium":null}function lq({event:e,onClick:t}){const n=nq(e.type);return p.jsxs("div",{className:Ae("flex gap-4 items-start border-b border-outline-variant/5 pb-2 font-mono text-[11px] transition-all duration-150",t&&"cursor-pointer hover:bg-surface-container-high/50 hover:translate-x-1 -mx-2 px-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"),onClick:t,onKeyDown:t?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),t())}:void 0,tabIndex:t?0:void 0,role:t?"link":void 0,"aria-label":t?`${e.type.replace(/_/g," ")}: ${e.summary}`:void 0,children:[p.jsx("span",{className:"text-outline shrink-0 tabular-nums",children:iq(e.timestamp)}),p.jsx("span",{className:Ae("shrink-0 font-bold",aq[n]),children:rq[n]}),p.jsx("span",{className:"text-on-surface/70 truncate",children:e.summary})]})}function oq(){const{data:e,isLoading:t}=kD(eq),n=Wi(),r=(e==null?void 0:e.slice(0,tq))??[];return p.jsxs("div",{className:"glass-panel p-6 rounded-xl border border-outline-variant/10 transition-[border-color] duration-200 hover:border-outline-variant/25",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h4",{className:"font-serif text-xl text-on-surface",children:"System Integrity Logs"}),p.jsx("span",{className:"text-[10px] font-mono text-sage px-2 py-1 bg-sage-muted rounded",children:"LIVE"})]}),t?p.jsx("div",{className:"space-y-3",children:[1,2,3].map(a=>p.jsxs("div",{className:"flex gap-4 items-start pb-2 animate-pulse",children:[p.jsx("div",{className:"h-3 w-14 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high/50"}),p.jsx("div",{className:"h-3 flex-1 rounded bg-surface-container-high/40"})]},a))}):r.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[p.jsx(Tj,{className:"h-8 w-8 text-outline/20"}),p.jsx("p",{className:"font-sans text-xs text-on-surface-variant",children:"No log entries yet"})]}):p.jsx("div",{className:"space-y-3",children:r.map(a=>{const i=sq(a);return p.jsx(lq,{event:a,onClick:i?()=>n(i):void 0},a.id)})})]})}function uq(e){const{embedded_count:t,total_embeddable:n}=e.embedding;if(n===0)return"Initializing";const r=t/n;return r>=.95?"Optimal":r>=.7?"Good":"Degraded"}function cq({stats:e}){const t=uq(e);return p.jsxs("div",{className:"flex items-center justify-between px-2 py-3 border-t border-outline-variant/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"font-mono text-[10px] uppercase text-sage",children:["System Connectivity: ",t]}),p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sage animate-pulse"})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:e.vault.name}),p.jsxs("span",{className:"font-mono text-[10px] uppercase text-outline/50",children:["v",e.daemon.version]})]})]})}function fq(){const{data:e,isLoading:t,isError:n,error:r}=Sp();return p.jsx(R1,{isLoading:t,error:n?r instanceof Error?r:new Error("Unable to reach daemon"):null,loadingText:"Connecting to daemon...",children:e&&p.jsxs("div",{className:"relative min-h-full",children:[p.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.04]",children:p.jsxs("svg",{height:"100%",width:"100%",viewBox:"0 0 800 800",preserveAspectRatio:"none",children:[p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 300 500 200 400C100 300 0 400 0 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 600 500 500 600 400C700 300 800 400 800 400",fill:"none",stroke:"#abcfb8",strokeWidth:"1"}),p.jsx("path",{className:"mycelial-connector",d:"M400 800C400 500 450 300 400 100",fill:"none",stroke:"#abcfb8",strokeWidth:"1"})]})}),p.jsxs("div",{className:"relative z-10 p-6 lg:p-8 max-w-7xl mx-auto space-y-10",children:[p.jsx(SF,{stats:e}),p.jsx(kF,{stats:e}),p.jsx(PF,{}),p.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsx(JF,{}),p.jsx(oq,{})]}),p.jsx(cq,{stats:e})]})]})})}const dq=Ep("rounded-md transition-colors",{variants:{level:{lowest:"bg-surface-container-lowest",low:"bg-surface-container-low",default:"bg-surface-container",high:"bg-surface-container-high",highest:"bg-surface-container-highest",bright:"bg-surface-bright"},interactive:{true:"cursor-pointer hover-lift hover:brightness-[1.08]",false:""},ghostBorder:{true:"border border-[var(--ghost-border)]",false:""},glass:{true:"backdrop-blur-xl bg-surface-variant/60",false:""},glow:{true:"shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]",false:""}},defaultVariants:{level:"low",interactive:!1,ghostBorder:!1,glass:!1,glow:!1}}),st=j.forwardRef(({className:e,level:t,interactive:n,ghostBorder:r,glass:a,glow:i,...l},o)=>p.jsx("div",{ref:o,className:Ae(dq({level:t,interactive:n,ghostBorder:r,glass:a,glow:i}),e),...l}));st.displayName="Surface";function hq({tabs:e,activeTab:t,onTabChange:n,className:r}){return p.jsx("div",{className:Ae("flex items-center gap-6",r),children:e.map(a=>p.jsx("button",{onClick:()=>n(a.id),className:Ae("pb-2 font-sans text-sm font-medium transition-colors border-b-2",t===a.id?"text-primary border-primary":"text-on-surface-variant border-transparent hover:text-on-surface"),children:a.label},a.id))})}function Gi({title:e,subtitle:t,tabs:n,activeTab:r,onTabChange:a,actions:i,className:l}){return p.jsxs("div",{className:Ae("pb-6",l),children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"font-serif text-2xl font-normal text-on-surface tracking-wide",children:e}),t&&p.jsx("p",{className:"mt-1 font-sans text-sm text-on-surface-variant",children:t})]}),i&&p.jsx("div",{className:"flex items-center gap-2",children:i})]}),n&&r&&a&&p.jsx(hq,{tabs:n,activeTab:r,onTabChange:a,className:"mt-4"})]})}function MD({open:e,onOpenChange:t,title:n,description:r,icon:a,meta:i,impact:l,confirmLabel:o="Confirm",variant:f="destructive",onConfirm:c,isPending:d=!1}){var v,m;return p.jsx(Ap,{open:e,onOpenChange:t,children:p.jsxs(hd,{className:"sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden",children:[p.jsxs(Rp,{children:[p.jsxs("div",{className:"flex items-center gap-3",children:[a&&p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15",children:a}),p.jsx(vd,{children:n})]}),p.jsx(A1,{children:r})]}),i&&i.length>0&&p.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0",children:(v=i[0])==null?void 0:v.value}),i.length>1&&p.jsx("span",{className:"text-sm font-medium text-on-surface truncate",children:(m=i[1])==null?void 0:m.value})]}),l&&l.length>0&&p.jsx("div",{className:"grid grid-cols-2 gap-2",children:l.map(y=>p.jsxs("div",{className:"rounded-md border border-outline-variant/20 px-3 py-2",children:[p.jsx("div",{className:"font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant",children:y.label}),p.jsx("div",{className:"font-sans text-base font-medium text-on-surface",children:y.value})]},y.label))}),p.jsxs(jp,{children:[p.jsx(Ke,{variant:"secondary",size:"sm",onClick:()=>t(!1),disabled:d,children:"Cancel"}),p.jsxs(Ke,{variant:f,size:"sm",onClick:c,disabled:d,className:"gap-2",children:[d&&p.jsx(Qn,{className:"h-4 w-4 animate-spin"}),o]})]})]})})}function TT(e,[t,n]){return Math.min(n,Math.max(t,e))}function vq(e){const t=e+"CollectionProvider",[n,r]=Cp(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:S,children:b}=w,C=Bi.useRef(null),T=Bi.useRef(new Map).current;return p.jsx(a,{scope:S,itemMap:T,collectionRef:C,children:b})};l.displayName=t;const o=e+"CollectionSlot",f=Uf(o),c=Bi.forwardRef((w,S)=>{const{scope:b,children:C}=w,T=i(o,b),N=Cn(S,T.collectionRef);return p.jsx(f,{ref:N,children:C})});c.displayName=o;const d=e+"CollectionItemSlot",v="data-radix-collection-item",m=Uf(d),y=Bi.forwardRef((w,S)=>{const{scope:b,children:C,...T}=w,N=Bi.useRef(null),A=Cn(S,N),R=i(d,b);return Bi.useEffect(()=>(R.itemMap.set(N,{ref:N,...T}),()=>void R.itemMap.delete(N))),p.jsx(m,{[v]:"",ref:A,children:C})});y.displayName=d;function x(w){const S=i(e+"CollectionConsumer",w);return Bi.useCallback(()=>{const C=S.collectionRef.current;if(!C)return[];const T=Array.from(C.querySelectorAll(`[${v}]`));return Array.from(S.itemMap.values()).sort((R,D)=>T.indexOf(R.ref.current)-T.indexOf(D.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:c,ItemSlot:y},x,r]}var pq=j.createContext(void 0);function mq(e){const t=j.useContext(pq);return e||t||"ltr"}const gq=["top","right","bottom","left"],sl=Math.min,Jr=Math.max,Gv=Math.round,Jh=Math.floor,si=e=>({x:e,y:e}),yq={left:"right",right:"left",bottom:"top",top:"bottom"};function hb(e,t,n){return Jr(e,sl(t,n))}function $i(e,t){return typeof e=="function"?e(t):e}function Ki(e){return e.split("-")[0]}function sc(e){return e.split("-")[1]}function z1(e){return e==="x"?"y":"x"}function I1(e){return e==="y"?"height":"width"}function ri(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function F1(e){return z1(ri(e))}function xq(e,t,n){n===void 0&&(n=!1);const r=sc(e),a=F1(e),i=I1(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=$v(l)),[l,$v(l)]}function bq(e){const t=$v(e);return[vb(e),t,vb(t)]}function vb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kT=["left","right"],NT=["right","left"],wq=["top","bottom"],Sq=["bottom","top"];function Eq(e,t,n){switch(e){case"top":case"bottom":return n?t?NT:kT:t?kT:NT;case"left":case"right":return t?wq:Sq;default:return[]}}function Cq(e,t,n,r){const a=sc(e);let i=Eq(Ki(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(vb)))),i}function $v(e){const t=Ki(e);return yq[t]+e.slice(t.length)}function Tq(e){return{top:0,right:0,bottom:0,left:0,...e}}function OD(e){return typeof e!="number"?Tq(e):{top:e,right:e,bottom:e,left:e}}function Kv(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function AT(e,t,n){let{reference:r,floating:a}=e;const i=ri(t),l=F1(t),o=I1(l),f=Ki(t),c=i==="y",d=r.x+r.width/2-a.width/2,v=r.y+r.height/2-a.height/2,m=r[o]/2-a[o]/2;let y;switch(f){case"top":y={x:d,y:r.y-a.height};break;case"bottom":y={x:d,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:v};break;case"left":y={x:r.x-a.width,y:v};break;default:y={x:r.x,y:r.y}}switch(sc(t)){case"start":y[l]-=m*(n&&c?-1:1);break;case"end":y[l]+=m*(n&&c?-1:1);break}return y}async function kq(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:l,elements:o,strategy:f}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:v="floating",altBoundary:m=!1,padding:y=0}=$i(t,e),x=OD(y),S=o[m?v==="floating"?"reference":"floating":v],b=Kv(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(S)))==null||n?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:f})),C=v==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),N=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},A=Kv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:C,offsetParent:T,strategy:f}):C);return{top:(b.top-A.top+x.top)/N.y,bottom:(A.bottom-b.bottom+x.bottom)/N.y,left:(b.left-A.left+x.left)/N.x,right:(A.right-b.right+x.right)/N.x}}const Nq=50,Aq=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,o=l.detectOverflow?l:{...l,detectOverflow:kq},f=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:v}=AT(c,r,f),m=r,y=0;const x={};for(let w=0;w<i.length;w++){const S=i[w];if(!S)continue;const{name:b,fn:C}=S,{x:T,y:N,data:A,reset:R}=await C({x:d,y:v,initialPlacement:r,placement:m,strategy:a,middlewareData:x,rects:c,platform:o,elements:{reference:e,floating:t}});d=T??d,v=N??v,x[b]={...x[b],...A},R&&y<Nq&&(y++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(c=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:d,y:v}=AT(c,m,f)),w=-1)}return{x:d,y:v,placement:m,strategy:a,middlewareData:x}},Rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:o,middlewareData:f}=t,{element:c,padding:d=0}=$i(e,t)||{};if(c==null)return{};const v=OD(d),m={x:n,y:r},y=F1(a),x=I1(y),w=await l.getDimensions(c),S=y==="y",b=S?"top":"left",C=S?"bottom":"right",T=S?"clientHeight":"clientWidth",N=i.reference[x]+i.reference[y]-m[y]-i.floating[x],A=m[y]-i.reference[y],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let D=R?R[T]:0;(!D||!await(l.isElement==null?void 0:l.isElement(R)))&&(D=o.floating[T]||i.floating[x]);const L=N/2-A/2,_=D/2-w[x]/2-1,M=sl(v[b],_),z=sl(v[C],_),P=M,G=D-w[x]-z,I=D/2-w[x]/2+L,F=hb(P,I,G),B=!f.arrow&&sc(a)!=null&&I!==F&&i.reference[x]/2-(I<P?M:z)-w[x]/2<0,H=B?I<P?I-P:I-G:0;return{[y]:m[y]+H,data:{[y]:F,centerOffset:I-F-H,...B&&{alignmentOffset:H}},reset:B}}}),jq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:l,initialPlacement:o,platform:f,elements:c}=t,{mainAxis:d=!0,crossAxis:v=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...S}=$i(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ki(a),C=ri(o),T=Ki(o)===o,N=await(f.isRTL==null?void 0:f.isRTL(c.floating)),A=m||(T||!w?[$v(o)]:bq(o)),R=x!=="none";!m&&R&&A.push(...Cq(o,w,x,N));const D=[o,...A],L=await f.detectOverflow(t,S),_=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&_.push(L[b]),v){const I=xq(a,l,N);_.push(L[I[0]],L[I[1]])}if(M=[...M,{placement:a,overflows:_}],!_.every(I=>I<=0)){var z,P;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,F=D[I];if(F&&(!(v==="alignment"?C!==ri(F):!1)||M.every(Y=>ri(Y.placement)===C?Y.overflows[0]>0:!0)))return{data:{index:I,overflows:M},reset:{placement:F}};let B=(P=M.filter(H=>H.overflows[0]<=0).sort((H,Y)=>H.overflows[1]-Y.overflows[1])[0])==null?void 0:P.placement;if(!B)switch(y){case"bestFit":{var G;const H=(G=M.filter(Y=>{if(R){const Q=ri(Y.placement);return Q===C||Q==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(Q=>Q>0).reduce((Q,V)=>Q+V,0)]).sort((Y,Q)=>Y[1]-Q[1])[0])==null?void 0:G[0];H&&(B=H);break}case"initialPlacement":B=o;break}if(a!==B)return{reset:{placement:B}}}return{}}}};function RT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jT(e){return gq.some(t=>e[t]>=0)}const Dq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=$i(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),o=RT(l,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:jT(o)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),o=RT(l,n.floating);return{data:{escapedOffsets:o,escaped:jT(o)}}}default:return{}}}}},LD=new Set(["left","top"]);async function Mq(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=Ki(n),o=sc(n),f=ri(n)==="y",c=LD.has(l)?-1:1,d=i&&f?-1:1,v=$i(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return o&&typeof x=="number"&&(y=o==="end"?x*-1:x),f?{x:y*d,y:m*c}:{x:m*c,y:y*d}}const Oq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:o}=t,f=await Mq(t,e);return l===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:l}}}}},Lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:i}=t,{mainAxis:l=!0,crossAxis:o=!1,limiter:f={fn:b=>{let{x:C,y:T}=b;return{x:C,y:T}}},...c}=$i(e,t),d={x:n,y:r},v=await i.detectOverflow(t,c),m=ri(Ki(a)),y=z1(m);let x=d[y],w=d[m];if(l){const b=y==="y"?"top":"left",C=y==="y"?"bottom":"right",T=x+v[b],N=x-v[C];x=hb(T,x,N)}if(o){const b=m==="y"?"top":"left",C=m==="y"?"bottom":"right",T=w+v[b],N=w-v[C];w=hb(T,w,N)}const S=f.fn({...t,[y]:x,[m]:w});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[y]:l,[m]:o}}}}}},_q=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:o=0,mainAxis:f=!0,crossAxis:c=!0}=$i(e,t),d={x:n,y:r},v=ri(a),m=z1(v);let y=d[m],x=d[v];const w=$i(o,t),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const T=m==="y"?"height":"width",N=i.reference[m]-i.floating[T]+S.mainAxis,A=i.reference[m]+i.reference[T]-S.mainAxis;y<N?y=N:y>A&&(y=A)}if(c){var b,C;const T=m==="y"?"width":"height",N=LD.has(Ki(a)),A=i.reference[v]-i.floating[T]+(N&&((b=l.offset)==null?void 0:b[v])||0)+(N?0:S.crossAxis),R=i.reference[v]+i.reference[T]+(N?0:((C=l.offset)==null?void 0:C[v])||0)-(N?S.crossAxis:0);x<A?x=A:x>R&&(x=R)}return{[m]:y,[v]:x}}}},Bq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:o}=t,{apply:f=()=>{},...c}=$i(e,t),d=await l.detectOverflow(t,c),v=Ki(a),m=sc(a),y=ri(a)==="y",{width:x,height:w}=i.floating;let S,b;v==="top"||v==="bottom"?(S=v,b=m===(await(l.isRTL==null?void 0:l.isRTL(o.floating))?"start":"end")?"left":"right"):(b=v,S=m==="end"?"top":"bottom");const C=w-d.top-d.bottom,T=x-d.left-d.right,N=sl(w-d[S],C),A=sl(x-d[b],T),R=!t.middlewareData.shift;let D=N,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=C),R&&!m){const M=Jr(d.left,0),z=Jr(d.right,0),P=Jr(d.top,0),G=Jr(d.bottom,0);y?L=x-2*(M!==0||z!==0?M+z:Jr(d.left,d.right)):D=w-2*(P!==0||G!==0?P+G:Jr(d.top,d.bottom))}await f({...t,availableWidth:L,availableHeight:D});const _=await l.getDimensions(o.floating);return x!==_.width||w!==_.height?{reset:{rects:!0}}:{}}}};function Mp(){return typeof window<"u"}function lc(e){return _D(e)?(e.nodeName||"").toLowerCase():"#document"}function ea(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fi(e){var t;return(t=(_D(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _D(e){return Mp()?e instanceof Node||e instanceof ea(e).Node:!1}function Ba(e){return Mp()?e instanceof Element||e instanceof ea(e).Element:!1}function Ji(e){return Mp()?e instanceof HTMLElement||e instanceof ea(e).HTMLElement:!1}function DT(e){return!Mp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ea(e).ShadowRoot}function pd(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Pa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function Pq(e){return/^(table|td|th)$/.test(lc(e))}function Op(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zq=/transform|translate|scale|rotate|perspective|filter/,Iq=/paint|layout|strict|content/,Fl=e=>!!e&&e!=="none";let Py;function q1(e){const t=Ba(e)?Pa(e):e;return Fl(t.transform)||Fl(t.translate)||Fl(t.scale)||Fl(t.rotate)||Fl(t.perspective)||!U1()&&(Fl(t.backdropFilter)||Fl(t.filter))||zq.test(t.willChange||"")||Iq.test(t.contain||"")}function Fq(e){let t=ll(e);for(;Ji(t)&&!Yu(t);){if(q1(t))return t;if(Op(t))return null;t=ll(t)}return null}function U1(){return Py==null&&(Py=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Py}function Yu(e){return/^(html|body|#document)$/.test(lc(e))}function Pa(e){return ea(e).getComputedStyle(e)}function Lp(e){return Ba(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ll(e){if(lc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||DT(e)&&e.host||fi(e);return DT(t)?t.host:t}function BD(e){const t=ll(e);return Yu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ji(t)&&pd(t)?t:BD(t)}function Vf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=BD(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=ea(a);if(i){const o=pb(l);return t.concat(l,l.visualViewport||[],pd(a)?a:[],o&&n?Vf(o):[])}else return t.concat(a,Vf(a,[],n))}function pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PD(e){const t=Pa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ji(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,o=Gv(n)!==i||Gv(r)!==l;return o&&(n=i,r=l),{width:n,height:r,$:o}}function V1(e){return Ba(e)?e:e.contextElement}function Ru(e){const t=V1(e);if(!Ji(t))return si(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=PD(t);let l=(i?Gv(n.width):n.width)/r,o=(i?Gv(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!o||!Number.isFinite(o))&&(o=1),{x:l,y:o}}const qq=si(0);function zD(e){const t=ea(e);return!U1()||!t.visualViewport?qq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ea(e)?!1:t}function fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=V1(e);let l=si(1);t&&(r?Ba(r)&&(l=Ru(r)):l=Ru(e));const o=Uq(i,n,r)?zD(i):si(0);let f=(a.left+o.x)/l.x,c=(a.top+o.y)/l.y,d=a.width/l.x,v=a.height/l.y;if(i){const m=ea(i),y=r&&Ba(r)?ea(r):r;let x=m,w=pb(x);for(;w&&r&&y!==x;){const S=Ru(w),b=w.getBoundingClientRect(),C=Pa(w),T=b.left+(w.clientLeft+parseFloat(C.paddingLeft))*S.x,N=b.top+(w.clientTop+parseFloat(C.paddingTop))*S.y;f*=S.x,c*=S.y,d*=S.x,v*=S.y,f+=T,c+=N,x=ea(w),w=pb(x)}}return Kv({width:d,height:v,x:f,y:c})}function _p(e,t){const n=Lp(e).scrollLeft;return t?t.left+n:fo(fi(e)).left+n}function ID(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-_p(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Vq(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=fi(r),o=t?Op(t.floating):!1;if(r===l||o&&i)return n;let f={scrollLeft:0,scrollTop:0},c=si(1);const d=si(0),v=Ji(r);if((v||!v&&!i)&&((lc(r)!=="body"||pd(l))&&(f=Lp(r)),v)){const y=fo(r);c=Ru(r),d.x=y.x+r.clientLeft,d.y=y.y+r.clientTop}const m=l&&!v&&!i?ID(l,f):si(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-f.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-f.scrollTop*c.y+d.y+m.y}}function Hq(e){return Array.from(e.getClientRects())}function Gq(e){const t=fi(e),n=Lp(e),r=e.ownerDocument.body,a=Jr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Jr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+_p(e);const o=-n.scrollTop;return Pa(r).direction==="rtl"&&(l+=Jr(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:o}}const MT=25;function $q(e,t){const n=ea(e),r=fi(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,o=0,f=0;if(a){i=a.width,l=a.height;const d=U1();(!d||d&&t==="fixed")&&(o=a.offsetLeft,f=a.offsetTop)}const c=_p(r);if(c<=0){const d=r.ownerDocument,v=d.body,m=getComputedStyle(v),y=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-v.clientWidth-y);x<=MT&&(i-=x)}else c<=MT&&(i+=c);return{width:i,height:l,x:o,y:f}}function Kq(e,t){const n=fo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Ji(e)?Ru(e):si(1),l=e.clientWidth*i.x,o=e.clientHeight*i.y,f=a*i.x,c=r*i.y;return{width:l,height:o,x:f,y:c}}function OT(e,t,n){let r;if(t==="viewport")r=$q(e,n);else if(t==="document")r=Gq(fi(e));else if(Ba(t))r=Kq(t,n);else{const a=zD(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Kv(r)}function FD(e,t){const n=ll(e);return n===t||!Ba(n)||Yu(n)?!1:Pa(n).position==="fixed"||FD(n,t)}function Yq(e,t){const n=t.get(e);if(n)return n;let r=Vf(e,[],!1).filter(o=>Ba(o)&&lc(o)!=="body"),a=null;const i=Pa(e).position==="fixed";let l=i?ll(e):e;for(;Ba(l)&&!Yu(l);){const o=Pa(l),f=q1(l);!f&&o.position==="fixed"&&(a=null),(i?!f&&!a:!f&&o.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||pd(l)&&!f&&FD(e,l))?r=r.filter(d=>d!==l):a=o,l=ll(l)}return t.set(e,r),r}function Xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Op(t)?[]:Yq(t,this._c):[].concat(n),r],o=OT(t,l[0],a);let f=o.top,c=o.right,d=o.bottom,v=o.left;for(let m=1;m<l.length;m++){const y=OT(t,l[m],a);f=Jr(y.top,f),c=sl(y.right,c),d=sl(y.bottom,d),v=Jr(y.left,v)}return{width:c-v,height:d-f,x:v,y:f}}function Qq(e){const{width:t,height:n}=PD(e);return{width:t,height:n}}function Wq(e,t,n){const r=Ji(t),a=fi(t),i=n==="fixed",l=fo(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const f=si(0);function c(){f.x=_p(a)}if(r||!r&&!i)if((lc(t)!=="body"||pd(a))&&(o=Lp(t)),r){const y=fo(t,!0,i,t);f.x=y.x+t.clientLeft,f.y=y.y+t.clientTop}else a&&c();i&&!r&&a&&c();const d=a&&!r&&!i?ID(a,o):si(0),v=l.left+o.scrollLeft-f.x-d.x,m=l.top+o.scrollTop-f.y-d.y;return{x:v,y:m,width:l.width,height:l.height}}function zy(e){return Pa(e).position==="static"}function LT(e,t){if(!Ji(e)||Pa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fi(e)===n&&(n=n.ownerDocument.body),n}function qD(e,t){const n=ea(e);if(Op(e))return n;if(!Ji(e)){let a=ll(e);for(;a&&!Yu(a);){if(Ba(a)&&!zy(a))return a;a=ll(a)}return n}let r=LT(e,t);for(;r&&Pq(r)&&zy(r);)r=LT(r,t);return r&&Yu(r)&&zy(r)&&!q1(r)?n:r||Fq(e)||n}const Zq=async function(e){const t=this.getOffsetParent||qD,n=this.getDimensions,r=await n(e.floating);return{reference:Wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jq(e){return Pa(e).direction==="rtl"}const eU={convertOffsetParentRelativeRectToViewportRelativeRect:Vq,getDocumentElement:fi,getClippingRect:Xq,getOffsetParent:qD,getElementRects:Zq,getClientRects:Hq,getDimensions:Qq,getScale:Ru,isElement:Ba,isRTL:Jq};function UD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tU(e,t){let n=null,r;const a=fi(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function l(o,f){o===void 0&&(o=!1),f===void 0&&(f=1),i();const c=e.getBoundingClientRect(),{left:d,top:v,width:m,height:y}=c;if(o||t(),!m||!y)return;const x=Jh(v),w=Jh(a.clientWidth-(d+m)),S=Jh(a.clientHeight-(v+y)),b=Jh(d),T={rootMargin:-x+"px "+-w+"px "+-S+"px "+-b+"px",threshold:Jr(0,sl(1,f))||1};let N=!0;function A(R){const D=R[0].intersectionRatio;if(D!==f){if(!N)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!UD(c,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(A,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(A,T)}n.observe(e)}return l(!0),i}function nU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,c=V1(e),d=a||i?[...c?Vf(c):[],...t?Vf(t):[]]:[];d.forEach(b=>{a&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const v=c&&o?tU(c,n):null;let m=-1,y=null;l&&(y=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&y&&t&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=y)==null||T.observe(t)})),n()}),c&&!f&&y.observe(c),t&&y.observe(t));let x,w=f?fo(e):null;f&&S();function S(){const b=fo(e);w&&!UD(w,b)&&n(),w=b,x=requestAnimationFrame(S)}return n(),()=>{var b;d.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),v==null||v(),(b=y)==null||b.disconnect(),y=null,f&&cancelAnimationFrame(x)}}const rU=Oq,aU=Lq,iU=jq,sU=Bq,lU=Dq,_T=Rq,oU=_q,uU=(e,t,n)=>{const r=new Map,a={platform:eU,...n},i={...a.platform,_c:r};return Aq(e,t,{...a,platform:i})};var cU=typeof document<"u",fU=function(){},Tv=cU?j.useLayoutEffect:fU;function Yv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Yv(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Yv(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function VD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function BT(e,t){const n=VD(e);return Math.round(t*n)/n}function Iy(e){const t=j.useRef(e);return Tv(()=>{t.current=e}),t}function dU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:o=!0,whileElementsMounted:f,open:c}=e,[d,v]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=j.useState(r);Yv(m,r)||y(r);const[x,w]=j.useState(null),[S,b]=j.useState(null),C=j.useCallback(Y=>{Y!==R.current&&(R.current=Y,w(Y))},[]),T=j.useCallback(Y=>{Y!==D.current&&(D.current=Y,b(Y))},[]),N=i||x,A=l||S,R=j.useRef(null),D=j.useRef(null),L=j.useRef(d),_=f!=null,M=Iy(f),z=Iy(a),P=Iy(c),G=j.useCallback(()=>{if(!R.current||!D.current)return;const Y={placement:t,strategy:n,middleware:m};z.current&&(Y.platform=z.current),uU(R.current,D.current,Y).then(Q=>{const V={...Q,isPositioned:P.current!==!1};I.current&&!Yv(L.current,V)&&(L.current=V,fd.flushSync(()=>{v(V)}))})},[m,t,n,z,P]);Tv(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,v(Y=>({...Y,isPositioned:!1})))},[c]);const I=j.useRef(!1);Tv(()=>(I.current=!0,()=>{I.current=!1}),[]),Tv(()=>{if(N&&(R.current=N),A&&(D.current=A),N&&A){if(M.current)return M.current(N,A,G);G()}},[N,A,G,M,_]);const F=j.useMemo(()=>({reference:R,floating:D,setReference:C,setFloating:T}),[C,T]),B=j.useMemo(()=>({reference:N,floating:A}),[N,A]),H=j.useMemo(()=>{const Y={position:n,left:0,top:0};if(!B.floating)return Y;const Q=BT(B.floating,d.x),V=BT(B.floating,d.y);return o?{...Y,transform:"translate("+Q+"px, "+V+"px)",...VD(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:V}},[n,o,B.floating,d.x,d.y]);return j.useMemo(()=>({...d,update:G,refs:F,elements:B,floatingStyles:H}),[d,G,F,B,H])}const hU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_T({element:r.current,padding:a}).fn(n):{}:r?_T({element:r,padding:a}).fn(n):{}}}},vU=(e,t)=>{const n=rU(e);return{name:n.name,fn:n.fn,options:[e,t]}},pU=(e,t)=>{const n=aU(e);return{name:n.name,fn:n.fn,options:[e,t]}},mU=(e,t)=>({fn:oU(e).fn,options:[e,t]}),gU=(e,t)=>{const n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},yU=(e,t)=>{const n=sU(e);return{name:n.name,fn:n.fn,options:[e,t]}},xU=(e,t)=>{const n=lU(e);return{name:n.name,fn:n.fn,options:[e,t]}},bU=(e,t)=>{const n=hU(e);return{name:n.name,fn:n.fn,options:[e,t]}};var wU="Arrow",HD=j.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return p.jsx(Yt.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});HD.displayName=wU;var SU=HD;function EU(e){const[t,n]=j.useState(void 0);return vr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,o;if("borderBoxSize"in i){const f=i.borderBoxSize,c=Array.isArray(f)?f[0]:f;l=c.inlineSize,o=c.blockSize}else l=e.offsetWidth,o=e.offsetHeight;n({width:l,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var H1="Popper",[GD,$D]=Cp(H1),[CU,KD]=GD(H1),YD=e=>{const{__scopePopper:t,children:n}=e,[r,a]=j.useState(null);return p.jsx(CU,{scope:t,anchor:r,onAnchorChange:a,children:n})};YD.displayName=H1;var XD="PopperAnchor",QD=j.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=KD(XD,n),l=j.useRef(null),o=Cn(t,l),f=j.useRef(null);return j.useEffect(()=>{const c=f.current;f.current=(r==null?void 0:r.current)||l.current,c!==f.current&&i.onAnchorChange(f.current)}),r?null:p.jsx(Yt.div,{...a,ref:o})});QD.displayName=XD;var G1="PopperContent",[TU,kU]=GD(G1),WD=j.forwardRef((e,t)=>{var ae,we,fe,J,ne,re;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:o=0,avoidCollisions:f=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:v="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...w}=e,S=KD(G1,n),[b,C]=j.useState(null),T=Cn(t,ge=>C(ge)),[N,A]=j.useState(null),R=EU(N),D=(R==null?void 0:R.width)??0,L=(R==null?void 0:R.height)??0,_=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(c)?c:[c],P=z.length>0,G={padding:M,boundary:z.filter(AU),altBoundary:P},{refs:I,floatingStyles:F,placement:B,isPositioned:H,middlewareData:Y}=dU({strategy:"fixed",placement:_,whileElementsMounted:(...ge)=>nU(...ge,{animationFrame:y==="always"}),elements:{reference:S.anchor},middleware:[vU({mainAxis:a+L,alignmentAxis:l}),f&&pU({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?mU():void 0,...G}),f&&gU({...G}),yU({...G,apply:({elements:ge,rects:ke,availableWidth:Be,availableHeight:lt})=>{const{width:Ze,height:Qe}=ke.reference,qe=ge.floating.style;qe.setProperty("--radix-popper-available-width",`${Be}px`),qe.setProperty("--radix-popper-available-height",`${lt}px`),qe.setProperty("--radix-popper-anchor-width",`${Ze}px`),qe.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),N&&bU({element:N,padding:o}),RU({arrowWidth:D,arrowHeight:L}),m&&xU({strategy:"referenceHidden",...G})]}),[Q,V]=eM(B),q=uo(x);vr(()=>{H&&(q==null||q())},[H,q]);const X=(ae=Y.arrow)==null?void 0:ae.x,U=(we=Y.arrow)==null?void 0:we.y,te=((fe=Y.arrow)==null?void 0:fe.centerOffset)!==0,[ie,oe]=j.useState();return vr(()=>{b&&oe(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:H?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(J=Y.transformOrigin)==null?void 0:J.x,(ne=Y.transformOrigin)==null?void 0:ne.y].join(" "),...((re=Y.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(TU,{scope:n,placedSide:Q,onArrowChange:A,arrowX:X,arrowY:U,shouldHideArrow:te,children:p.jsx(Yt.div,{"data-side":Q,"data-align":V,...w,ref:T,style:{...w.style,animation:H?void 0:"none"}})})})});WD.displayName=G1;var ZD="PopperArrow",NU={top:"bottom",right:"left",bottom:"top",left:"right"},JD=j.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=kU(ZD,r),l=NU[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(SU,{...a,ref:n,style:{...a.style,display:"block"}})})});JD.displayName=ZD;function AU(e){return e!==null}var RU=e=>({name:"transformOrigin",options:e,fn(t){var S,b,C;const{placement:n,rects:r,middlewareData:a}=t,l=((S=a.arrow)==null?void 0:S.centerOffset)!==0,o=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[c,d]=eM(n),v={start:"0%",center:"50%",end:"100%"}[d],m=(((b=a.arrow)==null?void 0:b.x)??0)+o/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+f/2;let x="",w="";return c==="bottom"?(x=l?v:`${m}px`,w=`${-f}px`):c==="top"?(x=l?v:`${m}px`,w=`${r.floating.height+f}px`):c==="right"?(x=`${-f}px`,w=l?v:`${y}px`):c==="left"&&(x=`${r.floating.width+f}px`,w=l?v:`${y}px`),{data:{x,y:w}}}});function eM(e){const[t,n="center"]=e.split("-");return[t,n]}var jU=YD,DU=QD,MU=WD,OU=JD;function LU(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),_U="VisuallyHidden",BU=j.forwardRef((e,t)=>p.jsx(Yt.span,{...e,ref:t,style:{...tM,...e.style}}));BU.displayName=_U;var PU=[" ","Enter","ArrowUp","ArrowDown"],zU=[" ","Enter"],ho="Select",[Bp,Pp,IU]=vq(ho),[oc]=Cp(ho,[IU,$D]),zp=$D(),[FU,pl]=oc(ho),[qU,UU]=oc(ho),nM=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:o,onValueChange:f,dir:c,name:d,autoComplete:v,disabled:m,required:y,form:x}=e,w=zp(t),[S,b]=j.useState(null),[C,T]=j.useState(null),[N,A]=j.useState(!1),R=mq(c),[D,L]=Uv({prop:r,defaultProp:a??!1,onChange:i,caller:ho}),[_,M]=Uv({prop:l,defaultProp:o,onChange:f,caller:ho}),z=j.useRef(null),P=S?x||!!S.closest("form"):!0,[G,I]=j.useState(new Set),F=Array.from(G).map(B=>B.props.value).join(";");return p.jsx(jU,{...w,children:p.jsxs(FU,{required:y,scope:t,trigger:S,onTriggerChange:b,valueNode:C,onValueNodeChange:T,valueNodeHasChildren:N,onValueNodeHasChildrenChange:A,contentId:Nu(),value:_,onValueChange:M,open:D,onOpenChange:L,dir:R,triggerPointerDownPosRef:z,disabled:m,children:[p.jsx(Bp.Provider,{scope:t,children:p.jsx(qU,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(B=>{I(H=>new Set(H).add(B))},[]),onNativeOptionRemove:j.useCallback(B=>{I(H=>{const Y=new Set(H);return Y.delete(B),Y})},[]),children:n})}),P?p.jsxs(SM,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:v,value:_,onChange:B=>M(B.target.value),disabled:m,form:x,children:[_===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},F):null]})})};nM.displayName=ho;var rM="SelectTrigger",aM=j.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=zp(n),l=pl(rM,n),o=l.disabled||r,f=Cn(t,l.onTriggerChange),c=Pp(n),d=j.useRef("touch"),[v,m,y]=CM(w=>{const S=c().filter(T=>!T.disabled),b=S.find(T=>T.value===l.value),C=TM(S,w,b);C!==void 0&&l.onValueChange(C.value)}),x=w=>{o||(l.onOpenChange(!0),y()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return p.jsx(DU,{asChild:!0,...i,children:p.jsx(Yt.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":EM(l.value)?"":void 0,...a,ref:f,onClick:Wt(a.onClick,w=>{w.currentTarget.focus(),d.current!=="mouse"&&x(w)}),onPointerDown:Wt(a.onPointerDown,w=>{d.current=w.pointerType;const S=w.target;S.hasPointerCapture(w.pointerId)&&S.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(x(w),w.preventDefault())}),onKeyDown:Wt(a.onKeyDown,w=>{const S=v.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&m(w.key),!(S&&w.key===" ")&&PU.includes(w.key)&&(x(),w.preventDefault())})})})});aM.displayName=rM;var iM="SelectValue",sM=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:l="",...o}=e,f=pl(iM,n),{onValueNodeHasChildrenChange:c}=f,d=i!==void 0,v=Cn(t,f.onValueNodeChange);return vr(()=>{c(d)},[c,d]),p.jsx(Yt.span,{...o,ref:v,style:{pointerEvents:"none"},children:EM(f.value)?p.jsx(p.Fragment,{children:l}):i})});sM.displayName=iM;var VU="SelectIcon",lM=j.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return p.jsx(Yt.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});lM.displayName=VU;var HU="SelectPortal",oM=e=>p.jsx(E1,{asChild:!0,...e});oM.displayName=HU;var vo="SelectContent",uM=j.forwardRef((e,t)=>{const n=pl(vo,e.__scopeSelect),[r,a]=j.useState();if(vr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?fd.createPortal(p.jsx(cM,{scope:e.__scopeSelect,children:p.jsx(Bp.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(fM,{...e,ref:t})});uM.displayName=vo;var ja=10,[cM,ml]=oc(vo),GU="SelectContentImpl",$U=Uf("SelectContent.RemoveScroll"),fM=j.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:l,side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S,...b}=e,C=pl(vo,n),[T,N]=j.useState(null),[A,R]=j.useState(null),D=Cn(t,ae=>N(ae)),[L,_]=j.useState(null),[M,z]=j.useState(null),P=Pp(n),[G,I]=j.useState(!1),F=j.useRef(!1);j.useEffect(()=>{if(T)return Zj(T)},[T]),Vj();const B=j.useCallback(ae=>{const[we,...fe]=P().map(re=>re.ref.current),[J]=fe.slice(-1),ne=document.activeElement;for(const re of ae)if(re===ne||(re==null||re.scrollIntoView({block:"nearest"}),re===we&&A&&(A.scrollTop=0),re===J&&A&&(A.scrollTop=A.scrollHeight),re==null||re.focus(),document.activeElement!==ne))return},[P,A]),H=j.useCallback(()=>B([L,T]),[B,L,T]);j.useEffect(()=>{G&&H()},[G,H]);const{onOpenChange:Y,triggerPointerDownPosRef:Q}=C;j.useEffect(()=>{if(T){let ae={x:0,y:0};const we=J=>{var ne,re;ae={x:Math.abs(Math.round(J.pageX)-(((ne=Q.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(J.pageY)-(((re=Q.current)==null?void 0:re.y)??0))}},fe=J=>{ae.x<=10&&ae.y<=10?J.preventDefault():T.contains(J.target)||Y(!1),document.removeEventListener("pointermove",we),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",fe,{capture:!0})}}},[T,Y,Q]),j.useEffect(()=>{const ae=()=>Y(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[Y]);const[V,q]=CM(ae=>{const we=P().filter(ne=>!ne.disabled),fe=we.find(ne=>ne.ref.current===document.activeElement),J=TM(we,ae,fe);J&&setTimeout(()=>J.ref.current.focus())}),X=j.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&(_(ae),J&&(F.current=!0))},[C.value]),U=j.useCallback(()=>T==null?void 0:T.focus(),[T]),te=j.useCallback((ae,we,fe)=>{const J=!F.current&&!fe;(C.value!==void 0&&C.value===we||J)&&z(ae)},[C.value]),ie=r==="popper"?mb:dM,oe=ie===mb?{side:o,sideOffset:f,align:c,alignOffset:d,arrowPadding:v,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S}:{};return p.jsx(cM,{scope:n,content:T,viewport:A,onViewportChange:R,itemRefCallback:X,selectedItem:L,onItemLeave:U,itemTextRefCallback:te,focusSelectedItem:H,selectedItemText:M,position:r,isPositioned:G,searchRef:V,children:p.jsx(C1,{as:$U,allowPinchZoom:!0,children:p.jsx(S1,{asChild:!0,trapped:C.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Wt(a,ae=>{var we;(we=C.trigger)==null||we.focus({preventScroll:!0}),ae.preventDefault()}),children:p.jsx(w1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:p.jsx(ie,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ae=>ae.preventDefault(),...b,...oe,onPlaced:()=>I(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Wt(b.onKeyDown,ae=>{const we=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!we&&ae.key.length===1&&q(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let J=P().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const ne=ae.target,re=J.indexOf(ne);J=J.slice(re+1)}setTimeout(()=>B(J)),ae.preventDefault()}})})})})})})});fM.displayName=GU;var KU="SelectItemAlignedPosition",dM=j.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=pl(vo,n),l=ml(vo,n),[o,f]=j.useState(null),[c,d]=j.useState(null),v=Cn(t,D=>d(D)),m=Pp(n),y=j.useRef(!1),x=j.useRef(!0),{viewport:w,selectedItem:S,selectedItemText:b,focusSelectedItem:C}=l,T=j.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&c&&w&&S&&b){const D=i.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),_=i.valueNode.getBoundingClientRect(),M=b.getBoundingClientRect();if(i.dir!=="rtl"){const ne=M.left-L.left,re=_.left-ne,ge=D.left-re,ke=D.width+ge,Be=Math.max(ke,L.width),lt=window.innerWidth-ja,Ze=TT(re,[ja,Math.max(ja,lt-Be)]);o.style.minWidth=ke+"px",o.style.left=Ze+"px"}else{const ne=L.right-M.right,re=window.innerWidth-_.right-ne,ge=window.innerWidth-D.right-re,ke=D.width+ge,Be=Math.max(ke,L.width),lt=window.innerWidth-ja,Ze=TT(re,[ja,Math.max(ja,lt-Be)]);o.style.minWidth=ke+"px",o.style.right=Ze+"px"}const z=m(),P=window.innerHeight-ja*2,G=w.scrollHeight,I=window.getComputedStyle(c),F=parseInt(I.borderTopWidth,10),B=parseInt(I.paddingTop,10),H=parseInt(I.borderBottomWidth,10),Y=parseInt(I.paddingBottom,10),Q=F+B+G+Y+H,V=Math.min(S.offsetHeight*5,Q),q=window.getComputedStyle(w),X=parseInt(q.paddingTop,10),U=parseInt(q.paddingBottom,10),te=D.top+D.height/2-ja,ie=P-te,oe=S.offsetHeight/2,ae=S.offsetTop+oe,we=F+B+ae,fe=Q-we;if(we<=te){const ne=z.length>0&&S===z[z.length-1].ref.current;o.style.bottom="0px";const re=c.clientHeight-w.offsetTop-w.offsetHeight,ge=Math.max(ie,oe+(ne?U:0)+re+H),ke=we+ge;o.style.height=ke+"px"}else{const ne=z.length>0&&S===z[0].ref.current;o.style.top="0px";const ge=Math.max(te,F+w.offsetTop+(ne?X:0)+oe)+fe;o.style.height=ge+"px",w.scrollTop=we-te+w.offsetTop}o.style.margin=`${ja}px 0`,o.style.minHeight=V+"px",o.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[m,i.trigger,i.valueNode,o,c,w,S,b,i.dir,r]);vr(()=>T(),[T]);const[N,A]=j.useState();vr(()=>{c&&A(window.getComputedStyle(c).zIndex)},[c]);const R=j.useCallback(D=>{D&&x.current===!0&&(T(),C==null||C(),x.current=!1)},[T,C]);return p.jsx(XU,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:y,onScrollButtonChange:R,children:p.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:p.jsx(Yt.div,{...a,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});dM.displayName=KU;var YU="SelectPopperPosition",mb=j.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ja,...i}=e,l=zp(n);return p.jsx(MU,{...l,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});mb.displayName=YU;var[XU,$1]=oc(vo,{}),gb="SelectViewport",hM=j.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=ml(gb,n),l=$1(gb,n),o=Cn(t,i.onViewportChange),f=j.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(Bp.Slot,{scope:n,children:p.jsx(Yt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Wt(a.onScroll,c=>{const d=c.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:m}=l;if(m!=null&&m.current&&v){const y=Math.abs(f.current-d.scrollTop);if(y>0){const x=window.innerHeight-ja*2,w=parseFloat(v.style.minHeight),S=parseFloat(v.style.height),b=Math.max(w,S);if(b<x){const C=b+y,T=Math.min(x,C),N=C-T;v.style.height=T+"px",v.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,v.style.justifyContent="flex-end")}}}f.current=d.scrollTop})})})]})});hM.displayName=gb;var vM="SelectGroup",[QU,WU]=oc(vM),ZU=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Nu();return p.jsx(QU,{scope:n,id:a,children:p.jsx(Yt.div,{role:"group","aria-labelledby":a,...r,ref:t})})});ZU.displayName=vM;var pM="SelectLabel",JU=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=WU(pM,n);return p.jsx(Yt.div,{id:a.id,...r,ref:t})});JU.displayName=pM;var Xv="SelectItem",[e8,mM]=oc(Xv),gM=j.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...l}=e,o=pl(Xv,n),f=ml(Xv,n),c=o.value===r,[d,v]=j.useState(i??""),[m,y]=j.useState(!1),x=Cn(t,C=>{var T;return(T=f.itemRefCallback)==null?void 0:T.call(f,C,r,a)}),w=Nu(),S=j.useRef("touch"),b=()=>{a||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(e8,{scope:n,value:r,disabled:a,textId:w,isSelected:c,onItemTextChange:j.useCallback(C=>{v(T=>T||((C==null?void 0:C.textContent)??"").trim())},[]),children:p.jsx(Bp.ItemSlot,{scope:n,value:r,disabled:a,textValue:d,children:p.jsx(Yt.div,{role:"option","aria-labelledby":w,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:x,onFocus:Wt(l.onFocus,()=>y(!0)),onBlur:Wt(l.onBlur,()=>y(!1)),onClick:Wt(l.onClick,()=>{S.current!=="mouse"&&b()}),onPointerUp:Wt(l.onPointerUp,()=>{S.current==="mouse"&&b()}),onPointerDown:Wt(l.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:Wt(l.onPointerMove,C=>{var T;S.current=C.pointerType,a?(T=f.onItemLeave)==null||T.call(f):S.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Wt(l.onPointerLeave,C=>{var T;C.currentTarget===document.activeElement&&((T=f.onItemLeave)==null||T.call(f))}),onKeyDown:Wt(l.onKeyDown,C=>{var N;((N=f.searchRef)==null?void 0:N.current)!==""&&C.key===" "||(zU.includes(C.key)&&b(),C.key===" "&&C.preventDefault())})})})})});gM.displayName=Xv;var Nf="SelectItemText",yM=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,l=pl(Nf,n),o=ml(Nf,n),f=mM(Nf,n),c=UU(Nf,n),[d,v]=j.useState(null),m=Cn(t,b=>v(b),f.onItemTextChange,b=>{var C;return(C=o.itemTextRefCallback)==null?void 0:C.call(o,b,f.value,f.disabled)}),y=d==null?void 0:d.textContent,x=j.useMemo(()=>p.jsx("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:S}=c;return vr(()=>(w(x),()=>S(x)),[w,S,x]),p.jsxs(p.Fragment,{children:[p.jsx(Yt.span,{id:f.textId,...i,ref:m}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?fd.createPortal(i.children,l.valueNode):null]})});yM.displayName=Nf;var xM="SelectItemIndicator",bM=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return mM(xM,n).isSelected?p.jsx(Yt.span,{"aria-hidden":!0,...r,ref:t}):null});bM.displayName=xM;var yb="SelectScrollUpButton",t8=j.forwardRef((e,t)=>{const n=ml(yb,e.__scopeSelect),r=$1(yb,e.__scopeSelect),[a,i]=j.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollTop>0;i(c)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(wM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop-f.offsetHeight)}}):null});t8.displayName=yb;var xb="SelectScrollDownButton",n8=j.forwardRef((e,t)=>{const n=ml(xb,e.__scopeSelect),r=$1(xb,e.__scopeSelect),[a,i]=j.useState(!1),l=Cn(t,r.onScrollButtonChange);return vr(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=f.scrollHeight-f.clientHeight,d=Math.ceil(f.scrollTop)<c;i(d)};const f=n.viewport;return o(),f.addEventListener("scroll",o),()=>f.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?p.jsx(wM,{...e,ref:l,onAutoScroll:()=>{const{viewport:o,selectedItem:f}=n;o&&f&&(o.scrollTop=o.scrollTop+f.offsetHeight)}}):null});n8.displayName=xb;var wM=j.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=ml("SelectScrollButton",n),l=j.useRef(null),o=Pp(n),f=j.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return j.useEffect(()=>()=>f(),[f]),vr(()=>{var d;const c=o().find(v=>v.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),p.jsx(Yt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Wt(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Wt(a.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Wt(a.onPointerLeave,()=>{f()})})}),r8="SelectSeparator",a8=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Yt.div,{"aria-hidden":!0,...r,ref:t})});a8.displayName=r8;var bb="SelectArrow",i8=j.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=zp(n),i=pl(bb,n),l=ml(bb,n);return i.open&&l.position==="popper"?p.jsx(OU,{...a,...r,ref:t}):null});i8.displayName=bb;var s8="SelectBubbleInput",SM=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=j.useRef(null),i=Cn(r,a),l=LU(t);return j.useEffect(()=>{const o=a.current;if(!o)return;const f=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==t&&d){const v=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(v)}},[l,t]),p.jsx(Yt.select,{...n,style:{...tM,...n.style},ref:i,defaultValue:t})});SM.displayName=s8;function EM(e){return e===""||e===void 0}function CM(e){const t=uo(e),n=j.useRef(""),r=j.useRef(0),a=j.useCallback(l=>{const o=n.current+l;t(o),(function f(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>f(""),1e3))})(o)},[t]),i=j.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function TM(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=l8(e,Math.max(i,0));a.length===1&&(l=l.filter(c=>c!==n));const f=l.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}function l8(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var o8=nM,kM=aM,u8=sM,c8=lM,f8=oM,NM=uM,d8=hM,AM=gM,h8=yM,v8=bM;const io=o8,so=u8,tl=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(kM,{ref:r,className:Ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(c8,{asChild:!0,children:p.jsx(_a,{className:"h-4 w-4 opacity-50"})})]}));tl.displayName=kM.displayName;const nl=j.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>p.jsx(f8,{children:p.jsx(NM,{ref:a,className:Ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:p.jsx(d8,{className:Ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));nl.displayName=NM.displayName;const rl=j.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(AM,{ref:r,className:Ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(v8,{children:p.jsx(gp,{className:"h-4 w-4"})})}),p.jsx(h8,{children:t})]}));rl.displayName=AM.displayName;function K1({searchPlaceholder:e="Search...",searchValue:t,onSearchChange:n,filters:r=[],filterValues:a={},onFilterChange:i}){return p.jsxs(st,{level:"bright",className:"flex items-center gap-3 px-4 py-2 rounded-md",children:[p.jsx(nc,{className:"h-3.5 w-3.5 text-on-surface-variant shrink-0"}),p.jsx(fn,{placeholder:e,value:t,onChange:l=>n(l.target.value),className:"bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1","aria-label":e}),r.map(l=>p.jsx("div",{className:"w-40 shrink-0",children:p.jsxs(io,{value:a[l.key]??"all",onValueChange:o=>i==null?void 0:i(l.key,o),children:[p.jsx(tl,{children:p.jsx(so,{placeholder:l.label})}),p.jsx(nl,{children:l.options.map(o=>p.jsx(rl,{value:o.value,children:o.label},o.value))})]})},l.key))]})}function Ip({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;const i=t>0,l=t+n<e,o=t+1,f=Math.min(t+n,e);return p.jsxs("div",{className:"flex items-center justify-center gap-3 pt-1",children:[p.jsxs(Ke,{variant:"ghost",size:"sm",disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:"gap-1 text-on-surface-variant",children:[p.jsx(h1,{className:"h-4 w-4"}),"Prev"]}),p.jsxs("span",{className:"font-mono text-xs text-on-surface-variant",children:[o,"–",f," of ",e]}),p.jsxs(Ke,{variant:"ghost",size:"sm",disabled:!l,onClick:()=>r(t+n),className:"gap-1 text-on-surface-variant",children:["Next",p.jsx(Ea,{className:"h-4 w-4"})]})]})}const p8=ra.STATS,m8=ra.STATS,g8=ra.STATS,y8=3e4,x8=6e4,b8=1e4,w8=6e4;function S8(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.agent&&t.set("agent",e.agent),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!==void 0&&t.set("offset",String(e.offset));const n=t.toString(),r=n?`/sessions?${n}`:"/sessions";return Fa({queryKey:["sessions",e],queryFn:({signal:a})=>bt(r,{signal:a}),pollCategory:"standard",refetchInterval:p8})}function E8(e){return Fa({queryKey:["session",e],queryFn:({signal:t})=>bt(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:m8})}function C8(e){return Fa({queryKey:["session-batches",e],queryFn:({signal:t})=>bt(`/sessions/${e}/batches`,{signal:t}),enabled:e!==void 0,pollCategory:"standard",refetchInterval:g8})}function T8(e){return Tn({queryKey:["batch-activities",e],queryFn:({signal:t})=>bt(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:y8})}function k8(e){return Tn({queryKey:["session-attachments",e],queryFn:({signal:t})=>bt(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:x8})}function RM(){const e=Ca();return vl({mutationFn:t=>Aj(`/sessions/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]})}})}function jM(e){return Tn({queryKey:["session-impact",e],queryFn:({signal:t})=>bt(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:b8})}function DM(e){return Tn({queryKey:["session-plans",e],queryFn:({signal:t})=>bt(`/sessions/${e}/plans`,{signal:t}),enabled:!!e,staleTime:w8})}const N8=300;function A8(e,t=N8){const[n,r]=j.useState(e);return j.useEffect(()=>{const a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}const Tr="all";function Y1({initialFilters:e}){const[t,n]=j.useState(""),r=A8(t),[a,i]=j.useState(e),[l,o]=j.useState(0),f=j.useCallback((v,m)=>{i(y=>({...y,[v]:m})),o(0)},[]),c=j.useCallback(v=>{n(v),o(0)},[]),d=j.useCallback(v=>{const m=a[v];return m&&m!==Tr?m:void 0},[a]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:a,offset:l,setOffset:o,handleSearchChange:c,handleFilterChange:f,activeFilter:d}}function MM(e){return e==="active"?"active":e==="completed"?"completed":"error"}const R8={active:"bg-primary",completed:"bg-secondary",error:"bg-tertiary"},j8={active:"bg-primary/15 text-primary",completed:"bg-surface-container-high text-on-surface-variant",error:"bg-tertiary/15 text-tertiary"};function D8({status:e}){const t=MM(e);return p.jsx("span",{className:Ae("inline-block h-2 w-2 rounded-full shrink-0",R8[t])})}function OM({status:e}){const t=MM(e),n=e.charAt(0).toUpperCase()+e.slice(1);return p.jsxs("span",{className:Ae("inline-flex items-center gap-1.5 rounded-sm px-2 py-0.5 font-sans text-xs font-medium",j8[t]),children:[p.jsx(D8,{status:e}),n]})}const M8=5,wb=8,O8=12,L8=[{key:"status",label:"Status",options:[{value:Tr,label:"All statuses"},{value:"active",label:"Active"},{value:"completed",label:"Completed"}]},{key:"agent",label:"Agent",options:[{value:Tr,label:"All agents"},{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"}]}];function _8({session:e,onClick:t,onDelete:n}){const r=e.title||e.id.slice(0,wb);return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]",onClick:t,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},tabIndex:0,role:"row","aria-label":`Session: ${r}`,children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.id.slice(0,O8)})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("span",{className:"font-sans text-sm font-medium text-on-surface truncate block max-w-xs",children:r})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ln,{variant:"outline",className:"font-mono text-[10px] px-1.5 py-0",children:e.agent||"unknown"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(OM,{status:e.status})}),p.jsx("td",{className:"px-4 py-3 text-center",children:p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.prompt_count})}),p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:e.date}),p.jsx("button",{onClick:a=>{a.stopPropagation(),n()},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.stopPropagation()},className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-tertiary/10 hover:text-tertiary transition-all shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tertiary/40","aria-label":`Delete session ${r}`,title:"Delete session",children:p.jsx(qf,{className:"h-3.5 w-3.5"})})]})})]})}function B8(){return p.jsxs("tr",{className:"border-b border-[var(--ghost-border)]",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-40 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-16 rounded bg-surface-container-high animate-pulse"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-8 rounded bg-surface-container-high animate-pulse mx-auto"})}),p.jsx("td",{className:"px-4 py-3",children:p.jsx("div",{className:"h-3 w-20 rounded bg-surface-container-high animate-pulse"})})]})}function uu({children:e,className:t}){return p.jsx("th",{className:Ae("px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}function P8(){const e=Wi(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:a,setOffset:i,handleSearchChange:l,handleFilterChange:o,activeFilter:f}=Y1({initialFilters:{status:Tr,agent:Tr}}),[c,d]=j.useState(null),v=RM(),{data:m}=jM((c==null?void 0:c.id)??null),y=f("status"),x=f("agent"),{data:w,isLoading:S,isError:b,error:C}=S8({limit:ni,offset:a,status:y,agent:x,search:n});function T(){c&&v.mutate(c.id,{onSuccess:()=>d(null)})}const N=(w==null?void 0:w.sessions)??[],A=(w==null?void 0:w.total)??0,R=p.jsx(K1,{searchPlaceholder:"Search sessions...",searchValue:t,onSearchChange:l,filters:L8,filterValues:r,onFilterChange:o}),D=p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-[var(--ghost-border)] bg-surface-container/50",children:[p.jsx(uu,{children:"Session ID"}),p.jsx(uu,{children:"Title"}),p.jsx(uu,{children:"Agent"}),p.jsx(uu,{children:"Status"}),p.jsx(uu,{className:"text-center",children:"Turns"}),p.jsx(uu,{children:"Date"})]})});return b?p.jsxs("div",{children:[p.jsx(Gi,{title:"Session Archive"}),R,p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4",children:[p.jsx(Zi,{className:"h-5 w-5"}),p.jsx("span",{className:"font-sans text-sm",children:"Failed to load sessions"}),p.jsx("span",{className:"font-sans text-xs text-on-surface-variant",children:C instanceof Error?C.message:"Unknown error"})]})]}):p.jsxs("div",{children:[p.jsx(Gi,{title:"Session Archive",subtitle:S?"Loading...":`${A} session${A!==1?"s":""} captured`}),R,S?p.jsx(st,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full",children:[D,p.jsx("tbody",{children:Array.from({length:M8}).map((L,_)=>p.jsx(B8,{},_))})]})}):N.length===0?p.jsxs("div",{className:"flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4",children:[p.jsx(xp,{className:"h-8 w-8 opacity-30"}),p.jsx("span",{className:"font-sans text-sm",children:A===0&&!n&&!y&&!x?"No sessions yet":"No matching sessions"}),A===0&&!n&&!y&&!x&&p.jsx("span",{className:"font-sans text-xs",children:"Sessions appear here as you work with your agent"})]}):p.jsx(st,{level:"low",className:"rounded-md overflow-hidden mt-4",children:p.jsxs("table",{className:"w-full","aria-label":"Session archive",children:[D,p.jsx("tbody",{children:N.map(L=>p.jsx(_8,{session:L,onClick:()=>e(`/sessions/${L.id}`),onDelete:()=>d(L)},L.id))})]})}),p.jsx(Ip,{total:A,offset:a,limit:ni,onPageChange:i}),p.jsx(MD,{open:c!==null,onOpenChange:L=>{L||d(null)},title:"Delete Session",description:"This will permanently remove this session and all related data. This action cannot be undone.",icon:p.jsx(qf,{className:"h-4 w-4 text-tertiary"}),meta:c?[{label:"ID",value:c.id.slice(0,wb)},{label:"Title",value:c.title||c.id.slice(0,wb)}]:[],impact:m?[{label:"Prompts",value:m.promptCount},{label:"Spores",value:m.sporeCount},{label:"Attachments",value:m.attachmentCount},{label:"Graph Edges",value:m.graphEdgeCount}]:[],confirmLabel:"Delete Session",variant:"destructive",onConfirm:T,isPending:v.isPending})]})}function Zt({children:e,className:t}){return p.jsx("div",{className:Ae("font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant",t),children:e})}const z8=3e5;function I8(){return Tn({queryKey:["symbionts"],queryFn:({signal:e})=>bt("/symbionts",{signal:e}),staleTime:z8})}function F8(e,t,n){const r=e.find(a=>a.name===t);return r!=null&&r.resumeCommand?r.resumeCommand.replace("{sessionId}",n):null}function q8(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,V8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H8={};function PT(e,t){return(H8.jsx?V8:U8).test(e)}const G8=/[ \t\n\f\r]/g;function $8(e){return typeof e=="object"?e.type==="text"?zT(e.value):!1:zT(e)}function zT(e){return e.replace(G8,"")===""}class md{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}md.prototype.normal={};md.prototype.property={};md.prototype.space=void 0;function LM(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new md(n,r,t)}function Sb(e){return e.toLowerCase()}class Ur{constructor(t,n){this.attribute=n,this.property=t}}Ur.prototype.attribute="";Ur.prototype.booleanish=!1;Ur.prototype.boolean=!1;Ur.prototype.commaOrSpaceSeparated=!1;Ur.prototype.commaSeparated=!1;Ur.prototype.defined=!1;Ur.prototype.mustUseProperty=!1;Ur.prototype.number=!1;Ur.prototype.overloadedBoolean=!1;Ur.prototype.property="";Ur.prototype.spaceSeparated=!1;Ur.prototype.space=void 0;let K8=0;const gt=So(),Dn=So(),Eb=So(),Ne=So(),Qt=So(),ju=So(),Wr=So();function So(){return 2**++K8}const Cb=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Dn,commaOrSpaceSeparated:Wr,commaSeparated:ju,number:Ne,overloadedBoolean:Eb,spaceSeparated:Qt},Symbol.toStringTag,{value:"Module"})),Fy=Object.keys(Cb);class X1 extends Ur{constructor(t,n,r,a){let i=-1;if(super(t,n),IT(this,"space",a),typeof r=="number")for(;++i<Fy.length;){const l=Fy[i];IT(this,Fy[i],(r&Cb[l])===Cb[l])}}}X1.prototype.defined=!0;function IT(e,t,n){n&&(e[t]=n)}function uc(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new X1(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Sb(r)]=r,n[Sb(i.attribute)]=r}return new md(t,n,e.space)}const _M=uc({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:Ne,ariaColIndex:Ne,ariaColSpan:Ne,ariaControls:Qt,ariaCurrent:null,ariaDescribedBy:Qt,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:Qt,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:Qt,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qt,ariaLevel:Ne,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:Qt,ariaPlaceholder:null,ariaPosInSet:Ne,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:Qt,ariaRowCount:Ne,ariaRowIndex:Ne,ariaRowSpan:Ne,ariaSelected:Dn,ariaSetSize:Ne,ariaSort:null,ariaValueMax:Ne,ariaValueMin:Ne,ariaValueNow:Ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function BM(e,t){return t in e?e[t]:t}function PM(e,t){return BM(e,t.toLowerCase())}const Y8=uc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ju,acceptCharset:Qt,accessKey:Qt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Qt,autoFocus:gt,autoPlay:gt,blocking:Qt,capture:null,charSet:null,checked:gt,cite:null,className:Qt,cols:Ne,colSpan:null,content:null,contentEditable:Dn,controls:gt,controlsList:Qt,coords:Ne|ju,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:Eb,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Qt,height:Ne,hidden:Eb,high:Ne,href:null,hrefLang:null,htmlFor:Qt,httpEquiv:Qt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Qt,itemRef:Qt,itemScope:gt,itemType:Qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Ne,manifest:null,max:null,maxLength:Ne,media:null,method:null,min:null,minLength:Ne,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:Ne,pattern:null,ping:Qt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Qt,required:gt,reversed:gt,rows:Ne,rowSpan:Ne,sandbox:Qt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Ne,sizes:null,slot:null,span:Ne,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ne,step:null,style:null,tabIndex:Ne,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Dn,width:Ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qt,axis:null,background:null,bgColor:null,border:Ne,borderColor:null,bottomMargin:Ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ne,leftMargin:Ne,link:null,longDesc:null,lowSrc:null,marginHeight:Ne,marginWidth:Ne,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ne,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:Ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Ne,security:null,unselectable:null},space:"html",transform:PM}),X8=uc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wr,accentHeight:Ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ne,amplitude:Ne,arabicForm:null,ascent:Ne,attributeName:null,attributeType:null,azimuth:Ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ne,by:null,calcMode:null,capHeight:Ne,className:Qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ne,diffuseConstant:Ne,direction:null,display:null,dur:null,divisor:Ne,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ne,enableBackground:null,end:null,event:null,exponent:Ne,externalResourcesRequired:null,fill:null,fillOpacity:Ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ju,g2:ju,glyphName:ju,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ne,horizOriginX:Ne,horizOriginY:Ne,id:null,ideographic:Ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ne,k:Ne,k1:Ne,k2:Ne,k3:Ne,k4:Ne,kernelMatrix:Wr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ne,overlineThickness:Ne,paintOrder:null,panose1:null,path:null,pathLength:Ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ne,pointsAtY:Ne,pointsAtZ:Ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wr,rev:Wr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wr,requiredFeatures:Wr,requiredFonts:Wr,requiredFormats:Wr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ne,specularExponent:Ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ne,strikethroughThickness:Ne,string:null,stroke:null,strokeDashArray:Wr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ne,strokeOpacity:Ne,strokeWidth:null,style:null,surfaceScale:Ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wr,tabIndex:Ne,tableValues:null,target:null,targetX:Ne,targetY:Ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ne,underlineThickness:Ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ne,values:null,vAlphabetic:Ne,vMathematical:Ne,vectorEffect:null,vHanging:Ne,vIdeographic:Ne,version:null,vertAdvY:Ne,vertOriginX:Ne,vertOriginY:Ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:BM}),zM=uc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),IM=uc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:PM}),FM=uc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Q8={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},W8=/[A-Z]/g,FT=/-[a-z]/g,Z8=/^data[-\w.:]+$/i;function J8(e,t){const n=Sb(t);let r=t,a=Ur;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Z8.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(FT,tV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!FT.test(i)){let l=i.replace(W8,eV);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=X1}return new a(r,t)}function eV(e){return"-"+e.toLowerCase()}function tV(e){return e.charAt(1).toUpperCase()}const nV=LM([_M,Y8,zM,IM,FM],"html"),Q1=LM([_M,X8,zM,IM,FM],"svg");function rV(e){return e.join(" ").trim()}var cu={},qy,qT;function aV(){if(qT)return qy;qT=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
430
430
  `,c="/",d="*",v="",m="comment",y="declaration";function x(S,b){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];b=b||{};var C=1,T=1;function N(I){var F=I.match(t);F&&(C+=F.length);var B=I.lastIndexOf(f);T=~B?I.length-B:T+I.length}function A(){var I={line:C,column:T};return function(F){return F.position=new R(I),_(),F}}function R(I){this.start=I,this.end={line:C,column:T},this.source=b.source}R.prototype.content=S;function D(I){var F=new Error(b.source+":"+C+":"+T+": "+I);if(F.reason=I,F.filename=b.source,F.line=C,F.column=T,F.source=S,!b.silent)throw F}function L(I){var F=I.exec(S);if(F){var B=F[0];return N(B),S=S.slice(B.length),F}}function _(){L(n)}function M(I){var F;for(I=I||[];F=z();)F!==!1&&I.push(F);return I}function z(){var I=A();if(!(c!=S.charAt(0)||d!=S.charAt(1))){for(var F=2;v!=S.charAt(F)&&(d!=S.charAt(F)||c!=S.charAt(F+1));)++F;if(F+=2,v===S.charAt(F-1))return D("End of comment missing");var B=S.slice(2,F-2);return T+=2,N(B),S=S.slice(F),T+=2,I({type:m,comment:B})}}function P(){var I=A(),F=L(r);if(F){if(z(),!L(a))return D("property missing ':'");var B=L(i),H=I({type:y,property:w(F[0].replace(e,v)),value:B?w(B[0].replace(e,v)):v});return L(l),H}}function G(){var I=[];M(I);for(var F;F=P();)F!==!1&&(I.push(F),M(I));return I}return _(),G()}function w(S){return S?S.replace(o,v):v}return qy=x,qy}var UT;function iV(){if(UT)return cu;UT=1;var e=cu&&cu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(cu,"__esModule",{value:!0}),cu.default=n;const t=e(aV());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const l=(0,t.default)(r),o=typeof a=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:c,value:d}=f;o?a(c,d,f):d&&(i=i||{},i[c]=d)}),i}return cu}var hf={},VT;function sV(){if(VT)return hf;VT=1,Object.defineProperty(hf,"__esModule",{value:!0}),hf.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},l=function(c,d){return d.toUpperCase()},o=function(c,d){return"".concat(d,"-")},f=function(c,d){return d===void 0&&(d={}),i(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(a,o):c=c.replace(r,o),c.replace(t,l))};return hf.camelCase=f,hf}var vf,HT;function lV(){if(HT)return vf;HT=1;var e=vf&&vf.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(iV()),n=sV();function r(a,i){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(o,f){o&&f&&(l[(0,n.camelCase)(o,i)]=f)}),l}return r.default=r,vf=r,vf}var oV=lV();const uV=ld(oV),qM=UM("end"),W1=UM("start");function UM(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function cV(e){const t=W1(e),n=qM(e);if(t&&n)return{start:t,end:n}}function Mf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?GT(e.position):"start"in e||"end"in e?GT(e):"line"in e||"column"in e?Tb(e):""}function Tb(e){return $T(e&&e.line)+":"+$T(e&&e.column)}function GT(e){return Tb(e&&e.start)+"-"+Tb(e&&e.end)}function $T(e){return e&&typeof e=="number"?e:1}class gr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(l=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?i.ruleId=r:(i.source=r.slice(0,f),i.ruleId=r.slice(f+1))}if(!i.place&&i.ancestors&&i.ancestors){const f=i.ancestors[i.ancestors.length-1];f&&(i.place=f.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Mf(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gr.prototype.file="";gr.prototype.name="";gr.prototype.reason="";gr.prototype.message="";gr.prototype.stack="";gr.prototype.column=void 0;gr.prototype.line=void 0;gr.prototype.ancestors=void 0;gr.prototype.cause=void 0;gr.prototype.fatal=void 0;gr.prototype.place=void 0;gr.prototype.ruleId=void 0;gr.prototype.source=void 0;const Z1={}.hasOwnProperty,fV=new Map,dV=/[A-Z]/g,hV=new Set(["table","tbody","thead","tfoot","tr"]),vV=new Set(["td","th"]),VM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pV(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=EV(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=SV(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Q1:nV,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=HM(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function HM(e,t,n){if(t.type==="element")return mV(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gV(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return xV(e,t,n);if(t.type==="mdxjsEsm")return yV(e,t);if(t.type==="root")return bV(e,t,n);if(t.type==="text")return wV(e,t)}function mV(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Q1,e.schema=a),e.ancestors.push(t);const i=$M(e,t.tagName,!1),l=CV(e,t);let o=ew(e,t);return hV.has(t.tagName)&&(o=o.filter(function(f){return typeof f=="string"?!$8(f):!0})),GM(e,l,i,t),J1(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function gV(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Hf(e,t.position)}function yV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hf(e,t.position)}function xV(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Q1,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:$M(e,t.name,!0),l=TV(e,t),o=ew(e,t);return GM(e,l,i,t),J1(l,o),e.ancestors.pop(),e.schema=r,e.create(t,i,l,n)}function bV(e,t,n){const r={};return J1(r,ew(e,t)),e.create(t,e.Fragment,r,n)}function wV(e,t){return t.value}function GM(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function J1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function SV(e,t,n){return r;function r(a,i,l,o){const c=Array.isArray(l.children)?n:t;return o?c(i,l,o):c(i,l)}}function EV(e,t){return n;function n(r,a,i,l){const o=Array.isArray(i.children),f=W1(r);return t(a,i,l,o,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function CV(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Z1.call(t.properties,a)){const i=kV(e,a,t.properties[a]);if(i){const[l,o]=i;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&vV.has(t.tagName)?r=o:n[l]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function TV(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Hf(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Hf(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function ew(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:fV;for(;++r<t.children.length;){const i=t.children[r];let l;if(e.passKeys){const f=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(f){const c=a.get(f)||0;l=f+"-"+c,a.set(f,c+1)}}const o=HM(e,i,l);o!==void 0&&n.push(o)}return n}function kV(e,t,n){const r=J8(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?q8(n):rV(n)),r.property==="style"){let a=typeof n=="object"?n:NV(e,String(n));return e.stylePropertyNameCase==="css"&&(a=AV(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Q8[r.property]||r.property:r.attribute,n]}}function NV(e,t){try{return uV(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new gr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=VM+"#cannot-parse-style-attribute",a}}function $M(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,l;for(;++i<a.length;){const o=PT(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=l}else r=PT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Z1.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hf(e)}function Hf(e,t){const n=new gr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=VM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function AV(e){const t={};let n;for(n in e)Z1.call(e,n)&&(t[RV(n)]=e[n]);return t}function RV(e){let t=e.replace(dV,jV);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jV(e){return"-"+e.toLowerCase()}const Uy={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},DV={};function tw(e,t){const n=DV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return KM(e,r,a)}function KM(e,t,n){if(MV(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return KT(e.children,t,n)}return Array.isArray(e)?KT(e,t,n):""}function KT(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=KM(e[a],t,n);return r.join("")}function MV(e){return!!(e&&typeof e=="object")}const YT=document.createElement("i");function nw(e){const t="&"+e+";";YT.innerHTML=t;const n=YT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ta(e,t,n,r){const a=e.length;let i=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);i<r.length;)l=r.slice(i,i+1e4),l.unshift(t,0),e.splice(...l),i+=1e4,t+=1e4}function ba(e,t){return e.length>0?(ta(e,e.length,0,t),e):t}const XT={}.hasOwnProperty;function YM(e){const t={};let n=-1;for(;++n<e.length;)OV(t,e[n]);return t}function OV(e,t){let n;for(n in t){const a=(XT.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let l;if(i)for(l in i){XT.call(a,l)||(a[l]=[]);const o=i[l];LV(a[l],Array.isArray(o)?o:o?[o]:[])}}}function LV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ta(e,0,0,r)}function XM(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Oa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Er=gl(/[A-Za-z]/),hr=gl(/[\dA-Za-z]/),_V=gl(/[#-'*+\--9=?A-Z^-~]/);function Qv(e){return e!==null&&(e<32||e===127)}const kb=gl(/\d/),BV=gl(/[\dA-Fa-f]/),PV=gl(/[!-/:-@[-`{-~]/);function nt(e){return e!==null&&e<-2}function Kt(e){return e!==null&&(e<0||e===32)}function Et(e){return e===-2||e===-1||e===32}const Fp=gl(new RegExp("\\p{P}|\\p{S}","u")),po=gl(/\s/);function gl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function cc(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let l="";if(i===37&&hr(e.charCodeAt(n+1))&&hr(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(l=String.fromCharCode(i,o),a=1):l="�"}else l=String.fromCharCode(i);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function At(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(f){return Et(f)?(e.enter(n),o(f)):t(f)}function o(f){return Et(f)&&i++<a?(e.consume(f),o):(e.exit(n),t(f))}}const zV={tokenize:IV};function IV(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),At(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return nt(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),l)}}const FV={tokenize:qV},QT={tokenize:UV};function qV(e){const t=this,n=[];let r=0,a,i,l;return o;function o(T){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,f,c)(T)}return c(T)}function f(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const N=t.events.length;let A=N,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){R=t.events[A][1].end;break}b(r);let D=N;for(;D<t.events.length;)t.events[D][1].end={...R},D++;return ta(t.events,A+1,0,t.events.slice(N)),t.events.length=D,c(T)}return o(T)}function c(T){if(r===n.length){if(!a)return m(T);if(a.currentConstruct&&a.currentConstruct.concrete)return x(T);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(QT,d,v)(T)}function d(T){return a&&C(),b(r),m(T)}function v(T){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(T)}function m(T){return t.containerState={},e.attempt(QT,y,x)(T)}function y(T){return r++,n.push([t.currentConstruct,t.containerState]),m(T)}function x(T){if(T===null){a&&C(),b(0),e.consume(T);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),w(T)}function w(T){if(T===null){S(e.exit("chunkFlow"),!0),b(0),e.consume(T);return}return nt(T)?(e.consume(T),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(T),w)}function S(T,N){const A=t.sliceStream(T);if(N&&A.push(null),T.previous=i,i&&(i.next=T),i=T,a.defineSkip(T.start),a.write(A),t.parser.lazy[T.start.line]){let R=a.events.length;for(;R--;)if(a.events[R][1].start.offset<l&&(!a.events[R][1].end||a.events[R][1].end.offset>l))return;const D=t.events.length;let L=D,_,M;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(_){M=t.events[L][1].end;break}_=!0}for(b(r),R=D;R<t.events.length;)t.events[R][1].end={...M},R++;ta(t.events,L+1,0,t.events.slice(D)),t.events.length=R}}function b(T){let N=n.length;for(;N-- >T;){const A=n[N];t.containerState=A[1],A[0].exit.call(t,e)}n.length=T}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function UV(e,t,n){return At(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xu(e){if(e===null||Kt(e)||po(e))return 1;if(Fp(e))return 2}function qp(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Nb={name:"attention",resolveAll:VV,tokenize:HV};function VV(e,t){let n=-1,r,a,i,l,o,f,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[r][1].end},m={...e[n][1].start};WT(v,-f),WT(m,f),l={type:f>1?"strongSequence":"emphasisSequence",start:v,end:{...e[r][1].end}},o={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ba(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=ba(c,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",i,t]]),c=ba(c,qp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=ba(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ba(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ta(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Xu(r);let i;return l;function l(f){return i=f,e.enter("attentionSequence"),o(f)}function o(f){if(f===i)return e.consume(f),o;const c=e.exit("attentionSequence"),d=Xu(f),v=!d||d===2&&a||n.includes(f),m=!a||a===2&&d||n.includes(r);return c._open=!!(i===42?v:v&&(a||!m)),c._close=!!(i===42?m:m&&(d||!v)),t(f)}}function WT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const GV={name:"autolink",tokenize:$V};function $V(e,t,n){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Er(y)?(e.consume(y),l):y===64?n(y):c(y)}function l(y){return y===43||y===45||y===46||hr(y)?(r=1,o(y)):c(y)}function o(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||hr(y))&&r++<32?(e.consume(y),o):(r=0,c(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Qv(y)?n(y):(e.consume(y),f)}function c(y){return y===64?(e.consume(y),d):_V(y)?(e.consume(y),c):n(y)}function d(y){return hr(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),r=0,d):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):m(y)}function m(y){if((y===45||hr(y))&&r++<63){const x=y===45?m:v;return e.consume(y),x}return n(y)}}const gd={partial:!0,tokenize:KV};function KV(e,t,n){return r;function r(i){return Et(i)?At(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||nt(i)?t(i):n(i)}}const QM={continuation:{tokenize:XV},exit:QV,name:"blockQuote",tokenize:YV};function YV(e,t,n){const r=this;return a;function a(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),i}return n(l)}function i(l){return Et(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function XV(e,t,n){const r=this;return a;function a(l){return Et(l)?At(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return e.attempt(QM,t,n)(l)}}function QV(e){e.exit("blockQuote")}const WM={name:"characterEscape",tokenize:WV};function WV(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return PV(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const ZM={name:"characterReference",tokenize:ZV};function ZV(e,t,n){const r=this;let a=0,i,l;return o;function o(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),f}function f(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,l=hr,d(v))}function c(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,l=BV,d):(e.enter("characterReferenceValue"),i=7,l=kb,d(v))}function d(v){if(v===59&&a){const m=e.exit("characterReferenceValue");return l===hr&&!nw(r.sliceSerialize(m))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(v)&&a++<i?(e.consume(v),d):n(v)}}const ZT={partial:!0,tokenize:e9},JT={concrete:!0,name:"codeFenced",tokenize:JV};function JV(e,t,n){const r=this,a={partial:!0,tokenize:A};let i=0,l=0,o;return f;function f(R){return c(R)}function c(R){const D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,o=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(R)}function d(R){return R===o?(l++,e.consume(R),d):l<3?n(R):(e.exit("codeFencedFenceSequence"),Et(R)?At(e,v,"whitespace")(R):v(R))}function v(R){return R===null||nt(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(ZT,w,N)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(R))}function m(R){return R===null||nt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(R)):Et(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),At(e,y,"whitespace")(R)):R===96&&R===o?n(R):(e.consume(R),m)}function y(R){return R===null||nt(R)?v(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===null||nt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(R)):R===96&&R===o?n(R):(e.consume(R),x)}function w(R){return e.attempt(a,N,S)(R)}function S(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),b}function b(R){return i>0&&Et(R)?At(e,C,"linePrefix",i+1)(R):C(R)}function C(R){return R===null||nt(R)?e.check(ZT,w,N)(R):(e.enter("codeFlowValue"),T(R))}function T(R){return R===null||nt(R)?(e.exit("codeFlowValue"),C(R)):(e.consume(R),T)}function N(R){return e.exit("codeFenced"),t(R)}function A(R,D,L){let _=0;return M;function M(F){return R.enter("lineEnding"),R.consume(F),R.exit("lineEnding"),z}function z(F){return R.enter("codeFencedFence"),Et(F)?At(R,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):P(F)}function P(F){return F===o?(R.enter("codeFencedFenceSequence"),G(F)):L(F)}function G(F){return F===o?(_++,R.consume(F),G):_>=l?(R.exit("codeFencedFenceSequence"),Et(F)?At(R,I,"whitespace")(F):I(F)):L(F)}function I(F){return F===null||nt(F)?(R.exit("codeFencedFence"),D(F)):L(F)}}}function e9(e,t,n){const r=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Vy={name:"codeIndented",tokenize:n9},t9={partial:!0,tokenize:r9};function n9(e,t,n){const r=this;return a;function a(c){return e.enter("codeIndented"),At(e,i,"linePrefix",5)(c)}function i(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?l(c):n(c)}function l(c){return c===null?f(c):nt(c)?e.attempt(t9,l,f)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||nt(c)?(e.exit("codeFlowValue"),l(c)):(e.consume(c),o)}function f(c){return e.exit("codeIndented"),t(c)}}function r9(e,t,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):nt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):At(e,i,"linePrefix",5)(l)}function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):nt(l)?a(l):n(l)}}const a9={name:"codeText",previous:s9,resolve:i9,tokenize:l9};function i9(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function s9(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function l9(e,t,n){let r=0,a,i;return l;function l(v){return e.enter("codeText"),e.enter("codeTextSequence"),o(v)}function o(v){return v===96?(e.consume(v),r++,o):(e.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),f):v===96?(i=e.enter("codeTextSequence"),a=0,d(v)):nt(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):(e.enter("codeTextData"),c(v))}function c(v){return v===null||v===32||v===96||nt(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),c)}function d(v){return v===96?(e.consume(v),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(i.type="codeTextData",c(v))}}class o9{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&pf(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),pf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pf(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);pf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pf(this.left,n.reverse())}}}function pf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function JM(e){const t={};let n=-1,r,a,i,l,o,f,c;const d=new o9(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,i=0,i<f.length&&f[i][1].type==="lineEndingBlank"&&(i+=2),i<f.length&&f[i][1].type==="content"))for(;++i<f.length&&f[i][1].type!=="content";)f[i][1].type==="chunkText"&&(f[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,u9(d,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(l=d.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return ta(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function u9(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,f=[],c={};let d,v,m=-1,y=n,x=0,w=0;const S=[w];for(;y;){for(;e.get(++a)[1]!==y;);i.push(a),y._tokenizer||(d=r.sliceStream(y),y.next||d.push(null),v&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(d),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),v=y,y=y.next}for(y=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(w=m+1,S.push(w),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):S.pop(),m=S.length;m--;){const b=o.slice(S[m],S[m+1]),C=i.pop();f.push([C,C+b.length-1]),e.splice(C,2,b)}for(f.reverse(),m=-1;++m<f.length;)c[x+f[m][0]]=x+f[m][1],x+=f[m][1]-f[m][0]-1;return c}const c9={resolve:d9,tokenize:h9},f9={partial:!0,tokenize:v9};function d9(e){return JM(e),e}function h9(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):nt(o)?e.check(f9,l,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function v9(e,t,n){const r=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),At(e,i,"linePrefix")}function i(l){if(l===null||nt(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function eO(e,t,n,r,a,i,l,o,f){const c=f||Number.POSITIVE_INFINITY;let d=0;return v;function v(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||Qv(b)?n(b):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),w(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||nt(b)?n(b):(e.consume(b),b===92?x:y)}function x(b){return b===60||b===62||b===92?(e.consume(b),y):y(b)}function w(b){return!d&&(b===null||b===41||Kt(b))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(b)):d<c&&b===40?(e.consume(b),d++,w):b===41?(e.consume(b),d--,w):b===null||b===32||b===40||Qv(b)?n(b):(e.consume(b),b===92?S:w)}function S(b){return b===40||b===41||b===92?(e.consume(b),w):w(b)}}function tO(e,t,n,r,a,i){const l=this;let o=0,f;return c;function c(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(i),d}function d(y){return o>999||y===null||y===91||y===93&&!f||y===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(i),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):nt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||nt(y)||o++>999?(e.exit("chunkString"),d(y)):(e.consume(y),f||(f=!Et(y)),y===92?m:v)}function m(y){return y===91||y===92||y===93?(e.consume(y),o++,v):v(y)}}function nO(e,t,n,r,a,i){let l;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),l=m===40?41:m,f):n(m)}function f(m){return m===l?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),c(m))}function c(m){return m===l?(e.exit(i),f(l)):m===null?n(m):nt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),At(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===l||m===null||nt(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?v:d)}function v(m){return m===l||m===92?(e.consume(m),d):d(m)}}function Of(e,t){let n;return r;function r(a){return nt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Et(a)?At(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const p9={name:"definition",tokenize:g9},m9={partial:!0,tokenize:y9};function g9(e,t,n){const r=this;let a;return i;function i(y){return e.enter("definition"),l(y)}function l(y){return tO.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function o(y){return a=Oa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Kt(y)?Of(e,c)(y):c(y)}function c(y){return eO(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function d(y){return e.attempt(m9,v,v)(y)}function v(y){return Et(y)?At(e,m,"whitespace")(y):m(y)}function m(y){return y===null||nt(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function y9(e,t,n){return r;function r(o){return Kt(o)?Of(e,a)(o):n(o)}function a(o){return nO(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Et(o)?At(e,l,"whitespace")(o):l(o)}function l(o){return o===null||nt(o)?t(o):n(o)}}const x9={name:"hardBreakEscape",tokenize:b9};function b9(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return nt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const w9={name:"headingAtx",resolve:S9,tokenize:E9};function S9(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ta(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function E9(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),l(d)}function l(d){return d===35&&r++<6?(e.consume(d),l):d===null||Kt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),f(d)):d===null||nt(d)?(e.exit("atxHeading"),t(d)):Et(d)?At(e,o,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function f(d){return d===35?(e.consume(d),f):(e.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||Kt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),c)}}const C9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ek=["pre","script","style","textarea"],T9={concrete:!0,name:"htmlFlow",resolveTo:A9,tokenize:R9},k9={partial:!0,tokenize:D9},N9={partial:!0,tokenize:j9};function A9(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function R9(e,t,n){const r=this;let a,i,l,o,f;return c;function c(U){return d(U)}function d(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),v}function v(U){return U===33?(e.consume(U),m):U===47?(e.consume(U),i=!0,w):U===63?(e.consume(U),a=3,r.interrupt?t:V):Er(U)?(e.consume(U),l=String.fromCharCode(U),S):n(U)}function m(U){return U===45?(e.consume(U),a=2,y):U===91?(e.consume(U),a=5,o=0,x):Er(U)?(e.consume(U),a=4,r.interrupt?t:V):n(U)}function y(U){return U===45?(e.consume(U),r.interrupt?t:V):n(U)}function x(U){const te="CDATA[";return U===te.charCodeAt(o++)?(e.consume(U),o===te.length?r.interrupt?t:P:x):n(U)}function w(U){return Er(U)?(e.consume(U),l=String.fromCharCode(U),S):n(U)}function S(U){if(U===null||U===47||U===62||Kt(U)){const te=U===47,ie=l.toLowerCase();return!te&&!i&&ek.includes(ie)?(a=1,r.interrupt?t(U):P(U)):C9.includes(l.toLowerCase())?(a=6,te?(e.consume(U),b):r.interrupt?t(U):P(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):i?C(U):T(U))}return U===45||hr(U)?(e.consume(U),l+=String.fromCharCode(U),S):n(U)}function b(U){return U===62?(e.consume(U),r.interrupt?t:P):n(U)}function C(U){return Et(U)?(e.consume(U),C):M(U)}function T(U){return U===47?(e.consume(U),M):U===58||U===95||Er(U)?(e.consume(U),N):Et(U)?(e.consume(U),T):M(U)}function N(U){return U===45||U===46||U===58||U===95||hr(U)?(e.consume(U),N):A(U)}function A(U){return U===61?(e.consume(U),R):Et(U)?(e.consume(U),A):T(U)}function R(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),f=U,D):Et(U)?(e.consume(U),R):L(U)}function D(U){return U===f?(e.consume(U),f=null,_):U===null||nt(U)?n(U):(e.consume(U),D)}function L(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||Kt(U)?A(U):(e.consume(U),L)}function _(U){return U===47||U===62||Et(U)?T(U):n(U)}function M(U){return U===62?(e.consume(U),z):n(U)}function z(U){return U===null||nt(U)?P(U):Et(U)?(e.consume(U),z):n(U)}function P(U){return U===45&&a===2?(e.consume(U),B):U===60&&a===1?(e.consume(U),H):U===62&&a===4?(e.consume(U),q):U===63&&a===3?(e.consume(U),V):U===93&&a===5?(e.consume(U),Q):nt(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(k9,X,G)(U)):U===null||nt(U)?(e.exit("htmlFlowData"),G(U)):(e.consume(U),P)}function G(U){return e.check(N9,I,X)(U)}function I(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||nt(U)?G(U):(e.enter("htmlFlowData"),P(U))}function B(U){return U===45?(e.consume(U),V):P(U)}function H(U){return U===47?(e.consume(U),l="",Y):P(U)}function Y(U){if(U===62){const te=l.toLowerCase();return ek.includes(te)?(e.consume(U),q):P(U)}return Er(U)&&l.length<8?(e.consume(U),l+=String.fromCharCode(U),Y):P(U)}function Q(U){return U===93?(e.consume(U),V):P(U)}function V(U){return U===62?(e.consume(U),q):U===45&&a===2?(e.consume(U),V):P(U)}function q(U){return U===null||nt(U)?(e.exit("htmlFlowData"),X(U)):(e.consume(U),q)}function X(U){return e.exit("htmlFlow"),t(U)}}function j9(e,t,n){const r=this;return a;function a(l){return nt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function D9(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(gd,t,n)}}const M9={name:"htmlText",tokenize:O9};function O9(e,t,n){const r=this;let a,i,l;return o;function o(V){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(V),f}function f(V){return V===33?(e.consume(V),c):V===47?(e.consume(V),A):V===63?(e.consume(V),T):Er(V)?(e.consume(V),L):n(V)}function c(V){return V===45?(e.consume(V),d):V===91?(e.consume(V),i=0,x):Er(V)?(e.consume(V),C):n(V)}function d(V){return V===45?(e.consume(V),y):n(V)}function v(V){return V===null?n(V):V===45?(e.consume(V),m):nt(V)?(l=v,H(V)):(e.consume(V),v)}function m(V){return V===45?(e.consume(V),y):v(V)}function y(V){return V===62?B(V):V===45?m(V):v(V)}function x(V){const q="CDATA[";return V===q.charCodeAt(i++)?(e.consume(V),i===q.length?w:x):n(V)}function w(V){return V===null?n(V):V===93?(e.consume(V),S):nt(V)?(l=w,H(V)):(e.consume(V),w)}function S(V){return V===93?(e.consume(V),b):w(V)}function b(V){return V===62?B(V):V===93?(e.consume(V),b):w(V)}function C(V){return V===null||V===62?B(V):nt(V)?(l=C,H(V)):(e.consume(V),C)}function T(V){return V===null?n(V):V===63?(e.consume(V),N):nt(V)?(l=T,H(V)):(e.consume(V),T)}function N(V){return V===62?B(V):T(V)}function A(V){return Er(V)?(e.consume(V),R):n(V)}function R(V){return V===45||hr(V)?(e.consume(V),R):D(V)}function D(V){return nt(V)?(l=D,H(V)):Et(V)?(e.consume(V),D):B(V)}function L(V){return V===45||hr(V)?(e.consume(V),L):V===47||V===62||Kt(V)?_(V):n(V)}function _(V){return V===47?(e.consume(V),B):V===58||V===95||Er(V)?(e.consume(V),M):nt(V)?(l=_,H(V)):Et(V)?(e.consume(V),_):B(V)}function M(V){return V===45||V===46||V===58||V===95||hr(V)?(e.consume(V),M):z(V)}function z(V){return V===61?(e.consume(V),P):nt(V)?(l=z,H(V)):Et(V)?(e.consume(V),z):_(V)}function P(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),a=V,G):nt(V)?(l=P,H(V)):Et(V)?(e.consume(V),P):(e.consume(V),I)}function G(V){return V===a?(e.consume(V),a=void 0,F):V===null?n(V):nt(V)?(l=G,H(V)):(e.consume(V),G)}function I(V){return V===null||V===34||V===39||V===60||V===61||V===96?n(V):V===47||V===62||Kt(V)?_(V):(e.consume(V),I)}function F(V){return V===47||V===62||Kt(V)?_(V):n(V)}function B(V){return V===62?(e.consume(V),e.exit("htmlTextData"),e.exit("htmlText"),t):n(V)}function H(V){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),Y}function Y(V){return Et(V)?At(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):Q(V)}function Q(V){return e.enter("htmlTextData"),l(V)}}const rw={name:"labelEnd",resolveAll:P9,resolveTo:z9,tokenize:I9},L9={tokenize:F9},_9={tokenize:q9},B9={tokenize:U9};function P9(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&ta(e,0,e.length,n),e}function z9(e,t){let n=e.length,r=0,a,i,l,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(l=n);const f={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",f,t],["enter",c,t]],o=ba(o,e.slice(i+1,i+r+3)),o=ba(o,[["enter",d,t]]),o=ba(o,qp(t.parser.constructs.insideSpan.null,e.slice(i+r+4,l-3),t)),o=ba(o,[["exit",d,t],e[l-2],e[l-1],["exit",c,t]]),o=ba(o,e.slice(l+1)),o=ba(o,[["exit",f,t]]),ta(e,i,e.length,o),e}function I9(e,t,n){const r=this;let a=r.events.length,i,l;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?v(m):(l=r.parser.defined.includes(Oa(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),f):n(m)}function f(m){return m===40?e.attempt(L9,d,l?d:v)(m):m===91?e.attempt(_9,d,l?c:v)(m):l?d(m):v(m)}function c(m){return e.attempt(B9,d,v)(m)}function d(m){return t(m)}function v(m){return i._balanced=!0,n(m)}}function F9(e,t,n){return r;function r(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Kt(v)?Of(e,i)(v):i(v)}function i(v){return v===41?d(v):eO(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function l(v){return Kt(v)?Of(e,f)(v):d(v)}function o(v){return n(v)}function f(v){return v===34||v===39||v===40?nO(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):d(v)}function c(v){return Kt(v)?Of(e,d)(v):d(v)}function d(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function q9(e,t,n){const r=this;return a;function a(o){return tO.call(r,e,i,l,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Oa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function U9(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const V9={name:"labelStartImage",resolveAll:rw.resolveAll,tokenize:H9};function H9(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const G9={name:"labelStartLink",resolveAll:rw.resolveAll,tokenize:$9};function $9(e,t,n){const r=this;return a;function a(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Hy={name:"lineEnding",tokenize:K9};function K9(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),At(e,t,"linePrefix")}}const kv={name:"thematicBreak",tokenize:Y9};function Y9(e,t,n){let r=0,a;return i;function i(c){return e.enter("thematicBreak"),l(c)}function l(c){return a=c,o(c)}function o(c){return c===a?(e.enter("thematicBreakSequence"),f(c)):r>=3&&(c===null||nt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function f(c){return c===a?(e.consume(c),r++,f):(e.exit("thematicBreakSequence"),Et(c)?At(e,o,"whitespace")(c):o(c))}}const Br={continuation:{tokenize:Z9},exit:eH,name:"list",tokenize:W9},X9={partial:!0,tokenize:tH},Q9={partial:!0,tokenize:J9};function W9(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return o;function o(y){const x=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:kb(y)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(kv,n,c)(y):c(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return kb(y)&&++l<10?(e.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),c(y)):n(y)}function c(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(gd,r.interrupt?n:d,e.attempt(X9,m,v))}function d(y){return r.containerState.initialBlankLine=!0,i++,m(y)}function v(y){return Et(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),m):n(y)}function m(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function Z9(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(gd,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,At(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Et(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Q9,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,At(e,e.attempt(Br,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function J9(e,t,n){const r=this;return At(e,a,"listItemIndent",r.containerState.size+1);function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(i):n(i)}}function eH(e){e.exit(this.containerState.type)}function tH(e,t,n){const r=this;return At(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const l=r.events[r.events.length-1];return!Et(i)&&l&&l[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const tk={name:"setextUnderline",resolveTo:nH,tokenize:rH};function nH(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",l,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function rH(e,t,n){const r=this;let a;return i;function i(c){let d=r.events.length,v;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){v=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||v)?(e.enter("setextHeadingLine"),a=c,l(c)):n(c)}function l(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===a?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Et(c)?At(e,f,"lineSuffix")(c):f(c))}function f(c){return c===null||nt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const aH={tokenize:iH};function iH(e){const t=this,n=e.attempt(gd,r,e.attempt(this.parser.constructs.flowInitial,a,At(e,e.attempt(this.parser.constructs.flow,a,e.attempt(c9,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sH={resolveAll:aO()},lH=rO("string"),oH=rO("text");function rO(e){return{resolveAll:aO(e==="text"?uH:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,l,o);return l;function l(d){return c(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),f}function f(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),f)}function c(d){if(d===null)return!0;const v=a[d];let m=-1;if(v)for(;++m<v.length;){const y=v[m];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function aO(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function uH(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,l=-1,o=0,f;for(;i--;){const c=a[i];if(typeof c=="string"){for(l=c.length;c.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(c===-2)f=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||f||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const cH={42:Br,43:Br,45:Br,48:Br,49:Br,50:Br,51:Br,52:Br,53:Br,54:Br,55:Br,56:Br,57:Br,62:QM},fH={91:p9},dH={[-2]:Vy,[-1]:Vy,32:Vy},hH={35:w9,42:kv,45:[tk,kv],60:T9,61:tk,95:kv,96:JT,126:JT},vH={38:ZM,92:WM},pH={[-5]:Hy,[-4]:Hy,[-3]:Hy,33:V9,38:ZM,42:Nb,60:[GV,M9],91:G9,92:[x9,WM],93:rw,95:Nb,96:a9},mH={null:[Nb,sH]},gH={null:[42,95]},yH={null:[]},xH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gH,contentInitial:fH,disable:yH,document:cH,flow:hH,flowInitial:dH,insideSpan:mH,string:vH,text:pH},Symbol.toStringTag,{value:"Module"}));function bH(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let l=[],o=[];const f={attempt:D(A),check:D(R),consume:C,enter:T,exit:N,interrupt:D(R,{interrupt:!0})},c={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:e,previous:null,sliceSerialize:m,sliceStream:y,write:v};let d=t.tokenize.call(c,f);return t.resolveAll&&i.push(t),c;function v(z){return l=ba(l,z),S(),l[l.length-1]!==null?[]:(L(t,0),c.events=qp(i,c.events,c),c.events)}function m(z,P){return SH(y(z),P)}function y(z){return wH(l,z)}function x(){const{_bufferIndex:z,_index:P,line:G,column:I,offset:F}=r;return{_bufferIndex:z,_index:P,line:G,column:I,offset:F}}function w(z){a[z.line]=z.column,M()}function S(){let z;for(;r._index<l.length;){const P=l[r._index];if(typeof P=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<P.length;)b(P.charCodeAt(r._bufferIndex));else b(P)}}function b(z){d=d(z)}function C(z){nt(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,M()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=z}function T(z,P){const G=P||{};return G.type=z,G.start=x(),c.events.push(["enter",G,c]),o.push(G),G}function N(z){const P=o.pop();return P.end=x(),c.events.push(["exit",P,c]),P}function A(z,P){L(z,P.from)}function R(z,P){P.restore()}function D(z,P){return G;function G(I,F,B){let H,Y,Q,V;return Array.isArray(I)?X(I):"tokenize"in I?X([I]):q(I);function q(oe){return ae;function ae(we){const fe=we!==null&&oe[we],J=we!==null&&oe.null,ne=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(J)?J:J?[J]:[]];return X(ne)(we)}}function X(oe){return H=oe,Y=0,oe.length===0?B:U(oe[Y])}function U(oe){return ae;function ae(we){return V=_(),Q=oe,oe.partial||(c.currentConstruct=oe),oe.name&&c.parser.constructs.disable.null.includes(oe.name)?ie():oe.tokenize.call(P?Object.assign(Object.create(c),P):c,f,te,ie)(we)}}function te(oe){return z(Q,V),F}function ie(oe){return V.restore(),++Y<H.length?U(H[Y]):B}}}function L(z,P){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&ta(c.events,P,c.events.length-P,z.resolve(c.events.slice(P),c)),z.resolveTo&&(c.events=z.resolveTo(c.events,c))}function _(){const z=x(),P=c.previous,G=c.currentConstruct,I=c.events.length,F=Array.from(o);return{from:I,restore:B};function B(){r=z,c.previous=P,c.currentConstruct=G,c.events.length=I,o=F,M()}}function M(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function wH(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(r,i)];else{if(l=e.slice(n,a),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}i>0&&l.push(e[a].slice(0,i))}return l}function SH(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
431
431
  `;break}case-3:{l=`\r
432
432
  `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(i)}a=i===-2,r.push(l)}return r.join("")}function EH(e){const r={constructs:YM([xH,...(e||{}).extensions||[]]),content:a(zV),defined:[],document:a(FV),flow:a(aH),lazy:{},string:a(lH),text:a(oH)};return r;function a(i){return l;function l(o){return bH(r,i,o)}}}function CH(e){for(;!JM(e););return e}const nk=/[\0\t\n\r]/g;function TH(){let e=1,t="",n=!0,r;return a;function a(i,l,o){const f=[];let c,d,v,m,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),v=0,t="",n&&(i.charCodeAt(0)===65279&&v++,n=void 0);v<i.length;){if(nk.lastIndex=v,c=nk.exec(i),m=c&&c.index!==void 0?c.index:i.length,y=i.charCodeAt(m),!c){t=i.slice(v);break}if(y===10&&v===m&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),v<m&&(f.push(i.slice(v,m)),e+=m-v),y){case 0:{f.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,f.push(-2);e++<d;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}v=m+1}return o&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const kH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NH(e){return e.replace(kH,AH)}function AH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return XM(n.slice(i?2:1),i?16:10)}return nw(n)||e}const iO={}.hasOwnProperty;function RH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),jH(n)(CH(EH(n).document().write(TH()(e,t,!0))))}function jH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(qe),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(Be),blockQuote:i(J),characterEscape:_,characterReference:_,codeFenced:i(ne),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(ne,l),codeText:i(re,l),codeTextData:_,data:_,codeFlowValue:_,definition:i(ge),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(ke),hardBreakEscape:i(lt),hardBreakTrailing:i(lt),htmlFlow:i(Ze,l),htmlFlowData:_,htmlText:i(Ze,l),htmlTextData:_,image:i(Qe),label:l,link:i(qe),listItem:i(Ge),listItemValue:m,listOrdered:i(je,v),listUnordered:i(je),paragraph:i(Xe),reference:U,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(Be),strong:i(it),thematicBreak:i(ft)},exit:{atxHeading:f(),atxHeadingSequence:A,autolink:f(),autolinkEmail:fe,autolinkProtocol:we,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:oe,characterReference:ae,codeFenced:f(S),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:M,codeIndented:f(b),codeText:f(F),codeTextData:M,data:M,definition:f(),definitionDestinationString:N,definitionLabelString:C,definitionTitleString:T,emphasis:f(),hardBreakEscape:f(P),hardBreakTrailing:f(P),htmlFlow:f(G),htmlFlowData:M,htmlText:f(I),htmlTextData:M,image:f(H),label:Q,labelText:Y,lineEnding:z,link:f(B),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:te,resourceDestinationString:V,resourceTitleString:q,resource:X,setextHeading:f(L),setextHeadingLineSequence:D,setextHeadingText:R,strong:f(),thematicBreak:f()}};sO(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(he){let Ce={type:"root",children:[]};const De={stack:[Ce],tokenStack:[],config:t,enter:o,exit:c,buffer:l,resume:d,data:n},ze=[];let Me=-1;for(;++Me<he.length;)if(he[Me][1].type==="listOrdered"||he[Me][1].type==="listUnordered")if(he[Me][0]==="enter")ze.push(Me);else{const Oe=ze.pop();Me=a(he,Oe,Me)}for(Me=-1;++Me<he.length;){const Oe=t[he[Me][0]];iO.call(Oe,he[Me][1].type)&&Oe[he[Me][1].type].call(Object.assign({sliceSerialize:he[Me][2].sliceSerialize},De),he[Me][1])}if(De.tokenStack.length>0){const Oe=De.tokenStack[De.tokenStack.length-1];(Oe[1]||rk).call(De,void 0,Oe[0])}for(Ce.position={start:Os(he.length>0?he[0][1].start:{line:1,column:1,offset:0}),end:Os(he.length>0?he[he.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<t.transforms.length;)Ce=t.transforms[Me](Ce)||Ce;return Ce}function a(he,Ce,De){let ze=Ce-1,Me=-1,Oe=!1,ye,K,le,pe;for(;++ze<=De;){const de=he[ze];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?Me++:Me--,pe=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(ye&&!pe&&!Me&&!le&&(le=ze),pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pe=void 0}if(!Me&&de[0]==="enter"&&de[1].type==="listItemPrefix"||Me===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(ye){let xe=ze;for(K=void 0;xe--;){const Le=he[xe];if(Le[1].type==="lineEnding"||Le[1].type==="lineEndingBlank"){if(Le[0]==="exit")continue;K&&(he[K][1].type="lineEndingBlank",Oe=!0),Le[1].type="lineEnding",K=xe}else if(!(Le[1].type==="linePrefix"||Le[1].type==="blockQuotePrefix"||Le[1].type==="blockQuotePrefixWhitespace"||Le[1].type==="blockQuoteMarker"||Le[1].type==="listItemIndent"))break}le&&(!K||le<K)&&(ye._spread=!0),ye.end=Object.assign({},K?he[K][1].start:de[1].end),he.splice(K||ze,0,["exit",ye,de[2]]),ze++,De++}if(de[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};ye=xe,he.splice(ze,0,["enter",xe,de[2]]),ze++,De++,le=void 0,pe=!0}}}return he[Ce][1]._spread=Oe,De}function i(he,Ce){return De;function De(ze){o.call(this,he(ze),ze),Ce&&Ce.call(this,ze)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(he,Ce,De){this.stack[this.stack.length-1].children.push(he),this.stack.push(he),this.tokenStack.push([Ce,De||void 0]),he.position={start:Os(Ce.start),end:void 0}}function f(he){return Ce;function Ce(De){he&&he.call(this,De),c.call(this,De)}}function c(he,Ce){const De=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==he.type&&(Ce?Ce.call(this,he,ze[0]):(ze[1]||rk).call(this,he,ze[0]));else throw new Error("Cannot close `"+he.type+"` ("+Mf({start:he.start,end:he.end})+"): it’s not open");De.position.end=Os(he.end)}function d(){return tw(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function m(he){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(he),10),this.data.expectingFirstListItemValue=void 0}}function y(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=he}function x(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=he}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he.replace(/(\r?\n|\r)$/g,"")}function C(he){const Ce=this.resume(),De=this.stack[this.stack.length-1];De.label=Ce,De.identifier=Oa(this.sliceSerialize(he)).toLowerCase()}function T(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=he}function N(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=he}function A(he){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const De=this.sliceSerialize(he).length;Ce.depth=De}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function D(he){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(he).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function _(he){const De=this.stack[this.stack.length-1].children;let ze=De[De.length-1];(!ze||ze.type!=="text")&&(ze=Pe(),ze.position={start:Os(he.start),end:void 0},De.push(ze)),this.stack.push(ze)}function M(he){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(he),Ce.position.end=Os(he.end)}function z(he){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=Ce.children[Ce.children.length-1];De.position.end=Os(he.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ce.type)&&(_.call(this,he),M.call(this,he))}function P(){this.data.atHardBreak=!0}function G(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function I(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function F(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=he}function B(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ce,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function H(){const he=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";he.type+="Reference",he.referenceType=Ce,delete he.url,delete he.title}else delete he.identifier,delete he.label;this.data.referenceType=void 0}function Y(he){const Ce=this.sliceSerialize(he),De=this.stack[this.stack.length-2];De.label=NH(Ce),De.identifier=Oa(Ce).toLowerCase()}function Q(){const he=this.stack[this.stack.length-1],Ce=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const ze=he.children;De.children=ze}else De.alt=Ce}function V(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=he}function q(){const he=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=he}function X(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function te(he){const Ce=this.resume(),De=this.stack[this.stack.length-1];De.label=Ce,De.identifier=Oa(this.sliceSerialize(he)).toLowerCase(),this.data.referenceType="full"}function ie(he){this.data.characterReferenceType=he.type}function oe(he){const Ce=this.sliceSerialize(he),De=this.data.characterReferenceType;let ze;De?(ze=XM(Ce,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=nw(Ce);const Me=this.stack[this.stack.length-1];Me.value+=ze}function ae(he){const Ce=this.stack.pop();Ce.position.end=Os(he.end)}function we(he){M.call(this,he);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(he)}function fe(he){M.call(this,he);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(he)}function J(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ke(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function lt(){return{type:"break"}}function Ze(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function qe(){return{type:"link",title:null,url:"",children:[]}}function je(he){return{type:"list",ordered:he.type==="listOrdered",start:null,spread:he._spread,children:[]}}function Ge(he){return{type:"listItem",spread:he._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function it(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function Os(e){return{line:e.line,column:e.column,offset:e.offset}}function sO(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?sO(e,r):DH(e,r)}}function DH(e,t){let n;for(n in t)if(iO.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function rk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mf({start:t.start,end:t.end})+") is still open")}function MH(e){const t=this;t.parser=n;function n(r){return RH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function OH(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function LH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`