decocms 4.519.0 → 4.521.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-DpnSicPy.js → ActiveShapeUtils-NiXAWNnI.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-DBK8R4dI.js → AlertCircle-DGVmeswV.js} +1 -1
  3. package/dist/client/assets/{AreaChart-CeMTC5TB.js → AreaChart-DL7RX4W6.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-BhYsdDhs.js → ArrowLeft-DDWHto_R.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-B-samV76.js → ArrowUp-bm_9Fp5i.js} +1 -1
  6. package/dist/client/assets/{BarChart-D4vvVhNP.js → BarChart-DmTON82J.js} +1 -1
  7. package/dist/client/assets/{Building02-BVkscSyZ.js → Building02-p3_mZ-E2.js} +1 -1
  8. package/dist/client/assets/{CartesianChart-D5TCh86n.js → CartesianChart-oH_IqMjj.js} +1 -1
  9. package/dist/client/assets/{CategoricalChart-BlWkKGI4.js → CategoricalChart-Dy74bBD9.js} +1 -1
  10. package/dist/client/assets/{CheckCircle-Bnnstx7h.js → CheckCircle-Bx5iI6Lz.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-rEBuyaLs.js → ChevronSelectorVertical-CtVpNCaH.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-CBJitQaC.js → ChevronUp-ojSOtVX2.js} +1 -1
  13. package/dist/client/assets/{Copy01-B-Kqql1v.js → Copy01-CixCoZek.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-BuvGgoKU.js → CreditCard01-D0K-VlXU.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-kTicVrIf.js → DotsVertical-DzE0Ijkk.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-BUVr9l59.js → ErrorBarContext-DRS3e7xk.js} +1 -1
  17. package/dist/client/assets/{Globe04-KYEPLfFL.js → Globe04-CE15ScrO.js} +1 -1
  18. package/dist/client/assets/{Image01-D5xmdMv9.js → Image01-Bks737AT.js} +1 -1
  19. package/dist/client/assets/{Key01-egFT7DX9.js → Key01-CxbATohw.js} +1 -1
  20. package/dist/client/assets/{Link01-DbW4kVwR.js → Link01-DCdDhO7H.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-OntVHV0h.js → LinkBroken01-ZF7OlrXq.js} +1 -1
  22. package/dist/client/assets/{Minus-DN-1q402.js → Minus-DqMKpYLh.js} +1 -1
  23. package/dist/client/assets/{Monitor01-QBQW5XNf.js → Monitor01-B-_Pl3qs.js} +1 -1
  24. package/dist/client/assets/{Play-COeyqncs.js → Play-B6eaz3Uv.js} +1 -1
  25. package/dist/client/assets/{Plus-B4v3GkBC.js → Plus-B28tKNm1.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-5iYQv1Rq.js → ReferenceLine-C5aqWs1r.js} +1 -1
  27. package/dist/client/assets/{SearchMd-DWVKWjSh.js → SearchMd-OCyidoZI.js} +1 -1
  28. package/dist/client/assets/{Sector-CExKcwxp.js → Sector-CtNXSnWN.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-BhCtEuhY.js → ShoppingBag01-DHyiQNjO.js} +1 -1
  30. package/dist/client/assets/{Sun-DXxrAWEA.js → Sun-BUl5hUgs.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-ByDhQXb-.js → SwitchHorizontal01-BKu4aB4V.js} +1 -1
  32. package/dist/client/assets/{Tool01-Bhwq8fKA.js → Tool01-CnZckhqi.js} +1 -1
  33. package/dist/client/assets/{Trash01-BJcybrX2.js → Trash01-C34kFeWG.js} +1 -1
  34. package/dist/client/assets/{Upload01-D6z8pgdP.js → Upload01-sDXthFWJ.js} +1 -1
  35. package/dist/client/assets/{User01-BaPQvgQq.js → User01-2Hx1yZRb.js} +1 -1
  36. package/dist/client/assets/UserSquare-UeuSXkL4.js +1 -0
  37. package/dist/client/assets/{Users01-OOPFNu5a.js → Users01-D78JG135.js} +1 -1
  38. package/dist/client/assets/{XClose-DbFkM30N.js → XClose-BbuvN9Qp.js} +1 -1
  39. package/dist/client/assets/{ZoomOut-CKf6RmrA.js → ZoomOut-DnRMz8gp.js} +1 -1
  40. package/dist/client/assets/{access-gate-Bp5g1mrg.js → access-gate-B-XccyUi.js} +1 -1
  41. package/dist/client/assets/{add-connection-dialog-C3wKqrUu.js → add-connection-dialog-3BCYyOlq.js} +1 -1
  42. package/dist/client/assets/agent-analytics-CwuUduKr.js +1 -0
  43. package/dist/client/assets/agent-app-Dd83t7Jr.js +1 -0
  44. package/dist/client/assets/{agent-assets-CXlM6UQS.js → agent-assets-BX70IHOT.js} +1 -1
  45. package/dist/client/assets/{agent-automation-C1KFlSjr.js → agent-automation-DSOT91yw.js} +1 -1
  46. package/dist/client/assets/{agent-automations-BXeaRV79.js → agent-automations-DELrtNmQ.js} +1 -1
  47. package/dist/client/assets/agent-calendar-DAFHiZ7t.js +1 -0
  48. package/dist/client/assets/{agent-connect-sources-ByDR9dOm.js → agent-connect-sources-EYRSBit6.js} +1 -1
  49. package/dist/client/assets/agent-deck-19EIpeOv.js +1 -0
  50. package/dist/client/assets/agent-e2e-DgDrdrOU.js +1 -0
  51. package/dist/client/assets/agent-experiments-CDIR-vBl.js +1 -0
  52. package/dist/client/assets/agent-file-Crkwe1n0.js +1 -0
  53. package/dist/client/assets/agent-hosting-COv9KqxJ.js +1 -0
  54. package/dist/client/assets/agent-icon-2Sd6TPJR.js +1 -0
  55. package/dist/client/assets/agent-library-6vXi0pmB.js +1 -0
  56. package/dist/client/assets/agent-library-file-D_31XTpy.js +1 -0
  57. package/dist/client/assets/agent-monitor-DZGhzZ5b.js +1 -0
  58. package/dist/client/assets/{agent-overview-CSyXy3g4.js → agent-overview-jQR56ImR.js} +1 -1
  59. package/dist/client/assets/{agent-releases-srD8iHFc.js → agent-releases-1LcFLBWb.js} +1 -1
  60. package/dist/client/assets/agent-settings-BJW57Xya.js +1 -0
  61. package/dist/client/assets/{agent-site-editor-C0gN8EWt.js → agent-site-editor-FH5rkph4.js} +1 -1
  62. package/dist/client/assets/agent-site-editor-code-Dp5l17ta.js +2 -0
  63. package/dist/client/assets/agent-site-editor-content-BIwmC0as.js +1 -0
  64. package/dist/client/assets/agent-site-editor-preview-DJt8FppE.js +1 -0
  65. package/dist/client/assets/agent-view-DuXo8UyN.js +1 -0
  66. package/dist/client/assets/{agent-view-guard-IwJPeHon.js → agent-view-guard-BtSTYr3f.js} +1 -1
  67. package/dist/client/assets/{agents-list-kkn2potC.js → agents-list-BciltAjT.js} +1 -1
  68. package/dist/client/assets/{ai-providers-B1i5Zd64.js → ai-providers-1_g2-YFO.js} +1 -1
  69. package/dist/client/assets/{alert-CfW38lSF.js → alert-B6jt7ehz.js} +1 -1
  70. package/dist/client/assets/{alert-dialog-DOm8vTAh.js → alert-dialog-C6IuYhIc.js} +1 -1
  71. package/dist/client/assets/{analytics-sections-BnQKN24n.js → analytics-sections-CMbHJdjJ.js} +1 -1
  72. package/dist/client/assets/{analytics-tab-BPISXjrq.js → analytics-tab-BptBREH9.js} +1 -1
  73. package/dist/client/assets/{api-keys-B0NZlktL.js → api-keys-DNoVGHBL.js} +1 -1
  74. package/dist/client/assets/api-keys-YdF23sAO.js +1 -0
  75. package/dist/client/assets/{app-editor-Cl4XOhpA.js → app-editor-DIGpXnGi.js} +1 -1
  76. package/dist/client/assets/app-preview-url-DmK5uokM.js +1 -0
  77. package/dist/client/assets/{asset-utils-DE9emOC4.js → asset-utils-BaoKrfcS.js} +1 -1
  78. package/dist/client/assets/{auth-JXZLGOBb.js → auth-MbbNpK0f.js} +1 -1
  79. package/dist/client/assets/{auth-catchall-DJ8C8A5P.js → auth-catchall-CQhqMFI7.js} +1 -1
  80. package/dist/client/assets/{auth-entry-CRJg2jV6.js → auth-entry-BytQWBJH.js} +1 -1
  81. package/dist/client/assets/{auth-split-layout-Cb2N96wc.js → auth-split-layout-BLy72f6M.js} +1 -1
  82. package/dist/client/assets/{authenticate-and-persist-oauth-Sm0OtDe1.js → authenticate-and-persist-oauth-ChOS0TQ8.js} +1 -1
  83. package/dist/client/assets/{automation-list-row-DLS7nqs1.js → automation-list-row-CDTQ4wXs.js} +1 -1
  84. package/dist/client/assets/{automation-runs-DGVHidy8.js → automation-runs-uGIsi6Hf.js} +1 -1
  85. package/dist/client/assets/{automations-w7eRZ4NJ.js → automations-CYPV9xM6.js} +1 -1
  86. package/dist/client/assets/{autosend-YiZkI0k7.js → autosend-nr-hPbHj.js} +1 -1
  87. package/dist/client/assets/{avatar-BD2PDf8q.js → avatar-DarGMVT9.js} +1 -1
  88. package/dist/client/assets/{badge-CDeaoqCi.js → badge-7nY_ai7T.js} +1 -1
  89. package/dist/client/assets/{block-document-BleRxhvK.js → block-document-BFjSBfhL.js} +1 -1
  90. package/dist/client/assets/{blocks-preview-workspace-context-D22eN4p4.js → blocks-preview-workspace-context-CPEN608S.js} +1 -1
  91. package/dist/client/assets/{blocks-tab-states-g8ibEmjD.js → blocks-tab-states-DEKXC5rW.js} +1 -1
  92. package/dist/client/assets/{blog-schema-CrKFhIXz.js → blog-schema-DXeDEF-x.js} +1 -1
  93. package/dist/client/assets/{buckets-DRYNl_Gz.js → buckets-Fnw-QnpR.js} +1 -1
  94. package/dist/client/assets/{build-improve-prompt-doc-C1y7z_kF.js → build-improve-prompt-doc-BNyp6j2d.js} +1 -1
  95. package/dist/client/assets/{calendar-jrNp7aMz.js → calendar-D8eqk8F_.js} +1 -1
  96. package/dist/client/assets/{campaigns-view-BgZ9KvqV.js → campaigns-view-DwenRJ4m.js} +1 -1
  97. package/dist/client/assets/{capability-load-error-tQkVlgGI.js → capability-load-error-DK8yJwbi.js} +1 -1
  98. package/dist/client/assets/{category-editor-CtUbDM-y.js → category-editor-CvvoknG-.js} +1 -1
  99. package/dist/client/assets/{cdn-tab-wOWVfYEi.js → cdn-tab-DGngqFre.js} +1 -1
  100. package/dist/client/assets/{chart-BBE_aWjm.js → chart-BVOKVwol.js} +1 -1
  101. package/dist/client/assets/{chat-context-C1JvjRtO.js → chat-context-4LDKQ9-8.js} +1 -1
  102. package/dist/client/assets/{chat-draft-B0O1aMg3.js → chat-draft-DtnFj70R.js} +1 -1
  103. package/dist/client/assets/{checkbox-BQV5rQq6.js → checkbox--QGg9JL6.js} +1 -1
  104. package/dist/client/assets/{choose-editor-Cco5iYhS.js → choose-editor-Co3gZPYu.js} +1 -1
  105. package/dist/client/assets/{cli-auth-success-C0BkGk_m.js → cli-auth-success-PhyGH5OW.js} +1 -1
  106. package/dist/client/assets/{client-icons-CSB7_p4A.js → client-icons-C_ct3pd0.js} +1 -1
  107. package/dist/client/assets/cms-settings-editor-VrhsAjtC.js +1 -0
  108. package/dist/client/assets/{collapsible-DyKYJwPy.js → collapsible-DGVOZrNj.js} +1 -1
  109. package/dist/client/assets/{collection-detail-BvgJ-RrS.js → collection-detail-BAmfEJxU.js} +1 -1
  110. package/dist/client/assets/{collection-display-button-IJ7oRZnA.js → collection-display-button-ClKK9pYP.js} +1 -1
  111. package/dist/client/assets/{collection-search-DF8xKBAI.js → collection-search-DRo1WmLT.js} +1 -1
  112. package/dist/client/assets/{collection-table-wrapper-N4bJjHS6.js → collection-table-wrapper-Dgqpnsq8.js} +1 -1
  113. package/dist/client/assets/{collection-tabs-DUP2Wv2k.js → collection-tabs-Dc2dImyc.js} +1 -1
  114. package/dist/client/assets/{column-rules-CzVSaEJv.js → column-rules-DiqfCnEN.js} +1 -1
  115. package/dist/client/assets/{combobox-DSv_uY1C.js → combobox-DZgmK343.js} +1 -1
  116. package/dist/client/assets/{command-C2RTsWLU.js → command-CPx9UwtG.js} +1 -1
  117. package/dist/client/assets/{companion-mcps-section-Om4Xi1g-.js → companion-mcps-section-CLb76BIo.js} +1 -1
  118. package/dist/client/assets/{config-CnSMG0Cu.js → config-CxVvKo3A.js} +1 -1
  119. package/dist/client/assets/{connect-Cyhyxw9Y.js → connect-A3Avs8Pl.js} +1 -1
  120. package/dist/client/assets/{connect-layout-Zlm12dcn.js → connect-layout-BksXTmdN.js} +1 -1
  121. package/dist/client/assets/{connect-source-dialog-DNnWnFk9.js → connect-source-dialog-DSaPW3-r.js} +1 -1
  122. package/dist/client/assets/{connection-CKGquOu0.js → connection-GML1C2tu.js} +1 -1
  123. package/dist/client/assets/{connection-card-CeElSdkP.js → connection-card-ZvVd_UVc.js} +1 -1
  124. package/dist/client/assets/{connection-detail-XrFXQKQo.js → connection-detail-DtbzbTIM.js} +1 -1
  125. package/dist/client/assets/{connection-form-helpers-D5tlzOOb.js → connection-form-helpers-CGyT85pi.js} +1 -1
  126. package/dist/client/assets/{connections-WO7Na7dg.js → connections-D4x-lAFA.js} +1 -1
  127. package/dist/client/assets/{content-tab-C3B5hAv_.js → content-tab-DgdEt3c6.js} +3 -3
  128. package/dist/client/assets/{context-BojR4HN9.js → context-BcuOiE0n.js} +1 -1
  129. package/dist/client/assets/{context-menu-22sCTgBs.js → context-menu-BPat3chT.js} +1 -1
  130. package/dist/client/assets/{context-shell-D1N7epOl.js → context-shell-BpD_TiZV.js} +3 -3
  131. package/dist/client/assets/{core.esm-QVBuVFEZ.js → core.esm-CumN7OYl.js} +2 -2
  132. package/dist/client/assets/{create-organization-dialog-D6kuk20k.js → create-organization-dialog-C7cTp33N.js} +1 -1
  133. package/dist/client/assets/{daily-pulse-CQHr9nNT.js → daily-pulse-DIdfLtIG.js} +1 -1
  134. package/dist/client/assets/{discover-C-_i2-PM.js → discover-CG4C5Odc.js} +1 -1
  135. package/dist/client/assets/{domain-settings-C-dCekXs.js → domain-settings-DkAHUlQw.js} +1 -1
  136. package/dist/client/assets/{drawer-_y_lX-Yn.js → drawer-Bp7WNOCz.js} +1 -1
  137. package/dist/client/assets/{editor-D3dE1UTI.js → editor-CmZJbc4Z.js} +1 -1
  138. package/dist/client/assets/{editor-classes-Bzr4sAFl.js → editor-classes-DYddjmhz.js} +1 -1
  139. package/dist/client/assets/{empty-state-C-9cwlrp.js → empty-state-DBHadTD8.js} +1 -1
  140. package/dist/client/assets/{empty-state-gsVYH7fP.js → empty-state-vh9cmtA2.js} +1 -1
  141. package/dist/client/assets/{experiments-tab-CeVz9r9-.js → experiments-tab-BaB_Zi0V.js} +1 -1
  142. package/dist/client/assets/{experiments-tab-choice-2QAdfouX.js → experiments-tab-choice-p3E1pILX.js} +1 -1
  143. package/dist/client/assets/{extract-connection-data-CgXJmK0-.js → extract-connection-data-C2lA8ZOm.js} +1 -1
  144. package/dist/client/assets/{feature-gate-C5He1Jql.js → feature-gate-D8HHU_kV.js} +1 -1
  145. package/dist/client/assets/{feature-paywall-BKaJGna9.js → feature-paywall-CRRIPYfS.js} +1 -1
  146. package/dist/client/assets/{file-explorer-v9KulF9f.js → file-explorer-BTIbvupP.js} +1 -1
  147. package/dist/client/assets/{file-preview-BJJubHbu.js → file-preview-CsDpTAv6.js} +1 -1
  148. package/dist/client/assets/{file-share-button-Devx0UP5.js → file-share-button-BmWv4msr.js} +1 -1
  149. package/dist/client/assets/{file-type-icon-CtKJHzOq.js → file-type-icon-Ixvc6_bA.js} +1 -1
  150. package/dist/client/assets/{folder-icon-v_un8oBh.js → folder-icon-ByIjnQde.js} +1 -1
  151. package/dist/client/assets/{form-B4txFZ9_.js → form-CIAWZjuP.js} +1 -1
  152. package/dist/client/assets/{general-D1PYsEPe.js → general-DEusZ5JT.js} +1 -1
  153. package/dist/client/assets/{home-Ce58QfRL.js → home-B9bSA6tC.js} +1 -1
  154. package/dist/client/assets/{icon-button-B2nkkF4s.js → icon-button-7F5Toil2.js} +1 -1
  155. package/dist/client/assets/{index-CBITis32.js → index-4NUDq9UX.js} +1 -1
  156. package/dist/client/assets/{index-CYvWDMig.js → index-B0ZOlWzX.js} +1 -1
  157. package/dist/client/assets/{index-uj-2aD6g.js → index-B1T14RYF.js} +1 -1
  158. package/dist/client/assets/{index-BjNnHm9S.js → index-BEqT-aNW.js} +1 -1
  159. package/dist/client/assets/index-BQfNeaI1.css +1 -0
  160. package/dist/client/assets/{index-DAeJjOY-.js → index-BZ3kN-UW.js} +1 -1
  161. package/dist/client/assets/{index-CBPFaqzb.js → index-CRYNJjMc.js} +1 -1
  162. package/dist/client/assets/{index-9zYu4OQI.js → index-CYGV5ggz.js} +1 -1
  163. package/dist/client/assets/{index-DfK7_snd.js → index-CblLVDuN.js} +1 -1
  164. package/dist/client/assets/{index-DofgWNDj.js → index-CfHLnaAs.js} +1 -1
  165. package/dist/client/assets/{index-C_vsZdEs.js → index-DJCD1T3p.js} +36 -36
  166. package/dist/client/assets/{index-CHOolU-2.js → index-DiKBQ93t.js} +1 -1
  167. package/dist/client/assets/index-DrxFcbdt.js +4 -0
  168. package/dist/client/assets/{index-ZeYytYg9.js → index-DxIuEmxM.js} +1 -1
  169. package/dist/client/assets/{index-Bp5c1HaS.js → index-MrGr5MGL.js} +1 -1
  170. package/dist/client/assets/{index-redirect-Jch1OTL_.js → index-redirect-BSxSh5S-.js} +1 -1
  171. package/dist/client/assets/{index-DC_lXxHn.js → index-xD4K2nG7.js} +1 -1
  172. package/dist/client/assets/{infiniteQueryObserver-C2uEQLvN.js → infiniteQueryObserver-5dM4o4Hf.js} +1 -1
  173. package/dist/client/assets/{infra-billing-BI2rcYbR.js → infra-billing-BW0f21OW.js} +1 -1
  174. package/dist/client/assets/{input-DlfhLXVo.js → input-2QjNp7qX.js} +1 -1
  175. package/dist/client/assets/{input-nGqpK_4e.js → input-Di5PUIe8.js} +3 -3
  176. package/dist/client/assets/{integration-icon-CeG7h1x5.js → integration-icon-CMGBZM9F.js} +1 -1
  177. package/dist/client/assets/{jira-icon-DLfJcRXS.js → jira-icon-DZrAPkCR.js} +1 -1
  178. package/dist/client/assets/{label-CCla7LnP.js → label-CBlQ82Fk.js} +1 -1
  179. package/dist/client/assets/{layout-C9sg2y3c.js → layout-jno9iSY1.js} +1 -1
  180. package/dist/client/assets/{legacy-agents-deep-BpXhG-Np.js → legacy-agents-deep-C-JHuDVd.js} +1 -1
  181. package/dist/client/assets/{legacy-main-redirect-CNUdNl6X.js → legacy-main-redirect-BjKbMolf.js} +1 -1
  182. package/dist/client/assets/library-DC_yyIum.js +1 -0
  183. package/dist/client/assets/{login-mhnZ1Cb9.js → login-DrbMDqlp.js} +1 -1
  184. package/dist/client/assets/{markdown-BDTHe610.js → markdown-BU6g98sq.js} +1 -1
  185. package/dist/client/assets/{mcp-app-renderer-CMRuQe66.js → mcp-app-renderer-B6MBkXrw.js} +1 -1
  186. package/dist/client/assets/{mcp-oauth-L6wgBjWx.js → mcp-oauth-CFQzR34b.js} +1 -1
  187. package/dist/client/assets/{mcp-oauth-CIkq3Lwg.js → mcp-oauth-DHXkg8Ce.js} +1 -1
  188. package/dist/client/assets/{members-V_RnUVXg.js → members-D1907SI-.js} +1 -1
  189. package/dist/client/assets/{memory-CB8DHXY4.js → memory-CaQIwNtK.js} +1 -1
  190. package/dist/client/assets/{mini-report-page-DZhVo3A1.js → mini-report-page-5Lry2_1Y.js} +1 -1
  191. package/dist/client/assets/{mock-board-Dy_pSyrX.js → mock-board-Dfc7Zn2k.js} +3 -3
  192. package/dist/client/assets/{monaco-editor-BzWTOVge.js → monaco-editor-D1yDvJd3.js} +1 -1
  193. package/dist/client/assets/{monitoring-UGiK-7BE.js → monitoring-CvGmGp-w.js} +1 -1
  194. package/dist/client/assets/{monitoring-stats-row-BagVDHFD.js → monitoring-stats-row-C-A-doof.js} +1 -1
  195. package/dist/client/assets/{multi-select-CKLuefuY.js → multi-select-BNUkLp8H.js} +1 -1
  196. package/dist/client/assets/{mustache-Co8KcLI0.js → mustache-CksHv2Dr.js} +1 -1
  197. package/dist/client/assets/{named-rule-uses-0L-mc_uD.js → named-rule-uses-BBl065fe.js} +1 -1
  198. package/dist/client/assets/{named-rule-view-DZyPdsij.js → named-rule-view-BXK5sJ8X.js} +1 -1
  199. package/dist/client/assets/{new-project-dialog-C5J4MWsO.js → new-project-dialog-CYkF5k4O.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-DGdoi3wa.js → oauth-callback-BPlDpCVw.js} +1 -1
  201. package/dist/client/assets/{oauth-callback-ai-provider-DID3n8T6.js → oauth-callback-ai-provider-C-kNRGr2.js} +1 -1
  202. package/dist/client/assets/{onboarding-D9ovXhj0.js → onboarding-81KXiaqI.js} +1 -1
  203. package/dist/client/assets/{openai-conversation-CM0XUf2p.js → openai-conversation-Bi9e1sKc.js} +1 -1
  204. package/dist/client/assets/{optimistic-project-sidebar-views-Bfc4VpR_.js → optimistic-project-sidebar-views-CVVwXn2X.js} +1 -1
  205. package/dist/client/assets/{order-monitor-day-DXxkF6qy.js → order-monitor-day-BVSLADXz.js} +1 -1
  206. package/dist/client/assets/{organization-choice-BPMnBB4D.js → organization-choice-DmteYBAc.js} +1 -1
  207. package/dist/client/assets/{orgs-D8DaVl4f.js → orgs-BFPSbb2q.js} +1 -1
  208. package/dist/client/assets/{page-seo-form-BRaefSdh.js → page-seo-form-VA7wIeJU.js} +1 -1
  209. package/dist/client/assets/{pair-DO5ZeABu.js → pair-Cjnol9_x.js} +1 -1
  210. package/dist/client/assets/{parse-sections-C4YcWg_N.js → parse-sections-7Tm_vjpy.js} +1 -1
  211. package/dist/client/assets/{plan-0xsoBIKI.js → plan-KARVWZDV.js} +1 -1
  212. package/dist/client/assets/{plan-ladder-RZlDrpyw.js → plan-ladder-C-o1aFSi.js} +1 -1
  213. package/dist/client/assets/{popover-CjjSJX-T.js → popover-BsX8gIsV.js} +1 -1
  214. package/dist/client/assets/{post-calendar-CMfQVQhR.js → post-calendar-B6fP7Sp3.js} +1 -1
  215. package/dist/client/assets/{post-editor-DneZ_oYu.js → post-editor-B530kxYZ.js} +1 -1
  216. package/dist/client/assets/{preview-content-C045LLz9.js → preview-content-IEhLMW40.js} +1 -1
  217. package/dist/client/assets/{preview-dialog-C5KMdNHK.js → preview-dialog-B8MUF8yg.js} +1 -1
  218. package/dist/client/assets/{preview-panel-DbAGt6c_.js → preview-panel-C3yGSsCn.js} +1 -1
  219. package/dist/client/assets/preview-tab-DZ2jzEbi.js +551 -0
  220. package/dist/client/assets/{product-picker-dialog-BjUVIbA3.js → product-picker-dialog-Duu5EFXJ.js} +1 -1
  221. package/dist/client/assets/{profile-nkfQjNS7.js → profile-SgKnnlOX.js} +1 -1
  222. package/dist/client/assets/project-app-view-69GUddZy.js +1 -0
  223. package/dist/client/assets/{project-apps-BNVRAEb2.js → project-apps-DxvrGikA.js} +1 -1
  224. package/dist/client/assets/{project-feed-xXVaAcj7.js → project-feed-Dkn186cj.js} +1 -1
  225. package/dist/client/assets/{project-icon-N-_cW8IV.js → project-icon-DozUqz8V.js} +1 -1
  226. package/dist/client/assets/project-reports-6uzfgJoN.js +1 -0
  227. package/dist/client/assets/project-tasks-BLcB7Cwc.js +1 -0
  228. package/dist/client/assets/{projects-iwaahBWW.js → projects-BvtnS4il.js} +1 -1
  229. package/dist/client/assets/{projects-empty-state-zSj-H-15.js → projects-empty-state-Bd8sqs2o.js} +1 -1
  230. package/dist/client/assets/{prompts-DHg6zTlM.js → prompts-CfiuzCI2.js} +1 -1
  231. package/dist/client/assets/record-editor-DD-1yqpv.js +1 -0
  232. package/dist/client/assets/{redirect-editor-CUc3_Gjb.js → redirect-editor-Cq58-dw7.js} +1 -1
  233. package/dist/client/assets/{releases-api-FsFJ3Ao1.js → releases-api-toiaosbq.js} +1 -1
  234. package/dist/client/assets/reports-VJqlTUDX.js +1 -0
  235. package/dist/client/assets/{reports-BfO4SPfx.js → reports-X-r24zwl.js} +1 -1
  236. package/dist/client/assets/{reports-onboarding-C51nw6GE.js → reports-onboarding-B1eQP37P.js} +1 -1
  237. package/dist/client/assets/{reports-tab-D4zotKTH.js → reports-tab-BqceAQel.js} +2 -2
  238. package/dist/client/assets/{repositories-ChqgU36Q.js → repositories-CkzQSY8F.js} +1 -1
  239. package/dist/client/assets/repositories-DRGtDHym.js +1 -0
  240. package/dist/client/assets/{repository-binding-DAOz6vJw.js → repository-binding-CiDG0Cr0.js} +1 -1
  241. package/dist/client/assets/{repository-import-picker-BcrGb4sk.js → repository-import-picker-TlIvK00I.js} +1 -1
  242. package/dist/client/assets/{repository-picker-BIZQUbzV.js → repository-picker-BrjMgENb.js} +1 -1
  243. package/dist/client/assets/{require-capability-CW24vDTN.js → require-capability-D5vaDJ6i.js} +1 -1
  244. package/dist/client/assets/{required-auth-layout-DZbUxfmT.js → required-auth-layout-CLsGddT6.js} +1 -1
  245. package/dist/client/assets/{reset-password-CGOBWPvy.js → reset-password-BDTPUkZZ.js} +1 -1
  246. package/dist/client/assets/{resizable-CZKHd0We.js → resizable-LNv9WlFU.js} +1 -1
  247. package/dist/client/assets/{resolve-tab-icon-kIr1F8om.js → resolve-tab-icon-DDEl8WpS.js} +1 -1
  248. package/dist/client/assets/review-settings-CR1udLwz.js +1 -0
  249. package/dist/client/assets/{roles-DZEPLtk9.js → roles-DIBxviRh.js} +1 -1
  250. package/dist/client/assets/route-CMp29IPi.js +1 -0
  251. package/dist/client/assets/{route-lBtyO3bR.js → route-CwE5K4wd.js} +1 -1
  252. package/dist/client/assets/{route-BRcGegjD.js → route-DiDqKVTg.js} +1 -1
  253. package/dist/client/assets/{runnable-block-editor-DUtYxxN3.js → runnable-block-editor-D9HAcpIU.js} +3 -3
  254. package/dist/client/assets/{sandbox-lifecycle-context-wjpGI-pF.js → sandbox-lifecycle-context-BKUYq7kP.js} +1 -1
  255. package/dist/client/assets/{schema-CeHPVV-x.js → schema-6JU3flf4.js} +1 -1
  256. package/dist/client/assets/{schema-B-d5VC7M.js → schema-BbiQjr1e.js} +1 -1
  257. package/dist/client/assets/{scroll-area-DpJwcaMZ.js → scroll-area-CCVLtkoB.js} +1 -1
  258. package/dist/client/assets/{search-input-Dn_Mm6hP.js → search-input-43leKkGn.js} +1 -1
  259. package/dist/client/assets/{search-toggle-BlrCbEt-.js → search-toggle-Ds25LhLA.js} +1 -1
  260. package/dist/client/assets/{secret-ciphertext-x-rG3-SW.js → secret-ciphertext-BrIiDgyd.js} +1 -1
  261. package/dist/client/assets/{secret-picker-BjSmxw0L.js → secret-picker-aJPnp_F5.js} +1 -1
  262. package/dist/client/assets/{secrets-BOaO2wUC.js → secrets-CfWgVKjc.js} +1 -1
  263. package/dist/client/assets/{sections-B7NcoZr9.js → sections-Dvgo02ra.js} +1 -1
  264. package/dist/client/assets/{sections-editor-B65DWyde.js → sections-editor-BSfFPyUU.js} +1 -1
  265. package/dist/client/assets/{select-35KAqptX.js → select-CHmq3OGd.js} +1 -1
  266. package/dist/client/assets/{select-model-CRhm1POv.js → select-model-CvpLn49w.js} +1 -1
  267. package/dist/client/assets/{seo-editor-BD4rsTCg.js → seo-editor-BQ3pdKQv.js} +1 -1
  268. package/dist/client/assets/{separator-CN44jTdI.js → separator-vkFvxZ8m.js} +1 -1
  269. package/dist/client/assets/settings-tab-B_bx6QgP.js +1 -0
  270. package/dist/client/assets/{sheet--x4K5vq7.js → sheet-C_qetF7d.js} +1 -1
  271. package/dist/client/assets/{shell-layout-MuOSrWff.js → shell-layout-Bb-Bk8Da.js} +1 -1
  272. package/dist/client/assets/{site-draft-actions-C158kLWC.js → site-draft-actions-GBt56z1o.js} +1 -1
  273. package/dist/client/assets/site-draft-view-CZq-6QXP.js +2 -0
  274. package/dist/client/assets/site-editor-Dw86EYnX.js +1 -0
  275. package/dist/client/assets/{site-editor-toast-S3ZDWqj4.js → site-editor-toast-Dvaha1qd.js} +1 -1
  276. package/dist/client/assets/{skills-DLHcL6Ra.js → skills-CNP2yKUA.js} +1 -1
  277. package/dist/client/assets/{slider-CB0MGtcs.js → slider-Dt2pZuy0.js} +1 -1
  278. package/dist/client/assets/{sortable.esm-CnslkyN-.js → sortable.esm-Dgy_5_Gq.js} +1 -1
  279. package/dist/client/assets/{sso-HY_2IIv9.js → sso-BwMXXLZ-.js} +1 -1
  280. package/dist/client/assets/{suggestion-DZQHNrRW.js → suggestion-DUWht7S9.js} +1 -1
  281. package/dist/client/assets/{switch-CUuF3Lbb.js → switch-BKqScyl8.js} +1 -1
  282. package/dist/client/assets/{symbol-BF05cGJ-.js → symbol-Bw5pneOj.js} +1 -1
  283. package/dist/client/assets/{synced-repos-BSOSKhlb.js → synced-repos-DhRHDr6D.js} +1 -1
  284. package/dist/client/assets/{tab-icon-glyph-CJIOp39A.js → tab-icon-glyph-ALHCeulj.js} +1 -1
  285. package/dist/client/assets/{table-BlnsYBCM.js → table-DSiO4Kq6.js} +1 -1
  286. package/dist/client/assets/{tabs-6v8Cll9k.js → tabs-BcHqdI-j.js} +1 -1
  287. package/dist/client/assets/{task-assignee-avatar-C9Sk5bvn.js → task-assignee-avatar-CwyY8xOb.js} +1 -1
  288. package/dist/client/assets/{task-board-Bt136szd.js → task-board-ICmHlMKj.js} +1 -1
  289. package/dist/client/assets/{task-route-t6KGoxhC.js → task-route-SvQTR3TJ.js} +1 -1
  290. package/dist/client/assets/{task-status-DvsJuwH-.js → task-status-Dk0B9E0G.js} +1 -1
  291. package/dist/client/assets/{taskboard-analytics-Dsx_nKwf.js → taskboard-analytics-vr9mjCEM.js} +1 -1
  292. package/dist/client/assets/{tasks-B9wf25Tq.js → tasks-DUtkLCHD.js} +1 -1
  293. package/dist/client/assets/tasks-DzLAZqT6.js +1 -0
  294. package/dist/client/assets/{textarea-CzFPd8mY.js → textarea-CTbC00Fo.js} +1 -1
  295. package/dist/client/assets/{thread-analytics-BNsgRzDB.js → thread-analytics-CYtiXz-Q.js} +1 -1
  296. package/dist/client/assets/{thread-intent-Dimk3aQq.js → thread-intent-DcKV1aEK.js} +1 -1
  297. package/dist/client/assets/{thread-route-CBR-hVjV.js → thread-route-D05ck8nv.js} +1 -1
  298. package/dist/client/assets/{thread-route-Dx9_u5Jd.js → thread-route-DlbP9X8e.js} +1 -1
  299. package/dist/client/assets/{thread-sheet-body-BW-XRqLk.js → thread-sheet-body-DXSUCFvU.js} +1 -1
  300. package/dist/client/assets/{time-range-picker-CmcQeC_-.js → time-range-picker-cljXExVl.js} +1 -1
  301. package/dist/client/assets/{toggle-group-o8h9w6Rw.js → toggle-group-cK7x-LaG.js} +1 -1
  302. package/dist/client/assets/{tool-namespace-BohpB6u5.js → tool-namespace-CFMdc33T.js} +1 -1
  303. package/dist/client/assets/{toolbar-icon-button-eoL5rlvV.js → toolbar-icon-button-AJC8O64v.js} +1 -1
  304. package/dist/client/assets/{tooltip-BKiQ2c4S.js → tooltip-oRr5C_aw.js} +1 -1
  305. package/dist/client/assets/{tooltipContext-BKUF9aS4.js → tooltipContext-DBLuHkF3.js} +1 -1
  306. package/dist/client/assets/{track-BIe-Ry31.js → track-D3xYnfew.js} +1 -1
  307. package/dist/client/assets/{types-CjXbKtgO.js → types-BnGn2ply.js} +1 -1
  308. package/dist/client/assets/{url-slug-CKCta88_.js → url-slug-CiQKnf5R.js} +1 -1
  309. package/dist/client/assets/{usage-stats-CTkcwRGv.js → usage-stats-BFNP5B9b.js} +1 -1
  310. package/dist/client/assets/{use-ai-providers-De1swco5.js → use-ai-providers-DB7Q0SBY.js} +1 -1
  311. package/dist/client/assets/{use-apply-named-rule-Yk2R4vGY.js → use-apply-named-rule-DW6Wbxy3.js} +1 -1
  312. package/dist/client/assets/{use-automations-DOZ_ddWM.js → use-automations-BXbY6ysU.js} +1 -1
  313. package/dist/client/assets/{use-autosave-B8CxO0rS.js → use-autosave-BB3cf8aT.js} +1 -1
  314. package/dist/client/assets/{use-chat-layout-state-B0cKljGG.js → use-chat-layout-state-KA32sUXt.js} +1 -1
  315. package/dist/client/assets/{use-clock-tick-DXHhIXGi.js → use-clock-tick-CmSlUOB2.js} +1 -1
  316. package/dist/client/assets/{use-connect-companion-CNjzI2Gb.js → use-connect-companion-Dzb46un3.js} +1 -1
  317. package/dist/client/assets/{use-connection-Bb5luwYC.js → use-connection-PJ_l98GU.js} +1 -1
  318. package/dist/client/assets/{use-content-sync-9gqPWQll.js → use-content-sync-9tvG-lut.js} +1 -1
  319. package/dist/client/assets/{use-copy-GYYhLXBY.js → use-copy-D4R9cJ_t.js} +1 -1
  320. package/dist/client/assets/{use-create-virtual-mcp-CcifdRil.js → use-create-virtual-mcp-cYnUmw5j.js} +1 -1
  321. package/dist/client/assets/{use-date-fns-locale-CYgQL4Jo.js → use-date-fns-locale-BgdR-wYC.js} +1 -1
  322. package/dist/client/assets/{use-debounced-autosave-B9JjKQU0.js → use-debounced-autosave-CL6P-Lri.js} +1 -1
  323. package/dist/client/assets/{use-debounced-value-BOYaK5vY.js → use-debounced-value-BdOjhsVi.js} +1 -1
  324. package/dist/client/assets/{use-deco-credits-BOXZz3P1.js → use-deco-credits-DHNd5iXt.js} +1 -1
  325. package/dist/client/assets/{use-decopilot-events-DQQB-1qO.js → use-decopilot-events-CDLwP1Su.js} +1 -1
  326. package/dist/client/assets/{use-delete-connection-DeeN5sak.js → use-delete-connection-CkSINryc.js} +1 -1
  327. package/dist/client/assets/{use-deployment-admin-Bz_unjS_.js → use-deployment-admin-BZATCf2q.js} +1 -1
  328. package/dist/client/assets/{use-fast-preview-draft-url-DL15tTpN.js → use-fast-preview-draft-url-CGwz_fku.js} +1 -1
  329. package/dist/client/assets/{use-file-configs-Bs34_QXe.js → use-file-configs-nRV9S9D0.js} +1 -1
  330. package/dist/client/assets/{use-inbox-feed-CPLQGzQu.js → use-inbox-feed-CMEIMGZ6.js} +1 -1
  331. package/dist/client/assets/{use-infinite-scroll-TKtAAXad.js → use-infinite-scroll-CNz9_Nor.js} +1 -1
  332. package/dist/client/assets/{use-join-requests-Zw7OQ09c.js → use-join-requests-oCznfTNy.js} +1 -1
  333. package/dist/client/assets/{use-main-panel-tabs-w1hDvrxY.js → use-main-panel-tabs-BKmILeUa.js} +1 -1
  334. package/dist/client/assets/{use-mcp-auth-status-DTPo2TCr.js → use-mcp-auth-status-BlkUCjXO.js} +1 -1
  335. package/dist/client/assets/{use-mcp-client-Q83YdvIg.js → use-mcp-client-DKIfKwpJ.js} +1 -1
  336. package/dist/client/assets/{use-mcp-prompts-BcqS4HpY.js → use-mcp-prompts-MhXPkujh.js} +1 -1
  337. package/dist/client/assets/{use-mcp-tools-CFBxGHgP.js → use-mcp-tools-CTl2xkGk.js} +1 -1
  338. package/dist/client/assets/{use-members-CMq0EOLQ.js → use-members-BiXVclqd.js} +1 -1
  339. package/dist/client/assets/{use-mobile-DHwXmnJW.js → use-mobile-CCkX9zL-.js} +1 -1
  340. package/dist/client/assets/{use-move-blocks-BZQPOuio.js → use-move-blocks-C6LWTkiD.js} +1 -1
  341. package/dist/client/assets/{use-navigate-to-agent-CRetfCk1.js → use-navigate-to-agent-CEb5-IwU.js} +1 -1
  342. package/dist/client/assets/{use-open-billing-url-BoLb6LTQ.js → use-open-billing-url-D-NQ16Mb.js} +1 -1
  343. package/dist/client/assets/{use-org-auth-client-Im4HAiDN.js → use-org-auth-client-xXOFDOL1.js} +1 -1
  344. package/dist/client/assets/{use-org-fs-BkhssW-q.js → use-org-fs-DRaVeNa6.js} +1 -1
  345. package/dist/client/assets/{use-org-repo-syncs-CQwCJbKx.js → use-org-repo-syncs-LHzk4Keo.js} +1 -1
  346. package/dist/client/assets/{use-org-sso-ChZhVF-c.js → use-org-sso-Bx0Susbk.js} +1 -1
  347. package/dist/client/assets/{use-organization-roles-C3qIjIVy.js → use-organization-roles-CbO1bQ_O.js} +1 -1
  348. package/dist/client/assets/{use-organization-settings-BKC0vqj5.js → use-organization-settings-Bf2WDJz9.js} +1 -1
  349. package/dist/client/assets/{use-panel-navigate-D3V5oZgG.js → use-panel-navigate-CYYYdsdC.js} +1 -1
  350. package/dist/client/assets/{use-project-native-view-presence-BnccFS-g.js → use-project-native-view-presence-B2rH_d27.js} +1 -1
  351. package/dist/client/assets/{use-project-scope-CXdLsOUx.js → use-project-scope-C66L_LKx.js} +1 -1
  352. package/dist/client/assets/{use-recent-apps-B5QclJaN.js → use-recent-apps-DaFNVa3y.js} +1 -1
  353. package/dist/client/assets/{use-releases-BC3G5Pl0.js → use-releases-DwpIDRIp.js} +1 -1
  354. package/dist/client/assets/{use-reports-diagnostic-tcpLCmvm.js → use-reports-diagnostic-DnLCgooz.js} +1 -1
  355. package/dist/client/assets/{use-sandbox-events-DvplhdO9.js → use-sandbox-events-CioHBl5Q.js} +1 -1
  356. package/dist/client/assets/{use-secrets-Bc11D92Z.js → use-secrets-BrDaOgAh.js} +1 -1
  357. package/dist/client/assets/{use-section-preview-base-Dnt4agkC.js → use-section-preview-base-DxyD_MVI.js} +1 -1
  358. package/dist/client/assets/{use-session-runtime-C4oqymjC.js → use-session-runtime-DgSb1tZ1.js} +1 -1
  359. package/dist/client/assets/{use-sidebar-collapsed-BwUTTLp4.js → use-sidebar-collapsed-Lbn9i3wJ.js} +1 -1
  360. package/dist/client/assets/{use-tags-BB1h7o3t.js → use-tags-DxXXXYXQ.js} +1 -1
  361. package/dist/client/assets/{use-task-board-analytics-DGpoyTMw.js → use-task-board-analytics-B_lpE6sk.js} +1 -1
  362. package/dist/client/assets/{use-task-board-events-CavGFGcP.js → use-task-board-events-Ciu9fgM5.js} +1 -1
  363. package/dist/client/assets/{use-task-board-item-prs-DV_64vVH.js → use-task-board-item-prs-BXiZI60U.js} +1 -1
  364. package/dist/client/assets/{use-task-metadata-HTLDRogK.js → use-task-metadata-DXSFycil.js} +1 -1
  365. package/dist/client/assets/{use-thread-analytics-BpkGclpK.js → use-thread-analytics-BBBfMO-x.js} +1 -1
  366. package/dist/client/assets/{use-thread-outputs-DTZGPUxN.js → use-thread-outputs-Be0M4DCF.js} +1 -1
  367. package/dist/client/assets/useInfiniteQuery-C9OOM3iT.js +1 -0
  368. package/dist/client/assets/{useQueries-jpAcc0Og.js → useQueries-CjLpsE8j.js} +1 -1
  369. package/dist/client/assets/useSuspenseInfiniteQuery-DC4aZJSW.js +1 -0
  370. package/dist/client/assets/{users-rDy84J0H.js → users-DhWYm0Ur.js} +1 -1
  371. package/dist/client/assets/{utils-Azo2Yo1D.js → utils-BlqF72Vj.js} +1 -1
  372. package/dist/client/assets/{variant-calendar-EbCPgcKt.js → variant-calendar-Z__DuHea.js} +1 -1
  373. package/dist/client/assets/{variant-matcher-override-aUUxuYxP.js → variant-matcher-override-BcEAaLIA.js} +1 -1
  374. package/dist/client/assets/virtual-mcp-DQmDpfRM.js +1 -0
  375. package/dist/client/assets/{watch-sse-pool-BydfW6Wr.js → watch-sse-pool-9GQSHr-W.js} +1 -1
  376. package/dist/client/index.html +2 -2
  377. package/dist/server/server.js +510 -510
  378. package/package.json +1 -1
  379. package/dist/client/assets/UserSquare-BIGP81NS.js +0 -1
  380. package/dist/client/assets/agent-analytics-ga8WG0DD.js +0 -1
  381. package/dist/client/assets/agent-app-D3wD7b8f.js +0 -1
  382. package/dist/client/assets/agent-calendar-B3oKpSw2.js +0 -1
  383. package/dist/client/assets/agent-deck-CXdYMYf4.js +0 -1
  384. package/dist/client/assets/agent-e2e-BOVUEdNB.js +0 -1
  385. package/dist/client/assets/agent-experiments-HQCEx4Fq.js +0 -1
  386. package/dist/client/assets/agent-file-De8dU8yj.js +0 -1
  387. package/dist/client/assets/agent-hosting-BJaMFlfC.js +0 -1
  388. package/dist/client/assets/agent-icon-B7E6q_wB.js +0 -1
  389. package/dist/client/assets/agent-library-CycM9_xW.js +0 -1
  390. package/dist/client/assets/agent-library-file-CQfHiAWz.js +0 -1
  391. package/dist/client/assets/agent-monitor-DZTUJG_q.js +0 -1
  392. package/dist/client/assets/agent-settings-BzozrOuP.js +0 -1
  393. package/dist/client/assets/agent-site-editor-code-CfhAFGbw.js +0 -2
  394. package/dist/client/assets/agent-site-editor-content-HSi2zAV9.js +0 -1
  395. package/dist/client/assets/agent-site-editor-preview--Eh8H0cH.js +0 -1
  396. package/dist/client/assets/agent-view-i5fuA9y0.js +0 -1
  397. package/dist/client/assets/api-keys-9XoxlxPv.js +0 -1
  398. package/dist/client/assets/cms-settings-editor-DzowXA1R.js +0 -1
  399. package/dist/client/assets/index-AnCWAS83.js +0 -4
  400. package/dist/client/assets/index-MPdUOMBb.css +0 -1
  401. package/dist/client/assets/library-KPhgahQ-.js +0 -1
  402. package/dist/client/assets/preview-tab-BT-Dmpc3.js +0 -551
  403. package/dist/client/assets/project-app-view-bzcy9g1q.js +0 -1
  404. package/dist/client/assets/project-reports-CAf7P6Es.js +0 -1
  405. package/dist/client/assets/project-tasks-XqUcBopf.js +0 -1
  406. package/dist/client/assets/record-editor-hs79wE2U.js +0 -1
  407. package/dist/client/assets/reports-s1lwdSit.js +0 -1
  408. package/dist/client/assets/repositories-CGUqALW5.js +0 -1
  409. package/dist/client/assets/review-settings-9IMzIRKU.js +0 -1
  410. package/dist/client/assets/route-CYe3oAYd.js +0 -1
  411. package/dist/client/assets/settings-tab-BrPjDgOB.js +0 -1
  412. package/dist/client/assets/site-draft-view-cqx7I6xp.js +0 -2
  413. package/dist/client/assets/site-editor-Cepl1MM3.js +0 -1
  414. package/dist/client/assets/tasks-DUF77GAJ.js +0 -1
  415. package/dist/client/assets/useInfiniteQuery-XMmYWsXs.js +0 -1
  416. package/dist/client/assets/useSuspenseInfiniteQuery-BK6RRGGC.js +0 -1
  417. package/dist/client/assets/virtual-mcp-DSXubdao.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as D,b3 as rt,c as W,b as ie,j as i,ew as Ee,ex as Oe,ey as We,av as at,a2 as ye,an as ke,o as we,aE as Be,aF as Ve,e as Se,I as fe,aG as He,aH as ge,K as pe,t as le,B as re,w as qe,y as ne,D as ct,q as dt,s as ht,v as ut,aN as mt,h as Pe,l as ve,b2 as Y,d as ft,H as pt,a3 as xt}from"./index-C_vsZdEs.js";import{C as gt}from"./checkbox-BQV5rQq6.js";import{S as vt,b as bt,a as yt,d as jt,c as St}from"./select-35KAqptX.js";import{i as Ge}from"./ArrowLeft-BhYsdDhs.js";import{i as Nt}from"./ChevronSelectorVertical-rEBuyaLs.js";import{i as kt}from"./Key01-egFT7DX9.js";import{i as Ye,t as wt,d as _t,e as It,c as Ct,a as Mt,s as Et}from"./Tool01-Bhwq8fKA.js";import{i as Xe}from"./SearchMd-DWVKWjSh.js";import{e as _e,u as Ot,a as Pt,c as At}from"./use-ai-providers-De1swco5.js";import{d as Tt}from"./chat-context-C1JvjRtO.js";import{g as Ie}from"./ai-providers-logos-DD3qZ33J.js";import{i as zt}from"./Monitor01-QBQW5XNf.js";import{i as Ft}from"./AlertCircle-DBK8R4dI.js";import{A as Lt}from"./avatar-BD2PDf8q.js";import{s as Qe,a as Rt}from"./Image01-D5xmdMv9.js";import{t as Ae}from"./ChevronUp-CBJitQaC.js";function me(n,e,t){let s=t.initialDeps??[],o,l=!0;function r(){var c,h,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const m=n();if(!(m.length!==s.length||m.some((f,v)=>s[v]!==f)))return o;s=m;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,v=Math.round((Date.now()-u)*100)/100,k=v/16,b=(y,_)=>{for(y=String(y);y.length<_;)y=" "+y;return y};console.info(`%c⏱ ${b(v,5)} /${b(f,5)} ms`,`
1
+ import{r as D,b3 as rt,c as W,b as ie,j as i,ew as Ee,ex as Oe,ey as We,av as at,a2 as ye,an as ke,o as we,aE as Be,aF as Ve,e as Se,I as fe,aG as He,aH as ge,K as pe,t as le,B as re,w as qe,y as ne,D as ct,q as dt,s as ht,v as ut,aN as mt,h as Pe,l as ve,b2 as Y,d as ft,H as pt,a3 as xt}from"./index-DJCD1T3p.js";import{C as gt}from"./checkbox--QGg9JL6.js";import{S as vt,b as bt,a as yt,d as jt,c as St}from"./select-CHmq3OGd.js";import{i as Ge}from"./ArrowLeft-DDWHto_R.js";import{i as Nt}from"./ChevronSelectorVertical-CtVpNCaH.js";import{i as kt}from"./Key01-CxbATohw.js";import{i as Ye,t as wt,d as _t,e as It,c as Ct,a as Mt,s as Et}from"./Tool01-CnZckhqi.js";import{i as Xe}from"./SearchMd-OCyidoZI.js";import{e as _e,u as Ot,a as Pt,c as At}from"./use-ai-providers-DB7Q0SBY.js";import{d as Tt}from"./chat-context-4LDKQ9-8.js";import{g as Ie}from"./ai-providers-logos-DD3qZ33J.js";import{i as zt}from"./Monitor01-B-_Pl3qs.js";import{i as Ft}from"./AlertCircle-DGVmeswV.js";import{A as Lt}from"./avatar-DarGMVT9.js";import{s as Qe,a as Rt}from"./Image01-Bks737AT.js";import{t as Ae}from"./ChevronUp-ojSOtVX2.js";function me(n,e,t){let s=t.initialDeps??[],o,l=!0;function r(){var c,h,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const m=n();if(!(m.length!==s.length||m.some((f,v)=>s[v]!==f)))return o;s=m;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,v=Math.round((Date.now()-u)*100)/100,k=v/16,b=(y,_)=>{for(y=String(y);y.length<_;)y=" "+y;return y};console.info(`%c⏱ ${b(v,5)} /${b(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(l&&t.skipInitialOnChange)&&t.onChange(o),l=!1,o}return r.updateDeps=c=>{s=c},r}function Te(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Kt=(n,e)=>Math.abs(n-e)<1.01,Dt=(n,e,t)=>{let s;return function(...o){n.clearTimeout(s),s=n.setTimeout(()=>e.apply(this,o),t)}},ze=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},$t=n=>n,Ut=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),s=[];for(let o=e;o<=t;o++)s.push(o);return s},Wt=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;const o=r=>{const{width:c,height:h}=r;e({width:Math.round(c),height:Math.round(h)})};if(o(ze(t)),!s.ResizeObserver)return()=>{};const l=new s.ResizeObserver(r=>{const c=()=>{const h=r[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(ze(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return l.observe(t,{box:"border-box"}),()=>{l.unobserve(t)}},Fe={passive:!0},Le=typeof window>"u"?!0:"onscrollend"in window,Bt=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;let o=0;const l=n.options.useScrollendEvent&&Le?()=>{}:Dt(s,()=>{e(o,!1)},n.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:m,isRtl:p}=n.options;o=m?t.scrollLeft*(p&&-1||1):t.scrollTop,l(),e(o,a)},c=r(!0),h=r(!1);t.addEventListener("scroll",c,Fe);const d=n.options.useScrollendEvent&&Le;return d&&t.addEventListener("scrollend",h,Fe),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",h)}},Vt=(n,e,t)=>{if(e?.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},Ht=(n,{adjustments:e=0,behavior:t},s)=>{var o,l;const r=n+e;(l=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[s.options.horizontal?"left":"top"]:r,behavior:t})};class qt{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,s,o;return((o=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const r=()=>{const c=l.target,h=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(c,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),t=null},observe:o=>{var l;return(l=s())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=s())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([s,o])=>{typeof o>"u"&&delete t[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$t,rangeExtractor:Ut,onChange:()=>{},measureElement:Vt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,t)},this.maybeNotify=me(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,s)=>{const o=new Map,l=new Map;for(let r=s-1;r>=0;r--){const c=t[r];if(o.has(c.lane))continue;const h=l.get(c.lane);if(h==null||c.end>h.end?l.set(c.lane,c):c.end<h.end&&o.set(c.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=me(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,s,o,l,r,c,h)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:s,scrollMargin:o,getItemKey:l,enabled:r,lanes:c,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=me(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:s,scrollMargin:o,getItemKey:l,enabled:r,lanes:c,laneAssignmentMode:h},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,a),p=new Array(c).fill(void 0);for(let u=0;u<a;u++){const f=m[u];f&&(p[f.lane]=u)}for(let u=a;u<t;u++){const f=l(u),v=this.laneAssignments.get(u);let k,b;const y=h==="estimate"||d.has(f);if(v!==void 0&&this.options.lanes>1){k=v;const I=p[k],g=I!==void 0?m[I]:void 0;b=g?g.end+this.options.gap:s+o}else{const I=this.options.lanes===1?m[u-1]:this.getFurthestMeasurement(m,u);b=I?I.end+this.options.gap:s+o,k=I?I.lane:u%this.options.lanes,this.options.lanes>1&&y&&this.laneAssignments.set(u,k)}const _=d.get(f),C=typeof _=="number"?_:this.options.estimateSize(u),E=b+C;m[u]={index:u,start:b,size:C,end:E,key:f,lane:k},p[k]=u}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=me(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,o,l)=>this.range=t.length>0&&s>0?Gt({measurements:t,outerSize:s,scrollOffset:o,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=me(()=>{let t=null,s=null;const o=this.calculateRange();return o&&(t=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,o,l,r)=>l===null||r===null?[]:t({startIndex:l,endIndex:r,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,o=t.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,o-l),c=Math.min(this.options.count-1,o+l);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const s=this.indexFromElement(t),o=this.options.getItemKey(s),l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var o;const l=this.measurementsCache[t];if(!l)return;const r=this.itemSizeCache.get(l.key)??l.size,c=s-r;c!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,c,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,s)),this.notify(!1))},this.getVirtualItems=me(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const o=[];for(let l=0,r=t.length;l<r;l++){const c=t[l],h=s[c];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length!==0)return Te(s[Je(0,s.length-1,o=>Te(s[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,s,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),r=this.getScrollOffset();s==="auto"&&(s=t>=r+l?"end":"start"),s==="center"?t+=(o-l)/2:s==="end"&&(t-=l);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(s==="auto")if(r.end>=l+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=l+this.options.scrollPaddingStart)s="start";else return[l,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const c=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,s,r.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(t,s),r=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:r,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getOffsetForIndex(t,s);if(!l)return;const[r,c]=l,h=this.now();this.scrollState={index:t,align:c,behavior:o,startedAt:h,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+t,l=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=s[s.length-1])==null?void 0:t.end)??0;else{const l=Array(this.options.lanes).fill(null);let r=s.length-1;for(;r>=0&&l.some(c=>c===null);){const c=s[r];l[c.lane]===null&&(l[c.lane]=c.end),r--}o=Math.max(...l.filter(c=>c!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:s,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,l=1,r=o!==this.scrollState.lastTargetOffset;if(!r&&Kt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Je=(n,e,t,s)=>{for(;n<=e;){const o=(n+e)/2|0,l=t(o);if(l<s)n=o+1;else if(l>s)e=o-1;else return o}return n>0?n-1:0};function Gt({measurements:n,outerSize:e,scrollOffset:t,lanes:s}){const o=n.length-1,l=h=>n[h].start;if(n.length<=s)return{startIndex:0,endIndex:o};let r=Je(0,o,l,t),c=r;if(s===1)for(;c<o&&n[c].end<t+e;)c++;else if(s>1){const h=Array(s).fill(0);for(;c<o&&h.some(a=>a<t+e);){const a=n[c];h[a.lane]=a.end,c++}const d=Array(s).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=n[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%s),c=Math.min(o,c+(s-1-c%s))}return{startIndex:r,endIndex:c}}const Re=typeof document<"u"?D.useLayoutEffect:D.useEffect;function Yt({useFlushSync:n=!0,...e}){const t=D.useReducer(()=>({}),{})[1],s={...e,onChange:(l,r)=>{var c;n&&r?rt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,l,r)}},[o]=D.useState(()=>new qt(s));return o.setOptions(s),Re(()=>o._didMount(),[]),Re(()=>o._willUpdate()),o}function Xt(n){return Yt({observeElementRect:Wt,observeElementOffset:Bt,scrollToFn:Ht,...n})}const Ze=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(n){if(n)return Ze.find(e=>e.id===n)}const Ke=4;function xe(n){const e=W.c(8),{logo:t,name:s,description:o,onClick:l}=n;let r;e[0]!==t||e[1]!==s?(r=t?i.jsx("img",{src:t,alt:s,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):i.jsx(Lt,{fallback:s.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=s,e[2]=r):r=e[2];let c;return e[3]!==o||e[4]!==s||e[5]!==l||e[6]!==r?(c=i.jsx(We,{onClick:l,icon:r,title:s,description:o}),e[3]=o,e[4]=s,e[5]=l,e[6]=r,e[7]=c):c=e[7],c}function et(n){const e=W.c(38),{providers:t,onSelect:s,onShowAll:o}=n,l=ie();let r;e[0]!==t?(r=t.find(es),e[0]=t,e[1]=r):r=e[1];const c=r;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=h):h=e[2];const d=h;let a;if(e[3]!==s||e[4]!==t||e[5]!==l){let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=(j,P)=>{const A=d[j.id]??Number.MAX_SAFE_INTEGER,z=d[P.id]??Number.MAX_SAFE_INTEGER;return A-z},e[7]=C):C=e[7];const E=t.filter(Zt).sort(C);let I;e[8]!==t?(I=t.find(Jt),e[8]=t,e[9]=I):I=e[9];const g=I;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=be("openai"),e[10]=S):S=e[10];const N=S;let M;e[11]!==s?(M=j=>i.jsx(xe,{logo:j.logo,name:j.name,description:j.description,onClick:()=>s({kind:"provider",provider:j})},j.id),e[11]=s,e[12]=M):M=e[12];let x;e[13]!==s||e[14]!==g?(x=g&&N?[i.jsx(xe,{logo:N.logo,name:N.name,description:N.description,onClick:()=>s({kind:"openai-compatible",provider:g,preset:N})},N.id)]:[],e[13]=s,e[14]=g,e[15]=x):x=e[15];let w;e[16]!==s||e[17]!==g||e[18]!==l?(w=g?[...Ze.filter(Qt).map(j=>i.jsx(xe,{logo:j.logo,name:j.name,description:j.description,onClick:()=>s({kind:"openai-compatible",provider:g,preset:j})},j.id)),i.jsx(xe,{logo:g.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>s({kind:"openai-compatible",provider:g,preset:null})},"custom")]:[],e[16]=s,e[17]=g,e[18]=l,e[19]=w):w=e[19],a=[...E.map(M),...x,...w],e[3]=s,e[4]=t,e[5]=l,e[6]=a}else a=e[6];const m=a,p=m.length-Ke,u=!!o&&p>0;let f;e[20]!==m||e[21]!==u?(f=u?m.slice(0,Ke):m,e[20]=m,e[21]=u,e[22]=f):f=e[22];const v=f;let k;e[23]!==c||e[24]!==s||e[25]!==l?(k=c&&i.jsx(Ee,{children:i.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[i.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),i.jsx("p",{className:"text-xs font-medium text-special mb-1.5 px-2 pt-2 relative",children:l("settings.aiProviders.recommended")}),i.jsx(Oe,{className:"relative",children:i.jsx(xe,{logo:c.logo,name:c.name,description:c.description,onClick:()=>s({kind:"provider",provider:c})})})]})}),e[23]=c,e[24]=s,e[25]=l,e[26]=k):k=e[26];let b;e[27]!==p||e[28]!==o||e[29]!==u||e[30]!==l?(b=u&&i.jsx(We,{onClick:o,title:l(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:i.jsx(at,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=u,e[30]=l,e[31]=b):b=e[31];let y;e[32]!==b||e[33]!==v?(y=i.jsx(Ee,{children:i.jsxs(Oe,{children:[v,b]})}),e[32]=b,e[33]=v,e[34]=y):y=e[34];let _;return e[35]!==k||e[36]!==y?(_=i.jsxs("div",{className:"flex flex-col gap-6",children:[k,y]}),e[35]=k,e[36]=y,e[37]=_):_=e[37],_}function Qt(n){return n.id!=="openai"}function Jt(n){return n.id==="openai-compatible"}function Zt(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function es(n){return n.id==="deco"}function ts(n){return He({label:ge().optional(),apiKey:ge().min(1,n)})}function ss(n){const e=W.c(91),{providerId:t,onCancel:s,onSuccess:o}=n,{org:l}=ye(),r=ke(),c=we(),[h,d]=D.useState(!1),a=ie();let m;e[0]!==a?(m=Be(ts(a("settings.connectForms.apiKeyRequired"))),e[0]=a,e[1]=m):m=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={label:"",apiKey:""},e[2]=p):p=e[2];let u;e[3]!==m?(u={resolver:m,defaultValues:p},e[3]=m,e[4]=u):u=e[4];const{register:f,handleSubmit:v,formState:k}=Ve(u),{errors:b}=k;let y;e[5]!==t||e[6]!==r||e[7]!==a?(y=async se=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:se.label||a("settings.connectForms.defaultKeyLabel"),apiKey:se.apiKey})},e[5]=t,e[6]=r,e[7]=a,e[8]=y):y=e[8];let _;e[9]!==o||e[10]!==l||e[11]!==c||e[12]!==a?(_=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(l.id)}),c.invalidateQueries({queryKey:pe.aiProviders(l.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[9]=o,e[10]=l,e[11]=c,e[12]=a,e[13]=_):_=e[13];let C;e[14]!==a?(C=se=>{le.error(a("settings.connectForms.failedSaveKey",{error:se.message}))},e[14]=a,e[15]=C):C=e[15];let E;e[16]!==y||e[17]!==_||e[18]!==C?(E={mutationFn:y,onSuccess:_,onError:C},e[16]=y,e[17]=_,e[18]=C,e[19]=E):E=e[19];const{mutate:I,isPending:g,error:S}=Se(E);let N;e[20]!==I?(N=se=>I(se),e[20]=I,e[21]=N):N=e[21];let M;e[22]!==v||e[23]!==N?(M=v(N),e[22]=v,e[23]=N,e[24]=M):M=e[24];let x;e[25]!==a?(x=a("settings.connectForms.labelField"),e[25]=a,e[26]=x):x=e[26];let w;e[27]!==x?(w=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:x}),e[27]=x,e[28]=w):w=e[28];let j;e[29]!==a?(j=a("settings.connectForms.labelPlaceholder"),e[29]=a,e[30]=j):j=e[30];let P;e[31]!==f?(P=f("label"),e[31]=f,e[32]=P):P=e[32];let A;e[33]!==j||e[34]!==P?(A=i.jsx(fe,{placeholder:j,...P,size:"sm"}),e[33]=j,e[34]=P,e[35]=A):A=e[35];let z;e[36]!==w||e[37]!==A?(z=i.jsxs("div",{className:"space-y-1",children:[w,A]}),e[36]=w,e[37]=A,e[38]=z):z=e[38];let O;e[39]!==a?(O=a("settings.connectForms.apiKeyField"),e[39]=a,e[40]=O):O=e[40];let R;e[41]!==O?(R=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:O}),e[41]=O,e[42]=R):R=e[42];const G=h?"text":"password";let $;e[43]!==f?($=f("apiKey"),e[43]=f,e[44]=$):$=e[44];let X;e[45]!==G||e[46]!==$?(X=i.jsx(fe,{type:G,placeholder:"sk-...",...$,size:"sm",className:"ph-no-capture pr-8"}),e[45]=G,e[46]=$,e[47]=X):X=e[47];let Z;e[48]!==h?(Z=()=>d(!h),e[48]=h,e[49]=Z):Z=e[49];let Q;e[50]!==h||e[51]!==a?(Q=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[50]=h,e[51]=a,e[52]=Q):Q=e[52];let B;e[53]!==h?(B=h?i.jsx(Ye,{size:14}):i.jsx(Qe,{size:14}),e[53]=h,e[54]=B):B=e[54];let V;e[55]!==Z||e[56]!==Q||e[57]!==B?(V=i.jsx("button",{type:"button",onClick:Z,"aria-label":Q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:B}),e[55]=Z,e[56]=Q,e[57]=B,e[58]=V):V=e[58];let ee;e[59]!==X||e[60]!==V?(ee=i.jsxs("div",{className:"relative",children:[X,V]}),e[59]=X,e[60]=V,e[61]=ee):ee=e[61];let H;e[62]!==b.apiKey?(H=b.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[62]=b.apiKey,e[63]=H):H=e[63];let q;e[64]!==R||e[65]!==ee||e[66]!==H?(q=i.jsxs("div",{className:"space-y-1",children:[R,ee,H]}),e[64]=R,e[65]=ee,e[66]=H,e[67]=q):q=e[67];let J;e[68]!==S?(J=S&&i.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[68]=S,e[69]=J):J=e[69];let T;e[70]!==a?(T=a("settings.connectForms.cancel"),e[70]=a,e[71]=T):T=e[71];let F;e[72]!==g||e[73]!==s||e[74]!==T?(F=i.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:g,children:T}),e[72]=g,e[73]=s,e[74]=T,e[75]=F):F=e[75];let L;e[76]!==g||e[77]!==a?(L=a(g?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[76]=g,e[77]=a,e[78]=L):L=e[78];let K;e[79]!==g||e[80]!==L?(K=i.jsx(re,{type:"submit",size:"sm",disabled:g,children:L}),e[79]=g,e[80]=L,e[81]=K):K=e[81];let U;e[82]!==F||e[83]!==K?(U=i.jsxs(qe,{children:[F,K]}),e[82]=F,e[83]=K,e[84]=U):U=e[84];let te;return e[85]!==M||e[86]!==z||e[87]!==q||e[88]!==J||e[89]!==U?(te=i.jsxs("form",{onSubmit:M,className:"space-y-3",children:[z,q,J,U]}),e[85]=M,e[86]=z,e[87]=q,e[88]=J,e[89]=U,e[90]=te):te=e[90],te}function is(n){return He({label:ge().optional(),baseUrl:ge().min(1,n),apiKey:ge().optional()})}function ns(n){const e=W.c(109),{preset:t,onCancel:s,onSuccess:o}=n,{org:l}=ye(),r=ke(),c=we(),[h,d]=D.useState(!1),a=ie();let m;e[0]!==a?(m=Be(is(a("settings.connectForms.baseUrlRequired"))),e[0]=a,e[1]=m):m=e[1];const p=t?.defaultBaseUrl??"";let u;e[2]!==p?(u={label:"",baseUrl:p,apiKey:""},e[2]=p,e[3]=u):u=e[3];let f;e[4]!==m||e[5]!==u?(f={resolver:m,defaultValues:u},e[4]=m,e[5]=u,e[6]=f):f=e[6];const{register:v,handleSubmit:k,formState:b}=Ve(f),{errors:y}=b;let _;e[7]!==t||e[8]!==r?(_=async oe=>{const ot=JSON.stringify({baseUrl:oe.baseUrl,apiKey:oe.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:oe.label||t?.name||oe.baseUrl,apiKey:ot,...t?{presetId:t.id}:{}})},e[7]=t,e[8]=r,e[9]=_):_=e[9];let C;e[10]!==o||e[11]!==l||e[12]!==c||e[13]!==a?(C=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(l.id)}),c.invalidateQueries({queryKey:pe.aiProviders(l.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[10]=o,e[11]=l,e[12]=c,e[13]=a,e[14]=C):C=e[14];let E;e[15]!==a?(E=oe=>{le.error(a("settings.connectForms.failedSaveConnection",{error:oe.message}))},e[15]=a,e[16]=E):E=e[16];let I;e[17]!==_||e[18]!==C||e[19]!==E?(I={mutationFn:_,onSuccess:C,onError:E},e[17]=_,e[18]=C,e[19]=E,e[20]=I):I=e[20];const{mutate:g,isPending:S,error:N}=Se(I);let M;e[21]!==t||e[22]!==a?(M=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[21]=t,e[22]=a,e[23]=M):M=e[23];const x=M;let w;e[24]!==t?.baseUrlPlaceholder||e[25]!==a?(w=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[24]=t?.baseUrlPlaceholder,e[25]=a,e[26]=w):w=e[26];const j=w;let P;e[27]!==g?(P=oe=>g(oe),e[27]=g,e[28]=P):P=e[28];let A;e[29]!==k||e[30]!==P?(A=k(P),e[29]=k,e[30]=P,e[31]=A):A=e[31];let z;e[32]!==a?(z=a("settings.connectForms.labelField"),e[32]=a,e[33]=z):z=e[33];let O;e[34]!==z?(O=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:z}),e[34]=z,e[35]=O):O=e[35];let R;e[36]!==v?(R=v("label"),e[36]=v,e[37]=R):R=e[37];let G;e[38]!==x||e[39]!==R?(G=i.jsx(fe,{placeholder:x,...R,size:"sm"}),e[38]=x,e[39]=R,e[40]=G):G=e[40];let $;e[41]!==O||e[42]!==G?($=i.jsxs("div",{className:"space-y-1",children:[O,G]}),e[41]=O,e[42]=G,e[43]=$):$=e[43];let X;e[44]!==j||e[45]!==y||e[46]!==t?.defaultBaseUrl||e[47]!==v||e[48]!==a?(X=t?.defaultBaseUrl?i.jsx("input",{type:"hidden",...v("baseUrl")}):i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),i.jsx(fe,{type:"url",placeholder:j,...v("baseUrl"),size:"sm"}),y.baseUrl&&i.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[44]=j,e[45]=y,e[46]=t?.defaultBaseUrl,e[47]=v,e[48]=a,e[49]=X):X=e[49];let Z;e[50]!==a?(Z=a("settings.connectForms.apiKeyField"),e[50]=a,e[51]=Z):Z=e[51];let Q;e[52]!==t?.apiKeyRecommended||e[53]!==a?(Q=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[52]=t?.apiKeyRecommended,e[53]=a,e[54]=Q):Q=e[54];let B;e[55]!==Q?(B=i.jsxs("span",{className:"text-muted-foreground/60",children:["(",Q,")"]}),e[55]=Q,e[56]=B):B=e[56];let V;e[57]!==Z||e[58]!==B?(V=i.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[Z," ",B]}),e[57]=Z,e[58]=B,e[59]=V):V=e[59];const ee=h?"text":"password";let H;e[60]!==v?(H=v("apiKey"),e[60]=v,e[61]=H):H=e[61];let q;e[62]!==ee||e[63]!==H?(q=i.jsx(fe,{type:ee,placeholder:"sk-...",...H,size:"sm",className:"ph-no-capture pr-8"}),e[62]=ee,e[63]=H,e[64]=q):q=e[64];let J;e[65]!==h?(J=()=>d(!h),e[65]=h,e[66]=J):J=e[66];let T;e[67]!==h||e[68]!==a?(T=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[67]=h,e[68]=a,e[69]=T):T=e[69];let F;e[70]!==h?(F=h?i.jsx(Ye,{size:14}):i.jsx(Qe,{size:14}),e[70]=h,e[71]=F):F=e[71];let L;e[72]!==J||e[73]!==T||e[74]!==F?(L=i.jsx("button",{type:"button",onClick:J,"aria-label":T,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[72]=J,e[73]=T,e[74]=F,e[75]=L):L=e[75];let K;e[76]!==q||e[77]!==L?(K=i.jsxs("div",{className:"relative",children:[q,L]}),e[76]=q,e[77]=L,e[78]=K):K=e[78];let U;e[79]!==V||e[80]!==K?(U=i.jsxs("div",{className:"space-y-1",children:[V,K]}),e[79]=V,e[80]=K,e[81]=U):U=e[81];let te;e[82]!==t?(te=t?.helpText&&i.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[82]=t,e[83]=te):te=e[83];let se;e[84]!==N?(se=N&&i.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[84]=N,e[85]=se):se=e[85];let ae;e[86]!==a?(ae=a("settings.connectForms.cancel"),e[86]=a,e[87]=ae):ae=e[87];let ce;e[88]!==S||e[89]!==s||e[90]!==ae?(ce=i.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:S,children:ae}),e[88]=S,e[89]=s,e[90]=ae,e[91]=ce):ce=e[91];let de;e[92]!==S||e[93]!==a?(de=a(S?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[92]=S,e[93]=a,e[94]=de):de=e[94];let he;e[95]!==S||e[96]!==de?(he=i.jsx(re,{type:"submit",size:"sm",disabled:S,children:de}),e[95]=S,e[96]=de,e[97]=he):he=e[97];let ue;e[98]!==ce||e[99]!==he?(ue=i.jsxs(qe,{children:[ce,he]}),e[98]=ce,e[99]=he,e[100]=ue):ue=e[100];let je;return e[101]!==A||e[102]!==$||e[103]!==X||e[104]!==U||e[105]!==te||e[106]!==se||e[107]!==ue?(je=i.jsxs("form",{onSubmit:A,className:"space-y-3",children:[$,X,U,te,se,ue]}),e[101]=A,e[102]=$,e[103]=X,e[104]=U,e[105]=te,e[106]=se,e[107]=ue,e[108]=je):je=e[108],je}const ls={kind:"closed"};function os(n,e){switch(e.type){case"open":return n.kind==="closed"?{kind:"grid"}:n;case"close":return{kind:"closed"};case"back":switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return n}case"select-form":return n.kind!=="grid"?n:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return n.kind!=="grid"?n:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return n.kind==="oauth-pending"?{kind:"grid"}:n;case"select-provision":return n.kind!=="grid"?n:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return n.kind!=="provision-pending"?n:{kind:"provision-error",providerId:n.providerId,error:e.error};case"retry-provision":return n.kind!=="provision-error"?n:{kind:"provision-pending",providerId:n.providerId}}}function rs(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function as({open:n,onOpenChange:e,initialProvider:t}){const s=ie(),l=_e()?.providers??[],{org:r}=ye(),c=ke(),h=we(),[d,a]=D.useReducer(os,ls),m=D.useRef(!1);D.useEffect(()=>{n&&d.kind==="closed"?a({type:"open"}):!n&&d.kind!=="closed"&&a({type:"close"})},[n,d.kind]);const p=()=>{m.current=!1,a({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:pe.aiProviderKeys(r.id)}),h.invalidateQueries({queryKey:pe.aiProviders(r.id)})},{mutate:f}=Se({mutationFn:async({providerId:x,code:w,stateToken:j,label:P})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:x,code:w,stateToken:j,label:P}),x),onSuccess:x=>{ne("ai_provider_oauth_succeeded",{provider_id:x}),u();const w=l.find(j=>j.id===x);le.success(s("settings.connectProviderDialog.oauthSuccessMessage",{provider:w?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(x,w)=>{ne("ai_provider_oauth_failed",{provider_id:w.providerId,error:x.message}),le.error(s("settings.connectProviderDialog.oauthFailedMessage",{error:x.message})),a({type:"oauth-failed"})}}),{mutate:v}=Se({mutationFn:async x=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:x}),x),onSuccess:x=>{ne("ai_provider_provision_succeeded",{provider_id:x}),u();const w=l.find(j=>j.id===x);le.success(s("settings.connectProviderDialog.provisionSuccessMessage",{provider:w?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(x,w)=>{ne("ai_provider_provision_failed",{provider_id:w,error:x.message}),a({type:"provision-error",error:x.message})}}),k=async x=>{const{provider:w}=x,j=x.kind==="openai-compatible"?x.preset?.id??null:null,P=w.supportedMethods.includes("oauth-pkce"),A=w.supportedMethods.includes("api-key");if(w.supportsProvision===!0){ne("ai_provider_connect_clicked",{provider_id:w.id,method:"provision"}),a({type:"select-provision",providerId:w.id}),v(w.id);return}if(P){ne("ai_provider_connect_clicked",{provider_id:w.id,method:"oauth-pkce"});try{const O=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:w.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:w.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(s("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}A&&(ne("ai_provider_connect_clicked",{provider_id:w.id,...j!==null?{preset_id:j}:{},method:"api-key"}),a({type:"select-form",providerId:w.id,presetId:j}))},b=D.useRef(k);b.current=k;const y=D.useRef(t);y.current=t,D.useEffect(()=>{!y.current||d.kind!=="grid"||m.current||(m.current=!0,b.current(y.current))},[d.kind]);const _=d.kind==="oauth-pending"?d.stateToken:null,C=d.kind==="oauth-pending"?d.providerId:null;D.useEffect(()=>{if(d.kind!=="oauth-pending")return;let x=!1;const w=d.stateToken,j=d.providerId,P=z=>{if(z.origin!==window.location.origin||z.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:R}=z.data;if(R!==w){le.error(s("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}x=!0;const G=l.find($=>$.id===j);f({providerId:j,code:O,stateToken:w,label:G?.name??j})};window.addEventListener("message",P);const A=setTimeout(()=>{x||(ne("ai_provider_oauth_timeout",{provider_id:j}),a({type:"oauth-failed"}),le.error(s("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",P),clearTimeout(A)}},[d.kind,_,C,f]);const E=rs(d),I=E?l.find(x=>x.id===E):null,S=(d.kind==="form"&&d.presetId?be(d.presetId):null)?.name??I?.name??s("settings.connectProviderDialog.defaultTitle"),N=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():a({type:"back"})};return i.jsx(ct,{open:d.kind!=="closed",onOpenChange:x=>!x&&p(),children:i.jsxs(dt,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsxs(ht,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[N&&i.jsx(re,{variant:"ghost",size:"icon-sm","aria-label":s("settings.connectProviderDialog.backButtonLabel"),onClick:M,children:i.jsx(Ge,{size:16})}),i.jsx(ut,{children:S})]}),d.kind==="grid"&&!t&&i.jsx(mt,{children:s("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&i.jsx(et,{providers:l,onSelect:k}),d.kind==="form"&&(d.providerId==="openai-compatible"?i.jsx(ns,{preset:d.presetId?be(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}}):i.jsx(ss,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}})),d.kind==="oauth-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Pe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground text-center",children:s("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Pe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:s("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[i.jsx(Ft,{size:28,className:"text-destructive"}),i.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(re,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:s("settings.connectProviderDialog.backButton")}),i.jsx(re,{size:"sm",onClick:()=>{a({type:"retry-provision"}),v(d.providerId)},children:s("settings.connectProviderDialog.retryButton")})]})]})]})})}function cs(n){const e=W.c(36);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:s,description:o,providerFilter:l}=t,r=ie(),{org:c}=ye(),[h,d]=D.useState(null),[a,m]=D.useState(!1),p=_e();let u;e[2]!==p?.providers?(u=p?.providers??[],e[2]=p?.providers,e[3]=u):u=e[3];let f;if(e[4]!==l||e[5]!==u){let O;e[7]!==l?(O=R=>!l||l(R.id),e[7]=l,e[8]=O):O=e[8],f=u.filter(O),e[4]=l,e[5]=u,e[6]=f}else f=e[6];const v=f,k=c.name;let b;e[9]!==k||e[10]!==r||e[11]!==s?(b=s??(k?r("chat.noAiProviderEmptyState.headingWithOrg",{org:k}):r("chat.noAiProviderEmptyState.headingDefault")),e[9]=k,e[10]=r,e[11]=s,e[12]=b):b=e[12];const y=b;let _;e[13]!==o||e[14]!==r?(_=o??r("chat.noAiProviderEmptyState.subtitleDefault"),e[13]=o,e[14]=r,e[15]=_):_=e[15];const C=_;let E;e[16]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx("div",{className:"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border",children:i.jsx(zt,{size:24,className:"text-muted-foreground"})}),e[16]=E):E=e[16];let I;e[17]!==y?(I=i.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:y}),e[17]=y,e[18]=I):I=e[18];let g;e[19]!==C?(g=i.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:C}),e[19]=C,e[20]=g):g=e[20];let S;e[21]!==I||e[22]!==g?(S=i.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[E,i.jsxs("div",{className:"space-y-2",children:[I,g]})]}),e[21]=I,e[22]=g,e[23]=S):S=e[23];let N,M;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=O=>d(O),M=()=>m(!0),e[24]=N,e[25]=M):(N=e[24],M=e[25]);let x;e[26]!==v?(x=i.jsx("div",{className:"w-full",children:i.jsx(et,{providers:v,onSelect:N,onShowAll:M})}),e[26]=v,e[27]=x):x=e[27];const w=h!==null||a;let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=O=>{O||(d(null),m(!1))},e[28]=j):j=e[28];const P=h??void 0;let A;e[29]!==w||e[30]!==P?(A=i.jsx(as,{open:w,onOpenChange:j,initialProvider:P}),e[29]=w,e[30]=P,e[31]=A):A=e[31];let z;return e[32]!==x||e[33]!==A||e[34]!==S?(z=i.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[S,x,A]}),e[32]=x,e[33]=A,e[34]=S,e[35]=z):z=e[35],z}function Ce(n){const e=n.title.includes(": ");return{provider:e?n.title.split(": ")[0]??"":n.modelId.split("/")[0]??"",displayName:e?n.title.split(": ").slice(1).join(": "):n.title}}function ds(n){return n<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:n<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:n<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const hs=["bg-destructive","bg-warning","bg-success","bg-success"],us=["text-success","text-warning","text-warning","text-destructive"];function ms(n,e){const t=Math.round(n*.75/1e3),s=t>=1?`${t}K`:`${Math.round(n*.75)}`;return e("chat.shared.approxWords",{wordCount:s})}function fs(n){return n<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:n<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:n<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const ps={text:{icon:i.jsx(Ct,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:i.jsx(Rt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:i.jsx(It,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:i.jsx(_t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:i.jsx(wt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:i.jsx(Xe,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function xs(n){const e=W.c(10),{capability:t}=n,s=ie(),o=ps[t];if(o){const h=o.icon;let d;e[0]!==o.labelKey||e[1]!==s?(d=s(o.labelKey),e[0]=o.labelKey,e[1]=s,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=i.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[h,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let l;e[6]!==t?(l=t.charAt(0).toUpperCase(),e[6]=t,e[7]=l):l=e[7];const r=l+t.slice(1);let c;return e[8]!==r?(c=i.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=c):c=e[9],c}function gs(n){const e=W.c(59),{model:t,compact:s}=n,o=s===void 0?!1:s,l=ie();if(!t){let g;e[0]!==l?(g=l("chat.shared.hoverToPreview"),e[0]=l,e[1]=g):g=e[1];let S;return e[2]!==g?(S=i.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:g}),e[2]=g,e[3]=S):S=e[3],S}const r=t.costs?.input!=null?t.costs.input*1e6:null,c=t.costs?.output!=null?t.costs.output*1e6:null;let h;e[4]!==t?(h=Ce(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:a}=h;if(o){let g;e[6]!==t.limits||e[7]!==l?(g=t.limits?.contextWindow&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.context")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=l,e[8]=g):g=e[8];let S;e[9]!==r||e[10]!==l?(S=r!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.input")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=l,e[11]=S):S=e[11];let N;e[12]!==c||e[13]!==l?(N=c!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.output")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=l,e[14]=N):N=e[14];let M;e[15]!==t.limits||e[16]!==l?(M=t.limits?.maxOutputTokens&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.outputLimit")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=l,e[17]=M):M=e[17];let x;return e[18]!==g||e[19]!==S||e[20]!==N||e[21]!==M?(x=i.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,S,N,M]}),e[18]=g,e[19]=S,e[20]=N,e[21]=M,e[22]=x):x=e[22],x}let m;e[23]!==d?(m=i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=m):m=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&i.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let u;e[28]!==a?(u=i.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=u):u=e[29];let f;e[30]!==p||e[31]!==u?(f=i.jsxs("div",{className:"flex items-center gap-2.5",children:[p,u]}),e[30]=p,e[31]=u,e[32]=f):f=e[32];let v;e[33]!==t.modelId?(v=i.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=v):v=e[34];let k;e[35]!==m||e[36]!==f||e[37]!==v?(k=i.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,f,v]}),e[35]=m,e[36]=f,e[37]=v,e[38]=k):k=e[38];let b;e[39]!==t.capabilities?(b=t.capabilities&&t.capabilities.length>0&&i.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(vs)}),e[39]=t.capabilities,e[40]=b):b=e[40];let y;e[41]!==t.limits||e[42]!==l?(y=t.limits?.contextWindow&&(()=>{const{level:g,labelKey:S,descriptionKey:N}=ds(t.limits.contextWindow);return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.contextWindow")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>i.jsx("div",{className:ve("w-2 h-2 rounded-full",M<=g?hs[g-1]:"bg-muted")},M))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:l(S)}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l(N)]})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=l,e[43]=y):y=e[43];let _;e[44]!==t.limits||e[45]!==l?(_=t.limits?.maxOutputTokens&&i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.outputLimit")}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]}),i.jsx("span",{className:"text-sm text-muted-foreground",children:ms(t.limits.maxOutputTokens,l)})]})]}),e[44]=t.limits,e[45]=l,e[46]=_):_=e[46];let C;e[47]!==r||e[48]!==c||e[49]!==l?(C=(r!=null||c!=null)&&(()=>{const{level:g,labelKey:S}=r!=null?fs(r):{level:0,labelKey:null};return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.pricing")}),r!=null&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(N=>i.jsx("span",{className:ve("text-sm font-semibold leading-none",N<=g?us[g-1]:"text-muted-foreground/20"),children:"$"},N))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:S?l(S):""})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.input")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]}),c!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.output")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=c,e[49]=l,e[50]=C):C=e[50];let E;e[51]!==y||e[52]!==_||e[53]!==C?(E=i.jsxs("div",{className:"flex flex-col gap-6",children:[y,_,C]}),e[51]=y,e[52]=_,e[53]=C,e[54]=E):E=e[54];let I;return e[55]!==E||e[56]!==k||e[57]!==b?(I=i.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[k,b,E]}),e[55]=E,e[56]=k,e[57]=b,e[58]=I):I=e[58],I}function vs(n){return i.jsx(xs,{capability:n},n)}function ri(n){const e=W.c(22),{model:t,placeholder:s,isLoading:o}=n,l=o===void 0?!1:o,r=ie();let c;e[0]!==s||e[1]!==r?(c=s??r("chat.shared.selectModel"),e[0]=s,e[1]=r,e[2]=c):c=e[2];const h=c;if(l){let b;return e[3]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Y,{className:"w-5 h-5 rounded-sm shrink-0"}),i.jsx(Y,{className:"w-16 h-3 hidden md:block"})]}),e[3]=b):b=e[3],b}if(!t){let b;e[4]!==h?(b=i.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=b):b=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(Ae,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=y):y=e[6];let _;return e[7]!==b?(_=i.jsxs("div",{className:"flex items-center gap-1.5",children:[b,y]}),e[7]=b,e[8]=_):_=e[8],_}let d;e[9]!==t?(d=Ce(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let m;e[11]!==t?(m=Ie(t),e[11]=t,e[12]=m):m=e[12];const p=m;let u;e[13]!==t.title||e[14]!==p?(u=i.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=u):u=e[15];let f;e[16]!==a?(f=i.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=f):f=e[17];let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx(Ae,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=v):v=e[18];let k;return e[19]!==u||e[20]!==f?(k=i.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,f,v]}),e[19]=u,e[20]=f,e[21]=k):k=e[21],k}const bs=["vision","image","file","audio","video"],tt=["image/png","image/jpeg","image/gif","image/webp"],st=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Me(n){const e=n?.capabilities;return e?bs.some(t=>e.includes(t)):!1}function ai(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],s=t.includes("vision")||t.includes("image"),o=t.includes("file"),l=t.includes("audio"),r=t.includes("video");return!!(s&&tt.includes(n)||o&&n==="application/pdf"||l&&n.startsWith("audio/")||r&&n.startsWith("video/")||Me(e)&&st.includes(n))}function ci(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...tt),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Me(n)&&t.push(...st),t.join(",")}function di(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Me(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const it=["smarter","faster","cheaper"],ys={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},js=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ss=js.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),Ns="google/gemini-2.5-pro",De=new Map;function ks(n){const e=De.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:s,prefix:o}of Ss)if(n.startsWith(o)){if(o===Ns&&n.length>o.length&&n[o.length]==="-"){const r=n[o.length+1];if(!r||!/\d/.test(r))continue}t=s;break}return De.set(n,t),t}function ws(n,e,t){if(t)return n;const s=n.filter(o=>e.has(o.modelId));return s.length>0?s:n}function $e(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const s=ks(t.modelId);e[s??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((s,o)=>s.title.localeCompare(o.title));return e}const nt="studio:model-shortlist:",_s=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Is(n){try{const e=localStorage.getItem(nt+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Cs(n,e){localStorage.setItem(nt+n,JSON.stringify([...e]))}function Ms(n){const e=W.c(21),{model:t,onHover:s}=n;let o;e[0]!==t?(o=Ce(t),e[0]=t,e[1]=o):o=e[1];const{displayName:l,provider:r}=o;let c;e[2]!==t?(c=Ie(t),e[2]=t,e[3]=c):c=e[3];const h=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==h?(a=i.jsx("img",{src:h,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=h,e[9]=a):a=e[9];let m;e[10]!==l?(m=i.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:l}),e[10]=l,e[11]=m):m=e[11];let p;e[12]!==r?(p=i.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let u;e[14]!==m||e[15]!==p?(u=i.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[m,p]}),e[14]=m,e[15]=p,e[16]=u):u=e[16];let f;return e[17]!==d||e[18]!==a||e[19]!==u?(f=i.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,u]}),e[17]=d,e[18]=a,e[19]=u,e[20]=f):f=e[20],f}function Es(n){const e=W.c(16),{error:t,onRetry:s}=n,o=ie();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:i.jsx(xt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];const r=o("chat.decopilot.failedToLoadModels");let c;e[1]!==r?(c=i.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=c):c=e[2];const h=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==h||e[4]!==d?(a=i.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=a):a=e[5];let m;e[6]!==c||e[7]!==a?(m=i.jsxs("div",{className:"flex flex-col gap-1",children:[c,a]}),e[6]=c,e[7]=a,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Et,{className:"size-3.5"}),e[9]=p):p=e[9];const u=o("chat.decopilot.retry");let f;e[10]!==s||e[11]!==u?(f=i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs(re,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[p,u]})}),e[10]=s,e[11]=u,e[12]=f):f=e[12];let v;return e[13]!==f||e[14]!==m?(v=i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,m,f]}),e[13]=f,e[14]=m,e[15]=v):v=e[15],v}function Os(){const n=W.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Ps)}),n[0]=e):e=n[0],e}function Ps(n,e){return i.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[i.jsx(Y,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(Y,{className:"flex-1 h-4"}),i.jsx(Y,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ue(n){const e=W.c(12),{label:t,models:s,onSelect:o,onHover:l}=n;if(s.length===0)return null;let r;e[0]!==t?(r=i.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==s||e[3]!==l||e[4]!==o){let d;e[6]!==l||e[7]!==o?(d=a=>i.jsx("button",{type:"button",onClick:()=>o(a),onFocus:()=>l(a),className:"w-full text-left cursor-pointer",children:i.jsx(Ms,{model:a,onHover:l})},a.modelId),e[6]=l,e[7]=o,e[8]=d):d=e[8],c=s.map(d),e[2]=s,e[3]=l,e[4]=o,e[5]=c}else c=e[5];let h;return e[9]!==r||e[10]!==c?(h=i.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=h):h=e[11],h}function Ne(n,e){return e(n==="other"?"chat.decopilot.tierOther":ys[n])}function As(n){const e=W.c(21),{model:t,isChecked:s,onToggle:o,onHover:l}=n,[r,c]=D.useState(s);r!==s&&c(s);let h;e[0]!==t?(h=Ie(t),e[0]=t,e[1]=h):h=e[1];const d=h;let a;e[2]!==t||e[3]!==l?(a=()=>l(t),e[2]=t,e[3]=l,e[4]=a):a=e[4];let m;e[5]!==t.modelId||e[6]!==o?(m=()=>{c(Ts),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==r||e[9]!==m?(p=i.jsx(gt,{checked:r,onCheckedChange:m}),e[8]=r,e[9]=m,e[10]=p):p=e[10];let u;e[11]!==d||e[12]!==t.title?(u=i.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=u):u=e[13];let f;e[14]!==t.title?(f=i.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let v;return e[16]!==a||e[17]!==p||e[18]!==u||e[19]!==f?(v=i.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,u,f]}),e[16]=a,e[17]=p,e[18]=u,e[19]=f,e[20]=v):v=e[20],v}function Ts(n){return!n}function zs(n,e){const t=[];for(const s of it)if(n[s].length>0){t.push({type:"header",label:Ne(s,e)});for(const o of n[s])t.push({type:"model",model:o})}if(n.other.length>0){t.push({type:"header",label:Ne("other",e)});for(const s of n.other)t.push({type:"model",model:s})}return t}function Fs({items:n,shortlistSet:e,onToggle:t,onHover:s}){const o=D.useRef(null),l=Xt({count:n.length,getScrollElement:()=>o.current,estimateSize:r=>n[r]?.type==="header"?36:44,overscan:6});return i.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"relative",style:{height:l.getTotalSize()},children:l.getVirtualItems().map(r=>{const c=n[r.index];return c?i.jsx("div",{"data-index":r.index,ref:l.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?i.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):i.jsx(As,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:s})},r.key):null})})})}function Ls(n){const e=W.c(28),{keyId:t,searchTerm:s,onHover:o,onModelSelect:l,managing:r,onToggleManage:c,filterModels:h}=n,d=ie(),{models:a}=Pt(t),m=h?a.filter(h):a.filter(At);let p;e[0]!==t?(p=()=>(t?Is(t):null)??_s,e[0]=t,e[1]=p):p=e[1];const[u,f]=D.useState(p),[,v]=D.useTransition();let k;e[2]!==t||e[3]!==v?(k=N=>{t&&v(()=>{f(M=>{const x=new Set(M);return x.has(N)?x.delete(N):x.add(N),Cs(t,x),x})})},e[2]=t,e[3]=v,e[4]=k):k=e[4];const b=k,y=s.toLowerCase().trim(),_=N=>y?N.filter(M=>M.title.toLowerCase().includes(y)||M.modelId.toLowerCase().includes(y)):N;if(r){const N=$e(_(m)),M=zs(N,d);let x;e[5]!==u?(x=z=>u.has(z.modelId),e[5]=u,e[6]=x):x=e[6];const w=m.filter(x).length;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx(Ge,{size:14}),e[7]=j):j=e[7];let P;e[8]!==d?(P=d("chat.decopilot.back"),e[8]=d,e[9]=P):P=e[9];let A;return e[10]!==c||e[11]!==P?(A=i.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[j,P]}),e[10]=c,e[11]=P,e[12]=A):A=e[12],i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[A,i.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:w})})]}),i.jsx(Fs,{items:M,shortlistSet:u,onToggle:b,onHover:o})]})}const C=$e(_(ws(m,u,y)));let E;e[13]!==C||e[14]!==o||e[15]!==l||e[16]!==d?(E=it.map(N=>i.jsx(Ue,{label:Ne(N,d),models:C[N],onSelect:l,onHover:o},N)),e[13]=C,e[14]=o,e[15]=l,e[16]=d,e[17]=E):E=e[17];let I;e[18]!==d?(I=Ne("other",d),e[18]=d,e[19]=I):I=e[19];let g;e[20]!==C.other||e[21]!==o||e[22]!==l||e[23]!==I?(g=i.jsx(Ue,{label:I,models:C.other,onSelect:l,onHover:o}),e[20]=C.other,e[21]=o,e[22]=l,e[23]=I,e[24]=g):g=e[24];let S;return e[25]!==E||e[26]!==g?(S=i.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[E,g]}),e[25]=E,e[26]=g,e[27]=S):S=e[27],S}function hi(){const n=W.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:i.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[i.jsx(Y,{className:"size-4 shrink-0"}),i.jsx(Y,{className:"flex-1 h-6"}),i.jsx(Y,{className:"w-[140px] h-8 shrink-0"})]})}),n[0]=e):e=n[0];let t;n[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,i.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Rs)})]}),n[1]=t):t=n[1];let s;n[2]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(Y,{className:"size-6 shrink-0"}),i.jsx(Y,{className:"h-6 w-32"})]}),n[2]=s):s=n[2];let o;n[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[s,i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Y,{className:"h-6 w-20 rounded-md"}),i.jsx(Y,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=o):o=n[3];let l;n[4]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(Y,{className:"h-4 w-24"}),i.jsx(Y,{className:"h-4 w-32"})]}),n[4]=l):l=n[4];let r;return n[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,i.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:i.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,i.jsxs("div",{className:"flex flex-col gap-4",children:[l,i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(Y,{className:"h-4 w-16"}),i.jsx(Y,{className:"h-4 w-40"})]})]})]})})]}),n[5]=r):r=n[5],r}function Rs(n,e){return i.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[i.jsx(Y,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(Y,{className:"flex-1 h-4"}),i.jsx(Y,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function lt(n){const e=W.c(66),{onClose:t,credentialId:s,onCredentialChange:o,selectedModel:l,onModelChange:r,filterModels:c,compact:h}=n,d=ie(),[a,m]=D.useState(null),[p,u]=D.useState(""),[f,v]=D.useState(!1),k=_e(),b=Ot();let y;e[0]!==k?.providers?(y=Object.fromEntries((k?.providers??[]).map($s)),e[0]=k?.providers,e[1]=y):y=e[1];const _=y,C=ft(),{org:E}=ye();let I;e[2]!==o?(I=T=>{o(T),m(null)},e[2]=o,e[3]=I):I=e[3];const g=I;let S;e[4]!==s||e[5]!==t||e[6]!==r?(S=T=>{s&&(r(T),u(""),t())},e[4]=s,e[5]=t,e[6]=r,e[7]=S):S=e[7];const N=S;if(b.length===0){const T=!h&&"sm:w-[740px]";let F;e[8]!==T?(F=ve("flex items-center justify-center p-8 w-full",T),e[8]=T,e[9]=F):F=e[9];let L;e[10]===Symbol.for("react.memo_cache_sentinel")?(L=i.jsx(cs,{}),e[10]=L):L=e[10];let K;return e[11]!==F?(K=i.jsx("div",{className:F,children:L}),e[11]=F,e[12]=K):K=e[12],K}const M=h?"sm:h-[420px]":"sm:h-[460px]";let x;e[13]!==M?(x=ve("flex flex-col md:flex-row h-full min-h-0",M),e[13]=M,e[14]=x):x=e[14];const w=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let j;e[15]!==w?(j=ve("flex-1 flex flex-col min-h-0 overflow-hidden",w),e[15]=w,e[16]=j):j=e[16];let P;e[17]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(Xe,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=P):P=e[17];let A;e[18]!==f||e[19]!==d?(A=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=A):A=e[20];let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=T=>u(T.target.value),e[21]=z):z=e[21];let O;e[22]!==p||e[23]!==A?(O=i.jsx(fe,{autoFocus:!0,type:"text",placeholder:A,value:p,onChange:z,className:"flex-1 min-w-0 border-0 !shadow-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=A,e[24]=O):O=e[24];let R;e[25]!==s||e[26]!==g||e[27]!==b||e[28]!==_||e[29]!==d?(R=b.length>0&&i.jsxs(vt,{value:s??"",onValueChange:g,children:[i.jsxs(bt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Ds,children:[i.jsx(yt,{placeholder:d("chat.decopilot.key"),children:(()=>{const T=b.find(te=>te.id===s),F=T?_[T.providerId]:void 0,L=be(T?.presetId),K=L?.logo??F?.logo,U=L?.name??F?.name??T?.providerId??"Key";return i.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[K?i.jsx("img",{src:K,alt:U,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):i.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:U.slice(0,1).toUpperCase()}),i.jsx("span",{className:"text-xs truncate",children:U})]})})()}),i.jsx(Nt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),i.jsx(jt,{children:b.map(T=>{const F=_[T.providerId],L=be(T.presetId),K=L?.logo??F?.logo,U=L?.name??F?.name??T.providerId;return i.jsx(St,{value:T.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[K?i.jsx("img",{src:K,alt:U,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):i.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:U.slice(0,1).toUpperCase()}),i.jsxs("span",{children:[U," — ",T.label]})]})},T.id)})})]}),e[25]=s,e[26]=g,e[27]=b,e[28]=_,e[29]=d,e[30]=R):R=e[30];let G;e[31]!==O||e[32]!==R?(G=i.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:i.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[P,O,R]})}),e[31]=O,e[32]=R,e[33]=G):G=e[33];let $;e[34]!==s?($=T=>{const{error:F,resetError:L}=T;return i.jsx(Es,{error:F,onRetry:L,credentialId:s??void 0})},e[34]=s,e[35]=$):$=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=i.jsx(Os,{}),e[36]=X):X=e[36];const Z=s??void 0;let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>v(Ks),e[37]=Q):Q=e[37];let B;e[38]!==c||e[39]!==N||e[40]!==f||e[41]!==p||e[42]!==Z?(B=i.jsx(D.Suspense,{fallback:X,children:i.jsx(Ls,{keyId:Z,searchTerm:p,onHover:m,onModelSelect:N,managing:f,onToggleManage:Q,filterModels:c})}),e[38]=c,e[39]=N,e[40]=f,e[41]=p,e[42]=Z,e[43]=B):B=e[43];let V;e[44]!==s||e[45]!==$||e[46]!==B?(V=i.jsx(pt,{fallback:$,children:B},s),e[44]=s,e[45]=$,e[46]=B,e[47]=V):V=e[47];let ee;e[48]!==f||e[49]!==C||e[50]!==E||e[51]!==d?(ee=!f&&i.jsxs("div",{className:"border-t border-border flex",children:[i.jsxs("button",{type:"button",onClick:()=>D.startTransition(()=>v(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[i.jsx(Mt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),i.jsx("div",{className:"w-px bg-border shrink-0"}),i.jsxs("button",{type:"button",onClick:()=>C({to:"/$org/settings/ai-providers",params:{org:E.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[i.jsx(kt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=C,e[50]=E,e[51]=d,e[52]=ee):ee=e[52];let H;e[53]!==G||e[54]!==V||e[55]!==ee||e[56]!==j?(H=i.jsxs("div",{className:j,children:[G,V,ee]}),e[53]=G,e[54]=V,e[55]=ee,e[56]=j,e[57]=H):H=e[57];let q;e[58]!==h||e[59]!==a||e[60]!==l?(q=!h&&i.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:i.jsx(gs,{model:a??l??null})}),e[58]=h,e[59]=a,e[60]=l,e[61]=q):q=e[61];let J;return e[62]!==H||e[63]!==q||e[64]!==x?(J=i.jsxs("div",{className:x,children:[H,q]}),e[62]=H,e[63]=q,e[64]=x,e[65]=J):J=e[65],J}function Ks(n){return!n}function Ds(n){return n.stopPropagation()}function $s(n){return[n.id,n]}function Us(n){const e=W.c(12),{onClose:t}=n,{credentialId:s,setCredentialId:o,selectedModel:l,setModel:r}=Tt();let c;e[0]!==o?(c=a=>{ne("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=c):c=e[1];let h;e[2]!==s||e[3]!==l?.modelId||e[4]!==r?(h=a=>{s&&(ne("chat_model_changed",{from_model_id:l?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:s}),r({...a,keyId:s}))},e[2]=s,e[3]=l?.modelId,e[4]=r,e[5]=h):h=e[5];let d;return e[6]!==s||e[7]!==t||e[8]!==l||e[9]!==c||e[10]!==h?(d=i.jsx(lt,{onClose:t,credentialId:s,onCredentialChange:c,selectedModel:l,onModelChange:h}),e[6]=s,e[7]=t,e[8]=l,e[9]=c,e[10]=h,e[11]=d):d=e[11],d}function Ws(n){const e=W.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Us,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function Bs(n){const e=W.c(2);let t;return e[0]!==n?(t=i.jsx(lt,{...n}),e[0]=n,e[1]=t):t=e[1],t}function ui(n){const e=W.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Ws,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function mi(n){const e=W.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(Bs,{...t}),e[2]=t,e[3]=s):s=e[3],s}export{as as C,mi as M,cs as N,et as P,ri as S,hi as a,di as b,ui as c,be as d,ci as g,ai as i,Me as m};
@@ -1,4 +1,4 @@
1
- import{c as ue,r as xe,d as ns,a2 as ht,b as Pe,j as t,B as je,t as dt,af as Yt,an as as,K as bt,m as Et,a3 as As,l as ot,f0 as _s,h as Ks,b2 as Us,L as Vs,u as qs,n as _t,y as Wt,H as Hs,b5 as Bs,J as Js,W as Gs,I as Xt}from"./index-C_vsZdEs.js";import{S as Qs}from"./search-input-Dn_Mm6hP.js";import{E as Ht}from"./empty-state-gsVYH7fP.js";import{R as Ys}from"./require-capability-CW24vDTN.js";import{f as js}from"./pair-DO5ZeABu.js";import{u as ts}from"./use-connection-Bb5luwYC.js";import{g as Ps}from"./connection-slug-CITJ0kGN.js";import{B as Lt}from"./badge-CDeaoqCi.js";import{P as cs,a as ds,b as ms}from"./popover-CjjSJX-T.js";import{c as Pt,T as Dt,a as Rt,b as Ws}from"./tooltip-BKiQ2c4S.js";import{a as Ut}from"./Copy01-B-Kqql1v.js";import{n as Ns}from"./ZoomOut-CKf6RmrA.js";import{I as us,bM as Xs,a0 as Zs}from"./agent-icon-B7E6q_wB.js";import{i as el}from"./Key01-egFT7DX9.js";import{i as tl}from"./Play-COeyqncs.js";import{MonacoCodeEditor as bs}from"./monaco-editor-BzWTOVge.js";import{a as sl}from"./use-members-CMq0EOLQ.js";import{u as ll}from"./use-mcp-client-Q83YdvIg.js";import{b as rl}from"./repository-binding-DAOz6vJw.js";import{n as Ot}from"./LinkBroken01-OntVHV0h.js";import{c as il}from"./SwitchHorizontal01-ByDhQXb-.js";import{s as ol}from"./Plus-B4v3GkBC.js";import{s as nl}from"./Trash01-BJcybrX2.js";import{M as zt}from"./multi-select-CKLuefuY.js";import{b as yt,a as wt,c as ze,d as St,S as It}from"./select-35KAqptX.js";import{e as ys,T as al}from"./time-range-picker-CmcQeC_-.js";import{T as cl}from"./textarea-CzFPd8mY.js";import{C as Ds}from"./collection-tabs-DUP2Wv2k.js";import{S as dl}from"./switch-CUuF3Lbb.js";import{L as ml}from"./label-CCla7LnP.js";import{I as Ct}from"./integration-icon-CeG7h1x5.js";import{A as fs}from"./avatar-BD2PDf8q.js";import{A as ul,a as fl,b as xl}from"./alert-CfW38lSF.js";import{K as gt}from"./monitoring-stats-row-BagVDHFD.js";import{c as Bt}from"./use-decopilot-events-DQQB-1qO.js";import{g as pl,b as ws,f as Nt,c as Zt,d as gl,e as Ss,a as xs,h as hl,i as ps,T as vl,j as jl,r as Nl,k as bl}from"./thread-sheet-body-BW-XRqLk.js";import{u as yl}from"./useSuspenseInfiniteQuery-BK6RRGGC.js";import{c as wl,S as Sl,b as Rs,a as Ls}from"./sheet--x4K5vq7.js";import{c as _e,b as vt,d as Jt,e as Gt,T as ge,a as Qt}from"./table-BlnsYBCM.js";import{n as ss,t as ls}from"./ChevronUp-CBJitQaC.js";import{u as Os,A as Il}from"./automation-runs-DGVHidy8.js";import{u as Fs}from"./use-infinite-scroll-TKtAAXad.js";import{u as Cl}from"./useInfiniteQuery-XMmYWsXs.js";import{g as Tl}from"./task-status-DvsJuwH-.js";import{u as kl,d as Ml}from"./use-automations-DOZ_ddWM.js";import{i as _l}from"./ArrowLeft-BhYsdDhs.js";import{E as Is}from"./empty-state-C-9cwlrp.js";import{O as $s}from"./watch-sse-pool-BydfW6Wr.js";import{t as Pl}from"./task-key-BCHdFiOO.js";import{a as Dl}from"./format-time-Cq80KKvY.js";import{u as Rl,r as Ll,O as Ol,d as Fl}from"./order-monitor-day-DXxkF6qy.js";import{F as $l}from"./feature-gate-C5He1Jql.js";import"./SearchMd-DWVKWjSh.js";import"./access-gate-Bp5g1mrg.js";import"./capability-load-error-tQkVlgGI.js";import"./Tool01-Bhwq8fKA.js";import"./collapsible-DyKYJwPy.js";import"./use-copy-GYYhLXBY.js";import"./usage-stats-CTkcwRGv.js";import"./tool-namespace-BohpB6u5.js";import"./form-B4txFZ9_.js";import"./utils-CVEq3hMx.js";import"./markdown-BDTHe610.js";import"./location-V0VwTJTt.js";import"./use-mobile-DHwXmnJW.js";import"./use-panel-navigate-D3V5oZgG.js";import"./thread-route-CBR-hVjV.js";import"./use-project-scope-CXdLsOUx.js";import"./chat-context-C1JvjRtO.js";import"./autosend-YiZkI0k7.js";import"./thread-intent-Dimk3aQq.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./slugify-CEUa2lfQ.js";import"./use-ai-providers-De1swco5.js";import"./use-organization-settings-BKC0vqj5.js";import"./schema-B-d5VC7M.js";import"./task-board-Bt136szd.js";import"./use-clock-tick-DXHhIXGi.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CMRuQe66.js";import"./types-CjXbKtgO.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./AlertCircle-DBK8R4dI.js";import"./Image01-D5xmdMv9.js";import"./XClose-DbFkM30N.js";import"./ShoppingBag01-BhCtEuhY.js";import"./shell-layout-MuOSrWff.js";import"./Building02-BVkscSyZ.js";import"./UserSquare-BIGP81NS.js";import"./CheckCircle-Bnnstx7h.js";import"./Monitor01-QBQW5XNf.js";import"./command-C2RTsWLU.js";import"./index-Bp5c1HaS.js";import"./project-icon-N-_cW8IV.js";import"./new-project-dialog-C5J4MWsO.js";import"./repository-import-picker-BcrGb4sk.js";import"./use-navigate-to-agent-CRetfCk1.js";import"./repository-picker-BIZQUbzV.js";import"./collection-search-DF8xKBAI.js";import"./use-debounced-value-BOYaK5vY.js";import"./required-auth-layout-DZbUxfmT.js";import"./use-org-sso-ChZhVF-c.js";import"./Link01-DbW4kVwR.js";import"./use-mcp-prompts-BcqS4HpY.js";import"./use-thread-outputs-DTZGPUxN.js";import"./file-type-icon-CtKJHzOq.js";import"./index-CBPFaqzb.js";import"./ArrowUp-B-samV76.js";import"./ChevronSelectorVertical-rEBuyaLs.js";import"./CreditCard01-BuvGgoKU.js";import"./DotsVertical-kTicVrIf.js";import"./Globe04-KYEPLfFL.js";import"./Minus-DN-1q402.js";import"./Sun-DXxrAWEA.js";import"./Upload01-D6z8pgdP.js";import"./User01-BaPQvgQq.js";import"./Users01-OOPFNu5a.js";import"./editor-D3dE1UTI.js";import"./use-org-auth-client-Im4HAiDN.js";import"./auth-JXZLGOBb.js";import"./checkbox-BQV5rQq6.js";import"./index-BdQq_4o_.js";import"./scroll-area-DpJwcaMZ.js";import"./calendar-jrNp7aMz.js";import"./chart-BBE_aWjm.js";import"./index-DC_lXxHn.js";import"./symbol-BF05cGJ-.js";import"./CategoricalChart-BlWkKGI4.js";import"./CartesianChart-D5TCh86n.js";import"./AreaChart-CeMTC5TB.js";import"./tooltipContext-BKUF9aS4.js";import"./BarChart-D4vvVhNP.js";import"./ActiveShapeUtils-DpnSicPy.js";import"./Sector-CExKcwxp.js";import"./ErrorBarContext-BUVr9l59.js";import"./infiniteQueryObserver-C2uEQLvN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./useQueries-jpAcc0Og.js";import"./ReferenceLine-5iYQv1Rq.js";import"./feature-paywall-BKaJGna9.js";import"./plan-ladder-RZlDrpyw.js";const rs={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3},zl=["eq","contains","exists","in"];function El(s){return zl.includes(s)}function jt(s){return s.filter(e=>e.key.trim()).map(e=>{const l=encodeURIComponent(e.key.trim()),i=encodeURIComponent(e.value||"");return`${l}:${e.operator}:${i}`}).join(",")}function Al(s){return!s||typeof s!="string"?[]:s.split(",").map(e=>{if(!e)return;const[l,i,...m]=e.split(":"),n=l?decodeURIComponent(l):"";if(n.trim())return{key:n,operator:i&&El(i)?i:"eq",value:decodeURIComponent(m.join(":")||"")}}).filter(e=>e!==void 0)}function Vt(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 ue,r as xe,d as ns,a2 as ht,b as Pe,j as t,B as je,t as dt,af as Yt,an as as,K as bt,m as Et,a3 as As,l as ot,f0 as _s,h as Ks,b2 as Us,L as Vs,u as qs,n as _t,y as Wt,H as Hs,b5 as Bs,J as Js,W as Gs,I as Xt}from"./index-DJCD1T3p.js";import{S as Qs}from"./search-input-43leKkGn.js";import{E as Ht}from"./empty-state-vh9cmtA2.js";import{R as Ys}from"./require-capability-D5vaDJ6i.js";import{f as js}from"./pair-Cjnol9_x.js";import{u as ts}from"./use-connection-PJ_l98GU.js";import{g as Ps}from"./connection-slug-CITJ0kGN.js";import{B as Lt}from"./badge-7nY_ai7T.js";import{P as cs,a as ds,b as ms}from"./popover-BsX8gIsV.js";import{c as Pt,T as Dt,a as Rt,b as Ws}from"./tooltip-oRr5C_aw.js";import{a as Ut}from"./Copy01-CixCoZek.js";import{n as Ns}from"./ZoomOut-DnRMz8gp.js";import{I as us,bM as Xs,a0 as Zs}from"./agent-icon-2Sd6TPJR.js";import{i as el}from"./Key01-CxbATohw.js";import{i as tl}from"./Play-B6eaz3Uv.js";import{MonacoCodeEditor as bs}from"./monaco-editor-D1yDvJd3.js";import{a as sl}from"./use-members-BiXVclqd.js";import{u as ll}from"./use-mcp-client-DKIfKwpJ.js";import{b as rl}from"./repository-binding-CiDG0Cr0.js";import{n as Ot}from"./LinkBroken01-ZF7OlrXq.js";import{c as il}from"./SwitchHorizontal01-BKu4aB4V.js";import{s as ol}from"./Plus-B28tKNm1.js";import{s as nl}from"./Trash01-C34kFeWG.js";import{M as zt}from"./multi-select-BNUkLp8H.js";import{b as yt,a as wt,c as ze,d as St,S as It}from"./select-CHmq3OGd.js";import{e as ys,T as al}from"./time-range-picker-cljXExVl.js";import{T as cl}from"./textarea-CTbC00Fo.js";import{C as Ds}from"./collection-tabs-Dc2dImyc.js";import{S as dl}from"./switch-BKqScyl8.js";import{L as ml}from"./label-CBlQ82Fk.js";import{I as Ct}from"./integration-icon-CMGBZM9F.js";import{A as fs}from"./avatar-DarGMVT9.js";import{A as ul,a as fl,b as xl}from"./alert-B6jt7ehz.js";import{K as gt}from"./monitoring-stats-row-C-A-doof.js";import{c as Bt}from"./use-decopilot-events-CDLwP1Su.js";import{g as pl,b as ws,f as Nt,c as Zt,d as gl,e as Ss,a as xs,h as hl,i as ps,T as vl,j as jl,r as Nl,k as bl}from"./thread-sheet-body-DXSUCFvU.js";import{u as yl}from"./useSuspenseInfiniteQuery-DC4aZJSW.js";import{c as wl,S as Sl,b as Rs,a as Ls}from"./sheet-C_qetF7d.js";import{c as _e,b as vt,d as Jt,e as Gt,T as ge,a as Qt}from"./table-DSiO4Kq6.js";import{n as ss,t as ls}from"./ChevronUp-ojSOtVX2.js";import{u as Os,A as Il}from"./automation-runs-uGIsi6Hf.js";import{u as Fs}from"./use-infinite-scroll-CNz9_Nor.js";import{u as Cl}from"./useInfiniteQuery-C9OOM3iT.js";import{g as Tl}from"./task-status-Dk0B9E0G.js";import{u as kl,d as Ml}from"./use-automations-BXbY6ysU.js";import{i as _l}from"./ArrowLeft-DDWHto_R.js";import{E as Is}from"./empty-state-DBHadTD8.js";import{O as $s}from"./watch-sse-pool-9GQSHr-W.js";import{t as Pl}from"./task-key-BCHdFiOO.js";import{a as Dl}from"./format-time-Cq80KKvY.js";import{u as Rl,r as Ll,O as Ol,d as Fl}from"./order-monitor-day-BVSLADXz.js";import{F as $l}from"./feature-gate-D8HHU_kV.js";import"./SearchMd-OCyidoZI.js";import"./access-gate-B-XccyUi.js";import"./capability-load-error-DK8yJwbi.js";import"./Tool01-CnZckhqi.js";import"./collapsible-DGVOZrNj.js";import"./use-copy-D4R9cJ_t.js";import"./usage-stats-BFNP5B9b.js";import"./tool-namespace-CFMdc33T.js";import"./form-CIAWZjuP.js";import"./utils-CVEq3hMx.js";import"./markdown-BU6g98sq.js";import"./location-V0VwTJTt.js";import"./use-mobile-CCkX9zL-.js";import"./use-panel-navigate-CYYYdsdC.js";import"./thread-route-D05ck8nv.js";import"./use-project-scope-C66L_LKx.js";import"./chat-context-4LDKQ9-8.js";import"./autosend-nr-hPbHj.js";import"./thread-intent-DcKV1aEK.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./slugify-CEUa2lfQ.js";import"./use-ai-providers-DB7Q0SBY.js";import"./use-organization-settings-Bf2WDJz9.js";import"./schema-BbiQjr1e.js";import"./task-board-ICmHlMKj.js";import"./use-clock-tick-CmSlUOB2.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-B6MBkXrw.js";import"./types-BnGn2ply.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./AlertCircle-DGVmeswV.js";import"./Image01-Bks737AT.js";import"./XClose-BbuvN9Qp.js";import"./ShoppingBag01-DHyiQNjO.js";import"./shell-layout-Bb-Bk8Da.js";import"./Building02-p3_mZ-E2.js";import"./UserSquare-UeuSXkL4.js";import"./CheckCircle-Bx5iI6Lz.js";import"./Monitor01-B-_Pl3qs.js";import"./command-CPx9UwtG.js";import"./index-MrGr5MGL.js";import"./project-icon-DozUqz8V.js";import"./new-project-dialog-CYkF5k4O.js";import"./repository-import-picker-TlIvK00I.js";import"./use-navigate-to-agent-CEb5-IwU.js";import"./repository-picker-BrjMgENb.js";import"./collection-search-DRo1WmLT.js";import"./use-debounced-value-BdOjhsVi.js";import"./required-auth-layout-CLsGddT6.js";import"./use-org-sso-Bx0Susbk.js";import"./Link01-DCdDhO7H.js";import"./use-mcp-prompts-MhXPkujh.js";import"./use-thread-outputs-Be0M4DCF.js";import"./file-type-icon-Ixvc6_bA.js";import"./index-CRYNJjMc.js";import"./ArrowUp-bm_9Fp5i.js";import"./ChevronSelectorVertical-CtVpNCaH.js";import"./CreditCard01-D0K-VlXU.js";import"./DotsVertical-DzE0Ijkk.js";import"./Globe04-CE15ScrO.js";import"./Minus-DqMKpYLh.js";import"./Sun-BUl5hUgs.js";import"./Upload01-sDXthFWJ.js";import"./User01-2Hx1yZRb.js";import"./Users01-D78JG135.js";import"./editor-CmZJbc4Z.js";import"./use-org-auth-client-xXOFDOL1.js";import"./auth-MbbNpK0f.js";import"./checkbox--QGg9JL6.js";import"./index-BdQq_4o_.js";import"./scroll-area-CCVLtkoB.js";import"./calendar-D8eqk8F_.js";import"./chart-BVOKVwol.js";import"./index-xD4K2nG7.js";import"./symbol-Bw5pneOj.js";import"./CategoricalChart-Dy74bBD9.js";import"./CartesianChart-oH_IqMjj.js";import"./AreaChart-DL7RX4W6.js";import"./tooltipContext-DBLuHkF3.js";import"./BarChart-DmTON82J.js";import"./ActiveShapeUtils-NiXAWNnI.js";import"./Sector-CtNXSnWN.js";import"./ErrorBarContext-DRS3e7xk.js";import"./infiniteQueryObserver-5dM4o4Hf.js";import"./differenceInSeconds-C3x8sHUj.js";import"./useQueries-CjLpsE8j.js";import"./ReferenceLine-C5aqWs1r.js";import"./feature-paywall-CRRIPYfS.js";import"./plan-ladder-C-o1aFSi.js";const rs={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3},zl=["eq","contains","exists","in"];function El(s){return zl.includes(s)}function jt(s){return s.filter(e=>e.key.trim()).map(e=>{const l=encodeURIComponent(e.key.trim()),i=encodeURIComponent(e.value||"");return`${l}:${e.operator}:${i}`}).join(",")}function Al(s){return!s||typeof s!="string"?[]:s.split(",").map(e=>{if(!e)return;const[l,i,...m]=e.split(":"),n=l?decodeURIComponent(l):"";if(n.trim())return{key:n,operator:i&&El(i)?i:"eq",value:decodeURIComponent(m.join(":")||"")}}).filter(e=>e!==void 0)}function Vt(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 Cs(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,...i]=e.split("=");return{key:l||"",operator:"eq",value:i.join("=")}}if(e.includes("~")){const[l,...i]=e.split("~");return{key:l||"",operator:"contains",value:i.join("~")}}if(e.includes("@")){const[l,...i]=e.split("@");return{key:l||"",operator:"in",value:i.join("@")}}return{key:e,operator:"exists",value:""}}):[]}function Kl(s){const e={},l={},i=[],m={};for(const n of s)if(n.key.trim())switch(n.operator){case"eq":n.value&&(e[n.key]=n.value);break;case"contains":n.value&&(l[n.key]=`%${n.value}%`);break;case"exists":i.push(n.key);break;case"in":n.value&&(m[n.key]=n.value);break}return{properties:Object.keys(e).length>0?e:void 0,propertyPatterns:Object.keys(l).length>0?l:void 0,propertyKeys:i.length>0?i:void 0,propertyInValues:Object.keys(m).length>0?m:void 0}}function Ts(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 i=l.length;return i<=rs.maxJsonRenderSize?{content:l,isTruncated:!1,originalSize:i}:{content:l.slice(0,rs.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{n as $,x as D,_ as We,T as H,$ as je,a0 as I,a1 as U,o as W,a2 as G,a3 as J,a4 as me,a5 as qe,a6 as we,a7 as Xe,E as be,a8 as Ye,a9 as Ge,j as ve}from"./usage-stats-CTkcwRGv.js";import{eW as ye,fz as Ce,eV as Se,fA as Re,fB as Ee,fC as Te,fD as Oe,fE as Ae,eY as Ie,d$ as Me,r as C,b3 as ze}from"./index-C_vsZdEs.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 A(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 je(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(I.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(I.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(I.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(!A(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!A(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(!A(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(!A(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!A(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(!A(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=I.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(!A(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(!A(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(!A(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(!A(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(I.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(I.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(I.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(I.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,I.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=We({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(!A(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[I.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 At(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 It=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=It,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:At},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(Ae(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&&Ie(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(Ae(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);Ie({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{n as B,x as D,_ as We,T as H,$ as je,a0 as I,a1 as U,o as W,a2 as G,a3 as J,a4 as me,a5 as qe,a6 as we,a7 as Xe,E as be,a8 as Ye,a9 as Ge,j as ve}from"./usage-stats-BFNP5B9b.js";import{eW as ye,fz as Ce,eV as Se,fA as Re,fB as Ee,fC as Te,fD as Oe,fE as Ae,eY as Ie,e0 as Me,r as C,b3 as ze}from"./index-DJCD1T3p.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 $=(T+O)%t*2,q=l[$];q==null||q!=L&&l[$+1]==1?(l[$]=L,l[$+1]=1):q==L&&l[$+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 B("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 A(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 je(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(I.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(I.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(I.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 B("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(!A(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!A(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(!A(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(!A(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!A(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(!A(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=I.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(!A(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(!A(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(!A(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(!A(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(I.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(I.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(I.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(I.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,I.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=We({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(!A(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[I.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 At(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 It=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 B("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=It,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}Be(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Be(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 Be(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:At},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 Bt(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 $t=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(Ae(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():Bt(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&&Ie(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 $e=e=>new W({key:typeof e.pluginKey=="string"?new B(e.pluginKey):e.pluginKey,view:t=>new $t({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?[$e({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(Ae(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);Ie({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 B(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 B(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=$e({...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};