@plumile/backoffice-react 0.1.201 → 0.1.206

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 (192) hide show
  1. package/README.md +11 -4
  2. package/lib/esm/auth/login/LoginFlow.js.map +1 -1
  3. package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
  4. package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
  5. package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
  6. package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js +28 -28
  7. package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js.map +1 -1
  8. package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +123 -70
  9. package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
  10. package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +206 -204
  11. package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
  12. package/lib/esm/hooks/useAuth.js +56 -56
  13. package/lib/esm/hooks/useAuth.js.map +1 -1
  14. package/lib/esm/hooks/useConditionalSubscription.js +18 -18
  15. package/lib/esm/hooks/useConditionalSubscription.js.map +1 -1
  16. package/lib/esm/hooks/useInfiniteConnection.js +40 -38
  17. package/lib/esm/hooks/useInfiniteConnection.js.map +1 -1
  18. package/lib/esm/i18n/locales/en/backofficeReact.js +1 -0
  19. package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
  20. package/lib/esm/i18n/locales/fr/backofficeReact.js +1 -0
  21. package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
  22. package/lib/esm/index.js +56 -64
  23. package/lib/esm/pages/BackofficeEntityDetailPage.js +97 -97
  24. package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
  25. package/lib/esm/pages/BackofficeEntityListDataPage.js +39 -31
  26. package/lib/esm/pages/BackofficeEntityListDataPage.js.map +1 -1
  27. package/lib/esm/pages/BackofficeEntityListPage.js +2 -0
  28. package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
  29. package/lib/esm/pages/BackofficeLayoutPage.js +19 -19
  30. package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
  31. package/lib/esm/provider/BackofficeProvider.js +33 -33
  32. package/lib/esm/router/createBackofficeRoutes.js +26 -28
  33. package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
  34. package/lib/esm/storybook/relay/RelayStory.js +32 -32
  35. package/lib/esm/storybook/relay/RelayStory.js.map +1 -1
  36. package/lib/esm/storybook/relay/mockResolvers.js.map +1 -1
  37. package/lib/esm/style.css +1 -1
  38. package/lib/types/components/backoffice/detail/BackofficeEntitySummaryHeader.d.ts +1 -1
  39. package/lib/types/components/backoffice/detail/BackofficeEntitySummaryHeader.d.ts.map +1 -1
  40. package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
  41. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts +2 -0
  42. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
  43. package/lib/types/hooks/useAuth.d.ts.map +1 -1
  44. package/lib/types/hooks/useConditionalSubscription.d.ts.map +1 -1
  45. package/lib/types/hooks/useInfiniteConnection.d.ts +3 -2
  46. package/lib/types/hooks/useInfiniteConnection.d.ts.map +1 -1
  47. package/lib/types/i18n/locales/en/backofficeReact.d.ts +5 -0
  48. package/lib/types/i18n/locales/fr/backofficeReact.d.ts +5 -0
  49. package/lib/types/i18n/resources.d.ts +2 -0
  50. package/lib/types/i18n/resources.d.ts.map +1 -1
  51. package/lib/types/index.d.ts +1 -9
  52. package/lib/types/index.d.ts.map +1 -1
  53. package/lib/types/pages/BackofficeEntityListDataPage.d.ts.map +1 -1
  54. package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
  55. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  56. package/lib/types/router/createBackofficeRoutes.d.ts +3 -3
  57. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  58. package/lib/types/storybook/relay/RelayStory.d.ts +1 -1
  59. package/lib/types/storybook/relay/RelayStory.d.ts.map +1 -1
  60. package/lib/types/storybook/relay/mockResolvers.d.ts +9 -1
  61. package/lib/types/storybook/relay/mockResolvers.d.ts.map +1 -1
  62. package/package.json +12 -15
  63. package/lib/esm/_virtual/_rolldown/runtime.js +0 -7
  64. package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js +0 -13
  65. package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js.map +0 -1
  66. package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js +0 -12
  67. package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js.map +0 -1
  68. package/lib/esm/components/backoffice/detail/BackofficeEnumLabel.js +0 -16
  69. package/lib/esm/components/backoffice/detail/BackofficeEnumLabel.js.map +0 -1
  70. package/lib/esm/components/backoffice/detail/BackofficeReferenceValue.js +0 -17
  71. package/lib/esm/components/backoffice/detail/BackofficeReferenceValue.js.map +0 -1
  72. package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js +0 -8
  73. package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js.map +0 -1
  74. package/lib/esm/components/backoffice/detail/BackofficeStatusMetaBadge.js +0 -16
  75. package/lib/esm/components/backoffice/detail/BackofficeStatusMetaBadge.js.map +0 -1
  76. package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +0 -6
  77. package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js.map +0 -1
  78. package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +0 -6
  79. package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js.map +0 -1
  80. package/lib/esm/components/backoffice/routing/BackofficeRoutePendingBar.js +0 -12
  81. package/lib/esm/components/backoffice/routing/BackofficeRoutePendingBar.js.map +0 -1
  82. package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js +0 -7
  83. package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js.map +0 -1
  84. package/lib/esm/hooks/useBackofficeLoadMore.js +0 -18
  85. package/lib/esm/hooks/useBackofficeLoadMore.js.map +0 -1
  86. package/lib/esm/modules/base64.js +0 -21
  87. package/lib/esm/modules/base64.js.map +0 -1
  88. package/lib/esm/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -15
  89. package/lib/esm/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +0 -1
  90. package/lib/esm/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -15
  91. package/lib/esm/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.map +0 -1
  92. package/lib/esm/node_modules/@babel/runtime/helpers/defineProperty.js +0 -20
  93. package/lib/esm/node_modules/@babel/runtime/helpers/defineProperty.js.map +0 -1
  94. package/lib/esm/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -13
  95. package/lib/esm/node_modules/@babel/runtime/helpers/interopRequireDefault.js.map +0 -1
  96. package/lib/esm/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -13
  97. package/lib/esm/node_modules/@babel/runtime/helpers/iterableToArray.js.map +0 -1
  98. package/lib/esm/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -13
  99. package/lib/esm/node_modules/@babel/runtime/helpers/nonIterableSpread.js.map +0 -1
  100. package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -33
  101. package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js.map +0 -1
  102. package/lib/esm/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -19
  103. package/lib/esm/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js.map +0 -1
  104. package/lib/esm/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -18
  105. package/lib/esm/node_modules/@babel/runtime/helpers/toConsumableArray.js.map +0 -1
  106. package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -22
  107. package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js.map +0 -1
  108. package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -17
  109. package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +0 -1
  110. package/lib/esm/node_modules/@babel/runtime/helpers/typeof.js +0 -18
  111. package/lib/esm/node_modules/@babel/runtime/helpers/typeof.js.map +0 -1
  112. package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -19
  113. package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +0 -1
  114. package/lib/esm/node_modules/fbjs/lib/areEqual.js +0 -42
  115. package/lib/esm/node_modules/fbjs/lib/areEqual.js.map +0 -1
  116. package/lib/esm/node_modules/invariant/browser.js +0 -30
  117. package/lib/esm/node_modules/invariant/browser.js.map +0 -1
  118. package/lib/esm/node_modules/relay-test-utils/index.js +0 -11
  119. package/lib/esm/node_modules/relay-test-utils/index.js.map +0 -1
  120. package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js +0 -288
  121. package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js.map +0 -1
  122. package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js +0 -183
  123. package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js.map +0 -1
  124. package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js +0 -19
  125. package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js.map +0 -1
  126. package/lib/esm/node_modules/relay-test-utils/lib/index.js +0 -21
  127. package/lib/esm/node_modules/relay-test-utils/lib/index.js.map +0 -1
  128. package/lib/esm/node_modules/relay-test-utils/lib/unwrapContainer.js +0 -16
  129. package/lib/esm/node_modules/relay-test-utils/lib/unwrapContainer.js.map +0 -1
  130. package/lib/esm/relay/RelayProvider.js +0 -2
  131. package/lib/esm/relay/envHelpers.js +0 -63
  132. package/lib/esm/relay/envHelpers.js.map +0 -1
  133. package/lib/esm/relay/environment.js +0 -2
  134. package/lib/esm/relay/shortAccessTokenEnvironment.js +0 -2
  135. package/lib/esm/relay/useRelayOperationActivity.js +0 -2
  136. package/lib/esm/storybook/relay/relay-test-utils.d.js +0 -0
  137. package/lib/types/auth/AuthFlows.stories.d.ts +0 -19
  138. package/lib/types/auth/AuthFlows.stories.d.ts.map +0 -1
  139. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts +0 -41
  140. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts.map +0 -1
  141. package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts +0 -11
  142. package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts.map +0 -1
  143. package/lib/types/components/backoffice/detail/BackofficeDetailPrimitives.stories.d.ts +0 -17
  144. package/lib/types/components/backoffice/detail/BackofficeDetailPrimitives.stories.d.ts.map +0 -1
  145. package/lib/types/components/backoffice/detail/BackofficeDetailTaggedValue.d.ts +0 -13
  146. package/lib/types/components/backoffice/detail/BackofficeDetailTaggedValue.d.ts.map +0 -1
  147. package/lib/types/components/backoffice/detail/BackofficeEnumLabel.d.ts +0 -9
  148. package/lib/types/components/backoffice/detail/BackofficeEnumLabel.d.ts.map +0 -1
  149. package/lib/types/components/backoffice/detail/BackofficeReferenceValue.d.ts +0 -10
  150. package/lib/types/components/backoffice/detail/BackofficeReferenceValue.d.ts.map +0 -1
  151. package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts +0 -8
  152. package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts.map +0 -1
  153. package/lib/types/components/backoffice/detail/BackofficeStatusMetaBadge.d.ts +0 -11
  154. package/lib/types/components/backoffice/detail/BackofficeStatusMetaBadge.d.ts.map +0 -1
  155. package/lib/types/components/backoffice/detail/backofficeDetailRelationLink.css.d.ts +0 -6
  156. package/lib/types/components/backoffice/detail/backofficeDetailRelationLink.css.d.ts.map +0 -1
  157. package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts +0 -12
  158. package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts.map +0 -1
  159. package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts +0 -12
  160. package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts.map +0 -1
  161. package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts +0 -49
  162. package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts.map +0 -1
  163. package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts +0 -11
  164. package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts.map +0 -1
  165. package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts +0 -12
  166. package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts.map +0 -1
  167. package/lib/types/components/backoffice/refs/backofficeEntityIdRef.css.d.ts +0 -2
  168. package/lib/types/components/backoffice/refs/backofficeEntityIdRef.css.d.ts.map +0 -1
  169. package/lib/types/components/backoffice/routing/BackofficeRoutePendingBar.d.ts +0 -4
  170. package/lib/types/components/backoffice/routing/BackofficeRoutePendingBar.d.ts.map +0 -1
  171. package/lib/types/components/backoffice/routing/backofficeRoutePendingBar.css.d.ts +0 -3
  172. package/lib/types/components/backoffice/routing/backofficeRoutePendingBar.css.d.ts.map +0 -1
  173. package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts +0 -11
  174. package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts.map +0 -1
  175. package/lib/types/components/backoffice/tools/BackofficeTools.stories.d.ts +0 -17
  176. package/lib/types/components/backoffice/tools/BackofficeTools.stories.d.ts.map +0 -1
  177. package/lib/types/hooks/useBackofficeLoadMore.d.ts +0 -9
  178. package/lib/types/hooks/useBackofficeLoadMore.d.ts.map +0 -1
  179. package/lib/types/modules/base64.d.ts +0 -3
  180. package/lib/types/modules/base64.d.ts.map +0 -1
  181. package/lib/types/pages/BackofficeDashboardPage.stories.d.ts +0 -9
  182. package/lib/types/pages/BackofficeDashboardPage.stories.d.ts.map +0 -1
  183. package/lib/types/relay/RelayProvider.d.ts +0 -2
  184. package/lib/types/relay/RelayProvider.d.ts.map +0 -1
  185. package/lib/types/relay/envHelpers.d.ts +0 -25
  186. package/lib/types/relay/envHelpers.d.ts.map +0 -1
  187. package/lib/types/relay/environment.d.ts +0 -2
  188. package/lib/types/relay/environment.d.ts.map +0 -1
  189. package/lib/types/relay/shortAccessTokenEnvironment.d.ts +0 -5
  190. package/lib/types/relay/shortAccessTokenEnvironment.d.ts.map +0 -1
  191. package/lib/types/relay/useRelayOperationActivity.d.ts +0 -2
  192. package/lib/types/relay/useRelayOperationActivity.d.ts.map +0 -1
@@ -12,12 +12,12 @@ import { StrictMode as d, useEffect as f, useMemo as p, useRef as m, useState as
12
12
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
13
13
  import { I18nextProvider as v } from "react-i18next";
14
14
  import y from "@plumile/router/routing/RoutingContext.js";
15
- import { RelayProvider as b, configureRelayEnvironment as x, useRelayOperationActivity as S } from "@plumile/relay";
16
- import { createInstance as C } from "i18next";
17
- import w from "@plumile/router/routing/createRouter.js";
18
- import T from "@plumile/router/routing/RouterRenderer.js";
19
- import { BackofficeThemeProvider as E } from "@plumile/ui/admin/theme/BackofficeThemeProvider.js";
20
- import { RoutePendingBar as D } from "@plumile/ui/components/routing/RoutePendingBar.js";
15
+ import { createInstance as b } from "i18next";
16
+ import x from "@plumile/router/routing/createRouter.js";
17
+ import S from "@plumile/router/routing/RouterRenderer.js";
18
+ import { BackofficeThemeProvider as C } from "@plumile/ui/admin/theme/BackofficeThemeProvider.js";
19
+ import { RoutePendingBar as w } from "@plumile/ui/components/routing/RoutePendingBar.js";
20
+ import { RelayProvider as T, configureRelayEnvironment as E, useRelayOperationActivity as D } from "@plumile/relay";
21
21
  //#region src/provider/BackofficeProvider.tsx
22
22
  var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWith("/") ? e.slice(0, -1) : e : `/${e}`, k = (e, t) => {
23
23
  let n = O(t), r = O(e);
@@ -32,7 +32,7 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
32
32
  }])), j = ({ routes: e, context: t, instrumentations: n }) => {
33
33
  let [r, i] = h(null), a = m(null);
34
34
  return f(() => {
35
- let r = w(e, {
35
+ let r = x(e, {
36
36
  context: t,
37
37
  instrumentations: n
38
38
  });
@@ -45,41 +45,41 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
45
45
  e
46
46
  ]), r;
47
47
  }, M = ({ routes: e, instrumentations: t }) => {
48
- let r = i(), a = S(), o = j({
48
+ let r = i(), a = D(), o = j({
49
49
  routes: e,
50
50
  context: p(() => ({ relayEnvironment: r }), [r]),
51
51
  instrumentations: t
52
52
  });
53
53
  return o == null ? /* @__PURE__ */ g(n, {}) : /* @__PURE__ */ g(y.Provider, {
54
54
  value: o.context,
55
- children: /* @__PURE__ */ g(T, {
55
+ children: /* @__PURE__ */ g(S, {
56
56
  enableTransition: !0,
57
57
  externalPending: a.pendingCount > 0,
58
58
  fallback: /* @__PURE__ */ g(n, {}),
59
- pending: /* @__PURE__ */ g(D, {})
59
+ pending: /* @__PURE__ */ g(w, {})
60
60
  })
61
61
  });
62
62
  }, N = (n) => {
63
- let i = O(n.basePath ?? "/"), m = u(i), y = p(() => A(n.entityManifest, i), [i, n.entityManifest]), S = p(() => c(y, { basePath: i }), [i, y]), w = n.graphql, T = p(() => t(n.dashboards), [n.dashboards]);
63
+ let i = O(n.basePath ?? "/"), m = u(i), y = p(() => A(n.entityManifest, i), [i, n.entityManifest]), x = p(() => c(y, { basePath: i }), [i, y]), S = n.graphql, w = p(() => t(n.dashboards), [n.dashboards]);
64
64
  f(() => {
65
- let e = w.httpUrl ?? w.endpoint, t = w.wsUrl ?? w.wsEndpoint;
66
- x({
65
+ let e = S.httpUrl ?? S.endpoint, t = S.wsUrl ?? S.wsEndpoint;
66
+ E({
67
67
  httpUrl: e,
68
68
  wsUrl: t,
69
- getDataId: w.getDataId,
70
- logEvents: w.logEvents,
71
- getAuthHeaders: w.getAuthHeaders
69
+ getDataId: S.getDataId,
70
+ logEvents: S.logEvents,
71
+ getAuthHeaders: S.getAuthHeaders
72
72
  });
73
73
  }, [
74
- w.endpoint,
75
- w.getAuthHeaders,
76
- w.getDataId,
77
- w.httpUrl,
78
- w.logEvents,
79
- w.wsEndpoint,
80
- w.wsUrl
74
+ S.endpoint,
75
+ S.getAuthHeaders,
76
+ S.getDataId,
77
+ S.httpUrl,
78
+ S.logEvents,
79
+ S.wsEndpoint,
80
+ S.wsUrl
81
81
  ]);
82
- let D = p(() => o(n.i18n?.resources ?? {}), [n.i18n?.resources]), k = p(() => n.i18n?.instance ?? C(), [n.i18n?.instance]), [j, N] = h(k.isInitialized);
82
+ let D = p(() => o(n.i18n?.resources ?? {}), [n.i18n?.resources]), k = p(() => n.i18n?.instance ?? b(), [n.i18n?.instance]), [j, N] = h(k.isInitialized);
83
83
  f(() => {
84
84
  let e = !0, t = () => {
85
85
  e && N(!0);
@@ -128,43 +128,43 @@ var O = (e) => e.trim() === "" || e === "/" ? "/" : e.startsWith("/") ? e.endsWi
128
128
  basePath: i,
129
129
  entities: y,
130
130
  entityManifest: y,
131
- entityRegistry: S,
131
+ entityRegistry: x,
132
132
  filterColumnAliases: n.filterColumnAliases,
133
133
  sidebar: n.sidebar,
134
134
  dashboard: n.dashboard,
135
- dashboards: T,
135
+ dashboards: w,
136
136
  auth: n.auth,
137
137
  graphql: n.graphql
138
138
  }), [
139
139
  i,
140
140
  n.auth,
141
141
  n.dashboard,
142
- T,
142
+ w,
143
143
  y,
144
- S,
144
+ x,
145
145
  n.filterColumnAliases,
146
146
  n.graphql,
147
147
  n.sidebar
148
148
  ]), F = p(() => s({
149
149
  basePath: i,
150
150
  entityManifest: y,
151
- entityRegistry: S,
151
+ entityRegistry: x,
152
152
  sidebar: n.sidebar,
153
153
  auth: n.auth,
154
154
  dashboard: n.dashboard,
155
- dashboards: T,
155
+ dashboards: w,
156
156
  toolsOperationPage: n.toolsOperationPage
157
157
  }), [
158
158
  i,
159
159
  y,
160
- S,
160
+ x,
161
161
  n.auth,
162
162
  n.dashboard,
163
- T,
163
+ w,
164
164
  n.toolsOperationPage,
165
165
  n.sidebar
166
166
  ]), I = /* @__PURE__ */ g(r, { label: "Loading..." });
167
- return j && m && (I = /* @__PURE__ */ g(E, { children: /* @__PURE__ */ g(b, { children: /* @__PURE__ */ _(e, {
167
+ return j && m && (I = /* @__PURE__ */ g(C, { children: /* @__PURE__ */ g(T, { children: /* @__PURE__ */ _(e, {
168
168
  value: P,
169
169
  children: [n.overlay, /* @__PURE__ */ g(l, { children: /* @__PURE__ */ g(M, {
170
170
  routes: F,
@@ -56,11 +56,11 @@ var { loadQuery: f, usePreloadedQuery: p } = c, m = u("WrapperPage", async () =>
56
56
  return e.detailPages?.find((e) => I(e.pathSegment) === n) ?? null;
57
57
  }, B = (e, t) => z(e, t)?.id ?? t, V = d;
58
58
  function H(a) {
59
- let { basePath: o, entityManifest: c, entityRegistry: l, sidebar: u, auth: d, dashboard: p } = a, N = r(a.dashboards), I = M(o), z = P(I, "login"), H = P(I, "login/reset"), U = P(I, "login/reset/complete"), oe = P(I, "verify-email"), se = P(I, "accept-invitation"), ce = F(I, "login"), W = t(c, u), le = n(W, u), ue = e(W, u), G = /* @__PURE__ */ new Map();
60
- ue.forEach((e, t) => {
59
+ let { basePath: o, entityManifest: c, entityRegistry: l, sidebar: u, auth: d, dashboard: p } = a, m = r(a.dashboards), N = M(o), I = P(N, "login"), z = P(N, "login/reset"), H = P(N, "login/reset/complete"), U = P(N, "verify-email"), oe = P(N, "accept-invitation"), se = F(N, "login"), W = t(c, u), ce = n(W, u), le = e(W, u), G = /* @__PURE__ */ new Map();
60
+ le.forEach((e, t) => {
61
61
  G.set(t, e.groupId);
62
62
  });
63
- let K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = u?.permissionsQuery, de = async ({ context: e }) => {
63
+ let K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = u?.permissionsQuery, ue = async ({ context: e }) => {
64
64
  let t = await d.session.load();
65
65
  return {
66
66
  permissionsQuery: J == null ? null : f(e.relayEnvironment, J, {}),
@@ -72,7 +72,7 @@ function H(a) {
72
72
  }, X = () => p == null ? null : { dashboardId: "dashboard" }, Z = ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e }), Q = ({ children: e, prepared: t, Component: n }) => n == null ? null : /* @__PURE__ */ s(n, {
73
73
  prepared: t,
74
74
  children: e
75
- }), fe = V({
75
+ }), de = V({
76
76
  path: "",
77
77
  resourcePage: T,
78
78
  prepare: X,
@@ -83,7 +83,7 @@ function H(a) {
83
83
  prepare: Y,
84
84
  render: Z
85
85
  })]
86
- }), pe = V({
86
+ }), fe = V({
87
87
  path: "dashboard",
88
88
  resourcePage: T,
89
89
  prepare: X,
@@ -94,7 +94,7 @@ function H(a) {
94
94
  prepare: Y,
95
95
  render: Z
96
96
  })]
97
- }), me = N.map((e) => {
97
+ }), pe = m.map((e) => {
98
98
  let t = V({
99
99
  path: "",
100
100
  resourcePage: w,
@@ -118,9 +118,9 @@ function H(a) {
118
118
  render: Q,
119
119
  children: [t]
120
120
  });
121
- }), he = Object.values(c).filter((e) => e.kind === "list-detail"), ge = le.map((e) => {
121
+ }), me = Object.values(c).filter((e) => e.kind === "list-detail"), he = ce.map((e) => {
122
122
  let t = V({
123
- path: L(e.hub.href, I),
123
+ path: L(e.hub.href, N),
124
124
  resourcePage: D,
125
125
  prepare: () => ({
126
126
  hubId: e.hub.id,
@@ -129,8 +129,8 @@ function H(a) {
129
129
  render: ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e })
130
130
  });
131
131
  return e.groupId != null && q.set(t, e.groupId), t;
132
- }), _e = he.map((e) => {
133
- let t = e.routes.list, n = L(t, I), r = [], a = ({ match: t }) => {
132
+ }), ge = me.map((e) => {
133
+ let t = e.routes.list, n = L(t, N), r = [], a = ({ match: t }) => {
134
134
  let n = String(t?.params.id ?? ""), r = typeof t?.params.pagePath == "string" ? t.params.pagePath : null, a = r == null ? e.defaultDetailPageId : B(e, r);
135
135
  return /* @__PURE__ */ s(i, {
136
136
  entityManifest: e,
@@ -292,7 +292,6 @@ function H(a) {
292
292
  children: [
293
293
  V({
294
294
  path: "",
295
- resourcePage: m,
296
295
  prepare: ({ variables: t }) => {
297
296
  let n = String(t.id ?? "").trim();
298
297
  return { redirectTo: n === "" ? null : e.routes.detailPage(n, e.defaultDetailPageId) };
@@ -385,11 +384,10 @@ function H(a) {
385
384
  return K.set(d, e.id), r.push(d), V({
386
385
  path: n,
387
386
  children: r,
388
- resourcePage: m,
389
387
  suspenseBoundary: "segment"
390
388
  });
391
- }), ve = Object.values(c).filter((e) => e.kind === "tool").map((e) => {
392
- let t = L(e.routes.list, I), n = V({
389
+ }), _e = Object.values(c).filter((e) => e.kind === "tool").map((e) => {
390
+ let t = L(e.routes.list, N), n = V({
393
391
  path: "",
394
392
  resourcePage: a.toolsOperationPage ?? null,
395
393
  prepare: async () => {
@@ -430,12 +428,12 @@ function H(a) {
430
428
  children: [n]
431
429
  });
432
430
  return K.set(r, e.id), r;
433
- }), ye = V({
434
- path: I,
431
+ }), ve = V({
432
+ path: N,
435
433
  resourcePage: h,
436
434
  prepareSearchBehavior: "path",
437
435
  suspenseBoundary: "segment",
438
- prepare: de,
436
+ prepare: ue,
439
437
  render: ({ children: e, prepared: t, route: n, Component: r }) => {
440
438
  if (r == null) return null;
441
439
  let i = t, a = R(n, K), o = a == null ? R(n, q) : G.get(a) ?? null, c = r, l = d.session.get()?.authStatusQuery ?? null;
@@ -446,7 +444,7 @@ function H(a) {
446
444
  activeGroupId: o,
447
445
  authStatusQuery: l,
448
446
  authStatusPrepared: i.authStatusQuery,
449
- loginRedirectPath: ce,
447
+ loginRedirectPath: se,
450
448
  children: e
451
449
  }) : /* @__PURE__ */ s(ae, {
452
450
  Component: c,
@@ -457,16 +455,16 @@ function H(a) {
457
455
  });
458
456
  },
459
457
  children: [
460
- fe,
458
+ de,
459
+ ...he,
461
460
  ...ge,
462
461
  ..._e,
463
- ...ve,
464
- ...me,
465
- pe
462
+ ...pe,
463
+ fe
466
464
  ]
467
465
  }), $ = [
468
466
  V({
469
- path: z,
467
+ path: I,
470
468
  resourcePage: ne,
471
469
  prepare: async ({ context: e }) => {
472
470
  let t = await d.login.load();
@@ -475,30 +473,30 @@ function H(a) {
475
473
  render: ({ prepared: e, Component: t }) => t == null ? null : /* @__PURE__ */ s(t, { prepared: e })
476
474
  }),
477
475
  V({
478
- path: H,
476
+ path: z,
479
477
  resourcePage: re,
480
478
  prepare: async () => (await d.passwordResetRequest.load(), null),
481
479
  render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
482
480
  }),
483
481
  V({
484
- path: U,
482
+ path: H,
485
483
  resourcePage: ie,
486
484
  prepare: async () => (await d.passwordResetComplete.load(), null),
487
485
  render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
488
486
  }),
489
487
  V({
490
- path: oe,
488
+ path: U,
491
489
  resourcePage: O,
492
490
  prepare: async () => (await d.verifyEmail.load(), null),
493
491
  render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
494
492
  })
495
493
  ];
496
494
  return (d.hasAcceptInvitation === !0 || d.acceptInvitation != null) && $.push(V({
497
- path: se,
495
+ path: oe,
498
496
  resourcePage: k,
499
497
  prepare: async () => (await d.acceptInvitation?.load(), null),
500
498
  render: ({ Component: e }) => e == null ? null : /* @__PURE__ */ s(e, {})
501
- })), $.push(ye), $;
499
+ })), $.push(ve), $;
502
500
  }
503
501
  var U = {
504
502
  normalizeBaseSegment: M,
@@ -1 +1 @@
1
- {"version":3,"file":"createBackofficeRoutes.js","names":[],"sources":["../../../src/router/createBackofficeRoutes.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useContext,\n useEffect,\n type ComponentType,\n type JSX,\n type ReactNode,\n} from 'react';\nimport {\n getResourcePage,\n type ResourcePage,\n} from '@plumile/router/ResourcePage.js';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport { r } from '@plumile/router/tools.js';\nimport {\n type AnyRoute,\n type Route,\n type RouteFallbackArgs,\n} from '@plumile/router/types.js';\nimport * as ReactRelay from 'react-relay';\nimport type { PreloadedQuery } from 'react-relay';\nimport type {\n Environment,\n GraphQLTaggedNode,\n OperationType,\n Variables,\n} from 'relay-runtime';\n\nimport { BACKOFFICE_LIST_DEFAULTS } from '@plumile/backoffice-core/constants.js';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDetailPageManifestItem,\n BackofficeEntityManifestItem,\n BackofficeEntityManifestMap,\n I18nLabel,\n BackofficePreparedDetailFrameRoute,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficePreparedDetailPageConfigRoute,\n BackofficePreparedDetailPageDataRoute,\n BackofficePreparedDetailShellRoute,\n BackofficePreparedDetailUnknownPageRoute,\n BackofficePreparedListDataRoute,\n BackofficePreparedListLayoutRoute,\n BackofficePreparedListShellRoute,\n BackofficePreparedToolConfigRoute,\n BackofficePreparedToolRoute,\n} from '@plumile/backoffice-core/types.js';\n\nimport type {\n BackofficeAuthConfig,\n BackofficeDashboardRegistration,\n BackofficeDashboardModule,\n BackofficeResolvedSidebarHubConfig,\n BackofficeSidebarConfig,\n} from '../provider/types.js';\nimport {\n buildEntityGroupLookup,\n resolveSidebarHubEntries,\n resolveSidebarGroups,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport type { BackofficeEntityRegistry } from '../provider/entityRegistry.js';\nimport { validateBackofficeDashboardRegistrations } from '../provider/dashboardRegistrations.js';\nimport { BackofficeEntityDetailManifestFallback } from '../pages/detail/BackofficeEntityDetailManifestFallback.js';\n\nconst { loadQuery, usePreloadedQuery } = ReactRelay;\n\nexport type CreateBackofficeRoutesInput = {\n basePath: string;\n entityManifest: BackofficeEntityManifestMap;\n entityRegistry: BackofficeEntityRegistry;\n sidebar?: BackofficeSidebarConfig;\n auth: BackofficeAuthConfig;\n dashboard?: BackofficeDashboardModule;\n dashboards?: readonly BackofficeDashboardRegistration[];\n toolsOperationPage?: ResourcePage | null;\n};\n\nexport type BackofficeRouterContext = {\n relayEnvironment: Environment;\n};\n\nexport const WrapperPageResource: ResourcePage | null = getResourcePage(\n 'WrapperPage',\n // eslint-disable-next-line arrow-body-style\n async () => ({\n default: (await import('@plumile/ui/pages/WrapperPage.js')).WrapperPage,\n }),\n);\n\nexport const BackofficeLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLayoutPage.js'),\n );\n\nexport const BackofficeEntityListPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListPage.js'),\n );\n\nexport const BackofficeEntityListShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListShellPage.js'),\n );\n\nexport const BackofficeEntityListDataPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListDataPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListDataPage.js'),\n );\n\nexport const BackofficeEntityDetailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPage.js'),\n );\n\nexport const BackofficeEntityDetailFramePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailFramePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailFramePage.js'),\n );\n\nexport const BackofficeEntityDetailLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailLayoutPage.js'),\n );\n\nexport const BackofficeEntityDetailPageConfigPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPageConfigPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPageConfigPage.js'),\n );\n\nexport const BackofficeEntityDetailShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailShellPage.js'),\n );\n\nexport const BackofficeEntityDetailUnknownPageRedirectResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailUnknownPageRedirect',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailUnknownPageRedirect.js'),\n );\n\nexport const BackofficeDashboardPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardPage.js'),\n );\n\nexport const BackofficeDashboardShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardShellPage.js'),\n );\n\nexport const BackofficeToolShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeToolShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeToolShellPage.js'),\n );\n\nexport const BackofficeHubPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeHubPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeHubPage.js'),\n);\n\nexport const BackofficeLoginPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeLoginPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLoginPage.js'),\n);\n\nexport const BackofficePasswordResetRequestPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetRequestPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetRequestPage.js'),\n );\n\nexport const BackofficePasswordResetCompletePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetCompletePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetCompletePage.js'),\n );\n\nexport const BackofficeVerifyEmailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeVerifyEmailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeVerifyEmailPage.js'),\n );\n\nexport const BackofficeAcceptInvitationPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeAcceptInvitationPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeAcceptInvitationPage.js'),\n );\n\ntype PreparedLayout = {\n permissionsQuery: PreloadedQuery<OperationType> | null;\n authStatusQuery: PreloadedQuery<OperationType> | null;\n};\n\nexport type BackofficePreparedDashboardShellRoute = {\n dashboardId: string | null;\n label?: I18nLabel;\n};\n\nexport type BackofficePreparedDashboardRoute =\n BackofficePreparedDashboardShellRoute & {\n config: BackofficeDashboardConfig;\n };\n\ntype LayoutAuthStatus = {\n isLoggedIn?: boolean | null;\n me?: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n } | null;\n} | null;\n\ntype LayoutRouteComponent = ComponentType<{\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: LayoutAuthStatus;\n activeGroupId?: string | null;\n}>;\n\ntype LayoutRouteRenderProps = {\n children: ReactNode;\n Component: LayoutRouteComponent;\n preparedLayout: PreparedLayout | undefined;\n permissionsQuery: GraphQLTaggedNode | undefined;\n activeGroupId: string | null;\n};\n\nconst BackofficeHistoryRedirect = ({\n pathname,\n}: {\n pathname: string;\n}): null => {\n const router = useContext(RoutingContext);\n\n useEffect(() => {\n router?.history.set({\n pathname,\n });\n }, [pathname, router]);\n\n return null;\n};\n\nconst BackofficeLayoutRouteWithoutAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n}: LayoutRouteRenderProps): JSX.Element => {\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={null}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nconst BackofficeLayoutRouteWithAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n authStatusQuery,\n authStatusPrepared,\n loginRedirectPath,\n}: LayoutRouteRenderProps & {\n authStatusQuery: GraphQLTaggedNode;\n authStatusPrepared: PreloadedQuery<OperationType>;\n loginRedirectPath: string;\n}): JSX.Element => {\n const data = usePreloadedQuery(authStatusQuery, authStatusPrepared);\n const authStatus = data as LayoutAuthStatus;\n\n if (authStatus?.isLoggedIn !== true) {\n return <BackofficeHistoryRedirect pathname={loginRedirectPath} />;\n }\n\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nexport type BackofficePreparedHubRoute = {\n hubId: string;\n hub: BackofficeResolvedSidebarHubConfig;\n};\n\nconst normalizeBaseSegment = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '' || trimmed === '/') {\n return '';\n }\n return trimmed.replace(/^\\/+|\\/+$/g, '');\n};\n\nconst normalizePath = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '') {\n return '/';\n }\n return `/${trimmed}`.replace(/\\/+/g, '/');\n};\n\nconst buildScopedPath = (baseSegment: string, path: string): string => {\n const normalizedPath = path.replace(/^\\/+|\\/+$/g, '');\n if (baseSegment === '') {\n return normalizedPath;\n }\n if (normalizedPath === '') {\n return baseSegment;\n }\n return `${baseSegment}/${normalizedPath}`;\n};\n\nconst buildScopedAbsolutePath = (baseSegment: string, path: string): string => {\n return normalizePath(buildScopedPath(baseSegment, path));\n};\n\nconst normalizePagePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst buildRelativePath = (\n absolutePath: string,\n baseSegment: string,\n): string => {\n const normalized = normalizePath(absolutePath);\n const basePrefix = baseSegment === '' ? '' : `/${baseSegment}`;\n if (basePrefix !== '' && normalized.startsWith(basePrefix)) {\n return normalized.slice(basePrefix.length).replace(/^\\/+/, '');\n }\n return normalized.replace(/^\\/+/, '');\n};\n\nconst resolveActiveEntityIdFromRoute = (\n route: { routes: AnyRoute[] } | null,\n routeEntityIdMap: WeakMap<AnyRoute, string>,\n): string | null => {\n if (route?.routes == null) {\n return null;\n }\n for (let index = route.routes.length - 1; index >= 0; index -= 1) {\n const routeEntry = route.routes[index];\n if (routeEntry != null) {\n const entityId = routeEntityIdMap.get(routeEntry);\n if (entityId != null) {\n return entityId;\n }\n }\n }\n return null;\n};\n\nconst resolveDetailPageManifestByPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): BackofficeDetailPageManifestItem | null => {\n const pagePath = normalizePagePath(rawPagePath);\n return (\n entityManifestItem.detailPages?.find((page) => {\n return normalizePagePath(page.pathSegment) === pagePath;\n }) ?? null\n );\n};\n\nconst resolveDetailPageIdForPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): string => {\n return (\n resolveDetailPageManifestByPath(entityManifestItem, rawPagePath)?.id ??\n rawPagePath\n );\n};\n\nconst rBackoffice = r<BackofficeRouterContext>;\n\n/**\n * Creates backoffice routes based on the provided configuration\n */\nexport function createBackofficeRoutes(\n input: CreateBackofficeRoutesInput,\n): Route<BackofficeRouterContext, unknown>[] {\n const { basePath, entityManifest, entityRegistry, sidebar, auth, dashboard } =\n input;\n const dashboards = validateBackofficeDashboardRegistrations(input.dashboards);\n const baseSegment = normalizeBaseSegment(basePath);\n const loginPath = buildScopedPath(baseSegment, 'login');\n const passwordResetRequestPath = buildScopedPath(baseSegment, 'login/reset');\n const passwordResetCompletePath = buildScopedPath(\n baseSegment,\n 'login/reset/complete',\n );\n const verifyEmailPath = buildScopedPath(baseSegment, 'verify-email');\n const acceptInvitationPath = buildScopedPath(\n baseSegment,\n 'accept-invitation',\n );\n const loginRedirectPath = buildScopedAbsolutePath(baseSegment, 'login');\n const entities = entityManifest;\n const groups = resolveSidebarGroups(entities, sidebar);\n const hubEntries = resolveSidebarHubEntries(groups, sidebar);\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const entityIdToGroupId = new Map<string, string>();\n entityGroupLookup.forEach((value, entityId) => {\n entityIdToGroupId.set(entityId, value.groupId);\n });\n const routeEntityIdMap = new WeakMap<AnyRoute, string>();\n const routeGroupIdMap = new WeakMap<AnyRoute, string>();\n\n const permissionsQuery = sidebar?.permissionsQuery;\n const layoutPrepare = async ({\n context,\n }: {\n context: BackofficeRouterContext;\n }) => {\n const sessionAuth = await auth.session.load();\n const permissionsQueryRef =\n permissionsQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n permissionsQuery,\n {},\n )\n : null;\n const authStatusQueryRef =\n sessionAuth.authStatusQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n sessionAuth.authStatusQuery,\n {},\n { fetchPolicy: 'network-only' },\n )\n : null;\n return {\n permissionsQuery: permissionsQueryRef,\n authStatusQuery: authStatusQueryRef,\n };\n };\n\n const prepareRootDashboard =\n async (): Promise<BackofficePreparedDashboardRoute | null> => {\n if (dashboard == null) {\n return null;\n }\n const config = await dashboard.load();\n return {\n dashboardId: 'dashboard',\n config,\n };\n };\n const prepareRootDashboardShell =\n (): BackofficePreparedDashboardShellRoute | null => {\n if (dashboard == null) {\n return null;\n }\n return {\n dashboardId: 'dashboard',\n };\n };\n const renderDashboard = ({\n prepared,\n Component,\n }: {\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardComponent = Component as ComponentType<{\n prepared?: unknown;\n }>;\n return <DashboardComponent prepared={prepared} />;\n };\n const renderDashboardShell = ({\n children: dashboardChildren,\n prepared,\n Component,\n }: {\n children: ReactNode;\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardShellComponent = Component as ComponentType<{\n children?: ReactNode;\n prepared?: BackofficePreparedDashboardShellRoute | null;\n }>;\n return (\n <DashboardShellComponent\n prepared={prepared as BackofficePreparedDashboardShellRoute | null}\n >\n {dashboardChildren}\n </DashboardShellComponent>\n );\n };\n\n const dashboardConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardConfigRoute],\n });\n const dashboardAliasConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardAliasRoute = rBackoffice({\n path: 'dashboard',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardAliasConfigRoute],\n });\n const secondaryDashboardRoutes = dashboards.map((registration) => {\n const dashboardConfigChildRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: async () => {\n const config = await registration.module.load();\n return {\n dashboardId: registration.id,\n label: registration.label,\n config,\n } satisfies BackofficePreparedDashboardRoute;\n },\n render: renderDashboard,\n });\n return rBackoffice({\n path: `dashboard/${registration.id}`,\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: () => {\n return {\n dashboardId: registration.id,\n label: registration.label,\n } satisfies BackofficePreparedDashboardShellRoute;\n },\n render: renderDashboardShell,\n children: [dashboardConfigChildRoute],\n });\n });\n\n const listEntityEntries = Object.values(entityManifest).filter((entity) => {\n return entity.kind === 'list-detail';\n });\n\n const hubRoutes = hubEntries.map((entry) => {\n const hubRelative = buildRelativePath(entry.hub.href, baseSegment);\n const hubRoute = rBackoffice({\n path: hubRelative,\n resourcePage: BackofficeHubPageResource,\n prepare: () => {\n return {\n hubId: entry.hub.id,\n hub: entry.hub,\n } satisfies BackofficePreparedHubRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n });\n if (entry.groupId != null) {\n routeGroupIdMap.set(hubRoute, entry.groupId);\n }\n return hubRoute;\n });\n\n const entityRoutes = listEntityEntries.map((entityManifestItem) => {\n const listPath = entityManifestItem.routes.list;\n const listRelative = buildRelativePath(listPath, baseSegment);\n const children: Route<unknown, unknown>[] = [];\n const renderDetailRouteFallback = ({\n match,\n }: RouteFallbackArgs<BackofficeRouterContext>): JSX.Element => {\n const rawId = String(match?.params.id ?? '');\n const rawPagePath =\n typeof match?.params.pagePath === 'string'\n ? match.params.pagePath\n : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return (\n <BackofficeEntityDetailManifestFallback\n entityManifest={entityManifestItem}\n id={rawId}\n pageId={pageId}\n pagePath={rawPagePath}\n />\n );\n };\n\n if (entityManifestItem.hasList) {\n const listDataRoute = rBackoffice({\n path: '',\n querySchema: entityManifestItem.listNavigation.querySchema,\n resourcePage: BackofficeEntityListDataPageResource,\n prepareSearchBehavior: 'path',\n prepare: async ({ context, filters, query }) => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const { list } = config;\n const { defaults: listDefaults } = entityManifestItem.listNavigation;\n const navigationQuery: { sort?: string } = {};\n if (typeof query.sort === 'string') {\n navigationQuery.sort = query.sort;\n }\n const navigationFilters = filters as Parameters<\n typeof entityManifestItem.listNavigation.decode\n >[0]['filters'];\n const state = entityManifestItem.listNavigation.decode({\n filters: navigationFilters,\n query: navigationQuery,\n });\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = list.buildQueryVariables(variablesBase);\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n list.query,\n variables,\n );\n const prepared: BackofficePreparedListDataRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n query: queryRef,\n };\n return prepared;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(listDataRoute, entityManifestItem.id);\n\n const listRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListPageResource,\n prepareSearchBehavior: 'path',\n prepare: async () => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const prepared: BackofficePreparedListLayoutRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n };\n return prepared;\n },\n render: ({ children: listChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListLayoutRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {listChildren}\n </Component>\n );\n },\n children: [listDataRoute],\n });\n routeEntityIdMap.set(listRoute, entityManifestItem.id);\n\n const listShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListShellPageResource,\n prepareSearchBehavior: 'path',\n prepare: () => {\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n } satisfies BackofficePreparedListShellRoute;\n },\n render: ({ children: listShellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {listShellChildren}\n </Component>\n );\n },\n children: [listRoute],\n });\n routeEntityIdMap.set(listShellRoute, entityManifestItem.id);\n children.push(listShellRoute);\n }\n\n const detailPageRoutes = entityManifestItem.detailPages.map(\n (pageManifest) => {\n const pageDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const rawId = String(variables.id ?? '');\n const pageModule = await entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n );\n const pageBuildResult =\n pageModule.config.page.buildVariables != null\n ? pageModule.config.page.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const pageQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n pageModule.config.page.query,\n pageBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n detailId: pageBuildResult.detailId,\n id: rawId,\n pageConfig: pageModule.config,\n pageQuery: pageQueryRef,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageDataRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(pageDataRoute, entityManifestItem.id);\n\n const pageConfigRoute = rBackoffice({\n path: pageManifest.pathSegment,\n resourcePage: BackofficeEntityDetailPageConfigPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const [pageModule, layoutModule] = await Promise.all([\n entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n ),\n entityRegistry.loadDetailLayoutEntity(entityManifestItem.id),\n ]);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: layoutModule.config,\n id: rawId,\n pageConfig: pageModule.config,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageConfigRoute;\n },\n render: ({ children: pageChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageConfigRoute;\n return (\n <Component\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {pageChildren}\n </Component>\n );\n },\n children: [pageDataRoute],\n });\n routeEntityIdMap.set(pageConfigRoute, entityManifestItem.id);\n return pageConfigRoute;\n },\n );\n\n const detailLayoutDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailLayoutPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const rawId = String(variables.id ?? '');\n const layoutBuildResult =\n config.layoutPage.buildVariables != null\n ? config.layoutPage.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const layoutQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n config.layoutPage.query,\n layoutBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n layoutQuery: layoutQueryRef,\n id: rawId,\n } satisfies BackofficePreparedDetailLayoutDataRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailLayoutDataRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [\n rBackoffice({\n path: '',\n resourcePage: WrapperPageResource,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '').trim();\n return {\n redirectTo:\n rawId === ''\n ? null\n : entityManifestItem.routes.detailPage(\n rawId,\n entityManifestItem.defaultDetailPageId,\n ),\n };\n },\n render: ({ prepared }) => {\n const redirectTo =\n (prepared as { redirectTo?: string | null }).redirectTo ?? null;\n if (redirectTo == null) {\n return null;\n }\n return <BackofficeHistoryRedirect pathname={redirectTo} />;\n },\n }),\n ...detailPageRoutes,\n rBackoffice({\n path: ':pagePath',\n resourcePage: BackofficeEntityDetailUnknownPageRedirectResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const rawId = String(variables.id ?? '');\n const rawPagePath = String(variables.pagePath ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: entityModule.config,\n id: rawId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailUnknownPageRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedDetail =\n prepared as BackofficePreparedDetailUnknownPageRoute;\n return (\n <Component\n entityManifest={preparedDetail.entityManifest}\n config={preparedDetail.entityConfig}\n prepared={preparedDetail}\n />\n );\n },\n }),\n ],\n });\n routeEntityIdMap.set(detailLayoutDataRoute, entityManifestItem.id);\n\n const detailShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailShellPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const rawPagePath =\n typeof variables.pagePath === 'string' ? variables.pagePath : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n pageId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailShellRoute;\n },\n render: ({ children: shellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {shellChildren}\n </Component>\n );\n },\n children: [detailLayoutDataRoute],\n });\n routeEntityIdMap.set(detailShellRoute, entityManifestItem.id);\n\n const detailFrameRoute = rBackoffice({\n path: ':id',\n resourcePage: BackofficeEntityDetailFramePageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n } satisfies BackofficePreparedDetailFrameRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailFrameRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [detailShellRoute],\n });\n routeEntityIdMap.set(detailFrameRoute, entityManifestItem.id);\n children.push(detailFrameRoute);\n\n return rBackoffice({\n path: listRelative,\n children,\n resourcePage: WrapperPageResource,\n suspenseBoundary: 'segment',\n });\n });\n\n const toolsRoutes = Object.values(entityManifest)\n .filter((entity) => {\n return entity.kind === 'tool';\n })\n .map((toolManifest) => {\n const toolRelative = buildRelativePath(\n toolManifest.routes.list,\n baseSegment,\n );\n const toolConfigRoute = rBackoffice({\n path: '',\n resourcePage: input.toolsOperationPage ?? null,\n prepare: async () => {\n const toolModule = await entityRegistry.loadToolEntity(\n toolManifest.id,\n );\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n entityConfig: toolModule.config,\n } satisfies BackofficePreparedToolConfigRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolConfigRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n operation={preparedTool.entityConfig.tool.operation}\n toolId={preparedTool.entityConfig.id}\n />\n );\n },\n });\n routeEntityIdMap.set(toolConfigRoute, toolManifest.id);\n\n const toolRoute = rBackoffice({\n path: toolRelative,\n resourcePage: BackofficeToolShellPageResource,\n prepare: () => {\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n } satisfies BackofficePreparedToolRoute;\n },\n render: ({ children: toolChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n prepared={preparedTool}\n >\n {toolChildren}\n </Component>\n );\n },\n children: [toolConfigRoute],\n });\n routeEntityIdMap.set(toolRoute, toolManifest.id);\n return toolRoute;\n });\n\n const layoutRoute = rBackoffice({\n path: baseSegment,\n resourcePage: BackofficeLayoutPageResource,\n prepareSearchBehavior: 'path',\n suspenseBoundary: 'segment',\n prepare: layoutPrepare,\n render: ({ children, prepared, route, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedLayout = prepared as PreparedLayout | undefined;\n const activeEntityId = resolveActiveEntityIdFromRoute(\n route,\n routeEntityIdMap,\n );\n const activeGroupId =\n activeEntityId != null\n ? (entityIdToGroupId.get(activeEntityId) ?? null)\n : resolveActiveEntityIdFromRoute(route, routeGroupIdMap);\n const LayoutComponent = Component as LayoutRouteComponent;\n const authStatusQuery = auth.session.get()?.authStatusQuery ?? null;\n if (authStatusQuery != null && preparedLayout?.authStatusQuery != null) {\n return (\n <BackofficeLayoutRouteWithAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n authStatusQuery={authStatusQuery}\n authStatusPrepared={preparedLayout.authStatusQuery}\n loginRedirectPath={loginRedirectPath}\n >\n {children}\n </BackofficeLayoutRouteWithAuthStatus>\n );\n }\n return (\n <BackofficeLayoutRouteWithoutAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutRouteWithoutAuthStatus>\n );\n },\n children: [\n dashboardRoute,\n ...hubRoutes,\n ...entityRoutes,\n ...toolsRoutes,\n ...secondaryDashboardRoutes,\n dashboardAliasRoute,\n ],\n });\n\n const routes: Route<BackofficeRouterContext, unknown>[] = [\n rBackoffice({\n path: loginPath,\n resourcePage: BackofficeLoginPageResource,\n prepare: async ({ context }) => {\n const loginAuth = await auth.login.load();\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n loginAuth.loginQuery,\n {},\n );\n return { query: queryRef };\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n }),\n rBackoffice({\n path: passwordResetRequestPath,\n resourcePage: BackofficePasswordResetRequestPageResource,\n prepare: async () => {\n await auth.passwordResetRequest.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: passwordResetCompletePath,\n resourcePage: BackofficePasswordResetCompletePageResource,\n prepare: async () => {\n await auth.passwordResetComplete.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: verifyEmailPath,\n resourcePage: BackofficeVerifyEmailPageResource,\n prepare: async () => {\n await auth.verifyEmail.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n ];\n\n if (auth.hasAcceptInvitation === true || auth.acceptInvitation != null) {\n routes.push(\n rBackoffice({\n path: acceptInvitationPath,\n resourcePage: BackofficeAcceptInvitationPageResource,\n prepare: async () => {\n await auth.acceptInvitation?.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n );\n }\n\n routes.push(layoutRoute);\n\n return routes;\n}\n\nexport const __test = {\n normalizeBaseSegment,\n normalizePath,\n buildScopedPath,\n buildScopedAbsolutePath,\n buildRelativePath,\n resolveActiveEntityIdFromRoute,\n resolveDetailPageIdForPath,\n resolveDetailPageManifestByPath,\n validateBackofficeDashboardRegistrations,\n BackofficeLayoutRouteWithAuthStatus,\n} as const;\n\nexport default createBackofficeRoutes;\n"],"mappings":";;;;;;;;;;;AAgEA,IAAM,EAAE,WAAA,GAAW,mBAAA,MAAsB,GAiB5B,IAA2C,EACtD,eAEA,aAAa,EACX,UAAU,MAAM,OAAO,oCAAA,CAAqC,YAC9D,EACF,GAEa,IACX,EACE,wBAEA,YAAY,OAAO,mCACrB,GAEW,IACX,EACE,4BAEA,YAAY,OAAO,uCACrB,GAEW,IACX,EACE,iCAEA,YAAY,OAAO,4CACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,KACX,EACE,8BAEA,YAAY,OAAO,yCACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,oCAEA,YAAY,OAAO,+CACrB,GAEW,IACX,EACE,wCAEA,YAAY,OAAO,mDACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,6CAEA,YAAY,OAAO,wDACrB,GAEW,IACX,EACE,2BAEA,YAAY,OAAO,sCACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,IACX,EACE,2BAEA,YAAY,OAAO,sCACrB,GAEW,IAAiD,EAC5D,qBAEA,YAAY,OAAO,gCACrB,GAEa,KAAmD,EAC9D,uBAEA,YAAY,OAAO,kCACrB,GAEa,KACX,EACE,sCAEA,YAAY,OAAO,iDACrB,GAEW,KACX,EACE,uCAEA,YAAY,OAAO,kDACrB,GAEW,IACX,EACE,6BAEA,YAAY,OAAO,wCACrB,GAEW,IACX,EACE,kCAEA,YAAY,OAAO,6CACrB,GA4CI,KAA6B,EACjC,kBAGU;CACV,IAAM,IAAS,EAAW,CAAc;CAQxC,OANA,QAAgB;EACd,GAAQ,QAAQ,IAAI,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AET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;EAEvB,CAAC;EACD,EAAY;GACV,MAAM;GACN,cAAc;GACd,SAAS,aACP,MAAM,EAAK,sBAAsB,KAAK,GAC/B;GAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;EAEvB,CAAC;EACD,EAAY;GACV,MAAM;GACN,cAAc;GACd,SAAS,aACP,MAAM,EAAK,YAAY,KAAK,GACrB;GAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;EAEvB,CAAC;CACH;CAuBA,QArBI,EAAK,wBAAwB,MAAQ,EAAK,oBAAoB,SAChE,EAAO,KACL,EAAY;EACV,MAAM;EACN,cAAc;EACd,SAAS,aACP,MAAM,EAAK,kBAAkB,KAAK,GAC3B;EAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;CAEvB,CAAC,CACH,GAGF,EAAO,KAAK,EAAW,GAEhB;AACT;AAEA,IAAa,IAAS;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"createBackofficeRoutes.js","names":[],"sources":["../../../src/router/createBackofficeRoutes.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useContext,\n useEffect,\n type ComponentType,\n type JSX,\n type ReactNode,\n} from 'react';\nimport {\n getResourcePage,\n type ResourcePage,\n} from '@plumile/router/ResourcePage.js';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport { r } from '@plumile/router/tools.js';\nimport {\n type RouteNode,\n type Route,\n type RouteFallbackArgs,\n} from '@plumile/router/types.js';\nimport * as ReactRelay from 'react-relay';\nimport type { PreloadedQuery } from 'react-relay';\nimport type {\n Environment,\n GraphQLTaggedNode,\n OperationType,\n Variables,\n} from 'relay-runtime';\n\nimport { BACKOFFICE_LIST_DEFAULTS } from '@plumile/backoffice-core/constants.js';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDetailPageManifestItem,\n BackofficeEntityManifestItem,\n BackofficeEntityManifestMap,\n I18nLabel,\n BackofficePreparedDetailFrameRoute,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficePreparedDetailPageConfigRoute,\n BackofficePreparedDetailPageDataRoute,\n BackofficePreparedDetailShellRoute,\n BackofficePreparedDetailUnknownPageRoute,\n BackofficePreparedListDataRoute,\n BackofficePreparedListLayoutRoute,\n BackofficePreparedListShellRoute,\n BackofficePreparedToolConfigRoute,\n BackofficePreparedToolRoute,\n} from '@plumile/backoffice-core/types.js';\n\nimport type {\n BackofficeAuthConfig,\n BackofficeDashboardRegistration,\n BackofficeDashboardModule,\n BackofficeResolvedSidebarHubConfig,\n BackofficeSidebarConfig,\n} from '../provider/types.js';\nimport {\n buildEntityGroupLookup,\n resolveSidebarHubEntries,\n resolveSidebarGroups,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport type { BackofficeEntityRegistry } from '../provider/entityRegistry.js';\nimport { validateBackofficeDashboardRegistrations } from '../provider/dashboardRegistrations.js';\nimport { BackofficeEntityDetailManifestFallback } from '../pages/detail/BackofficeEntityDetailManifestFallback.js';\n\nconst { loadQuery, usePreloadedQuery } = ReactRelay;\n\nexport type CreateBackofficeRoutesInput = {\n basePath: string;\n entityManifest: BackofficeEntityManifestMap;\n entityRegistry: BackofficeEntityRegistry;\n sidebar?: BackofficeSidebarConfig;\n auth: BackofficeAuthConfig;\n dashboard?: BackofficeDashboardModule;\n dashboards?: readonly BackofficeDashboardRegistration[];\n toolsOperationPage?: ResourcePage | null;\n};\n\nexport type BackofficeRouterContext = {\n relayEnvironment: Environment;\n};\n\n/** @deprecated Structural routes no longer need a page resource. */\nexport const WrapperPageResource: ResourcePage | null = getResourcePage(\n 'WrapperPage',\n // eslint-disable-next-line arrow-body-style\n async () => ({\n default: (await import('@plumile/ui/pages/WrapperPage.js')).WrapperPage,\n }),\n);\n\nexport const BackofficeLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLayoutPage.js'),\n );\n\nexport const BackofficeEntityListPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListPage.js'),\n );\n\nexport const BackofficeEntityListShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListShellPage.js'),\n );\n\nexport const BackofficeEntityListDataPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListDataPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListDataPage.js'),\n );\n\nexport const BackofficeEntityDetailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPage.js'),\n );\n\nexport const BackofficeEntityDetailFramePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailFramePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailFramePage.js'),\n );\n\nexport const BackofficeEntityDetailLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailLayoutPage.js'),\n );\n\nexport const BackofficeEntityDetailPageConfigPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPageConfigPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPageConfigPage.js'),\n );\n\nexport const BackofficeEntityDetailShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailShellPage.js'),\n );\n\nexport const BackofficeEntityDetailUnknownPageRedirectResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailUnknownPageRedirect',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailUnknownPageRedirect.js'),\n );\n\nexport const BackofficeDashboardPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardPage.js'),\n );\n\nexport const BackofficeDashboardShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardShellPage.js'),\n );\n\nexport const BackofficeToolShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeToolShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeToolShellPage.js'),\n );\n\nexport const BackofficeHubPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeHubPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeHubPage.js'),\n);\n\nexport const BackofficeLoginPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeLoginPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLoginPage.js'),\n);\n\nexport const BackofficePasswordResetRequestPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetRequestPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetRequestPage.js'),\n );\n\nexport const BackofficePasswordResetCompletePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetCompletePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetCompletePage.js'),\n );\n\nexport const BackofficeVerifyEmailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeVerifyEmailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeVerifyEmailPage.js'),\n );\n\nexport const BackofficeAcceptInvitationPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeAcceptInvitationPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeAcceptInvitationPage.js'),\n );\n\ntype PreparedLayout = {\n permissionsQuery: PreloadedQuery<OperationType> | null;\n authStatusQuery: PreloadedQuery<OperationType> | null;\n};\n\nexport type BackofficePreparedDashboardShellRoute = {\n dashboardId: string | null;\n label?: I18nLabel;\n};\n\nexport type BackofficePreparedDashboardRoute =\n BackofficePreparedDashboardShellRoute & {\n config: BackofficeDashboardConfig;\n };\n\ntype LayoutAuthStatus = {\n isLoggedIn?: boolean | null;\n me?: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n } | null;\n} | null;\n\ntype LayoutRouteComponent = ComponentType<{\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: LayoutAuthStatus;\n activeGroupId?: string | null;\n}>;\n\ntype LayoutRouteRenderProps = {\n children: ReactNode;\n Component: LayoutRouteComponent;\n preparedLayout: PreparedLayout | undefined;\n permissionsQuery: GraphQLTaggedNode | undefined;\n activeGroupId: string | null;\n};\n\nconst BackofficeHistoryRedirect = ({\n pathname,\n}: {\n pathname: string;\n}): null => {\n const router = useContext(RoutingContext);\n\n useEffect(() => {\n router?.history.set({\n pathname,\n });\n }, [pathname, router]);\n\n return null;\n};\n\nconst BackofficeLayoutRouteWithoutAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n}: LayoutRouteRenderProps): JSX.Element => {\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={null}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nconst BackofficeLayoutRouteWithAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n authStatusQuery,\n authStatusPrepared,\n loginRedirectPath,\n}: LayoutRouteRenderProps & {\n authStatusQuery: GraphQLTaggedNode;\n authStatusPrepared: PreloadedQuery<OperationType>;\n loginRedirectPath: string;\n}): JSX.Element => {\n const data = usePreloadedQuery(authStatusQuery, authStatusPrepared);\n const authStatus = data as LayoutAuthStatus;\n\n if (authStatus?.isLoggedIn !== true) {\n return <BackofficeHistoryRedirect pathname={loginRedirectPath} />;\n }\n\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nexport type BackofficePreparedHubRoute = {\n hubId: string;\n hub: BackofficeResolvedSidebarHubConfig;\n};\n\nconst normalizeBaseSegment = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '' || trimmed === '/') {\n return '';\n }\n return trimmed.replace(/^\\/+|\\/+$/g, '');\n};\n\nconst normalizePath = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '') {\n return '/';\n }\n return `/${trimmed}`.replace(/\\/+/g, '/');\n};\n\nconst buildScopedPath = (baseSegment: string, path: string): string => {\n const normalizedPath = path.replace(/^\\/+|\\/+$/g, '');\n if (baseSegment === '') {\n return normalizedPath;\n }\n if (normalizedPath === '') {\n return baseSegment;\n }\n return `${baseSegment}/${normalizedPath}`;\n};\n\nconst buildScopedAbsolutePath = (baseSegment: string, path: string): string => {\n return normalizePath(buildScopedPath(baseSegment, path));\n};\n\nconst normalizePagePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst buildRelativePath = (\n absolutePath: string,\n baseSegment: string,\n): string => {\n const normalized = normalizePath(absolutePath);\n const basePrefix = baseSegment === '' ? '' : `/${baseSegment}`;\n if (basePrefix !== '' && normalized.startsWith(basePrefix)) {\n return normalized.slice(basePrefix.length).replace(/^\\/+/, '');\n }\n return normalized.replace(/^\\/+/, '');\n};\n\nconst resolveActiveEntityIdFromRoute = (\n route: { routes: RouteNode[] } | null,\n routeEntityIdMap: WeakMap<RouteNode, string>,\n): string | null => {\n if (route?.routes == null) {\n return null;\n }\n for (let index = route.routes.length - 1; index >= 0; index -= 1) {\n const routeEntry = route.routes[index];\n if (routeEntry != null) {\n const entityId = routeEntityIdMap.get(routeEntry);\n if (entityId != null) {\n return entityId;\n }\n }\n }\n return null;\n};\n\nconst resolveDetailPageManifestByPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): BackofficeDetailPageManifestItem | null => {\n const pagePath = normalizePagePath(rawPagePath);\n return (\n entityManifestItem.detailPages?.find((page) => {\n return normalizePagePath(page.pathSegment) === pagePath;\n }) ?? null\n );\n};\n\nconst resolveDetailPageIdForPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): string => {\n return (\n resolveDetailPageManifestByPath(entityManifestItem, rawPagePath)?.id ??\n rawPagePath\n );\n};\n\nconst rBackoffice = r<BackofficeRouterContext>;\n\n/**\n * Creates backoffice routes based on the provided configuration\n */\nexport function createBackofficeRoutes(\n input: CreateBackofficeRoutesInput,\n): Route<BackofficeRouterContext, unknown>[] {\n const { basePath, entityManifest, entityRegistry, sidebar, auth, dashboard } =\n input;\n const dashboards = validateBackofficeDashboardRegistrations(input.dashboards);\n const baseSegment = normalizeBaseSegment(basePath);\n const loginPath = buildScopedPath(baseSegment, 'login');\n const passwordResetRequestPath = buildScopedPath(baseSegment, 'login/reset');\n const passwordResetCompletePath = buildScopedPath(\n baseSegment,\n 'login/reset/complete',\n );\n const verifyEmailPath = buildScopedPath(baseSegment, 'verify-email');\n const acceptInvitationPath = buildScopedPath(\n baseSegment,\n 'accept-invitation',\n );\n const loginRedirectPath = buildScopedAbsolutePath(baseSegment, 'login');\n const entities = entityManifest;\n const groups = resolveSidebarGroups(entities, sidebar);\n const hubEntries = resolveSidebarHubEntries(groups, sidebar);\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const entityIdToGroupId = new Map<string, string>();\n entityGroupLookup.forEach((value, entityId) => {\n entityIdToGroupId.set(entityId, value.groupId);\n });\n const routeEntityIdMap = new WeakMap<RouteNode, string>();\n const routeGroupIdMap = new WeakMap<RouteNode, string>();\n\n const permissionsQuery = sidebar?.permissionsQuery;\n const layoutPrepare = async ({\n context,\n }: {\n context: BackofficeRouterContext;\n }) => {\n const sessionAuth = await auth.session.load();\n const permissionsQueryRef =\n permissionsQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n permissionsQuery,\n {},\n )\n : null;\n const authStatusQueryRef =\n sessionAuth.authStatusQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n sessionAuth.authStatusQuery,\n {},\n { fetchPolicy: 'network-only' },\n )\n : null;\n return {\n permissionsQuery: permissionsQueryRef,\n authStatusQuery: authStatusQueryRef,\n };\n };\n\n const prepareRootDashboard =\n async (): Promise<BackofficePreparedDashboardRoute | null> => {\n if (dashboard == null) {\n return null;\n }\n const config = await dashboard.load();\n return {\n dashboardId: 'dashboard',\n config,\n };\n };\n const prepareRootDashboardShell =\n (): BackofficePreparedDashboardShellRoute | null => {\n if (dashboard == null) {\n return null;\n }\n return {\n dashboardId: 'dashboard',\n };\n };\n const renderDashboard = ({\n prepared,\n Component,\n }: {\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardComponent = Component as ComponentType<{\n prepared?: unknown;\n }>;\n return <DashboardComponent prepared={prepared} />;\n };\n const renderDashboardShell = ({\n children: dashboardChildren,\n prepared,\n Component,\n }: {\n children: ReactNode;\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardShellComponent = Component as ComponentType<{\n children?: ReactNode;\n prepared?: BackofficePreparedDashboardShellRoute | null;\n }>;\n return (\n <DashboardShellComponent\n prepared={prepared as BackofficePreparedDashboardShellRoute | null}\n >\n {dashboardChildren}\n </DashboardShellComponent>\n );\n };\n\n const dashboardConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardConfigRoute],\n });\n const dashboardAliasConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardAliasRoute = rBackoffice({\n path: 'dashboard',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardAliasConfigRoute],\n });\n const secondaryDashboardRoutes = dashboards.map((registration) => {\n const dashboardConfigChildRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: async () => {\n const config = await registration.module.load();\n return {\n dashboardId: registration.id,\n label: registration.label,\n config,\n } satisfies BackofficePreparedDashboardRoute;\n },\n render: renderDashboard,\n });\n return rBackoffice({\n path: `dashboard/${registration.id}`,\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: () => {\n return {\n dashboardId: registration.id,\n label: registration.label,\n } satisfies BackofficePreparedDashboardShellRoute;\n },\n render: renderDashboardShell,\n children: [dashboardConfigChildRoute],\n });\n });\n\n const listEntityEntries = Object.values(entityManifest).filter((entity) => {\n return entity.kind === 'list-detail';\n });\n\n const hubRoutes = hubEntries.map((entry) => {\n const hubRelative = buildRelativePath(entry.hub.href, baseSegment);\n const hubRoute = rBackoffice({\n path: hubRelative,\n resourcePage: BackofficeHubPageResource,\n prepare: () => {\n return {\n hubId: entry.hub.id,\n hub: entry.hub,\n } satisfies BackofficePreparedHubRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n });\n if (entry.groupId != null) {\n routeGroupIdMap.set(hubRoute, entry.groupId);\n }\n return hubRoute;\n });\n\n const entityRoutes = listEntityEntries.map((entityManifestItem) => {\n const listPath = entityManifestItem.routes.list;\n const listRelative = buildRelativePath(listPath, baseSegment);\n const children: Route<unknown, unknown>[] = [];\n const renderDetailRouteFallback = ({\n match,\n }: RouteFallbackArgs<BackofficeRouterContext>): JSX.Element => {\n const rawId = String(match?.params.id ?? '');\n const rawPagePath =\n typeof match?.params.pagePath === 'string'\n ? match.params.pagePath\n : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return (\n <BackofficeEntityDetailManifestFallback\n entityManifest={entityManifestItem}\n id={rawId}\n pageId={pageId}\n pagePath={rawPagePath}\n />\n );\n };\n\n if (entityManifestItem.hasList) {\n const listDataRoute = rBackoffice({\n path: '',\n querySchema: entityManifestItem.listNavigation.querySchema,\n resourcePage: BackofficeEntityListDataPageResource,\n prepareSearchBehavior: 'path',\n prepare: async ({ context, filters, query }) => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const { list } = config;\n const { defaults: listDefaults } = entityManifestItem.listNavigation;\n const navigationQuery: { sort?: string } = {};\n if (typeof query.sort === 'string') {\n navigationQuery.sort = query.sort;\n }\n const navigationFilters = filters as Parameters<\n typeof entityManifestItem.listNavigation.decode\n >[0]['filters'];\n const state = entityManifestItem.listNavigation.decode({\n filters: navigationFilters,\n query: navigationQuery,\n });\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = list.buildQueryVariables(variablesBase);\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n list.query,\n variables,\n );\n const prepared: BackofficePreparedListDataRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n query: queryRef,\n };\n return prepared;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(listDataRoute, entityManifestItem.id);\n\n const listRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListPageResource,\n prepareSearchBehavior: 'path',\n prepare: async () => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const prepared: BackofficePreparedListLayoutRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n };\n return prepared;\n },\n render: ({ children: listChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListLayoutRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {listChildren}\n </Component>\n );\n },\n children: [listDataRoute],\n });\n routeEntityIdMap.set(listRoute, entityManifestItem.id);\n\n const listShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListShellPageResource,\n prepareSearchBehavior: 'path',\n prepare: () => {\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n } satisfies BackofficePreparedListShellRoute;\n },\n render: ({ children: listShellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {listShellChildren}\n </Component>\n );\n },\n children: [listRoute],\n });\n routeEntityIdMap.set(listShellRoute, entityManifestItem.id);\n children.push(listShellRoute);\n }\n\n const detailPageRoutes = entityManifestItem.detailPages.map(\n (pageManifest) => {\n const pageDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const rawId = String(variables.id ?? '');\n const pageModule = await entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n );\n const pageBuildResult =\n pageModule.config.page.buildVariables != null\n ? pageModule.config.page.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const pageQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n pageModule.config.page.query,\n pageBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n detailId: pageBuildResult.detailId,\n id: rawId,\n pageConfig: pageModule.config,\n pageQuery: pageQueryRef,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageDataRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(pageDataRoute, entityManifestItem.id);\n\n const pageConfigRoute = rBackoffice({\n path: pageManifest.pathSegment,\n resourcePage: BackofficeEntityDetailPageConfigPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const [pageModule, layoutModule] = await Promise.all([\n entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n ),\n entityRegistry.loadDetailLayoutEntity(entityManifestItem.id),\n ]);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: layoutModule.config,\n id: rawId,\n pageConfig: pageModule.config,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageConfigRoute;\n },\n render: ({ children: pageChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageConfigRoute;\n return (\n <Component\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {pageChildren}\n </Component>\n );\n },\n children: [pageDataRoute],\n });\n routeEntityIdMap.set(pageConfigRoute, entityManifestItem.id);\n return pageConfigRoute;\n },\n );\n\n const detailLayoutDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailLayoutPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const rawId = String(variables.id ?? '');\n const layoutBuildResult =\n config.layoutPage.buildVariables != null\n ? config.layoutPage.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const layoutQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n config.layoutPage.query,\n layoutBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n layoutQuery: layoutQueryRef,\n id: rawId,\n } satisfies BackofficePreparedDetailLayoutDataRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailLayoutDataRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [\n rBackoffice({\n path: '',\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '').trim();\n return {\n redirectTo:\n rawId === ''\n ? null\n : entityManifestItem.routes.detailPage(\n rawId,\n entityManifestItem.defaultDetailPageId,\n ),\n };\n },\n render: ({ prepared }) => {\n const redirectTo =\n (prepared as { redirectTo?: string | null }).redirectTo ?? null;\n if (redirectTo == null) {\n return null;\n }\n return <BackofficeHistoryRedirect pathname={redirectTo} />;\n },\n }),\n ...detailPageRoutes,\n rBackoffice({\n path: ':pagePath',\n resourcePage: BackofficeEntityDetailUnknownPageRedirectResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const rawId = String(variables.id ?? '');\n const rawPagePath = String(variables.pagePath ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: entityModule.config,\n id: rawId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailUnknownPageRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedDetail =\n prepared as BackofficePreparedDetailUnknownPageRoute;\n return (\n <Component\n entityManifest={preparedDetail.entityManifest}\n config={preparedDetail.entityConfig}\n prepared={preparedDetail}\n />\n );\n },\n }),\n ],\n });\n routeEntityIdMap.set(detailLayoutDataRoute, entityManifestItem.id);\n\n const detailShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailShellPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const rawPagePath =\n typeof variables.pagePath === 'string' ? variables.pagePath : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n pageId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailShellRoute;\n },\n render: ({ children: shellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {shellChildren}\n </Component>\n );\n },\n children: [detailLayoutDataRoute],\n });\n routeEntityIdMap.set(detailShellRoute, entityManifestItem.id);\n\n const detailFrameRoute = rBackoffice({\n path: ':id',\n resourcePage: BackofficeEntityDetailFramePageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n } satisfies BackofficePreparedDetailFrameRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailFrameRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [detailShellRoute],\n });\n routeEntityIdMap.set(detailFrameRoute, entityManifestItem.id);\n children.push(detailFrameRoute);\n\n return rBackoffice({\n path: listRelative,\n children,\n suspenseBoundary: 'segment',\n });\n });\n\n const toolsRoutes = Object.values(entityManifest)\n .filter((entity) => {\n return entity.kind === 'tool';\n })\n .map((toolManifest) => {\n const toolRelative = buildRelativePath(\n toolManifest.routes.list,\n baseSegment,\n );\n const toolConfigRoute = rBackoffice({\n path: '',\n resourcePage: input.toolsOperationPage ?? null,\n prepare: async () => {\n const toolModule = await entityRegistry.loadToolEntity(\n toolManifest.id,\n );\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n entityConfig: toolModule.config,\n } satisfies BackofficePreparedToolConfigRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolConfigRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n operation={preparedTool.entityConfig.tool.operation}\n toolId={preparedTool.entityConfig.id}\n />\n );\n },\n });\n routeEntityIdMap.set(toolConfigRoute, toolManifest.id);\n\n const toolRoute = rBackoffice({\n path: toolRelative,\n resourcePage: BackofficeToolShellPageResource,\n prepare: () => {\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n } satisfies BackofficePreparedToolRoute;\n },\n render: ({ children: toolChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n prepared={preparedTool}\n >\n {toolChildren}\n </Component>\n );\n },\n children: [toolConfigRoute],\n });\n routeEntityIdMap.set(toolRoute, toolManifest.id);\n return toolRoute;\n });\n\n const layoutRoute = rBackoffice({\n path: baseSegment,\n resourcePage: BackofficeLayoutPageResource,\n prepareSearchBehavior: 'path',\n suspenseBoundary: 'segment',\n prepare: layoutPrepare,\n render: ({ children, prepared, route, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedLayout = prepared as PreparedLayout | undefined;\n const activeEntityId = resolveActiveEntityIdFromRoute(\n route,\n routeEntityIdMap,\n );\n const activeGroupId =\n activeEntityId != null\n ? (entityIdToGroupId.get(activeEntityId) ?? null)\n : resolveActiveEntityIdFromRoute(route, routeGroupIdMap);\n const LayoutComponent = Component as LayoutRouteComponent;\n const authStatusQuery = auth.session.get()?.authStatusQuery ?? null;\n if (authStatusQuery != null && preparedLayout?.authStatusQuery != null) {\n return (\n <BackofficeLayoutRouteWithAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n authStatusQuery={authStatusQuery}\n authStatusPrepared={preparedLayout.authStatusQuery}\n loginRedirectPath={loginRedirectPath}\n >\n {children}\n </BackofficeLayoutRouteWithAuthStatus>\n );\n }\n return (\n <BackofficeLayoutRouteWithoutAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutRouteWithoutAuthStatus>\n );\n },\n children: [\n dashboardRoute,\n ...hubRoutes,\n ...entityRoutes,\n ...toolsRoutes,\n ...secondaryDashboardRoutes,\n dashboardAliasRoute,\n ],\n });\n\n const routes: Route<BackofficeRouterContext, unknown>[] = [\n rBackoffice({\n path: loginPath,\n resourcePage: BackofficeLoginPageResource,\n prepare: async ({ context }) => {\n const loginAuth = await auth.login.load();\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n loginAuth.loginQuery,\n {},\n );\n return { query: queryRef };\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n }),\n rBackoffice({\n path: passwordResetRequestPath,\n resourcePage: BackofficePasswordResetRequestPageResource,\n prepare: async () => {\n await auth.passwordResetRequest.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: passwordResetCompletePath,\n resourcePage: BackofficePasswordResetCompletePageResource,\n prepare: async () => {\n await auth.passwordResetComplete.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: verifyEmailPath,\n resourcePage: BackofficeVerifyEmailPageResource,\n prepare: async () => {\n await auth.verifyEmail.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n ];\n\n if (auth.hasAcceptInvitation === true || auth.acceptInvitation != null) {\n routes.push(\n rBackoffice({\n path: acceptInvitationPath,\n resourcePage: BackofficeAcceptInvitationPageResource,\n prepare: async () => {\n await auth.acceptInvitation?.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n );\n }\n\n routes.push(layoutRoute);\n\n return routes;\n}\n\nexport const __test = {\n normalizeBaseSegment,\n normalizePath,\n buildScopedPath,\n buildScopedAbsolutePath,\n buildRelativePath,\n resolveActiveEntityIdFromRoute,\n resolveDetailPageIdForPath,\n resolveDetailPageManifestByPath,\n validateBackofficeDashboardRegistrations,\n BackofficeLayoutRouteWithAuthStatus,\n} as const;\n\nexport default createBackofficeRoutes;\n"],"mappings":";;;;;;;;;;;AAgEA,IAAM,EAAE,WAAA,GAAW,mBAAA,MAAsB,GAkB5B,IAA2C,EACtD,eAEA,aAAa,EACX,UAAU,MAAM,OAAO,oCAAA,CAAqC,YAC9D,EACF,GAEa,IACX,EACE,wBAEA,YAAY,OAAO,mCACrB,GAEW,IACX,EACE,4BAEA,YAAY,OAAO,uCACrB,GAEW,IACX,EACE,iCAEA,YAAY,OAAO,4CACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,KACX,EACE,8BAEA,YAAY,OAAO,yCACrB,GAEW,IACX,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