@vc-shell/framework 1.1.99-alpha.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/core/api/platform.ts +9883 -9883
  2. package/core/composables/useDynamicProperties/index.ts +16 -10
  3. package/core/composables/useNotifications/index.ts +1 -32
  4. package/core/composables/useSettings/index.ts +3 -8
  5. package/core/composables/useUser/index.ts +171 -74
  6. package/core/composables/useUserManagement/index.ts +25 -67
  7. package/core/interceptors/index.ts +56 -19
  8. package/core/plugins/signalR/index.ts +1 -27
  9. package/core/types/index.ts +0 -2
  10. package/dist/core/api/platform.d.ts +1 -1
  11. package/dist/core/api/platform.d.ts.map +1 -1
  12. package/dist/core/composables/useDynamicProperties/index.d.ts.map +1 -1
  13. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  14. package/dist/core/composables/useSettings/index.d.ts.map +1 -1
  15. package/dist/core/composables/useUser/index.d.ts +9 -18
  16. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  17. package/dist/core/composables/useUserManagement/index.d.ts +7 -7
  18. package/dist/core/composables/useUserManagement/index.d.ts.map +1 -1
  19. package/dist/core/interceptors/index.d.ts +1 -2
  20. package/dist/core/interceptors/index.d.ts.map +1 -1
  21. package/dist/core/plugins/signalR/index.d.ts +0 -2
  22. package/dist/core/plugins/signalR/index.d.ts.map +1 -1
  23. package/dist/core/types/index.d.ts +1 -1
  24. package/dist/core/types/index.d.ts.map +1 -1
  25. package/dist/index.d.ts +0 -8
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/injection-keys.d.ts +1 -2
  28. package/dist/injection-keys.d.ts.map +1 -1
  29. package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  30. package/dist/shared/components/multilanguage-selector/multilanguage-selector.vue.d.ts +1 -1
  31. package/dist/shared/components/notifications/components/notification-container/index.d.ts +10 -10
  32. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  33. package/dist/shared/components/sign-in/useExternalProvider.d.ts +1 -1
  34. package/dist/shared/components/sign-in/useExternalProvider.d.ts.map +1 -1
  35. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -2
  36. package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
  37. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  38. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
  39. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +1 -1
  40. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
  41. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +1 -1
  42. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
  45. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
  46. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +2 -2
  47. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
  48. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  49. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +1 -1
  50. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
  51. package/dist/ui/components/molecules/index.d.ts +1 -0
  52. package/dist/ui/components/molecules/index.d.ts.map +1 -1
  53. package/dist/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue.d.ts +34 -0
  54. package/dist/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue.d.ts.map +1 -0
  55. package/dist/ui/components/molecules/vc-accordion/index.d.ts +7 -0
  56. package/dist/ui/components/molecules/vc-accordion/index.d.ts.map +1 -0
  57. package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts +42 -0
  58. package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts.map +1 -0
  59. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +1 -1
  60. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +2 -2
  61. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
  62. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  63. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  64. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
  65. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +1 -1
  66. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  67. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +1 -1
  68. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
  69. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  70. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +1 -1
  71. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +1 -1
  72. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
  73. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
  74. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
  75. package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +3 -3
  76. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
  77. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  78. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
  79. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  80. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +1 -1
  81. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
  82. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +5 -5
  83. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
  84. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
  85. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
  86. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +1 -1
  87. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
  88. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +2 -2
  89. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +2 -2
  90. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +3 -3
  91. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +1 -1
  92. package/package.json +5 -7
  93. package/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +2 -2
  94. package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +1 -15
  95. package/shared/components/sign-in/useExternalProvider.ts +1 -11
  96. package/shared/modules/dynamic/helpers/nodeBuilder.ts +3 -11
  97. package/ui/components/atoms/vc-badge/vc-badge.stories.ts +1 -1
  98. package/ui/components/atoms/vc-button/vc-button.stories.ts +1 -1
  99. package/ui/components/atoms/vc-card/vc-card.stories.ts +1 -1
  100. package/ui/components/atoms/vc-col/vc-col.stories.ts +1 -1
  101. package/ui/components/atoms/vc-container/vc-container.stories.ts +1 -1
  102. package/ui/components/atoms/vc-hint/vc-hint.stories.ts +1 -1
  103. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +1 -1
  104. package/ui/components/atoms/vc-image/vc-image.stories.ts +1 -1
  105. package/ui/components/atoms/vc-label/vc-label.stories.ts +1 -1
  106. package/ui/components/atoms/vc-link/vc-link.stories.ts +1 -1
  107. package/ui/components/atoms/vc-progress/vc-progress.stories.ts +1 -1
  108. package/ui/components/atoms/vc-row/vc-row.stories.ts +1 -1
  109. package/ui/components/atoms/vc-skeleton/vc-skeleton.stories.ts +1 -1
  110. package/ui/components/atoms/vc-status/vc-status.stories.ts +1 -1
  111. package/ui/components/atoms/vc-status-icon/vc-status-icon.stories.ts +1 -1
  112. package/ui/components/atoms/vc-tooltip/vc-tooltip.stories.ts +1 -1
  113. package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -1
  114. package/ui/components/atoms/vc-widget/vc-widget.stories.ts +1 -1
  115. package/ui/components/molecules/index.ts +1 -0
  116. package/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue +251 -0
  117. package/ui/components/molecules/vc-accordion/index.ts +11 -0
  118. package/ui/components/molecules/vc-accordion/vc-accordion.stories.ts +526 -0
  119. package/ui/components/molecules/vc-accordion/vc-accordion.vue +176 -0
  120. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +1 -1
  121. package/ui/components/molecules/vc-checkbox/vc-checkbox.stories.ts +1 -1
  122. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +1 -1
  123. package/ui/components/molecules/vc-field/vc-field.stories.ts +1 -1
  124. package/ui/components/molecules/vc-file-upload/vc-file-upload.stories.ts +1 -1
  125. package/ui/components/molecules/vc-form/vc-form.stories.ts +1 -1
  126. package/ui/components/molecules/vc-input/vc-input.stories.ts +1 -1
  127. package/ui/components/molecules/vc-input-currency/vc-input-currency.stories.ts +1 -1
  128. package/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.stories.ts +1 -1
  129. package/ui/components/molecules/vc-multivalue/vc-multivalue.stories.ts +1 -1
  130. package/ui/components/molecules/vc-pagination/vc-pagination.stories.ts +1 -1
  131. package/ui/components/molecules/vc-radio-button/vc-radio-button.stories.ts +1 -1
  132. package/ui/components/molecules/vc-rating/vc-rating.stories.ts +1 -1
  133. package/ui/components/molecules/vc-select/vc-select.stories.ts +1 -1
  134. package/ui/components/molecules/vc-slider/vc-slider.stories.ts +1 -1
  135. package/ui/components/molecules/vc-switch/vc-switch.stories.ts +1 -1
  136. package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +1 -1
  137. package/ui/components/molecules/vc-toast/vc-toast.stories.ts +1 -1
  138. package/ui/components/organisms/vc-app/vc-app.vue +2 -20
  139. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +4 -0
  140. package/ui/components/organisms/vc-gallery/vc-gallery.stories.ts +1 -1
  141. package/ui/components/organisms/vc-popup/vc-popup.stories.ts +1 -1
  142. package/core/providers/README.md +0 -176
  143. package/core/providers/auth-provider-manager.ts +0 -74
  144. package/core/providers/auth-provider-utils.ts +0 -26
  145. package/core/providers/example-custom-auth-provider.ts +0 -162
  146. package/core/providers/index.ts +0 -3
  147. package/core/providers/platform-auth-provider.ts +0 -207
  148. package/core/types/auth-provider.ts +0 -40
  149. package/dist/assets/042c75b764bc78a7.svg +0 -1
  150. package/dist/assets/0ba156439a339f2a.svg +0 -1
  151. package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
  152. package/dist/assets/0f590f8a94577092.svg +0 -1
  153. package/dist/assets/0fc5820f8be53a1b.svg +0 -1
  154. package/dist/assets/105efd028edc1dfe.woff +0 -0
  155. package/dist/assets/10768e2cc79fc60b.svg +0 -1
  156. package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
  157. package/dist/assets/154365acf3010d96.woff2 +0 -0
  158. package/dist/assets/157b8721e0600ea8.svg +0 -1
  159. package/dist/assets/15e91cdd649cde9a.svg +0 -1
  160. package/dist/assets/19275e398ae57130.woff2 +0 -0
  161. package/dist/assets/1a3e84b2457f709a.woff +0 -0
  162. package/dist/assets/1de63eb118636cce.svg +0 -1
  163. package/dist/assets/1ea01de36eb5491b.svg +0 -1
  164. package/dist/assets/204eaf512fde2023.svg +0 -1
  165. package/dist/assets/2088983edf42e153.svg +0 -1
  166. package/dist/assets/208f810a9321a327.svg +0 -1
  167. package/dist/assets/21220a9d10e6c558.svg +0 -1
  168. package/dist/assets/220db345a102045d.woff2 +0 -0
  169. package/dist/assets/225da11d23968333.svg +0 -1
  170. package/dist/assets/226f862dd81bdc13.woff2 +0 -0
  171. package/dist/assets/23a2d53395ddb14f.woff +0 -0
  172. package/dist/assets/259e6ad461a52ad7.svg +0 -1
  173. package/dist/assets/261e6dec4d53b9ac.woff +0 -0
  174. package/dist/assets/262f46a0b6d94bb6.svg +0 -1
  175. package/dist/assets/2857c513073467da.svg +0 -1
  176. package/dist/assets/2b3be7889467d98f.woff +0 -0
  177. package/dist/assets/2d4e6190eec72737.svg +0 -1
  178. package/dist/assets/2eba973185078bc8.woff +0 -0
  179. package/dist/assets/334d3f6bc766c516.woff +0 -0
  180. package/dist/assets/34ff7dd0c2285956.svg +0 -1
  181. package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
  182. package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
  183. package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
  184. package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
  185. package/dist/assets/41275bcb979cb650.svg +0 -1
  186. package/dist/assets/434f7982590e462f.woff +0 -0
  187. package/dist/assets/475937116ee3314a.woff2 +0 -0
  188. package/dist/assets/489710fb710e73f0.woff +0 -0
  189. package/dist/assets/49791943b3872376.woff2 +0 -0
  190. package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
  191. package/dist/assets/4d7a77b0e5373992.svg +0 -1
  192. package/dist/assets/4e43c74354534fb3.svg +0 -1
  193. package/dist/assets/4fe75f5117100705.svg +0 -1
  194. package/dist/assets/52e261a005074e1b.woff +0 -0
  195. package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
  196. package/dist/assets/54cda5482c6c9218.woff +0 -0
  197. package/dist/assets/550f52072e8ccafe.woff2 +0 -0
  198. package/dist/assets/572bb1bb4156a9c1.svg +0 -1
  199. package/dist/assets/6075995d7e74da46.woff2 +0 -0
  200. package/dist/assets/617c4736236e199e.woff +0 -0
  201. package/dist/assets/67230f05dc94a265.svg +0 -1
  202. package/dist/assets/6798e4dd4add9b48.svg +0 -1
  203. package/dist/assets/686d4077c1e26876.woff2 +0 -0
  204. package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
  205. package/dist/assets/6a3e73faf406cf33.svg +0 -1
  206. package/dist/assets/72de3a63bc0b70dd.svg +0 -1
  207. package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
  208. package/dist/assets/74ed5f8a78e71106.svg +0 -1
  209. package/dist/assets/7a5aa5abd625137f.ttf +0 -0
  210. package/dist/assets/7ce0c166fd6a1204.woff +0 -0
  211. package/dist/assets/7d55399c2a7bc985.svg +0 -1
  212. package/dist/assets/7d970675c69fca1d.woff +0 -0
  213. package/dist/assets/7eda727273fd98d3.svg +0 -1
  214. package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
  215. package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
  216. package/dist/assets/861e6b7192b3b6c7.woff +0 -0
  217. package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
  218. package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
  219. package/dist/assets/910b0d99b9e26568.svg +0 -1
  220. package/dist/assets/91fe94e424323d61.woff +0 -0
  221. package/dist/assets/92508f8707159b51.svg +0 -1
  222. package/dist/assets/9392bf1d591e1abb.svg +0 -1
  223. package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
  224. package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
  225. package/dist/assets/9d37314695c0b68d.woff +0 -0
  226. package/dist/assets/a03cdcd8da5bb987.woff +0 -0
  227. package/dist/assets/a18404194e3f9047.svg +0 -1
  228. package/dist/assets/a2017fe7f0a26510.svg +0 -1
  229. package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
  230. package/dist/assets/abf88f301a0730f4.svg +0 -1
  231. package/dist/assets/ac1a99b3d05d8232.woff +0 -0
  232. package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
  233. package/dist/assets/b1a596e31ad1185a.svg +0 -1
  234. package/dist/assets/b27767411c8427be.woff +0 -0
  235. package/dist/assets/b325adcae33bbe7a.svg +0 -1
  236. package/dist/assets/b372390551ca2fa1.svg +0 -1
  237. package/dist/assets/b5bb1e8fc975decd.svg +0 -1
  238. package/dist/assets/b645a4a2181b9dc1.svg +0 -1
  239. package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
  240. package/dist/assets/b94421fadd23b0f2.svg +0 -1
  241. package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
  242. package/dist/assets/c9191b638a10f67b.woff2 +0 -0
  243. package/dist/assets/ca791c5ca5848a03.svg +0 -1
  244. package/dist/assets/cb32840ce330103f.woff +0 -0
  245. package/dist/assets/ccc878931d74181b.woff2 +0 -0
  246. package/dist/assets/d084bda16abe8a56.svg +0 -1
  247. package/dist/assets/d32b129cae2fffd6.svg +0 -1
  248. package/dist/assets/d35a4c7113315758.woff2 +0 -0
  249. package/dist/assets/d3f792f54ae4c307.svg +0 -1
  250. package/dist/assets/d5a5b8630120073d.svg +0 -1
  251. package/dist/assets/d5f9664ebbfb104b.svg +0 -1
  252. package/dist/assets/d84247b59449dd88.woff2 +0 -0
  253. package/dist/assets/dceaf3b39091e6a4.woff +0 -0
  254. package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
  255. package/dist/assets/e2ad5b3428289141.woff +0 -0
  256. package/dist/assets/e38acaa1757232e0.svg +0 -1
  257. package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
  258. package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
  259. package/dist/assets/e61a1889bac955f4.woff2 +0 -0
  260. package/dist/assets/e72bb11356af94c7.svg +0 -1
  261. package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
  262. package/dist/assets/ebec912a42ad49ff.woff +0 -0
  263. package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
  264. package/dist/assets/f09d89268e4c0317.svg +0 -1
  265. package/dist/assets/f239394367fcf005.woff2 +0 -0
  266. package/dist/assets/f5722262b6e7214e.woff2 +0 -0
  267. package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
  268. package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
  269. package/dist/assets/fe141d99763f5d2b.woff +0 -0
  270. package/dist/assets/fed13b0d59903483.svg +0 -1
  271. package/dist/assets/fed757d2c2344ead.woff2 +0 -0
  272. package/dist/assets/ffc438f20e79ce73.woff +0 -0
  273. package/dist/core/providers/auth-provider-manager.d.ts +0 -34
  274. package/dist/core/providers/auth-provider-manager.d.ts.map +0 -1
  275. package/dist/core/providers/auth-provider-utils.d.ts +0 -17
  276. package/dist/core/providers/auth-provider-utils.d.ts.map +0 -1
  277. package/dist/core/providers/example-custom-auth-provider.d.ts +0 -45
  278. package/dist/core/providers/example-custom-auth-provider.d.ts.map +0 -1
  279. package/dist/core/providers/index.d.ts +0 -3
  280. package/dist/core/providers/index.d.ts.map +0 -1
  281. package/dist/core/providers/platform-auth-provider.d.ts +0 -34
  282. package/dist/core/providers/platform-auth-provider.d.ts.map +0 -1
  283. package/dist/core/types/auth-provider.d.ts +0 -27
  284. package/dist/core/types/auth-provider.d.ts.map +0 -1
  285. package/dist/framework.js +0 -25048
  286. package/dist/index.css +0 -9
  287. package/dist/vendor-boolbase-A_-Pp38P.js +0 -23
  288. package/dist/vendor-cheerio-C46iBpCu.js +0 -1053
  289. package/dist/vendor-cheerio-select-C8emRZsx.js +0 -191
  290. package/dist/vendor-core-js-DDuR6YMQ.js +0 -1206
  291. package/dist/vendor-css-select-DR9bp36p.js +0 -622
  292. package/dist/vendor-css-what-CZZaquJM.js +0 -267
  293. package/dist/vendor-cypress-signalr-mock-DjBxJHA6.js +0 -769
  294. package/dist/vendor-date-fns-sZ1zMzTH.js +0 -3008
  295. package/dist/vendor-dom-serializer-Sk3xHhQk.js +0 -213
  296. package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
  297. package/dist/vendor-domhandler-CL40eeX9.js +0 -311
  298. package/dist/vendor-dompurify-BuxjWxA2.js +0 -553
  299. package/dist/vendor-domutils-BiVCXO8c.js +0 -386
  300. package/dist/vendor-entities-CCReaWqU.js +0 -364
  301. package/dist/vendor-floating-ui-core-Cl9nBI4j.js +0 -349
  302. package/dist/vendor-floating-ui-dom-3z44E4mf.js +0 -395
  303. package/dist/vendor-floating-ui-utils-D2sT7feD.js +0 -259
  304. package/dist/vendor-floating-ui-vue-ClrgkeO5.js +0 -107
  305. package/dist/vendor-headlessui-vue-D7tzx4PC.js +0 -961
  306. package/dist/vendor-htmlparser2-CpQu33io.js +0 -735
  307. package/dist/vendor-intlify-core-base-Da62SG4M.js +0 -1130
  308. package/dist/vendor-intlify-message-compiler-CHvGSH2u.js +0 -952
  309. package/dist/vendor-intlify-shared-jWBPd9WB.js +0 -144
  310. package/dist/vendor-iso-639-1-BJO6WZAt.js +0 -781
  311. package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
  312. package/dist/vendor-linkifyjs-dCH9UYes.js +0 -701
  313. package/dist/vendor-lodash-es-BqkGj3Jl.js +0 -4816
  314. package/dist/vendor-lucide-vue-next-m0L4DzUL.js +0 -29780
  315. package/dist/vendor-markdown-it-Czg9qJTh.js +0 -2263
  316. package/dist/vendor-markdown-it-task-lists-BxLwscWK.js +0 -69
  317. package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
  318. package/dist/vendor-microsoft-applicationinsights-analytics-js-C1Yxuzwg.js +0 -1207
  319. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-DArHD4Dn.js +0 -261
  320. package/dist/vendor-microsoft-applicationinsights-channel-js-Dbs0XRes.js +0 -1822
  321. package/dist/vendor-microsoft-applicationinsights-common-OjU3Zs6r.js +0 -1921
  322. package/dist/vendor-microsoft-applicationinsights-core-js-DWRvqBek.js +0 -4276
  323. package/dist/vendor-microsoft-applicationinsights-dependencies-js-BxTNw-Sk.js +0 -1407
  324. package/dist/vendor-microsoft-applicationinsights-properties-js-Gfhpu-At.js +0 -572
  325. package/dist/vendor-microsoft-applicationinsights-shims-CxtPYiwp.js +0 -43
  326. package/dist/vendor-microsoft-applicationinsights-web-9yeJ0EZv.js +0 -487
  327. package/dist/vendor-microsoft-dynamicproto-js-DSkQkH3T.js +0 -147
  328. package/dist/vendor-microsoft-signalr-Bgpbb4fW.js +0 -1761
  329. package/dist/vendor-moment-DMLRxgRE.js +0 -2589
  330. package/dist/vendor-nevware21-ts-async-CdMc_sGt.js +0 -261
  331. package/dist/vendor-nevware21-ts-utils-Dy41wRhA.js +0 -853
  332. package/dist/vendor-nth-check-CS1D-zr5.js +0 -45
  333. package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
  334. package/dist/vendor-parse5-htmlparser2-tree-adapter-BWywtwol.js +0 -143
  335. package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
  336. package/dist/vendor-prettier-cZc5sCiS.js +0 -4875
  337. package/dist/vendor-prosemirror-commands-Cu1q5ZDk.js +0 -385
  338. package/dist/vendor-prosemirror-dropcursor-BuGmFgFS.js +0 -86
  339. package/dist/vendor-prosemirror-gapcursor-CyYcCWVK.js +0 -203
  340. package/dist/vendor-prosemirror-history-DzRcbrCw.js +0 -248
  341. package/dist/vendor-prosemirror-keymap-KfbdOEJw.js +0 -62
  342. package/dist/vendor-prosemirror-markdown-OyxRuawK.js +0 -650
  343. package/dist/vendor-prosemirror-model-DFp4ML7B.js +0 -2730
  344. package/dist/vendor-prosemirror-schema-list-CwCUArvx.js +0 -87
  345. package/dist/vendor-prosemirror-state-DHaVEu5h.js +0 -821
  346. package/dist/vendor-prosemirror-tables-mYok4vGT.js +0 -1711
  347. package/dist/vendor-prosemirror-transform-CAHmg-qG.js +0 -1508
  348. package/dist/vendor-prosemirror-view-CspJa44O.js +0 -3751
  349. package/dist/vendor-punycode-js-CgGegfA_.js +0 -133
  350. package/dist/vendor-rope-sequence-BWC2FSrq.js +0 -100
  351. package/dist/vendor-semver-Dar8oU3V.js +0 -1023
  352. package/dist/vendor-swiper-1bp0oJwt.js +0 -3387
  353. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +0 -1
  354. package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
  355. package/dist/vendor-tiptap-core-ClsTgaMv.js +0 -3699
  356. package/dist/vendor-tiptap-extension-blockquote-r1MBx4hD.js +0 -54
  357. package/dist/vendor-tiptap-extension-bold-BjLI4i8b.js +0 -74
  358. package/dist/vendor-tiptap-extension-code-D5-kDnMW.js +0 -52
  359. package/dist/vendor-tiptap-extension-code-block-RjEb0zPA.js +0 -215
  360. package/dist/vendor-tiptap-extension-document--PLOxIdq.js +0 -12
  361. package/dist/vendor-tiptap-extension-hard-break-9cxC2YOS.js +0 -59
  362. package/dist/vendor-tiptap-extension-heading-2w0TutHn.js +0 -63
  363. package/dist/vendor-tiptap-extension-horizontal-rule-CFowa_lc.js +0 -56
  364. package/dist/vendor-tiptap-extension-image-aWn-na6j.js +0 -127
  365. package/dist/vendor-tiptap-extension-italic-Bn-6saY0.js +0 -73
  366. package/dist/vendor-tiptap-extension-link-BmcG1_k-.js +0 -298
  367. package/dist/vendor-tiptap-extension-list-BrNBJ45n.js +0 -707
  368. package/dist/vendor-tiptap-extension-paragraph-DAiYhwUB.js +0 -41
  369. package/dist/vendor-tiptap-extension-placeholder-9tURDKy-.js +0 -1
  370. package/dist/vendor-tiptap-extension-strike-DqbXPfos.js +0 -64
  371. package/dist/vendor-tiptap-extension-table-DQwPaR7v.js +0 -374
  372. package/dist/vendor-tiptap-extension-table-cell-C0tEP_0i.js +0 -1
  373. package/dist/vendor-tiptap-extension-table-header-C0tEP_0i.js +0 -1
  374. package/dist/vendor-tiptap-extension-table-row-C0tEP_0i.js +0 -1
  375. package/dist/vendor-tiptap-extension-text-BFnfj70b.js +0 -13
  376. package/dist/vendor-tiptap-extension-text-style-Darua3qr.js +0 -235
  377. package/dist/vendor-tiptap-extension-underline-QyVnBqQZ.js +0 -65
  378. package/dist/vendor-tiptap-extensions-CU-D7bfm.js +0 -290
  379. package/dist/vendor-tiptap-markdown-BwATYN5A.js +0 -826
  380. package/dist/vendor-tiptap-pm-d91nGny8.js +0 -1
  381. package/dist/vendor-tiptap-starter-kit-5luf7zzS.js +0 -28
  382. package/dist/vendor-tiptap-vue-3-CFBErZGb.js +0 -157
  383. package/dist/vendor-truncate-html-DYC0Lj9o.js +0 -145
  384. package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
  385. package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
  386. package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
  387. package/dist/vendor-vue-currency-input-BqaYAdhD.js +0 -317
  388. package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
  389. package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
  390. package/dist/vendor-vue-i18n-CO5LWKE0.js +0 -1370
  391. package/dist/vendor-vue3-application-insights-BKiiWnf2.js +0 -69
  392. package/dist/vendor-vue3-touch-events-DqysuuWh.js +0 -169
  393. package/dist/vendor-vuepic-vue-datepicker-CaY_xSnG.js +0 -4998
  394. package/dist/vendor-vueuse-components-sgKpNzof.js +0 -542
  395. package/dist/vendor-vueuse-core-D0cN7FqY.js +0 -5130
  396. package/dist/vendor-vueuse-shared-Pt0UEStA.js +0 -1169
  397. package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
@@ -1,3751 +0,0 @@
1
- import { N as D, S as be, T as x, A as Nn } from "./vendor-prosemirror-state-DHaVEu5h.js";
2
- import { S as se, D as Ve, F as j, d as $t, M as Sn } from "./vendor-prosemirror-model-DFp4ML7B.js";
3
- import { d as Cn } from "./vendor-prosemirror-transform-CAHmg-qG.js";
4
- const C = function(t) {
5
- for (var e = 0; ; e++)
6
- if (t = t.previousSibling, !t)
7
- return e;
8
- }, he = function(t) {
9
- let e = t.assignedSlot || t.parentNode;
10
- return e && e.nodeType == 11 ? e.host : e;
11
- };
12
- let Ke = null;
13
- const H = function(t, e, n) {
14
- let o = Ke || (Ke = document.createRange());
15
- return o.setEnd(t, n ?? t.nodeValue.length), o.setStart(t, e || 0), o;
16
- }, On = function() {
17
- Ke = null;
18
- }, re = function(t, e, n, o) {
19
- return n && (st(t, e, n, o, -1) || st(t, e, n, o, 1));
20
- }, Mn = /^(img|br|input|textarea|hr)$/i;
21
- function st(t, e, n, o, i) {
22
- for (var s; ; ) {
23
- if (t == n && e == o)
24
- return !0;
25
- if (e == (i < 0 ? 0 : B(t))) {
26
- let r = t.parentNode;
27
- if (!r || r.nodeType != 1 || Ce(t) || Mn.test(t.nodeName) || t.contentEditable == "false")
28
- return !1;
29
- e = C(t) + (i < 0 ? 0 : 1), t = r;
30
- } else if (t.nodeType == 1) {
31
- let r = t.childNodes[e + (i < 0 ? -1 : 0)];
32
- if (r.nodeType == 1 && r.contentEditable == "false")
33
- if (!((s = r.pmViewDesc) === null || s === void 0) && s.ignoreForSelection)
34
- e += i;
35
- else
36
- return !1;
37
- else
38
- t = r, e = i < 0 ? B(t) : 0;
39
- } else
40
- return !1;
41
- }
42
- }
43
- function B(t) {
44
- return t.nodeType == 3 ? t.nodeValue.length : t.childNodes.length;
45
- }
46
- function xn(t, e) {
47
- for (; ; ) {
48
- if (t.nodeType == 3 && e)
49
- return t;
50
- if (t.nodeType == 1 && e > 0) {
51
- if (t.contentEditable == "false")
52
- return null;
53
- t = t.childNodes[e - 1], e = B(t);
54
- } else if (t.parentNode && !Ce(t))
55
- e = C(t), t = t.parentNode;
56
- else
57
- return null;
58
- }
59
- }
60
- function kn(t, e) {
61
- for (; ; ) {
62
- if (t.nodeType == 3 && e < t.nodeValue.length)
63
- return t;
64
- if (t.nodeType == 1 && e < t.childNodes.length) {
65
- if (t.contentEditable == "false")
66
- return null;
67
- t = t.childNodes[e], e = 0;
68
- } else if (t.parentNode && !Ce(t))
69
- e = C(t) + 1, t = t.parentNode;
70
- else
71
- return null;
72
- }
73
- }
74
- function Tn(t, e, n) {
75
- for (let o = e == 0, i = e == B(t); o || i; ) {
76
- if (t == n)
77
- return !0;
78
- let s = C(t);
79
- if (t = t.parentNode, !t)
80
- return !1;
81
- o = o && s == 0, i = i && s == B(t);
82
- }
83
- }
84
- function Ce(t) {
85
- let e;
86
- for (let n = t; n && !(e = n.pmViewDesc); n = n.parentNode)
87
- ;
88
- return e && e.node && e.node.isBlock && (e.dom == t || e.contentDOM == t);
89
- }
90
- const Re = function(t) {
91
- return t.focusNode && re(t.focusNode, t.focusOffset, t.anchorNode, t.anchorOffset);
92
- };
93
- function ee(t, e) {
94
- let n = document.createEvent("Event");
95
- return n.initEvent("keydown", !0, !0), n.keyCode = t, n.key = n.code = e, n;
96
- }
97
- function An(t) {
98
- let e = t.activeElement;
99
- for (; e && e.shadowRoot; )
100
- e = e.shadowRoot.activeElement;
101
- return e;
102
- }
103
- function En(t, e, n) {
104
- if (t.caretPositionFromPoint)
105
- try {
106
- let o = t.caretPositionFromPoint(e, n);
107
- if (o)
108
- return { node: o.offsetNode, offset: Math.min(B(o.offsetNode), o.offset) };
109
- } catch {
110
- }
111
- if (t.caretRangeFromPoint) {
112
- let o = t.caretRangeFromPoint(e, n);
113
- if (o)
114
- return { node: o.startContainer, offset: Math.min(B(o.startContainer), o.startOffset) };
115
- }
116
- }
117
- const $ = typeof navigator < "u" ? navigator : null, rt = typeof document < "u" ? document : null, w = $ && $.userAgent || "", He = /Edge\/(\d+)/.exec(w), qt = /MSIE \d/.exec(w), We = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w), P = !!(qt || We || He), J = qt ? document.documentMode : We ? +We[1] : He ? +He[1] : 0, I = !P && /gecko\/(\d+)/i.test(w);
118
- I && +(/Firefox\/(\d+)/.exec(w) || [0, 0])[1];
119
- const _e = !P && /Chrome\/(\d+)/.exec(w), M = !!_e, Kt = _e ? +_e[1] : 0, k = !P && !!$ && /Apple Computer/.test($.vendor), ue = k && (/Mobile\/\w+/.test(w) || !!$ && $.maxTouchPoints > 2), R = ue || ($ ? /Mac/.test($.platform) : !1), Pn = $ ? /Win/.test($.platform) : !1, W = /Android \d/.test(w), Oe = !!rt && "webkitFontSmoothing" in rt.documentElement.style, Vn = Oe ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
120
- function Rn(t) {
121
- let e = t.defaultView && t.defaultView.visualViewport;
122
- return e ? {
123
- left: 0,
124
- right: e.width,
125
- top: 0,
126
- bottom: e.height
127
- } : {
128
- left: 0,
129
- right: t.documentElement.clientWidth,
130
- top: 0,
131
- bottom: t.documentElement.clientHeight
132
- };
133
- }
134
- function K(t, e) {
135
- return typeof t == "number" ? t : t[e];
136
- }
137
- function Bn(t) {
138
- let e = t.getBoundingClientRect(), n = e.width / t.offsetWidth || 1, o = e.height / t.offsetHeight || 1;
139
- return {
140
- left: e.left,
141
- right: e.left + t.clientWidth * n,
142
- top: e.top,
143
- bottom: e.top + t.clientHeight * o
144
- };
145
- }
146
- function lt(t, e, n) {
147
- let o = t.someProp("scrollThreshold") || 0, i = t.someProp("scrollMargin") || 5, s = t.dom.ownerDocument;
148
- for (let r = n || t.dom; r; ) {
149
- if (r.nodeType != 1) {
150
- r = he(r);
151
- continue;
152
- }
153
- let l = r, a = l == s.body, c = a ? Rn(s) : Bn(l), d = 0, f = 0;
154
- if (e.top < c.top + K(o, "top") ? f = -(c.top - e.top + K(i, "top")) : e.bottom > c.bottom - K(o, "bottom") && (f = e.bottom - e.top > c.bottom - c.top ? e.top + K(i, "top") - c.top : e.bottom - c.bottom + K(i, "bottom")), e.left < c.left + K(o, "left") ? d = -(c.left - e.left + K(i, "left")) : e.right > c.right - K(o, "right") && (d = e.right - c.right + K(i, "right")), d || f)
155
- if (a)
156
- s.defaultView.scrollBy(d, f);
157
- else {
158
- let p = l.scrollLeft, h = l.scrollTop;
159
- f && (l.scrollTop += f), d && (l.scrollLeft += d);
160
- let g = l.scrollLeft - p, m = l.scrollTop - h;
161
- e = { left: e.left - g, top: e.top - m, right: e.right - g, bottom: e.bottom - m };
162
- }
163
- let u = a ? "fixed" : getComputedStyle(r).position;
164
- if (/^(fixed|sticky)$/.test(u))
165
- break;
166
- r = u == "absolute" ? r.offsetParent : he(r);
167
- }
168
- }
169
- function In(t) {
170
- let e = t.dom.getBoundingClientRect(), n = Math.max(0, e.top), o, i;
171
- for (let s = (e.left + e.right) / 2, r = n + 1; r < Math.min(innerHeight, e.bottom); r += 5) {
172
- let l = t.root.elementFromPoint(s, r);
173
- if (!l || l == t.dom || !t.dom.contains(l))
174
- continue;
175
- let a = l.getBoundingClientRect();
176
- if (a.top >= n - 20) {
177
- o = l, i = a.top;
178
- break;
179
- }
180
- }
181
- return { refDOM: o, refTop: i, stack: Ht(t.dom) };
182
- }
183
- function Ht(t) {
184
- let e = [], n = t.ownerDocument;
185
- for (let o = t; o && (e.push({ dom: o, top: o.scrollTop, left: o.scrollLeft }), t != n); o = he(o))
186
- ;
187
- return e;
188
- }
189
- function Fn({ refDOM: t, refTop: e, stack: n }) {
190
- let o = t ? t.getBoundingClientRect().top : 0;
191
- Wt(n, o == 0 ? 0 : o - e);
192
- }
193
- function Wt(t, e) {
194
- for (let n = 0; n < t.length; n++) {
195
- let { dom: o, top: i, left: s } = t[n];
196
- o.scrollTop != i + e && (o.scrollTop = i + e), o.scrollLeft != s && (o.scrollLeft = s);
197
- }
198
- }
199
- let ae = null;
200
- function zn(t) {
201
- if (t.setActive)
202
- return t.setActive();
203
- if (ae)
204
- return t.focus(ae);
205
- let e = Ht(t);
206
- t.focus(ae == null ? {
207
- get preventScroll() {
208
- return ae = { preventScroll: !0 }, !0;
209
- }
210
- } : void 0), ae || (ae = !1, Wt(e, 0));
211
- }
212
- function _t(t, e) {
213
- let n, o = 2e8, i, s = 0, r = e.top, l = e.top, a, c;
214
- for (let d = t.firstChild, f = 0; d; d = d.nextSibling, f++) {
215
- let u;
216
- if (d.nodeType == 1)
217
- u = d.getClientRects();
218
- else if (d.nodeType == 3)
219
- u = H(d).getClientRects();
220
- else
221
- continue;
222
- for (let p = 0; p < u.length; p++) {
223
- let h = u[p];
224
- if (h.top <= r && h.bottom >= l) {
225
- r = Math.max(h.bottom, r), l = Math.min(h.top, l);
226
- let g = h.left > e.left ? h.left - e.left : h.right < e.left ? e.left - h.right : 0;
227
- if (g < o) {
228
- n = d, o = g, i = g && n.nodeType == 3 ? {
229
- left: h.right < e.left ? h.right : h.left,
230
- top: e.top
231
- } : e, d.nodeType == 1 && g && (s = f + (e.left >= (h.left + h.right) / 2 ? 1 : 0));
232
- continue;
233
- }
234
- } else h.top > e.top && !a && h.left <= e.left && h.right >= e.left && (a = d, c = { left: Math.max(h.left, Math.min(h.right, e.left)), top: h.top });
235
- !n && (e.left >= h.right && e.top >= h.top || e.left >= h.left && e.top >= h.bottom) && (s = f + 1);
236
- }
237
- }
238
- return !n && a && (n = a, i = c, o = 0), n && n.nodeType == 3 ? Ln(n, i) : !n || o && n.nodeType == 1 ? { node: t, offset: s } : _t(n, i);
239
- }
240
- function Ln(t, e) {
241
- let n = t.nodeValue.length, o = document.createRange();
242
- for (let i = 0; i < n; i++) {
243
- o.setEnd(t, i + 1), o.setStart(t, i);
244
- let s = U(o, 1);
245
- if (s.top != s.bottom && Ze(e, s))
246
- return { node: t, offset: i + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
247
- }
248
- return { node: t, offset: 0 };
249
- }
250
- function Ze(t, e) {
251
- return t.left >= e.left - 1 && t.left <= e.right + 1 && t.top >= e.top - 1 && t.top <= e.bottom + 1;
252
- }
253
- function $n(t, e) {
254
- let n = t.parentNode;
255
- return n && /^li$/i.test(n.nodeName) && e.left < t.getBoundingClientRect().left ? n : t;
256
- }
257
- function qn(t, e, n) {
258
- let { node: o, offset: i } = _t(e, n), s = -1;
259
- if (o.nodeType == 1 && !o.firstChild) {
260
- let r = o.getBoundingClientRect();
261
- s = r.left != r.right && n.left > (r.left + r.right) / 2 ? 1 : -1;
262
- }
263
- return t.docView.posFromDOM(o, i, s);
264
- }
265
- function Kn(t, e, n, o) {
266
- let i = -1;
267
- for (let s = e, r = !1; s != t.dom; ) {
268
- let l = t.docView.nearestDesc(s, !0), a;
269
- if (!l)
270
- return null;
271
- if (l.dom.nodeType == 1 && (l.node.isBlock && l.parent || !l.contentDOM) && // Ignore elements with zero-size bounding rectangles
272
- ((a = l.dom.getBoundingClientRect()).width || a.height) && (l.node.isBlock && l.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName) && (!r && a.left > o.left || a.top > o.top ? i = l.posBefore : (!r && a.right < o.left || a.bottom < o.top) && (i = l.posAfter), r = !0), !l.contentDOM && i < 0 && !l.node.isText))
273
- return (l.node.isBlock ? o.top < (a.top + a.bottom) / 2 : o.left < (a.left + a.right) / 2) ? l.posBefore : l.posAfter;
274
- s = l.dom.parentNode;
275
- }
276
- return i > -1 ? i : t.docView.posFromDOM(e, n, -1);
277
- }
278
- function jt(t, e, n) {
279
- let o = t.childNodes.length;
280
- if (o && n.top < n.bottom)
281
- for (let i = Math.max(0, Math.min(o - 1, Math.floor(o * (e.top - n.top) / (n.bottom - n.top)) - 2)), s = i; ; ) {
282
- let r = t.childNodes[s];
283
- if (r.nodeType == 1) {
284
- let l = r.getClientRects();
285
- for (let a = 0; a < l.length; a++) {
286
- let c = l[a];
287
- if (Ze(e, c))
288
- return jt(r, e, c);
289
- }
290
- }
291
- if ((s = (s + 1) % o) == i)
292
- break;
293
- }
294
- return t;
295
- }
296
- function Hn(t, e) {
297
- let n = t.dom.ownerDocument, o, i = 0, s = En(n, e.left, e.top);
298
- s && ({ node: o, offset: i } = s);
299
- let r = (t.root.elementFromPoint ? t.root : n).elementFromPoint(e.left, e.top), l;
300
- if (!r || !t.dom.contains(r.nodeType != 1 ? r.parentNode : r)) {
301
- let c = t.dom.getBoundingClientRect();
302
- if (!Ze(e, c) || (r = jt(t.dom, e, c), !r))
303
- return null;
304
- }
305
- if (k)
306
- for (let c = r; o && c; c = he(c))
307
- c.draggable && (o = void 0);
308
- if (r = $n(r, e), o) {
309
- if (I && o.nodeType == 1 && (i = Math.min(i, o.childNodes.length), i < o.childNodes.length)) {
310
- let d = o.childNodes[i], f;
311
- d.nodeName == "IMG" && (f = d.getBoundingClientRect()).right <= e.left && f.bottom > e.top && i++;
312
- }
313
- let c;
314
- Oe && i && o.nodeType == 1 && (c = o.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, o == t.dom && i == o.childNodes.length - 1 && o.lastChild.nodeType == 1 && e.top > o.lastChild.getBoundingClientRect().bottom ? l = t.state.doc.content.size : (i == 0 || o.nodeType != 1 || o.childNodes[i - 1].nodeName != "BR") && (l = Kn(t, o, i, e));
315
- }
316
- l == null && (l = qn(t, r, e));
317
- let a = t.docView.nearestDesc(r, !0);
318
- return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
319
- }
320
- function at(t) {
321
- return t.top < t.bottom || t.left < t.right;
322
- }
323
- function U(t, e) {
324
- let n = t.getClientRects();
325
- if (n.length) {
326
- let o = n[e < 0 ? 0 : n.length - 1];
327
- if (at(o))
328
- return o;
329
- }
330
- return Array.prototype.find.call(n, at) || t.getBoundingClientRect();
331
- }
332
- const Wn = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
333
- function Ut(t, e, n) {
334
- let { node: o, offset: i, atom: s } = t.docView.domFromPos(e, n < 0 ? -1 : 1), r = Oe || I;
335
- if (o.nodeType == 3)
336
- if (r && (Wn.test(o.nodeValue) || (n < 0 ? !i : i == o.nodeValue.length))) {
337
- let a = U(H(o, i, i), n);
338
- if (I && i && /\s/.test(o.nodeValue[i - 1]) && i < o.nodeValue.length) {
339
- let c = U(H(o, i - 1, i - 1), -1);
340
- if (c.top == a.top) {
341
- let d = U(H(o, i, i + 1), -1);
342
- if (d.top != a.top)
343
- return me(d, d.left < c.left);
344
- }
345
- }
346
- return a;
347
- } else {
348
- let a = i, c = i, d = n < 0 ? 1 : -1;
349
- return n < 0 && !i ? (c++, d = -1) : n >= 0 && i == o.nodeValue.length ? (a--, d = 1) : n < 0 ? a-- : c++, me(U(H(o, a, c), d), d < 0);
350
- }
351
- if (!t.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
352
- if (s == null && i && (n < 0 || i == B(o))) {
353
- let a = o.childNodes[i - 1];
354
- if (a.nodeType == 1)
355
- return Fe(a.getBoundingClientRect(), !1);
356
- }
357
- if (s == null && i < B(o)) {
358
- let a = o.childNodes[i];
359
- if (a.nodeType == 1)
360
- return Fe(a.getBoundingClientRect(), !0);
361
- }
362
- return Fe(o.getBoundingClientRect(), n >= 0);
363
- }
364
- if (s == null && i && (n < 0 || i == B(o))) {
365
- let a = o.childNodes[i - 1], c = a.nodeType == 3 ? H(a, B(a) - (r ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
366
- if (c)
367
- return me(U(c, 1), !1);
368
- }
369
- if (s == null && i < B(o)) {
370
- let a = o.childNodes[i];
371
- for (; a.pmViewDesc && a.pmViewDesc.ignoreForCoords; )
372
- a = a.nextSibling;
373
- let c = a ? a.nodeType == 3 ? H(a, 0, r ? 0 : 1) : a.nodeType == 1 ? a : null : null;
374
- if (c)
375
- return me(U(c, -1), !0);
376
- }
377
- return me(U(o.nodeType == 3 ? H(o) : o, -n), n >= 0);
378
- }
379
- function me(t, e) {
380
- if (t.width == 0)
381
- return t;
382
- let n = e ? t.left : t.right;
383
- return { top: t.top, bottom: t.bottom, left: n, right: n };
384
- }
385
- function Fe(t, e) {
386
- if (t.height == 0)
387
- return t;
388
- let n = e ? t.top : t.bottom;
389
- return { top: n, bottom: n, left: t.left, right: t.right };
390
- }
391
- function Yt(t, e, n) {
392
- let o = t.state, i = t.root.activeElement;
393
- o != e && t.updateState(e), i != t.dom && t.focus();
394
- try {
395
- return n();
396
- } finally {
397
- o != e && t.updateState(o), i != t.dom && i && i.focus();
398
- }
399
- }
400
- function _n(t, e, n) {
401
- let o = e.selection, i = n == "up" ? o.$from : o.$to;
402
- return Yt(t, e, () => {
403
- let { node: s } = t.docView.domFromPos(i.pos, n == "up" ? -1 : 1);
404
- for (; ; ) {
405
- let l = t.docView.nearestDesc(s, !0);
406
- if (!l)
407
- break;
408
- if (l.node.isBlock) {
409
- s = l.contentDOM || l.dom;
410
- break;
411
- }
412
- s = l.dom.parentNode;
413
- }
414
- let r = Ut(t, i.pos, 1);
415
- for (let l = s.firstChild; l; l = l.nextSibling) {
416
- let a;
417
- if (l.nodeType == 1)
418
- a = l.getClientRects();
419
- else if (l.nodeType == 3)
420
- a = H(l, 0, l.nodeValue.length).getClientRects();
421
- else
422
- continue;
423
- for (let c = 0; c < a.length; c++) {
424
- let d = a[c];
425
- if (d.bottom > d.top + 1 && (n == "up" ? r.top - d.top > (d.bottom - r.top) * 2 : d.bottom - r.bottom > (r.bottom - d.top) * 2))
426
- return !1;
427
- }
428
- }
429
- return !0;
430
- });
431
- }
432
- const jn = /[\u0590-\u08ac]/;
433
- function Un(t, e, n) {
434
- let { $head: o } = e.selection;
435
- if (!o.parent.isTextblock)
436
- return !1;
437
- let i = o.parentOffset, s = !i, r = i == o.parent.content.size, l = t.domSelection();
438
- return l ? !jn.test(o.parent.textContent) || !l.modify ? n == "left" || n == "backward" ? s : r : Yt(t, e, () => {
439
- let { focusNode: a, focusOffset: c, anchorNode: d, anchorOffset: f } = t.domSelectionRange(), u = l.caretBidiLevel;
440
- l.modify("move", n, "character");
441
- let p = o.depth ? t.docView.domAfterPos(o.before()) : t.dom, { focusNode: h, focusOffset: g } = t.domSelectionRange(), m = h && !p.contains(h.nodeType == 1 ? h : h.parentNode) || a == h && c == g;
442
- try {
443
- l.collapse(d, f), a && (a != d || c != f) && l.extend && l.extend(a, c);
444
- } catch {
445
- }
446
- return u != null && (l.caretBidiLevel = u), m;
447
- }) : o.pos == o.start() || o.pos == o.end();
448
- }
449
- let ct = null, dt = null, ft = !1;
450
- function Yn(t, e, n) {
451
- return ct == e && dt == n ? ft : (ct = e, dt = n, ft = n == "up" || n == "down" ? _n(t, e, n) : Un(t, e, n));
452
- }
453
- const F = 0, ht = 1, te = 2, q = 3;
454
- class Me {
455
- constructor(e, n, o, i) {
456
- this.parent = e, this.children = n, this.dom = o, this.contentDOM = i, this.dirty = F, o.pmViewDesc = this;
457
- }
458
- // Used to check whether a given description corresponds to a
459
- // widget/mark/node.
460
- matchesWidget(e) {
461
- return !1;
462
- }
463
- matchesMark(e) {
464
- return !1;
465
- }
466
- matchesNode(e, n, o) {
467
- return !1;
468
- }
469
- matchesHack(e) {
470
- return !1;
471
- }
472
- // When parsing in-editor content (in domchange.js), we allow
473
- // descriptions to determine the parse rules that should be used to
474
- // parse them.
475
- parseRule() {
476
- return null;
477
- }
478
- // Used by the editor's event handler to ignore events that come
479
- // from certain descs.
480
- stopEvent(e) {
481
- return !1;
482
- }
483
- // The size of the content represented by this desc.
484
- get size() {
485
- let e = 0;
486
- for (let n = 0; n < this.children.length; n++)
487
- e += this.children[n].size;
488
- return e;
489
- }
490
- // For block nodes, this represents the space taken up by their
491
- // start/end tokens.
492
- get border() {
493
- return 0;
494
- }
495
- destroy() {
496
- this.parent = void 0, this.dom.pmViewDesc == this && (this.dom.pmViewDesc = void 0);
497
- for (let e = 0; e < this.children.length; e++)
498
- this.children[e].destroy();
499
- }
500
- posBeforeChild(e) {
501
- for (let n = 0, o = this.posAtStart; ; n++) {
502
- let i = this.children[n];
503
- if (i == e)
504
- return o;
505
- o += i.size;
506
- }
507
- }
508
- get posBefore() {
509
- return this.parent.posBeforeChild(this);
510
- }
511
- get posAtStart() {
512
- return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
513
- }
514
- get posAfter() {
515
- return this.posBefore + this.size;
516
- }
517
- get posAtEnd() {
518
- return this.posAtStart + this.size - 2 * this.border;
519
- }
520
- localPosFromDOM(e, n, o) {
521
- if (this.contentDOM && this.contentDOM.contains(e.nodeType == 1 ? e : e.parentNode))
522
- if (o < 0) {
523
- let s, r;
524
- if (e == this.contentDOM)
525
- s = e.childNodes[n - 1];
526
- else {
527
- for (; e.parentNode != this.contentDOM; )
528
- e = e.parentNode;
529
- s = e.previousSibling;
530
- }
531
- for (; s && !((r = s.pmViewDesc) && r.parent == this); )
532
- s = s.previousSibling;
533
- return s ? this.posBeforeChild(r) + r.size : this.posAtStart;
534
- } else {
535
- let s, r;
536
- if (e == this.contentDOM)
537
- s = e.childNodes[n];
538
- else {
539
- for (; e.parentNode != this.contentDOM; )
540
- e = e.parentNode;
541
- s = e.nextSibling;
542
- }
543
- for (; s && !((r = s.pmViewDesc) && r.parent == this); )
544
- s = s.nextSibling;
545
- return s ? this.posBeforeChild(r) : this.posAtEnd;
546
- }
547
- let i;
548
- if (e == this.dom && this.contentDOM)
549
- i = n > C(this.contentDOM);
550
- else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
551
- i = e.compareDocumentPosition(this.contentDOM) & 2;
552
- else if (this.dom.firstChild) {
553
- if (n == 0)
554
- for (let s = e; ; s = s.parentNode) {
555
- if (s == this.dom) {
556
- i = !1;
557
- break;
558
- }
559
- if (s.previousSibling)
560
- break;
561
- }
562
- if (i == null && n == e.childNodes.length)
563
- for (let s = e; ; s = s.parentNode) {
564
- if (s == this.dom) {
565
- i = !0;
566
- break;
567
- }
568
- if (s.nextSibling)
569
- break;
570
- }
571
- }
572
- return i ?? o > 0 ? this.posAtEnd : this.posAtStart;
573
- }
574
- nearestDesc(e, n = !1) {
575
- for (let o = !0, i = e; i; i = i.parentNode) {
576
- let s = this.getDesc(i), r;
577
- if (s && (!n || s.node))
578
- if (o && (r = s.nodeDOM) && !(r.nodeType == 1 ? r.contains(e.nodeType == 1 ? e : e.parentNode) : r == e))
579
- o = !1;
580
- else
581
- return s;
582
- }
583
- }
584
- getDesc(e) {
585
- let n = e.pmViewDesc;
586
- for (let o = n; o; o = o.parent)
587
- if (o == this)
588
- return n;
589
- }
590
- posFromDOM(e, n, o) {
591
- for (let i = e; i; i = i.parentNode) {
592
- let s = this.getDesc(i);
593
- if (s)
594
- return s.localPosFromDOM(e, n, o);
595
- }
596
- return -1;
597
- }
598
- // Find the desc for the node after the given pos, if any. (When a
599
- // parent node overrode rendering, there might not be one.)
600
- descAt(e) {
601
- for (let n = 0, o = 0; n < this.children.length; n++) {
602
- let i = this.children[n], s = o + i.size;
603
- if (o == e && s != o) {
604
- for (; !i.border && i.children.length; )
605
- for (let r = 0; r < i.children.length; r++) {
606
- let l = i.children[r];
607
- if (l.size) {
608
- i = l;
609
- break;
610
- }
611
- }
612
- return i;
613
- }
614
- if (e < s)
615
- return i.descAt(e - o - i.border);
616
- o = s;
617
- }
618
- }
619
- domFromPos(e, n) {
620
- if (!this.contentDOM)
621
- return { node: this.dom, offset: 0, atom: e + 1 };
622
- let o = 0, i = 0;
623
- for (let s = 0; o < this.children.length; o++) {
624
- let r = this.children[o], l = s + r.size;
625
- if (l > e || r instanceof Xt) {
626
- i = e - s;
627
- break;
628
- }
629
- s = l;
630
- }
631
- if (i)
632
- return this.children[o].domFromPos(i - this.children[o].border, n);
633
- for (let s; o && !(s = this.children[o - 1]).size && s instanceof Gt && s.side >= 0; o--)
634
- ;
635
- if (n <= 0) {
636
- let s, r = !0;
637
- for (; s = o ? this.children[o - 1] : null, !(!s || s.dom.parentNode == this.contentDOM); o--, r = !1)
638
- ;
639
- return s && n && r && !s.border && !s.domAtom ? s.domFromPos(s.size, n) : { node: this.contentDOM, offset: s ? C(s.dom) + 1 : 0 };
640
- } else {
641
- let s, r = !0;
642
- for (; s = o < this.children.length ? this.children[o] : null, !(!s || s.dom.parentNode == this.contentDOM); o++, r = !1)
643
- ;
644
- return s && r && !s.border && !s.domAtom ? s.domFromPos(0, n) : { node: this.contentDOM, offset: s ? C(s.dom) : this.contentDOM.childNodes.length };
645
- }
646
- }
647
- // Used to find a DOM range in a single parent for a given changed
648
- // range.
649
- parseRange(e, n, o = 0) {
650
- if (this.children.length == 0)
651
- return { node: this.contentDOM, from: e, to: n, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
652
- let i = -1, s = -1;
653
- for (let r = o, l = 0; ; l++) {
654
- let a = this.children[l], c = r + a.size;
655
- if (i == -1 && e <= c) {
656
- let d = r + a.border;
657
- if (e >= d && n <= c - a.border && a.node && a.contentDOM && this.contentDOM.contains(a.contentDOM))
658
- return a.parseRange(e, n, d);
659
- e = r;
660
- for (let f = l; f > 0; f--) {
661
- let u = this.children[f - 1];
662
- if (u.size && u.dom.parentNode == this.contentDOM && !u.emptyChildAt(1)) {
663
- i = C(u.dom) + 1;
664
- break;
665
- }
666
- e -= u.size;
667
- }
668
- i == -1 && (i = 0);
669
- }
670
- if (i > -1 && (c > n || l == this.children.length - 1)) {
671
- n = c;
672
- for (let d = l + 1; d < this.children.length; d++) {
673
- let f = this.children[d];
674
- if (f.size && f.dom.parentNode == this.contentDOM && !f.emptyChildAt(-1)) {
675
- s = C(f.dom);
676
- break;
677
- }
678
- n += f.size;
679
- }
680
- s == -1 && (s = this.contentDOM.childNodes.length);
681
- break;
682
- }
683
- r = c;
684
- }
685
- return { node: this.contentDOM, from: e, to: n, fromOffset: i, toOffset: s };
686
- }
687
- emptyChildAt(e) {
688
- if (this.border || !this.contentDOM || !this.children.length)
689
- return !1;
690
- let n = this.children[e < 0 ? 0 : this.children.length - 1];
691
- return n.size == 0 || n.emptyChildAt(e);
692
- }
693
- domAfterPos(e) {
694
- let { node: n, offset: o } = this.domFromPos(e, 0);
695
- if (n.nodeType != 1 || o == n.childNodes.length)
696
- throw new RangeError("No node after pos " + e);
697
- return n.childNodes[o];
698
- }
699
- // View descs are responsible for setting any selection that falls
700
- // entirely inside of them, so that custom implementations can do
701
- // custom things with the selection. Note that this falls apart when
702
- // a selection starts in such a node and ends in another, in which
703
- // case we just use whatever domFromPos produces as a best effort.
704
- setSelection(e, n, o, i = !1) {
705
- let s = Math.min(e, n), r = Math.max(e, n);
706
- for (let p = 0, h = 0; p < this.children.length; p++) {
707
- let g = this.children[p], m = h + g.size;
708
- if (s > h && r < m)
709
- return g.setSelection(e - h - g.border, n - h - g.border, o, i);
710
- h = m;
711
- }
712
- let l = this.domFromPos(e, e ? -1 : 1), a = n == e ? l : this.domFromPos(n, n ? -1 : 1), c = o.root.getSelection(), d = o.domSelectionRange(), f = !1;
713
- if ((I || k) && e == n) {
714
- let { node: p, offset: h } = l;
715
- if (p.nodeType == 3) {
716
- if (f = !!(h && p.nodeValue[h - 1] == `
717
- `), f && h == p.nodeValue.length)
718
- for (let g = p, m; g; g = g.parentNode) {
719
- if (m = g.nextSibling) {
720
- m.nodeName == "BR" && (l = a = { node: m.parentNode, offset: C(m) + 1 });
721
- break;
722
- }
723
- let y = g.pmViewDesc;
724
- if (y && y.node && y.node.isBlock)
725
- break;
726
- }
727
- } else {
728
- let g = p.childNodes[h - 1];
729
- f = g && (g.nodeName == "BR" || g.contentEditable == "false");
730
- }
731
- }
732
- if (I && d.focusNode && d.focusNode != a.node && d.focusNode.nodeType == 1) {
733
- let p = d.focusNode.childNodes[d.focusOffset];
734
- p && p.contentEditable == "false" && (i = !0);
735
- }
736
- if (!(i || f && k) && re(l.node, l.offset, d.anchorNode, d.anchorOffset) && re(a.node, a.offset, d.focusNode, d.focusOffset))
737
- return;
738
- let u = !1;
739
- if ((c.extend || e == n) && !(f && I)) {
740
- c.collapse(l.node, l.offset);
741
- try {
742
- e != n && c.extend(a.node, a.offset), u = !0;
743
- } catch {
744
- }
745
- }
746
- if (!u) {
747
- if (e > n) {
748
- let h = l;
749
- l = a, a = h;
750
- }
751
- let p = document.createRange();
752
- p.setEnd(a.node, a.offset), p.setStart(l.node, l.offset), c.removeAllRanges(), c.addRange(p);
753
- }
754
- }
755
- ignoreMutation(e) {
756
- return !this.contentDOM && e.type != "selection";
757
- }
758
- get contentLost() {
759
- return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
760
- }
761
- // Remove a subtree of the element tree that has been touched
762
- // by a DOM change, so that the next update will redraw it.
763
- markDirty(e, n) {
764
- for (let o = 0, i = 0; i < this.children.length; i++) {
765
- let s = this.children[i], r = o + s.size;
766
- if (o == r ? e <= r && n >= o : e < r && n > o) {
767
- let l = o + s.border, a = r - s.border;
768
- if (e >= l && n <= a) {
769
- this.dirty = e == o || n == r ? te : ht, e == l && n == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = q : s.markDirty(e - l, n - l);
770
- return;
771
- } else
772
- s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? te : q;
773
- }
774
- o = r;
775
- }
776
- this.dirty = te;
777
- }
778
- markParentsDirty() {
779
- let e = 1;
780
- for (let n = this.parent; n; n = n.parent, e++) {
781
- let o = e == 1 ? te : ht;
782
- n.dirty < o && (n.dirty = o);
783
- }
784
- }
785
- get domAtom() {
786
- return !1;
787
- }
788
- get ignoreForCoords() {
789
- return !1;
790
- }
791
- get ignoreForSelection() {
792
- return !1;
793
- }
794
- isText(e) {
795
- return !1;
796
- }
797
- }
798
- class Gt extends Me {
799
- constructor(e, n, o, i) {
800
- let s, r = n.type.toDOM;
801
- if (typeof r == "function" && (r = r(o, () => {
802
- if (!s)
803
- return i;
804
- if (s.parent)
805
- return s.parent.posBeforeChild(s);
806
- })), !n.type.spec.raw) {
807
- if (r.nodeType != 1) {
808
- let l = document.createElement("span");
809
- l.appendChild(r), r = l;
810
- }
811
- r.contentEditable = "false", r.classList.add("ProseMirror-widget");
812
- }
813
- super(e, [], r, null), this.widget = n, this.widget = n, s = this;
814
- }
815
- matchesWidget(e) {
816
- return this.dirty == F && e.type.eq(this.widget.type);
817
- }
818
- parseRule() {
819
- return { ignore: !0 };
820
- }
821
- stopEvent(e) {
822
- let n = this.widget.spec.stopEvent;
823
- return n ? n(e) : !1;
824
- }
825
- ignoreMutation(e) {
826
- return e.type != "selection" || this.widget.spec.ignoreSelection;
827
- }
828
- destroy() {
829
- this.widget.type.destroy(this.dom), super.destroy();
830
- }
831
- get domAtom() {
832
- return !0;
833
- }
834
- get ignoreForSelection() {
835
- return !!this.widget.type.spec.relaxedSide;
836
- }
837
- get side() {
838
- return this.widget.type.side;
839
- }
840
- }
841
- class Gn extends Me {
842
- constructor(e, n, o, i) {
843
- super(e, [], n, null), this.textDOM = o, this.text = i;
844
- }
845
- get size() {
846
- return this.text.length;
847
- }
848
- localPosFromDOM(e, n) {
849
- return e != this.textDOM ? this.posAtStart + (n ? this.size : 0) : this.posAtStart + n;
850
- }
851
- domFromPos(e) {
852
- return { node: this.textDOM, offset: e };
853
- }
854
- ignoreMutation(e) {
855
- return e.type === "characterData" && e.target.nodeValue == e.oldValue;
856
- }
857
- }
858
- class le extends Me {
859
- constructor(e, n, o, i, s) {
860
- super(e, [], o, i), this.mark = n, this.spec = s;
861
- }
862
- static create(e, n, o, i) {
863
- let s = i.nodeViews[n.type.name], r = s && s(n, i, o);
864
- return (!r || !r.dom) && (r = Ve.renderSpec(document, n.type.spec.toDOM(n, o), null, n.attrs)), new le(e, n, r.dom, r.contentDOM || r.dom, r);
865
- }
866
- parseRule() {
867
- return this.dirty & q || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
868
- }
869
- matchesMark(e) {
870
- return this.dirty != q && this.mark.eq(e);
871
- }
872
- markDirty(e, n) {
873
- if (super.markDirty(e, n), this.dirty != F) {
874
- let o = this.parent;
875
- for (; !o.node; )
876
- o = o.parent;
877
- o.dirty < this.dirty && (o.dirty = this.dirty), this.dirty = F;
878
- }
879
- }
880
- slice(e, n, o) {
881
- let i = le.create(this.parent, this.mark, !0, o), s = this.children, r = this.size;
882
- n < r && (s = Ue(s, n, r, o)), e > 0 && (s = Ue(s, 0, e, o));
883
- for (let l = 0; l < s.length; l++)
884
- s[l].parent = i;
885
- return i.children = s, i;
886
- }
887
- ignoreMutation(e) {
888
- return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
889
- }
890
- destroy() {
891
- this.spec.destroy && this.spec.destroy(), super.destroy();
892
- }
893
- }
894
- class Z extends Me {
895
- constructor(e, n, o, i, s, r, l, a, c) {
896
- super(e, [], s, r), this.node = n, this.outerDeco = o, this.innerDeco = i, this.nodeDOM = l;
897
- }
898
- // By default, a node is rendered using the `toDOM` method from the
899
- // node type spec. But client code can use the `nodeViews` spec to
900
- // supply a custom node view, which can influence various aspects of
901
- // the way the node works.
902
- //
903
- // (Using subclassing for this was intentionally decided against,
904
- // since it'd require exposing a whole slew of finicky
905
- // implementation details to the user code that they probably will
906
- // never need.)
907
- static create(e, n, o, i, s, r) {
908
- let l = s.nodeViews[n.type.name], a, c = l && l(n, s, () => {
909
- if (!a)
910
- return r;
911
- if (a.parent)
912
- return a.parent.posBeforeChild(a);
913
- }, o, i), d = c && c.dom, f = c && c.contentDOM;
914
- if (n.isText) {
915
- if (!d)
916
- d = document.createTextNode(n.text);
917
- else if (d.nodeType != 3)
918
- throw new RangeError("Text must be rendered as a DOM text node");
919
- } else d || ({ dom: d, contentDOM: f } = Ve.renderSpec(document, n.type.spec.toDOM(n), null, n.attrs));
920
- !f && !n.isText && d.nodeName != "BR" && (d.hasAttribute("contenteditable") || (d.contentEditable = "false"), n.type.spec.draggable && (d.draggable = !0));
921
- let u = d;
922
- return d = Qt(d, o, n), c ? a = new Xn(e, n, o, i, d, f || null, u, c, s, r + 1) : n.isText ? new Be(e, n, o, i, d, u, s) : new Z(e, n, o, i, d, f || null, u, s, r + 1);
923
- }
924
- parseRule() {
925
- if (this.node.type.spec.reparseInView)
926
- return null;
927
- let e = { node: this.node.type.name, attrs: this.node.attrs };
928
- if (this.node.type.whitespace == "pre" && (e.preserveWhitespace = "full"), !this.contentDOM)
929
- e.getContent = () => this.node.content;
930
- else if (!this.contentLost)
931
- e.contentElement = this.contentDOM;
932
- else {
933
- for (let n = this.children.length - 1; n >= 0; n--) {
934
- let o = this.children[n];
935
- if (this.dom.contains(o.dom.parentNode)) {
936
- e.contentElement = o.dom.parentNode;
937
- break;
938
- }
939
- }
940
- e.contentElement || (e.getContent = () => j.empty);
941
- }
942
- return e;
943
- }
944
- matchesNode(e, n, o) {
945
- return this.dirty == F && e.eq(this.node) && ke(n, this.outerDeco) && o.eq(this.innerDeco);
946
- }
947
- get size() {
948
- return this.node.nodeSize;
949
- }
950
- get border() {
951
- return this.node.isLeaf ? 0 : 1;
952
- }
953
- // Syncs `this.children` to match `this.node.content` and the local
954
- // decorations, possibly introducing nesting for marks. Then, in a
955
- // separate step, syncs the DOM inside `this.contentDOM` to
956
- // `this.children`.
957
- updateChildren(e, n) {
958
- let o = this.node.inlineContent, i = n, s = e.composing ? this.localCompositionInfo(e, n) : null, r = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new Zn(this, r && r.node, e);
959
- vn(this.node, this.innerDeco, (c, d, f) => {
960
- c.spec.marks ? a.syncToMarks(c.spec.marks, o, e) : c.type.side >= 0 && !f && a.syncToMarks(d == this.node.childCount ? Sn.none : this.node.child(d).marks, o, e), a.placeWidget(c, e, i);
961
- }, (c, d, f, u) => {
962
- a.syncToMarks(c.marks, o, e);
963
- let p;
964
- a.findNodeMatch(c, d, f, u) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (p = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, d, f, p, e) || a.updateNextNode(c, d, f, e, u, i) || a.addNode(c, d, f, e, i), i += c.nodeSize;
965
- }), a.syncToMarks([], o, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == te) && (r && this.protectLocalComposition(e, r), Jt(this.contentDOM, this.children, e), ue && eo(this.dom));
966
- }
967
- localCompositionInfo(e, n) {
968
- let { from: o, to: i } = e.state.selection;
969
- if (!(e.state.selection instanceof x) || o < n || i > n + this.node.content.size)
970
- return null;
971
- let s = e.input.compositionNode;
972
- if (!s || !this.dom.contains(s.parentNode))
973
- return null;
974
- if (this.node.inlineContent) {
975
- let r = s.nodeValue, l = to(this.node.content, r, o - n, i - n);
976
- return l < 0 ? null : { node: s, pos: l, text: r };
977
- } else
978
- return { node: s, pos: -1, text: "" };
979
- }
980
- protectLocalComposition(e, { node: n, pos: o, text: i }) {
981
- if (this.getDesc(n))
982
- return;
983
- let s = n;
984
- for (; s.parentNode != this.contentDOM; s = s.parentNode) {
985
- for (; s.previousSibling; )
986
- s.parentNode.removeChild(s.previousSibling);
987
- for (; s.nextSibling; )
988
- s.parentNode.removeChild(s.nextSibling);
989
- s.pmViewDesc && (s.pmViewDesc = void 0);
990
- }
991
- let r = new Gn(this, s, n, i);
992
- e.input.compositionNodes.push(r), this.children = Ue(this.children, o, o + i.length, e, r);
993
- }
994
- // If this desc must be updated to match the given node decoration,
995
- // do so and return true.
996
- update(e, n, o, i) {
997
- return this.dirty == q || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, n, o, i), !0);
998
- }
999
- updateInner(e, n, o, i) {
1000
- this.updateOuterDeco(n), this.node = e, this.innerDeco = o, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = F;
1001
- }
1002
- updateOuterDeco(e) {
1003
- if (ke(e, this.outerDeco))
1004
- return;
1005
- let n = this.nodeDOM.nodeType != 1, o = this.dom;
1006
- this.dom = Zt(this.dom, this.nodeDOM, je(this.outerDeco, this.node, n), je(e, this.node, n)), this.dom != o && (o.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
1007
- }
1008
- // Mark this node as being the selected node.
1009
- selectNode() {
1010
- this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.nodeDOM.draggable = !0));
1011
- }
1012
- // Remove selected node marking from this node.
1013
- deselectNode() {
1014
- this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.nodeDOM.removeAttribute("draggable"));
1015
- }
1016
- get domAtom() {
1017
- return this.node.isAtom;
1018
- }
1019
- }
1020
- function ut(t, e, n, o, i) {
1021
- Qt(o, e, t);
1022
- let s = new Z(void 0, t, e, n, o, o, o, i, 0);
1023
- return s.contentDOM && s.updateChildren(i, 0), s;
1024
- }
1025
- class Be extends Z {
1026
- constructor(e, n, o, i, s, r, l) {
1027
- super(e, n, o, i, s, null, r, l, 0);
1028
- }
1029
- parseRule() {
1030
- let e = this.nodeDOM.parentNode;
1031
- for (; e && e != this.dom && !e.pmIsDeco; )
1032
- e = e.parentNode;
1033
- return { skip: e || !0 };
1034
- }
1035
- update(e, n, o, i) {
1036
- return this.dirty == q || this.dirty != F && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(n), (this.dirty != F || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = F, !0);
1037
- }
1038
- inParent() {
1039
- let e = this.parent.contentDOM;
1040
- for (let n = this.nodeDOM; n; n = n.parentNode)
1041
- if (n == e)
1042
- return !0;
1043
- return !1;
1044
- }
1045
- domFromPos(e) {
1046
- return { node: this.nodeDOM, offset: e };
1047
- }
1048
- localPosFromDOM(e, n, o) {
1049
- return e == this.nodeDOM ? this.posAtStart + Math.min(n, this.node.text.length) : super.localPosFromDOM(e, n, o);
1050
- }
1051
- ignoreMutation(e) {
1052
- return e.type != "characterData" && e.type != "selection";
1053
- }
1054
- slice(e, n, o) {
1055
- let i = this.node.cut(e, n), s = document.createTextNode(i.text);
1056
- return new Be(this.parent, i, this.outerDeco, this.innerDeco, s, s, o);
1057
- }
1058
- markDirty(e, n) {
1059
- super.markDirty(e, n), this.dom != this.nodeDOM && (e == 0 || n == this.nodeDOM.nodeValue.length) && (this.dirty = q);
1060
- }
1061
- get domAtom() {
1062
- return !1;
1063
- }
1064
- isText(e) {
1065
- return this.node.text == e;
1066
- }
1067
- }
1068
- class Xt extends Me {
1069
- parseRule() {
1070
- return { ignore: !0 };
1071
- }
1072
- matchesHack(e) {
1073
- return this.dirty == F && this.dom.nodeName == e;
1074
- }
1075
- get domAtom() {
1076
- return !0;
1077
- }
1078
- get ignoreForCoords() {
1079
- return this.dom.nodeName == "IMG";
1080
- }
1081
- }
1082
- class Xn extends Z {
1083
- constructor(e, n, o, i, s, r, l, a, c, d) {
1084
- super(e, n, o, i, s, r, l, c, d), this.spec = a;
1085
- }
1086
- // A custom `update` method gets to decide whether the update goes
1087
- // through. If it does, and there's a `contentDOM` node, our logic
1088
- // updates the children.
1089
- update(e, n, o, i) {
1090
- if (this.dirty == q)
1091
- return !1;
1092
- if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
1093
- let s = this.spec.update(e, n, o);
1094
- return s && this.updateInner(e, n, o, i), s;
1095
- } else return !this.contentDOM && !e.isLeaf ? !1 : super.update(e, n, o, i);
1096
- }
1097
- selectNode() {
1098
- this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
1099
- }
1100
- deselectNode() {
1101
- this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
1102
- }
1103
- setSelection(e, n, o, i) {
1104
- this.spec.setSelection ? this.spec.setSelection(e, n, o.root) : super.setSelection(e, n, o, i);
1105
- }
1106
- destroy() {
1107
- this.spec.destroy && this.spec.destroy(), super.destroy();
1108
- }
1109
- stopEvent(e) {
1110
- return this.spec.stopEvent ? this.spec.stopEvent(e) : !1;
1111
- }
1112
- ignoreMutation(e) {
1113
- return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
1114
- }
1115
- }
1116
- function Jt(t, e, n) {
1117
- let o = t.firstChild, i = !1;
1118
- for (let s = 0; s < e.length; s++) {
1119
- let r = e[s], l = r.dom;
1120
- if (l.parentNode == t) {
1121
- for (; l != o; )
1122
- o = pt(o), i = !0;
1123
- o = o.nextSibling;
1124
- } else
1125
- i = !0, t.insertBefore(l, o);
1126
- if (r instanceof le) {
1127
- let a = o ? o.previousSibling : t.lastChild;
1128
- Jt(r.contentDOM, r.children, n), o = a ? a.nextSibling : t.firstChild;
1129
- }
1130
- }
1131
- for (; o; )
1132
- o = pt(o), i = !0;
1133
- i && n.trackWrites == t && (n.trackWrites = null);
1134
- }
1135
- const ge = function(t) {
1136
- t && (this.nodeName = t);
1137
- };
1138
- ge.prototype = /* @__PURE__ */ Object.create(null);
1139
- const ne = [new ge()];
1140
- function je(t, e, n) {
1141
- if (t.length == 0)
1142
- return ne;
1143
- let o = n ? ne[0] : new ge(), i = [o];
1144
- for (let s = 0; s < t.length; s++) {
1145
- let r = t[s].type.attrs;
1146
- if (r) {
1147
- r.nodeName && i.push(o = new ge(r.nodeName));
1148
- for (let l in r) {
1149
- let a = r[l];
1150
- a != null && (n && i.length == 1 && i.push(o = new ge(e.isInline ? "span" : "div")), l == "class" ? o.class = (o.class ? o.class + " " : "") + a : l == "style" ? o.style = (o.style ? o.style + ";" : "") + a : l != "nodeName" && (o[l] = a));
1151
- }
1152
- }
1153
- }
1154
- return i;
1155
- }
1156
- function Zt(t, e, n, o) {
1157
- if (n == ne && o == ne)
1158
- return e;
1159
- let i = e;
1160
- for (let s = 0; s < o.length; s++) {
1161
- let r = o[s], l = n[s];
1162
- if (s) {
1163
- let a;
1164
- l && l.nodeName == r.nodeName && i != t && (a = i.parentNode) && a.nodeName.toLowerCase() == r.nodeName || (a = document.createElement(r.nodeName), a.pmIsDeco = !0, a.appendChild(i), l = ne[0]), i = a;
1165
- }
1166
- Jn(i, l || ne[0], r);
1167
- }
1168
- return i;
1169
- }
1170
- function Jn(t, e, n) {
1171
- for (let o in e)
1172
- o != "class" && o != "style" && o != "nodeName" && !(o in n) && t.removeAttribute(o);
1173
- for (let o in n)
1174
- o != "class" && o != "style" && o != "nodeName" && n[o] != e[o] && t.setAttribute(o, n[o]);
1175
- if (e.class != n.class) {
1176
- let o = e.class ? e.class.split(" ").filter(Boolean) : [], i = n.class ? n.class.split(" ").filter(Boolean) : [];
1177
- for (let s = 0; s < o.length; s++)
1178
- i.indexOf(o[s]) == -1 && t.classList.remove(o[s]);
1179
- for (let s = 0; s < i.length; s++)
1180
- o.indexOf(i[s]) == -1 && t.classList.add(i[s]);
1181
- t.classList.length == 0 && t.removeAttribute("class");
1182
- }
1183
- if (e.style != n.style) {
1184
- if (e.style) {
1185
- let o = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, i;
1186
- for (; i = o.exec(e.style); )
1187
- t.style.removeProperty(i[1]);
1188
- }
1189
- n.style && (t.style.cssText += n.style);
1190
- }
1191
- }
1192
- function Qt(t, e, n) {
1193
- return Zt(t, t, ne, je(e, n, t.nodeType != 1));
1194
- }
1195
- function ke(t, e) {
1196
- if (t.length != e.length)
1197
- return !1;
1198
- for (let n = 0; n < t.length; n++)
1199
- if (!t[n].type.eq(e[n].type))
1200
- return !1;
1201
- return !0;
1202
- }
1203
- function pt(t) {
1204
- let e = t.nextSibling;
1205
- return t.parentNode.removeChild(t), e;
1206
- }
1207
- class Zn {
1208
- constructor(e, n, o) {
1209
- this.lock = n, this.view = o, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = Qn(e.node.content, e);
1210
- }
1211
- // Destroy and remove the children between the given indices in
1212
- // `this.top`.
1213
- destroyBetween(e, n) {
1214
- if (e != n) {
1215
- for (let o = e; o < n; o++)
1216
- this.top.children[o].destroy();
1217
- this.top.children.splice(e, n - e), this.changed = !0;
1218
- }
1219
- }
1220
- // Destroy all remaining children in `this.top`.
1221
- destroyRest() {
1222
- this.destroyBetween(this.index, this.top.children.length);
1223
- }
1224
- // Sync the current stack of mark descs with the given array of
1225
- // marks, reusing existing mark descs when possible.
1226
- syncToMarks(e, n, o) {
1227
- let i = 0, s = this.stack.length >> 1, r = Math.min(s, e.length);
1228
- for (; i < r && (i == s - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1; )
1229
- i++;
1230
- for (; i < s; )
1231
- this.destroyRest(), this.top.dirty = F, this.index = this.stack.pop(), this.top = this.stack.pop(), s--;
1232
- for (; s < e.length; ) {
1233
- this.stack.push(this.top, this.index + 1);
1234
- let l = -1;
1235
- for (let a = this.index; a < Math.min(this.index + 3, this.top.children.length); a++) {
1236
- let c = this.top.children[a];
1237
- if (c.matchesMark(e[s]) && !this.isLocked(c.dom)) {
1238
- l = a;
1239
- break;
1240
- }
1241
- }
1242
- if (l > -1)
1243
- l > this.index && (this.changed = !0, this.destroyBetween(this.index, l)), this.top = this.top.children[this.index];
1244
- else {
1245
- let a = le.create(this.top, e[s], n, o);
1246
- this.top.children.splice(this.index, 0, a), this.top = a, this.changed = !0;
1247
- }
1248
- this.index = 0, s++;
1249
- }
1250
- }
1251
- // Try to find a node desc matching the given data. Skip over it and
1252
- // return true when successful.
1253
- findNodeMatch(e, n, o, i) {
1254
- let s = -1, r;
1255
- if (i >= this.preMatch.index && (r = this.preMatch.matches[i - this.preMatch.index]).parent == this.top && r.matchesNode(e, n, o))
1256
- s = this.top.children.indexOf(r, this.index);
1257
- else
1258
- for (let l = this.index, a = Math.min(this.top.children.length, l + 5); l < a; l++) {
1259
- let c = this.top.children[l];
1260
- if (c.matchesNode(e, n, o) && !this.preMatch.matched.has(c)) {
1261
- s = l;
1262
- break;
1263
- }
1264
- }
1265
- return s < 0 ? !1 : (this.destroyBetween(this.index, s), this.index++, !0);
1266
- }
1267
- updateNodeAt(e, n, o, i, s) {
1268
- let r = this.top.children[i];
1269
- return r.dirty == q && r.dom == r.contentDOM && (r.dirty = te), r.update(e, n, o, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
1270
- }
1271
- findIndexWithChild(e) {
1272
- for (; ; ) {
1273
- let n = e.parentNode;
1274
- if (!n)
1275
- return -1;
1276
- if (n == this.top.contentDOM) {
1277
- let o = e.pmViewDesc;
1278
- if (o) {
1279
- for (let i = this.index; i < this.top.children.length; i++)
1280
- if (this.top.children[i] == o)
1281
- return i;
1282
- }
1283
- return -1;
1284
- }
1285
- e = n;
1286
- }
1287
- }
1288
- // Try to update the next node, if any, to the given data. Checks
1289
- // pre-matches to avoid overwriting nodes that could still be used.
1290
- updateNextNode(e, n, o, i, s, r) {
1291
- for (let l = this.index; l < this.top.children.length; l++) {
1292
- let a = this.top.children[l];
1293
- if (a instanceof Z) {
1294
- let c = this.preMatch.matched.get(a);
1295
- if (c != null && c != s)
1296
- return !1;
1297
- let d = a.dom, f, u = this.isLocked(d) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != q && ke(n, a.outerDeco));
1298
- if (!u && a.update(e, n, o, i))
1299
- return this.destroyBetween(this.index, l), a.dom != d && (this.changed = !0), this.index++, !0;
1300
- if (!u && (f = this.recreateWrapper(a, e, n, o, i, r)))
1301
- return this.destroyBetween(this.index, l), this.top.children[this.index] = f, f.contentDOM && (f.dirty = te, f.updateChildren(i, r + 1), f.dirty = F), this.changed = !0, this.index++, !0;
1302
- break;
1303
- }
1304
- }
1305
- return !1;
1306
- }
1307
- // When a node with content is replaced by a different node with
1308
- // identical content, move over its children.
1309
- recreateWrapper(e, n, o, i, s, r) {
1310
- if (e.dirty || n.isAtom || !e.children.length || !e.node.content.eq(n.content) || !ke(o, e.outerDeco) || !i.eq(e.innerDeco))
1311
- return null;
1312
- let l = Z.create(this.top, n, o, i, s, r);
1313
- if (l.contentDOM) {
1314
- l.children = e.children, e.children = [];
1315
- for (let a of l.children)
1316
- a.parent = l;
1317
- }
1318
- return e.destroy(), l;
1319
- }
1320
- // Insert the node as a newly created node desc.
1321
- addNode(e, n, o, i, s) {
1322
- let r = Z.create(this.top, e, n, o, i, s);
1323
- r.contentDOM && r.updateChildren(i, s + 1), this.top.children.splice(this.index++, 0, r), this.changed = !0;
1324
- }
1325
- placeWidget(e, n, o) {
1326
- let i = this.index < this.top.children.length ? this.top.children[this.index] : null;
1327
- if (i && i.matchesWidget(e) && (e == i.widget || !i.widget.type.toDOM.parentNode))
1328
- this.index++;
1329
- else {
1330
- let s = new Gt(this.top, e, n, o);
1331
- this.top.children.splice(this.index++, 0, s), this.changed = !0;
1332
- }
1333
- }
1334
- // Make sure a textblock looks and behaves correctly in
1335
- // contentEditable.
1336
- addTextblockHacks() {
1337
- let e = this.top.children[this.index - 1], n = this.top;
1338
- for (; e instanceof le; )
1339
- n = e, e = n.children[n.children.length - 1];
1340
- (!e || // Empty textblock
1341
- !(e instanceof Be) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((k || M) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", n), this.addHackNode("BR", this.top));
1342
- }
1343
- addHackNode(e, n) {
1344
- if (n == this.top && this.index < n.children.length && n.children[this.index].matchesHack(e))
1345
- this.index++;
1346
- else {
1347
- let o = document.createElement(e);
1348
- e == "IMG" && (o.className = "ProseMirror-separator", o.alt = ""), e == "BR" && (o.className = "ProseMirror-trailingBreak");
1349
- let i = new Xt(this.top, [], o, null);
1350
- n != this.top ? n.children.push(i) : n.children.splice(this.index++, 0, i), this.changed = !0;
1351
- }
1352
- }
1353
- isLocked(e) {
1354
- return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
1355
- }
1356
- }
1357
- function Qn(t, e) {
1358
- let n = e, o = n.children.length, i = t.childCount, s = /* @__PURE__ */ new Map(), r = [];
1359
- e: for (; i > 0; ) {
1360
- let l;
1361
- for (; ; )
1362
- if (o) {
1363
- let c = n.children[o - 1];
1364
- if (c instanceof le)
1365
- n = c, o = c.children.length;
1366
- else {
1367
- l = c, o--;
1368
- break;
1369
- }
1370
- } else {
1371
- if (n == e)
1372
- break e;
1373
- o = n.parent.children.indexOf(n), n = n.parent;
1374
- }
1375
- let a = l.node;
1376
- if (a) {
1377
- if (a != t.child(i - 1))
1378
- break;
1379
- --i, s.set(l, i), r.push(l);
1380
- }
1381
- }
1382
- return { index: i, matched: s, matches: r.reverse() };
1383
- }
1384
- function wn(t, e) {
1385
- return t.type.side - e.type.side;
1386
- }
1387
- function vn(t, e, n, o) {
1388
- let i = e.locals(t), s = 0;
1389
- if (i.length == 0) {
1390
- for (let c = 0; c < t.childCount; c++) {
1391
- let d = t.child(c);
1392
- o(d, i, e.forChild(s, d), c), s += d.nodeSize;
1393
- }
1394
- return;
1395
- }
1396
- let r = 0, l = [], a = null;
1397
- for (let c = 0; ; ) {
1398
- let d, f;
1399
- for (; r < i.length && i[r].to == s; ) {
1400
- let m = i[r++];
1401
- m.widget && (d ? (f || (f = [d])).push(m) : d = m);
1402
- }
1403
- if (d)
1404
- if (f) {
1405
- f.sort(wn);
1406
- for (let m = 0; m < f.length; m++)
1407
- n(f[m], c, !!a);
1408
- } else
1409
- n(d, c, !!a);
1410
- let u, p;
1411
- if (a)
1412
- p = -1, u = a, a = null;
1413
- else if (c < t.childCount)
1414
- p = c, u = t.child(c++);
1415
- else
1416
- break;
1417
- for (let m = 0; m < l.length; m++)
1418
- l[m].to <= s && l.splice(m--, 1);
1419
- for (; r < i.length && i[r].from <= s && i[r].to > s; )
1420
- l.push(i[r++]);
1421
- let h = s + u.nodeSize;
1422
- if (u.isText) {
1423
- let m = h;
1424
- r < i.length && i[r].from < m && (m = i[r].from);
1425
- for (let y = 0; y < l.length; y++)
1426
- l[y].to < m && (m = l[y].to);
1427
- m < h && (a = u.cut(m - s), u = u.cut(0, m - s), h = m, p = -1);
1428
- } else
1429
- for (; r < i.length && i[r].to < h; )
1430
- r++;
1431
- let g = u.isInline && !u.isLeaf ? l.filter((m) => !m.inline) : l.slice();
1432
- o(u, g, e.forChild(s, u), p), s = h;
1433
- }
1434
- }
1435
- function eo(t) {
1436
- if (t.nodeName == "UL" || t.nodeName == "OL") {
1437
- let e = t.style.cssText;
1438
- t.style.cssText = e + "; list-style: square !important", window.getComputedStyle(t).listStyle, t.style.cssText = e;
1439
- }
1440
- }
1441
- function to(t, e, n, o) {
1442
- for (let i = 0, s = 0; i < t.childCount && s <= o; ) {
1443
- let r = t.child(i++), l = s;
1444
- if (s += r.nodeSize, !r.isText)
1445
- continue;
1446
- let a = r.text;
1447
- for (; i < t.childCount; ) {
1448
- let c = t.child(i++);
1449
- if (s += c.nodeSize, !c.isText)
1450
- break;
1451
- a += c.text;
1452
- }
1453
- if (s >= n) {
1454
- if (s >= o && a.slice(o - e.length - l, o - l) == e)
1455
- return o - e.length;
1456
- let c = l < o ? a.lastIndexOf(e, o - l - 1) : -1;
1457
- if (c >= 0 && c + e.length + l >= n)
1458
- return l + c;
1459
- if (n == o && a.length >= o + e.length - l && a.slice(o - l, o - l + e.length) == e)
1460
- return o;
1461
- }
1462
- }
1463
- return -1;
1464
- }
1465
- function Ue(t, e, n, o, i) {
1466
- let s = [];
1467
- for (let r = 0, l = 0; r < t.length; r++) {
1468
- let a = t[r], c = l, d = l += a.size;
1469
- c >= n || d <= e ? s.push(a) : (c < e && s.push(a.slice(0, e - c, o)), i && (s.push(i), i = void 0), d > n && s.push(a.slice(n - c, a.size, o)));
1470
- }
1471
- return s;
1472
- }
1473
- function Qe(t, e = null) {
1474
- let n = t.domSelectionRange(), o = t.state.doc;
1475
- if (!n.focusNode)
1476
- return null;
1477
- let i = t.docView.nearestDesc(n.focusNode), s = i && i.size == 0, r = t.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
1478
- if (r < 0)
1479
- return null;
1480
- let l = o.resolve(r), a, c;
1481
- if (Re(n)) {
1482
- for (a = r; i && !i.node; )
1483
- i = i.parent;
1484
- let f = i.node;
1485
- if (i && f.isAtom && D.isSelectable(f) && i.parent && !(f.isInline && Tn(n.focusNode, n.focusOffset, i.dom))) {
1486
- let u = i.posBefore;
1487
- c = new D(r == u ? l : o.resolve(u));
1488
- }
1489
- } else {
1490
- if (n instanceof t.dom.ownerDocument.defaultView.Selection && n.rangeCount > 1) {
1491
- let f = r, u = r;
1492
- for (let p = 0; p < n.rangeCount; p++) {
1493
- let h = n.getRangeAt(p);
1494
- f = Math.min(f, t.docView.posFromDOM(h.startContainer, h.startOffset, 1)), u = Math.max(u, t.docView.posFromDOM(h.endContainer, h.endOffset, -1));
1495
- }
1496
- if (f < 0)
1497
- return null;
1498
- [a, r] = u == t.state.selection.anchor ? [u, f] : [f, u], l = o.resolve(r);
1499
- } else
1500
- a = t.docView.posFromDOM(n.anchorNode, n.anchorOffset, 1);
1501
- if (a < 0)
1502
- return null;
1503
- }
1504
- let d = o.resolve(a);
1505
- if (!c) {
1506
- let f = e == "pointer" || t.state.selection.head < l.pos && !s ? 1 : -1;
1507
- c = we(t, d, l, f);
1508
- }
1509
- return c;
1510
- }
1511
- function wt(t) {
1512
- return t.editable ? t.hasFocus() : en(t) && document.activeElement && document.activeElement.contains(t.dom);
1513
- }
1514
- function _(t, e = !1) {
1515
- let n = t.state.selection;
1516
- if (vt(t, n), !!wt(t)) {
1517
- if (!e && t.input.mouseDown && t.input.mouseDown.allowDefault && M) {
1518
- let o = t.domSelectionRange(), i = t.domObserver.currentSelection;
1519
- if (o.anchorNode && i.anchorNode && re(o.anchorNode, o.anchorOffset, i.anchorNode, i.anchorOffset)) {
1520
- t.input.mouseDown.delayedSelectionSync = !0, t.domObserver.setCurSelection();
1521
- return;
1522
- }
1523
- }
1524
- if (t.domObserver.disconnectSelection(), t.cursorWrapper)
1525
- oo(t);
1526
- else {
1527
- let { anchor: o, head: i } = n, s, r;
1528
- mt && !(n instanceof x) && (n.$from.parent.inlineContent || (s = gt(t, n.from)), !n.empty && !n.$from.parent.inlineContent && (r = gt(t, n.to))), t.docView.setSelection(o, i, t, e), mt && (s && yt(s), r && yt(r)), n.visible ? t.dom.classList.remove("ProseMirror-hideselection") : (t.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && no(t));
1529
- }
1530
- t.domObserver.setCurSelection(), t.domObserver.connectSelection();
1531
- }
1532
- }
1533
- const mt = k || M && Kt < 63;
1534
- function gt(t, e) {
1535
- let { node: n, offset: o } = t.docView.domFromPos(e, 0), i = o < n.childNodes.length ? n.childNodes[o] : null, s = o ? n.childNodes[o - 1] : null;
1536
- if (k && i && i.contentEditable == "false")
1537
- return ze(i);
1538
- if ((!i || i.contentEditable == "false") && (!s || s.contentEditable == "false")) {
1539
- if (i)
1540
- return ze(i);
1541
- if (s)
1542
- return ze(s);
1543
- }
1544
- }
1545
- function ze(t) {
1546
- return t.contentEditable = "true", k && t.draggable && (t.draggable = !1, t.wasDraggable = !0), t;
1547
- }
1548
- function yt(t) {
1549
- t.contentEditable = "false", t.wasDraggable && (t.draggable = !0, t.wasDraggable = null);
1550
- }
1551
- function no(t) {
1552
- let e = t.dom.ownerDocument;
1553
- e.removeEventListener("selectionchange", t.input.hideSelectionGuard);
1554
- let n = t.domSelectionRange(), o = n.anchorNode, i = n.anchorOffset;
1555
- e.addEventListener("selectionchange", t.input.hideSelectionGuard = () => {
1556
- (n.anchorNode != o || n.anchorOffset != i) && (e.removeEventListener("selectionchange", t.input.hideSelectionGuard), setTimeout(() => {
1557
- (!wt(t) || t.state.selection.visible) && t.dom.classList.remove("ProseMirror-hideselection");
1558
- }, 20));
1559
- });
1560
- }
1561
- function oo(t) {
1562
- let e = t.domSelection();
1563
- if (!e)
1564
- return;
1565
- let n = t.cursorWrapper.dom, o = n.nodeName == "IMG";
1566
- o ? e.collapse(n.parentNode, C(n) + 1) : e.collapse(n, 0), !o && !t.state.selection.visible && P && J <= 11 && (n.disabled = !0, n.disabled = !1);
1567
- }
1568
- function vt(t, e) {
1569
- if (e instanceof D) {
1570
- let n = t.docView.descAt(e.from);
1571
- n != t.lastSelectedViewDesc && (bt(t), n && n.selectNode(), t.lastSelectedViewDesc = n);
1572
- } else
1573
- bt(t);
1574
- }
1575
- function bt(t) {
1576
- t.lastSelectedViewDesc && (t.lastSelectedViewDesc.parent && t.lastSelectedViewDesc.deselectNode(), t.lastSelectedViewDesc = void 0);
1577
- }
1578
- function we(t, e, n, o) {
1579
- return t.someProp("createSelectionBetween", (i) => i(t, e, n)) || x.between(e, n, o);
1580
- }
1581
- function Dt(t) {
1582
- return t.editable && !t.hasFocus() ? !1 : en(t);
1583
- }
1584
- function en(t) {
1585
- let e = t.domSelectionRange();
1586
- if (!e.anchorNode)
1587
- return !1;
1588
- try {
1589
- return t.dom.contains(e.anchorNode.nodeType == 3 ? e.anchorNode.parentNode : e.anchorNode) && (t.editable || t.dom.contains(e.focusNode.nodeType == 3 ? e.focusNode.parentNode : e.focusNode));
1590
- } catch {
1591
- return !1;
1592
- }
1593
- }
1594
- function io(t) {
1595
- let e = t.docView.domFromPos(t.state.selection.anchor, 0), n = t.domSelectionRange();
1596
- return re(e.node, e.offset, n.anchorNode, n.anchorOffset);
1597
- }
1598
- function Ye(t, e) {
1599
- let { $anchor: n, $head: o } = t.selection, i = e > 0 ? n.max(o) : n.min(o), s = i.parent.inlineContent ? i.depth ? t.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
1600
- return s && be.findFrom(s, e);
1601
- }
1602
- function Y(t, e) {
1603
- return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()), !0;
1604
- }
1605
- function Nt(t, e, n) {
1606
- let o = t.state.selection;
1607
- if (o instanceof x)
1608
- if (n.indexOf("s") > -1) {
1609
- let { $head: i } = o, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
1610
- if (!s || s.isText || !s.isLeaf)
1611
- return !1;
1612
- let r = t.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
1613
- return Y(t, new x(o.$anchor, r));
1614
- } else if (o.empty) {
1615
- if (t.endOfTextblock(e > 0 ? "forward" : "backward")) {
1616
- let i = Ye(t.state, e);
1617
- return i && i instanceof D ? Y(t, i) : !1;
1618
- } else if (!(R && n.indexOf("m") > -1)) {
1619
- let i = o.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, r;
1620
- if (!s || s.isText)
1621
- return !1;
1622
- let l = e < 0 ? i.pos - s.nodeSize : i.pos;
1623
- return s.isAtom || (r = t.docView.descAt(l)) && !r.contentDOM ? D.isSelectable(s) ? Y(t, new D(e < 0 ? t.state.doc.resolve(i.pos - s.nodeSize) : i)) : Oe ? Y(t, new x(t.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
1624
- }
1625
- } else return !1;
1626
- else {
1627
- if (o instanceof D && o.node.isInline)
1628
- return Y(t, new x(e > 0 ? o.$to : o.$from));
1629
- {
1630
- let i = Ye(t.state, e);
1631
- return i ? Y(t, i) : !1;
1632
- }
1633
- }
1634
- }
1635
- function Te(t) {
1636
- return t.nodeType == 3 ? t.nodeValue.length : t.childNodes.length;
1637
- }
1638
- function ye(t, e) {
1639
- let n = t.pmViewDesc;
1640
- return n && n.size == 0 && (e < 0 || t.nextSibling || t.nodeName != "BR");
1641
- }
1642
- function ce(t, e) {
1643
- return e < 0 ? so(t) : ro(t);
1644
- }
1645
- function so(t) {
1646
- let e = t.domSelectionRange(), n = e.focusNode, o = e.focusOffset;
1647
- if (!n)
1648
- return;
1649
- let i, s, r = !1;
1650
- for (I && n.nodeType == 1 && o < Te(n) && ye(n.childNodes[o], -1) && (r = !0); ; )
1651
- if (o > 0) {
1652
- if (n.nodeType != 1)
1653
- break;
1654
- {
1655
- let l = n.childNodes[o - 1];
1656
- if (ye(l, -1))
1657
- i = n, s = --o;
1658
- else if (l.nodeType == 3)
1659
- n = l, o = n.nodeValue.length;
1660
- else
1661
- break;
1662
- }
1663
- } else {
1664
- if (tn(n))
1665
- break;
1666
- {
1667
- let l = n.previousSibling;
1668
- for (; l && ye(l, -1); )
1669
- i = n.parentNode, s = C(l), l = l.previousSibling;
1670
- if (l)
1671
- n = l, o = Te(n);
1672
- else {
1673
- if (n = n.parentNode, n == t.dom)
1674
- break;
1675
- o = 0;
1676
- }
1677
- }
1678
- }
1679
- r ? Ge(t, n, o) : i && Ge(t, i, s);
1680
- }
1681
- function ro(t) {
1682
- let e = t.domSelectionRange(), n = e.focusNode, o = e.focusOffset;
1683
- if (!n)
1684
- return;
1685
- let i = Te(n), s, r;
1686
- for (; ; )
1687
- if (o < i) {
1688
- if (n.nodeType != 1)
1689
- break;
1690
- let l = n.childNodes[o];
1691
- if (ye(l, 1))
1692
- s = n, r = ++o;
1693
- else
1694
- break;
1695
- } else {
1696
- if (tn(n))
1697
- break;
1698
- {
1699
- let l = n.nextSibling;
1700
- for (; l && ye(l, 1); )
1701
- s = l.parentNode, r = C(l) + 1, l = l.nextSibling;
1702
- if (l)
1703
- n = l, o = 0, i = Te(n);
1704
- else {
1705
- if (n = n.parentNode, n == t.dom)
1706
- break;
1707
- o = i = 0;
1708
- }
1709
- }
1710
- }
1711
- s && Ge(t, s, r);
1712
- }
1713
- function tn(t) {
1714
- let e = t.pmViewDesc;
1715
- return e && e.node && e.node.isBlock;
1716
- }
1717
- function lo(t, e) {
1718
- for (; t && e == t.childNodes.length && !Ce(t); )
1719
- e = C(t) + 1, t = t.parentNode;
1720
- for (; t && e < t.childNodes.length; ) {
1721
- let n = t.childNodes[e];
1722
- if (n.nodeType == 3)
1723
- return n;
1724
- if (n.nodeType == 1 && n.contentEditable == "false")
1725
- break;
1726
- t = n, e = 0;
1727
- }
1728
- }
1729
- function ao(t, e) {
1730
- for (; t && !e && !Ce(t); )
1731
- e = C(t), t = t.parentNode;
1732
- for (; t && e; ) {
1733
- let n = t.childNodes[e - 1];
1734
- if (n.nodeType == 3)
1735
- return n;
1736
- if (n.nodeType == 1 && n.contentEditable == "false")
1737
- break;
1738
- t = n, e = t.childNodes.length;
1739
- }
1740
- }
1741
- function Ge(t, e, n) {
1742
- if (e.nodeType != 3) {
1743
- let s, r;
1744
- (r = lo(e, n)) ? (e = r, n = 0) : (s = ao(e, n)) && (e = s, n = s.nodeValue.length);
1745
- }
1746
- let o = t.domSelection();
1747
- if (!o)
1748
- return;
1749
- if (Re(o)) {
1750
- let s = document.createRange();
1751
- s.setEnd(e, n), s.setStart(e, n), o.removeAllRanges(), o.addRange(s);
1752
- } else o.extend && o.extend(e, n);
1753
- t.domObserver.setCurSelection();
1754
- let { state: i } = t;
1755
- setTimeout(() => {
1756
- t.state == i && _(t);
1757
- }, 50);
1758
- }
1759
- function St(t, e) {
1760
- let n = t.state.doc.resolve(e);
1761
- if (!(M || Pn) && n.parent.inlineContent) {
1762
- let i = t.coordsAtPos(e);
1763
- if (e > n.start()) {
1764
- let s = t.coordsAtPos(e - 1), r = (s.top + s.bottom) / 2;
1765
- if (r > i.top && r < i.bottom && Math.abs(s.left - i.left) > 1)
1766
- return s.left < i.left ? "ltr" : "rtl";
1767
- }
1768
- if (e < n.end()) {
1769
- let s = t.coordsAtPos(e + 1), r = (s.top + s.bottom) / 2;
1770
- if (r > i.top && r < i.bottom && Math.abs(s.left - i.left) > 1)
1771
- return s.left > i.left ? "ltr" : "rtl";
1772
- }
1773
- }
1774
- return getComputedStyle(t.dom).direction == "rtl" ? "rtl" : "ltr";
1775
- }
1776
- function Ct(t, e, n) {
1777
- let o = t.state.selection;
1778
- if (o instanceof x && !o.empty || n.indexOf("s") > -1 || R && n.indexOf("m") > -1)
1779
- return !1;
1780
- let { $from: i, $to: s } = o;
1781
- if (!i.parent.inlineContent || t.endOfTextblock(e < 0 ? "up" : "down")) {
1782
- let r = Ye(t.state, e);
1783
- if (r && r instanceof D)
1784
- return Y(t, r);
1785
- }
1786
- if (!i.parent.inlineContent) {
1787
- let r = e < 0 ? i : s, l = o instanceof Nn ? be.near(r, e) : be.findFrom(r, e);
1788
- return l ? Y(t, l) : !1;
1789
- }
1790
- return !1;
1791
- }
1792
- function Ot(t, e) {
1793
- if (!(t.state.selection instanceof x))
1794
- return !0;
1795
- let { $head: n, $anchor: o, empty: i } = t.state.selection;
1796
- if (!n.sameParent(o))
1797
- return !0;
1798
- if (!i)
1799
- return !1;
1800
- if (t.endOfTextblock(e > 0 ? "forward" : "backward"))
1801
- return !0;
1802
- let s = !n.textOffset && (e < 0 ? n.nodeBefore : n.nodeAfter);
1803
- if (s && !s.isText) {
1804
- let r = t.state.tr;
1805
- return e < 0 ? r.delete(n.pos - s.nodeSize, n.pos) : r.delete(n.pos, n.pos + s.nodeSize), t.dispatch(r), !0;
1806
- }
1807
- return !1;
1808
- }
1809
- function Mt(t, e, n) {
1810
- t.domObserver.stop(), e.contentEditable = n, t.domObserver.start();
1811
- }
1812
- function co(t) {
1813
- if (!k || t.state.selection.$head.parentOffset > 0)
1814
- return !1;
1815
- let { focusNode: e, focusOffset: n } = t.domSelectionRange();
1816
- if (e && e.nodeType == 1 && n == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
1817
- let o = e.firstChild;
1818
- Mt(t, o, "true"), setTimeout(() => Mt(t, o, "false"), 20);
1819
- }
1820
- return !1;
1821
- }
1822
- function fo(t) {
1823
- let e = "";
1824
- return t.ctrlKey && (e += "c"), t.metaKey && (e += "m"), t.altKey && (e += "a"), t.shiftKey && (e += "s"), e;
1825
- }
1826
- function ho(t, e) {
1827
- let n = e.keyCode, o = fo(e);
1828
- if (n == 8 || R && n == 72 && o == "c")
1829
- return Ot(t, -1) || ce(t, -1);
1830
- if (n == 46 && !e.shiftKey || R && n == 68 && o == "c")
1831
- return Ot(t, 1) || ce(t, 1);
1832
- if (n == 13 || n == 27)
1833
- return !0;
1834
- if (n == 37 || R && n == 66 && o == "c") {
1835
- let i = n == 37 ? St(t, t.state.selection.from) == "ltr" ? -1 : 1 : -1;
1836
- return Nt(t, i, o) || ce(t, i);
1837
- } else if (n == 39 || R && n == 70 && o == "c") {
1838
- let i = n == 39 ? St(t, t.state.selection.from) == "ltr" ? 1 : -1 : 1;
1839
- return Nt(t, i, o) || ce(t, i);
1840
- } else {
1841
- if (n == 38 || R && n == 80 && o == "c")
1842
- return Ct(t, -1, o) || ce(t, -1);
1843
- if (n == 40 || R && n == 78 && o == "c")
1844
- return co(t) || Ct(t, 1, o) || ce(t, 1);
1845
- if (o == (R ? "m" : "c") && (n == 66 || n == 73 || n == 89 || n == 90))
1846
- return !0;
1847
- }
1848
- return !1;
1849
- }
1850
- function ve(t, e) {
1851
- t.someProp("transformCopied", (p) => {
1852
- e = p(e, t);
1853
- });
1854
- let n = [], { content: o, openStart: i, openEnd: s } = e;
1855
- for (; i > 1 && s > 1 && o.childCount == 1 && o.firstChild.childCount == 1; ) {
1856
- i--, s--;
1857
- let p = o.firstChild;
1858
- n.push(p.type.name, p.attrs != p.type.defaultAttrs ? p.attrs : null), o = p.content;
1859
- }
1860
- let r = t.someProp("clipboardSerializer") || Ve.fromSchema(t.state.schema), l = an(), a = l.createElement("div");
1861
- a.appendChild(r.serializeFragment(o, { document: l }));
1862
- let c = a.firstChild, d, f = 0;
1863
- for (; c && c.nodeType == 1 && (d = ln[c.nodeName.toLowerCase()]); ) {
1864
- for (let p = d.length - 1; p >= 0; p--) {
1865
- let h = l.createElement(d[p]);
1866
- for (; a.firstChild; )
1867
- h.appendChild(a.firstChild);
1868
- a.appendChild(h), f++;
1869
- }
1870
- c = a.firstChild;
1871
- }
1872
- c && c.nodeType == 1 && c.setAttribute("data-pm-slice", `${i} ${s}${f ? ` -${f}` : ""} ${JSON.stringify(n)}`);
1873
- let u = t.someProp("clipboardTextSerializer", (p) => p(e, t)) || e.content.textBetween(0, e.content.size, `
1874
-
1875
- `);
1876
- return { dom: a, text: u, slice: e };
1877
- }
1878
- function nn(t, e, n, o, i) {
1879
- let s = i.parent.type.spec.code, r, l;
1880
- if (!n && !e)
1881
- return null;
1882
- let a = !!e && (o || s || !n);
1883
- if (a) {
1884
- if (t.someProp("transformPastedText", (u) => {
1885
- e = u(e, s || o, t);
1886
- }), s)
1887
- return l = new se(j.from(t.state.schema.text(e.replace(/\r\n?/g, `
1888
- `))), 0, 0), t.someProp("transformPasted", (u) => {
1889
- l = u(l, t, !0);
1890
- }), l;
1891
- let f = t.someProp("clipboardTextParser", (u) => u(e, i, o, t));
1892
- if (f)
1893
- l = f;
1894
- else {
1895
- let u = i.marks(), { schema: p } = t.state, h = Ve.fromSchema(p);
1896
- r = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((g) => {
1897
- let m = r.appendChild(document.createElement("p"));
1898
- g && m.appendChild(h.serializeNode(p.text(g, u)));
1899
- });
1900
- }
1901
- } else
1902
- t.someProp("transformPastedHTML", (f) => {
1903
- n = f(n, t);
1904
- }), r = go(n), Oe && yo(r);
1905
- let c = r && r.querySelector("[data-pm-slice]"), d = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
1906
- if (d && d[3])
1907
- for (let f = +d[3]; f > 0; f--) {
1908
- let u = r.firstChild;
1909
- for (; u && u.nodeType != 1; )
1910
- u = u.nextSibling;
1911
- if (!u)
1912
- break;
1913
- r = u;
1914
- }
1915
- if (l || (l = (t.someProp("clipboardParser") || t.someProp("domParser") || $t.fromSchema(t.state.schema)).parseSlice(r, {
1916
- preserveWhitespace: !!(a || d),
1917
- context: i,
1918
- ruleFromNode(u) {
1919
- return u.nodeName == "BR" && !u.nextSibling && u.parentNode && !uo.test(u.parentNode.nodeName) ? { ignore: !0 } : null;
1920
- }
1921
- })), d)
1922
- l = bo(xt(l, +d[1], +d[2]), d[4]);
1923
- else if (l = se.maxOpen(po(l.content, i), !0), l.openStart || l.openEnd) {
1924
- let f = 0, u = 0;
1925
- for (let p = l.content.firstChild; f < l.openStart && !p.type.spec.isolating; f++, p = p.firstChild)
1926
- ;
1927
- for (let p = l.content.lastChild; u < l.openEnd && !p.type.spec.isolating; u++, p = p.lastChild)
1928
- ;
1929
- l = xt(l, f, u);
1930
- }
1931
- return t.someProp("transformPasted", (f) => {
1932
- l = f(l, t, a);
1933
- }), l;
1934
- }
1935
- const uo = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
1936
- function po(t, e) {
1937
- if (t.childCount < 2)
1938
- return t;
1939
- for (let n = e.depth; n >= 0; n--) {
1940
- let i = e.node(n).contentMatchAt(e.index(n)), s, r = [];
1941
- if (t.forEach((l) => {
1942
- if (!r)
1943
- return;
1944
- let a = i.findWrapping(l.type), c;
1945
- if (!a)
1946
- return r = null;
1947
- if (c = r.length && s.length && sn(a, s, l, r[r.length - 1], 0))
1948
- r[r.length - 1] = c;
1949
- else {
1950
- r.length && (r[r.length - 1] = rn(r[r.length - 1], s.length));
1951
- let d = on(l, a);
1952
- r.push(d), i = i.matchType(d.type), s = a;
1953
- }
1954
- }), r)
1955
- return j.from(r);
1956
- }
1957
- return t;
1958
- }
1959
- function on(t, e, n = 0) {
1960
- for (let o = e.length - 1; o >= n; o--)
1961
- t = e[o].create(null, j.from(t));
1962
- return t;
1963
- }
1964
- function sn(t, e, n, o, i) {
1965
- if (i < t.length && i < e.length && t[i] == e[i]) {
1966
- let s = sn(t, e, n, o.lastChild, i + 1);
1967
- if (s)
1968
- return o.copy(o.content.replaceChild(o.childCount - 1, s));
1969
- if (o.contentMatchAt(o.childCount).matchType(i == t.length - 1 ? n.type : t[i + 1]))
1970
- return o.copy(o.content.append(j.from(on(n, t, i + 1))));
1971
- }
1972
- }
1973
- function rn(t, e) {
1974
- if (e == 0)
1975
- return t;
1976
- let n = t.content.replaceChild(t.childCount - 1, rn(t.lastChild, e - 1)), o = t.contentMatchAt(t.childCount).fillBefore(j.empty, !0);
1977
- return t.copy(n.append(o));
1978
- }
1979
- function Xe(t, e, n, o, i, s) {
1980
- let r = e < 0 ? t.firstChild : t.lastChild, l = r.content;
1981
- return t.childCount > 1 && (s = 0), i < o - 1 && (l = Xe(l, e, n, o, i + 1, s)), i >= n && (l = e < 0 ? r.contentMatchAt(0).fillBefore(l, s <= i).append(l) : l.append(r.contentMatchAt(r.childCount).fillBefore(j.empty, !0))), t.replaceChild(e < 0 ? 0 : t.childCount - 1, r.copy(l));
1982
- }
1983
- function xt(t, e, n) {
1984
- return e < t.openStart && (t = new se(Xe(t.content, -1, e, t.openStart, 0, t.openEnd), e, t.openEnd)), n < t.openEnd && (t = new se(Xe(t.content, 1, n, t.openEnd, 0, 0), t.openStart, n)), t;
1985
- }
1986
- const ln = {
1987
- thead: ["table"],
1988
- tbody: ["table"],
1989
- tfoot: ["table"],
1990
- caption: ["table"],
1991
- colgroup: ["table"],
1992
- col: ["table", "colgroup"],
1993
- tr: ["table", "tbody"],
1994
- td: ["table", "tbody", "tr"],
1995
- th: ["table", "tbody", "tr"]
1996
- };
1997
- let kt = null;
1998
- function an() {
1999
- return kt || (kt = document.implementation.createHTMLDocument("title"));
2000
- }
2001
- let Le = null;
2002
- function mo(t) {
2003
- let e = window.trustedTypes;
2004
- return e ? (Le || (Le = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (n) => n })), Le.createHTML(t)) : t;
2005
- }
2006
- function go(t) {
2007
- let e = /^(\s*<meta [^>]*>)*/.exec(t);
2008
- e && (t = t.slice(e[0].length));
2009
- let n = an().createElement("div"), o = /<([a-z][^>\s]+)/i.exec(t), i;
2010
- if ((i = o && ln[o[1].toLowerCase()]) && (t = i.map((s) => "<" + s + ">").join("") + t + i.map((s) => "</" + s + ">").reverse().join("")), n.innerHTML = mo(t), i)
2011
- for (let s = 0; s < i.length; s++)
2012
- n = n.querySelector(i[s]) || n;
2013
- return n;
2014
- }
2015
- function yo(t) {
2016
- let e = t.querySelectorAll(M ? "span:not([class]):not([style])" : "span.Apple-converted-space");
2017
- for (let n = 0; n < e.length; n++) {
2018
- let o = e[n];
2019
- o.childNodes.length == 1 && o.textContent == " " && o.parentNode && o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "), o);
2020
- }
2021
- }
2022
- function bo(t, e) {
2023
- if (!t.size)
2024
- return t;
2025
- let n = t.content.firstChild.type.schema, o;
2026
- try {
2027
- o = JSON.parse(e);
2028
- } catch {
2029
- return t;
2030
- }
2031
- let { content: i, openStart: s, openEnd: r } = t;
2032
- for (let l = o.length - 2; l >= 0; l -= 2) {
2033
- let a = n.nodes[o[l]];
2034
- if (!a || a.hasRequiredAttrs())
2035
- break;
2036
- i = j.from(a.create(o[l + 1], i)), s++, r++;
2037
- }
2038
- return new se(i, s, r);
2039
- }
2040
- const T = {}, A = {}, Do = { touchstart: !0, touchmove: !0 };
2041
- class No {
2042
- constructor() {
2043
- this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "", button: 0 }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
2044
- }
2045
- }
2046
- function So(t) {
2047
- for (let e in T) {
2048
- let n = T[e];
2049
- t.dom.addEventListener(e, t.input.eventHandlers[e] = (o) => {
2050
- Oo(t, o) && !et(t, o) && (t.editable || !(o.type in A)) && n(t, o);
2051
- }, Do[e] ? { passive: !0 } : void 0);
2052
- }
2053
- k && t.dom.addEventListener("input", () => null), Je(t);
2054
- }
2055
- function X(t, e) {
2056
- t.input.lastSelectionOrigin = e, t.input.lastSelectionTime = Date.now();
2057
- }
2058
- function Co(t) {
2059
- t.domObserver.stop();
2060
- for (let e in t.input.eventHandlers)
2061
- t.dom.removeEventListener(e, t.input.eventHandlers[e]);
2062
- clearTimeout(t.input.composingTimeout), clearTimeout(t.input.lastIOSEnterFallbackTimeout);
2063
- }
2064
- function Je(t) {
2065
- t.someProp("handleDOMEvents", (e) => {
2066
- for (let n in e)
2067
- t.input.eventHandlers[n] || t.dom.addEventListener(n, t.input.eventHandlers[n] = (o) => et(t, o));
2068
- });
2069
- }
2070
- function et(t, e) {
2071
- return t.someProp("handleDOMEvents", (n) => {
2072
- let o = n[e.type];
2073
- return o ? o(t, e) || e.defaultPrevented : !1;
2074
- });
2075
- }
2076
- function Oo(t, e) {
2077
- if (!e.bubbles)
2078
- return !0;
2079
- if (e.defaultPrevented)
2080
- return !1;
2081
- for (let n = e.target; n != t.dom; n = n.parentNode)
2082
- if (!n || n.nodeType == 11 || n.pmViewDesc && n.pmViewDesc.stopEvent(e))
2083
- return !1;
2084
- return !0;
2085
- }
2086
- function Mo(t, e) {
2087
- !et(t, e) && T[e.type] && (t.editable || !(e.type in A)) && T[e.type](t, e);
2088
- }
2089
- A.keydown = (t, e) => {
2090
- let n = e;
2091
- if (t.input.shiftKey = n.keyCode == 16 || n.shiftKey, !dn(t, n) && (t.input.lastKeyCode = n.keyCode, t.input.lastKeyCodeTime = Date.now(), !(W && M && n.keyCode == 13)))
2092
- if (n.keyCode != 229 && t.domObserver.forceFlush(), ue && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
2093
- let o = Date.now();
2094
- t.input.lastIOSEnter = o, t.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
2095
- t.input.lastIOSEnter == o && (t.someProp("handleKeyDown", (i) => i(t, ee(13, "Enter"))), t.input.lastIOSEnter = 0);
2096
- }, 200);
2097
- } else t.someProp("handleKeyDown", (o) => o(t, n)) || ho(t, n) ? n.preventDefault() : X(t, "key");
2098
- };
2099
- A.keyup = (t, e) => {
2100
- e.keyCode == 16 && (t.input.shiftKey = !1);
2101
- };
2102
- A.keypress = (t, e) => {
2103
- let n = e;
2104
- if (dn(t, n) || !n.charCode || n.ctrlKey && !n.altKey || R && n.metaKey)
2105
- return;
2106
- if (t.someProp("handleKeyPress", (i) => i(t, n))) {
2107
- n.preventDefault();
2108
- return;
2109
- }
2110
- let o = t.state.selection;
2111
- if (!(o instanceof x) || !o.$from.sameParent(o.$to)) {
2112
- let i = String.fromCharCode(n.charCode), s = () => t.state.tr.insertText(i).scrollIntoView();
2113
- !/[\r\n]/.test(i) && !t.someProp("handleTextInput", (r) => r(t, o.$from.pos, o.$to.pos, i, s)) && t.dispatch(s()), n.preventDefault();
2114
- }
2115
- };
2116
- function Ie(t) {
2117
- return { left: t.clientX, top: t.clientY };
2118
- }
2119
- function xo(t, e) {
2120
- let n = e.x - t.clientX, o = e.y - t.clientY;
2121
- return n * n + o * o < 100;
2122
- }
2123
- function tt(t, e, n, o, i) {
2124
- if (o == -1)
2125
- return !1;
2126
- let s = t.state.doc.resolve(o);
2127
- for (let r = s.depth + 1; r > 0; r--)
2128
- if (t.someProp(e, (l) => r > s.depth ? l(t, n, s.nodeAfter, s.before(r), i, !0) : l(t, n, s.node(r), s.before(r), i, !1)))
2129
- return !0;
2130
- return !1;
2131
- }
2132
- function fe(t, e, n) {
2133
- if (t.focused || t.focus(), t.state.selection.eq(e))
2134
- return;
2135
- let o = t.state.tr.setSelection(e);
2136
- o.setMeta("pointer", !0), t.dispatch(o);
2137
- }
2138
- function ko(t, e) {
2139
- if (e == -1)
2140
- return !1;
2141
- let n = t.state.doc.resolve(e), o = n.nodeAfter;
2142
- return o && o.isAtom && D.isSelectable(o) ? (fe(t, new D(n)), !0) : !1;
2143
- }
2144
- function To(t, e) {
2145
- if (e == -1)
2146
- return !1;
2147
- let n = t.state.selection, o, i;
2148
- n instanceof D && (o = n.node);
2149
- let s = t.state.doc.resolve(e);
2150
- for (let r = s.depth + 1; r > 0; r--) {
2151
- let l = r > s.depth ? s.nodeAfter : s.node(r);
2152
- if (D.isSelectable(l)) {
2153
- o && n.$from.depth > 0 && r >= n.$from.depth && s.before(n.$from.depth + 1) == n.$from.pos ? i = s.before(n.$from.depth) : i = s.before(r);
2154
- break;
2155
- }
2156
- }
2157
- return i != null ? (fe(t, D.create(t.state.doc, i)), !0) : !1;
2158
- }
2159
- function Ao(t, e, n, o, i) {
2160
- return tt(t, "handleClickOn", e, n, o) || t.someProp("handleClick", (s) => s(t, e, o)) || (i ? To(t, n) : ko(t, n));
2161
- }
2162
- function Eo(t, e, n, o) {
2163
- return tt(t, "handleDoubleClickOn", e, n, o) || t.someProp("handleDoubleClick", (i) => i(t, e, o));
2164
- }
2165
- function Po(t, e, n, o) {
2166
- return tt(t, "handleTripleClickOn", e, n, o) || t.someProp("handleTripleClick", (i) => i(t, e, o)) || Vo(t, n, o);
2167
- }
2168
- function Vo(t, e, n) {
2169
- if (n.button != 0)
2170
- return !1;
2171
- let o = t.state.doc;
2172
- if (e == -1)
2173
- return o.inlineContent ? (fe(t, x.create(o, 0, o.content.size)), !0) : !1;
2174
- let i = o.resolve(e);
2175
- for (let s = i.depth + 1; s > 0; s--) {
2176
- let r = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
2177
- if (r.inlineContent)
2178
- fe(t, x.create(o, l + 1, l + 1 + r.content.size));
2179
- else if (D.isSelectable(r))
2180
- fe(t, D.create(o, l));
2181
- else
2182
- continue;
2183
- return !0;
2184
- }
2185
- }
2186
- function nt(t) {
2187
- return Ae(t);
2188
- }
2189
- const cn = R ? "metaKey" : "ctrlKey";
2190
- T.mousedown = (t, e) => {
2191
- let n = e;
2192
- t.input.shiftKey = n.shiftKey;
2193
- let o = nt(t), i = Date.now(), s = "singleClick";
2194
- i - t.input.lastClick.time < 500 && xo(n, t.input.lastClick) && !n[cn] && t.input.lastClick.button == n.button && (t.input.lastClick.type == "singleClick" ? s = "doubleClick" : t.input.lastClick.type == "doubleClick" && (s = "tripleClick")), t.input.lastClick = { time: i, x: n.clientX, y: n.clientY, type: s, button: n.button };
2195
- let r = t.posAtCoords(Ie(n));
2196
- r && (s == "singleClick" ? (t.input.mouseDown && t.input.mouseDown.done(), t.input.mouseDown = new Ro(t, r, n, !!o)) : (s == "doubleClick" ? Eo : Po)(t, r.pos, r.inside, n) ? n.preventDefault() : X(t, "pointer"));
2197
- };
2198
- class Ro {
2199
- constructor(e, n, o, i) {
2200
- this.view = e, this.pos = n, this.event = o, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!o[cn], this.allowDefault = o.shiftKey;
2201
- let s, r;
2202
- if (n.inside > -1)
2203
- s = e.state.doc.nodeAt(n.inside), r = n.inside;
2204
- else {
2205
- let d = e.state.doc.resolve(n.pos);
2206
- s = d.parent, r = d.depth ? d.before() : 0;
2207
- }
2208
- const l = i ? null : o.target, a = l ? e.docView.nearestDesc(l, !0) : null;
2209
- this.target = a && a.nodeDOM.nodeType == 1 ? a.nodeDOM : null;
2210
- let { selection: c } = e.state;
2211
- (o.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof D && c.from <= r && c.to > r) && (this.mightDrag = {
2212
- node: s,
2213
- pos: r,
2214
- addAttr: !!(this.target && !this.target.draggable),
2215
- setUneditable: !!(this.target && I && !this.target.hasAttribute("contentEditable"))
2216
- }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
2217
- this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
2218
- }, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), X(e, "pointer");
2219
- }
2220
- done() {
2221
- this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => _(this.view)), this.view.input.mouseDown = null;
2222
- }
2223
- up(e) {
2224
- if (this.done(), !this.view.dom.contains(e.target))
2225
- return;
2226
- let n = this.pos;
2227
- this.view.state.doc != this.startDoc && (n = this.view.posAtCoords(Ie(e))), this.updateAllowDefault(e), this.allowDefault || !n ? X(this.view, "pointer") : Ao(this.view, n.pos, n.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
2228
- k && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
2229
- // cursor, but still report that the node is selected
2230
- // when asked through getSelection. You'll then get a
2231
- // situation where clicking at the point where that
2232
- // (hidden) cursor is doesn't change the selection, and
2233
- // thus doesn't get a reaction from ProseMirror. This
2234
- // works around that.
2235
- M && !this.view.state.selection.visible && Math.min(Math.abs(n.pos - this.view.state.selection.from), Math.abs(n.pos - this.view.state.selection.to)) <= 2) ? (fe(this.view, be.near(this.view.state.doc.resolve(n.pos))), e.preventDefault()) : X(this.view, "pointer");
2236
- }
2237
- move(e) {
2238
- this.updateAllowDefault(e), X(this.view, "pointer"), e.buttons == 0 && this.done();
2239
- }
2240
- updateAllowDefault(e) {
2241
- !this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
2242
- }
2243
- }
2244
- T.touchstart = (t) => {
2245
- t.input.lastTouch = Date.now(), nt(t), X(t, "pointer");
2246
- };
2247
- T.touchmove = (t) => {
2248
- t.input.lastTouch = Date.now(), X(t, "pointer");
2249
- };
2250
- T.contextmenu = (t) => nt(t);
2251
- function dn(t, e) {
2252
- return t.composing ? !0 : k && Math.abs(e.timeStamp - t.input.compositionEndedAt) < 500 ? (t.input.compositionEndedAt = -2e8, !0) : !1;
2253
- }
2254
- const Bo = W ? 5e3 : -1;
2255
- A.compositionstart = A.compositionupdate = (t) => {
2256
- if (!t.composing) {
2257
- t.domObserver.flush();
2258
- let { state: e } = t, n = e.selection.$to;
2259
- if (e.selection instanceof x && (e.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((o) => o.type.spec.inclusive === !1)))
2260
- t.markCursor = t.state.storedMarks || n.marks(), Ae(t, !0), t.markCursor = null;
2261
- else if (Ae(t, !e.selection.empty), I && e.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
2262
- let o = t.domSelectionRange();
2263
- for (let i = o.focusNode, s = o.focusOffset; i && i.nodeType == 1 && s != 0; ) {
2264
- let r = s < 0 ? i.lastChild : i.childNodes[s - 1];
2265
- if (!r)
2266
- break;
2267
- if (r.nodeType == 3) {
2268
- let l = t.domSelection();
2269
- l && l.collapse(r, r.nodeValue.length);
2270
- break;
2271
- } else
2272
- i = r, s = -1;
2273
- }
2274
- }
2275
- t.input.composing = !0;
2276
- }
2277
- fn(t, Bo);
2278
- };
2279
- A.compositionend = (t, e) => {
2280
- t.composing && (t.input.composing = !1, t.input.compositionEndedAt = e.timeStamp, t.input.compositionPendingChanges = t.domObserver.pendingRecords().length ? t.input.compositionID : 0, t.input.compositionNode = null, t.input.compositionPendingChanges && Promise.resolve().then(() => t.domObserver.flush()), t.input.compositionID++, fn(t, 20));
2281
- };
2282
- function fn(t, e) {
2283
- clearTimeout(t.input.composingTimeout), e > -1 && (t.input.composingTimeout = setTimeout(() => Ae(t), e));
2284
- }
2285
- function hn(t) {
2286
- for (t.composing && (t.input.composing = !1, t.input.compositionEndedAt = Fo()); t.input.compositionNodes.length > 0; )
2287
- t.input.compositionNodes.pop().markParentsDirty();
2288
- }
2289
- function Io(t) {
2290
- let e = t.domSelectionRange();
2291
- if (!e.focusNode)
2292
- return null;
2293
- let n = xn(e.focusNode, e.focusOffset), o = kn(e.focusNode, e.focusOffset);
2294
- if (n && o && n != o) {
2295
- let i = o.pmViewDesc, s = t.domObserver.lastChangedTextNode;
2296
- if (n == s || o == s)
2297
- return s;
2298
- if (!i || !i.isText(o.nodeValue))
2299
- return o;
2300
- if (t.input.compositionNode == o) {
2301
- let r = n.pmViewDesc;
2302
- if (!(!r || !r.isText(n.nodeValue)))
2303
- return o;
2304
- }
2305
- }
2306
- return n || o;
2307
- }
2308
- function Fo() {
2309
- let t = document.createEvent("Event");
2310
- return t.initEvent("event", !0, !0), t.timeStamp;
2311
- }
2312
- function Ae(t, e = !1) {
2313
- if (!(W && t.domObserver.flushingSoon >= 0)) {
2314
- if (t.domObserver.forceFlush(), hn(t), e || t.docView && t.docView.dirty) {
2315
- let n = Qe(t), o = t.state.selection;
2316
- return n && !n.eq(o) ? t.dispatch(t.state.tr.setSelection(n)) : (t.markCursor || e) && !o.$from.node(o.$from.sharedDepth(o.to)).inlineContent ? t.dispatch(t.state.tr.deleteSelection()) : t.updateState(t.state), !0;
2317
- }
2318
- return !1;
2319
- }
2320
- }
2321
- function zo(t, e) {
2322
- if (!t.dom.parentNode)
2323
- return;
2324
- let n = t.dom.parentNode.appendChild(document.createElement("div"));
2325
- n.appendChild(e), n.style.cssText = "position: fixed; left: -10000px; top: 10px";
2326
- let o = getSelection(), i = document.createRange();
2327
- i.selectNodeContents(e), t.dom.blur(), o.removeAllRanges(), o.addRange(i), setTimeout(() => {
2328
- n.parentNode && n.parentNode.removeChild(n), t.focus();
2329
- }, 50);
2330
- }
2331
- const De = P && J < 15 || ue && Vn < 604;
2332
- T.copy = A.cut = (t, e) => {
2333
- let n = e, o = t.state.selection, i = n.type == "cut";
2334
- if (o.empty)
2335
- return;
2336
- let s = De ? null : n.clipboardData, r = o.content(), { dom: l, text: a } = ve(t, r);
2337
- s ? (n.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : zo(t, l), i && t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
2338
- };
2339
- function Lo(t) {
2340
- return t.openStart == 0 && t.openEnd == 0 && t.content.childCount == 1 ? t.content.firstChild : null;
2341
- }
2342
- function $o(t, e) {
2343
- if (!t.dom.parentNode)
2344
- return;
2345
- let n = t.input.shiftKey || t.state.selection.$from.parent.type.spec.code, o = t.dom.parentNode.appendChild(document.createElement(n ? "textarea" : "div"));
2346
- n || (o.contentEditable = "true"), o.style.cssText = "position: fixed; left: -10000px; top: 10px", o.focus();
2347
- let i = t.input.shiftKey && t.input.lastKeyCode != 45;
2348
- setTimeout(() => {
2349
- t.focus(), o.parentNode && o.parentNode.removeChild(o), n ? Ne(t, o.value, null, i, e) : Ne(t, o.textContent, o.innerHTML, i, e);
2350
- }, 50);
2351
- }
2352
- function Ne(t, e, n, o, i) {
2353
- let s = nn(t, e, n, o, t.state.selection.$from);
2354
- if (t.someProp("handlePaste", (a) => a(t, i, s || se.empty)))
2355
- return !0;
2356
- if (!s)
2357
- return !1;
2358
- let r = Lo(s), l = r ? t.state.tr.replaceSelectionWith(r, o) : t.state.tr.replaceSelection(s);
2359
- return t.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
2360
- }
2361
- function un(t) {
2362
- let e = t.getData("text/plain") || t.getData("Text");
2363
- if (e)
2364
- return e;
2365
- let n = t.getData("text/uri-list");
2366
- return n ? n.replace(/\r?\n/g, " ") : "";
2367
- }
2368
- A.paste = (t, e) => {
2369
- let n = e;
2370
- if (t.composing && !W)
2371
- return;
2372
- let o = De ? null : n.clipboardData, i = t.input.shiftKey && t.input.lastKeyCode != 45;
2373
- o && Ne(t, un(o), o.getData("text/html"), i, n) ? n.preventDefault() : $o(t, n);
2374
- };
2375
- class pn {
2376
- constructor(e, n, o) {
2377
- this.slice = e, this.move = n, this.node = o;
2378
- }
2379
- }
2380
- const qo = R ? "altKey" : "ctrlKey";
2381
- function mn(t, e) {
2382
- let n = t.someProp("dragCopies", (o) => !o(e));
2383
- return n ?? !e[qo];
2384
- }
2385
- T.dragstart = (t, e) => {
2386
- let n = e, o = t.input.mouseDown;
2387
- if (o && o.done(), !n.dataTransfer)
2388
- return;
2389
- let i = t.state.selection, s = i.empty ? null : t.posAtCoords(Ie(n)), r;
2390
- if (!(s && s.pos >= i.from && s.pos <= (i instanceof D ? i.to - 1 : i.to))) {
2391
- if (o && o.mightDrag)
2392
- r = D.create(t.state.doc, o.mightDrag.pos);
2393
- else if (n.target && n.target.nodeType == 1) {
2394
- let f = t.docView.nearestDesc(n.target, !0);
2395
- f && f.node.type.spec.draggable && f != t.docView && (r = D.create(t.state.doc, f.posBefore));
2396
- }
2397
- }
2398
- let l = (r || t.state.selection).content(), { dom: a, text: c, slice: d } = ve(t, l);
2399
- (!n.dataTransfer.files.length || !M || Kt > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData(De ? "Text" : "text/html", a.innerHTML), n.dataTransfer.effectAllowed = "copyMove", De || n.dataTransfer.setData("text/plain", c), t.dragging = new pn(d, mn(t, n), r);
2400
- };
2401
- T.dragend = (t) => {
2402
- let e = t.dragging;
2403
- window.setTimeout(() => {
2404
- t.dragging == e && (t.dragging = null);
2405
- }, 50);
2406
- };
2407
- A.dragover = A.dragenter = (t, e) => e.preventDefault();
2408
- A.drop = (t, e) => {
2409
- let n = e, o = t.dragging;
2410
- if (t.dragging = null, !n.dataTransfer)
2411
- return;
2412
- let i = t.posAtCoords(Ie(n));
2413
- if (!i)
2414
- return;
2415
- let s = t.state.doc.resolve(i.pos), r = o && o.slice;
2416
- r ? t.someProp("transformPasted", (h) => {
2417
- r = h(r, t, !1);
2418
- }) : r = nn(t, un(n.dataTransfer), De ? null : n.dataTransfer.getData("text/html"), !1, s);
2419
- let l = !!(o && mn(t, n));
2420
- if (t.someProp("handleDrop", (h) => h(t, n, r || se.empty, l))) {
2421
- n.preventDefault();
2422
- return;
2423
- }
2424
- if (!r)
2425
- return;
2426
- n.preventDefault();
2427
- let a = r ? Cn(t.state.doc, s.pos, r) : s.pos;
2428
- a == null && (a = s.pos);
2429
- let c = t.state.tr;
2430
- if (l) {
2431
- let { node: h } = o;
2432
- h ? h.replace(c) : c.deleteSelection();
2433
- }
2434
- let d = c.mapping.map(a), f = r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1, u = c.doc;
2435
- if (f ? c.replaceRangeWith(d, d, r.content.firstChild) : c.replaceRange(d, d, r), c.doc.eq(u))
2436
- return;
2437
- let p = c.doc.resolve(d);
2438
- if (f && D.isSelectable(r.content.firstChild) && p.nodeAfter && p.nodeAfter.sameMarkup(r.content.firstChild))
2439
- c.setSelection(new D(p));
2440
- else {
2441
- let h = c.mapping.map(a);
2442
- c.mapping.maps[c.mapping.maps.length - 1].forEach((g, m, y, V) => h = V), c.setSelection(we(t, p, c.doc.resolve(h)));
2443
- }
2444
- t.focus(), t.dispatch(c.setMeta("uiEvent", "drop"));
2445
- };
2446
- T.focus = (t) => {
2447
- t.input.lastFocus = Date.now(), t.focused || (t.domObserver.stop(), t.dom.classList.add("ProseMirror-focused"), t.domObserver.start(), t.focused = !0, setTimeout(() => {
2448
- t.docView && t.hasFocus() && !t.domObserver.currentSelection.eq(t.domSelectionRange()) && _(t);
2449
- }, 20));
2450
- };
2451
- T.blur = (t, e) => {
2452
- let n = e;
2453
- t.focused && (t.domObserver.stop(), t.dom.classList.remove("ProseMirror-focused"), t.domObserver.start(), n.relatedTarget && t.dom.contains(n.relatedTarget) && t.domObserver.currentSelection.clear(), t.focused = !1);
2454
- };
2455
- T.beforeinput = (t, e) => {
2456
- if (M && W && e.inputType == "deleteContentBackward") {
2457
- t.domObserver.flushSoon();
2458
- let { domChangeCount: o } = t.input;
2459
- setTimeout(() => {
2460
- if (t.input.domChangeCount != o || (t.dom.blur(), t.focus(), t.someProp("handleKeyDown", (s) => s(t, ee(8, "Backspace")))))
2461
- return;
2462
- let { $cursor: i } = t.state.selection;
2463
- i && i.pos > 0 && t.dispatch(t.state.tr.delete(i.pos - 1, i.pos).scrollIntoView());
2464
- }, 50);
2465
- }
2466
- };
2467
- for (let t in A)
2468
- T[t] = A[t];
2469
- function Se(t, e) {
2470
- if (t == e)
2471
- return !0;
2472
- for (let n in t)
2473
- if (t[n] !== e[n])
2474
- return !1;
2475
- for (let n in e)
2476
- if (!(n in t))
2477
- return !1;
2478
- return !0;
2479
- }
2480
- class Ee {
2481
- constructor(e, n) {
2482
- this.toDOM = e, this.spec = n || oe, this.side = this.spec.side || 0;
2483
- }
2484
- map(e, n, o, i) {
2485
- let { pos: s, deleted: r } = e.mapResult(n.from + i, this.side < 0 ? -1 : 1);
2486
- return r ? null : new L(s - o, s - o, this);
2487
- }
2488
- valid() {
2489
- return !0;
2490
- }
2491
- eq(e) {
2492
- return this == e || e instanceof Ee && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && Se(this.spec, e.spec));
2493
- }
2494
- destroy(e) {
2495
- this.spec.destroy && this.spec.destroy(e);
2496
- }
2497
- }
2498
- class Q {
2499
- constructor(e, n) {
2500
- this.attrs = e, this.spec = n || oe;
2501
- }
2502
- map(e, n, o, i) {
2503
- let s = e.map(n.from + i, this.spec.inclusiveStart ? -1 : 1) - o, r = e.map(n.to + i, this.spec.inclusiveEnd ? 1 : -1) - o;
2504
- return s >= r ? null : new L(s, r, this);
2505
- }
2506
- valid(e, n) {
2507
- return n.from < n.to;
2508
- }
2509
- eq(e) {
2510
- return this == e || e instanceof Q && Se(this.attrs, e.attrs) && Se(this.spec, e.spec);
2511
- }
2512
- static is(e) {
2513
- return e.type instanceof Q;
2514
- }
2515
- destroy() {
2516
- }
2517
- }
2518
- class ot {
2519
- constructor(e, n) {
2520
- this.attrs = e, this.spec = n || oe;
2521
- }
2522
- map(e, n, o, i) {
2523
- let s = e.mapResult(n.from + i, 1);
2524
- if (s.deleted)
2525
- return null;
2526
- let r = e.mapResult(n.to + i, -1);
2527
- return r.deleted || r.pos <= s.pos ? null : new L(s.pos - o, r.pos - o, this);
2528
- }
2529
- valid(e, n) {
2530
- let { index: o, offset: i } = e.content.findIndex(n.from), s;
2531
- return i == n.from && !(s = e.child(o)).isText && i + s.nodeSize == n.to;
2532
- }
2533
- eq(e) {
2534
- return this == e || e instanceof ot && Se(this.attrs, e.attrs) && Se(this.spec, e.spec);
2535
- }
2536
- destroy() {
2537
- }
2538
- }
2539
- class L {
2540
- /**
2541
- @internal
2542
- */
2543
- constructor(e, n, o) {
2544
- this.from = e, this.to = n, this.type = o;
2545
- }
2546
- /**
2547
- @internal
2548
- */
2549
- copy(e, n) {
2550
- return new L(e, n, this.type);
2551
- }
2552
- /**
2553
- @internal
2554
- */
2555
- eq(e, n = 0) {
2556
- return this.type.eq(e.type) && this.from + n == e.from && this.to + n == e.to;
2557
- }
2558
- /**
2559
- @internal
2560
- */
2561
- map(e, n, o) {
2562
- return this.type.map(e, this, n, o);
2563
- }
2564
- /**
2565
- Creates a widget decoration, which is a DOM node that's shown in
2566
- the document at the given position. It is recommended that you
2567
- delay rendering the widget by passing a function that will be
2568
- called when the widget is actually drawn in a view, but you can
2569
- also directly pass a DOM node. `getPos` can be used to find the
2570
- widget's current document position.
2571
- */
2572
- static widget(e, n, o) {
2573
- return new L(e, e, new Ee(n, o));
2574
- }
2575
- /**
2576
- Creates an inline decoration, which adds the given attributes to
2577
- each inline node between `from` and `to`.
2578
- */
2579
- static inline(e, n, o, i) {
2580
- return new L(e, n, new Q(o, i));
2581
- }
2582
- /**
2583
- Creates a node decoration. `from` and `to` should point precisely
2584
- before and after a node in the document. That node, and only that
2585
- node, will receive the given attributes.
2586
- */
2587
- static node(e, n, o, i) {
2588
- return new L(e, n, new ot(o, i));
2589
- }
2590
- /**
2591
- The spec provided when creating this decoration. Can be useful
2592
- if you've stored extra information in that object.
2593
- */
2594
- get spec() {
2595
- return this.type.spec;
2596
- }
2597
- /**
2598
- @internal
2599
- */
2600
- get inline() {
2601
- return this.type instanceof Q;
2602
- }
2603
- /**
2604
- @internal
2605
- */
2606
- get widget() {
2607
- return this.type instanceof Ee;
2608
- }
2609
- }
2610
- const de = [], oe = {};
2611
- class S {
2612
- /**
2613
- @internal
2614
- */
2615
- constructor(e, n) {
2616
- this.local = e.length ? e : de, this.children = n.length ? n : de;
2617
- }
2618
- /**
2619
- Create a set of decorations, using the structure of the given
2620
- document. This will consume (modify) the `decorations` array, so
2621
- you must make a copy if you want need to preserve that.
2622
- */
2623
- static create(e, n) {
2624
- return n.length ? Pe(n, e, 0, oe) : O;
2625
- }
2626
- /**
2627
- Find all decorations in this set which touch the given range
2628
- (including decorations that start or end directly at the
2629
- boundaries) and match the given predicate on their spec. When
2630
- `start` and `end` are omitted, all decorations in the set are
2631
- considered. When `predicate` isn't given, all decorations are
2632
- assumed to match.
2633
- */
2634
- find(e, n, o) {
2635
- let i = [];
2636
- return this.findInner(e ?? 0, n ?? 1e9, i, 0, o), i;
2637
- }
2638
- findInner(e, n, o, i, s) {
2639
- for (let r = 0; r < this.local.length; r++) {
2640
- let l = this.local[r];
2641
- l.from <= n && l.to >= e && (!s || s(l.spec)) && o.push(l.copy(l.from + i, l.to + i));
2642
- }
2643
- for (let r = 0; r < this.children.length; r += 3)
2644
- if (this.children[r] < n && this.children[r + 1] > e) {
2645
- let l = this.children[r] + 1;
2646
- this.children[r + 2].findInner(e - l, n - l, o, i + l, s);
2647
- }
2648
- }
2649
- /**
2650
- Map the set of decorations in response to a change in the
2651
- document.
2652
- */
2653
- map(e, n, o) {
2654
- return this == O || e.maps.length == 0 ? this : this.mapInner(e, n, 0, 0, o || oe);
2655
- }
2656
- /**
2657
- @internal
2658
- */
2659
- mapInner(e, n, o, i, s) {
2660
- let r;
2661
- for (let l = 0; l < this.local.length; l++) {
2662
- let a = this.local[l].map(e, o, i);
2663
- a && a.type.valid(n, a) ? (r || (r = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
2664
- }
2665
- return this.children.length ? Ko(this.children, r || [], e, n, o, i, s) : r ? new S(r.sort(ie), de) : O;
2666
- }
2667
- /**
2668
- Add the given array of decorations to the ones in the set,
2669
- producing a new set. Consumes the `decorations` array. Needs
2670
- access to the current document to create the appropriate tree
2671
- structure.
2672
- */
2673
- add(e, n) {
2674
- return n.length ? this == O ? S.create(e, n) : this.addInner(e, n, 0) : this;
2675
- }
2676
- addInner(e, n, o) {
2677
- let i, s = 0;
2678
- e.forEach((l, a) => {
2679
- let c = a + o, d;
2680
- if (d = yn(n, l, c)) {
2681
- for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
2682
- s += 3;
2683
- i[s] == a ? i[s + 2] = i[s + 2].addInner(l, d, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Pe(d, l, c + 1, oe)), s += 3;
2684
- }
2685
- });
2686
- let r = gn(s ? bn(n) : n, -o);
2687
- for (let l = 0; l < r.length; l++)
2688
- r[l].type.valid(e, r[l]) || r.splice(l--, 1);
2689
- return new S(r.length ? this.local.concat(r).sort(ie) : this.local, i || this.children);
2690
- }
2691
- /**
2692
- Create a new set that contains the decorations in this set, minus
2693
- the ones in the given array.
2694
- */
2695
- remove(e) {
2696
- return e.length == 0 || this == O ? this : this.removeInner(e, 0);
2697
- }
2698
- removeInner(e, n) {
2699
- let o = this.children, i = this.local;
2700
- for (let s = 0; s < o.length; s += 3) {
2701
- let r, l = o[s] + n, a = o[s + 1] + n;
2702
- for (let d = 0, f; d < e.length; d++)
2703
- (f = e[d]) && f.from > l && f.to < a && (e[d] = null, (r || (r = [])).push(f));
2704
- if (!r)
2705
- continue;
2706
- o == this.children && (o = this.children.slice());
2707
- let c = o[s + 2].removeInner(r, l + 1);
2708
- c != O ? o[s + 2] = c : (o.splice(s, 3), s -= 3);
2709
- }
2710
- if (i.length) {
2711
- for (let s = 0, r; s < e.length; s++)
2712
- if (r = e[s])
2713
- for (let l = 0; l < i.length; l++)
2714
- i[l].eq(r, n) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
2715
- }
2716
- return o == this.children && i == this.local ? this : i.length || o.length ? new S(i, o) : O;
2717
- }
2718
- forChild(e, n) {
2719
- if (this == O)
2720
- return this;
2721
- if (n.isLeaf)
2722
- return S.empty;
2723
- let o, i;
2724
- for (let l = 0; l < this.children.length; l += 3)
2725
- if (this.children[l] >= e) {
2726
- this.children[l] == e && (o = this.children[l + 2]);
2727
- break;
2728
- }
2729
- let s = e + 1, r = s + n.content.size;
2730
- for (let l = 0; l < this.local.length; l++) {
2731
- let a = this.local[l];
2732
- if (a.from < r && a.to > s && a.type instanceof Q) {
2733
- let c = Math.max(s, a.from) - s, d = Math.min(r, a.to) - s;
2734
- c < d && (i || (i = [])).push(a.copy(c, d));
2735
- }
2736
- }
2737
- if (i) {
2738
- let l = new S(i.sort(ie), de);
2739
- return o ? new G([l, o]) : l;
2740
- }
2741
- return o || O;
2742
- }
2743
- /**
2744
- @internal
2745
- */
2746
- eq(e) {
2747
- if (this == e)
2748
- return !0;
2749
- if (!(e instanceof S) || this.local.length != e.local.length || this.children.length != e.children.length)
2750
- return !1;
2751
- for (let n = 0; n < this.local.length; n++)
2752
- if (!this.local[n].eq(e.local[n]))
2753
- return !1;
2754
- for (let n = 0; n < this.children.length; n += 3)
2755
- if (this.children[n] != e.children[n] || this.children[n + 1] != e.children[n + 1] || !this.children[n + 2].eq(e.children[n + 2]))
2756
- return !1;
2757
- return !0;
2758
- }
2759
- /**
2760
- @internal
2761
- */
2762
- locals(e) {
2763
- return it(this.localsInner(e));
2764
- }
2765
- /**
2766
- @internal
2767
- */
2768
- localsInner(e) {
2769
- if (this == O)
2770
- return de;
2771
- if (e.inlineContent || !this.local.some(Q.is))
2772
- return this.local;
2773
- let n = [];
2774
- for (let o = 0; o < this.local.length; o++)
2775
- this.local[o].type instanceof Q || n.push(this.local[o]);
2776
- return n;
2777
- }
2778
- forEachSet(e) {
2779
- e(this);
2780
- }
2781
- }
2782
- S.empty = new S([], []);
2783
- S.removeOverlap = it;
2784
- const O = S.empty;
2785
- class G {
2786
- constructor(e) {
2787
- this.members = e;
2788
- }
2789
- map(e, n) {
2790
- const o = this.members.map((i) => i.map(e, n, oe));
2791
- return G.from(o);
2792
- }
2793
- forChild(e, n) {
2794
- if (n.isLeaf)
2795
- return S.empty;
2796
- let o = [];
2797
- for (let i = 0; i < this.members.length; i++) {
2798
- let s = this.members[i].forChild(e, n);
2799
- s != O && (s instanceof G ? o = o.concat(s.members) : o.push(s));
2800
- }
2801
- return G.from(o);
2802
- }
2803
- eq(e) {
2804
- if (!(e instanceof G) || e.members.length != this.members.length)
2805
- return !1;
2806
- for (let n = 0; n < this.members.length; n++)
2807
- if (!this.members[n].eq(e.members[n]))
2808
- return !1;
2809
- return !0;
2810
- }
2811
- locals(e) {
2812
- let n, o = !0;
2813
- for (let i = 0; i < this.members.length; i++) {
2814
- let s = this.members[i].localsInner(e);
2815
- if (s.length)
2816
- if (!n)
2817
- n = s;
2818
- else {
2819
- o && (n = n.slice(), o = !1);
2820
- for (let r = 0; r < s.length; r++)
2821
- n.push(s[r]);
2822
- }
2823
- }
2824
- return n ? it(o ? n : n.sort(ie)) : de;
2825
- }
2826
- // Create a group for the given array of decoration sets, or return
2827
- // a single set when possible.
2828
- static from(e) {
2829
- switch (e.length) {
2830
- case 0:
2831
- return O;
2832
- case 1:
2833
- return e[0];
2834
- default:
2835
- return new G(e.every((n) => n instanceof S) ? e : e.reduce((n, o) => n.concat(o instanceof S ? o : o.members), []));
2836
- }
2837
- }
2838
- forEachSet(e) {
2839
- for (let n = 0; n < this.members.length; n++)
2840
- this.members[n].forEachSet(e);
2841
- }
2842
- }
2843
- function Ko(t, e, n, o, i, s, r) {
2844
- let l = t.slice();
2845
- for (let c = 0, d = s; c < n.maps.length; c++) {
2846
- let f = 0;
2847
- n.maps[c].forEach((u, p, h, g) => {
2848
- let m = g - h - (p - u);
2849
- for (let y = 0; y < l.length; y += 3) {
2850
- let V = l[y + 1];
2851
- if (V < 0 || u > V + d - f)
2852
- continue;
2853
- let z = l[y] + d - f;
2854
- p >= z ? l[y + 1] = u <= z ? -2 : -1 : u >= d && m && (l[y] += m, l[y + 1] += m);
2855
- }
2856
- f += m;
2857
- }), d = n.maps[c].map(d, -1);
2858
- }
2859
- let a = !1;
2860
- for (let c = 0; c < l.length; c += 3)
2861
- if (l[c + 1] < 0) {
2862
- if (l[c + 1] == -2) {
2863
- a = !0, l[c + 1] = -1;
2864
- continue;
2865
- }
2866
- let d = n.map(t[c] + s), f = d - i;
2867
- if (f < 0 || f >= o.content.size) {
2868
- a = !0;
2869
- continue;
2870
- }
2871
- let u = n.map(t[c + 1] + s, -1), p = u - i, { index: h, offset: g } = o.content.findIndex(f), m = o.maybeChild(h);
2872
- if (m && g == f && g + m.nodeSize == p) {
2873
- let y = l[c + 2].mapInner(n, m, d + 1, t[c] + s + 1, r);
2874
- y != O ? (l[c] = f, l[c + 1] = p, l[c + 2] = y) : (l[c + 1] = -2, a = !0);
2875
- } else
2876
- a = !0;
2877
- }
2878
- if (a) {
2879
- let c = Ho(l, t, e, n, i, s, r), d = Pe(c, o, 0, r);
2880
- e = d.local;
2881
- for (let f = 0; f < l.length; f += 3)
2882
- l[f + 1] < 0 && (l.splice(f, 3), f -= 3);
2883
- for (let f = 0, u = 0; f < d.children.length; f += 3) {
2884
- let p = d.children[f];
2885
- for (; u < l.length && l[u] < p; )
2886
- u += 3;
2887
- l.splice(u, 0, d.children[f], d.children[f + 1], d.children[f + 2]);
2888
- }
2889
- }
2890
- return new S(e.sort(ie), l);
2891
- }
2892
- function gn(t, e) {
2893
- if (!e || !t.length)
2894
- return t;
2895
- let n = [];
2896
- for (let o = 0; o < t.length; o++) {
2897
- let i = t[o];
2898
- n.push(new L(i.from + e, i.to + e, i.type));
2899
- }
2900
- return n;
2901
- }
2902
- function Ho(t, e, n, o, i, s, r) {
2903
- function l(a, c) {
2904
- for (let d = 0; d < a.local.length; d++) {
2905
- let f = a.local[d].map(o, i, c);
2906
- f ? n.push(f) : r.onRemove && r.onRemove(a.local[d].spec);
2907
- }
2908
- for (let d = 0; d < a.children.length; d += 3)
2909
- l(a.children[d + 2], a.children[d] + c + 1);
2910
- }
2911
- for (let a = 0; a < t.length; a += 3)
2912
- t[a + 1] == -1 && l(t[a + 2], e[a] + s + 1);
2913
- return n;
2914
- }
2915
- function yn(t, e, n) {
2916
- if (e.isLeaf)
2917
- return null;
2918
- let o = n + e.nodeSize, i = null;
2919
- for (let s = 0, r; s < t.length; s++)
2920
- (r = t[s]) && r.from > n && r.to < o && ((i || (i = [])).push(r), t[s] = null);
2921
- return i;
2922
- }
2923
- function bn(t) {
2924
- let e = [];
2925
- for (let n = 0; n < t.length; n++)
2926
- t[n] != null && e.push(t[n]);
2927
- return e;
2928
- }
2929
- function Pe(t, e, n, o) {
2930
- let i = [], s = !1;
2931
- e.forEach((l, a) => {
2932
- let c = yn(t, l, a + n);
2933
- if (c) {
2934
- s = !0;
2935
- let d = Pe(c, l, n + a + 1, o);
2936
- d != O && i.push(a, a + l.nodeSize, d);
2937
- }
2938
- });
2939
- let r = gn(s ? bn(t) : t, -n).sort(ie);
2940
- for (let l = 0; l < r.length; l++)
2941
- r[l].type.valid(e, r[l]) || (o.onRemove && o.onRemove(r[l].spec), r.splice(l--, 1));
2942
- return r.length || i.length ? new S(r, i) : O;
2943
- }
2944
- function ie(t, e) {
2945
- return t.from - e.from || t.to - e.to;
2946
- }
2947
- function it(t) {
2948
- let e = t;
2949
- for (let n = 0; n < e.length - 1; n++) {
2950
- let o = e[n];
2951
- if (o.from != o.to)
2952
- for (let i = n + 1; i < e.length; i++) {
2953
- let s = e[i];
2954
- if (s.from == o.from) {
2955
- s.to != o.to && (e == t && (e = t.slice()), e[i] = s.copy(s.from, o.to), Tt(e, i + 1, s.copy(o.to, s.to)));
2956
- continue;
2957
- } else {
2958
- s.from < o.to && (e == t && (e = t.slice()), e[n] = o.copy(o.from, s.from), Tt(e, i, o.copy(s.from, o.to)));
2959
- break;
2960
- }
2961
- }
2962
- }
2963
- return e;
2964
- }
2965
- function Tt(t, e, n) {
2966
- for (; e < t.length && ie(n, t[e]) > 0; )
2967
- e++;
2968
- t.splice(e, 0, n);
2969
- }
2970
- function $e(t) {
2971
- let e = [];
2972
- return t.someProp("decorations", (n) => {
2973
- let o = n(t.state);
2974
- o && o != O && e.push(o);
2975
- }), t.cursorWrapper && e.push(S.create(t.state.doc, [t.cursorWrapper.deco])), G.from(e);
2976
- }
2977
- const Wo = {
2978
- childList: !0,
2979
- characterData: !0,
2980
- characterDataOldValue: !0,
2981
- attributes: !0,
2982
- attributeOldValue: !0,
2983
- subtree: !0
2984
- }, _o = P && J <= 11;
2985
- class jo {
2986
- constructor() {
2987
- this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
2988
- }
2989
- set(e) {
2990
- this.anchorNode = e.anchorNode, this.anchorOffset = e.anchorOffset, this.focusNode = e.focusNode, this.focusOffset = e.focusOffset;
2991
- }
2992
- clear() {
2993
- this.anchorNode = this.focusNode = null;
2994
- }
2995
- eq(e) {
2996
- return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
2997
- }
2998
- }
2999
- class Uo {
3000
- constructor(e, n) {
3001
- this.view = e, this.handleDOMChange = n, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new jo(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((o) => {
3002
- for (let i = 0; i < o.length; i++)
3003
- this.queue.push(o[i]);
3004
- P && J <= 11 && o.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
3005
- }), _o && (this.onCharData = (o) => {
3006
- this.queue.push({ target: o.target, type: "characterData", oldValue: o.prevValue }), this.flushSoon();
3007
- }), this.onSelectionChange = this.onSelectionChange.bind(this);
3008
- }
3009
- flushSoon() {
3010
- this.flushingSoon < 0 && (this.flushingSoon = window.setTimeout(() => {
3011
- this.flushingSoon = -1, this.flush();
3012
- }, 20));
3013
- }
3014
- forceFlush() {
3015
- this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
3016
- }
3017
- start() {
3018
- this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, Wo)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
3019
- }
3020
- stop() {
3021
- if (this.observer) {
3022
- let e = this.observer.takeRecords();
3023
- if (e.length) {
3024
- for (let n = 0; n < e.length; n++)
3025
- this.queue.push(e[n]);
3026
- window.setTimeout(() => this.flush(), 20);
3027
- }
3028
- this.observer.disconnect();
3029
- }
3030
- this.onCharData && this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData), this.disconnectSelection();
3031
- }
3032
- connectSelection() {
3033
- this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
3034
- }
3035
- disconnectSelection() {
3036
- this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
3037
- }
3038
- suppressSelectionUpdates() {
3039
- this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
3040
- }
3041
- onSelectionChange() {
3042
- if (Dt(this.view)) {
3043
- if (this.suppressingSelectionUpdates)
3044
- return _(this.view);
3045
- if (P && J <= 11 && !this.view.state.selection.empty) {
3046
- let e = this.view.domSelectionRange();
3047
- if (e.focusNode && re(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
3048
- return this.flushSoon();
3049
- }
3050
- this.flush();
3051
- }
3052
- }
3053
- setCurSelection() {
3054
- this.currentSelection.set(this.view.domSelectionRange());
3055
- }
3056
- ignoreSelectionChange(e) {
3057
- if (!e.focusNode)
3058
- return !0;
3059
- let n = /* @__PURE__ */ new Set(), o;
3060
- for (let s = e.focusNode; s; s = he(s))
3061
- n.add(s);
3062
- for (let s = e.anchorNode; s; s = he(s))
3063
- if (n.has(s)) {
3064
- o = s;
3065
- break;
3066
- }
3067
- let i = o && this.view.docView.nearestDesc(o);
3068
- if (i && i.ignoreMutation({
3069
- type: "selection",
3070
- target: o.nodeType == 3 ? o.parentNode : o
3071
- }))
3072
- return this.setCurSelection(), !0;
3073
- }
3074
- pendingRecords() {
3075
- if (this.observer)
3076
- for (let e of this.observer.takeRecords())
3077
- this.queue.push(e);
3078
- return this.queue;
3079
- }
3080
- flush() {
3081
- let { view: e } = this;
3082
- if (!e.docView || this.flushingSoon > -1)
3083
- return;
3084
- let n = this.pendingRecords();
3085
- n.length && (this.queue = []);
3086
- let o = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(o) && Dt(e) && !this.ignoreSelectionChange(o), s = -1, r = -1, l = !1, a = [];
3087
- if (e.editable)
3088
- for (let d = 0; d < n.length; d++) {
3089
- let f = this.registerMutation(n[d], a);
3090
- f && (s = s < 0 ? f.from : Math.min(f.from, s), r = r < 0 ? f.to : Math.max(f.to, r), f.typeOver && (l = !0));
3091
- }
3092
- if (I && a.length) {
3093
- let d = a.filter((f) => f.nodeName == "BR");
3094
- if (d.length == 2) {
3095
- let [f, u] = d;
3096
- f.parentNode && f.parentNode.parentNode == u.parentNode ? u.remove() : f.remove();
3097
- } else {
3098
- let { focusNode: f } = this.currentSelection;
3099
- for (let u of d) {
3100
- let p = u.parentNode;
3101
- p && p.nodeName == "LI" && (!f || Xo(e, f) != p) && u.remove();
3102
- }
3103
- }
3104
- }
3105
- let c = null;
3106
- s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Re(o) && (c = Qe(e)) && c.eq(be.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, _(e), this.currentSelection.set(o), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, r), Yo(e)), this.handleDOMChange(s, r, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(o) || _(e), this.currentSelection.set(o));
3107
- }
3108
- registerMutation(e, n) {
3109
- if (n.indexOf(e.target) > -1)
3110
- return null;
3111
- let o = this.view.docView.nearestDesc(e.target);
3112
- if (e.type == "attributes" && (o == this.view.docView || e.attributeName == "contenteditable" || // Firefox sometimes fires spurious events for null/empty styles
3113
- e.attributeName == "style" && !e.oldValue && !e.target.getAttribute("style")) || !o || o.ignoreMutation(e))
3114
- return null;
3115
- if (e.type == "childList") {
3116
- for (let d = 0; d < e.addedNodes.length; d++) {
3117
- let f = e.addedNodes[d];
3118
- n.push(f), f.nodeType == 3 && (this.lastChangedTextNode = f);
3119
- }
3120
- if (o.contentDOM && o.contentDOM != o.dom && !o.contentDOM.contains(e.target))
3121
- return { from: o.posBefore, to: o.posAfter };
3122
- let i = e.previousSibling, s = e.nextSibling;
3123
- if (P && J <= 11 && e.addedNodes.length)
3124
- for (let d = 0; d < e.addedNodes.length; d++) {
3125
- let { previousSibling: f, nextSibling: u } = e.addedNodes[d];
3126
- (!f || Array.prototype.indexOf.call(e.addedNodes, f) < 0) && (i = f), (!u || Array.prototype.indexOf.call(e.addedNodes, u) < 0) && (s = u);
3127
- }
3128
- let r = i && i.parentNode == e.target ? C(i) + 1 : 0, l = o.localPosFromDOM(e.target, r, -1), a = s && s.parentNode == e.target ? C(s) : e.target.childNodes.length, c = o.localPosFromDOM(e.target, a, 1);
3129
- return { from: l, to: c };
3130
- } else return e.type == "attributes" ? { from: o.posAtStart - o.border, to: o.posAtEnd + o.border } : (this.lastChangedTextNode = e.target, {
3131
- from: o.posAtStart,
3132
- to: o.posAtEnd,
3133
- // An event was generated for a text change that didn't change
3134
- // any text. Mark the dom change to fall back to assuming the
3135
- // selection was typed over with an identical value if it can't
3136
- // find another change.
3137
- typeOver: e.target.nodeValue == e.oldValue
3138
- });
3139
- }
3140
- }
3141
- let At = /* @__PURE__ */ new WeakMap(), Et = !1;
3142
- function Yo(t) {
3143
- if (!At.has(t) && (At.set(t, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace) !== -1)) {
3144
- if (t.requiresGeckoHackNode = I, Et)
3145
- return;
3146
- console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Et = !0;
3147
- }
3148
- }
3149
- function Pt(t, e) {
3150
- let n = e.startContainer, o = e.startOffset, i = e.endContainer, s = e.endOffset, r = t.domAtPos(t.state.selection.anchor);
3151
- return re(r.node, r.offset, i, s) && ([n, o, i, s] = [i, s, n, o]), { anchorNode: n, anchorOffset: o, focusNode: i, focusOffset: s };
3152
- }
3153
- function Go(t, e) {
3154
- if (e.getComposedRanges) {
3155
- let i = e.getComposedRanges(t.root)[0];
3156
- if (i)
3157
- return Pt(t, i);
3158
- }
3159
- let n;
3160
- function o(i) {
3161
- i.preventDefault(), i.stopImmediatePropagation(), n = i.getTargetRanges()[0];
3162
- }
3163
- return t.dom.addEventListener("beforeinput", o, !0), document.execCommand("indent"), t.dom.removeEventListener("beforeinput", o, !0), n ? Pt(t, n) : null;
3164
- }
3165
- function Xo(t, e) {
3166
- for (let n = e.parentNode; n && n != t.dom; n = n.parentNode) {
3167
- let o = t.docView.nearestDesc(n, !0);
3168
- if (o && o.node.isBlock)
3169
- return n;
3170
- }
3171
- return null;
3172
- }
3173
- function Jo(t, e, n) {
3174
- let { node: o, fromOffset: i, toOffset: s, from: r, to: l } = t.docView.parseRange(e, n), a = t.domSelectionRange(), c, d = a.anchorNode;
3175
- if (d && t.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (c = [{ node: d, offset: a.anchorOffset }], Re(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), M && t.input.lastKeyCode === 8)
3176
- for (let m = s; m > i; m--) {
3177
- let y = o.childNodes[m - 1], V = y.pmViewDesc;
3178
- if (y.nodeName == "BR" && !V) {
3179
- s = m;
3180
- break;
3181
- }
3182
- if (!V || V.size)
3183
- break;
3184
- }
3185
- let f = t.state.doc, u = t.someProp("domParser") || $t.fromSchema(t.state.schema), p = f.resolve(r), h = null, g = u.parse(o, {
3186
- topNode: p.parent,
3187
- topMatch: p.parent.contentMatchAt(p.index()),
3188
- topOpen: !0,
3189
- from: i,
3190
- to: s,
3191
- preserveWhitespace: p.parent.type.whitespace == "pre" ? "full" : !0,
3192
- findPositions: c,
3193
- ruleFromNode: Zo,
3194
- context: p
3195
- });
3196
- if (c && c[0].pos != null) {
3197
- let m = c[0].pos, y = c[1] && c[1].pos;
3198
- y == null && (y = m), h = { anchor: m + r, head: y + r };
3199
- }
3200
- return { doc: g, sel: h, from: r, to: l };
3201
- }
3202
- function Zo(t) {
3203
- let e = t.pmViewDesc;
3204
- if (e)
3205
- return e.parseRule();
3206
- if (t.nodeName == "BR" && t.parentNode) {
3207
- if (k && /^(ul|ol)$/i.test(t.parentNode.nodeName)) {
3208
- let n = document.createElement("div");
3209
- return n.appendChild(document.createElement("li")), { skip: n };
3210
- } else if (t.parentNode.lastChild == t || k && /^(tr|table)$/i.test(t.parentNode.nodeName))
3211
- return { ignore: !0 };
3212
- } else if (t.nodeName == "IMG" && t.getAttribute("mark-placeholder"))
3213
- return { ignore: !0 };
3214
- return null;
3215
- }
3216
- const Qo = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
3217
- function wo(t, e, n, o, i) {
3218
- let s = t.input.compositionPendingChanges || (t.composing ? t.input.compositionID : 0);
3219
- if (t.input.compositionPendingChanges = 0, e < 0) {
3220
- let b = t.input.lastSelectionTime > Date.now() - 50 ? t.input.lastSelectionOrigin : null, N = Qe(t, b);
3221
- if (N && !t.state.selection.eq(N)) {
3222
- if (M && W && t.input.lastKeyCode === 13 && Date.now() - 100 < t.input.lastKeyCodeTime && t.someProp("handleKeyDown", (Dn) => Dn(t, ee(13, "Enter"))))
3223
- return;
3224
- let E = t.state.tr.setSelection(N);
3225
- b == "pointer" ? E.setMeta("pointer", !0) : b == "key" && E.scrollIntoView(), s && E.setMeta("composition", s), t.dispatch(E);
3226
- }
3227
- return;
3228
- }
3229
- let r = t.state.doc.resolve(e), l = r.sharedDepth(n);
3230
- e = r.before(l + 1), n = t.state.doc.resolve(n).after(l + 1);
3231
- let a = t.state.selection, c = Jo(t, e, n), d = t.state.doc, f = d.slice(c.from, c.to), u, p;
3232
- t.input.lastKeyCode === 8 && Date.now() - 100 < t.input.lastKeyCodeTime ? (u = t.state.selection.to, p = "end") : (u = t.state.selection.from, p = "start"), t.input.lastKeyCode = null;
3233
- let h = ti(f.content, c.doc.content, c.from, u, p);
3234
- if (h && t.input.domChangeCount++, (ue && t.input.lastIOSEnter > Date.now() - 225 || W) && i.some((b) => b.nodeType == 1 && !Qo.test(b.nodeName)) && (!h || h.endA >= h.endB) && t.someProp("handleKeyDown", (b) => b(t, ee(13, "Enter")))) {
3235
- t.input.lastIOSEnter = 0;
3236
- return;
3237
- }
3238
- if (!h)
3239
- if (o && a instanceof x && !a.empty && a.$head.sameParent(a.$anchor) && !t.composing && !(c.sel && c.sel.anchor != c.sel.head))
3240
- h = { start: a.from, endA: a.to, endB: a.to };
3241
- else {
3242
- if (c.sel) {
3243
- let b = Vt(t, t.state.doc, c.sel);
3244
- if (b && !b.eq(t.state.selection)) {
3245
- let N = t.state.tr.setSelection(b);
3246
- s && N.setMeta("composition", s), t.dispatch(N);
3247
- }
3248
- }
3249
- return;
3250
- }
3251
- t.state.selection.from < t.state.selection.to && h.start == h.endB && t.state.selection instanceof x && (h.start > t.state.selection.from && h.start <= t.state.selection.from + 2 && t.state.selection.from >= c.from ? h.start = t.state.selection.from : h.endA < t.state.selection.to && h.endA >= t.state.selection.to - 2 && t.state.selection.to <= c.to && (h.endB += t.state.selection.to - h.endA, h.endA = t.state.selection.to)), P && J <= 11 && h.endB == h.start + 1 && h.endA == h.start && h.start > c.from && c.doc.textBetween(h.start - c.from - 1, h.start - c.from + 1) == "  " && (h.start--, h.endA--, h.endB--);
3252
- let g = c.doc.resolveNoCache(h.start - c.from), m = c.doc.resolveNoCache(h.endB - c.from), y = d.resolve(h.start), V = g.sameParent(m) && g.parent.inlineContent && y.end() >= h.endA;
3253
- if ((ue && t.input.lastIOSEnter > Date.now() - 225 && (!V || i.some((b) => b.nodeName == "DIV" || b.nodeName == "P")) || !V && g.pos < c.doc.content.size && (!g.sameParent(m) || !g.parent.inlineContent) && g.pos < m.pos && !/\S/.test(c.doc.textBetween(g.pos, m.pos, "", ""))) && t.someProp("handleKeyDown", (b) => b(t, ee(13, "Enter")))) {
3254
- t.input.lastIOSEnter = 0;
3255
- return;
3256
- }
3257
- if (t.state.selection.anchor > h.start && ei(d, h.start, h.endA, g, m) && t.someProp("handleKeyDown", (b) => b(t, ee(8, "Backspace")))) {
3258
- W && M && t.domObserver.suppressSelectionUpdates();
3259
- return;
3260
- }
3261
- M && h.endB == h.start && (t.input.lastChromeDelete = Date.now()), W && !V && g.start() != m.start() && m.parentOffset == 0 && g.depth == m.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == h.endA && (h.endB -= 2, m = c.doc.resolveNoCache(h.endB - c.from), setTimeout(() => {
3262
- t.someProp("handleKeyDown", function(b) {
3263
- return b(t, ee(13, "Enter"));
3264
- });
3265
- }, 20));
3266
- let z = h.start, v = h.endA, pe = (b) => {
3267
- let N = b || t.state.tr.replace(z, v, c.doc.slice(h.start - c.from, h.endB - c.from));
3268
- if (c.sel) {
3269
- let E = Vt(t, N.doc, c.sel);
3270
- E && !(M && t.composing && E.empty && (h.start != h.endB || t.input.lastChromeDelete < Date.now() - 100) && (E.head == z || E.head == N.mapping.map(v) - 1) || P && E.empty && E.head == z) && N.setSelection(E);
3271
- }
3272
- return s && N.setMeta("composition", s), N.scrollIntoView();
3273
- }, xe;
3274
- if (V)
3275
- if (g.pos == m.pos) {
3276
- P && J <= 11 && g.parentOffset == 0 && (t.domObserver.suppressSelectionUpdates(), setTimeout(() => _(t), 20));
3277
- let b = pe(t.state.tr.delete(z, v)), N = d.resolve(h.start).marksAcross(d.resolve(h.endA));
3278
- N && b.ensureMarks(N), t.dispatch(b);
3279
- } else if (
3280
- // Adding or removing a mark
3281
- h.endA == h.endB && (xe = vo(g.parent.content.cut(g.parentOffset, m.parentOffset), y.parent.content.cut(y.parentOffset, h.endA - y.start())))
3282
- ) {
3283
- let b = pe(t.state.tr);
3284
- xe.type == "add" ? b.addMark(z, v, xe.mark) : b.removeMark(z, v, xe.mark), t.dispatch(b);
3285
- } else if (g.parent.child(g.index()).isText && g.index() == m.index() - (m.textOffset ? 0 : 1)) {
3286
- let b = g.parent.textBetween(g.parentOffset, m.parentOffset), N = () => pe(t.state.tr.insertText(b, z, v));
3287
- t.someProp("handleTextInput", (E) => E(t, z, v, b, N)) || t.dispatch(N());
3288
- } else
3289
- t.dispatch(pe());
3290
- else
3291
- t.dispatch(pe());
3292
- }
3293
- function Vt(t, e, n) {
3294
- return Math.max(n.anchor, n.head) > e.content.size ? null : we(t, e.resolve(n.anchor), e.resolve(n.head));
3295
- }
3296
- function vo(t, e) {
3297
- let n = t.firstChild.marks, o = e.firstChild.marks, i = n, s = o, r, l, a;
3298
- for (let d = 0; d < o.length; d++)
3299
- i = o[d].removeFromSet(i);
3300
- for (let d = 0; d < n.length; d++)
3301
- s = n[d].removeFromSet(s);
3302
- if (i.length == 1 && s.length == 0)
3303
- l = i[0], r = "add", a = (d) => d.mark(l.addToSet(d.marks));
3304
- else if (i.length == 0 && s.length == 1)
3305
- l = s[0], r = "remove", a = (d) => d.mark(l.removeFromSet(d.marks));
3306
- else
3307
- return null;
3308
- let c = [];
3309
- for (let d = 0; d < e.childCount; d++)
3310
- c.push(a(e.child(d)));
3311
- if (j.from(c).eq(t))
3312
- return { mark: l, type: r };
3313
- }
3314
- function ei(t, e, n, o, i) {
3315
- if (
3316
- // The content must have shrunk
3317
- n - e <= i.pos - o.pos || // newEnd must point directly at or after the end of the block that newStart points into
3318
- qe(o, !0, !1) < i.pos
3319
- )
3320
- return !1;
3321
- let s = t.resolve(e);
3322
- if (!o.parent.isTextblock) {
3323
- let l = s.nodeAfter;
3324
- return l != null && n == e + l.nodeSize;
3325
- }
3326
- if (s.parentOffset < s.parent.content.size || !s.parent.isTextblock)
3327
- return !1;
3328
- let r = t.resolve(qe(s, !0, !0));
3329
- return !r.parent.isTextblock || r.pos > n || qe(r, !0, !1) < n ? !1 : o.parent.content.cut(o.parentOffset).eq(r.parent.content);
3330
- }
3331
- function qe(t, e, n) {
3332
- let o = t.depth, i = e ? t.end() : t.pos;
3333
- for (; o > 0 && (e || t.indexAfter(o) == t.node(o).childCount); )
3334
- o--, i++, e = !1;
3335
- if (n) {
3336
- let s = t.node(o).maybeChild(t.indexAfter(o));
3337
- for (; s && !s.isLeaf; )
3338
- s = s.firstChild, i++;
3339
- }
3340
- return i;
3341
- }
3342
- function ti(t, e, n, o, i) {
3343
- let s = t.findDiffStart(e, n);
3344
- if (s == null)
3345
- return null;
3346
- let { a: r, b: l } = t.findDiffEnd(e, n + t.size, n + e.size);
3347
- if (i == "end") {
3348
- let a = Math.max(0, s - Math.min(r, l));
3349
- o -= r + a - s;
3350
- }
3351
- if (r < s && t.size < e.size) {
3352
- let a = o <= s && o >= r ? s - o : 0;
3353
- s -= a, s && s < e.size && Rt(e.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), l = s + (l - r), r = s;
3354
- } else if (l < s) {
3355
- let a = o <= s && o >= l ? s - o : 0;
3356
- s -= a, s && s < t.size && Rt(t.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), r = s + (r - l), l = s;
3357
- }
3358
- return { start: s, endA: r, endB: l };
3359
- }
3360
- function Rt(t) {
3361
- if (t.length != 2)
3362
- return !1;
3363
- let e = t.charCodeAt(0), n = t.charCodeAt(1);
3364
- return e >= 56320 && e <= 57343 && n >= 55296 && n <= 56319;
3365
- }
3366
- class ni {
3367
- /**
3368
- Create a view. `place` may be a DOM node that the editor should
3369
- be appended to, a function that will place it into the document,
3370
- or an object whose `mount` property holds the node to use as the
3371
- document container. If it is `null`, the editor will not be
3372
- added to the document.
3373
- */
3374
- constructor(e, n) {
3375
- this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new No(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = n, this.state = n.state, this.directPlugins = n.plugins || [], this.directPlugins.forEach(Lt), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Ft(this), It(this), this.nodeViews = zt(this), this.docView = ut(this.state.doc, Bt(this), $e(this), this.dom, this), this.domObserver = new Uo(this, (o, i, s, r) => wo(this, o, i, s, r)), this.domObserver.start(), So(this), this.updatePluginViews();
3376
- }
3377
- /**
3378
- Holds `true` when a
3379
- [composition](https://w3c.github.io/uievents/#events-compositionevents)
3380
- is active.
3381
- */
3382
- get composing() {
3383
- return this.input.composing;
3384
- }
3385
- /**
3386
- The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
3387
- */
3388
- get props() {
3389
- if (this._props.state != this.state) {
3390
- let e = this._props;
3391
- this._props = {};
3392
- for (let n in e)
3393
- this._props[n] = e[n];
3394
- this._props.state = this.state;
3395
- }
3396
- return this._props;
3397
- }
3398
- /**
3399
- Update the view's props. Will immediately cause an update to
3400
- the DOM.
3401
- */
3402
- update(e) {
3403
- e.handleDOMEvents != this._props.handleDOMEvents && Je(this);
3404
- let n = this._props;
3405
- this._props = e, e.plugins && (e.plugins.forEach(Lt), this.directPlugins = e.plugins), this.updateStateInner(e.state, n);
3406
- }
3407
- /**
3408
- Update the view by updating existing props object with the object
3409
- given as argument. Equivalent to `view.update(Object.assign({},
3410
- view.props, props))`.
3411
- */
3412
- setProps(e) {
3413
- let n = {};
3414
- for (let o in this._props)
3415
- n[o] = this._props[o];
3416
- n.state = this.state;
3417
- for (let o in e)
3418
- n[o] = e[o];
3419
- this.update(n);
3420
- }
3421
- /**
3422
- Update the editor's `state` prop, without touching any of the
3423
- other props.
3424
- */
3425
- updateState(e) {
3426
- this.updateStateInner(e, this._props);
3427
- }
3428
- updateStateInner(e, n) {
3429
- var o;
3430
- let i = this.state, s = !1, r = !1;
3431
- e.storedMarks && this.composing && (hn(this), r = !0), this.state = e;
3432
- let l = i.plugins != e.plugins || this._props.plugins != n.plugins;
3433
- if (l || this._props.plugins != n.plugins || this._props.nodeViews != n.nodeViews) {
3434
- let p = zt(this);
3435
- ii(p, this.nodeViews) && (this.nodeViews = p, s = !0);
3436
- }
3437
- (l || n.handleDOMEvents != this._props.handleDOMEvents) && Je(this), this.editable = Ft(this), It(this);
3438
- let a = $e(this), c = Bt(this), d = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", f = s || !this.docView.matchesNode(e.doc, c, a);
3439
- (f || !e.selection.eq(i.selection)) && (r = !0);
3440
- let u = d == "preserve" && r && this.dom.style.overflowAnchor == null && In(this);
3441
- if (r) {
3442
- this.domObserver.stop();
3443
- let p = f && (P || M) && !this.composing && !i.selection.empty && !e.selection.empty && oi(i.selection, e.selection);
3444
- if (f) {
3445
- let h = M ? this.trackWrites = this.domSelectionRange().focusNode : null;
3446
- this.composing && (this.input.compositionNode = Io(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ut(e.doc, c, a, this.dom, this)), h && !this.trackWrites && (p = !0);
3447
- }
3448
- p || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && io(this)) ? _(this, p) : (vt(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
3449
- }
3450
- this.updatePluginViews(i), !((o = this.dragging) === null || o === void 0) && o.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), d == "reset" ? this.dom.scrollTop = 0 : d == "to selection" ? this.scrollToSelection() : u && Fn(u);
3451
- }
3452
- /**
3453
- @internal
3454
- */
3455
- scrollToSelection() {
3456
- let e = this.domSelectionRange().focusNode;
3457
- if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
3458
- if (!this.someProp("handleScrollToSelection", (n) => n(this))) if (this.state.selection instanceof D) {
3459
- let n = this.docView.domAfterPos(this.state.selection.from);
3460
- n.nodeType == 1 && lt(this, n.getBoundingClientRect(), e);
3461
- } else
3462
- lt(this, this.coordsAtPos(this.state.selection.head, 1), e);
3463
- }
3464
- }
3465
- destroyPluginViews() {
3466
- let e;
3467
- for (; e = this.pluginViews.pop(); )
3468
- e.destroy && e.destroy();
3469
- }
3470
- updatePluginViews(e) {
3471
- if (!e || e.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
3472
- this.prevDirectPlugins = this.directPlugins, this.destroyPluginViews();
3473
- for (let n = 0; n < this.directPlugins.length; n++) {
3474
- let o = this.directPlugins[n];
3475
- o.spec.view && this.pluginViews.push(o.spec.view(this));
3476
- }
3477
- for (let n = 0; n < this.state.plugins.length; n++) {
3478
- let o = this.state.plugins[n];
3479
- o.spec.view && this.pluginViews.push(o.spec.view(this));
3480
- }
3481
- } else
3482
- for (let n = 0; n < this.pluginViews.length; n++) {
3483
- let o = this.pluginViews[n];
3484
- o.update && o.update(this, e);
3485
- }
3486
- }
3487
- updateDraggedNode(e, n) {
3488
- let o = e.node, i = -1;
3489
- if (this.state.doc.nodeAt(o.from) == o.node)
3490
- i = o.from;
3491
- else {
3492
- let s = o.from + (this.state.doc.content.size - n.doc.content.size);
3493
- (s > 0 && this.state.doc.nodeAt(s)) == o.node && (i = s);
3494
- }
3495
- this.dragging = new pn(e.slice, e.move, i < 0 ? void 0 : D.create(this.state.doc, i));
3496
- }
3497
- someProp(e, n) {
3498
- let o = this._props && this._props[e], i;
3499
- if (o != null && (i = n ? n(o) : o))
3500
- return i;
3501
- for (let r = 0; r < this.directPlugins.length; r++) {
3502
- let l = this.directPlugins[r].props[e];
3503
- if (l != null && (i = n ? n(l) : l))
3504
- return i;
3505
- }
3506
- let s = this.state.plugins;
3507
- if (s)
3508
- for (let r = 0; r < s.length; r++) {
3509
- let l = s[r].props[e];
3510
- if (l != null && (i = n ? n(l) : l))
3511
- return i;
3512
- }
3513
- }
3514
- /**
3515
- Query whether the view has focus.
3516
- */
3517
- hasFocus() {
3518
- if (P) {
3519
- let e = this.root.activeElement;
3520
- if (e == this.dom)
3521
- return !0;
3522
- if (!e || !this.dom.contains(e))
3523
- return !1;
3524
- for (; e && this.dom != e && this.dom.contains(e); ) {
3525
- if (e.contentEditable == "false")
3526
- return !1;
3527
- e = e.parentElement;
3528
- }
3529
- return !0;
3530
- }
3531
- return this.root.activeElement == this.dom;
3532
- }
3533
- /**
3534
- Focus the editor.
3535
- */
3536
- focus() {
3537
- this.domObserver.stop(), this.editable && zn(this.dom), _(this), this.domObserver.start();
3538
- }
3539
- /**
3540
- Get the document root in which the editor exists. This will
3541
- usually be the top-level `document`, but might be a [shadow
3542
- DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
3543
- root if the editor is inside one.
3544
- */
3545
- get root() {
3546
- let e = this._root;
3547
- if (e == null) {
3548
- for (let n = this.dom.parentNode; n; n = n.parentNode)
3549
- if (n.nodeType == 9 || n.nodeType == 11 && n.host)
3550
- return n.getSelection || (Object.getPrototypeOf(n).getSelection = () => n.ownerDocument.getSelection()), this._root = n;
3551
- }
3552
- return e || document;
3553
- }
3554
- /**
3555
- When an existing editor view is moved to a new document or
3556
- shadow tree, call this to make it recompute its root.
3557
- */
3558
- updateRoot() {
3559
- this._root = null;
3560
- }
3561
- /**
3562
- Given a pair of viewport coordinates, return the document
3563
- position that corresponds to them. May return null if the given
3564
- coordinates aren't inside of the editor. When an object is
3565
- returned, its `pos` property is the position nearest to the
3566
- coordinates, and its `inside` property holds the position of the
3567
- inner node that the position falls inside of, or -1 if it is at
3568
- the top level, not in any node.
3569
- */
3570
- posAtCoords(e) {
3571
- return Hn(this, e);
3572
- }
3573
- /**
3574
- Returns the viewport rectangle at a given document position.
3575
- `left` and `right` will be the same number, as this returns a
3576
- flat cursor-ish rectangle. If the position is between two things
3577
- that aren't directly adjacent, `side` determines which element
3578
- is used. When < 0, the element before the position is used,
3579
- otherwise the element after.
3580
- */
3581
- coordsAtPos(e, n = 1) {
3582
- return Ut(this, e, n);
3583
- }
3584
- /**
3585
- Find the DOM position that corresponds to the given document
3586
- position. When `side` is negative, find the position as close as
3587
- possible to the content before the position. When positive,
3588
- prefer positions close to the content after the position. When
3589
- zero, prefer as shallow a position as possible.
3590
-
3591
- Note that you should **not** mutate the editor's internal DOM,
3592
- only inspect it (and even that is usually not necessary).
3593
- */
3594
- domAtPos(e, n = 0) {
3595
- return this.docView.domFromPos(e, n);
3596
- }
3597
- /**
3598
- Find the DOM node that represents the document node after the
3599
- given position. May return `null` when the position doesn't point
3600
- in front of a node or if the node is inside an opaque node view.
3601
-
3602
- This is intended to be able to call things like
3603
- `getBoundingClientRect` on that DOM node. Do **not** mutate the
3604
- editor DOM directly, or add styling this way, since that will be
3605
- immediately overriden by the editor as it redraws the node.
3606
- */
3607
- nodeDOM(e) {
3608
- let n = this.docView.descAt(e);
3609
- return n ? n.nodeDOM : null;
3610
- }
3611
- /**
3612
- Find the document position that corresponds to a given DOM
3613
- position. (Whenever possible, it is preferable to inspect the
3614
- document structure directly, rather than poking around in the
3615
- DOM, but sometimes—for example when interpreting an event
3616
- target—you don't have a choice.)
3617
-
3618
- The `bias` parameter can be used to influence which side of a DOM
3619
- node to use when the position is inside a leaf node.
3620
- */
3621
- posAtDOM(e, n, o = -1) {
3622
- let i = this.docView.posFromDOM(e, n, o);
3623
- if (i == null)
3624
- throw new RangeError("DOM position not inside the editor");
3625
- return i;
3626
- }
3627
- /**
3628
- Find out whether the selection is at the end of a textblock when
3629
- moving in a given direction. When, for example, given `"left"`,
3630
- it will return true if moving left from the current cursor
3631
- position would leave that position's parent textblock. Will apply
3632
- to the view's current state by default, but it is possible to
3633
- pass a different state.
3634
- */
3635
- endOfTextblock(e, n) {
3636
- return Yn(this, n || this.state, e);
3637
- }
3638
- /**
3639
- Run the editor's paste logic with the given HTML string. The
3640
- `event`, if given, will be passed to the
3641
- [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
3642
- */
3643
- pasteHTML(e, n) {
3644
- return Ne(this, "", e, !1, n || new ClipboardEvent("paste"));
3645
- }
3646
- /**
3647
- Run the editor's paste logic with the given plain-text input.
3648
- */
3649
- pasteText(e, n) {
3650
- return Ne(this, e, null, !0, n || new ClipboardEvent("paste"));
3651
- }
3652
- /**
3653
- Serialize the given slice as it would be if it was copied from
3654
- this editor. Returns a DOM element that contains a
3655
- representation of the slice as its children, a textual
3656
- representation, and the transformed slice (which can be
3657
- different from the given input due to hooks like
3658
- [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
3659
- */
3660
- serializeForClipboard(e) {
3661
- return ve(this, e);
3662
- }
3663
- /**
3664
- Removes the editor from the DOM and destroys all [node
3665
- views](https://prosemirror.net/docs/ref/#view.NodeView).
3666
- */
3667
- destroy() {
3668
- this.docView && (Co(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], $e(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, On());
3669
- }
3670
- /**
3671
- This is true when the view has been
3672
- [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
3673
- used anymore).
3674
- */
3675
- get isDestroyed() {
3676
- return this.docView == null;
3677
- }
3678
- /**
3679
- Used for testing.
3680
- */
3681
- dispatchEvent(e) {
3682
- return Mo(this, e);
3683
- }
3684
- /**
3685
- @internal
3686
- */
3687
- domSelectionRange() {
3688
- let e = this.domSelection();
3689
- return e ? k && this.root.nodeType === 11 && An(this.dom.ownerDocument) == this.dom && Go(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
3690
- }
3691
- /**
3692
- @internal
3693
- */
3694
- domSelection() {
3695
- return this.root.getSelection();
3696
- }
3697
- }
3698
- ni.prototype.dispatch = function(t) {
3699
- let e = this._props.dispatchTransaction;
3700
- e ? e.call(this, t) : this.updateState(this.state.apply(t));
3701
- };
3702
- function Bt(t) {
3703
- let e = /* @__PURE__ */ Object.create(null);
3704
- return e.class = "ProseMirror", e.contenteditable = String(t.editable), t.someProp("attributes", (n) => {
3705
- if (typeof n == "function" && (n = n(t.state)), n)
3706
- for (let o in n)
3707
- o == "class" ? e.class += " " + n[o] : o == "style" ? e.style = (e.style ? e.style + ";" : "") + n[o] : !e[o] && o != "contenteditable" && o != "nodeName" && (e[o] = String(n[o]));
3708
- }), e.translate || (e.translate = "no"), [L.node(0, t.state.doc.content.size, e)];
3709
- }
3710
- function It(t) {
3711
- if (t.markCursor) {
3712
- let e = document.createElement("img");
3713
- e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), t.cursorWrapper = { dom: e, deco: L.widget(t.state.selection.from, e, { raw: !0, marks: t.markCursor }) };
3714
- } else
3715
- t.cursorWrapper = null;
3716
- }
3717
- function Ft(t) {
3718
- return !t.someProp("editable", (e) => e(t.state) === !1);
3719
- }
3720
- function oi(t, e) {
3721
- let n = Math.min(t.$anchor.sharedDepth(t.head), e.$anchor.sharedDepth(e.head));
3722
- return t.$anchor.start(n) != e.$anchor.start(n);
3723
- }
3724
- function zt(t) {
3725
- let e = /* @__PURE__ */ Object.create(null);
3726
- function n(o) {
3727
- for (let i in o)
3728
- Object.prototype.hasOwnProperty.call(e, i) || (e[i] = o[i]);
3729
- }
3730
- return t.someProp("nodeViews", n), t.someProp("markViews", n), e;
3731
- }
3732
- function ii(t, e) {
3733
- let n = 0, o = 0;
3734
- for (let i in t) {
3735
- if (t[i] != e[i])
3736
- return !0;
3737
- n++;
3738
- }
3739
- for (let i in e)
3740
- o++;
3741
- return n != o;
3742
- }
3743
- function Lt(t) {
3744
- if (t.spec.state || t.spec.filterTransaction || t.spec.appendTransaction)
3745
- throw new RangeError("Plugins passed directly to the view must not have a state component");
3746
- }
3747
- export {
3748
- S as D,
3749
- ni as E,
3750
- L as a
3751
- };