@blocknote/xl-ai 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/blocknote-xl-ai.cjs +10 -10
  2. package/dist/blocknote-xl-ai.cjs.map +1 -1
  3. package/dist/blocknote-xl-ai.js +391 -391
  4. package/dist/blocknote-xl-ai.js.map +1 -1
  5. package/dist/webpack-stats.json +1 -1
  6. package/package.json +9 -8
  7. package/src/api/LLMRequest.ts +5 -3
  8. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{Add heading (h1) and code block_1_4ed20a68d545bbcac0a6974406d9b1b1.json → Add heading (h1) and code block_1_2f82a8f66db1e848b6fcf11cf3b40597.json } +2 -2
  9. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add a list (end)_1_a8c0f5688c447808ea40e16816bc9d88.json → add a list (end)_1_c2d9df5eea16a2823b16315808698634.json } +2 -2
  10. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add a new paragraph (empty doc)_1_4200cbf42b5dd56e2fb7c1dc4c0e5c95.json → add a new paragraph (empty doc)_1_4a415aef98742a73f1d8e76b31b48fd9.json } +2 -2
  11. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add a new paragraph (end)_1_3cecc2859589d59d7b2a73b271a02ebb.json → add a new paragraph (end)_1_c3ac403267365e72e1acdeaf703272ac.json } +2 -2
  12. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add a new paragraph (start)_1_0b6e5ba7c365aa004ab09915db4747d2.json → add a new paragraph (start)_1_a7deaebd8a05b0eacd438ef4772a84b0.json } +2 -2
  13. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{Add heading (h1) and code block_1_f09fb671c15594eba4367376e1de7404.json → Add heading (h1) and code block_1_c9d02980acbb81e12922c758580ae086.json } +2 -2
  14. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add a list (end)_1_9ca128e303da5f76048c82f2c1928b5f.json → add a list (end)_1_898ab571e824bb2cf7bfd3a4ec769cc4.json } +2 -2
  15. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add a new paragraph (empty doc)_1_fedaaecc10d6ddf733d85168d2167795.json → add a new paragraph (empty doc)_1_13f4377aac43e7a42d2e0fbe377b093f.json } +2 -2
  16. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add a new paragraph (end)_1_fe965ef7a99beb3acc090a9f597b4279.json → add a new paragraph (end)_1_41b6ad49c80f708e02a289f0a978d10f.json } +2 -2
  17. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add a new paragraph (start)_1_232100784a2397a470c08d82001cb7fb.json → add a new paragraph (start)_1_ba9d1b82c2e1653cbfad19e72d157d19.json } +2 -2
  18. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{Add heading (h1) and code block_1_da4995473884c05440ca118c6ae41453.json → Add heading (h1) and code block_1_d7a1ca07ded19de08a51f21236c2d68e.json } +2 -2
  19. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add a list (end)_1_bcc7319416c9b14368ea5ad861f9b722.json → add a list (end)_1_ea8fe6c45678a567e7bfc9a4f9ff9d7e.json } +2 -2
  20. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add a new paragraph (empty doc)_1_8fd66df698028c81b94d9c3da3f48565.json → add a new paragraph (empty doc)_1_be406ee8435789d49b4de3a2952366bc.json } +2 -2
  21. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add a new paragraph (end)_1_1df9f2bee04498ef092f332ebce02289.json → add a new paragraph (end)_1_0f618344844192bfd9fca2e00cb8ef3a.json } +2 -2
  22. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add a new paragraph (start)_1_ddea32bf65559924075cf5a378ff52a9.json → add a new paragraph (start)_1_a171c162d38c9ae40b2a22be3ef913b9.json } +2 -2
  23. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{Add heading (h1) and code block_1_411b9303baf0445a2b3d22af986dcbd7.json → Add heading (h1) and code block_1_4490bc6c485a737b4584207976c00303.json } +2 -2
  24. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add a list (end)_1_b62f9dcc3af6272c847eb867f28464e4.json → add a list (end)_1_7a96610c4bbc6c8f141e4addbc2106bf.json } +2 -2
  25. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add a new paragraph (empty doc)_1_e3538aed67ed181c709f2c76ebd3b88c.json → add a new paragraph (empty doc)_1_44de7bf7410dad3111bbadfa384b3806.json } +2 -2
  26. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add a new paragraph (end)_1_4da2dc377fad46f51e531f5cb2594b48.json → add a new paragraph (end)_1_b6706fca4145b801d7884d53dd16458f.json } +2 -2
  27. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add a new paragraph (start)_1_9a1739085965869c82a4ab025a9b426c.json → add a new paragraph (start)_1_f2e4502c4c5fb89e3ab56801c4e2ebb1.json } +2 -2
  28. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_bde67ab7834e0e85453474bfec5d6899.json +15 -0
  29. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_87f55153eeb60ab71bfc14cc2fd2f957.json +15 -0
  30. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_51ba760ef2fb18f3445641c82a09fabc.json +15 -0
  31. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_8e7994f92b21645243d6012cbefb10aa.json +15 -0
  32. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_13e966493243f338888f862532e11055.json +15 -0
  33. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add and update paragraph_1_a16755b57abd9123bc8d138ece2fc206.json → add and update paragraph_1_a6c32f94ed9ef180b605d3e529b66f0a.json } +2 -2
  34. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{add paragraph and update selection_1_9d3466520f605a356f2c31458954e816.json → add paragraph and update selection_1_da1b9a436aabf66b488fd5f147c006d6.json } +2 -2
  35. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add and update paragraph_1_051b564433dad882d26853a2d2e41841.json → add and update paragraph_1_b747e1a9db81d87169dbb057c80a400e.json } +2 -2
  36. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{add paragraph and update selection_1_0ca431ee9c56812e10198e60552a536f.json → add paragraph and update selection_1_1441637b8dce16dc9c48df2cf6507d9b.json } +2 -2
  37. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add and update paragraph_1_8ef78aa1880fd8536fa49acb127f51c0.json → add and update paragraph_1_7252c232ad6e528961ee8cb6825e1ced.json } +2 -2
  38. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{add paragraph and update selection_1_04f9e76ff73eff953288564e5385dbd4.json → add paragraph and update selection_1_ce0574730306ae367b09cefba52e1ee5.json } +2 -2
  39. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add and update paragraph_1_e9e8ca04b228ebbec6f48d24c147fbcf.json → add and update paragraph_1_304d3249edb4213cd5b98862492557f2.json } +2 -2
  40. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{add paragraph and update selection_1_f5cd402d603bead3d759ebb5485f39c3.json → add paragraph and update selection_1_58bb195c54dff663752ffdd8e6b50bf0.json } +2 -2
  41. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_f7403010a908af399a5228468b304f47.json +15 -0
  42. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_495ea67d9ad44b58172da3db145b3a10.json +15 -0
  43. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{delete first block_1_a4ec61146ba0a517742770cb5843201f.json → delete first block_1_278e7fb63bd96fb65d7e2b2a6c215e24.json } +2 -2
  44. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{delete first block_1_ee24300ba2c8986f54c02b0d2aec9691.json → delete first block_1_b8070bd231a475d9df5bbb9da081cf01.json } +2 -2
  45. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{delete first block_1_21ad45e4791e6ce60e52c20228c507ff.json → delete first block_1_5190aca5ac8dc8a51ad5b5ab8277fc21.json } +2 -2
  46. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{delete first block_1_002ed2fb069e97008c626fe8c2d43637.json → delete first block_1_9b505e5406bea6b6aa0194536538eed7.json } +2 -2
  47. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_4fd26859e74455f20838c0acf2b72429.json +15 -0
  48. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{drop mark and link and change text within mark_1_a97a8a61e45a5cfa1f37771aefbf06ba.json → drop mark and link and change text within mark_1_8978afc5c34284715a8914c2fd570f93.json } +2 -2
  49. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{drop mark and link_1_80d39d8c2f69d28a6aec0dee64eb7b4f.json → drop mark and link_1_938010771c761a751ffbec3118e90f37.json } +2 -2
  50. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{modify nested content_1_64d59c27de629179d00d268836aebcba.json → modify nested content_1_671661bffc93e10ce475a7a35f15d754.json } +2 -2
  51. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{modify parent content_1_7cb863416d6d953446640251160e084e.json → modify parent content_1_3be350bb2a881627e6d2c9bf1c977133.json } +2 -2
  52. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{plain source block, add mention_1_c6025cf7f6efc3b57f721752b1f49801.json → plain source block, add mention_1_fbbe189dec37c71e5cfc78fa72504cd6.json } +2 -2
  53. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{standard update_1_b3b73d97f68d26aba18541b8c809ec4d.json → standard update_1_fa30387ecfa9d5ca59f612c7ab97f4bd.json } +2 -2
  54. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in source block, remove mark_1_f6a509381d62c4242864af576bb7ba61.json → styles + ic in source block, remove mark_1_db38bde293870f2bef2303384e4e0a55.json } +2 -2
  55. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in source block, remove mention_1_61539d923364c797cda8519b7d6dbb77.json → styles + ic in source block, remove mention_1_2b37d06351765e430fa35e5ca5c63dec.json } +2 -2
  56. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in source block, replace content_1_a73907775c98b6c395eac24591e7f1d4.json → styles + ic in source block, replace content_1_7a40338400651cdf9b96bdf8da120da9.json } +2 -2
  57. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in source block, update mention prop_1_1821b0f5da6b0bdb28f9444c6eaca222.json → styles + ic in source block, update mention prop_1_2d883e86ea71cfb987a22379a3edfa77.json } +2 -2
  58. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in source block, update text_1_82f2d8a07824544fad31d34c8a554af1.json → styles + ic in source block, update text_1_3ccdc93a62d16ec0bcf50be253c1dc56.json } +2 -2
  59. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in target block, add mark (paragraph)_1_c8bc122a4cb48783ca677fc4aa6cd947.json → styles + ic in target block, add mark (paragraph)_1_809e0216515551c13573267a351ba535.json } +2 -2
  60. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{styles + ic in target block, add mark (word)_1_686bfcd92e4eb65462c1811ad4a3976d.json → styles + ic in target block, add mark (word)_1_12dba322e1c862453710164ab8dacd01.json } +2 -2
  61. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{translate selection_1_2968b738a7996331d8faf2692d652c3c.json → translate selection_1_e8c60e9f841b4ab0a3e3542f57873ecf.json } +2 -2
  62. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{turn paragraphs into list_1_dd8e963f842a261deec745e8d4608bfd.json → turn paragraphs into list_1_0301237447d5b4413e7dadcad3480eb7.json } +2 -2
  63. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{update block type and content_1_06943ba0bda62a61f058ba07379ab4b7.json → update block type and content_1_9206839a16fcfab9cdcdd9e45f09f1da.json } +2 -2
  64. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (non-streaming)/{update block type_1_9e53c774c99f178f06b3c7b3608d1605.json → update block type_1_16071edfe34f45ccfeb3bb4b023da531.json } +2 -2
  65. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{drop mark and link and change text within mark_1_2b911dce06e556a512fa22d1a0042b5a.json → drop mark and link and change text within mark_1_fe18c50fd2feadd6457384d8fb8944ec.json } +2 -2
  66. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{drop mark and link_1_f7d042c6ddd42b02098b813fe6e2da2b.json → drop mark and link_1_221aeca7fef5f125b53481e1b86ef472.json } +2 -2
  67. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{modify nested content_1_0cbaaf87b0c6b588f7d7e21f72ed7a7c.json → modify nested content_1_556624e3ee02680707ba62c186d62e84.json } +2 -2
  68. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{modify parent content_1_d190a41cfce34eb5362468031cb608fe.json → modify parent content_1_c0bdc581c11c643bf23b9b9db2d63c81.json } +2 -2
  69. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{plain source block, add mention_1_963338caea5317fbaa588fed459f0895.json → plain source block, add mention_1_0864d889b31cae8e316f6a78ef61df7d.json } +2 -2
  70. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{standard update_1_da09ee8bda5dc347edc748b59bc3bb16.json → standard update_1_f80b18afddb894d5ef20c2e5b40d1735.json } +2 -2
  71. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in source block, remove mark_1_90482aba878618976330fda1af8f6766.json → styles + ic in source block, remove mark_1_de6fb747b4d41b8d888fabe55320091c.json } +2 -2
  72. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in source block, remove mention_1_5c149679babf73b41810f291fcb4d558.json → styles + ic in source block, remove mention_1_c0ff836d1dce7a2f6e6f86f220640315.json } +2 -2
  73. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in source block, replace content_1_0c9d3ace7da95353a998edbaff79177d.json → styles + ic in source block, replace content_1_da5f1ab6fa91c869e64322937264846f.json } +2 -2
  74. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in source block, update mention prop_1_57893638a0ceb0edac342346fa706076.json → styles + ic in source block, update mention prop_1_38b3b843f1c225ba4b5fae0ea9fe7d69.json } +2 -2
  75. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in source block, update text_1_ef01870ca5f4083b4ea345e00d3c52ff.json → styles + ic in source block, update text_1_b5b0d849bf7cfd45920a42b802840eb0.json } +2 -2
  76. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in target block, add mark (paragraph)_1_ee8107efdf5fd19552a7fff0b08f6657.json → styles + ic in target block, add mark (paragraph)_1_15b8c82decbf30a714f2df977d22c034.json } +2 -2
  77. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{styles + ic in target block, add mark (word)_1_ca95d8d83853d5deb4765c6768a2563f.json → styles + ic in target block, add mark (word)_1_7b3ed3b4d44c3e948694f0ea709b6a18.json } +2 -2
  78. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{translate selection_1_674d4ec4b8af2ac528ec90892731f67a.json → translate selection_1_b44a83174a714b0c75c0ae03566175c0.json } +2 -2
  79. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{turn paragraphs into list_1_1ec910c96203d1d86b7dcce97e352e91.json → turn paragraphs into list_1_0d58195328e2194c6d2466a4ff9f8bc5.json } +2 -2
  80. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{update block type and content_1_e09825f3b2477a73e86972716897a19e.json → update block type and content_1_25e6f872caa48f5825f7ceb4b0f78655.json } +2 -2
  81. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (non-streaming)/{update block type_1_cf54cfb6c7dfc32b6429ca1a2302a2b6.json → update block type_1_1199a83747eb0f064e1c6badaa3e788d.json } +2 -2
  82. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{drop mark and link and change text within mark_1_efeeda50dc4be1869d555c44cc00a5f5.json → drop mark and link and change text within mark_1_5936286917db7874ab151e025d44f0ec.json } +2 -2
  83. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{drop mark and link_1_e3ff518cb46e814abe773f4184678323.json → drop mark and link_1_4aa07cf0823d35359854ab671dd8403a.json } +2 -2
  84. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{modify nested content_1_c335661f5c1022666f7905497d4a3189.json → modify nested content_1_f2b4ede7c5fa7fe6f53f0224d9c843e6.json } +2 -2
  85. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{modify parent content_1_73db91187a949699f0fd921ebe60d841.json → modify parent content_1_37be7ebe33cd5e612c15b138aa8e868a.json } +2 -2
  86. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{plain source block, add mention_1_57f7d170977b8d3400a3a1d7182790b0.json → plain source block, add mention_1_3ab6cac43fb1418a242820f5fb741a80.json } +2 -2
  87. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{standard update_1_67b27460b36b3013a36967448a8522c4.json → standard update_1_45a526f03ac0adef7c3c45cb4cda6d5a.json } +2 -2
  88. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in source block, remove mark_1_abd6ba31606c51fb682ca64b85af7008.json → styles + ic in source block, remove mark_1_466a1bc182d81c967fcd9dc2d0161046.json } +2 -2
  89. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in source block, remove mention_1_bcb2fc9b7ec7eb1ae370d9387dc7e505.json → styles + ic in source block, remove mention_1_2b98509c91ffaa3f4b775afdebef2dd1.json } +2 -2
  90. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in source block, replace content_1_9e6d5cd399d444173556b9dc0afc3334.json → styles + ic in source block, replace content_1_24ba9ad6b82850e51f9aeb27631974c1.json } +2 -2
  91. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in source block, update mention prop_1_e1d72f9616d34022fba9ea219eb13748.json → styles + ic in source block, update mention prop_1_64f592e51960d717cdbd7aa155ae6196.json } +2 -2
  92. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in source block, update text_1_bd11c0a3efe0e2b04a0133c6ca73a5cd.json → styles + ic in source block, update text_1_9ae98cae168d1714dcdd12abbf4ab7dc.json } +2 -2
  93. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in target block, add mark (paragraph)_1_c865fea79947e8f5885f8c7ebc7dd91a.json → styles + ic in target block, add mark (paragraph)_1_42509ec379b9798b007c4481b1b65118.json } +2 -2
  94. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{styles + ic in target block, add mark (word)_1_e155e7bf26070976e31928b82bb13fbc.json → styles + ic in target block, add mark (word)_1_4054e8af99647ab39ef82cbd2fa546c9.json } +2 -2
  95. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{translate selection_1_54ec8515dd6ab214d8b92c5cf4f09529.json → translate selection_1_e16698998bf1a04cb9538d79a1ceff2c.json } +2 -2
  96. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{turn paragraphs into list_1_ec7bd4074c354be223256a9d0ab17e64.json → turn paragraphs into list_1_12667c1a7b080c02776120c0a85b9cd9.json } +2 -2
  97. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{update block type and content_1_a935b00dc3276d6713bffbfb1fdf211e.json → update block type and content_1_4f67ef168fbf2021f1b78fb11b22f568.json } +2 -2
  98. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/{update block type_1_21d1130a166f73bca224130b84ed37c4.json → update block type_1_f14e429b4f85b7586942a94000a44f21.json } +2 -2
  99. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{drop mark and link and change text within mark_1_8798a9655a7eb7a651bb81f5f811fc60.json → drop mark and link and change text within mark_1_c9e281ea445a93fbc84005fa8a92d07e.json } +2 -2
  100. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{drop mark and link_1_001ea299cc5ab0754d17884094fa9d86.json → drop mark and link_1_6f06b0c532060f9a0c1c0b2f64f2b6ab.json } +2 -2
  101. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{modify nested content_1_3b7f9df9f7701d51e2ccf274e5280a7d.json → modify nested content_1_f87724ae16fe199bd8fb1ac207a3ab99.json } +2 -2
  102. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{modify parent content_1_3b9c9ee90eacd058e510ca1c82cbd554.json → modify parent content_1_85ee68d4daa7ddab518c19afcd02cb44.json } +2 -2
  103. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{plain source block, add mention_1_2e588074658964fdee8f372a25645e39.json → plain source block, add mention_1_babb54324affa4adb9249cdae14cf222.json } +2 -2
  104. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{standard update_1_8aa8c7ee6f4c17a92493df542b131069.json → standard update_1_8c6a9aa2df797ab1a789805eb44c20c6.json } +2 -2
  105. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in source block, remove mark_1_7c37aad8ce27e926dc486960a90f35eb.json → styles + ic in source block, remove mark_1_3308e5066e651a6abeb10e26cd62b8c2.json } +2 -2
  106. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in source block, remove mention_1_a9fa6b0be7fae1d70499aa6ecfea6704.json → styles + ic in source block, remove mention_1_5b43e33507a6bc64943c2383991ad7d4.json } +2 -2
  107. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in source block, replace content_1_4d4299b8044479fe9e15a4a168707806.json → styles + ic in source block, replace content_1_b9c728e7fe649e31114138d69a0b69c7.json } +2 -2
  108. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in source block, update mention prop_1_c6fa894a14f6be81fb568283e4724af9.json → styles + ic in source block, update mention prop_1_6fb8402fb1c0ef42821646b7ae01a6f8.json } +2 -2
  109. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in source block, update text_1_aa627d12493a30d6fa1bbf6d282b6ecd.json → styles + ic in source block, update text_1_39a7f24d933099914037252cc9e02645.json } +2 -2
  110. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in target block, add mark (paragraph)_1_711e7638278935cce832085d8cce0abc.json → styles + ic in target block, add mark (paragraph)_1_cecd6722d457eb6bb4b1231e28c61b64.json } +2 -2
  111. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{styles + ic in target block, add mark (word)_1_739768c550cdc9eb5af10dbacc7c6d22.json → styles + ic in target block, add mark (word)_1_ca614a9ed0162e6f24732e67e6076cb1.json } +2 -2
  112. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{translate selection_1_83bf8aa261516bf197d1391294bbcb06.json → translate selection_1_1d9ae8d2cabb0ab2d3425b42da65f9aa.json } +2 -2
  113. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{turn paragraphs into list_1_5aa207db4b8600962363d2352bf0b1c4.json → turn paragraphs into list_1_c329ee96e44a6acec8c490bfe9036c3c.json } +2 -2
  114. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{update block type and content_1_12e64702225f7eb521a176feffbdde9a.json → update block type and content_1_99c94387729dc443ea9a142027ae75a1.json } +2 -2
  115. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/{update block type_1_b81e29ddb0de05a668236685bd2df42c.json → update block type_1_9d69f7aa4a1a514ddb293bfae46db69d.json } +2 -2
  116. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_99fc53184b728115e2c9bf977d44addb.json +15 -0
  117. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_ec6e45525b18ba57e7669697631ed856.json +15 -0
  118. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_69e8bfa87ec2c7377f0f3e5bec154a35.json +15 -0
  119. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_4fa129b1c39dce035ef12c29e733d88f.json +15 -0
  120. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_110023b0bf33e516b42bee6f23b6a840.json +15 -0
  121. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_3ea83b592a9e001f52872db06794772f.json +15 -0
  122. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_6cf3d04771c2ac3bb39f84bda06a167a.json +15 -0
  123. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_b5e611d650819fc89af1f9ccfb59f24e.json +15 -0
  124. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_016a76a8b508815af96b7185d6137346.json +15 -0
  125. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_a6321b1baeca3f0e777cc6f735d39599.json +15 -0
  126. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_cd61b04f5a5a80de556e7524ab8efa7e.json +15 -0
  127. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_dca280088154bf070ef536e89a0570c3.json +15 -0
  128. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_2419100d41a8a73ec4a564889d7a57e9.json +15 -0
  129. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_290252f83e798ac47770abfbb9bf6d73.json +15 -0
  130. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_8103f7c569fd8326b0ae947eefd7d92d.json +15 -0
  131. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_282445e6005328e75fc2768da3503c3b.json +15 -0
  132. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_f1fcbe3b4b5404a79557569199effbf2.json +15 -0
  133. package/src/api/formats/html-blocks/defaultHTMLPromptBuilder.ts +5 -2
  134. package/src/api/formats/html-blocks/htmlPromptData.ts +4 -1
  135. package/src/api/formats/html-blocks/tools/index.ts +4 -14
  136. package/src/api/formats/json/defaultJSONPromptBuilder.ts +6 -2
  137. package/src/api/formats/json/jsonPromptData.ts +4 -1
  138. package/src/api/formats/markdown-blocks/markdownPromptData.ts +4 -1
  139. package/src/api/promptHelpers/trimEmptyBlocks.ts +2 -5
  140. package/src/components/AIMenu/BlockPositioner.tsx +12 -1
  141. package/src/components/AIMenu/getDefaultAIMenuItems.tsx +1 -1
  142. package/src/streamTool/callLLMWithStreamTools.ts +12 -2
  143. package/src/testUtil/cases/updateOperationTestCases.ts +1 -1
  144. package/types/src/api/promptHelpers/trimEmptyBlocks.d.ts +1 -0
  145. package/types/src/components/AIMenu/BlockPositioner.d.ts +4 -1
  146. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_91d754a12d792f37fe1483d19a7b4e64.json +0 -15
  147. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_1b9c5367195624176c28a1ca3684ebac.json +0 -15
  148. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_bda56d4903fe73aa33304a959057957d.json +0 -15
  149. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_731edbb5fc3b6e4a927978b9e203f336.json +0 -15
  150. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_56f9b395b16c8dc222ce13deb68cd412.json +0 -15
  151. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_2551adfcc4ecd63e37094152b44c1144.json +0 -15
  152. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_fc5837fa3ab53d1a511a8092a926d87d.json +0 -15
  153. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_af53bf5e53a86669deaae43b9ab27c67.json +0 -15
  154. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_f48c2d1d72f4c3514c346629fb7f4d0d.json +0 -15
  155. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_c357b571feb374378ba1b288c39b6c31.json +0 -15
  156. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_782caee9bbb515bfdae481d31ea48e48.json +0 -15
  157. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_92e8df7af02866607d407a52926d4f52.json +0 -15
  158. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_69dfced69472e5cf7789a98b3ccbbdd8.json +0 -15
  159. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_f5d03fb0433b5e5b912f40dbffd9f462.json +0 -15
  160. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_d0386ebc8dc8350f33c44c2251cd1d3c.json +0 -15
  161. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_83b1ed76da3ba0a764fdc6fb4d25e47a.json +0 -15
  162. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_dd48a67d4d41880db75515d0a95a53dc.json +0 -15
  163. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_e21784bb9948aac3dd70492535dff192.json +0 -15
  164. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_72b362e3a2e48e9e1d5dad68fc3da63c.json +0 -15
  165. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_968bf60fd7c9520b848955d47ea8a568.json +0 -15
  166. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_45c3fcc7757ac314a77786102326e125.json +0 -15
  167. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_8cfca4c1847085a8a31be1818346738e.json +0 -15
  168. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_2f31610c836b996af773c3856634d5c3.json +0 -15
  169. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_94cf62e3727b3443984720bc54218659.json +0 -15
  170. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_19432d3e11d58717813be52d54eb6edd.json +0 -15
@@ -1,33 +1,33 @@
1
1
  var et = Object.defineProperty;
2
2
  var tt = (e, t, o) => t in e ? et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var j = (e, t, o) => tt(e, typeof t != "symbol" ? t + "" : t, o);
3
+ var D = (e, t, o) => tt(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  import { getPmSchema as ot, UnreachableCaseError as Pe, getNodeById as rt, updateBlockTr as nt, insertBlocks as st, trackPosition as se, removeAndInsertBlocks as it, getBlock as Oe, defaultProps as Me, isStyledTextInlineContent as at, isLinkInlineContent as ct, BlockNoteExtension as lt, filterSuggestionItems as ut, mergeCSSClasses as dt } from "@blocknote/core";
5
- import { applySuggestions as Be, suggestChanges as pt, revertSuggestions as ie } from "@blocknote/prosemirror-suggest-changes";
6
- import { jsonSchema as xe, streamObject as mt, generateObject as ft, APICallError as ht, RetryError as yt } from "ai";
5
+ import { applySuggestions as Be, suggestChanges as mt, revertSuggestions as ie } from "@blocknote/prosemirror-suggest-changes";
6
+ import { jsonSchema as xe, streamObject as pt, generateObject as ft, APICallError as ht, RetryError as yt } from "ai";
7
7
  import { TextSelection as gt, Plugin as Le, PluginKey as _e } from "prosemirror-state";
8
8
  import { fixTablesKey as kt } from "prosemirror-tables";
9
9
  import bt from "lodash.isequal";
10
10
  import { Slice as Y, Fragment as ae } from "prosemirror-model";
11
- import { Transform as N, Mapping as Ee, ReplaceStep as L, ReplaceAroundStep as St } from "prosemirror-transform";
11
+ import { Transform as A, Mapping as Ie, ReplaceStep as _, ReplaceAroundStep as St } from "prosemirror-transform";
12
12
  import { ChangeSet as ce, simplifyChanges as wt } from "prosemirror-changeset";
13
13
  import { DecorationSet as le, Decoration as ue } from "prosemirror-view";
14
14
  import { defaultSelectionBuilder as Tt } from "y-prosemirror";
15
15
  import { jsxs as vt, jsx as y } from "react/jsx-runtime";
16
16
  import { useBlockNoteContext as Ct, useComponentsContext as G, useSuggestionMenuKeyboardHandler as Pt, useBlockNoteEditor as K, useUIElementPositioning as Ot } from "@blocknote/react";
17
- import B, { useState as Ie, useCallback as D, useMemo as E, useEffect as Ne } from "react";
17
+ import B, { useState as Ee, useCallback as $, useMemo as E, useEffect as Ne } from "react";
18
18
  import { useStore as Ae } from "zustand";
19
19
  import { offset as Mt, size as Bt, autoUpdate as xt } from "@floating-ui/react";
20
20
  const de = (e) => {
21
21
  let t;
22
- const o = /* @__PURE__ */ new Set(), r = (u, m) => {
22
+ const o = /* @__PURE__ */ new Set(), r = (u, p) => {
23
23
  const l = typeof u == "function" ? u(t) : u;
24
24
  if (!Object.is(l, t)) {
25
25
  const f = t;
26
- t = m ?? (typeof l != "object" || l === null) ? l : Object.assign({}, t, l), o.forEach((p) => p(t, f));
26
+ t = p ?? (typeof l != "object" || l === null) ? l : Object.assign({}, t, l), o.forEach((m) => m(t, f));
27
27
  }
28
- }, n = () => t, s = { setState: r, getState: n, getInitialState: () => c, subscribe: (u) => (o.add(u), () => o.delete(u)) }, c = t = e(r, n, s);
29
- return s;
30
- }, pe = (e) => e ? de(e) : de;
28
+ }, n = () => t, i = { setState: r, getState: n, getInitialState: () => c, subscribe: (u) => (o.add(u), () => o.delete(u)) }, c = t = e(r, n, i);
29
+ return i;
30
+ }, me = (e) => e ? de(e) : de;
31
31
  function Lt(e) {
32
32
  const { properties: t, required: o, $defs: r, ...n } = e.parameters;
33
33
  return {
@@ -84,7 +84,7 @@ function _t(e) {
84
84
  }
85
85
  });
86
86
  }
87
- function I(e) {
87
+ function N(e) {
88
88
  if (e.locked)
89
89
  throw new Error(
90
90
  "Stream (source) is already locked and cannot be iterated."
@@ -103,22 +103,22 @@ function I(e) {
103
103
  }, t;
104
104
  }
105
105
  function De(e) {
106
- return I(_t(e));
106
+ return N(_t(e));
107
107
  }
108
- async function* Et(e) {
108
+ async function* It(e) {
109
109
  var n;
110
110
  let t = 0, o = !0, r;
111
- for await (const i of e)
112
- if ((n = i.operations) != null && n.length) {
113
- for (let a = t; a < i.operations.length; a++) {
114
- const s = i.operations[a];
115
- r = s, yield {
116
- partialOperation: s,
111
+ for await (const s of e)
112
+ if ((n = s.operations) != null && n.length) {
113
+ for (let a = t; a < s.operations.length; a++) {
114
+ const i = s.operations[a];
115
+ r = i, yield {
116
+ partialOperation: i,
117
117
  isUpdateToPreviousOperation: a === t && !o,
118
- isPossiblyPartial: a === i.operations.length - 1
118
+ isPossiblyPartial: a === s.operations.length - 1
119
119
  }, o = !1;
120
120
  }
121
- t = i.operations.length - 1;
121
+ t = s.operations.length - 1;
122
122
  }
123
123
  if (!r)
124
124
  throw new Error("No operations seen");
@@ -145,7 +145,7 @@ async function* $e(e, t) {
145
145
  async function* Re(e, t) {
146
146
  for await (const o of e) {
147
147
  const r = t.find(
148
- (i) => i.name === o.partialOperation.type
148
+ (s) => s.name === o.partialOperation.type
149
149
  );
150
150
  if (!r) {
151
151
  yield {
@@ -165,7 +165,7 @@ async function* Re(e, t) {
165
165
  };
166
166
  }
167
167
  }
168
- async function* It(e, t) {
168
+ async function* Et(e, t) {
169
169
  const o = Re(
170
170
  e,
171
171
  t
@@ -196,30 +196,31 @@ async function At(e, t) {
196
196
  throw new Error(
197
197
  "Cannot provide output or schema in _generateObjectOptions"
198
198
  );
199
- const i = {
199
+ const s = {
200
200
  // non-overridable options for streamObject
201
201
  output: "object",
202
202
  schema: xe(je(e)),
203
203
  // configurable options for streamObject
204
204
  // - optional, with defaults
205
205
  // mistral somehow needs "auto", while groq/llama needs "tool"
206
+ // google needs "auto" because https://github.com/vercel/ai/issues/6959
206
207
  // TODO: further research this and / or make configurable
207
208
  // for now stick to "tool" by default as this has been tested mostly
208
- mode: r.model.provider === "mistral.chat" ? "auto" : "tool",
209
+ mode: r.model.provider === "mistral.chat" || r.model.provider === "google.generative-ai" ? "auto" : "tool",
209
210
  // - mandatory ones:
210
211
  ...r,
211
212
  // extra options for streamObject
212
213
  ...o ?? {}
213
- }, a = await ft(i), s = jt(a.object);
214
- if (!s.ok)
215
- throw new Error(s.error);
214
+ }, a = await ft(s), i = jt(a.object);
215
+ if (!i.ok)
216
+ throw new Error(i.error);
216
217
  let c;
217
218
  return {
218
219
  streamObjectResult: void 0,
219
220
  generateObjectResult: a,
220
221
  get operationsSource() {
221
222
  return c || (c = De(
222
- Nt(s.value, e)
223
+ Nt(i.value, e)
223
224
  )), c;
224
225
  },
225
226
  async getGeneratedOperations() {
@@ -259,36 +260,37 @@ async function Dt(e, t, o = () => {
259
260
  // configurable options for streamObject
260
261
  // - optional, with defaults
261
262
  // mistral somehow needs "auto", while groq/llama needs "tool"
263
+ // google needs "auto" because https://github.com/vercel/ai/issues/6959
262
264
  // TODO: further research this and / or make configurable
263
265
  // for now stick to "tool" by default as this has been tested mostly
264
- mode: n.model.provider === "mistral.chat" ? "auto" : "tool",
266
+ mode: n.model.provider === "mistral.chat" || n.model.provider === "google.generative-ai" ? "auto" : "tool",
265
267
  // - mandatory ones:
266
268
  ...n,
267
269
  // extra options for streamObject
268
270
  ...t._streamObjectOptions ?? {}
269
- }, s = mt(a);
271
+ }, i = pt(a);
270
272
  let c;
271
- const [u, m] = s.fullStream.tee(), l = (async () => {
273
+ const [u, p] = i.fullStream.tee(), l = (async () => {
272
274
  let f = {
273
275
  operations: []
274
276
  };
275
- const p = I(
276
- Ht(m)
277
+ const m = N(
278
+ Ht(p)
277
279
  );
278
- for await (const h of p)
280
+ for await (const h of m)
279
281
  h && typeof h == "object" && "operations" in h && (f = h);
280
282
  return f;
281
283
  })();
282
284
  return {
283
- streamObjectResult: s,
285
+ streamObjectResult: i,
284
286
  generateObjectResult: void 0,
285
287
  get operationsSource() {
286
288
  return c || (c = De(
287
- It(
288
- Et(
289
+ Et(
290
+ It(
289
291
  $t(
290
292
  Rt(
291
- I(u)
293
+ N(u)
292
294
  ),
293
295
  o
294
296
  )
@@ -308,7 +310,7 @@ async function* $t(e, t) {
308
310
  o && (t(), o = !1), yield r;
309
311
  }
310
312
  function Rt(e) {
311
- return I(
313
+ return N(
312
314
  e.pipeThrough(
313
315
  new TransformStream({
314
316
  transform(t, o) {
@@ -333,7 +335,7 @@ function Rt(e) {
333
335
  );
334
336
  }
335
337
  function Ht(e) {
336
- return I(
338
+ return N(
337
339
  e.pipeThrough(
338
340
  new TransformStream({
339
341
  transform(t, o) {
@@ -394,14 +396,32 @@ class qt {
394
396
  console.log(JSON.stringify(t, null, 2));
395
397
  }
396
398
  }
397
- function z(e, t) {
399
+ function Ut(e, t, o = !0, r = !0) {
400
+ let n = 0, s = e.length;
401
+ if (o)
402
+ for (; n < s && t(e[n]); )
403
+ n++;
404
+ if (r)
405
+ for (; s > n && t(e[s - 1]); )
406
+ s--;
407
+ return e.slice(n, s);
408
+ }
409
+ function x(e, t) {
410
+ return Ut(
411
+ e,
412
+ (r) => X(r) && (t == null ? void 0 : t.cursorBlockId) !== r.id,
413
+ (t == null ? void 0 : t.trimStart) ?? !1,
414
+ (t == null ? void 0 : t.trimEnd) ?? !0
415
+ );
416
+ }
417
+ function F(e, t) {
398
418
  const o = e.getTextCursorPosition(), r = [];
399
419
  for (const n of t) {
400
- const i = n.id === o.block.id;
420
+ const s = n.id === o.block.id;
401
421
  r.push({
402
422
  id: n.id,
403
423
  block: n.block
404
- }), i && r.push({
424
+ }), s && r.push({
405
425
  cursor: !0
406
426
  });
407
427
  }
@@ -422,39 +442,23 @@ function T(e) {
422
442
  ...T(t.children)
423
443
  ]);
424
444
  }
425
- function x(e) {
445
+ function L(e) {
426
446
  return e.map((t) => typeof t == "object" && t && "id" in t ? {
427
447
  ...t,
428
448
  id: `${t.id}$`
429
449
  } : t);
430
450
  }
431
- function Ut(e, t, o = !0, r = !0) {
432
- let n = 0, i = e.length;
433
- if (o)
434
- for (; n < i && t(e[n]); )
435
- n++;
436
- if (r)
437
- for (; i > n && t(e[i - 1]); )
438
- i--;
439
- return e.slice(n, i);
440
- }
441
- function F(e, t) {
442
- return e.length === 1 ? e : Ut(
443
- e,
444
- (r) => X(r),
445
- (t == null ? void 0 : t.trimStart) ?? !1,
446
- (t == null ? void 0 : t.trimEnd) ?? !0
447
- );
448
- }
449
451
  async function He(e, t) {
450
- const o = F(e.document), r = await C(
451
- T(o),
452
- async (s) => e.blocksToHTMLLossy([s])
453
- ), i = z(e, r).filter(
454
- (s) => "cursor" in s || !(t.excludeBlockIds || []).includes(s.id)
452
+ const o = e.getTextCursorPosition().block.id, r = x(e.document, {
453
+ cursorBlockId: o
454
+ }), n = await C(
455
+ T(r),
456
+ async (c) => e.blocksToHTMLLossy([c])
457
+ ), a = F(e, n).filter(
458
+ (c) => "cursor" in c || !(t.excludeBlockIds || []).includes(c.id)
455
459
  );
456
460
  return {
457
- htmlBlocks: x(i)
461
+ htmlBlocks: L(a)
458
462
  };
459
463
  }
460
464
  async function qe(e, t) {
@@ -463,7 +467,7 @@ async function qe(e, t) {
463
467
  async (n) => e.blocksToHTMLLossy([n])
464
468
  );
465
469
  return {
466
- htmlSelectedBlocks: x(o),
470
+ htmlSelectedBlocks: L(o),
467
471
  htmlDocument: (await C(T(e.document), async (n) => e.blocksToHTMLLossy([n]))).map(({ block: n }) => ({ block: n }))
468
472
  // strip ids so LLM can't accidentally issue updates to ids not in selection
469
473
  };
@@ -521,8 +525,9 @@ function Ft(e) {
521
525
  ];
522
526
  }
523
527
  const Jt = async (e, t) => {
528
+ const o = x(e.document).length === 0;
524
529
  if (t.selectedBlocks) {
525
- const o = await qe(e, {
530
+ const r = await qe(e, {
526
531
  selectedBlocks: t.selectedBlocks
527
532
  });
528
533
  return t.previousMessages ? [
@@ -534,7 +539,7 @@ const Jt = async (e, t) => {
534
539
  },
535
540
  {
536
541
  role: "system",
537
- content: JSON.stringify(o.htmlSelectedBlocks)
542
+ content: JSON.stringify(r.htmlSelectedBlocks)
538
543
  },
539
544
  {
540
545
  role: "system",
@@ -542,7 +547,7 @@ const Jt = async (e, t) => {
542
547
  },
543
548
  {
544
549
  role: "system",
545
- content: JSON.stringify(o.htmlDocument)
550
+ content: JSON.stringify(r.htmlDocument)
546
551
  },
547
552
  {
548
553
  role: "system",
@@ -556,12 +561,11 @@ const Jt = async (e, t) => {
556
561
  content: t.userPrompt
557
562
  }
558
563
  ] : zt({
559
- ...o,
560
- userPrompt: t.userPrompt,
561
- isEmptyDocument: e.isEmpty
564
+ ...r,
565
+ userPrompt: t.userPrompt
562
566
  });
563
567
  } else {
564
- const o = await He(e, t);
568
+ const r = await He(e, t);
565
569
  return t.previousMessages ? [
566
570
  ...t.previousMessages,
567
571
  {
@@ -571,7 +575,7 @@ const Jt = async (e, t) => {
571
575
  },
572
576
  {
573
577
  role: "system",
574
- content: JSON.stringify(o.htmlBlocks)
578
+ content: JSON.stringify(r.htmlBlocks)
575
579
  },
576
580
  {
577
581
  role: "system",
@@ -585,9 +589,9 @@ const Jt = async (e, t) => {
585
589
  content: t.userPrompt
586
590
  }
587
591
  ] : Ft({
588
- ...o,
592
+ ...r,
589
593
  userPrompt: t.userPrompt,
590
- isEmptyDocument: e.isEmpty
594
+ isEmptyDocument: o
591
595
  });
592
596
  }
593
597
  };
@@ -595,36 +599,36 @@ function Vt(e) {
595
599
  let t, o = !1;
596
600
  return e.descendants((r, n) => o ? !1 : (r.isText && (o = !0, t = n), !0)), t;
597
601
  }
598
- function $(e) {
599
- var i;
600
- const t = ot(e), { modification: o } = t.marks, r = [], n = new N(e.before);
602
+ function R(e) {
603
+ var s;
604
+ const t = ot(e), { modification: o } = t.marks, r = [], n = new A(e.before);
601
605
  for (let a = 0; a < e.steps.length; a++) {
602
- const s = e.steps[a], c = new Ee(e.mapping.maps.slice(0, a)).invert();
603
- if (s.structure) {
604
- if (s instanceof L) {
605
- if (s.to !== s.from + 1 || s.slice.openStart !== 0 || s.slice.openEnd !== 1 || s.slice.content.size !== 2)
606
+ const i = e.steps[a], c = new Ie(e.mapping.maps.slice(0, a)).invert();
607
+ if (i.structure) {
608
+ if (i instanceof _) {
609
+ if (i.to !== i.from + 1 || i.slice.openStart !== 0 || i.slice.openEnd !== 1 || i.slice.content.size !== 2)
606
610
  throw new Error(
607
611
  "Structure change is not in expected format (ReplaceStep)"
608
612
  );
609
- } else if (s instanceof St) {
610
- if (s.insert !== 1 || s.slice.size !== 2 || s.gapTo !== s.to - 1 || s.gapFrom !== s.from + 1)
613
+ } else if (i instanceof St) {
614
+ if (i.insert !== 1 || i.slice.size !== 2 || i.gapTo !== i.to - 1 || i.gapFrom !== i.from + 1)
611
615
  throw new Error(
612
616
  "Structure change is not in expected format (ReplaceAroundStep)"
613
617
  );
614
618
  } else
615
619
  throw new Error("Step is not a ReplaceStep or ReplaceAroundStep");
616
- const b = c.map(s.from), g = s.slice.content.firstChild, k = n.doc.resolve(n.mapping.map(b)).nodeAfter;
620
+ const b = c.map(i.from), g = i.slice.content.firstChild, k = n.doc.resolve(n.mapping.map(b)).nodeAfter;
617
621
  let w = g.marks || [];
618
622
  g.type !== k.type && (w = o.create({
619
623
  type: "nodeType",
620
624
  previousValue: k.type.name,
621
625
  newValue: g.type.name
622
626
  }).addToSet(w));
623
- const A = /* @__PURE__ */ new Set([
627
+ const j = /* @__PURE__ */ new Set([
624
628
  ...Object.keys(g.attrs),
625
629
  ...Object.keys(k.attrs)
626
630
  ]);
627
- for (const P of A)
631
+ for (const P of j)
628
632
  g.attrs[P] !== k.attrs[P] && (w = o.create({
629
633
  type: "attr",
630
634
  attrName: P,
@@ -644,10 +648,10 @@ function $(e) {
644
648
  });
645
649
  continue;
646
650
  }
647
- if (!(s instanceof L))
651
+ if (!(i instanceof _))
648
652
  throw new Error("Step is not a ReplaceStep");
649
- const u = c.map(s.from), m = c.map(s.to);
650
- if (s.slice.openStart > 0 || s.slice.openEnd > 0)
653
+ const u = c.map(i.from), p = c.map(i.to);
654
+ if (i.slice.openStart > 0 || i.slice.openEnd > 0)
651
655
  throw new Error(
652
656
  "Slice has openStart or openEnd > 0, but structure=false"
653
657
  );
@@ -655,32 +659,32 @@ function $(e) {
655
659
  prosemirrorSteps: [],
656
660
  selection: {
657
661
  anchor: n.mapping.map(u),
658
- head: n.mapping.map(m)
662
+ head: n.mapping.map(p)
659
663
  },
660
664
  type: "select"
661
665
  });
662
- const l = s.slice.content.textBetween(0, s.slice.size), f = l === n.doc.textBetween(n.mapping.map(u), n.mapping.map(m));
663
- let p;
666
+ const l = i.slice.content.textBetween(0, i.slice.size), f = l === n.doc.textBetween(n.mapping.map(u), n.mapping.map(p));
667
+ let m;
664
668
  if (f)
665
- p = s.slice.content.size;
669
+ m = i.slice.content.size;
666
670
  else if (l.length === 0)
667
- p = s.slice.content.size;
671
+ m = i.slice.content.size;
668
672
  else {
669
- const b = Vt(s.slice.content);
673
+ const b = Vt(i.slice.content);
670
674
  if (b === void 0)
671
675
  throw new Error("unexpected: no first character found");
672
- p = b + 1;
676
+ m = b + 1;
673
677
  }
674
- let h = n.mapping.map(m);
675
- const d = n.mapping.map(m);
678
+ let h = n.mapping.map(p);
679
+ const d = n.mapping.map(p);
676
680
  let S = !0;
677
- for (let b = p; b <= s.slice.content.size; b++) {
678
- const g = S && u !== m, k = n.steps.length;
681
+ for (let b = m; b <= i.slice.content.size; b++) {
682
+ const g = S && u !== p, k = n.steps.length;
679
683
  if (g) {
680
684
  const M = n.doc.resolve(n.mapping.map(u));
681
- (i = M.nodeAfter) != null && i.isBlock && n.addNodeMark(M.pos, t.mark("deletion", {})), n.addMark(M.pos, h, t.mark("deletion", {})), h = n.mapping.map(m);
685
+ (s = M.nodeAfter) != null && s.isBlock && n.addNodeMark(M.pos, t.mark("deletion", {})), n.addMark(M.pos, h, t.mark("deletion", {})), h = n.mapping.map(p);
682
686
  }
683
- const w = new Y(s.slice.content.cut(0, b), 0, 0);
687
+ const w = new Y(i.slice.content.cut(0, b), 0, 0);
684
688
  n.replace(d, h, w).addMark(
685
689
  d,
686
690
  d + w.content.size,
@@ -690,15 +694,15 @@ function $(e) {
690
694
  d + w.content.size,
691
695
  (M, P) => P < d || P > d + w.content.size ? !0 : (M.isBlock && n.addNodeMark(P, t.mark("insertion", {})), !1)
692
696
  ), h = n.mapping.slice(k).map(h);
693
- const A = gt.near(
697
+ const j = gt.near(
694
698
  n.doc.resolve(d + w.content.size),
695
699
  -1
696
700
  );
697
701
  r.push({
698
702
  prosemirrorSteps: n.steps.slice(k),
699
703
  selection: {
700
- anchor: A.from,
701
- head: A.from
704
+ anchor: j.from,
705
+ head: j.from
702
706
  },
703
707
  type: g ? "replace" : "insert"
704
708
  // 3. Insert the replacement character by character
@@ -731,52 +735,52 @@ function ee(e, t) {
731
735
  return e;
732
736
  }
733
737
  function Zt(e, t, o) {
734
- const r = new N(t);
738
+ const r = new A(t);
735
739
  for (const a of e) {
736
- const s = new L(
740
+ const i = new _(
737
741
  r.mapping.map(a.fromA),
738
742
  r.mapping.map(a.toA),
739
743
  o.slice(a.fromB, a.toB)
740
744
  );
741
- r.step(s);
745
+ r.step(i);
742
746
  }
743
747
  const n = r.mapping.invert();
744
- let i = r.doc.content.findDiffStart(o.content);
745
- for (; i !== null; ) {
746
- const a = o.resolve(i).nodeAfter, s = r.doc.resolve(i).nodeAfter;
747
- if (!a || !s)
748
+ let s = r.doc.content.findDiffStart(o.content);
749
+ for (; s !== null; ) {
750
+ const a = o.resolve(s).nodeAfter, i = r.doc.resolve(s).nodeAfter;
751
+ if (!a || !i)
748
752
  throw new Error("diffNode not found");
749
- const c = !a.isLeaf && a.content.eq(s.content), u = c ? 1 : Math.min(a.nodeSize, s.nodeSize), m = i + u, l = n.map(i), f = n.map(m);
750
- let p = e.length;
753
+ const c = !a.isLeaf && a.content.eq(i.content), u = c ? 1 : Math.min(a.nodeSize, i.nodeSize), p = s + u, l = n.map(s), f = n.map(p);
754
+ let m = e.length;
751
755
  for (let d = 0; d < e.length; d++)
752
756
  if (e[d].fromA >= f) {
753
- p = d;
757
+ m = d;
754
758
  break;
755
759
  }
756
- e.splice(p, 0, {
760
+ e.splice(m, 0, {
757
761
  fromA: l,
758
762
  toA: f,
759
- fromB: i,
760
- toB: m,
763
+ fromB: s,
764
+ toB: p,
761
765
  deleted: [],
762
766
  inserted: [],
763
767
  type: c ? "node-type-or-attr-update" : "mark-update"
764
768
  }), r.step(
765
- new L(
766
- i,
767
- m,
768
- o.slice(i, m),
769
+ new _(
770
+ s,
771
+ p,
772
+ o.slice(s, p),
769
773
  c
770
774
  )
771
775
  );
772
776
  const h = r.doc.content.findDiffStart(o.content);
773
- if (h === i)
777
+ if (h === s)
774
778
  throw new Error("diffStart not moving");
775
- i = h;
779
+ s = h;
776
780
  }
777
781
  return e;
778
782
  }
779
- const me = (e, t) => {
783
+ const pe = (e, t) => {
780
784
  const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
781
785
  e.descendants((a) => {
782
786
  a.type.name === "tableCell" && o.add(JSON.stringify(a.toJSON()));
@@ -790,58 +794,58 @@ const me = (e, t) => {
790
794
  encodeCharacter: (a) => a,
791
795
  encodeNodeStart: (a) => {
792
796
  if (a.type.name === "tableCell") {
793
- const s = JSON.stringify(a.toJSON());
794
- return n.has(s) ? s : a.type.name;
797
+ const i = JSON.stringify(a.toJSON());
798
+ return n.has(i) ? i : a.type.name;
795
799
  }
796
800
  return a.type.name;
797
801
  },
798
802
  encodeNodeEnd: (a) => {
799
803
  if (a.type.name === "tableCell") {
800
- const s = JSON.stringify(a.toJSON());
801
- return n.has(s) ? s : -1;
804
+ const i = JSON.stringify(a.toJSON());
805
+ return n.has(i) ? i : -1;
802
806
  }
803
807
  return -1;
804
808
  },
805
- compareTokens: (a, s) => a === s
809
+ compareTokens: (a, i) => a === i
806
810
  };
807
811
  };
808
812
  function J(e, t, o = !1, r, n) {
809
- const i = rt(e.id, t), a = new N(t);
813
+ const s = rt(e.id, t), a = new A(t);
810
814
  nt(
811
815
  a,
812
- i.posBeforeNode,
816
+ s.posBeforeNode,
813
817
  e.block,
814
818
  r,
815
819
  n
816
820
  );
817
- let s = a.doc, c = ce.create(
821
+ let i = a.doc, c = ce.create(
818
822
  t,
819
823
  void 0,
820
- me(t, s)
824
+ pe(t, i)
821
825
  );
822
- if (c = c.addSteps(s, a.mapping.maps, 0), o && c.changes.length > 0) {
823
- const l = c.changes[c.changes.length - 1], f = l.toA - l.fromA, p = l.toB - l.fromB;
824
- if (f > p) {
826
+ if (c = c.addSteps(i, a.mapping.maps, 0), o && c.changes.length > 0) {
827
+ const l = c.changes[c.changes.length - 1], f = l.toA - l.fromA, m = l.toB - l.fromB;
828
+ if (f > m) {
825
829
  const h = t.slice(
826
- l.fromA + p,
830
+ l.fromA + m,
827
831
  l.toA
828
832
  );
829
833
  a.step(
830
- new L(l.toB, l.toB, h)
831
- ), s = a.doc, c = ce.create(
834
+ new _(l.toB, l.toB, h)
835
+ ), i = a.doc, c = ce.create(
832
836
  c.startDoc,
833
837
  void 0,
834
- me(c.startDoc, s)
835
- ), c = c.addSteps(s, a.mapping.maps, 0);
838
+ pe(c.startDoc, i)
839
+ ), c = c.addSteps(i, a.mapping.maps, 0);
836
840
  }
837
841
  }
838
- const u = [], m = wt(
842
+ const u = [], p = wt(
839
843
  c.changes,
840
- s
844
+ i
841
845
  );
842
- for (let l = 0; l < m.length; l++) {
843
- const f = m[l], p = s.slice(f.fromB, f.toB);
844
- if (p.openEnd === 1 && p.openStart === 0 && (f.type = "node-type-or-attr-update", p.size > 2)) {
846
+ for (let l = 0; l < p.length; l++) {
847
+ const f = p[l], m = i.slice(f.fromB, f.toB);
848
+ if (m.openEnd === 1 && m.openStart === 0 && (f.type = "node-type-or-attr-update", m.size > 2)) {
845
849
  const h = {
846
850
  fromA: f.fromA,
847
851
  toA: f.fromA + 1,
@@ -858,21 +862,21 @@ function J(e, t, o = !1, r, n) {
858
862
  deleted: [],
859
863
  inserted: []
860
864
  };
861
- m.splice(l, 1, h, d), l++;
865
+ p.splice(l, 1, h, d), l++;
862
866
  }
863
867
  }
864
- Zt(m, t, s);
865
- for (let l = 0; l < m.length; l++) {
866
- const f = m[l], p = s.slice(f.fromB, f.toB);
867
- if (p.openEnd > 0 && p.size > 1)
868
+ Zt(p, t, i);
869
+ for (let l = 0; l < p.length; l++) {
870
+ const f = p[l], m = i.slice(f.fromB, f.toB);
871
+ if (m.openEnd > 0 && m.size > 1)
868
872
  throw new Error(
869
873
  "unexpected, openEnd > 0 and size > 1, this should have been split into two steps"
870
874
  );
871
- l === m.length - 1 && o && f.type === "mark-update" || u.push(
872
- new L(
875
+ l === p.length - 1 && o && f.type === "mark-update" || u.push(
876
+ new _(
873
877
  f.fromA,
874
878
  f.toA,
875
- p,
879
+ m,
876
880
  f.type === "node-type-or-attr-update"
877
881
  )
878
882
  );
@@ -942,83 +946,83 @@ function te(e) {
942
946
  ok: !1,
943
947
  error: "referenceId and blocks are required"
944
948
  };
945
- let i = n.referenceId;
949
+ let s = n.referenceId;
946
950
  if (o.idsSuffixed) {
947
- if (!(i != null && i.endsWith("$")))
951
+ if (!(s != null && s.endsWith("$")))
948
952
  return {
949
953
  ok: !1,
950
954
  error: "referenceId must end with $"
951
955
  };
952
- i = i.slice(0, -1);
956
+ s = s.slice(0, -1);
953
957
  }
954
- if (!t.getBlock(i))
958
+ if (!t.getBlock(s))
955
959
  return {
956
960
  ok: !1,
957
961
  error: "referenceId not found"
958
962
  };
959
- const s = Wt(
963
+ const i = Wt(
960
964
  n.blocks,
961
965
  (c) => e.validateBlock(c, t)
962
966
  );
963
- return s.ok ? {
967
+ return i.ok ? {
964
968
  ok: !0,
965
969
  value: {
966
970
  type: n.type,
967
- referenceId: i,
971
+ referenceId: s,
968
972
  position: n.position,
969
- blocks: s.value
973
+ blocks: i.value
970
974
  }
971
- } : s;
975
+ } : i;
972
976
  },
973
977
  // Note: functionality mostly tested in jsontools.test.ts
974
978
  // would be nicer to add a direct unit test
975
979
  execute: async function* (n) {
976
- var s;
977
- let i = [];
980
+ var i;
981
+ let s = [];
978
982
  const a = {};
979
983
  for await (const c of n) {
980
- if (c.isUpdateToPreviousOperation || (i = []), c.operation.type !== "add") {
984
+ if (c.isUpdateToPreviousOperation || (s = []), c.operation.type !== "add") {
981
985
  yield c;
982
986
  continue;
983
987
  }
984
- const u = c.operation, m = await e.toJSONToolCall(t, {
988
+ const u = c.operation, p = await e.toJSONToolCall(t, {
985
989
  ...c,
986
990
  operation: u
987
991
  });
988
- if (m && !(c.isPossiblyPartial && X(
989
- m.blocks[m.blocks.length - 1]
992
+ if (p && !(c.isPossiblyPartial && X(
993
+ p.blocks[p.blocks.length - 1]
990
994
  ))) {
991
- for (let l = 0; l < m.blocks.length; l++) {
992
- const f = m.blocks[l], p = t.prosemirrorState.tr;
995
+ for (let l = 0; l < p.blocks.length; l++) {
996
+ const f = p.blocks[l], m = t.prosemirrorState.tr;
993
997
  let h = [];
994
- if (l < i.length) {
995
- const d = await e.rebaseTool(i[l], t), b = J(
998
+ if (l < s.length) {
999
+ const d = await e.rebaseTool(s[l], t), b = J(
996
1000
  {
997
- id: i[l],
1001
+ id: s[l],
998
1002
  block: f
999
1003
  },
1000
1004
  d.doc,
1001
1005
  !1
1002
1006
  ).map((g) => g.map(d.invertMap));
1003
1007
  for (const g of b)
1004
- p.step(g.map(p.mapping));
1005
- h = $(p), h = h.filter((g) => g.type !== "select");
1008
+ m.step(g.map(m.mapping));
1009
+ h = R(m), h = h.filter((g) => g.type !== "select");
1006
1010
  } else {
1007
1011
  const d = u.position === "after" ? a[u.referenceId] : void 0, S = st(
1008
- p,
1012
+ m,
1009
1013
  [f],
1010
- l > 0 ? i[l - 1] : d || u.referenceId,
1014
+ l > 0 ? s[l - 1] : d || u.referenceId,
1011
1015
  l > 0 ? "after" : u.position
1012
1016
  );
1013
- i.push(...S.map((b) => b.id)), h = $(p);
1017
+ s.push(...S.map((b) => b.id)), h = R(m);
1014
1018
  }
1015
1019
  h.find((d) => d.type === "replace");
1016
1020
  for (const d of h)
1017
1021
  o.withDelays && await Q(d), t.transact((S) => {
1018
1022
  ee(S, d);
1019
- }), (s = o.onBlockUpdate) == null || s.call(o, i[l]);
1023
+ }), (i = o.onBlockUpdate) == null || i.call(o, s[l]);
1020
1024
  }
1021
- c.isPossiblyPartial || u.position === "after" && (a[u.referenceId] = i[i.length - 1]);
1025
+ c.isPossiblyPartial || u.position === "after" && (a[u.referenceId] = s[s.length - 1]);
1022
1026
  }
1023
1027
  }
1024
1028
  }
@@ -1054,42 +1058,42 @@ function oe(e) {
1054
1058
  ok: !1,
1055
1059
  error: "id is required"
1056
1060
  };
1057
- let i = n.id;
1061
+ let s = n.id;
1058
1062
  if (o.idsSuffixed) {
1059
- if (!(i != null && i.endsWith("$")))
1063
+ if (!(s != null && s.endsWith("$")))
1060
1064
  return {
1061
1065
  ok: !1,
1062
1066
  error: "id must end with $"
1063
1067
  };
1064
- i = i.slice(0, -1);
1068
+ s = s.slice(0, -1);
1065
1069
  }
1066
1070
  if (!n.block)
1067
1071
  return {
1068
1072
  ok: !1,
1069
1073
  error: "block is required"
1070
1074
  };
1071
- const a = t.getBlock(i);
1075
+ const a = t.getBlock(s);
1072
1076
  if (!a)
1073
- return console.error("BLOCK NOT FOUND", i), {
1077
+ return console.error("BLOCK NOT FOUND", s), {
1074
1078
  ok: !1,
1075
1079
  error: "block not found"
1076
1080
  };
1077
- const s = e.validateBlock(n.block, t, a.type);
1078
- return s.ok ? {
1081
+ const i = e.validateBlock(n.block, t, a.type);
1082
+ return i.ok ? {
1079
1083
  ok: !0,
1080
1084
  value: {
1081
1085
  type: n.type,
1082
- id: i,
1083
- block: s.value
1086
+ id: s,
1087
+ block: i.value
1084
1088
  }
1085
- } : s;
1089
+ } : i;
1086
1090
  },
1087
1091
  // Note: functionality mostly tested in jsontools.test.ts
1088
1092
  // would be nicer to add a direct unit test
1089
1093
  execute: async function* (n) {
1090
1094
  var c;
1091
1095
  let a = 50;
1092
- const s = o.updateSelection ? {
1096
+ const i = o.updateSelection ? {
1093
1097
  from: se(t, o.updateSelection.from),
1094
1098
  to: se(t, o.updateSelection.to)
1095
1099
  } : void 0;
@@ -1098,15 +1102,15 @@ function oe(e) {
1098
1102
  yield u;
1099
1103
  continue;
1100
1104
  }
1101
- const m = u.operation;
1105
+ const p = u.operation;
1102
1106
  if (u.isPossiblyPartial) {
1103
- const k = JSON.stringify(m.block).length;
1107
+ const k = JSON.stringify(p.block).length;
1104
1108
  if (k < a)
1105
1109
  continue;
1106
1110
  a = k + 50;
1107
1111
  } else
1108
1112
  a = 50;
1109
- const l = await e.rebaseTool(m.id, t), f = s ? l.invertMap.invert().map(s.from()) : void 0, p = s ? l.invertMap.invert().map(s.to()) : void 0, h = await e.toJSONToolCall(t, u);
1113
+ const l = await e.rebaseTool(p.id, t), f = i ? l.invertMap.invert().map(i.from()) : void 0, m = i ? l.invertMap.invert().map(i.to()) : void 0, h = await e.toJSONToolCall(t, u);
1110
1114
  if (!h)
1111
1115
  continue;
1112
1116
  const d = J(
@@ -1114,18 +1118,18 @@ function oe(e) {
1114
1118
  l.doc,
1115
1119
  u.isPossiblyPartial,
1116
1120
  f,
1117
- p
1121
+ m
1118
1122
  );
1119
1123
  if (d.length === 1 && u.isPossiblyPartial)
1120
1124
  continue;
1121
- const S = d.map((k) => k.map(l.invertMap)), b = new N(t.prosemirrorState.doc);
1125
+ const S = d.map((k) => k.map(l.invertMap)), b = new A(t.prosemirrorState.doc);
1122
1126
  for (const k of S)
1123
1127
  b.step(k.map(b.mapping));
1124
- const g = $(b);
1128
+ const g = R(b);
1125
1129
  for (const k of g)
1126
1130
  o.withDelays && await Q(k), t.transact((w) => {
1127
1131
  ee(w, k);
1128
- }), (c = o.onBlockUpdate) == null || c.call(o, m.id);
1132
+ }), (c = o.onBlockUpdate) == null || c.call(o, p.id);
1129
1133
  }
1130
1134
  }
1131
1135
  };
@@ -1184,13 +1188,13 @@ const re = (e, t) => ({
1184
1188
  yield n;
1185
1189
  continue;
1186
1190
  }
1187
- const i = n.operation, a = e.prosemirrorState.tr;
1188
- it(a, [i.id], []);
1189
- const s = $(a);
1190
- for (const c of s)
1191
+ const s = n.operation, a = e.prosemirrorState.tr;
1192
+ it(a, [s.id], []);
1193
+ const i = R(a);
1194
+ for (const c of i)
1191
1195
  t.withDelays && await Q(c), e.transact((u) => {
1192
1196
  ee(u, c);
1193
- }), (r = t.onBlockUpdate) == null || r.call(t, i.id);
1197
+ }), (r = t.onBlockUpdate) == null || r.call(t, s.id);
1194
1198
  }
1195
1199
  }
1196
1200
  });
@@ -1204,13 +1208,13 @@ function fe(e) {
1204
1208
  0,
1205
1209
  r.length - n[0].length
1206
1210
  ));
1207
- const s = new DOMParser().parseFromString(
1211
+ const i = new DOMParser().parseFromString(
1208
1212
  `<div>${r}</div>`,
1209
1213
  "text/html"
1210
1214
  ).body.firstChild;
1211
- return s ? s.innerHTML : "";
1215
+ return i ? i.innerHTML : "";
1212
1216
  }
1213
- function R(e) {
1217
+ function H(e) {
1214
1218
  let t;
1215
1219
  if (Be(e.prosemirrorState, (o) => {
1216
1220
  t = o;
@@ -1218,7 +1222,7 @@ function R(e) {
1218
1222
  throw new Error("applySuggestionsTr is not set");
1219
1223
  return t;
1220
1224
  }
1221
- function H(e, t) {
1225
+ function q(e, t) {
1222
1226
  const o = t.mapping.invert();
1223
1227
  return {
1224
1228
  doc: t.doc,
@@ -1226,7 +1230,7 @@ function H(e, t) {
1226
1230
  * Return a new transform that has the projection applied.
1227
1231
  * You can add new operations to this transform and later rebase those on the original document with `rebaseTr`
1228
1232
  */
1229
- tr: () => new N(t.doc),
1233
+ tr: () => new A(t.doc),
1230
1234
  /**
1231
1235
  * Invert map created by the projection.
1232
1236
  * You can use this to map positions on the "clean" document (the projection) to positions on the original document
@@ -1240,8 +1244,8 @@ function H(e, t) {
1240
1244
  if (r.steps.length === 0)
1241
1245
  throw new Error("No steps to apply");
1242
1246
  let n = e.prosemirrorState.tr;
1243
- for (const i of r.steps) {
1244
- const a = i.map(o);
1247
+ for (const s of r.steps) {
1248
+ const a = s.map(o);
1245
1249
  if (!a)
1246
1250
  throw new Error("Step is not mapped");
1247
1251
  n = n.step(a);
@@ -1252,7 +1256,7 @@ function H(e, t) {
1252
1256
  }
1253
1257
  async function he(e, t) {
1254
1258
  var u;
1255
- const o = R(t), r = Oe(o.doc, e);
1259
+ const o = H(t), r = Oe(o.doc, e);
1256
1260
  if (!r)
1257
1261
  throw new Error("block not found");
1258
1262
  const n = await t.blocksToHTMLLossy([
@@ -1260,19 +1264,19 @@ async function he(e, t) {
1260
1264
  ...r,
1261
1265
  children: []
1262
1266
  }
1263
- ]), i = (u = window.__TEST_OPTIONS) == null ? void 0 : u.mockID, a = await t.tryParseHTMLToBlocks(n);
1264
- if (window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = i), a.length !== 1)
1267
+ ]), s = (u = window.__TEST_OPTIONS) == null ? void 0 : u.mockID, a = await t.tryParseHTMLToBlocks(n);
1268
+ if (window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = s), a.length !== 1)
1265
1269
  throw new Error("html diff invalid block count");
1266
- const s = a[0];
1267
- if (s.id = e, J(
1270
+ const i = a[0];
1271
+ if (i.id = e, J(
1268
1272
  {
1269
1273
  id: e,
1270
- block: s
1274
+ block: i
1271
1275
  },
1272
1276
  o.doc
1273
1277
  ).length)
1274
1278
  throw new Error("html diff");
1275
- return H(t, o);
1279
+ return q(t, o);
1276
1280
  }
1277
1281
  function ye(e) {
1278
1282
  return typeof e != "string" ? {
@@ -1288,13 +1292,8 @@ const V = {
1288
1292
  description: "Insert new blocks",
1289
1293
  schema: {
1290
1294
  block: {
1291
- $ref: "#/$defs/block"
1292
- },
1293
- $defs: {
1294
- block: {
1295
- type: "string",
1296
- description: "html of block (MUST be a single HTML element)"
1297
- }
1295
+ type: "string",
1296
+ description: "html of block (MUST be a single HTML element)"
1298
1297
  }
1299
1298
  },
1300
1299
  validateBlock: ye,
@@ -1302,10 +1301,10 @@ const V = {
1302
1301
  toJSONToolCall: async (e, t) => {
1303
1302
  var n;
1304
1303
  const o = (n = window.__TEST_OPTIONS) == null ? void 0 : n.mockID, r = (await Promise.all(
1305
- t.operation.blocks.map(async (i) => {
1306
- const a = t.isPossiblyPartial ? fe(i) : i;
1304
+ t.operation.blocks.map(async (s) => {
1305
+ const a = t.isPossiblyPartial ? fe(s) : s;
1307
1306
  return a ? (await e.tryParseHTMLToBlocks(a)).map(
1308
- (s) => (delete s.id, s)
1307
+ (i) => (delete i.id, i)
1309
1308
  ) : [];
1310
1309
  })
1311
1310
  )).flat();
@@ -1320,13 +1319,8 @@ const V = {
1320
1319
  description: "Update a block",
1321
1320
  schema: {
1322
1321
  block: {
1323
- $ref: "#/$defs/block"
1324
- },
1325
- $defs: {
1326
- block: {
1327
- type: "string",
1328
- description: "html of block (MUST be a single HTML element)"
1329
- }
1322
+ type: "string",
1323
+ description: "html of block (MUST be a single HTML element)"
1330
1324
  }
1331
1325
  },
1332
1326
  validateBlock: ye,
@@ -1345,14 +1339,14 @@ const V = {
1345
1339
  delete: re
1346
1340
  };
1347
1341
  function Yt(e, t, o, r, n) {
1348
- const i = {
1342
+ const s = {
1349
1343
  add: !0,
1350
1344
  update: !0,
1351
1345
  delete: !0,
1352
1346
  ...o
1353
1347
  };
1354
1348
  return [
1355
- ...i.update ? [
1349
+ ...s.update ? [
1356
1350
  V.update(e, {
1357
1351
  idsSuffixed: !0,
1358
1352
  withDelays: t,
@@ -1360,8 +1354,8 @@ function Yt(e, t, o, r, n) {
1360
1354
  onBlockUpdate: n
1361
1355
  })
1362
1356
  ] : [],
1363
- ...i.add ? [V.add(e, { idsSuffixed: !0, withDelays: t, onBlockUpdate: n })] : [],
1364
- ...i.delete ? [V.delete(e, { idsSuffixed: !0, withDelays: t, onBlockUpdate: n })] : []
1357
+ ...s.add ? [V.add(e, { idsSuffixed: !0, withDelays: t, onBlockUpdate: n })] : [],
1358
+ ...s.delete ? [V.delete(e, { idsSuffixed: !0, withDelays: t, onBlockUpdate: n })] : []
1365
1359
  ];
1366
1360
  }
1367
1361
  const Ue = {
@@ -1387,12 +1381,12 @@ async function Gt(e, t) {
1387
1381
  userPrompt: o,
1388
1382
  useSelection: r,
1389
1383
  deleteEmptyCursorBlock: n,
1390
- stream: i,
1384
+ stream: s,
1391
1385
  onStart: a,
1392
- withDelays: s,
1386
+ withDelays: i,
1393
1387
  dataFormat: c,
1394
1388
  previousResponse: u,
1395
- ...m
1389
+ ...p
1396
1390
  } = {
1397
1391
  maxRetries: 2,
1398
1392
  deleteEmptyCursorBlock: !0,
@@ -1400,14 +1394,15 @@ async function Gt(e, t) {
1400
1394
  withDelays: !0,
1401
1395
  dataFormat: Ue,
1402
1396
  ...t
1403
- }, l = t.promptBuilder ?? c.defaultPromptBuilder, f = c.getStreamTools, p = r ? void 0 : e.getTextCursorPosition().block, h = p && n && X(p) && e.document.length > 1 ? p.id : void 0, d = r ? e.getSelectionCutBlocks() : void 0;
1397
+ }, l = t.promptBuilder ?? c.defaultPromptBuilder, f = c.getStreamTools, m = r ? void 0 : e.getTextCursorPosition().block, h = m && n && X(m) && x(e.document).length > 0 ? m.id : void 0, d = r ? e.getSelectionCutBlocks() : void 0;
1404
1398
  let S;
1405
1399
  u && (S = u.messages.map((w) => w.role === "user" && typeof w.content == "string" ? {
1406
1400
  role: "system",
1407
1401
  content: `USER_MESSAGE: ${w.content}`
1408
1402
  } : w), S.push({
1409
- role: "assistant",
1410
- content: `These are the operations returned by a previous LLM call:
1403
+ role: "system",
1404
+ // using "assistant" here doesn't work with gemini because we can't mix system / assistant messages
1405
+ content: `ASSISTANT_MESSAGE: These are the operations returned by a previous LLM call:
1411
1406
  ` + JSON.stringify(
1412
1407
  await u.llmResult.getGeneratedOperations()
1413
1408
  )
@@ -1419,38 +1414,40 @@ async function Gt(e, t) {
1419
1414
  previousMessages: S
1420
1415
  }), g = f(
1421
1416
  e,
1422
- s,
1417
+ i,
1423
1418
  t.defaultStreamTools,
1424
1419
  d ? { from: d._meta.startPos, to: d._meta.endPos } : void 0,
1425
1420
  t.onBlockUpdate
1426
1421
  );
1427
1422
  let k;
1428
- return i ? k = await Dt(
1423
+ return s ? k = await Dt(
1429
1424
  g,
1430
1425
  {
1431
1426
  messages: b,
1432
- ...m
1427
+ ...p
1433
1428
  },
1434
1429
  () => {
1435
1430
  h && e.removeBlocks([h]), a == null || a();
1436
1431
  }
1437
1432
  ) : (k = await At(g, {
1438
1433
  messages: b,
1439
- ...m
1434
+ ...p
1440
1435
  }), h && e.removeBlocks([h]), a == null || a()), new qt(b, k, g);
1441
1436
  }
1442
1437
  async function ze(e, t) {
1443
- const o = F(e.document), r = await C(
1444
- T(o),
1445
- async (s) => ({
1446
- ...s,
1438
+ const o = e.getTextCursorPosition().block.id, r = x(e.document, {
1439
+ cursorBlockId: o
1440
+ }), n = await C(
1441
+ T(r),
1442
+ async (c) => ({
1443
+ ...c,
1447
1444
  children: void 0
1448
1445
  })
1449
- ), i = z(e, r).filter(
1450
- (s) => "cursor" in s || !(t.excludeBlockIds || []).includes(s.id)
1446
+ ), a = F(e, n).filter(
1447
+ (c) => "cursor" in c || !(t.excludeBlockIds || []).includes(c.id)
1451
1448
  );
1452
1449
  return {
1453
- jsonBlocks: x(i)
1450
+ jsonBlocks: L(a)
1454
1451
  };
1455
1452
  }
1456
1453
  async function Fe(e, t) {
@@ -1459,7 +1456,7 @@ async function Fe(e, t) {
1459
1456
  async (n) => n
1460
1457
  );
1461
1458
  return {
1462
- jsonSelectedBlocks: x(o),
1459
+ jsonSelectedBlocks: L(o),
1463
1460
  jsonDocument: (await C(T(e.document), async (n) => ({
1464
1461
  ...n,
1465
1462
  id: void 0,
@@ -1558,37 +1555,37 @@ function Xt(e) {
1558
1555
  ];
1559
1556
  }
1560
1557
  const Qt = async (e, t) => {
1558
+ const o = x(e.document).length === 0;
1561
1559
  if (t.selectedBlocks) {
1562
- const o = await Fe(e, {
1560
+ const r = await Fe(e, {
1563
1561
  selectedBlocks: t.selectedBlocks
1564
1562
  });
1565
1563
  return Kt({
1566
- ...o,
1567
- userPrompt: t.userPrompt,
1568
- isEmptyDocument: e.isEmpty
1564
+ ...r,
1565
+ userPrompt: t.userPrompt
1569
1566
  });
1570
1567
  } else {
1571
- const o = await ze(e, t);
1568
+ const r = await ze(e, t);
1572
1569
  return Xt({
1573
- ...o,
1570
+ ...r,
1574
1571
  userPrompt: t.userPrompt,
1575
- isEmptyDocument: e.isEmpty
1572
+ isEmptyDocument: o
1576
1573
  });
1577
1574
  }
1578
1575
  };
1579
1576
  function eo(e) {
1580
1577
  const t = {}, o = {};
1581
1578
  return e.forEach((n) => {
1582
- const { type: i, ...a } = n.properties, s = JSON.stringify(a);
1583
- t[s] ? t[s].push(i.enum[0]) : (t[s] = [i.enum[0]], o[s] = n);
1579
+ const { type: s, ...a } = n.properties, i = JSON.stringify(a);
1580
+ t[i] ? t[i].push(s.enum[0]) : (t[i] = [s.enum[0]], o[i] = n);
1584
1581
  }), Object.keys(
1585
1582
  t
1586
1583
  ).map((n) => {
1587
- const i = o[n];
1584
+ const s = o[n];
1588
1585
  return {
1589
- ...i,
1586
+ ...s,
1590
1587
  properties: {
1591
- ...i.properties,
1588
+ ...s.properties,
1592
1589
  type: {
1593
1590
  type: "string",
1594
1591
  enum: t[n]
@@ -1798,7 +1795,7 @@ function ke(e, t, o) {
1798
1795
  ok: !0,
1799
1796
  value: e
1800
1797
  };
1801
- if (!e.content.every((i) => Ve(i, t)))
1798
+ if (!e.content.every((s) => Ve(s, t)))
1802
1799
  return {
1803
1800
  ok: !1,
1804
1801
  error: "block content must be an array of inline content"
@@ -1819,7 +1816,7 @@ const Z = {
1819
1816
  ...ge(e.schema)
1820
1817
  }),
1821
1818
  validateBlock: ke,
1822
- rebaseTool: async (e, t) => H(t, R(t)),
1819
+ rebaseTool: async (e, t) => q(t, H(t)),
1823
1820
  toJSONToolCall: async (e, t) => t.operation
1824
1821
  }),
1825
1822
  update: oe({
@@ -1831,7 +1828,7 @@ const Z = {
1831
1828
  ...ge(e.schema)
1832
1829
  }),
1833
1830
  validateBlock: ke,
1834
- rebaseTool: async (e, t) => H(t, R(t)),
1831
+ rebaseTool: async (e, t) => q(t, H(t)),
1835
1832
  toJSONToolCall: async (e, t) => {
1836
1833
  const o = Object.fromEntries(
1837
1834
  Object.entries(Me).map(([r, n]) => [r, n.default])
@@ -1888,14 +1885,16 @@ const ao = {
1888
1885
  }
1889
1886
  };
1890
1887
  async function Ze(e, t) {
1891
- const o = F(e.document), r = await C(
1892
- T(o),
1893
- async (s) => e.blocksToMarkdownLossy([s])
1894
- ), i = z(e, r).filter(
1895
- (s) => "cursor" in s || !(t.excludeBlockIds || []).includes(s.id)
1888
+ const o = e.getTextCursorPosition().block.id, r = x(e.document, {
1889
+ cursorBlockId: o
1890
+ }), n = await C(
1891
+ T(r),
1892
+ async (c) => e.blocksToMarkdownLossy([c])
1893
+ ), a = F(e, n).filter(
1894
+ (c) => "cursor" in c || !(t.excludeBlockIds || []).includes(c.id)
1896
1895
  );
1897
1896
  return {
1898
- markdownBlocks: x(i)
1897
+ markdownBlocks: L(a)
1899
1898
  };
1900
1899
  }
1901
1900
  async function We(e, t) {
@@ -1904,7 +1903,7 @@ async function We(e, t) {
1904
1903
  async (n) => e.blocksToMarkdownLossy([n])
1905
1904
  );
1906
1905
  return {
1907
- markdownSelectedBlocks: x(o),
1906
+ markdownSelectedBlocks: L(o),
1908
1907
  markdownDocument: (await C(T(e.document), async (n) => e.blocksToMarkdownLossy([n]))).map(({ block: n }) => ({ block: n }))
1909
1908
  // strip ids so LLM can't accidentally issue updates to ids not in selection
1910
1909
  };
@@ -1983,20 +1982,20 @@ const uo = async (e, t) => {
1983
1982
  }
1984
1983
  };
1985
1984
  async function be(e, t) {
1986
- const o = R(t), r = await t.blocksToMarkdownLossy([Oe(o.doc, e)]), n = await t.tryParseMarkdownToBlocks(r), i = J(
1985
+ const o = H(t), r = await t.blocksToMarkdownLossy([Oe(o.doc, e)]), n = await t.tryParseMarkdownToBlocks(r), s = J(
1987
1986
  {
1988
1987
  id: e,
1989
1988
  block: n[0]
1990
1989
  },
1991
1990
  o.doc
1992
- ), a = new Ee();
1993
- for (const s of i) {
1994
- const c = s.map(a);
1991
+ ), a = new Ie();
1992
+ for (const i of s) {
1993
+ const c = i.map(a);
1995
1994
  if (!c)
1996
1995
  throw new Error("Failed to map step");
1997
1996
  o.step(c), a.appendMap(c.getMap());
1998
1997
  }
1999
- return H(t, o);
1998
+ return q(t, o);
2000
1999
  }
2001
2000
  function Se(e) {
2002
2001
  return typeof e != "string" ? {
@@ -2055,7 +2054,7 @@ const W = {
2055
2054
  }),
2056
2055
  delete: re
2057
2056
  };
2058
- function po(e, t, o, r) {
2057
+ function mo(e, t, o, r) {
2059
2058
  const n = {
2060
2059
  add: !0,
2061
2060
  update: !0,
@@ -2074,11 +2073,11 @@ function po(e, t, o, r) {
2074
2073
  ...n.delete ? [W.delete(e, { idsSuffixed: !0, withDelays: t })] : []
2075
2074
  ];
2076
2075
  }
2077
- const mo = {
2076
+ const po = {
2078
2077
  /**
2079
2078
  * Function to get the stream tools that can apply BlockNote Markdown block updates to the editor
2080
2079
  */
2081
- getStreamTools: po,
2080
+ getStreamTools: mo,
2082
2081
  /**
2083
2082
  * The default PromptBuilder that determines how a userPrompt is converted to an array of
2084
2083
  * LLM Messages (CoreMessage[])
@@ -2092,14 +2091,14 @@ const mo = {
2092
2091
  getDataForPromptWithSelection: We
2093
2092
  }
2094
2093
  }, ir = {
2095
- addCursorPosition: z,
2094
+ addCursorPosition: F,
2096
2095
  flattenBlocks: T,
2097
- suffixIDs: x,
2098
- trimEmptyBlocks: F,
2096
+ suffixIDs: L,
2097
+ trimEmptyBlocks: x,
2099
2098
  convertBlocks: C
2100
2099
  }, fo = {
2101
2100
  _experimental_json: ao,
2102
- _experimental_markdown: mo,
2101
+ _experimental_markdown: po,
2103
2102
  html: Ue
2104
2103
  }, we = new _e("blocknote-agent-cursor");
2105
2104
  function ho(e) {
@@ -2130,9 +2129,9 @@ function ho(e) {
2130
2129
  side: 10
2131
2130
  })
2132
2131
  );
2133
- const i = Math.min(r.anchor, r.head), a = Math.max(r.anchor, r.head);
2132
+ const s = Math.min(r.anchor, r.head), a = Math.max(r.anchor, r.head);
2134
2133
  return n.push(
2135
- ue.inline(i, a, Tt(e), {
2134
+ ue.inline(s, a, Tt(e), {
2136
2135
  inclusiveEnd: !0,
2137
2136
  inclusiveStart: !1
2138
2137
  })
@@ -2155,17 +2154,17 @@ class Ye extends lt {
2155
2154
  */
2156
2155
  constructor(o, r) {
2157
2156
  super();
2158
- j(this, "previousRequestOptions");
2157
+ D(this, "previousRequestOptions");
2159
2158
  // internal store including setters
2160
- j(this, "_store", pe()((o) => ({
2159
+ D(this, "_store", me()((o) => ({
2161
2160
  aiMenuState: "closed"
2162
2161
  })));
2163
2162
  /**
2164
2163
  * Returns a zustand store with the global configuration of the AI Extension.
2165
2164
  * These options are used by default across all LLM calls when calling {@link doLLMRequest}
2166
2165
  */
2167
- j(this, "options");
2168
- this.editor = o, this.options = pe()((n) => ({
2166
+ D(this, "options");
2167
+ this.editor = o, this.options = me()((n) => ({
2169
2168
  dataFormat: fo.html,
2170
2169
  stream: !0,
2171
2170
  ...r
@@ -2174,11 +2173,11 @@ class Ye extends lt {
2174
2173
  key: go,
2175
2174
  filterTransaction: (n) => {
2176
2175
  var a;
2177
- const i = this.store.getState().aiMenuState;
2178
- return !(i !== "closed" && i.status === "ai-writing" && (a = n.getMeta(kt)) != null && a.fixTables);
2176
+ const s = this.store.getState().aiMenuState;
2177
+ return !(s !== "closed" && s.status === "ai-writing" && (a = n.getMeta(kt)) != null && a.fixTables);
2179
2178
  }
2180
2179
  })
2181
- ), this.addProsemirrorPlugin(pt()), this.addProsemirrorPlugin(
2180
+ ), this.addProsemirrorPlugin(mt()), this.addProsemirrorPlugin(
2182
2181
  ho(
2183
2182
  r.agentCursor || { name: "AI", color: "#8bc6ff" }
2184
2183
  )
@@ -2219,18 +2218,18 @@ class Ye extends lt {
2219
2218
  acceptChanges() {
2220
2219
  var r;
2221
2220
  const o = this.editor.prosemirrorState.doc;
2222
- this.editor.exec((n, i) => ie(n, (a) => {
2223
- i == null || i(a.setMeta("addToHistory", !1));
2224
- })), this.editor.exec((n, i) => {
2221
+ this.editor.exec((n, s) => ie(n, (a) => {
2222
+ s == null || s(a.setMeta("addToHistory", !1));
2223
+ })), this.editor.exec((n, s) => {
2225
2224
  const a = n.tr;
2226
2225
  a.replace(
2227
2226
  0,
2228
2227
  a.doc.content.size,
2229
2228
  new Y(ae.from(o), 0, 0)
2230
2229
  );
2231
- const s = n.apply(a);
2232
- return Be(s, (c) => {
2233
- i == null || i(
2230
+ const i = n.apply(a);
2231
+ return Be(i, (c) => {
2232
+ s == null || s(
2234
2233
  a.replace(
2235
2234
  0,
2236
2235
  a.doc.content.size,
@@ -2245,8 +2244,8 @@ class Ye extends lt {
2245
2244
  */
2246
2245
  rejectChanges() {
2247
2246
  var o;
2248
- this.editor.exec((r, n) => ie(r, (i) => {
2249
- n == null || n(i.setMeta("addToHistory", !1));
2247
+ this.editor.exec((r, n) => ie(r, (s) => {
2248
+ n == null || n(s.setMeta("addToHistory", !1));
2250
2249
  })), (o = this.editor.forkYDocPlugin) == null || o.merge({ keepChanges: !1 }), this.closeAIMenu();
2251
2250
  }
2252
2251
  /**
@@ -2304,34 +2303,34 @@ class Ye extends lt {
2304
2303
  this.setAIResponseStatus("thinking"), (n = this.editor.forkYDocPlugin) == null || n.fork();
2305
2304
  let r;
2306
2305
  try {
2307
- const i = {
2306
+ const s = {
2308
2307
  ...this.options.getState(),
2309
2308
  ...o,
2310
2309
  previousResponse: this.store.getState().llmResponse
2311
2310
  };
2312
- this.previousRequestOptions = i, r = await Gt(this.editor, {
2313
- ...i,
2311
+ this.previousRequestOptions = s, r = await Gt(this.editor, {
2312
+ ...s,
2314
2313
  onStart: () => {
2315
2314
  var a;
2316
2315
  this.setAIResponseStatus("ai-writing"), (a = o.onStart) == null || a.call(o);
2317
2316
  },
2318
2317
  onBlockUpdate: (a) => {
2319
- var s;
2318
+ var i;
2320
2319
  this._store.setState({
2321
2320
  aiMenuState: {
2322
2321
  blockId: a,
2323
2322
  status: "ai-writing"
2324
2323
  }
2325
- }), (s = o.onBlockUpdate) == null || s.call(o, a);
2324
+ }), (i = o.onBlockUpdate) == null || i.call(o, a);
2326
2325
  }
2327
2326
  }), this._store.setState({
2328
2327
  llmResponse: r
2329
2328
  }), await r.execute(), this.setAIResponseStatus("user-reviewing");
2330
- } catch (i) {
2329
+ } catch (s) {
2331
2330
  this.setAIResponseStatus({
2332
2331
  status: "error",
2333
- error: i
2334
- }), console.warn("Error calling LLM", i);
2332
+ error: s
2333
+ }), console.warn("Error calling LLM", s);
2335
2334
  }
2336
2335
  return r;
2337
2336
  }
@@ -2343,7 +2342,7 @@ function O(e) {
2343
2342
  return e.extension(Ye);
2344
2343
  }
2345
2344
  const ko = (e, t) => async (o, r) => {
2346
- const n = new Request(o, r), i = new Request(
2345
+ const n = new Request(o, r), s = new Request(
2347
2346
  `${e}?provider=${encodeURIComponent(
2348
2347
  t
2349
2348
  )}&url=${encodeURIComponent(n.url)}`,
@@ -2357,7 +2356,7 @@ const ko = (e, t) => async (o, r) => {
2357
2356
  }
2358
2357
  );
2359
2358
  try {
2360
- return await fetch(i);
2359
+ return await fetch(s);
2361
2360
  } catch (a) {
2362
2361
  throw new TypeError("fetch failed", {
2363
2362
  cause: a
@@ -2396,9 +2395,9 @@ function So(e, t) {
2396
2395
  if (e == null) return {};
2397
2396
  var o = wo(e, t), r, n;
2398
2397
  if (Object.getOwnPropertySymbols) {
2399
- var i = Object.getOwnPropertySymbols(e);
2400
- for (n = 0; n < i.length; n++)
2401
- r = i[n], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
2398
+ var s = Object.getOwnPropertySymbols(e);
2399
+ for (n = 0; n < s.length; n++)
2400
+ r = s[n], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
2402
2401
  }
2403
2402
  return o;
2404
2403
  }
@@ -2412,15 +2411,15 @@ function wo(e, t) {
2412
2411
  }
2413
2412
  return o;
2414
2413
  }
2415
- function q() {
2416
- return q = Object.assign ? Object.assign.bind() : function(e) {
2414
+ function U() {
2415
+ return U = Object.assign ? Object.assign.bind() : function(e) {
2417
2416
  for (var t = 1; t < arguments.length; t++) {
2418
2417
  var o = arguments[t];
2419
2418
  for (var r in o)
2420
2419
  Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
2421
2420
  }
2422
2421
  return e;
2423
- }, q.apply(this, arguments);
2422
+ }, U.apply(this, arguments);
2424
2423
  }
2425
2424
  function ve(e, t) {
2426
2425
  var o = Object.keys(e);
@@ -2432,7 +2431,7 @@ function ve(e, t) {
2432
2431
  }
2433
2432
  return o;
2434
2433
  }
2435
- function U(e) {
2434
+ function z(e) {
2436
2435
  for (var t = 1; t < arguments.length; t++) {
2437
2436
  var o = arguments[t] != null ? arguments[t] : {};
2438
2437
  t % 2 ? ve(Object(o), !0).forEach(function(r) {
@@ -2461,13 +2460,13 @@ function Co(e, t) {
2461
2460
  return (t === "string" ? String : Number)(e);
2462
2461
  }
2463
2462
  function Ke(e) {
2464
- return e && e.map((t, o) => /* @__PURE__ */ B.createElement(t.tag, U({
2463
+ return e && e.map((t, o) => /* @__PURE__ */ B.createElement(t.tag, z({
2465
2464
  key: o
2466
2465
  }, t.attr), Ke(t.child)));
2467
2466
  }
2468
2467
  function v(e) {
2469
- return (t) => /* @__PURE__ */ B.createElement(Po, q({
2470
- attr: U({}, e.attr)
2468
+ return (t) => /* @__PURE__ */ B.createElement(Po, U({
2469
+ attr: z({}, e.attr)
2471
2470
  }, t), Ke(e.child));
2472
2471
  }
2473
2472
  function Po(e) {
@@ -2475,21 +2474,21 @@ function Po(e) {
2475
2474
  var {
2476
2475
  attr: r,
2477
2476
  size: n,
2478
- title: i
2479
- } = e, a = So(e, bo), s = n || o.size || "1em", c;
2480
- return o.className && (c = o.className), e.className && (c = (c ? c + " " : "") + e.className), /* @__PURE__ */ B.createElement("svg", q({
2477
+ title: s
2478
+ } = e, a = So(e, bo), i = n || o.size || "1em", c;
2479
+ return o.className && (c = o.className), e.className && (c = (c ? c + " " : "") + e.className), /* @__PURE__ */ B.createElement("svg", U({
2481
2480
  stroke: "currentColor",
2482
2481
  fill: "currentColor",
2483
2482
  strokeWidth: "0"
2484
2483
  }, o.attr, r, a, {
2485
2484
  className: c,
2486
- style: U(U({
2485
+ style: z(z({
2487
2486
  color: e.color || o.color
2488
2487
  }, o.style), e.style),
2489
- height: s,
2490
- width: s,
2488
+ height: i,
2489
+ width: i,
2491
2490
  xmlns: "http://www.w3.org/2000/svg"
2492
- }), i && /* @__PURE__ */ B.createElement("title", null, i), e.children);
2491
+ }), s && /* @__PURE__ */ B.createElement("title", null, s), e.children);
2493
2492
  };
2494
2493
  return Te !== void 0 ? /* @__PURE__ */ B.createElement(Te.Consumer, null, (o) => t(o)) : t(Ge);
2495
2494
  }
@@ -2517,45 +2516,45 @@ function Lo(e) {
2517
2516
  function _o(e) {
2518
2517
  return v({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" }, child: [] }] })(e);
2519
2518
  }
2520
- function Eo(e) {
2519
+ function Io(e) {
2521
2520
  return v({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" }, child: [] }] })(e);
2522
2521
  }
2523
- function Io(e) {
2522
+ function Eo(e) {
2524
2523
  return v({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M12 4C9.4095 4 7.10606 5.23053 5.64274 7.14274L8 9.5H2V3.5L4.21863 5.71863C6.05061 3.452 8.85558 2 12 2 17.5228 2 22 6.47715 22 12H20C20 7.58172 16.4183 4 12 4ZM4 12C4 16.4183 7.58172 20 12 20 14.5905 20 16.894 18.7695 18.3573 16.8573L16 14.5 22 14.5V20.5L19.7814 18.2814C17.9494 20.548 15.1444 22 12 22 6.47715 22 2 17.5228 2 12H4Z" }, child: [] }] })(e);
2525
2524
  }
2526
2525
  function ne(e) {
2527
2526
  return v({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M17.0007 1.20825 18.3195 3.68108 20.7923 4.99992 18.3195 6.31876 17.0007 8.79159 15.6818 6.31876 13.209 4.99992 15.6818 3.68108 17.0007 1.20825ZM8.00065 4.33325 10.6673 9.33325 15.6673 11.9999 10.6673 14.6666 8.00065 19.6666 5.33398 14.6666.333984 11.9999 5.33398 9.33325 8.00065 4.33325ZM19.6673 16.3333 18.0007 13.2083 16.334 16.3333 13.209 17.9999 16.334 19.6666 18.0007 22.7916 19.6673 19.6666 22.7923 17.9999 19.6673 16.3333Z" }, child: [] }] })(e);
2528
2527
  }
2529
- function _(e) {
2528
+ function I(e) {
2530
2529
  if (!e.dictionary.ai)
2531
2530
  throw new Error("AI dictionary not found");
2532
2531
  return e.dictionary.ai;
2533
2532
  }
2534
2533
  function Qe() {
2535
2534
  const e = Ct();
2536
- return _(e.editor);
2535
+ return I(e.editor);
2537
2536
  }
2538
2537
  const No = (e) => {
2539
- const t = G(), { onManualPromptSubmit: o, promptText: r, onPromptTextChange: n } = e, [i, a] = Ie(""), s = r || i, c = D(
2538
+ const t = G(), { onManualPromptSubmit: o, promptText: r, onPromptTextChange: n } = e, [s, a] = Ee(""), i = r || s, c = $(
2540
2539
  async (d) => {
2541
- d.key === "Enter" && o(s);
2540
+ d.key === "Enter" && o(i);
2542
2541
  },
2543
- [s, o]
2544
- ), u = D(
2542
+ [i, o]
2543
+ ), u = $(
2545
2544
  (d) => {
2546
2545
  const S = d.currentTarget.value;
2547
2546
  n && n(S), r === void 0 && a(S);
2548
2547
  },
2549
2548
  [n, a, r]
2550
- ), m = E(() => ut(e.items, s), [s, e.items]), { selectedIndex: l, setSelectedIndex: f, handler: p } = Pt(m, (d) => d.onItemClick()), h = D(
2549
+ ), p = E(() => ut(e.items, i), [i, e.items]), { selectedIndex: l, setSelectedIndex: f, handler: m } = Pt(p, (d) => d.onItemClick()), h = $(
2551
2550
  (d) => {
2552
- d.key === "Enter" ? m.length > 0 ? p(d) : c(d) : p(d);
2551
+ d.key === "Enter" ? p.length > 0 ? m(d) : c(d) : m(d);
2553
2552
  },
2554
- [c, p, m.length]
2553
+ [c, m, p.length]
2555
2554
  );
2556
2555
  return Ne(() => {
2557
2556
  f(0);
2558
- }, [s, f]), /* @__PURE__ */ vt("div", { className: "bn-combobox", children: [
2557
+ }, [i, f]), /* @__PURE__ */ vt("div", { className: "bn-combobox", children: [
2559
2558
  /* @__PURE__ */ y(t.Generic.Form.Root, { children: /* @__PURE__ */ y(
2560
2559
  t.Generic.Form.TextInput,
2561
2560
  {
@@ -2563,7 +2562,7 @@ const No = (e) => {
2563
2562
  name: "ai-prompt",
2564
2563
  variant: "large",
2565
2564
  icon: e.icon,
2566
- value: s || "",
2565
+ value: i || "",
2567
2566
  autoFocus: !0,
2568
2567
  placeholder: e.placeholder,
2569
2568
  disabled: e.disabled,
@@ -2579,7 +2578,7 @@ const No = (e) => {
2579
2578
  {
2580
2579
  className: "bn-combobox-items",
2581
2580
  id: "ai-suggestion-menu",
2582
- children: m.map((d, S) => /* @__PURE__ */ y(
2581
+ children: p.map((d, S) => /* @__PURE__ */ y(
2583
2582
  t.SuggestionMenu.Item,
2584
2583
  {
2585
2584
  className: dt(
@@ -2598,7 +2597,7 @@ const No = (e) => {
2598
2597
  ] });
2599
2598
  };
2600
2599
  function Ao(e) {
2601
- const t = _(e), o = O(e);
2600
+ const t = I(e), o = O(e);
2602
2601
  return [
2603
2602
  {
2604
2603
  key: "continue_writing",
@@ -2607,7 +2606,7 @@ function Ao(e) {
2607
2606
  icon: /* @__PURE__ */ y(Ce, { size: 18 }),
2608
2607
  onItemClick: async () => {
2609
2608
  await o.callLLM({
2610
- userPrompt: "Continue writing: write more text at the current cursor position related to the previous text",
2609
+ userPrompt: "Continue writing at the current cursor position related to the previous text. Add multiple blocks if needed. If the document looks like a template / draft, follow the template. Be extensive if needed.",
2611
2610
  // By default, LLM will be able to add / update / delete blocks. For "continue writing", we only want to allow adding new blocks.
2612
2611
  defaultStreamTools: {
2613
2612
  add: !0,
@@ -2667,7 +2666,7 @@ function Ao(e) {
2667
2666
  ];
2668
2667
  }
2669
2668
  function jo(e) {
2670
- const t = _(e), o = O(e);
2669
+ const t = I(e), o = O(e);
2671
2670
  return [
2672
2671
  {
2673
2672
  key: "improve_writing",
@@ -2692,7 +2691,7 @@ function jo(e) {
2692
2691
  key: "fix_spelling",
2693
2692
  title: t.ai_default_commands.fix_spelling.title,
2694
2693
  aliases: t.ai_default_commands.fix_spelling.aliases,
2695
- icon: /* @__PURE__ */ y(Eo, { size: 18 }),
2694
+ icon: /* @__PURE__ */ y(Io, { size: 18 }),
2696
2695
  onItemClick: async () => {
2697
2696
  await o.callLLM({
2698
2697
  useSelection: !0,
@@ -2739,7 +2738,7 @@ function jo(e) {
2739
2738
  ];
2740
2739
  }
2741
2740
  function Do(e) {
2742
- const t = _(e), o = O(e);
2741
+ const t = I(e), o = O(e);
2743
2742
  return [
2744
2743
  {
2745
2744
  key: "accept",
@@ -2764,13 +2763,13 @@ function Do(e) {
2764
2763
  ];
2765
2764
  }
2766
2765
  function $o(e) {
2767
- const t = _(e), o = O(e);
2766
+ const t = I(e), o = O(e);
2768
2767
  return [
2769
2768
  {
2770
2769
  key: "retry",
2771
2770
  title: t.ai_menu.actions.retry.title,
2772
2771
  aliases: t.ai_menu.actions.retry.aliases,
2773
- icon: /* @__PURE__ */ y(Io, { size: 18 }),
2772
+ icon: /* @__PURE__ */ y(Eo, { size: 18 }),
2774
2773
  onItemClick: async () => {
2775
2774
  await o.retry();
2776
2775
  },
@@ -2792,38 +2791,38 @@ function Ro(e, t) {
2792
2791
  return t === "user-input" ? e.getSelection() ? jo(e) : Ao(e) : t === "user-reviewing" ? Do(e) : t === "error" ? $o(e) : [];
2793
2792
  }
2794
2793
  const Ho = (e) => {
2795
- const t = K(), [o, r] = Ie(""), n = Qe(), i = G(), a = O(t), s = Ae(
2794
+ const t = K(), [o, r] = Ee(""), n = Qe(), s = G(), a = O(t), i = Ae(
2796
2795
  a.store,
2797
- (p) => p.aiMenuState !== "closed" ? p.aiMenuState.status : "closed"
2796
+ (m) => m.aiMenuState !== "closed" ? m.aiMenuState.status : "closed"
2798
2797
  ), { items: c } = e, u = E(() => {
2799
- let p = [];
2800
- return c ? p = c(t, s) : p = Ro(t, s), p.map((h) => ({
2798
+ let m = [];
2799
+ return c ? m = c(t, i) : m = Ro(t, i), m.map((h) => ({
2801
2800
  ...h,
2802
2801
  onItemClick: () => {
2803
2802
  h.onItemClick(r);
2804
2803
  }
2805
2804
  }));
2806
- }, [c, s, t]), m = D(
2807
- async (p) => {
2805
+ }, [c, i, t]), p = $(
2806
+ async (m) => {
2808
2807
  await a.callLLM({
2809
- userPrompt: p,
2808
+ userPrompt: m,
2810
2809
  useSelection: t.getSelection() !== void 0
2811
2810
  });
2812
2811
  },
2813
2812
  [a, t]
2814
2813
  );
2815
2814
  Ne(() => {
2816
- (s === "user-reviewing" || s === "error") && r("");
2817
- }, [s]);
2818
- const l = E(() => s === "thinking" ? n.ai_menu.status.thinking : s === "ai-writing" ? n.ai_menu.status.editing : s === "error" ? n.ai_menu.status.error : n.ai_menu.input_placeholder, [s, n]), f = E(() => {
2819
- if (s === "thinking" || s === "ai-writing")
2815
+ (i === "user-reviewing" || i === "error") && r("");
2816
+ }, [i]);
2817
+ const l = E(() => i === "thinking" ? n.ai_menu.status.thinking : i === "ai-writing" ? n.ai_menu.status.editing : i === "error" ? n.ai_menu.status.error : n.ai_menu.input_placeholder, [i, n]), f = E(() => {
2818
+ if (i === "thinking" || i === "ai-writing")
2820
2819
  return /* @__PURE__ */ y(
2821
- i.SuggestionMenu.Loader,
2820
+ s.SuggestionMenu.Loader,
2822
2821
  {
2823
2822
  className: "bn-suggestion-menu-loader bn-combobox-right-section"
2824
2823
  }
2825
2824
  );
2826
- if (s === "error")
2825
+ if (i === "error")
2827
2826
  return /* @__PURE__ */ y("div", { className: "bn-combobox-right-section bn-combobox-error", children: /* @__PURE__ */ y(
2828
2827
  "svg",
2829
2828
  {
@@ -2835,16 +2834,16 @@ const Ho = (e) => {
2835
2834
  children: /* @__PURE__ */ y("path", { d: "M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480v-160q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v160q0 17 11.5 28.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" })
2836
2835
  }
2837
2836
  ) });
2838
- }, [i, s]);
2837
+ }, [s, i]);
2839
2838
  return /* @__PURE__ */ y(
2840
2839
  No,
2841
2840
  {
2842
- onManualPromptSubmit: e.onManualPromptSubmit || m,
2841
+ onManualPromptSubmit: e.onManualPromptSubmit || p,
2843
2842
  items: u,
2844
2843
  promptText: o,
2845
2844
  onPromptTextChange: r,
2846
2845
  placeholder: l,
2847
- disabled: s === "thinking" || s === "ai-writing",
2846
+ disabled: i === "thinking" || i === "ai-writing",
2848
2847
  icon: /* @__PURE__ */ y("div", { className: "bn-combobox-icon", children: /* @__PURE__ */ y(ne, {}) }),
2849
2848
  rightSection: f
2850
2849
  }
@@ -2853,7 +2852,7 @@ const Ho = (e) => {
2853
2852
  const t = e.blockID ? document.querySelector(`[data-id="${e.blockID}"]`) : void 0, o = E(() => t ? {
2854
2853
  getBoundingClientRect: () => t.getBoundingClientRect(),
2855
2854
  contextElement: t
2856
- } : null, [t]), { isMounted: r, ref: n, style: i, getFloatingProps: a, isPositioned: s } = Ot(!!t, o, 3e3, {
2855
+ } : null, [t]), { isMounted: r, ref: n, style: s, getFloatingProps: a, isPositioned: i } = Ot(!!t, o, 3e3, {
2857
2856
  canDismiss: {
2858
2857
  enabled: !0,
2859
2858
  escapeKey: !0,
@@ -2872,23 +2871,24 @@ const Ho = (e) => {
2872
2871
  })
2873
2872
  ],
2874
2873
  onOpenChange: e.onOpenChange,
2875
- whileElementsMounted: (c, u, m) => xt(c, u, m, {
2874
+ whileElementsMounted: (c, u, p) => xt(c, u, p, {
2876
2875
  animationFrame: !0
2877
- })
2876
+ }),
2877
+ ...e.floatingOptions
2878
2878
  });
2879
2879
  return r ? /* @__PURE__ */ y(
2880
2880
  "div",
2881
2881
  {
2882
2882
  ref: n,
2883
2883
  style: {
2884
- ...i
2884
+ ...s
2885
2885
  },
2886
2886
  ...a(),
2887
- children: s && e.children
2887
+ children: i && e.children
2888
2888
  }
2889
2889
  ) : null;
2890
2890
  }, lr = (e) => {
2891
- const t = K(), o = O(t), r = Ae(o.store, (a) => a.aiMenuState), n = r === "closed" ? void 0 : r.blockId, i = e.aiMenu || Ho;
2891
+ const t = K(), o = O(t), r = Ae(o.store, (a) => a.aiMenuState), n = r === "closed" ? void 0 : r.blockId, s = e.aiMenu || Ho;
2892
2892
  return /* @__PURE__ */ y(
2893
2893
  qo,
2894
2894
  {
@@ -2897,16 +2897,16 @@ const Ho = (e) => {
2897
2897
  onOpenChange: (a) => {
2898
2898
  a || r === "closed" || (r.status === "user-input" ? o.closeAIMenu() : (r.status === "user-reviewing" || r.status === "error") && o.rejectChanges());
2899
2899
  },
2900
- children: /* @__PURE__ */ y(i, {})
2900
+ children: /* @__PURE__ */ y(s, {})
2901
2901
  }
2902
2902
  );
2903
2903
  }, ur = () => {
2904
2904
  const e = Qe(), t = G(), o = K(), r = O(o), n = () => {
2905
2905
  o.formattingToolbar.closeMenu();
2906
- const i = o.getSelection();
2907
- if (!i)
2906
+ const s = o.getSelection();
2907
+ if (!s)
2908
2908
  throw new Error("No selection");
2909
- const a = i.blocks[i.blocks.length - 1].id;
2909
+ const a = s.blocks[s.blocks.length - 1].id;
2910
2910
  r.openAIMenuAtBlock(a);
2911
2911
  };
2912
2912
  return o.isEditable ? /* @__PURE__ */ y(
@@ -2932,7 +2932,7 @@ function dr(e) {
2932
2932
  r.block.content && Array.isArray(r.block.content) && // isarray check not ideal
2933
2933
  r.block.content.length === 0 && r.prevBlock ? t.openAIMenuAtBlock(r.prevBlock.id) : t.openAIMenuAtBlock(r.block.id);
2934
2934
  },
2935
- ..._(e).slash_menu.ai,
2935
+ ...I(e).slash_menu.ai,
2936
2936
  icon: /* @__PURE__ */ y(Uo.AI, {})
2937
2937
  }
2938
2938
  ];
@@ -2947,7 +2947,7 @@ export {
2947
2947
  Gt as callLLM,
2948
2948
  ar as createAIExtension,
2949
2949
  cr as createBlockNoteAIClient,
2950
- _ as getAIDictionary,
2950
+ I as getAIDictionary,
2951
2951
  O as getAIExtension,
2952
2952
  dr as getAISlashMenuItems,
2953
2953
  Ro as getDefaultAIMenuItems,