@citolab/qti-components 10.0.0-next.0 → 10.0.0-next.2

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 (46) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +191 -183
  3. package/dist/base.d.ts +2 -2
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-EPSUZIWL.js → chunk-2KP5UU5A.js} +6 -6
  6. package/dist/{chunk-GPNWMLLA.js → chunk-35WWWFS6.js} +2 -2
  7. package/dist/{chunk-QD3Y6UK3.js → chunk-3ZNECUPV.js} +2 -2
  8. package/dist/{chunk-3BAQWO5C.js → chunk-6K3QWJHH.js} +2 -2
  9. package/dist/{chunk-AWTQKBC4.js → chunk-6U3YPHXU.js} +2 -2
  10. package/dist/{chunk-WNAOVXXN.js → chunk-FD4AB6TM.js} +2 -2
  11. package/dist/{chunk-SVYHZIJ7.js → chunk-GBZNFSFY.js} +2 -2
  12. package/dist/{chunk-EUKU5QKV.js → chunk-K3VKQ6QF.js} +509 -274
  13. package/dist/chunk-K3VKQ6QF.js.map +1 -0
  14. package/dist/{chunk-ACRN7YJM.js → chunk-MI7774NV.js} +2 -2
  15. package/dist/{chunk-CNFVA3AA.js → chunk-RSMYGGQK.js} +2 -2
  16. package/dist/{chunk-F7R7GSWL.js → chunk-RU6332MD.js} +2 -2
  17. package/dist/{chunk-R7MMMDP7.js → chunk-TDWJ6WZA.js} +20 -2
  18. package/dist/chunk-TDWJ6WZA.js.map +1 -0
  19. package/dist/corrections.d.ts +2 -2
  20. package/dist/corrections.js +7 -7
  21. package/dist/elements.js +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +16 -12
  24. package/dist/interactions.js +3 -3
  25. package/dist/item.js +3 -3
  26. package/dist/processing.d.ts +2 -2
  27. package/dist/processing.js +3 -3
  28. package/dist/qti-components-jsx.d.ts +120 -0
  29. package/dist/{qti-condition-expression.d-L7yb3Rzy.d.ts → qti-condition-expression.d-VJH6cWxf.d.ts} +1 -1
  30. package/dist/{qti-expression.d-CuaLjZ6g.d.ts → qti-expression.d-BPxEp8HU.d.ts} +7 -0
  31. package/dist/{qti-test.d-_THYXPzd.d.ts → qti-test.d-DkpBNcsv.d.ts} +62 -2
  32. package/dist/test.d.ts +3 -3
  33. package/dist/test.js +8 -4
  34. package/package.json +8 -8
  35. package/dist/chunk-EUKU5QKV.js.map +0 -1
  36. package/dist/chunk-R7MMMDP7.js.map +0 -1
  37. /package/dist/{chunk-EPSUZIWL.js.map → chunk-2KP5UU5A.js.map} +0 -0
  38. /package/dist/{chunk-GPNWMLLA.js.map → chunk-35WWWFS6.js.map} +0 -0
  39. /package/dist/{chunk-QD3Y6UK3.js.map → chunk-3ZNECUPV.js.map} +0 -0
  40. /package/dist/{chunk-3BAQWO5C.js.map → chunk-6K3QWJHH.js.map} +0 -0
  41. /package/dist/{chunk-AWTQKBC4.js.map → chunk-6U3YPHXU.js.map} +0 -0
  42. /package/dist/{chunk-WNAOVXXN.js.map → chunk-FD4AB6TM.js.map} +0 -0
  43. /package/dist/{chunk-SVYHZIJ7.js.map → chunk-GBZNFSFY.js.map} +0 -0
  44. /package/dist/{chunk-ACRN7YJM.js.map → chunk-MI7774NV.js.map} +0 -0
  45. /package/dist/{chunk-CNFVA3AA.js.map → chunk-RSMYGGQK.js.map} +0 -0
  46. /package/dist/{chunk-F7R7GSWL.js.map → chunk-RU6332MD.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  dispatchDeclared,
4
4
  listenDeclared,
5
5
  listenPublic
6
- } from "./chunk-AWTQKBC4.js";
6
+ } from "./chunk-6U3YPHXU.js";
7
7
  import {
8
8
  item_css_default
9
9
  } from "./chunk-ZP6QQYSU.js";
@@ -24,7 +24,7 @@ import {
24
24
  qtiContext,
25
25
  sessionContext,
26
26
  testContext
27
- } from "./chunk-R7MMMDP7.js";
27
+ } from "./chunk-TDWJ6WZA.js";
28
28
 
29
29
  // ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
30
30
  import { LitElement, nothing as nothing2 } from "lit";
@@ -636,18 +636,18 @@ var EvalAstFactory = class {
636
636
  }
637
637
  const value = this.right.evaluate(scope);
638
638
  let receiver = void 0;
639
- let property20;
639
+ let property21;
640
640
  if (this.left.type === "Getter") {
641
641
  receiver = this.left.receiver.evaluate(scope);
642
- property20 = this.left.name;
642
+ property21 = this.left.name;
643
643
  } else if (this.left.type === "Index") {
644
644
  receiver = this.left.receiver.evaluate(scope);
645
- property20 = this.left.argument.evaluate(scope);
645
+ property21 = this.left.argument.evaluate(scope);
646
646
  } else if (this.left.type === "ID") {
647
647
  receiver = scope;
648
- property20 = this.left.value;
648
+ property21 = this.left.value;
649
649
  }
650
- return receiver === void 0 ? void 0 : receiver[property20] = value;
650
+ return receiver === void 0 ? void 0 : receiver[property21] = value;
651
651
  }
652
652
  return f(this.left.evaluate(scope), this.right.evaluate(scope));
653
653
  },
@@ -1119,6 +1119,8 @@ var PUBLIC_EVENTS = {
1119
1119
  "cito-test-rendered": { kind: "notification", scope: "test", deprecated: "qti-test-loaded" },
1120
1120
  "cito-test-loaded": { kind: "notification", scope: "test", deprecated: "qti-assessment-test-connected" },
1121
1121
  "cito-test-state-changed": { kind: "notification", scope: "test", deprecated: "qti-state-changed" },
1122
+ "cito-test-items-skipped": { kind: "notification", scope: "test" },
1123
+ "cito-test-end-reached": { kind: "notification", scope: "test" },
1122
1124
  "cito-item-ref-connected": { kind: "notification", scope: "item", deprecated: "qti-assessment-item-ref-connected" }
1123
1125
  };
1124
1126
  function dispatchPublic(target, name, detail) {
@@ -1370,15 +1372,75 @@ __decorate3([
1370
1372
  consume3({ context: testContext, subscribe: true })
1371
1373
  ], QtiAssessmentTest.prototype, "_testContext", void 0);
1372
1374
 
1373
- // ../qti-test/dist/components/qti-item-session-control/qti-item-session-control.js
1374
- import { html as html3, LitElement as LitElement4 } from "lit";
1375
+ // ../qti-test/dist/components/qti-branch-rule/qti-branch-rule.js
1376
+ import { css, html as html3, LitElement as LitElement4 } from "lit";
1375
1377
  import { property as property4 } from "lit/decorators.js";
1378
+
1379
+ // ../qti-test/dist/internal/evaluate-condition.js
1380
+ function evaluateBooleanChild(element, onError) {
1381
+ const expression = element.firstElementChild;
1382
+ if (!expression || typeof expression.calculate !== "function") {
1383
+ console.warn(`<${element.localName}> has no evaluable expression child`, element);
1384
+ return onError;
1385
+ }
1386
+ try {
1387
+ const result = expression.calculate();
1388
+ return result === true || result === "true";
1389
+ } catch (error) {
1390
+ console.warn(`<${element.localName}> could not evaluate its expression`, error);
1391
+ return onError;
1392
+ }
1393
+ }
1394
+
1395
+ // ../qti-test/dist/components/qti-branch-rule/qti-branch-rule.js
1376
1396
  var __decorate4 = function(decorators, target, key, desc) {
1377
1397
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1378
1398
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1379
1399
  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;
1380
1400
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1381
1401
  };
1402
+ var QtiBranchRule = class extends LitElement4 {
1403
+ constructor() {
1404
+ super(...arguments);
1405
+ this.target = "";
1406
+ }
1407
+ static {
1408
+ this.EXIT_SECTION = "EXIT_SECTION";
1409
+ }
1410
+ static {
1411
+ this.EXIT_TESTPART = "EXIT_TESTPART";
1412
+ }
1413
+ static {
1414
+ this.EXIT_TEST = "EXIT_TEST";
1415
+ }
1416
+ static {
1417
+ this.styles = css`
1418
+ :host {
1419
+ display: none;
1420
+ }
1421
+ `;
1422
+ }
1423
+ /** `true` when the test should jump to `target`. */
1424
+ evaluate() {
1425
+ return evaluateBooleanChild(this, false);
1426
+ }
1427
+ render() {
1428
+ return html3`<slot></slot>`;
1429
+ }
1430
+ };
1431
+ __decorate4([
1432
+ property4({ type: String })
1433
+ ], QtiBranchRule.prototype, "target", void 0);
1434
+
1435
+ // ../qti-test/dist/components/qti-item-session-control/qti-item-session-control.js
1436
+ import { html as html4, LitElement as LitElement5 } from "lit";
1437
+ import { property as property5 } from "lit/decorators.js";
1438
+ var __decorate5 = function(decorators, target, key, desc) {
1439
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1440
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1441
+ 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;
1442
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1443
+ };
1382
1444
  var stringToBooleanConverter3 = {
1383
1445
  fromAttribute(value) {
1384
1446
  return value === "true";
@@ -1387,7 +1449,7 @@ var stringToBooleanConverter3 = {
1387
1449
  return value ? "true" : "false";
1388
1450
  }
1389
1451
  };
1390
- var QtiItemSessionControl = class extends LitElement4 {
1452
+ var QtiItemSessionControl = class extends LitElement5 {
1391
1453
  constructor() {
1392
1454
  super(...arguments);
1393
1455
  this.maxAttempts = 1;
@@ -1408,29 +1470,29 @@ var QtiItemSessionControl = class extends LitElement4 {
1408
1470
  }));
1409
1471
  }
1410
1472
  render() {
1411
- return html3`<slot></slot>`;
1473
+ return html4`<slot></slot>`;
1412
1474
  }
1413
1475
  };
1414
- __decorate4([
1415
- property4({ type: Number, attribute: "max-attempts" })
1476
+ __decorate5([
1477
+ property5({ type: Number, attribute: "max-attempts" })
1416
1478
  ], QtiItemSessionControl.prototype, "maxAttempts", void 0);
1417
- __decorate4([
1418
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-feedback" })
1479
+ __decorate5([
1480
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-feedback" })
1419
1481
  ], QtiItemSessionControl.prototype, "showFeedback", void 0);
1420
- __decorate4([
1421
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-review" })
1482
+ __decorate5([
1483
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-review" })
1422
1484
  ], QtiItemSessionControl.prototype, "allowReview", void 0);
1423
- __decorate4([
1424
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-solution" })
1485
+ __decorate5([
1486
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-solution" })
1425
1487
  ], QtiItemSessionControl.prototype, "showSolution", void 0);
1426
- __decorate4([
1427
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-comment" })
1488
+ __decorate5([
1489
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-comment" })
1428
1490
  ], QtiItemSessionControl.prototype, "allowComment", void 0);
1429
- __decorate4([
1430
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-skipping" })
1491
+ __decorate5([
1492
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-skipping" })
1431
1493
  ], QtiItemSessionControl.prototype, "allowSkipping", void 0);
1432
- __decorate4([
1433
- property4({ type: Boolean, converter: stringToBooleanConverter3, attribute: "validate-responses" })
1494
+ __decorate5([
1495
+ property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "validate-responses" })
1434
1496
  ], QtiItemSessionControl.prototype, "validateResponses", void 0);
1435
1497
 
1436
1498
  // ../qti-test/dist/internal/item-ref-selection.js
@@ -1487,12 +1549,31 @@ var QtiNumberSelected = class extends QtiExpression {
1487
1549
  }
1488
1550
  };
1489
1551
 
1552
+ // ../qti-test/dist/components/qti-pre-condition/qti-pre-condition.js
1553
+ import { css as css2, html as html5, LitElement as LitElement6 } from "lit";
1554
+ var QtiPreCondition = class extends LitElement6 {
1555
+ static {
1556
+ this.styles = css2`
1557
+ :host {
1558
+ display: none;
1559
+ }
1560
+ `;
1561
+ }
1562
+ /** `true` when the parent may be presented. */
1563
+ evaluate() {
1564
+ return evaluateBooleanChild(this, true);
1565
+ }
1566
+ render() {
1567
+ return html5`<slot></slot>`;
1568
+ }
1569
+ };
1570
+
1490
1571
  // ../qti-test/dist/components/qti-outcome-processing/qti-outcome-processing.js
1491
- import { css, html as html4, LitElement as LitElement5 } from "lit";
1492
- var QtiOutcomeProcessing = class extends LitElement5 {
1572
+ import { css as css3, html as html6, LitElement as LitElement7 } from "lit";
1573
+ var QtiOutcomeProcessing = class extends LitElement7 {
1493
1574
  static {
1494
1575
  this.styles = [
1495
- css`
1576
+ css3`
1496
1577
  :host {
1497
1578
  display: none;
1498
1579
  }
@@ -1500,7 +1581,7 @@ var QtiOutcomeProcessing = class extends LitElement5 {
1500
1581
  ];
1501
1582
  }
1502
1583
  render() {
1503
- return html4`<slot></slot>`;
1584
+ return html6`<slot></slot>`;
1504
1585
  }
1505
1586
  process() {
1506
1587
  const logic = new QtiOutcomeProcessingProcessor();
@@ -1522,30 +1603,30 @@ var QtiOutcomeProcessingProcessor = class {
1522
1603
  };
1523
1604
 
1524
1605
  // ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
1525
- import { css as css2, html as html5 } from "lit";
1606
+ import { css as css4, html as html7 } from "lit";
1526
1607
  var QtiTestFeedback = class extends QtiModalFeedback {
1527
1608
  static {
1528
- this.styles = css2`
1609
+ this.styles = css4`
1529
1610
  :host {
1530
1611
  color: gray;
1531
1612
  }
1532
1613
  `;
1533
1614
  }
1534
1615
  render() {
1535
- return html5``;
1616
+ return html7``;
1536
1617
  }
1537
1618
  };
1538
1619
 
1539
1620
  // ../qti-test/dist/components/qti-test-part/qti-test-part.js
1540
- import { html as html6, LitElement as LitElement6 } from "lit";
1541
- import { property as property5 } from "lit/decorators.js";
1542
- var __decorate5 = function(decorators, target, key, desc) {
1621
+ import { html as html8, LitElement as LitElement8 } from "lit";
1622
+ import { property as property6 } from "lit/decorators.js";
1623
+ var __decorate6 = function(decorators, target, key, desc) {
1543
1624
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1544
1625
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1545
1626
  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;
1546
1627
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1547
1628
  };
1548
- var QtiTestPart = class extends LitElement6 {
1629
+ var QtiTestPart = class extends LitElement8 {
1549
1630
  constructor() {
1550
1631
  super(...arguments);
1551
1632
  this.identifier = "";
@@ -1572,25 +1653,25 @@ var QtiTestPart = class extends LitElement6 {
1572
1653
  }));
1573
1654
  }
1574
1655
  render() {
1575
- return html6` <slot></slot>`;
1656
+ return html8` <slot></slot>`;
1576
1657
  }
1577
1658
  };
1578
- __decorate5([
1579
- property5({ type: String })
1659
+ __decorate6([
1660
+ property6({ type: String })
1580
1661
  ], QtiTestPart.prototype, "identifier", void 0);
1581
- __decorate5([
1582
- property5({ type: String })
1662
+ __decorate6([
1663
+ property6({ type: String })
1583
1664
  ], QtiTestPart.prototype, "class", void 0);
1584
- __decorate5([
1585
- property5({ type: String, attribute: "navigation-mode" })
1665
+ __decorate6([
1666
+ property6({ type: String, attribute: "navigation-mode" })
1586
1667
  ], QtiTestPart.prototype, "navigationMode", void 0);
1587
- __decorate5([
1588
- property5({ type: String, attribute: "submission-mode" })
1668
+ __decorate6([
1669
+ property6({ type: String, attribute: "submission-mode" })
1589
1670
  ], QtiTestPart.prototype, "submissionMode", void 0);
1590
1671
 
1591
1672
  // ../qti-test/dist/components/qti-test-variables/qti-test-variables.js
1592
1673
  import { consume as consume4 } from "@lit/context";
1593
- var __decorate6 = function(decorators, target, key, desc) {
1674
+ var __decorate7 = function(decorators, target, key, desc) {
1594
1675
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1595
1676
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1596
1677
  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;
@@ -1631,7 +1712,7 @@ var QtiTestVariables = class extends QtiExpression {
1631
1712
  return this.getResult();
1632
1713
  }
1633
1714
  };
1634
- __decorate6([
1715
+ __decorate7([
1635
1716
  consume4({ context: testContext, subscribe: true })
1636
1717
  ], QtiTestVariables.prototype, "_testContext", void 0);
1637
1718
  var QtiTestVariablesExpression = class {
@@ -1665,12 +1746,104 @@ var QTI_TEST_STATE_VERSION = 1;
1665
1746
 
1666
1747
  // ../qti-test/dist/components/qti-test/qti-test.js
1667
1748
  import { ContextProvider, provide as provide2 } from "@lit/context";
1668
- import { html as html7, LitElement as LitElement8 } from "lit";
1749
+ import { html as html9, LitElement as LitElement10 } from "lit";
1669
1750
  import { state as state2 } from "lit/decorators.js";
1670
1751
 
1671
1752
  // ../qti-test/dist/mixins/test-navigation.mixin.js
1672
- import { property as property6 } from "lit/decorators.js";
1673
- var __decorate7 = function(decorators, target, key, desc) {
1753
+ import { property as property7 } from "lit/decorators.js";
1754
+
1755
+ // ../qti-test/dist/internal/item-sequencing.js
1756
+ var SECTION = "qti-assessment-section";
1757
+ var TEST_PART = "qti-test-part";
1758
+ var idOf = (ref) => ref.identifier || ref.getAttribute("identifier") || "";
1759
+ function resolveNextItem(refs, current) {
1760
+ const from = refs[current];
1761
+ let start = current + 1;
1762
+ const rule = firstFiringBranchRule(from, refs, current);
1763
+ if (rule) {
1764
+ const target = branchTargetIndex(rule, refs, current);
1765
+ if (target === null)
1766
+ return { id: null, skipped: refs.slice(current + 1).map(idOf) };
1767
+ if (target > current)
1768
+ start = target;
1769
+ else
1770
+ console.warn(`qti-branch-rule target "${rule.target}" is not ahead of "${idOf(from)}", ignored`);
1771
+ }
1772
+ const skipped = refs.slice(current + 1, start).map(idOf);
1773
+ for (let i = start; i < refs.length; i++) {
1774
+ if (preConditionsPass(refs[i], from))
1775
+ return { id: idOf(refs[i]), skipped };
1776
+ skipped.push(idOf(refs[i]));
1777
+ }
1778
+ return { id: null, skipped };
1779
+ }
1780
+ function resolveFirstItem(refs) {
1781
+ const skipped = [];
1782
+ for (const ref of refs) {
1783
+ if (preConditionsPass(ref, null))
1784
+ return { id: idOf(ref), skipped };
1785
+ skipped.push(idOf(ref));
1786
+ }
1787
+ return { id: null, skipped };
1788
+ }
1789
+ function firstFiringBranchRule(itemRef, refs, current) {
1790
+ const owners = [itemRef];
1791
+ for (let el = itemRef.parentElement; el && (el.localName === SECTION || el.localName === TEST_PART); el = el.parentElement) {
1792
+ if (el.contains(refs[current + 1] ?? null))
1793
+ break;
1794
+ owners.push(el);
1795
+ }
1796
+ for (const owner of owners) {
1797
+ for (const rule of owner.querySelectorAll(":scope > qti-branch-rule")) {
1798
+ if (rule.evaluate?.())
1799
+ return rule;
1800
+ }
1801
+ }
1802
+ return null;
1803
+ }
1804
+ function branchTargetIndex(rule, refs, current) {
1805
+ const owner = rule.parentElement;
1806
+ const firstAfter = (container) => {
1807
+ if (!container)
1808
+ return null;
1809
+ const last = refs.findLastIndex((ref) => container.contains(ref));
1810
+ return last + 1 < refs.length ? last + 1 : null;
1811
+ };
1812
+ switch (rule.target) {
1813
+ case QtiBranchRule.EXIT_TEST:
1814
+ return null;
1815
+ case QtiBranchRule.EXIT_TESTPART:
1816
+ return firstAfter(owner.closest(TEST_PART));
1817
+ case QtiBranchRule.EXIT_SECTION: {
1818
+ const section = owner.localName === SECTION ? owner : owner.closest(SECTION);
1819
+ return firstAfter(section ?? owner);
1820
+ }
1821
+ default: {
1822
+ const byRef = refs.findIndex((ref) => idOf(ref) === rule.target);
1823
+ if (byRef >= 0)
1824
+ return byRef;
1825
+ const container = [
1826
+ ...owner.closest("qti-assessment-test")?.querySelectorAll(`${SECTION}, ${TEST_PART}`) ?? []
1827
+ ].find((el) => el.getAttribute("identifier") === rule.target);
1828
+ const inside = container ? refs.findIndex((ref) => container.contains(ref)) : -1;
1829
+ if (inside >= 0)
1830
+ return inside;
1831
+ console.warn(`qti-branch-rule target "${rule.target}" not found`);
1832
+ return current + 1;
1833
+ }
1834
+ }
1835
+ }
1836
+ function preConditionsPass(itemRef, from) {
1837
+ const owners = [itemRef];
1838
+ for (let el = itemRef.parentElement; el && (el.localName === SECTION || el.localName === TEST_PART); el = el.parentElement) {
1839
+ if (!from || !el.contains(from))
1840
+ owners.push(el);
1841
+ }
1842
+ return owners.every((owner) => [...owner.querySelectorAll(":scope > qti-pre-condition")].every((condition) => condition.evaluate?.() ?? true));
1843
+ }
1844
+
1845
+ // ../qti-test/dist/mixins/test-navigation.mixin.js
1846
+ var __decorate8 = function(decorators, target, key, desc) {
1674
1847
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1675
1848
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1676
1849
  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;
@@ -1788,7 +1961,20 @@ var TestNavigationMixin = (superClass) => {
1788
1961
  _initializeNavigation() {
1789
1962
  if (!this.navigate)
1790
1963
  return;
1791
- const id = this._getDefaultNavigationId(this.navigate);
1964
+ let id = this._getDefaultNavigationId(this.navigate);
1965
+ if (this.navigate === "item" && this._testElement && !this.sessionContext?.navItemRefId) {
1966
+ const refs = [...this._testElement.querySelectorAll("qti-assessment-item-ref")];
1967
+ if (refs[0]?.closest("qti-test-part")?.getAttribute("navigation-mode") === "linear") {
1968
+ const first = resolveFirstItem(refs);
1969
+ if (first.skipped.length)
1970
+ dispatchPublic(this, "cito-test-items-skipped", { ids: first.skipped });
1971
+ if (first.id === null) {
1972
+ dispatchPublic(this, "cito-test-end-reached", {});
1973
+ return;
1974
+ }
1975
+ id = first.id;
1976
+ }
1977
+ }
1792
1978
  if (id) {
1793
1979
  this.navigateTo(this.navigate, id);
1794
1980
  }
@@ -1817,13 +2003,43 @@ var TestNavigationMixin = (superClass) => {
1817
2003
  }
1818
2004
  return true;
1819
2005
  }
2006
+ /**
2007
+ * A "next" step in a linear test part (a request for item i+1 while item i is active) goes
2008
+ * through the branch rules and pre-conditions. Deep links, item links and nonlinear parts are
2009
+ * left alone: the spec ignores both in nonlinear mode.
2010
+ *
2011
+ * @returns the item to present instead, `null` when the test has no eligible item left, or
2012
+ * `undefined` when the request is not a "next" step.
2013
+ */
2014
+ _resolveLinearNext(type, id) {
2015
+ if (type !== "item" || !this._testElement)
2016
+ return void 0;
2017
+ const refs = [...this._testElement.querySelectorAll("qti-assessment-item-ref")];
2018
+ const current = refs.findIndex((ref) => idOf(ref) === this.sessionContext?.navItemRefId);
2019
+ if (current < 0 || !refs[current + 1] || idOf(refs[current + 1]) !== id)
2020
+ return void 0;
2021
+ if (refs[current].closest("qti-test-part")?.getAttribute("navigation-mode") !== "linear")
2022
+ return void 0;
2023
+ const next = resolveNextItem(refs, current);
2024
+ if (next.id === id)
2025
+ return void 0;
2026
+ return next;
2027
+ }
1820
2028
  /**
1821
2029
  * Main navigation request handler with proper lifecycle management
1822
2030
  */
1823
2031
  async _handleNavigationRequest({ detail }) {
1824
2032
  if (!detail?.id)
1825
2033
  return;
1826
- if (this._isLinearNavigationRestricted(detail.type, detail.id)) {
2034
+ const resolved = this._resolveLinearNext(detail.type, detail.id);
2035
+ if (resolved?.id === null) {
2036
+ if (resolved.skipped.length)
2037
+ dispatchPublic(this, "cito-test-items-skipped", { ids: resolved.skipped });
2038
+ dispatchPublic(this, "cito-test-end-reached", {});
2039
+ return;
2040
+ }
2041
+ const target = resolved?.id ?? detail.id;
2042
+ if (!resolved && this._isLinearNavigationRestricted(detail.type, target)) {
1827
2043
  this._handleNavigationError(new Error("Navigation restricted in linear mode"), detail.type, detail.id);
1828
2044
  return;
1829
2045
  }
@@ -1831,16 +2047,19 @@ var TestNavigationMixin = (superClass) => {
1831
2047
  const navigationId = ++this._navigationId;
1832
2048
  const controller = new AbortController();
1833
2049
  try {
1834
- this._dispatchLoadingStarted(detail.type, detail.id);
2050
+ this._dispatchLoadingStarted(detail.type, target);
1835
2051
  this._activeController = controller;
1836
- await this._executeNavigation(detail.type, detail.id, navigationId, controller);
2052
+ await this._executeNavigation(detail.type, target, navigationId, controller);
2053
+ if (resolved?.skipped.length && navigationId === this._navigationId && !controller.signal.aborted) {
2054
+ dispatchPublic(this, "cito-test-items-skipped", { ids: resolved.skipped });
2055
+ }
1837
2056
  } catch (error) {
1838
- this._handleNavigationError(error, detail.type, detail.id);
2057
+ this._handleNavigationError(error, detail.type, target);
1839
2058
  } finally {
1840
2059
  if (this._activeController === controller) {
1841
2060
  this._activeController = null;
1842
2061
  }
1843
- this._dispatchLoadingEnded(detail.type, detail.id);
2062
+ this._dispatchLoadingEnded(detail.type, target);
1844
2063
  }
1845
2064
  }
1846
2065
  _handleNavigationError(error, type, id) {
@@ -2132,17 +2351,17 @@ var TestNavigationMixin = (superClass) => {
2132
2351
  });
2133
2352
  }
2134
2353
  }
2135
- __decorate7([
2136
- property6({ type: String })
2354
+ __decorate8([
2355
+ property7({ type: String })
2137
2356
  ], TestNavigationClass.prototype, "navigate", void 0);
2138
- __decorate7([
2139
- property6({ type: Number })
2357
+ __decorate8([
2358
+ property7({ type: Number })
2140
2359
  ], TestNavigationClass.prototype, "requestTimeout", void 0);
2141
- __decorate7([
2142
- property6({ attribute: false })
2360
+ __decorate8([
2361
+ property7({ attribute: false })
2143
2362
  ], TestNavigationClass.prototype, "postLoadTransformCallback", void 0);
2144
- __decorate7([
2145
- property6({ attribute: false })
2363
+ __decorate8([
2364
+ property7({ attribute: false })
2146
2365
  ], TestNavigationClass.prototype, "postLoadTestTransformCallback", void 0);
2147
2366
  return TestNavigationClass;
2148
2367
  };
@@ -2197,9 +2416,9 @@ var TestViewMixin = (superClass) => {
2197
2416
 
2198
2417
  // ../qti-test/dist/mixins/test-base.js
2199
2418
  import { provide } from "@lit/context";
2200
- import { LitElement as LitElement7 } from "lit";
2201
- import { property as property7 } from "lit/decorators.js";
2202
- var __decorate8 = function(decorators, target, key, desc) {
2419
+ import { LitElement as LitElement9 } from "lit";
2420
+ import { property as property8 } from "lit/decorators.js";
2421
+ var __decorate9 = function(decorators, target, key, desc) {
2203
2422
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2204
2423
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2205
2424
  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;
@@ -2340,17 +2559,17 @@ var TestBaseMixin = (superClass) => {
2340
2559
  this.dispatchEvent(new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false }));
2341
2560
  }
2342
2561
  }
2343
- __decorate8([
2344
- property7({ attribute: false, type: Object }),
2562
+ __decorate9([
2563
+ property8({ attribute: false, type: Object }),
2345
2564
  provide({ context: testContext })
2346
2565
  ], TestBaseClass.prototype, "testContext", void 0);
2347
- __decorate8([
2348
- property7({ attribute: false, type: Object }),
2566
+ __decorate9([
2567
+ property8({ attribute: false, type: Object }),
2349
2568
  provide({ context: sessionContext })
2350
2569
  ], TestBaseClass.prototype, "sessionContext", void 0);
2351
2570
  return TestBaseClass;
2352
2571
  };
2353
- var TestBase = class extends TestBaseMixin(LitElement7) {
2572
+ var TestBase = class extends TestBaseMixin(LitElement9) {
2354
2573
  };
2355
2574
 
2356
2575
  // ../qti-test/dist/mixins/test-state.mixin.js
@@ -2518,13 +2737,13 @@ var TestProcessingMixin = (superClass) => {
2518
2737
  };
2519
2738
 
2520
2739
  // ../qti-test/dist/components/qti-test/qti-test.js
2521
- var __decorate9 = function(decorators, target, key, desc) {
2740
+ var __decorate10 = function(decorators, target, key, desc) {
2522
2741
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2523
2742
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2524
2743
  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;
2525
2744
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2526
2745
  };
2527
- var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestStateMixin(TestBaseMixin(LitElement8))))) {
2746
+ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestStateMixin(TestBaseMixin(LitElement10))))) {
2528
2747
  // TODO: Properly implement IQtiTest interface
2529
2748
  // export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {
2530
2749
  constructor() {
@@ -2549,25 +2768,25 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
2549
2768
  this.dispatchEvent(new CustomEvent("qti-test-connected", { detail: this }));
2550
2769
  }
2551
2770
  render() {
2552
- return html7`<slot></slot>`;
2771
+ return html9`<slot></slot>`;
2553
2772
  }
2554
2773
  };
2555
- __decorate9([
2774
+ __decorate10([
2556
2775
  state2(),
2557
2776
  provide2({ context: configContext })
2558
2777
  ], QtiTest.prototype, "configContext", void 0);
2559
- __decorate9([
2778
+ __decorate10([
2560
2779
  state2(),
2561
2780
  provide2({ context: qtiContext })
2562
2781
  ], QtiTest.prototype, "qtiContext", void 0);
2563
2782
 
2564
2783
  // ../qti-test/dist/components/test-check-item/test-check-item.js
2565
2784
  import { consume as consume5 } from "@lit/context";
2566
- import { css as css4, html as html8, LitElement as LitElement9 } from "lit";
2785
+ import { css as css6, html as html10, LitElement as LitElement11 } from "lit";
2567
2786
 
2568
2787
  // ../qti-test/dist/components/styles.js
2569
- import { css as css3 } from "lit";
2570
- var form = css3`
2788
+ import { css as css5 } from "lit";
2789
+ var form = css5`
2571
2790
  display: inline-flex;
2572
2791
  align-items: center;
2573
2792
  justify-content: center;
@@ -2581,39 +2800,39 @@ var form = css3`
2581
2800
  user-select: none;
2582
2801
  border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
2583
2802
  `;
2584
- var btn = css3`
2803
+ var btn = css5`
2585
2804
  ${form};
2586
2805
  background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
2587
2806
  color: var(--test-button-color, var(--qti-component-color, inherit));
2588
2807
  border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
2589
2808
  var(--test-button-border-color, var(--qti-component-border-color, #0175aa));
2590
2809
  `;
2591
- var btnInteractive = css3`
2810
+ var btnInteractive = css5`
2592
2811
  background-color: var(--test-button-hover-background-color, var(--qti-bg-active, #f2f8fb));
2593
2812
  `;
2594
- var focusRing = css3`
2813
+ var focusRing = css5`
2595
2814
  outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, #007ac3);
2596
2815
  outline-offset: 2px;
2597
2816
  `;
2598
- var dis = css3`
2817
+ var dis = css5`
2599
2818
  cursor: not-allowed;
2600
2819
  opacity: 0.45;
2601
2820
  `;
2602
- var ind = css3`
2821
+ var ind = css5`
2603
2822
  ${form};
2604
2823
  border: 1px solid gray;
2605
2824
  `;
2606
2825
 
2607
2826
  // ../qti-test/dist/components/test-check-item/test-check-item.js
2608
- var __decorate10 = function(decorators, target, key, desc) {
2827
+ var __decorate11 = function(decorators, target, key, desc) {
2609
2828
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2610
2829
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2611
2830
  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;
2612
2831
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2613
2832
  };
2614
- var TestCheckItem = class extends LitElement9 {
2833
+ var TestCheckItem = class extends LitElement11 {
2615
2834
  static {
2616
- this.styles = css4`
2835
+ this.styles = css6`
2617
2836
  :host {
2618
2837
  ${btn};
2619
2838
  }
@@ -2642,25 +2861,25 @@ var TestCheckItem = class extends LitElement9 {
2642
2861
  });
2643
2862
  }
2644
2863
  render() {
2645
- return html8` <slot></slot> `;
2864
+ return html10` <slot></slot> `;
2646
2865
  }
2647
2866
  };
2648
- __decorate10([
2867
+ __decorate11([
2649
2868
  consume5({ context: testHostContext, subscribe: true })
2650
2869
  ], TestCheckItem.prototype, "testHost", void 0);
2651
2870
 
2652
2871
  // ../qti-test/dist/components/test-container/test-container.js
2653
2872
  import { consume as consume6 } from "@lit/context";
2654
- import { LitElement as LitElement10, html as html9 } from "lit";
2655
- import { property as property8, state as state3 } from "lit/decorators.js";
2873
+ import { LitElement as LitElement12, html as html11 } from "lit";
2874
+ import { property as property9, state as state3 } from "lit/decorators.js";
2656
2875
  import { until } from "lit/directives/until.js";
2657
- var __decorate11 = function(decorators, target, key, desc) {
2876
+ var __decorate12 = function(decorators, target, key, desc) {
2658
2877
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2659
2878
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2660
2879
  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;
2661
2880
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2662
2881
  };
2663
- var TestContainer = class extends LitElement10 {
2882
+ var TestContainer = class extends LitElement12 {
2664
2883
  constructor() {
2665
2884
  super(...arguments);
2666
2885
  this.customElementRegistry = null;
@@ -2745,7 +2964,7 @@ var TestContainer = class extends LitElement10 {
2745
2964
  }
2746
2965
  #initializeTemplateContent() {
2747
2966
  const template = this.querySelector("template");
2748
- this.#templateContent = template ? template.content : html9``;
2967
+ this.#templateContent = template ? template.content : html11``;
2749
2968
  }
2750
2969
  #applyStyles() {
2751
2970
  const sheet = new CSSStyleSheet();
@@ -2753,57 +2972,57 @@ var TestContainer = class extends LitElement10 {
2753
2972
  this.shadowRoot.adoptedStyleSheets = [sheet];
2754
2973
  }
2755
2974
  render() {
2756
- return html9`
2975
+ return html11`
2757
2976
  ${this.#templateContent}
2758
2977
  <slot></slot>
2759
- ${until(this.testDoc, html9`<span>Loading...</span>`)}
2978
+ ${until(this.testDoc, html11`<span>Loading...</span>`)}
2760
2979
  `;
2761
2980
  }
2762
2981
  };
2763
- __decorate11([
2764
- property8({ attribute: false })
2982
+ __decorate12([
2983
+ property9({ attribute: false })
2765
2984
  ], TestContainer.prototype, "customElementRegistry", void 0);
2766
- __decorate11([
2767
- property8({ type: String, attribute: "test-url" })
2985
+ __decorate12([
2986
+ property9({ type: String, attribute: "test-url" })
2768
2987
  ], TestContainer.prototype, "testURL", void 0);
2769
- __decorate11([
2988
+ __decorate12([
2770
2989
  state3()
2771
2990
  ], TestContainer.prototype, "testDoc", void 0);
2772
- __decorate11([
2991
+ __decorate12([
2773
2992
  state3()
2774
2993
  ], TestContainer.prototype, "testXML", void 0);
2775
- __decorate11([
2994
+ __decorate12([
2776
2995
  consume6({ context: testHostContext, subscribe: true })
2777
2996
  ], TestContainer.prototype, "testHost", void 0);
2778
- __decorate11([
2997
+ __decorate12([
2779
2998
  state3(),
2780
2999
  consume6({ context: qtiContext, subscribe: true })
2781
3000
  ], TestContainer.prototype, "qtiContext", void 0);
2782
- __decorate11([
3001
+ __decorate12([
2783
3002
  watch("testURL", { waitUntilFirstUpdate: true })
2784
3003
  ], TestContainer.prototype, "handleTestURLChange", null);
2785
- __decorate11([
3004
+ __decorate12([
2786
3005
  watch("testXML", { waitUntilFirstUpdate: true })
2787
3006
  ], TestContainer.prototype, "handleTestXMLChange", null);
2788
3007
 
2789
3008
  // ../qti-test/dist/components/test-end-attempt/test-end-attempt.js
2790
- import { css as css5, html as html10, LitElement as LitElement11 } from "lit";
2791
- import { property as property9 } from "lit/decorators.js";
3009
+ import { css as css7, html as html12, LitElement as LitElement13 } from "lit";
3010
+ import { property as property10 } from "lit/decorators.js";
2792
3011
  import { consume as consume7 } from "@lit/context";
2793
- var __decorate12 = function(decorators, target, key, desc) {
3012
+ var __decorate13 = function(decorators, target, key, desc) {
2794
3013
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2795
3014
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2796
3015
  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;
2797
3016
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2798
3017
  };
2799
- var TestEndAttempt = class extends LitElement11 {
3018
+ var TestEndAttempt = class extends LitElement13 {
2800
3019
  _handleTestElementChange(_oldValue, newValue) {
2801
3020
  if (newValue) {
2802
3021
  this.requestUpdate();
2803
3022
  }
2804
3023
  }
2805
3024
  static {
2806
- this.styles = css5`
3025
+ this.styles = css7`
2807
3026
  :host {
2808
3027
  ${btn};
2809
3028
  }
@@ -2848,6 +3067,10 @@ var TestEndAttempt = class extends LitElement11 {
2848
3067
  this._internalDisabled = true;
2849
3068
  return;
2850
3069
  }
3070
+ if (activeItem.adaptive && activeItem.completionStatus === "completed") {
3071
+ this._internalDisabled = true;
3072
+ return;
3073
+ }
2851
3074
  if (!activeItem.adaptive && maxAttempts > 0 && numAttempts >= maxAttempts) {
2852
3075
  this._internalDisabled = true;
2853
3076
  return;
@@ -2859,32 +3082,32 @@ var TestEndAttempt = class extends LitElement11 {
2859
3082
  }
2860
3083
  }
2861
3084
  render() {
2862
- return html10` <slot></slot> `;
3085
+ return html12` <slot></slot> `;
2863
3086
  }
2864
3087
  };
2865
- __decorate12([
3088
+ __decorate13([
2866
3089
  consume7({ context: computedContext, subscribe: true }),
2867
- property9({ attribute: false })
3090
+ property10({ attribute: false })
2868
3091
  ], TestEndAttempt.prototype, "computedContext", void 0);
2869
- __decorate12([
2870
- property9({ type: Boolean, reflect: true, attribute: "disabled" })
3092
+ __decorate13([
3093
+ property10({ type: Boolean, reflect: true, attribute: "disabled" })
2871
3094
  ], TestEndAttempt.prototype, "_internalDisabled", void 0);
2872
- __decorate12([
3095
+ __decorate13([
2873
3096
  watch("computedContext")
2874
3097
  ], TestEndAttempt.prototype, "_handleTestElementChange", null);
2875
3098
 
2876
3099
  // ../qti-test/dist/components/test-item-link/test-item-link.js
2877
- import { css as css6, html as html11, LitElement as LitElement12 } from "lit";
2878
- import { property as property10 } from "lit/decorators.js";
2879
- var __decorate13 = function(decorators, target, key, desc) {
3100
+ import { css as css8, html as html13, LitElement as LitElement14 } from "lit";
3101
+ import { property as property11 } from "lit/decorators.js";
3102
+ var __decorate14 = function(decorators, target, key, desc) {
2880
3103
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2881
3104
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2882
3105
  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;
2883
3106
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2884
3107
  };
2885
- var TestItemLink = class extends LitElement12 {
3108
+ var TestItemLink = class extends LitElement14 {
2886
3109
  static {
2887
- this.styles = css6`
3110
+ this.styles = css8`
2888
3111
  :host {
2889
3112
  ${btn};
2890
3113
  }
@@ -2908,19 +3131,19 @@ var TestItemLink = class extends LitElement12 {
2908
3131
  dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
2909
3132
  }
2910
3133
  render() {
2911
- return html11` <slot></slot> `;
3134
+ return html13` <slot></slot> `;
2912
3135
  }
2913
3136
  };
2914
- __decorate13([
2915
- property10({ type: String, attribute: "item-id" })
3137
+ __decorate14([
3138
+ property11({ type: String, attribute: "item-id" })
2916
3139
  ], TestItemLink.prototype, "itemId", void 0);
2917
3140
 
2918
3141
  // ../qti-test/dist/components/test-item-to-speech/test-item-to-speech.js
2919
- import { html as html12, LitElement as LitElement13, css as css7 } from "lit";
3142
+ import { html as html14, LitElement as LitElement15, css as css9 } from "lit";
2920
3143
  import { consume as consume8, provide as provide3, createContext as createContext2 } from "@lit/context";
2921
- import { property as property11, state as state4 } from "lit/decorators.js";
3144
+ import { property as property12, state as state4 } from "lit/decorators.js";
2922
3145
  import { ifDefined } from "lit/directives/if-defined.js";
2923
- var __decorate14 = function(decorators, target, key, desc) {
3146
+ var __decorate15 = function(decorators, target, key, desc) {
2924
3147
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2925
3148
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2926
3149
  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;
@@ -2949,14 +3172,14 @@ var ICONS = {
2949
3172
  pick: "M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"
2950
3173
  };
2951
3174
  var iconContent = (icon, label) => {
2952
- const svg = html12`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
3175
+ const svg = html14`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
2953
3176
  <path d="${ICONS[icon]}"></path>
2954
3177
  </svg>`;
2955
- return html12`${svg}<span class="label">${label}</span>`;
3178
+ return html14`${svg}<span class="label">${label}</span>`;
2956
3179
  };
2957
- var TtsButtonBase = class extends LitElement13 {
3180
+ var TtsButtonBase = class extends LitElement15 {
2958
3181
  static {
2959
- this.styles = css7`
3182
+ this.styles = css9`
2960
3183
  :host {
2961
3184
  display: inline-flex;
2962
3185
  }
@@ -3020,15 +3243,15 @@ var TtsButtonBase = class extends LitElement13 {
3020
3243
  this.#internals.states.add("picking");
3021
3244
  }
3022
3245
  };
3023
- __decorate14([
3024
- property11({ type: String })
3246
+ __decorate15([
3247
+ property12({ type: String })
3025
3248
  ], TtsButtonBase.prototype, "label", void 0);
3026
- __decorate14([
3249
+ __decorate15([
3027
3250
  consume8({ context: ttsContext, subscribe: true })
3028
3251
  ], TtsButtonBase.prototype, "_tts", void 0);
3029
- var TestItemToSpeech = class extends LitElement13 {
3252
+ var TestItemToSpeech = class extends LitElement15 {
3030
3253
  static {
3031
- this.styles = css7`
3254
+ this.styles = css9`
3032
3255
  :host {
3033
3256
  display: inline-flex;
3034
3257
  flex-wrap: wrap;
@@ -3181,7 +3404,7 @@ var TestItemToSpeech = class extends LitElement13 {
3181
3404
  this.#contentMode = false;
3182
3405
  }
3183
3406
  render() {
3184
- return html12`<slot></slot>`;
3407
+ return html14`<slot></slot>`;
3185
3408
  }
3186
3409
  /**
3187
3410
  * An item (re)rendered. If it is ours — e.g. after navigating to the item already shown — the
@@ -3618,16 +3841,16 @@ var TestItemToSpeech = class extends LitElement13 {
3618
3841
  }
3619
3842
  }
3620
3843
  };
3621
- __decorate14([
3622
- property11({ type: String })
3844
+ __decorate15([
3845
+ property12({ type: String })
3623
3846
  ], TestItemToSpeech.prototype, "language", void 0);
3624
- __decorate14([
3847
+ __decorate15([
3625
3848
  consume8({ context: sessionContext, subscribe: true })
3626
3849
  ], TestItemToSpeech.prototype, "_sessionContext", void 0);
3627
- __decorate14([
3850
+ __decorate15([
3628
3851
  consume8({ context: testHostContext, subscribe: true })
3629
3852
  ], TestItemToSpeech.prototype, "testHost", void 0);
3630
- __decorate14([
3853
+ __decorate15([
3631
3854
  state4(),
3632
3855
  provide3({ context: ttsContext })
3633
3856
  ], TestItemToSpeech.prototype, "_ttsContext", void 0);
@@ -3644,19 +3867,19 @@ var TestTtsPlay = class extends TtsButtonBase {
3644
3867
  }
3645
3868
  render() {
3646
3869
  const playing = this._tts?.state === "playing";
3647
- return html12`
3870
+ return html14`
3648
3871
  <button part="button" aria-label=${ifDefined(playing ? this.pauseLabel : this.label)} @click=${this.#toggle}>
3649
- ${playing ? html12`<slot name="pause">${iconContent("pause", this.pauseLabel ?? "Pause")}</slot>` : html12`<slot name="play">${iconContent("play", this.label ?? "Play")}</slot>`}
3872
+ ${playing ? html14`<slot name="pause">${iconContent("pause", this.pauseLabel ?? "Pause")}</slot>` : html14`<slot name="play">${iconContent("play", this.label ?? "Play")}</slot>`}
3650
3873
  </button>
3651
3874
  `;
3652
3875
  }
3653
3876
  };
3654
- __decorate14([
3655
- property11({ type: String, attribute: "pause-label" })
3877
+ __decorate15([
3878
+ property12({ type: String, attribute: "pause-label" })
3656
3879
  ], TestTtsPlay.prototype, "pauseLabel", void 0);
3657
3880
  var TestTtsPause = class extends TtsButtonBase {
3658
3881
  render() {
3659
- return html12`
3882
+ return html14`
3660
3883
  <button
3661
3884
  part="button"
3662
3885
  aria-label=${ifDefined(this.label)}
@@ -3670,7 +3893,7 @@ var TestTtsPause = class extends TtsButtonBase {
3670
3893
  };
3671
3894
  var TestTtsResume = class extends TtsButtonBase {
3672
3895
  render() {
3673
- return html12`
3896
+ return html14`
3674
3897
  <button
3675
3898
  part="button"
3676
3899
  aria-label=${ifDefined(this.label)}
@@ -3685,7 +3908,7 @@ var TestTtsResume = class extends TtsButtonBase {
3685
3908
  var TestTtsStop = class extends TtsButtonBase {
3686
3909
  render() {
3687
3910
  const idle = this._tts?.state === "idle" && !this._tts?.picking;
3688
- return html12`
3911
+ return html14`
3689
3912
  <button part="button" aria-label=${ifDefined(this.label)} ?disabled=${idle} @click=${() => this._tts?.stop()}>
3690
3913
  <slot>${iconContent("stop", this.label ?? "Stop")}</slot>
3691
3914
  </button>
@@ -3696,7 +3919,7 @@ var TestTtsPrev = class extends TtsButtonBase {
3696
3919
  render() {
3697
3920
  const collected = (this._tts?.elementCount ?? 0) > 0;
3698
3921
  const atStart = (this._tts?.currentElementIndex ?? 0) === 0;
3699
- return html12`
3922
+ return html14`
3700
3923
  <button
3701
3924
  part="button"
3702
3925
  aria-label=${ifDefined(this.label)}
@@ -3712,7 +3935,7 @@ var TestTtsNext = class extends TtsButtonBase {
3712
3935
  render() {
3713
3936
  const count = this._tts?.elementCount ?? 0;
3714
3937
  const atEnd = count > 0 && (this._tts?.currentElementIndex ?? 0) >= count - 1;
3715
- return html12`
3938
+ return html14`
3716
3939
  <button
3717
3940
  part="button"
3718
3941
  aria-label=${ifDefined(this.label)}
@@ -3726,7 +3949,7 @@ var TestTtsNext = class extends TtsButtonBase {
3726
3949
  };
3727
3950
  var TestTtsPick = class extends TtsButtonBase {
3728
3951
  render() {
3729
- return html12`
3952
+ return html14`
3730
3953
  <button
3731
3954
  part="button"
3732
3955
  aria-label=${ifDefined(this.label)}
@@ -3741,9 +3964,9 @@ var TestTtsPick = class extends TtsButtonBase {
3741
3964
 
3742
3965
  // ../qti-test/dist/components/test-navigation/test-navigation.js
3743
3966
  import { ContextConsumer, consume as consume9, provide as provide4 } from "@lit/context";
3744
- import { html as html13, LitElement as LitElement14 } from "lit";
3745
- import { property as property12, state as state5 } from "lit/decorators.js";
3746
- var __decorate15 = function(decorators, target, key, desc) {
3967
+ import { html as html15, LitElement as LitElement16 } from "lit";
3968
+ import { property as property13, state as state5 } from "lit/decorators.js";
3969
+ var __decorate16 = function(decorators, target, key, desc) {
3747
3970
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3748
3971
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3749
3972
  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;
@@ -3752,7 +3975,7 @@ var __decorate15 = function(decorators, target, key, desc) {
3752
3975
  var newQtiContext = () => ({
3753
3976
  QTI_CONTEXT: { testIdentifier: "", candidateIdentifier: "", environmentIdentifier: "default" }
3754
3977
  });
3755
- var TestNavigation = class extends LitElement14 {
3978
+ var TestNavigation = class extends LitElement16 {
3756
3979
  /**
3757
3980
  * @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
3758
3981
  * enclosing test's: reading returns it, writing replaces it, so a host that has always set the
@@ -3839,7 +4062,8 @@ var TestNavigation = class extends LitElement14 {
3839
4062
  this.#optimality.set(itemContext.identifier, optimality);
3840
4063
  const computedItem = this.computedItemFor(itemContext.identifier);
3841
4064
  const numAttempts = Number(itemContext.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
3842
- this.afterAttemptEnded(event.composedPath()[0]?.closest("qti-assessment-item"), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts));
4065
+ const completionStatus = itemContext.variables?.find((v) => v.identifier === "completionStatus")?.value;
4066
+ this.afterAttemptEnded(event.composedPath()[0]?.closest("qti-assessment-item"), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts, computedItem?.adaptive, completionStatus));
3843
4067
  }
3844
4068
  /**
3845
4069
  * Extension point for presentation packages reacting to an ended attempt.
@@ -3898,7 +4122,7 @@ var TestNavigation = class extends LitElement14 {
3898
4122
  }
3899
4123
  }
3900
4124
  render() {
3901
- return html13`<slot></slot>`;
4125
+ return html15`<slot></slot>`;
3902
4126
  }
3903
4127
  /* PK: on test connected we can build the computed context */
3904
4128
  #handleTestConnected(event) {
@@ -4142,7 +4366,7 @@ var TestNavigation = class extends LitElement14 {
4142
4366
  if (numAttempts > 0)
4143
4367
  this.#optimality.set(computedItem.identifier, optimality);
4144
4368
  }
4145
- const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);
4369
+ const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts, computedItem.adaptive, completionStatus);
4146
4370
  return {
4147
4371
  ...computedItem,
4148
4372
  completionStatus,
@@ -4190,10 +4414,17 @@ var TestNavigation = class extends LitElement14 {
4190
4414
  * `optimality` reflects the last *ended attempt* (see #optimality), not the
4191
4415
  * live selection — so a freshly-picked optimal answer doesn't count as done
4192
4416
  * until test-end-attempt evaluates it.
4417
+ *
4418
+ * Adaptive items decide this themselves: max-attempts does not apply to them
4419
+ * (QTI 3, itemSessionControl), and a wrong attempt may be the step that leads
4420
+ * on to the next part of the item. They are done once their response
4421
+ * processing sets completionStatus to 'completed'.
4193
4422
  */
4194
- #isItemDone(numAttempts, optimality, maxAttempts) {
4423
+ #isItemDone(numAttempts, optimality, maxAttempts, adaptive, completionStatus) {
4195
4424
  if (numAttempts === 0)
4196
4425
  return false;
4426
+ if (adaptive)
4427
+ return completionStatus === "completed";
4197
4428
  if (optimality !== "suboptimal")
4198
4429
  return true;
4199
4430
  const max = maxAttempts ?? 1;
@@ -4253,50 +4484,50 @@ var TestNavigation = class extends LitElement14 {
4253
4484
  return Number.isNaN(parsed) ? null : parsed;
4254
4485
  }
4255
4486
  };
4256
- __decorate15([
4257
- property12({ type: String })
4487
+ __decorate16([
4488
+ property13({ type: String })
4258
4489
  ], TestNavigation.prototype, "identifier", void 0);
4259
- __decorate15([
4490
+ __decorate16([
4260
4491
  state5()
4261
4492
  ], TestNavigation.prototype, "initContext", void 0);
4262
- __decorate15([
4493
+ __decorate16([
4263
4494
  state5(),
4264
4495
  consume9({ context: configContext, subscribe: true })
4265
4496
  ], TestNavigation.prototype, "configContext", void 0);
4266
- __decorate15([
4497
+ __decorate16([
4267
4498
  state5(),
4268
4499
  consume9({ context: testContext, subscribe: true })
4269
4500
  ], TestNavigation.prototype, "_testContext", void 0);
4270
- __decorate15([
4501
+ __decorate16([
4271
4502
  state5(),
4272
4503
  consume9({ context: sessionContext, subscribe: true })
4273
4504
  ], TestNavigation.prototype, "_sessionContext", void 0);
4274
- __decorate15([
4505
+ __decorate16([
4275
4506
  state5(),
4276
4507
  provide4({ context: computedContext })
4277
4508
  ], TestNavigation.prototype, "computedContext", void 0);
4278
- __decorate15([
4279
- property12({ type: Boolean, attribute: "auto-score-items" })
4509
+ __decorate16([
4510
+ property13({ type: Boolean, attribute: "auto-score-items" })
4280
4511
  ], TestNavigation.prototype, "autoScoreItems", void 0);
4281
4512
 
4282
4513
  // ../qti-test/dist/components/test-next/test-next.js
4283
- import { css as css8, html as html14, LitElement as LitElement15 } from "lit";
4284
- import { property as property13 } from "lit/decorators.js";
4514
+ import { css as css10, html as html16, LitElement as LitElement17 } from "lit";
4515
+ import { property as property14 } from "lit/decorators.js";
4285
4516
  import { consume as consume10 } from "@lit/context";
4286
- var __decorate16 = function(decorators, target, key, desc) {
4517
+ var __decorate17 = function(decorators, target, key, desc) {
4287
4518
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4288
4519
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4289
4520
  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;
4290
4521
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4291
4522
  };
4292
- var TestNext = class extends LitElement15 {
4523
+ var TestNext = class extends LitElement17 {
4293
4524
  _handleTestElementChange(_oldValue, newValue) {
4294
4525
  if (newValue) {
4295
4526
  this.requestUpdate();
4296
4527
  }
4297
4528
  }
4298
4529
  static {
4299
- this.styles = css8`
4530
+ this.styles = css10`
4300
4531
  :host {
4301
4532
  ${btn};
4302
4533
  }
@@ -4353,29 +4584,29 @@ var TestNext = class extends LitElement15 {
4353
4584
  dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
4354
4585
  }
4355
4586
  render() {
4356
- return html14`<slot></slot>`;
4587
+ return html16`<slot></slot>`;
4357
4588
  }
4358
4589
  };
4359
- __decorate16([
4360
- property13({ type: Boolean, reflect: true, attribute: "disabled" })
4590
+ __decorate17([
4591
+ property14({ type: Boolean, reflect: true, attribute: "disabled" })
4361
4592
  ], TestNext.prototype, "_internalDisabled", void 0);
4362
- __decorate16([
4593
+ __decorate17([
4363
4594
  consume10({ context: computedContext, subscribe: true })
4364
4595
  ], TestNext.prototype, "computedContext", void 0);
4365
- __decorate16([
4596
+ __decorate17([
4366
4597
  watch("computedContext")
4367
4598
  ], TestNext.prototype, "_handleTestElementChange", null);
4368
4599
 
4369
4600
  // ../qti-test/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js
4370
- import { html as html15, LitElement as LitElement16 } from "lit";
4601
+ import { html as html17, LitElement as LitElement18 } from "lit";
4371
4602
  import { consume as consume11 } from "@lit/context";
4372
- var __decorate17 = function(decorators, target, key, desc) {
4603
+ var __decorate18 = function(decorators, target, key, desc) {
4373
4604
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4374
4605
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4375
4606
  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;
4376
4607
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4377
4608
  };
4378
- var TestPagingButtonsStamp = class extends LitElement16 {
4609
+ var TestPagingButtonsStamp = class extends LitElement18 {
4379
4610
  #internals;
4380
4611
  createRenderRoot() {
4381
4612
  return this;
@@ -4392,33 +4623,33 @@ var TestPagingButtonsStamp = class extends LitElement16 {
4392
4623
  }
4393
4624
  render() {
4394
4625
  if (!this.computedContext)
4395
- return html15``;
4626
+ return html17``;
4396
4627
  const items = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items));
4397
- return html15` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
4628
+ return html17` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
4398
4629
  }
4399
4630
  };
4400
- __decorate17([
4631
+ __decorate18([
4401
4632
  consume11({ context: computedContext, subscribe: true })
4402
4633
  ], TestPagingButtonsStamp.prototype, "computedContext", void 0);
4403
4634
 
4404
4635
  // ../qti-test/dist/components/test-prev/test-prev.js
4405
- import { css as css9, html as html16, LitElement as LitElement17 } from "lit";
4406
- import { property as property14 } from "lit/decorators.js";
4636
+ import { css as css11, html as html18, LitElement as LitElement19 } from "lit";
4637
+ import { property as property15 } from "lit/decorators.js";
4407
4638
  import { consume as consume12 } from "@lit/context";
4408
- var __decorate18 = function(decorators, target, key, desc) {
4639
+ var __decorate19 = function(decorators, target, key, desc) {
4409
4640
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4410
4641
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4411
4642
  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;
4412
4643
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4413
4644
  };
4414
- var TestPrev = class extends LitElement17 {
4645
+ var TestPrev = class extends LitElement19 {
4415
4646
  _handleTestElementChange(_oldValue, newValue) {
4416
4647
  if (newValue) {
4417
4648
  this.requestUpdate();
4418
4649
  }
4419
4650
  }
4420
4651
  static {
4421
- this.styles = css9`
4652
+ this.styles = css11`
4422
4653
  :host {
4423
4654
  ${btn};
4424
4655
  }
@@ -4462,51 +4693,51 @@ var TestPrev = class extends LitElement17 {
4462
4693
  dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
4463
4694
  }
4464
4695
  render() {
4465
- return html16`<slot></slot>`;
4696
+ return html18`<slot></slot>`;
4466
4697
  }
4467
4698
  };
4468
- __decorate18([
4469
- property14({ type: Boolean, reflect: true, attribute: "disabled" })
4699
+ __decorate19([
4700
+ property15({ type: Boolean, reflect: true, attribute: "disabled" })
4470
4701
  ], TestPrev.prototype, "_internalDisabled", void 0);
4471
- __decorate18([
4702
+ __decorate19([
4472
4703
  consume12({ context: computedContext, subscribe: true })
4473
4704
  ], TestPrev.prototype, "computedContext", void 0);
4474
- __decorate18([
4705
+ __decorate19([
4475
4706
  watch("computedContext")
4476
4707
  ], TestPrev.prototype, "_handleTestElementChange", null);
4477
4708
 
4478
4709
  // ../qti-test/dist/components/test-print-context/test-print-context.js
4479
- import { html as html17, LitElement as LitElement18 } from "lit";
4710
+ import { html as html19, LitElement as LitElement20 } from "lit";
4480
4711
  import { consume as consume13 } from "@lit/context";
4481
4712
  import { state as state6 } from "lit/decorators.js";
4482
- var __decorate19 = function(decorators, target, key, desc) {
4713
+ var __decorate20 = function(decorators, target, key, desc) {
4483
4714
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4484
4715
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4485
4716
  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;
4486
4717
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4487
4718
  };
4488
- var TestPrintContext = class extends LitElement18 {
4719
+ var TestPrintContext = class extends LitElement20 {
4489
4720
  render() {
4490
- return html17` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
4721
+ return html19` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
4491
4722
  }
4492
4723
  };
4493
- __decorate19([
4724
+ __decorate20([
4494
4725
  state6(),
4495
4726
  consume13({ context: computedContext, subscribe: true })
4496
4727
  ], TestPrintContext.prototype, "computedContext", void 0);
4497
4728
 
4498
4729
  // ../qti-test/dist/components/test-print-item-variables/test-print-item-variables.js
4499
- import { html as html18, css as css10, LitElement as LitElement19 } from "lit";
4730
+ import { html as html20, css as css12, LitElement as LitElement21 } from "lit";
4500
4731
  import { consume as consume14 } from "@lit/context";
4501
- var __decorate20 = function(decorators, target, key, desc) {
4732
+ var __decorate21 = function(decorators, target, key, desc) {
4502
4733
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4503
4734
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4504
4735
  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;
4505
4736
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4506
4737
  };
4507
- var TestPrintVariables = class extends LitElement19 {
4738
+ var TestPrintVariables = class extends LitElement21 {
4508
4739
  static {
4509
- this.styles = css10`
4740
+ this.styles = css12`
4510
4741
  table {
4511
4742
  width: 100%;
4512
4743
  border-collapse: collapse;
@@ -4532,10 +4763,10 @@ var TestPrintVariables = class extends LitElement19 {
4532
4763
  render() {
4533
4764
  const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
4534
4765
  if (!activeItem || !activeItem.variables)
4535
- return html18``;
4766
+ return html20``;
4536
4767
  const responseVariables = activeItem.variables.filter((v) => v.type === "response");
4537
4768
  const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
4538
- const renderTable = (variables, title) => html18`
4769
+ const renderTable = (variables, title) => html20`
4539
4770
  <h3>${title}</h3>
4540
4771
  <table>
4541
4772
  <thead>
@@ -4552,7 +4783,7 @@ var TestPrintVariables = class extends LitElement19 {
4552
4783
  const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
4553
4784
  const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
4554
4785
  const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
4555
- return html18`
4786
+ return html20`
4556
4787
  <tr>
4557
4788
  <td>${v.identifier}</td>
4558
4789
  <td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
@@ -4565,26 +4796,26 @@ var TestPrintVariables = class extends LitElement19 {
4565
4796
  </tbody>
4566
4797
  </table>
4567
4798
  `;
4568
- return html18`
4799
+ return html20`
4569
4800
  ${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
4570
4801
  `;
4571
4802
  }
4572
4803
  };
4573
- __decorate20([
4804
+ __decorate21([
4574
4805
  consume14({ context: computedContext, subscribe: true })
4575
4806
  ], TestPrintVariables.prototype, "computedContext", void 0);
4576
4807
 
4577
4808
  // ../qti-test/dist/components/test-scoring-buttons/test-scoring-buttons.js
4578
- import { html as html19, LitElement as LitElement20, nothing as nothing3 } from "lit";
4809
+ import { html as html21, LitElement as LitElement22, nothing as nothing3 } from "lit";
4579
4810
  import { consume as consume15 } from "@lit/context";
4580
- import { property as property15 } from "lit/decorators.js";
4581
- var __decorate21 = function(decorators, target, key, desc) {
4811
+ import { property as property16 } from "lit/decorators.js";
4812
+ var __decorate22 = function(decorators, target, key, desc) {
4582
4813
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4583
4814
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4584
4815
  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;
4585
4816
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4586
4817
  };
4587
- var TestScoringButtons = class extends LitElement20 {
4818
+ var TestScoringButtons = class extends LitElement22 {
4588
4819
  createRenderRoot() {
4589
4820
  return this;
4590
4821
  }
@@ -4610,7 +4841,7 @@ var TestScoringButtons = class extends LitElement20 {
4610
4841
  render() {
4611
4842
  const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
4612
4843
  if (!activeItem || !activeItem.variables)
4613
- return html19``;
4844
+ return html21``;
4614
4845
  const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
4615
4846
  const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
4616
4847
  const score = scoreOutcome?.value;
@@ -4618,7 +4849,7 @@ var TestScoringButtons = class extends LitElement20 {
4618
4849
  if (!maxScore || !scoreOutcome)
4619
4850
  return nothing3;
4620
4851
  const scores = [...Array(Number(maxScore) + 1).keys()];
4621
- return html19`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : nothing3}`;
4852
+ return html21`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : nothing3}`;
4622
4853
  }
4623
4854
  constructor() {
4624
4855
  super();
@@ -4634,27 +4865,27 @@ var TestScoringButtons = class extends LitElement20 {
4634
4865
  });
4635
4866
  }
4636
4867
  };
4637
- __decorate21([
4638
- property15({ type: String, attribute: "view" })
4868
+ __decorate22([
4869
+ property16({ type: String, attribute: "view" })
4639
4870
  ], TestScoringButtons.prototype, "view", void 0);
4640
- __decorate21([
4641
- property15({ type: Boolean })
4871
+ __decorate22([
4872
+ property16({ type: Boolean })
4642
4873
  ], TestScoringButtons.prototype, "disabled", void 0);
4643
- __decorate21([
4874
+ __decorate22([
4644
4875
  consume15({ context: computedContext, subscribe: true })
4645
4876
  ], TestScoringButtons.prototype, "computedContext", void 0);
4646
4877
 
4647
4878
  // ../qti-test/dist/components/test-scoring-feedback/test-scoring-feedback.js
4648
4879
  import { consume as consume16 } from "@lit/context";
4649
- import { html as html20, LitElement as LitElement21 } from "lit";
4650
- import { property as property16 } from "lit/decorators.js";
4651
- var __decorate22 = function(decorators, target, key, desc) {
4880
+ import { html as html22, LitElement as LitElement23 } from "lit";
4881
+ import { property as property17 } from "lit/decorators.js";
4882
+ var __decorate23 = function(decorators, target, key, desc) {
4652
4883
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4653
4884
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4654
4885
  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;
4655
4886
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4656
4887
  };
4657
- var TestScoringFeedback = class extends LitElement21 {
4888
+ var TestScoringFeedback = class extends LitElement23 {
4658
4889
  constructor() {
4659
4890
  super(...arguments);
4660
4891
  this.view = null;
@@ -4662,9 +4893,9 @@ var TestScoringFeedback = class extends LitElement21 {
4662
4893
  render() {
4663
4894
  const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
4664
4895
  if (!activeItem || !activeItem.variables)
4665
- return html20``;
4896
+ return html22``;
4666
4897
  if (activeItem["category"] === "dep-informational")
4667
- return html20`<div>${this.dataset.informational}</div>`;
4898
+ return html22`<div>${this.dataset.informational}</div>`;
4668
4899
  const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
4669
4900
  const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
4670
4901
  const score = parseFloat(scoreOutcome?.value);
@@ -4684,26 +4915,26 @@ var TestScoringFeedback = class extends LitElement21 {
4684
4915
  }
4685
4916
  return this.dataset.inProgress;
4686
4917
  };
4687
- return html20`<div>${feedbackText()}</div>`;
4918
+ return html22`<div>${feedbackText()}</div>`;
4688
4919
  }
4689
4920
  };
4690
- __decorate22([
4921
+ __decorate23([
4691
4922
  consume16({ context: computedContext, subscribe: true })
4692
4923
  ], TestScoringFeedback.prototype, "computedContext", void 0);
4693
- __decorate22([
4694
- property16({ type: String, attribute: "view" })
4924
+ __decorate23([
4925
+ property17({ type: String, attribute: "view" })
4695
4926
  ], TestScoringFeedback.prototype, "view", void 0);
4696
4927
 
4697
4928
  // ../qti-test/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js
4698
- import { html as html21, LitElement as LitElement22 } from "lit";
4929
+ import { html as html23, LitElement as LitElement24 } from "lit";
4699
4930
  import { consume as consume17 } from "@lit/context";
4700
- var __decorate23 = function(decorators, target, key, desc) {
4931
+ var __decorate24 = function(decorators, target, key, desc) {
4701
4932
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4702
4933
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4703
4934
  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;
4704
4935
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4705
4936
  };
4706
- var TestSectionButtonsStamp = class extends LitElement22 {
4937
+ var TestSectionButtonsStamp = class extends LitElement24 {
4707
4938
  #internals;
4708
4939
  createRenderRoot() {
4709
4940
  return this;
@@ -4720,27 +4951,27 @@ var TestSectionButtonsStamp = class extends LitElement22 {
4720
4951
  }
4721
4952
  render() {
4722
4953
  if (!this.computedContext)
4723
- return html21``;
4954
+ return html23``;
4724
4955
  const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
4725
- return html21` ${sections.map((item) => this.myTemplate({ item }))} `;
4956
+ return html23` ${sections.map((item) => this.myTemplate({ item }))} `;
4726
4957
  }
4727
4958
  };
4728
- __decorate23([
4959
+ __decorate24([
4729
4960
  consume17({ context: computedContext, subscribe: true })
4730
4961
  ], TestSectionButtonsStamp.prototype, "computedContext", void 0);
4731
4962
 
4732
4963
  // ../qti-test/dist/components/test-section-link/test-section-link.js
4733
- import { css as css11, html as html22, LitElement as LitElement23 } from "lit";
4734
- import { property as property17 } from "lit/decorators.js";
4735
- var __decorate24 = function(decorators, target, key, desc) {
4964
+ import { css as css13, html as html24, LitElement as LitElement25 } from "lit";
4965
+ import { property as property18 } from "lit/decorators.js";
4966
+ var __decorate25 = function(decorators, target, key, desc) {
4736
4967
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4737
4968
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4738
4969
  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;
4739
4970
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4740
4971
  };
4741
- var TestSectionLink = class extends LitElement23 {
4972
+ var TestSectionLink = class extends LitElement25 {
4742
4973
  static {
4743
- this.styles = css11`
4974
+ this.styles = css13`
4744
4975
  :host {
4745
4976
  ${btn};
4746
4977
  }
@@ -4764,24 +4995,24 @@ var TestSectionLink = class extends LitElement23 {
4764
4995
  this.addEventListener("click", () => this.#requestItem(this.sectionId));
4765
4996
  }
4766
4997
  render() {
4767
- return html22` <slot></slot> `;
4998
+ return html24` <slot></slot> `;
4768
4999
  }
4769
5000
  };
4770
- __decorate24([
4771
- property17({ type: String, attribute: "section-id" })
5001
+ __decorate25([
5002
+ property18({ type: String, attribute: "section-id" })
4772
5003
  ], TestSectionLink.prototype, "sectionId", void 0);
4773
5004
 
4774
5005
  // ../qti-test/dist/components/test-stamp/test-stamp.js
4775
- import { html as html23, LitElement as LitElement24, nothing as nothing4 } from "lit";
4776
- import { property as property18, state as state7 } from "lit/decorators.js";
5006
+ import { html as html25, LitElement as LitElement26, nothing as nothing4 } from "lit";
5007
+ import { property as property19, state as state7 } from "lit/decorators.js";
4777
5008
  import { consume as consume18 } from "@lit/context";
4778
- var __decorate25 = function(decorators, target, key, desc) {
5009
+ var __decorate26 = function(decorators, target, key, desc) {
4779
5010
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4780
5011
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4781
5012
  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;
4782
5013
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4783
5014
  };
4784
- var TestStamp = class extends LitElement24 {
5015
+ var TestStamp = class extends LitElement26 {
4785
5016
  constructor() {
4786
5017
  super(...arguments);
4787
5018
  this.debug = false;
@@ -4844,33 +5075,33 @@ var TestStamp = class extends LitElement24 {
4844
5075
  }));
4845
5076
  }
4846
5077
  render() {
4847
- return html23` ${this.debug ? html23`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing4}
5078
+ return html25` ${this.debug ? html25`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing4}
4848
5079
  ${this.myTemplate ? this.myTemplate(this.stampContext) : nothing4}`;
4849
5080
  }
4850
5081
  };
4851
- __decorate25([
4852
- property18({ type: Boolean, reflect: true })
5082
+ __decorate26([
5083
+ property19({ type: Boolean, reflect: true })
4853
5084
  ], TestStamp.prototype, "debug", void 0);
4854
- __decorate25([
5085
+ __decorate26([
4855
5086
  state7(),
4856
5087
  consume18({ context: computedContext, subscribe: true })
4857
5088
  ], TestStamp.prototype, "computedContext", void 0);
4858
- __decorate25([
5089
+ __decorate26([
4859
5090
  state7()
4860
5091
  ], TestStamp.prototype, "stampContext", void 0);
4861
5092
 
4862
5093
  // ../qti-test/dist/components/test-view-toggle/test-view.js
4863
- import { html as html24, LitElement as LitElement25 } from "lit";
4864
- import { property as property19, state as state8 } from "lit/decorators.js";
5094
+ import { html as html26, LitElement as LitElement27 } from "lit";
5095
+ import { property as property20, state as state8 } from "lit/decorators.js";
4865
5096
  import { consume as consume19 } from "@lit/context";
4866
- var __decorate26 = function(decorators, target, key, desc) {
5097
+ var __decorate27 = function(decorators, target, key, desc) {
4867
5098
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4868
5099
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4869
5100
  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;
4870
5101
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4871
5102
  };
4872
5103
  var _a;
4873
- var TestView = class extends LitElement25 {
5104
+ var TestView = class extends LitElement27 {
4874
5105
  constructor() {
4875
5106
  super(...arguments);
4876
5107
  this.label = "view";
@@ -4898,7 +5129,7 @@ var TestView = class extends LitElement25 {
4898
5129
  dispatchPublic(this, "cito-test-switch-view", view);
4899
5130
  }
4900
5131
  render() {
4901
- return html24`
5132
+ return html26`
4902
5133
  <label part="label" for="viewSelect">${this.label}</label>
4903
5134
  <select
4904
5135
  part="select"
@@ -4908,38 +5139,38 @@ var TestView = class extends LitElement25 {
4908
5139
  this._switchView(el.value);
4909
5140
  }}
4910
5141
  >
4911
- ${this._viewOptions.map((v) => html24`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`)}
5142
+ ${this._viewOptions.map((v) => html26`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`)}
4912
5143
  </select>
4913
5144
  `;
4914
5145
  }
4915
5146
  };
4916
5147
  _a = TestView;
4917
- __decorate26([
5148
+ __decorate27([
4918
5149
  consume19({ context: sessionContext, subscribe: true })
4919
5150
  ], TestView.prototype, "sessionContext", void 0);
4920
- __decorate26([
4921
- property19({ type: String })
5151
+ __decorate27([
5152
+ property20({ type: String })
4922
5153
  ], TestView.prototype, "label", void 0);
4923
- __decorate26([
4924
- property19({ type: String, attribute: "view-options" })
5154
+ __decorate27([
5155
+ property20({ type: String, attribute: "view-options" })
4925
5156
  ], TestView.prototype, "viewOptions", void 0);
4926
- __decorate26([
5157
+ __decorate27([
4927
5158
  watch("viewOptions", { waitUntilFirstUpdate: true })
4928
5159
  ], TestView.prototype, "_handleViewOptionsChange", void 0);
4929
- __decorate26([
5160
+ __decorate27([
4930
5161
  state8()
4931
5162
  ], TestView.prototype, "_viewOptions", void 0);
4932
5163
 
4933
5164
  // ../qti-test/dist/components/test-view-toggle/test-view-toggle.js
4934
5165
  import { consume as consume20 } from "@lit/context";
4935
- import { html as html25, LitElement as LitElement26, nothing as nothing5 } from "lit";
4936
- var __decorate27 = function(decorators, target, key, desc) {
5166
+ import { html as html27, LitElement as LitElement28, nothing as nothing5 } from "lit";
5167
+ var __decorate28 = function(decorators, target, key, desc) {
4937
5168
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4938
5169
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4939
5170
  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;
4940
5171
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4941
5172
  };
4942
- var TestViewToggle = class extends LitElement26 {
5173
+ var TestViewToggle = class extends LitElement28 {
4943
5174
  createRenderRoot() {
4944
5175
  return this;
4945
5176
  }
@@ -4965,12 +5196,12 @@ var TestViewToggle = class extends LitElement26 {
4965
5196
  });
4966
5197
  }
4967
5198
  render() {
4968
- return html25`${this.myTemplate ? this.myTemplate({
5199
+ return html27`${this.myTemplate ? this.myTemplate({
4969
5200
  view: this.sessionContext?.view
4970
5201
  }) : nothing5}`;
4971
5202
  }
4972
5203
  };
4973
- __decorate27([
5204
+ __decorate28([
4974
5205
  consume20({ context: sessionContext, subscribe: true })
4975
5206
  ], TestViewToggle.prototype, "sessionContext", void 0);
4976
5207
 
@@ -4979,9 +5210,11 @@ var qtiTestElements = [
4979
5210
  { tag: "qti-assessment-item-ref", ctor: QtiAssessmentItemRef },
4980
5211
  { tag: "qti-assessment-section", ctor: QtiAssessmentSection },
4981
5212
  { tag: "qti-assessment-test", ctor: QtiAssessmentTest },
5213
+ { tag: "qti-branch-rule", ctor: QtiBranchRule },
4982
5214
  { tag: "qti-item-session-control", ctor: QtiItemSessionControl },
4983
5215
  { tag: "qti-number-selected", ctor: QtiNumberSelected },
4984
5216
  { tag: "qti-outcome-processing", ctor: QtiOutcomeProcessing },
5217
+ { tag: "qti-pre-condition", ctor: QtiPreCondition },
4985
5218
  { tag: "qti-test", ctor: QtiTest },
4986
5219
  { tag: "qti-test-feedback", ctor: QtiTestFeedback },
4987
5220
  { tag: "qti-test-part", ctor: QtiTestPart },
@@ -5017,8 +5250,10 @@ export {
5017
5250
  QtiAssessmentItemRef,
5018
5251
  QtiAssessmentSection,
5019
5252
  QtiAssessmentTest,
5253
+ QtiBranchRule,
5020
5254
  QtiItemSessionControl,
5021
5255
  QtiNumberSelected,
5256
+ QtiPreCondition,
5022
5257
  QtiOutcomeProcessing,
5023
5258
  QtiOutcomeProcessingProcessor,
5024
5259
  QtiTestFeedback,
@@ -5067,4 +5302,4 @@ export {
5067
5302
  * Portions Copyright (c) 2013, the Dart project authors.
5068
5303
  *)
5069
5304
  */
5070
- //# sourceMappingURL=chunk-EUKU5QKV.js.map
5305
+ //# sourceMappingURL=chunk-K3VKQ6QF.js.map