decocms 4.597.1 → 4.598.0

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 (482) hide show
  1. package/dist/client/assets/{AlertCircle-CYAsQRdT.js → AlertCircle-jxvwS2PA.js} +1 -1
  2. package/dist/client/assets/{AreaChart-WJ2lLKy4.js → AreaChart-zoolaKB0.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-zHVY_XX0.js → ArrowLeft-Dlf39oKA.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-B6vgPWbg.js → ArrowRight-DCL3gp96.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-CsFg9VL2.js → ArrowUp-BbUoh0-h.js} +1 -1
  6. package/dist/client/assets/{BookOpen01-AamEOlRO.js → BookOpen01-C85UtDum.js} +1 -1
  7. package/dist/client/assets/{CartesianChart-BxFiyXVM.js → CartesianChart-Bl1HZv9F.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-DfjY1woJ.js → CategoricalChart-jjkJNbxp.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-BB00e9u8.js → CheckCircle-KztuMvd5.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-CD0tZl8C.js → ChevronDown-c_BdXEOA.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-CmQsMnAL.js → ChevronSelectorVertical-DmpvIgAy.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-DGDvzrMe.js → ChevronUp-BSWVeXQq.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-W8t7hmzJ.js → CreditCard01-C4dCRCdu.js} +1 -1
  14. package/dist/client/assets/{Eye-nqlQ004P.js → Eye-BSRrcDT9.js} +1 -1
  15. package/dist/client/assets/{File02-o8s5093L.js → File02-KoBPCXEf.js} +1 -1
  16. package/dist/client/assets/{Fingerprint04-DY8McBak.js → Fingerprint04-B2N20uu4.js} +1 -1
  17. package/dist/client/assets/{Globe04-OZ9xS3Lx.js → Globe04-UMTQ82HG.js} +1 -1
  18. package/dist/client/assets/{Image01-DZmu7hyy.js → Image01-BGM1ArTz.js} +1 -1
  19. package/dist/client/assets/{Key01-CSQOqmIz.js → Key01-BMkzySkS.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-BSo5LCFE.js → LayoutLeft-DrOR8tOg.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-BxVMIk5A.js → LinkBroken01-hoBFLv94.js} +1 -1
  22. package/dist/client/assets/{MessageCircle01-D1dT92x6.js → MessageCircle01-CDpj4jpt.js} +1 -1
  23. package/dist/client/assets/{Minus-D2jrgo3d.js → Minus-DdEPrbsD.js} +1 -1
  24. package/dist/client/assets/{Monitor01-COmDHQ1j.js → Monitor01-B4iHbF93.js} +1 -1
  25. package/dist/client/assets/{Play-JVQd8C8L.js → Play-Clz2e0s4.js} +1 -1
  26. package/dist/client/assets/{Plus-CF8KlFVc.js → Plus-CO40HUhB.js} +1 -1
  27. package/dist/client/assets/{ReferenceLine-8082t01S.js → ReferenceLine-CeSeSzH6.js} +1 -1
  28. package/dist/client/assets/{SearchMd-Cw05gj7E.js → SearchMd-FI2fcykP.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-Cc2EJvA-.js → ShoppingBag01-BBDr_WSy.js} +1 -1
  30. package/dist/client/assets/{Sun-Bji8LMRX.js → Sun-D531tFmZ.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-BSGnkDXI.js → SwitchHorizontal01-B8iZqdiB.js} +1 -1
  32. package/dist/client/assets/{Tool01-BpBS8dw-.js → Tool01-CldemTEe.js} +1 -1
  33. package/dist/client/assets/{Tooltip-DvEW-S9l.js → Tooltip-B1dYEjVO.js} +1 -1
  34. package/dist/client/assets/{Trash01-DXQWI50A.js → Trash01-W_zwe5xo.js} +1 -1
  35. package/dist/client/assets/{Upload01-BXiTGuBV.js → Upload01-DDGkOE5t.js} +1 -1
  36. package/dist/client/assets/{UserCheck01-DLUgjW3m.js → UserCheck01-VgBUlrC3.js} +1 -1
  37. package/dist/client/assets/{UserSquare-a_XazovD.js → UserSquare-YQkID8bv.js} +1 -1
  38. package/dist/client/assets/{Users01-BpOXj9ap.js → Users01-CJ_YMgJe.js} +1 -1
  39. package/dist/client/assets/{XClose-DxbjiApV.js → XClose-Dv4YALPV.js} +1 -1
  40. package/dist/client/assets/{Zap-QnlW2BG3.js → Zap-DFubAl8b.js} +1 -1
  41. package/dist/client/assets/{access-gate-BvopvGmx.js → access-gate-C-gJXueM.js} +1 -1
  42. package/dist/client/assets/{add-connection-dialog-DaxWAHW0.js → add-connection-dialog-DyPd4ss_.js} +1 -1
  43. package/dist/client/assets/agent-app-BxXBXF3L.js +1 -0
  44. package/dist/client/assets/agent-assets-CFkP_Dfu.js +1 -0
  45. package/dist/client/assets/{agent-automation-D8HHkTDn.js → agent-automation-BaYqgCX1.js} +2 -2
  46. package/dist/client/assets/agent-automations-DBsSsUGW.js +1 -0
  47. package/dist/client/assets/agent-blog-lx6Ts7x1.js +2 -0
  48. package/dist/client/assets/agent-blog-post-BeOLBeeI.js +2 -0
  49. package/dist/client/assets/agent-calendar-BnmK4XQ1.js +1 -0
  50. package/dist/client/assets/{agent-capabilities-CPNkpGBe.js → agent-capabilities-CTj-iH2e.js} +1 -1
  51. package/dist/client/assets/agent-connect-sources-CH4TSb8y.js +1 -0
  52. package/dist/client/assets/agent-deck-DCB6fHd3.js +1 -0
  53. package/dist/client/assets/agent-e2e-BTYjDJlF.js +1 -0
  54. package/dist/client/assets/agent-experiments-Cw9pv6Dn.js +1 -0
  55. package/dist/client/assets/agent-file-CTx06rQr.js +1 -0
  56. package/dist/client/assets/agent-hosting-B5D0b6SX.js +1 -0
  57. package/dist/client/assets/agent-icon-CF35JltL.js +1 -0
  58. package/dist/client/assets/agent-library-BwDYP2WG.js +1 -0
  59. package/dist/client/assets/agent-library-file-C81bvh62.js +1 -0
  60. package/dist/client/assets/agent-overview-K-iHxR1q.js +1 -0
  61. package/dist/client/assets/{agent-releases-CctvTAm_.js → agent-releases-BwmxxOKG.js} +1 -1
  62. package/dist/client/assets/agent-settings-DSkSbN3M.js +1 -0
  63. package/dist/client/assets/{agent-site-editor-jPhFhiaS.js → agent-site-editor-AlBg5D2V.js} +1 -1
  64. package/dist/client/assets/agent-site-editor-code-DKlbc-rv.js +2 -0
  65. package/dist/client/assets/agent-site-editor-content-D8oVt80T.js +1 -0
  66. package/dist/client/assets/agent-site-editor-preview-C7REepxK.js +1 -0
  67. package/dist/client/assets/agent-view-B_4cQTkH.js +1 -0
  68. package/dist/client/assets/{agent-view-guard-DDiVN0Sq.js → agent-view-guard-ZsSVHdZf.js} +1 -1
  69. package/dist/client/assets/{ai-providers-OuekM_ro.js → ai-providers-hSqz3WwB.js} +1 -1
  70. package/dist/client/assets/{alert-PbrLNRQ0.js → alert-DvKjRxar.js} +1 -1
  71. package/dist/client/assets/{analytics-sections-DWAL7IVe.js → analytics-sections-VB2fGveD.js} +1 -1
  72. package/dist/client/assets/api-keys-1OldN0tT.js +1 -0
  73. package/dist/client/assets/{api-keys-CKMEwhf6.js → api-keys-5hVWR6f4.js} +1 -1
  74. package/dist/client/assets/app-editor-CKOA7wEE.js +1 -0
  75. package/dist/client/assets/{asset-utils-CJa90ZGO.js → asset-utils-DRModSGS.js} +1 -1
  76. package/dist/client/assets/{auth-C---Zkvq.js → auth-Ry9WrZV8.js} +1 -1
  77. package/dist/client/assets/{auth-catchall-DgTfFPJA.js → auth-catchall-DJ81nN52.js} +1 -1
  78. package/dist/client/assets/{auth-entry-Bdlo1esb.js → auth-entry-N3iwaDe6.js} +1 -1
  79. package/dist/client/assets/{auth-split-layout-C7aM0bmC.js → auth-split-layout-DRc17L6c.js} +1 -1
  80. package/dist/client/assets/{authenticate-and-persist-oauth-D1SCK9qV.js → authenticate-and-persist-oauth-ZYDIddXa.js} +1 -1
  81. package/dist/client/assets/{automation-list-row-CmL2MF72.js → automation-list-row-DW-hLflG.js} +1 -1
  82. package/dist/client/assets/{automation-runs-BabYNmi9.js → automation-runs-Cn3-xcc-.js} +1 -1
  83. package/dist/client/assets/automations-CVx7XBRT.js +1 -0
  84. package/dist/client/assets/{badge-BcMIPtVj.js → badge-CWKaTosK.js} +1 -1
  85. package/dist/client/assets/{block-document-BBR-lAQh.js → block-document-DnIO3ig2.js} +1 -1
  86. package/dist/client/assets/{blocks-preview-workspace-context-D-FzlGyh.js → blocks-preview-workspace-context-05h1qBm4.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-CmsgKSWv.js → blocks-tab-states-DDvkpFWf.js} +1 -1
  88. package/dist/client/assets/{blog-preview-url-DZyvHdU6.js → blog-preview-url-BeobaMnK.js} +1 -1
  89. package/dist/client/assets/{blog-schema-DbGoS5dM.js → blog-schema-BMIjJkjY.js} +1 -1
  90. package/dist/client/assets/{blog-source-gate-BYUxeuY-.js → blog-source-gate-CTlfDEgd.js} +1 -1
  91. package/dist/client/assets/{blog-view-gate-D1VDGt0q.js → blog-view-gate-BUKolpTm.js} +1 -1
  92. package/dist/client/assets/{buckets-CpBc4NBs.js → buckets-Cojjk4Rx.js} +1 -1
  93. package/dist/client/assets/{build-improve-prompt-doc-DsNhI5c0.js → build-improve-prompt-doc-cVHB56V7.js} +1 -1
  94. package/dist/client/assets/{calendar-oyktWjjy.js → calendar-D3_Is4BX.js} +1 -1
  95. package/dist/client/assets/{capability-load-error-CZr_hpNK.js → capability-load-error-l7VKbDu4.js} +1 -1
  96. package/dist/client/assets/category-editor-3t0p_Aia.js +1 -0
  97. package/dist/client/assets/{category-tree-CUP3rQKK.js → category-tree-rhKblFsZ.js} +1 -1
  98. package/dist/client/assets/{chart-L_rdD8Fy.js → chart-D0JID1mb.js} +1 -1
  99. package/dist/client/assets/{chat-context-BXxmldjV.js → chat-context-D5EEwp_m.js} +1 -1
  100. package/dist/client/assets/{chat-draft-Bu5orWL5.js → chat-draft-CL1clhIN.js} +1 -1
  101. package/dist/client/assets/{checkbox-DcLJM3uK.js → checkbox-DHBAzm3e.js} +1 -1
  102. package/dist/client/assets/choose-editor-CluRV_6I.js +1 -0
  103. package/dist/client/assets/{cli-auth-success-CmXNeNAR.js → cli-auth-success-D9loznd0.js} +1 -1
  104. package/dist/client/assets/cms-settings-editor-DY7QQNQD.js +1 -0
  105. package/dist/client/assets/{cms-store-drafts-B3P79s_J.js → cms-store-drafts-BocSU3zl.js} +1 -1
  106. package/dist/client/assets/{collapsible-B8lX7LSm.js → collapsible-JCTHx5_U.js} +1 -1
  107. package/dist/client/assets/collection-detail-l7ntNzFm.js +1 -0
  108. package/dist/client/assets/{collection-display-button-CIMd2CCY.js → collection-display-button-C6AAIEpT.js} +1 -1
  109. package/dist/client/assets/{collection-search-ioGjJlri.js → collection-search-Cez2fKoW.js} +1 -1
  110. package/dist/client/assets/{collection-table-wrapper-d2v3Inn9.js → collection-table-wrapper-DkyJJZPl.js} +1 -1
  111. package/dist/client/assets/{collection-tabs-CpA2E5BB.js → collection-tabs-D0yQpVJM.js} +1 -1
  112. package/dist/client/assets/{combobox-3XSCcZHm.js → combobox-Dm0ZumLc.js} +1 -1
  113. package/dist/client/assets/{command-CjjWneJ9.js → command-CALEDfdi.js} +1 -1
  114. package/dist/client/assets/{companion-mcps-section-BfugnMSL.js → companion-mcps-section-DyyItakB.js} +1 -1
  115. package/dist/client/assets/{config-DMRaGUqI.js → config-DpuCRGPS.js} +1 -1
  116. package/dist/client/assets/{connect-DPlH2AuB.js → connect-DhDiKdM5.js} +3 -3
  117. package/dist/client/assets/{connect-key-DXsdNQDg.js → connect-key-BnZjV7h5.js} +1 -1
  118. package/dist/client/assets/{connect-layout-BOatW4CZ.js → connect-layout-DPjmEUCP.js} +1 -1
  119. package/dist/client/assets/{connect-source-dialog-CXL8Ll8J.js → connect-source-dialog-CPF3zqCW.js} +1 -1
  120. package/dist/client/assets/{connection-DMyObHFk.js → connection-ByE21sI5.js} +1 -1
  121. package/dist/client/assets/{connection-card-CIdpI2wF.js → connection-card-v-6X4qws.js} +1 -1
  122. package/dist/client/assets/connection-detail-DOB5tzOq.js +1 -0
  123. package/dist/client/assets/{connection-form-helpers-CI-MD64a.js → connection-form-helpers-BZq0bQw7.js} +1 -1
  124. package/dist/client/assets/{connection-slug-CoQLu_eQ.js → connection-slug-Cu8poN2f.js} +1 -1
  125. package/dist/client/assets/connections-BshSiFUh.js +1 -0
  126. package/dist/client/assets/content-changes-Yn1NpHw-.js +1 -0
  127. package/dist/client/assets/{content-tab-D0dI2BbM.js → content-tab-BOS9R4w0.js} +3 -3
  128. package/dist/client/assets/context-CSNMIE52.js +1 -0
  129. package/dist/client/assets/{context-menu-B1dAG0Wr.js → context-menu-DjuEbDwW.js} +1 -1
  130. package/dist/client/assets/{context-shell-547AgBrw.js → context-shell-BtuEIN_r.js} +4 -4
  131. package/dist/client/assets/{create-organization-dialog-BKxedScB.js → create-organization-dialog-BFbwswlq.js} +1 -1
  132. package/dist/client/assets/{daily-pulse-aiJY3gnz.js → daily-pulse-Bg2uZfJ3.js} +1 -1
  133. package/dist/client/assets/{delete-copy-CGGKQ10f.js → delete-copy-CyOQI_UN.js} +1 -1
  134. package/dist/client/assets/{device-hint-QYtktsO0.js → device-hint-1SWvGp3v.js} +1 -1
  135. package/dist/client/assets/{discover-BZAuq37N.js → discover-DRvYEfga.js} +1 -1
  136. package/dist/client/assets/{domain-settings-BuaKW4Rw.js → domain-settings-kxDrXeNT.js} +1 -1
  137. package/dist/client/assets/{drawer-JbzUShND.js → drawer-CLdqPUpZ.js} +1 -1
  138. package/dist/client/assets/{editor-classes-D4G_DIGw.js → editor-classes-C7cnK7Wp.js} +1 -1
  139. package/dist/client/assets/{editor-BR1a7qGD.js → editor-fCTeAQ3h.js} +1 -1
  140. package/dist/client/assets/{empty-state-C0MDzZBx.js → empty-state-BM_yXYSI.js} +1 -1
  141. package/dist/client/assets/{empty-state-BnFVKQvv.js → empty-state-CHF2Jno9.js} +1 -1
  142. package/dist/client/assets/{experiments-tab-choice-DIRzwSia.js → experiments-tab-choice-Bo36uaUs.js} +1 -1
  143. package/dist/client/assets/{extract-connection-data-DtWfSA7r.js → extract-connection-data-jy3JaUYJ.js} +1 -1
  144. package/dist/client/assets/{feature-gate-BfrcuviK.js → feature-gate-CDxHWMHG.js} +1 -1
  145. package/dist/client/assets/{feature-paywall-DNnv958-.js → feature-paywall-Cc43JNfz.js} +1 -1
  146. package/dist/client/assets/file-explorer-BmZFNSEt.js +2 -0
  147. package/dist/client/assets/{file-preview-CC2pttDX.js → file-preview-DSlXa64u.js} +1 -1
  148. package/dist/client/assets/{file-share-button-dJsfWtiJ.js → file-share-button-mLtJT0f8.js} +2 -2
  149. package/dist/client/assets/{file-type-icon-nU6c9OQr.js → file-type-icon-CNUBpmBv.js} +1 -1
  150. package/dist/client/assets/{folder-icon-Wp7wbxIQ.js → folder-icon-Db1WLgp9.js} +1 -1
  151. package/dist/client/assets/{form-Dx1EBvxh.js → form-CCzLKFB7.js} +1 -1
  152. package/dist/client/assets/{frame-navigation-aPmo2U0P.js → frame-navigation-B4-_qfJ3.js} +1 -1
  153. package/dist/client/assets/{gateway-client-BQlD2psO.js → gateway-client-Dsg5xVl5.js} +1 -1
  154. package/dist/client/assets/general-DRn37bfZ.js +1 -0
  155. package/dist/client/assets/{github-icon-hFwcbgKP.js → github-icon-CizbgzyS.js} +1 -1
  156. package/dist/client/assets/{held-block-view-ByNmqPhe.js → held-block-view-CYXKzDkA.js} +1 -1
  157. package/dist/client/assets/home-BDEWRpho.js +1 -0
  158. package/dist/client/assets/{home-overview-BJLt3O6I.js → home-overview-Cc5zUwKU.js} +1 -1
  159. package/dist/client/assets/{hosted-reconcile-CgC-Mb3M.js → hosted-reconcile-BT71cbCZ.js} +1 -1
  160. package/dist/client/assets/{icon-button-8qhGM4eg.js → icon-button-BY-Dtplw.js} +1 -1
  161. package/dist/client/assets/{index-CqirF9LN.js → index-BKZ2GYzY.js} +1 -1
  162. package/dist/client/assets/{index-BR0U8TgB.js → index-Bf_p4D_6.js} +1 -1
  163. package/dist/client/assets/index-C3JbUkAn.js +1 -0
  164. package/dist/client/assets/{index-bfIJKw2l.js → index-C6V-s7Mj.js} +1 -1
  165. package/dist/client/assets/index-C9ybKZad.css +1 -0
  166. package/dist/client/assets/{index-MxNSCTK9.js → index-D146A7MA.js} +1 -1
  167. package/dist/client/assets/{index-C6-0Ff1m.js → index-D19iAD4s.js} +51 -39
  168. package/dist/client/assets/{index-D-cQHZ9D.js → index-D6VuEonE.js} +1 -1
  169. package/dist/client/assets/{index-ByOLAuLS.js → index-DAZyLaeQ.js} +1 -1
  170. package/dist/client/assets/{index-ZdVMGNX_.js → index-DHiZoBJ3.js} +1 -1
  171. package/dist/client/assets/index-DP6ex8je.js +4 -0
  172. package/dist/client/assets/{index-BPvQqOSy.js → index-DS6kB3db.js} +1 -1
  173. package/dist/client/assets/{index-DHE6Gmv8.js → index-DWF5ASE_.js} +8 -8
  174. package/dist/client/assets/{index-B7i_xJl4.js → index-DX45d0VZ.js} +1 -1
  175. package/dist/client/assets/{index-DWqgNqna.js → index-DeWoNfZE.js} +1 -1
  176. package/dist/client/assets/{index-B_eoP-Gi.js → index-DqGbUVIr.js} +2 -2
  177. package/dist/client/assets/{index-l6F0wrxq.js → index-i1TGxsLb.js} +1 -1
  178. package/dist/client/assets/{index-redirect-D-0BmEsE.js → index-redirect-1X0s58OF.js} +1 -1
  179. package/dist/client/assets/{index-CMjqNIsi.js → index-tfWzV95z.js} +1 -1
  180. package/dist/client/assets/{infiniteQueryObserver-CiZgrwb3.js → infiniteQueryObserver-B1MZYli5.js} +1 -1
  181. package/dist/client/assets/{infra-billing-DMYQXPE8.js → infra-billing-CEbGoBzj.js} +1 -1
  182. package/dist/client/assets/{input-_oxlM42n.js → input-DER1ofMN.js} +1 -1
  183. package/dist/client/assets/{input-BvykudC_.js → input-DUmEmIMD.js} +3 -3
  184. package/dist/client/assets/{integration-icon-BIQ_3p0x.js → integration-icon-LqaI_LSB.js} +1 -1
  185. package/dist/client/assets/{item-actions-BoAVVq18.js → item-actions-BQdANZXs.js} +1 -1
  186. package/dist/client/assets/{jira-icon-BYAb-E8q.js → jira-icon-DNsDxAZ7.js} +1 -1
  187. package/dist/client/assets/{label-Cq7ohFeR.js → label-B0UwCsXA.js} +1 -1
  188. package/dist/client/assets/{layout-DKgi2pWo.js → layout-CSIaEqJd.js} +1 -1
  189. package/dist/client/assets/{legacy-admin-welcome-dialog-Cdla_zr3.js → legacy-admin-welcome-dialog-DgOZFBtI.js} +1 -1
  190. package/dist/client/assets/{legacy-agents-deep-C4yyRVHA.js → legacy-agents-deep-Cx1B7fLu.js} +1 -1
  191. package/dist/client/assets/{legacy-main-redirect-CUxGG29A.js → legacy-main-redirect-CuOUB_B1.js} +1 -1
  192. package/dist/client/assets/library-B8otmHwX.js +1 -0
  193. package/dist/client/assets/{library-tab-DnuxDKa_.js → library-tab-BwU2UnDE.js} +1 -1
  194. package/dist/client/assets/{login-21wHOzeO.js → login-D7cd9YYg.js} +1 -1
  195. package/dist/client/assets/{markdown-5RMcvWqV.js → markdown-BNFJrVwN.js} +1 -1
  196. package/dist/client/assets/{mcp-app-renderer-BV5sVhom.js → mcp-app-renderer-ChxjPYfG.js} +1 -1
  197. package/dist/client/assets/{mcp-oauth-BU0x_iDk.js → mcp-oauth-BHqzrP9l.js} +1 -1
  198. package/dist/client/assets/{mcp-oauth-CeIVSnSu.js → mcp-oauth-CIbadsEV.js} +1 -1
  199. package/dist/client/assets/{members-BNWyDABE.js → members-CRNf5jdg.js} +1 -1
  200. package/dist/client/assets/{memory-d-IFBAud.js → memory-BtUUGfBH.js} +2 -2
  201. package/dist/client/assets/{mock-board-Y-hiGSHf.js → mock-board-CX-WNxEi.js} +3 -3
  202. package/dist/client/assets/{monaco-editor-d8C00Vbh.js → monaco-editor-oNRDmlFg.js} +1 -1
  203. package/dist/client/assets/{monitoring-3bxUWuJM.js → monitoring-DnzPiQ3F.js} +1 -1
  204. package/dist/client/assets/{monitoring-stats-row-BdeLiDjT.js → monitoring-stats-row-eut48zN3.js} +1 -1
  205. package/dist/client/assets/{multi-select-D6S763-B.js → multi-select-CADtUZ9A.js} +1 -1
  206. package/dist/client/assets/{mustache-CH8IdNgC.js → mustache-BM5hcjQo.js} +1 -1
  207. package/dist/client/assets/{named-rule-step-ISshG07e.js → named-rule-step-jeqaAuBi.js} +1 -1
  208. package/dist/client/assets/named-rule-view-0M7nk7ZR.js +1 -0
  209. package/dist/client/assets/{new-project-dialog-Ch6wUMKc.js → new-project-dialog-TULM28H3.js} +1 -1
  210. package/dist/client/assets/{new-project-store-BJVEZe7t.js → new-project-store-Dkp4wOSi.js} +1 -1
  211. package/dist/client/assets/{oauth-callback-DF-qannK.js → oauth-callback-D2m0oHFc.js} +1 -1
  212. package/dist/client/assets/{oauth-callback-ai-provider-BPFWE8hJ.js → oauth-callback-ai-provider-Cg2K-hUv.js} +1 -1
  213. package/dist/client/assets/{oauth-consent-DEVHlJrJ.js → oauth-consent-Cey84Qly.js} +1 -1
  214. package/dist/client/assets/{onboarding-BBiIM9eH.js → onboarding-C5tGxSm3.js} +1 -1
  215. package/dist/client/assets/openai-conversation-Cin6CRLj.js +3 -0
  216. package/dist/client/assets/{optimistic-project-sidebar-views-DoJ93lgL.js → optimistic-project-sidebar-views-BwI_h134.js} +1 -1
  217. package/dist/client/assets/{order-monitor-day-C4bwqh_Q.js → order-monitor-day-qB9QL9rR.js} +1 -1
  218. package/dist/client/assets/{organization-choice-CAc73DMC.js → organization-choice-UcNwkZgV.js} +1 -1
  219. package/dist/client/assets/{orgs-DlLRdIR1.js → orgs-BNCJkrfd.js} +1 -1
  220. package/dist/client/assets/{own-accounts-section-L5xwUYxF.js → own-accounts-section-B_G3r2Ak.js} +1 -1
  221. package/dist/client/assets/{pair-BKCcX4sy.js → pair-DaLtpCvg.js} +8 -8
  222. package/dist/client/assets/{parse-sections-CBJ8clfr.js → parse-sections-BRYcF5X4.js} +3 -3
  223. package/dist/client/assets/plan-BkTiTYLU.js +1 -0
  224. package/dist/client/assets/{plan-ladder-DDAcm-ji.js → plan-ladder-DZZeDiD-.js} +1 -1
  225. package/dist/client/assets/{plan-usage-card-BwiinbGT.js → plan-usage-card-CUEZgkUc.js} +1 -1
  226. package/dist/client/assets/{popover-DTBVeUtG.js → popover-Bm-_ILu8.js} +1 -1
  227. package/dist/client/assets/post-calendar-Dx1uahJO.js +1 -0
  228. package/dist/client/assets/{post-editor-CaTAhhxB.js → post-editor-DWqV-Y-J.js} +2 -2
  229. package/dist/client/assets/{preview-content-BGfL4iXO.js → preview-content-DiSiTI85.js} +1 -1
  230. package/dist/client/assets/{preview-dialog-BHh0s5Ms.js → preview-dialog-BP-VZ8b7.js} +1 -1
  231. package/dist/client/assets/{preview-panel-HHRrVU4R.js → preview-panel-DO2qxYoE.js} +1 -1
  232. package/dist/client/assets/{preview-tab-S2hZUwsX.js → preview-tab-lvMZ2nQh.js} +3 -3
  233. package/dist/client/assets/{primitives-K9ug68v7.js → primitives-DlHl12Ki.js} +1 -1
  234. package/dist/client/assets/{product-picker-dialog-ujfDfMoL.js → product-picker-dialog-2Sh66sGp.js} +1 -1
  235. package/dist/client/assets/{profile-Dc_w4Cyx.js → profile-C-34uFVs.js} +1 -1
  236. package/dist/client/assets/project-app-view-B1Na7Y2f.js +1 -0
  237. package/dist/client/assets/project-apps-4x8kh2Th.js +1 -0
  238. package/dist/client/assets/{project-icon-CGc9ojaV.js → project-icon-BpBMspxb.js} +1 -1
  239. package/dist/client/assets/{project-index-I2IwZ_L4.js → project-index-Dn8Lu82V.js} +1 -1
  240. package/dist/client/assets/project-reports-BKA5CwLs.js +1 -0
  241. package/dist/client/assets/project-tasks-DII3t9E-.js +1 -0
  242. package/dist/client/assets/projects-COEtC32s.js +1 -0
  243. package/dist/client/assets/{projects-empty-state-B5Z0ROP0.js → projects-empty-state-BaKUbZwF.js} +1 -1
  244. package/dist/client/assets/{prompts-DQItNyVW.js → prompts-BEx4mqMN.js} +1 -1
  245. package/dist/client/assets/record-editor-B5MUcK8d.js +1 -0
  246. package/dist/client/assets/redirect-editor-v_D7tsUa.js +1 -0
  247. package/dist/client/assets/{reports-B3-NqRd1.js → reports-CY9b4q7t.js} +1 -1
  248. package/dist/client/assets/reports-Dc_GbY37.js +1 -0
  249. package/dist/client/assets/reports-onboarding-B78MfFt5.js +1 -0
  250. package/dist/client/assets/reports-tab-DgzPfqIC.js +2 -0
  251. package/dist/client/assets/{repositories-Cf9nYfd0.js → repositories-BFzOuUP8.js} +1 -1
  252. package/dist/client/assets/repositories-DfE1c4ns.js +1 -0
  253. package/dist/client/assets/{repository-binding-Do6sAdct.js → repository-binding-CP_PNLcQ.js} +1 -1
  254. package/dist/client/assets/{repository-picker-B9qWS0uH.js → repository-picker-DCip0P__.js} +1 -1
  255. package/dist/client/assets/{require-capability-DdgYI50p.js → require-capability-uCkyxJfa.js} +1 -1
  256. package/dist/client/assets/{required-auth-layout-BwuuU3bJ.js → required-auth-layout-B7e3rkXx.js} +1 -1
  257. package/dist/client/assets/{reset-password-CFvEOHUE.js → reset-password-Bqbu7xzH.js} +1 -1
  258. package/dist/client/assets/{resizable-DbjoRAK-.js → resizable-D75nggzL.js} +1 -1
  259. package/dist/client/assets/resolve-tab-icon-BqdaZDC9.js +1 -0
  260. package/dist/client/assets/review-settings-BU42FIg-.js +1 -0
  261. package/dist/client/assets/{role-color-AmMn6ZIX.js → role-color-CUZgXceG.js} +1 -1
  262. package/dist/client/assets/roles-BhkeI1Tk.js +1 -0
  263. package/dist/client/assets/route-BdFxUFy-.js +1 -0
  264. package/dist/client/assets/route-C_hx8Usp.js +1 -0
  265. package/dist/client/assets/route-CvQ9iNjI.js +1 -0
  266. package/dist/client/assets/{route-page-header-D8CuFczr.js → route-page-header-B8C1ZRVD.js} +1 -1
  267. package/dist/client/assets/{sandbox-git-api-B3EnJ01P.js → sandbox-git-api-B73fIbEU.js} +1 -1
  268. package/dist/client/assets/{sandbox-lifecycle-context-BiHehEOC.js → sandbox-lifecycle-context-3zZM02yQ.js} +1 -1
  269. package/dist/client/assets/{save-status-DEylj8_h.js → save-status-5VKYddaB.js} +1 -1
  270. package/dist/client/assets/{schema-C9B5bAQC.js → schema-Bbiw44C-.js} +1 -1
  271. package/dist/client/assets/schema-BmYiAOGn.js +1 -0
  272. package/dist/client/assets/{scroll-area-BSx_oSJx.js → scroll-area-ZYmkOMr8.js} +1 -1
  273. package/dist/client/assets/{search-input-DE_voviB.js → search-input-Dfgi3Bm0.js} +1 -1
  274. package/dist/client/assets/{search-toggle-DeMaHCKK.js → search-toggle-Bt9uO9z1.js} +1 -1
  275. package/dist/client/assets/{secret-picker-Dslhp0Eb.js → secret-picker-35tY3ayS.js} +1 -1
  276. package/dist/client/assets/{secrets-BFU0jWBM.js → secrets-CTezjK3j.js} +1 -1
  277. package/dist/client/assets/{section-array-field-dPI_sYd7.js → section-array-field-D3J7UHmj.js} +1 -1
  278. package/dist/client/assets/{sections-BCyCfgtK.js → sections-CsKHN4VK.js} +1 -1
  279. package/dist/client/assets/sections-editor-bf1W6507.js +1 -0
  280. package/dist/client/assets/{select-Chdk1xe9.js → select-CKa1YoCw.js} +1 -1
  281. package/dist/client/assets/{select-model-DNsDO7Yn.js → select-model-BzdKMpAz.js} +1 -1
  282. package/dist/client/assets/{seo-editor-ByqHZOIr.js → seo-editor-RhNyCqwO.js} +1 -1
  283. package/dist/client/assets/{separator-CnEC83tf.js → separator-CmEbryS6.js} +1 -1
  284. package/dist/client/assets/{session-runtime-fXa5psFL.js → session-runtime-DZiu3uM2.js} +1 -1
  285. package/dist/client/assets/settings-tab-DgRCBiDm.js +1 -0
  286. package/dist/client/assets/{sheet-XJvcudCi.js → sheet-BDbcvRnu.js} +1 -1
  287. package/dist/client/assets/shell-layout-Lgn8VLZ9.js +1 -0
  288. package/dist/client/assets/{site-draft-actions-BJiaSwYy.js → site-draft-actions-LxERm8rz.js} +5 -5
  289. package/dist/client/assets/{site-draft-view-9aqy4RF0.js → site-draft-view-Dzyq1aKZ.js} +1 -1
  290. package/dist/client/assets/site-editor-DVvyNYht.js +1 -0
  291. package/dist/client/assets/site-editor-toast-QCYxwt4C.js +1 -0
  292. package/dist/client/assets/skills-D2pt05Zp.js +1 -0
  293. package/dist/client/assets/{slider-DaeRBQVD.js → slider-B257IOM8.js} +1 -1
  294. package/dist/client/assets/{sortable.esm-BulVoRsH.js → sortable.esm-6QfVcWZZ.js} +1 -1
  295. package/dist/client/assets/{sso-ptIJoXni.js → sso-QEHyu29Q.js} +1 -1
  296. package/dist/client/assets/{suggestion-DoHjrPPW.js → suggestion-DXAVxjkm.js} +1 -1
  297. package/dist/client/assets/{super-agent-icon-VandTz-0.js → super-agent-icon-Be9GDxp7.js} +1 -1
  298. package/dist/client/assets/{switch-6JKp3FKO.js → switch-DgvZdTyU.js} +1 -1
  299. package/dist/client/assets/{synced-repos-DJpcOxmB.js → synced-repos-CsgMx0Ny.js} +1 -1
  300. package/dist/client/assets/{tab-icon-glyph-BMUkOrax.js → tab-icon-glyph-UH4S7mUc.js} +1 -1
  301. package/dist/client/assets/{table-Dqj9d5ax.js → table-ChqekQnS.js} +1 -1
  302. package/dist/client/assets/{tabs-CT50lxBB.js → tabs-DV8AQUwT.js} +1 -1
  303. package/dist/client/assets/{task-board-DNboqZMy.js → task-board-DQX_apb8.js} +1 -1
  304. package/dist/client/assets/{task-key-DgbGUF2j.js → task-key-rSXWMPFP.js} +1 -1
  305. package/dist/client/assets/{task-route-DUKKS-kP.js → task-route-KYQNiD-8.js} +1 -1
  306. package/dist/client/assets/{task-status-BadjzsyY.js → task-status-CadzUBkc.js} +1 -1
  307. package/dist/client/assets/{taskboard-analytics-PY56GOP9.js → taskboard-analytics-B1Tn3vRG.js} +1 -1
  308. package/dist/client/assets/tasks-BBJAHV_M.js +1 -0
  309. package/dist/client/assets/{tasks-BXwt_hky.js → tasks-D0Ct-0ZT.js} +1 -1
  310. package/dist/client/assets/{textarea-C3LFFo0w.js → textarea-DCWhTUrR.js} +1 -1
  311. package/dist/client/assets/thread-analytics-BXz4d40L.js +1 -0
  312. package/dist/client/assets/{thread-button-CrjY15ns.js → thread-button-CkP3AL0P.js} +1 -1
  313. package/dist/client/assets/{thread-intent-j3i3V7mR.js → thread-intent-BsMPgCKi.js} +1 -1
  314. package/dist/client/assets/{thread-route-DY_UV0gu.js → thread-route-El3oNOnD.js} +1 -1
  315. package/dist/client/assets/thread-route-wZnmBpi8.js +1 -0
  316. package/dist/client/assets/{thread-sheet-body-DE05uWNv.js → thread-sheet-body-By8H92hw.js} +1 -1
  317. package/dist/client/assets/{time-range-picker-Bbk_8gb1.js → time-range-picker-svLFcXAw.js} +1 -1
  318. package/dist/client/assets/{toggle-group-CbJrGPYf.js → toggle-group-fJYx0W9h.js} +1 -1
  319. package/dist/client/assets/{tool-set-selector-z6gFzWDr.js → tool-set-selector-7nHtwp8O.js} +1 -1
  320. package/dist/client/assets/{toolbar-icon-button-CEZ74wIz.js → toolbar-icon-button-DIm3azB_.js} +1 -1
  321. package/dist/client/assets/{tooltip-BnL5r8Gv.js → tooltip-B3-v7v0W.js} +1 -1
  322. package/dist/client/assets/{tooltipContext-DvsqpzJf.js → tooltipContext-oNzr-fXK.js} +1 -1
  323. package/dist/client/assets/{track-PLvkvo8B.js → track-C9EcyFLh.js} +1 -1
  324. package/dist/client/assets/{types-9tZ4hN1z.js → types-6-Ps6AGR.js} +1 -1
  325. package/dist/client/assets/{url-slug-C2KUvR2X.js → url-slug-3v4BmBw0.js} +1 -1
  326. package/dist/client/assets/{usage-stats-DX8XXFQ9.js → usage-stats-njGMuDih.js} +1 -1
  327. package/dist/client/assets/{use-ai-providers-pXYGEzkI.js → use-ai-providers-DFv4_P6Z.js} +1 -1
  328. package/dist/client/assets/{use-api-keys-B03kdPI3.js → use-api-keys-PZMcZPlt.js} +1 -1
  329. package/dist/client/assets/use-apply-named-rule-B8KW11JW.js +1 -0
  330. package/dist/client/assets/use-ask-in-chat-Dxj79lpz.js +1 -0
  331. package/dist/client/assets/{use-automations-D6sS4b2K.js → use-automations-DD1lNWAq.js} +1 -1
  332. package/dist/client/assets/{use-autosave-ONtBLfOU.js → use-autosave-DBAueSyZ.js} +1 -1
  333. package/dist/client/assets/use-blocks-v8-project-DjyJGATt.js +1 -0
  334. package/dist/client/assets/use-blog-view-B9cmKJN3.js +1 -0
  335. package/dist/client/assets/{use-chat-layout-state-BNCeIaIM.js → use-chat-layout-state-CAIrZGnL.js} +1 -1
  336. package/dist/client/assets/{use-cms-publish-actions-DMDZLoe0.js → use-cms-publish-actions-Dq9NhEOB.js} +1 -1
  337. package/dist/client/assets/{use-connect-companion-Ez7z63oH.js → use-connect-companion-CLP35iDK.js} +1 -1
  338. package/dist/client/assets/{use-connection-D5_bE1jX.js → use-connection-CYsyXyy7.js} +1 -1
  339. package/dist/client/assets/{use-content-sync-D4PlAahX.js → use-content-sync-DWcjd7N0.js} +1 -1
  340. package/dist/client/assets/{use-copy-BRwsGSGM.js → use-copy-BStTcLWM.js} +1 -1
  341. package/dist/client/assets/{use-current-view-0HWp9lHl.js → use-current-view-Cn9H-KAc.js} +1 -1
  342. package/dist/client/assets/{use-date-fns-locale-DiJmvXQv.js → use-date-fns-locale-CSKjWaLe.js} +1 -1
  343. package/dist/client/assets/{use-debounced-autosave-BmZISibb.js → use-debounced-autosave-BudnGn2r.js} +1 -1
  344. package/dist/client/assets/{use-debounced-value-Dw3dFt4C.js → use-debounced-value-Dcq0NTAp.js} +1 -1
  345. package/dist/client/assets/{use-deco-credits-r1_nX8wr.js → use-deco-credits-D9t5Q-Ms.js} +1 -1
  346. package/dist/client/assets/{use-decopilot-events-B1JmbrrX.js → use-decopilot-events-DsEAOvda.js} +1 -1
  347. package/dist/client/assets/{use-delete-block-DDUTXhNF.js → use-delete-block-BZCQAK3P.js} +1 -1
  348. package/dist/client/assets/{use-delete-connection-C3dK-V2D.js → use-delete-connection-CBkpbZja.js} +1 -1
  349. package/dist/client/assets/{use-deployment-admin-KnQTKRss.js → use-deployment-admin-HoxFQgZ9.js} +1 -1
  350. package/dist/client/assets/{use-entitlements-DIoZnc_q.js → use-entitlements-BzKQLk_u.js} +1 -1
  351. package/dist/client/assets/{use-fast-preview-draft-url-D9LB_eIt.js → use-fast-preview-draft-url-tiq51pbg.js} +1 -1
  352. package/dist/client/assets/{use-file-configs-I6vvS9gB.js → use-file-configs-Caaj88sr.js} +1 -1
  353. package/dist/client/assets/{use-id-selection-BAv2DcG7.js → use-id-selection-D0jc_Dy0.js} +1 -1
  354. package/dist/client/assets/{use-in-settings-DxzX6GVb.js → use-in-settings-D-n4dJvM.js} +1 -1
  355. package/dist/client/assets/{use-inbox-feed-BwP3VnzE.js → use-inbox-feed-7Rm2Mjtr.js} +1 -1
  356. package/dist/client/assets/{use-infinite-scroll-DZHKJp2V.js → use-infinite-scroll-f5g_Vpk-.js} +1 -1
  357. package/dist/client/assets/{use-join-requests-DqFzxVX_.js → use-join-requests-Cu6LZvjE.js} +1 -1
  358. package/dist/client/assets/{use-main-panel-tabs-D2eQ46eC.js → use-main-panel-tabs-Ch-_m9wA.js} +1 -1
  359. package/dist/client/assets/{use-mcp-auth-status-C6_TAde2.js → use-mcp-auth-status-CrggBiFo.js} +1 -1
  360. package/dist/client/assets/{use-mcp-client-Bg8mQo9f.js → use-mcp-client-CCT6q-zj.js} +1 -1
  361. package/dist/client/assets/{use-mcp-prompts-DPiL3LQv.js → use-mcp-prompts-Bxssn6xT.js} +1 -1
  362. package/dist/client/assets/{use-mcp-tools-C5OR9KZ9.js → use-mcp-tools-CdypNtPV.js} +1 -1
  363. package/dist/client/assets/{use-mobile-IMVhNYT_.js → use-mobile-Dyvncftm.js} +1 -1
  364. package/dist/client/assets/{use-move-blocks-BVaiu02r.js → use-move-blocks-pw3TQRyc.js} +1 -1
  365. package/dist/client/assets/{use-navigate-to-agent-WJ7w-8ZZ.js → use-navigate-to-agent-0M4hsJnf.js} +1 -1
  366. package/dist/client/assets/{use-never-published-DpnSCkDS.js → use-never-published-BsVhVpS1.js} +1 -1
  367. package/dist/client/assets/{use-org-fs-C4V7-QNj.js → use-org-fs-CyfRrBTl.js} +1 -1
  368. package/dist/client/assets/{use-org-notice-DOVWyuaL.js → use-org-notice-BeUR_ZGA.js} +1 -1
  369. package/dist/client/assets/{use-org-repo-syncs-BukrXch8.js → use-org-repo-syncs-DvcdTgrS.js} +1 -1
  370. package/dist/client/assets/{use-org-sso-D7w6nhfD.js → use-org-sso-BOOKyOjL.js} +1 -1
  371. package/dist/client/assets/use-organization-settings-BEn5xJKT.js +1 -0
  372. package/dist/client/assets/{use-panel-navigate-CkYTugDF.js → use-panel-navigate-DzpMtCDM.js} +1 -1
  373. package/dist/client/assets/{use-project-native-view-presence-CkqC328s.js → use-project-native-view-presence-D4Mhq-72.js} +1 -1
  374. package/dist/client/assets/{use-project-scope-DwQViH2f.js → use-project-scope-DdM0t1xa.js} +1 -1
  375. package/dist/client/assets/{use-recent-apps-4wYjA0CX.js → use-recent-apps-BclKHbIs.js} +1 -1
  376. package/dist/client/assets/{use-reports-diagnostic-DKW88lIw.js → use-reports-diagnostic-BAbQPKnw.js} +1 -1
  377. package/dist/client/assets/use-sandbox-events-CdcsfdkO.js +2 -0
  378. package/dist/client/assets/{use-secrets-BW5HFrjP.js → use-secrets-LrCR8jto.js} +1 -1
  379. package/dist/client/assets/{use-section-preview-base-D61lHpgT.js → use-section-preview-base-CiQHlYOM.js} +1 -1
  380. package/dist/client/assets/{use-sidebar-collapsed-CvPku1YI.js → use-sidebar-collapsed-CiqzdmQp.js} +1 -1
  381. package/dist/client/assets/{use-tags-B-VIOJFl.js → use-tags-B6rjUKRX.js} +1 -1
  382. package/dist/client/assets/{use-task-board-analytics-pNXfpx7q.js → use-task-board-analytics-B5zThTLs.js} +1 -1
  383. package/dist/client/assets/{use-task-board-item-prs-CXo3bcGf.js → use-task-board-item-prs-QwsxzHpc.js} +1 -1
  384. package/dist/client/assets/{use-task-board-items-CygST8NV.js → use-task-board-items-B0KeELtH.js} +1 -1
  385. package/dist/client/assets/{use-task-board-prompts-DYeH1UKB.js → use-task-board-prompts-DjkyWndN.js} +1 -1
  386. package/dist/client/assets/{use-task-metadata-BKyg4fwU.js → use-task-metadata-DRyTcJBf.js} +1 -1
  387. package/dist/client/assets/{use-thread-outputs-U0o_TC58.js → use-thread-outputs-U5yvy3ti.js} +1 -1
  388. package/dist/client/assets/{use-view-draft-kind-DrDbO3-P.js → use-view-draft-kind-C2cwPb-d.js} +1 -1
  389. package/dist/client/assets/{use-voice-input-ChVzBkTC.js → use-voice-input-D_lO17n9.js} +1 -1
  390. package/dist/client/assets/useInfiniteQuery-BIIkqC2p.js +1 -0
  391. package/dist/client/assets/{useQueries-Cmvk9UMI.js → useQueries-C-94_zeU.js} +1 -1
  392. package/dist/client/assets/useSuspenseInfiniteQuery-B5PirUR6.js +1 -0
  393. package/dist/client/assets/{users-S8nniBNq.js → users-D4cUiO-M.js} +1 -1
  394. package/dist/client/assets/{utils-CalvUBc1.js → utils-CWN91Q0R.js} +1 -1
  395. package/dist/client/assets/variant-calendar-DHFpb0p3.js +1 -0
  396. package/dist/client/assets/{variant-matcher-override-DY5ZfO62.js → variant-matcher-override-GbUOkJxx.js} +1 -1
  397. package/dist/client/assets/{view-header-Dlc9W8Ql.js → view-header-BZNgPIdK.js} +1 -1
  398. package/dist/client/assets/{virtual-mcp-BYga37_3.js → virtual-mcp-jT57t8xN.js} +1 -1
  399. package/dist/client/assets/{watch-sse-pool-DdE7kwP2.js → watch-sse-pool-CrHa0Ln_.js} +1 -1
  400. package/dist/client/index.html +2 -2
  401. package/dist/server/migrate.js +210 -210
  402. package/dist/server/server.js +693 -693
  403. package/package.json +1 -1
  404. package/dist/client/assets/TrendUp01-CdeGaAD9.js +0 -1
  405. package/dist/client/assets/agent-app-zt9yWAWY.js +0 -1
  406. package/dist/client/assets/agent-assets-B4BoOCbn.js +0 -1
  407. package/dist/client/assets/agent-automations-CR47ElS_.js +0 -1
  408. package/dist/client/assets/agent-blog-kn7H8WW9.js +0 -2
  409. package/dist/client/assets/agent-blog-post-CWEMwEqA.js +0 -2
  410. package/dist/client/assets/agent-calendar-DER04lJC.js +0 -1
  411. package/dist/client/assets/agent-connect-sources-BBjozm2U.js +0 -1
  412. package/dist/client/assets/agent-deck-DD0U8VAD.js +0 -1
  413. package/dist/client/assets/agent-e2e-CQFRJ0Om.js +0 -1
  414. package/dist/client/assets/agent-experiments-Dz3AvJ4-.js +0 -1
  415. package/dist/client/assets/agent-file-CpVkBu0J.js +0 -1
  416. package/dist/client/assets/agent-hosting-BFGfgXWM.js +0 -1
  417. package/dist/client/assets/agent-icon-SasBmPrY.js +0 -1
  418. package/dist/client/assets/agent-library-Cn9MXoTF.js +0 -1
  419. package/dist/client/assets/agent-library-file-CafoXKvT.js +0 -1
  420. package/dist/client/assets/agent-overview-9j5_NkHV.js +0 -1
  421. package/dist/client/assets/agent-settings-e6iND6rW.js +0 -1
  422. package/dist/client/assets/agent-site-editor-code-Detw-R2f.js +0 -2
  423. package/dist/client/assets/agent-site-editor-content-BeFIR9Nd.js +0 -1
  424. package/dist/client/assets/agent-site-editor-preview-B4G1bvsT.js +0 -1
  425. package/dist/client/assets/agent-view-CHrkfSe7.js +0 -1
  426. package/dist/client/assets/api-keys-CtDwFEqi.js +0 -1
  427. package/dist/client/assets/app-editor-aGklcq_V.js +0 -1
  428. package/dist/client/assets/automations-CJM7s6OS.js +0 -1
  429. package/dist/client/assets/category-editor-Btv0sSPl.js +0 -1
  430. package/dist/client/assets/choose-editor-DQyXDHRD.js +0 -1
  431. package/dist/client/assets/cms-settings-editor-CHvYFO6g.js +0 -1
  432. package/dist/client/assets/collection-detail-GsM61XEt.js +0 -1
  433. package/dist/client/assets/connection-detail-CQX5UnUU.js +0 -1
  434. package/dist/client/assets/connections-CUnudfuh.js +0 -1
  435. package/dist/client/assets/context-BzsV0hxX.js +0 -1
  436. package/dist/client/assets/file-explorer-D_6SsDXA.js +0 -2
  437. package/dist/client/assets/general-CAva67lN.js +0 -1
  438. package/dist/client/assets/home-5ZWRmhLp.js +0 -1
  439. package/dist/client/assets/index-B5WGiIKx.js +0 -4
  440. package/dist/client/assets/index-BU3n1igW.js +0 -1
  441. package/dist/client/assets/index-C4wvi2v7.css +0 -1
  442. package/dist/client/assets/library-D6WcKfwU.js +0 -1
  443. package/dist/client/assets/named-rule-view-CXMDYxKO.js +0 -1
  444. package/dist/client/assets/openai-conversation-Cc0ggxu_.js +0 -3
  445. package/dist/client/assets/plan-Basau5px.js +0 -1
  446. package/dist/client/assets/post-calendar-CkZvvgA_.js +0 -1
  447. package/dist/client/assets/project-app-view-mLEnCg4s.js +0 -1
  448. package/dist/client/assets/project-apps-C4vT9LXH.js +0 -1
  449. package/dist/client/assets/project-reports-BlDDRtjQ.js +0 -1
  450. package/dist/client/assets/project-tasks-DpoEijNI.js +0 -1
  451. package/dist/client/assets/projects-BQZSr4gE.js +0 -1
  452. package/dist/client/assets/record-editor-BOQ2W0wP.js +0 -1
  453. package/dist/client/assets/redirect-editor-BrgJRHSk.js +0 -1
  454. package/dist/client/assets/reports-Bsc_XwTm.js +0 -1
  455. package/dist/client/assets/reports-onboarding-Beggk42B.js +0 -1
  456. package/dist/client/assets/reports-tab-CQP_rzUZ.js +0 -2
  457. package/dist/client/assets/repositories-CfgaBNdf.js +0 -1
  458. package/dist/client/assets/resolve-tab-icon-zc5Xnngt.js +0 -1
  459. package/dist/client/assets/review-settings-C_jx0NLX.js +0 -1
  460. package/dist/client/assets/roles-b_L0oOYd.js +0 -1
  461. package/dist/client/assets/route-Bahv9n22.js +0 -1
  462. package/dist/client/assets/route-D2bkX53_.js +0 -1
  463. package/dist/client/assets/route-Da-mMBjf.js +0 -1
  464. package/dist/client/assets/schema-DiSJ8SEc.js +0 -1
  465. package/dist/client/assets/sections-editor-CD9jVbGW.js +0 -1
  466. package/dist/client/assets/settings-tab-DG4z8CKo.js +0 -1
  467. package/dist/client/assets/shell-layout-CuBXiCpv.js +0 -1
  468. package/dist/client/assets/site-editor-BSb_9CNK.js +0 -1
  469. package/dist/client/assets/site-editor-toast-C2OaHizl.js +0 -1
  470. package/dist/client/assets/skills-DQnklyjk.js +0 -1
  471. package/dist/client/assets/tasks-74JzN4W9.js +0 -1
  472. package/dist/client/assets/thread-analytics-BmSAMduA.js +0 -1
  473. package/dist/client/assets/thread-route-DGrdxDp1.js +0 -1
  474. package/dist/client/assets/use-apply-named-rule-Cc4ACfQP.js +0 -1
  475. package/dist/client/assets/use-ask-in-chat-B6pTgaei.js +0 -1
  476. package/dist/client/assets/use-blocks-v8-project-z5uA6d0S.js +0 -1
  477. package/dist/client/assets/use-blog-view-BHifDign.js +0 -1
  478. package/dist/client/assets/use-organization-settings-BmAIEgEL.js +0 -1
  479. package/dist/client/assets/use-sandbox-events-DwjSc3R2.js +0 -2
  480. package/dist/client/assets/useInfiniteQuery-B5jgBAwp.js +0 -1
  481. package/dist/client/assets/useSuspenseInfiniteQuery-D3Nn_2Nf.js +0 -1
  482. package/dist/client/assets/variant-calendar-C-1HVzQo.js +0 -1
@@ -1 +1 @@
1
- import{r as n,c3 as q,dX as R,dY as Ee,dZ as ke,d_ as Se,aS as xe,d$ as j}from"./index-C6-0Ff1m.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")Y(),W(),w(1,X);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{Y(),W(),r.current.value||X(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{Y(),s?.getAttribute("id")===e&&X(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function X(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function Y(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function G(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function J(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):J(e)}let ie=()=>G(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):J(1)},ce=e=>{e.preventDefault(),e.metaKey?G(0):e.altKey?ue(-1):J(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),G(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Ye},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Je=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Xe(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Xe(l),{ref:l.ref},r(l.props.children)):r(l)}var Ye={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Je as _};
1
+ import{r as n,c3 as q,dX as R,dY as Ee,dZ as ke,d_ as Se,aS as xe,d$ as j}from"./index-D19iAD4s.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")Y(),W(),w(1,X);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{Y(),W(),r.current.value||X(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{Y(),s?.getAttribute("id")===e&&X(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function X(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function Y(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function G(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function J(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):J(e)}let ie=()=>G(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):J(1)},ce=e=>{e.preventDefault(),e.metaKey?G(0):e.altKey?ue(-1):J(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),G(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Ye},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Je=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Xe(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Xe(l),{ref:l.ref},r(l.props.children)):r(l)}var Ye={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Je as _};
@@ -1,5 +1,5 @@
1
- import{c as $,b as j,r as _,j as f,m as B,aY as at,t as se,b5 as Oe,a6 as ot,hj as lt,i as ct,K as ut,ca as ht,h as De,o as pt}from"./index-C6-0Ff1m.js";import{u as dt,v as Be,f as ue,B as ft,w as gt,_ as P,$ as mt,a0 as kt,J as xt,K as D,a1 as ve,a2 as bt,e as wt,a3 as Se,a4 as yt,a5 as Z,N as Fe,a6 as he,c as qe,a7 as pe,a8 as Tt,a9 as vt,s as St,aa as Mt,a as Et,E as At}from"./usage-stats-DX8XXFQ9.js";import{T as C,n as Rt,i as _t,E as $t}from"./editor-classes-D4G_DIGw.js";import{a as Ct,e as Ue,s as Lt,S as It}from"./suggestion-DoHjrPPW.js";import{B as zt}from"./index-ByOLAuLS.js";import{aE as Pt,ai as jt,aj as Nt,al as Ht,K as Ot,aY as Dt,aJ as Bt}from"./agent-icon-SasBmPrY.js";import{i as Ft}from"./SwitchHorizontal01-BSGnkDXI.js";import{s as qt}from"./Trash01-DXQWI50A.js";import{k as Ut,a as Gt}from"./use-org-fs-C4V7-QNj.js";import{E as Me,i as Ge,b as Zt,c as Kt,d as Ze,A as Wt,e as Qt,f as Xt,g as Vt,j as Jt}from"./markdown-5RMcvWqV.js";import{s as Yt,T as en}from"./index-MxNSCTK9.js";import{f as tn,a as nn,c as rn,C as sn,b as Ee}from"./command-CjjWneJ9.js";import{I as an}from"./icon-button-8qhGM4eg.js";function on(t){const e=$.c(30),{editor:n}=t,s=j(),[r,a]=_.useState(!1),[i,l]=_.useState(""),[o,h]=_.useState(!1);let c;e[0]!==n?(c=n.isActive("link"),e[0]=n,e[1]=c):c=e[1];const u=c;let p;e[2]!==n||e[3]!==r?(p=()=>{if(r){a(!1);return}const T=n.getAttributes("link").href;l(typeof T=="string"?T:""),h(!1),a(!0)},e[2]=n,e[3]=r,e[4]=p):p=e[4];const d=p;let g;e[5]!==n?(g=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),a(!1)},e[5]=n,e[6]=g):g=e[6];const x=g;let w;e[7]!==i||e[8]!==n||e[9]!==x?(w=()=>{const T=Rt(i);if(T===""){x();return}if(!_t(T)){h(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:T}).run(),a(!1)},e[7]=i,e[8]=n,e[9]=x,e[10]=w):w=e[10];const b=w;let y;e[11]!==s?(y=s("markdownEditor.link"),e[11]=s,e[12]=y):y=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=f.jsx(Pt,{size:14}),e[13]=v):v=e[13];let M;e[14]!==u||e[15]!==y||e[16]!==d?(M=f.jsx(C,{active:u,label:y,onClick:d,children:v}),e[14]=u,e[15]=y,e[16]=d,e[17]=M):M=e[17];let m;e[18]!==u||e[19]!==b||e[20]!==i||e[21]!==n||e[22]!==o||e[23]!==r||e[24]!==x||e[25]!==s?(m=r&&f.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md bg-popover p-1 shadow-soft",onBlur:T=>{T.currentTarget.contains(T.relatedTarget)||a(!1)},children:[f.jsx("input",{autoFocus:!0,type:"text","aria-label":s("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:s("markdownEditor.linkPlaceholder"),value:i,onChange:T=>{l(T.target.value),h(!1)},onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),b()):T.key==="Escape"&&(T.preventDefault(),a(!1),n.chain().focus().run())},className:B("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")}),f.jsx(C,{active:!1,label:s("markdownEditor.linkApply"),onClick:b,children:f.jsx(at,{size:14})}),u&&f.jsx(C,{active:!1,label:s("markdownEditor.linkRemove"),onClick:x,children:f.jsx(qt,{size:14})})]}),e[18]=u,e[19]=b,e[20]=i,e[21]=n,e[22]=o,e[23]=r,e[24]=x,e[25]=s,e[26]=m):m=e[26];let k;return e[27]!==M||e[28]!==m?(k=f.jsxs("div",{className:"relative",children:[M,m]}),e[27]=M,e[28]=m,e[29]=k):k=e[29],k}const ne=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},Ae=t=>{const e=$.c(2),{children:n}=t;let s;return e[0]!==n?(s=f.jsx("span",{className:"text-2xs font-semibold leading-none",children:n}),e[0]=n,e[1]=s):s=e[1],s},Ke=[1,2,3],ln=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function cn(t){const e=$.c(20),{editor:n}=t,s=j(),[r,a]=_.useState(null);let i;e[0]!==n?(i={editor:n,selector:un},e[0]=n,e[1]=i):i=e[1];const l=dt(i);let o;e[2]!==s?(o=s("markdownEditor.heading1"),e[2]=s,e[3]=o):o=e[3];let h;e[4]!==s?(h=s("markdownEditor.heading2"),e[4]=s,e[5]=h):h=e[5];let c;e[6]!==s?(c=s("markdownEditor.heading3"),e[6]=s,e[7]=c):c=e[7];let u;e[8]!==o||e[9]!==h||e[10]!==c?(u={1:o,2:h,3:c},e[8]=o,e[9]=h,e[10]=c,e[11]=u):u=e[11];const p=u;let d;e[12]!==n||e[13]!==p||e[14]!==r||e[15]!==l||e[16]!==s?(d=r&&f.jsxs(zt,{editor:n,shouldShow:ln,appendTo:r,className:"flex items-center gap-0.5 rounded-lg bg-popover p-1 shadow-soft","aria-label":s("markdownEditor.toolbarAriaLabel"),children:[f.jsx(C,{active:l.bold,label:s("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:f.jsx(jt,{size:14})}),f.jsx(C,{active:l.italic,label:s("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:f.jsx(Nt,{size:14})}),f.jsx(C,{active:l.strike,label:s("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:f.jsx(Ht,{size:14})}),f.jsx(C,{active:l.code,label:s("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:f.jsx(Ot,{size:14})}),f.jsx(ne,{}),Ke.map((x,w)=>f.jsx(C,{active:l.headings[w]??!1,label:p[x],onClick:()=>n.chain().focus().toggleHeading({level:x}).run(),children:f.jsx(Ae,{children:`H${x}`})},x)),f.jsx(ne,{}),f.jsx(C,{active:l.bulletList,label:s("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:f.jsx(Ft,{size:14})}),f.jsx(C,{active:l.orderedList,label:s("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:f.jsx(Ae,{children:"1."})}),f.jsx(C,{active:l.blockquote,label:s("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:f.jsx(Dt,{size:14})}),f.jsx(ne,{}),f.jsx(on,{editor:n})]}),e[12]=n,e[13]=p,e[14]=r,e[15]=l,e[16]=s,e[17]=d):d=e[17];let g;return e[18]!==d?(g=f.jsx("div",{ref:a,className:"relative z-20",children:d}),e[18]=d,e[19]=g):g=e[19],g}function un(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:Ke.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const hn=10,pn=25,dn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function fn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??dn[t.type]??""}function gn(){const t=$.c(4),e=j(),{upload:n}=Ut(Me),s=Gt(Me);let r;return t[0]!==s||t[1]!==e||t[2]!==n?(r={uploadFile:async i=>{const l=Ge(i),o=l?hn:pn;if(i.size>o*1024*1024)return se.error(e("markdownEditor.fileTooLarge",{name:i.name,max:String(o)})),null;const h=l?Zt:Kt,c=`${crypto.randomUUID()}${fn(i)}`;try{return await n.mutateAsync({dir:h,files:[new File([i],c,{type:i.type})]}),s(`${h}/${c}`)}catch{return se.error(e("markdownEditor.uploadFailed",{name:i.name})),null}}},t[0]=s,t[1]=e,t[2]=n,t[3]=r):r=t[3],r}const X=new Be("uploadSlots"),mn=ue.create({name:"uploadSlots",addProseMirrorPlugins(){return[new ft({key:X,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(X);if(!t.docChanged&&!n)return e;const s=new Map;for(const[r,a]of e)s.set(r,t.mapping.map(a));if(n){const[r,a]=n;a===null?s.delete(r):s.set(r,a)}return s}}})]}});function ie(t,e,n){return t.setMeta(X,[e,n])}function kn(t,e){return X.getState(t)?.get(e)}function xn(t,e,n,s,r){const{schema:a}=t.state,i=a.nodes[n];if(!i)return;const l=i.create(s),o=t.state.selection.to===e,h=t.state.doc.resolve(e),c=h.parent.textBetween(Math.max(0,h.parentOffset-1),h.parentOffset,void 0,""),u=()=>a.text(" "),p=l.isInline?[...c&&!/\s/.test(c)?[u()]:[],l,u()]:l,d=t.state.tr.replaceWith(e,e,p);let g=e,x=e;d.mapping.maps.at(-1)?.forEach((M,m,k,T)=>{g=k,x=T});let w;d.doc.nodesBetween(g,x,(M,m)=>{M===l&&(w=m+M.nodeSize)});let b=w??x;w!==void 0&&l.isInline&&(b+=1);const y=a.nodes.paragraph;w!==void 0&&l.isBlock&&y&&(d.doc.resolve(w).nodeAfter?.isTextblock||d.insert(w,y.create()),b=w+1);const v=gt.near(d.doc.resolve(b));o&&d.setSelection(v),r&&ie(d,r,v.to),t.dispatch(d)}function bn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function wn(t=!0){const e=j(),{uploadFile:n}=gn(),s=_.useRef(n);s.current=n;const[r,a]=_.useState(0),i=_.useRef(0),l=u=>{i.current+=u,a(i.current)},o=(u,p,d)=>{if(!t||p.length===0)return!1;l(p.length);const g=Symbol("upload");return u.dispatch(ie(u.state.tr,g,d)),(async()=>{for(const x of p)try{const w=await s.current(x);if(!w||u.isDestroyed)continue;const b=Ge(x);xn(u,kn(u.state,g)??u.state.selection.to,b?"image":"attachment",b?{src:w,alt:x.name}:{href:w,name:x.name},g)}catch{se.error(e("markdownEditor.uploadFailed",{name:x.name}))}finally{l(-1)}u.isDestroyed||u.dispatch(ie(u.state.tr,g,null))})(),!0};return{pending:r,uploading:()=>i.current>0,uploadInto:o,handlePaste:(u,p)=>{const d=bn(p.clipboardData);return d.length===0?!1:(p.stopPropagation(),o(u,d,u.state.selection.to))},handleDrop:(u,p,d,g)=>{if(g)return!1;const x=Array.from(p.dataTransfer?.files??[]);if(x.length===0)return!1;const w=u.posAtCoords({left:p.clientX,top:p.clientY})?.pos;return w===void 0?!1:(p.stopPropagation(),o(u,x,w))}}}function de(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O=de();function We(t){O=t}var N={exec:()=>null};function S(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(r,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(R.caret,"$1"),n=n.replace(r,i),s},getRegex:()=>new RegExp(n,e)};return s}var yn=(()=>{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)}}>`)},Tn=/^(?:[ \t]*(?:\n|$))+/,vn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,K=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Qe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xe=S(Qe).replace(/bull/g,fe).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(),En=S(Qe).replace(/bull/g,fe).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(),ge=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,An=/^[^\n]+/,me=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rn=S(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",me).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_n=S(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fe).getRegex(),ee="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",ke=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$n=S("^ {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",ke).replace("tag",ee).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ve=S(ge).replace("hr",K).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",ee).getRegex(),Cn=S(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ve).getRegex(),xe={blockquote:Cn,code:vn,def:Rn,fences:Sn,heading:Mn,hr:K,html:$n,lheading:Xe,list:_n,newline:Tn,paragraph:Ve,table:N,text:An},Re=S("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",K).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",ee).getRegex(),Ln={...xe,lheading:En,table:Re,paragraph:S(ge).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Re).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",ee).getRegex()},In={...xe,html:S(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ke).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:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:S(ge).replace("hr",K).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",Xe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Je=/^( {2,}|\\)\n(?!\s*$)/,jn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,F=/[\p{P}\p{S}]/u,te=/[\s\p{P}\p{S}]/u,be=/[^\s\p{P}\p{S}]/u,Nn=S(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,te).getRegex(),Ye=/(?!~)[\p{P}\p{S}]/u,Hn=/(?!~)[\s\p{P}\p{S}]/u,On=/(?:[^\s\p{P}\p{S}]|~)/u,Dn=S(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),et=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Bn=S(et,"u").replace(/punct/g,F).getRegex(),Fn=S(et,"u").replace(/punct/g,Ye).getRegex(),tt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qn=S(tt,"gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Un=S(tt,"gu").replace(/notPunctSpace/g,On).replace(/punctSpace/g,Hn).replace(/punct/g,Ye).getRegex(),Gn=S("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Zn=S(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,F).getRegex(),Kn="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Wn=S(Kn,"gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Qn=S(/\\(punct)/,"gu").replace(/punct/g,F).getRegex(),Xn=S(/^<(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(),Vn=S(ke).replace("(?:-->|$)","-->").getRegex(),Jn=S("^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",Vn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),V=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Yn=S(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",V).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nt=S(/^!?\[(label)\]\[(ref)\]/).replace("label",V).replace("ref",me).getRegex(),rt=S(/^!?\[(ref)\](?:\[\])?/).replace("ref",me).getRegex(),er=S("reflink|nolink(?!\\()","g").replace("reflink",nt).replace("nolink",rt).getRegex(),_e=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,we={_backpedal:N,anyPunctuation:Qn,autolink:Xn,blockSkip:Dn,br:Je,code:Pn,del:N,delLDelim:N,delRDelim:N,emStrongLDelim:Bn,emStrongRDelimAst:qn,emStrongRDelimUnd:Gn,escape:zn,link:Yn,nolink:rt,punctuation:Nn,reflink:nt,reflinkSearch:er,tag:Jn,text:jn,url:N},tr={...we,link:S(/^!?\[(label)\]\((.*?)\)/).replace("label",V).getRegex(),reflink:S(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V).getRegex()},ae={...we,emStrongRDelimAst:Un,emStrongLDelim:Fn,delLDelim:Zn,delRDelim:Wn,url:S(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_e).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:S(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_e).getRegex()},nr={...ae,br:S(Je).replace("{2,}","*").getRegex(),text:S(ae.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},W={normal:xe,gfm:Ln,pedantic:In},q={normal:we,gfm:ae,breaks:nr,pedantic:tr},rr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$e=t=>rr[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,$e)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,$e);return t}function Ce(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function Le(t,e){let n=t.replace(R.findPipe,(a,i,l)=>{let o=!1,h=i;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),s=n.split(R.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(R.slashPipe,"|");return s}function U(t,e,n){let s=t.length;if(s===0)return"";let r=0;for(;r<s&&t.charAt(s-r-1)===e;)r++;return t.slice(0,s-r)}function sr(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}function ir(t,e=0){let n=e,s="";for(let r of t)if(r===" "){let a=4-n%4;s+=" ".repeat(a),n+=a}else s+=r,n++;return s}function Ie(t,e,n,s,r){let a=e.href,i=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}function ar(t,e,n){let s=t.match(n.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
1
+ import{c as $,b as j,r as _,j as f,m as B,aY as at,t as se,b5 as Oe,a6 as ot,hj as lt,i as ct,K as ut,ca as ht,h as De,o as pt}from"./index-D19iAD4s.js";import{u as dt,v as Be,f as ue,B as ft,w as gt,_ as P,$ as mt,a0 as kt,J as xt,K as D,a1 as ve,a2 as bt,e as wt,a3 as Se,a4 as yt,a5 as G,N as Fe,a6 as he,c as qe,a7 as pe,a8 as Tt,a9 as vt,s as St,aa as Mt,a as Et,E as At}from"./usage-stats-njGMuDih.js";import{T as C,n as Rt,i as _t,E as $t}from"./editor-classes-C7cnK7Wp.js";import{a as Ct,e as Ue,s as Lt,S as It}from"./suggestion-DXAVxjkm.js";import{B as zt}from"./index-DAZyLaeQ.js";import{aF as Pt,aj as jt,ak as Nt,am as Ht,L as Ot,aZ as Dt,aK as Bt}from"./agent-icon-CF35JltL.js";import{i as Ft}from"./SwitchHorizontal01-B8iZqdiB.js";import{s as qt}from"./Trash01-W_zwe5xo.js";import{k as Ut,a as Zt}from"./use-org-fs-CyfRrBTl.js";import{E as Me,i as Ze,b as Gt,c as Kt,d as Ge,A as Wt,e as Qt,f as Xt,g as Vt,j as Jt}from"./markdown-BNFJrVwN.js";import{s as Yt,T as en}from"./index-D146A7MA.js";import{f as tn,a as nn,c as rn,C as sn,b as Ee}from"./command-CALEDfdi.js";import{I as an}from"./icon-button-BY-Dtplw.js";function on(t){const e=$.c(30),{editor:n}=t,s=j(),[r,a]=_.useState(!1),[i,l]=_.useState(""),[o,h]=_.useState(!1);let c;e[0]!==n?(c=n.isActive("link"),e[0]=n,e[1]=c):c=e[1];const u=c;let p;e[2]!==n||e[3]!==r?(p=()=>{if(r){a(!1);return}const T=n.getAttributes("link").href;l(typeof T=="string"?T:""),h(!1),a(!0)},e[2]=n,e[3]=r,e[4]=p):p=e[4];const d=p;let g;e[5]!==n?(g=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),a(!1)},e[5]=n,e[6]=g):g=e[6];const x=g;let w;e[7]!==i||e[8]!==n||e[9]!==x?(w=()=>{const T=Rt(i);if(T===""){x();return}if(!_t(T)){h(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:T}).run(),a(!1)},e[7]=i,e[8]=n,e[9]=x,e[10]=w):w=e[10];const b=w;let y;e[11]!==s?(y=s("markdownEditor.link"),e[11]=s,e[12]=y):y=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=f.jsx(Pt,{size:14}),e[13]=v):v=e[13];let M;e[14]!==u||e[15]!==y||e[16]!==d?(M=f.jsx(C,{active:u,label:y,onClick:d,children:v}),e[14]=u,e[15]=y,e[16]=d,e[17]=M):M=e[17];let m;e[18]!==u||e[19]!==b||e[20]!==i||e[21]!==n||e[22]!==o||e[23]!==r||e[24]!==x||e[25]!==s?(m=r&&f.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md bg-popover p-1 shadow-soft",onBlur:T=>{T.currentTarget.contains(T.relatedTarget)||a(!1)},children:[f.jsx("input",{autoFocus:!0,type:"text","aria-label":s("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:s("markdownEditor.linkPlaceholder"),value:i,onChange:T=>{l(T.target.value),h(!1)},onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),b()):T.key==="Escape"&&(T.preventDefault(),a(!1),n.chain().focus().run())},className:B("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")}),f.jsx(C,{active:!1,label:s("markdownEditor.linkApply"),onClick:b,children:f.jsx(at,{size:14})}),u&&f.jsx(C,{active:!1,label:s("markdownEditor.linkRemove"),onClick:x,children:f.jsx(qt,{size:14})})]}),e[18]=u,e[19]=b,e[20]=i,e[21]=n,e[22]=o,e[23]=r,e[24]=x,e[25]=s,e[26]=m):m=e[26];let k;return e[27]!==M||e[28]!==m?(k=f.jsxs("div",{className:"relative",children:[M,m]}),e[27]=M,e[28]=m,e[29]=k):k=e[29],k}const ne=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=f.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},Ae=t=>{const e=$.c(2),{children:n}=t;let s;return e[0]!==n?(s=f.jsx("span",{className:"text-2xs font-semibold leading-none",children:n}),e[0]=n,e[1]=s):s=e[1],s},Ke=[1,2,3],ln=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function cn(t){const e=$.c(20),{editor:n}=t,s=j(),[r,a]=_.useState(null);let i;e[0]!==n?(i={editor:n,selector:un},e[0]=n,e[1]=i):i=e[1];const l=dt(i);let o;e[2]!==s?(o=s("markdownEditor.heading1"),e[2]=s,e[3]=o):o=e[3];let h;e[4]!==s?(h=s("markdownEditor.heading2"),e[4]=s,e[5]=h):h=e[5];let c;e[6]!==s?(c=s("markdownEditor.heading3"),e[6]=s,e[7]=c):c=e[7];let u;e[8]!==o||e[9]!==h||e[10]!==c?(u={1:o,2:h,3:c},e[8]=o,e[9]=h,e[10]=c,e[11]=u):u=e[11];const p=u;let d;e[12]!==n||e[13]!==p||e[14]!==r||e[15]!==l||e[16]!==s?(d=r&&f.jsxs(zt,{editor:n,shouldShow:ln,appendTo:r,className:"flex items-center gap-0.5 rounded-lg bg-popover p-1 shadow-soft","aria-label":s("markdownEditor.toolbarAriaLabel"),children:[f.jsx(C,{active:l.bold,label:s("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:f.jsx(jt,{size:14})}),f.jsx(C,{active:l.italic,label:s("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:f.jsx(Nt,{size:14})}),f.jsx(C,{active:l.strike,label:s("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:f.jsx(Ht,{size:14})}),f.jsx(C,{active:l.code,label:s("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:f.jsx(Ot,{size:14})}),f.jsx(ne,{}),Ke.map((x,w)=>f.jsx(C,{active:l.headings[w]??!1,label:p[x],onClick:()=>n.chain().focus().toggleHeading({level:x}).run(),children:f.jsx(Ae,{children:`H${x}`})},x)),f.jsx(ne,{}),f.jsx(C,{active:l.bulletList,label:s("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:f.jsx(Ft,{size:14})}),f.jsx(C,{active:l.orderedList,label:s("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:f.jsx(Ae,{children:"1."})}),f.jsx(C,{active:l.blockquote,label:s("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:f.jsx(Dt,{size:14})}),f.jsx(ne,{}),f.jsx(on,{editor:n})]}),e[12]=n,e[13]=p,e[14]=r,e[15]=l,e[16]=s,e[17]=d):d=e[17];let g;return e[18]!==d?(g=f.jsx("div",{ref:a,className:"relative z-20",children:d}),e[18]=d,e[19]=g):g=e[19],g}function un(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:Ke.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const hn=10,pn=25,dn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function fn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??dn[t.type]??""}function gn(){const t=$.c(4),e=j(),{upload:n}=Ut(Me),s=Zt(Me);let r;return t[0]!==s||t[1]!==e||t[2]!==n?(r={uploadFile:async i=>{const l=Ze(i),o=l?hn:pn;if(i.size>o*1024*1024)return se.error(e("markdownEditor.fileTooLarge",{name:i.name,max:String(o)})),null;const h=l?Gt:Kt,c=`${crypto.randomUUID()}${fn(i)}`;try{return await n.mutateAsync({dir:h,files:[new File([i],c,{type:i.type})]}),s(`${h}/${c}`)}catch{return se.error(e("markdownEditor.uploadFailed",{name:i.name})),null}}},t[0]=s,t[1]=e,t[2]=n,t[3]=r):r=t[3],r}const X=new Be("uploadSlots"),mn=ue.create({name:"uploadSlots",addProseMirrorPlugins(){return[new ft({key:X,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(X);if(!t.docChanged&&!n)return e;const s=new Map;for(const[r,a]of e)s.set(r,t.mapping.map(a));if(n){const[r,a]=n;a===null?s.delete(r):s.set(r,a)}return s}}})]}});function ie(t,e,n){return t.setMeta(X,[e,n])}function kn(t,e){return X.getState(t)?.get(e)}function xn(t,e,n,s,r){const{schema:a}=t.state,i=a.nodes[n];if(!i)return;const l=i.create(s),o=t.state.selection.to===e,h=t.state.doc.resolve(e),c=h.parent.textBetween(Math.max(0,h.parentOffset-1),h.parentOffset,void 0,""),u=()=>a.text(" "),p=l.isInline?[...c&&!/\s/.test(c)?[u()]:[],l,u()]:l,d=t.state.tr.replaceWith(e,e,p);let g=e,x=e;d.mapping.maps.at(-1)?.forEach((M,m,k,T)=>{g=k,x=T});let w;d.doc.nodesBetween(g,x,(M,m)=>{M===l&&(w=m+M.nodeSize)});let b=w??x;w!==void 0&&l.isInline&&(b+=1);const y=a.nodes.paragraph;w!==void 0&&l.isBlock&&y&&(d.doc.resolve(w).nodeAfter?.isTextblock||d.insert(w,y.create()),b=w+1);const v=gt.near(d.doc.resolve(b));o&&d.setSelection(v),r&&ie(d,r,v.to),t.dispatch(d)}function bn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function wn(t=!0){const e=j(),{uploadFile:n}=gn(),s=_.useRef(n);s.current=n;const[r,a]=_.useState(0),i=_.useRef(0),l=u=>{i.current+=u,a(i.current)},o=(u,p,d)=>{if(!t||p.length===0)return!1;l(p.length);const g=Symbol("upload");return u.dispatch(ie(u.state.tr,g,d)),(async()=>{for(const x of p)try{const w=await s.current(x);if(!w||u.isDestroyed)continue;const b=Ze(x);xn(u,kn(u.state,g)??u.state.selection.to,b?"image":"attachment",b?{src:w,alt:x.name}:{href:w,name:x.name},g)}catch{se.error(e("markdownEditor.uploadFailed",{name:x.name}))}finally{l(-1)}u.isDestroyed||u.dispatch(ie(u.state.tr,g,null))})(),!0};return{pending:r,uploading:()=>i.current>0,uploadInto:o,handlePaste:(u,p)=>{const d=bn(p.clipboardData);return d.length===0?!1:(p.stopPropagation(),o(u,d,u.state.selection.to))},handleDrop:(u,p,d,g)=>{if(g)return!1;const x=Array.from(p.dataTransfer?.files??[]);if(x.length===0)return!1;const w=u.posAtCoords({left:p.clientX,top:p.clientY})?.pos;return w===void 0?!1:(p.stopPropagation(),o(u,x,w))}}}function de(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O=de();function We(t){O=t}var N={exec:()=>null};function S(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(r,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(R.caret,"$1"),n=n.replace(r,i),s},getRegex:()=>new RegExp(n,e)};return s}var yn=(()=>{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)}}>`)},Tn=/^(?:[ \t]*(?:\n|$))+/,vn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,K=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Qe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xe=S(Qe).replace(/bull/g,fe).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(),En=S(Qe).replace(/bull/g,fe).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(),ge=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,An=/^[^\n]+/,me=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rn=S(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",me).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_n=S(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fe).getRegex(),ee="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",ke=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$n=S("^ {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",ke).replace("tag",ee).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ve=S(ge).replace("hr",K).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",ee).getRegex(),Cn=S(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ve).getRegex(),xe={blockquote:Cn,code:vn,def:Rn,fences:Sn,heading:Mn,hr:K,html:$n,lheading:Xe,list:_n,newline:Tn,paragraph:Ve,table:N,text:An},Re=S("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",K).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",ee).getRegex(),Ln={...xe,lheading:En,table:Re,paragraph:S(ge).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Re).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",ee).getRegex()},In={...xe,html:S(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ke).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:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:S(ge).replace("hr",K).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",Xe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Je=/^( {2,}|\\)\n(?!\s*$)/,jn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,F=/[\p{P}\p{S}]/u,te=/[\s\p{P}\p{S}]/u,be=/[^\s\p{P}\p{S}]/u,Nn=S(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,te).getRegex(),Ye=/(?!~)[\p{P}\p{S}]/u,Hn=/(?!~)[\s\p{P}\p{S}]/u,On=/(?:[^\s\p{P}\p{S}]|~)/u,Dn=S(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),et=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Bn=S(et,"u").replace(/punct/g,F).getRegex(),Fn=S(et,"u").replace(/punct/g,Ye).getRegex(),tt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qn=S(tt,"gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Un=S(tt,"gu").replace(/notPunctSpace/g,On).replace(/punctSpace/g,Hn).replace(/punct/g,Ye).getRegex(),Zn=S("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Gn=S(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,F).getRegex(),Kn="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Wn=S(Kn,"gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,te).replace(/punct/g,F).getRegex(),Qn=S(/\\(punct)/,"gu").replace(/punct/g,F).getRegex(),Xn=S(/^<(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(),Vn=S(ke).replace("(?:-->|$)","-->").getRegex(),Jn=S("^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",Vn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),V=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Yn=S(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",V).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nt=S(/^!?\[(label)\]\[(ref)\]/).replace("label",V).replace("ref",me).getRegex(),rt=S(/^!?\[(ref)\](?:\[\])?/).replace("ref",me).getRegex(),er=S("reflink|nolink(?!\\()","g").replace("reflink",nt).replace("nolink",rt).getRegex(),_e=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,we={_backpedal:N,anyPunctuation:Qn,autolink:Xn,blockSkip:Dn,br:Je,code:Pn,del:N,delLDelim:N,delRDelim:N,emStrongLDelim:Bn,emStrongRDelimAst:qn,emStrongRDelimUnd:Zn,escape:zn,link:Yn,nolink:rt,punctuation:Nn,reflink:nt,reflinkSearch:er,tag:Jn,text:jn,url:N},tr={...we,link:S(/^!?\[(label)\]\((.*?)\)/).replace("label",V).getRegex(),reflink:S(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V).getRegex()},ae={...we,emStrongRDelimAst:Un,emStrongLDelim:Fn,delLDelim:Gn,delRDelim:Wn,url:S(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_e).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:S(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_e).getRegex()},nr={...ae,br:S(Je).replace("{2,}","*").getRegex(),text:S(ae.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},W={normal:xe,gfm:Ln,pedantic:In},q={normal:we,gfm:ae,breaks:nr,pedantic:tr},rr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$e=t=>rr[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,$e)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,$e);return t}function Ce(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function Le(t,e){let n=t.replace(R.findPipe,(a,i,l)=>{let o=!1,h=i;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),s=n.split(R.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(R.slashPipe,"|");return s}function U(t,e,n){let s=t.length;if(s===0)return"";let r=0;for(;r<s&&t.charAt(s-r-1)===e;)r++;return t.slice(0,s-r)}function sr(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}function ir(t,e=0){let n=e,s="";for(let r of t)if(r===" "){let a=4-n%4;s+=" ".repeat(a),n+=a}else s+=r,n++;return s}function Ie(t,e,n,s,r){let a=e.href,i=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}function ar(t,e,n){let s=t.match(n.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
3
3
  `).map(a=>{let i=a.match(n.other.beginningSpace);if(i===null)return a;let[l]=i;return l.length>=r.length?a.slice(r.length):a}).join(`
4
4
  `)}var J=class{options;rules;lexer;constructor(t){this.options=t||O}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
5
  `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],s=ar(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:s}}}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 s=U(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.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],`
@@ -55,15 +55,15 @@ ${this.parser.parse(t)}</blockquote>
55
55
  `}tablerow({text:t}){return`<tr>
56
56
  ${t}</tr>
57
57
  `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
58
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${z(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),r=Ce(t);if(r===null)return s;t=r;let a='<a href="'+t+'"';return e&&(a+=' title="'+z(e)+'"'),a+=">"+s+"</a>",a}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=Ce(t);if(r===null)return z(n);t=r;let a=`<img src="${t}" alt="${z(n)}"`;return e&&(a+=` title="${z(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:z(t.text)}},ye=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},I=class le{options;renderer;textRenderer;constructor(e){this.options=e||O,this.options.renderer=this.options.renderer||new Y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ye}static parse(e,n){return new le(n).parse(e)}static parseInline(e,n){return new le(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let i=r,l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){n+=l||"";continue}}let a=r;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let a=e[r];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let i=a;switch(i.type){case"escape":{s+=n.text(i);break}case"html":{s+=n.html(i);break}case"link":{s+=n.link(i);break}case"image":{s+=n.image(i);break}case"checkbox":{s+=n.checkbox(i);break}case"strong":{s+=n.strong(i);break}case"em":{s+=n.em(i);break}case"codespan":{s+=n.codespan(i);break}case"br":{s+=n.br(i);break}case"del":{s+=n.del(i);break}case"text":{s+=n.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},G=class{options;block;constructor(t){this.options=t||O}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?L.lex:L.lexInline}provideParser(t=this.block){return t?I.parse:I.parseInline}},or=class{defaults=de();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=I;Renderer=Y;TextRenderer=ye;Lexer=L;Tokenizer=J;Hooks=G;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let a of r.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of r.rows)for(let i of a)n=n.concat(this.walkTokens(i.tokens,e));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let i=r[a].flat(1/0);n=n.concat(this.walkTokens(i,e))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let a=e.renderers[r.name];a?e.renderers[r.name]=function(...i){let l=r.renderer.apply(this,i);return l===!1&&(l=a.apply(this,i)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[r.level];a?a.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),n.renderer){let r=this.defaults.renderer||new Y(this.defaults);for(let a in n.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let i=a,l=n.renderer[i],o=r[i];r[i]=(...h)=>{let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new J(this.defaults);for(let a in n.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let i=a,l=n.tokenizer[i],o=r[i];r[i]=(...h)=>{let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new G;for(let a in n.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let i=a,l=n.hooks[i],o=r[i];G.passThroughHooks.has(a)?r[i]=h=>{if(this.defaults.async&&G.passThroughHooksRespectAsync.has(a))return(async()=>{let u=await l.call(r,h);return o.call(r,u)})();let c=l.call(r,h);return o.call(r,c)}:r[i]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(r,h);return u===!1&&(u=await o.apply(r,h)),u})();let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(i){let l=[];return l.push(a.call(this,i)),r&&(l=l.concat(r.call(this,i))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return L.lex(t,e??this.defaults)}parser(t,e){return I.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let s={...n},r={...this.defaults,...s},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let i=r.hooks?await r.hooks.preprocess(e):e,l=await(r.hooks?await r.hooks.provideLexer(t):t?L.lex:L.lexInline)(i,r),o=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(o,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(t):t?I.parse:I.parseInline)(o,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(a);try{r.hooks&&(e=r.hooks.preprocess(e));let i=(r.hooks?r.hooks.provideLexer(t):t?L.lex:L.lexInline)(e,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let l=(r.hooks?r.hooks.provideParser(t):t?I.parse:I.parseInline)(i,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(i){return a(i)}}}onError(t,e){return n=>{if(n.message+=`
59
- Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+z(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},H=new or;function E(t,e){return H.parse(t,e)}E.options=E.setOptions=function(t){return H.setOptions(t),E.defaults=H.defaults,We(E.defaults),E};E.getDefaults=de;E.defaults=O;E.use=function(...t){return H.use(...t),E.defaults=H.defaults,We(E.defaults),E};E.walkTokens=function(t,e){return H.walkTokens(t,e)};E.parseInline=H.parseInline;E.Parser=I;E.parser=I.parse;E.Renderer=Y;E.TextRenderer=ye;E.Lexer=L;E.lexer=L.lex;E.Tokenizer=J;E.Hooks=G;E.parse=E;E.options;E.setOptions;E.use;E.walkTokens;E.parseInline;I.parse;L.lex;const lr=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function cr(t){return t.flatMap((e,n)=>{var s;if(e.type==="space"||((s=t[n+1])===null||s===void 0?void 0:s.type)==="space")return[e];const r=(e.raw||"").match(lr);return r?[{...e,raw:(e.raw||"").slice(0,-r[0].length)},{type:"space",raw:r[0]}]:[e]})}function ur(t,e){const n=e.split(`
58
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${z(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),r=Ce(t);if(r===null)return s;t=r;let a='<a href="'+t+'"';return e&&(a+=' title="'+z(e)+'"'),a+=">"+s+"</a>",a}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=Ce(t);if(r===null)return z(n);t=r;let a=`<img src="${t}" alt="${z(n)}"`;return e&&(a+=` title="${z(e)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:z(t.text)}},ye=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},I=class le{options;renderer;textRenderer;constructor(e){this.options=e||O,this.options.renderer=this.options.renderer||new Y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ye}static parse(e,n){return new le(n).parse(e)}static parseInline(e,n){return new le(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let i=r,l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){n+=l||"";continue}}let a=r;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let a=e[r];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let i=a;switch(i.type){case"escape":{s+=n.text(i);break}case"html":{s+=n.html(i);break}case"link":{s+=n.link(i);break}case"image":{s+=n.image(i);break}case"checkbox":{s+=n.checkbox(i);break}case"strong":{s+=n.strong(i);break}case"em":{s+=n.em(i);break}case"codespan":{s+=n.codespan(i);break}case"br":{s+=n.br(i);break}case"del":{s+=n.del(i);break}case"text":{s+=n.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Z=class{options;block;constructor(t){this.options=t||O}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?L.lex:L.lexInline}provideParser(t=this.block){return t?I.parse:I.parseInline}},or=class{defaults=de();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=I;Renderer=Y;TextRenderer=ye;Lexer=L;Tokenizer=J;Hooks=Z;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let a of r.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of r.rows)for(let i of a)n=n.concat(this.walkTokens(i.tokens,e));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let i=r[a].flat(1/0);n=n.concat(this.walkTokens(i,e))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let a=e.renderers[r.name];a?e.renderers[r.name]=function(...i){let l=r.renderer.apply(this,i);return l===!1&&(l=a.apply(this,i)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[r.level];a?a.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),n.renderer){let r=this.defaults.renderer||new Y(this.defaults);for(let a in n.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let i=a,l=n.renderer[i],o=r[i];r[i]=(...h)=>{let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new J(this.defaults);for(let a in n.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let i=a,l=n.tokenizer[i],o=r[i];r[i]=(...h)=>{let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Z;for(let a in n.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let i=a,l=n.hooks[i],o=r[i];Z.passThroughHooks.has(a)?r[i]=h=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(a))return(async()=>{let u=await l.call(r,h);return o.call(r,u)})();let c=l.call(r,h);return o.call(r,c)}:r[i]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(r,h);return u===!1&&(u=await o.apply(r,h)),u})();let c=l.apply(r,h);return c===!1&&(c=o.apply(r,h)),c}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(i){let l=[];return l.push(a.call(this,i)),r&&(l=l.concat(r.call(this,i))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return L.lex(t,e??this.defaults)}parser(t,e){return I.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let s={...n},r={...this.defaults,...s},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let i=r.hooks?await r.hooks.preprocess(e):e,l=await(r.hooks?await r.hooks.provideLexer(t):t?L.lex:L.lexInline)(i,r),o=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(o,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(t):t?I.parse:I.parseInline)(o,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(a);try{r.hooks&&(e=r.hooks.preprocess(e));let i=(r.hooks?r.hooks.provideLexer(t):t?L.lex:L.lexInline)(e,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let l=(r.hooks?r.hooks.provideParser(t):t?I.parse:I.parseInline)(i,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(i){return a(i)}}}onError(t,e){return n=>{if(n.message+=`
59
+ Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+z(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},H=new or;function E(t,e){return H.parse(t,e)}E.options=E.setOptions=function(t){return H.setOptions(t),E.defaults=H.defaults,We(E.defaults),E};E.getDefaults=de;E.defaults=O;E.use=function(...t){return H.use(...t),E.defaults=H.defaults,We(E.defaults),E};E.walkTokens=function(t,e){return H.walkTokens(t,e)};E.parseInline=H.parseInline;E.Parser=I;E.parser=I.parse;E.Renderer=Y;E.TextRenderer=ye;E.Lexer=L;E.lexer=L.lex;E.Tokenizer=J;E.Hooks=Z;E.parse=E;E.options;E.setOptions;E.use;E.walkTokens;E.parseInline;I.parse;L.lex;const lr=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function cr(t){return t.flatMap((e,n)=>{var s;if(e.type==="space"||((s=t[n+1])===null||s===void 0?void 0:s.type)==="space")return[e];const r=(e.raw||"").match(lr);return r?[{...e,raw:(e.raw||"").slice(0,-r[0].length)},{type:"space",raw:r[0]}]:[e]})}function ur(t,e){const n=e.split(`
60
60
  `).flatMap(s=>[s,""]).map(s=>`${t}${s}`).join(`
61
- `);return n.slice(0,n.length-1)}function hr(t,e){const n=[];return Array.from(t.entries()).forEach(([s,r])=>{if(!e){n.push(s);return}(e.marks||[]).find(a=>a.type===s&&Z(a.attrs,r.attrs))||n.push(s)}),n}function pr(t,e){const n=[];return Array.from(e.entries()).forEach(([s,r])=>{const a=t.get(s);(!a||!Z(a.attrs,r.attrs))&&n.push({type:s,mark:r})}),n}function dr(t,e,n,s){const r=!n,a=n&&(!n.marks||n.marks.length===0),i=n&&n.marks&&!s(e,new Map(n.marks.map(o=>[o.type,o]))),l=[];return(r||a||i)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([o,h])=>{n.marks.find(c=>c.type===o&&Z(c.attrs,h.attrs))||l.push(o)}):(r||a)&&l.push(...Array.from(t.keys()).reverse())),l}function fr(t,e){let n="";return Array.from(t.keys()).reverse().forEach(s=>{const r=e(s,t.get(s));r&&(n=r+n)}),t.clear(),n}function gr(t,e,n){let s="";return Array.from(t.entries()).forEach(([r,a])=>{const i=n(r,a);i&&(s+=i),e.set(r,a)}),s}function re(t){const e=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return e?{isTask:!0,checked:e[2].toLowerCase()==="x",indentLevel:e[1].length}:{isTask:!1,indentLevel:0}}function Q(t,e){return typeof t!="string"?"json":e}const mr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","mask","path","polygon","polyline","radialgradient","rect","stop","switch","symbol","textpath","tspan","use","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),kr=/<\/?([a-zA-Z][\w-]*)/g;function xr(t){const e=[];let n;for(;(n=kr.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function br(t){const e=t.toLowerCase();return e.includes("-")?!1:!mr.has(e)}function wr(t,e){return xr(t).some(n=>br(n)?!e.has(n):!1)}var ze=class{constructor(t){var e,n,s,r,a;this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.inlineNodeTypesCache=null,this.lastParseResult=null,this.markedInstance=(e=t?.marked)!==null&&e!==void 0?e:E,this.indentStyle=(n=t==null||(s=t.indentation)===null||s===void 0?void 0:s.style)!==null&&n!==void 0?n:"space",this.indentSize=(r=t==null||(a=t.indentation)===null||a===void 0?void 0:a.size)!==null&&r!==void 0?r:2,this.baseExtensions=t?.extensions||[],t?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t?.extensions&&(this.baseExtensions=t.extensions,mt(kt(t.extensions)).forEach(i=>this.registerExtension(i)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const s=xt(D(t,"code")),r=t.name;s&&this.codeTypes.add(r),this.extensionRanks.has(r)||this.extensionRanks.set(r,this.extensionRanks.size);const a=D(t,"markdownTokenName")||r,i=D(t,"parseMarkdown"),l=D(t,"renderMarkdown"),o=D(t,"markdownTokenizer"),h=(e=D(t,"markdownOptions"))!==null&&e!==void 0?e:null,c={tokenName:a,nodeName:r,parseMarkdown:i,renderMarkdown:l,isIndenting:(n=h?.indentsContent)!==null&&n!==void 0?n:!1,htmlReopen:h?.htmlReopen,tokenizer:o};if(a&&i){const u=this.registry.get(a)||[];u.push(c),this.registry.set(a,u)}if(l){const u=this.nodeTypeRegistry.get(r)||[];u.push(c),this.nodeTypeRegistry.set(r,u)}o&&this.hasMarked()&&this.registerTokenizer(o)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!==null&&e!==void 0?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:s="inline",tokenize:r}=t,a=this.createTokenizerHelpers.bind(this),i=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:h=>h.indexOf(n):l=h=>{const c=r(h,[],this.createTokenizerHelpers(this.createLexer()));return c&&c.raw?h.indexOf(c.raw):-1};const o={name:e,level:s,start:l,tokenizer(h,c){const u=this.lexer?a(this.lexer):a(i()),p=r(h,c,u);if(p&&p.type)return{...p,type:p.type||e,raw:p.raw||"",tokens:p.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[o]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/&nbsp;/g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const s=n.lex(t);return{type:"doc",content:this.parseTokens(s,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=e?cr(t):t,s=n.reduce((i,l,o)=>(l.type!=="space"&&i.push(o),i),[]);let r=-1,a=0;return n.flatMap((i,l)=>{for(;a<s.length&&s[a]<l;)r=s[a],a+=1;if(e&&i.type==="space"){var o;const c=(o=s[a])!==null&&o!==void 0?o:-1;return this.createImplicitEmptyParagraphsFromSpace(i,r,c)}const h=this.parseToken(i,e);return h===null?[]:Array.isArray(h)?h:[h]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const s=this.countParagraphSeparators(t.raw||"");if(s===0)return[];const r=Math.max(s-(e===-1||n===-1?0:1),0);return Array.from({length:r},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
61
+ `);return n.slice(0,n.length-1)}function hr(t,e){const n=[];return Array.from(t.entries()).forEach(([s,r])=>{if(!e){n.push(s);return}(e.marks||[]).find(a=>a.type===s&&G(a.attrs,r.attrs))||n.push(s)}),n}function pr(t,e){const n=[];return Array.from(e.entries()).forEach(([s,r])=>{const a=t.get(s);(!a||!G(a.attrs,r.attrs))&&n.push({type:s,mark:r})}),n}function dr(t,e,n,s){const r=!n,a=n&&(!n.marks||n.marks.length===0),i=n&&n.marks&&!s(e,new Map(n.marks.map(o=>[o.type,o]))),l=[];return(r||a||i)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([o,h])=>{n.marks.find(c=>c.type===o&&G(c.attrs,h.attrs))||l.push(o)}):(r||a)&&l.push(...Array.from(t.keys()).reverse())),l}function fr(t,e){let n="";return Array.from(t.keys()).reverse().forEach(s=>{const r=e(s,t.get(s));r&&(n=r+n)}),t.clear(),n}function gr(t,e,n){let s="";return Array.from(t.entries()).forEach(([r,a])=>{const i=n(r,a);i&&(s+=i),e.set(r,a)}),s}function re(t){const e=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return e?{isTask:!0,checked:e[2].toLowerCase()==="x",indentLevel:e[1].length}:{isTask:!1,indentLevel:0}}function Q(t,e){return typeof t!="string"?"json":e}const mr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","mask","path","polygon","polyline","radialgradient","rect","stop","switch","symbol","textpath","tspan","use","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),kr=/<\/?([a-zA-Z][\w-]*)/g;function xr(t){const e=[];let n;for(;(n=kr.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function br(t){const e=t.toLowerCase();return e.includes("-")?!1:!mr.has(e)}function wr(t,e){return xr(t).some(n=>br(n)?!e.has(n):!1)}var ze=class{constructor(t){var e,n,s,r,a;this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.inlineNodeTypesCache=null,this.lastParseResult=null,this.markedInstance=(e=t?.marked)!==null&&e!==void 0?e:E,this.indentStyle=(n=t==null||(s=t.indentation)===null||s===void 0?void 0:s.style)!==null&&n!==void 0?n:"space",this.indentSize=(r=t==null||(a=t.indentation)===null||a===void 0?void 0:a.size)!==null&&r!==void 0?r:2,this.baseExtensions=t?.extensions||[],t?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t?.extensions&&(this.baseExtensions=t.extensions,mt(kt(t.extensions)).forEach(i=>this.registerExtension(i)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const s=xt(D(t,"code")),r=t.name;s&&this.codeTypes.add(r),this.extensionRanks.has(r)||this.extensionRanks.set(r,this.extensionRanks.size);const a=D(t,"markdownTokenName")||r,i=D(t,"parseMarkdown"),l=D(t,"renderMarkdown"),o=D(t,"markdownTokenizer"),h=(e=D(t,"markdownOptions"))!==null&&e!==void 0?e:null,c={tokenName:a,nodeName:r,parseMarkdown:i,renderMarkdown:l,isIndenting:(n=h?.indentsContent)!==null&&n!==void 0?n:!1,htmlReopen:h?.htmlReopen,tokenizer:o};if(a&&i){const u=this.registry.get(a)||[];u.push(c),this.registry.set(a,u)}if(l){const u=this.nodeTypeRegistry.get(r)||[];u.push(c),this.nodeTypeRegistry.set(r,u)}o&&this.hasMarked()&&this.registerTokenizer(o)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!==null&&e!==void 0?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:s="inline",tokenize:r}=t,a=this.createTokenizerHelpers.bind(this),i=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:h=>h.indexOf(n):l=h=>{const c=r(h,[],this.createTokenizerHelpers(this.createLexer()));return c&&c.raw?h.indexOf(c.raw):-1};const o={name:e,level:s,start:l,tokenizer(h,c){const u=this.lexer?a(this.lexer):a(i()),p=r(h,c,u);if(p&&p.type)return{...p,type:p.type||e,raw:p.raw||"",tokens:p.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[o]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/&nbsp;/g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const s=n.lex(t);return{type:"doc",content:this.parseTokens(s,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=e?cr(t):t,s=n.reduce((i,l,o)=>(l.type!=="space"&&i.push(o),i),[]);let r=-1,a=0;return n.flatMap((i,l)=>{for(;a<s.length&&s[a]<l;)r=s[a],a+=1;if(e&&i.type==="space"){var o;const c=(o=s[a])!==null&&o!==void 0?o:-1;return this.createImplicitEmptyParagraphsFromSpace(i,r,c)}const h=this.parseToken(i,e);return h===null?[]:Array.isArray(h)?h:[h]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const s=this.countParagraphSeparators(t.raw||"");if(s===0)return[];const r=Math.max(s-(e===-1||n===-1?0:1),0);return Array.from({length:r},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
62
62
  `).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),s=this.createParseHelpers();if(n.find(r=>{if(!r.parseMarkdown)return!1;const a=r.parseMarkdown(t,s),i=this.normalizeParseResult(a);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,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>re(l).isTask),n=t.items.some(l=>!re(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const s=[];let r=[],a=null;for(let l=0;l<t.items.length;l+=1){const o=t.items[l],{isTask:h,checked:c,indentLevel:u}=re(o);let p=o;if(h){const g=(o.raw||o.text||"").split(`
63
63
  `),x=g[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),w=x?x[2]:"";let b=[];if(g.length>1&&g.slice(1).join(`
64
64
  `).trim()){const y=g.slice(1),v=y.filter(M=>M.trim());if(v.length>0){const M=Math.min(...v.map(k=>k.length-k.trimStart().length)),m=y.map(k=>k.trim()?k.slice(M):"").join(`
65
65
  `).trim();m&&(b=this.markedInstance.lexer(`${m}
66
- `))}}p={type:"taskItem",raw:"",mainContent:w,indentLevel:u,checked:c??!1,text:w,tokens:this.tokenizeInline(w),nestedTokens:b}}const d=h?"taskList":"list";a!==d?(r.length>0&&s.push({type:a,items:r}),r=[p],a=d):r.push(p)}r.length>0&&s.push({type:a,items:r});const i=[];for(let l=0;l<s.length;l+=1){const o=s[l],h={...t,type:o.type,items:o.items},c=this.parseToken(h);c&&(Array.isArray(c)?i.push(...c):i.push(c))}return i.length>0?i:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(s=>{if(!s.parseMarkdown)return!1;const r=s.parseMarkdown(t,n),a=this.normalizeParseResult(r);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}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 s={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete s.attrs,s},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 i=0;i<t.length;i+=1){const l=t[i];if(l.type==="text")e.push({type:"text",text:ve(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,s;const o=((n=(s=l.raw)!==null&&s!==void 0?s:l.text)!==null&&n!==void 0?n:"").toString(),h=/^<\/[\s]*[\w-]+/i.test(o),c=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!h&&c&&!/\/>$/.test(o)){const p=c[1],d=this.escapeRegex(p),g=new RegExp(`^<\\/\\s*${d}\\b`,"i");let x=-1;const w=[o];for(let b=i+1;b<t.length;b+=1){var r,a;const y=t[b],v=((r=(a=y.raw)!==null&&a!==void 0?a:y.text)!==null&&r!==void 0?r:"").toString();if(w.push(v),y.type==="html"&&g.test(v)){x=b;break}}if(x!==-1){const b=w.join(""),y={type:"html",raw:b,text:b,block:!1},v=this.parseHTMLToken(y);if(v){const M=this.normalizeParseResult(v);Array.isArray(M)?e.push(...M):M&&e.push(M)}i=x;continue}}const u=this.parseHTMLToken(l);if(u){const p=this.normalizeParseResult(u);Array.isArray(p)?e.push(...p):p&&e.push(p)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const h=this.createParseHelpers(),c=o.parseMarkdown(l,h);if(this.isMarkResult(c)){const u=this.applyMarkToContent(c.mark,c.content,c.attrs);e.push(...u)}else{const u=this.normalizeParseResult(c);Array.isArray(u)?e.push(...u):u&&e.push(u)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let i=e.length-1;i>0;i-=1){const l=e[i],o=e[i-1];if(l.type==="text"&&o.type==="text"){const h=l.marks||[],c=o.marks||[];bt(h,c)&&(o.text=(o.text||"")+(l.text||""),e.splice(i,1))}}return e}applyMarkToContent(t,e,n){return e.map(s=>{if(s.type==="text"){const r=s.marks||[],a=n?{type:t,attrs:n}:{type:t};return{...s,marks:[...r,a]}}return{...s,content:s.content?this.applyMarkToContent(t,s.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:ve(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=wt(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const s=this.toInlineContent(n.content);return s.length>0?s: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=Se(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return wr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=Se(this.baseExtensions),n=s=>{const r=s?.parseDOM;Array.isArray(r)&&r.forEach(a=>{if(typeof a?.tag=="string"){const i=a.tag.match(/^[a-zA-Z][\w-]*/);i&&t.add(i[0].toLowerCase())}})};Object.values(e.nodes).forEach(s=>n(s.spec)),Object.values(e.marks).forEach(s=>n(s.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(s=>this.codeTypes.has(typeof s=="string"?s:s.type))?t:this.escapeMarkdownSyntax(yt(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,s=0,r={}){var a;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const i=this.getHandlerForToken(t.type);if(!i)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(c,u)=>{const p=i.isIndenting?s+1:s;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,t,u||"",n,p):this.renderNodes(c,t,u||"",n,p)},renderChild:(c,u)=>{const p=i.isIndenting?s+1:s;return this.renderNodeToMarkdown(c,t,u,p)},indent:c=>this.indentString+c,wrapInBlock:ur},h={index:n,level:s,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...r}};return((a=i.renderMarkdown)===null||a===void 0?void 0:a.call(i,t,o,h))||""}renderNodes(t,e,n="",s=0,r=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,r):t.type?this.renderNodeToMarkdown(t,e,s,r):""}renderNodesWithMarkBoundaries(t,e,n="",s=0){const r=[],a=new Map,i=new Set,l=new Map;return t.forEach((o,h)=>{const c=h<t.length-1?t[h+1]:null;if(o.type)if(o.type==="text"){let u=this.encodeTextForMarkdown(o.text||"",o,e);const p=new Map((o.marks||[]).map(m=>[m.type,m])),d=this.getMarksToOpenForSerialization(a,p,c),g=hr(p,c),x=g.filter(m=>a.has(m)),w=x.length>0&&d.length>0;let b="";if(g.length>0&&!w){const m=u.match(/(\s+)$/);m&&(b=m[1],u=u.slice(0,-b.length))}w||g.slice().reverse().forEach(m=>{if(!a.has(m))return;const k=p.get(m),T=this.getMarkClosing(m,k,l.get(m));T&&(u+=T),a.has(m)&&(a.delete(m),l.delete(m))});let y="";if(d.length>0){const m=u.match(/^(\s+)/);m&&(y=m[1],u=u.slice(y.length))}d.forEach(({type:m,mark:k})=>{const T=i.has(m)?"html":"markdown",A=this.getMarkOpening(m,k,T);A&&(u=A+u),l.set(m,T),i.delete(m)}),w||d.slice().reverse().forEach(({type:m,mark:k})=>{a.set(m,k)}),u=y+u;let v;if(w){const m=new Set((c?.marks||[]).map(A=>A.type));d.forEach(({type:A})=>{m.has(A)&&this.getHtmlReopenTags(A)&&i.add(A)});const k=Array.from(a.keys()),T=x.slice().sort((A,it)=>k.indexOf(it)-k.indexOf(A));v=[...d.map(A=>A.type),...T]}else v=dr(a,p,c,this.markSetsEqual.bind(this));let M="";if(v.length>0){const m=u.match(/(\s+)$/);m&&(M=m[1],u=u.slice(0,-M.length))}v.forEach(m=>{var k;const T=(k=a.get(m))!==null&&k!==void 0?k:p.get(m),A=this.getMarkClosing(m,T,l.get(m));A&&(u+=A),a.delete(m),l.delete(m)}),u+=M,u+=b,r.push(u)}else{const u=new Set((o.marks||[]).map(b=>b.type)),p=new Map,d=new Map;a.forEach((b,y)=>{if(u.has(y)){var v;p.set(y,b),d.set(y,(v=l.get(y))!==null&&v!==void 0?v:"markdown")}});const g=fr(a,(b,y)=>this.getMarkClosing(b,y,l.get(b)));l.clear();const x=this.renderNodeToMarkdown(o,e,h,s),w=o.type==="hardBreak"?"":gr(p,a,(b,y)=>{var v;const M=(v=d.get(b))!==null&&v!==void 0?v:"markdown";return l.set(b,M),this.getMarkOpening(b,y,M)});r.push(g+x+w)}}),r.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.open)||""}const r=this.getHandlersForNodeType(t),a=r.length>0?r[0]:void 0;if(!a||!a.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const o=a.renderMarkdown(l,{renderChildren:()=>i,renderChild:()=>i,indent:c=>c,wrapInBlock:(c,u)=>c+u},{index:0,level:0,parentType:"text",meta:{}}),h=o.indexOf(i);return h>=0?o.substring(0,h):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.close)||""}const r=this.getHandlersForNodeType(t),a=r.length>0?r[0]:void 0;if(!a||!a.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const o=a.renderMarkdown(l,{renderChildren:()=>i,renderChild:()=>i,indent:u=>u,wrapInBlock:(u,p)=>u+p},{index:0,level:0,parentType:"text",meta:{}}),h=o.indexOf(i),c=h+33;return h>=0?o.substring(c):""}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,s])=>{const r=e.get(n);return r&&Z(s.attrs,r.attrs)})}getMarksToOpenForSerialization(t,e,n){const s=pr(t,e);if(s.length<=1)return s;const r=n?.marks||[],a=(h,c)=>r.some(u=>u.type===h&&Z(u.attrs,c)),i=(h,c)=>{var u,p;const d=(u=this.extensionRanks.get(h.type))!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER,g=(p=this.extensionRanks.get(c.type))!==null&&p!==void 0?p:Number.MAX_SAFE_INTEGER;return d!==g?g-d:h.type.localeCompare(c.type)},l=s.filter(h=>!a(h.type,h.mark.attrs)).sort(i),o=s.filter(h=>a(h.type,h.mark.attrs)).sort(i);return[...l,...o]}};const yr=ue.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(Q(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(Q(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(Q(e,n?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContentAt(t,e,n);const s=this.editor.markdown.parse(e);return P.insertContentAt(t,s,n)}}},addStorage(){return{manager:new ze({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 ze({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||Q(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 Tr(t){const e=$.c(13),{node:n,selected:s,editor:r,deleteNode:a}=t,i=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",h=s&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let c;e[0]!==h?(c=B(Wt,"select-none",h),e[0]=h,e[1]=c):c=e[1];let u;e[2]!==a||e[3]!==r.isEditable||e[4]!==i?(u=r.isEditable&&f.jsx("button",{type:"button","aria-label":i("markdownEditor.removeFile"),onMouseDown:vr,onClick:a,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:f.jsx(Oe,{size:14})}),e[2]=a,e[3]=r.isEditable,e[4]=i,e[5]=u):u=e[5];let p;e[6]!==l||e[7]!==o||e[8]!==u?(p=f.jsx(Qt,{href:l,name:o,children:u}),e[6]=l,e[7]=o,e[8]=u,e[9]=p):p=e[9];let d;return e[10]!==c||e[11]!==p?(d=f.jsx(pe,{as:"span",className:c,children:p}),e[10]=c,e[11]=p,e[12]=d):d=e[12],d}function vr(t){return t.preventDefault()}function Sr(t){return t.replace(/([[\]])/g,"\\$1")}const Mr=Fe.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]",getAttrs:t=>Ze(t.getAttribute("href")??"")?null:!1}]},renderHTML({HTMLAttributes:t,node:e}){return["a",qe(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`[${Sr(n)}](${e})`},addNodeView(){return he(Tr)}});function Er(t){const e=$.c(6),{node:n,selected:s}=t,r=typeof n.attrs.name=="string"?n.attrs.name:"";let a;e[0]!==n.attrs.id||e[1]!==s?(a=B("select-none",Vt(typeof n.attrs.id=="string"?n.attrs.id:null),s&&"ring-2 ring-ring"),e[0]=n.attrs.id,e[1]=s,e[2]=a):a=e[2];let i;return e[3]!==r||e[4]!==a?(i=f.jsxs(pe,{as:"span","data-testid":"mention-chip",className:a,children:["@",r]}),e[3]=r,e[4]=a,e[5]=i):i=e[5],i}const Ar=Fe.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",qe(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?Xt(e,n):`@${n}`},addNodeView(){return he(Er)}}),Rr="studio.mention-members.",ce=new Map;function Pe(t){const e=ce.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const s=JSON.parse(n);if(!Array.isArray(s))return;const r=s.filter(a=>!!a&&typeof a.id=="string"&&typeof a.name=="string");return ce.set(t,r),r}catch{return}}function _r(t,e){ce.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function $r(t,e){if(!t?.length)return e;const n=new Map(t.map(s=>[s.id,s]));return e.map(s=>{const r=n.get(s.id);return r&&r.name===s.name&&r.email===s.email&&r.image===s.image?r:s})}function Cr(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 Lr(t){const e=$.c(17),{locator:n}=ot(),s=lt(),r=`${Rr}${n}`;let a;e[0]!==n?(a=ut.mentionMembers(n),e[0]=n,e[1]=a):a=e[1];let i;e[2]!==r?(i=()=>Pe(r),e[2]=r,e[3]=i):i=e[3];let l;e[4]!==s||e[5]!==r?(l=async()=>{const d=await s.organization.listMembers(),g=$r(Pe(r),Cr(d?.data?.members??[]));return _r(r,g),g},e[4]=s,e[5]=r,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==a||e[9]!==i||e[10]!==l?(o={queryKey:a,enabled:t,staleTime:0,placeholderData:i,queryFn:l},e[7]=t,e[8]=a,e[9]=i,e[10]=l,e[11]=o):o=e[11];const h=ct(o);let c;e[12]!==h.data?(c=h.data??[],e[12]=h.data,e[13]=c):c=e[13];const u=h.isFetching&&!h.data;let p;return e[14]!==c||e[15]!==u?(p={members:c,loading:u},e[14]=c,e[15]=u,e[16]=p):p=e[16],p}const je={query:"",range:null,rect:null,editor:null};class Ir{state=je;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(je)}}const Te=new Be("markdownEditorMention");function zr(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),Ue(t.view,Te)}function Pr(t,e,n){const s=Math.min(e+n,t.content.size);return e>=s?"":t.textBetween(e,s,"","")}function st(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,"")}),Ue(t.view,Te)}function jr(t){return ue.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Te,allowedPrefixes:[" ",`
67
- `],allow:({state:n,range:s})=>{const r=t.dismissal;return r?s.from===r.from&&Pr(n.doc,r.from,r.text.length)===r.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"?(st(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Ct(e)]}})}const Ne=256,Nr=40,He=280,Hr=140,Or=[];function Dr(t){const e=$.c(5),{store:n,agents:s}=t,r=s===void 0?Or:s,a=_.useSyncExternalStore(n.subscribe,n.getSnapshot),i=a.range!==null;let l;return e[0]!==r||e[1]!==i||e[2]!==a||e[3]!==n?(l=i?f.jsx(Br,{store:n,state:a,agents:r}):null,e[0]=r,e[1]=i,e[2]=a,e[3]=n,e[4]=l):l=e[4],l}function Br({store:t,state:e,agents:n}){const s=j(),{members:r,loading:a}=Lr(!0),[i,l]=_.useState(e.query),[o,h]=_.useState(null),c=Fr(e.editor),u=c.getBoundingClientRect(),p=c===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):u,d=e.rect?.()??new DOMRect(0,0,0,0),g=p.bottom-d.bottom,x=g<He&&d.top-p.top>g,w=(x?d.top-p.top:g)-8,b=Math.min(He,Math.max(w,Hr))-Nr,y={position:"absolute",width:Ne,left:Math.min(d.left,p.right-Ne-8)-u.left,...x?{bottom:u.bottom-d.top+6}:{top:d.bottom-u.top+6}},v=()=>{e.editor&&st(e.editor,t),t.close()},M=k=>{const T=k.relatedTarget;if((!T||e.editor?.view.dom.contains(T)===!0)&&t.latched){o?.focus();return}v()},m=k=>{!e.editor||!e.range||(zr(e.editor,e.range,k),t.close())};return ht.createPortal(f.jsx("div",{style:y,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg bg-popover shadow-soft",children:f.jsxs(tn,{onKeyDown:k=>{k.key==="Escape"&&(k.preventDefault(),v(),e.editor?.commands.focus())},children:[f.jsx(nn,{ref:h,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:l,placeholder:s("markdownEditor.mentionSearch"),onBlur:M}),f.jsxs(rn,{style:{maxHeight:b},children:[a?f.jsx("div",{className:"flex items-center justify-center py-6",children:f.jsx(De,{size:"sm"})}):f.jsx(sn,{children:s("markdownEditor.mentionEmpty")}),n.map(k=>f.jsxs(Ee,{value:k.name,onSelect:()=>m(k),onMouseDown:T=>T.preventDefault(),className:"gap-2",children:[k.icon,f.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.name})]},k.id)),r.map(k=>f.jsxs(Ee,{value:`${k.name} ${k.email}`,onSelect:()=>m(k),onMouseDown:T=>T.preventDefault(),className:"gap-2",children:[f.jsx(pt,{url:k.image??void 0,fallback:k.name??"?",shape:"circle",size:"xs"}),f.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.name})]},k.id))]})]})}),c)}function Fr(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}function qr(t){const e=$.c(16),{node:n,selected:s,editor:r,deleteNode:a}=t,i=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let h;e[0]!==o||e[1]!==i?(h=o||i("markdownEditor.imageAltFallback"),e[0]=o,e[1]=i,e[2]=h):h=e[2];const c=s&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let u;e[3]!==c?(u=B("max-h-[420px] max-w-full rounded-lg border border-border object-contain",c),e[3]=c,e[4]=u):u=e[4];let p;e[5]!==l||e[6]!==h||e[7]!==u?(p=f.jsx("img",{src:l,alt:h,draggable:!1,className:u}),e[5]=l,e[6]=h,e[7]=u,e[8]=p):p=e[8];let d;e[9]!==a||e[10]!==r.isEditable||e[11]!==i?(d=r.isEditable&&f.jsx("button",{type:"button","aria-label":i("markdownEditor.removeImage"),onMouseDown:Ur,onClick:a,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg bg-card text-muted-foreground opacity-0 shadow-edge transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:f.jsx(Oe,{size:14})}),e[9]=a,e[10]=r.isEditable,e[11]=i,e[12]=d):d=e[12];let g;return e[13]!==p||e[14]!==d?(g=f.jsxs(pe,{className:"group/image relative my-3 w-fit max-w-full",children:[p,d]}),e[13]=p,e[14]=d,e[15]=g):g=e[15],g}function Ur(t){return t.preventDefault()}const Gr=Yt.extend({addNodeView(){return he(qr)}}).configure({inline:!1,allowBase64:!1}),Zr={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},Kr=Tt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Ze(n))return e.createNode("attachment",{href:n,name:t.text??""});const s=Jt(n);return s?e.createNode("mention",{id:s,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function Wr(t="",e){return[St.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),Kr.configure(Zr),Lt.configure({placeholder:t}),en,vt,Mt.configure({nested:!0}),Gr,Mr,mn,Ar,...e?[jr(e)]:[],yr.configure({markedOptions:{breaks:!0}})]}const Qr=/^(\s*)([-*+]|\d+[.)])\s+\S/,Xr=/^\s*(```|~~~)/,Vr=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Jr(t){const e=[];let n=!1,s=!1;for(const r of t.split(`
66
+ `))}}p={type:"taskItem",raw:"",mainContent:w,indentLevel:u,checked:c??!1,text:w,tokens:this.tokenizeInline(w),nestedTokens:b}}const d=h?"taskList":"list";a!==d?(r.length>0&&s.push({type:a,items:r}),r=[p],a=d):r.push(p)}r.length>0&&s.push({type:a,items:r});const i=[];for(let l=0;l<s.length;l+=1){const o=s[l],h={...t,type:o.type,items:o.items},c=this.parseToken(h);c&&(Array.isArray(c)?i.push(...c):i.push(c))}return i.length>0?i:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(s=>{if(!s.parseMarkdown)return!1;const r=s.parseMarkdown(t,n),a=this.normalizeParseResult(r);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}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 s={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete s.attrs,s},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 i=0;i<t.length;i+=1){const l=t[i];if(l.type==="text")e.push({type:"text",text:ve(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,s;const o=((n=(s=l.raw)!==null&&s!==void 0?s:l.text)!==null&&n!==void 0?n:"").toString(),h=/^<\/[\s]*[\w-]+/i.test(o),c=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!h&&c&&!/\/>$/.test(o)){const p=c[1],d=this.escapeRegex(p),g=new RegExp(`^<\\/\\s*${d}\\b`,"i");let x=-1;const w=[o];for(let b=i+1;b<t.length;b+=1){var r,a;const y=t[b],v=((r=(a=y.raw)!==null&&a!==void 0?a:y.text)!==null&&r!==void 0?r:"").toString();if(w.push(v),y.type==="html"&&g.test(v)){x=b;break}}if(x!==-1){const b=w.join(""),y={type:"html",raw:b,text:b,block:!1},v=this.parseHTMLToken(y);if(v){const M=this.normalizeParseResult(v);Array.isArray(M)?e.push(...M):M&&e.push(M)}i=x;continue}}const u=this.parseHTMLToken(l);if(u){const p=this.normalizeParseResult(u);Array.isArray(p)?e.push(...p):p&&e.push(p)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const h=this.createParseHelpers(),c=o.parseMarkdown(l,h);if(this.isMarkResult(c)){const u=this.applyMarkToContent(c.mark,c.content,c.attrs);e.push(...u)}else{const u=this.normalizeParseResult(c);Array.isArray(u)?e.push(...u):u&&e.push(u)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let i=e.length-1;i>0;i-=1){const l=e[i],o=e[i-1];if(l.type==="text"&&o.type==="text"){const h=l.marks||[],c=o.marks||[];bt(h,c)&&(o.text=(o.text||"")+(l.text||""),e.splice(i,1))}}return e}applyMarkToContent(t,e,n){return e.map(s=>{if(s.type==="text"){const r=s.marks||[],a=n?{type:t,attrs:n}:{type:t};return{...s,marks:[...r,a]}}return{...s,content:s.content?this.applyMarkToContent(t,s.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:ve(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=wt(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const s=this.toInlineContent(n.content);return s.length>0?s: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=Se(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return wr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=Se(this.baseExtensions),n=s=>{const r=s?.parseDOM;Array.isArray(r)&&r.forEach(a=>{if(typeof a?.tag=="string"){const i=a.tag.match(/^[a-zA-Z][\w-]*/);i&&t.add(i[0].toLowerCase())}})};Object.values(e.nodes).forEach(s=>n(s.spec)),Object.values(e.marks).forEach(s=>n(s.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(s=>this.codeTypes.has(typeof s=="string"?s:s.type))?t:this.escapeMarkdownSyntax(yt(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,s=0,r={}){var a;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const i=this.getHandlerForToken(t.type);if(!i)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(c,u)=>{const p=i.isIndenting?s+1:s;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,t,u||"",n,p):this.renderNodes(c,t,u||"",n,p)},renderChild:(c,u)=>{const p=i.isIndenting?s+1:s;return this.renderNodeToMarkdown(c,t,u,p)},indent:c=>this.indentString+c,wrapInBlock:ur},h={index:n,level:s,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...r}};return((a=i.renderMarkdown)===null||a===void 0?void 0:a.call(i,t,o,h))||""}renderNodes(t,e,n="",s=0,r=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,r):t.type?this.renderNodeToMarkdown(t,e,s,r):""}renderNodesWithMarkBoundaries(t,e,n="",s=0){const r=[],a=new Map,i=new Set,l=new Map;return t.forEach((o,h)=>{const c=h<t.length-1?t[h+1]:null;if(o.type)if(o.type==="text"){let u=this.encodeTextForMarkdown(o.text||"",o,e);const p=new Map((o.marks||[]).map(m=>[m.type,m])),d=this.getMarksToOpenForSerialization(a,p,c),g=hr(p,c),x=g.filter(m=>a.has(m)),w=x.length>0&&d.length>0;let b="";if(g.length>0&&!w){const m=u.match(/(\s+)$/);m&&(b=m[1],u=u.slice(0,-b.length))}w||g.slice().reverse().forEach(m=>{if(!a.has(m))return;const k=p.get(m),T=this.getMarkClosing(m,k,l.get(m));T&&(u+=T),a.has(m)&&(a.delete(m),l.delete(m))});let y="";if(d.length>0){const m=u.match(/^(\s+)/);m&&(y=m[1],u=u.slice(y.length))}d.forEach(({type:m,mark:k})=>{const T=i.has(m)?"html":"markdown",A=this.getMarkOpening(m,k,T);A&&(u=A+u),l.set(m,T),i.delete(m)}),w||d.slice().reverse().forEach(({type:m,mark:k})=>{a.set(m,k)}),u=y+u;let v;if(w){const m=new Set((c?.marks||[]).map(A=>A.type));d.forEach(({type:A})=>{m.has(A)&&this.getHtmlReopenTags(A)&&i.add(A)});const k=Array.from(a.keys()),T=x.slice().sort((A,it)=>k.indexOf(it)-k.indexOf(A));v=[...d.map(A=>A.type),...T]}else v=dr(a,p,c,this.markSetsEqual.bind(this));let M="";if(v.length>0){const m=u.match(/(\s+)$/);m&&(M=m[1],u=u.slice(0,-M.length))}v.forEach(m=>{var k;const T=(k=a.get(m))!==null&&k!==void 0?k:p.get(m),A=this.getMarkClosing(m,T,l.get(m));A&&(u+=A),a.delete(m),l.delete(m)}),u+=M,u+=b,r.push(u)}else{const u=new Set((o.marks||[]).map(b=>b.type)),p=new Map,d=new Map;a.forEach((b,y)=>{if(u.has(y)){var v;p.set(y,b),d.set(y,(v=l.get(y))!==null&&v!==void 0?v:"markdown")}});const g=fr(a,(b,y)=>this.getMarkClosing(b,y,l.get(b)));l.clear();const x=this.renderNodeToMarkdown(o,e,h,s),w=o.type==="hardBreak"?"":gr(p,a,(b,y)=>{var v;const M=(v=d.get(b))!==null&&v!==void 0?v:"markdown";return l.set(b,M),this.getMarkOpening(b,y,M)});r.push(g+x+w)}}),r.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.open)||""}const r=this.getHandlersForNodeType(t),a=r.length>0?r[0]:void 0;if(!a||!a.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const o=a.renderMarkdown(l,{renderChildren:()=>i,renderChild:()=>i,indent:c=>c,wrapInBlock:(c,u)=>c+u},{index:0,level:0,parentType:"text",meta:{}}),h=o.indexOf(i);return h>=0?o.substring(0,h):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.close)||""}const r=this.getHandlersForNodeType(t),a=r.length>0?r[0]:void 0;if(!a||!a.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const o=a.renderMarkdown(l,{renderChildren:()=>i,renderChild:()=>i,indent:u=>u,wrapInBlock:(u,p)=>u+p},{index:0,level:0,parentType:"text",meta:{}}),h=o.indexOf(i),c=h+33;return h>=0?o.substring(c):""}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,s])=>{const r=e.get(n);return r&&G(s.attrs,r.attrs)})}getMarksToOpenForSerialization(t,e,n){const s=pr(t,e);if(s.length<=1)return s;const r=n?.marks||[],a=(h,c)=>r.some(u=>u.type===h&&G(u.attrs,c)),i=(h,c)=>{var u,p;const d=(u=this.extensionRanks.get(h.type))!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER,g=(p=this.extensionRanks.get(c.type))!==null&&p!==void 0?p:Number.MAX_SAFE_INTEGER;return d!==g?g-d:h.type.localeCompare(c.type)},l=s.filter(h=>!a(h.type,h.mark.attrs)).sort(i),o=s.filter(h=>a(h.type,h.mark.attrs)).sort(i);return[...l,...o]}};const yr=ue.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(Q(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(Q(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(Q(e,n?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContentAt(t,e,n);const s=this.editor.markdown.parse(e);return P.insertContentAt(t,s,n)}}},addStorage(){return{manager:new ze({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 ze({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||Q(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 Tr(t){const e=$.c(13),{node:n,selected:s,editor:r,deleteNode:a}=t,i=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",h=s&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let c;e[0]!==h?(c=B(Wt,"select-none",h),e[0]=h,e[1]=c):c=e[1];let u;e[2]!==a||e[3]!==r.isEditable||e[4]!==i?(u=r.isEditable&&f.jsx("button",{type:"button","aria-label":i("markdownEditor.removeFile"),onMouseDown:vr,onClick:a,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:f.jsx(Oe,{size:14})}),e[2]=a,e[3]=r.isEditable,e[4]=i,e[5]=u):u=e[5];let p;e[6]!==l||e[7]!==o||e[8]!==u?(p=f.jsx(Qt,{href:l,name:o,children:u}),e[6]=l,e[7]=o,e[8]=u,e[9]=p):p=e[9];let d;return e[10]!==c||e[11]!==p?(d=f.jsx(pe,{as:"span",className:c,children:p}),e[10]=c,e[11]=p,e[12]=d):d=e[12],d}function vr(t){return t.preventDefault()}function Sr(t){return t.replace(/([[\]])/g,"\\$1")}const Mr=Fe.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]",getAttrs:t=>Ge(t.getAttribute("href")??"")?null:!1}]},renderHTML({HTMLAttributes:t,node:e}){return["a",qe(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`[${Sr(n)}](${e})`},addNodeView(){return he(Tr)}});function Er(t){const e=$.c(6),{node:n,selected:s}=t,r=typeof n.attrs.name=="string"?n.attrs.name:"";let a;e[0]!==n.attrs.id||e[1]!==s?(a=B("select-none",Vt(typeof n.attrs.id=="string"?n.attrs.id:null),s&&"ring-2 ring-ring"),e[0]=n.attrs.id,e[1]=s,e[2]=a):a=e[2];let i;return e[3]!==r||e[4]!==a?(i=f.jsxs(pe,{as:"span","data-testid":"mention-chip",className:a,children:["@",r]}),e[3]=r,e[4]=a,e[5]=i):i=e[5],i}const Ar=Fe.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",qe(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?Xt(e,n):`@${n}`},addNodeView(){return he(Er)}}),Rr="studio.mention-members.",ce=new Map;function Pe(t){const e=ce.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const s=JSON.parse(n);if(!Array.isArray(s))return;const r=s.filter(a=>!!a&&typeof a.id=="string"&&typeof a.name=="string");return ce.set(t,r),r}catch{return}}function _r(t,e){ce.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function $r(t,e){if(!t?.length)return e;const n=new Map(t.map(s=>[s.id,s]));return e.map(s=>{const r=n.get(s.id);return r&&r.name===s.name&&r.email===s.email&&r.image===s.image?r:s})}function Cr(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 Lr(t){const e=$.c(17),{locator:n}=ot(),s=lt(),r=`${Rr}${n}`;let a;e[0]!==n?(a=ut.mentionMembers(n),e[0]=n,e[1]=a):a=e[1];let i;e[2]!==r?(i=()=>Pe(r),e[2]=r,e[3]=i):i=e[3];let l;e[4]!==s||e[5]!==r?(l=async()=>{const d=await s.organization.listMembers(),g=$r(Pe(r),Cr(d?.data?.members??[]));return _r(r,g),g},e[4]=s,e[5]=r,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==a||e[9]!==i||e[10]!==l?(o={queryKey:a,enabled:t,staleTime:0,placeholderData:i,queryFn:l},e[7]=t,e[8]=a,e[9]=i,e[10]=l,e[11]=o):o=e[11];const h=ct(o);let c;e[12]!==h.data?(c=h.data??[],e[12]=h.data,e[13]=c):c=e[13];const u=h.isFetching&&!h.data;let p;return e[14]!==c||e[15]!==u?(p={members:c,loading:u},e[14]=c,e[15]=u,e[16]=p):p=e[16],p}const je={query:"",range:null,rect:null,editor:null};class Ir{state=je;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(je)}}const Te=new Be("markdownEditorMention");function zr(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),Ue(t.view,Te)}function Pr(t,e,n){const s=Math.min(e+n,t.content.size);return e>=s?"":t.textBetween(e,s,"","")}function st(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,"")}),Ue(t.view,Te)}function jr(t){return ue.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Te,allowedPrefixes:[" ",`
67
+ `],allow:({state:n,range:s})=>{const r=t.dismissal;return r?s.from===r.from&&Pr(n.doc,r.from,r.text.length)===r.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"?(st(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Ct(e)]}})}const Ne=256,Nr=40,He=280,Hr=140,Or=[];function Dr(t){const e=$.c(5),{store:n,agents:s}=t,r=s===void 0?Or:s,a=_.useSyncExternalStore(n.subscribe,n.getSnapshot),i=a.range!==null;let l;return e[0]!==r||e[1]!==i||e[2]!==a||e[3]!==n?(l=i?f.jsx(Br,{store:n,state:a,agents:r}):null,e[0]=r,e[1]=i,e[2]=a,e[3]=n,e[4]=l):l=e[4],l}function Br({store:t,state:e,agents:n}){const s=j(),{members:r,loading:a}=Lr(!0),[i,l]=_.useState(e.query),[o,h]=_.useState(null),c=Fr(e.editor),u=c.getBoundingClientRect(),p=c===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):u,d=e.rect?.()??new DOMRect(0,0,0,0),g=p.bottom-d.bottom,x=g<He&&d.top-p.top>g,w=(x?d.top-p.top:g)-8,b=Math.min(He,Math.max(w,Hr))-Nr,y={position:"absolute",width:Ne,left:Math.min(d.left,p.right-Ne-8)-u.left,...x?{bottom:u.bottom-d.top+6}:{top:d.bottom-u.top+6}},v=()=>{e.editor&&st(e.editor,t),t.close()},M=k=>{const T=k.relatedTarget;if((!T||e.editor?.view.dom.contains(T)===!0)&&t.latched){o?.focus();return}v()},m=k=>{!e.editor||!e.range||(zr(e.editor,e.range,k),t.close())};return ht.createPortal(f.jsx("div",{style:y,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg bg-popover shadow-soft",children:f.jsxs(tn,{onKeyDown:k=>{k.key==="Escape"&&(k.preventDefault(),v(),e.editor?.commands.focus())},children:[f.jsx(nn,{ref:h,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:l,placeholder:s("markdownEditor.mentionSearch"),onBlur:M}),f.jsxs(rn,{style:{maxHeight:b},children:[a?f.jsx("div",{className:"flex items-center justify-center py-6",children:f.jsx(De,{size:"sm"})}):f.jsx(sn,{children:s("markdownEditor.mentionEmpty")}),n.map(k=>f.jsxs(Ee,{value:k.name,onSelect:()=>m(k),onMouseDown:T=>T.preventDefault(),className:"gap-2",children:[k.icon,f.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.name})]},k.id)),r.map(k=>f.jsxs(Ee,{value:`${k.name} ${k.email}`,onSelect:()=>m(k),onMouseDown:T=>T.preventDefault(),className:"gap-2",children:[f.jsx(pt,{url:k.image??void 0,fallback:k.name??"?",shape:"circle",size:"xs"}),f.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.name})]},k.id))]})]})}),c)}function Fr(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}function qr(t){const e=$.c(16),{node:n,selected:s,editor:r,deleteNode:a}=t,i=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let h;e[0]!==o||e[1]!==i?(h=o||i("markdownEditor.imageAltFallback"),e[0]=o,e[1]=i,e[2]=h):h=e[2];const c=s&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let u;e[3]!==c?(u=B("max-h-[420px] max-w-full rounded-lg border border-border object-contain",c),e[3]=c,e[4]=u):u=e[4];let p;e[5]!==l||e[6]!==h||e[7]!==u?(p=f.jsx("img",{src:l,alt:h,draggable:!1,className:u}),e[5]=l,e[6]=h,e[7]=u,e[8]=p):p=e[8];let d;e[9]!==a||e[10]!==r.isEditable||e[11]!==i?(d=r.isEditable&&f.jsx("button",{type:"button","aria-label":i("markdownEditor.removeImage"),onMouseDown:Ur,onClick:a,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg bg-card text-muted-foreground opacity-0 shadow-edge transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:f.jsx(Oe,{size:14})}),e[9]=a,e[10]=r.isEditable,e[11]=i,e[12]=d):d=e[12];let g;return e[13]!==p||e[14]!==d?(g=f.jsxs(pe,{className:"group/image relative my-3 w-fit max-w-full",children:[p,d]}),e[13]=p,e[14]=d,e[15]=g):g=e[15],g}function Ur(t){return t.preventDefault()}const Zr=Yt.extend({addNodeView(){return he(qr)}}).configure({inline:!1,allowBase64:!1}),Gr={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},Kr=Tt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Ge(n))return e.createNode("attachment",{href:n,name:t.text??""});const s=Jt(n);return s?e.createNode("mention",{id:s,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function Wr(t="",e){return[St.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),Kr.configure(Gr),Lt.configure({placeholder:t}),en,vt,Mt.configure({nested:!0}),Zr,Mr,mn,Ar,...e?[jr(e)]:[],yr.configure({markedOptions:{breaks:!0}})]}const Qr=/^(\s*)([-*+]|\d+[.)])\s+\S/,Xr=/^\s*(```|~~~)/,Vr=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Jr(t){const e=[];let n=!1,s=!1;for(const r of t.split(`
68
68
  `)){if(Xr.test(r)){n=!n,s=!1,e.push(r);continue}if(n){e.push(r);continue}if(Qr.test(r)){s=!0,e.push(r);continue}if(!r.trim()){s=!1,e.push(r);continue}if(s&&Vr.test(r)){e[e.length-1]=`${e[e.length-1]} ${r.trim()}`;continue}s=!1,e.push(r)}return e.join(`
69
- `)}function Yr(t){const e=$.c(12),{onFiles:n,disabled:s}=t,r=j(),a=_.useRef(null);let i;e[0]!==r?(i=r("markdownEditor.attachFile"),e[0]=r,e[1]=i):i=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>a.current?.click(),o=f.jsx(Bt,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let h;e[4]!==s||e[5]!==i?(h=f.jsx(an,{type:"button",label:i,disabled:s,onClick:l,children:o}),e[4]=s,e[5]=i,e[6]=h):h=e[6];let c;e[7]!==n?(c=f.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:p=>{const d=Array.from(p.target.files??[]);p.target.value="",d.length>0&&n(d)}}),e[7]=n,e[8]=c):c=e[8];let u;return e[9]!==h||e[10]!==c?(u=f.jsxs(f.Fragment,{children:[h,c]}),e[9]=h,e[10]=c,e[11]=u):u=e[11],u}function es(t){const e=$.c(6),{pending:n}=t,s=j();if(n===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=f.jsx(De,{className:"size-3"}),e[0]=r):r=e[0];let a;e[1]!==n||e[2]!==s?(a=n===1?s("markdownEditor.uploading"):s("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=s,e[3]=a):a=e[3];let i;return e[4]!==a?(i=f.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[r,a]}),e[4]=a,e[5]=i):i=e[5],i}const ts=["outline-none","[&>*: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-sm","[&_pre_code]:bg-transparent [&_pre_code]:p-0",$t,"[&_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(" "),ns=["[&_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 rs(t){const e=$.c(10),{editor:n,mentions:s}=t,r=s.items;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["markdown-editor-mentions"],e[0]=a):a=e[0];let i;e[1]!==r?(i=h=>{const{query:c}=h,u=c.trim().toLowerCase();return Promise.resolve(u?r.filter(p=>`${p.name} ${p.title??""}`.toLowerCase().includes(u)):r)},e[1]=r,e[2]=i):i=e[2];let l;e[3]!==n?(l=h=>{const{range:c,item:u}=h;n.chain().focus().insertContentAt(c,[{type:"text",text:`@${u.name}`,marks:u.href?[{type:"link",attrs:{href:u.href}}]:void 0},{type:"text",text:" "}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==s.emptyLabel||e[7]!==i||e[8]!==l?(o=f.jsx(It,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:a,queryFn:i,emptyLabel:s.emptyLabel,renderItem:ss,onSelect:l}),e[5]=n,e[6]=s.emptyLabel,e[7]=i,e[8]=l,e[9]=o):o=e[9],o}function ss(t){return f.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[f.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&f.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function xs({defaultValue:t,onChange:e,placeholder:n,editable:s=!0,attachments:r=!0,mentions:a,inline:i=!1}){const l=wn(r),[o]=_.useState(()=>new Ir),h=_.useRef(e);h.current=e;const c=Et({extensions:Wr(n,a?void 0:o),content:Jr(t),contentType:"markdown",editable:s,autofocus:i?"end":!1,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:B(ts,!i&&"min-h-[200px] sm:min-h-[320px]",ns)},handlePaste:l.handlePaste,handleDrop:l.handleDrop},onUpdate:({editor:u,transaction:p})=>{p.docChanged&&h.current(u.getMarkdown())}});return c?f.jsxs("div",{className:"flex flex-col",children:[f.jsx(cn,{editor:c}),!a&&f.jsx(Dr,{store:o}),f.jsx(At,{editor:c,className:B(i?"text-sm text-foreground":"text-base text-muted-foreground")}),s&&a&&f.jsx(rs,{editor:c,mentions:a}),f.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[s&&a?.hint&&f.jsx("span",{children:a.hint}),s&&r&&f.jsx(Yr,{onFiles:u=>l.uploadInto(c.view,u,c.state.selection.to)}),f.jsx(es,{pending:l.pending})]})]}):null}export{Yr as A,Ir as M,mn as U,Ar as a,yr as b,Gr as c,Mr as d,Te as e,Dr as f,es as g,xs as h,jr as m,wn as u};
69
+ `)}function Yr(t){const e=$.c(12),{onFiles:n,disabled:s}=t,r=j(),a=_.useRef(null);let i;e[0]!==r?(i=r("markdownEditor.attachFile"),e[0]=r,e[1]=i):i=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>a.current?.click(),o=f.jsx(Bt,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let h;e[4]!==s||e[5]!==i?(h=f.jsx(an,{type:"button",label:i,disabled:s,onClick:l,children:o}),e[4]=s,e[5]=i,e[6]=h):h=e[6];let c;e[7]!==n?(c=f.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:p=>{const d=Array.from(p.target.files??[]);p.target.value="",d.length>0&&n(d)}}),e[7]=n,e[8]=c):c=e[8];let u;return e[9]!==h||e[10]!==c?(u=f.jsxs(f.Fragment,{children:[h,c]}),e[9]=h,e[10]=c,e[11]=u):u=e[11],u}function es(t){const e=$.c(6),{pending:n}=t,s=j();if(n===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=f.jsx(De,{className:"size-3"}),e[0]=r):r=e[0];let a;e[1]!==n||e[2]!==s?(a=n===1?s("markdownEditor.uploading"):s("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=s,e[3]=a):a=e[3];let i;return e[4]!==a?(i=f.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[r,a]}),e[4]=a,e[5]=i):i=e[5],i}const ts=["outline-none","[&>*: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-sm","[&_pre_code]:bg-transparent [&_pre_code]:p-0",$t,"[&_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(" "),ns=["[&_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 rs(t){const e=$.c(10),{editor:n,mentions:s}=t,r=s.items;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["markdown-editor-mentions"],e[0]=a):a=e[0];let i;e[1]!==r?(i=h=>{const{query:c}=h,u=c.trim().toLowerCase();return Promise.resolve(u?r.filter(p=>`${p.name} ${p.title??""}`.toLowerCase().includes(u)):r)},e[1]=r,e[2]=i):i=e[2];let l;e[3]!==n?(l=h=>{const{range:c,item:u}=h;n.chain().focus().insertContentAt(c,[{type:"text",text:`@${u.name}`,marks:u.href?[{type:"link",attrs:{href:u.href}}]:void 0},{type:"text",text:" "}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==s.emptyLabel||e[7]!==i||e[8]!==l?(o=f.jsx(It,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:a,queryFn:i,emptyLabel:s.emptyLabel,renderItem:ss,onSelect:l}),e[5]=n,e[6]=s.emptyLabel,e[7]=i,e[8]=l,e[9]=o):o=e[9],o}function ss(t){return f.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[f.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&f.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function xs({defaultValue:t,onChange:e,placeholder:n,editable:s=!0,attachments:r=!0,mentions:a,inline:i=!1}){const l=wn(r),[o]=_.useState(()=>new Ir),h=_.useRef(e);h.current=e;const c=Et({extensions:Wr(n,a?void 0:o),content:Jr(t),contentType:"markdown",editable:s,autofocus:i?"end":!1,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:B(ts,!i&&"min-h-[200px] sm:min-h-[320px]",ns)},handlePaste:l.handlePaste,handleDrop:l.handleDrop},onUpdate:({editor:u,transaction:p})=>{p.docChanged&&h.current(u.getMarkdown())}});return c?f.jsxs("div",{className:"flex flex-col",children:[f.jsx(cn,{editor:c}),!a&&f.jsx(Dr,{store:o}),f.jsx(At,{editor:c,className:B(i?"text-sm text-foreground":"text-base text-muted-foreground")}),s&&a&&f.jsx(rs,{editor:c,mentions:a}),f.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[s&&a?.hint&&f.jsx("span",{children:a.hint}),s&&r&&f.jsx(Yr,{onFiles:u=>l.uploadInto(c.view,u,c.state.selection.to)}),f.jsx(es,{pending:l.pending})]})]}):null}export{Yr as A,Ir as M,mn as U,Ar as a,yr as b,Zr as c,Mr as d,Te as e,Dr as f,es as g,xs as h,jr as m,wn as u};