decocms 4.425.0 → 4.425.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/dist/client/assets/{AlertCircle-CQU3FO2-.js → AlertCircle-DsOSKvzV.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Caz7K4-P.js → AreaChart-DtLzG-fG.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-r9k0gxde.js → ArrowLeft-2lm_J3QC.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CJiUKB0e.js → ArrowRight-A-Nw2bpi.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-D1uaoIEr.js → ArrowUp-CAUQitV-.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-CsM3ceFL.js → CartesianChart-DpAzR_jq.js} +1 -1
  7. package/dist/client/assets/{Check-soPAeKca.js → Check-CMF2Ywph.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-BdRkKVcj.js → CheckCircle-Brn-seMk.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-B4upaCys.js → ChevronUp-D_quOjFH.js} +1 -1
  10. package/dist/client/assets/{Copy01-Ck1CQt9c.js → Copy01-Dd4ky6ZP.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-C5LQldm8.js → CreditCard01-DFpHESd1.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DMsZySzr.js → DotsVertical-kOg4pODr.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-bwtijj2s.js → ErrorBarContext-3WQQZLF0.js} +1 -1
  14. package/dist/client/assets/{Image01-AxefwT4b.js → Image01-BdsDNVox.js} +1 -1
  15. package/dist/client/assets/{Key01-V9W0a2Yy.js → Key01-BUAFoCLq.js} +1 -1
  16. package/dist/client/assets/{Line-CPF3zU9K.js → Line-BuTAHyrm.js} +1 -1
  17. package/dist/client/assets/{Link01-C9tHLmLh.js → Link01-CMEXeVpO.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-CkkaHQ43.js → LinkExternal01-ZFH-yoZN.js} +1 -1
  19. package/dist/client/assets/{Monitor01-DYA_QMf2.js → Monitor01-C2krU25E.js} +1 -1
  20. package/dist/client/assets/{Palette-Bk3UCvKx.js → Palette-D5d1Mblr.js} +1 -1
  21. package/dist/client/assets/{Plus-kHt_8stA.js → Plus-Dc5RtznQ.js} +1 -1
  22. package/dist/client/assets/{SearchMd-DFB2ha4T.js → SearchMd-B30D9ndg.js} +1 -1
  23. package/dist/client/assets/{Sector-D22gYKYq.js → Sector-64WXTvD4.js} +1 -1
  24. package/dist/client/assets/{ShoppingBag01-IkLiZTCG.js → ShoppingBag01-DouihxuQ.js} +1 -1
  25. package/dist/client/assets/{Sun-CttdH4aG.js → Sun-CepnW0AC.js} +1 -1
  26. package/dist/client/assets/{Tool01-BVUW3itu.js → Tool01-gx1zwKcn.js} +1 -1
  27. package/dist/client/assets/{Trash01-CKOL_3ja.js → Trash01-DliBU2bP.js} +1 -1
  28. package/dist/client/assets/{Upload01-DlR8CSo4.js → Upload01-CQpa1a9n.js} +1 -1
  29. package/dist/client/assets/{User01-dc7WIl5M.js → User01-Dd4e-mIA.js} +1 -1
  30. package/dist/client/assets/{UserSquare-D1bS09Fm.js → UserSquare-DcFHmf0l.js} +1 -1
  31. package/dist/client/assets/{Users01-BaIVzoZ3.js → Users01-BYc5DjwP.js} +1 -1
  32. package/dist/client/assets/{X-Dp6J1NZk.js → X-AdrRw9Zp.js} +1 -1
  33. package/dist/client/assets/{XAxis-B8-Lgf5y.js → XAxis-hKxnHq9P.js} +1 -1
  34. package/dist/client/assets/{XClose-CVE8Vs6Q.js → XClose-DXJf2S1e.js} +1 -1
  35. package/dist/client/assets/{ZoomOut-ekFDVqJi.js → ZoomOut-Bqjt8gJB.js} +1 -1
  36. package/dist/client/assets/{access-gate-DVZHCUBi.js → access-gate-DTSTiQp3.js} +1 -1
  37. package/dist/client/assets/{add-connection-dialog-B-zUvMaq.js → add-connection-dialog-CjgmjJ6J.js} +1 -1
  38. package/dist/client/assets/agent-analytics-fW6DiN0D.js +2 -0
  39. package/dist/client/assets/agent-app-DRnmexWH.js +1 -0
  40. package/dist/client/assets/agent-assets-B6OCthBz.js +1 -0
  41. package/dist/client/assets/{agent-automation-Bj4sGNvm.js → agent-automation-D7w4sgBL.js} +2 -2
  42. package/dist/client/assets/agent-automations-VE77sb9q.js +1 -0
  43. package/dist/client/assets/agent-connect-sources-CR98SBRp.js +1 -0
  44. package/dist/client/assets/agent-deck-BLtrAz-G.js +1 -0
  45. package/dist/client/assets/agent-e2e-Ci2-1Esx.js +1 -0
  46. package/dist/client/assets/agent-experiments-D6lI5uOj.js +1 -0
  47. package/dist/client/assets/agent-file-B4Bf8NCP.js +1 -0
  48. package/dist/client/assets/{agent-git-BcKeYOTv.js → agent-git-AczEwwiL.js} +2 -2
  49. package/dist/client/assets/agent-hosting-C6G_0vSx.js +1 -0
  50. package/dist/client/assets/{agent-icon-C8wu-T9B.js → agent-icon-B1JUa-pK.js} +1 -1
  51. package/dist/client/assets/agent-library-E0JwHCSU.js +1 -0
  52. package/dist/client/assets/agent-library-file-D_y5O75S.js +1 -0
  53. package/dist/client/assets/agent-monitor-Dzcb37so.js +1 -0
  54. package/dist/client/assets/agent-overview-DCqvGj5y.js +1 -0
  55. package/dist/client/assets/agent-settings-CMwvE0uk.js +1 -0
  56. package/dist/client/assets/{agent-site-editor-BManvh2p.js → agent-site-editor-X06x49vI.js} +2 -2
  57. package/dist/client/assets/agent-site-editor-code-DJgbb6tV.js +2 -0
  58. package/dist/client/assets/{agent-site-editor-content-DVWOt-Lp.js → agent-site-editor-content-DQrj-VH4.js} +3 -3
  59. package/dist/client/assets/{agent-site-editor-preview-DqrFB9eA.js → agent-site-editor-preview-BrzBbshQ.js} +3 -3
  60. package/dist/client/assets/{agent-view-guard-DP6rr7-6.js → agent-view-guard-CjENDk5e.js} +1 -1
  61. package/dist/client/assets/agent-view-xIFnsvl0.js +1 -0
  62. package/dist/client/assets/{agents-list-BHJZEiO4.js → agents-list-C33TJcHC.js} +1 -1
  63. package/dist/client/assets/{ai-providers-BU1J8_R5.js → ai-providers-ZZ74aECC.js} +1 -1
  64. package/dist/client/assets/{alert-B_aVDXWu.js → alert-BKTGsFI8.js} +1 -1
  65. package/dist/client/assets/{alert-dialog-DJcNPQjm.js → alert-dialog-CIK2aHDv.js} +1 -1
  66. package/dist/client/assets/{analytics-sections-BXAEbLgR.js → analytics-sections-BZtSP0aA.js} +1 -1
  67. package/dist/client/assets/api-keys-D6HBMlIA.js +1 -0
  68. package/dist/client/assets/{api-keys-yyXIMQJI.js → api-keys-Kd3P9EQb.js} +1 -1
  69. package/dist/client/assets/app-editor-TQLa1Eqc.js +1 -0
  70. package/dist/client/assets/{asset-utils-BV839mqx.js → asset-utils-vxXtnPR8.js} +1 -1
  71. package/dist/client/assets/{auth-i4uSZxqM.js → auth-DS4Lo40d.js} +1 -1
  72. package/dist/client/assets/{auth-catchall-B38U7kv-.js → auth-catchall-DQwnE0NC.js} +1 -1
  73. package/dist/client/assets/{auth-entry-CKSK4iYs.js → auth-entry-DEh9VZst.js} +1 -1
  74. package/dist/client/assets/{auth-split-layout-D02-xSkU.js → auth-split-layout-DXgubjLw.js} +1 -1
  75. package/dist/client/assets/{authenticate-and-persist-oauth-D-PqEdfN.js → authenticate-and-persist-oauth-l_mXF0Cq.js} +1 -1
  76. package/dist/client/assets/{automation-list-row-Cj0lVdtQ.js → automation-list-row-DfjGMZpb.js} +1 -1
  77. package/dist/client/assets/{automation-runs-BNfzkXtY.js → automation-runs-CJ4TbZzx.js} +1 -1
  78. package/dist/client/assets/{automations-CcA3VvLO.js → automations-ELL00rba.js} +1 -1
  79. package/dist/client/assets/{autosend-BgamBAXS.js → autosend-C7EnJZLv.js} +1 -1
  80. package/dist/client/assets/{avatar-By9-J1G7.js → avatar-D5EBeZdt.js} +1 -1
  81. package/dist/client/assets/{badge-BLmau0Ea.js → badge-C7LZnr1G.js} +1 -1
  82. package/dist/client/assets/{block-document-DNf3E-rZ.js → block-document-mPXjkoGO.js} +1 -1
  83. package/dist/client/assets/{blocks-preview-workspace-context-Dp3GVv9B.js → blocks-preview-workspace-context-D2DgzWT_.js} +1 -1
  84. package/dist/client/assets/{buckets-CfOh79gF.js → buckets-CpKCcO2O.js} +1 -1
  85. package/dist/client/assets/{build-improve-prompt-doc-bnw-geKz.js → build-improve-prompt-doc-BA847z9G.js} +1 -1
  86. package/dist/client/assets/{calendar-C_3zvYnn.js → calendar-yvfvBAzS.js} +1 -1
  87. package/dist/client/assets/{capability-load-error-_sxFuxMW.js → capability-load-error-DwYWnWZk.js} +1 -1
  88. package/dist/client/assets/category-editor-BO67rgf7.js +1 -0
  89. package/dist/client/assets/{chart-DUDR_GLh.js → chart-Dv1JamW3.js} +1 -1
  90. package/dist/client/assets/{chat-context-DSOY14Dl.js → chat-context-fDVt7FJu.js} +1 -1
  91. package/dist/client/assets/{chat-draft-Db3gWleH.js → chat-draft-ldhGGrhS.js} +1 -1
  92. package/dist/client/assets/{checkbox-YgstniWn.js → checkbox-DKFzy_UI.js} +1 -1
  93. package/dist/client/assets/{choose-editor-Cvv0YS80.js → choose-editor-cP_2mN1n.js} +1 -1
  94. package/dist/client/assets/{claim-phase-copy-Byy3Q6us.js → claim-phase-copy-DAgG3vfo.js} +1 -1
  95. package/dist/client/assets/{cli-auth-success-CF33WEDl.js → cli-auth-success-D-t1ynTi.js} +1 -1
  96. package/dist/client/assets/{client-icons-3lGatXeB.js → client-icons-BXC5XYwX.js} +1 -1
  97. package/dist/client/assets/{collapsible-Pi90xi-e.js → collapsible-aZePgHKd.js} +1 -1
  98. package/dist/client/assets/{collection-detail-DHdecaB7.js → collection-detail-B6UBhveh.js} +1 -1
  99. package/dist/client/assets/{collection-display-button-Cb5VEBCx.js → collection-display-button-DwhCq88V.js} +1 -1
  100. package/dist/client/assets/{collection-search-CZPfBwnt.js → collection-search-CBSxLm5u.js} +1 -1
  101. package/dist/client/assets/{collection-table-wrapper-CR8wWqYX.js → collection-table-wrapper-uO2T9X8L.js} +1 -1
  102. package/dist/client/assets/{collection-tabs-CDyR4kzk.js → collection-tabs-DIB_pPlJ.js} +1 -1
  103. package/dist/client/assets/{combobox-BIrYGyuF.js → combobox-VNs66YBC.js} +1 -1
  104. package/dist/client/assets/{command-DxWpNp1x.js → command-BaUKjhoV.js} +1 -1
  105. package/dist/client/assets/{companion-mcps-section-BT3BpapS.js → companion-mcps-section-he2WjNhc.js} +1 -1
  106. package/dist/client/assets/{config-BfXHrI3c.js → config-DJlvAMtq.js} +1 -1
  107. package/dist/client/assets/{connect-BaV0v-Tu.js → connect-BzB4yRL7.js} +1 -1
  108. package/dist/client/assets/{connect-layout-BUm5geCN.js → connect-layout-DHjsvqYK.js} +1 -1
  109. package/dist/client/assets/{connection-sgm4TBxZ.js → connection-CnIXOjL9.js} +1 -1
  110. package/dist/client/assets/{connection-card-KlghLDwU.js → connection-card-Y1Y6409W.js} +1 -1
  111. package/dist/client/assets/{connection-detail-DclD8xq_.js → connection-detail-DryX9zB1.js} +1 -1
  112. package/dist/client/assets/{connection-form-helpers-i009QpGu.js → connection-form-helpers-abhaYYBG.js} +1 -1
  113. package/dist/client/assets/{connections-_X80BGGI.js → connections-CcwW96QT.js} +1 -1
  114. package/dist/client/assets/context--OKYBRk9.js +1 -0
  115. package/dist/client/assets/{create-organization-dialog-DhSGIMf_.js → create-organization-dialog-hS_wxzxv.js} +1 -1
  116. package/dist/client/assets/{decopilot-ZxSRkfiB.js → decopilot-BBx7_EFV.js} +1 -1
  117. package/dist/client/assets/{dialog-1dafL4bi.js → dialog-BgtCSZyf.js} +1 -1
  118. package/dist/client/assets/discover-DGG2hRLO.js +1 -0
  119. package/dist/client/assets/{domain-settings-CGpwkGbK.js → domain-settings-CVryaoxH.js} +1 -1
  120. package/dist/client/assets/{download-app-dialog-BcCXsaD8.js → download-app-dialog-BRX0Ra47.js} +1 -1
  121. package/dist/client/assets/{drawer-wrrjDRlR.js → drawer-BvFRhiv1.js} +1 -1
  122. package/dist/client/assets/{editor-BiYdYoAb.js → editor-DuOWmHoR.js} +1 -1
  123. package/dist/client/assets/{empty-state-Ck9uwtW-.js → empty-state-DB_SzRO6.js} +1 -1
  124. package/dist/client/assets/{empty-state-LYCOTuMl.js → empty-state-DKbbnCTb.js} +1 -1
  125. package/dist/client/assets/{extract-connection-data-Cm7kjryi.js → extract-connection-data-BRwBq3vf.js} +1 -1
  126. package/dist/client/assets/{feature-gate-VDho3P9i.js → feature-gate-BAIgZZXB.js} +1 -1
  127. package/dist/client/assets/{feature-paywall-O59PQJQ4.js → feature-paywall-Cwbvr67l.js} +1 -1
  128. package/dist/client/assets/{file-explorer-M_603rD8.js → file-explorer-CvMyNQBS.js} +1 -1
  129. package/dist/client/assets/{file-preview-DNv-TeY5.js → file-preview-OVrIjHIJ.js} +1 -1
  130. package/dist/client/assets/{file-share-button-CcJT8SCR.js → file-share-button-BoRqU7Iz.js} +1 -1
  131. package/dist/client/assets/{file-type-icon-buBDg-03.js → file-type-icon-Cejgy7H6.js} +1 -1
  132. package/dist/client/assets/flat-project-bym3Cc-H.js +1 -0
  133. package/dist/client/assets/{folder-icon-Da9ULcDI.js → folder-icon-CbqDLq4k.js} +1 -1
  134. package/dist/client/assets/{form-D5LPXjPj.js → form-Bwkg8Jqa.js} +1 -1
  135. package/dist/client/assets/{gateway-client-CeKj8qiL.js → gateway-client-DFxhiMGP.js} +1 -1
  136. package/dist/client/assets/{general-BPN087Lc.js → general-B4Sba9xG.js} +1 -1
  137. package/dist/client/assets/home-BrA_nbiq.js +1 -0
  138. package/dist/client/assets/index-6m6OXOoa.css +1 -0
  139. package/dist/client/assets/{index-H2LrQn17.js → index-B0GFQJYa.js} +1 -1
  140. package/dist/client/assets/{index-Ct9y-yVl.js → index-B9N7VFXz.js} +1 -1
  141. package/dist/client/assets/{index-CY8bQG9C.js → index-BXGaeoRo.js} +1 -1
  142. package/dist/client/assets/{index-DJzoBp2L.js → index-BqvCOs8v.js} +1 -1
  143. package/dist/client/assets/{index-D5-xqq3P.js → index-BzEAzC8-.js} +1 -1
  144. package/dist/client/assets/{index-D8akGTh4.js → index-C1l5ueXX.js} +1 -1
  145. package/dist/client/assets/{index-w4vR7oJd.js → index-CeJmvQn1.js} +3 -3
  146. package/dist/client/assets/{index-LgfzCRc4.js → index-D2sx2hj-.js} +1 -1
  147. package/dist/client/assets/{index-DFK3AqOd.js → index-D6WmSRmP.js} +1 -1
  148. package/dist/client/assets/{index-D3__nJJk.js → index-DJT_L8S6.js} +1 -1
  149. package/dist/client/assets/{index-CeFrI_-f.js → index-DUoAE5ST.js} +8 -8
  150. package/dist/client/assets/{index-D88JS0Yx.js → index-Ddpg7S6U.js} +1 -1
  151. package/dist/client/assets/{index-MebkKt8H.js → index-Dvm5L9kf.js} +1 -1
  152. package/dist/client/assets/{index-CBLynFUh.js → index-T9qmd0M1.js} +1 -1
  153. package/dist/client/assets/{index-redirect-DNJpUKHR.js → index-redirect-B7v6IA8J.js} +1 -1
  154. package/dist/client/assets/{index-Do5wILaI.js → index-t3GQvgTK.js} +1 -1
  155. package/dist/client/assets/{infiniteQueryObserver-DX9QHkGe.js → infiniteQueryObserver-boyhd8Uv.js} +1 -1
  156. package/dist/client/assets/{infra-billing-CJc_xWtO.js → infra-billing-CFIs1f7C.js} +1 -1
  157. package/dist/client/assets/{input-C2XryqlS.js → input-2vHFydNN.js} +1 -1
  158. package/dist/client/assets/{input-BLNFqzUM.js → input-Je7SXM19.js} +3 -3
  159. package/dist/client/assets/{input-CQlMbJrR.js → input-yIPgkwGw.js} +1 -1
  160. package/dist/client/assets/{integration-icon-60YSBd47.js → integration-icon-DsxYi58j.js} +1 -1
  161. package/dist/client/assets/{label-CTaphTs2.js → label-B5D3oXM0.js} +1 -1
  162. package/dist/client/assets/{last-preview-page-vt2OtvKU.js → last-preview-page-DiM8XiC2.js} +1 -1
  163. package/dist/client/assets/{layout-COlkqmIQ.js → layout-DzG-pOmM.js} +1 -1
  164. package/dist/client/assets/{legacy-agents-deep-Ctzjouqt.js → legacy-agents-deep-BhJ-RJKs.js} +1 -1
  165. package/dist/client/assets/{legacy-main-redirect-BaZYUmuc.js → legacy-main-redirect-k4k6oSNR.js} +1 -1
  166. package/dist/client/assets/library-C9HSbHdS.js +1 -0
  167. package/dist/client/assets/{library-tab-D4iQdrlE.js → library-tab-C3VxGFW1.js} +1 -1
  168. package/dist/client/assets/{login-QNIhU9dz.js → login-DJ6MsBjC.js} +1 -1
  169. package/dist/client/assets/{markdown-Ck-11dhN.js → markdown-Cuay45B5.js} +1 -1
  170. package/dist/client/assets/{mcp-app-renderer-BemaHPoe.js → mcp-app-renderer-Bz2q_atZ.js} +1 -1
  171. package/dist/client/assets/{mcp-oauth-DA7uY-37.js → mcp-oauth-BH0jXemG.js} +1 -1
  172. package/dist/client/assets/{members-BEhHXB0V.js → members-Ap41EyVo.js} +1 -1
  173. package/dist/client/assets/{message-templates-CX1OJ7C8.js → message-templates-X_EVv61O.js} +1 -1
  174. package/dist/client/assets/{mini-report-page-s_c2MmRH.js → mini-report-page-bRBLtGfH.js} +1 -1
  175. package/dist/client/assets/{mock-board-DPOuVqy_.js → mock-board-CYjTVJug.js} +1 -1
  176. package/dist/client/assets/{monaco-editor-CyLZqoPt.js → monaco-editor-BBA-2xe3.js} +1 -1
  177. package/dist/client/assets/{monitoring-stats-row-pkJdXLku.js → monitoring-stats-row-CjCgF20M.js} +1 -1
  178. package/dist/client/assets/{multi-select-CtEcT2Fm.js → multi-select-X-tz_9Eq.js} +1 -1
  179. package/dist/client/assets/{mustache-BIygiTUj.js → mustache-BgYmPFKE.js} +1 -1
  180. package/dist/client/assets/{new-project-dialog-BJkFsBCH.js → new-project-dialog-utK5AYOj.js} +1 -1
  181. package/dist/client/assets/{oauth-callback-DLIV3MGz.js → oauth-callback-C0ONc_Lk.js} +1 -1
  182. package/dist/client/assets/{oauth-callback-ai-provider-r46g0CGE.js → oauth-callback-ai-provider-E9B5w96T.js} +1 -1
  183. package/dist/client/assets/{onboarding-BdNB509_.js → onboarding-qhebZmKN.js} +1 -1
  184. package/dist/client/assets/openai-conversation-BaDnTpHn.js +3 -0
  185. package/dist/client/assets/{optimistic-project-sidebar-views-CTxHKwky.js → optimistic-project-sidebar-views-Bz7bGQe2.js} +1 -1
  186. package/dist/client/assets/{org-file-open-context-CNhQ4sPa.js → org-file-open-context-BJfMfMA3.js} +1 -1
  187. package/dist/client/assets/{organization-choice-ClD3tqal.js → organization-choice-Ogfn3N9-.js} +1 -1
  188. package/dist/client/assets/{orgs-bdVnOGJG.js → orgs-DUk_RkTf.js} +1 -1
  189. package/dist/client/assets/{page-seo-form-B0GpL4jq.js → page-seo-form-BbLnwvLC.js} +1 -1
  190. package/dist/client/assets/{pair-BqbLIj1t.js → pair-9c3wI9G4.js} +1 -1
  191. package/dist/client/assets/{plan-ladder-HHjxIVXp.js → plan-ladder-C5HBBt9O.js} +1 -1
  192. package/dist/client/assets/{popover-Dp4MK1ls.js → popover-LjbxD4kl.js} +1 -1
  193. package/dist/client/assets/post-calendar-BZuYHwNt.js +1 -0
  194. package/dist/client/assets/{post-editor-C1RmWFY5.js → post-editor-Cp_zmM1c.js} +2 -2
  195. package/dist/client/assets/{preview-content-CNIJYNak.js → preview-content-YLQa-MEQ.js} +1 -1
  196. package/dist/client/assets/{preview-dialog-C7esJb4w.js → preview-dialog-CYmFwkaw.js} +1 -1
  197. package/dist/client/assets/{profile-CXYVNdpP.js → profile-DjS7rPQX.js} +1 -1
  198. package/dist/client/assets/{project-app-view-CDgS0ywj.js → project-app-view-CDoexz4k.js} +1 -1
  199. package/dist/client/assets/project-feed-BIMko2yg.js +1 -0
  200. package/dist/client/assets/{project-icon-BY9kpN8_.js → project-icon-6NFCCRCG.js} +1 -1
  201. package/dist/client/assets/project-reports-DyRmdIDr.js +1 -0
  202. package/dist/client/assets/project-tasks-B_guST6M.js +1 -0
  203. package/dist/client/assets/{projects-empty-state-DfwkZhS9.js → projects-empty-state-B10a1M4B.js} +1 -1
  204. package/dist/client/assets/{projects-evwU_QXd.js → projects-s9YGF9Lu.js} +1 -1
  205. package/dist/client/assets/{prompts-CyLjyHbX.js → prompts-DbdYfdfQ.js} +1 -1
  206. package/dist/client/assets/record-editor-B6ATpNPy.js +1 -0
  207. package/dist/client/assets/redirect-editor-HlsJRCq9.js +1 -0
  208. package/dist/client/assets/{reports-BM-fsbYD.js → reports-BxsnFrLQ.js} +1 -1
  209. package/dist/client/assets/reports-DFP-qw8N.js +1 -0
  210. package/dist/client/assets/{reports-onboarding-BkOfNX6c.js → reports-onboarding-CsJ6--w4.js} +1 -1
  211. package/dist/client/assets/{reports-tab-akHTbMf0.js → reports-tab-Wktq9_sa.js} +2 -2
  212. package/dist/client/assets/{repositories-BhXqf3Sh.js → repositories-bXU3gUAH.js} +1 -1
  213. package/dist/client/assets/{repository-binding-Bye6exhX.js → repository-binding-B_NhY5XW.js} +1 -1
  214. package/dist/client/assets/{repository-import-picker-9N2XFQro.js → repository-import-picker-R1iARtfq.js} +1 -1
  215. package/dist/client/assets/{repository-picker-Hvr1qnSW.js → repository-picker-AmyIhwMY.js} +1 -1
  216. package/dist/client/assets/{require-capability-BikcW72U.js → require-capability-CE5MPnLW.js} +1 -1
  217. package/dist/client/assets/{required-auth-layout-DWm1sqaG.js → required-auth-layout-SykeHPol.js} +1 -1
  218. package/dist/client/assets/{reset-password-DBUxrz7S.js → reset-password-C9pPnrCB.js} +1 -1
  219. package/dist/client/assets/{resizable-xSdhf8k8.js → resizable-D-ZGQzkV.js} +1 -1
  220. package/dist/client/assets/{resolve-tab-icon-BViYoAOc.js → resolve-tab-icon-DNP2Pr3y.js} +1 -1
  221. package/dist/client/assets/{review-settings-CxdhHh4I.js → review-settings-CgbME_-p.js} +1 -1
  222. package/dist/client/assets/{rich-text-link-control-DNolPdT4.js → rich-text-link-control-1OzevT91.js} +1 -1
  223. package/dist/client/assets/{roles-CTJqjtAt.js → roles-B4-k5tdW.js} +1 -1
  224. package/dist/client/assets/route-BI7WVCqk.js +1 -0
  225. package/dist/client/assets/route-InImFr8T.js +1 -0
  226. package/dist/client/assets/route-f38UIBNa.js +1 -0
  227. package/dist/client/assets/{runnable-block-editor-D_v3Y6XS.js → runnable-block-editor-lWMI5Iat.js} +1 -1
  228. package/dist/client/assets/{sandbox-lifecycle-context-YRF_Tndn.js → sandbox-lifecycle-context-C-6m-zOX.js} +1 -1
  229. package/dist/client/assets/{schema-Dx8S5UKv.js → schema-CBdf6nVq.js} +1 -1
  230. package/dist/client/assets/{scroll-area-Ni1BHDLk.js → scroll-area-BtQLVih8.js} +1 -1
  231. package/dist/client/assets/{search-input-C2C6IDR9.js → search-input-BbRzOQHT.js} +1 -1
  232. package/dist/client/assets/{search-toggle-XrzCP3HU.js → search-toggle-ZwfKdVlS.js} +1 -1
  233. package/dist/client/assets/{secret-picker-MfuGbD7z.js → secret-picker-DSwFEi4y.js} +1 -1
  234. package/dist/client/assets/{secrets-BKa3uo1t.js → secrets-DTYS0xGf.js} +1 -1
  235. package/dist/client/assets/sections-editor-CKzkLSPE.js +1 -0
  236. package/dist/client/assets/{select-CKIWskoO.js → select-BqWleZPz.js} +1 -1
  237. package/dist/client/assets/{select-model-By0BbJXF.js → select-model-xT6PieCV.js} +1 -1
  238. package/dist/client/assets/seo-editor-C1si73zi.js +1 -0
  239. package/dist/client/assets/{separator-5ldU5iPA.js → separator-DL6IkOSl.js} +1 -1
  240. package/dist/client/assets/settings-tab-DYkQoTuQ.js +5 -0
  241. package/dist/client/assets/{sheet-CAco8v5i.js → sheet-Bd039v18.js} +1 -1
  242. package/dist/client/assets/{shell-layout-Dc8bj9Qy.js → shell-layout-C8-wrHjg.js} +1 -1
  243. package/dist/client/assets/{skills-CL3xHerv.js → skills-jyfkbBvw.js} +1 -1
  244. package/dist/client/assets/{sso-8H5cn8Jj.js → sso-XXxqJPKX.js} +1 -1
  245. package/dist/client/assets/{suggestion-Bk-rJje-.js → suggestion-B9XVxEmh.js} +1 -1
  246. package/dist/client/assets/{switch-DwueOTYO.js → switch-Ief2Eh48.js} +1 -1
  247. package/dist/client/assets/{synced-repos-CNdTZ24Q.js → synced-repos-DebeUuwF.js} +1 -1
  248. package/dist/client/assets/{tab-icon-glyph-h36dkcJK.js → tab-icon-glyph-BX5R1J_a.js} +1 -1
  249. package/dist/client/assets/{table-hEbek0Ft.js → table-KDJXUCBA.js} +1 -1
  250. package/dist/client/assets/{tabs-CdtjXlat.js → tabs-BRLOXiKA.js} +1 -1
  251. package/dist/client/assets/{task-board-X-0Zbika.js → task-board-BoLv4xpd.js} +1 -1
  252. package/dist/client/assets/{task-route-DR9eVvuK.js → task-route-Bf_mrHm9.js} +1 -1
  253. package/dist/client/assets/{task-status-Dt_MbhgH.js → task-status-CfiPoIDl.js} +1 -1
  254. package/dist/client/assets/taskboard-analytics-CPac4bBU.js +1 -0
  255. package/dist/client/assets/tasks-B_OUV33u.js +1 -0
  256. package/dist/client/assets/{tasks-DFiZjBSg.js → tasks-DyYINS8s.js} +1 -1
  257. package/dist/client/assets/{textarea-3tXmq-Wc.js → textarea-CVlc5gDB.js} +1 -1
  258. package/dist/client/assets/thread-analytics-BLC_N0Cy.js +1 -0
  259. package/dist/client/assets/thread-button-C3p-T2Sx.js +1 -0
  260. package/dist/client/assets/{thread-intent-Y1VdgKwx.js → thread-intent-CqtUmKwo.js} +1 -1
  261. package/dist/client/assets/{thread-route-BRshsfjF.js → thread-route-B6BPC0Ck.js} +1 -1
  262. package/dist/client/assets/{thread-route-CvFAwFyQ.js → thread-route-Dyu25GDz.js} +1 -1
  263. package/dist/client/assets/{thread-sheet-body-CuFuqQDP.js → thread-sheet-body-CgovWoIK.js} +1 -1
  264. package/dist/client/assets/{toggle-group-BBUMgsw-.js → toggle-group-DiLzg8Oz.js} +1 -1
  265. package/dist/client/assets/{toolbar-icon-button-DMjHAwX1.js → toolbar-icon-button-BYksvIS3.js} +1 -1
  266. package/dist/client/assets/{tooltip-CCq3uglU.js → tooltip-DR03IHA1.js} +1 -1
  267. package/dist/client/assets/{track-BQopacYb.js → track-BS0KNS0z.js} +1 -1
  268. package/dist/client/assets/{types-By6vVcI1.js → types-LTX_QS_n.js} +1 -1
  269. package/dist/client/assets/{usage-stats-CUGPskaJ.js → usage-stats-C51kdK-O.js} +1 -1
  270. package/dist/client/assets/{use-ai-providers-BdgkW-rz.js → use-ai-providers-CoMpro3i.js} +1 -1
  271. package/dist/client/assets/{use-automations-DRY01_uG.js → use-automations-DJNilpnc.js} +1 -1
  272. package/dist/client/assets/{use-autosave-BKedxvfh.js → use-autosave-BdgUy-0v.js} +1 -1
  273. package/dist/client/assets/use-chat-layout-state-_HZU5xG7.js +1 -0
  274. package/dist/client/assets/{use-connect-companion-BQlD5V75.js → use-connect-companion-Bv9Pb3sO.js} +1 -1
  275. package/dist/client/assets/{use-connection-B1Onu2Kt.js → use-connection-Dqt9FsoJ.js} +1 -1
  276. package/dist/client/assets/{use-copy-DmHXHCnz.js → use-copy-Cq1WnAZO.js} +1 -1
  277. package/dist/client/assets/{use-create-virtual-mcp-fQ6K6_pG.js → use-create-virtual-mcp-D0ynfXjq.js} +1 -1
  278. package/dist/client/assets/{use-date-fns-locale-C185nROT.js → use-date-fns-locale-D8lzkql1.js} +1 -1
  279. package/dist/client/assets/{use-debounced-autosave-BRJCxv7e.js → use-debounced-autosave-DcBd_wy0.js} +1 -1
  280. package/dist/client/assets/{use-debounced-value-yPMYT1PN.js → use-debounced-value-CQlodPiq.js} +1 -1
  281. package/dist/client/assets/{use-deco-credits-CrxCz8CE.js → use-deco-credits-DKE8CKUB.js} +1 -1
  282. package/dist/client/assets/{use-decopilot-events-CypL9wDE.js → use-decopilot-events-CRlKPkfk.js} +1 -1
  283. package/dist/client/assets/{use-delete-connection-BM3IJ70N.js → use-delete-connection-CTCZXhIi.js} +1 -1
  284. package/dist/client/assets/{use-deployment-admin-DeIDIzSg.js → use-deployment-admin-BDx0zwoX.js} +1 -1
  285. package/dist/client/assets/{use-fast-preview-draft-url-DGgr9dv2.js → use-fast-preview-draft-url--h9Tv0zG.js} +1 -1
  286. package/dist/client/assets/{use-file-configs-CLG1iL92.js → use-file-configs-Dm5QQPiU.js} +1 -1
  287. package/dist/client/assets/{use-infinite-scroll-9-lAGo5q.js → use-infinite-scroll-CQNm1p1Z.js} +1 -1
  288. package/dist/client/assets/{use-join-requests-BhpyUEa7.js → use-join-requests-Bygz0bo8.js} +1 -1
  289. package/dist/client/assets/use-main-panel-tabs-BhuNnd2h.js +1 -0
  290. package/dist/client/assets/{use-mcp-auth-status-e-d864j-.js → use-mcp-auth-status-CSk5HQ_I.js} +1 -1
  291. package/dist/client/assets/{use-mcp-client-CFwJWbBp.js → use-mcp-client-BUxJmD4z.js} +1 -1
  292. package/dist/client/assets/{use-mcp-prompts-Dt5SCeuL.js → use-mcp-prompts-BbeFHvZR.js} +1 -1
  293. package/dist/client/assets/{use-mcp-tools-Ddw8pP4s.js → use-mcp-tools-Bbmi6C0T.js} +1 -1
  294. package/dist/client/assets/{use-members-o--3mm1V.js → use-members-D5SND9MM.js} +1 -1
  295. package/dist/client/assets/{use-mobile-BcAqan0X.js → use-mobile-DPqh4jRn.js} +1 -1
  296. package/dist/client/assets/{use-navigate-to-agent-CjjoA5M6.js → use-navigate-to-agent-D9zMng25.js} +1 -1
  297. package/dist/client/assets/use-new-blocks-editor-D6z95MNv.js +1 -0
  298. package/dist/client/assets/{use-open-billing-url-m1RP8Kag.js → use-open-billing-url-BvxQsl9r.js} +1 -1
  299. package/dist/client/assets/{use-org-auth-client-DEUGdiVk.js → use-org-auth-client--nyW1O8e.js} +1 -1
  300. package/dist/client/assets/{use-org-fs-BSupMC3v.js → use-org-fs-DSuvAHdS.js} +1 -1
  301. package/dist/client/assets/{use-org-repo-syncs-O-NtvfvJ.js → use-org-repo-syncs-DNj_tgaw.js} +1 -1
  302. package/dist/client/assets/{use-org-sso-C8eq4Vdd.js → use-org-sso-DzOXFkj8.js} +1 -1
  303. package/dist/client/assets/{use-organization-roles-reY1_o4k.js → use-organization-roles-DN9XQYP6.js} +1 -1
  304. package/dist/client/assets/{use-organization-settings-DiTNcxQS.js → use-organization-settings-BrhF1m2_.js} +1 -1
  305. package/dist/client/assets/{use-panel-navigate-CFUA8opi.js → use-panel-navigate-DSVmT0jD.js} +1 -1
  306. package/dist/client/assets/{use-project-scope-nSXqOJGj.js → use-project-scope-Bo2r-DyF.js} +1 -1
  307. package/dist/client/assets/use-recent-apps-BB5-9Ae6.js +1 -0
  308. package/dist/client/assets/{use-releases-BbGaY8US.js → use-releases-DVJxEffL.js} +1 -1
  309. package/dist/client/assets/{use-reports-diagnostic-BT8MtXS3.js → use-reports-diagnostic-BnOhK7Bb.js} +1 -1
  310. package/dist/client/assets/{use-secrets-FJu3iWhY.js → use-secrets-DRwQEz1S.js} +1 -1
  311. package/dist/client/assets/{use-section-preview-base-CxPC0M-d.js → use-section-preview-base-B_v6WwFH.js} +1 -1
  312. package/dist/client/assets/{use-session-runtime-CNsfPJpj.js → use-session-runtime-DSwirXrC.js} +1 -1
  313. package/dist/client/assets/{use-tags-BXGxCIku.js → use-tags-DlHH4Qi1.js} +1 -1
  314. package/dist/client/assets/{use-task-board-analytics-DNKSgirc.js → use-task-board-analytics-CUnizIez.js} +1 -1
  315. package/dist/client/assets/{use-task-board-events-C7j5aBlD.js → use-task-board-events-4sCrjL4g.js} +1 -1
  316. package/dist/client/assets/{use-task-metadata-D3Ciwarw.js → use-task-metadata-DcX45smp.js} +1 -1
  317. package/dist/client/assets/{use-thread-analytics-D27BLIsa.js → use-thread-analytics-C1PD-wKd.js} +1 -1
  318. package/dist/client/assets/{use-thread-outputs-D0UmTPT7.js → use-thread-outputs-DXHpolX2.js} +1 -1
  319. package/dist/client/assets/useInfiniteQuery-DK0olIK3.js +1 -0
  320. package/dist/client/assets/{useQueries-CrAKGEfH.js → useQueries-D5KYPRzB.js} +1 -1
  321. package/dist/client/assets/useSuspenseInfiniteQuery-CoicqEC4.js +1 -0
  322. package/dist/client/assets/{users-CQYodV6R.js → users-DwbIuW3C.js} +1 -1
  323. package/dist/client/assets/{utils-D94emI8J.js → utils-VHhyqMwa.js} +1 -1
  324. package/dist/client/assets/variant-calendar-Nce7TSd8.js +1 -0
  325. package/dist/client/assets/{variant-matcher-override-BFWepI_H.js → variant-matcher-override-D18XaBSZ.js} +1 -1
  326. package/dist/client/assets/{view-mode-toggle-a9S8LD9H.js → view-mode-toggle-CqfMj8Tg.js} +1 -1
  327. package/dist/client/assets/{virtual-mcp-BC9jxxUg.js → virtual-mcp-CfWdBZM2.js} +1 -1
  328. package/dist/client/index.html +2 -2
  329. package/dist/server/cli.js +1 -1
  330. package/dist/server/server.js +1 -1
  331. package/package.json +1 -1
  332. package/dist/client/assets/agent-analytics-BHngg3aN.js +0 -2
  333. package/dist/client/assets/agent-app-eih7qmuw.js +0 -1
  334. package/dist/client/assets/agent-assets-CojSmNaz.js +0 -1
  335. package/dist/client/assets/agent-automations-BQwnmsqe.js +0 -1
  336. package/dist/client/assets/agent-connect-sources-DC_snIij.js +0 -1
  337. package/dist/client/assets/agent-deck-BHvHS_x2.js +0 -1
  338. package/dist/client/assets/agent-e2e-BScuCsCp.js +0 -1
  339. package/dist/client/assets/agent-experiments-0ZSUWJyV.js +0 -1
  340. package/dist/client/assets/agent-file-A2jLB4uh.js +0 -1
  341. package/dist/client/assets/agent-hosting-C03IBXsD.js +0 -1
  342. package/dist/client/assets/agent-library-Bndr3ZTh.js +0 -1
  343. package/dist/client/assets/agent-library-file-DHNrLn15.js +0 -1
  344. package/dist/client/assets/agent-monitor-C2UpDGeU.js +0 -1
  345. package/dist/client/assets/agent-overview-vGVfOmzC.js +0 -1
  346. package/dist/client/assets/agent-settings-CKUunA9x.js +0 -1
  347. package/dist/client/assets/agent-site-editor-code-DNEtxYix.js +0 -2
  348. package/dist/client/assets/agent-view-Eu0cDk5o.js +0 -1
  349. package/dist/client/assets/api-keys-DTPxsqpA.js +0 -1
  350. package/dist/client/assets/app-editor-OxAoUr_m.js +0 -1
  351. package/dist/client/assets/category-editor-BX5BNfiN.js +0 -1
  352. package/dist/client/assets/context-CHxPejUn.js +0 -1
  353. package/dist/client/assets/discover-1nnz5mE8.js +0 -1
  354. package/dist/client/assets/flat-project-DxrfpqU8.js +0 -1
  355. package/dist/client/assets/home-R2M47XKc.js +0 -1
  356. package/dist/client/assets/index-DFBQfnNq.css +0 -1
  357. package/dist/client/assets/library-CpDr8cUt.js +0 -1
  358. package/dist/client/assets/match-site-slug-config-D3fUJ6vX.js +0 -1
  359. package/dist/client/assets/openai-conversation-Bidm8HKX.js +0 -3
  360. package/dist/client/assets/post-calendar-DVsOpmKX.js +0 -1
  361. package/dist/client/assets/project-feed-DsVk1K7o.js +0 -1
  362. package/dist/client/assets/project-reports-DKz6hsTO.js +0 -1
  363. package/dist/client/assets/project-tasks-DEHeH6xm.js +0 -1
  364. package/dist/client/assets/record-editor-BG6JZBAo.js +0 -1
  365. package/dist/client/assets/redirect-editor-BSixOpkn.js +0 -1
  366. package/dist/client/assets/reports-DQHzs4c2.js +0 -1
  367. package/dist/client/assets/route-C4g7C29_.js +0 -1
  368. package/dist/client/assets/route-iDn0dH_W.js +0 -1
  369. package/dist/client/assets/route-mD1G8miY.js +0 -1
  370. package/dist/client/assets/sections-editor-DQXGqVXO.js +0 -1
  371. package/dist/client/assets/seo-editor-BI6yz1SI.js +0 -1
  372. package/dist/client/assets/settings-tab-DjCUiptn.js +0 -5
  373. package/dist/client/assets/taskboard-analytics-DGE69gm2.js +0 -1
  374. package/dist/client/assets/tasks-DEV8yvUO.js +0 -1
  375. package/dist/client/assets/thread-analytics-Batrg_G6.js +0 -1
  376. package/dist/client/assets/thread-button-1m1VWTYv.js +0 -1
  377. package/dist/client/assets/use-chat-layout-state-ffnO3cas.js +0 -1
  378. package/dist/client/assets/use-main-panel-tabs-Ex0Ebdb5.js +0 -1
  379. package/dist/client/assets/use-new-blocks-editor-DqR1bcfV.js +0 -1
  380. package/dist/client/assets/use-project-native-view-presence-xh82wo73.js +0 -1
  381. package/dist/client/assets/useInfiniteQuery-DXdUQ48R.js +0 -1
  382. package/dist/client/assets/useSuspenseInfiniteQuery-BmynEKtw.js +0 -1
  383. package/dist/client/assets/variant-calendar-Dfcw4asd.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as I,b as B,r as E,j as x,l as Z,X as Tt,m as vt,K as At,aO as Mt,h as Je,t as Re,B as St}from"./index-CeFrI_-f.js";import{a as Ct,E as fe,r as H,t as Rt,v as Et,w as Ye,x as j,y as Ee,z as $t,A as _t,B as $e,C as Lt,G as V,N as D,m as P,H as Y,T as et,R as ge,I as me,h as zt,J as It,K as Ht,L as Pt,O as jt,s as Nt,Q as Ot,S as Bt,u as Dt,b as Ft,U as qt}from"./index-CBLynFUh.js";import{a9 as Wt,aa as Ut,ac as Gt,F as Vt,b6 as Zt,aW as Kt}from"./agent-icon-C8wu-T9B.js";import{a as Qt,e as tt,s as Xt,S as Jt}from"./suggestion-Bk-rJje-.js";import{B as Yt,c as en,t as tn,C as nt,f as nn,g as _e,s as rn,m as Le,a as ze,b as sn,d as Ie,e as an,h as on,i as ln,j as cn,k as un,l as hn,n as dn}from"./index-D5-xqq3P.js";import{i as pn}from"./XClose-CVE8Vs6Q.js";import{T as $,n as fn,i as gn}from"./rich-text-link-control-DNolPdT4.js";import{i as mn}from"./Check-soPAeKca.js";import{i as kn}from"./Link01-C9tHLmLh.js";import{s as bn}from"./Trash01-CKOL_3ja.js";import{n as xn}from"./Image01-AxefwT4b.js";import{b as wn}from"./ZoomOut-ekFDVqJi.js";import{i as rt}from"./X-Dp6J1NZk.js";import{m as yn,a as Tn}from"./markdown-Ck-11dhN.js";import{A as vn}from"./avatar-By9-J1G7.js";import{f as An,C as Mn,c as Sn,a as Cn,b as Rn}from"./command-DxWpNp1x.js";import{g as En}from"./get-initials-D-f_fDFw.js";import{u as $n}from"./use-org-auth-client-DEUGdiVk.js";import{i as _n,b as Ln}from"./use-org-fs-BSupMC3v.js";function zn(t){const e=I.c(30),{editor:n}=t,s=B(),[r,a]=E.useState(!1),[i,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==r?(d=()=>{if(r){a(!1);return}const S=n.getAttributes("link").href;l(typeof S=="string"?S:""),c(!1),a(!0)},e[2]=n,e[3]=r,e[4]=d):d=e[4];const b=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),a(!1)},e[5]=n,e[6]=p):p=e[6];const k=p;let f;e[7]!==i||e[8]!==n||e[9]!==k?(f=()=>{const S=fn(i);if(S===""){k();return}if(!gn(S)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:S}).run(),a(!1)},e[7]=i,e[8]=n,e[9]=k,e[10]=f):f=e[10];const g=f;let w;e[11]!==s?(w=s("markdownEditor.link"),e[11]=s,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==b?(T=x.jsx($,{active:h,label:w,onClick:b,children:y}),e[14]=h,e[15]=w,e[16]=b,e[17]=T):T=e[17];let m;e[18]!==h||e[19]!==g||e[20]!==i||e[21]!==n||e[22]!==o||e[23]!==r||e[24]!==k||e[25]!==s?(m=r&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:S=>{S.currentTarget.contains(S.relatedTarget)||a(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":s("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:s("markdownEditor.linkPlaceholder"),value:i,onChange:S=>{l(S.target.value),c(!1)},onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),g()):S.key==="Escape"&&(S.preventDefault(),a(!1),n.chain().focus().run())},className:Z("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx($,{active:!1,label:s("markdownEditor.linkApply"),onClick:g,children:x.jsx(mn,{size:14})}),h&&x.jsx($,{active:!1,label:s("markdownEditor.linkRemove"),onClick:k,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=g,e[20]=i,e[21]=n,e[22]=o,e[23]=r,e[24]=k,e[25]=s,e[26]=m):m=e[26];let v;return e[27]!==T||e[28]!==m?(v=x.jsxs("div",{className:"relative",children:[T,m]}),e[27]=T,e[28]=m,e[29]=v):v=e[29],v}const ae=()=>{const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},He=t=>{const e=I.c(2),{children:n}=t;let s;return e[0]!==n?(s=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=s):s=e[1],s},st=[1,2,3],In=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function Hn(t){const e=I.c(20),{editor:n}=t,s=B(),[r,a]=E.useState(null);let i;e[0]!==n?(i={editor:n,selector:Pn},e[0]=n,e[1]=i):i=e[1];const l=Ct(i);let o;e[2]!==s?(o=s("markdownEditor.heading1"),e[2]=s,e[3]=o):o=e[3];let c;e[4]!==s?(c=s("markdownEditor.heading2"),e[4]=s,e[5]=c):c=e[5];let u;e[6]!==s?(u=s("markdownEditor.heading3"),e[6]=s,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let b;e[12]!==n||e[13]!==d||e[14]!==r||e[15]!==l||e[16]!==s?(b=r&&x.jsxs(Yt,{editor:n,shouldShow:In,appendTo:r,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":s("markdownEditor.toolbarAriaLabel"),children:[x.jsx($,{active:l.bold,label:s("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(Wt,{size:14})}),x.jsx($,{active:l.italic,label:s("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(Ut,{size:14})}),x.jsx($,{active:l.strike,label:s("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(Gt,{size:14})}),x.jsx($,{active:l.code,label:s("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(Vt,{size:14})}),x.jsx(ae,{}),st.map((k,f)=>x.jsx($,{active:l.headings[f]??!1,label:d[k],onClick:()=>n.chain().focus().toggleHeading({level:k}).run(),children:x.jsx(He,{children:`H${k}`})},k)),x.jsx(ae,{}),x.jsx($,{active:l.bulletList,label:s("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(pn,{size:14})}),x.jsx($,{active:l.orderedList,label:s("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(He,{children:"1."})}),x.jsx($,{active:l.blockquote,label:s("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(Zt,{size:14})}),x.jsx(ae,{}),x.jsx(zn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=r,e[15]=l,e[16]=s,e[17]=b):b=e[17];let p;return e[18]!==b?(p=x.jsx("div",{ref:a,className:"relative z-20",children:b}),e[18]=b,e[19]=p):p=e[19],p}function Pn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:st.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}function ke(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=ke();function it(t){F=t}var N={exec:()=>null};function A(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 jn=(()=>{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)}}>`)},Nn=/^(?:[ \t]*(?:\n|$))+/,On=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bn=/^ {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+|$)/,Dn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,be=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,at=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ot=A(at).replace(/bull/g,be).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(),Fn=A(at).replace(/bull/g,be).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(),xe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qn=/^[^\n]+/,we=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Wn=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",we).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Un=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,be).getRegex(),se="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",ye=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Gn=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ye).replace("tag",se).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lt=A(xe).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",se).getRegex(),Vn=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lt).getRegex(),Te={blockquote:Vn,code:On,def:Wn,fences:Bn,heading:Dn,hr:K,html:Gn,lheading:ot,list:Un,newline:Nn,paragraph:lt,table:N,text:qn},Pe=A("^ *([^\\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",se).getRegex(),Zn={...Te,lheading:Fn,table:Pe,paragraph:A(xe).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Pe).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",se).getRegex()},Kn={...Te,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye).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:A(xe).replace("hr",K).replace("heading",` *#{1,6} *[^
1
+ import{c as I,b as B,r as E,j as x,l as Z,X as Tt,m as vt,K as At,aO as Mt,h as Je,t as Re,B as St}from"./index-DUoAE5ST.js";import{a as Ct,E as fe,r as H,t as Rt,v as Et,w as Ye,x as j,y as Ee,z as $t,A as _t,B as $e,C as Lt,G as V,N as D,m as P,H as Y,T as et,R as ge,I as me,h as zt,J as It,K as Ht,L as Pt,O as jt,s as Nt,Q as Ot,S as Bt,u as Dt,b as Ft,U as qt}from"./index-T9qmd0M1.js";import{a9 as Wt,aa as Ut,ac as Gt,F as Vt,b6 as Zt,aW as Kt}from"./agent-icon-B1JUa-pK.js";import{a as Qt,e as tt,s as Xt,S as Jt}from"./suggestion-B9XVxEmh.js";import{B as Yt,c as en,t as tn,C as nt,f as nn,g as _e,s as rn,m as Le,a as ze,b as sn,d as Ie,e as an,h as on,i as ln,j as cn,k as un,l as hn,n as dn}from"./index-BzEAzC8-.js";import{i as pn}from"./XClose-DXJf2S1e.js";import{T as $,n as fn,i as gn}from"./rich-text-link-control-1OzevT91.js";import{i as mn}from"./Check-CMF2Ywph.js";import{i as kn}from"./Link01-CMEXeVpO.js";import{s as bn}from"./Trash01-DliBU2bP.js";import{n as xn}from"./Image01-BdsDNVox.js";import{b as wn}from"./ZoomOut-Bqjt8gJB.js";import{i as rt}from"./X-AdrRw9Zp.js";import{m as yn,a as Tn}from"./markdown-Cuay45B5.js";import{A as vn}from"./avatar-D5EBeZdt.js";import{f as An,C as Mn,c as Sn,a as Cn,b as Rn}from"./command-BaUKjhoV.js";import{g as En}from"./get-initials-D-f_fDFw.js";import{u as $n}from"./use-org-auth-client--nyW1O8e.js";import{i as _n,b as Ln}from"./use-org-fs-DSuvAHdS.js";function zn(t){const e=I.c(30),{editor:n}=t,s=B(),[r,a]=E.useState(!1),[i,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==r?(d=()=>{if(r){a(!1);return}const S=n.getAttributes("link").href;l(typeof S=="string"?S:""),c(!1),a(!0)},e[2]=n,e[3]=r,e[4]=d):d=e[4];const b=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),a(!1)},e[5]=n,e[6]=p):p=e[6];const k=p;let f;e[7]!==i||e[8]!==n||e[9]!==k?(f=()=>{const S=fn(i);if(S===""){k();return}if(!gn(S)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:S}).run(),a(!1)},e[7]=i,e[8]=n,e[9]=k,e[10]=f):f=e[10];const g=f;let w;e[11]!==s?(w=s("markdownEditor.link"),e[11]=s,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==b?(T=x.jsx($,{active:h,label:w,onClick:b,children:y}),e[14]=h,e[15]=w,e[16]=b,e[17]=T):T=e[17];let m;e[18]!==h||e[19]!==g||e[20]!==i||e[21]!==n||e[22]!==o||e[23]!==r||e[24]!==k||e[25]!==s?(m=r&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:S=>{S.currentTarget.contains(S.relatedTarget)||a(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":s("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:s("markdownEditor.linkPlaceholder"),value:i,onChange:S=>{l(S.target.value),c(!1)},onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),g()):S.key==="Escape"&&(S.preventDefault(),a(!1),n.chain().focus().run())},className:Z("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx($,{active:!1,label:s("markdownEditor.linkApply"),onClick:g,children:x.jsx(mn,{size:14})}),h&&x.jsx($,{active:!1,label:s("markdownEditor.linkRemove"),onClick:k,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=g,e[20]=i,e[21]=n,e[22]=o,e[23]=r,e[24]=k,e[25]=s,e[26]=m):m=e[26];let v;return e[27]!==T||e[28]!==m?(v=x.jsxs("div",{className:"relative",children:[T,m]}),e[27]=T,e[28]=m,e[29]=v):v=e[29],v}const ae=()=>{const t=I.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},He=t=>{const e=I.c(2),{children:n}=t;let s;return e[0]!==n?(s=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=s):s=e[1],s},st=[1,2,3],In=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function Hn(t){const e=I.c(20),{editor:n}=t,s=B(),[r,a]=E.useState(null);let i;e[0]!==n?(i={editor:n,selector:Pn},e[0]=n,e[1]=i):i=e[1];const l=Ct(i);let o;e[2]!==s?(o=s("markdownEditor.heading1"),e[2]=s,e[3]=o):o=e[3];let c;e[4]!==s?(c=s("markdownEditor.heading2"),e[4]=s,e[5]=c):c=e[5];let u;e[6]!==s?(u=s("markdownEditor.heading3"),e[6]=s,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let b;e[12]!==n||e[13]!==d||e[14]!==r||e[15]!==l||e[16]!==s?(b=r&&x.jsxs(Yt,{editor:n,shouldShow:In,appendTo:r,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":s("markdownEditor.toolbarAriaLabel"),children:[x.jsx($,{active:l.bold,label:s("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(Wt,{size:14})}),x.jsx($,{active:l.italic,label:s("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(Ut,{size:14})}),x.jsx($,{active:l.strike,label:s("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(Gt,{size:14})}),x.jsx($,{active:l.code,label:s("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(Vt,{size:14})}),x.jsx(ae,{}),st.map((k,f)=>x.jsx($,{active:l.headings[f]??!1,label:d[k],onClick:()=>n.chain().focus().toggleHeading({level:k}).run(),children:x.jsx(He,{children:`H${k}`})},k)),x.jsx(ae,{}),x.jsx($,{active:l.bulletList,label:s("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(pn,{size:14})}),x.jsx($,{active:l.orderedList,label:s("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(He,{children:"1."})}),x.jsx($,{active:l.blockquote,label:s("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(Zt,{size:14})}),x.jsx(ae,{}),x.jsx(zn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=r,e[15]=l,e[16]=s,e[17]=b):b=e[17];let p;return e[18]!==b?(p=x.jsx("div",{ref:a,className:"relative z-20",children:b}),e[18]=b,e[19]=p):p=e[19],p}function Pn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:st.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}function ke(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=ke();function it(t){F=t}var N={exec:()=>null};function A(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 jn=(()=>{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)}}>`)},Nn=/^(?:[ \t]*(?:\n|$))+/,On=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bn=/^ {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+|$)/,Dn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,be=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,at=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ot=A(at).replace(/bull/g,be).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(),Fn=A(at).replace(/bull/g,be).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(),xe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qn=/^[^\n]+/,we=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Wn=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",we).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Un=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,be).getRegex(),se="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",ye=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Gn=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ye).replace("tag",se).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lt=A(xe).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",se).getRegex(),Vn=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lt).getRegex(),Te={blockquote:Vn,code:On,def:Wn,fences:Bn,heading:Dn,hr:K,html:Gn,lheading:ot,list:Un,newline:Nn,paragraph:lt,table:N,text:qn},Pe=A("^ *([^\\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",se).getRegex(),Zn={...Te,lheading:Fn,table:Pe,paragraph:A(xe).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Pe).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",se).getRegex()},Kn={...Te,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye).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:A(xe).replace("hr",K).replace("heading",` *#{1,6} *[^
2
2
  ]`).replace("lheading",ot).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Qn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ct=/^( {2,}|\\)\n(?!\s*$)/,Jn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,ie=/[\s\p{P}\p{S}]/u,ve=/[^\s\p{P}\p{S}]/u,Yn=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ie).getRegex(),ut=/(?!~)[\p{P}\p{S}]/u,er=/(?!~)[\s\p{P}\p{S}]/u,tr=/(?:[^\s\p{P}\p{S}]|~)/u,nr=A(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",jn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ht=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,rr=A(ht,"u").replace(/punct/g,q).getRegex(),sr=A(ht,"u").replace(/punct/g,ut).getRegex(),dt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ir=A(dt,"gu").replace(/notPunctSpace/g,ve).replace(/punctSpace/g,ie).replace(/punct/g,q).getRegex(),ar=A(dt,"gu").replace(/notPunctSpace/g,tr).replace(/punctSpace/g,er).replace(/punct/g,ut).getRegex(),or=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ve).replace(/punctSpace/g,ie).replace(/punct/g,q).getRegex(),lr=A(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,q).getRegex(),cr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ur=A(cr,"gu").replace(/notPunctSpace/g,ve).replace(/punctSpace/g,ie).replace(/punct/g,q).getRegex(),hr=A(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),dr=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pr=A(ye).replace("(?:-->|$)","-->").getRegex(),fr=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",pr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ee=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gr=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ee).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pt=A(/^!?\[(label)\]\[(ref)\]/).replace("label",ee).replace("ref",we).getRegex(),ft=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",we).getRegex(),mr=A("reflink|nolink(?!\\()","g").replace("reflink",pt).replace("nolink",ft).getRegex(),je=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ae={_backpedal:N,anyPunctuation:hr,autolink:dr,blockSkip:nr,br:ct,code:Xn,del:N,delLDelim:N,delRDelim:N,emStrongLDelim:rr,emStrongRDelimAst:ir,emStrongRDelimUnd:or,escape:Qn,link:gr,nolink:ft,punctuation:Yn,reflink:pt,reflinkSearch:mr,tag:fr,text:Jn,url:N},kr={...Ae,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",ee).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ee).getRegex()},le={...Ae,emStrongRDelimAst:ar,emStrongLDelim:sr,delLDelim:lr,delRDelim:ur,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",je).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",je).getRegex()},br={...le,br:A(ct).replace("{2,}","*").getRegex(),text:A(le.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:Te,gfm:Zn,pedantic:Kn},W={normal:Ae,gfm:le,breaks:br,pedantic:kr},xr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ne=t=>xr[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,Ne)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,Ne);return t}function Oe(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function Be(t,e){let n=t.replace(R.findPipe,(a,i,l)=>{let o=!1,c=i;for(;--c>=0&&l[c]==="\\";)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 wr(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 yr(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 De(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 Tr(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 te=class{options;rules;lexer;constructor(t){this.options=t||F}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:U(n,`
@@ -1,4 +1,4 @@
1
- import{c as he,r as de,d as ms,X as kt,b as Ve,j as t,B as ge,t as dt,l as Ue,a2 as us,K as bt,m as Bt,Z as Qs,eJ as Fs,h as Xs,u as Ys,n as vt,E as Ws,q as ts,z as Zs,W as el}from"./index-CeFrI_-f.js";import{S as tl}from"./search-input-C2C6IDR9.js";import{E as es}from"./empty-state-LYCOTuMl.js";import{R as sl}from"./require-capability-BikcW72U.js";import{f as Ss}from"./pair-BqbLIj1t.js";import{u as is}from"./use-connection-B1Onu2Kt.js";import{g as Os}from"./connection-slug-CITJ0kGN.js";import{B as Et}from"./badge-BLmau0Ea.js";import{P as Jt,a as Gt,b as Qt}from"./popover-Dp4MK1ls.js";import{b as Ot,T as $t,a as zt,c as ll}from"./tooltip-CCq3uglU.js";import{i as ss}from"./Check-soPAeKca.js";import{a as Yt}from"./Copy01-Ck1CQt9c.js";import{n as Is}from"./Image01-AxefwT4b.js";import{x as fs,bw as rl,Y as ol,H as il,at as At,F as nl}from"./agent-icon-C8wu-T9B.js";import{i as al}from"./Key01-V9W0a2Yy.js";import{i as cl}from"./Sun-CttdH4aG.js";import{M as Ts}from"./monaco-editor-CyLZqoPt.js";import{a as dl}from"./use-members-o--3mm1V.js";import{u as ml}from"./use-mcp-client-CFwJWbBp.js";import{b as ul}from"./repository-binding-Bye6exhX.js";import{c as fl}from"./XClose-CVE8Vs6Q.js";import{s as xl}from"./Plus-kHt_8stA.js";import{s as pl}from"./Trash01-CKOL_3ja.js";import{I as Ht}from"./input-CQlMbJrR.js";import{M as qt}from"./multi-select-CtEcT2Fm.js";import{b as wt,a as yt,c as Ee,d as St,S as It}from"./select-CKIWskoO.js";import{S as gl}from"./scroll-area-Ni1BHDLk.js";import{t as Zt,n as ns}from"./ChevronUp-B4upaCys.js";import{C as hl}from"./calendar-C_3zvYnn.js";import{T as vl}from"./textarea-3tXmq-Wc.js";import{C as $s}from"./collection-tabs-CDyR4kzk.js";import{S as jl}from"./switch-DwueOTYO.js";import{L as Nl}from"./label-CTaphTs2.js";import{I as Tt}from"./integration-icon-60YSBd47.js";import{A as xs}from"./avatar-By9-J1G7.js";import{a as bl,b as wl,A as yl}from"./alert-B_aVDXWu.js";import{K as ht}from"./monitoring-stats-row-pkJdXLku.js";import{c as zs}from"./use-decopilot-events-CypL9wDE.js";import{g as Sl,b as ks,f as Nt,c as ls,a as ps,d as Il,e as Cs,h as Tl,i as gs,T as kl,j as Cl,r as Ml,k as Dl}from"./thread-sheet-body-CuFuqQDP.js";import{u as _l}from"./useSuspenseInfiniteQuery-BmynEKtw.js";import{c as Ll,S as Rl,b as Es,a as As}from"./sheet-CAco8v5i.js";import{c as Ae,b as Ut,d as hs,e as vs,T as je,a as js}from"./table-hEbek0Ft.js";import{u as Us,A as Pl}from"./automation-runs-BNfzkXtY.js";import{u as Vs}from"./use-infinite-scroll-9-lAGo5q.js";import{u as Fl}from"./useInfiniteQuery-DXdUQ48R.js";import{g as Ol}from"./task-status-Dt_MbhgH.js";import{u as $l,d as zl}from"./use-automations-DRY01_uG.js";import"./SearchMd-DFB2ha4T.js";import"./access-gate-DVZHCUBi.js";import"./capability-load-error-_sxFuxMW.js";import"./Tool01-BVUW3itu.js";import"./ArrowRight-CJiUKB0e.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./collapsible-Pi90xi-e.js";import"./use-copy-DmHXHCnz.js";import"./usage-stats-CUGPskaJ.js";import"./markdown-Ck-11dhN.js";import"./dialog-1dafL4bi.js";import"./X-Dp6J1NZk.js";import"./ZoomOut-ekFDVqJi.js";import"./org-file-open-context-CNhQ4sPa.js";import"./use-mobile-BcAqan0X.js";import"./use-panel-navigate-CFUA8opi.js";import"./thread-route-BRshsfjF.js";import"./use-project-scope-nSXqOJGj.js";import"./chat-context-DSOY14Dl.js";import"./autosend-BgamBAXS.js";import"./thread-intent-Y1VdgKwx.js";import"./backoff-8mStPHYB.js";import"./task-board-X-0Zbika.js";import"./schema-Dx8S5UKv.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-BdgkW-rz.js";import"./location-DBePU4bz.js";import"./use-organization-settings-DiTNcxQS.js";import"./shell-layout-Dc8bj9Qy.js";import"./Palette-Bk3UCvKx.js";import"./UserSquare-D1bS09Fm.js";import"./download-app-dialog-BcCXsaD8.js";import"./CheckCircle-BdRkKVcj.js";import"./Monitor01-DYA_QMf2.js";import"./command-DxWpNp1x.js";import"./index-MebkKt8H.js";import"./project-icon-BY9kpN8_.js";import"./new-project-dialog-BJkFsBCH.js";import"./ArrowLeft-r9k0gxde.js";import"./repository-import-picker-9N2XFQro.js";import"./use-navigate-to-agent-CjjoA5M6.js";import"./repository-picker-Hvr1qnSW.js";import"./LinkExternal01-CkkaHQ43.js";import"./collection-search-CZPfBwnt.js";import"./ShoppingBag01-IkLiZTCG.js";import"./use-debounced-value-yPMYT1PN.js";import"./required-auth-layout-DWm1sqaG.js";import"./use-org-sso-C8eq4Vdd.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-BemaHPoe.js";import"./types-By6vVcI1.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./gateway-client-CeKj8qiL.js";import"./tool-namespace-DmnQIdtF.js";import"./utils-CVEq3hMx.js";import"./AlertCircle-CQU3FO2-.js";import"./Link01-C9tHLmLh.js";import"./use-mcp-prompts-Dt5SCeuL.js";import"./index-CBLynFUh.js";import"./form-D5LPXjPj.js";import"./use-thread-outputs-D0UmTPT7.js";import"./file-type-icon-buBDg-03.js";import"./index-DFK3AqOd.js";import"./ArrowUp-D1uaoIEr.js";import"./CreditCard01-C5LQldm8.js";import"./DotsVertical-DMsZySzr.js";import"./Upload01-DlR8CSo4.js";import"./User01-dc7WIl5M.js";import"./Users01-BaIVzoZ3.js";import"./editor-BiYdYoAb.js";import"./use-org-auth-client-DEUGdiVk.js";import"./auth-i4uSZxqM.js";import"./checkbox-YgstniWn.js";import"./chart-DUDR_GLh.js";import"./index-D88JS0Yx.js";import"./CartesianChart-CsM3ceFL.js";import"./XAxis-B8-Lgf5y.js";import"./AreaChart-Caz7K4-P.js";import"./ErrorBarContext-bwtijj2s.js";import"./Sector-D22gYKYq.js";import"./infiniteQueryObserver-DX9QHkGe.js";const as={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3},El=["eq","contains","exists","in"];function Al(s){return El.includes(s)}function jt(s){return s.filter(e=>e.key.trim()).map(e=>{const l=encodeURIComponent(e.key.trim()),o=encodeURIComponent(e.value||"");return`${l}:${e.operator}:${o}`}).join(",")}function Ul(s){return!s||typeof s!="string"?[]:s.split(",").map(e=>{if(!e)return;const[l,o,...c]=e.split(":"),i=l?decodeURIComponent(l):"";if(i.trim())return{key:i,operator:o&&Al(o)?o:"eq",value:decodeURIComponent(c.join(":")||"")}}).filter(e=>e!==void 0)}function Wt(s){return s.filter(e=>e.key.trim()).map(e=>{switch(e.operator){case"eq":return`${e.key}=${e.value}`;case"contains":return`${e.key}~${e.value}`;case"exists":return`${e.key}?`;case"in":return`${e.key}@${e.value}`}}).join(`
1
+ import{c as he,r as de,d as ms,X as kt,b as Ve,j as t,B as ge,t as dt,l as Ue,a2 as us,K as bt,m as Bt,Z as Qs,eJ as Fs,h as Xs,u as Ys,n as vt,E as Ws,q as ts,z as Zs,W as el}from"./index-DUoAE5ST.js";import{S as tl}from"./search-input-BbRzOQHT.js";import{E as es}from"./empty-state-DKbbnCTb.js";import{R as sl}from"./require-capability-CE5MPnLW.js";import{f as Ss}from"./pair-9c3wI9G4.js";import{u as is}from"./use-connection-Dqt9FsoJ.js";import{g as Os}from"./connection-slug-CITJ0kGN.js";import{B as Et}from"./badge-C7LZnr1G.js";import{P as Jt,a as Gt,b as Qt}from"./popover-LjbxD4kl.js";import{b as Ot,T as $t,a as zt,c as ll}from"./tooltip-DR03IHA1.js";import{i as ss}from"./Check-CMF2Ywph.js";import{a as Yt}from"./Copy01-Dd4ky6ZP.js";import{n as Is}from"./Image01-BdsDNVox.js";import{x as fs,bw as rl,Y as ol,H as il,at as At,F as nl}from"./agent-icon-B1JUa-pK.js";import{i as al}from"./Key01-BUAFoCLq.js";import{i as cl}from"./Sun-CepnW0AC.js";import{M as Ts}from"./monaco-editor-BBA-2xe3.js";import{a as dl}from"./use-members-D5SND9MM.js";import{u as ml}from"./use-mcp-client-BUxJmD4z.js";import{b as ul}from"./repository-binding-B_NhY5XW.js";import{c as fl}from"./XClose-DXJf2S1e.js";import{s as xl}from"./Plus-Dc5RtznQ.js";import{s as pl}from"./Trash01-DliBU2bP.js";import{I as Ht}from"./input-yIPgkwGw.js";import{M as qt}from"./multi-select-X-tz_9Eq.js";import{b as wt,a as yt,c as Ee,d as St,S as It}from"./select-BqWleZPz.js";import{S as gl}from"./scroll-area-BtQLVih8.js";import{t as Zt,n as ns}from"./ChevronUp-D_quOjFH.js";import{C as hl}from"./calendar-yvfvBAzS.js";import{T as vl}from"./textarea-CVlc5gDB.js";import{C as $s}from"./collection-tabs-DIB_pPlJ.js";import{S as jl}from"./switch-Ief2Eh48.js";import{L as Nl}from"./label-B5D3oXM0.js";import{I as Tt}from"./integration-icon-DsxYi58j.js";import{A as xs}from"./avatar-D5EBeZdt.js";import{a as bl,b as wl,A as yl}from"./alert-BKTGsFI8.js";import{K as ht}from"./monitoring-stats-row-CjCgF20M.js";import{c as zs}from"./use-decopilot-events-CRlKPkfk.js";import{g as Sl,b as ks,f as Nt,c as ls,a as ps,d as Il,e as Cs,h as Tl,i as gs,T as kl,j as Cl,r as Ml,k as Dl}from"./thread-sheet-body-CgovWoIK.js";import{u as _l}from"./useSuspenseInfiniteQuery-CoicqEC4.js";import{c as Ll,S as Rl,b as Es,a as As}from"./sheet-Bd039v18.js";import{c as Ae,b as Ut,d as hs,e as vs,T as je,a as js}from"./table-KDJXUCBA.js";import{u as Us,A as Pl}from"./automation-runs-CJ4TbZzx.js";import{u as Vs}from"./use-infinite-scroll-CQNm1p1Z.js";import{u as Fl}from"./useInfiniteQuery-DK0olIK3.js";import{g as Ol}from"./task-status-CfiPoIDl.js";import{u as $l,d as zl}from"./use-automations-DJNilpnc.js";import"./SearchMd-B30D9ndg.js";import"./access-gate-DTSTiQp3.js";import"./capability-load-error-DwYWnWZk.js";import"./Tool01-gx1zwKcn.js";import"./ArrowRight-A-Nw2bpi.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./collapsible-aZePgHKd.js";import"./use-copy-Cq1WnAZO.js";import"./usage-stats-C51kdK-O.js";import"./markdown-Cuay45B5.js";import"./dialog-BgtCSZyf.js";import"./X-AdrRw9Zp.js";import"./ZoomOut-Bqjt8gJB.js";import"./org-file-open-context-BJfMfMA3.js";import"./use-mobile-DPqh4jRn.js";import"./use-panel-navigate-DSVmT0jD.js";import"./thread-route-B6BPC0Ck.js";import"./use-project-scope-Bo2r-DyF.js";import"./chat-context-fDVt7FJu.js";import"./autosend-C7EnJZLv.js";import"./thread-intent-CqtUmKwo.js";import"./backoff-8mStPHYB.js";import"./task-board-BoLv4xpd.js";import"./schema-CBdf6nVq.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-CoMpro3i.js";import"./location-DBePU4bz.js";import"./use-organization-settings-BrhF1m2_.js";import"./shell-layout-C8-wrHjg.js";import"./Palette-D5d1Mblr.js";import"./UserSquare-DcFHmf0l.js";import"./download-app-dialog-BRX0Ra47.js";import"./CheckCircle-Brn-seMk.js";import"./Monitor01-C2krU25E.js";import"./command-BaUKjhoV.js";import"./index-Dvm5L9kf.js";import"./project-icon-6NFCCRCG.js";import"./new-project-dialog-utK5AYOj.js";import"./ArrowLeft-2lm_J3QC.js";import"./repository-import-picker-R1iARtfq.js";import"./use-navigate-to-agent-D9zMng25.js";import"./repository-picker-AmyIhwMY.js";import"./LinkExternal01-ZFH-yoZN.js";import"./collection-search-CBSxLm5u.js";import"./ShoppingBag01-DouihxuQ.js";import"./use-debounced-value-CQlodPiq.js";import"./required-auth-layout-SykeHPol.js";import"./use-org-sso-DzOXFkj8.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-Bz2q_atZ.js";import"./types-LTX_QS_n.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./gateway-client-DFxhiMGP.js";import"./tool-namespace-DmnQIdtF.js";import"./utils-CVEq3hMx.js";import"./AlertCircle-DsOSKvzV.js";import"./Link01-CMEXeVpO.js";import"./use-mcp-prompts-BbeFHvZR.js";import"./index-T9qmd0M1.js";import"./form-Bwkg8Jqa.js";import"./use-thread-outputs-DXHpolX2.js";import"./file-type-icon-Cejgy7H6.js";import"./index-D6WmSRmP.js";import"./ArrowUp-CAUQitV-.js";import"./CreditCard01-DFpHESd1.js";import"./DotsVertical-kOg4pODr.js";import"./Upload01-CQpa1a9n.js";import"./User01-Dd4e-mIA.js";import"./Users01-BYc5DjwP.js";import"./editor-DuOWmHoR.js";import"./use-org-auth-client--nyW1O8e.js";import"./auth-DS4Lo40d.js";import"./checkbox-DKFzy_UI.js";import"./chart-Dv1JamW3.js";import"./index-Ddpg7S6U.js";import"./CartesianChart-DpAzR_jq.js";import"./XAxis-hKxnHq9P.js";import"./AreaChart-DtLzG-fG.js";import"./ErrorBarContext-3WQQZLF0.js";import"./Sector-64WXTvD4.js";import"./infiniteQueryObserver-boyhd8Uv.js";const as={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3},El=["eq","contains","exists","in"];function Al(s){return El.includes(s)}function jt(s){return s.filter(e=>e.key.trim()).map(e=>{const l=encodeURIComponent(e.key.trim()),o=encodeURIComponent(e.value||"");return`${l}:${e.operator}:${o}`}).join(",")}function Ul(s){return!s||typeof s!="string"?[]:s.split(",").map(e=>{if(!e)return;const[l,o,...c]=e.split(":"),i=l?decodeURIComponent(l):"";if(i.trim())return{key:i,operator:o&&Al(o)?o:"eq",value:decodeURIComponent(c.join(":")||"")}}).filter(e=>e!==void 0)}function Wt(s){return s.filter(e=>e.key.trim()).map(e=>{switch(e.operator){case"eq":return`${e.key}=${e.value}`;case"contains":return`${e.key}~${e.value}`;case"exists":return`${e.key}?`;case"in":return`${e.key}@${e.value}`}}).join(`
2
2
  `)}function Ms(s){return s.trim()?s.split(`
3
3
  `).map(e=>e.trim()).filter(e=>e.length>0).map(e=>{if(e.endsWith("?"))return{key:e.slice(0,-1),operator:"exists",value:""};if(e.includes("=")){const[l,...o]=e.split("=");return{key:l||"",operator:"eq",value:o.join("=")}}if(e.includes("~")){const[l,...o]=e.split("~");return{key:l||"",operator:"contains",value:o.join("~")}}if(e.includes("@")){const[l,...o]=e.split("@");return{key:l||"",operator:"in",value:o.join("@")}}return{key:e,operator:"exists",value:""}}):[]}function Vl(s){const e={},l={},o=[],c={};for(const i of s)if(i.key.trim())switch(i.operator){case"eq":i.value&&(e[i.key]=i.value);break;case"contains":i.value&&(l[i.key]=`%${i.value}%`);break;case"exists":o.push(i.key);break;case"in":i.value&&(c[i.key]=i.value);break}return{properties:Object.keys(e).length>0?e:void 0,propertyPatterns:Object.keys(l).length>0?l:void 0,propertyKeys:o.length>0?o:void 0,propertyInValues:Object.keys(c).length>0?c:void 0}}function Ds(s){if(!s)return{content:"null",isTruncated:!1,originalSize:4};const e=s._decocms_truncated;if(typeof e=="string"&&e.length>0)return{content:e,isTruncated:!0,originalSize:e.length};let l;try{l=JSON.stringify(s,null,2)}catch{return{content:"[Unable to serialize JSON]",isTruncated:!1,originalSize:0}}const o=l.length;return o<=as.maxJsonRenderSize?{content:l,isTruncated:!1,originalSize:o}:{content:l.slice(0,as.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{c as f,X as d,dO as h,j as g,N as m,a5 as p,M as j}from"./index-CeFrI_-f.js";import{L as v}from"./legacy-main-redirect-BaZYUmuc.js";import"./thread-route-BRshsfjF.js";const x=j("/shell/$org/org-shell/");function R(){const t=f.c(19),{org:r}=d(),l=x.useSearch(),{main:i,virtualmcpid:o}=l;if(i!==void 0){let e;t[0]!==i||t[1]!==r.slug||t[2]!==l||t[3]!==o?(e=h({org:r.slug,agentId:o,main:i,search:l}),t[0]=i,t[1]=r.slug,t[2]=l,t[3]=o,t[4]=e):e=t[4];const s=e;if(s?.kind==="canonical"){let a;return t[5]!==s?(a=g.jsx(v,{target:s}),t[5]=s,t[6]=a):a=t[6],a}}let n;t[7]!==o?(n=o?.trim()||null,t[7]=o,t[8]=n):n=t[8];const u=n;if(u){let e;t[9]!==r.slug||t[10]!==u?(e={org:r.slug,agentId:u},t[9]=r.slug,t[10]=u,t[11]=e):e=t[11];let s;t[12]!==l?(s={...l,virtualmcpid:void 0},t[12]=l,t[13]=s):s=t[13];let a;return t[14]!==e||t[15]!==s?(a=g.jsx(m,{to:p.projects,params:e,search:s,hash:!0,replace:!0}),t[14]=e,t[15]=s,t[16]=a):a=t[16],a}let c;return t[17]!==r.slug?(c=g.jsx(m,{to:p.home,params:{org:r.slug},search:N,hash:!0,replace:!0}),t[17]=r.slug,t[18]=c):c=t[18],c}function N(t){return{...t,virtualmcpid:void 0}}export{R as default};
1
+ import{c as f,X as d,dO as h,j as g,N as m,a5 as p,M as j}from"./index-DUoAE5ST.js";import{L as v}from"./legacy-main-redirect-k4k6oSNR.js";import"./thread-route-B6BPC0Ck.js";const x=j("/shell/$org/org-shell/");function R(){const t=f.c(19),{org:r}=d(),l=x.useSearch(),{main:i,virtualmcpid:o}=l;if(i!==void 0){let e;t[0]!==i||t[1]!==r.slug||t[2]!==l||t[3]!==o?(e=h({org:r.slug,agentId:o,main:i,search:l}),t[0]=i,t[1]=r.slug,t[2]=l,t[3]=o,t[4]=e):e=t[4];const s=e;if(s?.kind==="canonical"){let a;return t[5]!==s?(a=g.jsx(v,{target:s}),t[5]=s,t[6]=a):a=t[6],a}}let n;t[7]!==o?(n=o?.trim()||null,t[7]=o,t[8]=n):n=t[8];const u=n;if(u){let e;t[9]!==r.slug||t[10]!==u?(e={org:r.slug,agentId:u},t[9]=r.slug,t[10]=u,t[11]=e):e=t[11];let s;t[12]!==l?(s={...l,virtualmcpid:void 0},t[12]=l,t[13]=s):s=t[13];let a;return t[14]!==e||t[15]!==s?(a=g.jsx(m,{to:p.projects,params:e,search:s,hash:!0,replace:!0}),t[14]=e,t[15]=s,t[16]=a):a=t[16],a}let c;return t[17]!==r.slug?(c=g.jsx(m,{to:p.home,params:{org:r.slug},search:N,hash:!0,replace:!0}),t[17]=r.slug,t[18]=c):c=t[18],c}function N(t){return{...t,virtualmcpid:void 0}}export{R as default};
@@ -1 +1 @@
1
- import{c as _,U as te,V as ne,j as o,B as W,b as q,X as se,Y as oe,k as ae,L as ie,n as Y,r as F,d as le,ar as re,E as ce,P as I,aH as ue}from"./index-CeFrI_-f.js";import{u as de}from"./use-mobile-BcAqan0X.js";import{l as fe,a as he,u as me,n as pe}from"./thread-button-1m1VWTYv.js";import{a as X,R as ge,b as be}from"./resizable-xSdhf8k8.js";import{c as xe,b as je,m as ye}from"./use-chat-layout-state-ffnO3cas.js";import{G as Se,j as ve}from"./agent-icon-C8wu-T9B.js";import{s as Ce}from"./XClose-CVE8Vs6Q.js";import{T as J,a as Q,b as Z}from"./tooltip-CCq3uglU.js";import{T as G}from"./toolbar-icon-button-DMjHAwX1.js";import{a as Te}from"./use-project-scope-nSXqOJGj.js";import{f as Le}from"./repository-binding-Bye6exhX.js";function U(r,e){const s=typeof r=="number"?r:Number(r);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Ne(r,e){const s=_.c(8);let i;s[0]!==e?(i=c=>U(c,e),s[0]=e,s[1]=i):i=s[1];const[t,n]=te(r,i);let a;s[2]!==e||s[3]!==t?(a=U(t,e),s[2]=e,s[3]=t,s[4]=a):a=s[4];let l;return s[5]!==n||s[6]!==a?(l=[a,n],s[5]=n,s[6]=a,s[7]=l):l=s[7],l}const ze=33;function Pe(){const r=_.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=ne.sidePanelWidth(),r[0]=e):e=r[0],Ne(e,ze)}function _e(r){const e=_.c(19);let s,i,t,n,a,l;e[0]!==r?({label:i,tooltipSide:n,variant:a,size:l,children:s,...t}=r,e[0]=r,e[1]=s,e[2]=i,e[3]=t,e[4]=n,e[5]=a,e[6]=l):(s=e[1],i=e[2],t=e[3],n=e[4],a=e[5],l=e[6]);const c=n===void 0?"top":n,f=a===void 0?"ghost":a,u=l===void 0?"icon-sm":l;let d;e[7]!==s||e[8]!==i||e[9]!==t||e[10]!==u||e[11]!==f?(d=o.jsx(J,{asChild:!0,children:o.jsx(W,{"data-slot":"icon-button","aria-label":i,variant:f,size:u,...t,children:s})}),e[7]=s,e[8]=i,e[9]=t,e[10]=u,e[11]=f,e[12]=d):d=e[12];let h;e[13]!==i||e[14]!==c?(h=o.jsx(Q,{side:c,children:i}),e[13]=i,e[14]=c,e[15]=h):h=e[15];let m;return e[16]!==d||e[17]!==h?(m=o.jsxs(Z,{children:[d,h]}),e[16]=d,e[17]=h,e[18]=m):m=e[18],m}function Oe(r){const e=_.c(59),{actions:s,navigation:i}=r,t=q(),{org:n}=se(),a=Te(),l=Le(a),c=fe(),{toggleSidebar:f}=he(),u=me(),d=ee(),h=oe();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={select:Ee},e[0]=m):m=e[0];const j=ae(m),b=j?.mainView==="overview";let N;e[1]!==l?.title||e[2]!==t?(N=l?.title??t("common.loading"),e[1]=l?.title,e[2]=t,e[3]=N):N=e[3];const p=N;let O;e[4]!==b||e[5]!==j?.pageTitle||e[6]!==p||e[7]!==a||e[8]!==t?(O=b?a?p:t("sidebar.navDestinations.home"):t(j?.pageTitle??"page.view"),e[4]=b,e[5]=j?.pageTitle,e[6]=p,e[7]=a,e[8]=t,e[9]=O):O=e[9];const S=O;let v;e[10]!==n.slug||e[11]!==h||e[12]!==a?(v=h?{to:"/$org/projects",params:{org:n.slug},search:{project:a??void 0}}:{to:"/$org/projects/$agentId",params:{org:n.slug,agentId:a??""}},e[10]=n.slug,e[11]=h,e[12]=a,e[13]=v):v=e[13];const x=v;let y;if(e[14]!==c||e[15]!==b||e[16]!==n.slug||e[17]!==x||e[18]!==p||e[19]!==a||e[20]!==t||e[21]!==S){if(y=[],c){let L;e[23]!==t?(L=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=L):L=e[24];let k;e[25]!==n.slug?(k={to:"/$org/settings/general",params:{org:n.slug}},e[25]=n.slug,e[26]=k):k=e[26];let B;e[27]!==L||e[28]!==k?(B={key:"settings",label:L,link:k},e[27]=L,e[28]=k,e[29]=B):B=e[29],y.push(B)}else if(a&&!b){let L;e[30]!==x||e[31]!==p?(L={key:"project",label:p,link:x},e[30]=x,e[31]=p,e[32]=L):L=e[32],y.push(L)}let $;e[33]!==S?($={key:"page",label:S},e[33]=S,e[34]=$):$=e[34],y.push($),e[14]=c,e[15]=b,e[16]=n.slug,e[17]=x,e[18]=p,e[19]=a,e[20]=t,e[21]=S,e[22]=y}else y=e[22];let g;e[35]!==x||e[36]!==a||e[37]!==t||e[38]!==u?(g=u&&a&&o.jsx(_e,{label:t("projects.flat.close"),asChild:!0,children:o.jsx(ie,{...x,children:o.jsx(Ce,{size:16})})}),e[35]=x,e[36]=a,e[37]=t,e[38]=u,e[39]=g):g=e[39];const C=g;let z;e[40]!==d||e[41]!==t||e[42]!==u?(z=u&&d&&o.jsxs(Z,{children:[o.jsx(J,{asChild:!0,children:o.jsx(G,{"aria-label":t(d.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":d.threadOpen,active:d.threadOpen,onClick:d.toggleThread,children:o.jsx(Se,{size:16})})}),o.jsx(Q,{side:"bottom",children:t(d.threadOpen?"page.closeThread":"page.openThread")})]}),e[40]=d,e[41]=t,e[42]=u,e[43]=z):z=e[43];const T=z;let P;e[44]!==t?(P=t("layouts.shellControls.toggleSidebar"),e[44]=t,e[45]=P):P=e[45];let A;e[46]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(ve,{size:16}),e[46]=A):A=e[46];let E;e[47]!==P||e[48]!==f?(E=o.jsx(G,{className:"md:hidden",onClick:f,"aria-label":P,children:A}),e[47]=P,e[48]=f,e[49]=E):E=e[49];let w;e[50]!==T||e[51]!==E?(w=o.jsxs(o.Fragment,{children:[E,T]}),e[50]=T,e[51]=E,e[52]=w):w=e[52];let R;return e[53]!==s||e[54]!==y||e[55]!==C||e[56]!==i||e[57]!==w?(R=o.jsx(Y.Header,{leading:w,breadcrumbs:y,actions:s,trailingActions:C,navigation:i}),e[53]=s,e[54]=y,e[55]=C,e[56]=i,e[57]=w,e[58]=R):R=e[58],R}function Ee(r){return r.matches.findLast(we)?.staticData}function we(r){return r.staticData.pageTitle}const M="chat-layout-thread",D="chat-layout-content",H=F.createContext(null);function ke(){return K()}function ee(){return F.use(H)}function K(){const r=F.use(H);if(!r)throw new Error("ChatLayout regions require a ChatLayout");return r}function Ie(r){const e=_.c(25),{children:s,...i}=r,t=de(),n=le(),a=F.useRef(null),[l,c]=Pe(),{threadOpen:f,contentOpen:u}=i,d=xe(i),h=f&&u?l:d.side,m=100-h,j=g=>{const C=g.getLayout(),z=C[M],T=C[D];typeof z!="number"||typeof T!="number"||Math.abs(z-h)<.001&&Math.abs(T-m)<.001||g.setLayout({[M]:h,[D]:m})},b=je({visibility:i,threadVisibilityExplicit:i.threadVisibilityExplicit});let N;e[0]!==t||e[1]!==i||e[2]!==b?(N={...i,isMobile:t,mobileSurface:b},e[0]=t,e[1]=i,e[2]=b,e[3]=N):N=e[3];const p=N,O=t?p.mobileSurface==="chat":f;let S;e[4]!==t||e[5]!==i||e[6]!==n||e[7]!==p?(S=()=>{t?n({to:".",search:g=>({...g,...ye(p.mobileSurface==="chat"?"main":"chat")}),replace:!0}):i.toggleThread()},e[4]=t,e[5]=i,e[6]=n,e[7]=p,e[8]=S):S=e[8];let v;e[9]!==O||e[10]!==S?(v=o.jsx(pe,{open:O,onToggle:S}),e[9]=O,e[10]=S,e[11]=v):v=e[11];let x;e[12]!==s||e[13]!==u||e[14]!==m||e[15]!==t||e[16]!==c||e[17]!==j||e[18]!==f||e[19]!==h?(x=t?o.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:s}):o.jsx(ge,{ref:g=>{if(a.current=g,!g)return;let C=!0;return queueMicrotask(()=>{C&&j(g)}),()=>{C=!1,a.current===g&&(a.current=null)}},defaultLayout:{[M]:h,[D]:m},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(g,C)=>{const{isUserInteraction:z}=C;if(!z){const P=a.current;P&&j(P);return}const T=g[M];f&&u&&typeof T=="number"&&T>0&&T<100&&c(T)},children:s}),e[12]=s,e[13]=u,e[14]=m,e[15]=t,e[16]=c,e[17]=j,e[18]=f,e[19]=h,e[20]=x):x=e[20];let y;return e[21]!==v||e[22]!==x||e[23]!==p?(y=o.jsxs(H,{value:p,children:[v,x]}),e[21]=v,e[22]=x,e[23]=p,e[24]=y):y=e[24],y}function Me(r){const e=_.c(16),{children:s,topbar:i}=r,t=K();if(t.isMobile){let d;return e[0]!==s||e[1]!==t.mobileSurface||e[2]!==i?(d=t.mobileSurface==="chat"?o.jsxs(I,{variant:"plain","data-slot":"chat-layout-thread",children:[i,o.jsx(I.Content,{"data-testid":"chat-panel",children:s})]}):null,e[0]=s,e[1]=t.mobileSurface,e[2]=i,e[3]=d):d=e[3],d}const n=t.threadOpen?"":void 0;let a;e[4]!==s||e[5]!==t.threadOpen||e[6]!==i?(a=t.threadOpen&&o.jsxs(o.Fragment,{children:[i,o.jsx(I.Content,{"data-testid":"chat-panel",children:s})]}),e[4]=s,e[5]=t.threadOpen,e[6]=i,e[7]=a):a=e[7];let l;e[8]!==a?(l=o.jsx("div",{className:"h-full min-h-0 p-0.5",children:o.jsx(I,{"data-testid":"side-panel",children:a})}),e[8]=a,e[9]=l):l=e[9];let c;e[10]!==n||e[11]!==l?(c=o.jsx(X,{id:M,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n,className:"min-w-0 overflow-hidden bg-sidebar",children:l}),e[10]=n,e[11]=l,e[12]=c):c=e[12];let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(be,{className:"bg-sidebar"}),e[13]=f):f=e[13];let u;return e[14]!==c?(u=o.jsxs(o.Fragment,{children:[c,f]}),e[14]=c,e[15]=u):u=e[15],u}function Ae({children:r,routeId:e}){return r}function V(r){const e=_.c(25),{children:s,actions:i,drawer:t}=r,n=K();if(n.isMobile&&n.mobileSurface!=="main")return null;const a=n.isMobile?"plain":"card";let l;e[0]!==i||e[1]!==n.contentActions?(l=o.jsxs(o.Fragment,{children:[n.contentActions,i]}),e[0]=i,e[1]=n.contentActions,e[2]=l):l=e[2];let c;e[3]!==n.contentNavigation||e[4]!==l?(c=o.jsx(Oe,{navigation:n.contentNavigation,actions:l}),e[3]=n.contentNavigation,e[4]=l,e[5]=c):c=e[5];let f;e[6]!==s||e[7]!==n.contentKey?(f=o.jsx(re,{children:o.jsx(Ae,{routeId:n.contentKey,children:s})}),e[6]=s,e[7]=n.contentKey,e[8]=f):f=e[8];let u;e[9]!==n.contentKey||e[10]!==f?(u=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(ce,{children:f},n.contentKey)}),e[9]=n.contentKey,e[10]=f,e[11]=u):u=e[11];let d;e[12]!==t||e[13]!==u?(d=o.jsxs(I.Content,{children:[u,t]}),e[12]=t,e[13]=u,e[14]=d):d=e[14];let h;e[15]!==c||e[16]!==d?(h=o.jsxs(Y.Breadcrumbs.Provider,{children:[c,d]}),e[15]=c,e[16]=d,e[17]=h):h=e[17];let m;e[18]!==a||e[19]!==h?(m=o.jsx(I,{"data-testid":"main-panel",variant:a,children:h}),e[18]=a,e[19]=h,e[20]=m):m=e[20];const j=m;let b;return e[21]!==n.contentOpen||e[22]!==n.isMobile||e[23]!==j?(b=n.isMobile?j:o.jsx(X,{id:D,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:o.jsx("div",{className:"h-full min-h-0 p-0.5",children:j})}),e[21]=n.contentOpen,e[22]=n.isMobile,e[23]=j,e[24]=b):b=e[24],b}function Re(){const r=_.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(V,{children:o.jsx(ue,{})}),r[0]=e):e=r[0],e}function $e(r){const e=_.c(18),{error:s,reset:i}=r,t=q();let n;e[0]!==t?(n=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=n):n=e[1];let a;e[2]!==n?(a=o.jsx("h2",{className:"text-lg font-medium",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==s.message||e[5]!==t?(l=s.message||t("common.errorBoundary.unexpectedError"),e[4]=s.message,e[5]=t,e[6]=l):l=e[6];let c;e[7]!==l?(c=o.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:l}),e[7]=l,e[8]=c):c=e[8];let f;e[9]!==t?(f=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=f):f=e[10];let u;e[11]!==i||e[12]!==f?(u=o.jsx(W,{variant:"outline",onClick:i,children:f}),e[11]=i,e[12]=f,e[13]=u):u=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==u?(d=o.jsx(V,{children:o.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[a,c,u]})}),e[14]=a,e[15]=c,e[16]=u,e[17]=d):d=e[17],d}const Be=Object.assign(Ie,{Thread:Me,Content:V}),Je=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:Be,ChatLayoutError:$e,ChatLayoutPending:Re,useChatLayout:ke,useOptionalChatLayout:ee},Symbol.toStringTag,{value:"Module"}));export{Be as C,_e as I,Oe as R,Je as i};
1
+ import{c as _,U as te,V as ne,j as o,B as W,b as q,X as se,Y as oe,k as ae,L as ie,n as Y,r as F,d as le,ar as re,E as ce,P as I,aH as ue}from"./index-DUoAE5ST.js";import{u as de}from"./use-mobile-DPqh4jRn.js";import{m as fe,a as he,u as me,s as pe}from"./thread-button-C3p-T2Sx.js";import{a as X,R as ge,b as be}from"./resizable-D-ZGQzkV.js";import{f as xe,d as je,m as ye}from"./use-chat-layout-state-_HZU5xG7.js";import{G as Se,j as ve}from"./agent-icon-B1JUa-pK.js";import{s as Ce}from"./XClose-DXJf2S1e.js";import{T as J,a as Q,b as Z}from"./tooltip-DR03IHA1.js";import{T as G}from"./toolbar-icon-button-BYksvIS3.js";import{a as Te}from"./use-project-scope-Bo2r-DyF.js";import{f as Le}from"./repository-binding-B_NhY5XW.js";function U(r,e){const s=typeof r=="number"?r:Number(r);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Ne(r,e){const s=_.c(8);let i;s[0]!==e?(i=c=>U(c,e),s[0]=e,s[1]=i):i=s[1];const[t,n]=te(r,i);let a;s[2]!==e||s[3]!==t?(a=U(t,e),s[2]=e,s[3]=t,s[4]=a):a=s[4];let l;return s[5]!==n||s[6]!==a?(l=[a,n],s[5]=n,s[6]=a,s[7]=l):l=s[7],l}const ze=33;function Pe(){const r=_.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=ne.sidePanelWidth(),r[0]=e):e=r[0],Ne(e,ze)}function _e(r){const e=_.c(19);let s,i,t,n,a,l;e[0]!==r?({label:i,tooltipSide:n,variant:a,size:l,children:s,...t}=r,e[0]=r,e[1]=s,e[2]=i,e[3]=t,e[4]=n,e[5]=a,e[6]=l):(s=e[1],i=e[2],t=e[3],n=e[4],a=e[5],l=e[6]);const c=n===void 0?"top":n,f=a===void 0?"ghost":a,u=l===void 0?"icon-sm":l;let d;e[7]!==s||e[8]!==i||e[9]!==t||e[10]!==u||e[11]!==f?(d=o.jsx(J,{asChild:!0,children:o.jsx(W,{"data-slot":"icon-button","aria-label":i,variant:f,size:u,...t,children:s})}),e[7]=s,e[8]=i,e[9]=t,e[10]=u,e[11]=f,e[12]=d):d=e[12];let h;e[13]!==i||e[14]!==c?(h=o.jsx(Q,{side:c,children:i}),e[13]=i,e[14]=c,e[15]=h):h=e[15];let m;return e[16]!==d||e[17]!==h?(m=o.jsxs(Z,{children:[d,h]}),e[16]=d,e[17]=h,e[18]=m):m=e[18],m}function Oe(r){const e=_.c(59),{actions:s,navigation:i}=r,t=q(),{org:n}=se(),a=Te(),l=Le(a),c=fe(),{toggleSidebar:f}=he(),u=me(),d=ee(),h=oe();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={select:Ee},e[0]=m):m=e[0];const j=ae(m),b=j?.mainView==="overview";let N;e[1]!==l?.title||e[2]!==t?(N=l?.title??t("common.loading"),e[1]=l?.title,e[2]=t,e[3]=N):N=e[3];const p=N;let O;e[4]!==b||e[5]!==j?.pageTitle||e[6]!==p||e[7]!==a||e[8]!==t?(O=b?a?p:t("sidebar.navDestinations.home"):t(j?.pageTitle??"page.view"),e[4]=b,e[5]=j?.pageTitle,e[6]=p,e[7]=a,e[8]=t,e[9]=O):O=e[9];const S=O;let v;e[10]!==n.slug||e[11]!==h||e[12]!==a?(v=h?{to:"/$org/projects",params:{org:n.slug},search:{project:a??void 0}}:{to:"/$org/projects/$agentId",params:{org:n.slug,agentId:a??""}},e[10]=n.slug,e[11]=h,e[12]=a,e[13]=v):v=e[13];const x=v;let y;if(e[14]!==c||e[15]!==b||e[16]!==n.slug||e[17]!==x||e[18]!==p||e[19]!==a||e[20]!==t||e[21]!==S){if(y=[],c){let L;e[23]!==t?(L=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=L):L=e[24];let k;e[25]!==n.slug?(k={to:"/$org/settings/general",params:{org:n.slug}},e[25]=n.slug,e[26]=k):k=e[26];let B;e[27]!==L||e[28]!==k?(B={key:"settings",label:L,link:k},e[27]=L,e[28]=k,e[29]=B):B=e[29],y.push(B)}else if(a&&!b){let L;e[30]!==x||e[31]!==p?(L={key:"project",label:p,link:x},e[30]=x,e[31]=p,e[32]=L):L=e[32],y.push(L)}let $;e[33]!==S?($={key:"page",label:S},e[33]=S,e[34]=$):$=e[34],y.push($),e[14]=c,e[15]=b,e[16]=n.slug,e[17]=x,e[18]=p,e[19]=a,e[20]=t,e[21]=S,e[22]=y}else y=e[22];let g;e[35]!==x||e[36]!==a||e[37]!==t||e[38]!==u?(g=u&&a&&o.jsx(_e,{label:t("projects.flat.close"),asChild:!0,children:o.jsx(ie,{...x,children:o.jsx(Ce,{size:16})})}),e[35]=x,e[36]=a,e[37]=t,e[38]=u,e[39]=g):g=e[39];const C=g;let z;e[40]!==d||e[41]!==t||e[42]!==u?(z=u&&d&&o.jsxs(Z,{children:[o.jsx(J,{asChild:!0,children:o.jsx(G,{"aria-label":t(d.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":d.threadOpen,active:d.threadOpen,onClick:d.toggleThread,children:o.jsx(Se,{size:16})})}),o.jsx(Q,{side:"bottom",children:t(d.threadOpen?"page.closeThread":"page.openThread")})]}),e[40]=d,e[41]=t,e[42]=u,e[43]=z):z=e[43];const T=z;let P;e[44]!==t?(P=t("layouts.shellControls.toggleSidebar"),e[44]=t,e[45]=P):P=e[45];let A;e[46]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(ve,{size:16}),e[46]=A):A=e[46];let E;e[47]!==P||e[48]!==f?(E=o.jsx(G,{className:"md:hidden",onClick:f,"aria-label":P,children:A}),e[47]=P,e[48]=f,e[49]=E):E=e[49];let w;e[50]!==T||e[51]!==E?(w=o.jsxs(o.Fragment,{children:[E,T]}),e[50]=T,e[51]=E,e[52]=w):w=e[52];let R;return e[53]!==s||e[54]!==y||e[55]!==C||e[56]!==i||e[57]!==w?(R=o.jsx(Y.Header,{leading:w,breadcrumbs:y,actions:s,trailingActions:C,navigation:i}),e[53]=s,e[54]=y,e[55]=C,e[56]=i,e[57]=w,e[58]=R):R=e[58],R}function Ee(r){return r.matches.findLast(we)?.staticData}function we(r){return r.staticData.pageTitle}const M="chat-layout-thread",D="chat-layout-content",H=F.createContext(null);function ke(){return K()}function ee(){return F.use(H)}function K(){const r=F.use(H);if(!r)throw new Error("ChatLayout regions require a ChatLayout");return r}function Ie(r){const e=_.c(25),{children:s,...i}=r,t=de(),n=le(),a=F.useRef(null),[l,c]=Pe(),{threadOpen:f,contentOpen:u}=i,d=xe(i),h=f&&u?l:d.side,m=100-h,j=g=>{const C=g.getLayout(),z=C[M],T=C[D];typeof z!="number"||typeof T!="number"||Math.abs(z-h)<.001&&Math.abs(T-m)<.001||g.setLayout({[M]:h,[D]:m})},b=je({visibility:i,threadVisibilityExplicit:i.threadVisibilityExplicit});let N;e[0]!==t||e[1]!==i||e[2]!==b?(N={...i,isMobile:t,mobileSurface:b},e[0]=t,e[1]=i,e[2]=b,e[3]=N):N=e[3];const p=N,O=t?p.mobileSurface==="chat":f;let S;e[4]!==t||e[5]!==i||e[6]!==n||e[7]!==p?(S=()=>{t?n({to:".",search:g=>({...g,...ye(p.mobileSurface==="chat"?"main":"chat")}),replace:!0}):i.toggleThread()},e[4]=t,e[5]=i,e[6]=n,e[7]=p,e[8]=S):S=e[8];let v;e[9]!==O||e[10]!==S?(v=o.jsx(pe,{open:O,onToggle:S}),e[9]=O,e[10]=S,e[11]=v):v=e[11];let x;e[12]!==s||e[13]!==u||e[14]!==m||e[15]!==t||e[16]!==c||e[17]!==j||e[18]!==f||e[19]!==h?(x=t?o.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:s}):o.jsx(ge,{ref:g=>{if(a.current=g,!g)return;let C=!0;return queueMicrotask(()=>{C&&j(g)}),()=>{C=!1,a.current===g&&(a.current=null)}},defaultLayout:{[M]:h,[D]:m},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(g,C)=>{const{isUserInteraction:z}=C;if(!z){const P=a.current;P&&j(P);return}const T=g[M];f&&u&&typeof T=="number"&&T>0&&T<100&&c(T)},children:s}),e[12]=s,e[13]=u,e[14]=m,e[15]=t,e[16]=c,e[17]=j,e[18]=f,e[19]=h,e[20]=x):x=e[20];let y;return e[21]!==v||e[22]!==x||e[23]!==p?(y=o.jsxs(H,{value:p,children:[v,x]}),e[21]=v,e[22]=x,e[23]=p,e[24]=y):y=e[24],y}function Me(r){const e=_.c(16),{children:s,topbar:i}=r,t=K();if(t.isMobile){let d;return e[0]!==s||e[1]!==t.mobileSurface||e[2]!==i?(d=t.mobileSurface==="chat"?o.jsxs(I,{variant:"plain","data-slot":"chat-layout-thread",children:[i,o.jsx(I.Content,{"data-testid":"chat-panel",children:s})]}):null,e[0]=s,e[1]=t.mobileSurface,e[2]=i,e[3]=d):d=e[3],d}const n=t.threadOpen?"":void 0;let a;e[4]!==s||e[5]!==t.threadOpen||e[6]!==i?(a=t.threadOpen&&o.jsxs(o.Fragment,{children:[i,o.jsx(I.Content,{"data-testid":"chat-panel",children:s})]}),e[4]=s,e[5]=t.threadOpen,e[6]=i,e[7]=a):a=e[7];let l;e[8]!==a?(l=o.jsx("div",{className:"h-full min-h-0 p-0.5",children:o.jsx(I,{"data-testid":"side-panel",children:a})}),e[8]=a,e[9]=l):l=e[9];let c;e[10]!==n||e[11]!==l?(c=o.jsx(X,{id:M,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n,className:"min-w-0 overflow-hidden bg-sidebar",children:l}),e[10]=n,e[11]=l,e[12]=c):c=e[12];let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(be,{className:"bg-sidebar"}),e[13]=f):f=e[13];let u;return e[14]!==c?(u=o.jsxs(o.Fragment,{children:[c,f]}),e[14]=c,e[15]=u):u=e[15],u}function Ae({children:r,routeId:e}){return r}function V(r){const e=_.c(25),{children:s,actions:i,drawer:t}=r,n=K();if(n.isMobile&&n.mobileSurface!=="main")return null;const a=n.isMobile?"plain":"card";let l;e[0]!==i||e[1]!==n.contentActions?(l=o.jsxs(o.Fragment,{children:[n.contentActions,i]}),e[0]=i,e[1]=n.contentActions,e[2]=l):l=e[2];let c;e[3]!==n.contentNavigation||e[4]!==l?(c=o.jsx(Oe,{navigation:n.contentNavigation,actions:l}),e[3]=n.contentNavigation,e[4]=l,e[5]=c):c=e[5];let f;e[6]!==s||e[7]!==n.contentKey?(f=o.jsx(re,{children:o.jsx(Ae,{routeId:n.contentKey,children:s})}),e[6]=s,e[7]=n.contentKey,e[8]=f):f=e[8];let u;e[9]!==n.contentKey||e[10]!==f?(u=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(ce,{children:f},n.contentKey)}),e[9]=n.contentKey,e[10]=f,e[11]=u):u=e[11];let d;e[12]!==t||e[13]!==u?(d=o.jsxs(I.Content,{children:[u,t]}),e[12]=t,e[13]=u,e[14]=d):d=e[14];let h;e[15]!==c||e[16]!==d?(h=o.jsxs(Y.Breadcrumbs.Provider,{children:[c,d]}),e[15]=c,e[16]=d,e[17]=h):h=e[17];let m;e[18]!==a||e[19]!==h?(m=o.jsx(I,{"data-testid":"main-panel",variant:a,children:h}),e[18]=a,e[19]=h,e[20]=m):m=e[20];const j=m;let b;return e[21]!==n.contentOpen||e[22]!==n.isMobile||e[23]!==j?(b=n.isMobile?j:o.jsx(X,{id:D,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:o.jsx("div",{className:"h-full min-h-0 p-0.5",children:j})}),e[21]=n.contentOpen,e[22]=n.isMobile,e[23]=j,e[24]=b):b=e[24],b}function Re(){const r=_.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(V,{children:o.jsx(ue,{})}),r[0]=e):e=r[0],e}function $e(r){const e=_.c(18),{error:s,reset:i}=r,t=q();let n;e[0]!==t?(n=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=n):n=e[1];let a;e[2]!==n?(a=o.jsx("h2",{className:"text-lg font-medium",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==s.message||e[5]!==t?(l=s.message||t("common.errorBoundary.unexpectedError"),e[4]=s.message,e[5]=t,e[6]=l):l=e[6];let c;e[7]!==l?(c=o.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:l}),e[7]=l,e[8]=c):c=e[8];let f;e[9]!==t?(f=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=f):f=e[10];let u;e[11]!==i||e[12]!==f?(u=o.jsx(W,{variant:"outline",onClick:i,children:f}),e[11]=i,e[12]=f,e[13]=u):u=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==u?(d=o.jsx(V,{children:o.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[a,c,u]})}),e[14]=a,e[15]=c,e[16]=u,e[17]=d):d=e[17],d}const Be=Object.assign(Ie,{Thread:Me,Content:V}),Je=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:Be,ChatLayoutError:$e,ChatLayoutPending:Re,useChatLayout:ke,useOptionalChatLayout:ee},Symbol.toStringTag,{value:"Module"}));export{Be as C,_e as I,Oe as R,Je as i};
@@ -1 +1 @@
1
- import{j as W,h as $,U as D,V as We,T as H,W as A,X as U,Y as G,Z as J,_ as je,$ as me,a0 as qe,a1 as we,a2 as Xe,E as be,a3 as Ye,a4 as Ge,d as ve}from"./index-CBLynFUh.js";import{eD as ye,eS as Ce,eC as Se,eT as Re,eU as Ee,eV as Te,eW as Oe,eX as Ie,eF as Ae,e6 as Me,r as C,aO as ze}from"./index-CeFrI_-f.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new We(r.resolve(h),r.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ee(o)&&ee(i)&&ie(o,i)){const s=this.$anchorCell.node(-1)!=o.node(-1);return s&&this.isRowSelection()?z.rowSelection(o,i):s&&this.isColSelection()?z.colSelection(o,i):new z(o,i)}return H.between(o,i)}content(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),s={},l=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=t.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,m=f.right-i.right;if(g>0||m>0){let w=p.attrs;if(g>0&&(w=P(w,0,g)),m>0&&(w=P(w,w.colspan-m,m)),f.left<i.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(f.top<i.top||f.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}l.push(t.child(a).copy(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=je({ArrowLeft:K("horiz",-1),ArrowRight:K("horiz",1),ArrowUp:K("vert",-1),ArrowDown:K("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:V,"Mod-Backspace":V,Delete:V,"Mod-Delete":V});function k(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function K(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof b)return k(n,o,D.near(s.$headCell,t));if(e!="horiz"&&!s.empty)return!1;const l=Le(i,e,t);if(l==null)return!1;if(e=="horiz")return k(n,o,D.near(n.doc.resolve(s.head+t),t));{const r=n.doc.resolve(l),a=De(r,e,t);let c;return a?c=D.near(a,1):t<0?c=D.near(n.doc.resolve(r.before(-1)),-1):c=D.near(n.doc.resolve(r.after(-1)),1),k(n,o,c)}}}function _(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof b)l=s;else{const a=Le(i,e,t);if(a==null)return!1;l=new b(n.doc.resolve(a))}const r=De(l.$headCell,e,t);return r?k(n,o,new b(l.$anchorCell,r)):!1}}function Tt(e,t){const n=e.state.doc,o=N(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function Ot(e,t,n){if(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
1
+ import{j as W,h as $,U as D,V as We,T as H,W as A,X as U,Y as G,Z as J,_ as je,$ as me,a0 as qe,a1 as we,a2 as Xe,E as be,a3 as Ye,a4 as Ge,d as ve}from"./index-T9qmd0M1.js";import{eD as ye,eS as Ce,eC as Se,eT as Re,eU as Ee,eV as Te,eW as Oe,eX as Ie,eF as Ae,e6 as Me,r as C,aO as ze}from"./index-DUoAE5ST.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new We(r.resolve(h),r.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ee(o)&&ee(i)&&ie(o,i)){const s=this.$anchorCell.node(-1)!=o.node(-1);return s&&this.isRowSelection()?z.rowSelection(o,i):s&&this.isColSelection()?z.colSelection(o,i):new z(o,i)}return H.between(o,i)}content(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),s={},l=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=t.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,m=f.right-i.right;if(g>0||m>0){let w=p.attrs;if(g>0&&(w=P(w,0,g)),m>0&&(w=P(w,w.colspan-m,m)),f.left<i.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(f.top<i.top||f.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}l.push(t.child(a).copy(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=je({ArrowLeft:K("horiz",-1),ArrowRight:K("horiz",1),ArrowUp:K("vert",-1),ArrowDown:K("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:V,"Mod-Backspace":V,Delete:V,"Mod-Delete":V});function k(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function K(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof b)return k(n,o,D.near(s.$headCell,t));if(e!="horiz"&&!s.empty)return!1;const l=Le(i,e,t);if(l==null)return!1;if(e=="horiz")return k(n,o,D.near(n.doc.resolve(s.head+t),t));{const r=n.doc.resolve(l),a=De(r,e,t);let c;return a?c=D.near(a,1):t<0?c=D.near(n.doc.resolve(r.before(-1)),-1):c=D.near(n.doc.resolve(r.after(-1)),1),k(n,o,c)}}}function _(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof b)l=s;else{const a=Le(i,e,t);if(a==null)return!1;l=new b(n.doc.resolve(a))}const r=De(l.$headCell,e,t);return r?k(n,o,new b(l.$anchorCell,r)):!1}}function Tt(e,t){const n=e.state.doc,o=N(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function Ot(e,t,n){if(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
@@ -1 +1 @@
1
- import{r as l,br as ce,j as p,bp as _,bo as T,bm as C,bw as le,bq as de,bJ as ue,bF as fe,by as me}from"./index-CeFrI_-f.js";import{e as Y}from"./select-CKIWskoO.js";var $=["PageUp","PageDown"],X=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[H,Se,pe]=le(M),[W]=fe(M,[pe]),[he,V]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],K]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),j=l.useRef(S);function B(x){const y=ye(S,x);I(x,y)}function se(x){I(x,f.current)}function ae(){const x=j.current[f.current];S[f.current]!==x&&d(S)}function I(x,y,{commit:k}={commit:!1}){const F=_e(c),z=Ce(Math.round((x-n)/c)*c+n,F),A=Y(z,[n,s]);K((E=[])=>{const P=xe(E,A,y);if(Ee(P,u*c)){f.current=P.indexOf(A);const U=String(P)!==String(E);return U&&k&&d(P),U?P:E}else return E})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(H.Provider,{scope:e.__scopeSlider,children:p.jsx(H.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(j.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&I(n,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const z=$.includes(x.key)||x.shiftKey&&X.includes(x.key)?10:1,A=f.current,E=S[A],P=c*z*y;I(E+P,A,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function D(w){const S=R.current||i.getBoundingClientRect(),K=[0,S.width],B=O(K,f?[o,n]:[n,o]);return R.current=S,B(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=D(w.clientX);r?.(S)},onSlideMove:w=>{const S=D(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const K=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:K?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=V(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):$.concat(X).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=V(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,D=>b(D)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(H.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function De(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Ee(e,t){if(t>0){const o=De(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ie=q,Ae=te,Te=ne,Ve=oe;export{Ie as R,Ae as T,Te as a,Ve as b};
1
+ import{r as l,br as ce,j as p,bp as _,bo as T,bm as C,bw as le,bq as de,bJ as ue,bF as fe,by as me}from"./index-DUoAE5ST.js";import{e as Y}from"./select-BqWleZPz.js";var $=["PageUp","PageDown"],X=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[H,Se,pe]=le(M),[W]=fe(M,[pe]),[he,V]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],K]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),j=l.useRef(S);function B(x){const y=ye(S,x);I(x,y)}function se(x){I(x,f.current)}function ae(){const x=j.current[f.current];S[f.current]!==x&&d(S)}function I(x,y,{commit:k}={commit:!1}){const F=_e(c),z=Ce(Math.round((x-n)/c)*c+n,F),A=Y(z,[n,s]);K((E=[])=>{const P=xe(E,A,y);if(Ee(P,u*c)){f.current=P.indexOf(A);const U=String(P)!==String(E);return U&&k&&d(P),U?P:E}else return E})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(H.Provider,{scope:e.__scopeSlider,children:p.jsx(H.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(j.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&I(n,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const z=$.includes(x.key)||x.shiftKey&&X.includes(x.key)?10:1,A=f.current,E=S[A],P=c*z*y;I(E+P,A,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function D(w){const S=R.current||i.getBoundingClientRect(),K=[0,S.width],B=O(K,f?[o,n]:[n,o]);return R.current=S,B(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=D(w.clientX);r?.(S)},onSlideMove:w=>{const S=D(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const K=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:K?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=V(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):$.concat(X).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=V(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,D=>b(D)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(H.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function De(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Ee(e,t){if(t>0){const o=De(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ie=q,Ae=te,Te=ne,Ve=oe;export{Ie as R,Ae as T,Te as a,Ve as b};