@instructure/platform-modules 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/adapters/canvasGraphql/normalize.d.ts +1 -0
  2. package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
  3. package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
  4. package/dist/adapters/inMemory.d.ts.map +1 -1
  5. package/dist/chunks/ModulesProgressBar-B1oRo549.js +2548 -0
  6. package/dist/components/FilterSelect.d.ts.map +1 -1
  7. package/dist/components/ModuleCard.d.ts.map +1 -1
  8. package/dist/components/ModuleCard.stories.d.ts +2 -0
  9. package/dist/components/ModuleCard.stories.d.ts.map +1 -1
  10. package/dist/components/ModuleItemRow.d.ts.map +1 -1
  11. package/dist/components/ModulesList.d.ts.map +1 -1
  12. package/dist/components/ModulesList.stories.d.ts +1 -1
  13. package/dist/components/ModulesList.stories.d.ts.map +1 -1
  14. package/dist/components/ModulesProgressBar.d.ts +9 -0
  15. package/dist/components/ModulesProgressBar.d.ts.map +1 -1
  16. package/dist/components/StatusPill.d.ts +2 -0
  17. package/dist/components/StatusPill.d.ts.map +1 -1
  18. package/dist/edit/EditModuleCard.d.ts +5 -3
  19. package/dist/edit/EditModuleCard.d.ts.map +1 -1
  20. package/dist/edit/EditModuleItemRow.d.ts +2 -1
  21. package/dist/edit/EditModuleItemRow.d.ts.map +1 -1
  22. package/dist/edit/ModulesEditView.d.ts.map +1 -1
  23. package/dist/edit/ModulesEditView.stories.d.ts +3 -2
  24. package/dist/edit/ModulesEditView.stories.d.ts.map +1 -1
  25. package/dist/edit/controls/DragHandle.d.ts +12 -0
  26. package/dist/edit/controls/DragHandle.d.ts.map +1 -0
  27. package/dist/edit/dnd/EditDndProvider.d.ts +18 -0
  28. package/dist/edit/dnd/EditDndProvider.d.ts.map +1 -0
  29. package/dist/edit/dnd/announcements.d.ts +24 -0
  30. package/dist/edit/dnd/announcements.d.ts.map +1 -0
  31. package/dist/edit/dnd/ids.d.ts +41 -0
  32. package/dist/edit/dnd/ids.d.ts.map +1 -0
  33. package/dist/edit/index.d.ts +2 -0
  34. package/dist/edit/index.d.ts.map +1 -1
  35. package/dist/edit.js +610 -328
  36. package/dist/hooks/useItemsMode.d.ts.map +1 -1
  37. package/dist/hooks/useModulesPageData.d.ts.map +1 -1
  38. package/dist/index.js +732 -724
  39. package/dist/types/domain.d.ts +2 -0
  40. package/dist/types/domain.d.ts.map +1 -1
  41. package/dist/types/schemas.d.ts.map +1 -1
  42. package/locales/en.json +14 -2
  43. package/package.json +4 -2
  44. package/dist/chunks/ModulesProgressBar-B4fXbi-4.js +0 -2516
@@ -1,2516 +0,0 @@
1
- import { keepPreviousData as In, useQuery as Tn, useQueryClient as Sn, QueryObserver as yo } from "@tanstack/react-query";
2
- import kt from "p-limit";
3
- import { createContext as dt, useContext as Ke, useRef as _, useMemo as W, isValidElement as mt, useState as ne, useEffect as me, useCallback as R, memo as Mo, Fragment as wn, cloneElement as Io } from "react";
4
- import { BREAKPOINTS as To } from "@instructure/platform-with-breakpoints";
5
- import { jsx as l, jsxs as J } from "react/jsx-runtime";
6
- import { useTheme as En } from "@instructure/emotion";
7
- import { ScreenReaderContent as vn } from "@instructure/ui-a11y-content";
8
- import { Flex as U } from "@instructure/ui-flex/v11_7";
9
- import { PlugInstUIIcon as So, ExternalLinkInstUIIcon as wo, FileInstUIIcon as Eo, FileTextInstUIIcon as vo, MessagesSquareInstUIIcon as Co, RocketInstUIIcon as Po, FilePenLineInstUIIcon as _o, ClockInstUIIcon as Ao, CalendarInstUIIcon as gt, LockInstUIIcon as pt, CircleAlertInstUIIcon as Te, CircleCheckInstUIIcon as ft, ClockFadingInstUIIcon as ht, CircleDashedInstUIIcon as bt, CornerDownRightInstUIIcon as Do, IconArrowOpenStartLine as Lo, IconArrowOpenEndLine as xo } from "@instructure/ui-icons";
10
- import { Link as No } from "@instructure/ui-link/v11_7";
11
- import { Text as ue } from "@instructure/ui-text/v11_7";
12
- import { View as ie } from "@instructure/ui-view/v11_7";
13
- import { Pill as Ro } from "@instructure/ui-pill/v11_7";
14
- import { IconButton as Ft } from "@instructure/ui-buttons/v11_7";
15
- import { Heading as Oo } from "@instructure/ui-heading/v11_7";
16
- import { Tooltip as ko } from "@instructure/ui-tooltip/v11_7";
17
- import { z as i } from "zod";
18
- import { isValid as rt, colorToRGB as st, overlayColors as Fo, alpha as qo, color2hex as Cn, contrast as de, darken as zo, lighten as Uo } from "@instructure/ui-color-utils";
19
- const $o = i.object({
20
- target: i.enum(["module", "item"]),
21
- field: i.string(),
22
- op: i.enum(["eq", "contains", "within"]),
23
- value: i.union([i.string(), i.boolean(), i.number()])
24
- }).strict();
25
- function Bo(e, t) {
26
- const n = e == null ? void 0 : e[t.target];
27
- return !n || !Object.prototype.hasOwnProperty.call(n, t.field) ? !1 : n[t.field].includes(t.op);
28
- }
29
- const Wo = i.enum([
30
- "assignment",
31
- "quiz",
32
- "discussion",
33
- "page",
34
- "file",
35
- "external_url",
36
- "external_tool",
37
- "sub_header"
38
- ]), Go = i.enum(["not_started", "in_progress", "complete", "incomplete", "missing", "locked"]), jo = i.enum([
39
- "not_started",
40
- "in_progress",
41
- "complete",
42
- "missing",
43
- "incomplete",
44
- "missing_and_incomplete",
45
- "locked"
46
- ]), Ho = i.enum([
47
- "must_view",
48
- "must_mark_done",
49
- "must_contribute",
50
- "must_submit",
51
- "min_score",
52
- "min_percentage",
53
- "unknown"
54
- ]), Ko = i.object({
55
- status: jo.optional(),
56
- requirementsMet: i.number(),
57
- requirementCount: i.number(),
58
- percentComplete: i.number().min(0).max(100),
59
- nextDueAt: i.string().nullish(),
60
- missingCount: i.number(),
61
- incompleteCount: i.number()
62
- }), Pn = i.object({
63
- itemId: i.string(),
64
- type: Ho,
65
- minScore: i.number().nullish(),
66
- minPercentage: i.number().nullish()
67
- }), _n = i.object({
68
- id: i.string(),
69
- moduleId: i.string(),
70
- title: i.string(),
71
- type: Wo,
72
- position: i.number(),
73
- indent: i.number(),
74
- published: i.boolean(),
75
- url: i.string().nullish(),
76
- newTab: i.boolean().nullish(),
77
- completionRequirement: Pn.nullish(),
78
- dueAt: i.string().nullish(),
79
- status: Go.optional(),
80
- pointsPossible: i.number().nullish(),
81
- extensions: i.record(i.unknown()).optional()
82
- }), Yo = i.object({
83
- id: i.string(),
84
- name: i.string()
85
- }), Qo = i.object({
86
- id: i.string(),
87
- name: i.string(),
88
- position: i.number(),
89
- published: i.boolean(),
90
- itemCount: i.number(),
91
- estimatedDurationMinutes: i.number().optional(),
92
- items: i.array(_n).optional(),
93
- unlockAt: i.string().nullish(),
94
- prerequisiteModules: i.array(Yo),
95
- requirementCount: i.number().nullish(),
96
- requireSequentialProgress: i.boolean(),
97
- completionRequirements: i.array(Pn).optional(),
98
- progress: Ko.optional(),
99
- collapsed: i.boolean().nullish(),
100
- extensions: i.record(i.unknown()).optional()
101
- }), hl = i.object({
102
- hasNextPage: i.boolean(),
103
- endCursor: i.string().nullable()
104
- }).refine((e) => !e.hasNextPage || e.endCursor !== null, {
105
- message: 'hasNextPage is true but endCursor is null: there is another page and no cursor to ask for it with, which renders a "Load more" that can never load.',
106
- path: ["endCursor"]
107
- }), An = i.object({
108
- hasNextPage: i.boolean(),
109
- endCursor: i.string().nullable(),
110
- hasPreviousPage: i.boolean(),
111
- startCursor: i.string().nullable(),
112
- totalCount: i.number().nullable(),
113
- totalNrOfPages: i.number().nullable()
114
- }).refine((e) => !e.hasNextPage || e.endCursor !== null, {
115
- message: 'hasNextPage is true but endCursor is null: there is another page and no cursor to ask for it with, which renders a "Load more" that can never load.',
116
- path: ["endCursor"]
117
- }), bl = i.object({
118
- modules: i.array(Qo),
119
- pageInfo: An
120
- }), yl = i.object({
121
- items: i.array(_n),
122
- pageInfo: An
123
- }), Dn = "career.estimatedDurationMinutes";
124
- function Ln(e) {
125
- var n;
126
- const t = (n = e.extensions) == null ? void 0 : n[Dn];
127
- return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : t;
128
- }
129
- function Ml(e, t) {
130
- return t == null ? e : { ...e, [Dn]: t };
131
- }
132
- const Vo = "modules.suppressItemNumbering";
133
- function Il(e) {
134
- var t;
135
- return ((t = e.extensions) == null ? void 0 : t[Vo]) === !0;
136
- }
137
- const Zo = "organize.newPlacement", Xo = "organize.newModule", Jo = "organize.addedItemCount";
138
- function Tl(e) {
139
- var t;
140
- return ((t = e.extensions) == null ? void 0 : t[Zo]) === !0;
141
- }
142
- function Sl(e) {
143
- var t;
144
- return ((t = e.extensions) == null ? void 0 : t[Xo]) === !0;
145
- }
146
- function wl(e) {
147
- var n;
148
- const t = (n = e.extensions) == null ? void 0 : n[Jo];
149
- return typeof t != "number" || !Number.isInteger(t) || t < 0 ? 0 : t;
150
- }
151
- const xn = dt(null), er = () => {
152
- };
153
- function El({
154
- host: e,
155
- onEvent: t,
156
- children: n
157
- }) {
158
- const o = _(t);
159
- o.current = t;
160
- const r = W(
161
- () => (s) => o.current({ event: s, host: e }),
162
- [e]
163
- );
164
- return /* @__PURE__ */ l(xn.Provider, { value: r, children: n });
165
- }
166
- function tr() {
167
- return Ke(xn) ?? er;
168
- }
169
- const qt = 100, Nn = 2e3;
170
- class nr extends Error {
171
- constructor(t, n) {
172
- super(
173
- `This in-memory adapter was built for course ${t} but was asked for course ${n}. A fixture serves exactly one course.`
174
- ), this.name = "InMemoryCourseMismatchError", this.expected = t, this.received = n;
175
- }
176
- }
177
- const zt = (e) => `offset:${e}`, Ut = (e) => {
178
- if (!e) return 0;
179
- const t = Number.parseInt(e.replace("offset:", ""), 10);
180
- return Number.isFinite(t) && t >= 0 ? t : 0;
181
- }, ze = (e) => {
182
- if (e != null && e.aborted)
183
- throw new DOMException("The operation was aborted.", "AbortError");
184
- };
185
- function $t(e, t, n) {
186
- const o = e.length, r = Math.ceil(o / n), s = t.kind === "first" ? 0 : t.kind === "after" ? Ut(t.cursor) : t.kind === "before" ? Math.max(0, Ut(t.cursor) - n) : Math.max(0, o - t.count), a = e.slice(s, s + n), c = s + a.length, d = c < o, g = s > 0;
187
- return {
188
- slice: a,
189
- pageInfo: {
190
- hasNextPage: d,
191
- endCursor: d ? zt(c) : null,
192
- hasPreviousPage: g,
193
- startCursor: g ? zt(s) : null,
194
- totalCount: o,
195
- totalNrOfPages: r
196
- }
197
- };
198
- }
199
- const or = /* @__PURE__ */ new Map([
200
- ["COMPLETED", (e) => {
201
- var t;
202
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
203
- }],
204
- ["IN_PROGRESS", (e) => {
205
- var t;
206
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
207
- }],
208
- ["INCOMPLETE", (e) => {
209
- var t;
210
- return ((t = e.progress) == null ? void 0 : t.status) !== "complete";
211
- }],
212
- [
213
- "NOT_STARTED",
214
- (e) => {
215
- var t, n;
216
- return ((t = e.progress) == null ? void 0 : t.status) !== "complete" && ((n = e.progress) == null ? void 0 : n.status) !== "in_progress";
217
- }
218
- ]
219
- ]), rr = /* @__PURE__ */ new Map([
220
- ["locked", (e) => {
221
- var t;
222
- return ((t = e.progress) == null ? void 0 : t.status) === "locked";
223
- }],
224
- ["missing", (e) => {
225
- var t;
226
- return ((t = e.progress) == null ? void 0 : t.status) === "missing";
227
- }],
228
- ["missing_and_incomplete", (e) => {
229
- var t;
230
- return ((t = e.progress) == null ? void 0 : t.status) === "missing_and_incomplete";
231
- }],
232
- ["incomplete", (e) => {
233
- var t;
234
- return ((t = e.progress) == null ? void 0 : t.status) === "incomplete";
235
- }],
236
- ["complete", (e) => {
237
- var t;
238
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
239
- }],
240
- ["in_progress", (e) => {
241
- var t;
242
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
243
- }],
244
- ["not_started", (e) => {
245
- var t;
246
- return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
247
- }]
248
- ]), sr = {
249
- module: { completionStatus: ["eq"], moduleStatus: ["eq"], dueWithinDays: ["within"] }
250
- };
251
- function ir(e) {
252
- const t = Date.parse(e.start), n = Date.parse(e.end);
253
- return (o) => {
254
- var a;
255
- const r = (a = o.progress) == null ? void 0 : a.nextDueAt;
256
- if (!r) return !1;
257
- const s = Date.parse(r);
258
- return s >= t && s <= n;
259
- };
260
- }
261
- function ar(e, t) {
262
- if (e.target === "module" && e.field === "completionStatus" && e.op === "eq") {
263
- const n = typeof e.value == "string" ? or.get(e.value) : void 0;
264
- if (!n) throw new Error(`unknown completionStatus "${String(e.value)}"`);
265
- return n;
266
- }
267
- if (e.target === "module" && e.field === "moduleStatus" && e.op === "eq") {
268
- const n = typeof e.value == "string" ? rr.get(e.value) : void 0;
269
- if (!n) throw new Error(`unknown moduleStatus "${String(e.value)}"`);
270
- return n;
271
- }
272
- if (e.target === "module" && e.field === "dueWithinDays" && e.op === "within") {
273
- if (!t) throw new Error("A dueWithinDays clause needs a dueRange");
274
- return ir(t);
275
- }
276
- throw new Error(`in-memory adapter cannot compile ${e.target}.${e.field} ${e.op}`);
277
- }
278
- function vl(e, t = {}) {
279
- const n = (r) => e.itemsByModuleId[r] ?? [], o = (r) => {
280
- if (r !== e.courseId)
281
- throw new nr(e.courseId, r);
282
- };
283
- return {
284
- capabilities: sr,
285
- async listModules({
286
- courseId: r,
287
- page: s = { kind: "first" },
288
- pageSize: a,
289
- includeItems: c,
290
- filter: d,
291
- dueRange: g,
292
- inlineItemsFirst: h,
293
- signal: p
294
- }) {
295
- var T;
296
- ze(p), o(r), (T = t.onRequest) == null || T.call(t, "listModules", { operation: "listModules", courseId: r });
297
- const b = d ? e.modules.filter(ar(d, g)) : e.modules, { slice: I, pageInfo: x } = $t(b, s, a), O = Math.min(h ?? qt, qt);
298
- return { modules: I.map((E) => {
299
- const D = n(E.id), N = c && D.length <= O;
300
- return { ...E, itemCount: D.length, items: N ? D : void 0 };
301
- }), pageInfo: x };
302
- },
303
- async listModuleItems({
304
- courseId: r,
305
- moduleId: s,
306
- page: a = { kind: "first" },
307
- pageSize: c,
308
- signal: d
309
- }) {
310
- var p;
311
- ze(d), o(r), (p = t.onRequest) == null || p.call(t, "listModuleItems", { operation: "listModuleItems", courseId: r, moduleId: s });
312
- const { slice: g, pageInfo: h } = $t(n(s), a, c);
313
- return { items: g, pageInfo: h };
314
- },
315
- async setModuleCollapsed({
316
- courseId: r,
317
- moduleId: s,
318
- collapsed: a,
319
- signal: c
320
- }) {
321
- var g;
322
- ze(c), o(r), (g = t.onRequest) == null || g.call(t, "setModuleCollapsed", {
323
- operation: "setModuleCollapsed",
324
- courseId: r,
325
- moduleId: s,
326
- collapsed: a
327
- });
328
- const d = e.modules.findIndex((h) => h.id === s);
329
- d !== -1 && (e.modules[d] = { ...e.modules[d], collapsed: a });
330
- },
331
- async setAllModulesCollapsed({
332
- courseId: r,
333
- collapsed: s,
334
- signal: a
335
- }) {
336
- var c;
337
- ze(a), o(r), (c = t.onRequest) == null || c.call(t, "setAllModulesCollapsed", {
338
- operation: "setAllModulesCollapsed",
339
- courseId: r,
340
- collapsed: s
341
- }), e.modules = e.modules.map((d) => ({ ...d, collapsed: s }));
342
- }
343
- };
344
- }
345
- const Me = ["platform-modules"], Ne = {
346
- all: Me,
347
- course: (e) => [...Me, e],
348
- list: (e, t = {}) => [...Me, e, "list", t],
349
- items: (e, t, n = {}) => [...Me, e, "module", t, "items", n]
350
- };
351
- function cr(e) {
352
- return [...Me, e, "list"];
353
- }
354
- function We(e, t) {
355
- return [...Me, e, "module", t, "items"];
356
- }
357
- function Cl(e, t, n, o) {
358
- const r = o ? Ne.items(t, n, o) : We(t, n);
359
- return e.invalidateQueries({ queryKey: r });
360
- }
361
- function Pl(e, t, n) {
362
- const o = n ? Ne.list(t, n) : cr(t);
363
- return e.invalidateQueries({ queryKey: o });
364
- }
365
- function _l(e, t) {
366
- return e.invalidateQueries({ queryKey: Ne.course(t) });
367
- }
368
- const it = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
369
- function Bt(e, t) {
370
- const n = Object.entries(t ?? {}).filter(([, o]) => o !== void 0);
371
- return { ...e, ...Object.fromEntries(n) };
372
- }
373
- function Al(e, t = {}) {
374
- const n = Object.keys(e).map((r) => [
375
- r,
376
- Bt(e[r], it(t, r) ? t[r] : void 0)
377
- ]), o = Object.keys(t).filter((r) => !it(e, r)).sort().map((r) => [r, Bt({}, t[r])]);
378
- return Object.fromEntries([...n, ...o]);
379
- }
380
- function we(e, t) {
381
- if (!(!it(e, t) || e[t].hidden))
382
- return e[t];
383
- }
384
- function Rn(e) {
385
- return Object.keys(e).filter((t) => we(e, t) !== void 0).map((t) => ({ ...e[t], key: t })).sort((t, n) => t.order - n.order);
386
- }
387
- const lr = "Page %{page} of %{pageCount}", ur = "First page", dr = "Previous page", mr = "Next page", gr = "Last page", pr = "Page %{page}", fr = "…", hr = "Expand all modules", br = "Collapse all modules", yr = { one: "Loading items in %{count} module…", other: "Loading items in %{count} modules…" }, Mr = "All items loaded", Ir = { one: "%{count} module expanded", other: "%{count} modules expanded" }, Tr = { one: "%{count} module collapsed", other: "%{count} modules collapsed" }, Sr = "Modules failed to load: %{message}", wr = "Loading modules", Er = "No modules available yet", vr = "Modules will appear here once your instructor publishes them. Check back soon or reach out to your instructor for more information.", Cr = "No matching results", Pr = "Adjust or clear your filters to see more items.", _r = "Clear filters", Ar = "Show:", Dr = "All", Lr = "Not started", xr = "In progress", Nr = "Complete", Rr = "Due soon", Or = "Missing", kr = "Locked until %{name} is completed.", Fr = "Locked until %{prerequisites} are completed.", qr = "%{count} prerequisites", zr = "%{label}. %{name}", Ur = "%{label} %{name}", $r = "%{name} progress", Br = { one: "%{loaded} of %{count} item loaded in %{name}", other: "%{loaded} of %{count} items loaded in %{name}" }, Wr = "Items failed to load: %{message}", Gr = "Loading items", jr = "Loading…", Hr = "No items.", Kr = "%{name} items pages", Yr = "Page %{page} of %{pageCount} in %{name}", Qr = "(unpublished)", Vr = "Collapse %{name}", Zr = "Expand %{name}", Xr = "Not started", Jr = "In progress", es = "All completed", ts = "%{count} Missing", ns = "%{count} Incomplete", os = "%{missing} & %{incomplete}", rs = "Locked", ss = "Due soon", is = "Not started", as = "In progress", cs = "Completed", ls = "Incomplete", us = "Missing", ds = "Locked", ms = "Due soon", gs = "Assignment", ps = "Quiz", fs = "Discussion", hs = "Page", bs = "File", ys = "External URL", Ms = "External tool", Is = "Text header", Ts = "Item type", Ss = "Due date", ws = "Points", Es = "Requirement", vs = "Estimated duration", Cs = "Publish state", Ps = "View the item", _s = "Submit the assignment", As = "Contribute to the page", Ds = "Mark as done", Ls = "Score at least the minimum", xs = "Score at least %{count}", Ns = "Score at least the minimum percentage", Rs = "Score at least %{count}%", Os = "Complete the requirement", ks = "today, %{time}", Fs = "yesterday, %{time}", qs = "tomorrow, %{time}", zs = "%{date}, %{time}", Us = "%{time} (%{zone})", $s = "Due %{when}", Bs = "Past due %{when}", Ws = "Will unlock on %{when}", Gs = "Unlocked on %{when}", js = "%{duration} to complete", Hs = "%{duration} remaining", Ks = "%{hours}h %{minutes}m", Ys = "%{count}h", Qs = "%{count}m", Vs = { one: "%{count} pt", other: "%{count} pts" }, Zs = "%{met} of %{count}", Xs = { one: "%{met} of %{count} requirement met", other: "%{met} of %{count} requirements met" }, Js = "%{percent}%", ei = { one: "%{completedModules} of %{totalModules} module complete", other: "%{completedModules} of %{totalModules} modules complete" }, ti = "(%{itemsSummary})", ni = { one: "%{completedItems} of %{totalItems} item", other: "%{completedItems} of %{totalItems} items" }, oi = "Module progress", ri = "Module progress pages", si = "Modules %{start}–%{end} of %{total}", ii = "%{name}: %{status}", ai = "%{count}min", ci = "%{count}hr", li = "%{hours}hr %{minutes}min", ui = "Unpublished", di = "Untitled item", mi = "opens in a new window", gi = "Organize with AI", pi = "Organize content into modules", fi = "Module progression", hi = "Set module prerequisites", bi = "Set item requirements per module", yi = "Close", Mi = "What should this do?", Ii = "Place new content only", Ti = "Reorganize the whole course", Si = "This rebuilds every module in the course. Existing modules can be renamed, refilled, or removed.", wi = "Content to organize", Ei = "Anything else it should know? (optional)", vi = "For example: keep the lab work together and put it last.", Ci = "%{used}/%{max}", Pi = "Choose at least one kind of content.", _i = "Organize", Ai = "Cancel", Di = "Start over", Li = "Regenerate", xi = "Apply", Ni = "Try again", Ri = "Organizing your content…", Oi = "Creating your modules…", ki = "Still working. Large courses take longer.", Fi = "Your proposal is ready to review.", qi = "Your modules were created.", zi = "Your content could not be organized: %{message}", Ui = "Your modules could not be created: %{message}", $i = "Proposed modules", Bi = "New module", Wi = { one: "%{count} item added", other: "%{count} items added" }, Gi = "New", ji = "New placement", Hi = { one: "%{count} item was not placed", other: "%{count} items were not placed" }, Ki = "You can still apply this. Anything left out stays where it is.", Yi = { one: "%{count} thing to know", other: "%{count} things to know" }, Qi = "No modules yet", Vi = "Modules you add to this course appear here.", Zi = { one: "%{count} item", other: "%{count} items" }, Xi = "Complete all required items in any order", Ji = "Complete all required items in order", ea = "Complete one required item", ta = "Required", na = "Optional", oa = {
388
- pageChangedAnnouncement: lr,
389
- paginationFirstPage: ur,
390
- paginationPreviousPage: dr,
391
- paginationNextPage: mr,
392
- paginationLastPage: gr,
393
- paginationPageLabel: pr,
394
- paginationEllipsis: fr,
395
- expandAllModules: hr,
396
- collapseAllModules: br,
397
- expandAllLoadingItems: yr,
398
- expandAllItemsLoaded: Mr,
399
- modulesExpandedAnnouncement: Ir,
400
- modulesCollapsedAnnouncement: Tr,
401
- modulesLoadErrorAlert: Sr,
402
- modulesLoadingSpinnerLabel: wr,
403
- noModulesEmptyStateTitle: Er,
404
- noModulesEmptyStateDescription: vr,
405
- filteredEmptyStateTitle: Cr,
406
- filteredEmptyStateDescription: Pr,
407
- clearFilters: _r,
408
- filterGroupLabel: Ar,
409
- filterAll: Dr,
410
- filterNotStarted: Lr,
411
- filterInProgress: xr,
412
- filterComplete: Nr,
413
- filterDueThisWeek: Rr,
414
- filterMissing: Or,
415
- lockedByPrerequisiteByline: kr,
416
- lockedByPrerequisitesByline: Fr,
417
- lockedByPrerequisitesCount: qr,
418
- moduleNameWithLabel: zr,
419
- itemNameWithLabel: Ur,
420
- moduleProgressScreenReaderLabel: $r,
421
- itemsLoadedAnnouncement: Br,
422
- itemsLoadErrorAlert: Wr,
423
- itemsLoadingSpinnerLabel: Gr,
424
- itemsLoadingText: jr,
425
- noItemsEmptyState: Hr,
426
- itemsPaginationLabel: Kr,
427
- itemsPageChangedAnnouncement: Yr,
428
- moduleUnpublishedBadge: Qr,
429
- collapseModule: Vr,
430
- expandModule: Zr,
431
- moduleStatusNotStarted: Xr,
432
- moduleStatusInProgress: Jr,
433
- moduleStatusComplete: es,
434
- moduleStatusMissing: ts,
435
- moduleStatusIncomplete: ns,
436
- moduleStatusMissingAndIncomplete: os,
437
- moduleStatusLocked: rs,
438
- moduleStatusDueSoon: ss,
439
- itemStatusNotStarted: is,
440
- itemStatusInProgress: as,
441
- itemStatusComplete: cs,
442
- itemStatusIncomplete: ls,
443
- itemStatusMissing: us,
444
- itemStatusLocked: ds,
445
- itemStatusDueSoon: ms,
446
- itemTypeAssignment: gs,
447
- itemTypeQuiz: ps,
448
- itemTypeDiscussion: fs,
449
- itemTypePage: hs,
450
- itemTypeFile: bs,
451
- itemTypeExternalUrl: ys,
452
- itemTypeExternalTool: Ms,
453
- itemTypeSubHeader: Is,
454
- metaFieldTypeLabel: Ts,
455
- metaFieldDueAtLabel: Ss,
456
- metaFieldPointsLabel: ws,
457
- metaFieldRequirementLabel: Es,
458
- metaFieldDurationLabel: vs,
459
- metaFieldPublishStateLabel: Cs,
460
- requirementMustView: Ps,
461
- requirementMustSubmit: _s,
462
- requirementMustContribute: As,
463
- requirementMustMarkDone: Ds,
464
- requirementMinScoreUnknown: Ls,
465
- requirementMinScore: xs,
466
- requirementMinPercentageUnknown: Ns,
467
- requirementMinPercentage: Rs,
468
- requirementUnknown: Os,
469
- dateTimeToday: ks,
470
- dateTimeYesterday: Fs,
471
- dateTimeTomorrow: qs,
472
- dateTimeWithDate: zs,
473
- timeWithZone: Us,
474
- dueByline: $s,
475
- pastDueByline: Bs,
476
- unlockByline: Ws,
477
- unlockedByline: Gs,
478
- estimatedDurationByline: js,
479
- remainingDurationByline: Hs,
480
- estimatedDurationHoursAndMinutes: Ks,
481
- estimatedDurationHours: Ys,
482
- estimatedDurationMinutesAbbreviated: Qs,
483
- pointsAbbreviated: Vs,
484
- progressSummary: Zs,
485
- progressScreenReaderValue: Xs,
486
- moduleProgressOverviewPercentLabel: Js,
487
- moduleProgressOverviewSummary: ei,
488
- moduleProgressOverviewDetail: ti,
489
- moduleProgressOverviewItemsSummary: ni,
490
- moduleProgressOverviewGroupLabel: oi,
491
- moduleProgressOverviewPaginationLabel: ri,
492
- moduleProgressOverviewPageRange: si,
493
- moduleProgressSegmentLabel: ii,
494
- durationMinutes: ai,
495
- durationHours: ci,
496
- durationHoursAndMinutes: li,
497
- itemUnpublishedLabel: ui,
498
- itemUntitled: di,
499
- opensInNewWindow: mi,
500
- organizeModulesTrigger: gi,
501
- organizeModalLabel: pi,
502
- organizeProgressionLegend: fi,
503
- organizeSetPrerequisites: hi,
504
- organizeSetRequirements: bi,
505
- organizeCloseModal: yi,
506
- organizeModeLegend: Mi,
507
- organizeModePlaceNew: Ii,
508
- organizeModeReorganizeAll: Ti,
509
- organizeReorganizeWarning: Si,
510
- organizeContentTypesLegend: wi,
511
- organizeDirectionLabel: Ei,
512
- organizeDirectionPlaceholder: vi,
513
- organizeDirectionCount: Ci,
514
- organizeErrorPickAContentType: Pi,
515
- organizeSubmit: _i,
516
- organizeCancel: Ai,
517
- organizeStartOver: Di,
518
- organizeRegenerate: Li,
519
- organizeApply: xi,
520
- organizeTryAgain: Ni,
521
- organizeLoadingLabel: Ri,
522
- organizeApplyingLabel: Oi,
523
- organizeStillWorking: ki,
524
- organizeProposalReadyAnnouncement: Fi,
525
- organizeAppliedAnnouncement: qi,
526
- organizeFailed: zi,
527
- organizeApplyFailed: Ui,
528
- organizePreviewHeading: $i,
529
- organizeNewModuleLabel: Bi,
530
- organizeItemsAddedLabel: Wi,
531
- organizeNewItemPill: Gi,
532
- metaFieldNewPlacementLabel: ji,
533
- organizeUnplacedHeading: Hi,
534
- organizeUnplacedExplanation: Ki,
535
- organizeWarningsHeading: Yi,
536
- editNoModulesTitle: Qi,
537
- editNoModulesDescription: Vi,
538
- moduleItemCount: Zi,
539
- moduleRequirementAll: Xi,
540
- moduleRequirementAllInOrder: Ji,
541
- moduleRequirementOne: ea,
542
- itemRequiredTag: ta,
543
- itemOptionalTag: na
544
- }, ra = /%\{(\w+)\}/g, sa = oa, ae = "en-US", ia = /* @__PURE__ */ new Map(), aa = /* @__PURE__ */ new Map();
545
- function On(e, t, n) {
546
- const o = e.get(t);
547
- if (o) return o;
548
- const r = n();
549
- return e.set(t, r), r;
550
- }
551
- function ca(e, t, n) {
552
- return n ? e.replace(ra, (o, r) => {
553
- if (!Object.prototype.hasOwnProperty.call(n, r)) return o;
554
- const s = n[r];
555
- return typeof s == "number" && Number.isFinite(s) ? On(aa, t, () => new Intl.NumberFormat(t)).format(s) : String(s);
556
- }) : e;
557
- }
558
- function la(e, t, n) {
559
- const o = n == null ? void 0 : n.count;
560
- if (typeof o == "number" && Number.isFinite(o)) {
561
- const r = On(ia, t, () => new Intl.PluralRules(t)).select(o), s = e[r];
562
- if (typeof s == "string") return s;
563
- }
564
- return typeof e.other == "string" ? e.other : void 0;
565
- }
566
- function Wt(e, t, n) {
567
- if (typeof e == "string") return e;
568
- if (e !== null && typeof e == "object")
569
- return la(e, t, n);
570
- }
571
- const Gt = /* @__PURE__ */ new Set();
572
- function ua(e) {
573
- Gt.has(e) || (Gt.add(e), console.warn(
574
- `[platform-modules] no translation for "${e}"; it will render as itself. Add it to the catalog passed to ModulesI18nProvider.`
575
- ));
576
- }
577
- function da(e, t, n, o, r) {
578
- const s = Wt(e == null ? void 0 : e[t], n, r);
579
- if (typeof s == "string") return s;
580
- const a = Wt(sa[t], n, r);
581
- return typeof a == "string" ? a : (o && ua(t), t);
582
- }
583
- function kn(e, t = ae, n = !1) {
584
- return (o, r) => ca(da(e, o, t, n, r), t, r);
585
- }
586
- const ma = kn(), ga = { t: ma, locale: ae }, at = dt(null);
587
- function Dl({
588
- translations: e,
589
- locale: t,
590
- timezone: n,
591
- warnOnMissingKey: o,
592
- children: r
593
- }) {
594
- const s = Ke(at), a = W(() => {
595
- const c = (s == null ? void 0 : s.translations) === void 0 ? e : { ...s.translations, ...e }, d = t ?? (s == null ? void 0 : s.locale) ?? ae;
596
- return {
597
- t: kn(c, d, o),
598
- locale: d,
599
- timezone: n ?? (s == null ? void 0 : s.timezone),
600
- translations: c
601
- };
602
- }, [s, e, t, n, o]);
603
- return /* @__PURE__ */ l(at.Provider, { value: a, children: r });
604
- }
605
- function oe() {
606
- return Ke(at) ?? ga;
607
- }
608
- const ct = 864e5, lt = "en-US", jt = /* @__PURE__ */ new Map(), Ht = /* @__PURE__ */ new Map();
609
- function pa(e) {
610
- const t = Ht.get(e);
611
- if (t) return t;
612
- const n = new Intl.NumberFormat(e, { useGrouping: !1 });
613
- return Ht.set(e, n), n;
614
- }
615
- function Kt(e, t) {
616
- return {
617
- time: new Intl.DateTimeFormat(e, {
618
- hour: "numeric",
619
- minute: "2-digit",
620
- timeZone: t
621
- }),
622
- day: new Intl.DateTimeFormat(e, { month: "long", day: "numeric", timeZone: t }),
623
- dayYear: new Intl.DateTimeFormat(e, {
624
- month: "long",
625
- day: "numeric",
626
- year: "numeric",
627
- timeZone: t
628
- }),
629
- zone: t ? new Intl.DateTimeFormat(e, { timeZone: t, timeZoneName: "short" }) : void 0,
630
- civilDay: new Intl.DateTimeFormat(lt, {
631
- year: "numeric",
632
- month: "numeric",
633
- day: "numeric",
634
- timeZone: t
635
- })
636
- };
637
- }
638
- function yt(e, t) {
639
- const n = t || void 0, o = `${e}|${n ?? ""}`, r = jt.get(o);
640
- if (r) return r;
641
- let s;
642
- try {
643
- s = Kt(e, n);
644
- } catch {
645
- console.warn(
646
- `[platform-modules] Unusable timezone ${JSON.stringify(n)}; rendering dates in the viewer's own clock instead.`
647
- ), s = Kt(e, void 0);
648
- }
649
- return jt.set(o, s), s;
650
- }
651
- function Yt(e, t) {
652
- return new Date(Ge(e, t)).getUTCFullYear();
653
- }
654
- function fa(e, t) {
655
- var o;
656
- const n = (o = e.zone) == null ? void 0 : o.formatToParts(t).find((r) => r.type === "timeZoneName");
657
- return (n == null ? void 0 : n.value) ?? null;
658
- }
659
- function Fn(e, t) {
660
- var n;
661
- return Number((n = e.find((o) => o.type === t)) == null ? void 0 : n.value);
662
- }
663
- function Ge(e, t) {
664
- const n = e.civilDay.formatToParts(t), o = (r) => Fn(n, r);
665
- return Date.UTC(o("year"), o("month") - 1, o("day"));
666
- }
667
- function ha(e, t, n) {
668
- return Bn(yt(ae, n), e, t);
669
- }
670
- const Qt = {
671
- hour12: !1,
672
- year: "numeric",
673
- month: "numeric",
674
- day: "numeric",
675
- hour: "numeric",
676
- minute: "numeric",
677
- second: "numeric"
678
- }, Vt = /* @__PURE__ */ new Map();
679
- function ba(e) {
680
- const t = e || void 0, n = t ?? "", o = Vt.get(n);
681
- if (o) return o;
682
- let r;
683
- try {
684
- r = new Intl.DateTimeFormat(lt, { ...Qt, timeZone: t });
685
- } catch {
686
- r = new Intl.DateTimeFormat(lt, Qt);
687
- }
688
- return Vt.set(n, r), r;
689
- }
690
- function Zt(e, t) {
691
- const n = ba(e).formatToParts(t), o = (s) => Fn(n, s);
692
- return Date.UTC(
693
- o("year"),
694
- o("month") - 1,
695
- o("day"),
696
- o("hour") % 24,
697
- o("minute"),
698
- o("second")
699
- ) - Math.floor(t.getTime() / 1e3) * 1e3;
700
- }
701
- function Xt(e, t) {
702
- const n = Ge(yt(ae, t), e), o = new Date(n - Zt(t, e));
703
- return n - Zt(t, o);
704
- }
705
- function ya(e, t, n) {
706
- const o = Xt(e, n), r = new Date(o + t * ct + ct / 2);
707
- return {
708
- start: e.toISOString(),
709
- end: new Date(Xt(r, n) - 1).toISOString()
710
- };
711
- }
712
- const qn = 7;
713
- function zn(e) {
714
- if (!e) return null;
715
- const t = new Date(e);
716
- return Number.isNaN(t.getTime()) ? null : t;
717
- }
718
- function Un(e, t, n) {
719
- const o = zn(e);
720
- return o === null || $n(e, t) ? !1 : ha(o, t, n) < qn;
721
- }
722
- function $n(e, t) {
723
- const n = zn(e);
724
- return n !== null && n.getTime() < t.getTime();
725
- }
726
- function Bn(e, t, n) {
727
- return Math.round((Ge(e, t) - Ge(e, n)) / ct);
728
- }
729
- function Ma(e, t, n, { locale: o = ae, timezone: r } = {}) {
730
- const s = new Date(t);
731
- if (Number.isNaN(s.getTime())) return t;
732
- const a = yt(o, r), c = fa(a, s), d = a.time.format(s), g = c ? e("timeWithZone", { time: d, zone: c }) : d, h = Bn(a, s, n);
733
- if (h === 0) return e("dateTimeToday", { time: g });
734
- if (h === -1) return e("dateTimeYesterday", { time: g });
735
- if (h === 1) return e("dateTimeTomorrow", { time: g });
736
- const b = Yt(a, s) === Yt(a, n) ? a.day.format(s) : a.dayYear.format(s);
737
- return e("dateTimeWithDate", { date: b, time: g });
738
- }
739
- function Wn(e, t = ae) {
740
- return !Number.isInteger(e) || e < 1 ? null : pa(t).format(e);
741
- }
742
- function Ia(e, t, n = ae) {
743
- if (!e || t === void 0) return null;
744
- const o = Wn(t, n);
745
- return o === null ? null : `${e}.${o}`;
746
- }
747
- function Ta(e, t) {
748
- return t == null ? null : e("pointsAbbreviated", { count: t });
749
- }
750
- function Sa(e, t) {
751
- switch (t.type) {
752
- case "must_view":
753
- return e("requirementMustView");
754
- case "must_submit":
755
- return e("requirementMustSubmit");
756
- case "must_contribute":
757
- return e("requirementMustContribute");
758
- case "must_mark_done":
759
- return e("requirementMustMarkDone");
760
- case "min_score":
761
- return t.minScore === null || t.minScore === void 0 ? e("requirementMinScoreUnknown") : e("requirementMinScore", { count: t.minScore });
762
- case "min_percentage":
763
- return t.minPercentage === null || t.minPercentage === void 0 ? e("requirementMinPercentageUnknown") : e("requirementMinPercentage", { count: t.minPercentage });
764
- case "unknown":
765
- return e("requirementUnknown");
766
- }
767
- }
768
- function wa(e, t, n) {
769
- return e("progressSummary", { met: t, count: n });
770
- }
771
- function Ll(e, t, n) {
772
- return e("progressScreenReaderValue", { met: t, count: n });
773
- }
774
- function Ea(e) {
775
- if (!e) return null;
776
- const t = e.map((n) => Ln(n)).filter((n) => n !== null);
777
- return t.length === 0 ? null : t.reduce((n, o) => n + o, 0);
778
- }
779
- function xl(e) {
780
- if (!e) return null;
781
- const t = e.filter((n) => n.status !== void 0 && n.status !== "complete");
782
- return Ea(t);
783
- }
784
- function Gn(e) {
785
- return { hours: Math.floor(e / 60), mins: e % 60 };
786
- }
787
- function jn(e, t) {
788
- const { hours: n, mins: o } = Gn(t);
789
- return n > 0 && o > 0 ? e("estimatedDurationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("estimatedDurationHours", { count: n }) : e("estimatedDurationMinutesAbbreviated", { count: o });
790
- }
791
- function va(e, t) {
792
- return e("estimatedDurationByline", { duration: jn(e, t) });
793
- }
794
- function Ca(e, t) {
795
- return e("remainingDurationByline", { duration: jn(e, t) });
796
- }
797
- function Pa(e, t) {
798
- const { hours: n, mins: o } = Gn(t);
799
- return n > 0 && o > 0 ? e("durationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("durationHours", { count: n }) : e("durationMinutes", { count: o });
800
- }
801
- const _a = "all", Aa = qn, Da = {
802
- all: {
803
- label: "filterAll",
804
- order: 10,
805
- unfiltered: !0,
806
- predicate: () => !0
807
- },
808
- not_started: {
809
- label: "filterNotStarted",
810
- order: 15,
811
- predicate: (e) => {
812
- var t;
813
- return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
814
- },
815
- query: { target: "module", field: "moduleStatus", op: "eq", value: "not_started" }
816
- },
817
- in_progress: {
818
- label: "filterInProgress",
819
- order: 20,
820
- predicate: (e) => {
821
- var t;
822
- return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
823
- },
824
- query: { target: "module", field: "moduleStatus", op: "eq", value: "in_progress" }
825
- },
826
- complete: {
827
- label: "filterComplete",
828
- order: 30,
829
- predicate: (e) => {
830
- var t;
831
- return ((t = e.progress) == null ? void 0 : t.status) === "complete";
832
- },
833
- query: { target: "module", field: "completionStatus", op: "eq", value: "COMPLETED" }
834
- },
835
- due_this_week: {
836
- label: "filterDueThisWeek",
837
- order: 40,
838
- predicate: (e, { today: t, timezone: n }) => {
839
- var o;
840
- return Un((o = e.progress) == null ? void 0 : o.nextDueAt, t, n);
841
- },
842
- query: {
843
- target: "module",
844
- field: "dueWithinDays",
845
- op: "within",
846
- value: Aa
847
- }
848
- },
849
- missing: {
850
- label: "filterMissing",
851
- order: 50,
852
- predicate: (e) => {
853
- var t;
854
- return ((t = e.progress) == null ? void 0 : t.status) === "missing";
855
- },
856
- query: { target: "module", field: "moduleStatus", op: "eq", value: "missing" }
857
- }
858
- };
859
- function Mt(e) {
860
- return e == null ? void 0 : e.query;
861
- }
862
- function Hn(e) {
863
- return (e == null ? void 0 : e.unfiltered) === !0;
864
- }
865
- function Jt(e) {
866
- return e !== void 0 && !Hn(e);
867
- }
868
- function La(e) {
869
- return e !== void 0 && Mt(e) === void 0;
870
- }
871
- const xa = {
872
- moduleLabel: (e, t, { locale: n }) => Wn(e, n),
873
- dateTime: (e, t, { t: n, locale: o, timezone: r }) => Ma(n, e, t, { locale: o, timezone: r }),
874
- points: (e, { t }) => Ta(t, e),
875
- progress: (e, t, n, { t: o }) => wa(o, t, n)
876
- }, te = { size: "xs", color: "mutedColor" }, Na = {
877
- assignment: {
878
- label: "itemTypeAssignment",
879
- order: 10,
880
- icon: /* @__PURE__ */ l(_o, { ...te })
881
- },
882
- quiz: { label: "itemTypeQuiz", order: 20, icon: /* @__PURE__ */ l(Po, { ...te }) },
883
- discussion: {
884
- label: "itemTypeDiscussion",
885
- order: 30,
886
- icon: /* @__PURE__ */ l(Co, { ...te })
887
- },
888
- page: { label: "itemTypePage", order: 40, icon: /* @__PURE__ */ l(vo, { ...te }) },
889
- file: { label: "itemTypeFile", order: 50, icon: /* @__PURE__ */ l(Eo, { ...te }) },
890
- external_url: {
891
- label: "itemTypeExternalUrl",
892
- order: 60,
893
- icon: /* @__PURE__ */ l(wo, { ...te })
894
- },
895
- external_tool: {
896
- label: "itemTypeExternalTool",
897
- order: 70,
898
- icon: /* @__PURE__ */ l(So, { ...te })
899
- },
900
- sub_header: { label: "itemTypeSubHeader", order: 80, icon: null }
901
- }, Nl = "type", Ra = { fontSizeMedium: "inherit" }, en = /* @__PURE__ */ l(gt, { ...te });
902
- function tn({ item: e, today: t }) {
903
- return e.status !== "complete" && e.status !== "locked" && $n(e.dueAt, t);
904
- }
905
- const Oa = {
906
- type: {
907
- label: "metaFieldTypeLabel",
908
- order: 10,
909
- renderIcon: ({ item: e, config: t }) => {
910
- const n = we(t.itemTypes, e.type);
911
- return n ? n.renderIcon ? n.renderIcon({ item: e }) : n.icon : null;
912
- },
913
- render: ({ item: e, t, config: n }) => {
914
- const o = we(n.itemTypes, e.type);
915
- return o ? t(o.label) : null;
916
- }
917
- },
918
- points: {
919
- label: "metaFieldPointsLabel",
920
- order: 20,
921
- render: ({ item: e, formatters: t }) => t.points(e.pointsPossible)
922
- },
923
- requirement: {
924
- label: "metaFieldRequirementLabel",
925
- order: 30,
926
- render: ({ item: e, t }) => e.completionRequirement ? Sa(t, e.completionRequirement) : null
927
- },
928
- dueAt: {
929
- label: "metaFieldDueAtLabel",
930
- order: 40,
931
- icon: en,
932
- /** Only the shipped glyph reddens; a host that cleared or replaced it keeps what it set. */
933
- renderIcon: (e) => {
934
- var n;
935
- const t = (n = e.config.itemMeta.dueAt) == null ? void 0 : n.icon;
936
- return t !== en || !tn(e) ? t : /* @__PURE__ */ l(gt, { ...te, color: "errorColor" });
937
- },
938
- render: (e) => {
939
- const { item: t, today: n, formatters: o } = e;
940
- return t.dueAt ? tn(e) ? /* @__PURE__ */ l(ue, { color: "danger", themeOverride: Ra, children: o.pastDueByline(t.dueAt, n) }) : o.dueByline(t.dueAt, n) : null;
941
- }
942
- },
943
- estimatedDuration: {
944
- label: "metaFieldDurationLabel",
945
- order: 50,
946
- icon: /* @__PURE__ */ l(Ao, { ...te }),
947
- render: ({ item: e, t }) => {
948
- const n = Ln(e);
949
- return n === null ? null : Pa(t, n);
950
- }
951
- },
952
- unpublished: {
953
- label: "metaFieldPublishStateLabel",
954
- order: 60,
955
- render: ({ item: e, t }) => e.published ? null : t("itemUnpublishedLabel")
956
- }
957
- }, It = {
958
- formatters: xa,
959
- itemTypes: Na,
960
- itemStatuses: {},
961
- itemMeta: Oa,
962
- filters: Da,
963
- moduleActions: {},
964
- itemActions: {},
965
- navigation: {},
966
- permissions: {},
967
- notify: void 0
968
- };
969
- Object.freeze(It);
970
- for (const e of Object.values(It)) {
971
- Object.freeze(e);
972
- for (const t of Object.values(e ?? {})) Object.freeze(t);
973
- }
974
- function ka(e, t) {
975
- return Rn(e).filter((n) => {
976
- if (Hn(n)) return !1;
977
- const o = Mt(n);
978
- return o === void 0 ? !0 : !Bo(t, o);
979
- }).map((n) => n.key);
980
- }
981
- function nn(e) {
982
- return `[platform-modules] the adapter cannot serve filter(s): ${e.join(", ")}. Give the entry a query the adapter's capabilities declare, or mark it unfiltered.`;
983
- }
984
- function Fa(e, t) {
985
- const n = ka(e, t);
986
- if (n.length === 0) return e;
987
- if (process.env.NODE_ENV !== "production")
988
- throw new Error(nn(n));
989
- console.warn(nn(n));
990
- const o = Object.fromEntries(n.map((r) => [r, { ...e[r], hidden: !0 }]));
991
- return { ...e, ...o };
992
- }
993
- const Kn = dt(null);
994
- function Rl({ value: e, children: t }) {
995
- return /* @__PURE__ */ l(Kn.Provider, { value: e, children: t });
996
- }
997
- function Ye() {
998
- return Ke(Kn) ?? It;
999
- }
1000
- function Ol(e) {
1001
- return we(Ye().itemMeta, e) !== void 0;
1002
- }
1003
- const Re = i.object({
1004
- label: i.string(),
1005
- order: i.number(),
1006
- hidden: i.boolean().optional()
1007
- });
1008
- function ye(e) {
1009
- return i.record(i.string(), e);
1010
- }
1011
- const qa = ye(Re.strict()), Tt = (e) => e == null || typeof e == "string" || typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" || mt(e) || Array.isArray(e) && e.every(Tt), Yn = (e) => {
1012
- var t;
1013
- return e == null || typeof e == "function" && !((t = e.prototype) != null && t.isReactComponent);
1014
- }, za = Re.extend({
1015
- icon: i.custom(Tt, { message: "icon must be a ReactNode" }),
1016
- renderIcon: i.custom(Yn, {
1017
- message: "renderIcon must be a function of the item, not a React component"
1018
- })
1019
- }).strict(), Qn = (e) => {
1020
- var t;
1021
- return typeof e == "function" && !((t = e.prototype) != null && t.isReactComponent);
1022
- }, on = (e) => e == null || Qn(e), rn = Re.extend({
1023
- onSelect: i.custom(Qn, {
1024
- message: "onSelect must be a function taking an ActionContext"
1025
- }),
1026
- visible: i.custom(on, {
1027
- message: "visible must be a function taking an ActionContext, not a React component"
1028
- }),
1029
- renderModal: i.custom(on, {
1030
- message: "renderModal must be a function taking an ActionContext, not a React component"
1031
- })
1032
- }).strict();
1033
- function Ue() {
1034
- return i.custom((e) => typeof e == "function", {
1035
- message: "Expected a function"
1036
- });
1037
- }
1038
- const Ua = Re.extend({
1039
- render: i.custom((e) => typeof e == "function", {
1040
- message: "render must be a function taking a MetaFieldContext"
1041
- }),
1042
- icon: i.custom(Tt, { message: "icon must be a ReactNode" }),
1043
- renderIcon: i.custom(Yn, {
1044
- message: "renderIcon must be a function of the field context, not a React component"
1045
- })
1046
- }).strict(), $a = Re.extend({
1047
- predicate: i.custom((e) => typeof e == "function", {
1048
- message: "predicate must be a function of the module and a FilterContext"
1049
- }),
1050
- query: $o.optional(),
1051
- unfiltered: i.boolean().optional()
1052
- }).strict(), Le = () => i.custom((e) => typeof e == "function", { message: "Expected a function" }).optional(), Ba = i.object({
1053
- getItemHref: Le(),
1054
- getItemEditHref: Le(),
1055
- getModuleHref: Le(),
1056
- onItemClick: Le()
1057
- }).strict(), Wa = i.object({
1058
- createModule: i.boolean().optional(),
1059
- updateModule: i.boolean().optional(),
1060
- deleteModule: i.boolean().optional(),
1061
- reorderModules: i.boolean().optional(),
1062
- setModulesPublished: i.boolean().optional(),
1063
- createModuleItem: i.boolean().optional(),
1064
- updateModuleItem: i.boolean().optional(),
1065
- deleteModuleItem: i.boolean().optional(),
1066
- reorderModuleItems: i.boolean().optional()
1067
- }).strict(), kl = i.object({
1068
- formatters: i.object({
1069
- moduleLabel: Ue(),
1070
- dateTime: Ue(),
1071
- points: Ue(),
1072
- progress: Ue()
1073
- }).strict(),
1074
- itemTypes: ye(za),
1075
- itemStatuses: qa,
1076
- itemMeta: ye(Ua),
1077
- filters: ye($a),
1078
- moduleActions: ye(rn),
1079
- itemActions: ye(rn),
1080
- navigation: Ba,
1081
- permissions: Wa,
1082
- notify: Le()
1083
- });
1084
- function Vn() {
1085
- const { formatters: e } = Ye(), { t, locale: n, timezone: o } = oe();
1086
- return W(() => {
1087
- const r = { t, locale: n, timezone: o }, s = (a, c) => e.dateTime(a, c, r);
1088
- return {
1089
- moduleLabel: (a, c) => e.moduleLabel(a, c, r) || null,
1090
- dueByline: (a, c) => t("dueByline", { when: s(a, c) }),
1091
- pastDueByline: (a, c) => t("pastDueByline", { when: s(a, c) }),
1092
- unlockByline: (a, c) => t("unlockByline", { when: s(a, c) }),
1093
- unlockedByline: (a, c) => t("unlockedByline", { when: s(a, c) }),
1094
- estimatedDurationByline: (a) => va(t, a),
1095
- remainingDurationByline: (a) => Ca(t, a),
1096
- points: (a) => e.points(a, r),
1097
- progress: (a, c, d) => e.progress(a, c, d, r)
1098
- };
1099
- }, [e, t, n, o]);
1100
- }
1101
- const St = 10, Ga = 4, ja = 20, Zn = 100, Ha = 4, Ka = 4, wt = 5 * 60 * 1e3, Xn = 20;
1102
- function Jn(e) {
1103
- const {
1104
- courseId: t,
1105
- adapter: n,
1106
- page: o,
1107
- pageSize: r,
1108
- includeItems: s,
1109
- filter: a,
1110
- dueRange: c,
1111
- inlineItemsFirst: d,
1112
- inlineFirst: g,
1113
- view: h,
1114
- staleTime: p,
1115
- enabled: b
1116
- } = e;
1117
- return {
1118
- // `inlineItemsFirst`/`inlineFirst` are deliberately out of the key: derived from this list.
1119
- queryKey: Ne.list(t, { view: h, pageSize: r, includeItems: s, filter: a, page: o }),
1120
- queryFn: ({ signal: I }) => n.listModules({
1121
- courseId: t,
1122
- page: o,
1123
- pageSize: r,
1124
- includeItems: s,
1125
- filter: a,
1126
- dueRange: c,
1127
- inlineItemsFirst: d,
1128
- inlineFirst: g,
1129
- signal: I
1130
- }),
1131
- enabled: b,
1132
- staleTime: p,
1133
- refetchOnWindowFocus: !1
1134
- };
1135
- }
1136
- function Ya(e) {
1137
- const { courseId: t, moduleId: n, adapter: o, page: r, pageSize: s, view: a, staleTime: c, enabled: d, limit: g } = e;
1138
- return {
1139
- queryKey: Ne.items(t, n, { view: a, pageSize: s, page: r }),
1140
- queryFn: ({ signal: h }) => {
1141
- const p = () => o.listModuleItems({ courseId: t, moduleId: n, page: r, pageSize: s, signal: h });
1142
- return g ? g(() => {
1143
- if (h.aborted)
1144
- throw new DOMException("The operation was aborted.", "AbortError");
1145
- return p();
1146
- }) : p();
1147
- },
1148
- placeholderData: In,
1149
- enabled: d,
1150
- staleTime: c,
1151
- refetchOnWindowFocus: !1
1152
- };
1153
- }
1154
- const je = { request: { kind: "first" }, page: 1 };
1155
- function xe(e, t) {
1156
- return e === null ? 1 : Math.max(1, Math.ceil(e / t));
1157
- }
1158
- function Qa(e, t, n, o) {
1159
- switch (e) {
1160
- case "first":
1161
- return je;
1162
- case "previous":
1163
- return t === 2 ? je : n.hasPreviousPage && n.startCursor !== null ? { request: { kind: "before", cursor: n.startCursor }, page: t - 1 } : null;
1164
- case "next":
1165
- return n.hasNextPage && n.endCursor !== null ? { request: { kind: "after", cursor: n.endCursor }, page: t + 1 } : null;
1166
- case "last": {
1167
- const r = n.totalCount;
1168
- return r === null ? null : {
1169
- request: { kind: "last", count: r % o || o },
1170
- page: xe(r, o)
1171
- };
1172
- }
1173
- }
1174
- }
1175
- const tt = { kind: "first" }, Va = {
1176
- hasNextPage: !1,
1177
- endCursor: null,
1178
- hasPreviousPage: !1,
1179
- startCursor: null,
1180
- totalCount: null,
1181
- totalNrOfPages: null
1182
- };
1183
- function Za(e) {
1184
- var Q, se, ce;
1185
- const {
1186
- courseId: t,
1187
- adapter: n,
1188
- pageSize: o = St,
1189
- includeItems: r = !1,
1190
- filter: s,
1191
- dueRange: a,
1192
- inlineItemsFirst: c,
1193
- inlineFirst: d,
1194
- view: g,
1195
- staleTime: h = wt,
1196
- enabled: p = !0
1197
- } = e, [b, I] = ne(tt), [x, O] = ne(1), A = JSON.stringify([t, g, o, r, s]), T = _(A);
1198
- me(() => {
1199
- T.current !== A && (T.current = A, I(tt), O(1));
1200
- }, [A]);
1201
- const E = Tn({
1202
- ...Jn({
1203
- courseId: t,
1204
- adapter: n,
1205
- page: b,
1206
- pageSize: o,
1207
- includeItems: r,
1208
- filter: s,
1209
- dueRange: a,
1210
- inlineItemsFirst: c,
1211
- inlineFirst: d,
1212
- view: g,
1213
- staleTime: h,
1214
- enabled: p
1215
- }),
1216
- // `useItemsMode` shares `modulesQueryOptions`, and `inlineFirst` is out of that key.
1217
- placeholderData: In
1218
- }), D = _(null);
1219
- ((Q = E.data) == null ? void 0 : Q.pageInfo.totalCount) != null && (D.current = E.data.pageInfo.totalCount);
1220
- const N = _(1);
1221
- E.isPlaceholderData || (N.current = x);
1222
- const C = N.current, w = ((se = E.data) == null ? void 0 : se.pageInfo) ?? Va, S = ((ce = E.data) == null ? void 0 : ce.modules) ?? [], L = w.totalCount, K = xe(L, o), G = R(() => {
1223
- I(tt), O(1);
1224
- }, []), j = w.hasPreviousPage, H = w.startCursor, M = R(() => {
1225
- !j || H === null || (I({ kind: "before", cursor: H }), O(C - 1));
1226
- }, [j, H, C]), k = w.hasNextPage, P = w.endCursor, re = R(() => {
1227
- !k || P === null || (I({ kind: "after", cursor: P }), O(C + 1));
1228
- }, [k, P, C]), $ = R(() => {
1229
- const V = D.current, Z = V !== null && V > 0 && V % o || o;
1230
- I({ kind: "last", count: Z }), O(K);
1231
- }, [o, K]);
1232
- return {
1233
- modules: S,
1234
- pageInfo: w,
1235
- page: C,
1236
- pageCount: K,
1237
- hasNextPage: k,
1238
- hasPreviousPage: j,
1239
- goToFirstPage: G,
1240
- goToPreviousPage: M,
1241
- goToNextPage: re,
1242
- goToLastPage: $,
1243
- isLoading: E.isLoading,
1244
- isPending: E.isPending,
1245
- isPlaceholderData: E.isPlaceholderData,
1246
- error: E.error
1247
- };
1248
- }
1249
- const Xa = { kind: "first" };
1250
- function Ja(e, t, n = Nn) {
1251
- if (e.pageInfo.hasNextPage) return "onDemand";
1252
- let o = 0, r = 0;
1253
- for (const s of e.modules) {
1254
- if (s.itemCount > t) return "onDemand";
1255
- o += s.itemCount, s.itemCount > r && (r = s.itemCount);
1256
- }
1257
- return o > t * 2 ? "onDemand" : Math.max(e.modules.length, 1) * Math.max(r, 1) <= n ? "inline" : "onDemand";
1258
- }
1259
- function ec(e) {
1260
- const {
1261
- courseId: t,
1262
- adapter: n,
1263
- mode: o = "auto",
1264
- inlineThreshold: r = Zn,
1265
- nodeBudget: s = n.inlineNodeBudget ?? Nn,
1266
- pageSize: a = St,
1267
- filter: c,
1268
- dueRange: d,
1269
- view: g,
1270
- staleTime: h = wt
1271
- } = e, p = o === "auto", b = Tn(
1272
- Jn({
1273
- courseId: t,
1274
- adapter: n,
1275
- page: Xa,
1276
- pageSize: a,
1277
- includeItems: !1,
1278
- filter: c,
1279
- dueRange: d,
1280
- view: g,
1281
- staleTime: h,
1282
- enabled: p
1283
- })
1284
- );
1285
- if (!p)
1286
- return {
1287
- resolvedMode: o,
1288
- isResolving: !1,
1289
- probed: !1,
1290
- error: null,
1291
- inlineShape: null
1292
- };
1293
- if (b.error)
1294
- return {
1295
- resolvedMode: "onDemand",
1296
- isResolving: !1,
1297
- probed: !0,
1298
- error: b.error,
1299
- inlineShape: null
1300
- };
1301
- const I = b.data;
1302
- return I ? {
1303
- resolvedMode: Ja(I, r, s),
1304
- isResolving: !1,
1305
- probed: !0,
1306
- error: null,
1307
- inlineShape: tc(I)
1308
- } : { resolvedMode: null, isResolving: !0, probed: !0, error: null, inlineShape: null };
1309
- }
1310
- function tc(e) {
1311
- let t = 1;
1312
- for (const n of e.modules)
1313
- n.itemCount > t && (t = n.itemCount);
1314
- return { moduleCount: Math.max(e.modules.length, 1), maxItemCount: t };
1315
- }
1316
- const nc = `(max-width: ${To.mobileOnly.maxWidth})`;
1317
- function sn() {
1318
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(nc);
1319
- }
1320
- function oc() {
1321
- const [e, t] = ne(() => {
1322
- var n;
1323
- return ((n = sn()) == null ? void 0 : n.matches) ?? !1;
1324
- });
1325
- return me(() => {
1326
- const n = sn();
1327
- if (n === null) return;
1328
- t(n.matches);
1329
- const o = (r) => t(r.matches);
1330
- return n.addEventListener("change", o), () => n.removeEventListener("change", o);
1331
- }, []), e;
1332
- }
1333
- const nt = "\0", rc = /* @__PURE__ */ new Map();
1334
- function sc(e, t, {
1335
- pageSize: n,
1336
- retainCollapsedLimit: o = Xn,
1337
- partition: r = ""
1338
- }) {
1339
- const s = Sn(), a = _(/* @__PURE__ */ new Map()), c = _(/* @__PURE__ */ new Map()), d = `${n}${nt}${r}`, g = _(d), [h, p] = ne(rc), b = e.join(nt), I = W(() => b === "" ? [] : b.split(nt), [b]);
1340
- me(() => {
1341
- const T = a.current, E = c.current;
1342
- g.current !== d && (E.clear(), g.current = d);
1343
- const D = () => {
1344
- p((S) => {
1345
- const L = /* @__PURE__ */ new Map();
1346
- let K = S.size !== T.size;
1347
- for (const [G, j] of T) {
1348
- const H = j.getCurrentResult(), M = E.get(G), k = M ? H.isPlaceholderData ? M.shownPage : M.page : 1, P = S.get(G);
1349
- if (P && P.result === H && P.page === k) {
1350
- L.set(G, P);
1351
- continue;
1352
- }
1353
- L.set(G, { result: H, page: k }), K = !0;
1354
- }
1355
- return K ? L : S;
1356
- });
1357
- }, N = (S) => (E.get(S) ?? je).request, C = new Set(I);
1358
- for (const S of I) {
1359
- if (T.has(S)) continue;
1360
- const L = new yo(
1361
- s,
1362
- t(S, !0, N(S))
1363
- );
1364
- T.set(S, L), L.subscribe(D);
1365
- }
1366
- for (const [S, L] of T)
1367
- L.setOptions(t(S, C.has(S), N(S)));
1368
- for (const S of I) {
1369
- const L = T.get(S);
1370
- L && (T.delete(S), T.set(S, L));
1371
- }
1372
- let w = T.size - C.size;
1373
- if (w > o)
1374
- for (const [S, L] of T) {
1375
- if (w <= o) break;
1376
- C.has(S) || (L.destroy(), T.delete(S), E.delete(S), w -= 1);
1377
- }
1378
- D();
1379
- }, [s, t, I, o, d]), me(() => {
1380
- const T = a.current;
1381
- return () => {
1382
- for (const E of T.values()) E.destroy();
1383
- T.clear();
1384
- };
1385
- }, []);
1386
- const x = _(n);
1387
- x.current = n;
1388
- const O = _(t);
1389
- O.current = t;
1390
- const A = R((T, E) => {
1391
- const D = a.current.get(T), N = D == null ? void 0 : D.getCurrentResult();
1392
- if (!D || !(N != null && N.data) || N.isPlaceholderData) return;
1393
- const C = c.current.get(T) ?? je, w = Qa(E, C.page, N.data.pageInfo, x.current);
1394
- !w || w.page === C.page || (c.current.set(T, { ...w, shownPage: C.page }), D.setOptions(
1395
- O.current(T, D.options.enabled !== !1, w.request)
1396
- ));
1397
- }, []);
1398
- return { entries: h, goToPage: A };
1399
- }
1400
- const ic = [];
1401
- function Fl(e) {
1402
- var Lt, xt;
1403
- const {
1404
- courseId: t,
1405
- adapter: n,
1406
- view: o,
1407
- itemsMode: r = "auto",
1408
- inlineThreshold: s = Zn,
1409
- pageSize: a = St,
1410
- mobilePageSize: c = Ga,
1411
- itemPageSize: d = ja,
1412
- itemConcurrency: g = Ha,
1413
- retainCollapsedLimit: h = Xn,
1414
- staleTime: p = wt,
1415
- initialExpandedModuleIds: b,
1416
- initialFilter: I = _a,
1417
- today: x
1418
- } = e, O = oc() ? c : a, A = Sn(), T = Ye(), [E, D] = ne(I), N = W(
1419
- () => Fa(T.filters, n.capabilities),
1420
- [T.filters, n.capabilities]
1421
- ), C = we(N, E), w = Mt(C), { timezone: S } = oe(), [L] = ne(() => /* @__PURE__ */ new Date()), K = x ?? L, G = W(
1422
- () => (w == null ? void 0 : w.op) === "within" ? ya(K, Number(w.value), S) : void 0,
1423
- [w == null ? void 0 : w.op, w == null ? void 0 : w.value, K, S]
1424
- ), j = ec({
1425
- courseId: t,
1426
- adapter: n,
1427
- mode: r,
1428
- inlineThreshold: s,
1429
- pageSize: O,
1430
- filter: w,
1431
- dueRange: G,
1432
- view: o,
1433
- staleTime: p
1434
- }), H = j.resolvedMode, M = Za({
1435
- courseId: t,
1436
- adapter: n,
1437
- pageSize: O,
1438
- filter: w,
1439
- dueRange: G,
1440
- view: o,
1441
- staleTime: p,
1442
- includeItems: H === "inline",
1443
- inlineItemsFirst: (Lt = j.inlineShape) == null ? void 0 : Lt.maxItemCount,
1444
- inlineFirst: (xt = j.inlineShape) == null ? void 0 : xt.moduleCount,
1445
- enabled: H !== null
1446
- }), [k, P] = ne(
1447
- () => b ?? []
1448
- ), re = b === void 0, $ = _(!1), Q = Jt(C), se = _(Q);
1449
- se.current = Q;
1450
- const ce = _(M.hasNextPage);
1451
- ce.current = M.hasNextPage;
1452
- const V = _(M.isPlaceholderData);
1453
- V.current = M.isPlaceholderData, me(() => {
1454
- !re || $.current || Q || M.isPlaceholderData || P((u) => {
1455
- const m = new Set(u), f = [...u];
1456
- for (const v of M.modules)
1457
- v.collapsed === !1 && !m.has(v.id) && f.push(v.id);
1458
- return f.length === u.length ? u : f;
1459
- });
1460
- }, [M.modules, M.isPlaceholderData, re, Q]);
1461
- const Z = W(() => {
1462
- const u = /* @__PURE__ */ new Map();
1463
- for (const m of M.modules) u.set(m.id, m);
1464
- return u;
1465
- }, [M.modules]), ge = W(
1466
- () => k.filter((u) => {
1467
- const m = Z.get(u);
1468
- return m !== void 0 && m.items === void 0;
1469
- }),
1470
- [k, Z]
1471
- ), Oe = W(() => new Set(ge), [ge]), Ee = W(() => kt(g), [g]), ke = R(
1472
- (u, m, f) => Ya({
1473
- courseId: t,
1474
- moduleId: u,
1475
- adapter: n,
1476
- page: f,
1477
- pageSize: d,
1478
- view: o,
1479
- staleTime: p,
1480
- enabled: m,
1481
- limit: Ee
1482
- }),
1483
- [t, n, d, o, p, Ee]
1484
- ), ve = sc(ge, ke, {
1485
- pageSize: d,
1486
- retainCollapsedLimit: h,
1487
- partition: JSON.stringify([t, o])
1488
- }), y = W(() => kt(Ka), []), [X, F] = ne(0), le = R((u) => (F((m) => m + 1), u.finally(() => F((m) => m - 1))), []), Ce = _(/* @__PURE__ */ new Map()), Ve = _(Promise.resolve()), ee = R(
1489
- (u, m, f) => {
1490
- if (se.current) return;
1491
- const v = n.setModuleCollapsed;
1492
- if (!v) return;
1493
- const q = Promise.all([Ve.current, Ce.current.get(u)]).then(
1494
- () => y(() => v({ courseId: t, moduleId: u, collapsed: m }))
1495
- ), z = ((f == null ? void 0 : f.track) === !0 ? le(q) : q).catch((Y) => {
1496
- console.warn(
1497
- `[platform-modules] failed to persist module ${u} collapsed=${m}: ${String(Y)}`
1498
- );
1499
- }).finally(() => {
1500
- Ce.current.get(u) === z && Ce.current.delete(u);
1501
- });
1502
- Ce.current.set(u, z);
1503
- },
1504
- [n, t, y, le]
1505
- ), Fe = R(
1506
- (u, m) => {
1507
- const f = n.setAllModulesCollapsed;
1508
- if (!(!se.current && !ce.current && !V.current && f !== void 0)) {
1509
- for (const z of m) ee(z, u, { track: !0 });
1510
- return;
1511
- }
1512
- const q = le(
1513
- Promise.all([Ve.current, ...Ce.current.values()]).then(
1514
- () => f({ courseId: t, collapsed: u })
1515
- )
1516
- ).catch((z) => {
1517
- console.warn(
1518
- `[platform-modules] failed to persist all modules collapsed=${u}: ${String(z)}`
1519
- );
1520
- });
1521
- Ve.current = q;
1522
- },
1523
- [n, t, ee, le]
1524
- ), Ze = R(
1525
- (u, m) => {
1526
- $.current = !0, P(
1527
- (f) => f.includes(u) ? f : [...f, u]
1528
- ), (m == null ? void 0 : m.persist) !== !1 && ee(u, !1);
1529
- },
1530
- [ee]
1531
- ), Pe = R(
1532
- (u, m) => {
1533
- $.current = !0, P((f) => f.filter((v) => v !== u)), A.cancelQueries({ queryKey: We(t, u) }), (m == null ? void 0 : m.persist) !== !1 && ee(u, !0);
1534
- },
1535
- [A, t, ee]
1536
- ), co = R(
1537
- (u) => {
1538
- $.current = !0, P((m) => {
1539
- const f = new Set(m), v = u.filter((q) => !f.has(q));
1540
- return v.length === 0 ? m : [...m, ...v];
1541
- });
1542
- for (const m of u) ee(m, !1, { track: !0 });
1543
- },
1544
- [ee]
1545
- ), lo = R(
1546
- (u) => {
1547
- $.current = !0;
1548
- const m = new Set(u);
1549
- P((f) => {
1550
- const v = f.filter((q) => !m.has(q));
1551
- return v.length === f.length ? f : v;
1552
- });
1553
- for (const f of m)
1554
- A.cancelQueries({ queryKey: We(t, f) }), ee(f, !0, { track: !0 });
1555
- },
1556
- [A, t, ee]
1557
- ), pe = _(k);
1558
- pe.current = k;
1559
- const uo = R(() => {
1560
- $.current = !0;
1561
- const u = pe.current;
1562
- if (u.length !== 0) {
1563
- for (const m of u)
1564
- A.cancelQueries({ queryKey: We(t, m) });
1565
- P([]), Fe(!0, u);
1566
- }
1567
- }, [A, t, Fe]), mo = R(() => {
1568
- $.current = !0;
1569
- const u = M.modules.map((m) => m.id);
1570
- u.length !== 0 && (P(u), Fe(!1, u));
1571
- }, [M.modules, Fe]), Xe = _(E);
1572
- Xe.current = E;
1573
- const fe = _(null), go = R(
1574
- (u) => {
1575
- if (u === Xe.current) return;
1576
- if (Xe.current = u, Jt(we(N, u))) {
1577
- fe.current === null && (fe.current = pe.current);
1578
- const f = $.current;
1579
- for (const v of pe.current) Pe(v, { persist: !1 });
1580
- $.current = f;
1581
- } else fe.current !== null && (P(fe.current), pe.current = fe.current, fe.current = null);
1582
- D(u);
1583
- },
1584
- [N, Pe]
1585
- ), po = R(
1586
- (u) => {
1587
- pe.current.includes(u) ? Pe(u) : Ze(u);
1588
- },
1589
- [Pe, Ze]
1590
- ), vt = _(Z);
1591
- vt.current = Z;
1592
- const [Ct, fo] = ne(() => /* @__PURE__ */ new Map()), Pt = ve.goToPage, he = R(
1593
- (u, m) => {
1594
- var q;
1595
- const f = (q = vt.current.get(u)) == null ? void 0 : q.items;
1596
- if (f === void 0) {
1597
- Pt(u, m);
1598
- return;
1599
- }
1600
- const v = xe(f.length, d);
1601
- fo((z) => {
1602
- const Y = Math.min(z.get(u) ?? 1, v), _e = m === "first" ? 1 : m === "last" ? v : Math.min(Math.max(Y + (m === "next" ? 1 : -1), 1), v);
1603
- return _e === Y ? z : new Map(z).set(u, _e);
1604
- });
1605
- },
1606
- [Pt, d]
1607
- ), Je = W(() => /* @__PURE__ */ new Map(), [he]), _t = R(
1608
- (u) => {
1609
- let m = Je.get(u);
1610
- return m || (m = {
1611
- goToFirstPage: () => he(u, "first"),
1612
- goToPreviousPage: () => he(u, "previous"),
1613
- goToNextPage: () => he(u, "next"),
1614
- goToLastPage: () => he(u, "last")
1615
- }, Je.set(u, m)), m;
1616
- },
1617
- [Je, he]
1618
- ), At = ve.entries, Dt = _(/* @__PURE__ */ new Map()), ho = R(
1619
- (u) => {
1620
- var Nt, Rt;
1621
- const m = Z.get(u), f = At.get(u), v = Oe.has(u), q = Ct.get(u), z = _t(u), Y = Dt.current.get(u);
1622
- if (Y && Y.items === (m == null ? void 0 : m.items) && Y.entry === f && Y.active === v && Y.inlinePage === q && Y.navigation === z)
1623
- return Y.value;
1624
- const _e = (Ae) => (Dt.current.set(u, {
1625
- items: m == null ? void 0 : m.items,
1626
- entry: f,
1627
- active: v,
1628
- inlinePage: q,
1629
- navigation: z,
1630
- value: Ae
1631
- }), Ae);
1632
- if ((m == null ? void 0 : m.items) !== void 0) {
1633
- const Ae = xe(m.items.length, d), Ot = Math.min(q ?? 1, Ae), et = (Ot - 1) * d;
1634
- return _e({
1635
- items: m.items.slice(et, et + d),
1636
- page: Ot,
1637
- pageCount: Ae,
1638
- itemOffset: m.items.slice(0, et).filter((bo) => bo.type !== "sub_header").length,
1639
- ...z,
1640
- isLoading: !1,
1641
- isRefreshing: !1,
1642
- error: null,
1643
- source: "inline"
1644
- });
1645
- }
1646
- const B = f == null ? void 0 : f.result, qe = (f == null ? void 0 : f.page) ?? 1, be = (Nt = B == null ? void 0 : B.data) == null ? void 0 : Nt.pageInfo;
1647
- return _e({
1648
- items: ((Rt = B == null ? void 0 : B.data) == null ? void 0 : Rt.items) ?? ic,
1649
- page: qe,
1650
- pageCount: Math.max(
1651
- xe((be == null ? void 0 : be.totalCount) ?? null, d),
1652
- be != null && be.hasNextPage ? qe + 1 : qe
1653
- ),
1654
- // Assumes earlier pages hold no sub-headers. Exact numbers need a per-module running count.
1655
- itemOffset: (qe - 1) * d,
1656
- ...z,
1657
- isLoading: B ? B.isLoading : v,
1658
- isRefreshing: (B == null ? void 0 : B.isPlaceholderData) ?? !1,
1659
- error: (B == null ? void 0 : B.error) ?? null,
1660
- source: "onDemand"
1661
- });
1662
- },
1663
- [Z, At, Oe, Ct, _t, d]
1664
- );
1665
- return {
1666
- modules: M.modules,
1667
- pageInfo: M.pageInfo,
1668
- page: M.page,
1669
- pageCount: M.pageCount,
1670
- pageSize: O,
1671
- hasNextPage: M.hasNextPage,
1672
- hasPreviousPage: M.hasPreviousPage,
1673
- goToFirstPage: M.goToFirstPage,
1674
- goToPreviousPage: M.goToPreviousPage,
1675
- goToNextPage: M.goToNextPage,
1676
- goToLastPage: M.goToLastPage,
1677
- isLoading: (j.isResolving || M.isPending) && !M.isPlaceholderData,
1678
- isRefreshing: M.isPlaceholderData,
1679
- error: M.error ?? j.error,
1680
- itemsMode: H,
1681
- getItems: ho,
1682
- expandModule: Ze,
1683
- collapseModule: Pe,
1684
- expandModules: co,
1685
- collapseModules: lo,
1686
- collapseAllModules: uo,
1687
- expandAllModules: mo,
1688
- toggleModule: po,
1689
- expandedModuleIds: k,
1690
- filter: E,
1691
- setFilter: go,
1692
- filterEntry: C,
1693
- filterPredicate: La(C) ? C == null ? void 0 : C.predicate : void 0,
1694
- isPersistingCollapsed: X > 0
1695
- };
1696
- }
1697
- const ac = 20, cc = 4.5, an = 7, lc = 5, uc = 20, eo = "#000000", to = "#FFFFFF", no = {
1698
- primary: { semantic: "base", textKey: "baseTextColor", borderKey: "baseBorderColor" },
1699
- info: { semantic: "info", textKey: "infoTextColor", borderKey: "infoBorderColor" },
1700
- success: { semantic: "success", textKey: "successTextColor", borderKey: "successBorderColor" },
1701
- warning: { semantic: "warning", textKey: "warningTextColor", borderKey: "warningBorderColor" }
1702
- }, dc = {
1703
- card: {
1704
- primary: { fill: "#E8EAEC", stroke: "#8D959F", text: "#273540" },
1705
- info: { fill: "#D5E4F2", stroke: "#2B7ABC", text: "#23649A" },
1706
- success: { fill: "#CDE7D8", stroke: "#03893D", text: "#02642C" },
1707
- warning: { fill: "#F5DBCC", stroke: "#CF4A00", text: "#A13900" }
1708
- },
1709
- row: {
1710
- primary: { fill: "#DEE1E4", stroke: "#8D959F", text: "#273540" },
1711
- info: { fill: "#CADCEA", stroke: "#2B7ABC", text: "#1E5685" },
1712
- success: { fill: "#C2DFD0", stroke: "#03893D", text: "#02642C" },
1713
- warning: { fill: "#EBD2C4", stroke: "#CF4A00", text: "#A13900" }
1714
- }
1715
- };
1716
- function mc(e, t) {
1717
- const n = Fo(
1718
- st(e),
1719
- st(qo(t, ac))
1720
- );
1721
- return Cn(n);
1722
- }
1723
- function gc(e, t, n) {
1724
- const o = de(n, t) >= an ? an : cc;
1725
- return Math.min(o, Math.max(de(e, eo), de(e, to)));
1726
- }
1727
- function pc(e, t, n) {
1728
- const o = gc(e, t, n);
1729
- if (de(e, t) >= o) return t;
1730
- const r = de(e, eo) > de(e, to) ? zo : Uo;
1731
- let s = t;
1732
- for (let a = 0; a < uc && de(e, s) < o; a++)
1733
- s = r(s, lc);
1734
- return Cn(s);
1735
- }
1736
- function fc(e) {
1737
- return rt(e) && st(e).a === 1;
1738
- }
1739
- function cn(e, t) {
1740
- var n;
1741
- return t === "card" ? (n = e == null ? void 0 : e.elevatedSurface) == null ? void 0 : n.base : e == null ? void 0 : e.muted;
1742
- }
1743
- function ln(e, t, n, o) {
1744
- var a, c, d, g;
1745
- const r = dc[n][e], s = t;
1746
- try {
1747
- const h = s == null ? void 0 : s.newTheme, p = (a = h == null ? void 0 : h.semantics) == null ? void 0 : a.call(h, h.primitives);
1748
- if (!p) return r;
1749
- const { semantic: b } = no[e], I = cn((g = (d = (c = s == null ? void 0 : s.themeOverride) == null ? void 0 : c.semantics) == null ? void 0 : d.color) == null ? void 0 : g.background, n) ?? cn(p.color.background, n) ?? "", x = o.stroke ?? p.color.stroke[b], O = o.label ?? p.color.text[b];
1750
- if (!fc(I) || !rt(x) || !rt(O)) return r;
1751
- const A = mc(I, x);
1752
- return { fill: A, stroke: x, text: pc(A, O, I) };
1753
- } catch {
1754
- return r;
1755
- }
1756
- }
1757
- const un = /* @__PURE__ */ new WeakMap();
1758
- function oo(e, t, n, o = {}) {
1759
- if (typeof t != "object" || t === null)
1760
- return ln(e, t, n, o);
1761
- let r = un.get(t);
1762
- r === void 0 && (r = /* @__PURE__ */ new Map(), un.set(t, r));
1763
- const s = `${n}:${e}:${o.stroke ?? ""}:${o.label ?? ""}`, a = r.get(s);
1764
- if (a !== void 0) return a;
1765
- const c = ln(e, t, n, o);
1766
- return r.set(s, c), c;
1767
- }
1768
- function $e(e, t) {
1769
- const { textKey: n, borderKey: o } = no[e];
1770
- return (r, s) => {
1771
- const a = r, { fill: c, stroke: d, text: g } = oo(e, s, t, {
1772
- stroke: a == null ? void 0 : a[o],
1773
- label: a == null ? void 0 : a[n]
1774
- });
1775
- return { backgroundColor: c, [n]: g, [o]: d };
1776
- };
1777
- }
1778
- function dn(e) {
1779
- return {
1780
- primary: $e("primary", e),
1781
- info: $e("info", e),
1782
- success: $e("success", e),
1783
- warning: $e("warning", e)
1784
- };
1785
- }
1786
- const hc = {
1787
- card: dn("card"),
1788
- row: dn("row")
1789
- }, bc = "#9242B4", yc = "#9E58BD";
1790
- function mn(e) {
1791
- return (t, n) => {
1792
- var a, c, d, g;
1793
- const { fill: o, stroke: r, text: s } = oo("primary", n, e, {
1794
- stroke: ((c = (a = n.colors) == null ? void 0 : a.contrasts) == null ? void 0 : c.violet4570) ?? yc,
1795
- label: ((g = (d = n.colors) == null ? void 0 : d.contrasts) == null ? void 0 : g.violet5790) ?? bc
1796
- });
1797
- return { backgroundColor: o, baseTextColor: s, baseBorderColor: r };
1798
- };
1799
- }
1800
- const ro = {
1801
- tone: "primary",
1802
- icon: /* @__PURE__ */ l(gt, { size: "sm" }),
1803
- themes: {
1804
- card: mn("card"),
1805
- row: mn("row")
1806
- }
1807
- }, Mc = {
1808
- not_started: { tone: "primary", icon: /* @__PURE__ */ l(bt, { size: "sm" }) },
1809
- in_progress: { tone: "info", icon: /* @__PURE__ */ l(ht, { size: "sm" }) },
1810
- complete: { tone: "success", icon: /* @__PURE__ */ l(ft, { size: "sm" }) },
1811
- missing: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1812
- incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1813
- missing_and_incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1814
- locked: { tone: "primary", icon: /* @__PURE__ */ l(pt, { size: "sm" }) }
1815
- }, Ic = {
1816
- not_started: { tone: "primary", icon: /* @__PURE__ */ l(bt, { size: "sm" }) },
1817
- in_progress: { tone: "info", icon: /* @__PURE__ */ l(ht, { size: "sm" }) },
1818
- complete: { tone: "success", icon: /* @__PURE__ */ l(ft, { size: "sm" }) },
1819
- incomplete: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1820
- missing: { tone: "warning", icon: /* @__PURE__ */ l(Te, { size: "sm" }) },
1821
- locked: { tone: "primary", icon: /* @__PURE__ */ l(pt, { size: "sm" }) }
1822
- };
1823
- function so(e, t, n, o) {
1824
- switch (t) {
1825
- case "not_started":
1826
- return e("moduleStatusNotStarted");
1827
- case "in_progress":
1828
- return e("moduleStatusInProgress");
1829
- case "complete":
1830
- return e("moduleStatusComplete");
1831
- case "missing":
1832
- return e("moduleStatusMissing", { count: n });
1833
- case "incomplete":
1834
- return e("moduleStatusIncomplete", { count: o });
1835
- case "missing_and_incomplete":
1836
- return e("moduleStatusMissingAndIncomplete", {
1837
- missing: e("moduleStatusMissing", { count: n }),
1838
- incomplete: e("moduleStatusIncomplete", { count: o })
1839
- });
1840
- case "locked":
1841
- return e("moduleStatusLocked");
1842
- }
1843
- }
1844
- function Tc(e, t) {
1845
- switch (t) {
1846
- case "not_started":
1847
- return e("itemStatusNotStarted");
1848
- case "in_progress":
1849
- return e("itemStatusInProgress");
1850
- case "complete":
1851
- return e("itemStatusComplete");
1852
- case "incomplete":
1853
- return e("itemStatusIncomplete");
1854
- case "missing":
1855
- return e("itemStatusMissing");
1856
- case "locked":
1857
- return e("itemStatusLocked");
1858
- }
1859
- }
1860
- function Qe(e, t, n, o) {
1861
- var r;
1862
- return /* @__PURE__ */ l(
1863
- Ro,
1864
- {
1865
- color: e.tone,
1866
- renderIcon: e.icon,
1867
- themeOverride: ((r = e.themes) == null ? void 0 : r[o]) ?? hc[o][e.tone],
1868
- "data-testid": n,
1869
- children: t
1870
- }
1871
- );
1872
- }
1873
- function ql({
1874
- status: e,
1875
- missingCount: t,
1876
- incompleteCount: n
1877
- }) {
1878
- const { t: o } = oe();
1879
- return Qe(
1880
- Mc[e],
1881
- so(o, e, t, n),
1882
- "module-status-pill",
1883
- "card"
1884
- );
1885
- }
1886
- function Sc({ status: e }) {
1887
- const { t } = oe();
1888
- return Qe(
1889
- Ic[e],
1890
- Tc(t, e),
1891
- "item-status-pill",
1892
- "row"
1893
- );
1894
- }
1895
- function zl() {
1896
- const { t: e } = oe();
1897
- return Qe(ro, e("moduleStatusDueSoon"), "module-due-soon-pill", "card");
1898
- }
1899
- function wc() {
1900
- const { t: e } = oe();
1901
- return Qe(ro, e("itemStatusDueSoon"), "item-due-soon-pill", "row");
1902
- }
1903
- function Ec() {
1904
- const e = En();
1905
- return "key" in e && e.key === "canvas-high-contrast" ? "inline" : "standalone";
1906
- }
1907
- const io = 2.75, vc = `${io}rem`, gn = "0.065em", Se = "0.8em", Cc = "0.28em", pn = "1px", Pc = "0.57em", ao = {
1908
- display: "inline-block",
1909
- paddingLeft: Se,
1910
- marginLeft: `-${Se}`,
1911
- backgroundImage: `radial-gradient(circle, currentColor ${gn}, transparent ${gn})`,
1912
- backgroundRepeat: "no-repeat",
1913
- backgroundSize: `${Se} 100%`,
1914
- backgroundPosition: "left center"
1915
- }, _c = {
1916
- ...ao,
1917
- backgroundImage: "none",
1918
- borderLeft: `${pn} solid`,
1919
- paddingLeft: `calc(${Se} / 2 - ${pn})`,
1920
- marginLeft: `calc(-${Se} / 2)`
1921
- };
1922
- function fn() {
1923
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(forced-colors: active)");
1924
- }
1925
- function Ac() {
1926
- const [e, t] = ne(() => {
1927
- var n;
1928
- return ((n = fn()) == null ? void 0 : n.matches) ?? !1;
1929
- });
1930
- return me(() => {
1931
- const n = fn();
1932
- if (n === null) return;
1933
- t(n.matches);
1934
- const o = (r) => t(r.matches);
1935
- return n.addEventListener("change", o), () => n.removeEventListener("change", o);
1936
- }, []), e ? _c : ao;
1937
- }
1938
- const Dc = {
1939
- overflowX: "clip",
1940
- overflowWrap: "anywhere",
1941
- lineHeight: 0
1942
- }, Lc = "#6A7883", Et = 0.5, He = { display: "block" }, xc = { ...He, marginTop: `${Et}rem` }, Nc = {
1943
- ...He,
1944
- marginTop: `-${Et}rem`
1945
- }, hn = { marginTop: `${Et}rem` }, bn = { display: "inline-block" }, Rc = {
1946
- display: "-webkit-box",
1947
- WebkitLineClamp: 2,
1948
- WebkitBoxOrient: "vertical",
1949
- overflow: "hidden"
1950
- }, Oc = {
1951
- marginRight: `calc(${Se} - ${Cc})`
1952
- }, kc = {
1953
- display: "inline-flex",
1954
- alignItems: "center",
1955
- height: "1lh",
1956
- verticalAlign: "top",
1957
- marginInlineEnd: Pc
1958
- };
1959
- function Ie(e) {
1960
- return e == null || typeof e == "boolean" || e === "" ? !0 : Array.isArray(e) ? e.every(Ie) : mt(e) && e.type === wn ? Ie(e.props.children) : !1;
1961
- }
1962
- const Fc = 1.5, qc = 0.25, zc = 0.5;
1963
- function Uc(e, t) {
1964
- var o, r;
1965
- const n = En();
1966
- return ("colors" in n ? (r = (o = n.colors) == null ? void 0 : o.contrasts) == null ? void 0 : r[e] : void 0) ?? t;
1967
- }
1968
- function $c({
1969
- item: e,
1970
- today: t,
1971
- attachedAbove: n,
1972
- attachedBelow: o,
1973
- stackPill: r = !1,
1974
- moduleLabel: s,
1975
- itemNumber: a
1976
- }) {
1977
- var ve;
1978
- const { t: c, locale: d, timezone: g } = oe(), h = tr(), p = Ec(), b = Uc("grey4570", Lc), I = Ac(), x = _(null), O = Vn(), A = Ye(), { navigation: T } = A, E = W(() => Rn(A.itemMeta), [A.itemMeta]), D = e.title || c("itemUntitled");
1979
- if (e.type === "sub_header")
1980
- return /* @__PURE__ */ l(
1981
- ie,
1982
- {
1983
- as: "div",
1984
- padding: r ? "x-small small" : "x-small mediumSmall",
1985
- margin: "x-small 0 0 0",
1986
- "data-testid": `module-item-${e.id}`,
1987
- children: /* @__PURE__ */ l(
1988
- ue,
1989
- {
1990
- size: "small",
1991
- weight: "bold",
1992
- transform: "uppercase",
1993
- "data-testid": "module-item-title",
1994
- "data-sub-header": "true",
1995
- children: D
1996
- }
1997
- )
1998
- }
1999
- );
2000
- const N = Ia(s, a, d), C = N ? c("itemNameWithLabel", { label: N, name: D }) : D, w = ((ve = T.getItemHref) == null ? void 0 : ve.call(T, e)) ?? e.url ?? null, S = e.status === "locked", L = S ? null : w, K = e.status !== void 0 && e.status !== "complete" && !S && Un(e.dueAt, t, g), G = T.onItemClick, j = (y) => {
2001
- h(`item-click-${e.type}`), G == null || G(e, y);
2002
- }, H = (y) => {
2003
- var F;
2004
- const X = x.current;
2005
- !X || X.contains(y.target) || (F = window.getSelection()) != null && F.toString().trim() || X.dispatchEvent(
2006
- new window.MouseEvent("click", {
2007
- bubbles: !0,
2008
- cancelable: !0,
2009
- ctrlKey: y.ctrlKey,
2010
- metaKey: y.metaKey,
2011
- shiftKey: y.shiftKey,
2012
- altKey: y.altKey
2013
- })
2014
- );
2015
- }, M = { item: e, t: c, today: t, locale: d, timezone: g, formatters: O, config: A }, k = E.map((y) => ({
2016
- key: y.key,
2017
- node: y.render(M),
2018
- icon: y.renderIcon ? y.renderIcon(M) : y.icon
2019
- })).filter((y) => !Ie(y.node)), P = [];
2020
- let re;
2021
- const $ = r ? k.find((y) => y.key === "dueAt" && !Ie(y.icon)) : void 0, Q = $ && k.find((y) => y.key === "estimatedDuration");
2022
- for (const y of k)
2023
- if (y !== Q)
2024
- if (!Ie(y.icon) && (r || !re)) {
2025
- const X = y === $ && Q ? [y, Q] : [y];
2026
- P.push(X), re ?? (re = X);
2027
- } else re ? re.push(y) : P.length === 0 ? P.push([y]) : P[0].push(y);
2028
- const se = r ? { ...bn, ...hn } : bn, ce = r ? { ...I, ...hn } : I, V = K || e.status ? /* @__PURE__ */ J(U, { alignItems: "center", gap: "x-small", wrap: r ? "wrap" : "no-wrap", children: [
2029
- K ? /* @__PURE__ */ l(U.Item, { children: /* @__PURE__ */ l(wc, {}) }) : null,
2030
- e.status ? /* @__PURE__ */ l(U.Item, { children: /* @__PURE__ */ l(Sc, { status: e.status }) }) : null
2031
- ] }) : null, Z = r ? /* @__PURE__ */ l("span", { style: Rc, "data-title-clamp": "", children: C }) : C, ge = {
2032
- weight: "bold",
2033
- size: r ? "medium" : "small",
2034
- lineHeight: "condensed",
2035
- "data-testid": "module-item-title"
2036
- }, Oe = L ? /* @__PURE__ */ J(
2037
- No,
2038
- {
2039
- href: L,
2040
- elementRef: (y) => {
2041
- x.current = y;
2042
- },
2043
- onClick: j,
2044
- forceButtonRole: !1,
2045
- variant: p,
2046
- display: r ? "block" : void 0,
2047
- target: e.newTab ? "_blank" : void 0,
2048
- rel: e.newTab ? "noopener noreferrer" : void 0,
2049
- children: [
2050
- /* @__PURE__ */ l(ue, { ...ge, color: "primary", children: Z }),
2051
- e.newTab ? /* @__PURE__ */ l(vn, { children: ` ${c("opensInNewWindow")}` }) : null
2052
- ]
2053
- }
2054
- ) : /* @__PURE__ */ l(
2055
- ue,
2056
- {
2057
- ...ge,
2058
- color: S ? "secondary" : "primary",
2059
- "data-locked": S ? "true" : void 0,
2060
- children: Z
2061
- }
2062
- ), Ee = n ? "none" : "large", ke = o ? "none" : "large";
2063
- return /* @__PURE__ */ l(
2064
- ie,
2065
- {
2066
- as: "div",
2067
- background: "secondary",
2068
- borderRadius: `${Ee} ${Ee} ${ke} ${ke}`,
2069
- padding: r ? "small" : "mediumSmall",
2070
- margin: n ? "0" : "x-small 0 0 0",
2071
- cursor: L ? "pointer" : void 0,
2072
- onClick: L ? H : void 0,
2073
- "data-testid": `module-item-${e.id}`,
2074
- children: /* @__PURE__ */ l("div", { style: { paddingInlineStart: `${Math.max(e.indent - 1, 0) * io}rem` }, children: /* @__PURE__ */ J(U, { alignItems: "start", gap: "mediumSmall", children: [
2075
- /* @__PURE__ */ l(U.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ J(U, { alignItems: "center", children: [
2076
- e.indent > 0 ? /* @__PURE__ */ l(
2077
- U.Item,
2078
- {
2079
- size: vc,
2080
- textAlign: "center",
2081
- "data-testid": "item-nest-arrow",
2082
- children: /* @__PURE__ */ l("span", { style: { color: b }, children: /* @__PURE__ */ l(Do, { size: "md", color: "inherit" }) })
2083
- }
2084
- ) : null,
2085
- /* @__PURE__ */ J(U.Item, { shouldGrow: !0, shouldShrink: !0, children: [
2086
- /* @__PURE__ */ l(
2087
- "div",
2088
- {
2089
- style: {
2090
- lineHeight: r ? 0 : `${Fc}rem`,
2091
- marginBottom: k.length === 0 ? 0 : `${r ? zc : qc}rem`
2092
- },
2093
- children: Oe
2094
- }
2095
- ),
2096
- /* @__PURE__ */ l("div", { style: Dc, children: /* @__PURE__ */ l(
2097
- ue,
2098
- {
2099
- size: r ? "small" : "x-small",
2100
- lineHeight: "default",
2101
- color: "secondary",
2102
- "data-testid": "module-item-meta",
2103
- children: P.map((y, X) => /* @__PURE__ */ l(
2104
- "span",
2105
- {
2106
- style: r ? X > 0 ? He : Nc : P.length > 1 ? X > 0 ? xc : He : void 0,
2107
- "data-testid": "meta-line",
2108
- children: y.map((F, le) => /* @__PURE__ */ J(wn, { children: [
2109
- le > 0 ? /* @__PURE__ */ l("span", { style: Oc, children: " " }) : null,
2110
- /* @__PURE__ */ J(
2111
- "span",
2112
- {
2113
- style: le > 0 ? ce : se,
2114
- "data-testid": "meta-fact",
2115
- "data-fact-key": F.key,
2116
- children: [
2117
- Ie(F.icon) ? null : /* @__PURE__ */ l(
2118
- "span",
2119
- {
2120
- style: kc,
2121
- "aria-hidden": "true",
2122
- "data-testid": `meta-icon-${F.key}`,
2123
- children: r && mt(F.icon) && F.icon.props.size === "xs" ? Io(F.icon, { size: "sm" }) : F.icon
2124
- }
2125
- ),
2126
- F.node
2127
- ]
2128
- }
2129
- )
2130
- ] }, F.key))
2131
- },
2132
- y[0].key
2133
- ))
2134
- }
2135
- ) }),
2136
- r && V ? /* @__PURE__ */ l(ie, { as: "div", margin: "x-small 0 0 0", children: V }) : null
2137
- ] })
2138
- ] }) }),
2139
- !r && V ? /* @__PURE__ */ l(U.Item, { children: V }) : null
2140
- ] }) })
2141
- }
2142
- );
2143
- }
2144
- const Ul = Mo($c);
2145
- function Bc(e) {
2146
- switch (e) {
2147
- case "complete":
2148
- return "complete";
2149
- case "locked":
2150
- return "locked";
2151
- case void 0:
2152
- case "not_started":
2153
- return "notStarted";
2154
- case "in_progress":
2155
- return "inProgress";
2156
- case "missing":
2157
- case "incomplete":
2158
- case "missing_and_incomplete":
2159
- return "missing";
2160
- }
2161
- }
2162
- function ot(e) {
2163
- return (t, n) => {
2164
- const { newTheme: o } = n;
2165
- return {
2166
- backgroundPrimaryInverse: o.semantics(o.primitives).color.background.accent[e]
2167
- };
2168
- };
2169
- }
2170
- const Wc = {
2171
- missing: {
2172
- background: "primary-inverse",
2173
- borderWidth: "none",
2174
- themeOverride: ot("honey"),
2175
- icon: /* @__PURE__ */ l(Te, { size: "sm", color: "onColor" })
2176
- },
2177
- complete: {
2178
- background: "primary-inverse",
2179
- borderWidth: "none",
2180
- themeOverride: ot("aurora"),
2181
- icon: /* @__PURE__ */ l(ft, { size: "sm", color: "onColor" })
2182
- },
2183
- inProgress: {
2184
- background: "primary-inverse",
2185
- borderWidth: "none",
2186
- themeOverride: ot("sky"),
2187
- icon: /* @__PURE__ */ l(ht, { size: "sm", color: "onColor" })
2188
- },
2189
- notStarted: {
2190
- background: "primary",
2191
- borderWidth: "medium",
2192
- icon: /* @__PURE__ */ l(bt, { size: "sm", color: "baseColor" })
2193
- },
2194
- locked: {
2195
- background: "secondary",
2196
- borderWidth: "small",
2197
- icon: /* @__PURE__ */ l(pt, { size: "sm", color: "baseColor" })
2198
- }
2199
- };
2200
- function Gc(e) {
2201
- var a, c, d;
2202
- let t = 0, n = 0, o = 0;
2203
- for (const g of e)
2204
- ((a = g.progress) == null ? void 0 : a.status) === "complete" && (t += 1), n += ((c = g.progress) == null ? void 0 : c.requirementCount) ?? 0, o += ((d = g.progress) == null ? void 0 : d.requirementsMet) ?? 0;
2205
- const r = e.length, s = r === 0 ? 0 : t === r ? 100 : Math.floor(t / r * 100);
2206
- return {
2207
- totalModules: r,
2208
- completedModules: t,
2209
- totalItems: n,
2210
- completedItems: o,
2211
- percent: s
2212
- };
2213
- }
2214
- const ut = 32, jc = "4px", Hc = 4, De = { none: 0, small: 1, medium: 2 }, Kc = 6, Yc = 8, yn = 2, Be = 3;
2215
- function Qc(e, t, n) {
2216
- const o = Hc + n / 2, r = e ? ut / 2 : o, s = t ? ut / 2 : o;
2217
- return `${r}px ${s}px ${s}px ${r}px`;
2218
- }
2219
- function Vc({
2220
- module: e,
2221
- isFirst: t,
2222
- isLast: n,
2223
- onClick: o
2224
- }) {
2225
- var b, I, x;
2226
- const { t: r } = oe(), a = Vn().moduleLabel(e.position, e), c = a ? r("moduleNameWithLabel", { label: a, name: e.name }) : e.name, d = ((b = e.progress) == null ? void 0 : b.status) ?? "not_started", g = Bc(d), h = r("moduleProgressSegmentLabel", {
2227
- name: c,
2228
- status: so(
2229
- r,
2230
- d,
2231
- ((I = e.progress) == null ? void 0 : I.missingCount) ?? 0,
2232
- ((x = e.progress) == null ? void 0 : x.incompleteCount) ?? 0
2233
- )
2234
- }), p = Wc[g];
2235
- return /* @__PURE__ */ l(U.Item, { shouldGrow: !0, shouldShrink: !0, size: "0", children: /* @__PURE__ */ l(ko, { renderTip: c, children: () => /* @__PURE__ */ J(
2236
- ie,
2237
- {
2238
- as: "button",
2239
- type: "button",
2240
- display: "block",
2241
- width: "100%",
2242
- height: `${ut}px`,
2243
- padding: "0",
2244
- position: "relative",
2245
- borderRadius: Qc(t, n, De[p.borderWidth]),
2246
- borderWidth: p.borderWidth,
2247
- borderColor: "secondary",
2248
- background: p.background,
2249
- themeOverride: p.themeOverride,
2250
- cursor: o ? "pointer" : void 0,
2251
- onClick: o ? () => o(e.id) : void 0,
2252
- "data-testid": `modules-progress-segment-${e.id}`,
2253
- children: [
2254
- /* @__PURE__ */ l(U, { as: "span", height: "100%", justifyItems: "center", alignItems: "center", children: p.icon }),
2255
- /* @__PURE__ */ l(vn, { children: h }),
2256
- /* @__PURE__ */ l(
2257
- "span",
2258
- {
2259
- "aria-hidden": "true",
2260
- "data-testid": `modules-progress-hit-area-${e.id}`,
2261
- style: {
2262
- position: "absolute",
2263
- top: `-${Kc + De[p.borderWidth]}px`,
2264
- bottom: `-${Yc + De[p.borderWidth]}px`,
2265
- left: `${yn - De[p.borderWidth]}px`,
2266
- right: `${yn - De[p.borderWidth]}px`
2267
- }
2268
- }
2269
- )
2270
- ]
2271
- }
2272
- ) }) });
2273
- }
2274
- function $l({
2275
- modules: e,
2276
- onModuleClick: t,
2277
- hasMoreModules: n = !1,
2278
- continuesBefore: o = !1,
2279
- continuesAfter: r = !1,
2280
- pagination: s
2281
- }) {
2282
- const { t: a } = oe(), c = W(() => Gc(e), [e]);
2283
- if (!e.some((p) => p.progress !== void 0) || c.totalModules === 0) return null;
2284
- const g = a("moduleProgressOverviewSummary", {
2285
- count: c.totalModules,
2286
- completedModules: c.completedModules,
2287
- totalModules: c.totalModules
2288
- }), h = c.totalItems > 0 ? a("moduleProgressOverviewDetail", {
2289
- itemsSummary: a("moduleProgressOverviewItemsSummary", {
2290
- count: c.totalItems,
2291
- completedItems: c.completedItems,
2292
- totalItems: c.totalItems
2293
- })
2294
- }) : null;
2295
- return /* @__PURE__ */ J(ie, { as: "div", margin: "0 0 small 0", "data-testid": "modules-progress-overview", children: [
2296
- n ? null : /* @__PURE__ */ l(U, { wrap: "wrap", children: /* @__PURE__ */ J(U.Item, { children: [
2297
- /* @__PURE__ */ l(ie, { as: "span", margin: "0 x-small 0 0", children: /* @__PURE__ */ l(
2298
- Oo,
2299
- {
2300
- level: "reset",
2301
- variant: "titleSection",
2302
- "data-testid": "modules-progress-overview-percent",
2303
- children: a("moduleProgressOverviewPercentLabel", { percent: c.percent })
2304
- }
2305
- ) }),
2306
- /* @__PURE__ */ l(ue, { variant: "content", "data-testid": "modules-progress-overview-summary", children: h ? `${g} ${h}` : g })
2307
- ] }) }),
2308
- /* @__PURE__ */ l(ie, { as: "div", margin: "xx-small 0 0 0", children: /* @__PURE__ */ l(
2309
- U,
2310
- {
2311
- gap: jc,
2312
- role: "group",
2313
- "aria-label": a("moduleProgressOverviewGroupLabel"),
2314
- "data-testid": "modules-progress-overview-segments",
2315
- children: e.map((p, b) => /* @__PURE__ */ l(
2316
- Vc,
2317
- {
2318
- module: p,
2319
- isFirst: b === 0 && !o,
2320
- isLast: b === e.length - 1 && !r,
2321
- onClick: t
2322
- },
2323
- p.id
2324
- ))
2325
- }
2326
- ) }),
2327
- s ? /* @__PURE__ */ l(Zc, { pagination: s, shownCount: e.length }) : null
2328
- ] });
2329
- }
2330
- function Mn({
2331
- targetRef: e,
2332
- testId: t,
2333
- children: n
2334
- }) {
2335
- return /* @__PURE__ */ l(
2336
- "span",
2337
- {
2338
- "data-testid": t,
2339
- style: {
2340
- display: "inline-flex",
2341
- padding: `0 ${Be}px ${Be}px`,
2342
- margin: `0 -${Be}px -${Be}px`
2343
- },
2344
- onClick: (o) => {
2345
- var r;
2346
- o.target === o.currentTarget && ((r = e.current) == null || r.click());
2347
- },
2348
- children: n
2349
- }
2350
- );
2351
- }
2352
- function Zc({
2353
- pagination: e,
2354
- shownCount: t
2355
- }) {
2356
- const { t: n } = oe(), { rangeStart: o, totalCount: r, hasPreviousPage: s, hasNextPage: a, disabled: c = !1 } = e, d = _(null), g = _(null), h = _(null);
2357
- me(() => {
2358
- var I, x;
2359
- if (c) return;
2360
- const b = h.current;
2361
- h.current = null, b === "next" && !a && ((I = d.current) == null || I.focus()), b === "previous" && !s && ((x = g.current) == null || x.focus());
2362
- }, [c, a, s]);
2363
- const p = (b) => {
2364
- c || (h.current = b, b === "next" ? e.onNextPage() : e.onPreviousPage());
2365
- };
2366
- return /* @__PURE__ */ l(ie, { as: "div", margin: "x-small 0 0 0", children: /* @__PURE__ */ J(
2367
- U,
2368
- {
2369
- as: "nav",
2370
- justifyItems: "space-between",
2371
- alignItems: "center",
2372
- gap: "x-small",
2373
- "aria-label": n("moduleProgressOverviewPaginationLabel"),
2374
- "data-testid": "modules-progress-overview-pagination",
2375
- children: [
2376
- /* @__PURE__ */ l(Mn, { targetRef: d, testId: "modules-progress-overview-previous-hit-area", children: /* @__PURE__ */ l(
2377
- Ft,
2378
- {
2379
- size: "small",
2380
- withBackground: !1,
2381
- withBorder: !1,
2382
- renderIcon: /* @__PURE__ */ l(Lo, {}),
2383
- screenReaderLabel: n("paginationPreviousPage"),
2384
- interaction: s ? "enabled" : "disabled",
2385
- elementRef: (b) => {
2386
- d.current = b;
2387
- },
2388
- onClick: () => p("previous")
2389
- }
2390
- ) }),
2391
- r === null ? null : /* @__PURE__ */ l(ue, { size: "small", color: "secondary", "data-testid": "modules-progress-overview-range", children: n("moduleProgressOverviewPageRange", {
2392
- start: o,
2393
- end: o + t - 1,
2394
- total: r
2395
- }) }),
2396
- /* @__PURE__ */ l(Mn, { targetRef: g, testId: "modules-progress-overview-next-hit-area", children: /* @__PURE__ */ l(
2397
- Ft,
2398
- {
2399
- size: "small",
2400
- withBackground: !1,
2401
- withBorder: !1,
2402
- renderIcon: /* @__PURE__ */ l(xo, {}),
2403
- screenReaderLabel: n("paginationNextPage"),
2404
- interaction: a ? "enabled" : "disabled",
2405
- elementRef: (b) => {
2406
- g.current = b;
2407
- },
2408
- onClick: () => p("next")
2409
- }
2410
- ) })
2411
- ]
2412
- }
2413
- ) });
2414
- }
2415
- export {
2416
- Qo as $,
2417
- Dc as A,
2418
- Oc as B,
2419
- zl as C,
2420
- ro as D,
2421
- xl as E,
2422
- Ll as F,
2423
- Ul as G,
2424
- Vo as H,
2425
- Nn as I,
2426
- Jo as J,
2427
- Xo as K,
2428
- Zo as L,
2429
- yl as M,
2430
- Dl as N,
2431
- Rl as O,
2432
- vl as P,
2433
- Fl as Q,
2434
- $l as R,
2435
- _a as S,
2436
- Pn as T,
2437
- Ho as U,
2438
- $o as V,
2439
- Bo as W,
2440
- _n as X,
2441
- Go as Y,
2442
- Wo as Z,
2443
- Ko as _,
2444
- bl as a,
2445
- An as a0,
2446
- jo as a1,
2447
- hl as a2,
2448
- Yo as a3,
2449
- Dn as a4,
2450
- Ln as a5,
2451
- El as a6,
2452
- nr as a7,
2453
- rn as a8,
2454
- Da as a9,
2455
- wc as aA,
2456
- Tc as aB,
2457
- Sc as aC,
2458
- so as aD,
2459
- kn as aE,
2460
- ae as aF,
2461
- ma as aG,
2462
- Ie as aH,
2463
- io as aI,
2464
- ot as aJ,
2465
- xa as aa,
2466
- Aa as ab,
2467
- Mt as ac,
2468
- $a as ad,
2469
- Fa as ae,
2470
- La as af,
2471
- za as ag,
2472
- Ua as ah,
2473
- Re as ai,
2474
- ye as aj,
2475
- Nl as ak,
2476
- ka as al,
2477
- Ol as am,
2478
- we as an,
2479
- Zn as ao,
2480
- Ha as ap,
2481
- ja as aq,
2482
- Ga as ar,
2483
- St as as,
2484
- Xn as at,
2485
- wt as au,
2486
- Za as av,
2487
- _l as aw,
2488
- We as ax,
2489
- Ne as ay,
2490
- cr as az,
2491
- qt as b,
2492
- Cl as c,
2493
- kl as d,
2494
- Sl as e,
2495
- Tl as f,
2496
- wl as g,
2497
- it as h,
2498
- Pl as i,
2499
- It as j,
2500
- Ye as k,
2501
- Mc as l,
2502
- Al as m,
2503
- kc as n,
2504
- Bt as o,
2505
- tr as p,
2506
- Vn as q,
2507
- Ec as r,
2508
- ql as s,
2509
- Un as t,
2510
- oe as u,
2511
- Rn as v,
2512
- Ml as w,
2513
- Il as x,
2514
- Ac as y,
2515
- Ea as z
2516
- };