xAPI + AI Integration Summary
-----------------------------
Original file: Monsoon_Mastery_Checkpoint_20260302.zip
Base mode: minimal
AI used: yes
AI provider: openai
AI model: gpt-5.2
AI status: success

Custom Instructions:
Capture data from the Final Completion Screen, which tracks the student's Score Percentage, the total number of Attempts they took, and a history of their Confidence Levels for that specific concept.

AI Explanation:
- The script auto-runs on `DOMContentLoaded` and initializes a tracker without changing any existing xAPI wrapper configuration.
- It never performs network calls. The only “send” mechanism is `window.storeState(payload)`.
- It waits briefly for `window.storeState` to exist (retry loop up to 2.5s). If it never appears, the script still collects events but won’t throw errors.
- It maintains internal session state:
  - `scorePct` (0–100) parsed from the final completion screen text when available
  - `attempts` inferred from drag/drop attempts and also parsed from completion screen text if present
  - `confidenceHistory` captured from the final completion screen (and updates) using DOM heuristics
  - `history` ring buffer of recent events with timestamps in seconds since session start
- It tracks at least 5 meaningful user events:
  1) `session-start` flush
  2) `checkbox_change` (checked/unchecked)
  3) `drag_start`
  4) `drop` (counts as an attempt)
  5) `play_pause` (inferred from clicked controls)
  6) `completion_click` (bonus)
  7) `visibility_hidden/visibility_visible` (bonus)
  8) `completion` + `confidence` events on final screen detection (custom requirement)
- It uses a `MutationObserver` to detect when a final completion/results screen is inserted/updated dynamically, then parses score %, attempts, and confidence history and sends a completion payload.