@citolab/qti-components 9.4.0 → 9.6.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 (65) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +1876 -272
  3. package/dist/base.d.ts +10 -10
  4. package/dist/base.js +7 -1
  5. package/dist/{chunk-GNTO3IFM.js → chunk-EAQOUBXA.js} +717 -417
  6. package/dist/chunk-EAQOUBXA.js.map +1 -0
  7. package/dist/{chunk-B5XHZI2P.js → chunk-H72OXVRF.js} +2 -2
  8. package/dist/{chunk-B74SYQB2.js → chunk-I7ACMH74.js} +3 -3
  9. package/dist/{chunk-MSGYZE6L.js → chunk-LOKULHVY.js} +504 -283
  10. package/dist/chunk-LOKULHVY.js.map +1 -0
  11. package/dist/{chunk-ACRN7YJM.js → chunk-QOFGUIYE.js} +2 -2
  12. package/dist/{chunk-R7MMMDP7.js → chunk-QUTM5TT6.js} +56 -2
  13. package/dist/chunk-QUTM5TT6.js.map +1 -0
  14. package/dist/chunk-QVZLJY75.js +7 -0
  15. package/dist/chunk-QVZLJY75.js.map +1 -0
  16. package/dist/{chunk-BMXG7D2N.js → chunk-RV7ADJ33.js} +2 -2
  17. package/dist/{chunk-JHPQJDAV.js → chunk-TBJT7AGB.js} +2 -2
  18. package/dist/{chunk-LKHRHFXO.js → chunk-TC4257SG.js} +6 -6
  19. package/dist/{chunk-XEWGFAS4.js → chunk-TFQAUWCM.js} +105 -30
  20. package/dist/chunk-TFQAUWCM.js.map +1 -0
  21. package/dist/{chunk-3BAQWO5C.js → chunk-V3NKEAQY.js} +40 -4
  22. package/dist/chunk-V3NKEAQY.js.map +1 -0
  23. package/dist/{chunk-C3JPUV36.js → chunk-YS6CBO45.js} +2 -2
  24. package/dist/{computed.types.d-gJrBeUMG.d.ts → computed.types.d-SsTm3ieP.d.ts} +1 -1
  25. package/dist/corrections.d.ts +9 -9
  26. package/dist/corrections.js +8 -8
  27. package/dist/elements.d.ts +65 -3
  28. package/dist/elements.js +15 -5
  29. package/dist/index.d.ts +11 -11
  30. package/dist/index.js +40 -14
  31. package/dist/interactions.d.ts +4 -4
  32. package/dist/interactions.js +7 -3
  33. package/dist/item.css +12 -0
  34. package/dist/item.d.ts +4 -4
  35. package/dist/item.js +4 -4
  36. package/dist/{item.types.d-B55QkJ92.d.ts → item.types.d-DuVR0ZVK.d.ts} +7 -1
  37. package/dist/loader.d.ts +2 -2
  38. package/dist/processing.d.ts +10 -3
  39. package/dist/processing.js +3 -3
  40. package/dist/qti-components-jsx.d.ts +273 -213
  41. package/dist/{qti-condition-expression.d-L7yb3Rzy.d.ts → qti-condition-expression.d-B-T1NNl0.d.ts} +1 -1
  42. package/dist/{qti-expression.d-CuaLjZ6g.d.ts → qti-expression.d-B-Cfbqlb.d.ts} +8 -1
  43. package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-DbzPSJuK.d.ts} +1 -1
  44. package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-DjWvKbfL.d.ts} +1 -1
  45. package/dist/{qti-test.d-Cud5Gvy0.d.ts → qti-test.d-DOWT6YNa.d.ts} +109 -12
  46. package/dist/{qti-text-entry-interaction.d-DKvz9ncv.d.ts → qti-text-entry-interaction.d-h5UZ8Qvp.d.ts} +34 -19
  47. package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-wB9uYs-j.d.ts} +34 -2
  48. package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-Cw8GcziG.d.ts} +1 -1
  49. package/dist/test.d.ts +7 -7
  50. package/dist/test.js +11 -5
  51. package/package.json +6 -6
  52. package/dist/chunk-3BAQWO5C.js.map +0 -1
  53. package/dist/chunk-A32YH4H5.js +0 -7
  54. package/dist/chunk-A32YH4H5.js.map +0 -1
  55. package/dist/chunk-GNTO3IFM.js.map +0 -1
  56. package/dist/chunk-MSGYZE6L.js.map +0 -1
  57. package/dist/chunk-R7MMMDP7.js.map +0 -1
  58. package/dist/chunk-XEWGFAS4.js.map +0 -1
  59. /package/dist/{chunk-B5XHZI2P.js.map → chunk-H72OXVRF.js.map} +0 -0
  60. /package/dist/{chunk-B74SYQB2.js.map → chunk-I7ACMH74.js.map} +0 -0
  61. /package/dist/{chunk-ACRN7YJM.js.map → chunk-QOFGUIYE.js.map} +0 -0
  62. /package/dist/{chunk-BMXG7D2N.js.map → chunk-RV7ADJ33.js.map} +0 -0
  63. /package/dist/{chunk-JHPQJDAV.js.map → chunk-TBJT7AGB.js.map} +0 -0
  64. /package/dist/{chunk-LKHRHFXO.js.map → chunk-TC4257SG.js.map} +0 -0
  65. /package/dist/{chunk-C3JPUV36.js.map → chunk-YS6CBO45.js.map} +0 -0
@@ -6,15 +6,18 @@ import {
6
6
  boxSizing,
7
7
  configContext,
8
8
  dropRegion,
9
+ inferRecordFieldBaseType,
9
10
  interactionContext,
11
+ isRecordValue,
10
12
  itemContext,
11
13
  parseResponseAttribute,
12
14
  qtiContext,
15
+ readRecordFieldValues,
13
16
  removeDoubleSlashes,
14
17
  responseAttributeConverter,
15
18
  serializeResponseAttribute,
16
19
  validationMessage
17
- } from "./chunk-R7MMMDP7.js";
20
+ } from "./chunk-QUTM5TT6.js";
18
21
 
19
22
  // ../interactions/core/dist/elements/qti-associable-hotspot/qti-associable-hotspot.js
20
23
  import { LitElement, html } from "lit";
@@ -207,6 +210,10 @@ var qti_gap_img_styles_default = [
207
210
  align-items: center;
208
211
  justify-content: center;
209
212
  user-select: none;
213
+ /* In graphic-gap-match the picture's authored size is in the graphic's coordinate space, so it
214
+ scales with the graphic and keeps fitting its hotspot. The interaction publishes the factor;
215
+ anywhere else it is unset and the chip keeps its size. */
216
+ zoom: var(--qti-graphic-scale, 1);
210
217
  }
211
218
  `
212
219
  ];
@@ -1254,22 +1261,22 @@ var [Observable, Subscriber] = (() => {
1254
1261
  const AsyncFromSyncIteratorPrototype = {
1255
1262
  next(...args) {
1256
1263
  const O = this;
1257
- const state14 = privateState.get(O);
1258
- if (!state14?.syncIteratorRecord)
1264
+ const state15 = privateState.get(O);
1265
+ if (!state15?.syncIteratorRecord)
1259
1266
  throw new TypeError(
1260
1267
  "AsyncFromSyncIteratorPrototype.next called on invalid object"
1261
1268
  );
1262
- const { syncIteratorRecord } = state14;
1269
+ const { syncIteratorRecord } = state15;
1263
1270
  return pTry(() => syncIteratorRecord.next(...args));
1264
1271
  },
1265
1272
  return(...args) {
1266
1273
  const O = this;
1267
- const state14 = privateState.get(O);
1268
- if (!state14?.syncIteratorRecord)
1274
+ const state15 = privateState.get(O);
1275
+ if (!state15?.syncIteratorRecord)
1269
1276
  throw new TypeError(
1270
1277
  "AsyncFromSyncIteratorPrototype.return called on invalid object"
1271
1278
  );
1272
- const { syncIteratorRecord } = state14;
1279
+ const { syncIteratorRecord } = state15;
1273
1280
  return pTry(() => {
1274
1281
  if (!syncIteratorRecord.return) return { value: void 0, done: true };
1275
1282
  return syncIteratorRecord.return(...args);
@@ -1277,12 +1284,12 @@ var [Observable, Subscriber] = (() => {
1277
1284
  },
1278
1285
  throw(...args) {
1279
1286
  const O = this;
1280
- const state14 = privateState.get(O);
1281
- if (!state14?.syncIteratorRecord)
1287
+ const state15 = privateState.get(O);
1288
+ if (!state15?.syncIteratorRecord)
1282
1289
  throw new TypeError(
1283
1290
  "AsyncFromSyncIteratorPrototype.throw called on invalid object"
1284
1291
  );
1285
- const { syncIteratorRecord } = state14;
1292
+ const { syncIteratorRecord } = state15;
1286
1293
  return pTry(() => {
1287
1294
  if (!syncIteratorRecord.throw) {
1288
1295
  syncIteratorRecord.return();
@@ -1348,11 +1355,11 @@ var [Observable, Subscriber] = (() => {
1348
1355
  }
1349
1356
  }
1350
1357
  function closeASubscription(subscriber, reason) {
1351
- const state14 = privateState.get(subscriber);
1352
- if (!state14?.active) return;
1353
- state14.active = false;
1354
- state14.subscriptionController.abort(reason);
1355
- for (const teardown of state14.teardowns.reverse()) {
1358
+ const state15 = privateState.get(subscriber);
1359
+ if (!state15?.active) return;
1360
+ state15.active = false;
1361
+ state15.subscriptionController.abort(reason);
1362
+ for (const teardown of state15.teardowns.reverse()) {
1356
1363
  if (isBrowserContext() && !isDocumentFullyActive(document)) return;
1357
1364
  try {
1358
1365
  teardown();
@@ -1433,10 +1440,10 @@ var [Observable, Subscriber] = (() => {
1433
1440
  if (!(this instanceof Subscriber2))
1434
1441
  throw new TypeError("illegal invocation");
1435
1442
  if (!arguments.length) throw new TypeError("too few arguments");
1436
- const state14 = privateState.get(this);
1437
- if (!state14?.active) return;
1443
+ const state15 = privateState.get(this);
1444
+ if (!state15?.active) return;
1438
1445
  if (isBrowserContext() && !isDocumentFullyActive(document)) return;
1439
- const internalObservers = new Set(state14.observers);
1446
+ const internalObservers = new Set(state15.observers);
1440
1447
  for (const observer of internalObservers) {
1441
1448
  observer.next(value);
1442
1449
  }
@@ -1446,14 +1453,14 @@ var [Observable, Subscriber] = (() => {
1446
1453
  if (!(this instanceof Subscriber2))
1447
1454
  throw new TypeError("illegal invocation");
1448
1455
  if (!arguments.length) throw new TypeError("too few arguments");
1449
- const state14 = privateState.get(this);
1450
- if (!state14?.active) {
1456
+ const state15 = privateState.get(this);
1457
+ if (!state15?.active) {
1451
1458
  reportError(error);
1452
1459
  return;
1453
1460
  }
1454
1461
  if (isBrowserContext() && !isDocumentFullyActive(document)) return;
1455
1462
  closeASubscription(this, error);
1456
- const internalObservers = new Set(state14.observers);
1463
+ const internalObservers = new Set(state15.observers);
1457
1464
  for (const observer of internalObservers) {
1458
1465
  observer.error(error);
1459
1466
  }
@@ -1462,11 +1469,11 @@ var [Observable, Subscriber] = (() => {
1462
1469
  complete() {
1463
1470
  if (!(this instanceof Subscriber2))
1464
1471
  throw new TypeError("illegal invocation");
1465
- const state14 = privateState.get(this);
1466
- if (!state14?.active) return;
1472
+ const state15 = privateState.get(this);
1473
+ if (!state15?.active) return;
1467
1474
  if (isBrowserContext() && !isDocumentFullyActive(document)) return;
1468
1475
  closeASubscription(this);
1469
- const internalObservers = new Set(state14.observers);
1476
+ const internalObservers = new Set(state15.observers);
1470
1477
  for (const observer of internalObservers) {
1471
1478
  observer.complete();
1472
1479
  }
@@ -1479,9 +1486,9 @@ var [Observable, Subscriber] = (() => {
1479
1486
  throw new TypeError(`Parameter 1 is not of type 'Function'`);
1480
1487
  }
1481
1488
  if (isBrowserContext() && !isDocumentFullyActive(document)) return;
1482
- const state14 = privateState.get(this);
1483
- if (state14?.active)
1484
- state14.teardowns.push(teardown);
1489
+ const state15 = privateState.get(this);
1490
+ if (state15?.active)
1491
+ state15.teardowns.push(teardown);
1485
1492
  else teardown();
1486
1493
  }
1487
1494
  get active() {
@@ -2665,17 +2672,17 @@ function isDraggableDisabled(target) {
2665
2672
  return internals?.states?.has("disabled") ?? false;
2666
2673
  }
2667
2674
  var internalsOf = (el) => el?.internals;
2668
- function setDragChipState(el, state14, on) {
2675
+ function setDragChipState(el, state15, on) {
2669
2676
  const states = internalsOf(el)?.states;
2670
2677
  if (!states)
2671
2678
  return;
2672
2679
  if (on)
2673
- states.add(state14);
2680
+ states.add(state15);
2674
2681
  else
2675
- states.delete(state14);
2682
+ states.delete(state15);
2676
2683
  }
2677
- function hasDragChipState(el, state14) {
2678
- return internalsOf(el)?.states?.has(state14) ?? false;
2684
+ function hasDragChipState(el, state15) {
2685
+ return internalsOf(el)?.states?.has(state15) ?? false;
2679
2686
  }
2680
2687
  function clearDragChipStates(el) {
2681
2688
  setDragChipState(el, "dragging", false);
@@ -2771,7 +2778,7 @@ var resolveDragCloneHost = (dragSource, preferredHost) => {
2771
2778
  return hostFor(fullscreenElement);
2772
2779
  return host;
2773
2780
  };
2774
- var measureFixedFrame = (host) => {
2781
+ var measureFixedFrame = (host, ownZoom = 1) => {
2775
2782
  const ownerDocument = host.ownerDocument ?? document;
2776
2783
  const probe = ownerDocument.createElement("div");
2777
2784
  probe.style.cssText = `position:fixed;left:0;top:0;width:${PROBE_SIZE}px;height:${PROBE_SIZE}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`;
@@ -2780,7 +2787,9 @@ var measureFixedFrame = (host) => {
2780
2787
  probe.remove();
2781
2788
  return {
2782
2789
  origin: { x: rect.left, y: rect.top },
2783
- scale: { x: rect.width / PROBE_SIZE || 1, y: rect.height / PROBE_SIZE || 1 }
2790
+ // The clone's own `zoom` (copied from the chip with the rest of its computed style) multiplies
2791
+ // its left/top/width/height on top of whatever scales the host, so it is part of the frame.
2792
+ scale: { x: (rect.width / PROBE_SIZE || 1) * ownZoom, y: (rect.height / PROBE_SIZE || 1) * ownZoom }
2784
2793
  };
2785
2794
  };
2786
2795
  var toFrameCoordinates = (frame, x, y) => ({
@@ -2821,6 +2830,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
2821
2830
  returnAnchorItems: []
2822
2831
  };
2823
2832
  this.cloneFrame = IDENTITY_FIXED_FRAME;
2833
+ this.cloneZoom = 1;
2824
2834
  this.subscriptions = [];
2825
2835
  this.dragSubscriptions = [];
2826
2836
  this.lastPointerDownAt = 0;
@@ -3391,7 +3401,8 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
3391
3401
  clone.style.setProperty(property27, computedStyles.getPropertyValue(property27));
3392
3402
  }
3393
3403
  const host = resolveDragCloneHost(element.isConnected ? element : this, this.dragCloneRoot());
3394
- this.cloneFrame = measureFixedFrame(host);
3404
+ this.cloneZoom = parseFloat(computedStyles.zoom) || 1;
3405
+ this.cloneFrame = measureFixedFrame(host, this.cloneZoom);
3395
3406
  clone.style.position = "fixed";
3396
3407
  clone.style.width = `${rect.width / this.cloneFrame.scale.x}px`;
3397
3408
  clone.style.height = `${rect.height / this.cloneFrame.scale.y}px`;
@@ -3450,7 +3461,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
3450
3461
  if (host === dragClone.parentNode)
3451
3462
  return;
3452
3463
  host.appendChild(dragClone);
3453
- this.cloneFrame = measureFixedFrame(host);
3464
+ this.cloneFrame = measureFixedFrame(host, this.cloneZoom);
3454
3465
  if (lastCoordinates) {
3455
3466
  this.updateClonePosition(lastCoordinates.x, lastCoordinates.y);
3456
3467
  }
@@ -3506,6 +3517,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
3506
3517
  });
3507
3518
  this.dragSubscriptions = [];
3508
3519
  this.cloneFrame = IDENTITY_FIXED_FRAME;
3520
+ this.cloneZoom = 1;
3509
3521
  this.dragState = {
3510
3522
  dragging: false,
3511
3523
  dragSource: null,
@@ -3520,14 +3532,14 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
3520
3532
  returnAnchorItems: []
3521
3533
  };
3522
3534
  }
3523
- setInternalsState(state14, enabled) {
3535
+ setInternalsState(state15, enabled) {
3524
3536
  const internals = this._internals;
3525
3537
  if (!internals?.states)
3526
3538
  return;
3527
3539
  if (enabled) {
3528
- internals.states.add(state14);
3540
+ internals.states.add(state15);
3529
3541
  } else {
3530
- internals.states.delete(state14);
3542
+ internals.states.delete(state15);
3531
3543
  }
3532
3544
  }
3533
3545
  cleanup() {
@@ -6469,6 +6481,7 @@ __decorate19([
6469
6481
 
6470
6482
  // ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.js
6471
6483
  import { html as html18 } from "lit";
6484
+ import { state as state9 } from "lit/decorators.js";
6472
6485
 
6473
6486
  // ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.styles.js
6474
6487
  import { css as css17 } from "lit";
@@ -6499,7 +6512,8 @@ var qti_graphic_gap_match_interaction_styles_default = [
6499
6512
  width: 25%;
6500
6513
  }
6501
6514
  & [part='image'] {
6502
- width: 75%;
6515
+ /* A cap, not a width: the slot must stay exactly the graphic's box (see below). */
6516
+ max-width: 75%;
6503
6517
  }
6504
6518
  }
6505
6519
  :host(.qti-choices-right) {
@@ -6508,12 +6522,25 @@ var qti_graphic_gap_match_interaction_styles_default = [
6508
6522
  width: 25%;
6509
6523
  }
6510
6524
  & [part='image'] {
6511
- width: 75%;
6525
+ /* A cap, not a width: the slot must stay exactly the graphic's box (see below). */
6526
+ max-width: 75%;
6512
6527
  }
6513
6528
  }
6529
+ /*
6530
+ * The coordinate space the drop areas sit on. Every qti-associable-hotspot is position:absolute
6531
+ * and placed with left/top percentages of the graphic (positionShapes), so this slot must be
6532
+ * (a) a positioning context and (b) exactly the box of the graphic — the same contract as the
6533
+ * hotspot interaction's slot.
6534
+ *
6535
+ * width: fit-content shrink-wraps the slot to the graphic instead of the full row, so a
6536
+ * percentage of the slot is a percentage of the picture.
6537
+ * max-width: 100% lets the slot, and with it the graphic, narrow to the container.
6538
+ */
6514
6539
  [part='image'] {
6515
6540
  display: block;
6516
6541
  position: relative;
6542
+ width: fit-content;
6543
+ max-width: 100%;
6517
6544
  }
6518
6545
  /* [part='drops'] , */
6519
6546
 
@@ -6527,8 +6554,22 @@ var qti_graphic_gap_match_interaction_styles_default = [
6527
6554
  border-radius: 0.3rem;
6528
6555
  gap: 0.5rem;
6529
6556
  }
6530
- ::slotted(img) {
6531
- display: inline-block;
6557
+ /*
6558
+ * Fluid, like the hotspot interaction's graphic: an item declares the graphic at the size its
6559
+ * coords were authored in (often a full-resolution picture, 1600px wide), and it must still fit a
6560
+ * column or a phone. The drop areas are percentages of it, so they scale along.
6561
+ *
6562
+ * max-width: 100% shrinks a graphic wider than its container, never upscales a small one.
6563
+ * height: auto keeps the aspect ratio the width/height attributes declare; without it the
6564
+ * height attribute pins the height while the width shrinks.
6565
+ * display: block no inline descender gap under the picture, which would make the slot
6566
+ * taller than the graphic and skew every vertical percentage.
6567
+ */
6568
+ ::slotted(img),
6569
+ ::slotted(object) {
6570
+ display: block;
6571
+ max-width: 100%;
6572
+ height: auto;
6532
6573
  user-select: none;
6533
6574
  pointer-events: none;
6534
6575
  }
@@ -6536,56 +6577,121 @@ var qti_graphic_gap_match_interaction_styles_default = [
6536
6577
  ];
6537
6578
 
6538
6579
  // ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.js
6580
+ var __decorate20 = function(decorators, target, key, desc) {
6581
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6582
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6583
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6584
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6585
+ };
6539
6586
  var SlottedBase2 = DragDropSlottedMixin(Interaction, "qti-gap-img, qti-gap-text", "qti-associable-hotspot", `slot[part~='drags']`);
6540
6587
  var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(SlottedBase2, '[qti-draggable="true"]') {
6588
+ constructor() {
6589
+ super(...arguments);
6590
+ this.autoSizeDropzones = false;
6591
+ this._graphicScale = 1;
6592
+ this.#graphicObserver = null;
6593
+ this.#observedGraphic = null;
6594
+ this.#positionHotspotOnRegister = (e) => {
6595
+ this.#positionHotspot(e.target);
6596
+ };
6597
+ }
6541
6598
  static {
6542
6599
  this.styles = qti_graphic_gap_match_interaction_styles_default;
6543
6600
  }
6601
+ #graphicObserver;
6602
+ #observedGraphic;
6544
6603
  render() {
6604
+ const scale = `--qti-graphic-scale: ${this._graphicScale}`;
6545
6605
  return html18` <slot name="prompt"></slot>
6546
- <slot part="image"></slot>
6547
- <slot part="drags" name="drags" class="hover-border"></slot>
6606
+ <slot part="image" style=${scale}></slot>
6607
+ <slot part="drags" name="drags" class="hover-border" style=${scale}></slot>
6548
6608
  <div role="alert" part="message" id="validation-message"></div>`;
6549
6609
  }
6550
6610
  shouldReturnToInventoryOnInventoryDrop() {
6551
6611
  return true;
6552
6612
  }
6553
- #positionHotspotOnRegister(e) {
6554
- const hotspot = e.target;
6613
+ /**
6614
+ * The background graphic: a direct child, as QTI places it. Not `findGraphic(this)`, which
6615
+ * searches every descendant and would pick up a `qti-gap-img`'s picture (or one in the prompt)
6616
+ * when it comes first.
6617
+ */
6618
+ #graphic() {
6619
+ return this.querySelector(':scope > img, :scope > object[type^="image"]');
6620
+ }
6621
+ /**
6622
+ * Pins the graphic's box to the aspect ratio its width/height attributes declare: the coordinate
6623
+ * space the drop areas are percentages of. With the fluid `height: auto` (see the styles) the box
6624
+ * would otherwise follow the bitmap — an `<object>` gets no ratio from its attributes at all, and
6625
+ * an `<img>` only `auto w / h`, where the loaded bitmap's own ratio wins. Either way a picture
6626
+ * whose pixels differ from its declared size would slide out from under its drop areas. Pinned,
6627
+ * it fills the declared box as it does at its fixed size.
6628
+ */
6629
+ #keepDeclaredRatio(graphic) {
6630
+ if (graphic.style.aspectRatio)
6631
+ return;
6632
+ const length = (name) => {
6633
+ const raw = (graphic.getAttribute(name) ?? "").trim();
6634
+ const value = parseFloat(raw);
6635
+ return raw.endsWith("%") || !(value > 0) ? null : value;
6636
+ };
6637
+ const width = length("width");
6638
+ const height = length("height");
6639
+ if (width && height)
6640
+ graphic.style.aspectRatio = `${width} / ${height}`;
6641
+ }
6642
+ /**
6643
+ * Places a drop area over the graphic with `positionShapes`, the hotspot interaction's helper:
6644
+ * percentages of the coordinate space the `coords` were authored in, so the areas scale with the
6645
+ * graphic when it is narrower than its declared width (see the styles). They used to be written
6646
+ * in pixels, which only held while the graphic rendered at exactly that width.
6647
+ */
6648
+ #positionHotspot(hotspot) {
6649
+ const graphic = this.#graphic();
6555
6650
  const coords = hotspot.getAttribute("coords");
6556
6651
  const shape = hotspot.getAttribute("shape");
6557
- const coordsNumber = coords.split(",").map((s) => parseInt(s));
6558
- switch (shape) {
6559
- case "circle":
6560
- {
6561
- const [centerX, centerY, radius] = coordsNumber;
6562
- hotspot.style.left = centerX - radius + "px";
6563
- hotspot.style.top = centerY - radius + "px";
6564
- hotspot.style.width = hotspot.style.height = 2 * radius + "px";
6565
- }
6566
- break;
6567
- case "rect":
6568
- {
6569
- const [leftX, topY, rightX, bottomY] = coordsNumber;
6570
- hotspot.style.left = leftX + "px";
6571
- hotspot.style.top = topY + "px";
6572
- hotspot.style.width = rightX - leftX + "px";
6573
- hotspot.style.height = bottomY - topY + "px";
6574
- }
6575
- break;
6576
- default:
6577
- break;
6578
- }
6652
+ if (!graphic || !coords || !shape)
6653
+ return;
6654
+ this.#keepDeclaredRatio(graphic);
6655
+ this.#observeGraphic(graphic);
6656
+ positionShapes(shape, coords.split(",").map((s) => parseFloat(s)), graphic, hotspot);
6579
6657
  }
6658
+ /**
6659
+ * Tracks the graphic's rendered width. The authored chip sizes live in the same coordinate space
6660
+ * as the `coords` — an item that draws a 275x126 hotspot for a 275x126 tile means the tile to fill
6661
+ * it — so the chips scale by the same factor as the drop areas.
6662
+ */
6663
+ #observeGraphic(graphic) {
6664
+ if (this.#observedGraphic === graphic)
6665
+ return;
6666
+ this.#graphicObserver?.disconnect();
6667
+ this.#observedGraphic = graphic;
6668
+ this.#graphicObserver = new ResizeObserver(() => {
6669
+ const declared = parseFloat(graphic.getAttribute("width") ?? "");
6670
+ const rendered = graphic.getBoundingClientRect().width;
6671
+ const scale = declared > 0 && rendered > 0 ? Math.min(1, rendered / declared) : 1;
6672
+ const rounded = Math.round(scale * 1e3) / 1e3;
6673
+ if (rounded !== this._graphicScale)
6674
+ this._graphicScale = rounded;
6675
+ });
6676
+ this.#graphicObserver.observe(graphic);
6677
+ }
6678
+ #positionHotspotOnRegister;
6580
6679
  connectedCallback() {
6581
6680
  super.connectedCallback();
6582
6681
  this.addEventListener("qti-register-hotspot", this.#positionHotspotOnRegister);
6682
+ this.querySelectorAll(":scope > qti-associable-hotspot").forEach((hotspot) => this.#positionHotspot(hotspot));
6583
6683
  }
6584
6684
  disconnectedCallback() {
6585
6685
  super.disconnectedCallback();
6586
6686
  this.removeEventListener("qti-register-hotspot", this.#positionHotspotOnRegister);
6687
+ this.#graphicObserver?.disconnect();
6688
+ this.#graphicObserver = null;
6689
+ this.#observedGraphic = null;
6587
6690
  }
6588
6691
  };
6692
+ __decorate20([
6693
+ state9()
6694
+ ], QtiGraphicGapMatchInteraction.prototype, "_graphicScale", void 0);
6589
6695
 
6590
6696
  // ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.js
6591
6697
  import { html as html19 } from "lit";
@@ -6638,7 +6744,7 @@ var qti_graphic_order_interaction_styles_default = [
6638
6744
  ];
6639
6745
 
6640
6746
  // ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.js
6641
- var __decorate20 = function(decorators, target, key, desc) {
6747
+ var __decorate21 = function(decorators, target, key, desc) {
6642
6748
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6643
6749
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6644
6750
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -6773,10 +6879,10 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
6773
6879
  this.removeEventListener("register-qti-hotspot-choice", this.#positionHotspotOnRegister);
6774
6880
  }
6775
6881
  };
6776
- __decorate20([
6882
+ __decorate21([
6777
6883
  property19({ type: Number, attribute: "max-choices" })
6778
6884
  ], QtiGraphicOrderInteraction.prototype, "maxChoices", void 0);
6779
- __decorate20([
6885
+ __decorate21([
6780
6886
  watch("response")
6781
6887
  ], QtiGraphicOrderInteraction.prototype, "handleOrderedResponseChange", null);
6782
6888
 
@@ -6921,7 +7027,7 @@ var QtiHottextInteraction = class extends ChoicesMixin(Interaction, "qti-hottext
6921
7027
 
6922
7028
  // ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
6923
7029
  import { html as html22 } from "lit";
6924
- import { property as property20, state as state9 } from "lit/decorators.js";
7030
+ import { property as property20, state as state10 } from "lit/decorators.js";
6925
7031
  import { consume as consume5 } from "@lit/context";
6926
7032
 
6927
7033
  // ../interactions/core/dist/mixins/menu-auto-size/menu-auto-size.mixin.js
@@ -7296,7 +7402,7 @@ var styles2 = own;
7296
7402
  var qti_inline_choice_interaction_styles_default = styles2;
7297
7403
 
7298
7404
  // ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
7299
- var __decorate21 = function(decorators, target, key, desc) {
7405
+ var __decorate22 = function(decorators, target, key, desc) {
7300
7406
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7301
7407
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7302
7408
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -7666,23 +7772,23 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
7666
7772
  return [...promptOption ? [promptOption] : [], ...slottedChoices];
7667
7773
  }
7668
7774
  };
7669
- __decorate21([
7670
- state9()
7775
+ __decorate22([
7776
+ state10()
7671
7777
  ], QtiInlineChoiceInteraction.prototype, "options", void 0);
7672
- __decorate21([
7673
- state9()
7778
+ __decorate22([
7779
+ state10()
7674
7780
  ], QtiInlineChoiceInteraction.prototype, "_dropdownOpen", void 0);
7675
- __decorate21([
7781
+ __decorate22([
7676
7782
  consume5({ context: configContext, subscribe: true }),
7677
7783
  property20({ attribute: false })
7678
7784
  ], QtiInlineChoiceInteraction.prototype, "configContext", void 0);
7679
- __decorate21([
7785
+ __decorate22([
7680
7786
  property20({ type: String, attribute: "data-prompt" })
7681
7787
  ], QtiInlineChoiceInteraction.prototype, "dataPrompt", void 0);
7682
- __decorate21([
7788
+ __decorate22([
7683
7789
  watch("dataPrompt", { waitUntilFirstUpdate: true })
7684
7790
  ], QtiInlineChoiceInteraction.prototype, "_handleDataPromptChange", void 0);
7685
- __decorate21([
7791
+ __decorate22([
7686
7792
  property20({
7687
7793
  type: Boolean,
7688
7794
  reflect: true,
@@ -7693,19 +7799,19 @@ __decorate21([
7693
7799
  }
7694
7800
  })
7695
7801
  ], QtiInlineChoiceInteraction.prototype, "required", void 0);
7696
- __decorate21([
7802
+ __decorate22([
7697
7803
  property20({ type: Number, attribute: "min-choices" })
7698
7804
  ], QtiInlineChoiceInteraction.prototype, "minChoices", void 0);
7699
- __decorate21([
7805
+ __decorate22([
7700
7806
  watch(["required", "minChoices"], { waitUntilFirstUpdate: true })
7701
7807
  ], QtiInlineChoiceInteraction.prototype, "_handleRequiredChange", void 0);
7702
- __decorate21([
7808
+ __decorate22([
7703
7809
  property20({ attribute: "response", reflect: false, noAccessor: true })
7704
7810
  ], QtiInlineChoiceInteraction.prototype, "response", null);
7705
7811
 
7706
7812
  // ../interactions/match-interaction/dist/qti-match-interaction.js
7707
7813
  import { html as html23, nothing as nothing3 } from "lit";
7708
- import { property as property21, state as state10 } from "lit/decorators.js";
7814
+ import { property as property21, state as state11 } from "lit/decorators.js";
7709
7815
 
7710
7816
  // ../interactions/match-interaction/dist/qti-match-interaction.styles.js
7711
7817
  import { css as css22 } from "lit";
@@ -7885,7 +7991,7 @@ var qti_match_interaction_tabular_styles_default = [
7885
7991
  ];
7886
7992
 
7887
7993
  // ../interactions/match-interaction/dist/qti-match-interaction.js
7888
- var __decorate22 = function(decorators, target, key, desc) {
7994
+ var __decorate23 = function(decorators, target, key, desc) {
7889
7995
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7890
7996
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7891
7997
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -8088,13 +8194,13 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
8088
8194
  `;
8089
8195
  }
8090
8196
  };
8091
- __decorate22([
8197
+ __decorate23([
8092
8198
  property21({ type: String })
8093
8199
  ], QtiMatchInteraction.prototype, "class", void 0);
8094
- __decorate22([
8095
- state10()
8200
+ __decorate23([
8201
+ state11()
8096
8202
  ], QtiMatchInteraction.prototype, "_response", void 0);
8097
- __decorate22([
8203
+ __decorate23([
8098
8204
  property21({ type: String, attribute: "response-identifier" })
8099
8205
  ], QtiMatchInteraction.prototype, "responseIdentifier", void 0);
8100
8206
 
@@ -8172,7 +8278,7 @@ var QtiMediaInteraction = class extends Interaction {
8172
8278
  // ../interactions/order-interaction/dist/qti-order-interaction.js
8173
8279
  import { html as html25 } from "lit";
8174
8280
  import { repeat as repeat6 } from "lit/directives/repeat.js";
8175
- import { property as property22, state as state11 } from "lit/decorators.js";
8281
+ import { property as property22, state as state12 } from "lit/decorators.js";
8176
8282
 
8177
8283
  // ../interactions/order-interaction/dist/qti-order-interaction.styles.js
8178
8284
  import { css as css25 } from "lit";
@@ -8394,7 +8500,7 @@ var qti_order_interaction_styles_default = [
8394
8500
  ];
8395
8501
 
8396
8502
  // ../interactions/order-interaction/dist/qti-order-interaction.js
8397
- var __decorate23 = function(decorators, target, key, desc) {
8503
+ var __decorate24 = function(decorators, target, key, desc) {
8398
8504
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8399
8505
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8400
8506
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -8453,18 +8559,21 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
8453
8559
  this.childrenMap = Array.from(this.querySelectorAll("qti-simple-choice"));
8454
8560
  }
8455
8561
  };
8456
- __decorate23([
8457
- state11()
8562
+ __decorate24([
8563
+ state12()
8458
8564
  ], QtiOrderInteraction.prototype, "nrChoices", void 0);
8459
- __decorate23([
8565
+ __decorate24([
8460
8566
  property22({ type: String })
8461
8567
  ], QtiOrderInteraction.prototype, "orientation", void 0);
8462
8568
 
8463
8569
  // ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
8464
8570
  import { css as css27, html as html26 } from "lit";
8465
- import { property as property23, state as state12 } from "lit/decorators.js";
8571
+ import { property as property23, state as state13 } from "lit/decorators.js";
8466
8572
  import { consume as consume6 } from "@lit/context";
8467
8573
 
8574
+ // ../qti-theme/dist/native-css.js
8575
+ var native_css_default = "@layer qti-base {\n/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */\n/* ============================\n QTI 3 shared css\n 1. Display\n 2. Special Flex styles\n 3. Margin\n 4. Padding\n 5. Horizontal Alignment styles\n 6. Vertical Alignment styles\n 7. Height\n 8. Width\n 9. Text-Indent\n 10. List Style\n 11. Layout\n 12. Other QTI 3 presentation utilities\n ============================ */\n\n/* ==========\n Display css\n =========== */\n\n.qti-display-inline {\n display: inline;\n}\n\n.qti-display-inline-block {\n display: inline-block;\n}\n\n.qti-display-block {\n display: block;\n}\n\n.qti-display-flex {\n display: flex;\n}\n\n.qti-display-inline-flex {\n display: inline-flex;\n}\n\n.qti-display-grid {\n display: grid;\n}\n\n.qti-display-inline-grid {\n display: inline-grid;\n}\n\n.qti-display-table {\n display: table;\n}\n\n.qti-display-table-cell {\n display: table-cell;\n}\n\n.qti-display-table-row {\n display: table-row;\n}\n\n.qti-display-list-item {\n display: list-item;\n}\n\n.qti-display-inherit {\n display: inherit;\n}\n\n/* \n * hidden to screen readers and sighted\n */\n.qti-hidden {\n display: none;\n}\n\n/*\n * visible to screen readers, hidden to sighted\n */\n.qti-visually-hidden {\n position: fixed !important;\n overflow: hidden;\n clip: rect(1px 1px 1px 1px);\n height: 1px;\n width: 1px;\n border: 0;\n margin: -1px;\n}\n\n/* =============================\n Special flex styles\n ============================= */\n\n.qti-flex-direction-column {\n flex-direction: column;\n}\n\n.qti-flex-direction-row {\n flex-direction: row;\n}\n\n.qti-flex-grow-1 {\n flex-grow: 1;\n}\n\n.qti-flex-grow-0 {\n flex-grow: 0;\n}\n\n/* =========\n Margin css\n ========== */\n\n/**\n * For margin Top and Bottom and Left and Right\n */\n.qti-margin-0 {\n margin: 0 !important;\n}\n\n.qti-margin-1 {\n margin: 0.25rem !important;\n}\n\n.qti-margin-2 {\n margin: 0.5rem !important;\n}\n\n.qti-margin-3 {\n margin: 1rem !important;\n}\n\n.qti-margin-4 {\n margin: 1.5rem !important;\n}\n\n.qti-margin-5 {\n margin: 3rem !important;\n}\n\n.qti-margin-auto {\n margin: auto !important;\n}\n\n/*\n For margin Left and Right\n */\n.qti-margin-x-0 {\n margin-right: 0 !important;\n margin-left: 0 !important;\n}\n\n.qti-margin-x-1 {\n margin-right: 0.25rem !important;\n margin-left: 0.25rem !important;\n}\n\n.qti-margin-x-2 {\n margin-right: 0.5rem !important;\n margin-left: 0.5rem !important;\n}\n\n.qti-margin-x-3 {\n margin-right: 1rem !important;\n margin-left: 1rem !important;\n}\n\n.qti-margin-x-4 {\n margin-right: 1.5rem !important;\n margin-left: 1.5rem !important;\n}\n\n.qti-margin-x-5 {\n margin-right: 3rem !important;\n margin-left: 3rem !important;\n}\n\n.qti-margin-x-auto {\n margin-right: auto !important;\n margin-left: auto !important;\n}\n\n/*\n For margin Top and Bottom\n */\n.qti-margin-y-0 {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n}\n\n.qti-margin-y-1 {\n margin-top: 0.25rem !important;\n margin-bottom: 0.25rem !important;\n}\n\n.qti-margin-y-2 {\n margin-top: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n}\n\n.qti-margin-y-3 {\n margin-top: 1rem !important;\n margin-bottom: 1rem !important;\n}\n\n.qti-margin-y-4 {\n margin-top: 1.5rem !important;\n margin-bottom: 1.5rem !important;\n}\n\n.qti-margin-y-5 {\n margin-top: 3rem !important;\n margin-bottom: 3rem !important;\n}\n\n.qti-margin-y-auto {\n margin-top: auto !important;\n margin-bottom: auto !important;\n}\n\n/*\n For margin Top\n */\n.qti-margin-t-0 {\n margin-top: 0 !important;\n}\n\n.qti-margin-t-1 {\n margin-top: 0.25rem !important;\n}\n\n.qti-margin-t-2 {\n margin-top: 0.5rem !important;\n}\n\n.qti-margin-t-3 {\n margin-top: 1rem !important;\n}\n\n.qti-margin-t-4 {\n margin-top: 1.5rem !important;\n}\n\n.qti-margin-t-5 {\n margin-top: 3rem !important;\n}\n\n.qti-margin-t-auto {\n margin-top: auto !important;\n}\n\n/* \n For margin Bottom\n */\n.qti-margin-b-0 {\n margin-bottom: 0 !important;\n}\n\n.qti-margin-b-1 {\n margin-bottom: 0.25rem !important;\n}\n\n.qti-margin-b-2 {\n margin-bottom: 0.5rem !important;\n}\n\n.qti-margin-b-3 {\n margin-bottom: 1rem !important;\n}\n\n.qti-margin-b-4 {\n margin-bottom: 1.5rem !important;\n}\n\n.qti-margin-b-5 {\n margin-bottom: 3rem !important;\n}\n\n.qti-margin-b-auto {\n margin-bottom: auto !important;\n}\n\n/*\n For margin Start LTR\n */\n.qti-margin-s-0 {\n margin-left: 0 !important;\n}\n\n.qti-margin-s-1 {\n margin-left: 0.25rem !important;\n}\n\n.qti-margin-s-2 {\n margin-left: 0.5rem !important;\n}\n\n.qti-margin-s-3 {\n margin-left: 1rem !important;\n}\n\n.qti-margin-s-4 {\n margin-left: 1.5rem !important;\n}\n\n.qti-margin-s-5 {\n margin-left: 3rem !important;\n}\n\n.qti-margin-s-auto {\n margin-left: auto !important;\n}\n\n/* \n For margin End LTR\n */\n.qti-margin-e-0 {\n margin-right: 0 !important;\n}\n\n.qti-margin-e-1 {\n margin-right: 0.25rem !important;\n}\n\n.qti-margin-e-2 {\n margin-right: 0.5rem !important;\n}\n\n.qti-margin-e-3 {\n margin-right: 1rem !important;\n}\n\n.qti-margin-e-4 {\n margin-right: 1.5rem !important;\n}\n\n.qti-margin-e-5 {\n margin-right: 3rem !important;\n}\n\n.qti-margin-e-auto {\n margin-right: auto !important;\n}\n\n/* =========\n Padding css\n ========== */\n\n/*\n For padding Top and Bottom and Left and Right\n */\n.qti-padding-0 {\n padding: 0 !important;\n}\n\n.qti-padding-1 {\n padding: 0.25rem !important;\n}\n\n.qti-padding-2 {\n padding: 0.5rem !important;\n}\n\n.qti-padding-3 {\n padding: 1rem !important;\n}\n\n.qti-padding-4 {\n padding: 1.5rem !important;\n}\n\n.qti-padding-5 {\n padding: 3rem !important;\n}\n\n/*\n For padding Left and Right\n */\n.qti-padding-x-0 {\n padding-right: 0 !important;\n padding-left: 0 !important;\n}\n\n.qti-padding-x-1 {\n padding-right: 0.25rem !important;\n padding-left: 0.25rem !important;\n}\n\n.qti-padding-x-2 {\n padding-right: 0.5rem !important;\n padding-left: 0.5rem !important;\n}\n\n.qti-padding-x-3 {\n padding-right: 1rem !important;\n padding-left: 1rem !important;\n}\n\n.qti-padding-x-4 {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n}\n\n.qti-padding-x-5 {\n padding-right: 3rem !important;\n padding-left: 3rem !important;\n}\n\n/*\n For padding Top and Bottom\n */\n.qti-padding-y-0 {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n\n.qti-padding-y-1 {\n padding-top: 0.25rem !important;\n padding-bottom: 0.25rem !important;\n}\n\n.qti-padding-y-2 {\n padding-top: 0.5rem !important;\n padding-bottom: 0.5rem !important;\n}\n\n.qti-padding-y-3 {\n padding-top: 1rem !important;\n padding-bottom: 1rem !important;\n}\n\n.qti-padding-y-4 {\n padding-top: 1.5rem !important;\n padding-bottom: 1.5rem !important;\n}\n\n.qti-padding-y-5 {\n padding-top: 3rem !important;\n padding-bottom: 3rem !important;\n}\n\n/*\n For padding Top\n */\n.qti-padding-t-0 {\n padding-top: 0 !important;\n}\n\n.qti-padding-t-1 {\n padding-top: 0.25rem !important;\n}\n\n.qti-padding-t-2 {\n padding-top: 0.5rem !important;\n}\n\n.qti-padding-t-3 {\n padding-top: 1rem !important;\n}\n\n.qti-padding-t-4 {\n padding-top: 1.5rem !important;\n}\n\n.qti-padding-t-5 {\n padding-top: 3rem !important;\n}\n\n/*\n For padding Bottom\n */\n.qti-padding-b-0 {\n padding-bottom: 0 !important;\n}\n\n.qti-padding-b-1 {\n padding-bottom: 0.25rem !important;\n}\n\n.qti-padding-b-2 {\n padding-bottom: 0.5rem !important;\n}\n\n.qti-padding-b-3 {\n padding-bottom: 1rem !important;\n}\n\n.qti-padding-b-4 {\n padding-bottom: 1.5rem !important;\n}\n\n.qti-padding-b-5 {\n padding-bottom: 3rem !important;\n}\n\n/*\n For padding Start LTR\n */\n.qti-padding-s-0 {\n padding-left: 0 !important;\n}\n\n.qti-padding-s-1 {\n padding-left: 0.25rem !important;\n}\n\n.qti-padding-s-2 {\n padding-left: 0.5rem !important;\n}\n\n.qti-padding-s-3 {\n padding-left: 1rem !important;\n}\n\n.qti-padding-s-4 {\n padding-left: 1.5rem !important;\n}\n\n.qti-padding-s-5 {\n padding-left: 3rem !important;\n}\n\n/*\n For padding End LTR\n */\n.qti-padding-e-0 {\n padding-right: 0 !important;\n}\n\n.qti-padding-e-1 {\n padding-right: 0.25rem !important;\n}\n\n.qti-padding-e-2 {\n padding-right: 0.5rem !important;\n}\n\n.qti-padding-e-3 {\n padding-right: 1rem !important;\n}\n\n.qti-padding-e-4 {\n padding-right: 1.5rem !important;\n}\n\n.qti-padding-e-5 {\n padding-right: 3rem !important;\n}\n\n/* ====================\n Horizontal alignment\n ==================== */\n\n.qti-align-left {\n text-align: left;\n}\n\n.qti-align-center {\n text-align: center;\n}\n\n.qti-align-right {\n text-align: right;\n}\n\n/* ==================\n Vertical alignment\n ================== */\n\n.qti-valign-top {\n vertical-align: top;\n}\n\n.qti-valign-middle {\n vertical-align: middle;\n}\n\n.qti-valign-baseline {\n vertical-align: baseline;\n}\n\n.qti-valign-bottom {\n vertical-align: bottom;\n}\n\n/* =============\n Height styles\n ============= */\n\n.qti-height-0 {\n height: 0;\n}\n\n.qti-height-px {\n height: 1px;\n}\n\n.qti-height-0p5 {\n height: 0.125rem;\n}\n\n.qti-height-1 {\n height: 0.25rem;\n}\n\n.qti-height-1p5 {\n height: 0.375rem;\n}\n\n.qti-height-2 {\n height: 0.5rem;\n}\n\n.qti-height-2p5 {\n height: 0.625rem;\n}\n\n.qti-height-3 {\n height: 0.75rem;\n}\n\n.qti-height-3p5 {\n height: 0.875rem;\n}\n\n.qti-height-4 {\n height: 1rem;\n}\n\n.qti-height-5 {\n height: 1.25rem;\n}\n\n.qti-height-6 {\n height: 1.5rem;\n}\n\n.qti-height-7 {\n height: 1.75rem;\n}\n\n.qti-height-8 {\n height: 2rem;\n}\n\n.qti-height-9 {\n height: 2.25rem;\n}\n\n.qti-height-10 {\n height: 2.5rem;\n}\n\n.qti-height-11 {\n height: 2.75rem;\n}\n\n.qti-height-12 {\n height: 3rem;\n}\n\n.qti-height-14 {\n height: 3.5rem;\n}\n\n.qti-height-16 {\n height: 4rem;\n}\n\n.qti-height-20 {\n height: 5rem;\n}\n\n.qti-height-24 {\n height: 6rem;\n}\n\n.qti-height-28 {\n height: 7rem;\n}\n\n.qti-height-32 {\n height: 8rem;\n}\n\n.qti-height-36 {\n height: 9rem;\n}\n\n.qti-height-40 {\n height: 10rem;\n}\n\n.qti-height-44 {\n height: 11rem;\n}\n\n.qti-height-48 {\n height: 12rem;\n}\n\n.qti-height-52 {\n height: 13rem;\n}\n\n.qti-height-56 {\n height: 14rem;\n}\n\n.qti-height-60 {\n height: 15rem;\n}\n\n.qti-height-64 {\n height: 16rem;\n}\n\n.qti-height-72 {\n height: 18rem;\n}\n\n.qti-height-80 {\n height: 20rem;\n}\n\n.qti-height-96 {\n height: 24rem;\n}\n\n.qti-height-1-2 {\n height: 50%;\n}\n\n.qti-height-1-3 {\n height: 33.3333%;\n}\n\n.qti-height-2-3 {\n height: 66.6667%;\n}\n\n.qti-height-1-4 {\n height: 25%;\n}\n\n.qti-height-2-4 {\n height: 50%;\n}\n\n.qti-height-3-4 {\n height: 75%;\n}\n\n.qti-height-1-5 {\n height: 20%;\n}\n\n.qti-height-2-5 {\n height: 40%;\n}\n\n.qti-height-3-5 {\n height: 60%;\n}\n\n.qti-height-4-5 {\n height: 80%;\n}\n\n.qti-height-1-6 {\n height: 16.6667%;\n}\n\n.qti-height-2-6 {\n height: 33.3333%;\n}\n\n.qti-height-3-6 {\n height: 50%;\n}\n\n.qti-height-4-6 {\n height: 66.6667%;\n}\n\n.qti-height-5-6 {\n height: 83.3333%;\n}\n\n.qti-height-auto {\n height: auto;\n}\n\n.qti-height-full {\n height: 100%;\n}\n\n/* ============\n Width styles\n ============ */\n\n.qti-width-0 {\n width: 0;\n}\n\n.qti-width-px {\n width: 1px;\n}\n\n.qti-width-0p5 {\n width: 0.125rem;\n}\n\n.qti-width-1 {\n width: 0.25rem;\n}\n\n.qti-width-1p5 {\n width: 0.375rem;\n}\n\n.qti-width-2 {\n width: 0.5rem;\n}\n\n.qti-width-2p5 {\n width: 0.625rem;\n}\n\n.qti-width-3 {\n width: 0.75rem;\n}\n\n.qti-width-3p5 {\n width: 0.875rem;\n}\n\n.qti-width-4 {\n width: 1rem;\n}\n\n.qti-width-5 {\n width: 1.25rem;\n}\n\n.qti-width-6 {\n width: 1.5rem;\n}\n\n.qti-width-7 {\n width: 1.75rem;\n}\n\n.qti-width-8 {\n width: 2rem;\n}\n\n.qti-width-9 {\n width: 2.25rem;\n}\n\n.qti-width-10 {\n width: 2.5rem;\n}\n\n.qti-width-11 {\n width: 2.75rem;\n}\n\n.qti-width-12 {\n width: 3rem;\n}\n\n.qti-width-14 {\n width: 3.5rem;\n}\n\n.qti-width-16 {\n width: 4rem;\n}\n\n.qti-width-20 {\n width: 5rem;\n}\n\n.qti-width-24 {\n width: 6rem;\n}\n\n.qti-width-28 {\n width: 7rem;\n}\n\n.qti-width-32 {\n width: 8rem;\n}\n\n.qti-width-36 {\n width: 9rem;\n}\n\n.qti-width-40 {\n width: 10rem;\n}\n\n.qti-width-44 {\n width: 11rem;\n}\n\n.qti-width-48 {\n width: 12rem;\n}\n\n.qti-width-52 {\n width: 13rem;\n}\n\n.qti-width-56 {\n width: 14rem;\n}\n\n.qti-width-60 {\n width: 15rem;\n}\n\n.qti-width-64 {\n width: 16rem;\n}\n\n.qti-width-72 {\n width: 18rem;\n}\n\n.qti-width-80 {\n width: 20rem;\n}\n\n.qti-width-96 {\n width: 24rem;\n}\n\n.qti-width-auto {\n width: auto;\n}\n\n.qti-width-1-2 {\n width: 50%;\n}\n\n.qti-width-1-3 {\n width: 33.3333%;\n}\n\n.qti-width-2-3 {\n width: 66.6667%;\n}\n\n.qti-width-1-4 {\n width: 25%;\n}\n\n.qti-width-2-4 {\n width: 50%;\n}\n\n.qti-width-3-4 {\n width: 75%;\n}\n\n.qti-width-1-5 {\n width: 20%;\n}\n\n.qti-width-2-5 {\n width: 40%;\n}\n\n.qti-width-3-5 {\n width: 60%;\n}\n\n.qti-width-4-5 {\n width: 80%;\n}\n\n.qti-width-1-6 {\n width: 16.6667%;\n}\n\n.qti-width-2-6 {\n width: 33.3333%;\n}\n\n.qti-width-3-6 {\n width: 50%;\n}\n\n.qti-width-4-6 {\n width: 66.6667%;\n}\n\n.qti-width-5-6 {\n width: 83.3333%;\n}\n\n.qti-width-1-12 {\n width: 8.3333%;\n}\n\n.qti-width-2-12 {\n width: 16.6667%;\n}\n\n.qti-width-3-12 {\n width: 25%;\n}\n\n.qti-width-4-12 {\n width: 33.3333%;\n}\n\n.qti-width-5-12 {\n width: 41.6667%;\n}\n\n.qti-width-6-12 {\n width: 50%;\n}\n\n.qti-width-7-12 {\n width: 58.3333%;\n}\n\n.qti-width-8-12 {\n width: 66.6667%;\n}\n\n.qti-width-9-12 {\n width: 75%;\n}\n\n.qti-width-10-12 {\n width: 83.3333%;\n}\n\n.qti-width-11-12 {\n width: 91.6667%;\n}\n\n.qti-width-full,\n.qti-fullwidth {\n width: 100%;\n}\n\n/* ==================\n Text Indent styles\n ================== */\n\n.qti-text-indent-0 {\n text-indent: 0;\n}\n\n.qti-text-indent-px {\n text-indent: 1px;\n}\n\n.qti-text-indent-0p5 {\n text-indent: 0.125rem;\n}\n\n.qti-text-indent-1 {\n text-indent: 0.25rem;\n}\n\n.qti-text-indent-1p5 {\n text-indent: 0.375rem;\n}\n\n.qti-text-indent-2 {\n text-indent: 0.5rem;\n}\n\n.qti-text-indent-2p5 {\n text-indent: 0.625rem;\n}\n\n.qti-text-indent-3 {\n text-indent: 0.75rem;\n}\n\n.qti-text-indent-3p5 {\n text-indent: 0.875rem;\n}\n\n.qti-text-indent-4 {\n text-indent: 1rem;\n}\n\n.qti-text-indent-5 {\n text-indent: 1.25rem;\n}\n\n.qti-text-indent-6 {\n text-indent: 1.5rem;\n}\n\n.qti-text-indent-7 {\n text-indent: 1.75rem;\n}\n\n.qti-text-indent-8 {\n text-indent: 2rem;\n}\n\n.qti-text-indent-12 {\n text-indent: 3rem;\n}\n\n.qti-text-indent-16 {\n text-indent: 4rem;\n}\n\n.qti-text-indent-20 {\n text-indent: 5rem;\n}\n\n.qti-text-indent-24 {\n text-indent: 6rem;\n}\n\n.qti-text-indent-28 {\n text-indent: 7rem;\n}\n\n.qti-text-indent-32 {\n text-indent: 8rem;\n}\n\n/* =================\n List Style styles\n ================= */\n\n.qti-list-style-type-none {\n list-style-type: none;\n}\n\n.qti-list-style-type-disc {\n list-style-type: disc;\n}\n\n.qti-list-style-type-circle {\n list-style-type: circle;\n}\n\n.qti-list-style-type-square {\n list-style-type: square;\n}\n\n.qti-list-style-type-decimal {\n list-style-type: decimal;\n}\n\n.qti-list-style-type-decimal-leading-zero {\n list-style-type: decimal-leading-zero;\n}\n\n.qti-list-style-type-lower-alpha {\n list-style-type: lower-alpha;\n}\n\n.qti-list-style-type-upper-alpha {\n list-style-type: upper-alpha;\n}\n\n.qti-list-style-type-lower-roman {\n list-style-type: lower-roman;\n}\n\n.qti-list-style-type-upper-roman {\n list-style-type: upper-roman;\n}\n\n.qti-list-style-type-lower-latin {\n list-style-type: lower-latin;\n}\n\n.qti-list-style-type-upper-latin {\n list-style-type: upper-latin;\n}\n\n.qti-list-style-type-lower-greek {\n list-style-type: lower-greek;\n}\n\n.qti-list-style-type-arabic-indic {\n list-style-type: arabic-indic;\n}\n\n.qti-list-style-type-armenian {\n list-style-type: armenian;\n}\n\n.qti-list-style-type-lower-armenian {\n list-style-type: lower-armenian;\n}\n\n.qti-list-style-type-upper-armenian {\n list-style-type: upper-armenian;\n}\n\n.qti-list-style-type-bengali {\n list-style-type: bengali;\n}\n\n.qti-list-style-type-cambodian {\n list-style-type: cambodian;\n}\n\n.qti-list-style-type-simp-chinese-formal {\n list-style-type: simp-chinese-formal;\n}\n\n.qti-list-style-type-simp-chinese-informal {\n list-style-type: simp-chinese-informal;\n}\n\n.qti-list-style-type-trad-chinese-formal {\n list-style-type: trad-chinese-formal;\n}\n\n.qti-list-style-type-trad-chinese-informal {\n list-style-type: trad-chinese-informal;\n}\n\n.qti-list-style-type-cjk-ideographic {\n list-style-type: cjk-ideographic;\n}\n\n.qti-list-style-type-cjk-heavenly-stem {\n list-style-type: cjk-heavenly-stem;\n}\n\n.qti-list-style-type-cjk-earthly-branch {\n list-style-type: cjk-earthly-branch;\n}\n\n.qti-list-style-type-devanagari {\n list-style-type: devanagari;\n}\n\n.qti-list-style-type-ethiopic-halehame-ti-er {\n list-style-type: ethiopic-halehame-ti-er;\n}\n\n.qti-list-style-type-ethiopic-halehame-ti-et {\n list-style-type: ethiopic-halehame-ti-et;\n}\n\n.qti-list-style-type-ethiopic-halehame-am {\n list-style-type: ethiopic-halehame-am;\n}\n\n.qti-list-style-type-ethiopic-halehame {\n list-style-type: ethiopic-halehame;\n}\n\n.qti-list-style-type-georgian {\n list-style-type: georgian;\n}\n\n.qti-list-style-type-gujarati {\n list-style-type: gujarati;\n}\n\n.qti-list-style-type-gurmukhi {\n list-style-type: gurmukhi;\n}\n\n.qti-list-style-type-hangul {\n list-style-type: hangul;\n}\n\n.qti-list-style-type-hangul-consonant {\n list-style-type: hangul-consonant;\n}\n\n.qti-list-style-type-hebrew {\n list-style-type: hebrew;\n}\n\n.qti-list-style-type-hiragana {\n list-style-type: hiragana;\n}\n\n.qti-list-style-type-hiragana-iroha {\n list-style-type: hiragana-iroha;\n}\n\n.qti-list-style-type-khmer {\n list-style-type: khmer;\n}\n\n.qti-list-style-type-korean-hangul-formal {\n list-style-type: korean-hangul-formal;\n}\n\n.qti-list-style-type-korean-hanja-formal {\n list-style-type: korean-hanja-formal;\n}\n\n.qti-list-style-type-korean-hanja-informal {\n list-style-type: korean-hanja-informal;\n}\n\n.qti-list-style-type-lao {\n list-style-type: lao;\n}\n\n.qti-list-style-type-malayalam {\n list-style-type: malayalam;\n}\n\n.qti-list-style-type-mongolian {\n list-style-type: mongolian;\n}\n\n.qti-list-style-type-myanmar {\n list-style-type: myanmar;\n}\n\n.qti-list-style-type-oriya {\n list-style-type: oriya;\n}\n\n.qti-list-style-type-persian {\n list-style-type: persian;\n}\n\n.qti-list-style-type-thai {\n list-style-type: thai;\n}\n\n.qti-list-style-type-tibetan {\n list-style-type: tibetan;\n}\n\n.qti-list-style-type-telugu {\n list-style-type: telugu;\n}\n\n.qti-list-style-type-urdu {\n list-style-type: urdu;\n}\n\n/* =========================\n Other QTI 3 Presentation Utilities\n ========================= */\n\n.qti-bordered {\n border: 1px solid var(--table-border-color);\n}\n\n.qti-underline {\n text-decoration: underline;\n text-decoration-color: var(--foreground);\n}\n\n.qti-italic {\n font-style: italic;\n}\n\n.qti-well {\n min-height: 20px;\n padding: 19px;\n margin-bottom: 20px;\n background-color: var(--well-bg);\n border: var(--well-border);\n border-radius: 4px;\n box-shadow: var(--well-box-shadow);\n}\n\n/* Set writing-mode to vertical-rl \n Typical for CJK vertical text */\n.qti-writing-mode-vertical-rl {\n writing-mode: vertical-rl;\n}\n\n/* Set writing-mode to vertical-lr\n Typical for Mongolian vertical text */\n.qti-writing-mode-vertical-lr {\n writing-mode: vertical-lr;\n}\n\n/* Set writing-mode to horizontal-tb \n Browser default */\n.qti-writing-mode-horizontal-tb {\n writing-mode: horizontal-tb;\n}\n\n/* Float an element left */\n.qti-float-left {\n float: left;\n}\n\n/* Float an element right */\n.qti-float-right {\n float: right;\n}\n\n/* Remove a float */\n.qti-float-none {\n float: none;\n}\n\n/* Clearfix Hack to apply to a container of \n floated content that overflows the container. */\n.qti-float-clearfix::after {\n content: '';\n clear: both;\n display: table;\n}\n\n.qti-float-clear-left\n .qti-float-clear-right\n .qti-float-clear-both\n \n /* Set text-orientation to upright */\n .qti-text-orientation-upright {\n text-orientation: upright;\n}\n}\n\n@layer qti-base {\n\n.qti-layout-row {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n gap: 2.1276595745%;\n}\n\n.qti-layout-row [class*='qti-layout-col']:not(:empty) {\n box-sizing: border-box;\n}\n\n.qti-layout-row [class*='qti-layout-col']:empty {\n width: 0;\n overflow: hidden; /* to fully collapse if there\u2019s padding or borders */\n}\n\n.qti-layout-col1 {\n width: 6.3829787234%;\n}\n\n.qti-layout-col2 {\n width: 14.8936170213%;\n}\n\n.qti-layout-col3 {\n width: 23.4042553191%;\n}\n\n.qti-layout-col4 {\n width: 31.914893617%;\n}\n\n.qti-layout-col5 {\n width: 40.4255319149%;\n}\n\n.qti-layout-col6 {\n width: 48.9361702128%;\n}\n\n.qti-layout-col7 {\n width: 57.4468085106%;\n}\n\n.qti-layout-col8 {\n width: 65.9574468085%;\n}\n\n.qti-layout-col9 {\n width: 74.4680851064%;\n}\n\n.qti-layout-col10 {\n width: 82.9787234043%;\n}\n\n.qti-layout-col11 {\n width: 91.4893617021%;\n}\n\n.qti-layout-col12 {\n width: 100%;\n}\n\n.qti-layout-offset1 {\n margin-left: 8.5106382979%;\n}\n\n.qti-layout-offset2 {\n margin-left: 17.0212765957%;\n}\n\n.qti-layout-offset3 {\n margin-left: 25.5319148936%;\n}\n\n.qti-layout-offset4 {\n margin-left: 34.0425531915%;\n}\n\n.qti-layout-offset5 {\n margin-left: 42.5531914894%;\n}\n\n.qti-layout-offset6 {\n margin-left: 51.0638297872%;\n}\n\n.qti-layout-offset7 {\n margin-left: 59.5744680851%;\n}\n\n.qti-layout-offset8 {\n margin-left: 68.085106383%;\n}\n\n.qti-layout-offset9 {\n margin-left: 76.5957446809%;\n}\n\n.qti-layout-offset10 {\n margin-left: 85.1063829787%;\n}\n\n.qti-layout-offset11 {\n margin-left: 93.6170212766%;\n}\n\n@media (width <= 767px) {\n [class*='qti-layout-col'] {\n width: 100%;\n }\n}\n}\n";
8576
+
8468
8577
  // ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.styles.js
8469
8578
  import { css as css26 } from "lit";
8470
8579
  var qti_portable_custom_interaction_styles_default = [
@@ -8482,18 +8591,179 @@ var qti_portable_custom_interaction_styles_default = [
8482
8591
  `
8483
8592
  ];
8484
8593
 
8594
+ // ../interactions/portable-custom-interaction/dist/record-response.js
8595
+ var PAIR_BASE_TYPES = /* @__PURE__ */ new Set(["point", "pair", "directedPair"]);
8596
+ var coerceBaseValue = (value, baseType) => {
8597
+ if (value === null || value === void 0)
8598
+ return value;
8599
+ switch (baseType) {
8600
+ case "integer": {
8601
+ if (typeof value === "number")
8602
+ return value;
8603
+ const parsed = parseInt(String(value), 10);
8604
+ return Number.isNaN(parsed) ? value : parsed;
8605
+ }
8606
+ case "float":
8607
+ case "duration": {
8608
+ if (typeof value === "number")
8609
+ return value;
8610
+ const parsed = parseFloat(String(value));
8611
+ return Number.isNaN(parsed) ? value : parsed;
8612
+ }
8613
+ case "boolean": {
8614
+ if (typeof value === "boolean")
8615
+ return value;
8616
+ if (typeof value === "string") {
8617
+ const lowered = value.toLowerCase();
8618
+ if (lowered === "true")
8619
+ return true;
8620
+ if (lowered === "false")
8621
+ return false;
8622
+ }
8623
+ return value;
8624
+ }
8625
+ case "point": {
8626
+ const parts = Array.isArray(value) ? value : String(value).trim().split(/[\s,]+/);
8627
+ const numbers = parts.map((part) => typeof part === "number" ? part : parseFloat(String(part)));
8628
+ return numbers.length === 2 && numbers.every(Number.isFinite) ? numbers : value;
8629
+ }
8630
+ case "pair":
8631
+ case "directedPair": {
8632
+ const parts = Array.isArray(value) ? value : String(value).trim().split(/\s+/);
8633
+ return parts.length === 2 ? parts.map(String) : value;
8634
+ }
8635
+ case "string":
8636
+ case "identifier":
8637
+ default:
8638
+ return String(value);
8639
+ }
8640
+ };
8641
+ var recordEntryFromValue = (name, entryValue, baseType) => {
8642
+ if (baseType) {
8643
+ if (Array.isArray(entryValue) && !PAIR_BASE_TYPES.has(baseType)) {
8644
+ return { name, list: { [baseType]: entryValue.map((v) => coerceBaseValue(v, baseType)) } };
8645
+ }
8646
+ if (entryValue === null || entryValue === void 0) {
8647
+ return { name, base: null };
8648
+ }
8649
+ return { name, base: { [baseType]: coerceBaseValue(entryValue, baseType) } };
8650
+ }
8651
+ if (Array.isArray(entryValue)) {
8652
+ const filtered = entryValue.filter((v) => v !== null && v !== void 0);
8653
+ if (filtered.length && filtered.every((v) => typeof v === "boolean")) {
8654
+ return { name, list: { boolean: filtered } };
8655
+ }
8656
+ if (filtered.length && filtered.every((v) => typeof v === "number")) {
8657
+ const numbers = filtered;
8658
+ const isIntegers = numbers.every((n) => Number.isInteger(n));
8659
+ return { name, list: { [isIntegers ? "integer" : "float"]: numbers } };
8660
+ }
8661
+ return { name, list: { string: entryValue.map((v) => v === null || v === void 0 ? "" : String(v)) } };
8662
+ }
8663
+ if (typeof entryValue === "boolean") {
8664
+ return { name, base: { boolean: entryValue } };
8665
+ }
8666
+ if (typeof entryValue === "number") {
8667
+ if (Number.isInteger(entryValue))
8668
+ return { name, base: { integer: entryValue } };
8669
+ return { name, base: { float: entryValue } };
8670
+ }
8671
+ if (entryValue === null || entryValue === void 0) {
8672
+ return { name, base: { string: "" } };
8673
+ }
8674
+ if (typeof entryValue === "object") {
8675
+ try {
8676
+ return { name, base: { string: JSON.stringify(entryValue) } };
8677
+ } catch {
8678
+ return { name, base: { string: String(entryValue) } };
8679
+ }
8680
+ }
8681
+ return { name, base: { string: String(entryValue) } };
8682
+ };
8683
+ var recordToQtiVariableJSON = (value, fieldBaseTypes = {}) => {
8684
+ if (!isRecordValue(value)) {
8685
+ return { record: [] };
8686
+ }
8687
+ const recordEntries = [];
8688
+ for (const [name, entryValue] of Object.entries(value)) {
8689
+ recordEntries.push(recordEntryFromValue(name, entryValue, fieldBaseTypes[name]));
8690
+ }
8691
+ return { record: recordEntries };
8692
+ };
8693
+ var recordFieldBaseTypes = (value, declared = {}) => {
8694
+ if (!isRecordValue(value))
8695
+ return { ...declared };
8696
+ const baseTypes = {};
8697
+ for (const [name, entryValue] of Object.entries(value)) {
8698
+ baseTypes[name] = declared[name] ?? inferRecordFieldBaseType(Array.isArray(entryValue) ? entryValue[0] : entryValue);
8699
+ }
8700
+ return baseTypes;
8701
+ };
8702
+ var recordResponseToQtiVariableJSON = (value, declared = {}) => recordToQtiVariableJSON(value, recordFieldBaseTypes(value, declared));
8703
+ var toQtiLiteral = (value) => {
8704
+ if (value === null || value === void 0)
8705
+ return null;
8706
+ if (Array.isArray(value))
8707
+ return value.map(String).join(" ");
8708
+ if (typeof value === "object") {
8709
+ try {
8710
+ return JSON.stringify(value);
8711
+ } catch {
8712
+ return String(value);
8713
+ }
8714
+ }
8715
+ return String(value);
8716
+ };
8717
+ var firstTypedValue = (typed) => {
8718
+ if (!typed)
8719
+ return void 0;
8720
+ for (const key of Object.keys(typed)) {
8721
+ const value = typed[key];
8722
+ if (value !== void 0 && value !== null)
8723
+ return value;
8724
+ }
8725
+ return void 0;
8726
+ };
8727
+ var recordFromQtiVariableJSON = (record) => {
8728
+ const value = {};
8729
+ for (const entry of record) {
8730
+ if (!entry || typeof entry.name !== "string" || !entry.name)
8731
+ continue;
8732
+ if (entry.list) {
8733
+ const items = firstTypedValue(entry.list);
8734
+ value[entry.name] = Array.isArray(items) ? items.map(toQtiLiteral).filter((v) => v !== null) : [];
8735
+ } else {
8736
+ value[entry.name] = toQtiLiteral(firstTypedValue(entry.base));
8737
+ }
8738
+ }
8739
+ return value;
8740
+ };
8741
+
8742
+ // ../interactions/portable-custom-interaction/dist/vendor/require-js.js
8743
+ var require_js_default = `/** vim: et:ts=4:sw=4:sts=4
8744
+ * @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
8745
+ * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
8746
+ */var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
8747
+ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;
8748
+
8485
8749
  // ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
8486
- var __decorate24 = function(decorators, target, key, desc) {
8750
+ var __decorate25 = function(decorators, target, key, desc) {
8487
8751
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8488
8752
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8489
8753
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8490
8754
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8491
8755
  };
8756
+ var inlineScriptText = (text) => text.replace(/<\/(script)/gi, "<\\/$1");
8757
+ var inlineStyleText = (text) => text.replace(/<\/(style)/gi, "<\\/$1");
8492
8758
  var STATUSES_SHOWING_CORRECT_RESPONSE = ["solution", "review"];
8493
8759
  function hasCorrectResponseValue(value) {
8494
8760
  if (value === null || value === void 0)
8495
8761
  return false;
8496
- return Array.isArray(value) ? value.length > 0 : value !== "";
8762
+ if (Array.isArray(value))
8763
+ return value.length > 0;
8764
+ if (isRecordValue(value))
8765
+ return Object.keys(value).length > 0;
8766
+ return value !== "";
8497
8767
  }
8498
8768
  var QtiPortableCustomInteraction = class extends Interaction {
8499
8769
  constructor() {
@@ -8504,7 +8774,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
8504
8774
  this._iframeMessageOrigin = null;
8505
8775
  this.requirePathsJson = "";
8506
8776
  this.requireShimJson = "";
8507
- this.requireJsUrl = "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";
8777
+ this.requireJsUrl = "";
8508
8778
  this.baseUrl = "";
8509
8779
  this.useDefaultPaths = false;
8510
8780
  this.status = "interacting";
@@ -8570,30 +8840,32 @@ var QtiPortableCustomInteraction = class extends Interaction {
8570
8840
  this.#pciCustomValidityMessage = pciCustomValidity;
8571
8841
  }
8572
8842
  const stateRaw = data?.params?.state;
8573
- let state14;
8843
+ let state15;
8574
8844
  if (stateRaw === void 0) {
8575
- state14 = void 0;
8845
+ state15 = void 0;
8576
8846
  } else if (stateRaw === null) {
8577
- state14 = null;
8847
+ state15 = null;
8578
8848
  } else if (typeof stateRaw === "string") {
8579
- state14 = stateRaw;
8849
+ state15 = stateRaw;
8580
8850
  } else {
8581
8851
  try {
8582
- state14 = `__qti_json__::${JSON.stringify(stateRaw)}`;
8852
+ state15 = `__qti_json__::${JSON.stringify(stateRaw)}`;
8583
8853
  } catch {
8584
- state14 = null;
8854
+ state15 = null;
8585
8855
  }
8586
8856
  }
8587
8857
  if (converted === null) {
8588
- const emptyResponse = this.responseVariable?.cardinality === "single" ? "" : [];
8858
+ const cardinality = this.responseVariable?.cardinality;
8859
+ const emptyResponse = cardinality === "record" ? null : cardinality === "single" ? "" : [];
8589
8860
  this.response = emptyResponse;
8590
8861
  this.validate();
8591
- this.saveResponse(emptyResponse, state14);
8862
+ this.saveResponse(emptyResponse, state15);
8592
8863
  break;
8593
8864
  }
8594
- this.response = converted;
8865
+ const response = converted;
8866
+ this.response = response;
8595
8867
  this.validate();
8596
- this.saveResponse(converted, state14);
8868
+ this.saveResponse(response, state15);
8597
8869
  break;
8598
8870
  }
8599
8871
  case "error":
@@ -8721,9 +8993,13 @@ var QtiPortableCustomInteraction = class extends Interaction {
8721
8993
  return this.#getRequireShim();
8722
8994
  }
8723
8995
  /**
8724
- * Converts QtiVariableJSON to a string or string array
8996
+ * Converts QtiVariableJSON to a string, a string array, or for a record its field map
8725
8997
  */
8726
8998
  #convertQtiVariableJSON(input) {
8999
+ if (input && Array.isArray(input.record)) {
9000
+ const record = recordFromQtiVariableJSON(input.record);
9001
+ return Object.keys(record).length ? record : null;
9002
+ }
8727
9003
  for (const topLevelKey in input) {
8728
9004
  if (input.hasOwnProperty(topLevelKey)) {
8729
9005
  const nestedObject = input[topLevelKey];
@@ -8750,44 +9026,6 @@ var QtiPortableCustomInteraction = class extends Interaction {
8750
9026
  const needle = tagName.toLowerCase();
8751
9027
  return Array.from(this.children).filter((child) => child.tagName.toLowerCase() === needle);
8752
9028
  }
8753
- /**
8754
- * Coerce a scalar value to the expected base-type when possible
8755
- */
8756
- coerceBaseValue(value, baseType) {
8757
- if (value === null || value === void 0)
8758
- return value;
8759
- switch (baseType) {
8760
- case "integer": {
8761
- if (typeof value === "number")
8762
- return value;
8763
- const parsed = parseInt(String(value), 10);
8764
- return Number.isNaN(parsed) ? value : parsed;
8765
- }
8766
- case "float":
8767
- case "duration": {
8768
- if (typeof value === "number")
8769
- return value;
8770
- const parsed = parseFloat(String(value));
8771
- return Number.isNaN(parsed) ? value : parsed;
8772
- }
8773
- case "boolean": {
8774
- if (typeof value === "boolean")
8775
- return value;
8776
- if (typeof value === "string") {
8777
- const lowered = value.toLowerCase();
8778
- if (lowered === "true")
8779
- return true;
8780
- if (lowered === "false")
8781
- return false;
8782
- }
8783
- return value;
8784
- }
8785
- case "string":
8786
- case "identifier":
8787
- default:
8788
- return String(value);
8789
- }
8790
- }
8791
9029
  /**
8792
9030
  * Normalize an input into a list form
8793
9031
  */
@@ -8801,62 +9039,13 @@ var QtiPortableCustomInteraction = class extends Interaction {
8801
9039
  */
8802
9040
  variableToQtiVariableJSON(value, cardinality, baseType) {
8803
9041
  if (cardinality === "record" || baseType === "record") {
8804
- return this.recordToQtiVariableJSON(value);
9042
+ return recordToQtiVariableJSON(value);
8805
9043
  }
8806
9044
  if (cardinality !== "single") {
8807
- const listValues = this.normalizeListValue(value).map((v) => this.coerceBaseValue(v, baseType));
9045
+ const listValues = this.normalizeListValue(value).map((v) => coerceBaseValue(v, baseType));
8808
9046
  return { list: { [baseType]: listValues } };
8809
9047
  }
8810
- return { base: { [baseType]: this.coerceBaseValue(value, baseType) } };
8811
- }
8812
- /**
8813
- * Convert a record object into QtiVariableJSON
8814
- */
8815
- recordToQtiVariableJSON(value) {
8816
- if (!value || typeof value !== "object") {
8817
- return { record: [] };
8818
- }
8819
- const recordEntries = [];
8820
- for (const [name, entryValue] of Object.entries(value)) {
8821
- recordEntries.push(this.recordEntryFromValue(name, entryValue));
8822
- }
8823
- return { record: recordEntries };
8824
- }
8825
- /**
8826
- * Build a record entry from an arbitrary value
8827
- */
8828
- recordEntryFromValue(name, entryValue) {
8829
- if (Array.isArray(entryValue)) {
8830
- const filtered = entryValue.filter((v) => v !== null && v !== void 0);
8831
- if (filtered.length && filtered.every((v) => typeof v === "boolean")) {
8832
- return { name, list: { boolean: filtered } };
8833
- }
8834
- if (filtered.length && filtered.every((v) => typeof v === "number")) {
8835
- const numbers = filtered;
8836
- const isIntegers = numbers.every((n) => Number.isInteger(n));
8837
- return { name, list: { [isIntegers ? "integer" : "float"]: numbers } };
8838
- }
8839
- return { name, list: { string: entryValue.map((v) => v === null || v === void 0 ? "" : String(v)) } };
8840
- }
8841
- if (typeof entryValue === "boolean") {
8842
- return { name, base: { boolean: entryValue } };
8843
- }
8844
- if (typeof entryValue === "number") {
8845
- if (Number.isInteger(entryValue))
8846
- return { name, base: { integer: entryValue } };
8847
- return { name, base: { float: entryValue } };
8848
- }
8849
- if (entryValue === null || entryValue === void 0) {
8850
- return { name, base: { string: "" } };
8851
- }
8852
- if (typeof entryValue === "object") {
8853
- try {
8854
- return { name, base: { string: JSON.stringify(entryValue) } };
8855
- } catch {
8856
- return { name, base: { string: String(entryValue) } };
8857
- }
8858
- }
8859
- return { name, base: { string: String(entryValue) } };
9048
+ return { base: { [baseType]: coerceBaseValue(value, baseType) } };
8860
9049
  }
8861
9050
  /**
8862
9051
  * Extract default QTI_CONTEXT values from qti-context-declaration elements
@@ -8871,15 +9060,10 @@ var QtiPortableCustomInteraction = class extends Interaction {
8871
9060
  const defaultValueElement = declaration.querySelector("qti-default-value");
8872
9061
  if (!defaultValueElement)
8873
9062
  return;
8874
- const valueElements = defaultValueElement.querySelectorAll("qti-value[field-identifier]");
8875
- valueElements.forEach((valueElement) => {
8876
- const fieldIdentifier = valueElement.getAttribute("field-identifier");
8877
- if (!fieldIdentifier)
8878
- return;
8879
- const baseType = valueElement.getAttribute("base-type") || "string";
8880
- const textContent = valueElement.textContent?.trim() || "";
8881
- defaults[fieldIdentifier] = this.coerceBaseValue(textContent, baseType);
8882
- });
9063
+ const { value, baseTypes } = readRecordFieldValues(defaultValueElement.querySelectorAll("qti-value"));
9064
+ for (const [fieldIdentifier, textContent] of Object.entries(value)) {
9065
+ defaults[fieldIdentifier] = coerceBaseValue(textContent, baseTypes[fieldIdentifier] ?? "string");
9066
+ }
8883
9067
  });
8884
9068
  return defaults;
8885
9069
  }
@@ -8898,7 +9082,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
8898
9082
  environmentIdentifier: merged.environmentIdentifier ?? "",
8899
9083
  ...merged
8900
9084
  };
8901
- return this.recordToQtiVariableJSON(normalized);
9085
+ return recordToQtiVariableJSON(normalized);
8902
9086
  }
8903
9087
  /**
8904
9088
  * Collect template variables referenced by qti-template-variable children
@@ -8991,7 +9175,10 @@ var QtiPortableCustomInteraction = class extends Interaction {
8991
9175
  /**
8992
9176
  * Converts response variables to QtiVariableJSON
8993
9177
  */
8994
- responseVariablesToQtiVariableJSON(input, cardinality, baseType) {
9178
+ responseVariablesToQtiVariableJSON(input, cardinality, baseType, fieldBaseTypes) {
9179
+ if (cardinality === "record") {
9180
+ return recordResponseToQtiVariableJSON(input, fieldBaseTypes);
9181
+ }
8995
9182
  if (cardinality !== "single") {
8996
9183
  const list = { list: {} };
8997
9184
  list.list[baseType] = input;
@@ -9005,6 +9192,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
9005
9192
  #hasNonEmptyResponse() {
9006
9193
  if (this.response === null || this.response === void 0)
9007
9194
  return false;
9195
+ if (isRecordValue(this.response)) {
9196
+ return Object.values(this.response).some((v) => v !== "" && v !== null && v !== void 0);
9197
+ }
9008
9198
  if (Array.isArray(this.response)) {
9009
9199
  if (this.response.length === 0)
9010
9200
  return false;
@@ -9032,6 +9222,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
9032
9222
  get value() {
9033
9223
  if (this.#value === null || this.#value === void 0)
9034
9224
  return null;
9225
+ if (isRecordValue(this.#value))
9226
+ return JSON.stringify(this.#value);
9035
9227
  return Array.isArray(this.#value) ? this.#value.join(",") : String(this.#value);
9036
9228
  }
9037
9229
  set boundTo(newValue) {
@@ -9046,10 +9238,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
9046
9238
  const responseVariable = {};
9047
9239
  const variable = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier);
9048
9240
  if (variable) {
9049
- const cardinality = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.cardinality || "single";
9050
- const baseType = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.baseType || "string";
9051
- const value = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.value || null;
9052
- const responseVal = this.responseVariablesToQtiVariableJSON(value, cardinality, baseType);
9241
+ const cardinality = variable.cardinality || "single";
9242
+ const baseType = variable.baseType || "string";
9243
+ const value = variable.value || null;
9244
+ const fieldBaseTypes = variable.fieldBaseTypes;
9245
+ const responseVal = this.responseVariablesToQtiVariableJSON(value, cardinality, baseType, fieldBaseTypes);
9053
9246
  responseVariable[this.responseIdentifier] = responseVal;
9054
9247
  }
9055
9248
  return responseVariable;
@@ -9219,11 +9412,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
9219
9412
  const iframeBaseUrl = this.dataset.baseUrl ? this.dataset.baseUrl.startsWith("/") ? `${window.location.origin}${this.dataset.baseUrl}` : this.dataset.baseUrl : "";
9220
9413
  const iframeBaseHref = iframeBaseUrl ? iframeBaseUrl.endsWith("/") ? iframeBaseUrl : `${iframeBaseUrl}/` : `${window.location.origin}/`;
9221
9414
  const forwardConsole = this.dataset.forwardConsole === "true";
9222
- const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
9223
- const defaultComponentsCdnUrl = isLocalhost ? `${window.location.origin}/cdn/index.js` : "https://unpkg.com/@citolab/qti-components/cdn";
9224
- const defaultComponentsCssUrl = isLocalhost ? `${window.location.origin}/dist/item.css` : "https://unpkg.com/@citolab/qti-components@latest/dist/item.css";
9225
- const componentsCdnUrl = this.dataset.componentsCdnUrl || defaultComponentsCdnUrl;
9226
- const componentsCssUrl = this.dataset.componentsCssUrl || defaultComponentsCssUrl;
9415
+ const componentsCdnUrl = this.dataset.componentsCdnUrl;
9416
+ const componentsCssUrl = this.dataset.componentsCssUrl;
9417
+ const requireJsTag = this.requireJsUrl ? `<script src="${this.requireJsUrl}"></script>` : `<script>${inlineScriptText(require_js_default)}</script>`;
9227
9418
  const fontStyles = `
9228
9419
  font-family: ${parentStyles.getPropertyValue("font-family")};
9229
9420
  font-size: ${parentStyles.getPropertyValue("font-size")};
@@ -9231,17 +9422,18 @@ var QtiPortableCustomInteraction = class extends Interaction {
9231
9422
  font-weight: ${parentStyles.getPropertyValue("font-weight")};
9232
9423
  color: ${parentStyles.getPropertyValue("color")};
9233
9424
  `;
9425
+ const langHost = this.closest("[lang], [xml\\:lang]");
9426
+ const iframeLang = [langHost?.getAttribute("lang"), langHost?.getAttribute("xml:lang"), document.documentElement.lang].map((l) => (l ?? "").trim()).find((l) => /^[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*$/.test(l)) ?? "en";
9234
9427
  return (
9235
9428
  /* html */
9236
9429
  `<!DOCTYPE html>
9237
- <html lang="en">
9430
+ <html lang="${iframeLang}">
9238
9431
  <head>
9239
9432
  <meta charset="utf-8" />
9240
9433
  <title>QTI PCI Container</title>
9241
9434
  <base href="${iframeBaseHref}" />
9242
- <script type="module">
9243
- import '${componentsCdnUrl}';
9244
- </script>
9435
+ ${componentsCdnUrl ? `<script type="module">import '${componentsCdnUrl}';</script>` : ""}
9436
+ <style>${inlineStyleText(native_css_default)}</style>
9245
9437
  <style>
9246
9438
  body, html {
9247
9439
  margin: 0;
@@ -9265,8 +9457,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
9265
9457
  min-height: 50px;
9266
9458
  }
9267
9459
  </style>
9268
- <link href="${componentsCssUrl}" rel="stylesheet" />
9269
- <script src="${this.requireJsUrl}"></script>
9460
+ ${componentsCssUrl ? `<link href="${componentsCssUrl}" rel="stylesheet" />` : ""}
9461
+ ${requireJsTag}
9270
9462
  <script>
9271
9463
  const forwardConsole = ${forwardConsole ? "true" : "false"};
9272
9464
  if (forwardConsole) {
@@ -10181,42 +10373,42 @@ var QtiPortableCustomInteraction = class extends Interaction {
10181
10373
  `;
10182
10374
  }
10183
10375
  };
10184
- __decorate24([
10376
+ __decorate25([
10185
10377
  property23({ type: String, attribute: "module" })
10186
10378
  ], QtiPortableCustomInteraction.prototype, "module", void 0);
10187
- __decorate24([
10379
+ __decorate25([
10188
10380
  property23({ type: String, attribute: "custom-interaction-type-identifier" })
10189
10381
  ], QtiPortableCustomInteraction.prototype, "customInteractionTypeIdentifier", void 0);
10190
- __decorate24([
10382
+ __decorate25([
10191
10383
  property23({ type: String, attribute: "data-require-paths" })
10192
10384
  ], QtiPortableCustomInteraction.prototype, "requirePathsJson", void 0);
10193
- __decorate24([
10385
+ __decorate25([
10194
10386
  property23({ type: String, attribute: "data-require-shim" })
10195
10387
  ], QtiPortableCustomInteraction.prototype, "requireShimJson", void 0);
10196
- __decorate24([
10388
+ __decorate25([
10197
10389
  property23({ type: String, attribute: "data-require-js-url" })
10198
10390
  ], QtiPortableCustomInteraction.prototype, "requireJsUrl", void 0);
10199
- __decorate24([
10391
+ __decorate25([
10200
10392
  property23({ type: String, attribute: "data-base-url" })
10201
10393
  ], QtiPortableCustomInteraction.prototype, "baseUrl", void 0);
10202
- __decorate24([
10394
+ __decorate25([
10203
10395
  property23({ type: Boolean, attribute: "data-use-default-paths" })
10204
10396
  ], QtiPortableCustomInteraction.prototype, "useDefaultPaths", void 0);
10205
- __decorate24([
10397
+ __decorate25([
10206
10398
  property23({ type: String, attribute: "data-status" })
10207
10399
  ], QtiPortableCustomInteraction.prototype, "status", void 0);
10208
- __decorate24([
10209
- state12()
10400
+ __decorate25([
10401
+ state13()
10210
10402
  ], QtiPortableCustomInteraction.prototype, "_errorMessage", void 0);
10211
- __decorate24([
10403
+ __decorate25([
10212
10404
  consume6({ context: itemContext, subscribe: true }),
10213
- state12()
10405
+ state13()
10214
10406
  ], QtiPortableCustomInteraction.prototype, "context", void 0);
10215
- __decorate24([
10407
+ __decorate25([
10216
10408
  consume6({ context: qtiContext, subscribe: true }),
10217
- state12()
10409
+ state13()
10218
10410
  ], QtiPortableCustomInteraction.prototype, "qtiContext", void 0);
10219
- __decorate24([
10411
+ __decorate25([
10220
10412
  property23({ attribute: "response", reflect: false, converter: responseAttributeConverter({ emptyAs: null }) })
10221
10413
  ], QtiPortableCustomInteraction.prototype, "response", void 0);
10222
10414
 
@@ -10313,7 +10505,7 @@ var QtiPositionObjectStage = class extends LitElement13 {
10313
10505
 
10314
10506
  // ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
10315
10507
  import { html as html29, nothing as nothing4 } from "lit";
10316
- import { property as property24, state as state13 } from "lit/decorators.js";
10508
+ import { property as property24, state as state14 } from "lit/decorators.js";
10317
10509
  import { repeat as repeat7 } from "lit/directives/repeat.js";
10318
10510
  import { styleMap } from "lit/directives/style-map.js";
10319
10511
 
@@ -10360,7 +10552,7 @@ var qti_select_point_interaction_styles_default = [
10360
10552
  ];
10361
10553
 
10362
10554
  // ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
10363
- var __decorate25 = function(decorators, target, key, desc) {
10555
+ var __decorate26 = function(decorators, target, key, desc) {
10364
10556
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10365
10557
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10366
10558
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -10554,19 +10746,19 @@ var QtiSelectPointInteraction = class extends Interaction {
10554
10746
  }
10555
10747
  }
10556
10748
  };
10557
- __decorate25([
10749
+ __decorate26([
10558
10750
  property24({
10559
10751
  type: Number,
10560
10752
  attribute: "max-choices"
10561
10753
  })
10562
10754
  ], QtiSelectPointInteraction.prototype, "maxChoices", void 0);
10563
- __decorate25([
10755
+ __decorate26([
10564
10756
  property24({
10565
10757
  type: Number,
10566
10758
  attribute: "min-choices"
10567
10759
  })
10568
10760
  ], QtiSelectPointInteraction.prototype, "minChoices", void 0);
10569
- __decorate25([
10761
+ __decorate26([
10570
10762
  property24({
10571
10763
  attribute: "response",
10572
10764
  reflect: false,
@@ -10583,13 +10775,13 @@ __decorate25([
10583
10775
  }
10584
10776
  })
10585
10777
  ], QtiSelectPointInteraction.prototype, "response", void 0);
10586
- __decorate25([
10778
+ __decorate26([
10587
10779
  property24({ attribute: "area-mappings" })
10588
10780
  ], QtiSelectPointInteraction.prototype, "areaMappings", void 0);
10589
- __decorate25([
10590
- state13()
10781
+ __decorate26([
10782
+ state14()
10591
10783
  ], QtiSelectPointInteraction.prototype, "_areaEntries", void 0);
10592
- __decorate25([
10784
+ __decorate26([
10593
10785
  watch("areaMappings")
10594
10786
  ], QtiSelectPointInteraction.prototype, "_handleAreaMappingsChange", void 0);
10595
10787
 
@@ -10655,7 +10847,7 @@ var qti_slider_interaction_styles_default = [
10655
10847
  transform: translateX(-50%);
10656
10848
  cursor: pointer;
10657
10849
  border-radius: 9999px; /* rounded-full */
10658
- left: var(--value-percentage);
10850
+ left: var(--value-percentage, 0%);
10659
10851
  }
10660
10852
  [part='value'] {
10661
10853
  position: absolute;
@@ -10673,7 +10865,7 @@ var qti_slider_interaction_styles_default = [
10673
10865
  ];
10674
10866
 
10675
10867
  // ../interactions/slider-interaction/dist/qti-slider-interaction.js
10676
- var __decorate26 = function(decorators, target, key, desc) {
10868
+ var __decorate27 = function(decorators, target, key, desc) {
10677
10869
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10678
10870
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10679
10871
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -10682,7 +10874,7 @@ var __decorate26 = function(decorators, target, key, desc) {
10682
10874
  var QtiSliderInteraction = class extends Interaction {
10683
10875
  constructor() {
10684
10876
  super(...arguments);
10685
- this.#value = 0;
10877
+ this.#value = null;
10686
10878
  this.min = 0;
10687
10879
  this.max = 100;
10688
10880
  this.step = 1;
@@ -10690,44 +10882,71 @@ var QtiSliderInteraction = class extends Interaction {
10690
10882
  static {
10691
10883
  this.styles = qti_slider_interaction_styles_default;
10692
10884
  }
10885
+ /**
10886
+ * The value the slider shows, or `null` before there is one. A slider has no initial position of
10887
+ * its own (QTI 3): it starts at the response declaration's default, which reaches it through
10888
+ * `response` like any other value the item holds, or it starts empty.
10889
+ */
10693
10890
  #value;
10694
10891
  validate() {
10695
10892
  return true;
10696
10893
  }
10697
10894
  connectedCallback() {
10698
10895
  super.connectedCallback();
10699
- if (!this.hasAttribute("response")) {
10700
- this.#updateValue(this.min);
10701
- }
10702
10896
  this.setAttribute("tabindex", "0");
10703
10897
  this.setAttribute("role", "slider");
10704
10898
  }
10899
+ willUpdate(changed) {
10900
+ super.willUpdate(changed);
10901
+ this._internals.ariaValueMin = String(this.min);
10902
+ this._internals.ariaValueMax = String(this.max);
10903
+ }
10904
+ /**
10905
+ * Shows the value without publishing it: it came from the item (a default or a restored answer) or
10906
+ * from the host, which hold it already. Only the candidate's input is published.
10907
+ */
10705
10908
  get response() {
10706
- return this.#value.toString();
10909
+ return this.#value === null ? null : this.#value.toString();
10707
10910
  }
10708
10911
  set response(val) {
10709
- if (val === null || val === "")
10912
+ if (val === null || val === void 0 || val === "") {
10913
+ this.#show(null);
10710
10914
  return;
10915
+ }
10711
10916
  const newValue = parseFloat(val);
10712
10917
  if (!isNaN(newValue)) {
10713
- this.#updateValue(newValue);
10918
+ this.#show(newValue);
10714
10919
  }
10715
10920
  }
10716
10921
  /** Extension hook for optional content rendered on the slider rail. */
10717
10922
  renderRailSupplement() {
10718
10923
  return nothing5;
10719
10924
  }
10720
- #updateValue(newValue) {
10925
+ /** Moves the knob to `newValue`, clamped to the bounds, or empties the slider. Returns whether it moved. */
10926
+ #show(newValue) {
10721
10927
  const oldValue = this.#value;
10722
- this.#value = Math.min(this.max, Math.max(this.min, newValue));
10928
+ this.#value = newValue === null ? null : Math.min(this.max, Math.max(this.min, newValue));
10723
10929
  if (this.#value === oldValue) {
10724
- return;
10930
+ return false;
10931
+ }
10932
+ if (this.#value === null) {
10933
+ this.style.removeProperty("--value-percentage");
10934
+ this._internals.setFormValue(null);
10935
+ this._internals.ariaValueNow = null;
10936
+ } else {
10937
+ const valuePercentage = (this.#value - this.min) / (this.max - this.min) * 100;
10938
+ this.style.setProperty("--value-percentage", `${valuePercentage}%`);
10939
+ this._internals.setFormValue(this.value);
10940
+ this._internals.ariaValueNow = String(this.#value);
10725
10941
  }
10726
- const valuePercentage = (this.#value - this.min) / (this.max - this.min) * 100;
10727
- this.style.setProperty("--value-percentage", `${valuePercentage}%`);
10728
- this._internals.setFormValue(this.value);
10729
- this.saveResponse(this.response);
10730
10942
  this.requestUpdate();
10943
+ return true;
10944
+ }
10945
+ /** The candidate's input: shows it and publishes it. */
10946
+ #commit(newValue) {
10947
+ if (this.#show(newValue)) {
10948
+ this.saveResponse(this.response);
10949
+ }
10731
10950
  }
10732
10951
  render() {
10733
10952
  return html30`
@@ -10742,7 +10961,7 @@ var QtiSliderInteraction = class extends Interaction {
10742
10961
 
10743
10962
  <div id="rail" part="rail" @mousedown=${this.#onMouseDown} @touchstart=${this.#onTouchStart}>
10744
10963
  <div id="knob" part="knob">
10745
- <div id="value" part="value">${this.response}</div>
10964
+ ${this.#value === null ? nothing5 : html30`<div id="value" part="value">${this.#value}</div>`}
10746
10965
  </div>
10747
10966
 
10748
10967
  ${this.renderRailSupplement()}
@@ -10780,25 +10999,25 @@ var QtiSliderInteraction = class extends Interaction {
10780
10999
  const diffX = pageX - railRect.left;
10781
11000
  const percentage = Math.min(1, Math.max(0, diffX / railRect.width));
10782
11001
  const steppedValue = this.min + Math.round(percentage * (this.max - this.min) / this.step) * this.step;
10783
- this.#updateValue(steppedValue);
11002
+ this.#commit(steppedValue);
10784
11003
  }
10785
11004
  #onDragEnd() {
10786
11005
  this.dispatchEvent(new Event("change", { bubbles: true }));
10787
11006
  }
10788
11007
  };
10789
- __decorate26([
11008
+ __decorate27([
10790
11009
  query2("#rail")
10791
11010
  ], QtiSliderInteraction.prototype, "_rail", void 0);
10792
- __decorate26([
11011
+ __decorate27([
10793
11012
  property25({ type: Number, attribute: "lower-bound" })
10794
11013
  ], QtiSliderInteraction.prototype, "min", void 0);
10795
- __decorate26([
11014
+ __decorate27([
10796
11015
  property25({ type: Number, attribute: "upper-bound" })
10797
11016
  ], QtiSliderInteraction.prototype, "max", void 0);
10798
- __decorate26([
11017
+ __decorate27([
10799
11018
  property25({ type: Number, attribute: "step" })
10800
11019
  ], QtiSliderInteraction.prototype, "step", void 0);
10801
- __decorate26([
11020
+ __decorate27([
10802
11021
  property25({ attribute: "response", reflect: false, noAccessor: true })
10803
11022
  ], QtiSliderInteraction.prototype, "response", null);
10804
11023
 
@@ -10905,7 +11124,7 @@ var qti_text_entry_interaction_styles_default = [
10905
11124
  ];
10906
11125
 
10907
11126
  // ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.js
10908
- var __decorate27 = function(decorators, target, key, desc) {
11127
+ var __decorate28 = function(decorators, target, key, desc) {
10909
11128
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10910
11129
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10911
11130
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -11012,25 +11231,25 @@ var QtiTextEntryInteraction = class extends Interaction {
11012
11231
  this.response = "";
11013
11232
  }
11014
11233
  };
11015
- __decorate27([
11234
+ __decorate28([
11016
11235
  property26({ type: Number, attribute: "expected-length" })
11017
11236
  ], QtiTextEntryInteraction.prototype, "expectedLength", void 0);
11018
- __decorate27([
11237
+ __decorate28([
11019
11238
  property26({ type: String, attribute: "pattern-mask" })
11020
11239
  ], QtiTextEntryInteraction.prototype, "patternMask", void 0);
11021
- __decorate27([
11240
+ __decorate28([
11022
11241
  property26({ type: String, attribute: "placeholder-text" })
11023
11242
  ], QtiTextEntryInteraction.prototype, "placeholderText", void 0);
11024
- __decorate27([
11243
+ __decorate28([
11025
11244
  property26({ type: String, attribute: "data-patternmask-message" })
11026
11245
  ], QtiTextEntryInteraction.prototype, "dataPatternmaskMessage", void 0);
11027
- __decorate27([
11246
+ __decorate28([
11028
11247
  property26({ type: String, attribute: "response", reflect: false })
11029
11248
  ], QtiTextEntryInteraction.prototype, "response", void 0);
11030
- __decorate27([
11249
+ __decorate28([
11031
11250
  query3("input")
11032
11251
  ], QtiTextEntryInteraction.prototype, "_input", void 0);
11033
- __decorate27([
11252
+ __decorate28([
11034
11253
  watch("response", { waitUntilFirstUpdate: true })
11035
11254
  ], QtiTextEntryInteraction.prototype, "_handleValueChange", void 0);
11036
11255
 
@@ -11739,6 +11958,8 @@ export {
11739
11958
  elements24 as elements14,
11740
11959
  QtiOrderInteraction,
11741
11960
  elements25 as elements15,
11961
+ inlineScriptText,
11962
+ inlineStyleText,
11742
11963
  QtiPortableCustomInteraction,
11743
11964
  elements26 as elements16,
11744
11965
  QtiPositionObjectInteraction,
@@ -11754,4 +11975,4 @@ export {
11754
11975
  elements31 as elements21,
11755
11976
  qtiInteractionElements
11756
11977
  };
11757
- //# sourceMappingURL=chunk-MSGYZE6L.js.map
11978
+ //# sourceMappingURL=chunk-LOKULHVY.js.map