@citolab/qti-components 7.28.1 → 8.0.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 (82) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +6205 -2973
  3. package/dist/base.d.ts +9 -50
  4. package/dist/base.js +27 -6
  5. package/dist/chunk-5QYII4OZ.js +1374 -0
  6. package/dist/chunk-5QYII4OZ.js.map +1 -0
  7. package/dist/{chunk-MPC7LIPC.js → chunk-5SJS36BI.js} +4264 -3647
  8. package/dist/chunk-5SJS36BI.js.map +1 -0
  9. package/dist/chunk-64XSIBGO.js +241 -0
  10. package/dist/chunk-64XSIBGO.js.map +1 -0
  11. package/dist/{chunk-SP6S2WMG.js → chunk-7V4HJFHW.js} +3 -3
  12. package/dist/{chunk-SP6S2WMG.js.map → chunk-7V4HJFHW.js.map} +1 -1
  13. package/dist/{chunk-3XV26R5M.js → chunk-H3J7LFRO.js} +829 -1005
  14. package/dist/chunk-H3J7LFRO.js.map +1 -0
  15. package/dist/{chunk-3WBG257S.js → chunk-IJD53WY6.js} +96 -74
  16. package/dist/chunk-IJD53WY6.js.map +1 -0
  17. package/dist/chunk-KYEZRYO6.js +1608 -0
  18. package/dist/chunk-KYEZRYO6.js.map +1 -0
  19. package/dist/{chunk-HFCZFWSH.js → chunk-LZJHHZQ2.js} +1954 -1729
  20. package/dist/chunk-LZJHHZQ2.js.map +1 -0
  21. package/dist/chunk-MGF5F3S2.js +11 -0
  22. package/dist/chunk-MGF5F3S2.js.map +1 -0
  23. package/dist/chunk-MJVPNN7W.js +11 -0
  24. package/dist/chunk-MJVPNN7W.js.map +1 -0
  25. package/dist/{chunk-REI3AMCZ.js → chunk-NA2N2WSG.js} +1303 -1193
  26. package/dist/chunk-NA2N2WSG.js.map +1 -0
  27. package/dist/chunk-V5G7X53Y.js +11 -0
  28. package/dist/chunk-V5G7X53Y.js.map +1 -0
  29. package/dist/chunk-W4QZPCNC.js +294 -0
  30. package/dist/chunk-W4QZPCNC.js.map +1 -0
  31. package/dist/chunk-WCQ26LV7.js +102 -0
  32. package/dist/chunk-WCQ26LV7.js.map +1 -0
  33. package/dist/{chunk-WDO2TRFM.js → chunk-WVVMNF74.js} +851 -925
  34. package/dist/chunk-WVVMNF74.js.map +1 -0
  35. package/dist/{chunk-FLJAKWXL.js → chunk-X3E5HXG2.js} +2 -2
  36. package/dist/corrections.d.ts +1 -0
  37. package/dist/corrections.js +84 -0
  38. package/dist/elements.d.ts +1 -399
  39. package/dist/elements.js +6 -5
  40. package/dist/index.d.ts +9 -23
  41. package/dist/index.js +185 -76
  42. package/dist/interactions.d.ts +1 -915
  43. package/dist/interactions.js +19 -15
  44. package/dist/item.css +4118 -1920
  45. package/dist/item.d.ts +1 -134
  46. package/dist/item.js +6 -11
  47. package/dist/loader.d.ts +1 -22
  48. package/dist/loader.js +2 -3
  49. package/dist/processing.d.ts +1 -731
  50. package/dist/processing.js +2 -3
  51. package/dist/qti-components-jsx.d.ts +5220 -2571
  52. package/dist/test.d.ts +1 -539
  53. package/dist/test.js +26 -11
  54. package/dist/transformers.d.ts +1 -18
  55. package/dist/transformers.js +1 -2
  56. package/package.json +19 -15
  57. package/custom-elements.json +0 -43251
  58. package/dist/chunk-3WBG257S.js.map +0 -1
  59. package/dist/chunk-3XV26R5M.js.map +0 -1
  60. package/dist/chunk-AQ5RJFM6.js +0 -3673
  61. package/dist/chunk-AQ5RJFM6.js.map +0 -1
  62. package/dist/chunk-HFCZFWSH.js.map +0 -1
  63. package/dist/chunk-MPC7LIPC.js.map +0 -1
  64. package/dist/chunk-QXBXORM3.js +0 -27
  65. package/dist/chunk-REI3AMCZ.js.map +0 -1
  66. package/dist/chunk-RLTYVS2I.js +0 -530
  67. package/dist/chunk-RLTYVS2I.js.map +0 -1
  68. package/dist/chunk-WDO2TRFM.js.map +0 -1
  69. package/dist/computed-item.context-DfsW_96S.d.ts +0 -22
  70. package/dist/computed.context-DHbxad0N.d.ts +0 -45
  71. package/dist/config.context-BjZ2bZSY.d.ts +0 -42
  72. package/dist/interaction-Bgzlw7Iu.d.ts +0 -110
  73. package/dist/item.context-CkUeDcaO.d.ts +0 -15
  74. package/dist/qti-condition-expression-Dam-RER6.d.ts +0 -26
  75. package/dist/qti-feedback-ChmXhZuf.d.ts +0 -21
  76. package/dist/qti-rule-base-ajOnfGXY.d.ts +0 -16
  77. package/dist/qti-transform-test-DoZaWItm.d.ts +0 -70
  78. package/dist/qti.context-CejJMlfZ.d.ts +0 -50
  79. package/dist/test.context-CByZZjkR.d.ts +0 -15
  80. package/dist/variables-CMYcDbyW.d.ts +0 -70
  81. /package/dist/{chunk-FLJAKWXL.js.map → chunk-X3E5HXG2.js.map} +0 -0
  82. /package/dist/{chunk-QXBXORM3.js.map → corrections.js.map} +0 -0
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  o
3
- } from "./chunk-FLJAKWXL.js";
3
+ } from "./chunk-X3E5HXG2.js";
4
+ import {
5
+ watch
6
+ } from "./chunk-64XSIBGO.js";
4
7
  import {
5
8
  qtiTransformItem
6
- } from "./chunk-3WBG257S.js";
9
+ } from "./chunk-IJD53WY6.js";
7
10
  import {
8
11
  QtiFeedback,
9
12
  QtiVariableDeclaration,
@@ -14,85 +17,79 @@ import {
14
17
  i2,
15
18
  itemContext,
16
19
  itemContextVariables,
17
- n,
18
- r,
19
- t,
20
- watch
21
- } from "./chunk-3XV26R5M.js";
22
- import {
23
- __decorateClass,
24
- __privateAdd,
25
- __privateGet,
26
- __privateMethod,
27
- __privateSet
28
- } from "./chunk-QXBXORM3.js";
20
+ n2 as n,
21
+ r
22
+ } from "./chunk-H3J7LFRO.js";
29
23
 
30
- // ../qti-elements/src/components/qti-assessment-item/qti-assessment-item.ts
31
- var _itemTitle, _templateProcessing, _initialContext, _feedbackElements, _interactionElements, _QtiAssessmentItem_instances, attachEventListeners_fn, removeEventListeners_fn, _handleRegisterVariable, _handleRegisterFeedback, _handleRegisterInteraction, _handleEndAttempt, _handleSetOutcomeValue, _handleSetTemplateValue, _handleSetCorrectResponse, _handleUpdateResponseVariable, processTemplates_fn, getCompletionStatus_fn, resetOutcomeVariablesBeforeResponseProcessing_fn;
24
+ // ../qti-elements/dist/components/qti-assessment-item/qti-assessment-item.js
25
+ var __decorate = function(decorators, target, key, desc) {
26
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
27
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
28
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
29
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
30
+ };
32
31
  var QtiAssessmentItem = class extends i2 {
33
32
  constructor() {
34
33
  super(...arguments);
35
- __privateAdd(this, _QtiAssessmentItem_instances);
36
- __privateAdd(this, _itemTitle);
37
- __privateAdd(this, _templateProcessing, null);
34
+ this.#templateProcessing = null;
38
35
  this.identifier = "";
39
36
  this.adaptive = "false";
40
37
  this.timeDependent = null;
41
38
  this._handleDisabledChange = (_, disabled) => {
42
- __privateGet(this, _interactionElements).forEach((ch) => ch.disabled = disabled);
39
+ this.interactionElements.forEach((ch) => ch.disabled = disabled);
43
40
  };
44
- this._handleReadonlyChange = (_, readonly) => __privateGet(this, _interactionElements).forEach((ch) => ch.readonly = readonly);
41
+ this._handleReadonlyChange = (_, readonly) => this.interactionElements.forEach((ch) => ch.readonly = readonly);
45
42
  this._context = {
46
43
  variables: itemContextVariables
47
44
  };
48
- __privateAdd(this, _initialContext, { ...this._context, variables: this._context.variables });
49
- __privateAdd(this, _feedbackElements, []);
50
- __privateAdd(this, _interactionElements, []);
51
- __privateAdd(this, _handleRegisterVariable, (e2) => {
45
+ this.#initialContext = { ...this._context, variables: this._context.variables };
46
+ this.#feedbackElements = [];
47
+ this.interactionElements = [];
48
+ this.#handleRegisterVariable = (e2) => {
52
49
  e2.stopImmediatePropagation();
53
50
  this._context = { ...this._context, variables: [...this._context.variables, e2.detail.variable] };
54
- __privateSet(this, _initialContext, this._context);
51
+ this.#initialContext = this._context;
55
52
  e2.stopPropagation();
56
- });
57
- __privateAdd(this, _handleRegisterFeedback, (e2) => {
53
+ };
54
+ this.#handleRegisterFeedback = (e2) => {
58
55
  e2.stopImmediatePropagation();
59
56
  const feedbackElement = e2.detail;
60
- __privateGet(this, _feedbackElements).push(feedbackElement);
57
+ this.#feedbackElements.push(feedbackElement);
61
58
  const numAttempts = Number(this._context.variables.find((v) => v.identifier === "numAttempts")?.value) || 0;
62
59
  if (numAttempts > 0) {
63
60
  feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);
64
61
  }
65
- });
66
- __privateAdd(this, _handleRegisterInteraction, (e2) => {
62
+ };
63
+ this.#handleRegisterInteraction = (e2) => {
67
64
  e2.stopImmediatePropagation();
68
- __privateGet(this, _interactionElements).push(e2.detail.interactionElement);
69
- });
70
- __privateAdd(this, _handleEndAttempt, (e2) => {
65
+ this.interactionElements.push(e2.detail.interactionElement);
66
+ };
67
+ this.#handleEndAttempt = (e2) => {
71
68
  e2.stopImmediatePropagation();
72
69
  const { responseIdentifier, countAttempt } = e2.detail;
73
70
  this.validate();
74
71
  this.updateResponseVariable(responseIdentifier, "true");
75
72
  this.processResponse(countAttempt);
76
- });
77
- __privateAdd(this, _handleSetOutcomeValue, (e2) => {
73
+ };
74
+ this.#handleSetOutcomeValue = (e2) => {
78
75
  e2.stopImmediatePropagation();
79
76
  const { outcomeIdentifier, value } = e2.detail;
80
77
  this.updateOutcomeVariable(outcomeIdentifier, value);
81
78
  e2.stopPropagation();
82
- });
83
- __privateAdd(this, _handleSetTemplateValue, (e2) => {
79
+ };
80
+ this.#handleSetTemplateValue = (e2) => {
84
81
  e2.stopImmediatePropagation();
85
82
  const { templateIdentifier, value } = e2.detail;
86
83
  this.updateTemplateVariable(templateIdentifier, value ?? void 0);
87
84
  e2.stopPropagation();
88
- });
89
- __privateAdd(this, _handleSetCorrectResponse, (e2) => {
85
+ };
86
+ this.#handleSetCorrectResponse = (e2) => {
90
87
  e2.stopImmediatePropagation();
91
88
  const { responseIdentifier, value } = e2.detail;
92
89
  this.updateCorrectResponse(responseIdentifier, value ?? void 0);
93
90
  e2.stopPropagation();
94
- });
95
- __privateAdd(this, _handleUpdateResponseVariable, (e2) => {
91
+ };
92
+ this.#handleUpdateResponseVariable = (e2) => {
96
93
  e2.stopImmediatePropagation();
97
94
  const { responseIdentifier, response, state } = e2.detail;
98
95
  this.updateResponseVariable(responseIdentifier, response);
@@ -105,20 +102,20 @@ var QtiAssessmentItem = class extends i2 {
105
102
  }
106
103
  };
107
104
  }
108
- this.dispatchEvent(
109
- new CustomEvent("qti-item-context-updated", {
110
- bubbles: true,
111
- composed: true,
112
- detail: { itemContext: this._context }
113
- })
114
- );
115
- });
105
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
106
+ bubbles: true,
107
+ composed: true,
108
+ detail: { itemContext: this._context }
109
+ }));
110
+ };
116
111
  }
112
+ #itemTitle;
113
+ #templateProcessing;
117
114
  get title() {
118
- return __privateGet(this, _itemTitle);
115
+ return this.#itemTitle;
119
116
  }
120
117
  set title(value) {
121
- __privateSet(this, _itemTitle, value);
118
+ this.#itemTitle = value;
122
119
  this.removeAttribute("title");
123
120
  this.setAttribute("data-title", value);
124
121
  }
@@ -163,9 +160,7 @@ var QtiAssessmentItem = class extends i2 {
163
160
  };
164
161
  this._context.variables.forEach((variable) => {
165
162
  if (variable.type === "response") {
166
- const interactionElement = __privateGet(this, _interactionElements).find(
167
- (el) => el.responseIdentifier === variable.identifier
168
- );
163
+ const interactionElement = this.interactionElements.find((el) => el.responseIdentifier === variable.identifier);
169
164
  if (interactionElement) {
170
165
  interactionElement.response = variable.value;
171
166
  }
@@ -173,7 +168,7 @@ var QtiAssessmentItem = class extends i2 {
173
168
  });
174
169
  this.variables.forEach((variable) => {
175
170
  if (variable.type === "outcome") {
176
- __privateGet(this, _feedbackElements).forEach((fe) => fe.checkShowFeedback(variable.identifier));
171
+ this.#feedbackElements.forEach((fe) => fe.checkShowFeedback(variable.identifier));
177
172
  }
178
173
  });
179
174
  }
@@ -186,6 +181,8 @@ var QtiAssessmentItem = class extends i2 {
186
181
  state: value ? { ...value } : void 0
187
182
  };
188
183
  }
184
+ #initialContext;
185
+ #feedbackElements;
189
186
  /** @deprecated use variables property instead */
190
187
  set responses(myResponses) {
191
188
  if (myResponses) {
@@ -194,9 +191,7 @@ var QtiAssessmentItem = class extends i2 {
194
191
  if (responseVariable) {
195
192
  this.updateResponseVariable(response.responseIdentifier, response.response);
196
193
  }
197
- const interaction = __privateGet(this, _interactionElements).find(
198
- (i3) => i3.getAttribute("response-identifier") === response.responseIdentifier
199
- );
194
+ const interaction = this.interactionElements.find((i3) => i3.getAttribute("response-identifier") === response.responseIdentifier);
200
195
  if (interaction) {
201
196
  interaction.response = response.response;
202
197
  }
@@ -207,57 +202,68 @@ var QtiAssessmentItem = class extends i2 {
207
202
  return T`<slot></slot>`;
208
203
  }
209
204
  connectedCallback() {
210
- __privateMethod(this, _QtiAssessmentItem_instances, attachEventListeners_fn).call(this);
205
+ this.#attachEventListeners();
211
206
  super.connectedCallback();
212
207
  this.updateComplete.then(() => {
213
- this.dispatchEvent(
214
- new CustomEvent("qti-assessment-item-connected", {
215
- bubbles: true,
216
- composed: true,
217
- detail: this
218
- })
219
- );
220
- __privateMethod(this, _QtiAssessmentItem_instances, processTemplates_fn).call(this);
208
+ this.dispatchEvent(new CustomEvent("qti-assessment-item-connected", {
209
+ bubbles: true,
210
+ composed: true,
211
+ detail: this
212
+ }));
213
+ this.#processTemplates();
221
214
  });
222
215
  }
223
216
  disconnectedCallback() {
224
- __privateMethod(this, _QtiAssessmentItem_instances, removeEventListeners_fn).call(this);
217
+ this.#removeEventListeners();
225
218
  super.disconnectedCallback();
226
219
  }
227
- /**
228
- * Toggles the display of correct responses for all interactions.
229
- * @param show - A boolean indicating whether to show or hide correct responses.
230
- */
231
- showCorrectResponse(show) {
232
- for (const interaction of __privateGet(this, _interactionElements)) {
233
- interaction.toggleCorrectResponse(show);
220
+ #attachEventListeners() {
221
+ this.addEventListener("qti-register-variable", this.#handleRegisterVariable);
222
+ this.addEventListener("qti-register-feedback", this.#handleRegisterFeedback);
223
+ this.addEventListener("qti-register-interaction", this.#handleRegisterInteraction);
224
+ this.addEventListener("end-attempt", this.#handleEndAttempt);
225
+ this.addEventListener("qti-set-outcome-value", this.#handleSetOutcomeValue);
226
+ this.addEventListener("qti-set-template-value", this.#handleSetTemplateValue);
227
+ this.addEventListener("qti-set-correct-response", this.#handleSetCorrectResponse);
228
+ this.addEventListener("qti-interaction-response", this.#handleUpdateResponseVariable);
229
+ }
230
+ #removeEventListeners() {
231
+ this.removeEventListener("qti-register-variable", this.#handleRegisterVariable);
232
+ this.removeEventListener("qti-register-feedback", this.#handleRegisterFeedback);
233
+ this.removeEventListener("qti-register-interaction", this.#handleRegisterInteraction);
234
+ this.removeEventListener("end-attempt", this.#handleEndAttempt);
235
+ this.removeEventListener("qti-set-outcome-value", this.#handleSetOutcomeValue);
236
+ this.removeEventListener("qti-set-template-value", this.#handleSetTemplateValue);
237
+ this.removeEventListener("qti-set-correct-response", this.#handleSetCorrectResponse);
238
+ this.removeEventListener("qti-interaction-response", this.#handleUpdateResponseVariable);
239
+ }
240
+ #handleRegisterVariable;
241
+ #handleRegisterFeedback;
242
+ #handleRegisterInteraction;
243
+ #handleEndAttempt;
244
+ #handleSetOutcomeValue;
245
+ #handleSetTemplateValue;
246
+ #handleSetCorrectResponse;
247
+ #handleUpdateResponseVariable;
248
+ async #processTemplates() {
249
+ const templateDeclarations = Array.from(this.querySelectorAll("qti-template-declaration"));
250
+ if (templateDeclarations.length > 0) {
251
+ await Promise.all(templateDeclarations.map((declaration) => declaration.updateComplete));
252
+ await Promise.resolve();
234
253
  }
235
- document.querySelectorAll("item-show-correct-response").forEach((el) => {
236
- el.shown = show;
237
- });
238
- }
239
- /**
240
- * Toggles the display of the candidate correction for all interactions.
241
- * @param show - A boolean indicating whether to show or hide candidate correction.
242
- */
243
- showCandidateCorrection(show) {
244
- for (const interaction of __privateGet(this, _interactionElements)) {
245
- interaction.toggleCandidateCorrection(show);
254
+ this.#templateProcessing = this.querySelector("qti-template-processing");
255
+ if (this.#templateProcessing) {
256
+ this.#templateProcessing.process();
257
+ this.#initialContext = { ...this._context, variables: this._context.variables };
246
258
  }
247
- document.querySelectorAll("item-show-candidate-correction").forEach((el) => {
248
- el.shown = show;
249
- });
250
259
  }
251
260
  processResponse(countNumAttempts = true, reportValidityAfterScoring = true) {
252
261
  this.validate(reportValidityAfterScoring);
253
262
  if (countNumAttempts) {
254
- this.updateOutcomeVariable(
255
- "numAttempts",
256
- (+this._context.variables.find((v) => v.identifier === "numAttempts")?.value + 1).toString()
257
- );
263
+ this.updateOutcomeVariable("numAttempts", (+this._context.variables.find((v) => v.identifier === "numAttempts")?.value + 1).toString());
258
264
  }
259
265
  if (this.adaptive === "false") {
260
- __privateMethod(this, _QtiAssessmentItem_instances, resetOutcomeVariablesBeforeResponseProcessing_fn).call(this);
266
+ this.#resetOutcomeVariablesBeforeResponseProcessing();
261
267
  }
262
268
  const responseProcessor = this.querySelector("qti-response-processing");
263
269
  const canProcess = !!(responseProcessor && typeof responseProcessor.process === "function");
@@ -265,19 +271,17 @@ var QtiAssessmentItem = class extends i2 {
265
271
  responseProcessor.process();
266
272
  }
267
273
  if (this.adaptive === "false") {
268
- this.updateOutcomeVariable("completionStatus", __privateMethod(this, _QtiAssessmentItem_instances, getCompletionStatus_fn).call(this));
274
+ this.updateOutcomeVariable("completionStatus", this.#getCompletionStatus());
269
275
  }
270
- this.dispatchEvent(
271
- new CustomEvent("qti-item-context-updated", {
272
- bubbles: true,
273
- composed: true,
274
- detail: { itemContext: this._context }
275
- })
276
- );
276
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
277
+ bubbles: true,
278
+ composed: true,
279
+ detail: { itemContext: this._context }
280
+ }));
277
281
  return canProcess;
278
282
  }
279
283
  resetResponses() {
280
- this._context = __privateGet(this, _initialContext);
284
+ this._context = this.#initialContext;
281
285
  }
282
286
  getResponse(identifier) {
283
287
  return this.getVariable(identifier);
@@ -288,6 +292,9 @@ var QtiAssessmentItem = class extends i2 {
288
292
  getVariable(identifier) {
289
293
  return this._context.variables.find((v) => v.identifier === identifier) || null;
290
294
  }
295
+ /** Extension point for presentation packages reacting to a candidate response change. */
296
+ afterResponseVariableUpdated() {
297
+ }
291
298
  // saving privates here: ------------------------------------------------------------------------------
292
299
  /**
293
300
  * Updates the response variable with the specified identifier to the given value.
@@ -305,20 +312,18 @@ var QtiAssessmentItem = class extends i2 {
305
312
  ...this._context,
306
313
  variables: this._context.variables.map((v) => v.identifier !== identifier ? v : { ...v, value })
307
314
  };
308
- this.showCandidateCorrection(false);
309
- this.dispatchEvent(
310
- new CustomEvent("qti-interaction-changed", {
311
- bubbles: true,
312
- composed: true,
313
- detail: {
314
- item: this.identifier,
315
- responseIdentifier: identifier,
316
- response: Array.isArray(value) ? [...value] : value
317
- }
318
- })
319
- );
315
+ this.afterResponseVariableUpdated();
316
+ this.dispatchEvent(new CustomEvent("qti-interaction-changed", {
317
+ bubbles: true,
318
+ composed: true,
319
+ detail: {
320
+ item: this.identifier,
321
+ responseIdentifier: identifier,
322
+ response: Array.isArray(value) ? [...value] : value
323
+ }
324
+ }));
320
325
  if (this.adaptive === "false") {
321
- this.updateOutcomeVariable("completionStatus", __privateMethod(this, _QtiAssessmentItem_instances, getCompletionStatus_fn).call(this));
326
+ this.updateOutcomeVariable("completionStatus", this.#getCompletionStatus());
322
327
  }
323
328
  }
324
329
  /**
@@ -333,20 +338,16 @@ var QtiAssessmentItem = class extends i2 {
333
338
  const normalizedValue = templateVariable.cardinality === "single" ? Array.isArray(value) ? value[0] : value ?? null : value === void 0 || value === null ? null : Array.isArray(value) ? value : [value];
334
339
  this._context = {
335
340
  ...this._context,
336
- variables: this._context.variables.map(
337
- (v) => v.identifier !== identifier ? v : {
338
- ...v,
339
- value: normalizedValue
340
- }
341
- )
342
- };
343
- this.dispatchEvent(
344
- new CustomEvent("qti-item-context-updated", {
345
- bubbles: true,
346
- composed: true,
347
- detail: { itemContext: this._context }
341
+ variables: this._context.variables.map((v) => v.identifier !== identifier ? v : {
342
+ ...v,
343
+ value: normalizedValue
348
344
  })
349
- );
345
+ };
346
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
347
+ bubbles: true,
348
+ composed: true,
349
+ detail: { itemContext: this._context }
350
+ }));
350
351
  }
351
352
  /**
352
353
  * Updates the correct response for the specified response variable.
@@ -360,30 +361,24 @@ var QtiAssessmentItem = class extends i2 {
360
361
  const normalizedValue = responseVariable.cardinality === "single" ? Array.isArray(value) ? value[0] : value ?? null : value === void 0 || value === null ? null : Array.isArray(value) ? value : [value];
361
362
  this._context = {
362
363
  ...this._context,
363
- variables: this._context.variables.map(
364
- (v) => v.identifier !== identifier ? v : {
365
- ...v,
366
- correctResponse: normalizedValue
367
- }
368
- )
369
- };
370
- this.dispatchEvent(
371
- new CustomEvent("qti-item-context-updated", {
372
- bubbles: true,
373
- composed: true,
374
- detail: { itemContext: this._context }
364
+ variables: this._context.variables.map((v) => v.identifier !== identifier ? v : {
365
+ ...v,
366
+ correctResponse: normalizedValue
375
367
  })
376
- );
368
+ };
369
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
370
+ bubbles: true,
371
+ composed: true,
372
+ detail: { itemContext: this._context }
373
+ }));
377
374
  }
378
375
  setOutcomeVariable(identifier, value) {
379
376
  this.updateOutcomeVariable(identifier, value);
380
- this.dispatchEvent(
381
- new CustomEvent("qti-item-context-updated", {
382
- bubbles: true,
383
- composed: true,
384
- detail: { itemContext: this._context }
385
- })
386
- );
377
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
378
+ bubbles: true,
379
+ composed: true,
380
+ detail: { itemContext: this._context }
381
+ }));
387
382
  }
388
383
  /**
389
384
  * Updates the outcome variable with the specified identifier to the given value.
@@ -414,145 +409,102 @@ var QtiAssessmentItem = class extends i2 {
414
409
  };
415
410
  })
416
411
  };
417
- __privateGet(this, _feedbackElements).forEach((fe) => fe.checkShowFeedback(identifier));
418
- this.dispatchEvent(
419
- new CustomEvent("qti-outcome-changed", {
420
- bubbles: true,
421
- composed: true,
422
- detail: {
423
- item: this.identifier,
424
- outcomeIdentifier: identifier,
425
- value: this._context.variables.find((v) => v.identifier === identifier)?.value
426
- }
427
- })
428
- );
412
+ this.#feedbackElements.forEach((fe) => fe.checkShowFeedback(identifier));
413
+ this.dispatchEvent(new CustomEvent("qti-outcome-changed", {
414
+ bubbles: true,
415
+ composed: true,
416
+ detail: {
417
+ item: this.identifier,
418
+ outcomeIdentifier: identifier,
419
+ value: this._context.variables.find((v) => v.identifier === identifier)?.value
420
+ }
421
+ }));
429
422
  }
430
423
  validate(reportValidity = true) {
431
- const isValid = __privateGet(this, _interactionElements).every((interactionElement) => interactionElement.validate());
424
+ const isValid = this.interactionElements.every((interactionElement) => interactionElement.validate());
432
425
  if (reportValidity) {
433
426
  this.reportValidity();
434
427
  }
435
428
  return isValid;
436
429
  }
437
430
  reportValidity() {
438
- for (const interactionElement of __privateGet(this, _interactionElements)) {
431
+ for (const interactionElement of this.interactionElements) {
439
432
  interactionElement.reportValidity();
440
433
  }
441
434
  }
442
- };
443
- _itemTitle = new WeakMap();
444
- _templateProcessing = new WeakMap();
445
- _initialContext = new WeakMap();
446
- _feedbackElements = new WeakMap();
447
- _interactionElements = new WeakMap();
448
- _QtiAssessmentItem_instances = new WeakSet();
449
- attachEventListeners_fn = function() {
450
- this.addEventListener("qti-register-variable", __privateGet(this, _handleRegisterVariable));
451
- this.addEventListener("qti-register-feedback", __privateGet(this, _handleRegisterFeedback));
452
- this.addEventListener("qti-register-interaction", __privateGet(this, _handleRegisterInteraction));
453
- this.addEventListener("end-attempt", __privateGet(this, _handleEndAttempt));
454
- this.addEventListener("qti-set-outcome-value", __privateGet(this, _handleSetOutcomeValue));
455
- this.addEventListener("qti-set-template-value", __privateGet(this, _handleSetTemplateValue));
456
- this.addEventListener("qti-set-correct-response", __privateGet(this, _handleSetCorrectResponse));
457
- this.addEventListener("qti-interaction-response", __privateGet(this, _handleUpdateResponseVariable));
458
- };
459
- removeEventListeners_fn = function() {
460
- this.removeEventListener("qti-register-variable", __privateGet(this, _handleRegisterVariable));
461
- this.removeEventListener("qti-register-feedback", __privateGet(this, _handleRegisterFeedback));
462
- this.removeEventListener("qti-register-interaction", __privateGet(this, _handleRegisterInteraction));
463
- this.removeEventListener("end-attempt", __privateGet(this, _handleEndAttempt));
464
- this.removeEventListener("qti-set-outcome-value", __privateGet(this, _handleSetOutcomeValue));
465
- this.removeEventListener("qti-set-template-value", __privateGet(this, _handleSetTemplateValue));
466
- this.removeEventListener("qti-set-correct-response", __privateGet(this, _handleSetCorrectResponse));
467
- this.removeEventListener("qti-interaction-response", __privateGet(this, _handleUpdateResponseVariable));
468
- };
469
- _handleRegisterVariable = new WeakMap();
470
- _handleRegisterFeedback = new WeakMap();
471
- _handleRegisterInteraction = new WeakMap();
472
- _handleEndAttempt = new WeakMap();
473
- _handleSetOutcomeValue = new WeakMap();
474
- _handleSetTemplateValue = new WeakMap();
475
- _handleSetCorrectResponse = new WeakMap();
476
- _handleUpdateResponseVariable = new WeakMap();
477
- processTemplates_fn = async function() {
478
- const templateDeclarations = Array.from(this.querySelectorAll("qti-template-declaration"));
479
- if (templateDeclarations.length > 0) {
480
- await Promise.all(templateDeclarations.map((declaration) => declaration.updateComplete));
481
- await Promise.resolve();
482
- }
483
- __privateSet(this, _templateProcessing, this.querySelector("qti-template-processing"));
484
- if (__privateGet(this, _templateProcessing)) {
485
- __privateGet(this, _templateProcessing).process();
486
- __privateSet(this, _initialContext, { ...this._context, variables: this._context.variables });
435
+ #getCompletionStatus() {
436
+ const valid = this.validate(false);
437
+ if (valid === true)
438
+ return "completed";
439
+ if (valid === false)
440
+ return "incomplete";
441
+ return "not_attempted";
442
+ }
443
+ #resetOutcomeVariablesBeforeResponseProcessing() {
444
+ this._context = {
445
+ ...this._context,
446
+ variables: this._context.variables.map((variable) => {
447
+ if (variable.type !== "outcome") {
448
+ return variable;
449
+ }
450
+ const hasDefaultValue = "defaultValue" in variable;
451
+ const declaredDefault = hasDefaultValue ? variable.defaultValue : null;
452
+ let value = declaredDefault ?? null;
453
+ if ((value === null || value === void 0) && (variable.baseType === "integer" || variable.baseType === "float")) {
454
+ value = "0";
455
+ }
456
+ return {
457
+ ...variable,
458
+ value
459
+ };
460
+ })
461
+ };
487
462
  }
488
463
  };
489
- getCompletionStatus_fn = function() {
490
- const valid = this.validate(false);
491
- if (valid === true) return "completed";
492
- if (valid === false) return "incomplete";
493
- return "not_attempted";
494
- };
495
- resetOutcomeVariablesBeforeResponseProcessing_fn = function() {
496
- this._context = {
497
- ...this._context,
498
- variables: this._context.variables.map((variable) => {
499
- if (variable.type !== "outcome") {
500
- return variable;
501
- }
502
- const hasDefaultValue = "defaultValue" in variable;
503
- const declaredDefault = hasDefaultValue ? variable.defaultValue : null;
504
- let value = declaredDefault ?? null;
505
- if ((value === null || value === void 0) && (variable.baseType === "integer" || variable.baseType === "float")) {
506
- value = "0";
507
- }
508
- return {
509
- ...variable,
510
- value
511
- };
512
- })
513
- };
514
- };
515
- __decorateClass([
464
+ __decorate([
516
465
  n({ type: String })
517
- ], QtiAssessmentItem.prototype, "identifier", 2);
518
- __decorateClass([
466
+ ], QtiAssessmentItem.prototype, "identifier", void 0);
467
+ __decorate([
519
468
  n({ type: String })
520
- ], QtiAssessmentItem.prototype, "adaptive", 2);
521
- __decorateClass([
469
+ ], QtiAssessmentItem.prototype, "adaptive", void 0);
470
+ __decorate([
522
471
  n({ type: String })
523
- ], QtiAssessmentItem.prototype, "timeDependent", 2);
524
- __decorateClass([
472
+ ], QtiAssessmentItem.prototype, "timeDependent", void 0);
473
+ __decorate([
525
474
  n({ type: String })
526
- ], QtiAssessmentItem.prototype, "title", 1);
527
- __decorateClass([
475
+ ], QtiAssessmentItem.prototype, "title", null);
476
+ __decorate([
528
477
  n({ type: Boolean })
529
- ], QtiAssessmentItem.prototype, "disabled", 2);
530
- __decorateClass([
478
+ ], QtiAssessmentItem.prototype, "disabled", void 0);
479
+ __decorate([
531
480
  watch("disabled", { waitUntilFirstUpdate: true })
532
- ], QtiAssessmentItem.prototype, "_handleDisabledChange", 2);
533
- __decorateClass([
481
+ ], QtiAssessmentItem.prototype, "_handleDisabledChange", void 0);
482
+ __decorate([
534
483
  n({ type: Boolean })
535
- ], QtiAssessmentItem.prototype, "readonly", 2);
536
- __decorateClass([
484
+ ], QtiAssessmentItem.prototype, "readonly", void 0);
485
+ __decorate([
537
486
  watch("readonly", { waitUntilFirstUpdate: true })
538
- ], QtiAssessmentItem.prototype, "_handleReadonlyChange", 2);
539
- __decorateClass([
487
+ ], QtiAssessmentItem.prototype, "_handleReadonlyChange", void 0);
488
+ __decorate([
540
489
  e({ context: itemContext })
541
- ], QtiAssessmentItem.prototype, "_context", 2);
542
- QtiAssessmentItem = __decorateClass([
543
- t("qti-assessment-item")
544
- ], QtiAssessmentItem);
490
+ ], QtiAssessmentItem.prototype, "_context", void 0);
545
491
 
546
- // ../qti-elements/src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts
492
+ // ../qti-elements/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js
493
+ var __decorate2 = function(decorators, target, key, desc) {
494
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
495
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
496
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
497
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
498
+ };
547
499
  var QtiAssessmentStimulusRefConnectedEvent = class _QtiAssessmentStimulusRefConnectedEvent extends Event {
500
+ static {
501
+ this.eventName = "qti-assessment-stimulus-ref-connected";
502
+ }
548
503
  constructor(element, item) {
549
504
  super(_QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });
550
505
  this.element = element;
551
506
  this.item = item;
552
507
  }
553
- static {
554
- this.eventName = "qti-assessment-stimulus-ref-connected";
555
- }
556
508
  };
557
509
  var QtiAssessmentStimulusRef = class extends i2 {
558
510
  constructor() {
@@ -589,48 +541,130 @@ var QtiAssessmentStimulusRef = class extends i2 {
589
541
  }
590
542
  }
591
543
  };
592
- __decorateClass([
544
+ __decorate2([
593
545
  n({ type: String })
594
- ], QtiAssessmentStimulusRef.prototype, "identifier", 2);
595
- __decorateClass([
546
+ ], QtiAssessmentStimulusRef.prototype, "identifier", void 0);
547
+ __decorate2([
596
548
  n({ type: String })
597
- ], QtiAssessmentStimulusRef.prototype, "href", 2);
598
- QtiAssessmentStimulusRef = __decorateClass([
599
- t("qti-assessment-stimulus-ref")
600
- ], QtiAssessmentStimulusRef);
549
+ ], QtiAssessmentStimulusRef.prototype, "href", void 0);
601
550
 
602
- // ../qti-elements/src/components/qti-companion-materials-info/qti-companion-materials-info.ts
551
+ // ../qti-elements/dist/components/qti-companion-materials-info/qti-companion-materials-info.js
603
552
  var QtiCompanionMaterialsInfo = class extends i2 {
604
- // static override styles = css`
605
- // slot {
606
- // display: hidden;
607
- // }
608
- // `;
609
- // override render() {
610
- // return html` <slot></slot> `;
611
- // }
612
553
  };
613
- QtiCompanionMaterialsInfo = __decorateClass([
614
- t("qti-companion-materials-info")
615
- ], QtiCompanionMaterialsInfo);
616
554
 
617
- // ../qti-elements/src/components/qti-custom-operator/qti-custom-operator.ts
618
- var _operatorFunction;
619
- var QtiCustomOperator = class extends i2 {
555
+ // ../qti-elements/dist/components/qti-content-body/qti-content-body.js
556
+ var __decorate3 = function(decorators, target, key, desc) {
557
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
558
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
559
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
560
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
561
+ };
562
+ var QtiContentBody = class extends i2 {
563
+ render() {
564
+ return T`<slot @slotchange=${this.#expandMathVariables}></slot>`;
565
+ }
566
+ connectedCallback() {
567
+ super.connectedCallback();
568
+ this.updateComplete.then(() => this.#expandMathVariables());
569
+ }
570
+ updated(changedProperties) {
571
+ if (changedProperties.has("context")) {
572
+ this.#expandMathVariables();
573
+ }
574
+ }
575
+ #expandMathVariables() {
576
+ const mathVariables = /* @__PURE__ */ new Map();
577
+ const templateVariables = (this.context?.variables ?? []).filter((variable) => variable.type === "template");
578
+ for (const variable of templateVariables) {
579
+ const templateVariable = variable;
580
+ if (templateVariable.mathVariable !== true || templateVariable.value === null || templateVariable.value === void 0) {
581
+ continue;
582
+ }
583
+ mathVariables.set(templateVariable.identifier, this.#stringifyValue(templateVariable.value));
584
+ }
585
+ if (mathVariables.size === 0) {
586
+ return;
587
+ }
588
+ const mathIdentifiers = Array.from(this.querySelectorAll("*")).filter((element) => element.localName.toLowerCase() === "mi" || element.localName.toLowerCase() === "mn");
589
+ for (const element of mathIdentifiers) {
590
+ const identifier = element.getAttribute("data-qti-math-variable-source") ?? element.textContent?.trim() ?? "";
591
+ const value = mathVariables.get(identifier);
592
+ if (!value) {
593
+ continue;
594
+ }
595
+ if (element.localName.toLowerCase() === "mn") {
596
+ element.textContent = value;
597
+ element.setAttribute("data-qti-math-variable-source", identifier);
598
+ continue;
599
+ }
600
+ const replacement = document.createElement("mn");
601
+ replacement.textContent = value;
602
+ replacement.setAttribute("data-qti-math-variable-source", identifier);
603
+ element.replaceWith(replacement);
604
+ }
605
+ }
606
+ #stringifyValue(value) {
607
+ if (Array.isArray(value)) {
608
+ return value.join(" ");
609
+ }
610
+ return value?.toString() ?? "";
611
+ }
612
+ };
613
+ __decorate3([
614
+ c({ context: itemContext, subscribe: true }),
615
+ r()
616
+ ], QtiContentBody.prototype, "context", void 0);
617
+
618
+ // ../qti-elements/dist/components/qti-context-declaration/qti-context-declaration.js
619
+ var __decorate4 = function(decorators, target, key, desc) {
620
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
621
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
622
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
623
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
624
+ };
625
+ var QtiContextDeclaration = class extends i2 {
620
626
  constructor() {
621
627
  super(...arguments);
622
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
623
- __privateAdd(this, _operatorFunction);
628
+ this.identifier = "";
629
+ this.cardinality = "record";
630
+ }
631
+ static {
632
+ this.styles = [
633
+ i`
634
+ :host {
635
+ display: none;
636
+ }
637
+ `
638
+ ];
639
+ }
640
+ render() {
641
+ return T`<slot></slot>`;
624
642
  }
643
+ };
644
+ __decorate4([
645
+ n({ type: String })
646
+ ], QtiContextDeclaration.prototype, "identifier", void 0);
647
+ __decorate4([
648
+ n({ type: String })
649
+ ], QtiContextDeclaration.prototype, "cardinality", void 0);
650
+
651
+ // ../qti-elements/dist/components/qti-custom-operator/qti-custom-operator.js
652
+ var __decorate5 = function(decorators, target, key, desc) {
653
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
654
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
655
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
656
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
657
+ };
658
+ var QtiCustomOperator = class extends i2 {
659
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
660
+ #operatorFunction;
625
661
  render() {
626
662
  return T`<slot @slotchange=${this.handleSlotChange}></slot>`;
627
663
  }
628
664
  handleSlotChange() {
629
- const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find(
630
- (node) => node.nodeType === Node.COMMENT_NODE
631
- );
665
+ const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find((node) => node.nodeType === Node.COMMENT_NODE);
632
666
  try {
633
- __privateSet(this, _operatorFunction, new Function("context", "fn", "item", commentNode?.textContent ?? ""));
667
+ this.#operatorFunction = new Function("context", "fn", "item", commentNode?.textContent ?? "");
634
668
  } catch (e2) {
635
669
  console.error("custom-operator contains invalid javascript code", e2);
636
670
  }
@@ -643,53 +677,38 @@ var QtiCustomOperator = class extends i2 {
643
677
  const item = {
644
678
  getVariable: (variableIdentifier) => this._context?.variables.find((v) => v.identifier === variableIdentifier),
645
679
  updateOutcomeVariable: (outcomeIdentifier, value) => {
646
- this.dispatchEvent(
647
- new CustomEvent("qti-set-outcome-value", {
648
- bubbles: true,
649
- composed: true,
650
- detail: {
651
- outcomeIdentifier,
652
- value
653
- }
654
- })
655
- );
680
+ this.dispatchEvent(new CustomEvent("qti-set-outcome-value", {
681
+ bubbles: true,
682
+ composed: true,
683
+ detail: {
684
+ outcomeIdentifier,
685
+ value
686
+ }
687
+ }));
656
688
  },
657
689
  updateResponseVariable: (responseIdentifier, response) => {
658
- this.dispatchEvent(
659
- new CustomEvent("qti-interaction-response", {
660
- bubbles: true,
661
- composed: true,
662
- detail: {
663
- responseIdentifier,
664
- response
665
- }
666
- })
667
- );
690
+ this.dispatchEvent(new CustomEvent("qti-interaction-response", {
691
+ bubbles: true,
692
+ composed: true,
693
+ detail: {
694
+ responseIdentifier,
695
+ response
696
+ }
697
+ }));
668
698
  }
669
699
  };
670
- return __privateGet(this, _operatorFunction).call(this, this._context, fn, item);
700
+ return this.#operatorFunction(this._context, fn, item);
671
701
  }
672
702
  };
673
- _operatorFunction = new WeakMap();
674
- __decorateClass([
703
+ __decorate5([
675
704
  c({ context: itemContext, subscribe: true }),
676
705
  r()
677
- ], QtiCustomOperator.prototype, "_context", 2);
678
- QtiCustomOperator = __decorateClass([
679
- t("qti-custom-operator")
680
- ], QtiCustomOperator);
706
+ ], QtiCustomOperator.prototype, "_context", void 0);
681
707
 
682
- // ../qti-elements/src/components/qti-feedback-block/qti-feedback-block.ts
708
+ // ../qti-elements/dist/components/qti-feedback-block/qti-feedback-block.js
683
709
  var QtiFeedbackBlock = class extends QtiFeedback {
684
- render() {
685
- return T` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `;
686
- }
687
- connectedCallback() {
688
- super.connectedCallback();
689
- this.checkShowFeedback(this.outcomeIdentifier);
690
- }
691
- };
692
- QtiFeedbackBlock.styles = i`
710
+ static {
711
+ this.styles = i`
693
712
  :host {
694
713
  display: block;
695
714
  }
@@ -700,22 +719,24 @@ QtiFeedbackBlock.styles = i`
700
719
  display: none;
701
720
  }
702
721
  `;
703
- QtiFeedbackBlock = __decorateClass([
704
- t("qti-feedback-block")
705
- ], QtiFeedbackBlock);
706
-
707
- // ../qti-elements/src/components/qti-feedback-inline/qti-feedback-inline.ts
708
- var QtiFeedbackInline = class extends QtiFeedback {
709
- constructor() {
710
- super(...arguments);
711
- this.render = () => T` <slot part="feedback" class="${o(this.showStatus)}"></slot> `;
722
+ }
723
+ render() {
724
+ return T` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `;
712
725
  }
713
726
  connectedCallback() {
714
727
  super.connectedCallback();
715
728
  this.checkShowFeedback(this.outcomeIdentifier);
716
729
  }
717
730
  };
718
- QtiFeedbackInline.styles = i`
731
+
732
+ // ../qti-elements/dist/components/qti-feedback-inline/qti-feedback-inline.js
733
+ var QtiFeedbackInline = class extends QtiFeedback {
734
+ constructor() {
735
+ super(...arguments);
736
+ this.render = () => T` <slot part="feedback" class="${o(this.showStatus)}"></slot> `;
737
+ }
738
+ static {
739
+ this.styles = i`
719
740
  .on {
720
741
  display: inline-block;
721
742
  }
@@ -723,17 +744,78 @@ QtiFeedbackInline.styles = i`
723
744
  display: none;
724
745
  }
725
746
  `;
726
- QtiFeedbackInline = __decorateClass([
727
- t("qti-feedback-inline")
728
- ], QtiFeedbackInline);
747
+ }
748
+ connectedCallback() {
749
+ super.connectedCallback();
750
+ this.checkShowFeedback(this.outcomeIdentifier);
751
+ }
752
+ };
753
+
754
+ // ../qti-elements/dist/components/qti-item-body/qti-item-body.styles.js
755
+ var qti_item_body_styles_default = i`
756
+ :host {
757
+ display: block;
758
+ }
759
+ `;
760
+
761
+ // ../qti-elements/dist/components/qti-item-body/qti-item-body.js
762
+ var QtiItemBody = class extends i2 {
763
+ static {
764
+ this.styles = qti_item_body_styles_default;
765
+ }
766
+ render() {
767
+ return T`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
768
+ }
769
+ };
729
770
 
730
- // ../qti-elements/src/components/qti-modal-feedback/qti-modal-feedback.ts
771
+ // ../qti-elements/dist/components/qti-modal-feedback/qti-modal-feedback.js
731
772
  var QtiModalFeedback = class extends QtiFeedback {
773
+ static {
774
+ this.styles = i`
775
+ .cito-dialog {
776
+ background: var(--qti-bg);
777
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
778
+ border-radius: var(--qti-border-radius);
779
+ padding: var(--qti-padding-box);
780
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
781
+ position: fixed;
782
+ top: 50%;
783
+ left: 50%;
784
+ transform: translate(-50%, -50%);
785
+ z-index: 1000;
786
+ width: auto;
787
+ max-width: 90%;
788
+ }
789
+
790
+ .button {
791
+ border-radius: var(--qti-border-radius);
792
+ padding: var(--qti-padding-box);
793
+ background-color: var(--qti-bg-active);
794
+ border: var(--qti-border-active);
795
+ cursor: pointer;
796
+ position: relative;
797
+ display: inline-block;
798
+ }
799
+
800
+ /* Inlined from --qti-disabled-bg / --qti-disabled-color, which this button was the only reader
801
+ of anywhere in the repo. They were named as a global disabled vocabulary but no interaction
802
+ ever used them: the theme's disabled treatment is cursor only (see the note in qti-mixins.css). */
803
+ .button:disabled {
804
+ background-color: transparent;
805
+ color: var(--qti-fg);
806
+ cursor: not-allowed;
807
+ }
808
+
809
+ .button:focus {
810
+ outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
811
+ }
812
+ `;
813
+ }
732
814
  render() {
733
815
  return T`
734
- <dialog class="qti-dialog" part="feedback" ?open="${this.showStatus === "on"}">
816
+ <dialog class="cito-dialog" part="feedback" ?open="${this.showStatus === "on"}">
735
817
  <slot></slot>
736
- <div style="margin-top: var(--qti-gap-size); text-align: center;">
818
+ <div style="margin-top: var(--qti-gap); text-align: center;">
737
819
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
738
820
  </div>
739
821
  </dialog>
@@ -768,369 +850,27 @@ var QtiModalFeedback = class extends QtiFeedback {
768
850
  }
769
851
  }
770
852
  };
771
- QtiModalFeedback.styles = i`
772
- .qti-dialog {
773
- background: var(--qti-bg);
774
- border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
775
- border-radius: var(--qti-border-radius);
776
- padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
777
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
778
- position: fixed;
779
- top: 50%;
780
- left: 50%;
781
- transform: translate(-50%, -50%);
782
- z-index: 1000;
783
- width: auto;
784
- max-width: 90%;
785
- }
786
853
 
787
- .button {
788
- border-radius: var(--qti-border-radius);
789
- padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
790
- background-color: var(--qti-bg-active);
791
- border: var(--qti-border-active);
792
- cursor: pointer;
793
- position: relative;
794
- display: inline-block;
795
- }
796
-
797
- .button:hover {
798
- background-color: var(--qti-hover-bg);
799
- }
800
-
801
- .button:disabled {
802
- background-color: var(--qti-disabled-bg);
803
- color: var(--qti-disabled-color);
804
- cursor: not-allowed;
805
- }
806
-
807
- .button:focus {
808
- outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
809
- }
810
- `;
811
- QtiModalFeedback = __decorateClass([
812
- t("qti-modal-feedback")
813
- ], QtiModalFeedback);
814
-
815
- // ../qti-elements/src/components/qti-item-body/qti-item-body.styles.ts
816
- var qti_item_body_styles_default = i`
817
- :host {
818
- display: block;
819
- }
820
- `;
821
-
822
- // ../qti-elements/src/components/qti-item-body/qti-item-body.ts
823
- var QtiItemBody = class extends i2 {
824
- render() {
825
- return T`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
826
- }
827
- };
828
- QtiItemBody.styles = qti_item_body_styles_default;
829
- QtiItemBody = __decorateClass([
830
- t("qti-item-body")
831
- ], QtiItemBody);
832
-
833
- // ../qti-elements/src/components/qti-content-body/qti-content-body.ts
834
- var _QtiContentBody_instances, expandMathVariables_fn, stringifyValue_fn;
835
- var QtiContentBody = class extends i2 {
836
- constructor() {
837
- super(...arguments);
838
- __privateAdd(this, _QtiContentBody_instances);
839
- }
840
- render() {
841
- return T`<slot @slotchange=${__privateMethod(this, _QtiContentBody_instances, expandMathVariables_fn)}></slot>`;
842
- }
843
- connectedCallback() {
844
- super.connectedCallback();
845
- this.updateComplete.then(() => __privateMethod(this, _QtiContentBody_instances, expandMathVariables_fn).call(this));
846
- }
847
- updated(changedProperties) {
848
- if (changedProperties.has("context")) {
849
- __privateMethod(this, _QtiContentBody_instances, expandMathVariables_fn).call(this);
850
- }
851
- }
852
- };
853
- _QtiContentBody_instances = new WeakSet();
854
- expandMathVariables_fn = function() {
855
- const mathVariables = /* @__PURE__ */ new Map();
856
- const templateVariables = (this.context?.variables ?? []).filter((variable) => variable.type === "template");
857
- for (const variable of templateVariables) {
858
- const templateVariable = variable;
859
- if (templateVariable.mathVariable !== true || templateVariable.value === null || templateVariable.value === void 0) {
860
- continue;
861
- }
862
- mathVariables.set(templateVariable.identifier, __privateMethod(this, _QtiContentBody_instances, stringifyValue_fn).call(this, templateVariable.value));
863
- }
864
- if (mathVariables.size === 0) {
865
- return;
866
- }
867
- const mathIdentifiers = Array.from(this.querySelectorAll("*")).filter(
868
- (element) => element.localName.toLowerCase() === "mi" || element.localName.toLowerCase() === "mn"
869
- );
870
- for (const element of mathIdentifiers) {
871
- const identifier = element.getAttribute("data-qti-math-variable-source") ?? element.textContent?.trim() ?? "";
872
- const value = mathVariables.get(identifier);
873
- if (!value) {
874
- continue;
875
- }
876
- if (element.localName.toLowerCase() === "mn") {
877
- element.textContent = value;
878
- element.setAttribute("data-qti-math-variable-source", identifier);
879
- continue;
880
- }
881
- const replacement = document.createElement("mn");
882
- replacement.textContent = value;
883
- replacement.setAttribute("data-qti-math-variable-source", identifier);
884
- element.replaceWith(replacement);
885
- }
886
- };
887
- stringifyValue_fn = function(value) {
888
- if (Array.isArray(value)) {
889
- return value.join(" ");
890
- }
891
- return value?.toString() ?? "";
892
- };
893
- __decorateClass([
894
- c({ context: itemContext, subscribe: true }),
895
- r()
896
- ], QtiContentBody.prototype, "context", 2);
897
- QtiContentBody = __decorateClass([
898
- t("qti-content-body")
899
- ], QtiContentBody);
900
-
901
- // ../qti-elements/src/components/qti-rubric-block/qti-rubric-block.ts
902
- var QtiRubricBlock = class extends i2 {
903
- handleclassNamesChange() {
904
- const classNames = this.classNames.split(" ");
905
- classNames.forEach((className) => {
906
- switch (className) {
907
- case "qti-rubric-discretionary-placement":
908
- {
909
- const event = new CustomEvent("qti-rubric:discretionary-placement", {
910
- detail: { className, element: this },
911
- bubbles: true,
912
- composed: true,
913
- cancelable: true
914
- });
915
- const notCancelled = this.dispatchEvent(event);
916
- if (!notCancelled) return;
917
- this.setAttribute("slot", "qti-rubric-block");
918
- }
919
- break;
920
- case "qti-rubric-inline":
921
- this.setAttribute("slot", "");
922
- break;
923
- default:
924
- break;
925
- }
926
- });
927
- }
928
- render() {
929
- return T`<slot></slot>`;
930
- }
931
- };
932
- QtiRubricBlock.styles = i`
933
- :host {
934
- display: block;
935
- }
936
- `;
937
- __decorateClass([
938
- n({ type: String })
939
- ], QtiRubricBlock.prototype, "id", 2);
940
- __decorateClass([
941
- n({ type: String })
942
- ], QtiRubricBlock.prototype, "use", 2);
943
- __decorateClass([
944
- n({ type: String })
945
- ], QtiRubricBlock.prototype, "view", 2);
946
- __decorateClass([
947
- n({ type: String, attribute: "class" })
948
- ], QtiRubricBlock.prototype, "classNames", 2);
949
- __decorateClass([
950
- watch("classNames", { waitUntilFirstUpdate: true })
951
- ], QtiRubricBlock.prototype, "handleclassNamesChange", 1);
952
- QtiRubricBlock = __decorateClass([
953
- t("qti-rubric-block")
954
- ], QtiRubricBlock);
955
-
956
- // ../qti-elements/src/components/qti-stylesheet/qti-stylesheet.ts
957
- var _styleElement, _QtiStylesheet_instances, minifyCss_fn;
958
- var QtiStylesheet = class extends i2 {
959
- constructor() {
960
- super(...arguments);
961
- __privateAdd(this, _QtiStylesheet_instances);
962
- __privateAdd(this, _styleElement, null);
963
- }
964
- firstUpdated(_changedProperties) {
965
- super.firstUpdated(_changedProperties);
966
- const link = this.getAttribute("href");
967
- if (link !== null) {
968
- fetch(link).then((response) => response.text()).then((cssContent) => {
969
- const minifiedCss = __privateMethod(this, _QtiStylesheet_instances, minifyCss_fn).call(this, cssContent);
970
- __privateSet(this, _styleElement, document.createElement("style"));
971
- __privateGet(this, _styleElement).media = "screen";
972
- __privateGet(this, _styleElement).textContent = `@scope {${minifiedCss}}`;
973
- if (this.parentElement) {
974
- this.parentElement.appendChild(__privateGet(this, _styleElement));
975
- } else {
976
- console.warn("No parent element to append the scoped stylesheet to.");
977
- }
978
- }).catch((error) => {
979
- console.error("Failed to load stylesheet:", error);
980
- });
981
- }
982
- if (this.textContent !== null && this.textContent.trim() !== "") {
983
- const minifiedCss = __privateMethod(this, _QtiStylesheet_instances, minifyCss_fn).call(this, this.textContent);
984
- __privateSet(this, _styleElement, document.createElement("style"));
985
- __privateGet(this, _styleElement).media = "screen";
986
- __privateGet(this, _styleElement).textContent = `@scope {${minifiedCss}}`;
987
- if (this.parentElement) {
988
- this.parentElement.appendChild(__privateGet(this, _styleElement));
989
- } else {
990
- console.warn("No parent element to append the scoped stylesheet to.");
991
- }
992
- }
993
- }
994
- disconnectedCallback() {
995
- if (__privateGet(this, _styleElement)) {
996
- try {
997
- __privateGet(this, _styleElement).remove();
998
- } catch (error) {
999
- console.error("Could not remove stylesheet:", error);
1000
- }
1001
- }
1002
- super.disconnectedCallback();
1003
- }
854
+ // ../qti-elements/dist/components/qti-outcome-declaration/qti-outcome-declaration.js
855
+ var __decorate6 = function(decorators, target, key, desc) {
856
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
857
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
858
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
859
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1004
860
  };
1005
- _styleElement = new WeakMap();
1006
- _QtiStylesheet_instances = new WeakSet();
1007
- minifyCss_fn = function(cssContent) {
1008
- return cssContent.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;])\s*/g, "$1").trim();
1009
- };
1010
- QtiStylesheet = __decorateClass([
1011
- t("qti-stylesheet")
1012
- ], QtiStylesheet);
1013
-
1014
- // ../qti-elements/src/components/qti-response-declaration/qti-response-declaration.ts
1015
- var _QtiResponseDeclaration_instances, correctResponse_get, mapping_get, areaMapping_get;
1016
- var QtiResponseDeclaration = class extends QtiVariableDeclaration {
861
+ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
1017
862
  constructor() {
1018
863
  super(...arguments);
1019
- __privateAdd(this, _QtiResponseDeclaration_instances);
1020
- }
1021
- render() {
1022
- const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
1023
- return T`${JSON.stringify(value, null, 2)}`;
1024
- }
1025
- connectedCallback() {
1026
- super.connectedCallback();
1027
- const defaultValue = this.defaultValues(this.cardinality);
1028
- const responseVariable = {
1029
- baseType: this.baseType,
1030
- identifier: this.identifier,
1031
- correctResponse: __privateGet(this, _QtiResponseDeclaration_instances, correctResponse_get),
1032
- cardinality: this.cardinality || "single",
1033
- mapping: __privateGet(this, _QtiResponseDeclaration_instances, mapping_get),
1034
- defaultValue,
1035
- areaMapping: __privateGet(this, _QtiResponseDeclaration_instances, areaMapping_get),
1036
- value: null,
1037
- type: "response",
1038
- candidateResponse: null
1039
- };
1040
- responseVariable.value = defaultValue;
1041
- this.dispatchEvent(
1042
- new CustomEvent("qti-register-variable", {
1043
- bubbles: true,
1044
- composed: true,
1045
- detail: { variable: responseVariable }
1046
- })
1047
- );
1048
- }
1049
- };
1050
- _QtiResponseDeclaration_instances = new WeakSet();
1051
- correctResponse_get = function() {
1052
- let result;
1053
- const correctResponse = this.querySelector("qti-correct-response");
1054
- if (correctResponse) {
1055
- const values = correctResponse.querySelectorAll("qti-value");
1056
- if (this.cardinality === "single" && values.length > 0) {
1057
- result = values[0].textContent.trim();
1058
- values[0].remove();
1059
- } else if (this.cardinality !== "single") {
1060
- result = [];
1061
- for (let i3 = 0; i3 < values.length; i3++) {
1062
- result.push(values[i3].textContent.trim());
1063
- values[i3].remove();
1064
- }
1065
- }
864
+ this.externalScored = null;
1066
865
  }
1067
- return result;
1068
- };
1069
- mapping_get = function() {
1070
- const mappingElement = this.querySelector("qti-mapping");
1071
- const lowerBound = parseFloat(mappingElement?.getAttribute("lower-bound"));
1072
- const uppperBound = parseFloat(mappingElement?.getAttribute("upper-bound"));
1073
- const mappingValue = {
1074
- defaultValue: Number(mappingElement?.getAttribute("default-value")) || 0,
1075
- lowerBound: isNaN(lowerBound) ? null : lowerBound,
1076
- upperBound: isNaN(uppperBound) ? null : uppperBound,
1077
- mapEntries: Array.from(mappingElement?.querySelectorAll("qti-map-entry") || []).map((el) => ({
1078
- mapKey: el.getAttribute("map-key") || "",
1079
- mappedValue: Number(el.getAttribute("mapped-value")) || 0,
1080
- caseSensitive: el.hasAttribute("case-sensitive") ? el.getAttribute("case-sensitive") !== "false" : false
1081
- }))
1082
- };
1083
- return mappingValue;
1084
- };
1085
- areaMapping_get = function() {
1086
- const areaMappingElement = this.querySelector("qti-area-mapping");
1087
- const defaultValue = Number(areaMappingElement?.getAttribute("default-value")) || 0;
1088
- const lowerBound = parseFloat(areaMappingElement?.getAttribute("lower-bound"));
1089
- const uppperBound = parseFloat(areaMappingElement?.getAttribute("upper-bound"));
1090
- const areaMapEntries = Array.from(areaMappingElement?.querySelectorAll("qti-area-map-entry") || []).map(
1091
- (el) => ({
1092
- shape: el.getAttribute("shape") || "default",
1093
- coords: el.getAttribute("coords") || "",
1094
- mappedValue: Number(el.getAttribute("mapped-value")) || 0,
1095
- defaultValue: Number(el.getAttribute("default-value")) || 0
1096
- })
1097
- );
1098
- return {
1099
- defaultValue,
1100
- lowerBound: isNaN(lowerBound) ? null : lowerBound,
1101
- upperBound: isNaN(uppperBound) ? null : uppperBound,
1102
- areaMapEntries
1103
- };
1104
- };
1105
- QtiResponseDeclaration.styles = [
1106
- i`
866
+ static {
867
+ this.styles = [
868
+ i`
1107
869
  :host {
1108
870
  display: none;
1109
871
  }
1110
872
  `
1111
- ];
1112
- __decorateClass([
1113
- n({ type: String, attribute: "base-type" })
1114
- ], QtiResponseDeclaration.prototype, "baseType", 2);
1115
- __decorateClass([
1116
- n({ type: String })
1117
- ], QtiResponseDeclaration.prototype, "identifier", 2);
1118
- __decorateClass([
1119
- n({ type: String })
1120
- ], QtiResponseDeclaration.prototype, "cardinality", 2);
1121
- __decorateClass([
1122
- c({ context: itemContext, subscribe: true }),
1123
- r()
1124
- ], QtiResponseDeclaration.prototype, "itemContext", 2);
1125
- QtiResponseDeclaration = __decorateClass([
1126
- t("qti-response-declaration")
1127
- ], QtiResponseDeclaration);
1128
-
1129
- // ../qti-elements/src/components/qti-outcome-declaration/qti-outcome-declaration.ts
1130
- var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
1131
- constructor() {
1132
- super(...arguments);
1133
- this.externalScored = null;
873
+ ];
1134
874
  }
1135
875
  render() {
1136
876
  const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
@@ -1172,43 +912,141 @@ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
1172
912
  if ((outcomeVariable.value === null || outcomeVariable.value == void 0) && (outcomeVariable.baseType === "integer" || outcomeVariable.baseType === "float")) {
1173
913
  outcomeVariable.value = "0";
1174
914
  }
1175
- this.dispatchEvent(
1176
- new CustomEvent("qti-register-variable", {
1177
- bubbles: true,
1178
- composed: true,
1179
- detail: { variable: outcomeVariable }
1180
- })
1181
- );
915
+ this.dispatchEvent(new CustomEvent("qti-register-variable", {
916
+ bubbles: true,
917
+ composed: true,
918
+ detail: { variable: outcomeVariable }
919
+ }));
1182
920
  }
1183
921
  };
1184
- QtiOutcomeDeclaration.styles = [
1185
- i`
922
+ __decorate6([
923
+ n({ type: String, attribute: "base-type" })
924
+ ], QtiOutcomeDeclaration.prototype, "baseType", void 0);
925
+ __decorate6([
926
+ n({ type: String, attribute: "external-scored" })
927
+ ], QtiOutcomeDeclaration.prototype, "externalScored", void 0);
928
+ __decorate6([
929
+ n({ type: String })
930
+ ], QtiOutcomeDeclaration.prototype, "identifier", void 0);
931
+ __decorate6([
932
+ n({ type: String })
933
+ ], QtiOutcomeDeclaration.prototype, "cardinality", void 0);
934
+ __decorate6([
935
+ c({ context: itemContext, subscribe: true }),
936
+ r()
937
+ ], QtiOutcomeDeclaration.prototype, "itemContext", void 0);
938
+
939
+ // ../qti-elements/dist/components/qti-response-declaration/qti-response-declaration.js
940
+ var __decorate7 = function(decorators, target, key, desc) {
941
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
942
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
943
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
944
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
945
+ };
946
+ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
947
+ static {
948
+ this.styles = [
949
+ i`
1186
950
  :host {
1187
951
  display: none;
1188
952
  }
1189
953
  `
1190
- ];
1191
- __decorateClass([
954
+ ];
955
+ }
956
+ render() {
957
+ const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
958
+ return T`${JSON.stringify(value, null, 2)}`;
959
+ }
960
+ connectedCallback() {
961
+ super.connectedCallback();
962
+ const defaultValue = this.defaultValues(this.cardinality);
963
+ const responseVariable = {
964
+ baseType: this.baseType,
965
+ identifier: this.identifier,
966
+ correctResponse: this.#correctResponse,
967
+ cardinality: this.cardinality || "single",
968
+ mapping: this.#mapping,
969
+ defaultValue,
970
+ areaMapping: this.#areaMapping,
971
+ value: null,
972
+ type: "response",
973
+ candidateResponse: null
974
+ };
975
+ responseVariable.value = defaultValue;
976
+ this.dispatchEvent(new CustomEvent("qti-register-variable", {
977
+ bubbles: true,
978
+ composed: true,
979
+ detail: { variable: responseVariable }
980
+ }));
981
+ }
982
+ get #correctResponse() {
983
+ let result;
984
+ const correctResponse = this.querySelector("qti-correct-response");
985
+ if (correctResponse) {
986
+ const values = correctResponse.querySelectorAll("qti-value");
987
+ if (this.cardinality === "single" && values.length > 0) {
988
+ result = values[0].textContent.trim();
989
+ values[0].remove();
990
+ } else if (this.cardinality !== "single") {
991
+ result = [];
992
+ for (let i3 = 0; i3 < values.length; i3++) {
993
+ result.push(values[i3].textContent.trim());
994
+ values[i3].remove();
995
+ }
996
+ }
997
+ }
998
+ return result;
999
+ }
1000
+ get #mapping() {
1001
+ const mappingElement = this.querySelector("qti-mapping");
1002
+ const lowerBound = parseFloat(mappingElement?.getAttribute("lower-bound"));
1003
+ const uppperBound = parseFloat(mappingElement?.getAttribute("upper-bound"));
1004
+ const mappingValue = {
1005
+ defaultValue: Number(mappingElement?.getAttribute("default-value")) || 0,
1006
+ lowerBound: isNaN(lowerBound) ? null : lowerBound,
1007
+ upperBound: isNaN(uppperBound) ? null : uppperBound,
1008
+ mapEntries: Array.from(mappingElement?.querySelectorAll("qti-map-entry") || []).map((el) => ({
1009
+ mapKey: el.getAttribute("map-key") || "",
1010
+ mappedValue: Number(el.getAttribute("mapped-value")) || 0,
1011
+ caseSensitive: el.hasAttribute("case-sensitive") ? el.getAttribute("case-sensitive") !== "false" : false
1012
+ }))
1013
+ };
1014
+ return mappingValue;
1015
+ }
1016
+ get #areaMapping() {
1017
+ const areaMappingElement = this.querySelector("qti-area-mapping");
1018
+ const defaultValue = Number(areaMappingElement?.getAttribute("default-value")) || 0;
1019
+ const lowerBound = parseFloat(areaMappingElement?.getAttribute("lower-bound"));
1020
+ const uppperBound = parseFloat(areaMappingElement?.getAttribute("upper-bound"));
1021
+ const areaMapEntries = Array.from(areaMappingElement?.querySelectorAll("qti-area-map-entry") || []).map((el) => ({
1022
+ shape: el.getAttribute("shape") || "default",
1023
+ coords: el.getAttribute("coords") || "",
1024
+ mappedValue: Number(el.getAttribute("mapped-value")) || 0,
1025
+ defaultValue: Number(el.getAttribute("default-value")) || 0
1026
+ }));
1027
+ return {
1028
+ defaultValue,
1029
+ lowerBound: isNaN(lowerBound) ? null : lowerBound,
1030
+ upperBound: isNaN(uppperBound) ? null : uppperBound,
1031
+ areaMapEntries
1032
+ };
1033
+ }
1034
+ };
1035
+ __decorate7([
1192
1036
  n({ type: String, attribute: "base-type" })
1193
- ], QtiOutcomeDeclaration.prototype, "baseType", 2);
1194
- __decorateClass([
1195
- n({ type: String, attribute: "external-scored" })
1196
- ], QtiOutcomeDeclaration.prototype, "externalScored", 2);
1197
- __decorateClass([
1037
+ ], QtiResponseDeclaration.prototype, "baseType", void 0);
1038
+ __decorate7([
1198
1039
  n({ type: String })
1199
- ], QtiOutcomeDeclaration.prototype, "identifier", 2);
1200
- __decorateClass([
1040
+ ], QtiResponseDeclaration.prototype, "identifier", void 0);
1041
+ __decorate7([
1201
1042
  n({ type: String })
1202
- ], QtiOutcomeDeclaration.prototype, "cardinality", 2);
1203
- __decorateClass([
1043
+ ], QtiResponseDeclaration.prototype, "cardinality", void 0);
1044
+ __decorate7([
1204
1045
  c({ context: itemContext, subscribe: true }),
1205
1046
  r()
1206
- ], QtiOutcomeDeclaration.prototype, "itemContext", 2);
1207
- QtiOutcomeDeclaration = __decorateClass([
1208
- t("qti-outcome-declaration")
1209
- ], QtiOutcomeDeclaration);
1047
+ ], QtiResponseDeclaration.prototype, "itemContext", void 0);
1210
1048
 
1211
- // ../qti-elements/src/internal/template-strings.ts
1049
+ // ../qti-elements/dist/internal/template-strings.js
1212
1050
  var matchCorrect = `<qti-response-processing>
1213
1051
  <qti-response-condition>
1214
1052
  <qti-response-if>
@@ -1262,19 +1100,24 @@ var mapResponsePoint = `<qti-response-processing>
1262
1100
  </qti-response-condition>
1263
1101
  </qti-response-processing>`;
1264
1102
 
1265
- // ../qti-elements/src/components/qti-response-processing/qti-response-processing.ts
1266
- var _QtiResponseProcessing_instances, fragmentFromString_fn;
1103
+ // ../qti-elements/dist/components/qti-response-processing/qti-response-processing.js
1267
1104
  var QtiResponseProcessing = class extends i2 {
1268
- constructor() {
1269
- super(...arguments);
1270
- __privateAdd(this, _QtiResponseProcessing_instances);
1105
+ static {
1106
+ this.styles = [
1107
+ i`
1108
+ :host {
1109
+ display: none;
1110
+ }
1111
+ `
1112
+ ];
1271
1113
  }
1272
1114
  render() {
1273
1115
  return T`<slot></slot>`;
1274
1116
  }
1275
1117
  process() {
1276
1118
  const assessmentItem = this.closest("qti-assessment-item");
1277
- if (!assessmentItem) return;
1119
+ if (!assessmentItem)
1120
+ return;
1278
1121
  const rules = [...this.children];
1279
1122
  for (const rule of rules) {
1280
1123
  rule.process();
@@ -1287,47 +1130,201 @@ var QtiResponseProcessing = class extends i2 {
1287
1130
  this.innerHTML = "";
1288
1131
  switch (templateName) {
1289
1132
  case "map_response": {
1290
- this.appendChild(__privateMethod(this, _QtiResponseProcessing_instances, fragmentFromString_fn).call(this, mapResponse).firstElementChild.firstElementChild);
1133
+ this.appendChild(this.#fragmentFromString(mapResponse).firstElementChild.firstElementChild);
1291
1134
  break;
1292
1135
  }
1293
1136
  case "map_response_point": {
1294
- this.appendChild(__privateMethod(this, _QtiResponseProcessing_instances, fragmentFromString_fn).call(this, mapResponsePoint).firstElementChild.firstElementChild);
1137
+ this.appendChild(this.#fragmentFromString(mapResponsePoint).firstElementChild.firstElementChild);
1295
1138
  break;
1296
1139
  }
1297
1140
  case "match_correct":
1298
- this.appendChild(__privateMethod(this, _QtiResponseProcessing_instances, fragmentFromString_fn).call(this, matchCorrect).firstElementChild.firstElementChild);
1141
+ this.appendChild(this.#fragmentFromString(matchCorrect).firstElementChild.firstElementChild);
1299
1142
  break;
1300
1143
  }
1301
1144
  }
1302
1145
  }
1146
+ #fragmentFromString(strHTML) {
1147
+ return document.createRange().createContextualFragment(strHTML);
1148
+ }
1303
1149
  };
1304
- _QtiResponseProcessing_instances = new WeakSet();
1305
- fragmentFromString_fn = function(strHTML) {
1306
- return document.createRange().createContextualFragment(strHTML);
1150
+
1151
+ // ../qti-elements/dist/components/qti-rubric-block/qti-rubric-block.js
1152
+ var __decorate8 = function(decorators, target, key, desc) {
1153
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1154
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1155
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
1156
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1307
1157
  };
1308
- QtiResponseProcessing.styles = [
1309
- i`
1310
- :host {
1311
- display: none;
1158
+ var QtiRubricBlock = class extends i2 {
1159
+ handleclassNamesChange() {
1160
+ const classNames = this.classNames.split(" ");
1161
+ classNames.forEach((className) => {
1162
+ switch (className) {
1163
+ case "qti-rubric-discretionary-placement":
1164
+ {
1165
+ const event = new CustomEvent("qti-rubric:discretionary-placement", {
1166
+ detail: { className, element: this },
1167
+ bubbles: true,
1168
+ composed: true,
1169
+ cancelable: true
1170
+ });
1171
+ const notCancelled = this.dispatchEvent(event);
1172
+ if (!notCancelled)
1173
+ return;
1174
+ this.setAttribute("slot", "qti-rubric-block");
1175
+ }
1176
+ break;
1177
+ case "qti-rubric-inline":
1178
+ this.setAttribute("slot", "");
1179
+ break;
1180
+ default:
1181
+ break;
1312
1182
  }
1313
- `
1314
- ];
1315
- QtiResponseProcessing = __decorateClass([
1316
- t("qti-response-processing")
1317
- ], QtiResponseProcessing);
1183
+ });
1184
+ }
1185
+ static {
1186
+ this.styles = i`
1187
+ :host {
1188
+ display: block;
1189
+ }
1190
+ `;
1191
+ }
1192
+ render() {
1193
+ return T`<slot></slot>`;
1194
+ }
1195
+ };
1196
+ __decorate8([
1197
+ n({ type: String })
1198
+ ], QtiRubricBlock.prototype, "id", void 0);
1199
+ __decorate8([
1200
+ n({ type: String })
1201
+ ], QtiRubricBlock.prototype, "use", void 0);
1202
+ __decorate8([
1203
+ n({ type: String })
1204
+ ], QtiRubricBlock.prototype, "view", void 0);
1205
+ __decorate8([
1206
+ n({ type: String, attribute: "class" })
1207
+ ], QtiRubricBlock.prototype, "classNames", void 0);
1208
+ __decorate8([
1209
+ watch("classNames", { waitUntilFirstUpdate: true })
1210
+ ], QtiRubricBlock.prototype, "handleclassNamesChange", null);
1318
1211
 
1319
- // ../qti-elements/src/components/qti-template-declaration/qti-template-declaration.ts
1320
- var _defaultValue, _QtiTemplateDeclaration_instances, processDefaultValue_fn, convertValue_fn, registerTemplateVariable_fn;
1212
+ // ../qti-elements/dist/components/qti-stylesheet/qti-stylesheet.js
1213
+ var QtiStylesheet = class extends i2 {
1214
+ #styleElement = null;
1215
+ firstUpdated(_changedProperties) {
1216
+ super.firstUpdated(_changedProperties);
1217
+ const link = this.getAttribute("href");
1218
+ if (link !== null) {
1219
+ fetch(link).then((response) => response.text()).then((cssContent) => {
1220
+ const minifiedCss = this.#minifyCss(cssContent);
1221
+ this.#styleElement = document.createElement("style");
1222
+ this.#styleElement.media = "screen";
1223
+ this.#styleElement.textContent = `@scope {${minifiedCss}}`;
1224
+ if (this.parentElement) {
1225
+ this.parentElement.appendChild(this.#styleElement);
1226
+ } else {
1227
+ console.warn("No parent element to append the scoped stylesheet to.");
1228
+ }
1229
+ }).catch((error) => {
1230
+ console.error("Failed to load stylesheet:", error);
1231
+ });
1232
+ }
1233
+ if (this.textContent !== null && this.textContent.trim() !== "") {
1234
+ const minifiedCss = this.#minifyCss(this.textContent);
1235
+ this.#styleElement = document.createElement("style");
1236
+ this.#styleElement.media = "screen";
1237
+ this.#styleElement.textContent = `@scope {${minifiedCss}}`;
1238
+ if (this.parentElement) {
1239
+ this.parentElement.appendChild(this.#styleElement);
1240
+ } else {
1241
+ console.warn("No parent element to append the scoped stylesheet to.");
1242
+ }
1243
+ }
1244
+ }
1245
+ #minifyCss(cssContent) {
1246
+ return cssContent.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;])\s*/g, "$1").trim();
1247
+ }
1248
+ disconnectedCallback() {
1249
+ if (this.#styleElement) {
1250
+ try {
1251
+ this.#styleElement.remove();
1252
+ } catch (error) {
1253
+ console.error("Could not remove stylesheet:", error);
1254
+ }
1255
+ }
1256
+ super.disconnectedCallback();
1257
+ }
1258
+ };
1259
+
1260
+ // ../qti-elements/dist/components/qti-template-constraint/qti-template-constraint.js
1261
+ var QtiTemplateConstraint = class extends i2 {
1262
+ render() {
1263
+ return T`<slot></slot>`;
1264
+ }
1265
+ /**
1266
+ * Evaluates the constraint condition
1267
+ * @returns true if constraint is satisfied, false if template processing should restart
1268
+ */
1269
+ calculate() {
1270
+ const expressions = [...this.children];
1271
+ if (expressions.length !== 1) {
1272
+ console.error("qti-template-constraint must have exactly one child expression");
1273
+ return true;
1274
+ }
1275
+ try {
1276
+ const result = expressions[0].calculate();
1277
+ return Boolean(result);
1278
+ } catch (error) {
1279
+ console.error("Error evaluating template constraint:", error);
1280
+ return true;
1281
+ }
1282
+ }
1283
+ /**
1284
+ * Template constraints don't have sub-rules like conditions
1285
+ */
1286
+ getSubRules() {
1287
+ return [];
1288
+ }
1289
+ /**
1290
+ * Process the template constraint
1291
+ * @returns true if constraint is satisfied, false if template processing should restart
1292
+ */
1293
+ process() {
1294
+ const constraintSatisfied = this.calculate();
1295
+ if (!constraintSatisfied) {
1296
+ console.debug("Template constraint not satisfied, restarting template processing");
1297
+ }
1298
+ return constraintSatisfied;
1299
+ }
1300
+ };
1301
+
1302
+ // ../qti-elements/dist/components/qti-template-declaration/qti-template-declaration.js
1303
+ var __decorate9 = function(decorators, target, key, desc) {
1304
+ var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1305
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1306
+ else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d = decorators[i3]) r2 = (c2 < 3 ? d(r2) : c2 > 3 ? d(target, key, r2) : d(target, key)) || r2;
1307
+ return c2 > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1308
+ };
1321
1309
  var QtiTemplateDeclaration = class extends i2 {
1322
1310
  constructor() {
1323
1311
  super(...arguments);
1324
- __privateAdd(this, _QtiTemplateDeclaration_instances);
1325
1312
  this.identifier = "";
1326
1313
  this.cardinality = "single";
1327
1314
  this.baseType = "string";
1328
1315
  this.mathVariable = false;
1329
1316
  this.paramVariable = false;
1330
- __privateAdd(this, _defaultValue, null);
1317
+ this.#defaultValue = null;
1318
+ }
1319
+ #defaultValue;
1320
+ static {
1321
+ this.styles = [
1322
+ i`
1323
+ :host {
1324
+ display: none;
1325
+ }
1326
+ `
1327
+ ];
1331
1328
  }
1332
1329
  render() {
1333
1330
  return T`<slot></slot>`;
@@ -1335,10 +1332,61 @@ var QtiTemplateDeclaration = class extends i2 {
1335
1332
  connectedCallback() {
1336
1333
  super.connectedCallback();
1337
1334
  this.updateComplete.then(() => {
1338
- __privateMethod(this, _QtiTemplateDeclaration_instances, processDefaultValue_fn).call(this);
1339
- __privateMethod(this, _QtiTemplateDeclaration_instances, registerTemplateVariable_fn).call(this);
1335
+ this.#processDefaultValue();
1336
+ this.#registerTemplateVariable();
1340
1337
  });
1341
1338
  }
1339
+ /**
1340
+ * Process qti-default-value to extract the default value
1341
+ */
1342
+ #processDefaultValue() {
1343
+ const defaultValueElement = this.querySelector("qti-default-value");
1344
+ if (!defaultValueElement) {
1345
+ return;
1346
+ }
1347
+ const textContent = defaultValueElement.textContent?.trim() || "";
1348
+ this.#defaultValue = this.#convertValue(textContent);
1349
+ }
1350
+ /**
1351
+ * Convert string value based on base-type
1352
+ */
1353
+ #convertValue(value) {
1354
+ if (!value)
1355
+ return null;
1356
+ switch (this.baseType) {
1357
+ case "integer":
1358
+ return parseInt(value, 10);
1359
+ case "float":
1360
+ case "duration":
1361
+ return parseFloat(value);
1362
+ case "boolean":
1363
+ return value.toLowerCase() === "true";
1364
+ case "string":
1365
+ default:
1366
+ return value;
1367
+ }
1368
+ }
1369
+ /**
1370
+ * Register this template variable with the assessment item
1371
+ */
1372
+ #registerTemplateVariable() {
1373
+ const templateVariable = {
1374
+ identifier: this.identifier,
1375
+ cardinality: this.cardinality,
1376
+ baseType: this.baseType,
1377
+ defaultValue: this.#defaultValue,
1378
+ value: this.#defaultValue,
1379
+ type: "template",
1380
+ mathVariable: this.mathVariable,
1381
+ paramVariable: this.paramVariable
1382
+ };
1383
+ const variable = { ...templateVariable, value: this.#defaultValue?.toString() || "" };
1384
+ this.dispatchEvent(new CustomEvent("qti-register-variable", {
1385
+ bubbles: true,
1386
+ composed: true,
1387
+ detail: { variable }
1388
+ }));
1389
+ }
1342
1390
  /**
1343
1391
  * Get the template variable definition
1344
1392
  */
@@ -1347,100 +1395,41 @@ var QtiTemplateDeclaration = class extends i2 {
1347
1395
  identifier: this.identifier,
1348
1396
  cardinality: this.cardinality,
1349
1397
  baseType: this.baseType,
1350
- value: __privateGet(this, _defaultValue),
1398
+ value: this.#defaultValue,
1351
1399
  type: "template",
1352
1400
  mathVariable: this.mathVariable,
1353
1401
  paramVariable: this.paramVariable
1354
1402
  };
1355
1403
  }
1356
1404
  };
1357
- _defaultValue = new WeakMap();
1358
- _QtiTemplateDeclaration_instances = new WeakSet();
1359
- /**
1360
- * Process qti-default-value to extract the default value
1361
- */
1362
- processDefaultValue_fn = function() {
1363
- const defaultValueElement = this.querySelector("qti-default-value");
1364
- if (!defaultValueElement) {
1365
- return;
1366
- }
1367
- const textContent = defaultValueElement.textContent?.trim() || "";
1368
- __privateSet(this, _defaultValue, __privateMethod(this, _QtiTemplateDeclaration_instances, convertValue_fn).call(this, textContent));
1369
- };
1370
- /**
1371
- * Convert string value based on base-type
1372
- */
1373
- convertValue_fn = function(value) {
1374
- if (!value) return null;
1375
- switch (this.baseType) {
1376
- case "integer":
1377
- return parseInt(value, 10);
1378
- case "float":
1379
- case "duration":
1380
- return parseFloat(value);
1381
- case "boolean":
1382
- return value.toLowerCase() === "true";
1383
- case "string":
1384
- default:
1385
- return value;
1386
- }
1387
- };
1388
- /**
1389
- * Register this template variable with the assessment item
1390
- */
1391
- registerTemplateVariable_fn = function() {
1392
- const templateVariable = {
1393
- identifier: this.identifier,
1394
- cardinality: this.cardinality,
1395
- baseType: this.baseType,
1396
- defaultValue: __privateGet(this, _defaultValue),
1397
- value: __privateGet(this, _defaultValue),
1398
- type: "template",
1399
- mathVariable: this.mathVariable,
1400
- paramVariable: this.paramVariable
1401
- };
1402
- const variable = { ...templateVariable, value: __privateGet(this, _defaultValue)?.toString() || "" };
1403
- this.dispatchEvent(
1404
- new CustomEvent("qti-register-variable", {
1405
- bubbles: true,
1406
- composed: true,
1407
- detail: { variable }
1408
- })
1409
- );
1410
- };
1411
- QtiTemplateDeclaration.styles = [
1412
- i`
1413
- :host {
1414
- display: none;
1415
- }
1416
- `
1417
- ];
1418
- __decorateClass([
1405
+ __decorate9([
1419
1406
  n({ type: String })
1420
- ], QtiTemplateDeclaration.prototype, "identifier", 2);
1421
- __decorateClass([
1407
+ ], QtiTemplateDeclaration.prototype, "identifier", void 0);
1408
+ __decorate9([
1422
1409
  n({ type: String })
1423
- ], QtiTemplateDeclaration.prototype, "cardinality", 2);
1424
- __decorateClass([
1410
+ ], QtiTemplateDeclaration.prototype, "cardinality", void 0);
1411
+ __decorate9([
1425
1412
  n({ type: String, attribute: "base-type" })
1426
- ], QtiTemplateDeclaration.prototype, "baseType", 2);
1427
- __decorateClass([
1413
+ ], QtiTemplateDeclaration.prototype, "baseType", void 0);
1414
+ __decorate9([
1428
1415
  n({ type: Boolean, attribute: "math-variable" })
1429
- ], QtiTemplateDeclaration.prototype, "mathVariable", 2);
1430
- __decorateClass([
1416
+ ], QtiTemplateDeclaration.prototype, "mathVariable", void 0);
1417
+ __decorate9([
1431
1418
  n({ type: Boolean, attribute: "param-variable" })
1432
- ], QtiTemplateDeclaration.prototype, "paramVariable", 2);
1433
- QtiTemplateDeclaration = __decorateClass([
1434
- t("qti-template-declaration")
1435
- ], QtiTemplateDeclaration);
1419
+ ], QtiTemplateDeclaration.prototype, "paramVariable", void 0);
1436
1420
 
1437
- // ../qti-elements/src/components/qti-template-processing/qti-template-processing.ts
1438
- var _maxIterations;
1421
+ // ../qti-elements/dist/components/qti-template-processing/qti-template-processing.js
1439
1422
  var QtiTemplateProcessing = class extends i2 {
1440
- constructor() {
1441
- super(...arguments);
1442
- __privateAdd(this, _maxIterations, 100);
1423
+ static {
1424
+ this.styles = [
1425
+ i`
1426
+ :host {
1427
+ display: none;
1428
+ }
1429
+ `
1430
+ ];
1443
1431
  }
1432
+ #maxIterations = 100;
1444
1433
  // Prevent infinite loops in template constraints
1445
1434
  render() {
1446
1435
  return T`<slot></slot>`;
@@ -1459,7 +1448,7 @@ var QtiTemplateProcessing = class extends i2 {
1459
1448
  do {
1460
1449
  shouldReprocess = false;
1461
1450
  iterations++;
1462
- if (iterations > __privateGet(this, _maxIterations)) {
1451
+ if (iterations > this.#maxIterations) {
1463
1452
  console.error("Template processing exceeded maximum iterations. Possible infinite loop.");
1464
1453
  break;
1465
1454
  }
@@ -1481,13 +1470,11 @@ var QtiTemplateProcessing = class extends i2 {
1481
1470
  break;
1482
1471
  }
1483
1472
  } while (shouldReprocess);
1484
- this.dispatchEvent(
1485
- new CustomEvent("qti-template-processing-complete", {
1486
- bubbles: true,
1487
- composed: true,
1488
- detail: { iterations }
1489
- })
1490
- );
1473
+ this.dispatchEvent(new CustomEvent("qti-template-processing-complete", {
1474
+ bubbles: true,
1475
+ composed: true,
1476
+ detail: { iterations }
1477
+ }));
1491
1478
  }
1492
1479
  firstUpdated(_changedProperties) {
1493
1480
  if (this.getAttribute("template")) {
@@ -1495,110 +1482,49 @@ var QtiTemplateProcessing = class extends i2 {
1495
1482
  }
1496
1483
  }
1497
1484
  };
1498
- _maxIterations = new WeakMap();
1499
- QtiTemplateProcessing.styles = [
1500
- i`
1501
- :host {
1502
- display: none;
1503
- }
1504
- `
1505
- ];
1506
- QtiTemplateProcessing = __decorateClass([
1507
- t("qti-template-processing")
1508
- ], QtiTemplateProcessing);
1509
1485
 
1510
- // ../qti-elements/src/components/qti-template-constraint/qti-template-constraint.ts
1511
- var QtiTemplateConstraint = class extends i2 {
1512
- render() {
1513
- return T`<slot></slot>`;
1514
- }
1515
- /**
1516
- * Evaluates the constraint condition
1517
- * @returns true if constraint is satisfied, false if template processing should restart
1518
- */
1519
- calculate() {
1520
- const expressions = [...this.children];
1521
- if (expressions.length !== 1) {
1522
- console.error("qti-template-constraint must have exactly one child expression");
1523
- return true;
1524
- }
1525
- try {
1526
- const result = expressions[0].calculate();
1527
- return Boolean(result);
1528
- } catch (error) {
1529
- console.error("Error evaluating template constraint:", error);
1530
- return true;
1531
- }
1532
- }
1533
- /**
1534
- * Template constraints don't have sub-rules like conditions
1535
- */
1536
- getSubRules() {
1537
- return [];
1538
- }
1539
- /**
1540
- * Process the template constraint
1541
- * @returns true if constraint is satisfied, false if template processing should restart
1542
- */
1543
- process() {
1544
- const constraintSatisfied = this.calculate();
1545
- if (!constraintSatisfied) {
1546
- console.debug("Template constraint not satisfied, restarting template processing");
1547
- }
1548
- return constraintSatisfied;
1549
- }
1550
- };
1551
- QtiTemplateConstraint = __decorateClass([
1552
- t("qti-template-constraint")
1553
- ], QtiTemplateConstraint);
1554
-
1555
- // ../qti-elements/src/components/qti-context-declaration/qti-context-declaration.ts
1556
- var QtiContextDeclaration = class extends i2 {
1557
- constructor() {
1558
- super(...arguments);
1559
- this.identifier = "";
1560
- this.cardinality = "record";
1561
- }
1562
- render() {
1563
- return T`<slot></slot>`;
1564
- }
1565
- };
1566
- QtiContextDeclaration.styles = [
1567
- i`
1568
- :host {
1569
- display: none;
1570
- }
1571
- `
1486
+ // ../qti-elements/dist/elements.js
1487
+ var qtiContentElements = [
1488
+ { tag: "qti-assessment-item", ctor: QtiAssessmentItem },
1489
+ { tag: "qti-assessment-stimulus-ref", ctor: QtiAssessmentStimulusRef },
1490
+ { tag: "qti-companion-materials-info", ctor: QtiCompanionMaterialsInfo },
1491
+ { tag: "qti-content-body", ctor: QtiContentBody },
1492
+ { tag: "qti-context-declaration", ctor: QtiContextDeclaration },
1493
+ { tag: "qti-custom-operator", ctor: QtiCustomOperator },
1494
+ { tag: "qti-feedback-block", ctor: QtiFeedbackBlock },
1495
+ { tag: "qti-feedback-inline", ctor: QtiFeedbackInline },
1496
+ { tag: "qti-item-body", ctor: QtiItemBody },
1497
+ { tag: "qti-modal-feedback", ctor: QtiModalFeedback },
1498
+ { tag: "qti-outcome-declaration", ctor: QtiOutcomeDeclaration },
1499
+ { tag: "qti-response-declaration", ctor: QtiResponseDeclaration },
1500
+ { tag: "qti-response-processing", ctor: QtiResponseProcessing },
1501
+ { tag: "qti-rubric-block", ctor: QtiRubricBlock },
1502
+ { tag: "qti-stylesheet", ctor: QtiStylesheet },
1503
+ { tag: "qti-template-constraint", ctor: QtiTemplateConstraint },
1504
+ { tag: "qti-template-declaration", ctor: QtiTemplateDeclaration },
1505
+ { tag: "qti-template-processing", ctor: QtiTemplateProcessing }
1572
1506
  ];
1573
- __decorateClass([
1574
- n({ type: String })
1575
- ], QtiContextDeclaration.prototype, "identifier", 2);
1576
- __decorateClass([
1577
- n({ type: String })
1578
- ], QtiContextDeclaration.prototype, "cardinality", 2);
1579
- QtiContextDeclaration = __decorateClass([
1580
- t("qti-context-declaration")
1581
- ], QtiContextDeclaration);
1582
1507
 
1583
1508
  export {
1584
1509
  QtiAssessmentItem,
1585
1510
  QtiAssessmentStimulusRefConnectedEvent,
1586
1511
  QtiAssessmentStimulusRef,
1587
1512
  QtiCompanionMaterialsInfo,
1513
+ QtiContentBody,
1514
+ QtiContextDeclaration,
1588
1515
  QtiCustomOperator,
1589
1516
  QtiFeedbackBlock,
1590
1517
  QtiFeedbackInline,
1591
- QtiModalFeedback,
1592
1518
  QtiItemBody,
1593
- QtiContentBody,
1594
- QtiRubricBlock,
1595
- QtiStylesheet,
1596
- QtiResponseDeclaration,
1519
+ QtiModalFeedback,
1597
1520
  QtiOutcomeDeclaration,
1521
+ QtiResponseDeclaration,
1598
1522
  QtiResponseProcessing,
1523
+ QtiRubricBlock,
1524
+ QtiStylesheet,
1525
+ QtiTemplateConstraint,
1599
1526
  QtiTemplateDeclaration,
1600
1527
  QtiTemplateProcessing,
1601
- QtiTemplateConstraint,
1602
- QtiContextDeclaration
1528
+ qtiContentElements
1603
1529
  };
1604
- //# sourceMappingURL=chunk-WDO2TRFM.js.map
1530
+ //# sourceMappingURL=chunk-WVVMNF74.js.map