@rebasepro/admin 0.0.1-canary.09e5ec5

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 (780) hide show
  1. package/LICENSE +6 -0
  2. package/dist/CollectionEditorDialog-B2M9lCyL.js +4720 -0
  3. package/dist/CollectionEditorDialog-B2M9lCyL.js.map +1 -0
  4. package/dist/CollectionsStudioView-WG6soyfs.js +218 -0
  5. package/dist/CollectionsStudioView-WG6soyfs.js.map +1 -0
  6. package/dist/ContentHomePage-CDF_a6Lp.js +1786 -0
  7. package/dist/ContentHomePage-CDF_a6Lp.js.map +1 -0
  8. package/dist/ExportCollectionAction-Dc0VOWMN.js +439 -0
  9. package/dist/ExportCollectionAction-Dc0VOWMN.js.map +1 -0
  10. package/dist/ImportCollectionAction-DpCagAOy.js +686 -0
  11. package/dist/ImportCollectionAction-DpCagAOy.js.map +1 -0
  12. package/dist/PropertyEditView-DS67DxoT.js +8138 -0
  13. package/dist/PropertyEditView-DS67DxoT.js.map +1 -0
  14. package/dist/RoleChip-QtUFXeTp.js +67 -0
  15. package/dist/RoleChip-QtUFXeTp.js.map +1 -0
  16. package/dist/RolesView-CIuYBimF.js +424 -0
  17. package/dist/RolesView-CIuYBimF.js.map +1 -0
  18. package/dist/UsersView-B5zelXnH.js +493 -0
  19. package/dist/UsersView-B5zelXnH.js.map +1 -0
  20. package/dist/collection_editor/CollectionEditorDialogsContext.d.ts +19 -0
  21. package/dist/collection_editor/ConfigControllerProvider.d.ts +45 -0
  22. package/dist/collection_editor/_cms_internals.d.ts +29 -0
  23. package/dist/collection_editor/api/generateCollectionApi.d.ts +77 -0
  24. package/dist/collection_editor/api/index.d.ts +1 -0
  25. package/dist/collection_editor/index.d.ts +16 -0
  26. package/dist/collection_editor/pgColumnToProperty.d.ts +6 -0
  27. package/dist/collection_editor/types/collection_editor_controller.d.ts +56 -0
  28. package/dist/collection_editor/types/collection_inference.d.ts +10 -0
  29. package/dist/collection_editor/types/config_controller.d.ts +91 -0
  30. package/dist/collection_editor/types/config_permissions.d.ts +19 -0
  31. package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +11 -0
  32. package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +10 -0
  33. package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -0
  34. package/dist/collection_editor/ui/EditorCollectionActionStart.d.ts +2 -0
  35. package/dist/collection_editor/ui/EditorEntityAction.d.ts +2 -0
  36. package/dist/collection_editor/ui/HomePageEditorCollectionAction.d.ts +2 -0
  37. package/dist/collection_editor/ui/KanbanSetupAction.d.ts +10 -0
  38. package/dist/collection_editor/ui/MissingReferenceWidget.d.ts +3 -0
  39. package/dist/collection_editor/ui/NewCollectionButton.d.ts +1 -0
  40. package/dist/collection_editor/ui/NewCollectionCard.d.ts +2 -0
  41. package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +7 -0
  42. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +36 -0
  43. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
  44. package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +11 -0
  45. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +72 -0
  46. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +19 -0
  47. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
  48. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +17 -0
  49. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.d.ts +12 -0
  50. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +1 -0
  51. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +5 -0
  52. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.d.ts +14 -0
  53. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +5 -0
  54. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
  55. package/dist/collection_editor/ui/collection_editor/EntityActionsEditTab.d.ts +5 -0
  56. package/dist/collection_editor/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
  57. package/dist/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +4 -0
  58. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +12 -0
  59. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
  60. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.d.ts +6 -0
  61. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
  62. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
  63. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +47 -0
  64. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +16 -0
  65. package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +31 -0
  66. package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +11 -0
  67. package/dist/collection_editor/ui/collection_editor/SwitchControl.d.ts +8 -0
  68. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
  69. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +7 -0
  70. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +13 -0
  71. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +7 -0
  72. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.d.ts +7 -0
  73. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.d.ts +3 -0
  74. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.d.ts +10 -0
  75. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.d.ts +3 -0
  76. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.d.ts +9 -0
  77. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.d.ts +3 -0
  78. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.d.ts +7 -0
  79. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
  80. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.d.ts +3 -0
  81. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.d.ts +14 -0
  82. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +15 -0
  83. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.d.ts +9 -0
  84. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.d.ts +5 -0
  85. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.d.ts +5 -0
  86. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.d.ts +4 -0
  87. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +3 -0
  88. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
  89. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +3 -0
  90. package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
  91. package/dist/collection_editor/ui/collection_editor/properties/conditions/index.d.ts +6 -0
  92. package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
  93. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +5 -0
  94. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +4 -0
  95. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.d.ts +3 -0
  96. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +11 -0
  97. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.d.ts +3 -0
  98. package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -0
  99. package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -0
  100. package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -0
  101. package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -0
  102. package/dist/collection_editor/ui/collection_editor/util.d.ts +5 -0
  103. package/dist/collection_editor/ui/collection_editor/utils/strings.d.ts +1 -0
  104. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.d.ts +3 -0
  105. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -0
  106. package/dist/collection_editor/useCollectionEditorController.d.ts +6 -0
  107. package/dist/collection_editor/useCollectionsConfigController.d.ts +6 -0
  108. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +6 -0
  109. package/dist/collection_editor/validateCollectionJson.d.ts +22 -0
  110. package/dist/collection_editor_ui.d.ts +8 -0
  111. package/dist/collection_editor_ui.js +11 -0
  112. package/dist/collection_editor_ui.js.map +1 -0
  113. package/dist/components/AdminModeSyncer.d.ts +17 -0
  114. package/dist/components/ArrayContainer.d.ts +58 -0
  115. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  116. package/dist/components/CollectionEditorDialogs.d.ts +15 -0
  117. package/dist/components/DefaultAppBar.d.ts +29 -0
  118. package/dist/components/DefaultDrawer.d.ts +29 -0
  119. package/dist/components/DeleteEntityDialog.d.ts +13 -0
  120. package/dist/components/DrawerNavigationGroup.d.ts +49 -0
  121. package/dist/components/DrawerNavigationItem.d.ts +10 -0
  122. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +39 -0
  123. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +27 -0
  124. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +129 -0
  125. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +26 -0
  126. package/dist/components/EntityCollectionTable/column_utils.d.ts +16 -0
  127. package/dist/components/EntityCollectionTable/fields/TableMultipleRelationField.d.ts +21 -0
  128. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +22 -0
  129. package/dist/components/EntityCollectionTable/fields/TableRelationField.d.ts +22 -0
  130. package/dist/components/EntityCollectionTable/fields/TableRelationSelectorField.d.ts +20 -0
  131. package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +35 -0
  132. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +12 -0
  133. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +9 -0
  134. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +8 -0
  135. package/dist/components/EntityCollectionTable/fields/VirtualTableSelect.d.ts +15 -0
  136. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +7 -0
  137. package/dist/components/EntityCollectionTable/fields/VirtualTableUserSelect.d.ts +12 -0
  138. package/dist/components/EntityCollectionTable/index.d.ts +6 -0
  139. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +21 -0
  140. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +32 -0
  141. package/dist/components/EntityCollectionTable/internal/EntityTableCellActions.d.ts +9 -0
  142. package/dist/components/EntityCollectionTable/internal/common.d.ts +5 -0
  143. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +27 -0
  144. package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +13 -0
  145. package/dist/components/EntityCollectionTable/internal/popup_field/useWindowSize.d.ts +6 -0
  146. package/dist/components/EntityCollectionTable/table_bindings.d.ts +28 -0
  147. package/dist/components/EntityCollectionView/Board.d.ts +2 -0
  148. package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
  149. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
  150. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
  151. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +31 -0
  152. package/dist/components/EntityCollectionView/EntityCard.d.ts +20 -0
  153. package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +21 -0
  154. package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +32 -0
  155. package/dist/components/EntityCollectionView/EntityCollectionListView.d.ts +34 -0
  156. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +64 -0
  157. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +18 -0
  158. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +18 -0
  159. package/dist/components/EntityCollectionView/FiltersDialog.d.ts +15 -0
  160. package/dist/components/EntityCollectionView/SplitListView.d.ts +57 -0
  161. package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
  162. package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
  163. package/dist/components/EntityCollectionView/hooks/useCollectionInlineEditor.d.ts +12 -0
  164. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +19 -0
  165. package/dist/components/EntityCollectionView/useBoardDataController.d.ts +61 -0
  166. package/dist/components/EntityCollectionView/useEntityPreviewSlots.d.ts +101 -0
  167. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  168. package/dist/components/EntityCollectionView/utils.d.ts +3 -0
  169. package/dist/components/EntityEditView.d.ts +49 -0
  170. package/dist/components/EntityEditViewFormActions.d.ts +2 -0
  171. package/dist/components/EntityJsonPreview.d.ts +3 -0
  172. package/dist/components/EntityPreview.d.ts +56 -0
  173. package/dist/components/EntitySidePanel.d.ts +10 -0
  174. package/dist/components/EntityView.d.ts +12 -0
  175. package/dist/components/FieldCaption.d.ts +5 -0
  176. package/dist/components/HomePage/ContentHomePage.d.ts +11 -0
  177. package/dist/components/HomePage/FavouritesView.d.ts +3 -0
  178. package/dist/components/HomePage/HomePageDnD.d.ts +77 -0
  179. package/dist/components/HomePage/NavigationCard.d.ts +11 -0
  180. package/dist/components/HomePage/NavigationCardBinding.d.ts +18 -0
  181. package/dist/components/HomePage/NavigationGroup.d.ts +11 -0
  182. package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
  183. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  184. package/dist/components/HomePage/index.d.ts +4 -0
  185. package/dist/components/PropertyCollectionView.d.ts +24 -0
  186. package/dist/components/PropertyConfigBadge.d.ts +6 -0
  187. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  188. package/dist/components/RebaseAuthGate.d.ts +21 -0
  189. package/dist/components/RebaseCMS.d.ts +10 -0
  190. package/dist/components/RebaseLayout.d.ts +32 -0
  191. package/dist/components/RebaseNavigation.d.ts +24 -0
  192. package/dist/components/RebaseRouteDefs.d.ts +30 -0
  193. package/dist/components/RebaseShell.d.ts +25 -0
  194. package/dist/components/ReferenceTable/EntitySelectionTable.d.ts +59 -0
  195. package/dist/components/ReferenceWidget.d.ts +30 -0
  196. package/dist/components/RelationSelector.d.ts +32 -0
  197. package/dist/components/SearchIconsView.d.ts +5 -0
  198. package/dist/components/SelectableTable/SelectableTable.d.ts +95 -0
  199. package/dist/components/SelectableTable/SelectableTableContext.d.ts +4 -0
  200. package/dist/components/SelectableTable/SelectionStore.d.ts +26 -0
  201. package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +9 -0
  202. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +12 -0
  203. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +15 -0
  204. package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +12 -0
  205. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +13 -0
  206. package/dist/components/SideDialogs.d.ts +25 -0
  207. package/dist/components/SideEntityProvider.d.ts +32 -0
  208. package/dist/components/UserSelector.d.ts +18 -0
  209. package/dist/components/admin/RoleChip.d.ts +4 -0
  210. package/dist/components/admin/RolesView.d.ts +4 -0
  211. package/dist/components/admin/UsersView.d.ts +4 -0
  212. package/dist/components/admin/index.d.ts +3 -0
  213. package/dist/components/app/AppBar.d.ts +12 -0
  214. package/dist/components/app/Drawer.d.ts +19 -0
  215. package/dist/components/app/Scaffold.d.ts +34 -0
  216. package/dist/components/app/index.d.ts +4 -0
  217. package/dist/components/app/useApp.d.ts +17 -0
  218. package/dist/components/common/default_entity_actions.d.ts +4 -0
  219. package/dist/components/common/index.d.ts +1 -0
  220. package/dist/components/field_configs.d.ts +7 -0
  221. package/dist/components/history/EntityHistoryEntry.d.ts +17 -0
  222. package/dist/components/history/EntityHistoryView.d.ts +6 -0
  223. package/dist/components/history/LastEditedByFormAction.d.ts +6 -0
  224. package/dist/components/history/LastEditedByIndicator.d.ts +10 -0
  225. package/dist/components/history/UserChip.d.ts +4 -0
  226. package/dist/components/history/index.d.ts +5 -0
  227. package/dist/components/index.d.ts +38 -0
  228. package/dist/contexts/BreacrumbsContext.d.ts +8 -0
  229. package/dist/contexts/SideDialogsControllerContext.d.ts +3 -0
  230. package/dist/contexts/SideEntityControllerContext.d.ts +3 -0
  231. package/dist/data_export/export/BasicExportAction.d.ts +7 -0
  232. package/dist/data_export/export/ExportCollectionAction.d.ts +11 -0
  233. package/dist/data_export/export/export.d.ts +22 -0
  234. package/dist/data_export/export/index.d.ts +3 -0
  235. package/dist/data_export/index.d.ts +1 -0
  236. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +13 -0
  237. package/dist/data_import/components/ImportFileUpload.d.ts +3 -0
  238. package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +9 -0
  239. package/dist/data_import/components/ImportSaveInProgress.d.ts +8 -0
  240. package/dist/data_import/components/index.d.ts +4 -0
  241. package/dist/data_import/hooks/index.d.ts +1 -0
  242. package/dist/data_import/hooks/useImportConfig.d.ts +2 -0
  243. package/dist/data_import/import/ImportCollectionAction.d.ts +15 -0
  244. package/dist/data_import/import/index.d.ts +1 -0
  245. package/dist/data_import/index.d.ts +5 -0
  246. package/dist/data_import/types/column_mapping.d.ts +20 -0
  247. package/dist/data_import/types/index.d.ts +1 -0
  248. package/dist/data_import/utils/data.d.ts +4 -0
  249. package/dist/data_import/utils/file_headers.d.ts +1 -0
  250. package/dist/data_import/utils/file_to_json.d.ts +16 -0
  251. package/dist/data_import/utils/get_import_inference_type.d.ts +2 -0
  252. package/dist/data_import/utils/get_properties_mapping.d.ts +1 -0
  253. package/dist/data_import/utils/index.d.ts +3 -0
  254. package/dist/editor/components/SlashCommandMenu.d.ts +6 -0
  255. package/dist/editor/components/editor-bubble-item.d.ts +8 -0
  256. package/dist/editor/components/editor-bubble.d.ts +8 -0
  257. package/dist/editor/components/image-bubble.d.ts +5 -0
  258. package/dist/editor/components/index.d.ts +16 -0
  259. package/dist/editor/components/table-bubble.d.ts +5 -0
  260. package/dist/editor/editor.d.ts +30 -0
  261. package/dist/editor/extensions/HighlightDecorationExtension.d.ts +24 -0
  262. package/dist/editor/extensions/Image/index.d.ts +6 -0
  263. package/dist/editor/extensions/Image.d.ts +6 -0
  264. package/dist/editor/extensions/TextLoadingDecorationExtension.d.ts +16 -0
  265. package/dist/editor/extensions/clipboard.d.ts +7 -0
  266. package/dist/editor/extensions/custom-keymap.d.ts +1 -0
  267. package/dist/editor/extensions/drag-and-drop.d.ts +9 -0
  268. package/dist/editor/hooks/useProseMirror.d.ts +13 -0
  269. package/dist/editor/hooks/useProseMirrorContext.d.ts +9 -0
  270. package/dist/editor/index.d.ts +2 -0
  271. package/dist/editor/markdown.d.ts +5 -0
  272. package/dist/editor/nodeViews/ImageComponent.d.ts +3 -0
  273. package/dist/editor/nodeViews/ReactNodeView.d.ts +29 -0
  274. package/dist/editor/nodeViews/TaskItemComponent.d.ts +3 -0
  275. package/dist/editor/nodeViews/index.d.ts +6 -0
  276. package/dist/editor/plugins/index.d.ts +2 -0
  277. package/dist/editor/plugins/inputrules.d.ts +6 -0
  278. package/dist/editor/plugins/placeholderPlugin.d.ts +3 -0
  279. package/dist/editor/plugins/slashCommandPlugin.d.ts +12 -0
  280. package/dist/editor/schema.d.ts +2 -0
  281. package/dist/editor/selectors/ai-selector.d.ts +0 -0
  282. package/dist/editor/selectors/color-selector.d.ts +10 -0
  283. package/dist/editor/selectors/link-selector.d.ts +8 -0
  284. package/dist/editor/selectors/node-selector.d.ts +15 -0
  285. package/dist/editor/selectors/text-buttons.d.ts +1 -0
  286. package/dist/editor/types.d.ts +5 -0
  287. package/dist/editor/useProseMirror.d.ts +16 -0
  288. package/dist/editor/utils/prosemirror-utils.d.ts +7 -0
  289. package/dist/editor/utils/remove_classes.d.ts +1 -0
  290. package/dist/editor/utils/useDebouncedCallback.d.ts +1 -0
  291. package/dist/editor.js +3834 -0
  292. package/dist/editor.js.map +1 -0
  293. package/dist/form/EntityForm.d.ts +10 -0
  294. package/dist/form/EntityFormActions.d.ts +2 -0
  295. package/dist/form/PropertyFieldBinding.d.ts +30 -0
  296. package/dist/form/components/ErrorFocus.d.ts +4 -0
  297. package/dist/form/components/FieldHelperText.d.ts +12 -0
  298. package/dist/form/components/FormEntry.d.ts +6 -0
  299. package/dist/form/components/FormLayout.d.ts +5 -0
  300. package/dist/form/components/LabelWithIcon.d.ts +14 -0
  301. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  302. package/dist/form/components/LocalChangesMenu.d.ts +11 -0
  303. package/dist/form/components/StorageItemPreview.d.ts +14 -0
  304. package/dist/form/components/StorageUploadProgress.d.ts +10 -0
  305. package/dist/form/components/index.d.ts +5 -0
  306. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +10 -0
  307. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +13 -0
  308. package/dist/form/field_bindings/BlockFieldBinding.d.ts +11 -0
  309. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +12 -0
  310. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +8 -0
  311. package/dist/form/field_bindings/MapFieldBinding.d.ts +10 -0
  312. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +12 -0
  313. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +10 -0
  314. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +10 -0
  315. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +11 -0
  316. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +10 -0
  317. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +10 -0
  318. package/dist/form/field_bindings/RelationFieldBinding.d.ts +3 -0
  319. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +11 -0
  320. package/dist/form/field_bindings/SelectFieldBinding.d.ts +11 -0
  321. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +21 -0
  322. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +10 -0
  323. package/dist/form/field_bindings/TextFieldBinding.d.ts +9 -0
  324. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +14 -0
  325. package/dist/form/index.d.ts +20 -0
  326. package/dist/form/useClearRestoreValue.d.ts +13 -0
  327. package/dist/form/validation.d.ts +21 -0
  328. package/dist/hooks/index.d.ts +15 -0
  329. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +5 -0
  330. package/dist/hooks/navigation/contexts/NavigationStateContext.d.ts +4 -0
  331. package/dist/hooks/navigation/contexts/UrlContext.d.ts +4 -0
  332. package/dist/hooks/navigation/contexts/index.d.ts +3 -0
  333. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +7 -0
  334. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +34 -0
  335. package/dist/hooks/navigation/useBuildUrlController.d.ts +7 -0
  336. package/dist/hooks/navigation/useNavigationRegistry.d.ts +11 -0
  337. package/dist/hooks/navigation/useNavigationResolution.d.ts +7 -0
  338. package/dist/hooks/navigation/useNavigationURLs.d.ts +11 -0
  339. package/dist/hooks/navigation/useResolvedCollections.d.ts +28 -0
  340. package/dist/hooks/navigation/useResolvedViews.d.ts +29 -0
  341. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +27 -0
  342. package/dist/hooks/navigation/utils.d.ts +12 -0
  343. package/dist/hooks/useBreadcrumbsController.d.ts +42 -0
  344. package/dist/hooks/useBuildSideDialogsController.d.ts +2 -0
  345. package/dist/hooks/useBuildSideEntityController.d.ts +6 -0
  346. package/dist/hooks/useCMSContext.d.ts +27 -0
  347. package/dist/hooks/useEntityHistory.d.ts +30 -0
  348. package/dist/hooks/useEntitySelectionDialog.d.ts +18 -0
  349. package/dist/hooks/useResolvedNavigationFrom.d.ts +73 -0
  350. package/dist/hooks/useSideDialogsController.d.ts +19 -0
  351. package/dist/hooks/useSideEntityController.d.ts +11 -0
  352. package/dist/index-CBhrgpR7.js +12 -0
  353. package/dist/index-CBhrgpR7.js.map +1 -0
  354. package/dist/index-CHxgwt6E.js +456 -0
  355. package/dist/index-CHxgwt6E.js.map +1 -0
  356. package/dist/index-Dey5WJpO.js +8 -0
  357. package/dist/index-Dey5WJpO.js.map +1 -0
  358. package/dist/index.d.ts +12 -0
  359. package/dist/index.js +799 -0
  360. package/dist/index.js.map +1 -0
  361. package/dist/markdown-z2Ir7Cgo.js +618 -0
  362. package/dist/markdown-z2Ir7Cgo.js.map +1 -0
  363. package/dist/preview/PropertyPreview.d.ts +7 -0
  364. package/dist/preview/components/ArrayEnumPreview.d.ts +11 -0
  365. package/dist/preview/components/BooleanPreview.d.ts +11 -0
  366. package/dist/preview/components/DatePreview.d.ts +17 -0
  367. package/dist/preview/components/EmptyValue.d.ts +6 -0
  368. package/dist/preview/components/EnumValuesChip.d.ts +13 -0
  369. package/dist/preview/components/ImagePreview.d.ts +16 -0
  370. package/dist/preview/components/ReferencePreview.d.ts +17 -0
  371. package/dist/preview/components/RelationPreview.d.ts +17 -0
  372. package/dist/preview/components/StorageThumbnail.d.ts +15 -0
  373. package/dist/preview/components/UrlComponentPreview.d.ts +14 -0
  374. package/dist/preview/components/UserPreview.d.ts +9 -0
  375. package/dist/preview/index.d.ts +23 -0
  376. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +6 -0
  377. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +6 -0
  378. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +6 -0
  379. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +6 -0
  380. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +6 -0
  381. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +6 -0
  382. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +6 -0
  383. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +6 -0
  384. package/dist/preview/property_previews/MapPropertyPreview.d.ts +9 -0
  385. package/dist/preview/property_previews/NumberPropertyPreview.d.ts +7 -0
  386. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +14 -0
  387. package/dist/preview/property_previews/StringPropertyPreview.d.ts +7 -0
  388. package/dist/preview/util.d.ts +7 -0
  389. package/dist/routes/CustomViewRoute.d.ts +4 -0
  390. package/dist/routes/RebaseRoute.d.ts +1 -0
  391. package/dist/routes/index.d.ts +2 -0
  392. package/dist/types/components/EntityFormActionsProps.d.ts +19 -0
  393. package/dist/types/components/EntityFormProps.d.ts +48 -0
  394. package/dist/types/components/PropertyPreviewProps.d.ts +47 -0
  395. package/dist/types/components/formex.d.ts +40 -0
  396. package/dist/types/components/index.d.ts +3 -0
  397. package/dist/types/fields.d.ts +221 -0
  398. package/dist/types/index.d.ts +2 -0
  399. package/dist/useEntityHistory-Dcj4zhGj.js +121 -0
  400. package/dist/useEntityHistory-Dcj4zhGj.js.map +1 -0
  401. package/dist/util/entity_actions.d.ts +2 -0
  402. package/dist/util/index.d.ts +5 -0
  403. package/dist/util/navigation_utils.d.ts +17 -0
  404. package/dist/util/previews.d.ts +4 -0
  405. package/dist/util/property_utils.d.ts +25 -0
  406. package/dist/util/resolutions.d.ts +9 -0
  407. package/dist/util-BQ82ySL3.js +27720 -0
  408. package/dist/util-BQ82ySL3.js.map +1 -0
  409. package/package.json +171 -0
  410. package/src/collection_editor/CollectionEditorDialogsContext.tsx +25 -0
  411. package/src/collection_editor/ConfigControllerProvider.tsx +407 -0
  412. package/src/collection_editor/_cms_internals.ts +41 -0
  413. package/src/collection_editor/api/generateCollectionApi.ts +125 -0
  414. package/src/collection_editor/api/index.ts +1 -0
  415. package/src/collection_editor/index.ts +63 -0
  416. package/src/collection_editor/pgColumnToProperty.ts +273 -0
  417. package/src/collection_editor/types/collection_editor_controller.tsx +64 -0
  418. package/src/collection_editor/types/collection_inference.ts +17 -0
  419. package/src/collection_editor/types/config_controller.tsx +109 -0
  420. package/src/collection_editor/types/config_permissions.ts +20 -0
  421. package/src/collection_editor/ui/AddKanbanColumnAction.tsx +186 -0
  422. package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +50 -0
  423. package/src/collection_editor/ui/EditorCollectionAction.tsx +58 -0
  424. package/src/collection_editor/ui/EditorCollectionActionStart.tsx +93 -0
  425. package/src/collection_editor/ui/EditorEntityAction.tsx +54 -0
  426. package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +120 -0
  427. package/src/collection_editor/ui/KanbanSetupAction.tsx +40 -0
  428. package/src/collection_editor/ui/MissingReferenceWidget.tsx +33 -0
  429. package/src/collection_editor/ui/NewCollectionButton.tsx +27 -0
  430. package/src/collection_editor/ui/NewCollectionCard.tsx +53 -0
  431. package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +53 -0
  432. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +246 -0
  433. package/src/collection_editor/ui/collection_editor/AIModifiedPathsContext.tsx +90 -0
  434. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +417 -0
  435. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +977 -0
  436. package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +286 -0
  437. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +164 -0
  438. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +589 -0
  439. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +332 -0
  440. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +242 -0
  441. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +101 -0
  442. package/src/collection_editor/ui/collection_editor/CollectionYupValidation.tsx +9 -0
  443. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +133 -0
  444. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +302 -0
  445. package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +151 -0
  446. package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +40 -0
  447. package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +39 -0
  448. package/src/collection_editor/ui/collection_editor/EnumForm.tsx +358 -0
  449. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +252 -0
  450. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +142 -0
  451. package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +194 -0
  452. package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +41 -0
  453. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +777 -0
  454. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +155 -0
  455. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +350 -0
  456. package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +241 -0
  457. package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +39 -0
  458. package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +47 -0
  459. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +67 -0
  460. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +295 -0
  461. package/src/collection_editor/ui/collection_editor/import/clean_import_data.ts +57 -0
  462. package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +147 -0
  463. package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +41 -0
  464. package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +113 -0
  465. package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +250 -0
  466. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +125 -0
  467. package/src/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.tsx +20 -0
  468. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +153 -0
  469. package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +210 -0
  470. package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +117 -0
  471. package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +163 -0
  472. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +346 -0
  473. package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +106 -0
  474. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +360 -0
  475. package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +148 -0
  476. package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +90 -0
  477. package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +47 -0
  478. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +915 -0
  479. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +29 -0
  480. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +614 -0
  481. package/src/collection_editor/ui/collection_editor/properties/conditions/index.ts +6 -0
  482. package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +93 -0
  483. package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +52 -0
  484. package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +63 -0
  485. package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +117 -0
  486. package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +154 -0
  487. package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +29 -0
  488. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +112 -0
  489. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +183 -0
  490. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +88 -0
  491. package/src/collection_editor/ui/collection_editor/templates/users_template.ts +42 -0
  492. package/src/collection_editor/ui/collection_editor/util.ts +28 -0
  493. package/src/collection_editor/ui/collection_editor/utils/strings.ts +1 -0
  494. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +34 -0
  495. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +281 -0
  496. package/src/collection_editor/useCollectionEditorController.tsx +9 -0
  497. package/src/collection_editor/useCollectionsConfigController.tsx +9 -0
  498. package/src/collection_editor/useLocalCollectionsConfigController.tsx +120 -0
  499. package/src/collection_editor/validateCollectionJson.ts +379 -0
  500. package/src/collection_editor_ui.ts +15 -0
  501. package/src/components/AdminModeSyncer.tsx +56 -0
  502. package/src/components/ArrayContainer.tsx +538 -0
  503. package/src/components/ClearFilterSortButton.tsx +48 -0
  504. package/src/components/CollectionEditorDialogs.tsx +68 -0
  505. package/src/components/DefaultAppBar.tsx +242 -0
  506. package/src/components/DefaultDrawer.tsx +347 -0
  507. package/src/components/DeleteEntityDialog.tsx +182 -0
  508. package/src/components/DrawerNavigationGroup.tsx +130 -0
  509. package/src/components/DrawerNavigationItem.tsx +65 -0
  510. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +233 -0
  511. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +385 -0
  512. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +171 -0
  513. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +340 -0
  514. package/src/components/EntityCollectionTable/column_utils.tsx +75 -0
  515. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +130 -0
  516. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +172 -0
  517. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +181 -0
  518. package/src/components/EntityCollectionTable/fields/TableRelationSelectorField.tsx +42 -0
  519. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +322 -0
  520. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +39 -0
  521. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +90 -0
  522. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +80 -0
  523. package/src/components/EntityCollectionTable/fields/VirtualTableSelect.tsx +133 -0
  524. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +32 -0
  525. package/src/components/EntityCollectionTable/fields/VirtualTableUserSelect.tsx +41 -0
  526. package/src/components/EntityCollectionTable/index.tsx +14 -0
  527. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +102 -0
  528. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +310 -0
  529. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +81 -0
  530. package/src/components/EntityCollectionTable/internal/common.tsx +73 -0
  531. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +418 -0
  532. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +96 -0
  533. package/src/components/EntityCollectionTable/internal/popup_field/useWindowSize.tsx +22 -0
  534. package/src/components/EntityCollectionTable/table_bindings.tsx +346 -0
  535. package/src/components/EntityCollectionView/Board.tsx +474 -0
  536. package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
  537. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
  538. package/src/components/EntityCollectionView/BoardSortableList.tsx +177 -0
  539. package/src/components/EntityCollectionView/EntityBoardCard.tsx +264 -0
  540. package/src/components/EntityCollectionView/EntityCard.tsx +224 -0
  541. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +614 -0
  542. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +267 -0
  543. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +816 -0
  544. package/src/components/EntityCollectionView/EntityCollectionView.tsx +1277 -0
  545. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +179 -0
  546. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +148 -0
  547. package/src/components/EntityCollectionView/FiltersDialog.tsx +242 -0
  548. package/src/components/EntityCollectionView/SplitListView.tsx +314 -0
  549. package/src/components/EntityCollectionView/ViewModeToggle.tsx +199 -0
  550. package/src/components/EntityCollectionView/board_types.ts +113 -0
  551. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +79 -0
  552. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +140 -0
  553. package/src/components/EntityCollectionView/useBoardDataController.tsx +675 -0
  554. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +442 -0
  555. package/src/components/EntityCollectionView/useSelectionController.tsx +39 -0
  556. package/src/components/EntityCollectionView/utils.ts +19 -0
  557. package/src/components/EntityEditView.tsx +632 -0
  558. package/src/components/EntityEditViewFormActions.tsx +352 -0
  559. package/src/components/EntityJsonPreview.tsx +66 -0
  560. package/src/components/EntityPreview.tsx +372 -0
  561. package/src/components/EntitySidePanel.tsx +160 -0
  562. package/src/components/EntityView.tsx +69 -0
  563. package/src/components/FieldCaption.tsx +14 -0
  564. package/src/components/HomePage/ContentHomePage.tsx +567 -0
  565. package/src/components/HomePage/FavouritesView.tsx +61 -0
  566. package/src/components/HomePage/HomePageDnD.tsx +703 -0
  567. package/src/components/HomePage/NavigationCard.tsx +88 -0
  568. package/src/components/HomePage/NavigationCardBinding.tsx +108 -0
  569. package/src/components/HomePage/NavigationGroup.tsx +157 -0
  570. package/src/components/HomePage/RenameGroupDialog.tsx +123 -0
  571. package/src/components/HomePage/SmallNavigationCard.tsx +46 -0
  572. package/src/components/HomePage/index.tsx +5 -0
  573. package/src/components/PropertyCollectionView.tsx +335 -0
  574. package/src/components/PropertyConfigBadge.tsx +27 -0
  575. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  576. package/src/components/RebaseAuthGate.tsx +42 -0
  577. package/src/components/RebaseCMS.tsx +27 -0
  578. package/src/components/RebaseLayout.tsx +73 -0
  579. package/src/components/RebaseNavigation.tsx +230 -0
  580. package/src/components/RebaseRouteDefs.tsx +130 -0
  581. package/src/components/RebaseShell.tsx +70 -0
  582. package/src/components/ReferenceTable/EntitySelectionTable.tsx +363 -0
  583. package/src/components/ReferenceWidget.tsx +155 -0
  584. package/src/components/RelationSelector.tsx +672 -0
  585. package/src/components/SearchIconsView.tsx +96 -0
  586. package/src/components/SelectableTable/SelectableTable.tsx +356 -0
  587. package/src/components/SelectableTable/SelectableTableContext.tsx +6 -0
  588. package/src/components/SelectableTable/SelectionStore.ts +67 -0
  589. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +51 -0
  590. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +125 -0
  591. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +208 -0
  592. package/src/components/SelectableTable/filters/RelationFilterField.tsx +138 -0
  593. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +221 -0
  594. package/src/components/SideDialogs.tsx +208 -0
  595. package/src/components/SideEntityProvider.tsx +76 -0
  596. package/src/components/UserSelector.tsx +339 -0
  597. package/src/components/admin/RoleChip.tsx +23 -0
  598. package/src/components/admin/RolesView.tsx +419 -0
  599. package/src/components/admin/UsersView.tsx +782 -0
  600. package/src/components/admin/index.ts +3 -0
  601. package/src/components/app/AppBar.tsx +17 -0
  602. package/src/components/app/Drawer.tsx +30 -0
  603. package/src/components/app/Scaffold.tsx +242 -0
  604. package/src/components/app/index.ts +4 -0
  605. package/src/components/app/useApp.tsx +36 -0
  606. package/src/components/common/default_entity_actions.tsx +156 -0
  607. package/src/components/common/index.ts +1 -0
  608. package/src/components/field_configs.tsx +423 -0
  609. package/src/components/history/EntityHistoryEntry.tsx +182 -0
  610. package/src/components/history/EntityHistoryView.tsx +191 -0
  611. package/src/components/history/LastEditedByFormAction.tsx +24 -0
  612. package/src/components/history/LastEditedByIndicator.tsx +98 -0
  613. package/src/components/history/UserChip.tsx +15 -0
  614. package/src/components/history/index.tsx +5 -0
  615. package/src/components/index.ts +55 -0
  616. package/src/contexts/BreacrumbsContext.tsx +53 -0
  617. package/src/contexts/SideDialogsControllerContext.tsx +5 -0
  618. package/src/contexts/SideEntityControllerContext.tsx +5 -0
  619. package/src/data_export/export/BasicExportAction.tsx +143 -0
  620. package/src/data_export/export/ExportCollectionAction.tsx +266 -0
  621. package/src/data_export/export/export.ts +248 -0
  622. package/src/data_export/export/index.ts +3 -0
  623. package/src/data_export/index.ts +1 -0
  624. package/src/data_import/components/DataNewPropertiesMapping.tsx +231 -0
  625. package/src/data_import/components/ImportFileUpload.tsx +43 -0
  626. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +60 -0
  627. package/src/data_import/components/ImportSaveInProgress.tsx +121 -0
  628. package/src/data_import/components/index.ts +4 -0
  629. package/src/data_import/hooks/index.ts +1 -0
  630. package/src/data_import/hooks/useImportConfig.tsx +34 -0
  631. package/src/data_import/import/ImportCollectionAction.tsx +436 -0
  632. package/src/data_import/import/index.ts +1 -0
  633. package/src/data_import/index.ts +5 -0
  634. package/src/data_import/types/column_mapping.ts +32 -0
  635. package/src/data_import/types/index.ts +1 -0
  636. package/src/data_import/utils/data.ts +148 -0
  637. package/src/data_import/utils/file_headers.ts +90 -0
  638. package/src/data_import/utils/file_to_json.ts +106 -0
  639. package/src/data_import/utils/get_import_inference_type.ts +27 -0
  640. package/src/data_import/utils/get_properties_mapping.ts +67 -0
  641. package/src/data_import/utils/index.ts +3 -0
  642. package/src/editor/components/SlashCommandMenu.tsx +517 -0
  643. package/src/editor/components/editor-bubble-item.tsx +32 -0
  644. package/src/editor/components/editor-bubble.tsx +120 -0
  645. package/src/editor/components/image-bubble.tsx +165 -0
  646. package/src/editor/components/index.ts +14 -0
  647. package/src/editor/components/table-bubble.tsx +171 -0
  648. package/src/editor/editor.tsx +510 -0
  649. package/src/editor/extensions/HighlightDecorationExtension.ts +114 -0
  650. package/src/editor/extensions/Image/index.ts +133 -0
  651. package/src/editor/extensions/Image.ts +159 -0
  652. package/src/editor/extensions/TextLoadingDecorationExtension.tsx +107 -0
  653. package/src/editor/extensions/clipboard.ts +72 -0
  654. package/src/editor/extensions/custom-keymap.ts +25 -0
  655. package/src/editor/extensions/drag-and-drop.tsx +508 -0
  656. package/src/editor/hooks/useProseMirror.ts +126 -0
  657. package/src/editor/hooks/useProseMirrorContext.ts +15 -0
  658. package/src/editor/index.ts +2 -0
  659. package/src/editor/markdown.ts +205 -0
  660. package/src/editor/nodeViews/ImageComponent.tsx +20 -0
  661. package/src/editor/nodeViews/ReactNodeView.tsx +89 -0
  662. package/src/editor/nodeViews/TaskItemComponent.tsx +29 -0
  663. package/src/editor/nodeViews/index.ts +35 -0
  664. package/src/editor/plugins/index.ts +58 -0
  665. package/src/editor/plugins/inputrules.ts +82 -0
  666. package/src/editor/plugins/placeholderPlugin.ts +55 -0
  667. package/src/editor/plugins/slashCommandPlugin.ts +65 -0
  668. package/src/editor/schema.ts +263 -0
  669. package/src/editor/selectors/ai-selector.tsx +111 -0
  670. package/src/editor/selectors/color-selector.tsx +200 -0
  671. package/src/editor/selectors/link-selector.tsx +119 -0
  672. package/src/editor/selectors/node-selector.tsx +145 -0
  673. package/src/editor/selectors/text-buttons.tsx +80 -0
  674. package/src/editor/types.ts +6 -0
  675. package/src/editor/useProseMirror.ts +125 -0
  676. package/src/editor/utils/prosemirror-utils.ts +113 -0
  677. package/src/editor/utils/remove_classes.ts +17 -0
  678. package/src/editor/utils/useDebouncedCallback.ts +25 -0
  679. package/src/form/EntityForm.tsx +855 -0
  680. package/src/form/EntityFormActions.tsx +214 -0
  681. package/src/form/PropertyFieldBinding.tsx +344 -0
  682. package/src/form/components/ErrorFocus.tsx +44 -0
  683. package/src/form/components/FieldHelperText.tsx +85 -0
  684. package/src/form/components/FormEntry.tsx +22 -0
  685. package/src/form/components/FormLayout.tsx +16 -0
  686. package/src/form/components/LabelWithIcon.tsx +43 -0
  687. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  688. package/src/form/components/LocalChangesMenu.tsx +132 -0
  689. package/src/form/components/StorageItemPreview.tsx +82 -0
  690. package/src/form/components/StorageUploadProgress.tsx +105 -0
  691. package/src/form/components/index.tsx +5 -0
  692. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +107 -0
  693. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +171 -0
  694. package/src/form/field_bindings/BlockFieldBinding.tsx +280 -0
  695. package/src/form/field_bindings/DateTimeFieldBinding.tsx +72 -0
  696. package/src/form/field_bindings/KeyValueFieldBinding.tsx +554 -0
  697. package/src/form/field_bindings/MapFieldBinding.tsx +162 -0
  698. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +232 -0
  699. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +123 -0
  700. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +157 -0
  701. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +66 -0
  702. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +141 -0
  703. package/src/form/field_bindings/ReferenceFieldBinding.tsx +141 -0
  704. package/src/form/field_bindings/RelationFieldBinding.tsx +184 -0
  705. package/src/form/field_bindings/RepeatFieldBinding.tsx +139 -0
  706. package/src/form/field_bindings/SelectFieldBinding.tsx +110 -0
  707. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +493 -0
  708. package/src/form/field_bindings/SwitchFieldBinding.tsx +65 -0
  709. package/src/form/field_bindings/TextFieldBinding.tsx +156 -0
  710. package/src/form/field_bindings/UserSelectFieldBinding.tsx +66 -0
  711. package/src/form/index.tsx +27 -0
  712. package/src/form/useClearRestoreValue.tsx +36 -0
  713. package/src/form/validation.ts +519 -0
  714. package/src/hooks/index.ts +15 -0
  715. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +20 -0
  716. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +16 -0
  717. package/src/hooks/navigation/contexts/UrlContext.tsx +25 -0
  718. package/src/hooks/navigation/contexts/index.ts +14 -0
  719. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +171 -0
  720. package/src/hooks/navigation/useBuildNavigationStateController.tsx +133 -0
  721. package/src/hooks/navigation/useBuildUrlController.tsx +66 -0
  722. package/src/hooks/navigation/useNavigationRegistry.ts +153 -0
  723. package/src/hooks/navigation/useNavigationResolution.ts +91 -0
  724. package/src/hooks/navigation/useNavigationURLs.ts +56 -0
  725. package/src/hooks/navigation/useResolvedCollections.ts +133 -0
  726. package/src/hooks/navigation/useResolvedViews.tsx +216 -0
  727. package/src/hooks/navigation/useTopLevelNavigation.ts +257 -0
  728. package/src/hooks/navigation/utils.ts +176 -0
  729. package/src/hooks/useBreadcrumbsController.tsx +49 -0
  730. package/src/hooks/useBuildSideDialogsController.tsx +145 -0
  731. package/src/hooks/useBuildSideEntityController.tsx +310 -0
  732. package/src/hooks/useCMSContext.tsx +79 -0
  733. package/src/hooks/useEntityHistory.ts +167 -0
  734. package/src/hooks/useEntitySelectionDialog.tsx +57 -0
  735. package/src/hooks/useResolvedNavigationFrom.tsx +160 -0
  736. package/src/hooks/useSideDialogsController.tsx +25 -0
  737. package/src/hooks/useSideEntityController.tsx +13 -0
  738. package/src/index.ts +95 -0
  739. package/src/preview/PropertyPreview.tsx +292 -0
  740. package/src/preview/components/ArrayEnumPreview.tsx +39 -0
  741. package/src/preview/components/BooleanPreview.tsx +25 -0
  742. package/src/preview/components/DatePreview.tsx +93 -0
  743. package/src/preview/components/EmptyValue.tsx +10 -0
  744. package/src/preview/components/EnumValuesChip.tsx +39 -0
  745. package/src/preview/components/ImagePreview.tsx +143 -0
  746. package/src/preview/components/ReferencePreview.tsx +166 -0
  747. package/src/preview/components/RelationPreview.tsx +160 -0
  748. package/src/preview/components/StorageThumbnail.tsx +90 -0
  749. package/src/preview/components/UrlComponentPreview.tsx +115 -0
  750. package/src/preview/components/UserPreview.tsx +30 -0
  751. package/src/preview/index.ts +25 -0
  752. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +73 -0
  753. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +44 -0
  754. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +50 -0
  755. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +49 -0
  756. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +44 -0
  757. package/src/preview/property_previews/ArrayOneOfPreview.tsx +72 -0
  758. package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +35 -0
  759. package/src/preview/property_previews/ArrayPropertyPreview.tsx +70 -0
  760. package/src/preview/property_previews/MapPropertyPreview.tsx +146 -0
  761. package/src/preview/property_previews/NumberPropertyPreview.tsx +29 -0
  762. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +277 -0
  763. package/src/preview/property_previews/StringPropertyPreview.tsx +59 -0
  764. package/src/preview/util.ts +30 -0
  765. package/src/routes/CustomViewRoute.tsx +24 -0
  766. package/src/routes/RebaseRoute.tsx +344 -0
  767. package/src/routes/index.ts +2 -0
  768. package/src/types/components/EntityFormActionsProps.tsx +20 -0
  769. package/src/types/components/EntityFormProps.tsx +54 -0
  770. package/src/types/components/PropertyPreviewProps.tsx +59 -0
  771. package/src/types/components/formex.tsx +46 -0
  772. package/src/types/components/index.ts +3 -0
  773. package/src/types/fields.tsx +299 -0
  774. package/src/types/index.ts +4 -0
  775. package/src/util/entity_actions.ts +28 -0
  776. package/src/util/index.ts +5 -0
  777. package/src/util/navigation_utils.ts +69 -0
  778. package/src/util/previews.ts +50 -0
  779. package/src/util/property_utils.tsx +215 -0
  780. package/src/util/resolutions.ts +71 -0
package/dist/editor.js ADDED
@@ -0,0 +1,3834 @@
1
+ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
+ import React__default, { createContext, useContext, forwardRef, useRef, useState, useEffect, useLayoutEffect, useMemo } from "react";
3
+ import { defaultBorderMixin, cls, iconSize, TextField, IconButton, Tooltip, Popover, Button, focusedDisabled, useInjectStyles, Separator, TextareaAutosize } from "@rebasepro/ui";
4
+ import { useTranslation } from "@rebasepro/core";
5
+ import { c } from "react-compiler-runtime";
6
+ import { autoUpdate, computePosition, offset, flip, shift } from "@floating-ui/dom";
7
+ import { NodeSelection, PluginKey, Plugin, TextSelection, EditorState } from "prosemirror-state";
8
+ import { Slot } from "@radix-ui/react-slot";
9
+ import { Fragment, DOMParser, DOMSerializer } from "prosemirror-model";
10
+ import { TypeIcon, CheckSquareIcon, Heading1Icon, Heading2Icon, Heading3Icon, ListIcon, ListOrderedIcon, QuoteIcon, CodeIcon, ImageIcon, TableIcon, Wand2Icon, ChevronDownIcon, CheckIcon, Trash2Icon, BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon } from "lucide-react";
11
+ import { setBlockType, wrapIn, toggleMark, baseKeymap } from "prosemirror-commands";
12
+ import { wrapInList, sinkListItem, liftListItem, splitListItem } from "prosemirror-schema-list";
13
+ import { s as schema, p as parser, a as serializer } from "./markdown-z2Ir7Cgo.js";
14
+ import { DecorationSet, Decoration, EditorView } from "prosemirror-view";
15
+ import { addRowBefore, addRowAfter, deleteRow, addColumnBefore, addColumnAfter, deleteColumn, deleteTable, goToNextCell, columnResizing, tableEditing } from "prosemirror-tables";
16
+ import { keymap } from "prosemirror-keymap";
17
+ import { history, redo, undo } from "prosemirror-history";
18
+ import { dropPoint } from "prosemirror-transform";
19
+ import { gapCursor } from "prosemirror-gapcursor";
20
+ import { inputRules, smartQuotes, ellipsis, emDash, InputRule, wrappingInputRule, textblockTypeInputRule } from "prosemirror-inputrules";
21
+ import { createRoot } from "react-dom/client";
22
+ const ProseMirrorContext = createContext({
23
+ state: null,
24
+ view: null
25
+ });
26
+ const useProseMirrorContext = () => {
27
+ return useContext(ProseMirrorContext);
28
+ };
29
+ const EditorBubble = forwardRef((t0, ref) => {
30
+ const $ = c(19);
31
+ const {
32
+ children,
33
+ options,
34
+ className
35
+ } = t0;
36
+ const {
37
+ view,
38
+ state
39
+ } = useProseMirrorContext();
40
+ const menuRef = useRef(null);
41
+ const [show, setShow] = useState(false);
42
+ let t1;
43
+ let t2;
44
+ if ($[0] !== state || $[1] !== view) {
45
+ t1 = () => {
46
+ if (!view || !state) {
47
+ return;
48
+ }
49
+ const timer = setTimeout(() => {
50
+ const {
51
+ selection
52
+ } = state;
53
+ const {
54
+ empty
55
+ } = selection;
56
+ let isImage;
57
+ isImage = false;
58
+ state.doc.nodesBetween(selection.from, selection.to, (node) => {
59
+ if (node.type.name === "image") {
60
+ isImage = true;
61
+ }
62
+ });
63
+ if (isImage || empty || selection instanceof NodeSelection) {
64
+ setShow(false);
65
+ return;
66
+ }
67
+ setShow(true);
68
+ }, 0);
69
+ return () => clearTimeout(timer);
70
+ };
71
+ t2 = [view, state];
72
+ $[0] = state;
73
+ $[1] = view;
74
+ $[2] = t1;
75
+ $[3] = t2;
76
+ } else {
77
+ t1 = $[2];
78
+ t2 = $[3];
79
+ }
80
+ useEffect(t1, t2);
81
+ let t3;
82
+ if ($[4] !== options?.offset || $[5] !== options?.placement || $[6] !== show || $[7] !== state || $[8] !== view) {
83
+ t3 = () => {
84
+ if (!show || !view || !state || !menuRef.current) {
85
+ return;
86
+ }
87
+ const {
88
+ from,
89
+ to
90
+ } = state.selection;
91
+ let start;
92
+ start = view.coordsAtPos(from);
93
+ let end;
94
+ end = view.coordsAtPos(to);
95
+ const virtualEl = {
96
+ getBoundingClientRect() {
97
+ const top = Math.min(start.top, end.top);
98
+ const bottom = Math.max(start.bottom, end.bottom);
99
+ const left = Math.min(start.left, end.left);
100
+ const right = Math.max(start.right, end.right);
101
+ return {
102
+ width: right - left,
103
+ height: bottom - top,
104
+ x: left,
105
+ y: top,
106
+ top,
107
+ left,
108
+ right,
109
+ bottom
110
+ };
111
+ }
112
+ };
113
+ const cleanup = autoUpdate(virtualEl, menuRef.current, () => {
114
+ if (!menuRef.current) {
115
+ return;
116
+ }
117
+ try {
118
+ start = view.coordsAtPos(state.selection.from);
119
+ end = view.coordsAtPos(state.selection.to);
120
+ } catch (t42) {
121
+ }
122
+ computePosition(virtualEl, menuRef.current, {
123
+ placement: options?.placement || "top",
124
+ middleware: [offset(options?.offset || 8), flip(), shift()],
125
+ strategy: "fixed"
126
+ }).then((t52) => {
127
+ const {
128
+ x,
129
+ y
130
+ } = t52;
131
+ if (menuRef.current) {
132
+ Object.assign(menuRef.current.style, {
133
+ left: `${x}px`,
134
+ top: `${y}px`,
135
+ visibility: "visible"
136
+ });
137
+ }
138
+ });
139
+ });
140
+ return () => cleanup();
141
+ };
142
+ $[4] = options?.offset;
143
+ $[5] = options?.placement;
144
+ $[6] = show;
145
+ $[7] = state;
146
+ $[8] = view;
147
+ $[9] = t3;
148
+ } else {
149
+ t3 = $[9];
150
+ }
151
+ let t4;
152
+ if ($[10] !== options || $[11] !== show || $[12] !== state || $[13] !== view) {
153
+ t4 = [show, view, state, options];
154
+ $[10] = options;
155
+ $[11] = show;
156
+ $[12] = state;
157
+ $[13] = view;
158
+ $[14] = t4;
159
+ } else {
160
+ t4 = $[14];
161
+ }
162
+ useEffect(t3, t4);
163
+ if (!show) {
164
+ return null;
165
+ }
166
+ let t5;
167
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
168
+ t5 = {
169
+ position: "fixed",
170
+ zIndex: 9999,
171
+ visibility: "hidden"
172
+ };
173
+ $[15] = t5;
174
+ } else {
175
+ t5 = $[15];
176
+ }
177
+ let t6;
178
+ if ($[16] !== children || $[17] !== className) {
179
+ t6 = /* @__PURE__ */ jsx("div", { ref: menuRef, className, style: t5, onMouseDown: _temp$5, children });
180
+ $[16] = children;
181
+ $[17] = className;
182
+ $[18] = t6;
183
+ } else {
184
+ t6 = $[18];
185
+ }
186
+ return t6;
187
+ });
188
+ EditorBubble.displayName = "EditorBubble";
189
+ function _temp$5(e_0) {
190
+ e_0.preventDefault();
191
+ }
192
+ const EditorBubbleItem = forwardRef((t0, ref) => {
193
+ const $ = c(13);
194
+ let asChild;
195
+ let children;
196
+ let onSelect;
197
+ let rest;
198
+ if ($[0] !== t0) {
199
+ ({
200
+ children,
201
+ asChild,
202
+ onSelect,
203
+ ...rest
204
+ } = t0);
205
+ $[0] = t0;
206
+ $[1] = asChild;
207
+ $[2] = children;
208
+ $[3] = onSelect;
209
+ $[4] = rest;
210
+ } else {
211
+ asChild = $[1];
212
+ children = $[2];
213
+ onSelect = $[3];
214
+ rest = $[4];
215
+ }
216
+ const {
217
+ view
218
+ } = useProseMirrorContext();
219
+ const Comp = asChild ? Slot : "div";
220
+ if (!view) {
221
+ return null;
222
+ }
223
+ let t1;
224
+ if ($[5] !== onSelect) {
225
+ t1 = () => onSelect?.();
226
+ $[5] = onSelect;
227
+ $[6] = t1;
228
+ } else {
229
+ t1 = $[6];
230
+ }
231
+ let t2;
232
+ if ($[7] !== Comp || $[8] !== children || $[9] !== ref || $[10] !== rest || $[11] !== t1) {
233
+ t2 = /* @__PURE__ */ jsx(Comp, { ref, ...rest, onMouseDown: _temp$4, onClick: t1, children });
234
+ $[7] = Comp;
235
+ $[8] = children;
236
+ $[9] = ref;
237
+ $[10] = rest;
238
+ $[11] = t1;
239
+ $[12] = t2;
240
+ } else {
241
+ t2 = $[12];
242
+ }
243
+ return t2;
244
+ });
245
+ EditorBubbleItem.displayName = "EditorBubbleItem";
246
+ function _temp$4(e) {
247
+ e.preventDefault();
248
+ }
249
+ const SlashCommandPluginKey = new PluginKey("slash-command");
250
+ function slashCommandPlugin() {
251
+ return new Plugin({
252
+ key: SlashCommandPluginKey,
253
+ state: {
254
+ init() {
255
+ return {
256
+ active: false
257
+ };
258
+ },
259
+ apply(tr, value, oldState, newState) {
260
+ const meta = tr.getMeta(SlashCommandPluginKey);
261
+ if (meta !== void 0) {
262
+ return meta;
263
+ }
264
+ const {
265
+ selection
266
+ } = newState;
267
+ if (!(selection instanceof TextSelection) || !selection.empty) {
268
+ return {
269
+ active: false
270
+ };
271
+ }
272
+ const $anchor = selection.$anchor;
273
+ if ($anchor.parent.type.name === "code_block") {
274
+ return {
275
+ active: false
276
+ };
277
+ }
278
+ const textBefore = $anchor.parent.textBetween(Math.max(0, $anchor.parentOffset - 20), $anchor.parentOffset, void 0, "");
279
+ const match = textBefore.match(/(?:\s|^)(\/)([a-zA-Z0-9]*)$/);
280
+ if (!match) {
281
+ return {
282
+ active: false
283
+ };
284
+ }
285
+ if (value.dismissed) {
286
+ return {
287
+ active: false,
288
+ dismissed: true
289
+ };
290
+ }
291
+ const query = match[2];
292
+ const from = $anchor.pos - query.length - 1;
293
+ const to = $anchor.pos;
294
+ return {
295
+ active: true,
296
+ range: {
297
+ from,
298
+ to
299
+ },
300
+ query
301
+ };
302
+ }
303
+ }
304
+ });
305
+ }
306
+ async function onFileRead(view, readerEvent, pos, upload, image) {
307
+ const {
308
+ schema: schema2
309
+ } = view.state;
310
+ const plugin = view.state.plugins.find((p) => p.key === ImagePluginKey.key);
311
+ if (!plugin) {
312
+ console.error("Image plugin not found");
313
+ return;
314
+ }
315
+ const decoId = Math.random().toString(36).substring(7);
316
+ const placeholder = document.createElement("div");
317
+ const imageElement = document.createElement("img");
318
+ imageElement.setAttribute("class", "opacity-40 rounded-lg border " + defaultBorderMixin);
319
+ imageElement.src = readerEvent.target?.result;
320
+ placeholder.appendChild(imageElement);
321
+ const deco = Decoration.widget(pos, placeholder, {
322
+ id: decoId
323
+ });
324
+ let decorationSet = plugin.getState(view.state);
325
+ decorationSet = decorationSet?.add(view.state.doc, [deco]);
326
+ view.dispatch(view.state.tr.setMeta(plugin, {
327
+ decorationSet
328
+ }));
329
+ const src = await upload(image);
330
+ console.debug("Uploaded image", src);
331
+ const replacePlaceholder = () => {
332
+ let currentDecos = plugin.getState(view.state);
333
+ const foundDecos = currentDecos.find(void 0, void 0, (spec) => spec.id === decoId);
334
+ if (foundDecos.length === 0) {
335
+ console.warn("Image placeholder removed before upload completed.");
336
+ return;
337
+ }
338
+ const currentPos = foundDecos[0].from;
339
+ const imageNode = view.state.schema.nodes.image.create({
340
+ src
341
+ });
342
+ const tr = view.state.tr.replaceWith(currentPos, currentPos, imageNode);
343
+ currentDecos = currentDecos.remove(foundDecos);
344
+ tr.setMeta(plugin, {
345
+ decorationSet: currentDecos
346
+ });
347
+ view.dispatch(tr);
348
+ };
349
+ const preloader = new Image();
350
+ preloader.src = src;
351
+ preloader.onload = replacePlaceholder;
352
+ preloader.onerror = replacePlaceholder;
353
+ }
354
+ const ImagePluginKey = new PluginKey("imagePlugin");
355
+ const createDropImagePlugin = (upload) => {
356
+ const plugin = new Plugin({
357
+ key: ImagePluginKey,
358
+ state: {
359
+ // Initialize the plugin state with an empty DecorationSet
360
+ init: () => DecorationSet.empty,
361
+ // Apply transactions to update the state
362
+ apply: (tr, old) => {
363
+ const meta = tr.getMeta(plugin);
364
+ if (meta && meta.decorationSet) {
365
+ return meta.decorationSet;
366
+ }
367
+ return old.map(tr.mapping, tr.doc);
368
+ }
369
+ },
370
+ props: {
371
+ handleDOMEvents: {
372
+ dragover: (view, event) => {
373
+ if (event.dataTransfer?.types?.includes("Files")) {
374
+ event.preventDefault();
375
+ return true;
376
+ }
377
+ return false;
378
+ },
379
+ drop: (view, event) => {
380
+ if (!event.dataTransfer?.files || event.dataTransfer?.files.length === 0) {
381
+ return false;
382
+ }
383
+ event.preventDefault();
384
+ const files = Array.from(event.dataTransfer.files);
385
+ const images = files.filter((file) => /image/i.test(file.type));
386
+ if (images.length === 0) {
387
+ console.log("No images found in dropped files");
388
+ return false;
389
+ }
390
+ images.forEach((image) => {
391
+ const position = view.posAtCoords({
392
+ left: event.clientX,
393
+ top: event.clientY
394
+ });
395
+ if (!position) return;
396
+ const reader = new FileReader();
397
+ reader.onload = async (readerEvent) => {
398
+ await onFileRead(view, readerEvent, position.pos, upload, image);
399
+ };
400
+ reader.readAsDataURL(image);
401
+ });
402
+ return true;
403
+ }
404
+ },
405
+ handlePaste(view, event) {
406
+ const html = event.clipboardData?.getData("text/html");
407
+ if (html && html.includes("<img")) {
408
+ return false;
409
+ }
410
+ const items2 = Array.from(event.clipboardData?.items || []);
411
+ const pos = view.state.selection.from;
412
+ let anyImageFound = false;
413
+ items2.filter((item) => item.type.startsWith("image/")).forEach((item) => {
414
+ const image = item.getAsFile();
415
+ if (image) {
416
+ anyImageFound = true;
417
+ const reader = new FileReader();
418
+ reader.onload = async (readerEvent) => {
419
+ await onFileRead(view, readerEvent, pos, upload, image);
420
+ };
421
+ reader.readAsDataURL(image);
422
+ }
423
+ });
424
+ return anyImageFound;
425
+ },
426
+ decorations(state) {
427
+ return plugin.getState(state);
428
+ }
429
+ }
430
+ });
431
+ return plugin;
432
+ };
433
+ const loadingDecorationKey = new PluginKey("loadingDecoration");
434
+ const textLoadingCommands = {
435
+ toggleLoadingDecoration: (state, dispatch, loadingHtml) => {
436
+ const {
437
+ selection
438
+ } = state;
439
+ const pos = selection.from;
440
+ if (!dispatch) return false;
441
+ const tr = state.tr.setMeta(loadingDecorationKey, {
442
+ pos,
443
+ type: "loadingDecoration",
444
+ remove: false,
445
+ loadingHtml
446
+ });
447
+ dispatch(tr);
448
+ return true;
449
+ },
450
+ removeLoadingDecoration: (state, dispatch) => {
451
+ if (!dispatch) return false;
452
+ const tr = state.tr.setMeta(loadingDecorationKey, {
453
+ pos: 0,
454
+ // We can pass any position as it will remove the entire decoration set
455
+ type: "loadingDecoration",
456
+ remove: true
457
+ });
458
+ dispatch(tr);
459
+ return true;
460
+ }
461
+ };
462
+ const textLoadingDecorationPlugin = () => {
463
+ return new Plugin({
464
+ key: loadingDecorationKey,
465
+ state: {
466
+ init() {
467
+ return {
468
+ decorationSet: DecorationSet.empty,
469
+ hasDecoration: false
470
+ };
471
+ },
472
+ apply(tr, oldState) {
473
+ const action = tr.getMeta(loadingDecorationKey);
474
+ if (action?.type === "loadingDecoration") {
475
+ const {
476
+ pos,
477
+ remove,
478
+ loadingHtml
479
+ } = action;
480
+ if (remove) {
481
+ return {
482
+ decorationSet: DecorationSet.empty,
483
+ hasDecoration: false
484
+ };
485
+ }
486
+ const decoration = Decoration.widget(pos, () => {
487
+ const container = document.createElement("span");
488
+ container.className = "loading-decoration";
489
+ if (loadingHtml) {
490
+ container.innerHTML = loadingHtml;
491
+ } else {
492
+ const span = document.createElement("span");
493
+ span.innerText = "loading...";
494
+ container.appendChild(span);
495
+ }
496
+ return container;
497
+ });
498
+ return {
499
+ decorationSet: DecorationSet.empty.add(tr.doc, [decoration]),
500
+ hasDecoration: true
501
+ };
502
+ }
503
+ return {
504
+ decorationSet: oldState.decorationSet.map(tr.mapping, tr.doc),
505
+ hasDecoration: oldState.hasDecoration
506
+ };
507
+ }
508
+ },
509
+ props: {
510
+ decorations(state) {
511
+ return this.getState(state)?.decorationSet || DecorationSet.empty;
512
+ }
513
+ }
514
+ });
515
+ };
516
+ const suggestionItems = [{
517
+ title: "Text",
518
+ description: "Just start typing with plain text.",
519
+ searchTerms: ["p", "paragraph"],
520
+ icon: /* @__PURE__ */ jsx(TypeIcon, { size: iconSize.small }),
521
+ command: (view, range) => {
522
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
523
+ setBlockType(schema.nodes.paragraph)(view.state, view.dispatch);
524
+ }
525
+ }, {
526
+ title: "To-do List",
527
+ description: "Track tasks with a to-do list.",
528
+ searchTerms: ["todo", "task", "list", "check", "checkbox"],
529
+ icon: /* @__PURE__ */ jsx(CheckSquareIcon, { size: iconSize.small }),
530
+ command: (view, range) => {
531
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
532
+ wrapInList(schema.nodes.task_list)(view.state, view.dispatch);
533
+ }
534
+ }, {
535
+ title: "Heading 1",
536
+ description: "Big section heading.",
537
+ searchTerms: ["title", "big", "large"],
538
+ icon: /* @__PURE__ */ jsx(Heading1Icon, { size: iconSize.small }),
539
+ command: (view, range) => {
540
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
541
+ setBlockType(schema.nodes.heading, {
542
+ level: 1
543
+ })(view.state, view.dispatch);
544
+ }
545
+ }, {
546
+ title: "Heading 2",
547
+ description: "Medium section heading.",
548
+ searchTerms: ["subtitle", "medium"],
549
+ icon: /* @__PURE__ */ jsx(Heading2Icon, { size: iconSize.small }),
550
+ command: (view, range) => {
551
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
552
+ setBlockType(schema.nodes.heading, {
553
+ level: 2
554
+ })(view.state, view.dispatch);
555
+ }
556
+ }, {
557
+ title: "Heading 3",
558
+ description: "Small section heading.",
559
+ searchTerms: ["subtitle", "small"],
560
+ icon: /* @__PURE__ */ jsx(Heading3Icon, { size: iconSize.small }),
561
+ command: (view, range) => {
562
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
563
+ setBlockType(schema.nodes.heading, {
564
+ level: 3
565
+ })(view.state, view.dispatch);
566
+ }
567
+ }, {
568
+ title: "Bullet List",
569
+ description: "Create a simple bullet list.",
570
+ searchTerms: ["unordered", "point"],
571
+ icon: /* @__PURE__ */ jsx(ListIcon, { size: iconSize.small }),
572
+ command: (view, range) => {
573
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
574
+ wrapInList(schema.nodes.bullet_list)(view.state, view.dispatch);
575
+ }
576
+ }, {
577
+ title: "Numbered List",
578
+ description: "Create a list with numbering.",
579
+ searchTerms: ["ordered"],
580
+ icon: /* @__PURE__ */ jsx(ListOrderedIcon, { size: iconSize.small }),
581
+ command: (view, range) => {
582
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
583
+ wrapInList(schema.nodes.ordered_list)(view.state, view.dispatch);
584
+ }
585
+ }, {
586
+ title: "Quote",
587
+ description: "Capture a quote.",
588
+ searchTerms: ["blockquote"],
589
+ icon: /* @__PURE__ */ jsx(QuoteIcon, { size: iconSize.small }),
590
+ command: (view, range) => {
591
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
592
+ wrapIn(schema.nodes.blockquote)(view.state, view.dispatch);
593
+ }
594
+ }, {
595
+ title: "Code",
596
+ description: "Capture a code snippet.",
597
+ searchTerms: ["codeblock"],
598
+ icon: /* @__PURE__ */ jsx(CodeIcon, { size: iconSize.small }),
599
+ command: (view, range) => {
600
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
601
+ setBlockType(schema.nodes.code_block)(view.state, view.dispatch);
602
+ }
603
+ }, {
604
+ title: "Image",
605
+ description: "Upload an image from your computer.",
606
+ searchTerms: ["photo", "picture", "media", "upload", "file"],
607
+ icon: /* @__PURE__ */ jsx(ImageIcon, { size: iconSize.small }),
608
+ command: (view, range, upload) => {
609
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
610
+ const input = document.createElement("input");
611
+ input.type = "file";
612
+ input.accept = "image/*";
613
+ input.onchange = async () => {
614
+ if (input.files?.length) {
615
+ const file = input.files[0];
616
+ if (!file) return;
617
+ const pos = view.state.selection.from;
618
+ const images = Array.from(input.files).filter((f) => /image/i.test(f.type));
619
+ if (images.length === 0) return false;
620
+ images.forEach((image) => {
621
+ const reader = new FileReader();
622
+ reader.onload = async (readerEvent) => {
623
+ await onFileRead(view, readerEvent, pos, upload, image);
624
+ };
625
+ reader.readAsDataURL(image);
626
+ });
627
+ }
628
+ return true;
629
+ };
630
+ input.click();
631
+ }
632
+ }, {
633
+ title: "Table",
634
+ description: "Insert a custom grid table.",
635
+ searchTerms: ["table", "grid", "row", "col"],
636
+ icon: /* @__PURE__ */ jsx(TableIcon, { size: iconSize.small }),
637
+ command: (view, range, upload, aiController, setSubView) => {
638
+ if (setSubView) setSubView("table-grid");
639
+ }
640
+ }];
641
+ const autocompleteSuggestionItem = {
642
+ title: "Autocomplete",
643
+ description: "Add text based on the context.",
644
+ searchTerms: ["ai"],
645
+ icon: /* @__PURE__ */ jsx(Wand2Icon, { size: iconSize.small }),
646
+ command: async (view, range, upload, aiController) => {
647
+ if (!aiController) throw Error("No AiController");
648
+ view.dispatch(view.state.tr.deleteRange(range.from, range.to));
649
+ setBlockType(schema.nodes.paragraph)(view.state, view.dispatch);
650
+ const {
651
+ state
652
+ } = view;
653
+ const {
654
+ from,
655
+ to
656
+ } = state.selection;
657
+ const textBeforeCursor = state.doc.textBetween(0, from, "\n");
658
+ const textAfterCursor = state.doc.textBetween(to, state.doc.content.size, "\n");
659
+ let buffer = "";
660
+ const result = await aiController.autocomplete(textBeforeCursor, textAfterCursor, (delta) => {
661
+ buffer += delta;
662
+ if (delta.length !== 0) {
663
+ textLoadingCommands.toggleLoadingDecoration(view.state, view.dispatch, buffer);
664
+ }
665
+ });
666
+ try {
667
+ const unescapedResult = result.replace(/\\n/g, "\n").replace(/\\t/g, " ");
668
+ const isHTML = /<\/?[a-z][\s\S]*>/i.test(unescapedResult);
669
+ let parsedDoc;
670
+ if (isHTML) {
671
+ const div = document.createElement("div");
672
+ div.innerHTML = unescapedResult;
673
+ parsedDoc = DOMParser.fromSchema(view.state.schema).parse(div);
674
+ } else {
675
+ parsedDoc = parser.parse(unescapedResult);
676
+ }
677
+ if (parsedDoc) {
678
+ const tr = view.state.tr.replaceWith(view.state.selection.from, view.state.selection.from, parsedDoc.content);
679
+ view.dispatch(tr);
680
+ } else {
681
+ view.dispatch(view.state.tr.insertText(unescapedResult));
682
+ }
683
+ } catch (e) {
684
+ console.error(e);
685
+ view.dispatch(view.state.tr.insertText(result));
686
+ }
687
+ }
688
+ };
689
+ const SlashCommandMenu = ({
690
+ upload,
691
+ aiController
692
+ }) => {
693
+ const {
694
+ view,
695
+ state
696
+ } = useProseMirrorContext();
697
+ const menuRef = useRef(null);
698
+ const [selectedIndex, setSelectedIndex] = useState(0);
699
+ const [subView, setSubView] = useState(null);
700
+ const [tableGridCoords, setTableGridCoords] = useState({
701
+ r: 0,
702
+ c: 0
703
+ });
704
+ const pluginState = state ? SlashCommandPluginKey.getState(state) : null;
705
+ const isActive = pluginState?.active;
706
+ const query = pluginState?.query || "";
707
+ const range = pluginState?.range;
708
+ const filteredItems = React__default.useMemo(() => {
709
+ if (!isActive) return [];
710
+ const availableItems = [...suggestionItems];
711
+ if (aiController) availableItems.push(autocompleteSuggestionItem);
712
+ return availableItems.filter((item) => {
713
+ const inTitle = item.title.toLowerCase().includes(query.toLowerCase());
714
+ if (inTitle) return inTitle;
715
+ return item.searchTerms?.some((term) => term.toLowerCase().includes(query.toLowerCase()));
716
+ });
717
+ }, [query, isActive, aiController]);
718
+ useEffect(() => {
719
+ setSelectedIndex(0);
720
+ }, [query]);
721
+ useEffect(() => {
722
+ if (!isActive) setSubView(null);
723
+ }, [isActive]);
724
+ useEffect(() => {
725
+ if (!view || !isActive || !range || !menuRef.current) return;
726
+ const start = view.coordsAtPos(range.from);
727
+ const virtualEl = {
728
+ getBoundingClientRect() {
729
+ return {
730
+ width: 0,
731
+ height: start.bottom - start.top,
732
+ x: start.left,
733
+ y: start.top,
734
+ top: start.top,
735
+ left: start.left,
736
+ right: start.left,
737
+ bottom: start.bottom
738
+ };
739
+ }
740
+ };
741
+ const cleanup = autoUpdate(virtualEl, menuRef.current, () => {
742
+ if (!menuRef.current) return;
743
+ computePosition(virtualEl, menuRef.current, {
744
+ placement: "bottom-start",
745
+ middleware: [offset(4), flip(), shift()],
746
+ strategy: "fixed"
747
+ }).then(({
748
+ x,
749
+ y
750
+ }) => {
751
+ if (menuRef.current) {
752
+ Object.assign(menuRef.current.style, {
753
+ left: `${x}px`,
754
+ top: `${y}px`,
755
+ visibility: "visible"
756
+ });
757
+ }
758
+ });
759
+ });
760
+ return () => cleanup();
761
+ }, [view, isActive, range]);
762
+ useEffect(() => {
763
+ if (!isActive || !view) return;
764
+ const handleKeyDown = (e) => {
765
+ if (subView === "table-grid") {
766
+ if (e.key === "Escape") {
767
+ e.preventDefault();
768
+ e.stopPropagation();
769
+ e.stopImmediatePropagation();
770
+ setSubView(null);
771
+ setTableGridCoords({
772
+ r: 0,
773
+ c: 0
774
+ });
775
+ } else if (e.key === "ArrowUp") {
776
+ e.preventDefault();
777
+ e.stopPropagation();
778
+ setTableGridCoords((prev) => ({
779
+ r: Math.max(0, prev.r - 1),
780
+ c: prev.c
781
+ }));
782
+ } else if (e.key === "ArrowDown") {
783
+ e.preventDefault();
784
+ e.stopPropagation();
785
+ setTableGridCoords((prev_0) => ({
786
+ r: Math.min(4, prev_0.r + 1),
787
+ c: prev_0.c
788
+ }));
789
+ } else if (e.key === "ArrowLeft") {
790
+ e.preventDefault();
791
+ e.stopPropagation();
792
+ setTableGridCoords((prev_1) => ({
793
+ r: prev_1.r,
794
+ c: Math.max(0, prev_1.c - 1)
795
+ }));
796
+ } else if (e.key === "ArrowRight") {
797
+ e.preventDefault();
798
+ e.stopPropagation();
799
+ setTableGridCoords((prev_2) => ({
800
+ r: prev_2.r,
801
+ c: Math.min(4, prev_2.c + 1)
802
+ }));
803
+ } else if (e.key === "Enter") {
804
+ e.preventDefault();
805
+ e.stopPropagation();
806
+ if (range) {
807
+ const tableNode = createTableNode(view.state.schema, tableGridCoords.r + 1, tableGridCoords.c + 1);
808
+ const tr = view.state.tr.replaceWith(range.from, range.to, tableNode);
809
+ try {
810
+ const selection = TextSelection.create(tr.doc, range.from + 4);
811
+ tr.setSelection(selection);
812
+ } catch (e_0) {
813
+ console.warn("Could not select first cell", e_0);
814
+ }
815
+ tr.setMeta(SlashCommandPluginKey, {
816
+ active: false
817
+ });
818
+ view.dispatch(tr);
819
+ view.focus();
820
+ setSubView(null);
821
+ setTableGridCoords({
822
+ r: 0,
823
+ c: 0
824
+ });
825
+ }
826
+ }
827
+ return;
828
+ }
829
+ if (e.key === "ArrowUp") {
830
+ e.preventDefault();
831
+ e.stopPropagation();
832
+ setSelectedIndex((prev_3) => (prev_3 + filteredItems.length - 1) % filteredItems.length);
833
+ } else if (e.key === "ArrowDown") {
834
+ e.preventDefault();
835
+ e.stopPropagation();
836
+ setSelectedIndex((prev_4) => (prev_4 + 1) % filteredItems.length);
837
+ } else if (e.key === "Enter") {
838
+ e.preventDefault();
839
+ e.stopPropagation();
840
+ if (filteredItems[selectedIndex] && range) {
841
+ filteredItems[selectedIndex].command(view, range, upload, aiController, setSubView);
842
+ setTimeout(() => {
843
+ }, 0);
844
+ }
845
+ } else if (e.key === "Escape") {
846
+ e.preventDefault();
847
+ e.stopPropagation();
848
+ e.stopImmediatePropagation();
849
+ view.dispatch(view.state.tr.setMeta(SlashCommandPluginKey, {
850
+ active: false,
851
+ dismissed: true
852
+ }));
853
+ }
854
+ };
855
+ window.addEventListener("keydown", handleKeyDown, {
856
+ capture: true
857
+ });
858
+ return () => window.removeEventListener("keydown", handleKeyDown, {
859
+ capture: true
860
+ });
861
+ }, [isActive, selectedIndex, filteredItems, view, range, upload, aiController, subView, tableGridCoords]);
862
+ const itemRefs = useRef([]);
863
+ useEffect(() => {
864
+ if (itemRefs.current[selectedIndex]) {
865
+ itemRefs.current[selectedIndex]?.scrollIntoView({
866
+ block: "nearest"
867
+ });
868
+ }
869
+ }, [selectedIndex]);
870
+ useEffect(() => {
871
+ if (!subView) {
872
+ setTableGridCoords({
873
+ r: 0,
874
+ c: 0
875
+ });
876
+ }
877
+ }, [subView]);
878
+ if (!isActive || filteredItems.length === 0) return null;
879
+ if (subView === "table-grid" && range && view) {
880
+ return /* @__PURE__ */ jsx("div", { ref: menuRef, onMouseDown: (e_1) => e_1.preventDefault(), style: {
881
+ position: "fixed",
882
+ zIndex: 9999,
883
+ visibility: "hidden"
884
+ }, className: cls("text-surface-900 dark:text-white rounded-md border bg-white dark:bg-surface-800 p-2 shadow transition-none", defaultBorderMixin), children: /* @__PURE__ */ jsx(TableGridPicker, { hoveredRow: tableGridCoords.r, hoveredCol: tableGridCoords.c, onHover: (r, c2) => setTableGridCoords({
885
+ r,
886
+ c: c2
887
+ }), onSelect: (rows, cols) => {
888
+ const tableNode_0 = createTableNode(view.state.schema, rows, cols);
889
+ const tr_0 = view.state.tr.replaceWith(range.from, range.to, tableNode_0);
890
+ try {
891
+ const selection_0 = TextSelection.create(tr_0.doc, range.from + 4);
892
+ tr_0.setSelection(selection_0);
893
+ } catch (e_2) {
894
+ console.warn("Could not select first cell", e_2);
895
+ }
896
+ tr_0.setMeta(SlashCommandPluginKey, {
897
+ active: false
898
+ });
899
+ view.dispatch(tr_0);
900
+ view.focus();
901
+ setSubView(null);
902
+ } }) });
903
+ }
904
+ return /* @__PURE__ */ jsx("div", { ref: menuRef, style: {
905
+ position: "fixed",
906
+ zIndex: 9999,
907
+ visibility: "hidden"
908
+ }, className: cls("text-surface-900 dark:text-white max-h-[280px] w-72 overflow-y-auto rounded-md border bg-white dark:bg-surface-800 px-1 py-2 shadow transition-none", defaultBorderMixin), children: filteredItems.map((item_0, index) => /* @__PURE__ */ jsxs("button", { ref: (el) => {
909
+ itemRefs.current[index] = el;
910
+ }, onClick: (e_3) => {
911
+ e_3.preventDefault();
912
+ if (range && view) {
913
+ item_0.command(view, range, upload, aiController, setSubView);
914
+ if (!subView) view.focus();
915
+ }
916
+ }, onMouseDown: (e_4) => e_4.preventDefault(), className: cls("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-blue-50 hover:dark:bg-surface-700", index === selectedIndex ? "bg-blue-100 dark:bg-surface-accent-950" : ""), children: [
917
+ /* @__PURE__ */ jsx("div", { className: cls("flex h-10 w-10 shrink-0 items-center justify-center rounded-md border bg-white dark:bg-surface-800", defaultBorderMixin), children: item_0.icon }),
918
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col overflow-hidden", children: [
919
+ /* @__PURE__ */ jsx("p", { className: "font-medium truncate", children: item_0.title }),
920
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-surface-700 dark:text-surface-accent-300 truncate", children: item_0.description })
921
+ ] })
922
+ ] }, item_0.title)) });
923
+ };
924
+ const createTableNode = (schema2, rowsCount, colsCount) => {
925
+ const rows = [];
926
+ for (let r = 0; r < rowsCount; r++) {
927
+ const cells = [];
928
+ for (let c2 = 0; c2 < colsCount; c2++) {
929
+ const isHeader = r === 0;
930
+ const cellType = isHeader ? schema2.nodes.table_header : schema2.nodes.table_cell;
931
+ const cell = cellType.createAndFill();
932
+ if (cell) cells.push(cell);
933
+ }
934
+ const row = schema2.nodes.table_row.create(null, Fragment.from(cells));
935
+ rows.push(row);
936
+ }
937
+ return schema2.nodes.table.create(null, Fragment.from(rows));
938
+ };
939
+ const TableGridPicker = (t0) => {
940
+ const $ = c(12);
941
+ const {
942
+ hoveredRow,
943
+ hoveredCol,
944
+ onHover,
945
+ onSelect
946
+ } = t0;
947
+ const t1 = hoveredCol + 1;
948
+ const t2 = hoveredRow + 1;
949
+ let t3;
950
+ if ($[0] !== t1 || $[1] !== t2) {
951
+ t3 = /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500 font-medium mb-1", children: [
952
+ t1,
953
+ " x ",
954
+ t2,
955
+ " Table"
956
+ ] });
957
+ $[0] = t1;
958
+ $[1] = t2;
959
+ $[2] = t3;
960
+ } else {
961
+ t3 = $[2];
962
+ }
963
+ let t4;
964
+ if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
965
+ t4 = Array.from({
966
+ length: 5
967
+ });
968
+ $[3] = t4;
969
+ } else {
970
+ t4 = $[3];
971
+ }
972
+ let t5;
973
+ if ($[4] !== hoveredCol || $[5] !== hoveredRow || $[6] !== onHover || $[7] !== onSelect) {
974
+ t5 = /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: t4.map((_, r) => /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: Array.from({
975
+ length: 5
976
+ }).map((__0, c2) => /* @__PURE__ */ jsx("div", { className: cls("w-5 h-5 border rounded-sm cursor-pointer transition-colors duration-75", r <= hoveredRow && c2 <= hoveredCol ? "bg-blue-100 border-blue-400 dark:bg-blue-900 dark:border-blue-500" : "bg-white dark:bg-surface-800 border-gray-200 dark:border-gray-700 hover:border-blue-300"), onMouseEnter: () => onHover(r, c2), onClick: () => onSelect(hoveredRow + 1, hoveredCol + 1) }, c2)) }, r)) });
977
+ $[4] = hoveredCol;
978
+ $[5] = hoveredRow;
979
+ $[6] = onHover;
980
+ $[7] = onSelect;
981
+ $[8] = t5;
982
+ } else {
983
+ t5 = $[8];
984
+ }
985
+ let t6;
986
+ if ($[9] !== t3 || $[10] !== t5) {
987
+ t6 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 items-center justify-center p-1 w-fit", children: [
988
+ t3,
989
+ t5
990
+ ] });
991
+ $[9] = t3;
992
+ $[10] = t5;
993
+ $[11] = t6;
994
+ } else {
995
+ t6 = $[11];
996
+ }
997
+ return t6;
998
+ };
999
+ const ImageBubble = forwardRef((t0, ref) => {
1000
+ const $ = c(42);
1001
+ const {
1002
+ options,
1003
+ className
1004
+ } = t0;
1005
+ const {
1006
+ view,
1007
+ state
1008
+ } = useProseMirrorContext();
1009
+ const {
1010
+ t
1011
+ } = useTranslation();
1012
+ const menuRef = useRef(null);
1013
+ const [show, setShow] = useState(false);
1014
+ const [alt, setAlt] = useState("");
1015
+ const [title, setTitle] = useState("");
1016
+ const [imagePos, setImagePos] = useState(null);
1017
+ let t1;
1018
+ let t2;
1019
+ if ($[0] !== view) {
1020
+ t1 = () => {
1021
+ if (!view) {
1022
+ return;
1023
+ }
1024
+ const handleContextMenu = (e) => {
1025
+ const posInfo = view.posAtCoords({
1026
+ left: e.clientX,
1027
+ top: e.clientY
1028
+ });
1029
+ if (posInfo && posInfo.inside >= 0) {
1030
+ const node = view.state.doc.nodeAt(posInfo.inside);
1031
+ if (node && node.type.name === "image") {
1032
+ e.preventDefault();
1033
+ const tr = view.state.tr.setSelection(NodeSelection.create(view.state.doc, posInfo.inside));
1034
+ view.dispatch(tr);
1035
+ setShow(true);
1036
+ setAlt(node.attrs.alt || "");
1037
+ setTitle(node.attrs.title || "");
1038
+ setImagePos(posInfo.inside);
1039
+ }
1040
+ }
1041
+ };
1042
+ view.dom.addEventListener("contextmenu", handleContextMenu);
1043
+ const handleMousedown = (e_0) => {
1044
+ if (menuRef.current && !menuRef.current.contains(e_0.target) && e_0.button !== 2) {
1045
+ setShow(false);
1046
+ }
1047
+ };
1048
+ document.addEventListener("mousedown", handleMousedown);
1049
+ return () => {
1050
+ view.dom.removeEventListener("contextmenu", handleContextMenu);
1051
+ document.removeEventListener("mousedown", handleMousedown);
1052
+ };
1053
+ };
1054
+ t2 = [view];
1055
+ $[0] = view;
1056
+ $[1] = t1;
1057
+ $[2] = t2;
1058
+ } else {
1059
+ t1 = $[1];
1060
+ t2 = $[2];
1061
+ }
1062
+ useEffect(t1, t2);
1063
+ let t3;
1064
+ if ($[3] !== options?.offset || $[4] !== options?.placement || $[5] !== show || $[6] !== state || $[7] !== view) {
1065
+ t3 = () => {
1066
+ if (!show || !view || !state || !menuRef.current) {
1067
+ return;
1068
+ }
1069
+ const {
1070
+ from,
1071
+ to
1072
+ } = state.selection;
1073
+ let start;
1074
+ start = view.coordsAtPos(from);
1075
+ let end;
1076
+ end = view.coordsAtPos(to);
1077
+ const virtualEl = {
1078
+ getBoundingClientRect() {
1079
+ const top = Math.min(start.top, end.top);
1080
+ const bottom = Math.max(start.bottom, end.bottom);
1081
+ const left = Math.min(start.left, end.left);
1082
+ const right = Math.max(start.right, end.right);
1083
+ return {
1084
+ width: right - left,
1085
+ height: bottom - top,
1086
+ x: left,
1087
+ y: top,
1088
+ top,
1089
+ left,
1090
+ right,
1091
+ bottom
1092
+ };
1093
+ }
1094
+ };
1095
+ const cleanup = autoUpdate(virtualEl, menuRef.current, () => {
1096
+ if (!menuRef.current) {
1097
+ return;
1098
+ }
1099
+ try {
1100
+ start = view.coordsAtPos(state.selection.from);
1101
+ end = view.coordsAtPos(state.selection.to);
1102
+ } catch (t42) {
1103
+ }
1104
+ computePosition(virtualEl, menuRef.current, {
1105
+ placement: options?.placement || "bottom",
1106
+ middleware: [offset(options?.offset || 8), flip(), shift()],
1107
+ strategy: "fixed"
1108
+ }).then((t52) => {
1109
+ const {
1110
+ x,
1111
+ y
1112
+ } = t52;
1113
+ if (menuRef.current) {
1114
+ Object.assign(menuRef.current.style, {
1115
+ left: `${x}px`,
1116
+ top: `${y}px`,
1117
+ visibility: "visible"
1118
+ });
1119
+ }
1120
+ });
1121
+ });
1122
+ return () => cleanup();
1123
+ };
1124
+ $[3] = options?.offset;
1125
+ $[4] = options?.placement;
1126
+ $[5] = show;
1127
+ $[6] = state;
1128
+ $[7] = view;
1129
+ $[8] = t3;
1130
+ } else {
1131
+ t3 = $[8];
1132
+ }
1133
+ let t4;
1134
+ if ($[9] !== options || $[10] !== show || $[11] !== state || $[12] !== view) {
1135
+ t4 = [show, view, state, options];
1136
+ $[9] = options;
1137
+ $[10] = show;
1138
+ $[11] = state;
1139
+ $[12] = view;
1140
+ $[13] = t4;
1141
+ } else {
1142
+ t4 = $[13];
1143
+ }
1144
+ useEffect(t3, t4);
1145
+ let t5;
1146
+ if ($[14] !== imagePos || $[15] !== view) {
1147
+ t5 = (newAlt, newTitle) => {
1148
+ if (imagePos !== null && view) {
1149
+ const node_0 = view.state.doc.nodeAt(imagePos);
1150
+ if (node_0 && node_0.type.name === "image") {
1151
+ const tr_0 = view.state.tr.setNodeMarkup(imagePos, void 0, {
1152
+ ...node_0.attrs,
1153
+ alt: newAlt,
1154
+ title: newTitle
1155
+ });
1156
+ tr_0.setSelection(NodeSelection.create(tr_0.doc, imagePos));
1157
+ view.dispatch(tr_0);
1158
+ }
1159
+ }
1160
+ };
1161
+ $[14] = imagePos;
1162
+ $[15] = view;
1163
+ $[16] = t5;
1164
+ } else {
1165
+ t5 = $[16];
1166
+ }
1167
+ const handleSave = t5;
1168
+ if (!show) {
1169
+ return null;
1170
+ }
1171
+ let t6;
1172
+ if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1173
+ t6 = {
1174
+ visibility: "hidden",
1175
+ position: "fixed",
1176
+ zIndex: 50
1177
+ };
1178
+ $[17] = t6;
1179
+ } else {
1180
+ t6 = $[17];
1181
+ }
1182
+ let t7;
1183
+ if ($[18] !== className) {
1184
+ t7 = cls("flex flex-col gap-1.5 p-2 w-56 max-w-[90vw] rounded-lg border bg-white dark:bg-surface-800 shadow-lg", defaultBorderMixin, className);
1185
+ $[18] = className;
1186
+ $[19] = t7;
1187
+ } else {
1188
+ t7 = $[19];
1189
+ }
1190
+ let t8;
1191
+ if ($[20] !== t) {
1192
+ t8 = t("alt_text");
1193
+ $[20] = t;
1194
+ $[21] = t8;
1195
+ } else {
1196
+ t8 = $[21];
1197
+ }
1198
+ let t9;
1199
+ if ($[22] !== handleSave || $[23] !== title) {
1200
+ t9 = (e_3) => {
1201
+ setAlt(e_3.target.value);
1202
+ handleSave(e_3.target.value, title);
1203
+ };
1204
+ $[22] = handleSave;
1205
+ $[23] = title;
1206
+ $[24] = t9;
1207
+ } else {
1208
+ t9 = $[24];
1209
+ }
1210
+ let t10;
1211
+ if ($[25] !== alt || $[26] !== t8 || $[27] !== t9) {
1212
+ t10 = /* @__PURE__ */ jsx(TextField, { size: "small", placeholder: t8, value: alt, onChange: t9 });
1213
+ $[25] = alt;
1214
+ $[26] = t8;
1215
+ $[27] = t9;
1216
+ $[28] = t10;
1217
+ } else {
1218
+ t10 = $[28];
1219
+ }
1220
+ let t11;
1221
+ if ($[29] !== t) {
1222
+ t11 = t("title");
1223
+ $[29] = t;
1224
+ $[30] = t11;
1225
+ } else {
1226
+ t11 = $[30];
1227
+ }
1228
+ let t12;
1229
+ if ($[31] !== alt || $[32] !== handleSave) {
1230
+ t12 = (e_4) => {
1231
+ setTitle(e_4.target.value);
1232
+ handleSave(alt, e_4.target.value);
1233
+ };
1234
+ $[31] = alt;
1235
+ $[32] = handleSave;
1236
+ $[33] = t12;
1237
+ } else {
1238
+ t12 = $[33];
1239
+ }
1240
+ let t13;
1241
+ if ($[34] !== t11 || $[35] !== t12 || $[36] !== title) {
1242
+ t13 = /* @__PURE__ */ jsx(TextField, { size: "small", placeholder: t11, value: title, onChange: t12 });
1243
+ $[34] = t11;
1244
+ $[35] = t12;
1245
+ $[36] = title;
1246
+ $[37] = t13;
1247
+ } else {
1248
+ t13 = $[37];
1249
+ }
1250
+ let t14;
1251
+ if ($[38] !== t10 || $[39] !== t13 || $[40] !== t7) {
1252
+ t14 = /* @__PURE__ */ jsxs("div", { ref: menuRef, style: t6, className: t7, onMouseDown: _temp$3, children: [
1253
+ t10,
1254
+ t13
1255
+ ] });
1256
+ $[38] = t10;
1257
+ $[39] = t13;
1258
+ $[40] = t7;
1259
+ $[41] = t14;
1260
+ } else {
1261
+ t14 = $[41];
1262
+ }
1263
+ return t14;
1264
+ });
1265
+ ImageBubble.displayName = "ImageBubble";
1266
+ function _temp$3(e_2) {
1267
+ if (e_2.target === e_2.currentTarget) {
1268
+ e_2.preventDefault();
1269
+ }
1270
+ }
1271
+ const isSelectionInTable = (state) => {
1272
+ const {
1273
+ $from
1274
+ } = state.selection;
1275
+ for (let d = $from.depth; d > 0; d--) {
1276
+ if ($from.node(d).type.name === "table") {
1277
+ return true;
1278
+ }
1279
+ }
1280
+ return false;
1281
+ };
1282
+ const TableBubble = forwardRef((t0, ref) => {
1283
+ const $ = c(104);
1284
+ const {
1285
+ options,
1286
+ className
1287
+ } = t0;
1288
+ const {
1289
+ view,
1290
+ state
1291
+ } = useProseMirrorContext();
1292
+ const {
1293
+ t
1294
+ } = useTranslation();
1295
+ const menuRef = useRef(null);
1296
+ const [show, setShow] = useState(false);
1297
+ let t1;
1298
+ if ($[0] !== state) {
1299
+ t1 = () => {
1300
+ if (!state) {
1301
+ return;
1302
+ }
1303
+ setShow(isSelectionInTable(state));
1304
+ };
1305
+ $[0] = state;
1306
+ $[1] = t1;
1307
+ } else {
1308
+ t1 = $[1];
1309
+ }
1310
+ const t2 = state?.selection;
1311
+ let t3;
1312
+ if ($[2] !== t2) {
1313
+ t3 = [t2];
1314
+ $[2] = t2;
1315
+ $[3] = t3;
1316
+ } else {
1317
+ t3 = $[3];
1318
+ }
1319
+ useEffect(t1, t3);
1320
+ let t4;
1321
+ if ($[4] !== options?.offset || $[5] !== options?.placement || $[6] !== show || $[7] !== state || $[8] !== view) {
1322
+ t4 = () => {
1323
+ if (!show || !view || !state || !menuRef.current) {
1324
+ return;
1325
+ }
1326
+ const {
1327
+ from,
1328
+ to
1329
+ } = state.selection;
1330
+ if (view.isDestroyed) {
1331
+ return;
1332
+ }
1333
+ let start;
1334
+ start = view.coordsAtPos(from);
1335
+ let end;
1336
+ end = view.coordsAtPos(to);
1337
+ const virtualEl = {
1338
+ getBoundingClientRect() {
1339
+ const top = Math.min(start.top, end.top);
1340
+ const bottom = Math.max(start.bottom, end.bottom);
1341
+ const left = Math.min(start.left, end.left);
1342
+ const right = Math.max(start.right, end.right);
1343
+ return {
1344
+ width: right - left,
1345
+ height: bottom - top,
1346
+ x: left,
1347
+ y: top,
1348
+ top,
1349
+ bottom,
1350
+ left,
1351
+ right
1352
+ };
1353
+ }
1354
+ };
1355
+ const cleanup = autoUpdate(virtualEl, menuRef.current, () => {
1356
+ if (!menuRef.current || view.isDestroyed) {
1357
+ return;
1358
+ }
1359
+ try {
1360
+ start = view.coordsAtPos(state.selection.from);
1361
+ end = view.coordsAtPos(state.selection.to);
1362
+ } catch (t52) {
1363
+ }
1364
+ computePosition(virtualEl, menuRef.current, {
1365
+ placement: options?.placement || "top",
1366
+ middleware: [offset(options?.offset || 8), flip(), shift()],
1367
+ strategy: "fixed"
1368
+ }).then((t62) => {
1369
+ const {
1370
+ x,
1371
+ y
1372
+ } = t62;
1373
+ if (menuRef.current) {
1374
+ Object.assign(menuRef.current.style, {
1375
+ left: `${x}px`,
1376
+ top: `${y}px`,
1377
+ visibility: "visible"
1378
+ });
1379
+ }
1380
+ });
1381
+ });
1382
+ return () => cleanup();
1383
+ };
1384
+ $[4] = options?.offset;
1385
+ $[5] = options?.placement;
1386
+ $[6] = show;
1387
+ $[7] = state;
1388
+ $[8] = view;
1389
+ $[9] = t4;
1390
+ } else {
1391
+ t4 = $[9];
1392
+ }
1393
+ let t5;
1394
+ if ($[10] !== options || $[11] !== show || $[12] !== state || $[13] !== view) {
1395
+ t5 = [show, view, state, options];
1396
+ $[10] = options;
1397
+ $[11] = show;
1398
+ $[12] = state;
1399
+ $[13] = view;
1400
+ $[14] = t5;
1401
+ } else {
1402
+ t5 = $[14];
1403
+ }
1404
+ useEffect(t4, t5);
1405
+ if (!show || !view || !state) {
1406
+ return null;
1407
+ }
1408
+ let t6;
1409
+ if ($[15] !== state || $[16] !== view) {
1410
+ t6 = (cmd) => {
1411
+ cmd(state, view.dispatch);
1412
+ view.focus();
1413
+ };
1414
+ $[15] = state;
1415
+ $[16] = view;
1416
+ $[17] = t6;
1417
+ } else {
1418
+ t6 = $[17];
1419
+ }
1420
+ const executeCommand = t6;
1421
+ let t7;
1422
+ if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1423
+ t7 = {
1424
+ visibility: "hidden",
1425
+ position: "fixed",
1426
+ zIndex: 50
1427
+ };
1428
+ $[18] = t7;
1429
+ } else {
1430
+ t7 = $[18];
1431
+ }
1432
+ let t8;
1433
+ if ($[19] !== className) {
1434
+ t8 = cls("flex flex-row gap-1 p-1 rounded-lg border bg-white dark:bg-surface-800 shadow-lg", defaultBorderMixin, className);
1435
+ $[19] = className;
1436
+ $[20] = t8;
1437
+ } else {
1438
+ t8 = $[20];
1439
+ }
1440
+ let t9;
1441
+ if ($[21] !== t) {
1442
+ t9 = t("add_row_before");
1443
+ $[21] = t;
1444
+ $[22] = t9;
1445
+ } else {
1446
+ t9 = $[22];
1447
+ }
1448
+ let t10;
1449
+ if ($[23] !== executeCommand) {
1450
+ t10 = () => executeCommand(addRowBefore);
1451
+ $[23] = executeCommand;
1452
+ $[24] = t10;
1453
+ } else {
1454
+ t10 = $[24];
1455
+ }
1456
+ let t11;
1457
+ if ($[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1458
+ t11 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1459
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1460
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "16" }),
1461
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "12", x2: "16", y2: "12" }),
1462
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "9", x2: "21", y2: "9" })
1463
+ ] });
1464
+ $[25] = t11;
1465
+ } else {
1466
+ t11 = $[25];
1467
+ }
1468
+ let t12;
1469
+ if ($[26] !== t10) {
1470
+ t12 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t10, children: t11 });
1471
+ $[26] = t10;
1472
+ $[27] = t12;
1473
+ } else {
1474
+ t12 = $[27];
1475
+ }
1476
+ let t13;
1477
+ if ($[28] !== t12 || $[29] !== t9) {
1478
+ t13 = /* @__PURE__ */ jsx(Tooltip, { title: t9, children: t12 });
1479
+ $[28] = t12;
1480
+ $[29] = t9;
1481
+ $[30] = t13;
1482
+ } else {
1483
+ t13 = $[30];
1484
+ }
1485
+ let t14;
1486
+ if ($[31] !== t) {
1487
+ t14 = t("add_row_after");
1488
+ $[31] = t;
1489
+ $[32] = t14;
1490
+ } else {
1491
+ t14 = $[32];
1492
+ }
1493
+ let t15;
1494
+ if ($[33] !== executeCommand) {
1495
+ t15 = () => executeCommand(addRowAfter);
1496
+ $[33] = executeCommand;
1497
+ $[34] = t15;
1498
+ } else {
1499
+ t15 = $[34];
1500
+ }
1501
+ let t16;
1502
+ if ($[35] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1503
+ t16 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1504
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1505
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "12", x2: "12", y2: "20" }),
1506
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "16", x2: "16", y2: "16" }),
1507
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "15", x2: "21", y2: "15" })
1508
+ ] });
1509
+ $[35] = t16;
1510
+ } else {
1511
+ t16 = $[35];
1512
+ }
1513
+ let t17;
1514
+ if ($[36] !== t15) {
1515
+ t17 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t15, children: t16 });
1516
+ $[36] = t15;
1517
+ $[37] = t17;
1518
+ } else {
1519
+ t17 = $[37];
1520
+ }
1521
+ let t18;
1522
+ if ($[38] !== t14 || $[39] !== t17) {
1523
+ t18 = /* @__PURE__ */ jsx(Tooltip, { title: t14, children: t17 });
1524
+ $[38] = t14;
1525
+ $[39] = t17;
1526
+ $[40] = t18;
1527
+ } else {
1528
+ t18 = $[40];
1529
+ }
1530
+ let t19;
1531
+ if ($[41] !== t) {
1532
+ t19 = t("delete_row");
1533
+ $[41] = t;
1534
+ $[42] = t19;
1535
+ } else {
1536
+ t19 = $[42];
1537
+ }
1538
+ let t20;
1539
+ if ($[43] !== executeCommand) {
1540
+ t20 = () => executeCommand(deleteRow);
1541
+ $[43] = executeCommand;
1542
+ $[44] = t20;
1543
+ } else {
1544
+ t20 = $[44];
1545
+ }
1546
+ let t21;
1547
+ if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1548
+ t21 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1549
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1550
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
1551
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "12", x2: "16", y2: "12" })
1552
+ ] });
1553
+ $[45] = t21;
1554
+ } else {
1555
+ t21 = $[45];
1556
+ }
1557
+ let t22;
1558
+ if ($[46] !== t20) {
1559
+ t22 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t20, children: t21 });
1560
+ $[46] = t20;
1561
+ $[47] = t22;
1562
+ } else {
1563
+ t22 = $[47];
1564
+ }
1565
+ let t23;
1566
+ if ($[48] !== t19 || $[49] !== t22) {
1567
+ t23 = /* @__PURE__ */ jsx(Tooltip, { title: t19, children: t22 });
1568
+ $[48] = t19;
1569
+ $[49] = t22;
1570
+ $[50] = t23;
1571
+ } else {
1572
+ t23 = $[50];
1573
+ }
1574
+ let t24;
1575
+ if ($[51] !== t13 || $[52] !== t18 || $[53] !== t23) {
1576
+ t24 = /* @__PURE__ */ jsxs("div", { className: "flex gap-1 border-r pr-1 mr-1 dark:border-gray-700", children: [
1577
+ t13,
1578
+ t18,
1579
+ t23
1580
+ ] });
1581
+ $[51] = t13;
1582
+ $[52] = t18;
1583
+ $[53] = t23;
1584
+ $[54] = t24;
1585
+ } else {
1586
+ t24 = $[54];
1587
+ }
1588
+ let t25;
1589
+ if ($[55] !== t) {
1590
+ t25 = t("add_column_before");
1591
+ $[55] = t;
1592
+ $[56] = t25;
1593
+ } else {
1594
+ t25 = $[56];
1595
+ }
1596
+ let t26;
1597
+ if ($[57] !== executeCommand) {
1598
+ t26 = () => executeCommand(addColumnBefore);
1599
+ $[57] = executeCommand;
1600
+ $[58] = t26;
1601
+ } else {
1602
+ t26 = $[58];
1603
+ }
1604
+ let t27;
1605
+ if ($[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1606
+ t27 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1607
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1608
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "12", x2: "16", y2: "12" }),
1609
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "16" }),
1610
+ /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
1611
+ ] });
1612
+ $[59] = t27;
1613
+ } else {
1614
+ t27 = $[59];
1615
+ }
1616
+ let t28;
1617
+ if ($[60] !== t26) {
1618
+ t28 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t26, children: t27 });
1619
+ $[60] = t26;
1620
+ $[61] = t28;
1621
+ } else {
1622
+ t28 = $[61];
1623
+ }
1624
+ let t29;
1625
+ if ($[62] !== t25 || $[63] !== t28) {
1626
+ t29 = /* @__PURE__ */ jsx(Tooltip, { title: t25, children: t28 });
1627
+ $[62] = t25;
1628
+ $[63] = t28;
1629
+ $[64] = t29;
1630
+ } else {
1631
+ t29 = $[64];
1632
+ }
1633
+ let t30;
1634
+ if ($[65] !== t) {
1635
+ t30 = t("add_column_after");
1636
+ $[65] = t;
1637
+ $[66] = t30;
1638
+ } else {
1639
+ t30 = $[66];
1640
+ }
1641
+ let t31;
1642
+ if ($[67] !== executeCommand) {
1643
+ t31 = () => executeCommand(addColumnAfter);
1644
+ $[67] = executeCommand;
1645
+ $[68] = t31;
1646
+ } else {
1647
+ t31 = $[68];
1648
+ }
1649
+ let t32;
1650
+ if ($[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1651
+ t32 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1652
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1653
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "12", x2: "20", y2: "12" }),
1654
+ /* @__PURE__ */ jsx("line", { x1: "16", y1: "8", x2: "16", y2: "16" }),
1655
+ /* @__PURE__ */ jsx("line", { x1: "15", y1: "3", x2: "15", y2: "21" })
1656
+ ] });
1657
+ $[69] = t32;
1658
+ } else {
1659
+ t32 = $[69];
1660
+ }
1661
+ let t33;
1662
+ if ($[70] !== t31) {
1663
+ t33 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t31, children: t32 });
1664
+ $[70] = t31;
1665
+ $[71] = t33;
1666
+ } else {
1667
+ t33 = $[71];
1668
+ }
1669
+ let t34;
1670
+ if ($[72] !== t30 || $[73] !== t33) {
1671
+ t34 = /* @__PURE__ */ jsx(Tooltip, { title: t30, children: t33 });
1672
+ $[72] = t30;
1673
+ $[73] = t33;
1674
+ $[74] = t34;
1675
+ } else {
1676
+ t34 = $[74];
1677
+ }
1678
+ let t35;
1679
+ if ($[75] !== t) {
1680
+ t35 = t("delete_column");
1681
+ $[75] = t;
1682
+ $[76] = t35;
1683
+ } else {
1684
+ t35 = $[76];
1685
+ }
1686
+ let t36;
1687
+ if ($[77] !== executeCommand) {
1688
+ t36 = () => executeCommand(deleteColumn);
1689
+ $[77] = executeCommand;
1690
+ $[78] = t36;
1691
+ } else {
1692
+ t36 = $[78];
1693
+ }
1694
+ let t37;
1695
+ if ($[79] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1696
+ t37 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1697
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
1698
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "3", x2: "12", y2: "21" }),
1699
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "16" })
1700
+ ] });
1701
+ $[79] = t37;
1702
+ } else {
1703
+ t37 = $[79];
1704
+ }
1705
+ let t38;
1706
+ if ($[80] !== t36) {
1707
+ t38 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t36, children: t37 });
1708
+ $[80] = t36;
1709
+ $[81] = t38;
1710
+ } else {
1711
+ t38 = $[81];
1712
+ }
1713
+ let t39;
1714
+ if ($[82] !== t35 || $[83] !== t38) {
1715
+ t39 = /* @__PURE__ */ jsx(Tooltip, { title: t35, children: t38 });
1716
+ $[82] = t35;
1717
+ $[83] = t38;
1718
+ $[84] = t39;
1719
+ } else {
1720
+ t39 = $[84];
1721
+ }
1722
+ let t40;
1723
+ if ($[85] !== t29 || $[86] !== t34 || $[87] !== t39) {
1724
+ t40 = /* @__PURE__ */ jsxs("div", { className: "flex gap-1 border-r pr-1 mr-1 dark:border-gray-700", children: [
1725
+ t29,
1726
+ t34,
1727
+ t39
1728
+ ] });
1729
+ $[85] = t29;
1730
+ $[86] = t34;
1731
+ $[87] = t39;
1732
+ $[88] = t40;
1733
+ } else {
1734
+ t40 = $[88];
1735
+ }
1736
+ let t41;
1737
+ if ($[89] !== t) {
1738
+ t41 = t("delete_table");
1739
+ $[89] = t;
1740
+ $[90] = t41;
1741
+ } else {
1742
+ t41 = $[90];
1743
+ }
1744
+ let t42;
1745
+ if ($[91] !== executeCommand) {
1746
+ t42 = () => executeCommand(deleteTable);
1747
+ $[91] = executeCommand;
1748
+ $[92] = t42;
1749
+ } else {
1750
+ t42 = $[92];
1751
+ }
1752
+ let t43;
1753
+ if ($[93] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1754
+ t43 = /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1755
+ /* @__PURE__ */ jsx("polyline", { points: "3 6 5 6 21 6" }),
1756
+ /* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
1757
+ /* @__PURE__ */ jsx("line", { x1: "10", y1: "11", x2: "10", y2: "17" }),
1758
+ /* @__PURE__ */ jsx("line", { x1: "14", y1: "11", x2: "14", y2: "17" })
1759
+ ] });
1760
+ $[93] = t43;
1761
+ } else {
1762
+ t43 = $[93];
1763
+ }
1764
+ let t44;
1765
+ if ($[94] !== t42) {
1766
+ t44 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t42, children: t43 });
1767
+ $[94] = t42;
1768
+ $[95] = t44;
1769
+ } else {
1770
+ t44 = $[95];
1771
+ }
1772
+ let t45;
1773
+ if ($[96] !== t41 || $[97] !== t44) {
1774
+ t45 = /* @__PURE__ */ jsx(Tooltip, { title: t41, children: t44 });
1775
+ $[96] = t41;
1776
+ $[97] = t44;
1777
+ $[98] = t45;
1778
+ } else {
1779
+ t45 = $[98];
1780
+ }
1781
+ let t46;
1782
+ if ($[99] !== t24 || $[100] !== t40 || $[101] !== t45 || $[102] !== t8) {
1783
+ t46 = /* @__PURE__ */ jsxs("div", { ref: menuRef, style: t7, className: t8, onMouseDown: _temp$2, children: [
1784
+ t24,
1785
+ t40,
1786
+ t45
1787
+ ] });
1788
+ $[99] = t24;
1789
+ $[100] = t40;
1790
+ $[101] = t45;
1791
+ $[102] = t8;
1792
+ $[103] = t46;
1793
+ } else {
1794
+ t46 = $[103];
1795
+ }
1796
+ return t46;
1797
+ });
1798
+ TableBubble.displayName = "TableBubble";
1799
+ function _temp$2(e_0) {
1800
+ e_0.preventDefault();
1801
+ }
1802
+ function isMarkActive(state, type) {
1803
+ if (!state || !type) return false;
1804
+ const {
1805
+ from,
1806
+ $from,
1807
+ to,
1808
+ empty
1809
+ } = state.selection;
1810
+ if (empty) return !!type.isInSet(state.storedMarks || $from.marks());
1811
+ return state.doc.rangeHasMark(from, to, type);
1812
+ }
1813
+ function isNodeActive(state, type, attrs = {}) {
1814
+ if (!state || !type) return false;
1815
+ const selection = state.selection;
1816
+ const {
1817
+ $from,
1818
+ to
1819
+ } = selection;
1820
+ const node = selection instanceof TextSelection ? void 0 : selection.node;
1821
+ if (node) {
1822
+ return node.type === type && (!attrs || Object.keys(attrs).every((key) => node.attrs[key] === attrs[key]));
1823
+ }
1824
+ return to <= $from.end() && $from.parent.type === type && (!attrs || Object.keys(attrs).every((key) => $from.parent.attrs[key] === attrs[key]));
1825
+ }
1826
+ function getMarkAttributes(state, type) {
1827
+ if (!state || !type) return {};
1828
+ const {
1829
+ from,
1830
+ $from,
1831
+ to,
1832
+ empty
1833
+ } = state.selection;
1834
+ let mark;
1835
+ if (empty) {
1836
+ mark = type.isInSet(state.storedMarks || $from.marks());
1837
+ } else {
1838
+ let found = false;
1839
+ state.doc.nodesBetween(from, to, (node) => {
1840
+ if (found) return false;
1841
+ const m = type.isInSet(node.marks);
1842
+ if (m) {
1843
+ mark = m;
1844
+ found = true;
1845
+ }
1846
+ return true;
1847
+ });
1848
+ }
1849
+ return mark ? mark.attrs : {};
1850
+ }
1851
+ function setMark(type, attrs) {
1852
+ return (state, dispatch) => {
1853
+ const selection = state.selection;
1854
+ const {
1855
+ empty,
1856
+ $cursor,
1857
+ ranges
1858
+ } = selection;
1859
+ if (empty && !$cursor || !type) return false;
1860
+ if (dispatch) {
1861
+ if ($cursor) {
1862
+ dispatch(state.tr.addStoredMark(type.create(attrs)));
1863
+ } else {
1864
+ const tr = state.tr;
1865
+ for (let i = 0; i < ranges.length; i++) {
1866
+ const {
1867
+ $from,
1868
+ $to
1869
+ } = ranges[i];
1870
+ tr.addMark($from.pos, $to.pos, type.create(attrs));
1871
+ }
1872
+ dispatch(tr.scrollIntoView());
1873
+ }
1874
+ }
1875
+ return true;
1876
+ };
1877
+ }
1878
+ function unsetMark(type) {
1879
+ return (state, dispatch) => {
1880
+ const selection = state.selection;
1881
+ const {
1882
+ empty,
1883
+ $cursor,
1884
+ ranges
1885
+ } = selection;
1886
+ if (empty && !$cursor || !type) return false;
1887
+ if (dispatch) {
1888
+ const tr = state.tr;
1889
+ if ($cursor) {
1890
+ const parent = $cursor.parent;
1891
+ let markStart = -1;
1892
+ let markEnd = -1;
1893
+ let currentMarkStart = -1;
1894
+ parent.forEach((child, offset2) => {
1895
+ const childStart = $cursor.start() + offset2;
1896
+ const childEnd = childStart + child.nodeSize;
1897
+ if (type.isInSet(child.marks)) {
1898
+ if (currentMarkStart === -1) currentMarkStart = childStart;
1899
+ if ($cursor.pos >= childStart && $cursor.pos <= childEnd) {
1900
+ markStart = currentMarkStart;
1901
+ }
1902
+ } else {
1903
+ if (currentMarkStart !== -1) {
1904
+ if (markStart !== -1 && markEnd === -1) markEnd = childStart;
1905
+ currentMarkStart = -1;
1906
+ }
1907
+ }
1908
+ });
1909
+ if (markStart !== -1 && markEnd === -1) {
1910
+ markEnd = $cursor.end();
1911
+ }
1912
+ if (markStart !== -1 && markEnd !== -1) {
1913
+ tr.removeMark(markStart, markEnd, type);
1914
+ }
1915
+ tr.removeStoredMark(type);
1916
+ dispatch(tr.scrollIntoView());
1917
+ } else {
1918
+ for (let i = 0; i < ranges.length; i++) {
1919
+ const {
1920
+ $from,
1921
+ $to
1922
+ } = ranges[i];
1923
+ tr.removeMark($from.pos, $to.pos, type);
1924
+ }
1925
+ dispatch(tr.scrollIntoView());
1926
+ }
1927
+ }
1928
+ return true;
1929
+ };
1930
+ }
1931
+ const items = [{
1932
+ name: "Text",
1933
+ labelKey: "editor_text",
1934
+ icon: TypeIcon,
1935
+ command: (state, dispatch) => setBlockType(schema.nodes.paragraph)(state, dispatch),
1936
+ isActive: (state) => isNodeActive(state, schema.nodes.paragraph) && !isNodeActive(state, schema.nodes.bullet_list) && !isNodeActive(state, schema.nodes.ordered_list)
1937
+ }, {
1938
+ name: "Heading 1",
1939
+ labelKey: "editor_heading_1",
1940
+ icon: Heading1Icon,
1941
+ command: (state, dispatch) => setBlockType(schema.nodes.heading, {
1942
+ level: 1
1943
+ })(state, dispatch),
1944
+ isActive: (state) => isNodeActive(state, schema.nodes.heading, {
1945
+ level: 1
1946
+ })
1947
+ }, {
1948
+ name: "Heading 2",
1949
+ labelKey: "editor_heading_2",
1950
+ icon: Heading2Icon,
1951
+ command: (state, dispatch) => setBlockType(schema.nodes.heading, {
1952
+ level: 2
1953
+ })(state, dispatch),
1954
+ isActive: (state) => isNodeActive(state, schema.nodes.heading, {
1955
+ level: 2
1956
+ })
1957
+ }, {
1958
+ name: "Heading 3",
1959
+ labelKey: "editor_heading_3",
1960
+ icon: Heading3Icon,
1961
+ command: (state, dispatch) => setBlockType(schema.nodes.heading, {
1962
+ level: 3
1963
+ })(state, dispatch),
1964
+ isActive: (state) => isNodeActive(state, schema.nodes.heading, {
1965
+ level: 3
1966
+ })
1967
+ }, {
1968
+ name: "To-do List",
1969
+ labelKey: "editor_todo_list",
1970
+ icon: CheckSquareIcon,
1971
+ command: (state, dispatch) => wrapInList(schema.nodes.task_list)(state, dispatch),
1972
+ isActive: (state) => isNodeActive(state, schema.nodes.task_item)
1973
+ }, {
1974
+ name: "Bullet List",
1975
+ labelKey: "editor_bullet_list",
1976
+ icon: ListIcon,
1977
+ command: (state, dispatch) => wrapInList(schema.nodes.bullet_list)(state, dispatch),
1978
+ isActive: (state) => isNodeActive(state, schema.nodes.bullet_list)
1979
+ }, {
1980
+ name: "Numbered List",
1981
+ labelKey: "editor_numbered_list",
1982
+ icon: ListOrderedIcon,
1983
+ command: (state, dispatch) => wrapInList(schema.nodes.ordered_list)(state, dispatch),
1984
+ isActive: (state) => isNodeActive(state, schema.nodes.ordered_list)
1985
+ }, {
1986
+ name: "Quote",
1987
+ labelKey: "editor_quote",
1988
+ icon: QuoteIcon,
1989
+ command: (state, dispatch) => wrapIn(schema.nodes.blockquote)(state, dispatch),
1990
+ isActive: (state) => isNodeActive(state, schema.nodes.blockquote)
1991
+ }, {
1992
+ name: "Code",
1993
+ labelKey: "editor_code",
1994
+ icon: CodeIcon,
1995
+ command: (state, dispatch) => setBlockType(schema.nodes.code_block)(state, dispatch),
1996
+ isActive: (state) => isNodeActive(state, schema.nodes.code_block)
1997
+ }];
1998
+ const NodeSelector = (t0) => {
1999
+ const $ = c(40);
2000
+ const {
2001
+ open,
2002
+ onOpenChange,
2003
+ portalContainer
2004
+ } = t0;
2005
+ const {
2006
+ state,
2007
+ view
2008
+ } = useProseMirrorContext();
2009
+ const {
2010
+ t
2011
+ } = useTranslation();
2012
+ if (!state || !view) {
2013
+ return null;
2014
+ }
2015
+ let T0;
2016
+ let T1;
2017
+ let activeItem;
2018
+ let t1;
2019
+ let t2;
2020
+ let t3;
2021
+ let t4;
2022
+ let t5;
2023
+ let t6;
2024
+ let t7;
2025
+ let t8;
2026
+ let t9;
2027
+ if ($[0] !== portalContainer || $[1] !== state || $[2] !== t) {
2028
+ activeItem = items.filter((item) => item.isActive(state)).pop() ?? {
2029
+ name: "Multiple",
2030
+ labelKey: "editor_multiple"
2031
+ };
2032
+ T1 = Popover;
2033
+ t6 = 5;
2034
+ t7 = "start";
2035
+ t8 = portalContainer;
2036
+ t9 = "w-48 p-1";
2037
+ T0 = Button;
2038
+ t3 = "text";
2039
+ t4 = "gap-2 rounded-none";
2040
+ t5 = "text";
2041
+ t1 = "whitespace-nowrap text-sm";
2042
+ t2 = t(activeItem.labelKey);
2043
+ $[0] = portalContainer;
2044
+ $[1] = state;
2045
+ $[2] = t;
2046
+ $[3] = T0;
2047
+ $[4] = T1;
2048
+ $[5] = activeItem;
2049
+ $[6] = t1;
2050
+ $[7] = t2;
2051
+ $[8] = t3;
2052
+ $[9] = t4;
2053
+ $[10] = t5;
2054
+ $[11] = t6;
2055
+ $[12] = t7;
2056
+ $[13] = t8;
2057
+ $[14] = t9;
2058
+ } else {
2059
+ T0 = $[3];
2060
+ T1 = $[4];
2061
+ activeItem = $[5];
2062
+ t1 = $[6];
2063
+ t2 = $[7];
2064
+ t3 = $[8];
2065
+ t4 = $[9];
2066
+ t5 = $[10];
2067
+ t6 = $[11];
2068
+ t7 = $[12];
2069
+ t8 = $[13];
2070
+ t9 = $[14];
2071
+ }
2072
+ let t10;
2073
+ if ($[15] !== t1 || $[16] !== t2) {
2074
+ t10 = /* @__PURE__ */ jsx("span", { className: t1, children: t2 });
2075
+ $[15] = t1;
2076
+ $[16] = t2;
2077
+ $[17] = t10;
2078
+ } else {
2079
+ t10 = $[17];
2080
+ }
2081
+ let t11;
2082
+ if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2083
+ t11 = /* @__PURE__ */ jsx(ChevronDownIcon, { size: iconSize.small });
2084
+ $[18] = t11;
2085
+ } else {
2086
+ t11 = $[18];
2087
+ }
2088
+ let t12;
2089
+ if ($[19] !== T0 || $[20] !== t10 || $[21] !== t3 || $[22] !== t4 || $[23] !== t5) {
2090
+ t12 = /* @__PURE__ */ jsxs(T0, { variant: t3, className: t4, color: t5, children: [
2091
+ t10,
2092
+ t11
2093
+ ] });
2094
+ $[19] = T0;
2095
+ $[20] = t10;
2096
+ $[21] = t3;
2097
+ $[22] = t4;
2098
+ $[23] = t5;
2099
+ $[24] = t12;
2100
+ } else {
2101
+ t12 = $[24];
2102
+ }
2103
+ let t13;
2104
+ if ($[25] !== activeItem || $[26] !== onOpenChange || $[27] !== t || $[28] !== view) {
2105
+ t13 = items.map((item_0, index) => /* @__PURE__ */ jsxs(EditorBubbleItem, { onSelect: () => {
2106
+ item_0.command(view.state, view.dispatch);
2107
+ view.focus();
2108
+ onOpenChange(false);
2109
+ }, className: "flex cursor-pointer items-center justify-between rounded px-2 py-1 text-sm hover:bg-blue-50 hover:dark:bg-surface-700 text-surface-900 dark:text-white", children: [
2110
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
2111
+ /* @__PURE__ */ jsx(item_0.icon, { size: iconSize.smallest }),
2112
+ /* @__PURE__ */ jsx("span", { children: t(item_0.labelKey) })
2113
+ ] }),
2114
+ activeItem.name === item_0.name && /* @__PURE__ */ jsx(CheckIcon, { size: iconSize.smallest })
2115
+ ] }, index));
2116
+ $[25] = activeItem;
2117
+ $[26] = onOpenChange;
2118
+ $[27] = t;
2119
+ $[28] = view;
2120
+ $[29] = t13;
2121
+ } else {
2122
+ t13 = $[29];
2123
+ }
2124
+ let t14;
2125
+ if ($[30] !== T1 || $[31] !== onOpenChange || $[32] !== open || $[33] !== t12 || $[34] !== t13 || $[35] !== t6 || $[36] !== t7 || $[37] !== t8 || $[38] !== t9) {
2126
+ t14 = /* @__PURE__ */ jsx(T1, { sideOffset: t6, align: t7, portalContainer: t8, className: t9, trigger: t12, modal: true, open, onOpenChange, children: t13 });
2127
+ $[30] = T1;
2128
+ $[31] = onOpenChange;
2129
+ $[32] = open;
2130
+ $[33] = t12;
2131
+ $[34] = t13;
2132
+ $[35] = t6;
2133
+ $[36] = t7;
2134
+ $[37] = t8;
2135
+ $[38] = t9;
2136
+ $[39] = t14;
2137
+ } else {
2138
+ t14 = $[39];
2139
+ }
2140
+ return t14;
2141
+ };
2142
+ function isValidUrl(url) {
2143
+ try {
2144
+ new URL(url);
2145
+ return true;
2146
+ } catch (e) {
2147
+ return false;
2148
+ }
2149
+ }
2150
+ function getUrlFromString(str) {
2151
+ if (isValidUrl(str)) return str;
2152
+ try {
2153
+ if (str.includes(".") && !str.includes(" ")) {
2154
+ return new URL(`https://${str}`).toString();
2155
+ }
2156
+ return null;
2157
+ } catch (e) {
2158
+ return null;
2159
+ }
2160
+ }
2161
+ const LinkSelector = (t0) => {
2162
+ const $ = c(58);
2163
+ const {
2164
+ open,
2165
+ onOpenChange
2166
+ } = t0;
2167
+ const inputRef = useRef(null);
2168
+ const {
2169
+ state,
2170
+ view
2171
+ } = useProseMirrorContext();
2172
+ const {
2173
+ t
2174
+ } = useTranslation();
2175
+ let t1;
2176
+ let t2;
2177
+ if ($[0] !== open) {
2178
+ t1 = () => {
2179
+ if (open && inputRef.current) {
2180
+ inputRef.current.focus();
2181
+ }
2182
+ };
2183
+ t2 = [open];
2184
+ $[0] = open;
2185
+ $[1] = t1;
2186
+ $[2] = t2;
2187
+ } else {
2188
+ t1 = $[1];
2189
+ t2 = $[2];
2190
+ }
2191
+ useEffect(t1, t2);
2192
+ if (!state || !view) {
2193
+ return null;
2194
+ }
2195
+ let t3;
2196
+ if ($[3] !== onOpenChange || $[4] !== view) {
2197
+ t3 = (e) => {
2198
+ e.preventDefault();
2199
+ const value = inputRef.current?.value;
2200
+ if (!value) {
2201
+ return;
2202
+ }
2203
+ const url = getUrlFromString(value);
2204
+ if (url) {
2205
+ setMark(schema.marks.link, {
2206
+ href: url
2207
+ })(view.state, view.dispatch);
2208
+ view.focus();
2209
+ onOpenChange(false);
2210
+ }
2211
+ };
2212
+ $[3] = onOpenChange;
2213
+ $[4] = view;
2214
+ $[5] = t3;
2215
+ } else {
2216
+ t3 = $[5];
2217
+ }
2218
+ const handleSubmit = t3;
2219
+ let t4;
2220
+ if ($[6] !== onOpenChange || $[7] !== view) {
2221
+ t4 = () => {
2222
+ unsetMark(schema.marks.link)(view.state, view.dispatch);
2223
+ view.focus();
2224
+ onOpenChange(false);
2225
+ };
2226
+ $[6] = onOpenChange;
2227
+ $[7] = view;
2228
+ $[8] = t4;
2229
+ } else {
2230
+ t4 = $[8];
2231
+ }
2232
+ const handleRemoveLink = t4;
2233
+ let T0;
2234
+ let T1;
2235
+ let href;
2236
+ let t10;
2237
+ let t11;
2238
+ let t12;
2239
+ let t5;
2240
+ let t6;
2241
+ let t7;
2242
+ let t8;
2243
+ let t9;
2244
+ if ($[9] !== onOpenChange || $[10] !== open || $[11] !== state) {
2245
+ const isActive = isMarkActive(state, schema.marks.link);
2246
+ let t132;
2247
+ if ($[23] !== state) {
2248
+ t132 = getMarkAttributes(state, schema.marks.link).href || "";
2249
+ $[23] = state;
2250
+ $[24] = t132;
2251
+ } else {
2252
+ t132 = $[24];
2253
+ }
2254
+ href = t132;
2255
+ T1 = Popover;
2256
+ t10 = true;
2257
+ t11 = open;
2258
+ t12 = onOpenChange;
2259
+ T0 = Button;
2260
+ t6 = "text";
2261
+ t7 = "button";
2262
+ t8 = "gap-2 rounded-none";
2263
+ t9 = "text";
2264
+ t5 = cls("underline decoration-stone-400 underline-offset-4", {
2265
+ "text-blue-500": isActive
2266
+ });
2267
+ $[9] = onOpenChange;
2268
+ $[10] = open;
2269
+ $[11] = state;
2270
+ $[12] = T0;
2271
+ $[13] = T1;
2272
+ $[14] = href;
2273
+ $[15] = t10;
2274
+ $[16] = t11;
2275
+ $[17] = t12;
2276
+ $[18] = t5;
2277
+ $[19] = t6;
2278
+ $[20] = t7;
2279
+ $[21] = t8;
2280
+ $[22] = t9;
2281
+ } else {
2282
+ T0 = $[12];
2283
+ T1 = $[13];
2284
+ href = $[14];
2285
+ t10 = $[15];
2286
+ t11 = $[16];
2287
+ t12 = $[17];
2288
+ t5 = $[18];
2289
+ t6 = $[19];
2290
+ t7 = $[20];
2291
+ t8 = $[21];
2292
+ t9 = $[22];
2293
+ }
2294
+ let t13;
2295
+ if ($[25] !== t) {
2296
+ t13 = t("editor_link");
2297
+ $[25] = t;
2298
+ $[26] = t13;
2299
+ } else {
2300
+ t13 = $[26];
2301
+ }
2302
+ let t14;
2303
+ if ($[27] !== t13 || $[28] !== t5) {
2304
+ t14 = /* @__PURE__ */ jsx("p", { className: t5, children: t13 });
2305
+ $[27] = t13;
2306
+ $[28] = t5;
2307
+ $[29] = t14;
2308
+ } else {
2309
+ t14 = $[29];
2310
+ }
2311
+ let t15;
2312
+ if ($[30] !== T0 || $[31] !== t14 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) {
2313
+ t15 = /* @__PURE__ */ jsx(T0, { variant: t6, type: t7, className: t8, color: t9, children: t14 });
2314
+ $[30] = T0;
2315
+ $[31] = t14;
2316
+ $[32] = t6;
2317
+ $[33] = t7;
2318
+ $[34] = t8;
2319
+ $[35] = t9;
2320
+ $[36] = t15;
2321
+ } else {
2322
+ t15 = $[36];
2323
+ }
2324
+ let t16;
2325
+ if ($[37] !== t) {
2326
+ t16 = t("editor_paste_or_type_link");
2327
+ $[37] = t;
2328
+ $[38] = t16;
2329
+ } else {
2330
+ t16 = $[38];
2331
+ }
2332
+ let t17;
2333
+ if ($[39] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2334
+ t17 = cls("text-surface-900 dark:text-white flex-grow bg-transparent p-1 text-sm outline-none", focusedDisabled);
2335
+ $[39] = t17;
2336
+ } else {
2337
+ t17 = $[39];
2338
+ }
2339
+ let t18;
2340
+ if ($[40] !== href || $[41] !== open || $[42] !== t16) {
2341
+ t18 = /* @__PURE__ */ jsx("input", { ref: inputRef, autoFocus: open, placeholder: t16, defaultValue: href, className: t17 });
2342
+ $[40] = href;
2343
+ $[41] = open;
2344
+ $[42] = t16;
2345
+ $[43] = t18;
2346
+ } else {
2347
+ t18 = $[43];
2348
+ }
2349
+ let t19;
2350
+ if ($[44] !== handleRemoveLink || $[45] !== href) {
2351
+ t19 = href ? /* @__PURE__ */ jsx(Button, { size: "small", variant: "text", type: "button", color: "text", className: "flex items-center", onClick: handleRemoveLink, children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.small }) }) : /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", variant: "text", children: /* @__PURE__ */ jsx(CheckIcon, { size: iconSize.small }) });
2352
+ $[44] = handleRemoveLink;
2353
+ $[45] = href;
2354
+ $[46] = t19;
2355
+ } else {
2356
+ t19 = $[46];
2357
+ }
2358
+ let t20;
2359
+ if ($[47] !== handleSubmit || $[48] !== t18 || $[49] !== t19) {
2360
+ t20 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex p-1 gap-1", children: [
2361
+ t18,
2362
+ t19
2363
+ ] });
2364
+ $[47] = handleSubmit;
2365
+ $[48] = t18;
2366
+ $[49] = t19;
2367
+ $[50] = t20;
2368
+ } else {
2369
+ t20 = $[50];
2370
+ }
2371
+ let t21;
2372
+ if ($[51] !== T1 || $[52] !== t10 || $[53] !== t11 || $[54] !== t12 || $[55] !== t15 || $[56] !== t20) {
2373
+ t21 = /* @__PURE__ */ jsx(T1, { modal: t10, open: t11, onOpenChange: t12, trigger: t15, children: t20 });
2374
+ $[51] = T1;
2375
+ $[52] = t10;
2376
+ $[53] = t11;
2377
+ $[54] = t12;
2378
+ $[55] = t15;
2379
+ $[56] = t20;
2380
+ $[57] = t21;
2381
+ } else {
2382
+ t21 = $[57];
2383
+ }
2384
+ return t21;
2385
+ };
2386
+ const TextButtons = () => {
2387
+ const $ = c(3);
2388
+ const {
2389
+ state,
2390
+ view
2391
+ } = useProseMirrorContext();
2392
+ if (!state || !view) {
2393
+ return null;
2394
+ }
2395
+ let t0;
2396
+ if ($[0] !== state || $[1] !== view) {
2397
+ const items2 = [{
2398
+ name: "bold",
2399
+ labelKey: "editor_bold",
2400
+ isActive: _temp$1,
2401
+ command: _temp2,
2402
+ icon: BoldIcon
2403
+ }, {
2404
+ name: "italic",
2405
+ labelKey: "editor_italic",
2406
+ isActive: _temp3,
2407
+ command: _temp4,
2408
+ icon: ItalicIcon
2409
+ }, {
2410
+ name: "underline",
2411
+ labelKey: "editor_underline",
2412
+ isActive: _temp5,
2413
+ command: _temp6,
2414
+ icon: UnderlineIcon
2415
+ }, {
2416
+ name: "strike",
2417
+ labelKey: "editor_strikethrough",
2418
+ isActive: _temp7,
2419
+ command: _temp8,
2420
+ icon: StrikethroughIcon
2421
+ }, {
2422
+ name: "code",
2423
+ labelKey: "editor_code",
2424
+ isActive: _temp9,
2425
+ command: _temp0,
2426
+ icon: CodeIcon
2427
+ }];
2428
+ t0 = /* @__PURE__ */ jsx("div", { className: "flex", children: items2.map((item, index) => /* @__PURE__ */ jsx(EditorBubbleItem, { onSelect: () => {
2429
+ item.command(view.state, view.dispatch);
2430
+ view.focus();
2431
+ }, children: /* @__PURE__ */ jsx(Button, { size: "small", color: "text", className: "gap-2 rounded-none h-full", variant: "text", children: /* @__PURE__ */ jsx(item.icon, { className: cls({
2432
+ "text-inherit": !item.isActive(state),
2433
+ "text-blue-500": item.isActive(state)
2434
+ }) }) }) }, index)) });
2435
+ $[0] = state;
2436
+ $[1] = view;
2437
+ $[2] = t0;
2438
+ } else {
2439
+ t0 = $[2];
2440
+ }
2441
+ return t0;
2442
+ };
2443
+ function _temp$1(s) {
2444
+ return isMarkActive(s, schema.marks.bold);
2445
+ }
2446
+ function _temp2(s_0, dispatch) {
2447
+ return toggleMark(schema.marks.bold)(s_0, dispatch);
2448
+ }
2449
+ function _temp3(s_1) {
2450
+ return isMarkActive(s_1, schema.marks.italic);
2451
+ }
2452
+ function _temp4(s_2, dispatch_0) {
2453
+ return toggleMark(schema.marks.italic)(s_2, dispatch_0);
2454
+ }
2455
+ function _temp5(s_3) {
2456
+ return isMarkActive(s_3, schema.marks.underline);
2457
+ }
2458
+ function _temp6(s_4, dispatch_1) {
2459
+ return toggleMark(schema.marks.underline)(s_4, dispatch_1);
2460
+ }
2461
+ function _temp7(s_5) {
2462
+ return isMarkActive(s_5, schema.marks.strike);
2463
+ }
2464
+ function _temp8(s_6, dispatch_2) {
2465
+ return toggleMark(schema.marks.strike)(s_6, dispatch_2);
2466
+ }
2467
+ function _temp9(s_7) {
2468
+ return isMarkActive(s_7, schema.marks.code);
2469
+ }
2470
+ function _temp0(s_8, dispatch_3) {
2471
+ return toggleMark(schema.marks.code)(s_8, dispatch_3);
2472
+ }
2473
+ function removeClassesFromJson(jsonObj) {
2474
+ if (Array.isArray(jsonObj)) {
2475
+ return jsonObj.map((item) => removeClassesFromJson(item));
2476
+ } else if (typeof jsonObj === "object" && jsonObj !== null) {
2477
+ if (jsonObj.attrs && typeof jsonObj.attrs === "object" && "class" in jsonObj.attrs) {
2478
+ delete jsonObj.attrs.class;
2479
+ }
2480
+ Object.keys(jsonObj).forEach((key) => {
2481
+ jsonObj[key] = removeClassesFromJson(jsonObj[key]);
2482
+ });
2483
+ }
2484
+ return jsonObj;
2485
+ }
2486
+ function serializeForClipboard(view, slice) {
2487
+ view.someProp("transformCopied", (f) => {
2488
+ slice = f(slice, view);
2489
+ });
2490
+ const context = [];
2491
+ let {
2492
+ content,
2493
+ openStart,
2494
+ openEnd
2495
+ } = slice;
2496
+ while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
2497
+ openStart--;
2498
+ openEnd--;
2499
+ const node = content.firstChild;
2500
+ context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);
2501
+ content = node.content;
2502
+ }
2503
+ const serializer2 = view.someProp("clipboardSerializer") || DOMSerializer.fromSchema(view.state.schema);
2504
+ const doc = detachedDoc(), wrap = doc.createElement("div");
2505
+ wrap.appendChild(serializer2.serializeFragment(content, {
2506
+ document: doc
2507
+ }));
2508
+ let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
2509
+ while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
2510
+ for (let i = needsWrap.length - 1; i >= 0; i--) {
2511
+ const wrapper = doc.createElement(needsWrap[i]);
2512
+ while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
2513
+ wrap.appendChild(wrapper);
2514
+ wrappers++;
2515
+ }
2516
+ firstChild = wrap.firstChild;
2517
+ }
2518
+ if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
2519
+ const text = view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n");
2520
+ return {
2521
+ dom: wrap,
2522
+ text,
2523
+ slice
2524
+ };
2525
+ }
2526
+ const wrapMap = {
2527
+ thead: ["table"],
2528
+ tbody: ["table"],
2529
+ tfoot: ["table"],
2530
+ caption: ["table"],
2531
+ colgroup: ["table"],
2532
+ col: ["table", "colgroup"],
2533
+ tr: ["table", "tbody"],
2534
+ td: ["table", "tbody", "tr"],
2535
+ th: ["table", "tbody", "tr"]
2536
+ };
2537
+ let _detachedDoc = null;
2538
+ function detachedDoc() {
2539
+ return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
2540
+ }
2541
+ function absoluteRect(element) {
2542
+ const data = element.getBoundingClientRect();
2543
+ let ancestor = element.parentElement;
2544
+ while (ancestor && window.getComputedStyle(ancestor).position === "static") {
2545
+ ancestor = ancestor.parentElement;
2546
+ }
2547
+ const ancestorRect = ancestor?.getBoundingClientRect();
2548
+ return {
2549
+ top: data.top - (ancestorRect?.top ?? 0),
2550
+ left: data.left - (ancestorRect?.left ?? 0),
2551
+ width: data.width
2552
+ };
2553
+ }
2554
+ function nodeDOMAtCoords(coords, view) {
2555
+ const editorRect = view.dom.getBoundingClientRect();
2556
+ if (coords.y < editorRect.top || coords.y > editorRect.bottom) return void 0;
2557
+ if (coords.x < editorRect.left - 100 || coords.x > editorRect.right + 50) return void 0;
2558
+ const blockSelector = 'li, p, pre, blockquote, h1, h2, h3, h4, h5, h6, img, [data-type="taskList"]';
2559
+ const elem = document.elementFromPoint(coords.x, coords.y);
2560
+ const block = elem?.closest(blockSelector);
2561
+ if (block && view.dom.contains(block) && block.textContent?.trim()) {
2562
+ const li = block.closest("li");
2563
+ return li && view.dom.contains(li) ? li : block;
2564
+ }
2565
+ const probeX = editorRect.left + Math.min(60, editorRect.width / 4);
2566
+ if (coords.x > probeX) return void 0;
2567
+ const probeElem = document.elementFromPoint(probeX, coords.y);
2568
+ const probeBlock = probeElem?.closest(blockSelector);
2569
+ if (probeBlock && probeBlock.textContent?.trim()) {
2570
+ if (view.dom.contains(probeBlock)) {
2571
+ const li = probeBlock.closest("li");
2572
+ return li && view.dom.contains(li) ? li : probeBlock;
2573
+ }
2574
+ }
2575
+ return void 0;
2576
+ }
2577
+ function nodePosAtDOM(node, view, options) {
2578
+ try {
2579
+ if (!view.dom.contains(node)) return null;
2580
+ const pos = view.posAtDOM(node, 0);
2581
+ const $pos = view.state.doc.resolve(pos);
2582
+ if ($pos.depth > 0) {
2583
+ return $pos.before();
2584
+ }
2585
+ return pos;
2586
+ } catch (e) {
2587
+ return null;
2588
+ }
2589
+ }
2590
+ function dragHandlePlugin(options = {
2591
+ dragHandleWidth: 24
2592
+ }) {
2593
+ function handleDragStart(event, view) {
2594
+ view.focus();
2595
+ if (!event.dataTransfer) return;
2596
+ const node = nodeDOMAtCoords({
2597
+ x: event.clientX,
2598
+ y: event.clientY
2599
+ }, view);
2600
+ if (!(node instanceof Element)) return;
2601
+ const nodePos = nodePosAtDOM(node, view);
2602
+ if (nodePos == null || nodePos < 0) return;
2603
+ const draggedNodeSelection = NodeSelection.create(view.state.doc, nodePos);
2604
+ view.dispatch(view.state.tr.setSelection(draggedNodeSelection));
2605
+ const slice = view.state.selection.content();
2606
+ const {
2607
+ dom,
2608
+ text
2609
+ } = serializeForClipboard(view, slice);
2610
+ event.dataTransfer.clearData();
2611
+ event.dataTransfer.setData("text/html", dom.innerHTML);
2612
+ event.dataTransfer.setData("text/plain", text);
2613
+ event.dataTransfer.effectAllowed = "copyMove";
2614
+ event.dataTransfer.setDragImage(node, 0, 0);
2615
+ view.dragging = {
2616
+ slice,
2617
+ move: true,
2618
+ node: draggedNodeSelection
2619
+ };
2620
+ }
2621
+ function handleClick(event, view) {
2622
+ view.focus();
2623
+ view.dom.classList.remove("dragging");
2624
+ const node = nodeDOMAtCoords({
2625
+ x: event.clientX,
2626
+ y: event.clientY
2627
+ }, view);
2628
+ if (!(node instanceof Element)) return;
2629
+ const nodePos = nodePosAtDOM(node, view);
2630
+ if (!nodePos) return;
2631
+ view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos)));
2632
+ }
2633
+ let dragHandleElement = null;
2634
+ function hideDragHandle() {
2635
+ if (dragHandleElement) {
2636
+ dragHandleElement.classList.add("hide");
2637
+ dragHandleElement.style.opacity = "0";
2638
+ dragHandleElement.style.pointerEvents = "none";
2639
+ }
2640
+ }
2641
+ function showDragHandle() {
2642
+ if (dragHandleElement) {
2643
+ dragHandleElement.classList.remove("hide");
2644
+ dragHandleElement.style.opacity = "1";
2645
+ dragHandleElement.style.pointerEvents = "auto";
2646
+ }
2647
+ }
2648
+ return new Plugin({
2649
+ view: (view) => {
2650
+ dragHandleElement = document.createElement("div");
2651
+ dragHandleElement.draggable = true;
2652
+ dragHandleElement.dataset.dragHandle = "";
2653
+ dragHandleElement.classList.add("drag-handle");
2654
+ dragHandleElement.addEventListener("dragstart", (e) => {
2655
+ handleDragStart(e, view);
2656
+ });
2657
+ dragHandleElement.addEventListener("click", (e) => {
2658
+ handleClick(e, view);
2659
+ });
2660
+ const onMouseMove = (event) => {
2661
+ if (!view.editable) {
2662
+ return;
2663
+ }
2664
+ const node = nodeDOMAtCoords({
2665
+ x: event.clientX,
2666
+ y: event.clientY
2667
+ }, view);
2668
+ if (!(node instanceof Element)) {
2669
+ hideDragHandle();
2670
+ return;
2671
+ }
2672
+ const compStyle = window.getComputedStyle(node);
2673
+ const lineHeight = parseInt(compStyle.lineHeight, 10);
2674
+ const paddingTop = parseInt(compStyle.paddingTop, 10);
2675
+ const rect = absoluteRect(node);
2676
+ if (!rect) {
2677
+ hideDragHandle();
2678
+ return;
2679
+ }
2680
+ rect.top += (lineHeight - 24) / 2;
2681
+ rect.top += paddingTop;
2682
+ if (node.matches("ul:not([data-type=taskList]) li, ol li")) {
2683
+ rect.left -= options.dragHandleWidth;
2684
+ }
2685
+ rect.width = options.dragHandleWidth;
2686
+ if (!dragHandleElement) return;
2687
+ dragHandleElement.style.left = `${rect.left - rect.width}px`;
2688
+ dragHandleElement.style.top = `${rect.top}px`;
2689
+ showDragHandle();
2690
+ };
2691
+ window.addEventListener("mousemove", onMouseMove);
2692
+ hideDragHandle();
2693
+ view?.dom?.parentElement?.appendChild(dragHandleElement);
2694
+ return {
2695
+ destroy: () => {
2696
+ window.removeEventListener("mousemove", onMouseMove);
2697
+ dragHandleElement?.remove?.();
2698
+ dragHandleElement = null;
2699
+ }
2700
+ };
2701
+ },
2702
+ props: {
2703
+ handleDOMEvents: {
2704
+ keydown: () => {
2705
+ hideDragHandle();
2706
+ },
2707
+ mousewheel: () => {
2708
+ hideDragHandle();
2709
+ },
2710
+ // dragging class is used for CSS
2711
+ dragstart: (view) => {
2712
+ view.dom.classList.add("dragging");
2713
+ },
2714
+ drop: (view) => {
2715
+ view.dom.classList.remove("dragging");
2716
+ },
2717
+ dragend: (view) => {
2718
+ view.dom.classList.remove("dragging");
2719
+ }
2720
+ }
2721
+ }
2722
+ });
2723
+ }
2724
+ function globalDragDropPlugin() {
2725
+ let dropCursorElement = null;
2726
+ let cleanup = null;
2727
+ function updateDropCursorColor(el) {
2728
+ const isDark = document.documentElement.getAttribute("data-theme") === "dark";
2729
+ const varName = isDark ? "--color-surface-accent-300" : "--color-surface-accent-600";
2730
+ const color = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
2731
+ el.style.backgroundColor = color || (isDark ? "#cbd5e1" : "#475569");
2732
+ }
2733
+ return new Plugin({
2734
+ view(editorView) {
2735
+ dropCursorElement = document.createElement("div");
2736
+ dropCursorElement.className = "prosemirror-dropcursor-block";
2737
+ dropCursorElement.style.cssText = "position: absolute; z-index: 50; pointer-events: none; height: 2px;";
2738
+ updateDropCursorColor(dropCursorElement);
2739
+ const observer = new MutationObserver(() => {
2740
+ if (dropCursorElement) updateDropCursorColor(dropCursorElement);
2741
+ });
2742
+ observer.observe(document.documentElement, {
2743
+ attributes: true,
2744
+ attributeFilter: ["data-theme"]
2745
+ });
2746
+ const removeCursor = () => {
2747
+ if (dropCursorElement && dropCursorElement.parentNode) {
2748
+ dropCursorElement.parentNode.removeChild(dropCursorElement);
2749
+ }
2750
+ };
2751
+ const getBlockInsertionPoint = (event, clampedX) => {
2752
+ const pos = editorView.posAtCoords({
2753
+ left: clampedX,
2754
+ top: event.clientY
2755
+ });
2756
+ if (!pos) return null;
2757
+ const $pos = editorView.state.doc.resolve(pos.pos);
2758
+ let blockDepth = 0;
2759
+ for (let i = $pos.depth; i > 0; i--) {
2760
+ const name = $pos.node(i).type.name;
2761
+ if (name === "list_item" || name === "taskItem") {
2762
+ blockDepth = i;
2763
+ break;
2764
+ }
2765
+ if ($pos.node(i).isBlock && name !== "bullet_list" && name !== "ordered_list" && name !== "taskList") {
2766
+ blockDepth = i;
2767
+ }
2768
+ }
2769
+ if (blockDepth === 0) return pos.pos;
2770
+ const nodeBeforePos = $pos.before(blockDepth);
2771
+ const nodeAfterPos = $pos.after(blockDepth);
2772
+ const domNode = editorView.nodeDOM(nodeBeforePos);
2773
+ if (domNode instanceof HTMLElement) {
2774
+ const rect = domNode.getBoundingClientRect();
2775
+ const isTopHalf = event.clientY < rect.top + rect.height / 2;
2776
+ return isTopHalf ? nodeBeforePos : nodeAfterPos;
2777
+ }
2778
+ return pos.pos;
2779
+ };
2780
+ const handleDragOver = (event) => {
2781
+ if (!editorView.editable || !editorView.dragging) return;
2782
+ if (!editorView.dragging?.node) {
2783
+ removeCursor();
2784
+ return;
2785
+ }
2786
+ event.preventDefault();
2787
+ const editorRect = editorView.dom.getBoundingClientRect();
2788
+ const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));
2789
+ const target = getBlockInsertionPoint(event, clampedX);
2790
+ if (target === null) {
2791
+ removeCursor();
2792
+ return;
2793
+ }
2794
+ const $pos = editorView.state.doc.resolve(target);
2795
+ let rect;
2796
+ const before = $pos.nodeBefore;
2797
+ const after = $pos.nodeAfter;
2798
+ if (before || after) {
2799
+ const nodeDOM = editorView.nodeDOM(target - (before ? before.nodeSize : 0));
2800
+ if (nodeDOM && nodeDOM instanceof HTMLElement) {
2801
+ const nodeRect = nodeDOM.getBoundingClientRect();
2802
+ let top = before ? nodeRect.bottom : nodeRect.top;
2803
+ if (before && after) {
2804
+ const afterDOM = editorView.nodeDOM(target);
2805
+ if (afterDOM && afterDOM instanceof HTMLElement) {
2806
+ top = (top + afterDOM.getBoundingClientRect().top) / 2;
2807
+ }
2808
+ }
2809
+ rect = {
2810
+ left: nodeRect.left,
2811
+ right: nodeRect.right,
2812
+ top: top - 1,
2813
+ bottom: top + 1
2814
+ };
2815
+ }
2816
+ }
2817
+ if (!rect) {
2818
+ const coords = editorView.coordsAtPos(target);
2819
+ rect = {
2820
+ left: editorRect.left + 50,
2821
+ right: editorRect.right - 50,
2822
+ top: coords.top - 1,
2823
+ bottom: coords.top + 1
2824
+ };
2825
+ }
2826
+ const parent = editorView.dom.offsetParent;
2827
+ let parentLeft = 0;
2828
+ let parentTop = 0;
2829
+ if (parent && parent !== document.body && getComputedStyle(parent).position !== "static") {
2830
+ const parentRect = parent.getBoundingClientRect();
2831
+ parentLeft = parentRect.left - parent.scrollLeft;
2832
+ parentTop = parentRect.top - parent.scrollTop;
2833
+ }
2834
+ if (!dropCursorElement.parentNode) {
2835
+ parent.appendChild(dropCursorElement);
2836
+ }
2837
+ dropCursorElement.style.left = `${rect.left - parentLeft}px`;
2838
+ dropCursorElement.style.top = `${rect.top - parentTop}px`;
2839
+ dropCursorElement.style.width = `${rect.right - rect.left}px`;
2840
+ };
2841
+ const handleDrop = (event) => {
2842
+ if (!editorView.editable || !editorView.dragging) return;
2843
+ if (!editorView.dragging?.node) {
2844
+ removeCursor();
2845
+ return;
2846
+ }
2847
+ event.preventDefault();
2848
+ removeCursor();
2849
+ editorView.dom.classList.remove("dragging");
2850
+ const editorRect = editorView.dom.getBoundingClientRect();
2851
+ const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));
2852
+ const targetPos = getBlockInsertionPoint(event, clampedX);
2853
+ if (targetPos === null) return;
2854
+ const dragging = editorView.dragging;
2855
+ if (dragging && dragging.slice) {
2856
+ let tr = editorView.state.tr;
2857
+ if (dragging.move) {
2858
+ const {
2859
+ node: node2
2860
+ } = dragging;
2861
+ if (node2) {
2862
+ node2.replace(tr);
2863
+ } else {
2864
+ tr = tr.deleteSelection();
2865
+ }
2866
+ }
2867
+ const mappedTarget = tr.mapping.map(targetPos);
2868
+ const beforeInsert = tr.doc;
2869
+ const {
2870
+ node,
2871
+ slice
2872
+ } = dragging;
2873
+ if (node && node.node) {
2874
+ let nodeToInsert = node.node;
2875
+ const $mapped = tr.doc.resolve(mappedTarget);
2876
+ const parentName = $mapped.parent.type.name;
2877
+ const isTargetList = parentName === "bullet_list" || parentName === "ordered_list";
2878
+ const isTargetTaskList = parentName === "taskList";
2879
+ if ("type" in nodeToInsert && nodeToInsert.type.name === "list_item" && !isTargetList) {
2880
+ nodeToInsert = nodeToInsert.content;
2881
+ } else if ("type" in nodeToInsert && nodeToInsert.type.name === "taskItem" && !isTargetTaskList) {
2882
+ nodeToInsert = nodeToInsert.content;
2883
+ }
2884
+ const isFragment = !("type" in nodeToInsert);
2885
+ const needsWrap = isFragment || "type" in nodeToInsert && nodeToInsert.type.name !== "list_item" && nodeToInsert.type.name !== "taskItem";
2886
+ if (needsWrap) {
2887
+ if (isTargetList) {
2888
+ const listItemType = editorView.state.schema.nodes.list_item;
2889
+ if (listItemType) nodeToInsert = listItemType.create(null, nodeToInsert);
2890
+ } else if (isTargetTaskList) {
2891
+ const taskItemType = editorView.state.schema.nodes.taskItem;
2892
+ if (taskItemType) nodeToInsert = taskItemType.create({
2893
+ checked: false
2894
+ }, nodeToInsert);
2895
+ }
2896
+ }
2897
+ try {
2898
+ tr = tr.insert(mappedTarget, nodeToInsert);
2899
+ } catch (e) {
2900
+ console.warn("Could not insert dragged node exactly at target. Attempting fallback.", e);
2901
+ const point = dropPoint(tr.doc, mappedTarget, slice);
2902
+ if (point !== null) {
2903
+ tr = tr.replace(point, point, slice);
2904
+ }
2905
+ }
2906
+ } else if (slice) {
2907
+ const point = dropPoint(tr.doc, mappedTarget, slice);
2908
+ const finalTarget = point !== null ? point : mappedTarget;
2909
+ tr = tr.replace(finalTarget, finalTarget, slice);
2910
+ }
2911
+ if (!tr.doc.eq(beforeInsert)) {
2912
+ editorView.dispatch(tr.setMeta("uiEvent", "drop"));
2913
+ editorView.focus();
2914
+ }
2915
+ }
2916
+ editorView.dragging = null;
2917
+ };
2918
+ const handleDragEnd = () => {
2919
+ removeCursor();
2920
+ };
2921
+ window.addEventListener("dragover", handleDragOver, {
2922
+ capture: true
2923
+ });
2924
+ window.addEventListener("drop", handleDrop, {
2925
+ capture: true
2926
+ });
2927
+ window.addEventListener("dragend", handleDragEnd, {
2928
+ capture: true
2929
+ });
2930
+ cleanup = () => {
2931
+ removeCursor();
2932
+ observer.disconnect();
2933
+ window.removeEventListener("dragover", handleDragOver, {
2934
+ capture: true
2935
+ });
2936
+ window.removeEventListener("drop", handleDrop, {
2937
+ capture: true
2938
+ });
2939
+ window.removeEventListener("dragend", handleDragEnd, {
2940
+ capture: true
2941
+ });
2942
+ };
2943
+ return {
2944
+ destroy() {
2945
+ if (cleanup) cleanup();
2946
+ }
2947
+ };
2948
+ }
2949
+ });
2950
+ }
2951
+ const highlightDecorationKey = new PluginKey("highlightDecoration");
2952
+ function buildDecorationSet(highlight, doc) {
2953
+ const decorations = [];
2954
+ if (highlight) {
2955
+ decorations.push(Decoration.inline(highlight.from, highlight.to, {
2956
+ class: "dark:bg-surface-accent-700 bg-surface-accent-300"
2957
+ }));
2958
+ }
2959
+ const decorationSet = DecorationSet.create(doc, decorations);
2960
+ return decorationSet;
2961
+ }
2962
+ const highlightCommands = {
2963
+ toggleAutocompleteHighlight: (range) => (state, dispatch) => {
2964
+ const {
2965
+ selection
2966
+ } = state;
2967
+ const pos = selection.from;
2968
+ if (!dispatch) return false;
2969
+ const tr = state.tr.setMeta(highlightDecorationKey, {
2970
+ pos,
2971
+ type: "highlightDecoration",
2972
+ remove: false,
2973
+ range
2974
+ });
2975
+ dispatch(tr);
2976
+ return true;
2977
+ },
2978
+ removeAutocompleteHighlight: () => (state, dispatch) => {
2979
+ if (!dispatch) return false;
2980
+ const tr = state.tr.setMeta(highlightDecorationKey, {
2981
+ pos: 0,
2982
+ type: "highlightDecoration",
2983
+ remove: true
2984
+ });
2985
+ dispatch(tr);
2986
+ return true;
2987
+ }
2988
+ };
2989
+ const highlightDecorationPlugin = (initialHighlight) => {
2990
+ return new Plugin({
2991
+ key: highlightDecorationKey,
2992
+ state: {
2993
+ init: (_, {
2994
+ doc
2995
+ }) => {
2996
+ const decorationSet = DecorationSet.empty;
2997
+ return {
2998
+ decorationSet,
2999
+ highlight: initialHighlight
3000
+ };
3001
+ },
3002
+ apply(transaction, oldState) {
3003
+ const action = transaction.getMeta(highlightDecorationKey);
3004
+ const highlight = action?.range;
3005
+ if (action?.type === "highlightDecoration") {
3006
+ const doc = transaction.doc;
3007
+ const {
3008
+ remove
3009
+ } = action;
3010
+ if (remove) {
3011
+ return {
3012
+ decorationSet: DecorationSet.empty
3013
+ };
3014
+ }
3015
+ const decorationSet = buildDecorationSet(highlight, doc);
3016
+ return {
3017
+ decorationSet,
3018
+ highlight
3019
+ };
3020
+ } else {
3021
+ return oldState;
3022
+ }
3023
+ }
3024
+ },
3025
+ props: {
3026
+ decorations(state) {
3027
+ const autocompleteState = this.getState(state);
3028
+ if (autocompleteState?.decorationSet) {
3029
+ return autocompleteState.decorationSet;
3030
+ } else {
3031
+ return DecorationSet.empty;
3032
+ }
3033
+ }
3034
+ }
3035
+ });
3036
+ };
3037
+ const blockQuoteRule = wrappingInputRule(/^\s*>\s$/, schema.nodes.blockquote);
3038
+ const orderedListRule = wrappingInputRule(/^(\d+)\.\s$/, schema.nodes.ordered_list, (match) => ({
3039
+ order: +match[1]
3040
+ }), (match, node) => node.childCount + node.attrs.order === +match[1]);
3041
+ const bulletListRule = wrappingInputRule(/^\s*([-+*])\s$/, schema.nodes.bullet_list);
3042
+ const taskListRule = wrappingInputRule(/^\s*(\[ \])\s$/, schema.nodes.task_list);
3043
+ const codeBlockRule = textblockTypeInputRule(/^```$/, schema.nodes.code_block);
3044
+ const headingRule = textblockTypeInputRule(new RegExp("^(#{1,6})\\s$"), schema.nodes.heading, (match) => ({
3045
+ level: match[1].length
3046
+ }));
3047
+ const horizontalRuleInputRule = new InputRule(/^(?:---|—-|___\s|\*\*\*\s)$/, (state, match, start, end) => {
3048
+ const tr = state.tr;
3049
+ tr.replaceWith(start - 1, end, schema.nodes.horizontal_rule.create());
3050
+ return tr;
3051
+ });
3052
+ function markInputRule(regexp, markType, getAttrs) {
3053
+ return new InputRule(regexp, (state, match, start, end) => {
3054
+ const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
3055
+ const tr = state.tr;
3056
+ if (match[1]) {
3057
+ const textStart = start + match[0].indexOf(match[1]);
3058
+ const textEnd = textStart + match[1].length;
3059
+ if (textEnd < end) tr.delete(textEnd, end);
3060
+ if (textStart > start) tr.delete(start, textStart);
3061
+ end = start + match[1].length;
3062
+ }
3063
+ tr.addMark(start, end, markType.create(attrs));
3064
+ tr.removeStoredMark(markType);
3065
+ return tr;
3066
+ });
3067
+ }
3068
+ const strongRule = markInputRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, schema.marks.bold);
3069
+ const emRule = markInputRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)$/, schema.marks.italic);
3070
+ const codeRule = markInputRule(/(?:`)([^`]+)(?:`)$/, schema.marks.code);
3071
+ const strikeRule = markInputRule(/(?:~~)([^~]+)(?:~~)$/, schema.marks.strike);
3072
+ const markdownInputRules = inputRules({
3073
+ rules: [...smartQuotes, ellipsis, emDash, blockQuoteRule, orderedListRule, bulletListRule, codeBlockRule, headingRule, taskListRule, horizontalRuleInputRule, strongRule, emRule, codeRule, strikeRule]
3074
+ });
3075
+ const placeholderPluginKey = new PluginKey("placeholderPlugin");
3076
+ function isNodeEmpty(node) {
3077
+ const defaultContent = node.type.createAndFill();
3078
+ if (!defaultContent) return true;
3079
+ return node.content.eq(defaultContent.content);
3080
+ }
3081
+ function placeholderPlugin(text) {
3082
+ return new Plugin({
3083
+ key: placeholderPluginKey,
3084
+ props: {
3085
+ decorations: (state) => {
3086
+ const doc = state.doc;
3087
+ const decorations = [];
3088
+ const isEmptyDoc = doc.childCount === 1 && doc.firstChild?.isTextblock && doc.firstChild.content.size === 0;
3089
+ const {
3090
+ anchor
3091
+ } = state.selection;
3092
+ doc.descendants((node, pos) => {
3093
+ const isEmpty = !node.isLeaf && isNodeEmpty(node);
3094
+ if (isEmpty) {
3095
+ const nodeEnd = pos + node.nodeSize;
3096
+ const hasCursor = anchor >= pos && anchor <= nodeEnd;
3097
+ if (!hasCursor && !isEmptyDoc) {
3098
+ return false;
3099
+ }
3100
+ const classes = ["is-empty"];
3101
+ if (isEmptyDoc) {
3102
+ classes.push("is-editor-empty");
3103
+ }
3104
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
3105
+ class: classes.join(" "),
3106
+ "data-placeholder": text
3107
+ }));
3108
+ }
3109
+ return false;
3110
+ });
3111
+ return DecorationSet.create(doc, decorations);
3112
+ }
3113
+ }
3114
+ });
3115
+ }
3116
+ const customKeymap = {
3117
+ "Tab": goToNextCell(1),
3118
+ "Shift-Tab": goToNextCell(-1),
3119
+ "Mod-z": undo,
3120
+ "Mod-y": redo,
3121
+ "Shift-Mod-z": redo,
3122
+ "Mod-b": toggleMark(schema.marks.bold),
3123
+ "Mod-i": toggleMark(schema.marks.italic),
3124
+ "Mod-u": toggleMark(schema.marks.underline),
3125
+ "Mod-Shift-s": toggleMark(schema.marks.strike),
3126
+ "Mod-e": toggleMark(schema.marks.code),
3127
+ "Mod-Shift-h": toggleMark(schema.marks.highlight),
3128
+ "Enter": splitListItem(schema.nodes.list_item),
3129
+ "Shift-Enter": splitListItem(schema.nodes.task_item),
3130
+ "Mod-[": liftListItem(schema.nodes.list_item),
3131
+ "Mod-]": sinkListItem(schema.nodes.list_item),
3132
+ "Shift-Mod-8": setBlockType(schema.nodes.bullet_list),
3133
+ "Shift-Mod-9": setBlockType(schema.nodes.ordered_list),
3134
+ "Mod-Alt-1": setBlockType(schema.nodes.heading, {
3135
+ level: 1
3136
+ }),
3137
+ "Mod-Alt-2": setBlockType(schema.nodes.heading, {
3138
+ level: 2
3139
+ }),
3140
+ "Mod-Alt-3": setBlockType(schema.nodes.heading, {
3141
+ level: 3
3142
+ }),
3143
+ "Mod-Alt-0": setBlockType(schema.nodes.paragraph)
3144
+ };
3145
+ const getCorePlugins = () => [history(), keymap(customKeymap), keymap(baseKeymap), globalDragDropPlugin(), gapCursor(), slashCommandPlugin(), dragHandlePlugin(), highlightDecorationPlugin(), textLoadingDecorationPlugin(), markdownInputRules, placeholderPlugin("Press '/' for commands")];
3146
+ class ReactNodeView {
3147
+ node;
3148
+ view;
3149
+ getPos;
3150
+ dom;
3151
+ contentDOM;
3152
+ root;
3153
+ Component;
3154
+ constructor(node, view, getPos, Component, as = "div", className, contentDOMElement) {
3155
+ this.node = node;
3156
+ this.view = view;
3157
+ this.getPos = getPos;
3158
+ this.Component = Component;
3159
+ this.dom = document.createElement(as);
3160
+ if (className) this.dom.className = className;
3161
+ if (contentDOMElement) {
3162
+ this.contentDOM = contentDOMElement;
3163
+ }
3164
+ const container = document.createElement("div");
3165
+ this.dom.appendChild(container);
3166
+ if (this.contentDOM) {
3167
+ this.dom.appendChild(this.contentDOM);
3168
+ }
3169
+ this.root = createRoot(container);
3170
+ this.render();
3171
+ }
3172
+ render() {
3173
+ this.root.render(/* @__PURE__ */ jsx(this.Component, { node: this.node, view: this.view, getPos: this.getPos }));
3174
+ }
3175
+ update(node) {
3176
+ if (node.type !== this.node.type) {
3177
+ return false;
3178
+ }
3179
+ this.node = node;
3180
+ this.render();
3181
+ return true;
3182
+ }
3183
+ destroy() {
3184
+ this.root.unmount();
3185
+ }
3186
+ ignoreMutation(mutation) {
3187
+ if (!this.contentDOM) {
3188
+ return true;
3189
+ }
3190
+ return !this.contentDOM.contains(mutation.target);
3191
+ }
3192
+ }
3193
+ const TaskItemComponent = (t0) => {
3194
+ const $ = c(7);
3195
+ const {
3196
+ node,
3197
+ view,
3198
+ getPos
3199
+ } = t0;
3200
+ const checked = node.attrs.checked;
3201
+ let t1;
3202
+ if ($[0] !== getPos || $[1] !== node.attrs || $[2] !== view) {
3203
+ t1 = (e) => {
3204
+ const pos = getPos();
3205
+ if (typeof pos !== "number") {
3206
+ return;
3207
+ }
3208
+ view.dispatch(view.state.tr.setNodeMarkup(pos, void 0, {
3209
+ ...node.attrs,
3210
+ checked: e.target.checked
3211
+ }));
3212
+ };
3213
+ $[0] = getPos;
3214
+ $[1] = node.attrs;
3215
+ $[2] = view;
3216
+ $[3] = t1;
3217
+ } else {
3218
+ t1 = $[3];
3219
+ }
3220
+ const handleChange = t1;
3221
+ let t2;
3222
+ if ($[4] !== checked || $[5] !== handleChange) {
3223
+ t2 = /* @__PURE__ */ jsx("label", { contentEditable: false, className: "flex items-start select-none px-1", children: /* @__PURE__ */ jsx("input", { type: "checkbox", checked, onChange: handleChange, className: "mt-1 flex-shrink-0 cursor-pointer" }) });
3224
+ $[4] = checked;
3225
+ $[5] = handleChange;
3226
+ $[6] = t2;
3227
+ } else {
3228
+ t2 = $[6];
3229
+ }
3230
+ return t2;
3231
+ };
3232
+ const ImageComponent = (t0) => {
3233
+ const $ = c(7);
3234
+ const {
3235
+ node,
3236
+ view,
3237
+ getPos
3238
+ } = t0;
3239
+ const selected = view.state.selection.from === getPos();
3240
+ const t1 = node.attrs.src;
3241
+ const t2 = node.attrs.alt || "";
3242
+ const t3 = node.attrs.title || "";
3243
+ const t4 = selected ? "" : "";
3244
+ let t5;
3245
+ if ($[0] !== t4) {
3246
+ t5 = cls("rounded-lg max-w-full !m-0", t4);
3247
+ $[0] = t4;
3248
+ $[1] = t5;
3249
+ } else {
3250
+ t5 = $[1];
3251
+ }
3252
+ let t6;
3253
+ if ($[2] !== node.attrs.src || $[3] !== t2 || $[4] !== t3 || $[5] !== t5) {
3254
+ t6 = /* @__PURE__ */ jsx("img", { src: t1, alt: t2, title: t3, className: t5 });
3255
+ $[2] = node.attrs.src;
3256
+ $[3] = t2;
3257
+ $[4] = t3;
3258
+ $[5] = t5;
3259
+ $[6] = t6;
3260
+ } else {
3261
+ t6 = $[6];
3262
+ }
3263
+ return t6;
3264
+ };
3265
+ function createReactNodeView(Component, as = "div", className, createContentDOM) {
3266
+ return (node, view, getPos) => {
3267
+ const contentDOM = createContentDOM ? createContentDOM() : void 0;
3268
+ return new ReactNodeView(node, view, getPos, Component, as, className, contentDOM);
3269
+ };
3270
+ }
3271
+ const nodeViews = {
3272
+ task_item: createReactNodeView(TaskItemComponent, "li", "flex items-start", () => {
3273
+ const dom = document.createElement("div");
3274
+ dom.className = "flex-grow min-w-0";
3275
+ return dom;
3276
+ }),
3277
+ image: createReactNodeView(ImageComponent, "span", "inline-block w-full")
3278
+ };
3279
+ const trailingNodePlugin = new Plugin({
3280
+ appendTransaction: (_, oldState, newState) => {
3281
+ const doc = newState.doc;
3282
+ if (doc.lastChild && doc.lastChild.type.name !== "paragraph") {
3283
+ return newState.tr.insert(doc.content.size, newState.schema.nodes.paragraph.create());
3284
+ }
3285
+ return null;
3286
+ }
3287
+ });
3288
+ function useProseMirror(t0) {
3289
+ const $ = c(13);
3290
+ const {
3291
+ initialContent,
3292
+ editable: t1,
3293
+ handleImageUpload
3294
+ } = t0;
3295
+ const editable = t1 === void 0 ? true : t1;
3296
+ let t2;
3297
+ if ($[0] !== handleImageUpload || $[1] !== initialContent) {
3298
+ const plugins = [...getCorePlugins(), columnResizing(), tableEditing(), trailingNodePlugin];
3299
+ if (handleImageUpload) {
3300
+ plugins.push(createDropImagePlugin(handleImageUpload));
3301
+ }
3302
+ t2 = EditorState.create({
3303
+ doc: typeof initialContent === "string" ? parser.parse(initialContent) : initialContent ? schema.nodeFromJSON(initialContent) : schema.node("doc", null, [schema.node("paragraph")]),
3304
+ schema,
3305
+ plugins
3306
+ });
3307
+ $[0] = handleImageUpload;
3308
+ $[1] = initialContent;
3309
+ $[2] = t2;
3310
+ } else {
3311
+ t2 = $[2];
3312
+ }
3313
+ const defaultState = t2;
3314
+ const [state, setState] = useState(defaultState);
3315
+ const [view, setView] = useState(null);
3316
+ const editorRef = useRef(null);
3317
+ const viewRef = useRef(null);
3318
+ let t3;
3319
+ if ($[3] !== defaultState || $[4] !== editable) {
3320
+ t3 = () => {
3321
+ if (!editorRef.current) {
3322
+ return;
3323
+ }
3324
+ const editorView = new EditorView(editorRef.current, {
3325
+ state: defaultState,
3326
+ editable: () => editable,
3327
+ dispatchTransaction: (tr) => {
3328
+ const newState = editorView.state.apply(tr);
3329
+ editorView.updateState(newState);
3330
+ setState(newState);
3331
+ },
3332
+ nodeViews,
3333
+ transformPastedHTML(html) {
3334
+ const div = document.createElement("div");
3335
+ div.innerHTML = html;
3336
+ div.querySelectorAll("*").forEach(_temp);
3337
+ return div.innerHTML;
3338
+ }
3339
+ });
3340
+ const originalPosAtCoords = editorView.posAtCoords.bind(editorView);
3341
+ editorView.posAtCoords = (coords) => {
3342
+ const res = originalPosAtCoords(coords);
3343
+ if (!res) {
3344
+ const editorRect = editorView.dom.getBoundingClientRect();
3345
+ if (coords.left <= editorRect.left) {
3346
+ const probeX = editorRect.left + Math.min(60, editorRect.width / 4);
3347
+ return originalPosAtCoords({
3348
+ left: probeX,
3349
+ top: coords.top
3350
+ });
3351
+ }
3352
+ if (coords.left >= editorRect.right) {
3353
+ const probeX_0 = editorRect.right - Math.min(60, editorRect.width / 4);
3354
+ return originalPosAtCoords({
3355
+ left: probeX_0,
3356
+ top: coords.top
3357
+ });
3358
+ }
3359
+ }
3360
+ return res;
3361
+ };
3362
+ viewRef.current = editorView;
3363
+ setView(editorView);
3364
+ return () => {
3365
+ editorView.destroy();
3366
+ viewRef.current = null;
3367
+ };
3368
+ };
3369
+ $[3] = defaultState;
3370
+ $[4] = editable;
3371
+ $[5] = t3;
3372
+ } else {
3373
+ t3 = $[5];
3374
+ }
3375
+ let t4;
3376
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3377
+ t4 = [];
3378
+ $[6] = t4;
3379
+ } else {
3380
+ t4 = $[6];
3381
+ }
3382
+ useLayoutEffect(t3, t4);
3383
+ let t5;
3384
+ let t6;
3385
+ if ($[7] !== editable) {
3386
+ t5 = () => {
3387
+ if (viewRef.current) {
3388
+ viewRef.current.setProps({
3389
+ editable: () => editable
3390
+ });
3391
+ }
3392
+ };
3393
+ t6 = [editable];
3394
+ $[7] = editable;
3395
+ $[8] = t5;
3396
+ $[9] = t6;
3397
+ } else {
3398
+ t5 = $[8];
3399
+ t6 = $[9];
3400
+ }
3401
+ useEffect(t5, t6);
3402
+ let t7;
3403
+ if ($[10] !== state || $[11] !== view) {
3404
+ t7 = {
3405
+ state,
3406
+ view,
3407
+ editorRef
3408
+ };
3409
+ $[10] = state;
3410
+ $[11] = view;
3411
+ $[12] = t7;
3412
+ } else {
3413
+ t7 = $[12];
3414
+ }
3415
+ return t7;
3416
+ }
3417
+ function _temp(el) {
3418
+ el.removeAttribute("style");
3419
+ el.removeAttribute("class");
3420
+ el.removeAttribute("color");
3421
+ el.removeAttribute("bgcolor");
3422
+ el.removeAttribute("face");
3423
+ }
3424
+ const proseClasses = {
3425
+ "sm": "prose-sm",
3426
+ "base": "prose-base",
3427
+ "lg": "prose-lg"
3428
+ };
3429
+ const RebaseEditor = ({
3430
+ content,
3431
+ onJsonContentChange,
3432
+ onHtmlContentChange,
3433
+ onMarkdownContentChange,
3434
+ version,
3435
+ textSize = "base",
3436
+ highlight,
3437
+ handleImageUpload,
3438
+ aiController,
3439
+ disabled,
3440
+ markdownConfig
3441
+ }) => {
3442
+ const {
3443
+ t
3444
+ } = useTranslation();
3445
+ const [openNode, setOpenNode] = useState(false);
3446
+ const [openLink, setOpenLink] = useState(false);
3447
+ const [isMarkdownMode, setIsMarkdownMode] = useState(false);
3448
+ const [internalMarkdown, setInternalMarkdown] = useState("");
3449
+ useEffect(() => {
3450
+ if (!isMarkdownMode) return;
3451
+ const timeout = setTimeout(() => {
3452
+ if (callbacksRef.current.onMarkdownContentChange) {
3453
+ callbacksRef.current.onMarkdownContentChange(internalMarkdown);
3454
+ }
3455
+ }, 250);
3456
+ return () => clearTimeout(timeout);
3457
+ }, [internalMarkdown, isMarkdownMode]);
3458
+ const handleToggleMarkdown = () => {
3459
+ if (!isMarkdownMode) {
3460
+ if (view) {
3461
+ setInternalMarkdown(serializer.serialize(view.state.doc));
3462
+ }
3463
+ setIsMarkdownMode(true);
3464
+ } else {
3465
+ if (view) {
3466
+ const newDoc = parser.parse(internalMarkdown);
3467
+ if (newDoc) {
3468
+ const tr = view.state.tr.replaceWith(0, view.state.doc.content.size, newDoc.content);
3469
+ view.dispatch(tr);
3470
+ }
3471
+ }
3472
+ setIsMarkdownMode(false);
3473
+ }
3474
+ };
3475
+ const handleMarkdownChange = (e) => {
3476
+ setInternalMarkdown(e.target.value);
3477
+ };
3478
+ const handleMarkdownBlur = () => {
3479
+ const {
3480
+ onMarkdownContentChange: onMarkdownContentChange_0,
3481
+ onJsonContentChange: onJsonContentChange_0
3482
+ } = callbacksRef.current;
3483
+ if (onMarkdownContentChange_0) {
3484
+ onMarkdownContentChange_0(internalMarkdown);
3485
+ }
3486
+ if (onJsonContentChange_0) {
3487
+ try {
3488
+ const newDoc_0 = parser.parse(internalMarkdown);
3489
+ if (newDoc_0) {
3490
+ onJsonContentChange_0(removeClassesFromJson(newDoc_0.toJSON()));
3491
+ }
3492
+ } catch (e_0) {
3493
+ console.warn("Could not parse markdown to JSON", e_0);
3494
+ }
3495
+ }
3496
+ };
3497
+ useInjectStyles("Editor", cssStyles);
3498
+ const callbacksRef = useRef({
3499
+ onMarkdownContentChange,
3500
+ onJsonContentChange
3501
+ });
3502
+ useEffect(() => {
3503
+ callbacksRef.current = {
3504
+ onMarkdownContentChange,
3505
+ onJsonContentChange
3506
+ };
3507
+ }, [onMarkdownContentChange, onJsonContentChange]);
3508
+ const flushChanges = (currentState) => {
3509
+ const {
3510
+ onMarkdownContentChange: onMarkdownContentChange_1,
3511
+ onJsonContentChange: onJsonContentChange_1
3512
+ } = callbacksRef.current;
3513
+ if (onMarkdownContentChange_1) {
3514
+ try {
3515
+ const markdown = serializer.serialize(currentState.doc);
3516
+ onMarkdownContentChange_1(markdown);
3517
+ } catch (e_1) {
3518
+ console.warn("[RebaseEditor] Could not serialize editor state to markdown:", e_1);
3519
+ }
3520
+ }
3521
+ if (onJsonContentChange_1) {
3522
+ const jsonContent = removeClassesFromJson(currentState.doc.toJSON());
3523
+ onJsonContentChange_1(jsonContent);
3524
+ }
3525
+ };
3526
+ const {
3527
+ state,
3528
+ view,
3529
+ editorRef
3530
+ } = useProseMirror({
3531
+ initialContent: content,
3532
+ editable: !disabled,
3533
+ handleImageUpload
3534
+ });
3535
+ const versionRef = useRef(version);
3536
+ useEffect(() => {
3537
+ if (versionRef.current === version) return;
3538
+ versionRef.current = version;
3539
+ if (!view) return;
3540
+ try {
3541
+ const newDoc_1 = typeof content === "string" ? parser.parse(content ?? "") : content ? schema.nodeFromJSON(content) : schema.node("doc", null, [schema.node("paragraph")]);
3542
+ if (newDoc_1) {
3543
+ const tr_0 = view.state.tr.replaceWith(0, view.state.doc.content.size, newDoc_1.content);
3544
+ view.dispatch(tr_0);
3545
+ }
3546
+ } catch (e_2) {
3547
+ console.warn("[RebaseEditor] Could not reset editor content:", e_2);
3548
+ }
3549
+ if (isMarkdownMode) {
3550
+ setInternalMarkdown(typeof content === "string" ? content : "");
3551
+ }
3552
+ mountTimeRef.current = Date.now();
3553
+ hasUserEditedRef.current = false;
3554
+ }, [version]);
3555
+ const doc = state?.doc;
3556
+ const mountTimeRef = useRef(Date.now());
3557
+ const hasUserEditedRef = useRef(false);
3558
+ useEffect(() => {
3559
+ if (!state) return;
3560
+ const elapsed = Date.now() - mountTimeRef.current;
3561
+ if (elapsed < 500 && !hasUserEditedRef.current) {
3562
+ return;
3563
+ }
3564
+ hasUserEditedRef.current = true;
3565
+ const timeout_0 = setTimeout(() => {
3566
+ flushChanges(state);
3567
+ }, 250);
3568
+ return () => clearTimeout(timeout_0);
3569
+ }, [doc]);
3570
+ useEffect(() => {
3571
+ if (!view) return;
3572
+ const dom = view.dom;
3573
+ const handleBlur = () => {
3574
+ if (!hasUserEditedRef.current) {
3575
+ const elapsed_0 = Date.now() - mountTimeRef.current;
3576
+ if (elapsed_0 < 500) return;
3577
+ }
3578
+ flushChanges(view.state);
3579
+ };
3580
+ dom.addEventListener("blur", handleBlur);
3581
+ return () => dom.removeEventListener("blur", handleBlur);
3582
+ }, [view]);
3583
+ useEffect(() => {
3584
+ if (view) {
3585
+ if (highlight) {
3586
+ highlightCommands.toggleAutocompleteHighlight(highlight)(view.state, view.dispatch);
3587
+ } else {
3588
+ highlightCommands.removeAutocompleteHighlight()(view.state, view.dispatch);
3589
+ }
3590
+ }
3591
+ }, [highlight?.from, highlight?.to]);
3592
+ const proseClass = proseClasses[textSize];
3593
+ return /* @__PURE__ */ jsxs("div", { className: "relative min-h-[200px] w-full", children: [
3594
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: handleToggleMarkdown, title: isMarkdownMode ? "Switch to Visual Editor" : "Switch to Markdown", className: "absolute top-2 right-2 z-10 px-2 py-1 text-xs font-medium text-surface-400 hover:text-surface-700 dark:text-surface-600 dark:hover:text-surface-300 transition-colors opacity-50 hover:opacity-100 bg-transparent rounded", children: isMarkdownMode ? "Visual" : "Markdown" }),
3595
+ /* @__PURE__ */ jsxs(ProseMirrorContext.Provider, { value: useMemo(() => ({
3596
+ state,
3597
+ view
3598
+ }), [state, view]), children: [
3599
+ /* @__PURE__ */ jsxs("div", { style: {
3600
+ display: isMarkdownMode ? "none" : "block"
3601
+ }, children: [
3602
+ /* @__PURE__ */ jsx("div", { ref: editorRef, className: cls("relative prose dark:prose-invert", proseClass, "prose-headings:font-title prose-headings:font-normal prose-strong:font-semibold prose-code:font-normal prose-blockquote:font-normal prose-a:font-normal font-default focus:outline-none max-w-full p-12") }),
3603
+ view && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3604
+ /* @__PURE__ */ jsxs(EditorBubble, { options: {
3605
+ placement: "top",
3606
+ offset: 6
3607
+ }, className: cls("flex w-fit max-w-[90vw] h-10 overflow-hidden rounded border bg-white dark:bg-surface-800 shadow", defaultBorderMixin), children: [
3608
+ /* @__PURE__ */ jsx(NodeSelector, { portalContainer: editorRef.current, open: openNode, onOpenChange: setOpenNode }),
3609
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
3610
+ /* @__PURE__ */ jsx(LinkSelector, { open: openLink, onOpenChange: setOpenLink }),
3611
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
3612
+ /* @__PURE__ */ jsx(TextButtons, {})
3613
+ ] }),
3614
+ /* @__PURE__ */ jsx(ImageBubble, { options: {
3615
+ placement: "bottom",
3616
+ offset: 6
3617
+ } }),
3618
+ /* @__PURE__ */ jsx(TableBubble, {})
3619
+ ] }),
3620
+ /* @__PURE__ */ jsx(SlashCommandMenu, { upload: handleImageUpload, aiController })
3621
+ ] }),
3622
+ isMarkdownMode && /* @__PURE__ */ jsx(TextareaAutosize, { value: internalMarkdown, onChange: handleMarkdownChange, onBlur: handleMarkdownBlur, className: cls("w-full h-full min-h-[200px] p-12 bg-transparent resize-none font-mono focus:ring-0", proseClass), style: {
3623
+ tabSize: 4,
3624
+ outline: "none",
3625
+ border: "none",
3626
+ boxShadow: "none"
3627
+ } })
3628
+ ] })
3629
+ ] });
3630
+ };
3631
+ const cssStyles = `
3632
+ .ProseMirror {
3633
+ box-shadow: none !important;
3634
+ }
3635
+ .ProseMirror .is-editor-empty:first-child::before {
3636
+ content: attr(data-placeholder);
3637
+ float: left;
3638
+ color: rgb(100 116 139); //500
3639
+ pointer-events: none;
3640
+ height: 0;
3641
+ }
3642
+ .ProseMirror .is-empty::before {
3643
+ content: attr(data-placeholder);
3644
+ float: left;
3645
+ color: rgb(100 116 139); //500
3646
+ pointer-events: none;
3647
+ height: 0;
3648
+ }
3649
+
3650
+ [data-theme="dark"] {
3651
+ .ProseMirror .is-empty::before {
3652
+ color: rgb(100 116 139); //500
3653
+ }
3654
+ }
3655
+
3656
+ .is-empty {
3657
+ cursor: text;
3658
+ color: rgb(100 116 139); //500
3659
+ }
3660
+
3661
+ .ProseMirror img {
3662
+ transition: filter 0.1s ease-in-out;
3663
+ }
3664
+ .ProseMirror img:hover {
3665
+ cursor: pointer;
3666
+ filter: brightness(90%);
3667
+ }
3668
+ .ProseMirror img.ProseMirror-selectednode {
3669
+ filter: brightness(90%);
3670
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;
3671
+ }
3672
+
3673
+ ul[data-type="taskList"] li > label {
3674
+ margin-right: 0.2rem;
3675
+ user-select: none;
3676
+ }
3677
+ @media screen and (max-width: 768px) {
3678
+ ul[data-type="taskList"] li > label {
3679
+ margin-right: 0.5rem;
3680
+ }
3681
+ }
3682
+ [data-theme="dark"] ul[data-type="taskList"] li > label input[type="checkbox"] {
3683
+ background-color: rgb(30 41 59);
3684
+ border: 2px solid #666;
3685
+ }
3686
+ [data-theme="dark"] ul[data-type="taskList"] li > label input[type="checkbox"]:hover { background-color: rgb(51 65 85); }
3687
+ [data-theme="dark"] ul[data-type="taskList"] li > label input[type="checkbox"]:active { background-color: rgb(71 85 105); }
3688
+ ul[data-type="taskList"] li > label input[type="checkbox"] {
3689
+ -webkit-appearance: none;
3690
+ appearance: none;
3691
+ background-color: white;
3692
+ margin: 0;
3693
+ cursor: pointer;
3694
+ width: 1.2em;
3695
+ height: 1.2em;
3696
+ position: relative;
3697
+ top: 5px;
3698
+ border: 2px solid #777;
3699
+ border-radius: 0.25em;
3700
+ margin-right: 0.3rem;
3701
+ display: grid;
3702
+ place-content: center;
3703
+ }
3704
+ ul[data-type="taskList"] li > label input[type="checkbox"]:hover { background-color: rgb(241 245 249); }
3705
+ ul[data-type="taskList"] li > label input[type="checkbox"]:active { background-color: rgb(226 232 240); }
3706
+ ul[data-type="taskList"] li > label input[type="checkbox"]::before {
3707
+ content: "";
3708
+ width: 0.65em;
3709
+ height: 0.65em;
3710
+ transform: scale(0);
3711
+ transition: 120ms transform ease-in-out;
3712
+ box-shadow: inset 1em 1em;
3713
+ transform-origin: center;
3714
+ clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
3715
+ }
3716
+ ul[data-type="taskList"] li > label input[type="checkbox"]:checked::before { transform: scale(1); }
3717
+
3718
+ [data-theme="dark"] {
3719
+ ul[data-type="taskList"] li[data-checked="true"] > div > p {
3720
+ color: rgb(226 232 240);
3721
+ text-decoration: line-through;
3722
+ text-decoration-thickness: 2px;
3723
+ }
3724
+ }
3725
+ ul[data-type="taskList"] li[data-checked="true"] > div > p {
3726
+ color: rgb(51 65 85);
3727
+ text-decoration: line-through;
3728
+ text-decoration-thickness: 2px;
3729
+ }
3730
+ .tippy-box { max-width: 400px !important; }
3731
+
3732
+ .ProseMirror:not(.dragging) .ProseMirror-selectednode {
3733
+ background-color: rgb(219 234 254);
3734
+ transition: background-color 0.2s;
3735
+ box-shadow: none;
3736
+ }
3737
+ [data-theme="dark"] .ProseMirror:not(.dragging) .ProseMirror-selectednode {
3738
+ background-color: rgb(51 65 85);
3739
+ }
3740
+ .prose-base table p { margin: 0; }
3741
+
3742
+ .drag-handle {
3743
+ position: absolute;
3744
+ opacity: 1;
3745
+ transition: opacity ease-in 0.2s;
3746
+ border-radius: 0.25rem;
3747
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' style='fill: rgba(128, 128, 128, 0.9)'%3E%3Cpath d='M3,2 C2.44771525,2 2,1.55228475 2,1 C2,0.44771525 2.44771525,0 3,0 C3.55228475,0 4,0.44771525 4,1 C4,1.55228475 3.55228475,2 3,2 Z M3,6 C2.44771525,6 2,5.55228475 2,5 C2,4.44771525 2.44771525,4 3,4 C3.55228475,4 4,4.44771525 4,5 C4,5.55228475 3.55228475,6 3,6 Z M3,10 C2.44771525,10 2,9.55228475 2,9 C2,8.44771525 2.44771525,8 3,8 C3.55228475,8 4,8.44771525 4,9 C4,9.55228475 3.55228475,10 3,10 Z M7,2 C6.44771525,2 6,1.55228475 6,1 C6,0.44771525 6.44771525,0 7,0 C7.55228475,0 8,0.44771525 8,1 C8,1.55228475 7.55228475,2 7,2 Z M7,6 C6.44771525,6 6,5.55228475 6,5 C6,4.44771525 6.44771525,4 7,4 C7.55228475,4 8,4.44771525 8,5 C8,5.55228475 7.55228475,6 7,6 Z M7,10 C6.44771525,10 6,9.55228475 6,9 C6,8.44771525 6.44771525,8 7,8 C7,8.44771525 7,9 7,9 C7,9.55228475 7,10 7,10 Z'%3E%3C/path%3E%3C/svg%3E");
3748
+ background-size: calc(0.5em + 0.375rem) calc(0.5em + 0.375rem);
3749
+ background-repeat: no-repeat;
3750
+ background-position: center;
3751
+ width: 1.2rem;
3752
+ height: 1.5rem;
3753
+ z-index: 100;
3754
+ cursor: grab;
3755
+ }
3756
+ .drag-handle::before {
3757
+ content: '';
3758
+ position: absolute;
3759
+ top: -10px;
3760
+ bottom: -10px;
3761
+ left: -20px;
3762
+ right: 0px;
3763
+ z-index: -1;
3764
+ }
3765
+ .drag-handle:hover { background-color: rgb(241 245 249); transition: background-color 0.2s; }
3766
+ .drag-handle:active { background-color: rgb(226 232 240); transition: background-color 0.2s; }
3767
+ .drag-handle.hide { opacity: 0; pointer-events: none; }
3768
+ @media screen and (max-width: 600px) { .drag-handle { display: none; pointer-events: none; } }
3769
+ [data-theme="dark"] .drag-handle:hover { background-color: rgb(51 65 85); }
3770
+ [data-theme="dark"] .drag-handle:active { background-color: rgb(51 65 85); }
3771
+ .prosemirror-dropcursor-block {
3772
+ background-color: var(--color-surface-accent-600);
3773
+ }
3774
+ [data-theme="dark"] .prosemirror-dropcursor-block {
3775
+ background-color: var(--color-surface-accent-300);
3776
+ }
3777
+
3778
+ .ProseMirror table {
3779
+ border-collapse: separate;
3780
+ border-spacing: 0;
3781
+ table-layout: fixed;
3782
+ width: 100%;
3783
+ margin: 1em 0;
3784
+ overflow: hidden;
3785
+ border-radius: 0.375rem;
3786
+ border: 1px solid #e5e7eb;
3787
+ }
3788
+ [data-theme="dark"] .ProseMirror table {
3789
+ border-color: #374151;
3790
+ }
3791
+
3792
+ .ProseMirror td, .ProseMirror th {
3793
+ min-width: 1em;
3794
+ padding: 8px 10px;
3795
+ vertical-align: top;
3796
+ box-sizing: border-box;
3797
+ position: relative;
3798
+ border-right: 1px solid #e5e7eb;
3799
+ border-bottom: 1px solid #e5e7eb;
3800
+ }
3801
+ [data-theme="dark"] .ProseMirror td, [data-theme="dark"] .ProseMirror th {
3802
+ border-right-color: #374151;
3803
+ border-bottom-color: #374151;
3804
+ }
3805
+
3806
+ .ProseMirror tr:last-child td, .ProseMirror tr:last-child th {
3807
+ border-bottom: none;
3808
+ }
3809
+ .ProseMirror th:last-child, .ProseMirror td:last-child {
3810
+ border-right: none;
3811
+ }
3812
+
3813
+ .ProseMirror td {
3814
+ background-color: transparent;
3815
+ }
3816
+
3817
+ .ProseMirror th {
3818
+ font-weight: 600;
3819
+ text-align: left;
3820
+ background-color: #f3f4f6;
3821
+ color: #374151;
3822
+ }
3823
+ [data-theme="dark"] .ProseMirror td {
3824
+ background-color: transparent;
3825
+ }
3826
+ [data-theme="dark"] .ProseMirror th {
3827
+ background-color: rgba(255, 255, 255, 0.05);
3828
+ color: #d1d5db;
3829
+ }
3830
+ `;
3831
+ export {
3832
+ RebaseEditor
3833
+ };
3834
+ //# sourceMappingURL=editor.js.map