@igstack/app-catalog-frontend-core 0.0.1

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 (652) hide show
  1. package/LICENSE +21 -0
  2. package/dist/esm/App.d.ts +12 -0
  3. package/dist/esm/App.js +12 -0
  4. package/dist/esm/App.js.map +1 -0
  5. package/dist/esm/__tests__/setupTests.d.ts +0 -0
  6. package/dist/esm/api/infra/createQueryClient.d.ts +9 -0
  7. package/dist/esm/api/infra/createQueryClient.js +25 -0
  8. package/dist/esm/api/infra/createQueryClient.js.map +1 -0
  9. package/dist/esm/api/infra/trpc.d.ts +1624 -0
  10. package/dist/esm/api/infra/trpc.js +8 -0
  11. package/dist/esm/api/infra/trpc.js.map +1 -0
  12. package/dist/esm/api/unsorted/appCatalogFetcher.d.ts +10 -0
  13. package/dist/esm/api/unsorted/appCatalogFetcher.js +18 -0
  14. package/dist/esm/api/unsorted/appCatalogFetcher.js.map +1 -0
  15. package/dist/esm/api/unsorted/createCachingFetcher.d.ts +23 -0
  16. package/dist/esm/api/unsorted/createCachingFetcher.js +93 -0
  17. package/dist/esm/api/unsorted/createCachingFetcher.js.map +1 -0
  18. package/dist/esm/appPropsFactory.d.ts +2 -0
  19. package/dist/esm/appPropsFactory.js +34 -0
  20. package/dist/esm/appPropsFactory.js.map +1 -0
  21. package/dist/esm/assets/app-catalog.svg.js +6 -0
  22. package/dist/esm/assets/app-catalog.svg.js.map +1 -0
  23. package/dist/esm/components/IconPickerDialog.d.ts +8 -0
  24. package/dist/esm/components/IconPickerDialog.js +98 -0
  25. package/dist/esm/components/IconPickerDialog.js.map +1 -0
  26. package/dist/esm/components/IconPickerField.d.ts +9 -0
  27. package/dist/esm/components/IconPickerField.js +76 -0
  28. package/dist/esm/components/IconPickerField.js.map +1 -0
  29. package/dist/esm/components/ThemeSwitcher.d.ts +1 -0
  30. package/dist/esm/components/ThemeSwitcher.js +25 -0
  31. package/dist/esm/components/ThemeSwitcher.js.map +1 -0
  32. package/dist/esm/components/theme-provider.d.ts +2 -0
  33. package/dist/esm/components/theme-provider.js +10 -0
  34. package/dist/esm/components/theme-provider.js.map +1 -0
  35. package/dist/esm/errors/AuthorizationError.d.ts +19 -0
  36. package/dist/esm/errors/AuthorizationError.js +20 -0
  37. package/dist/esm/errors/AuthorizationError.js.map +1 -0
  38. package/dist/esm/errors/index.d.ts +1 -0
  39. package/dist/esm/index.d.ts +3 -0
  40. package/dist/esm/index.js +7 -0
  41. package/dist/esm/index.js.map +1 -0
  42. package/dist/esm/lib/utils.d.ts +2 -0
  43. package/dist/esm/lib/utils.js +9 -0
  44. package/dist/esm/lib/utils.js.map +1 -0
  45. package/dist/esm/main.d.ts +0 -0
  46. package/dist/esm/modules/admin-base/components/AdminChat.d.ts +1 -0
  47. package/dist/esm/modules/admin-base/components/AdminChat.js +82 -0
  48. package/dist/esm/modules/admin-base/components/AdminChat.js.map +1 -0
  49. package/dist/esm/modules/admin-base/components/AdminLayout.d.ts +5 -0
  50. package/dist/esm/modules/admin-base/components/AdminLayout.js +83 -0
  51. package/dist/esm/modules/admin-base/components/AdminLayout.js.map +1 -0
  52. package/dist/esm/modules/admin-base/components/AdminWelcome.d.ts +1 -0
  53. package/dist/esm/modules/admin-base/components/AdminWelcome.js +37 -0
  54. package/dist/esm/modules/admin-base/components/AdminWelcome.js.map +1 -0
  55. package/dist/esm/modules/admin-base/context/AdminConfigContext.d.ts +8 -0
  56. package/dist/esm/modules/admin-base/context/AdminConfigContext.js +27 -0
  57. package/dist/esm/modules/admin-base/context/AdminConfigContext.js.map +1 -0
  58. package/dist/esm/modules/admin-base/index.d.ts +5 -0
  59. package/dist/esm/modules/admin-base/types/adminTypes.d.ts +10 -0
  60. package/dist/esm/modules/appCatalog/AppCatalogAdminPage.d.ts +1 -0
  61. package/dist/esm/modules/appCatalog/AppCatalogAdminPage.js +196 -0
  62. package/dist/esm/modules/appCatalog/AppCatalogAdminPage.js.map +1 -0
  63. package/dist/esm/modules/appCatalog/ScreenshotItem.d.ts +7 -0
  64. package/dist/esm/modules/appCatalog/ScreenshotItem.js +57 -0
  65. package/dist/esm/modules/appCatalog/ScreenshotItem.js.map +1 -0
  66. package/dist/esm/modules/appCatalog/ScreenshotManager.d.ts +15 -0
  67. package/dist/esm/modules/appCatalog/ScreenshotManager.js +155 -0
  68. package/dist/esm/modules/appCatalog/ScreenshotManager.js.map +1 -0
  69. package/dist/esm/modules/appCatalog/api/ApiQueryMagazineAppCatalog.d.ts +11 -0
  70. package/dist/esm/modules/appCatalog/api/ApiQueryMagazineAppCatalog.js +14 -0
  71. package/dist/esm/modules/appCatalog/api/ApiQueryMagazineAppCatalog.js.map +1 -0
  72. package/dist/esm/modules/appCatalog/catalogRouteLoader.d.ts +5 -0
  73. package/dist/esm/modules/appCatalog/catalogRouteLoader.js +20 -0
  74. package/dist/esm/modules/appCatalog/catalogRouteLoader.js.map +1 -0
  75. package/dist/esm/modules/appCatalog/context/AppCatalogContext.d.ts +15 -0
  76. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +47 -0
  77. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -0
  78. package/dist/esm/modules/appCatalog/index.d.ts +10 -0
  79. package/dist/esm/modules/appCatalog/routeLoader.d.ts +3 -0
  80. package/dist/esm/modules/appCatalog/routeLoader.js +7 -0
  81. package/dist/esm/modules/appCatalog/routeLoader.js.map +1 -0
  82. package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.d.ts +7 -0
  83. package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.js +257 -0
  84. package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.js.map +1 -0
  85. package/dist/esm/modules/appCatalog/ui/components/AppDetailModal.d.ts +7 -0
  86. package/dist/esm/modules/appCatalog/ui/components/ApproverDisplay.d.ts +30 -0
  87. package/dist/esm/modules/appCatalog/ui/components/GroupingColumn.d.ts +11 -0
  88. package/dist/esm/modules/appCatalog/ui/components/GroupingTabs.d.ts +7 -0
  89. package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.d.ts +10 -0
  90. package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js +35 -0
  91. package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js.map +1 -0
  92. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogFiltersCard.d.ts +9 -0
  93. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.d.ts +8 -0
  94. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +325 -0
  95. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -0
  96. package/dist/esm/modules/appCatalog/ui/grid/AppCatalogTable.d.ts +5 -0
  97. package/dist/esm/modules/appCatalog/ui/grid/appCatalogUtils.d.ts +2 -0
  98. package/dist/esm/modules/appCatalog/ui/hooks/useKeyboardNavigation.d.ts +10 -0
  99. package/dist/esm/modules/appCatalog/ui/hooks/useKeyboardNavigation.js +36 -0
  100. package/dist/esm/modules/appCatalog/ui/hooks/useKeyboardNavigation.js.map +1 -0
  101. package/dist/esm/modules/appCatalog/ui/layout/AppCatalogLayout.d.ts +9 -0
  102. package/dist/esm/modules/appCatalog/ui/layout/AppCatalogLayout.js +28 -0
  103. package/dist/esm/modules/appCatalog/ui/layout/AppCatalogLayout.js.map +1 -0
  104. package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.d.ts +1 -0
  105. package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js +112 -0
  106. package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js.map +1 -0
  107. package/dist/esm/modules/approvalMethod/AccessRequestFormFields.d.ts +7 -0
  108. package/dist/esm/modules/approvalMethod/AccessRequestFormFields.js +323 -0
  109. package/dist/esm/modules/approvalMethod/AccessRequestFormFields.js.map +1 -0
  110. package/dist/esm/modules/approvalMethod/ApprovalMethodForm.d.ts +14 -0
  111. package/dist/esm/modules/approvalMethod/ApprovalMethodForm.js +227 -0
  112. package/dist/esm/modules/approvalMethod/ApprovalMethodForm.js.map +1 -0
  113. package/dist/esm/modules/approvalMethod/ApprovalMethodSelector.d.ts +7 -0
  114. package/dist/esm/modules/approvalMethod/ApprovalMethodSelector.js +124 -0
  115. package/dist/esm/modules/approvalMethod/ApprovalMethodSelector.js.map +1 -0
  116. package/dist/esm/modules/approvalMethod/api/ApiQueryMagazineApprovalMethod.d.ts +381 -0
  117. package/dist/esm/modules/approvalMethod/api/ApiQueryMagazineApprovalMethod.js +26 -0
  118. package/dist/esm/modules/approvalMethod/api/ApiQueryMagazineApprovalMethod.js.map +1 -0
  119. package/dist/esm/modules/auth/AuthContext.d.ts +38 -0
  120. package/dist/esm/modules/auth/AuthContext.js +88 -0
  121. package/dist/esm/modules/auth/AuthContext.js.map +1 -0
  122. package/dist/esm/modules/auth/AuthModalContext.d.ts +19 -0
  123. package/dist/esm/modules/auth/AuthModalContext.js +33 -0
  124. package/dist/esm/modules/auth/AuthModalContext.js.map +1 -0
  125. package/dist/esm/modules/auth/ProtectedContent.d.ts +19 -0
  126. package/dist/esm/modules/auth/authClient.d.ts +704 -0
  127. package/dist/esm/modules/auth/authClient.js +8 -0
  128. package/dist/esm/modules/auth/authClient.js.map +1 -0
  129. package/dist/esm/modules/auth/authUtils.d.ts +6 -0
  130. package/dist/esm/modules/auth/authUtils.js +25 -0
  131. package/dist/esm/modules/auth/authUtils.js.map +1 -0
  132. package/dist/esm/modules/auth/index.d.ts +5 -0
  133. package/dist/esm/modules/auth/ui/LoginModal.d.ts +6 -0
  134. package/dist/esm/modules/auth/ui/LoginModal.js +22 -0
  135. package/dist/esm/modules/auth/ui/LoginModal.js.map +1 -0
  136. package/dist/esm/modules/auth/ui/LoginPage.d.ts +5 -0
  137. package/dist/esm/modules/auth/ui/LoginPage.js +50 -0
  138. package/dist/esm/modules/auth/ui/LoginPage.js.map +1 -0
  139. package/dist/esm/modules/auth/useAuthActions.d.ts +17 -0
  140. package/dist/esm/modules/auth/useAuthActions.js +62 -0
  141. package/dist/esm/modules/auth/useAuthActions.js.map +1 -0
  142. package/dist/esm/modules/config/GlobalConfigContext.d.ts +14 -0
  143. package/dist/esm/modules/config/GlobalConfigContext.js +21 -0
  144. package/dist/esm/modules/config/GlobalConfigContext.js.map +1 -0
  145. package/dist/esm/modules/config/HealthStateContext.d.ts +16 -0
  146. package/dist/esm/modules/gallery/Gallery.d.ts +12 -0
  147. package/dist/esm/modules/gallery/Gallery.js +246 -0
  148. package/dist/esm/modules/gallery/Gallery.js.map +1 -0
  149. package/dist/esm/modules/icons/IconManagementPage.d.ts +1 -0
  150. package/dist/esm/modules/icons/IconManagementPage.js +177 -0
  151. package/dist/esm/modules/icons/IconManagementPage.js.map +1 -0
  152. package/dist/esm/modules/pluginCore/PluginManagerContext.d.ts +19 -0
  153. package/dist/esm/modules/pluginCore/PluginManagerContext.js +29 -0
  154. package/dist/esm/modules/pluginCore/PluginManagerContext.js.map +1 -0
  155. package/dist/esm/modules/pluginCore/makePluginManagerContext.d.ts +4 -0
  156. package/dist/esm/modules/pluginCore/makePluginManagerContext.js +9 -0
  157. package/dist/esm/modules/pluginCore/makePluginManagerContext.js.map +1 -0
  158. package/dist/esm/modules/pluginCore/types.d.ts +24 -0
  159. package/dist/esm/node_modules/.pnpm/@dnd-kit_accessibility@3.1.1_react@19.1.2/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +60 -0
  160. package/dist/esm/node_modules/.pnpm/@dnd-kit_accessibility@3.1.1_react@19.1.2/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +1 -0
  161. package/dist/esm/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.1.2_react@19.1.2__react@19.1.2/node_modules/@dnd-kit/core/dist/core.esm.js +3055 -0
  162. package/dist/esm/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.1.2_react@19.1.2__react@19.1.2/node_modules/@dnd-kit/core/dist/core.esm.js.map +1 -0
  163. package/dist/esm/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.1.2_react@19.1.2__react@19.1.2__react@19.1.2/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +593 -0
  164. package/dist/esm/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.1.2_react@19.1.2__react@19.1.2__react@19.1.2/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -0
  165. package/dist/esm/node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@19.1.2/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +302 -0
  166. package/dist/esm/node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@19.1.2/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +1 -0
  167. package/dist/esm/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.71.1_react@19.1.2_/node_modules/@hookform/resolvers/dist/resolvers.js +34 -0
  168. package/dist/esm/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.71.1_react@19.1.2_/node_modules/@hookform/resolvers/dist/resolvers.js.map +1 -0
  169. package/dist/esm/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.71.1_react@19.1.2_/node_modules/@hookform/resolvers/zod/dist/zod.js +94 -0
  170. package/dist/esm/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.71.1_react@19.1.2_/node_modules/@hookform/resolvers/zod/dist/zod.js.map +1 -0
  171. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/TanStackRouterDevtools.js +72 -0
  172. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/TanStackRouterDevtools.js.map +1 -0
  173. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/TanStackRouterDevtoolsPanel.js +44 -0
  174. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/TanStackRouterDevtoolsPanel.js.map +1 -0
  175. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/index.js +12 -0
  176. package/dist/esm/node_modules/.pnpm/@tanstack_react-router-devtools@1.151.6_@tanstack_react-router@1.151.6_react-dom@19.1.2_20b78d099e847743bc64b4d051c71d30/node_modules/@tanstack/react-router-devtools/dist/esm/index.js.map +1 -0
  177. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.js +95 -0
  178. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.js.map +1 -0
  179. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/path.js +107 -0
  180. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/path.js.map +1 -0
  181. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/root.js +5 -0
  182. package/dist/esm/node_modules/.pnpm/@tanstack_router-core@1.151.6/node_modules/@tanstack/router-core/dist/esm/root.js.map +1 -0
  183. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/BaseTanStackRouterDevtoolsPanel-DxaCaP75.js +1963 -0
  184. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/BaseTanStackRouterDevtoolsPanel-DxaCaP75.js.map +1 -0
  185. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/FloatingTanStackRouterDevtools-CaypUmOS.js +284 -0
  186. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/FloatingTanStackRouterDevtools-CaypUmOS.js.map +1 -0
  187. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/index-5jfj03XJ.js +1855 -0
  188. package/dist/esm/node_modules/.pnpm/@tanstack_router-devtools-core@1.151.6_@tanstack_router-core@1.151.6_csstype@3.2.3/node_modules/@tanstack/router-devtools-core/dist/index-5jfj03XJ.js.map +1 -0
  189. package/dist/esm/node_modules/.pnpm/goober@2.1.18_csstype@3.2.3/node_modules/goober/dist/goober.modern.js +56 -0
  190. package/dist/esm/node_modules/.pnpm/goober@2.1.18_csstype@3.2.3/node_modules/goober/dist/goober.modern.js.map +1 -0
  191. package/dist/esm/node_modules/.pnpm/react-hook-form@7.71.1_react@19.1.2/node_modules/react-hook-form/dist/index.esm.js +1894 -0
  192. package/dist/esm/node_modules/.pnpm/react-hook-form@7.71.1_react@19.1.2/node_modules/react-hook-form/dist/index.esm.js.map +1 -0
  193. package/dist/esm/node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +17 -0
  194. package/dist/esm/node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +1 -0
  195. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/errors.js +45 -0
  196. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/errors.js.map +1 -0
  197. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/iso.js +44 -0
  198. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/iso.js.map +1 -0
  199. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/parse.js +30 -0
  200. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/parse.js.map +1 -0
  201. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js +632 -0
  202. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js.map +1 -0
  203. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js +500 -0
  204. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js.map +1 -0
  205. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/checks.js +244 -0
  206. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/checks.js.map +1 -0
  207. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js +75 -0
  208. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js.map +1 -0
  209. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/doc.js +38 -0
  210. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/doc.js.map +1 -0
  211. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js +73 -0
  212. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js.map +1 -0
  213. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/json-schema-processors.js +274 -0
  214. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
  215. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js +100 -0
  216. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js.map +1 -0
  217. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js +80 -0
  218. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js.map +1 -0
  219. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/registries.js +52 -0
  220. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/registries.js.map +1 -0
  221. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js +1247 -0
  222. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js.map +1 -0
  223. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/to-json-schema.js +363 -0
  224. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  225. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js +407 -0
  226. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js.map +1 -0
  227. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js +9 -0
  228. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js.map +1 -0
  229. package/dist/esm/plugins/builtin/pageUrl/pageUrlTypes.d.ts +11 -0
  230. package/dist/esm/routeTree.gen.d.ts +263 -0
  231. package/dist/esm/routeTree.gen.js +117 -0
  232. package/dist/esm/routeTree.gen.js.map +1 -0
  233. package/dist/esm/routes/__root.d.ts +2 -0
  234. package/dist/esm/routes/__root.js +22 -0
  235. package/dist/esm/routes/__root.js.map +1 -0
  236. package/dist/esm/routes/_layout/catalog.apps.index.d.ts +5 -0
  237. package/dist/esm/routes/_layout/catalog.apps.index.js +25 -0
  238. package/dist/esm/routes/_layout/catalog.apps.index.js.map +1 -0
  239. package/dist/esm/routes/_layout/index.d.ts +7 -0
  240. package/dist/esm/routes/_layout/index.js +28 -0
  241. package/dist/esm/routes/_layout/index.js.map +1 -0
  242. package/dist/esm/routes/_layout/login.d.ts +1 -0
  243. package/dist/esm/routes/_layout/login.js +16 -0
  244. package/dist/esm/routes/_layout/login.js.map +1 -0
  245. package/dist/esm/routes/_layout.d.ts +1 -0
  246. package/dist/esm/routes/_layout.js +12 -0
  247. package/dist/esm/routes/_layout.js.map +1 -0
  248. package/dist/esm/routes/admin/app-for-catalog/$id.d.ts +5 -0
  249. package/dist/esm/routes/admin/app-for-catalog/_id.js +67 -0
  250. package/dist/esm/routes/admin/app-for-catalog/_id.js.map +1 -0
  251. package/dist/esm/routes/admin/app-for-catalog/_id2.js +321 -0
  252. package/dist/esm/routes/admin/app-for-catalog/_id2.js.map +1 -0
  253. package/dist/esm/routes/admin/app-for-catalog/index.d.ts +1 -0
  254. package/dist/esm/routes/admin/app-for-catalog/index.js +9 -0
  255. package/dist/esm/routes/admin/app-for-catalog/index.js.map +1 -0
  256. package/dist/esm/routes/admin/app-for-catalog/index2.js +12 -0
  257. package/dist/esm/routes/admin/app-for-catalog/index2.js.map +1 -0
  258. package/dist/esm/routes/admin/app-for-catalog.d.ts +1 -0
  259. package/dist/esm/routes/admin/app-for-catalog.js +14 -0
  260. package/dist/esm/routes/admin/app-for-catalog.js.map +1 -0
  261. package/dist/esm/routes/admin/app-for-catalog2.js +9 -0
  262. package/dist/esm/routes/admin/app-for-catalog2.js.map +1 -0
  263. package/dist/esm/routes/admin/approval-methods/index.d.ts +32 -0
  264. package/dist/esm/routes/admin/approval-methods/index.js +24 -0
  265. package/dist/esm/routes/admin/approval-methods/index.js.map +1 -0
  266. package/dist/esm/routes/admin/approval-methods/index2.js +100 -0
  267. package/dist/esm/routes/admin/approval-methods/index2.js.map +1 -0
  268. package/dist/esm/routes/admin/approval-methods.d.ts +1 -0
  269. package/dist/esm/routes/admin/approval-methods.js +14 -0
  270. package/dist/esm/routes/admin/approval-methods.js.map +1 -0
  271. package/dist/esm/routes/admin/approval-methods2.js +7 -0
  272. package/dist/esm/routes/admin/approval-methods2.js.map +1 -0
  273. package/dist/esm/routes/admin/chat.d.ts +1 -0
  274. package/dist/esm/routes/admin/chat.js +14 -0
  275. package/dist/esm/routes/admin/chat.js.map +1 -0
  276. package/dist/esm/routes/admin/chat2.js +9 -0
  277. package/dist/esm/routes/admin/chat2.js.map +1 -0
  278. package/dist/esm/routes/admin/icons.d.ts +1 -0
  279. package/dist/esm/routes/admin/icons.js +14 -0
  280. package/dist/esm/routes/admin/icons.js.map +1 -0
  281. package/dist/esm/routes/admin/icons2.js +12 -0
  282. package/dist/esm/routes/admin/icons2.js.map +1 -0
  283. package/dist/esm/routes/admin/index.d.ts +1 -0
  284. package/dist/esm/routes/admin/index.js +9 -0
  285. package/dist/esm/routes/admin/index.js.map +1 -0
  286. package/dist/esm/routes/admin/index2.js +9 -0
  287. package/dist/esm/routes/admin/index2.js.map +1 -0
  288. package/dist/esm/routes/admin.d.ts +1 -0
  289. package/dist/esm/routes/admin.js +37 -0
  290. package/dist/esm/routes/admin.js.map +1 -0
  291. package/dist/esm/routes/admin2.js +18 -0
  292. package/dist/esm/routes/admin2.js.map +1 -0
  293. package/dist/esm/routes/auth.callback.d.ts +4 -0
  294. package/dist/esm/routes/auth.callback.js +56 -0
  295. package/dist/esm/routes/auth.callback.js.map +1 -0
  296. package/dist/esm/types/slateTypes.d.ts +28 -0
  297. package/dist/esm/types/table.d.ts +7 -0
  298. package/dist/esm/types/tanstackQuery.d.ts +13 -0
  299. package/dist/esm/types/types.d.ts +25 -0
  300. package/dist/esm/types/userBehaviourTypes.d.ts +76 -0
  301. package/dist/esm/types/utilityTypes.d.ts +1 -0
  302. package/dist/esm/ui/accordion.d.ts +7 -0
  303. package/dist/esm/ui/accordion.js +65 -0
  304. package/dist/esm/ui/accordion.js.map +1 -0
  305. package/dist/esm/ui/alert-dialog.d.ts +14 -0
  306. package/dist/esm/ui/alert-dialog.js +141 -0
  307. package/dist/esm/ui/alert-dialog.js.map +1 -0
  308. package/dist/esm/ui/autocomplete.d.ts +29 -0
  309. package/dist/esm/ui/badge.d.ts +9 -0
  310. package/dist/esm/ui/badge.js +27 -0
  311. package/dist/esm/ui/badge.js.map +1 -0
  312. package/dist/esm/ui/breadcrumb.d.ts +11 -0
  313. package/dist/esm/ui/breadcrumb.js +84 -0
  314. package/dist/esm/ui/breadcrumb.js.map +1 -0
  315. package/dist/esm/ui/button-group.d.ts +11 -0
  316. package/dist/esm/ui/button.d.ts +13 -0
  317. package/dist/esm/ui/button.js +53 -0
  318. package/dist/esm/ui/button.js.map +1 -0
  319. package/dist/esm/ui/card.d.ts +9 -0
  320. package/dist/esm/ui/card.js +66 -0
  321. package/dist/esm/ui/card.js.map +1 -0
  322. package/dist/esm/ui/checkbox.d.ts +4 -0
  323. package/dist/esm/ui/collapsible.d.ts +5 -0
  324. package/dist/esm/ui/command.d.ts +20 -0
  325. package/dist/esm/ui/command.js +131 -0
  326. package/dist/esm/ui/command.js.map +1 -0
  327. package/dist/esm/ui/components/ActionCard.d.ts +9 -0
  328. package/dist/esm/ui/components/AppIcon.d.ts +7 -0
  329. package/dist/esm/ui/components/Breadcrumbs.d.ts +19 -0
  330. package/dist/esm/ui/components/Breadcrumbs.js +36 -0
  331. package/dist/esm/ui/components/Breadcrumbs.js.map +1 -0
  332. package/dist/esm/ui/components/commandInput/EhBaseSelector.d.ts +2 -0
  333. package/dist/esm/ui/components/commandInput/types.d.ts +13 -0
  334. package/dist/esm/ui/components/error/BaseErrorPage.d.ts +10 -0
  335. package/dist/esm/ui/components/error/BaseErrorPage.js +16 -0
  336. package/dist/esm/ui/components/error/BaseErrorPage.js.map +1 -0
  337. package/dist/esm/ui/components/error/DefaultErrorComponent.d.ts +3 -0
  338. package/dist/esm/ui/components/error/DefaultErrorComponent.js +73 -0
  339. package/dist/esm/ui/components/error/DefaultErrorComponent.js.map +1 -0
  340. package/dist/esm/ui/components/error/ForbiddenErrorPage.d.ts +5 -0
  341. package/dist/esm/ui/components/error/ForbiddenErrorPage.js +54 -0
  342. package/dist/esm/ui/components/error/ForbiddenErrorPage.js.map +1 -0
  343. package/dist/esm/ui/components/error/RootErrorPage.d.ts +5 -0
  344. package/dist/esm/ui/components/error/RootErrorPage.js +15 -0
  345. package/dist/esm/ui/components/error/RootErrorPage.js.map +1 -0
  346. package/dist/esm/ui/components/footer/Footer.d.ts +1 -0
  347. package/dist/esm/ui/components/header/Header.d.ts +5 -0
  348. package/dist/esm/ui/components/header/Header.js +103 -0
  349. package/dist/esm/ui/components/header/Header.js.map +1 -0
  350. package/dist/esm/ui/components/widgetPanel/AddWidgetCard.d.ts +5 -0
  351. package/dist/esm/ui/components/widgetPanel/WidgetGrid.d.ts +6 -0
  352. package/dist/esm/ui/components/widgets/CredentialsWidget.d.ts +11 -0
  353. package/dist/esm/ui/components/widgets/VersionWidget.d.ts +7 -0
  354. package/dist/esm/ui/crud-list/CrudList.d.ts +2 -0
  355. package/dist/esm/ui/crud-list/CrudList.js +189 -0
  356. package/dist/esm/ui/crud-list/CrudList.js.map +1 -0
  357. package/dist/esm/ui/crud-list/index.d.ts +2 -0
  358. package/dist/esm/ui/crud-list/types.d.ts +35 -0
  359. package/dist/esm/ui/dialog.d.ts +15 -0
  360. package/dist/esm/ui/dialog.js +111 -0
  361. package/dist/esm/ui/dialog.js.map +1 -0
  362. package/dist/esm/ui/dropdown-menu.d.ts +25 -0
  363. package/dist/esm/ui/dropdown-menu.js +79 -0
  364. package/dist/esm/ui/dropdown-menu.js.map +1 -0
  365. package/dist/esm/ui/editable-list/EditableListField.d.ts +2 -0
  366. package/dist/esm/ui/editable-list/EditableListField.js +130 -0
  367. package/dist/esm/ui/editable-list/EditableListField.js.map +1 -0
  368. package/dist/esm/ui/editable-list/index.d.ts +2 -0
  369. package/dist/esm/ui/editable-list/types.d.ts +17 -0
  370. package/dist/esm/ui/empty.d.ts +11 -0
  371. package/dist/esm/ui/empty.js +103 -0
  372. package/dist/esm/ui/empty.js.map +1 -0
  373. package/dist/esm/ui/error/NotFoundError.d.ts +1 -0
  374. package/dist/esm/ui/error/NotFoundError.js +17 -0
  375. package/dist/esm/ui/error/NotFoundError.js.map +1 -0
  376. package/dist/esm/ui/form.d.ts +56 -0
  377. package/dist/esm/ui/form.js +134 -0
  378. package/dist/esm/ui/form.js.map +1 -0
  379. package/dist/esm/ui/input-group.d.ts +16 -0
  380. package/dist/esm/ui/input.d.ts +3 -0
  381. package/dist/esm/ui/input.js +22 -0
  382. package/dist/esm/ui/input.js.map +1 -0
  383. package/dist/esm/ui/item.d.ts +23 -0
  384. package/dist/esm/ui/label.d.ts +4 -0
  385. package/dist/esm/ui/label.js +23 -0
  386. package/dist/esm/ui/label.js.map +1 -0
  387. package/dist/esm/ui/layout/Footer.d.ts +1 -0
  388. package/dist/esm/ui/layout/LoadingScreen.d.ts +6 -0
  389. package/dist/esm/ui/layout/LoadingScreen.js +54 -0
  390. package/dist/esm/ui/layout/LoadingScreen.js.map +1 -0
  391. package/dist/esm/ui/layout/MainLayout.d.ts +7 -0
  392. package/dist/esm/ui/layout/MainLayout.js +17 -0
  393. package/dist/esm/ui/layout/MainLayout.js.map +1 -0
  394. package/dist/esm/ui/layout/SideColumn.d.ts +1 -0
  395. package/dist/esm/ui/layout/TopLevelProviders.d.ts +10 -0
  396. package/dist/esm/ui/layout/TopLevelProviders.js +46 -0
  397. package/dist/esm/ui/layout/TopLevelProviders.js.map +1 -0
  398. package/dist/esm/ui/layout/TopLevelProvidersForErrors.d.ts +10 -0
  399. package/dist/esm/ui/layout/TopLevelProvidersForErrors.js +24 -0
  400. package/dist/esm/ui/layout/TopLevelProvidersForErrors.js.map +1 -0
  401. package/dist/esm/ui/link.d.ts +13 -0
  402. package/dist/esm/ui/link.js +28 -0
  403. package/dist/esm/ui/link.js.map +1 -0
  404. package/dist/esm/ui/linkExternal.d.ts +8 -0
  405. package/dist/esm/ui/linkExternal.js +26 -0
  406. package/dist/esm/ui/linkExternal.js.map +1 -0
  407. package/dist/esm/ui/main/JumpTabContent.d.ts +1 -0
  408. package/dist/esm/ui/main/Tabs.d.ts +4 -0
  409. package/dist/esm/ui/markdown-editor/MarkdownEditor.d.ts +9 -0
  410. package/dist/esm/ui/markdown-editor/MarkdownEditor.js +116 -0
  411. package/dist/esm/ui/markdown-editor/MarkdownEditor.js.map +1 -0
  412. package/dist/esm/ui/markdown-editor/MarkdownToolbar.d.ts +6 -0
  413. package/dist/esm/ui/markdown-editor/MarkdownToolbar.js +99 -0
  414. package/dist/esm/ui/markdown-editor/MarkdownToolbar.js.map +1 -0
  415. package/dist/esm/ui/markdown-editor/index.d.ts +2 -0
  416. package/dist/esm/ui/popover.d.ts +7 -0
  417. package/dist/esm/ui/popover.js +40 -0
  418. package/dist/esm/ui/popover.js.map +1 -0
  419. package/dist/esm/ui/radio-group.d.ts +5 -0
  420. package/dist/esm/ui/resizable.d.ts +7 -0
  421. package/dist/esm/ui/resizable.js +47 -0
  422. package/dist/esm/ui/resizable.js.map +1 -0
  423. package/dist/esm/ui/scroll-area.d.ts +5 -0
  424. package/dist/esm/ui/scroll-area.js +62 -0
  425. package/dist/esm/ui/scroll-area.js.map +1 -0
  426. package/dist/esm/ui/search-input-with-shortcut.d.ts +25 -0
  427. package/dist/esm/ui/select.d.ts +15 -0
  428. package/dist/esm/ui/select.js +138 -0
  429. package/dist/esm/ui/select.js.map +1 -0
  430. package/dist/esm/ui/separator.d.ts +4 -0
  431. package/dist/esm/ui/shortcut-button.d.ts +24 -0
  432. package/dist/esm/ui/skeleton.d.ts +2 -0
  433. package/dist/esm/ui/skeleton.js +16 -0
  434. package/dist/esm/ui/skeleton.js.map +1 -0
  435. package/dist/esm/ui/spinner.d.ts +2 -0
  436. package/dist/esm/ui/spinner.js +18 -0
  437. package/dist/esm/ui/spinner.js.map +1 -0
  438. package/dist/esm/ui/table.d.ts +10 -0
  439. package/dist/esm/ui/table.js +87 -0
  440. package/dist/esm/ui/table.js.map +1 -0
  441. package/dist/esm/ui/tabs.d.ts +7 -0
  442. package/dist/esm/ui/textarea.d.ts +3 -0
  443. package/dist/esm/ui/textarea.js +19 -0
  444. package/dist/esm/ui/textarea.js.map +1 -0
  445. package/dist/esm/ui/tooltip.d.ts +7 -0
  446. package/dist/esm/userDb/AcDb.d.ts +14 -0
  447. package/dist/esm/userDb/AcDb.js +28 -0
  448. package/dist/esm/userDb/AcDb.js.map +1 -0
  449. package/dist/esm/userDb/DbContext.d.ts +9 -0
  450. package/dist/esm/userDb/DbContext.js +18 -0
  451. package/dist/esm/userDb/DbContext.js.map +1 -0
  452. package/dist/esm/util/createEhRouter.d.ts +7 -0
  453. package/dist/esm/util/createEhRouter.js +19 -0
  454. package/dist/esm/util/createEhRouter.js.map +1 -0
  455. package/dist/esm/util/error-utils.d.ts +6 -0
  456. package/dist/esm/util/error-utils.js +28 -0
  457. package/dist/esm/util/error-utils.js.map +1 -0
  458. package/dist/esm/util/highlightMatches.d.ts +2 -0
  459. package/dist/esm/util/reactQueryUtils.d.ts +10 -0
  460. package/dist/esm/util/reactQueryUtils.js +17 -0
  461. package/dist/esm/util/reactQueryUtils.js.map +1 -0
  462. package/dist/esm/util/slug-utils.d.ts +12 -0
  463. package/dist/index.css +225 -0
  464. package/dist/public/app-catalog-16x16.png +0 -0
  465. package/dist/public/app-catalog-192x192.png +0 -0
  466. package/dist/public/app-catalog-32x32.png +0 -0
  467. package/dist/public/app-catalog-48x48.png +0 -0
  468. package/dist/public/app-catalog-512x512.png +0 -0
  469. package/dist/public/app-catalog-square.svg +160 -0
  470. package/dist/public/app-catalog.png +0 -0
  471. package/dist/public/app-catalog.svg +198 -0
  472. package/dist/public/apple-touch-180x180.png +0 -0
  473. package/dist/public/favicon-app-catalog.ico +0 -0
  474. package/dist/public/favicon.ico +0 -0
  475. package/dist/public/robots.txt +2 -0
  476. package/package.json +159 -0
  477. package/public/app-catalog-16x16.png +0 -0
  478. package/public/app-catalog-192x192.png +0 -0
  479. package/public/app-catalog-32x32.png +0 -0
  480. package/public/app-catalog-48x48.png +0 -0
  481. package/public/app-catalog-512x512.png +0 -0
  482. package/public/app-catalog-square.svg +160 -0
  483. package/public/app-catalog.png +0 -0
  484. package/public/app-catalog.svg +198 -0
  485. package/public/apple-touch-180x180.png +0 -0
  486. package/public/favicon-app-catalog.ico +0 -0
  487. package/public/favicon.ico +0 -0
  488. package/public/robots.txt +2 -0
  489. package/src/App.tsx +28 -0
  490. package/src/__tests__/setupTests.tsx +0 -0
  491. package/src/api/infra/createQueryClient.ts +29 -0
  492. package/src/api/infra/trpc.ts +6 -0
  493. package/src/api/unsorted/appCatalogFetcher.ts +32 -0
  494. package/src/api/unsorted/createCachingFetcher.ts +159 -0
  495. package/src/appPropsFactory.ts +37 -0
  496. package/src/assets/app-catalog.svg +198 -0
  497. package/src/components/IconPickerDialog.tsx +136 -0
  498. package/src/components/IconPickerField.tsx +88 -0
  499. package/src/components/ThemeSwitcher.tsx +22 -0
  500. package/src/components/theme-provider.tsx +8 -0
  501. package/src/errors/AuthorizationError.ts +32 -0
  502. package/src/errors/index.ts +1 -0
  503. package/src/index.css +225 -0
  504. package/src/index.tsx +3 -0
  505. package/src/lib/utils.ts +7 -0
  506. package/src/main.tsx +57 -0
  507. package/src/modules/admin-base/components/AdminChat.tsx +122 -0
  508. package/src/modules/admin-base/components/AdminLayout.tsx +111 -0
  509. package/src/modules/admin-base/components/AdminWelcome.tsx +52 -0
  510. package/src/modules/admin-base/context/AdminConfigContext.tsx +36 -0
  511. package/src/modules/admin-base/index.ts +16 -0
  512. package/src/modules/admin-base/types/adminTypes.ts +11 -0
  513. package/src/modules/appCatalog/AppCatalogAdminPage.tsx +274 -0
  514. package/src/modules/appCatalog/ScreenshotItem.tsx +59 -0
  515. package/src/modules/appCatalog/ScreenshotManager.tsx +193 -0
  516. package/src/modules/appCatalog/api/ApiQueryMagazineAppCatalog.ts +12 -0
  517. package/src/modules/appCatalog/catalogRouteLoader.ts +28 -0
  518. package/src/modules/appCatalog/context/AppCatalogContext.tsx +52 -0
  519. package/src/modules/appCatalog/index.ts +16 -0
  520. package/src/modules/appCatalog/routeLoader.ts +9 -0
  521. package/src/modules/appCatalog/ui/components/AccessRequestSection.tsx +370 -0
  522. package/src/modules/appCatalog/ui/components/AppDetailModal.tsx +355 -0
  523. package/src/modules/appCatalog/ui/components/ApproverDisplay.tsx +260 -0
  524. package/src/modules/appCatalog/ui/components/GroupingColumn.tsx +65 -0
  525. package/src/modules/appCatalog/ui/components/GroupingTabs.tsx +41 -0
  526. package/src/modules/appCatalog/ui/components/ScreenshotGallery.tsx +51 -0
  527. package/src/modules/appCatalog/ui/grid/AppCatalogFiltersCard.tsx +79 -0
  528. package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +487 -0
  529. package/src/modules/appCatalog/ui/grid/AppCatalogTable.tsx +89 -0
  530. package/src/modules/appCatalog/ui/grid/appCatalogUtils.ts +5 -0
  531. package/src/modules/appCatalog/ui/hooks/useKeyboardNavigation.ts +54 -0
  532. package/src/modules/appCatalog/ui/layout/AppCatalogLayout.tsx +57 -0
  533. package/src/modules/appCatalog/ui/pages/AppCatalogPage.tsx +142 -0
  534. package/src/modules/approvalMethod/AccessRequestFormFields.tsx +393 -0
  535. package/src/modules/approvalMethod/ApprovalMethodForm.tsx +323 -0
  536. package/src/modules/approvalMethod/ApprovalMethodSelector.tsx +150 -0
  537. package/src/modules/approvalMethod/api/ApiQueryMagazineApprovalMethod.ts +34 -0
  538. package/src/modules/auth/AuthContext.tsx +130 -0
  539. package/src/modules/auth/AuthModalContext.tsx +49 -0
  540. package/src/modules/auth/ProtectedContent.tsx +55 -0
  541. package/src/modules/auth/authClient.ts +9 -0
  542. package/src/modules/auth/authUtils.ts +41 -0
  543. package/src/modules/auth/index.ts +6 -0
  544. package/src/modules/auth/ui/LoginModal.tsx +36 -0
  545. package/src/modules/auth/ui/LoginPage.tsx +62 -0
  546. package/src/modules/auth/useAuthActions.ts +85 -0
  547. package/src/modules/config/GlobalConfigContext.tsx +42 -0
  548. package/src/modules/config/HealthStateContext.tsx +47 -0
  549. package/src/modules/gallery/Gallery.tsx +317 -0
  550. package/src/modules/icons/IconManagementPage.tsx +245 -0
  551. package/src/modules/pluginCore/PluginManagerContext.tsx +78 -0
  552. package/src/modules/pluginCore/makePluginManagerContext.ts +13 -0
  553. package/src/modules/pluginCore/types.ts +27 -0
  554. package/src/plugins/builtin/pageUrl/pageUrlTypes.ts +16 -0
  555. package/src/routeTree.gen.ts +361 -0
  556. package/src/routes/__root.tsx +23 -0
  557. package/src/routes/_layout/catalog.apps.index.tsx +28 -0
  558. package/src/routes/_layout/index.tsx +31 -0
  559. package/src/routes/_layout/login.tsx +20 -0
  560. package/src/routes/_layout.tsx +9 -0
  561. package/src/routes/admin/app-for-catalog/$id.tsx +571 -0
  562. package/src/routes/admin/app-for-catalog/index.tsx +19 -0
  563. package/src/routes/admin/app-for-catalog.tsx +12 -0
  564. package/src/routes/admin/approval-methods/index.tsx +161 -0
  565. package/src/routes/admin/approval-methods.tsx +10 -0
  566. package/src/routes/admin/chat.tsx +13 -0
  567. package/src/routes/admin/icons.tsx +22 -0
  568. package/src/routes/admin/index.tsx +9 -0
  569. package/src/routes/admin.tsx +60 -0
  570. package/src/routes/auth.callback.tsx +74 -0
  571. package/src/types/slateTypes.ts +22 -0
  572. package/src/types/table.ts +9 -0
  573. package/src/types/tanstackQuery.ts +16 -0
  574. package/src/types/types.ts +30 -0
  575. package/src/types/userBehaviourTypes.ts +100 -0
  576. package/src/types/utilityTypes.ts +1 -0
  577. package/src/types/vite-env.d.ts +2 -0
  578. package/src/ui/accordion.tsx +64 -0
  579. package/src/ui/alert-dialog.tsx +155 -0
  580. package/src/ui/autocomplete.tsx +272 -0
  581. package/src/ui/badge.tsx +38 -0
  582. package/src/ui/breadcrumb.tsx +106 -0
  583. package/src/ui/button-group.tsx +85 -0
  584. package/src/ui/button.tsx +66 -0
  585. package/src/ui/card.tsx +92 -0
  586. package/src/ui/checkbox.tsx +30 -0
  587. package/src/ui/collapsible.tsx +45 -0
  588. package/src/ui/command.tsx +196 -0
  589. package/src/ui/components/ActionCard.tsx +30 -0
  590. package/src/ui/components/AppIcon.tsx +48 -0
  591. package/src/ui/components/Breadcrumbs.tsx +97 -0
  592. package/src/ui/components/commandInput/EhBaseSelector.tsx +17 -0
  593. package/src/ui/components/commandInput/types.ts +22 -0
  594. package/src/ui/components/error/BaseErrorPage.tsx +26 -0
  595. package/src/ui/components/error/DefaultErrorComponent.tsx +107 -0
  596. package/src/ui/components/error/ForbiddenErrorPage.tsx +89 -0
  597. package/src/ui/components/error/RootErrorPage.tsx +23 -0
  598. package/src/ui/components/footer/Footer.tsx +51 -0
  599. package/src/ui/components/header/Header.tsx +135 -0
  600. package/src/ui/components/widgetPanel/AddWidgetCard.tsx +17 -0
  601. package/src/ui/components/widgetPanel/WidgetGrid.tsx +18 -0
  602. package/src/ui/components/widgets/CredentialsWidget.tsx +55 -0
  603. package/src/ui/components/widgets/VersionWidget.tsx +29 -0
  604. package/src/ui/crud-list/CrudList.tsx +274 -0
  605. package/src/ui/crud-list/index.ts +2 -0
  606. package/src/ui/crud-list/types.ts +44 -0
  607. package/src/ui/dialog.tsx +141 -0
  608. package/src/ui/dropdown-menu.tsx +255 -0
  609. package/src/ui/editable-list/EditableListField.tsx +188 -0
  610. package/src/ui/editable-list/index.ts +2 -0
  611. package/src/ui/editable-list/types.ts +18 -0
  612. package/src/ui/empty.tsx +105 -0
  613. package/src/ui/error/NotFoundError.tsx +16 -0
  614. package/src/ui/form.tsx +188 -0
  615. package/src/ui/input-group.tsx +167 -0
  616. package/src/ui/input.tsx +21 -0
  617. package/src/ui/item.tsx +194 -0
  618. package/src/ui/label.tsx +22 -0
  619. package/src/ui/layout/Footer.tsx +16 -0
  620. package/src/ui/layout/LoadingScreen.tsx +67 -0
  621. package/src/ui/layout/MainLayout.tsx +28 -0
  622. package/src/ui/layout/SideColumn.tsx +3 -0
  623. package/src/ui/layout/TopLevelProviders.tsx +63 -0
  624. package/src/ui/layout/TopLevelProvidersForErrors.tsx +34 -0
  625. package/src/ui/link.tsx +33 -0
  626. package/src/ui/linkExternal.tsx +26 -0
  627. package/src/ui/main/JumpTabContent.tsx +12 -0
  628. package/src/ui/main/Tabs.tsx +29 -0
  629. package/src/ui/markdown-editor/MarkdownEditor.tsx +132 -0
  630. package/src/ui/markdown-editor/MarkdownToolbar.tsx +90 -0
  631. package/src/ui/markdown-editor/index.ts +2 -0
  632. package/src/ui/popover.tsx +48 -0
  633. package/src/ui/radio-group.tsx +43 -0
  634. package/src/ui/resizable.tsx +51 -0
  635. package/src/ui/scroll-area.tsx +58 -0
  636. package/src/ui/search-input-with-shortcut.tsx +54 -0
  637. package/src/ui/select.tsx +185 -0
  638. package/src/ui/separator.tsx +26 -0
  639. package/src/ui/shortcut-button.tsx +84 -0
  640. package/src/ui/skeleton.tsx +13 -0
  641. package/src/ui/spinner.tsx +16 -0
  642. package/src/ui/table.tsx +114 -0
  643. package/src/ui/tabs.tsx +64 -0
  644. package/src/ui/textarea.tsx +18 -0
  645. package/src/ui/tooltip.tsx +60 -0
  646. package/src/userDb/AcDb.ts +29 -0
  647. package/src/userDb/DbContext.tsx +22 -0
  648. package/src/util/createEhRouter.tsx +22 -0
  649. package/src/util/error-utils.ts +31 -0
  650. package/src/util/highlightMatches.tsx +29 -0
  651. package/src/util/reactQueryUtils.ts +20 -0
  652. package/src/util/slug-utils.ts +17 -0
@@ -0,0 +1,3055 @@
1
+ import React__default, { memo, useMemo, useReducer, useState, useRef, useCallback, useEffect, createContext, useContext } from "react";
2
+ import { unstable_batchedUpdates, createPortal } from "react-dom";
3
+ import { useLatestValue, useUniqueId, getEventCoordinates, getWindow, add, useIsomorphicLayoutEffect, getOwnerDocument, isKeyboardEvent, subtract, useLazyMemo, isHTMLElement, useNodeRef, canUseDOM, useInterval, usePrevious, findFirstFocusableNode, useEvent, isWindow, isNode, isDocument, isSVGElement } from "../../../../../@dnd-kit_utilities@3.2.2_react@19.1.2/node_modules/@dnd-kit/utilities/dist/utilities.esm.js";
4
+ import { useAnnouncement, HiddenText, LiveRegion } from "../../../../../@dnd-kit_accessibility@3.1.1_react@19.1.2/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js";
5
+ const DndMonitorContext = /* @__PURE__ */ createContext(null);
6
+ function useDndMonitor(listener) {
7
+ const registerListener = useContext(DndMonitorContext);
8
+ useEffect(() => {
9
+ if (!registerListener) {
10
+ throw new Error("useDndMonitor must be used within a children of <DndContext>");
11
+ }
12
+ const unsubscribe = registerListener(listener);
13
+ return unsubscribe;
14
+ }, [listener, registerListener]);
15
+ }
16
+ function useDndMonitorProvider() {
17
+ const [listeners] = useState(() => /* @__PURE__ */ new Set());
18
+ const registerListener = useCallback((listener) => {
19
+ listeners.add(listener);
20
+ return () => listeners.delete(listener);
21
+ }, [listeners]);
22
+ const dispatch = useCallback((_ref) => {
23
+ let {
24
+ type,
25
+ event
26
+ } = _ref;
27
+ listeners.forEach((listener) => {
28
+ var _listener$type;
29
+ return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
30
+ });
31
+ }, [listeners]);
32
+ return [dispatch, registerListener];
33
+ }
34
+ const defaultScreenReaderInstructions = {
35
+ draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "
36
+ };
37
+ const defaultAnnouncements = {
38
+ onDragStart(_ref) {
39
+ let {
40
+ active
41
+ } = _ref;
42
+ return "Picked up draggable item " + active.id + ".";
43
+ },
44
+ onDragOver(_ref2) {
45
+ let {
46
+ active,
47
+ over
48
+ } = _ref2;
49
+ if (over) {
50
+ return "Draggable item " + active.id + " was moved over droppable area " + over.id + ".";
51
+ }
52
+ return "Draggable item " + active.id + " is no longer over a droppable area.";
53
+ },
54
+ onDragEnd(_ref3) {
55
+ let {
56
+ active,
57
+ over
58
+ } = _ref3;
59
+ if (over) {
60
+ return "Draggable item " + active.id + " was dropped over droppable area " + over.id;
61
+ }
62
+ return "Draggable item " + active.id + " was dropped.";
63
+ },
64
+ onDragCancel(_ref4) {
65
+ let {
66
+ active
67
+ } = _ref4;
68
+ return "Dragging was cancelled. Draggable item " + active.id + " was dropped.";
69
+ }
70
+ };
71
+ function Accessibility(_ref) {
72
+ let {
73
+ announcements = defaultAnnouncements,
74
+ container,
75
+ hiddenTextDescribedById,
76
+ screenReaderInstructions = defaultScreenReaderInstructions
77
+ } = _ref;
78
+ const {
79
+ announce,
80
+ announcement
81
+ } = useAnnouncement();
82
+ const liveRegionId = useUniqueId("DndLiveRegion");
83
+ const [mounted, setMounted] = useState(false);
84
+ useEffect(() => {
85
+ setMounted(true);
86
+ }, []);
87
+ useDndMonitor(useMemo(() => ({
88
+ onDragStart(_ref2) {
89
+ let {
90
+ active
91
+ } = _ref2;
92
+ announce(announcements.onDragStart({
93
+ active
94
+ }));
95
+ },
96
+ onDragMove(_ref3) {
97
+ let {
98
+ active,
99
+ over
100
+ } = _ref3;
101
+ if (announcements.onDragMove) {
102
+ announce(announcements.onDragMove({
103
+ active,
104
+ over
105
+ }));
106
+ }
107
+ },
108
+ onDragOver(_ref4) {
109
+ let {
110
+ active,
111
+ over
112
+ } = _ref4;
113
+ announce(announcements.onDragOver({
114
+ active,
115
+ over
116
+ }));
117
+ },
118
+ onDragEnd(_ref5) {
119
+ let {
120
+ active,
121
+ over
122
+ } = _ref5;
123
+ announce(announcements.onDragEnd({
124
+ active,
125
+ over
126
+ }));
127
+ },
128
+ onDragCancel(_ref6) {
129
+ let {
130
+ active,
131
+ over
132
+ } = _ref6;
133
+ announce(announcements.onDragCancel({
134
+ active,
135
+ over
136
+ }));
137
+ }
138
+ }), [announce, announcements]));
139
+ if (!mounted) {
140
+ return null;
141
+ }
142
+ const markup = React__default.createElement(React__default.Fragment, null, React__default.createElement(HiddenText, {
143
+ id: hiddenTextDescribedById,
144
+ value: screenReaderInstructions.draggable
145
+ }), React__default.createElement(LiveRegion, {
146
+ id: liveRegionId,
147
+ announcement
148
+ }));
149
+ return container ? createPortal(markup, container) : markup;
150
+ }
151
+ var Action;
152
+ (function(Action2) {
153
+ Action2["DragStart"] = "dragStart";
154
+ Action2["DragMove"] = "dragMove";
155
+ Action2["DragEnd"] = "dragEnd";
156
+ Action2["DragCancel"] = "dragCancel";
157
+ Action2["DragOver"] = "dragOver";
158
+ Action2["RegisterDroppable"] = "registerDroppable";
159
+ Action2["SetDroppableDisabled"] = "setDroppableDisabled";
160
+ Action2["UnregisterDroppable"] = "unregisterDroppable";
161
+ })(Action || (Action = {}));
162
+ function noop() {
163
+ }
164
+ function useSensor(sensor, options) {
165
+ return useMemo(
166
+ () => ({
167
+ sensor,
168
+ options: options != null ? options : {}
169
+ }),
170
+ // eslint-disable-next-line react-hooks/exhaustive-deps
171
+ [sensor, options]
172
+ );
173
+ }
174
+ function useSensors() {
175
+ for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
176
+ sensors[_key] = arguments[_key];
177
+ }
178
+ return useMemo(
179
+ () => [...sensors].filter((sensor) => sensor != null),
180
+ // eslint-disable-next-line react-hooks/exhaustive-deps
181
+ [...sensors]
182
+ );
183
+ }
184
+ const defaultCoordinates = /* @__PURE__ */ Object.freeze({
185
+ x: 0,
186
+ y: 0
187
+ });
188
+ function distanceBetween(p1, p2) {
189
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
190
+ }
191
+ function sortCollisionsAsc(_ref, _ref2) {
192
+ let {
193
+ data: {
194
+ value: a
195
+ }
196
+ } = _ref;
197
+ let {
198
+ data: {
199
+ value: b
200
+ }
201
+ } = _ref2;
202
+ return a - b;
203
+ }
204
+ function sortCollisionsDesc(_ref3, _ref4) {
205
+ let {
206
+ data: {
207
+ value: a
208
+ }
209
+ } = _ref3;
210
+ let {
211
+ data: {
212
+ value: b
213
+ }
214
+ } = _ref4;
215
+ return b - a;
216
+ }
217
+ function cornersOfRectangle(_ref5) {
218
+ let {
219
+ left,
220
+ top,
221
+ height,
222
+ width
223
+ } = _ref5;
224
+ return [{
225
+ x: left,
226
+ y: top
227
+ }, {
228
+ x: left + width,
229
+ y: top
230
+ }, {
231
+ x: left,
232
+ y: top + height
233
+ }, {
234
+ x: left + width,
235
+ y: top + height
236
+ }];
237
+ }
238
+ function getFirstCollision(collisions, property) {
239
+ if (!collisions || collisions.length === 0) {
240
+ return null;
241
+ }
242
+ const [firstCollision] = collisions;
243
+ return firstCollision[property];
244
+ }
245
+ const closestCorners = (_ref) => {
246
+ let {
247
+ collisionRect,
248
+ droppableRects,
249
+ droppableContainers
250
+ } = _ref;
251
+ const corners = cornersOfRectangle(collisionRect);
252
+ const collisions = [];
253
+ for (const droppableContainer of droppableContainers) {
254
+ const {
255
+ id
256
+ } = droppableContainer;
257
+ const rect = droppableRects.get(id);
258
+ if (rect) {
259
+ const rectCorners = cornersOfRectangle(rect);
260
+ const distances = corners.reduce((accumulator, corner, index) => {
261
+ return accumulator + distanceBetween(rectCorners[index], corner);
262
+ }, 0);
263
+ const effectiveDistance = Number((distances / 4).toFixed(4));
264
+ collisions.push({
265
+ id,
266
+ data: {
267
+ droppableContainer,
268
+ value: effectiveDistance
269
+ }
270
+ });
271
+ }
272
+ }
273
+ return collisions.sort(sortCollisionsAsc);
274
+ };
275
+ function getIntersectionRatio(entry, target) {
276
+ const top = Math.max(target.top, entry.top);
277
+ const left = Math.max(target.left, entry.left);
278
+ const right = Math.min(target.left + target.width, entry.left + entry.width);
279
+ const bottom = Math.min(target.top + target.height, entry.top + entry.height);
280
+ const width = right - left;
281
+ const height = bottom - top;
282
+ if (left < right && top < bottom) {
283
+ const targetArea = target.width * target.height;
284
+ const entryArea = entry.width * entry.height;
285
+ const intersectionArea = width * height;
286
+ const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
287
+ return Number(intersectionRatio.toFixed(4));
288
+ }
289
+ return 0;
290
+ }
291
+ const rectIntersection = (_ref) => {
292
+ let {
293
+ collisionRect,
294
+ droppableRects,
295
+ droppableContainers
296
+ } = _ref;
297
+ const collisions = [];
298
+ for (const droppableContainer of droppableContainers) {
299
+ const {
300
+ id
301
+ } = droppableContainer;
302
+ const rect = droppableRects.get(id);
303
+ if (rect) {
304
+ const intersectionRatio = getIntersectionRatio(rect, collisionRect);
305
+ if (intersectionRatio > 0) {
306
+ collisions.push({
307
+ id,
308
+ data: {
309
+ droppableContainer,
310
+ value: intersectionRatio
311
+ }
312
+ });
313
+ }
314
+ }
315
+ }
316
+ return collisions.sort(sortCollisionsDesc);
317
+ };
318
+ function adjustScale(transform, rect1, rect2) {
319
+ return {
320
+ ...transform,
321
+ scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
322
+ scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
323
+ };
324
+ }
325
+ function getRectDelta(rect1, rect2) {
326
+ return rect1 && rect2 ? {
327
+ x: rect1.left - rect2.left,
328
+ y: rect1.top - rect2.top
329
+ } : defaultCoordinates;
330
+ }
331
+ function createRectAdjustmentFn(modifier) {
332
+ return function adjustClientRect(rect) {
333
+ for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
334
+ adjustments[_key - 1] = arguments[_key];
335
+ }
336
+ return adjustments.reduce((acc, adjustment) => ({
337
+ ...acc,
338
+ top: acc.top + modifier * adjustment.y,
339
+ bottom: acc.bottom + modifier * adjustment.y,
340
+ left: acc.left + modifier * adjustment.x,
341
+ right: acc.right + modifier * adjustment.x
342
+ }), {
343
+ ...rect
344
+ });
345
+ };
346
+ }
347
+ const getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
348
+ function parseTransform(transform) {
349
+ if (transform.startsWith("matrix3d(")) {
350
+ const transformArray = transform.slice(9, -1).split(/, /);
351
+ return {
352
+ x: +transformArray[12],
353
+ y: +transformArray[13],
354
+ scaleX: +transformArray[0],
355
+ scaleY: +transformArray[5]
356
+ };
357
+ } else if (transform.startsWith("matrix(")) {
358
+ const transformArray = transform.slice(7, -1).split(/, /);
359
+ return {
360
+ x: +transformArray[4],
361
+ y: +transformArray[5],
362
+ scaleX: +transformArray[0],
363
+ scaleY: +transformArray[3]
364
+ };
365
+ }
366
+ return null;
367
+ }
368
+ function inverseTransform(rect, transform, transformOrigin) {
369
+ const parsedTransform = parseTransform(transform);
370
+ if (!parsedTransform) {
371
+ return rect;
372
+ }
373
+ const {
374
+ scaleX,
375
+ scaleY,
376
+ x: translateX,
377
+ y: translateY
378
+ } = parsedTransform;
379
+ const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
380
+ const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
381
+ const w = scaleX ? rect.width / scaleX : rect.width;
382
+ const h = scaleY ? rect.height / scaleY : rect.height;
383
+ return {
384
+ width: w,
385
+ height: h,
386
+ top: y,
387
+ right: x + w,
388
+ bottom: y + h,
389
+ left: x
390
+ };
391
+ }
392
+ const defaultOptions = {
393
+ ignoreTransform: false
394
+ };
395
+ function getClientRect(element, options) {
396
+ if (options === void 0) {
397
+ options = defaultOptions;
398
+ }
399
+ let rect = element.getBoundingClientRect();
400
+ if (options.ignoreTransform) {
401
+ const {
402
+ transform,
403
+ transformOrigin
404
+ } = getWindow(element).getComputedStyle(element);
405
+ if (transform) {
406
+ rect = inverseTransform(rect, transform, transformOrigin);
407
+ }
408
+ }
409
+ const {
410
+ top,
411
+ left,
412
+ width,
413
+ height,
414
+ bottom,
415
+ right
416
+ } = rect;
417
+ return {
418
+ top,
419
+ left,
420
+ width,
421
+ height,
422
+ bottom,
423
+ right
424
+ };
425
+ }
426
+ function getTransformAgnosticClientRect(element) {
427
+ return getClientRect(element, {
428
+ ignoreTransform: true
429
+ });
430
+ }
431
+ function getWindowClientRect(element) {
432
+ const width = element.innerWidth;
433
+ const height = element.innerHeight;
434
+ return {
435
+ top: 0,
436
+ left: 0,
437
+ right: width,
438
+ bottom: height,
439
+ width,
440
+ height
441
+ };
442
+ }
443
+ function isFixed(node, computedStyle) {
444
+ if (computedStyle === void 0) {
445
+ computedStyle = getWindow(node).getComputedStyle(node);
446
+ }
447
+ return computedStyle.position === "fixed";
448
+ }
449
+ function isScrollable(element, computedStyle) {
450
+ if (computedStyle === void 0) {
451
+ computedStyle = getWindow(element).getComputedStyle(element);
452
+ }
453
+ const overflowRegex = /(auto|scroll|overlay)/;
454
+ const properties2 = ["overflow", "overflowX", "overflowY"];
455
+ return properties2.some((property) => {
456
+ const value = computedStyle[property];
457
+ return typeof value === "string" ? overflowRegex.test(value) : false;
458
+ });
459
+ }
460
+ function getScrollableAncestors(element, limit) {
461
+ const scrollParents = [];
462
+ function findScrollableAncestors(node) {
463
+ if (limit != null && scrollParents.length >= limit) {
464
+ return scrollParents;
465
+ }
466
+ if (!node) {
467
+ return scrollParents;
468
+ }
469
+ if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
470
+ scrollParents.push(node.scrollingElement);
471
+ return scrollParents;
472
+ }
473
+ if (!isHTMLElement(node) || isSVGElement(node)) {
474
+ return scrollParents;
475
+ }
476
+ if (scrollParents.includes(node)) {
477
+ return scrollParents;
478
+ }
479
+ const computedStyle = getWindow(element).getComputedStyle(node);
480
+ if (node !== element) {
481
+ if (isScrollable(node, computedStyle)) {
482
+ scrollParents.push(node);
483
+ }
484
+ }
485
+ if (isFixed(node, computedStyle)) {
486
+ return scrollParents;
487
+ }
488
+ return findScrollableAncestors(node.parentNode);
489
+ }
490
+ if (!element) {
491
+ return scrollParents;
492
+ }
493
+ return findScrollableAncestors(element);
494
+ }
495
+ function getFirstScrollableAncestor(node) {
496
+ const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
497
+ return firstScrollableAncestor != null ? firstScrollableAncestor : null;
498
+ }
499
+ function getScrollableElement(element) {
500
+ if (!canUseDOM || !element) {
501
+ return null;
502
+ }
503
+ if (isWindow(element)) {
504
+ return element;
505
+ }
506
+ if (!isNode(element)) {
507
+ return null;
508
+ }
509
+ if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
510
+ return window;
511
+ }
512
+ if (isHTMLElement(element)) {
513
+ return element;
514
+ }
515
+ return null;
516
+ }
517
+ function getScrollXCoordinate(element) {
518
+ if (isWindow(element)) {
519
+ return element.scrollX;
520
+ }
521
+ return element.scrollLeft;
522
+ }
523
+ function getScrollYCoordinate(element) {
524
+ if (isWindow(element)) {
525
+ return element.scrollY;
526
+ }
527
+ return element.scrollTop;
528
+ }
529
+ function getScrollCoordinates(element) {
530
+ return {
531
+ x: getScrollXCoordinate(element),
532
+ y: getScrollYCoordinate(element)
533
+ };
534
+ }
535
+ var Direction;
536
+ (function(Direction2) {
537
+ Direction2[Direction2["Forward"] = 1] = "Forward";
538
+ Direction2[Direction2["Backward"] = -1] = "Backward";
539
+ })(Direction || (Direction = {}));
540
+ function isDocumentScrollingElement(element) {
541
+ if (!canUseDOM || !element) {
542
+ return false;
543
+ }
544
+ return element === document.scrollingElement;
545
+ }
546
+ function getScrollPosition(scrollingContainer) {
547
+ const minScroll = {
548
+ x: 0,
549
+ y: 0
550
+ };
551
+ const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
552
+ height: window.innerHeight,
553
+ width: window.innerWidth
554
+ } : {
555
+ height: scrollingContainer.clientHeight,
556
+ width: scrollingContainer.clientWidth
557
+ };
558
+ const maxScroll = {
559
+ x: scrollingContainer.scrollWidth - dimensions.width,
560
+ y: scrollingContainer.scrollHeight - dimensions.height
561
+ };
562
+ const isTop = scrollingContainer.scrollTop <= minScroll.y;
563
+ const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
564
+ const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
565
+ const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
566
+ return {
567
+ isTop,
568
+ isLeft,
569
+ isBottom,
570
+ isRight,
571
+ maxScroll,
572
+ minScroll
573
+ };
574
+ }
575
+ const defaultThreshold = {
576
+ x: 0.2,
577
+ y: 0.2
578
+ };
579
+ function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
580
+ let {
581
+ top,
582
+ left,
583
+ right,
584
+ bottom
585
+ } = _ref;
586
+ if (acceleration === void 0) {
587
+ acceleration = 10;
588
+ }
589
+ if (thresholdPercentage === void 0) {
590
+ thresholdPercentage = defaultThreshold;
591
+ }
592
+ const {
593
+ isTop,
594
+ isBottom,
595
+ isLeft,
596
+ isRight
597
+ } = getScrollPosition(scrollContainer);
598
+ const direction = {
599
+ x: 0,
600
+ y: 0
601
+ };
602
+ const speed = {
603
+ x: 0,
604
+ y: 0
605
+ };
606
+ const threshold = {
607
+ height: scrollContainerRect.height * thresholdPercentage.y,
608
+ width: scrollContainerRect.width * thresholdPercentage.x
609
+ };
610
+ if (!isTop && top <= scrollContainerRect.top + threshold.height) {
611
+ direction.y = Direction.Backward;
612
+ speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);
613
+ } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {
614
+ direction.y = Direction.Forward;
615
+ speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);
616
+ }
617
+ if (!isRight && right >= scrollContainerRect.right - threshold.width) {
618
+ direction.x = Direction.Forward;
619
+ speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
620
+ } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {
621
+ direction.x = Direction.Backward;
622
+ speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);
623
+ }
624
+ return {
625
+ direction,
626
+ speed
627
+ };
628
+ }
629
+ function getScrollElementRect(element) {
630
+ if (element === document.scrollingElement) {
631
+ const {
632
+ innerWidth,
633
+ innerHeight
634
+ } = window;
635
+ return {
636
+ top: 0,
637
+ left: 0,
638
+ right: innerWidth,
639
+ bottom: innerHeight,
640
+ width: innerWidth,
641
+ height: innerHeight
642
+ };
643
+ }
644
+ const {
645
+ top,
646
+ left,
647
+ right,
648
+ bottom
649
+ } = element.getBoundingClientRect();
650
+ return {
651
+ top,
652
+ left,
653
+ right,
654
+ bottom,
655
+ width: element.clientWidth,
656
+ height: element.clientHeight
657
+ };
658
+ }
659
+ function getScrollOffsets(scrollableAncestors) {
660
+ return scrollableAncestors.reduce((acc, node) => {
661
+ return add(acc, getScrollCoordinates(node));
662
+ }, defaultCoordinates);
663
+ }
664
+ function getScrollXOffset(scrollableAncestors) {
665
+ return scrollableAncestors.reduce((acc, node) => {
666
+ return acc + getScrollXCoordinate(node);
667
+ }, 0);
668
+ }
669
+ function getScrollYOffset(scrollableAncestors) {
670
+ return scrollableAncestors.reduce((acc, node) => {
671
+ return acc + getScrollYCoordinate(node);
672
+ }, 0);
673
+ }
674
+ function scrollIntoViewIfNeeded(element, measure) {
675
+ if (measure === void 0) {
676
+ measure = getClientRect;
677
+ }
678
+ if (!element) {
679
+ return;
680
+ }
681
+ const {
682
+ top,
683
+ left,
684
+ bottom,
685
+ right
686
+ } = measure(element);
687
+ const firstScrollableAncestor = getFirstScrollableAncestor(element);
688
+ if (!firstScrollableAncestor) {
689
+ return;
690
+ }
691
+ if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {
692
+ element.scrollIntoView({
693
+ block: "center",
694
+ inline: "center"
695
+ });
696
+ }
697
+ }
698
+ const properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
699
+ class Rect {
700
+ constructor(rect, element) {
701
+ this.rect = void 0;
702
+ this.width = void 0;
703
+ this.height = void 0;
704
+ this.top = void 0;
705
+ this.bottom = void 0;
706
+ this.right = void 0;
707
+ this.left = void 0;
708
+ const scrollableAncestors = getScrollableAncestors(element);
709
+ const scrollOffsets = getScrollOffsets(scrollableAncestors);
710
+ this.rect = {
711
+ ...rect
712
+ };
713
+ this.width = rect.width;
714
+ this.height = rect.height;
715
+ for (const [axis, keys, getScrollOffset] of properties) {
716
+ for (const key of keys) {
717
+ Object.defineProperty(this, key, {
718
+ get: () => {
719
+ const currentOffsets = getScrollOffset(scrollableAncestors);
720
+ const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
721
+ return this.rect[key] + scrollOffsetsDeltla;
722
+ },
723
+ enumerable: true
724
+ });
725
+ }
726
+ }
727
+ Object.defineProperty(this, "rect", {
728
+ enumerable: false
729
+ });
730
+ }
731
+ }
732
+ class Listeners {
733
+ constructor(target) {
734
+ this.target = void 0;
735
+ this.listeners = [];
736
+ this.removeAll = () => {
737
+ this.listeners.forEach((listener) => {
738
+ var _this$target;
739
+ return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
740
+ });
741
+ };
742
+ this.target = target;
743
+ }
744
+ add(eventName, handler, options) {
745
+ var _this$target2;
746
+ (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
747
+ this.listeners.push([eventName, handler, options]);
748
+ }
749
+ }
750
+ function getEventListenerTarget(target) {
751
+ const {
752
+ EventTarget
753
+ } = getWindow(target);
754
+ return target instanceof EventTarget ? target : getOwnerDocument(target);
755
+ }
756
+ function hasExceededDistance(delta, measurement) {
757
+ const dx = Math.abs(delta.x);
758
+ const dy = Math.abs(delta.y);
759
+ if (typeof measurement === "number") {
760
+ return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
761
+ }
762
+ if ("x" in measurement && "y" in measurement) {
763
+ return dx > measurement.x && dy > measurement.y;
764
+ }
765
+ if ("x" in measurement) {
766
+ return dx > measurement.x;
767
+ }
768
+ if ("y" in measurement) {
769
+ return dy > measurement.y;
770
+ }
771
+ return false;
772
+ }
773
+ var EventName;
774
+ (function(EventName2) {
775
+ EventName2["Click"] = "click";
776
+ EventName2["DragStart"] = "dragstart";
777
+ EventName2["Keydown"] = "keydown";
778
+ EventName2["ContextMenu"] = "contextmenu";
779
+ EventName2["Resize"] = "resize";
780
+ EventName2["SelectionChange"] = "selectionchange";
781
+ EventName2["VisibilityChange"] = "visibilitychange";
782
+ })(EventName || (EventName = {}));
783
+ function preventDefault(event) {
784
+ event.preventDefault();
785
+ }
786
+ function stopPropagation(event) {
787
+ event.stopPropagation();
788
+ }
789
+ var KeyboardCode;
790
+ (function(KeyboardCode2) {
791
+ KeyboardCode2["Space"] = "Space";
792
+ KeyboardCode2["Down"] = "ArrowDown";
793
+ KeyboardCode2["Right"] = "ArrowRight";
794
+ KeyboardCode2["Left"] = "ArrowLeft";
795
+ KeyboardCode2["Up"] = "ArrowUp";
796
+ KeyboardCode2["Esc"] = "Escape";
797
+ KeyboardCode2["Enter"] = "Enter";
798
+ KeyboardCode2["Tab"] = "Tab";
799
+ })(KeyboardCode || (KeyboardCode = {}));
800
+ const defaultKeyboardCodes = {
801
+ start: [KeyboardCode.Space, KeyboardCode.Enter],
802
+ cancel: [KeyboardCode.Esc],
803
+ end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]
804
+ };
805
+ const defaultKeyboardCoordinateGetter = (event, _ref) => {
806
+ let {
807
+ currentCoordinates
808
+ } = _ref;
809
+ switch (event.code) {
810
+ case KeyboardCode.Right:
811
+ return {
812
+ ...currentCoordinates,
813
+ x: currentCoordinates.x + 25
814
+ };
815
+ case KeyboardCode.Left:
816
+ return {
817
+ ...currentCoordinates,
818
+ x: currentCoordinates.x - 25
819
+ };
820
+ case KeyboardCode.Down:
821
+ return {
822
+ ...currentCoordinates,
823
+ y: currentCoordinates.y + 25
824
+ };
825
+ case KeyboardCode.Up:
826
+ return {
827
+ ...currentCoordinates,
828
+ y: currentCoordinates.y - 25
829
+ };
830
+ }
831
+ return void 0;
832
+ };
833
+ class KeyboardSensor {
834
+ constructor(props) {
835
+ this.props = void 0;
836
+ this.autoScrollEnabled = false;
837
+ this.referenceCoordinates = void 0;
838
+ this.listeners = void 0;
839
+ this.windowListeners = void 0;
840
+ this.props = props;
841
+ const {
842
+ event: {
843
+ target
844
+ }
845
+ } = props;
846
+ this.props = props;
847
+ this.listeners = new Listeners(getOwnerDocument(target));
848
+ this.windowListeners = new Listeners(getWindow(target));
849
+ this.handleKeyDown = this.handleKeyDown.bind(this);
850
+ this.handleCancel = this.handleCancel.bind(this);
851
+ this.attach();
852
+ }
853
+ attach() {
854
+ this.handleStart();
855
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
856
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
857
+ setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
858
+ }
859
+ handleStart() {
860
+ const {
861
+ activeNode,
862
+ onStart
863
+ } = this.props;
864
+ const node = activeNode.node.current;
865
+ if (node) {
866
+ scrollIntoViewIfNeeded(node);
867
+ }
868
+ onStart(defaultCoordinates);
869
+ }
870
+ handleKeyDown(event) {
871
+ if (isKeyboardEvent(event)) {
872
+ const {
873
+ active,
874
+ context,
875
+ options
876
+ } = this.props;
877
+ const {
878
+ keyboardCodes = defaultKeyboardCodes,
879
+ coordinateGetter = defaultKeyboardCoordinateGetter,
880
+ scrollBehavior = "smooth"
881
+ } = options;
882
+ const {
883
+ code
884
+ } = event;
885
+ if (keyboardCodes.end.includes(code)) {
886
+ this.handleEnd(event);
887
+ return;
888
+ }
889
+ if (keyboardCodes.cancel.includes(code)) {
890
+ this.handleCancel(event);
891
+ return;
892
+ }
893
+ const {
894
+ collisionRect
895
+ } = context.current;
896
+ const currentCoordinates = collisionRect ? {
897
+ x: collisionRect.left,
898
+ y: collisionRect.top
899
+ } : defaultCoordinates;
900
+ if (!this.referenceCoordinates) {
901
+ this.referenceCoordinates = currentCoordinates;
902
+ }
903
+ const newCoordinates = coordinateGetter(event, {
904
+ active,
905
+ context: context.current,
906
+ currentCoordinates
907
+ });
908
+ if (newCoordinates) {
909
+ const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
910
+ const scrollDelta = {
911
+ x: 0,
912
+ y: 0
913
+ };
914
+ const {
915
+ scrollableAncestors
916
+ } = context.current;
917
+ for (const scrollContainer of scrollableAncestors) {
918
+ const direction = event.code;
919
+ const {
920
+ isTop,
921
+ isRight,
922
+ isLeft,
923
+ isBottom,
924
+ maxScroll,
925
+ minScroll
926
+ } = getScrollPosition(scrollContainer);
927
+ const scrollElementRect = getScrollElementRect(scrollContainer);
928
+ const clampedCoordinates = {
929
+ x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
930
+ y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
931
+ };
932
+ const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
933
+ const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
934
+ if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
935
+ const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
936
+ const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
937
+ if (canScrollToNewCoordinates && !coordinatesDelta.y) {
938
+ scrollContainer.scrollTo({
939
+ left: newScrollCoordinates,
940
+ behavior: scrollBehavior
941
+ });
942
+ return;
943
+ }
944
+ if (canScrollToNewCoordinates) {
945
+ scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
946
+ } else {
947
+ scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
948
+ }
949
+ if (scrollDelta.x) {
950
+ scrollContainer.scrollBy({
951
+ left: -scrollDelta.x,
952
+ behavior: scrollBehavior
953
+ });
954
+ }
955
+ break;
956
+ } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
957
+ const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
958
+ const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
959
+ if (canScrollToNewCoordinates && !coordinatesDelta.x) {
960
+ scrollContainer.scrollTo({
961
+ top: newScrollCoordinates,
962
+ behavior: scrollBehavior
963
+ });
964
+ return;
965
+ }
966
+ if (canScrollToNewCoordinates) {
967
+ scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
968
+ } else {
969
+ scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
970
+ }
971
+ if (scrollDelta.y) {
972
+ scrollContainer.scrollBy({
973
+ top: -scrollDelta.y,
974
+ behavior: scrollBehavior
975
+ });
976
+ }
977
+ break;
978
+ }
979
+ }
980
+ this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
981
+ }
982
+ }
983
+ }
984
+ handleMove(event, coordinates) {
985
+ const {
986
+ onMove
987
+ } = this.props;
988
+ event.preventDefault();
989
+ onMove(coordinates);
990
+ }
991
+ handleEnd(event) {
992
+ const {
993
+ onEnd
994
+ } = this.props;
995
+ event.preventDefault();
996
+ this.detach();
997
+ onEnd();
998
+ }
999
+ handleCancel(event) {
1000
+ const {
1001
+ onCancel
1002
+ } = this.props;
1003
+ event.preventDefault();
1004
+ this.detach();
1005
+ onCancel();
1006
+ }
1007
+ detach() {
1008
+ this.listeners.removeAll();
1009
+ this.windowListeners.removeAll();
1010
+ }
1011
+ }
1012
+ KeyboardSensor.activators = [{
1013
+ eventName: "onKeyDown",
1014
+ handler: (event, _ref, _ref2) => {
1015
+ let {
1016
+ keyboardCodes = defaultKeyboardCodes,
1017
+ onActivation
1018
+ } = _ref;
1019
+ let {
1020
+ active
1021
+ } = _ref2;
1022
+ const {
1023
+ code
1024
+ } = event.nativeEvent;
1025
+ if (keyboardCodes.start.includes(code)) {
1026
+ const activator = active.activatorNode.current;
1027
+ if (activator && event.target !== activator) {
1028
+ return false;
1029
+ }
1030
+ event.preventDefault();
1031
+ onActivation == null ? void 0 : onActivation({
1032
+ event: event.nativeEvent
1033
+ });
1034
+ return true;
1035
+ }
1036
+ return false;
1037
+ }
1038
+ }];
1039
+ function isDistanceConstraint(constraint) {
1040
+ return Boolean(constraint && "distance" in constraint);
1041
+ }
1042
+ function isDelayConstraint(constraint) {
1043
+ return Boolean(constraint && "delay" in constraint);
1044
+ }
1045
+ class AbstractPointerSensor {
1046
+ constructor(props, events2, listenerTarget) {
1047
+ var _getEventCoordinates;
1048
+ if (listenerTarget === void 0) {
1049
+ listenerTarget = getEventListenerTarget(props.event.target);
1050
+ }
1051
+ this.props = void 0;
1052
+ this.events = void 0;
1053
+ this.autoScrollEnabled = true;
1054
+ this.document = void 0;
1055
+ this.activated = false;
1056
+ this.initialCoordinates = void 0;
1057
+ this.timeoutId = null;
1058
+ this.listeners = void 0;
1059
+ this.documentListeners = void 0;
1060
+ this.windowListeners = void 0;
1061
+ this.props = props;
1062
+ this.events = events2;
1063
+ const {
1064
+ event
1065
+ } = props;
1066
+ const {
1067
+ target
1068
+ } = event;
1069
+ this.props = props;
1070
+ this.events = events2;
1071
+ this.document = getOwnerDocument(target);
1072
+ this.documentListeners = new Listeners(this.document);
1073
+ this.listeners = new Listeners(listenerTarget);
1074
+ this.windowListeners = new Listeners(getWindow(target));
1075
+ this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
1076
+ this.handleStart = this.handleStart.bind(this);
1077
+ this.handleMove = this.handleMove.bind(this);
1078
+ this.handleEnd = this.handleEnd.bind(this);
1079
+ this.handleCancel = this.handleCancel.bind(this);
1080
+ this.handleKeydown = this.handleKeydown.bind(this);
1081
+ this.removeTextSelection = this.removeTextSelection.bind(this);
1082
+ this.attach();
1083
+ }
1084
+ attach() {
1085
+ const {
1086
+ events: events2,
1087
+ props: {
1088
+ options: {
1089
+ activationConstraint,
1090
+ bypassActivationConstraint
1091
+ }
1092
+ }
1093
+ } = this;
1094
+ this.listeners.add(events2.move.name, this.handleMove, {
1095
+ passive: false
1096
+ });
1097
+ this.listeners.add(events2.end.name, this.handleEnd);
1098
+ if (events2.cancel) {
1099
+ this.listeners.add(events2.cancel.name, this.handleCancel);
1100
+ }
1101
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
1102
+ this.windowListeners.add(EventName.DragStart, preventDefault);
1103
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
1104
+ this.windowListeners.add(EventName.ContextMenu, preventDefault);
1105
+ this.documentListeners.add(EventName.Keydown, this.handleKeydown);
1106
+ if (activationConstraint) {
1107
+ if (bypassActivationConstraint != null && bypassActivationConstraint({
1108
+ event: this.props.event,
1109
+ activeNode: this.props.activeNode,
1110
+ options: this.props.options
1111
+ })) {
1112
+ return this.handleStart();
1113
+ }
1114
+ if (isDelayConstraint(activationConstraint)) {
1115
+ this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
1116
+ this.handlePending(activationConstraint);
1117
+ return;
1118
+ }
1119
+ if (isDistanceConstraint(activationConstraint)) {
1120
+ this.handlePending(activationConstraint);
1121
+ return;
1122
+ }
1123
+ }
1124
+ this.handleStart();
1125
+ }
1126
+ detach() {
1127
+ this.listeners.removeAll();
1128
+ this.windowListeners.removeAll();
1129
+ setTimeout(this.documentListeners.removeAll, 50);
1130
+ if (this.timeoutId !== null) {
1131
+ clearTimeout(this.timeoutId);
1132
+ this.timeoutId = null;
1133
+ }
1134
+ }
1135
+ handlePending(constraint, offset) {
1136
+ const {
1137
+ active,
1138
+ onPending
1139
+ } = this.props;
1140
+ onPending(active, constraint, this.initialCoordinates, offset);
1141
+ }
1142
+ handleStart() {
1143
+ const {
1144
+ initialCoordinates
1145
+ } = this;
1146
+ const {
1147
+ onStart
1148
+ } = this.props;
1149
+ if (initialCoordinates) {
1150
+ this.activated = true;
1151
+ this.documentListeners.add(EventName.Click, stopPropagation, {
1152
+ capture: true
1153
+ });
1154
+ this.removeTextSelection();
1155
+ this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
1156
+ onStart(initialCoordinates);
1157
+ }
1158
+ }
1159
+ handleMove(event) {
1160
+ var _getEventCoordinates2;
1161
+ const {
1162
+ activated,
1163
+ initialCoordinates,
1164
+ props
1165
+ } = this;
1166
+ const {
1167
+ onMove,
1168
+ options: {
1169
+ activationConstraint
1170
+ }
1171
+ } = props;
1172
+ if (!initialCoordinates) {
1173
+ return;
1174
+ }
1175
+ const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
1176
+ const delta = subtract(initialCoordinates, coordinates);
1177
+ if (!activated && activationConstraint) {
1178
+ if (isDistanceConstraint(activationConstraint)) {
1179
+ if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
1180
+ return this.handleCancel();
1181
+ }
1182
+ if (hasExceededDistance(delta, activationConstraint.distance)) {
1183
+ return this.handleStart();
1184
+ }
1185
+ }
1186
+ if (isDelayConstraint(activationConstraint)) {
1187
+ if (hasExceededDistance(delta, activationConstraint.tolerance)) {
1188
+ return this.handleCancel();
1189
+ }
1190
+ }
1191
+ this.handlePending(activationConstraint, delta);
1192
+ return;
1193
+ }
1194
+ if (event.cancelable) {
1195
+ event.preventDefault();
1196
+ }
1197
+ onMove(coordinates);
1198
+ }
1199
+ handleEnd() {
1200
+ const {
1201
+ onAbort,
1202
+ onEnd
1203
+ } = this.props;
1204
+ this.detach();
1205
+ if (!this.activated) {
1206
+ onAbort(this.props.active);
1207
+ }
1208
+ onEnd();
1209
+ }
1210
+ handleCancel() {
1211
+ const {
1212
+ onAbort,
1213
+ onCancel
1214
+ } = this.props;
1215
+ this.detach();
1216
+ if (!this.activated) {
1217
+ onAbort(this.props.active);
1218
+ }
1219
+ onCancel();
1220
+ }
1221
+ handleKeydown(event) {
1222
+ if (event.code === KeyboardCode.Esc) {
1223
+ this.handleCancel();
1224
+ }
1225
+ }
1226
+ removeTextSelection() {
1227
+ var _this$document$getSel;
1228
+ (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
1229
+ }
1230
+ }
1231
+ const events = {
1232
+ cancel: {
1233
+ name: "pointercancel"
1234
+ },
1235
+ move: {
1236
+ name: "pointermove"
1237
+ },
1238
+ end: {
1239
+ name: "pointerup"
1240
+ }
1241
+ };
1242
+ class PointerSensor extends AbstractPointerSensor {
1243
+ constructor(props) {
1244
+ const {
1245
+ event
1246
+ } = props;
1247
+ const listenerTarget = getOwnerDocument(event.target);
1248
+ super(props, events, listenerTarget);
1249
+ }
1250
+ }
1251
+ PointerSensor.activators = [{
1252
+ eventName: "onPointerDown",
1253
+ handler: (_ref, _ref2) => {
1254
+ let {
1255
+ nativeEvent: event
1256
+ } = _ref;
1257
+ let {
1258
+ onActivation
1259
+ } = _ref2;
1260
+ if (!event.isPrimary || event.button !== 0) {
1261
+ return false;
1262
+ }
1263
+ onActivation == null ? void 0 : onActivation({
1264
+ event
1265
+ });
1266
+ return true;
1267
+ }
1268
+ }];
1269
+ const events$1 = {
1270
+ move: {
1271
+ name: "mousemove"
1272
+ },
1273
+ end: {
1274
+ name: "mouseup"
1275
+ }
1276
+ };
1277
+ var MouseButton;
1278
+ (function(MouseButton2) {
1279
+ MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick";
1280
+ })(MouseButton || (MouseButton = {}));
1281
+ class MouseSensor extends AbstractPointerSensor {
1282
+ constructor(props) {
1283
+ super(props, events$1, getOwnerDocument(props.event.target));
1284
+ }
1285
+ }
1286
+ MouseSensor.activators = [{
1287
+ eventName: "onMouseDown",
1288
+ handler: (_ref, _ref2) => {
1289
+ let {
1290
+ nativeEvent: event
1291
+ } = _ref;
1292
+ let {
1293
+ onActivation
1294
+ } = _ref2;
1295
+ if (event.button === MouseButton.RightClick) {
1296
+ return false;
1297
+ }
1298
+ onActivation == null ? void 0 : onActivation({
1299
+ event
1300
+ });
1301
+ return true;
1302
+ }
1303
+ }];
1304
+ const events$2 = {
1305
+ cancel: {
1306
+ name: "touchcancel"
1307
+ },
1308
+ move: {
1309
+ name: "touchmove"
1310
+ },
1311
+ end: {
1312
+ name: "touchend"
1313
+ }
1314
+ };
1315
+ class TouchSensor extends AbstractPointerSensor {
1316
+ constructor(props) {
1317
+ super(props, events$2);
1318
+ }
1319
+ static setup() {
1320
+ window.addEventListener(events$2.move.name, noop2, {
1321
+ capture: false,
1322
+ passive: false
1323
+ });
1324
+ return function teardown() {
1325
+ window.removeEventListener(events$2.move.name, noop2);
1326
+ };
1327
+ function noop2() {
1328
+ }
1329
+ }
1330
+ }
1331
+ TouchSensor.activators = [{
1332
+ eventName: "onTouchStart",
1333
+ handler: (_ref, _ref2) => {
1334
+ let {
1335
+ nativeEvent: event
1336
+ } = _ref;
1337
+ let {
1338
+ onActivation
1339
+ } = _ref2;
1340
+ const {
1341
+ touches
1342
+ } = event;
1343
+ if (touches.length > 1) {
1344
+ return false;
1345
+ }
1346
+ onActivation == null ? void 0 : onActivation({
1347
+ event
1348
+ });
1349
+ return true;
1350
+ }
1351
+ }];
1352
+ var AutoScrollActivator;
1353
+ (function(AutoScrollActivator2) {
1354
+ AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer";
1355
+ AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect";
1356
+ })(AutoScrollActivator || (AutoScrollActivator = {}));
1357
+ var TraversalOrder;
1358
+ (function(TraversalOrder2) {
1359
+ TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder";
1360
+ TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
1361
+ })(TraversalOrder || (TraversalOrder = {}));
1362
+ function useAutoScroller(_ref) {
1363
+ let {
1364
+ acceleration,
1365
+ activator = AutoScrollActivator.Pointer,
1366
+ canScroll,
1367
+ draggingRect,
1368
+ enabled,
1369
+ interval = 5,
1370
+ order = TraversalOrder.TreeOrder,
1371
+ pointerCoordinates,
1372
+ scrollableAncestors,
1373
+ scrollableAncestorRects,
1374
+ delta,
1375
+ threshold
1376
+ } = _ref;
1377
+ const scrollIntent = useScrollIntent({
1378
+ delta,
1379
+ disabled: !enabled
1380
+ });
1381
+ const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
1382
+ const scrollSpeed = useRef({
1383
+ x: 0,
1384
+ y: 0
1385
+ });
1386
+ const scrollDirection = useRef({
1387
+ x: 0,
1388
+ y: 0
1389
+ });
1390
+ const rect = useMemo(() => {
1391
+ switch (activator) {
1392
+ case AutoScrollActivator.Pointer:
1393
+ return pointerCoordinates ? {
1394
+ top: pointerCoordinates.y,
1395
+ bottom: pointerCoordinates.y,
1396
+ left: pointerCoordinates.x,
1397
+ right: pointerCoordinates.x
1398
+ } : null;
1399
+ case AutoScrollActivator.DraggableRect:
1400
+ return draggingRect;
1401
+ }
1402
+ }, [activator, draggingRect, pointerCoordinates]);
1403
+ const scrollContainerRef = useRef(null);
1404
+ const autoScroll = useCallback(() => {
1405
+ const scrollContainer = scrollContainerRef.current;
1406
+ if (!scrollContainer) {
1407
+ return;
1408
+ }
1409
+ const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
1410
+ const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
1411
+ scrollContainer.scrollBy(scrollLeft, scrollTop);
1412
+ }, []);
1413
+ const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
1414
+ useEffect(
1415
+ () => {
1416
+ if (!enabled || !scrollableAncestors.length || !rect) {
1417
+ clearAutoScrollInterval();
1418
+ return;
1419
+ }
1420
+ for (const scrollContainer of sortedScrollableAncestors) {
1421
+ if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
1422
+ continue;
1423
+ }
1424
+ const index = scrollableAncestors.indexOf(scrollContainer);
1425
+ const scrollContainerRect = scrollableAncestorRects[index];
1426
+ if (!scrollContainerRect) {
1427
+ continue;
1428
+ }
1429
+ const {
1430
+ direction,
1431
+ speed
1432
+ } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
1433
+ for (const axis of ["x", "y"]) {
1434
+ if (!scrollIntent[axis][direction[axis]]) {
1435
+ speed[axis] = 0;
1436
+ direction[axis] = 0;
1437
+ }
1438
+ }
1439
+ if (speed.x > 0 || speed.y > 0) {
1440
+ clearAutoScrollInterval();
1441
+ scrollContainerRef.current = scrollContainer;
1442
+ setAutoScrollInterval(autoScroll, interval);
1443
+ scrollSpeed.current = speed;
1444
+ scrollDirection.current = direction;
1445
+ return;
1446
+ }
1447
+ }
1448
+ scrollSpeed.current = {
1449
+ x: 0,
1450
+ y: 0
1451
+ };
1452
+ scrollDirection.current = {
1453
+ x: 0,
1454
+ y: 0
1455
+ };
1456
+ clearAutoScrollInterval();
1457
+ },
1458
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1459
+ [
1460
+ acceleration,
1461
+ autoScroll,
1462
+ canScroll,
1463
+ clearAutoScrollInterval,
1464
+ enabled,
1465
+ interval,
1466
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1467
+ JSON.stringify(rect),
1468
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1469
+ JSON.stringify(scrollIntent),
1470
+ setAutoScrollInterval,
1471
+ scrollableAncestors,
1472
+ sortedScrollableAncestors,
1473
+ scrollableAncestorRects,
1474
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1475
+ JSON.stringify(threshold)
1476
+ ]
1477
+ );
1478
+ }
1479
+ const defaultScrollIntent = {
1480
+ x: {
1481
+ [Direction.Backward]: false,
1482
+ [Direction.Forward]: false
1483
+ },
1484
+ y: {
1485
+ [Direction.Backward]: false,
1486
+ [Direction.Forward]: false
1487
+ }
1488
+ };
1489
+ function useScrollIntent(_ref2) {
1490
+ let {
1491
+ delta,
1492
+ disabled
1493
+ } = _ref2;
1494
+ const previousDelta = usePrevious(delta);
1495
+ return useLazyMemo((previousIntent) => {
1496
+ if (disabled || !previousDelta || !previousIntent) {
1497
+ return defaultScrollIntent;
1498
+ }
1499
+ const direction = {
1500
+ x: Math.sign(delta.x - previousDelta.x),
1501
+ y: Math.sign(delta.y - previousDelta.y)
1502
+ };
1503
+ return {
1504
+ x: {
1505
+ [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
1506
+ [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
1507
+ },
1508
+ y: {
1509
+ [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
1510
+ [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
1511
+ }
1512
+ };
1513
+ }, [disabled, delta, previousDelta]);
1514
+ }
1515
+ function useCachedNode(draggableNodes, id) {
1516
+ const draggableNode = id != null ? draggableNodes.get(id) : void 0;
1517
+ const node = draggableNode ? draggableNode.node.current : null;
1518
+ return useLazyMemo((cachedNode) => {
1519
+ var _ref;
1520
+ if (id == null) {
1521
+ return null;
1522
+ }
1523
+ return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
1524
+ }, [node, id]);
1525
+ }
1526
+ function useCombineActivators(sensors, getSyntheticHandler) {
1527
+ return useMemo(() => sensors.reduce((accumulator, sensor) => {
1528
+ const {
1529
+ sensor: Sensor
1530
+ } = sensor;
1531
+ const sensorActivators = Sensor.activators.map((activator) => ({
1532
+ eventName: activator.eventName,
1533
+ handler: getSyntheticHandler(activator.handler, sensor)
1534
+ }));
1535
+ return [...accumulator, ...sensorActivators];
1536
+ }, []), [sensors, getSyntheticHandler]);
1537
+ }
1538
+ var MeasuringStrategy;
1539
+ (function(MeasuringStrategy2) {
1540
+ MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always";
1541
+ MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging";
1542
+ MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging";
1543
+ })(MeasuringStrategy || (MeasuringStrategy = {}));
1544
+ var MeasuringFrequency;
1545
+ (function(MeasuringFrequency2) {
1546
+ MeasuringFrequency2["Optimized"] = "optimized";
1547
+ })(MeasuringFrequency || (MeasuringFrequency = {}));
1548
+ const defaultValue = /* @__PURE__ */ new Map();
1549
+ function useDroppableMeasuring(containers, _ref) {
1550
+ let {
1551
+ dragging,
1552
+ dependencies,
1553
+ config
1554
+ } = _ref;
1555
+ const [queue, setQueue] = useState(null);
1556
+ const {
1557
+ frequency,
1558
+ measure,
1559
+ strategy
1560
+ } = config;
1561
+ const containersRef = useRef(containers);
1562
+ const disabled = isDisabled();
1563
+ const disabledRef = useLatestValue(disabled);
1564
+ const measureDroppableContainers = useCallback(function(ids) {
1565
+ if (ids === void 0) {
1566
+ ids = [];
1567
+ }
1568
+ if (disabledRef.current) {
1569
+ return;
1570
+ }
1571
+ setQueue((value) => {
1572
+ if (value === null) {
1573
+ return ids;
1574
+ }
1575
+ return value.concat(ids.filter((id) => !value.includes(id)));
1576
+ });
1577
+ }, [disabledRef]);
1578
+ const timeoutId = useRef(null);
1579
+ const droppableRects = useLazyMemo((previousValue) => {
1580
+ if (disabled && !dragging) {
1581
+ return defaultValue;
1582
+ }
1583
+ if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
1584
+ const map = /* @__PURE__ */ new Map();
1585
+ for (let container of containers) {
1586
+ if (!container) {
1587
+ continue;
1588
+ }
1589
+ if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
1590
+ map.set(container.id, container.rect.current);
1591
+ continue;
1592
+ }
1593
+ const node = container.node.current;
1594
+ const rect = node ? new Rect(measure(node), node) : null;
1595
+ container.rect.current = rect;
1596
+ if (rect) {
1597
+ map.set(container.id, rect);
1598
+ }
1599
+ }
1600
+ return map;
1601
+ }
1602
+ return previousValue;
1603
+ }, [containers, queue, dragging, disabled, measure]);
1604
+ useEffect(() => {
1605
+ containersRef.current = containers;
1606
+ }, [containers]);
1607
+ useEffect(
1608
+ () => {
1609
+ if (disabled) {
1610
+ return;
1611
+ }
1612
+ measureDroppableContainers();
1613
+ },
1614
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1615
+ [dragging, disabled]
1616
+ );
1617
+ useEffect(
1618
+ () => {
1619
+ if (queue && queue.length > 0) {
1620
+ setQueue(null);
1621
+ }
1622
+ },
1623
+ //eslint-disable-next-line react-hooks/exhaustive-deps
1624
+ [JSON.stringify(queue)]
1625
+ );
1626
+ useEffect(
1627
+ () => {
1628
+ if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
1629
+ return;
1630
+ }
1631
+ timeoutId.current = setTimeout(() => {
1632
+ measureDroppableContainers();
1633
+ timeoutId.current = null;
1634
+ }, frequency);
1635
+ },
1636
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1637
+ [frequency, disabled, measureDroppableContainers, ...dependencies]
1638
+ );
1639
+ return {
1640
+ droppableRects,
1641
+ measureDroppableContainers,
1642
+ measuringScheduled: queue != null
1643
+ };
1644
+ function isDisabled() {
1645
+ switch (strategy) {
1646
+ case MeasuringStrategy.Always:
1647
+ return false;
1648
+ case MeasuringStrategy.BeforeDragging:
1649
+ return dragging;
1650
+ default:
1651
+ return !dragging;
1652
+ }
1653
+ }
1654
+ }
1655
+ function useInitialValue(value, computeFn) {
1656
+ return useLazyMemo((previousValue) => {
1657
+ if (!value) {
1658
+ return null;
1659
+ }
1660
+ if (previousValue) {
1661
+ return previousValue;
1662
+ }
1663
+ return typeof computeFn === "function" ? computeFn(value) : value;
1664
+ }, [computeFn, value]);
1665
+ }
1666
+ function useInitialRect(node, measure) {
1667
+ return useInitialValue(node, measure);
1668
+ }
1669
+ function useMutationObserver(_ref) {
1670
+ let {
1671
+ callback,
1672
+ disabled
1673
+ } = _ref;
1674
+ const handleMutations = useEvent(callback);
1675
+ const mutationObserver = useMemo(() => {
1676
+ if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
1677
+ return void 0;
1678
+ }
1679
+ const {
1680
+ MutationObserver
1681
+ } = window;
1682
+ return new MutationObserver(handleMutations);
1683
+ }, [handleMutations, disabled]);
1684
+ useEffect(() => {
1685
+ return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
1686
+ }, [mutationObserver]);
1687
+ return mutationObserver;
1688
+ }
1689
+ function useResizeObserver(_ref) {
1690
+ let {
1691
+ callback,
1692
+ disabled
1693
+ } = _ref;
1694
+ const handleResize = useEvent(callback);
1695
+ const resizeObserver = useMemo(
1696
+ () => {
1697
+ if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
1698
+ return void 0;
1699
+ }
1700
+ const {
1701
+ ResizeObserver
1702
+ } = window;
1703
+ return new ResizeObserver(handleResize);
1704
+ },
1705
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1706
+ [disabled]
1707
+ );
1708
+ useEffect(() => {
1709
+ return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
1710
+ }, [resizeObserver]);
1711
+ return resizeObserver;
1712
+ }
1713
+ function defaultMeasure(element) {
1714
+ return new Rect(getClientRect(element), element);
1715
+ }
1716
+ function useRect(element, measure, fallbackRect) {
1717
+ if (measure === void 0) {
1718
+ measure = defaultMeasure;
1719
+ }
1720
+ const [rect, setRect] = useState(null);
1721
+ function measureRect() {
1722
+ setRect((currentRect) => {
1723
+ if (!element) {
1724
+ return null;
1725
+ }
1726
+ if (element.isConnected === false) {
1727
+ var _ref;
1728
+ return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
1729
+ }
1730
+ const newRect = measure(element);
1731
+ if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
1732
+ return currentRect;
1733
+ }
1734
+ return newRect;
1735
+ });
1736
+ }
1737
+ const mutationObserver = useMutationObserver({
1738
+ callback(records) {
1739
+ if (!element) {
1740
+ return;
1741
+ }
1742
+ for (const record of records) {
1743
+ const {
1744
+ type,
1745
+ target
1746
+ } = record;
1747
+ if (type === "childList" && target instanceof HTMLElement && target.contains(element)) {
1748
+ measureRect();
1749
+ break;
1750
+ }
1751
+ }
1752
+ }
1753
+ });
1754
+ const resizeObserver = useResizeObserver({
1755
+ callback: measureRect
1756
+ });
1757
+ useIsomorphicLayoutEffect(() => {
1758
+ measureRect();
1759
+ if (element) {
1760
+ resizeObserver == null ? void 0 : resizeObserver.observe(element);
1761
+ mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
1762
+ childList: true,
1763
+ subtree: true
1764
+ });
1765
+ } else {
1766
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
1767
+ mutationObserver == null ? void 0 : mutationObserver.disconnect();
1768
+ }
1769
+ }, [element]);
1770
+ return rect;
1771
+ }
1772
+ function useRectDelta(rect) {
1773
+ const initialRect = useInitialValue(rect);
1774
+ return getRectDelta(rect, initialRect);
1775
+ }
1776
+ const defaultValue$1 = [];
1777
+ function useScrollableAncestors(node) {
1778
+ const previousNode = useRef(node);
1779
+ const ancestors = useLazyMemo((previousValue) => {
1780
+ if (!node) {
1781
+ return defaultValue$1;
1782
+ }
1783
+ if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {
1784
+ return previousValue;
1785
+ }
1786
+ return getScrollableAncestors(node);
1787
+ }, [node]);
1788
+ useEffect(() => {
1789
+ previousNode.current = node;
1790
+ }, [node]);
1791
+ return ancestors;
1792
+ }
1793
+ function useScrollOffsets(elements) {
1794
+ const [scrollCoordinates, setScrollCoordinates] = useState(null);
1795
+ const prevElements = useRef(elements);
1796
+ const handleScroll = useCallback((event) => {
1797
+ const scrollingElement = getScrollableElement(event.target);
1798
+ if (!scrollingElement) {
1799
+ return;
1800
+ }
1801
+ setScrollCoordinates((scrollCoordinates2) => {
1802
+ if (!scrollCoordinates2) {
1803
+ return null;
1804
+ }
1805
+ scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement));
1806
+ return new Map(scrollCoordinates2);
1807
+ });
1808
+ }, []);
1809
+ useEffect(() => {
1810
+ const previousElements = prevElements.current;
1811
+ if (elements !== previousElements) {
1812
+ cleanup(previousElements);
1813
+ const entries = elements.map((element) => {
1814
+ const scrollableElement = getScrollableElement(element);
1815
+ if (scrollableElement) {
1816
+ scrollableElement.addEventListener("scroll", handleScroll, {
1817
+ passive: true
1818
+ });
1819
+ return [scrollableElement, getScrollCoordinates(scrollableElement)];
1820
+ }
1821
+ return null;
1822
+ }).filter((entry) => entry != null);
1823
+ setScrollCoordinates(entries.length ? new Map(entries) : null);
1824
+ prevElements.current = elements;
1825
+ }
1826
+ return () => {
1827
+ cleanup(elements);
1828
+ cleanup(previousElements);
1829
+ };
1830
+ function cleanup(elements2) {
1831
+ elements2.forEach((element) => {
1832
+ const scrollableElement = getScrollableElement(element);
1833
+ scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
1834
+ });
1835
+ }
1836
+ }, [handleScroll, elements]);
1837
+ return useMemo(() => {
1838
+ if (elements.length) {
1839
+ return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
1840
+ }
1841
+ return defaultCoordinates;
1842
+ }, [elements, scrollCoordinates]);
1843
+ }
1844
+ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
1845
+ if (dependencies === void 0) {
1846
+ dependencies = [];
1847
+ }
1848
+ const initialScrollOffsets = useRef(null);
1849
+ useEffect(
1850
+ () => {
1851
+ initialScrollOffsets.current = null;
1852
+ },
1853
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1854
+ dependencies
1855
+ );
1856
+ useEffect(() => {
1857
+ const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
1858
+ if (hasScrollOffsets && !initialScrollOffsets.current) {
1859
+ initialScrollOffsets.current = scrollOffsets;
1860
+ }
1861
+ if (!hasScrollOffsets && initialScrollOffsets.current) {
1862
+ initialScrollOffsets.current = null;
1863
+ }
1864
+ }, [scrollOffsets]);
1865
+ return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
1866
+ }
1867
+ function useSensorSetup(sensors) {
1868
+ useEffect(
1869
+ () => {
1870
+ if (!canUseDOM) {
1871
+ return;
1872
+ }
1873
+ const teardownFns = sensors.map((_ref) => {
1874
+ let {
1875
+ sensor
1876
+ } = _ref;
1877
+ return sensor.setup == null ? void 0 : sensor.setup();
1878
+ });
1879
+ return () => {
1880
+ for (const teardown of teardownFns) {
1881
+ teardown == null ? void 0 : teardown();
1882
+ }
1883
+ };
1884
+ },
1885
+ // TO-DO: Sensors length could theoretically change which would not be a valid dependency
1886
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1887
+ sensors.map((_ref2) => {
1888
+ let {
1889
+ sensor
1890
+ } = _ref2;
1891
+ return sensor;
1892
+ })
1893
+ );
1894
+ }
1895
+ function useSyntheticListeners(listeners, id) {
1896
+ return useMemo(() => {
1897
+ return listeners.reduce((acc, _ref) => {
1898
+ let {
1899
+ eventName,
1900
+ handler
1901
+ } = _ref;
1902
+ acc[eventName] = (event) => {
1903
+ handler(event, id);
1904
+ };
1905
+ return acc;
1906
+ }, {});
1907
+ }, [listeners, id]);
1908
+ }
1909
+ function useWindowRect(element) {
1910
+ return useMemo(() => element ? getWindowClientRect(element) : null, [element]);
1911
+ }
1912
+ const defaultValue$2 = [];
1913
+ function useRects(elements, measure) {
1914
+ if (measure === void 0) {
1915
+ measure = getClientRect;
1916
+ }
1917
+ const [firstElement] = elements;
1918
+ const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
1919
+ const [rects, setRects] = useState(defaultValue$2);
1920
+ function measureRects() {
1921
+ setRects(() => {
1922
+ if (!elements.length) {
1923
+ return defaultValue$2;
1924
+ }
1925
+ return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
1926
+ });
1927
+ }
1928
+ const resizeObserver = useResizeObserver({
1929
+ callback: measureRects
1930
+ });
1931
+ useIsomorphicLayoutEffect(() => {
1932
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
1933
+ measureRects();
1934
+ elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
1935
+ }, [elements]);
1936
+ return rects;
1937
+ }
1938
+ function getMeasurableNode(node) {
1939
+ if (!node) {
1940
+ return null;
1941
+ }
1942
+ if (node.children.length > 1) {
1943
+ return node;
1944
+ }
1945
+ const firstChild = node.children[0];
1946
+ return isHTMLElement(firstChild) ? firstChild : node;
1947
+ }
1948
+ function useDragOverlayMeasuring(_ref) {
1949
+ let {
1950
+ measure
1951
+ } = _ref;
1952
+ const [rect, setRect] = useState(null);
1953
+ const handleResize = useCallback((entries) => {
1954
+ for (const {
1955
+ target
1956
+ } of entries) {
1957
+ if (isHTMLElement(target)) {
1958
+ setRect((rect2) => {
1959
+ const newRect = measure(target);
1960
+ return rect2 ? {
1961
+ ...rect2,
1962
+ width: newRect.width,
1963
+ height: newRect.height
1964
+ } : newRect;
1965
+ });
1966
+ break;
1967
+ }
1968
+ }
1969
+ }, [measure]);
1970
+ const resizeObserver = useResizeObserver({
1971
+ callback: handleResize
1972
+ });
1973
+ const handleNodeChange = useCallback((element) => {
1974
+ const node = getMeasurableNode(element);
1975
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
1976
+ if (node) {
1977
+ resizeObserver == null ? void 0 : resizeObserver.observe(node);
1978
+ }
1979
+ setRect(node ? measure(node) : null);
1980
+ }, [measure, resizeObserver]);
1981
+ const [nodeRef, setRef] = useNodeRef(handleNodeChange);
1982
+ return useMemo(() => ({
1983
+ nodeRef,
1984
+ rect,
1985
+ setRef
1986
+ }), [rect, nodeRef, setRef]);
1987
+ }
1988
+ const defaultSensors = [{
1989
+ sensor: PointerSensor,
1990
+ options: {}
1991
+ }, {
1992
+ sensor: KeyboardSensor,
1993
+ options: {}
1994
+ }];
1995
+ const defaultData = {
1996
+ current: {}
1997
+ };
1998
+ const defaultMeasuringConfiguration = {
1999
+ draggable: {
2000
+ measure: getTransformAgnosticClientRect
2001
+ },
2002
+ droppable: {
2003
+ measure: getTransformAgnosticClientRect,
2004
+ strategy: MeasuringStrategy.WhileDragging,
2005
+ frequency: MeasuringFrequency.Optimized
2006
+ },
2007
+ dragOverlay: {
2008
+ measure: getClientRect
2009
+ }
2010
+ };
2011
+ class DroppableContainersMap extends Map {
2012
+ get(id) {
2013
+ var _super$get;
2014
+ return id != null ? (_super$get = super.get(id)) != null ? _super$get : void 0 : void 0;
2015
+ }
2016
+ toArray() {
2017
+ return Array.from(this.values());
2018
+ }
2019
+ getEnabled() {
2020
+ return this.toArray().filter((_ref) => {
2021
+ let {
2022
+ disabled
2023
+ } = _ref;
2024
+ return !disabled;
2025
+ });
2026
+ }
2027
+ getNodeFor(id) {
2028
+ var _this$get$node$curren, _this$get;
2029
+ return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0;
2030
+ }
2031
+ }
2032
+ const defaultPublicContext = {
2033
+ activatorEvent: null,
2034
+ active: null,
2035
+ activeNode: null,
2036
+ activeNodeRect: null,
2037
+ collisions: null,
2038
+ containerNodeRect: null,
2039
+ draggableNodes: /* @__PURE__ */ new Map(),
2040
+ droppableRects: /* @__PURE__ */ new Map(),
2041
+ droppableContainers: /* @__PURE__ */ new DroppableContainersMap(),
2042
+ over: null,
2043
+ dragOverlay: {
2044
+ nodeRef: {
2045
+ current: null
2046
+ },
2047
+ rect: null,
2048
+ setRef: noop
2049
+ },
2050
+ scrollableAncestors: [],
2051
+ scrollableAncestorRects: [],
2052
+ measuringConfiguration: defaultMeasuringConfiguration,
2053
+ measureDroppableContainers: noop,
2054
+ windowRect: null,
2055
+ measuringScheduled: false
2056
+ };
2057
+ const defaultInternalContext = {
2058
+ activatorEvent: null,
2059
+ activators: [],
2060
+ active: null,
2061
+ activeNodeRect: null,
2062
+ ariaDescribedById: {
2063
+ draggable: ""
2064
+ },
2065
+ dispatch: noop,
2066
+ draggableNodes: /* @__PURE__ */ new Map(),
2067
+ over: null,
2068
+ measureDroppableContainers: noop
2069
+ };
2070
+ const InternalContext = /* @__PURE__ */ createContext(defaultInternalContext);
2071
+ const PublicContext = /* @__PURE__ */ createContext(defaultPublicContext);
2072
+ function getInitialState() {
2073
+ return {
2074
+ draggable: {
2075
+ active: null,
2076
+ initialCoordinates: {
2077
+ x: 0,
2078
+ y: 0
2079
+ },
2080
+ nodes: /* @__PURE__ */ new Map(),
2081
+ translate: {
2082
+ x: 0,
2083
+ y: 0
2084
+ }
2085
+ },
2086
+ droppable: {
2087
+ containers: new DroppableContainersMap()
2088
+ }
2089
+ };
2090
+ }
2091
+ function reducer(state, action) {
2092
+ switch (action.type) {
2093
+ case Action.DragStart:
2094
+ return {
2095
+ ...state,
2096
+ draggable: {
2097
+ ...state.draggable,
2098
+ initialCoordinates: action.initialCoordinates,
2099
+ active: action.active
2100
+ }
2101
+ };
2102
+ case Action.DragMove:
2103
+ if (state.draggable.active == null) {
2104
+ return state;
2105
+ }
2106
+ return {
2107
+ ...state,
2108
+ draggable: {
2109
+ ...state.draggable,
2110
+ translate: {
2111
+ x: action.coordinates.x - state.draggable.initialCoordinates.x,
2112
+ y: action.coordinates.y - state.draggable.initialCoordinates.y
2113
+ }
2114
+ }
2115
+ };
2116
+ case Action.DragEnd:
2117
+ case Action.DragCancel:
2118
+ return {
2119
+ ...state,
2120
+ draggable: {
2121
+ ...state.draggable,
2122
+ active: null,
2123
+ initialCoordinates: {
2124
+ x: 0,
2125
+ y: 0
2126
+ },
2127
+ translate: {
2128
+ x: 0,
2129
+ y: 0
2130
+ }
2131
+ }
2132
+ };
2133
+ case Action.RegisterDroppable: {
2134
+ const {
2135
+ element
2136
+ } = action;
2137
+ const {
2138
+ id
2139
+ } = element;
2140
+ const containers = new DroppableContainersMap(state.droppable.containers);
2141
+ containers.set(id, element);
2142
+ return {
2143
+ ...state,
2144
+ droppable: {
2145
+ ...state.droppable,
2146
+ containers
2147
+ }
2148
+ };
2149
+ }
2150
+ case Action.SetDroppableDisabled: {
2151
+ const {
2152
+ id,
2153
+ key,
2154
+ disabled
2155
+ } = action;
2156
+ const element = state.droppable.containers.get(id);
2157
+ if (!element || key !== element.key) {
2158
+ return state;
2159
+ }
2160
+ const containers = new DroppableContainersMap(state.droppable.containers);
2161
+ containers.set(id, {
2162
+ ...element,
2163
+ disabled
2164
+ });
2165
+ return {
2166
+ ...state,
2167
+ droppable: {
2168
+ ...state.droppable,
2169
+ containers
2170
+ }
2171
+ };
2172
+ }
2173
+ case Action.UnregisterDroppable: {
2174
+ const {
2175
+ id,
2176
+ key
2177
+ } = action;
2178
+ const element = state.droppable.containers.get(id);
2179
+ if (!element || key !== element.key) {
2180
+ return state;
2181
+ }
2182
+ const containers = new DroppableContainersMap(state.droppable.containers);
2183
+ containers.delete(id);
2184
+ return {
2185
+ ...state,
2186
+ droppable: {
2187
+ ...state.droppable,
2188
+ containers
2189
+ }
2190
+ };
2191
+ }
2192
+ default: {
2193
+ return state;
2194
+ }
2195
+ }
2196
+ }
2197
+ function RestoreFocus(_ref) {
2198
+ let {
2199
+ disabled
2200
+ } = _ref;
2201
+ const {
2202
+ active,
2203
+ activatorEvent,
2204
+ draggableNodes
2205
+ } = useContext(InternalContext);
2206
+ const previousActivatorEvent = usePrevious(activatorEvent);
2207
+ const previousActiveId = usePrevious(active == null ? void 0 : active.id);
2208
+ useEffect(() => {
2209
+ if (disabled) {
2210
+ return;
2211
+ }
2212
+ if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
2213
+ if (!isKeyboardEvent(previousActivatorEvent)) {
2214
+ return;
2215
+ }
2216
+ if (document.activeElement === previousActivatorEvent.target) {
2217
+ return;
2218
+ }
2219
+ const draggableNode = draggableNodes.get(previousActiveId);
2220
+ if (!draggableNode) {
2221
+ return;
2222
+ }
2223
+ const {
2224
+ activatorNode,
2225
+ node
2226
+ } = draggableNode;
2227
+ if (!activatorNode.current && !node.current) {
2228
+ return;
2229
+ }
2230
+ requestAnimationFrame(() => {
2231
+ for (const element of [activatorNode.current, node.current]) {
2232
+ if (!element) {
2233
+ continue;
2234
+ }
2235
+ const focusableNode = findFirstFocusableNode(element);
2236
+ if (focusableNode) {
2237
+ focusableNode.focus();
2238
+ break;
2239
+ }
2240
+ }
2241
+ });
2242
+ }
2243
+ }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
2244
+ return null;
2245
+ }
2246
+ function applyModifiers(modifiers, _ref) {
2247
+ let {
2248
+ transform,
2249
+ ...args
2250
+ } = _ref;
2251
+ return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
2252
+ return modifier({
2253
+ transform: accumulator,
2254
+ ...args
2255
+ });
2256
+ }, transform) : transform;
2257
+ }
2258
+ function useMeasuringConfiguration(config) {
2259
+ return useMemo(
2260
+ () => ({
2261
+ draggable: {
2262
+ ...defaultMeasuringConfiguration.draggable,
2263
+ ...config == null ? void 0 : config.draggable
2264
+ },
2265
+ droppable: {
2266
+ ...defaultMeasuringConfiguration.droppable,
2267
+ ...config == null ? void 0 : config.droppable
2268
+ },
2269
+ dragOverlay: {
2270
+ ...defaultMeasuringConfiguration.dragOverlay,
2271
+ ...config == null ? void 0 : config.dragOverlay
2272
+ }
2273
+ }),
2274
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2275
+ [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]
2276
+ );
2277
+ }
2278
+ function useLayoutShiftScrollCompensation(_ref) {
2279
+ let {
2280
+ activeNode,
2281
+ measure,
2282
+ initialRect,
2283
+ config = true
2284
+ } = _ref;
2285
+ const initialized = useRef(false);
2286
+ const {
2287
+ x,
2288
+ y
2289
+ } = typeof config === "boolean" ? {
2290
+ x: config,
2291
+ y: config
2292
+ } : config;
2293
+ useIsomorphicLayoutEffect(() => {
2294
+ const disabled = !x && !y;
2295
+ if (disabled || !activeNode) {
2296
+ initialized.current = false;
2297
+ return;
2298
+ }
2299
+ if (initialized.current || !initialRect) {
2300
+ return;
2301
+ }
2302
+ const node = activeNode == null ? void 0 : activeNode.node.current;
2303
+ if (!node || node.isConnected === false) {
2304
+ return;
2305
+ }
2306
+ const rect = measure(node);
2307
+ const rectDelta = getRectDelta(rect, initialRect);
2308
+ if (!x) {
2309
+ rectDelta.x = 0;
2310
+ }
2311
+ if (!y) {
2312
+ rectDelta.y = 0;
2313
+ }
2314
+ initialized.current = true;
2315
+ if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
2316
+ const firstScrollableAncestor = getFirstScrollableAncestor(node);
2317
+ if (firstScrollableAncestor) {
2318
+ firstScrollableAncestor.scrollBy({
2319
+ top: rectDelta.y,
2320
+ left: rectDelta.x
2321
+ });
2322
+ }
2323
+ }
2324
+ }, [activeNode, x, y, initialRect, measure]);
2325
+ }
2326
+ const ActiveDraggableContext = /* @__PURE__ */ createContext({
2327
+ ...defaultCoordinates,
2328
+ scaleX: 1,
2329
+ scaleY: 1
2330
+ });
2331
+ var Status;
2332
+ (function(Status2) {
2333
+ Status2[Status2["Uninitialized"] = 0] = "Uninitialized";
2334
+ Status2[Status2["Initializing"] = 1] = "Initializing";
2335
+ Status2[Status2["Initialized"] = 2] = "Initialized";
2336
+ })(Status || (Status = {}));
2337
+ const DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
2338
+ var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
2339
+ let {
2340
+ id,
2341
+ accessibility,
2342
+ autoScroll = true,
2343
+ children,
2344
+ sensors = defaultSensors,
2345
+ collisionDetection = rectIntersection,
2346
+ measuring,
2347
+ modifiers,
2348
+ ...props
2349
+ } = _ref;
2350
+ const store = useReducer(reducer, void 0, getInitialState);
2351
+ const [state, dispatch] = store;
2352
+ const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
2353
+ const [status, setStatus] = useState(Status.Uninitialized);
2354
+ const isInitialized = status === Status.Initialized;
2355
+ const {
2356
+ draggable: {
2357
+ active: activeId,
2358
+ nodes: draggableNodes,
2359
+ translate
2360
+ },
2361
+ droppable: {
2362
+ containers: droppableContainers
2363
+ }
2364
+ } = state;
2365
+ const node = activeId != null ? draggableNodes.get(activeId) : null;
2366
+ const activeRects = useRef({
2367
+ initial: null,
2368
+ translated: null
2369
+ });
2370
+ const active = useMemo(() => {
2371
+ var _node$data;
2372
+ return activeId != null ? {
2373
+ id: activeId,
2374
+ // It's possible for the active node to unmount while dragging
2375
+ data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
2376
+ rect: activeRects
2377
+ } : null;
2378
+ }, [activeId, node]);
2379
+ const activeRef = useRef(null);
2380
+ const [activeSensor, setActiveSensor] = useState(null);
2381
+ const [activatorEvent, setActivatorEvent] = useState(null);
2382
+ const latestProps = useLatestValue(props, Object.values(props));
2383
+ const draggableDescribedById = useUniqueId("DndDescribedBy", id);
2384
+ const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
2385
+ const measuringConfiguration = useMeasuringConfiguration(measuring);
2386
+ const {
2387
+ droppableRects,
2388
+ measureDroppableContainers,
2389
+ measuringScheduled
2390
+ } = useDroppableMeasuring(enabledDroppableContainers, {
2391
+ dragging: isInitialized,
2392
+ dependencies: [translate.x, translate.y],
2393
+ config: measuringConfiguration.droppable
2394
+ });
2395
+ const activeNode = useCachedNode(draggableNodes, activeId);
2396
+ const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
2397
+ const autoScrollOptions = getAutoScrollerOptions();
2398
+ const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
2399
+ useLayoutShiftScrollCompensation({
2400
+ activeNode: activeId != null ? draggableNodes.get(activeId) : null,
2401
+ config: autoScrollOptions.layoutShiftCompensation,
2402
+ initialRect: initialActiveNodeRect,
2403
+ measure: measuringConfiguration.draggable.measure
2404
+ });
2405
+ const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
2406
+ const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
2407
+ const sensorContext = useRef({
2408
+ activatorEvent: null,
2409
+ active: null,
2410
+ activeNode,
2411
+ collisionRect: null,
2412
+ collisions: null,
2413
+ droppableRects,
2414
+ draggableNodes,
2415
+ draggingNode: null,
2416
+ draggingNodeRect: null,
2417
+ droppableContainers,
2418
+ over: null,
2419
+ scrollableAncestors: [],
2420
+ scrollAdjustedTranslate: null
2421
+ });
2422
+ const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
2423
+ const dragOverlay = useDragOverlayMeasuring({
2424
+ measure: measuringConfiguration.dragOverlay.measure
2425
+ });
2426
+ const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
2427
+ const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
2428
+ const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect);
2429
+ const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect);
2430
+ const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null);
2431
+ const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
2432
+ const scrollableAncestorRects = useRects(scrollableAncestors);
2433
+ const modifiedTranslate = applyModifiers(modifiers, {
2434
+ transform: {
2435
+ x: translate.x - nodeRectDelta.x,
2436
+ y: translate.y - nodeRectDelta.y,
2437
+ scaleX: 1,
2438
+ scaleY: 1
2439
+ },
2440
+ activatorEvent,
2441
+ active,
2442
+ activeNodeRect,
2443
+ containerNodeRect,
2444
+ draggingNodeRect,
2445
+ over: sensorContext.current.over,
2446
+ overlayNodeRect: dragOverlay.rect,
2447
+ scrollableAncestors,
2448
+ scrollableAncestorRects,
2449
+ windowRect
2450
+ });
2451
+ const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
2452
+ const scrollOffsets = useScrollOffsets(scrollableAncestors);
2453
+ const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets);
2454
+ const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
2455
+ const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
2456
+ const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
2457
+ const collisions = active && collisionRect ? collisionDetection({
2458
+ active,
2459
+ collisionRect,
2460
+ droppableRects,
2461
+ droppableContainers: enabledDroppableContainers,
2462
+ pointerCoordinates
2463
+ }) : null;
2464
+ const overId = getFirstCollision(collisions, "id");
2465
+ const [over, setOver] = useState(null);
2466
+ const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
2467
+ const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
2468
+ const activeSensorRef = useRef(null);
2469
+ const instantiateSensor = useCallback(
2470
+ (event, _ref2) => {
2471
+ let {
2472
+ sensor: Sensor,
2473
+ options
2474
+ } = _ref2;
2475
+ if (activeRef.current == null) {
2476
+ return;
2477
+ }
2478
+ const activeNode2 = draggableNodes.get(activeRef.current);
2479
+ if (!activeNode2) {
2480
+ return;
2481
+ }
2482
+ const activatorEvent2 = event.nativeEvent;
2483
+ const sensorInstance = new Sensor({
2484
+ active: activeRef.current,
2485
+ activeNode: activeNode2,
2486
+ event: activatorEvent2,
2487
+ options,
2488
+ // Sensors need to be instantiated with refs for arguments that change over time
2489
+ // otherwise they are frozen in time with the stale arguments
2490
+ context: sensorContext,
2491
+ onAbort(id2) {
2492
+ const draggableNode = draggableNodes.get(id2);
2493
+ if (!draggableNode) {
2494
+ return;
2495
+ }
2496
+ const {
2497
+ onDragAbort
2498
+ } = latestProps.current;
2499
+ const event2 = {
2500
+ id: id2
2501
+ };
2502
+ onDragAbort == null ? void 0 : onDragAbort(event2);
2503
+ dispatchMonitorEvent({
2504
+ type: "onDragAbort",
2505
+ event: event2
2506
+ });
2507
+ },
2508
+ onPending(id2, constraint, initialCoordinates, offset) {
2509
+ const draggableNode = draggableNodes.get(id2);
2510
+ if (!draggableNode) {
2511
+ return;
2512
+ }
2513
+ const {
2514
+ onDragPending
2515
+ } = latestProps.current;
2516
+ const event2 = {
2517
+ id: id2,
2518
+ constraint,
2519
+ initialCoordinates,
2520
+ offset
2521
+ };
2522
+ onDragPending == null ? void 0 : onDragPending(event2);
2523
+ dispatchMonitorEvent({
2524
+ type: "onDragPending",
2525
+ event: event2
2526
+ });
2527
+ },
2528
+ onStart(initialCoordinates) {
2529
+ const id2 = activeRef.current;
2530
+ if (id2 == null) {
2531
+ return;
2532
+ }
2533
+ const draggableNode = draggableNodes.get(id2);
2534
+ if (!draggableNode) {
2535
+ return;
2536
+ }
2537
+ const {
2538
+ onDragStart
2539
+ } = latestProps.current;
2540
+ const event2 = {
2541
+ activatorEvent: activatorEvent2,
2542
+ active: {
2543
+ id: id2,
2544
+ data: draggableNode.data,
2545
+ rect: activeRects
2546
+ }
2547
+ };
2548
+ unstable_batchedUpdates(() => {
2549
+ onDragStart == null ? void 0 : onDragStart(event2);
2550
+ setStatus(Status.Initializing);
2551
+ dispatch({
2552
+ type: Action.DragStart,
2553
+ initialCoordinates,
2554
+ active: id2
2555
+ });
2556
+ dispatchMonitorEvent({
2557
+ type: "onDragStart",
2558
+ event: event2
2559
+ });
2560
+ setActiveSensor(activeSensorRef.current);
2561
+ setActivatorEvent(activatorEvent2);
2562
+ });
2563
+ },
2564
+ onMove(coordinates) {
2565
+ dispatch({
2566
+ type: Action.DragMove,
2567
+ coordinates
2568
+ });
2569
+ },
2570
+ onEnd: createHandler(Action.DragEnd),
2571
+ onCancel: createHandler(Action.DragCancel)
2572
+ });
2573
+ activeSensorRef.current = sensorInstance;
2574
+ function createHandler(type) {
2575
+ return async function handler() {
2576
+ const {
2577
+ active: active2,
2578
+ collisions: collisions2,
2579
+ over: over2,
2580
+ scrollAdjustedTranslate: scrollAdjustedTranslate2
2581
+ } = sensorContext.current;
2582
+ let event2 = null;
2583
+ if (active2 && scrollAdjustedTranslate2) {
2584
+ const {
2585
+ cancelDrop
2586
+ } = latestProps.current;
2587
+ event2 = {
2588
+ activatorEvent: activatorEvent2,
2589
+ active: active2,
2590
+ collisions: collisions2,
2591
+ delta: scrollAdjustedTranslate2,
2592
+ over: over2
2593
+ };
2594
+ if (type === Action.DragEnd && typeof cancelDrop === "function") {
2595
+ const shouldCancel = await Promise.resolve(cancelDrop(event2));
2596
+ if (shouldCancel) {
2597
+ type = Action.DragCancel;
2598
+ }
2599
+ }
2600
+ }
2601
+ activeRef.current = null;
2602
+ unstable_batchedUpdates(() => {
2603
+ dispatch({
2604
+ type
2605
+ });
2606
+ setStatus(Status.Uninitialized);
2607
+ setOver(null);
2608
+ setActiveSensor(null);
2609
+ setActivatorEvent(null);
2610
+ activeSensorRef.current = null;
2611
+ const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel";
2612
+ if (event2) {
2613
+ const handler2 = latestProps.current[eventName];
2614
+ handler2 == null ? void 0 : handler2(event2);
2615
+ dispatchMonitorEvent({
2616
+ type: eventName,
2617
+ event: event2
2618
+ });
2619
+ }
2620
+ });
2621
+ };
2622
+ }
2623
+ },
2624
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2625
+ [draggableNodes]
2626
+ );
2627
+ const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {
2628
+ return (event, active2) => {
2629
+ const nativeEvent = event.nativeEvent;
2630
+ const activeDraggableNode = draggableNodes.get(active2);
2631
+ if (
2632
+ // Another sensor is already instantiating
2633
+ activeRef.current !== null || // No active draggable
2634
+ !activeDraggableNode || // Event has already been captured
2635
+ nativeEvent.dndKit || nativeEvent.defaultPrevented
2636
+ ) {
2637
+ return;
2638
+ }
2639
+ const activationContext = {
2640
+ active: activeDraggableNode
2641
+ };
2642
+ const shouldActivate = handler(event, sensor.options, activationContext);
2643
+ if (shouldActivate === true) {
2644
+ nativeEvent.dndKit = {
2645
+ capturedBy: sensor.sensor
2646
+ };
2647
+ activeRef.current = active2;
2648
+ instantiateSensor(event, sensor);
2649
+ }
2650
+ };
2651
+ }, [draggableNodes, instantiateSensor]);
2652
+ const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
2653
+ useSensorSetup(sensors);
2654
+ useIsomorphicLayoutEffect(() => {
2655
+ if (activeNodeRect && status === Status.Initializing) {
2656
+ setStatus(Status.Initialized);
2657
+ }
2658
+ }, [activeNodeRect, status]);
2659
+ useEffect(
2660
+ () => {
2661
+ const {
2662
+ onDragMove
2663
+ } = latestProps.current;
2664
+ const {
2665
+ active: active2,
2666
+ activatorEvent: activatorEvent2,
2667
+ collisions: collisions2,
2668
+ over: over2
2669
+ } = sensorContext.current;
2670
+ if (!active2 || !activatorEvent2) {
2671
+ return;
2672
+ }
2673
+ const event = {
2674
+ active: active2,
2675
+ activatorEvent: activatorEvent2,
2676
+ collisions: collisions2,
2677
+ delta: {
2678
+ x: scrollAdjustedTranslate.x,
2679
+ y: scrollAdjustedTranslate.y
2680
+ },
2681
+ over: over2
2682
+ };
2683
+ unstable_batchedUpdates(() => {
2684
+ onDragMove == null ? void 0 : onDragMove(event);
2685
+ dispatchMonitorEvent({
2686
+ type: "onDragMove",
2687
+ event
2688
+ });
2689
+ });
2690
+ },
2691
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2692
+ [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
2693
+ );
2694
+ useEffect(
2695
+ () => {
2696
+ const {
2697
+ active: active2,
2698
+ activatorEvent: activatorEvent2,
2699
+ collisions: collisions2,
2700
+ droppableContainers: droppableContainers2,
2701
+ scrollAdjustedTranslate: scrollAdjustedTranslate2
2702
+ } = sensorContext.current;
2703
+ if (!active2 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) {
2704
+ return;
2705
+ }
2706
+ const {
2707
+ onDragOver
2708
+ } = latestProps.current;
2709
+ const overContainer = droppableContainers2.get(overId);
2710
+ const over2 = overContainer && overContainer.rect.current ? {
2711
+ id: overContainer.id,
2712
+ rect: overContainer.rect.current,
2713
+ data: overContainer.data,
2714
+ disabled: overContainer.disabled
2715
+ } : null;
2716
+ const event = {
2717
+ active: active2,
2718
+ activatorEvent: activatorEvent2,
2719
+ collisions: collisions2,
2720
+ delta: {
2721
+ x: scrollAdjustedTranslate2.x,
2722
+ y: scrollAdjustedTranslate2.y
2723
+ },
2724
+ over: over2
2725
+ };
2726
+ unstable_batchedUpdates(() => {
2727
+ setOver(over2);
2728
+ onDragOver == null ? void 0 : onDragOver(event);
2729
+ dispatchMonitorEvent({
2730
+ type: "onDragOver",
2731
+ event
2732
+ });
2733
+ });
2734
+ },
2735
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2736
+ [overId]
2737
+ );
2738
+ useIsomorphicLayoutEffect(() => {
2739
+ sensorContext.current = {
2740
+ activatorEvent,
2741
+ active,
2742
+ activeNode,
2743
+ collisionRect,
2744
+ collisions,
2745
+ droppableRects,
2746
+ draggableNodes,
2747
+ draggingNode,
2748
+ draggingNodeRect,
2749
+ droppableContainers,
2750
+ over,
2751
+ scrollableAncestors,
2752
+ scrollAdjustedTranslate
2753
+ };
2754
+ activeRects.current = {
2755
+ initial: draggingNodeRect,
2756
+ translated: collisionRect
2757
+ };
2758
+ }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
2759
+ useAutoScroller({
2760
+ ...autoScrollOptions,
2761
+ delta: translate,
2762
+ draggingRect: collisionRect,
2763
+ pointerCoordinates,
2764
+ scrollableAncestors,
2765
+ scrollableAncestorRects
2766
+ });
2767
+ const publicContext = useMemo(() => {
2768
+ const context = {
2769
+ active,
2770
+ activeNode,
2771
+ activeNodeRect,
2772
+ activatorEvent,
2773
+ collisions,
2774
+ containerNodeRect,
2775
+ dragOverlay,
2776
+ draggableNodes,
2777
+ droppableContainers,
2778
+ droppableRects,
2779
+ over,
2780
+ measureDroppableContainers,
2781
+ scrollableAncestors,
2782
+ scrollableAncestorRects,
2783
+ measuringConfiguration,
2784
+ measuringScheduled,
2785
+ windowRect
2786
+ };
2787
+ return context;
2788
+ }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);
2789
+ const internalContext = useMemo(() => {
2790
+ const context = {
2791
+ activatorEvent,
2792
+ activators,
2793
+ active,
2794
+ activeNodeRect,
2795
+ ariaDescribedById: {
2796
+ draggable: draggableDescribedById
2797
+ },
2798
+ dispatch,
2799
+ draggableNodes,
2800
+ over,
2801
+ measureDroppableContainers
2802
+ };
2803
+ return context;
2804
+ }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
2805
+ return React__default.createElement(DndMonitorContext.Provider, {
2806
+ value: registerMonitorListener
2807
+ }, React__default.createElement(InternalContext.Provider, {
2808
+ value: internalContext
2809
+ }, React__default.createElement(PublicContext.Provider, {
2810
+ value: publicContext
2811
+ }, React__default.createElement(ActiveDraggableContext.Provider, {
2812
+ value: transform
2813
+ }, children)), React__default.createElement(RestoreFocus, {
2814
+ disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false
2815
+ })), React__default.createElement(Accessibility, {
2816
+ ...accessibility,
2817
+ hiddenTextDescribedById: draggableDescribedById
2818
+ }));
2819
+ function getAutoScrollerOptions() {
2820
+ const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
2821
+ const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
2822
+ const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
2823
+ if (typeof autoScroll === "object") {
2824
+ return {
2825
+ ...autoScroll,
2826
+ enabled
2827
+ };
2828
+ }
2829
+ return {
2830
+ enabled
2831
+ };
2832
+ }
2833
+ });
2834
+ const NullContext = /* @__PURE__ */ createContext(null);
2835
+ const defaultRole = "button";
2836
+ const ID_PREFIX = "Draggable";
2837
+ function useDraggable(_ref) {
2838
+ let {
2839
+ id,
2840
+ data,
2841
+ disabled = false,
2842
+ attributes
2843
+ } = _ref;
2844
+ const key = useUniqueId(ID_PREFIX);
2845
+ const {
2846
+ activators,
2847
+ activatorEvent,
2848
+ active,
2849
+ activeNodeRect,
2850
+ ariaDescribedById,
2851
+ draggableNodes,
2852
+ over
2853
+ } = useContext(InternalContext);
2854
+ const {
2855
+ role = defaultRole,
2856
+ roleDescription = "draggable",
2857
+ tabIndex = 0
2858
+ } = attributes != null ? attributes : {};
2859
+ const isDragging = (active == null ? void 0 : active.id) === id;
2860
+ const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);
2861
+ const [node, setNodeRef] = useNodeRef();
2862
+ const [activatorNode, setActivatorNodeRef] = useNodeRef();
2863
+ const listeners = useSyntheticListeners(activators, id);
2864
+ const dataRef = useLatestValue(data);
2865
+ useIsomorphicLayoutEffect(
2866
+ () => {
2867
+ draggableNodes.set(id, {
2868
+ id,
2869
+ key,
2870
+ node,
2871
+ activatorNode,
2872
+ data: dataRef
2873
+ });
2874
+ return () => {
2875
+ const node2 = draggableNodes.get(id);
2876
+ if (node2 && node2.key === key) {
2877
+ draggableNodes.delete(id);
2878
+ }
2879
+ };
2880
+ },
2881
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2882
+ [draggableNodes, id]
2883
+ );
2884
+ const memoizedAttributes = useMemo(() => ({
2885
+ role,
2886
+ tabIndex,
2887
+ "aria-disabled": disabled,
2888
+ "aria-pressed": isDragging && role === defaultRole ? true : void 0,
2889
+ "aria-roledescription": roleDescription,
2890
+ "aria-describedby": ariaDescribedById.draggable
2891
+ }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);
2892
+ return {
2893
+ active,
2894
+ activatorEvent,
2895
+ activeNodeRect,
2896
+ attributes: memoizedAttributes,
2897
+ isDragging,
2898
+ listeners: disabled ? void 0 : listeners,
2899
+ node,
2900
+ over,
2901
+ setNodeRef,
2902
+ setActivatorNodeRef,
2903
+ transform
2904
+ };
2905
+ }
2906
+ function useDndContext() {
2907
+ return useContext(PublicContext);
2908
+ }
2909
+ const ID_PREFIX$1 = "Droppable";
2910
+ const defaultResizeObserverConfig = {
2911
+ timeout: 25
2912
+ };
2913
+ function useDroppable(_ref) {
2914
+ let {
2915
+ data,
2916
+ disabled = false,
2917
+ id,
2918
+ resizeObserverConfig
2919
+ } = _ref;
2920
+ const key = useUniqueId(ID_PREFIX$1);
2921
+ const {
2922
+ active,
2923
+ dispatch,
2924
+ over,
2925
+ measureDroppableContainers
2926
+ } = useContext(InternalContext);
2927
+ const previous = useRef({
2928
+ disabled
2929
+ });
2930
+ const resizeObserverConnected = useRef(false);
2931
+ const rect = useRef(null);
2932
+ const callbackId = useRef(null);
2933
+ const {
2934
+ disabled: resizeObserverDisabled,
2935
+ updateMeasurementsFor,
2936
+ timeout: resizeObserverTimeout
2937
+ } = {
2938
+ ...defaultResizeObserverConfig,
2939
+ ...resizeObserverConfig
2940
+ };
2941
+ const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);
2942
+ const handleResize = useCallback(
2943
+ () => {
2944
+ if (!resizeObserverConnected.current) {
2945
+ resizeObserverConnected.current = true;
2946
+ return;
2947
+ }
2948
+ if (callbackId.current != null) {
2949
+ clearTimeout(callbackId.current);
2950
+ }
2951
+ callbackId.current = setTimeout(() => {
2952
+ measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);
2953
+ callbackId.current = null;
2954
+ }, resizeObserverTimeout);
2955
+ },
2956
+ //eslint-disable-next-line react-hooks/exhaustive-deps
2957
+ [resizeObserverTimeout]
2958
+ );
2959
+ const resizeObserver = useResizeObserver({
2960
+ callback: handleResize,
2961
+ disabled: resizeObserverDisabled || !active
2962
+ });
2963
+ const handleNodeChange = useCallback((newElement, previousElement) => {
2964
+ if (!resizeObserver) {
2965
+ return;
2966
+ }
2967
+ if (previousElement) {
2968
+ resizeObserver.unobserve(previousElement);
2969
+ resizeObserverConnected.current = false;
2970
+ }
2971
+ if (newElement) {
2972
+ resizeObserver.observe(newElement);
2973
+ }
2974
+ }, [resizeObserver]);
2975
+ const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
2976
+ const dataRef = useLatestValue(data);
2977
+ useEffect(() => {
2978
+ if (!resizeObserver || !nodeRef.current) {
2979
+ return;
2980
+ }
2981
+ resizeObserver.disconnect();
2982
+ resizeObserverConnected.current = false;
2983
+ resizeObserver.observe(nodeRef.current);
2984
+ }, [nodeRef, resizeObserver]);
2985
+ useEffect(
2986
+ () => {
2987
+ dispatch({
2988
+ type: Action.RegisterDroppable,
2989
+ element: {
2990
+ id,
2991
+ key,
2992
+ disabled,
2993
+ node: nodeRef,
2994
+ rect,
2995
+ data: dataRef
2996
+ }
2997
+ });
2998
+ return () => dispatch({
2999
+ type: Action.UnregisterDroppable,
3000
+ key,
3001
+ id
3002
+ });
3003
+ },
3004
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3005
+ [id]
3006
+ );
3007
+ useEffect(() => {
3008
+ if (disabled !== previous.current.disabled) {
3009
+ dispatch({
3010
+ type: Action.SetDroppableDisabled,
3011
+ id,
3012
+ key,
3013
+ disabled
3014
+ });
3015
+ previous.current.disabled = disabled;
3016
+ }
3017
+ }, [id, key, disabled, dispatch]);
3018
+ return {
3019
+ active,
3020
+ rect,
3021
+ isOver: (over == null ? void 0 : over.id) === id,
3022
+ node: nodeRef,
3023
+ over,
3024
+ setNodeRef
3025
+ };
3026
+ }
3027
+ export {
3028
+ AutoScrollActivator,
3029
+ DndContext,
3030
+ KeyboardCode,
3031
+ KeyboardSensor,
3032
+ MeasuringFrequency,
3033
+ MeasuringStrategy,
3034
+ MouseSensor,
3035
+ PointerSensor,
3036
+ TouchSensor,
3037
+ TraversalOrder,
3038
+ applyModifiers,
3039
+ closestCorners,
3040
+ defaultAnnouncements,
3041
+ defaultCoordinates,
3042
+ defaultKeyboardCoordinateGetter,
3043
+ defaultScreenReaderInstructions,
3044
+ getClientRect,
3045
+ getFirstCollision,
3046
+ getScrollableAncestors,
3047
+ rectIntersection,
3048
+ useDndContext,
3049
+ useDndMonitor,
3050
+ useDraggable,
3051
+ useDroppable,
3052
+ useSensor,
3053
+ useSensors
3054
+ };
3055
+ //# sourceMappingURL=core.esm.js.map