scorm-again 3.0.3 → 3.0.5

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.
@@ -252,14 +252,14 @@
252
252
  };
253
253
  }
254
254
 
255
- var __defProp$16 = Object.defineProperty;
256
- var __defNormalProp$16 = (obj, key, value) => key in obj ? __defProp$16(obj, key, {
255
+ var __defProp$1d = Object.defineProperty;
256
+ var __defNormalProp$1d = (obj, key, value) => key in obj ? __defProp$1d(obj, key, {
257
257
  enumerable: true,
258
258
  configurable: true,
259
259
  writable: true,
260
260
  value
261
261
  }) : obj[key] = value;
262
- var __publicField$16 = (obj, key, value) => __defNormalProp$16(obj, typeof key !== "symbol" ? key + "" : key, value);
262
+ var __publicField$1d = (obj, key, value) => __defNormalProp$1d(obj, typeof key !== "symbol" ? key + "" : key, value);
263
263
  class BaseCMI {
264
264
  /**
265
265
  * Constructor for BaseCMI
@@ -271,9 +271,9 @@
271
271
  * When true, getters can be accessed before the API is initialized, which is necessary
272
272
  * for serializing the CMI data structure to JSON format.
273
273
  */
274
- __publicField$16(this, "jsonString", false);
275
- __publicField$16(this, "_cmi_element");
276
- __publicField$16(this, "_initialized", false);
274
+ __publicField$1d(this, "jsonString", false);
275
+ __publicField$1d(this, "_cmi_element");
276
+ __publicField$1d(this, "_initialized", false);
277
277
  this._cmi_element = cmi_element;
278
278
  }
279
279
  /**
@@ -293,7 +293,7 @@
293
293
  class BaseRootCMI extends BaseCMI {
294
294
  constructor() {
295
295
  super(...arguments);
296
- __publicField$16(this, "_start_time");
296
+ __publicField$1d(this, "_start_time");
297
297
  }
298
298
  /**
299
299
  * Start time of the session
@@ -315,18 +315,18 @@
315
315
  }
316
316
  }
317
317
 
318
- var __defProp$15 = Object.defineProperty;
319
- var __defNormalProp$15 = (obj, key, value) => key in obj ? __defProp$15(obj, key, {
318
+ var __defProp$1c = Object.defineProperty;
319
+ var __defNormalProp$1c = (obj, key, value) => key in obj ? __defProp$1c(obj, key, {
320
320
  enumerable: true,
321
321
  configurable: true,
322
322
  writable: true,
323
323
  value
324
324
  }) : obj[key] = value;
325
- var __publicField$15 = (obj, key, value) => __defNormalProp$15(obj, typeof key !== "symbol" ? key + "" : key, value);
325
+ var __publicField$1c = (obj, key, value) => __defNormalProp$1c(obj, typeof key !== "symbol" ? key + "" : key, value);
326
326
  class BaseScormValidationError extends Error {
327
327
  constructor(CMIElement, errorCode) {
328
328
  super(`${CMIElement} : ${errorCode.toString()}`);
329
- __publicField$15(this, "_errorCode");
329
+ __publicField$1c(this, "_errorCode");
330
330
  this._errorCode = errorCode;
331
331
  Object.setPrototypeOf(this, BaseScormValidationError.prototype);
332
332
  }
@@ -348,8 +348,8 @@
348
348
  */
349
349
  constructor(CMIElement, errorCode, errorMessage, detailedMessage) {
350
350
  super(CMIElement, errorCode);
351
- __publicField$15(this, "_errorMessage");
352
- __publicField$15(this, "_detailedMessage", "");
351
+ __publicField$1c(this, "_errorMessage");
352
+ __publicField$1c(this, "_detailedMessage", "");
353
353
  this.message = `${CMIElement} : ${errorMessage}`;
354
354
  this._errorMessage = errorMessage;
355
355
  if (detailedMessage) {
@@ -674,14 +674,14 @@
674
674
  DEPENDENCY_NOT_ESTABLISHED: 408
675
675
  };
676
676
 
677
- var __defProp$14 = Object.defineProperty;
678
- var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, {
677
+ var __defProp$1b = Object.defineProperty;
678
+ var __defNormalProp$1b = (obj, key, value) => key in obj ? __defProp$1b(obj, key, {
679
679
  enumerable: true,
680
680
  configurable: true,
681
681
  writable: true,
682
682
  value
683
683
  }) : obj[key] = value;
684
- var __publicField$14 = (obj, key, value) => __defNormalProp$14(obj, typeof key !== "symbol" ? key + "" : key, value);
684
+ var __publicField$1b = (obj, key, value) => __defNormalProp$1b(obj, typeof key !== "symbol" ? key + "" : key, value);
685
685
  class CMIArray extends BaseCMI {
686
686
  /**
687
687
  * Constructor cmi *.n arrays
@@ -689,10 +689,10 @@
689
689
  */
690
690
  constructor(params) {
691
691
  super(params.CMIElement);
692
- __publicField$14(this, "_errorCode");
693
- __publicField$14(this, "_errorClass");
694
- __publicField$14(this, "__children");
695
- __publicField$14(this, "childArray");
692
+ __publicField$1b(this, "_errorCode");
693
+ __publicField$1b(this, "_errorClass");
694
+ __publicField$1b(this, "__children");
695
+ __publicField$1b(this, "childArray");
696
696
  this.__children = params.children;
697
697
  this._errorCode = params.errorCode ?? scorm12_errors.GENERAL;
698
698
  this._errorClass = params.errorClass || BaseScormValidationError;
@@ -1159,6 +1159,11 @@
1159
1159
  progress_range: "0#1"
1160
1160
  };
1161
1161
 
1162
+ const PERFORMANCE_STEP_NAME = "^$|" + scorm2004_regex.CMIShortIdentifier;
1163
+ const PERFORMANCE_CHARACTERSTRING = "(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}";
1164
+ const PERFORMANCE_NUMERIC_RANGE = "(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?";
1165
+ const CR_PERFORMANCE_STEP_ANSWER = "^(?:|" + PERFORMANCE_NUMERIC_RANGE + "|" + PERFORMANCE_CHARACTERSTRING + ")$";
1166
+ const LR_PERFORMANCE_STEP_ANSWER = "^(?:|" + PERFORMANCE_CHARACTERSTRING + ")$";
1162
1167
  const LearnerResponses = {
1163
1168
  "true-false": {
1164
1169
  format: "^true$|^false$",
@@ -1193,8 +1198,8 @@
1193
1198
  unique: false
1194
1199
  },
1195
1200
  performance: {
1196
- format: "^$|" + scorm2004_regex.CMIShortIdentifier,
1197
- format2: scorm2004_regex.CMIDecimal + "|^$|" + scorm2004_regex.CMIShortIdentifier,
1201
+ format: PERFORMANCE_STEP_NAME,
1202
+ format2: LR_PERFORMANCE_STEP_ANSWER,
1198
1203
  max: 250,
1199
1204
  delimiter: "[,]",
1200
1205
  delimiter2: "[.]",
@@ -1270,10 +1275,10 @@
1270
1275
  delimiter2: "[.]",
1271
1276
  unique: false,
1272
1277
  duplicate: false,
1273
- // step_name must be a non-empty short identifier
1274
- format: scorm2004_regex.CMIShortIdentifier,
1275
- // step_answer may be short identifier or numeric range (<decimal>[:<decimal>])
1276
- format2: `^(${scorm2004_regex.CMIShortIdentifier})$|^(?:\\d+(?:\\.\\d+)?(?::\\d+(?:\\.\\d+)?)?)$`
1278
+ // step_name: optional short_identifier_type
1279
+ format: PERFORMANCE_STEP_NAME,
1280
+ // step_answer: optional characterstring (spaces allowed) or numeric range
1281
+ format2: CR_PERFORMANCE_STEP_ANSWER
1277
1282
  },
1278
1283
  sequencing: {
1279
1284
  max: 36,
@@ -1310,14 +1315,14 @@
1310
1315
 
1311
1316
  const ValidLanguages = ["aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av", "ay", "az", "ba", "be", "bg", "bh", "bi", "bm", "bn", "bo", "br", "bs", "ca", "ce", "ch", "co", "cr", "cs", "cu", "cv", "cy", "da", "de", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fj", "fo", "fr", "fy", "ga", "gd", "gl", "gn", "gu", "gv", "ha", "he", "hi", "ho", "hr", "ht", "hu", "hy", "hz", "ia", "id", "ie", "ig", "ii", "ik", "io", "is", "it", "iu", "ja", "jv", "ka", "kg", "ki", "kj", "kk", "kl", "km", "kn", "ko", "kr", "ks", "ku", "kv", "kw", "ky", "la", "lb", "lg", "li", "ln", "lo", "lt", "lu", "lv", "mg", "mh", "mi", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "na", "nb", "nd", "ne", "ng", "nl", "nn", "no", "nr", "nv", "ny", "oc", "oj", "om", "or", "os", "pa", "pi", "pl", "ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa", "sc", "sd", "se", "sg", "sh", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "ti", "tk", "tl", "tn", "to", "tr", "ts", "tt", "tw", "ty", "ug", "uk", "ur", "uz", "ve", "vi", "vo", "wa", "wo", "xh", "yi", "yo", "za", "zh", "zu", "aar", "abk", "ave", "afr", "aka", "amh", "arg", "ara", "asm", "ava", "aym", "aze", "bak", "bel", "bul", "bih", "bis", "bam", "ben", "tib", "bod", "bre", "bos", "cat", "che", "cha", "cos", "cre", "cze", "ces", "chu", "chv", "wel", "cym", "dan", "ger", "deu", "div", "dzo", "ewe", "gre", "ell", "eng", "epo", "spa", "est", "baq", "eus", "per", "fas", "ful", "fin", "fij", "fao", "fre", "fra", "fry", "gle", "gla", "glg", "grn", "guj", "glv", "hau", "heb", "hin", "hmo", "hrv", "hat", "hun", "arm", "hye", "her", "ina", "ind", "ile", "ibo", "iii", "ipk", "ido", "ice", "isl", "ita", "iku", "jpn", "jav", "geo", "kat", "kon", "kik", "kua", "kaz", "kal", "khm", "kan", "kor", "kau", "kas", "kur", "kom", "cor", "kir", "lat", "ltz", "lug", "lim", "lin", "lao", "lit", "lub", "lav", "mlg", "mah", "mao", "mri", "mac", "mkd", "mal", "mon", "mol", "mar", "may", "msa", "mlt", "bur", "mya", "nau", "nob", "nde", "nep", "ndo", "dut", "nld", "nno", "nor", "nbl", "nav", "nya", "oci", "oji", "orm", "ori", "oss", "pan", "pli", "pol", "pus", "por", "que", "roh", "run", "rum", "ron", "rus", "kin", "san", "srd", "snd", "sme", "sag", "slo", "sin", "slk", "slv", "smo", "sna", "som", "alb", "sqi", "srp", "ssw", "sot", "sun", "swe", "swa", "tam", "tel", "tgk", "tha", "tir", "tuk", "tgl", "tsn", "ton", "tur", "tso", "tat", "twi", "tah", "uig", "ukr", "urd", "uzb", "ven", "vie", "vol", "wln", "wol", "xho", "yid", "yor", "zha", "chi", "zho", "zul"];
1312
1317
 
1313
- var __defProp$13 = Object.defineProperty;
1314
- var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
1318
+ var __defProp$1a = Object.defineProperty;
1319
+ var __defNormalProp$1a = (obj, key, value) => key in obj ? __defProp$1a(obj, key, {
1315
1320
  enumerable: true,
1316
1321
  configurable: true,
1317
1322
  writable: true,
1318
1323
  value
1319
1324
  }) : obj[key] = value;
1320
- var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
1325
+ var __publicField$1a = (obj, key, value) => __defNormalProp$1a(obj, typeof key !== "symbol" ? key + "" : key, value);
1321
1326
  class ScheduledCommit {
1322
1327
  /**
1323
1328
  * Constructor for ScheduledCommit
@@ -1326,10 +1331,10 @@
1326
1331
  * @param {string} callback
1327
1332
  */
1328
1333
  constructor(API, when, callback) {
1329
- __publicField$13(this, "_API");
1330
- __publicField$13(this, "_cancelled", false);
1331
- __publicField$13(this, "_timeout");
1332
- __publicField$13(this, "_callback");
1334
+ __publicField$1a(this, "_API");
1335
+ __publicField$1a(this, "_cancelled", false);
1336
+ __publicField$1a(this, "_timeout");
1337
+ __publicField$1a(this, "_callback");
1333
1338
  this._API = API;
1334
1339
  this._timeout = setTimeout(this.wrapper.bind(this), when);
1335
1340
  this._callback = callback;
@@ -1357,14 +1362,14 @@
1357
1362
 
1358
1363
  const HIDE_LMS_UI_TOKENS = ["continue", "previous", "exit", "exitAll", "abandon", "abandonAll", "suspendAll"];
1359
1364
 
1360
- var __defProp$12 = Object.defineProperty;
1361
- var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
1365
+ var __defProp$19 = Object.defineProperty;
1366
+ var __defNormalProp$19 = (obj, key, value) => key in obj ? __defProp$19(obj, key, {
1362
1367
  enumerable: true,
1363
1368
  configurable: true,
1364
1369
  writable: true,
1365
1370
  value
1366
1371
  }) : obj[key] = value;
1367
- var __publicField$12 = (obj, key, value) => __defNormalProp$12(obj, typeof key !== "symbol" ? key + "" : key, value);
1372
+ var __publicField$19 = (obj, key, value) => __defNormalProp$19(obj, typeof key !== "symbol" ? key + "" : key, value);
1368
1373
  var RuleConditionOperator = /* @__PURE__ */(RuleConditionOperator2 => {
1369
1374
  RuleConditionOperator2["NOT"] = "not";
1370
1375
  RuleConditionOperator2["AND"] = "and";
@@ -1397,10 +1402,10 @@
1397
1402
  let operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1398
1403
  let parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /* @__PURE__ */new Map();
1399
1404
  super("ruleCondition");
1400
- __publicField$12(this, "_condition", "always" /* ALWAYS */);
1401
- __publicField$12(this, "_operator", null);
1402
- __publicField$12(this, "_parameters", /* @__PURE__ */new Map());
1403
- __publicField$12(this, "_referencedObjective", null);
1405
+ __publicField$19(this, "_condition", "always" /* ALWAYS */);
1406
+ __publicField$19(this, "_operator", null);
1407
+ __publicField$19(this, "_parameters", /* @__PURE__ */new Map());
1408
+ __publicField$19(this, "_referencedObjective", null);
1404
1409
  this._condition = condition;
1405
1410
  this._operator = operator;
1406
1411
  this._parameters = parameters;
@@ -1671,9 +1676,9 @@
1671
1676
  }
1672
1677
  };
1673
1678
  // Optional, overridable provider for current time (LMS may set via SequencingService)
1674
- __publicField$12(_RuleCondition, "_now", () => /* @__PURE__ */new Date());
1679
+ __publicField$19(_RuleCondition, "_now", () => /* @__PURE__ */new Date());
1675
1680
  // Optional, overridable hook for getting elapsed seconds
1676
- __publicField$12(_RuleCondition, "_getElapsedSecondsHook");
1681
+ __publicField$19(_RuleCondition, "_getElapsedSecondsHook");
1677
1682
  let RuleCondition = _RuleCondition;
1678
1683
  class SequencingRule extends BaseCMI {
1679
1684
  /**
@@ -1685,9 +1690,9 @@
1685
1690
  let action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "skip";
1686
1691
  let conditionCombination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "and";
1687
1692
  super("sequencingRule");
1688
- __publicField$12(this, "_conditions", []);
1689
- __publicField$12(this, "_action", "skip" /* SKIP */);
1690
- __publicField$12(this, "_conditionCombination", "and" /* AND */);
1693
+ __publicField$19(this, "_conditions", []);
1694
+ __publicField$19(this, "_action", "skip" /* SKIP */);
1695
+ __publicField$19(this, "_conditionCombination", "and" /* AND */);
1691
1696
  this._action = action;
1692
1697
  this._conditionCombination = conditionCombination;
1693
1698
  }
@@ -1800,9 +1805,9 @@
1800
1805
  */
1801
1806
  constructor() {
1802
1807
  super("sequencingRules");
1803
- __publicField$12(this, "_preConditionRules", []);
1804
- __publicField$12(this, "_exitConditionRules", []);
1805
- __publicField$12(this, "_postConditionRules", []);
1808
+ __publicField$19(this, "_preConditionRules", []);
1809
+ __publicField$19(this, "_exitConditionRules", []);
1810
+ __publicField$19(this, "_postConditionRules", []);
1806
1811
  }
1807
1812
  /**
1808
1813
  * Called when the API needs to be reset
@@ -1919,9 +1924,17 @@
1919
1924
  }
1920
1925
  }
1921
1926
 
1927
+ var __defProp$18 = Object.defineProperty;
1928
+ var __defNormalProp$18 = (obj, key, value) => key in obj ? __defProp$18(obj, key, {
1929
+ enumerable: true,
1930
+ configurable: true,
1931
+ writable: true,
1932
+ value
1933
+ }) : obj[key] = value;
1934
+ var __publicField$18 = (obj, key, value) => __defNormalProp$18(obj, key + "" , value);
1922
1935
  class ActivityTreeQueries {
1923
1936
  constructor(activityTree) {
1924
- this.activityTree = activityTree;
1937
+ __publicField$18(this, "activityTree", activityTree);
1925
1938
  }
1926
1939
  /**
1927
1940
  * Check if activity is in the activity tree
@@ -2117,10 +2130,18 @@
2117
2130
  }
2118
2131
  }
2119
2132
 
2133
+ var __defProp$17 = Object.defineProperty;
2134
+ var __defNormalProp$17 = (obj, key, value) => key in obj ? __defProp$17(obj, key, {
2135
+ enumerable: true,
2136
+ configurable: true,
2137
+ writable: true,
2138
+ value
2139
+ }) : obj[key] = value;
2140
+ var __publicField$17 = (obj, key, value) => __defNormalProp$17(obj, typeof key !== "symbol" ? key + "" : key, value);
2120
2141
  class ChoiceConstraintValidator {
2121
2142
  constructor(activityTree, treeQueries) {
2122
- this.activityTree = activityTree;
2123
- this.treeQueries = treeQueries;
2143
+ __publicField$17(this, "activityTree", activityTree);
2144
+ __publicField$17(this, "treeQueries", treeQueries);
2124
2145
  }
2125
2146
  /**
2126
2147
  * Main entry point - consolidates ALL constraint validation for choice navigation
@@ -2572,14 +2593,14 @@
2572
2593
  }
2573
2594
  }
2574
2595
 
2575
- var __defProp$11 = Object.defineProperty;
2576
- var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
2596
+ var __defProp$16 = Object.defineProperty;
2597
+ var __defNormalProp$16 = (obj, key, value) => key in obj ? __defProp$16(obj, key, {
2577
2598
  enumerable: true,
2578
2599
  configurable: true,
2579
2600
  writable: true,
2580
2601
  value
2581
2602
  }) : obj[key] = value;
2582
- var __publicField$11 = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
2603
+ var __publicField$16 = (obj, key, value) => __defNormalProp$16(obj, typeof key !== "symbol" ? key + "" : key, value);
2583
2604
  var SequencingRequestType = /* @__PURE__ */(SequencingRequestType2 => {
2584
2605
  SequencingRequestType2["START"] = "start";
2585
2606
  SequencingRequestType2["RESUME_ALL"] = "resumeAll";
@@ -2608,10 +2629,10 @@
2608
2629
  let targetActivity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2609
2630
  let exception = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2610
2631
  let endSequencingSession = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2611
- __publicField$11(this, "deliveryRequest");
2612
- __publicField$11(this, "targetActivity");
2613
- __publicField$11(this, "exception");
2614
- __publicField$11(this, "endSequencingSession");
2632
+ __publicField$16(this, "deliveryRequest");
2633
+ __publicField$16(this, "targetActivity");
2634
+ __publicField$16(this, "exception");
2635
+ __publicField$16(this, "endSequencingSession");
2615
2636
  this.deliveryRequest = deliveryRequest;
2616
2637
  this.targetActivity = targetActivity;
2617
2638
  this.exception = exception;
@@ -2622,10 +2643,10 @@
2622
2643
  constructor(identifiedActivity, deliverable) {
2623
2644
  let exception = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2624
2645
  let endSequencingSession = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2625
- __publicField$11(this, "identifiedActivity");
2626
- __publicField$11(this, "deliverable");
2627
- __publicField$11(this, "exception");
2628
- __publicField$11(this, "endSequencingSession");
2646
+ __publicField$16(this, "identifiedActivity");
2647
+ __publicField$16(this, "deliverable");
2648
+ __publicField$16(this, "exception");
2649
+ __publicField$16(this, "endSequencingSession");
2629
2650
  this.identifiedActivity = identifiedActivity;
2630
2651
  this.deliverable = deliverable;
2631
2652
  this.exception = exception;
@@ -2635,8 +2656,8 @@
2635
2656
  class ChoiceTraversalResult {
2636
2657
  constructor(activity) {
2637
2658
  let exception = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2638
- __publicField$11(this, "activity");
2639
- __publicField$11(this, "exception");
2659
+ __publicField$16(this, "activity");
2660
+ __publicField$16(this, "exception");
2640
2661
  this.activity = activity;
2641
2662
  this.exception = exception;
2642
2663
  }
@@ -2647,19 +2668,19 @@
2647
2668
  return FlowSubprocessMode2;
2648
2669
  })(FlowSubprocessMode || {});
2649
2670
 
2650
- var __defProp$10 = Object.defineProperty;
2651
- var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, {
2671
+ var __defProp$15 = Object.defineProperty;
2672
+ var __defNormalProp$15 = (obj, key, value) => key in obj ? __defProp$15(obj, key, {
2652
2673
  enumerable: true,
2653
2674
  configurable: true,
2654
2675
  writable: true,
2655
2676
  value
2656
2677
  }) : obj[key] = value;
2657
- var __publicField$10 = (obj, key, value) => __defNormalProp$10(obj, typeof key !== "symbol" ? key + "" : key, value);
2678
+ var __publicField$15 = (obj, key, value) => __defNormalProp$15(obj, typeof key !== "symbol" ? key + "" : key, value);
2658
2679
  class RuleEvaluationEngine {
2659
2680
  constructor() {
2660
2681
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2661
- __publicField$10(this, "now");
2662
- __publicField$10(this, "getAttemptElapsedSecondsHook");
2682
+ __publicField$15(this, "now");
2683
+ __publicField$15(this, "getAttemptElapsedSecondsHook");
2663
2684
  this.now = options.now || (() => /* @__PURE__ */new Date());
2664
2685
  this.getAttemptElapsedSecondsHook = options.getAttemptElapsedSecondsHook || null;
2665
2686
  }
@@ -2930,14 +2951,14 @@
2930
2951
  }
2931
2952
  }
2932
2953
 
2933
- var __defProp$$ = Object.defineProperty;
2934
- var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, {
2954
+ var __defProp$14 = Object.defineProperty;
2955
+ var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, {
2935
2956
  enumerable: true,
2936
2957
  configurable: true,
2937
2958
  writable: true,
2938
2959
  value
2939
2960
  }) : obj[key] = value;
2940
- var __publicField$$ = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
2961
+ var __publicField$14 = (obj, key, value) => __defNormalProp$14(obj, typeof key !== "symbol" ? key + "" : key, value);
2941
2962
  var SelectionTiming = /* @__PURE__ */(SelectionTiming2 => {
2942
2963
  SelectionTiming2["NEVER"] = "never";
2943
2964
  SelectionTiming2["ONCE"] = "once";
@@ -2957,36 +2978,36 @@
2957
2978
  constructor() {
2958
2979
  super("sequencingControls");
2959
2980
  // Sequencing Control Modes
2960
- __publicField$$(this, "_enabled", true);
2961
- __publicField$$(this, "_choice", true);
2962
- __publicField$$(this, "_choiceExit", true);
2981
+ __publicField$14(this, "_enabled", true);
2982
+ __publicField$14(this, "_choice", true);
2983
+ __publicField$14(this, "_choiceExit", true);
2963
2984
  // Per SCORM 2004 Sequencing & Navigation, flow defaults to true
2964
- __publicField$$(this, "_flow", true);
2965
- __publicField$$(this, "_forwardOnly", false);
2966
- __publicField$$(this, "_useCurrentAttemptObjectiveInfo", true);
2967
- __publicField$$(this, "_useCurrentAttemptProgressInfo", true);
2985
+ __publicField$14(this, "_flow", true);
2986
+ __publicField$14(this, "_forwardOnly", false);
2987
+ __publicField$14(this, "_useCurrentAttemptObjectiveInfo", true);
2988
+ __publicField$14(this, "_useCurrentAttemptProgressInfo", true);
2968
2989
  // Constrain Choice Controls
2969
- __publicField$$(this, "_preventActivation", false);
2970
- __publicField$$(this, "_constrainChoice", false);
2990
+ __publicField$14(this, "_preventActivation", false);
2991
+ __publicField$14(this, "_constrainChoice", false);
2971
2992
  // Rule-driven traversal limiter (e.g., post-condition stopForwardTraversal)
2972
- __publicField$$(this, "_stopForwardTraversal", false);
2993
+ __publicField$14(this, "_stopForwardTraversal", false);
2973
2994
  // Rollup Controls
2974
- __publicField$$(this, "_rollupObjectiveSatisfied", true);
2975
- __publicField$$(this, "_rollupProgressCompletion", true);
2976
- __publicField$$(this, "_objectiveMeasureWeight", 1);
2995
+ __publicField$14(this, "_rollupObjectiveSatisfied", true);
2996
+ __publicField$14(this, "_rollupProgressCompletion", true);
2997
+ __publicField$14(this, "_objectiveMeasureWeight", 1);
2977
2998
  // Selection Controls
2978
- __publicField$$(this, "_selectionTiming", "never" /* NEVER */);
2979
- __publicField$$(this, "_selectCount", null);
2980
- __publicField$$(this, "_selectionCountStatus", false);
2981
- __publicField$$(this, "_randomizeChildren", false);
2999
+ __publicField$14(this, "_selectionTiming", "never" /* NEVER */);
3000
+ __publicField$14(this, "_selectCount", null);
3001
+ __publicField$14(this, "_selectionCountStatus", false);
3002
+ __publicField$14(this, "_randomizeChildren", false);
2982
3003
  // Randomization Controls
2983
- __publicField$$(this, "_randomizationTiming", "never" /* NEVER */);
2984
- __publicField$$(this, "_reorderChildren", false);
3004
+ __publicField$14(this, "_randomizationTiming", "never" /* NEVER */);
3005
+ __publicField$14(this, "_reorderChildren", false);
2985
3006
  // Auto-completion/satisfaction controls
2986
- __publicField$$(this, "_completionSetByContent", false);
2987
- __publicField$$(this, "_objectiveSetByContent", false);
3007
+ __publicField$14(this, "_completionSetByContent", false);
3008
+ __publicField$14(this, "_objectiveSetByContent", false);
2988
3009
  // Delivery Controls
2989
- __publicField$$(this, "_tracked", true);
3010
+ __publicField$14(this, "_tracked", true);
2990
3011
  }
2991
3012
  /**
2992
3013
  * Reset the sequencing controls to their default values
@@ -3547,10 +3568,18 @@
3547
3568
  }
3548
3569
  }
3549
3570
 
3571
+ var __defProp$13 = Object.defineProperty;
3572
+ var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
3573
+ enumerable: true,
3574
+ configurable: true,
3575
+ writable: true,
3576
+ value
3577
+ }) : obj[key] = value;
3578
+ var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
3550
3579
  class FlowTraversalService {
3551
3580
  constructor(activityTree, ruleEngine) {
3552
- this.activityTree = activityTree;
3553
- this.ruleEngine = ruleEngine;
3581
+ __publicField$13(this, "activityTree", activityTree);
3582
+ __publicField$13(this, "ruleEngine", ruleEngine);
3554
3583
  }
3555
3584
  /**
3556
3585
  * Flow Subprocess (SB.2.3)
@@ -3841,10 +3870,18 @@
3841
3870
  }
3842
3871
  }
3843
3872
 
3873
+ var __defProp$12 = Object.defineProperty;
3874
+ var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
3875
+ enumerable: true,
3876
+ configurable: true,
3877
+ writable: true,
3878
+ value
3879
+ }) : obj[key] = value;
3880
+ var __publicField$12 = (obj, key, value) => __defNormalProp$12(obj, typeof key !== "symbol" ? key + "" : key, value);
3844
3881
  class FlowRequestHandler {
3845
3882
  constructor(activityTree, traversalService) {
3846
- this.activityTree = activityTree;
3847
- this.traversalService = traversalService;
3883
+ __publicField$12(this, "activityTree", activityTree);
3884
+ __publicField$12(this, "traversalService", traversalService);
3848
3885
  }
3849
3886
  /**
3850
3887
  * Start Sequencing Request Process (SB.2.5)
@@ -3962,12 +3999,20 @@
3962
3999
  }
3963
4000
  }
3964
4001
 
4002
+ var __defProp$11 = Object.defineProperty;
4003
+ var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
4004
+ enumerable: true,
4005
+ configurable: true,
4006
+ writable: true,
4007
+ value
4008
+ }) : obj[key] = value;
4009
+ var __publicField$11 = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
3965
4010
  class ChoiceRequestHandler {
3966
4011
  constructor(activityTree, constraintValidator, traversalService, treeQueries) {
3967
- this.activityTree = activityTree;
3968
- this.constraintValidator = constraintValidator;
3969
- this.traversalService = traversalService;
3970
- this.treeQueries = treeQueries;
4012
+ __publicField$11(this, "activityTree", activityTree);
4013
+ __publicField$11(this, "constraintValidator", constraintValidator);
4014
+ __publicField$11(this, "traversalService", traversalService);
4015
+ __publicField$11(this, "treeQueries", treeQueries);
3971
4016
  }
3972
4017
  /**
3973
4018
  * Choice Sequencing Request Process (SB.2.9)
@@ -4168,10 +4213,18 @@
4168
4213
  }
4169
4214
  }
4170
4215
 
4216
+ var __defProp$10 = Object.defineProperty;
4217
+ var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, {
4218
+ enumerable: true,
4219
+ configurable: true,
4220
+ writable: true,
4221
+ value
4222
+ }) : obj[key] = value;
4223
+ var __publicField$10 = (obj, key, value) => __defNormalProp$10(obj, typeof key !== "symbol" ? key + "" : key, value);
4171
4224
  class ExitRequestHandler {
4172
4225
  constructor(activityTree, ruleEngine) {
4173
- this.activityTree = activityTree;
4174
- this.ruleEngine = ruleEngine;
4226
+ __publicField$10(this, "activityTree", activityTree);
4227
+ __publicField$10(this, "ruleEngine", ruleEngine);
4175
4228
  }
4176
4229
  /**
4177
4230
  * Exit Sequencing Request Process (SB.2.11)
@@ -4284,10 +4337,18 @@
4284
4337
  }
4285
4338
  }
4286
4339
 
4340
+ var __defProp$$ = Object.defineProperty;
4341
+ var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, {
4342
+ enumerable: true,
4343
+ configurable: true,
4344
+ writable: true,
4345
+ value
4346
+ }) : obj[key] = value;
4347
+ var __publicField$$ = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
4287
4348
  class RetryRequestHandler {
4288
4349
  constructor(activityTree, traversalService) {
4289
- this.activityTree = activityTree;
4290
- this.traversalService = traversalService;
4350
+ __publicField$$(this, "activityTree", activityTree);
4351
+ __publicField$$(this, "traversalService", traversalService);
4291
4352
  }
4292
4353
  /**
4293
4354
  * Retry Sequencing Request Process (SB.2.10)
@@ -5242,7 +5303,13 @@
5242
5303
  if (!scorm2004) {
5243
5304
  if (isFinalAttribute) {
5244
5305
  if (typeof attribute === "undefined" || !this.context.checkObjectHasProperty(refObject, attribute)) {
5245
- this.context.throwSCORMError(CMIElement, invalidErrorCode, invalidErrorMessage);
5306
+ if (attribute === "_children") {
5307
+ this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "CHILDREN_ERROR"));
5308
+ } else if (attribute === "_count") {
5309
+ this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "COUNT_ERROR"));
5310
+ } else {
5311
+ this.context.throwSCORMError(CMIElement, invalidErrorCode, invalidErrorMessage);
5312
+ }
5246
5313
  return {
5247
5314
  error: true
5248
5315
  };
@@ -5450,7 +5517,8 @@
5450
5517
  getNumericLevel(level) {
5451
5518
  if (level === void 0) return LogLevelEnum.NONE;
5452
5519
  if (typeof level === "number") return level;
5453
- switch (level) {
5520
+ const normalized = typeof level === "string" ? level.toUpperCase() : level;
5521
+ switch (normalized) {
5454
5522
  case "1":
5455
5523
  case "DEBUG":
5456
5524
  return LogLevelEnum.DEBUG;
@@ -5831,7 +5899,7 @@ ${stackTrace}`);
5831
5899
  * @param {Function} apiLog - The logging function
5832
5900
  */
5833
5901
  constructor(settings, error_codes, apiLog) {
5834
- this.apiLog = apiLog;
5902
+ __publicField$T(this, "apiLog", apiLog);
5835
5903
  __publicField$T(this, "settings");
5836
5904
  __publicField$T(this, "error_codes");
5837
5905
  __publicField$T(this, "storeName", "scorm_again_offline_data");
@@ -15495,19 +15563,20 @@ ${stackTrace}`);
15495
15563
  if (errorCode === 143) returnValue = global_constants.SCORM_FALSE;
15496
15564
  } else {
15497
15565
  const result = this.storeData(false);
15498
- if ((result.errorCode ?? 0) > 0) {
15566
+ const errorCode = result.errorCode ?? 0;
15567
+ if (errorCode > 0) {
15499
15568
  if (result.errorMessage) {
15500
15569
  this.apiLog("commit", `Commit failed with error: ${result.errorMessage}`, LogLevelEnum.ERROR);
15501
15570
  }
15502
15571
  if (result.errorDetails) {
15503
15572
  this.apiLog("commit", `Error details: ${JSON.stringify(result.errorDetails)}`, LogLevelEnum.DEBUG);
15504
15573
  }
15505
- this.throwSCORMError("api", result.errorCode);
15574
+ this.throwSCORMError("api", errorCode);
15506
15575
  }
15507
15576
  const resultValue = result?.result ?? global_constants.SCORM_FALSE;
15508
15577
  returnValue = typeof resultValue === "boolean" ? String(resultValue) : resultValue;
15509
15578
  this.apiLog(callbackName, " Result: " + returnValue, LogLevelEnum.DEBUG, "HttpRequest");
15510
- if (checkTerminated) this.lastErrorCode = "0";
15579
+ if (checkTerminated && errorCode === 0) this.lastErrorCode = "0";
15511
15580
  this.processListeners(callbackName);
15512
15581
  if (this.settings.enableOfflineSupport && this._offlineStorageService && this._offlineStorageService.isDeviceOnline() && this._courseId) {
15513
15582
  this._offlineStorageService.hasPendingOfflineData(this._courseId).then(hasPendingData => {
@@ -18292,6 +18361,49 @@ ${stackTrace}`);
18292
18361
  }
18293
18362
  }
18294
18363
 
18364
+ function stripBrackets(delim) {
18365
+ return delim.replace(/[[\]]/g, "");
18366
+ }
18367
+ function escapeRegex(s) {
18368
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18369
+ }
18370
+ function splitDelimited(value, bracketed) {
18371
+ if (!bracketed) {
18372
+ return [value];
18373
+ }
18374
+ if (value.includes(bracketed)) {
18375
+ return value.split(bracketed);
18376
+ }
18377
+ const bare = stripBrackets(bracketed);
18378
+ if (!bare) {
18379
+ return [value];
18380
+ }
18381
+ const splitRe = new RegExp(`(?<!\\\\)${escapeRegex(bare)}`, "g");
18382
+ const unescapeRe = new RegExp(`\\\\${escapeRegex(bare)}`, "g");
18383
+ return value.split(splitRe).map(part => part.replace(unescapeRe, bare));
18384
+ }
18385
+ function splitFirstDelimited(value, bracketed) {
18386
+ if (!bracketed) {
18387
+ return [value];
18388
+ }
18389
+ if (value.includes(bracketed)) {
18390
+ const idx = value.indexOf(bracketed);
18391
+ return [value.slice(0, idx), value.slice(idx + bracketed.length)];
18392
+ }
18393
+ const bare = stripBrackets(bracketed);
18394
+ if (!bare) {
18395
+ return [value];
18396
+ }
18397
+ const splitRe = new RegExp(`(?<!\\\\)${escapeRegex(bare)}`);
18398
+ const unescapeRe = new RegExp(`\\\\${escapeRegex(bare)}`, "g");
18399
+ const parts = value.split(splitRe);
18400
+ const first = (parts[0] ?? "").replace(unescapeRe, bare);
18401
+ if (parts.length === 1) {
18402
+ return [first];
18403
+ }
18404
+ return [first, parts.slice(1).join(bare).replace(unescapeRe, bare)];
18405
+ }
18406
+
18295
18407
  var __defProp$l = Object.defineProperty;
18296
18408
  var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, {
18297
18409
  enumerable: true,
@@ -18487,8 +18599,7 @@ ${stackTrace}`);
18487
18599
  const response_type = LearnerResponses[this.type];
18488
18600
  if (response_type) {
18489
18601
  if (response_type?.delimiter) {
18490
- const delimiter = response_type.delimiter === "[,]" ? "," : response_type.delimiter;
18491
- nodes = learner_response.split(delimiter);
18602
+ nodes = splitDelimited(learner_response, response_type.delimiter);
18492
18603
  } else {
18493
18604
  nodes[0] = learner_response;
18494
18605
  }
@@ -18496,10 +18607,10 @@ ${stackTrace}`);
18496
18607
  const formatRegex = new RegExp(response_type.format);
18497
18608
  for (let i = 0; i < nodes.length; i++) {
18498
18609
  if (response_type?.delimiter2) {
18499
- const delimiter2 = response_type.delimiter2 === "[.]" ? "." : response_type.delimiter2;
18500
- const values = nodes[i]?.split(delimiter2);
18610
+ const node = nodes[i] ?? "";
18611
+ const values = this.type === "performance" ? splitFirstDelimited(node, response_type.delimiter2) : splitDelimited(node, response_type.delimiter2);
18501
18612
  if (values?.length === 2) {
18502
- if (this.type === "performance" && (values[0] === "" || values[1] === "")) {
18613
+ if (this.type === "performance" && values[0] === "" && values[1] === "") {
18503
18614
  throw new Scorm2004ValidationError(this._cmi_element + ".learner_response", scorm2004_errors.TYPE_MISMATCH);
18504
18615
  }
18505
18616
  if (!values[0]?.match(formatRegex)) {
@@ -18680,37 +18791,19 @@ ${stackTrace}`);
18680
18791
  return result;
18681
18792
  }
18682
18793
  }
18683
- function stripBrackets(delim) {
18684
- return delim.replace(/[[\]]/g, "");
18685
- }
18686
- function escapeRegex(s) {
18687
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18688
- }
18689
- function splitUnescaped(text, delim) {
18690
- const reDelim = escapeRegex(delim);
18691
- const splitRe = new RegExp(`(?<!\\\\)${reDelim}`, "g");
18692
- const unescapeRe = new RegExp(`\\\\${reDelim}`, "g");
18693
- return text.split(splitRe).map(part => part.replace(unescapeRe, delim));
18694
- }
18695
- function splitFirstUnescaped(text, delim) {
18696
- const reDelim = escapeRegex(delim);
18697
- const splitRe = new RegExp(`(?<!\\\\)${reDelim}`);
18698
- const unescapeRe = new RegExp(`\\\\${reDelim}`, "g");
18699
- const parts = text.split(splitRe);
18700
- const firstPart = parts[0] ?? "";
18701
- if (parts.length === 1) {
18702
- return [firstPart.replace(unescapeRe, delim)];
18794
+ const RESPONSE_PREFIX_RE = /^\{(?:lang|case_matters|order_matters)=[^}]+\}/;
18795
+ function stripResponsePrefixes(node) {
18796
+ let result = node;
18797
+ while (RESPONSE_PREFIX_RE.test(result)) {
18798
+ result = result.replace(RESPONSE_PREFIX_RE, "");
18703
18799
  }
18704
- const part1 = firstPart.replace(unescapeRe, delim);
18705
- const part2 = parts.slice(1).join(delim).replace(unescapeRe, delim);
18706
- return [part1, part2];
18800
+ return result;
18707
18801
  }
18708
18802
  function validatePattern(type, pattern, responseDef) {
18709
18803
  if (pattern.trim() !== pattern) {
18710
18804
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18711
18805
  }
18712
- const subDelim1 = responseDef.delimiter ? stripBrackets(responseDef.delimiter) : null;
18713
- const rawNodes = subDelim1 ? splitUnescaped(pattern, subDelim1) : [pattern];
18806
+ const rawNodes = responseDef.delimiter ? splitDelimited(pattern, responseDef.delimiter) : [pattern];
18714
18807
  for (const raw of rawNodes) {
18715
18808
  if (raw.trim() !== raw) {
18716
18809
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
@@ -18719,17 +18812,11 @@ ${stackTrace}`);
18719
18812
  if (type === "fill-in" && pattern === "") {
18720
18813
  return;
18721
18814
  }
18722
- const delim1 = responseDef.delimiter ? stripBrackets(responseDef.delimiter) : null;
18723
- let nodes;
18724
- if (delim1) {
18725
- nodes = splitUnescaped(pattern, delim1);
18726
- } else {
18727
- nodes = [pattern];
18728
- }
18815
+ const nodes = responseDef.delimiter ? splitDelimited(pattern, responseDef.delimiter) : [pattern];
18729
18816
  if (!responseDef.delimiter && pattern.includes(",")) {
18730
18817
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18731
18818
  }
18732
- if (responseDef.unique || responseDef.duplicate === false) {
18819
+ if (type !== "numeric" && (responseDef.unique || responseDef.duplicate === false)) {
18733
18820
  const seen = new Set(nodes);
18734
18821
  if (seen.size !== nodes.length) {
18735
18822
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
@@ -18749,8 +18836,7 @@ ${stackTrace}`);
18749
18836
  if (!delimBracketed) {
18750
18837
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18751
18838
  }
18752
- const delim = stripBrackets(delimBracketed);
18753
- const parts = value.split(new RegExp(`(?<!\\\\)${escapeRegex(delim)}`, "g")).map(n => n.replace(new RegExp(`\\\\${escapeRegex(delim)}`, "g"), delim));
18839
+ const parts = splitDelimited(value, delimBracketed);
18754
18840
  if (parts.length !== 2 || parts[0] === "" || parts[1] === "") {
18755
18841
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18756
18842
  }
@@ -18762,12 +18848,14 @@ ${stackTrace}`);
18762
18848
  switch (type) {
18763
18849
  case "numeric":
18764
18850
  {
18765
- const numDelim = responseDef.delimiter ? stripBrackets(responseDef.delimiter) : ":";
18766
- const nums = node.split(numDelim);
18767
- if (nums.length < 1 || nums.length > 2) {
18768
- throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18851
+ if (node === "") {
18852
+ const bracketedRange = nodes.length >= 2 && !!responseDef.delimiter && pattern.includes(responseDef.delimiter);
18853
+ if (!bracketedRange) {
18854
+ throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18855
+ }
18856
+ break;
18769
18857
  }
18770
- nums.forEach(checkSingle);
18858
+ checkSingle(node);
18771
18859
  break;
18772
18860
  }
18773
18861
  case "performance":
@@ -18776,13 +18864,13 @@ ${stackTrace}`);
18776
18864
  if (!delimBracketed) {
18777
18865
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18778
18866
  }
18779
- const delim = stripBrackets(delimBracketed);
18780
- const parts = splitFirstUnescaped(node, delim);
18867
+ const record = stripResponsePrefixes(node);
18868
+ const parts = splitFirstDelimited(record, delimBracketed);
18781
18869
  if (parts.length !== 2) {
18782
18870
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18783
18871
  }
18784
18872
  const [part1, part2] = parts;
18785
- if (part1 === "" || part2 === "" || part1 === part2) {
18873
+ if (part1 === "" && part2 === "") {
18786
18874
  throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
18787
18875
  }
18788
18876
  if (part1 === void 0 || !fmt1.test(part1)) {
@@ -21568,7 +21656,7 @@ ${stackTrace}`);
21568
21656
  checkValidResponseType(CMIElement, response_type, value, interaction_type) {
21569
21657
  let nodes = [];
21570
21658
  if (response_type?.delimiter) {
21571
- nodes = String(value).split(response_type.delimiter);
21659
+ nodes = splitDelimited(String(value), response_type.delimiter);
21572
21660
  } else {
21573
21661
  nodes[0] = value;
21574
21662
  }
@@ -21666,26 +21754,33 @@ ${stackTrace}`);
21666
21754
  nodes[i] = this.removeCorrectResponsePrefixes(CMIElement, nodes[i]);
21667
21755
  }
21668
21756
  if (response?.delimiter2) {
21669
- const values = nodes[i].split(response.delimiter2);
21757
+ const values = interaction_type === "performance" ? splitFirstDelimited(nodes[i], response.delimiter2) : splitDelimited(nodes[i], response.delimiter2);
21670
21758
  if (values.length === 2) {
21671
- const matches = values[0].match(formatRegex);
21672
- if (!matches) {
21759
+ if (interaction_type === "performance" && values[0] === "" && values[1] === "") {
21673
21760
  this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21674
21761
  } else {
21675
- if (!response.format2 || !values[1].match(new RegExp(response.format2))) {
21762
+ const matches = values[0]?.match(formatRegex);
21763
+ if (!matches) {
21676
21764
  this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21765
+ } else {
21766
+ if (!response.format2 || !values[1]?.match(new RegExp(response.format2))) {
21767
+ this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21768
+ }
21677
21769
  }
21678
21770
  }
21679
21771
  } else {
21680
21772
  this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21681
21773
  }
21682
21774
  } else {
21775
+ if (interaction_type === "numeric" && nodes.length > 1 && nodes[i] === "" && !!response.delimiter && String(value).includes(response.delimiter)) {
21776
+ continue;
21777
+ }
21683
21778
  const matches = nodes[i].match(formatRegex);
21684
21779
  if (!matches && value !== "" || !matches && interaction_type === "true-false") {
21685
21780
  this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21686
21781
  } else {
21687
21782
  if (interaction_type === "numeric" && nodes.length > 1) {
21688
- if (Number(nodes[0]) > Number(nodes[1])) {
21783
+ if (nodes[0] !== "" && nodes[1] !== "" && Number(nodes[0]) > Number(nodes[1])) {
21689
21784
  this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
21690
21785
  }
21691
21786
  } else {