mongo-my-admin 0.0.0-stage → 0.1.4

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 (394) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-build-manifest.json +513 -0
  3. package/.next/app-path-routes-manifest.json +60 -0
  4. package/.next/build-manifest.json +33 -0
  5. package/.next/diagnostics/build-diagnostics.json +6 -0
  6. package/.next/diagnostics/framework.json +1 -0
  7. package/.next/export-marker.json +6 -0
  8. package/.next/images-manifest.json +58 -0
  9. package/.next/next-minimal-server.js.nft.json +1 -0
  10. package/.next/next-server.js.nft.json +1 -0
  11. package/.next/package.json +1 -0
  12. package/.next/prerender-manifest.json +90 -0
  13. package/.next/react-loadable-manifest.json +8 -0
  14. package/.next/required-server-files.json +323 -0
  15. package/.next/routes-manifest.json +410 -0
  16. package/.next/server/app/(app)/admin/audit/page.js +2 -0
  17. package/.next/server/app/(app)/admin/audit/page.js.nft.json +1 -0
  18. package/.next/server/app/(app)/admin/audit/page_client-reference-manifest.js +1 -0
  19. package/.next/server/app/(app)/admin/connections/page.js +2 -0
  20. package/.next/server/app/(app)/admin/connections/page.js.nft.json +1 -0
  21. package/.next/server/app/(app)/admin/connections/page_client-reference-manifest.js +1 -0
  22. package/.next/server/app/(app)/admin/security/page.js +2 -0
  23. package/.next/server/app/(app)/admin/security/page.js.nft.json +1 -0
  24. package/.next/server/app/(app)/admin/security/page_client-reference-manifest.js +1 -0
  25. package/.next/server/app/(app)/admin/users/page.js +2 -0
  26. package/.next/server/app/(app)/admin/users/page.js.nft.json +1 -0
  27. package/.next/server/app/(app)/admin/users/page_client-reference-manifest.js +1 -0
  28. package/.next/server/app/(app)/ai/page.js +12 -0
  29. package/.next/server/app/(app)/ai/page.js.nft.json +1 -0
  30. package/.next/server/app/(app)/ai/page_client-reference-manifest.js +1 -0
  31. package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page.js +2 -0
  32. package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page.js.nft.json +1 -0
  33. package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page_client-reference-manifest.js +1 -0
  34. package/.next/server/app/(app)/c/[cid]/[db]/page.js +2 -0
  35. package/.next/server/app/(app)/c/[cid]/[db]/page.js.nft.json +1 -0
  36. package/.next/server/app/(app)/c/[cid]/[db]/page_client-reference-manifest.js +1 -0
  37. package/.next/server/app/(app)/c/[cid]/page.js +2 -0
  38. package/.next/server/app/(app)/c/[cid]/page.js.nft.json +1 -0
  39. package/.next/server/app/(app)/c/[cid]/page_client-reference-manifest.js +1 -0
  40. package/.next/server/app/(app)/c/[cid]/performance/page.js +2 -0
  41. package/.next/server/app/(app)/c/[cid]/performance/page.js.nft.json +1 -0
  42. package/.next/server/app/(app)/c/[cid]/performance/page_client-reference-manifest.js +1 -0
  43. package/.next/server/app/(app)/c/[cid]/shell/page.js +2 -0
  44. package/.next/server/app/(app)/c/[cid]/shell/page.js.nft.json +1 -0
  45. package/.next/server/app/(app)/c/[cid]/shell/page_client-reference-manifest.js +1 -0
  46. package/.next/server/app/(app)/page.js +2 -0
  47. package/.next/server/app/(app)/page.js.nft.json +1 -0
  48. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -0
  49. package/.next/server/app/(app)/queries/page.js +2 -0
  50. package/.next/server/app/(app)/queries/page.js.nft.json +1 -0
  51. package/.next/server/app/(app)/queries/page_client-reference-manifest.js +1 -0
  52. package/.next/server/app/_not-found/page.js +2 -0
  53. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  54. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  55. package/.next/server/app/_not-found.html +1 -0
  56. package/.next/server/app/_not-found.meta +16 -0
  57. package/.next/server/app/_not-found.rsc +19 -0
  58. package/.next/server/app/api/admin/approvals/[id]/route.js +1 -0
  59. package/.next/server/app/api/admin/approvals/[id]/route.js.nft.json +1 -0
  60. package/.next/server/app/api/admin/approvals/[id]/route_client-reference-manifest.js +1 -0
  61. package/.next/server/app/api/admin/approvals/route.js +1 -0
  62. package/.next/server/app/api/admin/approvals/route.js.nft.json +1 -0
  63. package/.next/server/app/api/admin/approvals/route_client-reference-manifest.js +1 -0
  64. package/.next/server/app/api/admin/audit/route.js +1 -0
  65. package/.next/server/app/api/admin/audit/route.js.nft.json +1 -0
  66. package/.next/server/app/api/admin/audit/route_client-reference-manifest.js +1 -0
  67. package/.next/server/app/api/admin/security/route.js +1 -0
  68. package/.next/server/app/api/admin/security/route.js.nft.json +1 -0
  69. package/.next/server/app/api/admin/security/route_client-reference-manifest.js +1 -0
  70. package/.next/server/app/api/admin/users/[uid]/route.js +1 -0
  71. package/.next/server/app/api/admin/users/[uid]/route.js.nft.json +1 -0
  72. package/.next/server/app/api/admin/users/[uid]/route_client-reference-manifest.js +1 -0
  73. package/.next/server/app/api/admin/users/route.js +1 -0
  74. package/.next/server/app/api/admin/users/route.js.nft.json +1 -0
  75. package/.next/server/app/api/admin/users/route_client-reference-manifest.js +1 -0
  76. package/.next/server/app/api/ai/chat/route.js +2 -0
  77. package/.next/server/app/api/ai/chat/route.js.nft.json +1 -0
  78. package/.next/server/app/api/ai/chat/route_client-reference-manifest.js +1 -0
  79. package/.next/server/app/api/ai/confirm/route.js +2 -0
  80. package/.next/server/app/api/ai/confirm/route.js.nft.json +1 -0
  81. package/.next/server/app/api/ai/confirm/route_client-reference-manifest.js +1 -0
  82. package/.next/server/app/api/ai/policy/route.js +2 -0
  83. package/.next/server/app/api/ai/policy/route.js.nft.json +1 -0
  84. package/.next/server/app/api/ai/policy/route_client-reference-manifest.js +1 -0
  85. package/.next/server/app/api/ai/providers/[id]/route.js +2 -0
  86. package/.next/server/app/api/ai/providers/[id]/route.js.nft.json +1 -0
  87. package/.next/server/app/api/ai/providers/[id]/route_client-reference-manifest.js +1 -0
  88. package/.next/server/app/api/ai/providers/[id]/test/route.js +2 -0
  89. package/.next/server/app/api/ai/providers/[id]/test/route.js.nft.json +1 -0
  90. package/.next/server/app/api/ai/providers/[id]/test/route_client-reference-manifest.js +1 -0
  91. package/.next/server/app/api/ai/providers/route.js +2 -0
  92. package/.next/server/app/api/ai/providers/route.js.nft.json +1 -0
  93. package/.next/server/app/api/ai/providers/route_client-reference-manifest.js +1 -0
  94. package/.next/server/app/api/ai/tokens/[id]/route.js +2 -0
  95. package/.next/server/app/api/ai/tokens/[id]/route.js.nft.json +1 -0
  96. package/.next/server/app/api/ai/tokens/[id]/route_client-reference-manifest.js +1 -0
  97. package/.next/server/app/api/ai/tokens/route.js +2 -0
  98. package/.next/server/app/api/ai/tokens/route.js.nft.json +1 -0
  99. package/.next/server/app/api/ai/tokens/route_client-reference-manifest.js +1 -0
  100. package/.next/server/app/api/auth/login/route.js +1 -0
  101. package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
  102. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -0
  103. package/.next/server/app/api/auth/logout/route.js +1 -0
  104. package/.next/server/app/api/auth/logout/route.js.nft.json +1 -0
  105. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -0
  106. package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route.js +1 -0
  107. package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route.js.nft.json +1 -0
  108. package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route_client-reference-manifest.js +1 -0
  109. package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route.js +1 -0
  110. package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route.js.nft.json +1 -0
  111. package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route_client-reference-manifest.js +1 -0
  112. package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route.js +1 -0
  113. package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route.js.nft.json +1 -0
  114. package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route_client-reference-manifest.js +1 -0
  115. package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route.js +1 -0
  116. package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route.js.nft.json +1 -0
  117. package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route_client-reference-manifest.js +1 -0
  118. package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route.js +1 -0
  119. package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route.js.nft.json +1 -0
  120. package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route_client-reference-manifest.js +1 -0
  121. package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route.js +1 -0
  122. package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route.js.nft.json +1 -0
  123. package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route_client-reference-manifest.js +1 -0
  124. package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route.js +1 -0
  125. package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route.js.nft.json +1 -0
  126. package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route_client-reference-manifest.js +1 -0
  127. package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route.js +1 -0
  128. package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route.js.nft.json +1 -0
  129. package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route_client-reference-manifest.js +1 -0
  130. package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route.js +1 -0
  131. package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route.js.nft.json +1 -0
  132. package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route_client-reference-manifest.js +1 -0
  133. package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route.js +1 -0
  134. package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route.js.nft.json +1 -0
  135. package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route_client-reference-manifest.js +1 -0
  136. package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route.js +1 -0
  137. package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route.js.nft.json +1 -0
  138. package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route_client-reference-manifest.js +1 -0
  139. package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route.js +1 -0
  140. package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route.js.nft.json +1 -0
  141. package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route_client-reference-manifest.js +1 -0
  142. package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route.js +1 -0
  143. package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route.js.nft.json +1 -0
  144. package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route_client-reference-manifest.js +1 -0
  145. package/.next/server/app/api/c/[cid]/[db]/collections/route.js +1 -0
  146. package/.next/server/app/api/c/[cid]/[db]/collections/route.js.nft.json +1 -0
  147. package/.next/server/app/api/c/[cid]/[db]/collections/route_client-reference-manifest.js +1 -0
  148. package/.next/server/app/api/c/[cid]/[db]/collstats/route.js +1 -0
  149. package/.next/server/app/api/c/[cid]/[db]/collstats/route.js.nft.json +1 -0
  150. package/.next/server/app/api/c/[cid]/[db]/collstats/route_client-reference-manifest.js +1 -0
  151. package/.next/server/app/api/c/[cid]/[db]/danger/route.js +1 -0
  152. package/.next/server/app/api/c/[cid]/[db]/danger/route.js.nft.json +1 -0
  153. package/.next/server/app/api/c/[cid]/[db]/danger/route_client-reference-manifest.js +1 -0
  154. package/.next/server/app/api/c/[cid]/[db]/stats/route.js +1 -0
  155. package/.next/server/app/api/c/[cid]/[db]/stats/route.js.nft.json +1 -0
  156. package/.next/server/app/api/c/[cid]/[db]/stats/route_client-reference-manifest.js +1 -0
  157. package/.next/server/app/api/c/[cid]/databases/route.js +1 -0
  158. package/.next/server/app/api/c/[cid]/databases/route.js.nft.json +1 -0
  159. package/.next/server/app/api/c/[cid]/databases/route_client-reference-manifest.js +1 -0
  160. package/.next/server/app/api/c/[cid]/server/route.js +1 -0
  161. package/.next/server/app/api/c/[cid]/server/route.js.nft.json +1 -0
  162. package/.next/server/app/api/c/[cid]/server/route_client-reference-manifest.js +1 -0
  163. package/.next/server/app/api/c/[cid]/shell/route.js +1 -0
  164. package/.next/server/app/api/c/[cid]/shell/route.js.nft.json +1 -0
  165. package/.next/server/app/api/c/[cid]/shell/route_client-reference-manifest.js +1 -0
  166. package/.next/server/app/api/c/[cid]/tree/route.js +1 -0
  167. package/.next/server/app/api/c/[cid]/tree/route.js.nft.json +1 -0
  168. package/.next/server/app/api/c/[cid]/tree/route_client-reference-manifest.js +1 -0
  169. package/.next/server/app/api/connections/[cid]/route.js +1 -0
  170. package/.next/server/app/api/connections/[cid]/route.js.nft.json +1 -0
  171. package/.next/server/app/api/connections/[cid]/route_client-reference-manifest.js +1 -0
  172. package/.next/server/app/api/connections/route.js +1 -0
  173. package/.next/server/app/api/connections/route.js.nft.json +1 -0
  174. package/.next/server/app/api/connections/route_client-reference-manifest.js +1 -0
  175. package/.next/server/app/api/connections/test/route.js +1 -0
  176. package/.next/server/app/api/connections/test/route.js.nft.json +1 -0
  177. package/.next/server/app/api/connections/test/route_client-reference-manifest.js +1 -0
  178. package/.next/server/app/api/mcp/route.js +31 -0
  179. package/.next/server/app/api/mcp/route.js.nft.json +1 -0
  180. package/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -0
  181. package/.next/server/app/api/me/route.js +1 -0
  182. package/.next/server/app/api/me/route.js.nft.json +1 -0
  183. package/.next/server/app/api/me/route_client-reference-manifest.js +1 -0
  184. package/.next/server/app/api/me/totp/route.js +1 -0
  185. package/.next/server/app/api/me/totp/route.js.nft.json +1 -0
  186. package/.next/server/app/api/me/totp/route_client-reference-manifest.js +1 -0
  187. package/.next/server/app/favicon.ico/route.js +1 -0
  188. package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  189. package/.next/server/app/favicon.ico.body +0 -0
  190. package/.next/server/app/favicon.ico.meta +1 -0
  191. package/.next/server/app/login/page.js +2 -0
  192. package/.next/server/app/login/page.js.nft.json +1 -0
  193. package/.next/server/app/login/page_client-reference-manifest.js +1 -0
  194. package/.next/server/app/login.html +1 -0
  195. package/.next/server/app/login.meta +15 -0
  196. package/.next/server/app/login.rsc +23 -0
  197. package/.next/server/app-paths-manifest.json +60 -0
  198. package/.next/server/chunks/1005.js +13 -0
  199. package/.next/server/chunks/1671.js +3 -0
  200. package/.next/server/chunks/3249.js +55 -0
  201. package/.next/server/chunks/3336.js +1 -0
  202. package/.next/server/chunks/3565.js +1 -0
  203. package/.next/server/chunks/4357.js +128 -0
  204. package/.next/server/chunks/4811.js +15 -0
  205. package/.next/server/chunks/5207.js +1 -0
  206. package/.next/server/chunks/5611.js +6 -0
  207. package/.next/server/chunks/641.js +1 -0
  208. package/.next/server/chunks/7090.js +1 -0
  209. package/.next/server/chunks/7900.js +4 -0
  210. package/.next/server/chunks/890.js +22 -0
  211. package/.next/server/functions-config-manifest.json +4 -0
  212. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  213. package/.next/server/middleware-build-manifest.js +1 -0
  214. package/.next/server/middleware-manifest.json +6 -0
  215. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  216. package/.next/server/next-font-manifest.js +1 -0
  217. package/.next/server/next-font-manifest.json +1 -0
  218. package/.next/server/pages/404.html +1 -0
  219. package/.next/server/pages/500.html +1 -0
  220. package/.next/server/pages/_app.js +1 -0
  221. package/.next/server/pages/_app.js.nft.json +1 -0
  222. package/.next/server/pages/_document.js +1 -0
  223. package/.next/server/pages/_document.js.nft.json +1 -0
  224. package/.next/server/pages/_error.js +19 -0
  225. package/.next/server/pages/_error.js.nft.json +1 -0
  226. package/.next/server/pages-manifest.json +6 -0
  227. package/.next/server/server-reference-manifest.js +1 -0
  228. package/.next/server/server-reference-manifest.json +1 -0
  229. package/.next/server/webpack-runtime.js +1 -0
  230. package/.next/static/G4cngSmGFZg9r2ZjPR60A/_buildManifest.js +1 -0
  231. package/.next/static/G4cngSmGFZg9r2ZjPR60A/_ssgManifest.js +1 -0
  232. package/.next/static/chunks/1255-b84741b894bb9354.js +1 -0
  233. package/.next/static/chunks/3510-eb016c974975272c.js +1 -0
  234. package/.next/static/chunks/363642f4-b76d1a643b93556c.js +1 -0
  235. package/.next/static/chunks/4bd1b696-f785427dddbba9fb.js +1 -0
  236. package/.next/static/chunks/5376-9379c07669d2c28f.js +1 -0
  237. package/.next/static/chunks/5483-41e5f4776321671b.js +1 -0
  238. package/.next/static/chunks/559-bb0824aa49e1e88f.js +1 -0
  239. package/.next/static/chunks/5854-e53d093ab3d47bac.js +1 -0
  240. package/.next/static/chunks/6094-2acc6d932aabc2c5.js +1 -0
  241. package/.next/static/chunks/6545-2920df06f8188678.js +1 -0
  242. package/.next/static/chunks/6569.dd7c980e8da3a8f9.js +1 -0
  243. package/.next/static/chunks/7064-2c9c3ef8e8802efe.js +1 -0
  244. package/.next/static/chunks/8166-ebfa3185c20f6afa.js +1 -0
  245. package/.next/static/chunks/8720-bddd249d42ab6b16.js +1 -0
  246. package/.next/static/chunks/app/(app)/admin/audit/page-37753625bab57838.js +1 -0
  247. package/.next/static/chunks/app/(app)/admin/connections/page-820cf63eafd1599a.js +1 -0
  248. package/.next/static/chunks/app/(app)/admin/security/page-eac00bd22a1d165c.js +1 -0
  249. package/.next/static/chunks/app/(app)/admin/users/page-0b5011243a0fec97.js +1 -0
  250. package/.next/static/chunks/app/(app)/ai/page-df132e69b1d649f8.js +1 -0
  251. package/.next/static/chunks/app/(app)/c/[cid]/[db]/[coll]/page-0c7d71c115a02eb6.js +1 -0
  252. package/.next/static/chunks/app/(app)/c/[cid]/[db]/page-e700371c72058bc1.js +1 -0
  253. package/.next/static/chunks/app/(app)/c/[cid]/page-65d8810975a53cf0.js +1 -0
  254. package/.next/static/chunks/app/(app)/c/[cid]/performance/page-c6ae1521644ca6f1.js +1 -0
  255. package/.next/static/chunks/app/(app)/c/[cid]/shell/page-7900bef5bb856829.js +1 -0
  256. package/.next/static/chunks/app/(app)/layout-51a850b461498da4.js +1 -0
  257. package/.next/static/chunks/app/(app)/page-1c4d519e29aa2713.js +1 -0
  258. package/.next/static/chunks/app/(app)/queries/page-5c17ba95a116f5fa.js +1 -0
  259. package/.next/static/chunks/app/_not-found/page-1b209d37768dae8e.js +1 -0
  260. package/.next/static/chunks/app/api/admin/approvals/[id]/route-92dc981ff2fa6cf3.js +1 -0
  261. package/.next/static/chunks/app/api/admin/approvals/route-92dc981ff2fa6cf3.js +1 -0
  262. package/.next/static/chunks/app/api/admin/audit/route-92dc981ff2fa6cf3.js +1 -0
  263. package/.next/static/chunks/app/api/admin/security/route-92dc981ff2fa6cf3.js +1 -0
  264. package/.next/static/chunks/app/api/admin/users/[uid]/route-92dc981ff2fa6cf3.js +1 -0
  265. package/.next/static/chunks/app/api/admin/users/route-92dc981ff2fa6cf3.js +1 -0
  266. package/.next/static/chunks/app/api/ai/chat/route-92dc981ff2fa6cf3.js +1 -0
  267. package/.next/static/chunks/app/api/ai/confirm/route-92dc981ff2fa6cf3.js +1 -0
  268. package/.next/static/chunks/app/api/ai/policy/route-92dc981ff2fa6cf3.js +1 -0
  269. package/.next/static/chunks/app/api/ai/providers/[id]/route-92dc981ff2fa6cf3.js +1 -0
  270. package/.next/static/chunks/app/api/ai/providers/[id]/test/route-92dc981ff2fa6cf3.js +1 -0
  271. package/.next/static/chunks/app/api/ai/providers/route-92dc981ff2fa6cf3.js +1 -0
  272. package/.next/static/chunks/app/api/ai/tokens/[id]/route-92dc981ff2fa6cf3.js +1 -0
  273. package/.next/static/chunks/app/api/ai/tokens/route-92dc981ff2fa6cf3.js +1 -0
  274. package/.next/static/chunks/app/api/auth/login/route-92dc981ff2fa6cf3.js +1 -0
  275. package/.next/static/chunks/app/api/auth/logout/route-92dc981ff2fa6cf3.js +1 -0
  276. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/aggregate/route-92dc981ff2fa6cf3.js +1 -0
  277. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/bulk/route-92dc981ff2fa6cf3.js +1 -0
  278. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/count/route-92dc981ff2fa6cf3.js +1 -0
  279. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/danger/route-92dc981ff2fa6cf3.js +1 -0
  280. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/docs/route-92dc981ff2fa6cf3.js +1 -0
  281. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/explain/route-92dc981ff2fa6cf3.js +1 -0
  282. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/export/route-92dc981ff2fa6cf3.js +1 -0
  283. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/find/route-92dc981ff2fa6cf3.js +1 -0
  284. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/import/route-92dc981ff2fa6cf3.js +1 -0
  285. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/indexes/route-92dc981ff2fa6cf3.js +1 -0
  286. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/schema/route-92dc981ff2fa6cf3.js +1 -0
  287. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/stats/route-92dc981ff2fa6cf3.js +1 -0
  288. package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/validation/route-92dc981ff2fa6cf3.js +1 -0
  289. package/.next/static/chunks/app/api/c/[cid]/[db]/collections/route-92dc981ff2fa6cf3.js +1 -0
  290. package/.next/static/chunks/app/api/c/[cid]/[db]/collstats/route-92dc981ff2fa6cf3.js +1 -0
  291. package/.next/static/chunks/app/api/c/[cid]/[db]/danger/route-92dc981ff2fa6cf3.js +1 -0
  292. package/.next/static/chunks/app/api/c/[cid]/[db]/stats/route-92dc981ff2fa6cf3.js +1 -0
  293. package/.next/static/chunks/app/api/c/[cid]/databases/route-92dc981ff2fa6cf3.js +1 -0
  294. package/.next/static/chunks/app/api/c/[cid]/server/route-92dc981ff2fa6cf3.js +1 -0
  295. package/.next/static/chunks/app/api/c/[cid]/shell/route-92dc981ff2fa6cf3.js +1 -0
  296. package/.next/static/chunks/app/api/c/[cid]/tree/route-92dc981ff2fa6cf3.js +1 -0
  297. package/.next/static/chunks/app/api/connections/[cid]/route-92dc981ff2fa6cf3.js +1 -0
  298. package/.next/static/chunks/app/api/connections/route-92dc981ff2fa6cf3.js +1 -0
  299. package/.next/static/chunks/app/api/connections/test/route-92dc981ff2fa6cf3.js +1 -0
  300. package/.next/static/chunks/app/api/mcp/route-92dc981ff2fa6cf3.js +1 -0
  301. package/.next/static/chunks/app/api/me/route-92dc981ff2fa6cf3.js +1 -0
  302. package/.next/static/chunks/app/api/me/totp/route-92dc981ff2fa6cf3.js +1 -0
  303. package/.next/static/chunks/app/layout-e8f9794c3ac6a87d.js +1 -0
  304. package/.next/static/chunks/app/login/page-40fc4571688a5fe4.js +1 -0
  305. package/.next/static/chunks/bb55d925-1f4f527ca293a78d.js +3 -0
  306. package/.next/static/chunks/framework-c58965a13b4aab6d.js +1 -0
  307. package/.next/static/chunks/main-app-804a108971cfb50b.js +1 -0
  308. package/.next/static/chunks/main-b95b5f7f62b64ae7.js +1 -0
  309. package/.next/static/chunks/pages/_app-6c8c2371b16a04b8.js +1 -0
  310. package/.next/static/chunks/pages/_error-94812ad32cad7365.js +1 -0
  311. package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  312. package/.next/static/chunks/webpack-0ce8f621312b1eec.js +1 -0
  313. package/.next/static/css/d9c6fe72e33886b3.css +3 -0
  314. package/.next/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
  315. package/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  316. package/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
  317. package/.next/static/media/67957d42bae0796d-s.woff2 +0 -0
  318. package/.next/static/media/886030b0b59bc5a7-s.woff2 +0 -0
  319. package/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  320. package/.next/static/media/939c4f875ee75fbb-s.woff2 +0 -0
  321. package/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  322. package/.next/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
  323. package/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  324. package/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  325. package/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  326. package/.next/static/media/f911b923c6adde36-s.woff2 +0 -0
  327. package/.next/trace +6 -0
  328. package/.next/types/app/(app)/admin/audit/page.ts +84 -0
  329. package/.next/types/app/(app)/admin/connections/page.ts +84 -0
  330. package/.next/types/app/(app)/admin/security/page.ts +84 -0
  331. package/.next/types/app/(app)/admin/users/page.ts +84 -0
  332. package/.next/types/app/(app)/ai/page.ts +84 -0
  333. package/.next/types/app/(app)/c/[cid]/[db]/[coll]/page.ts +84 -0
  334. package/.next/types/app/(app)/c/[cid]/[db]/page.ts +84 -0
  335. package/.next/types/app/(app)/c/[cid]/page.ts +84 -0
  336. package/.next/types/app/(app)/c/[cid]/performance/page.ts +84 -0
  337. package/.next/types/app/(app)/c/[cid]/shell/page.ts +84 -0
  338. package/.next/types/app/(app)/page.ts +84 -0
  339. package/.next/types/app/(app)/queries/page.ts +84 -0
  340. package/.next/types/app/api/admin/approvals/[id]/route.ts +347 -0
  341. package/.next/types/app/api/admin/approvals/route.ts +347 -0
  342. package/.next/types/app/api/admin/audit/route.ts +347 -0
  343. package/.next/types/app/api/admin/security/route.ts +347 -0
  344. package/.next/types/app/api/admin/users/[uid]/route.ts +347 -0
  345. package/.next/types/app/api/admin/users/route.ts +347 -0
  346. package/.next/types/app/api/ai/chat/route.ts +347 -0
  347. package/.next/types/app/api/ai/confirm/route.ts +347 -0
  348. package/.next/types/app/api/ai/policy/route.ts +347 -0
  349. package/.next/types/app/api/ai/providers/[id]/route.ts +347 -0
  350. package/.next/types/app/api/ai/providers/[id]/test/route.ts +347 -0
  351. package/.next/types/app/api/ai/providers/route.ts +347 -0
  352. package/.next/types/app/api/ai/tokens/[id]/route.ts +347 -0
  353. package/.next/types/app/api/ai/tokens/route.ts +347 -0
  354. package/.next/types/app/api/auth/login/route.ts +347 -0
  355. package/.next/types/app/api/auth/logout/route.ts +347 -0
  356. package/.next/types/app/api/c/[cid]/[db]/[coll]/aggregate/route.ts +347 -0
  357. package/.next/types/app/api/c/[cid]/[db]/[coll]/bulk/route.ts +347 -0
  358. package/.next/types/app/api/c/[cid]/[db]/[coll]/count/route.ts +347 -0
  359. package/.next/types/app/api/c/[cid]/[db]/[coll]/danger/route.ts +347 -0
  360. package/.next/types/app/api/c/[cid]/[db]/[coll]/docs/route.ts +347 -0
  361. package/.next/types/app/api/c/[cid]/[db]/[coll]/explain/route.ts +347 -0
  362. package/.next/types/app/api/c/[cid]/[db]/[coll]/export/route.ts +347 -0
  363. package/.next/types/app/api/c/[cid]/[db]/[coll]/find/route.ts +347 -0
  364. package/.next/types/app/api/c/[cid]/[db]/[coll]/import/route.ts +347 -0
  365. package/.next/types/app/api/c/[cid]/[db]/[coll]/indexes/route.ts +347 -0
  366. package/.next/types/app/api/c/[cid]/[db]/[coll]/schema/route.ts +347 -0
  367. package/.next/types/app/api/c/[cid]/[db]/[coll]/stats/route.ts +347 -0
  368. package/.next/types/app/api/c/[cid]/[db]/[coll]/validation/route.ts +347 -0
  369. package/.next/types/app/api/c/[cid]/[db]/collections/route.ts +347 -0
  370. package/.next/types/app/api/c/[cid]/[db]/collstats/route.ts +347 -0
  371. package/.next/types/app/api/c/[cid]/[db]/danger/route.ts +347 -0
  372. package/.next/types/app/api/c/[cid]/[db]/stats/route.ts +347 -0
  373. package/.next/types/app/api/c/[cid]/databases/route.ts +347 -0
  374. package/.next/types/app/api/c/[cid]/server/route.ts +347 -0
  375. package/.next/types/app/api/c/[cid]/shell/route.ts +347 -0
  376. package/.next/types/app/api/c/[cid]/tree/route.ts +347 -0
  377. package/.next/types/app/api/connections/[cid]/route.ts +347 -0
  378. package/.next/types/app/api/connections/route.ts +347 -0
  379. package/.next/types/app/api/connections/test/route.ts +347 -0
  380. package/.next/types/app/api/mcp/route.ts +347 -0
  381. package/.next/types/app/api/me/route.ts +347 -0
  382. package/.next/types/app/api/me/totp/route.ts +347 -0
  383. package/.next/types/app/layout.ts +84 -0
  384. package/.next/types/app/login/page.ts +84 -0
  385. package/.next/types/cache-life.d.ts +141 -0
  386. package/.next/types/package.json +1 -0
  387. package/.next/types/routes.d.ts +127 -0
  388. package/.next/types/validator.ts +574 -0
  389. package/LICENSE +21 -0
  390. package/NOTICE +17 -0
  391. package/README.md +212 -2
  392. package/bin/mongoadmin.mjs +118 -0
  393. package/next.config.mjs +23 -0
  394. package/package.json +93 -4
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6545],{3037:t=>{t.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_d8ebd1",variable:"__variable_d8ebd1"}},3412:(t,e,s)=>{"use strict";s.d(e,{E:()=>p});var i=s(6195),a=s(4268),r=s(2162),n=s(3049),u=class extends r.k{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.#s.has(this)&&this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??("pending"===this.state.status?this.execute(this.state.variables):Promise.resolve())}async execute(t){let e=()=>{this.#a({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#i=(0,n.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)}),a="pending"===this.state.status,r=!i.canStart();try{if(a)e();else{this.#a({type:"pending",variables:t,isPaused:r}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:r})}this.state.isPaused&&i.canStart()&&e();let n=await i.start();return await this.#s.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#a({type:"success",data:n}),n}catch(e){try{await this.#s.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#s.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#a({type:"error",error:e}),e}finally{this.#i===i&&(this.#i=void 0),this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),a.jG.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}},o=s(8445),h=s(4049),l=class extends o.Q{#r;#n;#u;constructor(t={}){super(),this.config=t,this.#r=new Set,this.#n=new Map,this.#u=0}build(t,e,s){let i=new u({client:t,mutationCache:this,mutationId:++this.#u,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#r.add(t);let e=c(t);if("string"==typeof e){let s=this.#n.get(e);s?s.push(t):this.#n.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#r.delete(t)){t.destroy();let e=c(t);if("string"==typeof e){let s=this.#n.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#n.delete(e)}}this.notify({type:"removed",mutation:t})}has(t){return this.#r.has(t)}canRun(t){let e=c(t);if("string"!=typeof e)return!0;{let s=this.#n.get(e)?.find(t=>"pending"===t.state.status);return!s||s===t}}runNext(t){let e=c(t);return"string"==typeof e?this.#n.get(e)?.find(e=>e!==t&&e.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){a.jG.batch(()=>{let t=this.getAll();this.#r.clear(),this.#n.clear(),t.forEach(t=>t.destroy()),t.forEach(t=>{this.notify({type:"removed",mutation:t})})})}getAll(){return Array.from(this.#r)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,h.nJ)(e,t))}findAll(t={}){return this.getAll().filter(e=>(0,h.nJ)(t,e))}notify(t){a.jG.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return a.jG.batch(()=>Promise.all(t.map(t=>t.continue().catch(h.lQ))))}};function c(t){return t.options.scope?.id}var d=s(3122),f=s(43),y=class extends o.Q{#o;constructor(t={}){super(),this.config=t,this.#o=new Map}build(t,e,s){let i=e.queryKey,a=e.queryHash??(0,h.F$)(i,e),r=this.get(a);return r||(r=new f.X({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#o.has(t.queryHash)||(this.#o.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){this.#o.get(t.queryHash)===t&&(t.destroy(),this.#o.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){a.jG.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#o.get(t)}getAll(){return[...this.#o.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,h.MK)(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>(0,h.MK)(t,e)):e}notify(t){a.jG.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){a.jG.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){a.jG.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},p=class{#h;#s;#l;#c;#d;#f;#y;#p;constructor(t={}){this.#h=t.queryCache||new y,this.#s=t.mutationCache||new l,this.#l=t.defaultOptions||{},this.#c=new Map,this.#d=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#y=i.m.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onFocus())}),this.#p=d.t.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#y?.(),this.#y=void 0,this.#p?.(),this.#p=void 0)}isFetching(t){return this.#h.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#s.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#h.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime((0,h.GF)(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#h.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let i=this.defaultQueryOptions({queryKey:t}),a=this.#h.get(i.queryHash)?.state.data,r=(0,h.Zw)(e,a);if(void 0!==r)return this.#h.build(this,i).setData(r,{...s,manual:!0})}setQueriesData(t,e,s){return a.jG.batch(()=>this.#h.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state}removeQueries(t){let e=this.#h;a.jG.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#h;return a.jG.batch(()=>{let i=s.findAll(t),a=new Set(i);return i.forEach(t=>{t.reset()}),this.refetchQueries({type:"active",predicate:t=>a.has(t)},e)})}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(a.jG.batch(()=>this.#h.findAll(t).map(t=>t.cancel(s)))).then(h.lQ).catch(h.lQ)}invalidateQueries(t,e={}){return a.jG.batch(()=>(this.#h.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(a.jG.batch(()=>this.#h.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s),i="paused"===t.state.fetchStatus;return(!s.throwOnError||i)&&(e=e.catch(h.lQ)),i?Promise.resolve():e}))).then(h.lQ)}async query(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#h.build(this,e),i=s.isStaleByTime((0,h.GF)(e.staleTime,s))?await s.fetch(e):s.state.data,a=e.select;return a?a(i):i}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#h.build(this,e);return s.isStaleByTime((0,h.GF)(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(h.lQ).catch(h.lQ)}infiniteQuery(t){return t._type="infinite",this.query(t)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(h.lQ).catch(h.lQ)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return d.t.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#h}getMutationCache(){return this.#s}getDefaultOptions(){return this.#l}setDefaultOptions(t){this.#l=t}setQueryDefaults(t,e){this.#c.set((0,h.EN)(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#c.values()],s={};return e.forEach(e=>{(0,h.Cp)(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#d.set((0,h.EN)(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#d.values()],s={};return e.forEach(e=>{(0,h.Cp)(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#l.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=(0,h.F$)(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===h.hT&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#l.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#h.clear(),this.#s.clear()}}},5774:t=>{t.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_4dc837",variable:"__variable_4dc837"}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6569],{6569:(e,t,n)=>{function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}n.r(t),n.d(t,{Annotation:()=>o.YH,AnnotationType:()=>o.UJ,BidiSpan:()=>s.tF,BlockInfo:()=>s.uF,BlockType:()=>s._B,BlockWrapper:()=>s.l_,ChangeDesc:()=>o.Gu,ChangeSet:()=>o.VR,CharCategory:()=>o.Je,Compartment:()=>o.xx,Decoration:()=>s.NZ,Direction:()=>s.OP,EditorSelection:()=>o.OF,EditorState:()=>o.$t,EditorView:()=>s.Lz,ExternalChange:()=>t8,Facet:()=>o.sj,GutterMarker:()=>s.wJ,Line:()=>o.N1,MapMode:()=>o.iR,MatchDecorator:()=>s.dT,Prec:()=>o.Nb,Range:()=>o.Q6,RangeSet:()=>o.om,RangeSetBuilder:()=>o.vB,RangeValue:()=>o.FB,RectangleMarker:()=>s.Ip,SelectionRange:()=>o.yn,StateEffect:()=>o.Pe,StateEffectType:()=>o.DA,StateField:()=>o.sU,Text:()=>o.EY,Transaction:()=>o.ZX,ViewPlugin:()=>s.Z9,ViewUpdate:()=>s.X3,WidgetType:()=>s.xO,__test:()=>s.rU,activateHover:()=>s.ab,basicSetup:()=>t_,closeHoverTooltip:()=>s.ut,closeHoverTooltips:()=>s.vo,codePointAt:()=>o.vS,codePointSize:()=>o.Fh,color:()=>tQ.yW,combineConfig:()=>o.QR,countColumn:()=>o.y$,crosshairCursor:()=>s.HJ,default:()=>ni,defaultLightThemeOption:()=>tX,drawSelection:()=>s.VH,dropCursor:()=>s.A,findClusterBreak:()=>o.zK,findColumn:()=>o.kn,fromCodePoint:()=>o.MK,getDefaultExtensions:()=>t0,getDialog:()=>s.rC,getDrawSelectionConfig:()=>s.$G,getPanel:()=>s.ld,getStatistics:()=>t1,getTooltip:()=>s.Eg,gutter:()=>s.cU,gutterLineClass:()=>s.EV,gutterWidgetClass:()=>s.QO,gutters:()=>s.Hm,hasHoverTooltips:()=>s.n6,highlightActiveLine:()=>s.dz,highlightActiveLineGutter:()=>s.Wu,highlightSpecialChars:()=>s.N$,highlightTrailingWhitespace:()=>s.wu,highlightWhitespace:()=>s.Yq,hoverTooltip:()=>s.Ux,keymap:()=>s.w4,layer:()=>s.qd,lineNumberMarkers:()=>s.pK,lineNumberWidgetMarker:()=>s.qy,lineNumbers:()=>s.$K,logException:()=>s.c_,minimalSetup:()=>tY,oneDark:()=>tQ.bM,oneDarkHighlightStyle:()=>tQ.kS,oneDarkTheme:()=>tQ.y,panels:()=>s.C3,placeholder:()=>s.qf,rectangularSelection:()=>s.D4,repositionTooltips:()=>s.Pq,runScopeHandlers:()=>s.TS,scrollPastEnd:()=>s.BE,showDialog:()=>s.ui,showPanel:()=>s.S7,showTooltip:()=>s.DK,tooltips:()=>s.vX,useCodeMirror:()=>ne});var i=n(2115),o=n(5395),s=n(8082),l=n(5721),a=n(8348);function c(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}let h=c(function(e,t,n=t.selection.ranges){let r=[],i=-1;e:for(let{from:e,to:o}of n){let n=r.length,s=1e9,l;for(let n=e;n<=o;){let a=t.doc.lineAt(n);if(void 0==l&&!(l=d(t,a.from).line))continue e;if(a.from>i&&(e==o||o>a.from)){i=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;e<a.text.length&&e<s&&(s=e),r.push({line:a,comment:n,token:l,indent:e,empty:t,single:!1})}n=a.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)(s||!o)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null},0),u=c(m,0),f=c((e,t)=>m(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function d(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function m(e,t,n=t.selection.ranges){let r=n.map(e=>d(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let o,s,l=e.sliceDoc(r-50,r),a=e.sliceDoc(i,i+50),c=/\s*$/.exec(l)[0].length,h=/^\s*/.exec(a)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&a.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=100?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+50),s=e.sliceDoc(i-50,i));let f=/^\s*/.exec(o)[0].length,d=/\s*$/.exec(s)[0].length,m=s.length-d-n.length;return o.slice(f,f+t.length)==t&&s.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(o.charAt(f+t.length))},close:{pos:i-d-n.length,margin:+!!/\s/.test(s.charAt(m-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:o,close:s}=n;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}let p=o.YH.define(),g=o.YH.define(),v=o.sj.define(),y=o.sj.define({combine:e=>(0,o.QR)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),x=o.sU.define({create:()=>T.empty,update(e,t){let n=t.state.facet(y),r=t.annotation(p);if(r){let i=M.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?D(s,s.length,n.minDepth,i):F(s,t.startState.selection),new T(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(g);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(o.ZX.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=M.fromTransaction(t),l=t.annotation(o.ZX.time),a=t.annotation(o.ZX.userEvent);return s?e=e.addChanges(s,l,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,l,a,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new T(e.done.map(M.fromJSON),e.undone.map(M.fromJSON))});function w(e={}){return[x,y.of(e),s.Lz.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?b:"historyRedo"==e.inputType?S:null;return!!n&&(e.preventDefault(),n(t))}})]}function k(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(x,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}let b=k(0,!1),S=k(1,!1),A=k(0,!0),C=k(1,!0);class M{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new M(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new M(e.changes&&o.VR.fromJSON(e.changes),[],e.mapped&&o.Gu.fromJSON(e.mapped),e.startSelection&&o.OF.fromJSON(e.startSelection),e.selectionsAfter.map(o.OF.fromJSON))}static fromTransaction(e,t){let n=L;for(let t of e.startState.facet(v)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new M(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,L)}static selection(e){return new M(void 0,L,void 0,void 0,e)}}function D(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function O(e,t){return e.length?t.length?e.concat(t):e:t}let L=[];function F(e,t){if(!e.length)return[M.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),D(e,e.length-1,1e9,n.setSelAfter(r)))}}function E(e,t){if(!e.length)return e;let n=e.length,r=L;for(;n;){let i=function(e,t,n){let r=O(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):L,n);if(!e.changes)return M.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),l=e.mapped?e.mapped.composeDesc(s):s;return new M(i,o.Pe.mapEffects(e.effects,t),l,e.startSelection.map(s),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[M.selection(r)]:L}let R=/^(input\.type|delete)($|\.)/;class T{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new T(this.done,this.undone):this}addChanges(e,t,n,r,i){var s,l;let a,c,h=this.done,u=h[h.length-1];return new T(h=u&&u.changes&&!u.changes.empty&&e.changes&&(!n||R.test(n))&&(!u.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(s=u.changes,l=e.changes,a=[],c=!1,s.iterChangedRanges((e,t)=>a.push(e,t)),l.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<a.length;){let t=a[e++],i=a[e++];r>=t&&n<=i&&(c=!0)}}),c))||"input.type.compose"==n)?D(h,h.length-1,r.minDepth,new M(e.changes.compose(u.changes),O(o.Pe.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,L)):D(h,h.length,r.minDepth,e),L,t,n)}addSelection(e,t,n,r){var i;let o=this.done.length?this.done[this.done.length-1].selectionsAfter:L;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new T(F(this.done,e),this.undone,t,n)}addMapping(e){return new T(E(this.done,e),E(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length){let n,s;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:p.of({side:e,rest:(n=r[r.length-1],(s=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),s),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let n=1==r.length?L:r.slice(0,r.length-1);return i.mapped&&(n=E(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:p.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}T.empty=new T(L,L);let B=[{key:"Mod-z",run:b,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:S,preventDefault:!0},{linux:"Ctrl-Shift-z",run:S,preventDefault:!0},{key:"Mod-u",run:A,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:C,preventDefault:!0}];function z(e,t){return o.OF.create(e.ranges.map(t),e.mainIndex)}function P(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function I({state:e,dispatch:t},n){let r=z(e.selection,n);return!r.eq(e.selection,!0)&&(t(P(e,r)),!0)}function N(e,t){return o.OF.cursor(t?e.to:e.from)}function W(e,t){return I(e,n=>n.empty?e.moveByChar(n,t):N(n,t))}function q(e){return e.textDirectionAt(e.state.selection.main.head)==s.OP.LTR}let H=e=>W(e,!q(e)),$=e=>W(e,q(e));function J(e,t){return I(e,n=>n.empty?e.moveByGroup(n,t):N(n,t))}function U(e,t,n){let r,i,s=(0,l.mv)(e).resolveInner(t.head),c=n?a.uY.closedBy:a.uY.openedBy;for(let r=t.head;;){let t=n?s.childAfter(r):s.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,c)?r=n?t.to:t.from:s=t}return i=s.type.prop(c)&&(r=n?(0,l.jU)(e,s.from,1):(0,l.jU)(e,s.to,-1))&&r.matched?n?r.end.to:r.end.from:n?s.to:s.from,o.OF.cursor(i,n?-1:1)}function V(e,t){return I(e,n=>{if(!n.empty)return N(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;let K=e=>V(e,!1),Z=e=>V(e,!0);function j(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(s.Lz.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(r=Math.max(null==i?void 0:i.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function G(e,t){let n,r=j(e),{state:i}=e,o=z(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):N(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+r.marginTop,c=l.bottom-r.marginBottom;t&&t.top>a&&t.bottom<c&&(n=s.Lz.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(P(i,o),{effects:n}),!0}let _=e=>G(e,!1),Y=e=>G(e,!0);function Q(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=o.OF.cursor(r.from+n))}return i}function X(e,t,n){let r=z(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=o.OF.range(e.head,e.anchor));let r=n(e);return o.OF.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(P(e.state,r)),!0)}function ee(e,t){return X(e,t,n=>e.moveByChar(n,t))}let et=e=>ee(e,!q(e)),en=e=>ee(e,q(e));function er(e,t){return X(e,t,n=>e.moveByGroup(n,t))}function ei(e,t){return X(e,t,n=>e.moveVertically(n,t))}let eo=e=>ei(e,!1),es=e=>ei(e,!0);function el(e,t){return X(e,t,n=>e.moveVertically(n,t,j(e).height))}let ea=e=>el(e,!1),ec=e=>el(e,!0),eh=({state:e,dispatch:t})=>(t(P(e,{anchor:0})),!0),eu=({state:e,dispatch:t})=>(t(P(e,{anchor:e.doc.length})),!0),ef=({state:e,dispatch:t})=>(t(P(e,{anchor:e.selection.main.anchor,head:0})),!0),ed=({state:e,dispatch:t})=>(t(P(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function em(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(P(n,o.OF.create(i,i.length-1))),!0)}function ep(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:s}=r;if(i==s){let o=t(r);o<i?(n="delete.backward",o=eg(e,o,!1)):o>i&&(n="delete.forward",o=eg(e,o,!0)),i=Math.min(i,o),s=Math.max(s,o)}else i=eg(e,i,!1),s=eg(e,s,!0);return i==s?{range:r}:{changes:{from:i,to:s},range:o.OF.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?s.Lz.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function eg(e,t,n){if(e instanceof s.Lz)for(let r of e.state.facet(s.Lz.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let ev=(e,t,n)=>ep(e,r=>{let i=r.from,{state:s}=e,a=s.doc.lineAt(i),c,h;if(n&&!t&&i>a.from&&i<a.from+200&&!/[^ \t]/.test(c=a.text.slice(0,i-a.from))){if(" "==c[c.length-1])return i-1;let e=(0,o.y$)(c,s.tabSize)%(0,l.tp)(s)||(0,l.tp)(s);for(let t=0;t<e&&" "==c[c.length-1-t];t++)i--;h=i}else(h=(0,o.zK)(a.text,i-a.from,t,t)+a.from)==i&&a.number!=(t?s.doc.lines:1)?h+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(h-a.from,i-a.from))&&(h=(0,o.zK)(a.text,h-a.from,!1,!1)+a.from);return h}),ey=e=>ev(e,!1,!0),ex=e=>ev(e,!0,!1),ew=(e,t)=>ep(e,n=>{let r=n.head,{state:i}=e,s=i.doc.lineAt(r),l=i.charCategorizer(r);for(let e=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=(0,o.zK)(s.text,r-s.from,t)+s.from,c=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),h=l(c);if(null!=e&&h!=e)break;(" "!=c||r!=n.head)&&(e=h),r=a}return r}),ek=e=>ew(e,!1);function eb(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function eS(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of eb(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),l=s.length+1;if(n)for(let n of(r.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak}),t.ranges))i.push(o.OF.range(Math.min(e.doc.length,n.anchor+l),Math.min(e.doc.length,n.head+l)));else for(let n of(r.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text}),t.ranges))i.push(o.OF.range(n.anchor-l,n.head-l))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:o.OF.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function eA(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of eb(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let eC=eD(!1),eM=eD(!0);function eD(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,s=t.doc.lineAt(r),c=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=(0,l.mv)(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),o;return r&&i&&r.to<=t&&i.from>=t&&(o=r.type.prop(a.uY.closedBy))&&o.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=s.to?s:t.doc.lineAt(i)).to);let h=new l.KB(t,{simulateBreak:r,simulateDoubleBreak:!!c}),u=(0,l._v)(h,r);for(null==u&&(u=(0,o.y$)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<s.to&&/\s/.test(s.text[i-s.from]);)i++;c?{from:r,to:i}=c:r>s.from&&r<s.from+100&&!/\S/.test(s.text.slice(0,r))&&(r=s.from);let f=["",(0,l.EI)(t,u)];return c&&f.push((0,l.EI)(t,h.lineIndent(s.from,-1))),{changes:{from:r,to:i,insert:o.EY.of(f)},range:o.OF.cursor(r+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function eO(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let s=e.changes(i);return{changes:i,range:o.OF.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}let eL=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eO(e,(t,n)=>{n.push({from:t.from,insert:e.facet(l.Xt)})}),{userEvent:"input.indent"})),!0),eF=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(eO(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=(0,o.y$)(r,e.tabSize),s=0,a=(0,l.EI)(e,Math.max(0,i-(0,l.tp)(e)));for(;s<r.length&&s<a.length&&r.charCodeAt(s)==a.charCodeAt(s);)s++;n.push({from:t.from+s,to:t.from+r.length,insert:a.slice(s)})}),{userEvent:"delete.dedent"})),!0),eE=[{key:"Ctrl-b",run:H,shift:et,preventDefault:!0},{key:"Ctrl-f",run:$,shift:en},{key:"Ctrl-p",run:K,shift:eo},{key:"Ctrl-n",run:Z,shift:es},{key:"Ctrl-a",run:e=>I(e,t=>e.moveToLineBoundary(t,!1,!1)),shift:e=>X(e,!1,t=>o.OF.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>I(e,t=>e.moveToLineBoundary(t,!0,!1)),shift:e=>X(e,!0,t=>o.OF.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:ex},{key:"Ctrl-h",run:ey},{key:"Ctrl-k",run:e=>ep(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:ek},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:o.EY.of(["",""])},range:o.OF.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:(0,o.zK)(r.text,n-r.from,!1)+r.from,s=n==r.to?n+1:(0,o.zK)(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(i,n))},range:o.OF.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Y}],eR=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>I(e,t=>U(e.state,t,!q(e))),shift:e=>{let t=!q(e);return X(e,t,n=>U(e.state,n,t))}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>I(e,t=>U(e.state,t,q(e))),shift:e=>{let t=q(e);return X(e,t,n=>U(e.state,n,t))}},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>eS(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>eA(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>eS(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>eA(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>em(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>em(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=o.OF.create([n.main]):n.main.empty||(r=o.OF.create([o.OF.cursor(n.main.head)])),!!r&&(t(P(e,r)),!0)}},{key:"Mod-Enter",run:eM},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=eb(e).map(({from:t,to:n})=>o.OF.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:o.OF.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=z(e.selection,t=>{let n=(0,l.mv)(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return o.OF.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(P(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:eF},{key:"Mod-]",run:eL},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new l.KB(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=eO(e,(t,i,o)=>{let s=(0,l._v)(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],c=(0,l.EI)(e,s);(a!=c||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(eb(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=z(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>(function(e,t,n){let r=!1,i=z(e.selection,t=>{let i=(0,l.jU)(e,t.head,-1)||(0,l.jU)(e,t.head,1)||t.head>0&&(0,l.jU)(e,t.head-1,1)||t.head<e.doc.length&&(0,l.jU)(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let s=i.start.from==t.head?i.end.to:i.end.from;return n?o.OF.range(t.anchor,s):o.OF.cursor(s)});return!!r&&(t(P(e,i)),!0)})(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=d(e.state,n.from);return r.line?h(e):!!r.block&&f(e)}},{key:"Alt-A",mac:"Ctrl-A",run:u},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:H,shift:et,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>J(e,!q(e)),shift:e=>er(e,!q(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>I(e,t=>Q(e,t,!q(e))),shift:e=>{let t=!q(e);return X(e,t,n=>Q(e,n,t))},preventDefault:!0},{key:"ArrowRight",run:$,shift:en,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>J(e,q(e)),shift:e=>er(e,q(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>I(e,t=>Q(e,t,q(e))),shift:e=>{let t=q(e);return X(e,t,n=>Q(e,n,t))},preventDefault:!0},{key:"ArrowUp",run:K,shift:eo,preventDefault:!0},{mac:"Cmd-ArrowUp",run:eh,shift:ef},{mac:"Ctrl-ArrowUp",run:_,shift:ea},{key:"ArrowDown",run:Z,shift:es,preventDefault:!0},{mac:"Cmd-ArrowDown",run:eu,shift:ed},{mac:"Ctrl-ArrowDown",run:Y,shift:ec},{key:"PageUp",run:_,shift:ea},{key:"PageDown",run:Y,shift:ec},{key:"Home",run:e=>I(e,t=>Q(e,t,!1)),shift:e=>X(e,!1,t=>Q(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:eh,shift:ef},{key:"End",run:e=>I(e,t=>Q(e,t,!0)),shift:e=>X(e,!0,t=>Q(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:eu,shift:ed},{key:"Enter",run:eC,shift:eC},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:ey,shift:ey,preventDefault:!0},{key:"Delete",run:ex,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ek,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>ew(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>ep(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>ep(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(eE.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),eT={key:"Tab",run:eL,shift:eF};var eB=n(5029);let ez="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class eP{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ez(e)):ez,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return(0,o.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,o.MK)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,o.Fh)(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,o=!0;;e++){let n=r.charCodeAt(e),s=this.match(n,i,o,this.bufferPos+this.bufferStart,e==r.length-1);if(s)return this.value=s,this;if(e==r.length-1)break;o&&e<t.length&&t.charCodeAt(e)==n?i++:o=!1}}}match(e,t,n,r,i){let o=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],s=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?o={from:n.from,to:r,precise:i&&n.precise}:(n.index++,s=!0)),s?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?o={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}"undefined"!=typeof Symbol&&(eP.prototype[Symbol.iterator]=function(){return this});let eI={from:-1,to:-1,match:/.*/.exec(""),precise:!0},eN="gm"+(null==/x/.unicode?"":"u");class eW{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=eI,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new e$(e,t,n,r,i);this.re=new RegExp(t,eN+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=eJ(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=eJ(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let eq=new WeakMap;class eH{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=eq.get(e);if(!r||r.from>=n||r.to<=t){let r=new eH(t,e.sliceString(t,n));return eq.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),eq.set(e,new eH(o,i)),new eH(t,i.slice(t-o,n-o))}}class e${constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=eI,this.matchPos=eJ(e,r),this.re=new RegExp(t,eN+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=eH.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if(this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10){if(this.matchPos=eJ(this.text,n+ +(e==n)),this.test&&!this.test(e,n,t))continue;return this.value={from:e,to:n,precise:!0,match:t},this}}if(this.flat.to==this.to)return this.done=!0,this;this.flat=eH.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function eJ(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"undefined"!=typeof Symbol&&(eW.prototype[Symbol.iterator]=e$.prototype[Symbol.iterator]=function(){return this});let eU={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},eV=o.sj.define({combine:e=>(0,o.QR)(e,eU,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),eK=s.NZ.mark({class:"cm-selectionMatch"}),eZ=s.NZ.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ej(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=o.Je.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=o.Je.Word)}let eG=s.Z9.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(eV),{state:n}=e,r=n.selection;if(r.ranges.length>1)return s.NZ.none;let i=r.main,l,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return s.NZ.none;let e=n.wordAt(i.head);if(!e)return s.NZ.none;a=n.charCategorizer(i.head),l=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return s.NZ.none;if(t.wholeWords){var c,h,u;if(l=n.sliceDoc(i.from,i.to),!(ej(a=n.charCategorizer(i.head),n,i.from,i.to)&&(c=a,h=i.from,u=i.to,c(n.sliceDoc(h,h+1))==o.Je.Word&&c(n.sliceDoc(u-1,u))==o.Je.Word)))return s.NZ.none}else if(!(l=n.sliceDoc(i.from,i.to)))return s.NZ.none}let f=[];for(let r of e.visibleRanges){let e=new eP(n.doc,l,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!a||ej(a,n,r,o))&&(i.empty&&r<=i.from&&o>=i.to?f.push(eZ.range(r,o)):(r>=i.to||o<=i.from)&&f.push(eK.range(r,o)),f.length>t.maxMatches))return s.NZ.none}}return s.NZ.set(f)}},{decorations:e=>e.decorations}),e_=s.Lz.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),eY=o.sj.define({combine:e=>(0,o.QR)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new tg(e),scrollToMatch:e=>s.Lz.scrollIntoView(e)})});class eQ{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,eN),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new e4(this):new e1(this)}getCursor(e,t=0,n){let r=e.doc?e:o.$t.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?e3(this,r,t,n):e0(this,r,t,n)}}class eX{constructor(e){this.spec=e}}function e0(e,t,n,r){var i,s,l,a;let c;return e.wholeWord&&(l=t.doc,a=t.charCategorizer(t.selection.main.head),c=(e,t,n,r)=>((r>=e||r+n.length<=t)&&(r=Math.max(0,e-2),n=l.sliceString(r,Math.min(l.length,t+2))),(a(e5(n,e-r))!=o.Je.Word||a(e2(n,e-r))!=o.Je.Word)&&(a(e2(n,t-r))!=o.Je.Word||a(e5(n,t-r))!=o.Je.Word))),e.test&&(i=e.test,s=c,c=(e,n,r,o)=>(!s||!!s(e,n,r,o))&&i(e>=o&&n<=o+r.length?r.slice(e-o,n-o):t.doc.sliceString(e,n),t,e,n)),new eP(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),c)}class e1 extends eX{constructor(e){super(e)}nextMatch(e,t,n){let r=e0(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=e0(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=e0(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=e0(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=e0(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function e3(e,t,n,r){var i,s,l;let a;return e.wholeWord&&(l=t.charCategorizer(t.selection.main.head),a=(e,t,n)=>!n[0].length||(l(e5(n.input,n.index))!=o.Je.Word||l(e2(n.input,n.index))!=o.Je.Word)&&(l(e2(n.input,n.index+n[0].length))!=o.Je.Word||l(e5(n.input,n.index+n[0].length))!=o.Je.Word)),e.test&&(i=e.test,s=a,a=(e,n,r)=>(!s||s(e,n,r))&&i(r[0],t,e,n)),new eW(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:a},n,r)}function e5(e,t){return e.slice((0,o.zK)(e,t,!1),t)}function e2(e,t){return e.slice(t,(0,o.zK)(e,t))}class e4 extends eX{nextMatch(e,t,n){let r=e3(this.spec,e,n,e.doc.length).next();return r.done&&(r=e3(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=e3(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=e3(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=e3(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let e9=o.Pe.define(),e6=o.Pe.define(),e8=o.sU.define({create:e=>new e7(th(e).create(),null),update(e,t){for(let n of t.effects)n.is(e9)?e=new e7(n.value.create(),e.panel):n.is(e6)&&(e=new e7(e.query,n.value?tc:null));return e},provide:e=>s.S7.from(e,e=>e.panel)});class e7{constructor(e,t){this.query=e,this.panel=t}}let te=s.NZ.mark({class:"cm-searchMatch"}),tt=s.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),tn=s.Z9.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(e8))}update(e){let t=e.state.field(e8);(t!=e.startState.field(e8)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return s.NZ.none;let{view:n}=this,r=new o.vB;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:l}=i[t];for(;t<o-1&&l>i[t+1].from-500;)l=i[++t].to;e.highlight(n.state,s,l,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?tt:te)})}return r.finish()}},{decorations:e=>e.decorations});function tr(e){return t=>{let n=t.state.field(e8,!1);return n&&n.query.spec.valid?e(t,n):td(t)}}let ti=tr((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=o.OF.single(r.from,r.to),s=e.state.facet(eY);return e.dispatch({selection:i,effects:[tx(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),tf(e),!0}),to=tr((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=o.OF.single(i.from,i.to),l=e.state.facet(eY);return e.dispatch({selection:s,effects:[tx(e,i),l.scrollToMatch(s.main,e)],userEvent:"select.search"}),tf(e),!0}),ts=tr((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:o.OF.create(n.map(e=>o.OF.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),tl=tr((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let l=t.nextMatch(n,r,r);if(!l)return!1;let a=l,c=[],h,u,f=[];a.precise?a.from==r&&a.to==i&&(u=n.toText(t.getReplacement(a)),c.push({from:a.from,to:a.to,insert:u}),a=t.nextMatch(n,a.from,a.to),f.push(s.Lz.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):a=t.nextMatch(n,a.from,a.to);let d=e.state.changes(c);return a&&(h=o.OF.single(a.from,a.to).map(d),f.push(tx(e,a)),f.push(n.facet(eY).scrollToMatch(h.main,e))),e.dispatch({changes:d,selection:h,effects:f,userEvent:"input.replace"}),!0}),ta=tr((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:o}=r;o&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:s.Lz.announce.of(r),userEvent:"input.replace.all"}),!0});function tc(e){return e.state.facet(eY).createPanel(e)}function th(e,t){var n,r,i,o,s;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(eY);return new eQ({search:(null!=(n=null==t?void 0:t.literal)?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:c.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:c.literal,regexp:null!=(o=null==t?void 0:t.regexp)?o:c.regexp,wholeWord:null!=(s=null==t?void 0:t.wholeWord)?s:c.wholeWord})}function tu(e){let t=(0,s.ld)(e,tc);return t&&t.dom.querySelector("[main-field]")}function tf(e){let t=tu(e);t&&t==e.root.activeElement&&t.select()}let td=e=>{let t=e.state.field(e8,!1);if(t&&t.panel){let n=tu(e);if(n&&n!=e.root.activeElement){let r=th(e.state,t.query.spec);r.valid&&e.dispatch({effects:e9.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[e6.of(!0),t?e9.of(th(e.state,t.query.spec)):o.Pe.appendConfig.of(tk)]});return!0},tm=e=>{let t=e.state.field(e8,!1);if(!t||!t.panel)return!1;let n=(0,s.ld)(e,tc);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:e6.of(!1)}),!0},tp=[{key:"Mod-f",run:td,scope:"editor search-panel"},{key:"F3",run:ti,shift:to,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ti,shift:to,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tm,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],l=0;for(let t=new eP(e.doc,e.sliceDoc(r,i));!t.next().done;){if(s.length>1e3)return!1;t.value.from==r&&(l=s.length),s.push(o.OF.range(t.value.from,t.value.to))}return t(e.update({selection:o.OF.create(s,l),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=(0,s.rC)(e,"cm-goto-line");if(t){let e=t.dom.querySelector("input[type=text]");return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:l}=(0,s.ui)(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return l.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r)return void e.dispatch({effects:i});let l=n.doc.lineAt(n.selection.main.head),[,a,c,h,u]=r,f=h?+h.slice(1):0,d=c?+c:l.number;if(c&&u){let e=d/100;a&&(e=e*("-"==a?-1:1)+l.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else c&&a&&(d=d*("-"==a?-1:1)+l.number);let m=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=o.OF.cursor(m.from+Math.max(0,Math.min(f,m.length)));e.dispatch({effects:[i,s.Lz.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=o.OF.create(n.ranges.map(t=>e.wordAt(t.head)||o.OF.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new eP(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new eP(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(o.OF.range(i.from,i.to),!1),effects:s.Lz.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class tg{constructor(e){this.view=e;let t=this.query=e.state.field(e8).query.spec;function n(e,t,n){return(0,eB.A)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=(0,eB.A)("input",{value:t.search,placeholder:tv(e,"Find"),"aria-label":tv(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,eB.A)("input",{value:t.replace,placeholder:tv(e,"Replace"),"aria-label":tv(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,eB.A)("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=(0,eB.A)("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=(0,eB.A)("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=(0,eB.A)("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>ti(e),[tv(e,"next")]),n("prev",()=>to(e),[tv(e,"previous")]),n("select",()=>ts(e),[tv(e,"all")]),(0,eB.A)("label",null,[this.caseField,tv(e,"match case")]),(0,eB.A)("label",null,[this.reField,tv(e,"regexp")]),(0,eB.A)("label",null,[this.wordField,tv(e,"by word")]),...e.state.readOnly?[]:[(0,eB.A)("br"),this.replaceField,n("replace",()=>tl(e),[tv(e,"replace")]),n("replaceAll",()=>ta(e),[tv(e,"replace all")])],(0,eB.A)("button",{name:"close",onclick:()=>tm(e),"aria-label":tv(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new eQ({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:e9.of(e)}))}keydown(e){(0,s.TS)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?to:ti)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),tl(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(e9)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(eY).top}}function tv(e,t){return e.state.phrase(t)}let ty=/[\s\.,:;?!]/;function tx(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-30),l=Math.min(i,n+30),a=e.state.sliceDoc(o,l);if(o!=r.from){for(let e=0;e<30;e++)if(!ty.test(a[e+1])&&ty.test(a[e])){a=a.slice(e);break}}if(l!=i){for(let e=a.length-1;e>a.length-30;e--)if(!ty.test(a[e-1])&&ty.test(a[e])){a=a.slice(0,e);break}}return s.Lz.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}let tw=s.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),tk=[e8,o.Nb.low(tn),tw];var tb=n(3685);class tS{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class tA{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(tz).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),l=new o.vB,a=[],c=0,h=n.doc.iter(),u=0,f=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!a.length)break;if(a.length)t=c,n=a.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>f)break;n=r.to,a.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from==t&&(r.to>r.from||r.to==t))a.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,f);let o=!1;if(a.some(e=>e.from==t&&(e.to==n||n==f))&&!(o=t==n)&&n-t<10){let e=t-(u+h.value.length);e>0&&(h.next(e),u=t);for(let e=t;;){if(e>=n){o=!0;break}if(!h.lineBreak&&u+h.value.length>e)break;e=u+h.value.length,u+=h.value.length,h.next()}}let d=tU(a);if(o)l.add(t,t,s.NZ.widget({widget:new tW(d),diagnostics:a.slice()}));else{let e=a.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");l.add(t,n,s.NZ.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:a.slice(),inclusiveEnd:a.some(e=>e.to>n)}))}if((c=n)==f)break;for(let e=0;e<a.length;e++)a[e].to<=c&&a.splice(e--,1)}let d=l.finish();return new tA(d,t,tC(d))}}function tC(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(r){if(0>i.diagnostics.indexOf(r.diagnostic))return!1;r=new tS(r.from,n,r.diagnostic)}else r=new tS(e,n,t||i.diagnostics[0])}),r}function tM(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(tz).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(tD))||e.changes.touchesRange(o.from,Math.max(o.to,r)))}let tD=o.Pe.define(),tO=o.Pe.define(),tL=o.Pe.define(),tF=o.sU.define({create:()=>new tA(s.NZ.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=tC(n,e.selected.diagnostic,i)||tC(n,null,i)}!n.size&&i&&t.state.facet(tz).autoPanel&&(i=null),e=new tA(n,i,r)}for(let n of t.effects)if(n.is(tD)){let r=t.state.facet(tz).autoPanel?n.value.length?tH.open:null:e.panel;e=tA.init(n.value,r,t.state)}else n.is(tO)?e=new tA(e.diagnostics,n.value?tH.open:null,e.selected):n.is(tL)&&(e=new tA(e.diagnostics,e.panel,n.value));return e},provide:e=>[s.S7.from(e,e=>e.panel),s.Lz.decorations.from(e,e=>e.diagnostics)]}),tE=s.NZ.mark({class:"cm-lintRange cm-lintRange-active"});function tR(e,t){return(0,eB.A)("ul",{class:"cm-tooltip-lint"},t.map(t=>tN(e,t,!1)))}let tT=e=>{let t=e.state.field(tF,!1);return!!t&&!!t.panel&&(e.dispatch({effects:tO.of(!1)}),!0)},tB=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(tF,!1);t&&t.panel||e.dispatch({effects:function(e,t){return e.field(tF,!1)?t:t.concat(o.Pe.appendConfig.of(tj))}(e.state,[tO.of(!0)])});let n=(0,s.ld)(e,tH.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(tF,!1);if(!t)return!1;let n=e.state.selection.main,r=tC(t.diagnostics,null,n.to+1);return(!!r||!!(r=tC(t.diagnostics,null,0))&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),(0,s.ab)(e,r.from,1,{tooltip:tZ,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],tz=o.sj.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...(0,o.QR)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:tP,tooltipFilter:tP,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function tP(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function tI(e){let t=[];if(e)t:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue t}}t.push("")}return t}function tN(e,t,n){var r;let i=n?tI(t.actions):[];return(0,eB.A)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,eB.A)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let o=0,s=r=>{if(r.preventDefault(),o>Date.now()-100)return;let i=tC(e.state.field(tF).diagnostics,t);i&&n.apply(e,i.from,i.to),o=Date.now()},{name:l}=n,a=i[r]?l.indexOf(i[r]):-1,c=a<0?l:[l.slice(0,a),(0,eB.A)("u",l.slice(a,a+1)),l.slice(a+1)],h=n.markClass?" "+n.markClass:"";return(0,eB.A)("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&(0,eB.A)("div",{class:"cm-diagnosticSource"},t.source))}class tW extends s.xO{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,eB.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class tq{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=tN(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class tH{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)tT(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=tI(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=tC(this.view.state.field(tF).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=(0,eB.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=(0,eB.A)("div",{class:"cm-panel-lint"},this.list,(0,eB.A)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>tT(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(tF).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(tF),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:l})=>{for(let e of l.diagnostics){if(o.has(e))continue;o.add(e);let s=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){s=t;break}s<0?(l=new tq(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[s],s>n&&(this.items.splice(n,s-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),i=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new tq(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=tC(this.view.state.field(tF).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:tL.of(t)})}static open(e){return new tH(e)}}function t$(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let tJ=s.Lz.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:t$("#f11")},".cm-lintRange-warning":{backgroundImage:t$("orange")},".cm-lintRange-info":{backgroundImage:t$("#999")},".cm-lintRange-hint":{backgroundImage:t$("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function tU(e){let t="hint",n=1;for(let i of e){var r;let e="error"==(r=i.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=i.severity)}return t}s.wJ;let tV=o.Pe.define(),tK=o.sU.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=tM(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(tV)?t.value:e,e)),provide:e=>s.DK.from(e)}),tZ=(0,s.Ux)(function(e,t,n){let{diagnostics:r}=e.state.field(tF),i,o=-1,s=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,o=e,s=r,!1});let l=e.state.facet(tz).tooltipFilter;return(i&&l&&(i=l(i,e.state)),i)?{pos:o,end:s,above:!0,create:()=>({dom:tR(e,i)})}:null},{hideOn:tM}),tj=[tF,s.Lz.decorations.compute([tF],e=>{let{selected:t,panel:n}=e.field(tF);return t&&n&&t.from!=t.to?s.NZ.set([tE.range(t.from,t.to)]):s.NZ.none}),tZ,tJ],tG=o.sj.define({combine:e=>(0,o.QR)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});var t_=function(e){void 0===e&&(e={});var t=e.crosshairCursor,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(tb.Bc)),!1!==e.defaultKeymap&&(n=n.concat(eR)),!1!==e.searchKeymap&&(n=n.concat(tp)),!1!==e.historyKeymap&&(n=n.concat(B)),!1!==e.foldKeymap&&(n=n.concat(l.f7)),!1!==e.completionKeymap&&(n=n.concat(tb.OO)),!1!==e.lintKeymap&&(n=n.concat(tB));var r=[];return!1!==e.lineNumbers&&r.push((0,s.$K)()),!1!==e.highlightActiveLineGutter&&r.push((0,s.Wu)()),!1!==e.highlightSpecialChars&&r.push((0,s.N$)()),!1!==e.history&&r.push(w()),!1!==e.foldGutter&&r.push((0,l.Lv)()),!1!==e.drawSelection&&r.push((0,s.VH)()),!1!==e.dropCursor&&r.push((0,s.A)()),!1!==e.allowMultipleSelections&&r.push(o.$t.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push((0,l.WD)()),!1!==e.syntaxHighlighting&&r.push((0,l.y9)(l.Zt,{fallback:!0})),!1!==e.bracketMatching&&r.push((0,l.SG)()),!1!==e.closeBrackets&&r.push((0,tb.wm)()),!1!==e.autocompletion&&r.push((0,tb.yU)()),!1!==e.rectangularSelection&&r.push((0,s.D4)()),!1!==(void 0!==t&&t)&&r.push((0,s.HJ)()),!1!==e.highlightActiveLine&&r.push((0,s.dz)()),!1!==e.highlightSelectionMatches&&r.push([e_,eG]),e.tabSize&&"number"==typeof e.tabSize&&r.push(l.Xt.of(" ".repeat(e.tabSize))),r.concat([s.w4.of(n.flat())]).filter(Boolean)},tY=function(e){void 0===e&&(e={});var t=[];!1!==e.defaultKeymap&&(t=t.concat(eR)),!1!==e.historyKeymap&&(t=t.concat(B));var n=[];return!1!==e.highlightSpecialChars&&n.push((0,s.N$)()),!1!==e.history&&n.push(w()),!1!==e.drawSelection&&n.push((0,s.VH)()),!1!==e.syntaxHighlighting&&n.push((0,l.y9)(l.Zt,{fallback:!0})),n.concat([s.w4.of(t.flat())]).filter(Boolean)},tQ=n(3364),tX=s.Lz.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),t0=function(e){void 0===e&&(e={});var t=e,n=t.indentWithTab,r=t.editable,i=t.readOnly,l=t.theme,a=void 0===l?"light":l,c=t.placeholder,h=void 0===c?"":c,u=t.basicSetup,f=void 0===u||u,d=[];switch((void 0===n||n)&&d.unshift(s.w4.of([eT])),f&&("boolean"==typeof f?d.unshift(t_()):d.unshift(t_(f))),h&&d.unshift((0,s.qf)(h)),a){case"light":d.push(tX);break;case"dark":d.push(tQ.bM);break;case"none":break;default:d.push(a)}return!1===(void 0===r||r)&&d.push(s.Lz.editable.of(!1)),void 0!==i&&i&&d.push(o.$t.readOnly.of(!0)),[...d]},t1=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)});class t3{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class t5{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var t2=null,t4=s.Lz.theme({"& .cm-scroller":{height:"100% !important"}}),t9=null,t6=null,t8=o.YH.define(),t7=[];function ne(e){var t=e.value,n=e.selection,r=e.onChange,l=e.onStatistics,a=e.onCreateEditor,c=e.onUpdate,h=e.extensions,u=void 0===h?t7:h,f=e.autoFocus,d=e.theme,m=void 0===d?"light":d,p=e.height,g=void 0===p?null:p,v=e.minHeight,y=void 0===v?null:v,x=e.maxHeight,w=void 0===x?null:x,k=e.width,b=void 0===k?null:k,S=e.minWidth,A=void 0===S?null:S,C=e.maxWidth,M=void 0===C?null:C,D=e.placeholder,O=void 0===D?"":D,L=e.editable,F=void 0===L||L,E=e.readOnly,R=void 0!==E&&E,T=e.indentWithTab,B=void 0===T||T,z=e.basicSetup,P=void 0===z||z,I=e.root,N=e.initialState,W=(0,i.useState)(),q=W[0],H=W[1],$=(0,i.useState)(),J=$[0],U=$[1],V=(0,i.useState)(),K=V[0],Z=V[1],j=(0,i.useState)(()=>({current:null}))[0],G=(0,i.useState)(()=>({current:null}))[0],_=function(e,t,n,r,i,o){if(!e&&!t&&!n&&!r&&!i&&!o)return null;var l=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:o});return l===t9?t6:(t9=l,t6=s.Lz.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:o}}))}(g,y,w,b,A,M),Y=[s.Lz.updateListener.of(e=>{e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(t8))&&(j.current?j.current.reset():(j.current=new t3(()=>{if(G.current){var e=G.current;G.current=null,e()}j.current=null},200),("undefined"==typeof window?new t5:(!t2&&(t2=new t5),t2)).add(j.current)),r(e.state.doc.toString(),e)),l&&l(t1(e))}),..._?[_]:[],t4,...t0({theme:m,editable:F,readOnly:R,placeholder:O,indentWithTab:B,basicSetup:P})];return c&&"function"==typeof c&&Y.push(s.Lz.updateListener.of(c)),Y=Y.concat(u),(0,i.useLayoutEffect)(()=>{if(q&&!K){var e={doc:t,selection:n,extensions:Y},r=N?o.$t.fromJSON(N.json,e,N.fields):o.$t.create(e);if(Z(r),!J){var i=new s.Lz({state:r,parent:q,root:I});U(i),a&&a(i,r)}}return()=>{J&&(Z(void 0),U(void 0))}},[q,K]),(0,i.useEffect)(()=>{e.container&&H(e.container)},[e.container]),(0,i.useEffect)(()=>()=>{J&&(J.destroy(),U(void 0)),j.current&&(j.current.cancel(),j.current=null)},[J]),(0,i.useEffect)(()=>{f&&J&&J.focus()},[f,J]),(0,i.useEffect)(()=>{J&&J.dispatch({effects:o.Pe.reconfigure.of(Y)})},[m,u,g,y,w,b,A,M,O,F,R,B,P,r,c]),(0,i.useEffect)(()=>{if(void 0!==t){var e=J?J.state.doc.toString():"";if(J&&t!==e){var n=j.current&&!j.current.isDone,r=()=>{J&&t!==J.state.doc.toString()&&J.dispatch({changes:{from:0,to:J.state.doc.toString().length,insert:t||""},annotations:[t8.of(!0)]})};n?G.current=r:r()}}},[t,J]),{state:K,setState:Z,view:J,setView:U,container:q,setContainer:H}}var nt=n(5155),nn=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],nr=(0,i.forwardRef)((e,t)=>{var n=e.className,o=e.value,s=void 0===o?"":o,l=e.selection,a=e.extensions,c=e.onChange,h=e.onStatistics,u=e.onCreateEditor,f=e.onUpdate,d=e.autoFocus,m=e.theme,p=void 0===m?"light":m,g=e.height,v=e.minHeight,y=e.maxHeight,x=e.width,w=e.minWidth,k=e.maxWidth,b=e.basicSetup,S=e.placeholder,A=e.indentWithTab,C=e.editable,M=e.readOnly,D=e.root,O=e.initialState,L=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,nn),F=(0,i.useRef)(null),E=ne({root:D,value:s,autoFocus:d,theme:p,height:g,minHeight:v,maxHeight:y,width:x,minWidth:w,maxWidth:k,basicSetup:b,placeholder:S,indentWithTab:A,editable:C,readOnly:M,selection:l,onChange:c,onStatistics:h,onCreateEditor:u,onUpdate:f,extensions:void 0===a?[]:a,initialState:O}),R=E.state,T=E.view,B=E.container,z=E.setContainer;(0,i.useImperativeHandle)(t,()=>({editor:F.current,state:R,view:T}),[F,B,R,T]);var P=(0,i.useCallback)(e=>{F.current=e,z(e)},[z]);if("string"!=typeof s)throw Error("value must be typeof string but got "+typeof s);var I="string"==typeof p?"cm-theme-"+p:"cm-theme";return(0,nt.jsx)("div",r({ref:P,className:""+I+(n?" "+n:"")},L))});nr.displayName="CodeMirror";let ni=nr}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7064],{2296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{DecodeError:function(){return p},MiddlewareNotFoundError:function(){return b},MissingStaticPage:function(){return g},NormalizeError:function(){return y},PageNotFoundError:function(){return m},SP:function(){return f},ST:function(){return d},WEB_VITALS:function(){return r},execOnce:function(){return n},getDisplayName:function(){return a},getLocationOrigin:function(){return u},getURL:function(){return o},isAbsoluteUrl:function(){return i},isResSent:function(){return l},loadGetInitialProps:function(){return h},normalizeRepeatedSlashes:function(){return c},stringifyError:function(){return R}});let r=["CLS","FCP","FID","INP","LCP","TTFB"];function n(e){let t,r=!1;return function(){for(var n=arguments.length,s=Array(n),i=0;i<n;i++)s[i]=arguments[i];return r||(r=!0,t=e(...s)),t}}let s=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,i=e=>s.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return e+"//"+t+(r?":"+r:"")}function o(){let{href:e}=window.location,t=u();return e.substring(t.length)}function a(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function l(e){return e.finished||e.headersSent}function c(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?"?"+t.slice(1).join("?"):"")}async function h(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await h(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&l(r))return n;if(!n)throw Object.defineProperty(Error('"'+a(e)+'.getInitialProps()" should resolve to an object. But found "'+n+'" instead.'),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let f="undefined"!=typeof performance,d=f&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class p extends Error{}class y extends Error{}class m extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message="Cannot find module for page: "+e}}class g extends Error{constructor(e,t){super(),this.message="Failed to load static file for page: "+e+" "+t}}class b extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function R(e){return JSON.stringify({message:e.message,stack:e.stack})}},2454:(e,t,r)=>{r.d(t,{I:()=>R});var n=r(2115);let s=n.createContext(!1);s.Provider;var i=r(9776);r(5155);let u=n.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}());var o=r(4049),a=r(4268),l=r(7788),c=r(6195),h=r(43),f=r(8445),d=r(7126),p=class extends f.Q{#e;#t=void 0;#r=void 0;#n=void 0;#s;#i;#u;#o;#a;#l;#c;#h;#f;#d=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#t.addObserver(this),y(this.#t,this.options)?this.#p():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return m(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return m(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#m(),this.#g(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,o.GF)(this.options.enabled,this.#t))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#t.setOptions(this.options),t._defaulted&&!(0,o.f8)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let n=this.hasListeners();n&&g(this.#t,r,this.options,t)&&this.#p(),this.updateResult(),n&&(this.#t!==r||(0,o.GF)(this.options.enabled,this.#t)!==(0,o.GF)(t.enabled,this.#t)||(0,o.GF)(this.options.staleTime,this.#t)!==(0,o.GF)(t.staleTime,this.#t))&&this.#R();let s=this.#v();n&&(this.#t!==r||(0,o.GF)(this.options.enabled,this.#t)!==(0,o.GF)(t.enabled,this.#t)||s!==this.#f)&&this.#O(s)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return(0,o.f8)(this.getCurrentResult(),r)||(this.#n=r,this.#s=e),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),Reflect.get(e,r))})}trackProp(e){this.#d.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t,r=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,r),s=()=>{},i=new Promise(e=>{t=e,s=this.#e.getQueryCache().subscribe(t=>{"updated"===t.type&&t.query.queryHash===n.queryHash&&void 0!==n.state.data&&(s(),e(this.createResult(n,r)))})});return Promise.race([n.fetch(r).then(()=>{let e=this.createResult(n,r);return t?.(e),e}).finally(()=>{s()}),i])}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#p(e){this.#b();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.lQ)),t}#I(e){return!(0,l.S)()&&!1!==(0,o.GF)(this.options.enabled,this.#t)&&(0,o.gn)(e)}#R(){this.#m();let e=(0,o.GF)(this.options.staleTime,this.#t);if(this.#n.isStale||!this.#I(e))return;let t=(0,o.j3)(this.#n.dataUpdatedAt,e)+1;this.#c=d.zs.setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#v(){return(0,o.GF)(this.options.refetchInterval,this.#t)??!1}#O(e){this.#g(),this.#f=e,0!==this.#f&&this.#I(this.#f)&&(this.#h=d.zs.setInterval(()=>{(this.options.refetchIntervalInBackground||c.m.isFocused())&&this.#p()},this.#f))}#y(){this.#R(),this.#O(this.#v())}#m(){void 0!==this.#c&&(d.zs.clearTimeout(this.#c),this.#c=void 0)}#g(){void 0!==this.#h&&(d.zs.clearInterval(this.#h),this.#h=void 0)}createResult(e,t){let r,n=this.#t,s=this.options,i=this.#n,u=this.#s,a=e!==n?e.state:this.#r,{state:l}=e,c={...l},f=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&y(e,t),u=r&&g(e,n,t,s);(i||u)&&(c={...c,...(0,h.k)(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:m}=c;r=c.data;let R=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===m){let e,n=i?.isPlaceholderData&&t.placeholderData===u?.placeholderData;n?(e=i.data,R=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,(n||void 0!==e)&&(m="success",r=(0,o.pl)(t.select&&!R?this.#o:i?.data,e,t),f=!0)}if(t.select&&void 0!==r&&!R)if(r===this.#o&&t.select===this.#u)r=this.#a;else try{this.#u=t.select,this.#o=r,r=t.select(r),r=(0,o.pl)(i?.data,r,t),this.#a=r,this.#i=null}catch(e){this.#i=e}else void 0===r&&(this.#o=void 0,this.#i=null);this.#i&&(d=this.#i,r=this.#a,p=i?.error===d?i.errorUpdatedAt:Date.now(),m="error",f=!1);let v="fetching"===c.fetchStatus,O="pending"===m,I="error"===m,Q=O&&v,E=void 0!==r;return{status:m,fetchStatus:c.fetchStatus,isPending:O,isSuccess:"success"===m,isError:I,isInitialLoading:Q,isLoading:Q,data:r,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:c.dataUpdateCount>a.dataUpdateCount||c.errorUpdateCount>a.errorUpdateCount,isFetching:v,isRefetching:v&&!O,isLoadingError:I&&!E,isPaused:"paused"===c.fetchStatus,isPlaceholderData:f,isRefetchError:I&&E,isStale:b(e,t),refetch:this.refetch,isEnabled:!1!==(0,o.GF)(t.enabled,e)}}updateResult(){let e=this.#n,t=this.createResult(this.#t,this.options);if(this.#s=this.options,void 0!==this.#t.state.data&&(this.#l=this.#t),(0,o.f8)(t,e))return;this.#n=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#d.size||this.options.throwOnError&&this.#n.error!==e.error)return!0;for(let t of r??this.#d)if(this.#n[t]!==e[t])return!0;return!1})();a.jG.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#b(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function y(e,t){return!1!==(0,o.GF)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==(0,o.GF)(t.retryOnMount,e))||void 0!==e.state.data&&m(e,t,t.refetchOnMount)}function m(e,t,r){if(!1!==(0,o.GF)(t.enabled,e)&&"static"!==(0,o.GF)(t.staleTime,e)){let n=(0,o.GF)(r,e);return"always"===n||!1!==n&&b(e,t)}return!1}function g(e,t,r,n){return(e!==t||!1===(0,o.GF)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&b(e,r)}function b(e,t){return!1!==(0,o.GF)(t.enabled,e)&&e.isStaleByTime((0,o.GF)(t.staleTime,e))}function R(e,t){return function(e,t,r){let l=n.useContext(s),c=n.useContext(u),h=(0,i.jE)(r),f=h.defaultQueryOptions(e),d=h.getQueryCache().get(f.queryHash),p=!1!==e.subscribed;if(f._optimisticResults=l?"isRestoring":p?"optimistic":void 0,f.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=f.staleTime;f.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof f.gcTime&&(f.gcTime=Math.max(f.gcTime,1e3))}let y=(null==d?void 0:d.state.status)==="error"&&"function"==typeof f.throwOnError?(0,o.GU)(f.throwOnError,[d.state.error,d]):f.throwOnError;(f.suspense||y)&&!c.isReset()&&(f.retryOnMount=!1),n.useEffect(()=>{c.clearReset()},[c]);let[m]=n.useState(()=>new t(h,f)),g=m.getOptimisticResult(f);n.useEffect(()=>{m.setOptions(f)},[f,m]);let b=!l&&p;if(n.useSyncExternalStore(n.useCallback(e=>{let t=b?m.subscribe(a.jG.batchCalls(e)):o.lQ;return m.updateResult(),t},[m,b]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),f?.suspense&&g.isPending)throw m.fetchOptimistic(f).catch(()=>{c.clearReset()});if((e=>{let{result:t,errorResetBoundary:r,throwOnError:n,query:s,suspense:i}=e;return t.isError&&!r.isReset()&&!t.isFetching&&s&&(i&&void 0===t.data||(0,o.GU)(n,[t.error,s]))})({result:g,errorResetBoundary:c,throwOnError:f.throwOnError,query:d,suspense:f.suspense}))throw g.error;return f.notifyOnChangeProps?g:m.trackResult(g)}(e,p,t)}},2619:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return m},useLinkStatus:function(){return b}});let n=r(9417),s=r(5155),i=n._(r(2115)),u=r(7670),o=r(6752),a=r(3011),l=r(2296),c=r(6058);r(4781);let h=r(3499),f=r(8607),d=r(1807);r(7045);let p=r(6048);function y(e){return"string"==typeof e?e:(0,u.formatUrl)(e)}function m(e){var t;let r,n,u,[m,b]=(0,i.useOptimistic)(h.IDLE_LINK_STATUS),R=(0,i.useRef)(null),{href:v,as:O,children:I,prefetch:Q=null,passHref:E,replace:P,shallow:S,scroll:T,onClick:C,onMouseEnter:F,onTouchStart:_,legacyBehavior:w=!1,onNavigate:x,ref:j,unstable_dynamicOnHover:U,...k}=e;r=I,w&&("string"==typeof r||"number"==typeof r)&&(r=(0,s.jsx)("a",{children:r}));let M=i.default.useContext(o.AppRouterContext),L=!1!==Q,A=!1!==Q?null===(t=Q)||"auto"===t?p.FetchStrategy.PPR:p.FetchStrategy.Full:p.FetchStrategy.PPR,{href:D,as:G}=i.default.useMemo(()=>{let e=y(v);return{href:e,as:O?y(O):e}},[v,O]);w&&(n=i.default.Children.only(r));let N=w?n&&"object"==typeof n&&n.ref:j,z=i.default.useCallback(e=>(null!==M&&(R.current=(0,h.mountLinkInstance)(e,D,M,A,L,b)),()=>{R.current&&((0,h.unmountLinkForCurrentNavigation)(R.current),R.current=null),(0,h.unmountPrefetchableInstance)(e)}),[L,D,M,A,b]),W={ref:(0,a.useMergedRef)(z,N),onClick(e){w||"function"!=typeof C||C(e),w&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(e),M&&(e.defaultPrevented||function(e,t,r,n,s,u,o){let{nodeName:a}=e.currentTarget;if(!("A"===a.toUpperCase()&&function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||e.currentTarget.hasAttribute("download"))){if(!(0,f.isLocalURL)(t)){s&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),o){let e=!1;if(o({preventDefault:()=>{e=!0}}),e)return}i.default.startTransition(()=>{(0,d.dispatchNavigateAction)(r||t,s?"replace":"push",null==u||u,n.current)})}}(e,D,G,R,P,T,x))},onMouseEnter(e){w||"function"!=typeof F||F(e),w&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),M&&L&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)},onTouchStart:function(e){w||"function"!=typeof _||_(e),w&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),M&&L&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)}};return(0,l.isAbsoluteUrl)(G)?W.href=G:w&&!E&&("a"!==n.type||"href"in n.props)||(W.href=(0,c.addBasePath)(G)),u=w?i.default.cloneElement(n,W):(0,s.jsx)("a",{...k,...W,children:r}),(0,s.jsx)(g.Provider,{value:m,children:u})}let g=(0,i.createContext)(h.IDLE_LINK_STATUS),b=()=>(0,i.useContext)(g);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3011:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return s}});let n=r(2115);function s(e,t){let r=(0,n.useRef)(null),s=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=s.current;t&&(s.current=null,t())}else e&&(r.current=i(e,n)),t&&(s.current=i(t,n))},[e,t])}function i(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3078:(e,t)=>{function r(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function n(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function s(e){let t=new URLSearchParams;for(let[r,s]of Object.entries(e))if(Array.isArray(s))for(let e of s)t.append(r,n(e));else t.set(r,n(s));return t}function i(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(let t of r){for(let r of t.keys())e.delete(r);for(let[r,n]of t.entries())e.append(r,n)}return e}Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{assign:function(){return i},searchParamsToUrlQuery:function(){return r},urlQueryToSearchParams:function(){return s}})},7045:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},7670:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{formatUrl:function(){return i},formatWithValidation:function(){return o},urlObjectKeys:function(){return u}});let n=r(9417)._(r(3078)),s=/https?|ftp|gopher|file/;function i(e){let{auth:t,hostname:r}=e,i=e.protocol||"",u=e.pathname||"",o=e.hash||"",a=e.query||"",l=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?l=t+e.host:r&&(l=t+(~r.indexOf(":")?"["+r+"]":r),e.port&&(l+=":"+e.port)),a&&"object"==typeof a&&(a=String(n.urlQueryToSearchParams(a)));let c=e.search||a&&"?"+a||"";return i&&!i.endsWith(":")&&(i+=":"),e.slashes||(!i||s.test(i))&&!1!==l?(l="//"+(l||""),u&&"/"!==u[0]&&(u="/"+u)):l||(l=""),o&&"#"!==o[0]&&(o="#"+o),c&&"?"!==c[0]&&(c="?"+c),""+i+l+(u=u.replace(/[?#]/g,encodeURIComponent))+(c=c.replace("#","%23"))+o}let u=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function o(e){return i(e)}},8607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return i}});let n=r(2296),s=r(2929);function i(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,s.hasBasePath)(r.pathname)}catch(e){return!1}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8166],{986:(e,t,n)=>{n.d(t,{DP:()=>x,KO:()=>s,NP:()=>u,qR:()=>r});var l=n(5155),a=n(2115);let s={teal:{label:"Deep Teal",light:"#115e59",dark:"#2dd4bf"},navy:{label:"Navy",light:"#1e3a8a",dark:"#93c5fd"},indigo:{label:"Indigo",light:"#3730a3",dark:"#a5b4fc"},aubergine:{label:"Aubergine",light:"#581c87",dark:"#d8b4fe"},burgundy:{label:"Burgundy",light:"#881337",dark:"#fda4af"},rust:{label:"Rust",light:"#9a3412",dark:"#fdba74"},bronze:{label:"Bronze",light:"#854d0e",dark:"#fcd34d"},espresso:{label:"Espresso",light:"#5b3a24",dark:"#d6b28c"},graphite:{label:"Graphite",light:"#1f2937",dark:"#cbd5e1"}},r=/^#[0-9a-f]{6}$/i,i=e=>!!e&&(e in s||r.test(e)),c=(0,a.createContext)({dark:!1,toggle:()=>{},setDark:()=>{},accent:"teal",setAccent:()=>{}}),o=e=>{try{return localStorage.getItem(e)}catch(e){return null}},d=(e,t)=>{try{localStorage.setItem(e,t)}catch(e){}};function u(e){let{children:t}=e,[n,u]=(0,a.useState)(!1),[x,m]=(0,a.useState)("teal");(0,a.useEffect)(()=>{u("dark"===o("ma-theme"));let e=o("ma-accent");i(e)&&m(e)},[]),(0,a.useEffect)(()=>{let e=document.documentElement;e.classList.toggle("dark",n);let t=function(e,t){if(e in s){let n=s[e];return t?n.dark:n.light}return t?"color-mix(in srgb, ".concat(e," 55%, #ffffff)"):e}(x,n);e.style.setProperty("--accent",t),e.style.setProperty("--accent-hover",n?"color-mix(in srgb, ".concat(t," 80%, #ffffff)"):"color-mix(in srgb, ".concat(t," 82%, #000000)")),e.style.setProperty("--accent-soft",n?"color-mix(in srgb, ".concat(t," 18%, #0b1220)"):"color-mix(in srgb, ".concat(t," 10%, #ffffff)")),e.style.setProperty("--accent-fg",n||function(e){if(!r.test(e))return!1;let[t,n,l]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255);return .2126*t+.7152*n+.0722*l>.6}(x)?"#0b1220":"#ffffff")},[n,x]);let h=(0,a.useCallback)(e=>{u(e),d("ma-theme",e?"dark":"light")},[]),p=(0,a.useCallback)(()=>u(e=>(d("ma-theme",e?"light":"dark"),!e)),[]),g=(0,a.useCallback)(e=>{i(e)&&(m(e),d("ma-accent",e))},[]);return(0,l.jsx)(c.Provider,{value:{dark:n,toggle:p,setDark:h,accent:x,setAccent:g},children:t})}let x=()=>(0,a.useContext)(c)},2943:(e,t,n)=>{function l(e){if(null===e)return"Null";if(void 0===e)return"Undefined";if("string"==typeof e)return"String";if("boolean"==typeof e)return"Boolean";if("number"==typeof e)return Number.isInteger(e)?"Int32":"Double";if(e instanceof Date)return"Date";if(e instanceof RegExp)return"RegExp";if(Array.isArray(e))return"Array";let t=e._bsontype;return"ObjectId"===t||"ObjectID"===t?"ObjectId":"Int32"===t?"Int32":"Double"===t?"Double":"Long"===t?"Long":"Decimal128"===t?"Decimal128":"Binary"===t?4===e.sub_type?"UUID":"Binary":"BSONRegExp"===t?"RegExp":"Timestamp"===t?"Timestamp":"MinKey"===t?"MinKey":"MaxKey"===t?"MaxKey":"Code"===t?"Code":"BSONSymbol"===t||"Symbol"===t?"Symbol":"Object"}n.d(t,{CM:()=>o,I:()=>l,VH:()=>i,aB:()=>function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=" ".repeat(n+1),i=" ".repeat(n);switch(l(t)){case"String":return JSON.stringify(t);case"Int32":{let e=s(t);return Number.isInteger(e)&&0x7fffffff>=Math.abs(e)?String(e):"NumberInt(".concat(e,")")}case"Double":{let e=s(t);return Number.isInteger(e)?"Double(".concat(e,")"):String(e)}case"Long":return"NumberLong('".concat(t.toString(),"')");case"Decimal128":return"NumberDecimal('".concat(t.toString(),"')");case"Boolean":return String(t);case"Null":return"null";case"Undefined":return"undefined";case"Date":return"ISODate('".concat(r(t),"')");case"ObjectId":return"ObjectId('".concat(t.toHexString(),"')");case"UUID":return"UUID('".concat(t.toUUID().toString(),"')");case"Binary":return"BinData(".concat(t.sub_type,", '").concat(t.toString("base64"),"')");case"RegExp":return t instanceof RegExp?String(t):"/".concat(t.pattern,"/").concat(t.options);case"Timestamp":return"Timestamp({ t: ".concat(t.high,", i: ").concat(t.low," })");case"MinKey":return"MinKey()";case"MaxKey":return"MaxKey()";case"Array":if(0===t.length)return"[]";return"[\n".concat(t.map(t=>a+e(t,n+1)).join(",\n"),"\n").concat(i,"]");case"Object":{let l=Object.entries(t);if(0===l.length)return"{}";return"{\n".concat(l.map(t=>{let[l,s]=t;return"".concat(a).concat(/^[A-Za-z_$][\w$]*$/.test(l)?l:JSON.stringify(l),": ").concat(e(s,n+1))}).join(",\n"),"\n").concat(i,"}")}default:return JSON.stringify(String(t))}},sq:()=>a,u_:()=>c});let a={String:"t-string",Int32:"t-number",Double:"t-number",Long:"t-number",Decimal128:"t-number",Boolean:"t-bool",Date:"t-date",Timestamp:"t-date",ObjectId:"t-oid",UUID:"t-oid",Binary:"t-oid",Null:"t-null",Undefined:"t-null",RegExp:"t-string",MinKey:"t-null",MaxKey:"t-null"},s=e=>e.valueOf();function r(e){return Number.isNaN(e.getTime())?"Invalid Date":e.toISOString()}function i(e){let t=l(e);switch(t){case"String":return JSON.stringify(e);case"Int32":case"Double":return String(s(e));case"Long":case"Decimal128":return e.toString();case"Boolean":return String(e);case"Null":return"null";case"Undefined":return"undefined";case"Date":return r(e);case"ObjectId":return"ObjectId('".concat(e.toHexString(),"')");case"UUID":return"UUID('".concat(e.toUUID().toString(),"')");case"Binary":return"Binary(".concat(e.sub_type,", '").concat(e.toString("base64").slice(0,24),"…')");case"RegExp":return e instanceof RegExp?String(e):"/".concat(e.pattern,"/").concat(e.options);case"Timestamp":return"Timestamp({ t: ".concat(e.high,", i: ").concat(e.low," })");case"Array":return"Array (".concat(e.length,")");case"Object":return"Object (".concat(Object.keys(e).length,")");default:return t}}let c=e=>{let t=l(e);return"Object"===t||"Array"===t};function o(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,a=l(e);return(t="Array"===a?"[".concat(e.map(e=>c(e)?"Array"===l(e)?"[…]":"{…}":i(e)).join(", "),"]"):"Object"===a?"{ ".concat(Object.entries(e).map(e=>{let[t,n]=e;return"".concat(t,": ").concat(c(n)?"Array"===l(n)?"[…]":"{…}":i(n))}).join(", ")," }"):i(e)).length>n?t.slice(0,n-1)+"…":t}},3069:(e,t,n)=>{n.d(t,{UU:()=>x,YL:()=>d,xn:()=>u});var l=n(5155),a=n(2115),s=n(7212),r=n(4269),i=n(2943),c=n(6384);let o=(0,a.createContext)({mode:"expand",n:0}),d=()=>(0,a.useContext)(o);function u(e){let{command:t,children:n}=e;return(0,l.jsx)(o.Provider,{value:t,children:n})}let x=(0,a.memo)(function(e){let{value:t,collapseRoot:n=!1,bare:a=!1}=e;if(a&&t&&"object"==typeof t&&!Array.isArray(t)&&"Object"===(0,i.I)(t)){let e=Object.entries(t);return(0,l.jsx)("div",{className:"font-mono text-[12px] leading-[18px] text-fg",children:e.map((t,n)=>{let[a,s]=t;return(0,l.jsx)(m,{name:a,value:s,depth:1,last:n===e.length-1},a)})})}return(0,l.jsx)("div",{className:"font-mono text-[12px] leading-[18px] text-fg",children:(0,l.jsx)(m,{value:t,depth:0,last:!0,keepOpen:!n})})});function m(e){let{name:t,value:n,depth:d,last:u,keepOpen:x=!1}=e,h=(0,a.useContext)(o),p=(0,i.I)(n),[g,f]=(0,a.useState)("expand"===h.mode||x),[b,j]=(0,a.useState)(100);(0,a.useEffect)(()=>{f("expand"===h.mode||x)},[h,x]);let v=u?"":(0,l.jsx)("span",{className:"text-fg-subtle",children:","}),N=void 0!==t&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"t-key font-semibold",children:/^[A-Za-z_$][\w$]*$/.test(t)?t:JSON.stringify(t)}),(0,l.jsx)("span",{className:"text-fg-subtle",children:": "})]});if("Object"!==p&&"Array"!==p)return(0,l.jsxs)("div",{className:"pl-4",children:[N,(0,l.jsx)(c.d,{text:(0,i.aB)(n)}),v]});let y="Array"===p,w=y?n.map(e=>[void 0,e]):Object.entries(n),[k,S]=y?["[","]"]:["{","}"],C=w.length,$=(0,l.jsx)("button",{onClick:()=>f(e=>!e),"aria-label":g?"Collapse":"Expand",className:"absolute left-0 top-[2px] flex h-3.5 w-3.5 items-center justify-center rounded text-fg-subtle hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(s.A,{className:(0,r.cn)("h-3 w-3 transition-transform duration-100",g&&"rotate-90")})});return 0===C?(0,l.jsxs)("div",{className:"pl-4",children:[N,(0,l.jsxs)("span",{className:"text-fg-subtle",children:[k,S]}),v]}):g?(0,l.jsxs)("div",{className:"relative pl-4",children:[$,N,(0,l.jsx)("span",{className:"text-fg-subtle",children:k}),(0,l.jsxs)("div",{className:"border-l border-transparent hover:border-border",children:[w.slice(0,b).map((e,t)=>{let[n,a]=e;return(0,l.jsx)(m,{name:n,value:a,depth:d+1,last:t===C-1},null!=n?n:t)}),C>b&&(0,l.jsxs)("button",{onClick:()=>j(e=>e+1e3),className:"pl-4 font-sans text-[11px] text-accent hover:underline",children:["Show ",Math.min(1e3,C-b)," more of ",C-b]})]}),(0,l.jsx)("span",{className:"text-fg-subtle",children:S}),v]}):(0,l.jsxs)("div",{className:"relative pl-4",children:[$,N,(0,l.jsxs)("button",{onClick:()=>f(!0),className:"rounded px-0.5 text-fg-subtle hover:bg-bg-muted hover:text-fg",children:[k," … ",S]}),(0,l.jsxs)("span",{className:"ml-1.5 font-sans text-[10.5px] text-fg-subtle",children:[C," ",y?1===C?"item":"items":1===C?"field":"fields"]}),v]})}},6233:(e,t,n)=>{n.d(t,{i:()=>o});var l=n(5155),a=n(2115),s=n(3916),r=n(7212),i=n(4269),c=n(2943);let o=(0,a.memo)(function(e){let{value:t,depth:n=0,expandAll:s=!1}=e,r=Array.isArray(t)?t.map((e,t)=>[String(t),e]):Object.entries(t),[c,o]=(0,a.useState)(25),u=r.slice(0,c);return(0,l.jsxs)("div",{className:(0,i.cn)("font-mono text-[12px] leading-[19px]",n>0&&"ml-[18px] border-l pl-1.5"),children:[u.map(e=>{let[a,r]=e;return(0,l.jsx)(d,{name:a,value:r,depth:n,isIndex:Array.isArray(t),expandAll:s},a)}),r.length>u.length&&(0,l.jsxs)("button",{onClick:()=>o(e=>e+500),className:"text-[11px] text-accent hover:underline",children:["Show ",Math.min(500,r.length-u.length)," more of ",r.length-u.length]})]})});function d(e){var t;let{name:n,value:d,depth:u,isIndex:x,expandAll:m}=e,[h,p]=(0,a.useState)(m&&u<3),g=(0,c.I)(d),f=(0,c.u_)(d);return(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"group/field flex min-w-0 items-start gap-1 rounded px-0.5 hover:bg-bg-muted/70",children:[f?(0,l.jsx)("button",{onClick:()=>p(e=>!e),className:"mt-[2.5px] text-fg-subtle hover:text-fg",children:h?(0,l.jsx)(s.A,{className:"h-3.5 w-3.5"}):(0,l.jsx)(r.A,{className:"h-3.5 w-3.5"})}):(0,l.jsx)("span",{className:"w-3.5 shrink-0"}),(0,l.jsx)("span",{className:(0,i.cn)("shrink-0",x?"text-fg-subtle":"t-key font-semibold"),children:n}),(0,l.jsx)("span",{className:"shrink-0 text-fg-subtle",children:":"}),(0,l.jsx)("span",{className:(0,i.cn)("min-w-0 break-all",null!=(t=c.sq[g])?t:"text-fg-muted"),title:g,children:f?(0,l.jsx)("button",{onClick:()=>p(e=>!e),className:"text-fg-muted hover:text-fg",children:(0,c.VH)(d)}):(0,c.VH)(d)}),(0,l.jsx)("span",{className:"ml-1 hidden shrink-0 text-[10px] text-fg-subtle group-hover/field:inline",children:g})]}),f&&h&&(0,l.jsx)(o,{value:d,depth:u+1,expandAll:m})]})}},6384:(e,t,n)=>{n.d(t,{d:()=>i});var l=n(5155),a=n(2115);let s=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|\b(ObjectId|ISODate|NumberLong|NumberDecimal|NumberInt|Double|UUID|BinData|Timestamp|MinKey|MaxKey)\b|(-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b)|\b(true|false)\b|\b(null|undefined)\b|([A-Za-z_$][\w$]*)(?=\s*:)|([{}[\](),:])/g,r=/^\s*:/,i=(0,a.memo)(function(e){let t,{text:n}=e,a=[],i=0,c=0;for(s.lastIndex=0;t=s.exec(n);){t.index>i&&a.push(n.slice(i,t.index));let[e,s,o,d,u,x,m,h]=t,p="";void 0!==s?p=r.test(n.slice(t.index+e.length))?"t-key font-semibold":"t-string":o?p="ISODate"===o||"Timestamp"===o?"t-date":o.startsWith("Number")||"Double"===o?"t-number":"t-oid":d?p="t-number":u?p="t-bool":x?p="t-null":m?p="t-key font-semibold":h&&(p="text-fg-subtle"),a.push((0,l.jsx)("span",{className:p,children:e},c++)),i=t.index+e.length}return i<n.length&&a.push(n.slice(i)),(0,l.jsx)(l.Fragment,{children:a})})},6807:(e,t,n)=>{n.d(t,{OI:()=>d,SplitProvider:()=>o,h9:()=>u,qw:()=>x});var l=n(5155),a=n(2115),s=n(63);let r=(0,a.createContext)({panes:[],open:()=>{},close:()=>{},closeAll:()=>{},countFor:()=>0,forget:()=>{},mainAt:0,reorder:()=>{}}),i=(0,a.createContext)({open:()=>{},close:()=>{},closeAll:()=>{},forget:()=>{},reorder:()=>{}}),c="ma-split-tabs";function o(e){var t;let{children:n}=e,o=(0,s.usePathname)(),d=(0,a.useRef)(o);d.current=o;let[u,x]=(0,a.useState)({}),[m,h]=(0,a.useState)({});(0,a.useEffect)(()=>{var e,t;try{x(JSON.parse(null!=(e=sessionStorage.getItem(c))?e:"{}"))}catch(e){}try{h(JSON.parse(null!=(t=sessionStorage.getItem("".concat(c,"-main")))?t:"{}"))}catch(e){}},[]);let p=(0,a.useCallback)((e,t)=>h(n=>{let l={...n,[e]:t};t||delete l[e];try{sessionStorage.setItem("".concat(c,"-main"),JSON.stringify(l))}catch(e){}return l}),[]),g=(0,a.useCallback)(e=>x(t=>{let n=e(t);for(let e of Object.keys(n))n[e].length||delete n[e];try{sessionStorage.setItem(c,JSON.stringify(n))}catch(e){}return n}),[]),f=(0,a.useCallback)(e=>g(t=>{var n;let l=d.current,a=null!=(n=t[l])?n:[];return a.some(t=>t.cid===e.cid&&t.db===e.db&&t.coll===e.coll)?t:{...t,[l]:[...a,{...e,id:"".concat(Date.now().toString(36)).concat(Math.random().toString(36).slice(2,6))}].slice(-6)}}),[g]),b=(0,a.useCallback)(e=>g(t=>{var n;return{...t,[d.current]:(null!=(n=t[d.current])?n:[]).filter(t=>t.id!==e)}}),[g]),j=(0,a.useCallback)(()=>{let e=d.current;g(t=>({...t,[e]:[]})),p(e,0)},[g,p]),v=(0,a.useCallback)(e=>{g(t=>({...t,[e]:[]})),p(e,0)},[g,p]),N=(0,a.useCallback)(e=>{let t=d.current;g(n=>{var l;let a=new Map((null!=(l=n[t])?l:[]).map(e=>[e.id,e]));return{...n,[t]:e.filter(e=>"main"!==e).map(e=>a.get(e)).filter(Boolean)}}),p(t,Math.max(0,e.indexOf("main")))},[g,p]),y=(0,a.useCallback)(e=>{var t,n;return null!=(n=null==(t=u[e])?void 0:t.length)?n:0},[u]),w=(0,a.useMemo)(()=>{var e;return null!=(e=u[o])?e:[]},[u,o]),k=Math.min(null!=(t=m[o])?t:0,w.length),S=(0,a.useMemo)(()=>({open:f,close:b,closeAll:j,forget:v,reorder:N}),[f,b,j,v,N]),C=(0,a.useMemo)(()=>({panes:w,countFor:y,mainAt:k,...S}),[w,y,k,S]);return(0,l.jsx)(i.Provider,{value:S,children:(0,l.jsx)(r.Provider,{value:C,children:n})})}let d=()=>(0,a.useContext)(r),u=()=>(0,a.useContext)(i);function x(){return(0,a.useContext)(r).panes.length>0}},8166:(e,t,n)=>{n.d(t,{i:()=>ts,x:()=>ta});var l=n(5155),a=n(6807),s=n(2454),r=n(960),i=n(51),c=n(1488),o=n(9818),d=n(4269),u=n(2115),x=n(4239),m=n(9776),h=n(8570),p=n(6005),g=n(7906),f=n(38),b=n(9682),j=n(1606),v=n(9979),N=n(7212),y=n(5537),w=n(7211),k=n(4358),S=n(9282),C=n(1701),$=n(3998),D=n(1834),I=n(2943);function A(e){var t,n,a,i,c,x,m,h,p,g,f,b,j;let{scope:v,kind:N,query:y,pipeline:w,onClose:k}=e,[S,C]=(0,u.useState)("visual"),$=(0,s.I)({queryKey:["explain",v,N,y,w],queryFn:()=>(0,r.FH)("".concat((0,r.wV)(v.cid,v.db,v.coll),"/explain"),{body:"find"===N?{kind:N,filter:null==y?void 0:y.filter,project:null==y?void 0:y.project,sort:null==y?void 0:y.sort,collation:null==y?void 0:y.collation,skip:null==y?void 0:y.skip,limit:null==y?void 0:y.limit}:{kind:N,pipeline:w}})}),A=null==(t=$.data)?void 0:t.explain,F=null!=(g=null==A?void 0:A.executionStats)?g:null==A||null==(i=A.stages)||null==(a=i[0])||null==(n=a.$cursor)?void 0:n.executionStats,R=null!=(f=null==A||null==(c=A.queryPlanner)?void 0:c.winningPlan)?f:null==A||null==(p=A.stages)||null==(h=p[0])||null==(m=h.$cursor)||null==(x=m.queryPlanner)?void 0:x.winningPlan,M=null!=(j=null!=(b=null==F?void 0:F.executionStages)?b:null==R?void 0:R.queryPlan)?j:R,T=M?function e(t){var n;let l=t.indexName?[t.indexName]:[];for(let a of null!=(n=t.inputStages)?n:t.inputStage?[t.inputStage]:[])l.push(...e(a));return l}(M):[],L=!!M&&function e(t,n){var l;return t.stage===n||(null!=(l=t.inputStages)?l:t.inputStage?[t.inputStage]:[]).some(t=>e(t,n))}(M,"COLLSCAN");return(0,l.jsxs)(D.l,{open:!0,onClose:k,title:"Explain plan",width:"max-w-3xl",children:[$.isLoading&&(0,l.jsx)(o.y$,{}),(0,l.jsx)(o.aV,{error:$.error}),A&&(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(o.I2,{value:S,onChange:C,items:[{value:"visual",label:"Visual tree"},{value:"raw",label:"Raw output"}]}),L?(0,l.jsx)(o.Ex,{tone:"warn",children:"No index used (collection scan)"}):T.length>0?(0,l.jsxs)(o.Ex,{tone:"accent",children:["Index: ",T.join(", ")]}):null]}),F&&(0,l.jsxs)("div",{className:"grid grid-cols-4 gap-3 rounded-lg border p-3 text-xs",children:[(0,l.jsx)(O,{label:"Documents returned",value:(0,d.ZV)((0,d.bu)(F.nReturned))}),(0,l.jsx)(O,{label:"Documents examined",value:(0,d.ZV)((0,d.bu)(F.totalDocsExamined))}),(0,l.jsx)(O,{label:"Index keys examined",value:(0,d.ZV)((0,d.bu)(F.totalKeysExamined))}),(0,l.jsx)(O,{label:"Execution time",value:"".concat((0,d.bu)(F.executionTimeMillis)," ms")})]}),"visual"===S?M?(0,l.jsx)(E,{s:M}):(0,l.jsx)("p",{className:"text-xs text-fg-muted",children:"No plan tree in this output — see Raw output."}):(0,l.jsx)("pre",{className:"scrollbar-thin max-h-[50vh] overflow-auto rounded-md border bg-bg-subtle p-3 font-mono text-[11px]",children:(0,I.aB)(A)})]})]})}function O(e){let{label:t,value:n}=e;return(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-fg-subtle",children:t}),(0,l.jsx)("p",{className:"text-sm font-semibold",children:n})]})}function E(e){var t;let{s:n}=e,a=null!=(t=n.inputStages)?t:n.inputStage?[n.inputStage]:[];return(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,l.jsxs)("div",{className:"min-w-56 rounded-lg border px-3 py-2 text-xs ".concat("COLLSCAN"===n.stage?"border-warn bg-warn-soft":"IXSCAN"===n.stage?"border-accent bg-accent-soft":"bg-panel"),children:[(0,l.jsx)("p",{className:"font-semibold",children:n.stage}),n.indexName&&(0,l.jsxs)("p",{className:"font-mono text-[11px]",children:[n.indexName," ",n.keyPattern?(0,I.aB)(n.keyPattern).replace(/\s+/g," "):""]}),(0,l.jsxs)("div",{className:"mt-1 grid grid-cols-2 gap-x-3 text-[11px] text-fg-muted",children:[void 0!==n.nReturned&&(0,l.jsxs)("span",{children:["returned: ",(0,d.ZV)((0,d.bu)(n.nReturned))]}),void 0!==n.executionTimeMillisEstimate&&(0,l.jsxs)("span",{children:["time: ",(0,d.bu)(n.executionTimeMillisEstimate)," ms"]}),void 0!==n.docsExamined&&(0,l.jsxs)("span",{children:["docs: ",(0,d.ZV)((0,d.bu)(n.docsExamined))]}),void 0!==n.keysExamined&&(0,l.jsxs)("span",{children:["keys: ",(0,d.ZV)((0,d.bu)(n.keysExamined))]})]})]}),a.length>0&&(0,l.jsx)("div",{className:"flex gap-4 border-t pt-2",children:a.map((e,t)=>(0,l.jsx)(E,{s:e},t))})]})}var F=n(8720),R=n(5520),M=n(5142);function T(e){let{scope:t,query:n,total:a,onClose:s}=e,[i,c]=(0,u.useState)(!!(n.filter||n.project||n.sort)),[o,x]=(0,u.useState)("json"),[m,h]=(0,u.useState)(""),[p,g]=(0,u.useState)("");return(0,l.jsx)(D.l,{open:!0,onClose:s,title:"Export ".concat(t.coll),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:s,children:"Cancel"}),(0,l.jsx)($.$,{variant:"primary",onClick:function(){let e=new URL("".concat((0,r.wV)(t.cid,t.db,t.coll),"/export"),window.location.origin);e.searchParams.set("format",o),i&&(n.filter&&e.searchParams.set("filter",n.filter),n.project&&e.searchParams.set("project",n.project),n.sort&&e.searchParams.set("sort",n.sort)),m&&"csv"===o&&e.searchParams.set("fields",m),p&&e.searchParams.set("limit",p);let l=document.createElement("a");l.href=e.toString(),l.click(),F.oR.success("Export started — your browser is downloading the file"),s()},children:"Export"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,l.jsxs)("label",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{type:"radio",checked:i,onChange:()=>c(!0),disabled:!(n.filter||n.project||n.sort)}),"Export the current query result"]}),(0,l.jsxs)("label",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{type:"radio",checked:!i,onChange:()=>c(!1)}),"Export the full collection",null!==a?" (".concat((0,d.ZV)(a)," documents)"):""]}),(0,l.jsx)(M.D0,{label:"File type",children:(0,l.jsxs)(M.l6,{value:o,onChange:e=>x(e.target.value),children:[(0,l.jsx)("option",{value:"json",children:"JSON (Extended JSON — keeps types)"}),(0,l.jsx)("option",{value:"csv",children:"CSV"})]})}),"csv"===o&&(0,l.jsx)(M.D0,{label:"Fields (optional, comma separated)",hint:"Empty = all fields found in the data. Nested fields use dots, e.g. profile.city",children:(0,l.jsx)(M.pd,{value:m,onChange:e=>h(e.target.value),placeholder:"name,email,profile.city"})}),(0,l.jsx)(M.D0,{label:"Max documents (optional)",children:(0,l.jsx)(M.pd,{value:p,onChange:e=>g(e.target.value.replace(/\D/g,"")),placeholder:"All"})})]})})}function L(e){let{scope:t,onClose:n,onDone:a}=e,[s,i]=(0,u.useState)(null),[c,x]=(0,u.useState)(!0),[m,h]=(0,u.useState)(!1),[p,g]=(0,u.useState)(null),[f,b]=(0,u.useState)(null);async function j(){if(s){h(!0),g(null);try{var e,n;let l=new FormData;l.set("file",s),l.set("format",s.name.toLowerCase().endsWith(".csv")?"csv":"json"),l.set("stopOnError",String(c));let i=await fetch("".concat((0,r.wV)(t.cid,t.db,t.coll),"/import"),{method:"POST",body:l,credentials:"same-origin"}),o=R.On.parse(await i.text(),{relaxed:!1});if(!i.ok)throw Error(null!=(e=o.error)?e:"Import failed");let u={total:(0,d.bu)(o.total),inserted:(0,d.bu)(o.inserted),errors:null!=(n=o.errors)?n:[]};b(u),F.oR.success("Imported ".concat((0,d.ZV)(u.inserted)," of ").concat((0,d.ZV)(u.total)," documents")),a()}catch(e){g(e)}finally{h(!1)}}}return(0,l.jsx)(D.l,{open:!0,onClose:n,title:"Import into ".concat(t.coll),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:n,children:f?"Done":"Cancel"}),!f&&(0,l.jsx)($.$,{variant:"primary",loading:m,disabled:!s,onClick:j,children:"Import"})]}),children:(0,l.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,l.jsx)(M.D0,{label:"File",hint:"JSON array, newline-delimited JSON, or CSV with a header row. Max 200 MB.",children:(0,l.jsx)("input",{type:"file",accept:".json,.ndjson,.jsonl,.csv",onChange:e=>{var t,n;return i(null!=(n=null==(t=e.target.files)?void 0:t[0])?n:null)},className:"block w-full text-xs"})}),(0,l.jsxs)("label",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{type:"checkbox",checked:c,onChange:e=>x(e.target.checked)}),"Stop on first error"]}),f&&(0,l.jsxs)("div",{className:"rounded-md border bg-bg-subtle p-3",children:[(0,l.jsxs)("p",{className:"font-medium",children:["Inserted ",(0,d.ZV)(f.inserted)," of ",(0,d.ZV)(f.total)," documents."]}),f.errors.map((e,t)=>(0,l.jsx)("p",{className:"mt-1 text-danger",children:e},t))]}),(0,l.jsx)(o.aV,{error:p})]})})}var V=n(9532),q=n(7419),z=n(3916),U=n(7274),_=n(7909),H=n(3196),P=n(1224),B=n(3364),K=n(8082),J=n(5395),Z=n(986);let W=(0,_.default)(()=>n.e(6569).then(n.bind(n,6569)),{loadableGenerated:{webpack:()=>[null]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"h-full min-h-8 rounded-md border bg-bg-subtle"})});function Q(e){let{value:t,onChange:n,onRun:a,lang:s="js",minHeight:r="32px",maxHeight:i,readOnly:c,placeholder:o,oneLine:d,className:x,onReady:m}=e,{dark:h}=(0,Z.DP)(),p=(0,u.useMemo)(()=>["json"===s?(0,H.Pq)():(0,P.Q2)(),K.Lz.lineWrapping,J.Nb.highest(K.w4.of([{key:"Mod-Enter",run:()=>(null==a||a(),!0)},...d?[{key:"Enter",run:()=>(null==a||a(),!0)}]:[]]))],[s,a,d]);return(0,l.jsx)(W,{className:x,value:t,onChange:n,extensions:p,theme:h?B.bM:"light",readOnly:c,placeholder:o,minHeight:r,onCreateEditor:m,maxHeight:i,basicSetup:{lineNumbers:!d,foldGutter:!d,highlightActiveLine:!d,autocompletion:!0,bracketMatching:!0,closeBrackets:!0}})}var G=n(4049);let X={filter:"",project:"",sort:"",collation:"",skip:0,limit:20},Y=e=>!e.trim()||"{}"===e.trim(),ee=(e,t,n)=>"ma-hist:".concat(e,":").concat(t,":").concat(n);function et(e,t,n){try{var l;return JSON.parse(null!=(l=localStorage.getItem(ee(e,t,n)))?l:"[]")}catch(e){return[]}}function en(e){let{value:t,onRun:n,onExplain:a,scope:s}=e,[r,i]=(0,u.useState)(t),[c,o]=(0,u.useState)(!!(t.project||t.sort||t.collation||t.skip)),[x,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{i(t)},[t]);let h=(e,t)=>i(n=>({...n,[e]:t})),p=(0,u.useCallback)(()=>n(r),[r,n]),g=JSON.stringify(r)!==JSON.stringify(t);return(0,l.jsxs)("div",{className:"border-b bg-bg px-3 py-2",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 @[720px]:flex-nowrap",children:[(0,l.jsx)("button",{onClick:()=>m(!0),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-bg-muted hover:text-fg",title:"Query history & favourites",children:(0,l.jsx)(V.A,{className:"h-4 w-4"})}),(0,l.jsxs)("div",{className:"flex h-8 min-w-0 flex-1 basis-[calc(100%-2.5rem)] items-stretch overflow-hidden rounded-md border border-border-strong bg-panel transition-shadow focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 @[720px]:basis-0",children:[(0,l.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Filter"}),(0,l.jsx)(Q,{className:"ma-oneline min-w-0 flex-1",value:r.filter,onChange:e=>h("filter",e),onRun:p,oneLine:!0,placeholder:"{ field: 'value' } \xb7 Enter to run"})]}),(0,l.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-[38px] @[720px]:pl-0",children:[(0,l.jsxs)($.$,{size:"md",variant:"ghost",onClick:()=>o(e=>!e),children:["Options ",c?(0,l.jsx)(q.A,{className:"h-3 w-3"}):(0,l.jsx)(z.A,{className:"h-3 w-3"})]}),a&&(0,l.jsx)($.$,{size:"md",onClick:()=>a(r),children:"Explain"}),(0,l.jsx)($.$,{size:"md",onClick:()=>n({...t,filter:"",project:"",sort:"",collation:"",skip:0}),children:"Reset"}),(0,l.jsx)($.$,{size:"md",variant:"primary",className:(0,d.cn)("px-4",g&&"ring-2 ring-accent/30"),onClick:p,children:"Find"})]})]}),c&&(0,l.jsxs)("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5 pl-[38px] @[900px]:grid-cols-[minmax(0,1.3fr)_minmax(0,1fr)_minmax(0,1fr)_100px_100px]",children:[(0,l.jsx)(el,{label:"Project",children:(0,l.jsx)(Q,{value:r.project,onChange:e=>h("project",e),onRun:p,oneLine:!0,placeholder:"{ field: 1 }"})}),(0,l.jsx)(el,{label:"Sort",children:(0,l.jsx)(Q,{value:r.sort,onChange:e=>h("sort",e),onRun:p,oneLine:!0,placeholder:"{ field: -1 }"})}),(0,l.jsx)(el,{label:"Collation",children:(0,l.jsx)(Q,{value:r.collation,onChange:e=>h("collation",e),onRun:p,oneLine:!0,placeholder:"{ locale: 'en' }"})}),(0,l.jsx)(el,{label:"Skip",children:(0,l.jsx)("input",{className:"h-full w-full bg-transparent px-2 font-mono text-[12px] outline-none",inputMode:"numeric",value:r.skip||"",placeholder:"0",onChange:e=>h("skip",Number(e.target.value.replace(/\D/g,""))||0),onKeyDown:e=>"Enter"===e.key&&p()})}),(0,l.jsx)(el,{label:"Limit",children:(0,l.jsx)("input",{className:"h-full w-full bg-transparent px-2 font-mono text-[12px] outline-none",inputMode:"numeric",value:r.limit,onChange:e=>h("limit",Math.min(Number(e.target.value.replace(/\D/g,""))||20,1e3)),onKeyDown:e=>"Enter"===e.key&&p()})})]}),(0,l.jsx)(ea,{open:x,onClose:()=>m(!1),scope:s,current:r,onPick:e=>{m(!1),n({...t,...e,skip:0})}})]})}function el(e){let{label:t,children:n}=e;return(0,l.jsxs)("div",{className:"flex h-8 min-w-0 items-stretch overflow-hidden rounded-md border border-border-strong bg-panel transition-shadow focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:[(0,l.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:t}),(0,l.jsx)("div",{className:"ma-oneline min-w-0 flex-1",children:n})]})}function ea(e){let{open:t,onClose:n,scope:a,current:s,onPick:r}=e,[i,c]=(0,u.useState)([]),[o,d]=(0,u.useState)("");(0,u.useEffect)(()=>{t&&c(et(a.cid,a.db,a.coll))},[t,a]);let x=i.filter(e=>e.fav),m=i.filter(e=>!e.fav),h=e=>{let{h:t}=e;return(0,l.jsxs)("button",{onClick:()=>r(t),className:"block w-full rounded border px-3 py-2 text-left font-mono text-[11px] hover:border-accent",children:[t.fav&&(0,l.jsx)("p",{className:"mb-1 font-sans text-xs font-semibold",children:t.fav}),t.filter&&(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"text-fg-subtle",children:"filter "}),t.filter]}),t.sort&&(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"text-fg-subtle",children:"sort "}),t.sort]}),t.project&&(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"text-fg-subtle",children:"project "}),t.project]}),(0,l.jsx)("p",{className:"mt-1 font-sans text-[10px] text-fg-subtle",children:new Date(t.at).toLocaleString()})]})};return(0,l.jsxs)(D.l,{open:t,onClose:n,title:"Queries",width:"max-w-xl",children:[(0,l.jsxs)("div",{className:"mb-4 flex gap-2",children:[(0,l.jsx)(M.pd,{placeholder:"Save current query as…",value:o,onChange:e=>d(e.target.value)}),(0,l.jsxs)($.$,{disabled:!o,onClick:()=>{!function(e,t,n,l,a){let s=et(e,t,n);try{localStorage.setItem(ee(e,t,n),JSON.stringify([{...l,at:Date.now(),fav:a},...s].slice(0,80)))}catch(e){}}(a.cid,a.db,a.coll,s,o),d(""),c(et(a.cid,a.db,a.coll))},children:[(0,l.jsx)(U.A,{className:"h-3.5 w-3.5"}),"Save"]})]}),x.length>0&&(0,l.jsx)("h3",{className:"mb-2 text-xs font-semibold",children:"Favourites"}),(0,l.jsx)("div",{className:"mb-4 space-y-1.5",children:x.map((e,t)=>(0,l.jsx)(h,{h:e},"f".concat(t)))}),(0,l.jsx)("h3",{className:"mb-2 text-xs font-semibold",children:"Recent"}),(0,l.jsx)("div",{className:"space-y-1.5",children:m.length?m.map((e,t)=>(0,l.jsx)(h,{h:e},t)):(0,l.jsx)("p",{className:"text-xs text-fg-muted",children:"No queries yet."})})]})}var es=n(3069),er=n(8129),ei=n(7081),ec=n(3859),eo=n(6233);let ed=(0,u.memo)(function(e){let{doc:t,partial:n=!1,scope:a,canEdit:s,mode:i,onChanged:c,onClone:x}=e,[m,h]=(0,u.useState)(null),[p,g]=(0,u.useState)(!1),f=null!=m?m:t,[j,v]=(0,u.useState)(!1),[N,k]=(0,u.useState)(""),[S,C]=(0,u.useState)(null),[D,A]=(0,u.useState)(!1),[O,E]=(0,u.useState)(!1),M=(0,es.YL)(),[T,L]=(0,u.useState)({mode:"expand",n:0}),V=T.n>M.n?T:M,q=(0,r.wV)(a.cid,a.db,a.coll);async function z(){A(!0),C(null);try{await (0,r.FH)("".concat(q,"/docs"),{method:"PUT",ejson:!0,body:{_id:f._id,text:N}}),F.oR.success("Document updated"),v(!1),c()}catch(e){C(e)}finally{A(!1)}}async function U(){A(!0);try{await (0,r.FH)("".concat(q,"/docs"),{method:"DELETE",ejson:!0,body:{_id:f._id}}),F.oR.success("Document deleted"),c()}catch(e){C(e),E(!1)}finally{A(!1)}}async function _(){if(!n||m)return f;g(!0);try{let e=await (0,r.FH)("".concat(q,"/docs"),{query:{id:R.On.stringify({id:t._id},{relaxed:!1})}});return h(e.doc),e.doc}finally{g(!1)}}let H=e=>()=>{_().then(e,e=>F.oR.error(e instanceof Error?e.message:"Could not load the document"))};return(0,l.jsxs)("div",{className:(0,d.cn)("group relative rounded-md border bg-panel transition-shadow hover:shadow-[0_1px_4px_rgba(0,0,0,0.06)]",j&&"border-accent ring-2 ring-accent/20",O&&"border-danger"),children:[!j&&!O&&(0,l.jsxs)("div",{className:"absolute right-1.5 top-1.5 z-10 hidden gap-0.5 rounded-md border bg-panel p-0.5 shadow-sm group-hover:flex",children:[s&&(0,l.jsx)(eu,{title:"Edit",onClick:H(e=>{k((0,I.aB)(e)),v(!0)}),children:(0,l.jsx)(er.A,{className:"h-3.5 w-3.5"})}),"json"===i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eu,{title:"Expand all",onClick:()=>L({mode:"expand",n:Date.now()}),children:(0,l.jsx)(y.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)(eu,{title:"Collapse all",onClick:()=>L({mode:"collapse",n:Date.now()}),children:(0,l.jsx)(w.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("span",{className:"mx-0.5 w-px self-stretch bg-border"})]}),(0,l.jsx)(eu,{title:"Copy",onClick:H(e=>{navigator.clipboard.writeText((0,I.aB)(e)),F.oR.success("Copied")}),children:(0,l.jsx)(ei.A,{className:"h-3.5 w-3.5"})}),s&&(0,l.jsx)(eu,{title:"Clone",onClick:H(e=>{let{_id:t,...n}=e;x((0,I.aB)(n))}),children:(0,l.jsx)(ec.A,{className:"h-3.5 w-3.5"})}),s&&(0,l.jsx)(eu,{title:"Delete",danger:!0,onClick:()=>E(!0),children:(0,l.jsx)(b.A,{className:"h-3.5 w-3.5"})})]}),n&&!m&&!j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 border-b bg-bg-subtle px-3 py-1 text-[11px] text-fg-muted",children:[(0,l.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"Large document: long arrays and texts are shortened here."}),(0,l.jsx)("button",{onClick:H(()=>{}),disabled:p,className:"shrink-0 font-medium text-accent hover:underline disabled:opacity-50",children:p?"Loading…":"Load full"})]}),(0,l.jsx)("div",{className:"py-1.5 pl-2 pr-3",children:j?(0,l.jsx)(Q,{value:N,onChange:k,onRun:z,minHeight:"120px",maxHeight:"60vh"}):"json"===i?(0,l.jsx)("div",{className:"scrollbar-thin overflow-auto py-0.5 pl-1",children:(0,l.jsx)(es.xn,{command:V,children:(0,l.jsx)(es.UU,{value:f})})}):(0,l.jsx)(eo.i,{value:f})}),(j||O||!!S)&&(0,l.jsxs)("div",{className:(0,d.cn)("flex items-center gap-2 border-t px-3 py-2",O?"bg-danger-soft":"bg-bg-subtle"),children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:S?(0,l.jsx)(o.aV,{error:S}):O?(0,l.jsx)("span",{className:"text-xs font-medium text-danger",children:"Delete this document?"}):(0,l.jsx)("span",{className:"text-[11px] text-fg-muted",children:"Cmd/Ctrl+Enter to save \xb7 types are kept (Int32, Long, Date…)"})}),j&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:()=>{v(!1),C(null)},children:"Cancel"}),(0,l.jsx)($.$,{variant:"primary",loading:D,onClick:z,children:"Update"})]}),O&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:()=>E(!1),children:"Cancel"}),(0,l.jsx)($.$,{variant:"danger",loading:D,onClick:U,children:"Delete"})]}),!j&&!O&&null!=S&&(0,l.jsx)($.$,{onClick:()=>C(null),children:"Dismiss"})]})]})});function eu(e){let{children:t,title:n,onClick:a,danger:s}=e;return(0,l.jsx)("button",{title:n,onClick:a,className:(0,d.cn)("rounded p-1 text-fg-muted hover:bg-bg-muted",s?"hover:text-danger":"hover:text-fg"),children:t})}var ex=n(3437),em=n(6341),eh=n(4788),ep=n(7650),eg=n(6384);function ef(e){var t,n,a;let{peek:s}=e,r=(0,I.I)(s.value),i=(0,I.u_)(s.value),c=s.rect.top-90>8,o=Math.max(8,Math.min(s.rect.left,window.innerWidth-420-8)),u=c?{bottom:window.innerHeight-s.rect.top+6,left:o,maxWidth:420,maxHeight:s.rect.top-14}:{top:s.rect.bottom+6,left:o,maxWidth:420};return(0,ep.createPortal)((0,l.jsxs)("div",{style:u,className:"pointer-events-none fixed z-[60] min-w-[160px] rounded-lg border bg-panel shadow-xl ma-pop",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg-subtle px-2.5 py-1 text-[11px]",children:[(0,l.jsx)("span",{className:"truncate font-semibold",children:s.field}),(0,l.jsx)("span",{className:"text-fg-subtle",children:r})]}),(0,l.jsx)("div",{className:"max-h-[200px] overflow-hidden px-2.5 py-1.5 font-mono text-[12px] leading-[18px]",children:i?(0,l.jsx)("pre",{className:"whitespace-pre-wrap break-all",children:(0,l.jsx)(eg.d,{text:eb((0,I.aB)(s.value))})}):(0,l.jsx)("span",{className:(0,d.cn)("whitespace-pre-wrap break-all",null!=(t=I.sq[r])?t:"text-fg"),children:eb((n=s.value,"String"===(a=r)?JSON.stringify(n):"Date"===a?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString():"ObjectId"===a?"ObjectId('".concat(n.toHexString(),"')"):(0,I.aB)(n)))})})]}),document.body)}let eb=e=>e.length>2e3?"".concat(e.slice(0,2e3),"…"):e,ej=["Int32","Double","Long","Decimal128"];function ev(e){var t;let{docs:n,onOpen:a,storageKey:s}=e,[r,i]=(0,u.useState)(()=>{try{var e;return s?JSON.parse(null!=(e=localStorage.getItem(s))?e:"{}"):{}}catch(e){return{}}}),c=e=>{i(t=>{let n=e(t);try{s&&localStorage.setItem(s,JSON.stringify(n))}catch(e){}return n})},o=(0,u.useMemo)(()=>{let e=["_id"],t=new Map;for(let a of n)for(let[n,s]of Object.entries(a)){var l;t.has(n)||(t.set(n,new Map),"_id"!==n&&e.push(n));let a=t.get(n),r=(0,I.I)(s);a.set(r,(null!=(l=a.get(r))?l:0)+1)}return e.map(e=>{var n,l,a;let s=[...(null!=(l=t.get(e))?l:new Map).entries()].sort((e,t)=>t[1]-e[1]);return{name:e,type:s.length>1?"Mixed":null!=(a=null==(n=s[0])?void 0:n[0])?a:"—",numeric:1===s.length&&ej.includes(s[0][0])}})},[n]),[m,h]=(0,u.useState)(null),[p,g]=(0,u.useState)({mode:"expand",n:0}),[f,b]=(0,u.useState)(()=>{try{return"raw"===localStorage.getItem("ma-panel-mode")?"raw":"tree"}catch(e){return"tree"}}),j={ObjectId:210,UUID:290,Date:200,Timestamp:200,Int32:100,Double:110,Long:130,Decimal128:130,Boolean:90},v=(0,u.useMemo)(()=>new Map(o.map(e=>[e.name,e.type])),[o]),N=e=>{var t,n,l;return null!=(l=null!=(n=void 0!==r[e]?Math.max(72,r[e]):void 0)?n:j[null!=(t=v.get(e))?t:""])?l:160},k=40+o.reduce((e,t)=>e+N(t.name),0),C=function(){let[e,t]=(0,u.useState)(null),n=(0,u.useRef)(null),a=(0,u.useCallback)(()=>{n.current&&clearTimeout(n.current),n.current=null,t(null)},[]),s=(0,u.useCallback)((e,l)=>({onMouseEnter:a=>{let s=a.currentTarget;n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.scrollWidth>s.clientWidth+1&&t({field:e,value:l,rect:s.getBoundingClientRect()})},350)},onMouseLeave:a}),[a]);return(0,u.useEffect)(()=>{if(e)return window.addEventListener("scroll",a,!0),()=>window.removeEventListener("scroll",a,!0)},[e,a]),{bind:s,node:e?(0,l.jsx)(ef,{peek:e}):null,clear:a}}(),$=(0,u.useRef)(null),[D,A]=(0,u.useState)(()=>{try{return Math.max(360,Number(localStorage.getItem("ma-panel-w"))||360)}catch(e){return 360}}),O=e=>{A(e);try{localStorage.setItem("ma-panel-w",String(e))}catch(e){}},E=(0,u.useRef)(null),R=(0,x.Te)({count:n.length,getScrollElement:()=>E.current,estimateSize:()=>28,overscan:20}),M=R.getVirtualItems(),T=o.length>30,L=(0,x.Te)({horizontal:!0,count:o.length,getScrollElement:()=>E.current,estimateSize:e=>N(o[e].name),paddingStart:40,overscan:4,enabled:T});(0,u.useEffect)(()=>{L.measure()},[r,o]);let V=L.getVirtualItems(),q=T&&V.length?V[0].index:0,z=T&&V.length?V.at(-1).index:o.length-1;return(0,l.jsxs)("div",{ref:$,className:"flex h-full min-w-0",children:[(0,l.jsxs)("div",{ref:E,className:"scrollbar-thin h-full min-w-0 flex-1 overflow-auto bg-panel",children:[(0,l.jsxs)("table",{className:"min-w-full table-fixed border-separate border-spacing-0 text-[12px]",style:{width:k},children:[(0,l.jsxs)("colgroup",{children:[(0,l.jsx)("col",{style:{width:40}}),o.map((e,t)=>(0,l.jsx)("col",{style:{width:t===o.length-1?void 0:N(e.name)}},e.name))]}),(0,l.jsx)("thead",{className:"sticky top-0 z-10",children:(0,l.jsxs)("tr",{className:"bg-bg-subtle",children:[(0,l.jsx)("th",{className:"group/reset sticky left-0 z-30 h-8 w-10 border-b border-r bg-bg-subtle px-0 text-[10.5px] font-medium text-fg-subtle",children:Object.keys(r).length>0?(0,l.jsxs)("button",{onClick:()=>c(()=>({})),title:"Reset all column widths",className:"flex h-full w-full items-center justify-center hover:text-accent",children:[(0,l.jsx)("span",{className:"group-hover/reset:hidden",children:"#"}),(0,l.jsx)(ex.A,{className:"hidden h-3.5 w-3.5 group-hover/reset:block"})]}):(0,l.jsx)("span",{className:"block pr-2 text-right",children:"#"})}),o.map(e=>(0,l.jsxs)("th",{className:"relative h-8 border-b border-r px-3 text-left font-normal",children:[(0,l.jsxs)("span",{className:"flex h-[18px] flex-wrap items-baseline gap-x-1.5 overflow-hidden leading-[18px]",title:"".concat(e.name," \xb7 ").concat(e.type),children:[(0,l.jsx)("span",{className:"max-w-full truncate text-[12px] font-semibold text-fg",children:e.name}),(0,l.jsx)("span",{className:"whitespace-nowrap text-[10px] font-medium text-fg-subtle",children:e.type})]}),(0,l.jsx)("span",{role:"separator","aria-orientation":"vertical",title:"Drag to resize \xb7 double-click to reset",onPointerDown:t=>(function(e,t){e.preventDefault(),e.stopPropagation();let n=e.currentTarget.parentElement,l=n.closest("table"),a=l.querySelectorAll("col")[n.cellIndex],s=e.clientX,r=n.getBoundingClientRect().width,i=l.getBoundingClientRect().width,o=r,d=0,u=e=>{o=Math.max(72,Math.round(r+e.clientX-s)),d||(d=requestAnimationFrame(()=>{d=0,a&&(a.style.width="".concat(o,"px")),l.style.width="".concat(i+o-r,"px")}))},x=()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",x),cancelAnimationFrame(d),document.body.style.cursor="",document.body.style.userSelect="",c(e=>({...e,[t]:o}))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",u),window.addEventListener("pointerup",x)})(t,e.name),onDoubleClick:()=>{let t;return t=e.name,c(e=>{let n={...e};return delete n[t],n})},className:"absolute -right-[5px] top-0 z-20 h-full w-[10px] cursor-col-resize after:absolute after:left-[4px] after:top-1.5 after:h-[calc(100%-12px)] after:w-px after:bg-transparent hover:after:w-[2px] hover:after:bg-accent"})]},e.name))]})}),(0,l.jsxs)("tbody",{className:"font-mono",children:[M.length>0&&(0,l.jsx)("tr",{style:{height:M[0].start}}),M.map(e=>{let t=n[e.index];return(0,l.jsxs)("tr",{className:"group h-7 cursor-default",onDoubleClick:()=>a(t),children:[(0,l.jsx)("td",{className:"sticky left-0 border-b border-r bg-panel px-2 text-right text-[11px] text-fg-subtle group-hover:bg-bg-muted",children:e.index+1}),q>0&&(0,l.jsx)("td",{colSpan:q,className:"border-b"}),o.slice(q,z+1).map(n=>{let a=n.name in t,s=t[n.name],r=a?(0,I.I)(s):null;return(0,l.jsx)("td",{...r?C.bind(n.name,s):{},onClick:r?()=>{C.clear(),g({mode:"expand",n:Date.now()}),h({row:e.index,field:n.name,value:s})}:void 0,className:(0,d.cn)("truncate overflow-hidden border-b px-3",r&&"cursor-pointer",(null==m?void 0:m.row)===e.index&&m.field===n.name?"bg-accent-soft shadow-[inset_0_0_0_1.5px_var(--accent)]":"group-hover:bg-bg-muted hover:!bg-accent-soft/60",n.numeric&&"tabular-nums",r?"ObjectId"===r||"Array"===r||"Object"===r?"text-fg-muted":I.sq[r]:""),children:r?(0,I.u_)(s)?(0,I.CM)(s,400):"ObjectId"===r?s.toHexString():(0,I.VH)(s):(0,l.jsx)("span",{className:"text-border-strong",children:"\xb7"})},n.name)}),z<o.length-1&&(0,l.jsx)("td",{colSpan:o.length-1-z,className:"border-b"})]},e.key)}),M.length>0&&(0,l.jsx)("tr",{style:{height:R.getTotalSize()-M.at(-1).end}})]})]}),C.node]}),m&&(0,l.jsxs)("aside",{style:{width:D},className:"relative flex shrink-0 flex-col border-l bg-panel",children:[(0,l.jsx)("span",{role:"separator","aria-orientation":"vertical",title:"Drag to resize \xb7 double-click to reset",onPointerDown:function(e){var t,n;e.preventDefault();let l=e.clientX,a=Math.max(360,(null!=(n=null==(t=$.current)?void 0:t.clientWidth)?n:1200)*.75),s=e.currentTarget.parentElement,r=D,i=0,c=e=>{r=Math.round(Math.min(a,Math.max(360,D+(l-e.clientX)))),i||(i=requestAnimationFrame(()=>{i=0,s.style.width="".concat(r,"px")}))},o=()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",o),cancelAnimationFrame(i),document.body.style.cursor="",document.body.style.userSelect="",O(r)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",c),window.addEventListener("pointerup",o)},onDoubleClick:()=>O(360),className:"absolute -left-[5px] top-0 z-20 h-full w-[10px] cursor-col-resize after:absolute after:left-[4px] after:top-0 after:h-full after:w-[2px] after:bg-transparent hover:after:bg-accent"}),(0,l.jsxs)("div",{className:"flex h-10 items-center gap-1 border-b bg-bg-subtle px-3",children:[(0,l.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12px]",children:[(0,l.jsxs)("span",{className:"text-fg-subtle",children:["Row ",m.row+1," › "]}),(0,l.jsx)("b",{className:"font-mono",children:m.field}),(0,l.jsx)("span",{className:"ml-1.5 text-[11px] text-fg-subtle",children:(0,I.I)(m.value)})]}),(0,I.u_)(m.value)&&(0,l.jsx)("div",{className:"flex items-center rounded-md bg-bg-muted p-0.5",children:[["tree","Tree view",(0,l.jsx)(em.A,{className:"h-3.5 w-3.5"},"t")],["raw","Raw JSON",(0,l.jsx)(S.A,{className:"h-3.5 w-3.5"},"r")]].map(e=>{let[t,n,a]=e;return(0,l.jsx)("button",{title:n,"aria-label":n,onClick:()=>(e=>{b(e);try{localStorage.setItem("ma-panel-mode",e)}catch(e){}})(t),className:(0,d.cn)("flex h-6 w-6 items-center justify-center rounded transition-colors",f===t?"bg-panel text-fg shadow-sm":"text-fg-subtle hover:text-fg"),children:a},t)})}),"raw"===f&&(0,I.u_)(m.value)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{title:"Expand all",onClick:()=>g({mode:"expand",n:Date.now()}),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(y.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("button",{title:"Collapse all",onClick:()=>g({mode:"collapse",n:Date.now()}),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(w.A,{className:"h-3.5 w-3.5"})})]}),(0,l.jsx)("button",{title:"Copy value",onClick:()=>{navigator.clipboard.writeText((0,I.aB)(m.value)),F.oR.success("Copied")},className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(ei.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("button",{title:"Close",onClick:()=>h(null),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(eh.A,{className:"h-3.5 w-3.5"})})]}),(0,l.jsx)("div",{className:"scrollbar-thin flex-1 overflow-auto p-3",children:(0,I.u_)(m.value)?"tree"===f?(0,l.jsx)(eo.i,{value:m.value,expandAll:!0}):(0,l.jsx)(es.xn,{command:p,children:(0,l.jsx)(es.UU,{value:m.value,collapseRoot:!0})}):(0,l.jsx)("div",{className:(0,d.cn)("whitespace-pre-wrap break-all font-mono text-[13px] leading-5",null!=(t=I.sq[(0,I.I)(m.value)])?t:"text-fg"),children:"String"===(0,I.I)(m.value)?JSON.stringify(m.value):(0,I.aB)(m.value)})})]})]})}let eN=[{label:"ObjectId()",text:"ObjectId()"},{label:"ISODate()",text:"ISODate()"},{label:"NumberLong()",text:"NumberLong('0')"},{label:"NumberDecimal()",text:"NumberDecimal('0.00')"},{label:"UUID()",text:"UUID()"}];function ey(e){let{scope:t,initial:n,onClose:a,onDone:s}=e,[i,c]=(0,u.useState)(n),[x,m]=(0,u.useState)(null),[h,p]=(0,u.useState)(!1),g=(0,u.useRef)(null),f=i.trim().startsWith("[");async function b(){p(!0),m(null);try{let e=await (0,r.FH)("".concat((0,r.wV)(t.cid,t.db,t.coll),"/docs"),{body:{text:i}});F.oR.success("Inserted ".concat((0,d.bu)(e.insertedCount)," document(s)")),s(),a()}catch(e){m(e)}finally{p(!1)}}return(0,l.jsxs)(D.l,{open:!0,onClose:a,width:"max-w-2xl",title:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:["Insert ",f?"documents":"document",(0,l.jsxs)("span",{className:"rounded bg-bg-muted px-1.5 py-0.5 font-mono text-[11px] font-normal text-fg-muted",children:[t.db,".",t.coll]})]}),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{className:"mr-auto flex items-center gap-1 text-[11px] text-fg-subtle",children:[(0,l.jsx)("kbd",{className:"rounded border bg-bg-subtle px-1 font-sans",children:"⌘"}),(0,l.jsx)("kbd",{className:"rounded border bg-bg-subtle px-1 font-sans",children:"Enter"})," to insert"]}),(0,l.jsx)($.$,{onClick:a,children:"Cancel"}),(0,l.jsx)($.$,{variant:"primary",loading:h,onClick:b,children:"Insert"})]}),children:[(0,l.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"mr-0.5 text-[11px] text-fg-muted",title:"Type one document { } or an array [{ }, { }] to insert many",children:"Insert type"}),eN.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>(function(e){let t=g.current;t&&(t.dispatch(t.state.replaceSelection(e)),t.focus())})(e.text),className:"rounded border bg-bg-subtle px-1.5 py-0.5 font-mono text-[10.5px] text-fg-muted transition-colors hover:border-accent hover:text-accent",children:e.label},e.label))]}),(0,l.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:(0,l.jsx)(Q,{value:i,onChange:c,onRun:b,minHeight:"260px",maxHeight:"55vh",onReady:e=>{g.current=e;let t=e.state.doc.toString(),n=t.match(/^\{\n(\s*)\n\}$/),l=n?2+n[1].length:Math.max(0,t.lastIndexOf("}")-1);e.dispatch({selection:{anchor:l}}),e.focus()}})}),null!=x&&(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(o.aV,{error:x})})]})}function ew(e){var t,n;let{scope:a,op:s,filter:i,onClose:c,onDone:x}=e,[m,h]=(0,u.useState)(i||"{}"),[p,g]=(0,u.useState)("{ $set: { } }"),[f,b]=(0,u.useState)(null),[j,v]=(0,u.useState)(null),[N,y]=(0,u.useState)(!1),[w,k]=(0,u.useState)(""),S=(0,r.wV)(a.cid,a.db,a.coll);(0,u.useEffect)(()=>{b(null);let e=setTimeout(async()=>{try{let e=await (0,r.FH)("".concat(S,"/bulk"),{body:{op:s,filter:m,update:p,dryRun:!0}});b({matched:(0,d.bu)(e.matched),sample:e.sample}),v(null)}catch(e){v(e)}},400);return()=>clearTimeout(e)},[m,p,s,S]);let C="delete"===s||(null!=(n=null==f?void 0:f.matched)?n:0)>1e3;async function A(){y(!0);try{let e=await (0,r.FH)("".concat(S,"/bulk"),{body:{op:s,filter:m,update:p,dryRun:!1}});F.oR.success("delete"===s?"Deleted ".concat((0,d.bu)(e.deleted)," document(s)"):"Updated ".concat((0,d.bu)(e.modified)," of ").concat((0,d.bu)(e.matched)," matched")),x(),c()}catch(e){v(e)}finally{y(!1)}}return(0,l.jsx)(D.l,{open:!0,onClose:c,width:"max-w-2xl",title:"delete"===s?"Delete documents":"Update documents",footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:c,children:"Cancel"}),(0,l.jsx)($.$,{variant:"delete"===s?"danger":"primary",loading:N,disabled:!f||0===f.matched||C&&w!==String(f.matched),onClick:A,children:"delete"===s?"Delete ".concat(f?(0,d.ZV)(f.matched):""," documents"):"Update ".concat(f?(0,d.ZV)(f.matched):""," documents")})]}),children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"Filter"}),(0,l.jsx)("div",{className:"rounded-md border",children:(0,l.jsx)(Q,{value:m,onChange:h,minHeight:"40px"})})]}),"update"===s&&(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"Update (operators like $set, $unset, $inc, or a pipeline)"}),(0,l.jsx)("div",{className:"rounded-md border",children:(0,l.jsx)(Q,{value:p,onChange:g,minHeight:"80px"})})]}),(0,l.jsxs)("div",{className:"rounded-md border bg-bg-subtle px-3 py-2 text-xs",children:[f?(0,l.jsxs)("b",{children:[(0,d.ZV)(f.matched)," document(s) match this filter."]}):j?null:(0,l.jsx)(o.y$,{className:"h-3.5 w-3.5"}),null==f||null==(t=f.sample)?void 0:t.slice(0,2).map((e,t)=>(0,l.jsx)("pre",{className:"mt-2 max-h-32 overflow-auto font-mono text-[11px] text-fg-muted",children:(0,I.aB)(e)},t))]}),C&&f&&f.matched>0&&(0,l.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,l.jsxs)("p",{children:["Type ",(0,l.jsx)("b",{children:f.matched})," to confirm:"]}),(0,l.jsx)(M.pd,{value:w,onChange:e=>k(e.target.value)})]}),(0,l.jsx)(o.aV,{error:j})]})})}function ek(e){var t,n,a,c,x,D,I;let{cid:O,db:E,coll:F,role:M,readonly:V}=e,q=(0,u.useMemo)(()=>({cid:O,db:E,coll:F}),[O,E,F]),[z,U]=(0,u.useState)(X),[_,H]=(0,u.useState)(0),[P,B]=(0,u.useState)("list"),[K,J]=(0,u.useState)({mode:"expand",n:0});(0,u.useEffect)(()=>{try{let e=localStorage.getItem("ma-doc-view");("list"===e||"json"===e||"table"===e)&&B(e)}catch(e){}},[]);let Z=(0,u.useCallback)(e=>{B(e);try{localStorage.setItem("ma-doc-view",e)}catch(e){}},[]),[W,Q]=(0,u.useState)(null),[el,ea]=(0,u.useState)(null),[er,ei]=(0,u.useState)(null),[ec,eo]=(0,u.useState)(!1),[eu,ex]=(0,u.useState)(!1),em=(0,m.jE)(),[eh,ep]=(0,u.useState)(!1);(0,u.useEffect)(()=>ep(!1),[z.filter]);let{docs:eg,count:ef,skip:eb}=function(e,t,n,l,a){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=l.skip+a*l.limit,o=(0,r.wV)(e,t,n),u=(0,m.jE)();return{docs:(0,s.I)({queryKey:["docs",e,t,n,l,a],queryFn:()=>{let s=a>0&&Y(l.filter)&&Y(l.sort)?u.getQueryData(["docs",e,t,n,l,a-1]):void 0,i=null==s?void 0:s.docs.at(-1),d=i&&void 0!==i._id?R.On.stringify({id:i._id},{relaxed:!1}):void 0;return(0,r.FH)("".concat(o,"/find"),{query:{filter:l.filter,project:l.project,sort:l.sort,collation:l.collation,skip:c,limit:l.limit,after:d}})},placeholderData:G.rX,staleTime:0}),count:(0,s.I)({queryKey:["count",e,t,n,l.filter,i],queryFn:async()=>{let e=await (0,r.FH)("".concat(o,"/count"),{query:{filter:l.filter,exact:i?1:void 0}});return{count:null===e.count?null:(0,d.bu)(e.count),estimated:e.estimated,timedOut:!!e.timedOut,capped:!!e.capped}},placeholderData:G.rX,staleTime:1e4}),skip:c}}(O,E,F,z,_,eh),ej=(0,i.$3)(M,"editor")&&!V,eN=(0,u.useCallback)(e=>{let t=JSON.stringify(e)===JSON.stringify(z)&&0===_;U(e),H(0),function(e,t,n,l){if(!l.filter&&!l.project&&!l.sort)return;let a={filter:l.filter,project:l.project,sort:l.sort,collation:l.collation,at:Date.now()},s=et(e,t,n).filter(e=>e.fav||e.filter!==a.filter||e.sort!==a.sort||e.project!==a.project);try{localStorage.setItem(ee(e,t,n),JSON.stringify([a,...s].slice(0,50)))}catch(e){}}(O,E,F,e),t&&em.invalidateQueries({queryKey:["docs",O,E,F,e,0]})},[O,E,F,em,z,_]),ek=(0,u.useCallback)(e=>Q(e),[]),eC=(0,u.useCallback)(()=>{em.invalidateQueries({queryKey:["docs",O,E,F]}),em.invalidateQueries({queryKey:["count",O,E,F]}),em.invalidateQueries({queryKey:["collstats",O,E,F]})},[O,E,F,em]),e$=null!=(D=null==(t=eg.data)?void 0:t.docs)?D:[],eD=(0,u.useMemo)(()=>{var e,t;return new Set(null!=(t=null==(e=eg.data)?void 0:e.partial)?t:[])},[eg.data]),eI=null!=(I=null==(n=ef.data)?void 0:n.count)?I:null,eA=e$.length?eb+1:0,eO=eb+e$.length,eE=!!(null==(a=ef.data)?void 0:a.capped),eF=null===eI||eE?e$.length===z.limit:eO<eI;return(0,l.jsxs)("div",{className:"@container flex min-h-0 flex-1 flex-col",children:[(0,l.jsx)(en,{value:z,onRun:eN,onExplain:ei,scope:q}),(0,l.jsxs)("div",{className:"ma-scroll-x flex h-10 shrink-0 items-center gap-1.5 overflow-x-auto overflow-y-hidden border-b bg-bg px-3 [&>*]:shrink-0",children:[ej&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)($.$,{variant:"primary",title:"Add data",onClick:()=>Q("{\n \n}"),children:[(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden @[760px]:inline",children:"Add data"})]}),(0,l.jsxs)($.$,{title:"Import",onClick:()=>ex(!0),children:[(0,l.jsx)(p.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden @[760px]:inline",children:"Import"})]})]}),(0,l.jsxs)($.$,{title:"Export",onClick:()=>eo(!0),children:[(0,l.jsx)(g.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden @[760px]:inline",children:"Export"})]}),ej&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)($.$,{title:"Update many",onClick:()=>ea("update"),children:[(0,l.jsx)(f.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden @[760px]:inline",children:"Update"})]}),(0,l.jsxs)($.$,{variant:"danger-outline",title:"Delete many",onClick:()=>ea("delete"),children:[(0,l.jsx)(b.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden @[760px]:inline",children:"Delete"})]})]}),(0,l.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-xs text-fg-muted",children:[eg.data&&(0,l.jsxs)("span",{className:"hidden whitespace-nowrap text-[11px] tabular-nums text-fg-subtle @[600px]:inline",children:[(0,d.bu)(eg.data.ms)," ms"]}),(0,l.jsx)($.$,{size:"icon",variant:"ghost",title:"Refresh",onClick:eC,children:(0,l.jsx)(j.A,{className:(0,d.cn)("h-3.5 w-3.5",eg.isFetching&&"animate-spin")})}),(0,l.jsxs)("div",{className:"flex h-7 items-center rounded-md border border-border-strong",children:[(0,l.jsxs)("span",{className:"whitespace-nowrap px-2.5 text-[12px] tabular-nums text-fg",children:[(0,d.ZV)(eA),"–",(0,d.ZV)(eO)," ",(0,l.jsx)("span",{className:"text-fg-subtle",children:"of"})," ",ef.isLoading?"…":null===eI?(null==(c=ef.data)?void 0:c.timedOut)?"many":"?":eE?(0,l.jsxs)("button",{onClick:()=>ep(!0),title:"More than 10,000 match. Click to count them all (can be slow on big collections).",className:"underline decoration-dotted underline-offset-2 hover:text-accent",children:[(0,d.ZV)(eI),"+"]}):"".concat((null==(x=ef.data)?void 0:x.estimated)?"~":"").concat((0,d.ZV)(eI)),eh&&ef.isFetching&&" …"]}),(0,l.jsx)("button",{disabled:0===_,onClick:()=>H(e=>e-1),title:"Previous page",className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted disabled:opacity-40",children:(0,l.jsx)(v.A,{className:"h-4 w-4"})}),(0,l.jsx)("button",{disabled:!eF,onClick:()=>H(e=>e+1),title:"Next page",className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted disabled:opacity-40",children:(0,l.jsx)(N.A,{className:"h-4 w-4"})})]}),"json"===P&&(0,l.jsxs)("div",{className:"flex h-7 items-center rounded-md border border-border-strong",children:[(0,l.jsx)("button",{title:"Expand all documents",onClick:()=>J({mode:"expand",n:Date.now()}),className:"flex h-full w-7 items-center justify-center text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(y.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("button",{title:"Collapse all documents",onClick:()=>J({mode:"collapse",n:Date.now()}),className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,l.jsx)(w.A,{className:"h-3.5 w-3.5"})})]}),(0,l.jsx)(o.I2,{value:P,onChange:Z,items:[{value:"list",label:(0,l.jsx)(k.A,{className:"h-3.5 w-3.5"})},{value:"json",label:(0,l.jsx)(S.A,{className:"h-3.5 w-3.5"})},{value:"table",label:(0,l.jsx)(C.A,{className:"h-3.5 w-3.5"})}]})]})]}),(0,l.jsx)("div",{className:"min-h-0 flex-1 bg-bg-subtle",children:eg.error?(0,l.jsx)("div",{className:"p-4",children:(0,l.jsx)(o.aV,{error:eg.error})}):eg.isLoading?(0,l.jsx)("div",{className:"flex justify-center p-10",children:(0,l.jsx)(o.y$,{})}):0===e$.length?(0,l.jsx)(o.Sv,{title:z.filter?"No documents match this filter":"This collection has no documents",children:ej&&!z.filter&&(0,l.jsxs)($.$,{className:"mt-2",variant:"primary",onClick:()=>Q("{\n \n}"),children:[(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"}),"Insert document"]})}):"table"===P?(0,l.jsx)(ev,{docs:e$,onOpen:()=>Z("list"),storageKey:"ma-colw:".concat(O,":").concat(E,":").concat(F)}):(0,l.jsx)(es.xn,{command:K,children:(0,l.jsx)(eS,{docs:e$,render:(e,t)=>(0,l.jsx)(ed,{doc:e,partial:eD.has(t),scope:q,canEdit:ej,mode:P,onChanged:eC,onClone:ek})})})}),null!==W&&(0,l.jsx)(ey,{scope:q,initial:W,onClose:()=>Q(null),onDone:eC}),el&&(0,l.jsx)(ew,{scope:q,op:el,filter:z.filter,onClose:()=>ea(null),onDone:eC}),er&&(0,l.jsx)(A,{scope:q,kind:"find",query:er,onClose:()=>ei(null)}),ec&&(0,l.jsx)(T,{scope:q,query:z,total:eI,onClose:()=>eo(!1)}),eu&&(0,l.jsx)(L,{scope:q,onClose:()=>ex(!1),onDone:eC})]})}function eS(e){let{docs:t,render:n}=e,a=(0,u.useRef)(null),s=(0,x.Te)({count:t.length,getScrollElement:()=>a.current,estimateSize:()=>150,overscan:4,gap:6});return(0,l.jsx)("div",{ref:a,className:"scrollbar-thin h-full overflow-auto px-3 py-2.5",children:(0,l.jsx)("div",{style:{height:s.getTotalSize(),position:"relative"},children:s.getVirtualItems().map(e=>(0,l.jsx)("div",{"data-index":e.index,ref:s.measureElement,style:{position:"absolute",top:0,left:0,right:0,transform:"translateY(".concat(e.start,"px)")},children:n(t[e.index],e.index)},e.key))})})}var eC=n(6787),e$=n(8386),eD=n(7709),eI=n(3228),eA=n(209),eO=n(7550);let eE={$match:"{\n field: 'value'\n}",$project:"{\n field: 1\n}",$group:"{\n _id: '$field',\n count: { $sum: 1 }\n}",$sort:"{\n field: -1\n}",$limit:"10",$skip:"0",$unwind:"'$arrayField'",$lookup:"{\n from: 'otherCollection',\n localField: 'field',\n foreignField: '_id',\n as: 'joined'\n}",$addFields:"{\n newField: '$field'\n}",$set:"{\n newField: '$field'\n}",$unset:"'field'",$count:"'total'",$facet:"{\n byField: [{ $sortByCount: '$field' }]\n}",$bucket:"{\n groupBy: '$field',\n boundaries: [0, 10, 100],\n default: 'other'\n}",$sortByCount:"'$field'",$sample:"{\n size: 10\n}",$replaceRoot:"{\n newRoot: '$field'\n}",$geoNear:"{\n near: { type: 'Point', coordinates: [0, 0] },\n distanceField: 'dist'\n}",$out:"'outputCollection'",$merge:"{\n into: 'outputCollection'\n}"},eF={$match:"Filter documents",$project:"Pick or reshape fields",$group:"Group and aggregate",$sort:"Sort documents",$limit:"Keep the first N",$skip:"Skip the first N",$unwind:"One document per array item",$lookup:"Join another collection",$addFields:"Add computed fields",$set:"Add computed fields",$unset:"Remove fields",$count:"Count documents",$facet:"Run several pipelines at once",$bucket:"Group into ranges",$sortByCount:"Group, count and sort",$sample:"Random sample",$replaceRoot:"Promote a sub-document",$geoNear:"Sort by distance",$out:"Write results to a collection",$merge:"Merge results into a collection"},eR={mode:"collapse",n:1};function eM(e){let{doc:t}=e;return(0,l.jsx)("div",{className:"rounded-md border bg-panel py-1 pl-1 pr-2",children:(0,l.jsx)(es.xn,{command:eR,children:(0,l.jsx)(es.UU,{value:t,bare:!0})})})}let eT=1,eL=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"$match";return{id:eT++,op:t,body:null!=(e=eE[t])?e:"{}",enabled:!0}};function eV(e,t){return"[\n".concat(e.filter((e,n)=>e.enabled&&(void 0===t||n<=t)).map(e=>" { ".concat(e.op,": ").concat(e.body.replace(/\n/g,"\n ")," }")).join(",\n"),"\n]")}function eq(e){let{cid:t,db:n,coll:a,role:s}=e,c="ma-pipe:".concat(t,":").concat(n,":").concat(a),[x,m]=(0,u.useState)("builder"),[p,g]=(0,u.useState)(()=>[eL("$match")]),[f,b]=(0,u.useState)("[\n { $match: {} }\n]"),[j,v]=(0,u.useState)(null),[N,y]=(0,u.useState)(null),[w,k]=(0,u.useState)(!1),[S,C]=(0,u.useState)(!1),[D,I]=(0,u.useState)([]),O=(0,r.wV)(t,n,a);(0,u.useEffect)(()=>{try{var e;I(JSON.parse(null!=(e=localStorage.getItem(c))?e:"[]"))}catch(e){}},[c]);let E="builder"===x?eV(p):f,R=/\$(out|merge)\b/.test(E),T=(0,u.useCallback)(async()=>{k(!0),y(null);try{let e=await (0,r.FH)("".concat(O,"/aggregate"),{body:{pipeline:E,limit:100}});v({docs:e.docs,ms:(0,d.bu)(e.ms),wrote:e.wrote}),e.wrote&&F.oR.success("Pipeline ran and wrote its output")}catch(e){y(e)}finally{k(!1)}},[O,E]),[L,V]=(0,u.useState)(null);return(0,l.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,l.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b px-3",children:[(0,l.jsx)("div",{className:"flex rounded-md bg-bg-muted p-0.5",children:[["builder","Stages",(0,l.jsx)(eC.A,{className:"h-3.5 w-3.5"},"s")],["text","Text",(0,l.jsx)(e$.A,{className:"h-3.5 w-3.5"},"t")]].map(e=>{let[t,n,a]=e;return(0,l.jsxs)("button",{onClick:()=>{"text"===t&&b(eV(p)),m(t)},className:(0,d.cn)("flex h-6 items-center gap-1.5 rounded px-2.5 text-[12px] transition-colors",x===t?"bg-panel font-medium text-fg shadow-sm":"text-fg-muted hover:text-fg"),children:[a,n]},t)})}),"builder"===x&&(0,l.jsxs)("span",{className:"text-[12px] text-fg-muted",children:[(0,l.jsx)("b",{className:"text-fg",children:p.length})," ",1===p.length?"stage":"stages",p.some(e=>!e.enabled)&&" \xb7 ".concat(p.filter(e=>!e.enabled).length," disabled")]}),D.length>0&&(0,l.jsxs)(M.l6,{className:"h-7 w-48 text-xs",value:"",onChange:e=>{let t=D.find(t=>t.name===e.target.value);t&&(b(t.text),m("text"))},children:[(0,l.jsx)("option",{value:"",children:"Open saved pipeline…"}),D.map(e=>(0,l.jsx)("option",{children:e.name},e.name))]}),(0,l.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,l.jsxs)($.$,{onClick:()=>{navigator.clipboard.writeText("db.getCollection(".concat(JSON.stringify(a),").aggregate(").concat(E,");")),F.oR.success("Copied as mongosh code")},children:[(0,l.jsx)(ei.A,{className:"h-3.5 w-3.5"}),"Export to code"]}),null===L?(0,l.jsxs)($.$,{onClick:()=>V(""),children:[(0,l.jsx)(eD.A,{className:"h-3.5 w-3.5"}),"Save"]}):(0,l.jsxs)("form",{className:"flex gap-1",onSubmit:e=>{e.preventDefault(),function(){let e=null==L?void 0:L.trim();if(!e)return;let t=[{name:e,text:E},...D.filter(t=>t.name!==e)];I(t);try{localStorage.setItem(c,JSON.stringify(t))}catch(e){}V(null),F.oR.success("Pipeline saved")}()},children:[(0,l.jsx)("input",{autoFocus:!0,value:L,onChange:e=>V(e.target.value),onKeyDown:e=>"Escape"===e.key&&V(null),placeholder:"Pipeline name",className:"h-7 w-40 rounded-md border border-border-strong bg-panel px-2 text-xs outline-none focus:border-accent"}),(0,l.jsx)($.$,{type:"submit",variant:"primary",disabled:!L.trim(),children:"Save"})]}),(0,l.jsx)($.$,{onClick:()=>C(!0),children:"Explain"}),(0,l.jsxs)($.$,{variant:"primary",loading:w,onClick:T,disabled:R&&!(0,i.$3)(s,"editor"),title:R&&!(0,i.$3)(s,"editor")?"$out/$merge need the editor role":void 0,children:[(0,l.jsx)(eI.A,{className:"h-3.5 w-3.5"}),"Run"]})]})]}),(0,l.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,l.jsx)("div",{className:"scrollbar-thin min-w-0 flex-1 overflow-auto bg-bg-subtle p-3",children:"text"===x?(0,l.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong bg-panel focus-within:border-accent",children:(0,l.jsx)(Q,{value:f,onChange:b,onRun:T,minHeight:"300px"})}):(0,l.jsxs)("div",{className:"space-y-2.5",children:[p.map((e,s)=>(0,l.jsx)(ez,{cid:t,db:n,coll:a,stages:p,index:s,stage:e,onChange:t=>g(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>g(t=>t.filter(t=>t.id!==e.id)),onMove:e=>g(t=>{let n=[...t];return[n[s],n[s+e]]=[n[s+e],n[s]],n})},e.id)),(0,l.jsxs)("button",{onClick:()=>g(e=>[...e,eL("$project")]),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-md border border-dashed border-border-strong text-[12.5px] text-fg-muted transition-colors hover:border-accent hover:bg-accent-soft/40 hover:text-accent",children:[(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"}),"Add stage"]})]})}),(0,l.jsxs)("div",{className:"flex w-[40%] min-w-80 flex-col border-l bg-panel",children:[(0,l.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b bg-bg-subtle px-3 text-[12px]",children:[(0,l.jsx)("span",{className:"font-semibold",children:"Output"}),j&&(0,l.jsxs)("span",{className:"text-fg-muted",children:[(0,l.jsx)("b",{className:"text-fg",children:j.docs.length})," ",1===j.docs.length?"document":"documents",100===j.docs.length?" (first 100)":""," \xb7 ",j.ms," ms"]})]}),(0,l.jsxs)("div",{className:"scrollbar-thin flex-1 space-y-1.5 overflow-auto bg-bg-subtle p-3",children:[(0,l.jsx)(o.aV,{error:N}),w&&(0,l.jsx)(o.y$,{}),!j&&!w&&!N&&(0,l.jsx)(o.Sv,{title:"Run the pipeline to see results",children:"Each stage also shows a live preview of its output."}),j&&0===j.docs.length&&(0,l.jsx)(o.Sv,{title:"The pipeline returned no documents"}),null==j?void 0:j.docs.map((e,t)=>(0,l.jsx)(eM,{doc:e},t))]})]})]}),S&&(0,l.jsx)(A,{scope:{cid:t,db:n,coll:a},kind:"aggregate",pipeline:E,onClose:()=>C(!1)})]})}function ez(e){var t;let{cid:n,db:a,coll:s,stages:i,index:c,stage:x,onChange:m,onRemove:h,onMove:p}=e,[g,f]=(0,u.useState)(null),[j,v]=(0,u.useState)(null),[N,y]=(0,u.useState)(!1),w=(0,u.useMemo)(()=>eV(i,c),[i,c]),k="$out"===x.op||"$merge"===x.op;return(0,u.useEffect)(()=>{if(!x.enabled||k)return void f(null);y(!0);let e=setTimeout(async()=>{try{let e=await (0,r.FH)("".concat((0,r.wV)(n,a,s),"/aggregate"),{body:{pipeline:w,uptoStage:i.filter(e=>e.enabled).indexOf(x),previewLimit:10}});f({docs:e.docs,ms:(0,d.bu)(e.ms)}),v(null)}catch(e){v(e),f(null)}finally{y(!1)}},600);return()=>clearTimeout(e)},[w,n,a,s,x,i,k]),(0,l.jsxs)("div",{className:(0,d.cn)("group overflow-hidden rounded-md border bg-panel",!x.enabled&&"opacity-55"),children:[(0,l.jsxs)("div",{className:"flex h-9 items-center gap-2 border-b px-2.5",children:[(0,l.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-accent-soft text-[10.5px] font-semibold text-accent",children:c+1}),(0,l.jsx)("select",{value:x.op,onChange:e=>{var t;return m({op:e.target.value,body:null!=(t=eE[e.target.value])?t:"{}"})},className:"h-6 cursor-pointer rounded bg-bg-muted px-1.5 font-mono text-[12px] font-semibold text-fg outline-none hover:bg-border focus:ring-2 focus:ring-accent/20",children:Object.keys(eE).map(e=>(0,l.jsx)("option",{children:e},e))}),(0,l.jsx)("span",{className:"hidden truncate text-[11px] text-fg-subtle md:inline",children:null!=(t=eF[x.op])?t:""}),(0,l.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,l.jsxs)("div",{className:"flex gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,l.jsx)($.$,{size:"icon-xs",variant:"ghost",title:"Move up",onClick:()=>p(-1),disabled:0===c,children:(0,l.jsx)(eA.A,{className:"h-3 w-3"})}),(0,l.jsx)($.$,{size:"icon-xs",variant:"ghost",title:"Move down",onClick:()=>p(1),disabled:c===i.length-1,children:(0,l.jsx)(eO.A,{className:"h-3 w-3"})}),(0,l.jsx)($.$,{size:"icon-xs",variant:"ghost",title:"Delete stage",onClick:h,children:(0,l.jsx)(b.A,{className:"h-3 w-3"})})]}),(0,l.jsx)("label",{className:"ml-1.5 flex cursor-pointer items-center gap-1.5 text-[11px] text-fg-muted",title:x.enabled?"Disable this stage":"Enable this stage",children:(0,l.jsxs)("span",{className:(0,d.cn)("relative h-4 w-7 rounded-full transition-colors",x.enabled?"bg-accent":"bg-border-strong"),children:[(0,l.jsx)("span",{className:(0,d.cn)("absolute top-0.5 h-3 w-3 rounded-full bg-white shadow transition-all",x.enabled?"left-3.5":"left-0.5")}),(0,l.jsx)("input",{type:"checkbox",className:"sr-only",checked:x.enabled,onChange:e=>m({enabled:e.target.checked})})]})})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2",children:[(0,l.jsx)("div",{className:"ma-editor border-r",children:(0,l.jsx)(Q,{value:x.body,onChange:e=>m({body:e}),minHeight:"120px",maxHeight:"280px"})}),(0,l.jsxs)("div",{className:"flex max-h-[280px] min-h-[120px] flex-col bg-bg-subtle",children:[(0,l.jsxs)("div",{className:"flex h-7 shrink-0 items-center gap-1.5 border-b px-2.5 text-[11px] text-fg-muted",children:[(0,l.jsx)("span",{className:"font-medium text-fg",children:"Output"}),g&&!k&&(0,l.jsxs)("span",{children:["\xb7 ",g.docs.length," ",1===g.docs.length?"doc":"docs"," (sample) \xb7 ",g.ms," ms"]}),N&&(0,l.jsx)(o.y$,{className:"ml-auto h-3 w-3"})]}),(0,l.jsx)("div",{className:"scrollbar-thin flex-1 space-y-1.5 overflow-auto p-2",children:k?(0,l.jsxs)("p",{className:"text-[11px] text-fg-muted",children:[x.op," writes data, so it has no preview. It runs only when you press Run."]}):x.enabled?j?(0,l.jsx)(o.aV,{error:j}):g&&0===g.docs.length?(0,l.jsxs)("p",{className:"pt-6 text-center text-[11.5px] text-fg-muted",children:["No documents after this stage.",(0,l.jsx)("br",{}),(0,l.jsx)("span",{className:"text-fg-subtle",children:"Check the filter above."})]}):null==g?void 0:g.docs.map((e,t)=>(0,l.jsx)(eM,{doc:e},t)):(0,l.jsx)("p",{className:"text-[11px] text-fg-muted",children:"Stage is disabled — it is skipped when the pipeline runs."})})]})]})]})}let eU={String:"bg-emerald-500",Number:"bg-blue-500",Int32:"bg-blue-500",Double:"bg-sky-500",Long:"bg-indigo-500",Decimal128:"bg-indigo-400",Date:"bg-amber-500",ObjectId:"bg-purple-500",Boolean:"bg-fuchsia-500",Document:"bg-teal-500",Array:"bg-cyan-600",Null:"bg-gray-400",Undefined:"bg-gray-300",Binary:"bg-violet-400",UUID:"bg-violet-500"};function e_(e){let{cid:t,db:n,coll:a}=e,[i,c]=(0,u.useState)(""),[x,m]=(0,u.useState)(1e3),[h,p]=(0,u.useState)(null),g=(0,s.I)({queryKey:["schema",t,n,a,h],queryFn:()=>(0,r.FH)("".concat((0,r.wV)(t,n,a),"/schema"),{query:{filter:h.filter,size:h.size}}),enabled:!!h,staleTime:1/0}),f=()=>p({filter:i,size:x});return(0,l.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg px-3 py-2",children:[(0,l.jsxs)("div",{className:"flex h-8 min-w-0 flex-1 items-stretch overflow-hidden rounded-md border border-border-strong bg-panel focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:[(0,l.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Filter"}),(0,l.jsx)(Q,{className:"ma-oneline min-w-0 flex-1",value:i,onChange:c,onRun:f,oneLine:!0,placeholder:"{ } \xb7 empty = whole collection \xb7 Enter to analyze"})]}),(0,l.jsxs)("div",{className:"flex h-8 items-center rounded-md border border-border-strong bg-panel p-0.5",title:"How many random documents to sample",children:[(0,l.jsx)("span",{className:"px-2 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Sample"}),[100,1e3,5e3,1e4].map(e=>(0,l.jsx)("button",{onClick:()=>m(e),className:(0,d.cn)("h-6 rounded px-2 text-[12px] tabular-nums transition-colors",x===e?"bg-accent-soft font-medium text-accent":"text-fg-muted hover:text-fg"),children:e>=1e3?"".concat(e/1e3,"k"):e},e))]}),(0,l.jsxs)($.$,{size:"md",variant:"primary",onClick:f,loading:g.isFetching,children:[(0,l.jsx)(eI.A,{className:"h-3.5 w-3.5"}),"Analyze"]})]}),(0,l.jsxs)("div",{className:"scrollbar-thin flex-1 overflow-auto p-4",children:[(0,l.jsx)(o.aV,{error:g.error}),!h&&(0,l.jsx)(o.Sv,{title:"Analyze the schema",children:"See every field, its types and how often it appears — from a random sample, so it is fast on any size."}),g.isFetching&&(0,l.jsx)("div",{className:"flex justify-center p-10",children:(0,l.jsx)(o.y$,{})}),g.data&&!g.isFetching&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{className:"mb-3 text-xs text-fg-muted",children:["Analyzed ",(0,l.jsx)("b",{className:"text-fg",children:(0,d.ZV)((0,d.bu)(g.data.schema.count))})," documents \xb7 ",g.data.schema.fields.length," top-level fields \xb7 ",(0,d.bu)(g.data.ms)," ms"]}),(0,l.jsx)("div",{className:"space-y-2",children:g.data.schema.fields.map(e=>(0,l.jsx)(eH,{f:e,total:(0,d.bu)(g.data.schema.count)},e.name))})]})]})]})}function eH(e){var t,n;let{f:a,total:s,depth:r=0}=e,[i,c]=(0,u.useState)(!1),o=[...a.types].sort((e,t)=>(0,d.bu)(t.probability)-(0,d.bu)(e.probability)),x=o.flatMap(e=>{var t,n;return"Document"===e.name?null!=(t=e.fields)?t:[]:"Array"===e.name?(null!=(n=e.types)?n:[]).flatMap(e=>{var t;return"Document"===e.name&&null!=(t=e.fields)?t:[]}):[]}),[m,h]=(0,u.useState)(null==(t=o[0])?void 0:t.name),p=null!=(n=o.find(e=>e.name===m))?n:o[0],g=(0,d.bu)(a.probability);return(0,l.jsxs)("div",{className:(0,d.cn)("rounded-lg border bg-panel",r>0&&"ml-6"),children:[(0,l.jsxs)("div",{className:"grid grid-cols-[minmax(180px,260px)_1fr] gap-4 p-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[x.length>0?(0,l.jsx)("button",{onClick:()=>c(e=>!e),className:"text-fg-subtle",children:i?(0,l.jsx)(z.A,{className:"h-3.5 w-3.5"}):(0,l.jsx)(N.A,{className:"h-3.5 w-3.5"})}):(0,l.jsx)("span",{className:"w-3.5"}),(0,l.jsx)("span",{className:"truncate font-mono text-[13px] font-semibold",title:a.path.join("."),children:a.name})]}),(0,l.jsxs)("p",{className:"mt-1 pl-[18px] text-[11px] text-fg-muted",children:["In ",(0,l.jsxs)("b",{className:(0,d.cn)(g<1?"text-warn":"text-fg"),children:[(100*g).toFixed(+(g<1&&g>.99)),"%"]})," of documents"]})]}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"flex h-2.5 overflow-hidden rounded-full bg-bg-muted",children:o.map(e=>{var t;return(0,l.jsx)("button",{onClick:()=>h(e.name),title:"".concat(e.name,": ").concat((100*(0,d.bu)(e.probability)).toFixed(1),"%"),style:{width:"".concat(100*(0,d.bu)(e.probability),"%")},className:(0,d.cn)(null!=(t=eU[e.name])?t:"bg-gray-500",m===e.name?"":"opacity-60")},e.name)})}),(0,l.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-x-3 text-[11px]",children:o.map(e=>{var t;return(0,l.jsxs)("button",{onClick:()=>h(e.name),className:(0,d.cn)("flex items-center gap-1",m===e.name?"font-semibold text-fg":"text-fg-muted"),children:[(0,l.jsx)("span",{className:(0,d.cn)("h-2 w-2 rounded-full",null!=(t=eU[e.name])?t:"bg-gray-500")}),e.name," ",(100*(0,d.bu)(e.probability)).toFixed(0),"%"]},e.name)})}),p&&(0,l.jsx)(eP,{t:p,total:s})]})]}),i&&(0,l.jsx)("div",{className:"space-y-2 border-t p-2",children:(function(e){let t=new Map;for(let n of e)t.has(n.name)||t.set(n.name,n);return[...t.values()]})(x).map(e=>(0,l.jsx)(eH,{f:e,total:s,depth:r+1},e.name))})]})}function eP(e){var t,n,a,s;let{t:r}=e,i=(null!=(t=r.values)?t:[]).slice(0,50);if("Array"===r.name)return(0,l.jsxs)("p",{className:"mt-2 text-[11px] text-fg-muted",children:["Array lengths: min ",Math.min(...(null!=(n=r.lengths)?n:[0]).map(d.bu)),", max ",Math.max(...(null!=(a=r.lengths)?a:[0]).map(d.bu))]});if("Document"===r.name||0===i.length)return null;if(["Number","Int32","Double","Long","Decimal128"].includes(r.name)){let e=i.map(d.bu).filter(e=>Number.isFinite(e));if(!e.length)return null;let t=Math.min(...e),n=Math.max(...e),a=Array(12).fill(0);for(let l of e)a[Math.min(11,Math.floor((l-t)/(n-t||1)*12))]++;let s=Math.max(...a);return(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsx)("div",{className:"flex h-12 items-end gap-0.5",children:a.map((e,t)=>(0,l.jsx)("div",{className:"flex-1 rounded-t bg-accent/70",style:{height:"".concat(e/s*100,"%")},title:"".concat(e)},t))}),(0,l.jsxs)("p",{className:"mt-1 flex justify-between text-[10px] text-fg-subtle",children:[(0,l.jsxs)("span",{children:["min ",(0,d.ZV)(t)]}),(0,l.jsxs)("span",{children:["max ",(0,d.ZV)(n)]})]})]})}let c=new Map;for(let e of i){let t=(0,I.VH)(e);c.set(t,(null!=(s=c.get(t))?s:0)+1)}let o=[...c.entries()].sort((e,t)=>t[1]-e[1]).slice(0,8);return(0,l.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:o.map(e=>{let[t,n]=e;return(0,l.jsxs)("span",{className:"max-w-[240px] truncate rounded bg-bg-muted px-1.5 py-0.5 font-mono text-[10.5px]",title:"".concat(t," (").concat(n,")"),children:[t,n>1&&(0,l.jsxs)("span",{className:"text-fg-subtle",children:[" \xd7",n]})]},t)})})}var eB=n(4763),eK=n(832),eJ=n(4287);function eZ(e){var t,n;let{cid:a,db:c,coll:x,role:p}=e,g=(0,r.wV)(a,c,x),f=(0,m.jE)(),v=(0,s.I)({queryKey:["indexes",a,c,x],queryFn:()=>(0,r.FH)("".concat(g,"/indexes"))}),[N,y]=(0,u.useState)(!1),[w,k]=(0,u.useState)(null),S=(0,i.$3)(p,"admin"),C=()=>{f.invalidateQueries({queryKey:["indexes",a,c,x]}),f.invalidateQueries({queryKey:["collstats",a,c,x]})};async function D(e){try{await (0,r.FH)("".concat(g,"/indexes"),{method:"PATCH",body:{name:e.name,hidden:!e.hidden}}),F.oR.success(e.hidden?"Index unhidden":"Index hidden"),C()}catch(e){F.oR.error(e.message)}}let A=null!=(n=null==(t=v.data)?void 0:t.indexes)?n:[],O=A.reduce((e,t)=>e+(null===t.size?0:(0,d.bu)(t.size)),0),E=Math.max(1,...A.map(e=>e.usage?(0,d.bu)(e.usage.ops):0));return(0,l.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,l.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b px-3",children:[S&&(0,l.jsxs)($.$,{variant:"primary",onClick:()=>y(!0),children:[(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"}),"Create index"]}),v.data&&(0,l.jsxs)("span",{className:"text-[12px] text-fg-muted",children:[(0,l.jsx)("b",{className:"text-fg",children:A.length})," ",1===A.length?"index":"indexes"," \xb7 ",(0,l.jsx)("b",{className:"text-fg",children:(0,d.z3)(O)})," total"]}),(0,l.jsx)($.$,{size:"icon",variant:"ghost",className:"ml-auto",onClick:C,title:"Refresh",children:(0,l.jsx)(j.A,{className:(0,d.cn)("h-3.5 w-3.5",v.isFetching&&"animate-spin")})})]}),(0,l.jsxs)("div",{className:"scrollbar-thin flex-1 overflow-auto bg-panel",children:[v.isLoading&&(0,l.jsx)("div",{className:"p-4",children:(0,l.jsx)(o.y$,{})}),null!=v.error&&(0,l.jsx)("div",{className:"p-4",children:(0,l.jsx)(o.aV,{error:v.error})}),v.data&&(0,l.jsxs)("table",{className:"w-full border-separate border-spacing-0 text-[12px]",children:[(0,l.jsx)("thead",{className:"sticky top-0 z-10 bg-bg-subtle",children:(0,l.jsxs)("tr",{className:"text-left text-[11px] text-fg-muted",children:[(0,l.jsx)("th",{className:"h-8 border-b px-4 font-semibold",children:"Index"}),(0,l.jsx)("th",{className:"h-8 w-[110px] border-b px-3 font-semibold",children:"Type"}),(0,l.jsx)("th",{className:"h-8 w-[90px] border-b px-3 font-semibold",children:"Size"}),(0,l.jsx)("th",{className:"h-8 w-[170px] border-b px-3 font-semibold",children:"Usage"}),(0,l.jsx)("th",{className:"h-8 w-[200px] border-b px-3 font-semibold",children:"Properties"}),(0,l.jsx)("th",{className:"h-8 w-[84px] border-b px-3"})]})}),(0,l.jsx)("tbody",{children:A.map(e=>{var t;let n=e.usage?(0,d.bu)(e.usage.ops):null;return(0,l.jsxs)("tr",{className:(0,d.cn)("group hover:bg-bg-subtle",e.hidden&&"opacity-60"),children:[(0,l.jsx)("td",{className:"h-9 border-b px-4",children:(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,l.jsx)("span",{className:"shrink-0 font-mono text-[12px] font-semibold",children:e.name}),(0,l.jsx)("span",{className:"flex min-w-0 flex-wrap gap-1",children:Object.entries(e.key).map(e=>{let[t,n]=e;return(0,l.jsx)(eW,{field:t,dir:n},t)})})]})}),(0,l.jsx)("td",{className:"border-b px-3",children:(0,l.jsx)(eG,{type:function(e){let t=Object.values(e.key).map(String);return t.includes("text")?"Text":t.includes("2dsphere")?"Geospatial":t.includes("hashed")?"Hashed":Object.keys(e.key).some(e=>e.includes("$**"))?"Wildcard":Object.keys(e.key).length>1?"Compound":"Regular"}(e)})}),(0,l.jsx)("td",{className:"border-b px-3 tabular-nums",children:(0,d.z3)(null===e.size?null:(0,d.bu)(e.size))}),(0,l.jsx)("td",{className:"border-b px-3",children:null===n?(0,l.jsx)("span",{className:"text-fg-subtle",children:"—"}):0===n?(0,l.jsx)("span",{className:"inline-flex h-[18px] items-center rounded bg-warn-soft px-1.5 text-[10.5px] font-medium text-warn",title:"No queries have used this index since the server started",children:"Never used"}):(0,l.jsxs)("div",{className:"flex items-center gap-2",title:(null==(t=e.usage)?void 0:t.since)?"Counted since ".concat(new Date(e.usage.since).toLocaleString()):void 0,children:[(0,l.jsxs)("span",{className:"w-16 shrink-0 tabular-nums",children:[(0,d.ZV)(n)," ops"]}),(0,l.jsx)("div",{className:"h-1 w-16 overflow-hidden rounded-full bg-bg-muted",children:(0,l.jsx)("div",{className:"h-full rounded-full bg-accent/80",style:{width:"".concat(Math.max(4,n/E*100),"%")}})})]})}),(0,l.jsx)("td",{className:"border-b px-3",children:(0,l.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.unique&&(0,l.jsx)(o.Ex,{tone:"accent",children:"unique"}),e.sparse&&(0,l.jsx)(o.Ex,{children:"sparse"}),void 0!==e.expireAfterSeconds&&(0,l.jsxs)(o.Ex,{tone:"warn",children:["TTL ",(0,d.bu)(e.expireAfterSeconds),"s"]}),e.partialFilterExpression&&(0,l.jsx)("span",{title:(0,I.aB)(e.partialFilterExpression).replace(/\s+/g," "),children:(0,l.jsx)(o.Ex,{children:"partial"})}),e.hidden&&(0,l.jsx)(o.Ex,{tone:"warn",children:"hidden"}),!e.unique&&!e.sparse&&void 0===e.expireAfterSeconds&&!e.partialFilterExpression&&!e.hidden&&(0,l.jsx)("span",{className:"text-fg-subtle",children:"—"})]})}),(0,l.jsx)("td",{className:"border-b px-3 text-right",children:"_id_"===e.name?(0,l.jsx)("span",{title:"The _id index is required and cannot be dropped",className:"inline-flex text-fg-subtle",children:(0,l.jsx)(eB.A,{className:"h-3.5 w-3.5"})}):S?(0,l.jsxs)("div",{className:"flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,l.jsx)($.$,{size:"icon-xs",variant:"ghost",title:e.hidden?"Unhide":"Hide (test dropping safely)",onClick:()=>D(e),children:e.hidden?(0,l.jsx)(eK.A,{className:"h-3.5 w-3.5"}):(0,l.jsx)(eJ.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)($.$,{size:"icon-xs",variant:"ghost",title:"Drop index",onClick:()=>k(e.name),children:(0,l.jsx)(b.A,{className:"h-3.5 w-3.5"})})]}):null})]},e.name)})})]})]}),N&&(0,l.jsx)(eY,{base:g,onClose:()=>y(!1),onDone:C}),w&&(0,l.jsx)(e1,{base:g,name:w,onClose:()=>k(null),onDone:C})]})}function eW(e){let{field:t,dir:n}=e,a="object"==typeof n&&null!==n&&"valueOf"in n?n.valueOf():n,s=1===a?"↑":-1===a?"↓":String(a);return(0,l.jsxs)("span",{className:"inline-flex h-[18px] items-center gap-1 rounded bg-bg-muted px-1.5 font-mono text-[11px]",title:"".concat(t,": ").concat(String(a)),children:[(0,l.jsx)("span",{className:"text-fg",children:t}),(0,l.jsx)("span",{className:(0,d.cn)("text-[10.5px]",1===a||-1===a?"text-accent":"text-fg-muted"),children:s})]})}let eQ={Regular:"bg-bg-muted text-fg-muted",Compound:"bg-sky-100 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300",Text:"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300",Geospatial:"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",Hashed:"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300",Wildcard:"bg-pink-100 text-pink-700 dark:bg-pink-500/15 dark:text-pink-300"};function eG(e){var t;let{type:n}=e;return(0,l.jsx)("span",{className:(0,d.cn)("inline-flex h-[18px] items-center rounded px-1.5 text-[10.5px] font-medium",null!=(t=eQ[n])?t:eQ.Regular),children:n})}let eX=[{v:"1",label:"Ascending ↑"},{v:"-1",label:"Descending ↓"},{v:"text",label:"Text"},{v:"2dsphere",label:"2dsphere (geo)"},{v:"hashed",label:"Hashed"}];function eY(e){let{base:t,onClose:n,onDone:a}=e,[i,c]=(0,u.useState)([{field:"",type:"1"}]),[d,x]=(0,u.useState)(""),[m,p]=(0,u.useState)({unique:!1,sparse:!1,hidden:!1,ttl:!1,partial:!1,collation:!1,name:!1}),[g,f]=(0,u.useState)("3600"),[b,j]=(0,u.useState)("{ status: 'active' }"),[v,N]=(0,u.useState)("{ locale: 'en', strength: 2 }"),[y,w]=(0,u.useState)(null),[k,S]=(0,u.useState)(!1),C=(0,s.I)({queryKey:["index-field-suggest",t],queryFn:()=>(0,r.FH)("".concat(t,"/find"),{query:{limit:50}}),staleTime:6e4}),I=(0,u.useMemo)(()=>{var e,t;let n=new Set,l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";for(let[a,s]of Object.entries(e)){let e=t?"".concat(t,".").concat(a):a;n.add(e),!s||"object"!=typeof s||Array.isArray(s)||"_bsontype"in s||s instanceof Date||!(t.split(".").length<3)||l(s,e)}};for(let n of null!=(t=null==(e=C.data)?void 0:e.docs)?t:[])l(n);return[...n].sort()},[C.data]),A="{ ".concat(i.filter(e=>e.field.trim()).map(e=>"".concat(/^[A-Za-z_$][\w$.]*$/.test(e.field.trim())&&!e.field.includes(".")?e.field.trim():JSON.stringify(e.field.trim()),": ").concat("1"===e.type||"-1"===e.type?e.type:"'".concat(e.type,"'"))).join(", ")," }"),O=i.every(e=>e.field.trim()),E=m.ttl&&i.length>1,R=O&&!E&&(!m.ttl||/^\d+$/.test(g)),T=(e,t)=>c(n=>n.map((n,l)=>l===e?{...n,...t}:n)),L=e=>p(t=>({...t,[e]:!t[e]}));async function V(){let e=[];m.name&&d.trim()&&e.push("name: ".concat(JSON.stringify(d.trim()))),m.unique&&e.push("unique: true"),m.sparse&&e.push("sparse: true"),m.hidden&&e.push("hidden: true"),m.ttl&&e.push("expireAfterSeconds: ".concat(Number(g))),m.partial&&b.trim()&&e.push("partialFilterExpression: ".concat(b)),m.collation&&v.trim()&&e.push("collation: ".concat(v)),S(!0),w(null);try{let l=await (0,r.FH)("".concat(t,"/indexes"),{body:{keys:A,options:"{ ".concat(e.join(", ")," }")}});F.oR.success("Index ".concat(l.name," created")),a(),n()}catch(e){w(e)}finally{S(!1)}}return(0,l.jsx)(D.l,{open:!0,onClose:n,title:"Create index",width:"max-w-xl",footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("code",{className:"mr-auto max-w-[60%] truncate rounded bg-bg-muted px-2 py-1 font-mono text-[11px] text-fg-muted",title:A,children:A}),(0,l.jsx)($.$,{onClick:n,children:"Cancel"}),(0,l.jsx)($.$,{variant:"primary",loading:k,disabled:!R,onClick:V,children:"Create index"})]}),children:(0,l.jsxs)("div",{className:"space-y-4 text-[12.5px]",children:[(0,l.jsxs)("section",{children:[(0,l.jsx)("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Index fields"}),(0,l.jsx)("datalist",{id:"ma-index-fields",children:I.map(e=>(0,l.jsx)("option",{value:e},e))}),(0,l.jsx)("div",{className:"space-y-1.5",children:i.map((e,t)=>(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(M.pd,{list:"ma-index-fields",placeholder:"field name, e.g. email or profile.city",value:e.field,onChange:e=>T(t,{field:e.target.value}),autoFocus:0===t,className:"flex-1 font-mono text-[12px]"}),(0,l.jsx)(M.l6,{value:e.type,onChange:e=>T(t,{type:e.target.value}),className:"w-40",children:eX.map(e=>(0,l.jsx)("option",{value:e.v,children:e.label},e.v))}),(0,l.jsx)($.$,{size:"icon",variant:"ghost",title:"Remove field",disabled:1===i.length,onClick:()=>c(e=>e.filter((e,n)=>n!==t)),children:(0,l.jsx)(eh.A,{className:"h-3.5 w-3.5"})})]},t))}),(0,l.jsxs)($.$,{variant:"ghost",className:"mt-1.5 text-accent",onClick:()=>c(e=>[...e,{field:"",type:"1"}]),children:[(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"}),"Add field"]})]}),(0,l.jsxs)("section",{children:[(0,l.jsx)("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Options"}),(0,l.jsxs)("div",{className:"divide-y rounded-md border",children:[(0,l.jsx)(e0,{on:m.unique,onToggle:()=>L("unique"),title:"Unique",hint:"Reject documents with a duplicate value"}),(0,l.jsx)(e0,{on:m.sparse,onToggle:()=>L("sparse"),title:"Sparse",hint:"Only index documents that have the field"}),(0,l.jsx)(e0,{on:m.hidden,onToggle:()=>L("hidden"),title:"Create hidden",hint:"Build it now, let queries use it later"}),(0,l.jsx)(e0,{on:m.ttl,onToggle:()=>L("ttl"),title:"TTL (auto-delete)",hint:"Delete documents N seconds after the date in this field",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(M.pd,{value:g,onChange:e=>f(e.target.value.replace(/\D/g,"")),className:"w-32 tabular-nums",inputMode:"numeric"}),(0,l.jsx)("span",{className:"text-fg-muted",children:"seconds"}),E&&(0,l.jsx)("span",{className:"text-[11px] text-danger",children:"TTL works on a single date field only"})]})}),(0,l.jsx)(e0,{on:m.partial,onToggle:()=>L("partial"),title:"Partial filter",hint:"Only index documents matching a filter",children:(0,l.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong",children:(0,l.jsx)(Q,{value:b,onChange:j,oneLine:!0})})}),(0,l.jsx)(e0,{on:m.collation,onToggle:()=>L("collation"),title:"Collation",hint:"Language rules, e.g. case-insensitive matching",children:(0,l.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong",children:(0,l.jsx)(Q,{value:v,onChange:N,oneLine:!0})})}),(0,l.jsx)(e0,{on:m.name,onToggle:()=>L("name"),title:"Custom name",hint:"Otherwise named automatically, e.g. email_1",children:(0,l.jsx)(M.pd,{value:d,onChange:e=>x(e.target.value),placeholder:"my_index",className:"font-mono text-[12px]"})})]})]}),null!=y&&(0,l.jsx)(o.aV,{error:y})]})})}function e0(e){let{on:t,onToggle:n,title:a,hint:s,children:r}=e;return(0,l.jsxs)("div",{className:"px-3 py-2",children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-3",children:[(0,l.jsxs)("span",{className:(0,d.cn)("relative h-4 w-7 shrink-0 rounded-full transition-colors",t?"bg-accent":"bg-border-strong"),children:[(0,l.jsx)("span",{className:(0,d.cn)("absolute top-0.5 h-3 w-3 rounded-full bg-white shadow transition-all",t?"left-3.5":"left-0.5")}),(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:n,className:"sr-only"})]}),(0,l.jsx)("span",{className:"font-medium",children:a}),(0,l.jsx)("span",{className:"truncate text-[11.5px] text-fg-subtle",children:s})]}),t&&r&&(0,l.jsx)("div",{className:"mt-2 pl-10",children:r})]})}function e1(e){let{base:t,name:n,onClose:a,onDone:s}=e,[i,c]=(0,u.useState)(""),[d,x]=(0,u.useState)(!1),[m,h]=(0,u.useState)(null);async function p(){x(!0);try{await (0,r.FH)("".concat(t,"/indexes"),{method:"DELETE",body:{name:n}}),F.oR.success("Index ".concat(n," dropped")),s(),a()}catch(e){h(e)}finally{x(!1)}}return(0,l.jsx)(D.l,{open:!0,onClose:a,title:"Drop index",footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)($.$,{onClick:a,children:"Cancel"}),(0,l.jsx)($.$,{variant:"danger",loading:d,disabled:i!==n,onClick:p,children:"Drop index"})]}),children:(0,l.jsxs)("div",{className:"space-y-2 text-xs",children:[(0,l.jsxs)("p",{children:["Queries that use ",(0,l.jsx)("b",{className:"font-mono",children:n})," may become slow. Tip: hide the index first to test."]}),(0,l.jsxs)("p",{children:["Type ",(0,l.jsx)("b",{className:"font-mono",children:n})," to confirm:"]}),(0,l.jsx)(M.pd,{value:i,onChange:e=>c(e.target.value),autoFocus:!0}),(0,l.jsx)(o.aV,{error:m})]})})}var e5=n(4626),e3=n(7289),e2=n(9013),e6=n(4105);let e4={error:"Invalid writes are rejected",warn:"Invalid writes are allowed but logged"},e8={off:"Rules are not checked",moderate:"Only checks documents that already pass",strict:"Checks every insert and update"};function e7(e){var t,n,a,c;let{cid:x,db:h,coll:p,role:g}=e,f=(0,r.wV)(x,h,p),b=(0,m.jE)(),j=(0,s.I)({queryKey:["validation",x,h,p],queryFn:()=>(0,r.FH)("".concat(f,"/validation"))}),[v,N]=(0,u.useState)(""),[y,w]=(0,u.useState)("strict"),[k,S]=(0,u.useState)("error"),[C,D]=(0,u.useState)(null),[A,O]=(0,u.useState)(!1),[E,R]=(0,u.useState)(null),[M,T]=(0,u.useState)(!1),[L,V]=(0,u.useState)("failed"),q=(0,u.useRef)(!1),z=e=>{q.current=!0,V(e)},U=(0,i.$3)(g,"admin"),_=!!j.data&&Object.keys(j.data.validator).length>0,H=(0,u.useMemo)(()=>_&&j.data?(0,I.aB)(j.data.validator):"{\n $jsonSchema: {\n bsonType: 'object',\n required: ['name'],\n properties: {\n name: { bsonType: 'string', description: 'must be a string' }\n }\n }\n}",[j.data,_]);function P(){j.data&&(N(H),w(j.data.validationLevel),S(j.data.validationAction))}(0,u.useEffect)(P,[j.data,H]);let B=!!j.data&&(!_||v!==H||y!==j.data.validationLevel||k!==j.data.validationAction);async function K(){T(!0);try{await (0,r.FH)("".concat(f,"/validation"),{method:"PUT",body:{validator:v,validationLevel:y,validationAction:k}}),F.oR.success("Validation rules applied"),await b.invalidateQueries({queryKey:["validation",x,h,p]})}catch(e){R(e)}finally{T(!1)}}if((0,u.useEffect)(()=>{if(!v)return;O(!0);let e=setTimeout(async()=>{try{let e=await (0,r.FH)("".concat(f,"/validation"),{body:{validator:v}});D(e),R(null),q.current||V((0,d.bu)(e.failedCount)>0?"failed":"passed")}catch(e){R(e),D(null)}finally{O(!1)}},600);return()=>clearTimeout(e)},[v,f]),j.isLoading)return(0,l.jsx)("div",{className:"p-6",children:(0,l.jsx)(o.y$,{})});let J=(0,d.bu)(null!=(n=null==C?void 0:C.passedCount)?n:0),Z=(0,d.bu)(null!=(a=null==C?void 0:C.failedCount)?a:0),W=(0,d.bu)(null!=(c=null==C?void 0:C.sampled)?c:0),G=_&&(null==(t=j.data)?void 0:t.validationLevel)!=="off";return(0,l.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,l.jsxs)("div",{className:"flex h-11 shrink-0 items-center gap-4 border-b px-3",children:[(0,l.jsxs)("span",{className:(0,d.cn)("inline-flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium",G?"bg-accent-soft text-accent":"bg-bg-muted text-fg-muted"),children:[G?(0,l.jsx)(e5.A,{className:"h-3.5 w-3.5"}):(0,l.jsx)(e3.A,{className:"h-3.5 w-3.5"}),G?"Rules active":_?"Rules off":"No rules yet"]}),(0,l.jsx)(tn,{label:"Action",value:k,onChange:S,disabled:!U,hint:e4[k],options:[["error","Error"],["warn","Warn"]]}),(0,l.jsx)(tn,{label:"Level",value:y,onChange:w,disabled:!U,hint:e8[y],options:[["off","Off"],["moderate","Moderate"],["strict","Strict"]]}),U&&(0,l.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[B&&_&&(0,l.jsx)("span",{className:"text-[11px] text-warn",children:"Unsaved changes"}),(0,l.jsxs)($.$,{onClick:P,disabled:!B||!_&&v===H,children:[(0,l.jsx)(ex.A,{className:"h-3.5 w-3.5"}),"Revert"]}),(0,l.jsxs)($.$,{variant:"primary",loading:M,disabled:!B,onClick:K,children:[(0,l.jsx)(eD.A,{className:"h-3.5 w-3.5"}),"Apply rules"]})]})]}),(0,l.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2 p-3",children:[(0,l.jsx)("div",{className:"ma-editor ma-editor-fill min-h-0 flex-1 overflow-hidden rounded-md border border-border-strong focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:(0,l.jsx)(Q,{value:v,onChange:N,readOnly:!U,className:"h-full"})}),null!=E&&(0,l.jsx)(o.aV,{error:E}),!U&&(0,l.jsx)("p",{className:"text-[11px] text-fg-subtle",children:"Read-only: changing validation rules needs the admin role."})]}),(0,l.jsxs)("aside",{className:"flex w-[42%] min-w-[320px] max-w-[560px] flex-col border-l bg-bg-subtle",children:[(0,l.jsxs)("div",{className:"border-b bg-panel px-3 py-2.5",children:[(0,l.jsx)("p",{className:"text-[12px] font-semibold",children:"Preview on sample data"}),(0,l.jsx)("p",{className:"mt-0.5 text-[11px] text-fg-muted",children:A&&!C?"Checking…":0===W?"This collection has no documents to test.":(0,l.jsxs)(l.Fragment,{children:["Of ",(0,l.jsx)("b",{className:"text-fg",children:W})," random documents: ",(0,l.jsxs)("b",{className:"text-accent",children:[J," pass"]}),", ",(0,l.jsxs)("b",{className:Z?"text-danger":"text-fg",children:[Z," fail"]}),A&&" \xb7 updating…"]})}),W>0&&(0,l.jsxs)("div",{className:"mt-2 flex h-1.5 overflow-hidden rounded-full bg-bg-muted",children:[(0,l.jsx)("div",{className:"bg-accent",style:{width:"".concat(J/W*100,"%")}}),(0,l.jsx)("div",{className:"bg-danger",style:{width:"".concat(Z/W*100,"%")}})]}),(0,l.jsxs)("div",{className:"mt-2.5 flex gap-1",children:[(0,l.jsx)(tt,{active:"failed"===L,onClick:()=>z("failed"),icon:(0,l.jsx)(e2.A,{className:"h-3.5 w-3.5 text-danger"}),label:"Failed",count:Z}),(0,l.jsx)(tt,{active:"passed"===L,onClick:()=>z("passed"),icon:(0,l.jsx)(e6.A,{className:"h-3.5 w-3.5 text-accent"}),label:"Passed",count:J})]})]}),(0,l.jsx)("div",{className:"scrollbar-thin flex-1 space-y-2 overflow-auto p-3",children:C?0===("passed"===L?C.passed:C.failed).length?(0,l.jsx)(o.Sv,{title:"failed"===L?"No sampled document breaks these rules":"No sampled document passes these rules"}):("passed"===L?C.passed:C.failed).map((e,t)=>(0,l.jsx)(te,{doc:e,ok:"passed"===L},t)):A?(0,l.jsx)(o.y$,{}):null})]})]})]})}let e9={mode:"collapse",n:1};function te(e){var t;let{doc:n,ok:a}=e,s=n._id,r=(null==s?void 0:s.toHexString)?s.toHexString():String(null!=(t=n._id)?t:"");return(0,l.jsxs)("div",{className:"overflow-hidden rounded-md border bg-panel",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg-subtle px-2.5 py-1 text-[11px]",children:[a?(0,l.jsx)(e6.A,{className:"h-3.5 w-3.5 text-accent"}):(0,l.jsx)(e2.A,{className:"h-3.5 w-3.5 text-danger"}),(0,l.jsx)("span",{className:(0,d.cn)("font-medium",a?"text-accent":"text-danger"),children:a?"Passes":"Fails"}),(0,l.jsx)("span",{className:"ml-auto truncate font-mono text-fg-subtle",title:r,children:r})]}),(0,l.jsx)("div",{className:"py-1.5 pl-1 pr-2.5",children:(0,l.jsx)(es.xn,{command:e9,children:(0,l.jsx)(es.UU,{value:n,bare:!0})})})]})}function tt(e){let{active:t,onClick:n,icon:a,label:s,count:r}=e;return(0,l.jsxs)("button",{onClick:n,className:(0,d.cn)("flex h-7 items-center gap-1.5 rounded-md px-2.5 text-[12px] transition-colors",t?"bg-bg-muted font-medium text-fg":"text-fg-muted hover:bg-bg-muted/60 hover:text-fg"),children:[a,s,(0,l.jsx)("span",{className:"rounded bg-panel px-1 text-[10.5px] tabular-nums text-fg-muted",children:r})]})}function tn(e){let{label:t,value:n,onChange:a,options:s,disabled:r,hint:i}=e;return(0,l.jsxs)("div",{className:"flex items-center gap-2",title:i,children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-fg-subtle",children:t}),(0,l.jsx)("div",{className:"flex rounded-md bg-bg-muted p-0.5",children:s.map(e=>{let[t,s]=e;return(0,l.jsx)("button",{disabled:r,onClick:()=>a(t),className:(0,d.cn)("h-6 rounded px-2.5 text-[12px] transition-colors disabled:cursor-not-allowed",n===t?"bg-panel font-medium text-fg shadow-sm":"text-fg-muted hover:text-fg"),children:s},t)})})]})}let tl=[{id:"documents",label:"Documents"},{id:"aggregations",label:"Aggregations"},{id:"schema",label:"Schema"},{id:"indexes",label:"Indexes"},{id:"validation",label:"Validation"}],ta=e=>{var t,n;return null!=(n=null==(t=tl.find(t=>t.id===e))?void 0:t.id)?n:"documents"};function ts(e){var t,n,u,x;let{cid:m,db:h,coll:p,tab:g,onTab:f,compact:b,headerExtra:j}=e,v=(0,a.qw)(),N=b||v,y=null==(t=(0,i.yj)().data)?void 0:t.connections.find(e=>e.id===m),w=null==(n=(0,i.Wc)(m).data)?void 0:n.databases.find(e=>e.name===h),k=null==w?void 0:w.collections.find(e=>e.name===p),S=(null==k?void 0:k.type)==="view",C=null!=(u=null==w?void 0:w.role)?u:null,$=(0,s.I)({queryKey:["collstats",m,h,p],queryFn:()=>(0,r.FH)("".concat((0,r.wV)(m,h,p),"/stats")),enabled:!!k&&!S,staleTime:3e4}),D=tl.filter(e=>!(S&&("indexes"===e.id||"validation"===e.id)));return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.z,{crumbs:[{label:null!=(x=null==y?void 0:y.name)?x:"…",href:"/c/".concat(m)},{label:h,href:"/c/".concat(m,"/").concat((0,r.fk)(h))},{label:p}],actions:(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] text-fg-muted",children:[S&&(0,l.jsx)(o.Ex,{children:"View"}),C&&(0,l.jsx)(o.Ex,{tone:"viewer"===C?"neutral":"accent",children:C}),$.data&&!N&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tr,{label:"Documents",value:(0,d.ZV)((0,d.bu)($.data.count))}),(0,l.jsx)(tr,{label:"Storage",value:(0,d.z3)((0,d.bu)($.data.storageSize))}),(0,l.jsx)(tr,{label:"Indexes",value:"".concat((0,d.bu)($.data.nindexes)," \xb7 ").concat((0,d.z3)((0,d.bu)($.data.totalIndexSize)))})]}),N&&$.data&&(0,l.jsxs)("span",{className:"tabular-nums",children:[(0,d.ZV)((0,d.bu)($.data.count))," docs"]}),j]})}),(0,l.jsx)("div",{className:"scrollbar-thin flex h-9 shrink-0 items-end gap-0.5 overflow-x-auto border-b px-3",children:D.map(e=>(0,l.jsx)("button",{onClick:()=>f(e.id),className:(0,d.cn)("-mb-px h-9 shrink-0 border-b-2 px-2.5 text-[12.5px] transition-colors",g===e.id?"border-accent font-semibold text-fg":"border-transparent text-fg-muted hover:text-fg"),children:e.label},e.id))}),"documents"===g&&(0,l.jsx)(ek,{cid:m,db:h,coll:p,role:C,readonly:S},"".concat(h,".").concat(p)),"aggregations"===g&&(0,l.jsx)(eq,{cid:m,db:h,coll:p,role:C},"".concat(h,".").concat(p)),"schema"===g&&(0,l.jsx)(e_,{cid:m,db:h,coll:p},"".concat(h,".").concat(p)),"indexes"===g&&(0,l.jsx)(eZ,{cid:m,db:h,coll:p,role:C},"".concat(h,".").concat(p)),"validation"===g&&(0,l.jsx)(e7,{cid:m,db:h,coll:p,role:C},"".concat(h,".").concat(p))]})}function tr(e){let{label:t,value:n}=e;return(0,l.jsxs)("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap rounded-md border bg-bg-subtle px-2",children:[(0,l.jsx)("span",{className:"text-fg-subtle",children:t}),(0,l.jsx)("b",{className:"font-semibold text-fg",children:n})]})}}}]);