decocms 4.568.2 → 4.570.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 (394) hide show
  1. package/dist/client/assets/{AlertCircle-C8Ovs13g.js → AlertCircle-1CFQF9HU.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BPZ71FQT.js → AreaChart-CUZD7bCb.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BevitLPy.js → ArrowLeft-yZosAbEQ.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-LKVB7Ud3.js → ArrowUp-B_QEh9AM.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-BKvZsEJJ.js → CartesianChart-DOo-DPo8.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-BAz9vqhr.js → CategoricalChart-KK8jWPWD.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-6PthhUL2.js → CheckCircle-DjUjDOFk.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-DPCJGeHn.js → ChevronSelectorVertical-C2ySHatm.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CpgR3_nb.js → ChevronUp-aVrgoYI4.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-C2oB4pfr.js → CreditCard01-CMrZYrMd.js} +1 -1
  11. package/dist/client/assets/{Globe04-BhKEHcph.js → Globe04-Czvq6voU.js} +1 -1
  12. package/dist/client/assets/{Key01-BSJHIVa1.js → Key01-CJVeUDDi.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-BBFDlqgt.js → LinkBroken01-Dhn_nIp2.js} +1 -1
  14. package/dist/client/assets/{Minus-CVdaI4Fm.js → Minus-qjFidgiH.js} +1 -1
  15. package/dist/client/assets/{Monitor01-Cuob4vSq.js → Monitor01-BwW28bRE.js} +1 -1
  16. package/dist/client/assets/{Play-Da9nWpcs.js → Play-DWKJ4lP6.js} +1 -1
  17. package/dist/client/assets/{Plus-_9GNTGSE.js → Plus-u00IxELx.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-DsOcULXV.js → ReferenceLine-DhlQLhxT.js} +1 -1
  19. package/dist/client/assets/{SearchMd-CW3ppy8-.js → SearchMd-DrxAIngK.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-B5QyiZLr.js → ShoppingBag01-BOpj8wnX.js} +1 -1
  21. package/dist/client/assets/{Sun-BDkIkIw6.js → Sun-CUTKbSf6.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-Mkrao4SC.js → SwitchHorizontal01-DedOEqGg.js} +1 -1
  23. package/dist/client/assets/{Tool01-B3AGNBtQ.js → Tool01-BXFm5jK2.js} +1 -1
  24. package/dist/client/assets/{Tooltip-VyzG-XyD.js → Tooltip-DhVaIgPv.js} +1 -1
  25. package/dist/client/assets/{Trash01-BMv3ZifH.js → Trash01-t2BYg0st.js} +1 -1
  26. package/dist/client/assets/{Upload01-C0aUrRmk.js → Upload01-BBUgsLLD.js} +1 -1
  27. package/dist/client/assets/{UserSquare-Vj3086v1.js → UserSquare-BloCTB27.js} +1 -1
  28. package/dist/client/assets/{Users01-B9jA9cs-.js → Users01-D0A6lP8t.js} +1 -1
  29. package/dist/client/assets/{XClose-BIHWtUjo.js → XClose-CUME_VK2.js} +1 -1
  30. package/dist/client/assets/{Zap-TomaYxmL.js → Zap-CmNmFUbX.js} +1 -1
  31. package/dist/client/assets/{access-gate-Kza0R1uM.js → access-gate-CbFfEOdM.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-P67nq7X-.js → add-connection-dialog-Bk4KRwLm.js} +1 -1
  33. package/dist/client/assets/agent-app-D1s_xxXR.js +1 -0
  34. package/dist/client/assets/{agent-assets-DtbqMuB9.js → agent-assets-CvRDUZu-.js} +1 -1
  35. package/dist/client/assets/{agent-automation-DAvuTlAb.js → agent-automation-CHtwx6sg.js} +1 -1
  36. package/dist/client/assets/{agent-automations-NySBiOWw.js → agent-automations-BgmzkAtz.js} +1 -1
  37. package/dist/client/assets/{agent-calendar-CH42INb4.js → agent-calendar-BQ5xnVXW.js} +1 -1
  38. package/dist/client/assets/{agent-capabilities-W9vBXHXR.js → agent-capabilities-DmNIevq-.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-DhfPL4pD.js → agent-connect-sources-DgRvrlpj.js} +1 -1
  40. package/dist/client/assets/agent-deck-1mK6Ythm.js +1 -0
  41. package/dist/client/assets/{agent-e2e-BU2QcQtT.js → agent-e2e-CowJJC6D.js} +1 -1
  42. package/dist/client/assets/agent-experiments-3ZqH1pHZ.js +1 -0
  43. package/dist/client/assets/{agent-file-3PXh2x7T.js → agent-file-w7JCVN0l.js} +1 -1
  44. package/dist/client/assets/{agent-hosting-DP-fQO-C.js → agent-hosting-p1C0G82t.js} +1 -1
  45. package/dist/client/assets/{agent-icon-CqeITJaa.js → agent-icon-AbOSM7KF.js} +1 -1
  46. package/dist/client/assets/agent-library-Bivz2SRZ.js +1 -0
  47. package/dist/client/assets/agent-library-file-CpGwdPNs.js +1 -0
  48. package/dist/client/assets/agent-overview-CwCkuDX2.js +1 -0
  49. package/dist/client/assets/{agent-releases-BUU1ZC1p.js → agent-releases-BWDO07Iy.js} +2 -2
  50. package/dist/client/assets/agent-settings-DEn_87Gp.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-mLmsToBw.js → agent-site-editor-BubERiUy.js} +1 -1
  52. package/dist/client/assets/agent-site-editor-code-DqKm62jM.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-DmZnej6I.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-DuaKrxk_.js +1 -0
  55. package/dist/client/assets/agent-view-Cey5y0PV.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-CEF0TLXe.js → agent-view-guard-w1_Juyu5.js} +1 -1
  57. package/dist/client/assets/{ai-providers-Bk0b8lBS.js → ai-providers-DAY0nNTK.js} +1 -1
  58. package/dist/client/assets/{alert-DVyXeSP0.js → alert-hJJytfOJ.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-HglAPM52.js → analytics-sections-BNJmu5jh.js} +1 -1
  60. package/dist/client/assets/{api-keys-CPcOhmA3.js → api-keys-DOETgk_S.js} +1 -1
  61. package/dist/client/assets/api-keys-IHsKCg1y.js +1 -0
  62. package/dist/client/assets/{app-editor-BuVYUcC0.js → app-editor-CN-Ok2RW.js} +1 -1
  63. package/dist/client/assets/{asset-utils-B_PFTFoC.js → asset-utils-DhDLN_-h.js} +1 -1
  64. package/dist/client/assets/{auth-DmpUBIs7.js → auth-D1oBKWc9.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-CFzPqvha.js → auth-catchall-CU9OueC2.js} +1 -1
  66. package/dist/client/assets/{auth-entry-wXfEcyl9.js → auth-entry-BrGmprWz.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-BjY-DDgX.js → auth-split-layout-DdjSjW7w.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-DaaDxUin.js → authenticate-and-persist-oauth-DfXhL6KV.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-DXb5up2E.js → automation-list-row-D2RgfFAV.js} +1 -1
  70. package/dist/client/assets/{automation-runs-BAUKeHIB.js → automation-runs-_P-ch70z.js} +1 -1
  71. package/dist/client/assets/{automations-BvaZrGnV.js → automations-DVc_UfEJ.js} +1 -1
  72. package/dist/client/assets/{autosend-BVZJx1Ct.js → autosend-xPyRMwmc.js} +1 -1
  73. package/dist/client/assets/{badge-DzMp3mdM.js → badge-BLopTdJo.js} +1 -1
  74. package/dist/client/assets/{block-document-bjE6-3hu.js → block-document-DRcrQBeX.js} +1 -1
  75. package/dist/client/assets/{blocks-preview-workspace-context-BL9PsmSD.js → blocks-preview-workspace-context-D9X9QQD5.js} +1 -1
  76. package/dist/client/assets/{blocks-tab-states-ifXBK4F2.js → blocks-tab-states-DOYuC7hO.js} +1 -1
  77. package/dist/client/assets/{blog-schema-rddaOm3X.js → blog-schema-njjjFtQI.js} +1 -1
  78. package/dist/client/assets/{buckets-BzOMugSD.js → buckets-DHR--iFw.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-BYoR7ku5.js → build-improve-prompt-doc-DrCjUiSm.js} +1 -1
  80. package/dist/client/assets/{calendar-BJC2oYOH.js → calendar-8e1bW3QX.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-N3peg2W6.js → capability-load-error-C9mmbd-g.js} +1 -1
  82. package/dist/client/assets/{category-editor-11ETFMeQ.js → category-editor-ngsbNhPd.js} +1 -1
  83. package/dist/client/assets/{chart-BaW3HlzU.js → chart-PfmlhR6m.js} +1 -1
  84. package/dist/client/assets/{chat-context-Bc7GhR8U.js → chat-context-BFpdF0Ea.js} +6 -6
  85. package/dist/client/assets/{chat-draft-CnT-R9KP.js → chat-draft-B0ZUpMX_.js} +1 -1
  86. package/dist/client/assets/{checkbox-Djgrt1vS.js → checkbox-DDDKCgb5.js} +1 -1
  87. package/dist/client/assets/{choose-editor-BY15-a1C.js → choose-editor-XtwrmhD8.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-Wkek8Nxt.js → cli-auth-success-BnJsDVo5.js} +1 -1
  89. package/dist/client/assets/{client-icons-DUqNvNJS.js → client-icons-Cw3Ivutw.js} +1 -1
  90. package/dist/client/assets/{cms-settings-editor-CMQtdcSG.js → cms-settings-editor-DY67ejEv.js} +1 -1
  91. package/dist/client/assets/{cms-store-drafts-BakCAk7K.js → cms-store-drafts-CYIZoD9d.js} +1 -1
  92. package/dist/client/assets/{collapsible-Cu2ykx45.js → collapsible-C4GX1H_R.js} +1 -1
  93. package/dist/client/assets/{collection-detail-CnJWnmsp.js → collection-detail-8Mxw24IU.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-NSxOZ5TH.js → collection-display-button-WZ9U6Dnn.js} +1 -1
  95. package/dist/client/assets/{collection-search-ClV5mqoe.js → collection-search-Dz7QHmOz.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-Dh8uL3pb.js → collection-table-wrapper-06TDQKrw.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-T0QGfCDZ.js → collection-tabs-C-fKyh8w.js} +1 -1
  98. package/dist/client/assets/{combobox-Cx-C-l4z.js → combobox-DqPSOi3v.js} +1 -1
  99. package/dist/client/assets/{command-DgSBNjBh.js → command-CYK5M8XI.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-zXENoXl8.js → companion-mcps-section-CAKFIeG-.js} +1 -1
  101. package/dist/client/assets/{config-1zqgWIk2.js → config-DBXuSQO1.js} +1 -1
  102. package/dist/client/assets/{connect-DrCZmYlD.js → connect-NGxtU5_0.js} +1 -1
  103. package/dist/client/assets/{connect-layout-DQ4O9ewt.js → connect-layout-DBzvmer6.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-BFfL8MZO.js → connect-source-dialog-BnXxvvcJ.js} +1 -1
  105. package/dist/client/assets/{connection-DHqLhyYm.js → connection-_PcrLws7.js} +1 -1
  106. package/dist/client/assets/{connection-card-yh4MTPg_.js → connection-card-4gZcunZq.js} +1 -1
  107. package/dist/client/assets/{connection-detail-CLMyx8eY.js → connection-detail-C0eX0pfz.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-Bp0P0TC9.js → connection-form-helpers-C7Gv9-lg.js} +1 -1
  109. package/dist/client/assets/{connection-slug-nir9u1BL.js → connection-slug-BsU2LQiu.js} +1 -1
  110. package/dist/client/assets/{connections-DvAElJBj.js → connections-BA8V7XrH.js} +1 -1
  111. package/dist/client/assets/{content-tab-ClOEdPwZ.js → content-tab-C_nIeaie.js} +3 -3
  112. package/dist/client/assets/{context-Duc_mQnE.js → context-8d_KiSNS.js} +1 -1
  113. package/dist/client/assets/{context-menu-Cxk9gBC0.js → context-menu-o6rJLNXJ.js} +1 -1
  114. package/dist/client/assets/{context-shell-DUWqXQZN.js → context-shell-C1Ha8IE2.js} +3 -3
  115. package/dist/client/assets/{core.esm-DAx4DJuz.js → core.esm-BGRTXfSt.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-BjqA3lpc.js → create-organization-dialog-h3rzGSt9.js} +1 -1
  117. package/dist/client/assets/{device-hint-DPZT-Xea.js → device-hint-BOo4jdep.js} +1 -1
  118. package/dist/client/assets/{discover-BY4Mr8uM.js → discover-BeGAehHo.js} +1 -1
  119. package/dist/client/assets/{domain-settings-CbT821rp.js → domain-settings-Nhk3Nbp-.js} +1 -1
  120. package/dist/client/assets/{drawer-BFx-bd_L.js → drawer-C1zPem_-.js} +1 -1
  121. package/dist/client/assets/{editor-C09OhWY7.js → editor-BcXADR5b.js} +1 -1
  122. package/dist/client/assets/{editor-classes-CBvy4Zr6.js → editor-classes-BftbquCD.js} +1 -1
  123. package/dist/client/assets/{empty-state-UqiTRa_b.js → empty-state-BrKCVCOA.js} +1 -1
  124. package/dist/client/assets/{empty-state-DUTglEtg.js → empty-state-tlDzCEBe.js} +1 -1
  125. package/dist/client/assets/{experiments-tab-choice-DVTcfAT7.js → experiments-tab-choice-Dnv5W_mO.js} +1 -1
  126. package/dist/client/assets/{extract-connection-data-Dc6vmoBL.js → extract-connection-data-B4CAQLEm.js} +1 -1
  127. package/dist/client/assets/{feature-gate-DIvD2qXm.js → feature-gate-DWILcK73.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-Ds90JgjK.js → feature-paywall-BOdJ7pc_.js} +1 -1
  129. package/dist/client/assets/{feedback-JjHaNOsE.js → feedback--BP5XsMC.js} +1 -1
  130. package/dist/client/assets/{file-explorer-CluRXZ37.js → file-explorer-BHgkTafl.js} +1 -1
  131. package/dist/client/assets/{file-preview-D8Si3yqg.js → file-preview-B3c1V4-B.js} +1 -1
  132. package/dist/client/assets/{file-share-button-BMnJAgQ5.js → file-share-button-BmfBQCy7.js} +1 -1
  133. package/dist/client/assets/{file-type-icon-CNSXAyFe.js → file-type-icon-C-QM854F.js} +1 -1
  134. package/dist/client/assets/{folder-icon-C89oXJaH.js → folder-icon-evgkGdeR.js} +1 -1
  135. package/dist/client/assets/{form-DpIMBI8y.js → form-D2GmFQW3.js} +1 -1
  136. package/dist/client/assets/{general-DHFARAaC.js → general-B3MQGRB4.js} +1 -1
  137. package/dist/client/assets/{github-icon-DewiI3zK.js → github-icon-i7iUozqR.js} +1 -1
  138. package/dist/client/assets/{home-DUBEI8qS.js → home-ZCo0svlJ.js} +1 -1
  139. package/dist/client/assets/{home-overview-BoEkJpNz.js → home-overview-qYf3hL7N.js} +1 -1
  140. package/dist/client/assets/{hosted-reconcile-97iAdZVR.js → hosted-reconcile-CvdR91uj.js} +1 -1
  141. package/dist/client/assets/{icon-button-BfxFpZIz.js → icon-button-BUwzNv83.js} +1 -1
  142. package/dist/client/assets/{index-D3yQzMmD.js → index-BfxdS8h-.js} +1 -1
  143. package/dist/client/assets/{index-YAbWBpI2.js → index-BpRy7AHp.js} +32 -32
  144. package/dist/client/assets/{index-BqI8ssrO.js → index-CCTNTj2P.js} +1 -1
  145. package/dist/client/assets/index-CKEKSTrk.css +1 -0
  146. package/dist/client/assets/{index-7uos3LCQ.js → index-CKnb1ufF.js} +1 -1
  147. package/dist/client/assets/{index-B64fyQ1o.js → index-C_UqErbC.js} +1 -1
  148. package/dist/client/assets/{index-_xfuQegh.js → index-ChAPkvx3.js} +1 -1
  149. package/dist/client/assets/{index-ooZoGt7g.js → index-DPD9OENi.js} +1 -1
  150. package/dist/client/assets/{index-DYz5vKDK.js → index-DQBul4yU.js} +1 -1
  151. package/dist/client/assets/{index-BA4wFQV0.js → index-D_UeTS1-.js} +1 -1
  152. package/dist/client/assets/{index-cBEKd_zd.js → index-Dn1UQvhJ.js} +1 -1
  153. package/dist/client/assets/{index-CYEUdIaI.js → index-OBb8rfAw.js} +1 -1
  154. package/dist/client/assets/{index-DnPa3j4q.js → index-cKSjr8CK.js} +1 -1
  155. package/dist/client/assets/index-clkmgwR3.js +1 -0
  156. package/dist/client/assets/{index-BIHeqmlu.js → index-lbygo01z.js} +1 -1
  157. package/dist/client/assets/{index-redirect-o6Cxf_-C.js → index-redirect-D-YiN8Xo.js} +1 -1
  158. package/dist/client/assets/{index-sUdqwSqQ.js → index-ukVGoFpO.js} +1 -1
  159. package/dist/client/assets/{index-Bv7_FvT_.js → index-xj3IgJTF.js} +1 -1
  160. package/dist/client/assets/{infiniteQueryObserver-BetHfx9E.js → infiniteQueryObserver-D03R0ede.js} +1 -1
  161. package/dist/client/assets/{infra-billing-C4-Upy26.js → infra-billing-s8EIFgUr.js} +1 -1
  162. package/dist/client/assets/{input-DD9yaa2N.js → input-Cnq9i2l1.js} +1 -1
  163. package/dist/client/assets/{input-BwL2yzTb.js → input-DfTSMalp.js} +3 -3
  164. package/dist/client/assets/{integration-icon-BJPq2ynB.js → integration-icon-FxF8FEU6.js} +1 -1
  165. package/dist/client/assets/{jira-icon-BJ1Yqfz3.js → jira-icon-BLg3npMf.js} +1 -1
  166. package/dist/client/assets/{label-ERMWTDM1.js → label-Bh2Pit2O.js} +1 -1
  167. package/dist/client/assets/{layout-Clyb314Q.js → layout-C60ZlULv.js} +1 -1
  168. package/dist/client/assets/{legacy-agents-deep-DXqg162W.js → legacy-agents-deep-DwelfdPA.js} +1 -1
  169. package/dist/client/assets/{legacy-main-redirect-DnsMd1-f.js → legacy-main-redirect-C_4oCw1E.js} +1 -1
  170. package/dist/client/assets/library-B-jS61L0.js +1 -0
  171. package/dist/client/assets/{library-tab-B4AZKZNW.js → library-tab-BaUP3ZVF.js} +1 -1
  172. package/dist/client/assets/{login-DoyIZZDV.js → login-bcoCcqBW.js} +1 -1
  173. package/dist/client/assets/{markdown-XW6Y_EoI.js → markdown-j0gDnxTp.js} +1 -1
  174. package/dist/client/assets/{mcp-app-renderer-DL7gNCl6.js → mcp-app-renderer-C3zml1pp.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-rHESfw1u.js → mcp-oauth-D4Pxc73w.js} +1 -1
  176. package/dist/client/assets/{mcp-oauth-PRMkVXh1.js → mcp-oauth-I0kjN__K.js} +1 -1
  177. package/dist/client/assets/{members-DBffdKOk.js → members-Dxz1ewpb.js} +1 -1
  178. package/dist/client/assets/{memory-DTe7ai10.js → memory-C_AcXDod.js} +1 -1
  179. package/dist/client/assets/{mock-board-Dcrv6S29.js → mock-board-COgbDYxA.js} +3 -3
  180. package/dist/client/assets/{monaco-editor-Bomp4HmR.js → monaco-editor-DtIoXdMD.js} +1 -1
  181. package/dist/client/assets/{monitoring-CKTJkohg.js → monitoring-DWb86ZoC.js} +1 -1
  182. package/dist/client/assets/{monitoring-stats-row-BVMN-DLg.js → monitoring-stats-row-BSstVGMX.js} +1 -1
  183. package/dist/client/assets/{multi-select-D9N-nXLY.js → multi-select-DailkN9Q.js} +1 -1
  184. package/dist/client/assets/{mustache-eb_Bg87y.js → mustache-BSD6v2ig.js} +1 -1
  185. package/dist/client/assets/{named-rule-view-zp9L0ztj.js → named-rule-view-B_8gTqcI.js} +1 -1
  186. package/dist/client/assets/{new-project-dialog-CxL0mjQ3.js → new-project-dialog-wz5dJWkC.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-BXFUoube.js → oauth-callback-B7Nohzxd.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-C-SfsQUr.js → oauth-callback-ai-provider-BmsntsZe.js} +1 -1
  189. package/dist/client/assets/{oauth-consent-hR2Ry0UE.js → oauth-consent-cf55Bmz-.js} +1 -1
  190. package/dist/client/assets/{onboarding-IOMBN2u3.js → onboarding-Cdi9idPQ.js} +1 -1
  191. package/dist/client/assets/{openai-conversation-U4xBjBfE.js → openai-conversation-BMpQOydo.js} +1 -1
  192. package/dist/client/assets/{optimistic-project-sidebar-views-DlG0FgvT.js → optimistic-project-sidebar-views-AOXvjkSa.js} +1 -1
  193. package/dist/client/assets/{order-monitor-day-DHO_k1R7.js → order-monitor-day-Bk2YpEn9.js} +1 -1
  194. package/dist/client/assets/{organization-choice-SsLKJxTz.js → organization-choice-CcyZ2sED.js} +1 -1
  195. package/dist/client/assets/{orgs-CN24uHaU.js → orgs-C6-Q2iMm.js} +1 -1
  196. package/dist/client/assets/{own-accounts-section-DiMchtro.js → own-accounts-section-BEuNQYr7.js} +1 -1
  197. package/dist/client/assets/{pair-BzX9EpMl.js → pair-D0R2UDgp.js} +1 -1
  198. package/dist/client/assets/{parse-sections-UGlsQq9_.js → parse-sections-DTDSECqx.js} +3 -3
  199. package/dist/client/assets/{plan-CwrMkHhz.js → plan-D5_Bt3KJ.js} +1 -1
  200. package/dist/client/assets/{plan-ladder-BmHzS4XX.js → plan-ladder-BWKx4tc-.js} +1 -1
  201. package/dist/client/assets/{plan-usage-card-BPrhaw5t.js → plan-usage-card-Z5a-2qYK.js} +1 -1
  202. package/dist/client/assets/{popover-eKoh4-Z1.js → popover-BrVMYzI-.js} +1 -1
  203. package/dist/client/assets/{post-calendar-5-RTMM86.js → post-calendar-BpEmJgqQ.js} +1 -1
  204. package/dist/client/assets/{post-editor-bG2s_3vv.js → post-editor-yNAWU29F.js} +1 -1
  205. package/dist/client/assets/{preview-content-B0_lha9p.js → preview-content-CWagFWI_.js} +1 -1
  206. package/dist/client/assets/{preview-dialog-Ci3FAVDm.js → preview-dialog-Bc1z8QHZ.js} +1 -1
  207. package/dist/client/assets/{preview-panel-BuqHC95v.js → preview-panel-bcbhyFq_.js} +1 -1
  208. package/dist/client/assets/{preview-tab-ChwoL7Do.js → preview-tab-nbSkAxxa.js} +3 -3
  209. package/dist/client/assets/{product-picker-dialog-DkygTQUe.js → product-picker-dialog-CNr_kHqK.js} +1 -1
  210. package/dist/client/assets/{profile-GstFURmM.js → profile-DtHrUsir.js} +1 -1
  211. package/dist/client/assets/{project-app-view-BML0V8pu.js → project-app-view-BfN3k7ju.js} +1 -1
  212. package/dist/client/assets/{project-apps-BFVy6oqU.js → project-apps-C_vCRb8O.js} +1 -1
  213. package/dist/client/assets/{project-icon-DRALSoCE.js → project-icon-n7LBJrfx.js} +1 -1
  214. package/dist/client/assets/{project-index-0ZlMTyxM.js → project-index-2cTAo4fH.js} +1 -1
  215. package/dist/client/assets/project-reports-C1Hkwfya.js +1 -0
  216. package/dist/client/assets/{project-sidebar-views-IsAuRqFR.js → project-sidebar-views-DhZy-bnC.js} +1 -1
  217. package/dist/client/assets/project-tasks-B8hDD-I8.js +1 -0
  218. package/dist/client/assets/{projects-Cwfayn5A.js → projects-OSECm-FW.js} +1 -1
  219. package/dist/client/assets/{projects-empty-state-BLo1oUuy.js → projects-empty-state-B7zdGKEZ.js} +1 -1
  220. package/dist/client/assets/{prompts-geIlmCw0.js → prompts-J4HaC_ei.js} +1 -1
  221. package/dist/client/assets/record-editor-B3zURv0C.js +1 -0
  222. package/dist/client/assets/{redirect-editor-CZ8Jt6Rk.js → redirect-editor-DeoRyu0l.js} +1 -1
  223. package/dist/client/assets/reports-CofWqBLU.js +1 -0
  224. package/dist/client/assets/{reports-SAO6FB-Y.js → reports-CpGpr_ZH.js} +1 -1
  225. package/dist/client/assets/{reports-onboarding-8dWVmpHn.js → reports-onboarding-CJMXOfw7.js} +1 -1
  226. package/dist/client/assets/{reports-tab-ICX3CL8K.js → reports-tab-LNIEzMQ4.js} +2 -2
  227. package/dist/client/assets/{repositories-CEe5dTCI.js → repositories-CCBdk88v.js} +1 -1
  228. package/dist/client/assets/repositories-yBP4WuG_.js +1 -0
  229. package/dist/client/assets/{repository-binding-BEFtyvwg.js → repository-binding-DdmRVWpz.js} +1 -1
  230. package/dist/client/assets/{repository-picker-dYbX0JPX.js → repository-picker-ClelLyeu.js} +1 -1
  231. package/dist/client/assets/{require-capability-C_BedkF8.js → require-capability-BCUql2uo.js} +1 -1
  232. package/dist/client/assets/{required-auth-layout-B2yDP8xU.js → required-auth-layout-Lh-Wt6uK.js} +1 -1
  233. package/dist/client/assets/{reset-password-HMJAQkaR.js → reset-password-Cq-nDwrY.js} +1 -1
  234. package/dist/client/assets/{resizable-CXcYWQyr.js → resizable-D8U4YOro.js} +1 -1
  235. package/dist/client/assets/{resolve-tab-icon-CSavMQhX.js → resolve-tab-icon-CukmKoWA.js} +1 -1
  236. package/dist/client/assets/{review-settings-HR5AJuT5.js → review-settings-BzmxgDqt.js} +1 -1
  237. package/dist/client/assets/{role-color-XqQUBPY2.js → role-color-C-Q62gr6.js} +1 -1
  238. package/dist/client/assets/{roles-WFtvt_td.js → roles-b8ba7BB1.js} +1 -1
  239. package/dist/client/assets/route-BK2wi4kD.js +1 -0
  240. package/dist/client/assets/{route-BeJKDC7d.js → route-CXbtT4mj.js} +1 -1
  241. package/dist/client/assets/{route-CUPbBKJB.js → route-Dq87eMEg.js} +1 -1
  242. package/dist/client/assets/{sandbox-lifecycle-context-CFqytSKR.js → sandbox-lifecycle-context-o_ip6_5z.js} +1 -1
  243. package/dist/client/assets/{schema-CU--MvCG.js → schema-ByYst2Pb.js} +1 -1
  244. package/dist/client/assets/{schema-s_8X_Pq7.js → schema-CDmusrrq.js} +1 -1
  245. package/dist/client/assets/{scroll-area-V--N6BXn.js → scroll-area-Ch8iXNIM.js} +1 -1
  246. package/dist/client/assets/{search-input-BQcAdCac.js → search-input-CqM9MiZ3.js} +1 -1
  247. package/dist/client/assets/{search-toggle-BQnVnCJm.js → search-toggle-VKaSo9uW.js} +1 -1
  248. package/dist/client/assets/{secret-picker-kAED7ZfH.js → secret-picker-DPC7oeFy.js} +1 -1
  249. package/dist/client/assets/{secrets-CI8FkMIy.js → secrets-2ntDkWXH.js} +1 -1
  250. package/dist/client/assets/{section-array-field-D45EV3Ua.js → section-array-field-ziyJ9KKG.js} +1 -1
  251. package/dist/client/assets/{sections-ChpddIHY.js → sections-B2FraWlK.js} +1 -1
  252. package/dist/client/assets/{sections-editor-DGs8wpRP.js → sections-editor-D6NJi3oc.js} +1 -1
  253. package/dist/client/assets/{select-BkMg57qf.js → select-BqAgCf_e.js} +1 -1
  254. package/dist/client/assets/{select-model-Dxh581PI.js → select-model-CgHPgPvz.js} +1 -1
  255. package/dist/client/assets/{seo-editor-46VthC2w.js → seo-editor-Bc6Ncl3H.js} +1 -1
  256. package/dist/client/assets/{separator-XP0nOrIu.js → separator-B2LjZA6j.js} +1 -1
  257. package/dist/client/assets/settings-tab-DzS7_7oR.js +1 -0
  258. package/dist/client/assets/{sheet-B4T7-RMg.js → sheet-y4usetIj.js} +1 -1
  259. package/dist/client/assets/shell-layout-BHLD5jhn.js +1 -0
  260. package/dist/client/assets/{site-draft-actions-QFmuYxUg.js → site-draft-actions-gfTBLW-u.js} +1 -1
  261. package/dist/client/assets/{site-draft-view-ffleha4j.js → site-draft-view-B7polEM8.js} +1 -1
  262. package/dist/client/assets/site-editor-Cp5Zuvwt.js +1 -0
  263. package/dist/client/assets/{site-editor-toast-B1S7n1Id.js → site-editor-toast-DaSHvCWu.js} +1 -1
  264. package/dist/client/assets/{skills-BIRzMqs8.js → skills-BemYRmGR.js} +1 -1
  265. package/dist/client/assets/{slider-B7-Cm7k7.js → slider-CUVU1H_x.js} +1 -1
  266. package/dist/client/assets/{sortable.esm-CW_p4INX.js → sortable.esm-Sw9w3P90.js} +1 -1
  267. package/dist/client/assets/{sso-BsU2HJVe.js → sso-C3qLFTZi.js} +1 -1
  268. package/dist/client/assets/{suggestion-DbrJ_AD8.js → suggestion-BiaV3mvJ.js} +1 -1
  269. package/dist/client/assets/{switch-B_lDpEA0.js → switch-DKx4qpl7.js} +1 -1
  270. package/dist/client/assets/{synced-repos-DCv_vlRR.js → synced-repos-edmrMUSZ.js} +1 -1
  271. package/dist/client/assets/{tab-icon-glyph-6tkQpk4Q.js → tab-icon-glyph-C8csunxY.js} +1 -1
  272. package/dist/client/assets/{table-C6s_VKOi.js → table-Dq5I6aY7.js} +1 -1
  273. package/dist/client/assets/{tabs-DlRJfLwT.js → tabs-0SGJ_qve.js} +1 -1
  274. package/dist/client/assets/{task-board-DUco_y7A.js → task-board-CWLsdAvC.js} +1 -1
  275. package/dist/client/assets/{task-route-CRs-eXmU.js → task-route-Cay3KQ6a.js} +1 -1
  276. package/dist/client/assets/{task-status-BOHpGrk3.js → task-status-D-bn6Q3b.js} +1 -1
  277. package/dist/client/assets/{taskboard-analytics-fFVrXogo.js → taskboard-analytics-L-F5O9dg.js} +1 -1
  278. package/dist/client/assets/{tasks-SWTgaFVa.js → tasks-DIxE8tYD.js} +1 -1
  279. package/dist/client/assets/tasks-Drp2qtBI.js +1 -0
  280. package/dist/client/assets/{textarea-OklqAHMd.js → textarea-C8pP4RDC.js} +1 -1
  281. package/dist/client/assets/thread-analytics-01LkdxOy.js +1 -0
  282. package/dist/client/assets/{thread-intent-C1wXk8R2.js → thread-intent-D7FGI3D0.js} +1 -1
  283. package/dist/client/assets/{thread-route-LSwEDNk3.js → thread-route-CKRKYHUZ.js} +1 -1
  284. package/dist/client/assets/{thread-route-DicZMCve.js → thread-route-E0bMcc27.js} +1 -1
  285. package/dist/client/assets/{thread-sheet-body-CEMon8kR.js → thread-sheet-body-DkwRzpXX.js} +1 -1
  286. package/dist/client/assets/{time-range-picker-C6ZqhnIM.js → time-range-picker-DNs3LiZc.js} +1 -1
  287. package/dist/client/assets/{toggle-group-5MHxVWOz.js → toggle-group-DkZuJxmr.js} +1 -1
  288. package/dist/client/assets/{tool-namespace-Ceqr3QyQ.js → tool-namespace-CCkkm2qA.js} +1 -1
  289. package/dist/client/assets/{tool-set-selector-DLUu043H.js → tool-set-selector-5zt8G69C.js} +1 -1
  290. package/dist/client/assets/{toolbar-icon-button-DEBmHG_e.js → toolbar-icon-button-Cx0kc5lZ.js} +1 -1
  291. package/dist/client/assets/{tooltip-DAuc-B32.js → tooltip-jhiffORJ.js} +1 -1
  292. package/dist/client/assets/{tooltipContext-1vhchD6-.js → tooltipContext-BYQJi6EG.js} +1 -1
  293. package/dist/client/assets/{track-YH0kfWd_.js → track-8QL-WYe-.js} +1 -1
  294. package/dist/client/assets/{types-DyZTbbkk.js → types-CR7kvQl1.js} +1 -1
  295. package/dist/client/assets/{url-slug-DIlgbobQ.js → url-slug-BxiYZtUy.js} +1 -1
  296. package/dist/client/assets/{usage-stats-BebN-2hd.js → usage-stats-DB51uKij.js} +1 -1
  297. package/dist/client/assets/{use-ai-providers-DcAVgXsj.js → use-ai-providers-sfkouqgF.js} +1 -1
  298. package/dist/client/assets/{use-apply-named-rule-B_Z446Ry.js → use-apply-named-rule-DA98Iihd.js} +1 -1
  299. package/dist/client/assets/use-ask-in-chat-tQsBmTsy.js +1 -0
  300. package/dist/client/assets/{use-automations-nJoSSUFU.js → use-automations-DD-H-0gg.js} +1 -1
  301. package/dist/client/assets/{use-autosave-D5M1H1ld.js → use-autosave-Bw7KaLnG.js} +1 -1
  302. package/dist/client/assets/use-blocks-v8-project-DzHuTeMz.js +1 -0
  303. package/dist/client/assets/{use-chat-layout-state-DlqdI6ik.js → use-chat-layout-state-BbG5C9on.js} +1 -1
  304. package/dist/client/assets/{use-cms-publish-actions-sdbq0KPV.js → use-cms-publish-actions-1o6NX1uP.js} +5 -5
  305. package/dist/client/assets/{use-connect-companion-DXp8DxZm.js → use-connect-companion-LWK1AWBF.js} +1 -1
  306. package/dist/client/assets/use-connection-CgY1E7FR.js +1 -0
  307. package/dist/client/assets/{use-content-sync-TbLiRz5C.js → use-content-sync-9QsuTp3C.js} +1 -1
  308. package/dist/client/assets/{use-copy-D33RiL7q.js → use-copy-DRW_V1kW.js} +1 -1
  309. package/dist/client/assets/{use-date-fns-locale-BRlda5oW.js → use-date-fns-locale-Cw3Zaqb5.js} +1 -1
  310. package/dist/client/assets/{use-debounced-autosave-DE6eSc27.js → use-debounced-autosave-CgAvArNN.js} +1 -1
  311. package/dist/client/assets/{use-debounced-value-CzIv9NaE.js → use-debounced-value-B0a3uxKQ.js} +1 -1
  312. package/dist/client/assets/{use-deco-credits-BaQvGBEw.js → use-deco-credits-BVH6IrV5.js} +1 -1
  313. package/dist/client/assets/{use-decopilot-events-DjIuYjOP.js → use-decopilot-events-BYlxYXUQ.js} +1 -1
  314. package/dist/client/assets/{use-delete-connection-aPrSXyAj.js → use-delete-connection-CvuMwKsA.js} +1 -1
  315. package/dist/client/assets/{use-deployment-admin-CUut_j3Q.js → use-deployment-admin-Bw3ciRk9.js} +1 -1
  316. package/dist/client/assets/{use-entitlements-D3oGZGk4.js → use-entitlements-CMCBZq5_.js} +1 -1
  317. package/dist/client/assets/{use-fast-preview-draft-url-axvbwLaV.js → use-fast-preview-draft-url-BUD5f_Gm.js} +1 -1
  318. package/dist/client/assets/{use-file-configs-5QRblAyS.js → use-file-configs-2Z7OwHbg.js} +1 -1
  319. package/dist/client/assets/{use-id-selection-BvQC2CH0.js → use-id-selection--cuaALt7.js} +1 -1
  320. package/dist/client/assets/{use-inbox-feed-B_E5DqhG.js → use-inbox-feed-DxzsD1YQ.js} +1 -1
  321. package/dist/client/assets/{use-infinite-scroll-DUyqnU8Z.js → use-infinite-scroll-BKVwA-Ob.js} +1 -1
  322. package/dist/client/assets/{use-join-requests-Dz7yS88x.js → use-join-requests-BZlGoiU5.js} +1 -1
  323. package/dist/client/assets/{use-main-panel-tabs-ChV3O5om.js → use-main-panel-tabs-4JSMbOrH.js} +1 -1
  324. package/dist/client/assets/{use-mcp-auth-status-BwIqp-AR.js → use-mcp-auth-status-CYCjckUQ.js} +1 -1
  325. package/dist/client/assets/{use-mcp-client-Ce3gHVGN.js → use-mcp-client-CjLtJgTU.js} +1 -1
  326. package/dist/client/assets/{use-mcp-prompts-Dq9WwEe3.js → use-mcp-prompts-JVEMCdnt.js} +1 -1
  327. package/dist/client/assets/{use-mcp-tools-DuEgTWI8.js → use-mcp-tools-C5jhMv1O.js} +1 -1
  328. package/dist/client/assets/{use-mobile-CW1BshYp.js → use-mobile-CKr6zvd6.js} +1 -1
  329. package/dist/client/assets/{use-move-blocks-B6bkFBMu.js → use-move-blocks-B-6qZYKa.js} +1 -1
  330. package/dist/client/assets/{use-navigate-to-agent-DEmRYJP2.js → use-navigate-to-agent-BJsKVGd6.js} +1 -1
  331. package/dist/client/assets/{use-org-fs-Dj3nhg6p.js → use-org-fs-DDhNsbr6.js} +1 -1
  332. package/dist/client/assets/{use-org-repo-syncs-BssG7LDG.js → use-org-repo-syncs-DBx3nqV9.js} +1 -1
  333. package/dist/client/assets/{use-org-sso-CPPSm2_k.js → use-org-sso-DyxTDJHi.js} +1 -1
  334. package/dist/client/assets/{use-organization-settings-Bxmr_gqX.js → use-organization-settings-Cs5X07HH.js} +1 -1
  335. package/dist/client/assets/{use-project-scope-Cp4z8A1-.js → use-project-scope-DK5Zq3Vj.js} +1 -1
  336. package/dist/client/assets/{use-recent-apps-BZ6rxv5O.js → use-recent-apps-BrqeKXhi.js} +1 -1
  337. package/dist/client/assets/{use-reports-diagnostic-C7WA1MXv.js → use-reports-diagnostic-D0MF0Enh.js} +1 -1
  338. package/dist/client/assets/{use-sandbox-events-D_ekj7qC.js → use-sandbox-events-DKvN2vib.js} +1 -1
  339. package/dist/client/assets/{use-secrets-CaIOigN4.js → use-secrets-q3tQjsVS.js} +1 -1
  340. package/dist/client/assets/{use-section-preview-base-C1Vehe6q.js → use-section-preview-base-DI0VnMUg.js} +1 -1
  341. package/dist/client/assets/{use-sidebar-collapsed-BzixWcm4.js → use-sidebar-collapsed-NHFQSjyB.js} +1 -1
  342. package/dist/client/assets/{use-tags-CKT9rJaQ.js → use-tags-7ZRefyR6.js} +1 -1
  343. package/dist/client/assets/{use-task-board-analytics-GfBHZgc-.js → use-task-board-analytics-CFKUFKZO.js} +1 -1
  344. package/dist/client/assets/{use-task-board-events-B65L1qbJ.js → use-task-board-events-D1ietf1D.js} +1 -1
  345. package/dist/client/assets/{use-task-board-item-prs-BVht1yZk.js → use-task-board-item-prs-hyB7mT0I.js} +1 -1
  346. package/dist/client/assets/{use-task-board-items-D_dsOzO4.js → use-task-board-items-C5M-iJHh.js} +1 -1
  347. package/dist/client/assets/{use-task-board-prompts-CNi_885P.js → use-task-board-prompts-Bj8qQJuo.js} +1 -1
  348. package/dist/client/assets/{use-task-metadata-CVbCX8pH.js → use-task-metadata-D_W5nMRB.js} +1 -1
  349. package/dist/client/assets/{use-thread-outputs-BgwiVnbA.js → use-thread-outputs-CIMyOC9i.js} +1 -1
  350. package/dist/client/assets/{use-voice-input-qp904jOd.js → use-voice-input-D0UxQK8p.js} +1 -1
  351. package/dist/client/assets/useInfiniteQuery-4mlqNbEX.js +1 -0
  352. package/dist/client/assets/{useQueries-_uQRl1Uh.js → useQueries-D-paqk_N.js} +1 -1
  353. package/dist/client/assets/useSuspenseInfiniteQuery-6pYaPTkl.js +1 -0
  354. package/dist/client/assets/{users-D-5oJ2Ks.js → users-CgyVEAVi.js} +1 -1
  355. package/dist/client/assets/{utils-CWqleJYQ.js → utils-CML3oMCb.js} +1 -1
  356. package/dist/client/assets/{variant-calendar-WDduM77l.js → variant-calendar-CiRidZhE.js} +1 -1
  357. package/dist/client/assets/{variant-matcher-override-Bb9J_WJV.js → variant-matcher-override-DptryLC2.js} +1 -1
  358. package/dist/client/assets/{view-header-BdEbmY1e.js → view-header-C5UPfmG7.js} +1 -1
  359. package/dist/client/assets/{virtual-mcp-B5SyuXEj.js → virtual-mcp-BVgnJh3F.js} +1 -1
  360. package/dist/client/assets/{watch-sse-pool-BQPiLe0y.js → watch-sse-pool-DiT4THMV.js} +1 -1
  361. package/dist/client/index.html +2 -2
  362. package/dist/server/server.js +765 -714
  363. package/package.json +1 -1
  364. package/dist/client/assets/agent-app-Da9CCDUf.js +0 -1
  365. package/dist/client/assets/agent-deck-BAqsiSU8.js +0 -1
  366. package/dist/client/assets/agent-experiments-D_FXRK8m.js +0 -1
  367. package/dist/client/assets/agent-library-file-CClO1HJb.js +0 -1
  368. package/dist/client/assets/agent-library-jdBUMrX4.js +0 -1
  369. package/dist/client/assets/agent-overview-CozHgqWw.js +0 -1
  370. package/dist/client/assets/agent-settings-DFWwpeNN.js +0 -1
  371. package/dist/client/assets/agent-site-editor-code-Y9S3Tflm.js +0 -2
  372. package/dist/client/assets/agent-site-editor-content-DQIMpOhN.js +0 -1
  373. package/dist/client/assets/agent-site-editor-preview-Cmd7Qr1A.js +0 -1
  374. package/dist/client/assets/agent-view-CECuI8u1.js +0 -1
  375. package/dist/client/assets/api-keys-CeUptd-H.js +0 -1
  376. package/dist/client/assets/index-BLlatKRp.js +0 -1
  377. package/dist/client/assets/index-SmuiYnIl.css +0 -1
  378. package/dist/client/assets/library-D5ziXpSY.js +0 -1
  379. package/dist/client/assets/project-reports-Db25ahlS.js +0 -1
  380. package/dist/client/assets/project-tasks-8KIU2G_G.js +0 -1
  381. package/dist/client/assets/record-editor-B_4KV28Z.js +0 -1
  382. package/dist/client/assets/reports-BCF6hR_E.js +0 -1
  383. package/dist/client/assets/repositories-CaGUOsCY.js +0 -1
  384. package/dist/client/assets/route-Dvj1xiWd.js +0 -1
  385. package/dist/client/assets/settings-tab-D_5Bm5aU.js +0 -1
  386. package/dist/client/assets/shell-layout-BejViDQa.js +0 -1
  387. package/dist/client/assets/site-editor-By5ShAZu.js +0 -1
  388. package/dist/client/assets/tasks-B4qczLXa.js +0 -1
  389. package/dist/client/assets/thread-analytics-DTuM9ZEl.js +0 -1
  390. package/dist/client/assets/use-ask-in-chat-Ta68GLzt.js +0 -1
  391. package/dist/client/assets/use-blocks-v8-project-DcWNpXou.js +0 -1
  392. package/dist/client/assets/use-connection-Dht5w7Xq.js +0 -1
  393. package/dist/client/assets/useInfiniteQuery-CCCREFcj.js +0 -1
  394. package/dist/client/assets/useSuspenseInfiniteQuery-CIdX85h2.js +0 -1
@@ -1 +1 @@
1
- import{c as w,ar as oe,at as re,b as se,a5 as ce,l as de,j as s,m as ue,n as ae,r as D,d as he,aR as Z,R as J,P as z,aZ as fe,B as me}from"./index-YAbWBpI2.js";import{u as pe}from"./use-mobile-CW1BshYp.js";import{h as ge,c as be,u as xe,m as ye}from"./use-sidebar-collapsed-BzixWcm4.js";import{a as ie,R as je,b as Se}from"./resizable-CXcYWQyr.js";import{c as ve,r as Ce,m as Te}from"./use-chat-layout-state-DlqdI6ik.js";import{L as Le,q as Ne}from"./agent-icon-CqeITJaa.js";import{c as Q,T as X,a as ee}from"./tooltip-DAuc-B32.js";import{T as te}from"./toolbar-icon-button-DEBmHG_e.js";import{u as we}from"./use-project-scope-Cp4z8A1-.js";import{b as Pe}from"./repository-binding-BEFtyvwg.js";function ne(o,e){const a=typeof o=="number"?o:Number(o);return!Number.isFinite(a)||a<=0||a>=100?e:a}function ze(o,e){const a=w.c(8);let l;a[0]!==e?(l=c=>ne(c,e),a[0]=e,a[1]=l):l=a[1];const[t,i]=oe(o,l);let n;a[2]!==e||a[3]!==t?(n=ne(t,e),a[2]=e,a[3]=t,a[4]=n):n=a[4];let u;return a[5]!==i||a[6]!==n?(u=[n,i],a[5]=i,a[6]=n,a[7]=u):u=a[7],u}const _e=33;function Oe(){const o=w.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=re.sidePanelWidth(),o[0]=e):e=o[0],ze(e,_e)}function Ee(o){const e=w.c(64),{actions:a,navigation:l}=o,t=se(),{org:i}=ce(),n=we(),u=Pe(n),c=ge(),{toggleSidebar:d}=be(),h=xe(),r=le();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={select:Re},e[0]=f):f=e[0];const m=de(f),b=m?.mainView==="overview";let x;e[1]!==u?.title||e[2]!==t?(x=u?.title??t("common.loading"),e[1]=u?.title,e[2]=t,e[3]=x):x=e[3];const y=x;let j;e[4]!==b||e[5]!==m?.mainView||e[6]!==m?.pageTitle||e[7]!==y||e[8]!==n||e[9]!==t?(j=b?n?y:t("sidebar.navDestinations.home"):m?.mainView==="files"?t("sidebar.navDestinations.context"):t(m?.pageTitle??"page.view"),e[4]=b,e[5]=m?.mainView,e[6]=m?.pageTitle,e[7]=y,e[8]=n,e[9]=t,e[10]=j):j=e[10];const S=j,C=n??"";let T;e[11]!==i.slug||e[12]!==C?(T={to:"/$org/projects/$agentId",params:{org:i.slug,agentId:C}},e[11]=i.slug,e[12]=C,e[13]=T):T=e[13];const p=T;let g;if(e[14]!==c||e[15]!==b||e[16]!==i.slug||e[17]!==p||e[18]!==y||e[19]!==n||e[20]!==t||e[21]!==S){if(g=[],c){let v;e[23]!==t?(v=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=v):v=e[24];let B;e[25]!==i.slug?(B={to:"/$org/settings/general",params:{org:i.slug}},e[25]=i.slug,e[26]=B):B=e[26];let K;e[27]!==v||e[28]!==B?(K={key:"settings",label:v,link:B},e[27]=v,e[28]=B,e[29]=K):K=e[29],g.push(K)}else if(n&&!b){let v;e[30]!==p||e[31]!==y?(v={key:"project",label:y,link:p},e[30]=p,e[31]=y,e[32]=v):v=e[32],g.push(v)}let V;e[33]!==S?(V={key:"page",label:S},e[33]=S,e[34]=V):V=e[34],g.push(V),e[14]=c,e[15]=b,e[16]=i.slug,e[17]=p,e[18]=y,e[19]=n,e[20]=t,e[21]=S,e[22]=g}else g=e[22];const L=h,N=!!r&&!r.threadless&&r.threadOpen;let P;e[35]!==r||e[36]!==L||e[37]!==t?(P=L&&r&&!r.threadless&&s.jsxs(Q,{children:[s.jsx(X,{asChild:!0,children:s.jsx(te,{"aria-label":t(r.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":r.threadOpen,active:r.threadOpen,onClick:r.toggleThread,children:s.jsx(Le,{size:16})})}),s.jsx(ee,{side:"bottom",children:t(r.threadOpen?"page.closeThread":"page.openThread")})]}),e[35]=r,e[36]=L,e[37]=t,e[38]=P):P=e[38];const q=P,W=(!L||N)&&"md:hidden";let _;e[39]!==W?(_=ue(W),e[39]=W,e[40]=_):_=e[40];let O;e[41]!==t?(O=t("page.expandSidebar"),e[41]=t,e[42]=O):O=e[42];let A;e[43]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{size:16}),e[43]=A):A=e[43];let E;e[44]!==_||e[45]!==O||e[46]!==d?(E=s.jsx(X,{asChild:!0,children:s.jsx(te,{className:_,onClick:d,"aria-label":O,children:A})}),e[44]=_,e[45]=O,e[46]=d,e[47]=E):E=e[47];let R;e[48]!==t?(R=t("page.expandSidebar"),e[48]=t,e[49]=R):R=e[49];let M;e[50]!==R?(M=s.jsx(ee,{side:"bottom",children:R}),e[50]=R,e[51]=M):M=e[51];let k;e[52]!==E||e[53]!==M?(k=s.jsxs(Q,{children:[E,M]}),e[52]=E,e[53]=M,e[54]=k):k=e[54];let I;e[55]!==q||e[56]!==k?(I=s.jsxs(s.Fragment,{children:[k,q]}),e[55]=q,e[56]=k,e[57]=I):I=e[57];let H;return e[58]!==a||e[59]!==g||e[60]!==l||e[61]!==i.name||e[62]!==I?(H=s.jsx(ae.Header,{leading:I,breadcrumbs:g,scope:i.name,actions:a,navigation:l}),e[58]=a,e[59]=g,e[60]=l,e[61]=i.name,e[62]=I,e[63]=H):H=e[63],H}function Re(o){return o.matches.findLast(Me)?.staticData}function Me(o){return o.staticData.pageTitle}const $="chat-layout-thread",F="chat-layout-content",G=D.createContext(null);function ke(){return U()}function le(){return D.use(G)}function U(){const o=D.use(G);if(!o)throw new Error("ChatLayout regions require a ChatLayout");return o}function Ie(o){const e=w.c(23),{children:a,...l}=o,t=pe(),i=he(),n=D.useRef(null),[u,c]=Oe(),{threadOpen:d,contentOpen:h}=l,r=ve(l),f=d&&h?u:r.side,m=100-f,b=p=>{const g=p.getLayout(),L=g[$],N=g[F];typeof L!="number"||typeof N!="number"||Math.abs(L-f)<.001&&Math.abs(N-m)<.001||p.setLayout({[$]:f,[F]:m})},x=Ce({visibility:l,threadVisibilityExplicit:l.threadVisibilityExplicit});let y;e[0]!==t||e[1]!==l||e[2]!==x?(y={...l,isMobile:t,mobileSurface:x},e[0]=t,e[1]=l,e[2]=x,e[3]=y):y=e[3];const j=y;let S;e[4]!==t||e[5]!==l||e[6]!==i||e[7]!==d||e[8]!==j?(S=!l.threadless&&s.jsx(ye,{open:t?j.mobileSurface==="chat":d,onToggle:()=>{t?i({to:".",search:p=>({...p,...Te(j.mobileSurface==="chat"?"main":"chat")}),replace:!0}):l.toggleThread()}}),e[4]=t,e[5]=l,e[6]=i,e[7]=d,e[8]=j,e[9]=S):S=e[9];let C;e[10]!==a||e[11]!==h||e[12]!==m||e[13]!==t||e[14]!==c||e[15]!==b||e[16]!==d||e[17]!==f?(C=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(je,{ref:p=>{if(n.current=p,!p)return;let g=!0;return queueMicrotask(()=>{g&&b(p)}),()=>{g=!1,n.current===p&&(n.current=null)}},defaultLayout:{[$]:f,[F]:m},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(p,g)=>{const{isUserInteraction:L}=g;if(!L){const P=n.current;P&&b(P);return}const N=p[$];d&&h&&typeof N=="number"&&N>0&&N<100&&c(N)},children:a}),e[10]=a,e[11]=h,e[12]=m,e[13]=t,e[14]=c,e[15]=b,e[16]=d,e[17]=f,e[18]=C):C=e[18];let T;return e[19]!==S||e[20]!==C||e[21]!==j?(T=s.jsxs(G,{value:j,children:[S,C]}),e[19]=S,e[20]=C,e[21]=j,e[22]=T):T=e[22],T}function Be(o){const e=w.c(16),{children:a,topbar:l}=o,t=U();if(t.isMobile){let r;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==l?(r=t.mobileSurface==="chat"?s.jsxs(z,{variant:"plain","data-slot":"chat-layout-thread",children:[l,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=l,e[3]=r):r=e[3],r}const i=t.threadOpen?"":void 0;let n;e[4]!==a||e[5]!==t.threadOpen||e[6]!==l?(n=t.threadOpen&&s.jsxs(s.Fragment,{children:[l,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=l,e[7]=n):n=e[7];let u;e[8]!==n?(u=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(z,{"data-testid":"side-panel",children:n})}),e[8]=n,e[9]=u):u=e[9];let c;e[10]!==i||e[11]!==u?(c=s.jsx(ie,{id:$,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":i,className:"min-w-0 overflow-hidden bg-sidebar",children:u}),e[10]=i,e[11]=u,e[12]=c):c=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Se,{className:"bg-sidebar"}),e[13]=d):d=e[13];let h;return e[14]!==c?(h=s.jsxs(s.Fragment,{children:[c,d]}),e[14]=c,e[15]=h):h=e[15],h}function $e({children:o,routeId:e}){return o}function Y(o){const e=w.c(23),{children:a,actions:l,drawer:t,aside:i}=o,n=U();if(n.isMobile&&n.mobileSurface!=="main")return null;const u=n.isMobile?"plain":"card";let c;e[0]!==l||e[1]!==n.contentNavigation?(c=s.jsx(Ee,{navigation:n.contentNavigation,actions:l}),e[0]=l,e[1]=n.contentNavigation,e[2]=c):c=e[2];let d;e[3]!==a||e[4]!==n.contentKey?(d=s.jsx(Z,{children:s.jsx($e,{routeId:n.contentKey,children:a})}),e[3]=a,e[4]=n.contentKey,e[5]=d):d=e[5];let h;e[6]!==n.contentKey||e[7]!==d?(h=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(J,{children:d},n.contentKey)}),e[6]=n.contentKey,e[7]=d,e[8]=h):h=e[8];let r;e[9]!==t||e[10]!==h?(r=s.jsxs(z.Content,{children:[h,t]}),e[9]=t,e[10]=h,e[11]=r):r=e[11];let f;e[12]!==c||e[13]!==r?(f=s.jsxs(ae.Breadcrumbs.Provider,{children:[c,r]}),e[12]=c,e[13]=r,e[14]=f):f=e[14];let m;e[15]!==u||e[16]!==f?(m=s.jsx(z,{"data-testid":"main-panel",variant:u,children:f}),e[15]=u,e[16]=f,e[17]=m):m=e[17];const b=m;let x;return e[18]!==i||e[19]!==n.contentOpen||e[20]!==n.isMobile||e[21]!==b?(x=n.isMobile?b:s.jsx(ie,{id:F,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsxs("div",{className:"flex h-full min-h-0",children:[s.jsx("div",{className:"h-full min-h-0 min-w-0 flex-1 p-0.5",children:b}),i&&s.jsx("div",{className:"h-full min-h-0 w-[42%] min-w-80 shrink-0 p-0.5",children:s.jsx(z,{"data-testid":"aside-panel",children:s.jsx(J,{children:s.jsx(Z,{children:i})},D.isValidElement(i)?i.key??void 0:void 0)})})]})}),e[18]=i,e[19]=n.contentOpen,e[20]=n.isMobile,e[21]=b,e[22]=x):x=e[22],x}function De(){const o=w.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Y,{children:s.jsx(fe,{})}),o[0]=e):e=o[0],e}function Ae(o){const e=w.c(18),{error:a,reset:l}=o,t=se();let i;e[0]!==t?(i=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=i):i=e[1];let n;e[2]!==i?(n=s.jsx("h2",{className:"text-lg font-medium",children:i}),e[2]=i,e[3]=n):n=e[3];let u;e[4]!==a.message||e[5]!==t?(u=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=u):u=e[6];let c;e[7]!==u?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:u}),e[7]=u,e[8]=c):c=e[8];let d;e[9]!==t?(d=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=d):d=e[10];let h;e[11]!==l||e[12]!==d?(h=s.jsx(me,{variant:"outline",onClick:l,children:d}),e[11]=l,e[12]=d,e[13]=h):h=e[13];let r;return e[14]!==n||e[15]!==c||e[16]!==h?(r=s.jsx(Y,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[n,c,h]})}),e[14]=n,e[15]=c,e[16]=h,e[17]=r):r=e[17],r}const He=Object.assign(Ie,{Thread:Be,Content:Y}),Qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:He,ChatLayoutError:Ae,ChatLayoutPending:De,useChatLayout:ke,useOptionalChatLayout:le},Symbol.toStringTag,{value:"Module"}));export{He as C,Ee as R,Qe as i,ke as u};
1
+ import{c as w,ar as oe,at as re,b as se,a5 as ce,l as de,j as s,m as ue,n as ae,r as D,d as he,aR as Z,R as J,P as z,aZ as fe,B as me}from"./index-BpRy7AHp.js";import{u as pe}from"./use-mobile-CKr6zvd6.js";import{h as ge,c as be,u as xe,m as ye}from"./use-sidebar-collapsed-NHFQSjyB.js";import{a as ie,R as je,b as Se}from"./resizable-D8U4YOro.js";import{c as ve,r as Ce,m as Te}from"./use-chat-layout-state-BbG5C9on.js";import{L as Le,q as Ne}from"./agent-icon-AbOSM7KF.js";import{c as Q,T as X,a as ee}from"./tooltip-jhiffORJ.js";import{T as te}from"./toolbar-icon-button-Cx0kc5lZ.js";import{u as we}from"./use-project-scope-DK5Zq3Vj.js";import{b as Pe}from"./repository-binding-DdmRVWpz.js";function ne(o,e){const a=typeof o=="number"?o:Number(o);return!Number.isFinite(a)||a<=0||a>=100?e:a}function ze(o,e){const a=w.c(8);let l;a[0]!==e?(l=c=>ne(c,e),a[0]=e,a[1]=l):l=a[1];const[t,i]=oe(o,l);let n;a[2]!==e||a[3]!==t?(n=ne(t,e),a[2]=e,a[3]=t,a[4]=n):n=a[4];let u;return a[5]!==i||a[6]!==n?(u=[n,i],a[5]=i,a[6]=n,a[7]=u):u=a[7],u}const _e=33;function Oe(){const o=w.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=re.sidePanelWidth(),o[0]=e):e=o[0],ze(e,_e)}function Ee(o){const e=w.c(64),{actions:a,navigation:l}=o,t=se(),{org:i}=ce(),n=we(),u=Pe(n),c=ge(),{toggleSidebar:d}=be(),h=xe(),r=le();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={select:Re},e[0]=f):f=e[0];const m=de(f),b=m?.mainView==="overview";let x;e[1]!==u?.title||e[2]!==t?(x=u?.title??t("common.loading"),e[1]=u?.title,e[2]=t,e[3]=x):x=e[3];const y=x;let j;e[4]!==b||e[5]!==m?.mainView||e[6]!==m?.pageTitle||e[7]!==y||e[8]!==n||e[9]!==t?(j=b?n?y:t("sidebar.navDestinations.home"):m?.mainView==="files"?t("sidebar.navDestinations.context"):t(m?.pageTitle??"page.view"),e[4]=b,e[5]=m?.mainView,e[6]=m?.pageTitle,e[7]=y,e[8]=n,e[9]=t,e[10]=j):j=e[10];const S=j,C=n??"";let T;e[11]!==i.slug||e[12]!==C?(T={to:"/$org/projects/$agentId",params:{org:i.slug,agentId:C}},e[11]=i.slug,e[12]=C,e[13]=T):T=e[13];const p=T;let g;if(e[14]!==c||e[15]!==b||e[16]!==i.slug||e[17]!==p||e[18]!==y||e[19]!==n||e[20]!==t||e[21]!==S){if(g=[],c){let v;e[23]!==t?(v=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=v):v=e[24];let B;e[25]!==i.slug?(B={to:"/$org/settings/general",params:{org:i.slug}},e[25]=i.slug,e[26]=B):B=e[26];let K;e[27]!==v||e[28]!==B?(K={key:"settings",label:v,link:B},e[27]=v,e[28]=B,e[29]=K):K=e[29],g.push(K)}else if(n&&!b){let v;e[30]!==p||e[31]!==y?(v={key:"project",label:y,link:p},e[30]=p,e[31]=y,e[32]=v):v=e[32],g.push(v)}let V;e[33]!==S?(V={key:"page",label:S},e[33]=S,e[34]=V):V=e[34],g.push(V),e[14]=c,e[15]=b,e[16]=i.slug,e[17]=p,e[18]=y,e[19]=n,e[20]=t,e[21]=S,e[22]=g}else g=e[22];const L=h,N=!!r&&!r.threadless&&r.threadOpen;let P;e[35]!==r||e[36]!==L||e[37]!==t?(P=L&&r&&!r.threadless&&s.jsxs(Q,{children:[s.jsx(X,{asChild:!0,children:s.jsx(te,{"aria-label":t(r.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":r.threadOpen,active:r.threadOpen,onClick:r.toggleThread,children:s.jsx(Le,{size:16})})}),s.jsx(ee,{side:"bottom",children:t(r.threadOpen?"page.closeThread":"page.openThread")})]}),e[35]=r,e[36]=L,e[37]=t,e[38]=P):P=e[38];const q=P,W=(!L||N)&&"md:hidden";let _;e[39]!==W?(_=ue(W),e[39]=W,e[40]=_):_=e[40];let O;e[41]!==t?(O=t("page.expandSidebar"),e[41]=t,e[42]=O):O=e[42];let A;e[43]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{size:16}),e[43]=A):A=e[43];let E;e[44]!==_||e[45]!==O||e[46]!==d?(E=s.jsx(X,{asChild:!0,children:s.jsx(te,{className:_,onClick:d,"aria-label":O,children:A})}),e[44]=_,e[45]=O,e[46]=d,e[47]=E):E=e[47];let R;e[48]!==t?(R=t("page.expandSidebar"),e[48]=t,e[49]=R):R=e[49];let M;e[50]!==R?(M=s.jsx(ee,{side:"bottom",children:R}),e[50]=R,e[51]=M):M=e[51];let k;e[52]!==E||e[53]!==M?(k=s.jsxs(Q,{children:[E,M]}),e[52]=E,e[53]=M,e[54]=k):k=e[54];let I;e[55]!==q||e[56]!==k?(I=s.jsxs(s.Fragment,{children:[k,q]}),e[55]=q,e[56]=k,e[57]=I):I=e[57];let H;return e[58]!==a||e[59]!==g||e[60]!==l||e[61]!==i.name||e[62]!==I?(H=s.jsx(ae.Header,{leading:I,breadcrumbs:g,scope:i.name,actions:a,navigation:l}),e[58]=a,e[59]=g,e[60]=l,e[61]=i.name,e[62]=I,e[63]=H):H=e[63],H}function Re(o){return o.matches.findLast(Me)?.staticData}function Me(o){return o.staticData.pageTitle}const $="chat-layout-thread",F="chat-layout-content",G=D.createContext(null);function ke(){return U()}function le(){return D.use(G)}function U(){const o=D.use(G);if(!o)throw new Error("ChatLayout regions require a ChatLayout");return o}function Ie(o){const e=w.c(23),{children:a,...l}=o,t=pe(),i=he(),n=D.useRef(null),[u,c]=Oe(),{threadOpen:d,contentOpen:h}=l,r=ve(l),f=d&&h?u:r.side,m=100-f,b=p=>{const g=p.getLayout(),L=g[$],N=g[F];typeof L!="number"||typeof N!="number"||Math.abs(L-f)<.001&&Math.abs(N-m)<.001||p.setLayout({[$]:f,[F]:m})},x=Ce({visibility:l,threadVisibilityExplicit:l.threadVisibilityExplicit});let y;e[0]!==t||e[1]!==l||e[2]!==x?(y={...l,isMobile:t,mobileSurface:x},e[0]=t,e[1]=l,e[2]=x,e[3]=y):y=e[3];const j=y;let S;e[4]!==t||e[5]!==l||e[6]!==i||e[7]!==d||e[8]!==j?(S=!l.threadless&&s.jsx(ye,{open:t?j.mobileSurface==="chat":d,onToggle:()=>{t?i({to:".",search:p=>({...p,...Te(j.mobileSurface==="chat"?"main":"chat")}),replace:!0}):l.toggleThread()}}),e[4]=t,e[5]=l,e[6]=i,e[7]=d,e[8]=j,e[9]=S):S=e[9];let C;e[10]!==a||e[11]!==h||e[12]!==m||e[13]!==t||e[14]!==c||e[15]!==b||e[16]!==d||e[17]!==f?(C=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(je,{ref:p=>{if(n.current=p,!p)return;let g=!0;return queueMicrotask(()=>{g&&b(p)}),()=>{g=!1,n.current===p&&(n.current=null)}},defaultLayout:{[$]:f,[F]:m},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(p,g)=>{const{isUserInteraction:L}=g;if(!L){const P=n.current;P&&b(P);return}const N=p[$];d&&h&&typeof N=="number"&&N>0&&N<100&&c(N)},children:a}),e[10]=a,e[11]=h,e[12]=m,e[13]=t,e[14]=c,e[15]=b,e[16]=d,e[17]=f,e[18]=C):C=e[18];let T;return e[19]!==S||e[20]!==C||e[21]!==j?(T=s.jsxs(G,{value:j,children:[S,C]}),e[19]=S,e[20]=C,e[21]=j,e[22]=T):T=e[22],T}function Be(o){const e=w.c(16),{children:a,topbar:l}=o,t=U();if(t.isMobile){let r;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==l?(r=t.mobileSurface==="chat"?s.jsxs(z,{variant:"plain","data-slot":"chat-layout-thread",children:[l,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=l,e[3]=r):r=e[3],r}const i=t.threadOpen?"":void 0;let n;e[4]!==a||e[5]!==t.threadOpen||e[6]!==l?(n=t.threadOpen&&s.jsxs(s.Fragment,{children:[l,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=l,e[7]=n):n=e[7];let u;e[8]!==n?(u=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(z,{"data-testid":"side-panel",children:n})}),e[8]=n,e[9]=u):u=e[9];let c;e[10]!==i||e[11]!==u?(c=s.jsx(ie,{id:$,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":i,className:"min-w-0 overflow-hidden bg-sidebar",children:u}),e[10]=i,e[11]=u,e[12]=c):c=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Se,{className:"bg-sidebar"}),e[13]=d):d=e[13];let h;return e[14]!==c?(h=s.jsxs(s.Fragment,{children:[c,d]}),e[14]=c,e[15]=h):h=e[15],h}function $e({children:o,routeId:e}){return o}function Y(o){const e=w.c(23),{children:a,actions:l,drawer:t,aside:i}=o,n=U();if(n.isMobile&&n.mobileSurface!=="main")return null;const u=n.isMobile?"plain":"card";let c;e[0]!==l||e[1]!==n.contentNavigation?(c=s.jsx(Ee,{navigation:n.contentNavigation,actions:l}),e[0]=l,e[1]=n.contentNavigation,e[2]=c):c=e[2];let d;e[3]!==a||e[4]!==n.contentKey?(d=s.jsx(Z,{children:s.jsx($e,{routeId:n.contentKey,children:a})}),e[3]=a,e[4]=n.contentKey,e[5]=d):d=e[5];let h;e[6]!==n.contentKey||e[7]!==d?(h=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(J,{children:d},n.contentKey)}),e[6]=n.contentKey,e[7]=d,e[8]=h):h=e[8];let r;e[9]!==t||e[10]!==h?(r=s.jsxs(z.Content,{children:[h,t]}),e[9]=t,e[10]=h,e[11]=r):r=e[11];let f;e[12]!==c||e[13]!==r?(f=s.jsxs(ae.Breadcrumbs.Provider,{children:[c,r]}),e[12]=c,e[13]=r,e[14]=f):f=e[14];let m;e[15]!==u||e[16]!==f?(m=s.jsx(z,{"data-testid":"main-panel",variant:u,children:f}),e[15]=u,e[16]=f,e[17]=m):m=e[17];const b=m;let x;return e[18]!==i||e[19]!==n.contentOpen||e[20]!==n.isMobile||e[21]!==b?(x=n.isMobile?b:s.jsx(ie,{id:F,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsxs("div",{className:"flex h-full min-h-0",children:[s.jsx("div",{className:"h-full min-h-0 min-w-0 flex-1 p-0.5",children:b}),i&&s.jsx("div",{className:"h-full min-h-0 w-[42%] min-w-80 shrink-0 p-0.5",children:s.jsx(z,{"data-testid":"aside-panel",children:s.jsx(J,{children:s.jsx(Z,{children:i})},D.isValidElement(i)?i.key??void 0:void 0)})})]})}),e[18]=i,e[19]=n.contentOpen,e[20]=n.isMobile,e[21]=b,e[22]=x):x=e[22],x}function De(){const o=w.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Y,{children:s.jsx(fe,{})}),o[0]=e):e=o[0],e}function Ae(o){const e=w.c(18),{error:a,reset:l}=o,t=se();let i;e[0]!==t?(i=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=i):i=e[1];let n;e[2]!==i?(n=s.jsx("h2",{className:"text-lg font-medium",children:i}),e[2]=i,e[3]=n):n=e[3];let u;e[4]!==a.message||e[5]!==t?(u=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=u):u=e[6];let c;e[7]!==u?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:u}),e[7]=u,e[8]=c):c=e[8];let d;e[9]!==t?(d=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=d):d=e[10];let h;e[11]!==l||e[12]!==d?(h=s.jsx(me,{variant:"outline",onClick:l,children:d}),e[11]=l,e[12]=d,e[13]=h):h=e[13];let r;return e[14]!==n||e[15]!==c||e[16]!==h?(r=s.jsx(Y,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[n,c,h]})}),e[14]=n,e[15]=c,e[16]=h,e[17]=r):r=e[17],r}const He=Object.assign(Ie,{Thread:Be,Content:Y}),Qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:He,ChatLayoutError:Ae,ChatLayoutPending:De,useChatLayout:ke,useOptionalChatLayout:le},Symbol.toStringTag,{value:"Module"}));export{He as C,Ee as R,Qe as i,ke as u};
@@ -1 +1 @@
1
- import{n as $,x as D,_ as We,T as H,$ as je,a0 as A,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-BebN-2hd.js";import{gs as ye,he as Ce,gr as Se,hf as Re,hg as Ee,hh as Te,hi as Oe,hj as Ie,gu as Ae,fi as Me,r as C,bQ as ze}from"./index-YAbWBpI2.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new 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(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=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(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
1
+ import{n as $,x as D,_ as We,T as H,$ as je,a0 as A,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-DB51uKij.js";import{gs as ye,he as Ce,gr as Se,hf as Re,hg as Ee,hh as Te,hi as Oe,hj as Ie,gu as Ae,fj as Me,r as C,bQ as ze}from"./index-BpRy7AHp.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new 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(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=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(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
@@ -1,4 +1,4 @@
1
- import{r as $,bQ as nt,c as U,b as ie,j as i,g3 as ke,o as lt,g4 as rt,a5 as be,ak as we,q as _e,aD as We,aE as Ue,e as je,I as fe,aF as Be,aG as xe,K as pe,t as le,B as oe,y as Ve,E as ne,D as ot,v as at,w as ct,x as dt,h as Oe,m as ge,bB as J,d as ht,R as ut,a6 as mt}from"./index-YAbWBpI2.js";import{C as ft}from"./checkbox-Djgrt1vS.js";import{S as pt,b as xt,a as gt,d as vt,c as bt}from"./select-BkMg57qf.js";import{i as He}from"./ArrowLeft-BevitLPy.js";import{i as yt}from"./ChevronSelectorVertical-DPCJGeHn.js";import{i as jt}from"./Key01-BSJHIVa1.js";import{i as qe,s as Ye,t as St,e as Nt,f as kt,b as wt,d as _t,a as It,g as Ct}from"./Tool01-B3AGNBtQ.js";import{i as Qe}from"./SearchMd-CW3ppy8-.js";import{e as Ie,u as Mt,a as Et,c as Ot}from"./use-ai-providers-DcAVgXsj.js";import{d as zt}from"./chat-context-Bc7GhR8U.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{g as ve}from"./openai-compatible-presets-BKGfVqEx.js";import{i as Pt}from"./Monitor01-Cuob4vSq.js";import{i as At}from"./AlertCircle-C8Ovs13g.js";import{u as Ft}from"./use-entitlements-D3oGZGk4.js";import{t as ze}from"./ChevronUp-CpgR3_nb.js";function me(n,e,t){let s=t.initialDeps??[],l,r=!0;function a(){var c,h,d;let o;t.key&&((c=t.debug)!=null&&c.call(t))&&(o=Date.now());const m=n();if(!(m.length!==s.length||m.some((f,g)=>s[g]!==f)))return l;s=m;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),l=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-o)*100)/100,g=Math.round((Date.now()-u)*100)/100,I=g/16,S=(y,w)=>{for(y=String(y);y.length<w;)y=" "+y;return y};console.info(`%c⏱ ${S(g,5)} /${S(f,5)} ms`,`
1
+ import{r as $,bQ as nt,c as U,b as ie,j as i,g3 as ke,o as lt,g4 as rt,a5 as be,ak as we,q as _e,aD as We,aE as Ue,e as je,I as fe,aF as Be,aG as xe,K as pe,t as le,B as oe,y as Ve,E as ne,D as ot,v as at,w as ct,x as dt,h as Oe,m as ge,bB as J,d as ht,R as ut,a6 as mt}from"./index-BpRy7AHp.js";import{C as ft}from"./checkbox-DDDKCgb5.js";import{S as pt,b as xt,a as gt,d as vt,c as bt}from"./select-BqAgCf_e.js";import{i as He}from"./ArrowLeft-yZosAbEQ.js";import{i as yt}from"./ChevronSelectorVertical-C2ySHatm.js";import{i as jt}from"./Key01-CJVeUDDi.js";import{i as qe,s as Ye,t as St,e as Nt,f as kt,b as wt,d as _t,a as It,g as Ct}from"./Tool01-BXFm5jK2.js";import{i as Qe}from"./SearchMd-DrxAIngK.js";import{e as Ie,u as Mt,a as Et,c as Ot}from"./use-ai-providers-sfkouqgF.js";import{d as zt}from"./chat-context-BFpdF0Ea.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{g as ve}from"./openai-compatible-presets-BKGfVqEx.js";import{i as Pt}from"./Monitor01-BwW28bRE.js";import{i as At}from"./AlertCircle-1CFQF9HU.js";import{u as Ft}from"./use-entitlements-CMCBZq5_.js";import{t as ze}from"./ChevronUp-aVrgoYI4.js";function me(n,e,t){let s=t.initialDeps??[],l,r=!0;function a(){var c,h,d;let o;t.key&&((c=t.debug)!=null&&c.call(t))&&(o=Date.now());const m=n();if(!(m.length!==s.length||m.some((f,g)=>s[g]!==f)))return l;s=m;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),l=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-o)*100)/100,g=Math.round((Date.now()-u)*100)/100,I=g/16,S=(y,w)=>{for(y=String(y);y.length<w;)y=" "+y;return y};console.info(`%c⏱ ${S(g,5)} /${S(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*I,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(r&&t.skipInitialOnChange)&&t.onChange(l),r=!1,l}return a.updateDeps=c=>{s=c},a}function Pe(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Tt=(n,e)=>Math.abs(n-e)<1.01,Rt=(n,e,t)=>{let s;return function(...l){n.clearTimeout(s),s=n.setTimeout(()=>e.apply(this,l),t)}},Ae=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},Kt=n=>n,Lt=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),s=[];for(let l=e;l<=t;l++)s.push(l);return s},Dt=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;const l=a=>{const{width:c,height:h}=a;e({width:Math.round(c),height:Math.round(h)})};if(l(Ae(t)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(a=>{const c=()=>{const h=a[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){l({width:d.inlineSize,height:d.blockSize});return}}l(Ae(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},Fe={passive:!0},Te=typeof window>"u"?!0:"onscrollend"in window,$t=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;let l=0;const r=n.options.useScrollendEvent&&Te?()=>{}:Rt(s,()=>{e(l,!1)},n.options.isScrollingResetDelay),a=o=>()=>{const{horizontal:m,isRtl:p}=n.options;l=m?t.scrollLeft*(p&&-1||1):t.scrollTop,r(),e(l,o)},c=a(!0),h=a(!1);t.addEventListener("scroll",c,Fe);const d=n.options.useScrollendEvent&&Te;return d&&t.addEventListener("scrollend",h,Fe),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",h)}},Wt=(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"]},Ut=(n,{adjustments:e=0,behavior:t},s)=>{var l,r;const a=n+e;(r=(l=s.scrollElement)==null?void 0:l.scrollTo)==null||r.call(l,{[s.options.horizontal?"left":"top"]:a,behavior:t})};class Bt{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,l;return((l=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:l.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(l=>{l.forEach(r=>{const a=()=>{const c=r.target,h=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(c,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var l;(l=s())==null||l.disconnect(),t=null},observe:l=>{var r;return(r=s())==null?void 0:r.observe(l,{box:"border-box"})},unobserve:l=>{var r;return(r=s())==null?void 0:r.unobserve(l)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([s,l])=>{typeof l>"u"&&delete t[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Kt,rangeExtractor:Lt,onChange:()=>{},measureElement:Wt,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,l;(l=(s=this.options).onChange)==null||l.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(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=r,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 l=new Map,r=new Map;for(let a=s-1;a>=0;a--){const c=t[a];if(l.has(c.lane))continue;const h=r.get(c.lane);if(h==null||c.end>h.end?r.set(c.lane,c):c.end<h.end&&l.set(c.lane,!0),l.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((a,c)=>a.end===c.end?a.index-c.index:a.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,l,r,a,c,h)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:s,scrollMargin:l,getItemKey:r,enabled:a,lanes:c,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=me(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:s,scrollMargin:l,getItemKey:r,enabled:a,lanes:c,laneAssignmentMode:h},d)=>{if(!a)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 o=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,o),p=new Array(c).fill(void 0);for(let u=0;u<o;u++){const f=m[u];f&&(p[f.lane]=u)}for(let u=o;u<t;u++){const f=r(u),g=this.laneAssignments.get(u);let I,S;const y=h==="estimate"||d.has(f);if(g!==void 0&&this.options.lanes>1){I=g;const N=p[I],x=N!==void 0?m[N]:void 0;S=x?x.end+this.options.gap:s+l}else{const N=this.options.lanes===1?m[u-1]:this.getFurthestMeasurement(m,u);S=N?N.end+this.options.gap:s+l,I=N?N.lane:u%this.options.lanes,this.options.lanes>1&&y&&this.laneAssignments.set(u,I)}const w=d.get(f),_=typeof w=="number"?w:this.options.estimateSize(u),C=S+_;m[u]={index:u,start:S,size:_,end:C,key:f,lane:I},p[I]=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,l,r)=>this.range=t.length>0&&s>0?Vt({measurements:t,outerSize:s,scrollOffset:l,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=me(()=>{let t=null,s=null;const l=this.calculateRange();return l&&(t=l.startIndex,s=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,l,r,a)=>r===null||a===null?[]:t({startIndex:r,endIndex:a,overscan:s,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,l=t.getAttribute(s);return l?parseInt(l,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 l=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(l!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,l-r),c=Math.min(this.options.count-1,l+r);return t>=a&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,c)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(c))});return}const s=this.indexFromElement(t),l=this.options.getItemKey(s),r=this.elementsCache.get(l);r!==t&&(r&&this.observer.unobserve(r),this.observer.observe(t),this.elementsCache.set(l,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var l;const r=this.measurementsCache[t];if(!r)return;const a=this.itemSizeCache.get(r.key)??r.size,c=s-a;c!==0&&(((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,c,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.getVirtualItems=me(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const l=[];for(let r=0,a=t.length;r<a;r++){const c=t[r],h=s[c];l.push(h)}return l},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length!==0)return Pe(s[Ge(0,s.length-1,l=>Pe(s[l]).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,l=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=t>=a+r?"end":"start"),s==="center"?t+=(l-r)/2:s==="end"&&(t-=r);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 l=this.getSize(),r=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(s==="auto")if(a.end>=r+l-this.options.scrollPaddingEnd)s="end";else if(a.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const c=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,s,a.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:l="auto"}={})=>{const r=this.getOffsetForAlignment(t,s),a=this.now();this.scrollState={index:null,align:s,behavior:l,startedAt:a,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:l="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.getOffsetForIndex(t,s);if(!r)return;const[a,c]=r,h=this.now();this.scrollState={index:t,align:c,behavior:l,startedAt:h,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const l=this.getScrollOffset()+t,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let l;if(s.length===0)l=this.options.paddingStart;else if(this.options.lanes===1)l=((t=s[s.length-1])==null?void 0:t.end)??0;else{const r=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&r.some(c=>c===null);){const c=s[a];r[c.lane]===null&&(r[c.lane]=c.end),a--}l=Math.max(...r.filter(c=>c!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:s,behavior:l})=>{this.options.scrollToFn(t,{behavior:l,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,l=s?s[0]:this.scrollState.lastTargetOffset,r=1,a=l!==this.scrollState.lastTargetOffset;if(!a&&Tt(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=l,this.scrollState.behavior="auto",this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Ge=(n,e,t,s)=>{for(;n<=e;){const l=(n+e)/2|0,r=t(l);if(r<s)n=l+1;else if(r>s)e=l-1;else return l}return n>0?n-1:0};function Vt({measurements:n,outerSize:e,scrollOffset:t,lanes:s}){const l=n.length-1,r=h=>n[h].start;if(n.length<=s)return{startIndex:0,endIndex:l};let a=Ge(0,l,r,t),c=a;if(s===1)for(;c<l&&n[c].end<t+e;)c++;else if(s>1){const h=Array(s).fill(0);for(;c<l&&h.some(o=>o<t+e);){const o=n[c];h[o.lane]=o.end,c++}const d=Array(s).fill(t+e);for(;a>=0&&d.some(o=>o>=t);){const o=n[a];d[o.lane]=o.start,a--}a=Math.max(0,a-a%s),c=Math.min(l,c+(s-1-c%s))}return{startIndex:a,endIndex:c}}const Re=typeof document<"u"?$.useLayoutEffect:$.useEffect;function Ht({useFlushSync:n=!0,...e}){const t=$.useReducer(()=>({}),{})[1],s={...e,onChange:(r,a)=>{var c;n&&a?nt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,r,a)}},[l]=$.useState(()=>new Bt(s));return l.setOptions(s),Re(()=>l._didMount(),[]),Re(()=>l._willUpdate()),l}function qt(n){return Ht({observeElementRect:Dt,observeElementOffset:$t,scrollToFn:Ut,...n})}const Yt=["anthropic","openrouter"],Qt=["google"];function Ne(n){const e=U.c(8),{logo:t,name:s,description:l,onClick:r}=n;let a;e[0]!==t||e[1]!==s?(a=t?i.jsx("img",{src:t,alt:s,className:"size-5 object-contain"}):i.jsx(lt,{fallback:s.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=s,e[2]=a):a=e[2];let c;return e[3]!==l||e[4]!==s||e[5]!==r||e[6]!==a?(c=i.jsx(rt,{onClick:r,icon:a,title:s,description:l}),e[3]=l,e[4]=s,e[5]=r,e[6]=a,e[7]=c):c=e[7],c}function Ke(n){const e=U.c(7),{label:t,children:s}=n;let l;e[0]!==t?(l=i.jsx("span",{className:"px-1 text-meta",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==s?(r=i.jsx(ke,{children:s}),e[2]=s,e[3]=r):r=e[3];let a;return e[4]!==l||e[5]!==r?(a=i.jsxs("div",{className:"flex flex-col gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=a):a=e[6],a}function Xe(n){const e=U.c(45),{providers:t,onSelect:s}=n,l=ie(),r=Ft();let a;e[0]!==t?(a=S=>t.find(y=>y.id===S),e[0]=t,e[1]=a):a=e[1];const c=a;let h,d,o,m,p;if(e[2]!==c||e[3]!==s||e[4]!==r){const S=r?void 0:c("deco");let y;e[10]!==c?(y=c("openai-compatible"),e[10]=c,e[11]=y):y=e[11],o=y;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=ve("openai"),e[12]=w):w=e[12];const _=w;let C;e[13]!==s?(C=v=>i.jsx(Ne,{logo:v.logo,name:v.name,description:v.description,onClick:()=>s({kind:"provider",provider:v})},v.id),e[13]=s,e[14]=C):C=e[14];const N=C;if(e[15]!==c||e[16]!==s||e[17]!==o||e[18]!==N){let v;if(e[20]!==c||e[21]!==N?(v=j=>{const M=c(j);return M?[N(M)]:[]},e[20]=c,e[21]=N,e[22]=v):v=e[22],h=Yt.flatMap(v),o&&_){let j;e[23]!==s||e[24]!==o?(j=i.jsx(Ne,{logo:_.logo,name:_.name,description:_.description,onClick:()=>s({kind:"openai-compatible",provider:o,preset:_})},_.id),e[23]=s,e[24]=o,e[25]=j):j=e[25],h.push(j)}e[15]=c,e[16]=s,e[17]=o,e[18]=N,e[19]=h}else h=e[19];let x;e[26]!==c||e[27]!==N?(x=Qt.flatMap(v=>{const j=c(v);return j?[N(j)]:[]}),e[26]=c,e[27]=N,e[28]=x):x=e[28],d=x,m="flex flex-col gap-5",p=S&&i.jsx(ke,{children:N(S)}),e[2]=c,e[3]=s,e[4]=r,e[5]=h,e[6]=d,e[7]=o,e[8]=m,e[9]=p}else h=e[5],d=e[6],o=e[7],m=e[8],p=e[9];let u;e[29]!==h||e[30]!==l?(u=h.length>0&&i.jsx(Ke,{label:l("settings.aiProviders.groupChat"),children:h}),e[29]=h,e[30]=l,e[31]=u):u=e[31];let f;e[32]!==d||e[33]!==l?(f=d.length>0&&i.jsx(Ke,{label:l("settings.aiProviders.groupMedia"),children:d}),e[32]=d,e[33]=l,e[34]=f):f=e[34];let g;e[35]!==s||e[36]!==o||e[37]!==l?(g=o&&i.jsx(ke,{children:i.jsx(Ne,{logo:o.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>s({kind:"openai-compatible",provider:o,preset:null})})}),e[35]=s,e[36]=o,e[37]=l,e[38]=g):g=e[38];let I;return e[39]!==m||e[40]!==p||e[41]!==u||e[42]!==f||e[43]!==g?(I=i.jsxs("div",{className:m,children:[p,u,f,g]}),e[39]=m,e[40]=p,e[41]=u,e[42]=f,e[43]=g,e[44]=I):I=e[44],I}function Gt(n){return Be({label:xe().optional(),apiKey:xe().min(1,n)})}function Xt(n){const e=U.c(91),{providerId:t,onCancel:s,onSuccess:l}=n,{org:r}=be(),a=we(),c=_e(),[h,d]=$.useState(!1),o=ie();let m;e[0]!==o?(m=We(Gt(o("settings.connectForms.apiKeyRequired"))),e[0]=o,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:g,formState:I}=Ue(u),{errors:S}=I;let y;e[5]!==t||e[6]!==a||e[7]!==o?(y=async se=>{await a.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:se.label||o("settings.connectForms.defaultKeyLabel"),apiKey:se.apiKey})},e[5]=t,e[6]=a,e[7]=o,e[8]=y):y=e[8];let w;e[9]!==l||e[10]!==r||e[11]!==c||e[12]!==o?(w=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(r.id)}),c.invalidateQueries({queryKey:pe.aiProviders(r.id)}),le.success(o("settings.connectForms.keySavedSuccess")),l()},e[9]=l,e[10]=r,e[11]=c,e[12]=o,e[13]=w):w=e[13];let _;e[14]!==o?(_=se=>{le.error(o("settings.connectForms.failedSaveKey",{error:se.message}))},e[14]=o,e[15]=_):_=e[15];let C;e[16]!==y||e[17]!==w||e[18]!==_?(C={mutationFn:y,onSuccess:w,onError:_},e[16]=y,e[17]=w,e[18]=_,e[19]=C):C=e[19];const{mutate:N,isPending:x,error:v}=je(C);let j;e[20]!==N?(j=se=>N(se),e[20]=N,e[21]=j):j=e[21];let M;e[22]!==g||e[23]!==j?(M=g(j),e[22]=g,e[23]=j,e[24]=M):M=e[24];let E;e[25]!==o?(E=o("settings.connectForms.labelField"),e[25]=o,e[26]=E):E=e[26];let R;e[27]!==E?(R=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:E}),e[27]=E,e[28]=R):R=e[28];let A;e[29]!==o?(A=o("settings.connectForms.labelPlaceholder"),e[29]=o,e[30]=A):A=e[30];let b;e[31]!==f?(b=f("label"),e[31]=f,e[32]=b):b=e[32];let k;e[33]!==A||e[34]!==b?(k=i.jsx(fe,{placeholder:A,...b,size:"sm"}),e[33]=A,e[34]=b,e[35]=k):k=e[35];let z;e[36]!==R||e[37]!==k?(z=i.jsxs("div",{className:"space-y-1",children:[R,k]}),e[36]=R,e[37]=k,e[38]=z):z=e[38];let T;e[39]!==o?(T=o("settings.connectForms.apiKeyField"),e[39]=o,e[40]=T):T=e[40];let L;e[41]!==T?(L=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:T}),e[41]=T,e[42]=L):L=e[42];const W=h?"text":"password";let P;e[43]!==f?(P=f("apiKey"),e[43]=f,e[44]=P):P=e[44];let V;e[45]!==W||e[46]!==P?(V=i.jsx(fe,{type:W,placeholder:"sk-...",...P,size:"sm",className:"ph-no-capture pr-8"}),e[45]=W,e[46]=P,e[47]=V):V=e[47];let X;e[48]!==h?(X=()=>d(!h),e[48]=h,e[49]=X):X=e[49];let H;e[50]!==h||e[51]!==o?(H=o(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[50]=h,e[51]=o,e[52]=H):H=e[52];let q;e[53]!==h?(q=h?i.jsx(qe,{size:14}):i.jsx(Ye,{size:14}),e[53]=h,e[54]=q):q=e[54];let Y;e[55]!==X||e[56]!==H||e[57]!==q?(Y=i.jsx("button",{type:"button",onClick:X,"aria-label":H,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:q}),e[55]=X,e[56]=H,e[57]=q,e[58]=Y):Y=e[58];let ee;e[59]!==V||e[60]!==Y?(ee=i.jsxs("div",{className:"relative",children:[V,Y]}),e[59]=V,e[60]=Y,e[61]=ee):ee=e[61];let Q;e[62]!==S.apiKey?(Q=S.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message}),e[62]=S.apiKey,e[63]=Q):Q=e[63];let G;e[64]!==L||e[65]!==ee||e[66]!==Q?(G=i.jsxs("div",{className:"space-y-1",children:[L,ee,Q]}),e[64]=L,e[65]=ee,e[66]=Q,e[67]=G):G=e[67];let Z;e[68]!==v?(Z=v&&i.jsx("p",{className:"text-xs text-destructive",children:v.message}),e[68]=v,e[69]=Z):Z=e[69];let O;e[70]!==o?(O=o("settings.connectForms.cancel"),e[70]=o,e[71]=O):O=e[71];let F;e[72]!==x||e[73]!==s||e[74]!==O?(F=i.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:x,children:O}),e[72]=x,e[73]=s,e[74]=O,e[75]=F):F=e[75];let K;e[76]!==x||e[77]!==o?(K=o(x?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[76]=x,e[77]=o,e[78]=K):K=e[78];let D;e[79]!==x||e[80]!==K?(D=i.jsx(oe,{type:"submit",size:"sm",disabled:x,children:K}),e[79]=x,e[80]=K,e[81]=D):D=e[81];let B;e[82]!==F||e[83]!==D?(B=i.jsxs(Ve,{children:[F,D]}),e[82]=F,e[83]=D,e[84]=B):B=e[84];let te;return e[85]!==M||e[86]!==z||e[87]!==G||e[88]!==Z||e[89]!==B?(te=i.jsxs("form",{onSubmit:M,className:"space-y-3",children:[z,G,Z,B]}),e[85]=M,e[86]=z,e[87]=G,e[88]=Z,e[89]=B,e[90]=te):te=e[90],te}function Jt(n){return Be({label:xe().optional(),baseUrl:xe().min(1,n),apiKey:xe().optional()})}function Zt(n){const e=U.c(109),{preset:t,onCancel:s,onSuccess:l}=n,{org:r}=be(),a=we(),c=_e(),[h,d]=$.useState(!1),o=ie();let m;e[0]!==o?(m=We(Jt(o("settings.connectForms.baseUrlRequired"))),e[0]=o,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:g,handleSubmit:I,formState:S}=Ue(f),{errors:y}=S;let w;e[7]!==t||e[8]!==a?(w=async re=>{const it=JSON.stringify({baseUrl:re.baseUrl,apiKey:re.apiKey||""});await a.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:re.label||t?.name||re.baseUrl,apiKey:it,...t?{presetId:t.id}:{}})},e[7]=t,e[8]=a,e[9]=w):w=e[9];let _;e[10]!==l||e[11]!==r||e[12]!==c||e[13]!==o?(_=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(r.id)}),c.invalidateQueries({queryKey:pe.aiProviders(r.id)}),le.success(o("settings.connectForms.connectionSavedSuccess")),l()},e[10]=l,e[11]=r,e[12]=c,e[13]=o,e[14]=_):_=e[14];let C;e[15]!==o?(C=re=>{le.error(o("settings.connectForms.failedSaveConnection",{error:re.message}))},e[15]=o,e[16]=C):C=e[16];let N;e[17]!==w||e[18]!==_||e[19]!==C?(N={mutationFn:w,onSuccess:_,onError:C},e[17]=w,e[18]=_,e[19]=C,e[20]=N):N=e[20];const{mutate:x,isPending:v,error:j}=je(N);let M;e[21]!==t||e[22]!==o?(M=t?o("settings.connectForms.labelPlaceholderPreset",{name:t.name}):o("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[21]=t,e[22]=o,e[23]=M):M=e[23];const E=M;let R;e[24]!==t?.baseUrlPlaceholder||e[25]!==o?(R=t?.baseUrlPlaceholder??o("settings.connectForms.baseUrlPlaceholder"),e[24]=t?.baseUrlPlaceholder,e[25]=o,e[26]=R):R=e[26];const A=R;let b;e[27]!==x?(b=re=>x(re),e[27]=x,e[28]=b):b=e[28];let k;e[29]!==I||e[30]!==b?(k=I(b),e[29]=I,e[30]=b,e[31]=k):k=e[31];let z;e[32]!==o?(z=o("settings.connectForms.labelField"),e[32]=o,e[33]=z):z=e[33];let T;e[34]!==z?(T=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:z}),e[34]=z,e[35]=T):T=e[35];let L;e[36]!==g?(L=g("label"),e[36]=g,e[37]=L):L=e[37];let W;e[38]!==E||e[39]!==L?(W=i.jsx(fe,{placeholder:E,...L,size:"sm"}),e[38]=E,e[39]=L,e[40]=W):W=e[40];let P;e[41]!==T||e[42]!==W?(P=i.jsxs("div",{className:"space-y-1",children:[T,W]}),e[41]=T,e[42]=W,e[43]=P):P=e[43];let V;e[44]!==A||e[45]!==y||e[46]!==t?.defaultBaseUrl||e[47]!==g||e[48]!==o?(V=t?.defaultBaseUrl?i.jsx("input",{type:"hidden",...g("baseUrl")}):i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:o("settings.connectForms.baseUrlField")}),i.jsx(fe,{type:"url",placeholder:A,...g("baseUrl"),size:"sm"}),y.baseUrl&&i.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[44]=A,e[45]=y,e[46]=t?.defaultBaseUrl,e[47]=g,e[48]=o,e[49]=V):V=e[49];let X;e[50]!==o?(X=o("settings.connectForms.apiKeyField"),e[50]=o,e[51]=X):X=e[51];let H;e[52]!==t?.apiKeyRecommended||e[53]!==o?(H=t?.apiKeyRecommended?o("settings.connectForms.recommended"):o("settings.connectForms.optional"),e[52]=t?.apiKeyRecommended,e[53]=o,e[54]=H):H=e[54];let q;e[55]!==H?(q=i.jsxs("span",{className:"text-muted-foreground/60",children:["(",H,")"]}),e[55]=H,e[56]=q):q=e[56];let Y;e[57]!==X||e[58]!==q?(Y=i.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[X," ",q]}),e[57]=X,e[58]=q,e[59]=Y):Y=e[59];const ee=h?"text":"password";let Q;e[60]!==g?(Q=g("apiKey"),e[60]=g,e[61]=Q):Q=e[61];let G;e[62]!==ee||e[63]!==Q?(G=i.jsx(fe,{type:ee,placeholder:"sk-...",...Q,size:"sm",className:"ph-no-capture pr-8"}),e[62]=ee,e[63]=Q,e[64]=G):G=e[64];let Z;e[65]!==h?(Z=()=>d(!h),e[65]=h,e[66]=Z):Z=e[66];let O;e[67]!==h||e[68]!==o?(O=o(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[67]=h,e[68]=o,e[69]=O):O=e[69];let F;e[70]!==h?(F=h?i.jsx(qe,{size:14}):i.jsx(Ye,{size:14}),e[70]=h,e[71]=F):F=e[71];let K;e[72]!==Z||e[73]!==O||e[74]!==F?(K=i.jsx("button",{type:"button",onClick:Z,"aria-label":O,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[72]=Z,e[73]=O,e[74]=F,e[75]=K):K=e[75];let D;e[76]!==G||e[77]!==K?(D=i.jsxs("div",{className:"relative",children:[G,K]}),e[76]=G,e[77]=K,e[78]=D):D=e[78];let B;e[79]!==Y||e[80]!==D?(B=i.jsxs("div",{className:"space-y-1",children:[Y,D]}),e[79]=Y,e[80]=D,e[81]=B):B=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]!==j?(se=j&&i.jsx("p",{className:"text-xs text-destructive",children:j.message}),e[84]=j,e[85]=se):se=e[85];let ae;e[86]!==o?(ae=o("settings.connectForms.cancel"),e[86]=o,e[87]=ae):ae=e[87];let ce;e[88]!==v||e[89]!==s||e[90]!==ae?(ce=i.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:v,children:ae}),e[88]=v,e[89]=s,e[90]=ae,e[91]=ce):ce=e[91];let de;e[92]!==v||e[93]!==o?(de=o(v?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[92]=v,e[93]=o,e[94]=de):de=e[94];let he;e[95]!==v||e[96]!==de?(he=i.jsx(oe,{type:"submit",size:"sm",disabled:v,children:de}),e[95]=v,e[96]=de,e[97]=he):he=e[97];let ue;e[98]!==ce||e[99]!==he?(ue=i.jsxs(Ve,{children:[ce,he]}),e[98]=ce,e[99]=he,e[100]=ue):ue=e[100];let ye;return e[101]!==k||e[102]!==P||e[103]!==V||e[104]!==B||e[105]!==te||e[106]!==se||e[107]!==ue?(ye=i.jsxs("form",{onSubmit:k,className:"space-y-3",children:[P,V,B,te,se,ue]}),e[101]=k,e[102]=P,e[103]=V,e[104]=B,e[105]=te,e[106]=se,e[107]=ue,e[108]=ye):ye=e[108],ye}const es={kind:"closed"};function ts(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 ss(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function is({open:n,onOpenChange:e,initialProvider:t}){const s=ie(),r=Ie()?.providers??[],{org:a}=be(),c=we(),h=_e(),[d,o]=$.useReducer(ts,es),m=$.useRef(!1);$.useEffect(()=>{n&&d.kind==="closed"?o({type:"open"}):!n&&d.kind!=="closed"&&o({type:"close"})},[n,d.kind]);const p=()=>{m.current=!1,o({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:pe.aiProviderKeys(a.id)}),h.invalidateQueries({queryKey:pe.aiProviders(a.id)})},{mutate:f}=je({mutationFn:async({providerId:b,code:k,stateToken:z,label:T})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:b,code:k,stateToken:z,label:T}),b),onSuccess:b=>{ne("ai_provider_oauth_succeeded",{provider_id:b}),u();const k=r.find(z=>z.id===b);le.success(s("settings.connectProviderDialog.oauthSuccessMessage",{provider:k?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(b,k)=>{ne("ai_provider_oauth_failed",{provider_id:k.providerId,error:b.message}),le.error(s("settings.connectProviderDialog.oauthFailedMessage",{error:b.message})),o({type:"oauth-failed"})}}),{mutate:g}=je({mutationFn:async b=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:b}),b),onSuccess:b=>{ne("ai_provider_provision_succeeded",{provider_id:b}),u();const k=r.find(z=>z.id===b);le.success(s("settings.connectProviderDialog.provisionSuccessMessage",{provider:k?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(b,k)=>{ne("ai_provider_provision_failed",{provider_id:k,error:b.message}),o({type:"provision-error",error:b.message})}}),I=async b=>{const{provider:k}=b,z=b.kind==="openai-compatible"?b.preset?.id??null:null,T=k.supportedMethods.includes("oauth-pkce"),L=k.supportedMethods.includes("api-key");if(k.supportsProvision===!0){ne("ai_provider_connect_clicked",{provider_id:k.id,method:"provision"}),o({type:"select-provision",providerId:k.id}),g(k.id);return}if(T){ne("ai_provider_connect_clicked",{provider_id:k.id,method:"oauth-pkce"});try{const P=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:k.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!P?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");o({type:"select-oauth",providerId:k.id,stateToken:P.stateToken}),window.open(P.url,"AiProviderOAuth","width=600,height=700")}catch(P){le.error(s("settings.connectProviderDialog.startOAuthFailedMessage",{error:P instanceof Error?P.message:String(P)}))}return}L&&(ne("ai_provider_connect_clicked",{provider_id:k.id,...z!==null?{preset_id:z}:{},method:"api-key"}),o({type:"select-form",providerId:k.id,presetId:z}))},S=$.useRef(I);S.current=I;const y=$.useRef(t);y.current=t,$.useEffect(()=>{!y.current||d.kind!=="grid"||m.current||(m.current=!0,S.current(y.current))},[d.kind]);const w=d.kind==="oauth-pending"?d.stateToken:null,_=d.kind==="oauth-pending"?d.providerId:null;$.useEffect(()=>{if(d.kind!=="oauth-pending")return;let b=!1;const k=d.stateToken,z=d.providerId,T=W=>{if(W.origin!==window.location.origin||W.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:P,stateToken:V}=W.data;if(V!==k){le.error(s("settings.connectProviderDialog.securityCheckFailedMessage")),o({type:"oauth-failed"});return}b=!0;const X=r.find(H=>H.id===z);f({providerId:z,code:P,stateToken:k,label:X?.name??z})};window.addEventListener("message",T);const L=setTimeout(()=>{b||(ne("ai_provider_oauth_timeout",{provider_id:z}),o({type:"oauth-failed"}),le.error(s("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",T),clearTimeout(L)}},[d.kind,w,_,f]);const[C,N]=$.useState(d);d.kind!=="closed"&&d!==C&&N(d);const x=d.kind==="closed"?C:d,v=ss(x),j=v?r.find(b=>b.id===v):null,E=(x.kind==="form"&&x.presetId?ve(x.presetId):null)?.name??j?.name??s("settings.connectProviderDialog.defaultTitle"),R=x.kind!=="grid"&&x.kind!=="closed",A=()=>{t?p():o({type:"back"})};return i.jsx(ot,{open:d.kind!=="closed",onOpenChange:b=>!b&&p(),children:i.jsxs(at,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsx(ct,{children:i.jsxs("div",{className:"flex items-center gap-2",children:[R&&i.jsx(oe,{variant:"ghost",size:"icon-sm","aria-label":s("settings.connectProviderDialog.backButtonLabel"),onClick:A,children:i.jsx(He,{size:16})}),i.jsx(dt,{children:E})]})}),x.kind==="grid"&&!t&&i.jsx(Xe,{providers:r,onSelect:I}),x.kind==="form"&&(x.providerId==="openai-compatible"?i.jsx(Zt,{preset:x.presetId?ve(x.presetId):void 0,onCancel:()=>o({type:"back"}),onSuccess:()=>{u(),p()}}):i.jsx(Xt,{providerId:x.providerId,onCancel:()=>o({type:"back"}),onSuccess:()=>{u(),p()}})),x.kind==="oauth-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Oe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground text-center",children:s("settings.connectProviderDialog.oauthPendingMessage")})]}),x.kind==="provision-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Oe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:s("settings.connectProviderDialog.provisionPendingMessage")})]}),x.kind==="provision-error"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[i.jsx(At,{size:28,className:"text-destructive"}),i.jsx("p",{className:"text-sm text-foreground text-center",children:x.error}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(oe,{variant:"outline",size:"sm",onClick:()=>o({type:"back"}),children:s("settings.connectProviderDialog.backButton")}),i.jsx(oe,{size:"sm",onClick:()=>{o({type:"retry-provision"}),g(x.providerId)},children:s("settings.connectProviderDialog.retryButton")})]})]})]})})}function ns(n){const e=U.c(35);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:s,description:l,providerFilter:r}=t,a=ie(),{org:c}=be(),[h,d]=$.useState(null),o=Ie();let m;e[2]!==o?.providers?(m=o?.providers??[],e[2]=o?.providers,e[3]=m):m=e[3];let p;if(e[4]!==r||e[5]!==m){let b;e[7]!==r?(b=k=>!r||r(k.id),e[7]=r,e[8]=b):b=e[8],p=m.filter(b),e[4]=r,e[5]=m,e[6]=p}else p=e[6];const u=p,f=c.name;let g;e[9]!==f||e[10]!==a||e[11]!==s?(g=s??(f?a("chat.noAiProviderEmptyState.headingWithOrg",{org:f}):a("chat.noAiProviderEmptyState.headingDefault")),e[9]=f,e[10]=a,e[11]=s,e[12]=g):g=e[12];const I=g;let S;e[13]!==l||e[14]!==a?(S=l??a("chat.noAiProviderEmptyState.subtitleDefault"),e[13]=l,e[14]=a,e[15]=S):S=e[15];const y=S;let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx("div",{className:"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border",children:i.jsx(Pt,{size:24,className:"text-muted-foreground"})}),e[16]=w):w=e[16];let _;e[17]!==I?(_=i.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:I}),e[17]=I,e[18]=_):_=e[18];let C;e[19]!==y?(C=i.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:y}),e[19]=y,e[20]=C):C=e[20];let N;e[21]!==_||e[22]!==C?(N=i.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[w,i.jsxs("div",{className:"space-y-2",children:[_,C]})]}),e[21]=_,e[22]=C,e[23]=N):N=e[23];let x;e[24]===Symbol.for("react.memo_cache_sentinel")?(x=b=>d(b),e[24]=x):x=e[24];let v;e[25]!==u?(v=i.jsx("div",{className:"w-full",children:i.jsx(Xe,{providers:u,onSelect:x})}),e[25]=u,e[26]=v):v=e[26];const j=h!==null;let M;e[27]===Symbol.for("react.memo_cache_sentinel")?(M=b=>{b||d(null)},e[27]=M):M=e[27];const E=h??void 0;let R;e[28]!==j||e[29]!==E?(R=i.jsx(is,{open:j,onOpenChange:M,initialProvider:E}),e[28]=j,e[29]=E,e[30]=R):R=e[30];let A;return e[31]!==v||e[32]!==R||e[33]!==N?(A=i.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[N,v,R]}),e[31]=v,e[32]=R,e[33]=N,e[34]=A):A=e[34],A}function Me(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 ls(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 rs=["bg-destructive","bg-warning","bg-success","bg-success"],os=["text-success","text-warning","text-warning","text-destructive"];function as(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 cs(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 ds={text:{icon:i.jsx(_t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:i.jsx(wt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:i.jsx(kt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:i.jsx(Nt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:i.jsx(St,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:i.jsx(Qe,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function hs(n){const e=U.c(10),{capability:t}=n,s=ie(),l=ds[t];if(l){const h=l.icon;let d;e[0]!==l.labelKey||e[1]!==s?(d=s(l.labelKey),e[0]=l.labelKey,e[1]=s,e[2]=d):d=e[2];let o;return e[3]!==l.icon||e[4]!==d?(o=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]=l.icon,e[4]=d,e[5]=o):o=e[5],o}let r;e[6]!==t?(r=t.charAt(0).toUpperCase(),e[6]=t,e[7]=r):r=e[7];const a=r+t.slice(1);let c;return e[8]!==a?(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:a}),e[8]=a,e[9]=c):c=e[9],c}function us(n){const e=U.c(59),{model:t,compact:s}=n,l=s===void 0?!1:s,r=ie();if(!t){let x;e[0]!==r?(x=r("chat.shared.hoverToPreview"),e[0]=r,e[1]=x):x=e[1];let v;return e[2]!==x?(v=i.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=v):v=e[3],v}const a=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=Me(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:o}=h;if(l){let x;e[6]!==t.limits||e[7]!==r?(x=t.limits?.contextWindow&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:r("chat.shared.context")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",r("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=r,e[8]=x):x=e[8];let v;e[9]!==a||e[10]!==r?(v=a!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:r("chat.shared.input")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",a.toFixed(2)," / 1M"]})]}),e[9]=a,e[10]=r,e[11]=v):v=e[11];let j;e[12]!==c||e[13]!==r?(j=c!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:r("chat.shared.output")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=r,e[14]=j):j=e[14];let M;e[15]!==t.limits||e[16]!==r?(M=t.limits?.maxOutputTokens&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:r("chat.shared.outputLimit")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",r("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=r,e[17]=M):M=e[17];let E;return e[18]!==x||e[19]!==v||e[20]!==j||e[21]!==M?(E=i.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,v,j,M]}),e[18]=x,e[19]=v,e[20]=j,e[21]=M,e[22]=E):E=e[22],E}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]!==o?(u=i.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:o}),e[28]=o,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 g;e[33]!==t.modelId?(g=i.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=g):g=e[34];let I;e[35]!==m||e[36]!==f||e[37]!==g?(I=i.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,f,g]}),e[35]=m,e[36]=f,e[37]=g,e[38]=I):I=e[38];let S;e[39]!==t.capabilities?(S=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(ms)}),e[39]=t.capabilities,e[40]=S):S=e[40];let y;e[41]!==t.limits||e[42]!==r?(y=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:v,descriptionKey:j}=ls(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:r("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:ge("w-2 h-2 rounded-full",M<=x?rs[x-1]:"bg-muted")},M))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:r(v)}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",r(j)]})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",r("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=r,e[43]=y):y=e[43];let w;e[44]!==t.limits||e[45]!==r?(w=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:r("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()," ",r("chat.shared.tokens")]}),i.jsx("span",{className:"text-sm text-muted-foreground",children:as(t.limits.maxOutputTokens,r)})]})]}),e[44]=t.limits,e[45]=r,e[46]=w):w=e[46];let _;e[47]!==a||e[48]!==c||e[49]!==r?(_=(a!=null||c!=null)&&(()=>{const{level:x,labelKey:v}=a!=null?cs(a):{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:r("chat.shared.pricing")}),a!=null&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(j=>i.jsx("span",{className:ge("text-sm font-semibold leading-none",j<=x?os[x-1]:"text-muted-foreground/20"),children:"$"},j))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:v?r(v):""})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[a!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:r("chat.shared.input")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",a.toFixed(2)," / 1M"," ",r("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:r("chat.shared.output")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",r("chat.shared.tokens")]})]})]})]})})(),e[47]=a,e[48]=c,e[49]=r,e[50]=_):_=e[50];let C;e[51]!==y||e[52]!==w||e[53]!==_?(C=i.jsxs("div",{className:"flex flex-col gap-6",children:[y,w,_]}),e[51]=y,e[52]=w,e[53]=_,e[54]=C):C=e[54];let N;return e[55]!==C||e[56]!==I||e[57]!==S?(N=i.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[I,S,C]}),e[55]=C,e[56]=I,e[57]=S,e[58]=N):N=e[58],N}function ms(n){return i.jsx(hs,{capability:n},n)}function si(n){const e=U.c(22),{model:t,placeholder:s,isLoading:l}=n,r=l===void 0?!1:l,a=ie();let c;e[0]!==s||e[1]!==a?(c=s??a("chat.shared.selectModel"),e[0]=s,e[1]=a,e[2]=c):c=e[2];const h=c;if(r){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(J,{className:"w-5 h-5 rounded-sm shrink-0"}),i.jsx(J,{className:"w-16 h-3 hidden md:block"})]}),e[3]=S):S=e[3],S}if(!t){let S;e[4]!==h?(S=i.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=S):S=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=y):y=e[6];let w;return e[7]!==S?(w=i.jsxs("div",{className:"flex items-center gap-1.5",children:[S,y]}),e[7]=S,e[8]=w):w=e[8],w}let d;e[9]!==t?(d=Me(t),e[9]=t,e[10]=d):d=e[10];const{displayName:o}=d;let m;e[11]!==t?(m=Ce(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]!==o?(f=i.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:o}),e[16]=o,e[17]=f):f=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=g):g=e[18];let I;return e[19]!==u||e[20]!==f?(I=i.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,f,g]}),e[19]=u,e[20]=f,e[21]=I):I=e[21],I}const fs=["vision","image","file","audio","video"],Je=["image/png","image/jpeg","image/gif","image/webp"],Ze=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Ee(n){const e=n?.capabilities;return e?fs.some(t=>e.includes(t)):!1}function ii(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],s=t.includes("vision")||t.includes("image"),l=t.includes("file"),r=t.includes("audio"),a=t.includes("video");return!!(s&&Je.includes(n)||l&&n==="application/pdf"||r&&n.startsWith("audio/")||a&&n.startsWith("video/")||Ee(e)&&Ze.includes(n))}function ni(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...Je),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Ee(n)&&t.push(...Ze),t.join(",")}function li(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"),Ee(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const et=["smarter","faster","cheaper"],ps={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},xs=[{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"]}],gs=xs.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),vs="google/gemini-2.5-pro",Le=new Map;function bs(n){const e=Le.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:s,prefix:l}of gs)if(n.startsWith(l)){if(l===vs&&n.length>l.length&&n[l.length]==="-"){const a=n[l.length+1];if(!a||!/\d/.test(a))continue}t=s;break}return Le.set(n,t),t}function ys(n,e,t){if(t)return n;const s=n.filter(l=>e.has(l.modelId));return s.length>0?s:n}function De(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const s=bs(t.modelId);e[s??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((s,l)=>s.title.localeCompare(l.title));return e}const tt="studio:model-shortlist:",js=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 Ss(n){try{const e=localStorage.getItem(tt+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Ns(n,e){localStorage.setItem(tt+n,JSON.stringify([...e]))}function ks(n){const e=U.c(21),{model:t,onHover:s}=n;let l;e[0]!==t?(l=Me(t),e[0]=t,e[1]=l):l=e[1];const{displayName:r,provider:a}=l;let c;e[2]!==t?(c=Ce(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 o;e[7]!==t.title||e[8]!==h?(o=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]=o):o=e[9];let m;e[10]!==r?(m=i.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:r}),e[10]=r,e[11]=m):m=e[11];let p;e[12]!==a?(p=i.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:a}),e[12]=a,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]!==o||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:[o,u]}),e[17]=d,e[18]=o,e[19]=u,e[20]=f):f=e[20],f}function ws(n){const e=U.c(16),{error:t,onRetry:s}=n,l=ie();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:i.jsx(mt,{className:"size-5 text-destructive"})}),e[0]=r):r=e[0];const a=l("chat.decopilot.failedToLoadModels");let c;e[1]!==a?(c=i.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e[1]=a,e[2]=c):c=e[2];const h=t?.message||l("chat.decopilot.couldNotFetchModels"),d=" "+l("chat.decopilot.tryAnotherProviderOrRetry");let o;e[3]!==h||e[4]!==d?(o=i.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=o):o=e[5];let m;e[6]!==c||e[7]!==o?(m=i.jsxs("div",{className:"flex flex-col gap-1",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Ct,{className:"size-3.5"}),e[9]=p):p=e[9];const u=l("chat.decopilot.retry");let f;e[10]!==s||e[11]!==u?(f=i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs(oe,{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 g;return e[13]!==f||e[14]!==m?(g=i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[r,m,f]}),e[13]=f,e[14]=m,e[15]=g):g=e[15],g}function _s(){const n=U.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(Is)}),n[0]=e):e=n[0],e}function Is(n,e){return i.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[i.jsx(J,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(J,{className:"flex-1 h-4"}),i.jsx(J,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function $e(n){const e=U.c(12),{label:t,models:s,onSelect:l,onHover:r}=n;if(s.length===0)return null;let a;e[0]!==t?(a=i.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=a):a=e[1];let c;if(e[2]!==s||e[3]!==r||e[4]!==l){let d;e[6]!==r||e[7]!==l?(d=o=>i.jsx("button",{type:"button",onClick:()=>l(o),onFocus:()=>r(o),className:"w-full text-left cursor-pointer",children:i.jsx(ks,{model:o,onHover:r})},o.modelId),e[6]=r,e[7]=l,e[8]=d):d=e[8],c=s.map(d),e[2]=s,e[3]=r,e[4]=l,e[5]=c}else c=e[5];let h;return e[9]!==a||e[10]!==c?(h=i.jsxs("div",{children:[a,c]}),e[9]=a,e[10]=c,e[11]=h):h=e[11],h}function Se(n,e){return e(n==="other"?"chat.decopilot.tierOther":ps[n])}function Cs(n){const e=U.c(21),{model:t,isChecked:s,onToggle:l,onHover:r}=n,[a,c]=$.useState(s);a!==s&&c(s);let h;e[0]!==t?(h=Ce(t),e[0]=t,e[1]=h):h=e[1];const d=h;let o;e[2]!==t||e[3]!==r?(o=()=>r(t),e[2]=t,e[3]=r,e[4]=o):o=e[4];let m;e[5]!==t.modelId||e[6]!==l?(m=()=>{c(Ms),l(t.modelId)},e[5]=t.modelId,e[6]=l,e[7]=m):m=e[7];let p;e[8]!==a||e[9]!==m?(p=i.jsx(ft,{checked:a,onCheckedChange:m}),e[8]=a,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 g;return e[16]!==o||e[17]!==p||e[18]!==u||e[19]!==f?(g=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:o,children:[p,u,f]}),e[16]=o,e[17]=p,e[18]=u,e[19]=f,e[20]=g):g=e[20],g}function Ms(n){return!n}function Es(n,e){const t=[];for(const s of et)if(n[s].length>0){t.push({type:"header",label:Se(s,e)});for(const l of n[s])t.push({type:"model",model:l})}if(n.other.length>0){t.push({type:"header",label:Se("other",e)});for(const s of n.other)t.push({type:"model",model:s})}return t}function Os({items:n,shortlistSet:e,onToggle:t,onHover:s}){const l=$.useRef(null),r=qt({count:n.length,getScrollElement:()=>l.current,estimateSize:a=>n[a]?.type==="header"?36:44,overscan:6});return i.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"relative",style:{height:r.getTotalSize()},children:r.getVirtualItems().map(a=>{const c=n[a.index];return c?i.jsx("div",{"data-index":a.index,ref:r.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${a.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(Cs,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:s})},a.key):null})})})}function zs(n){const e=U.c(28),{keyId:t,searchTerm:s,onHover:l,onModelSelect:r,managing:a,onToggleManage:c,filterModels:h}=n,d=ie(),{models:o}=Et(t),m=h?o.filter(h):o.filter(Ot);let p;e[0]!==t?(p=()=>(t?Ss(t):null)??js,e[0]=t,e[1]=p):p=e[1];const[u,f]=$.useState(p),[,g]=$.useTransition();let I;e[2]!==t||e[3]!==g?(I=j=>{t&&g(()=>{f(M=>{const E=new Set(M);return E.has(j)?E.delete(j):E.add(j),Ns(t,E),E})})},e[2]=t,e[3]=g,e[4]=I):I=e[4];const S=I,y=s.toLowerCase().trim(),w=j=>y?j.filter(M=>M.title.toLowerCase().includes(y)||M.modelId.toLowerCase().includes(y)):j;if(a){const j=De(w(m)),M=Es(j,d);let E;e[5]!==u?(E=z=>u.has(z.modelId),e[5]=u,e[6]=E):E=e[6];const R=m.filter(E).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(He,{size:14}),e[7]=A):A=e[7];let b;e[8]!==d?(b=d("chat.decopilot.back"),e[8]=d,e[9]=b):b=e[9];let k;return e[10]!==c||e[11]!==b?(k=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:[A,b]}),e[10]=c,e[11]=b,e[12]=k):k=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:[k,i.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:R})})]}),i.jsx(Os,{items:M,shortlistSet:u,onToggle:S,onHover:l})]})}const _=De(w(ys(m,u,y)));let C;e[13]!==_||e[14]!==l||e[15]!==r||e[16]!==d?(C=et.map(j=>i.jsx($e,{label:Se(j,d),models:_[j],onSelect:r,onHover:l},j)),e[13]=_,e[14]=l,e[15]=r,e[16]=d,e[17]=C):C=e[17];let N;e[18]!==d?(N=Se("other",d),e[18]=d,e[19]=N):N=e[19];let x;e[20]!==_.other||e[21]!==l||e[22]!==r||e[23]!==N?(x=i.jsx($e,{label:N,models:_.other,onSelect:r,onHover:l}),e[20]=_.other,e[21]=l,e[22]=r,e[23]=N,e[24]=x):x=e[24];let v;return e[25]!==C||e[26]!==x?(v=i.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[C,x]}),e[25]=C,e[26]=x,e[27]=v):v=e[27],v}function ri(){const n=U.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(J,{className:"size-4 shrink-0"}),i.jsx(J,{className:"flex-1 h-6"}),i.jsx(J,{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(Ps)})]}),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(J,{className:"size-6 shrink-0"}),i.jsx(J,{className:"h-6 w-32"})]}),n[2]=s):s=n[2];let l;n[3]===Symbol.for("react.memo_cache_sentinel")?(l=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(J,{className:"h-6 w-20 rounded-md"}),i.jsx(J,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=l):l=n[3];let r;n[4]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(J,{className:"h-4 w-24"}),i.jsx(J,{className:"h-4 w-32"})]}),n[4]=r):r=n[4];let a;return n[5]===Symbol.for("react.memo_cache_sentinel")?(a=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:[l,i.jsxs("div",{className:"flex flex-col gap-4",children:[r,i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(J,{className:"h-4 w-16"}),i.jsx(J,{className:"h-4 w-40"})]})]})]})})]}),n[5]=a):a=n[5],a}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(J,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(J,{className:"flex-1 h-4"}),i.jsx(J,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function st(n){const e=U.c(66),{onClose:t,credentialId:s,onCredentialChange:l,selectedModel:r,onModelChange:a,filterModels:c,compact:h}=n,d=ie(),[o,m]=$.useState(null),[p,u]=$.useState(""),[f,g]=$.useState(!1),I=Ie(),S=Mt();let y;e[0]!==I?.providers?(y=Object.fromEntries((I?.providers??[]).map(Ts)),e[0]=I?.providers,e[1]=y):y=e[1];const w=y,_=ht(),{org:C}=be();let N;e[2]!==l?(N=O=>{l(O),m(null)},e[2]=l,e[3]=N):N=e[3];const x=N;let v;e[4]!==s||e[5]!==t||e[6]!==a?(v=O=>{s&&(a(O),u(""),t())},e[4]=s,e[5]=t,e[6]=a,e[7]=v):v=e[7];const j=v;if(S.length===0){const O=!h&&"sm:w-[740px]";let F;e[8]!==O?(F=ge("flex items-center justify-center p-8 w-full",O),e[8]=O,e[9]=F):F=e[9];let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx(ns,{}),e[10]=K):K=e[10];let D;return e[11]!==F?(D=i.jsx("div",{className:F,children:K}),e[11]=F,e[12]=D):D=e[12],D}const M=h?"sm:h-[420px]":"sm:h-[460px]";let E;e[13]!==M?(E=ge("flex flex-col md:flex-row h-full min-h-0",M),e[13]=M,e[14]=E):E=e[14];const R=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let A;e[15]!==R?(A=ge("flex-1 flex flex-col min-h-0 overflow-hidden",R),e[15]=R,e[16]=A):A=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(Qe,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=b):b=e[17];let k;e[18]!==f||e[19]!==d?(k=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=k):k=e[20];let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=O=>u(O.target.value),e[21]=z):z=e[21];let T;e[22]!==p||e[23]!==k?(T=i.jsx(fe,{autoFocus:!0,type:"text",placeholder:k,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]=k,e[24]=T):T=e[24];let L;e[25]!==s||e[26]!==x||e[27]!==S||e[28]!==w||e[29]!==d?(L=S.length>0&&i.jsxs(pt,{value:s??"",onValueChange:x,children:[i.jsxs(xt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Fs,children:[i.jsx(gt,{placeholder:d("chat.decopilot.key"),children:(()=>{const O=S.find(te=>te.id===s),F=O?w[O.providerId]:void 0,K=ve(O?.presetId),D=K?.logo??F?.logo,B=K?.name??F?.name??O?.providerId??"Key";return i.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[D?i.jsx("img",{src:D,alt:B,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:B.slice(0,1).toUpperCase()}),i.jsx("span",{className:"text-xs truncate",children:B})]})})()}),i.jsx(yt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),i.jsx(vt,{children:S.map(O=>{const F=w[O.providerId],K=ve(O.presetId),D=K?.logo??F?.logo,B=K?.name??F?.name??O.providerId;return i.jsx(bt,{value:O.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[D?i.jsx("img",{src:D,alt:B,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:B.slice(0,1).toUpperCase()}),i.jsxs("span",{children:[B," — ",O.label]})]})},O.id)})})]}),e[25]=s,e[26]=x,e[27]=S,e[28]=w,e[29]=d,e[30]=L):L=e[30];let W;e[31]!==T||e[32]!==L?(W=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:[b,T,L]})}),e[31]=T,e[32]=L,e[33]=W):W=e[33];let P;e[34]!==s?(P=O=>{const{error:F,resetError:K}=O;return i.jsx(ws,{error:F,onRetry:K,credentialId:s??void 0})},e[34]=s,e[35]=P):P=e[35];let V;e[36]===Symbol.for("react.memo_cache_sentinel")?(V=i.jsx(_s,{}),e[36]=V):V=e[36];const X=s??void 0;let H;e[37]===Symbol.for("react.memo_cache_sentinel")?(H=()=>g(As),e[37]=H):H=e[37];let q;e[38]!==c||e[39]!==j||e[40]!==f||e[41]!==p||e[42]!==X?(q=i.jsx($.Suspense,{fallback:V,children:i.jsx(zs,{keyId:X,searchTerm:p,onHover:m,onModelSelect:j,managing:f,onToggleManage:H,filterModels:c})}),e[38]=c,e[39]=j,e[40]=f,e[41]=p,e[42]=X,e[43]=q):q=e[43];let Y;e[44]!==s||e[45]!==P||e[46]!==q?(Y=i.jsx(ut,{fallback:P,children:q},s),e[44]=s,e[45]=P,e[46]=q,e[47]=Y):Y=e[47];let ee;e[48]!==f||e[49]!==_||e[50]!==C||e[51]!==d?(ee=!f&&i.jsxs("div",{className:"border-t border-border flex",children:[i.jsxs("button",{type:"button",onClick:()=>$.startTransition(()=>g(!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(It,{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:()=>_({to:"/$org/settings/ai-providers",params:{org:C.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(jt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=_,e[50]=C,e[51]=d,e[52]=ee):ee=e[52];let Q;e[53]!==W||e[54]!==Y||e[55]!==ee||e[56]!==A?(Q=i.jsxs("div",{className:A,children:[W,Y,ee]}),e[53]=W,e[54]=Y,e[55]=ee,e[56]=A,e[57]=Q):Q=e[57];let G;e[58]!==h||e[59]!==o||e[60]!==r?(G=!h&&i.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:i.jsx(us,{model:o??r??null})}),e[58]=h,e[59]=o,e[60]=r,e[61]=G):G=e[61];let Z;return e[62]!==Q||e[63]!==G||e[64]!==E?(Z=i.jsxs("div",{className:E,children:[Q,G]}),e[62]=Q,e[63]=G,e[64]=E,e[65]=Z):Z=e[65],Z}function As(n){return!n}function Fs(n){return n.stopPropagation()}function Ts(n){return[n.id,n]}function Rs(n){const e=U.c(12),{onClose:t}=n,{credentialId:s,setCredentialId:l,selectedModel:r,setModel:a}=zt();let c;e[0]!==l?(c=o=>{ne("chat_credential_changed",{credential_id:o}),l(o)},e[0]=l,e[1]=c):c=e[1];let h;e[2]!==s||e[3]!==r?.modelId||e[4]!==a?(h=o=>{s&&(ne("chat_model_changed",{from_model_id:r?.modelId??null,to_model_id:o.modelId,to_model_provider:o.providerId??null,credential_id:s}),a({...o,keyId:s}))},e[2]=s,e[3]=r?.modelId,e[4]=a,e[5]=h):h=e[5];let d;return e[6]!==s||e[7]!==t||e[8]!==r||e[9]!==c||e[10]!==h?(d=i.jsx(st,{onClose:t,credentialId:s,onCredentialChange:c,selectedModel:r,onModelChange:h}),e[6]=s,e[7]=t,e[8]=r,e[9]=c,e[10]=h,e[11]=d):d=e[11],d}function Ks(n){const e=U.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Rs,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function Ls(n){const e=U.c(2);let t;return e[0]!==n?(t=i.jsx(st,{...n}),e[0]=n,e[1]=t):t=e[1],t}function oi(n){const e=U.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Ks,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function ai(n){const e=U.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(Ls,{...t}),e[2]=t,e[3]=s):s=e[3],s}export{is as C,ai as M,ns as N,Xe as P,si as S,ri as a,li as b,oi as c,ni as g,ii as i,Ee as m};