scorm-again 3.0.0 → 3.0.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 (50) hide show
  1. package/dist/aicc.js.map +1 -0
  2. package/dist/aicc.min.js.map +1 -0
  3. package/dist/cross-frame-api.js +26 -11
  4. package/dist/cross-frame-api.js.map +1 -0
  5. package/dist/cross-frame-api.min.js +1 -1
  6. package/dist/cross-frame-api.min.js.map +1 -0
  7. package/dist/cross-frame-lms.js +16 -4
  8. package/dist/cross-frame-lms.js.map +1 -0
  9. package/dist/cross-frame-lms.min.js +1 -1
  10. package/dist/cross-frame-lms.min.js.map +1 -0
  11. package/dist/esm/aicc.js.map +1 -0
  12. package/dist/esm/aicc.min.js.map +1 -0
  13. package/dist/esm/cross-frame-api.js +115 -108
  14. package/dist/esm/cross-frame-api.js.map +1 -0
  15. package/dist/esm/cross-frame-api.min.js +1 -1
  16. package/dist/esm/cross-frame-api.min.js.map +1 -0
  17. package/dist/esm/cross-frame-lms.js +32 -30
  18. package/dist/esm/cross-frame-lms.js.map +1 -0
  19. package/dist/esm/cross-frame-lms.min.js +1 -1
  20. package/dist/esm/cross-frame-lms.min.js.map +1 -0
  21. package/dist/esm/scorm-again.js +804 -506
  22. package/dist/esm/scorm-again.js.map +1 -0
  23. package/dist/esm/scorm-again.min.js +1 -1
  24. package/dist/esm/scorm-again.min.js.map +1 -0
  25. package/dist/esm/scorm12.js +152 -373
  26. package/dist/esm/scorm12.js.map +1 -0
  27. package/dist/esm/scorm12.min.js +1 -1
  28. package/dist/esm/scorm12.min.js.map +1 -0
  29. package/dist/esm/scorm2004.js +582 -312
  30. package/dist/esm/scorm2004.js.map +1 -0
  31. package/dist/esm/scorm2004.min.js +1 -1
  32. package/dist/esm/scorm2004.min.js.map +1 -0
  33. package/dist/scorm-again.js +1205 -334
  34. package/dist/scorm-again.js.map +1 -0
  35. package/dist/scorm-again.min.js +1 -1
  36. package/dist/scorm-again.min.js.map +1 -0
  37. package/dist/scorm12.js +832 -71
  38. package/dist/scorm12.js.map +1 -0
  39. package/dist/scorm12.min.js +1 -1
  40. package/dist/scorm12.min.js.map +1 -0
  41. package/dist/scorm2004.js +1078 -292
  42. package/dist/scorm2004.js.map +1 -0
  43. package/dist/scorm2004.min.js +1 -1
  44. package/dist/scorm2004.min.js.map +1 -0
  45. package/dist/types/BaseAPI.d.ts +3 -3
  46. package/dist/types/Scorm2004API.d.ts +1 -0
  47. package/dist/types/cmi/scorm2004/sequencing/handlers/termination_handler.d.ts +2 -2
  48. package/dist/types/interfaces/services.d.ts +3 -2
  49. package/dist/types/services/EventService.d.ts +3 -3
  50. package/package.json +41 -44
@@ -8,7 +8,7 @@ const designations = {
8
8
  M: SECONDS_PER_MINUTE,
9
9
  S: SECONDS_PER_SECOND
10
10
  };
11
- const getSecondsAsHHMMSS = memoize((totalSeconds) => {
11
+ const getSecondsAsHHMMSS = (totalSeconds) => {
12
12
  if (!totalSeconds || totalSeconds <= 0) {
13
13
  return "00:00:00";
14
14
  }
@@ -27,8 +27,8 @@ const getSecondsAsHHMMSS = memoize((totalSeconds) => {
27
27
  msStr = "." + msStr.split(".")[1];
28
28
  }
29
29
  return (hours + ":" + minutes + ":" + seconds).replace(/\b\d\b/g, "0$&") + msStr;
30
- });
31
- const getSecondsAsISODuration = memoize((seconds) => {
30
+ };
31
+ const getSecondsAsISODuration = (seconds) => {
32
32
  if (!seconds || seconds <= 0) {
33
33
  return "PT0S";
34
34
  }
@@ -53,7 +53,7 @@ const getSecondsAsISODuration = memoize((seconds) => {
53
53
  }
54
54
  });
55
55
  return duration;
56
- });
56
+ };
57
57
  const getTimeAsSeconds = memoize(
58
58
  (timeString, timeRegex) => {
59
59
  if (typeof timeString === "number" || typeof timeString === "boolean") {
@@ -269,18 +269,19 @@ function parseNavigationRequest(navRequest) {
269
269
  }
270
270
 
271
271
  class BaseCMI {
272
+ /**
273
+ * Flag used during JSON serialization to allow getter access without initialization checks.
274
+ * When true, getters can be accessed before the API is initialized, which is necessary
275
+ * for serializing the CMI data structure to JSON format.
276
+ */
277
+ jsonString = false;
278
+ _cmi_element;
279
+ _initialized = false;
272
280
  /**
273
281
  * Constructor for BaseCMI
274
282
  * @param {string} cmi_element
275
283
  */
276
284
  constructor(cmi_element) {
277
- /**
278
- * Flag used during JSON serialization to allow getter access without initialization checks.
279
- * When true, getters can be accessed before the API is initialized, which is necessary
280
- * for serializing the CMI data structure to JSON format.
281
- */
282
- this.jsonString = false;
283
- this._initialized = false;
284
285
  this._cmi_element = cmi_element;
285
286
  }
286
287
  /**
@@ -298,6 +299,7 @@ class BaseCMI {
298
299
  }
299
300
  }
300
301
  class BaseRootCMI extends BaseCMI {
302
+ _start_time;
301
303
  /**
302
304
  * Start time of the session
303
305
  * @type {number | undefined}
@@ -324,6 +326,7 @@ class BaseScormValidationError extends Error {
324
326
  this._errorCode = errorCode;
325
327
  Object.setPrototypeOf(this, BaseScormValidationError.prototype);
326
328
  }
329
+ _errorCode;
327
330
  /**
328
331
  * Getter for _errorCode
329
332
  * @return {number}
@@ -342,7 +345,6 @@ class ValidationError extends BaseScormValidationError {
342
345
  */
343
346
  constructor(CMIElement, errorCode, errorMessage, detailedMessage) {
344
347
  super(CMIElement, errorCode);
345
- this._detailedMessage = "";
346
348
  this.message = `${CMIElement} : ${errorMessage}`;
347
349
  this._errorMessage = errorMessage;
348
350
  if (detailedMessage) {
@@ -350,6 +352,8 @@ class ValidationError extends BaseScormValidationError {
350
352
  }
351
353
  Object.setPrototypeOf(this, ValidationError.prototype);
352
354
  }
355
+ _errorMessage;
356
+ _detailedMessage = "";
353
357
  /**
354
358
  * Getter for _errorMessage
355
359
  * @return {string}
@@ -688,6 +692,10 @@ const scorm2004_errors = {
688
692
  };
689
693
 
690
694
  class CMIArray extends BaseCMI {
695
+ _errorCode;
696
+ _errorClass;
697
+ __children;
698
+ childArray;
691
699
  /**
692
700
  * Constructor cmi *.n arrays
693
701
  * @param {object} params
@@ -1696,6 +1704,10 @@ const ValidLanguages = [
1696
1704
  ];
1697
1705
 
1698
1706
  class ScheduledCommit {
1707
+ _API;
1708
+ _cancelled = false;
1709
+ _timeout;
1710
+ _callback;
1699
1711
  /**
1700
1712
  * Constructor for ScheduledCommit
1701
1713
  * @param {BaseAPI} API
@@ -1703,7 +1715,6 @@ class ScheduledCommit {
1703
1715
  * @param {string} callback
1704
1716
  */
1705
1717
  constructor(API, when, callback) {
1706
- this._cancelled = false;
1707
1718
  this._API = API;
1708
1719
  this._timeout = setTimeout(this.wrapper.bind(this), when);
1709
1720
  this._callback = callback;
@@ -1760,6 +1771,14 @@ var RuleActionType = /* @__PURE__ */ ((RuleActionType2) => {
1760
1771
  return RuleActionType2;
1761
1772
  })(RuleActionType || {});
1762
1773
  class RuleCondition extends BaseCMI {
1774
+ _condition = "always" /* ALWAYS */;
1775
+ _operator = null;
1776
+ _parameters = /* @__PURE__ */ new Map();
1777
+ _referencedObjective = null;
1778
+ // Optional, overridable provider for current time (LMS may set via SequencingService)
1779
+ static _now = () => /* @__PURE__ */ new Date();
1780
+ // Optional, overridable hook for getting elapsed seconds
1781
+ static _getElapsedSecondsHook = void 0;
1763
1782
  /**
1764
1783
  * Constructor for RuleCondition
1765
1784
  * @param {RuleConditionType} condition - The condition type
@@ -1768,22 +1787,10 @@ class RuleCondition extends BaseCMI {
1768
1787
  */
1769
1788
  constructor(condition = "always" /* ALWAYS */, operator = null, parameters = /* @__PURE__ */ new Map()) {
1770
1789
  super("ruleCondition");
1771
- this._condition = "always" /* ALWAYS */;
1772
- this._operator = null;
1773
- this._parameters = /* @__PURE__ */ new Map();
1774
- this._referencedObjective = null;
1775
1790
  this._condition = condition;
1776
1791
  this._operator = operator;
1777
1792
  this._parameters = parameters;
1778
1793
  }
1779
- static {
1780
- // Optional, overridable provider for current time (LMS may set via SequencingService)
1781
- this._now = () => /* @__PURE__ */ new Date();
1782
- }
1783
- static {
1784
- // Optional, overridable hook for getting elapsed seconds
1785
- this._getElapsedSecondsHook = void 0;
1786
- }
1787
1794
  /**
1788
1795
  * Allow integrators to override the clock used for time-based rules.
1789
1796
  */
@@ -2051,6 +2058,9 @@ class RuleCondition extends BaseCMI {
2051
2058
  }
2052
2059
  }
2053
2060
  class SequencingRule extends BaseCMI {
2061
+ _conditions = [];
2062
+ _action = "skip" /* SKIP */;
2063
+ _conditionCombination = "and" /* AND */;
2054
2064
  /**
2055
2065
  * Constructor for SequencingRule
2056
2066
  * @param {RuleActionType} action - The action to take when the rule conditions are met
@@ -2058,9 +2068,6 @@ class SequencingRule extends BaseCMI {
2058
2068
  */
2059
2069
  constructor(action = "skip" /* SKIP */, conditionCombination = "and" /* AND */) {
2060
2070
  super("sequencingRule");
2061
- this._conditions = [];
2062
- this._action = "skip" /* SKIP */;
2063
- this._conditionCombination = "and" /* AND */;
2064
2071
  this._action = action;
2065
2072
  this._conditionCombination = conditionCombination;
2066
2073
  }
@@ -2174,14 +2181,14 @@ class SequencingRule extends BaseCMI {
2174
2181
  }
2175
2182
  }
2176
2183
  class SequencingRules extends BaseCMI {
2184
+ _preConditionRules = [];
2185
+ _exitConditionRules = [];
2186
+ _postConditionRules = [];
2177
2187
  /**
2178
2188
  * Constructor for SequencingRules
2179
2189
  */
2180
2190
  constructor() {
2181
2191
  super("sequencingRules");
2182
- this._preConditionRules = [];
2183
- this._exitConditionRules = [];
2184
- this._postConditionRules = [];
2185
2192
  }
2186
2193
  /**
2187
2194
  * Called when the API needs to be reset
@@ -2922,6 +2929,10 @@ var DeliveryRequestType = /* @__PURE__ */ ((DeliveryRequestType2) => {
2922
2929
  return DeliveryRequestType2;
2923
2930
  })(DeliveryRequestType || {});
2924
2931
  class SequencingResult {
2932
+ deliveryRequest;
2933
+ targetActivity;
2934
+ exception;
2935
+ endSequencingSession;
2925
2936
  constructor(deliveryRequest = "doNotDeliver" /* DO_NOT_DELIVER */, targetActivity = null, exception = null, endSequencingSession = false) {
2926
2937
  this.deliveryRequest = deliveryRequest;
2927
2938
  this.targetActivity = targetActivity;
@@ -2930,6 +2941,10 @@ class SequencingResult {
2930
2941
  }
2931
2942
  }
2932
2943
  class FlowSubprocessResult {
2944
+ identifiedActivity;
2945
+ deliverable;
2946
+ exception;
2947
+ endSequencingSession;
2933
2948
  constructor(identifiedActivity, deliverable, exception = null, endSequencingSession = false) {
2934
2949
  this.identifiedActivity = identifiedActivity;
2935
2950
  this.deliverable = deliverable;
@@ -2938,6 +2953,8 @@ class FlowSubprocessResult {
2938
2953
  }
2939
2954
  }
2940
2955
  class ChoiceTraversalResult {
2956
+ activity;
2957
+ exception;
2941
2958
  constructor(activity, exception = null) {
2942
2959
  this.activity = activity;
2943
2960
  this.exception = exception;
@@ -2950,6 +2967,8 @@ var FlowSubprocessMode = /* @__PURE__ */ ((FlowSubprocessMode2) => {
2950
2967
  })(FlowSubprocessMode || {});
2951
2968
 
2952
2969
  class RuleEvaluationEngine {
2970
+ now;
2971
+ getAttemptElapsedSecondsHook;
2953
2972
  constructor(options = {}) {
2954
2973
  this.now = options.now || (() => /* @__PURE__ */ new Date());
2955
2974
  this.getAttemptElapsedSecondsHook = options.getAttemptElapsedSecondsHook || null;
@@ -3250,42 +3269,42 @@ var RandomizationTiming = /* @__PURE__ */ ((RandomizationTiming2) => {
3250
3269
  return RandomizationTiming2;
3251
3270
  })(RandomizationTiming || {});
3252
3271
  class SequencingControls extends BaseCMI {
3272
+ // Sequencing Control Modes
3273
+ _enabled = true;
3274
+ _choice = true;
3275
+ _choiceExit = true;
3276
+ // Per SCORM 2004 Sequencing & Navigation, flow defaults to true
3277
+ _flow = true;
3278
+ _forwardOnly = false;
3279
+ _useCurrentAttemptObjectiveInfo = true;
3280
+ _useCurrentAttemptProgressInfo = true;
3281
+ // Constrain Choice Controls
3282
+ _preventActivation = false;
3283
+ _constrainChoice = false;
3284
+ // Rule-driven traversal limiter (e.g., post-condition stopForwardTraversal)
3285
+ _stopForwardTraversal = false;
3286
+ // Rollup Controls
3287
+ _rollupObjectiveSatisfied = true;
3288
+ _rollupProgressCompletion = true;
3289
+ _objectiveMeasureWeight = 1;
3290
+ // Selection Controls
3291
+ _selectionTiming = "never" /* NEVER */;
3292
+ _selectCount = null;
3293
+ _selectionCountStatus = false;
3294
+ _randomizeChildren = false;
3295
+ // Randomization Controls
3296
+ _randomizationTiming = "never" /* NEVER */;
3297
+ _reorderChildren = false;
3298
+ // Auto-completion/satisfaction controls
3299
+ _completionSetByContent = false;
3300
+ _objectiveSetByContent = false;
3301
+ // Delivery Controls
3302
+ _tracked = true;
3253
3303
  /**
3254
3304
  * Constructor for SequencingControls
3255
3305
  */
3256
3306
  constructor() {
3257
3307
  super("sequencingControls");
3258
- // Sequencing Control Modes
3259
- this._enabled = true;
3260
- this._choice = true;
3261
- this._choiceExit = true;
3262
- // Per SCORM 2004 Sequencing & Navigation, flow defaults to true
3263
- this._flow = true;
3264
- this._forwardOnly = false;
3265
- this._useCurrentAttemptObjectiveInfo = true;
3266
- this._useCurrentAttemptProgressInfo = true;
3267
- // Constrain Choice Controls
3268
- this._preventActivation = false;
3269
- this._constrainChoice = false;
3270
- // Rule-driven traversal limiter (e.g., post-condition stopForwardTraversal)
3271
- this._stopForwardTraversal = false;
3272
- // Rollup Controls
3273
- this._rollupObjectiveSatisfied = true;
3274
- this._rollupProgressCompletion = true;
3275
- this._objectiveMeasureWeight = 1;
3276
- // Selection Controls
3277
- this._selectionTiming = "never" /* NEVER */;
3278
- this._selectCount = null;
3279
- this._selectionCountStatus = false;
3280
- this._randomizeChildren = false;
3281
- // Randomization Controls
3282
- this._randomizationTiming = "never" /* NEVER */;
3283
- this._reorderChildren = false;
3284
- // Auto-completion/satisfaction controls
3285
- this._completionSetByContent = false;
3286
- this._objectiveSetByContent = false;
3287
- // Delivery Controls
3288
- this._tracked = true;
3289
3308
  }
3290
3309
  /**
3291
3310
  * Reset the sequencing controls to their default values
@@ -4683,6 +4702,19 @@ class RetryRequestHandler {
4683
4702
  }
4684
4703
 
4685
4704
  class SequencingProcess {
4705
+ activityTree;
4706
+ // Extracted services
4707
+ treeQueries;
4708
+ constraintValidator;
4709
+ ruleEngine;
4710
+ traversalService;
4711
+ // Request handlers
4712
+ flowHandler;
4713
+ choiceHandler;
4714
+ exitHandler;
4715
+ retryHandler;
4716
+ // Time function (exposed for testing)
4717
+ _now;
4686
4718
  /**
4687
4719
  * Get/set the current time function (used for testing time-dependent logic)
4688
4720
  */
@@ -4706,6 +4738,7 @@ class SequencingProcess {
4706
4738
  );
4707
4739
  this.retryHandler = new RetryRequestHandler(this.activityTree, this.traversalService);
4708
4740
  }
4741
+ _getAttemptElapsedSecondsHook;
4709
4742
  /**
4710
4743
  * Get/set the elapsed seconds hook (used for time-based rules)
4711
4744
  */
@@ -4940,9 +4973,12 @@ class SequencingProcess {
4940
4973
  }
4941
4974
 
4942
4975
  class ActivityDeliveryService {
4976
+ eventService;
4977
+ loggingService;
4978
+ callbacks;
4979
+ currentDeliveredActivity = null;
4980
+ pendingDelivery = null;
4943
4981
  constructor(eventService, loggingService, callbacks = {}) {
4944
- this.currentDeliveredActivity = null;
4945
- this.pendingDelivery = null;
4946
4982
  this.eventService = eventService;
4947
4983
  this.loggingService = loggingService;
4948
4984
  this.callbacks = callbacks;
@@ -5028,6 +5064,8 @@ class ActivityDeliveryService {
5028
5064
  }
5029
5065
 
5030
5066
  class AsynchronousHttpService {
5067
+ settings;
5068
+ error_codes;
5031
5069
  /**
5032
5070
  * Constructor for AsynchronousHttpService
5033
5071
  * @param {Settings} settings - The settings object
@@ -5223,6 +5261,7 @@ function getErrorCode(errorCodes, key) {
5223
5261
  return code;
5224
5262
  }
5225
5263
  class CMIValueAccessService {
5264
+ context;
5226
5265
  constructor(context) {
5227
5266
  this.context = context;
5228
5267
  }
@@ -5587,11 +5626,13 @@ class CMIValueAccessService {
5587
5626
  }
5588
5627
 
5589
5628
  class LoggingService {
5629
+ static _instance;
5630
+ _logLevel = LogLevelEnum.ERROR;
5631
+ _logHandler;
5590
5632
  /**
5591
5633
  * Private constructor to prevent direct instantiation
5592
5634
  */
5593
5635
  constructor() {
5594
- this._logLevel = LogLevelEnum.ERROR;
5595
5636
  this._logHandler = defaultLogHandler;
5596
5637
  }
5597
5638
  /**
@@ -5745,6 +5786,12 @@ function getLoggingService() {
5745
5786
  }
5746
5787
 
5747
5788
  class ErrorHandlingService {
5789
+ _lastErrorCode = "0";
5790
+ _lastDiagnostic = "";
5791
+ _errorCodes;
5792
+ _apiLog;
5793
+ _getLmsErrorMessageDetails;
5794
+ _loggingService;
5748
5795
  /**
5749
5796
  * Constructor for ErrorHandlingService
5750
5797
  *
@@ -5754,8 +5801,6 @@ class ErrorHandlingService {
5754
5801
  * @param {ILoggingService} loggingService - Optional logging service instance
5755
5802
  */
5756
5803
  constructor(errorCodes, apiLog, getLmsErrorMessageDetails, loggingService) {
5757
- this._lastErrorCode = "0";
5758
- this._lastDiagnostic = "";
5759
5804
  this._errorCodes = errorCodes;
5760
5805
  this._apiLog = apiLog;
5761
5806
  this._getLmsErrorMessageDetails = getLmsErrorMessageDetails;
@@ -5902,15 +5947,17 @@ function createErrorHandlingService(errorCodes, apiLog, getLmsErrorMessageDetail
5902
5947
  }
5903
5948
 
5904
5949
  class EventService {
5950
+ // Map of function names to listeners for faster lookups
5951
+ listenerMap = /* @__PURE__ */ new Map();
5952
+ // Total count of listeners for logging
5953
+ listenerCount = 0;
5954
+ // Function to log API messages
5955
+ apiLog;
5905
5956
  /**
5906
5957
  * Constructor for EventService
5907
5958
  * @param {Function} apiLog - Function to log API messages
5908
5959
  */
5909
5960
  constructor(apiLog) {
5910
- // Map of function names to listeners for faster lookups
5911
- this.listenerMap = /* @__PURE__ */ new Map();
5912
- // Total count of listeners for logging
5913
- this.listenerCount = 0;
5914
5961
  this.apiLog = apiLog;
5915
5962
  }
5916
5963
  /**
@@ -6078,10 +6125,6 @@ class OfflineStorageService {
6078
6125
  */
6079
6126
  constructor(settings, error_codes, apiLog) {
6080
6127
  this.apiLog = apiLog;
6081
- this.storeName = "scorm_again_offline_data";
6082
- this.syncQueue = "scorm_again_sync_queue";
6083
- this.isOnline = navigator.onLine;
6084
- this.syncInProgress = false;
6085
6128
  this.settings = settings;
6086
6129
  this.error_codes = error_codes;
6087
6130
  this.boundOnlineStatusChangeHandler = this.handleOnlineStatusChange.bind(this);
@@ -6090,6 +6133,14 @@ class OfflineStorageService {
6090
6133
  window.addEventListener("offline", this.boundOnlineStatusChangeHandler);
6091
6134
  window.addEventListener("scorm-again:network-status", this.boundCustomNetworkStatusHandler);
6092
6135
  }
6136
+ settings;
6137
+ error_codes;
6138
+ storeName = "scorm_again_offline_data";
6139
+ syncQueue = "scorm_again_sync_queue";
6140
+ isOnline = navigator.onLine;
6141
+ syncInProgress = false;
6142
+ boundOnlineStatusChangeHandler;
6143
+ boundCustomNetworkStatusHandler;
6093
6144
  /**
6094
6145
  * Handle changes in online status
6095
6146
  */
@@ -6401,7 +6452,7 @@ class OfflineStorageService {
6401
6452
  localStorage.setItem(key, JSON.stringify(data));
6402
6453
  } catch (error) {
6403
6454
  if (error instanceof DOMException && error.name === "QuotaExceededError") {
6404
- throw new Error("storage quota exceeded - localStorage is full");
6455
+ throw new Error("storage quota exceeded - localStorage is full", { cause: error });
6405
6456
  }
6406
6457
  throw error;
6407
6458
  }
@@ -6515,6 +6566,8 @@ var RollupConsiderationType = /* @__PURE__ */ ((RollupConsiderationType2) => {
6515
6566
  return RollupConsiderationType2;
6516
6567
  })(RollupConsiderationType || {});
6517
6568
  class RollupCondition extends BaseCMI {
6569
+ _condition = "always" /* ALWAYS */;
6570
+ _parameters = /* @__PURE__ */ new Map();
6518
6571
  /**
6519
6572
  * Constructor for RollupCondition
6520
6573
  * @param {RollupConditionType} condition - The condition type
@@ -6522,8 +6575,6 @@ class RollupCondition extends BaseCMI {
6522
6575
  */
6523
6576
  constructor(condition = "always" /* ALWAYS */, parameters = /* @__PURE__ */ new Map()) {
6524
6577
  super("rollupCondition");
6525
- this._condition = "always" /* ALWAYS */;
6526
- this._parameters = /* @__PURE__ */ new Map();
6527
6578
  this._condition = condition;
6528
6579
  this._parameters = parameters;
6529
6580
  }
@@ -6611,6 +6662,11 @@ class RollupCondition extends BaseCMI {
6611
6662
  }
6612
6663
  }
6613
6664
  class RollupRule extends BaseCMI {
6665
+ _conditions = [];
6666
+ _action = "satisfied" /* SATISFIED */;
6667
+ _consideration = "all" /* ALL */;
6668
+ _minimumCount = 0;
6669
+ _minimumPercent = 0;
6614
6670
  /**
6615
6671
  * Constructor for RollupRule
6616
6672
  * @param {RollupActionType} action - The action to take when the rule conditions are met
@@ -6620,11 +6676,6 @@ class RollupRule extends BaseCMI {
6620
6676
  */
6621
6677
  constructor(action = "satisfied" /* SATISFIED */, consideration = "all" /* ALL */, minimumCount = 0, minimumPercent = 0) {
6622
6678
  super("rollupRule");
6623
- this._conditions = [];
6624
- this._action = "satisfied" /* SATISFIED */;
6625
- this._consideration = "all" /* ALL */;
6626
- this._minimumCount = 0;
6627
- this._minimumPercent = 0;
6628
6679
  this._action = action;
6629
6680
  this._consideration = consideration;
6630
6681
  this._minimumCount = minimumCount;
@@ -6777,12 +6828,12 @@ class RollupRule extends BaseCMI {
6777
6828
  }
6778
6829
  }
6779
6830
  class RollupRules extends BaseCMI {
6831
+ _rules = [];
6780
6832
  /**
6781
6833
  * Constructor for RollupRules
6782
6834
  */
6783
6835
  constructor() {
6784
6836
  super("rollupRules");
6785
- this._rules = [];
6786
6837
  }
6787
6838
  /**
6788
6839
  * Called when the API needs to be reset
@@ -6973,22 +7024,28 @@ class RollupRules extends BaseCMI {
6973
7024
  }
6974
7025
 
6975
7026
  class ActivityObjective {
7027
+ _id;
7028
+ _description;
7029
+ _satisfiedByMeasure;
7030
+ _minNormalizedMeasure;
7031
+ _mapInfo;
7032
+ _isPrimary;
7033
+ _satisfiedStatus = false;
7034
+ _satisfiedStatusKnown = false;
7035
+ // Note: measureStatus has no dirty flag because it is not synchronized to global
7036
+ // objectives. It serves as a validity gate for other synced properties.
7037
+ _measureStatus = false;
7038
+ _normalizedMeasure = 0;
7039
+ _progressMeasure = 0;
7040
+ _progressMeasureStatus = false;
7041
+ _completionStatus = CompletionStatus.UNKNOWN;
7042
+ _progressStatus = false;
7043
+ // Dirty flags for tracking which properties have been modified locally
7044
+ _satisfiedStatusDirty = false;
7045
+ _normalizedMeasureDirty = false;
7046
+ _completionStatusDirty = false;
7047
+ _progressMeasureDirty = false;
6976
7048
  constructor(id, options = {}) {
6977
- this._satisfiedStatus = false;
6978
- this._satisfiedStatusKnown = false;
6979
- // Note: measureStatus has no dirty flag because it is not synchronized to global
6980
- // objectives. It serves as a validity gate for other synced properties.
6981
- this._measureStatus = false;
6982
- this._normalizedMeasure = 0;
6983
- this._progressMeasure = 0;
6984
- this._progressMeasureStatus = false;
6985
- this._completionStatus = CompletionStatus.UNKNOWN;
6986
- this._progressStatus = false;
6987
- // Dirty flags for tracking which properties have been modified locally
6988
- this._satisfiedStatusDirty = false;
6989
- this._normalizedMeasureDirty = false;
6990
- this._completionStatusDirty = false;
6991
- this._progressMeasureDirty = false;
6992
7049
  this._id = id;
6993
7050
  this._description = options.description ?? null;
6994
7051
  this._satisfiedByMeasure = options.satisfiedByMeasure ?? false;
@@ -7183,6 +7240,90 @@ class ActivityObjective {
7183
7240
  }
7184
7241
  }
7185
7242
  class Activity extends BaseCMI {
7243
+ _id = "";
7244
+ _title = "";
7245
+ _children = [];
7246
+ _parent = null;
7247
+ _isVisible = true;
7248
+ _isActive = false;
7249
+ _isSuspended = false;
7250
+ _isCompleted = false;
7251
+ _completionStatus = CompletionStatus.UNKNOWN;
7252
+ _successStatus = SuccessStatus.UNKNOWN;
7253
+ _attemptCount = 0;
7254
+ _attemptCompletionAmount = 0;
7255
+ _attemptAbsoluteDuration = "PT0H0M0S";
7256
+ _attemptExperiencedDuration = "PT0H0M0S";
7257
+ _activityAbsoluteDuration = "PT0H0M0S";
7258
+ _activityExperiencedDuration = "PT0H0M0S";
7259
+ // Duration tracking fields (separate from limits) - actual calculated values
7260
+ _attemptAbsoluteDurationValue = "PT0H0M0S";
7261
+ _attemptExperiencedDurationValue = "PT0H0M0S";
7262
+ _activityAbsoluteDurationValue = "PT0H0M0S";
7263
+ _activityExperiencedDurationValue = "PT0H0M0S";
7264
+ // Timestamp tracking for duration calculation
7265
+ _activityStartTimestampUtc = null;
7266
+ _attemptStartTimestampUtc = null;
7267
+ _activityEndedDate = null;
7268
+ _objectiveSatisfiedStatus = false;
7269
+ _objectiveSatisfiedStatusKnown = false;
7270
+ _objectiveMeasureStatus = false;
7271
+ _objectiveNormalizedMeasure = 0;
7272
+ _scaledPassingScore = 0.7;
7273
+ // Default passing score
7274
+ // Dirty flags for tracking which activity-level objective properties have been modified locally
7275
+ _objectiveSatisfiedStatusDirty = false;
7276
+ _objectiveNormalizedMeasureDirty = false;
7277
+ _objectiveMeasureStatusDirty = false;
7278
+ _progressMeasure = 0;
7279
+ _progressMeasureStatus = false;
7280
+ _location = "";
7281
+ _attemptAbsoluteStartTime = "";
7282
+ _learnerPrefs = null;
7283
+ _activityAttemptActive = false;
7284
+ _isHiddenFromChoice = false;
7285
+ _isAvailable = true;
7286
+ _hideLmsUi = [];
7287
+ _auxiliaryResources = [];
7288
+ _attemptLimit = null;
7289
+ _attemptAbsoluteDurationLimit = null;
7290
+ _activityAbsoluteDurationLimit = null;
7291
+ _timeLimitAction = null;
7292
+ _timeLimitDuration = null;
7293
+ _beginTimeLimit = null;
7294
+ _endTimeLimit = null;
7295
+ _launchData = "";
7296
+ _credit = "credit";
7297
+ _maxTimeAllowed = "";
7298
+ _completionThreshold = "";
7299
+ _sequencingControls;
7300
+ _sequencingRules;
7301
+ _rollupRules;
7302
+ _processedChildren = null;
7303
+ _isNewAttempt = false;
7304
+ _primaryObjective = null;
7305
+ _objectives = [];
7306
+ _rollupConsiderations = {
7307
+ requiredForSatisfied: "always",
7308
+ requiredForNotSatisfied: "always",
7309
+ requiredForCompleted: "always",
7310
+ requiredForIncomplete: "always",
7311
+ measureSatisfactionIfActive: true
7312
+ };
7313
+ // Individual rollup consideration properties for this activity (RB.1.4.2)
7314
+ // These determine when THIS activity is included in parent rollup calculations
7315
+ _requiredForSatisfied = "always";
7316
+ _requiredForNotSatisfied = "always";
7317
+ _requiredForCompleted = "always";
7318
+ _requiredForIncomplete = "always";
7319
+ _wasSkipped = false;
7320
+ _attemptProgressStatus = false;
7321
+ _wasAutoCompleted = false;
7322
+ _wasAutoSatisfied = false;
7323
+ _completedByMeasure = false;
7324
+ _minProgressMeasure = 1;
7325
+ _progressWeight = 1;
7326
+ _attemptCompletionAmountStatus = false;
7186
7327
  /**
7187
7328
  * Constructor for Activity
7188
7329
  * @param {string} id - The unique identifier for this activity
@@ -7190,87 +7331,6 @@ class Activity extends BaseCMI {
7190
7331
  */
7191
7332
  constructor(id = "", title = "") {
7192
7333
  super("activity");
7193
- this._id = "";
7194
- this._title = "";
7195
- this._children = [];
7196
- this._parent = null;
7197
- this._isVisible = true;
7198
- this._isActive = false;
7199
- this._isSuspended = false;
7200
- this._isCompleted = false;
7201
- this._completionStatus = CompletionStatus.UNKNOWN;
7202
- this._successStatus = SuccessStatus.UNKNOWN;
7203
- this._attemptCount = 0;
7204
- this._attemptCompletionAmount = 0;
7205
- this._attemptAbsoluteDuration = "PT0H0M0S";
7206
- this._attemptExperiencedDuration = "PT0H0M0S";
7207
- this._activityAbsoluteDuration = "PT0H0M0S";
7208
- this._activityExperiencedDuration = "PT0H0M0S";
7209
- // Duration tracking fields (separate from limits) - actual calculated values
7210
- this._attemptAbsoluteDurationValue = "PT0H0M0S";
7211
- this._attemptExperiencedDurationValue = "PT0H0M0S";
7212
- this._activityAbsoluteDurationValue = "PT0H0M0S";
7213
- this._activityExperiencedDurationValue = "PT0H0M0S";
7214
- // Timestamp tracking for duration calculation
7215
- this._activityStartTimestampUtc = null;
7216
- this._attemptStartTimestampUtc = null;
7217
- this._activityEndedDate = null;
7218
- this._objectiveSatisfiedStatus = false;
7219
- this._objectiveSatisfiedStatusKnown = false;
7220
- this._objectiveMeasureStatus = false;
7221
- this._objectiveNormalizedMeasure = 0;
7222
- this._scaledPassingScore = 0.7;
7223
- // Default passing score
7224
- // Dirty flags for tracking which activity-level objective properties have been modified locally
7225
- this._objectiveSatisfiedStatusDirty = false;
7226
- this._objectiveNormalizedMeasureDirty = false;
7227
- this._objectiveMeasureStatusDirty = false;
7228
- this._progressMeasure = 0;
7229
- this._progressMeasureStatus = false;
7230
- this._location = "";
7231
- this._attemptAbsoluteStartTime = "";
7232
- this._learnerPrefs = null;
7233
- this._activityAttemptActive = false;
7234
- this._isHiddenFromChoice = false;
7235
- this._isAvailable = true;
7236
- this._hideLmsUi = [];
7237
- this._auxiliaryResources = [];
7238
- this._attemptLimit = null;
7239
- this._attemptAbsoluteDurationLimit = null;
7240
- this._activityAbsoluteDurationLimit = null;
7241
- this._timeLimitAction = null;
7242
- this._timeLimitDuration = null;
7243
- this._beginTimeLimit = null;
7244
- this._endTimeLimit = null;
7245
- this._launchData = "";
7246
- this._credit = "credit";
7247
- this._maxTimeAllowed = "";
7248
- this._completionThreshold = "";
7249
- this._processedChildren = null;
7250
- this._isNewAttempt = false;
7251
- this._primaryObjective = null;
7252
- this._objectives = [];
7253
- this._rollupConsiderations = {
7254
- requiredForSatisfied: "always",
7255
- requiredForNotSatisfied: "always",
7256
- requiredForCompleted: "always",
7257
- requiredForIncomplete: "always",
7258
- measureSatisfactionIfActive: true
7259
- };
7260
- // Individual rollup consideration properties for this activity (RB.1.4.2)
7261
- // These determine when THIS activity is included in parent rollup calculations
7262
- this._requiredForSatisfied = "always";
7263
- this._requiredForNotSatisfied = "always";
7264
- this._requiredForCompleted = "always";
7265
- this._requiredForIncomplete = "always";
7266
- this._wasSkipped = false;
7267
- this._attemptProgressStatus = false;
7268
- this._wasAutoCompleted = false;
7269
- this._wasAutoSatisfied = false;
7270
- this._completedByMeasure = false;
7271
- this._minProgressMeasure = 1;
7272
- this._progressWeight = 1;
7273
- this._attemptCompletionAmountStatus = false;
7274
7334
  this._id = id;
7275
7335
  this._title = title;
7276
7336
  this._sequencingControls = new SequencingControls();
@@ -8976,6 +9036,7 @@ class RollupChildFilter {
8976
9036
  }
8977
9037
 
8978
9038
  class RollupRuleEvaluator {
9039
+ childFilter;
8979
9040
  /**
8980
9041
  * Create a new RollupRuleEvaluator
8981
9042
  *
@@ -9097,6 +9158,8 @@ class RollupRuleEvaluator {
9097
9158
  }
9098
9159
 
9099
9160
  class MeasureRollupProcessor {
9161
+ childFilter;
9162
+ eventCallback;
9100
9163
  /**
9101
9164
  * Create a new MeasureRollupProcessor
9102
9165
  *
@@ -9273,6 +9336,9 @@ class MeasureRollupProcessor {
9273
9336
  }
9274
9337
 
9275
9338
  class ObjectiveRollupProcessor {
9339
+ childFilter;
9340
+ ruleEvaluator;
9341
+ eventCallback;
9276
9342
  /**
9277
9343
  * Create a new ObjectiveRollupProcessor
9278
9344
  *
@@ -9407,6 +9473,10 @@ class ObjectiveRollupProcessor {
9407
9473
  }
9408
9474
 
9409
9475
  class ProgressRollupProcessor {
9476
+ childFilter;
9477
+ ruleEvaluator;
9478
+ objectiveProcessor;
9479
+ eventCallback;
9410
9480
  /**
9411
9481
  * Create a new ProgressRollupProcessor
9412
9482
  *
@@ -9500,6 +9570,7 @@ class ProgressRollupProcessor {
9500
9570
  }
9501
9571
 
9502
9572
  class DurationRollupProcessor {
9573
+ eventCallback;
9503
9574
  /**
9504
9575
  * Create a new DurationRollupProcessor
9505
9576
  *
@@ -9608,6 +9679,11 @@ class DurationRollupProcessor {
9608
9679
 
9609
9680
  const MAX_CLUSTER_DEPTH = 10;
9610
9681
  class CrossClusterProcessor {
9682
+ measureProcessor;
9683
+ objectiveProcessor;
9684
+ progressProcessor;
9685
+ eventCallback;
9686
+ processingClusters = /* @__PURE__ */ new Set();
9611
9687
  /**
9612
9688
  * Create a new CrossClusterProcessor
9613
9689
  *
@@ -9617,7 +9693,6 @@ class CrossClusterProcessor {
9617
9693
  * @param eventCallback - Optional callback for firing events
9618
9694
  */
9619
9695
  constructor(measureProcessor, objectiveProcessor, progressProcessor, eventCallback) {
9620
- this.processingClusters = /* @__PURE__ */ new Set();
9621
9696
  this.measureProcessor = measureProcessor;
9622
9697
  this.objectiveProcessor = objectiveProcessor;
9623
9698
  this.progressProcessor = progressProcessor;
@@ -9758,6 +9833,7 @@ class CrossClusterProcessor {
9758
9833
  }
9759
9834
 
9760
9835
  class GlobalObjectiveSynchronizer {
9836
+ eventCallback;
9761
9837
  /**
9762
9838
  * Create a new GlobalObjectiveSynchronizer
9763
9839
  *
@@ -10148,6 +10224,9 @@ class GlobalObjectiveSynchronizer {
10148
10224
  }
10149
10225
 
10150
10226
  class RollupStateValidator {
10227
+ rollupStateLog = [];
10228
+ childFilter;
10229
+ eventCallback;
10151
10230
  /**
10152
10231
  * Create a new RollupStateValidator
10153
10232
  *
@@ -10155,7 +10234,6 @@ class RollupStateValidator {
10155
10234
  * @param eventCallback - Optional callback for firing events
10156
10235
  */
10157
10236
  constructor(childFilter, eventCallback) {
10158
- this.rollupStateLog = [];
10159
10237
  this.childFilter = childFilter;
10160
10238
  this.eventCallback = eventCallback || null;
10161
10239
  }
@@ -10279,6 +10357,16 @@ class RollupStateValidator {
10279
10357
  }
10280
10358
 
10281
10359
  class RollupProcess {
10360
+ childFilter;
10361
+ ruleEvaluator;
10362
+ measureProcessor;
10363
+ objectiveProcessor;
10364
+ progressProcessor;
10365
+ durationProcessor;
10366
+ globalObjectiveSynchronizer;
10367
+ stateValidator;
10368
+ crossClusterProcessor;
10369
+ eventCallback;
10282
10370
  /**
10283
10371
  * Create a new RollupProcess orchestrator
10284
10372
  *
@@ -10491,6 +10579,7 @@ function validateSuccessStatus(value) {
10491
10579
  return null;
10492
10580
  }
10493
10581
  class RteDataTransferService {
10582
+ context;
10494
10583
  constructor(context) {
10495
10584
  this.context = context;
10496
10585
  }
@@ -10652,8 +10741,16 @@ class RteDataTransferService {
10652
10741
  }
10653
10742
 
10654
10743
  class TerminationHandler {
10744
+ activityTree;
10745
+ sequencingProcess;
10746
+ rollupProcess;
10747
+ globalObjectiveMap;
10748
+ eventCallback;
10749
+ getCMIData;
10750
+ is4thEdition;
10751
+ invalidateCacheCallback = null;
10752
+ _rteDataTransferService;
10655
10753
  constructor(activityTree, sequencingProcess, rollupProcess, globalObjectiveMap, eventCallback = null, options) {
10656
- this.invalidateCacheCallback = null;
10657
10754
  this.activityTree = activityTree;
10658
10755
  this.sequencingProcess = sequencingProcess;
10659
10756
  this.rollupProcess = rollupProcess;
@@ -10765,7 +10862,7 @@ class TerminationHandler {
10765
10862
  this.endAttempt(this.activityTree.currentActivity);
10766
10863
  }
10767
10864
  }
10768
- let processedExit = false;
10865
+ let processedExit;
10769
10866
  let postConditionResult;
10770
10867
  do {
10771
10868
  processedExit = false;
@@ -11238,6 +11335,9 @@ class TerminationHandler {
11238
11335
  }
11239
11336
 
11240
11337
  class DeliveryRequest {
11338
+ valid;
11339
+ targetActivity;
11340
+ exception;
11241
11341
  constructor(valid = false, targetActivity = null, exception = null) {
11242
11342
  this.valid = valid;
11243
11343
  this.targetActivity = targetActivity;
@@ -11245,13 +11345,22 @@ class DeliveryRequest {
11245
11345
  }
11246
11346
  }
11247
11347
  class DeliveryHandler {
11348
+ static HIDE_LMS_UI_ORDER = [...HIDE_LMS_UI_TOKENS];
11349
+ activityTree;
11350
+ rollupProcess;
11351
+ globalObjectiveMap;
11352
+ adlNav;
11353
+ eventCallback;
11354
+ now;
11355
+ defaultHideLmsUi;
11356
+ defaultAuxiliaryResources;
11357
+ _deliveryInProgress = false;
11358
+ contentDelivered = false;
11359
+ checkActivityCallback = null;
11360
+ invalidateCacheCallback = null;
11361
+ updateNavigationValidityCallback = null;
11362
+ clearSuspendedActivityCallback = null;
11248
11363
  constructor(activityTree, rollupProcess, globalObjectiveMap, adlNav = null, eventCallback = null, options) {
11249
- this._deliveryInProgress = false;
11250
- this.contentDelivered = false;
11251
- this.checkActivityCallback = null;
11252
- this.invalidateCacheCallback = null;
11253
- this.updateNavigationValidityCallback = null;
11254
- this.clearSuspendedActivityCallback = null;
11255
11364
  this.activityTree = activityTree;
11256
11365
  this.rollupProcess = rollupProcess;
11257
11366
  this.globalObjectiveMap = globalObjectiveMap;
@@ -11261,9 +11370,6 @@ class DeliveryHandler {
11261
11370
  this.defaultHideLmsUi = options?.defaultHideLmsUi ? [...options.defaultHideLmsUi] : [];
11262
11371
  this.defaultAuxiliaryResources = options?.defaultAuxiliaryResources ? options.defaultAuxiliaryResources.map((resource) => ({ ...resource })) : [];
11263
11372
  }
11264
- static {
11265
- this.HIDE_LMS_UI_ORDER = [...HIDE_LMS_UI_TOKENS];
11266
- }
11267
11373
  /**
11268
11374
  * Set callback to check activity validity
11269
11375
  */
@@ -11548,9 +11654,11 @@ class DeliveryHandler {
11548
11654
  }
11549
11655
 
11550
11656
  class NavigationLookAhead {
11657
+ activityTree;
11658
+ sequencingProcess;
11659
+ cache = null;
11660
+ isDirty = true;
11551
11661
  constructor(activityTree, sequencingProcess) {
11552
- this.cache = null;
11553
- this.isDirty = true;
11554
11662
  this.activityTree = activityTree;
11555
11663
  this.sequencingProcess = sequencingProcess;
11556
11664
  }
@@ -11901,6 +12009,11 @@ var NavigationRequestType = /* @__PURE__ */ ((NavigationRequestType2) => {
11901
12009
  return NavigationRequestType2;
11902
12010
  })(NavigationRequestType || {});
11903
12011
  class NavigationRequestResult {
12012
+ valid;
12013
+ terminationRequest;
12014
+ sequencingRequest;
12015
+ targetActivityId;
12016
+ exception;
11904
12017
  constructor(valid = false, terminationRequest = null, sequencingRequest = null, targetActivityId = null, exception = null) {
11905
12018
  this.valid = valid;
11906
12019
  this.terminationRequest = terminationRequest;
@@ -11910,8 +12023,13 @@ class NavigationRequestResult {
11910
12023
  }
11911
12024
  }
11912
12025
  class NavigationValidityService {
12026
+ activityTree;
12027
+ sequencingProcess;
12028
+ adlNav;
12029
+ eventCallback;
12030
+ navigationLookAhead;
12031
+ getEffectiveHideLmsUiCallback = null;
11913
12032
  constructor(activityTree, sequencingProcess, adlNav = null, eventCallback = null) {
11914
- this.getEffectiveHideLmsUiCallback = null;
11915
12033
  this.activityTree = activityTree;
11916
12034
  this.sequencingProcess = sequencingProcess;
11917
12035
  this.adlNav = adlNav;
@@ -12596,9 +12714,9 @@ class NavigationValidityService {
12596
12714
  }
12597
12715
 
12598
12716
  class GlobalObjectiveService {
12717
+ globalObjectiveMap = /* @__PURE__ */ new Map();
12718
+ eventCallback = null;
12599
12719
  constructor(eventCallback) {
12600
- this.globalObjectiveMap = /* @__PURE__ */ new Map();
12601
- this.eventCallback = null;
12602
12720
  this.eventCallback = eventCallback || null;
12603
12721
  }
12604
12722
  /**
@@ -12857,11 +12975,16 @@ class GlobalObjectiveService {
12857
12975
  }
12858
12976
 
12859
12977
  class SequencingStateManager {
12978
+ activityTree;
12979
+ globalObjectiveService;
12980
+ rollupProcess;
12981
+ adlNav;
12982
+ eventCallback;
12983
+ getEffectiveHideLmsUiCallback = null;
12984
+ getEffectiveAuxiliaryResourcesCallback = null;
12985
+ contentDeliveredGetter = null;
12986
+ contentDeliveredSetter = null;
12860
12987
  constructor(activityTree, globalObjectiveService, rollupProcess, adlNav = null, eventCallback = null) {
12861
- this.getEffectiveHideLmsUiCallback = null;
12862
- this.getEffectiveAuxiliaryResourcesCallback = null;
12863
- this.contentDeliveredGetter = null;
12864
- this.contentDeliveredSetter = null;
12865
12988
  this.activityTree = activityTree;
12866
12989
  this.globalObjectiveService = globalObjectiveService;
12867
12990
  this.rollupProcess = rollupProcess;
@@ -13228,8 +13351,11 @@ class SequencingStateManager {
13228
13351
  }
13229
13352
 
13230
13353
  class DeliveryValidator {
13354
+ activityTree;
13355
+ eventCallback;
13356
+ now;
13357
+ contentDeliveredGetter = null;
13231
13358
  constructor(activityTree, eventCallback = null, options) {
13232
- this.contentDeliveredGetter = null;
13233
13359
  this.activityTree = activityTree;
13234
13360
  this.eventCallback = eventCallback;
13235
13361
  this.now = options?.now || (() => /* @__PURE__ */ new Date());
@@ -13806,8 +13932,24 @@ class DeliveryValidator {
13806
13932
  }
13807
13933
 
13808
13934
  class OverallSequencingProcess {
13935
+ // Core dependencies
13936
+ activityTree;
13937
+ sequencingProcess;
13938
+ rollupProcess;
13939
+ adlNav;
13940
+ eventCallback = null;
13941
+ // Extracted services
13942
+ terminationHandler;
13943
+ deliveryHandler;
13944
+ navigationValidityService;
13945
+ globalObjectiveService;
13946
+ stateManager;
13947
+ deliveryValidator;
13948
+ navigationLookAhead;
13949
+ // Configuration
13950
+ enhancedDeliveryValidation;
13951
+ is4thEdition;
13809
13952
  constructor(activityTree, sequencingProcess, rollupProcess, adlNav = null, eventCallback = null, options) {
13810
- this.eventCallback = null;
13811
13953
  this.activityTree = activityTree;
13812
13954
  this.sequencingProcess = sequencingProcess;
13813
13955
  this.rollupProcess = rollupProcess;
@@ -14277,14 +14419,22 @@ class OverallSequencingProcess {
14277
14419
  }
14278
14420
 
14279
14421
  class SequencingService {
14422
+ sequencing;
14423
+ cmi;
14424
+ adl;
14425
+ eventService;
14426
+ loggingService;
14427
+ activityDeliveryService;
14428
+ rollupProcess;
14429
+ overallSequencingProcess = null;
14430
+ sequencingProcess = null;
14431
+ eventListeners = {};
14432
+ configuration;
14433
+ isInitialized = false;
14434
+ isSequencingActive = false;
14435
+ lastCMIValues = /* @__PURE__ */ new Map();
14436
+ lastSequencingResult = null;
14280
14437
  constructor(sequencing, cmi, adl, eventService, loggingService, configuration = {}) {
14281
- this.overallSequencingProcess = null;
14282
- this.sequencingProcess = null;
14283
- this.eventListeners = {};
14284
- this.isInitialized = false;
14285
- this.isSequencingActive = false;
14286
- this.lastCMIValues = /* @__PURE__ */ new Map();
14287
- this.lastSequencingResult = null;
14288
14438
  this.sequencing = sequencing;
14289
14439
  this.cmi = cmi;
14290
14440
  this.adl = adl;
@@ -15188,6 +15338,8 @@ class SerializationService {
15188
15338
  }
15189
15339
 
15190
15340
  class SynchronousHttpService {
15341
+ settings;
15342
+ error_codes;
15191
15343
  /**
15192
15344
  * Constructor for SynchronousHttpService
15193
15345
  * @param {InternalSettings} settings - The settings object
@@ -15390,6 +15542,17 @@ class ValidationService {
15390
15542
  const validationService = new ValidationService();
15391
15543
 
15392
15544
  class BaseAPI {
15545
+ _timeout;
15546
+ _error_codes;
15547
+ _settings = DefaultSettings;
15548
+ _httpService;
15549
+ _eventService;
15550
+ _serializationService;
15551
+ _errorHandlingService;
15552
+ _loggingService;
15553
+ _offlineStorageService;
15554
+ _cmiValueAccessService;
15555
+ _courseId = "";
15393
15556
  /**
15394
15557
  * Constructor for Base API class. Sets some shared API fields, as well as
15395
15558
  * sets up options for the API.
@@ -15404,8 +15567,6 @@ class BaseAPI {
15404
15567
  * @param {IOfflineStorageService} offlineStorageService - Optional Offline Storage service instance
15405
15568
  */
15406
15569
  constructor(error_codes, settings, httpService, eventService, serializationService, cmiDataService, errorHandlingService, loggingService, offlineStorageService) {
15407
- this._settings = DefaultSettings;
15408
- this._courseId = "";
15409
15570
  if (new.target === BaseAPI) {
15410
15571
  throw new TypeError("Cannot construct BaseAPI instances directly");
15411
15572
  }
@@ -15532,6 +15693,8 @@ class BaseAPI {
15532
15693
  };
15533
15694
  this._cmiValueAccessService = new CMIValueAccessService(cmiValueAccessContext);
15534
15695
  }
15696
+ startingData;
15697
+ currentState;
15535
15698
  /**
15536
15699
  * Get the last error code
15537
15700
  * @return {string}
@@ -16444,6 +16607,21 @@ class BaseAPI {
16444
16607
  }
16445
16608
 
16446
16609
  class CMIScore extends BaseCMI {
16610
+ __children;
16611
+ /**
16612
+ * Score range validation pattern (e.g., "0#100" for SCORM 1.2).
16613
+ * Set to `false` to disable range validation (e.g., for SCORM 2004 where scores have no upper bound).
16614
+ * This property is intentionally unused in the base class but provides subclass flexibility.
16615
+ */
16616
+ __score_range;
16617
+ __invalid_error_code;
16618
+ __invalid_type_code;
16619
+ __invalid_range_code;
16620
+ __decimal_regex;
16621
+ __error_class;
16622
+ _raw = "";
16623
+ _min = "";
16624
+ _max;
16447
16625
  /**
16448
16626
  * Constructor for *.score
16449
16627
  *
@@ -16467,8 +16645,6 @@ class CMIScore extends BaseCMI {
16467
16645
  */
16468
16646
  constructor(params) {
16469
16647
  super(params.CMIElement);
16470
- this._raw = "";
16471
- this._min = "";
16472
16648
  this.__children = params.score_children || scorm12_constants.score_children;
16473
16649
  this.__score_range = !params.score_range ? false : scorm12_regex.score_range;
16474
16650
  this._max = params.max || params.max === "" ? params.max : "100";
@@ -16621,18 +16797,6 @@ class CMICore extends BaseCMI {
16621
16797
  */
16622
16798
  constructor() {
16623
16799
  super("cmi.core");
16624
- this.__children = scorm12_constants.core_children;
16625
- this._student_id = "";
16626
- this._student_name = "";
16627
- this._lesson_location = "";
16628
- this._credit = "";
16629
- this._lesson_status = "not attempted";
16630
- this._entry = "";
16631
- this._total_time = "";
16632
- this._lesson_mode = "normal";
16633
- this._exit = "";
16634
- this._session_time = "00:00:00";
16635
- this._suspend_data = "";
16636
16800
  this.score = new CMIScore({
16637
16801
  CMIElement: "cmi.core.score",
16638
16802
  score_children: scorm12_constants.score_children,
@@ -16643,6 +16807,7 @@ class CMICore extends BaseCMI {
16643
16807
  errorClass: Scorm12ValidationError
16644
16808
  });
16645
16809
  }
16810
+ score;
16646
16811
  /**
16647
16812
  * Called when the API has been initialized after the CMI has been created
16648
16813
  */
@@ -16650,6 +16815,18 @@ class CMICore extends BaseCMI {
16650
16815
  super.initialize();
16651
16816
  this.score?.initialize();
16652
16817
  }
16818
+ __children = scorm12_constants.core_children;
16819
+ _student_id = "";
16820
+ _student_name = "";
16821
+ _lesson_location = "";
16822
+ _credit = "";
16823
+ _lesson_status = "not attempted";
16824
+ _entry = "";
16825
+ _total_time = "";
16826
+ _lesson_mode = "normal";
16827
+ _exit = "";
16828
+ _session_time = "00:00:00";
16829
+ _suspend_data = "";
16653
16830
  /**
16654
16831
  * Called when the API has been reset
16655
16832
  */
@@ -17050,8 +17227,6 @@ let CMIObjectivesObject$1 = class CMIObjectivesObject extends BaseCMI {
17050
17227
  */
17051
17228
  constructor() {
17052
17229
  super("cmi.objectives.n");
17053
- this._id = "";
17054
- this._status = "";
17055
17230
  this.score = new CMIScore({
17056
17231
  CMIElement: "cmi.objectives.n.score",
17057
17232
  score_children: scorm12_constants.score_children,
@@ -17062,6 +17237,9 @@ let CMIObjectivesObject$1 = class CMIObjectivesObject extends BaseCMI {
17062
17237
  errorClass: Scorm12ValidationError
17063
17238
  });
17064
17239
  }
17240
+ score;
17241
+ _id = "";
17242
+ _status = "";
17065
17243
  /**
17066
17244
  * Called when the API has been reset
17067
17245
  */
@@ -17153,15 +17331,16 @@ function parseTimeAllowed(value, fieldName) {
17153
17331
  throw new Scorm12ValidationError(fieldName, scorm12_errors.TYPE_MISMATCH);
17154
17332
  }
17155
17333
  class CMIStudentData extends BaseCMI {
17334
+ __children;
17335
+ _mastery_score = "";
17336
+ _max_time_allowed = "";
17337
+ _time_limit_action = "";
17156
17338
  /**
17157
17339
  * Constructor for cmi.student_data
17158
17340
  * @param {string} student_data_children
17159
17341
  */
17160
17342
  constructor(student_data_children) {
17161
17343
  super("cmi.student_data");
17162
- this._mastery_score = "";
17163
- this._max_time_allowed = "";
17164
- this._time_limit_action = "";
17165
17344
  this.__children = student_data_children ? student_data_children : scorm12_constants.student_data_children;
17166
17345
  }
17167
17346
  /**
@@ -17301,18 +17480,19 @@ class CMIStudentData extends BaseCMI {
17301
17480
  }
17302
17481
 
17303
17482
  class CMIStudentPreference extends BaseCMI {
17483
+ __children;
17304
17484
  /**
17305
17485
  * Constructor for cmi.student_preference
17306
17486
  * @param {string} student_preference_children
17307
17487
  */
17308
17488
  constructor(student_preference_children) {
17309
17489
  super("cmi.student_preference");
17310
- this._audio = "";
17311
- this._language = "";
17312
- this._speed = "";
17313
- this._text = "";
17314
17490
  this.__children = student_preference_children ? student_preference_children : scorm12_constants.student_preference_children;
17315
17491
  }
17492
+ _audio = "";
17493
+ _language = "";
17494
+ _speed = "";
17495
+ _text = "";
17316
17496
  /**
17317
17497
  * Called when the API has been reset
17318
17498
  */
@@ -17454,13 +17634,6 @@ let CMIInteractionsObject$1 = class CMIInteractionsObject extends BaseCMI {
17454
17634
  */
17455
17635
  constructor() {
17456
17636
  super("cmi.interactions.n");
17457
- this._id = "";
17458
- this._time = "";
17459
- this._type = "";
17460
- this._weighting = "";
17461
- this._student_response = "";
17462
- this._result = "";
17463
- this._latency = "";
17464
17637
  this.objectives = new CMIArray({
17465
17638
  CMIElement: "cmi.interactions.n.objectives",
17466
17639
  errorCode: scorm12_errors.INVALID_SET_VALUE,
@@ -17474,6 +17647,8 @@ let CMIInteractionsObject$1 = class CMIInteractionsObject extends BaseCMI {
17474
17647
  children: scorm12_constants.correct_responses_children
17475
17648
  });
17476
17649
  }
17650
+ objectives;
17651
+ correct_responses;
17477
17652
  /**
17478
17653
  * Called when the API has been initialized after the CMI has been created
17479
17654
  */
@@ -17482,6 +17657,13 @@ let CMIInteractionsObject$1 = class CMIInteractionsObject extends BaseCMI {
17482
17657
  this.objectives?.initialize();
17483
17658
  this.correct_responses?.initialize();
17484
17659
  }
17660
+ _id = "";
17661
+ _time = "";
17662
+ _type = "";
17663
+ _weighting = "";
17664
+ _student_response = "";
17665
+ _result = "";
17666
+ _latency = "";
17485
17667
  /**
17486
17668
  * Called when the API has been reset
17487
17669
  */
@@ -17711,8 +17893,8 @@ let CMIInteractionsObjectivesObject$1 = class CMIInteractionsObjectivesObject ex
17711
17893
  */
17712
17894
  constructor() {
17713
17895
  super("cmi.interactions.n.objectives.n");
17714
- this._id = "";
17715
17896
  }
17897
+ _id = "";
17716
17898
  /**
17717
17899
  * Called when the API has been reset
17718
17900
  */
@@ -17765,8 +17947,8 @@ let CMIInteractionsCorrectResponsesObject$1 = class CMIInteractionsCorrectRespon
17765
17947
  */
17766
17948
  constructor() {
17767
17949
  super("cmi.interactions.correct_responses.n");
17768
- this._pattern = "";
17769
17950
  }
17951
+ _pattern = "";
17770
17952
  /**
17771
17953
  * Called when the API has been reset
17772
17954
  */
@@ -17815,6 +17997,11 @@ let CMIInteractionsCorrectResponsesObject$1 = class CMIInteractionsCorrectRespon
17815
17997
  };
17816
17998
 
17817
17999
  let CMI$1 = class CMI extends BaseRootCMI {
18000
+ __children = "";
18001
+ __version = "3.4";
18002
+ _launch_data = "";
18003
+ _comments = "";
18004
+ _comments_from_lms = "";
17818
18005
  /**
17819
18006
  * Constructor for the SCORM 1.2 cmi object
17820
18007
  * @param {string} cmi_children
@@ -17823,11 +18010,6 @@ let CMI$1 = class CMI extends BaseRootCMI {
17823
18010
  */
17824
18011
  constructor(cmi_children, student_data, initialized) {
17825
18012
  super("cmi");
17826
- this.__children = "";
17827
- this.__version = "3.4";
17828
- this._launch_data = "";
17829
- this._comments = "";
17830
- this._comments_from_lms = "";
17831
18013
  if (initialized) this.initialize();
17832
18014
  this.__children = cmi_children ? cmi_children : scorm12_constants.cmi_children;
17833
18015
  this.core = new CMICore();
@@ -17836,6 +18018,11 @@ let CMI$1 = class CMI extends BaseRootCMI {
17836
18018
  this.student_preference = new CMIStudentPreference();
17837
18019
  this.interactions = new CMIInteractions$1();
17838
18020
  }
18021
+ core;
18022
+ objectives;
18023
+ student_data;
18024
+ student_preference;
18025
+ interactions;
17839
18026
  /**
17840
18027
  * Called when the API has been reset
17841
18028
  *
@@ -18040,7 +18227,6 @@ class NAV extends BaseCMI {
18040
18227
  */
18041
18228
  constructor() {
18042
18229
  super("cmi.nav");
18043
- this._event = "";
18044
18230
  }
18045
18231
  /**
18046
18232
  * Called when the API has been reset
@@ -18057,6 +18243,7 @@ class NAV extends BaseCMI {
18057
18243
  this._event = "";
18058
18244
  this._initialized = false;
18059
18245
  }
18246
+ _event = "";
18060
18247
  /**
18061
18248
  * Getter for _event
18062
18249
  * @return {string}
@@ -18092,6 +18279,19 @@ class NAV extends BaseCMI {
18092
18279
  }
18093
18280
 
18094
18281
  class Scorm12API extends BaseAPI {
18282
+ /**
18283
+ * Static global storage for learner preferences
18284
+ * When globalStudentPreferences is enabled, preferences persist across SCO instances
18285
+ * @private
18286
+ */
18287
+ static _globalLearnerPrefs = null;
18288
+ /**
18289
+ * Clear the global learner preferences storage
18290
+ * @public
18291
+ */
18292
+ static clearGlobalPreferences() {
18293
+ Scorm12API._globalLearnerPrefs = null;
18294
+ }
18095
18295
  /**
18096
18296
  * Constructor for SCORM 1.2 API
18097
18297
  * @param {object} settings
@@ -18105,7 +18305,6 @@ class Scorm12API extends BaseAPI {
18105
18305
  }
18106
18306
  }
18107
18307
  super(scorm12_errors, settingsCopy, httpService);
18108
- this.statusSetByModule = false;
18109
18308
  this.cmi = new CMI$1();
18110
18309
  this.nav = new NAV();
18111
18310
  if (this.settings.globalStudentPreferences && Scorm12API._globalLearnerPrefs) {
@@ -18131,21 +18330,17 @@ class Scorm12API extends BaseAPI {
18131
18330
  this.LMSGetErrorString = this.lmsGetErrorString;
18132
18331
  this.LMSGetDiagnostic = this.lmsGetDiagnostic;
18133
18332
  }
18134
- static {
18135
- /**
18136
- * Static global storage for learner preferences
18137
- * When globalStudentPreferences is enabled, preferences persist across SCO instances
18138
- * @private
18139
- */
18140
- this._globalLearnerPrefs = null;
18141
- }
18142
- /**
18143
- * Clear the global learner preferences storage
18144
- * @public
18145
- */
18146
- static clearGlobalPreferences() {
18147
- Scorm12API._globalLearnerPrefs = null;
18148
- }
18333
+ statusSetByModule = false;
18334
+ cmi;
18335
+ nav;
18336
+ LMSInitialize;
18337
+ LMSFinish;
18338
+ LMSGetValue;
18339
+ LMSSetValue;
18340
+ LMSCommit;
18341
+ LMSGetLastError;
18342
+ LMSGetErrorString;
18343
+ LMSGetDiagnostic;
18149
18344
  /**
18150
18345
  * Called when the API needs to be reset
18151
18346
  */
@@ -18341,7 +18536,7 @@ class Scorm12API extends BaseAPI {
18341
18536
  */
18342
18537
  setCMIValue(CMIElement, value) {
18343
18538
  const result = this._commonSetCMIValue("LMSSetValue", false, CMIElement, value);
18344
- if (this.settings.globalStudentPreferences) {
18539
+ if (result === global_constants.SCORM_TRUE && this.settings.globalStudentPreferences) {
18345
18540
  if (CMIElement === "cmi.student_preference.audio") {
18346
18541
  this._updateGlobalPreference("audio", value);
18347
18542
  } else if (CMIElement === "cmi.student_preference.language") {
@@ -18444,7 +18639,7 @@ class Scorm12API extends BaseAPI {
18444
18639
  const flattened = flatten(cmiExport);
18445
18640
  switch (this.settings.dataCommitFormat) {
18446
18641
  case "flattened":
18447
- return flatten(cmiExport);
18642
+ return flattened;
18448
18643
  case "params":
18449
18644
  for (const item in flattened) {
18450
18645
  if ({}.hasOwnProperty.call(flattened, item)) {
@@ -18563,16 +18758,16 @@ class Scorm12API extends BaseAPI {
18563
18758
  }
18564
18759
 
18565
18760
  class CMILearnerPreference extends BaseCMI {
18761
+ __children = scorm2004_constants.student_preference_children;
18762
+ _audio_level = "1";
18763
+ _language = "";
18764
+ _delivery_speed = "1";
18765
+ _audio_captioning = "0";
18566
18766
  /**
18567
18767
  * Constructor for cmi.learner_preference
18568
18768
  */
18569
18769
  constructor() {
18570
18770
  super("cmi.learner_preference");
18571
- this.__children = scorm2004_constants.student_preference_children;
18572
- this._audio_level = "1";
18573
- this._language = "";
18574
- this._delivery_speed = "1";
18575
- this._audio_captioning = "0";
18576
18771
  }
18577
18772
  /**
18578
18773
  * Called when the API has been reset
@@ -18736,20 +18931,20 @@ class CMIInteractions extends CMIArray {
18736
18931
  }
18737
18932
  }
18738
18933
  class CMIInteractionsObject extends BaseCMI {
18934
+ _id = "";
18935
+ _idIsSet = false;
18936
+ _type = "";
18937
+ _timestamp = "";
18938
+ _weighting = "";
18939
+ _learner_response = "";
18940
+ _result = "";
18941
+ _latency = "";
18942
+ _description = "";
18739
18943
  /**
18740
18944
  * Constructor for cmi.interaction.n
18741
18945
  */
18742
18946
  constructor() {
18743
18947
  super("cmi.interactions.n");
18744
- this._id = "";
18745
- this._idIsSet = false;
18746
- this._type = "";
18747
- this._timestamp = "";
18748
- this._weighting = "";
18749
- this._learner_response = "";
18750
- this._result = "";
18751
- this._latency = "";
18752
- this._description = "";
18753
18948
  this.objectives = new CMIArray({
18754
18949
  CMIElement: "cmi.interactions.n.objectives",
18755
18950
  errorCode: scorm2004_errors.READ_ONLY_ELEMENT,
@@ -18763,6 +18958,8 @@ class CMIInteractionsObject extends BaseCMI {
18763
18958
  children: scorm2004_constants.correct_responses_children
18764
18959
  });
18765
18960
  }
18961
+ objectives;
18962
+ correct_responses;
18766
18963
  /**
18767
18964
  * Called when the API has been initialized after the CMI has been created
18768
18965
  */
@@ -19102,12 +19299,12 @@ class CMIInteractionsObject extends BaseCMI {
19102
19299
  }
19103
19300
  }
19104
19301
  class CMIInteractionsObjectivesObject extends BaseCMI {
19302
+ _id = "";
19105
19303
  /**
19106
19304
  * Constructor for cmi.interactions.n.objectives.n
19107
19305
  */
19108
19306
  constructor() {
19109
19307
  super("cmi.interactions.n.objectives.n");
19110
- this._id = "";
19111
19308
  }
19112
19309
  /**
19113
19310
  * Called when the API has been reset
@@ -19322,13 +19519,14 @@ function validatePattern(type, pattern, responseDef) {
19322
19519
  }
19323
19520
  }
19324
19521
  class CMIInteractionsCorrectResponsesObject extends BaseCMI {
19522
+ _pattern = "";
19523
+ _interactionType;
19325
19524
  /**
19326
19525
  * Constructor for cmi.interactions.n.correct_responses.n
19327
19526
  * @param interactionType The type of interaction (e.g. "numeric", "choice", etc.)
19328
19527
  */
19329
19528
  constructor(interactionType) {
19330
19529
  super("cmi.interactions.n.correct_responses.n");
19331
- this._pattern = "";
19332
19530
  this._interactionType = interactionType;
19333
19531
  }
19334
19532
  reset() {
@@ -19365,6 +19563,7 @@ class CMIInteractionsCorrectResponsesObject extends BaseCMI {
19365
19563
  }
19366
19564
 
19367
19565
  class Scorm2004CMIScore extends CMIScore {
19566
+ _scaled = "";
19368
19567
  /**
19369
19568
  * Constructor for cmi *.score
19370
19569
  */
@@ -19379,7 +19578,6 @@ class Scorm2004CMIScore extends CMIScore {
19379
19578
  decimalRegex: scorm2004_regex.CMIDecimal,
19380
19579
  errorClass: Scorm2004ValidationError
19381
19580
  });
19382
- this._scaled = "";
19383
19581
  }
19384
19582
  /**
19385
19583
  * Called when the API has been reset
@@ -19466,6 +19664,10 @@ class CMICommentsFromLearner extends CMIArray {
19466
19664
  }
19467
19665
  }
19468
19666
  class CMICommentsObject extends BaseCMI {
19667
+ _comment = "";
19668
+ _location = "";
19669
+ _timestamp = "";
19670
+ _readOnlyAfterInit;
19469
19671
  /**
19470
19672
  * Constructor for cmi.comments_from_learner.n and cmi.comments_from_lms.n
19471
19673
  * @param {boolean} readOnlyAfterInit
@@ -19475,9 +19677,6 @@ class CMICommentsObject extends BaseCMI {
19475
19677
  this._comment = "";
19476
19678
  this._location = "";
19477
19679
  this._timestamp = "";
19478
- this._comment = "";
19479
- this._location = "";
19480
- this._timestamp = "";
19481
19680
  this._readOnlyAfterInit = readOnlyAfterInit;
19482
19681
  }
19483
19682
  /**
@@ -19620,17 +19819,17 @@ class CMIObjectives extends CMIArray {
19620
19819
  }
19621
19820
  }
19622
19821
  class CMIObjectivesObject extends BaseCMI {
19822
+ _id = "";
19823
+ _idIsSet = false;
19824
+ _success_status = "unknown";
19825
+ _completion_status = "unknown";
19826
+ _progress_measure = "";
19827
+ _description = "";
19623
19828
  /**
19624
19829
  * Constructor for cmi.objectives.n
19625
19830
  */
19626
19831
  constructor() {
19627
19832
  super("cmi.objectives.n");
19628
- this._id = "";
19629
- this._idIsSet = false;
19630
- this._success_status = "unknown";
19631
- this._completion_status = "unknown";
19632
- this._progress_measure = "";
19633
- this._description = "";
19634
19833
  this.score = new Scorm2004CMIScore();
19635
19834
  }
19636
19835
  reset() {
@@ -19643,6 +19842,7 @@ class CMIObjectivesObject extends BaseCMI {
19643
19842
  this._description = "";
19644
19843
  this.score?.reset();
19645
19844
  }
19845
+ score;
19646
19846
  /**
19647
19847
  * Called when the API has been initialized after the CMI has been created
19648
19848
  */
@@ -19842,13 +20042,13 @@ class CMIObjectivesObject extends BaseCMI {
19842
20042
  }
19843
20043
 
19844
20044
  class CMIMetadata extends BaseCMI {
20045
+ __version = "1.0";
20046
+ __children = scorm2004_constants.cmi_children;
19845
20047
  /**
19846
20048
  * Constructor for CMIMetadata
19847
20049
  */
19848
20050
  constructor() {
19849
20051
  super("cmi");
19850
- this.__version = "1.0";
19851
- this.__children = scorm2004_constants.cmi_children;
19852
20052
  }
19853
20053
  /**
19854
20054
  * Getter for __version
@@ -19893,13 +20093,13 @@ class CMIMetadata extends BaseCMI {
19893
20093
  }
19894
20094
 
19895
20095
  class CMILearner extends BaseCMI {
20096
+ _learner_id = "";
20097
+ _learner_name = "";
19896
20098
  /**
19897
20099
  * Constructor for CMILearner
19898
20100
  */
19899
20101
  constructor() {
19900
20102
  super("cmi");
19901
- this._learner_id = "";
19902
- this._learner_name = "";
19903
20103
  }
19904
20104
  /**
19905
20105
  * Getter for _learner_id
@@ -19952,14 +20152,14 @@ class CMILearner extends BaseCMI {
19952
20152
  }
19953
20153
 
19954
20154
  class CMIStatus extends BaseCMI {
20155
+ _completion_status = "unknown";
20156
+ _success_status = "unknown";
20157
+ _progress_measure = "";
19955
20158
  /**
19956
20159
  * Constructor for CMIStatus
19957
20160
  */
19958
20161
  constructor() {
19959
20162
  super("cmi");
19960
- this._completion_status = "unknown";
19961
- this._success_status = "unknown";
19962
- this._progress_measure = "";
19963
20163
  }
19964
20164
  /**
19965
20165
  * Getter for _completion_status
@@ -20037,15 +20237,15 @@ class CMIStatus extends BaseCMI {
20037
20237
  }
20038
20238
 
20039
20239
  class CMISession extends BaseCMI {
20240
+ _entry = "";
20241
+ _exit = "";
20242
+ _session_time = "PT0H0M0S";
20243
+ _total_time = "PT0S";
20040
20244
  /**
20041
20245
  * Constructor for CMISession
20042
20246
  */
20043
20247
  constructor() {
20044
20248
  super("cmi");
20045
- this._entry = "";
20046
- this._exit = "";
20047
- this._session_time = "PT0H0M0S";
20048
- this._total_time = "PT0S";
20049
20249
  }
20050
20250
  /**
20051
20251
  * Getter for _entry
@@ -20183,14 +20383,14 @@ class CMISession extends BaseCMI {
20183
20383
  }
20184
20384
 
20185
20385
  class CMIContent extends BaseCMI {
20386
+ _location = "";
20387
+ _launch_data = "";
20388
+ _suspend_data = "";
20186
20389
  /**
20187
20390
  * Constructor for CMIContent
20188
20391
  */
20189
20392
  constructor() {
20190
20393
  super("cmi");
20191
- this._location = "";
20192
- this._launch_data = "";
20193
- this._suspend_data = "";
20194
20394
  }
20195
20395
  /**
20196
20396
  * Getter for _location
@@ -20261,15 +20461,15 @@ class CMIContent extends BaseCMI {
20261
20461
  }
20262
20462
 
20263
20463
  class CMISettings extends BaseCMI {
20464
+ _credit = "credit";
20465
+ _mode = "normal";
20466
+ _time_limit_action = "continue,no message";
20467
+ _max_time_allowed = "";
20264
20468
  /**
20265
20469
  * Constructor for CMISettings
20266
20470
  */
20267
20471
  constructor() {
20268
20472
  super("cmi");
20269
- this._credit = "credit";
20270
- this._mode = "normal";
20271
- this._time_limit_action = "continue,no message";
20272
- this._max_time_allowed = "";
20273
20473
  }
20274
20474
  /**
20275
20475
  * Getter for _credit
@@ -20389,13 +20589,13 @@ class CMISettings extends BaseCMI {
20389
20589
  }
20390
20590
 
20391
20591
  class CMIThresholds extends BaseCMI {
20592
+ _scaled_passing_score = "";
20593
+ _completion_threshold = "";
20392
20594
  /**
20393
20595
  * Constructor for CMIThresholds
20394
20596
  */
20395
20597
  constructor() {
20396
20598
  super("cmi");
20397
- this._scaled_passing_score = "";
20398
- this._completion_threshold = "";
20399
20599
  }
20400
20600
  /**
20401
20601
  * Getter for _scaled_passing_score
@@ -20503,6 +20703,21 @@ class CMI extends BaseRootCMI {
20503
20703
  this.objectives = new CMIObjectives();
20504
20704
  if (initialized) this.initialize();
20505
20705
  }
20706
+ // New component classes
20707
+ metadata;
20708
+ learner;
20709
+ status;
20710
+ session;
20711
+ content;
20712
+ settings;
20713
+ thresholds;
20714
+ // Original complex objects
20715
+ learner_preference;
20716
+ score;
20717
+ comments_from_learner;
20718
+ comments_from_lms;
20719
+ interactions;
20720
+ objectives;
20506
20721
  /**
20507
20722
  * Called when the API has been initialized after the CMI has been created
20508
20723
  */
@@ -20947,11 +21162,12 @@ class ADL extends BaseCMI {
20947
21162
  */
20948
21163
  constructor() {
20949
21164
  super("adl");
20950
- this.data = new ADLData();
20951
- this._sequencing = null;
20952
21165
  this.nav = new ADLNav();
20953
21166
  this.data = new ADLData();
20954
21167
  }
21168
+ nav;
21169
+ data = new ADLData();
21170
+ _sequencing = null;
20955
21171
  /**
20956
21172
  * Called when the API has been initialized after the CMI has been created
20957
21173
  */
@@ -21004,16 +21220,17 @@ class ADL extends BaseCMI {
21004
21220
  }
21005
21221
  }
21006
21222
  class ADLNav extends BaseCMI {
21223
+ _request = "_none_";
21224
+ _sequencing = null;
21007
21225
  /**
21008
21226
  * Constructor for `adl.nav`
21009
21227
  */
21010
21228
  constructor() {
21011
21229
  super("adl.nav");
21012
- this._request = "_none_";
21013
- this._sequencing = null;
21014
21230
  this.request_valid = new ADLNavRequestValid();
21015
21231
  this.request_valid.setParentNav(this);
21016
21232
  }
21233
+ request_valid;
21017
21234
  /**
21018
21235
  * Getter for sequencing
21019
21236
  * @return {Sequencing | null}
@@ -21092,12 +21309,12 @@ class ADLData extends CMIArray {
21092
21309
  }
21093
21310
  }
21094
21311
  class ADLDataObject extends BaseCMI {
21312
+ _id = "";
21313
+ _store = "";
21314
+ _idIsSet = false;
21315
+ _storeIsSet = false;
21095
21316
  constructor() {
21096
21317
  super("adl.data.n");
21097
- this._id = "";
21098
- this._store = "";
21099
- this._idIsSet = false;
21100
- this._storeIsSet = false;
21101
21318
  }
21102
21319
  /**
21103
21320
  * Called when the API has been reset
@@ -21184,10 +21401,8 @@ class ADLDataObject extends BaseCMI {
21184
21401
  }
21185
21402
  }
21186
21403
  class ADLNavRequestValidChoice {
21187
- constructor() {
21188
- this._parentNav = null;
21189
- this._staticValues = {};
21190
- }
21404
+ _parentNav = null;
21405
+ _staticValues = {};
21191
21406
  setParentNav(nav) {
21192
21407
  this._parentNav = nav;
21193
21408
  }
@@ -21226,10 +21441,8 @@ class ADLNavRequestValidChoice {
21226
21441
  }
21227
21442
  }
21228
21443
  class ADLNavRequestValidJump {
21229
- constructor() {
21230
- this._parentNav = null;
21231
- this._staticValues = {};
21232
- }
21444
+ _parentNav = null;
21445
+ _staticValues = {};
21233
21446
  setParentNav(nav) {
21234
21447
  this._parentNav = nav;
21235
21448
  }
@@ -21261,19 +21474,21 @@ class ADLNavRequestValidJump {
21261
21474
  }
21262
21475
  }
21263
21476
  class ADLNavRequestValid extends BaseCMI {
21477
+ _continue = "unknown";
21478
+ _previous = "unknown";
21479
+ _choice;
21480
+ _jump;
21481
+ _exit = "unknown";
21482
+ _exitAll = "unknown";
21483
+ _abandon = "unknown";
21484
+ _abandonAll = "unknown";
21485
+ _suspendAll = "unknown";
21486
+ _parentNav = null;
21264
21487
  /**
21265
21488
  * Constructor for adl.nav.request_valid
21266
21489
  */
21267
21490
  constructor() {
21268
21491
  super("adl.nav.request_valid");
21269
- this._continue = "unknown";
21270
- this._previous = "unknown";
21271
- this._exit = "unknown";
21272
- this._exitAll = "unknown";
21273
- this._abandon = "unknown";
21274
- this._abandonAll = "unknown";
21275
- this._suspendAll = "unknown";
21276
- this._parentNav = null;
21277
21492
  this._choice = new ADLNavRequestValidChoice();
21278
21493
  this._jump = new ADLNavRequestValidJump();
21279
21494
  }
@@ -21595,15 +21810,15 @@ class ADLNavRequestValid extends BaseCMI {
21595
21810
  }
21596
21811
 
21597
21812
  class ActivityTree extends BaseCMI {
21813
+ _root = null;
21814
+ _currentActivity = null;
21815
+ _suspendedActivity = null;
21816
+ _activities = /* @__PURE__ */ new Map();
21598
21817
  /**
21599
21818
  * Constructor for ActivityTree
21600
21819
  */
21601
21820
  constructor(root) {
21602
21821
  super("activityTree");
21603
- this._root = null;
21604
- this._currentActivity = null;
21605
- this._suspendedActivity = null;
21606
- this._activities = /* @__PURE__ */ new Map();
21607
21822
  if (root) {
21608
21823
  this.root = root;
21609
21824
  }
@@ -21925,15 +22140,19 @@ class ActivityTree extends BaseCMI {
21925
22140
  }
21926
22141
 
21927
22142
  class Sequencing extends BaseCMI {
22143
+ _activityTree;
22144
+ _sequencingRules;
22145
+ _sequencingControls;
22146
+ _rollupRules;
22147
+ _adlNav = null;
22148
+ _hideLmsUi = [];
22149
+ _auxiliaryResources = [];
22150
+ _overallSequencingProcess = null;
21928
22151
  /**
21929
22152
  * Constructor for Sequencing
21930
22153
  */
21931
22154
  constructor() {
21932
22155
  super("sequencing");
21933
- this._adlNav = null;
21934
- this._hideLmsUi = [];
21935
- this._auxiliaryResources = [];
21936
- this._overallSequencingProcess = null;
21937
22156
  this._activityTree = new ActivityTree();
21938
22157
  this._sequencingRules = new SequencingRules();
21939
22158
  this._sequencingControls = new SequencingControls();
@@ -22135,6 +22354,7 @@ class Sequencing extends BaseCMI {
22135
22354
  }
22136
22355
 
22137
22356
  class Scorm2004ResponseValidator {
22357
+ context;
22138
22358
  constructor(context) {
22139
22359
  this.context = context;
22140
22360
  }
@@ -22341,7 +22561,7 @@ class Scorm2004ResponseValidator {
22341
22561
  let seenLang = false;
22342
22562
  const prefixRegex = new RegExp("^({(lang|case_matters|order_matters)=([^}]+)})");
22343
22563
  let matches = node.match(prefixRegex);
22344
- let langMatches = null;
22564
+ let langMatches;
22345
22565
  while (matches) {
22346
22566
  switch (matches[2]) {
22347
22567
  case "lang":
@@ -22381,6 +22601,8 @@ class Scorm2004ResponseValidator {
22381
22601
  }
22382
22602
 
22383
22603
  class Scorm2004CMIHandler {
22604
+ context;
22605
+ responseValidator;
22384
22606
  constructor(context, responseValidator) {
22385
22607
  this.context = context;
22386
22608
  this.responseValidator = responseValidator;
@@ -23044,6 +23266,8 @@ class SequencingConfigurationBuilder {
23044
23266
  }
23045
23267
 
23046
23268
  class ActivityTreeBuilder {
23269
+ sequencingCollections;
23270
+ sequencingConfigBuilder;
23047
23271
  constructor(collections, sequencingConfigBuilder) {
23048
23272
  this.sequencingCollections = collections || {};
23049
23273
  this.sequencingConfigBuilder = sequencingConfigBuilder || new SequencingConfigurationBuilder();
@@ -23243,8 +23467,9 @@ class ActivityTreeBuilder {
23243
23467
  }
23244
23468
 
23245
23469
  class GlobalObjectiveManager {
23470
+ _globalObjectives = [];
23471
+ context;
23246
23472
  constructor(context) {
23247
- this._globalObjectives = [];
23248
23473
  this.context = context;
23249
23474
  }
23250
23475
  /**
@@ -23672,6 +23897,8 @@ class GlobalObjectiveManager {
23672
23897
  }
23673
23898
 
23674
23899
  class SequencingStatePersistence {
23900
+ context;
23901
+ globalObjectiveManager;
23675
23902
  constructor(context, globalObjectiveManager) {
23676
23903
  this.context = context;
23677
23904
  this.globalObjectiveManager = globalObjectiveManager;
@@ -23923,6 +24150,8 @@ class SequencingStatePersistence {
23923
24150
  }
23924
24151
 
23925
24152
  class Scorm2004DataSerializer {
24153
+ context;
24154
+ globalObjectiveManager;
23926
24155
  constructor(context, globalObjectiveManager) {
23927
24156
  this.context = context;
23928
24157
  this.globalObjectiveManager = globalObjectiveManager || null;
@@ -24073,6 +24302,19 @@ class Scorm2004DataSerializer {
24073
24302
  }
24074
24303
 
24075
24304
  class Scorm2004API extends BaseAPI {
24305
+ _version = "1.0";
24306
+ _sequencing;
24307
+ _sequencingService = null;
24308
+ _extractedScoItemIds = [];
24309
+ _sequencingCollections = {};
24310
+ // Extracted class instances
24311
+ _responseValidator;
24312
+ _cmiHandler;
24313
+ _activityTreeBuilder;
24314
+ _sequencingConfigBuilder;
24315
+ _globalObjectiveManager;
24316
+ _statePersistence = null;
24317
+ _dataSerializer;
24076
24318
  /**
24077
24319
  * Constructor for SCORM 2004 API
24078
24320
  * @param {Settings} settings
@@ -24086,11 +24328,6 @@ class Scorm2004API extends BaseAPI {
24086
24328
  }
24087
24329
  }
24088
24330
  super(scorm2004_errors, settingsCopy, httpService);
24089
- this._version = "1.0";
24090
- this._sequencingService = null;
24091
- this._extractedScoItemIds = [];
24092
- this._sequencingCollections = {};
24093
- this._statePersistence = null;
24094
24331
  this.cmi = new CMI();
24095
24332
  this.adl = new ADL();
24096
24333
  this._sequencing = new Sequencing();
@@ -24146,6 +24383,16 @@ class Scorm2004API extends BaseAPI {
24146
24383
  this.GetErrorString = this.lmsGetErrorString;
24147
24384
  this.GetDiagnostic = this.lmsGetDiagnostic;
24148
24385
  }
24386
+ cmi;
24387
+ adl;
24388
+ Initialize;
24389
+ Terminate;
24390
+ GetValue;
24391
+ SetValue;
24392
+ Commit;
24393
+ GetLastError;
24394
+ GetErrorString;
24395
+ GetDiagnostic;
24149
24396
  /**
24150
24397
  * Called when the API needs to be reset
24151
24398
  *
@@ -24299,6 +24546,11 @@ class Scorm2004API extends BaseAPI {
24299
24546
  processedSequencingRequest = requestToProcess;
24300
24547
  }
24301
24548
  } catch (error) {
24549
+ this.apiLog(
24550
+ "lmsFinish",
24551
+ `Sequencing navigation failed, falling back to event-based navigation: ${error}`,
24552
+ LogLevelEnum.WARN
24553
+ );
24302
24554
  navigationHandled = false;
24303
24555
  }
24304
24556
  }
@@ -24336,6 +24588,14 @@ class Scorm2004API extends BaseAPI {
24336
24588
  * @return {string} The value of the element, or empty string
24337
24589
  */
24338
24590
  lmsGetValue(CMIElement) {
24591
+ if (this.isTerminated()) {
24592
+ this.lastErrorCode = String(scorm2004_errors.RETRIEVE_AFTER_TERM);
24593
+ return "";
24594
+ }
24595
+ if (!this.isInitialized()) {
24596
+ this.lastErrorCode = String(scorm2004_errors.RETRIEVE_BEFORE_INIT);
24597
+ return "";
24598
+ }
24339
24599
  if (CMIElement === "adl.nav.request") {
24340
24600
  this.throwSCORMError(
24341
24601
  CMIElement,
@@ -24368,14 +24628,6 @@ class Scorm2004API extends BaseAPI {
24368
24628
  }
24369
24629
  }
24370
24630
  }
24371
- if (this.isTerminated()) {
24372
- this.lastErrorCode = String(scorm2004_errors.RETRIEVE_AFTER_TERM);
24373
- return "";
24374
- }
24375
- if (!this.isInitialized()) {
24376
- this.lastErrorCode = String(scorm2004_errors.RETRIEVE_BEFORE_INIT);
24377
- return "";
24378
- }
24379
24631
  if (CMIElement === "cmi.completion_status") {
24380
24632
  return this._cmiHandler.evaluateCompletionStatus();
24381
24633
  }
@@ -24392,12 +24644,7 @@ class Scorm2004API extends BaseAPI {
24392
24644
  * @return {string} "true" or "false"
24393
24645
  */
24394
24646
  lmsSetValue(CMIElement, value) {
24395
- let oldValue = null;
24396
- try {
24397
- oldValue = this.getCMIValue(CMIElement);
24398
- } catch (error) {
24399
- oldValue = null;
24400
- }
24647
+ const oldValue = this._peekCMIValue(CMIElement);
24401
24648
  const result = this.setValue("SetValue", "Commit", true, CMIElement, value);
24402
24649
  if (result === global_constants.SCORM_TRUE && this._sequencingService) {
24403
24650
  try {
@@ -24529,6 +24776,48 @@ class Scorm2004API extends BaseAPI {
24529
24776
  }
24530
24777
  this._responseValidator.validateCorrectResponse(CMIElement, interaction, value);
24531
24778
  }
24779
+ /**
24780
+ * Silently peeks at a CMI value without triggering error logging or
24781
+ * mutating lastErrorCode. Returns null if the element doesn't exist.
24782
+ * Used internally to capture old values before SetValue overwrites them.
24783
+ *
24784
+ * @param {string} CMIElement - dot-delimited CMI path (e.g. "cmi.interactions.0.id")
24785
+ * @return {*} the current value, or null if the path doesn't resolve
24786
+ */
24787
+ _peekCMIValue(CMIElement) {
24788
+ if (!CMIElement || typeof CMIElement !== "string") {
24789
+ return null;
24790
+ }
24791
+ const segments = CMIElement.split(".");
24792
+ let refObject = this;
24793
+ for (let i = 0; i < segments.length; i++) {
24794
+ const attribute = segments[i];
24795
+ if (refObject == null) {
24796
+ return null;
24797
+ }
24798
+ try {
24799
+ refObject = refObject[attribute];
24800
+ } catch {
24801
+ return null;
24802
+ }
24803
+ if (refObject instanceof CMIArray) {
24804
+ const nextIndex = i + 1;
24805
+ if (nextIndex >= segments.length) {
24806
+ return refObject;
24807
+ }
24808
+ const nextSegment = segments[nextIndex];
24809
+ const index = Number(nextSegment);
24810
+ if (!Number.isNaN(index) && Number.isInteger(index) && index >= 0) {
24811
+ if (index >= refObject.childArray.length) {
24812
+ return null;
24813
+ }
24814
+ refObject = refObject.childArray[index];
24815
+ i++;
24816
+ }
24817
+ }
24818
+ }
24819
+ return refObject ?? null;
24820
+ }
24532
24821
  /**
24533
24822
  * Gets a value from the CMI Object
24534
24823
  * @param {string} CMIElement
@@ -24995,105 +25284,135 @@ class Scorm2004API extends BaseAPI {
24995
25284
  }
24996
25285
 
24997
25286
  class CrossFrameAPI {
25287
+ _cache = /* @__PURE__ */ new Map();
25288
+ _cacheTimestamps = /* @__PURE__ */ new Map();
25289
+ _lastError = "0";
25290
+ _pending = /* @__PURE__ */ new Map();
25291
+ _counter = 0;
25292
+ _origin;
25293
+ _targetWindow;
25294
+ _timeout;
25295
+ _heartbeatInterval;
25296
+ _heartbeatTimeout;
25297
+ _destroyed = false;
25298
+ _connected = true;
25299
+ _lastHeartbeatResponse = Date.now();
25300
+ _heartbeatTimer;
25301
+ _eventListeners = /* @__PURE__ */ new Map();
25302
+ _boundOnMessage;
24998
25303
  /**
24999
- * Creates a new CrossFrameAPI instance.
25000
- * @param targetOrigin - Origin to send messages to. Default "*" sends to any origin.
25001
- * @param targetWindow - Window to send messages to. Default is window.parent.
25002
- * @param options - Configuration options
25304
+ * Type guard to validate MessageResponse structure
25003
25305
  */
25004
- constructor(targetOrigin = "*", targetWindow = window.parent, options = {}) {
25005
- this._cache = /* @__PURE__ */ new Map();
25006
- this._cacheTimestamps = /* @__PURE__ */ new Map();
25007
- this._lastError = "0";
25008
- this._pending = /* @__PURE__ */ new Map();
25009
- this._counter = 0;
25010
- this._destroyed = false;
25011
- this._connected = true;
25012
- this._lastHeartbeatResponse = Date.now();
25013
- this._eventListeners = /* @__PURE__ */ new Map();
25014
- this._handler = {
25015
- get: (target, prop, receiver) => {
25016
- if (typeof prop !== "string" || prop in target) {
25017
- const v = Reflect.get(target, prop, receiver);
25018
- return typeof v === "function" ? v.bind(target) : v;
25306
+ static _isValidMessageResponse(data) {
25307
+ if (typeof data !== "object" || data === null) return false;
25308
+ const resp = data;
25309
+ if (typeof resp.messageId !== "string" || resp.messageId.length === 0) return false;
25310
+ if (resp.error !== void 0) {
25311
+ if (typeof resp.error !== "object" || resp.error === null) return false;
25312
+ const err = resp.error;
25313
+ if (typeof err.message !== "string") return false;
25314
+ if (err.code !== void 0 && typeof err.code !== "string") return false;
25315
+ }
25316
+ if (resp.isHeartbeat !== void 0 && typeof resp.isHeartbeat !== "boolean") return false;
25317
+ return true;
25318
+ }
25319
+ /**
25320
+ * Validates that args is an array and sanitizes it for safe use
25321
+ */
25322
+ static _validateArgs(args) {
25323
+ if (!Array.isArray(args)) return false;
25324
+ return true;
25325
+ }
25326
+ _handler = {
25327
+ get: (target, prop, receiver) => {
25328
+ if (typeof prop !== "string" || prop in target) {
25329
+ const v = Reflect.get(target, prop, receiver);
25330
+ return typeof v === "function" ? v.bind(target) : v;
25331
+ }
25332
+ const methodName = prop;
25333
+ const isGet = methodName.endsWith("GetValue");
25334
+ const isSet = methodName.startsWith("LMSSet") || methodName.endsWith("SetValue");
25335
+ const isInit = methodName === "Initialize" || methodName === "LMSInitialize";
25336
+ const isFinish = methodName === "Terminate" || methodName === "LMSFinish";
25337
+ const isCommit = methodName === "Commit" || methodName === "LMSCommit";
25338
+ const isErrorString = methodName === "GetErrorString" || methodName === "LMSGetErrorString";
25339
+ const isDiagnostic = methodName === "GetDiagnostic" || methodName === "LMSGetDiagnostic";
25340
+ return (...args) => {
25341
+ if (!CrossFrameAPI._validateArgs(args)) {
25342
+ console.error(`CrossFrameAPI: Invalid arguments for ${methodName}`);
25343
+ return "";
25019
25344
  }
25020
- const methodName = prop;
25021
- const isGet = methodName.endsWith("GetValue");
25022
- const isSet = methodName.startsWith("LMSSet") || methodName.endsWith("SetValue");
25023
- const isInit = methodName === "Initialize" || methodName === "LMSInitialize";
25024
- const isFinish = methodName === "Terminate" || methodName === "LMSFinish";
25025
- const isCommit = methodName === "Commit" || methodName === "LMSCommit";
25026
- const isErrorString = methodName === "GetErrorString" || methodName === "LMSGetErrorString";
25027
- const isDiagnostic = methodName === "GetDiagnostic" || methodName === "LMSGetDiagnostic";
25028
- return (...args) => {
25029
- if (!CrossFrameAPI._validateArgs(args)) {
25030
- console.error(`CrossFrameAPI: Invalid arguments for ${methodName}`);
25031
- return "";
25032
- }
25033
- if (isSet && args.length >= 2) {
25345
+ if (isSet && args.length >= 2) {
25346
+ const key = args[0];
25347
+ target._cache.set(key, String(args[1]));
25348
+ target._cacheTimestamps.set(key, Date.now());
25349
+ target._lastError = "0";
25350
+ }
25351
+ const requestTime = Date.now();
25352
+ target._post(methodName, args).then((res) => {
25353
+ if (isGet && args.length >= 1) {
25034
25354
  const key = args[0];
25035
- target._cache.set(key, String(args[1]));
25036
- target._cacheTimestamps.set(key, Date.now());
25037
- target._lastError = "0";
25038
- }
25039
- const requestTime = Date.now();
25040
- target._post(methodName, args).then((res) => {
25041
- if (isGet && args.length >= 1) {
25042
- const key = args[0];
25043
- const localModTime = target._cacheTimestamps.get(key) ?? 0;
25044
- if (localModTime < requestTime) {
25045
- target._cache.set(key, String(res));
25046
- target._cacheTimestamps.delete(key);
25047
- }
25048
- target._lastError = "0";
25049
- }
25050
- if (isErrorString && args.length >= 1) {
25051
- const code = String(args[0]);
25052
- target._cache.set(`error_${code}`, String(res));
25053
- }
25054
- if (isDiagnostic && args.length >= 1) {
25055
- const code = String(args[0]);
25056
- target._cache.set(`diag_${code}`, String(res));
25057
- }
25058
- if (methodName === "GetLastError" || methodName === "LMSGetLastError") {
25059
- target._lastError = String(res);
25355
+ const localModTime = target._cacheTimestamps.get(key) ?? 0;
25356
+ if (localModTime < requestTime) {
25357
+ target._cache.set(key, String(res));
25358
+ target._cacheTimestamps.delete(key);
25060
25359
  }
25061
- }).catch((err) => target._capture(methodName, err));
25062
- if (isGet && args.length >= 1) {
25063
- return target._cache.get(args[0]) ?? "";
25360
+ target._lastError = "0";
25064
25361
  }
25065
25362
  if (isErrorString && args.length >= 1) {
25066
25363
  const code = String(args[0]);
25067
- return target._cache.get(`error_${code}`) ?? "";
25364
+ target._cache.set(`error_${code}`, String(res));
25068
25365
  }
25069
25366
  if (isDiagnostic && args.length >= 1) {
25070
25367
  const code = String(args[0]);
25071
- return target._cache.get(`diag_${code}`) ?? "";
25072
- }
25073
- if (isInit || isFinish || isCommit || isSet) {
25074
- const result = "true";
25075
- target._post("getFlattenedCMI", []).then((all) => {
25076
- if (all && typeof all === "object") {
25077
- const entries = Object.entries(all);
25078
- entries.forEach(([key, val]) => {
25079
- const localModTime = target._cacheTimestamps.get(key) ?? 0;
25080
- if (localModTime < requestTime) {
25081
- target._cache.set(key, val);
25082
- target._cacheTimestamps.delete(key);
25083
- }
25084
- });
25085
- }
25086
- target._lastError = "0";
25087
- }).catch((err) => target._capture("getFlattenedCMI", err));
25088
- return result;
25368
+ target._cache.set(`diag_${code}`, String(res));
25089
25369
  }
25090
25370
  if (methodName === "GetLastError" || methodName === "LMSGetLastError") {
25091
- return target._lastError;
25371
+ target._lastError = String(res);
25092
25372
  }
25093
- return "";
25094
- };
25095
- }
25096
- };
25373
+ }).catch((err) => target._capture(methodName, err));
25374
+ if (isGet && args.length >= 1) {
25375
+ return target._cache.get(args[0]) ?? "";
25376
+ }
25377
+ if (isErrorString && args.length >= 1) {
25378
+ const code = String(args[0]);
25379
+ return target._cache.get(`error_${code}`) ?? "";
25380
+ }
25381
+ if (isDiagnostic && args.length >= 1) {
25382
+ const code = String(args[0]);
25383
+ return target._cache.get(`diag_${code}`) ?? "";
25384
+ }
25385
+ if (isInit || isFinish || isCommit || isSet) {
25386
+ const result = "true";
25387
+ target._post("getFlattenedCMI", []).then((all) => {
25388
+ if (all && typeof all === "object") {
25389
+ const entries = Object.entries(all);
25390
+ entries.forEach(([key, val]) => {
25391
+ const localModTime = target._cacheTimestamps.get(key) ?? 0;
25392
+ if (localModTime < requestTime) {
25393
+ target._cache.set(key, val);
25394
+ target._cacheTimestamps.delete(key);
25395
+ }
25396
+ });
25397
+ }
25398
+ target._lastError = "0";
25399
+ }).catch((err) => target._capture("getFlattenedCMI", err));
25400
+ return result;
25401
+ }
25402
+ if (methodName === "GetLastError" || methodName === "LMSGetLastError") {
25403
+ return target._lastError;
25404
+ }
25405
+ return "";
25406
+ };
25407
+ }
25408
+ };
25409
+ /**
25410
+ * Creates a new CrossFrameAPI instance.
25411
+ * @param targetOrigin - Origin to send messages to. Default "*" sends to any origin.
25412
+ * @param targetWindow - Window to send messages to. Default is window.parent.
25413
+ * @param options - Configuration options
25414
+ */
25415
+ constructor(targetOrigin = "*", targetWindow = window.parent, options = {}) {
25097
25416
  this._origin = targetOrigin;
25098
25417
  this._targetWindow = targetWindow;
25099
25418
  this._timeout = options.timeout ?? 5e3;
@@ -25109,29 +25428,6 @@ class CrossFrameAPI {
25109
25428
  this._startHeartbeat();
25110
25429
  return new Proxy(this, this._handler);
25111
25430
  }
25112
- /**
25113
- * Type guard to validate MessageResponse structure
25114
- */
25115
- static _isValidMessageResponse(data) {
25116
- if (typeof data !== "object" || data === null) return false;
25117
- const resp = data;
25118
- if (typeof resp.messageId !== "string" || resp.messageId.length === 0) return false;
25119
- if (resp.error !== void 0) {
25120
- if (typeof resp.error !== "object" || resp.error === null) return false;
25121
- const err = resp.error;
25122
- if (typeof err.message !== "string") return false;
25123
- if (err.code !== void 0 && typeof err.code !== "string") return false;
25124
- }
25125
- if (resp.isHeartbeat !== void 0 && typeof resp.isHeartbeat !== "boolean") return false;
25126
- return true;
25127
- }
25128
- /**
25129
- * Validates that args is an array and sanitizes it for safe use
25130
- */
25131
- static _validateArgs(args) {
25132
- if (!Array.isArray(args)) return false;
25133
- return true;
25134
- }
25135
25431
  /**
25136
25432
  * Destroys this instance, removing event listeners and preventing further message processing.
25137
25433
  * Once destroyed, the instance cannot be reused.
@@ -25295,6 +25591,38 @@ class CrossFrameAPI {
25295
25591
  }
25296
25592
 
25297
25593
  class CrossFrameLMS {
25594
+ _api;
25595
+ _origin;
25596
+ _rateLimit;
25597
+ _requestTimes = [];
25598
+ _destroyed = false;
25599
+ _boundOnMessage;
25600
+ /**
25601
+ * Strict allowlist of methods that can be invoked via cross-frame messages.
25602
+ * Only SCORM API methods and internal helpers are permitted.
25603
+ */
25604
+ static ALLOWED_METHODS = /* @__PURE__ */ new Set([
25605
+ // SCORM 1.2 methods
25606
+ "LMSInitialize",
25607
+ "LMSFinish",
25608
+ "LMSGetValue",
25609
+ "LMSSetValue",
25610
+ "LMSCommit",
25611
+ "LMSGetLastError",
25612
+ "LMSGetErrorString",
25613
+ "LMSGetDiagnostic",
25614
+ // SCORM 2004 methods
25615
+ "Initialize",
25616
+ "Terminate",
25617
+ "GetValue",
25618
+ "SetValue",
25619
+ "Commit",
25620
+ "GetLastError",
25621
+ "GetErrorString",
25622
+ "GetDiagnostic",
25623
+ // Internal method for cache warming
25624
+ "getFlattenedCMI"
25625
+ ]);
25298
25626
  /**
25299
25627
  * Creates a new CrossFrameLMS instance.
25300
25628
  * @param api - The SCORM API instance to delegate calls to
@@ -25302,8 +25630,6 @@ class CrossFrameLMS {
25302
25630
  * @param options - Configuration options
25303
25631
  */
25304
25632
  constructor(api, targetOrigin = "*", options = {}) {
25305
- this._requestTimes = [];
25306
- this._destroyed = false;
25307
25633
  this._api = api;
25308
25634
  this._origin = targetOrigin;
25309
25635
  this._rateLimit = options.rateLimit ?? 100;
@@ -25315,34 +25641,6 @@ class CrossFrameLMS {
25315
25641
  this._boundOnMessage = this._onMessage.bind(this);
25316
25642
  window.addEventListener("message", this._boundOnMessage);
25317
25643
  }
25318
- static {
25319
- /**
25320
- * Strict allowlist of methods that can be invoked via cross-frame messages.
25321
- * Only SCORM API methods and internal helpers are permitted.
25322
- */
25323
- this.ALLOWED_METHODS = /* @__PURE__ */ new Set([
25324
- // SCORM 1.2 methods
25325
- "LMSInitialize",
25326
- "LMSFinish",
25327
- "LMSGetValue",
25328
- "LMSSetValue",
25329
- "LMSCommit",
25330
- "LMSGetLastError",
25331
- "LMSGetErrorString",
25332
- "LMSGetDiagnostic",
25333
- // SCORM 2004 methods
25334
- "Initialize",
25335
- "Terminate",
25336
- "GetValue",
25337
- "SetValue",
25338
- "Commit",
25339
- "GetLastError",
25340
- "GetErrorString",
25341
- "GetDiagnostic",
25342
- // Internal method for cache warming
25343
- "getFlattenedCMI"
25344
- ]);
25345
- }
25346
25644
  /**
25347
25645
  * Destroys this instance, removing event listeners and preventing further message processing.
25348
25646
  * Once destroyed, the instance cannot be reused.