@open-mercato/cezar 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/README.md +19 -11
  2. package/dist/agent-config/catalog.d.ts +1 -1
  3. package/dist/agent-config/files.d.ts +1 -1
  4. package/dist/agent-config/service.d.ts +1 -1
  5. package/dist/agent-config/validate.d.ts +1 -1
  6. package/dist/automations/coordinator.d.ts +26 -0
  7. package/dist/automations/coordinator.js +66 -0
  8. package/dist/automations/coordinator.js.map +1 -0
  9. package/dist/automations/github-poller.d.ts +74 -0
  10. package/dist/automations/github-poller.js +234 -0
  11. package/dist/automations/github-poller.js.map +1 -0
  12. package/dist/automations/scheduler.d.ts +42 -0
  13. package/dist/automations/scheduler.js +192 -0
  14. package/dist/automations/scheduler.js.map +1 -0
  15. package/dist/automations/store.d.ts +65 -0
  16. package/dist/automations/store.js +298 -0
  17. package/dist/automations/store.js.map +1 -0
  18. package/dist/automations/task-template.d.ts +18 -0
  19. package/dist/automations/task-template.js +95 -0
  20. package/dist/automations/task-template.js.map +1 -0
  21. package/dist/automations/types.d.ts +251 -0
  22. package/dist/automations/types.js +158 -0
  23. package/dist/automations/types.js.map +1 -0
  24. package/dist/config.d.ts +9 -111
  25. package/dist/contract/agent-config.d.ts +151 -0
  26. package/dist/contract/automations.d.ts +911 -0
  27. package/dist/contract/events.d.ts +45 -0
  28. package/dist/contract/github.d.ts +467 -0
  29. package/dist/contract/health.d.ts +96 -0
  30. package/dist/contract/index.d.ts +15 -0
  31. package/dist/contract/index.js +1421 -0
  32. package/dist/contract/projects.d.ts +182 -0
  33. package/dist/contract/repo.d.ts +234 -0
  34. package/dist/contract/runs.d.ts +1226 -0
  35. package/dist/contract/skills.d.ts +225 -0
  36. package/dist/contract/workflows.d.ts +212 -0
  37. package/dist/contract/workspace.d.ts +442 -0
  38. package/dist/core/agent-env.d.ts +1 -1
  39. package/dist/core/agent-runner.d.ts +12 -1
  40. package/dist/core/agent-runner.js +13 -0
  41. package/dist/core/agent-runner.js.map +1 -1
  42. package/dist/core/ask.d.ts +45 -124
  43. package/dist/core/ask.js +103 -13
  44. package/dist/core/ask.js.map +1 -1
  45. package/dist/core/claude-cli-runner.d.ts +2 -2
  46. package/dist/core/claude-cli-runner.js +52 -9
  47. package/dist/core/claude-cli-runner.js.map +1 -1
  48. package/dist/core/claude-ui-mapper.d.ts +1 -1
  49. package/dist/core/codex-app-server-runner.d.ts +1 -1
  50. package/dist/core/codex-app-server-runner.js +55 -3
  51. package/dist/core/codex-app-server-runner.js.map +1 -1
  52. package/dist/core/codex-app-server-transport.d.ts +6 -1
  53. package/dist/core/codex-app-server-transport.js +12 -3
  54. package/dist/core/codex-app-server-transport.js.map +1 -1
  55. package/dist/core/codex-model-catalog.d.ts +1 -1
  56. package/dist/core/codex-ui-mapper.d.ts +5 -1
  57. package/dist/core/codex-ui-mapper.js +74 -17
  58. package/dist/core/codex-ui-mapper.js.map +1 -1
  59. package/dist/core/model-identity.d.ts +1 -1
  60. package/dist/core/model-presets.d.ts +2 -2
  61. package/dist/core/model-presets.js +1 -1
  62. package/dist/core/opencode-server-runner.d.ts +2 -2
  63. package/dist/core/opencode-ui-mapper.d.ts +4 -1
  64. package/dist/core/opencode-ui-mapper.js +45 -7
  65. package/dist/core/opencode-ui-mapper.js.map +1 -1
  66. package/dist/core/provider-auth.d.ts +62 -0
  67. package/dist/core/provider-auth.js +290 -0
  68. package/dist/core/provider-auth.js.map +1 -0
  69. package/dist/core/provider-availability.d.ts +3 -0
  70. package/dist/core/provider-availability.js +13 -0
  71. package/dist/core/provider-availability.js.map +1 -0
  72. package/dist/core/runner-factory.d.ts +1 -1
  73. package/dist/core/runner-model-catalog.d.ts +1 -1
  74. package/dist/core/tool-display.d.ts +1 -1
  75. package/dist/core/ui-events.d.ts +1 -1
  76. package/dist/core/ui-events.js +1 -1
  77. package/dist/git-diff-base.d.ts +60 -0
  78. package/dist/git-diff-base.js +54 -0
  79. package/dist/git-diff-base.js.map +1 -0
  80. package/dist/git-worktree.d.ts +37 -6
  81. package/dist/git-worktree.js +39 -9
  82. package/dist/git-worktree.js.map +1 -1
  83. package/dist/handoff.d.ts +2 -2
  84. package/dist/handoff.js +1 -1
  85. package/dist/index.js +65 -8
  86. package/dist/index.js.map +1 -1
  87. package/dist/paths.d.ts +16 -1
  88. package/dist/paths.js +24 -1
  89. package/dist/paths.js.map +1 -1
  90. package/dist/planner.d.ts +2 -2
  91. package/dist/planner.js +1 -1
  92. package/dist/planner.js.map +1 -1
  93. package/dist/release/manifests.d.ts +81 -0
  94. package/dist/release/manifests.js +74 -0
  95. package/dist/release/manifests.js.map +1 -0
  96. package/dist/release/snapshot.d.ts +9 -23
  97. package/dist/release/snapshot.js +9 -22
  98. package/dist/release/snapshot.js.map +1 -1
  99. package/dist/release/stable.d.ts +15 -29
  100. package/dist/release/stable.js +14 -27
  101. package/dist/release/stable.js.map +1 -1
  102. package/dist/runs/auto-name.d.ts +1 -1
  103. package/dist/runs/retention.d.ts +1 -1
  104. package/dist/runs/store.d.ts +142 -336
  105. package/dist/runs/store.js +136 -9
  106. package/dist/runs/store.js.map +1 -1
  107. package/dist/runs/ui-event-sink.d.ts +1 -1
  108. package/dist/server/app-type.d.ts +21 -0
  109. package/dist/server/app-type.js +2 -0
  110. package/dist/server/app-type.js.map +1 -0
  111. package/dist/server/capabilities.d.ts +6 -5
  112. package/dist/server/capabilities.js +11 -0
  113. package/dist/server/capabilities.js.map +1 -1
  114. package/dist/server/forge/github.d.ts +58 -151
  115. package/dist/server/forge/github.js +530 -6
  116. package/dist/server/forge/github.js.map +1 -1
  117. package/dist/server/forge/index.d.ts +10 -3
  118. package/dist/server/forge/index.js +14 -1
  119. package/dist/server/forge/index.js.map +1 -1
  120. package/dist/server/forge/types.d.ts +86 -1
  121. package/dist/server/git-changes.d.ts +8 -8
  122. package/dist/server/git-changes.js +14 -17
  123. package/dist/server/git-changes.js.map +1 -1
  124. package/dist/server/git.d.ts +2 -0
  125. package/dist/server/git.js +9 -0
  126. package/dist/server/git.js.map +1 -1
  127. package/dist/server/github.d.ts +3 -3
  128. package/dist/server/github.js +1 -1
  129. package/dist/server/github.js.map +1 -1
  130. package/dist/server/pr.d.ts +2 -2
  131. package/dist/server/project-context.d.ts +20 -3
  132. package/dist/server/project-context.js +30 -1
  133. package/dist/server/project-context.js.map +1 -1
  134. package/dist/server/provider-action-gate.d.ts +8 -0
  135. package/dist/server/provider-action-gate.js +54 -0
  136. package/dist/server/provider-action-gate.js.map +1 -0
  137. package/dist/server/provider-auth-runtime.d.ts +21 -0
  138. package/dist/server/provider-auth-runtime.js +66 -0
  139. package/dist/server/provider-auth-runtime.js.map +1 -0
  140. package/dist/server/server.d.ts +11142 -47
  141. package/dist/server/server.js +1714 -806
  142. package/dist/server/server.js.map +1 -1
  143. package/dist/server/validators.d.ts +97 -0
  144. package/dist/server/validators.js +86 -0
  145. package/dist/server/validators.js.map +1 -0
  146. package/dist/server/ws.d.ts +2 -2
  147. package/dist/server/ws.js +2 -2
  148. package/dist/server/ws.js.map +1 -1
  149. package/dist/server-install/engine.d.ts +1 -1
  150. package/dist/server-install/platforms/macosx-ngrok.d.ts +1 -1
  151. package/dist/server-install/platforms/ubuntu-vps.d.ts +16 -1
  152. package/dist/server-install/platforms/ubuntu-vps.js +83 -1
  153. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  154. package/dist/server-install/state.d.ts +1 -1
  155. package/dist/server-install/steps.d.ts +2 -2
  156. package/dist/server-install/strategies.d.ts +1 -1
  157. package/dist/server-install/types.d.ts +38 -424
  158. package/dist/server-install/ui.d.ts +1 -1
  159. package/dist/skills-banner.d.ts +7 -6
  160. package/dist/skills-banner.js +7 -6
  161. package/dist/skills-banner.js.map +1 -1
  162. package/dist/skills-remote.d.ts +2 -2
  163. package/dist/skills-update.d.ts +88 -0
  164. package/dist/skills-update.js +392 -0
  165. package/dist/skills-update.js.map +1 -0
  166. package/dist/skills.d.ts +2 -0
  167. package/dist/skills.js +3 -2
  168. package/dist/skills.js.map +1 -1
  169. package/dist/todos.d.ts +2 -28
  170. package/dist/todos.js +1 -1
  171. package/dist/ui-state.d.ts +16 -2
  172. package/dist/ui-state.js +14 -1
  173. package/dist/ui-state.js.map +1 -1
  174. package/dist/workflows/load.d.ts +1 -1
  175. package/dist/workflows/run.d.ts +53 -12
  176. package/dist/workflows/run.js +436 -64
  177. package/dist/workflows/run.js.map +1 -1
  178. package/dist/workflows/types.d.ts +59 -224
  179. package/dist/workflows/types.js +14 -0
  180. package/dist/workflows/types.js.map +1 -1
  181. package/dist/workspace/config.d.ts +68 -206
  182. package/dist/workspace/config.js +145 -14
  183. package/dist/workspace/config.js.map +1 -1
  184. package/dist/workspace/migrations.d.ts +1 -1
  185. package/dist/workspace/migrations.js +19 -4
  186. package/dist/workspace/migrations.js.map +1 -1
  187. package/dist/workspace/projects.d.ts +8 -2
  188. package/dist/workspace/projects.js +9 -3
  189. package/dist/workspace/projects.js.map +1 -1
  190. package/dist/workspace/semaphore.d.ts +6 -0
  191. package/dist/workspace/semaphore.js +14 -1
  192. package/dist/workspace/semaphore.js.map +1 -1
  193. package/dist/workspace/ui-state.d.ts +13 -3
  194. package/dist/workspace/ui-state.js +15 -5
  195. package/dist/workspace/ui-state.js.map +1 -1
  196. package/package.json +17 -39
  197. package/scripts/inline-contract.mjs +112 -0
  198. package/scripts/mock-claude.mjs +39 -1
  199. package/scripts/sync-readme.mjs +20 -0
  200. package/web/dist/assets/alert-dialog-ghffK6g9.js +1 -0
  201. package/web/dist/assets/arrow-down-Cz8qb71e.js +1 -0
  202. package/web/dist/assets/arrow-left-wcYKQXI_.js +1 -0
  203. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  204. package/web/dist/assets/centered-state-ZtnFHA-n.js +43 -0
  205. package/web/dist/assets/chevron-right-G4caF2QV.js +1 -0
  206. package/web/dist/assets/{chunk-BO2N2NFS-DtrdTCWa.js → chunk-BO2N2NFS-DE6qKn3r.js} +8 -8
  207. package/web/dist/assets/circle-check--KvBxXWp.js +1 -0
  208. package/web/dist/assets/circle-x-C3EFZ3xf.js +1 -0
  209. package/web/dist/assets/collapsible-B0JVzd0B.js +1 -0
  210. package/web/dist/assets/commit-list-wm6DPHNs.js +1 -0
  211. package/web/dist/assets/compare-variants-DbdP4Y5T.js +1 -0
  212. package/web/dist/assets/{core-DePtBHcl.js → core-BCsw8oQw.js} +1 -1
  213. package/web/dist/assets/diff-Bizc96qe.js +3 -0
  214. package/web/dist/assets/diff-stat-Dyfg3ltF.js +1 -0
  215. package/web/dist/assets/{diff-view-DCeSegKk.js → diff-view-CG8ek6tC.js} +4 -4
  216. package/web/dist/assets/dropdown-menu-C1Dlf35P.js +1 -0
  217. package/web/dist/assets/editable-title-5rC_QRBZ.js +1 -0
  218. package/web/dist/assets/{ellipsis-vertical-CNnSLn5a.js → ellipsis-vertical-DpGTRqC2.js} +1 -1
  219. package/web/dist/assets/{file-D4GBh1ao.js → file-DlUGpUlb.js} +1 -1
  220. package/web/dist/assets/folder-BAY6Vddy.js +1 -0
  221. package/web/dist/assets/{git-pull-request-DnR8Xh4_.js → git-pull-request-agOG0iGM.js} +1 -1
  222. package/web/dist/assets/git-toolbar-DGiNMmtY.js +1 -0
  223. package/web/dist/assets/github-Vp7lxYGQ.js +1 -0
  224. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  225. package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
  226. package/web/dist/assets/image-preview-BWGk5fPX.js +1 -0
  227. package/web/dist/assets/index-DSxyJpuK.css +2 -0
  228. package/web/dist/assets/index-DiawI6RX.js +6 -0
  229. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  230. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  231. package/web/dist/assets/markdown-BGBOGCA_.js +2 -0
  232. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  233. package/web/dist/assets/new-task-form-BpAw_Dks.js +1 -0
  234. package/web/dist/assets/pill-Dvs-P0xy.js +1 -0
  235. package/web/dist/assets/project-router-Cx8NPoqn.js +1 -0
  236. package/web/dist/assets/prompt-templates-CSBYBR1I.js +15 -0
  237. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  238. package/web/dist/assets/{refresh-cw-BT8E96Tm.js → refresh-cw-BoGdAykg.js} +1 -1
  239. package/web/dist/assets/repo-git-PmX-BNMo.js +1 -0
  240. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  241. package/web/dist/assets/run-diff-EcOkf3ti.js +3 -0
  242. package/web/dist/assets/run-header-BGiv6_qX.js +1 -0
  243. package/web/dist/assets/{search-x-BDjaMrzG.js → search-x-X3EpVhgs.js} +1 -1
  244. package/web/dist/assets/skill-empty-hint-CZLALx6l.js +1 -0
  245. package/web/dist/assets/skills-BiWfHmCR.js +1 -0
  246. package/web/dist/assets/skills-CC91ouGH.js +1 -0
  247. package/web/dist/assets/sparkles-Dt4q7pbG.js +1 -0
  248. package/web/dist/assets/{square-terminal-Ckjjn0vb.js → square-terminal-hwBL8XsC.js} +1 -1
  249. package/web/dist/assets/tab-link-DIlR5T07.js +1 -0
  250. package/web/dist/assets/task-changes-XkHDxzQA.js +1 -0
  251. package/web/dist/assets/task-commits-BTTA5k5T.js +1 -0
  252. package/web/dist/assets/task-files-Da8_4C9g.js +2 -0
  253. package/web/dist/assets/task-thread-DoNXUsHr.js +9 -0
  254. package/web/dist/assets/textarea-CUdokhkv.js +1 -0
  255. package/web/dist/assets/thread-loading-B8q8ukXJ.js +1 -0
  256. package/web/dist/assets/{trash-2-DAyZ0VSi.js → trash-2-DhVIdWv8.js} +1 -1
  257. package/web/dist/assets/{triangle-alert-Uy8rokUh.js → triangle-alert-XYT0DGCI.js} +1 -1
  258. package/web/dist/assets/{upload-CDdyPPo_.js → upload-BKjN59-1.js} +1 -1
  259. package/web/dist/assets/use-desktop-Bf5LS_P4.js +1 -0
  260. package/web/dist/assets/use-submit-shortcut-CzVyoAMd.js +1 -0
  261. package/web/dist/assets/utils-DsLuRXwV.js +64 -0
  262. package/web/dist/assets/workflows-o2QU_pvU.js +11 -0
  263. package/web/dist/assets/zoomable-image-7WyUiaVD.js +1 -0
  264. package/web/dist/index.html +32 -13
  265. package/scripts/dev.mjs +0 -74
  266. package/scripts/release-snapshot.mjs +0 -130
  267. package/scripts/release.mjs +0 -119
  268. package/web/dist/assets/arrow-left-CnSdp92h.js +0 -1
  269. package/web/dist/assets/bundle-mjs-BegPhL5c.js +0 -1
  270. package/web/dist/assets/centered-state-DOsTcJZF.js +0 -43
  271. package/web/dist/assets/commit-list-BrxBEzRK.js +0 -1
  272. package/web/dist/assets/compare-variants-Bv2c9ORF.js +0 -1
  273. package/web/dist/assets/dist-B6XQOhgM.js +0 -1
  274. package/web/dist/assets/git-toolbar-pIC1ubPM.js +0 -1
  275. package/web/dist/assets/github-DTTSG0ht.js +0 -1
  276. package/web/dist/assets/highlighted-body-OFNGDK62-BuFJwunK.js +0 -1
  277. package/web/dist/assets/image-preview-DEhW0TFz.js +0 -1
  278. package/web/dist/assets/index-Cijmlz7q.js +0 -30
  279. package/web/dist/assets/index-DzroxqBG.css +0 -2
  280. package/web/dist/assets/lib-DPEZDBUN.js +0 -1
  281. package/web/dist/assets/lib-uHpeUPzK.js +0 -1
  282. package/web/dist/assets/mermaid-GHXKKRXX-CN2zQue0.js +0 -1
  283. package/web/dist/assets/open-mercato-toBr6SOa.svg +0 -11
  284. package/web/dist/assets/project-router-BMx4e8m-.js +0 -1
  285. package/web/dist/assets/repo-git-BusYfa3t.js +0 -1
  286. package/web/dist/assets/run-diff-wOJ3odA-.js +0 -3
  287. package/web/dist/assets/run-header-Cg5incil.js +0 -1
  288. package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +0 -1
  289. package/web/dist/assets/skills-PpP2owbM.js +0 -1
  290. package/web/dist/assets/tab-link-F3uQrdm2.js +0 -1
  291. package/web/dist/assets/task-changes-iD9kS79I.js +0 -1
  292. package/web/dist/assets/task-commits-COkLaUri.js +0 -1
  293. package/web/dist/assets/task-files-Ckttz7XH.js +0 -2
  294. package/web/dist/assets/task-thread-CQD91VPt.js +0 -9
  295. package/web/dist/assets/textarea-Bj_LCreg.js +0 -1
  296. package/web/dist/assets/use-desktop-DUh0STzq.js +0 -3
  297. package/web/dist/assets/utils-B8s5qIcK.js +0 -1
  298. package/web/dist/assets/workflows-BFk8C0co.js +0 -11
  299. package/web/dist/assets/zoomable-image-PEDOqyLQ.js +0 -1
  300. /package/web/{open-mercato.svg → dist/open-mercato.svg} +0 -0
@@ -0,0 +1 @@
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,_ as i,b as a,g as o,h as s,v as c,x as l,y as u}from"./centered-state-ZtnFHA-n.js";var d=e(t(),1),f=n(),p=`Collapsible`,[m,h]=a(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:o,onOpenChange:c,...u}=e,[m,h]=i({prop:r,defaultProp:a??!1,onChange:c,caller:p});return(0,f.jsx)(g,{scope:n,disabled:o,contentId:s(),open:m,onOpenToggle:d.useCallback(()=>h(e=>!e),[h]),children:(0,f.jsx)(l.div,{"data-state":w(m),"data-disabled":o?``:void 0,...u,ref:t})})});v.displayName=p;var y=`CollapsibleTrigger`,b=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=_(y,n);return(0,f.jsx)(l.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":w(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:u(e.onClick,i.onOpenToggle)})});b.displayName=y;var x=`CollapsibleContent`,S=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_(x,e.__scopeCollapsible);return(0,f.jsx)(o,{present:n||i.open,children:({present:e})=>(0,f.jsx)(C,{...r,ref:t,present:e})})});S.displayName=x;var C=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:i,children:a,...o}=e,s=_(x,n),[u,p]=d.useState(i),m=d.useRef(null),h=r(t,m),g=d.useRef(0),v=g.current,y=d.useRef(0),b=y.current,S=s.open||u,C=d.useRef(S),T=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),c(()=>{let e=m.current;if(e){T.current=T.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,y.current=t.width,C.current||(e.style.transitionDuration=T.current.transitionDuration,e.style.animationName=T.current.animationName),p(i)}},[s.open,i]),(0,f.jsx)(l.div,{"data-state":w(s.open),"data-disabled":s.disabled?``:void 0,id:s.contentId,hidden:!S,...o,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:S&&a})});function w(e){return e?`open`:`closed`}var T=v;function E({...e}){return(0,f.jsx)(T,{"data-slot":`collapsible`,...e})}function D({...e}){return(0,f.jsx)(b,{"data-slot":`collapsible-trigger`,...e})}function O({...e}){return(0,f.jsx)(S,{"data-slot":`collapsible-content`,...e})}export{O as n,D as r,E as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DsLuRXwV.js";import{t as i}from"./project-router-Cx8NPoqn.js";import{t as a}from"./lib-BQXq3kEf.js";var o=e(t(),1),s=n(),c=41;function l({slot:e,commits:t,className:n}){let i=t.length>150,l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(0);(0,o.useLayoutEffect)(()=>{if(!i)return;let e=()=>{let e=l.current,t=d.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let m=t.map(e=>(0,s.jsx)(u,{commit:e},e.sha));return(0,s.jsx)(`div`,{ref:e=>{l.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":i,className:r(`flex flex-col divide-y divide-border px-2 py-1 md:px-4`,n),children:i?(0,s.jsx)(a,{scrollRef:d,startMargin:f,itemSize:c,children:m}):m})}function u({commit:e}){return(0,s.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_41px] [content-visibility:auto]`,children:(0,s.jsxs)(i,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:`flex min-w-0 items-baseline gap-3 rounded-sm px-2 py-2.5 hover:bg-muted`,children:[(0,s.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),(0,s.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.subject}),(0,s.jsxs)(`span`,{className:`hidden shrink-0 text-[11px] text-soft-foreground sm:inline`,children:[e.author,` · `,e.when]})]})})}export{l as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,An as i,H as a,Nt as o,U as s,Ut as c,Xt as l,_t as u,a as d,fr as f,i as p,k as m,kt as h,lr as g,sr as _,t as v}from"./centered-state-ZtnFHA-n.js";import{t as y}from"./utils-DsLuRXwV.js";import{t as b}from"./chevron-right-G4caF2QV.js";import{t as x}from"./search-x-X3EpVhgs.js";import{n as S,r as C,t as w}from"./collapsible-B0JVzd0B.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./alert-dialog-ghffK6g9.js";import{c as N,t as P}from"./project-router-Cx8NPoqn.js";import{a as F,n as I,r as L,t as R}from"./pill-Dvs-P0xy.js";import{t as z}from"./markdown-BGBOGCA_.js";import{m as B,v as V}from"./index-DiawI6RX.js";import{t as H}from"./run-diff-EcOkf3ti.js";var U=e(t(),1),W=n();function G(){let{groupId:e}=_(),t=a(e),n=I(s().data),i=f();if((0,U.useEffect)(()=>{e&&i.invalidateQueries({queryKey:r.groups.detail(e)})},[i,e,(u().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,W.jsx)(B,{});if(t.isError){let e=t.error instanceof l&&t.error.status===404;return(0,W.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(v,{icon:e?(0,W.jsx)(x,{}):(0,W.jsx)(V,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,W.jsx)(d,{asChild:!0,variant:`outline`,children:(0,W.jsx)(P,{to:`/`,children:`Back to tasks`})})})})}return(0,W.jsx)(K,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function K({groupId:e,variants:t,showTokens:n,showCost:a}){let o=N(),s=f(),[l,u]=(0,U.useState)(null),d=t.every(e=>h.has(e.status)),_=t[0]?c(t[0]):``,v=g({mutationFn:t=>i(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:r.runs.all}),s.invalidateQueries({queryKey:r.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>p(e.message,{tone:`danger`})});return(0,W.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,W.jsx)(V,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:_,children:_})]}),(0,W.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,W.jsx)(`div`,{"data-slot":`compare-columns`,className:y(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,W.jsx)(q,{variant:e,allTerminal:d,pickPending:v.isPending,onPick:()=>u(e),showTokens:n,showCost:a},e.id))}),(0,W.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,W.jsx)(J,{variant:e},e.id))}),(0,W.jsx)(M,{open:l!==null,onOpenChange:e=>!e&&u(null),children:(0,W.jsxs)(D,{children:[(0,W.jsxs)(j,{children:[(0,W.jsxs)(E,{children:[`Pick variant `,l?.variant,`?`]}),(0,W.jsxs)(T,{children:[`Variant `,l?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,W.jsxs)(k,{children:[(0,W.jsx)(A,{children:`Keep comparing`}),(0,W.jsxs)(O,{"data-slot":`confirm-pick`,onClick:()=>{l&&v.mutate(l.id),u(null)},children:[(0,W.jsx)(m,{"aria-hidden":`true`}),`Pick variant `,l?.variant]})]})]})})]})}function q({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let s=F(e),c=o(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,W.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,W.jsx)(R,{dot:s.tone,pulse:s.pulse,children:s.label}),i&&l||a&&c?(0,W.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,W.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&l&&a&&c?(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&c?(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,W.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,W.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,W.jsx)(z,{children:e.handoffExcerpt})}):(0,W.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,W.jsxs)(d,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,W.jsx)(m,{"aria-hidden":`true`}),`Pick this one`]})]})}function J({variant:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(w,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,W.jsxs)(C,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,W.jsx)(b,{className:y(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,W.jsx)(S,{children:(0,W.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,W.jsx)(H,{runId:e.id})})})]})}export{G as CompareVariantsRoute};
@@ -1,4 +1,4 @@
1
- import{c as e,d as t,i as n,l as r,n as i,o as a,r as o,t as s,u as c}from"./lib-uHpeUPzK.js";var l=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function u(e){return d(e)}function d(e){return Array.isArray(e)?f(e):e instanceof RegExp?e:typeof e==`object`?p(e):e}function f(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=d(e[n]);return t}function p(e){let t={};for(let n in e)t[n]=d(e[n]);return t}function m(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function h(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?h(e.substring(0,e.length-1)):e.substr(~t+1)}var g=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,_=class{static hasCaptures(e){return e===null?!1:(g.lastIndex=0,g.test(e))}static replaceCaptures(e,t,n){return e.replace(g,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function v(e,t){return e<t?-1:+(e>t)}function ee(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=v(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function te(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function ne(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var re=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},y=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(ce(e),t)}static createFromParsedTheme(e,t){return ue(e,t)}_cachedMatchRoot=new re(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ae(e.parent,t.parentScopes));return n?new se(n.fontStyle,n.foreground,n.background):null}},ie=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ae(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!oe(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function oe(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var se=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function ce(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&te(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&te(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new le(l,u,e,o,s,c)}}return n}var le=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},b=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(b||{});function ue(e,t){e.sort((e,t)=>{let n=v(e.scope,t.scope);return n!==0||(n=ee(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new de(t),o=new se(n,a.getId(r),a.getId(i)),s=new me(new pe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new y(a,o,s)}var de=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},fe=Object.freeze([]),pe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||fe,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},me=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),pe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(ee(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new pe(e,t,n,r,i))}},x=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=ge(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function he(e){return e}function ge(e){return e}function S(e,t){let n=[],r=ve(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(_e(i)){let e=[];do e.push(i),i=r.next();while(_e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function _e(e){return!!e&&!!e.match(/[\w\.:]+/)}function ve(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function ye(e){typeof e.dispose==`function`&&e.dispose()}var C=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},be=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},xe=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Se=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new C(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new xe;for(let n of e)Ce(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof C){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Ce(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof C?w({baseGrammar:a,selfGrammar:i},r):we(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new C(e))}function we(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Te([r],t,n)}}function w(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Te(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Te(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Te(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?m({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Te(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=je(i);switch(a.kind){case 0:w({...t,selfGrammar:t.baseGrammar},n);break;case 1:w(t,n);break;case 2:we(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?we(a.ruleName,i,n):w(i,n)}else a.kind===4?n.add(new be(a.scopeName,a.ruleName)):n.add(new C(a.scopeName));break}}}var Ee=class{kind=0},De=class{kind=1},Oe=class{constructor(e){this.ruleName=e}kind=2},ke=class{constructor(e){this.scopeName=e}kind=3},Ae=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function je(e){if(e===`$base`)return new Ee;if(e===`$self`)return new De;let t=e.indexOf(`#`);return t===-1?new ke(e):t===0?new Oe(e.substring(1)):new Ae(e.substring(0,t),e.substring(t+1))}var Me=/\\(\d+)/,Ne=/\\(\d+)/g,Pe=-1,Fe=-2;function Ie(e){return e}function Le(e){return e}var T=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=_.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=_.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${h(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:_.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:_.replaceCaptures(this._contentName,e,t)}},Re=class extends T{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},ze=class extends T{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new E(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new D,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Be=class extends T{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new D,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ve=class extends T{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new E(i,this.id),this.beginCaptures=a,this._end=new E(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},He=class extends T{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new E(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new E(o,Fe),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new D,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},Ue=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Re(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new ze(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=m({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Be(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new He(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ve(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=je(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Be||e instanceof Ve||e instanceof He)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},E=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=Me.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Ne.lastIndex=0,this.source.replace(Ne,(e,t)=>ne(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},D=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new We(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new We(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},We=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
1
+ import{c as e,d as t,i as n,l as r,n as i,o as a,r as o,t as s,u as c}from"./lib-BxQXEXDF.js";var l=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function u(e){return d(e)}function d(e){return Array.isArray(e)?f(e):e instanceof RegExp?e:typeof e==`object`?p(e):e}function f(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=d(e[n]);return t}function p(e){let t={};for(let n in e)t[n]=d(e[n]);return t}function m(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function h(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?h(e.substring(0,e.length-1)):e.substr(~t+1)}var g=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,_=class{static hasCaptures(e){return e===null?!1:(g.lastIndex=0,g.test(e))}static replaceCaptures(e,t,n){return e.replace(g,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function v(e,t){return e<t?-1:+(e>t)}function ee(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=v(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function te(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function ne(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var re=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},y=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(ce(e),t)}static createFromParsedTheme(e,t){return ue(e,t)}_cachedMatchRoot=new re(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ae(e.parent,t.parentScopes));return n?new se(n.fontStyle,n.foreground,n.background):null}},ie=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ae(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!oe(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function oe(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var se=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function ce(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&te(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&te(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new le(l,u,e,o,s,c)}}return n}var le=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},b=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(b||{});function ue(e,t){e.sort((e,t)=>{let n=v(e.scope,t.scope);return n!==0||(n=ee(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new de(t),o=new se(n,a.getId(r),a.getId(i)),s=new me(new pe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new y(a,o,s)}var de=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},fe=Object.freeze([]),pe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||fe,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},me=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),pe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(ee(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new pe(e,t,n,r,i))}},x=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=ge(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function he(e){return e}function ge(e){return e}function S(e,t){let n=[],r=ve(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(_e(i)){let e=[];do e.push(i),i=r.next();while(_e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function _e(e){return!!e&&!!e.match(/[\w\.:]+/)}function ve(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function ye(e){typeof e.dispose==`function`&&e.dispose()}var C=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},be=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},xe=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Se=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new C(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new xe;for(let n of e)Ce(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof C){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Ce(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof C?w({baseGrammar:a,selfGrammar:i},r):we(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new C(e))}function we(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Te([r],t,n)}}function w(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Te(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Te(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Te(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?m({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Te(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=je(i);switch(a.kind){case 0:w({...t,selfGrammar:t.baseGrammar},n);break;case 1:w(t,n);break;case 2:we(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?we(a.ruleName,i,n):w(i,n)}else a.kind===4?n.add(new be(a.scopeName,a.ruleName)):n.add(new C(a.scopeName));break}}}var Ee=class{kind=0},De=class{kind=1},Oe=class{constructor(e){this.ruleName=e}kind=2},ke=class{constructor(e){this.scopeName=e}kind=3},Ae=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function je(e){if(e===`$base`)return new Ee;if(e===`$self`)return new De;let t=e.indexOf(`#`);return t===-1?new ke(e):t===0?new Oe(e.substring(1)):new Ae(e.substring(0,t),e.substring(t+1))}var Me=/\\(\d+)/,Ne=/\\(\d+)/g,Pe=-1,Fe=-2;function Ie(e){return e}function Le(e){return e}var T=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=_.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=_.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${h(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:_.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:_.replaceCaptures(this._contentName,e,t)}},Re=class extends T{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},ze=class extends T{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new E(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new D,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Be=class extends T{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new D,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ve=class extends T{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new E(i,this.id),this.beginCaptures=a,this._end=new E(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},He=class extends T{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new E(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new E(o,Fe),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new D,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},Ue=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Re(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new ze(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=m({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Be(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new He(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ve(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=je(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Be||e instanceof Ve||e instanceof He)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},E=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=Me.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Ne.lastIndex=0,this.source.replace(Ne,(e,t)=>ne(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},D=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new We(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new We(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},We=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
2
2
  `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ge=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ke=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Ge(e,8),this._embeddedLanguagesMatcher=new qe(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Ge(0,0);_getBasicScopeAttributes=new re(e=>new Ge(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},qe=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>ne(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Je=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ye(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Xe(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Je(i,!0);f()}return new Je(i,!1);function f(){let o=Ze(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Pe){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),O(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Ve){let r=o;O(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof He){let r=o;O(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(O(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Xe(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof He&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=tt(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Fe){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),O(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Ze(e,t,n,r,i,a){let o=Qe(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=$e(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Qe(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=et(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function $e(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=et(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function et(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function tt(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function O(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Ye(e,p,n&&d.start===0,d.start,f,i,!1,0),ye(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new nt(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var nt=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function rt(e,t,n,r,i,a,o,s){return new ot(e,t,n,r,i,a,o,s)}function it(e,t,n,r,i){let a=S(t,k),o=Ue.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function k(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(at(t[r],e))return n=r+1,!0;return!1})}function at(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var ot=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Ke(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=st(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=S(e,k);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)it(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&it(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Ie(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[Le(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=st(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Ue.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===ct.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=x.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?A.createRootAndLookUpScopeName(a,r,this):A.createRoot(`unknown`,r),t=new ct(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
3
3
  `;let a=this.createOnigString(e),o=a.content.length,s=new ut(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Ye(this,a,i,0,t,s,!0,r);return ye(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function st(e,t){return e=u(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var A=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=ie.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new ie(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new ie(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),x.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},ct=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?A.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Le(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=A.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Ie(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,A.fromExtension(r,n.contentNameScopesList))}},lt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):S(e,k).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>S(e,k).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},ut=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=x.set(n,0,he(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=x.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},dt=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,rt(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},ft=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new dt(y.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(y.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new lt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Se(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},pt=ct.NULL;function j(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function M(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function mt(e){return Array.isArray(e)?e:[e]}async function ht(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function N(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function gt(e){return e===`ansi`||N(e)}function P(e){return e===`none`}function _t(e){return P(e)}var vt=/(\r?\n)/g;function F(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(vt),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var yt={light:`#333333`,dark:`#bbbbbb`},bt={light:`#fffffe`,dark:`#1e1e1e`},xt=`__shiki_resolved`;function I(e){if(e?.[xt])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?yt.light:yt.dark,n||=t.type===`light`?bt.light:bt.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,xt,{enumerable:!1,writable:!1,value:!0}),t}async function St(e){return[...new Set((await Promise.all(e.filter(e=>!gt(e)).map(async e=>await ht(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Ct(e){return(await Promise.all(e.map(async e=>_t(e)?null:I(await ht(e))))).filter(e=>!!e)}function wt(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new l(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Tt=class extends ft{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=I(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=y.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=wt(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new l(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},Et=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},L=0;function R(e){L+=1,e.warnings!==!1&&L>=10&&L%10==0&&console.warn(`[Shiki] ${L} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new l("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(I),i=new Tt(new Et(e.engine,n),r,n,e.langAlias),a;function o(t){return wt(t,e.langAlias)}function s(e){_();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new l(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};_();let t=i.getTheme(e);if(!t)throw new l(`Theme \`${e}\` not found, you may need to load it first`);return t}function u(e){_();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function d(){return _(),i.getLoadedThemes()}function f(){return _(),i.getLoadedLanguages()}function p(...e){_(),i.loadLanguages(e.flat(1))}async function m(...e){return p(await St(e))}function h(...e){_();for(let t of e.flat(1))i.loadTheme(t)}async function g(...e){return _(),h(await Ct(e))}function _(){if(t)throw new l(`Shiki instance has been disposed`)}function v(){t||(t=!0,i.dispose(),--L)}return{setTheme:u,getTheme:c,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:f,resolveLangAlias:o,loadLanguage:m,loadLanguageSync:p,loadTheme:g,loadThemeSync:h,dispose:v,[Symbol.dispose]:v}}var Dt=R;async function Ot(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Ct(e.themes||[]),St(e.langs||[]),e.engine]);return R({...e,themes:t,langs:n,engine:r})}var kt=Ot,At=new WeakMap;function z(e,t){At.set(e,t)}function B(e){return At.get(e)}var V=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(mt(n).map(e=>[e,pt])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return jt(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function jt(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function Mt(e,t){if(!(e instanceof V))throw new l(`Invalid grammar state`);return e.getInternalStack(t)}var Nt=/,/,Pt=/ /;function Ft(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(N(e.resolveLangAlias(n.lang||`text`))||P(r))return F(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new l(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new l(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Lt(t,o,i,a,n)}function It(...e){if(e.length===2)return B(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(N(i)||P(a))throw new l(`Plain language does not have grammar state`);if(i===`ansi`)throw new l(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new V(Rt(n,c,o,s,r).stateStack,c.name,o.name)}function Lt(e,t,n,r,i){let a=Rt(e,t,n,r,i),o=new V(a.stateStack,t.name,n.name);return z(a.tokens,o),a.tokens}function Rt(e,t,n,r,i){let a=j(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=F(e),u=i.grammarState?Mt(i.grammarState,n.name)??pt:i.grammarContextCode==null?pt:Rt(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=M(r[x.getForeground(s)],a),u=x.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=x.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Nt).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Pt))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?zt(t.scopes):Bt(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function zt(e){return e.map(e=>({scopeName:e}))}function Bt(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Ut(e,i,t.slice(0,r))}}return n}function Vt(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Ht(e,t,n){if(!Vt(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Vt(e[r],n[i])&&--r,--i;return r===-1}function Ut(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Ht(e,t,n)){r.push(a);break}return r}function H(e,t,n,r=Ft){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:B(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Wt(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new V(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&z(s,c),s}function Wt(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var Gt=/["&'<>`]/g,Kt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,qt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Jt=/[|\\{}()[\]^$+*?.]/g,Yt=new WeakMap;function Xt(e,t){if(e=e.replace(t.subset?Zt(t.subset):Gt,r),t.subset||t.escapeOnly)return e;return e.replace(Kt,n).replace(qt,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Zt(e){let t=Yt.get(e);return t||(t=Qt(e),Yt.set(e,t)),t}function Qt(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Jt,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var $t=/[\dA-Fa-f]/;function en(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!$t.test(String.fromCharCode(t))?r:r+`;`}var tn=/\d/;function nn(e,t,n){let r=`&#`+String(e);return n&&t&&!tn.test(String.fromCharCode(t))?r:r+`;`}var rn=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),an={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},on=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],sn={}.hasOwnProperty,cn={},U;for(U in an)sn.call(an,U)&&(cn[an[U]]=U);var ln=/[^\dA-Za-z]/;function un(e,t,n,r){let i=String.fromCharCode(e);if(sn.call(cn,i)){let e=cn[i],a=`&`+e;return n&&rn.includes(e)&&!on.includes(e)&&(!r||t&&t!==61&&ln.test(String.fromCharCode(t)))?a:a+`;`}return``}function dn(e,t,n){let r=en(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=un(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=nn(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function W(e,t){return Xt(e,Object.assign({format:dn},t))}var fn=/^>|^->|<!--|-->|--!>|<!-$/g,pn=[`>`],mn=[`<`,`>`];function hn(e,t,n,r){return r.settings.bogusComments?`<?`+W(e.value,Object.assign({},r.settings.characterReferences,{subset:pn}))+`>`:`<!--`+e.value.replace(fn,i)+`-->`;function i(e){return W(e,Object.assign({},r.settings.characterReferences,{subset:mn}))}}function gn(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var G=yn(1),_n=yn(-1),vn=[];function yn(e){return t;function t(t,n,r){let i=t?t.children:vn,a=(n||0)+e,o=i[a];if(!r)for(;o&&s(o);)a+=e,o=i[a];return o}}var bn={}.hasOwnProperty;function xn(e){return t;function t(t,n,r){return bn.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Sn=xn({body:Tn,caption:Cn,colgroup:Cn,dd:kn,dt:On,head:Cn,html:wn,li:Dn,optgroup:jn,option:Mn,p:En,rp:An,rt:An,tbody:Pn,td:Ln,tfoot:Fn,th:Ln,thead:Nn,tr:In});function Cn(e,t,n){let r=G(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&s(r.value.charAt(0)))}function wn(e,t,n){let r=G(n,t);return!r||r.type!==`comment`}function Tn(e,t,n){let r=G(n,t);return!r||r.type!==`comment`}function En(e,t,n){let r=G(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function Dn(e,t,n){let r=G(n,t);return!r||r.type===`element`&&r.tagName===`li`}function On(e,t,n){let r=G(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function kn(e,t,n){let r=G(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function An(e,t,n){let r=G(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function jn(e,t,n){let r=G(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Mn(e,t,n){let r=G(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Nn(e,t,n){let r=G(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Pn(e,t,n){let r=G(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Fn(e,t,n){return!G(n,t)}function In(e,t,n){let r=G(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Ln(e,t,n){let r=G(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Rn=xn({body:Vn,colgroup:Hn,head:Bn,html:zn,tbody:Un});function zn(e){let t=G(e,-1);return!t||t.type!==`comment`}function Bn(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function Vn(e){let t=G(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&s(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Hn(e,t,n){let r=_n(n,t),i=G(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Sn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Un(e,t,n){let r=_n(n,t),i=G(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Sn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var K={name:[[`
4
4
  \f\r &/=>`.split(``),`
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CG8ek6tC.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-DsLuRXwV.js","assets/bundle-mjs-BT31bpU6.js","assets/chevron-right-G4caF2QV.js","assets/diff-stat-Dyfg3ltF.js","assets/highlighter-CdHqIwFr.js","assets/lib-BQXq3kEf.js","assets/image-preview-BWGk5fPX.js","assets/zoomable-image-7WyUiaVD.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DsLuRXwV.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{t as a}from"./diff-stat-Dyfg3ltF.js";import{n as o,t as s}from"./image-preview-BWGk5fPX.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-CG8ek6tC.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
+ `).map((e,t)=>(0,l.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DsLuRXwV.js";var n=e();function r({stat:e,className:r}){let i=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,a=e.repointed?`${i} — uncommitted changes only, measured with another branch checked out in this task's worktree`:void 0;return(0,n.jsxs)(`span`,{"data-slot":`diff-stat`,...a?{"data-repointed":`true`,"aria-label":a}:{},title:a??i,className:t(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,r),children:[(0,n.jsxs)(`span`,{className:`text-success`,children:[`+`,e.adds]}),` `,(0,n.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.dels]})]})}export{r as t};
@@ -1,6 +1,6 @@
1
- import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{t as r}from"./utils-B8s5qIcK.js";import{C as i,S as a,an as o,rt as s,w as c}from"./index-Cijmlz7q.js";import{t as l}from"./lib-DPEZDBUN.js";import{n as u,t as d}from"./image-preview-DEhW0TFz.js";var f=n(t(),1),p=44;function m(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DsLuRXwV.js";import{t as i}from"./chevron-right-G4caF2QV.js";import{t as a}from"./diff-stat-Dyfg3ltF.js";import{a as o,i as s,r as c}from"./highlighter-CdHqIwFr.js";import{t as l}from"./lib-BQXq3kEf.js";import{n as u,t as d}from"./image-preview-BWGk5fPX.js";var f=e(t(),1),p=44;function m(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function h(e){return m(e)*20+p}function g(e){return e.reduce((e,t)=>e+m(t),0)}function _(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function v(e){return`${e.oldPath??``}→${e.path}`}function y(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var b=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,x=300,S=.3;function C(e,t){if(e===t)return null;let n=e.match(b)??[],r=t.match(b)??[];if(n.length===0||r.length===0||n.length>x||r.length>x)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<S)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:w(n,o),add:w(r,s)}}function w(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function T(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var E=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,D=`… (patch truncated)`;function O(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
- `);o.at(-1)===``&&o.pop();for(let e of o){let o=E.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(D)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function k(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function A(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function M(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(j(t,i))}else t(i),r++}}function N(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function P(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var F=e(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:a,onOpenInApp:o,viewRef:c,className:l}){let u=(0,f.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[d,p]=(0,f.useState)(()=>new Set),[m,y]=(0,f.useState)(()=>new Map),b=(0,f.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),x=(0,f.useCallback)(async(e,t)=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=A(t,n.split(`
5
- `));y(n=>{let i=v(e);return new Map(n).set(i,new Map(n.get(i)??L).set(t.beforeHunk,r))})},[i]),S=(0,f.useMemo)(()=>g(e),[e]),[C]=(0,f.useState)(()=>typeof window>`u`?``:window.location.search),w=_(C,S),T=(0,f.useRef)(null),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useImperativeHandle)(c,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=E.current;r?r.scrollToIndex(n,{align:`start`}):R(D.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let O=e=>{let r=v(e);return(0,F.jsx)(H,{file:e,open:!d.has(r),onToggle:()=>b(r),expanded:m.get(r)??L,onExpand:t=>void x(e,t),mode:t,wrap:n,canExpand:i!==void 0,imageSrc:a,onOpenInApp:o})};return(0,F.jsxs)(`div`,{ref:e=>{D.current=e,e&&(T.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col`,l),children:[(0,F.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,F.jsx)(s,{stat:u})]}),w===`virtual`?(0,F.jsx)(B,{files:e,handleRef:E,scrollElRef:T,card:O}):(0,F.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${h(e)}px`},className:`pb-3 [content-visibility:auto]`,children:O(e)},v(e)))})]})}function B({files:e,handleRef:t,scrollElRef:n,card:r}){let i=(0,f.useRef)(null),[a,o]=(0,f.useState)(0);return(0,f.useLayoutEffect)(()=>{let e=()=>{let e=i.current,t=n.current;!e||!t||o(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,F.jsx)(`div`,{ref:e=>{i.current=e,e&&(n.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,F.jsx)(l,{ref:t,scrollRef:n,startMargin:a,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,className:`pb-3`,children:r(e)},v(e)))})})}var V={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function H({file:e,open:t,onToggle:n,expanded:i,onExpand:a,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}){let p=V[e.status];return(0,F.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,F.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 rounded-t-md border-b border-border/50 bg-card`,children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":t,onClick:n,className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,F.jsx)(o,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,F.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),p?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:p}):null,e.image?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,F.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,F.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]})}),t?(0,F.jsx)(U,{file:e,expanded:i,onExpand:a,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}):null]})}function U({file:e,expanded:t,onExpand:n,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c}){let l=(0,f.useMemo)(()=>O(e.patch),[e.patch]),p=o&&e.status!==`added`&&e.status!==`deleted`,m=(0,f.useMemo)(()=>k(l.hunks,p),[l.hunks,p]),h=(0,f.useMemo)(()=>{let e=[];l.hunks.forEach((n,r)=>{let i=t.get(r);i&&e.push(...i),e.push(...n.lines)});let n=t.get(l.hunks.length);return n&&e.push(...n),e},[l.hunks,t]),g=(0,f.useMemo)(()=>new Map(h.map((e,t)=>[e,t])),[h]),_=W(e.path,h),v=(0,f.useMemo)(()=>i===`unified`?N(l.hunks,m,t):null,[i,l.hunks,m,t]),b=(0,f.useMemo)(()=>i===`split`?P(l.hunks,m,t):null,[i,l.hunks,m,t]),x=(0,f.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${y(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(u(e))return(0,F.jsx)(d,{file:e,imageSrc:s,onOpenInApp:c});if(e.binary)return(0,F.jsx)(G,{children:`Binary file — no text diff.`});if(l.hunks.length===0)return(0,F.jsx)(G,{children:l.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let S=e=>{if(!_)return null;let t=g.get(e);return t===void 0?null:_[t]??null};return(0,F.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,F.jsxs)(`div`,{"data-slot":`diff-rows`,style:x,className:`[&>*]:[contain-intrinsic-block-size:auto_20px] [&>*]:[content-visibility:auto]`,children:[v?v.map((e,t)=>(0,F.jsx)(Q,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null,b?b.map((e,t)=>(0,F.jsx)(ee,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null]}),l.truncated?(0,F.jsx)(G,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function W(e,t){let n=(0,f.useMemo)(()=>t.length>I?null:t.map(e=>e.text).join(`
6
- `),[t]),r=(0,f.useMemo)(()=>c(e),[e]),[o,s]=(0,f.useState)(null);return(0,f.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return a(n,r).then(t=>{e||s({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:o?.text===n?o.tokens:i(n,r)?.tokens??null}function G({children:e}){return(0,F.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var K={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},q={add:`+`,del:`−`,context:` `};function J({hunk:e}){return(0,F.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function Y({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,F.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,F.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function X({cell:e,tokens:t,wrap:n}){let i=T(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,F.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,F.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function Z({value:e}){return(0,F.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function Q({row:e,wrap:t,tokensFor:n,onExpand:i}){if(e.type===`hunk`)return(0,F.jsx)(J,{hunk:e.hunk});if(e.type===`gap`)return(0,F.jsx)(Y,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,F.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:r(`flex`,K[a.kind]),children:[(0,F.jsx)(Z,{value:a.oldLine}),(0,F.jsx)(Z,{value:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e.cell,tokens:n(a),wrap:t})]})}function ee({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,F.jsx)(J,{hunk:e.hunk}):e.type===`gap`?(0,F.jsx)(Y,{gap:e.gap,onExpand:r}):(0,F.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,F.jsx)($,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,F.jsx)($,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function $({cell:e,side:t,tokensFor:n,wrap:i}){if(!e)return(0,F.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,t===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,F.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:r(`flex min-w-0`,K[a.kind],t===`new`&&`border-l border-border/40`),children:[(0,F.jsx)(Z,{value:t===`old`?a.oldLine:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e,tokens:n(a),wrap:i})]})}export{z as DiffView};
4
+ `);o.at(-1)===``&&o.pop();for(let e of o){let o=E.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(D)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function k(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function A(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function M(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(j(t,i))}else t(i),r++}}function N(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function P(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var F=n(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:o,onOpenInApp:s,viewRef:c,className:l}){let u=(0,f.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[d,p]=(0,f.useState)(()=>new Set),[m,y]=(0,f.useState)(()=>new Map),b=(0,f.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),x=(0,f.useCallback)(async(e,t)=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=A(t,n.split(`
5
+ `));y(n=>{let i=v(e);return new Map(n).set(i,new Map(n.get(i)??L).set(t.beforeHunk,r))})},[i]),S=(0,f.useMemo)(()=>g(e),[e]),[C]=(0,f.useState)(()=>typeof window>`u`?``:window.location.search),w=_(C,S),T=(0,f.useRef)(null),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useImperativeHandle)(c,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=E.current;r?r.scrollToIndex(n,{align:`start`}):R(D.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let O=e=>{let r=v(e);return(0,F.jsx)(H,{file:e,open:!d.has(r),onToggle:()=>b(r),expanded:m.get(r)??L,onExpand:t=>void x(e,t),mode:t,wrap:n,canExpand:i!==void 0,imageSrc:o,onOpenInApp:s})};return(0,F.jsxs)(`div`,{ref:e=>{D.current=e,e&&(T.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col`,l),children:[(0,F.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,F.jsx)(a,{stat:u})]}),w===`virtual`?(0,F.jsx)(B,{files:e,handleRef:E,scrollElRef:T,card:O}):(0,F.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${h(e)}px`},className:`pb-3 [content-visibility:auto]`,children:O(e)},v(e)))})]})}function B({files:e,handleRef:t,scrollElRef:n,card:r}){let i=(0,f.useRef)(null),[a,o]=(0,f.useState)(0);return(0,f.useLayoutEffect)(()=>{let e=()=>{let e=i.current,t=n.current;!e||!t||o(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,F.jsx)(`div`,{ref:e=>{i.current=e,e&&(n.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,F.jsx)(l,{ref:t,scrollRef:n,startMargin:a,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,className:`pb-3`,children:r(e)},v(e)))})})}var V={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function H({file:e,open:t,onToggle:n,expanded:o,onExpand:s,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}){let p=V[e.status];return(0,F.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,F.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 rounded-t-md border-b border-border/50 bg-card`,children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":t,onClick:n,className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,F.jsx)(i,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,F.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),p?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:p}):null,e.image?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,F.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,F.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]})}),t?(0,F.jsx)(U,{file:e,expanded:o,onExpand:s,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}):null]})}function U({file:e,expanded:t,onExpand:n,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c}){let l=(0,f.useMemo)(()=>O(e.patch),[e.patch]),p=o&&e.status!==`added`&&e.status!==`deleted`,m=(0,f.useMemo)(()=>k(l.hunks,p),[l.hunks,p]),h=(0,f.useMemo)(()=>{let e=[];l.hunks.forEach((n,r)=>{let i=t.get(r);i&&e.push(...i),e.push(...n.lines)});let n=t.get(l.hunks.length);return n&&e.push(...n),e},[l.hunks,t]),g=(0,f.useMemo)(()=>new Map(h.map((e,t)=>[e,t])),[h]),_=W(e.path,h),v=(0,f.useMemo)(()=>i===`unified`?N(l.hunks,m,t):null,[i,l.hunks,m,t]),b=(0,f.useMemo)(()=>i===`split`?P(l.hunks,m,t):null,[i,l.hunks,m,t]),x=(0,f.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${y(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(u(e))return(0,F.jsx)(d,{file:e,imageSrc:s,onOpenInApp:c});if(e.binary)return(0,F.jsx)(G,{children:`Binary file — no text diff.`});if(l.hunks.length===0)return(0,F.jsx)(G,{children:l.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let S=e=>{if(!_)return null;let t=g.get(e);return t===void 0?null:_[t]??null};return(0,F.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,F.jsxs)(`div`,{"data-slot":`diff-rows`,style:x,className:`[&>*]:[contain-intrinsic-block-size:auto_20px] [&>*]:[content-visibility:auto]`,children:[v?v.map((e,t)=>(0,F.jsx)(Q,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null,b?b.map((e,t)=>(0,F.jsx)(ee,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null]}),l.truncated?(0,F.jsx)(G,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function W(e,t){let n=(0,f.useMemo)(()=>t.length>I?null:t.map(e=>e.text).join(`
6
+ `),[t]),r=(0,f.useMemo)(()=>o(e),[e]),[i,a]=(0,f.useState)(null);return(0,f.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return c(n,r).then(t=>{e||a({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:i?.text===n?i.tokens:s(n,r)?.tokens??null}function G({children:e}){return(0,F.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var K={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},q={add:`+`,del:`−`,context:` `};function J({hunk:e}){return(0,F.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function Y({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,F.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,F.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function X({cell:e,tokens:t,wrap:n}){let i=T(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,F.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,F.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function Z({value:e}){return(0,F.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function Q({row:e,wrap:t,tokensFor:n,onExpand:i}){if(e.type===`hunk`)return(0,F.jsx)(J,{hunk:e.hunk});if(e.type===`gap`)return(0,F.jsx)(Y,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,F.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:r(`flex`,K[a.kind]),children:[(0,F.jsx)(Z,{value:a.oldLine}),(0,F.jsx)(Z,{value:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e.cell,tokens:n(a),wrap:t})]})}function ee({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,F.jsx)(J,{hunk:e.hunk}):e.type===`gap`?(0,F.jsx)(Y,{gap:e.gap,onExpand:r}):(0,F.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,F.jsx)($,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,F.jsx)($,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function $({cell:e,side:t,tokensFor:n,wrap:i}){if(!e)return(0,F.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,t===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,F.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:r(`flex min-w-0 overflow-x-auto`,K[a.kind],t===`new`&&`border-l border-border/40`),children:[(0,F.jsx)(Z,{value:t===`old`?a.oldLine:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e,tokens:n(a),wrap:i})]})}export{z as DiffView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{E as i,S as a,_ as o,b as s,c,d as l,f as u,g as d,h as f,l as p,m,s as h,u as g,v as _,w as v,x as y,y as b}from"./centered-state-ZtnFHA-n.js";import{r as x,t as S}from"./utils-DsLuRXwV.js";var C=x(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),w=e(t(),1),T=r();function E(e){let t=e+`CollectionProvider`,[n,r]=s(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=w.useRef(null),i=w.useRef(new Map).current;return(0,T.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=t;let l=e+`CollectionSlot`,u=v(l),d=w.forwardRef((e,t)=>{let{scope:n,children:r}=e,a=i(t,o(l,n).collectionRef);return(0,T.jsx)(u,{ref:a,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=v(f),h=w.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,s=w.useRef(null),c=i(t,s),l=o(f,n);return w.useEffect(()=>(l.itemMap.set(s,{ref:s,...a}),()=>void l.itemMap.delete(s))),(0,T.jsx)(m,{[p]:``,ref:c,children:r})});h.displayName=f;function g(t){let n=o(e+`CollectionConsumer`,t);return w.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:c,Slot:d,ItemSlot:h},g,r]}var D=w.createContext(void 0);function O(e){let t=w.useContext(D);return e||t||`ltr`}var k=e(n(),1);function A(e){let[t,n]=w.useState(void 0);return _(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var j=[`top`,`right`,`bottom`,`left`],M=Math.min,N=Math.max,P=Math.round,F=Math.floor,I=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return N(e,M(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function B(e){return e===`x`?`y`:`x`}function ne(e){return e===`y`?`height`:`width`}function V(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function re(e){return B(V(e))}function ie(e,t,n){n===void 0&&(n=!1);let r=z(e),i=re(e),a=ne(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pe(o)),[o,pe(o)]}function ae(e){let t=pe(e);return[oe(e),t,oe(t)]}function oe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var se=[`left`,`right`],ce=[`right`,`left`],le=[`top`,`bottom`],ue=[`bottom`,`top`];function de(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ce:se:t?se:ce;case`left`:case`right`:return t?le:ue;default:return[]}}function fe(e,t,n,r){let i=z(e),a=de(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oe)))),a}function pe(e){let t=R(e);return ee[t]+e.slice(t.length)}function me(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function he(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:me(e)}function ge(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _e(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=re(t),s=ne(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=z(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ve(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=he(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ge(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ge(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ye=50,be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ve},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_e(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ye&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=_e(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=he(u),f={x:n,y:r},p=re(i),m=ne(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=M(d[_],T),D=M(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=te(E,k,O),j=!c.arrow&&z(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,N=j?k<E?k-E:k-O:0;return{[p]:f[p]+N,data:{[p]:A,centerOffset:k-A-N,...j&&{alignmentOffset:N}},reset:j}}}),Se=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=V(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pe(o)]:ae(o)),x=p!==`none`;!d&&x&&b.push(...fe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ie(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==V(t))||T.every(e=>V(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=V(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function we(e){return j.some(t=>e[t]>=0)}var Te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=L(e,t);switch(i){case`referenceHidden`:{let e=Ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:we(e)}}}case`escaped`:{let e=Ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:we(e)}}}default:return{}}}}},Ee=new Set([`left`,`top`]);async function De(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=V(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Oe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await De(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=L(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(i),p=B(f),m=u[p],h=u[f],g=(e,t)=>te(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ae=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=L(e,t),u={x:n,y:r},d=V(i),f=B(d),p=u[f],m=u[d],h=L(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ee.has(R(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=L(e,t),c=await i.detectOverflow(t,s),l=R(n),u=z(n),d=V(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=M(p-c[m],g),y=M(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*N(c.left,c.right):S=p-2*N(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Me(){return typeof window<`u`}function Ne(e){return Pe(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return Me()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return Me()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function Ie(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Le(e){return/^(table|td|th)$/.test(Ne(e))}function Re(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ze=/transform|translate|scale|rotate|perspective|filter/,Be=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,Ve;function He(e){let t=W(e)?q(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!We()&&(K(t.backdropFilter)||K(t.filter))||ze.test(t.willChange||``)||Be.test(t.contain||``)}function Ue(e){let t=J(e);for(;G(t)&&!Ge(t);){if(He(t))return t;if(Re(t))return null;t=J(t)}return null}function We(){return Ve??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ve}function Ge(e){return/^(html|body|#document)$/.test(Ne(e))}function q(e){return H(e).getComputedStyle(e)}function Ke(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||U(e);return Fe(t)?t.host:t}function qe(e){let t=J(e);return Ge(t)?(e.ownerDocument||e).body:G(t)&&Ie(t)?t:qe(t)}function Je(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=qe(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ye(a);return t.concat(a,a.visualViewport||[],Ie(r)?r:[],e&&n?Je(e):[])}else return t.concat(r,Je(r,[],n))}function Ye(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xe(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=P(n)!==a||P(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ze(e){return W(e)?e:e.contextElement}function Qe(e){let t=Ze(e);if(!G(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xe(t),o=(a?P(n.width):n.width)/r,s=(a?P(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $e=I(0);function et(e){let t=H(e);return!We()||!t.visualViewport?$e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ze(e),o=I(1);t&&(r?W(r)&&(o=Qe(r)):o=Qe(e));let s=tt(a,n,r)?et(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=Ye(n);for(;i&&t!==n;){let e=Qe(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=Ye(n)}}return ge({width:u,height:d,x:c,y:l})}function nt(e,t){let n=Ke(e).scrollLeft;return t?t.left+n:Y(U(e)).left+n}function rt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nt(e,n),y:n.top+t.scrollTop}}function it(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Re(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=G(r);if((d||!a)&&((Ne(r)!==`body`||Ie(o))&&(c=Ke(r)),d)){let e=Y(r);l=Qe(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?rt(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function at(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ot(e){let t=Ke(e),n=e.ownerDocument.body,r=N(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=N(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+nt(e),o=-t.scrollTop;return q(n).direction===`rtl`&&(a+=N(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var st=25;function ct(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!We()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(nt(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=st&&(s-=o)}return{width:s,height:c,x:l,y:u}}function lt(e,t){let n=Y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Qe(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ut(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ct(e,n,t);else if(t===`document`)r=ot(U(e));else if(W(t))r=lt(t,n);else{let n=et(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ge(r)}function dt(e,t){let n=t.get(e);if(n)return n;let r=Je(e,[],!1).filter(e=>W(e)&&Ne(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;W(o)&&!Ge(o);){let e=q(o),t=He(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=J(o)}return t.set(e,r),r}function ft(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Re(t)?[]:dt(t,this._c):[].concat(n),r],o=ut(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ut(t,a[e],i);s=N(n.top,s),c=M(n.right,c),l=M(n.bottom,l),u=N(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function pt(e){let{width:t,height:n}=Xe(e);return{width:t,height:n}}function mt(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);if((r||!a)&&((Ne(t)!==`body`||Ie(i))&&(s=Ke(t)),r)){let e=Y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=nt(i));let l=i&&!r&&!a?rt(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function ht(e){return q(e).position===`static`}function gt(e,t){if(!G(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function _t(e,t){let n=H(e);if(Re(e))return n;if(!G(e)){let t=J(e);for(;t&&!Ge(t);){if(W(t)&&!ht(t))return t;t=J(t)}return n}let r=gt(e,t);for(;r&&Le(r)&&ht(r);)r=gt(r,t);return r&&Ge(r)&&ht(r)&&!He(r)?n:r||Ue(e)||n}var vt=async function(e){let t=this.getOffsetParent||_t,n=this.getDimensions,r=await n(e.floating);return{reference:mt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yt(e){return q(e).direction===`rtl`}var bt={convertOffsetParentRelativeRectToViewportRelativeRect:it,getDocumentElement:U,getClippingRect:ft,getOffsetParent:_t,getElementRects:vt,getClientRects:at,getDimensions:pt,getScale:Qe,isElement:W,isRTL:yt};function xt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function St(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=F(d),h=F(a.clientWidth-(u+f)),g=F(a.clientHeight-(d+p)),_=F(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:N(0,M(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!xt(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ct(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ze(e),u=i||a?[...l?Je(l):[],...t?Je(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?St(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Y(e):null;c&&g();function g(){let t=Y(e);h&&!xt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var wt=Oe,Tt=ke,Et=Se,Dt=je,Ot=Te,kt=xe,At=Ae,jt=(e,t,n)=>{let r=new Map,i=n??{},a={...bt,...i.platform,_c:r};return be(e,t,{...i,platform:a})},Mt=typeof document<`u`?w.useLayoutEffect:function(){};function Nt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Nt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Nt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Pt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ft(e,t){let n=Pt(e);return Math.round(t*n)/n}function It(e){let t=w.useRef(e);return Mt(()=>{t.current=e}),t}function Lt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=w.useState(r);Nt(f,r)||p(r);let[m,h]=w.useState(null),[g,_]=w.useState(null),v=w.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=w.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=w.useRef(null),C=w.useRef(null),T=w.useRef(u),E=c!=null,D=It(c),O=It(i),A=It(l),j=w.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),jt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Nt(T.current,t)&&(T.current=t,k.flushSync(()=>{d(t)}))})},[f,t,n,O,A]);Mt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=w.useRef(!1);Mt(()=>(M.current=!0,()=>{M.current=!1}),[]),Mt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,j);j()}},[b,x,j,D,E]);let N=w.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),P=w.useMemo(()=>({reference:b,floating:x}),[b,x]),F=w.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Ft(P.floating,u.x),r=Ft(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Pt(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Rt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:kt({element:r.current,padding:i}).fn(n):r?kt({element:r,padding:i}).fn(n):{}}}},zt=(e,t)=>{let n=wt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vt=(e,t)=>({fn:At(e).fn,options:[e,t]}),Ht=(e,t)=>{let n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ut=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wt=(e,t)=>{let n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=Rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=`Arrow`,qt=w.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,T.jsx)(y.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,T.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});qt.displayName=Kt;var Jt=qt,Yt=`Popper`,[Xt,Zt]=s(Yt),[Qt,$t]=Xt(Yt),en=e=>{let{__scopePopper:t,children:n}=e,[r,i]=w.useState(null),[a,o]=w.useState(void 0);return(0,T.jsx)(Qt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};en.displayName=Yt;var tn=`PopperAnchor`,nn=w.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=$t(tn,n),s=w.useRef(null),c=o.onAnchorChange,l=i(t,w.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=w.useRef(null);w.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&c(u.current)});let d=o.placementState&&pn(o.placementState),f=d?.[0],p=d?.[1];return r?null:(0,T.jsx)(y.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});nn.displayName=tn;var rn=`PopperContent`,[an,on]=Xt(rn),sn=w.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,...v}=e,b=$t(rn,n),[x,S]=w.useState(null),C=i(t,S),[E,D]=w.useState(null),O=A(E),k=O?.width??0,j=O?.height??0,M=r+(o===`center`?``:`-`+o),N=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],F=P.length>0,I={padding:N,boundary:P.filter(dn),altBoundary:F},{refs:ee,floatingStyles:te,placement:L,isPositioned:R,middlewareData:z}=Lt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>Ct(...e,{animationFrame:h===`always`}),elements:{reference:b.anchor},middleware:[zt({mainAxis:a+j,alignmentAxis:s}),l&&Bt({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Vt():void 0,...I}),l&&Ht({...I}),Ut({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),E&&Gt({element:E,padding:c}),fn({arrowWidth:k,arrowHeight:j}),p&&Wt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),B=b.setPlacementState;_(()=>(B(L),()=>{B(void 0)}),[L,B]);let[ne,V]=pn(L),re=m(g);_(()=>{R&&re?.()},[R,re]);let ie=z.arrow?.x,ae=z.arrow?.y,oe=z.arrow?.centerOffset!==0,[se,ce]=w.useState();return _(()=>{x&&ce(window.getComputedStyle(x).zIndex)},[x]),(0,T.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:R?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,T.jsx)(an,{scope:n,placedSide:ne,placedAlign:V,onArrowChange:D,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,T.jsx)(y.div,{"data-side":ne,"data-align":V,...v,ref:C,style:{...v.style,animation:R?void 0:`none`}})})})});sn.displayName=rn;var cn=`PopperArrow`,ln={top:`bottom`,right:`left`,bottom:`top`,left:`right`},un=w.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=on(cn,n),a=ln[i.placedSide];return(0,T.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,T.jsx)(Jt,{...r,ref:t,style:{...r.style,display:`block`}})})});un.displayName=cn;function dn(e){return e!==null}var fn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=pn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function pn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var mn=en,hn=nn,gn=sn,_n=un,vn=!1;function yn(){let[e,t]=w.useState(vn);return w.useEffect(()=>{vn||(vn=!0,t(!0))},[]),e}var bn=w.useSyncExternalStore;function xn(){return()=>{}}function Sn(){return bn(xn,()=>!0,()=>!1)}var Cn=typeof bn==`function`?Sn:yn,wn=`rovingFocusGroup.onEntryFocus`,Tn={bubbles:!1,cancelable:!0},En=`RovingFocusGroup`,[Dn,On,kn]=E(En),[An,jn]=s(En,[kn]),[Mn,Nn]=An(En),Pn=w.forwardRef((e,t)=>(0,T.jsx)(Dn.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,T.jsx)(Dn.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,T.jsx)(Fn,{...e,ref:t})})}));Pn.displayName=En;var Fn=w.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,h=w.useRef(null),g=i(t,h),_=O(s),[v,x]=o({prop:c,defaultProp:l??null,onChange:u,caller:En}),[S,C]=w.useState(!1),E=m(d),D=On(n),k=w.useRef(!1),[A,j]=w.useState(0);return w.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(wn,E),()=>e.removeEventListener(wn,E)},[E]),(0,T.jsx)(Mn,{scope:n,orientation:r,dir:_,loop:a,currentTabStopId:v,onItemFocus:w.useCallback(e=>x(e),[x]),onItemShiftTab:w.useCallback(()=>C(!0),[]),onFocusableItemAdd:w.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:w.useCallback(()=>j(e=>e-1),[]),children:(0,T.jsx)(y.div,{tabIndex:S||A===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:`none`,...e.style},onMouseDown:b(e.onMouseDown,()=>{k.current=!0}),onFocus:b(e.onFocus,e=>{let t=!k.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(wn,Tn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=D().filter(e=>e.focusable);Vn([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:b(e.onBlur,()=>C(!1))})})}),In=`RovingFocusGroupItem`,Ln=w.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=f(),l=a||c,u=Nn(In,n),d=u.currentTabStopId===l,p=On(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u,v=Cn();return _(()=>{if(!(!v||!r))return m(),()=>h()},[v,r,m,h]),w.useEffect(()=>{if(!(v||!r))return m(),()=>h()},[v,r,m,h]),(0,T.jsx)(Dn.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,T.jsx)(y.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:b(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:b(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:b(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Bn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Hn(n,r+1):n.slice(r+1)}setTimeout(()=>Vn(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Ln.displayName=In;var Rn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function zn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Bn(e,t,n){let r=zn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Rn[r]}function Vn(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Hn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Un=Pn,Wn=Ln,Gn=[`Enter`,` `],Kn=[`ArrowDown`,`PageUp`,`Home`],qn=[`ArrowUp`,`PageDown`,`End`],Jn=[...Kn,...qn],Yn={ltr:[...Gn,`ArrowRight`],rtl:[...Gn,`ArrowLeft`]},Xn={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Zn=`Menu`,[Qn,$n,er]=E(Zn),[X,tr]=s(Zn,[er,Zt,jn]),nr=Zt(),rr=jn(),[ir,Z]=X(Zn),[ar,or]=X(Zn),sr=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nr(t),[c,l]=w.useState(null),u=w.useRef(!1),d=m(a),f=O(i);return w.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),w.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,T.jsx)(mn,{...s,children:(0,T.jsx)(ir,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,T.jsx)(ar,{scope:t,onClose:w.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};sr.displayName=Zn;var cr=`MenuAnchor`,lr=w.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nr(n);return(0,T.jsx)(hn,{...i,...r,ref:t})});lr.displayName=cr;var ur=`MenuPortal`,[dr,fr]=X(ur,{forceMount:void 0}),pr=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Z(ur,t);return(0,T.jsx)(dr,{scope:t,forceMount:n,children:(0,T.jsx)(d,{present:n||a.open,children:(0,T.jsx)(g,{asChild:!0,container:i,children:r})})})};pr.displayName=ur;var Q=`MenuContent`,[mr,hr]=X(Q),gr=w.forwardRef((e,t)=>{let n=fr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeMenu),o=or(Q,e.__scopeMenu);return(0,T.jsx)(Qn.Provider,{scope:e.__scopeMenu,children:(0,T.jsx)(d,{present:r||a.open,children:(0,T.jsx)(Qn.Slot,{scope:e.__scopeMenu,children:o.modal?(0,T.jsx)(_r,{...i,ref:t}):(0,T.jsx)(vr,{...i,ref:t})})})})}),_r=w.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu),r=w.useRef(null),a=i(t,r);return w.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,T.jsx)(br,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vr=w.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu);return(0,T.jsx)(br,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yr=v(`MenuContent.ScrollLock`),br=w.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,disableOutsideScroll:y,...x}=e,S=Z(Q,n),C=or(Q,n),E=nr(n),D=rr(n),O=$n(n),[k,A]=w.useState(null),j=w.useRef(null),M=i(t,j,S.onContentChange),N=w.useRef(0),P=w.useRef(``),F=w.useRef(0),I=w.useRef(null),ee=w.useRef(`right`),te=w.useRef(0),L=y?c:w.Fragment,R=y?{as:yr,allowPinchZoom:!0}:void 0,z=e=>{let t=P.current+e,n=O().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ii(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};w.useEffect(()=>()=>window.clearTimeout(N.current),[]),p();let B=w.useCallback(e=>ee.current===I.current?.side&&oi(e,I.current?.area),[]);return(0,T.jsx)(mr,{scope:n,searchRef:P,onItemEnter:w.useCallback(e=>{B(e)&&e.preventDefault()},[B]),onItemLeave:w.useCallback(e=>{B(e)||(j.current?.focus(),A(null))},[B]),onTriggerLeave:w.useCallback(e=>{B(e)&&e.preventDefault()},[B]),pointerGraceTimerRef:F,onPointerGraceIntentChange:w.useCallback(e=>{I.current=e},[]),children:(0,T.jsx)(L,{...R,children:(0,T.jsx)(l,{asChild:!0,trapped:a,onMountAutoFocus:b(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,T.jsx)(u,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,children:(0,T.jsx)(Un,{asChild:!0,...D,dir:C.dir,orientation:`vertical`,loop:r,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:b(f,e=>{C.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,T.jsx)(gn,{role:`menu`,"aria-orientation":`vertical`,"data-state":$r(S.open),"data-radix-menu-content":``,dir:C.dir,...E,...x,ref:M,style:{outline:`none`,...x.style},onKeyDown:b(x.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&z(e.key));let i=j.current;if(e.target!==i||!Jn.includes(e.key))return;e.preventDefault();let a=O().filter(e=>!e.disabled).map(e=>e.ref.current);qn.includes(e.key)&&a.reverse(),ni(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:b(e.onPointerMove,si(e=>{let t=e.target,n=te.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>te.current?`right`:`left`;ee.current=t,te.current=e.clientX}}))})})})})})})});gr.displayName=Q;var xr=`MenuGroup`,Sr=w.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,T.jsx)(y.div,{role:`group`,...r,ref:t})});Sr.displayName=xr;var Cr=`MenuLabel`,wr=w.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,T.jsx)(y.div,{...r,ref:t})});wr.displayName=Cr;var Tr=`MenuItem`,Er=`menu.itemSelect`,Dr=w.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...o}=e,s=w.useRef(null),c=or(Tr,e.__scopeMenu),l=hr(Tr,e.__scopeMenu),u=i(t,s),d=w.useRef(!1),f=()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(Er,{bubbles:!0,cancelable:!0});e.addEventListener(Er,e=>r?.(e),{once:!0}),a(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,T.jsx)(Or,{...o,ref:u,disabled:n,onClick:b(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:b(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{n||e.target!==e.currentTarget||l.searchRef.current!==``&&e.key===` `||Gn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Dr.displayName=Tr;var Or=w.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,s=hr(Tr,n),c=rr(n),l=w.useRef(null),u=i(t,l),[d,f]=w.useState(!1),[p,m]=w.useState(``);return w.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,T.jsx)(Qn.ItemSlot,{scope:n,disabled:r,textValue:a??p,children:(0,T.jsx)(Wn,{asChild:!0,...c,focusable:!r,children:(0,T.jsx)(y.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:u,onPointerMove:b(e.onPointerMove,si(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,si(e=>s.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),kr=`MenuCheckboxItem`,Ar=w.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,T.jsx)(Rr,{scope:e.__scopeMenu,checked:n,children:(0,T.jsx)(Dr,{role:`menuitemcheckbox`,"aria-checked":ei(n)?`mixed`:n,...i,ref:t,"data-state":ti(n),onSelect:b(i.onSelect,()=>r?.(ei(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ar.displayName=kr;var jr=`MenuRadioGroup`,[Mr,Nr]=X(jr,{value:void 0,onValueChange:()=>{}}),Pr=w.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=m(r);return(0,T.jsx)(Mr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,T.jsx)(Sr,{...i,ref:t})})});Pr.displayName=jr;var Fr=`MenuRadioItem`,Ir=w.forwardRef((e,t)=>{let{value:n,...r}=e,i=Nr(Fr,e.__scopeMenu),a=n===i.value;return(0,T.jsx)(Rr,{scope:e.__scopeMenu,checked:a,children:(0,T.jsx)(Dr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ti(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ir.displayName=Fr;var Lr=`MenuItemIndicator`,[Rr,zr]=X(Lr,{checked:!1}),Br=w.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=zr(Lr,n);return(0,T.jsx)(d,{present:r||ei(a.checked)||a.checked===!0,children:(0,T.jsx)(y.span,{...i,ref:t,"data-state":ti(a.checked)})})});Br.displayName=Lr;var Vr=`MenuSeparator`,Hr=w.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,T.jsx)(y.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Hr.displayName=Vr;var Ur=`MenuArrow`,Wr=w.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nr(n);return(0,T.jsx)(_n,{...i,...r,ref:t})});Wr.displayName=Ur;var Gr=`MenuSub`,[Kr,qr]=X(Gr),Jr=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Z(Gr,t),o=nr(t),[s,c]=w.useState(null),[l,u]=w.useState(null),d=m(i);return w.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,T.jsx)(mn,{...o,children:(0,T.jsx)(ir,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,T.jsx)(Kr,{scope:t,contentId:f(),triggerId:f(),trigger:s,onTriggerChange:c,children:n})})})};Jr.displayName=Gr;var Yr=`MenuSubTrigger`,Xr=w.forwardRef((e,t)=>{let n=Z(Yr,e.__scopeMenu),r=or(Yr,e.__scopeMenu),a=qr(Yr,e.__scopeMenu),o=hr(Yr,e.__scopeMenu),s=w.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=w.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);w.useEffect(()=>d,[d]),w.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=i(t,a.onTriggerChange);return(0,T.jsx)(lr,{asChild:!0,...u,children:(0,T.jsx)(Or,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":$r(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,si(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:b(e.onPointerLeave,si(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Yn[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Xr.displayName=Yr;var Zr=`MenuSubContent`,Qr=w.forwardRef((e,t)=>{let n=fr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,align:a=`start`,...o}=e,s=Z(Q,e.__scopeMenu),c=or(Q,e.__scopeMenu),l=qr(Zr,e.__scopeMenu),u=w.useRef(null),f=i(t,u);return(0,T.jsx)(Qn.Provider,{scope:e.__scopeMenu,children:(0,T.jsx)(d,{present:r||s.open,children:(0,T.jsx)(Qn.Slot,{scope:e.__scopeMenu,children:(0,T.jsx)(br,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:b(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Xn[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});Qr.displayName=Zr;function $r(e){return e?`open`:`closed`}function ei(e){return e===`indeterminate`}function ti(e){return ei(e)?`indeterminate`:e?`checked`:`unchecked`}function ni(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ri(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ii(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ri(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ai(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oi(e,t){return t?ai({x:e.clientX,y:e.clientY},t):!1}function si(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ci=sr,li=lr,ui=pr,di=gr,fi=Sr,pi=wr,mi=Dr,hi=Ar,gi=Pr,_i=Ir,vi=Br,yi=Hr,bi=Wr,xi=Xr,Si=Qr,Ci=`DropdownMenu`,[wi,Ti]=s(Ci,[tr]),$=tr(),[Ei,Di]=wi(Ci),Oi=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=$(t),u=w.useRef(null),[d,p]=o({prop:i,defaultProp:a??!1,onChange:s,caller:Ci});return(0,T.jsx)(Ei,{scope:t,triggerId:f(),triggerRef:u,contentId:f(),open:d,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,T.jsx)(ci,{...l,open:d,onOpenChange:p,dir:r,modal:c,children:n})})};Oi.displayName=Ci;var ki=`DropdownMenuTrigger`,Ai=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,o=Di(ki,n),s=$(n),c=i(t,o.triggerRef);return(0,T.jsx)(li,{asChild:!0,...s,children:(0,T.jsx)(y.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...a,ref:c,onPointerDown:b(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ai.displayName=ki;var ji=`DropdownMenuPortal`,Mi=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,T.jsx)(ui,{...r,...n})};Mi.displayName=ji;var Ni=`DropdownMenuContent`,Pi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Di(Ni,n),a=$(n),o=w.useRef(!1);return(0,T.jsx)(di,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Pi.displayName=Ni;var Fi=`DropdownMenuGroup`,Ii=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(fi,{...i,...r,ref:t})});Ii.displayName=Fi;var Li=`DropdownMenuLabel`,Ri=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(pi,{...i,...r,ref:t})});Ri.displayName=Li;var zi=`DropdownMenuItem`,Bi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(mi,{...i,...r,ref:t})});Bi.displayName=zi;var Vi=`DropdownMenuCheckboxItem`,Hi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(hi,{...i,...r,ref:t})});Hi.displayName=Vi;var Ui=`DropdownMenuRadioGroup`,Wi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(gi,{...i,...r,ref:t})});Wi.displayName=Ui;var Gi=`DropdownMenuRadioItem`,Ki=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(_i,{...i,...r,ref:t})});Ki.displayName=Gi;var qi=`DropdownMenuItemIndicator`,Ji=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(vi,{...i,...r,ref:t})});Ji.displayName=qi;var Yi=`DropdownMenuSeparator`,Xi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(yi,{...i,...r,ref:t})});Xi.displayName=Yi;var Zi=`DropdownMenuArrow`,Qi=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(bi,{...i,...r,ref:t})});Qi.displayName=Zi;var $i=`DropdownMenuSubTrigger`,ea=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(xi,{...i,...r,ref:t})});ea.displayName=$i;var ta=`DropdownMenuSubContent`,na=w.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,T.jsx)(Si,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});na.displayName=ta;var ra=Oi,ia=Ai,aa=Mi,oa=Pi,sa=Ri,ca=Bi,la=Wi,ua=Ki,da=Ji,fa=Xi;function pa({...e}){return(0,T.jsx)(ra,{"data-slot":`dropdown-menu`,...e})}function ma({...e}){return(0,T.jsx)(ia,{"data-slot":`dropdown-menu-trigger`,...e})}function ha({className:e,sideOffset:t=4,...n}){return(0,T.jsx)(aa,{children:(0,T.jsx)(oa,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:S(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function ga({className:e,inset:t,variant:n=`default`,...r}){return(0,T.jsx)(ca,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:S(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function _a({...e}){return(0,T.jsx)(la,{"data-slot":`dropdown-menu-radio-group`,...e})}function va({className:e,children:t,...n}){return(0,T.jsxs)(ua,{"data-slot":`dropdown-menu-radio-item`,className:S(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,T.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,T.jsx)(da,{children:(0,T.jsx)(C,{className:`size-2 fill-current`})})}),t]})}function ya({className:e,inset:t,...n}){return(0,T.jsx)(sa,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:S(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function ba({className:e,...t}){return(0,T.jsx)(fa,{"data-slot":`dropdown-menu-separator`,className:S(`-mx-1 my-1 h-px bg-border`,e),...t})}export{_a as a,ma as c,gn as d,mn as f,C as h,ya as i,hn as l,A as m,ha as n,va as o,Zt as p,ga as r,ba as s,pa as t,_n as u};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,r as i,t as a}from"./utils-DsLuRXwV.js";var o=i(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),s=i(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),c=i(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),l=i(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),u=n();function d({reference:e,taskTitle:t,className:n,compact:i=!1}){let{kind:o,number:c,url:l}=e,d=a(`inline-flex h-[22px] items-center gap-1 rounded-full border border-violet/35 px-2 font-mono text-[11px] font-semibold text-violet`,n),f=i&&o===`PR`?`PR`:c?`${o===`Issue`?`Issue `:``}#${c}`:o;return!l||!r(l)?(0,u.jsx)(`span`,{"data-slot":o===`PR`?`pr-chip`:`issue-chip`,className:d,children:f}):(0,u.jsxs)(`a`,{"data-slot":o===`PR`?`pr-chip`:`issue-chip`,href:l,target:`_blank`,rel:`noopener noreferrer`,title:l,"aria-label":`Open the ${o===`PR`?`pull request`:`issue`} for ${t}`,className:a(d,`hover:bg-violet/10`),children:[f,(0,u.jsx)(s,{className:`size-2.5`,"aria-hidden":`true`})]})}var f=e(t(),1);function p(e,t){let[n,r]=(0,f.useState)(!1),[i,a]=(0,f.useState)(``),o=(0,f.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function m({editor:e,className:t}){return(0,u.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:a(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}export{c as a,l as i,p as n,o,d as r,m as t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-B8s5qIcK.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t};
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-B8s5qIcK.js";var t=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t};
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-B8s5qIcK.js";var t=e(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]);export{t};
1
+ import{r as e}from"./utils-DsLuRXwV.js";var t=e(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-ZtnFHA-n.js";import{n as i,r as a,t as o}from"./utils-DsLuRXwV.js";import{t as s}from"./chevron-right-G4caF2QV.js";import{c,n as l,r as u,t as d}from"./dropdown-menu-C1Dlf35P.js";import{t as f}from"./ellipsis-vertical-DpGTRqC2.js";import{n as p}from"./tab-link-DIlR5T07.js";import{t as m}from"./file-DlUGpUlb.js";import{t as h}from"./folder-BAY6Vddy.js";import{i as g,n as _,r as v}from"./use-desktop-Bf5LS_P4.js";import{t as y}from"./git-pull-request-agOG0iGM.js";import{t as b}from"./square-terminal-hwBL8XsC.js";import{t as x}from"./upload-BKjN59-1.js";import{t as S}from"./diff-stat-Dyfg3ltF.js";var C=a(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),w=e(t(),1),T=n();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:r}){let[i,a]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(s,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,T.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),i?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:o(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(m,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:s,onAction:p}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,T.jsx)(_,{branch:t}):null,n?(0,T.jsx)(R,{stat:n}):null,(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(v,{mode:i,wrap:a,onModeChange:o,onWrapChange:s})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:p},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:p}),e.menu.length>0?(0,T.jsxs)(d,{children:[(0,T.jsx)(c,{asChild:!0,children:(0,T.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(f,{"aria-hidden":`true`})})}),(0,T.jsx)(l,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(u,{disabled:!e.enabled,title:e.reason,onSelect:()=>p(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(g,{"aria-hidden":`true`}),push:(0,T.jsx)(x,{"aria-hidden":`true`}),"create-pr":(0,T.jsx)(y,{"aria-hidden":`true`}),"view-pr":(0,T.jsx)(p,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(b,{"aria-hidden":`true`})};function L({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,T.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(S,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{C as a,E as i,F as n,P as r,R as t};