decocms 4.448.0 → 4.448.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/dist/client/assets/{AlertCircle-BgzKIHBg.js → AlertCircle-Db3nN-aH.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D9J1W_3A.js → AreaChart-DmAMjRU1.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-Bd0lzf25.js → ArrowLeft-DF1VpR4-.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-THfmrwlM.js → ArrowUp-DflMQXXz.js} +1 -1
  5. package/dist/client/assets/{Building02-CSMMDKRZ.js → Building02-BUDdR-6E.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-BWUtT14P.js → CartesianChart-BzPN35d4.js} +1 -1
  7. package/dist/client/assets/{Check-CkBscgA2.js → Check-CfruVhvH.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-Bokn_JKt.js → CheckCircle-HR7NNZ3-.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-d9MFOW1T.js → ChevronUp-CEpzchWv.js} +1 -1
  10. package/dist/client/assets/{Copy01-C68wCYtl.js → Copy01-D-GZ4qIF.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-B4oRpD46.js → CreditCard01-BY3nyBCf.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-C2t5zhKy.js → DotsVertical-aeQXuX6u.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-D08eI2fo.js → ErrorBarContext-Cj6WADqE.js} +1 -1
  14. package/dist/client/assets/{Image01-Duw-3ecX.js → Image01-OmShhTml.js} +1 -1
  15. package/dist/client/assets/{Key01-CqL4JhuL.js → Key01-NG3oKlPr.js} +1 -1
  16. package/dist/client/assets/{Line-DL1QPfVo.js → Line-Ts9KFqpF.js} +1 -1
  17. package/dist/client/assets/{Link01-C-Mwe2eF.js → Link01-1uL5aIKM.js} +1 -1
  18. package/dist/client/assets/{LinkBroken01-DN8kSYpX.js → LinkBroken01-CFGCvwaI.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-DMM7FS6P.js → LinkExternal01-Dk2IEzny.js} +1 -1
  20. package/dist/client/assets/{Monitor01-Wyitf2St.js → Monitor01-r1M4P899.js} +1 -1
  21. package/dist/client/assets/{Palette-VX8lOEW0.js → Palette-BV7fb0fO.js} +1 -1
  22. package/dist/client/assets/{Plus-DDqlhBDc.js → Plus-1s9ECeWs.js} +1 -1
  23. package/dist/client/assets/{SearchMd-WaC9Elkv.js → SearchMd-DDbxc7mn.js} +1 -1
  24. package/dist/client/assets/{Sector-BR94vGtg.js → Sector-CXitzeGt.js} +1 -1
  25. package/dist/client/assets/{ShoppingBag01-Cl4z1_2H.js → ShoppingBag01-uWG5kJpn.js} +1 -1
  26. package/dist/client/assets/{Sun-COvLf5Lc.js → Sun-VXtioQh5.js} +1 -1
  27. package/dist/client/assets/{Tool01-CH2aHsGf.js → Tool01-B3UTdWk1.js} +1 -1
  28. package/dist/client/assets/{Trash01-DK8Y_gth.js → Trash01-tZa4tQgg.js} +1 -1
  29. package/dist/client/assets/{Upload01-oF1C_3Ru.js → Upload01-C4ayNGmm.js} +1 -1
  30. package/dist/client/assets/{User01-GD0yW4Qu.js → User01-DfJTRENR.js} +1 -1
  31. package/dist/client/assets/{UserSquare-D6GqJl2I.js → UserSquare-DakxUyFX.js} +1 -1
  32. package/dist/client/assets/{Users01-DgVeXNsL.js → Users01-D1M_5vmR.js} +1 -1
  33. package/dist/client/assets/{X-YRTghwXC.js → X-D1hYIKW4.js} +1 -1
  34. package/dist/client/assets/{XAxis-DnLQ7FuQ.js → XAxis-BlsGT8aY.js} +1 -1
  35. package/dist/client/assets/{XClose-75e7Vbaa.js → XClose-CZsHZD1U.js} +1 -1
  36. package/dist/client/assets/{ZoomOut-Dvx_7Y9U.js → ZoomOut-B3W1nlA8.js} +1 -1
  37. package/dist/client/assets/{access-gate-BU27wCPK.js → access-gate-CMJKaGq4.js} +1 -1
  38. package/dist/client/assets/{add-connection-dialog-BHmJQXXQ.js → add-connection-dialog-DS0UVmPE.js} +1 -1
  39. package/dist/client/assets/{agent-analytics-B6eFHWAd.js → agent-analytics-Bzt3dTIX.js} +1 -1
  40. package/dist/client/assets/agent-app-Bq1z4UEX.js +1 -0
  41. package/dist/client/assets/{agent-assets-DiWQ8d3n.js → agent-assets-BeMlZBU0.js} +1 -1
  42. package/dist/client/assets/{agent-automation-DjYw4oXf.js → agent-automation-hCSS2iBK.js} +3 -3
  43. package/dist/client/assets/agent-automations-CvUUkBS7.js +1 -0
  44. package/dist/client/assets/{agent-connect-sources-MyA_CgnU.js → agent-connect-sources-audgoNWa.js} +1 -1
  45. package/dist/client/assets/agent-deck-DRn6ikjP.js +1 -0
  46. package/dist/client/assets/{agent-e2e-C9FCqOvB.js → agent-e2e-Do-jXxTg.js} +1 -1
  47. package/dist/client/assets/{agent-experiments-BlE9ebq7.js → agent-experiments-B9x7m-5N.js} +1 -1
  48. package/dist/client/assets/{agent-file-BALSM2yR.js → agent-file-CIAazgTY.js} +1 -1
  49. package/dist/client/assets/{agent-git-CrY9aGVI.js → agent-git-C6GlYNXM.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-Cih5FNYQ.js → agent-hosting-7i_HnuDS.js} +1 -1
  51. package/dist/client/assets/{agent-icon-BUiQnNP8.js → agent-icon-D_ZGENxN.js} +1 -1
  52. package/dist/client/assets/agent-library-BZuL8vYd.js +1 -0
  53. package/dist/client/assets/agent-library-file-Bu3i1o_d.js +1 -0
  54. package/dist/client/assets/{agent-monitor-BuhaPSMe.js → agent-monitor-CbpDwLDd.js} +1 -1
  55. package/dist/client/assets/{agent-overview-BX0iaaBw.js → agent-overview-yIvpqD1-.js} +1 -1
  56. package/dist/client/assets/agent-settings-BcEWyXFz.js +1 -0
  57. package/dist/client/assets/{agent-site-editor-Dz301u4g.js → agent-site-editor-DE0wVbOL.js} +1 -1
  58. package/dist/client/assets/agent-site-editor-code-Db-tTtwK.js +2 -0
  59. package/dist/client/assets/{agent-site-editor-content-ChafU8bT.js → agent-site-editor-content-CKsCDKCv.js} +3 -3
  60. package/dist/client/assets/{agent-site-editor-preview-UtIZTPE6.js → agent-site-editor-preview-kEsNGvz_.js} +3 -3
  61. package/dist/client/assets/agent-view-CnJsDvaq.js +1 -0
  62. package/dist/client/assets/{agent-view-guard-CegzWEHj.js → agent-view-guard-a_hkm-gv.js} +1 -1
  63. package/dist/client/assets/{agents-list-OSdOs1OH.js → agents-list-BjUfXtNq.js} +1 -1
  64. package/dist/client/assets/{ai-providers-fPKqY7_P.js → ai-providers-Cl1blExb.js} +1 -1
  65. package/dist/client/assets/{alert-BxQz8cP6.js → alert-CchhhzUN.js} +1 -1
  66. package/dist/client/assets/{alert-dialog-BB87iWcS.js → alert-dialog-DQQJ1XbB.js} +1 -1
  67. package/dist/client/assets/{analytics-sections-md4NfZUk.js → analytics-sections-BUzUUc2U.js} +1 -1
  68. package/dist/client/assets/{api-keys-OtcVZ-We.js → api-keys-CRS8Su-u.js} +1 -1
  69. package/dist/client/assets/api-keys-okTm4rkQ.js +1 -0
  70. package/dist/client/assets/app-editor-BgMOWrPY.js +1 -0
  71. package/dist/client/assets/{asset-utils-PWPK46Eo.js → asset-utils-BUkd_wzJ.js} +1 -1
  72. package/dist/client/assets/{auth-CqmWT_2g.js → auth-DkrC80Fv.js} +1 -1
  73. package/dist/client/assets/{auth-catchall-B3XbOymv.js → auth-catchall-Cj_WWBaC.js} +1 -1
  74. package/dist/client/assets/{auth-entry-BPZIshWr.js → auth-entry-pUftQne2.js} +1 -1
  75. package/dist/client/assets/{auth-split-layout-BVZv5XKC.js → auth-split-layout-GyBppwlx.js} +1 -1
  76. package/dist/client/assets/{authenticate-and-persist-oauth-B41Sx_s0.js → authenticate-and-persist-oauth-DZPZruqA.js} +1 -1
  77. package/dist/client/assets/{automation-list-row-BYt9sTMx.js → automation-list-row-C01tJLzJ.js} +1 -1
  78. package/dist/client/assets/{automation-runs-DIohB3g_.js → automation-runs-Chx2be97.js} +1 -1
  79. package/dist/client/assets/{automations-BedV72qg.js → automations-B5NcHs07.js} +1 -1
  80. package/dist/client/assets/{autosend-CEQzRhvd.js → autosend-BguW2u9l.js} +1 -1
  81. package/dist/client/assets/{avatar-BUy252-G.js → avatar-DDA18BIM.js} +1 -1
  82. package/dist/client/assets/{badge-DejmcZm9.js → badge-Dc-IK6BL.js} +1 -1
  83. package/dist/client/assets/{block-document-BgGQ2lXv.js → block-document-Czl8SaOV.js} +3 -3
  84. package/dist/client/assets/{blocks-preview-workspace-context-CJ0cJXJ-.js → blocks-preview-workspace-context-DMZb3L-m.js} +1 -1
  85. package/dist/client/assets/{buckets-ZSaS5z_u.js → buckets-BOK-PnCO.js} +1 -1
  86. package/dist/client/assets/{build-improve-prompt-doc-BRKfF38j.js → build-improve-prompt-doc-930f5R3e.js} +1 -1
  87. package/dist/client/assets/{calendar-CLfWOBUX.js → calendar-DhlOv9Bj.js} +1 -1
  88. package/dist/client/assets/{capability-load-error-BJHb8XrA.js → capability-load-error-CpEVM6Dd.js} +1 -1
  89. package/dist/client/assets/{category-editor-DWtggVgM.js → category-editor-CWCJz9Vq.js} +1 -1
  90. package/dist/client/assets/{chart-HsGopGVn.js → chart-lUFqAt8R.js} +1 -1
  91. package/dist/client/assets/{chat-context-BaRraYAA.js → chat-context-EpEt-eZN.js} +1 -1
  92. package/dist/client/assets/{chat-draft-CFEQOnWd.js → chat-draft-DRwpbA8F.js} +1 -1
  93. package/dist/client/assets/{checkbox-CNknzL68.js → checkbox-s_Nr65IF.js} +1 -1
  94. package/dist/client/assets/{choose-editor-DHUTwjGC.js → choose-editor-DKUhud4R.js} +1 -1
  95. package/dist/client/assets/{claim-phase-copy-D-H4AKq1.js → claim-phase-copy-2ZGhXfS0.js} +1 -1
  96. package/dist/client/assets/{cli-auth-success-DMCOlZVU.js → cli-auth-success-tzhHRfw9.js} +1 -1
  97. package/dist/client/assets/{client-icons-Dot2-8Ng.js → client-icons-BTs3mGDp.js} +1 -1
  98. package/dist/client/assets/{collapsible-COfnVvaq.js → collapsible-B5EU8Qsl.js} +1 -1
  99. package/dist/client/assets/{collection-detail-CvQy-FNQ.js → collection-detail-C9rDVdq_.js} +1 -1
  100. package/dist/client/assets/{collection-display-button-nS47msXw.js → collection-display-button-DmqlrvhS.js} +1 -1
  101. package/dist/client/assets/{collection-search-QrA0qPpv.js → collection-search-BbuEIifQ.js} +1 -1
  102. package/dist/client/assets/{collection-table-wrapper-D-FHJqcw.js → collection-table-wrapper-Dw-aDXmG.js} +1 -1
  103. package/dist/client/assets/{collection-tabs-BTTf3Im8.js → collection-tabs-BCBBaszn.js} +1 -1
  104. package/dist/client/assets/{column-rules-26AzKhwv.js → column-rules-coDsKRKU.js} +1 -1
  105. package/dist/client/assets/{combobox-DJMmGAgM.js → combobox-BlJ2joxY.js} +1 -1
  106. package/dist/client/assets/{command-BeWosBD5.js → command-B4qLeS_u.js} +1 -1
  107. package/dist/client/assets/{companion-mcps-section-DquOXFwc.js → companion-mcps-section-DMLzCb1h.js} +1 -1
  108. package/dist/client/assets/{config-B_J6eren.js → config-DQ7ccaQS.js} +1 -1
  109. package/dist/client/assets/{connect-BHDzXT3q.js → connect-B-J7tJM-.js} +1 -1
  110. package/dist/client/assets/{connect-layout-B5DraPjV.js → connect-layout-Db8Prbks.js} +1 -1
  111. package/dist/client/assets/{connection-DLraZ45i.js → connection-Ccv5hBHa.js} +1 -1
  112. package/dist/client/assets/{connection-card-ByBeHaTx.js → connection-card-DnFko9yQ.js} +1 -1
  113. package/dist/client/assets/{connection-detail-D5wElMjE.js → connection-detail-CVzgLQRD.js} +1 -1
  114. package/dist/client/assets/{connection-form-helpers-B37qd_wK.js → connection-form-helpers-D8wUuK7l.js} +1 -1
  115. package/dist/client/assets/{connections-BGJZd1b3.js → connections-D_u2aek4.js} +1 -1
  116. package/dist/client/assets/{context-_owvmTJc.js → context-BYClOYK0.js} +1 -1
  117. package/dist/client/assets/{context-menu-cIAF7GDl.js → context-menu-CbaIoz4Q.js} +1 -1
  118. package/dist/client/assets/{create-organization-dialog-DpSclRHW.js → create-organization-dialog-C3nbO2yw.js} +1 -1
  119. package/dist/client/assets/{daily-pulse-BMbckFog.js → daily-pulse-DRnyrg2A.js} +1 -1
  120. package/dist/client/assets/{decopilot-DvJjDwc1.js → decopilot-D_BLAMUM.js} +1 -1
  121. package/dist/client/assets/{device-hint-B1OpXsK3.js → device-hint-BiQMycz5.js} +1 -1
  122. package/dist/client/assets/{dialog-B30-8RI6.js → dialog-w4Rq3UVr.js} +1 -1
  123. package/dist/client/assets/{discover-CvOdgoTH.js → discover-D1GPCoK_.js} +1 -1
  124. package/dist/client/assets/{domain-settings-DoLockR6.js → domain-settings-twPHN9Hq.js} +1 -1
  125. package/dist/client/assets/{download-app-dialog-BEeBKwQl.js → download-app-dialog-wYXIid0Y.js} +1 -1
  126. package/dist/client/assets/{drawer-Dx_eDva4.js → drawer-BIE-d7uo.js} +1 -1
  127. package/dist/client/assets/{editor-CLYxWXVn.js → editor-cVCBgTqL.js} +1 -1
  128. package/dist/client/assets/{empty-state-CyTqx1WF.js → empty-state-ByMMprph.js} +1 -1
  129. package/dist/client/assets/{empty-state-BtuSozdW.js → empty-state-CoCzGnr1.js} +1 -1
  130. package/dist/client/assets/{extract-connection-data-Ceomd2dy.js → extract-connection-data-Bz9UqkYi.js} +1 -1
  131. package/dist/client/assets/{feature-gate-ByQ_9Uyr.js → feature-gate-BPUn63Aj.js} +1 -1
  132. package/dist/client/assets/{feature-paywall-BpkcH4cr.js → feature-paywall-BMuEMkwo.js} +1 -1
  133. package/dist/client/assets/{file-explorer-p49Fj9h5.js → file-explorer-LtokbF5u.js} +1 -1
  134. package/dist/client/assets/{file-preview-oU4O4mYj.js → file-preview-CSZWyvVp.js} +1 -1
  135. package/dist/client/assets/{file-share-button-42_gXSxN.js → file-share-button-DcHx1P5p.js} +2 -2
  136. package/dist/client/assets/{file-type-icon-DM7d4yre.js → file-type-icon-CZZLh9KE.js} +1 -1
  137. package/dist/client/assets/flat-project-D_j4QQer.js +1 -0
  138. package/dist/client/assets/{folder-icon-Bw0HK4N5.js → folder-icon-ovYUPBEj.js} +1 -1
  139. package/dist/client/assets/{form-HEFwQ86k.js → form-CRr8EgmW.js} +1 -1
  140. package/dist/client/assets/{gateway-client-DMn6uSTc.js → gateway-client-CX3L1DlB.js} +1 -1
  141. package/dist/client/assets/{general--mkEOaC6.js → general-Cwc0DkY7.js} +1 -1
  142. package/dist/client/assets/{home-Dx0u1fAR.js → home-DtvScmwn.js} +1 -1
  143. package/dist/client/assets/{icon-button-C6LsyxKS.js → icon-button-qw_8WIYn.js} +1 -1
  144. package/dist/client/assets/{index-BuKCAq02.js → index-7HZZgQdo.js} +9 -9
  145. package/dist/client/assets/{index-DUchVaNj.js → index-B7rGJakY.js} +1 -1
  146. package/dist/client/assets/{index-DAhfV5vh.js → index-BIAjfIob.js} +2 -2
  147. package/dist/client/assets/{index-B8iNur1H.js → index-BXIv7gin.js} +1 -1
  148. package/dist/client/assets/{index-D9Dp_srJ.js → index-B_VJ4GLU.js} +1 -1
  149. package/dist/client/assets/{index-DfRZ3eV-.js → index-BcE-bRAy.js} +1 -1
  150. package/dist/client/assets/{index-D9o-WuiI.js → index-BnB81_Oe.js} +1 -1
  151. package/dist/client/assets/{index-rIGGQh0Z.js → index-BzUXAjsp.js} +1 -1
  152. package/dist/client/assets/{index-C4Vjmkff.js → index-CReZUI6Q.js} +1 -1
  153. package/dist/client/assets/{index-IqSVG5fY.js → index-DM2UYmVh.js} +1 -1
  154. package/dist/client/assets/{index-Bi-7WlGx.js → index-DzW2acnX.js} +1 -1
  155. package/dist/client/assets/{index-CYKZD4gc.js → index-Shs2Oj_W.js} +5 -5
  156. package/dist/client/assets/{index-D8B9h6s-.js → index-cem-9T3s.js} +1 -1
  157. package/dist/client/assets/{index-BCW6nCJr.js → index-jkZvzgj2.js} +1 -1
  158. package/dist/client/assets/{index-Laz3och2.js → index-rLDyw3Ik.js} +1 -1
  159. package/dist/client/assets/{index-redirect-9lk3Mcpc.js → index-redirect-Cfd72Uxx.js} +1 -1
  160. package/dist/client/assets/{infiniteQueryObserver-BlKY7V_o.js → infiniteQueryObserver-CkNSrzGg.js} +1 -1
  161. package/dist/client/assets/{infra-billing-ClXW240-.js → infra-billing-CaaQ_u3D.js} +1 -1
  162. package/dist/client/assets/{input-Uk8z-Ktf.js → input-CWthaoYx.js} +1 -1
  163. package/dist/client/assets/{input-Cxi1fFAz.js → input-CkpH0Zzq.js} +7 -7
  164. package/dist/client/assets/{input-C1SzE0r0.js → input-a6CWM_f5.js} +1 -1
  165. package/dist/client/assets/{integration-icon-DTJ53jik.js → integration-icon-BgOF3lUj.js} +1 -1
  166. package/dist/client/assets/{label-CsA5aIjl.js → label-7zvV_A0w.js} +1 -1
  167. package/dist/client/assets/{layout-0SkVikTT.js → layout-CI04YNnq.js} +1 -1
  168. package/dist/client/assets/{legacy-agents-deep-o2zNRJBD.js → legacy-agents-deep-CUdp2BTS.js} +1 -1
  169. package/dist/client/assets/{legacy-main-redirect-D1DUV9jt.js → legacy-main-redirect-DsLg7265.js} +1 -1
  170. package/dist/client/assets/library-C00FatCl.js +1 -0
  171. package/dist/client/assets/{library-tab-yb3t70cm.js → library-tab-DSE2pjEP.js} +1 -1
  172. package/dist/client/assets/{login-BCvV20QX.js → login-DnyhAXn7.js} +1 -1
  173. package/dist/client/assets/{markdown-DA7Pnev1.js → markdown-D9wcV3av.js} +1 -1
  174. package/dist/client/assets/{mcp-app-renderer-CL-fBp7u.js → mcp-app-renderer-JSQk1QJI.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-Ig94NzNJ.js → mcp-oauth-Co4uJbVo.js} +1 -1
  176. package/dist/client/assets/{members-BVCs6BGJ.js → members-BupihWrA.js} +1 -1
  177. package/dist/client/assets/{memory-wRkeFRMb.js → memory-yuGjbHck.js} +1 -1
  178. package/dist/client/assets/{message-templates-DAHFL7pm.js → message-templates-Cds11lV8.js} +1 -1
  179. package/dist/client/assets/{mini-report-page-Bsz_Vl_A.js → mini-report-page-B1SuzZni.js} +1 -1
  180. package/dist/client/assets/{mock-board-DfLUI4qA.js → mock-board-_62IBbgv.js} +1 -1
  181. package/dist/client/assets/{monaco-editor-v37lBX9D.js → monaco-editor-BO06LVWw.js} +1 -1
  182. package/dist/client/assets/{monitoring-stats-row-BvGkbm2U.js → monitoring-stats-row-D03SsGJp.js} +1 -1
  183. package/dist/client/assets/{multi-select-Bwn4u1SH.js → multi-select-Cjoii_cC.js} +1 -1
  184. package/dist/client/assets/{mustache-WARBPpMc.js → mustache-Dp1foAfO.js} +1 -1
  185. package/dist/client/assets/{new-project-dialog-CD-S7Uy7.js → new-project-dialog-icLMLYqi.js} +1 -1
  186. package/dist/client/assets/{oauth-callback-KD8ycZ5S.js → oauth-callback-CVfetVAP.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-ai-provider-QZ1DUytq.js → oauth-callback-ai-provider-CnPqSe1E.js} +1 -1
  188. package/dist/client/assets/{onboarding-C6fAcgnI.js → onboarding-BmCAS9vK.js} +1 -1
  189. package/dist/client/assets/{openai-conversation-DpaYihIr.js → openai-conversation-DlCnTte1.js} +1 -1
  190. package/dist/client/assets/{optimistic-project-sidebar-views-BYi3SXbd.js → optimistic-project-sidebar-views-oy4G1Kaq.js} +1 -1
  191. package/dist/client/assets/{org-file-open-context-BFenNlZj.js → org-file-open-context-CLF54XEa.js} +1 -1
  192. package/dist/client/assets/{organization-choice-BPRjWGDV.js → organization-choice-Bt3MLBsw.js} +1 -1
  193. package/dist/client/assets/{orgs-BBxAiigC.js → orgs-BJyZkuwo.js} +1 -1
  194. package/dist/client/assets/{page-seo-form-D-Y4ByH_.js → page-seo-form-8uBfYAI6.js} +1 -1
  195. package/dist/client/assets/{pair-DyoXAxM8.js → pair-CLXCcuMh.js} +7 -7
  196. package/dist/client/assets/{plan-ladder-DDzYift2.js → plan-ladder-DhSw_fwI.js} +1 -1
  197. package/dist/client/assets/{popover-VHHbgkVg.js → popover-C_V2LVnJ.js} +1 -1
  198. package/dist/client/assets/{post-calendar-BzC1oMA5.js → post-calendar-BIIpmMju.js} +1 -1
  199. package/dist/client/assets/{post-editor-yqrrgVyd.js → post-editor-B37Xez_m.js} +2 -2
  200. package/dist/client/assets/{preview-content-m5N-x4SX.js → preview-content-BlRRg191.js} +1 -1
  201. package/dist/client/assets/{preview-dialog-YD1mDcgr.js → preview-dialog-BKVZzSjP.js} +1 -1
  202. package/dist/client/assets/{profile-Eok7UgYx.js → profile-TaCycvjA.js} +1 -1
  203. package/dist/client/assets/{project-app-view-KKbO6aIR.js → project-app-view-CbLDbHOi.js} +1 -1
  204. package/dist/client/assets/{project-feed-DUhzdphC.js → project-feed-DTY9-u8z.js} +1 -1
  205. package/dist/client/assets/{project-icon-rqB8fgDE.js → project-icon-C4JycAqm.js} +1 -1
  206. package/dist/client/assets/project-reports-CtMWxF0s.js +1 -0
  207. package/dist/client/assets/project-tasks-BbVtcKvE.js +1 -0
  208. package/dist/client/assets/{projects-BPCyrkzG.js → projects-Eg1_VR2Q.js} +1 -1
  209. package/dist/client/assets/{projects-empty-state-Dg9KTZEd.js → projects-empty-state-CBbCxzaP.js} +1 -1
  210. package/dist/client/assets/{prompts-BW6rt8iD.js → prompts-DZ59BG2y.js} +1 -1
  211. package/dist/client/assets/record-editor-DeR8ud8S.js +1 -0
  212. package/dist/client/assets/{redirect-editor-B4oNhGb_.js → redirect-editor-BondEy9a.js} +1 -1
  213. package/dist/client/assets/reports-BzhKRDU2.js +1 -0
  214. package/dist/client/assets/{reports-RlJWeR7R.js → reports-DfSy_H9p.js} +1 -1
  215. package/dist/client/assets/{reports-onboarding-DG0-FS10.js → reports-onboarding-D0z_0WAJ.js} +1 -1
  216. package/dist/client/assets/{reports-tab-BY1reunF.js → reports-tab-aV03354-.js} +2 -2
  217. package/dist/client/assets/{repositories-jwsNIE6M.js → repositories-Ca6U94Eb.js} +1 -1
  218. package/dist/client/assets/{repository-binding-BjQg44s0.js → repository-binding-CwcJXORE.js} +1 -1
  219. package/dist/client/assets/{repository-import-picker-ZyzYgBKd.js → repository-import-picker-Buztgm8Q.js} +1 -1
  220. package/dist/client/assets/{repository-picker-zKlkxI7H.js → repository-picker-y0hYy5kr.js} +1 -1
  221. package/dist/client/assets/{require-capability-BqUwjQSq.js → require-capability-Gi6Cq5g4.js} +1 -1
  222. package/dist/client/assets/{required-auth-layout-Ci_VyqXV.js → required-auth-layout-DRAVuUmA.js} +1 -1
  223. package/dist/client/assets/{reset-password-s1hi7DCq.js → reset-password-CTHX8ypT.js} +1 -1
  224. package/dist/client/assets/{resizable-ByFftuKZ.js → resizable-B-SXbcgq.js} +1 -1
  225. package/dist/client/assets/resolve-tab-icon-CFcBboDL.js +1 -0
  226. package/dist/client/assets/{review-settings-9KPdssy5.js → review-settings-ZXaTej2V.js} +1 -1
  227. package/dist/client/assets/{rich-text-link-control-Cxt5hePr.js → rich-text-link-control-BC2-hOHc.js} +1 -1
  228. package/dist/client/assets/{roles-D15bYv4O.js → roles-D3sai9Xa.js} +1 -1
  229. package/dist/client/assets/{route-CtEWmlke.js → route-DOYibcUj.js} +1 -1
  230. package/dist/client/assets/route-DyWuGhpB.js +1 -0
  231. package/dist/client/assets/{route-frKExtKv.js → route-QTYPpKZa.js} +1 -1
  232. package/dist/client/assets/{runnable-block-editor-qWArPPH0.js → runnable-block-editor-BCTPVIbY.js} +1 -1
  233. package/dist/client/assets/{sandbox-lifecycle-context-CwjnToEe.js → sandbox-lifecycle-context-YRhirepc.js} +1 -1
  234. package/dist/client/assets/{schema-DVBa_MAN.js → schema-Dy2dCTb2.js} +1 -1
  235. package/dist/client/assets/{scroll-area-DRHarC_1.js → scroll-area-CsFEnaKP.js} +1 -1
  236. package/dist/client/assets/{search-input-CHV8xc4e.js → search-input-Dp9JHDzm.js} +1 -1
  237. package/dist/client/assets/{search-toggle-C48Q5Dw4.js → search-toggle-BT-BfQY3.js} +1 -1
  238. package/dist/client/assets/{secret-picker-BYFIGBnL.js → secret-picker-C62yp0qj.js} +1 -1
  239. package/dist/client/assets/{secrets-D81SC9ri.js → secrets-Cs_yf4rg.js} +1 -1
  240. package/dist/client/assets/{sections-editor-DPbRocOh.js → sections-editor-DjuUdErV.js} +1 -1
  241. package/dist/client/assets/{select-Cfp-vpJN.js → select-BpZbuPGW.js} +1 -1
  242. package/dist/client/assets/{select-model-Iau9tAbT.js → select-model-BZ5EU69r.js} +1 -1
  243. package/dist/client/assets/{seo-editor-DuOP0tU_.js → seo-editor-DnYb2_Ur.js} +1 -1
  244. package/dist/client/assets/{separator-4K_GV67Z.js → separator-BRRGCg3f.js} +1 -1
  245. package/dist/client/assets/{settings-tab--CXf6ivv.js → settings-tab-DelUBojW.js} +1 -1
  246. package/dist/client/assets/{sheet-BA1BhLlr.js → sheet-Bxm2Ecbf.js} +1 -1
  247. package/dist/client/assets/{shell-layout-Cns9lUi4.js → shell-layout-BiH8aBHO.js} +1 -1
  248. package/dist/client/assets/{skills-Cg-DT6iV.js → skills-DBxtGFNm.js} +1 -1
  249. package/dist/client/assets/{sso-CUdr-7CQ.js → sso-B3nLmUhk.js} +1 -1
  250. package/dist/client/assets/{suggestion-BlpEbXkf.js → suggestion-9Q6bHY8e.js} +1 -1
  251. package/dist/client/assets/{switch-CQPn6TRL.js → switch-Bc5pgw8A.js} +1 -1
  252. package/dist/client/assets/{synced-repos-Dwj-iZL5.js → synced-repos-Cqc_naVZ.js} +1 -1
  253. package/dist/client/assets/{tab-icon-glyph-COOZpimV.js → tab-icon-glyph-BumQfE8u.js} +1 -1
  254. package/dist/client/assets/{table-BaXr9rnW.js → table-Crpmv2sS.js} +1 -1
  255. package/dist/client/assets/{tabs-boN14fnC.js → tabs-B6bIyG28.js} +1 -1
  256. package/dist/client/assets/{task-board-CfiWV1iu.js → task-board-BbZ9GQGP.js} +1 -1
  257. package/dist/client/assets/{task-route-ZyJZvQEP.js → task-route-DKbj_WdJ.js} +1 -1
  258. package/dist/client/assets/{task-status-CZe8FdJE.js → task-status-BVSmGEZk.js} +1 -1
  259. package/dist/client/assets/{taskboard-analytics-CU05ehRX.js → taskboard-analytics-BkZpSx6m.js} +1 -1
  260. package/dist/client/assets/{tasks-DpliXkxN.js → tasks-BmXAg7Pc.js} +1 -1
  261. package/dist/client/assets/tasks-DAAXX5VX.js +1 -0
  262. package/dist/client/assets/{textarea-re22-64Y.js → textarea-sFSrgIDo.js} +1 -1
  263. package/dist/client/assets/{thread-analytics-BBXLC8Mt.js → thread-analytics-Dub6GoBE.js} +1 -1
  264. package/dist/client/assets/{thread-button-D-bmXoX1.js → thread-button-BZWkzcO5.js} +1 -1
  265. package/dist/client/assets/{thread-intent-DjddwZgX.js → thread-intent-CymiMb9N.js} +1 -1
  266. package/dist/client/assets/{thread-route-58igbRqf.js → thread-route-D8VfAGMB.js} +1 -1
  267. package/dist/client/assets/{thread-route-DXu3auHO.js → thread-route-DLpzTEeV.js} +1 -1
  268. package/dist/client/assets/{thread-sheet-body-D44ITTQU.js → thread-sheet-body-CnBkeoGW.js} +1 -1
  269. package/dist/client/assets/{toggle-group-C96sHBVW.js → toggle-group-DKRKyDcv.js} +1 -1
  270. package/dist/client/assets/{toolbar-icon-button-BwLSK1SV.js → toolbar-icon-button-MVHbrtro.js} +1 -1
  271. package/dist/client/assets/{tooltip-cYDDz2Pp.js → tooltip-Dv7afHpw.js} +1 -1
  272. package/dist/client/assets/{track-DRQxhxbu.js → track-CjRoUBOS.js} +1 -1
  273. package/dist/client/assets/{types-DIHxpGG3.js → types-DBR1YZTm.js} +1 -1
  274. package/dist/client/assets/{usage-stats-BToxR0wR.js → usage-stats-BbeoZmyv.js} +1 -1
  275. package/dist/client/assets/{use-ai-providers-BaF1iqq_.js → use-ai-providers-FHqoziET.js} +1 -1
  276. package/dist/client/assets/{use-automations-CRmgA2ID.js → use-automations-_cV7HGoX.js} +1 -1
  277. package/dist/client/assets/{use-autosave-CXF6_aFn.js → use-autosave-DsNta1WQ.js} +1 -1
  278. package/dist/client/assets/{use-chat-layout-state-Cc2VHc6I.js → use-chat-layout-state-BvV3bxbR.js} +1 -1
  279. package/dist/client/assets/{use-clock-tick-ChrO8Wr8.js → use-clock-tick-BAunurTI.js} +1 -1
  280. package/dist/client/assets/{use-connect-companion-CR1Xr13y.js → use-connect-companion-Caz3IFCL.js} +1 -1
  281. package/dist/client/assets/{use-connection-DfxY3Owk.js → use-connection-Cmy657RR.js} +1 -1
  282. package/dist/client/assets/{use-copy-BBTjUiXD.js → use-copy-ujgvQ5dH.js} +1 -1
  283. package/dist/client/assets/{use-create-virtual-mcp-eOn9ybNU.js → use-create-virtual-mcp-DueL7AUj.js} +1 -1
  284. package/dist/client/assets/{use-date-fns-locale-dUrJdjgT.js → use-date-fns-locale-EtAi9vaF.js} +1 -1
  285. package/dist/client/assets/{use-debounced-autosave-DomrC7JG.js → use-debounced-autosave-C4Qi2CJW.js} +1 -1
  286. package/dist/client/assets/{use-debounced-value-DyppKzdq.js → use-debounced-value-CrHLbu9g.js} +1 -1
  287. package/dist/client/assets/{use-deco-credits-CFjGcaIq.js → use-deco-credits-D3afMhiX.js} +1 -1
  288. package/dist/client/assets/{use-decopilot-events-7cMuGUn_.js → use-decopilot-events-CjKrO0jV.js} +1 -1
  289. package/dist/client/assets/{use-delete-connection-QY7PVH-8.js → use-delete-connection-LxOx_x8e.js} +1 -1
  290. package/dist/client/assets/{use-deployment-admin-BmAVlBQk.js → use-deployment-admin-DY2o5EnU.js} +1 -1
  291. package/dist/client/assets/{use-fast-preview-draft-url-CAtuvvrG.js → use-fast-preview-draft-url-CmLtxiDd.js} +1 -1
  292. package/dist/client/assets/{use-file-configs-CLIgCo9H.js → use-file-configs-D7LE9ap9.js} +1 -1
  293. package/dist/client/assets/{use-infinite-scroll-BBNiZIZb.js → use-infinite-scroll-Cb0iiXUg.js} +1 -1
  294. package/dist/client/assets/{use-join-requests-BPZN_x_r.js → use-join-requests-C5dEdpQv.js} +1 -1
  295. package/dist/client/assets/{use-main-panel-tabs-BmwpMk5o.js → use-main-panel-tabs-DHibEtAs.js} +1 -1
  296. package/dist/client/assets/use-mcp-auth-status-C3fX_4FP.js +1 -0
  297. package/dist/client/assets/{use-mcp-client-D2VYpHPF.js → use-mcp-client-C5l2yl6W.js} +1 -1
  298. package/dist/client/assets/{use-mcp-prompts-DtbMED93.js → use-mcp-prompts-BVIuta_8.js} +1 -1
  299. package/dist/client/assets/{use-mcp-tools-BicoFNZe.js → use-mcp-tools-Dd2K2MEg.js} +1 -1
  300. package/dist/client/assets/{use-members-BuEaDeJm.js → use-members-C8b6zTud.js} +1 -1
  301. package/dist/client/assets/{use-mobile-UCEvtXfH.js → use-mobile-BzhADNq9.js} +1 -1
  302. package/dist/client/assets/{use-navigate-to-agent-BZlsExbp.js → use-navigate-to-agent-CJINVNqy.js} +1 -1
  303. package/dist/client/assets/use-new-blocks-editor-C1l2pwoG.js +1 -0
  304. package/dist/client/assets/{use-open-billing-url-SUgaj5hP.js → use-open-billing-url-Cq9TBBtx.js} +1 -1
  305. package/dist/client/assets/{use-org-auth-client-CY1uAtqK.js → use-org-auth-client-rz6TTtxX.js} +1 -1
  306. package/dist/client/assets/{use-org-fs-DUuc6Zxc.js → use-org-fs-Rb59H37N.js} +1 -1
  307. package/dist/client/assets/{use-org-repo-syncs-W7zCKeFI.js → use-org-repo-syncs-D_S7rByt.js} +1 -1
  308. package/dist/client/assets/{use-org-sso-BxhvCAY_.js → use-org-sso-B16z1Gwx.js} +1 -1
  309. package/dist/client/assets/{use-organization-roles-B7z-gMaH.js → use-organization-roles-D5d8wUfo.js} +1 -1
  310. package/dist/client/assets/{use-organization-settings-B4tP4hFm.js → use-organization-settings-DphCgL0t.js} +1 -1
  311. package/dist/client/assets/{use-panel-navigate--QzQC3VZ.js → use-panel-navigate-COgw91gy.js} +1 -1
  312. package/dist/client/assets/{use-project-scope-BBHuYyAU.js → use-project-scope-96tNEQMv.js} +1 -1
  313. package/dist/client/assets/{use-releases-CFy4ROz7.js → use-releases-D_F2eIEk.js} +1 -1
  314. package/dist/client/assets/{use-reports-diagnostic-DAw3nLO7.js → use-reports-diagnostic-CWfTPghA.js} +1 -1
  315. package/dist/client/assets/{use-secrets-BX9baefu.js → use-secrets-BlS86lEz.js} +1 -1
  316. package/dist/client/assets/{use-section-preview-base-DiMdIa4C.js → use-section-preview-base-C3tIAG5D.js} +1 -1
  317. package/dist/client/assets/{use-session-runtime-DFN8v9Uu.js → use-session-runtime-DFwFkf-U.js} +1 -1
  318. package/dist/client/assets/{use-tags-BtzhaZAL.js → use-tags-9Y3tv814.js} +1 -1
  319. package/dist/client/assets/{use-task-board-analytics-DlTRreOu.js → use-task-board-analytics-B2AqZ3tO.js} +1 -1
  320. package/dist/client/assets/{use-task-board-events-CkFoY4mj.js → use-task-board-events-DnD7ebJW.js} +1 -1
  321. package/dist/client/assets/{use-task-metadata-CVwRScr5.js → use-task-metadata-C-OFYT7E.js} +1 -1
  322. package/dist/client/assets/{use-thread-analytics-BUhgXjvp.js → use-thread-analytics-DwnHexBS.js} +1 -1
  323. package/dist/client/assets/{use-thread-outputs-DOsnMhNz.js → use-thread-outputs-DHDZHQNM.js} +1 -1
  324. package/dist/client/assets/useInfiniteQuery-DHRNPEn6.js +1 -0
  325. package/dist/client/assets/{useQueries-BRIObTwd.js → useQueries-tREh8-g2.js} +1 -1
  326. package/dist/client/assets/useSuspenseInfiniteQuery-3LkxYWp7.js +1 -0
  327. package/dist/client/assets/{users-BnkfBaAF.js → users-CIwLBog0.js} +1 -1
  328. package/dist/client/assets/{utils-DpuKt6Cb.js → utils-CRYzloOE.js} +1 -1
  329. package/dist/client/assets/variant-calendar-PsqiJPEs.js +1 -0
  330. package/dist/client/assets/{variant-matcher-override-C6K9_6nf.js → variant-matcher-override-DmfwASjx.js} +1 -1
  331. package/dist/client/assets/{view-mode-toggle-B8earrSa.js → view-mode-toggle-CRnxPiTG.js} +1 -1
  332. package/dist/client/assets/{virtual-mcp-BMmjcaCV.js → virtual-mcp-CQwUfXI_.js} +1 -1
  333. package/dist/client/index.html +1 -1
  334. package/dist/server/cli.js +1 -1
  335. package/dist/server/server.js +1 -1
  336. package/package.json +1 -1
  337. package/dist/client/assets/agent-app-Dq_7tqVN.js +0 -1
  338. package/dist/client/assets/agent-automations-BUvLJ7il.js +0 -1
  339. package/dist/client/assets/agent-deck-DP1RFPYl.js +0 -1
  340. package/dist/client/assets/agent-library-Beh5m17Q.js +0 -1
  341. package/dist/client/assets/agent-library-file-CwXHAXv4.js +0 -1
  342. package/dist/client/assets/agent-settings-CW-eYN6A.js +0 -1
  343. package/dist/client/assets/agent-site-editor-code--ZdaE1Zs.js +0 -2
  344. package/dist/client/assets/agent-view-BYv17ry1.js +0 -1
  345. package/dist/client/assets/api-keys-BtiHVECl.js +0 -1
  346. package/dist/client/assets/app-editor-D0P361Xh.js +0 -1
  347. package/dist/client/assets/flat-project-D60fVc1Z.js +0 -1
  348. package/dist/client/assets/library-BP7VdqPu.js +0 -1
  349. package/dist/client/assets/project-reports-RQE1LLFO.js +0 -1
  350. package/dist/client/assets/project-tasks-CuvuY6F8.js +0 -1
  351. package/dist/client/assets/record-editor-CGGiShp3.js +0 -1
  352. package/dist/client/assets/reports-BadwKRdX.js +0 -1
  353. package/dist/client/assets/resolve-tab-icon-C76owMiT.js +0 -1
  354. package/dist/client/assets/route-gl8RhBbx.js +0 -1
  355. package/dist/client/assets/tasks-Dqb81gsh.js +0 -1
  356. package/dist/client/assets/use-mcp-auth-status-BnOryspq.js +0 -1
  357. package/dist/client/assets/use-new-blocks-editor-DSBgh7mx.js +0 -1
  358. package/dist/client/assets/useInfiniteQuery-BpXl9N7J.js +0 -1
  359. package/dist/client/assets/useSuspenseInfiniteQuery-Dc8cFcZ0.js +0 -1
  360. package/dist/client/assets/variant-calendar-BRsSo7Ye.js +0 -1
@@ -1,8 +1,8 @@
1
- import{c as $,b as j,r as E,j as x,l as K,t as ue,X as Tt,m as vt,K as At,aR as Mt,h as Xe}from"./index-DAhfV5vh.js";import{a as St,E as ie,j as Ct,h as Je,S as Rt,r as H,t as Et,v as $t,w as Ye,x as N,y as Ee,z as _t,A as Lt,B as $e,C as It,G as Z,N as D,m as P,H as Y,T as et,R as ke,I as be,J as zt,K as Ht,L as Pt,O as jt,s as Nt,Q as Ot,U as Bt,u as Dt,b as Ft}from"./index-BCW6nCJr.js";import{T as _,n as qt,i as Wt,E as Ut}from"./rich-text-link-control-Cxt5hePr.js";import{a as Gt,e as tt,s as Zt,S as Kt}from"./suggestion-BlpEbXkf.js";import{B as Vt,c as Qt,t as Xt,C as nt,f as Jt,g as _e,s as Yt,m as Le,a as Ie,b as en,d as ze,e as tn,h as nn,i as rn,j as sn,k as an,l as on,n as ln}from"./index-D8B9h6s-.js";import{ac as cn,ad as un,af as hn,H as dn,b7 as pn,aX as fn}from"./agent-icon-BUiQnNP8.js";import{i as gn}from"./XClose-75e7Vbaa.js";import{i as mn}from"./Check-CkBscgA2.js";import{i as kn}from"./Link01-C-Mwe2eF.js";import{s as bn}from"./Trash01-DK8Y_gth.js";import{i as xn,b as wn}from"./use-org-fs-DUuc6Zxc.js";import{E as He,i as rt,a as yn,b as Tn,A as vn,c as An,m as Mn,d as Sn,e as Cn}from"./markdown-DA7Pnev1.js";import{i as st}from"./X-YRTghwXC.js";import{A as Rn}from"./avatar-BUy252-G.js";import{f as En,C as $n,c as _n,a as Ln,b as In}from"./command-BeWosBD5.js";import{g as zn}from"./get-initials-D-f_fDFw.js";import{u as Hn}from"./use-org-auth-client-CY1uAtqK.js";import{I as Pn}from"./icon-button-C6LsyxKS.js";function jn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),c(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=qt(a);if(M===""){g();return}if(!Wt(M)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=x.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let b;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(b=s&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),c(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:K("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:x.jsx(mn,{size:14})}),h&&x.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=b):b=e[26];let v;return e[27]!==T||e[28]!==b?(v=x.jsxs("div",{className:"relative",children:[T,b]}),e[27]=T,e[28]=b,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},Pe=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],Nn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function On(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:Bn},e[0]=n,e[1]=a):a=e[1];const l=St(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let c;e[4]!==r?(c=r("markdownEditor.heading2"),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==r?(u=r("markdownEditor.heading3"),e[6]=r,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&x.jsxs(Vt,{editor:n,shouldShow:Nn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[x.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(cn,{size:14})}),x.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(un,{size:14})}),x.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(hn,{size:14})}),x.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(dn,{size:14})}),x.jsx(le,{}),it.map((g,m)=>x.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:x.jsx(Pe,{children:`H${g}`})},g)),x.jsx(le,{}),x.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(gn,{size:14})}),x.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(Pe,{children:"1."})}),x.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(pn,{size:14})}),x.jsx(le,{}),x.jsx(jn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=x.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function Bn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Dn=10,Fn=25,qn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function Wn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??qn[t.type]??""}function Un(){const t=$.c(4),e=j(),{upload:n}=xn(He),r=wn(He);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=rt(a),o=l?Dn:Fn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const c=l?yn:Tn,u=`${crypto.randomUUID()}${Wn(a)}`;try{return await n.mutateAsync({dir:c,files:[new File([a],u,{type:a.type})]}),r(`${c}/${u}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Je("uploadSlots"),Gn=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Ct({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Zn(t,e){return ee.getState(t)?.get(e)}function Kn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,c=t.state.doc.resolve(e),u=c.parent.textBetween(Math.max(0,c.parentOffset-1),c.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...u&&!/\s/.test(u)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,b,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,b)=>{T===l&&(m=b+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Rt.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Qn(t=!0){const e=j(),{uploadFile:n}=Un(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=rt(g);Kn(h,Zn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function xe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=xe();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Xn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Jn=/^(?:[ \t]*(?:\n|$))+/,Yn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,er=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,V=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),nr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ir=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ar=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:or,code:Yn,def:sr,fences:er,heading:tr,hr:V,html:ar,lheading:lt,list:ir,newline:Jn,paragraph:ct,table:O,text:rr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),lr={...Ae,lheading:nr,table:je,paragraph:A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},cr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",V).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ur=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,dr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,oe=/[\s\p{P}\p{S}]/u,Me=/[^\s\p{P}\p{S}]/u,pr=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oe).getRegex(),ht=/(?!~)[\p{P}\p{S}]/u,fr=/(?!~)[\s\p{P}\p{S}]/u,gr=/(?:[^\s\p{P}\p{S}]|~)/u,mr=A(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kr=A(dt,"u").replace(/punct/g,q).getRegex(),br=A(dt,"u").replace(/punct/g,ht).getRegex(),pt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=A(pt,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),wr=A(pt,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,fr).replace(/punct/g,ht).getRegex(),yr=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Tr=A(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,q).getRegex(),vr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ar=A(vr,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Mr=A(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),Sr=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cr=A(ve).replace("(?:-->|$)","-->").getRegex(),Rr=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Er=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ft=A(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),gt=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),$r=A("reflink|nolink(?!\\()","g").replace("reflink",ft).replace("nolink",gt).getRegex(),Ne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Se={_backpedal:O,anyPunctuation:Mr,autolink:Sr,blockSkip:mr,br:ut,code:hr,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:kr,emStrongRDelimAst:xr,emStrongRDelimUnd:yr,escape:ur,link:Er,nolink:gt,punctuation:pr,reflink:ft,reflinkSearch:$r,tag:Rr,text:dr,url:O},_r={...Se,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Se,emStrongRDelimAst:wr,emStrongLDelim:br,delLDelim:Tr,delRDelim:Ar,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ne).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ne).getRegex()},Lr={...de,br:A(ut).replace("{2,}","*").getRegex(),text:A(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:Ae,gfm:lr,pedantic:cr},W={normal:Se,gfm:de,breaks:Lr,pedantic:_r},Ir={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Oe=t=>Ir[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,Oe)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,Oe);return t}function Be(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function De(t,e){let n=t.replace(R.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\";)o=!o;return o?"|":" |"}),r=n.split(R.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(R.slashPipe,"|");return r}function U(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function zr(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Hr(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Fe(t,e,n,r,s){let i=e.href,a=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,o}function Pr(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
1
+ import{c as $,b as j,r as E,j as x,l as K,t as ue,X as Tt,m as vt,K as At,aR as Mt,h as Xe}from"./index-BIAjfIob.js";import{a as St,E as ie,j as Ct,h as Je,S as Rt,r as P,t as Et,v as $t,w as Ye,x as N,y as Ee,z as _t,A as Lt,B as $e,C as It,G as Z,N as D,m as H,H as Y,T as et,R as ke,I as be,J as zt,K as Pt,L as Ht,O as jt,s as Nt,Q as Ot,U as Bt,u as Dt,b as Ft}from"./index-jkZvzgj2.js";import{T as _,n as qt,i as Wt,E as Ut}from"./rich-text-link-control-BC2-hOHc.js";import{a as Gt,e as tt,s as Zt,S as Kt}from"./suggestion-9Q6bHY8e.js";import{B as Vt,c as Qt,t as Xt,C as nt,f as Jt,g as _e,s as Yt,m as Le,a as Ie,b as en,d as ze,e as tn,h as nn,i as rn,j as sn,k as an,l as on,n as ln}from"./index-cem-9T3s.js";import{ad as cn,ae as un,ag as hn,I as dn,b8 as pn,aY as fn}from"./agent-icon-D_ZGENxN.js";import{i as gn}from"./XClose-CZsHZD1U.js";import{i as mn}from"./Check-CfruVhvH.js";import{i as kn}from"./Link01-1uL5aIKM.js";import{s as bn}from"./Trash01-tZa4tQgg.js";import{i as xn,b as wn}from"./use-org-fs-Rb59H37N.js";import{E as Pe,i as rt,a as yn,b as Tn,A as vn,c as An,m as Mn,d as Sn,e as Cn}from"./markdown-D9wcV3av.js";import{i as st}from"./X-D1hYIKW4.js";import{A as Rn}from"./avatar-DDA18BIM.js";import{f as En,C as $n,c as _n,a as Ln,b as In}from"./command-B4qLeS_u.js";import{g as zn}from"./get-initials-D-f_fDFw.js";import{u as Pn}from"./use-org-auth-client-rz6TTtxX.js";import{I as Hn}from"./icon-button-qw_8WIYn.js";function jn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),c(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=qt(a);if(M===""){g();return}if(!Wt(M)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=x.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let b;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(b=s&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),c(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:K("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:x.jsx(mn,{size:14})}),h&&x.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=b):b=e[26];let v;return e[27]!==T||e[28]!==b?(v=x.jsxs("div",{className:"relative",children:[T,b]}),e[27]=T,e[28]=b,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},He=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],Nn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function On(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:Bn},e[0]=n,e[1]=a):a=e[1];const l=St(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let c;e[4]!==r?(c=r("markdownEditor.heading2"),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==r?(u=r("markdownEditor.heading3"),e[6]=r,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&x.jsxs(Vt,{editor:n,shouldShow:Nn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[x.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(cn,{size:14})}),x.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(un,{size:14})}),x.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(hn,{size:14})}),x.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(dn,{size:14})}),x.jsx(le,{}),it.map((g,m)=>x.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:x.jsx(He,{children:`H${g}`})},g)),x.jsx(le,{}),x.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(gn,{size:14})}),x.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(He,{children:"1."})}),x.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(pn,{size:14})}),x.jsx(le,{}),x.jsx(jn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=x.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function Bn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Dn=10,Fn=25,qn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function Wn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??qn[t.type]??""}function Un(){const t=$.c(4),e=j(),{upload:n}=xn(Pe),r=wn(Pe);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=rt(a),o=l?Dn:Fn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const c=l?yn:Tn,u=`${crypto.randomUUID()}${Wn(a)}`;try{return await n.mutateAsync({dir:c,files:[new File([a],u,{type:a.type})]}),r(`${c}/${u}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Je("uploadSlots"),Gn=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Ct({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Zn(t,e){return ee.getState(t)?.get(e)}function Kn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,c=t.state.doc.resolve(e),u=c.parent.textBetween(Math.max(0,c.parentOffset-1),c.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...u&&!/\s/.test(u)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,b,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,b)=>{T===l&&(m=b+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Rt.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Qn(t=!0){const e=j(),{uploadFile:n}=Un(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=rt(g);Kn(h,Zn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function xe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=xe();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Xn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Jn=/^(?:[ \t]*(?:\n|$))+/,Yn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,er=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,V=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),nr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ir=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ar=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:or,code:Yn,def:sr,fences:er,heading:tr,hr:V,html:ar,lheading:lt,list:ir,newline:Jn,paragraph:ct,table:O,text:rr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),lr={...Ae,lheading:nr,table:je,paragraph:A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},cr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",V).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ur=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,dr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,oe=/[\s\p{P}\p{S}]/u,Me=/[^\s\p{P}\p{S}]/u,pr=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oe).getRegex(),ht=/(?!~)[\p{P}\p{S}]/u,fr=/(?!~)[\s\p{P}\p{S}]/u,gr=/(?:[^\s\p{P}\p{S}]|~)/u,mr=A(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kr=A(dt,"u").replace(/punct/g,q).getRegex(),br=A(dt,"u").replace(/punct/g,ht).getRegex(),pt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=A(pt,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),wr=A(pt,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,fr).replace(/punct/g,ht).getRegex(),yr=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Tr=A(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,q).getRegex(),vr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ar=A(vr,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Mr=A(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),Sr=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cr=A(ve).replace("(?:-->|$)","-->").getRegex(),Rr=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Er=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ft=A(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),gt=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),$r=A("reflink|nolink(?!\\()","g").replace("reflink",ft).replace("nolink",gt).getRegex(),Ne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Se={_backpedal:O,anyPunctuation:Mr,autolink:Sr,blockSkip:mr,br:ut,code:hr,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:kr,emStrongRDelimAst:xr,emStrongRDelimUnd:yr,escape:ur,link:Er,nolink:gt,punctuation:pr,reflink:ft,reflinkSearch:$r,tag:Rr,text:dr,url:O},_r={...Se,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Se,emStrongRDelimAst:wr,emStrongLDelim:br,delLDelim:Tr,delRDelim:Ar,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ne).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ne).getRegex()},Lr={...de,br:A(ut).replace("{2,}","*").getRegex(),text:A(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:Ae,gfm:lr,pedantic:cr},W={normal:Se,gfm:de,breaks:Lr,pedantic:_r},Ir={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Oe=t=>Ir[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,Oe)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,Oe);return t}function Be(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function De(t,e){let n=t.replace(R.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\";)o=!o;return o?"|":" |"}),r=n.split(R.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(R.slashPipe,"|");return r}function U(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function zr(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Pr(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Fe(t,e,n,r,s){let i=e.href,a=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,o}function Hr(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
3
3
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=s.length?i.slice(s.length):i}).join(`
4
4
  `)}var ne=class{options;rules;lexer;constructor(t){this.options=t||F}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:U(n,`
5
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Pr(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=U(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:U(e[0],`
5
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Hr(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=U(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:U(e[0],`
6
6
  `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=U(e[0],`
7
7
  `).split(`
8
8
  `),r="",s="",i=[];for(;n.length>0;){let a=!1,l=[],o;for(o=0;o<n.length;o++)if(this.rules.other.blockquoteStart.test(n[o]))l.push(n[o]),a=!0;else if(!a)l.push(n[o]);else break;n=n.slice(o);let c=l.join(`
@@ -14,7 +14,7 @@ ${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
14
14
  `),g=this.blockquote(p);i[i.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,s=s.substring(0,s.length-f.text.length)+g.text;break}else if(d?.type==="list"){let f=d,p=f.raw+`
15
15
  `+n.join(`
16
16
  `),g=this.list(p);i[i.length-1]=g,r=r.substring(0,r.length-d.raw.length)+g.raw,s=s.substring(0,s.length-f.raw.length)+g.raw,n=p.substring(i.at(-1).raw.length).split(`
17
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;t;){let o=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=Hr(e[2].split(`
17
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;t;){let o=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=Pr(e[2].split(`
18
18
  `,1)[0],e[1].length),d=t.split(`
19
19
  `,1)[0],f=!h.trim(),p=0;if(this.options.pedantic?(p=2,u=h.trimStart()):f?p=e[1].length+1:(p=h.search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=h.slice(p),p+=e[1].length),f&&this.rules.other.blankLine.test(d)&&(c+=d+`
20
20
  `,t=t.substring(d.length+1),o=!0),!o){let g=this.rules.other.nextBulletRegex(p),m=this.rules.other.hrRegex(p),k=this.rules.other.fencesBeginRegex(p),w=this.rules.other.headingBeginRegex(p),y=this.rules.other.htmlBeginRegex(p),T=this.rules.other.blockquoteBeginRegex(p);for(;t;){let b=t.split(`
@@ -63,21 +63,21 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
63
63
  `),g=p[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),m=g?g[2]:"";let k=[];if(p.length>1&&p.slice(1).join(`
64
64
  `).trim()){const w=p.slice(1),y=w.filter(T=>T.trim());if(y.length>0){const T=Math.min(...y.map(v=>v.length-v.trimStart().length)),b=w.map(v=>v.trim()?v.slice(T):"").join(`
65
65
  `).trim();b&&(k=this.markedInstance.lexer(`${b}
66
- `))}}d={type:"taskItem",raw:"",mainContent:m,indentLevel:h,checked:u??!1,text:m,tokens:this.tokenizeInline(m),nestedTokens:k}}const f=c?"taskList":"list";i!==f?(s.length>0&&r.push({type:i,items:s}),s=[d],i=f):s.push(d)}s.length>0&&r.push({type:i,items:s});const a=[];for(let l=0;l<r.length;l+=1){const o=r[l],c={...t,type:o.type,items:o.items},u=this.parseToken(c);u&&(Array.isArray(u)?a.push(...u):a.push(u))}return a.length>0?a:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(r=>{if(!r.parseMarkdown)return!1;const s=r.parseMarkdown(t,n),i=this.normalizeParseResult(s);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){const e=[];for(let a=0;a<t.length;a+=1){const l=t[a];if(l.type==="text")e.push({type:"text",text:Ee(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,r;const o=((n=(r=l.raw)!==null&&r!==void 0?r:l.text)!==null&&n!==void 0?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(o),u=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(o)){const d=u[1],f=this.escapeRegex(d),p=new RegExp(`^<\\/\\s*${f}\\b`,"i");let g=-1;const m=[o];for(let k=a+1;k<t.length;k+=1){var s,i;const w=t[k],y=((s=(i=w.raw)!==null&&i!==void 0?i:w.text)!==null&&s!==void 0?s:"").toString();if(m.push(y),w.type==="html"&&p.test(y)){g=k;break}}if(g!==-1){const k=m.join(""),w={type:"html",raw:k,text:k,block:!1},y=this.parseHTMLToken(w);if(y){const T=this.normalizeParseResult(y);Array.isArray(T)?e.push(...T):T&&e.push(T)}a=g;continue}}const h=this.parseHTMLToken(l);if(h){const d=this.normalizeParseResult(h);Array.isArray(d)?e.push(...d):d&&e.push(d)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const c=this.createParseHelpers(),u=o.parseMarkdown(l,c);if(this.isMarkResult(u)){const h=this.applyMarkToContent(u.mark,u.content,u.attrs);e.push(...h)}else{const h=this.normalizeParseResult(u);Array.isArray(h)?e.push(...h):h&&e.push(h)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let a=e.length-1;a>0;a-=1){const l=e[a],o=e[a-1];if(l.type==="text"&&o.type==="text"){const c=l.marks||[],u=o.marks||[];_t(c,u)&&(o.text=(o.text||"")+(l.text||""),e.splice(a,1))}}return e}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:Ee(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=Lt(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const r=this.toInlineContent(n.content);return r.length>0?r:null}return n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}toInlineContent(t){const e=this.getInlineNodeTypes();return t.flatMap(n=>n.type&&e.has(n.type)?[n]:n.content?this.toInlineContent(n.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;const t=new Set(["text"]);try{const e=$e(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return Qr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=$e(this.baseExtensions),n=r=>{const s=r?.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof i?.tag=="string"){const a=i.tag.match(/^[a-zA-Z][\w-]*/);a&&t.add(a[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(r=>this.codeTypes.has(typeof r=="string"?r:r.type))?t:this.escapeMarkdownSyntax(It(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const a=this.getHandlerForToken(t.type);if(!a)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(u,h)=>{const d=a.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,t,h||"",n,d):this.renderNodes(u,t,h||"",n,d)},renderChild:(u,h)=>{const d=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(u,t,h,d)},indent:u=>this.indentString+u,wrapInBlock:Br},c={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...s}};return((i=a.renderMarkdown)===null||i===void 0?void 0:i.call(a,t,o,c))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,a=new Set,l=new Map;return t.forEach((o,c)=>{const u=c<t.length-1?t[c+1]:null;if(o.type)if(o.type==="text"){let h=this.encodeTextForMarkdown(o.text||"",o,e);const d=new Map((o.marks||[]).map(b=>[b.type,b])),f=this.getMarksToOpenForSerialization(i,d,u),p=Dr(d,u),g=p.filter(b=>i.has(b)),m=g.length>0&&f.length>0;let k="";if(p.length>0&&!m){const b=h.match(/(\s+)$/);b&&(k=b[1],h=h.slice(0,-k.length))}m||p.slice().reverse().forEach(b=>{if(!i.has(b))return;const v=d.get(b),M=this.getMarkClosing(b,v,l.get(b));M&&(h+=M),i.has(b)&&(i.delete(b),l.delete(b))});let w="";if(f.length>0){const b=h.match(/^(\s+)/);b&&(w=b[1],h=h.slice(w.length))}f.forEach(({type:b,mark:v})=>{const M=a.has(b)?"html":"markdown",C=this.getMarkOpening(b,v,M);C&&(h=C+h),l.set(b,M),a.delete(b)}),m||f.slice().reverse().forEach(({type:b,mark:v})=>{i.set(b,v)}),h=w+h;let y;if(m){const b=new Set((u?.marks||[]).map(C=>C.type));f.forEach(({type:C})=>{b.has(C)&&this.getHtmlReopenTags(C)&&a.add(C)});const v=Array.from(i.keys()),M=g.slice().sort((C,yt)=>v.indexOf(yt)-v.indexOf(C));y=[...f.map(C=>C.type),...M]}else y=qr(i,d,u,this.markSetsEqual.bind(this));let T="";if(y.length>0){const b=h.match(/(\s+)$/);b&&(T=b[1],h=h.slice(0,-T.length))}y.forEach(b=>{var v;const M=(v=i.get(b))!==null&&v!==void 0?v:d.get(b),C=this.getMarkClosing(b,M,l.get(b));C&&(h+=C),i.delete(b),l.delete(b)}),h+=T,h+=k,s.push(h)}else{const h=new Set((o.marks||[]).map(k=>k.type)),d=new Map,f=new Map;i.forEach((k,w)=>{if(h.has(w)){var y;d.set(w,k),f.set(w,(y=l.get(w))!==null&&y!==void 0?y:"markdown")}});const p=Wr(i,(k,w)=>this.getMarkClosing(k,w,l.get(k)));l.clear();const g=this.renderNodeToMarkdown(o,e,c,r),m=o.type==="hardBreak"?"":Ur(d,i,(k,w)=>{var y;const T=(y=f.get(k))!==null&&y!==void 0?y:"markdown";return l.set(k,T),this.getMarkOpening(k,w,T)});s.push(p+g+m)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.open)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:u=>u,wrapInBlock:(u,h)=>u+h},{index:0,level:0,parentType:"text",meta:{}}),c=o.indexOf(a);return c>=0?o.substring(0,c):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.close)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:h=>h,wrapInBlock:(h,d)=>h+d},{index:0,level:0,parentType:"text",meta:{}}),c=o.indexOf(a),u=c+33;return c>=0?o.substring(u):""}catch(o){throw new Error(`Failed to get mark closing for ${t}: ${o}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&Z(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=Fr(t,e);if(r.length<=1)return r;const s=n?.marks||[],i=(c,u)=>s.some(h=>h.type===c&&Z(h.attrs,u)),a=(c,u)=>{var h,d;const f=(h=this.extensionRanks.get(c.type))!==null&&h!==void 0?h:Number.MAX_SAFE_INTEGER,p=(d=this.extensionRanks.get(u.type))!==null&&d!==void 0?d:Number.MAX_SAFE_INTEGER;return f!==p?p-f:c.type.localeCompare(u.type)},l=r.filter(c=>!i(c.type,c.mark.attrs)).sort(a),o=r.filter(c=>i(c.type,c.mark.attrs)).sort(a);return[...l,...o]}};const Xr=ie.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return H.setContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return H.setContent(t,e);const n=this.editor.markdown.parse(t);return H.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return H.insertContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return H.insertContent(t,e);const n=this.editor.markdown.parse(t);return H.insertContent(n,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType)return H.insertContentAt(t,e,n);if(X(e,n?.contentType)!=="markdown"||!this.editor.markdown)return H.insertContentAt(t,e,n);const r=this.editor.markdown.parse(e);return H.insertContentAt(t,r,n)}}},addStorage(){return{manager:new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||X(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);!((t=e.content)===null||t===void 0)&&t.length&&(this.editor.options.content=e)}});function se(t){return t==="left"||t==="right"||t==="center"?t:null}function Jr(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return se(e||n)}function Yr(t){return se(t?.align)}function mt(){return{default:null,parseHTML:t=>Jr(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function es(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function kt(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):es(t)}const ts=/[ \t\r\n\f]+/g;function bt(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(ts,"")===""}function xt(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}const ns=D.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>bt(t)?{}:!1,getContent:(t,e)=>xt(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",P(this.options.HTMLAttributes,t),0]}}),rs=D.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>bt(t)?{}:!1,getContent:(t,e)=>xt(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",P(this.options.HTMLAttributes,t),0]}}),ss=D.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",P(this.options.HTMLAttributes,t),0]}});function ge(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function We(t,e,n,r,s,i){let a=0,l=!0,o=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,f=0;d<c.childCount;d+=1){const{colspan:p,colwidth:g}=c.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const k=s===f?i:g&&g[m],w=k?`${k}px`:"";if(a+=k||r,k||(l=!1),o){if(o.style.width!==w){const[y,T]=ge(r,k);o.style.setProperty(y,T)}o=o.nextSibling}else{const y=document.createElement("col"),[T,b]=ge(r,k);y.style.setProperty(T,b),e.appendChild(y)}}}for(;o;){var u;const d=o.nextSibling;(u=o.parentNode)===null||u===void 0||u.removeChild(o),o=d}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!h?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var is=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),We(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,We(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function as(t,e,n,r){let s=0,i=!0;const a=[],l=t.firstChild;if(!l)return{};for(let u=0,h=0;u<l.childCount;u+=1){const{colspan:d,colwidth:f}=l.child(u).attrs;for(let p=0;p<d;p+=1,h+=1){const g=n===h?r:f&&f[p];s+=g||e,g||(i=!1);const[m,k]=ge(e,g);a.push(["col",{style:`${m}: ${k}`}])}}const o=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:o,tableMinWidth:c}}function Ue(t,e){return t.createAndFill()}function os(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function ls(t,e,n,r,s){const i=os(t),a=[],l=[];for(let c=0;c<n;c+=1){const u=Ue(i.cell);if(u&&l.push(u),r){const h=Ue(i.header_cell);h&&a.push(h)}}const o=[];for(let c=0;c<e;c+=1)o.push(i.row.createChecked(null,r&&c===0?a:l));return i.table.createChecked(null,o)}function cs(t){return t instanceof nt}const J=({editor:t})=>{const{selection:e}=t.state;if(!cs(e))return!1;let n=0;const r=Y(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function Ge(t,e){const n=t.mapping.map(e),r=Y(t.selection.$from,a=>a.type.name==="table");if(r?.pos===n)return;const s=t.doc.nodeAt(n);if(!s)return;const i=n+s.nodeSize-1;t.setSelection(et.near(t.doc.resolve(i),-1))}function us(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let a=0;for(;s+a<t.length&&t[s+a]==="`";)a+=1;if(a===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,o=>o==="|"?"\\|":o)+t.slice(s,s+r),n=s+r,i=!0;break}s+=a}i||(e+=t.slice(n,n+r),n+=r)}return e}function hs(t){return t.split(`
66
+ `))}}d={type:"taskItem",raw:"",mainContent:m,indentLevel:h,checked:u??!1,text:m,tokens:this.tokenizeInline(m),nestedTokens:k}}const f=c?"taskList":"list";i!==f?(s.length>0&&r.push({type:i,items:s}),s=[d],i=f):s.push(d)}s.length>0&&r.push({type:i,items:s});const a=[];for(let l=0;l<r.length;l+=1){const o=r[l],c={...t,type:o.type,items:o.items},u=this.parseToken(c);u&&(Array.isArray(u)?a.push(...u):a.push(u))}return a.length>0?a:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(r=>{if(!r.parseMarkdown)return!1;const s=r.parseMarkdown(t,n),i=this.normalizeParseResult(s);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){const e=[];for(let a=0;a<t.length;a+=1){const l=t[a];if(l.type==="text")e.push({type:"text",text:Ee(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,r;const o=((n=(r=l.raw)!==null&&r!==void 0?r:l.text)!==null&&n!==void 0?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(o),u=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(o)){const d=u[1],f=this.escapeRegex(d),p=new RegExp(`^<\\/\\s*${f}\\b`,"i");let g=-1;const m=[o];for(let k=a+1;k<t.length;k+=1){var s,i;const w=t[k],y=((s=(i=w.raw)!==null&&i!==void 0?i:w.text)!==null&&s!==void 0?s:"").toString();if(m.push(y),w.type==="html"&&p.test(y)){g=k;break}}if(g!==-1){const k=m.join(""),w={type:"html",raw:k,text:k,block:!1},y=this.parseHTMLToken(w);if(y){const T=this.normalizeParseResult(y);Array.isArray(T)?e.push(...T):T&&e.push(T)}a=g;continue}}const h=this.parseHTMLToken(l);if(h){const d=this.normalizeParseResult(h);Array.isArray(d)?e.push(...d):d&&e.push(d)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const c=this.createParseHelpers(),u=o.parseMarkdown(l,c);if(this.isMarkResult(u)){const h=this.applyMarkToContent(u.mark,u.content,u.attrs);e.push(...h)}else{const h=this.normalizeParseResult(u);Array.isArray(h)?e.push(...h):h&&e.push(h)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let a=e.length-1;a>0;a-=1){const l=e[a],o=e[a-1];if(l.type==="text"&&o.type==="text"){const c=l.marks||[],u=o.marks||[];_t(c,u)&&(o.text=(o.text||"")+(l.text||""),e.splice(a,1))}}return e}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:Ee(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=Lt(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const r=this.toInlineContent(n.content);return r.length>0?r:null}return n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}toInlineContent(t){const e=this.getInlineNodeTypes();return t.flatMap(n=>n.type&&e.has(n.type)?[n]:n.content?this.toInlineContent(n.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;const t=new Set(["text"]);try{const e=$e(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return Qr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=$e(this.baseExtensions),n=r=>{const s=r?.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof i?.tag=="string"){const a=i.tag.match(/^[a-zA-Z][\w-]*/);a&&t.add(a[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(r=>this.codeTypes.has(typeof r=="string"?r:r.type))?t:this.escapeMarkdownSyntax(It(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const a=this.getHandlerForToken(t.type);if(!a)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(u,h)=>{const d=a.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,t,h||"",n,d):this.renderNodes(u,t,h||"",n,d)},renderChild:(u,h)=>{const d=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(u,t,h,d)},indent:u=>this.indentString+u,wrapInBlock:Br},c={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...s}};return((i=a.renderMarkdown)===null||i===void 0?void 0:i.call(a,t,o,c))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,a=new Set,l=new Map;return t.forEach((o,c)=>{const u=c<t.length-1?t[c+1]:null;if(o.type)if(o.type==="text"){let h=this.encodeTextForMarkdown(o.text||"",o,e);const d=new Map((o.marks||[]).map(b=>[b.type,b])),f=this.getMarksToOpenForSerialization(i,d,u),p=Dr(d,u),g=p.filter(b=>i.has(b)),m=g.length>0&&f.length>0;let k="";if(p.length>0&&!m){const b=h.match(/(\s+)$/);b&&(k=b[1],h=h.slice(0,-k.length))}m||p.slice().reverse().forEach(b=>{if(!i.has(b))return;const v=d.get(b),M=this.getMarkClosing(b,v,l.get(b));M&&(h+=M),i.has(b)&&(i.delete(b),l.delete(b))});let w="";if(f.length>0){const b=h.match(/^(\s+)/);b&&(w=b[1],h=h.slice(w.length))}f.forEach(({type:b,mark:v})=>{const M=a.has(b)?"html":"markdown",C=this.getMarkOpening(b,v,M);C&&(h=C+h),l.set(b,M),a.delete(b)}),m||f.slice().reverse().forEach(({type:b,mark:v})=>{i.set(b,v)}),h=w+h;let y;if(m){const b=new Set((u?.marks||[]).map(C=>C.type));f.forEach(({type:C})=>{b.has(C)&&this.getHtmlReopenTags(C)&&a.add(C)});const v=Array.from(i.keys()),M=g.slice().sort((C,yt)=>v.indexOf(yt)-v.indexOf(C));y=[...f.map(C=>C.type),...M]}else y=qr(i,d,u,this.markSetsEqual.bind(this));let T="";if(y.length>0){const b=h.match(/(\s+)$/);b&&(T=b[1],h=h.slice(0,-T.length))}y.forEach(b=>{var v;const M=(v=i.get(b))!==null&&v!==void 0?v:d.get(b),C=this.getMarkClosing(b,M,l.get(b));C&&(h+=C),i.delete(b),l.delete(b)}),h+=T,h+=k,s.push(h)}else{const h=new Set((o.marks||[]).map(k=>k.type)),d=new Map,f=new Map;i.forEach((k,w)=>{if(h.has(w)){var y;d.set(w,k),f.set(w,(y=l.get(w))!==null&&y!==void 0?y:"markdown")}});const p=Wr(i,(k,w)=>this.getMarkClosing(k,w,l.get(k)));l.clear();const g=this.renderNodeToMarkdown(o,e,c,r),m=o.type==="hardBreak"?"":Ur(d,i,(k,w)=>{var y;const T=(y=f.get(k))!==null&&y!==void 0?y:"markdown";return l.set(k,T),this.getMarkOpening(k,w,T)});s.push(p+g+m)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.open)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:u=>u,wrapInBlock:(u,h)=>u+h},{index:0,level:0,parentType:"text",meta:{}}),c=o.indexOf(a);return c>=0?o.substring(0,c):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.close)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:h=>h,wrapInBlock:(h,d)=>h+d},{index:0,level:0,parentType:"text",meta:{}}),c=o.indexOf(a),u=c+33;return c>=0?o.substring(u):""}catch(o){throw new Error(`Failed to get mark closing for ${t}: ${o}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&Z(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=Fr(t,e);if(r.length<=1)return r;const s=n?.marks||[],i=(c,u)=>s.some(h=>h.type===c&&Z(h.attrs,u)),a=(c,u)=>{var h,d;const f=(h=this.extensionRanks.get(c.type))!==null&&h!==void 0?h:Number.MAX_SAFE_INTEGER,p=(d=this.extensionRanks.get(u.type))!==null&&d!==void 0?d:Number.MAX_SAFE_INTEGER;return f!==p?p-f:c.type.localeCompare(u.type)},l=r.filter(c=>!i(c.type,c.mark.attrs)).sort(a),o=r.filter(c=>i(c.type,c.mark.attrs)).sort(a);return[...l,...o]}};const Xr=ie.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return P.setContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.setContent(t,e);const n=this.editor.markdown.parse(t);return P.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return P.insertContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContent(t,e);const n=this.editor.markdown.parse(t);return P.insertContent(n,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType)return P.insertContentAt(t,e,n);if(X(e,n?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContentAt(t,e,n);const r=this.editor.markdown.parse(e);return P.insertContentAt(t,r,n)}}},addStorage(){return{manager:new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||X(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);!((t=e.content)===null||t===void 0)&&t.length&&(this.editor.options.content=e)}});function se(t){return t==="left"||t==="right"||t==="center"?t:null}function Jr(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return se(e||n)}function Yr(t){return se(t?.align)}function mt(){return{default:null,parseHTML:t=>Jr(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function es(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function kt(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):es(t)}const ts=/[ \t\r\n\f]+/g;function bt(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(ts,"")===""}function xt(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}const ns=D.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>bt(t)?{}:!1,getContent:(t,e)=>xt(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",H(this.options.HTMLAttributes,t),0]}}),rs=D.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>bt(t)?{}:!1,getContent:(t,e)=>xt(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",H(this.options.HTMLAttributes,t),0]}}),ss=D.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",H(this.options.HTMLAttributes,t),0]}});function ge(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function We(t,e,n,r,s,i){let a=0,l=!0,o=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,f=0;d<c.childCount;d+=1){const{colspan:p,colwidth:g}=c.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const k=s===f?i:g&&g[m],w=k?`${k}px`:"";if(a+=k||r,k||(l=!1),o){if(o.style.width!==w){const[y,T]=ge(r,k);o.style.setProperty(y,T)}o=o.nextSibling}else{const y=document.createElement("col"),[T,b]=ge(r,k);y.style.setProperty(T,b),e.appendChild(y)}}}for(;o;){var u;const d=o.nextSibling;(u=o.parentNode)===null||u===void 0||u.removeChild(o),o=d}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!h?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var is=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),We(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,We(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function as(t,e,n,r){let s=0,i=!0;const a=[],l=t.firstChild;if(!l)return{};for(let u=0,h=0;u<l.childCount;u+=1){const{colspan:d,colwidth:f}=l.child(u).attrs;for(let p=0;p<d;p+=1,h+=1){const g=n===h?r:f&&f[p];s+=g||e,g||(i=!1);const[m,k]=ge(e,g);a.push(["col",{style:`${m}: ${k}`}])}}const o=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:o,tableMinWidth:c}}function Ue(t,e){return t.createAndFill()}function os(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function ls(t,e,n,r,s){const i=os(t),a=[],l=[];for(let c=0;c<n;c+=1){const u=Ue(i.cell);if(u&&l.push(u),r){const h=Ue(i.header_cell);h&&a.push(h)}}const o=[];for(let c=0;c<e;c+=1)o.push(i.row.createChecked(null,r&&c===0?a:l));return i.table.createChecked(null,o)}function cs(t){return t instanceof nt}const J=({editor:t})=>{const{selection:e}=t.state;if(!cs(e))return!1;let n=0;const r=Y(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function Ge(t,e){const n=t.mapping.map(e),r=Y(t.selection.$from,a=>a.type.name==="table");if(r?.pos===n)return;const s=t.doc.nodeAt(n);if(!s)return;const i=n+s.nodeSize-1;t.setSelection(et.near(t.doc.resolve(i),-1))}function us(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let a=0;for(;s+a<t.length&&t[s+a]==="`";)a+=1;if(a===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,o=>o==="|"?"\\|":o)+t.slice(s,s+r),n=s+r,i=!0;break}s+=a}i||(e+=t.slice(n,n+r),n+=r)}return e}function hs(t){return t.split(`
67
67
  `).map(e=>!e.includes("|")||!e.includes("`")?e:us(e)).join(`
68
68
  `)}function ds(t){return(t||"").replace(/\s+/g," ").trim()}function ps(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!==null&&r!==void 0?r:"";if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(p=>{const g=[];p.content&&p.content.forEach(m=>{let k="";m.content&&Array.isArray(m.content)&&m.content.length>1?k=m.content.map(b=>e.renderChildren(b)).join(s):k=m.content?e.renderChildren(m.content):"";const w=ds(k.split(s).join(`
69
69
  `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),y=m.type==="tableHeader",T=Yr(m.attrs);g.push({text:w,isHeader:y,align:T})}),i.push(g)});const a=i.reduce((p,g)=>Math.max(p,g.length),0);if(a===0)return"";const l=Array.from({length:a}).fill(0);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;const k=(((g=p[m])===null||g===void 0?void 0:g.text)||"").length;k>l[m]&&(l[m]=k),l[m]<3&&(l[m]=3)}});const o=(p,g)=>p+" ".repeat(Math.max(0,g-p.length)),c=i[0],u=c.some(p=>p.isHeader),h=Array.from({length:a}).fill(null);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;!h[m]&&(!((g=p[m])===null||g===void 0)&&g.align)&&(h[m]=p[m].align)}});let d=`
70
70
  `;const f=Array.from({length:a}).map((p,g)=>u&&c[g]&&c[g].text||"");return d+=`| ${f.map((p,g)=>o(p,l[g])).join(" | ")} |
71
71
  `,d+=`| ${l.map((p,g)=>{const m=Math.max(3,p),k=h[g];return k==="left"?`:${"-".repeat(m)}`:k==="right"?`${"-".repeat(m)}:`:k==="center"?`:${"-".repeat(m)}:`:"-".repeat(m)}).join(" | ")} |
72
72
  `,(u?i.slice(1):i).forEach(p=>{d+=`| ${Array.from({length:a}).fill(0).map((g,m)=>o(p[m]&&p[m].text||"",l[m])).join(" | ")} |
73
- `}),d}const fs=D.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:is,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=as(t,this.options.cellMinWidth),i=e.style;function a(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",P(this.options.HTMLAttributes,e,{style:a()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((i,a)=>{var l;const o=se((l=r[a])!==null&&l!==void 0?l:i.align),c=o?{align:o}:{};s.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((a,l)=>{var o;const c=se((o=r[l])!==null&&o!==void 0?o:a.align),u=c?{align:c}:{};i.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>ps(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
73
+ `}),d}const fs=D.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:is,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=as(t,this.options.cellMinWidth),i=e.style;function a(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",H(this.options.HTMLAttributes,e,{style:a()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const s=[];t.header.forEach((i,a)=>{var l;const o=se((l=r[a])!==null&&l!==void 0?l:i.align),c=o?{align:o}:{};s.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((a,l)=>{var o;const c=se((o=r[l])!==null&&o!==void 0?o:a.align),u=c?{align:c}:{};i.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>ps(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
74
74
  `);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
75
75
 
76
76
  `),s=r>=0?t.slice(0,r):t,i=s.split(`
77
77
  `);if(i.length<2)return;const a=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(a)||!a.includes("|"))return;const l=hs(s);if(l===s)return;const o=n.blockTokens(l)[0];if(o?.type!=="table"||!o.raw)return;const c=o.raw.split(`
78
78
  `).length,u=t.split(`
79
79
  `).slice(0,c).join(`
80
- `);return{...o,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const a=ls(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(et.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>ln(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>on(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return an(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>sn(t,e),addRowAfter:()=>({state:t,dispatch:e})=>rn(t,e),deleteRow:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return nn(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>tn(t,e),mergeCells:()=>({state:t,dispatch:e})=>Le(t,e),splitCell:()=>({state:t,dispatch:e})=>Ie(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ze("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ze("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>en(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Le(t,e)?!0:Ie(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Yt(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>_e(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>_e(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Jt(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=nt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:J,"Mod-Backspace":J,Delete:J,"Mod-Delete":J}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Qt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=P(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Ye(N(t,"tableRole",e))}}}),gs=ie.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(fs.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ns.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(rs.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ss.configure(this.options.tableRow)),t}});function ms(t){const e=$.c(13),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",c=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let u;e[0]!==c?(u=K(vn,"select-none",c),e[0]=c,e[1]=u):u=e[1];let h;e[2]!==i||e[3]!==s.isEditable||e[4]!==a?(h=s.isEditable&&x.jsx("button",{type:"button","aria-label":a("markdownEditor.removeFile"),onMouseDown:ks,onClick:i,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:x.jsx(st,{size:14})}),e[2]=i,e[3]=s.isEditable,e[4]=a,e[5]=h):h=e[5];let d;e[6]!==l||e[7]!==o||e[8]!==h?(d=x.jsx(An,{href:l,name:o,children:h}),e[6]=l,e[7]=o,e[8]=h,e[9]=d):d=e[9];let f;return e[10]!==u||e[11]!==d?(f=x.jsx(be,{as:"span",className:u,children:d}),e[10]=u,e[11]=d,e[12]=f):f=e[12],f}function ks(t){return t.preventDefault()}function bs(t){return t.replace(/([[\]])/g,"\\$1")}const xs=D.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",P(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${bs(n)}](${e})`},addNodeView(){return ke(ms)}});function ws(t){const e=$.c(5),{node:n,selected:r}=t,s=typeof n.attrs.name=="string"?n.attrs.name:"",i=r&&"ring-2 ring-ring";let a;e[0]!==i?(a=K("select-none rounded px-1 font-medium text-primary","bg-primary/10",i),e[0]=i,e[1]=a):a=e[1];let l;return e[2]!==s||e[3]!==a?(l=x.jsxs(be,{as:"span","data-testid":"mention-chip",className:a,children:["@",s]}),e[2]=s,e[3]=a,e[4]=l):l=e[4],l}const ys=D.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-mention-name"),renderHTML:t=>t.name?{"data-mention-name":t.name}:{}}}},parseHTML(){return[{tag:"span[data-mention-id]"}]},renderHTML({HTMLAttributes:t,node:e}){return["span",P(t),`@${typeof e.attrs.name=="string"?e.attrs.name:""}`]},renderMarkdown:t=>{const e=typeof t.attrs?.id=="string"?t.attrs.id:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return e?Mn(e,n):`@${n}`},addNodeView(){return ke(ws)}}),Ts="studio.mention-members.",me=new Map;function Ze(t){const e=me.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const r=JSON.parse(n);if(!Array.isArray(r))return;const s=r.filter(i=>!!i&&typeof i.id=="string"&&typeof i.name=="string");return me.set(t,s),s}catch{return}}function vs(t,e){me.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function As(t,e){if(!t?.length)return e;const n=new Map(t.map(r=>[r.id,r]));return e.map(r=>{const s=n.get(r.id);return s&&s.name===r.name&&s.email===r.email&&s.image===r.image?s:r})}function Ms(t){return t.map(e=>({id:e.userId,name:e.user?.name?.trim()||e.user?.email?.trim()||"",email:e.user?.email??"",image:e.user?.image??null})).filter(e=>!!e.name).sort((e,n)=>e.name.localeCompare(n.name))}function Ss(t){const e=$.c(17),{locator:n}=Tt(),r=Hn(),s=`${Ts}${n}`;let i;e[0]!==n?(i=At.mentionMembers(n),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==s?(a=()=>Ze(s),e[2]=s,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==s?(l=async()=>{const f=await r.organization.listMembers(),p=As(Ze(s),Ms(f?.data?.members??[]));return vs(s,p),p},e[4]=r,e[5]=s,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==i||e[9]!==a||e[10]!==l?(o={queryKey:i,enabled:t,staleTime:0,placeholderData:a,queryFn:l},e[7]=t,e[8]=i,e[9]=a,e[10]=l,e[11]=o):o=e[11];const c=vt(o);let u;e[12]!==c.data?(u=c.data??[],e[12]=c.data,e[13]=u):u=e[13];const h=c.isFetching&&!c.data;let d;return e[14]!==u||e[15]!==h?(d={members:u,loading:h},e[14]=u,e[15]=h,e[16]=d):d=e[16],d}const Ke={query:"",range:null,rect:null,editor:null};class Cs{state=Ke;listeners=new Set;dismissal=null;latched=!1;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;set(e){this.state=e;for(const n of this.listeners)n()}close(){this.latched=!1,this.set(Ke)}}const Re=new Je("markdownEditorMention");function Rs(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),tt(t.view,Re)}function Es(t,e,n){const r=Math.min(e+n,t.content.size);return e>=r?"":t.textBetween(e,r,"","")}function wt(t,e){const n=e.getSnapshot().range??void 0;n&&n.to>n.from&&(e.dismissal={from:n.from,text:t.state.doc.textBetween(n.from,n.to,"")}),tt(t.view,Re)}function $s(t){return ie.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Re,allowedPrefixes:[" ",`
81
- `],allow:({state:n,range:r})=>{const s=t.dismissal;return s?r.from===s.from&&Es(n.doc,s.from,s.text.length)===s.text?!1:(t.dismissal=null,!0):!0},items:()=>[],render:()=>({onStart:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onUpdate:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onKeyDown:({event:n})=>n.key==="Escape"?(wt(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Gt(e)]}})}const Ve=256,_s=40,Qe=280,Ls=140;function Is(t){const e=$.c(4),{store:n}=t,r=E.useSyncExternalStore(n.subscribe,n.getSnapshot),s=r.range!==null;let i;return e[0]!==s||e[1]!==r||e[2]!==n?(i=s?x.jsx(zs,{store:n,state:r}):null,e[0]=s,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}function zs({store:t,state:e}){const n=j(),{members:r,loading:s}=Ss(!0),[i,a]=E.useState(e.query),[l,o]=E.useState(null),c=Hs(e.editor),u=c.getBoundingClientRect(),h=c===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):u,d=e.rect?.()??new DOMRect(0,0,0,0),f=h.bottom-d.bottom,p=f<Qe&&d.top-h.top>f,g=(p?d.top-h.top:f)-8,m=Math.min(Qe,Math.max(g,Ls))-_s,k={position:"absolute",width:Ve,left:Math.min(d.left,h.right-Ve-8)-u.left,...p?{bottom:u.bottom-d.top+6}:{top:d.bottom-u.top+6}},w=()=>{e.editor&&wt(e.editor,t),t.close()},y=b=>{const v=b.relatedTarget;if((!v||e.editor?.view.dom.contains(v)===!0)&&t.latched){l?.focus();return}w()},T=b=>{!e.editor||!e.range||(Rs(e.editor,e.range,b),t.close())};return Mt.createPortal(x.jsx("div",{style:k,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg border border-border bg-popover shadow-md",children:x.jsxs(En,{onKeyDown:b=>{b.key==="Escape"&&(b.preventDefault(),w(),e.editor?.commands.focus())},children:[x.jsx($n,{ref:o,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:a,placeholder:n("markdownEditor.mentionSearch"),onBlur:y}),x.jsxs(_n,{style:{maxHeight:m},children:[s?x.jsx("div",{className:"flex items-center justify-center py-6",children:x.jsx(Xe,{size:"sm"})}):x.jsx(Ln,{children:n("markdownEditor.mentionEmpty")}),r.map(b=>x.jsxs(In,{value:`${b.name} ${b.email}`,onSelect:()=>T(b),onMouseDown:v=>v.preventDefault(),className:"gap-2",children:[x.jsx(Rn,{url:b.image??void 0,fallback:zn(b.name),shape:"circle",size:"xs"}),x.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name})]},b.id))]})]})}),c)}function Hs(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}const Ps=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,js=D.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",P(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,a;const l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",o=(r=(s=t.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",c=(i=(a=t.attrs)===null||a===void 0?void 0:a.title)!==null&&i!==void 0?i:"";return c?`![${o}](${l} "${c}")`:`![${o}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:a,HTMLAttributes:l,editor:o})=>{const c=document.createElement("img");c.draggable=!1;const u=P(this.options.HTMLAttributes,l);Object.entries(u).forEach(([k,w])=>{if(w!=null)switch(k){case"src":case"width":case"height":break;default:c.setAttribute(k,w)}}),u.src!==null&&(c.src=u.src);let h={...l};const d=k=>{if(typeof k=="string"&&k!==""){c.getAttribute("src")!==k&&(c.src=k);return}c.hasAttribute("src")&&c.removeAttribute("src"),c.src!==""&&(c.src="")};d(l.src);const f=k=>{if(k.type!==i.type)return!1;const w=o.extensionManager.attributes.filter(T=>T.type===k.type.name),y=Pt(k,w);return Object.keys(h).forEach(T=>{!s.has(T)&&!(T in y)&&c.removeAttribute(T)}),Object.entries(y).forEach(([T,b])=>{s.has(T)||(b!=null?c.setAttribute(T,b):c.removeAttribute(T))}),d(y.src),h=y,!0},p=new Ht({element:c,editor:o,node:i,getPos:a,onResize:(k,w)=>{c.style.width=`${k}px`,c.style.height=`${w}px`},onCommit:(k,w)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:k,height:w}).run()},onUpdate:f,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),g=p.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",c.complete&&c.naturalWidth>0?m():(c.onload=m,c.onerror=m),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[zt({find:Ps,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var Ns=js;function Os(t){const e=$.c(16),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let c;e[0]!==o||e[1]!==a?(c=o||a("markdownEditor.imageAltFallback"),e[0]=o,e[1]=a,e[2]=c):c=e[2];const u=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==u?(h=K("max-h-[420px] max-w-full rounded-lg border border-border object-contain",u),e[3]=u,e[4]=h):h=e[4];let d;e[5]!==l||e[6]!==c||e[7]!==h?(d=x.jsx("img",{src:l,alt:c,draggable:!1,className:h}),e[5]=l,e[6]=c,e[7]=h,e[8]=d):d=e[8];let f;e[9]!==i||e[10]!==s.isEditable||e[11]!==a?(f=s.isEditable&&x.jsx("button",{type:"button","aria-label":a("markdownEditor.removeImage"),onMouseDown:Bs,onClick:i,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:x.jsx(st,{size:14})}),e[9]=i,e[10]=s.isEditable,e[11]=a,e[12]=f):f=e[12];let p;return e[13]!==d||e[14]!==f?(p=x.jsxs(be,{className:"group/image relative my-3 w-fit max-w-full",children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15],p}function Bs(t){return t.preventDefault()}const Ds=Ns.extend({addNodeView(){return ke(Os)}}).configure({inline:!1,allowBase64:!1}),Fs={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},qs=Bt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Sn(n))return e.createNode("attachment",{href:n,name:t.text??""});const r=Cn(n);return r?e.createNode("mention",{id:r,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function Ws(t="",e){return[Nt.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),qs.configure(Fs),Zt.configure({placeholder:t}),gs,jt,Ot.configure({nested:!0}),Ds,xs,Gn,ys,...e?[$s(e)]:[],Xr.configure({markedOptions:{breaks:!0}})]}const Us=/^(\s*)([-*+]|\d+[.)])\s+\S/,Gs=/^\s*(```|~~~)/,Zs=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Ks(t){const e=[];let n=!1,r=!1;for(const s of t.split(`
80
+ `);return{...o,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const a=ls(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(et.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>ln(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>on(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return an(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>sn(t,e),addRowAfter:()=>({state:t,dispatch:e})=>rn(t,e),deleteRow:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return nn(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>tn(t,e),mergeCells:()=>({state:t,dispatch:e})=>Le(t,e),splitCell:()=>({state:t,dispatch:e})=>Ie(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ze("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ze("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>en(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Le(t,e)?!0:Ie(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Yt(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>_e(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>_e(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Jt(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=nt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:J,"Mod-Backspace":J,Delete:J,"Mod-Delete":J}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Qt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=H(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Ye(N(t,"tableRole",e))}}}),gs=ie.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(fs.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ns.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(rs.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ss.configure(this.options.tableRow)),t}});function ms(t){const e=$.c(13),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",c=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let u;e[0]!==c?(u=K(vn,"select-none",c),e[0]=c,e[1]=u):u=e[1];let h;e[2]!==i||e[3]!==s.isEditable||e[4]!==a?(h=s.isEditable&&x.jsx("button",{type:"button","aria-label":a("markdownEditor.removeFile"),onMouseDown:ks,onClick:i,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:x.jsx(st,{size:14})}),e[2]=i,e[3]=s.isEditable,e[4]=a,e[5]=h):h=e[5];let d;e[6]!==l||e[7]!==o||e[8]!==h?(d=x.jsx(An,{href:l,name:o,children:h}),e[6]=l,e[7]=o,e[8]=h,e[9]=d):d=e[9];let f;return e[10]!==u||e[11]!==d?(f=x.jsx(be,{as:"span",className:u,children:d}),e[10]=u,e[11]=d,e[12]=f):f=e[12],f}function ks(t){return t.preventDefault()}function bs(t){return t.replace(/([[\]])/g,"\\$1")}const xs=D.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",H(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${bs(n)}](${e})`},addNodeView(){return ke(ms)}});function ws(t){const e=$.c(5),{node:n,selected:r}=t,s=typeof n.attrs.name=="string"?n.attrs.name:"",i=r&&"ring-2 ring-ring";let a;e[0]!==i?(a=K("select-none rounded px-1 font-medium text-primary","bg-primary/10",i),e[0]=i,e[1]=a):a=e[1];let l;return e[2]!==s||e[3]!==a?(l=x.jsxs(be,{as:"span","data-testid":"mention-chip",className:a,children:["@",s]}),e[2]=s,e[3]=a,e[4]=l):l=e[4],l}const ys=D.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-mention-name"),renderHTML:t=>t.name?{"data-mention-name":t.name}:{}}}},parseHTML(){return[{tag:"span[data-mention-id]"}]},renderHTML({HTMLAttributes:t,node:e}){return["span",H(t),`@${typeof e.attrs.name=="string"?e.attrs.name:""}`]},renderMarkdown:t=>{const e=typeof t.attrs?.id=="string"?t.attrs.id:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return e?Mn(e,n):`@${n}`},addNodeView(){return ke(ws)}}),Ts="studio.mention-members.",me=new Map;function Ze(t){const e=me.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const r=JSON.parse(n);if(!Array.isArray(r))return;const s=r.filter(i=>!!i&&typeof i.id=="string"&&typeof i.name=="string");return me.set(t,s),s}catch{return}}function vs(t,e){me.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function As(t,e){if(!t?.length)return e;const n=new Map(t.map(r=>[r.id,r]));return e.map(r=>{const s=n.get(r.id);return s&&s.name===r.name&&s.email===r.email&&s.image===r.image?s:r})}function Ms(t){return t.map(e=>({id:e.userId,name:e.user?.name?.trim()||e.user?.email?.trim()||"",email:e.user?.email??"",image:e.user?.image??null})).filter(e=>!!e.name).sort((e,n)=>e.name.localeCompare(n.name))}function Ss(t){const e=$.c(17),{locator:n}=Tt(),r=Pn(),s=`${Ts}${n}`;let i;e[0]!==n?(i=At.mentionMembers(n),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==s?(a=()=>Ze(s),e[2]=s,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==s?(l=async()=>{const f=await r.organization.listMembers(),p=As(Ze(s),Ms(f?.data?.members??[]));return vs(s,p),p},e[4]=r,e[5]=s,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==i||e[9]!==a||e[10]!==l?(o={queryKey:i,enabled:t,staleTime:0,placeholderData:a,queryFn:l},e[7]=t,e[8]=i,e[9]=a,e[10]=l,e[11]=o):o=e[11];const c=vt(o);let u;e[12]!==c.data?(u=c.data??[],e[12]=c.data,e[13]=u):u=e[13];const h=c.isFetching&&!c.data;let d;return e[14]!==u||e[15]!==h?(d={members:u,loading:h},e[14]=u,e[15]=h,e[16]=d):d=e[16],d}const Ke={query:"",range:null,rect:null,editor:null};class Cs{state=Ke;listeners=new Set;dismissal=null;latched=!1;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;set(e){this.state=e;for(const n of this.listeners)n()}close(){this.latched=!1,this.set(Ke)}}const Re=new Je("markdownEditorMention");function Rs(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),tt(t.view,Re)}function Es(t,e,n){const r=Math.min(e+n,t.content.size);return e>=r?"":t.textBetween(e,r,"","")}function wt(t,e){const n=e.getSnapshot().range??void 0;n&&n.to>n.from&&(e.dismissal={from:n.from,text:t.state.doc.textBetween(n.from,n.to,"")}),tt(t.view,Re)}function $s(t){return ie.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Re,allowedPrefixes:[" ",`
81
+ `],allow:({state:n,range:r})=>{const s=t.dismissal;return s?r.from===s.from&&Es(n.doc,s.from,s.text.length)===s.text?!1:(t.dismissal=null,!0):!0},items:()=>[],render:()=>({onStart:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onUpdate:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onKeyDown:({event:n})=>n.key==="Escape"?(wt(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Gt(e)]}})}const Ve=256,_s=40,Qe=280,Ls=140;function Is(t){const e=$.c(4),{store:n}=t,r=E.useSyncExternalStore(n.subscribe,n.getSnapshot),s=r.range!==null;let i;return e[0]!==s||e[1]!==r||e[2]!==n?(i=s?x.jsx(zs,{store:n,state:r}):null,e[0]=s,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}function zs({store:t,state:e}){const n=j(),{members:r,loading:s}=Ss(!0),[i,a]=E.useState(e.query),[l,o]=E.useState(null),c=Ps(e.editor),u=c.getBoundingClientRect(),h=c===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):u,d=e.rect?.()??new DOMRect(0,0,0,0),f=h.bottom-d.bottom,p=f<Qe&&d.top-h.top>f,g=(p?d.top-h.top:f)-8,m=Math.min(Qe,Math.max(g,Ls))-_s,k={position:"absolute",width:Ve,left:Math.min(d.left,h.right-Ve-8)-u.left,...p?{bottom:u.bottom-d.top+6}:{top:d.bottom-u.top+6}},w=()=>{e.editor&&wt(e.editor,t),t.close()},y=b=>{const v=b.relatedTarget;if((!v||e.editor?.view.dom.contains(v)===!0)&&t.latched){l?.focus();return}w()},T=b=>{!e.editor||!e.range||(Rs(e.editor,e.range,b),t.close())};return Mt.createPortal(x.jsx("div",{style:k,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg border border-border bg-popover shadow-md",children:x.jsxs(En,{onKeyDown:b=>{b.key==="Escape"&&(b.preventDefault(),w(),e.editor?.commands.focus())},children:[x.jsx($n,{ref:o,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:a,placeholder:n("markdownEditor.mentionSearch"),onBlur:y}),x.jsxs(_n,{style:{maxHeight:m},children:[s?x.jsx("div",{className:"flex items-center justify-center py-6",children:x.jsx(Xe,{size:"sm"})}):x.jsx(Ln,{children:n("markdownEditor.mentionEmpty")}),r.map(b=>x.jsxs(In,{value:`${b.name} ${b.email}`,onSelect:()=>T(b),onMouseDown:v=>v.preventDefault(),className:"gap-2",children:[x.jsx(Rn,{url:b.image??void 0,fallback:zn(b.name),shape:"circle",size:"xs"}),x.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name})]},b.id))]})]})}),c)}function Ps(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}const Hs=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,js=D.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",H(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,a;const l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",o=(r=(s=t.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",c=(i=(a=t.attrs)===null||a===void 0?void 0:a.title)!==null&&i!==void 0?i:"";return c?`![${o}](${l} "${c}")`:`![${o}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:a,HTMLAttributes:l,editor:o})=>{const c=document.createElement("img");c.draggable=!1;const u=H(this.options.HTMLAttributes,l);Object.entries(u).forEach(([k,w])=>{if(w!=null)switch(k){case"src":case"width":case"height":break;default:c.setAttribute(k,w)}}),u.src!==null&&(c.src=u.src);let h={...l};const d=k=>{if(typeof k=="string"&&k!==""){c.getAttribute("src")!==k&&(c.src=k);return}c.hasAttribute("src")&&c.removeAttribute("src"),c.src!==""&&(c.src="")};d(l.src);const f=k=>{if(k.type!==i.type)return!1;const w=o.extensionManager.attributes.filter(T=>T.type===k.type.name),y=Ht(k,w);return Object.keys(h).forEach(T=>{!s.has(T)&&!(T in y)&&c.removeAttribute(T)}),Object.entries(y).forEach(([T,b])=>{s.has(T)||(b!=null?c.setAttribute(T,b):c.removeAttribute(T))}),d(y.src),h=y,!0},p=new Pt({element:c,editor:o,node:i,getPos:a,onResize:(k,w)=>{c.style.width=`${k}px`,c.style.height=`${w}px`},onCommit:(k,w)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:k,height:w}).run()},onUpdate:f,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),g=p.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",c.complete&&c.naturalWidth>0?m():(c.onload=m,c.onerror=m),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[zt({find:Hs,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var Ns=js;function Os(t){const e=$.c(16),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let c;e[0]!==o||e[1]!==a?(c=o||a("markdownEditor.imageAltFallback"),e[0]=o,e[1]=a,e[2]=c):c=e[2];const u=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==u?(h=K("max-h-[420px] max-w-full rounded-lg border border-border object-contain",u),e[3]=u,e[4]=h):h=e[4];let d;e[5]!==l||e[6]!==c||e[7]!==h?(d=x.jsx("img",{src:l,alt:c,draggable:!1,className:h}),e[5]=l,e[6]=c,e[7]=h,e[8]=d):d=e[8];let f;e[9]!==i||e[10]!==s.isEditable||e[11]!==a?(f=s.isEditable&&x.jsx("button",{type:"button","aria-label":a("markdownEditor.removeImage"),onMouseDown:Bs,onClick:i,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:x.jsx(st,{size:14})}),e[9]=i,e[10]=s.isEditable,e[11]=a,e[12]=f):f=e[12];let p;return e[13]!==d||e[14]!==f?(p=x.jsxs(be,{className:"group/image relative my-3 w-fit max-w-full",children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15],p}function Bs(t){return t.preventDefault()}const Ds=Ns.extend({addNodeView(){return ke(Os)}}).configure({inline:!1,allowBase64:!1}),Fs={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},qs=Bt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Sn(n))return e.createNode("attachment",{href:n,name:t.text??""});const r=Cn(n);return r?e.createNode("mention",{id:r,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function Ws(t="",e){return[Nt.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),qs.configure(Fs),Zt.configure({placeholder:t}),gs,jt,Ot.configure({nested:!0}),Ds,xs,Gn,ys,...e?[$s(e)]:[],Xr.configure({markedOptions:{breaks:!0}})]}const Us=/^(\s*)([-*+]|\d+[.)])\s+\S/,Gs=/^\s*(```|~~~)/,Zs=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Ks(t){const e=[];let n=!1,r=!1;for(const s of t.split(`
82
82
  `)){if(Gs.test(s)){n=!n,r=!1,e.push(s);continue}if(n){e.push(s);continue}if(Us.test(s)){r=!0,e.push(s);continue}if(!s.trim()){r=!1,e.push(s);continue}if(r&&Zs.test(s)){e[e.length-1]=`${e[e.length-1]} ${s.trim()}`;continue}r=!1,e.push(s)}return e.join(`
83
- `)}function Vs(t){const e=$.c(12),{onFiles:n,disabled:r}=t,s=j(),i=E.useRef(null);let a;e[0]!==s?(a=s("markdownEditor.attachFile"),e[0]=s,e[1]=a):a=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>i.current?.click(),o=x.jsx(fn,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let c;e[4]!==r||e[5]!==a?(c=x.jsx(Pn,{type:"button",label:a,disabled:r,onClick:l,children:o}),e[4]=r,e[5]=a,e[6]=c):c=e[6];let u;e[7]!==n?(u=x.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:d=>{const f=Array.from(d.target.files??[]);d.target.value="",f.length>0&&n(f)}}),e[7]=n,e[8]=u):u=e[8];let h;return e[9]!==c||e[10]!==u?(h=x.jsxs(x.Fragment,{children:[c,u]}),e[9]=c,e[10]=u,e[11]=h):h=e[11],h}function Qs(t){const e=$.c(6),{pending:n}=t,r=j();if(n===0)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=x.jsx(Xe,{className:"size-3"}),e[0]=s):s=e[0];let i;e[1]!==n||e[2]!==r?(i=n===1?r("markdownEditor.uploading"):r("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==i?(a=x.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[s,i]}),e[4]=i,e[5]=a):a=e[5],a}const Xs=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0",Ut,"[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground","[&_table]:my-3 [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse","[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top","[&_th>p]:my-0 [&_td>p]:my-0","[&_ul[data-type=taskList]]:my-3 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0","[&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:items-start [&_li[data-type=taskItem]]:gap-2","[&_li[data-type=taskItem]>label]:mt-1 [&_li[data-type=taskItem]>label]:shrink-0","[&_li[data-type=taskItem]>div]:min-w-0 [&_li[data-type=taskItem]>div>p]:my-0"].join(" "),Js=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Ys(t){const e=$.c(10),{editor:n,mentions:r}=t,s=r.items;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["markdown-editor-mentions"],e[0]=i):i=e[0];let a;e[1]!==s?(a=c=>{const{query:u}=c,h=u.trim().toLowerCase();return Promise.resolve(h?s.filter(d=>`${d.name} ${d.title??""}`.toLowerCase().includes(h)):s)},e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=c=>{const{range:u,item:h}=c;n.chain().focus().insertContentAt(u,[{type:"text",text:`@${h.name} `}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==r.emptyLabel||e[7]!==a||e[8]!==l?(o=x.jsx(Kt,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:i,queryFn:a,emptyLabel:r.emptyLabel,renderItem:ei,onSelect:l}),e[5]=n,e[6]=r.emptyLabel,e[7]=a,e[8]=l,e[9]=o):o=e[9],o}function ei(t){return x.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[x.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&x.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function xi({defaultValue:t,onChange:e,placeholder:n,editable:r=!0,attachments:s=!0,mentions:i}){const a=Qn(s),[l]=E.useState(()=>new Cs),o=E.useRef(e);o.current=e;const c=Dt({extensions:Ws(n,i?void 0:l),content:Ks(t),contentType:"markdown",editable:r,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:K(Xs,Js)},handlePaste:a.handlePaste,handleDrop:a.handleDrop},onUpdate:({editor:u,transaction:h})=>{h.docChanged&&o.current(u.getMarkdown())}});return c?x.jsxs("div",{className:"flex flex-col",children:[x.jsx(On,{editor:c}),!i&&x.jsx(Is,{store:l}),x.jsx(Ft,{editor:c,className:"text-[15px] text-muted-foreground"}),r&&i&&x.jsx(Ys,{editor:c,mentions:i}),x.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[r&&i?.hint&&x.jsx("span",{children:i.hint}),r&&s&&x.jsx(Vs,{onFiles:u=>a.uploadInto(c.view,u,c.state.selection.to)}),x.jsx(Qs,{pending:a.pending})]})]}):null}export{Vs as A,Cs as M,Gn as U,ys as a,Xr as b,Ds as c,xs as d,Re as e,Is as f,Qs as g,xi as h,$s as m,Qn as u};
83
+ `)}function Vs(t){const e=$.c(12),{onFiles:n,disabled:r}=t,s=j(),i=E.useRef(null);let a;e[0]!==s?(a=s("markdownEditor.attachFile"),e[0]=s,e[1]=a):a=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>i.current?.click(),o=x.jsx(fn,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let c;e[4]!==r||e[5]!==a?(c=x.jsx(Hn,{type:"button",label:a,disabled:r,onClick:l,children:o}),e[4]=r,e[5]=a,e[6]=c):c=e[6];let u;e[7]!==n?(u=x.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:d=>{const f=Array.from(d.target.files??[]);d.target.value="",f.length>0&&n(f)}}),e[7]=n,e[8]=u):u=e[8];let h;return e[9]!==c||e[10]!==u?(h=x.jsxs(x.Fragment,{children:[c,u]}),e[9]=c,e[10]=u,e[11]=h):h=e[11],h}function Qs(t){const e=$.c(6),{pending:n}=t,r=j();if(n===0)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=x.jsx(Xe,{className:"size-3"}),e[0]=s):s=e[0];let i;e[1]!==n||e[2]!==r?(i=n===1?r("markdownEditor.uploading"):r("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==i?(a=x.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[s,i]}),e[4]=i,e[5]=a):a=e[5],a}const Xs=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0",Ut,"[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground","[&_table]:my-3 [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse","[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top","[&_th>p]:my-0 [&_td>p]:my-0","[&_ul[data-type=taskList]]:my-3 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0","[&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:items-start [&_li[data-type=taskItem]]:gap-2","[&_li[data-type=taskItem]>label]:mt-1 [&_li[data-type=taskItem]>label]:shrink-0","[&_li[data-type=taskItem]>div]:min-w-0 [&_li[data-type=taskItem]>div>p]:my-0"].join(" "),Js=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Ys(t){const e=$.c(10),{editor:n,mentions:r}=t,s=r.items;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["markdown-editor-mentions"],e[0]=i):i=e[0];let a;e[1]!==s?(a=c=>{const{query:u}=c,h=u.trim().toLowerCase();return Promise.resolve(h?s.filter(d=>`${d.name} ${d.title??""}`.toLowerCase().includes(h)):s)},e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=c=>{const{range:u,item:h}=c;n.chain().focus().insertContentAt(u,[{type:"text",text:`@${h.name} `}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==r.emptyLabel||e[7]!==a||e[8]!==l?(o=x.jsx(Kt,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:i,queryFn:a,emptyLabel:r.emptyLabel,renderItem:ei,onSelect:l}),e[5]=n,e[6]=r.emptyLabel,e[7]=a,e[8]=l,e[9]=o):o=e[9],o}function ei(t){return x.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[x.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&x.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function xi({defaultValue:t,onChange:e,placeholder:n,editable:r=!0,attachments:s=!0,mentions:i}){const a=Qn(s),[l]=E.useState(()=>new Cs),o=E.useRef(e);o.current=e;const c=Dt({extensions:Ws(n,i?void 0:l),content:Ks(t),contentType:"markdown",editable:r,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:K(Xs,Js)},handlePaste:a.handlePaste,handleDrop:a.handleDrop},onUpdate:({editor:u,transaction:h})=>{h.docChanged&&o.current(u.getMarkdown())}});return c?x.jsxs("div",{className:"flex flex-col",children:[x.jsx(On,{editor:c}),!i&&x.jsx(Is,{store:l}),x.jsx(Ft,{editor:c,className:"text-[15px] text-muted-foreground"}),r&&i&&x.jsx(Ys,{editor:c,mentions:i}),x.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[r&&i?.hint&&x.jsx("span",{children:i.hint}),r&&s&&x.jsx(Vs,{onFiles:u=>a.uploadInto(c.view,u,c.state.selection.to)}),x.jsx(Qs,{pending:a.pending})]})]}):null}export{Vs as A,Cs as M,Gn as U,ys as a,Xr as b,Ds as c,xs as d,Re as e,Is as f,Qs as g,xi as h,$s as m,Qn as u};
@@ -1 +1 @@
1
- import{r as l,br as ce,j as p,bp as _,bo as T,bm as C,bw as le,bq as de,bJ as ue,bF as fe,by as me}from"./index-DAhfV5vh.js";import{e as Y}from"./select-Cfp-vpJN.js";var $=["PageUp","PageDown"],X=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[H,Se,pe]=le(M),[W]=fe(M,[pe]),[he,V]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],K]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),j=l.useRef(S);function B(x){const y=ye(S,x);I(x,y)}function se(x){I(x,f.current)}function ae(){const x=j.current[f.current];S[f.current]!==x&&d(S)}function I(x,y,{commit:k}={commit:!1}){const F=_e(c),z=Ce(Math.round((x-n)/c)*c+n,F),A=Y(z,[n,s]);K((E=[])=>{const P=xe(E,A,y);if(Ee(P,u*c)){f.current=P.indexOf(A);const U=String(P)!==String(E);return U&&k&&d(P),U?P:E}else return E})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(H.Provider,{scope:e.__scopeSlider,children:p.jsx(H.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(j.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&I(n,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const z=$.includes(x.key)||x.shiftKey&&X.includes(x.key)?10:1,A=f.current,E=S[A],P=c*z*y;I(E+P,A,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function D(w){const S=R.current||i.getBoundingClientRect(),K=[0,S.width],B=O(K,f?[o,n]:[n,o]);return R.current=S,B(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=D(w.clientX);r?.(S)},onSlideMove:w=>{const S=D(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const K=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:K?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=V(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):$.concat(X).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=V(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,D=>b(D)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(H.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function De(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Ee(e,t){if(t>0){const o=De(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ie=q,Ae=te,Te=ne,Ve=oe;export{Ie as R,Ae as T,Te as a,Ve as b};
1
+ import{r as l,br as ce,j as p,bp as _,bo as T,bm as C,bw as le,bq as de,bJ as ue,bF as fe,by as me}from"./index-BIAjfIob.js";import{e as Y}from"./select-BpZbuPGW.js";var $=["PageUp","PageDown"],X=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[H,Se,pe]=le(M),[W]=fe(M,[pe]),[he,V]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],K]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),j=l.useRef(S);function B(x){const y=ye(S,x);I(x,y)}function se(x){I(x,f.current)}function ae(){const x=j.current[f.current];S[f.current]!==x&&d(S)}function I(x,y,{commit:k}={commit:!1}){const F=_e(c),z=Ce(Math.round((x-n)/c)*c+n,F),A=Y(z,[n,s]);K((E=[])=>{const P=xe(E,A,y);if(Ee(P,u*c)){f.current=P.indexOf(A);const U=String(P)!==String(E);return U&&k&&d(P),U?P:E}else return E})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(H.Provider,{scope:e.__scopeSlider,children:p.jsx(H.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(j.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&I(n,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const z=$.includes(x.key)||x.shiftKey&&X.includes(x.key)?10:1,A=f.current,E=S[A],P=c*z*y;I(E+P,A,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function D(w){const S=R.current||i.getBoundingClientRect(),K=[0,S.width],B=O(K,f?[o,n]:[n,o]);return R.current=S,B(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=D(w.clientX);r?.(S)},onSlideMove:w=>{const S=D(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const K=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:K?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=V(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):$.concat(X).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=V(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,D=>b(D)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(H.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function De(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Ee(e,t){if(t>0){const o=De(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ie=q,Ae=te,Te=ne,Ve=oe;export{Ie as R,Ae as T,Te as a,Ve as b};