openwork-server 0.18.56 → 0.18.58

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 (299) hide show
  1. package/README.md +2 -2
  2. package/dist/opencode-plugin-deps-1.18.30.tgz +0 -0
  3. package/dist/opencode-plugins/opencode-stop-fence-client.js +6 -0
  4. package/dist/opencode-plugins/openwork-capabilities-knowledge.js +0 -5
  5. package/dist/opencode-plugins/openwork-cloud-skills-v2.js +114 -0
  6. package/dist/opencode-plugins/openwork-codemode-discovery-v2.js +60 -0
  7. package/dist/opencode-plugins/openwork-context-v2.js +13777 -1
  8. package/dist/opencode-plugins/openwork-extensions-preview-steering.js +1 -1
  9. package/dist/opencode-plugins/openwork-extensions-preview.js +97 -8
  10. package/dist/opencode-plugins/openwork-mcp-readiness-v2.js +192 -0
  11. package/dist/opencode-plugins/openwork-mcp-results-v2.js +10836 -13
  12. package/dist/opencode-plugins/openwork-provider-filters-v2.js +5 -7
  13. package/dist/openwork-server.mjs +3278 -3450
  14. package/package.json +1 -1
  15. package/web/assets/abnfDiagram-VCTEODGH-NpzjfSVw.js +1 -0
  16. package/web/assets/app-DAPWjSQy.js +2619 -0
  17. package/web/assets/app-Dt3ByUuG.css +32 -0
  18. package/web/assets/{arc-7SoIBvT7.js → arc-CHKYZ_eM.js} +1 -1
  19. package/web/assets/architectureDiagram-5GKGNRK7-CbtqO0tI.js +36 -0
  20. package/web/assets/{artifact-code-view-WLwX_I1h.js → artifact-code-view-BQF6eKZY.js} +2 -2
  21. package/web/assets/artifact-spreadsheet-editor-CQJKFbub.js +11 -0
  22. package/web/assets/{artifact-text-editor-BHyVrNyR.js → artifact-text-editor-B6E8-x3q.js} +2 -2
  23. package/web/assets/{blockDiagram-OSKFZWR5-Cvqr9DPi.js → blockDiagram-OSKFZWR5-Ceoouvgp.js} +3 -3
  24. package/web/assets/{c4Diagram-7LVT6UL2-CWTWC9C1.js → c4Diagram-7LVT6UL2-DeZ6n4qW.js} +2 -2
  25. package/web/assets/channel-BA95BnJ8.js +1 -0
  26. package/web/assets/{chunk-2Q5K7J3B-DpJkzZ5x.js → chunk-2Q5K7J3B-CpycWP6o.js} +1 -1
  27. package/web/assets/{chunk-5VM5RSS4-BtTBnr9m.js → chunk-5VM5RSS4-DhEpcp77.js} +1 -1
  28. package/web/assets/{chunk-F27PBJKO-BbAvFJAg.js → chunk-F27PBJKO-D0H-x4y2.js} +1 -1
  29. package/web/assets/{chunk-HLEWEB6X-DX5mKBrj.js → chunk-HLEWEB6X-CApTHm_u.js} +1 -1
  30. package/web/assets/{chunk-JWPE2WC7-CugB1e5O.js → chunk-JWPE2WC7-BHCjUPpx.js} +1 -1
  31. package/web/assets/{chunk-POPQ4Y6H-BQ-bWmmo.js → chunk-POPQ4Y6H-CQhggViX.js} +1 -1
  32. package/web/assets/{chunk-SVP7TREG-szCI_Kz9.js → chunk-SVP7TREG-CpeIJurV.js} +1 -1
  33. package/web/assets/{chunk-XXDRQBXY-C5UTO899.js → chunk-XXDRQBXY-CLRkKkAV.js} +1 -1
  34. package/web/assets/{chunk-ZLD2IHE6-D5v_jiDg.js → chunk-ZLD2IHE6-BdYnQ042.js} +1 -1
  35. package/web/assets/classDiagram-CYGNFDIV-DEYczDTV.js +1 -0
  36. package/web/assets/classDiagram-v2-TLXNO2FR-DEYczDTV.js +1 -0
  37. package/web/assets/cose-bilkent-JH36ORCC-DmF8vX7k.js +1 -0
  38. package/web/assets/{cynefin-OW5HDTMX-DSTjm6jO.js → cynefin-OW5HDTMX-NLetkEsX.js} +1 -1
  39. package/web/assets/cynefinDiagram-5FMLGOSQ-DKP1VgT5.js +62 -0
  40. package/web/assets/{dagre-OS7QT2EB-BZMseQyA.js → dagre-OS7QT2EB-CRAAAd8s.js} +2 -2
  41. package/web/assets/{diagram-S7CK7UJ4-Cs2hsmEJ.js → diagram-S7CK7UJ4-DpAtNlvk.js} +2 -2
  42. package/web/assets/diagram-UQ7AKVKN-D3OPArp4.js +41 -0
  43. package/web/assets/{diagram-VSXAHHWV-DxKXQXAC.js → diagram-VSXAHHWV-Ce3MQsSX.js} +2 -2
  44. package/web/assets/diagram-VX7I27RA-DMNK9KDH.js +24 -0
  45. package/web/assets/diagram-Z3DM3KII-CCUXCTwV.js +24 -0
  46. package/web/assets/ebnfDiagram-PWID7BFC-Ch1ZBqfh.js +1 -0
  47. package/web/assets/{erDiagram-2YWLMYGG-B0Mdv5WO.js → erDiagram-2YWLMYGG-DfRCB-xW.js} +2 -2
  48. package/web/assets/{flowDiagram-T62WH6J4-CUnt9AMo.js → flowDiagram-T62WH6J4-Ch9kGwk1.js} +1 -1
  49. package/web/assets/ganttDiagram-EL5Y4UJY-BzB0WGSq.js +292 -0
  50. package/web/assets/gitGraphDiagram-WWUBYQGX-Brbs3apz.js +106 -0
  51. package/web/assets/infoDiagram-FKFFQAWI-Ca71MEwH.js +2 -0
  52. package/web/assets/{ishikawaDiagram-5VMMS53U-jNVSJSu1.js → ishikawaDiagram-5VMMS53U-D0wX8tOf.js} +2 -2
  53. package/web/assets/{journeyDiagram-EYS64GPL-De3j0gPh.js → journeyDiagram-EYS64GPL-PeZPacru.js} +2 -2
  54. package/web/assets/{kanban-definition-UXKFOSKX-Bbc8wjhq.js → kanban-definition-UXKFOSKX-BLh162tT.js} +2 -2
  55. package/web/assets/{layout-BIjP2nup.js → layout-C0RknDsU.js} +1 -1
  56. package/web/assets/{linear-lvQZOiHM.js → linear-B9CiaY59.js} +1 -1
  57. package/web/assets/{mermaid.core-LJPf4T7o.js → mermaid.core-CPTixcx8.js} +10 -10
  58. package/web/assets/{mindmap-definition-THT77NOG-DiboHsg8.js → mindmap-definition-THT77NOG-BKk-svp_.js} +2 -2
  59. package/web/assets/pegDiagram-XKGWAZYB-Bs6f-6OM.js +1 -0
  60. package/web/assets/{pieDiagram-E7YTZNPT-bPvBuBuG.js → pieDiagram-E7YTZNPT-O9rjTBOJ.js} +2 -2
  61. package/web/assets/{quadrantDiagram-AXDQQJYC-BGyrQhlH.js → quadrantDiagram-AXDQQJYC-MPWJAd0o.js} +2 -2
  62. package/web/assets/railroadDiagram-O6MQD6OU-CmtyQoYY.js +1 -0
  63. package/web/assets/{requirementDiagram-IS5BZ75X-atdASt4G.js → requirementDiagram-IS5BZ75X-CiLZ0RyK.js} +2 -2
  64. package/web/assets/{sankeyDiagram-P5KCCOFB-BV9prEKy.js → sankeyDiagram-P5KCCOFB-BLbDh3R4.js} +2 -2
  65. package/web/assets/{sequenceDiagram-WJ2MYXX4-Csfm-fZ-.js → sequenceDiagram-WJ2MYXX4-DQMbAIgI.js} +2 -2
  66. package/web/assets/sizeCapture-INFHLROL-Di7AzhHC.js +1 -0
  67. package/web/assets/stateDiagram-XQSTLZYL-VqhUG217.js +1 -0
  68. package/web/assets/stateDiagram-v2-IH3M54BS-BXsiZKn6.js +1 -0
  69. package/web/assets/swimlanes-V6O3JKXN-BkN28nKF.js +1 -0
  70. package/web/assets/swimlanesDiagram-JKAHXJPX-BuF8_99Y.js +8 -0
  71. package/web/assets/{timeline-definition-24CTP7MA-C8X71OnL.js → timeline-definition-24CTP7MA-B-p3ba39.js} +2 -2
  72. package/web/assets/{vennDiagram-4TSXK5OY-BZo-99ra.js → vennDiagram-4TSXK5OY-Cggk7sJ0.js} +2 -2
  73. package/web/assets/{wardleyDiagram-VM6X3IG4-BHwH6ZLg.js → wardleyDiagram-VM6X3IG4-DZ8iGx_0.js} +2 -2
  74. package/web/assets/{workspace-file-tree-C8iSfvPt.js → workspace-file-tree-BKLzftpj.js} +2 -2
  75. package/web/assets/{xychartDiagram-S5SC5T6Z-BieEi319.js → xychartDiagram-S5SC5T6Z-Dg1J2qoX.js} +2 -2
  76. package/web/ext-microsoft-365.svg +1 -0
  77. package/web/index.html +2 -4
  78. package/web/assets/abnfDiagram-VCTEODGH-Dr1YMfll.js +0 -1
  79. package/web/assets/app-D9Nvta88.js +0 -2631
  80. package/web/assets/app-DOrYoP_4.css +0 -32
  81. package/web/assets/architectureDiagram-5GKGNRK7-BZwevfH9.js +0 -36
  82. package/web/assets/artifact-spreadsheet-editor-BvEnxKsm.js +0 -11
  83. package/web/assets/channel-BkgEJbR-.js +0 -1
  84. package/web/assets/classDiagram-CYGNFDIV-BHINh3-f.js +0 -1
  85. package/web/assets/classDiagram-v2-TLXNO2FR-BHINh3-f.js +0 -1
  86. package/web/assets/cose-bilkent-JH36ORCC-BhG_zAfo.js +0 -1
  87. package/web/assets/cynefinDiagram-5FMLGOSQ-Dqkgb6tF.js +0 -62
  88. package/web/assets/diagram-UQ7AKVKN-CDnRP_yz.js +0 -41
  89. package/web/assets/diagram-VX7I27RA-BJKoseDf.js +0 -24
  90. package/web/assets/diagram-Z3DM3KII-DDcMvRxo.js +0 -24
  91. package/web/assets/ebnfDiagram-PWID7BFC-C2uUm-CC.js +0 -1
  92. package/web/assets/ganttDiagram-EL5Y4UJY-CENsUToC.js +0 -292
  93. package/web/assets/gitGraphDiagram-WWUBYQGX-CrbKh94B.js +0 -106
  94. package/web/assets/index-CyyMNIC_.css +0 -1
  95. package/web/assets/index-D6FUvVB1.js +0 -49
  96. package/web/assets/infoDiagram-FKFFQAWI-B-U-x_qU.js +0 -2
  97. package/web/assets/katex-HP8lGamR.js +0 -257
  98. package/web/assets/overlay-DA5SOee-.js +0 -1
  99. package/web/assets/pegDiagram-XKGWAZYB-DO_edVtr.js +0 -1
  100. package/web/assets/railroadDiagram-O6MQD6OU-XhPIuoOE.js +0 -1
  101. package/web/assets/sizeCapture-INFHLROL-CLmH-AjF.js +0 -1
  102. package/web/assets/stateDiagram-XQSTLZYL-yiSt2fJK.js +0 -1
  103. package/web/assets/stateDiagram-v2-IH3M54BS-BEhxOujx.js +0 -1
  104. package/web/assets/swimlanes-V6O3JKXN-BpXNggx9.js +0 -1
  105. package/web/assets/swimlanesDiagram-JKAHXJPX-DWqwFv9F.js +0 -8
  106. package/web/grain-art/extension/extension-001.png +0 -0
  107. package/web/grain-art/extension/extension-002.png +0 -0
  108. package/web/grain-art/extension/extension-003.png +0 -0
  109. package/web/grain-art/extension/extension-004.png +0 -0
  110. package/web/grain-art/extension/extension-005.png +0 -0
  111. package/web/grain-art/extension/extension-006.png +0 -0
  112. package/web/grain-art/extension/extension-007.png +0 -0
  113. package/web/grain-art/extension/extension-008.png +0 -0
  114. package/web/grain-art/extension/extension-009.png +0 -0
  115. package/web/grain-art/extension/extension-010.png +0 -0
  116. package/web/grain-art/extension/extension-011.png +0 -0
  117. package/web/grain-art/extension/extension-012.png +0 -0
  118. package/web/grain-art/extension/extension-013.png +0 -0
  119. package/web/grain-art/extension/extension-014.png +0 -0
  120. package/web/grain-art/extension/extension-015.png +0 -0
  121. package/web/grain-art/extension/extension-016.png +0 -0
  122. package/web/grain-art/extension/extension-017.png +0 -0
  123. package/web/grain-art/extension/extension-018.png +0 -0
  124. package/web/grain-art/extension/extension-019.png +0 -0
  125. package/web/grain-art/extension/extension-020.png +0 -0
  126. package/web/grain-art/extension/extension-021.png +0 -0
  127. package/web/grain-art/extension/extension-022.png +0 -0
  128. package/web/grain-art/extension/extension-023.png +0 -0
  129. package/web/grain-art/extension/extension-024.png +0 -0
  130. package/web/grain-art/extension/extension-025.png +0 -0
  131. package/web/grain-art/extension/extension-026.png +0 -0
  132. package/web/grain-art/extension/extension-027.png +0 -0
  133. package/web/grain-art/extension/extension-028.png +0 -0
  134. package/web/grain-art/extension/extension-029.png +0 -0
  135. package/web/grain-art/extension/extension-030.png +0 -0
  136. package/web/grain-art/extension/extension-031.png +0 -0
  137. package/web/grain-art/extension/extension-032.png +0 -0
  138. package/web/grain-art/fallback/fallback-001.png +0 -0
  139. package/web/grain-art/fallback/fallback-002.png +0 -0
  140. package/web/grain-art/fallback/fallback-003.png +0 -0
  141. package/web/grain-art/fallback/fallback-004.png +0 -0
  142. package/web/grain-art/fallback/fallback-005.png +0 -0
  143. package/web/grain-art/fallback/fallback-006.png +0 -0
  144. package/web/grain-art/fallback/fallback-007.png +0 -0
  145. package/web/grain-art/fallback/fallback-008.png +0 -0
  146. package/web/grain-art/fallback/fallback-009.png +0 -0
  147. package/web/grain-art/fallback/fallback-010.png +0 -0
  148. package/web/grain-art/fallback/fallback-011.png +0 -0
  149. package/web/grain-art/fallback/fallback-012.png +0 -0
  150. package/web/grain-art/fallback/fallback-013.png +0 -0
  151. package/web/grain-art/fallback/fallback-014.png +0 -0
  152. package/web/grain-art/fallback/fallback-015.png +0 -0
  153. package/web/grain-art/fallback/fallback-016.png +0 -0
  154. package/web/grain-art/fallback/fallback-017.png +0 -0
  155. package/web/grain-art/fallback/fallback-018.png +0 -0
  156. package/web/grain-art/fallback/fallback-019.png +0 -0
  157. package/web/grain-art/fallback/fallback-020.png +0 -0
  158. package/web/grain-art/fallback/fallback-021.png +0 -0
  159. package/web/grain-art/fallback/fallback-022.png +0 -0
  160. package/web/grain-art/fallback/fallback-023.png +0 -0
  161. package/web/grain-art/fallback/fallback-024.png +0 -0
  162. package/web/grain-art/fallback/fallback-025.png +0 -0
  163. package/web/grain-art/fallback/fallback-026.png +0 -0
  164. package/web/grain-art/fallback/fallback-027.png +0 -0
  165. package/web/grain-art/fallback/fallback-028.png +0 -0
  166. package/web/grain-art/fallback/fallback-029.png +0 -0
  167. package/web/grain-art/fallback/fallback-030.png +0 -0
  168. package/web/grain-art/fallback/fallback-031.png +0 -0
  169. package/web/grain-art/fallback/fallback-032.png +0 -0
  170. package/web/grain-art/mcps/mcps-001.png +0 -0
  171. package/web/grain-art/mcps/mcps-002.png +0 -0
  172. package/web/grain-art/mcps/mcps-003.png +0 -0
  173. package/web/grain-art/mcps/mcps-004.png +0 -0
  174. package/web/grain-art/mcps/mcps-005.png +0 -0
  175. package/web/grain-art/mcps/mcps-006.png +0 -0
  176. package/web/grain-art/mcps/mcps-007.png +0 -0
  177. package/web/grain-art/mcps/mcps-008.png +0 -0
  178. package/web/grain-art/mcps/mcps-009.png +0 -0
  179. package/web/grain-art/mcps/mcps-010.png +0 -0
  180. package/web/grain-art/mcps/mcps-011.png +0 -0
  181. package/web/grain-art/mcps/mcps-012.png +0 -0
  182. package/web/grain-art/mcps/mcps-013.png +0 -0
  183. package/web/grain-art/mcps/mcps-014.png +0 -0
  184. package/web/grain-art/mcps/mcps-015.png +0 -0
  185. package/web/grain-art/mcps/mcps-016.png +0 -0
  186. package/web/grain-art/mcps/mcps-017.png +0 -0
  187. package/web/grain-art/mcps/mcps-018.png +0 -0
  188. package/web/grain-art/mcps/mcps-019.png +0 -0
  189. package/web/grain-art/mcps/mcps-020.png +0 -0
  190. package/web/grain-art/mcps/mcps-021.png +0 -0
  191. package/web/grain-art/mcps/mcps-022.png +0 -0
  192. package/web/grain-art/mcps/mcps-023.png +0 -0
  193. package/web/grain-art/mcps/mcps-024.png +0 -0
  194. package/web/grain-art/mcps/mcps-025.png +0 -0
  195. package/web/grain-art/mcps/mcps-026.png +0 -0
  196. package/web/grain-art/mcps/mcps-027.png +0 -0
  197. package/web/grain-art/mcps/mcps-028.png +0 -0
  198. package/web/grain-art/mcps/mcps-029.png +0 -0
  199. package/web/grain-art/mcps/mcps-030.png +0 -0
  200. package/web/grain-art/mcps/mcps-031.png +0 -0
  201. package/web/grain-art/mcps/mcps-032.png +0 -0
  202. package/web/grain-art/plugins/plugins-001.png +0 -0
  203. package/web/grain-art/plugins/plugins-002.png +0 -0
  204. package/web/grain-art/plugins/plugins-003.png +0 -0
  205. package/web/grain-art/plugins/plugins-004.png +0 -0
  206. package/web/grain-art/plugins/plugins-005.png +0 -0
  207. package/web/grain-art/plugins/plugins-006.png +0 -0
  208. package/web/grain-art/plugins/plugins-007.png +0 -0
  209. package/web/grain-art/plugins/plugins-008.png +0 -0
  210. package/web/grain-art/plugins/plugins-009.png +0 -0
  211. package/web/grain-art/plugins/plugins-010.png +0 -0
  212. package/web/grain-art/plugins/plugins-011.png +0 -0
  213. package/web/grain-art/plugins/plugins-012.png +0 -0
  214. package/web/grain-art/plugins/plugins-013.png +0 -0
  215. package/web/grain-art/plugins/plugins-014.png +0 -0
  216. package/web/grain-art/plugins/plugins-015.png +0 -0
  217. package/web/grain-art/plugins/plugins-016.png +0 -0
  218. package/web/grain-art/plugins/plugins-017.png +0 -0
  219. package/web/grain-art/plugins/plugins-018.png +0 -0
  220. package/web/grain-art/plugins/plugins-019.png +0 -0
  221. package/web/grain-art/plugins/plugins-020.png +0 -0
  222. package/web/grain-art/plugins/plugins-021.png +0 -0
  223. package/web/grain-art/plugins/plugins-022.png +0 -0
  224. package/web/grain-art/plugins/plugins-023.png +0 -0
  225. package/web/grain-art/plugins/plugins-024.png +0 -0
  226. package/web/grain-art/plugins/plugins-025.png +0 -0
  227. package/web/grain-art/plugins/plugins-026.png +0 -0
  228. package/web/grain-art/plugins/plugins-027.png +0 -0
  229. package/web/grain-art/plugins/plugins-028.png +0 -0
  230. package/web/grain-art/plugins/plugins-029.png +0 -0
  231. package/web/grain-art/plugins/plugins-030.png +0 -0
  232. package/web/grain-art/plugins/plugins-031.png +0 -0
  233. package/web/grain-art/plugins/plugins-032.png +0 -0
  234. package/web/grain-art/skills/skills-001.png +0 -0
  235. package/web/grain-art/skills/skills-002.png +0 -0
  236. package/web/grain-art/skills/skills-003.png +0 -0
  237. package/web/grain-art/skills/skills-004.png +0 -0
  238. package/web/grain-art/skills/skills-005.png +0 -0
  239. package/web/grain-art/skills/skills-006.png +0 -0
  240. package/web/grain-art/skills/skills-007.png +0 -0
  241. package/web/grain-art/skills/skills-008.png +0 -0
  242. package/web/grain-art/skills/skills-009.png +0 -0
  243. package/web/grain-art/skills/skills-010.png +0 -0
  244. package/web/grain-art/skills/skills-011.png +0 -0
  245. package/web/grain-art/skills/skills-012.png +0 -0
  246. package/web/grain-art/skills/skills-013.png +0 -0
  247. package/web/grain-art/skills/skills-014.png +0 -0
  248. package/web/grain-art/skills/skills-015.png +0 -0
  249. package/web/grain-art/skills/skills-016.png +0 -0
  250. package/web/grain-art/skills/skills-017.png +0 -0
  251. package/web/grain-art/skills/skills-018.png +0 -0
  252. package/web/grain-art/skills/skills-019.png +0 -0
  253. package/web/grain-art/skills/skills-020.png +0 -0
  254. package/web/grain-art/skills/skills-021.png +0 -0
  255. package/web/grain-art/skills/skills-022.png +0 -0
  256. package/web/grain-art/skills/skills-023.png +0 -0
  257. package/web/grain-art/skills/skills-024.png +0 -0
  258. package/web/grain-art/skills/skills-025.png +0 -0
  259. package/web/grain-art/skills/skills-026.png +0 -0
  260. package/web/grain-art/skills/skills-027.png +0 -0
  261. package/web/grain-art/skills/skills-028.png +0 -0
  262. package/web/grain-art/skills/skills-029.png +0 -0
  263. package/web/grain-art/skills/skills-030.png +0 -0
  264. package/web/grain-art/skills/skills-031.png +0 -0
  265. package/web/grain-art/skills/skills-032.png +0 -0
  266. package/web/grain-art/workspaces/workspaces-001.png +0 -0
  267. package/web/grain-art/workspaces/workspaces-002.png +0 -0
  268. package/web/grain-art/workspaces/workspaces-003.png +0 -0
  269. package/web/grain-art/workspaces/workspaces-004.png +0 -0
  270. package/web/grain-art/workspaces/workspaces-005.png +0 -0
  271. package/web/grain-art/workspaces/workspaces-006.png +0 -0
  272. package/web/grain-art/workspaces/workspaces-007.png +0 -0
  273. package/web/grain-art/workspaces/workspaces-008.png +0 -0
  274. package/web/grain-art/workspaces/workspaces-009.png +0 -0
  275. package/web/grain-art/workspaces/workspaces-010.png +0 -0
  276. package/web/grain-art/workspaces/workspaces-011.png +0 -0
  277. package/web/grain-art/workspaces/workspaces-012.png +0 -0
  278. package/web/grain-art/workspaces/workspaces-013.png +0 -0
  279. package/web/grain-art/workspaces/workspaces-014.png +0 -0
  280. package/web/grain-art/workspaces/workspaces-015.png +0 -0
  281. package/web/grain-art/workspaces/workspaces-016.png +0 -0
  282. package/web/grain-art/workspaces/workspaces-017.png +0 -0
  283. package/web/grain-art/workspaces/workspaces-018.png +0 -0
  284. package/web/grain-art/workspaces/workspaces-019.png +0 -0
  285. package/web/grain-art/workspaces/workspaces-020.png +0 -0
  286. package/web/grain-art/workspaces/workspaces-021.png +0 -0
  287. package/web/grain-art/workspaces/workspaces-022.png +0 -0
  288. package/web/grain-art/workspaces/workspaces-023.png +0 -0
  289. package/web/grain-art/workspaces/workspaces-024.png +0 -0
  290. package/web/grain-art/workspaces/workspaces-025.png +0 -0
  291. package/web/grain-art/workspaces/workspaces-026.png +0 -0
  292. package/web/grain-art/workspaces/workspaces-027.png +0 -0
  293. package/web/grain-art/workspaces/workspaces-028.png +0 -0
  294. package/web/grain-art/workspaces/workspaces-029.png +0 -0
  295. package/web/grain-art/workspaces/workspaces-030.png +0 -0
  296. package/web/grain-art/workspaces/workspaces-031.png +0 -0
  297. package/web/grain-art/workspaces/workspaces-032.png +0 -0
  298. package/web/openwork-logo.svg +0 -1
  299. package/web/overlay.html +0 -29
@@ -0,0 +1,11 @@
1
+ import{T as Xt,f as st,Q as j,j as E,L as zt,B as A,P as rt,c as Ft,u as Zt,r as P,a as jt}from"./app-DAPWjSQy.js";const I=new Set(["input","option","optgroup","select","button","datalist","textarea"]),f=new Set(["p"]),ot=new Set(["thead","tbody"]),it=new Set(["dd","dt"]),at=new Set(["rt","rp"]),Bt=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",f],["h1",f],["h2",f],["h3",f],["h4",f],["h5",f],["h6",f],["select",I],["input",I],["output",I],["button",I],["datalist",I],["textarea",I],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",it],["dt",it],["address",f],["article",f],["aside",f],["blockquote",f],["details",f],["div",f],["dl",f],["fieldset",f],["figcaption",f],["figure",f],["footer",f],["form",f],["header",f],["hr",f],["main",f],["nav",f],["ol",f],["pre",f],["section",f],["table",f],["ul",f],["rt",at],["rp",at],["tbody",ot],["tfoot",ot]]),Vt=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),ct=new Set(["math","svg"]),lt=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Wt=/\s|\//;class Ht{constructor(t,n={}){var s,r,o,i,a;this.options=n,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.foreignContext=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t??{},this.lowerCaseTagNames=(s=n.lowerCaseTags)!==null&&s!==void 0?s:!n.xmlMode,this.lowerCaseAttributeNames=(r=n.lowerCaseAttributeNames)!==null&&r!==void 0?r:!n.xmlMode,this.tokenizer=new((o=n.Tokenizer)!==null&&o!==void 0?o:Xt)(this.options,this),(a=(i=this.cbs).onparserinit)===null||a===void 0||a.call(i,this)}ontext(t,n){var s,r;const o=this.getSlice(t,n);this.endIndex=n-1,(r=(s=this.cbs).ontext)===null||r===void 0||r.call(s,o),this.startIndex=n}ontextentity(t){var n,s;const r=this.tokenizer.getSectionStart();this.endIndex=r-1,(s=(n=this.cbs).ontext)===null||s===void 0||s.call(n,st(t)),this.startIndex=r}isVoidElement(t){return!this.options.xmlMode&&Vt.has(t)}onopentagname(t,n){this.endIndex=n;let s=this.getSlice(t,n);this.lowerCaseTagNames&&(s=s.toLowerCase()),this.emitOpenTag(s)}emitOpenTag(t){var n,s,r,o;this.openTagStart=this.startIndex,this.tagname=t;const i=!this.options.xmlMode&&Bt.get(t);if(i)for(;this.stack.length>0&&i.has(this.stack[this.stack.length-1]);){const a=this.stack.pop();(s=(n=this.cbs).onclosetag)===null||s===void 0||s.call(n,a,!0)}this.isVoidElement(t)||(this.stack.push(t),ct.has(t)?this.foreignContext.push(!0):lt.has(t)&&this.foreignContext.push(!1)),(o=(r=this.cbs).onopentagname)===null||o===void 0||o.call(r,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var n,s;this.startIndex=this.openTagStart,this.attribs&&((s=(n=this.cbs).onopentag)===null||s===void 0||s.call(n,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,n){var s,r,o,i,a,c;this.endIndex=n;let h=this.getSlice(t,n);if(this.lowerCaseTagNames&&(h=h.toLowerCase()),(ct.has(h)||lt.has(h))&&this.foreignContext.pop(),this.isVoidElement(h))!this.options.xmlMode&&h==="br"&&((r=(s=this.cbs).onopentagname)===null||r===void 0||r.call(s,"br"),(i=(o=this.cbs).onopentag)===null||i===void 0||i.call(o,"br",{},!0),(c=(a=this.cbs).onclosetag)===null||c===void 0||c.call(a,"br",!1));else{const u=this.stack.lastIndexOf(h);if(u!==-1)if(this.cbs.onclosetag){let l=this.stack.length-u;for(;l--;)this.cbs.onclosetag(this.stack.pop(),l!==0)}else this.stack.length=u;else!this.options.xmlMode&&h==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=n+1}onselfclosingtag(t){this.endIndex=t,this.options.xmlMode||this.options.recognizeSelfClosing||this.foreignContext[this.foreignContext.length-1]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var n,s;const r=this.tagname;this.endOpenTag(t),this.stack[this.stack.length-1]===r&&((s=(n=this.cbs).onclosetag)===null||s===void 0||s.call(n,r,!t),this.stack.pop())}onattribname(t,n){this.startIndex=t;const s=this.getSlice(t,n);this.attribname=this.lowerCaseAttributeNames?s.toLowerCase():s}onattribdata(t,n){this.attribvalue+=this.getSlice(t,n)}onattribentity(t){this.attribvalue+=st(t)}onattribend(t,n){var s,r;this.endIndex=n,(r=(s=this.cbs).onattribute)===null||r===void 0||r.call(s,this.attribname,this.attribvalue,t===j.Double?'"':t===j.Single?"'":t===j.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const n=t.search(Wt);let s=n<0?t:t.substr(0,n);return this.lowerCaseTagNames&&(s=s.toLowerCase()),s}ondeclaration(t,n){this.endIndex=n;const s=this.getSlice(t,n);if(this.cbs.onprocessinginstruction){const r=this.getInstructionName(s);this.cbs.onprocessinginstruction(`!${r}`,`!${s}`)}this.startIndex=n+1}onprocessinginstruction(t,n){this.endIndex=n;const s=this.getSlice(t,n);if(this.cbs.onprocessinginstruction){const r=this.getInstructionName(s);this.cbs.onprocessinginstruction(`?${r}`,`?${s}`)}this.startIndex=n+1}oncomment(t,n,s){var r,o,i,a;this.endIndex=n,(o=(r=this.cbs).oncomment)===null||o===void 0||o.call(r,this.getSlice(t,n-s)),(a=(i=this.cbs).oncommentend)===null||a===void 0||a.call(i),this.startIndex=n+1}oncdata(t,n,s){var r,o,i,a,c,h,u,l,d,m;this.endIndex=n;const b=this.getSlice(t,n-s);this.options.xmlMode||this.options.recognizeCDATA?((o=(r=this.cbs).oncdatastart)===null||o===void 0||o.call(r),(a=(i=this.cbs).ontext)===null||a===void 0||a.call(i,b),(h=(c=this.cbs).oncdataend)===null||h===void 0||h.call(c)):((l=(u=this.cbs).oncomment)===null||l===void 0||l.call(u,`[CDATA[${b}]]`),(m=(d=this.cbs).oncommentend)===null||m===void 0||m.call(d)),this.startIndex=n+1}onend(){var t,n;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let s=this.stack.length;s>0;this.cbs.onclosetag(this.stack[--s],!0));}(n=(t=this.cbs).onend)===null||n===void 0||n.call(t)}reset(){var t,n,s,r;(n=(t=this.cbs).onreset)===null||n===void 0||n.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(r=(s=this.cbs).onparserinit)===null||r===void 0||r.call(s,this),this.buffers.length=0,this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,n){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let s=this.buffers[0].slice(t-this.bufferOffset,n-this.bufferOffset);for(;n-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),s+=this.buffers[0].slice(0,n-this.bufferOffset);return s}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var n,s;if(this.ended){(s=(n=this.cbs).onerror)===null||s===void 0||s.call(n,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var n,s;if(this.ended){(s=(n=this.cbs).onerror)===null||s===void 0||s.call(n,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}const Et=67324752,St=33639248,yt=101010256,Yt=1,Gt=8,Kt=64,Q=0,vt=8,Qt=12*1024*1024,X=128,kt=10*1024*1024,$=2*1024*1024,_t=100,Ct=new TextEncoder,qt=new TextDecoder("utf-8");function _(e){return Ct.encode(e)}function q(e){return qt.decode(e)}function It(e){return Ct.encode(e).byteLength}function T(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Tt(e){const t=e.reduce((r,o)=>r+o.byteLength,0),n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.byteLength;return n}async function $t(e,t,n){const s=e.getReader(),r=[];let o=0;try{for(;;){const{done:i,value:a}=await s.read();if(i)break;if(o+=a.byteLength,o>t)throw await s.cancel(),new Error(`ZIP entry ${n} inflated beyond its declared size.`);r.push(a)}}finally{s.releaseLock()}return Tt(r)}function Lt(e){const t=new Uint8Array(e.byteLength);return t.set(e),new ReadableStream({start(n){n.enqueue(t),n.close()}})}async function Jt(e,t,n){const s=Lt(e).pipeThrough(new DecompressionStream("deflate-raw"));return await $t(s,t,n)}async function te(e){const t=Lt(e).pipeThrough(new CompressionStream("deflate-raw"));return await $t(t,$+1024,"(deflate)")}function ee(e){const t=T(e),n=Math.max(0,e.byteLength-65535-22);for(let s=e.byteLength-22;s>=n;s-=1){if(s<0||t.getUint32(s,!0)!==yt)continue;const r=t.getUint16(s+20,!0);if(s+22+r===e.byteLength)return s}throw new Error("ZIP end-of-central-directory not found.")}function Rt(e,t){if((e&Yt)!==0)throw new Error(`ZIP entry ${t} is encrypted.`);if((e&Kt)!==0)throw new Error(`ZIP entry ${t} uses strong encryption.`)}function ht(e,t,n){return t===n?!0:(e&Gt)!==0&&t===0}function ne(e){if(e.byteLength>Qt)throw new Error("ZIP input exceeds compressed byte limit.");const t=T(e),n=ee(e),s=t.getUint16(n+4,!0),r=t.getUint16(n+6,!0),o=t.getUint16(n+8,!0),i=t.getUint16(n+10,!0),a=t.getUint32(n+12,!0),c=t.getUint32(n+16,!0),h=c+a;if(s!==0||r!==0||o!==i)throw new Error("Multi-disk ZIP archives are not supported.");if(i===65535||a===4294967295||c===4294967295)throw new Error("ZIP64 archives are not supported.");if(i>X)throw new Error(`ZIP entry count ${i} exceeds limit ${X}.`);if(c+a>e.byteLength)throw new Error("ZIP central directory is out of bounds.");if(h>n)throw new Error("ZIP central directory overlaps the end-of-central-directory record.");const u=[];let l=c,d=0;for(let m=0;m<i;m+=1){if(l+46>h||t.getUint32(l,!0)!==St)throw new Error("Invalid ZIP central directory entry.");const b=t.getUint16(l+8,!0),x=t.getUint16(l+10,!0),w=t.getUint32(l+20,!0),p=t.getUint32(l+24,!0),g=t.getUint16(l+28,!0),k=t.getUint16(l+30,!0),v=t.getUint16(l+32,!0),y=t.getUint32(l+42,!0);if(w===4294967295||p===4294967295||y===4294967295)throw new Error("ZIP64 archives are not supported.");if(l+46+g+k+v>h)throw new Error("ZIP central directory entry is out of bounds.");const S=q(e.subarray(l+46,l+46+g));if(Rt(b,S),x!==Q&&x!==vt)throw new Error(`ZIP entry ${S} uses unsupported compression method ${x}.`);if(p>$)throw new Error(`ZIP entry ${S} exceeds per-entry uncompressed limit.`);if(p>0&&w===0)throw new Error(`ZIP entry ${S} has an invalid compression ratio.`);if(w>0&&p/w>_t)throw new Error(`ZIP entry ${S} exceeds compression ratio limit.`);if(d+=p,d>kt)throw new Error("ZIP archive exceeds total uncompressed limit.");u.push({name:S,flags:b,method:x,compressedSize:w,uncompressedSize:p,localOffset:y}),l+=46+g+k+v}if(l!==h)throw new Error("ZIP central directory size does not match its entries.");return u}async function se(e,t){const n=T(e),s=t.localOffset;if(s+30>e.byteLength||n.getUint32(s,!0)!==Et)throw new Error(`Invalid local ZIP header for ${t.name}.`);const r=n.getUint16(s+6,!0),o=n.getUint16(s+8,!0),i=n.getUint32(s+18,!0),a=n.getUint32(s+22,!0),c=n.getUint16(s+26,!0),h=n.getUint16(s+28,!0);if(Rt(r,t.name),o!==t.method)throw new Error(`ZIP method mismatch for ${t.name}.`);if(!ht(r,i,t.compressedSize)||!ht(r,a,t.uncompressedSize))throw new Error(`ZIP size mismatch for ${t.name}.`);if(s+30+c+h>e.byteLength)throw new Error(`ZIP local header for ${t.name} is out of bounds.`);if(q(e.subarray(s+30,s+30+c))!==t.name)throw new Error(`ZIP local header name mismatch for ${t.name}.`);const l=s+30+c+h;if(l+t.compressedSize>e.byteLength)throw new Error(`ZIP data for ${t.name} is out of bounds.`);const d=e.subarray(l,l+t.compressedSize),m=t.method===Q?d.slice():await Jt(d,t.uncompressedSize,t.name);if(m.byteLength!==t.uncompressedSize)throw new Error(`ZIP uncompressed size mismatch for ${t.name}.`);return m}function re(e){const t=new Map;for(const n of e)t.set(n.name,n);return t}async function L(e,t,n){const s=t.get(n);if(!s)return null;const r=q(await se(e,s));return Mt(r),r}let O=null;function oe(e){if(!O){O=new Uint32Array(256);for(let n=0;n<256;n+=1){let s=n;for(let r=0;r<8;r+=1)s=s&1?3988292384^s>>>1:s>>>1;O[n]=s>>>0}}let t=4294967295;for(const n of e)t=O[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}async function ie(e){if(e.length>X)throw new Error(`ZIP entry count ${e.length} exceeds limit ${X}.`);const t=[],n=[];let s=0,r=0;for(const c of e){if(c.data.byteLength>$)throw new Error(`ZIP entry ${c.name} exceeds per-entry uncompressed limit.`);if(r+=c.data.byteLength,r>kt)throw new Error("ZIP archive exceeds total uncompressed limit.");const h=await te(c.data),u=h.byteLength<c.data.byteLength&&c.data.byteLength/Math.max(1,h.byteLength)<=_t,l=u?h:c.data,d=u?vt:Q,m=_(c.name),b=oe(c.data),x=new Uint8Array(30),w=T(x);w.setUint32(0,Et,!0),w.setUint16(4,20,!0),w.setUint16(6,0,!0),w.setUint16(8,d,!0),w.setUint32(14,b,!0),w.setUint32(18,l.byteLength,!0),w.setUint32(22,c.data.byteLength,!0),w.setUint16(26,m.byteLength,!0),t.push(x,m,l);const p=new Uint8Array(46),g=T(p);g.setUint32(0,St,!0),g.setUint16(4,20,!0),g.setUint16(6,20,!0),g.setUint16(8,0,!0),g.setUint16(10,d,!0),g.setUint32(16,b,!0),g.setUint32(20,l.byteLength,!0),g.setUint32(24,c.data.byteLength,!0),g.setUint16(28,m.byteLength,!0),g.setUint32(42,s,!0),n.push(p,m),s+=x.byteLength+m.byteLength+l.byteLength}const o=n.reduce((c,h)=>c+h.byteLength,0),i=new Uint8Array(22),a=T(i);return a.setUint32(0,yt,!0),a.setUint16(8,e.length,!0),a.setUint16(10,e.length,!0),a.setUint32(12,o,!0),a.setUint32(16,s,!0),Tt([...t,...n,i])}function Mt(e){if(It(e)>$)throw new Error("Office XML exceeds the parser input limit.");const t=e.toLowerCase();if(t.includes("<!doctype")||t.includes("<!entity"))throw new Error("Office XML DTD and entity declarations are not supported.")}function ut(e){const t=e.lastIndexOf(":");return(t===-1?e:e.slice(t+1)).toLowerCase()}function z(e,t){Mt(e);let n="",s=0;const r=t||" ";return new Ht({onopentag(i){s>0?s+=1:ut(i)==="script"||ut(i)==="style"?(n+=r,s=1):n+=t},ontext(i){s===0&&(n+=i)},onclosetag(){s>0?(s-=1,s===0&&(n+=r)):n+=t}},{decodeEntities:!0,xmlMode:!0}).end(e),n}function ae(e){return z(`<openwork-value>${e}</openwork-value>`,"")}function Ut(e){return z(e," ").replace(/\s+/g," ").trim()}function J(e){return`(?:[A-Za-z_][\\w.-]*:)?${e}`}function tt(e){const t={},n=/([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;let s;for(;s=n.exec(e);){const r=s[1],o=s[2]??s[3]??"";t[r]=ae(o)}return t}function M(e,t){const n=J(t),s=new RegExp(`<${n}\\b([^>]*)>([\\s\\S]*?)<\\/${n}>`,"g"),r=[];let o;for(;o=s.exec(e);)r.push({attributes:tt(o[1]),inner:o[2]});return r}function C(e,t){const n=J(t),s=new RegExp(`<${n}\\b([^>]*)\\/?\\s*>`,"g"),r=[];let o;for(;o=s.exec(e);)r.push(tt(o[1]));return r}function ce(e,t){const n=M(e,t)[0];if(n)return z(n.inner,"").trim()}function B(e,t){const n=J(t),s=new RegExp(`<${n}\\b([^>]*?)(\\/>|>([\\s\\S]*?)<\\/${n}>)`,"g"),r=[];let o;for(;o=s.exec(e);)r.push({attributes:tt(o[1]),inner:o[3]??""});return r}function W(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g,"")}function dt(...e){const t=[];for(const n of e.join("/").split("/"))!n||n==="."||(n===".."?t.pop():t.push(n));return t.join("/")}function le(e,t){const n=new Map;if(!e)return n;for(const s of C(e,"Relationship")){const r=s.Id,o=s.Target;!r||!o||s.TargetMode==="External"||/^[a-z][a-z0-9+.-]*:/i.test(o)||n.set(r,o.startsWith("/")?dt(o.slice(1)):dt(t,o))}return n}const he=64,ue=2e5,de=25e4,ft=32,mt=5e4,H=1048576,Y=16384,pt=31,gt=32767,wt=Date.UTC(1899,11,30),fe=Date.UTC(1904,0,1),V=864e5;function G(e){let t=e,n="";for(;t>0;){const s=(t-1)%26;n=String.fromCharCode(65+s)+n,t=Math.floor((t-1)/26)}return n}function me(e){let t=0;for(const n of e.toUpperCase()){const s=n.charCodeAt(0);if(s<65||s>90)return 0;t=t*26+(s-64)}return t}function K(e){const t=/^\$?([A-Za-z]{1,3})\$?(\d{1,7})$/.exec(e.trim());if(!t)return null;const n=me(t[1]),s=Number.parseInt(t[2],10);return n<1||n>Y||s<1||s>H?null:{row:s,column:n}}function pe(e){const t=e.trim(),[n,s=n]=t.split(":"),r=K(n),o=K(s);return!r||!o?null:{firstRow:Math.min(r.row,o.row),lastRow:Math.max(r.row,o.row),firstColumn:Math.min(r.column,o.column),lastColumn:Math.max(r.column,o.column)}}function ge(e,t){const n=le(t,"xl"),s=C(e,"sheet"),r=s.slice(0,he).map((o,i)=>{const a=o["r:id"]??o.id??"",c=a&&n.has(a)?n.get(a)??"":`xl/worksheets/sheet${i+1}.xml`;return{position:i+1,name:o.name??`Sheet${i+1}`,sheetId:o.sheetId??String(i+1),relationshipId:a,path:c,hidden:o.state==="hidden"||o.state==="veryHidden"}});return{sheets:r,omittedSheets:s.length-r.length}}function Nt(e){return M(e,"t").map(n=>z(n.inner,"")).join("").trim()||Ut(e)}function we(e){if(!e)return[];const t=[];for(const n of M(e,"si")){if(t.length>=ue)break;t.push(Nt(n.inner))}return t}function be(e){switch(e){case"0":return"General";case"1":return"0";case"2":return"0.00";case"3":return"#,##0";case"4":return"#,##0.00";case"9":return"0%";case"10":return"0.00%";case"11":return"0.00E+00";case"14":return"mm-dd-yy";case"15":return"d-mmm-yy";case"16":return"d-mmm";case"17":return"mmm-yy";case"18":return"h:mm AM/PM";case"19":return"h:mm:ss AM/PM";case"20":return"h:mm";case"21":return"h:mm:ss";case"22":return"m/d/yy h:mm";case"27":case"28":case"29":case"30":case"31":case"36":case"50":case"51":case"52":case"53":case"54":case"57":case"58":return"yyyy-mm-dd";case"32":case"33":case"34":case"35":case"55":case"56":return"h:mm:ss";case"45":return"mm:ss";case"46":return"[h]:mm:ss";case"47":return"mmss.0";case"49":return"@";default:return""}}function xe(e){if(!e)return[];const t=new Map;for(const s of C(e,"numFmt"))s.numFmtId&&s.formatCode&&t.set(s.numFmtId,s.formatCode);const n=M(e,"cellXfs")[0]?.inner??"";return C(n,"xf").map(s=>{const r=s.numFmtId??"0";return t.get(r)??be(r)})}function Ee(e){if(!e||e==="General"||e==="@")return!1;const t=e.replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"").replace(/\\./g,"").replace(/[Ee][+-]/g,"");return/[ymdhs]/i.test(t)}function R(e,t=2){return String(e).padStart(t,"0")}function Se(e,t=!1){if(!Number.isFinite(e)||e<0||e>2958465)return null;const n=t?fe:e<60?wt+V:wt,s=Math.round(e*V),r=new Date(n+s);if(Number.isNaN(r.getTime()))return null;const o=`${R(r.getUTCHours())}:${R(r.getUTCMinutes())}:${R(r.getUTCSeconds())}`;if(e<1&&!t)return o;const i=`${r.getUTCFullYear()}-${R(r.getUTCMonth()+1)}-${R(r.getUTCDate())}`;return s%V===0?i:`${i} ${o}`}function ye(e){return e==="s"?"shared_string":e==="inlineStr"?"inline_string":e==="str"?"formula_string":e==="b"?"boolean":e==="e"?"error":e==="d"?"date":e||"number"}function ve(e,t,n,s,r,o){if(e==="inlineStr")return Nt(n)||void 0;if(e==="s"&&t!==void 0){const i=Number.parseInt(t,10);return Number.isInteger(i)?s[i]:void 0}return e==="b"&&t!==void 0?t==="1"?"TRUE":"FALSE":(e===""||e==="n")&&t!==void 0&&Ee(r)?Se(Number(t),o)??t:t}function ke(e,t,n,s,r){const o=C(e,"dimension")[0]?.ref??"",i=[];for(const d of C(e,"mergeCell"))d.ref&&i.push(d.ref);const a=M(e,"sheetData")[0]?.inner??e,c=[];let h=0,u=0,l=0;for(const d of B(a,"row")){const m=Number.parseInt(d.attributes.r??"",10),b=Number.isInteger(m)&&m>0?m:l+1;l=b;let x=0;for(const w of B(d.inner,"c")){const p=w.attributes,g=w.inner,k=p.r?K(p.r):null,v=k?.column??x+1,y=k?.row??b;x=v;const S=B(g,"f")[0],U=ce(g,"v"),F=p.t??"";if(S&&(u+=1),U===void 0&&!S&&F!=="inlineStr")continue;if(c.length>=r){h+=1;continue}const N=p.s,Z=N!==void 0?n[Number.parseInt(N,10)]:void 0,nt=ve(F,U,g,t,Z,s),Dt=S?Ut(S.inner):"";c.push({reference:`${G(v)}${y}`,row:y,column:v,type:ye(F),...N!==void 0?{styleIndex:N}:{},...Z?{numberFormat:Z}:{},...S?{formula:Dt}:{},...S?.attributes.t?{formulaType:S.attributes.t}:{},...S?.attributes.ref?{formulaRef:S.attributes.ref}:{},...U!==void 0?{rawValue:U}:{},...nt!==void 0?{displayedValue:nt}:{}})}}return{dimension:o,mergedRanges:i,cells:c,omittedCells:h,formulaCount:u}}function _e(e,t){const n=e.length===0&&t?pe(t):null;if(n)return n;if(e.length===0)return{firstRow:0,lastRow:0,firstColumn:0,lastColumn:0};let s=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0;for(const a of e)s=Math.min(s,a.row),r=Math.max(r,a.row),o=Math.min(o,a.column),i=Math.max(i,a.column);return{firstRow:s,lastRow:r,firstColumn:o,lastColumn:i}}async function Ce(e){const t=re(ne(e)),n=await L(e,t,"xl/workbook.xml");if(!n)throw new Error("XLSX workbook.xml was not found.");const s=we(await L(e,t,"xl/sharedStrings.xml")),r=xe(await L(e,t,"xl/styles.xml")),{sheets:o,omittedSheets:i}=ge(n,await L(e,t,"xl/_rels/workbook.xml.rels"));if(o.length===0)throw new Error("XLSX workbook contained no sheets.");const a=C(n,"workbookPr").some(c=>c.date1904==="1"||c.date1904==="true");return{sheets:o,omittedSheets:i,sharedStringCount:s.length,styleCount:r.length,date1904:a,async readSheet(c,h={}){const u=c.path.startsWith("xl/worksheets/")&&c.path.endsWith(".xml")?c.path:"",l=u?await L(e,t,u):null;if(!l)throw new Error(`Worksheet XML for "${c.name}" was not found or was outside xl/worksheets.`);const d=ke(l,s,r,a,h.cellLimit??de);return{info:c,...d,..._e(d.cells,d.dimension)}}}}const Ie=25e4;function Te(e,t={}){if(e.cells.length===0)return[[""]];const n=t.maxCells??Ie;if(e.lastRow*e.lastColumn>n)throw new Error(`This sheet spans ${e.lastRow} rows by ${e.lastColumn} columns, which is too large to show as an editable grid.`);const s=Array.from({length:e.lastRow},()=>Array.from({length:e.lastColumn},()=>""));for(const r of e.cells)s[r.row-1][r.column-1]=t.formulas&&r.formula?`=${r.formula}`:r.displayedValue??r.rawValue??(r.formula?`=${r.formula}`:"");return s}const $e=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/,bt=8192,Le=/\b(DDE|WEBSERVICE|FILTERXML|RTD|CALL|REGISTER(?:\.ID)?|EXEC|SQL\.REQUEST|IMPORT(?:DATA|XML|HTML|FEED|RANGE)|IMAGE)\s*\(/i,Re=/\[[^\]]*\][^!'"(),;+\-*/^&=<>\[\]{}]*!|'[^']*\[[^\]]*\][^']*'!/u,Me=/'[^']*(?::\/\/|\\\\)[^']*'!/;function At(e){return typeof e=="object"&&e!==null&&typeof e.formula=="string"}function Ue(e){const t=e.trim().replace(/^=/,"");if(!t)return"is empty";if(t.length>bt)return`is longer than ${bt} characters`;if(t.includes("|"))return"contains a DDE-style external command reference";const n=Le.exec(t);return n?`uses ${n[1].toUpperCase()}, which reaches outside the workbook when it recalculates`:Re.test(t)?"references another workbook":Me.test(t)?"references a remote or network path":null}function Ne(e,t){const n=Ue(e.formula);if(n)throw new Error(`Formula in ${t} ${n}; only calculations inside the workbook are written. Write the value instead.`);return e.formula.trim().replace(/^=/,"")}function Ae(e){if(e==="")return null;if(e==="TRUE")return!0;if(e==="FALSE")return!1;if($e.test(e)){const t=Number(e);if(Number.isFinite(t))return t}return e}function Pe(e,t,n){let r=(e??"").replace(/[\u0000-\u001f\u007f[\]:*?/\\]/g," ").replace(/\s+/g," ").replace(/^'+|'+$/g,"").trim().slice(0,pt).trim()||`Sheet${t}`,o=2;for(;n.has(r.toLowerCase())||r.toLowerCase()==="history";)r=`${r.slice(0,pt-String(o).length-1)}-${o}`,o+=1;return n.add(r.toLowerCase()),r}function Oe(e,t,n){const s=n>0?` s="${n}"`:"";if(t===null||t==="")return"";if(typeof t=="number")return Number.isFinite(t)?`<c r="${e}"${s}><v>${t}</v></c>`:`<c r="${e}" t="e"${s}><v>#NUM!</v></c>`;if(typeof t=="boolean")return`<c r="${e}" t="b"${s}><v>${t?1:0}</v></c>`;if(At(t))return`<c r="${e}"${s}><f>${W(Ne(t,e))}</f></c>`;if(t.length>gt)throw new Error(`Cell ${e} holds ${t.length} characters of text; Excel allows ${gt}. Shorten it or split it across cells.`);const r=/^\s|\s$|\n/.test(t)?' xml:space="preserve"':"";return`<c r="${e}" t="inlineStr"${s}><is><t${r}>${W(t)}</t></is></c>`}function De(e){return e===null?0:At(e)?12:String(e).split(`
2
+ `).reduce((t,n)=>Math.max(t,n.length),0)}function Xe(e){const t=e.rows,n=t.reduce((u,l)=>Math.max(u,l.length),0);if(t.length>H)throw new Error(`Sheet "${e.name??""}" has ${t.length} rows; Excel allows ${H}.`);if(n>Y)throw new Error(`Sheet "${e.name??""}" has ${n} columns; Excel allows ${Y}.`);const s=e.header??!0,r=Array.from({length:n},()=>0),o=[];t.forEach((u,l)=>{const d=[];u.forEach((m,b)=>{r[b]=Math.max(r[b],De(m));const x=Oe(`${G(b+1)}${l+1}`,m,s&&l===0?1:0);x&&d.push(x)}),d.length&&o.push(`<row r="${l+1}">${d.join("")}</row>`)});const i=t.length&&n?`A1:${G(n)}${t.length}`:"A1",a=n?`<cols>${r.map((u,l)=>`<col min="${l+1}" max="${l+1}" width="${Math.min(60,Math.max(8,u+2))}" customWidth="1"/>`).join("")}</cols>`:"",c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="${i}"/><sheetViews><sheetView workbookViewId="0"${s&&t.length>1?'><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView>':"/>"}</sheetViews><sheetFormatPr defaultRowHeight="15"/>${a}<sheetData>${o.join("")}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`,h=It(c);if(h>$)throw new Error(`Sheet ${JSON.stringify(e.name??"")} would be ${h} bytes of worksheet XML; the limit is ${$} bytes (roughly 30,000 text cells). Split the rows across sheets or files, shorten cell text, or write a CSV instead.`);return{xml:c,rows:t.length,columns:n}}const ze=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4
+ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;async function Fe(e){if(e.length===0)throw new Error("A workbook needs at least one sheet.");if(e.length>ft)throw new Error(`A workbook may contain at most ${ft} sheets.`);const t=e.reduce((i,a)=>i+a.rows.reduce((c,h)=>c+h.length,0),0);if(t>mt)throw new Error(`Workbook has ${t} cells; spreadsheet_write accepts at most ${mt}. Split the data across files or write a CSV.`);const n=new Set,s=e.map((i,a)=>({...i,name:Pe(i.name,a+1,n)})),r=s.map(i=>Xe(i)),o=[{name:"[Content_Types].xml",data:_(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
5
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>${s.map((i,a)=>`<Override PartName="/xl/worksheets/sheet${a+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`)},{name:"_rels/.rels",data:_(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
6
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`)},{name:"xl/workbook.xml",data:_(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
7
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><bookViews><workbookView/></bookViews><sheets>${s.map((i,a)=>`<sheet name="${W(i.name)}" sheetId="${a+1}" r:id="rId${a+1}"/>`).join("")}</sheets><calcPr fullCalcOnLoad="1"/></workbook>`)},{name:"xl/_rels/workbook.xml.rels",data:_(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
8
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${s.map((i,a)=>`<Relationship Id="rId${a+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${a+1}.xml"/>`).join("")}<Relationship Id="rId${s.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`)},{name:"xl/styles.xml",data:_(ze)},...r.map((i,a)=>({name:`xl/worksheets/sheet${a+1}.xml`,data:_(i.xml)}))];return{bytes:await ie(o),sheets:s.map((i,a)=>({name:i.name,rows:r[a].rows,columns:r[a].columns}))}}function et(e){const t=e.toLowerCase().split(/[?#]/)[0]??e.toLowerCase(),n=t.lastIndexOf(".");return n>=0?t.slice(n+1):""}function Pt(e){return et(e)==="tsv"?" ":","}function Ze(e,t){const n=[];let s=[],r="",o=!1;for(let i=0;i<e.length;i+=1){const a=e[i],c=e[i+1];if(o){a==='"'&&c==='"'?(r+='"',i+=1):a==='"'?o=!1:r+=a;continue}if(a==='"'){o=!0;continue}if(a===t){s.push(r),r="";continue}if(a===`
9
+ `){s.push(r),n.push(s),s=[],r="";continue}a!=="\r"&&(r+=a)}return(r||s.length)&&(s.push(r),n.push(s)),n.length?n:[[""]]}function je(e,t){return e.map(n=>n.map(s=>{const r=String(s??"");return!r.includes(t)&&!/["\r\n]/.test(r)?r:`"${r.replace(/"/g,'""')}"`}).join(t)).join(`
10
+ `)+`
11
+ `}function Ot(e){return e==="xls"?"Legacy .xls workbooks can't be edited here. Save the file as .xlsx and open it again.":e==="ods"?"OpenDocument spreadsheets can't be edited here. Export the file as .xlsx and open it again.":null}function Be(e){return new Uint8Array(e.kind==="binary"?e.data:new ArrayBuffer(0))}function Ve(e){const t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}async function We(e){const t=et(e.name);if(t==="csv"||t==="tsv")return Ze(e.content.kind==="text"?e.content.data:"",Pt(e.name));const n=Ot(t);if(n)throw new Error(n);const s=await Ce(Be(e.content)),r=await s.readSheet(s.sheets[0]);return Te(r)}async function He(e,t){const n=et(e);if(n==="csv"||n==="tsv")return{kind:"text",data:je(t,Pt(e))};const s=Ot(n);if(s)throw new Error(s);const{bytes:r}=await Fe([{name:"Sheet1",header:!1,rows:t.map(o=>o.map(i=>Ae(String(i??""))))}]);return{kind:"binary",data:Ve(r)}}function D(e){return e.map(t=>[...t])}function xt(e){const t=Math.max(1,...e.map(n=>n.length));return e.map(n=>Array.from({length:t},(s,r)=>n[r]??""))}function Ye({name:e,content:t,onSave:n}){const{data:s,error:r,isLoading:o}=Zt({queryKey:["artifact-spreadsheet",e,t],queryFn:async()=>xt(await We({name:e,content:t})),refetchOnReconnect:!1,refetchOnWindowFocus:!1,staleTime:1/0}),[i,a]=P.useState([[""]]),[c,h]=P.useState([[""]]),u=P.useMemo(()=>JSON.stringify(i)!==JSON.stringify(c),[c,i]);P.useEffect(()=>{s&&(a(s),h(D(s)))},[s]);const{mutate:l,isPending:d}=jt({mutationFn:async()=>{const p=await He(e,i);await n(p)},onSuccess:()=>{h(D(i))}});return{rows:i,error:r,isLoading:o,updateCell:(p,g,k)=>{a(v=>{const y=D(v);return y[p]=[...y[p]??[]],y[p][g]=k,xt(y)})},addRow:()=>a(p=>[...p,Array.from({length:Math.max(1,p[0]?.length??1)},()=>"")]),addColumn:()=>a(p=>p.map(g=>[...g,""])),discard:()=>a(D(c)),isDirty:u,save:l,isSaving:d}}function Ke(e){const{rows:t,error:n,isLoading:s,updateCell:r,addRow:o,addColumn:i,discard:a,isDirty:c,save:h,isSaving:u}=Ye(e),l=e.saving||u;return s?E.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:E.jsx(zt,{className:"size-4 animate-spin"})}):n?E.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:n instanceof Error?n.message:"Failed to parse spreadsheet"}):E.jsxs("div",{className:Ft("flex h-full min-h-0 flex-col",e.className),children:[E.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-3 py-2 border-b border-border",children:[E.jsxs(A,{variant:"ghost",size:"xs",onClick:o,children:[E.jsx(rt,{className:"size-3"})," Row"]}),E.jsxs(A,{variant:"ghost",size:"xs",onClick:i,children:[E.jsx(rt,{className:"size-3"})," Column"]}),E.jsx("div",{className:"min-w-0 flex-1"}),E.jsx(A,{variant:"ghost",size:"xs",onClick:a,disabled:!c||l,children:"Discard"}),E.jsx(A,{variant:"default",size:"xs",onClick:()=>h(),disabled:!c||l,children:l?"Saving":"Save"})]}),E.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:E.jsx("table",{className:"w-full border-collapse text-xs",children:E.jsx("tbody",{children:t.map((d,m)=>E.jsx("tr",{children:d.map((b,x)=>E.jsx("td",{className:"border-b not-first:border-l border-border p-0 align-top",children:E.jsx("input",{className:"h-8 w-full min-w-[120px] bg-transparent px-2 text-foreground outline-none focus:bg-muted/50",value:b,onChange:w=>r(m,x,w.target.value)})},x))},m))})})})]})}export{Ke as ArtifactSpreadsheetEditor};
@@ -1,4 +1,4 @@
1
- import{r as Ei,j as mf,c as g0}from"./index-D6FUvVB1.js";import{r as m0,s as S0,A as b0}from"./app-D9Nvta88.js";let Zo=[],Od=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?Od:Zo).push(t=t+r[e])})();function y0(r){if(r<768)return!1;for(let e=0,t=Zo.length;;){let i=e+t>>1;if(r<Zo[i])t=i;else if(r>=Od[i])e=i+1;else return!0;if(e==t)return!1}}function Sf(r){return r>=127462&&r<=127487}const bf=8205;function x0(r,e,t=!0,i=!0){return(t?gd:k0)(r,e,i)}function gd(r,e,t){if(e==r.length)return e;e&&md(r.charCodeAt(e))&&Sd(r.charCodeAt(e-1))&&e--;let i=zl(r,e);for(e+=yf(i);e<r.length;){let n=zl(r,e);if(i==bf||n==bf||t&&y0(n))e+=yf(n),i=n;else if(Sf(n)){let s=0,l=e-2;for(;l>=0&&Sf(zl(r,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function k0(r,e,t){for(;e>0;){let i=gd(r,e-2,t);if(i<e)return i;e--}return 0}function zl(r,e){let t=r.charCodeAt(e);if(!Sd(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return md(i)?(t-55296<<10)+(i-56320)+65536:t}function md(r){return r>=56320&&r<57344}function Sd(r){return r>=55296&&r<56320}function yf(r){return r<65536?1:2}let F=class bd{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=nn(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),bs.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=nn(this,e,t);let i=[];return this.decompose(e,t,i,0),bs.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new qn(this),s=new qn(e);for(let l=t,o=t;;){if(n.next(l),s.next(l),l=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new qn(this,e)}iterRange(e,t=this.length){return new yd(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xd(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?bd.empty:e.length<=32?new ut(e):bs.from(ut.split(e,[]))}},ut=class Qt extends F{constructor(e,t=w0(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let l=this.text[s],o=n+l.length;if((t?i:o)>=e)return new $0(n,o,i,l);n=o+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new Qt(xf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let l=i.pop(),o=ys(s.text,l.text.slice(),0,s.length);if(o.length<=32)i.push(new Qt(o,l.length+s.length));else{let a=o.length>>1;i.push(new Qt(o.slice(0,a)),new Qt(o.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof Qt))return super.replace(e,t,i);[e,t]=nn(this,e,t);let n=ys(this.text,ys(i.text,xf(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new Qt(n,s):bs.from(Qt.split(n,[]),s)}sliceString(e,t=this.length,i=`
1
+ import{b as g0,s as m0,r as Ei,j as mf,c as S0,A as b0}from"./app-DAPWjSQy.js";let Zo=[],Od=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?Od:Zo).push(t=t+r[e])})();function y0(r){if(r<768)return!1;for(let e=0,t=Zo.length;;){let i=e+t>>1;if(r<Zo[i])t=i;else if(r>=Od[i])e=i+1;else return!0;if(e==t)return!1}}function Sf(r){return r>=127462&&r<=127487}const bf=8205;function x0(r,e,t=!0,i=!0){return(t?gd:k0)(r,e,i)}function gd(r,e,t){if(e==r.length)return e;e&&md(r.charCodeAt(e))&&Sd(r.charCodeAt(e-1))&&e--;let i=zl(r,e);for(e+=yf(i);e<r.length;){let n=zl(r,e);if(i==bf||n==bf||t&&y0(n))e+=yf(n),i=n;else if(Sf(n)){let s=0,l=e-2;for(;l>=0&&Sf(zl(r,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function k0(r,e,t){for(;e>0;){let i=gd(r,e-2,t);if(i<e)return i;e--}return 0}function zl(r,e){let t=r.charCodeAt(e);if(!Sd(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return md(i)?(t-55296<<10)+(i-56320)+65536:t}function md(r){return r>=56320&&r<57344}function Sd(r){return r>=55296&&r<56320}function yf(r){return r<65536?1:2}let F=class bd{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=nn(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),bs.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=nn(this,e,t);let i=[];return this.decompose(e,t,i,0),bs.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new qn(this),s=new qn(e);for(let l=t,o=t;;){if(n.next(l),s.next(l),l=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new qn(this,e)}iterRange(e,t=this.length){return new yd(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xd(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?bd.empty:e.length<=32?new ut(e):bs.from(ut.split(e,[]))}},ut=class Qt extends F{constructor(e,t=w0(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let l=this.text[s],o=n+l.length;if((t?i:o)>=e)return new $0(n,o,i,l);n=o+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new Qt(xf(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let l=i.pop(),o=ys(s.text,l.text.slice(),0,s.length);if(o.length<=32)i.push(new Qt(o,l.length+s.length));else{let a=o.length>>1;i.push(new Qt(o.slice(0,a)),new Qt(o.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof Qt))return super.replace(e,t,i);[e,t]=nn(this,e,t);let n=ys(this.text,ys(i.text,xf(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new Qt(n,s):bs.from(Qt.split(n,[]),s)}sliceString(e,t=this.length,i=`
2
2
  `){[e,t]=nn(this,e,t);let n="";for(let s=0,l=0;s<=t&&l<this.text.length;l++){let o=this.text[l],a=s+o.length;s>e&&l&&(n+=i),e<a&&t>s&&(n+=o.slice(Math.max(0,e-s),t-s)),s=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new Qt(i,n)),i=[],n=-1);return n>-1&&t.push(new Qt(i,n)),t}},bs=class Bi extends F{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let l=this.children[s],o=n+l.length,a=i+l.lines-1;if((t?a:o)>=e)return l.lineInner(e,t,i,n);n=o+1,i=a+1}}decompose(e,t,i,n){for(let s=0,l=0;l<=t&&s<this.children.length;s++){let o=this.children[s],a=l+o.length;if(e<=a&&t>=l){let h=n&((l<=e?1:0)|(a>=t?2:0));l>=e&&a<=t&&!h?i.push(o):o.decompose(e-l,t-l,i,h)}l=a+1}}replace(e,t,i){if([e,t]=nn(this,e,t),i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let l=this.children[n],o=s+l.length;if(e>=s&&t<=o){let a=l.replace(e-s,t-s,i),h=this.lines-l.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new Bi(f,this.length-(t-e)+i.length)}return super.replace(s,o,a)}s=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=nn(this,e,t);let n="";for(let s=0,l=0;s<this.children.length&&l<=t;s++){let o=this.children[s],a=l+o.length;l>e&&s&&(n+=i),e<a&&t>l&&(n+=o.sliceString(e-l,t-l,i)),l=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Bi))return 0;let i=0,[n,s,l,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==l||s==o)return i;let a=this.children[n],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ut(d,t)}let n=Math.max(32,i>>5),s=n<<1,l=n>>1,o=[],a=0,h=-1,f=[];function c(d){let p;if(d.lines>s&&d instanceof Bi)for(let O of d.children)c(O);else d.lines>l&&(a>l||!a)?(u(),o.push(d)):d instanceof ut&&a&&(p=f[f.length-1])instanceof ut&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new ut(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(o.push(f.length==1?f[0]:Bi.from(f,h)),h=-1,a=f.length=0)}for(let d of e)c(d);return u(),o.length==1?o[0]:new Bi(o,t)}};F.empty=new ut([""],0);function w0(r){let e=-1;for(let t of r)e+=t.length+1;return e}function ys(r,e,t=0,i=1e9){for(let n=0,s=0,l=!0;s<r.length&&n<=i;s++){let o=r[s],a=n+o.length;a>=t&&(a>i&&(o=o.slice(0,i-n)),n<t&&(o=o.slice(t-n)),l?(e[e.length-1]+=o,l=!1):e.push(o)),n=a+1}return e}function xf(r,e,t){return ys(r,[""],e,t)}let qn=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ut?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],l=s>>1,o=n instanceof ut?n.text.length:n.children.length;if(l==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(n instanceof ut){let a=n.text[l+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[l+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ut?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},yd=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new qn(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},xd=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(F.prototype[Symbol.iterator]=function(){return this.iter()},qn.prototype[Symbol.iterator]=yd.prototype[Symbol.iterator]=xd.prototype[Symbol.iterator]=function(){return this});let $0=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function nn(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function ve(r,e,t=!0,i=!0){return x0(r,e,t,i)}function Q0(r){return r>=56320&&r<57344}function v0(r){return r>=55296&&r<56320}function P0(r,e){let t=r.charCodeAt(e);if(!v0(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return Q0(i)?(t-55296<<10)+(i-56320)+65536:t}function T0(r){return r<65536?1:2}const Xo=/\r\n?|\n/;var Ue=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Ue||(Ue={}));let Yi=class xs{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],l=this.sections[t++];l<0?(e(i,n,s),n+=s):n+=l,i+=s}}iterChangedRanges(e,t=!1){Eo(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new xs(e)}composeDesc(e){return this.empty?e:e.empty?this:kd(this,e)}mapDesc(e,t=!1){return e.empty?this:Lo(this,e,t)}mapPos(e,t=-1,i=Ue.Simple){let n=0,s=0;for(let l=0;l<this.sections.length;){let o=this.sections[l++],a=this.sections[l++],h=n+o;if(a<0){if(h>e)return s+(e-n);s+=o}else{if(i!=Ue.Simple&&h>=e&&(i==Ue.TrackDel&&n<e&&h>e||i==Ue.TrackBefore&&n<e||i==Ue.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!o)return e==n||t<0?s:s+a;s+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],l=this.sections[i++],o=n+s;if(l>=0&&n<=t&&o>=e)return n<e&&o>t?"cover":!0;n=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new xs(e)}static create(e){return new xs(e)}},gt=class ii extends Yi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Eo(this,(t,i,n,s,l)=>e=e.replace(n,n+(i-t),l),!1),e}mapDesc(e,t=!1){return Lo(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let l=t[n],o=t[n+1];if(o>=0){t[n]=o,t[n+1]=l;let a=n>>1;for(;i.length<a;)i.push(F.empty);i.push(l?e.slice(s,s+l):F.empty)}s+=l}return new ii(t,i)}compose(e){return this.empty?e:e.empty?this:kd(this,e,!0)}map(e,t=!1){return e.empty?this:Lo(this,e,t,!0)}iterChanges(e,t=!1){Eo(this,e,t)}get desc(){return Yi.create(this.sections)}filter(e){let t=[],i=[],n=[],s=new sr(this);e:for(let l=0,o=0;;){let a=l==e.length?1e9:e[l++];for(;o<a||o==a&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,a-o);$e(n,f,-1);let c=s.ins==-1?-1:s.off==0?s.ins:0;$e(t,f,c),c>0&&ai(i,t,s.text),s.forward(f),o+=f}let h=e[l++];for(;o<h;){if(s.done)break e;let f=Math.min(s.len,h-o);$e(t,f,-1),$e(n,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),o+=f}}return{changes:new ii(t,i),filtered:Yi.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let n=[],s=[],l=0,o=null;function a(f=!1){if(!f&&!n.length)return;l<t&&$e(n,t-l,-1);let c=new ii(n,s);o=o?o.compose(c.map(o)):c,n=[],s=[],l=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof ii){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);a(),o=o?o.compose(f.map(o)):f}else{let{from:c,to:u=c,insert:d}=f;if(c>u||c<0||u>t)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?F.of(d.split(i||Xo)):d:F.empty,O=p.length;if(c==u&&O==0)return;c<l&&a(),c>l&&$e(n,c-l,-1),$e(n,u-c,O),ai(s,n,p),l=u}}return h(e),a(!o),o}static empty(e){return new ii(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((l,o)=>o&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<n;)i.push(F.empty);i[n]=F.of(s.slice(1)),t.push(s[0],i[n].length)}}}return new ii(t,i)}static createSet(e,t){return new ii(e,t)}};function $e(r,e,t,i=!1){if(e==0&&t<=0)return;let n=r.length-2;n>=0&&t<=0&&t==r[n+1]?r[n]+=e:n>=0&&e==0&&r[n]==0?r[n+1]+=t:i?(r[n]+=e,r[n+1]+=t):r.push(e,t)}function ai(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<i;)r.push(F.empty);r.push(t)}}function Eo(r,e,t){let i=r.inserted;for(let n=0,s=0,l=0;l<r.sections.length;){let o=r.sections[l++],a=r.sections[l++];if(a<0)n+=o,s+=o;else{let h=n,f=s,c=F.empty;for(;h+=o,f+=a,a&&i&&(c=c.append(i[l-2>>1])),!(t||l==r.sections.length||r.sections[l+1]<0);)o=r.sections[l++],a=r.sections[l++];e(n,h,s,f,c),n=h,s=f}}}function Lo(r,e,t,i=!1){let n=[],s=i?[]:null,l=new sr(r),o=new sr(e);for(let a=-1;;){if(l.done&&o.len||o.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&o.ins==-1){let h=Math.min(l.len,o.len);$e(n,h,-1),l.forward(h),o.forward(h)}else if(o.ins>=0&&(l.ins<0||a==l.i||l.off==0&&(o.len<l.len||o.len==l.len&&!t))){let h=o.len;for($e(n,o.ins,-1);h;){let f=Math.min(l.len,h);l.ins>=0&&a<l.i&&l.len<=f&&($e(n,0,l.ins),s&&ai(s,n,l.text),a=l.i),l.forward(f),h-=f}o.next()}else if(l.ins>=0){let h=0,f=l.len;for(;f;)if(o.ins==-1){let c=Math.min(f,o.len);h+=c,f-=c,o.forward(c)}else if(o.ins==0&&o.len<f)f-=o.len,o.next();else break;$e(n,h,a<l.i?l.ins:0),s&&a<l.i&&ai(s,n,l.text),a=l.i,l.forward(l.len-f)}else{if(l.done&&o.done)return s?gt.createSet(n,s):Yi.create(n);throw new Error("Mismatched change set lengths")}}}function kd(r,e,t=!1){let i=[],n=t?[]:null,s=new sr(r),l=new sr(e);for(let o=!1;;){if(s.done&&l.done)return n?gt.createSet(i,n):Yi.create(i);if(s.ins==0)$e(i,s.len,0,o),s.next();else if(l.len==0&&!l.done)$e(i,0,l.ins,o),n&&ai(n,i,l.text),l.next();else{if(s.done||l.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,l.len),h=i.length;if(s.ins==-1){let f=l.ins==-1?-1:l.off?0:l.ins;$e(i,a,f,o),n&&f&&ai(n,i,l.text)}else l.ins==-1?($e(i,s.off?0:s.len,a,o),n&&ai(n,i,s.textBit(a))):($e(i,s.off?0:s.len,l.off?0:l.ins,o),n&&!l.off&&ai(n,i,l.text));o=(s.ins>a||l.ins>=0&&l.len>a)&&(o||i.length>h),s.forward2(a),l.forward(a)}}}}let sr=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?F.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?F.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Ir=class Bo{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new Bo(i,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return T.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return T.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return T.range(e.anchor,e.head)}static create(e,t,i){return new Bo(e,t,i)}},T=class qe{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:qe.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new qe([this.main],0)}addRange(e,t=!0){return qe.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,qe.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new qe(e.ranges.map(t=>Ir.fromJSON(t)),e.main)}static single(e,t=e){return new qe([qe.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=i:s.from<i)return qe.normalized(e.slice(),t);i=s.to}return new qe(e,t)}static cursor(e,t=0,i,n){return Ir.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,t,i,n){let s=(i??16777215)<<6|(n==null?7:Math.min(6,n));return t<e?Ir.create(t,e,48|s):Ir.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(i);for(let n=1;n<e.length;n++){let s=e[n],l=e[n-1];if(s.empty?s.from<=l.to:s.from<l.to){let o=l.from,a=Math.max(s.to,l.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?qe.range(a,o):qe.range(o,a))}}return new qe(e,t)}};function wd(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Oh=0,E=class $d{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=Oh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new $d(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:gh),!!e.static,e.enables)}of(e){return new ks([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ks(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ks(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function gh(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}let ks=class{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=Oh++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,l=e[s]>>1,o=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?h=!0:(((t=e[c.id])!==null&&t!==void 0?t:1)&1)==0&&f.push(e[c.id]);return{create(c){return c.values[l]=i(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Do(c,f)){let d=i(c);if(o?!kf(d,c.values[l],n):!n(d,c.values[l]))return c.values[l]=d,1}return 0},reconfigure:(c,u)=>{let d,p=u.config.address[s];if(p!=null){let O=Ws(u,p);if(this.dependencies.every(g=>g instanceof E?u.facet(g)===c.facet(g):g instanceof Ri?u.field(g,!1)==c.field(g,!1):!0)||(o?kf(d=i(c),O,n):n(d=i(c),O)))return c.values[l]=O,0}else d=i(c);return c.values[l]=d,1}}}};function kf(r,e,t){if(r.length!=e.length)return!1;for(let i=0;i<r.length;i++)if(!t(r[i],e[i]))return!1;return!0}function Do(r,e){let t=!1;for(let i of e)Nn(r,i)&1&&(t=!0);return t}function C0(r,e,t){let i=t.map(a=>r[a.id]),n=t.map(a=>a.type),s=i.filter(a=>!(a&1)),l=r[e.id]>>1;function o(a){let h=[];for(let f=0;f<i.length;f++){let c=Ws(a,i[f]);if(n[f]==2)for(let u of c)h.push(u);else h.push(c)}return e.combine(h)}return{create(a){for(let h of i)Nn(a,h);return a.values[l]=o(a),1},update(a,h){if(!Do(a,s))return 0;let f=o(a);return e.compare(f,a.values[l])?0:(a.values[l]=f,1)},reconfigure(a,h){let f=Do(a,i),c=h.config.facets[e.id],u=h.facet(e);if(c&&!f&&gh(t,c))return a.values[l]=u,0;let d=o(a);return e.compare(d,u)?(a.values[l]=u,0):(a.values[l]=d,1)}}}const Vr=E.define({static:!0});let Ri=class Qd{constructor(e,t,i,n,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new Qd(Oh++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Vr).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let s=i.values[t],l=this.updateF(s,n);return this.compareF(s,l)?0:(i.values[t]=l,1)},reconfigure:(i,n)=>{let s=i.facet(Vr),l=n.facet(Vr),o;return(o=s.find(a=>a.field==this))&&o!=l.find(a=>a.field==this)?(i.values[t]=o.create(i),1):n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Vr.of({field:this,create:e})]}get extension(){return this}};const ki={lowest:4,low:3,default:2,high:1,highest:0};function vn(r){return e=>new vd(e,r)}const mh={highest:vn(ki.highest),high:vn(ki.high),default:vn(ki.default),low:vn(ki.low),lowest:vn(ki.lowest)};let vd=class{constructor(e,t){this.inner=e,this.prec=t}},Pd=class Td{of(e){return new Wo(this,e)}reconfigure(e){return Td.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Wo=class{constructor(e,t){this.compartment=e,this.inner=t}},wf=class Cd{constructor(e,t,i,n,s,l){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=l,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let n=[],s=Object.create(null),l=new Map;for(let u of A0(e,t,l))u instanceof Ri?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let o=Object.create(null),a=[],h=[];for(let u of n)o[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=i?.config.facets;for(let u in s){let d=s[u],p=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(o[p.id]=a.length<<1|1,gh(O,d))a.push(i.facet(p));else{let g=p.combine(d.map(m=>m.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(o[g.id]=a.length<<1|1,a.push(g.value)):(o[g.id]=h.length<<1,h.push(m=>g.dynamicSlot(m)));o[p.id]=h.length<<1,h.push(g=>C0(g,p,d))}}let c=h.map(u=>u(o));return new Cd(e,l,c,o,a,s)}};function A0(r,e,t){let i=[[],[],[],[],[]],n=new Map;function s(l,o){let a=n.get(l);if(a!=null){if(a<=o)return;let h=i[a].indexOf(l);h>-1&&i[a].splice(h,1),l instanceof Wo&&t.delete(l.compartment)}if(n.set(l,o),Array.isArray(l))for(let h of l)s(h,o);else if(l instanceof Wo){if(t.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;t.set(l.compartment,h),s(h,o)}else if(l instanceof vd)s(l.inner,l.prec);else if(l instanceof Ri)i[o].push(l),l.provides&&s(l.provides,o);else if(l instanceof ks)i[o].push(l),l.facet.extensions&&s(l.facet.extensions,ki.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,o)}}return s(r,ki.default),i.reduce((l,o)=>l.concat(o))}function Nn(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let n=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|n}function Ws(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Ad=E.define(),zo=E.define({combine:r=>r.some(e=>e),static:!0}),Md=E.define({combine:r=>r.length?r[0]:void 0,static:!0}),Rd=E.define(),Zd=E.define(),Xd=E.define(),Ed=E.define({combine:r=>r.length?r[0]:!1});let gi=class{constructor(e,t){this.type=e,this.value=t}static define(){return new M0}},M0=class{of(e){return new gi(this,e)}},R0=class{constructor(e){this.map=e}of(e){return new Oe(this,e)}},Oe=class Ld{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ld(this.type,t)}is(e){return this.type==e}static define(e={}){return new R0(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let s=n.map(t);s&&i.push(s)}return i}};Oe.reconfigure=Oe.define();Oe.appendConfig=Oe.define();let Ie=class Bn{constructor(e,t,i,n,s,l){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=l,this._doc=null,this._state=null,i&&wd(i,t.newLength),s.some(o=>o.type==Bn.time)||(this.annotations=s.concat(Bn.time.of(Date.now())))}static create(e,t,i,n,s,l){return new Bn(e,t,i,n,s,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Bn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Ie.time=gi.define();Ie.userEvent=gi.define();Ie.addToHistory=gi.define();Ie.remote=gi.define();function Z0(r,e){let t=[];for(let i=0,n=0;;){let s,l;if(i<r.length&&(n==e.length||e[n]>=r[i]))s=r[i++],l=r[i++];else if(n<e.length)s=e[n++],l=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,l):t[t.length-1]<l&&(t[t.length-1]=l)}}function Bd(r,e,t){var i;let n,s,l;return t?(n=e.changes,s=gt.empty(e.changes.length),l=r.changes.compose(e.changes)):(n=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),l=r.changes.compose(n)),{changes:l,selection:e.selection?e.selection.map(s):(i=r.selection)===null||i===void 0?void 0:i.map(n),effects:Oe.mapEffects(r.effects,n).concat(Oe.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Io(r,e,t){let i=e.selection,n=_i(e.annotations);return e.userEvent&&(n=n.concat(Ie.userEvent.of(e.userEvent))),{changes:e.changes instanceof gt?e.changes:gt.of(e.changes||[],t,r.facet(Md)),selection:i&&(i instanceof T?i:T.single(i.anchor,i.head)),effects:_i(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function Dd(r,e,t){let i=Io(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let l=!!e[s].sequential;i=Bd(i,Io(r,e[s],l?i.changes.newLength:r.doc.length),l)}let n=Ie.create(r,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return E0(t?X0(n):n)}function X0(r){let e=r.startState,t=!0;for(let n of e.facet(Rd)){let s=n(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Z0(t,s))}if(t!==!0){let n,s;if(t===!1)s=r.changes.invertedDesc,n=gt.empty(e.doc.length);else{let l=r.changes.filter(t);n=l.changes,s=l.filtered.mapDesc(l.changes).invertedDesc}r=Ie.create(e,n,r.selection&&r.selection.map(s),Oe.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let i=e.facet(Zd);for(let n=i.length-1;n>=0;n--){let s=i[n](r);s instanceof Ie?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ie?r=s[0]:r=Dd(e,_i(s),!1)}return r}function E0(r){let e=r.startState,t=e.facet(Xd),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Bd(i,Io(e,s,r.changes.newLength),!0))}return i==r?r:Ie.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const L0=[];function _i(r){return r==null?L0:Array.isArray(r)?r:[r]}var qt=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(qt||(qt={}));const B0=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Vo;try{Vo=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function D0(r){if(Vo)return Vo.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||B0.test(t)))return!0}return!1}function W0(r){return e=>{if(!/\S/.test(e))return qt.Space;if(D0(e))return qt.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return qt.Word;return qt.Other}}let ge=class ht{constructor(e,t,i,n,s,l){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,l&&(l._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Nn(this,o<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Nn(this,i),Ws(this,i)}update(...e){return Dd(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let o of e.effects)o.is(Pd.reconfigure)?(t&&(n=new Map,t.compartments.forEach((a,h)=>n.set(h,a)),t=null),n.set(o.value.compartment,o.value.extension)):o.is(Oe.reconfigure)?(t=null,i=o.value):o.is(Oe.appendConfig)&&(t=null,i=_i(i).concat(o.value));let s;t?s=e.startState.values.slice():(t=wf.resolve(i,n,this),s=new ht(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let l=e.startState.facet(zo)?e.newSelection:e.newSelection.asSingle();new ht(t,e.newDoc,l,s,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:T.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],l=_i(i.effects);for(let o=1;o<t.ranges.length;o++){let a=e(t.ranges[o]),h=this.changes(a.changes),f=h.map(n);for(let u=0;u<o;u++)s[u]=s[u].map(f);let c=n.mapDesc(h,!0);s.push(a.range.map(c)),n=n.compose(f),l=Oe.mapEffects(l,f).concat(Oe.mapEffects(_i(a.effects),c))}return{changes:n,selection:T.create(s,t.mainIndex),effects:l}}changes(e=[]){return e instanceof gt?e:gt.of(e,this.doc.length,this.facet(ht.lineSeparator))}toText(e){return F.of(e.split(this.facet(ht.lineSeparator)||Xo))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Nn(this,t),Ws(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof Ri&&this.config.address[n.id]!=null&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let l=i[s],o=e[s];n.push(l.init(a=>l.spec.fromJSON(o,a)))}}return ht.create({doc:e.doc,selection:T.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=wf.resolve(e.extensions||[],new Map),i=e.doc instanceof F?e.doc:F.of((e.doc||"").split(t.staticFacet(ht.lineSeparator)||Xo)),n=e.selection?e.selection instanceof T?e.selection:T.single(e.selection.anchor,e.selection.head):T.single(0);return wd(n,i.length),t.staticFacet(zo)||(n=n.asSingle()),new ht(t,i,n,t.dynamicSlots.map(()=>null),(s,l)=>l.create(s),null)}get tabSize(){return this.facet(ht.tabSize)}get lineBreak(){return this.facet(ht.lineSeparator)||`
@@ -31,4 +31,4 @@ import{r as Ei,j as mf,c as g0}from"./index-D6FUvVB1.js";import{r as m0,s as S0,
31
31
  constructor(\${params}) {
32
32
  \${}
33
33
  }
34
- }`,{label:"class",detail:"definition",type:"keyword"}),Be('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Be('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ov=Ym.concat([Be("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Be("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Be("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),rd=new lO,_m=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Xn(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}const av=["FunctionDeclaration"],hv={FunctionDeclaration:Xn("function"),ClassDeclaration:Xn("class"),ClassExpression:()=>!0,EnumDeclaration:Xn("constant"),TypeAliasDeclaration:Xn("type"),NamespaceDeclaration:Xn("namespace"),VariableDefinition(r,e){r.matchContext(av)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function qm(r,e){let t=rd.get(e);if(t)return t;let i=[],n=!0;function s(l,o){let a=r.sliceString(l.from,l.to);i.push({label:a,type:o})}return e.cursor(H.IncludeAnonymous).iterate(l=>{if(n)n=!1;else if(l.name){let o=hv[l.name];if(o&&o(l,s)||_m.has(l.name))return!1}else if(l.to-l.from>8192){for(let o of qm(r,l.node))i.push(o);return!1}}),rd.set(e,i),i}const sd=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Nm=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function fv(r){let e=ne(r.state).resolveInner(r.pos,-1);if(Nm.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&sd.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let n=e;n;n=n.parent)_m.has(n.name)&&(i=i.concat(qm(r.state.doc,n)));return{options:i,from:t?e.from:r.pos,validFor:sd}}const Lt=an.define({name:"javascript",parser:lv.configure({props:[Zr.add({IfStatement:Ms({except:/^\s*({|else\b)/}),TryStatement:Ms({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Rb,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Mb({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ms({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),Xr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pO,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Gm={test:r=>/^JSX/.test(r.name),facet:Eh({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Fm=Lt.configure({dialect:"ts"},"typescript"),Um=Lt.configure({dialect:"jsx",props:[Lh.add(r=>r.isTop?[Gm]:void 0)]}),Hm=Lt.configure({dialect:"jsx ts",props:[Lh.add(r=>r.isTop?[Gm]:void 0)]},"typescript");let Km=r=>({label:r,type:"keyword"});const Jm="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Km),cv=Jm.concat(["declare","implements","private","protected","public"].map(Km));function uv(r={}){let e=r.jsx?r.typescript?Hm:Um:r.typescript?Fm:Lt,t=r.typescript?ov.concat(cv):Ym.concat(Jm);return new Or(e,[Lt.data.of({autocomplete:Ow(Nm,pw(t))}),Lt.data.of({autocomplete:fv}),r.jsx?Ov:[]])}function dv(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function ld(r,e,t=r.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}const pv=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ov=V.inputHandler.of((r,e,t,i,n)=>{if((pv?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Lt.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:l}=s,o=l.changeByRange(a=>{var h;let{head:f}=a,c=ne(l).resolveInner(f-1,-1),u;if(c.name=="JSXStartTag"&&(c=c.parent),!(l.doc.sliceString(f-1,f)!=i||c.name=="JSXAttributeValue"&&c.to>f)){if(i==">"&&c.name=="JSXFragmentTag")return{range:a,changes:{from:f,insert:"</>"}};if(i=="/"&&c.name=="JSXStartCloseTag"){let d=c.parent,p=d.parent;if(p&&d.from==f-2&&((u=ld(l.doc,p.firstChild,f))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let O=`${u}>`;return{range:P.cursor(f+O.length,-1),changes:{from:f,insert:O}}}}else if(i==">"){let d=dv(c);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(l.doc.sliceString(f,f+2))&&(u=ld(l.doc,d,f)))return{range:a,changes:{from:f,insert:`</${u}>`}}}}return{range:a}});return o.changes.empty?!1:(r.dispatch([s,l.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),En=["_blank","_self","_top","_parent"],Po=["ascii","utf-8","utf-16","latin1","latin1"],To=["get","post","put","delete"],Co=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],_e=["true","false"],Z={},gv={a:{attrs:{href:null,ping:null,type:null,media:null,target:En,hreflang:null}},abbr:Z,address:Z,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Z,aside:Z,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Z,base:{attrs:{href:null,target:En}},bdi:Z,bdo:Z,blockquote:{attrs:{cite:null}},body:Z,br:Z,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Co,formmethod:To,formnovalidate:["novalidate"],formtarget:En,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Z,center:Z,cite:Z,code:Z,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Z,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Z,div:Z,dl:Z,dt:Z,em:Z,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Z,figure:Z,footer:Z,form:{attrs:{action:null,name:null,"accept-charset":Po,autocomplete:["on","off"],enctype:Co,method:To,novalidate:["novalidate"],target:En}},h1:Z,h2:Z,h3:Z,h4:Z,h5:Z,h6:Z,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Z,hgroup:Z,hr:Z,html:{attrs:{manifest:null}},i:Z,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Co,formmethod:To,formnovalidate:["novalidate"],formtarget:En,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Z,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Z,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Z,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Po,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Z,noscript:Z,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Z,param:{attrs:{name:null,value:null}},pre:Z,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Z,rt:Z,ruby:Z,samp:Z,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Po}},section:Z,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Z,source:{attrs:{src:null,type:null,media:null}},span:Z,strong:Z,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Z,summary:Z,sup:Z,table:Z,tbody:Z,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Z,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Z,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Z,time:{attrs:{datetime:null}},title:Z,tr:Z,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Z,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Z},e0={accesskey:null,class:null,contenteditable:_e,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:_e,autocorrect:_e,autocapitalize:_e,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":_e,"aria-autocomplete":["inline","list","both","none"],"aria-busy":_e,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":_e,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":_e,"aria-hidden":_e,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":_e,"aria-multiselectable":_e,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":_e,"aria-relevant":null,"aria-required":_e,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},t0="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of t0)e0[r]=null;class Tr{constructor(e,t){this.tags={...gv,...e},this.globalAttrs={...e0,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Tr.default=new Tr;function Sn(r,e,t=r.length){if(!e)return"";let i=e.firstChild,n=i&&i.getChild("TagName");return n?r.sliceString(n.from,Math.min(n.to,t)):""}function bn(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function i0(r,e,t){let i=t.tags[Sn(r,bn(e))];return i?.children||t.allTags}function pf(r,e){let t=[];for(let i=bn(e);i&&!i.type.isTop;i=bn(i.parent)){let n=Sn(r,i);if(n&&i.lastChild.name=="CloseTag")break;n&&t.indexOf(n)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(n)}return t}const n0=/^[:\-\.\w\u00b7-\uffff]*$/;function od(r,e,t,i,n){let s=/\s*>/.test(r.sliceDoc(n,n+5))?"":">",l=bn(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:n,options:i0(r.doc,l,e).map(o=>({label:o,type:"type"})).concat(pf(r.doc,t).map((o,a)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function ad(r,e,t,i){let n=/\s*>/.test(r.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:pf(r.doc,e).map((s,l)=>({label:s,apply:s+n,type:"type",boost:99-l})),validFor:n0}}function mv(r,e,t,i){let n=[],s=0;for(let l of i0(r.doc,t,e))n.push({label:"<"+l,type:"type"});for(let l of pf(r.doc,t))n.push({label:"</"+l+">",type:"type",boost:99-s++});return{from:i,to:i,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Sv(r,e,t,i,n){let s=bn(t),l=s?e.tags[Sn(r.doc,s)]:null,o=l&&l.attrs?Object.keys(l.attrs):[],a=l&&l.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:n,options:a.map(h=>({label:h,type:"property"})),validFor:n0}}function bv(r,e,t,i,n){var s;let l=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],a;if(l){let h=r.sliceDoc(l.from,l.to),f=e.globalAttrs[h];if(!f){let c=bn(t),u=c?e.tags[Sn(r.doc,c)]:null;f=u?.attrs&&u.attrs[h]}if(f){let c=r.sliceDoc(i,n).toLowerCase(),u='"',d='"';/^['"]/.test(c)?(a=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",d=r.sliceDoc(n,n+1)==c[0]?"":c[0],c=c.slice(1),i++):a=/^[^\s<>='"]*$/;for(let p of f)o.push({label:p,apply:u+p+d,type:"constant"})}}return{from:i,to:n,options:o,validFor:a}}function r0(r,e){let{state:t,pos:i}=e,n=ne(t).resolveInner(i,-1),s=n.resolve(i);for(let l=i,o;s==n&&(o=n.childBefore(l));){let a=o.lastChild;if(!a||!a.type.isError||a.from<a.to)break;s=n=o,l=a.from}return n.name=="TagName"?n.parent&&/CloseTag$/.test(n.parent.name)?ad(t,n,n.from,i):od(t,r,n,n.from,i):n.name=="StartTag"||n.name=="IncompleteTag"?od(t,r,n,i,i):n.name=="StartCloseTag"||n.name=="IncompleteCloseTag"?ad(t,n,i,i):n.name=="OpenTag"||n.name=="SelfClosingTag"||n.name=="AttributeName"?Sv(t,r,n,n.name=="AttributeName"?n.from:i,i):n.name=="Is"||n.name=="AttributeValue"||n.name=="UnquotedAttributeValue"?bv(t,r,n,n.name=="Is"?i:n.from,i):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?mv(t,r,n,i):null}function yv(r){return r0(Tr.default,r)}function xv(r){let{extraTags:e,extraGlobalAttributes:t}=r,i=t||e?new Tr(e,t):Tr.default;return n=>r0(i,n)}const kv=Lt.parser.configure({top:"SingleExpression"}),s0=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:Fm.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:Um.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:Hm.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:kv},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:Lt.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:yl.parser}],l0=[{name:"style",parser:yl.parser.configure({top:"Styles"})}].concat(t0.map(r=>({name:r,parser:Lt.parser}))),o0=an.define({name:"html",parser:N$.configure({props:[Zr.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].length<r.node.to)return r.continue();let e=null,t;for(let i=r.node;;){let n=i.lastChild;if(!n||n.name!="Element"||n.to!=i.to)break;e=i=n}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?r.lineIndent(e.from)+r.unit:null}}),Xr.add({Element(r){let e=r.firstChild,t=r.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:r.to}}}),OO.add({"OpenTag CloseTag":r=>r.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Ds=o0.configure({wrap:Bm(s0,l0)});function wv(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=Bm((r.nestedLanguages||[]).concat(s0),(r.nestedAttributes||[]).concat(l0)));let i=t?o0.configure({wrap:t,dialect:e}):e?Ds.configure({dialect:e}):Ds;return new Or(i,[Ds.data.of({autocomplete:xv(r)}),r.autoCloseTags!==!1?$v:[],uv().support,CQ().support])}const hd=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),$v=V.inputHandler.of((r,e,t,i,n)=>{if(r.composing||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Ds.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:l}=s,o=l.changeByRange(a=>{var h,f,c;let u=l.doc.sliceString(a.from-1,a.to)==i,{head:d}=a,p=ne(l).resolveInner(d,-1),O;if(u&&i==">"&&p.name=="EndTag"){let g=p.parent;if(((f=(h=g.parent)===null||h===void 0?void 0:h.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(O=Sn(l.doc,g.parent,d))&&!hd.has(O)){let m=d+(l.doc.sliceString(d,d+1)===">"?1:0),b=`</${O}>`;return{range:a,changes:{from:d,to:m,insert:b}}}}else if(u&&i=="/"&&p.name=="IncompleteCloseTag"){let g=p.parent;if(p.from==d-2&&((c=g.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(O=Sn(l.doc,g,d))&&!hd.has(O)){let m=d+(l.doc.sliceString(d,d+1)===">"?1:0),b=`${O}>`;return{range:P.cursor(d+b.length,-1),changes:{from:d,to:m,insert:b}}}}return{range:a}});return o.changes.empty?!1:(r.dispatch([s,l.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),a0=Eh({commentTokens:{block:{open:"<!--",close:"-->"}}}),h0=new q,f0=Iw.configure({props:[Xr.add(r=>!r.is("Block")||r.is("Document")||ph(r)!=null||Qv(r)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),h0.add(ph),Zr.add({Document:()=>null}),Ii.add({Document:a0})]});function ph(r){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(r.name);return e?+e[1]:void 0}function Qv(r){return r.name=="OrderedList"||r.name=="BulletList"}function vv(r,e){let t=r;for(;;){let i=t.nextSibling,n;if(!i||(n=ph(i.type))!=null&&n<=e)break;t=i}return t.to}const Pv=Zb.of((r,e,t)=>{for(let i=ne(r).resolveInner(t,-1);i&&!(i.from<e);i=i.parent){let n=i.type.prop(h0);if(n==null)continue;let s=vv(i,n);if(s>t)return{from:t,to:s}}return null});function Of(r){return new et(a0,r,[],"markdown")}const Tv=Of(f0),Cv=f0.configure([Kw,e$,Jw,t$,{props:[Xr.add({Table:(r,e)=>({from:e.doc.lineAt(r.from).to,to:r.to})})]}]),Cr=Of(Cv);function Av(r,e){return t=>{if(t&&r){let i=null;if(t=/\S*/.exec(t)[0],typeof r=="function"?i=r(t):i=Ks.matchLanguageName(r,t,!0),i instanceof Ks)return i.support?i.support.language.parser:pr.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}class Ao{constructor(e,t,i,n,s,l,o){this.node=e,this.from=t,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=l,this.item=o}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length<e;)i+=" ";return i}else{for(let n=this.to-this.from-i.length-this.spaceAfter.length;n>0;n--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+u0(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function c0(r,e){let t=[],i=[];for(let n=r;n;n=n.parent){if(n.name=="FencedCode")return i;(n.name=="ListItem"||n.name=="Blockquote")&&t.push(n)}for(let n=t.length-1;n>=0;n--){let s=t[n],l,o=e.lineAt(s.from),a=s.from-o.from;if(s.name=="Blockquote"&&(l=/^ *>( ?)/.exec(o.text.slice(a))))i.push(new Ao(s,a,a+l[0].length,"",l[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(l=/^( *)\d+([.)])( *)/.exec(o.text.slice(a)))){let h=l[3],f=l[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),i.push(new Ao(s.parent,a,a+f,l[1],h,l[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(l=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(a)))){let h=l[4],f=l[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let c=l[2];l[3]&&(c+=l[3].replace(/[xX]/," ")),i.push(new Ao(s.parent,a,a+f,l[1],h,c,s))}}return i}function u0(r,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(r.from,r.from+10))}function Mo(r,e,t,i=0){for(let n=-1,s=r;;){if(s.name=="ListItem"){let o=u0(s,e),a=+o[2];if(n>=0){if(a!=n+1)return;t.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(n+2+i)})}n=a}let l=s.nextSibling;if(!l)break;s=l}}function gf(r,e){let t=/^[ \t]*/.exec(r)[0].length;if(!t||e.facet(Rr)!=" ")return r;let i=br(r,4,t),n="";for(let s=i;s>0;)s>=4?(n+=" ",s-=4):(n+=" ",s--);return n+r.slice(t)}const Mv=(r={})=>({state:e,dispatch:t})=>{let i=ne(e),{doc:n}=e,s=null,l=e.changeByRange(o=>{if(!o.empty||!Cr.isActiveAt(e,o.from,-1)&&!Cr.isActiveAt(e,o.from,1))return s={range:o};let a=o.from,h=n.lineAt(a),f=c0(i.resolveInner(a,-1),n);for(;f.length&&f[f.length-1].from>a-h.from;)f.pop();if(!f.length)return s={range:o};let c=f[f.length-1];if(c.to-c.spaceAfter.length>a-h.from)return s={range:o};let u=a>=c.to-c.spaceAfter.length&&!/\S/.test(h.text.slice(c.to));if(c.item&&u){let m=c.node.firstChild,b=c.node.getChild("ListItem","ListItem");if(m.to>=a||b&&b.to<a||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)||r.nonTightLists===!1){let y=f.length>1?f[f.length-2]:null,C,k="";y&&y.item?(C=h.from+y.from,k=y.marker(n,1)):C=h.from+(y?y.to:0);let w=[{from:C,to:a,insert:k}];return c.node.name=="OrderedList"&&Mo(c.item,n,w,-2),y&&y.node.name=="OrderedList"&&Mo(y.item,n,w),{range:P.cursor(C+k.length),changes:w}}else{let y=cd(f,e,h);return{range:P.cursor(a+y.length+1),changes:{from:h.from,insert:y+e.lineBreak}}}}if(c.node.name=="Blockquote"&&u&&h.from){let m=n.lineAt(h.from-1),b=/>\s*$/.exec(m.text);if(b&&b.index==c.from){let y=e.changes([{from:m.from+b.index,to:m.to},{from:h.from+c.from,to:h.to}]);return{range:o.map(y),changes:y}}}let d=[];c.node.name=="OrderedList"&&Mo(c.item,n,d);let p=c.item&&c.item.from<h.from,O="";if(!p||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=c.to)for(let m=0,b=f.length-1;m<=b;m++)O+=m==b&&!p?f[m].marker(n,1):f[m].blank(m<b?br(h.text,4,f[m+1].from)-O.length:null);let g=a;for(;g>h.from&&/\s/.test(h.text.charAt(g-h.from-1));)g--;return O=gf(O,e),Zv(c.node,e.doc)&&(O=cd(f,e,h)+e.lineBreak+O),d.push({from:g,to:a,insert:e.lineBreak+O}),{range:P.cursor(g+O.length+1),changes:d}});return s?!1:(t(e.update(l,{scrollIntoView:!0,userEvent:"input"})),!0)},Rv=Mv();function fd(r){return r.name=="QuoteMark"||r.name=="ListMark"}function Zv(r,e){if(r.name!="OrderedList"&&r.name!="BulletList")return!1;let t=r.firstChild,i=r.getChild("ListItem","ListItem");if(!i)return!1;let n=e.lineAt(t.to),s=e.lineAt(i.from),l=/^[\s>]*$/.test(n.text);return n.number+(l?0:1)<s.number}function cd(r,e,t){let i="";for(let n=0,s=r.length-2;n<=s;n++)i+=r[n].blank(n<s?br(t.text,4,r[n+1].from)-i.length:null,n<s);return gf(i,e)}function Xv(r,e){let t=r.resolveInner(e,-1),i=e;fd(t)&&(i=t.from,t=t.parent);for(let n;n=t.childBefore(i);)if(fd(n))i=n.from;else if(n.name=="OrderedList"||n.name=="BulletList")t=n.lastChild,i=t.to;else break;return t}const Ev=({state:r,dispatch:e})=>{let t=ne(r),i=null,n=r.changeByRange(s=>{let l=s.from,{doc:o}=r;if(s.empty&&Cr.isActiveAt(r,s.from)){let a=o.lineAt(l),h=c0(Xv(t,l),o);if(h.length){let f=h[h.length-1],c=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(l-a.from>c&&!/\S/.test(a.text.slice(c,l-a.from)))return{range:P.cursor(a.from+c),changes:{from:a.from+c,to:l}};if(l-a.from==c&&(f.item&&a.from<=f.item.from||/^[\s>]*$/.test(a.text.slice(0,f.to)))){let u=a.from+f.from;if(f.item&&f.node.from<f.item.from&&/\S/.test(a.text.slice(f.from,f.to))){let d=f.blank(br(a.text,4,f.to)-br(a.text,4,f.from));return u==a.from&&(d=gf(d,r)),{range:P.cursor(u+d.length),changes:{from:u,to:a.from+f.to,insert:d}}}if(u<l)return{range:P.cursor(u),changes:{from:u,to:l}}}}}return i={range:s}});return i?!1:(e(r.update(n,{scrollIntoView:!0,userEvent:"delete"})),!0)},Lv=[{key:"Enter",run:Rv},{key:"Backspace",run:Ev}],d0=wv({matchClosingTags:!1});function Bv(r={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:i=!0,base:{parser:n}=Tv,completeHTMLTags:s=!0,pasteURLAsLink:l=!0,htmlTagLanguage:o=d0}=r;if(!(n instanceof Wl))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let a=r.extensions?[r.extensions]:[],h=[o.support,Pv],f;l&&h.push(Iv),t instanceof Or?(h.push(t.support),f=t.language):t&&(f=t);let c=e||f?Av(e,f):void 0;a.push(jw({codeParser:c,htmlParser:o.language.parser})),i&&h.push(Rl.high(tf.of(Lv)));let u=Of(n.configure(a));return s&&h.push(u.data.of({autocomplete:Dv})),new Or(u,h)}function Dv(r){let{state:e,pos:t}=r,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!i)return null;let n=ne(e).resolveInner(t,-1);for(;n&&!n.type.isTop;){if(n.name=="CodeBlock"||n.name=="FencedCode"||n.name=="ProcessingInstructionBlock"||n.name=="CommentBlock"||n.name=="Link"||n.name=="Image")return null;n=n.parent}return{from:t-i[0].length,to:t,options:Wv(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Ro=null;function Wv(){if(Ro)return Ro;let r=yv(new uw(ie.create({extensions:d0}),0,!0));return Ro=r?r.options:[]}const zv=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Iv=V.domEventHandlers({paste:(r,e)=>{var t;let{main:i}=e.state.selection;if(i.empty)return!1;let n=(t=r.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!n||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(n)||(/^www\./.test(n)&&(n="https://"+n),!Cr.isActiveAt(e.state,i.from,1)))return!1;let s=ne(e.state),l=!1;return s.iterate({from:i.from,to:i.to,enter:o=>{(o.from>i.from||zv.test(o.name))&&(l=!0)},leave:o=>{o.to<i.to&&(l=!0)}}),l?!1:(e.dispatch({changes:[{from:i.from,insert:"["},{from:i.to,insert:`](${n})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),Ln=N.replace({}),Vv=[N.mark({class:"cm-md-h1"}),N.mark({class:"cm-md-h2"}),N.mark({class:"cm-md-h3"}),N.mark({class:"cm-md-h4"}),N.mark({class:"cm-md-h5"}),N.mark({class:"cm-md-h6"})],jv=N.mark({class:"cm-md-strong"}),Yv=N.mark({class:"cm-md-emphasis"}),_v=N.mark({class:"cm-md-strike"}),qv=N.mark({class:"cm-md-code"});N.mark({class:"cm-md-link"});const Nv=N.line({class:"cm-md-quote"}),Gv=N.line({class:"cm-md-codeblock"});class Fv extends yn{eq(){return!0}toDOM(){const e=document.createElement("span");return e.className="cm-md-bullet",e.textContent="•",e}ignoreEvent(){return!1}}const Uv=N.replace({widget:new Fv});function p0(r,e,t){for(const i of r.selection.ranges)if(i.from<=t&&i.to>=e)return!0;return!1}function Li(r,e){const t=r.state.doc.lineAt(e);return p0(r.state,t.from,t.to)}function ud(r){const e=[],t=hO(r.state,r.state.doc.length,200)??ne(r.state);for(const{from:n,to:s}of r.visibleRanges)t.iterate({from:n,to:s,enter:l=>{const o=l.name;if(o==="Table")return!1;if(/^ATXHeading[1-6]$/.test(o)){const a=Number(o.slice(-1))-1;e.push(Vv[a].range(l.from,l.to));return}if(o==="HeaderMark"){if(!Li(r,l.from)){const a=r.state.doc.sliceString(l.to,l.to+1)===" "?l.to+1:l.to;e.push(Ln.range(l.from,a))}return}if(o==="StrongEmphasis"){e.push(jv.range(l.from,l.to));return}if(o==="Emphasis"){e.push(Yv.range(l.from,l.to));return}if(o==="Strikethrough"){e.push(_v.range(l.from,l.to));return}if(o==="InlineCode"){e.push(qv.range(l.from,l.to));return}if(o==="EmphasisMark"||o==="CodeMark"||o==="StrikethroughMark"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}if(o==="QuoteMark"){if(!Li(r,l.from)){const a=r.state.doc.sliceString(l.to,l.to+1)===" "?l.to+1:l.to;e.push(Ln.range(l.from,a))}return}if(o==="ListMark"){const a=r.state.doc.lineAt(l.from).text;/^\s*[-*+]\s/.test(a)&&!Li(r,l.from)&&e.push(Uv.range(l.from,l.to));return}if(o==="LinkMark"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}if(o==="URL"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}}});for(const{from:n,to:s}of r.visibleRanges)t.iterate({from:n,to:s,enter:l=>{if(l.name==="Blockquote"){let o=l.from;for(;o<=l.to;){const a=r.state.doc.lineAt(o);if(e.push(Nv.range(a.from)),a.to+1>l.to)break;o=a.to+1}}if(l.name==="FencedCode"||l.name==="CodeBlock"){let o=l.from;for(;o<=l.to;){const a=r.state.doc.lineAt(o);if(e.push(Gv.range(a.from)),a.to+1>l.to)break;o=a.to+1}}}});e.sort((n,s)=>n.from-s.from||n.value.startSide-s.value.startSide);const i=new zs;for(const n of e)i.add(n.from,n.to,n.value);return i.finish()}const Hv=hr.fromClass(class{decorations;constructor(r){this.decorations=ud(r)}update(r){(r.docChanged||r.viewportChanged||r.selectionSet||ne(r.startState)!==ne(r.state))&&(this.decorations=ud(r.view))}},{decorations:r=>r.decorations});function Kv(r){const e=r instanceof Element?r.closest("tr"):null,t=e?.parentElement;return!e||!(t instanceof HTMLTableSectionElement)||t.tagName!=="TBODY"?0:Array.from(t.rows).indexOf(e)+2}class Jv extends yn{constructor(e,t){super(),this.source=e,this.from=t}eq(e){return e.source===this.source&&e.from===this.from}toDOM(e){const t=document.createElement("div");return t.className="cm-md-table",t.innerHTML=m0(this.source,"surface"),t.addEventListener("click",i=>{if(i.defaultPrevented||i.button!==0||i.altKey||i.ctrlKey||i.metaKey||i.shiftKey)return;const n=i.target;if(!(n instanceof Element)||!n.closest("td, th")||n.closest("a, button, input, select, textarea")||S0(t,t.ownerDocument.getSelection()))return;i.preventDefault();const s=e.state.doc,l=s.lineAt(this.from).number+Kv(i.target);e.dispatch({selection:{anchor:s.line(Math.min(l,s.lines)).from}}),e.focus()}),t}ignoreEvent(){return!0}}function dd(r){const e=new zs;return(hO(r,r.doc.length,200)??ne(r)).iterate({enter:i=>{if(i.name!=="Table")return;if(p0(r,i.from,i.to))return!1;const n=r.doc.sliceString(i.from,i.to);return e.add(i.from,i.to,N.replace({widget:new Jv(n,i.from),block:!0})),!1}}),e.finish()}const O0=Ri.define({create:r=>dd(r),update(r,e){return e.docChanged||e.selection||ne(e.startState)!==ne(e.state)?dd(e.state):r},provide:r=>z.decorations.from(r)});function pd(r,e){const{state:t}=r,i=t.doc.lineAt(t.selection.main.head),n=e===1?i.to+1:i.from-1;if(n<0||n>t.doc.length)return!1;let s=null;return t.field(O0).between(n,n,(l,o)=>(s=e===1?l:t.doc.lineAt(o).from,!1)),s===null?!1:(r.dispatch({selection:{anchor:s},scrollIntoView:!0}),!0)}const eP=mh.high(Ch.of([{key:"ArrowDown",run:r=>pd(r,1)},{key:"ArrowUp",run:r=>pd(r,-1)}])),tP=z.baseTheme({".cm-md-h1":{fontSize:"1.6em",fontWeight:"700",lineHeight:"1.3"},".cm-md-h2":{fontSize:"1.4em",fontWeight:"700",lineHeight:"1.3"},".cm-md-h3":{fontSize:"1.2em",fontWeight:"600",lineHeight:"1.3"},".cm-md-h4":{fontSize:"1.1em",fontWeight:"600"},".cm-md-h5":{fontSize:"1.05em",fontWeight:"600"},".cm-md-h6":{fontSize:"1em",fontWeight:"600"},".cm-md-strong":{fontWeight:"700"},".cm-md-emphasis":{fontStyle:"italic"},".cm-md-strike":{textDecoration:"line-through"},".cm-md-code":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",backgroundColor:"hsl(var(--muted) / 0.6)",borderRadius:"4px",padding:"0.1em 0.3em"},".cm-md-link":{color:"hsl(var(--primary))",textDecoration:"underline"},".cm-md-quote":{borderLeft:"3px solid hsl(var(--border))",paddingLeft:"0.75em",color:"hsl(var(--muted-foreground))",fontStyle:"italic"},".cm-md-codeblock":{backgroundColor:"hsl(var(--muted) / 0.4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},".cm-md-bullet":{paddingRight:"0.4em",color:"hsl(var(--muted-foreground))"},".cm-md-table":{cursor:"text",overflowX:"auto",contain:"inline-size",userSelect:"text"},".cm-md-table table":{fontSize:"0.95em",width:"max-content",minWidth:"100%"}});function iP(){return[O0,eP,Hv,tP]}const nP=/^(#{1,6}\s+|>\s+|[-*+]\s+(\[[ xX]\]\s+)?|\d+[.)]\s+)/;function bi(r,e){const{state:t}=r,{from:i,to:n}=t.selection.main,s=t.doc.lineAt(i).number,l=t.doc.lineAt(n).number,o=[];for(let a=s;a<=l;a++){const h=t.doc.line(a),f=nP.exec(h.text),c=typeof e=="function"?e(a-s):e;o.push({from:h.from,to:h.from+(f?f[0].length:0),insert:c})}r.dispatch({changes:o}),r.focus()}function Ss(r,e){const{from:t,to:i}=r.state.selection.main,n=r.state.sliceDoc(t,i);r.dispatch({changes:{from:t,to:i,insert:`${e}${n}${e}`},selection:{anchor:t+e.length,head:i+e.length}}),r.focus()}function xT(r){const e=Ei.useRef(null),t=Ei.useRef(null),i=Ei.useRef(r.onChange);Ei.useEffect(()=>{i.current=r.onChange},[r.onChange]),Ei.useEffect(()=>{const o=e.current;if(!o)return;const a=new z({parent:o,state:ge.create({doc:r.value,extensions:[r.language==="markdown"?[]:qS(),Ub(),Ch.of([...ex,...sy]),r.language==="markdown"?[Bv({base:Cr}),iP()]:[],z.lineWrapping,z.updateListener.of(h=>{h.docChanged&&i.current(h.state.doc.toString())}),r.language==="markdown"?z.theme({"&":{height:"100%",background:"transparent"},".cm-scroller":{fontFamily:"inherit"},".cm-content":{minHeight:"100%",padding:"16px",maxWidth:"768px",margin:"0 auto",fontSize:"14px",lineHeight:"1.7"},".cm-activeLine":{backgroundColor:"transparent"}}):z.theme({"&":{height:"100%",background:"transparent"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},".cm-content":{minHeight:"100%",padding:"12px 0",fontSize:"12px",lineHeight:"20px"},".cm-gutters":{background:"transparent",borderRight:"1px solid hsl(var(--border))"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px",color:"hsl(var(--muted-foreground))"},".cm-activeLine":{backgroundColor:"hsl(var(--muted) / 0.35)"},".cm-activeLineGutter":{backgroundColor:"hsl(var(--muted) / 0.35)"}})]})});return t.current=a,()=>{a.destroy(),t.current=null}},[r.language]),Ei.useEffect(()=>{const o=t.current;if(!o)return;const a=o.state.doc.toString();a!==r.value&&o.dispatch({changes:{from:0,to:a.length,insert:r.value}})},[r.value]);const n=mf.jsx("div",{ref:e,className:g0("h-full min-h-0 overflow-hidden",r.className)});if(r.language!=="markdown")return n;const s=o=>{const a=t.current;a&&o(a)},l=[{type:"item",id:"heading-1",label:"Heading 1",onSelect:()=>s(o=>bi(o,"# "))},{type:"item",id:"heading-2",label:"Heading 2",onSelect:()=>s(o=>bi(o,"## "))},{type:"item",id:"heading-3",label:"Heading 3",onSelect:()=>s(o=>bi(o,"### "))},{type:"item",id:"paragraph",label:"Paragraph",onSelect:()=>s(o=>bi(o,""))},{type:"separator"},{type:"item",id:"bold",label:"Bold",onSelect:()=>s(o=>Ss(o,"**"))},{type:"item",id:"italic",label:"Italic",onSelect:()=>s(o=>Ss(o,"*"))},{type:"item",id:"strikethrough",label:"Strikethrough",onSelect:()=>s(o=>Ss(o,"~~"))},{type:"item",id:"inline-code",label:"Inline code",onSelect:()=>s(o=>Ss(o,"`"))},{type:"separator"},{type:"item",id:"bullet-list",label:"Bullet list",onSelect:()=>s(o=>bi(o,"- "))},{type:"item",id:"numbered-list",label:"Numbered list",onSelect:()=>s(o=>bi(o,a=>`${a+1}. `))},{type:"item",id:"quote",label:"Quote",onSelect:()=>s(o=>bi(o,"> "))}];return mf.jsx(b0,{actions:l,includeEditing:!0,className:"block h-full min-h-0",children:n})}export{xT as ArtifactTextEditor};
34
+ }`,{label:"class",detail:"definition",type:"keyword"}),Be('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Be('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ov=Ym.concat([Be("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Be("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Be("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),rd=new lO,_m=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Xn(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}const av=["FunctionDeclaration"],hv={FunctionDeclaration:Xn("function"),ClassDeclaration:Xn("class"),ClassExpression:()=>!0,EnumDeclaration:Xn("constant"),TypeAliasDeclaration:Xn("type"),NamespaceDeclaration:Xn("namespace"),VariableDefinition(r,e){r.matchContext(av)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function qm(r,e){let t=rd.get(e);if(t)return t;let i=[],n=!0;function s(l,o){let a=r.sliceString(l.from,l.to);i.push({label:a,type:o})}return e.cursor(H.IncludeAnonymous).iterate(l=>{if(n)n=!1;else if(l.name){let o=hv[l.name];if(o&&o(l,s)||_m.has(l.name))return!1}else if(l.to-l.from>8192){for(let o of qm(r,l.node))i.push(o);return!1}}),rd.set(e,i),i}const sd=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Nm=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function fv(r){let e=ne(r.state).resolveInner(r.pos,-1);if(Nm.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&sd.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let n=e;n;n=n.parent)_m.has(n.name)&&(i=i.concat(qm(r.state.doc,n)));return{options:i,from:t?e.from:r.pos,validFor:sd}}const Lt=an.define({name:"javascript",parser:lv.configure({props:[Zr.add({IfStatement:Ms({except:/^\s*({|else\b)/}),TryStatement:Ms({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Rb,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Mb({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ms({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),Xr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pO,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Gm={test:r=>/^JSX/.test(r.name),facet:Eh({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Fm=Lt.configure({dialect:"ts"},"typescript"),Um=Lt.configure({dialect:"jsx",props:[Lh.add(r=>r.isTop?[Gm]:void 0)]}),Hm=Lt.configure({dialect:"jsx ts",props:[Lh.add(r=>r.isTop?[Gm]:void 0)]},"typescript");let Km=r=>({label:r,type:"keyword"});const Jm="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Km),cv=Jm.concat(["declare","implements","private","protected","public"].map(Km));function uv(r={}){let e=r.jsx?r.typescript?Hm:Um:r.typescript?Fm:Lt,t=r.typescript?ov.concat(cv):Ym.concat(Jm);return new Or(e,[Lt.data.of({autocomplete:Ow(Nm,pw(t))}),Lt.data.of({autocomplete:fv}),r.jsx?Ov:[]])}function dv(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function ld(r,e,t=r.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}const pv=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ov=V.inputHandler.of((r,e,t,i,n)=>{if((pv?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Lt.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:l}=s,o=l.changeByRange(a=>{var h;let{head:f}=a,c=ne(l).resolveInner(f-1,-1),u;if(c.name=="JSXStartTag"&&(c=c.parent),!(l.doc.sliceString(f-1,f)!=i||c.name=="JSXAttributeValue"&&c.to>f)){if(i==">"&&c.name=="JSXFragmentTag")return{range:a,changes:{from:f,insert:"</>"}};if(i=="/"&&c.name=="JSXStartCloseTag"){let d=c.parent,p=d.parent;if(p&&d.from==f-2&&((u=ld(l.doc,p.firstChild,f))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let O=`${u}>`;return{range:P.cursor(f+O.length,-1),changes:{from:f,insert:O}}}}else if(i==">"){let d=dv(c);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(l.doc.sliceString(f,f+2))&&(u=ld(l.doc,d,f)))return{range:a,changes:{from:f,insert:`</${u}>`}}}}return{range:a}});return o.changes.empty?!1:(r.dispatch([s,l.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),En=["_blank","_self","_top","_parent"],Po=["ascii","utf-8","utf-16","latin1","latin1"],To=["get","post","put","delete"],Co=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],_e=["true","false"],Z={},gv={a:{attrs:{href:null,ping:null,type:null,media:null,target:En,hreflang:null}},abbr:Z,address:Z,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Z,aside:Z,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Z,base:{attrs:{href:null,target:En}},bdi:Z,bdo:Z,blockquote:{attrs:{cite:null}},body:Z,br:Z,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Co,formmethod:To,formnovalidate:["novalidate"],formtarget:En,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Z,center:Z,cite:Z,code:Z,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Z,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Z,div:Z,dl:Z,dt:Z,em:Z,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Z,figure:Z,footer:Z,form:{attrs:{action:null,name:null,"accept-charset":Po,autocomplete:["on","off"],enctype:Co,method:To,novalidate:["novalidate"],target:En}},h1:Z,h2:Z,h3:Z,h4:Z,h5:Z,h6:Z,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Z,hgroup:Z,hr:Z,html:{attrs:{manifest:null}},i:Z,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Co,formmethod:To,formnovalidate:["novalidate"],formtarget:En,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Z,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Z,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Z,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Po,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Z,noscript:Z,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Z,param:{attrs:{name:null,value:null}},pre:Z,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Z,rt:Z,ruby:Z,samp:Z,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Po}},section:Z,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Z,source:{attrs:{src:null,type:null,media:null}},span:Z,strong:Z,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Z,summary:Z,sup:Z,table:Z,tbody:Z,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Z,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Z,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Z,time:{attrs:{datetime:null}},title:Z,tr:Z,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Z,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Z},e0={accesskey:null,class:null,contenteditable:_e,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:_e,autocorrect:_e,autocapitalize:_e,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":_e,"aria-autocomplete":["inline","list","both","none"],"aria-busy":_e,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":_e,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":_e,"aria-hidden":_e,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":_e,"aria-multiselectable":_e,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":_e,"aria-relevant":null,"aria-required":_e,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},t0="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of t0)e0[r]=null;class Tr{constructor(e,t){this.tags={...gv,...e},this.globalAttrs={...e0,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Tr.default=new Tr;function Sn(r,e,t=r.length){if(!e)return"";let i=e.firstChild,n=i&&i.getChild("TagName");return n?r.sliceString(n.from,Math.min(n.to,t)):""}function bn(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function i0(r,e,t){let i=t.tags[Sn(r,bn(e))];return i?.children||t.allTags}function pf(r,e){let t=[];for(let i=bn(e);i&&!i.type.isTop;i=bn(i.parent)){let n=Sn(r,i);if(n&&i.lastChild.name=="CloseTag")break;n&&t.indexOf(n)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(n)}return t}const n0=/^[:\-\.\w\u00b7-\uffff]*$/;function od(r,e,t,i,n){let s=/\s*>/.test(r.sliceDoc(n,n+5))?"":">",l=bn(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:n,options:i0(r.doc,l,e).map(o=>({label:o,type:"type"})).concat(pf(r.doc,t).map((o,a)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function ad(r,e,t,i){let n=/\s*>/.test(r.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:pf(r.doc,e).map((s,l)=>({label:s,apply:s+n,type:"type",boost:99-l})),validFor:n0}}function mv(r,e,t,i){let n=[],s=0;for(let l of i0(r.doc,t,e))n.push({label:"<"+l,type:"type"});for(let l of pf(r.doc,t))n.push({label:"</"+l+">",type:"type",boost:99-s++});return{from:i,to:i,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Sv(r,e,t,i,n){let s=bn(t),l=s?e.tags[Sn(r.doc,s)]:null,o=l&&l.attrs?Object.keys(l.attrs):[],a=l&&l.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:n,options:a.map(h=>({label:h,type:"property"})),validFor:n0}}function bv(r,e,t,i,n){var s;let l=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],a;if(l){let h=r.sliceDoc(l.from,l.to),f=e.globalAttrs[h];if(!f){let c=bn(t),u=c?e.tags[Sn(r.doc,c)]:null;f=u?.attrs&&u.attrs[h]}if(f){let c=r.sliceDoc(i,n).toLowerCase(),u='"',d='"';/^['"]/.test(c)?(a=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",d=r.sliceDoc(n,n+1)==c[0]?"":c[0],c=c.slice(1),i++):a=/^[^\s<>='"]*$/;for(let p of f)o.push({label:p,apply:u+p+d,type:"constant"})}}return{from:i,to:n,options:o,validFor:a}}function r0(r,e){let{state:t,pos:i}=e,n=ne(t).resolveInner(i,-1),s=n.resolve(i);for(let l=i,o;s==n&&(o=n.childBefore(l));){let a=o.lastChild;if(!a||!a.type.isError||a.from<a.to)break;s=n=o,l=a.from}return n.name=="TagName"?n.parent&&/CloseTag$/.test(n.parent.name)?ad(t,n,n.from,i):od(t,r,n,n.from,i):n.name=="StartTag"||n.name=="IncompleteTag"?od(t,r,n,i,i):n.name=="StartCloseTag"||n.name=="IncompleteCloseTag"?ad(t,n,i,i):n.name=="OpenTag"||n.name=="SelfClosingTag"||n.name=="AttributeName"?Sv(t,r,n,n.name=="AttributeName"?n.from:i,i):n.name=="Is"||n.name=="AttributeValue"||n.name=="UnquotedAttributeValue"?bv(t,r,n,n.name=="Is"?i:n.from,i):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?mv(t,r,n,i):null}function yv(r){return r0(Tr.default,r)}function xv(r){let{extraTags:e,extraGlobalAttributes:t}=r,i=t||e?new Tr(e,t):Tr.default;return n=>r0(i,n)}const kv=Lt.parser.configure({top:"SingleExpression"}),s0=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:Fm.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:Um.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:Hm.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:kv},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:Lt.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:yl.parser}],l0=[{name:"style",parser:yl.parser.configure({top:"Styles"})}].concat(t0.map(r=>({name:r,parser:Lt.parser}))),o0=an.define({name:"html",parser:N$.configure({props:[Zr.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].length<r.node.to)return r.continue();let e=null,t;for(let i=r.node;;){let n=i.lastChild;if(!n||n.name!="Element"||n.to!=i.to)break;e=i=n}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?r.lineIndent(e.from)+r.unit:null}}),Xr.add({Element(r){let e=r.firstChild,t=r.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:r.to}}}),OO.add({"OpenTag CloseTag":r=>r.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Ds=o0.configure({wrap:Bm(s0,l0)});function wv(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=Bm((r.nestedLanguages||[]).concat(s0),(r.nestedAttributes||[]).concat(l0)));let i=t?o0.configure({wrap:t,dialect:e}):e?Ds.configure({dialect:e}):Ds;return new Or(i,[Ds.data.of({autocomplete:xv(r)}),r.autoCloseTags!==!1?$v:[],uv().support,CQ().support])}const hd=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),$v=V.inputHandler.of((r,e,t,i,n)=>{if(r.composing||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Ds.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:l}=s,o=l.changeByRange(a=>{var h,f,c;let u=l.doc.sliceString(a.from-1,a.to)==i,{head:d}=a,p=ne(l).resolveInner(d,-1),O;if(u&&i==">"&&p.name=="EndTag"){let g=p.parent;if(((f=(h=g.parent)===null||h===void 0?void 0:h.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(O=Sn(l.doc,g.parent,d))&&!hd.has(O)){let m=d+(l.doc.sliceString(d,d+1)===">"?1:0),b=`</${O}>`;return{range:a,changes:{from:d,to:m,insert:b}}}}else if(u&&i=="/"&&p.name=="IncompleteCloseTag"){let g=p.parent;if(p.from==d-2&&((c=g.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(O=Sn(l.doc,g,d))&&!hd.has(O)){let m=d+(l.doc.sliceString(d,d+1)===">"?1:0),b=`${O}>`;return{range:P.cursor(d+b.length,-1),changes:{from:d,to:m,insert:b}}}}return{range:a}});return o.changes.empty?!1:(r.dispatch([s,l.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),a0=Eh({commentTokens:{block:{open:"<!--",close:"-->"}}}),h0=new q,f0=Iw.configure({props:[Xr.add(r=>!r.is("Block")||r.is("Document")||ph(r)!=null||Qv(r)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),h0.add(ph),Zr.add({Document:()=>null}),Ii.add({Document:a0})]});function ph(r){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(r.name);return e?+e[1]:void 0}function Qv(r){return r.name=="OrderedList"||r.name=="BulletList"}function vv(r,e){let t=r;for(;;){let i=t.nextSibling,n;if(!i||(n=ph(i.type))!=null&&n<=e)break;t=i}return t.to}const Pv=Zb.of((r,e,t)=>{for(let i=ne(r).resolveInner(t,-1);i&&!(i.from<e);i=i.parent){let n=i.type.prop(h0);if(n==null)continue;let s=vv(i,n);if(s>t)return{from:t,to:s}}return null});function Of(r){return new et(a0,r,[],"markdown")}const Tv=Of(f0),Cv=f0.configure([Kw,e$,Jw,t$,{props:[Xr.add({Table:(r,e)=>({from:e.doc.lineAt(r.from).to,to:r.to})})]}]),Cr=Of(Cv);function Av(r,e){return t=>{if(t&&r){let i=null;if(t=/\S*/.exec(t)[0],typeof r=="function"?i=r(t):i=Ks.matchLanguageName(r,t,!0),i instanceof Ks)return i.support?i.support.language.parser:pr.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}class Ao{constructor(e,t,i,n,s,l,o){this.node=e,this.from=t,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=l,this.item=o}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length<e;)i+=" ";return i}else{for(let n=this.to-this.from-i.length-this.spaceAfter.length;n>0;n--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+u0(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function c0(r,e){let t=[],i=[];for(let n=r;n;n=n.parent){if(n.name=="FencedCode")return i;(n.name=="ListItem"||n.name=="Blockquote")&&t.push(n)}for(let n=t.length-1;n>=0;n--){let s=t[n],l,o=e.lineAt(s.from),a=s.from-o.from;if(s.name=="Blockquote"&&(l=/^ *>( ?)/.exec(o.text.slice(a))))i.push(new Ao(s,a,a+l[0].length,"",l[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(l=/^( *)\d+([.)])( *)/.exec(o.text.slice(a)))){let h=l[3],f=l[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),i.push(new Ao(s.parent,a,a+f,l[1],h,l[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(l=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(a)))){let h=l[4],f=l[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let c=l[2];l[3]&&(c+=l[3].replace(/[xX]/," ")),i.push(new Ao(s.parent,a,a+f,l[1],h,c,s))}}return i}function u0(r,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(r.from,r.from+10))}function Mo(r,e,t,i=0){for(let n=-1,s=r;;){if(s.name=="ListItem"){let o=u0(s,e),a=+o[2];if(n>=0){if(a!=n+1)return;t.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(n+2+i)})}n=a}let l=s.nextSibling;if(!l)break;s=l}}function gf(r,e){let t=/^[ \t]*/.exec(r)[0].length;if(!t||e.facet(Rr)!=" ")return r;let i=br(r,4,t),n="";for(let s=i;s>0;)s>=4?(n+=" ",s-=4):(n+=" ",s--);return n+r.slice(t)}const Mv=(r={})=>({state:e,dispatch:t})=>{let i=ne(e),{doc:n}=e,s=null,l=e.changeByRange(o=>{if(!o.empty||!Cr.isActiveAt(e,o.from,-1)&&!Cr.isActiveAt(e,o.from,1))return s={range:o};let a=o.from,h=n.lineAt(a),f=c0(i.resolveInner(a,-1),n);for(;f.length&&f[f.length-1].from>a-h.from;)f.pop();if(!f.length)return s={range:o};let c=f[f.length-1];if(c.to-c.spaceAfter.length>a-h.from)return s={range:o};let u=a>=c.to-c.spaceAfter.length&&!/\S/.test(h.text.slice(c.to));if(c.item&&u){let m=c.node.firstChild,b=c.node.getChild("ListItem","ListItem");if(m.to>=a||b&&b.to<a||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)||r.nonTightLists===!1){let y=f.length>1?f[f.length-2]:null,C,k="";y&&y.item?(C=h.from+y.from,k=y.marker(n,1)):C=h.from+(y?y.to:0);let w=[{from:C,to:a,insert:k}];return c.node.name=="OrderedList"&&Mo(c.item,n,w,-2),y&&y.node.name=="OrderedList"&&Mo(y.item,n,w),{range:P.cursor(C+k.length),changes:w}}else{let y=cd(f,e,h);return{range:P.cursor(a+y.length+1),changes:{from:h.from,insert:y+e.lineBreak}}}}if(c.node.name=="Blockquote"&&u&&h.from){let m=n.lineAt(h.from-1),b=/>\s*$/.exec(m.text);if(b&&b.index==c.from){let y=e.changes([{from:m.from+b.index,to:m.to},{from:h.from+c.from,to:h.to}]);return{range:o.map(y),changes:y}}}let d=[];c.node.name=="OrderedList"&&Mo(c.item,n,d);let p=c.item&&c.item.from<h.from,O="";if(!p||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=c.to)for(let m=0,b=f.length-1;m<=b;m++)O+=m==b&&!p?f[m].marker(n,1):f[m].blank(m<b?br(h.text,4,f[m+1].from)-O.length:null);let g=a;for(;g>h.from&&/\s/.test(h.text.charAt(g-h.from-1));)g--;return O=gf(O,e),Zv(c.node,e.doc)&&(O=cd(f,e,h)+e.lineBreak+O),d.push({from:g,to:a,insert:e.lineBreak+O}),{range:P.cursor(g+O.length+1),changes:d}});return s?!1:(t(e.update(l,{scrollIntoView:!0,userEvent:"input"})),!0)},Rv=Mv();function fd(r){return r.name=="QuoteMark"||r.name=="ListMark"}function Zv(r,e){if(r.name!="OrderedList"&&r.name!="BulletList")return!1;let t=r.firstChild,i=r.getChild("ListItem","ListItem");if(!i)return!1;let n=e.lineAt(t.to),s=e.lineAt(i.from),l=/^[\s>]*$/.test(n.text);return n.number+(l?0:1)<s.number}function cd(r,e,t){let i="";for(let n=0,s=r.length-2;n<=s;n++)i+=r[n].blank(n<s?br(t.text,4,r[n+1].from)-i.length:null,n<s);return gf(i,e)}function Xv(r,e){let t=r.resolveInner(e,-1),i=e;fd(t)&&(i=t.from,t=t.parent);for(let n;n=t.childBefore(i);)if(fd(n))i=n.from;else if(n.name=="OrderedList"||n.name=="BulletList")t=n.lastChild,i=t.to;else break;return t}const Ev=({state:r,dispatch:e})=>{let t=ne(r),i=null,n=r.changeByRange(s=>{let l=s.from,{doc:o}=r;if(s.empty&&Cr.isActiveAt(r,s.from)){let a=o.lineAt(l),h=c0(Xv(t,l),o);if(h.length){let f=h[h.length-1],c=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(l-a.from>c&&!/\S/.test(a.text.slice(c,l-a.from)))return{range:P.cursor(a.from+c),changes:{from:a.from+c,to:l}};if(l-a.from==c&&(f.item&&a.from<=f.item.from||/^[\s>]*$/.test(a.text.slice(0,f.to)))){let u=a.from+f.from;if(f.item&&f.node.from<f.item.from&&/\S/.test(a.text.slice(f.from,f.to))){let d=f.blank(br(a.text,4,f.to)-br(a.text,4,f.from));return u==a.from&&(d=gf(d,r)),{range:P.cursor(u+d.length),changes:{from:u,to:a.from+f.to,insert:d}}}if(u<l)return{range:P.cursor(u),changes:{from:u,to:l}}}}}return i={range:s}});return i?!1:(e(r.update(n,{scrollIntoView:!0,userEvent:"delete"})),!0)},Lv=[{key:"Enter",run:Rv},{key:"Backspace",run:Ev}],d0=wv({matchClosingTags:!1});function Bv(r={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:i=!0,base:{parser:n}=Tv,completeHTMLTags:s=!0,pasteURLAsLink:l=!0,htmlTagLanguage:o=d0}=r;if(!(n instanceof Wl))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let a=r.extensions?[r.extensions]:[],h=[o.support,Pv],f;l&&h.push(Iv),t instanceof Or?(h.push(t.support),f=t.language):t&&(f=t);let c=e||f?Av(e,f):void 0;a.push(jw({codeParser:c,htmlParser:o.language.parser})),i&&h.push(Rl.high(tf.of(Lv)));let u=Of(n.configure(a));return s&&h.push(u.data.of({autocomplete:Dv})),new Or(u,h)}function Dv(r){let{state:e,pos:t}=r,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!i)return null;let n=ne(e).resolveInner(t,-1);for(;n&&!n.type.isTop;){if(n.name=="CodeBlock"||n.name=="FencedCode"||n.name=="ProcessingInstructionBlock"||n.name=="CommentBlock"||n.name=="Link"||n.name=="Image")return null;n=n.parent}return{from:t-i[0].length,to:t,options:Wv(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Ro=null;function Wv(){if(Ro)return Ro;let r=yv(new uw(ie.create({extensions:d0}),0,!0));return Ro=r?r.options:[]}const zv=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Iv=V.domEventHandlers({paste:(r,e)=>{var t;let{main:i}=e.state.selection;if(i.empty)return!1;let n=(t=r.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!n||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(n)||(/^www\./.test(n)&&(n="https://"+n),!Cr.isActiveAt(e.state,i.from,1)))return!1;let s=ne(e.state),l=!1;return s.iterate({from:i.from,to:i.to,enter:o=>{(o.from>i.from||zv.test(o.name))&&(l=!0)},leave:o=>{o.to<i.to&&(l=!0)}}),l?!1:(e.dispatch({changes:[{from:i.from,insert:"["},{from:i.to,insert:`](${n})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),Ln=N.replace({}),Vv=[N.mark({class:"cm-md-h1"}),N.mark({class:"cm-md-h2"}),N.mark({class:"cm-md-h3"}),N.mark({class:"cm-md-h4"}),N.mark({class:"cm-md-h5"}),N.mark({class:"cm-md-h6"})],jv=N.mark({class:"cm-md-strong"}),Yv=N.mark({class:"cm-md-emphasis"}),_v=N.mark({class:"cm-md-strike"}),qv=N.mark({class:"cm-md-code"});N.mark({class:"cm-md-link"});const Nv=N.line({class:"cm-md-quote"}),Gv=N.line({class:"cm-md-codeblock"});class Fv extends yn{eq(){return!0}toDOM(){const e=document.createElement("span");return e.className="cm-md-bullet",e.textContent="•",e}ignoreEvent(){return!1}}const Uv=N.replace({widget:new Fv});function p0(r,e,t){for(const i of r.selection.ranges)if(i.from<=t&&i.to>=e)return!0;return!1}function Li(r,e){const t=r.state.doc.lineAt(e);return p0(r.state,t.from,t.to)}function ud(r){const e=[],t=hO(r.state,r.state.doc.length,200)??ne(r.state);for(const{from:n,to:s}of r.visibleRanges)t.iterate({from:n,to:s,enter:l=>{const o=l.name;if(o==="Table")return!1;if(/^ATXHeading[1-6]$/.test(o)){const a=Number(o.slice(-1))-1;e.push(Vv[a].range(l.from,l.to));return}if(o==="HeaderMark"){if(!Li(r,l.from)){const a=r.state.doc.sliceString(l.to,l.to+1)===" "?l.to+1:l.to;e.push(Ln.range(l.from,a))}return}if(o==="StrongEmphasis"){e.push(jv.range(l.from,l.to));return}if(o==="Emphasis"){e.push(Yv.range(l.from,l.to));return}if(o==="Strikethrough"){e.push(_v.range(l.from,l.to));return}if(o==="InlineCode"){e.push(qv.range(l.from,l.to));return}if(o==="EmphasisMark"||o==="CodeMark"||o==="StrikethroughMark"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}if(o==="QuoteMark"){if(!Li(r,l.from)){const a=r.state.doc.sliceString(l.to,l.to+1)===" "?l.to+1:l.to;e.push(Ln.range(l.from,a))}return}if(o==="ListMark"){const a=r.state.doc.lineAt(l.from).text;/^\s*[-*+]\s/.test(a)&&!Li(r,l.from)&&e.push(Uv.range(l.from,l.to));return}if(o==="LinkMark"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}if(o==="URL"){Li(r,l.from)||e.push(Ln.range(l.from,l.to));return}}});for(const{from:n,to:s}of r.visibleRanges)t.iterate({from:n,to:s,enter:l=>{if(l.name==="Blockquote"){let o=l.from;for(;o<=l.to;){const a=r.state.doc.lineAt(o);if(e.push(Nv.range(a.from)),a.to+1>l.to)break;o=a.to+1}}if(l.name==="FencedCode"||l.name==="CodeBlock"){let o=l.from;for(;o<=l.to;){const a=r.state.doc.lineAt(o);if(e.push(Gv.range(a.from)),a.to+1>l.to)break;o=a.to+1}}}});e.sort((n,s)=>n.from-s.from||n.value.startSide-s.value.startSide);const i=new zs;for(const n of e)i.add(n.from,n.to,n.value);return i.finish()}const Hv=hr.fromClass(class{decorations;constructor(r){this.decorations=ud(r)}update(r){(r.docChanged||r.viewportChanged||r.selectionSet||ne(r.startState)!==ne(r.state))&&(this.decorations=ud(r.view))}},{decorations:r=>r.decorations});function Kv(r){const e=r instanceof Element?r.closest("tr"):null,t=e?.parentElement;return!e||!(t instanceof HTMLTableSectionElement)||t.tagName!=="TBODY"?0:Array.from(t.rows).indexOf(e)+2}class Jv extends yn{constructor(e,t){super(),this.source=e,this.from=t}eq(e){return e.source===this.source&&e.from===this.from}toDOM(e){const t=document.createElement("div");return t.className="cm-md-table",t.innerHTML=g0(this.source,"surface"),t.addEventListener("click",i=>{if(i.defaultPrevented||i.button!==0||i.altKey||i.ctrlKey||i.metaKey||i.shiftKey)return;const n=i.target;if(!(n instanceof Element)||!n.closest("td, th")||n.closest("a, button, input, select, textarea")||m0(t,t.ownerDocument.getSelection()))return;i.preventDefault();const s=e.state.doc,l=s.lineAt(this.from).number+Kv(i.target);e.dispatch({selection:{anchor:s.line(Math.min(l,s.lines)).from}}),e.focus()}),t}ignoreEvent(){return!0}}function dd(r){const e=new zs;return(hO(r,r.doc.length,200)??ne(r)).iterate({enter:i=>{if(i.name!=="Table")return;if(p0(r,i.from,i.to))return!1;const n=r.doc.sliceString(i.from,i.to);return e.add(i.from,i.to,N.replace({widget:new Jv(n,i.from),block:!0})),!1}}),e.finish()}const O0=Ri.define({create:r=>dd(r),update(r,e){return e.docChanged||e.selection||ne(e.startState)!==ne(e.state)?dd(e.state):r},provide:r=>z.decorations.from(r)});function pd(r,e){const{state:t}=r,i=t.doc.lineAt(t.selection.main.head),n=e===1?i.to+1:i.from-1;if(n<0||n>t.doc.length)return!1;let s=null;return t.field(O0).between(n,n,(l,o)=>(s=e===1?l:t.doc.lineAt(o).from,!1)),s===null?!1:(r.dispatch({selection:{anchor:s},scrollIntoView:!0}),!0)}const eP=mh.high(Ch.of([{key:"ArrowDown",run:r=>pd(r,1)},{key:"ArrowUp",run:r=>pd(r,-1)}])),tP=z.baseTheme({".cm-md-h1":{fontSize:"1.6em",fontWeight:"700",lineHeight:"1.3"},".cm-md-h2":{fontSize:"1.4em",fontWeight:"700",lineHeight:"1.3"},".cm-md-h3":{fontSize:"1.2em",fontWeight:"600",lineHeight:"1.3"},".cm-md-h4":{fontSize:"1.1em",fontWeight:"600"},".cm-md-h5":{fontSize:"1.05em",fontWeight:"600"},".cm-md-h6":{fontSize:"1em",fontWeight:"600"},".cm-md-strong":{fontWeight:"700"},".cm-md-emphasis":{fontStyle:"italic"},".cm-md-strike":{textDecoration:"line-through"},".cm-md-code":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",backgroundColor:"hsl(var(--muted) / 0.6)",borderRadius:"4px",padding:"0.1em 0.3em"},".cm-md-link":{color:"hsl(var(--primary))",textDecoration:"underline"},".cm-md-quote":{borderLeft:"3px solid hsl(var(--border))",paddingLeft:"0.75em",color:"hsl(var(--muted-foreground))",fontStyle:"italic"},".cm-md-codeblock":{backgroundColor:"hsl(var(--muted) / 0.4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},".cm-md-bullet":{paddingRight:"0.4em",color:"hsl(var(--muted-foreground))"},".cm-md-table":{cursor:"text",overflowX:"auto",contain:"inline-size",userSelect:"text"},".cm-md-table table":{fontSize:"0.95em",width:"max-content",minWidth:"100%"}});function iP(){return[O0,eP,Hv,tP]}const nP=/^(#{1,6}\s+|>\s+|[-*+]\s+(\[[ xX]\]\s+)?|\d+[.)]\s+)/;function bi(r,e){const{state:t}=r,{from:i,to:n}=t.selection.main,s=t.doc.lineAt(i).number,l=t.doc.lineAt(n).number,o=[];for(let a=s;a<=l;a++){const h=t.doc.line(a),f=nP.exec(h.text),c=typeof e=="function"?e(a-s):e;o.push({from:h.from,to:h.from+(f?f[0].length:0),insert:c})}r.dispatch({changes:o}),r.focus()}function Ss(r,e){const{from:t,to:i}=r.state.selection.main,n=r.state.sliceDoc(t,i);r.dispatch({changes:{from:t,to:i,insert:`${e}${n}${e}`},selection:{anchor:t+e.length,head:i+e.length}}),r.focus()}function yT(r){const e=Ei.useRef(null),t=Ei.useRef(null),i=Ei.useRef(r.onChange);Ei.useEffect(()=>{i.current=r.onChange},[r.onChange]),Ei.useEffect(()=>{const o=e.current;if(!o)return;const a=new z({parent:o,state:ge.create({doc:r.value,extensions:[r.language==="markdown"?[]:qS(),Ub(),Ch.of([...ex,...sy]),r.language==="markdown"?[Bv({base:Cr}),iP()]:[],z.lineWrapping,z.updateListener.of(h=>{h.docChanged&&i.current(h.state.doc.toString())}),r.language==="markdown"?z.theme({"&":{height:"100%",background:"transparent"},".cm-scroller":{fontFamily:"inherit"},".cm-content":{minHeight:"100%",padding:"16px",maxWidth:"768px",margin:"0 auto",fontSize:"14px",lineHeight:"1.7"},".cm-activeLine":{backgroundColor:"transparent"}}):z.theme({"&":{height:"100%",background:"transparent"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},".cm-content":{minHeight:"100%",padding:"12px 0",fontSize:"12px",lineHeight:"20px"},".cm-gutters":{background:"transparent",borderRight:"1px solid hsl(var(--border))"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px",color:"hsl(var(--muted-foreground))"},".cm-activeLine":{backgroundColor:"hsl(var(--muted) / 0.35)"},".cm-activeLineGutter":{backgroundColor:"hsl(var(--muted) / 0.35)"}})]})});return t.current=a,()=>{a.destroy(),t.current=null}},[r.language]),Ei.useEffect(()=>{const o=t.current;if(!o)return;const a=o.state.doc.toString();a!==r.value&&o.dispatch({changes:{from:0,to:a.length,insert:r.value}})},[r.value]);const n=mf.jsx("div",{ref:e,className:S0("h-full min-h-0 overflow-hidden",r.className)});if(r.language!=="markdown")return n;const s=o=>{const a=t.current;a&&o(a)},l=[{type:"item",id:"heading-1",label:"Heading 1",onSelect:()=>s(o=>bi(o,"# "))},{type:"item",id:"heading-2",label:"Heading 2",onSelect:()=>s(o=>bi(o,"## "))},{type:"item",id:"heading-3",label:"Heading 3",onSelect:()=>s(o=>bi(o,"### "))},{type:"item",id:"paragraph",label:"Paragraph",onSelect:()=>s(o=>bi(o,""))},{type:"separator"},{type:"item",id:"bold",label:"Bold",onSelect:()=>s(o=>Ss(o,"**"))},{type:"item",id:"italic",label:"Italic",onSelect:()=>s(o=>Ss(o,"*"))},{type:"item",id:"strikethrough",label:"Strikethrough",onSelect:()=>s(o=>Ss(o,"~~"))},{type:"item",id:"inline-code",label:"Inline code",onSelect:()=>s(o=>Ss(o,"`"))},{type:"separator"},{type:"item",id:"bullet-list",label:"Bullet list",onSelect:()=>s(o=>bi(o,"- "))},{type:"item",id:"numbered-list",label:"Numbered list",onSelect:()=>s(o=>bi(o,a=>`${a+1}. `))},{type:"item",id:"quote",label:"Quote",onSelect:()=>s(o=>bi(o,"> "))}];return mf.jsx(b0,{actions:l,includeEditing:!0,className:"block h-full min-h-0",children:n})}export{yT as ArtifactTextEditor};