@inkeep/open-knowledge 0.68.11-beta.0 → 0.68.12-beta.1

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 (112) hide show
  1. package/dist/{acp-harness-probe-DaYXqGxg.mjs → acp-harness-probe-CT9zUTRO.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-0akOuzy0.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-_7R63fwz.mjs → init-CdZuLwQy.mjs} +3 -3
  6. package/dist/init-DUE-cUA2.mjs +1 -0
  7. package/dist/{launch-json-removal-B28FsoE2.mjs → launch-json-removal-DEZq703t.mjs} +2 -2
  8. package/dist/loader-C_2wUUkf.mjs +1 -0
  9. package/dist/{loader-C4UW1MW5.mjs → loader-DaiAZUue.mjs} +2 -2
  10. package/dist/{preview-DKtYHQbM.mjs → preview-ChZG0J0K.mjs} +2 -2
  11. package/dist/preview-DONZ_U_O.mjs +1 -0
  12. package/dist/public/assets/{ActivityModeContent-C9Z839EN.js → ActivityModeContent-BWdSS2D6.js} +1 -1
  13. package/dist/public/assets/{AddPropertiesButton-DSQKtGW9.js → AddPropertiesButton-CPR5ISd3.js} +2 -2
  14. package/dist/public/assets/{AgentDiffPane-Cu3m0Lib.js → AgentDiffPane-DaTqhZ5p.js} +1 -1
  15. package/dist/public/assets/{AgentThreadClientBinder-D1mSPUsr.js → AgentThreadClientBinder-CmEEIjX-.js} +1 -1
  16. package/dist/public/assets/{CodeMirrorPropInput-CRa8tGX-.js → CodeMirrorPropInput-CxKiaHDG.js} +1 -1
  17. package/dist/public/assets/ConsentDialogBody-DvA9T9zf.js +2 -0
  18. package/dist/public/assets/{DocumentContext-BdZiErvh.js → DocumentContext-Dq9Tp3cJ.js} +20 -20
  19. package/dist/public/assets/{EditorModeToggle-DYldyVnC.js → EditorModeToggle-Bc3uB9U-.js} +1 -1
  20. package/dist/public/assets/{EnableSyncConfirmDialog-N_l5NwWg.js → EnableSyncConfirmDialog-CNj6t4oU.js} +1 -1
  21. package/dist/public/assets/{ExcalidrawDocEditor-CFg6aGVN.js → ExcalidrawDocEditor-DBtbiCJx.js} +1 -1
  22. package/dist/public/assets/FeedbackForm-sO7YM2-Z.js +1 -0
  23. package/dist/public/assets/{ImportSkillDialog-DOKtVFqO.js → ImportSkillDialog-Bwpq62xq.js} +1 -1
  24. package/dist/public/assets/{LintConfigEditor-SzAKIf-P.js → LintConfigEditor-Ba5oKq1w.js} +1 -1
  25. package/dist/public/assets/ManagedArtifactProperties-Btpe5_SI.js +1 -0
  26. package/dist/public/assets/{ManagedArtifactProperties-8E5SQSnI.js → ManagedArtifactProperties-CdkKGxEj.js} +1 -1
  27. package/dist/public/assets/MermaidDocEditor-B8aDyiMO.js +1 -0
  28. package/dist/public/assets/{PropertyDisplayRow-CBiQBnOL.js → PropertyDisplayRow-v1cOAjw5.js} +2 -2
  29. package/dist/public/assets/{ReportBugMenuTrigger-D7aC0OiR.js → ReportBugMenuTrigger-Bf1Hqrda.js} +2 -2
  30. package/dist/public/assets/{SchemaConfigEditor-DGBRJY7Q.js → SchemaConfigEditor-XhXk8g7T.js} +1 -1
  31. package/dist/public/assets/{SessionsHost-CrnQRViT.js → SessionsHost-BKECnSlu.js} +2 -2
  32. package/dist/public/assets/{SettingsDialogBody-DnEGrTMq.js → SettingsDialogBody-HeV6I7MY.js} +1 -1
  33. package/dist/public/assets/{ShareBranchSwitchDialog-Cgkl3a5v.js → ShareBranchSwitchDialog-DD_l6rfk.js} +1 -1
  34. package/dist/public/assets/{ShareReceiveDialog-6TxrHOIU.js → ShareReceiveDialog-CeUqKz5V.js} +1 -1
  35. package/dist/public/assets/{ShareReceiveMissDialog-BCkm-E10.js → ShareReceiveMissDialog-BW5sX7tJ.js} +1 -1
  36. package/dist/public/assets/{SkillInstallMenu-D3KWfbhA.js → SkillInstallMenu-BpNof3ef.js} +1 -1
  37. package/dist/public/assets/{SkillOriginInline-CaEMp81T.js → SkillOriginInline-BrKRkdWk.js} +2 -2
  38. package/dist/public/assets/{SkillToolbarControls-tpuUyOLu.js → SkillToolbarControls-IMOVZKvF.js} +1 -1
  39. package/dist/public/assets/SourceEditor-BTYnAFsw.js +1 -0
  40. package/dist/public/assets/{TerminalPanel-MpZfhb9K.js → TerminalPanel-CdIGSrlk.js} +1 -1
  41. package/dist/public/assets/{TerminalWindowApp-CwExuljm.js → TerminalWindowApp-NycR0wsI.js} +1 -1
  42. package/dist/public/assets/TextDocEditor-DdWAwS7A.js +1 -0
  43. package/dist/public/assets/{ThreadView-Dv-MJgLn.js → ThreadView-C3OoXuxe.js} +3 -3
  44. package/dist/public/assets/{TimelineDiffPane-G1nycx_c.js → TimelineDiffPane-DnAhc1K4.js} +1 -1
  45. package/dist/public/assets/{agent-diff-store-Bln_lxtD.js → agent-diff-store-bDOZFhMv.js} +1 -1
  46. package/dist/public/assets/{auth-state-cache-BLGrQ86G.js → auth-state-cache-CXy0onrr.js} +1 -1
  47. package/dist/public/assets/{client-version-CXZnsz8b.js → client-version-Dhl7MADN.js} +1 -1
  48. package/dist/public/assets/{comment-chips-Bm8WWDT7.js → comment-chips-D8HG458e.js} +1 -1
  49. package/dist/public/assets/{config-provider-BvIhxk0G.js → config-provider-CHjUKQH3.js} +2 -2
  50. package/dist/public/assets/doc-undo-manager-5ipqqo4q.js +1 -0
  51. package/dist/public/assets/{index-BLB78i4B.js → index-CS0TGgfx.js} +7 -7
  52. package/dist/public/assets/{launch-agent-thread-CYKu9e2m.js → launch-agent-thread-Clx5mTVb.js} +1 -1
  53. package/dist/public/assets/{markdownlint-rule-browser-CF1tj7Rc.js → markdownlint-rule-browser-BF4sbKQU.js} +1 -1
  54. package/dist/public/assets/{pending-receive-nav-store-BtQaH8Ow.js → pending-receive-nav-store-C4_yaUyL.js} +1 -1
  55. package/dist/public/assets/{progress-DKwbAv_d.js → progress-D-1ao2o_.js} +1 -1
  56. package/dist/public/assets/{selection-context-BBTm-UVn.js → selection-context-6WzTStMT.js} +1 -1
  57. package/dist/public/assets/{src-BBEwVksN.js → src-DYAS3Jip.js} +1 -1
  58. package/dist/public/assets/{telemetry-impl-B_63zFxn.js → telemetry-impl-B6UTkAwl.js} +2 -2
  59. package/dist/public/assets/{telemetry-startup-BMrCBn-y.js → telemetry-startup-BQCFQ5WG.js} +1 -1
  60. package/dist/public/assets/{typing-burst-detector-D-RxXAZt.js → typing-burst-detector-BQP3UEXA.js} +1 -1
  61. package/dist/public/assets/{use-activity-panel-TaOc5fsr.js → use-activity-panel-DEtbTEBl.js} +1 -1
  62. package/dist/public/assets/{use-open-skill-BfikAHGm.js → use-open-skill-ROXADwkl.js} +1 -1
  63. package/dist/public/assets/{use-terminal-enabled-f6uI67oZ.js → use-terminal-enabled-BMRgNWfi.js} +1 -1
  64. package/dist/public/assets/{use-timeline-entry-diff-DEsOnT79.js → use-timeline-entry-diff-8r8oGG-s.js} +1 -1
  65. package/dist/public/index.html +20 -20
  66. package/dist/{repair-launch-json-O0pvONvJ.mjs → repair-launch-json-Y3sFjzYU.mjs} +2 -2
  67. package/dist/{repair-mcp-configs-BFtKKOXF.mjs → repair-mcp-configs-C3MCcme0.mjs} +2 -2
  68. package/dist/src-CRiQE-9w.mjs +1 -0
  69. package/dist/{src-D5pqfubu.mjs → src-VpH6m875.mjs} +2 -2
  70. package/dist/{start-DET7Qj8h.mjs → start-BIh0ynfY.mjs} +2 -2
  71. package/dist/start-BkNmoUJX.mjs +1 -0
  72. package/package.json +4 -4
  73. package/dist/constants-jyYwGmDC.mjs +0 -2
  74. package/dist/init-CBEFRP85.mjs +0 -1
  75. package/dist/loader-Bz5cS92c.mjs +0 -1
  76. package/dist/preview-26pLGThq.mjs +0 -1
  77. package/dist/public/assets/ConsentDialogBody-Bu8u9p1a.js +0 -2
  78. package/dist/public/assets/FeedbackForm-CnwouVSg.js +0 -1
  79. package/dist/public/assets/ManagedArtifactProperties-DyQXtUCs.js +0 -1
  80. package/dist/public/assets/MermaidDocEditor-C-qlUZje.js +0 -1
  81. package/dist/public/assets/SourceEditor-D_IY9GyQ.js +0 -1
  82. package/dist/public/assets/TextDocEditor-DAcD7hS1.js +0 -1
  83. package/dist/src-y6vbbp7M.mjs +0 -1
  84. package/dist/start-BoiJ1XmS.mjs +0 -1
  85. /package/dist/public/assets/{GraphPanel-r8Gqxdvr.js → GraphPanel-ig_aaE6z.js} +0 -0
  86. /package/dist/public/assets/{McpConsentDialogBody-D3q7WAev.js → McpConsentDialogBody-HesTuXBk.js} +0 -0
  87. /package/dist/public/assets/{ReportBugDialogBody-B4Ph81pw.js → ReportBugDialogBody-CGsC-64R.js} +0 -0
  88. /package/dist/public/assets/{SkillEditBanner-D_nkf6Qd.js → SkillEditBanner-B3DCnnjz.js} +0 -0
  89. /package/dist/public/assets/{SkillForkDialog-Bhq9zhtY.js → SkillForkDialog-67R0OSL-.js} +0 -0
  90. /package/dist/public/assets/{SkillUpdateConflictDialog-Cbj5JNXp.js → SkillUpdateConflictDialog-D1ffg_Rg.js} +0 -0
  91. /package/dist/public/assets/{SlidesToolbarControls-DWqUzkgL.js → SlidesToolbarControls-CSx5LfK6.js} +0 -0
  92. /package/dist/public/assets/{TerminalStartingNotice-DPZ5efWf.js → TerminalStartingNotice-DqoBhFu7.js} +0 -0
  93. /package/dist/public/assets/{__vite-browser-external-Bk_TL8Am.js → __vite-browser-external-DrUO0isw.js} +0 -0
  94. /package/dist/public/assets/{calendar-EJgVmWKE.js → calendar-B-WVKwTL.js} +0 -0
  95. /package/dist/public/assets/{code-highlighter-impl-CX4PVgAd.js → code-highlighter-impl-D-lTmjEE.js} +0 -0
  96. /package/dist/public/assets/{messages-DvrupXSr.js → messages-AuL-SqIm.js} +0 -0
  97. /package/dist/public/assets/{messages-DZE-VzhB.js → messages-B13vqusL.js} +0 -0
  98. /package/dist/public/assets/{messages-DnatZmOM.js → messages-B6TwkPF1.js} +0 -0
  99. /package/dist/public/assets/{messages-BzB2vjb8.js → messages-BVrCMt9-.js} +0 -0
  100. /package/dist/public/assets/{messages-6fcD2J3f.js → messages-Baom0hOY.js} +0 -0
  101. /package/dist/public/assets/{messages-CHyeSnWa.js → messages-CHSE3ku3.js} +0 -0
  102. /package/dist/public/assets/{messages-DrjcM4fb.js → messages-CI_JW3Ka.js} +0 -0
  103. /package/dist/public/assets/{messages-BcgMON4t.js → messages-COzhvUrO.js} +0 -0
  104. /package/dist/public/assets/{messages-BfSRfllp.js → messages-CRQg60mG.js} +0 -0
  105. /package/dist/public/assets/{messages-CFC4xaZ5.js → messages-CmF2j2PB.js} +0 -0
  106. /package/dist/public/assets/{messages-DZfszRg3.js → messages-gjJDNMOj.js} +0 -0
  107. /package/dist/public/assets/{schema-fields-view-intent-CC2U0Dcz.js → schema-fields-view-intent-_9aQC2Cm.js} +0 -0
  108. /package/dist/public/assets/{share-metadata-rows-l9N1Abdo.js → share-metadata-rows-x7aTYdJp.js} +0 -0
  109. /package/dist/public/assets/{tabs-CGk-Lem4.js → tabs-B9Ncs2Ot.js} +0 -0
  110. /package/dist/public/assets/{tag-pill-input-vfk8h50K.js → tag-pill-input-iFjKjjTv.js} +0 -0
  111. /package/dist/public/assets/{thread-client-Cww-A_o6.js → thread-client-D6kQOHZl.js} +0 -0
  112. /package/dist/public/assets/{useLintConfigViewMode-B1AUcWg_.js → useLintConfigViewMode-E5ymIys_.js} +0 -0
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-highlighter-impl-CX4PVgAd.js","./engine-compile-DQkU3NTo.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./chunk-CYidjpOJ.js","./css-DVo_6oqG.js","./diff-KPRaIRKE.js","./docker-B39Gr-F8.js","./go-Cc9Pf4kZ.js","./html-BAFrkEUa.js","./javascript-CZOCR3Iu.js","./json-C3XLmYL7.js","./markdown-CPBSohqB.js","./python-X9bxiKBC.js","./rust-BKZ0ei9R.js","./shellscript-CS0MpU9F.js","./sql-BkyzSV9J.js","./toml-DUS-uie-.js","./tsx-B0YyuJfA.js","./yaml-Bkc3eLkv.js","./ok-syntax-theme-COS26B1a.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{O as r,Xn as i,Yr as a,ar as o,fr as s,i as c,ir as l,jr as u,rr as d,sr as f,tr as p}from"./DocumentContext-BdZiErvh.js";import{t as m}from"./react-f2sANaYj.js";import{n as h,r as g}from"./dist-Nvb76hAm.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{i as v,o as y}from"./local-menu-action-bus-CTOHR9LV.js";import{t as b}from"./utils-CPqDy6Hr.js";import{n as x,r as S}from"./clipboard-adapter-815RzzoI.js";import{t as C}from"./button-Cym3gapE.js";import{i as w,n as T,t as E}from"./tooltip-DttaCTqz.js";import{c as D,i as O,t as k}from"./dialog-_kqu_91M.js";import{a as A,c as j,d as M,f as N,i as P,l as F,n as ee,o as te,p as ne,r as I,s as re,t as L,u as ie,v as ae,y as R}from"./progress-DKwbAv_d.js";import{n as z}from"./separator-DmmNuc_B.js";import{t as oe}from"./switch-iwBsEWej.js";import{b as B,d as se,t as V}from"./RegisteredAgentIcon-5StNVeMK.js";import{$r as ce,pt as H}from"./dist-D6JA916i.js";import{n as le}from"./dist-CJhtNlOm2.js";import{t as U}from"./dist-Cr4-nBVI.js";import{g as ue,p as de,r as fe}from"./launcher-selection-BZDeoOtN.js";import{n as pe}from"./use-workspace-DAuqjfCS.js";import{t as W}from"./createLucideIcon-BYL3gqKc.js";import{f as G,h as K,o as q}from"./Mermaid-Cw1EnMJu.js";import{t as me}from"./check-D16atakQ.js";import{t as he}from"./chevron-down-DZvAgb7P.js";import{t as ge}from"./chevron-right-ARd3H40k.js";import{o as _e,r as ve,s as ye}from"./prop-types-gfjew8MI.js";import{a as be,c as J,d as xe,f as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as je}from"./dropdown-menu-DYfdElMl.js";import{n as Me,t as Ne}from"./terminal-D4S9lNQf.js";import{Tt as Pe}from"./CodeMirrorPropInput-CRa8tGX-.js";import{t as Fe}from"./list-plus-BXaFXlLg.js";import{t as Ie}from"./spinner-By93kIxm.js";import{c as Le,n as Re,o as ze,s as Be,t as Ve}from"./comment-chips-Bm8WWDT7.js";import{t as He}from"./square-pen-DK8eXxpV.js";import{t as Ue}from"./trash-2-Dxkzm2qO.js";import{t as We}from"./triangle-alert-CnzPFn6V.js";import{t as Ge}from"./wrench-X0fcm_5p.js";import{t as Ke}from"./x-CAqepOgq.js";import{i as qe,l as Je}from"./doc-hash-Dx9hwyex.js";import{t as Ye}from"./external-link-DSbrgMTH.js";import{t as Xe}from"./badge-DXNaFLJT.js";import{t as Ze}from"./skeleton-IXDSleLh.js";import{t as Qe}from"./textarea-BlVs71hx.js";import{n as $e}from"./agent-presence-BFDnO46z.js";import{i as et,n as tt}from"./chunk-BO2N2NFS-CUMnMIzo.js";import{n as nt}from"./libesm-AifqMnJy.js";import{n as rt}from"./ok-syntax-theme-COS26B1a.js";import{a as it,d as at,f as ot,m as st,n as ct,p as lt,r as ut,s as dt}from"./thread-client-Cww-A_o6.js";import{i as ft,n as pt}from"./launch-agent-thread-CYKu9e2m.js";var mt=W(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ht=W(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),gt=W(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),_t=W(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=_(),vt=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),yt=new Set([`auto`]);function bt(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function xt(e){let t=bt(e.id),n=bt(e.name??``);return yt.has(t)||yt.has(n)?!0:vt.test(t)||vt.test(n)}var St={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function Ct(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=St[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&xt(r)?`self-managed`:i}var X=e(m(),1),Z=n();function wt({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=Tt(Et(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...Tt(a,o),ref:kt(a.ref,o.ref)};return X.cloneElement(n,s)}function Tt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=kt(i,r):Ot(n)&&typeof i==`function`&&typeof r==`function`?t[n]=Dt(r,i):t[n]=r}}return t}function Et(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function Dt(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function Ot(e){return/^on[A-Z]/.test(e)}function kt(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var At=8,jt=64,Mt=0,Nt=.5,Pt=180,Ft=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),It={start:!1,end:!1},Lt={currentAnchorId:null,visibleMessageIds:[]};function Rt({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return It;let i=Xt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function zt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Lt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of Bt(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Nt&&(u=e)}return l.length===0&&u===null?Lt:{currentAnchorId:u,visibleMessageIds:l}}function Bt(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Vt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Ht(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Ut(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Wt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Gt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of Bt(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Kt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=qt(t,i),o=t.getBoundingClientRect().height,s=$t(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function qt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Jt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Yt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Xt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Xt({content:e,spacer:t,viewport:n}){let r=Bt(e,t),i=Qt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Zt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Qt(e){let t=window.getComputedStyle(e);return{end:tn(t.paddingBlockEnd||t.paddingBottom),start:tn(t.paddingBlockStart||t.paddingTop)}}function $t(e){let t=e?.parentElement;return t?Qt(t):{end:0,start:0}}function en(e){if(!e)return 0;let t=window.getComputedStyle(e);return tn(t.rowGap===`normal`?t.gap:t.rowGap)}function tn(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function nn({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},Pt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Nt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Zt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Kt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Yt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:Jt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function rn(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function an(e,t){return rn(e,t)}function on(){return rn(Lt,cn)}function sn(e,t){return e.start===t.start&&e.end===t.end}function cn(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function ln({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=an(It,sn)),j.current===null&&(j.current=on()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function un(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function dn({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=At,scrollPreviousItemPeek:r=jt,scrollMargin:i=Mt}){let a=ln({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=X.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let te=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),ne=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Nt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),I=X.useCallback(()=>{let e=Rt({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});ne(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;te(t),k.setSnapshot(t)},[ne,k,te]),re=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,I()}))},[I]),L=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(zt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:ie,reanchorToAnchoredMessage:ae,scrollToElement:R,scrollToEnd:z,scrollToMessage:oe,scrollToStart:B}=nn({refs:a,commitScrollState:I,scheduleStateCommit:re,scheduleVisibilitySync:L}),se=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=Jt(e.element,t)-e.viewportTop;return Math.abs(n)<=Nt?!1:(t.scrollTop+=n,e.viewportTop=Jt(e.element,t),re(),L(),!0)},[re,L]),V=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Gt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:Jt(n,t)}:null},[]),ce=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ie()&&V()}))},[V,ie]),H=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Wt(Bt(t,D.current)):null;if(!t||!n||!r)e=z({behavior:`auto`});else{let i=qt(r,n);e=Xt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?z({behavior:`auto`}):R(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?z({behavior:`auto`}):B({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,R,z,B]),le=X.useCallback(()=>{let e=u.current;if(!e)return;let t=Bt(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ie())return;if(n===0){if(H()||t.length>0&&s.current&&z({behavior:`auto`}))return;I(),L();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){se();return}if(t.length>n){let e=Vt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Ut(t,n)){z({behavior:`auto`});return}R(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Ht(t,F.current);if(e){R(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?z({behavior:`auto`}):(I(),L())})(),V()},[H,V,I,ie,se,L,R,z]),U=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){z({behavior:`auto`});return}let e=E.current;if(ae()){s.current&&e>0&&E.current===0&&z({behavior:`auto`});return}re(),L()},[ae,re,L,z]),ue=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){L();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}L()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),L()}},[L,N]),de=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Lt)},[N]),fe=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),L(),v.current?.messageId===e&&ce();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),L())},[ce,L]),pe=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),W=X.useCallback(()=>te(k.getSnapshot()),[k,te]),G=un(x,W),K=un(A,W),q=X.useCallback(e=>{u.current=e},[]),me=X.useCallback(e=>{D.current=e,T.current=en(e?.parentElement??null)},[]),he=X.useCallback(()=>{I(),L(),V()},[V,I,L]),ge=X.useMemo(()=>({handleContentChange:le,handleResize:U,observeVisibility:ue,preserveScrollOnPrependRef:b,scrollToEnd:z,scrollToMessage:oe,scrollToStart:B,setContentElement:q,setRootElement:G,setSpacerElement:me,setViewportElement:K,stateStore:k,syncAfterScroll:he,unobserveVisibility:de,userScrollIntent:pe,viewportRef:A,visibilityStore:N}),[le,U,ue,z,oe,B,q,G,me,K,k,he,de,pe,N]);return X.useLayoutEffect(()=>{H()},[H]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){z({behavior:`auto`});return}I()},[e,I,z]),{context:ge,registerMessage:fe}}function fn(e){let t=X.useRef(e);return t.current=e,t}var pn=X.createContext(null),mn=X.createContext(null);function hn(){let e=X.useContext(pn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function gn(){let e=X.useContext(mn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function _n(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=hn();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function vn({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=dn({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(pn.Provider,{value:o,children:(0,Z.jsx)(mn.Provider,{value:s,children:t})})}function yn({children:e,...t}){let{setRootElement:n}=hn();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function bn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=hn();f.current=o;let _=X.useCallback(e=>{p(e),kt(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Ft.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function xn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=hn(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),kt(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function Sn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=gn(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),kt(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function Cn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=hn(),d=fn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return wt({defaultTagName:`button`,props:Tt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var wn={Provider:vn,Root:yn,Viewport:bn,Content:xn,Item:Sn,Button:Cn};function Tn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(wn.Provider,{...e}),t[0]=e,t[1]=n),n}function En(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function On(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kn(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=b(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(wn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function An(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=b(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let p;t[10]!==a||t[11]!==d||t[12]!==u?(p=a??(0,Z.jsx)(C,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=p):p=t[13];let m;t[14]!==n||t[15]!==l?(m=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(h,{id:`EQXPXf`}):(0,Z.jsx)(h,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=m):m=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==u?(g=(0,Z.jsx)(wn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:p,...i,children:m}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=u,t[24]=g):g=t[24],g}var jn=new Map,Mn=0;function Nn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Pn(){let e=Nn();for(let[t,n]of jn)t((e-n)/1e3);if(jn.size===0){Mn=0;return}Mn=requestAnimationFrame(Pn)}function Fn(e){return jn.set(e,Nn()),Mn===0&&typeof requestAnimationFrame==`function`&&(Mn=requestAnimationFrame(Pn)),()=>{jn.delete(e),jn.size===0&&Mn!==0&&(cancelAnimationFrame(Mn),Mn=0)}}var Q=40,In=15,Ln=15,$=12.4,Rn={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},zn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,Bn=2.26,Vn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Hn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Un(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[In+(e[0]-(i+a)/2)*c,Ln+(e[1]-(o+s)/2)*c])}function Wn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Gn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Kn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Hn(Un(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Hn(Un(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Hn(Un(t(e,Q),n))}function s(e,n,r){return Hn(Wn(t(e,Q),n,r))}function c(e,n,r){return Hn(t(e,Q).map(e=>[In+(e[0]-In)*n,Ln+(e[1]-Ln)*r]))}function l(e,n,r=1){return Hn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[In+(e[0]-In)*a,Ln+(e[1]-Ln)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([In+Math.cos(a)*t,Ln+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(In+Math.cos(i)*o).toFixed(2)} ${(Ln+Math.sin(i)*o).toFixed(2)}`}return Hn(Un(Wn(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[In+Math.cos(n)*e,Ln+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[In+Math.cos(t)*n,Ln+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Hn(Un(Wn(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([In+Math.cos(o)*c,Ln+Math.sin(o)*c])}return Hn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([In+Math.cos(r)*e,Ln+Math.sin(r)*e])}return Hn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function qn(){let e=Gn();if(e===null)return null;try{let t=Kn(e),n=t.silhouette(S,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(Vn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Jn;function Yn(){return Jn===void 0&&(Jn=qn()),Jn}var Xn=/-?\d+(?:\.\d+)?/g;function Zn(e){return{fragments:e[0].split(Xn),numbers:e.map(e=>(e.match(Xn)??[]).map(Number))}}function Qn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function $n(e){return e<.5?2*e*e:1-2*(1-e)**2}var er=.58;function tr(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:$n(r?Math.min(1,c/er):c)}}var nr=Rn,rr=[nr.blobby,nr.triangle,nr.square,nr.sparkle,nr.comma,nr.pentagon,nr.hexagon,nr.blobby],ir={[nr.comma]:-2.9},ar={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},or=20,sr=8.4;function cr(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=g(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=q(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,zn),e.setAttribute(`stroke-width`,String(Bn)),s.current?.removeAttribute(`transform`);return}let t=Yn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Zn(t.paths),r=NaN,i=``;return Fn(t=>{let{from:a,to:o,t:c}=tr(t,rr.length,sr,!0),l=n.numbers[rr[a]],u=n.numbers[rr[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Qn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=ir[rr[a]]??0,h=m+((ir[rr[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,X.useEffect)(p,m);let h;t[6]===r?h=t[7]:(h=b(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=h);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`path`,{ref:o,d:zn,fill:`none`,stroke:`currentColor`,strokeWidth:Bn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:or,height:or,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[v,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ar.leftCx,cy:ar.cy,rx:ar.rx,ry:ar.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ar.rightCx,cy:ar.cy,rx:ar.rx,ry:ar.ry,fill:`currentColor`})]})]})})}),t[11]=y):y=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==h||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:h,"data-testid":i,children:[_,y,S]}),t[17]=S,t[18]=h,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function lr(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function ur(e){let t=lr(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:U._({id:`GK5Ft_`,values:{0:r.name}})}function dr(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?U._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?U._({id:`R6ABfU`}):null}var fr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),pr=700*1024;function mr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function hr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function gr(e){let t=e.type||``;if(!fr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:pr}};let n=await hr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function _r(e){return yr(e,e=>e.type.startsWith(`image/`))}function vr(e){return yr(e,e=>e.size>0)}function yr(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function br(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function xr(e,t={}){if((e.type||``).startsWith(`image/`))return gr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=br(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var Sr=3,Cr=Sr*2+2;function wr(e){let t=e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-highlighter-impl-D-lTmjEE.js","./engine-compile-DQkU3NTo.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./chunk-CYidjpOJ.js","./css-DVo_6oqG.js","./diff-KPRaIRKE.js","./docker-B39Gr-F8.js","./go-Cc9Pf4kZ.js","./html-BAFrkEUa.js","./javascript-CZOCR3Iu.js","./json-C3XLmYL7.js","./markdown-CPBSohqB.js","./python-X9bxiKBC.js","./rust-BKZ0ei9R.js","./shellscript-CS0MpU9F.js","./sql-BkyzSV9J.js","./toml-DUS-uie-.js","./tsx-B0YyuJfA.js","./yaml-Bkc3eLkv.js","./ok-syntax-theme-COS26B1a.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{O as r,Xn as i,Yr as a,ar as o,fr as s,i as c,ir as l,jr as u,rr as d,sr as f,tr as p}from"./DocumentContext-Dq9Tp3cJ.js";import{t as m}from"./react-f2sANaYj.js";import{n as h,r as g}from"./dist-Nvb76hAm.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{i as v,o as y}from"./local-menu-action-bus-CTOHR9LV.js";import{t as b}from"./utils-CPqDy6Hr.js";import{n as x,r as S}from"./clipboard-adapter-815RzzoI.js";import{t as C}from"./button-Cym3gapE.js";import{i as w,n as T,t as E}from"./tooltip-DttaCTqz.js";import{c as D,i as O,t as k}from"./dialog-_kqu_91M.js";import{a as A,c as j,d as M,f as N,i as P,l as F,n as ee,o as te,p as ne,r as I,s as re,t as L,u as ie,v as ae,y as R}from"./progress-D-1ao2o_.js";import{n as z}from"./separator-DmmNuc_B.js";import{t as oe}from"./switch-iwBsEWej.js";import{b as B,d as se,t as V}from"./RegisteredAgentIcon-5StNVeMK.js";import{$r as ce,pt as H}from"./dist-D6JA916i.js";import{n as le}from"./dist-CJhtNlOm2.js";import{t as U}from"./dist-Cr4-nBVI.js";import{g as ue,p as de,r as fe}from"./launcher-selection-BZDeoOtN.js";import{n as pe}from"./use-workspace-DAuqjfCS.js";import{t as W}from"./createLucideIcon-BYL3gqKc.js";import{f as G,h as K,o as q}from"./Mermaid-Cw1EnMJu.js";import{t as me}from"./check-D16atakQ.js";import{t as he}from"./chevron-down-DZvAgb7P.js";import{t as ge}from"./chevron-right-ARd3H40k.js";import{o as _e,r as ve,s as ye}from"./prop-types-gfjew8MI.js";import{a as be,c as J,d as xe,f as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as je}from"./dropdown-menu-DYfdElMl.js";import{n as Me,t as Ne}from"./terminal-D4S9lNQf.js";import{Tt as Pe}from"./CodeMirrorPropInput-CxKiaHDG.js";import{t as Fe}from"./list-plus-BXaFXlLg.js";import{t as Ie}from"./spinner-By93kIxm.js";import{c as Le,n as Re,o as ze,s as Be,t as Ve}from"./comment-chips-D8HG458e.js";import{t as He}from"./square-pen-DK8eXxpV.js";import{t as Ue}from"./trash-2-Dxkzm2qO.js";import{t as We}from"./triangle-alert-CnzPFn6V.js";import{t as Ge}from"./wrench-X0fcm_5p.js";import{t as Ke}from"./x-CAqepOgq.js";import{i as qe,l as Je}from"./doc-hash-Dx9hwyex.js";import{t as Ye}from"./external-link-DSbrgMTH.js";import{t as Xe}from"./badge-DXNaFLJT.js";import{t as Ze}from"./skeleton-IXDSleLh.js";import{t as Qe}from"./textarea-BlVs71hx.js";import{n as $e}from"./agent-presence-BFDnO46z.js";import{i as et,n as tt}from"./chunk-BO2N2NFS-CUMnMIzo.js";import{n as nt}from"./libesm-AifqMnJy.js";import{n as rt}from"./ok-syntax-theme-COS26B1a.js";import{a as it,d as at,f as ot,m as st,n as ct,p as lt,r as ut,s as dt}from"./thread-client-D6kQOHZl.js";import{i as ft,n as pt}from"./launch-agent-thread-Clx5mTVb.js";var mt=W(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ht=W(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),gt=W(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),_t=W(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=_(),vt=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),yt=new Set([`auto`]);function bt(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function xt(e){let t=bt(e.id),n=bt(e.name??``);return yt.has(t)||yt.has(n)?!0:vt.test(t)||vt.test(n)}var St={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function Ct(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=St[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&xt(r)?`self-managed`:i}var X=e(m(),1),Z=n();function wt({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=Tt(Et(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...Tt(a,o),ref:kt(a.ref,o.ref)};return X.cloneElement(n,s)}function Tt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=kt(i,r):Ot(n)&&typeof i==`function`&&typeof r==`function`?t[n]=Dt(r,i):t[n]=r}}return t}function Et(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function Dt(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function Ot(e){return/^on[A-Z]/.test(e)}function kt(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var At=8,jt=64,Mt=0,Nt=.5,Pt=180,Ft=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),It={start:!1,end:!1},Lt={currentAnchorId:null,visibleMessageIds:[]};function Rt({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return It;let i=Xt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function zt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Lt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of Bt(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Nt&&(u=e)}return l.length===0&&u===null?Lt:{currentAnchorId:u,visibleMessageIds:l}}function Bt(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Vt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Ht(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Ut(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Wt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Gt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of Bt(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Kt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=qt(t,i),o=t.getBoundingClientRect().height,s=$t(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function qt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Jt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Yt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Xt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Xt({content:e,spacer:t,viewport:n}){let r=Bt(e,t),i=Qt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Zt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Qt(e){let t=window.getComputedStyle(e);return{end:tn(t.paddingBlockEnd||t.paddingBottom),start:tn(t.paddingBlockStart||t.paddingTop)}}function $t(e){let t=e?.parentElement;return t?Qt(t):{end:0,start:0}}function en(e){if(!e)return 0;let t=window.getComputedStyle(e);return tn(t.rowGap===`normal`?t.gap:t.rowGap)}function tn(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function nn({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},Pt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Nt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Zt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Kt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Yt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:Jt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function rn(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function an(e,t){return rn(e,t)}function on(){return rn(Lt,cn)}function sn(e,t){return e.start===t.start&&e.end===t.end}function cn(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function ln({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=an(It,sn)),j.current===null&&(j.current=on()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function un(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function dn({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=At,scrollPreviousItemPeek:r=jt,scrollMargin:i=Mt}){let a=ln({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=X.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let te=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),ne=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Nt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),I=X.useCallback(()=>{let e=Rt({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});ne(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;te(t),k.setSnapshot(t)},[ne,k,te]),re=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,I()}))},[I]),L=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(zt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:ie,reanchorToAnchoredMessage:ae,scrollToElement:R,scrollToEnd:z,scrollToMessage:oe,scrollToStart:B}=nn({refs:a,commitScrollState:I,scheduleStateCommit:re,scheduleVisibilitySync:L}),se=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=Jt(e.element,t)-e.viewportTop;return Math.abs(n)<=Nt?!1:(t.scrollTop+=n,e.viewportTop=Jt(e.element,t),re(),L(),!0)},[re,L]),V=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Gt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:Jt(n,t)}:null},[]),ce=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ie()&&V()}))},[V,ie]),H=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Wt(Bt(t,D.current)):null;if(!t||!n||!r)e=z({behavior:`auto`});else{let i=qt(r,n);e=Xt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?z({behavior:`auto`}):R(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?z({behavior:`auto`}):B({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,R,z,B]),le=X.useCallback(()=>{let e=u.current;if(!e)return;let t=Bt(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ie())return;if(n===0){if(H()||t.length>0&&s.current&&z({behavior:`auto`}))return;I(),L();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){se();return}if(t.length>n){let e=Vt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Ut(t,n)){z({behavior:`auto`});return}R(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Ht(t,F.current);if(e){R(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?z({behavior:`auto`}):(I(),L())})(),V()},[H,V,I,ie,se,L,R,z]),U=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){z({behavior:`auto`});return}let e=E.current;if(ae()){s.current&&e>0&&E.current===0&&z({behavior:`auto`});return}re(),L()},[ae,re,L,z]),ue=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){L();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}L()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),L()}},[L,N]),de=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Lt)},[N]),fe=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),L(),v.current?.messageId===e&&ce();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),L())},[ce,L]),pe=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),W=X.useCallback(()=>te(k.getSnapshot()),[k,te]),G=un(x,W),K=un(A,W),q=X.useCallback(e=>{u.current=e},[]),me=X.useCallback(e=>{D.current=e,T.current=en(e?.parentElement??null)},[]),he=X.useCallback(()=>{I(),L(),V()},[V,I,L]),ge=X.useMemo(()=>({handleContentChange:le,handleResize:U,observeVisibility:ue,preserveScrollOnPrependRef:b,scrollToEnd:z,scrollToMessage:oe,scrollToStart:B,setContentElement:q,setRootElement:G,setSpacerElement:me,setViewportElement:K,stateStore:k,syncAfterScroll:he,unobserveVisibility:de,userScrollIntent:pe,viewportRef:A,visibilityStore:N}),[le,U,ue,z,oe,B,q,G,me,K,k,he,de,pe,N]);return X.useLayoutEffect(()=>{H()},[H]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){z({behavior:`auto`});return}I()},[e,I,z]),{context:ge,registerMessage:fe}}function fn(e){let t=X.useRef(e);return t.current=e,t}var pn=X.createContext(null),mn=X.createContext(null);function hn(){let e=X.useContext(pn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function gn(){let e=X.useContext(mn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function _n(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=hn();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function vn({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=dn({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(pn.Provider,{value:o,children:(0,Z.jsx)(mn.Provider,{value:s,children:t})})}function yn({children:e,...t}){let{setRootElement:n}=hn();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function bn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=hn();f.current=o;let _=X.useCallback(e=>{p(e),kt(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Ft.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function xn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=hn(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),kt(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function Sn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=gn(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),kt(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function Cn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=hn(),d=fn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return wt({defaultTagName:`button`,props:Tt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var wn={Provider:vn,Root:yn,Viewport:bn,Content:xn,Item:Sn,Button:Cn};function Tn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(wn.Provider,{...e}),t[0]=e,t[1]=n),n}function En(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function On(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kn(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=b(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(wn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function An(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=b(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let p;t[10]!==a||t[11]!==d||t[12]!==u?(p=a??(0,Z.jsx)(C,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=p):p=t[13];let m;t[14]!==n||t[15]!==l?(m=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(h,{id:`EQXPXf`}):(0,Z.jsx)(h,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=m):m=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==u?(g=(0,Z.jsx)(wn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:p,...i,children:m}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=u,t[24]=g):g=t[24],g}var jn=new Map,Mn=0;function Nn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Pn(){let e=Nn();for(let[t,n]of jn)t((e-n)/1e3);if(jn.size===0){Mn=0;return}Mn=requestAnimationFrame(Pn)}function Fn(e){return jn.set(e,Nn()),Mn===0&&typeof requestAnimationFrame==`function`&&(Mn=requestAnimationFrame(Pn)),()=>{jn.delete(e),jn.size===0&&Mn!==0&&(cancelAnimationFrame(Mn),Mn=0)}}var Q=40,In=15,Ln=15,$=12.4,Rn={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},zn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,Bn=2.26,Vn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Hn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Un(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[In+(e[0]-(i+a)/2)*c,Ln+(e[1]-(o+s)/2)*c])}function Wn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Gn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Kn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Hn(Un(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Hn(Un(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Hn(Un(t(e,Q),n))}function s(e,n,r){return Hn(Wn(t(e,Q),n,r))}function c(e,n,r){return Hn(t(e,Q).map(e=>[In+(e[0]-In)*n,Ln+(e[1]-Ln)*r]))}function l(e,n,r=1){return Hn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[In+(e[0]-In)*a,Ln+(e[1]-Ln)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([In+Math.cos(a)*t,Ln+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(In+Math.cos(i)*o).toFixed(2)} ${(Ln+Math.sin(i)*o).toFixed(2)}`}return Hn(Un(Wn(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[In+Math.cos(n)*e,Ln+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[In+Math.cos(t)*n,Ln+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Hn(Un(Wn(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([In+Math.cos(o)*c,Ln+Math.sin(o)*c])}return Hn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([In+Math.cos(r)*e,Ln+Math.sin(r)*e])}return Hn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function qn(){let e=Gn();if(e===null)return null;try{let t=Kn(e),n=t.silhouette(S,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(Vn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Jn;function Yn(){return Jn===void 0&&(Jn=qn()),Jn}var Xn=/-?\d+(?:\.\d+)?/g;function Zn(e){return{fragments:e[0].split(Xn),numbers:e.map(e=>(e.match(Xn)??[]).map(Number))}}function Qn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function $n(e){return e<.5?2*e*e:1-2*(1-e)**2}var er=.58;function tr(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:$n(r?Math.min(1,c/er):c)}}var nr=Rn,rr=[nr.blobby,nr.triangle,nr.square,nr.sparkle,nr.comma,nr.pentagon,nr.hexagon,nr.blobby],ir={[nr.comma]:-2.9},ar={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},or=20,sr=8.4;function cr(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=g(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=q(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,zn),e.setAttribute(`stroke-width`,String(Bn)),s.current?.removeAttribute(`transform`);return}let t=Yn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Zn(t.paths),r=NaN,i=``;return Fn(t=>{let{from:a,to:o,t:c}=tr(t,rr.length,sr,!0),l=n.numbers[rr[a]],u=n.numbers[rr[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Qn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=ir[rr[a]]??0,h=m+((ir[rr[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,X.useEffect)(p,m);let h;t[6]===r?h=t[7]:(h=b(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=h);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`path`,{ref:o,d:zn,fill:`none`,stroke:`currentColor`,strokeWidth:Bn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:or,height:or,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[v,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ar.leftCx,cy:ar.cy,rx:ar.rx,ry:ar.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ar.rightCx,cy:ar.cy,rx:ar.rx,ry:ar.ry,fill:`currentColor`})]})]})})}),t[11]=y):y=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==h||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:h,"data-testid":i,children:[_,y,S]}),t[17]=S,t[18]=h,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function lr(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function ur(e){let t=lr(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:U._({id:`GK5Ft_`,values:{0:r.name}})}function dr(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?U._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?U._({id:`R6ABfU`}):null}var fr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),pr=700*1024;function mr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function hr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function gr(e){let t=e.type||``;if(!fr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:pr}};let n=await hr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function _r(e){return yr(e,e=>e.type.startsWith(`image/`))}function vr(e){return yr(e,e=>e.size>0)}function yr(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function br(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function xr(e,t={}){if((e.type||``).startsWith(`image/`))return gr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=br(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var Sr=3,Cr=Sr*2+2;function wr(e){let t=e.split(`
3
3
  `);return t[t.length-1]===``&&t.pop(),t}function Tr(e,t){if(e===null)return wr(t).map(e=>({type:`add`,text:e}));let n=[],r=nt(e,t);for(let[e,t]of r.entries()){let i=wr(t.value);if(t.added){for(let e of i)n.push({type:`add`,text:e});continue}if(t.removed){for(let e of i)n.push({type:`del`,text:e});continue}if(i.length<=Cr){for(let e of i)n.push({type:`ctx`,text:e});continue}let a=e>0?i.slice(0,Sr):[],o=e<r.length-1?i.slice(-Sr):[];for(let e of a)n.push({type:`ctx`,text:e});n.push({type:`gap`,count:i.length-a.length-o.length});for(let e of o)n.push({type:`ctx`,text:e})}return n}var Er=/^\[[^\]]{1,32}\]\s*/,Dr=/\bhttps?:\/\/\S+/,Or=/\b[A-Z0-9]{3,8}(?:-[A-Z0-9]{3,8})+\b/;function kr(e){try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return e}}function Ar(e){let t,n,r=[];for(let i of e){let e=i.replace(Er,``).trim();if(e===``)continue;let a=e.match(Dr);if(n===void 0&&a!==null){n=a[0].replace(/[).,]+$/,``);let e=new URLSearchParams(n.split(`?`)[1]??``).get(`user_code`);e!==null&&e!==``&&(t=e)}if(t===void 0){let n=e.match(Or);n!==null&&(t=n[0])}let o=t!==void 0&&e.includes(t),s=n!==void 0&&e.includes(n);!o&&!s&&r.push(e)}return{...t===void 0?{}:{code:t},...n===void 0?{}:{url:n},lines:r}}var jr=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function Mr(e){return e.replace(jr,``)}function Nr(e){return Mr(e).split(`
4
4
  `).map(e=>{let t=e.replace(/\r+$/,``),n=t.lastIndexOf(`\r`);return n===-1?t:t.slice(n+1)}).join(`
5
- `)}var Pr=new Set(H),Fr=/^(?:open[-_ ]?knowledge|ok)$/,Ir=/^(?:mcp[^a-z0-9]+)?(?:open[-_ ]?knowledge|ok)[^a-z0-9]+([a-z_]+)$/;function Lr(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Rr(e){return Ir.exec(e.trim().toLowerCase())?.[1]??null}function zr(e,t){let n=F(Lr(t),`server`);if(n!==null&&!Fr.test(n.toLowerCase()))return null;let r=ie(t),i=[Rr(e),r?.tool??null].find(e=>e!==null&&Pr.has(e));return i===void 0?null:{tool:i,args:r?.args??{}}}function Br(e){return typeof e==`string`?e.trim()===``?[]:[e.trim()]:Array.isArray(e)?e.flatMap(Br):typeof e==`object`&&e?Br(e.path):[]}var Vr=[`document`,`documents`,`folder`,`file`,`template`,`asset`,`path`,`from`,`name`];function Hr(e){for(let t of Vr){let n=Br(e[t]);if(n.length>0)return n}return[]}function Ur(e){return e.replace(/\.mdx?$/i,``)}var Wr=120;function Gr(e){if(typeof e!=`string`)return null;let t=e.replace(/\s+/g,` `).trim();return t===``?null:t.length>Wr?`${t.slice(0,Wr-1)}…`:t}function Kr(e,t){let n=Hr(t),r=n[0],i=n.length>1?U._({id:`C7waqI`,values:{0:n.length}}):r===void 0?null:Ur(r);switch(e){case`write`:return{glyph:`edit`,text:i===null?U._({id:`tLX6LY`}):U._({id:`MvWBwz`,values:{subject:i}})};case`edit`:return{glyph:`edit`,text:i===null?U._({id:`Fx9aOF`}):U._({id:`7aNk5D`,values:{subject:i}})};case`delete`:return{glyph:`delete`,text:i===null?U._({id:`DcFr-y`}):U._({id:`Gb_h4G`,values:{subject:i}})};case`move`:{let e=Br(t.to)[0];if(i===null||e===void 0)return{glyph:`move`,text:U._({id:`RGptDW`})};let n=Ur(e);return{glyph:`move`,text:U._({id:`pbyEp3`,values:{subject:i,destination:n}})}}case`search`:{let e=Gr(t.query);return{glyph:`search`,text:e===null?U._({id:`EvXKHE`}):U._({id:`yWfjqS`,values:{query:e}})}}case`exec`:{let e=Gr(t.command);return{glyph:`execute`,text:e===null?U._({id:`FS4Udk`}):U._({id:`a5gwRt`,values:{command:e}})}}case`lint`:case`audit`:return{glyph:`check`,text:i===null?U._({id:`7S7FNA`}):U._({id:`TEJiKw`,values:{subject:i}})};case`links`:return{glyph:`link`,text:i===null?U._({id:`vallqD`}):U._({id:`KDrbNG`,values:{subject:i}})};case`history`:return{glyph:`history`,text:i===null?U._({id:`Ug2xzC`}):U._({id:`90-wKT`,values:{subject:i}})};case`config`:{let e=Gr(t.key);return{glyph:`settings`,text:e===null?U._({id:`ZwpggY`}):U._({id:`-oHckY`,values:{key:e}})}}case`skills`:return{glyph:`read`,text:U._({id:`4mp6Tv`})};case`install`:return{glyph:`install`,text:i===null?U._({id:`4ErgAf`}):U._({id:`WbWtif`,values:{subject:i}})};case`import`:{let e=Gr(t.skill)??Gr(t.source);return{glyph:`install`,text:e===null?U._({id:`DhT_PK`}):U._({id:`hCattk`,values:{source:e}})}}case`palette`:return{glyph:`read`,text:U._({id:`7czmD1`})};case`preview_url`:return{glyph:`fetch`,text:U._({id:`UL-9ej`})};case`share_link`:return{glyph:`share`,text:i===null?U._({id:`ABq-cq`}):U._({id:`ibE3-O`,values:{subject:i}})};case`checkpoint`:return{glyph:`history`,text:U._({id:`5b3WD-`})};case`conflicts`:return{glyph:`check`,text:U._({id:`i94lQe`})};case`resolve_conflict`:return{glyph:`edit`,text:i===null?U._({id:`_YWqV2`}):U._({id:`AeLo3p`,values:{subject:i}})};case`restore_version`:return{glyph:`restore`,text:i===null?U._({id:`caiyaU`}):U._({id:`hS0wC4`,values:{subject:i}})};default:return{glyph:`other`,text:U._({id:`vhGTWU`,values:{tool:e}})}}}var qr={read:`read`,edit:`edit`,delete:`delete`,move:`move`,search:`search`,execute:`execute`,think:`think`,fetch:`fetch`,switch_mode:`switch_mode`};function Jr(e){let t=zr(e.title,e.rawInput);return t===null?{text:e.title,glyph:qr[e.toolKind]??`other`}:Kr(t.tool,t.args)}var Yr=new Map([{id:`shellscript`,aliases:[`bash`,`sh`,`shell`,`zsh`]},{id:`tsx`,aliases:[`typescript`,`ts`,`jsx`]},{id:`javascript`,aliases:[`js`]},{id:`json`,aliases:[`jsonc`]},{id:`python`,aliases:[`py`]},{id:`rust`,aliases:[`rs`]},{id:`go`,aliases:[]},{id:`css`,aliases:[]},{id:`html`,aliases:[]},{id:`markdown`,aliases:[`md`]},{id:`yaml`,aliases:[`yml`]},{id:`toml`,aliases:[]},{id:`sql`,aliases:[]},{id:`diff`,aliases:[]},{id:`dockerfile`,aliases:[`docker`]}].flatMap(e=>[[e.id,e.id],...e.aliases.map(t=>[t,e.id])])),Xr=[rt,rt],Zr=400,Qr=new Map,$r=new Map;function ei(e,t){return`${t}:${e.length}:${e.slice(0,100)}:${e.length>100?e.slice(-100):``}`}var ti={name:`shiki`,type:`code-highlighter`,getSupportedLanguages:()=>Array.from(Yr.keys()),supportsLanguage:e=>Yr.has(e),getThemes:()=>Xr,highlight(e,n){let r=Yr.get(e.language)??`text`,i=ei(e.code,r),a=Qr.get(i);if(a!==void 0)return a;if(n!==void 0){let e=$r.get(i)??new Set;e.add(n),$r.set(i,e)}return t(async()=>{let{tokenize:e}=await import(`./code-highlighter-impl-CX4PVgAd.js`);return{tokenize:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url).then(async({tokenize:t})=>{let n=await t(e.code,r);if(Qr.size>=Zr){let e=Math.floor(Qr.size/2);for(let t of Qr.keys()){if(e===0)break;Qr.delete(t),--e}}Qr.set(i,n);let a=$r.get(i);if(a!==void 0){$r.delete(i);for(let e of a)e(n)}}).catch(e=>{$r.delete(i),console.warn(`[code-highlighter] highlight failed, leaving plain text`,e)}),null}};function ni(){return e=>{ri(e)}}function ri(e){let t=e.children;if(t===void 0)return;let n=[];for(let e of t){if(e.type===`text`&&e.value!==void 0&&e.value.includes(`
5
+ `)}var Pr=new Set(H),Fr=/^(?:open[-_ ]?knowledge|ok)$/,Ir=/^(?:mcp[^a-z0-9]+)?(?:open[-_ ]?knowledge|ok)[^a-z0-9]+([a-z_]+)$/;function Lr(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Rr(e){return Ir.exec(e.trim().toLowerCase())?.[1]??null}function zr(e,t){let n=F(Lr(t),`server`);if(n!==null&&!Fr.test(n.toLowerCase()))return null;let r=ie(t),i=[Rr(e),r?.tool??null].find(e=>e!==null&&Pr.has(e));return i===void 0?null:{tool:i,args:r?.args??{}}}function Br(e){return typeof e==`string`?e.trim()===``?[]:[e.trim()]:Array.isArray(e)?e.flatMap(Br):typeof e==`object`&&e?Br(e.path):[]}var Vr=[`document`,`documents`,`folder`,`file`,`template`,`asset`,`path`,`from`,`name`];function Hr(e){for(let t of Vr){let n=Br(e[t]);if(n.length>0)return n}return[]}function Ur(e){return e.replace(/\.mdx?$/i,``)}var Wr=120;function Gr(e){if(typeof e!=`string`)return null;let t=e.replace(/\s+/g,` `).trim();return t===``?null:t.length>Wr?`${t.slice(0,Wr-1)}…`:t}function Kr(e,t){let n=Hr(t),r=n[0],i=n.length>1?U._({id:`C7waqI`,values:{0:n.length}}):r===void 0?null:Ur(r);switch(e){case`write`:return{glyph:`edit`,text:i===null?U._({id:`tLX6LY`}):U._({id:`MvWBwz`,values:{subject:i}})};case`edit`:return{glyph:`edit`,text:i===null?U._({id:`Fx9aOF`}):U._({id:`7aNk5D`,values:{subject:i}})};case`delete`:return{glyph:`delete`,text:i===null?U._({id:`DcFr-y`}):U._({id:`Gb_h4G`,values:{subject:i}})};case`move`:{let e=Br(t.to)[0];if(i===null||e===void 0)return{glyph:`move`,text:U._({id:`RGptDW`})};let n=Ur(e);return{glyph:`move`,text:U._({id:`pbyEp3`,values:{subject:i,destination:n}})}}case`search`:{let e=Gr(t.query);return{glyph:`search`,text:e===null?U._({id:`EvXKHE`}):U._({id:`yWfjqS`,values:{query:e}})}}case`exec`:{let e=Gr(t.command);return{glyph:`execute`,text:e===null?U._({id:`FS4Udk`}):U._({id:`a5gwRt`,values:{command:e}})}}case`lint`:case`audit`:return{glyph:`check`,text:i===null?U._({id:`7S7FNA`}):U._({id:`TEJiKw`,values:{subject:i}})};case`links`:return{glyph:`link`,text:i===null?U._({id:`vallqD`}):U._({id:`KDrbNG`,values:{subject:i}})};case`history`:return{glyph:`history`,text:i===null?U._({id:`Ug2xzC`}):U._({id:`90-wKT`,values:{subject:i}})};case`config`:{let e=Gr(t.key);return{glyph:`settings`,text:e===null?U._({id:`ZwpggY`}):U._({id:`-oHckY`,values:{key:e}})}}case`skills`:return{glyph:`read`,text:U._({id:`4mp6Tv`})};case`install`:return{glyph:`install`,text:i===null?U._({id:`4ErgAf`}):U._({id:`WbWtif`,values:{subject:i}})};case`import`:{let e=Gr(t.skill)??Gr(t.source);return{glyph:`install`,text:e===null?U._({id:`DhT_PK`}):U._({id:`hCattk`,values:{source:e}})}}case`palette`:return{glyph:`read`,text:U._({id:`7czmD1`})};case`preview_url`:return{glyph:`fetch`,text:U._({id:`UL-9ej`})};case`share_link`:return{glyph:`share`,text:i===null?U._({id:`ABq-cq`}):U._({id:`ibE3-O`,values:{subject:i}})};case`checkpoint`:return{glyph:`history`,text:U._({id:`5b3WD-`})};case`conflicts`:return{glyph:`check`,text:U._({id:`i94lQe`})};case`resolve_conflict`:return{glyph:`edit`,text:i===null?U._({id:`_YWqV2`}):U._({id:`AeLo3p`,values:{subject:i}})};case`restore_version`:return{glyph:`restore`,text:i===null?U._({id:`caiyaU`}):U._({id:`hS0wC4`,values:{subject:i}})};default:return{glyph:`other`,text:U._({id:`vhGTWU`,values:{tool:e}})}}}var qr={read:`read`,edit:`edit`,delete:`delete`,move:`move`,search:`search`,execute:`execute`,think:`think`,fetch:`fetch`,switch_mode:`switch_mode`};function Jr(e){let t=zr(e.title,e.rawInput);return t===null?{text:e.title,glyph:qr[e.toolKind]??`other`}:Kr(t.tool,t.args)}var Yr=new Map([{id:`shellscript`,aliases:[`bash`,`sh`,`shell`,`zsh`]},{id:`tsx`,aliases:[`typescript`,`ts`,`jsx`]},{id:`javascript`,aliases:[`js`]},{id:`json`,aliases:[`jsonc`]},{id:`python`,aliases:[`py`]},{id:`rust`,aliases:[`rs`]},{id:`go`,aliases:[]},{id:`css`,aliases:[]},{id:`html`,aliases:[]},{id:`markdown`,aliases:[`md`]},{id:`yaml`,aliases:[`yml`]},{id:`toml`,aliases:[]},{id:`sql`,aliases:[]},{id:`diff`,aliases:[]},{id:`dockerfile`,aliases:[`docker`]}].flatMap(e=>[[e.id,e.id],...e.aliases.map(t=>[t,e.id])])),Xr=[rt,rt],Zr=400,Qr=new Map,$r=new Map;function ei(e,t){return`${t}:${e.length}:${e.slice(0,100)}:${e.length>100?e.slice(-100):``}`}var ti={name:`shiki`,type:`code-highlighter`,getSupportedLanguages:()=>Array.from(Yr.keys()),supportsLanguage:e=>Yr.has(e),getThemes:()=>Xr,highlight(e,n){let r=Yr.get(e.language)??`text`,i=ei(e.code,r),a=Qr.get(i);if(a!==void 0)return a;if(n!==void 0){let e=$r.get(i)??new Set;e.add(n),$r.set(i,e)}return t(async()=>{let{tokenize:e}=await import(`./code-highlighter-impl-D-lTmjEE.js`);return{tokenize:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url).then(async({tokenize:t})=>{let n=await t(e.code,r);if(Qr.size>=Zr){let e=Math.floor(Qr.size/2);for(let t of Qr.keys()){if(e===0)break;Qr.delete(t),--e}}Qr.set(i,n);let a=$r.get(i);if(a!==void 0){$r.delete(i);for(let e of a)e(n)}}).catch(e=>{$r.delete(i),console.warn(`[code-highlighter] highlight failed, leaving plain text`,e)}),null}};function ni(){return e=>{ri(e)}}function ri(e){let t=e.children;if(t===void 0)return;let n=[];for(let e of t){if(e.type===`text`&&e.value!==void 0&&e.value.includes(`
6
6
  `)){let t=e.value.split(/\r?\n/);for(let[e,r]of t.entries())e>0&&n.push({type:`break`}),r!==``&&n.push({type:`text`,value:r});continue}ri(e),n.push(e)}e.children=n}var ii=/(?<![A-Za-z0-9_./@-])[A-Za-z0-9_./@-]+\.(?:md|mdx)\b/g;function ai(e){let{workspace:t,pages:n}=e;return t===null||n.size===0?null:e=>{let r=e.indexOf(`#`),i=(r===-1?e:e.slice(0,r)).replace(/^@/,``);if(i===``)return null;let a=P(i,t);if(a!==null&&n.has(a))return a;let o=oi(t,i);if(o!==null){let e=P(o,t);if(e!==null&&n.has(e))return e}let s=si(i);if(s===null)return null;if(n.has(s))return s;let c=`/${s}`,l=null;for(let e of n)if(e===s||e.endsWith(c)){if(l!==null)return null;l=e}return l}}function oi(e,t){if(t.startsWith(`/`)||t.startsWith(`\\`))return null;let n=e.pathSeparator,r=e=>n===`\\`?e.replaceAll(`\\`,`/`):e,i=r(e.contentDir).replace(/\/$/,``),a=r(t),o=i.split(`/`),s=a.split(`/`)[0];if(s===void 0||s===``)return null;for(let e=o.length-1;e>=0;--e)if(o[e]===s){let t=o.slice(0,e).join(`/`);return t===``?`/${a}`:`${t}/${a}`}return null}function si(e){let t=/\.(?:md|mdx)$/i.exec(e);return t===null?null:e.slice(0,-t[0].length)}var ci=null;function li(e){ci=e}function ui(){return()=>e=>{let t=ci;if(t!==null)try{di(e,t)}catch(e){console.warn(`[remarkDocPathLinks] rewrite failed, partial rewrites may remain`,e)}}}function di(e,t){if(e==null)return;let n=e.children;if(n===void 0)return;let r=[];for(let e of n)if(e!=null){if(e.type===`link`){r.push(e);continue}if(e.type===`text`&&typeof e.value==`string`){r.push(...fi(e.value,t));continue}if(e.type===`inlineCode`&&typeof e.value==`string`){let n=t(e.value.trim());n===null?r.push(e):r.push({type:`link`,url:Je(n),title:null,children:[e]});continue}di(e,t),r.push(e)}e.children=r}function fi(e,t){let n=[],r=0,i=new RegExp(ii.source,ii.flags),a=i.exec(e);for(;a!==null;){let[o]=a,s=a.index,c=t(o);c!==null&&(s>r&&n.push({type:`text`,value:e.slice(r,s)}),n.push({type:`link`,url:Je(c),title:null,children:[{type:`text`,value:o}]}),r=s+o.length),a=i.exec(e)}return r===0?[{type:`text`,value:e}]:(r<e.length&&n.push({type:`text`,value:e.slice(r)}),n)}var pi=(0,X.createContext)(!1);function mi(e){let t=(0,Y.c)(12),{_:n}=g(),{href:r,children:i}=e;if(r?.startsWith(`#/`)){let e;t[0]===r?e=t[1]:(e=qe(r)??r,t[0]=r,t[1]=e);let a=e,o;t[2]!==n||t[3]!==a?(o=n({id:`mPzgTS`,values:{docName:a}}),t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;return t[5]!==i||t[6]!==r||t[7]!==o?(s=(0,Z.jsx)(`a`,{href:r,"data-testid":`agent-thread-doc-link`,title:o,className:`text-primary underline underline-offset-2 decoration-primary/40 hover:decoration-primary`,children:i}),t[5]=i,t[6]=r,t[7]=o,t[8]=s):s=t[8],s}let a;return t[9]!==i||t[10]!==r?(a=(0,Z.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,"data-streamdown":`link`,className:`wrap-anywhere font-medium text-primary underline`,children:i}),t[9]=i,t[10]=r,t[11]=a):a=t[11],a}function hi(e){let t=(0,Y.c)(16),{text:n}=e,r=(0,X.use)(pi),i,a;t[0]===n?(i=t[1],a=t[2]):(i=[n],a=()=>(0,Z.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n}),t[0]=n,t[1]=i,t[2]=a);let o=r?`with-resolver`:`no-resolver`,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=Object.values(tt),t[3]=s):s=t[3];let c,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=[...s,ni,ui()],l={a:mi},t[4]=c,t[5]=l):(c=t[4],l=t[5]);let u,d,f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={code:{copy:!0,download:!1},table:!1,mermaid:!1},d={code:ti},f={enabled:!1},t[6]=u,t[7]=d,t[8]=f):(u=t[6],d=t[7],f=t[8]);let p;t[9]!==o||t[10]!==n?(p=(0,Z.jsx)(et,{className:`[&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_pre_code>span]:block [&_ol]:list-outside [&_ul]:list-outside [&_ol]:ps-6 [&_ul]:ps-6 [&_li+li]:mt-2 [&_li>p]:block! [&_li>*+*]:mt-2 [&_li_[data-streamdown=code-block]]:my-2! [&_code]:text-1sm [&_pre]:text-1sm [&_[data-streamdown=code-block-body]]:p-3 [&_[data-streamdown=code-block-body]]:max-h-80 [&_[data-streamdown=code-block-body]]:overflow-auto`,remarkPlugins:c,components:l,lineNumbers:!1,controls:u,plugins:d,linkSafety:f,children:n},o),t[9]=o,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==i||t[13]!==p||t[14]!==a?(m=(0,Z.jsx)(y,{resetKeys:i,fallbackRender:a,onError:gi,children:p}),t[12]=i,t[13]=p,t[14]=a,t[15]=m):m=t[15],m}function gi(e){console.error(`[AgentMarkdown] markdown render failed, falling back to plain text`,e)}function _i(e){let t=[],n=null,r=()=>{let i=t.shift();if(i===void 0){n=null;return}let a=e.region();a!==null&&(a.textContent=``),n=setTimeout(()=>{let t=e.region();t!==null&&(t.textContent=i),n=setTimeout(r,e.spacingMs)},50)};return{announce(e){e.length!==0&&(t.push(...e),n===null&&r())},dispose(){t.length=0,n!==null&&(clearTimeout(n),n=null)}}}var vi=150;function yi(e){let t=(0,Y.c)(9),{notices:n,agentName:r,replayThroughSeq:i}=e,{_:a}=g(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=(0,X.useRef)(-1/0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=_i({region:()=>o.current,spacingMs:vi});return s.current=e,()=>{e.dispose(),s.current=null}},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,X.useEffect)(l,u);let d,f;t[2]!==a||t[3]!==r||t[4]!==n||t[5]!==i?(d=()=>{let e=Math.max(i,c.current),t=n.filter(t=>t.seq>e);t.length!==0&&(c.current=t[t.length-1]?.seq??e,s.current?.announce(t.map(e=>a({id:`d6qW27`,values:{agentName:r,headline:bi(e.text)}}))))},f=[n,r,i,a],t[2]=a,t[3]=r,t[4]=n,t[5]=i,t[6]=d,t[7]=f):(d=t[6],f=t[7]),(0,X.useEffect)(d,f);let p;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:o,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`agent-thread-warning-announcer`}),t[8]=p):p=t[8],p}function bi(e){return(e.split(`
7
7
  `,1)[0]??``).trim()}function xi(e){let t=(0,Y.c)(27),{plan:n,approval:r}=e,{_:i}=g(),[a,o]=(0,X.useState)(!1),s=n.filter(Ti).length,c;t[0]===n?c=t[1]:(c=n.some(wi),t[0]=n,t[1]=c);let l=r!==void 0&&c,u,d;t[2]===l?(u=t[3],d=t[4]):(u=()=>{l&&o(!0)},d=[l],t[2]=l,t[3]=u,t[4]=d),(0,X.useEffect)(u,d);let f=C,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>o(Ci),t[5]=p):p=t[5];let m;t[6]===a?m=t[7]:(m=a?(0,Z.jsx)(he,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(ge,{className:`size-3.5`,"aria-hidden":`true`}),t[6]=a,t[7]=m);let h=i({id:`QM3SBZ`,values:{0:n.length,done:s}}),_;t[8]===h?_=t[9]:(_=(0,Z.jsx)(`span`,{children:h}),t[8]=h,t[9]=_);let v;t[10]!==f||t[11]!==a||t[12]!==m||t[13]!==_||t[14]!==p?(v=(0,Z.jsxs)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start gap-1.5 p-0 font-medium text-muted-foreground text-xs hover:bg-transparent`,onClick:p,"aria-expanded":a,"data-testid":`agent-thread-plan-toggle`,children:[m,_]}),t[10]=f,t[11]=a,t[12]=m,t[13]=_,t[14]=p,t[15]=v):v=t[15];let y;t[16]!==a||t[17]!==n?(y=a?(0,Z.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,"data-testid":`agent-thread-plan-list`,children:n.map(Si)}):null,t[16]=a,t[17]=n,t[18]=y):y=t[18];let b;t[19]!==i||t[20]!==r||t[21]!==l?(b=l?(0,Z.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-end gap-1`,"data-testid":`agent-thread-plan-approval`,children:[(0,Z.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-muted-foreground text-xs hover:text-foreground`,onClick:r.onReject,"data-testid":`agent-thread-plan-approval-reject`,children:i({id:`1t_NnN`})}),(0,Z.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:r.onAskChanges,"data-testid":`agent-thread-plan-approval-ask-changes`,children:i({id:`T_N0ro`})}),(0,Z.jsx)(C,{type:`button`,variant:`default`,size:`sm`,className:`h-7 text-xs`,onClick:r.onApprove,"data-testid":`agent-thread-plan-approval-approve`,children:i({id:`4GYCwt`})})]}):null,t[19]=i,t[20]=r,t[21]=l,t[22]=b):b=t[22];let x;return t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,Z.jsxs)(`div`,{className:`border-border/60 border-b bg-muted/30 px-3 py-1.5`,children:[v,y,b]}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26],x}function Si(e,t){return(0,Z.jsxs)(`li`,{className:b(`flex items-start gap-1.5 text-xs`,e.status===`completed`&&`text-muted-foreground line-through`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:e.status===`completed`?`☑`:`☐`}),(0,Z.jsx)(`span`,{children:e.content})]},t)}function Ci(e){return!e}function wi(e){return e.status!==`completed`}function Ti(e){return e.status===`completed`}function Ei(e,t){if(!$e(e))return null;let n=null;for(let r of e.getStates().values()){let e=r.agentPresence;if(e)for(let r of Object.values(e)){if(!r.currentDoc||ce(r.currentDoc))continue;let e=r.docTs;if(e===void 0||t-e>=5e3||n!==null&&e<=n.ts)continue;let i=re(r.currentDoc);i!==null&&(n={doc:i,ts:e})}}return n}function Di(e,t){let n=e[e.length-1];return n!==void 0&&n.doc===t.doc&&n.ts===t.ts?e:[...e,t]}function Oi(e,t){switch(e.kind){case`message`:return`msg:${t}:${e.messageId}`;case`tool_call`:return`tool:${e.toolCallId}`;case`permission`:return`perm:${e.requestId}`;case`runtime_consent`:return`consent:${e.requestId}`;case`pi_bridge`:return`pi-bridge:${e.prompt?.requestId??t}`;case`notice`:return`notice:${t}`;case`agent_notice`:return`agent-notice:${t}`}}var ki=Date.now(),Ai=null,ji=new Set;function Mi(e){let t=new Date(e);return t.setHours(24,0,0,0),Math.max(t.getTime()-e,1e3)}function Ni(){ki=Date.now(),Ai=setTimeout(()=>{Ni();for(let e of ji)e()},Mi(Date.now()))}function Pi(e){return ji.add(e),Ai===null&&Ni(),()=>{ji.delete(e),ji.size===0&&Ai!==null&&(clearTimeout(Ai),Ai=null)}}function Fi(){return ki}function Ii(){return(0,X.useSyncExternalStore)(Pi,Fi,Fi)}var Li=10080*60*1e3;function Ri(e,t,n){let r=new Date(e),i=new Date(t),a={hour:`numeric`,minute:`2-digit`};if(r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate())return r.toLocaleTimeString(n,a);let o=t-e;return o>0&&o<Li?r.toLocaleString(n,{weekday:`long`,...a}):r.getFullYear()===i.getFullYear()?r.toLocaleString(n,{month:`short`,day:`numeric`,...a}):r.toLocaleString(n,{year:`numeric`,month:`short`,day:`numeric`,...a})}function zi(e){let t=(0,Y.c)(32),{text:n,sentAt:i,alwaysVisible:a,restoreFocus:o,onEdit:s}=e,c=a===void 0?!1:a,l=o===void 0?!1:o,{_:u,i18n:d}=g(),p=Ii(),m=(0,X.useRef)(null),h,_;t[0]===l?(h=t[1],_=t[2]):(h=()=>{l&&m.current?.focus({preventScroll:!0})},_=[l],t[0]=l,t[1]=h,t[2]=_),(0,X.useEffect)(h,_);let v=c?null:`opacity-0 transition-opacity focus-within:opacity-100 group-hover/user-message:opacity-100`,y;t[3]===v?y=t[4]:(y=b(`mt-1 flex items-center justify-end gap-1 text-muted-foreground`,v),t[3]=v,t[4]=y);let S;t[5]!==d||t[6]!==p||t[7]!==i?(S=i===void 0?null:(0,Z.jsx)(`time`,{dateTime:new Date(i).toISOString(),title:new Date(i).toLocaleString(d.locale||void 0),className:`me-1 text-xs`,"data-testid":`agent-thread-user-message-sent-at`,children:Ri(i,p,d.locale||void 0)}),t[5]=d,t[6]=p,t[7]=i,t[8]=S):S=t[8];let D;t[9]===u?D=t[10]:(D=u({id:`kPOw9O`}),t[9]=u,t[10]=D);let O;t[11]!==D||t[12]!==n?(O=(0,Z.jsx)(r,{copyContent:n,clipboardWrite:x,size:`icon-xs`,ariaLabel:D,testId:`agent-thread-user-message-copy`}),t[11]=D,t[12]=n,t[13]=O):O=t[13];let k;t[14]===u?k=t[15]:(k=u({id:`sOafXU`}),t[14]=u,t[15]=k);let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(f,{className:`size-3.5`,"aria-hidden":`true`}),t[16]=A):A=t[16];let j;t[17]!==s||t[18]!==k?(j=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsx)(C,{ref:m,type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":k,onClick:s,"data-testid":`agent-thread-user-message-edit`,children:A})}),t[17]=s,t[18]=k,t[19]=j):j=t[19];let M;t[20]===u?M=t[21]:(M=u({id:`sOafXU`}),t[20]=u,t[21]=M);let N;t[22]===M?N=t[23]:(N=(0,Z.jsx)(T,{children:M}),t[22]=M,t[23]=N);let P;t[24]!==j||t[25]!==N?(P=(0,Z.jsxs)(E,{disableHoverableContent:!0,children:[j,N]}),t[24]=j,t[25]=N,t[26]=P):P=t[26];let F;return t[27]!==P||t[28]!==y||t[29]!==S||t[30]!==O?(F=(0,Z.jsxs)(`div`,{className:y,"data-testid":`agent-thread-user-message-actions`,children:[S,O,P]}),t[27]=P,t[28]=y,t[29]=S,t[30]=O,t[31]=F):F=t[31],F}function Bi(e){let t=(0,Y.c)(87),{initialText:n,currentAgent:r,canSendHere:i,onCancel:a,onSend:o}=e,{_:s}=g(),c=(0,X.useRef)(null),l;t[0]===n?l=t[1]:(l=n.trim(),t[0]=n,t[1]=l);let[u,d]=(0,X.useState)(l===``),[f,p]=(0,X.useState)(!1),m=Vi(r),_,v;t[2]===n?(_=t[3],v=t[4]):(_=()=>{c.current?.setText(n),c.current?.focusEnd()},v=[n],t[2]=n,t[3]=_,t[4]=v),(0,X.useEffect)(_,v);let y;t[5]!==o||t[6]!==f?(y=e=>{if(f)return;let t=c.current?.getContent(),n=t?.instruction.trim()??``;n!==``&&(p(!0),o(n,e,t?.attachments??[]).finally(()=>p(!1)))},t[5]=o,t[6]=f,t[7]=y):y=t[7];let b=y,x;t[8]!==i||t[9]!==b?(x=()=>{i&&b({kind:`this-thread`})},t[8]=i,t[9]=b,t[10]=x):x=t[10];let S=x,w;t[11]===s?w=t[12]:(w=s({id:`sOafXU`}),t[11]=s,t[12]=w);let T;t[13]===s?T=t[14]:(T=s({id:`sOafXU`}),t[13]=s,t[14]=T);let E;t[15]!==a||t[16]!==S||t[17]!==w||t[18]!==T?(E=(0,Z.jsx)(ne,{ref:c,ariaLabel:w,placeholder:T,onEmptyChange:d,onSubmit:S,onEscape:a,className:`max-h-60 overflow-y-auto text-sm`,testId:`agent-thread-user-message-edit-field`}),t[15]=a,t[16]=S,t[17]=w,t[18]=T,t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(h,{id:`dEgA5A`}),t[20]=D):D=t[20];let O;t[21]===a?O=t[22]:(O=(0,Z.jsx)(C,{type:`button`,size:`sm`,variant:`outline`,onClick:a,"data-testid":`agent-thread-user-message-edit-cancel`,children:D}),t[21]=a,t[22]=O);let k=u||!i||f,A;t[23]!==s||t[24]!==f?(A=f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ie,{className:`size-3`,"aria-hidden":`true`}),s({id:`Sad2tK`})]}):s({id:`JlFcis`}),t[23]=s,t[24]=f,t[25]=A):A=t[25];let j;t[26]!==S||t[27]!==f||t[28]!==k||t[29]!==A?(j=(0,Z.jsx)(C,{type:`button`,size:`sm`,disabled:k,"aria-busy":f,onClick:S,"data-testid":`agent-thread-user-message-edit-send`,children:A}),t[26]=S,t[27]=f,t[28]=k,t[29]=A,t[30]=j):j=t[30];let M=u||f,N;t[31]===s?N=t[32]:(N=s({id:`LJHTS5`}),t[31]=s,t[32]=N);let P;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(he,{className:`size-3.5`,"aria-hidden":`true`}),t[33]=P):P=t[33];let F;t[34]!==M||t[35]!==N?(F=(0,Z.jsx)(Te,{asChild:!0,children:(0,Z.jsx)(C,{type:`button`,size:`sm`,disabled:M,"aria-label":N,"data-testid":`agent-thread-user-message-edit-send-menu`,children:P})}),t[34]=M,t[35]=N,t[36]=F):F=t[36];let ee=!i,te;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(h,{id:`YPJfPD`})}),t[37]=te):te=t[37];let I;t[38]!==S||t[39]!==ee?(I=(0,Z.jsx)(be,{disabled:ee,onSelect:S,"data-testid":`agent-thread-send-target-this-thread`,children:te}),t[38]=S,t[39]=ee,t[40]=I):I=t[40];let re;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(je,{}),t[41]=re):re=t[41];let L;t[42]===s?L=t[43]:(L=s({id:`Fjz6aJ`}),t[42]=s,t[43]=L);let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(De,{children:(0,Z.jsx)(h,{id:`Fjz6aJ`})}),t[44]=ie):ie=t[44];let R;t[45]!==r||t[46]!==b?(R=()=>b({kind:`new-thread`,agent:r}),t[45]=r,t[46]=b,t[47]=R):R=t[47];let z;t[48]!==r.iconUrl||t[49]!==r.id?(z=(0,Z.jsx)(V,{agentId:r.id,iconUrl:r.iconUrl,className:`size-4`}),t[48]=r.iconUrl,t[49]=r.id,t[50]=z):z=t[50];let oe;t[51]===r.name?oe=t[52]:(oe=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:r.name}),t[51]=r.name,t[52]=oe);let B;t[53]!==R||t[54]!==z||t[55]!==oe?(B=(0,Z.jsxs)(be,{onSelect:R,"data-testid":`agent-thread-send-target-new-thread`,children:[z,oe]}),t[53]=R,t[54]=z,t[55]=oe,t[56]=B):B=t[56];let se;if(t[57]!==m||t[58]!==b){let e;t[60]===b?e=t[61]:(e=e=>(0,Z.jsxs)(be,{onSelect:()=>b({kind:`new-thread`,agent:e}),"data-testid":`agent-thread-send-target-agent-${e.source}:${e.id}`,children:[(0,Z.jsx)(V,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name})]},`${e.source}:${e.id}`),t[60]=b,t[61]=e),se=m.map(e),t[57]=m,t[58]=b,t[59]=se}else se=t[59];let ce;t[62]!==L||t[63]!==B||t[64]!==se?(ce=(0,Z.jsxs)(Ce,{"aria-label":L,children:[ie,B,se]}),t[62]=L,t[63]=B,t[64]=se,t[65]=ce):ce=t[65];let H;t[66]!==I||t[67]!==ce?(H=(0,Z.jsxs)(ke,{align:`end`,className:`max-h-80 min-w-[220px]`,"data-testid":`agent-thread-user-message-send-targets`,children:[I,re,ce]}),t[66]=I,t[67]=ce,t[68]=H):H=t[68];let le;t[69]!==F||t[70]!==H?(le=(0,Z.jsxs)(Ae,{modal:!1,children:[F,H]}),t[69]=F,t[70]=H,t[71]=le):le=t[71];let U;t[72]!==j||t[73]!==le?(U=(0,Z.jsxs)(ae,{children:[j,le]}),t[72]=j,t[73]=le,t[74]=U):U=t[74];let ue;t[75]!==s||t[76]!==f?(ue=f?s({id:`Sad2tK`}):null,t[75]=s,t[76]=f,t[77]=ue):ue=t[77];let de;t[78]===ue?de=t[79]:(de=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:ue}),t[78]=ue,t[79]=de);let fe;t[80]!==O||t[81]!==U||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[O,U,de]}),t[80]=O,t[81]=U,t[82]=de,t[83]=fe):fe=t[83];let pe;return t[84]!==fe||t[85]!==E?(pe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":`agent-thread-user-message-editor`,children:[E,fe]}),t[84]=fe,t[85]=E,t[86]=pe):pe=t[86],pe}function Vi(e){let t=(0,Y.c)(6),n=se(),r=B(),i;if(t[0]!==e||t[1]!==n||t[2]!==r){let a;t[4]===e?a=t[5]:(a=t=>!(t.source===e.source&&t.id===e.id),t[4]=e,t[5]=a),i=fe(r,n).filter(a),t[0]=e,t[1]=n,t[2]=r,t[3]=i}else i=t[3];return i}function Hi(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.kind===`tool_call`&&(n.status===`in_progress`||n.status===`pending`))return n.toolKind}return null}function Ui(){return[U._({id:`-VqsyR`}),U._({id:`UD_onR`}),U._({id:`D7hnvB`}),U._({id:`uF82hk`}),U._({id:`G0I7bo`}),U._({id:`eXPP7Z`}),U._({id:`juD53g`}),U._({id:`sqUrlK`}),U._({id:`3zDeFb`}),U._({id:`JAQ09e`}),U._({id:`JyW5aS`}),U._({id:`gmAH_b`})]}var Wi={min:3500,max:7e3};function Gi(e,t,n){return t<=1?0:(e+1+Math.floor(n*(t-1)))%t}function Ki(e){return Wi.min+e*(Wi.max-Wi.min)}function qi(e){let t=(0,Y.c)(3),[n,r]=(0,X.useState)(Yi),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;r(Math.floor(Math.random()*Ui().length));let t,n=()=>{t=setTimeout(()=>{r(Ji),n()},Ki(Math.random()))};return n(),()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,X.useEffect)(i,a),n}function Ji(e){return Gi(e,Ui().length,Math.random())}function Yi(){return Math.floor(Math.random()*Ui().length)}function Xi(e){switch(e){case`read`:return U._({id:`YGt-0e`});case`search`:return U._({id:`jC8Bv4`});case`fetch`:return U._({id:`bnOTEz`});case`edit`:return U._({id:`GwpcXB`});case`delete`:return U._({id:`CD8lBW`});case`execute`:return U._({id:`wc54KE`});case`think`:return U._({id:`BGoW3h`});default:return null}}function Zi(e,t){let n=Xi(e);if(n!==null)return n;let r=Ui();return r[(t%r.length+r.length)%r.length]}var Qi=1e4,$i=1400,ea={read:Pe,edit:He,delete:Ue,move:mt,search:o,execute:Ne,think:p,fetch:_e,switch_mode:gt,check:ye,link:s,history:de,share:R,install:Me,settings:l,restore:z,other:Ge};function ta(e){return e instanceof Error?e.message:String(e)}function na(e){return e.replace(/\s+Agent$/i,``)}var ra=(0,X.createContext)(null),ia=new Set([`connect`,`session-setup`,`auth-required`]);function aa(e){return ia.has(e.reason)}var oa=/^\s*(?:npm\s+(?:error|ERR!)\s+\S|error:\s*\S|Error:\s*\S|fatal:\s*\S|panic:\s*\S)/;function sa(e){let t=e.split(`
8
8
  `);for(let e=0;e<t.length;e+=1){let n=t[e]?.trim()??``;if(n!==``&&oa.test(n))return n}return null}var ca=/^\s*(?:npm\s+(?:error|ERR!)|error:|Error:|fatal:|panic:)/,la=/^\s*(?:npm\s+warn|warning:|warn:)/;function ua(e){let t=e.split(`
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-BAloNqfo.js","./chunk-CYidjpOJ.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./compiler-runtime-BfE3aGVn.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-Cym3gapE.js";import{i as ne,n as re,t as ie}from"./tooltip-DttaCTqz.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-_kqu_91M.js";import{l as de}from"./select-BL1z9P70.js";import{n as fe,t as pe}from"./toggle-group-C2_37kV5.js";import{wt as me}from"./dist-D6JA916i.js";import{n as he}from"./dist-CJhtNlOm2.js";import{t as ge}from"./chevron-down-DZvAgb7P.js";import{t as _e}from"./spinner-By93kIxm.js";import{n as ve,t as ye}from"./panel-right-open-D4enOyq7.js";import{t as be}from"./undo-2-DXBUErQ5.js";import{t as xe}from"./x-CAqepOgq.js";import{t as Se}from"./timeline-diff-store-CdyjyOp2.js";import{t as s}from"./lru-string-cache-B0-sPXj-.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-DEsOnT79.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-BAloNqfo.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-Cym3gapE.js";import{i as ne,n as re,t as ie}from"./tooltip-DttaCTqz.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-_kqu_91M.js";import{l as de}from"./select-BL1z9P70.js";import{n as fe,t as pe}from"./toggle-group-C2_37kV5.js";import{wt as me}from"./dist-D6JA916i.js";import{n as he}from"./dist-CJhtNlOm2.js";import{t as ge}from"./chevron-down-DZvAgb7P.js";import{t as _e}from"./spinner-By93kIxm.js";import{n as ve,t as ye}from"./panel-right-open-D4enOyq7.js";import{t as be}from"./undo-2-DXBUErQ5.js";import{t as xe}from"./x-CAqepOgq.js";import{t as Se}from"./timeline-diff-store-CdyjyOp2.js";import{t as s}from"./lru-string-cache-B0-sPXj-.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-8r8oGG-s.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-BAloNqfo.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{tr as n}from"./DocumentContext-BdZiErvh.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-BZjrNgR6.js";import{t as c}from"./copilot-DLy2Kvlv.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{tr as n}from"./DocumentContext-Dq9Tp3cJ.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-BZjrNgR6.js";import{t as c}from"./copilot-DLy2Kvlv.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Cr as n,br as r,i,ir as a,sr as o,yr as s}from"./DocumentContext-BdZiErvh.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{t as f}from"./utils-CPqDy6Hr.js";import{n as p,t as m}from"./clipboard-adapter-815RzzoI.js";import{C as h,S as g,_,a as v,h as y}from"./SkillInstallMenu-D3KWfbhA.js";import{t as b}from"./button-Cym3gapE.js";import{t as x}from"./dist-BHv-mziD.js";import{i as S,n as C,t as w}from"./tooltip-DttaCTqz.js";import{n as T,r as E,t as D}from"./collapsible-DYySK8La.js";import{a as O,c as k,i as A,n as j,o as M,s as N,t as P}from"./dialog-_kqu_91M.js";import{t as F}from"./alert-dialog-DLAYZZMu.js";import{t as I}from"./checkbox-Dm1F7ko3.js";import{t as L}from"./label-D-K3fWtj.js";import{i as R,n as z,o as ee,s as te,t as ne}from"./select-BL1z9P70.js";import{n as B,t as re}from"./radio-group-npdxiS6E.js";import{Gt as V,Ko as H,Kt as U,Qs as W,Ut as ie,Wt as G,Ys as ae,Yt as oe,hs as se,rn as ce,wt as le}from"./dist-D6JA916i.js";import{n as K}from"./dist-CJhtNlOm2.js";import{c as ue}from"./use-settings-route-WFqgyKMc.js";import{t as q}from"./dist-Cr4-nBVI.js";import{c as J,v as de,x as fe}from"./documents-events-DR8HEJoe.js";import{i as Y}from"./use-apply-config-theme-CBmHKD_B.js";import{t as pe}from"./parse-api-error-Dd8VI2eu.js";import{n as me}from"./use-workspace-DAuqjfCS.js";import{t as X}from"./createLucideIcon-BYL3gqKc.js";import{h as he,n as ge,r as _e,t as ve}from"./EnableSyncConfirmDialog-N_l5NwWg.js";import{f as ye,h as be,p as xe}from"./Mermaid-Cw1EnMJu.js";import{t as Se}from"./arrow-up-right-BaKj0sfV.js";import{t as Ce}from"./check-D16atakQ.js";import{t as we}from"./chevron-right-ARd3H40k.js";import{s as Te}from"./prop-types-gfjew8MI.js";import{a as Ee,m as De,r as Oe,t as ke}from"./dropdown-menu-DYfdElMl.js";import{n as Ae,t as je}from"./terminal-D4S9lNQf.js";import{a as Me,r as Ne,t as Pe}from"./folder-config-api-D4N0ED0-.js";import{t as Fe}from"./spinner-By93kIxm.js";import{t as Ie}from"./refresh-cw-BO3b6gLF.js";import{t as Le}from"./trash-2-Dxkzm2qO.js";import{t as Re}from"./triangle-alert-CnzPFn6V.js";import{t as ze}from"./x-CAqepOgq.js";import{c as Be,h as Ve,l as He,s as Ue}from"./doc-hash-Dx9hwyex.js";import{n as We}from"./doc-paths-Co-S4Nk5.js";import"./config-provider-BvIhxk0G.js";import{p as Ge,r as Ke,t as qe}from"./skill-scope-D9dg7q4P.js";import{S as Je,h as Ye,i as Xe,p as Ze,x as Qe}from"./skills-api-BU5k9WYz.js";import{t as $e}from"./input-CUJ5gt4q.js";import{a as et,i as tt,r as nt,t as rt}from"./popover-DoM32eoR.js";import{t as it}from"./external-link-DSbrgMTH.js";import{t as at}from"./badge-DXNaFLJT.js";import{a as ot,i as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./field-Dq4rVnNT.js";import{t as pt}from"./use-skills-dKHpTH68.js";import{t as mt}from"./textarea-BlVs71hx.js";import{t as ht}from"./use-conflicts-CXDbJNoF.js";import{t as gt}from"./terminal-command-events-DBrAYz2u.js";var _t=X(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),vt=X(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),yt=X(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),bt=X(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),xt=X(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),St=X(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]);function Ct(e){return e===`eperm`?q._({id:`XuQzrk`}):q._({id:`BUyQnq`})}async function wt(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:Ct(t.reason)}}var Z=d(),Q=e(c(),1);function Tt(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return fe(()=>{o(kt)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Dt).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:q._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Et),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Et(e){return e+1}async function Dt(e){if(!e.ok){let t=await e.json().catch(Ot);throw Error(pe(t)??`HTTP ${e.status}`)}return e.json()}function Ot(){return null}function kt(e){return e+1}function At(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>fe(()=>{a(Nt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(jt).then(t=>{if(e)return;let n=ce.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:q._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function jt(e){if(!e.ok){let t=await e.json().catch(Mt);throw Error(pe(t)??`HTTP ${e.status}`)}return e.json()}function Mt(){return null}function Nt(e){return e+1}async function Pt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Ft(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Pt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return de(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),It=`github.com`,Lt=new Map;async function Rt(e){try{let t=await e.json(),n=le.safeParse(t);if(n.success)return n.data.title}catch{}}async function zt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Bt(e){let t=e?.host??It,n=await zt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Rt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function Vt(e){let t=e?.host??It,n=Lt.get(t);if(n)return n;let r=Bt(e).finally(()=>{Lt.delete(t)});return Lt.set(t,r),r}function Ht(e){let t=e.split(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Cr as n,br as r,i,ir as a,sr as o,yr as s}from"./DocumentContext-Dq9Tp3cJ.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{t as f}from"./utils-CPqDy6Hr.js";import{n as p,t as m}from"./clipboard-adapter-815RzzoI.js";import{C as h,S as g,_,a as v,h as y}from"./SkillInstallMenu-BpNof3ef.js";import{t as b}from"./button-Cym3gapE.js";import{t as x}from"./dist-BHv-mziD.js";import{i as S,n as C,t as w}from"./tooltip-DttaCTqz.js";import{n as T,r as E,t as D}from"./collapsible-DYySK8La.js";import{a as O,c as k,i as A,n as j,o as M,s as N,t as P}from"./dialog-_kqu_91M.js";import{t as F}from"./alert-dialog-DLAYZZMu.js";import{t as I}from"./checkbox-Dm1F7ko3.js";import{t as L}from"./label-D-K3fWtj.js";import{i as R,n as z,o as ee,s as te,t as ne}from"./select-BL1z9P70.js";import{n as B,t as re}from"./radio-group-npdxiS6E.js";import{Gt as V,Ko as H,Kt as U,Qs as W,Ut as ie,Wt as G,Ys as ae,Yt as oe,hs as se,rn as ce,wt as le}from"./dist-D6JA916i.js";import{n as K}from"./dist-CJhtNlOm2.js";import{c as ue}from"./use-settings-route-WFqgyKMc.js";import{t as q}from"./dist-Cr4-nBVI.js";import{c as J,v as de,x as fe}from"./documents-events-DR8HEJoe.js";import{i as Y}from"./use-apply-config-theme-CBmHKD_B.js";import{t as pe}from"./parse-api-error-Dd8VI2eu.js";import{n as me}from"./use-workspace-DAuqjfCS.js";import{t as X}from"./createLucideIcon-BYL3gqKc.js";import{h as he,n as ge,r as _e,t as ve}from"./EnableSyncConfirmDialog-CNj6t4oU.js";import{f as ye,h as be,p as xe}from"./Mermaid-Cw1EnMJu.js";import{t as Se}from"./arrow-up-right-BaKj0sfV.js";import{t as Ce}from"./check-D16atakQ.js";import{t as we}from"./chevron-right-ARd3H40k.js";import{s as Te}from"./prop-types-gfjew8MI.js";import{a as Ee,m as De,r as Oe,t as ke}from"./dropdown-menu-DYfdElMl.js";import{n as Ae,t as je}from"./terminal-D4S9lNQf.js";import{a as Me,r as Ne,t as Pe}from"./folder-config-api-D4N0ED0-.js";import{t as Fe}from"./spinner-By93kIxm.js";import{t as Ie}from"./refresh-cw-BO3b6gLF.js";import{t as Le}from"./trash-2-Dxkzm2qO.js";import{t as Re}from"./triangle-alert-CnzPFn6V.js";import{t as ze}from"./x-CAqepOgq.js";import{c as Be,h as Ve,l as He,s as Ue}from"./doc-hash-Dx9hwyex.js";import{n as We}from"./doc-paths-Co-S4Nk5.js";import"./config-provider-CHjUKQH3.js";import{p as Ge,r as Ke,t as qe}from"./skill-scope-D9dg7q4P.js";import{S as Je,h as Ye,i as Xe,p as Ze,x as Qe}from"./skills-api-BU5k9WYz.js";import{t as $e}from"./input-CUJ5gt4q.js";import{a as et,i as tt,r as nt,t as rt}from"./popover-DoM32eoR.js";import{t as it}from"./external-link-DSbrgMTH.js";import{t as at}from"./badge-DXNaFLJT.js";import{a as ot,i as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./field-Dq4rVnNT.js";import{t as pt}from"./use-skills-dKHpTH68.js";import{t as mt}from"./textarea-BlVs71hx.js";import{t as ht}from"./use-conflicts-CXDbJNoF.js";import{t as gt}from"./terminal-command-events-DBrAYz2u.js";var _t=X(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),vt=X(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),yt=X(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),bt=X(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),xt=X(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),St=X(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]);function Ct(e){return e===`eperm`?q._({id:`XuQzrk`}):q._({id:`BUyQnq`})}async function wt(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:Ct(t.reason)}}var Z=d(),Q=e(c(),1);function Tt(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return fe(()=>{o(kt)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(Dt).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:q._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Et),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Et(e){return e+1}async function Dt(e){if(!e.ok){let t=await e.json().catch(Ot);throw Error(pe(t)??`HTTP ${e.status}`)}return e.json()}function Ot(){return null}function kt(e){return e+1}function At(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>fe(()=>{a(Nt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(jt).then(t=>{if(e)return;let n=ce.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:q._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function jt(e){if(!e.ok){let t=await e.json().catch(Mt);throw Error(pe(t)??`HTTP ${e.status}`)}return e.json()}function Mt(){return null}function Nt(e){return e+1}async function Pt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Ft(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Pt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return de(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),It=`github.com`,Lt=new Map;async function Rt(e){try{let t=await e.json(),n=le.safeParse(t);if(n.success)return n.data.title}catch{}}async function zt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Bt(e){let t=e?.host??It,n=await zt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Rt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function Vt(e){let t=e?.host??It,n=Lt.get(t);if(n)return n;let r=Bt(e).finally(()=>{Lt.delete(t)});return Lt.set(t,r),r}function Ht(e){let t=e.split(`
2
2
  `);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Ut(){return{status:Vt,async repos(e){let t=e?.host??`github.com`,n=await zt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Rt(n)??q._({id:`sGZLfB`})};let r=Ht(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||q._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:q._({id:`sGZLfB`})};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await zt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await Rt(t)}}}}function Wt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Gt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
3
3
  `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Kt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}var qt=2e3,Jt=1e4;function Yt(e,t){return new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t.addEventListener(`abort`,i,{once:!0})})}function Xt(e){fetch(`/api/local-op/auth/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({channel:e})}).catch(e=>{console.warn(`[auth-transport] Cancel request failed (best-effort):`,e instanceof Error?e.message:e)})}async function Zt(e,t,n,r){let i=Ut(),a=qt;for(;!t.aborted&&Date.now()<n;){try{let n=await i.status(r?{host:r}:void 0);if(t.aborted)return;if(n.authenticated){e({type:`complete`,host:n.host,login:n.login,name:n.name,email:n.email});return}}catch(e){console.warn(`[auth-transport] Recovery probe failed:`,e instanceof Error?e.message:e)}await Yt(a,t),a=Math.min(a*1.5,Jt)}t.aborted||e({type:`error`,message:q._({id:`ve8vEM`})})}function Qt(e,t,n){let r=!1,i=Kt((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=q._({id:`LnVIW4`});try{let t=le.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:q._({id:`LnVIW4`})});return}if(await Gt(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||q._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:q._({id:`DskIkK`})});return}await Zt(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await Zt(a,i,n,t.host);return}a({type:`error`,message:q._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||Xt(n),i.cancel()}}}function $t(){return{start(){return Qt(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return Qt(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=q._({id:`sNeKjP`});try{let e=le.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:q._({id:`Q5fqMz`})}}}}}function en(e){return{start(){return e.localOp.auth.start()}}}async function tn(e){try{await navigator.clipboard.writeText(e)}catch{}}function nn(e){let t=(0,Z.c)(25),{onSuccess:n,startFlow:i}=e,{_:a}=u(),[o,s]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(`https://github.com/login/device`),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[0]!==a||t[1]!==n||t[2]!==i?(C=async function(){h(null);try{let e=i();x.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,o=await t.next();for(;!o.done;){let e=o.value;if(e.type===`verification`)s(e.user_code),d(e.verification_uri),_(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),tn(e.user_code).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)});else if(e.type===`complete`){r=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,h(e.message);break}o=await t.next()}r||h(a({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&h(a({id:`Q5fqMz`}))}},t[0]=a,t[1]=n,t[2]=i,t[3]=C):C=t[3];let w=C,T;t[4]===w?T=t[5]:(T=()=>{let e=!1;return queueMicrotask(()=>{e||w()}),()=>{e=!0,x.current?.(),x.current=null,S.current&&clearInterval(S.current)}},t[4]=w,t[5]=T);let E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[6]=E):E=t[6],(0,Q.useEffect)(T,E);let D,O;t[7]!==a||t[8]!==g?(D=()=>{if(g!==null)return S.current=setInterval(()=>{let e=g-Date.now();e<=0?(y(0),S.current&&clearInterval(S.current),h(a({id:`ve8vEM`}))):y(e)},1e3),()=>{S.current&&clearInterval(S.current)}},O=[g,a],t[7]=a,t[8]=g,t[9]=D,t[10]=O):(D=t[9],O=t[10]),(0,Q.useEffect)(D,O);let k=Math.floor(v/6e4),A=Math.floor(v%6e4/1e3),j;t[11]===A?j=t[12]:(j=A.toString().padStart(2,`0`),t[11]=A,t[12]=j);let M=`${k}:${j}`,N;t[13]!==a||t[14]!==f||t[15]!==m||t[16]!==M||t[17]!==o||t[18]!==c?(N=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`eVPynQ`,values:{verificationUri:c},components:{0:(0,$.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>it(e,c),onAuxClick:e=>it(e,c),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(Se,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(b,{type:`button`,variant:`outline`,"aria-label":a({id:`nCzR-G`,values:{userCode:o}}),onClick:()=>void tn(o).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:o}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:f?(0,$.jsx)(Ce,{className:`size-4`}):(0,$.jsx)(r,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:f?(0,$.jsx)(l,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(l,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(l,{id:`gYz2ep`,values:{timeLabel:M}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:m?null:(0,$.jsx)(l,{id:`aWlJai`})}),t[13]=a,t[14]=f,t[15]=m,t[16]=M,t[17]=o,t[18]=c,t[19]=N):N=t[19];let P;t[20]===m?P=t[21]:(P=m&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:m}),t[20]=m,t[21]=P);let F;return t[22]!==N||t[23]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[N,P]}),t[22]=N,t[23]=P,t[24]=F):F=t[24],F}function rn(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=u(),c;t[0]===n?c=t[1]:(c=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(l,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===s?f=t[4]:(f=s({id:`6YtxFj`}),t[3]=s,t[4]=f);let p;t[5]!==s||t[6]!==n?(p=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)($e,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===s?g=t[16]:(g=s({id:`O3oNi5`}),t[15]=s,t[16]=g);let _;t[17]===s?_=t[18]:(_=s({id:`O3oNi5`}),t[17]=s,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)($e,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,d,h,y]}),t[26]=c,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function an(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:s,onGhSignIn:c}=e,{_:d}=u(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==c||t[2]!==s?(p=s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{type:`button`,onClick:c,children:(0,$.jsx)(l,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(l,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=c,t[2]=s,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>it(e,f),h=e=>it(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(l,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Se,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=_):_=t[9];let v;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(v=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,_]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(l,{id:`Xg-Ntj`})}),t[15]=y):y=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)($e,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===s?E=t[30]:(E=!s&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(l,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`9Vh9Jf`})})]})]}),t[29]=s,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==v?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,v,y,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=v,t[36]=D):D=t[36],D}var on=1e4;function sn(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c,host:d,ghAvailable:f}=e,{_:p}=u(),m;t[0]===s?m=t[1]:(m=s??$t(),t[0]=s,t[1]=m);let h=m,g;t[2]===c?g=t[3]:(g=c??Ut(),t[2]=c,t[3]=g);let _=g,[v,y]=(0,Q.useState)(`auth`),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,ee]=(0,Q.useState)(void 0),[te,ne]=(0,Q.useState)(void 0),B=d??z,re=!!B&&B!==`github.com`&&!!(f??te)&&typeof h.ghLogin==`function`,V=!a&&d===void 0,H,U;t[4]!==d||t[5]!==a||t[6]!==V||t[7]!==n?(H=()=>{n&&(S(null),w(``),E(``),O(``),I(null),R(!1),ee(void 0),ne(void 0),y(a||V?`checking`:d&&d!==`github.com`?`pat`:`auth`))},U=[n,a,d,V],t[4]=d,t[5]=a,t[6]=V,t[7]=n,t[8]=H,t[9]=U):(H=t[8],U=t[9]),(0,Q.useLayoutEffect)(H,U);let W;t[10]!==a||t[11]!==n||t[12]!==_?(W=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),on);return _.status().then(n=>{e||(n.authenticated?(S({login:n.login,name:n.name,email:n.email}),w(n.name??``),E(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=_,t[13]=W):W=t[13];let ie;t[14]!==a||t[15]!==n?(ie=[n,a],t[14]=a,t[15]=n,t[16]=ie):ie=t[16],(0,Q.useEffect)(W,ie);let G;t[17]!==V||t[18]!==n||t[19]!==_?(G=()=>{if(!n||!V)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),on);return _.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;ee(n.host),ne(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=V,t[18]=n,t[19]=_,t[20]=G):G=t[20];let ae;t[21]!==V||t[22]!==n?(ae=[n,V],t[21]=V,t[22]=n,t[23]=ae):ae=t[23],(0,Q.useEffect)(G,ae);let oe;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(oe=function(e){if(S(e),a)w(e.name??``),E(e.email??``),y(`identity`);else{y(`done`),i?.(e),r(!1);let t=e.login;K.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=oe):oe=t[28];let se=oe,ce;t[29]!==p||t[30]!==B||t[31]!==se||t[32]!==L||t[33]!==D||t[34]!==h?(ce=async function(){let e=D.trim();if(!e||!B||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(B,e);R(!1),t.ok?se({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=B,t[31]=se,t[32]=L,t[33]=D,t[34]=h,t[35]=ce):ce=t[35];let le=ce,ue;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(ue=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(cn);let n={...x??{login:``},name:e,email:t};y(`done`),i?.(n),r(!1);let a=n.login;K.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=ue):ue=t[40];let q=ue,J;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(J=function(){if(!x)return;y(`done`),i?.(x),r(!1);let e=x.login;K.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=J):J=t[45];let de=J,fe;t[46]===r?fe=t[47]:(fe=function(){r(!1)},t[46]=r,t[47]=fe);let Y=fe,pe;t[48]!==a||t[49]!==o||t[50]!==v?(pe=(0,$.jsx)(N,{children:(0,$.jsx)(k,{children:o&&(v===`pat`||v===`gh-device`)?(0,$.jsx)(l,{id:`DUWgfT`}):o?(0,$.jsx)(l,{id:`X8kjQX`}):v===`pat`||v===`gh-device`?(0,$.jsx)(l,{id:`tzZ6ha`}):a&&v!==`auth`?(0,$.jsx)(l,{id:`29XZXN`}):(0,$.jsx)(l,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=v,t[51]=pe):pe=t[51];let me;t[52]===v?me=t[53]:(me=v===`checking`&&(0,$.jsx)(j,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gBbxn_`})})}),t[52]=v,t[53]=me);let X;t[54]!==se||t[55]!==Y||t[56]!==h||t[57]!==v?(X=v===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(nn,{onSuccess:se,startFlow:()=>h.start()})}),(0,$.jsx)(M,{children:(0,$.jsx)(b,{variant:`outline`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})})})]}),t[54]=se,t[55]=Y,t[56]=h,t[57]=v,t[58]=X):X=t[58];let he;t[59]!==re||t[60]!==B||t[61]!==Y||t[62]!==le||t[63]!==F||t[64]!==L||t[65]!==D||t[66]!==v?(he=v===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(an,{host:B??``,token:D,onTokenChange:O,error:F,onSubmit:le,showGhOption:re,onGhSignIn:()=>y(`gh-device`)})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`outline`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})}),(0,$.jsx)(b,{onClick:le,disabled:!D.trim()||L,children:L?(0,$.jsx)(l,{id:`9zb2WA`}):(0,$.jsx)(l,{id:`iSLIjg`})})]})]}),t[59]=re,t[60]=B,t[61]=Y,t[62]=le,t[63]=F,t[64]=L,t[65]=D,t[66]=v,t[67]=he):he=t[67];let ge;t[68]!==B||t[69]!==se||t[70]!==Y||t[71]!==h||t[72]!==v?(ge=v===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(nn,{onSuccess:se,startFlow:()=>h.ghLogin?.(B??``)??h.start()})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:()=>y(`pat`),children:(0,$.jsx)(l,{id:`hLKfZe`})}),(0,$.jsx)(b,{variant:`outline`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})})]})]}),t[68]=B,t[69]=se,t[70]=Y,t[71]=h,t[72]=v,t[73]=ge):ge=t[73];let _e;t[74]!==x||t[75]!==q||t[76]!==de||t[77]!==T||t[78]!==C||t[79]!==v?(_e=v===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(rn,{login:x.login,name:C,onNameChange:w,email:T,onEmailChange:E})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:de,children:(0,$.jsx)(l,{id:`6Uau97`})}),(0,$.jsx)(b,{onClick:()=>q(C.trim(),T.trim()),disabled:!C.trim()||!T.trim(),children:(0,$.jsx)(l,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=q,t[76]=de,t[77]=T,t[78]=C,t[79]=v,t[80]=_e):_e=t[80];let ve;t[81]!==pe||t[82]!==me||t[83]!==X||t[84]!==he||t[85]!==ge||t[86]!==_e?(ve=(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[pe,me,X,he,ge,_e]}),t[81]=pe,t[82]=me,t[83]=X,t[84]=he,t[85]=ge,t[86]=_e,t[87]=ve):ve=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==ve?(ye=(0,$.jsx)(P,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=ye):ye=t[91],ye}function cn(){}function ln(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(l,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(lt,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ut,{children:(0,$.jsx)(l,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==s||t[7]!==u||t[8]!==a||t[9]!==c||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(mt,{id:u,value:n,onChange:m,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=u,t[8]=a,t[9]=c,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(ft,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var un=/^[A-Za-z0-9_-]+$/;function dn(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function fn(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var pn=0;function mn(){return pn+=1,`prop-${pn}`}function hn(e){let{frontmatter:t,body:n}=ae(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of W(t).split(`
4
4
  `)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:mn(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function gn(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
@@ -1 +1 @@
1
- import{Fn as e,In as t}from"./dist-D6JA916i.js";var n={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.68.10`}?.VITE_APP_VERSION??`0.0.0-unknown`;function r(){return e({kind:`web`,runtimeVersion:n})}function i(){return t({kind:`web`,runtimeVersion:n})}export{r as n,i as r,n as t};
1
+ import{Fn as e,In as t}from"./dist-D6JA916i.js";var n={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.68.11`}?.VITE_APP_VERSION??`0.0.0-unknown`;function r(){return e({kind:`web`,runtimeVersion:n})}function i(){return t({kind:`web`,runtimeVersion:n})}export{r as n,i as r,n as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Br as t,Jn as n,Kn as r,Mn as i,Nr as a,Pr as o,oi as s,ri as c,ui as l}from"./DocumentContext-BdZiErvh.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{i as p}from"./local-menu-action-bus-CTOHR9LV.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-Cym3gapE.js";import{i as g,n as _,t as v}from"./tooltip-DttaCTqz.js";import{Bn as y,Li as b,nr as x,tr as S,yr as C,zn as w}from"./dist-D6JA916i.js";import{n as T}from"./dist-CJhtNlOm2.js";import{t as E}from"./dist-Cr4-nBVI.js";import{t as D}from"./createLucideIcon-BYL3gqKc.js";import{xt as O}from"./CodeMirrorPropInput-CRa8tGX-.js";import{t as ee}from"./x-CAqepOgq.js";import{l as te}from"./doc-hash-Dx9hwyex.js";var k=D(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),A=f(),j=`var(--ok-comment-hue,37,99,235)`,ne=j,re={fill:.22,line:.7},ie={fill:.45,line:1},ae=.45;function oe(e,t){let n=ne,{fill:r,line:i}=t?ie:re;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function M(e){return e.map(e=>e.id??`·`).join(`|`)}function se(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function ce(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:oe(e??a.covering[0],e!==void 0),threadId:se(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&M(a.covering)===M(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function le(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ue(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=R(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),de(n),!0}return!1}function R(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function de(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${j},${ae})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function z(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=w(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function fe(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function B(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:C(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:C(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=b(t.length);return c-s>l?null:{start:s,end:c}}function V(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function H(e,t,n){if(t.length===0)return null;let r=fe(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=C(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=B(e.text,t,n);return r===null?null:V(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||C(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=S({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||x(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,r[0])}let l=[],u=-1;for(let t of r){let n=x(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,l[0])}var U=64;function pe(e,t,n){return{prefix:y(e,Math.max(0,t-U),t),suffix:y(e,n,Math.min(e.content.size,n+U))}}function W(e,t,n){return G(e)(t,n)}function G(e){let t=z(e),n=null;return(r,i)=>{let a=H(t,r,i);return a===null?(n??=z(e,{includeBlockComponents:!0}),H(n,r,i)):a}}var me=220,he=24;function ge(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-me;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+he)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,r){let a=O(e);if(!a)return!1;let o=K(a.dom);if(!o)return i(n,`comment-reveal`,()=>e.commands.scrollIntoView());let s,c;try{s=a.coordsAtPos(t.from),c=a.coordsAtPos(t.to)}catch{return!1}let l=o.getBoundingClientRect(),u=ge({anchorTop:s.top,anchorBottom:Math.max(s.bottom,c.bottom),viewTop:l.top,viewBottom:l.bottom,insetTop:q(o)});if(u===0)return!0;let d=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return i(n,`comment-reveal`,()=>o.scrollTo({top:o.scrollTop+u,behavior:r?.instant||d?`auto`:`smooth`}))}var _e=1e4,Y=80,ve=1500,X=[`wheel`,`touchstart`,`mousedown`,`keydown`];function ye(e){let t=!1,i=null,s=null,c=-1,u=()=>{let n=r(e.docName);if(!n||n.isDestroyed)return!1;if(t||(t=!0,a(e.threadId)),e.quote===``)return i===null&&(i=Date.now(),o(e.threadId)),!0;let l=n.state.doc.content.size;return(s===null||l!==c)&&(s=W(n.state.doc,e.quote,e.context),c=l),!s||!J(n,s,e.docName,{instant:!0})?!1:(i===null&&(i=Date.now(),o(e.threadId)),!0)};l(`comments`),u(),r(e.docName)===null&&window.location.assign(te(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of X)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{u()&&i!==null&&Date.now()-i>=ve&&f()},h=n(m),g=window.setInterval(m,Y),_=window.setTimeout(()=>{i===null&&T.error(t?E._({id:`KeXgA-`}):E._({id:`JDQ5I5`})),f()},_e);for(let e of X)window.addEventListener(e,p,!0);m()}var Z=e();function be(){return c().length}function xe(){let e=(0,A.c)(4),n=c(),r;if(e[0]!==n){r=new Map;for(let e of n){let n=t(e)?.docName;n!==void 0&&r.set(n,(r.get(n)??0)+1)}e[0]=n,e[1]=r}else r=e[1];let i;return e[2]===r?i=e[3]:(i=[...r].map(Se),e[2]=r,e[3]=i),i}function Se(e){let[t,n]=e;return{docName:t,count:n}}function Ce(e){let t=(0,A.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=d();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,Z.jsx)(p,{className:`size-3`}),i=(0,Z.jsx)(u,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=f):f=t[10];let y;t[11]===l?y=t[12]:(y=l({id:`2zvUIK`}),t[11]=l,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(k,{className:`size-3`}),t[13]=b):b=t[13];let x;t[14]!==n||t[15]!==c.length?(x=c.length>1?(0,Z.jsx)(u,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,Z.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==x?(S=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":y,onClick:Te,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[b,x]})}),t[17]=y,t[18]=x,t[19]=S):S=t[19];let C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(_,{className:`max-w-64`,children:c.length>1?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(we)}):(0,Z.jsx)(u,{id:`2zvUIK`})}),t[20]=c,t[21]=C);let w;t[22]!==S||t[23]!==C?(w=(0,Z.jsxs)(v,{children:[S,C]}),t[22]=S,t[23]=C,t[24]=w):w=t[24];let T;t[25]===l?T=t[26]:(T=l({id:`pFRz_E`}),t[25]=l,t[26]=T);let E;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ee,{className:`size-3`}),t[27]=E):E=t[27];let D;t[28]!==o||t[29]!==T?(D=(0,Z.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":T,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:E}),t[28]=o,t[29]=T,t[30]=D):D=t[30];let O;return t[31]!==D||t[32]!==w?(O=(0,Z.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:f,children:[w,D]}),t[31]=D,t[32]=w,t[33]=O):O=t[33],O}function we(e){return(0,Z.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,Z.jsx)(`span`,{className:`truncate`,children:Q(e.docName)})]},e.docName)}function Te(){return s()}function Q(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ee(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function De(e){ye({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Oe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Oe=30;function ke(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ae(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function je(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Me(e){if(!e.repeats)return null;let t=Ae(e.prefix),n=je(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ne(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Br as t,Jn as n,Kn as r,Mn as i,Nr as a,Pr as o,oi as s,ri as c,ui as l}from"./DocumentContext-Dq9Tp3cJ.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{i as p}from"./local-menu-action-bus-CTOHR9LV.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-Cym3gapE.js";import{i as g,n as _,t as v}from"./tooltip-DttaCTqz.js";import{Bn as y,Li as b,nr as x,tr as S,yr as C,zn as w}from"./dist-D6JA916i.js";import{n as T}from"./dist-CJhtNlOm2.js";import{t as E}from"./dist-Cr4-nBVI.js";import{t as D}from"./createLucideIcon-BYL3gqKc.js";import{xt as O}from"./CodeMirrorPropInput-CxKiaHDG.js";import{t as ee}from"./x-CAqepOgq.js";import{l as te}from"./doc-hash-Dx9hwyex.js";var k=D(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),A=f(),j=`var(--ok-comment-hue,37,99,235)`,ne=j,re={fill:.22,line:.7},ie={fill:.45,line:1},ae=.45;function oe(e,t){let n=ne,{fill:r,line:i}=t?ie:re;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function M(e){return e.map(e=>e.id??`·`).join(`|`)}function se(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function ce(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:oe(e??a.covering[0],e!==void 0),threadId:se(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&M(a.covering)===M(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function le(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ue(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=R(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),de(n),!0}return!1}function R(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function de(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${j},${ae})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function z(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=w(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function fe(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function B(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:C(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:C(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=b(t.length);return c-s>l?null:{start:s,end:c}}function V(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function H(e,t,n){if(t.length===0)return null;let r=fe(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=C(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=B(e.text,t,n);return r===null?null:V(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||C(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=S({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||x(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,r[0])}let l=[],u=-1;for(let t of r){let n=x(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,l[0])}var U=64;function pe(e,t,n){return{prefix:y(e,Math.max(0,t-U),t),suffix:y(e,n,Math.min(e.content.size,n+U))}}function W(e,t,n){return G(e)(t,n)}function G(e){let t=z(e),n=null;return(r,i)=>{let a=H(t,r,i);return a===null?(n??=z(e,{includeBlockComponents:!0}),H(n,r,i)):a}}var me=220,he=24;function ge(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-me;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+he)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,r){let a=O(e);if(!a)return!1;let o=K(a.dom);if(!o)return i(n,`comment-reveal`,()=>e.commands.scrollIntoView());let s,c;try{s=a.coordsAtPos(t.from),c=a.coordsAtPos(t.to)}catch{return!1}let l=o.getBoundingClientRect(),u=ge({anchorTop:s.top,anchorBottom:Math.max(s.bottom,c.bottom),viewTop:l.top,viewBottom:l.bottom,insetTop:q(o)});if(u===0)return!0;let d=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return i(n,`comment-reveal`,()=>o.scrollTo({top:o.scrollTop+u,behavior:r?.instant||d?`auto`:`smooth`}))}var _e=1e4,Y=80,ve=1500,X=[`wheel`,`touchstart`,`mousedown`,`keydown`];function ye(e){let t=!1,i=null,s=null,c=-1,u=()=>{let n=r(e.docName);if(!n||n.isDestroyed)return!1;if(t||(t=!0,a(e.threadId)),e.quote===``)return i===null&&(i=Date.now(),o(e.threadId)),!0;let l=n.state.doc.content.size;return(s===null||l!==c)&&(s=W(n.state.doc,e.quote,e.context),c=l),!s||!J(n,s,e.docName,{instant:!0})?!1:(i===null&&(i=Date.now(),o(e.threadId)),!0)};l(`comments`),u(),r(e.docName)===null&&window.location.assign(te(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of X)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{u()&&i!==null&&Date.now()-i>=ve&&f()},h=n(m),g=window.setInterval(m,Y),_=window.setTimeout(()=>{i===null&&T.error(t?E._({id:`KeXgA-`}):E._({id:`JDQ5I5`})),f()},_e);for(let e of X)window.addEventListener(e,p,!0);m()}var Z=e();function be(){return c().length}function xe(){let e=(0,A.c)(4),n=c(),r;if(e[0]!==n){r=new Map;for(let e of n){let n=t(e)?.docName;n!==void 0&&r.set(n,(r.get(n)??0)+1)}e[0]=n,e[1]=r}else r=e[1];let i;return e[2]===r?i=e[3]:(i=[...r].map(Se),e[2]=r,e[3]=i),i}function Se(e){let[t,n]=e;return{docName:t,count:n}}function Ce(e){let t=(0,A.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=d();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,Z.jsx)(p,{className:`size-3`}),i=(0,Z.jsx)(u,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=f):f=t[10];let y;t[11]===l?y=t[12]:(y=l({id:`2zvUIK`}),t[11]=l,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(k,{className:`size-3`}),t[13]=b):b=t[13];let x;t[14]!==n||t[15]!==c.length?(x=c.length>1?(0,Z.jsx)(u,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,Z.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==x?(S=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":y,onClick:Te,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[b,x]})}),t[17]=y,t[18]=x,t[19]=S):S=t[19];let C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(_,{className:`max-w-64`,children:c.length>1?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(we)}):(0,Z.jsx)(u,{id:`2zvUIK`})}),t[20]=c,t[21]=C);let w;t[22]!==S||t[23]!==C?(w=(0,Z.jsxs)(v,{children:[S,C]}),t[22]=S,t[23]=C,t[24]=w):w=t[24];let T;t[25]===l?T=t[26]:(T=l({id:`pFRz_E`}),t[25]=l,t[26]=T);let E;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ee,{className:`size-3`}),t[27]=E):E=t[27];let D;t[28]!==o||t[29]!==T?(D=(0,Z.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":T,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:E}),t[28]=o,t[29]=T,t[30]=D):D=t[30];let O;return t[31]!==D||t[32]!==w?(O=(0,Z.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:f,children:[w,D]}),t[31]=D,t[32]=w,t[33]=O):O=t[33],O}function we(e){return(0,Z.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,Z.jsx)(`span`,{className:`truncate`,children:Q(e.docName)})]},e.docName)}function Te(){return s()}function Q(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ee(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function De(e){ye({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Oe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Oe=30;function ke(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ae(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function je(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Me(e){if(!e.repeats)return null;let t=Ae(e.prefix),n=je(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ne(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
2
2
  `))i.push(` > ${e}`);i.push(``),i.push(` ${e.body.trim()}`)}e.anchorLost&&(i.push(``),i.push(n===``?` (Note: \`${e.propertyKey}\` is no longer in this document's frontmatter — it was renamed or removed since the comment was written. Do not apply this to a different property; if you cannot tell what it now refers to, say so instead of guessing.)`:` (Note: that text is no longer in \`${e.propertyKey}\` — the value was edited, reshaped, or removed since the comment was written. Do not apply this to a different property or a different part of the value; if you cannot tell what it now refers to, say so instead of guessing.)`));return}i.push(`${t+1}. In \`${e.docName}\`, on this passage:`),i.push(``);for(let t of e.quote.split(`
3
3
  `))i.push(` > ${t}`);i.push(``),i.push(` ${e.body.trim()}`);let n=Me(e);n!==null&&(i.push(``),i.push(` ${n}`)),e.anchorLost&&(i.push(``),i.push(` (Note: this passage is no longer in the document — it was edited or removed since the comment was written. Do not apply this to a different passage; if you cannot tell what it now refers to, say so instead of guessing.)`))}),n&&n.markdown.trim().length>0){i.push(``),i.push(`Also in scope, selected in \`${n.docName}\` (not a comment):`),i.push(``);for(let e of n.markdown.trim().split(`
4
4
  `))i.push(`> ${e}`)}return i.join(`