@rubytech/create-realagent-code 0.1.602 → 0.1.603

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 (181) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/neo4j/schema.cypher +7 -0
  3. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +15 -1
  4. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
  5. package/payload/platform/plugins/docs/references/telegram-guide.md +14 -0
  6. package/payload/server/public/activity.html +6 -6
  7. package/payload/server/public/agents.html +5 -5
  8. package/payload/server/public/assets/{AdminLoginScreens-CaQqLuxZ.js → AdminLoginScreens-DI5bNlX8.js} +1 -1
  9. package/payload/server/public/assets/AdminLoginScreens-DI5bNlX8.js.br +0 -0
  10. package/payload/server/public/assets/AdminLoginScreens-DI5bNlX8.js.gz +0 -0
  11. package/payload/server/public/assets/{AdminShell-D8WTrqem.js → AdminShell-B-iX9ahJ.js} +1 -1
  12. package/payload/server/public/assets/AdminShell-B-iX9ahJ.js.br +0 -0
  13. package/payload/server/public/assets/AdminShell-B-iX9ahJ.js.gz +0 -0
  14. package/payload/server/public/assets/{activity-B3fiJrC2.js → activity-CqgFwANo.js} +1 -1
  15. package/payload/server/public/assets/activity-CqgFwANo.js.br +0 -0
  16. package/payload/server/public/assets/activity-CqgFwANo.js.gz +0 -0
  17. package/payload/server/public/assets/{admin-ouF-DflP.js → admin-K63n6ybW.js} +1 -1
  18. package/payload/server/public/assets/admin-K63n6ybW.js.br +0 -0
  19. package/payload/server/public/assets/admin-K63n6ybW.js.gz +0 -0
  20. package/payload/server/public/assets/{agents-C8RSXHdh.js → agents-cue5Zf8X.js} +1 -1
  21. package/payload/server/public/assets/agents-cue5Zf8X.js.br +0 -0
  22. package/payload/server/public/assets/agents-cue5Zf8X.js.gz +0 -0
  23. package/payload/server/public/assets/{browser-Dbv6-Rag.js → browser-CqDBcKwU.js} +1 -1
  24. package/payload/server/public/assets/browser-CqDBcKwU.js.br +0 -0
  25. package/payload/server/public/assets/browser-CqDBcKwU.js.gz +0 -0
  26. package/payload/server/public/assets/{calendar-vJjtsH9n.js → calendar-BgzuW5Rt.js} +1 -1
  27. package/payload/server/public/assets/calendar-BgzuW5Rt.js.br +0 -0
  28. package/payload/server/public/assets/calendar-BgzuW5Rt.js.gz +0 -0
  29. package/payload/server/public/assets/chat-HYZViu2u.js +1 -0
  30. package/payload/server/public/assets/chat-HYZViu2u.js.br +3 -0
  31. package/payload/server/public/assets/chat-HYZViu2u.js.gz +0 -0
  32. package/payload/server/public/assets/chevron-left-C5FXH9r_.js +1 -0
  33. package/payload/server/public/assets/chevron-left-C5FXH9r_.js.br +0 -0
  34. package/payload/server/public/assets/clock-DxPtyejC.js +1 -0
  35. package/payload/server/public/assets/clock-DxPtyejC.js.br +0 -0
  36. package/payload/server/public/assets/clock-DxPtyejC.js.gz +0 -0
  37. package/payload/server/public/assets/{copy-DyG7sC5o.js → copy-BNhZ0flH.js} +1 -1
  38. package/payload/server/public/assets/copy-BNhZ0flH.js.br +0 -0
  39. package/payload/server/public/assets/copy-BNhZ0flH.js.gz +0 -0
  40. package/payload/server/public/assets/data-kCBB8Z4Z.js +1 -0
  41. package/payload/server/public/assets/data-kCBB8Z4Z.js.br +0 -0
  42. package/payload/server/public/assets/data-kCBB8Z4Z.js.gz +0 -0
  43. package/payload/server/public/assets/{field-Bx6pM-vq.js → field-X4OVA3vx.js} +1 -1
  44. package/payload/server/public/assets/field-X4OVA3vx.js.br +0 -0
  45. package/payload/server/public/assets/field-X4OVA3vx.js.gz +0 -0
  46. package/payload/server/public/assets/{file-text-CpHWsMGe.js → file-text-BddO_2EI.js} +1 -1
  47. package/payload/server/public/assets/file-text-BddO_2EI.js.br +0 -0
  48. package/payload/server/public/assets/file-text-BddO_2EI.js.gz +0 -0
  49. package/payload/server/public/assets/{graph-DjOywuv_.js → graph-l7tzHqvm.js} +1 -1
  50. package/payload/server/public/assets/graph-l7tzHqvm.js.br +0 -0
  51. package/payload/server/public/assets/graph-l7tzHqvm.js.gz +0 -0
  52. package/payload/server/public/assets/{graph-labels-CGWtqa-m.js → graph-labels-CtFFq5W2.js} +1 -1
  53. package/payload/server/public/assets/graph-labels-CtFFq5W2.js.br +0 -0
  54. package/payload/server/public/assets/graph-labels-CtFFq5W2.js.gz +0 -0
  55. package/payload/server/public/assets/jsx-runtime-bq0g4NlA.css +1 -0
  56. package/payload/server/public/assets/jsx-runtime-bq0g4NlA.css.br +0 -0
  57. package/payload/server/public/assets/jsx-runtime-bq0g4NlA.css.gz +0 -0
  58. package/payload/server/public/assets/{operator-_DN0RF1R.js → operator-Dg-dwf7a.js} +1 -1
  59. package/payload/server/public/assets/operator-Dg-dwf7a.js.br +7 -0
  60. package/payload/server/public/assets/operator-Dg-dwf7a.js.gz +0 -0
  61. package/payload/server/public/assets/{page-DI4qQIK0.js → page-Ci1bfIbs.js} +1 -1
  62. package/payload/server/public/assets/page-Ci1bfIbs.js.br +0 -0
  63. package/payload/server/public/assets/page-Ci1bfIbs.js.gz +0 -0
  64. package/payload/server/public/assets/{page-zCwgrs8m.js → page-Y9JmFq0Q.js} +1 -1
  65. package/payload/server/public/assets/page-Y9JmFq0Q.js.br +0 -0
  66. package/payload/server/public/assets/page-Y9JmFq0Q.js.gz +0 -0
  67. package/payload/server/public/assets/play-BSZVGpQT.js +1 -0
  68. package/payload/server/public/assets/play-BSZVGpQT.js.br +0 -0
  69. package/payload/server/public/assets/play-BSZVGpQT.js.gz +0 -0
  70. package/payload/server/public/assets/{public-DDVWBNSH.js → public-m66FAza_.js} +1 -1
  71. package/payload/server/public/assets/public-m66FAza_.js.br +0 -0
  72. package/payload/server/public/assets/public-m66FAza_.js.gz +0 -0
  73. package/payload/server/public/assets/{rotate-ccw-xTwkf-m7.js → rotate-ccw-DTOJmOxB.js} +1 -1
  74. package/payload/server/public/assets/rotate-ccw-DTOJmOxB.js.br +0 -0
  75. package/payload/server/public/assets/rotate-ccw-DTOJmOxB.js.gz +0 -0
  76. package/payload/server/public/assets/{routines-Bu5MdNmG.js → routines-6fxZNacQ.js} +1 -1
  77. package/payload/server/public/assets/routines-6fxZNacQ.js.br +0 -0
  78. package/payload/server/public/assets/routines-6fxZNacQ.js.gz +0 -0
  79. package/payload/server/public/assets/{skills-DRunh5vy.js → skills-51mqx-s5.js} +1 -1
  80. package/payload/server/public/assets/skills-51mqx-s5.js.br +0 -0
  81. package/payload/server/public/assets/skills-51mqx-s5.js.gz +0 -0
  82. package/payload/server/public/assets/{tasks-DI2fznvd.js → tasks-D4y-Cwa3.js} +1 -1
  83. package/payload/server/public/assets/tasks-D4y-Cwa3.js.br +0 -0
  84. package/payload/server/public/assets/tasks-D4y-Cwa3.js.gz +0 -0
  85. package/payload/server/public/assets/{triangle-alert-B6CHZeUf.js → triangle-alert-BzCjDFts.js} +1 -1
  86. package/payload/server/public/assets/triangle-alert-BzCjDFts.js.br +0 -0
  87. package/payload/server/public/assets/triangle-alert-BzCjDFts.js.gz +0 -0
  88. package/payload/server/public/assets/{useCopyFeedback-6rU2IEPk.js → useCopyFeedback-BG7h37Rx.js} +1 -1
  89. package/payload/server/public/assets/useCopyFeedback-BG7h37Rx.js.br +2 -0
  90. package/payload/server/public/assets/useCopyFeedback-BG7h37Rx.js.gz +0 -0
  91. package/payload/server/public/assets/{useMediaQuery-D7A5Bzs3.js → useMediaQuery-CqwktQr_.js} +1 -1
  92. package/payload/server/public/assets/useMediaQuery-CqwktQr_.js.br +0 -0
  93. package/payload/server/public/assets/{useMediaQuery-D7A5Bzs3.js.gz → useMediaQuery-CqwktQr_.js.gz} +0 -0
  94. package/payload/server/public/assets/{useVoiceRecorder-CptrerVA.js → useVoiceRecorder-CAZcUc1s.js} +1 -1
  95. package/payload/server/public/assets/useVoiceRecorder-CAZcUc1s.js.br +0 -0
  96. package/payload/server/public/assets/useVoiceRecorder-CAZcUc1s.js.gz +0 -0
  97. package/payload/server/public/assets/{wrench-DyX4C8aY.js → wrench-B2WKLLQG.js} +1 -1
  98. package/payload/server/public/assets/wrench-B2WKLLQG.js.br +0 -0
  99. package/payload/server/public/assets/wrench-B2WKLLQG.js.gz +0 -0
  100. package/payload/server/public/browser.html +5 -5
  101. package/payload/server/public/calendar.html +8 -8
  102. package/payload/server/public/chat.html +14 -14
  103. package/payload/server/public/data.html +12 -12
  104. package/payload/server/public/field.html +3 -3
  105. package/payload/server/public/graph.html +10 -10
  106. package/payload/server/public/index.html +14 -14
  107. package/payload/server/public/operator.html +16 -16
  108. package/payload/server/public/public.html +14 -14
  109. package/payload/server/public/routines.html +8 -8
  110. package/payload/server/public/skills.html +6 -6
  111. package/payload/server/public/tasks.html +7 -7
  112. package/payload/server/server.js +436 -325
  113. package/payload/server/public/assets/AdminLoginScreens-CaQqLuxZ.js.br +0 -0
  114. package/payload/server/public/assets/AdminLoginScreens-CaQqLuxZ.js.gz +0 -0
  115. package/payload/server/public/assets/AdminShell-D8WTrqem.js.br +0 -0
  116. package/payload/server/public/assets/AdminShell-D8WTrqem.js.gz +0 -0
  117. package/payload/server/public/assets/activity-B3fiJrC2.js.br +0 -0
  118. package/payload/server/public/assets/activity-B3fiJrC2.js.gz +0 -0
  119. package/payload/server/public/assets/admin-ouF-DflP.js.br +0 -0
  120. package/payload/server/public/assets/admin-ouF-DflP.js.gz +0 -0
  121. package/payload/server/public/assets/agents-C8RSXHdh.js.br +0 -0
  122. package/payload/server/public/assets/agents-C8RSXHdh.js.gz +0 -0
  123. package/payload/server/public/assets/browser-Dbv6-Rag.js.br +0 -0
  124. package/payload/server/public/assets/browser-Dbv6-Rag.js.gz +0 -0
  125. package/payload/server/public/assets/calendar-vJjtsH9n.js.br +0 -0
  126. package/payload/server/public/assets/calendar-vJjtsH9n.js.gz +0 -0
  127. package/payload/server/public/assets/chat-cqL4qPUy.js +0 -1
  128. package/payload/server/public/assets/chat-cqL4qPUy.js.br +0 -1
  129. package/payload/server/public/assets/chat-cqL4qPUy.js.gz +0 -0
  130. package/payload/server/public/assets/chevron-left-DB98DSG3.js +0 -1
  131. package/payload/server/public/assets/chevron-left-DB98DSG3.js.br +0 -0
  132. package/payload/server/public/assets/clock-4YwsYe4L.js +0 -1
  133. package/payload/server/public/assets/clock-4YwsYe4L.js.br +0 -0
  134. package/payload/server/public/assets/clock-4YwsYe4L.js.gz +0 -0
  135. package/payload/server/public/assets/copy-DyG7sC5o.js.br +0 -0
  136. package/payload/server/public/assets/copy-DyG7sC5o.js.gz +0 -0
  137. package/payload/server/public/assets/data-BAzLtx9C.js +0 -1
  138. package/payload/server/public/assets/data-BAzLtx9C.js.br +0 -0
  139. package/payload/server/public/assets/data-BAzLtx9C.js.gz +0 -0
  140. package/payload/server/public/assets/field-Bx6pM-vq.js.br +0 -0
  141. package/payload/server/public/assets/field-Bx6pM-vq.js.gz +0 -0
  142. package/payload/server/public/assets/file-text-CpHWsMGe.js.br +0 -0
  143. package/payload/server/public/assets/file-text-CpHWsMGe.js.gz +0 -0
  144. package/payload/server/public/assets/graph-DjOywuv_.js.br +0 -0
  145. package/payload/server/public/assets/graph-DjOywuv_.js.gz +0 -0
  146. package/payload/server/public/assets/graph-labels-CGWtqa-m.js.br +0 -0
  147. package/payload/server/public/assets/graph-labels-CGWtqa-m.js.gz +0 -0
  148. package/payload/server/public/assets/jsx-runtime-D75_aR1J.css +0 -1
  149. package/payload/server/public/assets/jsx-runtime-D75_aR1J.css.br +0 -0
  150. package/payload/server/public/assets/jsx-runtime-D75_aR1J.css.gz +0 -0
  151. package/payload/server/public/assets/operator-_DN0RF1R.js.br +0 -0
  152. package/payload/server/public/assets/operator-_DN0RF1R.js.gz +0 -0
  153. package/payload/server/public/assets/page-DI4qQIK0.js.br +0 -0
  154. package/payload/server/public/assets/page-DI4qQIK0.js.gz +0 -0
  155. package/payload/server/public/assets/page-zCwgrs8m.js.br +0 -0
  156. package/payload/server/public/assets/page-zCwgrs8m.js.gz +0 -0
  157. package/payload/server/public/assets/play-CHQ5a9yh.js +0 -1
  158. package/payload/server/public/assets/play-CHQ5a9yh.js.br +0 -0
  159. package/payload/server/public/assets/play-CHQ5a9yh.js.gz +0 -0
  160. package/payload/server/public/assets/public-DDVWBNSH.js.br +0 -0
  161. package/payload/server/public/assets/public-DDVWBNSH.js.gz +0 -0
  162. package/payload/server/public/assets/rotate-ccw-xTwkf-m7.js.br +0 -0
  163. package/payload/server/public/assets/rotate-ccw-xTwkf-m7.js.gz +0 -0
  164. package/payload/server/public/assets/routines-Bu5MdNmG.js.br +0 -0
  165. package/payload/server/public/assets/routines-Bu5MdNmG.js.gz +0 -0
  166. package/payload/server/public/assets/skills-DRunh5vy.js.br +0 -0
  167. package/payload/server/public/assets/skills-DRunh5vy.js.gz +0 -0
  168. package/payload/server/public/assets/tasks-DI2fznvd.js.br +0 -0
  169. package/payload/server/public/assets/tasks-DI2fznvd.js.gz +0 -0
  170. package/payload/server/public/assets/triangle-alert-B6CHZeUf.js.br +0 -0
  171. package/payload/server/public/assets/triangle-alert-B6CHZeUf.js.gz +0 -0
  172. package/payload/server/public/assets/useCopyFeedback-6rU2IEPk.js.br +0 -2
  173. package/payload/server/public/assets/useCopyFeedback-6rU2IEPk.js.gz +0 -0
  174. package/payload/server/public/assets/useMediaQuery-D7A5Bzs3.js.br +0 -0
  175. package/payload/server/public/assets/useVoiceRecorder-CptrerVA.js.br +0 -0
  176. package/payload/server/public/assets/useVoiceRecorder-CptrerVA.js.gz +0 -0
  177. package/payload/server/public/assets/wrench-DyX4C8aY.js.br +0 -0
  178. package/payload/server/public/assets/wrench-DyX4C8aY.js.gz +0 -0
  179. /package/payload/server/public/assets/{jsx-runtime-B2Q1UOSJ.js → jsx-runtime-UK6hgBWO.js} +0 -0
  180. /package/payload/server/public/assets/{jsx-runtime-B2Q1UOSJ.js.br → jsx-runtime-UK6hgBWO.js.br} +0 -0
  181. /package/payload/server/public/assets/{jsx-runtime-B2Q1UOSJ.js.gz → jsx-runtime-UK6hgBWO.js.gz} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-B2Q1UOSJ.js";import"./useMediaQuery-D7A5Bzs3.js";import{n as i,t as a}from"./AdminLoginScreens-CaQqLuxZ.js";import"./useVoiceRecorder-CptrerVA.js";import"./AdminShell-D8WTrqem.js";import{t as o}from"./page-zCwgrs8m.js";import"./useCopyFeedback-6rU2IEPk.js";var s=n(),c=e(t(),1),l=r();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState)},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`,forceCanonicalSession:window.location.pathname!==`/chat`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-UK6hgBWO.js";import"./useMediaQuery-CqwktQr_.js";import{n as i,t as a}from"./AdminLoginScreens-DI5bNlX8.js";import"./useVoiceRecorder-CAZcUc1s.js";import"./AdminShell-B-iX9ahJ.js";import{t as o}from"./page-Y9JmFq0Q.js";import"./useCopyFeedback-BG7h37Rx.js";var s=n(),c=e(t(),1),l=r();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState)},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`,forceCanonicalSession:window.location.pathname!==`/chat`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
@@ -0,0 +1,7 @@
1
+ � d3��o��J�b<�.Y�����8��)��(ns@am����7yۖ�Z�;�T�b0���Y�آ��.gWs�\�y���8��Â����[o�BQH�˩�
2
+ ���U- ���FΆ�AYS�h0I�a���*Q�4�E�
3
+ @KNu�Q�[,"O����#�Ej)gU�z�CN
4
+
5
+ �ȑ���G8��K&�I!�#��]X���'�dה�L����& r�$C�t(������ ���z����Mz|�inJ����M��i���Cf
6
+ �`)o��U[aK;�#zDa�2���$�[z���)o�둇�_l��F�
7
+
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,r as n,t as r}from"./jsx-runtime-B2Q1UOSJ.js";import{F as i,G as a,I as o,L as s,M as c,N as l,O as u,P as d,T as f,V as p,W as m,Y as h,Z as g,_,c as v,d as ee,g as te,it as y,j as b,k as x,m as S,n as C,s as w,t as ne,u as T,v as E}from"./useMediaQuery-D7A5Bzs3.js";import{A as re,D as ie,E as ae,S as oe,c as D,k as se,n as O,p as ce,r as k}from"./useVoiceRecorder-CptrerVA.js";import{t as A}from"./chevron-left-DB98DSG3.js";import{t as le}from"./file-text-CpHWsMGe.js";import{i as ue,t as j}from"./graph-labels-CGWtqa-m.js";import{t as de}from"./triangle-alert-B6CHZeUf.js";import{i as fe,n as pe,t as me}from"./file-download-B7zwa78w.js";var he=g(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ge=g(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),M=g(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_e=g(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ve=g(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ye=g(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),N=g(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),be=g(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),P=e(t(),1);function xe(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=(0,P.useRef)(null),s=(0,P.useCallback)(e=>{a(null);let n=e.find(e=>!k(e.type,re));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>se);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,P.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,P.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,P.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,P.useCallback)(()=>{r(!1)},[]),onDrop:(0,P.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var Se=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function Ce(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var F=r();function we({onSelect:e}){return(0,F.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:Se.map((t,n)=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function Te({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=(0,P.useCallback)(t=>{u(!0),c(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{o(e),i(e.path===`.`?``:e.path)}).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>u(!1))},[e]);(0,P.useEffect)(()=>{d(``)},[d]);let f=e=>d(r?`${r}/${e}`:e),p=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),d(e.join(`/`))},h=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,F.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,F.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,F.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:p,"aria-label":`Up one folder`,children:(0,F.jsx)(A,{size:18})}),(0,F.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,F.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,F.jsx)(b,{size:18})})]}),s&&(0,F.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:s}),l&&(0,F.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!l&&(0,F.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,F.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,F.jsx)(`li`,{children:e.kind===`directory`?(0,F.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>f(e.name),children:[(0,F.jsx)(m,{size:16,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,F.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>h(e),children:[(0,F.jsx)(le,{size:16,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}var Ee=n();function De(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function I({transport:e,sessionKey:t,replyTo:n,onClearReply:r,features:i}){let a=i?.attachments!==!1,s=i?.voice!==!1,u=i?.deviceFiles!==!1,d=i?.quote!==!1,[f,p]=(0,P.useState)(``),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)(null),[v,ee]=(0,P.useState)(!1),[te,y]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),T=(0,P.useRef)(null),{pendingFiles:E,attachError:re,setAttachError:oe,addFiles:D,removeFile:se,clearFiles:ce}=xe(),{state:k,elapsedSeconds:A,errorMessage:ue,start:j,send:de,discard:fe}=O(),pe=k===`recording`||k===`paused`,me=(0,P.useCallback)(()=>{j()},[j]),he=(0,P.useCallback)(async()=>{let e=await de();if(e){let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;D([new File([e],`voice-note${t}`,{type:e.type})])}},[A,de,D]),ge=(0,P.useCallback)(()=>{fe()},[A,fe]),_e=(0,P.useRef)(!1),ve=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[be,Se]=(0,P.useState)(null),[I,L]=(0,P.useState)(null),R=(0,P.useRef)(null),Oe=(0,P.useCallback)(e=>{let t=R.current;t&&Se(Math.min(ve(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),z=(0,P.useCallback)(()=>{R.current=null,window.removeEventListener(`pointermove`,Oe),window.removeEventListener(`pointerup`,z)},[Oe]),ke=(0,P.useCallback)(e=>{R.current={startY:e.clientY,startH:T.current?.offsetHeight??44},window.addEventListener(`pointermove`,Oe),window.addEventListener(`pointerup`,z),e.preventDefault()},[Oe,z]),Ae=(0,P.useCallback)(e=>{let t=be??T.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(ve(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&Se(n)},[be]),je=(0,P.useRef)(``);(0,P.useEffect)(()=>{let e=T.current;if(!e)return;let t=je.current!==``&&f===``;if(je.current=f,be!==null){t&&Se(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(ve(),Math.max(44,e.scrollHeight));e.style.height=n,L(r)},[f,be]);let B=(f.trim().length>0||E.length>0||C.length>0)&&!m,Me=(0,P.useCallback)(async()=>{if(!_e.current&&!(f.trim().length===0&&E.length===0&&C.length===0)){_e.current=!0,h(!0),_(null);try{let i=`${e.endpoint}?session_key=${encodeURIComponent(t)}`,a;if(E.length>0||C.length>0){let t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);f.trim()&&t.append(`text`,f);for(let e of E)t.append(`files`,e);for(let e of C)t.append(`fileRefs`,e.path);n&&t.append(`quotedId`,n.msgKeyId),a=await fetch(i,{method:`POST`,body:t})}else a=await fetch(i,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e.fields,text:f,...n?{quotedId:n.msgKeyId}:{}})});let o=await a.json().catch(()=>({}));if(!a.ok){_(o.error??`Send failed.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${o.error??`unknown`}`);return}p(``),ce(),w([]),r?.()}catch(t){_(`Could not reach the server. Try again.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${String(t)}`)}finally{_e.current=!1,h(!1)}}},[f,E,C,n,r,e,t,ce]),Ne=(0,P.useCallback)(e=>{let t=T.current,{value:n,caret:r}=Ce(f,e,t?t.selectionStart:null,t?t.selectionEnd:null);p(n),ee(!1),requestAnimationFrame(()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[f]),Pe=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),B&&Me())},Fe=e=>e.dataTransfer.types.includes(`Files`),Ie=(0,P.useCallback)(e=>{Fe(e)&&(e.preventDefault(),a&&S(!0))},[a]),Le=(0,P.useCallback)(()=>S(!1),[]),Re=(0,P.useCallback)(e=>{if(!Fe(e))return;e.preventDefault(),S(!1);let t=[...e.dataTransfer.files];if(t.length!==0){if(!a){oe(`This conversation takes text only. Attachments cannot be sent here.`);return}Math.max(0,E.length+t.length-5),D(t)}},[E.length,D,a,oe]),ze=e=>e.startsWith(`image/`)?(0,F.jsx)(M,{size:14}):e===`application/pdf`?(0,F.jsx)(le,{size:14}):(0,F.jsx)(ie,{size:14}),Be=ne(`(max-width: 720px)`),[V,Ve]=(0,P.useState)(null);(0,P.useEffect)(()=>{Ve(Be?document.querySelector(`.admin-footer`):null)},[Be]);let He=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>ee(e=>!e),disabled:m,"aria-label":`Emoji`,"aria-expanded":v,children:(0,F.jsx)(N,{size:22})}),(a||u)&&(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>y(!0),disabled:m,"aria-label":`Attach files`,children:(0,F.jsx)(o,{size:22})})]});return(0,F.jsxs)(`div`,{className:`wa-reply${x?` wa-reply-drag-over`:``}`,onDragOver:Ie,onDragLeave:Le,onDrop:Re,children:[te&&(0,F.jsx)(Te,{sessionKey:t,onPick:e=>{w(t=>[...t,e].slice(0,5)),y(!1)},onClose:()=>y(!1)}),v&&(0,F.jsx)(we,{onSelect:Ne}),g&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:g}),re&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:re}),k===`error`&&ue&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ue}),(E.length>0||C.length>0)&&(0,F.jsxs)(`div`,{className:`wa-reply-attachments`,children:[E.map((e,t)=>(0,F.jsxs)(`div`,{className:`wa-reply-chip`,children:[ze(e.type),(0,F.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>se(t),"aria-label":`Remove ${e.name}`,children:(0,F.jsx)(b,{size:12})})]},`f-${t}`)),C.map((e,t)=>(0,F.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,F.jsx)(le,{size:14}),(0,F.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>w(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,F.jsx)(b,{size:12})})]},`r-${t}`))]}),d&&n&&(0,F.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,F.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,F.jsx)(`span`,{className:`wa-reply-quote-who`,children:n.fromMe?`You`:n.senderName??`Contact`}),(0,F.jsx)(`span`,{className:`wa-reply-quote-text`,children:n.body||`Message`})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>r?.(),"aria-label":`Cancel reply`,children:(0,F.jsx)(b,{size:14})})]}),!pe&&(0,F.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:ke,onKeyDown:Ae}),(0,F.jsx)(`div`,{className:`wa-reply-row`,children:pe?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:ge,"aria-label":`Cancel recording`,children:(0,F.jsx)(c,{size:20})}),(0,F.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,F.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),De(A)]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,F.jsx)(l,{size:20})})]}):(0,F.jsxs)(F.Fragment,{children:[V?(0,Ee.createPortal)((0,F.jsx)(`div`,{className:`wa-reply-footer-actions`,children:He}),V):He,(0,F.jsxs)(`div`,{className:`wa-reply-inputwrap`,children:[(0,F.jsx)(`textarea`,{ref:T,className:`wa-reply-input`,value:f,rows:1,style:{height:`${be??I??44}px`},placeholder:`Type a message`,disabled:m,onChange:e=>p(e.target.value),onKeyDown:Pe}),s&&f.length===0&&(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void me(),disabled:m,"aria-label":`Record voice note`,children:(0,F.jsx)(ae,{size:22})})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void Me(),disabled:!B,"aria-label":`Send`,children:(0,F.jsx)(ye,{size:20})})]})})]})}function L({accountId:e,channelKey:t,contactName:n,sessionKey:r,sendable:i=!0,onBack:a}){let o=t.slice(t.indexOf(`:`)+1),s=n===o?void 0:o;return(0,F.jsxs)(`div`,{className:`wa-web tg-web`,children:[(0,F.jsxs)(`header`,{className:`wa-web-header`,children:[a&&(0,F.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:a,"aria-label":`Back`,children:(0,F.jsx)(A,{size:20})}),(0,F.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,F.jsx)(oe,{size:20})}),(0,F.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,F.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,F.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]})]}),(0,F.jsx)(`div`,{className:`wa-web-body`,"data-testid":`telegram-web-conversation`,children:(0,F.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`telegram`,accountId:e,channelKey:t}})}),i&&(0,F.jsx)(I,{transport:{endpoint:`/api/telegram-reader/send`,fields:{accountId:e,channelKey:t}},sessionKey:r,features:{attachments:!1,voice:!1,deviceFiles:!1,quote:!1}})]})}function R({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=ee(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(``),f=()=>{l(!1),d(``)},[p,m]=(0,P.useState)(null);return(0,F.jsxs)(`div`,{className:`wa-web`,children:[(0,F.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,F.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,F.jsx)(A,{size:20})}),(0,F.jsx)(ce,{accountId:e,jid:t,sessionKey:r}),c?(0,F.jsxs)(`div`,{className:`wa-web-search`,children:[(0,F.jsx)(ue,{size:18,"aria-hidden":!0}),(0,F.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`&&f()}}),(0,F.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:f,"aria-label":`Close search`,children:(0,F.jsx)(b,{size:18})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,F.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,F.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>l(!0),"aria-label":`Search messages`,children:(0,F.jsx)(ue,{size:20})})]})]}),(0,F.jsx)(`div`,{className:`wa-web-body`,children:(0,F.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`whatsapp`,accountId:e,remoteJid:t},search:c?u:void 0,onReplyTo:m,groupThread:a})}),(0,F.jsx)(I,{transport:{endpoint:`/api/whatsapp-reader/reply`,fields:{accountId:e,remoteJid:t}},sessionKey:r,replyTo:p,onClearReply:()=>m(null)})]})}function Oe(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||j.has(e)&&(t.add(e),n.push(e)));return n}function z(e,t){return _(e,t)}function ke({conversations:e,sessionKey:t,onBack:n}){let{zone:r}=E(),[i,a]=(0,P.useState)(null),o=w(e);return i?i.source===`store`&&i.channel===`telegram`&&i.accountId&&i.channelKey?(0,F.jsx)(L,{accountId:i.accountId,channelKey:i.channelKey,contactName:v(i),sessionKey:t,onBack:()=>a(null)},T(i)):i.source===`store`&&i.accountId&&i.remoteJid?(0,F.jsx)(R,{accountId:i.accountId,remoteJid:i.remoteJid,contactName:v(i),sessionKey:t,onBack:()=>a(null)},T(i)):(0,F.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,F.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>a(null),"aria-label":`Back to conversations`,children:[(0,F.jsx)(A,{size:16}),` Back`]}),(0,F.jsx)(`span`,{className:`op-conv-title`,children:v(i)})]}),(0,F.jsx)(D,{sessionId:i.sessionId,projectDir:i.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:i.source===`store`,store:i.source===`store`?{channel:`whatsapp`,accountId:i.accountId,remoteJid:i.remoteJid}:void 0},T(i))]}):(0,F.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,F.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,F.jsx)(A,{size:16}),` Chat`]}),(0,F.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),o.map(e=>(0,F.jsxs)(`div`,{className:`op-conv-group`,children:[(0,F.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,F.jsx)(S,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{a(e)},children:[e.source===`store`&&e.accountId&&e.remoteJid&&(0,F.jsx)(ce,{accountId:e.accountId,jid:e.remoteJid,sessionKey:t,className:`op-conv-avatar`,size:16}),(0,F.jsx)(`span`,{className:`op-conv-name`,children:v(e)}),e.modelGated&&(0,F.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,F.jsx)(de,{size:13})}),(0,F.jsx)(`span`,{className:`op-conv-when`,children:z(e.lastMessageAt,r)})]},T(e)))]},e.channel))]})}var Ae=/\.(png|jpe?g|gif|webp|svg)$/i;function je(e){return Ae.test(e)}function B(e){return e.entryPath??e.name}var Me=`maxy-data-view`,Ne=95*1024*1024,Pe=48*1024*1024;function Fe(){return typeof window>`u`?`list`:window.localStorage.getItem(Me)===`grid`?`grid`:`list`}function Ie(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,F.jsx)(x,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,F.jsx)(te,{cacheKey:e,children:(0,F.jsx)(`div`,{className:`data-page data-page-full`,children:(0,F.jsx)(Le,{cacheKey:e})})})}):(0,F.jsx)(`div`,{className:`data-page`,children:(0,F.jsxs)(`div`,{className:`data-empty`,children:[(0,F.jsx)(`p`,{children:`You are not signed in.`}),(0,F.jsxs)(`p`,{children:[`Open the `,(0,F.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,F.jsx)(u,{surface:`gate`})}function Le({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=y({initialCacheKey:e,surface:`data`});return(0,F.jsx)(U,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Re(){if(typeof window>`u`)return`@home`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`@home`}function ze(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`||e===`@home`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function Be(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function V(e){return new Promise((t,n)=>e.file(t,n))}async function Ve(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await V(r),relpath:e});else if(r.isDirectory){let t=await Be(r.createReader());n.push(...await Ve(t,e))}}return n}function He(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function H({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let{zone:r}=E(),[o,l]=(0,P.useState)(``),f=(0,P.useRef)(null),[g,_]=(0,P.useState)(``),[v,ee]=(0,P.useState)(null),[te,y]=(0,P.useState)(`hybrid`),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)(null),[ne,T]=(0,P.useState)(null),[re,ie]=(0,P.useState)(0),[ae,oe]=(0,P.useState)(!1),[D,se]=(0,P.useState)(()=>Re()),[O,ce]=(0,P.useState)(null),[k,A]=(0,P.useState)(()=>Fe()),[j,de]=(0,P.useState)(null),[M,ye]=(0,P.useState)([]),[N,xe]=(0,P.useState)(null),[Se,Ce]=(0,P.useState)(0),[we,Te]=(0,P.useState)(null),Ee=(0,P.useRef)(null),De=M.slice(0,-1).map(e=>e.name).join(`/`),I=(()=>{let e=M.map(e=>e.name);return e.length>=2&&e[0]===`accounts`?`${e[0]}/${e[1]}`:null})(),L=N?De:D,R=(0,P.useCallback)(e=>L===`.`||L===``?e:`${L}/${e}`,[L]),[z,ke]=(0,P.useState)(!1),[Ae,Ie]=(0,P.useState)(!1),[Le,Be]=(0,P.useState)(null),[V,H]=(0,P.useState)(!1),[U,W]=(0,P.useState)(null),[Ge,Ke]=(0,P.useState)(null),[qe,Xe]=(0,P.useState)(null),[Ze,Qe]=(0,P.useState)(!1),[$e,et]=(0,P.useState)(null),tt=(0,P.useRef)(null),[nt,rt]=(0,P.useState)(0),[it,at]=(0,P.useState)(!1),[ot,st]=(0,P.useState)(``),[ct,lt]=(0,P.useState)(null),[ut,dt]=(0,P.useState)(``),[ft,pt]=(0,P.useState)(null),G=(()=>{let e=D===`.`?[]:D.split(`/`).filter(Boolean);return e.some(e=>e.startsWith(`@`))?!1:e.length>=2&&e[0]===`accounts`})(),[mt,ht]=(0,P.useState)(!1),gt=(0,P.useRef)(null),[_t,K]=(0,P.useState)(!1),vt=(0,P.useRef)(null);(0,P.useEffect)(()=>{let e=o.trim();if(!e){_(``),ee(null),w(null);return}oe(!1);let t=setTimeout(()=>_(e),300);return()=>clearTimeout(t)},[o]),(0,P.useEffect)(()=>{if(!g){S(!1);return}let t=!1;return S(!0),w(null),e(`/api/admin/graph-search?q=${encodeURIComponent(g)}&labels=FileArtifact&limit=20${ae?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ee(e.results),y(e.mode??`hybrid`),ie(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||w(e instanceof Error?e.message:String(e))}).finally(()=>{t||S(!1)}),()=>{t=!0}},[g,e,n,ae]);let yt=(0,P.useMemo)(()=>v?Oe(v):[],[v]),bt=ne&&yt.includes(ne)?ne:null,xt=(0,P.useMemo)(()=>v?bt?v.filter(e=>e.labels.includes(bt)):v:null,[v,bt]),St=(0,P.useCallback)(e=>{let n=e.properties.relativePath;if(typeof n!=`string`||n.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[t]);(0,P.useEffect)(()=>{if(!v)return;let e=v.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[v]),(0,P.useEffect)(()=>{let t=!1;return ke(!0),Be(null),e(`/api/admin/files?path=${encodeURIComponent(D===`.`?``:D)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ce(e.entries),ye(e.displayPath??[]),xe(e.view??null),Ce(typeof e.systemCount==`number`?e.systemCount:0))}).catch(e=>{t||(ce([]),ye([]),xe(null),Ce(0),Be(e instanceof Error?e.message:String(e)))}).finally(()=>{t||(ke(!1),Ie(!0))}),()=>{t=!0}},[e,D,nt,n]),(0,P.useEffect)(()=>{if(N!==null||!I||Ee.current===I)return;Ee.current=I;let t=!1;return e(`/api/admin/files?path=${encodeURIComponent(`${I}/@home`)}`).then(e=>e.ok?e.json():null).then(e=>{t||!e||Te((e.entries??[]).map(e=>e.name))}).catch(e=>{console.warn(`[data-ui] op=rail-buckets status=error reason="${e instanceof Error?e.message:String(e)}"`)}),()=>{t=!0}},[e,N,I]),(0,P.useEffect)(()=>{ze(D)},[D]);let Ct=(0,P.useCallback)(()=>{rt(e=>e+1)},[]),q=(0,P.useCallback)(e=>{ht(!1),se(e)},[]),wt=(0,P.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);l(``),w(null),T(null),q(r)},[q]),Tt=(0,P.useCallback)(()=>{if(!D.split(`/`).some(e=>e.startsWith(`@`))){if(D===`.`||D===``)return;let e=D.split(`/`).filter(Boolean);e.pop(),se(e.length===0?`.`:e.join(`/`));return}M.length!==0&&se(M.length>=2?M.slice(0,M.length-1).map(e=>e.name).join(`/`):`.`)},[D,M]),Et=(0,P.useCallback)(e=>{pe(t,R(B(e)))},[R,t]),[J,Dt]=(0,P.useState)(!1),[Y,Ot]=(0,P.useState)(new Set),kt=(0,P.useRef)(null),X=(0,P.useRef)(!1),At=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,jt=(0,P.useCallback)(e=>{Dt(!0),Ot(new Set([e]))},[]),Z=(0,P.useCallback)(e=>{Dt(!1),Ot(new Set)},[]),Q=(0,P.useCallback)(e=>{Ot(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Mt=(0,P.useCallback)(e=>{X.current=!1,kt.current=setTimeout(()=>{X.current=!0,jt(e)},500)},[jt]),$=(0,P.useCallback)(()=>{kt.current&&=(clearTimeout(kt.current),null)},[]),Nt=(0,P.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}Et(e)},[J,Q,Et]),Pt=(0,P.useCallback)(e=>{A(e),typeof window<`u`&&window.localStorage.setItem(Me,e)},[]),Ft=(0,P.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}de({src:me(t,R(B(e))),alt:e.displayName??e.name})},[J,Q,R,t]),It=(0,P.useCallback)(()=>(O??[]).filter(e=>e.kind===`file`&&Y.has(e.name)),[O,Y]),Lt=(0,P.useCallback)(()=>{if(Y.size!==1)return null;let e=(O??[]).find(e=>Y.has(e.name));return e&&!e.entryPath?e:null},[O,Y]),Rt=(0,P.useCallback)(()=>(O??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&Y.has(e.name)),[O,Y]),zt=(0,P.useCallback)(()=>{let e=Rt(),n=e.some(e=>e.kind===`directory`);e.length===1&&!n?Et(e[0]):e.length>=1&&fe(t,e.map(e=>R(B(e)))),Z(`action`)},[Rt,Et,R,t,Z]),Bt=(0,P.useCallback)(async()=>{let t=It(),n=t.filter(e=>!e.protected),r=t.length-n.length;et(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=R(B(t));try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){et(e instanceof Error?e.message:String(e))}}rt(e=>e+1),Z(`action`)},[It,R,e,Z]),Vt=(0,P.useCallback)(async()=>{let e=It();if(At)try{let n=await Promise.all(e.map(async e=>{let n=R(B(e)),r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:n})&&await navigator.share({files:n})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[It,At,R,t]),Ht=(0,P.useCallback)(()=>{tt.current?.click()},[]),Ut=(0,P.useCallback)((e,n={})=>{let r=(r,i,a)=>{let o=new URLSearchParams({session_key:t,path:D===`.`?``:D,filename:e.name});n.relpath&&o.set(`relpath`,n.relpath),n.token&&o.set(`token`,n.token);for(let[e,t]of Object.entries(i))o.set(e,t);return new Promise(t=>{let n=new XMLHttpRequest;n.open(`POST`,`/api/admin/files/upload?${o.toString()}`),n.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),a&&(n.upload.onprogress=e=>{e.lengthComputable&&a(e.loaded)}),n.onload=()=>{let e={};try{e=JSON.parse(n.responseText)}catch{}t({status:n.status,data:e})},n.onerror=()=>t({status:0,data:{}}),n.onabort=()=>t({status:0,data:{error:`aborted`}}),n.send(r)})};if(e.size<=Ne)return r(e,{},t=>n.onProgress?.(t,e.size));let i=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,a=Math.ceil(e.size/Pe);return(async()=>{let t={status:0,data:{}};for(let o=0;o<a;o++){let s=o*Pe;if(t=await r(e.slice(s,Math.min(s+Pe,e.size)),{uploadId:i,seq:String(o),total:String(a)},t=>n.onProgress?.(s+t,e.size)),!(t.status>=200&&t.status<300))return t}return t})()},[t,D]),Wt=(0,P.useCallback)(async e=>{Ke(null),H(!0),W({loaded:0,total:e.size});try{let{status:t,data:n}=await Ut(e,{onProgress:(e,t)=>W({loaded:e,total:t})});t>=200&&t<300&&n.path?(se(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),rt(e=>e+1)):Ke(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{H(!1),W(null),tt.current&&(tt.current.value=``)}},[Ut]),Gt=(0,P.useCallback)(e=>{G&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Qe(!0))},[G]),Kt=(0,P.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Qe(!1)},[]),qt=(0,P.useCallback)(async e=>{e.preventDefault(),Qe(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(n.length===0)return;if(!G){Ke(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);H(!0),Ke(null),Xe(null);try{let e=await Ve(r),n=0,i=[];for(let r=0;r<e.length;r++){let{file:a,relpath:o}=e[r];W({loaded:0,total:a.size});let{status:s,data:c}=await Ut(a,{relpath:o,token:t,onProgress:(e,t)=>W({loaded:e,total:t})});if(s>=200&&s<300)n++;else{let e=s===0?`http=0`:He(s,c.error);i.push(`${o} (${e})`)}}Xe(`Uploaded ${n}, skipped ${i.length}${i.length?`: ${i.join(`, `)}`:``}`),rt(e=>e+1)}catch(e){Ke(e instanceof Error?e.message:String(e))}finally{H(!1),W(null)}},[G,Ut]),Jt=(0,P.useCallback)(async()=>{let t=ot.trim();if(t){pt(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:D===`.`?``:D,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);at(!1),st(``),rt(e=>e+1)}catch(e){pt(e instanceof Error?e.message:String(e))}}},[e,ot,D]),Yt=(0,P.useCallback)(async()=>{if(!ct)return;let t=ut.trim();if(!t)return;pt(null);let n=R(ct);try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);lt(null),dt(``),Z(`action`),rt(e=>e+1)}catch(e){pt(e instanceof Error?e.message:String(e))}},[e,ut,ct,R,Z]);(0,P.useEffect)(()=>{if(!mt)return;let e=e=>{gt.current&&!gt.current.contains(e.target)&&ht(!1)},t=e=>{e.key===`Escape`&&ht(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[mt]),(0,P.useEffect)(()=>{if(!_t)return;let e=e=>{vt.current&&!vt.current.contains(e.target)&&K(!1)},t=e=>{e.key===`Escape`&&K(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[_t]);let Xt=(0,P.useCallback)(e=>M.slice(0,e+1).map(e=>e.name).join(`/`),[M]),Zt=M.length>=2,Qt=Zt?[{name:`.`,label:`data`},...M.slice(0,M.length-2).map((e,t)=>({name:Xt(t),label:e.displayName??e.name}))]:[];return Ae?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`data-toolbar`,children:[J?(0,F.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Z(`cancel`),"aria-label":`Cancel selection`,children:[(0,F.jsx)(b,{size:14}),` Cancel`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`data-search-input`,children:[o===``&&(0,F.jsx)(ue,{size:14}),(0,F.jsx)(`input`,{ref:f,type:`text`,value:o,onChange:e=>l(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),x&&(0,F.jsx)(p,{size:14,className:`spin`}),o!==``&&(0,F.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{l(``),f.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,F.jsx)(b,{size:14})})]}),(0,F.jsxs)(`div`,{className:`data-toolbar-actions`,ref:vt,children:[(0,F.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>K(e=>!e),"aria-haspopup":`menu`,"aria-expanded":_t,"aria-label":`File actions`,title:`File actions`,children:(0,F.jsx)(he,{size:16})}),(0,F.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":_t?`true`:void 0,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ct(),K(!1)},disabled:z,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[z?(0,F.jsx)(p,{size:16,className:`spin`}):(0,F.jsx)(i,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Ht(),K(!1)},disabled:V||!G,title:G?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[V?U&&U.total>0?(0,F.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(U.loaded/U.total*100),`%`]}):(0,F.jsx)(p,{size:16,className:`spin`}):(0,F.jsx)(be,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{at(e=>!e),st(``),pt(null),K(!1)},disabled:V||!G,title:G?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,F.jsx)(ge,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Pt(k===`grid`?`list`:`grid`),K(!1)},title:k===`grid`?`List view`:`Grid view`,"aria-label":k===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":k===`grid`,children:[k===`grid`?(0,F.jsx)(ve,{size:16}):(0,F.jsx)(_e,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:k===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,F.jsxs)(`div`,{className:`data-breadcrumbs`,children:[D!==`.`&&(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:Tt,title:`Up one level`,"aria-label":`Up one level`,children:(0,F.jsx)(h,{size:14})}),Zt?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,ref:gt,children:[(0,F.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>ht(e=>!e),"aria-haspopup":`menu`,"aria-expanded":mt,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),mt&&(0,F.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Qt.map(e=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>q(e.name),title:e.label,children:e.label},e.name))})]}),[M.length-2,M.length-1].map(e=>{let t=M[e];return(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,F.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Xt(e)),title:t.name,children:t.displayName??t.name})]},Xt(e))})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(`.`),children:`data`}),M.map((e,t)=>(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,F.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Xt(t)),title:e.name,children:e.displayName??e.name})]},Xt(t)))]})]}),it&&(0,F.jsxs)(`div`,{className:`data-inline-form`,children:[(0,F.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:ot,autoFocus:!0,onChange:e=>st(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Jt(),e.key===`Escape`&&at(!1)}}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Jt,children:`Create`}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>at(!1),children:`Cancel`})]}),ct&&(0,F.jsxs)(`div`,{className:`data-inline-form`,children:[(0,F.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:ut,autoFocus:!0,onChange:e=>dt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Yt(),e.key===`Escape`&&lt(null)}}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Yt,children:`Rename`}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>lt(null),children:`Cancel`})]}),ft&&(0,F.jsx)(`div`,{className:`data-error`,children:ft}),(0,F.jsx)(`input`,{type:`file`,ref:tt,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Wt(t)}})]}),(0,F.jsxs)(`div`,{className:`data-body`,"data-drag-active":Ze?`true`:void 0,onDragEnter:Gt,onDragOver:Gt,onDragLeave:Kt,onDrop:qt,children:[N===null&&I&&we&&we.length>0&&(0,F.jsxs)(`aside`,{className:`data-rail`,"aria-label":`Folders`,children:[(0,F.jsx)(`span`,{className:`data-rail-label`,children:`Folders`}),(0,F.jsx)(`ul`,{className:`data-rail-list`,children:we.map(e=>{let t=`${I}/${e}`,n=D===t||D.startsWith(`${t}/`);return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:`data-rail-item`,"aria-current":n?`true`:void 0,onClick:()=>q(t),children:[(0,F.jsx)(m,{size:13}),(0,F.jsx)(`span`,{className:`data-rail-item-name`,children:e})]})},e)})})]}),(0,F.jsxs)(`div`,{className:`data-content`,children:[(C!==null||v!==null)&&(0,F.jsxs)(`section`,{className:`data-panel admin-card`,children:[C&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,C]}),yt.length>0&&(0,F.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:yt.map(e=>{let t=e===bt;return(0,F.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>T(t?null:e),children:We([e])??e},e)})}),v&&!x&&(0,F.jsxs)(`div`,{className:`data-results-meta`,children:[xt.length,` of `,v.length,` result`,v.length===1?``:`s`]}),v&&!x&&!bt&&re>0&&!ae&&(0,F.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[re,` low-confidence result`,re===1?``:`s`,` hidden — show all`]}),v&&!x&&!bt&&ae&&(0,F.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),v&&v.length===0&&!x&&(0,F.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),xt&&xt.length>0&&(0,F.jsx)(`ul`,{className:`data-results`,children:xt.map(e=>(0,F.jsx)(Ue,{hit:e,mode:te,onDownload:St,onLocate:wt},e.nodeId))})]}),(0,F.jsxs)(`section`,{className:`data-panel data-panel--wide admin-card`,children:[U&&(0,F.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":U.total>0?Math.round(U.loaded/U.total*100):void 0,children:[(0,F.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,F.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${U.total>0?Math.round(U.loaded/U.total*100):0}%`}})}),(0,F.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,U.total>0?`${Math.round(U.loaded/U.total*100)}%`:``]})]}),Ge&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,Ge]}),qe&&(0,F.jsx)(`div`,{className:`data-status`,children:qe}),$e&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,$e]}),Le&&(0,F.jsx)(`div`,{className:`data-error`,children:Le}),z&&(0,F.jsxs)(`div`,{className:`data-loading`,children:[(0,F.jsx)(p,{size:14,className:`spin`}),` Loading…`]}),!z&&N!==`home`&&O&&O.length===0&&!Le&&(0,F.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!z&&N===`home`&&O&&(0,F.jsxs)(`ul`,{className:`routine-list data-home-list`,children:[O.map(e=>(0,F.jsxs)(`li`,{className:`data-home-card`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>q(R(e.name)),children:[(0,F.jsx)(`span`,{className:`data-home-card-title`,children:e.name}),(0,F.jsx)(`span`,{className:`data-home-card-count`,children:e.childCount===null||e.childCount===void 0?`—`:`${e.childCount} ${e.childCount===1?`item`:`items`}`})]}),(0,F.jsxs)(`ul`,{className:`data-home-card-children`,children:[e.childCount===null&&(0,F.jsx)(`li`,{className:`data-home-card-error`,children:`Could not read this folder.`}),e.childCount===0&&(0,F.jsx)(`li`,{className:`data-home-card-empty`,children:`Empty.`}),(e.children??[]).map(e=>(0,F.jsxs)(`li`,{className:`data-home-card-child`,children:[e.kind===`directory`?(0,F.jsx)(m,{size:12}):(0,F.jsx)(le,{size:12}),(0,F.jsx)(`span`,{className:`data-home-card-child-name`,children:e.name})]},e.name)),typeof e.childCount==`number`&&e.childCount>(e.children?.length??0)&&(0,F.jsxs)(`li`,{className:`data-home-card-more`,children:[`+`,e.childCount-(e.children?.length??0),` more`]})]})]},e.name)),(0,F.jsxs)(`li`,{className:`data-home-card`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>q(R(`@system`)),children:[(0,F.jsx)(`span`,{className:`data-home-card-title`,children:`system`}),(0,F.jsxs)(`span`,{className:`data-home-card-count`,children:[Se,` `,Se===1?`item`:`items`]})]}),(0,F.jsx)(`ul`,{className:`data-home-card-children`,children:(0,F.jsx)(`li`,{className:`data-home-card-empty`,children:`Platform and plugin folders.`})})]})]}),!z&&N!==`home`&&O&&O.length>0&&k===`grid`&&(0,F.jsx)(`ul`,{className:`data-grid`,children:O.map(e=>{let n=e.displayName??e.name,r=J&&Y.has(e.name);if(e.kind===`directory`)return(0,F.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(R(e.name))},children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsx)(m,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n})]})},e.name);if(e.kind===`file`){let i=je(B(e)),a=R(B(e));return(0,F.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?Ft(e):Nt(e),title:J?void 0:i?`Preview ${n}`:`Download ${n}`,children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,F.jsx)(`img`,{className:`data-grid-thumb`,src:me(t,a),alt:n,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,F.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n}),!i&&(0,F.jsx)(`span`,{className:`data-grid-sub`,children:Je(e.sizeBytes)})]})},e.name)}return(0,F.jsx)(`li`,{className:`data-grid-cell`,children:(0,F.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,F.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,children:n}),(0,F.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!z&&N!==`home`&&O&&O.length>0&&k===`list`&&(0,F.jsx)(`ul`,{className:`data-entries`,children:O.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=J&&Y.has(e.name);return(0,F.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(R(e.name))},children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsx)(m,{size:14}),(0,F.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=J&&Y.has(e.name);return(0,F.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>Nt(e),title:J?void 0:`Download ${t}`,children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsxs)(`span`,{className:`data-entry-text`,children:[(0,F.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,F.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Ye(e.modifiedAt,r)}`,children:[Je(e.sizeBytes),` · `,Ye(e.modifiedAt,r)]})]})]})},e.name)}return(0,F.jsx)(`li`,{className:`data-entry`,children:(0,F.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,F.jsxs)(`span`,{className:`data-entry-text`,children:[(0,F.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,F.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]})]}),J&&(0,F.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,F.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Vt,disabled:!At||Y.size===0,title:At?`Share selected files`:`Sharing is not supported on this device`,children:[(0,F.jsx)(d,{size:16}),` Share`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:zt,disabled:Y.size===0,children:[(0,F.jsx)(a,{size:16}),` Download`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=Lt();e&&(lt(e.name),dt(e.name))},disabled:!Lt(),children:[(0,F.jsx)(s,{size:16}),` Rename`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Bt,disabled:Y.size===0,children:[(0,F.jsx)(c,{size:16}),` Delete`]})]})}),j&&(0,F.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":j.alt,onClick:()=>de(null),children:(0,F.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:j.src,alt:j.alt})})]}):(0,F.jsx)(u,{surface:`gate`})}function U({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let r=(0,P.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),i=(0,P.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[a,o]=(0,P.useState)([]),[s,c]=(0,P.useState)(`files`),{subAccounts:l,activeAccountId:u,switching:d,switchAccount:p}=C(t);return(0,P.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/operator-conversations/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||o(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,F.jsxs)(`main`,{className:`data-main`,children:[(0,F.jsx)(f,{variant:`operator`,onNavigate:i,onOpenConversations:a.length>0?()=>c(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:l,activeAccountId:u,switchingAccount:d,onSwitchAccount:p}),s===`conversations`?(0,F.jsx)(ke,{conversations:a,sessionKey:t,onBack:()=>c(`files`)}):(0,F.jsx)(H,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function W({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=y({initialCacheKey:e,surface:`data`});return(0,F.jsx)(`div`,{className:`data-page`,children:(0,F.jsx)(`main`,{className:`data-main`,children:(0,F.jsx)(H,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function Ue({hit:e,mode:t,onDownload:n,onLocate:r}){let{zone:i}=E(),a=Ge(e.properties),o=Ke(e.properties),s=We(e.labels),c=qe(e.properties),[l,u]=(0,P.useState)(!1),d=o&&o.length>280,f=l||!d?o:o?.slice(0,280)+`…`,p=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,h=e.properties.relativePath,g=typeof h==`string`&&h.length>0,_=g?h.lastIndexOf(`/`):-1,v=g?_===-1?`data`:h.slice(0,_):null;return(0,F.jsxs)(`li`,{className:`data-result`,children:[(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${a??s??`file`}`,children:[s&&(0,F.jsx)(`div`,{className:`data-result-header`,children:(0,F.jsx)(`span`,{className:`data-result-labels`,children:s})}),a&&(0,F.jsx)(`div`,{className:`data-result-title`,children:a}),o&&(0,F.jsx)(`pre`,{className:`data-result-body`,children:f}),(0,F.jsxs)(`div`,{className:`data-result-scores`,children:[c&&(0,F.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Ye(c,i),` · `]}),p]})]}),g&&(0,F.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${v}`,"aria-label":`Locate in ${v}`,children:[(0,F.jsx)(m,{size:12}),v]}),d&&(0,F.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>u(e=>!e),children:l?`Show less`:`Show more`})]})}function We(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ge(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function Ke(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function qe(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Je(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function Ye(e,t){return _(e,t)||`—`}export{L as i,W as n,R as r,Ie as t};
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,r as n,t as r}from"./jsx-runtime-UK6hgBWO.js";import{F as i,G as a,I as o,L as s,M as c,N as l,O as u,P as d,T as f,V as p,W as m,Y as h,Z as g,_,c as v,d as ee,g as te,it as y,j as b,k as x,m as S,n as C,s as w,t as ne,u as T,v as E}from"./useMediaQuery-CqwktQr_.js";import{A as re,D as ie,E as ae,S as oe,c as D,k as se,n as O,p as ce,r as k}from"./useVoiceRecorder-CAZcUc1s.js";import{t as A}from"./chevron-left-C5FXH9r_.js";import{t as le}from"./file-text-BddO_2EI.js";import{i as ue,t as j}from"./graph-labels-CtFFq5W2.js";import{t as de}from"./triangle-alert-BzCjDFts.js";import{i as fe,n as pe,t as me}from"./file-download-B7zwa78w.js";var he=g(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ge=g(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),M=g(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_e=g(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ve=g(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ye=g(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),N=g(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),be=g(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),P=e(t(),1);function xe(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=(0,P.useRef)(null),s=(0,P.useCallback)(e=>{a(null);let n=e.find(e=>!k(e.type,re));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>se);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,P.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,P.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,P.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,P.useCallback)(()=>{r(!1)},[]),onDrop:(0,P.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var Se=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function Ce(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var F=r();function we({onSelect:e}){return(0,F.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:Se.map((t,n)=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function Te({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=(0,P.useCallback)(t=>{u(!0),c(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{o(e),i(e.path===`.`?``:e.path)}).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>u(!1))},[e]);(0,P.useEffect)(()=>{d(``)},[d]);let f=e=>d(r?`${r}/${e}`:e),p=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),d(e.join(`/`))},h=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,F.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,F.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,F.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:p,"aria-label":`Up one folder`,children:(0,F.jsx)(A,{size:18})}),(0,F.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,F.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,F.jsx)(b,{size:18})})]}),s&&(0,F.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:s}),l&&(0,F.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!l&&(0,F.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,F.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,F.jsx)(`li`,{children:e.kind===`directory`?(0,F.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>f(e.name),children:[(0,F.jsx)(m,{size:16,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,F.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>h(e),children:[(0,F.jsx)(le,{size:16,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}var Ee=n();function De(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function I({transport:e,sessionKey:t,replyTo:n,onClearReply:r,features:i}){let a=i?.attachments!==!1,s=i?.voice!==!1,u=i?.deviceFiles!==!1,d=i?.quote!==!1,[f,p]=(0,P.useState)(``),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)(null),[v,ee]=(0,P.useState)(!1),[te,y]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),T=(0,P.useRef)(null),{pendingFiles:E,attachError:re,setAttachError:oe,addFiles:D,removeFile:se,clearFiles:ce}=xe(),{state:k,elapsedSeconds:A,errorMessage:ue,start:j,send:de,discard:fe}=O(),pe=k===`recording`||k===`paused`,me=(0,P.useCallback)(()=>{j()},[j]),he=(0,P.useCallback)(async()=>{let e=await de();if(e){let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;D([new File([e],`voice-note${t}`,{type:e.type})])}},[A,de,D]),ge=(0,P.useCallback)(()=>{fe()},[A,fe]),_e=(0,P.useRef)(!1),ve=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[be,Se]=(0,P.useState)(null),[I,L]=(0,P.useState)(null),R=(0,P.useRef)(null),Oe=(0,P.useCallback)(e=>{let t=R.current;t&&Se(Math.min(ve(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),z=(0,P.useCallback)(()=>{R.current=null,window.removeEventListener(`pointermove`,Oe),window.removeEventListener(`pointerup`,z)},[Oe]),ke=(0,P.useCallback)(e=>{R.current={startY:e.clientY,startH:T.current?.offsetHeight??44},window.addEventListener(`pointermove`,Oe),window.addEventListener(`pointerup`,z),e.preventDefault()},[Oe,z]),Ae=(0,P.useCallback)(e=>{let t=be??T.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(ve(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&Se(n)},[be]),je=(0,P.useRef)(``);(0,P.useEffect)(()=>{let e=T.current;if(!e)return;let t=je.current!==``&&f===``;if(je.current=f,be!==null){t&&Se(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(ve(),Math.max(44,e.scrollHeight));e.style.height=n,L(r)},[f,be]);let B=(f.trim().length>0||E.length>0||C.length>0)&&!m,Me=(0,P.useCallback)(async()=>{if(!_e.current&&!(f.trim().length===0&&E.length===0&&C.length===0)){_e.current=!0,h(!0),_(null);try{let i=`${e.endpoint}?session_key=${encodeURIComponent(t)}`,a;if(E.length>0||C.length>0){let t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);f.trim()&&t.append(`text`,f);for(let e of E)t.append(`files`,e);for(let e of C)t.append(`fileRefs`,e.path);n&&t.append(`quotedId`,n.msgKeyId),a=await fetch(i,{method:`POST`,body:t})}else a=await fetch(i,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e.fields,text:f,...n?{quotedId:n.msgKeyId}:{}})});let o=await a.json().catch(()=>({}));if(!a.ok){_(o.error??`Send failed.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${o.error??`unknown`}`);return}p(``),ce(),w([]),r?.()}catch(t){_(`Could not reach the server. Try again.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${String(t)}`)}finally{_e.current=!1,h(!1)}}},[f,E,C,n,r,e,t,ce]),Ne=(0,P.useCallback)(e=>{let t=T.current,{value:n,caret:r}=Ce(f,e,t?t.selectionStart:null,t?t.selectionEnd:null);p(n),ee(!1),requestAnimationFrame(()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[f]),Pe=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),B&&Me())},Fe=e=>e.dataTransfer.types.includes(`Files`),Ie=(0,P.useCallback)(e=>{Fe(e)&&(e.preventDefault(),a&&S(!0))},[a]),Le=(0,P.useCallback)(()=>S(!1),[]),Re=(0,P.useCallback)(e=>{if(!Fe(e))return;e.preventDefault(),S(!1);let t=[...e.dataTransfer.files];if(t.length!==0){if(!a){oe(`This conversation takes text only. Attachments cannot be sent here.`);return}Math.max(0,E.length+t.length-5),D(t)}},[E.length,D,a,oe]),ze=e=>e.startsWith(`image/`)?(0,F.jsx)(M,{size:14}):e===`application/pdf`?(0,F.jsx)(le,{size:14}):(0,F.jsx)(ie,{size:14}),Be=ne(`(max-width: 720px)`),[V,Ve]=(0,P.useState)(null);(0,P.useEffect)(()=>{Ve(Be?document.querySelector(`.admin-footer`):null)},[Be]);let He=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>ee(e=>!e),disabled:m,"aria-label":`Emoji`,"aria-expanded":v,children:(0,F.jsx)(N,{size:22})}),(a||u)&&(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>y(!0),disabled:m,"aria-label":`Attach files`,children:(0,F.jsx)(o,{size:22})})]});return(0,F.jsxs)(`div`,{className:`wa-reply${x?` wa-reply-drag-over`:``}`,onDragOver:Ie,onDragLeave:Le,onDrop:Re,children:[te&&(0,F.jsx)(Te,{sessionKey:t,onPick:e=>{w(t=>[...t,e].slice(0,5)),y(!1)},onClose:()=>y(!1)}),v&&(0,F.jsx)(we,{onSelect:Ne}),g&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:g}),re&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:re}),k===`error`&&ue&&(0,F.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ue}),(E.length>0||C.length>0)&&(0,F.jsxs)(`div`,{className:`wa-reply-attachments`,children:[E.map((e,t)=>(0,F.jsxs)(`div`,{className:`wa-reply-chip`,children:[ze(e.type),(0,F.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>se(t),"aria-label":`Remove ${e.name}`,children:(0,F.jsx)(b,{size:12})})]},`f-${t}`)),C.map((e,t)=>(0,F.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,F.jsx)(le,{size:14}),(0,F.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>w(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,F.jsx)(b,{size:12})})]},`r-${t}`))]}),d&&n&&(0,F.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,F.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,F.jsx)(`span`,{className:`wa-reply-quote-who`,children:n.fromMe?`You`:n.senderName??`Contact`}),(0,F.jsx)(`span`,{className:`wa-reply-quote-text`,children:n.body||`Message`})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>r?.(),"aria-label":`Cancel reply`,children:(0,F.jsx)(b,{size:14})})]}),!pe&&(0,F.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:ke,onKeyDown:Ae}),(0,F.jsx)(`div`,{className:`wa-reply-row`,children:pe?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:ge,"aria-label":`Cancel recording`,children:(0,F.jsx)(c,{size:20})}),(0,F.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,F.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),De(A)]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,F.jsx)(l,{size:20})})]}):(0,F.jsxs)(F.Fragment,{children:[V?(0,Ee.createPortal)((0,F.jsx)(`div`,{className:`wa-reply-footer-actions`,children:He}),V):He,(0,F.jsxs)(`div`,{className:`wa-reply-inputwrap`,children:[(0,F.jsx)(`textarea`,{ref:T,className:`wa-reply-input`,value:f,rows:1,style:{height:`${be??I??44}px`},placeholder:`Type a message`,disabled:m,onChange:e=>p(e.target.value),onKeyDown:Pe}),s&&f.length===0&&(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void me(),disabled:m,"aria-label":`Record voice note`,children:(0,F.jsx)(ae,{size:22})})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void Me(),disabled:!B,"aria-label":`Send`,children:(0,F.jsx)(ye,{size:20})})]})})]})}function L({accountId:e,channelKey:t,contactName:n,sessionKey:r,sendable:i=!0,onBack:a}){let o=t.slice(t.indexOf(`:`)+1),s=n===o?void 0:o;return(0,F.jsxs)(`div`,{className:`wa-web tg-web`,children:[(0,F.jsxs)(`header`,{className:`wa-web-header`,children:[a&&(0,F.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:a,"aria-label":`Back`,children:(0,F.jsx)(A,{size:20})}),(0,F.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,F.jsx)(oe,{size:20})}),(0,F.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,F.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,F.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]})]}),(0,F.jsx)(`div`,{className:`wa-web-body`,"data-testid":`telegram-web-conversation`,children:(0,F.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`telegram`,accountId:e,channelKey:t}})}),i&&(0,F.jsx)(I,{transport:{endpoint:`/api/telegram-reader/send`,fields:{accountId:e,channelKey:t}},sessionKey:r,features:{attachments:!1,voice:!1,deviceFiles:!1,quote:!1}})]})}function R({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=ee(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(``),f=()=>{l(!1),d(``)},[p,m]=(0,P.useState)(null);return(0,F.jsxs)(`div`,{className:`wa-web`,children:[(0,F.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,F.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,F.jsx)(A,{size:20})}),(0,F.jsx)(ce,{accountId:e,jid:t,sessionKey:r}),c?(0,F.jsxs)(`div`,{className:`wa-web-search`,children:[(0,F.jsx)(ue,{size:18,"aria-hidden":!0}),(0,F.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`&&f()}}),(0,F.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:f,"aria-label":`Close search`,children:(0,F.jsx)(b,{size:18})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,F.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,F.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,F.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>l(!0),"aria-label":`Search messages`,children:(0,F.jsx)(ue,{size:20})})]})]}),(0,F.jsx)(`div`,{className:`wa-web-body`,children:(0,F.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`whatsapp`,accountId:e,remoteJid:t},search:c?u:void 0,onReplyTo:m,groupThread:a})}),(0,F.jsx)(I,{transport:{endpoint:`/api/whatsapp-reader/reply`,fields:{accountId:e,remoteJid:t}},sessionKey:r,replyTo:p,onClearReply:()=>m(null)})]})}function Oe(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||j.has(e)&&(t.add(e),n.push(e)));return n}function z(e,t){return _(e,t)}function ke({conversations:e,sessionKey:t,onBack:n}){let{zone:r}=E(),[i,a]=(0,P.useState)(null),o=w(e);return i?i.source===`store`&&i.channel===`telegram`&&i.accountId&&i.channelKey?(0,F.jsx)(L,{accountId:i.accountId,channelKey:i.channelKey,contactName:v(i),sessionKey:t,onBack:()=>a(null)},T(i)):i.source===`store`&&i.accountId&&i.remoteJid?(0,F.jsx)(R,{accountId:i.accountId,remoteJid:i.remoteJid,contactName:v(i),sessionKey:t,onBack:()=>a(null)},T(i)):(0,F.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,F.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>a(null),"aria-label":`Back to conversations`,children:[(0,F.jsx)(A,{size:16}),` Back`]}),(0,F.jsx)(`span`,{className:`op-conv-title`,children:v(i)})]}),(0,F.jsx)(D,{sessionId:i.sessionId,projectDir:i.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:i.source===`store`,store:i.source===`store`?{channel:`whatsapp`,accountId:i.accountId,remoteJid:i.remoteJid}:void 0},T(i))]}):(0,F.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,F.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,F.jsx)(A,{size:16}),` Chat`]}),(0,F.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),o.map(e=>(0,F.jsxs)(`div`,{className:`op-conv-group`,children:[(0,F.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,F.jsx)(S,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,F.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{a(e)},children:[e.source===`store`&&e.accountId&&e.remoteJid&&(0,F.jsx)(ce,{accountId:e.accountId,jid:e.remoteJid,sessionKey:t,className:`op-conv-avatar`,size:16}),(0,F.jsx)(`span`,{className:`op-conv-name`,children:v(e)}),e.modelGated&&(0,F.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,F.jsx)(de,{size:13})}),(0,F.jsx)(`span`,{className:`op-conv-when`,children:z(e.lastMessageAt,r)})]},T(e)))]},e.channel))]})}var Ae=/\.(png|jpe?g|gif|webp|svg)$/i;function je(e){return Ae.test(e)}function B(e){return e.entryPath??e.name}var Me=`maxy-data-view`,Ne=95*1024*1024,Pe=48*1024*1024;function Fe(){return typeof window>`u`?`list`:window.localStorage.getItem(Me)===`grid`?`grid`:`list`}function Ie(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,F.jsx)(x,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,F.jsx)(te,{cacheKey:e,children:(0,F.jsx)(`div`,{className:`data-page data-page-full`,children:(0,F.jsx)(Le,{cacheKey:e})})})}):(0,F.jsx)(`div`,{className:`data-page`,children:(0,F.jsxs)(`div`,{className:`data-empty`,children:[(0,F.jsx)(`p`,{children:`You are not signed in.`}),(0,F.jsxs)(`p`,{children:[`Open the `,(0,F.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,F.jsx)(u,{surface:`gate`})}function Le({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=y({initialCacheKey:e,surface:`data`});return(0,F.jsx)(U,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Re(){if(typeof window>`u`)return`@home`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`@home`}function ze(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`||e===`@home`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function Be(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function V(e){return new Promise((t,n)=>e.file(t,n))}async function Ve(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await V(r),relpath:e});else if(r.isDirectory){let t=await Be(r.createReader());n.push(...await Ve(t,e))}}return n}function He(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function H({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let{zone:r}=E(),[o,l]=(0,P.useState)(``),f=(0,P.useRef)(null),[g,_]=(0,P.useState)(``),[v,ee]=(0,P.useState)(null),[te,y]=(0,P.useState)(`hybrid`),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)(null),[ne,T]=(0,P.useState)(null),[re,ie]=(0,P.useState)(0),[ae,oe]=(0,P.useState)(!1),[D,se]=(0,P.useState)(()=>Re()),[O,ce]=(0,P.useState)(null),[k,A]=(0,P.useState)(()=>Fe()),[j,de]=(0,P.useState)(null),[M,ye]=(0,P.useState)([]),[N,xe]=(0,P.useState)(null),[Se,Ce]=(0,P.useState)(0),[we,Te]=(0,P.useState)(null),Ee=(0,P.useRef)(null),De=M.slice(0,-1).map(e=>e.name).join(`/`),I=(()=>{let e=M.map(e=>e.name);return e.length>=2&&e[0]===`accounts`?`${e[0]}/${e[1]}`:null})(),L=N?De:D,R=(0,P.useCallback)(e=>L===`.`||L===``?e:`${L}/${e}`,[L]),[z,ke]=(0,P.useState)(!1),[Ae,Ie]=(0,P.useState)(!1),[Le,Be]=(0,P.useState)(null),[V,H]=(0,P.useState)(!1),[U,W]=(0,P.useState)(null),[Ge,Ke]=(0,P.useState)(null),[qe,Xe]=(0,P.useState)(null),[Ze,Qe]=(0,P.useState)(!1),[$e,et]=(0,P.useState)(null),tt=(0,P.useRef)(null),[nt,rt]=(0,P.useState)(0),[it,at]=(0,P.useState)(!1),[ot,st]=(0,P.useState)(``),[ct,lt]=(0,P.useState)(null),[ut,dt]=(0,P.useState)(``),[ft,pt]=(0,P.useState)(null),G=(()=>{let e=D===`.`?[]:D.split(`/`).filter(Boolean);return e.some(e=>e.startsWith(`@`))?!1:e.length>=2&&e[0]===`accounts`})(),[mt,ht]=(0,P.useState)(!1),gt=(0,P.useRef)(null),[_t,K]=(0,P.useState)(!1),vt=(0,P.useRef)(null);(0,P.useEffect)(()=>{let e=o.trim();if(!e){_(``),ee(null),w(null);return}oe(!1);let t=setTimeout(()=>_(e),300);return()=>clearTimeout(t)},[o]),(0,P.useEffect)(()=>{if(!g){S(!1);return}let t=!1;return S(!0),w(null),e(`/api/admin/graph-search?q=${encodeURIComponent(g)}&labels=FileArtifact&limit=20${ae?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ee(e.results),y(e.mode??`hybrid`),ie(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||w(e instanceof Error?e.message:String(e))}).finally(()=>{t||S(!1)}),()=>{t=!0}},[g,e,n,ae]);let yt=(0,P.useMemo)(()=>v?Oe(v):[],[v]),bt=ne&&yt.includes(ne)?ne:null,xt=(0,P.useMemo)(()=>v?bt?v.filter(e=>e.labels.includes(bt)):v:null,[v,bt]),St=(0,P.useCallback)(e=>{let n=e.properties.relativePath;if(typeof n!=`string`||n.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[t]);(0,P.useEffect)(()=>{if(!v)return;let e=v.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[v]),(0,P.useEffect)(()=>{let t=!1;return ke(!0),Be(null),e(`/api/admin/files?path=${encodeURIComponent(D===`.`?``:D)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ce(e.entries),ye(e.displayPath??[]),xe(e.view??null),Ce(typeof e.systemCount==`number`?e.systemCount:0))}).catch(e=>{t||(ce([]),ye([]),xe(null),Ce(0),Be(e instanceof Error?e.message:String(e)))}).finally(()=>{t||(ke(!1),Ie(!0))}),()=>{t=!0}},[e,D,nt,n]),(0,P.useEffect)(()=>{if(N!==null||!I||Ee.current===I)return;Ee.current=I;let t=!1;return e(`/api/admin/files?path=${encodeURIComponent(`${I}/@home`)}`).then(e=>e.ok?e.json():null).then(e=>{t||!e||Te((e.entries??[]).map(e=>e.name))}).catch(e=>{console.warn(`[data-ui] op=rail-buckets status=error reason="${e instanceof Error?e.message:String(e)}"`)}),()=>{t=!0}},[e,N,I]),(0,P.useEffect)(()=>{ze(D)},[D]);let Ct=(0,P.useCallback)(()=>{rt(e=>e+1)},[]),q=(0,P.useCallback)(e=>{ht(!1),se(e)},[]),wt=(0,P.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);l(``),w(null),T(null),q(r)},[q]),Tt=(0,P.useCallback)(()=>{if(!D.split(`/`).some(e=>e.startsWith(`@`))){if(D===`.`||D===``)return;let e=D.split(`/`).filter(Boolean);e.pop(),se(e.length===0?`.`:e.join(`/`));return}M.length!==0&&se(M.length>=2?M.slice(0,M.length-1).map(e=>e.name).join(`/`):`.`)},[D,M]),Et=(0,P.useCallback)(e=>{pe(t,R(B(e)))},[R,t]),[J,Dt]=(0,P.useState)(!1),[Y,Ot]=(0,P.useState)(new Set),kt=(0,P.useRef)(null),X=(0,P.useRef)(!1),At=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,jt=(0,P.useCallback)(e=>{Dt(!0),Ot(new Set([e]))},[]),Z=(0,P.useCallback)(e=>{Dt(!1),Ot(new Set)},[]),Q=(0,P.useCallback)(e=>{Ot(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Mt=(0,P.useCallback)(e=>{X.current=!1,kt.current=setTimeout(()=>{X.current=!0,jt(e)},500)},[jt]),$=(0,P.useCallback)(()=>{kt.current&&=(clearTimeout(kt.current),null)},[]),Nt=(0,P.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}Et(e)},[J,Q,Et]),Pt=(0,P.useCallback)(e=>{A(e),typeof window<`u`&&window.localStorage.setItem(Me,e)},[]),Ft=(0,P.useCallback)(e=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}de({src:me(t,R(B(e))),alt:e.displayName??e.name})},[J,Q,R,t]),It=(0,P.useCallback)(()=>(O??[]).filter(e=>e.kind===`file`&&Y.has(e.name)),[O,Y]),Lt=(0,P.useCallback)(()=>{if(Y.size!==1)return null;let e=(O??[]).find(e=>Y.has(e.name));return e&&!e.entryPath?e:null},[O,Y]),Rt=(0,P.useCallback)(()=>(O??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&Y.has(e.name)),[O,Y]),zt=(0,P.useCallback)(()=>{let e=Rt(),n=e.some(e=>e.kind===`directory`);e.length===1&&!n?Et(e[0]):e.length>=1&&fe(t,e.map(e=>R(B(e)))),Z(`action`)},[Rt,Et,R,t,Z]),Bt=(0,P.useCallback)(async()=>{let t=It(),n=t.filter(e=>!e.protected),r=t.length-n.length;et(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=R(B(t));try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){et(e instanceof Error?e.message:String(e))}}rt(e=>e+1),Z(`action`)},[It,R,e,Z]),Vt=(0,P.useCallback)(async()=>{let e=It();if(At)try{let n=await Promise.all(e.map(async e=>{let n=R(B(e)),r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:n})&&await navigator.share({files:n})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[It,At,R,t]),Ht=(0,P.useCallback)(()=>{tt.current?.click()},[]),Ut=(0,P.useCallback)((e,n={})=>{let r=(r,i,a)=>{let o=new URLSearchParams({session_key:t,path:D===`.`?``:D,filename:e.name});n.relpath&&o.set(`relpath`,n.relpath),n.token&&o.set(`token`,n.token);for(let[e,t]of Object.entries(i))o.set(e,t);return new Promise(t=>{let n=new XMLHttpRequest;n.open(`POST`,`/api/admin/files/upload?${o.toString()}`),n.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),a&&(n.upload.onprogress=e=>{e.lengthComputable&&a(e.loaded)}),n.onload=()=>{let e={};try{e=JSON.parse(n.responseText)}catch{}t({status:n.status,data:e})},n.onerror=()=>t({status:0,data:{}}),n.onabort=()=>t({status:0,data:{error:`aborted`}}),n.send(r)})};if(e.size<=Ne)return r(e,{},t=>n.onProgress?.(t,e.size));let i=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,a=Math.ceil(e.size/Pe);return(async()=>{let t={status:0,data:{}};for(let o=0;o<a;o++){let s=o*Pe;if(t=await r(e.slice(s,Math.min(s+Pe,e.size)),{uploadId:i,seq:String(o),total:String(a)},t=>n.onProgress?.(s+t,e.size)),!(t.status>=200&&t.status<300))return t}return t})()},[t,D]),Wt=(0,P.useCallback)(async e=>{Ke(null),H(!0),W({loaded:0,total:e.size});try{let{status:t,data:n}=await Ut(e,{onProgress:(e,t)=>W({loaded:e,total:t})});t>=200&&t<300&&n.path?(se(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),rt(e=>e+1)):Ke(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{H(!1),W(null),tt.current&&(tt.current.value=``)}},[Ut]),Gt=(0,P.useCallback)(e=>{G&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Qe(!0))},[G]),Kt=(0,P.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Qe(!1)},[]),qt=(0,P.useCallback)(async e=>{e.preventDefault(),Qe(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(n.length===0)return;if(!G){Ke(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);H(!0),Ke(null),Xe(null);try{let e=await Ve(r),n=0,i=[];for(let r=0;r<e.length;r++){let{file:a,relpath:o}=e[r];W({loaded:0,total:a.size});let{status:s,data:c}=await Ut(a,{relpath:o,token:t,onProgress:(e,t)=>W({loaded:e,total:t})});if(s>=200&&s<300)n++;else{let e=s===0?`http=0`:He(s,c.error);i.push(`${o} (${e})`)}}Xe(`Uploaded ${n}, skipped ${i.length}${i.length?`: ${i.join(`, `)}`:``}`),rt(e=>e+1)}catch(e){Ke(e instanceof Error?e.message:String(e))}finally{H(!1),W(null)}},[G,Ut]),Jt=(0,P.useCallback)(async()=>{let t=ot.trim();if(t){pt(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:D===`.`?``:D,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);at(!1),st(``),rt(e=>e+1)}catch(e){pt(e instanceof Error?e.message:String(e))}}},[e,ot,D]),Yt=(0,P.useCallback)(async()=>{if(!ct)return;let t=ut.trim();if(!t)return;pt(null);let n=R(ct);try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);lt(null),dt(``),Z(`action`),rt(e=>e+1)}catch(e){pt(e instanceof Error?e.message:String(e))}},[e,ut,ct,R,Z]);(0,P.useEffect)(()=>{if(!mt)return;let e=e=>{gt.current&&!gt.current.contains(e.target)&&ht(!1)},t=e=>{e.key===`Escape`&&ht(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[mt]),(0,P.useEffect)(()=>{if(!_t)return;let e=e=>{vt.current&&!vt.current.contains(e.target)&&K(!1)},t=e=>{e.key===`Escape`&&K(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[_t]);let Xt=(0,P.useCallback)(e=>M.slice(0,e+1).map(e=>e.name).join(`/`),[M]),Zt=M.length>=2,Qt=Zt?[{name:`.`,label:`data`},...M.slice(0,M.length-2).map((e,t)=>({name:Xt(t),label:e.displayName??e.name}))]:[];return Ae?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`data-toolbar`,children:[J?(0,F.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Z(`cancel`),"aria-label":`Cancel selection`,children:[(0,F.jsx)(b,{size:14}),` Cancel`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`data-search-input`,children:[o===``&&(0,F.jsx)(ue,{size:14}),(0,F.jsx)(`input`,{ref:f,type:`text`,value:o,onChange:e=>l(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),x&&(0,F.jsx)(p,{size:14,className:`spin`}),o!==``&&(0,F.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{l(``),f.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,F.jsx)(b,{size:14})})]}),(0,F.jsxs)(`div`,{className:`data-toolbar-actions`,ref:vt,children:[(0,F.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>K(e=>!e),"aria-haspopup":`menu`,"aria-expanded":_t,"aria-label":`File actions`,title:`File actions`,children:(0,F.jsx)(he,{size:16})}),(0,F.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":_t?`true`:void 0,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Ct(),K(!1)},disabled:z,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[z?(0,F.jsx)(p,{size:16,className:`spin`}):(0,F.jsx)(i,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Ht(),K(!1)},disabled:V||!G,title:G?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[V?U&&U.total>0?(0,F.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(U.loaded/U.total*100),`%`]}):(0,F.jsx)(p,{size:16,className:`spin`}):(0,F.jsx)(be,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{at(e=>!e),st(``),pt(null),K(!1)},disabled:V||!G,title:G?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,F.jsx)(ge,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Pt(k===`grid`?`list`:`grid`),K(!1)},title:k===`grid`?`List view`:`Grid view`,"aria-label":k===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":k===`grid`,children:[k===`grid`?(0,F.jsx)(ve,{size:16}):(0,F.jsx)(_e,{size:16}),(0,F.jsx)(`span`,{className:`data-action-label`,children:k===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,F.jsxs)(`div`,{className:`data-breadcrumbs`,children:[D!==`.`&&(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:Tt,title:`Up one level`,"aria-label":`Up one level`,children:(0,F.jsx)(h,{size:14})}),Zt?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,ref:gt,children:[(0,F.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>ht(e=>!e),"aria-haspopup":`menu`,"aria-expanded":mt,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),mt&&(0,F.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Qt.map(e=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>q(e.name),title:e.label,children:e.label},e.name))})]}),[M.length-2,M.length-1].map(e=>{let t=M[e];return(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,F.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Xt(e)),title:t.name,children:t.displayName??t.name})]},Xt(e))})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(`.`),children:`data`}),M.map((e,t)=>(0,F.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,F.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,F.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>q(Xt(t)),title:e.name,children:e.displayName??e.name})]},Xt(t)))]})]}),it&&(0,F.jsxs)(`div`,{className:`data-inline-form`,children:[(0,F.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:ot,autoFocus:!0,onChange:e=>st(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Jt(),e.key===`Escape`&&at(!1)}}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Jt,children:`Create`}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>at(!1),children:`Cancel`})]}),ct&&(0,F.jsxs)(`div`,{className:`data-inline-form`,children:[(0,F.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:ut,autoFocus:!0,onChange:e=>dt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Yt(),e.key===`Escape`&&lt(null)}}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Yt,children:`Rename`}),(0,F.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>lt(null),children:`Cancel`})]}),ft&&(0,F.jsx)(`div`,{className:`data-error`,children:ft}),(0,F.jsx)(`input`,{type:`file`,ref:tt,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Wt(t)}})]}),(0,F.jsxs)(`div`,{className:`data-body`,"data-drag-active":Ze?`true`:void 0,onDragEnter:Gt,onDragOver:Gt,onDragLeave:Kt,onDrop:qt,children:[N===null&&I&&we&&we.length>0&&(0,F.jsxs)(`aside`,{className:`data-rail`,"aria-label":`Folders`,children:[(0,F.jsx)(`span`,{className:`data-rail-label`,children:`Folders`}),(0,F.jsx)(`ul`,{className:`data-rail-list`,children:we.map(e=>{let t=`${I}/${e}`,n=D===t||D.startsWith(`${t}/`);return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:`data-rail-item`,"aria-current":n?`true`:void 0,onClick:()=>q(t),children:[(0,F.jsx)(m,{size:13}),(0,F.jsx)(`span`,{className:`data-rail-item-name`,children:e})]})},e)})})]}),(0,F.jsxs)(`div`,{className:`data-content`,children:[(C!==null||v!==null)&&(0,F.jsxs)(`section`,{className:`data-panel admin-card`,children:[C&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,C]}),yt.length>0&&(0,F.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:yt.map(e=>{let t=e===bt;return(0,F.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>T(t?null:e),children:We([e])??e},e)})}),v&&!x&&(0,F.jsxs)(`div`,{className:`data-results-meta`,children:[xt.length,` of `,v.length,` result`,v.length===1?``:`s`]}),v&&!x&&!bt&&re>0&&!ae&&(0,F.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[re,` low-confidence result`,re===1?``:`s`,` hidden — show all`]}),v&&!x&&!bt&&ae&&(0,F.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),v&&v.length===0&&!x&&(0,F.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),xt&&xt.length>0&&(0,F.jsx)(`ul`,{className:`data-results`,children:xt.map(e=>(0,F.jsx)(Ue,{hit:e,mode:te,onDownload:St,onLocate:wt},e.nodeId))})]}),(0,F.jsxs)(`section`,{className:N===`home`?`data-panel data-panel--wide`:`data-panel data-panel--wide admin-card`,children:[U&&(0,F.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":U.total>0?Math.round(U.loaded/U.total*100):void 0,children:[(0,F.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,F.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${U.total>0?Math.round(U.loaded/U.total*100):0}%`}})}),(0,F.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,U.total>0?`${Math.round(U.loaded/U.total*100)}%`:``]})]}),Ge&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,Ge]}),qe&&(0,F.jsx)(`div`,{className:`data-status`,children:qe}),$e&&(0,F.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,$e]}),Le&&(0,F.jsx)(`div`,{className:`data-error`,children:Le}),z&&(0,F.jsxs)(`div`,{className:`data-loading`,children:[(0,F.jsx)(p,{size:14,className:`spin`}),` Loading…`]}),!z&&N!==`home`&&O&&O.length===0&&!Le&&(0,F.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!z&&N===`home`&&O&&(0,F.jsxs)(`ul`,{className:`routine-list data-home-list`,children:[O.map(e=>(0,F.jsxs)(`li`,{className:`data-home-card`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>q(R(e.name)),children:[(0,F.jsx)(`span`,{className:`data-home-card-title`,children:e.name}),(0,F.jsx)(`span`,{className:`data-home-card-count`,children:e.childCount===null||e.childCount===void 0?`—`:`${e.childCount} ${e.childCount===1?`item`:`items`}`})]}),(0,F.jsxs)(`ul`,{className:`data-home-card-children`,children:[e.childCount===null&&(0,F.jsx)(`li`,{className:`data-home-card-error`,children:`Could not read this folder.`}),e.childCount===0&&(0,F.jsx)(`li`,{className:`data-home-card-empty`,children:`Empty.`}),(e.children??[]).map(e=>(0,F.jsxs)(`li`,{className:`data-home-card-child`,children:[e.kind===`directory`?(0,F.jsx)(m,{size:12}):(0,F.jsx)(le,{size:12}),(0,F.jsx)(`span`,{className:`data-home-card-child-name`,children:e.name})]},e.name)),typeof e.childCount==`number`&&e.childCount>(e.children?.length??0)&&(0,F.jsxs)(`li`,{className:`data-home-card-more`,children:[`+`,e.childCount-(e.children?.length??0),` more`]})]})]},e.name)),(0,F.jsxs)(`li`,{className:`data-home-card`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>q(R(`@system`)),children:[(0,F.jsx)(`span`,{className:`data-home-card-title`,children:`system`}),(0,F.jsxs)(`span`,{className:`data-home-card-count`,children:[Se,` `,Se===1?`item`:`items`]})]}),(0,F.jsx)(`ul`,{className:`data-home-card-children`,children:(0,F.jsx)(`li`,{className:`data-home-card-empty`,children:`Platform and plugin folders.`})})]})]}),!z&&N!==`home`&&O&&O.length>0&&k===`grid`&&(0,F.jsx)(`ul`,{className:`data-grid`,children:O.map(e=>{let n=e.displayName??e.name,r=J&&Y.has(e.name);if(e.kind===`directory`)return(0,F.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(R(e.name))},children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsx)(m,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n})]})},e.name);if(e.kind===`file`){let i=je(B(e)),a=R(B(e));return(0,F.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?Ft(e):Nt(e),title:J?void 0:i?`Preview ${n}`:`Download ${n}`,children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,F.jsx)(`img`,{className:`data-grid-thumb`,src:me(t,a),alt:n,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,F.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n}),!i&&(0,F.jsx)(`span`,{className:`data-grid-sub`,children:Je(e.sizeBytes)})]})},e.name)}return(0,F.jsx)(`li`,{className:`data-grid-cell`,children:(0,F.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,F.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,F.jsx)(`span`,{className:`data-grid-label`,children:n}),(0,F.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!z&&N!==`home`&&O&&O.length>0&&k===`list`&&(0,F.jsx)(`ul`,{className:`data-entries`,children:O.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=J&&Y.has(e.name);return(0,F.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(X.current){X.current=!1;return}if(J){Q(e.name);return}q(R(e.name))},children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsx)(m,{size:14}),(0,F.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=J&&Y.has(e.name);return(0,F.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,F.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>Nt(e),title:J?void 0:`Download ${t}`,children:[J&&(0,F.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,F.jsxs)(`span`,{className:`data-entry-text`,children:[(0,F.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,F.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Ye(e.modifiedAt,r)}`,children:[Je(e.sizeBytes),` · `,Ye(e.modifiedAt,r)]})]})]})},e.name)}return(0,F.jsx)(`li`,{className:`data-entry`,children:(0,F.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,F.jsxs)(`span`,{className:`data-entry-text`,children:[(0,F.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,F.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]})]}),J&&(0,F.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,F.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Vt,disabled:!At||Y.size===0,title:At?`Share selected files`:`Sharing is not supported on this device`,children:[(0,F.jsx)(d,{size:16}),` Share`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:zt,disabled:Y.size===0,children:[(0,F.jsx)(a,{size:16}),` Download`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=Lt();e&&(lt(e.name),dt(e.name))},disabled:!Lt(),children:[(0,F.jsx)(s,{size:16}),` Rename`]}),(0,F.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Bt,disabled:Y.size===0,children:[(0,F.jsx)(c,{size:16}),` Delete`]})]})}),j&&(0,F.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":j.alt,onClick:()=>de(null),children:(0,F.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:j.src,alt:j.alt})})]}):(0,F.jsx)(u,{surface:`gate`})}function U({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let r=(0,P.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),i=(0,P.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[a,o]=(0,P.useState)([]),[s,c]=(0,P.useState)(`files`),{subAccounts:l,activeAccountId:u,switching:d,switchAccount:p}=C(t);return(0,P.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/operator-conversations/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||o(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,F.jsxs)(`main`,{className:`data-main`,children:[(0,F.jsx)(f,{variant:`operator`,onNavigate:i,onOpenConversations:a.length>0?()=>c(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:l,activeAccountId:u,switchingAccount:d,onSwitchAccount:p}),s===`conversations`?(0,F.jsx)(ke,{conversations:a,sessionKey:t,onBack:()=>c(`files`)}):(0,F.jsx)(H,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function W({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=y({initialCacheKey:e,surface:`data`});return(0,F.jsx)(`div`,{className:`data-page`,children:(0,F.jsx)(`main`,{className:`data-main`,children:(0,F.jsx)(H,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function Ue({hit:e,mode:t,onDownload:n,onLocate:r}){let{zone:i}=E(),a=Ge(e.properties),o=Ke(e.properties),s=We(e.labels),c=qe(e.properties),[l,u]=(0,P.useState)(!1),d=o&&o.length>280,f=l||!d?o:o?.slice(0,280)+`…`,p=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,h=e.properties.relativePath,g=typeof h==`string`&&h.length>0,_=g?h.lastIndexOf(`/`):-1,v=g?_===-1?`data`:h.slice(0,_):null;return(0,F.jsxs)(`li`,{className:`data-result`,children:[(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${a??s??`file`}`,children:[s&&(0,F.jsx)(`div`,{className:`data-result-header`,children:(0,F.jsx)(`span`,{className:`data-result-labels`,children:s})}),a&&(0,F.jsx)(`div`,{className:`data-result-title`,children:a}),o&&(0,F.jsx)(`pre`,{className:`data-result-body`,children:f}),(0,F.jsxs)(`div`,{className:`data-result-scores`,children:[c&&(0,F.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Ye(c,i),` · `]}),p]})]}),g&&(0,F.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${v}`,"aria-label":`Locate in ${v}`,children:[(0,F.jsx)(m,{size:12}),v]}),d&&(0,F.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>u(e=>!e),children:l?`Show less`:`Show more`})]})}function We(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ge(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function Ke(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function qe(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Je(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function Ye(e,t){return _(e,t)||`—`}export{L as i,W as n,R as r,Ie as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DA-Gezeo.js","assets/preload-helper-eAV8hweq.js","assets/dist-DjYA4E4S.js","assets/chunk-BycB0eMI.js","assets/chunk-U2HBQHQK-DcqGPXEy.js","assets/src-BvINb2fL.js","assets/chunk-5PVQY5BW-C0bRnMKQ.js","assets/chunk-ICPOFSXX-BP8A8zb1.js","assets/_baseFor-BApe6Tla.js","assets/isEmpty-DY_Xp9Na.js","assets/chunk-336JU56O-ChGDYu_S.js","assets/chunk-5FUZZQ4R-B3s1YuQa.js","assets/chunk-X2U36JSP-DtRi7n5Z.js","assets/chunk-ZZ45TVLE-teET41Yh.js","assets/rough.esm-ec8xsRC7.js","assets/chunk-ENJZ2VHE-BdPfdZYB.js","assets/line-K8229GLG.js","assets/path-DY2qBuPM.js","assets/array-eiH4WfvY.js","assets/chunk-BSJP7CBP-0xBlnKJN.js","assets/chunk-426QAEUC-DLLi1nAr.js","assets/chunk-XPW4576I-DmuDCcY3.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-B2Q1UOSJ.js";import{$ as a,A as o,I as s,L as c,M as l,N as u,O as d,V as f,Z as p,_ as m,a as h,j as g,k as _,nt as v,q as y,v as b,y as x}from"./useMediaQuery-D7A5Bzs3.js";import{A as S,C,D as w,E as T,O as E,T as D,_ as O,a as k,b as ee,c as te,d as A,f as j,g as ne,h as re,i as M,k as ie,l as ae,m as oe,n as se,o as ce,r as le,s as N,t as ue,u as de,v as fe,w as pe,x as me,y as he}from"./useVoiceRecorder-CptrerVA.js";import{A as ge,D as _e,E as ve,O as ye,S as be,T as P,b as xe,c as Se,d as F,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke,w as Ae,y as je}from"./AdminShell-D8WTrqem.js";import{t as Me}from"./chevron-left-DB98DSG3.js";import{t as Ne}from"./copy-DyG7sC5o.js";import{t as Pe}from"./file-text-CpHWsMGe.js";import{t as Fe}from"./play-CHQ5a9yh.js";import{t as Ie}from"./rotate-ccw-xTwkf-m7.js";import{t as Le}from"./wrench-DyX4C8aY.js";import{t as Re}from"./preload-helper-eAV8hweq.js";import{t as ze}from"./useCopyFeedback-6rU2IEPk.js";var Be=p(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ve=p(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),He=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ue=p(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),We=p(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ge=p(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ke=p(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function qe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
2
+ import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-UK6hgBWO.js";import{$ as a,A as o,I as s,L as c,M as l,N as u,O as d,V as f,Z as p,_ as m,a as h,j as g,k as _,nt as v,q as y,v as b,y as x}from"./useMediaQuery-CqwktQr_.js";import{A as S,C,D as w,E as T,O as E,T as D,_ as O,a as k,b as ee,c as te,d as A,f as j,g as ne,h as re,i as M,k as ie,l as ae,m as oe,n as se,o as ce,r as le,s as N,t as ue,u as de,v as fe,w as pe,x as me,y as he}from"./useVoiceRecorder-CAZcUc1s.js";import{A as ge,D as _e,E as ve,O as ye,S as be,T as P,b as xe,c as Se,d as F,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke,w as Ae,y as je}from"./AdminShell-B-iX9ahJ.js";import{t as Me}from"./chevron-left-C5FXH9r_.js";import{t as Ne}from"./copy-BNhZ0flH.js";import{t as Pe}from"./file-text-BddO_2EI.js";import{t as Fe}from"./play-BSZVGpQT.js";import{t as Ie}from"./rotate-ccw-DTOJmOxB.js";import{t as Le}from"./wrench-B2WKLLQG.js";import{t as Re}from"./preload-helper-eAV8hweq.js";import{t as ze}from"./useCopyFeedback-BG7h37Rx.js";var Be=p(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ve=p(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),He=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ue=p(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),We=p(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ge=p(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ke=p(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function qe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
3
3
  `,r-1)+1,a=e.indexOf(`
4
4
  `,r),o=a===-1?e.length:a;if(r!==o)return null;let s=e.slice(i,o),c=s.match(/^(\s*)(\d+)\.[ \t]*$/);if(c){let t=c[1];return{value:e.slice(0,i)+t+e.slice(o),caret:i+t.length}}let l=s.match(/^(\s*)(\d+)\.[ \t]/);if(l){let t=`\n${l[1]}${parseInt(l[2],10)+1}. `;return{value:e.slice(0,r)+t+e.slice(r),caret:r+t.length}}return null}function Je(e,t){let n=[];for(let r of e){if(r.kind!==`file`)continue;let e=r.getAsFile();if(e)if(e.name===``||e.name===`image.png`){let r=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([e],`pasted-image-${t}.${r}`,{type:e.type}))}else n.push(e)}return n}function Ye(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Xe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ze=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qe={};function $e(e,t){return((t||Qe).jsx?Ze:Xe).test(e)}var et=/[ \t\n\f\r]/g;function tt(e){return typeof e==`object`?e.type===`text`?nt(e.value):!1:nt(e)}function nt(e){return e.replace(et,``)===``}var I=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};I.prototype.normal={},I.prototype.property={},I.prototype.space=void 0;function rt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new I(n,r,t)}function it(e){return e.toLowerCase()}var L=class{constructor(e,t){this.attribute=t,this.property=e}};L.prototype.attribute=``,L.prototype.booleanish=!1,L.prototype.boolean=!1,L.prototype.commaOrSpaceSeparated=!1,L.prototype.commaSeparated=!1,L.prototype.defined=!1,L.prototype.mustUseProperty=!1,L.prototype.number=!1,L.prototype.overloadedBoolean=!1,L.prototype.property=``,L.prototype.spaceSeparated=!1,L.prototype.space=void 0;var at=t({boolean:()=>R,booleanish:()=>z,commaOrSpaceSeparated:()=>H,commaSeparated:()=>ct,number:()=>B,overloadedBoolean:()=>st,spaceSeparated:()=>V}),ot=0,R=U(),z=U(),st=U(),B=U(),V=U(),ct=U(),H=U();function U(){return 2**++ot}var lt=Object.keys(at),ut=class extends L{constructor(e,t,n,r){let i=-1;if(super(e,t),dt(this,`space`,r),typeof n==`number`)for(;++i<lt.length;){let e=lt[i];dt(this,lt[i],(n&at[e])===at[e])}}};ut.prototype.defined=!0;function dt(e,t,n){n&&(e[t]=n)}function ft(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ut(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[it(r)]=r,n[it(a.attribute)]=r}return new I(t,n,e.space)}var pt=ft({properties:{ariaActiveDescendant:null,ariaAtomic:z,ariaAutoComplete:null,ariaBusy:z,ariaChecked:z,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:z,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:z,ariaFlowTo:V,ariaGrabbed:z,ariaHasPopup:null,ariaHidden:z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:z,ariaMultiLine:z,ariaMultiSelectable:z,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:z,ariaReadOnly:z,ariaRelevant:null,ariaRequired:z,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:z,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function mt(e,t){return t in e?e[t]:t}function ht(e,t){return mt(e,t.toLowerCase())}var gt=ft({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ct,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:R,allowPaymentRequest:R,allowUserMedia:R,alt:null,as:null,async:R,autoCapitalize:null,autoComplete:V,autoFocus:R,autoPlay:R,blocking:V,capture:null,charSet:null,checked:R,cite:null,className:V,cols:B,colSpan:null,content:null,contentEditable:z,controls:R,controlsList:V,coords:B|ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R,defer:R,dir:null,dirName:null,disabled:R,download:st,draggable:z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R,formTarget:null,headers:V,height:B,hidden:st,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:R,inputMode:null,integrity:null,is:null,isMap:R,itemId:null,itemProp:V,itemRef:V,itemScope:R,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:R,muted:R,name:null,nonce:null,noModule:R,noValidate:R,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:R,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:R,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R,referrerPolicy:null,rel:V,required:R,reversed:R,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:R,seamless:R,selected:R,shadowRootClonable:R,shadowRootDelegatesFocus:R,shadowRootMode:null,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:R,useMap:null,value:z,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R,declare:R,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:R,noHref:R,noShade:R,noWrap:R,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:z,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:R,disableRemotePlayback:R,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:ht}),_t=ft({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:H,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:R,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ct,g2:ct,glyphName:ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:H,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H,rev:H,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H,requiredFeatures:H,requiredFonts:H,requiredFormats:H,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:H,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:mt}),vt=ft({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),yt=ft({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ht}),bt=ft({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),xt={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},St=/[A-Z]/g,Ct=/-[a-z]/g,wt=/^data[-\w.:]+$/i;function Tt(e,t){let n=it(t),r=t,i=L;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&wt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ct,Dt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ct.test(e)){let n=e.replace(St,Et);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ut}return new i(r,t)}function Et(e){return`-`+e.toLowerCase()}function Dt(e){return e.charAt(1).toUpperCase()}var Ot=rt([pt,gt,vt,yt,bt],`html`),kt=rt([pt,_t,vt,yt,bt],`svg`);function At(e){return e.join(` `).trim()}var jt=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
5
5
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Mt=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(jt());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Nt=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),W=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Mt()),r=Nt();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Pt=It(`end`),Ft=It(`start`);function It(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Lt(e){let t=Ft(e),n=Pt(e);if(t&&n)return{start:t,end:n}}function Rt(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Bt(e.position):`start`in e||`end`in e?Bt(e):`line`in e||`column`in e?zt(e):``}function zt(e){return Vt(e&&e.line)+`:`+Vt(e&&e.column)}function Bt(e){return zt(e&&e.start)+`-`+zt(e&&e.end)}function Vt(e){return e&&typeof e==`number`?e:1}var G=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Rt(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};G.prototype.file=``,G.prototype.name=``,G.prototype.reason=``,G.prototype.message=``,G.prototype.stack=``,G.prototype.column=void 0,G.prototype.line=void 0,G.prototype.ancestors=void 0,G.prototype.cause=void 0,G.prototype.fatal=void 0,G.prototype.place=void 0,G.prototype.ruleId=void 0,G.prototype.source=void 0;var Ht=e(W(),1),Ut={}.hasOwnProperty,Wt=new Map,Gt=/[A-Z]/g,Kt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),qt=new Set([`td`,`th`]),Jt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Yt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=sn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=on(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?kt:Ot,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Xt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Xt(e,t,n){if(t.type===`element`)return Zt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Qt(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return en(e,t,n);if(t.type===`mdxjsEsm`)return $t(e,t);if(t.type===`root`)return tn(e,t,n);if(t.type===`text`)return nn(e,t)}function Zt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=kt,e.schema=i),e.ancestors.push(t);let a=pn(e,t.tagName,!1),o=cn(e,t),s=un(e,t);return Kt.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!tt(e):!0})),rn(e,o,a,t),an(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Qt(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}mn(e,t.position)}function $t(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mn(e,t.position)}function en(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=kt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:pn(e,t.name,!0),o=ln(e,t),s=un(e,t);return rn(e,o,a,t),an(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function tn(e,t,n){let r={};return an(r,un(e,t)),e.create(t,e.Fragment,r,n)}function nn(e,t){return t.value}function rn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function an(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function on(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function sn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ft(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function cn(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ut.call(t.properties,i)){let a=dn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&qt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ln(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else mn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else mn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function un(e,t){let n=[],r=-1,i=e.passKeys?new Map:Wt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Xt(e,a,o);s!==void 0&&n.push(s)}return n}function dn(e,t,n){let r=Tt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ye(n):At(n)),r.property===`style`){let t=typeof n==`object`?n:fn(e,String(n));return e.stylePropertyNameCase===`css`&&(t=hn(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?xt[r.property]||r.property:r.attribute,n]}}function fn(e,t){try{return(0,Ht.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new G("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Jt+`#cannot-parse-style-attribute`,r}}function pn(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=$e(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=$e(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ut.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);mn(e)}function mn(e,t){let n=new G("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Jt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function hn(e){let t={},n;for(n in e)Ut.call(e,n)&&(t[gn(n)]=e[n]);return t}function gn(e){let t=e.replace(Gt,_n);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function _n(e){return`-`+e.toLowerCase()}var vn={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},yn={};function bn(e,t){let n=t||yn;return xn(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function xn(e,t,n){if(Cn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Sn(e.children,t,n)}return Array.isArray(e)?Sn(e,t,n):``}function Sn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=xn(e[i],t,n);return r.join(``)}function Cn(e){return!!(e&&typeof e==`object`)}var wn=document.createElement(`i`);function Tn(e){let t=`&`+e+`;`;wn.innerHTML=t;let n=wn.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function En(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Dn(e,t){return e.length>0?(En(e,e.length,0,t),e):t}var On={}.hasOwnProperty;function kn(e){let t={},n=-1;for(;++n<e.length;)An(t,e[n]);return t}function An(e,t){let n;for(n in t){let r=(On.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){On.call(r,a)||(r[a]=[]);let e=i[a];jn(r[a],Array.isArray(e)?e:e?[e]:[])}}}function jn(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);En(e,0,0,r)}function Mn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Nn(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var K=Vn(/[A-Za-z]/),q=Vn(/[\dA-Za-z]/),Pn=Vn(/[#-'*+\--9=?A-Z^-~]/);function Fn(e){return e!==null&&(e<32||e===127)}var In=Vn(/\d/),Ln=Vn(/[\dA-Fa-f]/),Rn=Vn(/[!-/:-@[-`{-~]/);function J(e){return e!==null&&e<-2}function Y(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}var zn=Vn(/\p{P}|\p{S}/u),Bn=Vn(/\s/);function Vn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Hn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&q(e.charCodeAt(n+1))&&q(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Z(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return X(r)?(e.enter(n),s(r)):t(r)}function s(r){return X(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Un={tokenize:Wn};function Wn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Z(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return J(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Gn={tokenize:qn},Kn={tokenize:Jn};function qn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return En(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Kn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Kn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return J(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;En(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jn(e,t,n){return Z(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Yn(e){if(e===null||Y(e)||Bn(e))return 1;if(zn(e))return 2}function Xn(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Zn={name:`attention`,resolveAll:Qn,tokenize:$n};function Qn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};er(d,-c),er(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Dn(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Dn(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Dn(l,Xn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Dn(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Dn(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,En(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function $n(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Yn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Yn(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function er(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var tr={name:`autolink`,tokenize:nr};function nr(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return K(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||q(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||q(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Fn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Pn(t)?(e.consume(t),l):n(t)}function u(e){return q(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||q(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var rr={partial:!0,tokenize:ir};function ir(e,t,n){return r;function r(t){return X(t)?Z(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||J(e)?t(e):n(e)}}var ar={continuation:{tokenize:sr},exit:cr,name:`blockQuote`,tokenize:or};function or(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return X(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function sr(e,t,n){let r=this;return i;function i(t){return X(t)?Z(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ar,t,n)(r)}}function cr(e){e.exit(`blockQuote`)}var lr={name:`characterEscape`,tokenize:ur};function ur(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Rn(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var dr={name:`characterReference`,tokenize:fr};function fr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=q,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ln,u):(e.enter(`characterReferenceValue`),a=7,o=In,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===q&&!Tn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var pr={partial:!0,tokenize:gr},mr={concrete:!0,name:`codeFenced`,tokenize:hr};function hr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),X(t)?Z(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||J(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(pr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Z(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||J(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&X(t)?Z(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||J(t)?e.check(pr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||J(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),X(t)?Z(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),X(t)?Z(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||J(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function gr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var _r={name:`codeIndented`,tokenize:yr},vr={partial:!0,tokenize:br};function yr(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Z(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):J(t)?e.attempt(vr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||J(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function br(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Z(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):J(e)?i(e):n(e)}}var xr={name:`codeText`,previous:Cr,resolve:Sr,tokenize:wr};function Sr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Cr(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function wr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||J(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Tr=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Er(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Er(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Er(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Er(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Er(this.left,t.reverse())}}};function Er(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Dr(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Tr(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Or(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return En(e,0,1/0,u.slice(0)),!l}function Or(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var kr={resolve:jr,tokenize:Mr},Ar={partial:!0,tokenize:Nr};function jr(e){return Dr(e),e}function Mr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):J(t)?e.check(Ar,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Nr(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,a,`linePrefix`)}function a(i){if(i===null||J(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Pr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Fn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||J(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Y(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Fn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Fr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):J(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||J(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!X(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Ir(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Z(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||J(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Lr(e,t){let n;return r;function r(i){return J(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):X(i)?Z(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Rr={name:`definition`,tokenize:Br},zr={partial:!0,tokenize:Vr};function Br(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Fr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Y(t)?Lr(e,l)(t):l(t)}function l(t){return Pr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(zr,d,d)(t)}function d(t){return X(t)?Z(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||J(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Vr(e,t,n){return r;function r(t){return Y(t)?Lr(e,i)(t):n(t)}function i(t){return Ir(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return X(t)?Z(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||J(e)?t(e):n(e)}}var Hr={name:`hardBreakEscape`,tokenize:Ur};function Ur(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return J(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Wr={name:`headingAtx`,resolve:Gr,tokenize:Kr};function Gr(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},En(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Kr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Y(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||J(n)?(e.exit(`atxHeading`),t(n)):X(n)?Z(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Y(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var qr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Jr=[`pre`,`script`,`style`,`textarea`],Yr={concrete:!0,name:`htmlFlow`,resolveTo:Qr,tokenize:$r},Xr={partial:!0,tokenize:ti},Zr={partial:!0,tokenize:ei};function Qr(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function $r(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:M):K(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):K(a)?(e.consume(a),i=4,r.interrupt?t:M):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:M):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return K(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Y(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Jr.includes(l)?(i=1,r.interrupt?t(s):O(s)):qr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||q(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return X(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||K(t)?(e.consume(t),b):X(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||q(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):X(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):X(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||J(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Y(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||X(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||J(t)?O(t):X(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),M):t===93&&i===5?(e.consume(t),re):J(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Xr,ae,k)(t)):t===null||J(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Zr,ee,ae)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||J(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),M):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return Jr.includes(n)?(e.consume(t),ie):O(t)}return K(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function re(t){return t===93?(e.consume(t),M):O(t)}function M(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),M):O(t)}function ie(t){return t===null||J(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function ei(e,t,n){let r=this;return i;function i(t){return J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ti(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(rr,t,n)}}var ni={name:`htmlText`,tokenize:ri};function ri(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):K(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):K(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):J(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):J(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):J(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):J(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return K(t)?(e.consume(t),S):n(t)}function S(t){return t===45||q(t)?(e.consume(t),S):C(t)}function C(t){return J(t)?(o=C,j(t)):X(t)?(e.consume(t),C):A(t)}function w(t){return t===45||q(t)?(e.consume(t),w):t===47||t===62||Y(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||K(t)?(e.consume(t),E):J(t)?(o=T,j(t)):X(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||q(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):J(t)?(o=D,j(t)):X(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):J(t)?(o=O,j(t)):X(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):J(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Y(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||Y(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return X(t)?Z(e,re,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):re(t)}function re(t){return e.enter(`htmlTextData`),o(t)}}var ii={name:`labelEnd`,resolveAll:ci,resolveTo:li,tokenize:ui},ai={tokenize:di},oi={tokenize:fi},si={tokenize:pi};function ci(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&En(e,0,e.length,n),e}function li(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Dn(s,e.slice(a+1,a+r+3)),s=Dn(s,[[`enter`,u,t]]),s=Dn(s,Xn(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Dn(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Dn(s,e.slice(o+1)),s=Dn(s,[[`exit`,c,t]]),En(e,a,e.length,s),e}function ui(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Nn(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ai,u,o?u:d)(t):t===91?e.attempt(oi,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(si,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function di(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Y(t)?Lr(e,a)(t):a(t)}function a(t){return t===41?u(t):Pr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Y(t)?Lr(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Ir(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Y(t)?Lr(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function fi(e,t,n){let r=this;return i;function i(t){return Fr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function pi(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var mi={name:`labelStartImage`,resolveAll:ii.resolveAll,tokenize:hi};function hi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var gi={name:`labelStartLink`,resolveAll:ii.resolveAll,tokenize:_i};function _i(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var vi={name:`lineEnding`,tokenize:yi};function yi(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Z(e,t,`linePrefix`)}}var bi={name:`thematicBreak`,tokenize:xi};function xi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||J(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),X(t)?Z(e,s,`whitespace`)(t):s(t))}}var Si={continuation:{tokenize:Ei},exit:Oi,name:`list`,tokenize:Ti},Ci={partial:!0,tokenize:ki},wi={partial:!0,tokenize:Di};function Ti(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:In(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(bi,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return In(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(rr,r.interrupt?n:u,e.attempt(Ci,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return X(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Ei(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(rr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Z(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!X(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(wi,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Z(e,e.attempt(Si,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Di(e,t,n){let r=this;return Z(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Oi(e){e.exit(this.containerState.type)}function ki(e,t,n){let r=this;return Z(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!X(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ai={name:`setextUnderline`,resolveTo:ji,tokenize:Mi};function ji(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Mi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),X(t)?Z(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||J(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ni={tokenize:Pi};function Pi(e){let t=this,n=e.attempt(rr,r,e.attempt(this.parser.constructs.flowInitial,i,Z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(kr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Fi={resolveAll:zi()},Ii=Ri(`string`),Li=Ri(`text`);function Ri(e){return{resolveAll:zi(e===`text`?Bi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function zi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Bi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Vi=t({attentionMarkers:()=>Yi,contentInitial:()=>Ui,disable:()=>Xi,document:()=>Hi,flow:()=>Gi,flowInitial:()=>Wi,insideSpan:()=>Ji,string:()=>Ki,text:()=>qi}),Hi={42:Si,43:Si,45:Si,48:Si,49:Si,50:Si,51:Si,52:Si,53:Si,54:Si,55:Si,56:Si,57:Si,62:ar},Ui={91:Rr},Wi={[-2]:_r,[-1]:_r,32:_r},Gi={35:Wr,42:bi,45:[Ai,bi],60:Yr,61:Ai,95:bi,96:mr,126:mr},Ki={38:dr,92:lr},qi={[-5]:vi,[-4]:vi,[-3]:vi,33:mi,38:dr,42:Zn,60:[tr,ni],91:gi,92:[Hr,lr],93:ii,95:Zn,96:xr},Ji={null:[Zn,Fi]},Yi={null:[42,95]},Xi={null:[]};function Zi(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Dn(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Xn(a,l.events,l),l.events):[]}function f(e,t){return $i(p(e),t)}function p(e){return Qi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){J(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&En(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Qi(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function $i(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
@@ -0,0 +1 @@
1
+ import{Z as e}from"./useMediaQuery-CqwktQr_.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-B2Q1UOSJ.js";import"./useMediaQuery-D7A5Bzs3.js";import"./useVoiceRecorder-CptrerVA.js";import{O as i}from"./AdminShell-D8WTrqem.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-zCwgrs8m.js";import"./useCopyFeedback-6rU2IEPk.js";var d=n(),f=e(t(),1),p=r();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&sessionStorage.setItem(s,e)}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-UK6hgBWO.js";import"./useMediaQuery-CqwktQr_.js";import"./useVoiceRecorder-CAZcUc1s.js";import{O as i}from"./AdminShell-B-iX9ahJ.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-Y9JmFq0Q.js";import"./useCopyFeedback-BG7h37Rx.js";var d=n(),f=e(t(),1),p=r();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&sessionStorage.setItem(s,e)}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
@@ -1 +1 @@
1
- import{Z as e}from"./useMediaQuery-D7A5Bzs3.js";var t=e(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);export{t};
1
+ import{Z as e}from"./useMediaQuery-CqwktQr_.js";var t=e(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);export{t};