@citolab/qti-components 9.2.0 → 9.3.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.
@@ -25,7 +25,8 @@ import {
25
25
 
26
26
  // ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
27
27
  import { LitElement, nothing as nothing2 } from "lit";
28
- import { property } from "lit/decorators.js";
28
+ import { property, state } from "lit/decorators.js";
29
+ import { consume } from "@lit/context";
29
30
 
30
31
  // ../../node_modules/.pnpm/@heximal+templates@0.1.5/node_modules/@heximal/templates/index.js
31
32
  import { render as renderLit, nothing } from "lit-html";
@@ -1115,9 +1116,8 @@ var QtiAssessmentItemRef = class extends LitElement {
1115
1116
  super(...arguments);
1116
1117
  this.xmlDoc = null;
1117
1118
  this.myTemplate = null;
1119
+ this.#rendered = null;
1118
1120
  }
1119
- // @consume({ context: computedContext, subscribe: true })
1120
- // private computedContext: ComputedContext;
1121
1121
  /**
1122
1122
  * The `<qti-weight>` children of this ref, keyed by identifier — what
1123
1123
  * `qti-test-variables`' `weight-identifier` resolves against.
@@ -1181,10 +1181,37 @@ var QtiAssessmentItemRef = class extends LitElement {
1181
1181
  detail: { identifier: this.identifier, href: this.href, category: this.category }
1182
1182
  }));
1183
1183
  }
1184
+ #computedItem() {
1185
+ for (const testPart of this.computedContext?.testParts ?? []) {
1186
+ for (const section of testPart.sections) {
1187
+ const item = section.items.find((i) => i.identifier === this.identifier);
1188
+ if (item)
1189
+ return item;
1190
+ }
1191
+ }
1192
+ return void 0;
1193
+ }
1194
+ /**
1195
+ * The clone of `xmlDoc` that is rendered, and what it was cloned for. Cloned
1196
+ * once per document and template, not per render: re-renders from
1197
+ * computed-context changes then hand Lit the same fragment, which it leaves
1198
+ * alone, instead of rebuilding the item (and reloading its PCIs, which
1199
+ * changes the context again).
1200
+ */
1201
+ #rendered;
1184
1202
  render() {
1185
- if (!this.xmlDoc)
1203
+ if (!this.xmlDoc) {
1204
+ this.#rendered = null;
1186
1205
  return nothing2;
1187
- const xmlDoc = this.xmlDoc.cloneNode(true);
1206
+ }
1207
+ if (this.#rendered?.source !== this.xmlDoc || this.#rendered.template !== this.myTemplate) {
1208
+ this.#rendered = {
1209
+ source: this.xmlDoc,
1210
+ template: this.myTemplate,
1211
+ doc: this.xmlDoc.cloneNode(true)
1212
+ };
1213
+ }
1214
+ const xmlDoc = this.#rendered.doc;
1188
1215
  if (!this.myTemplate)
1189
1216
  return xmlDoc;
1190
1217
  const model = {
@@ -1192,6 +1219,7 @@ var QtiAssessmentItemRef = class extends LitElement {
1192
1219
  identifier: this.identifier,
1193
1220
  href: this.href,
1194
1221
  category: this.category,
1222
+ item: this.#computedItem(),
1195
1223
  itemRef: this
1196
1224
  };
1197
1225
  return this.myTemplate(model);
@@ -1212,12 +1240,16 @@ __decorate([
1212
1240
  __decorate([
1213
1241
  property({ type: String })
1214
1242
  ], QtiAssessmentItemRef.prototype, "href", void 0);
1243
+ __decorate([
1244
+ state(),
1245
+ consume({ context: computedContext, subscribe: true })
1246
+ ], QtiAssessmentItemRef.prototype, "computedContext", void 0);
1215
1247
  __decorate([
1216
1248
  property({ type: Object, attribute: false })
1217
1249
  ], QtiAssessmentItemRef.prototype, "xmlDoc", void 0);
1218
1250
 
1219
1251
  // ../qti-test/dist/components/qti-assessment-section/qti-assessment-section.js
1220
- import { consume } from "@lit/context";
1252
+ import { consume as consume2 } from "@lit/context";
1221
1253
  import { html, LitElement as LitElement2 } from "lit";
1222
1254
  import { property as property2 } from "lit/decorators.js";
1223
1255
  var __decorate2 = function(decorators, target, key, desc) {
@@ -1279,11 +1311,11 @@ __decorate2([
1279
1311
  property2({ type: String, attribute: "submission-mode" })
1280
1312
  ], QtiAssessmentSection.prototype, "submissionMode", void 0);
1281
1313
  __decorate2([
1282
- consume({ context: testContext, subscribe: true })
1314
+ consume2({ context: testContext, subscribe: true })
1283
1315
  ], QtiAssessmentSection.prototype, "_testContext", void 0);
1284
1316
 
1285
1317
  // ../qti-test/dist/components/qti-assessment-test/qti-assessment-test.js
1286
- import { consume as consume2 } from "@lit/context";
1318
+ import { consume as consume3 } from "@lit/context";
1287
1319
  import { html as html2, LitElement as LitElement3 } from "lit";
1288
1320
  import { property as property3 } from "lit/decorators.js";
1289
1321
  var __decorate3 = function(decorators, target, key, desc) {
@@ -1322,7 +1354,7 @@ __decorate3([
1322
1354
  property3({ type: String })
1323
1355
  ], QtiAssessmentTest.prototype, "title", null);
1324
1356
  __decorate3([
1325
- consume2({ context: testContext, subscribe: true })
1357
+ consume3({ context: testContext, subscribe: true })
1326
1358
  ], QtiAssessmentTest.prototype, "_testContext", void 0);
1327
1359
 
1328
1360
  // ../qti-test/dist/components/qti-item-session-control/qti-item-session-control.js
@@ -1544,7 +1576,7 @@ __decorate5([
1544
1576
  ], QtiTestPart.prototype, "submissionMode", void 0);
1545
1577
 
1546
1578
  // ../qti-test/dist/components/qti-test-variables/qti-test-variables.js
1547
- import { consume as consume3 } from "@lit/context";
1579
+ import { consume as consume4 } from "@lit/context";
1548
1580
  var __decorate6 = function(decorators, target, key, desc) {
1549
1581
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1550
1582
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1587,7 +1619,7 @@ var QtiTestVariables = class extends QtiExpression {
1587
1619
  }
1588
1620
  };
1589
1621
  __decorate6([
1590
- consume3({ context: testContext, subscribe: true })
1622
+ consume4({ context: testContext, subscribe: true })
1591
1623
  ], QtiTestVariables.prototype, "_testContext", void 0);
1592
1624
  var QtiTestVariablesExpression = class {
1593
1625
  constructor(testContext2, itemVariable, includedItems) {
@@ -1618,7 +1650,7 @@ var QtiTestVariablesExpression = class {
1618
1650
  // ../qti-test/dist/components/qti-test/qti-test.js
1619
1651
  import { provide as provide2 } from "@lit/context";
1620
1652
  import { html as html7, LitElement as LitElement8 } from "lit";
1621
- import { state } from "lit/decorators.js";
1653
+ import { state as state2 } from "lit/decorators.js";
1622
1654
 
1623
1655
  // ../qti-test/dist/mixins/test-navigation.mixin.js
1624
1656
  import { property as property6 } from "lit/decorators.js";
@@ -2253,7 +2285,7 @@ var TestBaseMixin = (superClass) => {
2253
2285
  this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state);
2254
2286
  });
2255
2287
  }
2256
- _updateItemVariablesInTestContext(identifier, variables, state8) {
2288
+ _updateItemVariablesInTestContext(identifier, variables, state9) {
2257
2289
  this.testContext = {
2258
2290
  ...this.testContext,
2259
2291
  // Spread existing test context properties
@@ -2268,7 +2300,7 @@ var TestBaseMixin = (superClass) => {
2268
2300
  const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
2269
2301
  return matchingVariable ? { ...matchingVariable, ...variable } : variable;
2270
2302
  }),
2271
- ...state8 !== void 0 ? { state: state8 ? { ...state8 } : void 0 } : {}
2303
+ ...state9 !== void 0 ? { state: state9 ? { ...state9 } : void 0 } : {}
2272
2304
  };
2273
2305
  })
2274
2306
  };
@@ -2369,7 +2401,7 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
2369
2401
  }
2370
2402
  };
2371
2403
  __decorate9([
2372
- state(),
2404
+ state2(),
2373
2405
  provide2({ context: configContext })
2374
2406
  ], QtiTest.prototype, "configContext", void 0);
2375
2407
 
@@ -2381,18 +2413,34 @@ import { css as css3 } from "lit";
2381
2413
  var form = css3`
2382
2414
  display: inline-flex;
2383
2415
  align-items: center;
2416
+ justify-content: center;
2417
+ gap: 0.375em;
2418
+ box-sizing: border-box;
2419
+ min-block-size: var(--test-button-size, 2.25rem);
2420
+ padding: 0 0.875rem;
2421
+ font: inherit;
2422
+ line-height: 1.25;
2384
2423
  cursor: pointer;
2385
- padding: 0.5rem 1rem;
2386
- border-radius: 0.25rem;
2387
2424
  user-select: none;
2425
+ border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
2388
2426
  `;
2389
2427
  var btn = css3`
2390
- background-color: lightgray;
2391
2428
  ${form};
2429
+ background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
2430
+ color: var(--test-button-color, var(--qti-component-color, inherit));
2431
+ border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
2432
+ var(--test-button-border-color, var(--qti-component-border-color, #0175aa));
2433
+ `;
2434
+ var btnInteractive = css3`
2435
+ background-color: var(--test-button-hover-background-color, var(--qti-bg-active, #f2f8fb));
2436
+ `;
2437
+ var focusRing = css3`
2438
+ outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, #007ac3);
2439
+ outline-offset: 2px;
2392
2440
  `;
2393
2441
  var dis = css3`
2394
2442
  cursor: not-allowed;
2395
- opacity: 0.8;
2443
+ opacity: 0.45;
2396
2444
  `;
2397
2445
  var ind = css3`
2398
2446
  ${form};
@@ -2406,6 +2454,12 @@ var TestCheckItem = class extends LitElement9 {
2406
2454
  :host {
2407
2455
  ${btn};
2408
2456
  }
2457
+ :host(:hover:not([disabled])) {
2458
+ ${btnInteractive};
2459
+ }
2460
+ :host(:focus-visible) {
2461
+ ${focusRing};
2462
+ }
2409
2463
  :host([disabled]) {
2410
2464
  ${dis};
2411
2465
  }
@@ -2429,9 +2483,9 @@ var TestCheckItem = class extends LitElement9 {
2429
2483
  };
2430
2484
 
2431
2485
  // ../qti-test/dist/components/test-container/test-container.js
2432
- import { consume as consume4 } from "@lit/context";
2486
+ import { consume as consume5 } from "@lit/context";
2433
2487
  import { LitElement as LitElement10, html as html9 } from "lit";
2434
- import { property as property8, state as state2 } from "lit/decorators.js";
2488
+ import { property as property8, state as state3 } from "lit/decorators.js";
2435
2489
  import { until } from "lit/directives/until.js";
2436
2490
  var __decorate10 = function(decorators, target, key, desc) {
2437
2491
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2546,14 +2600,14 @@ __decorate10([
2546
2600
  property8({ type: String, attribute: "test-url" })
2547
2601
  ], TestContainer.prototype, "testURL", void 0);
2548
2602
  __decorate10([
2549
- state2()
2603
+ state3()
2550
2604
  ], TestContainer.prototype, "testDoc", void 0);
2551
2605
  __decorate10([
2552
- state2()
2606
+ state3()
2553
2607
  ], TestContainer.prototype, "testXML", void 0);
2554
2608
  __decorate10([
2555
- state2(),
2556
- consume4({ context: qtiContext, subscribe: true })
2609
+ state3(),
2610
+ consume5({ context: qtiContext, subscribe: true })
2557
2611
  ], TestContainer.prototype, "qtiContext", void 0);
2558
2612
  __decorate10([
2559
2613
  watch("testURL", { waitUntilFirstUpdate: true })
@@ -2565,7 +2619,7 @@ __decorate10([
2565
2619
  // ../qti-test/dist/components/test-end-attempt/test-end-attempt.js
2566
2620
  import { css as css5, html as html10, LitElement as LitElement11 } from "lit";
2567
2621
  import { property as property9 } from "lit/decorators.js";
2568
- import { consume as consume5 } from "@lit/context";
2622
+ import { consume as consume6 } from "@lit/context";
2569
2623
  var __decorate11 = function(decorators, target, key, desc) {
2570
2624
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2571
2625
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2583,6 +2637,12 @@ var TestEndAttempt = class extends LitElement11 {
2583
2637
  :host {
2584
2638
  ${btn};
2585
2639
  }
2640
+ :host(:hover:not([disabled])) {
2641
+ ${btnInteractive};
2642
+ }
2643
+ :host(:focus-visible) {
2644
+ ${focusRing};
2645
+ }
2586
2646
  :host([disabled]) {
2587
2647
  ${dis};
2588
2648
  }
@@ -2633,7 +2693,7 @@ var TestEndAttempt = class extends LitElement11 {
2633
2693
  }
2634
2694
  };
2635
2695
  __decorate11([
2636
- consume5({ context: computedContext, subscribe: true }),
2696
+ consume6({ context: computedContext, subscribe: true }),
2637
2697
  property9({ attribute: false })
2638
2698
  ], TestEndAttempt.prototype, "computedContext", void 0);
2639
2699
  __decorate11([
@@ -2658,6 +2718,12 @@ var TestItemLink = class extends LitElement12 {
2658
2718
  :host {
2659
2719
  ${btn};
2660
2720
  }
2721
+ :host(:hover:not([disabled])) {
2722
+ ${btnInteractive};
2723
+ }
2724
+ :host(:focus-visible) {
2725
+ ${focusRing};
2726
+ }
2661
2727
  :host([disabled]) {
2662
2728
  ${dis};
2663
2729
  }
@@ -2688,8 +2754,9 @@ __decorate12([
2688
2754
 
2689
2755
  // ../qti-test/dist/components/test-item-to-speech/test-item-to-speech.js
2690
2756
  import { html as html12, LitElement as LitElement13, css as css7 } from "lit";
2691
- import { consume as consume6, provide as provide3, createContext } from "@lit/context";
2692
- import { property as property11, state as state3 } from "lit/decorators.js";
2757
+ import { consume as consume7, provide as provide3, createContext } from "@lit/context";
2758
+ import { property as property11, state as state4 } from "lit/decorators.js";
2759
+ import { ifDefined } from "lit/directives/if-defined.js";
2693
2760
  var __decorate13 = function(decorators, target, key, desc) {
2694
2761
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2695
2762
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2710,34 +2777,95 @@ function getHighlightSheet() {
2710
2777
  return highlightSheet;
2711
2778
  }
2712
2779
  var ttsContext = createContext(/* @__PURE__ */ Symbol("tts-context"));
2780
+ var ICONS = {
2781
+ play: "M8 5v14l11-7z",
2782
+ pause: "M6 5h4v14H6zM14 5h4v14h-4z",
2783
+ stop: "M6 6h12v12H6z",
2784
+ prev: "M6 5h2v14H6zM20 5v14L9 12z",
2785
+ next: "M16 5h2v14h-2zM4 5v14l11-7z",
2786
+ pick: "M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"
2787
+ };
2788
+ var iconContent = (icon, label) => html12`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d=${ICONS[icon]}></path></svg
2789
+ ><span class="label">${label}</span>`;
2713
2790
  var TtsButtonBase = class extends LitElement13 {
2714
2791
  static {
2715
2792
  this.styles = css7`
2716
2793
  :host {
2717
- display: inline-block;
2794
+ display: inline-flex;
2718
2795
  }
2719
2796
  button {
2720
- cursor: pointer;
2797
+ ${btn};
2798
+ min-inline-size: var(--test-button-size, 2.25rem);
2799
+ padding-inline: 0.5rem;
2800
+ }
2801
+ button:hover:not(:disabled) {
2802
+ ${btnInteractive};
2803
+ }
2804
+ button:focus-visible {
2805
+ ${focusRing};
2721
2806
  }
2722
2807
  button:disabled {
2723
- opacity: 0.4;
2724
- cursor: default;
2808
+ ${dis};
2809
+ }
2810
+ button[aria-pressed='true'],
2811
+ button[aria-pressed='true']:hover {
2812
+ background-color: var(--test-button-selected-background-color, var(--qti-selected-bg, #0175aa));
2813
+ color: var(--test-button-selected-color, var(--qti-selected-color, #fff));
2814
+ }
2815
+ svg,
2816
+ ::slotted(svg) {
2817
+ flex: none;
2818
+ inline-size: var(--test-tts-icon-size, 1.125rem);
2819
+ block-size: var(--test-tts-icon-size, 1.125rem);
2820
+ }
2821
+ svg {
2822
+ fill: currentColor;
2823
+ }
2824
+ /* The default content is icon-only; this keeps the button's accessible name. */
2825
+ .label {
2826
+ position: absolute;
2827
+ inline-size: 1px;
2828
+ block-size: 1px;
2829
+ overflow: hidden;
2830
+ clip-path: inset(50%);
2831
+ white-space: nowrap;
2725
2832
  }
2726
2833
  `;
2727
2834
  }
2728
2835
  #internals = this.attachInternals();
2729
- updated(changed) {
2730
- if (changed.has("_tts")) {
2731
- this.#internals.states.clear();
2732
- if (this._tts?.state)
2733
- this.#internals.states.add(this._tts.state);
2734
- }
2836
+ #mirroredState;
2837
+ #mirroredPicking = false;
2838
+ updated(_changed) {
2839
+ const state9 = this._tts?.state;
2840
+ const picking = this._tts?.picking ?? false;
2841
+ if (state9 === this.#mirroredState && picking === this.#mirroredPicking)
2842
+ return;
2843
+ this.#mirroredState = state9;
2844
+ this.#mirroredPicking = picking;
2845
+ this.#internals.states.clear();
2846
+ if (state9)
2847
+ this.#internals.states.add(state9);
2848
+ if (picking)
2849
+ this.#internals.states.add("picking");
2735
2850
  }
2736
2851
  };
2737
2852
  __decorate13([
2738
- consume6({ context: ttsContext, subscribe: true })
2853
+ property11({ type: String })
2854
+ ], TtsButtonBase.prototype, "label", void 0);
2855
+ __decorate13([
2856
+ consume7({ context: ttsContext, subscribe: true })
2739
2857
  ], TtsButtonBase.prototype, "_tts", void 0);
2740
2858
  var TestItemToSpeech = class extends LitElement13 {
2859
+ static {
2860
+ this.styles = css7`
2861
+ :host {
2862
+ display: inline-flex;
2863
+ flex-wrap: wrap;
2864
+ align-items: center;
2865
+ gap: var(--test-tts-gap, 0.25rem);
2866
+ }
2867
+ `;
2868
+ }
2741
2869
  #internals;
2742
2870
  #itemElements;
2743
2871
  #boundHandleItemConnected;
@@ -2747,6 +2875,16 @@ var TestItemToSpeech = class extends LitElement13 {
2747
2875
  #currentElementIndex;
2748
2876
  // Text nodes of the element currently being spoken (for word-boundary highlight)
2749
2877
  #textNodes;
2878
+ // The utterance this player is speaking; lets the error handler tell "our speech was
2879
+ // cancelled by another player" apart from a cancel we issued ourselves.
2880
+ #currentUtterance;
2881
+ // Pick mode: all elements highlighted, a click on one starts reading from there.
2882
+ #picking;
2883
+ #pickRoot;
2884
+ #boundHandlePickClick;
2885
+ // Set when the last element has been read: the cursor stays on it (so prev still works),
2886
+ // but the next play starts the item over instead of repeating that last element.
2887
+ #finished;
2750
2888
  // Two separate CSS Highlight objects
2751
2889
  #elementHighlight;
2752
2890
  // whole-element cursor
@@ -2754,6 +2892,7 @@ var TestItemToSpeech = class extends LitElement13 {
2754
2892
  // current word during speech
2755
2893
  // Tracks previous navItemRefId to detect item switches
2756
2894
  #prevNavItemRefId;
2895
+ #prevNavSectionId;
2757
2896
  #boundHandleNavigation;
2758
2897
  constructor() {
2759
2898
  super();
@@ -2765,9 +2904,15 @@ var TestItemToSpeech = class extends LitElement13 {
2765
2904
  this.#readingElements = null;
2766
2905
  this.#currentElementIndex = 0;
2767
2906
  this.#textNodes = [];
2907
+ this.#currentUtterance = null;
2908
+ this.#picking = false;
2909
+ this.#pickRoot = null;
2910
+ this.#boundHandlePickClick = this.#handlePickClick.bind(this);
2911
+ this.#finished = false;
2768
2912
  this.#elementHighlight = new Highlight();
2769
2913
  this.#wordHighlight = new Highlight();
2770
2914
  this.#prevNavItemRefId = void 0;
2915
+ this.#prevNavSectionId = void 0;
2771
2916
  this.#boundHandleNavigation = () => this.#stop();
2772
2917
  this._ttsContext = {
2773
2918
  state: "idle",
@@ -2776,23 +2921,41 @@ var TestItemToSpeech = class extends LitElement13 {
2776
2921
  play: () => this.#playSpeech(),
2777
2922
  pause: () => this.#pause(),
2778
2923
  resume: () => this.#resume(),
2779
- stop: () => this.#stop(),
2924
+ stop: () => {
2925
+ this.#stopPicking();
2926
+ this.#stop();
2927
+ },
2780
2928
  prevElement: () => this.#prevElement(),
2781
- nextElement: () => this.#nextElement()
2929
+ nextElement: () => this.#nextElement(),
2930
+ togglePick: () => this.#togglePick(),
2931
+ picking: false
2782
2932
  };
2783
2933
  }
2784
2934
  willUpdate(changed) {
2785
2935
  void changed;
2786
2936
  }
2787
- updated(_changed) {
2937
+ updated(changed) {
2938
+ if (changed.has("itemRefId") && changed.get("itemRefId") !== void 0) {
2939
+ this.#resetReadingPosition();
2940
+ }
2788
2941
  const current = this._sessionContext?.navItemRefId ?? null;
2789
- if (this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !== current) {
2790
- this.#stop();
2791
- this.#readingElements = null;
2792
- this.#currentElementIndex = 0;
2793
- this.#updateContext();
2942
+ const section = this._sessionContext?.navSectionId ?? null;
2943
+ const itemChanged = this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !== current;
2944
+ const sectionChanged = this.#prevNavSectionId !== void 0 && this.#prevNavSectionId !== section;
2945
+ if (sectionChanged || itemChanged && !this.itemRefId) {
2946
+ this.#resetReadingPosition();
2794
2947
  }
2795
2948
  this.#prevNavItemRefId = current;
2949
+ this.#prevNavSectionId = section;
2950
+ }
2951
+ /** Stop speech and forget the collected reading elements, so the next play starts afresh. */
2952
+ #resetReadingPosition() {
2953
+ this.#stopPicking();
2954
+ this.#stop();
2955
+ this.#readingElements = null;
2956
+ this.#currentElementIndex = 0;
2957
+ this.#finished = false;
2958
+ this.#updateContext();
2796
2959
  }
2797
2960
  connectedCallback() {
2798
2961
  super.connectedCallback();
@@ -2803,7 +2966,11 @@ var TestItemToSpeech = class extends LitElement13 {
2803
2966
  }
2804
2967
  disconnectedCallback() {
2805
2968
  super.disconnectedCallback();
2806
- speechSynthesis.cancel();
2969
+ if (this.#currentUtterance) {
2970
+ this.#currentUtterance = null;
2971
+ speechSynthesis.cancel();
2972
+ }
2973
+ this.#stopPicking();
2807
2974
  this.#clearAllHighlights();
2808
2975
  this.#eventHost?.removeEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
2809
2976
  this.#eventHost?.removeEventListener("qti-request-navigation", this.#boundHandleNavigation);
@@ -2817,15 +2984,50 @@ var TestItemToSpeech = class extends LitElement13 {
2817
2984
  const item = event.detail;
2818
2985
  if (item?.identifier) {
2819
2986
  this.#itemElements.set(item.identifier, item);
2987
+ if (this.itemRefId && item.identifier === this.itemRefId && this.#readingElements !== null) {
2988
+ this.#resetReadingPosition();
2989
+ }
2990
+ }
2991
+ }
2992
+ /**
2993
+ * Find the rendered `qti-assessment-item` for an item-ref identifier without relying on the
2994
+ * connected-event cache — the player may be added after the item rendered (a header built
2995
+ * around an existing item) or sit in a shadow root the event never bubbled through.
2996
+ */
2997
+ #findItemInDom(identifier) {
2998
+ const esc = (v) => typeof CSS !== "undefined" && CSS.escape ? CSS.escape(v) : v.replace(/"/g, '\\"');
2999
+ const selector = `qti-assessment-item-ref[identifier="${esc(identifier)}"] qti-assessment-item, qti-assessment-item[identifier="${esc(identifier)}"]`;
3000
+ const ownRef = this.closest("qti-assessment-item-ref");
3001
+ if (ownRef?.getAttribute("identifier") === identifier) {
3002
+ const own = ownRef.querySelector("qti-assessment-item");
3003
+ if (own)
3004
+ return own;
3005
+ }
3006
+ let root = this.getRootNode();
3007
+ while (root) {
3008
+ const scope = root;
3009
+ const direct = scope.querySelector?.(selector);
3010
+ if (direct)
3011
+ return direct;
3012
+ for (const container of Array.from(scope.querySelectorAll?.("test-container") ?? [])) {
3013
+ const inShadow = container.shadowRoot?.querySelector(selector);
3014
+ if (inShadow)
3015
+ return inShadow;
3016
+ }
3017
+ const host = root.host;
3018
+ if (!host)
3019
+ break;
3020
+ root = host.getRootNode();
2820
3021
  }
3022
+ return null;
2821
3023
  }
2822
3024
  /** Update speech state on both the context (notifies children) and the host's CSS custom states. */
2823
- #setSpeechState(state8) {
2824
- this._ttsContext = { ...this._ttsContext, state: state8 };
3025
+ #setSpeechState(state9) {
3026
+ this._ttsContext = { ...this._ttsContext, state: state9 };
2825
3027
  this.#internals.states.delete("idle");
2826
3028
  this.#internals.states.delete("playing");
2827
3029
  this.#internals.states.delete("paused");
2828
- this.#internals.states.add(state8);
3030
+ this.#internals.states.add(state9);
2829
3031
  }
2830
3032
  /** Push currentElementIndex and elementCount into context so children can react. */
2831
3033
  #updateContext() {
@@ -2839,25 +3041,50 @@ var TestItemToSpeech = class extends LitElement13 {
2839
3041
  #getReadingElements() {
2840
3042
  if (this.#readingElements !== null)
2841
3043
  return this.#readingElements;
2842
- const identifier = this._sessionContext?.navItemRefId;
3044
+ const identifier = this.itemRefId || this._sessionContext?.navItemRefId;
2843
3045
  if (!identifier)
2844
3046
  return [];
2845
- const assessmentItem = this.#itemElements.get(identifier);
3047
+ const cached = this.#itemElements.get(identifier);
3048
+ const assessmentItem = cached?.isConnected ? cached : this.#findItemInDom(identifier);
2846
3049
  if (!assessmentItem)
2847
3050
  return [];
2848
3051
  const itemBody = assessmentItem.querySelector("qti-item-body");
2849
3052
  if (!itemBody)
2850
3053
  return [];
2851
- const selector = "p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";
2852
- this.#readingElements = Array.from(itemBody.querySelectorAll(selector)).filter((el) => (el.textContent ?? "").trim().length > 0);
3054
+ const selector = "p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption, qti-prompt, qti-simple-choice";
3055
+ this.#readingElements = Array.from(itemBody.querySelectorAll(selector)).filter((el) => (el.textContent ?? "").trim().length > 0 && !el.querySelector(selector));
2853
3056
  return this.#readingElements;
2854
3057
  }
3058
+ /**
3059
+ * Resolve the speech language for a reading element.
3060
+ * Element `lang` → closest ancestor `lang` (crossing shadow hosts) → `<html lang>` → `language` attribute.
3061
+ * Empty `lang=""` is treated as absent.
3062
+ */
3063
+ #resolveLang(element) {
3064
+ let node = element;
3065
+ while (node) {
3066
+ const lang = node.getAttribute("lang") || node.getAttribute("xml:lang");
3067
+ if (lang?.trim())
3068
+ return lang.trim();
3069
+ node = node.parentElement ?? node.getRootNode().host ?? null;
3070
+ }
3071
+ const documentLang = document.documentElement.getAttribute("lang");
3072
+ if (documentLang?.trim())
3073
+ return documentLang.trim();
3074
+ return this.language;
3075
+ }
2855
3076
  #playSpeech() {
2856
3077
  const elements = this.#getReadingElements();
2857
3078
  if (!elements.length) {
2858
3079
  console.warn("test-item-to-speech: no readable elements found in qti-item-body");
2859
3080
  return;
2860
3081
  }
3082
+ this.#stopPicking();
3083
+ speechSynthesis.cancel();
3084
+ if (this.#finished) {
3085
+ this.#finished = false;
3086
+ this.#currentElementIndex = 0;
3087
+ }
2861
3088
  this.#speakElement(this.#currentElementIndex);
2862
3089
  }
2863
3090
  /** Speak the element at the given index, then auto-advance when it ends. */
@@ -2868,11 +3095,13 @@ var TestItemToSpeech = class extends LitElement13 {
2868
3095
  this.#currentElementIndex = elements.length - 1;
2869
3096
  if (elements.length > 0)
2870
3097
  this.#highlightElement(elements[this.#currentElementIndex]);
3098
+ this.#finished = true;
2871
3099
  this.#setSpeechState("idle");
2872
3100
  this.#updateContext();
2873
3101
  return;
2874
3102
  }
2875
3103
  this.#currentElementIndex = index;
3104
+ this.#finished = false;
2876
3105
  this.#updateContext();
2877
3106
  const element = elements[index];
2878
3107
  element.scrollIntoView({ behavior: "smooth", block: "nearest" });
@@ -2884,7 +3113,7 @@ var TestItemToSpeech = class extends LitElement13 {
2884
3113
  return;
2885
3114
  }
2886
3115
  const utterance = new SpeechSynthesisUtterance(text);
2887
- utterance.lang = this.language;
3116
+ utterance.lang = this.#resolveLang(element);
2888
3117
  utterance.rate = 1;
2889
3118
  utterance.onboundary = (event) => {
2890
3119
  if (event.name !== "word")
@@ -2892,9 +3121,20 @@ var TestItemToSpeech = class extends LitElement13 {
2892
3121
  this.#updateWordHighlight(event.charIndex, event.charLength ?? 0);
2893
3122
  };
2894
3123
  utterance.onend = () => {
3124
+ if (this.#currentUtterance !== utterance)
3125
+ return;
3126
+ this.#currentUtterance = null;
2895
3127
  this.#clearWordHighlight();
2896
3128
  this.#speakElement(this.#currentElementIndex + 1);
2897
3129
  };
3130
+ utterance.onerror = () => {
3131
+ if (this.#currentUtterance !== utterance)
3132
+ return;
3133
+ this.#currentUtterance = null;
3134
+ this.#clearAllHighlights();
3135
+ this.#setSpeechState("idle");
3136
+ };
3137
+ this.#currentUtterance = utterance;
2898
3138
  speechSynthesis.speak(utterance);
2899
3139
  this.#setSpeechState("playing");
2900
3140
  }
@@ -2907,17 +3147,69 @@ var TestItemToSpeech = class extends LitElement13 {
2907
3147
  this.#setSpeechState("playing");
2908
3148
  }
2909
3149
  #stop() {
3150
+ this.#currentUtterance = null;
2910
3151
  speechSynthesis.cancel();
2911
3152
  this.#clearAllHighlights();
2912
3153
  this.#setSpeechState("idle");
2913
3154
  }
3155
+ // ─── Pick mode ────────────────────────────────────────────────────────────
3156
+ #togglePick() {
3157
+ if (this.#picking)
3158
+ this.#stopPicking();
3159
+ else
3160
+ this.#startPicking();
3161
+ }
3162
+ /** Highlight every reading element and wait for a click on one of them. */
3163
+ #startPicking() {
3164
+ const elements = this.#getReadingElements();
3165
+ if (!elements.length) {
3166
+ console.warn("test-item-to-speech: no readable elements found in qti-item-body");
3167
+ return;
3168
+ }
3169
+ this.#stop();
3170
+ this.#picking = true;
3171
+ this.#internals.states.add("picking");
3172
+ this.#highlightElements(elements);
3173
+ this.#pickRoot = elements[0].getRootNode();
3174
+ this.#pickRoot.addEventListener("click", this.#boundHandlePickClick, true);
3175
+ this._ttsContext = { ...this._ttsContext, picking: true };
3176
+ }
3177
+ #stopPicking() {
3178
+ if (!this.#picking)
3179
+ return;
3180
+ this.#picking = false;
3181
+ this.#internals.states.delete("picking");
3182
+ this.#pickRoot?.removeEventListener("click", this.#boundHandlePickClick, true);
3183
+ this.#pickRoot = null;
3184
+ this.#clearAllHighlights();
3185
+ this._ttsContext = { ...this._ttsContext, picking: false };
3186
+ }
3187
+ #handlePickClick(event) {
3188
+ const elements = this.#readingElements ?? [];
3189
+ const path = event.composedPath();
3190
+ let index = elements.findIndex((el) => path.includes(el));
3191
+ if (index < 0) {
3192
+ const container = path.find((node) => node instanceof Element && node.matches("qti-simple-choice, li, qti-prompt"));
3193
+ if (container)
3194
+ index = elements.findIndex((el) => container.contains(el));
3195
+ }
3196
+ if (index < 0)
3197
+ return;
3198
+ event.preventDefault();
3199
+ event.stopPropagation();
3200
+ this.#stopPicking();
3201
+ speechSynthesis.cancel();
3202
+ this.#speakElement(index);
3203
+ }
2914
3204
  #prevElement() {
2915
3205
  const elements = this.#getReadingElements();
2916
3206
  if (!elements.length)
2917
3207
  return;
3208
+ this.#currentUtterance = null;
2918
3209
  speechSynthesis.cancel();
2919
3210
  this.#clearWordHighlight();
2920
3211
  this.#currentElementIndex = Math.max(0, this.#currentElementIndex - 1);
3212
+ this.#finished = false;
2921
3213
  this.#updateContext();
2922
3214
  const el = elements[this.#currentElementIndex];
2923
3215
  el.scrollIntoView({ behavior: "smooth", block: "nearest" });
@@ -2928,9 +3220,11 @@ var TestItemToSpeech = class extends LitElement13 {
2928
3220
  const elements = this.#getReadingElements();
2929
3221
  if (!elements.length)
2930
3222
  return;
3223
+ this.#currentUtterance = null;
2931
3224
  speechSynthesis.cancel();
2932
3225
  this.#clearWordHighlight();
2933
3226
  this.#currentElementIndex = Math.min(elements.length - 1, this.#currentElementIndex + 1);
3227
+ this.#finished = false;
2934
3228
  this.#updateContext();
2935
3229
  const el = elements[this.#currentElementIndex];
2936
3230
  el.scrollIntoView({ behavior: "smooth", block: "nearest" });
@@ -2951,13 +3245,19 @@ var TestItemToSpeech = class extends LitElement13 {
2951
3245
  }
2952
3246
  /** Highlight the whole element as the navigation cursor (blue). */
2953
3247
  #highlightElement(element) {
3248
+ this.#highlightElements([element]);
3249
+ }
3250
+ /** Put the blue cursor highlight on several elements at once (pick mode). */
3251
+ #highlightElements(elements) {
2954
3252
  if (!("highlights" in CSS))
2955
3253
  return;
2956
3254
  this.#ensureHighlightStyles();
2957
3255
  this.#elementHighlight.clear();
2958
- const range = new Range();
2959
- range.selectNodeContents(element);
2960
- this.#elementHighlight.add(range);
3256
+ for (const element of elements) {
3257
+ const range = new Range();
3258
+ range.selectNodeContents(element);
3259
+ this.#elementHighlight.add(range);
3260
+ }
2961
3261
  CSS.highlights.set(HIGHLIGHT_ELEMENT, this.#elementHighlight);
2962
3262
  }
2963
3263
  /** Highlight the current word within #textNodes (yellow, during speech). */
@@ -2998,15 +3298,16 @@ var TestItemToSpeech = class extends LitElement13 {
2998
3298
  if (!("highlights" in CSS))
2999
3299
  return;
3000
3300
  this.#wordHighlight.clear();
3001
- CSS.highlights.delete(HIGHLIGHT_WORD);
3301
+ if (CSS.highlights.get(HIGHLIGHT_WORD) === this.#wordHighlight)
3302
+ CSS.highlights.delete(HIGHLIGHT_WORD);
3002
3303
  }
3003
3304
  #clearAllHighlights() {
3004
3305
  if (!("highlights" in CSS))
3005
3306
  return;
3006
- this.#wordHighlight.clear();
3007
- CSS.highlights.delete(HIGHLIGHT_WORD);
3307
+ this.#clearWordHighlight();
3008
3308
  this.#elementHighlight.clear();
3009
- CSS.highlights.delete(HIGHLIGHT_ELEMENT);
3309
+ if (CSS.highlights.get(HIGHLIGHT_ELEMENT) === this.#elementHighlight)
3310
+ CSS.highlights.delete(HIGHLIGHT_ELEMENT);
3010
3311
  }
3011
3312
  /** Fallback word-length when charLength is 0. */
3012
3313
  #wordLengthAt(charIndex, text) {
@@ -3026,10 +3327,20 @@ var TestItemToSpeech = class extends LitElement13 {
3026
3327
  if (!document.adoptedStyleSheets.includes(sheet)) {
3027
3328
  document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
3028
3329
  }
3330
+ const roots = /* @__PURE__ */ new Set();
3029
3331
  const testContainer = this.closest("test-navigation")?.querySelector("test-container") ?? this.closest("qti-test")?.querySelector("test-container");
3030
- const root = testContainer?.shadowRoot;
3031
- if (root && !root.adoptedStyleSheets.includes(sheet)) {
3032
- root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
3332
+ if (testContainer?.shadowRoot)
3333
+ roots.add(testContainer.shadowRoot);
3334
+ const ownRoot = this.getRootNode();
3335
+ if (ownRoot instanceof ShadowRoot)
3336
+ roots.add(ownRoot);
3337
+ const itemRoot = this.#readingElements?.[0]?.getRootNode();
3338
+ if (itemRoot instanceof ShadowRoot)
3339
+ roots.add(itemRoot);
3340
+ for (const root of roots) {
3341
+ if (!root.adoptedStyleSheets.includes(sheet)) {
3342
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
3343
+ }
3033
3344
  }
3034
3345
  }
3035
3346
  };
@@ -3037,10 +3348,13 @@ __decorate13([
3037
3348
  property11({ type: String })
3038
3349
  ], TestItemToSpeech.prototype, "language", void 0);
3039
3350
  __decorate13([
3040
- consume6({ context: sessionContext, subscribe: true })
3351
+ property11({ type: String, attribute: "item-ref-id" })
3352
+ ], TestItemToSpeech.prototype, "itemRefId", void 0);
3353
+ __decorate13([
3354
+ consume7({ context: sessionContext, subscribe: true })
3041
3355
  ], TestItemToSpeech.prototype, "_sessionContext", void 0);
3042
3356
  __decorate13([
3043
- state3(),
3357
+ state4(),
3044
3358
  provide3({ context: ttsContext })
3045
3359
  ], TestItemToSpeech.prototype, "_ttsContext", void 0);
3046
3360
  var TestTtsPlay = class extends TtsButtonBase {
@@ -3057,17 +3371,25 @@ var TestTtsPlay = class extends TtsButtonBase {
3057
3371
  render() {
3058
3372
  const playing = this._tts?.state === "playing";
3059
3373
  return html12`
3060
- <button part="button" @click=${this.#toggle}>
3061
- ${playing ? html12`<slot name="pause">⏸</slot>` : html12`<slot name="play">▶</slot>`}
3374
+ <button part="button" aria-label=${ifDefined(playing ? this.pauseLabel : this.label)} @click=${this.#toggle}>
3375
+ ${playing ? html12`<slot name="pause">${iconContent("pause", this.pauseLabel ?? "Pause")}</slot>` : html12`<slot name="play">${iconContent("play", this.label ?? "Play")}</slot>`}
3062
3376
  </button>
3063
3377
  `;
3064
3378
  }
3065
3379
  };
3380
+ __decorate13([
3381
+ property11({ type: String, attribute: "pause-label" })
3382
+ ], TestTtsPlay.prototype, "pauseLabel", void 0);
3066
3383
  var TestTtsPause = class extends TtsButtonBase {
3067
3384
  render() {
3068
3385
  return html12`
3069
- <button part="button" ?disabled=${this._tts?.state !== "playing"} @click=${() => this._tts?.pause()}>
3070
- <slot>⏸</slot>
3386
+ <button
3387
+ part="button"
3388
+ aria-label=${ifDefined(this.label)}
3389
+ ?disabled=${this._tts?.state !== "playing"}
3390
+ @click=${() => this._tts?.pause()}
3391
+ >
3392
+ <slot>${iconContent("pause", this.label ?? "Pause")}</slot>
3071
3393
  </button>
3072
3394
  `;
3073
3395
  }
@@ -3075,48 +3397,78 @@ var TestTtsPause = class extends TtsButtonBase {
3075
3397
  var TestTtsResume = class extends TtsButtonBase {
3076
3398
  render() {
3077
3399
  return html12`
3078
- <button part="button" ?disabled=${this._tts?.state !== "paused"} @click=${() => this._tts?.resume()}>
3079
- <slot>▶</slot>
3400
+ <button
3401
+ part="button"
3402
+ aria-label=${ifDefined(this.label)}
3403
+ ?disabled=${this._tts?.state !== "paused"}
3404
+ @click=${() => this._tts?.resume()}
3405
+ >
3406
+ <slot>${iconContent("play", this.label ?? "Resume")}</slot>
3080
3407
  </button>
3081
3408
  `;
3082
3409
  }
3083
3410
  };
3084
3411
  var TestTtsStop = class extends TtsButtonBase {
3085
3412
  render() {
3413
+ const idle = this._tts?.state === "idle" && !this._tts?.picking;
3086
3414
  return html12`
3087
- <button part="button" ?disabled=${this._tts?.state === "idle"} @click=${() => this._tts?.stop()}>
3088
- <slot>■</slot>
3415
+ <button part="button" aria-label=${ifDefined(this.label)} ?disabled=${idle} @click=${() => this._tts?.stop()}>
3416
+ <slot>${iconContent("stop", this.label ?? "Stop")}</slot>
3089
3417
  </button>
3090
3418
  `;
3091
3419
  }
3092
3420
  };
3093
3421
  var TestTtsPrev = class extends TtsButtonBase {
3094
3422
  render() {
3423
+ const collected = (this._tts?.elementCount ?? 0) > 0;
3095
3424
  const atStart = (this._tts?.currentElementIndex ?? 0) === 0;
3096
- const noElements = (this._tts?.elementCount ?? 0) === 0;
3097
3425
  return html12`
3098
- <button part="button" ?disabled=${noElements || atStart} @click=${() => this._tts?.prevElement()}>
3099
- <slot>◀◀</slot>
3426
+ <button
3427
+ part="button"
3428
+ aria-label=${ifDefined(this.label)}
3429
+ ?disabled=${collected && atStart}
3430
+ @click=${() => this._tts?.prevElement()}
3431
+ >
3432
+ <slot>${iconContent("prev", this.label ?? "Previous sentence")}</slot>
3100
3433
  </button>
3101
3434
  `;
3102
3435
  }
3103
3436
  };
3104
3437
  var TestTtsNext = class extends TtsButtonBase {
3105
3438
  render() {
3106
- const atEnd = (this._tts?.elementCount ?? 0) > 0 && (this._tts?.currentElementIndex ?? 0) >= (this._tts?.elementCount ?? 0) - 1;
3107
- const noElements = (this._tts?.elementCount ?? 0) === 0;
3439
+ const count = this._tts?.elementCount ?? 0;
3440
+ const atEnd = count > 0 && (this._tts?.currentElementIndex ?? 0) >= count - 1;
3441
+ return html12`
3442
+ <button
3443
+ part="button"
3444
+ aria-label=${ifDefined(this.label)}
3445
+ ?disabled=${atEnd}
3446
+ @click=${() => this._tts?.nextElement()}
3447
+ >
3448
+ <slot>${iconContent("next", this.label ?? "Next sentence")}</slot>
3449
+ </button>
3450
+ `;
3451
+ }
3452
+ };
3453
+ var TestTtsPick = class extends TtsButtonBase {
3454
+ render() {
3108
3455
  return html12`
3109
- <button part="button" ?disabled=${noElements || atEnd} @click=${() => this._tts?.nextElement()}>
3110
- <slot>▶▶</slot>
3456
+ <button
3457
+ part="button"
3458
+ aria-label=${ifDefined(this.label)}
3459
+ aria-pressed=${this._tts?.picking ? "true" : "false"}
3460
+ @click=${() => this._tts?.togglePick()}
3461
+ >
3462
+ <slot>${iconContent("pick", this.label ?? "Read from here")}</slot>
3111
3463
  </button>
3112
3464
  `;
3113
3465
  }
3114
3466
  };
3115
3467
 
3116
3468
  // ../qti-test/dist/components/test-navigation/test-navigation.js
3117
- import { consume as consume7, provide as provide4 } from "@lit/context";
3469
+ import { consume as consume8, provide as provide4 } from "@lit/context";
3118
3470
  import { html as html13, LitElement as LitElement14 } from "lit";
3119
- import { property as property12, state as state4 } from "lit/decorators.js";
3471
+ import { property as property12, state as state5 } from "lit/decorators.js";
3120
3472
  var __decorate14 = function(decorators, target, key, desc) {
3121
3473
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3122
3474
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3589,26 +3941,26 @@ __decorate14([
3589
3941
  property12({ type: String })
3590
3942
  ], TestNavigation.prototype, "identifier", void 0);
3591
3943
  __decorate14([
3592
- state4()
3944
+ state5()
3593
3945
  ], TestNavigation.prototype, "initContext", void 0);
3594
3946
  __decorate14([
3595
- state4(),
3947
+ state5(),
3596
3948
  provide4({ context: qtiContext })
3597
3949
  ], TestNavigation.prototype, "qtiContext", void 0);
3598
3950
  __decorate14([
3599
- state4(),
3600
- consume7({ context: configContext, subscribe: true })
3951
+ state5(),
3952
+ consume8({ context: configContext, subscribe: true })
3601
3953
  ], TestNavigation.prototype, "configContext", void 0);
3602
3954
  __decorate14([
3603
- state4(),
3604
- consume7({ context: testContext, subscribe: true })
3955
+ state5(),
3956
+ consume8({ context: testContext, subscribe: true })
3605
3957
  ], TestNavigation.prototype, "_testContext", void 0);
3606
3958
  __decorate14([
3607
- state4(),
3608
- consume7({ context: sessionContext, subscribe: true })
3959
+ state5(),
3960
+ consume8({ context: sessionContext, subscribe: true })
3609
3961
  ], TestNavigation.prototype, "_sessionContext", void 0);
3610
3962
  __decorate14([
3611
- state4(),
3963
+ state5(),
3612
3964
  provide4({ context: computedContext })
3613
3965
  ], TestNavigation.prototype, "computedContext", void 0);
3614
3966
  __decorate14([
@@ -3618,7 +3970,7 @@ __decorate14([
3618
3970
  // ../qti-test/dist/components/test-next/test-next.js
3619
3971
  import { css as css8, html as html14, LitElement as LitElement15 } from "lit";
3620
3972
  import { property as property13 } from "lit/decorators.js";
3621
- import { consume as consume8 } from "@lit/context";
3973
+ import { consume as consume9 } from "@lit/context";
3622
3974
  var __decorate15 = function(decorators, target, key, desc) {
3623
3975
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3624
3976
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3636,6 +3988,12 @@ var TestNext = class extends LitElement15 {
3636
3988
  :host {
3637
3989
  ${btn};
3638
3990
  }
3991
+ :host(:hover:not([disabled])) {
3992
+ ${btnInteractive};
3993
+ }
3994
+ :host(:focus-visible) {
3995
+ ${focusRing};
3996
+ }
3639
3997
  :host([disabled]) {
3640
3998
  ${dis};
3641
3999
  }
@@ -3697,7 +4055,7 @@ __decorate15([
3697
4055
  property13({ type: Boolean, reflect: true, attribute: "disabled" })
3698
4056
  ], TestNext.prototype, "_internalDisabled", void 0);
3699
4057
  __decorate15([
3700
- consume8({ context: computedContext, subscribe: true })
4058
+ consume9({ context: computedContext, subscribe: true })
3701
4059
  ], TestNext.prototype, "computedContext", void 0);
3702
4060
  __decorate15([
3703
4061
  watch("computedContext")
@@ -3705,7 +4063,7 @@ __decorate15([
3705
4063
 
3706
4064
  // ../qti-test/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js
3707
4065
  import { html as html15, LitElement as LitElement16 } from "lit";
3708
- import { consume as consume9 } from "@lit/context";
4066
+ import { consume as consume10 } from "@lit/context";
3709
4067
  var __decorate16 = function(decorators, target, key, desc) {
3710
4068
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3711
4069
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3735,13 +4093,13 @@ var TestPagingButtonsStamp = class extends LitElement16 {
3735
4093
  }
3736
4094
  };
3737
4095
  __decorate16([
3738
- consume9({ context: computedContext, subscribe: true })
4096
+ consume10({ context: computedContext, subscribe: true })
3739
4097
  ], TestPagingButtonsStamp.prototype, "computedContext", void 0);
3740
4098
 
3741
4099
  // ../qti-test/dist/components/test-prev/test-prev.js
3742
4100
  import { css as css9, html as html16, LitElement as LitElement17 } from "lit";
3743
4101
  import { property as property14 } from "lit/decorators.js";
3744
- import { consume as consume10 } from "@lit/context";
4102
+ import { consume as consume11 } from "@lit/context";
3745
4103
  var __decorate17 = function(decorators, target, key, desc) {
3746
4104
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3747
4105
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3759,6 +4117,12 @@ var TestPrev = class extends LitElement17 {
3759
4117
  :host {
3760
4118
  ${btn};
3761
4119
  }
4120
+ :host(:hover:not([disabled])) {
4121
+ ${btnInteractive};
4122
+ }
4123
+ :host(:focus-visible) {
4124
+ ${focusRing};
4125
+ }
3762
4126
  :host([disabled]) {
3763
4127
  ${dis};
3764
4128
  }
@@ -3807,7 +4171,7 @@ __decorate17([
3807
4171
  property14({ type: Boolean, reflect: true, attribute: "disabled" })
3808
4172
  ], TestPrev.prototype, "_internalDisabled", void 0);
3809
4173
  __decorate17([
3810
- consume10({ context: computedContext, subscribe: true })
4174
+ consume11({ context: computedContext, subscribe: true })
3811
4175
  ], TestPrev.prototype, "computedContext", void 0);
3812
4176
  __decorate17([
3813
4177
  watch("computedContext")
@@ -3815,8 +4179,8 @@ __decorate17([
3815
4179
 
3816
4180
  // ../qti-test/dist/components/test-print-context/test-print-context.js
3817
4181
  import { html as html17, LitElement as LitElement18 } from "lit";
3818
- import { consume as consume11 } from "@lit/context";
3819
- import { state as state5 } from "lit/decorators.js";
4182
+ import { consume as consume12 } from "@lit/context";
4183
+ import { state as state6 } from "lit/decorators.js";
3820
4184
  var __decorate18 = function(decorators, target, key, desc) {
3821
4185
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3822
4186
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3829,13 +4193,13 @@ var TestPrintContext = class extends LitElement18 {
3829
4193
  }
3830
4194
  };
3831
4195
  __decorate18([
3832
- state5(),
3833
- consume11({ context: computedContext, subscribe: true })
4196
+ state6(),
4197
+ consume12({ context: computedContext, subscribe: true })
3834
4198
  ], TestPrintContext.prototype, "computedContext", void 0);
3835
4199
 
3836
4200
  // ../qti-test/dist/components/test-print-item-variables/test-print-item-variables.js
3837
4201
  import { html as html18, css as css10, LitElement as LitElement19 } from "lit";
3838
- import { consume as consume12 } from "@lit/context";
4202
+ import { consume as consume13 } from "@lit/context";
3839
4203
  var __decorate19 = function(decorators, target, key, desc) {
3840
4204
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3841
4205
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3909,12 +4273,12 @@ var TestPrintVariables = class extends LitElement19 {
3909
4273
  }
3910
4274
  };
3911
4275
  __decorate19([
3912
- consume12({ context: computedContext, subscribe: true })
4276
+ consume13({ context: computedContext, subscribe: true })
3913
4277
  ], TestPrintVariables.prototype, "computedContext", void 0);
3914
4278
 
3915
4279
  // ../qti-test/dist/components/test-scoring-buttons/test-scoring-buttons.js
3916
4280
  import { html as html19, LitElement as LitElement20, nothing as nothing3 } from "lit";
3917
- import { consume as consume13 } from "@lit/context";
4281
+ import { consume as consume14 } from "@lit/context";
3918
4282
  import { property as property15 } from "lit/decorators.js";
3919
4283
  var __decorate20 = function(decorators, target, key, desc) {
3920
4284
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3982,11 +4346,11 @@ __decorate20([
3982
4346
  property15({ type: Boolean })
3983
4347
  ], TestScoringButtons.prototype, "disabled", void 0);
3984
4348
  __decorate20([
3985
- consume13({ context: computedContext, subscribe: true })
4349
+ consume14({ context: computedContext, subscribe: true })
3986
4350
  ], TestScoringButtons.prototype, "computedContext", void 0);
3987
4351
 
3988
4352
  // ../qti-test/dist/components/test-scoring-feedback/test-scoring-feedback.js
3989
- import { consume as consume14 } from "@lit/context";
4353
+ import { consume as consume15 } from "@lit/context";
3990
4354
  import { html as html20, LitElement as LitElement21 } from "lit";
3991
4355
  import { property as property16 } from "lit/decorators.js";
3992
4356
  var __decorate21 = function(decorators, target, key, desc) {
@@ -4029,7 +4393,7 @@ var TestScoringFeedback = class extends LitElement21 {
4029
4393
  }
4030
4394
  };
4031
4395
  __decorate21([
4032
- consume14({ context: computedContext, subscribe: true })
4396
+ consume15({ context: computedContext, subscribe: true })
4033
4397
  ], TestScoringFeedback.prototype, "computedContext", void 0);
4034
4398
  __decorate21([
4035
4399
  property16({ type: String, attribute: "view" })
@@ -4037,7 +4401,7 @@ __decorate21([
4037
4401
 
4038
4402
  // ../qti-test/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js
4039
4403
  import { html as html21, LitElement as LitElement22 } from "lit";
4040
- import { consume as consume15 } from "@lit/context";
4404
+ import { consume as consume16 } from "@lit/context";
4041
4405
  var __decorate22 = function(decorators, target, key, desc) {
4042
4406
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4043
4407
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -4067,7 +4431,7 @@ var TestSectionButtonsStamp = class extends LitElement22 {
4067
4431
  }
4068
4432
  };
4069
4433
  __decorate22([
4070
- consume15({ context: computedContext, subscribe: true })
4434
+ consume16({ context: computedContext, subscribe: true })
4071
4435
  ], TestSectionButtonsStamp.prototype, "computedContext", void 0);
4072
4436
 
4073
4437
  // ../qti-test/dist/components/test-section-link/test-section-link.js
@@ -4085,6 +4449,12 @@ var TestSectionLink = class extends LitElement23 {
4085
4449
  :host {
4086
4450
  ${btn};
4087
4451
  }
4452
+ :host(:hover:not([disabled])) {
4453
+ ${btnInteractive};
4454
+ }
4455
+ :host(:focus-visible) {
4456
+ ${focusRing};
4457
+ }
4088
4458
  :host([disabled]) {
4089
4459
  ${dis};
4090
4460
  }
@@ -4115,8 +4485,8 @@ __decorate23([
4115
4485
 
4116
4486
  // ../qti-test/dist/components/test-stamp/test-stamp.js
4117
4487
  import { html as html23, LitElement as LitElement24, nothing as nothing4 } from "lit";
4118
- import { property as property18, state as state6 } from "lit/decorators.js";
4119
- import { consume as consume16 } from "@lit/context";
4488
+ import { property as property18, state as state7 } from "lit/decorators.js";
4489
+ import { consume as consume17 } from "@lit/context";
4120
4490
  var __decorate24 = function(decorators, target, key, desc) {
4121
4491
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4122
4492
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -4194,17 +4564,17 @@ __decorate24([
4194
4564
  property18({ type: Boolean, reflect: true })
4195
4565
  ], TestStamp.prototype, "debug", void 0);
4196
4566
  __decorate24([
4197
- state6(),
4198
- consume16({ context: computedContext, subscribe: true })
4567
+ state7(),
4568
+ consume17({ context: computedContext, subscribe: true })
4199
4569
  ], TestStamp.prototype, "computedContext", void 0);
4200
4570
  __decorate24([
4201
- state6()
4571
+ state7()
4202
4572
  ], TestStamp.prototype, "stampContext", void 0);
4203
4573
 
4204
4574
  // ../qti-test/dist/components/test-view-toggle/test-view.js
4205
4575
  import { html as html24, LitElement as LitElement25 } from "lit";
4206
- import { property as property19, state as state7 } from "lit/decorators.js";
4207
- import { consume as consume17 } from "@lit/context";
4576
+ import { property as property19, state as state8 } from "lit/decorators.js";
4577
+ import { consume as consume18 } from "@lit/context";
4208
4578
  var __decorate25 = function(decorators, target, key, desc) {
4209
4579
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4210
4580
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -4261,7 +4631,7 @@ var TestView = class extends LitElement25 {
4261
4631
  };
4262
4632
  _a = TestView;
4263
4633
  __decorate25([
4264
- consume17({ context: sessionContext, subscribe: true })
4634
+ consume18({ context: sessionContext, subscribe: true })
4265
4635
  ], TestView.prototype, "sessionContext", void 0);
4266
4636
  __decorate25([
4267
4637
  property19({ type: String })
@@ -4273,11 +4643,11 @@ __decorate25([
4273
4643
  watch("viewOptions", { waitUntilFirstUpdate: true })
4274
4644
  ], TestView.prototype, "_handleViewOptionsChange", void 0);
4275
4645
  __decorate25([
4276
- state7()
4646
+ state8()
4277
4647
  ], TestView.prototype, "_viewOptions", void 0);
4278
4648
 
4279
4649
  // ../qti-test/dist/components/test-view-toggle/test-view-toggle.js
4280
- import { consume as consume18 } from "@lit/context";
4650
+ import { consume as consume19 } from "@lit/context";
4281
4651
  import { html as html25, LitElement as LitElement26, nothing as nothing5 } from "lit";
4282
4652
  var __decorate26 = function(decorators, target, key, desc) {
4283
4653
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4321,7 +4691,7 @@ var TestViewToggle = class extends LitElement26 {
4321
4691
  }
4322
4692
  };
4323
4693
  __decorate26([
4324
- consume18({ context: sessionContext, subscribe: true })
4694
+ consume19({ context: sessionContext, subscribe: true })
4325
4695
  ], TestViewToggle.prototype, "sessionContext", void 0);
4326
4696
 
4327
4697
  // ../qti-test/dist/elements.js
@@ -4354,6 +4724,7 @@ var qtiTestElements = [
4354
4724
  { tag: "test-stamp", ctor: TestStamp },
4355
4725
  { tag: "test-tts-next", ctor: TestTtsNext },
4356
4726
  { tag: "test-tts-pause", ctor: TestTtsPause },
4727
+ { tag: "test-tts-pick", ctor: TestTtsPick },
4357
4728
  { tag: "test-tts-play", ctor: TestTtsPlay },
4358
4729
  { tag: "test-tts-prev", ctor: TestTtsPrev },
4359
4730
  { tag: "test-tts-resume", ctor: TestTtsResume },
@@ -4387,6 +4758,7 @@ export {
4387
4758
  TestTtsStop,
4388
4759
  TestTtsPrev,
4389
4760
  TestTtsNext,
4761
+ TestTtsPick,
4390
4762
  TestNavigation,
4391
4763
  TestNext,
4392
4764
  TestPagingButtonsStamp,
@@ -4414,4 +4786,4 @@ export {
4414
4786
  * Portions Copyright (c) 2013, the Dart project authors.
4415
4787
  *)
4416
4788
  */
4417
- //# sourceMappingURL=chunk-7PXUE2GR.js.map
4789
+ //# sourceMappingURL=chunk-TDWLV5OD.js.map