@australiangreens/ag-internal-components 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/components/AuthGuard/AuthGuard.d.ts.map +1 -1
  4. package/dist/components/SessionExpiryDialog/index.d.ts.map +1 -1
  5. package/dist/components/index.d.ts +1 -3
  6. package/dist/components/index.d.ts.map +1 -1
  7. package/dist/domainCode/DomainCodeDialog.d.ts +3 -2
  8. package/dist/domainCode/DomainCodeDialog.d.ts.map +1 -1
  9. package/dist/esm/index.js +799 -990
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/index.d.ts +3 -1
  12. package/dist/layouts/AppLayout/NavBar/UserInfo.d.ts.map +1 -1
  13. package/dist/testing/wrappers.d.ts.map +1 -1
  14. package/package.json +9 -22
  15. package/dist/components/NavBar/NavBar.comp.test.d.ts +0 -2
  16. package/dist/components/NavBar/NavBar.comp.test.d.ts.map +0 -1
  17. package/dist/components/NavBar/NavBar.d.ts +0 -22
  18. package/dist/components/NavBar/NavBar.d.ts.map +0 -1
  19. package/dist/components/NavBar/NavBarContext.d.ts +0 -17
  20. package/dist/components/NavBar/NavBarContext.d.ts.map +0 -1
  21. package/dist/components/NavBar/NavBarDarkStyledList.d.ts +0 -3
  22. package/dist/components/NavBar/NavBarDarkStyledList.d.ts.map +0 -1
  23. package/dist/components/NavBar/NavBarLightStyledList.d.ts +0 -3
  24. package/dist/components/NavBar/NavBarLightStyledList.d.ts.map +0 -1
  25. package/dist/components/NavBar/NavBarLink.d.ts +0 -16
  26. package/dist/components/NavBar/NavBarLink.d.ts.map +0 -1
  27. package/dist/components/NavBar/NavBarLink.unit.test.d.ts +0 -2
  28. package/dist/components/NavBar/NavBarLink.unit.test.d.ts.map +0 -1
  29. package/dist/components/NavBar/Styling.d.ts +0 -16
  30. package/dist/components/NavBar/Styling.d.ts.map +0 -1
  31. package/dist/components/NavBar/index.d.ts +0 -9
  32. package/dist/components/NavBar/index.d.ts.map +0 -1
  33. package/dist/components/NavBar/index.stories.d.ts +0 -7
  34. package/dist/components/NavBar/index.stories.d.ts.map +0 -1
  35. package/dist/components/NavBar/testWrappers.d.ts +0 -6
  36. package/dist/components/NavBar/testWrappers.d.ts.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,710 +1,147 @@
1
- var rt = Object.defineProperty, at = Object.defineProperties;
2
- var st = Object.getOwnPropertyDescriptors;
3
- var G = Object.getOwnPropertySymbols;
4
- var ue = Object.prototype.hasOwnProperty, pe = Object.prototype.propertyIsEnumerable;
5
- var j = (e, t, o) => t in e ? rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, d = (e, t) => {
6
- for (var o in t || (t = {}))
7
- ue.call(t, o) && j(e, o, t[o]);
8
- if (G)
9
- for (var o of G(t))
10
- pe.call(t, o) && j(e, o, t[o]);
1
+ var Ve = Object.defineProperty, Ke = Object.defineProperties;
2
+ var Xe = Object.getOwnPropertyDescriptors;
3
+ var q = Object.getOwnPropertySymbols;
4
+ var ie = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
5
+ var Y = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, u = (e, t) => {
6
+ for (var n in t || (t = {}))
7
+ ie.call(t, n) && Y(e, n, t[n]);
8
+ if (q)
9
+ for (var n of q(t))
10
+ re.call(t, n) && Y(e, n, t[n]);
11
11
  return e;
12
- }, D = (e, t) => at(e, st(t));
13
- var he = (e, t) => {
14
- var o = {};
12
+ }, E = (e, t) => Ke(e, Xe(t));
13
+ var ae = (e, t) => {
14
+ var n = {};
15
15
  for (var i in e)
16
- ue.call(e, i) && t.indexOf(i) < 0 && (o[i] = e[i]);
17
- if (e != null && G)
18
- for (var i of G(e))
19
- t.indexOf(i) < 0 && pe.call(e, i) && (o[i] = e[i]);
20
- return o;
16
+ ie.call(e, i) && t.indexOf(i) < 0 && (n[i] = e[i]);
17
+ if (e != null && q)
18
+ for (var i of q(e))
19
+ t.indexOf(i) < 0 && re.call(e, i) && (n[i] = e[i]);
20
+ return n;
21
21
  };
22
- var fe = (e, t, o) => j(e, typeof t != "symbol" ? t + "" : t, o);
23
- var N = (e, t, o) => new Promise((i, r) => {
24
- var a = (l) => {
22
+ var se = (e, t, n) => Y(e, typeof t != "symbol" ? t + "" : t, n);
23
+ var N = (e, t, n) => new Promise((i, r) => {
24
+ var s = (l) => {
25
25
  try {
26
- s(o.next(l));
27
- } catch (u) {
28
- r(u);
26
+ a(n.next(l));
27
+ } catch (d) {
28
+ r(d);
29
29
  }
30
30
  }, c = (l) => {
31
31
  try {
32
- s(o.throw(l));
33
- } catch (u) {
34
- r(u);
32
+ a(n.throw(l));
33
+ } catch (d) {
34
+ r(d);
35
35
  }
36
- }, s = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(a, c);
37
- s((o = o.apply(e, t)).next());
36
+ }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(s, c);
37
+ a((n = n.apply(e, t)).next());
38
38
  });
39
- import { jsxs as m, Fragment as T, jsx as n } from "react/jsx-runtime";
40
- import { useState as L, createContext as Me, useCallback as K, useContext as Te, createElement as oe, useEffect as ne, useMemo as lt, useRef as ee } from "react";
41
- import { Typography as _, Button as W, Paper as Le, Box as E, Drawer as Be, useTheme as J, useMediaQuery as ct, Collapse as dt, Avatar as me, Fade as ut, Skeleton as ge, Toolbar as pt, Divider as xe, Container as ht, IconButton as ft, Dialog as Pe, LinearProgress as Re, DialogTitle as Oe, DialogContent as He, DialogActions as Ue, Autocomplete as ie, TextField as re, CircularProgress as ae, Chip as mt, Tooltip as gt, Stack as xt, Snackbar as vt, Alert as Ct, FormHelperText as At } from "@mui/material";
42
- import We from "@mui/material/CssBaseline";
43
- import { styled as z, createTheme as ze, alpha as te } from "@mui/material/styles";
44
- import { createHelper as se } from "souvlaki";
45
- import { BrowserRouter as wt } from "react-router";
46
- import Ve from "@mui/material/List";
47
- import { ViewHeadline as St, Cancel as bt, ArrowDropDown as kt } from "@mui/icons-material";
48
- import { atom as M, useSetAtom as qe, useAtomValue as ve, useAtom as O } from "jotai";
49
- import Ce from "@mui/material/Box";
50
- import { useHydrateAtoms as yt } from "jotai/utils";
51
- import Ae from "react-avatar";
52
- import { useAuth0 as le } from "@auth0/auth0-react";
53
- import { useQuery as Ge } from "@tanstack/react-query";
54
- import Dt from "autosuggest-highlight/match";
55
- import It from "autosuggest-highlight/parse";
56
- import { Buffer as $t } from "buffer";
57
- import Ft from "@mui/material/Skeleton";
58
- function Wo({ text: e }) {
59
- const [t, o] = L(0);
60
- return /* @__PURE__ */ m(T, { children: [
61
- /* @__PURE__ */ n(_, { variant: "h6", color: "inherit", component: "div", sx: { fontSize: "22px" }, children: "Hello world" }),
62
- /* @__PURE__ */ n(_, { variant: "caption", display: "block", children: /* @__PURE__ */ n("span", { children: "Just ensuring MUI is working as planned as a peer dependency. v0.0.11" }) }),
63
- /* @__PURE__ */ n(
64
- W,
39
+ import { jsxs as f, Fragment as $, jsx as o } from "react/jsx-runtime";
40
+ import { useState as O, createElement as Z, useEffect as le, useMemo as Ye, createContext as Qe, useRef as Q, useCallback as ce, useContext as Je } from "react";
41
+ import { Typography as _, Button as U, Paper as be, Dialog as Fe, LinearProgress as Ee, DialogTitle as Ie, DialogContent as _e, DialogActions as Te, Autocomplete as j, TextField as ee, CircularProgress as te, Box as T, Chip as Ze, Tooltip as je, Stack as et, Snackbar as tt, Alert as nt, FormHelperText as ot, useTheme as K, useMediaQuery as it, Drawer as rt, Collapse as at, Avatar as de, Fade as st, Skeleton as ue, Toolbar as lt, Divider as pe, Container as ct, IconButton as dt } from "@mui/material";
42
+ import { Cancel as ut, ArrowDropDown as pt, ViewHeadline as ht } from "@mui/icons-material";
43
+ import mt from "autosuggest-highlight/match";
44
+ import ft from "autosuggest-highlight/parse";
45
+ import { useQuery as Ne } from "@tanstack/react-query";
46
+ import { useAuth0 as ne } from "@auth0/auth0-react";
47
+ import { Buffer as gt } from "buffer";
48
+ import xt from "@mui/material/Skeleton";
49
+ import { atom as P, useAtom as R, useSetAtom as Pe, useAtomValue as he } from "jotai";
50
+ import { createHelper as At } from "souvlaki";
51
+ import Ct from "@mui/material/CssBaseline";
52
+ import me from "@mui/material/Box";
53
+ import { useHydrateAtoms as vt } from "jotai/utils";
54
+ import { styled as $e, createTheme as Me, alpha as J } from "@mui/material/styles";
55
+ import fe from "react-avatar";
56
+ function Sn({ text: e }) {
57
+ const [t, n] = O(0);
58
+ return /* @__PURE__ */ f($, { children: [
59
+ /* @__PURE__ */ o(_, { variant: "h6", color: "inherit", component: "div", sx: { fontSize: "22px" }, children: "Hello world" }),
60
+ /* @__PURE__ */ o(_, { variant: "caption", display: "block", children: /* @__PURE__ */ o("span", { children: "Just ensuring MUI is working as planned as a peer dependency. v0.0.11" }) }),
61
+ /* @__PURE__ */ o(
62
+ U,
65
63
  {
66
64
  variant: "outlined",
67
- onClick: () => o((i) => i + 1),
65
+ onClick: () => n((i) => i + 1),
68
66
  "aria-label": "Increment",
69
67
  children: "Hello I am a button"
70
68
  }
71
69
  ),
72
- /* @__PURE__ */ m("p", { children: [
70
+ /* @__PURE__ */ f("p", { children: [
73
71
  "This is some text: ",
74
- /* @__PURE__ */ n("span", { children: e })
72
+ /* @__PURE__ */ o("span", { children: e })
75
73
  ] }),
76
- /* @__PURE__ */ m(Le, { children: [
74
+ /* @__PURE__ */ f(be, { children: [
77
75
  "This number will incremember when button pressed: ",
78
76
  t
79
77
  ] })
80
78
  ] });
81
79
  }
82
- const Xe = 330, Ye = 73, B = "Navbar", H = {
83
- root: `${B}-root`,
84
- menuButton: `${B}-menuButton`,
85
- hide: `${B}-hide`,
86
- content: `${B}-content`,
87
- userInfoHolder: `${B}-userInfoHolder`,
88
- settings: `${B}-settings`,
89
- pieChartIcon: `${B}-pieChartIcon`
90
- }, Et = z(E, {
91
- name: "NavBar"
92
- })(({ theme: e }) => ({
93
- [`&.${H.root}`]: {
94
- display: "flex"
95
- },
96
- [`& .${H.menuButton}`]: {
97
- marginRight: 36
98
- },
99
- [`& .${H.hide}`]: {
100
- display: "none"
101
- },
102
- [`& .${H.content}`]: {
103
- flexGrow: 1,
104
- padding: e.spacing(3)
105
- },
106
- [`& .${H.userInfoHolder}`]: {
107
- height: "148px",
108
- marginTop: "64px",
109
- marginBottom: "16px"
110
- }
111
- })), Ke = () => ({
112
- position: "absolute",
113
- height: "100%",
114
- overflowX: "hidden",
115
- overflowY: "hidden",
116
- color: "white",
117
- backgroundColor: "black"
118
- // backgroundColor: '#e8e8e8',
119
- }), Nt = () => d({
120
- width: Xe
121
- }, Ke()), _t = () => d({
122
- width: Ye
123
- }, Ke()), Mt = z(Be, {
124
- shouldForwardProp: (e) => e !== "open"
125
- })(({ theme: e, open: t }) => d(d({
126
- width: t ? Xe : Ye,
127
- flexShrink: 0,
128
- whiteSpace: "nowrap",
129
- boxSizing: "border-box",
130
- zIndex: e.zIndex.drawer + 100
131
- }, t && {
132
- "& .MuiDrawer-paper": Nt()
133
- }), !t && {
134
- "& .MuiDrawer-paper": _t()
135
- }));
136
- class ce extends Error {
137
- }
138
- fe(ce, "errorName", "ContextError");
139
- const Qe = Me(null), Tt = {}, Lt = {}, Bt = ({
140
- overrideState: e = Tt,
141
- overrideActions: t = Lt,
142
- children: o
143
- }) => {
144
- const [{ open: i }, r] = L({ open: !0 }), a = K((l) => {
145
- r({ open: l });
146
- }, []), c = K(() => {
147
- r((l) => D(d({}, l), { open: !l.open }));
148
- }, []), s = d(d({
149
- open: i,
150
- setOpen: a,
151
- toggleOpen: c
152
- }, e), t);
153
- return /* @__PURE__ */ n(Qe.Provider, { value: s, children: o });
154
- }, Pt = () => {
155
- const e = Te(Qe);
156
- if (e === null)
157
- throw new ce("Error: Tried to useNavBar outside of a <NavBarProvider>");
158
- return e;
159
- }, Rt = (e = {}) => d({
160
- open: !0
161
- }, e), zo = se(
162
- (e = Rt(), t = {}) => ({ children: o }) => /* @__PURE__ */ n(Bt, { overrideState: e, overrideActions: t, children: o })
163
- ), Vo = se(() => ({ children: e }) => /* @__PURE__ */ n(wt, { children: e })), we = 7, qo = z(Ve)(({ theme: e }) => ({
164
- backgroundColor: "black",
165
- color: "white",
166
- "& .MuiListItem-root": {
167
- padding: "unset"
168
- },
169
- "& .MuiListItemButton-root": {
170
- " .MuiListItemIcon-root": {
171
- color: "white",
172
- padding: `${we}px`
173
- },
174
- // Focus state
175
- "&.Mui-focusVisible": {
176
- backgroundColor: e.palette.grey[700]
177
- },
178
- // Selected state
179
- "&.Mui-selected": {
180
- borderLeftStyle: "solid",
181
- borderLeftWidth: "7px",
182
- borderLeftColor: e.palette.primary.main,
183
- paddingLeft: `calc(${e.spacing(2)} - ${we}px)`
184
- },
185
- // Hover state
186
- "&:hover": {
187
- backgroundColor: e.palette.primary.dark
188
- },
189
- // Focus+Selected state
190
- "&.Mui-selected.Mui-focusVisible": {
191
- backgroundColor: e.palette.grey[700]
192
- },
193
- // Hover+Selected state
194
- "&.Mui-selected:hover": {
195
- backgroundColor: e.palette.primary.dark
196
- }
197
- // Focus+Hover+Selected state doesn't need to be specified
198
- // '&.Mui-selected.Mui-focusVisible:hover': {
199
- // },
200
- }
201
- })), Se = 7, Go = z(Ve)(({ theme: e }) => ({
202
- backgroundColor: "#e8e8e8",
203
- color: "inherit",
204
- "& .MuiListItem-root": {
205
- padding: "unset"
206
- },
207
- "& .MuiListItemButton-root": {
208
- " .MuiListItemIcon-root": {
209
- color: "inherit",
210
- padding: `${Se}px`
211
- },
212
- // Focus state
213
- "&.Mui-focusVisible": {
214
- backgroundColor: e.palette.grey[700]
215
- },
216
- // Selected state
217
- "&.Mui-selected": {
218
- borderLeftStyle: "solid",
219
- borderLeftWidth: "7px",
220
- borderLeftColor: e.palette.primary.main,
221
- paddingLeft: `calc(${e.spacing(2)} - ${Se}px)`
222
- },
223
- // Hover state
224
- "&:hover": {
225
- backgroundColor: e.palette.primary.dark
226
- },
227
- // Focus+Selected state
228
- "&.Mui-selected.Mui-focusVisible": {
229
- backgroundColor: e.palette.grey[700]
230
- },
231
- // Hover+Selected state
232
- "&.Mui-selected:hover": {
233
- backgroundColor: e.palette.primary.dark
234
- }
235
- // Focus+Hover+Selected state doesn't need to be specified
236
- // '&.Mui-selected.Mui-focusVisible:hover': {
237
- // },
238
- }
239
- }));
240
- function Xo({
241
- "data-testid": e,
242
- children: t
243
- }) {
244
- const { open: o } = Pt();
245
- return /* @__PURE__ */ m(Et, { className: H.root, "data-testid": e, children: [
246
- /* @__PURE__ */ n(We, {}),
247
- /* @__PURE__ */ n(
248
- Mt,
249
- {
250
- variant: "permanent",
251
- anchor: "left",
252
- transitionDuration: null,
253
- open: o,
254
- children: t
255
- }
256
- )
257
- ] });
258
- }
259
- const Je = () => {
260
- const e = J();
261
- return ct(e.breakpoints.down("sm"));
262
- }, Ot = 64, Ht = 72, Ut = 256, Q = M(!0), Wt = M(Ut), zt = M(Ht), be = M(""), Vt = M(void 0), qt = M(Ot), Gt = M(void 0);
263
- function Xt({ links: e }) {
264
- return /* @__PURE__ */ n("div", { children: "LinksMenu not implemented yet" });
265
- }
266
- const X = "Navbar", q = {
267
- root: `${X}-root`,
268
- menuButton: `${X}-menuButton`,
269
- hide: `${X}-hide`,
270
- content: `${X}-content`
271
- // userInfoHolder: `${PREFIX}-userInfoHolder`,
272
- // settings: `${PREFIX}-settings`,
273
- // pieChartIcon: `${PREFIX}-pieChartIcon`,
274
- }, Yt = z(E, { name: "NavBar" })(({ theme: e }) => ({
275
- [`&.${q.root}`]: {
276
- display: "flex"
277
- },
278
- [`& .${q.menuButton}`]: {
279
- marginRight: 36
280
- },
281
- [`& .${q.hide}`]: {
282
- display: "none"
283
- },
284
- [`& .${q.content}`]: {
285
- flexGrow: 1,
286
- padding: e.spacing(3)
287
- }
288
- // [`& .${classes.userInfoHolder}`]: {
289
- // height: '148px',
290
- // marginTop: '64px',
291
- // marginBottom: '16px',
292
- // },
293
- })), U = (e, t, o) => e.transitions.create(t, {
294
- easing: e.transitions.easing.sharp,
295
- duration: o === "leaving" ? e.transitions.duration.leavingScreen : e.transitions.duration.enteringScreen
296
- }), Kt = (e) => {
297
- const t = J();
298
- return /* @__PURE__ */ n(
299
- dt,
300
- d({
301
- easing: t.transitions.easing.sharp,
302
- timeout: {
303
- enter: t.transitions.duration.enteringScreen,
304
- exit: t.transitions.duration.leavingScreen
305
- }
306
- }, e)
307
- );
308
- }, Ze = (e) => {
309
- var t, o;
310
- return {
311
- overflowX: "hidden",
312
- color: "inherit",
313
- backgroundColor: (o = (t = e == null ? void 0 : e.navBar) == null ? void 0 : t.backgroundColor) != null ? o : "white"
314
- // Provide default so tests don't need to wrap theme provider
315
- };
316
- }, ke = (e, t) => d({
317
- width: t,
318
- transition: U(e, "width", "entering")
319
- }, Ze(e)), ye = (e, t) => d({
320
- width: t,
321
- transition: U(e, "width", "leaving")
322
- }, Ze(e)), Qt = z(Be, {
323
- shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
324
- })(({ theme: e, open: t, widthOpen: o, widthClosed: i, isSmallScreen: r }) => d(d({
325
- flexShrink: 0,
326
- whiteSpace: "nowrap",
327
- boxSizing: "border-box",
328
- display: "flex",
329
- flexDirection: "column"
330
- }, t && D(d({}, ke(e, o)), {
331
- backgroundColor: "",
332
- "& .MuiDrawer-paper": ke(e, o)
333
- })), !t && D(d({}, ye(e, r ? o : i)), {
334
- backgroundColor: "",
335
- "& .MuiDrawer-paper": ye(e, r ? o : i)
336
- })));
337
- function je(e) {
338
- return e.replace(
339
- /(^|-)([a-z])/g,
340
- (t, o, i) => o === "-" ? " " + i.toUpperCase() : i.toUpperCase()
341
- );
342
- }
343
- function Yo(e, t, o, i) {
344
- var c;
345
- if (!e) return "None";
346
- const a = Object.entries(e).filter(
347
- ([s, l]) => s.startsWith("https://greens.org.au/roles/") && l.includes(t)
348
- ).map(
349
- ([s]) => {
350
- var l;
351
- return je((l = s.split("/").at(-1)) != null ? l : "");
352
- }
353
- );
354
- return (c = i.find(
355
- (s) => o[s].some((l) => a.includes(l))
356
- )) != null ? c : "None";
357
- }
358
- const Ko = (e) => {
359
- const { getIdTokenClaims: t, user: o } = le();
360
- return Ge({
361
- queryKey: ["availableDomains", o == null ? void 0 : o.sub],
362
- queryFn: () => N(null, null, function* () {
363
- const i = yield t();
364
- return i ? Object.entries(i).reduce((r, [a, c]) => {
365
- var u;
366
- const s = je((u = a.split("/").at(-1)) != null ? u : ""), l = a.startsWith("https://greens.org.au/roles/") && e.includes(s) ? c : [];
367
- return [.../* @__PURE__ */ new Set([...r, ...l])];
368
- }, []) : [];
369
- })
370
- });
371
- }, Qo = (e) => Object.values(e).reduce(
372
- (t, o) => [.../* @__PURE__ */ new Set([...t, ...o])],
373
- []
374
- ), Y = {
375
- log: console.warn.bind(console),
376
- error: console.error.bind(console),
377
- warn: console.warn.bind(console),
378
- info: console.info.bind(console),
379
- debug: console.debug.bind(console)
380
- };
381
- function Jo(e, t) {
382
- console[e] = (...o) => {
383
- for (const i of t)
384
- if (typeof i == "function") {
385
- if (i(...o)) return;
386
- } else if (i instanceof RegExp && o.length > 0) {
387
- for (const r of o)
388
- if (typeof r == "string" && i.test(r))
389
- return;
390
- }
391
- Y[e](o);
392
- };
393
- }
394
- function Zo(e) {
395
- if (e)
396
- console[e] = Y[e];
397
- else
398
- for (const t of Object.keys(Y))
399
- console[t] = Y[t];
400
- }
401
- function Jt(e) {
402
- let t = 0;
403
- for (let o = 0, i = e.length; o < i; o++) {
404
- const r = e.charCodeAt(o);
405
- t = (t << 5) - t + r, t |= 0;
406
- }
407
- return t;
408
- }
409
- const De = ["#A62A21", "#7e3794", "#0B51C1", "#3A6024", "#A81563", "#B3003C"], Ie = (e) => e.split(/\s/).map((t) => t.substring(0, 1).toUpperCase()).filter((t) => !!t).slice(0, 2).join("").toUpperCase();
410
- function Zt({ user: e, domainCode: t, open: o, useNewAvatar: i = !1 }) {
411
- const r = J();
412
- return /* @__PURE__ */ m(
413
- E,
414
- {
415
- sx: {
416
- paddingTop: 3,
417
- display: "flex",
418
- alignItems: "center",
419
- flexDirection: "column",
420
- gap: "0.5rem"
421
- },
422
- children: [
423
- !i && /* @__PURE__ */ n(
424
- E,
425
- {
426
- sx: {
427
- width: o ? "5rem" : "2rem",
428
- transition: o ? U(r, ["width", "height"], "entering") : U(r, ["width", "height"], "leaving"),
429
- aspectRatio: 1
430
- },
431
- children: e != null && e.name ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(
432
- me,
433
- {
434
- src: e == null ? void 0 : e.picture,
435
- sx: {
436
- width: "100%",
437
- height: "100%",
438
- bgcolor: De[Math.abs(Jt(e == null ? void 0 : e.name)) % De.length]
439
- },
440
- children: Ie(e == null ? void 0 : e.name)
441
- }
442
- ) }) : /* @__PURE__ */ n(me, { sx: { width: "100%", height: "100%" } })
443
- }
444
- ),
445
- i && /* @__PURE__ */ n(
446
- E,
447
- {
448
- sx: {
449
- width: o ? "5rem" : "2rem",
450
- transition: o ? U(r, ["width", "height"], "entering") : U(r, ["width", "height"], "leaving"),
451
- aspectRatio: 1
452
- },
453
- children: e != null && e.name ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ m(Ae, { src: e == null ? void 0 : e.picture, name: e == null ? void 0 : e.name, round: !0, size: o ? "80" : "32", children: [
454
- " ",
455
- Ie(e == null ? void 0 : e.name),
456
- " ",
457
- "ab"
458
- ] }) }) : /* @__PURE__ */ n(Ae, {})
459
- }
460
- ),
461
- /* @__PURE__ */ n(Kt, { sx: { width: "100%" }, in: o, children: /* @__PURE__ */ n(ut, { in: o, children: /* @__PURE__ */ m(E, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", children: [
462
- e != null && e.name ? /* @__PURE__ */ n(_, { children: e == null ? void 0 : e.name }) : /* @__PURE__ */ n(ge, { animation: !1, width: "50%" }),
463
- t ? /* @__PURE__ */ n(_, { children: t.toUpperCase() }) : /* @__PURE__ */ n(ge, { animation: !1, width: "25%" })
464
- ] }) }) })
465
- ]
466
- }
467
- );
468
- }
469
- function jt({
470
- open: e,
471
- widthClosed: t,
472
- widthOpen: o,
473
- "data-testid": i,
474
- top: r,
475
- middle: a,
476
- bottom: c,
477
- user: s,
478
- domainCode: l,
479
- useNewAvatar: u = !1
480
- }) {
481
- const g = Je(), S = qe(Q);
482
- return /* @__PURE__ */ n(Yt, { className: q.root, "data-testid": i, children: /* @__PURE__ */ m(
483
- Qt,
484
- {
485
- open: e,
486
- widthOpen: o,
487
- widthClosed: t,
488
- anchor: "left",
489
- variant: g ? "temporary" : "permanent",
490
- PaperProps: {
491
- component: "nav"
492
- },
493
- onClose: () => {
494
- S(!1);
495
- },
496
- isSmallScreen: g,
497
- children: [
498
- !g && /* @__PURE__ */ n(pt, {}),
499
- r && /* @__PURE__ */ m(E, { flexGrow: "0", children: [
500
- r,
501
- /* @__PURE__ */ n(xe, { variant: "middle", sx: { marginY: "0.5rem" } })
502
- ] }),
503
- /* @__PURE__ */ n(E, { flexGrow: "1", children: Array.isArray(a) ? /* @__PURE__ */ n(Xt, { links: a }) : a }),
504
- /* @__PURE__ */ m(E, { flexGrow: "0", children: [
505
- /* @__PURE__ */ n(xe, { variant: "middle", sx: { marginY: "0.5rem" } }),
506
- /* @__PURE__ */ n(Zt, { user: s, domainCode: l, open: e, useNewAvatar: u }),
507
- c && /* @__PURE__ */ n(T, { children: c })
508
- ] })
509
- ]
510
- }
511
- ) });
512
- }
513
- function eo({
514
- children: e,
515
- topBarHeight: t,
516
- maxWidth: o = !1,
517
- noPadding: i
518
- }) {
519
- return /* @__PURE__ */ n(
520
- E,
521
- {
522
- sx: {
523
- overflow: "auto",
524
- height: `calc(100vh - ${t}px)`,
525
- flexGrow: 1
526
- },
527
- children: i ? /* @__PURE__ */ n(E, { component: "main", id: "main-content", height: "inherit", children: e }) : /* @__PURE__ */ n(
528
- ht,
529
- {
530
- component: "main",
531
- id: "main-content",
532
- maxWidth: o,
533
- sx: { paddingTop: 3, paddingBottom: 3, flexGrow: 1 },
534
- children: e
535
- }
536
- )
537
- }
538
- );
539
- }
540
- const to = "TopBar", oo = {
541
- titleText: `${to}-titleText`
542
- };
543
- function no({
544
- titleText: e = "",
545
- height: t,
546
- "data-testid": o,
547
- middle: i
548
- }) {
549
- const r = qe(Q), a = () => r((l) => !l), c = J(), s = Je();
550
- return /* @__PURE__ */ n("header", { "data-testid": o, children: /* @__PURE__ */ m(
551
- Le,
552
- {
553
- square: !0,
554
- elevation: 0,
555
- sx: {
556
- width: "100%",
557
- position: "sticky",
558
- color: "primary.contrastText",
559
- backgroundColor: "primary.main",
560
- display: "flex",
561
- alignItems: "center",
562
- gap: 2,
563
- flexShrink: 0,
564
- height: t,
565
- zIndex: s ? 0 : c.zIndex.drawer + 101
566
- },
567
- children: [
568
- /* @__PURE__ */ n(
569
- ft,
570
- {
571
- size: "medium",
572
- color: "inherit",
573
- sx: { padding: 1.5, marginLeft: "12px" },
574
- onClick: a,
575
- children: /* @__PURE__ */ n(St, { fontSize: "medium" })
576
- }
577
- ),
578
- /* @__PURE__ */ n(_, { className: oo.titleText, variant: "h6", component: "h1", children: e }),
579
- i
580
- ]
581
- }
582
- ) });
583
- }
584
- function jo({
585
- children: e,
586
- initialTitleText: t,
587
- initialNavBarOpen: o,
588
- pageContainerProps: i,
589
- pageContentDataTestId: r,
590
- topBarDataTestId: a,
591
- navBarDataTestId: c,
592
- navBarMiddle: s,
593
- navBarBottom: l,
594
- user: u,
595
- domainCode: g,
596
- useNewAvatar: S = !1
597
- }) {
598
- yt([
599
- [Q, o != null ? o : !0],
600
- [be, t != null ? t : ""]
601
- ]);
602
- const A = ve(Q), [f] = O(Wt), [b] = O(zt), y = ve(be), [p] = O(qt), [k] = O(Vt), [I] = O(Gt);
603
- return /* @__PURE__ */ m(Ce, { children: [
604
- /* @__PURE__ */ n(We, {}),
605
- /* @__PURE__ */ n(
606
- no,
607
- {
608
- titleText: y,
609
- "data-testid": a,
610
- height: p,
611
- middle: k
612
- }
613
- ),
614
- /* @__PURE__ */ m(Ce, { sx: { display: "flex" }, children: [
615
- /* @__PURE__ */ n(
616
- jt,
617
- {
618
- open: A,
619
- top: I,
620
- middle: s,
621
- bottom: l,
622
- user: u,
623
- domainCode: g,
624
- widthOpen: f,
625
- widthClosed: b,
626
- offsetTop: p,
627
- "data-testid": c,
628
- useNewAvatar: S
629
- }
630
- ),
631
- /* @__PURE__ */ n(
632
- eo,
633
- D(d({
634
- "data-testid": r,
635
- topBarHeight: p
636
- }, i), {
637
- children: e
638
- })
639
- )
640
- ] })
641
- ] });
642
- }
643
- const et = ({
80
+ const Le = ({
644
81
  isOpen: e,
645
82
  dialogTitle: t,
646
- children: o,
83
+ children: n,
647
84
  maxWidth: i,
648
85
  primaryButton: r,
649
- secondaryButton: a,
86
+ secondaryButton: s,
650
87
  additionalButtons: c,
651
- onClose: s,
88
+ onClose: a,
652
89
  sx: l,
653
- "data-testid": u,
654
- disableCloseOnBackdropOrEscape: g = !1,
655
- isLoading: S = !1
90
+ "data-testid": d,
91
+ disableCloseOnBackdropOrEscape: m = !1,
92
+ isLoading: y = !1
656
93
  }) => {
657
- var b, y;
658
- const [A, f] = L(!1);
659
- return /* @__PURE__ */ m(
660
- Pe,
94
+ var w, D;
95
+ const [v, g] = O(!1);
96
+ return /* @__PURE__ */ f(
97
+ Fe,
661
98
  {
662
99
  open: e,
663
100
  onClose: (p, k) => N(null, null, function* () {
664
- g && (k === "backdropClick" || k === "escapeKeyDown") || A || (a != null && a.onClick ? yield a.onClick() : s());
101
+ m && (k === "backdropClick" || k === "escapeKeyDown") || v || (s != null && s.onClick ? yield s.onClick() : a());
665
102
  }),
666
103
  fullWidth: !0,
667
104
  maxWidth: i != null ? i : "xs",
668
- "data-testid": u,
105
+ "data-testid": d,
669
106
  sx: l,
670
107
  children: [
671
- S && /* @__PURE__ */ n(Re, { sx: { height: "4px", marginBottom: "-4px" } }),
672
- /* @__PURE__ */ n(Oe, { children: t }),
673
- /* @__PURE__ */ n(He, { sx: { "& > :last-child": { marginBottom: 0 } }, children: o }),
674
- /* @__PURE__ */ m(Ue, { children: [
675
- /* @__PURE__ */ n(
676
- W,
108
+ y && /* @__PURE__ */ o(Ee, { sx: { height: "4px", marginBottom: "-4px" } }),
109
+ /* @__PURE__ */ o(Ie, { children: t }),
110
+ /* @__PURE__ */ o(_e, { sx: { "& > :last-child": { marginBottom: 0 } }, children: n }),
111
+ /* @__PURE__ */ f(Te, { children: [
112
+ /* @__PURE__ */ o(
113
+ U,
677
114
  {
678
- onClick: (b = a == null ? void 0 : a.onClick) != null ? b : s,
679
- "data-testid": a == null ? void 0 : a.testId,
680
- disabled: (a == null ? void 0 : a.disabled) || A,
681
- color: a == null ? void 0 : a.buttonColor,
682
- children: (y = a == null ? void 0 : a.text) != null ? y : "Cancel"
115
+ onClick: (w = s == null ? void 0 : s.onClick) != null ? w : a,
116
+ "data-testid": s == null ? void 0 : s.testId,
117
+ disabled: (s == null ? void 0 : s.disabled) || v,
118
+ color: s == null ? void 0 : s.buttonColor,
119
+ children: (D = s == null ? void 0 : s.text) != null ? D : "Cancel"
683
120
  }
684
121
  ),
685
122
  c && c.map((p, k) => {
686
- var I;
687
- return /* @__PURE__ */ n(
688
- W,
123
+ var b;
124
+ return /* @__PURE__ */ o(
125
+ U,
689
126
  {
690
127
  onClick: p == null ? void 0 : p.onClick,
691
128
  "data-testid": p == null ? void 0 : p.testId,
692
- disabled: (p == null ? void 0 : p.disabled) || A,
129
+ disabled: (p == null ? void 0 : p.disabled) || v,
693
130
  color: p == null ? void 0 : p.buttonColor,
694
- children: (I = p.text) != null ? I : `Button ${k}`
131
+ children: (b = p.text) != null ? b : `Button ${k}`
695
132
  },
696
133
  k
697
134
  );
698
135
  }),
699
- r && /* @__PURE__ */ n(
700
- W,
136
+ r && /* @__PURE__ */ o(
137
+ U,
701
138
  {
702
139
  onClick: () => N(null, null, function* () {
703
140
  var p;
704
- f(!0), yield (p = r.onClick) == null ? void 0 : p.call(r), f(!1);
141
+ g(!0), yield (p = r.onClick) == null ? void 0 : p.call(r), g(!1);
705
142
  }),
706
143
  "data-testid": r.testId,
707
- disabled: r.disabled || A,
144
+ disabled: r.disabled || v,
708
145
  color: r == null ? void 0 : r.buttonColor,
709
146
  children: r.text
710
147
  }
@@ -713,139 +150,139 @@ const et = ({
713
150
  ]
714
151
  }
715
152
  );
716
- }, tt = ({
153
+ }, Re = ({
717
154
  minLength: e,
718
155
  preLoadedOptions: t,
719
- lookup: o,
156
+ lookup: n,
720
157
  label: i,
721
158
  inputValue: r
722
- }) => Ge({
159
+ }) => Ne({
723
160
  queryFn: () => e && r.length < e ? t != null ? t : [] : t ? t.filter(
724
- (a) => a.label.toLowerCase().includes(r.toLowerCase())
725
- ) : o(r),
161
+ (s) => s.label.toLowerCase().includes(r.toLowerCase())
162
+ ) : n(r),
726
163
  queryKey: ["autocomplete", i, r]
727
164
  });
728
- function en({
165
+ function wn({
729
166
  lookup: e = () => N(null, null, function* () {
730
167
  }),
731
168
  enableHighlighting: t = !0,
732
- onChange: o,
169
+ onChange: n,
733
170
  minLength: i = 0,
734
171
  label: r,
735
- value: a,
172
+ value: s,
736
173
  "data-testid": c,
737
- sx: s,
174
+ sx: a,
738
175
  boxSx: l,
739
- textFieldColor: u,
740
- textFieldVariant: g = "filled",
741
- loadingText: S = "Loading...",
742
- noOptionsText: A = "No options",
743
- popupIcon: f = /* @__PURE__ */ n(kt, {}),
744
- error: b = !1,
745
- helperText: y = "",
176
+ textFieldColor: d,
177
+ textFieldVariant: m = "filled",
178
+ loadingText: y = "Loading...",
179
+ noOptionsText: v = "No options",
180
+ popupIcon: g = /* @__PURE__ */ o(pt, {}),
181
+ error: w = !1,
182
+ helperText: D = "",
746
183
  preLoadedOptions: p = void 0,
747
184
  disablePortal: k = !1,
748
- disableIconFlip: I = !1
185
+ disableIconFlip: b = !1
749
186
  }) {
750
- const [F, V] = L(""), P = (h, v) => {
751
- const C = a.filter((w) => w.id !== v);
752
- o(C, "delete", h);
753
- }, { data: x, isLoading: $ } = tt({
754
- inputValue: F,
187
+ const [I, H] = O(""), M = (h, A) => {
188
+ const C = s.filter((S) => S.id !== A);
189
+ n(C, "delete", h);
190
+ }, { data: x, isLoading: F } = Re({
191
+ inputValue: I,
755
192
  label: r,
756
193
  lookup: e,
757
194
  minLength: i,
758
195
  preLoadedOptions: p
759
- }), R = F.length >= i;
760
- return /* @__PURE__ */ m("div", { "data-testid": c, children: [
761
- /* @__PURE__ */ n(
762
- ie,
196
+ }), L = I.length >= i;
197
+ return /* @__PURE__ */ f("div", { "data-testid": c, children: [
198
+ /* @__PURE__ */ o(
199
+ j,
763
200
  {
764
- sx: d(d({}, s), I ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
201
+ sx: u(u({}, a), b ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
765
202
  "data-testid": c ? `${c}:Autocomplete` : void 0,
766
203
  disablePortal: k,
767
204
  multiple: !0,
768
205
  getOptionLabel: (h) => typeof h == "string" ? h : h.label,
769
- loading: R ? $ : !1,
770
- options: [...a, ...x != null ? x : []],
206
+ loading: L ? F : !1,
207
+ options: [...s, ...x != null ? x : []],
771
208
  filterSelectedOptions: !0,
772
209
  includeInputInList: !0,
773
- value: a,
774
- onChange: (h, v, C) => {
775
- o(v, C, h);
210
+ value: s,
211
+ onChange: (h, A, C) => {
212
+ n(A, C, h);
776
213
  },
777
- onInputChange: (h, v) => V(v),
778
- noOptionsText: R ? A : "Start typing to search",
779
- loadingText: S,
780
- popupIcon: f,
781
- renderInput: (h) => /* @__PURE__ */ n(
782
- re,
783
- D(d({}, h), {
214
+ onInputChange: (h, A) => H(A),
215
+ noOptionsText: L ? v : "Start typing to search",
216
+ loadingText: y,
217
+ popupIcon: g,
218
+ renderInput: (h) => /* @__PURE__ */ o(
219
+ ee,
220
+ E(u({}, h), {
784
221
  label: r,
785
222
  fullWidth: !0,
786
- variant: g,
787
- error: b,
788
- helperText: y,
789
- InputProps: D(d({}, h.InputProps), {
790
- endAdornment: /* @__PURE__ */ m(T, { children: [
791
- $ ? /* @__PURE__ */ n(ae, { color: "inherit", size: 20 }) : null,
223
+ variant: m,
224
+ error: w,
225
+ helperText: D,
226
+ InputProps: E(u({}, h.InputProps), {
227
+ endAdornment: /* @__PURE__ */ f($, { children: [
228
+ F ? /* @__PURE__ */ o(te, { color: "inherit", size: 20 }) : null,
792
229
  h.InputProps.endAdornment
793
230
  ] })
794
231
  }),
795
232
  "data-testid": c ? `${c}:Autocomplete:TextField` : void 0,
796
- onKeyDown: (v) => {
797
- (v.key === "Backspace" || v.key === "Delete") && v.stopPropagation();
233
+ onKeyDown: (A) => {
234
+ (A.key === "Backspace" || A.key === "Delete") && A.stopPropagation();
798
235
  },
799
- color: u
236
+ color: d
800
237
  })
801
238
  ),
802
239
  renderTags: () => null,
803
- isOptionEqualToValue: (h, v) => h.id === v.id,
804
- renderOption: (h, v, C) => {
240
+ isOptionEqualToValue: (h, A) => h.id === A.id,
241
+ renderOption: (h, A, C) => {
805
242
  if (t) {
806
- const w = Dt(v.label, C.inputValue, {
243
+ const S = mt(A.label, C.inputValue, {
807
244
  insideWords: !0,
808
245
  findAllOccurrences: !0
809
- }), Z = It(v.label, w);
810
- return /* @__PURE__ */ oe(
246
+ }), X = ft(A.label, S);
247
+ return /* @__PURE__ */ Z(
811
248
  "li",
812
- D(d({}, h), {
813
- key: v.id,
814
- "data-testid": c ? `${c}:Autocomplete:option(${v.id.toString()})` : void 0
249
+ E(u({}, h), {
250
+ key: A.id,
251
+ "data-testid": c ? `${c}:Autocomplete:option(${A.id.toString()})` : void 0
815
252
  }),
816
- /* @__PURE__ */ n("div", { children: Z.map((de, it) => /* @__PURE__ */ n(
253
+ /* @__PURE__ */ o("div", { children: X.map((oe, Ge) => /* @__PURE__ */ o(
817
254
  "span",
818
255
  {
819
256
  style: {
820
- fontWeight: de.highlight ? 700 : 400
257
+ fontWeight: oe.highlight ? 700 : 400
821
258
  },
822
- children: de.text
259
+ children: oe.text
823
260
  },
824
- it
261
+ Ge
825
262
  )) })
826
263
  );
827
264
  } else
828
- return /* @__PURE__ */ oe(
265
+ return /* @__PURE__ */ Z(
829
266
  "li",
830
- D(d({}, h), {
831
- key: v.id,
832
- "data-testid": c ? `${c}:option(${v.id.toString()})` : void 0
267
+ E(u({}, h), {
268
+ key: A.id,
269
+ "data-testid": c ? `${c}:option(${A.id.toString()})` : void 0
833
270
  }),
834
- v.label
271
+ A.label
835
272
  );
836
273
  }
837
274
  }
838
275
  ),
839
- a.length > 0 && /* @__PURE__ */ n(E, { sx: l, children: a.map((h) => /* @__PURE__ */ n(
840
- mt,
276
+ s.length > 0 && /* @__PURE__ */ o(T, { sx: l, children: s.map((h) => /* @__PURE__ */ o(
277
+ Ze,
841
278
  {
842
279
  sx: {
843
280
  marginTop: 1,
844
281
  marginRight: 1,
845
282
  height: "auto"
846
283
  },
847
- label: /* @__PURE__ */ n(
848
- gt,
284
+ label: /* @__PURE__ */ o(
285
+ je,
849
286
  {
850
287
  title: h.tooltipContent || "",
851
288
  placement: "bottom-start",
@@ -859,13 +296,13 @@ function en({
859
296
  }
860
297
  ]
861
298
  },
862
- children: /* @__PURE__ */ n(_, { style: { whiteSpace: "normal" }, children: h.chipLabel ? h.chipLabel : h.label })
299
+ children: /* @__PURE__ */ o(_, { style: { whiteSpace: "normal" }, children: h.chipLabel ? h.chipLabel : h.label })
863
300
  }
864
301
  ),
865
302
  "data-testid": c ? `${c}:Chip(${h.id.toString()})` : void 0,
866
- onDelete: (v) => P(v, h.id),
867
- deleteIcon: /* @__PURE__ */ n(
868
- bt,
303
+ onDelete: (A) => M(A, h.id),
304
+ deleteIcon: /* @__PURE__ */ o(
305
+ ut,
869
306
  {
870
307
  "data-testid": c ? `${c}:Chip(${h.id.toString()}):deleteIcon` : void 0
871
308
  }
@@ -875,120 +312,114 @@ function en({
875
312
  )) })
876
313
  ] });
877
314
  }
878
- const tn = /MUI: The value provided to.*is invalid/i, on = ({
315
+ const kn = /MUI: The value provided to.*is invalid/i, yn = ({
879
316
  lookup: e = () => N(null, null, function* () {
880
317
  }),
881
318
  onChange: t,
882
- label: o,
319
+ label: n,
883
320
  value: i,
884
321
  sx: r,
885
- textFieldColor: a,
322
+ textFieldColor: s,
886
323
  textFieldVariant: c = "filled",
887
- error: s = !1,
324
+ error: a = !1,
888
325
  "data-testid": l,
889
- noOptionsText: u = "No options",
890
- minLength: g = 3,
891
- disablePortal: S = !1,
892
- preLoadedOptions: A,
893
- helperText: f = "",
894
- disabled: b,
895
- popupIcon: y,
326
+ noOptionsText: d = "No options",
327
+ minLength: m = 3,
328
+ disablePortal: y = !1,
329
+ preLoadedOptions: v,
330
+ helperText: g = "",
331
+ disabled: w,
332
+ popupIcon: D,
896
333
  disableIconFlip: p
897
334
  }) => {
898
- const [k, I] = L(""), { data: F, isLoading: V } = tt({
335
+ const [k, b] = O(""), { data: I, isLoading: H } = Re({
899
336
  inputValue: k,
900
- label: o,
337
+ label: n,
901
338
  lookup: e,
902
- minLength: g != null ? g : 0,
903
- preLoadedOptions: A
904
- }), P = k.length >= g;
905
- return /* @__PURE__ */ n("div", { "data-testid": l, children: /* @__PURE__ */ n(xt, { direction: "row", spacing: 1, children: /* @__PURE__ */ n(
906
- ie,
339
+ minLength: m != null ? m : 0,
340
+ preLoadedOptions: v
341
+ }), M = k.length >= m;
342
+ return /* @__PURE__ */ o("div", { "data-testid": l, children: /* @__PURE__ */ o(et, { direction: "row", spacing: 1, children: /* @__PURE__ */ o(
343
+ j,
907
344
  {
908
- sx: d(d({}, r), p ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
345
+ sx: u(u({}, r), p ? { ".MuiAutocomplete-popupIndicatorOpen": { transform: "rotate(0deg)" } } : {}),
909
346
  "data-testid": l ? `${l}:Autocomplete` : void 0,
910
- loading: P ? V : !1,
911
- options: F != null ? F : [],
912
- onChange: (x, $, R) => {
913
- t(x, $, R);
347
+ loading: M ? H : !1,
348
+ options: I != null ? I : [],
349
+ onChange: (x, F, L) => {
350
+ t(x, F, L);
914
351
  },
915
- disablePortal: S,
352
+ disablePortal: y,
916
353
  filterOptions: (x) => x,
917
354
  value: i,
918
- noOptionsText: P ? u : "Start typing to search",
355
+ noOptionsText: M ? d : "Start typing to search",
919
356
  getOptionLabel: (x) => x.label,
920
- popupIcon: y,
921
- renderInput: (x) => /* @__PURE__ */ n(
922
- re,
923
- D(d({
357
+ popupIcon: D,
358
+ renderInput: (x) => /* @__PURE__ */ o(
359
+ ee,
360
+ E(u({
924
361
  "data-testid": l ? `${l}:Autocomplete:TextField` : void 0
925
362
  }, x), {
926
363
  variant: c,
927
- label: o,
928
- color: a,
929
- error: s,
930
- helperText: f
364
+ label: n,
365
+ color: s,
366
+ error: a,
367
+ helperText: g
931
368
  })
932
369
  ),
933
- isOptionEqualToValue: (x, $) => x.id === $.id,
934
- onInputChange: (x, $) => {
935
- I($);
370
+ isOptionEqualToValue: (x, F) => x.id === F.id,
371
+ onInputChange: (x, F) => {
372
+ b(F);
936
373
  },
937
- renderOption: (x, $) => /* @__PURE__ */ oe(
374
+ renderOption: (x, F) => /* @__PURE__ */ Z(
938
375
  "li",
939
- D(d({}, x), {
940
- key: $.id,
941
- "data-testid": l ? `${l}:Autocomplete:option(${$.id.toString()})` : void 0
376
+ E(u({}, x), {
377
+ key: F.id,
378
+ "data-testid": l ? `${l}:Autocomplete:option(${F.id.toString()})` : void 0
942
379
  }),
943
- $.label
380
+ F.label
944
381
  ),
945
- disabled: b
382
+ disabled: w
946
383
  }
947
384
  ) }) });
948
- }, io = (e) => {
385
+ }, St = (e) => {
949
386
  if (!e)
950
387
  return -1;
951
388
  try {
952
- const o = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), i = decodeURIComponent(
953
- $t.from(o, "base64").toString("utf8").split("").map(function(a) {
954
- return "%" + ("00" + a.charCodeAt(0).toString(16)).slice(-2);
389
+ const n = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), i = decodeURIComponent(
390
+ gt.from(n, "base64").toString("utf8").split("").map(function(s) {
391
+ return "%" + ("00" + s.charCodeAt(0).toString(16)).slice(-2);
955
392
  }).join("")
956
393
  ), r = JSON.parse(i);
957
394
  return r != null && r.exp ? r.exp : -1;
958
395
  } catch (t) {
959
396
  return -1;
960
397
  }
961
- }, nn = ({
398
+ }, Dn = ({
962
399
  open: e = !1,
963
400
  closeHandler: t,
964
- setAuth0ExpiryTime: o
401
+ setAuth0ExpiryTime: n
965
402
  }) => {
966
- const { logout: i, getAccessTokenSilently: r } = le(), [a, c] = L(0), s = () => N(null, null, function* () {
967
- i({ logoutParams: { returnTo: `${window.location.origin}` } });
968
- }), l = () => N(null, null, function* () {
969
- c(a + 1), t();
970
- });
971
- return ne(() => {
972
- N(null, null, function* () {
973
- if (a > 0) {
974
- const A = yield r({ cacheMode: "off" }), f = io(A) * 1e3;
975
- o(f);
976
- }
977
- });
978
- }, [a, r, o]), /* @__PURE__ */ n(
979
- et,
403
+ const { logout: i, getAccessTokenSilently: r } = ne();
404
+ return /* @__PURE__ */ o(
405
+ Le,
980
406
  {
981
407
  isOpen: e,
982
408
  primaryButton: {
983
409
  text: "Continue",
984
- onClick: l,
410
+ onClick: () => N(null, null, function* () {
411
+ const d = yield r({ cacheMode: "off" }), m = St(d) * 1e3;
412
+ n(m), t();
413
+ }),
985
414
  disabled: !1,
986
415
  testId: "PreferencesDialog",
987
416
  buttonColor: "secondary"
988
417
  },
989
418
  secondaryButton: {
990
419
  text: "Log out",
991
- onClick: s,
420
+ onClick: () => N(null, null, function* () {
421
+ i({ logoutParams: { returnTo: `${window.location.origin}` } });
422
+ }),
992
423
  disabled: !1,
993
424
  testId: "PreferencesDialog",
994
425
  buttonColor: "secondary"
@@ -996,42 +427,42 @@ const tn = /MUI: The value provided to.*is invalid/i, on = ({
996
427
  onClose: t,
997
428
  dialogTitle: "Session expiry",
998
429
  disableCloseOnBackdropOrEscape: !0,
999
- children: /* @__PURE__ */ n("p", { style: { marginBottom: 0 }, children: "Your session is about to time out due to inactivity. Do you want to continue?" })
430
+ children: /* @__PURE__ */ o("p", { style: { marginBottom: 0 }, children: "Your session is about to time out due to inactivity. Do you want to continue?" })
1000
431
  }
1001
432
  );
1002
433
  };
1003
- function ro(e) {
434
+ function wt(e) {
1004
435
  return "error" in e;
1005
436
  }
1006
- function ao(e) {
437
+ function kt(e) {
1007
438
  var i;
1008
- const t = e.error, o = (i = e == null ? void 0 : e.error_description) != null ? i : "";
1009
- return t === "access_denied" && o.startsWith("You do not have the required authorization");
439
+ const t = e.error, n = (i = e == null ? void 0 : e.error_description) != null ? i : "";
440
+ return t === "access_denied" && n.startsWith("You do not have the required authorization");
1010
441
  }
1011
- function so(e) {
442
+ function yt(e) {
1012
443
  var i;
1013
- const t = e.error, o = (i = e == null ? void 0 : e.error_description) != null ? i : "";
1014
- return t === "access_denied" && o.startsWith("User did not authorize the request");
444
+ const t = e.error, n = (i = e == null ? void 0 : e.error_description) != null ? i : "";
445
+ return t === "access_denied" && n.startsWith("User did not authorize the request");
1015
446
  }
1016
- function lo(e) {
447
+ function Dt(e) {
1017
448
  var i;
1018
- const t = e.error, o = (i = e == null ? void 0 : e.error_description) != null ? i : "";
1019
- return t === "access_denied" && o.match(/Script.*time.*exceeded/);
449
+ const t = e.error, n = (i = e == null ? void 0 : e.error_description) != null ? i : "";
450
+ return t === "access_denied" && n.match(/Script.*time.*exceeded/);
1020
451
  }
1021
- function rn({
452
+ function bn({
1022
453
  children: e,
1023
454
  appName: t = "the app",
1024
- throwErrors: o = "none",
455
+ throwErrors: n = "none",
1025
456
  disableConsoleLogging: i = !1,
1026
457
  onError: r = () => {
1027
458
  }
1028
459
  }) {
1029
- var S, A;
1030
- const { isAuthenticated: a, isLoading: c, error: s, loginWithRedirect: l, logout: u } = le();
1031
- ne(() => {
1032
- s && r(s);
1033
- }, [s, r]);
1034
- const g = lt(
460
+ var y, v;
461
+ const { isAuthenticated: s, isLoading: c, error: a, loginWithRedirect: l, logout: d } = ne();
462
+ le(() => {
463
+ a && r(a);
464
+ }, [a, r]);
465
+ const m = Ye(
1035
466
  () => ({
1036
467
  appState: {
1037
468
  returnTo: `${window.location.pathname}${window.location.search}`
@@ -1039,163 +470,166 @@ function rn({
1039
470
  }),
1040
471
  []
1041
472
  );
1042
- if (ne(() => {
1043
- c || a || s || l(g);
1044
- }, [c, a, s, l, r, g]), s) {
473
+ if (le(() => {
474
+ c || s || a || l(m);
475
+ }, [c, s, a, l, r, m]), a) {
1045
476
  if (i || console.error(
1046
- `Error detected in AuthGuard [isAuthenticated=${a},isLoading=${c}]`,
1047
- s
1048
- ), o === "all")
1049
- throw s;
1050
- if (ro(s)) {
1051
- let f = "Auth error", b = "An unknown Auth0 error occurred.";
1052
- if (ao(s))
1053
- f = "Unauthorised", b = `You are not authorised to access ${t}.`;
1054
- else if (so(s))
1055
- f = "App not authorised", b = `You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`;
1056
- else if (lo(s))
1057
- f = "Auth0 script execution time exceeded", b = "The Auth0 login flow exceeded the time limit (20s). Try again in a minute by clicking the RELOAD button below.";
1058
- else if (s.message === "Invalid state") {
1059
- const y = localStorage.getItem("auth0_redirect_count");
1060
- y ? y && parseInt(y) < 2 && (localStorage.setItem("auth0_redirect_count", String(parseInt(y) + 1)), l(g)) : (localStorage.setItem("auth0_redirect_count", "1"), l(g));
1061
- } else if (o === "unknown") throw s;
1062
- return /* @__PURE__ */ m(Pe, { open: !0, children: [
1063
- /* @__PURE__ */ n(Oe, { children: f }),
1064
- /* @__PURE__ */ m(He, { children: [
1065
- /* @__PURE__ */ n(_, { children: b }),
1066
- /* @__PURE__ */ n("br", {}),
1067
- /* @__PURE__ */ n(_, { variant: "subtitle2", children: "Details from Auth0" }),
1068
- /* @__PURE__ */ m(_, { variant: "body2", children: [
477
+ `Error detected in AuthGuard [isAuthenticated=${s},isLoading=${c}]`,
478
+ a
479
+ ), n === "all")
480
+ throw a;
481
+ if (wt(a)) {
482
+ let g = "Auth error", w = "An unknown Auth0 error occurred.";
483
+ if (kt(a))
484
+ g = "Unauthorised", w = `You are not authorised to access ${t}.`;
485
+ else if (yt(a))
486
+ g = "App not authorised", w = `You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`;
487
+ else if (Dt(a))
488
+ g = "Auth0 script execution time exceeded", w = "The Auth0 login flow exceeded the time limit (20s). Try again in a minute by clicking the RELOAD button below.";
489
+ else if (a.message === "Invalid state") {
490
+ const D = localStorage.getItem("auth0_redirect_count");
491
+ D ? D && parseInt(D) < 2 && (localStorage.setItem("auth0_redirect_count", String(parseInt(D) + 1)), l(m)) : (localStorage.setItem("auth0_redirect_count", "1"), l(m));
492
+ } else if (n === "unknown") throw a;
493
+ return /* @__PURE__ */ f(Fe, { open: !0, children: [
494
+ /* @__PURE__ */ o(Ie, { children: g }),
495
+ /* @__PURE__ */ f(_e, { children: [
496
+ /* @__PURE__ */ o(_, { children: w }),
497
+ /* @__PURE__ */ o("br", {}),
498
+ /* @__PURE__ */ o(_, { variant: "subtitle2", children: "Details from Auth0" }),
499
+ /* @__PURE__ */ f(_, { variant: "body2", children: [
1069
500
  "error: ",
1070
- (S = s == null ? void 0 : s.error) != null ? S : "N/A"
501
+ (y = a == null ? void 0 : a.error) != null ? y : "N/A"
1071
502
  ] }),
1072
- /* @__PURE__ */ m(_, { variant: "body2", children: [
503
+ /* @__PURE__ */ f(_, { variant: "body2", children: [
1073
504
  "description: ",
1074
- (A = s == null ? void 0 : s.error_description) != null ? A : "N/A"
505
+ (v = a == null ? void 0 : a.error_description) != null ? v : "N/A"
1075
506
  ] })
1076
507
  ] }),
1077
- /* @__PURE__ */ m(Ue, { children: [
1078
- f === "Auth0 script execution time exceeded" && /* @__PURE__ */ n(W, { href: window.location.origin + window.location.pathname, children: "Reload" }),
1079
- /* @__PURE__ */ n(W, { onClick: () => u({ logoutParams: { returnTo: window.location.origin } }), children: "Logout" })
508
+ /* @__PURE__ */ f(Te, { children: [
509
+ g === "Auth0 script execution time exceeded" && /* @__PURE__ */ o(U, { href: window.location.origin + window.location.pathname, children: "Reload" }),
510
+ /* @__PURE__ */ o(U, { onClick: () => d({ logoutParams: { returnTo: window.location.origin } }), children: "Logout" })
1080
511
  ] })
1081
512
  ] });
1082
- } else if (o === "unknown") throw s;
513
+ } else if (n === "unknown") throw a;
1083
514
  }
1084
- return a ? (localStorage.removeItem("auth0_redirect_count"), /* @__PURE__ */ n(T, { children: e })) : /* @__PURE__ */ n(Ft, { variant: "rectangular", animation: "pulse", height: "100vh", width: "100vw" });
515
+ return s ? (localStorage.removeItem("auth0_redirect_count"), /* @__PURE__ */ o($, { children: e })) : /* @__PURE__ */ o(xt, { variant: "rectangular", animation: "pulse", height: "100vh", width: "100vw" });
1085
516
  }
1086
- const co = {
517
+ const bt = {
1087
518
  autoHideDuration: 6e3,
1088
519
  anchorOrigin: { vertical: "top", horizontal: "center" },
1089
520
  // The default is false. If we prefer timer to continue when window loses
1090
521
  // focus, change to true
1091
522
  disableWindowBlurListener: !1
1092
- }, uo = {
523
+ }, Ft = {
1093
524
  shouldClose: (e, t) => t !== "clickaway"
1094
- }, $e = {
525
+ }, ge = {
1095
526
  message: "",
1096
527
  severity: "info",
1097
528
  variant: "standard",
1098
529
  progressIndicator: void 0
1099
530
  // Can use 'circular' or 'linear'
1100
- }, Fe = 100, Ee = 2e3, po = 2e3, ho = /* @__PURE__ */ (() => {
531
+ }, xe = 100, Ae = 2e3, Et = 2e3, It = /* @__PURE__ */ (() => {
1101
532
  let e = 0;
1102
533
  return () => (e += 1, e);
1103
- })(), fo = {
534
+ })(), _t = {
1104
535
  borderBottomLeftRadius: "0px",
1105
536
  borderBottomRightRadius: "0px"
1106
- }, mo = {}, go = {}, ot = Me(null);
1107
- function xo(a) {
1108
- var c = a, {
1109
- overrideState: e = mo,
1110
- overrideActions: t = go,
1111
- shouldClose: o = uo.shouldClose,
537
+ }, Tt = {}, Nt = {}, Be = Qe(null);
538
+ function Pt(s) {
539
+ var c = s, {
540
+ overrideState: e = Tt,
541
+ overrideActions: t = Nt,
542
+ shouldClose: n = Ft.shouldClose,
1112
543
  children: i
1113
- } = c, r = he(c, [
544
+ } = c, r = ae(c, [
1114
545
  "overrideState",
1115
546
  "overrideActions",
1116
547
  "shouldClose",
1117
548
  "children"
1118
549
  ]);
1119
- var v;
1120
- const [{ open: s }, l] = L({ open: !1 }), u = ee([]), g = ee(Date.now()), S = ee(0), A = K((C) => {
550
+ var A;
551
+ const [{ open: a }, l] = O({ open: !1 }), d = Q([]), m = Q(Date.now()), y = Q(0), v = ce((C) => {
1121
552
  l({ open: C });
1122
- }, []), f = K((C = {}) => {
1123
- S.current += 1, u.current.length >= Fe && Date.now() - g.current >= Ee && (g.current = Date.now(), console.error(
1124
- `SaladBarProvider: MAX_QUEUE_LENGTH (${Fe}) hit ${S.current} times in last ${Ee}ms)`
1125
- ), S.current = 0);
1126
- const w = d(D(d({}, $e), {
1127
- key: ho()
553
+ }, []), g = ce((C = {}) => {
554
+ y.current += 1, d.current.length >= xe && Date.now() - m.current >= Ae && (m.current = Date.now(), console.error(
555
+ `SaladBarProvider: MAX_QUEUE_LENGTH (${xe}) hit ${y.current} times in last ${Ae}ms)`
556
+ ), y.current = 0);
557
+ const S = u(E(u({}, ge), {
558
+ key: It()
1128
559
  }), C);
1129
- return u.current.push(w), u.current.length === 1 && l({ open: !0 }), w.key;
1130
- }, []), b = (C = "", w = {}) => f(d({ message: C, severity: "success" }, w)), y = (C = "", w = {}) => f(d({ message: C, severity: "info" }, w)), p = (C = "", w = {}) => f(d({ message: C, severity: "warning" }, w)), k = (C = "", w = {}) => f(d({ message: C, severity: "error" }, w)), I = (C) => {
1131
- const w = u.current.findIndex((Z) => Z.key === C);
1132
- if (w !== -1)
1133
- return w === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(w, 1);
1134
- }, F = (C, w) => {
1135
- o(C, w) && l({ open: !1 });
1136
- }, V = () => {
1137
- }, P = () => {
1138
- u.current.shift(), u.current.length > 0 && l({ open: !0 });
1139
- }, x = (v = u.current[0]) != null ? v : d({}, $e), $ = {};
1140
- "autoHideDuration" in x && ($.autoHideDuration = x.autoHideDuration);
1141
- const R = d(d({}, co), r), h = d(d({
1142
- open: s,
1143
- setOpen: A,
1144
- enqueueNotification: f,
1145
- enqueueSuccessNotification: b,
1146
- enqueueInfoNotification: y,
560
+ return d.current.push(S), d.current.length === 1 && l({ open: !0 }), S.key;
561
+ }, []), w = (C = "", S = {}) => g(u({ message: C, severity: "success" }, S)), D = (C = "", S = {}) => g(u({ message: C, severity: "info" }, S)), p = (C = "", S = {}) => g(u({ message: C, severity: "warning" }, S)), k = (C = "", S = {}) => g(u({ message: C, severity: "error" }, S)), b = (C) => {
562
+ const S = d.current.findIndex((X) => X.key === C);
563
+ if (S !== -1)
564
+ return S === 0 ? (l({ open: !1 }), d.current[0]) : d.current.splice(S, 1);
565
+ }, I = (C, S) => {
566
+ n(C, S) && l({ open: !1 });
567
+ }, H = () => {
568
+ }, M = () => {
569
+ d.current.shift(), d.current.length > 0 && l({ open: !0 });
570
+ }, x = (A = d.current[0]) != null ? A : u({}, ge), F = {};
571
+ "autoHideDuration" in x && (F.autoHideDuration = x.autoHideDuration);
572
+ const L = u(u({}, bt), r), h = u(u({
573
+ open: a,
574
+ setOpen: v,
575
+ enqueueNotification: g,
576
+ enqueueSuccessNotification: w,
577
+ enqueueInfoNotification: D,
1147
578
  enqueueWarningNotification: p,
1148
579
  enqueueErrorNotification: k,
1149
- removeNotification: I
580
+ removeNotification: b
1150
581
  }, e), t);
1151
- return /* @__PURE__ */ m(ot.Provider, { value: h, children: [
582
+ return /* @__PURE__ */ f(Be.Provider, { value: h, children: [
1152
583
  i,
1153
- /* @__PURE__ */ n(
1154
- vt,
1155
- D(d(d({}, R), $), {
1156
- open: s,
1157
- onClose: F,
584
+ /* @__PURE__ */ o(
585
+ tt,
586
+ E(u(u({}, L), F), {
587
+ open: a,
588
+ onClose: I,
1158
589
  TransitionProps: {
1159
- onExited: P,
1160
- onExit: V
590
+ onExited: M,
591
+ onExit: H
1161
592
  },
1162
- sx: { zIndex: po },
1163
- children: /* @__PURE__ */ m("div", { children: [
1164
- /* @__PURE__ */ n(
1165
- Ct,
593
+ sx: { zIndex: Et },
594
+ children: /* @__PURE__ */ f("div", { children: [
595
+ /* @__PURE__ */ o(
596
+ nt,
1166
597
  {
1167
- onClose: (C) => F(C, "closeAlert"),
598
+ onClose: (C) => I(C, "closeAlert"),
1168
599
  severity: x.severity,
1169
600
  variant: "filled",
1170
- icon: x.progressIndicator === "circular" ? /* @__PURE__ */ n(ae, { size: "1em" }) : void 0,
1171
- style: x.progressIndicator === "linear" ? fo : void 0,
601
+ icon: x.progressIndicator === "circular" ? /* @__PURE__ */ o(te, { size: "1em" }) : void 0,
602
+ style: x.progressIndicator === "linear" ? _t : void 0,
1172
603
  children: x.message
1173
604
  }
1174
605
  ),
1175
- x.progressIndicator === "linear" && /* @__PURE__ */ n(Re, { color: "primary" })
606
+ x.progressIndicator === "linear" && /* @__PURE__ */ o(Ee, { color: "primary" })
1176
607
  ] })
1177
608
  })
1178
609
  )
1179
610
  ] });
1180
611
  }
1181
- function vo() {
1182
- const e = Te(ot);
612
+ class Ue extends Error {
613
+ }
614
+ se(Ue, "errorName", "ContextError");
615
+ function $t() {
616
+ const e = Je(Be);
1183
617
  if (e === null)
1184
- throw new ce("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
618
+ throw new Ue("Error: Tried to useSaladBar outside of a <SaladBarProvider>");
1185
619
  return e;
1186
620
  }
1187
- const an = se(
1188
- (e = { autoHideDuration: 1 }, t = {}, o = {}) => ({ children: i }) => /* @__PURE__ */ n(xo, D(d({}, e), { overrideState: t, overrideActions: o, children: /* @__PURE__ */ n(T, { children: i }) }))
1189
- ), nt = "domainCode";
1190
- var _e;
1191
- const Ne = M(
1192
- JSON.parse((_e = localStorage.getItem(nt)) != null ? _e : '{"domainCode": ""}').domainCode
1193
- ), Co = M(
1194
- (e) => e(Ne),
1195
- (e, t, o) => {
1196
- t(Ne, o), localStorage.setItem(nt, JSON.stringify({ domainCode: o }));
621
+ const Fn = At(
622
+ (e = { autoHideDuration: 1 }, t = {}, n = {}) => ({ children: i }) => /* @__PURE__ */ o(Pt, E(u({}, e), { overrideState: t, overrideActions: n, children: /* @__PURE__ */ o($, { children: i }) }))
623
+ ), Oe = "domainCode";
624
+ var De;
625
+ const Ce = P(
626
+ JSON.parse((De = localStorage.getItem(Oe)) != null ? De : '{"domainCode": ""}').domainCode
627
+ ), Mt = P(
628
+ (e) => e(Ce),
629
+ (e, t, n) => {
630
+ t(Ce, n), localStorage.setItem(Oe, JSON.stringify({ domainCode: n }));
1197
631
  }
1198
- ), Ao = {
632
+ ), Lt = {
1199
633
  act: "ACT",
1200
634
  nsw: "NSW",
1201
635
  nt: "NT",
@@ -1205,79 +639,463 @@ const Ne = M(
1205
639
  vic: "VIC",
1206
640
  wa: "WA",
1207
641
  ag: "AG",
1208
- fedmps: "Fedmps",
642
+ fedmps: "FedMPs",
1209
643
  "": ""
1210
- }, wo = (e) => {
644
+ }, He = (e) => {
1211
645
  var t;
1212
- return e === null ? "N/A" : (t = Ao[e]) != null ? t : "";
1213
- }, sn = ({
646
+ return e === null ? "N/A" : (t = Lt[e]) != null ? t : "";
647
+ }, En = ({
1214
648
  isLoading: e,
1215
649
  isOpen: t,
1216
- onClose: o,
650
+ onClose: n,
1217
651
  onDomainChange: i,
1218
652
  domainOptions: r,
1219
- applicationName: a,
653
+ applicationName: s,
1220
654
  handleLogout: c
1221
655
  }) => {
1222
- const [s, l] = O(Co), [u, g] = L(s), { enqueueSuccessNotification: S } = vo(), A = r.length === 0, f = !!s && !r.includes(s) && !r.includes(u), b = !s || A || f, y = () => N(null, null, function* () {
1223
- u ? (l(u), i == null || i(u), S(`Set organisation to ${u}`), o()) : (l(""), i == null || i(""));
656
+ const [a, l] = R(Mt), [d, m] = O(a), { enqueueSuccessNotification: y } = $t(), v = r.length === 0, g = !!a && !r.includes(a) && !r.includes(d), w = !a || v || g, D = () => N(null, null, function* () {
657
+ d ? (l(d), i == null || i(d), y(`Set organisation to ${d}`), n()) : (l(""), i == null || i(""));
1224
658
  }), p = () => N(null, null, function* () {
1225
- s && !A && !f ? (g(s), o()) : b && c();
659
+ a && !v && !g ? (m(a), n()) : w && c();
1226
660
  });
1227
661
  let k;
1228
- return A ? k = "Unable to retrieve your active organisations. Try logging in again." : f && (k = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ m(
1229
- et,
662
+ return v ? k = "Unable to retrieve your active organisations. Try logging in again." : g && (k = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ f(
663
+ Le,
1230
664
  {
1231
665
  isOpen: t,
1232
666
  dialogTitle: "Select an organisation",
1233
667
  primaryButton: {
1234
668
  text: "Confirm",
1235
- onClick: y,
1236
- disabled: !u || A || f,
669
+ onClick: D,
670
+ disabled: !d || v || g,
1237
671
  buttonColor: "primary"
1238
672
  },
1239
673
  secondaryButton: {
1240
- text: b ? "Logout" : "Cancel",
674
+ text: w ? "Logout" : "Cancel",
1241
675
  onClick: p
1242
676
  },
1243
- onClose: b ? () => {
1244
- } : o,
677
+ onClose: w ? () => {
678
+ } : n,
1245
679
  children: [
1246
- /* @__PURE__ */ m(_, { marginBottom: 2, children: [
680
+ /* @__PURE__ */ f(_, { marginBottom: 2, children: [
1247
681
  "Select the default organisation that you want to use with the ",
1248
- a,
682
+ s,
1249
683
  "."
1250
684
  ] }),
1251
- /* @__PURE__ */ n(
1252
- ie,
685
+ /* @__PURE__ */ o(
686
+ j,
1253
687
  {
1254
688
  loading: e,
1255
689
  multiple: !1,
1256
690
  disableClearable: !1,
1257
- value: u !== "" ? u : null,
1258
- onChange: (I, F) => g(F != null ? F : ""),
1259
- getOptionLabel: wo,
691
+ value: d !== "" ? d : null,
692
+ onChange: (b, I) => m(I != null ? I : ""),
693
+ getOptionLabel: He,
1260
694
  options: [...r.toSorted()],
1261
- renderInput: (I) => /* @__PURE__ */ n(
1262
- re,
1263
- D(d({}, I), {
695
+ renderInput: (b) => /* @__PURE__ */ o(
696
+ ee,
697
+ E(u({}, b), {
1264
698
  variant: "filled",
1265
699
  label: "Select organisation",
1266
- InputProps: D(d({}, I.InputProps), {
1267
- endAdornment: /* @__PURE__ */ m(T, { children: [
1268
- e ? /* @__PURE__ */ n(ae, { color: "inherit", size: 20, sx: { marginTop: "-20px" } }) : null,
1269
- I.InputProps.endAdornment
700
+ InputProps: E(u({}, b.InputProps), {
701
+ endAdornment: /* @__PURE__ */ f($, { children: [
702
+ e ? /* @__PURE__ */ o(te, { color: "inherit", size: 20, sx: { marginTop: "-20px" } }) : null,
703
+ b.InputProps.endAdornment
1270
704
  ] })
1271
705
  })
1272
706
  })
1273
707
  )
1274
708
  }
1275
709
  ),
1276
- k && /* @__PURE__ */ n(At, { error: !0, children: k })
710
+ k && /* @__PURE__ */ o(ot, { error: !0, children: k })
1277
711
  ]
1278
712
  }
1279
713
  );
1280
- }, ln = ze({
714
+ }, We = () => {
715
+ const e = K();
716
+ return it(e.breakpoints.down("sm"));
717
+ }, Rt = 64, Bt = 72, Ut = 256, V = P(!0), Ot = P(Ut), Ht = P(Bt), ve = P(""), Wt = P(void 0), qt = P(Rt), zt = P(void 0);
718
+ function Gt({ links: e }) {
719
+ return /* @__PURE__ */ o("div", { children: "LinksMenu not implemented yet" });
720
+ }
721
+ const z = "Navbar", W = {
722
+ root: `${z}-root`,
723
+ menuButton: `${z}-menuButton`,
724
+ hide: `${z}-hide`,
725
+ content: `${z}-content`
726
+ // userInfoHolder: `${PREFIX}-userInfoHolder`,
727
+ // settings: `${PREFIX}-settings`,
728
+ // pieChartIcon: `${PREFIX}-pieChartIcon`,
729
+ }, Vt = $e(T, { name: "NavBar" })(({ theme: e }) => ({
730
+ [`&.${W.root}`]: {
731
+ display: "flex"
732
+ },
733
+ [`& .${W.menuButton}`]: {
734
+ marginRight: 36
735
+ },
736
+ [`& .${W.hide}`]: {
737
+ display: "none"
738
+ },
739
+ [`& .${W.content}`]: {
740
+ flexGrow: 1,
741
+ padding: e.spacing(3)
742
+ }
743
+ // [`& .${classes.userInfoHolder}`]: {
744
+ // height: '148px',
745
+ // marginTop: '64px',
746
+ // marginBottom: '16px',
747
+ // },
748
+ })), B = (e, t, n) => e.transitions.create(t, {
749
+ easing: e.transitions.easing.sharp,
750
+ duration: n === "leaving" ? e.transitions.duration.leavingScreen : e.transitions.duration.enteringScreen
751
+ }), Kt = (e) => {
752
+ const t = K();
753
+ return /* @__PURE__ */ o(
754
+ at,
755
+ u({
756
+ easing: t.transitions.easing.sharp,
757
+ timeout: {
758
+ enter: t.transitions.duration.enteringScreen,
759
+ exit: t.transitions.duration.leavingScreen
760
+ }
761
+ }, e)
762
+ );
763
+ }, qe = (e) => {
764
+ var t, n;
765
+ return {
766
+ overflowX: "hidden",
767
+ color: "inherit",
768
+ backgroundColor: (n = (t = e == null ? void 0 : e.navBar) == null ? void 0 : t.backgroundColor) != null ? n : "white"
769
+ // Provide default so tests don't need to wrap theme provider
770
+ };
771
+ }, Se = (e, t) => u({
772
+ width: t,
773
+ transition: B(e, "width", "entering")
774
+ }, qe(e)), we = (e, t) => u({
775
+ width: t,
776
+ transition: B(e, "width", "leaving")
777
+ }, qe(e)), Xt = $e(rt, {
778
+ shouldForwardProp: (e) => !["widthOpen", "widthClosed", "isSmallScreen"].includes(e)
779
+ })(({ theme: e, open: t, widthOpen: n, widthClosed: i, isSmallScreen: r }) => u(u({
780
+ flexShrink: 0,
781
+ whiteSpace: "nowrap",
782
+ boxSizing: "border-box",
783
+ display: "flex",
784
+ flexDirection: "column"
785
+ }, t && E(u({}, Se(e, n)), {
786
+ backgroundColor: "",
787
+ "& .MuiDrawer-paper": Se(e, n)
788
+ })), !t && E(u({}, we(e, r ? n : i)), {
789
+ backgroundColor: "",
790
+ "& .MuiDrawer-paper": we(e, r ? n : i)
791
+ })));
792
+ function ze(e) {
793
+ return e.replace(
794
+ /(^|-)([a-z])/g,
795
+ (t, n, i) => n === "-" ? " " + i.toUpperCase() : i.toUpperCase()
796
+ );
797
+ }
798
+ function In(e, t, n, i) {
799
+ var c;
800
+ if (!e) return "None";
801
+ const s = Object.entries(e).filter(
802
+ ([a, l]) => a.startsWith("https://greens.org.au/roles/") && l.includes(t)
803
+ ).map(
804
+ ([a]) => {
805
+ var l;
806
+ return ze((l = a.split("/").at(-1)) != null ? l : "");
807
+ }
808
+ );
809
+ return (c = i.find(
810
+ (a) => n[a].some((l) => s.includes(l))
811
+ )) != null ? c : "None";
812
+ }
813
+ const _n = (e) => {
814
+ const { getIdTokenClaims: t, user: n } = ne();
815
+ return Ne({
816
+ queryKey: ["availableDomains", n == null ? void 0 : n.sub],
817
+ queryFn: () => N(null, null, function* () {
818
+ const i = yield t();
819
+ return i ? Object.entries(i).reduce((r, [s, c]) => {
820
+ var d;
821
+ const a = ze((d = s.split("/").at(-1)) != null ? d : ""), l = s.startsWith("https://greens.org.au/roles/") && e.includes(a) ? c : [];
822
+ return [.../* @__PURE__ */ new Set([...r, ...l])];
823
+ }, []) : [];
824
+ })
825
+ });
826
+ }, Tn = (e) => Object.values(e).reduce(
827
+ (t, n) => [.../* @__PURE__ */ new Set([...t, ...n])],
828
+ []
829
+ ), G = {
830
+ log: console.warn.bind(console),
831
+ error: console.error.bind(console),
832
+ warn: console.warn.bind(console),
833
+ info: console.info.bind(console),
834
+ debug: console.debug.bind(console)
835
+ };
836
+ function Nn(e, t) {
837
+ console[e] = (...n) => {
838
+ for (const i of t)
839
+ if (typeof i == "function") {
840
+ if (i(...n)) return;
841
+ } else if (i instanceof RegExp && n.length > 0) {
842
+ for (const r of n)
843
+ if (typeof r == "string" && i.test(r))
844
+ return;
845
+ }
846
+ G[e](n);
847
+ };
848
+ }
849
+ function Pn(e) {
850
+ if (e)
851
+ console[e] = G[e];
852
+ else
853
+ for (const t of Object.keys(G))
854
+ console[t] = G[t];
855
+ }
856
+ function Yt(e) {
857
+ let t = 0;
858
+ for (let n = 0, i = e.length; n < i; n++) {
859
+ const r = e.charCodeAt(n);
860
+ t = (t << 5) - t + r, t |= 0;
861
+ }
862
+ return t;
863
+ }
864
+ const ke = ["#A62A21", "#7e3794", "#0B51C1", "#3A6024", "#A81563", "#B3003C"], ye = (e) => e.split(/\s/).map((t) => t.substring(0, 1).toUpperCase()).filter((t) => !!t).slice(0, 2).join("").toUpperCase();
865
+ function Qt({ user: e, domainCode: t, open: n, useNewAvatar: i = !1 }) {
866
+ const r = K();
867
+ return /* @__PURE__ */ f(
868
+ T,
869
+ {
870
+ sx: {
871
+ paddingTop: 3,
872
+ display: "flex",
873
+ alignItems: "center",
874
+ flexDirection: "column",
875
+ gap: "0.5rem"
876
+ },
877
+ children: [
878
+ !i && /* @__PURE__ */ o(
879
+ T,
880
+ {
881
+ sx: {
882
+ width: n ? "5rem" : "2rem",
883
+ transition: n ? B(r, ["width", "height"], "entering") : B(r, ["width", "height"], "leaving"),
884
+ aspectRatio: 1
885
+ },
886
+ children: e != null && e.name ? /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
887
+ de,
888
+ {
889
+ src: e == null ? void 0 : e.picture,
890
+ sx: {
891
+ width: "100%",
892
+ height: "100%",
893
+ bgcolor: ke[Math.abs(Yt(e == null ? void 0 : e.name)) % ke.length]
894
+ },
895
+ children: ye(e == null ? void 0 : e.name)
896
+ }
897
+ ) }) : /* @__PURE__ */ o(de, { sx: { width: "100%", height: "100%" } })
898
+ }
899
+ ),
900
+ i && /* @__PURE__ */ o(
901
+ T,
902
+ {
903
+ sx: {
904
+ width: n ? "5rem" : "2rem",
905
+ transition: n ? B(r, ["width", "height"], "entering") : B(r, ["width", "height"], "leaving"),
906
+ aspectRatio: 1
907
+ },
908
+ children: e != null && e.name ? /* @__PURE__ */ o($, { children: /* @__PURE__ */ f(fe, { src: e == null ? void 0 : e.picture, name: e == null ? void 0 : e.name, round: !0, size: n ? "80" : "32", children: [
909
+ " ",
910
+ ye(e == null ? void 0 : e.name),
911
+ " ",
912
+ "ab"
913
+ ] }) }) : /* @__PURE__ */ o(fe, {})
914
+ }
915
+ ),
916
+ /* @__PURE__ */ o(Kt, { sx: { width: "100%" }, in: n, children: /* @__PURE__ */ o(st, { in: n, children: /* @__PURE__ */ f(T, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", children: [
917
+ e != null && e.name ? /* @__PURE__ */ o(_, { children: e == null ? void 0 : e.name }) : /* @__PURE__ */ o(ue, { animation: !1, width: "50%" }),
918
+ t ? /* @__PURE__ */ o(_, { children: He(t) }) : /* @__PURE__ */ o(ue, { animation: !1, width: "25%" })
919
+ ] }) }) })
920
+ ]
921
+ }
922
+ );
923
+ }
924
+ function Jt({
925
+ open: e,
926
+ widthClosed: t,
927
+ widthOpen: n,
928
+ "data-testid": i,
929
+ top: r,
930
+ middle: s,
931
+ bottom: c,
932
+ user: a,
933
+ domainCode: l,
934
+ useNewAvatar: d = !1
935
+ }) {
936
+ const m = We(), y = Pe(V);
937
+ return /* @__PURE__ */ o(Vt, { className: W.root, "data-testid": i, children: /* @__PURE__ */ f(
938
+ Xt,
939
+ {
940
+ open: e,
941
+ widthOpen: n,
942
+ widthClosed: t,
943
+ anchor: "left",
944
+ variant: m ? "temporary" : "permanent",
945
+ PaperProps: {
946
+ component: "nav"
947
+ },
948
+ onClose: () => {
949
+ y(!1);
950
+ },
951
+ isSmallScreen: m,
952
+ children: [
953
+ !m && /* @__PURE__ */ o(lt, {}),
954
+ r && /* @__PURE__ */ f(T, { flexGrow: "0", children: [
955
+ r,
956
+ /* @__PURE__ */ o(pe, { variant: "middle", sx: { marginY: "0.5rem" } })
957
+ ] }),
958
+ /* @__PURE__ */ o(T, { flexGrow: "1", children: Array.isArray(s) ? /* @__PURE__ */ o(Gt, { links: s }) : s }),
959
+ /* @__PURE__ */ f(T, { flexGrow: "0", children: [
960
+ /* @__PURE__ */ o(pe, { variant: "middle", sx: { marginY: "0.5rem" } }),
961
+ /* @__PURE__ */ o(Qt, { user: a, domainCode: l, open: e, useNewAvatar: d }),
962
+ c && /* @__PURE__ */ o($, { children: c })
963
+ ] })
964
+ ]
965
+ }
966
+ ) });
967
+ }
968
+ function Zt({
969
+ children: e,
970
+ topBarHeight: t,
971
+ maxWidth: n = !1,
972
+ noPadding: i
973
+ }) {
974
+ return /* @__PURE__ */ o(
975
+ T,
976
+ {
977
+ sx: {
978
+ overflow: "auto",
979
+ height: `calc(100vh - ${t}px)`,
980
+ flexGrow: 1
981
+ },
982
+ children: i ? /* @__PURE__ */ o(T, { component: "main", id: "main-content", height: "inherit", children: e }) : /* @__PURE__ */ o(
983
+ ct,
984
+ {
985
+ component: "main",
986
+ id: "main-content",
987
+ maxWidth: n,
988
+ sx: { paddingTop: 3, paddingBottom: 3, flexGrow: 1 },
989
+ children: e
990
+ }
991
+ )
992
+ }
993
+ );
994
+ }
995
+ const jt = "TopBar", en = {
996
+ titleText: `${jt}-titleText`
997
+ };
998
+ function tn({
999
+ titleText: e = "",
1000
+ height: t,
1001
+ "data-testid": n,
1002
+ middle: i
1003
+ }) {
1004
+ const r = Pe(V), s = () => r((l) => !l), c = K(), a = We();
1005
+ return /* @__PURE__ */ o("header", { "data-testid": n, children: /* @__PURE__ */ f(
1006
+ be,
1007
+ {
1008
+ square: !0,
1009
+ elevation: 0,
1010
+ sx: {
1011
+ width: "100%",
1012
+ position: "sticky",
1013
+ color: "primary.contrastText",
1014
+ backgroundColor: "primary.main",
1015
+ display: "flex",
1016
+ alignItems: "center",
1017
+ gap: 2,
1018
+ flexShrink: 0,
1019
+ height: t,
1020
+ zIndex: a ? 0 : c.zIndex.drawer + 101
1021
+ },
1022
+ children: [
1023
+ /* @__PURE__ */ o(
1024
+ dt,
1025
+ {
1026
+ size: "medium",
1027
+ color: "inherit",
1028
+ sx: { padding: 1.5, marginLeft: "12px" },
1029
+ onClick: s,
1030
+ children: /* @__PURE__ */ o(ht, { fontSize: "medium" })
1031
+ }
1032
+ ),
1033
+ /* @__PURE__ */ o(_, { className: en.titleText, variant: "h6", component: "h1", children: e }),
1034
+ i
1035
+ ]
1036
+ }
1037
+ ) });
1038
+ }
1039
+ function $n({
1040
+ children: e,
1041
+ initialTitleText: t,
1042
+ initialNavBarOpen: n,
1043
+ pageContainerProps: i,
1044
+ pageContentDataTestId: r,
1045
+ topBarDataTestId: s,
1046
+ navBarDataTestId: c,
1047
+ navBarMiddle: a,
1048
+ navBarBottom: l,
1049
+ user: d,
1050
+ domainCode: m,
1051
+ useNewAvatar: y = !1
1052
+ }) {
1053
+ vt([
1054
+ [V, n != null ? n : !0],
1055
+ [ve, t != null ? t : ""]
1056
+ ]);
1057
+ const v = he(V), [g] = R(Ot), [w] = R(Ht), D = he(ve), [p] = R(qt), [k] = R(Wt), [b] = R(zt);
1058
+ return /* @__PURE__ */ f(me, { children: [
1059
+ /* @__PURE__ */ o(Ct, {}),
1060
+ /* @__PURE__ */ o(
1061
+ tn,
1062
+ {
1063
+ titleText: D,
1064
+ "data-testid": s,
1065
+ height: p,
1066
+ middle: k
1067
+ }
1068
+ ),
1069
+ /* @__PURE__ */ f(me, { sx: { display: "flex" }, children: [
1070
+ /* @__PURE__ */ o(
1071
+ Jt,
1072
+ {
1073
+ open: v,
1074
+ top: b,
1075
+ middle: a,
1076
+ bottom: l,
1077
+ user: d,
1078
+ domainCode: m,
1079
+ widthOpen: g,
1080
+ widthClosed: w,
1081
+ offsetTop: p,
1082
+ "data-testid": c,
1083
+ useNewAvatar: y
1084
+ }
1085
+ ),
1086
+ /* @__PURE__ */ o(
1087
+ Zt,
1088
+ E(u({
1089
+ "data-testid": r,
1090
+ topBarHeight: p
1091
+ }, i), {
1092
+ children: e
1093
+ })
1094
+ )
1095
+ ] })
1096
+ ] });
1097
+ }
1098
+ const Mn = Me({
1281
1099
  palette: {
1282
1100
  primary: {
1283
1101
  dark: "#00A651",
@@ -1328,7 +1146,7 @@ const Ne = M(
1328
1146
  navBar: {
1329
1147
  backgroundColor: "#E8E8E8"
1330
1148
  }
1331
- }), cn = ze({
1149
+ }), Ln = Me({
1332
1150
  palette: {
1333
1151
  primary: {
1334
1152
  main: "#007236",
@@ -1382,18 +1200,18 @@ const Ne = M(
1382
1200
  styleOverrides: {
1383
1201
  root: ({ theme: e }) => ({
1384
1202
  "&.Mui-selected": {
1385
- backgroundColor: te(
1203
+ backgroundColor: J(
1386
1204
  e.palette.secondary.main,
1387
1205
  e.palette.action.selectedOpacity
1388
1206
  ),
1389
1207
  "&:hover": {
1390
- backgroundColor: te(
1208
+ backgroundColor: J(
1391
1209
  e.palette.secondary.main,
1392
1210
  e.palette.action.selectedOpacity
1393
1211
  )
1394
1212
  },
1395
1213
  "&.Mui-focusVisible": {
1396
- backgroundColor: te(
1214
+ backgroundColor: J(
1397
1215
  e.palette.secondary.main,
1398
1216
  e.palette.action.focusOpacity
1399
1217
  )
@@ -1424,48 +1242,39 @@ const Ne = M(
1424
1242
  }
1425
1243
  });
1426
1244
  export {
1427
- et as AgDialog,
1428
- jo as AppLayout,
1429
- rn as AuthGuard,
1430
- ot as Context,
1431
- ce as ContextError,
1432
- sn as DomainCodeDialog,
1433
- Wo as ExampleComponent,
1434
- en as FetchAutocomplete,
1435
- tn as MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX,
1436
- Ye as NAVBAR_WIDTH_CLOSED,
1437
- Xe as NAVBAR_WIDTH_OPENED,
1438
- Xo as NavBar,
1439
- qo as NavBarDarkStyledList,
1440
- Go as NavBarLightStyledList,
1441
- Bt as NavBarProvider,
1442
- xo as SaladBarProvider,
1443
- nn as SessionExpiryDialog,
1444
- on as SingleAutocomplete,
1445
- Rt as buildNavBarState,
1446
- Yo as determineUserLevelFromClaims,
1447
- Co as domainCodeAtom,
1448
- ln as fed21Theme,
1449
- io as getAuth0Expiry,
1450
- Qo as getValidBusinessRoles,
1451
- cn as internalAgSystemsTheme,
1452
- H as navBarClasses,
1453
- Q as navBarOpenAtom,
1454
- Gt as navBarTopAtom,
1455
- zt as navBarWidthClosedAtom,
1456
- Wt as navBarWidthOpenAtom,
1457
- Jt as simpleHashCode,
1458
- Jo as suppressConsole,
1459
- be as titleTextAtom,
1245
+ Le as AgDialog,
1246
+ $n as AppLayout,
1247
+ bn as AuthGuard,
1248
+ Be as Context,
1249
+ Ue as ContextError,
1250
+ Lt as DOMAIN_CODE_LABELS,
1251
+ En as DomainCodeDialog,
1252
+ Sn as ExampleComponent,
1253
+ wn as FetchAutocomplete,
1254
+ kn as MUI_AUTOCOMPLETE_VALUE_WARNING_REGEX,
1255
+ Pt as SaladBarProvider,
1256
+ Dn as SessionExpiryDialog,
1257
+ yn as SingleAutocomplete,
1258
+ In as determineUserLevelFromClaims,
1259
+ Mt as domainCodeAtom,
1260
+ Mn as fed21Theme,
1261
+ St as getAuth0Expiry,
1262
+ He as getDomainOptionLabel,
1263
+ Tn as getValidBusinessRoles,
1264
+ Ln as internalAgSystemsTheme,
1265
+ V as navBarOpenAtom,
1266
+ zt as navBarTopAtom,
1267
+ Ht as navBarWidthClosedAtom,
1268
+ Ot as navBarWidthOpenAtom,
1269
+ Yt as simpleHashCode,
1270
+ Nn as suppressConsole,
1271
+ ve as titleTextAtom,
1460
1272
  qt as topBarHeightAtom,
1461
- Vt as topBarMiddleAtom,
1462
- Zo as unsuppressConsole,
1463
- tt as useAutocompleteOptions,
1464
- Pt as useNavBar,
1465
- vo as useSaladBar,
1466
- Ko as useValidDomains,
1467
- Vo as withBrowserRouter,
1468
- zo as withNavBarProvider,
1469
- an as withSaladBarProvider
1273
+ Wt as topBarMiddleAtom,
1274
+ Pn as unsuppressConsole,
1275
+ Re as useAutocompleteOptions,
1276
+ $t as useSaladBar,
1277
+ _n as useValidDomains,
1278
+ Fn as withSaladBarProvider
1470
1279
  };
1471
1280
  //# sourceMappingURL=index.js.map