@vc-shell/framework 2.0.0-alpha.6 → 2.0.0-alpha.8

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 (501) hide show
  1. package/CHANGELOG.md +4511 -0
  2. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  3. package/dist/core/plugins/modularity/index.d.ts +0 -2
  4. package/dist/core/plugins/modularity/index.d.ts.map +1 -1
  5. package/dist/core/types/index.d.ts +2 -79
  6. package/dist/core/types/index.d.ts.map +1 -1
  7. package/dist/core/types/menu-types.d.ts +80 -0
  8. package/dist/core/types/menu-types.d.ts.map +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/injection-keys.d.ts +0 -21
  11. package/dist/injection-keys.d.ts.map +1 -1
  12. package/dist/shared/components/blade-navigation/types/index.d.ts +1 -1
  13. package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
  14. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  15. package/dist/shared/components/notifications/composables/useContainer/index.d.ts.map +1 -1
  16. package/dist/shared/components/notifications/types/index.d.ts +9 -1
  17. package/dist/shared/components/notifications/types/index.d.ts.map +1 -1
  18. package/dist/shared/modules/index.d.ts +0 -1
  19. package/dist/shared/modules/index.d.ts.map +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
  22. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
  23. package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts +1 -1
  24. package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts.map +1 -1
  25. package/dist/ui/components/molecules/vc-checkbox/index.d.ts +1 -2
  26. package/dist/ui/components/molecules/vc-checkbox/index.d.ts.map +1 -1
  27. package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.vue.d.ts +26 -34
  28. package/dist/ui/components/molecules/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
  29. package/dist/ui/components/molecules/vc-checkbox-group/index.d.ts +1 -1
  30. package/dist/ui/components/molecules/vc-checkbox-group/index.d.ts.map +1 -1
  31. package/dist/ui/components/molecules/vc-checkbox-group/vc-checkbox-group.vue.d.ts +23 -31
  32. package/dist/ui/components/molecules/vc-checkbox-group/vc-checkbox-group.vue.d.ts.map +1 -1
  33. package/dist/ui/components/molecules/vc-color-input/vc-color-input.vue.d.ts +2 -2
  34. package/dist/ui/components/molecules/vc-date-picker/vc-date-picker.vue.d.ts +3 -3
  35. package/dist/ui/components/molecules/vc-date-picker/vc-date-picker.vue.d.ts.map +1 -1
  36. package/dist/ui/components/molecules/vc-dropdown/vc-dropdown.vue.d.ts +1 -1
  37. package/dist/ui/components/molecules/vc-dropdown-panel/vc-dropdown-panel.vue.d.ts +1 -1
  38. package/dist/ui/components/molecules/vc-dropdown-panel/vc-dropdown-panel.vue.d.ts.map +1 -1
  39. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +1 -1
  40. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
  41. package/dist/ui/components/molecules/vc-menu/vc-menu.vue.d.ts +1 -1
  42. package/dist/ui/components/molecules/vc-menu/vc-menu.vue.d.ts.map +1 -1
  43. package/dist/ui/components/molecules/vc-multivalue/_internal/MultivalueTrigger.vue.d.ts +2 -2
  44. package/dist/ui/components/molecules/vc-radio-button/index.d.ts +0 -1
  45. package/dist/ui/components/molecules/vc-radio-button/index.d.ts.map +1 -1
  46. package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.vue.d.ts +22 -39
  47. package/dist/ui/components/molecules/vc-radio-button/vc-radio-button.vue.d.ts.map +1 -1
  48. package/dist/ui/components/molecules/vc-radio-group/index.d.ts +1 -1
  49. package/dist/ui/components/molecules/vc-radio-group/index.d.ts.map +1 -1
  50. package/dist/ui/components/molecules/vc-radio-group/vc-radio-group.vue.d.ts +22 -28
  51. package/dist/ui/components/molecules/vc-radio-group/vc-radio-group.vue.d.ts.map +1 -1
  52. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +2 -2
  53. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  54. package/dist/ui/components/molecules/vc-select/composables/index.d.ts +1 -3
  55. package/dist/ui/components/molecules/vc-select/composables/index.d.ts.map +1 -1
  56. package/dist/ui/components/molecules/vc-select/composables/useSelectDataSource.d.ts +30 -0
  57. package/dist/ui/components/molecules/vc-select/composables/useSelectDataSource.d.ts.map +1 -0
  58. package/dist/ui/components/molecules/vc-select/composables/useSelectSelection.d.ts +3 -2
  59. package/dist/ui/components/molecules/vc-select/composables/useSelectSelection.d.ts.map +1 -1
  60. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +13 -7
  61. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  62. package/dist/ui/components/molecules/vc-toast/vc-toast.vue.d.ts +1 -1
  63. package/dist/ui/components/molecules/vc-toast/vc-toast.vue.d.ts.map +1 -1
  64. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
  65. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  66. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  67. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +3 -3
  68. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
  69. package/dist/ui/components/organisms/vc-image-upload/vc-image-upload.vue.d.ts +3 -3
  70. package/dist/ui/components/organisms/vc-image-upload/vc-image-upload.vue.d.ts.map +1 -1
  71. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +2 -2
  72. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
  73. package/dist/ui/components/organisms/vc-sidebar/vc-sidebar.vue.d.ts +3 -3
  74. package/dist/ui/components/organisms/vc-sidebar/vc-sidebar.vue.d.ts.map +1 -1
  75. package/dist/ui/components/organisms/vc-table/VcDataTable.vue.d.ts +1 -1
  76. package/dist/ui/components/organisms/vc-table/VcTableAdapter.vue.d.ts +8 -8
  77. package/dist/ui/components/organisms/vc-table/VcTableAdapter.vue.d.ts.map +1 -1
  78. package/dist/ui/components/organisms/vc-table/components/ColumnFilter.vue.d.ts +1 -1
  79. package/dist/ui/components/organisms/vc-table/components/ColumnFilter.vue.d.ts.map +1 -1
  80. package/dist/ui/components/organisms/vc-table/components/DataTableCellRenderer.vue.d.ts.map +1 -1
  81. package/dist/ui/components/organisms/vc-table/components/GlobalFiltersPanel.vue.d.ts +2 -2
  82. package/dist/ui/components/organisms/vc-table/components/TableAddRowButton.vue.d.ts +1 -1
  83. package/dist/ui/components/organisms/vc-table/components/TableAddRowButton.vue.d.ts.map +1 -1
  84. package/dist/ui/components/organisms/vc-table/components/TableCheckbox.vue.d.ts +2 -2
  85. package/dist/ui/components/organisms/vc-table/components/TableRow.vue.d.ts +2 -2
  86. package/dist/ui/components/organisms/vc-table/components/TableSearchHeader.vue.d.ts +1 -1
  87. package/dist/ui/components/organisms/vc-table/components/TableSearchHeader.vue.d.ts.map +1 -1
  88. package/dist/ui/components/organisms/vc-table/components/VcColumn.vue.d.ts +11 -11
  89. package/dist/ui/components/organisms/vc-table/components/mobile/MobileActionSheet.vue.d.ts +2 -2
  90. package/dist/ui/components/organisms/vc-table/composables/useTableContext.d.ts +2 -6
  91. package/dist/ui/components/organisms/vc-table/composables/useTableContext.d.ts.map +1 -1
  92. package/dist/ui/components/organisms/vc-table/keys.d.ts +5 -1
  93. package/dist/ui/components/organisms/vc-table/keys.d.ts.map +1 -1
  94. package/dist/ui/components/organisms/vc-table/types.d.ts +6 -3
  95. package/dist/ui/components/organisms/vc-table/types.d.ts.map +1 -1
  96. package/dist/ui/components/organisms/vc-table/utils/ColumnCollector.d.ts +2 -6
  97. package/dist/ui/components/organisms/vc-table/utils/ColumnCollector.d.ts.map +1 -1
  98. package/dist/ui/types/global-components.d.ts +10 -0
  99. package/dist/ui/types/global-components.d.ts.map +1 -0
  100. package/dist/ui/types/index.d.ts +0 -8
  101. package/dist/ui/types/index.d.ts.map +1 -1
  102. package/package.json +7 -8
  103. package/LICENSE +0 -12
  104. package/dist/assets/042c75b764bc78a7.svg +0 -1
  105. package/dist/assets/0ba156439a339f2a.svg +0 -1
  106. package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
  107. package/dist/assets/0d67e9e056b4c500.woff +0 -0
  108. package/dist/assets/0f590f8a94577092.svg +0 -1
  109. package/dist/assets/0fc5820f8be53a1b.svg +0 -1
  110. package/dist/assets/105efd028edc1dfe.woff +0 -0
  111. package/dist/assets/10768e2cc79fc60b.svg +0 -1
  112. package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
  113. package/dist/assets/131b34336aedaf47.woff +0 -0
  114. package/dist/assets/154365acf3010d96.woff2 +0 -0
  115. package/dist/assets/157b8721e0600ea8.svg +0 -1
  116. package/dist/assets/15e91cdd649cde9a.svg +0 -1
  117. package/dist/assets/19275e398ae57130.woff2 +0 -0
  118. package/dist/assets/19bb1c668a5db39f.woff2 +0 -0
  119. package/dist/assets/1a3e84b2457f709a.woff +0 -0
  120. package/dist/assets/1de63eb118636cce.svg +0 -1
  121. package/dist/assets/1ea01de36eb5491b.svg +0 -1
  122. package/dist/assets/2010ada3e82156ed.woff +0 -0
  123. package/dist/assets/204eaf512fde2023.svg +0 -1
  124. package/dist/assets/2088983edf42e153.svg +0 -1
  125. package/dist/assets/208f810a9321a327.svg +0 -1
  126. package/dist/assets/21220a9d10e6c558.svg +0 -1
  127. package/dist/assets/220db345a102045d.woff2 +0 -0
  128. package/dist/assets/225da11d23968333.svg +0 -1
  129. package/dist/assets/226f862dd81bdc13.woff2 +0 -0
  130. package/dist/assets/23a2d53395ddb14f.woff +0 -0
  131. package/dist/assets/259e6ad461a52ad7.svg +0 -1
  132. package/dist/assets/261e6dec4d53b9ac.woff +0 -0
  133. package/dist/assets/262f46a0b6d94bb6.svg +0 -1
  134. package/dist/assets/2857c513073467da.svg +0 -1
  135. package/dist/assets/2b3be7889467d98f.woff +0 -0
  136. package/dist/assets/2d4e6190eec72737.svg +0 -1
  137. package/dist/assets/2eba973185078bc8.woff +0 -0
  138. package/dist/assets/334d3f6bc766c516.woff +0 -0
  139. package/dist/assets/34ff7dd0c2285956.svg +0 -1
  140. package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
  141. package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
  142. package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
  143. package/dist/assets/3fc09a6113184f16.woff +0 -0
  144. package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
  145. package/dist/assets/41275bcb979cb650.svg +0 -1
  146. package/dist/assets/434f7982590e462f.woff +0 -0
  147. package/dist/assets/475937116ee3314a.woff2 +0 -0
  148. package/dist/assets/477e1881a0394cc5.woff +0 -0
  149. package/dist/assets/489710fb710e73f0.woff +0 -0
  150. package/dist/assets/49791943b3872376.woff2 +0 -0
  151. package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
  152. package/dist/assets/4d7a77b0e5373992.svg +0 -1
  153. package/dist/assets/4e43c74354534fb3.svg +0 -1
  154. package/dist/assets/4fe75f5117100705.svg +0 -1
  155. package/dist/assets/52e261a005074e1b.woff +0 -0
  156. package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
  157. package/dist/assets/54cda5482c6c9218.woff +0 -0
  158. package/dist/assets/550f52072e8ccafe.woff2 +0 -0
  159. package/dist/assets/572bb1bb4156a9c1.svg +0 -1
  160. package/dist/assets/6075995d7e74da46.woff2 +0 -0
  161. package/dist/assets/617c4736236e199e.woff +0 -0
  162. package/dist/assets/67230f05dc94a265.svg +0 -1
  163. package/dist/assets/6798e4dd4add9b48.svg +0 -1
  164. package/dist/assets/686d4077c1e26876.woff2 +0 -0
  165. package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
  166. package/dist/assets/6a3e73faf406cf33.svg +0 -1
  167. package/dist/assets/72de3a63bc0b70dd.svg +0 -1
  168. package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
  169. package/dist/assets/74ed5f8a78e71106.svg +0 -1
  170. package/dist/assets/7a5aa5abd625137f.ttf +0 -0
  171. package/dist/assets/7ce0c166fd6a1204.woff +0 -0
  172. package/dist/assets/7d55399c2a7bc985.svg +0 -1
  173. package/dist/assets/7d970675c69fca1d.woff +0 -0
  174. package/dist/assets/7eda727273fd98d3.svg +0 -1
  175. package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
  176. package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
  177. package/dist/assets/861e6b7192b3b6c7.woff +0 -0
  178. package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
  179. package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
  180. package/dist/assets/910b0d99b9e26568.svg +0 -1
  181. package/dist/assets/91fe94e424323d61.woff +0 -0
  182. package/dist/assets/92508f8707159b51.svg +0 -1
  183. package/dist/assets/9392bf1d591e1abb.svg +0 -1
  184. package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
  185. package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
  186. package/dist/assets/9d37314695c0b68d.woff +0 -0
  187. package/dist/assets/a03cdcd8da5bb987.woff +0 -0
  188. package/dist/assets/a18404194e3f9047.svg +0 -1
  189. package/dist/assets/a2017fe7f0a26510.svg +0 -1
  190. package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
  191. package/dist/assets/abf88f301a0730f4.svg +0 -1
  192. package/dist/assets/ac1a99b3d05d8232.woff +0 -0
  193. package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
  194. package/dist/assets/b1a596e31ad1185a.svg +0 -1
  195. package/dist/assets/b27767411c8427be.woff +0 -0
  196. package/dist/assets/b325adcae33bbe7a.svg +0 -1
  197. package/dist/assets/b372390551ca2fa1.svg +0 -1
  198. package/dist/assets/b5bb1e8fc975decd.svg +0 -1
  199. package/dist/assets/b645a4a2181b9dc1.svg +0 -1
  200. package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
  201. package/dist/assets/b7ffde2383bb16ba.woff2 +0 -0
  202. package/dist/assets/b94421fadd23b0f2.svg +0 -1
  203. package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
  204. package/dist/assets/c5195215cb712e9c.woff2 +0 -0
  205. package/dist/assets/c9191b638a10f67b.woff2 +0 -0
  206. package/dist/assets/c97328b91ac5cc66.woff +0 -0
  207. package/dist/assets/ca791c5ca5848a03.svg +0 -1
  208. package/dist/assets/cb32840ce330103f.woff +0 -0
  209. package/dist/assets/ccc878931d74181b.woff2 +0 -0
  210. package/dist/assets/cdc69f8b549c866d.woff2 +0 -0
  211. package/dist/assets/d084bda16abe8a56.svg +0 -1
  212. package/dist/assets/d32b129cae2fffd6.svg +0 -1
  213. package/dist/assets/d35a4c7113315758.woff2 +0 -0
  214. package/dist/assets/d3f792f54ae4c307.svg +0 -1
  215. package/dist/assets/d5a5b8630120073d.svg +0 -1
  216. package/dist/assets/d5eb20bcdcf5616a.woff2 +0 -0
  217. package/dist/assets/d5f9664ebbfb104b.svg +0 -1
  218. package/dist/assets/d84247b59449dd88.woff2 +0 -0
  219. package/dist/assets/da4b7f5883fe7743.woff2 +0 -0
  220. package/dist/assets/dceaf3b39091e6a4.woff +0 -0
  221. package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
  222. package/dist/assets/e2ad5b3428289141.woff +0 -0
  223. package/dist/assets/e38acaa1757232e0.svg +0 -1
  224. package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
  225. package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
  226. package/dist/assets/e61a1889bac955f4.woff2 +0 -0
  227. package/dist/assets/e72bb11356af94c7.svg +0 -1
  228. package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
  229. package/dist/assets/ebec912a42ad49ff.woff +0 -0
  230. package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
  231. package/dist/assets/f09d89268e4c0317.svg +0 -1
  232. package/dist/assets/f239394367fcf005.woff2 +0 -0
  233. package/dist/assets/f5722262b6e7214e.woff2 +0 -0
  234. package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
  235. package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
  236. package/dist/assets/fe141d99763f5d2b.woff +0 -0
  237. package/dist/assets/fed13b0d59903483.svg +0 -1
  238. package/dist/assets/fed757d2c2344ead.woff2 +0 -0
  239. package/dist/assets/ffc438f20e79ce73.woff +0 -0
  240. package/dist/core/plugins/modularity/loader-mf.d.ts +0 -17
  241. package/dist/core/plugins/modularity/loader-mf.d.ts.map +0 -1
  242. package/dist/framework.css +0 -9
  243. package/dist/framework.js +0 -36477
  244. package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts +0 -6
  245. package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts.map +0 -1
  246. package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +0 -54
  247. package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +0 -1
  248. package/dist/shared/modules/dynamic/components/factories.d.ts +0 -23
  249. package/dist/shared/modules/dynamic/components/factories.d.ts.map +0 -1
  250. package/dist/shared/modules/dynamic/components/fields/Button.d.ts +0 -47
  251. package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +0 -1
  252. package/dist/shared/modules/dynamic/components/fields/Card.d.ts +0 -47
  253. package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +0 -1
  254. package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +0 -47
  255. package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +0 -1
  256. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +0 -47
  257. package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +0 -1
  258. package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts +0 -47
  259. package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts.map +0 -1
  260. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +0 -48
  261. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +0 -1
  262. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +0 -47
  263. package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +0 -1
  264. package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +0 -47
  265. package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +0 -1
  266. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +0 -47
  267. package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +0 -1
  268. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +0 -47
  269. package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +0 -1
  270. package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +0 -47
  271. package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +0 -1
  272. package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +0 -47
  273. package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +0 -1
  274. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts +0 -47
  275. package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +0 -1
  276. package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts +0 -51
  277. package/dist/shared/modules/dynamic/components/fields/RadioButtonGroup.d.ts.map +0 -1
  278. package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts +0 -47
  279. package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts.map +0 -1
  280. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +0 -47
  281. package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +0 -1
  282. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +0 -47
  283. package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +0 -1
  284. package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts +0 -47
  285. package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts.map +0 -1
  286. package/dist/shared/modules/dynamic/components/fields/Table.d.ts +0 -47
  287. package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +0 -1
  288. package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +0 -47
  289. package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +0 -1
  290. package/dist/shared/modules/dynamic/components/fields/ValidationField.d.ts +0 -13
  291. package/dist/shared/modules/dynamic/components/fields/ValidationField.d.ts.map +0 -1
  292. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +0 -47
  293. package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +0 -1
  294. package/dist/shared/modules/dynamic/components/fields/props.d.ts +0 -40
  295. package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +0 -1
  296. package/dist/shared/modules/dynamic/components/index.d.ts +0 -4
  297. package/dist/shared/modules/dynamic/components/index.d.ts.map +0 -1
  298. package/dist/shared/modules/dynamic/composables/index.d.ts +0 -5
  299. package/dist/shared/modules/dynamic/composables/index.d.ts.map +0 -1
  300. package/dist/shared/modules/dynamic/composables/useDynamicViewsUtils/index.d.ts +0 -10
  301. package/dist/shared/modules/dynamic/composables/useDynamicViewsUtils/index.d.ts.map +0 -1
  302. package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts +0 -22
  303. package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +0 -1
  304. package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts +0 -14
  305. package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts.map +0 -1
  306. package/dist/shared/modules/dynamic/composables/useToolbarReducer/index.d.ts +0 -11
  307. package/dist/shared/modules/dynamic/composables/useToolbarReducer/index.d.ts.map +0 -1
  308. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts +0 -10
  309. package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +0 -1
  310. package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts +0 -22
  311. package/dist/shared/modules/dynamic/factories/base/useListFactory.d.ts.map +0 -1
  312. package/dist/shared/modules/dynamic/factories/index.d.ts +0 -4
  313. package/dist/shared/modules/dynamic/factories/index.d.ts.map +0 -1
  314. package/dist/shared/modules/dynamic/factories/types/index.d.ts +0 -186
  315. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +0 -1
  316. package/dist/shared/modules/dynamic/helpers/getters.d.ts +0 -2
  317. package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +0 -1
  318. package/dist/shared/modules/dynamic/helpers/methodHandler.d.ts +0 -4
  319. package/dist/shared/modules/dynamic/helpers/methodHandler.d.ts.map +0 -1
  320. package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts +0 -14
  321. package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +0 -1
  322. package/dist/shared/modules/dynamic/helpers/override.d.ts +0 -8
  323. package/dist/shared/modules/dynamic/helpers/override.d.ts.map +0 -1
  324. package/dist/shared/modules/dynamic/helpers/safeIn.d.ts +0 -5
  325. package/dist/shared/modules/dynamic/helpers/safeIn.d.ts.map +0 -1
  326. package/dist/shared/modules/dynamic/helpers/setters.d.ts +0 -9
  327. package/dist/shared/modules/dynamic/helpers/setters.d.ts.map +0 -1
  328. package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts +0 -3
  329. package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts.map +0 -1
  330. package/dist/shared/modules/dynamic/helpers/unwrapInterpolation.d.ts +0 -3
  331. package/dist/shared/modules/dynamic/helpers/unwrapInterpolation.d.ts.map +0 -1
  332. package/dist/shared/modules/dynamic/index.d.ts +0 -39
  333. package/dist/shared/modules/dynamic/index.d.ts.map +0 -1
  334. package/dist/shared/modules/dynamic/keys.d.ts +0 -3
  335. package/dist/shared/modules/dynamic/keys.d.ts.map +0 -1
  336. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +0 -131
  337. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +0 -1
  338. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +0 -77
  339. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +0 -1
  340. package/dist/shared/modules/dynamic/pages/index.d.ts +0 -4
  341. package/dist/shared/modules/dynamic/pages/index.d.ts.map +0 -1
  342. package/dist/shared/modules/dynamic/types/index.d.ts +0 -1137
  343. package/dist/shared/modules/dynamic/types/index.d.ts.map +0 -1
  344. package/dist/shared/modules/dynamic/types/models.d.ts +0 -131
  345. package/dist/shared/modules/dynamic/types/models.d.ts.map +0 -1
  346. package/dist/ui/components/molecules/vc-select/composables/useSelectDefaultValue.d.ts +0 -16
  347. package/dist/ui/components/molecules/vc-select/composables/useSelectDefaultValue.d.ts.map +0 -1
  348. package/dist/ui/components/molecules/vc-select/composables/useSelectOptions.d.ts +0 -19
  349. package/dist/ui/components/molecules/vc-select/composables/useSelectOptions.d.ts.map +0 -1
  350. package/dist/ui/components/molecules/vc-select/composables/useSelectSearch.d.ts +0 -23
  351. package/dist/ui/components/molecules/vc-select/composables/useSelectSearch.d.ts.map +0 -1
  352. package/dist/vendor-boolbase-D2i1C8XR.js +0 -18
  353. package/dist/vendor-cheerio-DrsWhxJH.js +0 -1053
  354. package/dist/vendor-cheerio-select-jw4C2SiT.js +0 -191
  355. package/dist/vendor-core-js-Do_NZFHx.js +0 -880
  356. package/dist/vendor-css-select-BwGMmTuc.js +0 -622
  357. package/dist/vendor-css-what-CZZaquJM.js +0 -267
  358. package/dist/vendor-cypress-signalr-mock-itnm2wpA.js +0 -781
  359. package/dist/vendor-d3-array-9cpTrqlO.js +0 -149
  360. package/dist/vendor-d3-axis-D1_DbKLz.js +0 -74
  361. package/dist/vendor-d3-brush-CcKeJp9e.js +0 -1
  362. package/dist/vendor-d3-color-BOYE6h_9.js +0 -306
  363. package/dist/vendor-d3-dispatch-fx-WMg0D.js +0 -64
  364. package/dist/vendor-d3-ease-Cr34gv04.js +0 -8
  365. package/dist/vendor-d3-format-DaIwZvFc.js +0 -182
  366. package/dist/vendor-d3-interpolate-BYG2gvO4.js +0 -177
  367. package/dist/vendor-d3-interpolate-path-CpGLvKgS.js +0 -299
  368. package/dist/vendor-d3-path-DJOTitNW.js +0 -64
  369. package/dist/vendor-d3-scale-CC5rtdt5.js +0 -561
  370. package/dist/vendor-d3-selection-CNMxsYiL.js +0 -603
  371. package/dist/vendor-d3-shape-DBhCDMiV.js +0 -925
  372. package/dist/vendor-d3-time-DAPP210_.js +0 -212
  373. package/dist/vendor-d3-time-format-hD7iE2WG.js +0 -491
  374. package/dist/vendor-d3-timer-C1cUWKPz.js +0 -67
  375. package/dist/vendor-d3-transition-BbNQT7qF.js +0 -524
  376. package/dist/vendor-d3-zoom-CcKeJp9e.js +0 -1
  377. package/dist/vendor-date-fns-BKO3x1R1.js +0 -3102
  378. package/dist/vendor-dom-serializer-BbVuF1MQ.js +0 -213
  379. package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
  380. package/dist/vendor-domhandler-Kufn9M_V.js +0 -311
  381. package/dist/vendor-dompurify-M2Bspgo5.js +0 -553
  382. package/dist/vendor-domutils-DDRq_ial.js +0 -386
  383. package/dist/vendor-emotion-cache-eEZT5l-Q.js +0 -274
  384. package/dist/vendor-emotion-hash-DImMRhyK.js +0 -22
  385. package/dist/vendor-emotion-memoize-BcEUCz8q.js +0 -9
  386. package/dist/vendor-emotion-serialize-BSDW8NwU.js +0 -123
  387. package/dist/vendor-emotion-sheet-CS8ZBl9s.js +0 -44
  388. package/dist/vendor-emotion-unitless-B7u1PU6w.js +0 -53
  389. package/dist/vendor-emotion-utils-D7refZTM.js +0 -28
  390. package/dist/vendor-entities-J86Og8IU.js +0 -364
  391. package/dist/vendor-floating-ui-core-BoHdh92a.js +0 -432
  392. package/dist/vendor-floating-ui-dom-BvVXFZ4B.js +0 -398
  393. package/dist/vendor-floating-ui-utils-CidJRIm2.js +0 -257
  394. package/dist/vendor-floating-ui-vue-sCrhit51.js +0 -121
  395. package/dist/vendor-gridstack-Dkfw452e.js +0 -3390
  396. package/dist/vendor-headlessui-vue-Cn-RMs4E.js +0 -961
  397. package/dist/vendor-htmlparser2-BxKKzWLL.js +0 -735
  398. package/dist/vendor-internmap-Q5729_cS.js +0 -35
  399. package/dist/vendor-intlify-core-base-BmIo1dK4.js +0 -1141
  400. package/dist/vendor-intlify-message-compiler-D9VOavkL.js +0 -960
  401. package/dist/vendor-intlify-shared-SCAs3ybf.js +0 -144
  402. package/dist/vendor-iso-639-1-rPqx9HMT.js +0 -786
  403. package/dist/vendor-juggle-resize-observer-DiSiNbbT.js +0 -286
  404. package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
  405. package/dist/vendor-linkifyjs-dCH9UYes.js +0 -701
  406. package/dist/vendor-lodash-es-BtnfG6xF.js +0 -4829
  407. package/dist/vendor-lucide-vue-next-CPgeDcFj.js +0 -33093
  408. package/dist/vendor-markdown-it-Bs9KEWkF.js +0 -2266
  409. package/dist/vendor-markdown-it-task-lists-CHCnS7dl.js +0 -69
  410. package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
  411. package/dist/vendor-microsoft-applicationinsights-analytics-js-DFu_cVaY.js +0 -1207
  412. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-DRQLN2Ue.js +0 -261
  413. package/dist/vendor-microsoft-applicationinsights-channel-js-BIJDcP3D.js +0 -1822
  414. package/dist/vendor-microsoft-applicationinsights-common-CJjmnDMb.js +0 -1921
  415. package/dist/vendor-microsoft-applicationinsights-core-js-BOc_o46i.js +0 -4276
  416. package/dist/vendor-microsoft-applicationinsights-dependencies-js-DDz502id.js +0 -1407
  417. package/dist/vendor-microsoft-applicationinsights-properties-js-9aDWHwXJ.js +0 -572
  418. package/dist/vendor-microsoft-applicationinsights-shims-Dton8Vqy.js +0 -43
  419. package/dist/vendor-microsoft-applicationinsights-web-DTa5YN-h.js +0 -487
  420. package/dist/vendor-microsoft-dynamicproto-js-89GEKjvR.js +0 -147
  421. package/dist/vendor-microsoft-signalr-Bgpbb4fW.js +0 -1761
  422. package/dist/vendor-module-federation-enhanced-CV1CNdJy.js +0 -22
  423. package/dist/vendor-module-federation-error-codes-DdVwX11j.js +0 -55
  424. package/dist/vendor-module-federation-runtime-CVH_lWgu.js +0 -91
  425. package/dist/vendor-module-federation-runtime-core-D5G-s9nP.js +0 -2202
  426. package/dist/vendor-module-federation-runtime-tools-CQbtw-RJ.js +0 -18
  427. package/dist/vendor-module-federation-sdk-DM4AJRa7.js +0 -683
  428. package/dist/vendor-nevware21-ts-async-D4qa7g-U.js +0 -261
  429. package/dist/vendor-nevware21-ts-utils-DII8jruI.js +0 -853
  430. package/dist/vendor-nth-check-CGMdQf59.js +0 -45
  431. package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
  432. package/dist/vendor-parse5-htmlparser2-tree-adapter-BUDJ887-.js +0 -143
  433. package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
  434. package/dist/vendor-prettier-CoRReRqw.js +0 -5215
  435. package/dist/vendor-prosemirror-commands-Bv4ChObl.js +0 -385
  436. package/dist/vendor-prosemirror-dropcursor-kF5UKNFM.js +0 -86
  437. package/dist/vendor-prosemirror-gapcursor-S3ikcYX6.js +0 -203
  438. package/dist/vendor-prosemirror-history-CQYKHz3u.js +0 -248
  439. package/dist/vendor-prosemirror-keymap-CAfQyvJ7.js +0 -62
  440. package/dist/vendor-prosemirror-markdown-rpUTSG_Q.js +0 -663
  441. package/dist/vendor-prosemirror-model-DAA3avbR.js +0 -2730
  442. package/dist/vendor-prosemirror-schema-list-BNJkECdS.js +0 -87
  443. package/dist/vendor-prosemirror-state-IeimrELV.js +0 -821
  444. package/dist/vendor-prosemirror-tables-zVUKdbdQ.js +0 -1414
  445. package/dist/vendor-prosemirror-transform-BUjWd5Tb.js +0 -1525
  446. package/dist/vendor-prosemirror-view-DFpBkGRq.js +0 -3794
  447. package/dist/vendor-punycode-js-CgGegfA_.js +0 -133
  448. package/dist/vendor-rope-sequence-BWC2FSrq.js +0 -100
  449. package/dist/vendor-semver-Dar8oU3V.js +0 -1023
  450. package/dist/vendor-striptags-BrHtQQiF.js +0 -120
  451. package/dist/vendor-stylis-ClfDrgKE.js +0 -334
  452. package/dist/vendor-swiper-1bp0oJwt.js +0 -3387
  453. package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
  454. package/dist/vendor-throttle-debounce-CX0imT7m.js +0 -28
  455. package/dist/vendor-tiptap-core-CDScflP1.js +0 -3921
  456. package/dist/vendor-tiptap-extension-blockquote-ChRAwuus.js +0 -55
  457. package/dist/vendor-tiptap-extension-bold-BwoVpOFS.js +0 -74
  458. package/dist/vendor-tiptap-extension-code-DOlgG3ih.js +0 -52
  459. package/dist/vendor-tiptap-extension-code-block-CMeTs87s.js +0 -215
  460. package/dist/vendor-tiptap-extension-document-DO8oly70.js +0 -12
  461. package/dist/vendor-tiptap-extension-hard-break-BgDl2sHf.js +0 -59
  462. package/dist/vendor-tiptap-extension-heading-DFuYlwHi.js +0 -63
  463. package/dist/vendor-tiptap-extension-horizontal-rule-uyfttMp9.js +0 -56
  464. package/dist/vendor-tiptap-extension-image-DPeBaTE3.js +0 -128
  465. package/dist/vendor-tiptap-extension-italic-C9-3jNxO.js +0 -73
  466. package/dist/vendor-tiptap-extension-link-B57VzStq.js +0 -312
  467. package/dist/vendor-tiptap-extension-list-spvOF7Mz.js +0 -722
  468. package/dist/vendor-tiptap-extension-paragraph-Cj7auQB7.js +0 -44
  469. package/dist/vendor-tiptap-extension-placeholder-DhwvmZ6Y.js +0 -1
  470. package/dist/vendor-tiptap-extension-strike-yj6UvnkO.js +0 -64
  471. package/dist/vendor-tiptap-extension-table-cell-CQpTPSvF.js +0 -1
  472. package/dist/vendor-tiptap-extension-table-ex1kZQ-9.js +0 -374
  473. package/dist/vendor-tiptap-extension-table-header-CQpTPSvF.js +0 -1
  474. package/dist/vendor-tiptap-extension-table-row-CQpTPSvF.js +0 -1
  475. package/dist/vendor-tiptap-extension-text-C8FG4KnI.js +0 -13
  476. package/dist/vendor-tiptap-extension-text-style-DsQDXowp.js +0 -235
  477. package/dist/vendor-tiptap-extension-underline-HB3fg6Dc.js +0 -65
  478. package/dist/vendor-tiptap-extensions-CUGwjzl5.js +0 -296
  479. package/dist/vendor-tiptap-markdown-DLzeP3KU.js +0 -826
  480. package/dist/vendor-tiptap-pm-DSHuSumV.js +0 -1
  481. package/dist/vendor-tiptap-starter-kit-C42PcJ7J.js +0 -28
  482. package/dist/vendor-tiptap-vue-3-BxWCzu9Z.js +0 -157
  483. package/dist/vendor-truncate-html-r2r8GKvW.js +0 -145
  484. package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
  485. package/dist/vendor-unovis-ts-Bue71Kwt.js +0 -2382
  486. package/dist/vendor-unovis-vue-C_K1g5KH.js +0 -446
  487. package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
  488. package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
  489. package/dist/vendor-vue-currency-input-CckB4kjx.js +0 -317
  490. package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
  491. package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
  492. package/dist/vendor-vue-i18n-DeO9Fa9I.js +0 -1387
  493. package/dist/vendor-vue-router-R3V0tq8_.js +0 -6
  494. package/dist/vendor-vue3-application-insights-BmJCYUcp.js +0 -69
  495. package/dist/vendor-vue3-touch-events-DqysuuWh.js +0 -169
  496. package/dist/vendor-vuepic-vue-datepicker-CaZ_qpJp.js +0 -4998
  497. package/dist/vendor-vueuse-components-Be490f6P.js +0 -542
  498. package/dist/vendor-vueuse-core-BW8bO6-j.js +0 -5135
  499. package/dist/vendor-vueuse-shared-bmkWEEYZ.js +0 -1169
  500. package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
  501. package/dist/vendor-web-vitals-vrpLO1bu.js +0 -207
@@ -1,3921 +0,0 @@
1
- import { f as me, c as gt, T as ge, e as ve, l as ye, j as _t, b as Q, R as be, a as we } from "./vendor-prosemirror-transform-BUjWd5Tb.js";
2
- import { c as ke, d as Me, e as xe, j as Se, a as Ee, b as Te, f as Ae, g as Ce, h as Pe, l as $e, i as Ne, n as Re, s as ze, k as Ie, m as De, o as Oe, p as _e, q as Tt, w as Be } from "./vendor-prosemirror-commands-Bv4ChObl.js";
3
- import { N as nt, E as je, S as j, T as P, P as $, a as O, A as Le } from "./vendor-prosemirror-state-IeimrELV.js";
4
- import { D as He, d as Bt, F as D, N as Fe, c as ut, S as Ve } from "./vendor-prosemirror-model-DAA3avbR.js";
5
- import { l as We, s as Ue, w as Ke } from "./vendor-prosemirror-schema-list-BNJkECdS.js";
6
- import { E as qe } from "./vendor-prosemirror-view-DFpBkGRq.js";
7
- import { k as Je } from "./vendor-prosemirror-keymap-CAfQyvJ7.js";
8
- var Xe = Object.defineProperty, vt = (e, t) => {
9
- for (var n in t)
10
- Xe(e, n, { get: t[n], enumerable: !0 });
11
- };
12
- function rt(e) {
13
- const { state: t, transaction: n } = e;
14
- let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
15
- return {
16
- ...t,
17
- apply: t.apply.bind(t),
18
- applyTransaction: t.applyTransaction.bind(t),
19
- plugins: t.plugins,
20
- schema: t.schema,
21
- reconfigure: t.reconfigure.bind(t),
22
- toJSON: t.toJSON.bind(t),
23
- get storedMarks() {
24
- return o;
25
- },
26
- get selection() {
27
- return r;
28
- },
29
- get doc() {
30
- return s;
31
- },
32
- get tr() {
33
- return r = n.selection, s = n.doc, o = n.storedMarks, n;
34
- }
35
- };
36
- }
37
- var st = class {
38
- constructor(e) {
39
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
40
- }
41
- get hasCustomState() {
42
- return !!this.customState;
43
- }
44
- get state() {
45
- return this.customState || this.editor.state;
46
- }
47
- get commands() {
48
- const { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: s } = n, o = this.buildProps(s);
49
- return Object.fromEntries(
50
- Object.entries(e).map(([i, a]) => [i, (...l) => {
51
- const u = a(...l)(o);
52
- return !s.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(s), u;
53
- }])
54
- );
55
- }
56
- get chain() {
57
- return () => this.createChain();
58
- }
59
- get can() {
60
- return () => this.createCan();
61
- }
62
- createChain(e, t = !0) {
63
- const { rawCommands: n, editor: r, state: s } = this, { view: o } = r, i = [], a = !!e, c = e || s.tr, l = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && o.dispatch(c), i.every((d) => d === !0)), u = {
64
- ...Object.fromEntries(
65
- Object.entries(n).map(([d, p]) => [d, (...h) => {
66
- const m = this.buildProps(c, t), g = p(...h)(m);
67
- return i.push(g), u;
68
- }])
69
- ),
70
- run: l
71
- };
72
- return u;
73
- }
74
- createCan(e) {
75
- const { rawCommands: t, state: n } = this, r = !1, s = e || n.tr, o = this.buildProps(s, r);
76
- return {
77
- ...Object.fromEntries(
78
- Object.entries(t).map(([a, c]) => [a, (...l) => c(...l)({ ...o, dispatch: void 0 })])
79
- ),
80
- chain: () => this.createChain(s, r)
81
- };
82
- }
83
- buildProps(e, t = !0) {
84
- const { rawCommands: n, editor: r, state: s } = this, { view: o } = r, i = {
85
- tr: e,
86
- editor: r,
87
- view: o,
88
- state: rt({
89
- state: s,
90
- transaction: e
91
- }),
92
- dispatch: t ? () => {
93
- } : void 0,
94
- chain: () => this.createChain(e, t),
95
- can: () => this.createCan(e),
96
- get commands() {
97
- return Object.fromEntries(
98
- Object.entries(n).map(([a, c]) => [a, (...l) => c(...l)(i)])
99
- );
100
- }
101
- };
102
- return i;
103
- }
104
- }, jt = {};
105
- vt(jt, {
106
- blur: () => Ye,
107
- clearContent: () => Qe,
108
- clearNodes: () => Ze,
109
- command: () => Ge,
110
- createParagraphNear: () => tn,
111
- cut: () => en,
112
- deleteCurrentNode: () => nn,
113
- deleteNode: () => rn,
114
- deleteRange: () => sn,
115
- deleteSelection: () => on,
116
- enter: () => an,
117
- exitCode: () => cn,
118
- extendMarkRange: () => ln,
119
- first: () => dn,
120
- focus: () => fn,
121
- forEach: () => pn,
122
- insertContent: () => hn,
123
- insertContentAt: () => vn,
124
- joinBackward: () => wn,
125
- joinDown: () => bn,
126
- joinForward: () => kn,
127
- joinItemBackward: () => Mn,
128
- joinItemForward: () => xn,
129
- joinTextblockBackward: () => Sn,
130
- joinTextblockForward: () => En,
131
- joinUp: () => yn,
132
- keyboardShortcut: () => An,
133
- lift: () => Cn,
134
- liftEmptyBlock: () => Pn,
135
- liftListItem: () => $n,
136
- newlineInCode: () => Nn,
137
- resetAttributes: () => Rn,
138
- scrollIntoView: () => zn,
139
- selectAll: () => In,
140
- selectNodeBackward: () => Dn,
141
- selectNodeForward: () => On,
142
- selectParentNode: () => _n,
143
- selectTextblockEnd: () => Bn,
144
- selectTextblockStart: () => jn,
145
- setContent: () => Ln,
146
- setMark: () => ar,
147
- setMeta: () => cr,
148
- setNode: () => lr,
149
- setNodeSelection: () => dr,
150
- setTextDirection: () => ur,
151
- setTextSelection: () => fr,
152
- sinkListItem: () => pr,
153
- splitBlock: () => hr,
154
- splitListItem: () => mr,
155
- toggleList: () => gr,
156
- toggleMark: () => vr,
157
- toggleNode: () => yr,
158
- toggleWrap: () => br,
159
- undoInputRule: () => wr,
160
- unsetAllMarks: () => kr,
161
- unsetMark: () => Mr,
162
- unsetTextDirection: () => xr,
163
- updateAttributes: () => Sr,
164
- wrapIn: () => Er,
165
- wrapInList: () => Tr
166
- });
167
- var Ye = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
168
- var n;
169
- e.isDestroyed || (t.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
- }), !0), Qe = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ze = () => ({ state: e, tr: t, dispatch: n }) => {
171
- const { selection: r } = t, { ranges: s } = r;
172
- return n && s.forEach(({ $from: o, $to: i }) => {
173
- e.doc.nodesBetween(o.pos, i.pos, (a, c) => {
174
- if (a.type.isText)
175
- return;
176
- const { doc: l, mapping: u } = t, d = l.resolve(u.map(c)), p = l.resolve(u.map(c + a.nodeSize)), f = d.blockRange(p);
177
- if (!f)
178
- return;
179
- const h = ye(f);
180
- if (a.type.isTextblock) {
181
- const { defaultType: m } = d.parent.contentMatchAt(d.index());
182
- t.setNodeMarkup(f.start, m);
183
- }
184
- (h || h === 0) && t.lift(f, h);
185
- });
186
- }), !0;
187
- }, Ge = (e) => (t) => e(t), tn = () => ({ state: e, dispatch: t }) => ke(e, t), en = (e, t) => ({ editor: n, tr: r }) => {
188
- const { state: s } = n, o = s.doc.slice(e.from, e.to);
189
- r.deleteRange(e.from, e.to);
190
- const i = r.mapping.map(t);
191
- return r.insert(i, o.content), r.setSelection(new P(r.doc.resolve(Math.max(i - 1, 0)))), !0;
192
- }, nn = () => ({ tr: e, dispatch: t }) => {
193
- const { selection: n } = e, r = n.$anchor.node();
194
- if (r.content.size > 0)
195
- return !1;
196
- const s = e.selection.$anchor;
197
- for (let o = s.depth; o > 0; o -= 1)
198
- if (s.node(o).type === r.type) {
199
- if (t) {
200
- const a = s.before(o), c = s.after(o);
201
- e.delete(a, c).scrollIntoView();
202
- }
203
- return !0;
204
- }
205
- return !1;
206
- };
207
- function T(e, t) {
208
- if (typeof e == "string") {
209
- if (!t.nodes[e])
210
- throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
211
- return t.nodes[e];
212
- }
213
- return e;
214
- }
215
- var rn = (e) => ({ tr: t, state: n, dispatch: r }) => {
216
- const s = T(e, n.schema), o = t.selection.$anchor;
217
- for (let i = o.depth; i > 0; i -= 1)
218
- if (o.node(i).type === s) {
219
- if (r) {
220
- const c = o.before(i), l = o.after(i);
221
- t.delete(c, l).scrollIntoView();
222
- }
223
- return !0;
224
- }
225
- return !1;
226
- }, sn = (e) => ({ tr: t, dispatch: n }) => {
227
- const { from: r, to: s } = e;
228
- return n && t.delete(r, s), !0;
229
- }, on = () => ({ state: e, dispatch: t }) => Me(e, t), an = () => ({ commands: e }) => e.keyboardShortcut("Enter"), cn = () => ({ state: e, dispatch: t }) => xe(e, t);
230
- function yt(e) {
231
- return Object.prototype.toString.call(e) === "[object RegExp]";
232
- }
233
- function G(e, t, n = { strict: !0 }) {
234
- const r = Object.keys(t);
235
- return r.length ? r.every((s) => n.strict ? t[s] === e[s] : yt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
236
- }
237
- function Lt(e, t, n = {}) {
238
- return e.find((r) => r.type === t && G(
239
- // Only check equality for the attributes that are provided
240
- Object.fromEntries(Object.keys(n).map((s) => [s, r.attrs[s]])),
241
- n
242
- ));
243
- }
244
- function At(e, t, n = {}) {
245
- return !!Lt(e, t, n);
246
- }
247
- function bt(e, t, n) {
248
- var r;
249
- if (!e || !t)
250
- return;
251
- let s = e.parent.childAfter(e.parentOffset);
252
- if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) == null ? void 0 : r.attrs), !Lt([...s.node.marks], t, n)))
253
- return;
254
- let i = s.index, a = e.start() + s.offset, c = i + 1, l = a + s.node.nodeSize;
255
- for (; i > 0 && At([...e.parent.child(i - 1).marks], t, n); )
256
- i -= 1, a -= e.parent.child(i).nodeSize;
257
- for (; c < e.parent.childCount && At([...e.parent.child(c).marks], t, n); )
258
- l += e.parent.child(c).nodeSize, c += 1;
259
- return {
260
- from: a,
261
- to: l
262
- };
263
- }
264
- function z(e, t) {
265
- if (typeof e == "string") {
266
- if (!t.marks[e])
267
- throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
268
- return t.marks[e];
269
- }
270
- return e;
271
- }
272
- var ln = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
273
- const o = z(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: u } = a;
274
- if (s) {
275
- const d = bt(c, o, t);
276
- if (d && d.from <= l && d.to >= u) {
277
- const p = P.create(i, d.from, d.to);
278
- n.setSelection(p);
279
- }
280
- }
281
- return !0;
282
- }, dn = (e) => (t) => {
283
- const n = typeof e == "function" ? e(t) : e;
284
- for (let r = 0; r < n.length; r += 1)
285
- if (n[r](t))
286
- return !0;
287
- return !1;
288
- };
289
- function Ht(e) {
290
- return e instanceof P;
291
- }
292
- function B(e = 0, t = 0, n = 0) {
293
- return Math.min(Math.max(e, t), n);
294
- }
295
- function Ft(e, t = null) {
296
- if (!t)
297
- return null;
298
- const n = j.atStart(e), r = j.atEnd(e);
299
- if (t === "start" || t === !0)
300
- return n;
301
- if (t === "end")
302
- return r;
303
- const s = n.from, o = r.to;
304
- return t === "all" ? P.create(e, B(0, s, o), B(e.content.size, s, o)) : P.create(e, B(t, s, o), B(t, s, o));
305
- }
306
- function Ct() {
307
- return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
308
- }
309
- function tt() {
310
- return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
311
- navigator.userAgent.includes("Mac") && "ontouchend" in document;
312
- }
313
- function un() {
314
- return typeof navigator < "u" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : !1;
315
- }
316
- var fn = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
317
- t = {
318
- scrollIntoView: !0,
319
- ...t
320
- };
321
- const i = () => {
322
- (tt() || Ct()) && r.dom.focus(), un() && !tt() && !Ct() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
323
- n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
324
- });
325
- };
326
- try {
327
- if (r.hasFocus() && e === null || e === !1)
328
- return !0;
329
- } catch {
330
- return !1;
331
- }
332
- if (o && e === null && !Ht(n.state.selection))
333
- return i(), !0;
334
- const a = Ft(s.doc, e) || n.state.selection, c = n.state.selection.eq(a);
335
- return o && (c || s.setSelection(a), c && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
336
- }, pn = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), hn = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Vt = (e) => {
337
- const t = e.childNodes;
338
- for (let n = t.length - 1; n >= 0; n -= 1) {
339
- const r = t[n];
340
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Vt(r);
341
- }
342
- return e;
343
- };
344
- function q(e) {
345
- if (typeof window > "u")
346
- throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
347
- const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
348
- return Vt(n);
349
- }
350
- function W(e, t, n) {
351
- if (e instanceof Fe || e instanceof D)
352
- return e;
353
- n = {
354
- slice: !0,
355
- parseOptions: {},
356
- ...n
357
- };
358
- const r = typeof e == "object" && e !== null, s = typeof e == "string";
359
- if (r)
360
- try {
361
- if (Array.isArray(e) && e.length > 0)
362
- return D.fromArray(e.map((a) => t.nodeFromJSON(a)));
363
- const i = t.nodeFromJSON(e);
364
- return n.errorOnInvalidContent && i.check(), i;
365
- } catch (o) {
366
- if (n.errorOnInvalidContent)
367
- throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
368
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), W("", t, n);
369
- }
370
- if (s) {
371
- if (n.errorOnInvalidContent) {
372
- let i = !1, a = "";
373
- const c = new Bt({
374
- topNode: t.spec.topNode,
375
- marks: t.spec.marks,
376
- // Prosemirror's schemas are executed such that: the last to execute, matches last
377
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
378
- nodes: t.spec.nodes.append({
379
- __tiptap__private__unknown__catch__all__node: {
380
- content: "inline*",
381
- group: "block",
382
- parseDOM: [
383
- {
384
- tag: "*",
385
- getAttrs: (l) => (i = !0, a = typeof l == "string" ? l : l.outerHTML, null)
386
- }
387
- ]
388
- }
389
- })
390
- });
391
- if (n.slice ? ut.fromSchema(c).parseSlice(q(e), n.parseOptions) : ut.fromSchema(c).parse(q(e), n.parseOptions), n.errorOnInvalidContent && i)
392
- throw new Error("[tiptap error]: Invalid HTML content", {
393
- cause: new Error(`Invalid element found: ${a}`)
394
- });
395
- }
396
- const o = ut.fromSchema(t);
397
- return n.slice ? o.parseSlice(q(e), n.parseOptions).content : o.parse(q(e), n.parseOptions);
398
- }
399
- return W("", t, n);
400
- }
401
- function mn(e, t, n) {
402
- const r = e.steps.length - 1;
403
- if (r < t)
404
- return;
405
- const s = e.steps[r];
406
- if (!(s instanceof be || s instanceof we))
407
- return;
408
- const o = e.mapping.maps[r];
409
- let i = 0;
410
- o.forEach((a, c, l, u) => {
411
- i === 0 && (i = u);
412
- }), e.setSelection(j.near(e.doc.resolve(i), n));
413
- }
414
- var gn = (e) => !("type" in e), vn = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
415
- var i;
416
- if (s) {
417
- n = {
418
- parseOptions: o.options.parseOptions,
419
- updateSelection: !0,
420
- applyInputRules: !1,
421
- applyPasteRules: !1,
422
- ...n
423
- };
424
- let a;
425
- const c = (g) => {
426
- o.emit("contentError", {
427
- editor: o,
428
- error: g,
429
- disableCollaboration: () => {
430
- "collaboration" in o.storage && typeof o.storage.collaboration == "object" && o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
431
- }
432
- });
433
- }, l = {
434
- preserveWhitespace: "full",
435
- ...n.parseOptions
436
- };
437
- if (!n.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError)
438
- try {
439
- W(t, o.schema, {
440
- parseOptions: l,
441
- errorOnInvalidContent: !0
442
- });
443
- } catch (g) {
444
- c(g);
445
- }
446
- try {
447
- a = W(t, o.schema, {
448
- parseOptions: l,
449
- errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : o.options.enableContentCheck
450
- });
451
- } catch (g) {
452
- return c(g), !1;
453
- }
454
- let { from: u, to: d } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, p = !0, f = !0;
455
- if ((gn(a) ? a : [a]).forEach((g) => {
456
- g.check(), p = p ? g.isText && g.marks.length === 0 : !1, f = f ? g.isBlock : !1;
457
- }), u === d && f) {
458
- const { parent: g } = r.doc.resolve(u);
459
- g.isTextblock && !g.type.spec.code && !g.childCount && (u -= 1, d += 1);
460
- }
461
- let m;
462
- if (p) {
463
- if (Array.isArray(t))
464
- m = t.map((g) => g.text || "").join("");
465
- else if (t instanceof D) {
466
- let g = "";
467
- t.forEach((v) => {
468
- v.text && (g += v.text);
469
- }), m = g;
470
- } else typeof t == "object" && t && t.text ? m = t.text : m = t;
471
- r.insertText(m, u, d);
472
- } else {
473
- m = a;
474
- const g = r.doc.resolve(u), v = g.node(), b = g.parentOffset === 0, k = v.isText || v.isTextblock, M = v.content.size > 0;
475
- b && k && M && (u = Math.max(0, u - 1)), r.replaceWith(u, d, m);
476
- }
477
- n.updateSelection && mn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: u, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: u, text: m });
478
- }
479
- return !0;
480
- }, yn = () => ({ state: e, dispatch: t }) => Se(e, t), bn = () => ({ state: e, dispatch: t }) => Ee(e, t), wn = () => ({ state: e, dispatch: t }) => Te(e, t), kn = () => ({ state: e, dispatch: t }) => Ae(e, t), Mn = () => ({ state: e, dispatch: t, tr: n }) => {
481
- try {
482
- const r = _t(e.doc, e.selection.$from.pos, -1);
483
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
484
- } catch {
485
- return !1;
486
- }
487
- }, xn = () => ({ state: e, dispatch: t, tr: n }) => {
488
- try {
489
- const r = _t(e.doc, e.selection.$from.pos, 1);
490
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
491
- } catch {
492
- return !1;
493
- }
494
- }, Sn = () => ({ state: e, dispatch: t }) => Ce(e, t), En = () => ({ state: e, dispatch: t }) => Pe(e, t);
495
- function Wt() {
496
- return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
497
- }
498
- function Tn(e) {
499
- const t = e.split(/-(?!$)/);
500
- let n = t[t.length - 1];
501
- n === "Space" && (n = " ");
502
- let r, s, o, i;
503
- for (let a = 0; a < t.length - 1; a += 1) {
504
- const c = t[a];
505
- if (/^(cmd|meta|m)$/i.test(c))
506
- i = !0;
507
- else if (/^a(lt)?$/i.test(c))
508
- r = !0;
509
- else if (/^(c|ctrl|control)$/i.test(c))
510
- s = !0;
511
- else if (/^s(hift)?$/i.test(c))
512
- o = !0;
513
- else if (/^mod$/i.test(c))
514
- tt() || Wt() ? i = !0 : s = !0;
515
- else
516
- throw new Error(`Unrecognized modifier name: ${c}`);
517
- }
518
- return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
519
- }
520
- var An = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
521
- const o = Tn(e).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
522
- key: i === "Space" ? " " : i,
523
- altKey: o.includes("Alt"),
524
- ctrlKey: o.includes("Ctrl"),
525
- metaKey: o.includes("Meta"),
526
- shiftKey: o.includes("Shift"),
527
- bubbles: !0,
528
- cancelable: !0
529
- }), c = t.captureTransaction(() => {
530
- n.someProp("handleKeyDown", (l) => l(n, a));
531
- });
532
- return c?.steps.forEach((l) => {
533
- const u = l.map(r.mapping);
534
- u && s && r.maybeStep(u);
535
- }), !0;
536
- };
537
- function U(e, t, n = {}) {
538
- const { from: r, to: s, empty: o } = e.selection, i = t ? T(t, e.schema) : null, a = [];
539
- e.doc.nodesBetween(r, s, (d, p) => {
540
- if (d.isText)
541
- return;
542
- const f = Math.max(r, p), h = Math.min(s, p + d.nodeSize);
543
- a.push({
544
- node: d,
545
- from: f,
546
- to: h
547
- });
548
- });
549
- const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => G(d.node.attrs, n, { strict: !1 }));
550
- return o ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= c;
551
- }
552
- var Cn = (e, t = {}) => ({ state: n, dispatch: r }) => {
553
- const s = T(e, n.schema);
554
- return U(n, s, t) ? $e(n, r) : !1;
555
- }, Pn = () => ({ state: e, dispatch: t }) => Ne(e, t), $n = (e) => ({ state: t, dispatch: n }) => {
556
- const r = T(e, t.schema);
557
- return We(r)(t, n);
558
- }, Nn = () => ({ state: e, dispatch: t }) => Re(e, t);
559
- function ot(e, t) {
560
- return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
561
- }
562
- function Pt(e, t) {
563
- const n = typeof t == "string" ? [t] : t;
564
- return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
565
- }
566
- var Rn = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
567
- let o = null, i = null;
568
- const a = ot(
569
- typeof e == "string" ? e : e.name,
570
- r.schema
571
- );
572
- if (!a)
573
- return !1;
574
- a === "node" && (o = T(e, r.schema)), a === "mark" && (i = z(e, r.schema));
575
- let c = !1;
576
- return n.selection.ranges.forEach((l) => {
577
- r.doc.nodesBetween(l.$from.pos, l.$to.pos, (u, d) => {
578
- o && o === u.type && (c = !0, s && n.setNodeMarkup(d, void 0, Pt(u.attrs, t))), i && u.marks.length && u.marks.forEach((p) => {
579
- i === p.type && (c = !0, s && n.addMark(d, d + u.nodeSize, i.create(Pt(p.attrs, t))));
580
- });
581
- });
582
- }), c;
583
- }, zn = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), In = () => ({ tr: e, dispatch: t }) => {
584
- if (t) {
585
- const n = new Le(e.doc);
586
- e.setSelection(n);
587
- }
588
- return !0;
589
- }, Dn = () => ({ state: e, dispatch: t }) => ze(e, t), On = () => ({ state: e, dispatch: t }) => Ie(e, t), _n = () => ({ state: e, dispatch: t }) => De(e, t), Bn = () => ({ state: e, dispatch: t }) => Oe(e, t), jn = () => ({ state: e, dispatch: t }) => _e(e, t);
590
- function ht(e, t, n = {}, r = {}) {
591
- return W(e, t, {
592
- slice: !1,
593
- parseOptions: n,
594
- errorOnInvalidContent: r.errorOnInvalidContent
595
- });
596
- }
597
- var Ln = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
598
- const { doc: c } = o;
599
- if (r.preserveWhitespace !== "full") {
600
- const l = ht(e, s.schema, r, {
601
- errorOnInvalidContent: t ?? s.options.enableContentCheck
602
- });
603
- return i && o.replaceWith(0, c.content.size, l).setMeta("preventUpdate", !n), !0;
604
- }
605
- return i && o.setMeta("preventUpdate", !n), a.insertContentAt({ from: 0, to: c.content.size }, e, {
606
- parseOptions: r,
607
- errorOnInvalidContent: t ?? s.options.enableContentCheck
608
- });
609
- };
610
- function Ut(e, t) {
611
- const n = z(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
612
- o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (c) => {
613
- i.push(...c.marks);
614
- });
615
- const a = i.find((c) => c.type.name === n.name);
616
- return a ? { ...a.attrs } : {};
617
- }
618
- function Hn(e, t) {
619
- const n = new ge(e);
620
- return t.forEach((r) => {
621
- r.steps.forEach((s) => {
622
- n.step(s);
623
- });
624
- }), n;
625
- }
626
- function Fn(e) {
627
- for (let t = 0; t < e.edgeCount; t += 1) {
628
- const { type: n } = e.edge(t);
629
- if (n.isTextblock && !n.hasRequiredAttrs())
630
- return n;
631
- }
632
- return null;
633
- }
634
- function os(e, t, n) {
635
- const r = [];
636
- return e.nodesBetween(t.from, t.to, (s, o) => {
637
- n(s) && r.push({
638
- node: s,
639
- pos: o
640
- });
641
- }), r;
642
- }
643
- function Vn(e, t) {
644
- for (let n = e.depth; n > 0; n -= 1) {
645
- const r = e.node(n);
646
- if (t(r))
647
- return {
648
- pos: n > 0 ? e.before(n) : 0,
649
- start: e.start(n),
650
- depth: n,
651
- node: r
652
- };
653
- }
654
- }
655
- function it(e) {
656
- return (t) => Vn(t.$from, e);
657
- }
658
- function y(e, t, n) {
659
- return e.config[t] === void 0 && e.parent ? y(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
660
- ...n,
661
- parent: e.parent ? y(e.parent, t, n) : null
662
- }) : e.config[t];
663
- }
664
- function wt(e) {
665
- return e.map((t) => {
666
- const n = {
667
- name: t.name,
668
- options: t.options,
669
- storage: t.storage
670
- }, r = y(t, "addExtensions", n);
671
- return r ? [t, ...wt(r())] : t;
672
- }).flat(10);
673
- }
674
- function kt(e, t) {
675
- const n = He.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
676
- return s.appendChild(n), s.innerHTML;
677
- }
678
- function Kt(e) {
679
- return typeof e == "function";
680
- }
681
- function x(e, t = void 0, ...n) {
682
- return Kt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
683
- }
684
- function Wn(e = {}) {
685
- return Object.keys(e).length === 0 && e.constructor === Object;
686
- }
687
- function L(e) {
688
- const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
689
- return {
690
- baseExtensions: t,
691
- nodeExtensions: n,
692
- markExtensions: r
693
- };
694
- }
695
- function qt(e) {
696
- const t = [], { nodeExtensions: n, markExtensions: r } = L(e), s = [...n, ...r], o = {
697
- default: null,
698
- validate: void 0,
699
- rendered: !0,
700
- renderHTML: null,
701
- parseHTML: null,
702
- keepOnSplit: !0,
703
- isRequired: !1
704
- }, i = n.filter((l) => l.name !== "text").map((l) => l.name), a = r.map((l) => l.name), c = [...i, ...a];
705
- return e.forEach((l) => {
706
- const u = {
707
- name: l.name,
708
- options: l.options,
709
- storage: l.storage,
710
- extensions: s
711
- }, d = y(
712
- l,
713
- "addGlobalAttributes",
714
- u
715
- );
716
- if (!d)
717
- return;
718
- d().forEach((f) => {
719
- let h;
720
- Array.isArray(f.types) ? h = f.types : f.types === "*" ? h = c : f.types === "nodes" ? h = i : f.types === "marks" ? h = a : h = [], h.forEach((m) => {
721
- Object.entries(f.attributes).forEach(([g, v]) => {
722
- t.push({
723
- type: m,
724
- name: g,
725
- attribute: {
726
- ...o,
727
- ...v
728
- }
729
- });
730
- });
731
- });
732
- });
733
- }), s.forEach((l) => {
734
- const u = {
735
- name: l.name,
736
- options: l.options,
737
- storage: l.storage
738
- }, d = y(
739
- l,
740
- "addAttributes",
741
- u
742
- );
743
- if (!d)
744
- return;
745
- const p = d();
746
- Object.entries(p).forEach(([f, h]) => {
747
- const m = {
748
- ...o,
749
- ...h
750
- };
751
- typeof m?.default == "function" && (m.default = m.default()), m?.isRequired && m?.default === void 0 && delete m.default, t.push({
752
- type: l.name,
753
- name: f,
754
- attribute: m
755
- });
756
- });
757
- }), t;
758
- }
759
- function Un(e) {
760
- const t = [];
761
- let n = "", r = !1, s = !1, o = 0;
762
- const i = e.length;
763
- for (let a = 0; a < i; a += 1) {
764
- const c = e[a];
765
- if (c === "'" && !s) {
766
- r = !r, n += c;
767
- continue;
768
- }
769
- if (c === '"' && !r) {
770
- s = !s, n += c;
771
- continue;
772
- }
773
- if (!r && !s) {
774
- if (c === "(") {
775
- o += 1, n += c;
776
- continue;
777
- }
778
- if (c === ")" && o > 0) {
779
- o -= 1, n += c;
780
- continue;
781
- }
782
- if (c === ";" && o === 0) {
783
- t.push(n), n = "";
784
- continue;
785
- }
786
- }
787
- n += c;
788
- }
789
- return n && t.push(n), t;
790
- }
791
- function $t(e) {
792
- const t = [], n = Un(e || ""), r = n.length;
793
- for (let s = 0; s < r; s += 1) {
794
- const o = n[s], i = o.indexOf(":");
795
- if (i === -1)
796
- continue;
797
- const a = o.slice(0, i).trim(), c = o.slice(i + 1).trim();
798
- a && c && t.push([a, c]);
799
- }
800
- return t;
801
- }
802
- function Kn(...e) {
803
- return e.filter((t) => !!t).reduce((t, n) => {
804
- const r = { ...t };
805
- return Object.entries(n).forEach(([s, o]) => {
806
- if (!r[s]) {
807
- r[s] = o;
808
- return;
809
- }
810
- if (s === "class") {
811
- const a = o ? String(o).split(" ") : [], c = r[s] ? r[s].split(" ") : [], l = a.filter((u) => !c.includes(u));
812
- r[s] = [...c, ...l].join(" ");
813
- } else if (s === "style") {
814
- const a = new Map([...$t(r[s]), ...$t(o)]);
815
- r[s] = Array.from(a.entries()).map(([c, l]) => `${c}: ${l}`).join("; ");
816
- } else
817
- r[s] = o;
818
- }), r;
819
- }, {});
820
- }
821
- function et(e, t) {
822
- return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
823
- [n.name]: e.attrs[n.name]
824
- }).reduce((n, r) => Kn(n, r), {});
825
- }
826
- function qn(e) {
827
- return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
828
- }
829
- function Nt(e, t) {
830
- return "style" in e ? e : {
831
- ...e,
832
- getAttrs: (n) => {
833
- const r = e.getAttrs ? e.getAttrs(n) : e.attrs;
834
- if (r === !1)
835
- return !1;
836
- const s = t.reduce((o, i) => {
837
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : qn(n.getAttribute(i.name));
838
- return a == null ? o : {
839
- ...o,
840
- [i.name]: a
841
- };
842
- }, {});
843
- return { ...r, ...s };
844
- }
845
- };
846
- }
847
- function Rt(e) {
848
- return Object.fromEntries(
849
- // @ts-ignore
850
- Object.entries(e).filter(([t, n]) => t === "attrs" && Wn(n) ? !1 : n != null)
851
- );
852
- }
853
- function zt(e) {
854
- var t, n;
855
- const r = {};
856
- return !((t = e?.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), ((n = e?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
857
- }
858
- function Jn(e, t) {
859
- var n;
860
- const r = qt(e), { nodeExtensions: s, markExtensions: o } = L(e), i = (n = s.find((l) => y(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
861
- s.map((l) => {
862
- const u = r.filter((v) => v.type === l.name), d = {
863
- name: l.name,
864
- options: l.options,
865
- storage: l.storage,
866
- editor: t
867
- }, p = e.reduce((v, b) => {
868
- const k = y(b, "extendNodeSchema", d);
869
- return {
870
- ...v,
871
- ...k ? k(l) : {}
872
- };
873
- }, {}), f = Rt({
874
- ...p,
875
- content: x(y(l, "content", d)),
876
- marks: x(y(l, "marks", d)),
877
- group: x(y(l, "group", d)),
878
- inline: x(y(l, "inline", d)),
879
- atom: x(y(l, "atom", d)),
880
- selectable: x(y(l, "selectable", d)),
881
- draggable: x(y(l, "draggable", d)),
882
- code: x(y(l, "code", d)),
883
- whitespace: x(y(l, "whitespace", d)),
884
- linebreakReplacement: x(
885
- y(l, "linebreakReplacement", d)
886
- ),
887
- defining: x(y(l, "defining", d)),
888
- isolating: x(y(l, "isolating", d)),
889
- attrs: Object.fromEntries(u.map(zt))
890
- }), h = x(y(l, "parseHTML", d));
891
- h && (f.parseDOM = h.map(
892
- (v) => Nt(v, u)
893
- ));
894
- const m = y(l, "renderHTML", d);
895
- m && (f.toDOM = (v) => m({
896
- node: v,
897
- HTMLAttributes: et(v, u)
898
- }));
899
- const g = y(l, "renderText", d);
900
- return g && (f.toText = g), [l.name, f];
901
- })
902
- ), c = Object.fromEntries(
903
- o.map((l) => {
904
- const u = r.filter((g) => g.type === l.name), d = {
905
- name: l.name,
906
- options: l.options,
907
- storage: l.storage,
908
- editor: t
909
- }, p = e.reduce((g, v) => {
910
- const b = y(v, "extendMarkSchema", d);
911
- return {
912
- ...g,
913
- ...b ? b(l) : {}
914
- };
915
- }, {}), f = Rt({
916
- ...p,
917
- inclusive: x(y(l, "inclusive", d)),
918
- excludes: x(y(l, "excludes", d)),
919
- group: x(y(l, "group", d)),
920
- spanning: x(y(l, "spanning", d)),
921
- code: x(y(l, "code", d)),
922
- attrs: Object.fromEntries(u.map(zt))
923
- }), h = x(y(l, "parseHTML", d));
924
- h && (f.parseDOM = h.map(
925
- (g) => Nt(g, u)
926
- ));
927
- const m = y(l, "renderHTML", d);
928
- return m && (f.toDOM = (g) => m({
929
- mark: g,
930
- HTMLAttributes: et(g, u)
931
- })), [l.name, f];
932
- })
933
- );
934
- return new Bt({
935
- topNode: i,
936
- nodes: a,
937
- marks: c
938
- });
939
- }
940
- function Xn(e) {
941
- const t = e.filter((n, r) => e.indexOf(n) !== r);
942
- return Array.from(new Set(t));
943
- }
944
- function V(e) {
945
- return e.sort((n, r) => {
946
- const s = y(n, "priority") || 100, o = y(r, "priority") || 100;
947
- return s > o ? -1 : s < o ? 1 : 0;
948
- });
949
- }
950
- function Jt(e) {
951
- const t = V(wt(e)), n = Xn(t.map((r) => r.name));
952
- return n.length && console.warn(
953
- `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
954
- ), t;
955
- }
956
- function Xt(e, t, n) {
957
- const { from: r, to: s } = t, { blockSeparator: o = `
958
-
959
- `, textSerializers: i = {} } = n || {};
960
- let a = "";
961
- return e.nodesBetween(r, s, (c, l, u, d) => {
962
- var p;
963
- c.isBlock && l > r && (a += o);
964
- const f = i?.[c.type.name];
965
- if (f)
966
- return u && (a += f({
967
- node: c,
968
- pos: l,
969
- parent: u,
970
- index: d,
971
- range: t
972
- })), !1;
973
- c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, s - l));
974
- }), a;
975
- }
976
- function Yn(e, t) {
977
- const n = {
978
- from: 0,
979
- to: e.content.size
980
- };
981
- return Xt(e, n, t);
982
- }
983
- function Yt(e) {
984
- return Object.fromEntries(
985
- Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText])
986
- );
987
- }
988
- function Qn(e, t) {
989
- const n = T(t, e.schema), { from: r, to: s } = e.selection, o = [];
990
- e.doc.nodesBetween(r, s, (a) => {
991
- o.push(a);
992
- });
993
- const i = o.reverse().find((a) => a.type.name === n.name);
994
- return i ? { ...i.attrs } : {};
995
- }
996
- function Zn(e, t) {
997
- const n = ot(
998
- typeof t == "string" ? t : t.name,
999
- e.schema
1000
- );
1001
- return n === "node" ? Qn(e, t) : n === "mark" ? Ut(e, t) : {};
1002
- }
1003
- function Gn(e, t = JSON.stringify) {
1004
- const n = {};
1005
- return e.filter((r) => {
1006
- const s = t(r);
1007
- return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
1008
- });
1009
- }
1010
- function tr(e) {
1011
- const t = Gn(e);
1012
- return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
1013
- }
1014
- function er(e) {
1015
- const { mapping: t, steps: n } = e, r = [];
1016
- return t.maps.forEach((s, o) => {
1017
- const i = [];
1018
- if (s.ranges.length)
1019
- s.forEach((a, c) => {
1020
- i.push({ from: a, to: c });
1021
- });
1022
- else {
1023
- const { from: a, to: c } = n[o];
1024
- if (a === void 0 || c === void 0)
1025
- return;
1026
- i.push({ from: a, to: c });
1027
- }
1028
- i.forEach(({ from: a, to: c }) => {
1029
- const l = t.slice(o).map(a, -1), u = t.slice(o).map(c), d = t.invert().map(l, -1), p = t.invert().map(u);
1030
- r.push({
1031
- oldRange: {
1032
- from: d,
1033
- to: p
1034
- },
1035
- newRange: {
1036
- from: l,
1037
- to: u
1038
- }
1039
- });
1040
- });
1041
- }), tr(r);
1042
- }
1043
- function Qt(e, t, n) {
1044
- const r = [];
1045
- return e === t ? n.resolve(e).marks().forEach((s) => {
1046
- const o = n.resolve(e), i = bt(o, s.type);
1047
- i && r.push({
1048
- mark: s,
1049
- ...i
1050
- });
1051
- }) : n.nodesBetween(e, t, (s, o) => {
1052
- !s || s?.nodeSize === void 0 || r.push(
1053
- ...s.marks.map((i) => ({
1054
- from: o,
1055
- to: o + s.nodeSize,
1056
- mark: i
1057
- }))
1058
- );
1059
- }), r;
1060
- }
1061
- var is = (e, t, n, r = 20) => {
1062
- const s = e.doc.resolve(n);
1063
- let o = r, i = null;
1064
- for (; o > 0 && i === null; ) {
1065
- const a = s.node(o);
1066
- a?.type.name === t ? i = a : o -= 1;
1067
- }
1068
- return [i, o];
1069
- };
1070
- function H(e, t) {
1071
- return t.nodes[e] || t.marks[e] || null;
1072
- }
1073
- function Z(e, t, n) {
1074
- return Object.fromEntries(
1075
- Object.entries(n).filter(([r]) => {
1076
- const s = e.find((o) => o.type === t && o.name === r);
1077
- return s ? s.attribute.keepOnSplit : !1;
1078
- })
1079
- );
1080
- }
1081
- var nr = (e, t = 500) => {
1082
- let n = "";
1083
- const r = e.parentOffset;
1084
- return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
1085
- var c, l;
1086
- const u = ((l = (c = s.type.spec).toText) == null ? void 0 : l.call(c, {
1087
- node: s,
1088
- pos: o,
1089
- parent: i,
1090
- index: a
1091
- })) || s.textContent || "%leaf%";
1092
- n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
1093
- }), n;
1094
- };
1095
- function mt(e, t, n = {}) {
1096
- const { empty: r, ranges: s } = e.selection, o = t ? z(t, e.schema) : null;
1097
- if (r)
1098
- return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => G(d.attrs, n, { strict: !1 }));
1099
- let i = 0;
1100
- const a = [];
1101
- if (s.forEach(({ $from: d, $to: p }) => {
1102
- const f = d.pos, h = p.pos;
1103
- e.doc.nodesBetween(f, h, (m, g) => {
1104
- if (o && m.inlineContent && !m.type.allowsMarkType(o))
1105
- return !1;
1106
- if (!m.isText && !m.marks.length)
1107
- return;
1108
- const v = Math.max(f, g), b = Math.min(h, g + m.nodeSize), k = b - v;
1109
- i += k, a.push(
1110
- ...m.marks.map((M) => ({
1111
- mark: M,
1112
- from: v,
1113
- to: b
1114
- }))
1115
- );
1116
- });
1117
- }), i === 0)
1118
- return !1;
1119
- const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => G(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
1120
- return (c > 0 ? c + l : c) >= i;
1121
- }
1122
- function rr(e, t, n = {}) {
1123
- if (!t)
1124
- return U(e, null, n) || mt(e, null, n);
1125
- const r = ot(t, e.schema);
1126
- return r === "node" ? U(e, t, n) : r === "mark" ? mt(e, t, n) : !1;
1127
- }
1128
- var as = (e, t) => {
1129
- const { $from: n, $to: r, $anchor: s } = e.selection;
1130
- if (t) {
1131
- const o = it((a) => a.type.name === t)(e.selection);
1132
- if (!o)
1133
- return !1;
1134
- const i = e.doc.resolve(o.pos + 1);
1135
- return s.pos + 1 === i.end();
1136
- }
1137
- return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1138
- }, cs = (e) => {
1139
- const { $from: t, $to: n } = e.selection;
1140
- return !(t.parentOffset > 0 || t.pos !== n.pos);
1141
- };
1142
- function It(e, t) {
1143
- return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
1144
- }
1145
- function Dt(e, t) {
1146
- const { nodeExtensions: n } = L(t), r = n.find((i) => i.name === e);
1147
- if (!r)
1148
- return !1;
1149
- const s = {
1150
- name: r.name,
1151
- options: r.options,
1152
- storage: r.storage
1153
- }, o = x(y(r, "group", s));
1154
- return typeof o != "string" ? !1 : o.split(" ").includes("list");
1155
- }
1156
- function Mt(e, {
1157
- checkChildren: t = !0,
1158
- ignoreWhitespace: n = !1
1159
- } = {}) {
1160
- var r;
1161
- if (n) {
1162
- if (e.type.name === "hardBreak")
1163
- return !0;
1164
- if (e.isText)
1165
- return /^\s*$/m.test((r = e.text) != null ? r : "");
1166
- }
1167
- if (e.isText)
1168
- return !e.text;
1169
- if (e.isAtom || e.isLeaf)
1170
- return !1;
1171
- if (e.content.childCount === 0)
1172
- return !0;
1173
- if (t) {
1174
- let s = !0;
1175
- return e.content.forEach((o) => {
1176
- s !== !1 && (Mt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1177
- }), s;
1178
- }
1179
- return !1;
1180
- }
1181
- function ls(e) {
1182
- return e instanceof nt;
1183
- }
1184
- var Zt = class Gt {
1185
- constructor(t) {
1186
- this.position = t;
1187
- }
1188
- /**
1189
- * Creates a MappablePosition from a JSON object.
1190
- */
1191
- static fromJSON(t) {
1192
- return new Gt(t.position);
1193
- }
1194
- /**
1195
- * Converts the MappablePosition to a JSON object.
1196
- */
1197
- toJSON() {
1198
- return {
1199
- position: this.position
1200
- };
1201
- }
1202
- };
1203
- function sr(e, t) {
1204
- const n = t.mapping.mapResult(e.position);
1205
- return {
1206
- position: new Zt(n.pos),
1207
- mapResult: n
1208
- };
1209
- }
1210
- function or(e) {
1211
- return new Zt(e);
1212
- }
1213
- function ir(e, t, n) {
1214
- var r;
1215
- const { selection: s } = t;
1216
- let o = null;
1217
- if (Ht(s) && (o = s.$cursor), o) {
1218
- const a = (r = e.storedMarks) != null ? r : o.marks();
1219
- return o.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
1220
- }
1221
- const { ranges: i } = s;
1222
- return i.some(({ $from: a, $to: c }) => {
1223
- let l = a.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1224
- return e.doc.nodesBetween(a.pos, c.pos, (u, d, p) => {
1225
- if (l)
1226
- return !1;
1227
- if (u.isInline) {
1228
- const f = !p || p.type.allowsMarkType(n), h = !!n.isInSet(u.marks) || !u.marks.some((m) => m.type.excludes(n));
1229
- l = f && h;
1230
- }
1231
- return !l;
1232
- }), l;
1233
- });
1234
- }
1235
- var ar = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1236
- const { selection: o } = n, { empty: i, ranges: a } = o, c = z(e, r.schema);
1237
- if (s)
1238
- if (i) {
1239
- const l = Ut(r, c);
1240
- n.addStoredMark(
1241
- c.create({
1242
- ...l,
1243
- ...t
1244
- })
1245
- );
1246
- } else
1247
- a.forEach((l) => {
1248
- const u = l.$from.pos, d = l.$to.pos;
1249
- r.doc.nodesBetween(u, d, (p, f) => {
1250
- const h = Math.max(f, u), m = Math.min(f + p.nodeSize, d);
1251
- p.marks.find((v) => v.type === c) ? p.marks.forEach((v) => {
1252
- c === v.type && n.addMark(
1253
- h,
1254
- m,
1255
- c.create({
1256
- ...v.attrs,
1257
- ...t
1258
- })
1259
- );
1260
- }) : n.addMark(h, m, c.create(t));
1261
- });
1262
- });
1263
- return ir(r, n, c);
1264
- }, cr = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), lr = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
1265
- const o = T(e, n.schema);
1266
- let i;
1267
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) => Tt(o, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Tt(o, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1268
- }, dr = (e) => ({ tr: t, dispatch: n }) => {
1269
- if (n) {
1270
- const { doc: r } = t, s = B(e, 0, r.content.size), o = nt.create(r, s);
1271
- t.setSelection(o);
1272
- }
1273
- return !0;
1274
- }, ur = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1275
- const { selection: o } = r;
1276
- let i, a;
1277
- return typeof t == "number" ? (i = t, a = t) : t && "from" in t && "to" in t ? (i = t.from, a = t.to) : (i = o.from, a = o.to), s && n.doc.nodesBetween(i, a, (c, l) => {
1278
- c.isText || n.setNodeMarkup(l, void 0, {
1279
- ...c.attrs,
1280
- dir: e
1281
- });
1282
- }), !0;
1283
- }, fr = (e) => ({ tr: t, dispatch: n }) => {
1284
- if (n) {
1285
- const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = P.atStart(r).from, a = P.atEnd(r).to, c = B(s, i, a), l = B(o, i, a), u = P.create(r, c, l);
1286
- t.setSelection(u);
1287
- }
1288
- return !0;
1289
- }, pr = (e) => ({ state: t, dispatch: n }) => {
1290
- const r = T(e, t.schema);
1291
- return Ue(r)(t, n);
1292
- };
1293
- function Ot(e, t) {
1294
- const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1295
- if (n) {
1296
- const r = n.filter((s) => t?.includes(s.type.name));
1297
- e.tr.ensureMarks(r);
1298
- }
1299
- }
1300
- var hr = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
1301
- const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u = Z(l, a.node().type.name, a.node().attrs);
1302
- if (o instanceof nt && o.node.isBlock)
1303
- return !a.parentOffset || !Q(i, a.pos) ? !1 : (r && (e && Ot(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1304
- if (!a.parent.isBlock)
1305
- return !1;
1306
- const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Fn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1307
- let f = d && p ? [
1308
- {
1309
- type: p,
1310
- attrs: u
1311
- }
1312
- ] : void 0, h = Q(t.doc, t.mapping.map(a.pos), 1, f);
1313
- if (!f && !h && Q(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, f = p ? [
1314
- {
1315
- type: p,
1316
- attrs: u
1317
- }
1318
- ] : void 0), r) {
1319
- if (h && (o instanceof P && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, f), p && !d && !a.parentOffset && a.parent.type !== p)) {
1320
- const m = t.mapping.map(a.before()), g = t.doc.resolve(m);
1321
- a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1322
- }
1323
- e && Ot(n, s.extensionManager.splittableMarks), t.scrollIntoView();
1324
- }
1325
- return h;
1326
- }, mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
1327
- var i;
1328
- const a = T(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
1329
- if (u && u.isBlock || c.depth < 2 || !c.sameParent(l))
1330
- return !1;
1331
- const d = c.node(-1);
1332
- if (d.type !== a)
1333
- return !1;
1334
- const p = o.extensionManager.attributes;
1335
- if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1336
- if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
1337
- return !1;
1338
- if (s) {
1339
- let v = D.empty;
1340
- const b = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1341
- for (let A = c.depth - b; A >= c.depth - 3; A -= 1)
1342
- v = D.from(c.node(A).copy(v));
1343
- const k = (
1344
- // eslint-disable-next-line no-nested-ternary
1345
- c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
1346
- ), M = {
1347
- ...Z(p, c.node().type.name, c.node().attrs),
1348
- ...t
1349
- }, w = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
1350
- v = v.append(D.from(a.createAndFill(null, w) || void 0));
1351
- const S = c.before(c.depth - (b - 1));
1352
- n.replace(S, c.after(-k), new Ve(v, 4 - b, 0));
1353
- let E = -1;
1354
- n.doc.nodesBetween(S, n.doc.content.size, (A, C) => {
1355
- if (E > -1)
1356
- return !1;
1357
- A.isTextblock && A.content.size === 0 && (E = C + 1);
1358
- }), E > -1 && n.setSelection(P.near(n.doc.resolve(E))), n.scrollIntoView();
1359
- }
1360
- return !0;
1361
- }
1362
- const f = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
1363
- ...Z(p, d.type.name, d.attrs),
1364
- ...t
1365
- }, m = {
1366
- ...Z(p, c.node().type.name, c.node().attrs),
1367
- ...t
1368
- };
1369
- n.delete(c.pos, l.pos);
1370
- const g = f ? [
1371
- { type: a, attrs: h },
1372
- { type: f, attrs: m }
1373
- ] : [{ type: a, attrs: h }];
1374
- if (!Q(n.doc, c.pos, 2))
1375
- return !1;
1376
- if (s) {
1377
- const { selection: v, storedMarks: b } = r, { splittableMarks: k } = o.extensionManager, M = b || v.$to.parentOffset && v.$from.marks();
1378
- if (n.split(c.pos, 2, g).scrollIntoView(), !M || !s)
1379
- return !0;
1380
- const w = M.filter((S) => k.includes(S.type.name));
1381
- n.ensureMarks(w);
1382
- }
1383
- return !0;
1384
- }, ft = (e, t) => {
1385
- const n = it((i) => i.type === t)(e.selection);
1386
- if (!n)
1387
- return !0;
1388
- const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1389
- if (r === void 0)
1390
- return !0;
1391
- const s = e.doc.nodeAt(r);
1392
- return n.node.type === s?.type && gt(e.doc, n.pos) && e.join(n.pos), !0;
1393
- }, pt = (e, t) => {
1394
- const n = it((i) => i.type === t)(e.selection);
1395
- if (!n)
1396
- return !0;
1397
- const r = e.doc.resolve(n.start).after(n.depth);
1398
- if (r === void 0)
1399
- return !0;
1400
- const s = e.doc.nodeAt(r);
1401
- return n.node.type === s?.type && gt(e.doc, r) && e.join(r), !0;
1402
- }, gr = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: c, commands: l, can: u }) => {
1403
- const { extensions: d, splittableMarks: p } = s.extensionManager, f = T(e, i.schema), h = T(t, i.schema), { selection: m, storedMarks: g } = i, { $from: v, $to: b } = m, k = v.blockRange(b), M = g || m.$to.parentOffset && m.$from.marks();
1404
- if (!k)
1405
- return !1;
1406
- const w = it((S) => Dt(S.type.name, d))(m);
1407
- if (k.depth >= 1 && w && k.depth - w.depth <= 1) {
1408
- if (w.node.type === f)
1409
- return l.liftListItem(h);
1410
- if (Dt(w.node.type.name, d) && f.validContent(w.node.content) && a)
1411
- return c().command(() => (o.setNodeMarkup(w.pos, f), !0)).command(() => ft(o, f)).command(() => pt(o, f)).run();
1412
- }
1413
- return !n || !M || !a ? c().command(() => u().wrapInList(f, r) ? !0 : l.clearNodes()).wrapInList(f, r).command(() => ft(o, f)).command(() => pt(o, f)).run() : c().command(() => {
1414
- const S = u().wrapInList(f, r), E = M.filter((A) => p.includes(A.type.name));
1415
- return o.ensureMarks(E), S ? !0 : l.clearNodes();
1416
- }).wrapInList(f, r).command(() => ft(o, f)).command(() => pt(o, f)).run();
1417
- }, vr = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
1418
- const { extendEmptyMarkRange: o = !1 } = n, i = z(e, r.schema);
1419
- return mt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
1420
- }, yr = (e, t, n = {}) => ({ state: r, commands: s }) => {
1421
- const o = T(e, r.schema), i = T(t, r.schema), a = U(r, o, n);
1422
- let c;
1423
- return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? s.setNode(i, c) : s.setNode(o, { ...c, ...n });
1424
- }, br = (e, t = {}) => ({ state: n, commands: r }) => {
1425
- const s = T(e, n.schema);
1426
- return U(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
1427
- }, wr = () => ({ state: e, dispatch: t }) => {
1428
- const n = e.plugins;
1429
- for (let r = 0; r < n.length; r += 1) {
1430
- const s = n[r];
1431
- let o;
1432
- if (s.spec.isInputRules && (o = s.getState(e))) {
1433
- if (t) {
1434
- const i = e.tr, a = o.transform;
1435
- for (let c = a.steps.length - 1; c >= 0; c -= 1)
1436
- i.step(a.steps[c].invert(a.docs[c]));
1437
- if (o.text) {
1438
- const c = i.doc.resolve(o.from).marks();
1439
- i.replaceWith(o.from, o.to, e.schema.text(o.text, c));
1440
- } else
1441
- i.delete(o.from, o.to);
1442
- }
1443
- return !0;
1444
- }
1445
- }
1446
- return !1;
1447
- }, kr = () => ({ tr: e, dispatch: t }) => {
1448
- const { selection: n } = e, { empty: r, ranges: s } = n;
1449
- return r || t && s.forEach((o) => {
1450
- e.removeMark(o.$from.pos, o.$to.pos);
1451
- }), !0;
1452
- }, Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1453
- var o;
1454
- const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = z(e, r.schema), { $from: l, empty: u, ranges: d } = a;
1455
- if (!s)
1456
- return !0;
1457
- if (u && i) {
1458
- let { from: p, to: f } = a;
1459
- const h = (o = l.marks().find((g) => g.type === c)) == null ? void 0 : o.attrs, m = bt(l, c, h);
1460
- m && (p = m.from, f = m.to), n.removeMark(p, f, c);
1461
- } else
1462
- d.forEach((p) => {
1463
- n.removeMark(p.$from.pos, p.$to.pos, c);
1464
- });
1465
- return n.removeStoredMark(c), !0;
1466
- }, xr = (e) => ({ tr: t, state: n, dispatch: r }) => {
1467
- const { selection: s } = n;
1468
- let o, i;
1469
- return typeof e == "number" ? (o = e, i = e) : e && "from" in e && "to" in e ? (o = e.from, i = e.to) : (o = s.from, i = s.to), r && t.doc.nodesBetween(o, i, (a, c) => {
1470
- if (a.isText)
1471
- return;
1472
- const l = { ...a.attrs };
1473
- delete l.dir, t.setNodeMarkup(c, void 0, l);
1474
- }), !0;
1475
- }, Sr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1476
- let o = null, i = null;
1477
- const a = ot(
1478
- typeof e == "string" ? e : e.name,
1479
- r.schema
1480
- );
1481
- if (!a)
1482
- return !1;
1483
- a === "node" && (o = T(e, r.schema)), a === "mark" && (i = z(e, r.schema));
1484
- let c = !1;
1485
- return n.selection.ranges.forEach((l) => {
1486
- const u = l.$from.pos, d = l.$to.pos;
1487
- let p, f, h, m;
1488
- n.selection.empty ? r.doc.nodesBetween(u, d, (g, v) => {
1489
- o && o === g.type && (c = !0, h = Math.max(v, u), m = Math.min(v + g.nodeSize, d), p = v, f = g);
1490
- }) : r.doc.nodesBetween(u, d, (g, v) => {
1491
- v < u && o && o === g.type && (c = !0, h = Math.max(v, u), m = Math.min(v + g.nodeSize, d), p = v, f = g), v >= u && v <= d && (o && o === g.type && (c = !0, s && n.setNodeMarkup(v, void 0, {
1492
- ...g.attrs,
1493
- ...t
1494
- })), i && g.marks.length && g.marks.forEach((b) => {
1495
- if (i === b.type && (c = !0, s)) {
1496
- const k = Math.max(v, u), M = Math.min(v + g.nodeSize, d);
1497
- n.addMark(
1498
- k,
1499
- M,
1500
- i.create({
1501
- ...b.attrs,
1502
- ...t
1503
- })
1504
- );
1505
- }
1506
- }));
1507
- }), f && (p !== void 0 && s && n.setNodeMarkup(p, void 0, {
1508
- ...f.attrs,
1509
- ...t
1510
- }), i && f.marks.length && f.marks.forEach((g) => {
1511
- i === g.type && s && n.addMark(
1512
- h,
1513
- m,
1514
- i.create({
1515
- ...g.attrs,
1516
- ...t
1517
- })
1518
- );
1519
- }));
1520
- }), c;
1521
- }, Er = (e, t = {}) => ({ state: n, dispatch: r }) => {
1522
- const s = T(e, n.schema);
1523
- return Be(s, t)(n, r);
1524
- }, Tr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1525
- const s = T(e, n.schema);
1526
- return Ke(s, t)(n, r);
1527
- }, Ar = class {
1528
- constructor() {
1529
- this.callbacks = {};
1530
- }
1531
- on(e, t) {
1532
- return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
1533
- }
1534
- emit(e, ...t) {
1535
- const n = this.callbacks[e];
1536
- return n && n.forEach((r) => r.apply(this, t)), this;
1537
- }
1538
- off(e, t) {
1539
- const n = this.callbacks[e];
1540
- return n && (t ? this.callbacks[e] = n.filter((r) => r !== t) : delete this.callbacks[e]), this;
1541
- }
1542
- once(e, t) {
1543
- const n = (...r) => {
1544
- this.off(e, n), t.apply(this, r);
1545
- };
1546
- return this.on(e, n);
1547
- }
1548
- removeAllListeners() {
1549
- this.callbacks = {};
1550
- }
1551
- }, at = class {
1552
- constructor(e) {
1553
- var t;
1554
- this.find = e.find, this.handler = e.handler, this.undoable = (t = e.undoable) != null ? t : !0;
1555
- }
1556
- }, Cr = (e, t) => {
1557
- if (yt(t))
1558
- return t.exec(e);
1559
- const n = t(e);
1560
- if (!n)
1561
- return null;
1562
- const r = [n.text];
1563
- return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
1564
- };
1565
- function J(e) {
1566
- var t;
1567
- const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: c } = n;
1568
- if (c.composing)
1569
- return !1;
1570
- const l = c.state.doc.resolve(r);
1571
- if (
1572
- // check for code node
1573
- l.parent.type.spec.code || (t = l.nodeBefore || l.nodeAfter) != null && t.marks.find((p) => p.type.spec.code)
1574
- )
1575
- return !1;
1576
- let u = !1;
1577
- const d = nr(l) + o;
1578
- return i.forEach((p) => {
1579
- if (u)
1580
- return;
1581
- const f = Cr(d, p.find);
1582
- if (!f)
1583
- return;
1584
- const h = c.state.tr, m = rt({
1585
- state: c.state,
1586
- transaction: h
1587
- }), g = {
1588
- from: r - (f[0].length - o.length),
1589
- to: s
1590
- }, { commands: v, chain: b, can: k } = new st({
1591
- editor: n,
1592
- state: m
1593
- });
1594
- p.handler({
1595
- state: m,
1596
- range: g,
1597
- match: f,
1598
- commands: v,
1599
- chain: b,
1600
- can: k
1601
- }) === null || !h.steps.length || (p.undoable && h.setMeta(a, {
1602
- transform: h,
1603
- from: r,
1604
- to: s,
1605
- text: o
1606
- }), c.dispatch(h), u = !0);
1607
- }), u;
1608
- }
1609
- function Pr(e) {
1610
- const { editor: t, rules: n } = e, r = new $({
1611
- state: {
1612
- init() {
1613
- return null;
1614
- },
1615
- apply(s, o, i) {
1616
- const a = s.getMeta(r);
1617
- if (a)
1618
- return a;
1619
- const c = s.getMeta("applyInputRules");
1620
- return !!c && setTimeout(() => {
1621
- let { text: u } = c;
1622
- typeof u == "string" ? u = u : u = kt(D.from(u), i.schema);
1623
- const { from: d } = c, p = d + u.length;
1624
- J({
1625
- editor: t,
1626
- from: d,
1627
- to: p,
1628
- text: u,
1629
- rules: n,
1630
- plugin: r
1631
- });
1632
- }), s.selectionSet || s.docChanged ? null : o;
1633
- }
1634
- },
1635
- props: {
1636
- handleTextInput(s, o, i, a) {
1637
- return J({
1638
- editor: t,
1639
- from: o,
1640
- to: i,
1641
- text: a,
1642
- rules: n,
1643
- plugin: r
1644
- });
1645
- },
1646
- handleDOMEvents: {
1647
- compositionend: (s) => (setTimeout(() => {
1648
- const { $cursor: o } = s.state.selection;
1649
- o && J({
1650
- editor: t,
1651
- from: o.pos,
1652
- to: o.pos,
1653
- text: "",
1654
- rules: n,
1655
- plugin: r
1656
- });
1657
- }), !1)
1658
- },
1659
- // add support for input rules to trigger on enter
1660
- // this is useful for example for code blocks
1661
- handleKeyDown(s, o) {
1662
- if (o.key !== "Enter")
1663
- return !1;
1664
- const { $cursor: i } = s.state.selection;
1665
- return i ? J({
1666
- editor: t,
1667
- from: i.pos,
1668
- to: i.pos,
1669
- text: `
1670
- `,
1671
- rules: n,
1672
- plugin: r
1673
- }) : !1;
1674
- }
1675
- },
1676
- // @ts-ignore
1677
- isInputRules: !0
1678
- });
1679
- return r;
1680
- }
1681
- function $r(e) {
1682
- return Object.prototype.toString.call(e).slice(8, -1);
1683
- }
1684
- function X(e) {
1685
- return $r(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1686
- }
1687
- function te(e, t) {
1688
- const n = { ...e };
1689
- return X(e) && X(t) && Object.keys(t).forEach((r) => {
1690
- X(t[r]) && X(e[r]) ? n[r] = te(e[r], t[r]) : n[r] = t[r];
1691
- }), n;
1692
- }
1693
- var xt = class {
1694
- constructor(e = {}) {
1695
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
1696
- name: this.name
1697
- }, this.config = {
1698
- ...this.config,
1699
- ...e
1700
- }, this.name = this.config.name;
1701
- }
1702
- get options() {
1703
- return {
1704
- ...x(
1705
- y(this, "addOptions", {
1706
- name: this.name
1707
- })
1708
- ) || {}
1709
- };
1710
- }
1711
- get storage() {
1712
- return {
1713
- ...x(
1714
- y(this, "addStorage", {
1715
- name: this.name,
1716
- options: this.options
1717
- })
1718
- ) || {}
1719
- };
1720
- }
1721
- configure(e = {}) {
1722
- const t = this.extend({
1723
- ...this.config,
1724
- addOptions: () => te(this.options, e)
1725
- });
1726
- return t.name = this.name, t.parent = this.parent, t;
1727
- }
1728
- extend(e = {}) {
1729
- const t = new this.constructor({ ...this.config, ...e });
1730
- return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
1731
- }
1732
- }, Nr = class ee extends xt {
1733
- constructor() {
1734
- super(...arguments), this.type = "mark";
1735
- }
1736
- /**
1737
- * Create a new Mark instance
1738
- * @param config - Mark configuration object or a function that returns a configuration object
1739
- */
1740
- static create(t = {}) {
1741
- const n = typeof t == "function" ? t() : t;
1742
- return new ee(n);
1743
- }
1744
- static handleExit({ editor: t, mark: n }) {
1745
- const { tr: r } = t.state, s = t.state.selection.$from;
1746
- if (s.pos === s.end()) {
1747
- const i = s.marks();
1748
- if (!!!i.find((l) => l?.type.name === n.name))
1749
- return !1;
1750
- const c = i.find((l) => l?.type.name === n.name);
1751
- return c && r.removeStoredMark(c), r.insertText(" ", s.pos), t.view.dispatch(r), !0;
1752
- }
1753
- return !1;
1754
- }
1755
- configure(t) {
1756
- return super.configure(t);
1757
- }
1758
- extend(t) {
1759
- const n = typeof t == "function" ? t() : t;
1760
- return super.extend(n);
1761
- }
1762
- };
1763
- function Rr(e) {
1764
- return typeof e == "number";
1765
- }
1766
- var zr = class {
1767
- constructor(e) {
1768
- this.find = e.find, this.handler = e.handler;
1769
- }
1770
- }, Ir = (e, t, n) => {
1771
- if (yt(t))
1772
- return [...e.matchAll(t)];
1773
- const r = t(e, n);
1774
- return r ? r.map((s) => {
1775
- const o = [s.text];
1776
- return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
1777
- }) : [];
1778
- };
1779
- function Dr(e) {
1780
- const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new st({
1781
- editor: t,
1782
- state: n
1783
- }), d = [];
1784
- return n.doc.nodesBetween(r, s, (f, h) => {
1785
- var m, g, v, b, k;
1786
- if ((g = (m = f.type) == null ? void 0 : m.spec) != null && g.code || !(f.isText || f.isTextblock || f.isInline))
1787
- return;
1788
- const M = (k = (b = (v = f.content) == null ? void 0 : v.size) != null ? b : f.nodeSize) != null ? k : 0, w = Math.max(r, h), S = Math.min(s, h + M);
1789
- if (w >= S)
1790
- return;
1791
- const E = f.isText ? f.text || "" : f.textBetween(w - h, S - h, void 0, "");
1792
- Ir(E, o.find, i).forEach((C) => {
1793
- if (C.index === void 0)
1794
- return;
1795
- const _ = w + C.index + 1, lt = _ + C[0].length, K = {
1796
- from: n.tr.mapping.map(_),
1797
- to: n.tr.mapping.map(lt)
1798
- }, dt = o.handler({
1799
- state: n,
1800
- range: K,
1801
- match: C,
1802
- commands: c,
1803
- chain: l,
1804
- can: u,
1805
- pasteEvent: i,
1806
- dropEvent: a
1807
- });
1808
- d.push(dt);
1809
- });
1810
- }), d.every((f) => f !== null);
1811
- }
1812
- var Y = null, Or = (e) => {
1813
- var t;
1814
- const n = new ClipboardEvent("paste", {
1815
- clipboardData: new DataTransfer()
1816
- });
1817
- return (t = n.clipboardData) == null || t.setData("text/html", e), n;
1818
- };
1819
- function _r(e) {
1820
- const { editor: t, rules: n } = e;
1821
- let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
1822
- try {
1823
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1824
- } catch {
1825
- a = null;
1826
- }
1827
- const c = ({
1828
- state: u,
1829
- from: d,
1830
- to: p,
1831
- rule: f,
1832
- pasteEvt: h
1833
- }) => {
1834
- const m = u.tr, g = rt({
1835
- state: u,
1836
- transaction: m
1837
- });
1838
- if (!(!Dr({
1839
- editor: t,
1840
- state: g,
1841
- from: Math.max(d - 1, 0),
1842
- to: p.b - 1,
1843
- rule: f,
1844
- pasteEvent: h,
1845
- dropEvent: a
1846
- }) || !m.steps.length)) {
1847
- try {
1848
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1849
- } catch {
1850
- a = null;
1851
- }
1852
- return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
1853
- }
1854
- };
1855
- return n.map((u) => new $({
1856
- // we register a global drag handler to track the current drag source element
1857
- view(d) {
1858
- const p = (h) => {
1859
- var m;
1860
- r = (m = d.dom.parentElement) != null && m.contains(h.target) ? d.dom.parentElement : null, r && (Y = t);
1861
- }, f = () => {
1862
- Y && (Y = null);
1863
- };
1864
- return window.addEventListener("dragstart", p), window.addEventListener("dragend", f), {
1865
- destroy() {
1866
- window.removeEventListener("dragstart", p), window.removeEventListener("dragend", f);
1867
- }
1868
- };
1869
- },
1870
- props: {
1871
- handleDOMEvents: {
1872
- drop: (d, p) => {
1873
- if (o = r === d.dom.parentElement, a = p, !o) {
1874
- const f = Y;
1875
- f?.isEditable && setTimeout(() => {
1876
- const h = f.state.selection;
1877
- h && f.commands.deleteRange({ from: h.from, to: h.to });
1878
- }, 10);
1879
- }
1880
- return !1;
1881
- },
1882
- paste: (d, p) => {
1883
- var f;
1884
- const h = (f = p.clipboardData) == null ? void 0 : f.getData("text/html");
1885
- return i = p, s = !!h?.includes("data-pm-slice"), !1;
1886
- }
1887
- }
1888
- },
1889
- appendTransaction: (d, p, f) => {
1890
- const h = d[0], m = h.getMeta("uiEvent") === "paste" && !s, g = h.getMeta("uiEvent") === "drop" && !o, v = h.getMeta("applyPasteRules"), b = !!v;
1891
- if (!m && !g && !b)
1892
- return;
1893
- if (b) {
1894
- let { text: w } = v;
1895
- typeof w == "string" ? w = w : w = kt(D.from(w), f.schema);
1896
- const { from: S } = v, E = S + w.length, A = Or(w);
1897
- return c({
1898
- rule: u,
1899
- state: f,
1900
- from: S,
1901
- to: { b: E },
1902
- pasteEvt: A
1903
- });
1904
- }
1905
- const k = p.doc.content.findDiffStart(f.doc.content), M = p.doc.content.findDiffEnd(f.doc.content);
1906
- if (!(!Rr(k) || !M || k === M.b))
1907
- return c({
1908
- rule: u,
1909
- state: f,
1910
- from: k,
1911
- to: M,
1912
- pasteEvt: i
1913
- });
1914
- }
1915
- }));
1916
- }
1917
- var ct = class {
1918
- constructor(e, t) {
1919
- this.splittableMarks = [], this.editor = t, this.baseExtensions = e, this.extensions = Jt(e), this.schema = Jn(this.extensions, t), this.setupExtensions();
1920
- }
1921
- /**
1922
- * Get all commands from the extensions.
1923
- * @returns An object with all commands where the key is the command name and the value is the command function
1924
- */
1925
- get commands() {
1926
- return this.extensions.reduce((e, t) => {
1927
- const n = {
1928
- name: t.name,
1929
- options: t.options,
1930
- storage: this.editor.extensionStorage[t.name],
1931
- editor: this.editor,
1932
- type: H(t.name, this.schema)
1933
- }, r = y(t, "addCommands", n);
1934
- return r ? {
1935
- ...e,
1936
- ...r()
1937
- } : e;
1938
- }, {});
1939
- }
1940
- /**
1941
- * Get all registered Prosemirror plugins from the extensions.
1942
- * @returns An array of Prosemirror plugins
1943
- */
1944
- get plugins() {
1945
- const { editor: e } = this;
1946
- return V([...this.extensions].reverse()).flatMap((r) => {
1947
- const s = {
1948
- name: r.name,
1949
- options: r.options,
1950
- storage: this.editor.extensionStorage[r.name],
1951
- editor: e,
1952
- type: H(r.name, this.schema)
1953
- }, o = [], i = y(
1954
- r,
1955
- "addKeyboardShortcuts",
1956
- s
1957
- );
1958
- let a = {};
1959
- if (r.type === "mark" && y(r, "exitable", s) && (a.ArrowRight = () => Nr.handleExit({ editor: e, mark: r })), i) {
1960
- const p = Object.fromEntries(
1961
- Object.entries(i()).map(([f, h]) => [f, () => h({ editor: e })])
1962
- );
1963
- a = { ...a, ...p };
1964
- }
1965
- const c = Je(a);
1966
- o.push(c);
1967
- const l = y(r, "addInputRules", s);
1968
- if (It(r, e.options.enableInputRules) && l) {
1969
- const p = l();
1970
- if (p && p.length) {
1971
- const f = Pr({
1972
- editor: e,
1973
- rules: p
1974
- }), h = Array.isArray(f) ? f : [f];
1975
- o.push(...h);
1976
- }
1977
- }
1978
- const u = y(r, "addPasteRules", s);
1979
- if (It(r, e.options.enablePasteRules) && u) {
1980
- const p = u();
1981
- if (p && p.length) {
1982
- const f = _r({ editor: e, rules: p });
1983
- o.push(...f);
1984
- }
1985
- }
1986
- const d = y(
1987
- r,
1988
- "addProseMirrorPlugins",
1989
- s
1990
- );
1991
- if (d) {
1992
- const p = d();
1993
- o.push(...p);
1994
- }
1995
- return o;
1996
- });
1997
- }
1998
- /**
1999
- * Get all attributes from the extensions.
2000
- * @returns An array of attributes
2001
- */
2002
- get attributes() {
2003
- return qt(this.extensions);
2004
- }
2005
- /**
2006
- * Get all node views from the extensions.
2007
- * @returns An object with all node views where the key is the node name and the value is the node view function
2008
- */
2009
- get nodeViews() {
2010
- const { editor: e } = this, { nodeExtensions: t } = L(this.extensions);
2011
- return Object.fromEntries(
2012
- t.filter((n) => !!y(n, "addNodeView")).map((n) => {
2013
- const r = this.attributes.filter((c) => c.type === n.name), s = {
2014
- name: n.name,
2015
- options: n.options,
2016
- storage: this.editor.extensionStorage[n.name],
2017
- editor: e,
2018
- type: T(n.name, this.schema)
2019
- }, o = y(n, "addNodeView", s);
2020
- if (!o)
2021
- return [];
2022
- const i = o();
2023
- if (!i)
2024
- return [];
2025
- const a = (c, l, u, d, p) => {
2026
- const f = et(c, r);
2027
- return i({
2028
- // pass-through
2029
- node: c,
2030
- view: l,
2031
- getPos: u,
2032
- decorations: d,
2033
- innerDecorations: p,
2034
- // tiptap-specific
2035
- editor: e,
2036
- extension: n,
2037
- HTMLAttributes: f
2038
- });
2039
- };
2040
- return [n.name, a];
2041
- })
2042
- );
2043
- }
2044
- /**
2045
- * Get the composed dispatchTransaction function from all extensions.
2046
- * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
2047
- * @returns A composed dispatch function
2048
- */
2049
- dispatchTransaction(e) {
2050
- const { editor: t } = this;
2051
- return V([...this.extensions].reverse()).reduceRight((r, s) => {
2052
- const o = {
2053
- name: s.name,
2054
- options: s.options,
2055
- storage: this.editor.extensionStorage[s.name],
2056
- editor: t,
2057
- type: H(s.name, this.schema)
2058
- }, i = y(
2059
- s,
2060
- "dispatchTransaction",
2061
- o
2062
- );
2063
- return i ? (a) => {
2064
- i.call(o, { transaction: a, next: r });
2065
- } : r;
2066
- }, e);
2067
- }
2068
- /**
2069
- * Get the composed transformPastedHTML function from all extensions.
2070
- * @param baseTransform The base transform function (e.g. from the editor props)
2071
- * @returns A composed transform function that chains all extension transforms
2072
- */
2073
- transformPastedHTML(e) {
2074
- const { editor: t } = this;
2075
- return V([...this.extensions]).reduce(
2076
- (r, s) => {
2077
- const o = {
2078
- name: s.name,
2079
- options: s.options,
2080
- storage: this.editor.extensionStorage[s.name],
2081
- editor: t,
2082
- type: H(s.name, this.schema)
2083
- }, i = y(
2084
- s,
2085
- "transformPastedHTML",
2086
- o
2087
- );
2088
- return i ? (a, c) => {
2089
- const l = r(a, c);
2090
- return i.call(o, l);
2091
- } : r;
2092
- },
2093
- e || ((r) => r)
2094
- );
2095
- }
2096
- get markViews() {
2097
- const { editor: e } = this, { markExtensions: t } = L(this.extensions);
2098
- return Object.fromEntries(
2099
- t.filter((n) => !!y(n, "addMarkView")).map((n) => {
2100
- const r = this.attributes.filter((a) => a.type === n.name), s = {
2101
- name: n.name,
2102
- options: n.options,
2103
- storage: this.editor.extensionStorage[n.name],
2104
- editor: e,
2105
- type: z(n.name, this.schema)
2106
- }, o = y(n, "addMarkView", s);
2107
- if (!o)
2108
- return [];
2109
- const i = (a, c, l) => {
2110
- const u = et(a, r);
2111
- return o()({
2112
- // pass-through
2113
- mark: a,
2114
- view: c,
2115
- inline: l,
2116
- // tiptap-specific
2117
- editor: e,
2118
- extension: n,
2119
- HTMLAttributes: u,
2120
- updateAttributes: (d) => {
2121
- Qr(a, e, d);
2122
- }
2123
- });
2124
- };
2125
- return [n.name, i];
2126
- })
2127
- );
2128
- }
2129
- /**
2130
- * Go through all extensions, create extension storages & setup marks
2131
- * & bind editor event listener.
2132
- */
2133
- setupExtensions() {
2134
- const e = this.extensions;
2135
- this.editor.extensionStorage = Object.fromEntries(
2136
- e.map((t) => [t.name, t.storage])
2137
- ), e.forEach((t) => {
2138
- var n;
2139
- const r = {
2140
- name: t.name,
2141
- options: t.options,
2142
- storage: this.editor.extensionStorage[t.name],
2143
- editor: this.editor,
2144
- type: H(t.name, this.schema)
2145
- };
2146
- t.type === "mark" && ((n = x(y(t, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(t.name);
2147
- const s = y(t, "onBeforeCreate", r), o = y(t, "onCreate", r), i = y(t, "onUpdate", r), a = y(
2148
- t,
2149
- "onSelectionUpdate",
2150
- r
2151
- ), c = y(t, "onTransaction", r), l = y(t, "onFocus", r), u = y(t, "onBlur", r), d = y(t, "onDestroy", r);
2152
- s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), c && this.editor.on("transaction", c), l && this.editor.on("focus", l), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
2153
- });
2154
- }
2155
- };
2156
- ct.resolve = Jt;
2157
- ct.sort = V;
2158
- ct.flatten = wt;
2159
- var Br = {};
2160
- vt(Br, {
2161
- ClipboardTextSerializer: () => re,
2162
- Commands: () => se,
2163
- Delete: () => oe,
2164
- Drop: () => ie,
2165
- Editable: () => ae,
2166
- FocusEvents: () => le,
2167
- Keymap: () => de,
2168
- Paste: () => ue,
2169
- Tabindex: () => fe,
2170
- TextDirection: () => pe,
2171
- focusEventsPluginKey: () => ce
2172
- });
2173
- var N = class ne extends xt {
2174
- constructor() {
2175
- super(...arguments), this.type = "extension";
2176
- }
2177
- /**
2178
- * Create a new Extension instance
2179
- * @param config - Extension configuration object or a function that returns a configuration object
2180
- */
2181
- static create(t = {}) {
2182
- const n = typeof t == "function" ? t() : t;
2183
- return new ne(n);
2184
- }
2185
- configure(t) {
2186
- return super.configure(t);
2187
- }
2188
- extend(t) {
2189
- const n = typeof t == "function" ? t() : t;
2190
- return super.extend(n);
2191
- }
2192
- }, re = N.create({
2193
- name: "clipboardTextSerializer",
2194
- addOptions() {
2195
- return {
2196
- blockSeparator: void 0
2197
- };
2198
- },
2199
- addProseMirrorPlugins() {
2200
- return [
2201
- new $({
2202
- key: new O("clipboardTextSerializer"),
2203
- props: {
2204
- clipboardTextSerializer: () => {
2205
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c = Yt(n);
2206
- return Xt(r, { from: i, to: a }, {
2207
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
2208
- textSerializers: c
2209
- });
2210
- }
2211
- }
2212
- })
2213
- ];
2214
- }
2215
- }), se = N.create({
2216
- name: "commands",
2217
- addCommands() {
2218
- return {
2219
- ...jt
2220
- };
2221
- }
2222
- }), oe = N.create({
2223
- name: "delete",
2224
- onUpdate({ transaction: e, appendedTransactions: t }) {
2225
- var n, r, s;
2226
- const o = () => {
2227
- var i, a, c, l;
2228
- if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, e)) != null ? l : e.getMeta("y-sync$"))
2229
- return;
2230
- const u = Hn(e.before, [e, ...t]);
2231
- er(u).forEach((f) => {
2232
- u.mapping.mapResult(f.oldRange.from).deletedAfter && u.mapping.mapResult(f.oldRange.to).deletedBefore && u.before.nodesBetween(f.oldRange.from, f.oldRange.to, (h, m) => {
2233
- const g = m + h.nodeSize - 2, v = f.oldRange.from <= m && g <= f.oldRange.to;
2234
- this.editor.emit("delete", {
2235
- type: "node",
2236
- node: h,
2237
- from: m,
2238
- to: g,
2239
- newFrom: u.mapping.map(m),
2240
- newTo: u.mapping.map(g),
2241
- deletedRange: f.oldRange,
2242
- newRange: f.newRange,
2243
- partial: !v,
2244
- editor: this.editor,
2245
- transaction: e,
2246
- combinedTransform: u
2247
- });
2248
- });
2249
- });
2250
- const p = u.mapping;
2251
- u.steps.forEach((f, h) => {
2252
- var m, g;
2253
- if (f instanceof ve) {
2254
- const v = p.slice(h).map(f.from, -1), b = p.slice(h).map(f.to), k = p.invert().map(v, -1), M = p.invert().map(b), w = (m = u.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((E) => E.eq(f.mark)), S = (g = u.doc.nodeAt(b)) == null ? void 0 : g.marks.some((E) => E.eq(f.mark));
2255
- this.editor.emit("delete", {
2256
- type: "mark",
2257
- mark: f.mark,
2258
- from: f.from,
2259
- to: f.to,
2260
- deletedRange: {
2261
- from: k,
2262
- to: M
2263
- },
2264
- newRange: {
2265
- from: v,
2266
- to: b
2267
- },
2268
- partial: !!(S || w),
2269
- editor: this.editor,
2270
- transaction: e,
2271
- combinedTransform: u
2272
- });
2273
- }
2274
- });
2275
- };
2276
- (s = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || s ? setTimeout(o, 0) : o();
2277
- }
2278
- }), ie = N.create({
2279
- name: "drop",
2280
- addProseMirrorPlugins() {
2281
- return [
2282
- new $({
2283
- key: new O("tiptapDrop"),
2284
- props: {
2285
- handleDrop: (e, t, n, r) => {
2286
- this.editor.emit("drop", {
2287
- editor: this.editor,
2288
- event: t,
2289
- slice: n,
2290
- moved: r
2291
- });
2292
- }
2293
- }
2294
- })
2295
- ];
2296
- }
2297
- }), ae = N.create({
2298
- name: "editable",
2299
- addProseMirrorPlugins() {
2300
- return [
2301
- new $({
2302
- key: new O("editable"),
2303
- props: {
2304
- editable: () => this.editor.options.editable
2305
- }
2306
- })
2307
- ];
2308
- }
2309
- }), ce = new O("focusEvents"), le = N.create({
2310
- name: "focusEvents",
2311
- addProseMirrorPlugins() {
2312
- const { editor: e } = this;
2313
- return [
2314
- new $({
2315
- key: ce,
2316
- props: {
2317
- handleDOMEvents: {
2318
- focus: (t, n) => {
2319
- e.isFocused = !0;
2320
- const r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2321
- return t.dispatch(r), !1;
2322
- },
2323
- blur: (t, n) => {
2324
- e.isFocused = !1;
2325
- const r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2326
- return t.dispatch(r), !1;
2327
- }
2328
- }
2329
- }
2330
- })
2331
- ];
2332
- }
2333
- }), de = N.create({
2334
- name: "keymap",
2335
- addKeyboardShortcuts() {
2336
- const e = () => this.editor.commands.first(({ commands: i }) => [
2337
- () => i.undoInputRule(),
2338
- // maybe convert first text block node to default node
2339
- () => i.command(({ tr: a }) => {
2340
- const { selection: c, doc: l } = a, { empty: u, $anchor: d } = c, { pos: p, parent: f } = d, h = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, m = h.parent.type.spec.isolating, g = d.pos - d.parentOffset, v = m && h.parent.childCount === 1 ? g === d.pos : j.atStart(l).from === p;
2341
- return !u || !f.type.isTextblock || f.textContent.length || !v || v && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
2342
- }),
2343
- () => i.deleteSelection(),
2344
- () => i.joinBackward(),
2345
- () => i.selectNodeBackward()
2346
- ]), t = () => this.editor.commands.first(({ commands: i }) => [
2347
- () => i.deleteSelection(),
2348
- () => i.deleteCurrentNode(),
2349
- () => i.joinForward(),
2350
- () => i.selectNodeForward()
2351
- ]), r = {
2352
- Enter: () => this.editor.commands.first(({ commands: i }) => [
2353
- () => i.newlineInCode(),
2354
- () => i.createParagraphNear(),
2355
- () => i.liftEmptyBlock(),
2356
- () => i.splitBlock()
2357
- ]),
2358
- "Mod-Enter": () => this.editor.commands.exitCode(),
2359
- Backspace: e,
2360
- "Mod-Backspace": e,
2361
- "Shift-Backspace": e,
2362
- Delete: t,
2363
- "Mod-Delete": t,
2364
- "Mod-a": () => this.editor.commands.selectAll()
2365
- }, s = {
2366
- ...r
2367
- }, o = {
2368
- ...r,
2369
- "Ctrl-h": e,
2370
- "Alt-Backspace": e,
2371
- "Ctrl-d": t,
2372
- "Ctrl-Alt-Backspace": t,
2373
- "Alt-Delete": t,
2374
- "Alt-d": t,
2375
- "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2376
- "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2377
- };
2378
- return tt() || Wt() ? o : s;
2379
- },
2380
- addProseMirrorPlugins() {
2381
- return [
2382
- // With this plugin we check if the whole document was selected and deleted.
2383
- // In this case we will additionally call `clearNodes()` to convert e.g. a heading
2384
- // to a paragraph if necessary.
2385
- // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
2386
- // with many other commands.
2387
- new $({
2388
- key: new O("clearDocument"),
2389
- appendTransaction: (e, t, n) => {
2390
- if (e.some((m) => m.getMeta("composition")))
2391
- return;
2392
- const r = e.some((m) => m.docChanged) && !t.doc.eq(n.doc), s = e.some((m) => m.getMeta("preventClearDocument"));
2393
- if (!r || s)
2394
- return;
2395
- const { empty: o, from: i, to: a } = t.selection, c = j.atStart(t.doc).from, l = j.atEnd(t.doc).to;
2396
- if (o || !(i === c && a === l) || !Mt(n.doc))
2397
- return;
2398
- const p = n.tr, f = rt({
2399
- state: n,
2400
- transaction: p
2401
- }), { commands: h } = new st({
2402
- editor: this.editor,
2403
- state: f
2404
- });
2405
- if (h.clearNodes(), !!p.steps.length)
2406
- return p;
2407
- }
2408
- })
2409
- ];
2410
- }
2411
- }), ue = N.create({
2412
- name: "paste",
2413
- addProseMirrorPlugins() {
2414
- return [
2415
- new $({
2416
- key: new O("tiptapPaste"),
2417
- props: {
2418
- handlePaste: (e, t, n) => {
2419
- this.editor.emit("paste", {
2420
- editor: this.editor,
2421
- event: t,
2422
- slice: n
2423
- });
2424
- }
2425
- }
2426
- })
2427
- ];
2428
- }
2429
- }), fe = N.create({
2430
- name: "tabindex",
2431
- addProseMirrorPlugins() {
2432
- return [
2433
- new $({
2434
- key: new O("tabindex"),
2435
- props: {
2436
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
2437
- }
2438
- })
2439
- ];
2440
- }
2441
- }), pe = N.create({
2442
- name: "textDirection",
2443
- addOptions() {
2444
- return {
2445
- direction: void 0
2446
- };
2447
- },
2448
- addGlobalAttributes() {
2449
- if (!this.options.direction)
2450
- return [];
2451
- const { nodeExtensions: e } = L(this.extensions);
2452
- return [
2453
- {
2454
- types: e.filter((t) => t.name !== "text").map((t) => t.name),
2455
- attributes: {
2456
- dir: {
2457
- default: this.options.direction,
2458
- parseHTML: (t) => {
2459
- const n = t.getAttribute("dir");
2460
- return n && (n === "ltr" || n === "rtl" || n === "auto") ? n : this.options.direction;
2461
- },
2462
- renderHTML: (t) => t.dir ? {
2463
- dir: t.dir
2464
- } : {}
2465
- }
2466
- }
2467
- }
2468
- ];
2469
- },
2470
- addProseMirrorPlugins() {
2471
- return [
2472
- new $({
2473
- key: new O("textDirection"),
2474
- props: {
2475
- attributes: () => {
2476
- const e = this.options.direction;
2477
- return e ? {
2478
- dir: e
2479
- } : {};
2480
- }
2481
- }
2482
- })
2483
- ];
2484
- }
2485
- }), jr = class F {
2486
- constructor(t, n, r = !1, s = null) {
2487
- this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = n, this.currentNode = s;
2488
- }
2489
- get name() {
2490
- return this.node.type.name;
2491
- }
2492
- get node() {
2493
- return this.currentNode || this.resolvedPos.node();
2494
- }
2495
- get element() {
2496
- return this.editor.view.domAtPos(this.pos).node;
2497
- }
2498
- get depth() {
2499
- var t;
2500
- return (t = this.actualDepth) != null ? t : this.resolvedPos.depth;
2501
- }
2502
- get pos() {
2503
- return this.resolvedPos.pos;
2504
- }
2505
- get content() {
2506
- return this.node.content;
2507
- }
2508
- set content(t) {
2509
- let n = this.from, r = this.to;
2510
- if (this.isBlock) {
2511
- if (this.content.size === 0) {
2512
- console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
2513
- return;
2514
- }
2515
- n = this.from + 1, r = this.to - 1;
2516
- }
2517
- this.editor.commands.insertContentAt({ from: n, to: r }, t);
2518
- }
2519
- get attributes() {
2520
- return this.node.attrs;
2521
- }
2522
- get textContent() {
2523
- return this.node.textContent;
2524
- }
2525
- get size() {
2526
- return this.node.nodeSize;
2527
- }
2528
- get from() {
2529
- return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
2530
- }
2531
- get range() {
2532
- return {
2533
- from: this.from,
2534
- to: this.to
2535
- };
2536
- }
2537
- get to() {
2538
- return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
2539
- }
2540
- get parent() {
2541
- if (this.depth === 0)
2542
- return null;
2543
- const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2544
- return new F(n, this.editor);
2545
- }
2546
- get before() {
2547
- let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2548
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new F(t, this.editor);
2549
- }
2550
- get after() {
2551
- let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2552
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new F(t, this.editor);
2553
- }
2554
- get children() {
2555
- const t = [];
2556
- return this.node.content.forEach((n, r) => {
2557
- const s = n.isBlock && !n.isTextblock, o = n.isAtom && !n.isText, i = n.isInline, a = this.pos + r + (o ? 0 : 1);
2558
- if (a < 0 || a > this.resolvedPos.doc.nodeSize - 2)
2559
- return;
2560
- const c = this.resolvedPos.doc.resolve(a);
2561
- if (!s && !i && c.depth <= this.depth)
2562
- return;
2563
- const l = new F(c, this.editor, s, s || i ? n : null);
2564
- s && (l.actualDepth = this.depth + 1), t.push(l);
2565
- }), t;
2566
- }
2567
- get firstChild() {
2568
- return this.children[0] || null;
2569
- }
2570
- get lastChild() {
2571
- const t = this.children;
2572
- return t[t.length - 1] || null;
2573
- }
2574
- closest(t, n = {}) {
2575
- let r = null, s = this.parent;
2576
- for (; s && !r; ) {
2577
- if (s.node.type.name === t)
2578
- if (Object.keys(n).length > 0) {
2579
- const o = s.node.attrs, i = Object.keys(n);
2580
- for (let a = 0; a < i.length; a += 1) {
2581
- const c = i[a];
2582
- if (o[c] !== n[c])
2583
- break;
2584
- }
2585
- } else
2586
- r = s;
2587
- s = s.parent;
2588
- }
2589
- return r;
2590
- }
2591
- querySelector(t, n = {}) {
2592
- return this.querySelectorAll(t, n, !0)[0] || null;
2593
- }
2594
- querySelectorAll(t, n = {}, r = !1) {
2595
- let s = [];
2596
- if (!this.children || this.children.length === 0)
2597
- return s;
2598
- const o = Object.keys(n);
2599
- return this.children.forEach((i) => {
2600
- r && s.length > 0 || (i.node.type.name === t && o.every((c) => n[c] === i.node.attrs[c]) && s.push(i), !(r && s.length > 0) && (s = s.concat(i.querySelectorAll(t, n, r))));
2601
- }), s;
2602
- }
2603
- setAttribute(t) {
2604
- const { tr: n } = this.editor.state;
2605
- n.setNodeMarkup(this.from, void 0, {
2606
- ...this.node.attrs,
2607
- ...t
2608
- }), this.editor.view.dispatch(n);
2609
- }
2610
- }, Lr = `.ProseMirror {
2611
- position: relative;
2612
- }
2613
-
2614
- .ProseMirror {
2615
- word-wrap: break-word;
2616
- white-space: pre-wrap;
2617
- white-space: break-spaces;
2618
- -webkit-font-variant-ligatures: none;
2619
- font-variant-ligatures: none;
2620
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
2621
- }
2622
-
2623
- .ProseMirror [contenteditable="false"] {
2624
- white-space: normal;
2625
- }
2626
-
2627
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
2628
- white-space: pre-wrap;
2629
- }
2630
-
2631
- .ProseMirror pre {
2632
- white-space: pre-wrap;
2633
- }
2634
-
2635
- img.ProseMirror-separator {
2636
- display: inline !important;
2637
- border: none !important;
2638
- margin: 0 !important;
2639
- width: 0 !important;
2640
- height: 0 !important;
2641
- }
2642
-
2643
- .ProseMirror-gapcursor {
2644
- display: none;
2645
- pointer-events: none;
2646
- position: absolute;
2647
- margin: 0;
2648
- }
2649
-
2650
- .ProseMirror-gapcursor:after {
2651
- content: "";
2652
- display: block;
2653
- position: absolute;
2654
- top: -2px;
2655
- width: 20px;
2656
- border-top: 1px solid black;
2657
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
2658
- }
2659
-
2660
- @keyframes ProseMirror-cursor-blink {
2661
- to {
2662
- visibility: hidden;
2663
- }
2664
- }
2665
-
2666
- .ProseMirror-hideselection *::selection {
2667
- background: transparent;
2668
- }
2669
-
2670
- .ProseMirror-hideselection *::-moz-selection {
2671
- background: transparent;
2672
- }
2673
-
2674
- .ProseMirror-hideselection * {
2675
- caret-color: transparent;
2676
- }
2677
-
2678
- .ProseMirror-focused .ProseMirror-gapcursor {
2679
- display: block;
2680
- }`;
2681
- function Hr(e, t, n) {
2682
- const r = document.querySelector("style[data-tiptap-style]");
2683
- if (r !== null)
2684
- return r;
2685
- const s = document.createElement("style");
2686
- return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
2687
- }
2688
- var ds = class extends Ar {
2689
- constructor(t = {}) {
2690
- super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2691
- element: typeof document < "u" ? document.createElement("div") : null,
2692
- content: "",
2693
- injectCSS: !0,
2694
- injectNonce: void 0,
2695
- extensions: [],
2696
- autofocus: !1,
2697
- editable: !0,
2698
- textDirection: void 0,
2699
- editorProps: {},
2700
- parseOptions: {},
2701
- coreExtensionOptions: {},
2702
- enableInputRules: !0,
2703
- enablePasteRules: !0,
2704
- enableCoreExtensions: !0,
2705
- enableContentCheck: !1,
2706
- emitContentError: !1,
2707
- onBeforeCreate: () => null,
2708
- onCreate: () => null,
2709
- onMount: () => null,
2710
- onUnmount: () => null,
2711
- onUpdate: () => null,
2712
- onSelectionUpdate: () => null,
2713
- onTransaction: () => null,
2714
- onFocus: () => null,
2715
- onBlur: () => null,
2716
- onDestroy: () => null,
2717
- onContentError: ({ error: s }) => {
2718
- throw s;
2719
- },
2720
- onPaste: () => null,
2721
- onDrop: () => null,
2722
- onDelete: () => null,
2723
- enableExtensionDispatchTransaction: !0
2724
- }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2725
- getUpdatedPosition: sr,
2726
- createMappablePosition: or
2727
- }, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: s, slice: o, moved: i }) => this.options.onDrop(s, o, i)), this.on("paste", ({ event: s, slice: o }) => this.options.onPaste(s, o)), this.on("delete", this.options.onDelete);
2728
- const n = this.createDoc(), r = Ft(n, this.options.autofocus);
2729
- this.editorState = je.create({
2730
- doc: n,
2731
- schema: this.schema,
2732
- selection: r || void 0
2733
- }), this.options.element && this.mount(this.options.element);
2734
- }
2735
- /**
2736
- * Attach the editor to the DOM, creating a new editor view.
2737
- */
2738
- mount(t) {
2739
- if (typeof document > "u")
2740
- throw new Error(
2741
- "[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment."
2742
- );
2743
- this.createView(t), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2744
- this.isDestroyed || (this.options.autofocus !== !1 && this.options.autofocus !== null && this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2745
- }, 0);
2746
- }
2747
- /**
2748
- * Remove the editor from the DOM, but still allow remounting at a different point in time
2749
- */
2750
- unmount() {
2751
- if (this.editorView) {
2752
- const t = this.editorView.dom;
2753
- t?.editor && delete t.editor, this.editorView.destroy();
2754
- }
2755
- if (this.editorView = null, this.isInitialized = !1, this.css && !document.querySelectorAll(`.${this.className}`).length)
2756
- try {
2757
- typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
2758
- } catch (t) {
2759
- console.warn("Failed to remove CSS element:", t);
2760
- }
2761
- this.css = null, this.emit("unmount", { editor: this });
2762
- }
2763
- /**
2764
- * Returns the editor storage.
2765
- */
2766
- get storage() {
2767
- return this.extensionStorage;
2768
- }
2769
- /**
2770
- * An object of all registered commands.
2771
- */
2772
- get commands() {
2773
- return this.commandManager.commands;
2774
- }
2775
- /**
2776
- * Create a command chain to call multiple commands at once.
2777
- */
2778
- chain() {
2779
- return this.commandManager.chain();
2780
- }
2781
- /**
2782
- * Check if a command or a command chain can be executed. Without executing it.
2783
- */
2784
- can() {
2785
- return this.commandManager.can();
2786
- }
2787
- /**
2788
- * Inject CSS styles.
2789
- */
2790
- injectCSS() {
2791
- this.options.injectCSS && typeof document < "u" && (this.css = Hr(Lr, this.options.injectNonce));
2792
- }
2793
- /**
2794
- * Update editor options.
2795
- *
2796
- * @param options A list of options
2797
- */
2798
- setOptions(t = {}) {
2799
- this.options = {
2800
- ...this.options,
2801
- ...t
2802
- }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
2803
- }
2804
- /**
2805
- * Update editable state of the editor.
2806
- */
2807
- setEditable(t, n = !0) {
2808
- this.setOptions({ editable: t }), n && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2809
- }
2810
- /**
2811
- * Returns whether the editor is editable.
2812
- */
2813
- get isEditable() {
2814
- return this.options.editable && this.view && this.view.editable;
2815
- }
2816
- /**
2817
- * Returns the editor view.
2818
- */
2819
- get view() {
2820
- return this.editorView ? this.editorView : new Proxy(
2821
- {
2822
- state: this.editorState,
2823
- updateState: (t) => {
2824
- this.editorState = t;
2825
- },
2826
- dispatch: (t) => {
2827
- this.dispatchTransaction(t);
2828
- },
2829
- // Stub some commonly accessed properties to prevent errors
2830
- composing: !1,
2831
- dragging: null,
2832
- editable: !0,
2833
- isDestroyed: !1
2834
- },
2835
- {
2836
- get: (t, n) => {
2837
- if (this.editorView)
2838
- return this.editorView[n];
2839
- if (n === "state")
2840
- return this.editorState;
2841
- if (n in t)
2842
- return Reflect.get(t, n);
2843
- throw new Error(
2844
- `[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`
2845
- );
2846
- }
2847
- }
2848
- );
2849
- }
2850
- /**
2851
- * Returns the editor state.
2852
- */
2853
- get state() {
2854
- return this.editorView && (this.editorState = this.view.state), this.editorState;
2855
- }
2856
- /**
2857
- * Register a ProseMirror plugin.
2858
- *
2859
- * @param plugin A ProseMirror plugin
2860
- * @param handlePlugins Control how to merge the plugin into the existing plugins.
2861
- * @returns The new editor state
2862
- */
2863
- registerPlugin(t, n) {
2864
- const r = Kt(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2865
- return this.view.updateState(s), s;
2866
- }
2867
- /**
2868
- * Unregister a ProseMirror plugin.
2869
- *
2870
- * @param nameOrPluginKeyToRemove The plugins name
2871
- * @returns The new editor state or undefined if the editor is destroyed
2872
- */
2873
- unregisterPlugin(t) {
2874
- if (this.isDestroyed)
2875
- return;
2876
- const n = this.state.plugins;
2877
- let r = n;
2878
- if ([].concat(t).forEach((o) => {
2879
- const i = typeof o == "string" ? `${o}$` : o.key;
2880
- r = r.filter((a) => !a.key.startsWith(i));
2881
- }), n.length === r.length)
2882
- return;
2883
- const s = this.state.reconfigure({
2884
- plugins: r
2885
- });
2886
- return this.view.updateState(s), s;
2887
- }
2888
- /**
2889
- * Creates an extension manager.
2890
- */
2891
- createExtensionManager() {
2892
- var t, n;
2893
- const s = [...this.options.enableCoreExtensions ? [
2894
- ae,
2895
- re.configure({
2896
- blockSeparator: (n = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : n.blockSeparator
2897
- }),
2898
- se,
2899
- le,
2900
- de,
2901
- fe,
2902
- ie,
2903
- ue,
2904
- oe,
2905
- pe.configure({
2906
- direction: this.options.textDirection
2907
- })
2908
- ].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o?.type));
2909
- this.extensionManager = new ct(s, this);
2910
- }
2911
- /**
2912
- * Creates an command manager.
2913
- */
2914
- createCommandManager() {
2915
- this.commandManager = new st({
2916
- editor: this
2917
- });
2918
- }
2919
- /**
2920
- * Creates a ProseMirror schema.
2921
- */
2922
- createSchema() {
2923
- this.schema = this.extensionManager.schema;
2924
- }
2925
- /**
2926
- * Creates the initial document.
2927
- */
2928
- createDoc() {
2929
- let t;
2930
- try {
2931
- t = ht(this.options.content, this.schema, this.options.parseOptions, {
2932
- errorOnInvalidContent: this.options.enableContentCheck
2933
- });
2934
- } catch (n) {
2935
- if (!(n instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(n.message))
2936
- throw n;
2937
- this.emit("contentError", {
2938
- editor: this,
2939
- error: n,
2940
- disableCollaboration: () => {
2941
- "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((r) => r.name !== "collaboration"), this.createExtensionManager();
2942
- }
2943
- }), t = ht(this.options.content, this.schema, this.options.parseOptions, {
2944
- errorOnInvalidContent: !1
2945
- });
2946
- }
2947
- return t;
2948
- }
2949
- /**
2950
- * Creates a ProseMirror view.
2951
- */
2952
- createView(t) {
2953
- const { editorProps: n, enableExtensionDispatchTransaction: r } = this.options, s = n.dispatchTransaction || this.dispatchTransaction.bind(this), o = r ? this.extensionManager.dispatchTransaction(s) : s, i = n.transformPastedHTML, a = this.extensionManager.transformPastedHTML(i);
2954
- this.editorView = new qe(t, {
2955
- ...n,
2956
- attributes: {
2957
- // add `role="textbox"` to the editor element
2958
- role: "textbox",
2959
- ...n?.attributes
2960
- },
2961
- dispatchTransaction: o,
2962
- transformPastedHTML: a,
2963
- state: this.editorState,
2964
- markViews: this.extensionManager.markViews,
2965
- nodeViews: this.extensionManager.nodeViews
2966
- });
2967
- const c = this.state.reconfigure({
2968
- plugins: this.extensionManager.plugins
2969
- });
2970
- this.view.updateState(c), this.prependClass(), this.injectCSS();
2971
- const l = this.view.dom;
2972
- l.editor = this;
2973
- }
2974
- /**
2975
- * Creates all node and mark views.
2976
- */
2977
- createNodeViews() {
2978
- this.view.isDestroyed || this.view.setProps({
2979
- markViews: this.extensionManager.markViews,
2980
- nodeViews: this.extensionManager.nodeViews
2981
- });
2982
- }
2983
- /**
2984
- * Prepend class name to element.
2985
- */
2986
- prependClass() {
2987
- this.view.dom.className = `${this.className} ${this.view.dom.className}`;
2988
- }
2989
- captureTransaction(t) {
2990
- this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
2991
- const n = this.capturedTransaction;
2992
- return this.capturedTransaction = null, n;
2993
- }
2994
- /**
2995
- * The callback over which to send transactions (state updates) produced by the view.
2996
- *
2997
- * @param transaction An editor state transaction
2998
- */
2999
- dispatchTransaction(t) {
3000
- if (this.view.isDestroyed)
3001
- return;
3002
- if (this.isCapturingTransaction) {
3003
- if (!this.capturedTransaction) {
3004
- this.capturedTransaction = t;
3005
- return;
3006
- }
3007
- t.steps.forEach((u) => {
3008
- var d;
3009
- return (d = this.capturedTransaction) == null ? void 0 : d.step(u);
3010
- });
3011
- return;
3012
- }
3013
- const { state: n, transactions: r } = this.state.applyTransaction(t), s = !this.state.selection.eq(n.selection), o = r.includes(t), i = this.state;
3014
- if (this.emit("beforeTransaction", {
3015
- editor: this,
3016
- transaction: t,
3017
- nextState: n
3018
- }), !o)
3019
- return;
3020
- this.view.updateState(n), this.emit("transaction", {
3021
- editor: this,
3022
- transaction: t,
3023
- appendedTransactions: r.slice(1)
3024
- }), s && this.emit("selectionUpdate", {
3025
- editor: this,
3026
- transaction: t
3027
- });
3028
- const a = r.findLast((u) => u.getMeta("focus") || u.getMeta("blur")), c = a?.getMeta("focus"), l = a?.getMeta("blur");
3029
- c && this.emit("focus", {
3030
- editor: this,
3031
- event: c.event,
3032
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3033
- transaction: a
3034
- }), l && this.emit("blur", {
3035
- editor: this,
3036
- event: l.event,
3037
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3038
- transaction: a
3039
- }), !(t.getMeta("preventUpdate") || !r.some((u) => u.docChanged) || i.doc.eq(n.doc)) && this.emit("update", {
3040
- editor: this,
3041
- transaction: t,
3042
- appendedTransactions: r.slice(1)
3043
- });
3044
- }
3045
- /**
3046
- * Get attributes of the currently selected node or mark.
3047
- */
3048
- getAttributes(t) {
3049
- return Zn(this.state, t);
3050
- }
3051
- isActive(t, n) {
3052
- const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
3053
- return rr(this.state, r, s);
3054
- }
3055
- /**
3056
- * Get the document as JSON.
3057
- */
3058
- getJSON() {
3059
- return this.state.doc.toJSON();
3060
- }
3061
- /**
3062
- * Get the document as HTML.
3063
- */
3064
- getHTML() {
3065
- return kt(this.state.doc.content, this.schema);
3066
- }
3067
- /**
3068
- * Get the document as text.
3069
- */
3070
- getText(t) {
3071
- const { blockSeparator: n = `
3072
-
3073
- `, textSerializers: r = {} } = t || {};
3074
- return Yn(this.state.doc, {
3075
- blockSeparator: n,
3076
- textSerializers: {
3077
- ...Yt(this.schema),
3078
- ...r
3079
- }
3080
- });
3081
- }
3082
- /**
3083
- * Check if there is no content.
3084
- */
3085
- get isEmpty() {
3086
- return Mt(this.state.doc);
3087
- }
3088
- /**
3089
- * Destroy the editor.
3090
- */
3091
- destroy() {
3092
- this.emit("destroy"), this.unmount(), this.removeAllListeners();
3093
- }
3094
- /**
3095
- * Check if the editor is already destroyed.
3096
- */
3097
- get isDestroyed() {
3098
- var t, n;
3099
- return (n = (t = this.editorView) == null ? void 0 : t.isDestroyed) != null ? n : !0;
3100
- }
3101
- $node(t, n) {
3102
- var r;
3103
- return ((r = this.$doc) == null ? void 0 : r.querySelector(t, n)) || null;
3104
- }
3105
- $nodes(t, n) {
3106
- var r;
3107
- return ((r = this.$doc) == null ? void 0 : r.querySelectorAll(t, n)) || null;
3108
- }
3109
- $pos(t) {
3110
- const n = this.state.doc.resolve(t);
3111
- return new jr(n, this);
3112
- }
3113
- get $doc() {
3114
- return this.$pos(0);
3115
- }
3116
- };
3117
- function fs(e) {
3118
- return new at({
3119
- find: e.find,
3120
- handler: ({ state: t, range: n, match: r }) => {
3121
- const s = x(e.getAttributes, void 0, r);
3122
- if (s === !1 || s === null)
3123
- return null;
3124
- const { tr: o } = t, i = r[r.length - 1], a = r[0];
3125
- if (i) {
3126
- const c = a.search(/\S/), l = n.from + a.indexOf(i), u = l + i.length;
3127
- if (Qt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((m) => m === e.type && m !== f.mark.type)).filter((f) => f.to > l).length)
3128
- return null;
3129
- u < n.to && o.delete(u, n.to), l > n.from && o.delete(n.from + c, l);
3130
- const p = n.from + c + i.length;
3131
- o.addMark(n.from + c, p, e.type.create(s || {})), o.removeStoredMark(e.type);
3132
- }
3133
- },
3134
- undoable: e.undoable
3135
- });
3136
- }
3137
- function ps(e) {
3138
- return new at({
3139
- find: e.find,
3140
- handler: ({ state: t, range: n, match: r }) => {
3141
- const s = x(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
3142
- let a = n.to;
3143
- const c = e.type.create(s);
3144
- if (r[1]) {
3145
- const l = r[0].lastIndexOf(r[1]);
3146
- let u = i + l;
3147
- u > a ? u = a : a = u + r[1].length;
3148
- const d = r[0][r[0].length - 1];
3149
- o.insertText(d, i + r[0].length - 1), o.replaceWith(u, a, c);
3150
- } else if (r[0]) {
3151
- const l = e.type.isInline ? i : i - 1;
3152
- o.insert(l, e.type.create(s)).delete(o.mapping.map(i), o.mapping.map(a));
3153
- }
3154
- o.scrollIntoView();
3155
- },
3156
- undoable: e.undoable
3157
- });
3158
- }
3159
- function hs(e) {
3160
- return new at({
3161
- find: e.find,
3162
- handler: ({ state: t, range: n, match: r }) => {
3163
- const s = t.doc.resolve(n.from), o = x(e.getAttributes, void 0, r) || {};
3164
- if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), e.type))
3165
- return null;
3166
- t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, o);
3167
- },
3168
- undoable: e.undoable
3169
- });
3170
- }
3171
- function ms(e) {
3172
- return new at({
3173
- find: e.find,
3174
- handler: ({ state: t, range: n, match: r, chain: s }) => {
3175
- const o = x(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && me(c, e.type, o);
3176
- if (!l)
3177
- return null;
3178
- if (i.wrap(c, l), e.keepMarks && e.editor) {
3179
- const { selection: d, storedMarks: p } = t, { splittableMarks: f } = e.editor.extensionManager, h = p || d.$to.parentOffset && d.$from.marks();
3180
- if (h) {
3181
- const m = h.filter((g) => f.includes(g.type.name));
3182
- i.ensureMarks(m);
3183
- }
3184
- }
3185
- if (e.keepAttributes) {
3186
- const d = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3187
- s().updateAttributes(d, o).run();
3188
- }
3189
- const u = i.doc.resolve(n.from - 1).nodeBefore;
3190
- u && u.type === e.type && gt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
3191
- },
3192
- undoable: e.undoable
3193
- });
3194
- }
3195
- var Fr = (e) => "touches" in e, gs = class {
3196
- /**
3197
- * Creates a new ResizableNodeView instance.
3198
- *
3199
- * The constructor sets up the resize handles, applies initial sizing from
3200
- * node attributes, and configures all resize behavior options.
3201
- *
3202
- * @param options - Configuration options for the resizable node view
3203
- */
3204
- constructor(e) {
3205
- this.directions = ["bottom-left", "bottom-right", "top-left", "top-right"], this.minSize = {
3206
- height: 8,
3207
- width: 8
3208
- }, this.preserveAspectRatio = !1, this.classNames = {
3209
- container: "",
3210
- wrapper: "",
3211
- handle: "",
3212
- resizing: ""
3213
- }, this.initialWidth = 0, this.initialHeight = 0, this.aspectRatio = 1, this.isResizing = !1, this.activeHandle = null, this.startX = 0, this.startY = 0, this.startWidth = 0, this.startHeight = 0, this.isShiftKeyPressed = !1, this.lastEditableState = void 0, this.handleMap = /* @__PURE__ */ new Map(), this.handleMouseMove = (a) => {
3214
- if (!this.isResizing || !this.activeHandle)
3215
- return;
3216
- const c = a.clientX - this.startX, l = a.clientY - this.startY;
3217
- this.handleResize(c, l);
3218
- }, this.handleTouchMove = (a) => {
3219
- if (!this.isResizing || !this.activeHandle)
3220
- return;
3221
- const c = a.touches[0];
3222
- if (!c)
3223
- return;
3224
- const l = c.clientX - this.startX, u = c.clientY - this.startY;
3225
- this.handleResize(l, u);
3226
- }, this.handleMouseUp = () => {
3227
- if (!this.isResizing)
3228
- return;
3229
- const a = this.element.offsetWidth, c = this.element.offsetHeight;
3230
- this.onCommit(a, c), this.isResizing = !1, this.activeHandle = null, this.container.dataset.resizeState = "false", this.classNames.resizing && this.container.classList.remove(this.classNames.resizing), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp);
3231
- }, this.handleKeyDown = (a) => {
3232
- a.key === "Shift" && (this.isShiftKeyPressed = !0);
3233
- }, this.handleKeyUp = (a) => {
3234
- a.key === "Shift" && (this.isShiftKeyPressed = !1);
3235
- };
3236
- var t, n, r, s, o, i;
3237
- this.node = e.node, this.editor = e.editor, this.element = e.element, this.contentElement = e.contentElement, this.getPos = e.getPos, this.onResize = e.onResize, this.onCommit = e.onCommit, this.onUpdate = e.onUpdate, (t = e.options) != null && t.min && (this.minSize = {
3238
- ...this.minSize,
3239
- ...e.options.min
3240
- }), (n = e.options) != null && n.max && (this.maxSize = e.options.max), (r = e?.options) != null && r.directions && (this.directions = e.options.directions), (s = e.options) != null && s.preserveAspectRatio && (this.preserveAspectRatio = e.options.preserveAspectRatio), (o = e.options) != null && o.className && (this.classNames = {
3241
- container: e.options.className.container || "",
3242
- wrapper: e.options.className.wrapper || "",
3243
- handle: e.options.className.handle || "",
3244
- resizing: e.options.className.resizing || ""
3245
- }), (i = e.options) != null && i.createCustomHandle && (this.createCustomHandle = e.options.createCustomHandle), this.wrapper = this.createWrapper(), this.container = this.createContainer(), this.applyInitialSize(), this.attachHandles(), this.editor.on("update", this.handleEditorUpdate.bind(this));
3246
- }
3247
- /**
3248
- * Returns the top-level DOM node that should be placed in the editor.
3249
- *
3250
- * This is required by the ProseMirror NodeView interface. The container
3251
- * includes the wrapper, handles, and the actual content element.
3252
- *
3253
- * @returns The container element to be inserted into the editor
3254
- */
3255
- get dom() {
3256
- return this.container;
3257
- }
3258
- get contentDOM() {
3259
- var e;
3260
- return (e = this.contentElement) != null ? e : null;
3261
- }
3262
- handleEditorUpdate() {
3263
- const e = this.editor.isEditable;
3264
- e !== this.lastEditableState && (this.lastEditableState = e, e ? e && this.handleMap.size === 0 && this.attachHandles() : this.removeHandles());
3265
- }
3266
- /**
3267
- * Called when the node's content or attributes change.
3268
- *
3269
- * Updates the internal node reference. If a custom `onUpdate` callback
3270
- * was provided, it will be called to handle additional update logic.
3271
- *
3272
- * @param node - The new/updated node
3273
- * @param decorations - Node decorations
3274
- * @param innerDecorations - Inner decorations
3275
- * @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`
3276
- */
3277
- update(e, t, n) {
3278
- return e.type !== this.node.type ? !1 : (this.node = e, this.onUpdate ? this.onUpdate(e, t, n) : !0);
3279
- }
3280
- /**
3281
- * Cleanup method called when the node view is being removed.
3282
- *
3283
- * Removes all event listeners to prevent memory leaks. This is required
3284
- * by the ProseMirror NodeView interface. If a resize is active when
3285
- * destroy is called, it will be properly cancelled.
3286
- */
3287
- destroy() {
3288
- this.isResizing && (this.container.dataset.resizeState = "false", this.classNames.resizing && this.container.classList.remove(this.classNames.resizing), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp), this.isResizing = !1, this.activeHandle = null), this.editor.off("update", this.handleEditorUpdate.bind(this)), this.container.remove();
3289
- }
3290
- /**
3291
- * Creates the outer container element.
3292
- *
3293
- * The container is the top-level element returned by the NodeView and
3294
- * wraps the entire resizable node. It's set up with flexbox to handle
3295
- * alignment and includes data attributes for styling and identification.
3296
- *
3297
- * @returns The container element
3298
- */
3299
- createContainer() {
3300
- const e = document.createElement("div");
3301
- return e.dataset.resizeContainer = "", e.dataset.node = this.node.type.name, e.style.display = "flex", this.classNames.container && (e.className = this.classNames.container), e.appendChild(this.wrapper), e;
3302
- }
3303
- /**
3304
- * Creates the wrapper element that contains the content and handles.
3305
- *
3306
- * The wrapper uses relative positioning so that resize handles can be
3307
- * positioned absolutely within it. This is the direct parent of the
3308
- * content element being made resizable.
3309
- *
3310
- * @returns The wrapper element
3311
- */
3312
- createWrapper() {
3313
- const e = document.createElement("div");
3314
- return e.style.position = "relative", e.style.display = "block", e.dataset.resizeWrapper = "", this.classNames.wrapper && (e.className = this.classNames.wrapper), e.appendChild(this.element), e;
3315
- }
3316
- /**
3317
- * Creates a resize handle element for a specific direction.
3318
- *
3319
- * Each handle is absolutely positioned and includes a data attribute
3320
- * identifying its direction for styling purposes.
3321
- *
3322
- * @param direction - The resize direction for this handle
3323
- * @returns The handle element
3324
- */
3325
- createHandle(e) {
3326
- const t = document.createElement("div");
3327
- return t.dataset.resizeHandle = e, t.style.position = "absolute", this.classNames.handle && (t.className = this.classNames.handle), t;
3328
- }
3329
- /**
3330
- * Positions a handle element according to its direction.
3331
- *
3332
- * Corner handles (e.g., 'top-left') are positioned at the intersection
3333
- * of two edges. Edge handles (e.g., 'top') span the full width or height.
3334
- *
3335
- * @param handle - The handle element to position
3336
- * @param direction - The direction determining the position
3337
- */
3338
- positionHandle(e, t) {
3339
- const n = t.includes("top"), r = t.includes("bottom"), s = t.includes("left"), o = t.includes("right");
3340
- n && (e.style.top = "0"), r && (e.style.bottom = "0"), s && (e.style.left = "0"), o && (e.style.right = "0"), (t === "top" || t === "bottom") && (e.style.left = "0", e.style.right = "0"), (t === "left" || t === "right") && (e.style.top = "0", e.style.bottom = "0");
3341
- }
3342
- /**
3343
- * Creates and attaches all resize handles to the wrapper.
3344
- *
3345
- * Iterates through the configured directions, creates a handle for each,
3346
- * positions it, attaches the mousedown listener, and appends it to the DOM.
3347
- */
3348
- attachHandles() {
3349
- this.directions.forEach((e) => {
3350
- let t;
3351
- this.createCustomHandle ? t = this.createCustomHandle(e) : t = this.createHandle(e), t instanceof HTMLElement || (console.warn(
3352
- `[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`
3353
- ), t = this.createHandle(e)), this.createCustomHandle || this.positionHandle(t, e), t.addEventListener("mousedown", (n) => this.handleResizeStart(n, e)), t.addEventListener("touchstart", (n) => this.handleResizeStart(n, e)), this.handleMap.set(e, t), this.wrapper.appendChild(t);
3354
- });
3355
- }
3356
- /**
3357
- * Removes all resize handles from the wrapper.
3358
- *
3359
- * Cleans up the handle map and removes each handle element from the DOM.
3360
- */
3361
- removeHandles() {
3362
- this.handleMap.forEach((e) => e.remove()), this.handleMap.clear();
3363
- }
3364
- /**
3365
- * Applies initial sizing from node attributes to the element.
3366
- *
3367
- * If width/height attributes exist on the node, they're applied to the element.
3368
- * Otherwise, the element's natural/current dimensions are measured. The aspect
3369
- * ratio is calculated for later use in aspect-ratio-preserving resizes.
3370
- */
3371
- applyInitialSize() {
3372
- const e = this.node.attrs.width, t = this.node.attrs.height;
3373
- e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
3374
- }
3375
- /**
3376
- * Initiates a resize operation when a handle is clicked.
3377
- *
3378
- * Captures the starting mouse position and element dimensions, sets up
3379
- * the resize state, adds the resizing class and state attribute, and
3380
- * attaches document-level listeners for mouse movement and keyboard input.
3381
- *
3382
- * @param event - The mouse down event
3383
- * @param direction - The direction of the handle being dragged
3384
- */
3385
- handleResizeStart(e, t) {
3386
- e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, Fr(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3387
- }
3388
- handleResize(e, t) {
3389
- if (!this.activeHandle)
3390
- return;
3391
- const n = this.preserveAspectRatio || this.isShiftKeyPressed, { width: r, height: s } = this.calculateNewDimensions(this.activeHandle, e, t), o = this.applyConstraints(r, s, n);
3392
- this.element.style.width = `${o.width}px`, this.element.style.height = `${o.height}px`, this.onResize && this.onResize(o.width, o.height);
3393
- }
3394
- /**
3395
- * Calculates new dimensions based on mouse delta and resize direction.
3396
- *
3397
- * Takes the starting dimensions and applies the mouse movement delta
3398
- * according to the handle direction. For corner handles, both dimensions
3399
- * are affected. For edge handles, only one dimension changes. If aspect
3400
- * ratio should be preserved, delegates to applyAspectRatio.
3401
- *
3402
- * @param direction - The active resize handle direction
3403
- * @param deltaX - Horizontal mouse movement since resize start
3404
- * @param deltaY - Vertical mouse movement since resize start
3405
- * @returns The calculated width and height
3406
- */
3407
- calculateNewDimensions(e, t, n) {
3408
- let r = this.startWidth, s = this.startHeight;
3409
- const o = e.includes("right"), i = e.includes("left"), a = e.includes("bottom"), c = e.includes("top");
3410
- return o ? r = this.startWidth + t : i && (r = this.startWidth - t), a ? s = this.startHeight + n : c && (s = this.startHeight - n), (e === "right" || e === "left") && (r = this.startWidth + (o ? t : -t)), (e === "top" || e === "bottom") && (s = this.startHeight + (a ? n : -n)), this.preserveAspectRatio || this.isShiftKeyPressed ? this.applyAspectRatio(r, s, e) : { width: r, height: s };
3411
- }
3412
- /**
3413
- * Applies min/max constraints to dimensions.
3414
- *
3415
- * When aspect ratio is NOT preserved, constraints are applied independently
3416
- * to width and height. When aspect ratio IS preserved, constraints are
3417
- * applied while maintaining the aspect ratio—if one dimension hits a limit,
3418
- * the other is recalculated proportionally.
3419
- *
3420
- * This ensures that aspect ratio is never broken when constrained.
3421
- *
3422
- * @param width - The unconstrained width
3423
- * @param height - The unconstrained height
3424
- * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
3425
- * @returns The constrained dimensions
3426
- */
3427
- applyConstraints(e, t, n) {
3428
- var r, s, o, i;
3429
- if (!n) {
3430
- let l = Math.max(this.minSize.width, e), u = Math.max(this.minSize.height, t);
3431
- return (r = this.maxSize) != null && r.width && (l = Math.min(this.maxSize.width, l)), (s = this.maxSize) != null && s.height && (u = Math.min(this.maxSize.height, u)), { width: l, height: u };
3432
- }
3433
- let a = e, c = t;
3434
- return a < this.minSize.width && (a = this.minSize.width, c = a / this.aspectRatio), c < this.minSize.height && (c = this.minSize.height, a = c * this.aspectRatio), (o = this.maxSize) != null && o.width && a > this.maxSize.width && (a = this.maxSize.width, c = a / this.aspectRatio), (i = this.maxSize) != null && i.height && c > this.maxSize.height && (c = this.maxSize.height, a = c * this.aspectRatio), { width: a, height: c };
3435
- }
3436
- /**
3437
- * Adjusts dimensions to maintain the original aspect ratio.
3438
- *
3439
- * For horizontal handles (left/right), uses width as the primary dimension
3440
- * and calculates height from it. For vertical handles (top/bottom), uses
3441
- * height as primary and calculates width. For corner handles, uses width
3442
- * as the primary dimension.
3443
- *
3444
- * @param width - The new width
3445
- * @param height - The new height
3446
- * @param direction - The active resize direction
3447
- * @returns Dimensions adjusted to preserve aspect ratio
3448
- */
3449
- applyAspectRatio(e, t, n) {
3450
- const r = n === "left" || n === "right", s = n === "top" || n === "bottom";
3451
- return r ? {
3452
- width: e,
3453
- height: e / this.aspectRatio
3454
- } : s ? {
3455
- width: t * this.aspectRatio,
3456
- height: t
3457
- } : {
3458
- width: e,
3459
- height: e / this.aspectRatio
3460
- };
3461
- }
3462
- };
3463
- function vs(e, t) {
3464
- const { selection: n } = e, { $from: r } = n;
3465
- if (n instanceof nt) {
3466
- const o = r.index();
3467
- return r.parent.canReplaceWith(o, o + 1, t);
3468
- }
3469
- let s = r.depth;
3470
- for (; s >= 0; ) {
3471
- const o = r.index(s);
3472
- if (r.node(s).contentMatchAt(o).matchType(t))
3473
- return !0;
3474
- s -= 1;
3475
- }
3476
- return !1;
3477
- }
3478
- var Vr = {};
3479
- vt(Vr, {
3480
- createAtomBlockMarkdownSpec: () => Wr,
3481
- createBlockMarkdownSpec: () => Ur,
3482
- createInlineMarkdownSpec: () => Jr,
3483
- parseAttributes: () => St,
3484
- parseIndentedBlocks: () => Xr,
3485
- renderNestedMarkdownContent: () => Yr,
3486
- serializeAttributes: () => Et
3487
- });
3488
- function St(e) {
3489
- if (!e?.trim())
3490
- return {};
3491
- const t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), s = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3492
- if (s) {
3493
- const l = s.map((u) => u.trim().slice(1));
3494
- t.class = l.join(" ");
3495
- }
3496
- const o = r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
3497
- o && (t.id = o[1]);
3498
- const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
3499
- Array.from(r.matchAll(i)).forEach(([, l, u]) => {
3500
- var d;
3501
- const p = parseInt(((d = u.match(/__QUOTED_(\d+)__/)) == null ? void 0 : d[1]) || "0", 10), f = n[p];
3502
- f && (t[l] = f.slice(1, -1));
3503
- });
3504
- const c = r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
3505
- return c && c.split(/\s+/).filter(Boolean).forEach((u) => {
3506
- u.match(/^[a-zA-Z][\w-]*$/) && (t[u] = !0);
3507
- }), t;
3508
- }
3509
- function Et(e) {
3510
- if (!e || Object.keys(e).length === 0)
3511
- return "";
3512
- const t = [];
3513
- return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((r) => t.push(`.${r}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([n, r]) => {
3514
- n === "class" || n === "id" || (r === !0 ? t.push(n) : r !== !1 && r != null && t.push(`${n}="${String(r)}"`));
3515
- }), t.join(" ");
3516
- }
3517
- function Wr(e) {
3518
- const {
3519
- nodeName: t,
3520
- name: n,
3521
- parseAttributes: r = St,
3522
- serializeAttributes: s = Et,
3523
- defaultAttributes: o = {},
3524
- requiredAttributes: i = [],
3525
- allowedAttributes: a
3526
- } = e, c = n || t, l = (u) => {
3527
- if (!a)
3528
- return u;
3529
- const d = {};
3530
- return a.forEach((p) => {
3531
- p in u && (d[p] = u[p]);
3532
- }), d;
3533
- };
3534
- return {
3535
- parseMarkdown: (u, d) => {
3536
- const p = { ...o, ...u.attributes };
3537
- return d.createNode(t, p, []);
3538
- },
3539
- markdownTokenizer: {
3540
- name: t,
3541
- level: "block",
3542
- start(u) {
3543
- var d;
3544
- const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), f = (d = u.match(p)) == null ? void 0 : d.index;
3545
- return f !== void 0 ? f : -1;
3546
- },
3547
- tokenize(u, d, p) {
3548
- const f = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), h = u.match(f);
3549
- if (!h)
3550
- return;
3551
- const m = h[1] || "", g = r(m);
3552
- if (!i.find((b) => !(b in g)))
3553
- return {
3554
- type: t,
3555
- raw: h[0],
3556
- attributes: g
3557
- };
3558
- }
3559
- },
3560
- renderMarkdown: (u) => {
3561
- const d = l(u.attrs || {}), p = s(d), f = p ? ` {${p}}` : "";
3562
- return `:::${c}${f} :::`;
3563
- }
3564
- };
3565
- }
3566
- function Ur(e) {
3567
- const {
3568
- nodeName: t,
3569
- name: n,
3570
- getContent: r,
3571
- parseAttributes: s = St,
3572
- serializeAttributes: o = Et,
3573
- defaultAttributes: i = {},
3574
- content: a = "block",
3575
- allowedAttributes: c
3576
- } = e, l = n || t, u = (d) => {
3577
- if (!c)
3578
- return d;
3579
- const p = {};
3580
- return c.forEach((f) => {
3581
- f in d && (p[f] = d[f]);
3582
- }), p;
3583
- };
3584
- return {
3585
- parseMarkdown: (d, p) => {
3586
- let f;
3587
- if (r) {
3588
- const m = r(d);
3589
- f = typeof m == "string" ? [{ type: "text", text: m }] : m;
3590
- } else a === "block" ? f = p.parseChildren(d.tokens || []) : f = p.parseInline(d.tokens || []);
3591
- const h = { ...i, ...d.attributes };
3592
- return p.createNode(t, h, f);
3593
- },
3594
- markdownTokenizer: {
3595
- name: t,
3596
- level: "block",
3597
- start(d) {
3598
- var p;
3599
- const f = new RegExp(`^:::${l}`, "m"), h = (p = d.match(f)) == null ? void 0 : p.index;
3600
- return h !== void 0 ? h : -1;
3601
- },
3602
- tokenize(d, p, f) {
3603
- var h;
3604
- const m = new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = d.match(m);
3605
- if (!g)
3606
- return;
3607
- const [v, b = ""] = g, k = s(b);
3608
- let M = 1;
3609
- const w = v.length;
3610
- let S = "";
3611
- const E = /^:::([\w-]*)(\s.*)?/gm, A = d.slice(w);
3612
- for (E.lastIndex = 0; ; ) {
3613
- const C = E.exec(A);
3614
- if (C === null)
3615
- break;
3616
- const _ = C.index, lt = C[1];
3617
- if (!((h = C[2]) != null && h.endsWith(":::"))) {
3618
- if (lt)
3619
- M += 1;
3620
- else if (M -= 1, M === 0) {
3621
- const K = A.slice(0, _);
3622
- S = K.trim();
3623
- const dt = d.slice(0, w + _ + C[0].length);
3624
- let I = [];
3625
- if (S)
3626
- if (a === "block")
3627
- for (I = f.blockTokens(K), I.forEach((R) => {
3628
- R.text && (!R.tokens || R.tokens.length === 0) && (R.tokens = f.inlineTokens(R.text));
3629
- }); I.length > 0; ) {
3630
- const R = I[I.length - 1];
3631
- if (R.type === "paragraph" && (!R.text || R.text.trim() === ""))
3632
- I.pop();
3633
- else
3634
- break;
3635
- }
3636
- else
3637
- I = f.inlineTokens(S);
3638
- return {
3639
- type: t,
3640
- raw: dt,
3641
- attributes: k,
3642
- content: S,
3643
- tokens: I
3644
- };
3645
- }
3646
- }
3647
- }
3648
- }
3649
- },
3650
- renderMarkdown: (d, p) => {
3651
- const f = u(d.attrs || {}), h = o(f), m = h ? ` {${h}}` : "", g = p.renderChildren(d.content || [], `
3652
-
3653
- `);
3654
- return `:::${l}${m}
3655
-
3656
- ${g}
3657
-
3658
- :::`;
3659
- }
3660
- };
3661
- }
3662
- function Kr(e) {
3663
- if (!e.trim())
3664
- return {};
3665
- const t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3666
- let r = n.exec(e);
3667
- for (; r !== null; ) {
3668
- const [, s, o, i] = r;
3669
- t[s] = o || i, r = n.exec(e);
3670
- }
3671
- return t;
3672
- }
3673
- function qr(e) {
3674
- return Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => `${t}="${n}"`).join(" ");
3675
- }
3676
- function Jr(e) {
3677
- const {
3678
- nodeName: t,
3679
- name: n,
3680
- getContent: r,
3681
- parseAttributes: s = Kr,
3682
- serializeAttributes: o = qr,
3683
- defaultAttributes: i = {},
3684
- selfClosing: a = !1,
3685
- allowedAttributes: c
3686
- } = e, l = n || t, u = (p) => {
3687
- if (!c)
3688
- return p;
3689
- const f = {};
3690
- return c.forEach((h) => {
3691
- const m = typeof h == "string" ? h : h.name, g = typeof h == "string" ? void 0 : h.skipIfDefault;
3692
- if (m in p) {
3693
- const v = p[m];
3694
- if (g !== void 0 && v === g)
3695
- return;
3696
- f[m] = v;
3697
- }
3698
- }), f;
3699
- }, d = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3700
- return {
3701
- parseMarkdown: (p, f) => {
3702
- const h = { ...i, ...p.attributes };
3703
- if (a)
3704
- return f.createNode(t, h);
3705
- const m = r ? r(p) : p.content || "";
3706
- return m ? f.createNode(t, h, [f.createTextNode(m)]) : f.createNode(t, h, []);
3707
- },
3708
- markdownTokenizer: {
3709
- name: t,
3710
- level: "inline",
3711
- start(p) {
3712
- const f = a ? new RegExp(`\\[${d}\\s*[^\\]]*\\]`) : new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`), h = p.match(f), m = h?.index;
3713
- return m !== void 0 ? m : -1;
3714
- },
3715
- tokenize(p, f, h) {
3716
- const m = a ? new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`), g = p.match(m);
3717
- if (!g)
3718
- return;
3719
- let v = "", b = "";
3720
- if (a) {
3721
- const [, M] = g;
3722
- b = M;
3723
- } else {
3724
- const [, M, w] = g;
3725
- b = M, v = w || "";
3726
- }
3727
- const k = s(b.trim());
3728
- return {
3729
- type: t,
3730
- raw: g[0],
3731
- content: v.trim(),
3732
- attributes: k
3733
- };
3734
- }
3735
- },
3736
- renderMarkdown: (p) => {
3737
- let f = "";
3738
- r ? f = r(p) : p.content && p.content.length > 0 && (f = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
3739
- const h = u(p.attrs || {}), m = o(h), g = m ? ` ${m}` : "";
3740
- return a ? `[${l}${g}]` : `[${l}${g}]${f}[/${l}]`;
3741
- }
3742
- };
3743
- }
3744
- function Xr(e, t, n) {
3745
- var r, s, o, i;
3746
- const a = e.split(`
3747
- `), c = [];
3748
- let l = "", u = 0;
3749
- const d = t.baseIndentSize || 2;
3750
- for (; u < a.length; ) {
3751
- const p = a[u], f = p.match(t.itemPattern);
3752
- if (!f) {
3753
- if (c.length > 0)
3754
- break;
3755
- if (p.trim() === "") {
3756
- u += 1, l = `${l}${p}
3757
- `;
3758
- continue;
3759
- } else
3760
- return;
3761
- }
3762
- const h = t.extractItemData(f), { indentLevel: m, mainContent: g } = h;
3763
- l = `${l}${p}
3764
- `;
3765
- const v = [g];
3766
- for (u += 1; u < a.length; ) {
3767
- const w = a[u];
3768
- if (w.trim() === "") {
3769
- const E = a.slice(u + 1).findIndex((_) => _.trim() !== "");
3770
- if (E === -1)
3771
- break;
3772
- if ((((s = (r = a[u + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : s.length) || 0) > m) {
3773
- v.push(w), l = `${l}${w}
3774
- `, u += 1;
3775
- continue;
3776
- } else
3777
- break;
3778
- }
3779
- if ((((i = (o = w.match(/^(\s*)/)) == null ? void 0 : o[1]) == null ? void 0 : i.length) || 0) > m)
3780
- v.push(w), l = `${l}${w}
3781
- `, u += 1;
3782
- else
3783
- break;
3784
- }
3785
- let b;
3786
- const k = v.slice(1);
3787
- if (k.length > 0) {
3788
- const w = k.map((S) => S.slice(m + d)).join(`
3789
- `);
3790
- w.trim() && (t.customNestedParser ? b = t.customNestedParser(w) : b = n.blockTokens(w));
3791
- }
3792
- const M = t.createToken(h, b);
3793
- c.push(M);
3794
- }
3795
- if (c.length !== 0)
3796
- return {
3797
- items: c,
3798
- raw: l
3799
- };
3800
- }
3801
- function Yr(e, t, n, r) {
3802
- if (!e || !Array.isArray(e.content))
3803
- return "";
3804
- const s = typeof n == "function" ? n(r) : n, [o, ...i] = e.content, a = t.renderChildren([o]), c = [`${s}${a}`];
3805
- return i && i.length > 0 && i.forEach((l) => {
3806
- const u = t.renderChildren([l]);
3807
- if (u) {
3808
- const d = u.split(`
3809
- `).map((p) => p ? t.indent(p) : "").join(`
3810
- `);
3811
- c.push(d);
3812
- }
3813
- }), c.join(`
3814
- `);
3815
- }
3816
- function Qr(e, t, n = {}) {
3817
- const { state: r } = t, { doc: s, tr: o } = r, i = e;
3818
- s.descendants((a, c) => {
3819
- const l = o.mapping.map(c), u = o.mapping.map(c) + a.nodeSize;
3820
- let d = null;
3821
- if (a.marks.forEach((f) => {
3822
- if (f !== i)
3823
- return !1;
3824
- d = f;
3825
- }), !d)
3826
- return;
3827
- let p = !1;
3828
- if (Object.keys(n).forEach((f) => {
3829
- n[f] !== d.attrs[f] && (p = !0);
3830
- }), p) {
3831
- const f = e.type.create({
3832
- ...e.attrs,
3833
- ...n
3834
- });
3835
- o.removeMark(l, u, e.type), o.addMark(l, u, f);
3836
- }
3837
- }), o.docChanged && t.view.dispatch(o);
3838
- }
3839
- var ys = class he extends xt {
3840
- constructor() {
3841
- super(...arguments), this.type = "node";
3842
- }
3843
- /**
3844
- * Create a new Node instance
3845
- * @param config - Node configuration object or a function that returns a configuration object
3846
- */
3847
- static create(t = {}) {
3848
- const n = typeof t == "function" ? t() : t;
3849
- return new he(n);
3850
- }
3851
- configure(t) {
3852
- return super.configure(t);
3853
- }
3854
- extend(t) {
3855
- const n = typeof t == "function" ? t() : t;
3856
- return super.extend(n);
3857
- }
3858
- };
3859
- function bs(e) {
3860
- return new zr({
3861
- find: e.find,
3862
- handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
3863
- const o = x(e.getAttributes, void 0, r, s);
3864
- if (o === !1 || o === null)
3865
- return null;
3866
- const { tr: i } = t, a = r[r.length - 1], c = r[0];
3867
- let l = n.to;
3868
- if (a) {
3869
- const u = c.search(/\S/), d = n.from + c.indexOf(a), p = d + a.length;
3870
- if (Qt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((g) => g === e.type && g !== h.mark.type)).filter((h) => h.to > d).length)
3871
- return null;
3872
- p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + a.length, i.addMark(n.from + u, l, e.type.create(o || {})), i.removeStoredMark(e.type);
3873
- }
3874
- }
3875
- });
3876
- }
3877
- var ws = (e, t) => {
3878
- if (e === "slot")
3879
- return 0;
3880
- if (e instanceof Function)
3881
- return e(t);
3882
- const { children: n, ...r } = t ?? {};
3883
- if (e === "svg")
3884
- throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
3885
- return [e, r, n];
3886
- };
3887
- export {
3888
- Vn as A,
3889
- Br as B,
3890
- kt as C,
3891
- ds as E,
3892
- Nr as M,
3893
- ys as N,
3894
- gs as R,
3895
- bs as a,
3896
- fs as b,
3897
- vs as c,
3898
- Hn as d,
3899
- Qt as e,
3900
- os as f,
3901
- er as g,
3902
- ws as h,
3903
- ls as i,
3904
- Zn as j,
3905
- N as k,
3906
- et as l,
3907
- Kn as m,
3908
- ps as n,
3909
- U as o,
3910
- Xr as p,
3911
- cs as q,
3912
- Yr as r,
3913
- as as s,
3914
- hs as t,
3915
- T as u,
3916
- is as v,
3917
- ms as w,
3918
- x,
3919
- y,
3920
- Mt as z
3921
- };