decocms 4.584.8 → 4.584.9

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 (428) hide show
  1. package/dist/client/assets/{AlertCircle-BFB3gUiV.js → AlertCircle-Di8a-UWV.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CtLlhOXD.js → AreaChart-CCqrcx1b.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-COkdcH40.js → ArrowLeft-B2F854r0.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-C8DC__KS.js → ArrowRight-Dj2pC8B7.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DxQTcOKq.js → ArrowUp-Nhgapjwm.js} +1 -1
  6. package/dist/client/assets/{BookOpen01-CeeutiP7.js → BookOpen01-CHggQBWj.js} +1 -1
  7. package/dist/client/assets/{CartesianChart-CiiHjD5L.js → CartesianChart-BFVggI3G.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-8F960gzG.js → CategoricalChart-BYLFXXdR.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-1_ngPRl0.js → CheckCircle-UAsyLWI7.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-DtfpNfYi.js → ChevronDown-COkNoLwk.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-l40jkbdg.js → ChevronSelectorVertical-Buxlf1yx.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-CBIKlFGV.js → ChevronUp-C-YGqatN.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-WHBJntMv.js → CreditCard01-CRi7On3u.js} +1 -1
  14. package/dist/client/assets/{Eye-DWY2fSAh.js → Eye-C6rTinUa.js} +1 -1
  15. package/dist/client/assets/{File02-BRT-Ew93.js → File02-CNdUOOeH.js} +1 -1
  16. package/dist/client/assets/{Globe04-B3fhAFqq.js → Globe04-AW14Waq3.js} +1 -1
  17. package/dist/client/assets/{Image01-DMG8Qkz6.js → Image01-xPHq6tUP.js} +1 -1
  18. package/dist/client/assets/{Key01-Ay1sjQwx.js → Key01-BMD-TEa8.js} +1 -1
  19. package/dist/client/assets/{LayoutLeft-DcQL0isk.js → LayoutLeft-5PR-LA5J.js} +1 -1
  20. package/dist/client/assets/{LinkBroken01-DPGpUNPc.js → LinkBroken01-Chn3Zw95.js} +1 -1
  21. package/dist/client/assets/{MessageCircle01-CSCCnWCH.js → MessageCircle01-CeeL61Zn.js} +1 -1
  22. package/dist/client/assets/{Minus-5A9Ep-MV.js → Minus-CxmZj9NQ.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DfRrojp6.js → Monitor01-BNRBENLp.js} +1 -1
  24. package/dist/client/assets/{Play-CdyPk_4c.js → Play-DEfGDCy-.js} +1 -1
  25. package/dist/client/assets/{Plus-CqQu5mgz.js → Plus-C2jbSKfe.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-B1WAFRZT.js → ReferenceLine-D9-8u9ny.js} +1 -1
  27. package/dist/client/assets/{SearchMd-C4Y8JUHD.js → SearchMd-DIZIcq-T.js} +1 -1
  28. package/dist/client/assets/{ShoppingBag01-gV23Gp7o.js → ShoppingBag01-CVfO_hCG.js} +1 -1
  29. package/dist/client/assets/{Sun-DwP6zl8a.js → Sun-CPfe1reh.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-BhqLp2b4.js → SwitchHorizontal01-CFbhgx88.js} +1 -1
  31. package/dist/client/assets/{Tool01-CHVyNhSa.js → Tool01-BIyGNKrn.js} +1 -1
  32. package/dist/client/assets/{Tooltip-BIpYDBqK.js → Tooltip-MqN6JJnW.js} +1 -1
  33. package/dist/client/assets/{Trash01-5lm3icl_.js → Trash01-D20QdwlW.js} +1 -1
  34. package/dist/client/assets/{TrendUp01-BMksza7F.js → TrendUp01-yJId_zlL.js} +1 -1
  35. package/dist/client/assets/{Upload01-CCxJ0UkL.js → Upload01-C9Bt1TSM.js} +1 -1
  36. package/dist/client/assets/{UserCheck01-zn64v-Hm.js → UserCheck01-BNqLXBfG.js} +1 -1
  37. package/dist/client/assets/{UserSquare-CS1IJ6qv.js → UserSquare-BJ8rQzrf.js} +1 -1
  38. package/dist/client/assets/{Users01-Bh3HzgRt.js → Users01-BF_7Ge84.js} +1 -1
  39. package/dist/client/assets/{XClose-BxDeuAmz.js → XClose-BeMmbmRj.js} +1 -1
  40. package/dist/client/assets/{Zap-5QmdSYw7.js → Zap-DnTlLwWn.js} +1 -1
  41. package/dist/client/assets/{access-gate-0Jmj2nnF.js → access-gate-ys146buF.js} +1 -1
  42. package/dist/client/assets/{add-connection-dialog-BZuOUiYS.js → add-connection-dialog-BzuPzzcP.js} +1 -1
  43. package/dist/client/assets/agent-app-BplGduEL.js +1 -0
  44. package/dist/client/assets/{agent-assets-D326Iw76.js → agent-assets-CriTGOWU.js} +1 -1
  45. package/dist/client/assets/{agent-automation-Zq1iQa6E.js → agent-automation-CikOpkf1.js} +1 -1
  46. package/dist/client/assets/{agent-automations-h2xseLzk.js → agent-automations-Bgf1jQrh.js} +1 -1
  47. package/dist/client/assets/{agent-blog-CqbruziI.js → agent-blog-F5KTJKh9.js} +2 -2
  48. package/dist/client/assets/{agent-blog-post-Ddh1HYdV.js → agent-blog-post-OFgpigIS.js} +2 -2
  49. package/dist/client/assets/{agent-calendar-BnRSyoH6.js → agent-calendar-Dj_CPqBD.js} +1 -1
  50. package/dist/client/assets/{agent-capabilities-0q_PEaRd.js → agent-capabilities-nLnawz8n.js} +1 -1
  51. package/dist/client/assets/{agent-connect-sources-BdQWUfVh.js → agent-connect-sources-GVrze9Tn.js} +1 -1
  52. package/dist/client/assets/agent-deck-DcBq-EFc.js +1 -0
  53. package/dist/client/assets/{agent-e2e-Cq5tFrN7.js → agent-e2e-t_AgarMy.js} +1 -1
  54. package/dist/client/assets/agent-experiments-Db41C8mK.js +1 -0
  55. package/dist/client/assets/agent-file-CCf39Rtq.js +1 -0
  56. package/dist/client/assets/{agent-hosting-Bh96XN9S.js → agent-hosting-DYqOSc12.js} +1 -1
  57. package/dist/client/assets/{agent-icon-1vUJELUc.js → agent-icon-Djmp3uF_.js} +1 -1
  58. package/dist/client/assets/agent-library-DPkauleQ.js +1 -0
  59. package/dist/client/assets/agent-library-file-DBFbWEdb.js +1 -0
  60. package/dist/client/assets/agent-overview-w61B53CG.js +1 -0
  61. package/dist/client/assets/{agent-releases-S4GqVssW.js → agent-releases-CG7DBQNk.js} +1 -1
  62. package/dist/client/assets/agent-settings-DhAam1Kq.js +1 -0
  63. package/dist/client/assets/{agent-site-editor-DlcsAgpa.js → agent-site-editor-bsAYI9Qx.js} +1 -1
  64. package/dist/client/assets/agent-site-editor-code-B7ydMNRc.js +2 -0
  65. package/dist/client/assets/agent-site-editor-content-DGHE_na5.js +1 -0
  66. package/dist/client/assets/agent-site-editor-preview-B2KHkUGc.js +1 -0
  67. package/dist/client/assets/agent-view-2ZyI-5m_.js +1 -0
  68. package/dist/client/assets/{agent-view-guard-DyT-WkNT.js → agent-view-guard-BjTeUL0l.js} +1 -1
  69. package/dist/client/assets/{ai-providers-Bw3br-ax.js → ai-providers--9DxGzKr.js} +1 -1
  70. package/dist/client/assets/{alert-DsgJtvps.js → alert-DodlNZ2z.js} +1 -1
  71. package/dist/client/assets/{analytics-sections-DgS12h3K.js → analytics-sections-BavM7p0J.js} +1 -1
  72. package/dist/client/assets/{api-keys-B85336pg.js → api-keys-C9Ltg2HT.js} +1 -1
  73. package/dist/client/assets/api-keys-QeNKM9--.js +1 -0
  74. package/dist/client/assets/{app-editor-DEHAMUHX.js → app-editor-oJJTX1pK.js} +1 -1
  75. package/dist/client/assets/{asset-utils-c61YtAGu.js → asset-utils-B8xngYBo.js} +1 -1
  76. package/dist/client/assets/{auth-catchall-BAxpUTXQ.js → auth-catchall-BIoLm5Ab.js} +1 -1
  77. package/dist/client/assets/{auth-CUfTA8T0.js → auth-dN38N6ZJ.js} +1 -1
  78. package/dist/client/assets/{auth-entry-BoGMbivW.js → auth-entry-C1XoF05E.js} +1 -1
  79. package/dist/client/assets/{auth-split-layout-BWd0h7zG.js → auth-split-layout-C01yLUAN.js} +1 -1
  80. package/dist/client/assets/{authenticate-and-persist-oauth-COv8FkOt.js → authenticate-and-persist-oauth-BLc3TfFn.js} +1 -1
  81. package/dist/client/assets/{automation-list-row-DGcCh8CU.js → automation-list-row-PbVUdzfB.js} +1 -1
  82. package/dist/client/assets/{automation-runs-CIDR0-o_.js → automation-runs-Ci5bOvQY.js} +1 -1
  83. package/dist/client/assets/{automations-DNvrCNx5.js → automations-932xVZmd.js} +1 -1
  84. package/dist/client/assets/{badge-Pf9QzxnK.js → badge-ooD-f3Xm.js} +1 -1
  85. package/dist/client/assets/{block-document-C1uCTvtU.js → block-document-B3emD8Py.js} +1 -1
  86. package/dist/client/assets/{blocks-preview-workspace-context-BmruAU8L.js → blocks-preview-workspace-context-CPWJ7AAs.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-CiP5NKqR.js → blocks-tab-states-BzneOCDW.js} +1 -1
  88. package/dist/client/assets/{blog-preview-url-DrSNdo24.js → blog-preview-url-BVoP3Psp.js} +1 -1
  89. package/dist/client/assets/{blog-schema-CkFIU4SR.js → blog-schema-Pk7BbGun.js} +1 -1
  90. package/dist/client/assets/{blog-source-gate-XOwqt3qa.js → blog-source-gate-BpC4RIWC.js} +1 -1
  91. package/dist/client/assets/{blog-view-gate-7VsxrHvA.js → blog-view-gate-CGKzU05m.js} +1 -1
  92. package/dist/client/assets/{buckets-BtmcJWhS.js → buckets-Cvkckzfy.js} +1 -1
  93. package/dist/client/assets/{build-improve-prompt-doc-c_dRj9p0.js → build-improve-prompt-doc-DRdwqMyb.js} +1 -1
  94. package/dist/client/assets/{calendar-Ccf2VAnj.js → calendar-Dfc1FCTZ.js} +1 -1
  95. package/dist/client/assets/{capability-load-error-DnjuDOX-.js → capability-load-error-D-MJtSCR.js} +1 -1
  96. package/dist/client/assets/{category-editor-DG8ZyyVc.js → category-editor-DqvQQTB6.js} +1 -1
  97. package/dist/client/assets/{category-tree-CiYjKN9r.js → category-tree-D011La9Z.js} +1 -1
  98. package/dist/client/assets/{chart-vEWm-9uz.js → chart-uUI_EY97.js} +1 -1
  99. package/dist/client/assets/{chat-context-DRgQoOPX.js → chat-context-Bb_Yeasx.js} +1 -1
  100. package/dist/client/assets/{chat-draft-e-CMA-qe.js → chat-draft-C5b4ZZNT.js} +1 -1
  101. package/dist/client/assets/{checkbox-CydUHtJN.js → checkbox-B0iej-k4.js} +1 -1
  102. package/dist/client/assets/{choose-editor-YR1zSpeG.js → choose-editor-BHGbYr9M.js} +1 -1
  103. package/dist/client/assets/{cli-auth-success-Cq3254v5.js → cli-auth-success-BjK_2k36.js} +1 -1
  104. package/dist/client/assets/{cms-settings-editor-CF3ajtdS.js → cms-settings-editor-DczcBgsg.js} +1 -1
  105. package/dist/client/assets/{cms-store-drafts-DvTKntFL.js → cms-store-drafts-D65g6QDr.js} +1 -1
  106. package/dist/client/assets/{collapsible-jmkXcnQa.js → collapsible-bv19Lgop.js} +1 -1
  107. package/dist/client/assets/{collection-detail-Cq0EjLw2.js → collection-detail-CrdyPuxx.js} +1 -1
  108. package/dist/client/assets/{collection-display-button-BdAaSo2Z.js → collection-display-button-bohOcAnJ.js} +1 -1
  109. package/dist/client/assets/{collection-search-D8o4j-uq.js → collection-search-CT3oHQLL.js} +1 -1
  110. package/dist/client/assets/{collection-table-wrapper-CRrPq-Hv.js → collection-table-wrapper-COcHlvPf.js} +1 -1
  111. package/dist/client/assets/{collection-tabs-B5l6em52.js → collection-tabs-BbqMtY-J.js} +1 -1
  112. package/dist/client/assets/{combobox-DkjgY2xJ.js → combobox-C7dFW3mg.js} +1 -1
  113. package/dist/client/assets/{command-CQ-JRvpy.js → command-BUJZW101.js} +1 -1
  114. package/dist/client/assets/{companion-mcps-section-DoHAGrNA.js → companion-mcps-section-OQv-05I3.js} +1 -1
  115. package/dist/client/assets/{config-XRcanAcE.js → config-BW2WE8-w.js} +1 -1
  116. package/dist/client/assets/{connect-rxprssIL.js → connect-BM_qQLsb.js} +1 -1
  117. package/dist/client/assets/{connect-key-B8JwdxY_.js → connect-key-DaxTwfXl.js} +1 -1
  118. package/dist/client/assets/{connect-layout-D1rW31jg.js → connect-layout-Dqk87DYY.js} +1 -1
  119. package/dist/client/assets/{connect-source-dialog-Bd1uT1tp.js → connect-source-dialog-Bo2D6V9J.js} +1 -1
  120. package/dist/client/assets/{connection-C6x0X_hB.js → connection-CrDLMjxz.js} +1 -1
  121. package/dist/client/assets/{connection-card-BdEf2ezM.js → connection-card-B_Rm3jws.js} +1 -1
  122. package/dist/client/assets/{connection-detail-DbT9wYtT.js → connection-detail-Dya4wQXw.js} +1 -1
  123. package/dist/client/assets/{connection-form-helpers-Lbv4VYrx.js → connection-form-helpers-BnupWMcv.js} +1 -1
  124. package/dist/client/assets/{connection-slug-DPwoP1bG.js → connection-slug-Dsjc_7jc.js} +1 -1
  125. package/dist/client/assets/{connections-CJDQO2CH.js → connections-CqzzCCFh.js} +1 -1
  126. package/dist/client/assets/{content-tab-C3FRo_ZL.js → content-tab-xOW2jmWD.js} +3 -3
  127. package/dist/client/assets/{context-D6DmhOWq.js → context-B52xcJP8.js} +1 -1
  128. package/dist/client/assets/{context-menu-KBaVqVLo.js → context-menu-C3vl1voD.js} +1 -1
  129. package/dist/client/assets/{context-shell-2585iNPl.js → context-shell-CLN1cZ8-.js} +3 -3
  130. package/dist/client/assets/{create-organization-dialog-CM_3UeQq.js → create-organization-dialog-C8w69dn8.js} +1 -1
  131. package/dist/client/assets/{daily-pulse-pmTvSIcA.js → daily-pulse-BkhyNjIU.js} +1 -1
  132. package/dist/client/assets/{delete-copy-GRC3nQ3b.js → delete-copy-D7GWyg_y.js} +1 -1
  133. package/dist/client/assets/{device-hint-CVKHXMaf.js → device-hint-BWoKmEkk.js} +1 -1
  134. package/dist/client/assets/{discover-C4suMPso.js → discover-ClyGoNdo.js} +1 -1
  135. package/dist/client/assets/{domain-settings-BziyEdMC.js → domain-settings-Bff7hkhZ.js} +1 -1
  136. package/dist/client/assets/{drawer-DMjzv7kx.js → drawer-9dr-ukqt.js} +1 -1
  137. package/dist/client/assets/{editor-DJoO1oTe.js → editor-OtYf9TpJ.js} +1 -1
  138. package/dist/client/assets/{editor-classes-DxbZdxNb.js → editor-classes-B015z8BR.js} +1 -1
  139. package/dist/client/assets/{empty-message-Hjqfctaj.js → empty-message-DLDkQwTf.js} +1 -1
  140. package/dist/client/assets/{empty-state-fOAZ4i_4.js → empty-state-DGvmXTTx.js} +1 -1
  141. package/dist/client/assets/{empty-state-E3drTKwx.js → empty-state-DgS_yB9S.js} +1 -1
  142. package/dist/client/assets/{experiments-tab-choice-qOWGWOFZ.js → experiments-tab-choice-C_eMr2Jc.js} +1 -1
  143. package/dist/client/assets/{extract-connection-data-CjEe1MWg.js → extract-connection-data-D5LnDq3n.js} +1 -1
  144. package/dist/client/assets/{feature-gate-Cbex1En9.js → feature-gate-BwfJl_-J.js} +1 -1
  145. package/dist/client/assets/{feature-paywall-BknhXLyt.js → feature-paywall-CEAWGxEK.js} +1 -1
  146. package/dist/client/assets/{file-explorer-Ks63f54D.js → file-explorer-CsgK4soc.js} +1 -1
  147. package/dist/client/assets/{file-preview-CnBl6QdJ.js → file-preview-Dy_zYo8i.js} +1 -1
  148. package/dist/client/assets/{file-share-button-CDiroXKh.js → file-share-button-DwseFge1.js} +1 -1
  149. package/dist/client/assets/{file-type-icon-K1SpBuav.js → file-type-icon-BBC7AgSm.js} +1 -1
  150. package/dist/client/assets/{folder-icon-CGCVTlP4.js → folder-icon-Cu3Aqv3z.js} +1 -1
  151. package/dist/client/assets/{form-CWRcWXN_.js → form-C_3nPlqc.js} +1 -1
  152. package/dist/client/assets/{frame-navigation-pEGrcqBB.js → frame-navigation-DyI9DOPc.js} +1 -1
  153. package/dist/client/assets/{gateway-client-qrgHo9X7.js → gateway-client-GUKS8Neg.js} +1 -1
  154. package/dist/client/assets/{general-CFKZC4Bm.js → general-Cdeh5VuD.js} +1 -1
  155. package/dist/client/assets/{github-icon-DSYm9NcE.js → github-icon-F-zWm9rJ.js} +1 -1
  156. package/dist/client/assets/{held-block-view-CHpQrpR-.js → held-block-view-myNdCF-d.js} +1 -1
  157. package/dist/client/assets/{home-B1BEcUL6.js → home-CUGwCNOx.js} +1 -1
  158. package/dist/client/assets/{home-overview-3PYqsmAT.js → home-overview-D0M6VmNP.js} +1 -1
  159. package/dist/client/assets/{hosted-reconcile-7fs1X55C.js → hosted-reconcile-DbZes2_O.js} +1 -1
  160. package/dist/client/assets/{icon-button-gLVbB0jI.js → icon-button-CO-b_Z7N.js} +1 -1
  161. package/dist/client/assets/{index-Dv0x1GOA.js → index-Aa6DiPpP.js} +1 -1
  162. package/dist/client/assets/{index-bc5sqkPK.js → index-B4Z8qm4O.js} +1 -1
  163. package/dist/client/assets/{index-DWkvJNqc.js → index-BWOFXtLm.js} +1 -1
  164. package/dist/client/assets/{index-C85tHLcN.js → index-BbyUQV-V.js} +3 -3
  165. package/dist/client/assets/{index-Da85qowO.js → index-Bu3usBwV.js} +1 -1
  166. package/dist/client/assets/{index-CWlw9JP9.js → index-C98zqBJi.js} +1 -1
  167. package/dist/client/assets/{index-B2fClAY2.js → index-CEeYBwYa.js} +1 -1
  168. package/dist/client/assets/{index-DuzDqcfd.js → index-CUj2rPmp.js} +1 -1
  169. package/dist/client/assets/{index-q9YhUnQe.js → index-CVv3Fivj.js} +1 -1
  170. package/dist/client/assets/{index-CevVA9xN.js → index-CZNM0ywV.js} +1 -1
  171. package/dist/client/assets/{index-Cve__EcV.js → index-CaoQI4w-.js} +1 -1
  172. package/dist/client/assets/{index-D3QhpuIe.js → index-D8oZjzwY.js} +1 -1
  173. package/dist/client/assets/{index-DdTlbocB.js → index-DbrfsNuM.js} +1 -1
  174. package/dist/client/assets/{index-B-ySqoTz.js → index-DdUaZwED.js} +1 -1
  175. package/dist/client/assets/{index-DjnCseXM.js → index-DeCbUCeI.js} +1 -1
  176. package/dist/client/assets/{index-CJbDZUcV.js → index-Mge-nIe_.js} +1 -1
  177. package/dist/client/assets/{index-4HSuwhm_.js → index-kCYHIAlq.js} +1 -1
  178. package/dist/client/assets/{index-redirect-FZLKranc.js → index-redirect-CbcSCuPI.js} +1 -1
  179. package/dist/client/assets/{infiniteQueryObserver-qZVuRw-O.js → infiniteQueryObserver-DqRBsy9_.js} +1 -1
  180. package/dist/client/assets/{infra-billing-08HiMHaT.js → infra-billing-CWfj-Pw9.js} +1 -1
  181. package/dist/client/assets/{input-eKvzyWzB.js → input-BG3wFK5M.js} +1 -1
  182. package/dist/client/assets/{input-CeHWzvLk.js → input-BK3kIY9G.js} +3 -3
  183. package/dist/client/assets/{integration-icon-0KFdndK9.js → integration-icon-CqVW6T00.js} +1 -1
  184. package/dist/client/assets/{item-actions-DUxc4HRQ.js → item-actions-BR73Lbpo.js} +1 -1
  185. package/dist/client/assets/{jira-icon-BhlvPaKY.js → jira-icon-BveDG26q.js} +1 -1
  186. package/dist/client/assets/{label-BFTFjVIH.js → label-BlFTNuxs.js} +1 -1
  187. package/dist/client/assets/{layout-CWc5Dw37.js → layout-CJs8yxSP.js} +1 -1
  188. package/dist/client/assets/{legacy-admin-welcome-dialog-CjXnIz4O.js → legacy-admin-welcome-dialog-BeUx4hhs.js} +1 -1
  189. package/dist/client/assets/{legacy-agents-deep-DN_kOAia.js → legacy-agents-deep-D-0KzS7C.js} +1 -1
  190. package/dist/client/assets/{legacy-main-redirect-BtzGm7Me.js → legacy-main-redirect-BnbcsFdv.js} +1 -1
  191. package/dist/client/assets/library-D1GvJnHB.js +1 -0
  192. package/dist/client/assets/{library-tab-CuRo6sQJ.js → library-tab-BsPi8uGe.js} +1 -1
  193. package/dist/client/assets/{login-CrcWGbwY.js → login-CvKqHfzS.js} +1 -1
  194. package/dist/client/assets/{markdown-Bn4GUSDy.js → markdown-BLD58IcZ.js} +1 -1
  195. package/dist/client/assets/{mcp-app-renderer-BA9gzzWp.js → mcp-app-renderer-C3N-ooKA.js} +1 -1
  196. package/dist/client/assets/{mcp-oauth-BAH1YTyp.js → mcp-oauth-BBRt-CKi.js} +1 -1
  197. package/dist/client/assets/{mcp-oauth-CSXk2zEu.js → mcp-oauth-BetyI4Sc.js} +1 -1
  198. package/dist/client/assets/{members-BBVb35y2.js → members-G2uEV1Et.js} +1 -1
  199. package/dist/client/assets/{memory-DrdyYAMg.js → memory-BBzt-gTj.js} +1 -1
  200. package/dist/client/assets/{mock-board-BzPXjSGt.js → mock-board-DzuhmO_q.js} +3 -3
  201. package/dist/client/assets/{monaco-editor-DbDj727O.js → monaco-editor-BTeatlwM.js} +1 -1
  202. package/dist/client/assets/{monitoring-Bp8NCGcy.js → monitoring-C9ty4kJN.js} +1 -1
  203. package/dist/client/assets/{monitoring-stats-row-Cn1MlO4T.js → monitoring-stats-row-Ca0svB-0.js} +1 -1
  204. package/dist/client/assets/{multi-select-CgQoQWM4.js → multi-select-xFJ9DMUE.js} +1 -1
  205. package/dist/client/assets/{mustache-Df1Duqj_.js → mustache-BB27WkZo.js} +1 -1
  206. package/dist/client/assets/{named-rule-step-e1NE1N94.js → named-rule-step-DHcxNdON.js} +1 -1
  207. package/dist/client/assets/{named-rule-view-0d3pAypH.js → named-rule-view-Blk7EotW.js} +1 -1
  208. package/dist/client/assets/{new-project-dialog-Co22b0Pz.js → new-project-dialog-CwWe9JTm.js} +1 -1
  209. package/dist/client/assets/{new-project-store-Bk2gL22H.js → new-project-store-DI-rcaGT.js} +1 -1
  210. package/dist/client/assets/{oauth-callback-Dv5ActA7.js → oauth-callback-JurbFJad.js} +1 -1
  211. package/dist/client/assets/{oauth-callback-ai-provider-Bqdg_jjB.js → oauth-callback-ai-provider-DNhExCAX.js} +1 -1
  212. package/dist/client/assets/{oauth-consent-CcMxfq4q.js → oauth-consent-Dv-Pk8HZ.js} +1 -1
  213. package/dist/client/assets/{onboarding-Cx6yBxRM.js → onboarding-NnDc0_K6.js} +1 -1
  214. package/dist/client/assets/{openai-conversation-C-vUQsTW.js → openai-conversation-C3QjsSfG.js} +1 -1
  215. package/dist/client/assets/{optimistic-project-sidebar-views-B0fym-vN.js → optimistic-project-sidebar-views-B7gNYHcx.js} +1 -1
  216. package/dist/client/assets/{order-monitor-day-CZGARbXe.js → order-monitor-day-DfBlxxW3.js} +1 -1
  217. package/dist/client/assets/{organization-choice-z4KGe3ti.js → organization-choice-CIf8awfg.js} +1 -1
  218. package/dist/client/assets/{orgs-DCKipWZv.js → orgs-D2UEp59O.js} +1 -1
  219. package/dist/client/assets/{own-accounts-section-BPAeSgQF.js → own-accounts-section-9LGriAR-.js} +1 -1
  220. package/dist/client/assets/{pair-D_lpTII5.js → pair-Dg8_WzRx.js} +1 -1
  221. package/dist/client/assets/{parse-sections-CQLe_CsU.js → parse-sections-DFcHy6a1.js} +2 -2
  222. package/dist/client/assets/{plan-Cj0XFxCj.js → plan-DpsDK1nS.js} +1 -1
  223. package/dist/client/assets/{plan-ladder-bbfSV1Pj.js → plan-ladder-i51kvc_6.js} +1 -1
  224. package/dist/client/assets/{plan-usage-card-B8zRX2UQ.js → plan-usage-card-Mo9p5apk.js} +1 -1
  225. package/dist/client/assets/{popover-BjZp4C3X.js → popover-B2fZ96W0.js} +1 -1
  226. package/dist/client/assets/{post-calendar-gShSdFI0.js → post-calendar-BxpnvMqZ.js} +1 -1
  227. package/dist/client/assets/{post-editor-01HGKiT3.js → post-editor-DA_1qcnl.js} +1 -1
  228. package/dist/client/assets/{preview-content-Bur_HQlw.js → preview-content-D5RMjaD6.js} +1 -1
  229. package/dist/client/assets/{preview-dialog-DFhpYWDY.js → preview-dialog-C0sVKUR7.js} +1 -1
  230. package/dist/client/assets/{preview-panel-JnlIfMko.js → preview-panel-CInuQgv3.js} +1 -1
  231. package/dist/client/assets/{preview-tab-Blz8ji_b.js → preview-tab-D51UeUtA.js} +3 -3
  232. package/dist/client/assets/{product-picker-dialog-CBYXrBxN.js → product-picker-dialog-DSDf6Bwa.js} +1 -1
  233. package/dist/client/assets/{profile-CW1qZv4E.js → profile-BclswKhx.js} +1 -1
  234. package/dist/client/assets/{project-app-view-lLGemxMj.js → project-app-view-ke3ZuGxF.js} +1 -1
  235. package/dist/client/assets/{project-apps-Cp_UOz3C.js → project-apps-fbR4xDRx.js} +1 -1
  236. package/dist/client/assets/{project-icon-Dp3mt0vF.js → project-icon-BbR0XGm1.js} +1 -1
  237. package/dist/client/assets/{project-index-D0h6WvE8.js → project-index-lWz60EWQ.js} +1 -1
  238. package/dist/client/assets/project-reports-B9Ihgtjs.js +1 -0
  239. package/dist/client/assets/project-tasks-BlyYNsZd.js +1 -0
  240. package/dist/client/assets/{projects-D50oucbd.js → projects-BM5L61A_.js} +1 -1
  241. package/dist/client/assets/{projects-empty-state-l1yjn612.js → projects-empty-state-Vmw2nbR-.js} +1 -1
  242. package/dist/client/assets/{prompts-Dm_XOAdj.js → prompts-DEXjOdXC.js} +1 -1
  243. package/dist/client/assets/record-editor-5moRR35h.js +1 -0
  244. package/dist/client/assets/{redirect-editor-BBT8tW2u.js → redirect-editor-_jG1X_eI.js} +1 -1
  245. package/dist/client/assets/reports-BRR7RsFA.js +1 -0
  246. package/dist/client/assets/{reports-CCzLe_e7.js → reports-_8k_JS7q.js} +1 -1
  247. package/dist/client/assets/{reports-onboarding-qzYZ0U3H.js → reports-onboarding-8vGx8eDL.js} +1 -1
  248. package/dist/client/assets/{reports-tab-C0uzs6sx.js → reports-tab-Caka1Haa.js} +2 -2
  249. package/dist/client/assets/{repositories-98si2EgV.js → repositories-B9q1-DTL.js} +1 -1
  250. package/dist/client/assets/repositories-DJEaM14h.js +1 -0
  251. package/dist/client/assets/{repository-binding-DFWWxXUn.js → repository-binding-CYxPGVF9.js} +1 -1
  252. package/dist/client/assets/{repository-picker-DN8jGk0B.js → repository-picker-BwLPliw3.js} +1 -1
  253. package/dist/client/assets/{require-capability-BpI-Q9ce.js → require-capability-BdZtDVPs.js} +1 -1
  254. package/dist/client/assets/{required-auth-layout-DVaUpJLt.js → required-auth-layout-CEv7xMbD.js} +1 -1
  255. package/dist/client/assets/{reset-password-Dnaah8Bj.js → reset-password-DcjIR0v2.js} +1 -1
  256. package/dist/client/assets/{resizable-ZWRPFP99.js → resizable-CDz_Gn5D.js} +1 -1
  257. package/dist/client/assets/{resolve-tab-icon-D2fElWIs.js → resolve-tab-icon-DSU20OFN.js} +1 -1
  258. package/dist/client/assets/{review-settings-BQvIDJom.js → review-settings-4ZKA9iW7.js} +1 -1
  259. package/dist/client/assets/{role-color-D7aQG9YG.js → role-color-CAtp2x5d.js} +1 -1
  260. package/dist/client/assets/{roles-BtxXbl7C.js → roles-B7qeAHn4.js} +1 -1
  261. package/dist/client/assets/{route-BWatzPs6.js → route-CjIHbnSM.js} +1 -1
  262. package/dist/client/assets/{route-CklpWWje.js → route-D1xX0HWw.js} +1 -1
  263. package/dist/client/assets/route-DxBgurmK.js +1 -0
  264. package/dist/client/assets/{route-page-header-C89Dw-o7.js → route-page-header-BtRFuS1p.js} +1 -1
  265. package/dist/client/assets/{sandbox-git-api-VXUab4zs.js → sandbox-git-api-a72xh_lB.js} +1 -1
  266. package/dist/client/assets/{sandbox-lifecycle-context-DRfycjkH.js → sandbox-lifecycle-context-BgQ_JLd0.js} +1 -1
  267. package/dist/client/assets/{save-status-CP8vXl09.js → save-status-BXi_cq_U.js} +1 -1
  268. package/dist/client/assets/{schema-CakgGDYa.js → schema-BoCycph4.js} +1 -1
  269. package/dist/client/assets/{schema-uLUotu0l.js → schema-DvznvyNF.js} +1 -1
  270. package/dist/client/assets/{scroll-area-C9LFiu5G.js → scroll-area-BJzMdjhR.js} +1 -1
  271. package/dist/client/assets/{search-input-B_qP8-Dp.js → search-input-Dx1nMhkR.js} +1 -1
  272. package/dist/client/assets/{search-toggle-Dki5ryJE.js → search-toggle-CUowc2bs.js} +1 -1
  273. package/dist/client/assets/{secret-picker-DLFB3680.js → secret-picker-CzcUm0AA.js} +1 -1
  274. package/dist/client/assets/{secrets-D7nqaHdJ.js → secrets-T6PONWpM.js} +1 -1
  275. package/dist/client/assets/{section-array-field-maBthvLp.js → section-array-field-Dau5fGuc.js} +1 -1
  276. package/dist/client/assets/{sections-OkJT55N9.js → sections-B_pt0duw.js} +1 -1
  277. package/dist/client/assets/{sections-editor-BSd5yJzF.js → sections-editor-B1dRi1DP.js} +1 -1
  278. package/dist/client/assets/{select-0LL7vYGo.js → select-CaROtCr6.js} +1 -1
  279. package/dist/client/assets/{select-model-CdXfLfQ0.js → select-model-B_uQ8JoM.js} +1 -1
  280. package/dist/client/assets/{seo-editor-07Upgn4u.js → seo-editor-CgBBfTmC.js} +1 -1
  281. package/dist/client/assets/{separator-Bo22S7sI.js → separator-DzpcrIme.js} +1 -1
  282. package/dist/client/assets/{session-runtime-45E__Spq.js → session-runtime-B3M5aN-q.js} +1 -1
  283. package/dist/client/assets/settings-tab-dHZPtR7N.js +1 -0
  284. package/dist/client/assets/{sheet-D60vsWkT.js → sheet-um4noh5c.js} +1 -1
  285. package/dist/client/assets/{shell-layout-EsacDloA.js → shell-layout-49bNXIez.js} +1 -1
  286. package/dist/client/assets/{site-draft-actions-jgv5lneW.js → site-draft-actions-DK9guIkf.js} +1 -1
  287. package/dist/client/assets/{site-draft-view-B34XeV1i.js → site-draft-view-WvygLXbI.js} +1 -1
  288. package/dist/client/assets/site-editor-CD68AWh1.js +1 -0
  289. package/dist/client/assets/{site-editor-toast-BDulHEMF.js → site-editor-toast-CkErPR2A.js} +1 -1
  290. package/dist/client/assets/{skills-DsXVIKup.js → skills-DOI-sQ-e.js} +1 -1
  291. package/dist/client/assets/{slider-F0CZgjh6.js → slider-BSl20SQg.js} +1 -1
  292. package/dist/client/assets/{sortable.esm-DAdaPQLI.js → sortable.esm-CqIiSw1u.js} +1 -1
  293. package/dist/client/assets/{sso-VScqybhv.js → sso-BjUVysiz.js} +1 -1
  294. package/dist/client/assets/{suggestion-CD3Xe_6y.js → suggestion-Ddmtk3Nb.js} +1 -1
  295. package/dist/client/assets/{super-agent-icon-Bu6yeNMB.js → super-agent-icon-DoovhGsp.js} +1 -1
  296. package/dist/client/assets/{switch-B6bptBy8.js → switch-BH2QiW4s.js} +1 -1
  297. package/dist/client/assets/{synced-repos-BCfB6_fP.js → synced-repos-CWR0L5YE.js} +1 -1
  298. package/dist/client/assets/{tab-icon-glyph-UKzu2ZND.js → tab-icon-glyph-DOr4PjkR.js} +1 -1
  299. package/dist/client/assets/{table-CrAIuX7X.js → table-C92UEJKy.js} +1 -1
  300. package/dist/client/assets/{tabs-CkLLvnO_.js → tabs-NIuu6bj4.js} +1 -1
  301. package/dist/client/assets/{task-board-D4Sl9KMo.js → task-board-_DSzqPWi.js} +1 -1
  302. package/dist/client/assets/{task-key-DdCGJUj1.js → task-key-CaAm1Jwf.js} +1 -1
  303. package/dist/client/assets/{task-route-9l7x763b.js → task-route-DLJKfX0K.js} +1 -1
  304. package/dist/client/assets/{task-status-CVHHfIS_.js → task-status-DA1DjG6p.js} +1 -1
  305. package/dist/client/assets/{taskboard-analytics-XbLvf4gx.js → taskboard-analytics-Dh8Uts6G.js} +1 -1
  306. package/dist/client/assets/{tasks-F-Gf7MfK.js → tasks-BbQQWzuJ.js} +1 -1
  307. package/dist/client/assets/tasks-CpE_irof.js +1 -0
  308. package/dist/client/assets/{textarea-Jl12VF1V.js → textarea-Co6WXg3Y.js} +1 -1
  309. package/dist/client/assets/{thread-analytics-CN6YxU84.js → thread-analytics-DXYu0MbV.js} +1 -1
  310. package/dist/client/assets/{thread-button-DJoaq2w1.js → thread-button-8Paou_ey.js} +1 -1
  311. package/dist/client/assets/{thread-intent-_pxHME4U.js → thread-intent-BNjS3eKm.js} +1 -1
  312. package/dist/client/assets/{thread-route-BfFOgfGr.js → thread-route-B-bmrR_e.js} +1 -1
  313. package/dist/client/assets/{thread-route-CKA62JrL.js → thread-route-B-vrKdst.js} +1 -1
  314. package/dist/client/assets/{thread-sheet-body-BpMYGTmC.js → thread-sheet-body-BruhHKIO.js} +1 -1
  315. package/dist/client/assets/{time-range-picker-CirqLev7.js → time-range-picker-DLzufi0f.js} +1 -1
  316. package/dist/client/assets/{toggle-group-CdOqAyIy.js → toggle-group-D14vFqFg.js} +1 -1
  317. package/dist/client/assets/{tool-set-selector-CauuJZcJ.js → tool-set-selector-EC4Q3po8.js} +1 -1
  318. package/dist/client/assets/{toolbar-icon-button-Bc6P-Pcn.js → toolbar-icon-button-CKwtmkGZ.js} +1 -1
  319. package/dist/client/assets/{tooltip-k85O2ViC.js → tooltip-CINPZAUE.js} +1 -1
  320. package/dist/client/assets/{tooltipContext-BUwR0gbN.js → tooltipContext-B7kIVm-_.js} +1 -1
  321. package/dist/client/assets/{track-BB8Uscnm.js → track-B0303apM.js} +1 -1
  322. package/dist/client/assets/{types-DQ1tQWK0.js → types-KLF33bAU.js} +1 -1
  323. package/dist/client/assets/{url-slug-CTDbeJac.js → url-slug-BhLnqovl.js} +1 -1
  324. package/dist/client/assets/{usage-stats-DKOEXU2h.js → usage-stats-DTw2_3QF.js} +1 -1
  325. package/dist/client/assets/{use-ai-providers-CP-Hz8VY.js → use-ai-providers-BxpYBICM.js} +1 -1
  326. package/dist/client/assets/{use-api-keys-601ky0KO.js → use-api-keys-DEL0nRO1.js} +1 -1
  327. package/dist/client/assets/{use-apply-named-rule-DY3qdxpq.js → use-apply-named-rule-CRVOk9Kn.js} +1 -1
  328. package/dist/client/assets/use-ask-in-chat-DbbisiOd.js +1 -0
  329. package/dist/client/assets/{use-automations-BBJSxLUA.js → use-automations-Da6nezmh.js} +1 -1
  330. package/dist/client/assets/{use-autosave-C4herh_I.js → use-autosave-BHk7ZJHa.js} +1 -1
  331. package/dist/client/assets/use-blocks-v8-project-CTDs5jlx.js +1 -0
  332. package/dist/client/assets/use-blog-view-B5vAwn2e.js +1 -0
  333. package/dist/client/assets/{use-chat-layout-state-C2qYACH8.js → use-chat-layout-state-BmTxsTjG.js} +1 -1
  334. package/dist/client/assets/{use-cms-publish-actions-D2j0_CbX.js → use-cms-publish-actions-wU3dtco2.js} +1 -1
  335. package/dist/client/assets/{use-connect-companion-BZj5DqzS.js → use-connect-companion-N3ywRKD4.js} +1 -1
  336. package/dist/client/assets/{use-connection-PIh05Hyc.js → use-connection-Q1OVyR-K.js} +1 -1
  337. package/dist/client/assets/{use-content-sync-CLcT9zcO.js → use-content-sync-D1DcK5RP.js} +1 -1
  338. package/dist/client/assets/{use-copy-Bpi1xzoh.js → use-copy-CHLJB-eJ.js} +1 -1
  339. package/dist/client/assets/{use-current-view-Cw9yOMDU.js → use-current-view-DWPEJKMo.js} +1 -1
  340. package/dist/client/assets/{use-date-fns-locale-ByGoiQ-F.js → use-date-fns-locale-Ch-Feesx.js} +1 -1
  341. package/dist/client/assets/{use-debounced-autosave-D3C08Kat.js → use-debounced-autosave-C330kFl7.js} +1 -1
  342. package/dist/client/assets/{use-debounced-value-dqdgSMec.js → use-debounced-value-CDV_Hdj_.js} +1 -1
  343. package/dist/client/assets/{use-deco-credits-DV3818XY.js → use-deco-credits-BH9MKLeU.js} +1 -1
  344. package/dist/client/assets/{use-decopilot-events-DP_r1Kdt.js → use-decopilot-events-Bzy3gyOh.js} +1 -1
  345. package/dist/client/assets/{use-delete-block-CBmUPIsz.js → use-delete-block-Ds8KKf4b.js} +1 -1
  346. package/dist/client/assets/{use-delete-connection-gEgd8eK5.js → use-delete-connection-CUYN49rH.js} +1 -1
  347. package/dist/client/assets/{use-deployment-admin-DXdiazmg.js → use-deployment-admin-44Nr2y3l.js} +1 -1
  348. package/dist/client/assets/{use-entitlements-D5uPt1hf.js → use-entitlements-D_bekXoy.js} +1 -1
  349. package/dist/client/assets/{use-fast-preview-draft-url-CIlx2V4C.js → use-fast-preview-draft-url-BJcuelFd.js} +1 -1
  350. package/dist/client/assets/{use-file-configs-Ewn14i-x.js → use-file-configs-Dv6Dn9-s.js} +1 -1
  351. package/dist/client/assets/{use-id-selection-B6wRAhZh.js → use-id-selection-B5eFUC_T.js} +1 -1
  352. package/dist/client/assets/{use-in-settings-BghU4KTx.js → use-in-settings-DsvAK9xJ.js} +1 -1
  353. package/dist/client/assets/{use-inbox-feed-4znK-CEA.js → use-inbox-feed-DUOXuaWM.js} +1 -1
  354. package/dist/client/assets/{use-infinite-scroll-DI1uwk4k.js → use-infinite-scroll-K5fXsA2s.js} +1 -1
  355. package/dist/client/assets/{use-join-requests-SKf_bwd0.js → use-join-requests-ne0-a4Uk.js} +1 -1
  356. package/dist/client/assets/{use-main-panel-tabs-DCa4J6CK.js → use-main-panel-tabs-ZUH2Q11R.js} +1 -1
  357. package/dist/client/assets/{use-mcp-auth-status-VWBAwa4J.js → use-mcp-auth-status-BydVHpTh.js} +1 -1
  358. package/dist/client/assets/{use-mcp-client-CUrluUi3.js → use-mcp-client-KtY-iAqe.js} +1 -1
  359. package/dist/client/assets/{use-mcp-prompts-D0u43aV4.js → use-mcp-prompts-hYH8zGss.js} +1 -1
  360. package/dist/client/assets/{use-mcp-tools-_QuEBcsk.js → use-mcp-tools-Bkf2GErZ.js} +1 -1
  361. package/dist/client/assets/{use-mobile-BC_OOfWs.js → use-mobile-BFnx6XU5.js} +1 -1
  362. package/dist/client/assets/{use-move-blocks-DGHmjLIO.js → use-move-blocks-CTFo8anC.js} +1 -1
  363. package/dist/client/assets/{use-navigate-to-agent-WkE71T4J.js → use-navigate-to-agent-DzfMLwHb.js} +1 -1
  364. package/dist/client/assets/{use-never-published-CnJJZaok.js → use-never-published-DvQ5FOx0.js} +1 -1
  365. package/dist/client/assets/{use-org-fs-Dyz1rpOE.js → use-org-fs-BQXLoGp0.js} +1 -1
  366. package/dist/client/assets/{use-org-notice-BJ5lt1H7.js → use-org-notice-DiGO_5sP.js} +1 -1
  367. package/dist/client/assets/{use-org-repo-syncs-umqyAc6M.js → use-org-repo-syncs-DXQDNA2H.js} +1 -1
  368. package/dist/client/assets/{use-org-sso-JmqS1Edt.js → use-org-sso-BqAhMDLF.js} +1 -1
  369. package/dist/client/assets/{use-organization-settings-DA41rXk2.js → use-organization-settings-C_xGXqYD.js} +1 -1
  370. package/dist/client/assets/{use-panel-navigate-yD6TZRr4.js → use-panel-navigate-m_WUKcO1.js} +1 -1
  371. package/dist/client/assets/{use-project-native-view-presence-CyFNIrxc.js → use-project-native-view-presence-DoNrSMI0.js} +1 -1
  372. package/dist/client/assets/{use-project-scope-BCJ_xKUP.js → use-project-scope-tAmzLFmo.js} +1 -1
  373. package/dist/client/assets/{use-recent-apps-BUUyYoPc.js → use-recent-apps-D4SaJyU5.js} +1 -1
  374. package/dist/client/assets/{use-reports-diagnostic-COwt7AvG.js → use-reports-diagnostic-CQf2IKUc.js} +1 -1
  375. package/dist/client/assets/{use-sandbox-events-D_waR8p2.js → use-sandbox-events-Choa45Ad.js} +1 -1
  376. package/dist/client/assets/{use-secrets-BEOznyKR.js → use-secrets-B89UQslL.js} +1 -1
  377. package/dist/client/assets/{use-section-preview-base-BxY_Ezy0.js → use-section-preview-base-oNURhBRp.js} +1 -1
  378. package/dist/client/assets/{use-sidebar-collapsed-cUSrMUJF.js → use-sidebar-collapsed-DonGXxtx.js} +1 -1
  379. package/dist/client/assets/{use-tags-C9NNvOw6.js → use-tags-DlbCsNcX.js} +1 -1
  380. package/dist/client/assets/{use-task-board-analytics-ogJ5EfIA.js → use-task-board-analytics-CrP9Mh4i.js} +1 -1
  381. package/dist/client/assets/{use-task-board-item-prs-BAg_peyS.js → use-task-board-item-prs-DyqixuOS.js} +1 -1
  382. package/dist/client/assets/{use-task-board-items-CmBIGiCV.js → use-task-board-items-FrK4WjzX.js} +1 -1
  383. package/dist/client/assets/{use-task-board-prompts-QXjNkc47.js → use-task-board-prompts-JQ5bYVQJ.js} +1 -1
  384. package/dist/client/assets/{use-task-metadata-Betu8ti-.js → use-task-metadata-D2mdWA_p.js} +1 -1
  385. package/dist/client/assets/{use-thread-outputs-ubVl5FkO.js → use-thread-outputs-BYENDfew.js} +1 -1
  386. package/dist/client/assets/{use-view-draft-kind-BU8rQuMc.js → use-view-draft-kind-eAKU4tzG.js} +1 -1
  387. package/dist/client/assets/{use-voice-input-BCoTs98e.js → use-voice-input-CFZw5CCV.js} +1 -1
  388. package/dist/client/assets/useInfiniteQuery-L4kwu3zj.js +1 -0
  389. package/dist/client/assets/{useQueries-B0hlyY0W.js → useQueries-DFX8Ra2q.js} +1 -1
  390. package/dist/client/assets/useSuspenseInfiniteQuery-B00pnfIH.js +1 -0
  391. package/dist/client/assets/{users-Dhmi9cYi.js → users-CpjXg9O4.js} +1 -1
  392. package/dist/client/assets/{utils-BCwKnB-w.js → utils-C_wnF1Qr.js} +1 -1
  393. package/dist/client/assets/{variant-calendar-B5qUKPcz.js → variant-calendar-CNAmWyjo.js} +1 -1
  394. package/dist/client/assets/{variant-matcher-override-VPiqlMwA.js → variant-matcher-override-Dq-o59Sr.js} +1 -1
  395. package/dist/client/assets/{view-header-2DQ_V1au.js → view-header-DFmoKFz1.js} +1 -1
  396. package/dist/client/assets/{virtual-mcp-BMeHnqnd.js → virtual-mcp-BL-2RDhS.js} +1 -1
  397. package/dist/client/assets/{watch-sse-pool-Dr1opvol.js → watch-sse-pool-TBuzagYQ.js} +1 -1
  398. package/dist/client/index.html +1 -1
  399. package/dist/server/server.js +546 -546
  400. package/package.json +1 -1
  401. package/dist/client/assets/agent-app-vTHDRIso.js +0 -1
  402. package/dist/client/assets/agent-deck-4o03U5dB.js +0 -1
  403. package/dist/client/assets/agent-experiments-DaFnmI0P.js +0 -1
  404. package/dist/client/assets/agent-file-CFjzC_4I.js +0 -1
  405. package/dist/client/assets/agent-library-file-BEfsQe5S.js +0 -1
  406. package/dist/client/assets/agent-library-rMP1wbu3.js +0 -1
  407. package/dist/client/assets/agent-overview-BTE3fexE.js +0 -1
  408. package/dist/client/assets/agent-settings-zMaCCiSD.js +0 -1
  409. package/dist/client/assets/agent-site-editor-code-DyA6MjKp.js +0 -2
  410. package/dist/client/assets/agent-site-editor-content-CCu238VK.js +0 -1
  411. package/dist/client/assets/agent-site-editor-preview-BrhlNc4-.js +0 -1
  412. package/dist/client/assets/agent-view-DfmcDJUz.js +0 -1
  413. package/dist/client/assets/api-keys-D0jpT3cR.js +0 -1
  414. package/dist/client/assets/library-CEs7UWNI.js +0 -1
  415. package/dist/client/assets/project-reports-BiXUt-Xq.js +0 -1
  416. package/dist/client/assets/project-tasks-DdrYgENo.js +0 -1
  417. package/dist/client/assets/record-editor-CG3jrGrB.js +0 -1
  418. package/dist/client/assets/reports-C8kLYnyv.js +0 -1
  419. package/dist/client/assets/repositories-Ci5g9BEG.js +0 -1
  420. package/dist/client/assets/route-Cqx_ysK2.js +0 -1
  421. package/dist/client/assets/settings-tab-CwOpxSEI.js +0 -1
  422. package/dist/client/assets/site-editor-D-l5f0jx.js +0 -1
  423. package/dist/client/assets/tasks-DJzVVe14.js +0 -1
  424. package/dist/client/assets/use-ask-in-chat-J8CgInrW.js +0 -1
  425. package/dist/client/assets/use-blocks-v8-project-LPOFduCi.js +0 -1
  426. package/dist/client/assets/use-blog-view-DTDGh4BY.js +0 -1
  427. package/dist/client/assets/useInfiniteQuery-DRaTrWng.js +0 -1
  428. package/dist/client/assets/useSuspenseInfiniteQuery-BexWmnfg.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as $,c8 as nt,c as U,b as ie,j as i,gf as ke,o as lt,gg as rt,a4 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,d_ as J,d as ht,R as ut,a5 as mt}from"./index-C85tHLcN.js";import{C as ft}from"./checkbox-CydUHtJN.js";import{S as pt,b as xt,a as gt,d as vt,c as bt}from"./select-0LL7vYGo.js";import{i as He}from"./ArrowLeft-COkdcH40.js";import{i as yt}from"./ChevronSelectorVertical-l40jkbdg.js";import{i as jt}from"./Key01-Ay1sjQwx.js";import{i as qe,t as St,e as Nt,d as kt,c as wt,a as _t,s as It}from"./Tool01-CHVyNhSa.js";import{i as Ye}from"./SearchMd-C4Y8JUHD.js";import{e as Ie,u as Ct,a as Mt,c as Et}from"./use-ai-providers-CP-Hz8VY.js";import{d as Ot}from"./chat-context-DRgQoOPX.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{g as ve}from"./openai-compatible-presets-BKGfVqEx.js";import{i as zt}from"./Monitor01-DfRrojp6.js";import{i as Pt}from"./AlertCircle-BFB3gUiV.js";import{u as At}from"./use-entitlements-D5uPt1hf.js";import{s as Ge}from"./Eye-DWY2fSAh.js";import{t as ze}from"./ChevronDown-DtfpNfYi.js";import{a as Ft}from"./Image01-DMG8Qkz6.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 $,c8 as nt,c as U,b as ie,j as i,gf as ke,o as lt,gg as rt,a4 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,d_ as J,d as ht,R as ut,a5 as mt}from"./index-BbyUQV-V.js";import{C as ft}from"./checkbox-B0iej-k4.js";import{S as pt,b as xt,a as gt,d as vt,c as bt}from"./select-CaROtCr6.js";import{i as He}from"./ArrowLeft-B2F854r0.js";import{i as yt}from"./ChevronSelectorVertical-Buxlf1yx.js";import{i as jt}from"./Key01-BMD-TEa8.js";import{i as qe,t as St,e as Nt,d as kt,c as wt,a as _t,s as It}from"./Tool01-BIyGNKrn.js";import{i as Ye}from"./SearchMd-DIZIcq-T.js";import{e as Ie,u as Ct,a as Mt,c as Et}from"./use-ai-providers-BxpYBICM.js";import{d as Ot}from"./chat-context-Bb_Yeasx.js";import{g as Ce}from"./ai-providers-logos-DD3qZ33J.js";import{g as ve}from"./openai-compatible-presets-BKGfVqEx.js";import{i as zt}from"./Monitor01-BNRBENLp.js";import{i as Pt}from"./AlertCircle-Di8a-UWV.js";import{u as At}from"./use-entitlements-D_bekXoy.js";import{s as Ge}from"./Eye-C6rTinUa.js";import{t as ze}from"./ChevronDown-COkNoLwk.js";import{a as Ft}from"./Image01-xPHq6tUP.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[Qe(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 Qe=(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=Qe(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"],Gt=["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=At();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=Gt.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 Qt(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(Qt(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(Ge,{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 G;e[62]!==S.apiKey?(G=S.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message}),e[62]=S.apiKey,e[63]=G):G=e[63];let Q;e[64]!==L||e[65]!==ee||e[66]!==G?(Q=i.jsxs("div",{className:"space-y-1",children:[L,ee,G]}),e[64]=L,e[65]=ee,e[66]=G,e[67]=Q):Q=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]!==Q||e[88]!==Z||e[89]!==B?(te=i.jsxs("form",{onSubmit:M,className:"space-y-3",children:[z,Q,Z,B]}),e[85]=M,e[86]=z,e[87]=Q,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 G;e[60]!==g?(G=g("apiKey"),e[60]=g,e[61]=G):G=e[61];let Q;e[62]!==ee||e[63]!==G?(Q=i.jsx(fe,{type:ee,placeholder:"sk-...",...G,size:"sm",className:"ph-no-capture pr-8"}),e[62]=ee,e[63]=G,e[64]=Q):Q=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(Ge,{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]!==Q||e[77]!==K?(D=i.jsxs("div",{className:"relative",children:[Q,K]}),e[76]=Q,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(Pt,{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(zt,{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(wt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:i.jsx(Ft,{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(Ye,{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 ni(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 li(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 ri(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 oi(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(It,{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}=Mt(t),m=h?o.filter(h):o.filter(Et);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 ai(){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=Ct();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(Ye,{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(_t,{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 G;e[53]!==W||e[54]!==Y||e[55]!==ee||e[56]!==A?(G=i.jsxs("div",{className:A,children:[W,Y,ee]}),e[53]=W,e[54]=Y,e[55]=ee,e[56]=A,e[57]=G):G=e[57];let Q;e[58]!==h||e[59]!==o||e[60]!==r?(Q=!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]=Q):Q=e[61];let Z;return e[62]!==G||e[63]!==Q||e[64]!==E?(Z=i.jsxs("div",{className:E,children:[G,Q]}),e[62]=G,e[63]=Q,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}=Ot();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 ci(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 di(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,di as M,ns as N,Xe as P,ni as S,ai as a,oi as b,ci as c,ri as g,li as i,Ee as m};
@@ -1,4 +1,4 @@
1
- import{N as P,q as De,c as k,R as Ie,r as Pe,t as se,v as E,w as Oe,T as H,x as je,y as M,z as L,A as ve,D as Q,B as Z,C as Fe,G as _e,H as Ve,I as Ke,J as q,f as Xe}from"./usage-stats-DKOEXU2h.js";const qe=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ue=P.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",k(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,o,l,r,s;const c=(t=(n=e.attrs)===null||n===void 0?void 0:n.src)!==null&&t!==void 0?t:"",i=(o=(l=e.attrs)===null||l===void 0?void 0:l.alt)!==null&&o!==void 0?o:"",a=(r=(s=e.attrs)===null||s===void 0?void 0:s.title)!==null&&r!==void 0?r:"";return a?`![${i}](${c} "${a}")`:`![${i}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:o}=this.options.resize,l=new Set(["src","width","height"]);return({node:r,getPos:s,HTMLAttributes:c,editor:i})=>{const a=document.createElement("img");a.draggable=!1;const d=k(this.options.HTMLAttributes,c);Object.entries(d).forEach(([w,S])=>{if(S!=null)switch(w){case"src":case"width":case"height":break;default:a.setAttribute(w,S)}}),d.src!==null&&(a.src=d.src);let u={...c};const f=w=>{if(typeof w=="string"&&w!==""){a.getAttribute("src")!==w&&(a.src=w);return}a.hasAttribute("src")&&a.removeAttribute("src"),a.src!==""&&(a.src="")};f(c.src);const p=w=>{if(w.type!==r.type)return!1;const S=i.extensionManager.attributes.filter(A=>A.type===w.type.name),y=Pe(w,S);return Object.keys(u).forEach(A=>{!l.has(A)&&!(A in y)&&a.removeAttribute(A)}),Object.entries(y).forEach(([A,R])=>{l.has(A)||(R!=null?a.setAttribute(A,R):a.removeAttribute(A))}),f(y.src),u=y,!0},h=new Ie({element:a,editor:i,node:r,getPos:s,onResize:(w,S)=>{a.style.width=`${w}px`,a.style.height=`${S}px`},onCommit:(w,S)=>{const y=s();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:w,height:S}).run()},onUpdate:p,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:o===!0}}),g=h.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",a.complete&&a.naturalWidth>0?m():(a.onload=m,a.onerror=m),h}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[De({find:qe,type:this.type,getAttributes:e=>{const[,,t,n,o]=e;return{src:n,alt:t,title:o}}})]}});var un=Ue;let ee,te;if(typeof WeakMap<"u"){let e=new WeakMap;ee=t=>e.get(t),te=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ee=o=>{for(let l=0;l<e.length;l+=2)if(e[l]==o)return e[l+1]},te=(o,l)=>(n==10&&(n=0),e[n++]=o,e[n++]=l)}var C=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,l=t/this.width|0;let r=o+1,s=l+1;for(let c=1;r<this.width&&this.map[t+c]==n;c++)r++;for(let c=1;s<this.height&&this.map[t+this.width*c]==n;c++)s++;return{left:o,top:l,right:r,bottom:s}}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:l,top:r,bottom:s}=this.findCell(e);return t=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(e,t){const{left:n,right:o,top:l,bottom:r}=this.findCell(e),{left:s,right:c,top:i,bottom:a}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(l,i),right:Math.max(o,c),bottom:Math.max(r,a)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let l=e.left;l<e.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==e.left&&l&&this.map[r-1]==s||o==e.top&&o&&this.map[r-this.width]==s)&&t.push(s))}return t}positionAt(e,t,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==e){let s=t+e*this.width;const c=(e+1)*this.width;for(;s<c&&this.map[s]<l;)s++;return s==c?r-1:this.map[s]}l=r}}static get(e){return ee(e)||te(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ge(e),n=e.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=t*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=e.child(a);d++;for(let h=0;;h++){for(;l<o.length&&o[l]!=0;)l++;if(h==u.childCount)break;const g=u.child(h),{colspan:m,rowspan:w,colwidth:S}=g.attrs;for(let y=0;y<w;y++){if(y+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-y});break}const A=l+y*t;for(let R=0;R<m;R++){o[A+R]==0?o[A+R]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:m-R});const O=S&&S[R];if(O){const D=(A+R)%t*2,G=s[D];G==null||G!=O&&s[D+1]==1?(s[D]=O,s[D+1]=1):G==O&&s[D+1]++}}}l+=m,d+=g.nodeSize}const f=(a+1)*t;let p=0;for(;l<f;)o[l++]==0&&p++;p&&(r||(r=[])).push({type:"missing",row:a,n:p}),d++}(t===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const c=new C(t,n,o,r);let i=!1;for(let a=0;!i&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(i=!0);return i&&Ye(c,s,e),c}function Ge(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const l=e.child(o);let r=0;if(n)for(let s=0;s<o;s++){const c=e.child(s);for(let i=0;i<c.childCount;i++){const a=c.child(i);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const c=l.child(s);r+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}t==-1?t=r:t!=r&&(t=Math.max(t,r))}return t}function Ye(e,t,n){e.problems||(e.problems=[]);const o={};for(let l=0;l<e.map.length;l++){const r=e.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let c=null;const i=s.attrs;for(let a=0;a<i.colspan;a++){const d=t[(l+a)%e.width*2];d!=null&&(!i.colwidth||i.colwidth[a]!=d)&&((c||(c=Qe(i)))[a]=d)}c&&e.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:c})}}function Qe(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function v(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],l=o.spec.tableRole;l&&(t[l]=o)}}return t}const $=new se("selectingCells");function W(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 Ze(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 T(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=W(t.$head)||et(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function et(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 ne(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function tt(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 Re(e,t,n){const o=e.node(-1),l=C.get(o),r=e.start(-1),s=l.nextCell(e.pos-r,t,n);return s==null?null:e.node(0).resolve(r+s)}function B(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(l=>l>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 l=0;l<n;l++)o.colwidth.splice(t,0,0)}return o}function nt(e,t,n){const o=v(t.type.schema).header_cell;for(let l=0;l<e.height;l++)if(t.nodeAt(e.map[n+l*e.width]).type!=o)return!1;return!0}var b=class N extends E{constructor(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.rectBetween(t.pos-r,n.pos-r),c=t.node(0),i=l.cellsInRect(s).filter(d=>d!=n.pos-r);i.unshift(n.pos-r);const a=i.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new je(c.resolve(f),c.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),l=t.resolve(n.map(this.$headCell.pos));if(ne(o)&&ne(l)&&ie(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?N.rowSelection(o,l):r&&this.isColSelection()?N.colSelection(o,l):new N(o,l)}return H.between(o,l)}content(){const t=this.$anchorCell.node(-1),n=C.get(t),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let i=l.top;i<l.bottom;i++){const a=[];for(let d=i*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const p=n.findCell(f);let h=t.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);const g=l.left-p.left,m=p.right-l.right;if(g>0||m>0){let w=h.attrs;if(g>0&&(w=B(w,0,g)),m>0&&(w=B(w,w.colspan-m,m)),p.left<l.left){if(h=h.type.createAndFill(w),!h)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else h=h.type.create(w,h.content)}if(p.top<l.top||p.bottom>l.bottom){const w={...h.attrs,rowspan:Math.min(p.bottom,l.bottom)-Math.max(p.top,l.top)};p.top<l.top?h=h.type.createAndFill(w):h=h.type.create(w,h.content)}a.push(h)}s.push(t.child(i).copy(M.from(a)))}const c=this.isColSelection()&&this.isRowSelection()?t:s;return new L(M.from(c),1,1)}replace(t,n=L.empty){const o=t.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:c,$to:i}=l[s],a=t.mapping.slice(o);t.replace(a.map(c.pos),a.map(i.pos),s?L.empty:n)}const r=E.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);r&&t.setSelection(r)}replaceWith(t,n){this.replace(t,new L(M.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=C.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)t(n.nodeAt(r[s]),l+r[s])}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,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.findCell(t.pos-r),c=l.findCell(n.pos-r),i=t.node(0);return s.top<=c.top?(s.top>0&&(t=i.resolve(r+l.map[s.left])),c.bottom<l.height&&(n=i.resolve(r+l.map[l.width*(l.height-1)+c.right-1]))):(c.top>0&&(n=i.resolve(r+l.map[c.left])),s.bottom<l.height&&(t=i.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new N(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=C.get(t),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,c=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,c)==n.width}eq(t){return t instanceof N&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.findCell(t.pos-r),c=l.findCell(n.pos-r),i=t.node(0);return s.left<=c.left?(s.left>0&&(t=i.resolve(r+l.map[s.top*l.width])),c.right<l.width&&(n=i.resolve(r+l.map[l.width*(c.top+1)-1]))):(c.left>0&&(n=i.resolve(r+l.map[c.top*l.width])),s.right<l.width&&(t=i.resolve(r+l.map[l.width*(s.top+1)-1]))),new N(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new N(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new N(t.resolve(n),t.resolve(o))}getBookmark(){return new ot(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;E.jsonID("cell",b);var ot=class Te{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Te(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):E.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(Z.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Q.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,l=e.depth;for(;l>=0&&!(e.after(l+1)<e.end(l));l--,n++);for(let r=t.depth;r>=0&&!(t.before(r+1)>t.start(r));r--,o--);return n==o&&/row|table/.test(e.node(l).type.spec.tableRole)}function st({$from:e,$to:t}){let n,o;for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&t.parentOffset===0}function it(e,t,n){const o=(t||e).selection,l=(t||e).doc;let r,s;if(o instanceof Fe&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=b.create(l,o.from);else if(s=="row"){const c=l.resolve(o.from+1);r=b.rowSelection(c,c)}else if(!n){const c=C.get(o.node),i=o.from+1,a=i+c.map[c.width*c.height-1];r=b.create(l,i+1,a)}}else o instanceof H&&rt(o)?r=H.create(l,o.from):o instanceof H&&st(o)&&(r=H.create(l,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}const ct=new se("fix-tables");function Me(e,t,n,o){const l=e.childCount,r=t.childCount;e:for(let s=0,c=0;s<r;s++){const i=t.child(s);for(let a=c,d=Math.min(l,s+3);a<d;a++)if(e.child(a)==i){c=a+1,n+=i.nodeSize;continue e}o(i,n),c<l&&e.child(c).sameMarkup(i)?Me(e.child(c),i,n+1,o):i.nodesBetween(0,i.content.size,o,n+1),n+=i.nodeSize}}function ze(e,t){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=at(e,l,r,n))};return t?t.doc!=e.doc&&Me(t.doc,e.doc,0,o):e.doc.descendants(o),n}function at(e,t,n,o){const l=C.get(t);if(!l.problems)return o;o||(o=e.tr);const r=[];for(let i=0;i<l.height;i++)r.push(0);for(let i=0;i<l.problems.length;i++){const a=l.problems[i];if(a.type=="collision"){const d=t.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,B(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=t.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=t.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+t.nodeSize)}}let s,c;for(let i=0;i<r.length;i++)r[i]&&(s==null&&(s=i),c=i);for(let i=0,a=n+1;i<l.height;i++){const d=t.child(i),u=a+d.nodeSize,f=r[i];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const h=[];for(let m=0;m<f;m++){const w=v(e.schema)[p].createAndFill();w&&h.push(w)}const g=(i==0||s==i-1)&&c==i?a+1:u-1;o.insert(o.mapping.map(g),h)}a=u}return o.setMeta(ct,{fixTables:!0})}function z(e){const t=e.selection,n=J(e),o=n.node(-1),l=n.start(-1),r=C.get(o);return{...t instanceof b?r.rectBetween(t.$anchorCell.pos-l,t.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function Ne(e,{map:t,tableStart:n,table:o},l){let r=l>0?-1:0;nt(t,o,l+r)&&(r=l==0||l==t.width?null:0);for(let s=0;s<t.height;s++){const c=s*t.width+l;if(l>0&&l<t.width&&t.map[c-1]==t.map[c]){const i=t.map[c],a=o.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,xe(a.attrs,l-t.colCount(i))),s+=a.attrs.rowspan-1}else{const i=r==null?v(o.type.schema).cell:o.nodeAt(t.map[c+r]).type,a=t.positionAt(s,l,o);e.insert(e.mapping.map(n+a),i.createAndFill())}}return e}function dt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ne(e.tr,n,n.left))}return!0}function ut(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},l){const r=e.mapping.maps.length;for(let s=0;s<t.height;){const c=s*t.width+l,i=t.map[c],a=n.nodeAt(i),d=a.attrs;if(l>0&&t.map[c-1]==i||l<t.width-1&&t.map[c+1]==i)e.setNodeMarkup(e.mapping.slice(r).map(o+i),null,B(d,l-t.colCount(i)));else{const u=e.mapping.slice(r).map(o+i);e.delete(u,u+a.nodeSize)}s+=d.rowspan}}function ht(e,t){if(!T(e))return!1;if(t){const n=z(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;ft(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=C.get(r)}t(o)}return!0}function pt(e,t,n){var o;const l=v(t.type.schema).header_cell;for(let r=0;r<e.width;r++)if(((o=t.nodeAt(e.map[r+n*e.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Ee(e,{map:t,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let c=l>0?-1:0;pt(t,o,l+c)&&(c=l==0||l==t.height?null:0);for(let a=0,d=t.width*l;a<t.width;a++,d++)if(l>0&&l<t.height&&t.map[d]==t.map[d-t.width]){const u=t.map[d],f=o.nodeAt(u).attrs;e.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var i;const u=c==null?v(o.type.schema).cell:(i=o.nodeAt(t.map[d+c*t.width]))===null||i===void 0?void 0:i.type,f=u?.createAndFill();f&&s.push(f)}return e.insert(r,v(o.type.schema).row.create(null,s)),e}function mt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ee(e.tr,n,n.top))}return!0}function gt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ee(e.tr,n,n.bottom))}return!0}function wt(e,{map:t,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,c=e.mapping.maps.length;e.delete(r+o,s+o);const i=new Set;for(let a=0,d=l*t.width;a<t.width;a++,d++){const u=t.map[d];if(!i.has(u)){if(i.add(u),l>0&&u==t.map[d-t.width]){const f=n.nodeAt(u).attrs;e.setNodeMarkup(e.mapping.slice(c).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<t.height&&u==t.map[d+t.width]){const f=n.nodeAt(u),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=t.positionAt(l+1,a,n);e.insert(e.mapping.slice(c).map(o+g),h),a+=p.colspan-1}}}}function bt(e,t){if(!T(e))return!1;if(t){const n=z(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;wt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=C.get(n.table)}t(o)}return!0}function ce(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Ct({width:e,height:t,map:n},o){let l=o.top*e+o.left,r=l,s=(o.bottom-1)*e+o.left,c=l+(o.right-o.left-1);for(let i=o.top;i<o.bottom;i++){if(o.left>0&&n[r]==n[r-1]||o.right<e&&n[c]==n[c+1])return!0;r+=e,c+=e}for(let i=o.left;i<o.right;i++){if(o.top>0&&n[l]==n[l-e]||o.bottom<t&&n[s]==n[s+e])return!0;l++,s++}return!1}function ae(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=z(e),{map:l}=o;if(Ct(l,o))return!1;if(t){const r=e.tr,s={};let c=M.empty,i,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],p=o.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,i==null)i=f,a=p;else{ce(p)||(c=c.append(p.content));const h=r.mapping.map(f+o.tableStart);r.delete(h,h+p.nodeSize)}}if(i==null||a==null)return!0;if(r.setNodeMarkup(i+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),c.size>0){const d=i+1+a.content.size,u=ce(a)?i+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,c)}r.setSelection(new b(r.doc.resolve(i+o.tableStart))),t(r)}return!0}function de(e,t){const n=v(e.schema);return yt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function yt(e){return(t,n)=>{const o=t.selection;let l,r;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Ze(o.$from),!l)return!1;r=(s=W(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let c=l.attrs;const i=[],a=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const d=z(t),u=t.tr;for(let p=0;p<d.right-d.left;p++)i.push(a?{...c,colwidth:a&&a[p]?[a[p]]:null}:c);let f;for(let p=d.top;p<d.bottom;p++){let h=d.map.positionAt(p,d.left,d.table);p==d.top&&(h+=l.nodeSize);for(let g=d.left,m=0;g<d.right;g++,m++)g==d.left&&p==d.top||u.insert(f=u.mapping.map(h+d.tableStart,1),e({node:l,row:p,col:g}).createAndFill(i[m]))}u.setNodeMarkup(r,e({node:l,row:d.top,col:d.left}),i[0]),o instanceof b&&u.setSelection(new b(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function At(e,t){return function(n,o){if(!T(n))return!1;const l=J(n);if(l.nodeAfter.attrs[e]===t)return!1;if(o){const r=n.tr;n.selection instanceof b?n.selection.forEachCell((s,c)=>{s.attrs[e]!==t&&r.setNodeMarkup(c,null,{...s.attrs,[e]:t})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[e]:t}),o(r)}return!0}}function St(e){return function(t,n){if(!T(t))return!1;if(n){const o=v(t.schema),l=z(t),r=t.tr,s=l.map.cellsInRect(e=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:e=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),c=s.map(i=>l.table.nodeAt(i));for(let i=0;i<s.length;i++)c[i].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[i],o.cell,c[i].attrs);if(r.steps.length===0)for(let i=0;i<s.length;i++)r.setNodeMarkup(l.tableStart+s[i],o.header_cell,c[i].attrs);n(r)}return!0}}function ue(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 l=0;l<o.length;l++){const r=t.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function I(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?St(e):function(n,o){if(!T(n))return!1;if(o){const l=v(n.schema),r=z(n),s=n.tr,c=ue("row",r,l),i=ue("column",r,l),a=(e==="column"?c:e==="row"&&i)?1:0,d=e=="column"?{left:0,top:a,right:1,bottom:r.map.height}:e=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=e=="column"?i?l.cell:l.header_cell:e=="row"?c?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const p=f+r.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,u,h.attrs)}),o(s)}return!0}}I("row",{useDeprecatedLogic:!0});I("column",{useDeprecatedLogic:!0});const vt=I("cell",{useDeprecatedLogic:!0});function Rt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,l=e.before();o>=0;o--){const r=e.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.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),l=e.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function fe(e){return function(t,n){if(!T(t))return!1;const o=Rt(J(t),e);if(o==null)return!1;if(n){const l=t.doc.resolve(o);n(t.tr.setSelection(H.between(l,tt(l))).scrollIntoView())}return!0}}function xt(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 j(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,l=v(e.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new L(l,0,0))}),o.docChanged&&t(o)}return!0}function Tt(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 l=t.child(0),r=l.type.spec.tableRole,s=l.type.schema,c=[];if(r=="row")for(let i=0;i<t.childCount;i++){let a=t.child(i).content;const d=i?0:Math.max(0,n-1),u=i<t.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=oe(v(s).row,new L(a,d,u)).content),c.push(a)}else if(r=="cell"||r=="header_cell")c.push(n||o?oe(v(s).row,new L(t,n,o)).content:t);else return null;return Mt(s,c)}function Mt(e,t){const n=[];for(let l=0;l<t.length;l++){const r=t[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:c,colspan:i}=r.child(s).attrs;for(let a=l;a<l+c;a++)n[a]=(n[a]||0)+i}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=t.length&&t.push(M.empty),n[l]<o){const r=v(e).cell.createAndFill(),s=[];for(let c=n[l];c<o;c++)s.push(r);t[l]=t[l].append(M.from(s))}return{height:t.length,width:o,rows:t}}function oe(e,t){const n=e.createAndFill();return new _e(n).replace(0,n.content.size,t).doc}function zt({width:e,height:t,rows:n},o,l){if(e!=o){const r=[],s=[];for(let c=0;c<n.length;c++){const i=n[c],a=[];for(let d=r[c]||0,u=0;d<o;u++){let f=i.child(u%i.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(B(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)r[c+p]=(r[c+p]||0)+f.attrs.colspan}s.push(M.from(a))}n=s,e=o}if(t!=l){const r=[];for(let s=0,c=0;s<l;s++,c++){const i=[],a=n[c%t];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),i.push(u)}r.push(M.from(i))}n=r,t=l}return{width:e,height:t,rows:n}}function Nt(e,t,n,o,l,r,s){const c=e.doc.type.schema,i=v(c);let a,d;if(l>t.width)for(let u=0,f=0;u<t.height;u++){const p=n.child(u);f+=p.nodeSize;const h=[];let g;p.lastChild==null||p.lastChild.type==i.cell?g=a||(a=i.cell.createAndFill()):g=d||(d=i.header_cell.createAndFill());for(let m=t.width;m<l;m++)h.push(g);e.insert(e.mapping.slice(s).map(f-1+o),h)}if(r>t.height){const u=[];for(let h=0,g=(t.height-1)*t.width;h<Math.max(t.width,l);h++){const m=h>=t.width?!1:n.nodeAt(t.map[g+h]).type==i.header_cell;u.push(m?d||(d=i.header_cell.createAndFill()):a||(a=i.cell.createAndFill()))}const f=i.row.create(null,M.from(u)),p=[];for(let h=t.height;h<r;h++)p.push(f);e.insert(e.mapping.slice(s).map(o+n.nodeSize-2),p)}return!!(a||d)}function he(e,t,n,o,l,r,s,c){if(s==0||s==t.height)return!1;let i=!1;for(let a=l;a<r;a++){const d=s*t.width+a,u=t.map[d];if(t.map[d-t.width]==u){i=!0;const f=n.nodeAt(u),{top:p,left:h}=t.findCell(u);e.setNodeMarkup(e.mapping.slice(c).map(u+o),null,{...f.attrs,rowspan:s-p}),e.insert(e.mapping.slice(c).map(t.positionAt(s,h,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return i}function pe(e,t,n,o,l,r,s,c){if(s==0||s==t.width)return!1;let i=!1;for(let a=l;a<r;a++){const d=a*t.width+s,u=t.map[d];if(t.map[d-1]==u){i=!0;const f=n.nodeAt(u),p=t.colCount(u),h=e.mapping.slice(c).map(u+o);e.setNodeMarkup(h,null,B(f.attrs,s-p,f.attrs.colspan-(s-p))),e.insert(h+f.nodeSize,f.type.createAndFill(B(f.attrs,0,s-p))),a+=f.attrs.rowspan-1}}return i}function me(e,t,n,o,l){let r=n?e.doc.nodeAt(n-1):e.doc;if(!r)throw new Error("No table found");let s=C.get(r);const{top:c,left:i}=o,a=i+l.width,d=c+l.height,u=e.tr;let f=0;function p(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=C.get(r),f=u.mapping.maps.length}Nt(u,s,r,n,a,d,f)&&p(),he(u,s,r,n,i,a,c,f)&&p(),he(u,s,r,n,i,a,d,f)&&p(),pe(u,s,r,n,c,d,i,f)&&p(),pe(u,s,r,n,c,d,a,f)&&p();for(let h=c;h<d;h++){const g=s.positionAt(h,i,r),m=s.positionAt(h,a,r);u.replace(u.mapping.slice(f).map(g+n),u.mapping.slice(f).map(m+n),new L(l.rows[h-c],0,0))}p(),u.setSelection(new b(u.doc.resolve(n+s.positionAt(c,i,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),t(u)}const Et=Oe({ArrowLeft:F("horiz",-1),ArrowRight:F("horiz",1),ArrowUp:F("vert",-1),ArrowDown:F("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:j,"Mod-Backspace":j,Delete:j,"Mod-Delete":j});function K(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function F(e,t){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof b)return K(n,o,E.near(r.$headCell,t));if(e!="horiz"&&!r.empty)return!1;const s=He(l,e,t);if(s==null)return!1;if(e=="horiz")return K(n,o,E.near(n.doc.resolve(r.head+t),t));{const c=n.doc.resolve(s),i=Re(c,e,t);let a;return i?a=E.near(i,1):t<0?a=E.near(n.doc.resolve(c.before(-1)),-1):a=E.near(n.doc.resolve(c.after(-1)),1),K(n,o,a)}}}function _(e,t){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof b)s=r;else{const i=He(l,e,t);if(i==null)return!1;s=new b(n.doc.resolve(i))}const c=Re(s.$headCell,e,t);return c?K(n,o,new b(s.$anchorCell,c)):!1}}function Ht(e,t){const n=e.state.doc,o=W(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function $t(e,t,n){if(!T(e.state))return!1;let o=Tt(n);const l=e.state.selection;if(l instanceof b){o||(o={width:1,height:1,rows:[M.from(oe(v(e.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),c=C.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=zt(o,c.right-c.left,c.bottom-c.top),me(e.state,e.dispatch,s,c,o),!0}else if(o){const r=J(e.state),s=r.start(-1);return me(e.state,e.dispatch,s,C.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function Lt(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ge(e,t.target);let l;if(t.shiftKey&&e.state.selection instanceof b)r(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(l=W(e.state.selection.$anchor))!=null&&((n=Y(e,t))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,t),t.preventDefault();else if(!o)return;function r(i,a){let d=Y(e,a);const u=$.getState(e.state)==null;if(!d||!ie(i,d))if(u)d=i;else return;const f=new b(i,d);if(u||!e.state.selection.eq(f)){const p=e.state.tr.setSelection(f);u&&p.setMeta($,i.pos),e.dispatch(p)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",c),$.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta($,-1))}function c(i){const a=i,d=$.getState(e.state);let u;if(d!=null)u=e.state.doc.resolve(d);else if(ge(e,a.target)!=o&&(u=Y(e,t),!u))return s();u&&r(u,a)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",c)}function He(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),c=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(c)?s:null}}return null}function ge(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Y(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:l}=n;return o>=0&&W(e.state.doc.resolve(o))||W(e.state.doc.resolve(l))}var kt=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),le(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,le(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function le(e,t,n,o,l,r){let s=0,c=!0,i=t.firstChild;const a=e.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:p,colwidth:h}=a.child(u).attrs;for(let g=0;g<p;g++,f++){const m=l==f?r:h&&h[g],w=m?m+"px":"";if(s+=m||o,m||(c=!1),i)i.style.width!=w&&(i.style.width=w),i=i.nextSibling;else{const S=document.createElement("col");S.style.width=w,t.appendChild(S)}}}for(;i;){var d;const u=i.nextSibling;(d=i.parentNode)===null||d===void 0||d.removeChild(i),i=u}c?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const x=new se("tableColumnResizing");function Wt({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=kt,lastColumnResizable:l=!0}={}){const r=new ve({key:x,state:{init(s,c){var i;const a=(i=r.spec)===null||i===void 0||(i=i.props)===null||i===void 0?void 0:i.nodeViews,d=v(c.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new Bt(-1,!1)},apply(s,c){return c.apply(s)}},props:{attributes:s=>{const c=x.getState(s);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,c)=>{Dt(s,c,e,l)},mouseleave:s=>{It(s)},mousedown:(s,c)=>{Pt(s,c,t,n)}},decorations:s=>{const c=x.getState(s);if(c&&c.activeHandle>-1)return Vt(s,c.activeHandle)},nodeViews:{}}});return r}var Bt=class X{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(x);if(o&&o.setHandle!=null)return new X(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new X(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let l=t.mapping.map(n.activeHandle,-1);return ne(t.doc.resolve(l))||(l=-1),new X(l,n.dragging)}return n}};function Dt(e,t,n,o){if(!e.editable)return;const l=x.getState(e.state);if(l&&!l.dragging){const r=jt(t.target);let s=-1;if(r){const{left:c,right:i}=r.getBoundingClientRect();t.clientX-c<=n?s=we(e,t,"left",n):i-t.clientX<=n&&(s=we(e,t,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const c=e.state.doc.resolve(s),i=c.node(-1),a=C.get(i),d=c.start(-1);if(a.colCount(c.pos-d)+c.nodeAfter.attrs.colspan-1==a.width-1)return}$e(e,s)}}}function It(e){if(!e.editable)return;const t=x.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function Pt(e,t,n,o){var l;if(!e.editable)return!1;const r=(l=e.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=x.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const c=e.state.doc.nodeAt(s.activeHandle),i=Ot(e,s.activeHandle,c.attrs);e.dispatch(e.state.tr.setMeta(x,{setDragging:{startX:t.clientX,startWidth:i}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=x.getState(e.state);f?.dragging&&(Ft(e,f.activeHandle,be(f.dragging,u,n)),e.dispatch(e.state.tr.setMeta(x,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=x.getState(e.state);if(f&&f.dragging){const p=be(f.dragging,u,n);Ce(e,f.activeHandle,p,o)}}return Ce(e,s.activeHandle,i,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),t.preventDefault(),!0}function Ot(e,t,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=e.domAtPos(t);let s=r.node.childNodes[r.offset].offsetWidth,c=n;if(o)for(let i=0;i<n;i++)o[i]&&(s-=o[i],c--);return s/c}function jt(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function we(e,t,n,o){const l=n=="right"?-o:o,r=e.posAtCoords({left:t.clientX+l,top:t.clientY});if(!r)return-1;const{pos:s}=r,c=W(e.state.doc.resolve(s));if(!c)return-1;if(n=="right")return c.pos;const i=C.get(c.node(-1)),a=c.start(-1),d=i.map.indexOf(c.pos-a);return d%i.width==0?-1:a+i.map[d-1]}function be(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(x,{setHandle:t}))}function Ft(e,t,n){const o=e.state.doc.resolve(t),l=o.node(-1),r=C.get(l),s=o.start(-1),c=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,i=e.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+c;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,p=f.colspan==1?0:c-r.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;const h=f.colwidth?f.colwidth.slice():_t(f.colspan);h[p]=n,i.setNodeMarkup(s+u,null,{...f,colwidth:h})}i.docChanged&&e.dispatch(i)}function Ce(e,t,n,o){const l=e.state.doc.resolve(t),r=l.node(-1),s=l.start(-1),c=C.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let i=e.domAtPos(l.start(-1)).node;for(;i&&i.nodeName!="TABLE";)i=i.parentNode;i&&le(r,i.firstChild,i,o,c,n)}function _t(e){return Array(e).fill(0)}function Vt(e,t){const n=[],o=e.doc.resolve(t),l=o.node(-1);if(!l)return Q.empty;const r=C.get(l),s=o.start(-1),c=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=c+a*r.width;if((c==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var i;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((i=x.getState(e))===null||i===void 0)&&i.dragging&&n.push(Z.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(Z.widget(f,p))}}return Q.create(e.doc,n)}function Kt({allowTableNodeSelection:e=!1}={}){return new ve({key:$,state:{init(){return null},apply(t,n){const o=t.getMeta($);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:l,pos:r}=t.mapping.mapResult(n);return l?null:r}},props:{decorations:lt,handleDOMEvents:{mousedown:Lt},createSelectionBetween(t){return $.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Ht,handleKeyDown:Et,handlePaste:$t},appendTransaction(t,n,o){return it(o,ze(o,n),e)}})}function U(e){return e==="left"||e==="right"||e==="center"?e:null}function Xt(e){const t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase();return U(t||n)}function qt(e){return U(e?.align)}function Le(){return{default:null,parseHTML:e=>Xt(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function Ut(e){var t;const n=e.parentElement,o=e.closest("table");if(!n||!o)return null;const l=Array.from(n.children).indexOf(e),r=(t=o.querySelectorAll("colgroup > col")[l])===null||t===void 0?void 0:t.getAttribute("width");return r?[parseInt(r,10)]:null}function ke(e){const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):Ut(e)}const Jt=/[ \t\r\n\f]+/g;function We(e){var t;return e.children.length>0?!1:((t=e.textContent)!==null&&t!==void 0?t:"").replace(Jt,"")===""}function Be(e){const t=e.createAndFill();if(!t)throw new Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}const Gt=P.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:ke},align:Le()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:e=>We(e)?{}:!1,getContent:(e,t)=>Be(t.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",k(this.options.HTMLAttributes,e),0]}}),Yt=P.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:ke},align:Le()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:e=>We(e)?{}:!1,getContent:(e,t)=>Be(t.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",k(this.options.HTMLAttributes,e),0]}}),Qt=P.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",k(this.options.HTMLAttributes,e),0]}});function re(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function ye(e,t,n,o,l,r){let s=0,c=!0,i=t.firstChild;const a=e.firstChild;if(a!==null)for(let f=0,p=0;f<a.childCount;f+=1){const{colspan:h,colwidth:g}=a.child(f).attrs;for(let m=0;m<h;m+=1,p+=1){const w=l===p?r:g&&g[m],S=w?`${w}px`:"";if(s+=w||o,w||(c=!1),i){if(i.style.width!==S){const[y,A]=re(o,w);i.style.setProperty(y,A)}i=i.nextSibling}else{const y=document.createElement("col"),[A,R]=re(o,w);y.style.setProperty(A,R),t.appendChild(y)}}}for(;i;){var d;const f=i.nextSibling;(d=i.parentNode)===null||d===void 0||d.removeChild(i),i=f}const u=e.attrs.style&&typeof e.attrs.style=="string"&&/\bwidth\s*:/i.test(e.attrs.style);c&&!u?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var Zt=class{constructor(e,t,n,o={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[l,r]of Object.entries(o))r!=null&&(l==="style"?this.table.style.cssText=String(r):this.table.setAttribute(l,String(r)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ye(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,ye(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){const t=e.target,n=this.dom.contains(t),o=this.contentDOM.contains(t);return!!(n&&!o&&(e.type==="attributes"||e.type==="childList"||e.type==="characterData"))}};function en(e,t,n,o){let l=0,r=!0;const s=[],c=e.firstChild;if(!c)return{};for(let d=0,u=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let h=0;h<f;h+=1,u+=1){const g=n===u?o:p&&p[h];l+=g||t,g||(r=!1);const[m,w]=re(t,g);s.push(["col",{style:`${m}: ${w}`}])}}const i=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:i,tableMinWidth:a}}function Ae(e,t){return e.createAndFill()}function tn(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const o=e.nodes[n];o.spec.tableRole&&(t[o.spec.tableRole]=o)}),e.cached.tableNodeTypes=t,t}function nn(e,t,n,o,l){const r=tn(e),s=[],c=[];for(let a=0;a<n;a+=1){const d=Ae(r.cell);if(d&&c.push(d),o){const u=Ae(r.header_cell);u&&s.push(u)}}const i=[];for(let a=0;a<t;a+=1)i.push(r.row.createChecked(null,o&&a===0?s:c));return r.table.createChecked(null,i)}function on(e){return e instanceof b}const V=({editor:e})=>{const{selection:t}=e.state;if(!on(t))return!1;let n=0;const o=q(t.ranges[0].$from,l=>l.type.name==="table");return o?.node.descendants(l=>{if(l.type.name==="table")return!1;["tableCell","tableHeader"].includes(l.type.name)&&(n+=1)}),n!==t.ranges.length?!1:(e.commands.deleteTable(),!0)};function Se(e,t){const n=e.mapping.map(t),o=q(e.selection.$from,s=>s.type.name==="table");if(o?.pos===n)return;const l=e.doc.nodeAt(n);if(!l)return;const r=n+l.nodeSize-1;e.setSelection(H.near(e.doc.resolve(r),-1))}function ln(e){let t="",n=0;for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let o=0;for(;n+o<e.length&&e[n+o]==="`";)o+=1;let l=n+o,r=!1;for(;l<e.length;){if(e[l]!=="`"){l+=1;continue}let s=0;for(;l+s<e.length&&e[l+s]==="`";)s+=1;if(s===o){const c=e.slice(n+o,l);t+=e.slice(n,n+o)+c.replace(/\\\||\|/g,i=>i==="|"?"\\|":i)+e.slice(l,l+o),n=l+o,r=!0;break}l+=s}r||(t+=e.slice(n,n+o),n+=o)}return t}function rn(e){return e.split(`
1
+ import{N as P,q as De,c as k,R as Ie,r as Pe,t as se,v as E,w as Oe,T as H,x as je,y as M,z as L,A as ve,D as Q,B as Z,C as Fe,G as _e,H as Ve,I as Ke,J as q,f as Xe}from"./usage-stats-DTw2_3QF.js";const qe=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ue=P.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",k(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,o,l,r,s;const c=(t=(n=e.attrs)===null||n===void 0?void 0:n.src)!==null&&t!==void 0?t:"",i=(o=(l=e.attrs)===null||l===void 0?void 0:l.alt)!==null&&o!==void 0?o:"",a=(r=(s=e.attrs)===null||s===void 0?void 0:s.title)!==null&&r!==void 0?r:"";return a?`![${i}](${c} "${a}")`:`![${i}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:o}=this.options.resize,l=new Set(["src","width","height"]);return({node:r,getPos:s,HTMLAttributes:c,editor:i})=>{const a=document.createElement("img");a.draggable=!1;const d=k(this.options.HTMLAttributes,c);Object.entries(d).forEach(([w,S])=>{if(S!=null)switch(w){case"src":case"width":case"height":break;default:a.setAttribute(w,S)}}),d.src!==null&&(a.src=d.src);let u={...c};const f=w=>{if(typeof w=="string"&&w!==""){a.getAttribute("src")!==w&&(a.src=w);return}a.hasAttribute("src")&&a.removeAttribute("src"),a.src!==""&&(a.src="")};f(c.src);const p=w=>{if(w.type!==r.type)return!1;const S=i.extensionManager.attributes.filter(A=>A.type===w.type.name),y=Pe(w,S);return Object.keys(u).forEach(A=>{!l.has(A)&&!(A in y)&&a.removeAttribute(A)}),Object.entries(y).forEach(([A,R])=>{l.has(A)||(R!=null?a.setAttribute(A,R):a.removeAttribute(A))}),f(y.src),u=y,!0},h=new Ie({element:a,editor:i,node:r,getPos:s,onResize:(w,S)=>{a.style.width=`${w}px`,a.style.height=`${S}px`},onCommit:(w,S)=>{const y=s();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:w,height:S}).run()},onUpdate:p,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:o===!0}}),g=h.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",a.complete&&a.naturalWidth>0?m():(a.onload=m,a.onerror=m),h}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[De({find:qe,type:this.type,getAttributes:e=>{const[,,t,n,o]=e;return{src:n,alt:t,title:o}}})]}});var un=Ue;let ee,te;if(typeof WeakMap<"u"){let e=new WeakMap;ee=t=>e.get(t),te=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ee=o=>{for(let l=0;l<e.length;l+=2)if(e[l]==o)return e[l+1]},te=(o,l)=>(n==10&&(n=0),e[n++]=o,e[n++]=l)}var C=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,l=t/this.width|0;let r=o+1,s=l+1;for(let c=1;r<this.width&&this.map[t+c]==n;c++)r++;for(let c=1;s<this.height&&this.map[t+this.width*c]==n;c++)s++;return{left:o,top:l,right:r,bottom:s}}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:l,top:r,bottom:s}=this.findCell(e);return t=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(e,t){const{left:n,right:o,top:l,bottom:r}=this.findCell(e),{left:s,right:c,top:i,bottom:a}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(l,i),right:Math.max(o,c),bottom:Math.max(r,a)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let l=e.left;l<e.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==e.left&&l&&this.map[r-1]==s||o==e.top&&o&&this.map[r-this.width]==s)&&t.push(s))}return t}positionAt(e,t,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==e){let s=t+e*this.width;const c=(e+1)*this.width;for(;s<c&&this.map[s]<l;)s++;return s==c?r-1:this.map[s]}l=r}}static get(e){return ee(e)||te(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ge(e),n=e.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=t*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=e.child(a);d++;for(let h=0;;h++){for(;l<o.length&&o[l]!=0;)l++;if(h==u.childCount)break;const g=u.child(h),{colspan:m,rowspan:w,colwidth:S}=g.attrs;for(let y=0;y<w;y++){if(y+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-y});break}const A=l+y*t;for(let R=0;R<m;R++){o[A+R]==0?o[A+R]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:m-R});const O=S&&S[R];if(O){const D=(A+R)%t*2,G=s[D];G==null||G!=O&&s[D+1]==1?(s[D]=O,s[D+1]=1):G==O&&s[D+1]++}}}l+=m,d+=g.nodeSize}const f=(a+1)*t;let p=0;for(;l<f;)o[l++]==0&&p++;p&&(r||(r=[])).push({type:"missing",row:a,n:p}),d++}(t===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const c=new C(t,n,o,r);let i=!1;for(let a=0;!i&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(i=!0);return i&&Ye(c,s,e),c}function Ge(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const l=e.child(o);let r=0;if(n)for(let s=0;s<o;s++){const c=e.child(s);for(let i=0;i<c.childCount;i++){const a=c.child(i);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const c=l.child(s);r+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}t==-1?t=r:t!=r&&(t=Math.max(t,r))}return t}function Ye(e,t,n){e.problems||(e.problems=[]);const o={};for(let l=0;l<e.map.length;l++){const r=e.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let c=null;const i=s.attrs;for(let a=0;a<i.colspan;a++){const d=t[(l+a)%e.width*2];d!=null&&(!i.colwidth||i.colwidth[a]!=d)&&((c||(c=Qe(i)))[a]=d)}c&&e.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:c})}}function Qe(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function v(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],l=o.spec.tableRole;l&&(t[l]=o)}}return t}const $=new se("selectingCells");function W(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 Ze(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 T(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=W(t.$head)||et(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function et(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 ne(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function tt(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 Re(e,t,n){const o=e.node(-1),l=C.get(o),r=e.start(-1),s=l.nextCell(e.pos-r,t,n);return s==null?null:e.node(0).resolve(r+s)}function B(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(l=>l>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 l=0;l<n;l++)o.colwidth.splice(t,0,0)}return o}function nt(e,t,n){const o=v(t.type.schema).header_cell;for(let l=0;l<e.height;l++)if(t.nodeAt(e.map[n+l*e.width]).type!=o)return!1;return!0}var b=class N extends E{constructor(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.rectBetween(t.pos-r,n.pos-r),c=t.node(0),i=l.cellsInRect(s).filter(d=>d!=n.pos-r);i.unshift(n.pos-r);const a=i.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new je(c.resolve(f),c.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),l=t.resolve(n.map(this.$headCell.pos));if(ne(o)&&ne(l)&&ie(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?N.rowSelection(o,l):r&&this.isColSelection()?N.colSelection(o,l):new N(o,l)}return H.between(o,l)}content(){const t=this.$anchorCell.node(-1),n=C.get(t),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let i=l.top;i<l.bottom;i++){const a=[];for(let d=i*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const p=n.findCell(f);let h=t.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);const g=l.left-p.left,m=p.right-l.right;if(g>0||m>0){let w=h.attrs;if(g>0&&(w=B(w,0,g)),m>0&&(w=B(w,w.colspan-m,m)),p.left<l.left){if(h=h.type.createAndFill(w),!h)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else h=h.type.create(w,h.content)}if(p.top<l.top||p.bottom>l.bottom){const w={...h.attrs,rowspan:Math.min(p.bottom,l.bottom)-Math.max(p.top,l.top)};p.top<l.top?h=h.type.createAndFill(w):h=h.type.create(w,h.content)}a.push(h)}s.push(t.child(i).copy(M.from(a)))}const c=this.isColSelection()&&this.isRowSelection()?t:s;return new L(M.from(c),1,1)}replace(t,n=L.empty){const o=t.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:c,$to:i}=l[s],a=t.mapping.slice(o);t.replace(a.map(c.pos),a.map(i.pos),s?L.empty:n)}const r=E.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);r&&t.setSelection(r)}replaceWith(t,n){this.replace(t,new L(M.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=C.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)t(n.nodeAt(r[s]),l+r[s])}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,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.findCell(t.pos-r),c=l.findCell(n.pos-r),i=t.node(0);return s.top<=c.top?(s.top>0&&(t=i.resolve(r+l.map[s.left])),c.bottom<l.height&&(n=i.resolve(r+l.map[l.width*(l.height-1)+c.right-1]))):(c.top>0&&(n=i.resolve(r+l.map[c.left])),s.bottom<l.height&&(t=i.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new N(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=C.get(t),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,c=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,c)==n.width}eq(t){return t instanceof N&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),l=C.get(o),r=t.start(-1),s=l.findCell(t.pos-r),c=l.findCell(n.pos-r),i=t.node(0);return s.left<=c.left?(s.left>0&&(t=i.resolve(r+l.map[s.top*l.width])),c.right<l.width&&(n=i.resolve(r+l.map[l.width*(c.top+1)-1]))):(c.left>0&&(n=i.resolve(r+l.map[c.top*l.width])),s.right<l.width&&(t=i.resolve(r+l.map[l.width*(s.top+1)-1]))),new N(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new N(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new N(t.resolve(n),t.resolve(o))}getBookmark(){return new ot(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;E.jsonID("cell",b);var ot=class Te{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Te(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):E.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(Z.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Q.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,l=e.depth;for(;l>=0&&!(e.after(l+1)<e.end(l));l--,n++);for(let r=t.depth;r>=0&&!(t.before(r+1)>t.start(r));r--,o--);return n==o&&/row|table/.test(e.node(l).type.spec.tableRole)}function st({$from:e,$to:t}){let n,o;for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&t.parentOffset===0}function it(e,t,n){const o=(t||e).selection,l=(t||e).doc;let r,s;if(o instanceof Fe&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=b.create(l,o.from);else if(s=="row"){const c=l.resolve(o.from+1);r=b.rowSelection(c,c)}else if(!n){const c=C.get(o.node),i=o.from+1,a=i+c.map[c.width*c.height-1];r=b.create(l,i+1,a)}}else o instanceof H&&rt(o)?r=H.create(l,o.from):o instanceof H&&st(o)&&(r=H.create(l,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}const ct=new se("fix-tables");function Me(e,t,n,o){const l=e.childCount,r=t.childCount;e:for(let s=0,c=0;s<r;s++){const i=t.child(s);for(let a=c,d=Math.min(l,s+3);a<d;a++)if(e.child(a)==i){c=a+1,n+=i.nodeSize;continue e}o(i,n),c<l&&e.child(c).sameMarkup(i)?Me(e.child(c),i,n+1,o):i.nodesBetween(0,i.content.size,o,n+1),n+=i.nodeSize}}function ze(e,t){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=at(e,l,r,n))};return t?t.doc!=e.doc&&Me(t.doc,e.doc,0,o):e.doc.descendants(o),n}function at(e,t,n,o){const l=C.get(t);if(!l.problems)return o;o||(o=e.tr);const r=[];for(let i=0;i<l.height;i++)r.push(0);for(let i=0;i<l.problems.length;i++){const a=l.problems[i];if(a.type=="collision"){const d=t.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,B(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=t.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=t.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+t.nodeSize)}}let s,c;for(let i=0;i<r.length;i++)r[i]&&(s==null&&(s=i),c=i);for(let i=0,a=n+1;i<l.height;i++){const d=t.child(i),u=a+d.nodeSize,f=r[i];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const h=[];for(let m=0;m<f;m++){const w=v(e.schema)[p].createAndFill();w&&h.push(w)}const g=(i==0||s==i-1)&&c==i?a+1:u-1;o.insert(o.mapping.map(g),h)}a=u}return o.setMeta(ct,{fixTables:!0})}function z(e){const t=e.selection,n=J(e),o=n.node(-1),l=n.start(-1),r=C.get(o);return{...t instanceof b?r.rectBetween(t.$anchorCell.pos-l,t.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function Ne(e,{map:t,tableStart:n,table:o},l){let r=l>0?-1:0;nt(t,o,l+r)&&(r=l==0||l==t.width?null:0);for(let s=0;s<t.height;s++){const c=s*t.width+l;if(l>0&&l<t.width&&t.map[c-1]==t.map[c]){const i=t.map[c],a=o.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,xe(a.attrs,l-t.colCount(i))),s+=a.attrs.rowspan-1}else{const i=r==null?v(o.type.schema).cell:o.nodeAt(t.map[c+r]).type,a=t.positionAt(s,l,o);e.insert(e.mapping.map(n+a),i.createAndFill())}}return e}function dt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ne(e.tr,n,n.left))}return!0}function ut(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},l){const r=e.mapping.maps.length;for(let s=0;s<t.height;){const c=s*t.width+l,i=t.map[c],a=n.nodeAt(i),d=a.attrs;if(l>0&&t.map[c-1]==i||l<t.width-1&&t.map[c+1]==i)e.setNodeMarkup(e.mapping.slice(r).map(o+i),null,B(d,l-t.colCount(i)));else{const u=e.mapping.slice(r).map(o+i);e.delete(u,u+a.nodeSize)}s+=d.rowspan}}function ht(e,t){if(!T(e))return!1;if(t){const n=z(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;ft(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=C.get(r)}t(o)}return!0}function pt(e,t,n){var o;const l=v(t.type.schema).header_cell;for(let r=0;r<e.width;r++)if(((o=t.nodeAt(e.map[r+n*e.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Ee(e,{map:t,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let c=l>0?-1:0;pt(t,o,l+c)&&(c=l==0||l==t.height?null:0);for(let a=0,d=t.width*l;a<t.width;a++,d++)if(l>0&&l<t.height&&t.map[d]==t.map[d-t.width]){const u=t.map[d],f=o.nodeAt(u).attrs;e.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var i;const u=c==null?v(o.type.schema).cell:(i=o.nodeAt(t.map[d+c*t.width]))===null||i===void 0?void 0:i.type,f=u?.createAndFill();f&&s.push(f)}return e.insert(r,v(o.type.schema).row.create(null,s)),e}function mt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ee(e.tr,n,n.top))}return!0}function gt(e,t){if(!T(e))return!1;if(t){const n=z(e);t(Ee(e.tr,n,n.bottom))}return!0}function wt(e,{map:t,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,c=e.mapping.maps.length;e.delete(r+o,s+o);const i=new Set;for(let a=0,d=l*t.width;a<t.width;a++,d++){const u=t.map[d];if(!i.has(u)){if(i.add(u),l>0&&u==t.map[d-t.width]){const f=n.nodeAt(u).attrs;e.setNodeMarkup(e.mapping.slice(c).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<t.height&&u==t.map[d+t.width]){const f=n.nodeAt(u),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=t.positionAt(l+1,a,n);e.insert(e.mapping.slice(c).map(o+g),h),a+=p.colspan-1}}}}function bt(e,t){if(!T(e))return!1;if(t){const n=z(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;wt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=C.get(n.table)}t(o)}return!0}function ce(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Ct({width:e,height:t,map:n},o){let l=o.top*e+o.left,r=l,s=(o.bottom-1)*e+o.left,c=l+(o.right-o.left-1);for(let i=o.top;i<o.bottom;i++){if(o.left>0&&n[r]==n[r-1]||o.right<e&&n[c]==n[c+1])return!0;r+=e,c+=e}for(let i=o.left;i<o.right;i++){if(o.top>0&&n[l]==n[l-e]||o.bottom<t&&n[s]==n[s+e])return!0;l++,s++}return!1}function ae(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=z(e),{map:l}=o;if(Ct(l,o))return!1;if(t){const r=e.tr,s={};let c=M.empty,i,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],p=o.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,i==null)i=f,a=p;else{ce(p)||(c=c.append(p.content));const h=r.mapping.map(f+o.tableStart);r.delete(h,h+p.nodeSize)}}if(i==null||a==null)return!0;if(r.setNodeMarkup(i+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),c.size>0){const d=i+1+a.content.size,u=ce(a)?i+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,c)}r.setSelection(new b(r.doc.resolve(i+o.tableStart))),t(r)}return!0}function de(e,t){const n=v(e.schema);return yt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function yt(e){return(t,n)=>{const o=t.selection;let l,r;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Ze(o.$from),!l)return!1;r=(s=W(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let c=l.attrs;const i=[],a=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const d=z(t),u=t.tr;for(let p=0;p<d.right-d.left;p++)i.push(a?{...c,colwidth:a&&a[p]?[a[p]]:null}:c);let f;for(let p=d.top;p<d.bottom;p++){let h=d.map.positionAt(p,d.left,d.table);p==d.top&&(h+=l.nodeSize);for(let g=d.left,m=0;g<d.right;g++,m++)g==d.left&&p==d.top||u.insert(f=u.mapping.map(h+d.tableStart,1),e({node:l,row:p,col:g}).createAndFill(i[m]))}u.setNodeMarkup(r,e({node:l,row:d.top,col:d.left}),i[0]),o instanceof b&&u.setSelection(new b(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function At(e,t){return function(n,o){if(!T(n))return!1;const l=J(n);if(l.nodeAfter.attrs[e]===t)return!1;if(o){const r=n.tr;n.selection instanceof b?n.selection.forEachCell((s,c)=>{s.attrs[e]!==t&&r.setNodeMarkup(c,null,{...s.attrs,[e]:t})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[e]:t}),o(r)}return!0}}function St(e){return function(t,n){if(!T(t))return!1;if(n){const o=v(t.schema),l=z(t),r=t.tr,s=l.map.cellsInRect(e=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:e=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),c=s.map(i=>l.table.nodeAt(i));for(let i=0;i<s.length;i++)c[i].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[i],o.cell,c[i].attrs);if(r.steps.length===0)for(let i=0;i<s.length;i++)r.setNodeMarkup(l.tableStart+s[i],o.header_cell,c[i].attrs);n(r)}return!0}}function ue(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 l=0;l<o.length;l++){const r=t.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function I(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?St(e):function(n,o){if(!T(n))return!1;if(o){const l=v(n.schema),r=z(n),s=n.tr,c=ue("row",r,l),i=ue("column",r,l),a=(e==="column"?c:e==="row"&&i)?1:0,d=e=="column"?{left:0,top:a,right:1,bottom:r.map.height}:e=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=e=="column"?i?l.cell:l.header_cell:e=="row"?c?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const p=f+r.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,u,h.attrs)}),o(s)}return!0}}I("row",{useDeprecatedLogic:!0});I("column",{useDeprecatedLogic:!0});const vt=I("cell",{useDeprecatedLogic:!0});function Rt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,l=e.before();o>=0;o--){const r=e.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.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),l=e.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function fe(e){return function(t,n){if(!T(t))return!1;const o=Rt(J(t),e);if(o==null)return!1;if(n){const l=t.doc.resolve(o);n(t.tr.setSelection(H.between(l,tt(l))).scrollIntoView())}return!0}}function xt(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 j(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,l=v(e.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new L(l,0,0))}),o.docChanged&&t(o)}return!0}function Tt(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 l=t.child(0),r=l.type.spec.tableRole,s=l.type.schema,c=[];if(r=="row")for(let i=0;i<t.childCount;i++){let a=t.child(i).content;const d=i?0:Math.max(0,n-1),u=i<t.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=oe(v(s).row,new L(a,d,u)).content),c.push(a)}else if(r=="cell"||r=="header_cell")c.push(n||o?oe(v(s).row,new L(t,n,o)).content:t);else return null;return Mt(s,c)}function Mt(e,t){const n=[];for(let l=0;l<t.length;l++){const r=t[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:c,colspan:i}=r.child(s).attrs;for(let a=l;a<l+c;a++)n[a]=(n[a]||0)+i}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=t.length&&t.push(M.empty),n[l]<o){const r=v(e).cell.createAndFill(),s=[];for(let c=n[l];c<o;c++)s.push(r);t[l]=t[l].append(M.from(s))}return{height:t.length,width:o,rows:t}}function oe(e,t){const n=e.createAndFill();return new _e(n).replace(0,n.content.size,t).doc}function zt({width:e,height:t,rows:n},o,l){if(e!=o){const r=[],s=[];for(let c=0;c<n.length;c++){const i=n[c],a=[];for(let d=r[c]||0,u=0;d<o;u++){let f=i.child(u%i.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(B(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)r[c+p]=(r[c+p]||0)+f.attrs.colspan}s.push(M.from(a))}n=s,e=o}if(t!=l){const r=[];for(let s=0,c=0;s<l;s++,c++){const i=[],a=n[c%t];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),i.push(u)}r.push(M.from(i))}n=r,t=l}return{width:e,height:t,rows:n}}function Nt(e,t,n,o,l,r,s){const c=e.doc.type.schema,i=v(c);let a,d;if(l>t.width)for(let u=0,f=0;u<t.height;u++){const p=n.child(u);f+=p.nodeSize;const h=[];let g;p.lastChild==null||p.lastChild.type==i.cell?g=a||(a=i.cell.createAndFill()):g=d||(d=i.header_cell.createAndFill());for(let m=t.width;m<l;m++)h.push(g);e.insert(e.mapping.slice(s).map(f-1+o),h)}if(r>t.height){const u=[];for(let h=0,g=(t.height-1)*t.width;h<Math.max(t.width,l);h++){const m=h>=t.width?!1:n.nodeAt(t.map[g+h]).type==i.header_cell;u.push(m?d||(d=i.header_cell.createAndFill()):a||(a=i.cell.createAndFill()))}const f=i.row.create(null,M.from(u)),p=[];for(let h=t.height;h<r;h++)p.push(f);e.insert(e.mapping.slice(s).map(o+n.nodeSize-2),p)}return!!(a||d)}function he(e,t,n,o,l,r,s,c){if(s==0||s==t.height)return!1;let i=!1;for(let a=l;a<r;a++){const d=s*t.width+a,u=t.map[d];if(t.map[d-t.width]==u){i=!0;const f=n.nodeAt(u),{top:p,left:h}=t.findCell(u);e.setNodeMarkup(e.mapping.slice(c).map(u+o),null,{...f.attrs,rowspan:s-p}),e.insert(e.mapping.slice(c).map(t.positionAt(s,h,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return i}function pe(e,t,n,o,l,r,s,c){if(s==0||s==t.width)return!1;let i=!1;for(let a=l;a<r;a++){const d=a*t.width+s,u=t.map[d];if(t.map[d-1]==u){i=!0;const f=n.nodeAt(u),p=t.colCount(u),h=e.mapping.slice(c).map(u+o);e.setNodeMarkup(h,null,B(f.attrs,s-p,f.attrs.colspan-(s-p))),e.insert(h+f.nodeSize,f.type.createAndFill(B(f.attrs,0,s-p))),a+=f.attrs.rowspan-1}}return i}function me(e,t,n,o,l){let r=n?e.doc.nodeAt(n-1):e.doc;if(!r)throw new Error("No table found");let s=C.get(r);const{top:c,left:i}=o,a=i+l.width,d=c+l.height,u=e.tr;let f=0;function p(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=C.get(r),f=u.mapping.maps.length}Nt(u,s,r,n,a,d,f)&&p(),he(u,s,r,n,i,a,c,f)&&p(),he(u,s,r,n,i,a,d,f)&&p(),pe(u,s,r,n,c,d,i,f)&&p(),pe(u,s,r,n,c,d,a,f)&&p();for(let h=c;h<d;h++){const g=s.positionAt(h,i,r),m=s.positionAt(h,a,r);u.replace(u.mapping.slice(f).map(g+n),u.mapping.slice(f).map(m+n),new L(l.rows[h-c],0,0))}p(),u.setSelection(new b(u.doc.resolve(n+s.positionAt(c,i,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),t(u)}const Et=Oe({ArrowLeft:F("horiz",-1),ArrowRight:F("horiz",1),ArrowUp:F("vert",-1),ArrowDown:F("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:j,"Mod-Backspace":j,Delete:j,"Mod-Delete":j});function K(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function F(e,t){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof b)return K(n,o,E.near(r.$headCell,t));if(e!="horiz"&&!r.empty)return!1;const s=He(l,e,t);if(s==null)return!1;if(e=="horiz")return K(n,o,E.near(n.doc.resolve(r.head+t),t));{const c=n.doc.resolve(s),i=Re(c,e,t);let a;return i?a=E.near(i,1):t<0?a=E.near(n.doc.resolve(c.before(-1)),-1):a=E.near(n.doc.resolve(c.after(-1)),1),K(n,o,a)}}}function _(e,t){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof b)s=r;else{const i=He(l,e,t);if(i==null)return!1;s=new b(n.doc.resolve(i))}const c=Re(s.$headCell,e,t);return c?K(n,o,new b(s.$anchorCell,c)):!1}}function Ht(e,t){const n=e.state.doc,o=W(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function $t(e,t,n){if(!T(e.state))return!1;let o=Tt(n);const l=e.state.selection;if(l instanceof b){o||(o={width:1,height:1,rows:[M.from(oe(v(e.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),c=C.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=zt(o,c.right-c.left,c.bottom-c.top),me(e.state,e.dispatch,s,c,o),!0}else if(o){const r=J(e.state),s=r.start(-1);return me(e.state,e.dispatch,s,C.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function Lt(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ge(e,t.target);let l;if(t.shiftKey&&e.state.selection instanceof b)r(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(l=W(e.state.selection.$anchor))!=null&&((n=Y(e,t))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,t),t.preventDefault();else if(!o)return;function r(i,a){let d=Y(e,a);const u=$.getState(e.state)==null;if(!d||!ie(i,d))if(u)d=i;else return;const f=new b(i,d);if(u||!e.state.selection.eq(f)){const p=e.state.tr.setSelection(f);u&&p.setMeta($,i.pos),e.dispatch(p)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",c),$.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta($,-1))}function c(i){const a=i,d=$.getState(e.state);let u;if(d!=null)u=e.state.doc.resolve(d);else if(ge(e,a.target)!=o&&(u=Y(e,t),!u))return s();u&&r(u,a)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",c)}function He(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),c=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(c)?s:null}}return null}function ge(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Y(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:l}=n;return o>=0&&W(e.state.doc.resolve(o))||W(e.state.doc.resolve(l))}var kt=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),le(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,le(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function le(e,t,n,o,l,r){let s=0,c=!0,i=t.firstChild;const a=e.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:p,colwidth:h}=a.child(u).attrs;for(let g=0;g<p;g++,f++){const m=l==f?r:h&&h[g],w=m?m+"px":"";if(s+=m||o,m||(c=!1),i)i.style.width!=w&&(i.style.width=w),i=i.nextSibling;else{const S=document.createElement("col");S.style.width=w,t.appendChild(S)}}}for(;i;){var d;const u=i.nextSibling;(d=i.parentNode)===null||d===void 0||d.removeChild(i),i=u}c?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const x=new se("tableColumnResizing");function Wt({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=kt,lastColumnResizable:l=!0}={}){const r=new ve({key:x,state:{init(s,c){var i;const a=(i=r.spec)===null||i===void 0||(i=i.props)===null||i===void 0?void 0:i.nodeViews,d=v(c.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new Bt(-1,!1)},apply(s,c){return c.apply(s)}},props:{attributes:s=>{const c=x.getState(s);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,c)=>{Dt(s,c,e,l)},mouseleave:s=>{It(s)},mousedown:(s,c)=>{Pt(s,c,t,n)}},decorations:s=>{const c=x.getState(s);if(c&&c.activeHandle>-1)return Vt(s,c.activeHandle)},nodeViews:{}}});return r}var Bt=class X{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(x);if(o&&o.setHandle!=null)return new X(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new X(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let l=t.mapping.map(n.activeHandle,-1);return ne(t.doc.resolve(l))||(l=-1),new X(l,n.dragging)}return n}};function Dt(e,t,n,o){if(!e.editable)return;const l=x.getState(e.state);if(l&&!l.dragging){const r=jt(t.target);let s=-1;if(r){const{left:c,right:i}=r.getBoundingClientRect();t.clientX-c<=n?s=we(e,t,"left",n):i-t.clientX<=n&&(s=we(e,t,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const c=e.state.doc.resolve(s),i=c.node(-1),a=C.get(i),d=c.start(-1);if(a.colCount(c.pos-d)+c.nodeAfter.attrs.colspan-1==a.width-1)return}$e(e,s)}}}function It(e){if(!e.editable)return;const t=x.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function Pt(e,t,n,o){var l;if(!e.editable)return!1;const r=(l=e.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=x.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const c=e.state.doc.nodeAt(s.activeHandle),i=Ot(e,s.activeHandle,c.attrs);e.dispatch(e.state.tr.setMeta(x,{setDragging:{startX:t.clientX,startWidth:i}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=x.getState(e.state);f?.dragging&&(Ft(e,f.activeHandle,be(f.dragging,u,n)),e.dispatch(e.state.tr.setMeta(x,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=x.getState(e.state);if(f&&f.dragging){const p=be(f.dragging,u,n);Ce(e,f.activeHandle,p,o)}}return Ce(e,s.activeHandle,i,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),t.preventDefault(),!0}function Ot(e,t,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=e.domAtPos(t);let s=r.node.childNodes[r.offset].offsetWidth,c=n;if(o)for(let i=0;i<n;i++)o[i]&&(s-=o[i],c--);return s/c}function jt(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function we(e,t,n,o){const l=n=="right"?-o:o,r=e.posAtCoords({left:t.clientX+l,top:t.clientY});if(!r)return-1;const{pos:s}=r,c=W(e.state.doc.resolve(s));if(!c)return-1;if(n=="right")return c.pos;const i=C.get(c.node(-1)),a=c.start(-1),d=i.map.indexOf(c.pos-a);return d%i.width==0?-1:a+i.map[d-1]}function be(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(x,{setHandle:t}))}function Ft(e,t,n){const o=e.state.doc.resolve(t),l=o.node(-1),r=C.get(l),s=o.start(-1),c=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,i=e.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+c;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,p=f.colspan==1?0:c-r.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;const h=f.colwidth?f.colwidth.slice():_t(f.colspan);h[p]=n,i.setNodeMarkup(s+u,null,{...f,colwidth:h})}i.docChanged&&e.dispatch(i)}function Ce(e,t,n,o){const l=e.state.doc.resolve(t),r=l.node(-1),s=l.start(-1),c=C.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let i=e.domAtPos(l.start(-1)).node;for(;i&&i.nodeName!="TABLE";)i=i.parentNode;i&&le(r,i.firstChild,i,o,c,n)}function _t(e){return Array(e).fill(0)}function Vt(e,t){const n=[],o=e.doc.resolve(t),l=o.node(-1);if(!l)return Q.empty;const r=C.get(l),s=o.start(-1),c=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=c+a*r.width;if((c==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var i;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((i=x.getState(e))===null||i===void 0)&&i.dragging&&n.push(Z.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(Z.widget(f,p))}}return Q.create(e.doc,n)}function Kt({allowTableNodeSelection:e=!1}={}){return new ve({key:$,state:{init(){return null},apply(t,n){const o=t.getMeta($);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:l,pos:r}=t.mapping.mapResult(n);return l?null:r}},props:{decorations:lt,handleDOMEvents:{mousedown:Lt},createSelectionBetween(t){return $.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Ht,handleKeyDown:Et,handlePaste:$t},appendTransaction(t,n,o){return it(o,ze(o,n),e)}})}function U(e){return e==="left"||e==="right"||e==="center"?e:null}function Xt(e){const t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase();return U(t||n)}function qt(e){return U(e?.align)}function Le(){return{default:null,parseHTML:e=>Xt(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function Ut(e){var t;const n=e.parentElement,o=e.closest("table");if(!n||!o)return null;const l=Array.from(n.children).indexOf(e),r=(t=o.querySelectorAll("colgroup > col")[l])===null||t===void 0?void 0:t.getAttribute("width");return r?[parseInt(r,10)]:null}function ke(e){const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):Ut(e)}const Jt=/[ \t\r\n\f]+/g;function We(e){var t;return e.children.length>0?!1:((t=e.textContent)!==null&&t!==void 0?t:"").replace(Jt,"")===""}function Be(e){const t=e.createAndFill();if(!t)throw new Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}const Gt=P.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:ke},align:Le()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:e=>We(e)?{}:!1,getContent:(e,t)=>Be(t.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",k(this.options.HTMLAttributes,e),0]}}),Yt=P.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:ke},align:Le()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:e=>We(e)?{}:!1,getContent:(e,t)=>Be(t.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",k(this.options.HTMLAttributes,e),0]}}),Qt=P.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",k(this.options.HTMLAttributes,e),0]}});function re(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function ye(e,t,n,o,l,r){let s=0,c=!0,i=t.firstChild;const a=e.firstChild;if(a!==null)for(let f=0,p=0;f<a.childCount;f+=1){const{colspan:h,colwidth:g}=a.child(f).attrs;for(let m=0;m<h;m+=1,p+=1){const w=l===p?r:g&&g[m],S=w?`${w}px`:"";if(s+=w||o,w||(c=!1),i){if(i.style.width!==S){const[y,A]=re(o,w);i.style.setProperty(y,A)}i=i.nextSibling}else{const y=document.createElement("col"),[A,R]=re(o,w);y.style.setProperty(A,R),t.appendChild(y)}}}for(;i;){var d;const f=i.nextSibling;(d=i.parentNode)===null||d===void 0||d.removeChild(i),i=f}const u=e.attrs.style&&typeof e.attrs.style=="string"&&/\bwidth\s*:/i.test(e.attrs.style);c&&!u?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var Zt=class{constructor(e,t,n,o={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[l,r]of Object.entries(o))r!=null&&(l==="style"?this.table.style.cssText=String(r):this.table.setAttribute(l,String(r)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ye(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,ye(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){const t=e.target,n=this.dom.contains(t),o=this.contentDOM.contains(t);return!!(n&&!o&&(e.type==="attributes"||e.type==="childList"||e.type==="characterData"))}};function en(e,t,n,o){let l=0,r=!0;const s=[],c=e.firstChild;if(!c)return{};for(let d=0,u=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let h=0;h<f;h+=1,u+=1){const g=n===u?o:p&&p[h];l+=g||t,g||(r=!1);const[m,w]=re(t,g);s.push(["col",{style:`${m}: ${w}`}])}}const i=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:i,tableMinWidth:a}}function Ae(e,t){return e.createAndFill()}function tn(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const o=e.nodes[n];o.spec.tableRole&&(t[o.spec.tableRole]=o)}),e.cached.tableNodeTypes=t,t}function nn(e,t,n,o,l){const r=tn(e),s=[],c=[];for(let a=0;a<n;a+=1){const d=Ae(r.cell);if(d&&c.push(d),o){const u=Ae(r.header_cell);u&&s.push(u)}}const i=[];for(let a=0;a<t;a+=1)i.push(r.row.createChecked(null,o&&a===0?s:c));return r.table.createChecked(null,i)}function on(e){return e instanceof b}const V=({editor:e})=>{const{selection:t}=e.state;if(!on(t))return!1;let n=0;const o=q(t.ranges[0].$from,l=>l.type.name==="table");return o?.node.descendants(l=>{if(l.type.name==="table")return!1;["tableCell","tableHeader"].includes(l.type.name)&&(n+=1)}),n!==t.ranges.length?!1:(e.commands.deleteTable(),!0)};function Se(e,t){const n=e.mapping.map(t),o=q(e.selection.$from,s=>s.type.name==="table");if(o?.pos===n)return;const l=e.doc.nodeAt(n);if(!l)return;const r=n+l.nodeSize-1;e.setSelection(H.near(e.doc.resolve(r),-1))}function ln(e){let t="",n=0;for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let o=0;for(;n+o<e.length&&e[n+o]==="`";)o+=1;let l=n+o,r=!1;for(;l<e.length;){if(e[l]!=="`"){l+=1;continue}let s=0;for(;l+s<e.length&&e[l+s]==="`";)s+=1;if(s===o){const c=e.slice(n+o,l);t+=e.slice(n,n+o)+c.replace(/\\\||\|/g,i=>i==="|"?"\\|":i)+e.slice(l,l+o),n=l+o,r=!0;break}l+=s}r||(t+=e.slice(n,n+o),n+=o)}return t}function rn(e){return e.split(`
2
2
  `).map(t=>!t.includes("|")||!t.includes("`")?t:ln(t)).join(`
3
3
  `)}function sn(e){return(e||"").replace(/\s+/g," ").trim()}function cn(e,t,n={}){var o;const l=(o=n.cellLineSeparator)!==null&&o!==void 0?o:"";if(!e||!e.content||e.content.length===0)return"";const r=[];e.content.forEach(h=>{const g=[];h.content&&h.content.forEach(m=>{let w="";m.content&&Array.isArray(m.content)&&m.content.length>1?w=m.content.map(R=>t.renderChildren(R)).join(l):w=m.content?t.renderChildren(m.content):"";const S=sn(w.split(l).join(`
4
4
  `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),y=m.type==="tableHeader",A=qt(m.attrs);g.push({text:S,isHeader:y,align:A})}),r.push(g)});const s=r.reduce((h,g)=>Math.max(h,g.length),0);if(s===0)return"";const c=Array.from({length:s}).fill(0);r.forEach(h=>{for(let m=0;m<s;m+=1){var g;const w=(((g=h[m])===null||g===void 0?void 0:g.text)||"").length;w>c[m]&&(c[m]=w),c[m]<3&&(c[m]=3)}});const i=(h,g)=>h+" ".repeat(Math.max(0,g-h.length)),a=r[0],d=a.some(h=>h.isHeader),u=Array.from({length:s}).fill(null);r.forEach(h=>{for(let m=0;m<s;m+=1){var g;!u[m]&&(!((g=h[m])===null||g===void 0)&&g.align)&&(u[m]=h[m].align)}});let f=`