@instructure/platform-modules 1.11.0 → 1.13.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 (90) hide show
  1. package/README.md +72 -23
  2. package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
  3. package/dist/adapters/canvasGraphql/normalize.d.ts +2 -1
  4. package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
  5. package/dist/adapters/canvasGraphql/queries.d.ts +9 -2
  6. package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
  7. package/dist/adapters/inMemory.d.ts +2 -0
  8. package/dist/adapters/inMemory.d.ts.map +1 -1
  9. package/dist/adapters/types.d.ts +6 -1
  10. package/dist/adapters/types.d.ts.map +1 -1
  11. package/dist/analytics/types.d.ts +1 -1
  12. package/dist/analytics/types.d.ts.map +1 -1
  13. package/dist/cache/keys.d.ts +1 -0
  14. package/dist/cache/keys.d.ts.map +1 -1
  15. package/dist/chunks/useModulesPageData-BFCZuChP.js +1639 -0
  16. package/dist/components/FilterSelect.d.ts +1 -2
  17. package/dist/components/FilterSelect.d.ts.map +1 -1
  18. package/dist/components/ModuleCard.d.ts.map +1 -1
  19. package/dist/components/ModuleCard.stories.d.ts +1 -0
  20. package/dist/components/ModuleCard.stories.d.ts.map +1 -1
  21. package/dist/components/ModuleItemRow.d.ts +8 -5
  22. package/dist/components/ModuleItemRow.d.ts.map +1 -1
  23. package/dist/components/ModulesList.d.ts +0 -1
  24. package/dist/components/ModulesList.d.ts.map +1 -1
  25. package/dist/components/ModulesList.stories.d.ts +3 -2
  26. package/dist/components/ModulesList.stories.d.ts.map +1 -1
  27. package/dist/components/ModulesProgressBar.d.ts +20 -1
  28. package/dist/components/ModulesProgressBar.d.ts.map +1 -1
  29. package/dist/components/ModulesProgressBar.stories.d.ts +1 -0
  30. package/dist/components/ModulesProgressBar.stories.d.ts.map +1 -1
  31. package/dist/components/index.d.ts +1 -1
  32. package/dist/components/index.d.ts.map +1 -1
  33. package/dist/components/labels.d.ts +9 -0
  34. package/dist/components/labels.d.ts.map +1 -1
  35. package/dist/config/base.d.ts.map +1 -1
  36. package/dist/config/capabilities.d.ts.map +1 -1
  37. package/dist/config/filters.d.ts +2 -1
  38. package/dist/config/filters.d.ts.map +1 -1
  39. package/dist/config/index.d.ts +1 -1
  40. package/dist/config/index.d.ts.map +1 -1
  41. package/dist/config/itemMeta.d.ts.map +1 -1
  42. package/dist/config/itemTypes.d.ts +1 -1
  43. package/dist/config/resolve.d.ts.map +1 -1
  44. package/dist/config/schemas.d.ts +2 -2
  45. package/dist/config/schemas.d.ts.map +1 -1
  46. package/dist/config/types.d.ts +22 -2
  47. package/dist/config/types.d.ts.map +1 -1
  48. package/dist/edit/adapter/inMemoryEdit.d.ts +5 -0
  49. package/dist/edit/adapter/inMemoryEdit.d.ts.map +1 -0
  50. package/dist/edit/adapter/types.d.ts +90 -0
  51. package/dist/edit/adapter/types.d.ts.map +1 -0
  52. package/dist/edit/hooks/useModulesEditData.d.ts +28 -0
  53. package/dist/edit/hooks/useModulesEditData.d.ts.map +1 -0
  54. package/dist/edit/index.d.ts +5 -0
  55. package/dist/edit/index.d.ts.map +1 -0
  56. package/dist/edit.js +189 -0
  57. package/dist/hooks/constants.d.ts +3 -3
  58. package/dist/hooks/constants.d.ts.map +1 -1
  59. package/dist/hooks/index.d.ts +2 -3
  60. package/dist/hooks/index.d.ts.map +1 -1
  61. package/dist/hooks/pageSteps.d.ts +12 -0
  62. package/dist/hooks/pageSteps.d.ts.map +1 -0
  63. package/dist/hooks/queryOptions.d.ts +5 -3
  64. package/dist/hooks/queryOptions.d.ts.map +1 -1
  65. package/dist/hooks/useIsMobileViewport.d.ts +3 -0
  66. package/dist/hooks/useIsMobileViewport.d.ts.map +1 -0
  67. package/dist/hooks/useItemsMode.d.ts +2 -0
  68. package/dist/hooks/useItemsMode.d.ts.map +1 -1
  69. package/dist/hooks/useModuleItemQueries.d.ts +19 -8
  70. package/dist/hooks/useModuleItemQueries.d.ts.map +1 -1
  71. package/dist/hooks/useModules.d.ts +2 -0
  72. package/dist/hooks/useModules.d.ts.map +1 -1
  73. package/dist/hooks/useModulesPageData.d.ts +16 -7
  74. package/dist/hooks/useModulesPageData.d.ts.map +1 -1
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +1663 -2867
  78. package/dist/organize/Organize.stories.d.ts +2 -1
  79. package/dist/organize/Organize.stories.d.ts.map +1 -1
  80. package/dist/organize/OrganizeModulesModal.d.ts.map +1 -1
  81. package/dist/organize/ProposalPreview.d.ts.map +1 -1
  82. package/dist/types/domain.d.ts +3 -1
  83. package/dist/types/domain.d.ts.map +1 -1
  84. package/dist/types/filterClause.d.ts +2 -2
  85. package/dist/types/filterClause.d.ts.map +1 -1
  86. package/dist/types/schemas.d.ts.map +1 -1
  87. package/locales/en.json +6 -9
  88. package/package.json +8 -1
  89. package/dist/hooks/useModuleItems.d.ts +0 -25
  90. package/dist/hooks/useModuleItems.d.ts.map +0 -1
@@ -0,0 +1,1639 @@
1
+ import { keepPreviousData as It, useQuery as vt, useQueryClient as Tt, QueryObserver as un } from "@tanstack/react-query";
2
+ import nt from "p-limit";
3
+ import { createContext as Ct, useContext as xe, useMemo as W, useState as Q, useRef as T, useEffect as me, useCallback as v } from "react";
4
+ import { jsx as q } from "react/jsx-runtime";
5
+ import { z as a } from "zod";
6
+ import { PlugInstUIIcon as ln, ExternalLinkInstUIIcon as cn, FileInstUIIcon as dn, FileTextInstUIIcon as mn, MessagesSquareInstUIIcon as gn, RocketInstUIIcon as fn, FilePenLineInstUIIcon as pn, ClockInstUIIcon as hn, CalendarInstUIIcon as Et } from "@instructure/ui-icons";
7
+ import { Text as bn } from "@instructure/ui-text/v11_7";
8
+ import { BREAKPOINTS as Pn } from "@instructure/platform-with-breakpoints";
9
+ const Ni = a.object({
10
+ target: a.enum(["module", "item"]),
11
+ field: a.string(),
12
+ op: a.enum(["eq", "contains", "within"]),
13
+ value: a.union([a.string(), a.boolean(), a.number()])
14
+ }).strict();
15
+ function Mn(e, t) {
16
+ const n = e == null ? void 0 : e[t.target];
17
+ return !n || !Object.prototype.hasOwnProperty.call(n, t.field) ? !1 : n[t.field].includes(t.op);
18
+ }
19
+ const yn = a.enum([
20
+ "assignment",
21
+ "quiz",
22
+ "discussion",
23
+ "page",
24
+ "file",
25
+ "external_url",
26
+ "external_tool",
27
+ "sub_header"
28
+ ]), wn = a.enum(["not_started", "in_progress", "complete", "incomplete", "missing", "locked"]), Sn = a.enum([
29
+ "not_started",
30
+ "in_progress",
31
+ "complete",
32
+ "missing",
33
+ "incomplete",
34
+ "missing_and_incomplete",
35
+ "locked"
36
+ ]), In = a.enum([
37
+ "must_view",
38
+ "must_mark_done",
39
+ "must_contribute",
40
+ "must_submit",
41
+ "min_score",
42
+ "min_percentage",
43
+ "unknown"
44
+ ]), vn = a.object({
45
+ status: Sn.optional(),
46
+ requirementsMet: a.number(),
47
+ requirementCount: a.number(),
48
+ percentComplete: a.number().min(0).max(100),
49
+ nextDueAt: a.string().nullish(),
50
+ missingCount: a.number(),
51
+ incompleteCount: a.number()
52
+ }), Dt = a.object({
53
+ itemId: a.string(),
54
+ type: In,
55
+ minScore: a.number().nullish(),
56
+ minPercentage: a.number().nullish()
57
+ }), Lt = a.object({
58
+ id: a.string(),
59
+ moduleId: a.string(),
60
+ title: a.string(),
61
+ type: yn,
62
+ position: a.number(),
63
+ indent: a.number(),
64
+ published: a.boolean(),
65
+ url: a.string().nullish(),
66
+ newTab: a.boolean().nullish(),
67
+ completionRequirement: Dt.nullish(),
68
+ dueAt: a.string().nullish(),
69
+ status: wn.optional(),
70
+ pointsPossible: a.number().nullish(),
71
+ extensions: a.record(a.unknown()).optional()
72
+ }), Tn = a.object({
73
+ id: a.string(),
74
+ name: a.string()
75
+ }), Cn = a.object({
76
+ id: a.string(),
77
+ name: a.string(),
78
+ position: a.number(),
79
+ published: a.boolean(),
80
+ itemCount: a.number(),
81
+ estimatedDurationMinutes: a.number().optional(),
82
+ items: a.array(Lt).optional(),
83
+ unlockAt: a.string().nullish(),
84
+ prerequisiteModules: a.array(Tn),
85
+ requirementCount: a.number().nullish(),
86
+ requireSequentialProgress: a.boolean(),
87
+ completionRequirements: a.array(Dt).optional(),
88
+ progress: vn.optional(),
89
+ collapsed: a.boolean().nullish(),
90
+ extensions: a.record(a.unknown()).optional()
91
+ }), _i = a.object({
92
+ hasNextPage: a.boolean(),
93
+ endCursor: a.string().nullable()
94
+ }).refine((e) => !e.hasNextPage || e.endCursor !== null, {
95
+ 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.',
96
+ path: ["endCursor"]
97
+ }), At = a.object({
98
+ hasNextPage: a.boolean(),
99
+ endCursor: a.string().nullable(),
100
+ hasPreviousPage: a.boolean(),
101
+ startCursor: a.string().nullable(),
102
+ totalCount: a.number().nullable(),
103
+ totalNrOfPages: a.number().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
+ }), Oi = a.object({
108
+ modules: a.array(Cn),
109
+ pageInfo: At
110
+ }), xi = a.object({
111
+ items: a.array(Lt),
112
+ pageInfo: At
113
+ }), Nt = "career.estimatedDurationMinutes";
114
+ function _t(e) {
115
+ var n;
116
+ const t = (n = e.extensions) == null ? void 0 : n[Nt];
117
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : t;
118
+ }
119
+ function Ri(e, t) {
120
+ return t == null ? e : { ...e, [Nt]: t };
121
+ }
122
+ const En = "modules.suppressItemNumbering";
123
+ function qi(e) {
124
+ var t;
125
+ return ((t = e.extensions) == null ? void 0 : t[En]) === !0;
126
+ }
127
+ const Dn = "organize.newPlacement", Ln = "organize.newModule", An = "organize.addedItemCount";
128
+ function Fi(e) {
129
+ var t;
130
+ return ((t = e.extensions) == null ? void 0 : t[Dn]) === !0;
131
+ }
132
+ function ki(e) {
133
+ var t;
134
+ return ((t = e.extensions) == null ? void 0 : t[Ln]) === !0;
135
+ }
136
+ function zi(e) {
137
+ var n;
138
+ const t = (n = e.extensions) == null ? void 0 : n[An];
139
+ return typeof t != "number" || !Number.isInteger(t) || t < 0 ? 0 : t;
140
+ }
141
+ const ot = 100, Ot = 2e3;
142
+ class Nn extends Error {
143
+ constructor(t, n) {
144
+ super(
145
+ `This in-memory adapter was built for course ${t} but was asked for course ${n}. A fixture serves exactly one course.`
146
+ ), this.name = "InMemoryCourseMismatchError", this.expected = t, this.received = n;
147
+ }
148
+ }
149
+ const rt = (e) => `offset:${e}`, st = (e) => {
150
+ if (!e) return 0;
151
+ const t = Number.parseInt(e.replace("offset:", ""), 10);
152
+ return Number.isFinite(t) && t >= 0 ? t : 0;
153
+ }, Pe = (e) => {
154
+ if (e != null && e.aborted)
155
+ throw new DOMException("The operation was aborted.", "AbortError");
156
+ };
157
+ function it(e, t, n) {
158
+ const o = e.length, r = Math.ceil(o / n), s = t.kind === "first" ? 0 : t.kind === "after" ? st(t.cursor) : t.kind === "before" ? Math.max(0, st(t.cursor) - n) : Math.max(0, o - t.count), c = e.slice(s, s + n), g = s + c.length, l = g < o, f = s > 0;
159
+ return {
160
+ slice: c,
161
+ pageInfo: {
162
+ hasNextPage: l,
163
+ endCursor: l ? rt(g) : null,
164
+ hasPreviousPage: f,
165
+ startCursor: f ? rt(s) : null,
166
+ totalCount: o,
167
+ totalNrOfPages: r
168
+ }
169
+ };
170
+ }
171
+ const _n = /* @__PURE__ */ new Map([
172
+ ["COMPLETED", (e) => {
173
+ var t;
174
+ return ((t = e.progress) == null ? void 0 : t.status) === "complete";
175
+ }],
176
+ ["IN_PROGRESS", (e) => {
177
+ var t;
178
+ return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
179
+ }],
180
+ ["INCOMPLETE", (e) => {
181
+ var t;
182
+ return ((t = e.progress) == null ? void 0 : t.status) !== "complete";
183
+ }],
184
+ [
185
+ "NOT_STARTED",
186
+ (e) => {
187
+ var t, n;
188
+ return ((t = e.progress) == null ? void 0 : t.status) !== "complete" && ((n = e.progress) == null ? void 0 : n.status) !== "in_progress";
189
+ }
190
+ ]
191
+ ]), On = /* @__PURE__ */ new Map([
192
+ ["locked", (e) => {
193
+ var t;
194
+ return ((t = e.progress) == null ? void 0 : t.status) === "locked";
195
+ }],
196
+ ["missing", (e) => {
197
+ var t;
198
+ return ((t = e.progress) == null ? void 0 : t.status) === "missing";
199
+ }],
200
+ ["missing_and_incomplete", (e) => {
201
+ var t;
202
+ return ((t = e.progress) == null ? void 0 : t.status) === "missing_and_incomplete";
203
+ }],
204
+ ["incomplete", (e) => {
205
+ var t;
206
+ return ((t = e.progress) == null ? void 0 : t.status) === "incomplete";
207
+ }],
208
+ ["complete", (e) => {
209
+ var t;
210
+ return ((t = e.progress) == null ? void 0 : t.status) === "complete";
211
+ }],
212
+ ["in_progress", (e) => {
213
+ var t;
214
+ return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
215
+ }],
216
+ ["not_started", (e) => {
217
+ var t;
218
+ return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
219
+ }]
220
+ ]), xn = {
221
+ module: { completionStatus: ["eq"], moduleStatus: ["eq"], dueWithinDays: ["within"] }
222
+ };
223
+ function Rn(e) {
224
+ const t = Date.parse(e.start), n = Date.parse(e.end);
225
+ return (o) => {
226
+ var c;
227
+ const r = (c = o.progress) == null ? void 0 : c.nextDueAt;
228
+ if (!r) return !1;
229
+ const s = Date.parse(r);
230
+ return s >= t && s <= n;
231
+ };
232
+ }
233
+ function qn(e, t) {
234
+ if (e.target === "module" && e.field === "completionStatus" && e.op === "eq") {
235
+ const n = typeof e.value == "string" ? _n.get(e.value) : void 0;
236
+ if (!n) throw new Error(`unknown completionStatus "${String(e.value)}"`);
237
+ return n;
238
+ }
239
+ if (e.target === "module" && e.field === "moduleStatus" && e.op === "eq") {
240
+ const n = typeof e.value == "string" ? On.get(e.value) : void 0;
241
+ if (!n) throw new Error(`unknown moduleStatus "${String(e.value)}"`);
242
+ return n;
243
+ }
244
+ if (e.target === "module" && e.field === "dueWithinDays" && e.op === "within") {
245
+ if (!t) throw new Error("A dueWithinDays clause needs a dueRange");
246
+ return Rn(t);
247
+ }
248
+ throw new Error(`in-memory adapter cannot compile ${e.target}.${e.field} ${e.op}`);
249
+ }
250
+ function Ui(e, t = {}) {
251
+ const n = (r) => e.itemsByModuleId[r] ?? [], o = (r) => {
252
+ if (r !== e.courseId)
253
+ throw new Nn(e.courseId, r);
254
+ };
255
+ return {
256
+ capabilities: xn,
257
+ async listModules({
258
+ courseId: r,
259
+ page: s = { kind: "first" },
260
+ pageSize: c,
261
+ includeItems: g,
262
+ filter: l,
263
+ dueRange: f,
264
+ inlineItemsFirst: y,
265
+ signal: w
266
+ }) {
267
+ var p;
268
+ Pe(w), o(r), (p = t.onRequest) == null || p.call(t, "listModules", { operation: "listModules", courseId: r });
269
+ const C = l ? e.modules.filter(qn(l, f)) : e.modules, { slice: I, pageInfo: H } = it(C, s, c), O = Math.min(y ?? ot, ot);
270
+ return { modules: I.map((P) => {
271
+ const E = n(P.id), D = g && E.length <= O;
272
+ return { ...P, itemCount: E.length, items: D ? E : void 0 };
273
+ }), pageInfo: H };
274
+ },
275
+ async listModuleItems({
276
+ courseId: r,
277
+ moduleId: s,
278
+ page: c = { kind: "first" },
279
+ pageSize: g,
280
+ signal: l
281
+ }) {
282
+ var w;
283
+ Pe(l), o(r), (w = t.onRequest) == null || w.call(t, "listModuleItems", { operation: "listModuleItems", courseId: r, moduleId: s });
284
+ const { slice: f, pageInfo: y } = it(n(s), c, g);
285
+ return { items: f, pageInfo: y };
286
+ },
287
+ async setModuleCollapsed({
288
+ courseId: r,
289
+ moduleId: s,
290
+ collapsed: c,
291
+ signal: g
292
+ }) {
293
+ var f;
294
+ Pe(g), o(r), (f = t.onRequest) == null || f.call(t, "setModuleCollapsed", {
295
+ operation: "setModuleCollapsed",
296
+ courseId: r,
297
+ moduleId: s,
298
+ collapsed: c
299
+ });
300
+ const l = e.modules.findIndex((y) => y.id === s);
301
+ l !== -1 && (e.modules[l] = { ...e.modules[l], collapsed: c });
302
+ },
303
+ async setAllModulesCollapsed({
304
+ courseId: r,
305
+ collapsed: s,
306
+ signal: c
307
+ }) {
308
+ var g;
309
+ Pe(c), o(r), (g = t.onRequest) == null || g.call(t, "setAllModulesCollapsed", {
310
+ operation: "setAllModulesCollapsed",
311
+ courseId: r,
312
+ collapsed: s
313
+ }), e.modules = e.modules.map((l) => ({ ...l, collapsed: s }));
314
+ }
315
+ };
316
+ }
317
+ const re = ["platform-modules"], ge = {
318
+ all: re,
319
+ course: (e) => [...re, e],
320
+ list: (e, t = {}) => [...re, e, "list", t],
321
+ items: (e, t, n = {}) => [...re, e, "module", t, "items", n]
322
+ };
323
+ function Fn(e) {
324
+ return [...re, e, "list"];
325
+ }
326
+ function Me(e, t) {
327
+ return [...re, e, "module", t, "items"];
328
+ }
329
+ function Bi(e, t, n, o) {
330
+ const r = o ? ge.items(t, n, o) : Me(t, n);
331
+ return e.invalidateQueries({ queryKey: r });
332
+ }
333
+ function ji(e, t, n) {
334
+ const o = n ? ge.list(t, n) : Fn(t);
335
+ return e.invalidateQueries({ queryKey: o });
336
+ }
337
+ function Wi(e, t) {
338
+ return e.invalidateQueries({ queryKey: ge.course(t) });
339
+ }
340
+ const Ae = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
341
+ function at(e, t) {
342
+ const n = Object.entries(t ?? {}).filter(([, o]) => o !== void 0);
343
+ return { ...e, ...Object.fromEntries(n) };
344
+ }
345
+ function $i(e, t = {}) {
346
+ const n = Object.keys(e).map((r) => [
347
+ r,
348
+ at(e[r], Ae(t, r) ? t[r] : void 0)
349
+ ]), o = Object.keys(t).filter((r) => !Ae(e, r)).sort().map((r) => [r, at({}, t[r])]);
350
+ return Object.fromEntries([...n, ...o]);
351
+ }
352
+ function se(e, t) {
353
+ if (!(!Ae(e, t) || e[t].hidden))
354
+ return e[t];
355
+ }
356
+ function kn(e) {
357
+ return Object.keys(e).filter((t) => se(e, t) !== void 0).map((t) => ({ ...e[t], key: t })).sort((t, n) => t.order - n.order);
358
+ }
359
+ const zn = "Page %{page} of %{pageCount}", Un = "First page", Bn = "Previous page", jn = "Next page", Wn = "Last page", $n = "Page %{page}", Yn = "…", Gn = "Expand all modules", Qn = "Collapse all modules", Hn = { one: "Loading items in %{count} module…", other: "Loading items in %{count} modules…" }, Zn = "All items loaded", Kn = { one: "%{count} module expanded", other: "%{count} modules expanded" }, Vn = { one: "%{count} module collapsed", other: "%{count} modules collapsed" }, Xn = "Modules failed to load: %{message}", Jn = "Loading modules", eo = "No modules available yet", to = "Modules will appear here once your instructor publishes them. Check back soon or reach out to your instructor for more information.", no = "No matching results", oo = "Adjust or clear your filters to see more items.", ro = "Clear filters", so = "Show:", io = "All", ao = "Not started", uo = "In progress", lo = "Complete", co = "Due soon", mo = "Missing", go = "Locked until %{name} is completed.", fo = "Locked until %{prerequisites} are completed.", po = "%{count} prerequisites", ho = "%{label}. %{name}", bo = "%{label} %{name}", Po = "%{name} progress", Mo = { one: "%{loaded} of %{count} item loaded in %{name}", other: "%{loaded} of %{count} items loaded in %{name}" }, yo = "Items failed to load: %{message}", wo = "Loading items", So = "Loading…", Io = "No items.", vo = "%{name} items pages", To = "Page %{page} of %{pageCount} in %{name}", Co = "(unpublished)", Eo = "Collapse %{name}", Do = "Expand %{name}", Lo = "Not started", Ao = "In progress", No = "All completed", _o = "%{count} Missing", Oo = "%{count} Incomplete", xo = "%{missing} & %{incomplete}", Ro = "Locked", qo = "Due soon", Fo = "Not started", ko = "In progress", zo = "Completed", Uo = "Incomplete", Bo = "Missing", jo = "Locked", Wo = "Due soon", $o = "Assignment", Yo = "Quiz", Go = "Discussion", Qo = "Page", Ho = "File", Zo = "External URL", Ko = "External tool", Vo = "Text header", Xo = "Item type", Jo = "Due date", er = "Points", tr = "Requirement", nr = "Estimated duration", or = "Publish state", rr = "View the item", sr = "Submit the assignment", ir = "Contribute to the page", ar = "Mark as done", ur = "Score at least the minimum", lr = "Score at least %{count}", cr = "Score at least the minimum percentage", dr = "Score at least %{count}%", mr = "Complete the requirement", gr = "today, %{time}", fr = "yesterday, %{time}", pr = "tomorrow, %{time}", hr = "%{date}, %{time}", br = "%{time} (%{zone})", Pr = "Due %{when}", Mr = "Past due %{when}", yr = "Will unlock on %{when}", wr = "Unlocked on %{when}", Sr = "%{duration} to complete", Ir = "%{duration} remaining", vr = "%{hours}h %{minutes}m", Tr = "%{count}h", Cr = "%{count}m", Er = { one: "%{count} pt", other: "%{count} pts" }, Dr = "%{met} of %{count}", Lr = { one: "%{met} of %{count} requirement met", other: "%{met} of %{count} requirements met" }, Ar = "%{percent}%", Nr = { one: "%{completedModules} of %{totalModules} module complete", other: "%{completedModules} of %{totalModules} modules complete" }, _r = "(%{itemsSummary})", Or = { one: "%{completedItems} of %{totalItems} item", other: "%{completedItems} of %{totalItems} items" }, xr = "Module progress", Rr = "Module progress pages", qr = "Modules %{start}–%{end} of %{total}", Fr = "%{name}: %{status}", kr = "%{count}min", zr = "%{count}hr", Ur = "%{hours}hr %{minutes}min", Br = "Unpublished", jr = "Untitled item", Wr = "opens in a new window", $r = "Organize with AI", Yr = "Organize content into modules", Gr = "Module progression", Qr = "Set module prerequisites", Hr = "Set item requirements per module", Zr = "Close", Kr = "What should this do?", Vr = "Place new content only", Xr = "Reorganize the whole course", Jr = "This rebuilds every module in the course. Existing modules can be renamed, refilled, or removed.", es = "Content to organize", ts = "Anything else it should know? (optional)", ns = "For example: keep the lab work together and put it last.", os = "%{used}/%{max}", rs = "Choose at least one kind of content.", ss = "Organize", is = "Cancel", as = "Start over", us = "Regenerate", ls = "Apply", cs = "Try again", ds = "Organizing your content…", ms = "Creating your modules…", gs = "Still working. Large courses take longer.", fs = "Your proposal is ready to review.", ps = "Your modules were created.", hs = "Your content could not be organized: %{message}", bs = "Your modules could not be created: %{message}", Ps = "Proposed modules", Ms = "New module", ys = { one: "%{count} item added", other: "%{count} items added" }, ws = "New", Ss = "New placement", Is = { one: "%{count} item was not placed", other: "%{count} items were not placed" }, vs = "You can still apply this. Anything left out stays where it is.", Ts = { one: "%{count} thing to know", other: "%{count} things to know" }, Cs = {
360
+ pageChangedAnnouncement: zn,
361
+ paginationFirstPage: Un,
362
+ paginationPreviousPage: Bn,
363
+ paginationNextPage: jn,
364
+ paginationLastPage: Wn,
365
+ paginationPageLabel: $n,
366
+ paginationEllipsis: Yn,
367
+ expandAllModules: Gn,
368
+ collapseAllModules: Qn,
369
+ expandAllLoadingItems: Hn,
370
+ expandAllItemsLoaded: Zn,
371
+ modulesExpandedAnnouncement: Kn,
372
+ modulesCollapsedAnnouncement: Vn,
373
+ modulesLoadErrorAlert: Xn,
374
+ modulesLoadingSpinnerLabel: Jn,
375
+ noModulesEmptyStateTitle: eo,
376
+ noModulesEmptyStateDescription: to,
377
+ filteredEmptyStateTitle: no,
378
+ filteredEmptyStateDescription: oo,
379
+ clearFilters: ro,
380
+ filterGroupLabel: so,
381
+ filterAll: io,
382
+ filterNotStarted: ao,
383
+ filterInProgress: uo,
384
+ filterComplete: lo,
385
+ filterDueThisWeek: co,
386
+ filterMissing: mo,
387
+ lockedByPrerequisiteByline: go,
388
+ lockedByPrerequisitesByline: fo,
389
+ lockedByPrerequisitesCount: po,
390
+ moduleNameWithLabel: ho,
391
+ itemNameWithLabel: bo,
392
+ moduleProgressScreenReaderLabel: Po,
393
+ itemsLoadedAnnouncement: Mo,
394
+ itemsLoadErrorAlert: yo,
395
+ itemsLoadingSpinnerLabel: wo,
396
+ itemsLoadingText: So,
397
+ noItemsEmptyState: Io,
398
+ itemsPaginationLabel: vo,
399
+ itemsPageChangedAnnouncement: To,
400
+ moduleUnpublishedBadge: Co,
401
+ collapseModule: Eo,
402
+ expandModule: Do,
403
+ moduleStatusNotStarted: Lo,
404
+ moduleStatusInProgress: Ao,
405
+ moduleStatusComplete: No,
406
+ moduleStatusMissing: _o,
407
+ moduleStatusIncomplete: Oo,
408
+ moduleStatusMissingAndIncomplete: xo,
409
+ moduleStatusLocked: Ro,
410
+ moduleStatusDueSoon: qo,
411
+ itemStatusNotStarted: Fo,
412
+ itemStatusInProgress: ko,
413
+ itemStatusComplete: zo,
414
+ itemStatusIncomplete: Uo,
415
+ itemStatusMissing: Bo,
416
+ itemStatusLocked: jo,
417
+ itemStatusDueSoon: Wo,
418
+ itemTypeAssignment: $o,
419
+ itemTypeQuiz: Yo,
420
+ itemTypeDiscussion: Go,
421
+ itemTypePage: Qo,
422
+ itemTypeFile: Ho,
423
+ itemTypeExternalUrl: Zo,
424
+ itemTypeExternalTool: Ko,
425
+ itemTypeSubHeader: Vo,
426
+ metaFieldTypeLabel: Xo,
427
+ metaFieldDueAtLabel: Jo,
428
+ metaFieldPointsLabel: er,
429
+ metaFieldRequirementLabel: tr,
430
+ metaFieldDurationLabel: nr,
431
+ metaFieldPublishStateLabel: or,
432
+ requirementMustView: rr,
433
+ requirementMustSubmit: sr,
434
+ requirementMustContribute: ir,
435
+ requirementMustMarkDone: ar,
436
+ requirementMinScoreUnknown: ur,
437
+ requirementMinScore: lr,
438
+ requirementMinPercentageUnknown: cr,
439
+ requirementMinPercentage: dr,
440
+ requirementUnknown: mr,
441
+ dateTimeToday: gr,
442
+ dateTimeYesterday: fr,
443
+ dateTimeTomorrow: pr,
444
+ dateTimeWithDate: hr,
445
+ timeWithZone: br,
446
+ dueByline: Pr,
447
+ pastDueByline: Mr,
448
+ unlockByline: yr,
449
+ unlockedByline: wr,
450
+ estimatedDurationByline: Sr,
451
+ remainingDurationByline: Ir,
452
+ estimatedDurationHoursAndMinutes: vr,
453
+ estimatedDurationHours: Tr,
454
+ estimatedDurationMinutesAbbreviated: Cr,
455
+ pointsAbbreviated: Er,
456
+ progressSummary: Dr,
457
+ progressScreenReaderValue: Lr,
458
+ moduleProgressOverviewPercentLabel: Ar,
459
+ moduleProgressOverviewSummary: Nr,
460
+ moduleProgressOverviewDetail: _r,
461
+ moduleProgressOverviewItemsSummary: Or,
462
+ moduleProgressOverviewGroupLabel: xr,
463
+ moduleProgressOverviewPaginationLabel: Rr,
464
+ moduleProgressOverviewPageRange: qr,
465
+ moduleProgressSegmentLabel: Fr,
466
+ durationMinutes: kr,
467
+ durationHours: zr,
468
+ durationHoursAndMinutes: Ur,
469
+ itemUnpublishedLabel: Br,
470
+ itemUntitled: jr,
471
+ opensInNewWindow: Wr,
472
+ organizeModulesTrigger: $r,
473
+ organizeModalLabel: Yr,
474
+ organizeProgressionLegend: Gr,
475
+ organizeSetPrerequisites: Qr,
476
+ organizeSetRequirements: Hr,
477
+ organizeCloseModal: Zr,
478
+ organizeModeLegend: Kr,
479
+ organizeModePlaceNew: Vr,
480
+ organizeModeReorganizeAll: Xr,
481
+ organizeReorganizeWarning: Jr,
482
+ organizeContentTypesLegend: es,
483
+ organizeDirectionLabel: ts,
484
+ organizeDirectionPlaceholder: ns,
485
+ organizeDirectionCount: os,
486
+ organizeErrorPickAContentType: rs,
487
+ organizeSubmit: ss,
488
+ organizeCancel: is,
489
+ organizeStartOver: as,
490
+ organizeRegenerate: us,
491
+ organizeApply: ls,
492
+ organizeTryAgain: cs,
493
+ organizeLoadingLabel: ds,
494
+ organizeApplyingLabel: ms,
495
+ organizeStillWorking: gs,
496
+ organizeProposalReadyAnnouncement: fs,
497
+ organizeAppliedAnnouncement: ps,
498
+ organizeFailed: hs,
499
+ organizeApplyFailed: bs,
500
+ organizePreviewHeading: Ps,
501
+ organizeNewModuleLabel: Ms,
502
+ organizeItemsAddedLabel: ys,
503
+ organizeNewItemPill: ws,
504
+ metaFieldNewPlacementLabel: Ss,
505
+ organizeUnplacedHeading: Is,
506
+ organizeUnplacedExplanation: vs,
507
+ organizeWarningsHeading: Ts
508
+ }, Es = /%\{(\w+)\}/g, Ds = Cs, K = "en-US", Ls = /* @__PURE__ */ new Map(), As = /* @__PURE__ */ new Map();
509
+ function xt(e, t, n) {
510
+ const o = e.get(t);
511
+ if (o) return o;
512
+ const r = n();
513
+ return e.set(t, r), r;
514
+ }
515
+ function Ns(e, t, n) {
516
+ return n ? e.replace(Es, (o, r) => {
517
+ if (!Object.prototype.hasOwnProperty.call(n, r)) return o;
518
+ const s = n[r];
519
+ return typeof s == "number" && Number.isFinite(s) ? xt(As, t, () => new Intl.NumberFormat(t)).format(s) : String(s);
520
+ }) : e;
521
+ }
522
+ function _s(e, t, n) {
523
+ const o = n == null ? void 0 : n.count;
524
+ if (typeof o == "number" && Number.isFinite(o)) {
525
+ const r = xt(Ls, t, () => new Intl.PluralRules(t)).select(o), s = e[r];
526
+ if (typeof s == "string") return s;
527
+ }
528
+ return typeof e.other == "string" ? e.other : void 0;
529
+ }
530
+ function ut(e, t, n) {
531
+ if (typeof e == "string") return e;
532
+ if (e !== null && typeof e == "object")
533
+ return _s(e, t, n);
534
+ }
535
+ const lt = /* @__PURE__ */ new Set();
536
+ function Os(e) {
537
+ lt.has(e) || (lt.add(e), console.warn(
538
+ `[platform-modules] no translation for "${e}"; it will render as itself. Add it to the catalog passed to ModulesI18nProvider.`
539
+ ));
540
+ }
541
+ function xs(e, t, n, o, r) {
542
+ const s = ut(e == null ? void 0 : e[t], n, r);
543
+ if (typeof s == "string") return s;
544
+ const c = ut(Ds[t], n, r);
545
+ return typeof c == "string" ? c : (o && Os(t), t);
546
+ }
547
+ function Rt(e, t = K, n = !1) {
548
+ return (o, r) => Ns(xs(e, o, t, n, r), t, r);
549
+ }
550
+ const Rs = Rt(), qs = { t: Rs, locale: K }, Ne = Ct(null);
551
+ function Yi({
552
+ translations: e,
553
+ locale: t,
554
+ timezone: n,
555
+ warnOnMissingKey: o,
556
+ children: r
557
+ }) {
558
+ const s = xe(Ne), c = W(() => {
559
+ const g = (s == null ? void 0 : s.translations) === void 0 ? e : { ...s.translations, ...e }, l = t ?? (s == null ? void 0 : s.locale) ?? K;
560
+ return {
561
+ t: Rt(g, l, o),
562
+ locale: l,
563
+ timezone: n ?? (s == null ? void 0 : s.timezone),
564
+ translations: g
565
+ };
566
+ }, [s, e, t, n, o]);
567
+ return /* @__PURE__ */ q(Ne.Provider, { value: c, children: r });
568
+ }
569
+ function Fs() {
570
+ return xe(Ne) ?? qs;
571
+ }
572
+ const _e = 864e5, Oe = "en-US", ct = /* @__PURE__ */ new Map(), dt = /* @__PURE__ */ new Map();
573
+ function ks(e) {
574
+ const t = dt.get(e);
575
+ if (t) return t;
576
+ const n = new Intl.NumberFormat(e, { useGrouping: !1 });
577
+ return dt.set(e, n), n;
578
+ }
579
+ function mt(e, t) {
580
+ return {
581
+ time: new Intl.DateTimeFormat(e, {
582
+ hour: "numeric",
583
+ minute: "2-digit",
584
+ timeZone: t
585
+ }),
586
+ day: new Intl.DateTimeFormat(e, { month: "long", day: "numeric", timeZone: t }),
587
+ dayYear: new Intl.DateTimeFormat(e, {
588
+ month: "long",
589
+ day: "numeric",
590
+ year: "numeric",
591
+ timeZone: t
592
+ }),
593
+ zone: t ? new Intl.DateTimeFormat(e, { timeZone: t, timeZoneName: "short" }) : void 0,
594
+ civilDay: new Intl.DateTimeFormat(Oe, {
595
+ year: "numeric",
596
+ month: "numeric",
597
+ day: "numeric",
598
+ timeZone: t
599
+ })
600
+ };
601
+ }
602
+ function Re(e, t) {
603
+ const n = t || void 0, o = `${e}|${n ?? ""}`, r = ct.get(o);
604
+ if (r) return r;
605
+ let s;
606
+ try {
607
+ s = mt(e, n);
608
+ } catch {
609
+ console.warn(
610
+ `[platform-modules] Unusable timezone ${JSON.stringify(n)}; rendering dates in the viewer's own clock instead.`
611
+ ), s = mt(e, void 0);
612
+ }
613
+ return ct.set(o, s), s;
614
+ }
615
+ function gt(e, t) {
616
+ return new Date(ye(e, t)).getUTCFullYear();
617
+ }
618
+ function zs(e, t) {
619
+ var o;
620
+ const n = (o = e.zone) == null ? void 0 : o.formatToParts(t).find((r) => r.type === "timeZoneName");
621
+ return (n == null ? void 0 : n.value) ?? null;
622
+ }
623
+ function qt(e, t) {
624
+ var n;
625
+ return Number((n = e.find((o) => o.type === t)) == null ? void 0 : n.value);
626
+ }
627
+ function ye(e, t) {
628
+ const n = e.civilDay.formatToParts(t), o = (r) => qt(n, r);
629
+ return Date.UTC(o("year"), o("month") - 1, o("day"));
630
+ }
631
+ function Us(e, t, n) {
632
+ return Ut(Re(K, n), e, t);
633
+ }
634
+ const ft = {
635
+ hour12: !1,
636
+ year: "numeric",
637
+ month: "numeric",
638
+ day: "numeric",
639
+ hour: "numeric",
640
+ minute: "numeric",
641
+ second: "numeric"
642
+ }, pt = /* @__PURE__ */ new Map();
643
+ function Bs(e) {
644
+ const t = e || void 0, n = t ?? "", o = pt.get(n);
645
+ if (o) return o;
646
+ let r;
647
+ try {
648
+ r = new Intl.DateTimeFormat(Oe, { ...ft, timeZone: t });
649
+ } catch {
650
+ r = new Intl.DateTimeFormat(Oe, ft);
651
+ }
652
+ return pt.set(n, r), r;
653
+ }
654
+ function ht(e, t) {
655
+ const n = Bs(e).formatToParts(t), o = (s) => qt(n, s);
656
+ return Date.UTC(
657
+ o("year"),
658
+ o("month") - 1,
659
+ o("day"),
660
+ o("hour") % 24,
661
+ o("minute"),
662
+ o("second")
663
+ ) - Math.floor(t.getTime() / 1e3) * 1e3;
664
+ }
665
+ function bt(e, t) {
666
+ const n = ye(Re(K, t), e), o = new Date(n - ht(t, e));
667
+ return n - ht(t, o);
668
+ }
669
+ function js(e, t, n) {
670
+ const o = bt(e, n), r = new Date(o + t * _e + _e / 2);
671
+ return {
672
+ start: e.toISOString(),
673
+ end: new Date(bt(r, n) - 1).toISOString()
674
+ };
675
+ }
676
+ const Ft = 7;
677
+ function kt(e) {
678
+ if (!e) return null;
679
+ const t = new Date(e);
680
+ return Number.isNaN(t.getTime()) ? null : t;
681
+ }
682
+ function Ws(e, t, n) {
683
+ const o = kt(e);
684
+ return o === null || zt(e, t) ? !1 : Us(o, t, n) < Ft;
685
+ }
686
+ function zt(e, t) {
687
+ const n = kt(e);
688
+ return n !== null && n.getTime() < t.getTime();
689
+ }
690
+ function Ut(e, t, n) {
691
+ return Math.round((ye(e, t) - ye(e, n)) / _e);
692
+ }
693
+ function $s(e, t, n, { locale: o = K, timezone: r } = {}) {
694
+ const s = new Date(t);
695
+ if (Number.isNaN(s.getTime())) return t;
696
+ const c = Re(o, r), g = zs(c, s), l = c.time.format(s), f = g ? e("timeWithZone", { time: l, zone: g }) : l, y = Ut(c, s, n);
697
+ if (y === 0) return e("dateTimeToday", { time: f });
698
+ if (y === -1) return e("dateTimeYesterday", { time: f });
699
+ if (y === 1) return e("dateTimeTomorrow", { time: f });
700
+ const C = gt(c, s) === gt(c, n) ? c.day.format(s) : c.dayYear.format(s);
701
+ return e("dateTimeWithDate", { date: C, time: f });
702
+ }
703
+ function Bt(e, t = K) {
704
+ return !Number.isInteger(e) || e < 1 ? null : ks(t).format(e);
705
+ }
706
+ function Gi(e, t, n = K) {
707
+ if (!e || t === void 0) return null;
708
+ const o = Bt(t, n);
709
+ return o === null ? null : `${e}.${o}`;
710
+ }
711
+ function Ys(e, t) {
712
+ return t == null ? null : e("pointsAbbreviated", { count: t });
713
+ }
714
+ function Gs(e, t) {
715
+ switch (t.type) {
716
+ case "must_view":
717
+ return e("requirementMustView");
718
+ case "must_submit":
719
+ return e("requirementMustSubmit");
720
+ case "must_contribute":
721
+ return e("requirementMustContribute");
722
+ case "must_mark_done":
723
+ return e("requirementMustMarkDone");
724
+ case "min_score":
725
+ return t.minScore === null || t.minScore === void 0 ? e("requirementMinScoreUnknown") : e("requirementMinScore", { count: t.minScore });
726
+ case "min_percentage":
727
+ return t.minPercentage === null || t.minPercentage === void 0 ? e("requirementMinPercentageUnknown") : e("requirementMinPercentage", { count: t.minPercentage });
728
+ case "unknown":
729
+ return e("requirementUnknown");
730
+ }
731
+ }
732
+ function Qs(e, t, n) {
733
+ return e("progressSummary", { met: t, count: n });
734
+ }
735
+ function Qi(e, t, n) {
736
+ return e("progressScreenReaderValue", { met: t, count: n });
737
+ }
738
+ function Hs(e) {
739
+ if (!e) return null;
740
+ const t = e.map((n) => _t(n)).filter((n) => n !== null);
741
+ return t.length === 0 ? null : t.reduce((n, o) => n + o, 0);
742
+ }
743
+ function Hi(e) {
744
+ if (!e) return null;
745
+ const t = e.filter((n) => n.status !== void 0 && n.status !== "complete");
746
+ return Hs(t);
747
+ }
748
+ function jt(e) {
749
+ return { hours: Math.floor(e / 60), mins: e % 60 };
750
+ }
751
+ function Wt(e, t) {
752
+ const { hours: n, mins: o } = jt(t);
753
+ return n > 0 && o > 0 ? e("estimatedDurationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("estimatedDurationHours", { count: n }) : e("estimatedDurationMinutesAbbreviated", { count: o });
754
+ }
755
+ function Zi(e, t) {
756
+ return e("estimatedDurationByline", { duration: Wt(e, t) });
757
+ }
758
+ function Ki(e, t) {
759
+ return e("remainingDurationByline", { duration: Wt(e, t) });
760
+ }
761
+ function Zs(e, t) {
762
+ const { hours: n, mins: o } = jt(t);
763
+ return n > 0 && o > 0 ? e("durationHoursAndMinutes", { hours: n, minutes: o }) : n > 0 ? e("durationHours", { count: n }) : e("durationMinutes", { count: o });
764
+ }
765
+ const Ks = "all", Vs = Ft, Xs = {
766
+ all: {
767
+ label: "filterAll",
768
+ order: 10,
769
+ unfiltered: !0,
770
+ predicate: () => !0
771
+ },
772
+ not_started: {
773
+ label: "filterNotStarted",
774
+ order: 15,
775
+ predicate: (e) => {
776
+ var t;
777
+ return ((t = e.progress) == null ? void 0 : t.status) === "not_started";
778
+ },
779
+ query: { target: "module", field: "moduleStatus", op: "eq", value: "not_started" }
780
+ },
781
+ in_progress: {
782
+ label: "filterInProgress",
783
+ order: 20,
784
+ predicate: (e) => {
785
+ var t;
786
+ return ((t = e.progress) == null ? void 0 : t.status) === "in_progress";
787
+ },
788
+ query: { target: "module", field: "moduleStatus", op: "eq", value: "in_progress" }
789
+ },
790
+ complete: {
791
+ label: "filterComplete",
792
+ order: 30,
793
+ predicate: (e) => {
794
+ var t;
795
+ return ((t = e.progress) == null ? void 0 : t.status) === "complete";
796
+ },
797
+ query: { target: "module", field: "completionStatus", op: "eq", value: "COMPLETED" }
798
+ },
799
+ due_this_week: {
800
+ label: "filterDueThisWeek",
801
+ order: 40,
802
+ predicate: (e, { today: t, timezone: n }) => {
803
+ var o;
804
+ return Ws((o = e.progress) == null ? void 0 : o.nextDueAt, t, n);
805
+ },
806
+ query: {
807
+ target: "module",
808
+ field: "dueWithinDays",
809
+ op: "within",
810
+ value: Vs
811
+ }
812
+ },
813
+ missing: {
814
+ label: "filterMissing",
815
+ order: 50,
816
+ predicate: (e) => {
817
+ var t;
818
+ return ((t = e.progress) == null ? void 0 : t.status) === "missing";
819
+ },
820
+ query: { target: "module", field: "moduleStatus", op: "eq", value: "missing" }
821
+ }
822
+ };
823
+ function qe(e) {
824
+ return e == null ? void 0 : e.query;
825
+ }
826
+ function $t(e) {
827
+ return (e == null ? void 0 : e.unfiltered) === !0;
828
+ }
829
+ function Pt(e) {
830
+ return e !== void 0 && !$t(e);
831
+ }
832
+ function Js(e) {
833
+ return e !== void 0 && qe(e) === void 0;
834
+ }
835
+ const ei = {
836
+ moduleLabel: (e, t, { locale: n }) => Bt(e, n),
837
+ dateTime: (e, t, { t: n, locale: o, timezone: r }) => $s(n, e, t, { locale: o, timezone: r }),
838
+ points: (e, { t }) => Ys(t, e),
839
+ progress: (e, t, n, { t: o }) => Qs(o, t, n)
840
+ }, $ = { size: "xs", color: "mutedColor" }, ti = {
841
+ assignment: {
842
+ label: "itemTypeAssignment",
843
+ order: 10,
844
+ icon: /* @__PURE__ */ q(pn, { ...$ })
845
+ },
846
+ quiz: { label: "itemTypeQuiz", order: 20, icon: /* @__PURE__ */ q(fn, { ...$ }) },
847
+ discussion: {
848
+ label: "itemTypeDiscussion",
849
+ order: 30,
850
+ icon: /* @__PURE__ */ q(gn, { ...$ })
851
+ },
852
+ page: { label: "itemTypePage", order: 40, icon: /* @__PURE__ */ q(mn, { ...$ }) },
853
+ file: { label: "itemTypeFile", order: 50, icon: /* @__PURE__ */ q(dn, { ...$ }) },
854
+ external_url: {
855
+ label: "itemTypeExternalUrl",
856
+ order: 60,
857
+ icon: /* @__PURE__ */ q(cn, { ...$ })
858
+ },
859
+ external_tool: {
860
+ label: "itemTypeExternalTool",
861
+ order: 70,
862
+ icon: /* @__PURE__ */ q(ln, { ...$ })
863
+ },
864
+ sub_header: { label: "itemTypeSubHeader", order: 80, icon: null }
865
+ }, Vi = "type", ni = { fontSizeMedium: "inherit" }, Mt = /* @__PURE__ */ q(Et, { ...$ });
866
+ function yt({ item: e, today: t }) {
867
+ return e.status !== "complete" && e.status !== "locked" && zt(e.dueAt, t);
868
+ }
869
+ const oi = {
870
+ type: {
871
+ label: "metaFieldTypeLabel",
872
+ order: 10,
873
+ renderIcon: ({ item: e, config: t }) => {
874
+ const n = se(t.itemTypes, e.type);
875
+ return n ? n.renderIcon ? n.renderIcon({ item: e }) : n.icon : null;
876
+ },
877
+ render: ({ item: e, t, config: n }) => {
878
+ const o = se(n.itemTypes, e.type);
879
+ return o ? t(o.label) : null;
880
+ }
881
+ },
882
+ points: {
883
+ label: "metaFieldPointsLabel",
884
+ order: 20,
885
+ render: ({ item: e, formatters: t }) => t.points(e.pointsPossible)
886
+ },
887
+ requirement: {
888
+ label: "metaFieldRequirementLabel",
889
+ order: 30,
890
+ render: ({ item: e, t }) => e.completionRequirement ? Gs(t, e.completionRequirement) : null
891
+ },
892
+ dueAt: {
893
+ label: "metaFieldDueAtLabel",
894
+ order: 40,
895
+ icon: Mt,
896
+ /** Only the shipped glyph reddens; a host that cleared or replaced it keeps what it set. */
897
+ renderIcon: (e) => {
898
+ var n;
899
+ const t = (n = e.config.itemMeta.dueAt) == null ? void 0 : n.icon;
900
+ return t !== Mt || !yt(e) ? t : /* @__PURE__ */ q(Et, { ...$, color: "errorColor" });
901
+ },
902
+ render: (e) => {
903
+ const { item: t, today: n, formatters: o } = e;
904
+ return t.dueAt ? yt(e) ? /* @__PURE__ */ q(bn, { color: "danger", themeOverride: ni, children: o.pastDueByline(t.dueAt, n) }) : o.dueByline(t.dueAt, n) : null;
905
+ }
906
+ },
907
+ estimatedDuration: {
908
+ label: "metaFieldDurationLabel",
909
+ order: 50,
910
+ icon: /* @__PURE__ */ q(hn, { ...$ }),
911
+ render: ({ item: e, t }) => {
912
+ const n = _t(e);
913
+ return n === null ? null : Zs(t, n);
914
+ }
915
+ },
916
+ unpublished: {
917
+ label: "metaFieldPublishStateLabel",
918
+ order: 60,
919
+ render: ({ item: e, t }) => e.published ? null : t("itemUnpublishedLabel")
920
+ }
921
+ }, Fe = {
922
+ formatters: ei,
923
+ itemTypes: ti,
924
+ itemStatuses: {},
925
+ itemMeta: oi,
926
+ filters: Xs,
927
+ moduleActions: {},
928
+ itemActions: {},
929
+ navigation: {},
930
+ permissions: {},
931
+ notify: void 0
932
+ };
933
+ Object.freeze(Fe);
934
+ for (const e of Object.values(Fe)) {
935
+ Object.freeze(e);
936
+ for (const t of Object.values(e ?? {})) Object.freeze(t);
937
+ }
938
+ function ri(e, t) {
939
+ return kn(e).filter((n) => {
940
+ if ($t(n)) return !1;
941
+ const o = qe(n);
942
+ return o === void 0 ? !0 : !Mn(t, o);
943
+ }).map((n) => n.key);
944
+ }
945
+ function wt(e) {
946
+ 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.`;
947
+ }
948
+ function si(e, t) {
949
+ const n = ri(e, t);
950
+ if (n.length === 0) return e;
951
+ if (process.env.NODE_ENV !== "production")
952
+ throw new Error(wt(n));
953
+ console.warn(wt(n));
954
+ const o = Object.fromEntries(n.map((r) => [r, { ...e[r], hidden: !0 }]));
955
+ return { ...e, ...o };
956
+ }
957
+ const Yt = Ct(null);
958
+ function Xi({ value: e, children: t }) {
959
+ return /* @__PURE__ */ q(Yt.Provider, { value: e, children: t });
960
+ }
961
+ function Gt() {
962
+ return xe(Yt) ?? Fe;
963
+ }
964
+ function Ji(e) {
965
+ return se(Gt().itemMeta, e) !== void 0;
966
+ }
967
+ const ke = 10, ii = 4, ai = 20, Qt = 100, ui = 4, li = 4, ze = 5 * 60 * 1e3, Ht = 20;
968
+ function Zt(e) {
969
+ const {
970
+ courseId: t,
971
+ adapter: n,
972
+ page: o,
973
+ pageSize: r,
974
+ includeItems: s,
975
+ filter: c,
976
+ dueRange: g,
977
+ inlineItemsFirst: l,
978
+ inlineFirst: f,
979
+ view: y,
980
+ staleTime: w,
981
+ enabled: C
982
+ } = e;
983
+ return {
984
+ // `inlineItemsFirst`/`inlineFirst` are deliberately out of the key: derived from this list.
985
+ queryKey: ge.list(t, { view: y, pageSize: r, includeItems: s, filter: c, page: o }),
986
+ queryFn: ({ signal: I }) => n.listModules({
987
+ courseId: t,
988
+ page: o,
989
+ pageSize: r,
990
+ includeItems: s,
991
+ filter: c,
992
+ dueRange: g,
993
+ inlineItemsFirst: l,
994
+ inlineFirst: f,
995
+ signal: I
996
+ }),
997
+ enabled: C,
998
+ staleTime: w,
999
+ refetchOnWindowFocus: !1
1000
+ };
1001
+ }
1002
+ function ci(e) {
1003
+ const { courseId: t, moduleId: n, adapter: o, page: r, pageSize: s, view: c, staleTime: g, enabled: l, limit: f } = e;
1004
+ return {
1005
+ queryKey: ge.items(t, n, { view: c, pageSize: s, page: r }),
1006
+ queryFn: ({ signal: y }) => {
1007
+ const w = () => o.listModuleItems({ courseId: t, moduleId: n, page: r, pageSize: s, signal: y });
1008
+ return f ? f(() => {
1009
+ if (y.aborted)
1010
+ throw new DOMException("The operation was aborted.", "AbortError");
1011
+ return w();
1012
+ }) : w();
1013
+ },
1014
+ placeholderData: It,
1015
+ enabled: l,
1016
+ staleTime: g,
1017
+ refetchOnWindowFocus: !1
1018
+ };
1019
+ }
1020
+ const we = { request: { kind: "first" }, page: 1 };
1021
+ function de(e, t) {
1022
+ return e === null ? 1 : Math.max(1, Math.ceil(e / t));
1023
+ }
1024
+ function di(e, t, n, o) {
1025
+ switch (e) {
1026
+ case "first":
1027
+ return we;
1028
+ case "previous":
1029
+ return t === 2 ? we : n.hasPreviousPage && n.startCursor !== null ? { request: { kind: "before", cursor: n.startCursor }, page: t - 1 } : null;
1030
+ case "next":
1031
+ return n.hasNextPage && n.endCursor !== null ? { request: { kind: "after", cursor: n.endCursor }, page: t + 1 } : null;
1032
+ case "last": {
1033
+ const r = n.totalCount;
1034
+ return r === null ? null : {
1035
+ request: { kind: "last", count: r % o || o },
1036
+ page: de(r, o)
1037
+ };
1038
+ }
1039
+ }
1040
+ }
1041
+ const De = { kind: "first" }, mi = {
1042
+ hasNextPage: !1,
1043
+ endCursor: null,
1044
+ hasPreviousPage: !1,
1045
+ startCursor: null,
1046
+ totalCount: null,
1047
+ totalNrOfPages: null
1048
+ };
1049
+ function gi(e) {
1050
+ var V, X, ie;
1051
+ const {
1052
+ courseId: t,
1053
+ adapter: n,
1054
+ pageSize: o = ke,
1055
+ includeItems: r = !1,
1056
+ filter: s,
1057
+ dueRange: c,
1058
+ inlineItemsFirst: g,
1059
+ inlineFirst: l,
1060
+ view: f,
1061
+ staleTime: y = ze,
1062
+ enabled: w = !0
1063
+ } = e, [C, I] = Q(De), [H, O] = Q(1), x = JSON.stringify([t, f, o, r, s]), p = T(x);
1064
+ me(() => {
1065
+ p.current !== x && (p.current = x, I(De), O(1));
1066
+ }, [x]);
1067
+ const P = vt({
1068
+ ...Zt({
1069
+ courseId: t,
1070
+ adapter: n,
1071
+ page: C,
1072
+ pageSize: o,
1073
+ includeItems: r,
1074
+ filter: s,
1075
+ dueRange: c,
1076
+ inlineItemsFirst: g,
1077
+ inlineFirst: l,
1078
+ view: f,
1079
+ staleTime: y,
1080
+ enabled: w
1081
+ }),
1082
+ // `useItemsMode` shares `modulesQueryOptions`, and `inlineFirst` is out of that key.
1083
+ placeholderData: It
1084
+ }), E = T(null);
1085
+ ((V = P.data) == null ? void 0 : V.pageInfo.totalCount) != null && (E.current = P.data.pageInfo.totalCount);
1086
+ const D = T(1);
1087
+ P.isPlaceholderData || (D.current = H);
1088
+ const S = D.current, h = ((X = P.data) == null ? void 0 : X.pageInfo) ?? mi, b = ((ie = P.data) == null ? void 0 : ie.modules) ?? [], L = h.totalCount, Y = de(L, o), G = v(() => {
1089
+ I(De), O(1);
1090
+ }, []), z = h.hasPreviousPage, U = h.startCursor, m = v(() => {
1091
+ !z || U === null || (I({ kind: "before", cursor: U }), O(S - 1));
1092
+ }, [z, U, S]), F = h.hasNextPage, A = h.endCursor, fe = v(() => {
1093
+ !F || A === null || (I({ kind: "after", cursor: A }), O(S + 1));
1094
+ }, [F, A, S]), B = v(() => {
1095
+ const J = E.current, Z = J !== null && J > 0 && J % o || o;
1096
+ I({ kind: "last", count: Z }), O(Y);
1097
+ }, [o, Y]);
1098
+ return {
1099
+ modules: b,
1100
+ pageInfo: h,
1101
+ page: S,
1102
+ pageCount: Y,
1103
+ hasNextPage: F,
1104
+ hasPreviousPage: z,
1105
+ goToFirstPage: G,
1106
+ goToPreviousPage: m,
1107
+ goToNextPage: fe,
1108
+ goToLastPage: B,
1109
+ isLoading: P.isLoading,
1110
+ isPending: P.isPending,
1111
+ isPlaceholderData: P.isPlaceholderData,
1112
+ error: P.error
1113
+ };
1114
+ }
1115
+ const fi = { kind: "first" };
1116
+ function pi(e, t, n = Ot) {
1117
+ if (e.pageInfo.hasNextPage) return "onDemand";
1118
+ let o = 0, r = 0;
1119
+ for (const s of e.modules) {
1120
+ if (s.itemCount > t) return "onDemand";
1121
+ o += s.itemCount, s.itemCount > r && (r = s.itemCount);
1122
+ }
1123
+ return o > t * 2 ? "onDemand" : Math.max(e.modules.length, 1) * Math.max(r, 1) <= n ? "inline" : "onDemand";
1124
+ }
1125
+ function hi(e) {
1126
+ const {
1127
+ courseId: t,
1128
+ adapter: n,
1129
+ mode: o = "auto",
1130
+ inlineThreshold: r = Qt,
1131
+ nodeBudget: s = n.inlineNodeBudget ?? Ot,
1132
+ pageSize: c = ke,
1133
+ filter: g,
1134
+ dueRange: l,
1135
+ view: f,
1136
+ staleTime: y = ze
1137
+ } = e, w = o === "auto", C = vt(
1138
+ Zt({
1139
+ courseId: t,
1140
+ adapter: n,
1141
+ page: fi,
1142
+ pageSize: c,
1143
+ includeItems: !1,
1144
+ filter: g,
1145
+ dueRange: l,
1146
+ view: f,
1147
+ staleTime: y,
1148
+ enabled: w
1149
+ })
1150
+ );
1151
+ if (!w)
1152
+ return {
1153
+ resolvedMode: o,
1154
+ isResolving: !1,
1155
+ probed: !1,
1156
+ error: null,
1157
+ inlineShape: null
1158
+ };
1159
+ if (C.error)
1160
+ return {
1161
+ resolvedMode: "onDemand",
1162
+ isResolving: !1,
1163
+ probed: !0,
1164
+ error: C.error,
1165
+ inlineShape: null
1166
+ };
1167
+ const I = C.data;
1168
+ return I ? {
1169
+ resolvedMode: pi(I, r, s),
1170
+ isResolving: !1,
1171
+ probed: !0,
1172
+ error: null,
1173
+ inlineShape: bi(I)
1174
+ } : { resolvedMode: null, isResolving: !0, probed: !0, error: null, inlineShape: null };
1175
+ }
1176
+ function bi(e) {
1177
+ let t = 1;
1178
+ for (const n of e.modules)
1179
+ n.itemCount > t && (t = n.itemCount);
1180
+ return { moduleCount: Math.max(e.modules.length, 1), maxItemCount: t };
1181
+ }
1182
+ const Pi = `(max-width: ${Pn.mobileOnly.maxWidth})`;
1183
+ function St() {
1184
+ return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(Pi);
1185
+ }
1186
+ function Mi() {
1187
+ const [e, t] = Q(() => {
1188
+ var n;
1189
+ return ((n = St()) == null ? void 0 : n.matches) ?? !1;
1190
+ });
1191
+ return me(() => {
1192
+ const n = St();
1193
+ if (n === null) return;
1194
+ t(n.matches);
1195
+ const o = (r) => t(r.matches);
1196
+ return n.addEventListener("change", o), () => n.removeEventListener("change", o);
1197
+ }, []), e;
1198
+ }
1199
+ const Le = "\0", yi = /* @__PURE__ */ new Map();
1200
+ function wi(e, t, {
1201
+ pageSize: n,
1202
+ retainCollapsedLimit: o = Ht,
1203
+ partition: r = ""
1204
+ }) {
1205
+ const s = Tt(), c = T(/* @__PURE__ */ new Map()), g = T(/* @__PURE__ */ new Map()), l = `${n}${Le}${r}`, f = T(l), [y, w] = Q(yi), C = e.join(Le), I = W(() => C === "" ? [] : C.split(Le), [C]);
1206
+ me(() => {
1207
+ const p = c.current, P = g.current;
1208
+ f.current !== l && (P.clear(), f.current = l);
1209
+ const E = () => {
1210
+ w((b) => {
1211
+ const L = /* @__PURE__ */ new Map();
1212
+ let Y = b.size !== p.size;
1213
+ for (const [G, z] of p) {
1214
+ const U = z.getCurrentResult(), m = P.get(G), F = m ? U.isPlaceholderData ? m.shownPage : m.page : 1, A = b.get(G);
1215
+ if (A && A.result === U && A.page === F) {
1216
+ L.set(G, A);
1217
+ continue;
1218
+ }
1219
+ L.set(G, { result: U, page: F }), Y = !0;
1220
+ }
1221
+ return Y ? L : b;
1222
+ });
1223
+ }, D = (b) => (P.get(b) ?? we).request, S = new Set(I);
1224
+ for (const b of I) {
1225
+ if (p.has(b)) continue;
1226
+ const L = new un(
1227
+ s,
1228
+ t(b, !0, D(b))
1229
+ );
1230
+ p.set(b, L), L.subscribe(E);
1231
+ }
1232
+ for (const [b, L] of p)
1233
+ L.setOptions(t(b, S.has(b), D(b)));
1234
+ for (const b of I) {
1235
+ const L = p.get(b);
1236
+ L && (p.delete(b), p.set(b, L));
1237
+ }
1238
+ let h = p.size - S.size;
1239
+ if (h > o)
1240
+ for (const [b, L] of p) {
1241
+ if (h <= o) break;
1242
+ S.has(b) || (L.destroy(), p.delete(b), P.delete(b), h -= 1);
1243
+ }
1244
+ E();
1245
+ }, [s, t, I, o, l]), me(() => {
1246
+ const p = c.current;
1247
+ return () => {
1248
+ for (const P of p.values()) P.destroy();
1249
+ p.clear();
1250
+ };
1251
+ }, []);
1252
+ const H = T(n);
1253
+ H.current = n;
1254
+ const O = T(t);
1255
+ O.current = t;
1256
+ const x = v((p, P) => {
1257
+ const E = c.current.get(p), D = E == null ? void 0 : E.getCurrentResult();
1258
+ if (!E || !(D != null && D.data) || D.isPlaceholderData) return;
1259
+ const S = g.current.get(p) ?? we, h = di(P, S.page, D.data.pageInfo, H.current);
1260
+ !h || h.page === S.page || (g.current.set(p, { ...h, shownPage: S.page }), E.setOptions(
1261
+ O.current(p, E.options.enabled !== !1, h.request)
1262
+ ));
1263
+ }, []);
1264
+ return { entries: y, goToPage: x };
1265
+ }
1266
+ const Si = [];
1267
+ function ea(e) {
1268
+ var Ve, Xe;
1269
+ const {
1270
+ courseId: t,
1271
+ adapter: n,
1272
+ view: o,
1273
+ itemsMode: r = "auto",
1274
+ inlineThreshold: s = Qt,
1275
+ pageSize: c = ke,
1276
+ mobilePageSize: g = ii,
1277
+ itemPageSize: l = ai,
1278
+ itemConcurrency: f = ui,
1279
+ retainCollapsedLimit: y = Ht,
1280
+ staleTime: w = ze,
1281
+ initialExpandedModuleIds: C,
1282
+ initialFilter: I = Ks,
1283
+ today: H
1284
+ } = e, O = Mi() ? g : c, x = Tt(), p = Gt(), [P, E] = Q(I), D = W(
1285
+ () => si(p.filters, n.capabilities),
1286
+ [p.filters, n.capabilities]
1287
+ ), S = se(D, P), h = qe(S), { timezone: b } = Fs(), [L] = Q(() => /* @__PURE__ */ new Date()), Y = H ?? L, G = W(
1288
+ () => (h == null ? void 0 : h.op) === "within" ? js(Y, Number(h.value), b) : void 0,
1289
+ [h == null ? void 0 : h.op, h == null ? void 0 : h.value, Y, b]
1290
+ ), z = hi({
1291
+ courseId: t,
1292
+ adapter: n,
1293
+ mode: r,
1294
+ inlineThreshold: s,
1295
+ pageSize: O,
1296
+ filter: h,
1297
+ dueRange: G,
1298
+ view: o,
1299
+ staleTime: w
1300
+ }), U = z.resolvedMode, m = gi({
1301
+ courseId: t,
1302
+ adapter: n,
1303
+ pageSize: O,
1304
+ filter: h,
1305
+ dueRange: G,
1306
+ view: o,
1307
+ staleTime: w,
1308
+ includeItems: U === "inline",
1309
+ inlineItemsFirst: (Ve = z.inlineShape) == null ? void 0 : Ve.maxItemCount,
1310
+ inlineFirst: (Xe = z.inlineShape) == null ? void 0 : Xe.moduleCount,
1311
+ enabled: U !== null
1312
+ }), [F, A] = Q(
1313
+ () => C ?? []
1314
+ ), fe = C === void 0, B = T(!1), V = Pt(S), X = T(V);
1315
+ X.current = V;
1316
+ const ie = T(m.hasNextPage);
1317
+ ie.current = m.hasNextPage;
1318
+ const J = T(m.isPlaceholderData);
1319
+ J.current = m.isPlaceholderData, me(() => {
1320
+ !fe || B.current || V || m.isPlaceholderData || A((i) => {
1321
+ const u = new Set(i), d = [...i];
1322
+ for (const M of m.modules)
1323
+ M.collapsed === !1 && !u.has(M.id) && d.push(M.id);
1324
+ return d.length === i.length ? i : d;
1325
+ });
1326
+ }, [m.modules, m.isPlaceholderData, fe, V]);
1327
+ const Z = W(() => {
1328
+ const i = /* @__PURE__ */ new Map();
1329
+ for (const u of m.modules) i.set(u.id, u);
1330
+ return i;
1331
+ }, [m.modules]), Se = W(
1332
+ () => F.filter((i) => {
1333
+ const u = Z.get(i);
1334
+ return u !== void 0 && u.items === void 0;
1335
+ }),
1336
+ [F, Z]
1337
+ ), Ue = W(() => new Set(Se), [Se]), Be = W(() => nt(f), [f]), Kt = v(
1338
+ (i, u, d) => ci({
1339
+ courseId: t,
1340
+ moduleId: i,
1341
+ adapter: n,
1342
+ page: d,
1343
+ pageSize: l,
1344
+ view: o,
1345
+ staleTime: w,
1346
+ enabled: u,
1347
+ limit: Be
1348
+ }),
1349
+ [t, n, l, o, w, Be]
1350
+ ), je = wi(Se, Kt, {
1351
+ pageSize: l,
1352
+ retainCollapsedLimit: y,
1353
+ partition: JSON.stringify([t, o])
1354
+ }), We = W(() => nt(li), []), [Vt, $e] = Q(0), pe = v((i) => ($e((u) => u + 1), i.finally(() => $e((u) => u - 1))), []), ae = T(/* @__PURE__ */ new Map()), Ie = T(Promise.resolve()), j = v(
1355
+ (i, u, d) => {
1356
+ if (X.current) return;
1357
+ const M = n.setModuleCollapsed;
1358
+ if (!M) return;
1359
+ const N = Promise.all([Ie.current, ae.current.get(i)]).then(
1360
+ () => We(() => M({ courseId: t, moduleId: i, collapsed: u }))
1361
+ ), _ = ((d == null ? void 0 : d.track) === !0 ? pe(N) : N).catch((k) => {
1362
+ console.warn(
1363
+ `[platform-modules] failed to persist module ${i} collapsed=${u}: ${String(k)}`
1364
+ );
1365
+ }).finally(() => {
1366
+ ae.current.get(i) === _ && ae.current.delete(i);
1367
+ });
1368
+ ae.current.set(i, _);
1369
+ },
1370
+ [n, t, We, pe]
1371
+ ), he = v(
1372
+ (i, u) => {
1373
+ const d = n.setAllModulesCollapsed;
1374
+ if (!(!X.current && !ie.current && !J.current && d !== void 0)) {
1375
+ for (const _ of u) j(_, i, { track: !0 });
1376
+ return;
1377
+ }
1378
+ const N = pe(
1379
+ Promise.all([Ie.current, ...ae.current.values()]).then(
1380
+ () => d({ courseId: t, collapsed: i })
1381
+ )
1382
+ ).catch((_) => {
1383
+ console.warn(
1384
+ `[platform-modules] failed to persist all modules collapsed=${i}: ${String(_)}`
1385
+ );
1386
+ });
1387
+ Ie.current = N;
1388
+ },
1389
+ [n, t, j, pe]
1390
+ ), ve = v(
1391
+ (i, u) => {
1392
+ B.current = !0, A(
1393
+ (d) => d.includes(i) ? d : [...d, i]
1394
+ ), (u == null ? void 0 : u.persist) !== !1 && j(i, !1);
1395
+ },
1396
+ [j]
1397
+ ), ue = v(
1398
+ (i, u) => {
1399
+ B.current = !0, A((d) => d.filter((M) => M !== i)), x.cancelQueries({ queryKey: Me(t, i) }), (u == null ? void 0 : u.persist) !== !1 && j(i, !0);
1400
+ },
1401
+ [x, t, j]
1402
+ ), Xt = v(
1403
+ (i) => {
1404
+ B.current = !0, A((u) => {
1405
+ const d = new Set(u), M = i.filter((N) => !d.has(N));
1406
+ return M.length === 0 ? u : [...u, ...M];
1407
+ });
1408
+ for (const u of i) j(u, !1, { track: !0 });
1409
+ },
1410
+ [j]
1411
+ ), Jt = v(
1412
+ (i) => {
1413
+ B.current = !0;
1414
+ const u = new Set(i);
1415
+ A((d) => {
1416
+ const M = d.filter((N) => !u.has(N));
1417
+ return M.length === d.length ? d : M;
1418
+ });
1419
+ for (const d of u)
1420
+ x.cancelQueries({ queryKey: Me(t, d) }), j(d, !0, { track: !0 });
1421
+ },
1422
+ [x, t, j]
1423
+ ), ee = T(F);
1424
+ ee.current = F;
1425
+ const en = v(() => {
1426
+ B.current = !0;
1427
+ const i = ee.current;
1428
+ if (i.length !== 0) {
1429
+ for (const u of i)
1430
+ x.cancelQueries({ queryKey: Me(t, u) });
1431
+ A([]), he(!0, i);
1432
+ }
1433
+ }, [x, t, he]), tn = v(() => {
1434
+ B.current = !0;
1435
+ const i = m.modules.map((u) => u.id);
1436
+ i.length !== 0 && (A(i), he(!1, i));
1437
+ }, [m.modules, he]), Te = T(P);
1438
+ Te.current = P;
1439
+ const te = T(null), nn = v(
1440
+ (i) => {
1441
+ if (i === Te.current) return;
1442
+ if (Te.current = i, Pt(se(D, i))) {
1443
+ te.current === null && (te.current = ee.current);
1444
+ const d = B.current;
1445
+ for (const M of ee.current) ue(M, { persist: !1 });
1446
+ B.current = d;
1447
+ } else te.current !== null && (A(te.current), ee.current = te.current, te.current = null);
1448
+ E(i);
1449
+ },
1450
+ [D, ue]
1451
+ ), on = v(
1452
+ (i) => {
1453
+ ee.current.includes(i) ? ue(i) : ve(i);
1454
+ },
1455
+ [ue, ve]
1456
+ ), Ye = T(Z);
1457
+ Ye.current = Z;
1458
+ const [Ge, rn] = Q(() => /* @__PURE__ */ new Map()), Qe = je.goToPage, ne = v(
1459
+ (i, u) => {
1460
+ var N;
1461
+ const d = (N = Ye.current.get(i)) == null ? void 0 : N.items;
1462
+ if (d === void 0) {
1463
+ Qe(i, u);
1464
+ return;
1465
+ }
1466
+ const M = de(d.length, l);
1467
+ rn((_) => {
1468
+ const k = Math.min(_.get(i) ?? 1, M), le = u === "first" ? 1 : u === "last" ? M : Math.min(Math.max(k + (u === "next" ? 1 : -1), 1), M);
1469
+ return le === k ? _ : new Map(_).set(i, le);
1470
+ });
1471
+ },
1472
+ [Qe, l]
1473
+ ), Ce = W(() => /* @__PURE__ */ new Map(), [ne]), He = v(
1474
+ (i) => {
1475
+ let u = Ce.get(i);
1476
+ return u || (u = {
1477
+ goToFirstPage: () => ne(i, "first"),
1478
+ goToPreviousPage: () => ne(i, "previous"),
1479
+ goToNextPage: () => ne(i, "next"),
1480
+ goToLastPage: () => ne(i, "last")
1481
+ }, Ce.set(i, u)), u;
1482
+ },
1483
+ [Ce, ne]
1484
+ ), Ze = je.entries, Ke = T(/* @__PURE__ */ new Map()), sn = v(
1485
+ (i) => {
1486
+ var Je, et;
1487
+ const u = Z.get(i), d = Ze.get(i), M = Ue.has(i), N = Ge.get(i), _ = He(i), k = Ke.current.get(i);
1488
+ if (k && k.items === (u == null ? void 0 : u.items) && k.entry === d && k.active === M && k.inlinePage === N && k.navigation === _)
1489
+ return k.value;
1490
+ const le = (ce) => (Ke.current.set(i, {
1491
+ items: u == null ? void 0 : u.items,
1492
+ entry: d,
1493
+ active: M,
1494
+ inlinePage: N,
1495
+ navigation: _,
1496
+ value: ce
1497
+ }), ce);
1498
+ if ((u == null ? void 0 : u.items) !== void 0) {
1499
+ const ce = de(u.items.length, l), tt = Math.min(N ?? 1, ce), Ee = (tt - 1) * l;
1500
+ return le({
1501
+ items: u.items.slice(Ee, Ee + l),
1502
+ page: tt,
1503
+ pageCount: ce,
1504
+ itemOffset: u.items.slice(0, Ee).filter((an) => an.type !== "sub_header").length,
1505
+ ..._,
1506
+ isLoading: !1,
1507
+ isRefreshing: !1,
1508
+ error: null,
1509
+ source: "inline"
1510
+ });
1511
+ }
1512
+ const R = d == null ? void 0 : d.result, be = (d == null ? void 0 : d.page) ?? 1, oe = (Je = R == null ? void 0 : R.data) == null ? void 0 : Je.pageInfo;
1513
+ return le({
1514
+ items: ((et = R == null ? void 0 : R.data) == null ? void 0 : et.items) ?? Si,
1515
+ page: be,
1516
+ pageCount: Math.max(
1517
+ de((oe == null ? void 0 : oe.totalCount) ?? null, l),
1518
+ oe != null && oe.hasNextPage ? be + 1 : be
1519
+ ),
1520
+ // Assumes earlier pages hold no sub-headers. Exact numbers need a per-module running count.
1521
+ itemOffset: (be - 1) * l,
1522
+ ..._,
1523
+ isLoading: R ? R.isLoading : M,
1524
+ isRefreshing: (R == null ? void 0 : R.isPlaceholderData) ?? !1,
1525
+ error: (R == null ? void 0 : R.error) ?? null,
1526
+ source: "onDemand"
1527
+ });
1528
+ },
1529
+ [Z, Ze, Ue, Ge, He, l]
1530
+ );
1531
+ return {
1532
+ modules: m.modules,
1533
+ pageInfo: m.pageInfo,
1534
+ page: m.page,
1535
+ pageCount: m.pageCount,
1536
+ pageSize: O,
1537
+ hasNextPage: m.hasNextPage,
1538
+ hasPreviousPage: m.hasPreviousPage,
1539
+ goToFirstPage: m.goToFirstPage,
1540
+ goToPreviousPage: m.goToPreviousPage,
1541
+ goToNextPage: m.goToNextPage,
1542
+ goToLastPage: m.goToLastPage,
1543
+ isLoading: (z.isResolving || m.isPending) && !m.isPlaceholderData,
1544
+ isRefreshing: m.isPlaceholderData,
1545
+ error: m.error ?? z.error,
1546
+ itemsMode: U,
1547
+ getItems: sn,
1548
+ expandModule: ve,
1549
+ collapseModule: ue,
1550
+ expandModules: Xt,
1551
+ collapseModules: Jt,
1552
+ collapseAllModules: en,
1553
+ expandAllModules: tn,
1554
+ toggleModule: on,
1555
+ expandedModuleIds: F,
1556
+ filter: P,
1557
+ setFilter: nn,
1558
+ filterEntry: S,
1559
+ filterPredicate: Js(S) ? S == null ? void 0 : S.predicate : void 0,
1560
+ isPersistingCollapsed: Vt > 0
1561
+ };
1562
+ }
1563
+ export {
1564
+ qe as $,
1565
+ Yi as A,
1566
+ Xi as B,
1567
+ Ui as C,
1568
+ ea as D,
1569
+ En as E,
1570
+ Ni as F,
1571
+ Ks as G,
1572
+ Dt as H,
1573
+ Ot as I,
1574
+ In as J,
1575
+ Mn as K,
1576
+ Lt as L,
1577
+ xi as M,
1578
+ wn as N,
1579
+ yn as O,
1580
+ vn as P,
1581
+ Cn as Q,
1582
+ At as R,
1583
+ Sn as S,
1584
+ _i as T,
1585
+ Tn as U,
1586
+ Nt as V,
1587
+ _t as W,
1588
+ Nn as X,
1589
+ Xs as Y,
1590
+ ei as Z,
1591
+ Vs as _,
1592
+ Oi as a,
1593
+ si as a0,
1594
+ Js as a1,
1595
+ Vi as a2,
1596
+ ri as a3,
1597
+ Ji as a4,
1598
+ se as a5,
1599
+ Qt as a6,
1600
+ ui as a7,
1601
+ ai as a8,
1602
+ ii as a9,
1603
+ ke as aa,
1604
+ Ht as ab,
1605
+ ze as ac,
1606
+ gi as ad,
1607
+ Wi as ae,
1608
+ Me as af,
1609
+ ge as ag,
1610
+ Fn as ah,
1611
+ Rt as ai,
1612
+ K as aj,
1613
+ Rs as ak,
1614
+ ot as b,
1615
+ Bi as c,
1616
+ ki as d,
1617
+ Fi as e,
1618
+ Fe as f,
1619
+ zi as g,
1620
+ Ae as h,
1621
+ ji as i,
1622
+ Fs as j,
1623
+ Zi as k,
1624
+ Gi as l,
1625
+ $i as m,
1626
+ Ws as n,
1627
+ at as o,
1628
+ Hs as p,
1629
+ Hi as q,
1630
+ Ki as r,
1631
+ qi as s,
1632
+ Qi as t,
1633
+ Gt as u,
1634
+ kn as v,
1635
+ Ri as w,
1636
+ An as x,
1637
+ Ln as y,
1638
+ Dn as z
1639
+ };