scorm-again 2.6.3 → 2.6.4

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 (68) hide show
  1. package/dist/aicc.js +37 -22
  2. package/dist/aicc.js.map +1 -1
  3. package/dist/aicc.min.js +1 -1
  4. package/dist/aicc.min.js.map +1 -1
  5. package/dist/esm/aicc.js +37 -22
  6. package/dist/esm/aicc.js.map +1 -1
  7. package/dist/esm/aicc.min.js +1 -1
  8. package/dist/esm/aicc.min.js.map +1 -1
  9. package/dist/esm/scorm-again.js +66 -42
  10. package/dist/esm/scorm-again.js.map +1 -1
  11. package/dist/esm/scorm-again.min.js +1 -1
  12. package/dist/esm/scorm-again.min.js.map +1 -1
  13. package/dist/esm/scorm12.js +34 -20
  14. package/dist/esm/scorm12.js.map +1 -1
  15. package/dist/esm/scorm12.min.js +1 -1
  16. package/dist/esm/scorm12.min.js.map +1 -1
  17. package/dist/esm/scorm2004.js +56 -36
  18. package/dist/esm/scorm2004.js.map +1 -1
  19. package/dist/esm/scorm2004.min.js +1 -1
  20. package/dist/esm/scorm2004.min.js.map +1 -1
  21. package/dist/scorm-again.js +66 -42
  22. package/dist/scorm-again.js.map +1 -1
  23. package/dist/scorm-again.min.js +1 -1
  24. package/dist/scorm-again.min.js.map +1 -1
  25. package/dist/scorm12.js +34 -20
  26. package/dist/scorm12.js.map +1 -1
  27. package/dist/scorm12.min.js +1 -1
  28. package/dist/scorm12.min.js.map +1 -1
  29. package/dist/scorm2004.js +56 -36
  30. package/dist/scorm2004.js.map +1 -1
  31. package/dist/scorm2004.min.js +1 -1
  32. package/dist/scorm2004.min.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/BaseAPI.ts +54 -33
  35. package/src/Scorm12API.ts +3 -2
  36. package/src/Scorm2004API.ts +31 -24
  37. package/src/cmi/aicc/attempts.ts +3 -3
  38. package/src/cmi/aicc/core.ts +30 -12
  39. package/src/cmi/aicc/evaluation.ts +1 -1
  40. package/src/cmi/aicc/student_data.ts +1 -1
  41. package/src/cmi/aicc/student_demographics.ts +13 -13
  42. package/src/cmi/aicc/student_preferences.ts +1 -1
  43. package/src/cmi/aicc/tries.ts +3 -3
  44. package/src/cmi/aicc/validation.ts +1 -1
  45. package/src/cmi/common/array.ts +1 -1
  46. package/src/cmi/common/score.ts +3 -3
  47. package/src/cmi/common/validation.ts +2 -2
  48. package/src/cmi/scorm12/cmi.ts +12 -4
  49. package/src/cmi/scorm12/interactions.ts +27 -11
  50. package/src/cmi/scorm12/objectives.ts +4 -4
  51. package/src/cmi/scorm12/student_data.ts +12 -4
  52. package/src/cmi/scorm12/student_preference.ts +3 -1
  53. package/src/cmi/scorm12/validation.ts +5 -3
  54. package/src/cmi/scorm2004/adl.ts +21 -7
  55. package/src/cmi/scorm2004/cmi.ts +45 -15
  56. package/src/cmi/scorm2004/comments.ts +11 -5
  57. package/src/cmi/scorm2004/interactions.ts +25 -23
  58. package/src/cmi/scorm2004/learner_preference.ts +3 -1
  59. package/src/cmi/scorm2004/objectives.ts +5 -5
  60. package/src/cmi/scorm2004/score.ts +3 -3
  61. package/src/cmi/scorm2004/validation.ts +2 -2
  62. package/src/exceptions/aicc_exceptions.ts +4 -4
  63. package/src/exceptions/scorm12_exceptions.ts +4 -4
  64. package/src/exceptions/scorm2004_exceptions.ts +4 -4
  65. package/src/utilities.ts +3 -3
  66. package/test/Scorm12API.spec.ts +45 -0
  67. package/test/Scorm2004API.spec.ts +43 -0
  68. package/tsconfig.json +1 -0
@@ -34,11 +34,12 @@ var AICCValidationError = (function (_super) {
34
34
  (0,tslib_es6.__extends)(AICCValidationError, _super);
35
35
  function AICCValidationError(errorCode) {
36
36
  var _this = this;
37
+ var _a, _b, _c, _d;
37
38
  if ({}.hasOwnProperty.call(aicc_errors, String(errorCode))) {
38
- _this = _super.call(this, errorCode, aicc_errors[String(errorCode)].basicMessage, aicc_errors[String(errorCode)].detailMessage) || this;
39
+ _this = _super.call(this, errorCode, ((_a = aicc_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown rror", (_b = aicc_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
39
40
  }
40
41
  else {
41
- _this = _super.call(this, 101, aicc_errors["101"].basicMessage, aicc_errors["101"].detailMessage) || this;
42
+ _this = _super.call(this, 101, ((_c = aicc_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) || "General error", (_d = aicc_errors["101"]) === null || _d === void 0 ? void 0 : _d.detailMessage) || this;
42
43
  }
43
44
  return _this;
44
45
  }
@@ -1412,6 +1413,10 @@ var BaseAPI = (function () {
1412
1413
  : this._error_codes.GENERAL;
1413
1414
  for (var idx = 0; idx < structure.length; idx++) {
1414
1415
  var attribute = structure[idx];
1416
+ if (!attribute) {
1417
+ this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
1418
+ return api_constants.global_constants.SCORM_FALSE;
1419
+ }
1415
1420
  if (idx === structure.length - 1) {
1416
1421
  if (scorm2004 && attribute.substring(0, 8) === "{target=") {
1417
1422
  if (this.isInitialized()) {
@@ -1442,7 +1447,7 @@ var BaseAPI = (function () {
1442
1447
  break;
1443
1448
  }
1444
1449
  if (refObject instanceof array.CMIArray) {
1445
- var index = parseInt(structure[idx + 1], 10);
1450
+ var index = parseInt(structure[idx + 1] || "0", 10);
1446
1451
  if (!isNaN(index)) {
1447
1452
  var item = refObject.childArray[index];
1448
1453
  if (item) {
@@ -1486,6 +1491,10 @@ var BaseAPI = (function () {
1486
1491
  : this._error_codes.GENERAL;
1487
1492
  for (var idx = 0; idx < structure.length; idx++) {
1488
1493
  attribute = structure[idx];
1494
+ if (!attribute) {
1495
+ this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
1496
+ return;
1497
+ }
1489
1498
  if (!scorm2004) {
1490
1499
  if (idx === structure.length - 1) {
1491
1500
  if (!this._checkObjectHasProperty(refObject, attribute)) {
@@ -1511,7 +1520,7 @@ var BaseAPI = (function () {
1511
1520
  break;
1512
1521
  }
1513
1522
  if (refObject instanceof array.CMIArray) {
1514
- var index = parseInt(structure[idx + 1], 10);
1523
+ var index = parseInt(structure[idx + 1] || "", 10);
1515
1524
  if (!isNaN(index)) {
1516
1525
  var item = refObject.childArray[index];
1517
1526
  if (item) {
@@ -1549,17 +1558,18 @@ var BaseAPI = (function () {
1549
1558
  return this.currentState === api_constants.global_constants.STATE_TERMINATED;
1550
1559
  };
1551
1560
  BaseAPI.prototype.on = function (listenerName, callback) {
1561
+ var _a, _c;
1552
1562
  if (!callback)
1553
1563
  return;
1554
1564
  var listenerFunctions = listenerName.split(" ");
1555
1565
  for (var i = 0; i < listenerFunctions.length; i++) {
1556
- var listenerSplit = listenerFunctions[i].split(".");
1557
- if (listenerSplit.length === 0)
1566
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1567
+ if (!listenerSplit || listenerSplit.length === 0)
1558
1568
  return;
1559
1569
  var functionName = listenerSplit[0];
1560
1570
  var CMIElement = null;
1561
1571
  if (listenerSplit.length > 1) {
1562
- CMIElement = listenerName.replace(functionName + ".", "");
1572
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1563
1573
  }
1564
1574
  this.listenerArray.push({
1565
1575
  functionName: functionName,
@@ -1570,17 +1580,18 @@ var BaseAPI = (function () {
1570
1580
  }
1571
1581
  };
1572
1582
  BaseAPI.prototype.off = function (listenerName, callback) {
1583
+ var _a, _c;
1573
1584
  if (!callback)
1574
1585
  return;
1575
1586
  var listenerFunctions = listenerName.split(" ");
1576
1587
  var _loop_1 = function (i) {
1577
- var listenerSplit = listenerFunctions[i].split(".");
1578
- if (listenerSplit.length === 0)
1588
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1589
+ if (!listenerSplit || listenerSplit.length === 0)
1579
1590
  return { value: void 0 };
1580
1591
  var functionName = listenerSplit[0];
1581
1592
  var CMIElement = null;
1582
1593
  if (listenerSplit.length > 1) {
1583
- CMIElement = listenerName.replace(functionName + ".", "");
1594
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1584
1595
  }
1585
1596
  var removeIndex = this_1.listenerArray.findIndex(function (obj) {
1586
1597
  return obj.functionName === functionName &&
@@ -1600,15 +1611,16 @@ var BaseAPI = (function () {
1600
1611
  }
1601
1612
  };
1602
1613
  BaseAPI.prototype.clear = function (listenerName) {
1614
+ var _a, _c;
1603
1615
  var listenerFunctions = listenerName.split(" ");
1604
1616
  var _loop_2 = function (i) {
1605
- var listenerSplit = listenerFunctions[i].split(".");
1606
- if (listenerSplit.length === 0)
1617
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1618
+ if (!listenerSplit || (listenerSplit === null || listenerSplit === void 0 ? void 0 : listenerSplit.length) === 0)
1607
1619
  return { value: void 0 };
1608
1620
  var functionName = listenerSplit[0];
1609
1621
  var CMIElement = null;
1610
1622
  if (listenerSplit.length > 1) {
1611
- CMIElement = listenerName.replace(functionName + ".", "");
1623
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1612
1624
  }
1613
1625
  this_2.listenerArray = this_2.listenerArray.filter(function (obj) {
1614
1626
  return obj.functionName !== functionName && obj.CMIElement !== CMIElement;
@@ -2090,14 +2102,16 @@ var Scorm12Impl = (function (_super) {
2090
2102
  Scorm12Impl.prototype.validateCorrectResponse = function (_CMIElement, _value) {
2091
2103
  };
2092
2104
  Scorm12Impl.prototype.getLmsErrorMessageDetails = function (errorNumber, detail) {
2105
+ var _a, _b;
2093
2106
  var basicMessage = "No Error";
2094
2107
  var detailMessage = "No Error";
2095
2108
  errorNumber = String(errorNumber);
2096
2109
  if (_constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) {
2097
2110
  basicMessage =
2098
- _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].basicMessage;
2111
+ ((_a = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _a === void 0 ? void 0 : _a.basicMessage) ||
2112
+ "General Error";
2099
2113
  detailMessage =
2100
- _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].detailMessage;
2114
+ ((_b = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _b === void 0 ? void 0 : _b.detailMessage) || "";
2101
2115
  }
2102
2116
  return detail ? detailMessage : basicMessage;
2103
2117
  };
@@ -2254,11 +2268,12 @@ var Scorm2004ValidationError = (function (_super) {
2254
2268
  (0,tslib_es6.__extends)(Scorm2004ValidationError, _super);
2255
2269
  function Scorm2004ValidationError(errorCode) {
2256
2270
  var _this = this;
2271
+ var _a, _b, _c, _d;
2257
2272
  if ({}.hasOwnProperty.call(scorm2004_errors, String(errorCode))) {
2258
- _this = _super.call(this, errorCode, scorm2004_errors[String(errorCode)].basicMessage, scorm2004_errors[String(errorCode)].detailMessage) || this;
2273
+ _this = _super.call(this, errorCode, ((_a = scorm2004_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown error", (_b = scorm2004_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
2259
2274
  }
2260
2275
  else {
2261
- _this = _super.call(this, 101, scorm2004_errors["101"].basicMessage, scorm2004_errors["101"].detailMessage) || this;
2276
+ _this = _super.call(this, 101, ((_c = scorm2004_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) || "General error", (_d = scorm2004_errors["101"]) === null || _d === void 0 ? void 0 : _d.detailMessage) || this;
2262
2277
  }
2263
2278
  return _this;
2264
2279
  }
@@ -2674,6 +2689,7 @@ var CMIInteractionsObject = (function (_super) {
2674
2689
  return this._learner_response;
2675
2690
  },
2676
2691
  set: function (learner_response) {
2692
+ var _a, _b, _c, _d;
2677
2693
  if (this.initialized && (this._type === "" || this._id === "")) {
2678
2694
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);
2679
2695
  }
@@ -2691,14 +2707,14 @@ var CMIInteractionsObject = (function (_super) {
2691
2707
  var formatRegex = new RegExp(response_type.format);
2692
2708
  for (var i = 0; i < nodes.length; i++) {
2693
2709
  if (response_type === null || response_type === void 0 ? void 0 : response_type.delimiter2) {
2694
- var values = nodes[i].split(response_type.delimiter2);
2695
- if (values.length === 2) {
2696
- if (!values[0].match(formatRegex)) {
2710
+ var values = (_a = nodes[i]) === null || _a === void 0 ? void 0 : _a.split(response_type.delimiter2);
2711
+ if ((values === null || values === void 0 ? void 0 : values.length) === 2) {
2712
+ if (!((_b = values[0]) === null || _b === void 0 ? void 0 : _b.match(formatRegex))) {
2697
2713
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2698
2714
  }
2699
2715
  else {
2700
2716
  if (!response_type.format2 ||
2701
- !values[1].match(new RegExp(response_type.format2))) {
2717
+ !((_c = values[1]) === null || _c === void 0 ? void 0 : _c.match(new RegExp(response_type.format2)))) {
2702
2718
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2703
2719
  }
2704
2720
  }
@@ -2708,7 +2724,7 @@ var CMIInteractionsObject = (function (_super) {
2708
2724
  }
2709
2725
  }
2710
2726
  else {
2711
- if (!nodes[i].match(formatRegex)) {
2727
+ if (!((_d = nodes[i]) === null || _d === void 0 ? void 0 : _d.match(formatRegex))) {
2712
2728
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2713
2729
  }
2714
2730
  else {
@@ -4186,7 +4202,8 @@ var ADLNavRequestValid = (function (_super) {
4186
4202
  }
4187
4203
  for (var key in choice) {
4188
4204
  if ({}.hasOwnProperty.call(choice, key)) {
4189
- if (check2004ValidFormat(choice[key], regex.scorm2004_regex.NAVBoolean) &&
4205
+ if (choice[key] !== undefined &&
4206
+ check2004ValidFormat(choice[key], regex.scorm2004_regex.NAVBoolean) &&
4190
4207
  check2004ValidFormat(key, regex.scorm2004_regex.NAVTarget)) {
4191
4208
  this._choice[key] =
4192
4209
  enums.NAVBoolean[choice[key]];
@@ -4210,7 +4227,8 @@ var ADLNavRequestValid = (function (_super) {
4210
4227
  }
4211
4228
  for (var key in jump) {
4212
4229
  if ({}.hasOwnProperty.call(jump, key)) {
4213
- if (check2004ValidFormat(jump[key], regex.scorm2004_regex.NAVBoolean) &&
4230
+ if (jump[key] !== undefined &&
4231
+ check2004ValidFormat(jump[key], regex.scorm2004_regex.NAVBoolean) &&
4214
4232
  check2004ValidFormat(key, regex.scorm2004_regex.NAVTarget)) {
4215
4233
  this._jump[key] = enums.NAVBoolean[jump[key]];
4216
4234
  }
@@ -4363,19 +4381,19 @@ var Scorm2004Impl = (function (_super) {
4363
4381
  });
4364
4382
  };
4365
4383
  Scorm2004Impl.prototype.lmsGetValue = function (CMIElement) {
4366
- var _a;
4384
+ var _a, _b;
4367
4385
  var adlNavRequestRegex = "^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=\\S{0,}([a-zA-Z0-9-_]+)}$";
4368
4386
  if ((0,utilities.stringMatches)(CMIElement, adlNavRequestRegex)) {
4369
4387
  var matches = CMIElement.match(adlNavRequestRegex);
4370
4388
  if (matches) {
4371
4389
  var request = matches[1];
4372
- var target = matches[2].replace("{target=", "").replace("}", "");
4373
- if (request === "choice" || request === "jump") {
4390
+ var target = (_a = matches[2]) === null || _a === void 0 ? void 0 : _a.replace("{target=", "").replace("}", "");
4391
+ if (target && (request === "choice" || request === "jump")) {
4374
4392
  if (this.settings.scoItemIdValidator) {
4375
4393
  return String(this.settings.scoItemIdValidator(target));
4376
4394
  }
4377
4395
  if (this.settings.scoItemIds) {
4378
- return String((_a = this.settings.scoItemIds) === null || _a === void 0 ? void 0 : _a.includes(target));
4396
+ return String((_b = this.settings.scoItemIds) === null || _b === void 0 ? void 0 : _b.includes(target));
4379
4397
  }
4380
4398
  return String(request);
4381
4399
  }
@@ -4529,8 +4547,9 @@ var Scorm2004Impl = (function (_super) {
4529
4547
  var interaction_count = interaction.correct_responses._count;
4530
4548
  this.checkDuplicateChoiceResponse(interaction, value);
4531
4549
  var response_type = CorrectResponses[interaction.type];
4532
- if (typeof response_type.limit === "undefined" ||
4533
- interaction_count <= response_type.limit) {
4550
+ if (typeof response_type !== "undefined" &&
4551
+ (typeof response_type.limit === "undefined" ||
4552
+ interaction_count <= response_type.limit)) {
4534
4553
  this.checkValidResponseType(response_type, value, interaction.type);
4535
4554
  if ((this.lastErrorCode === "0" &&
4536
4555
  (!response_type.duplicate ||
@@ -4551,14 +4570,17 @@ var Scorm2004Impl = (function (_super) {
4551
4570
  return this._commonGetCMIValue("GetValue", true, CMIElement);
4552
4571
  };
4553
4572
  Scorm2004Impl.prototype.getLmsErrorMessageDetails = function (errorNumber, detail) {
4573
+ var _a, _b;
4554
4574
  var basicMessage = "";
4555
4575
  var detailMessage = "";
4556
4576
  errorNumber = String(errorNumber);
4557
4577
  if (api_constants.scorm2004_constants.error_descriptions[errorNumber]) {
4558
4578
  basicMessage =
4559
- api_constants.scorm2004_constants.error_descriptions[errorNumber].basicMessage;
4579
+ ((_a = api_constants.scorm2004_constants.error_descriptions[errorNumber]) === null || _a === void 0 ? void 0 : _a.basicMessage) ||
4580
+ "Unknown Error";
4560
4581
  detailMessage =
4561
- api_constants.scorm2004_constants.error_descriptions[errorNumber].detailMessage;
4582
+ ((_b = api_constants.scorm2004_constants.error_descriptions[errorNumber]) === null || _b === void 0 ? void 0 : _b.detailMessage) ||
4583
+ "";
4562
4584
  }
4563
4585
  return detail ? detailMessage : basicMessage;
4564
4586
  };
@@ -4574,7 +4596,7 @@ var Scorm2004Impl = (function (_super) {
4574
4596
  };
4575
4597
  Scorm2004Impl.prototype.checkCorrectResponseValue = function (interaction_type, nodes, value) {
4576
4598
  var response = CorrectResponses[interaction_type];
4577
- var formatRegex = new RegExp(response.format);
4599
+ var formatRegex = new RegExp((response === null || response === void 0 ? void 0 : response.format) || ".*");
4578
4600
  for (var i = 0; i < nodes.length && this.lastErrorCode === "0"; i++) {
4579
4601
  if (interaction_type.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")) {
4580
4602
  nodes[i] = this.removeCorrectResponsePrefixes(nodes[i]);
@@ -4610,7 +4632,7 @@ var Scorm2004Impl = (function (_super) {
4610
4632
  }
4611
4633
  }
4612
4634
  else {
4613
- if (nodes[i] !== "" && response.unique) {
4635
+ if (nodes[i] !== "" && (response === null || response === void 0 ? void 0 : response.unique)) {
4614
4636
  for (var j = 0; j < i && this.lastErrorCode === "0"; j++) {
4615
4637
  if (nodes[i] === nodes[j]) {
4616
4638
  this.throwSCORMError(error_codes.scorm2004_errors.TYPE_MISMATCH);
@@ -4623,6 +4645,7 @@ var Scorm2004Impl = (function (_super) {
4623
4645
  }
4624
4646
  };
4625
4647
  Scorm2004Impl.prototype.removeCorrectResponsePrefixes = function (node) {
4648
+ var _a;
4626
4649
  var seenOrder = false;
4627
4650
  var seenCase = false;
4628
4651
  var seenLang = false;
@@ -4660,7 +4683,7 @@ var Scorm2004Impl = (function (_super) {
4660
4683
  seenOrder = true;
4661
4684
  break;
4662
4685
  }
4663
- node = node.substring(matches[1].length);
4686
+ node = node.substring(((_a = matches[1]) === null || _a === void 0 ? void 0 : _a.length) || 0);
4664
4687
  matches = node.match(prefixRegex);
4665
4688
  }
4666
4689
  return node;
@@ -5062,8 +5085,8 @@ function checkValidFormat(value, regexPattern, errorCode, errorClass, allowEmpty
5062
5085
  function checkValidRange(value, rangePattern, errorCode, errorClass) {
5063
5086
  var ranges = rangePattern.split("#");
5064
5087
  value = value * 1.0;
5065
- if (value >= ranges[0]) {
5066
- if (ranges[1] === "*" || value <= ranges[1]) {
5088
+ if (ranges[0] && value >= ranges[0]) {
5089
+ if (ranges[1] && (ranges[1] === "*" || value <= ranges[1])) {
5067
5090
  return true;
5068
5091
  }
5069
5092
  else {
@@ -6658,11 +6681,12 @@ var Scorm12ValidationError = (function (_super) {
6658
6681
  (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(Scorm12ValidationError, _super);
6659
6682
  function Scorm12ValidationError(errorCode) {
6660
6683
  var _this = this;
6684
+ var _a, _b, _c, _d, _e;
6661
6685
  if ({}.hasOwnProperty.call(scorm12_errors, String(errorCode))) {
6662
- _this = _super.call(this, errorCode, scorm12_errors[String(errorCode)].basicMessage, scorm12_errors[String(errorCode)].detailMessage) || this;
6686
+ _this = _super.call(this, errorCode, ((_a = scorm12_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown error", (_b = scorm12_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
6663
6687
  }
6664
6688
  else {
6665
- _this = _super.call(this, 101, scorm12_errors["101"].basicMessage, scorm12_errors["101"].detailMessage) || this;
6689
+ _this = _super.call(this, 101, (_d = (_c = scorm12_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) !== null && _d !== void 0 ? _d : "General error", (_e = scorm12_errors["101"]) === null || _e === void 0 ? void 0 : _e.detailMessage) || this;
6666
6690
  }
6667
6691
  return _this;
6668
6692
  }
@@ -6732,7 +6756,7 @@ function getSecondsAsISODuration(seconds) {
6732
6756
  var duration = "P";
6733
6757
  var remainder = seconds;
6734
6758
  for (var designationsKey in designations) {
6735
- var current_seconds = designations[designationsKey];
6759
+ var current_seconds = designations[designationsKey] || 1;
6736
6760
  var value = Math.floor(remainder / current_seconds);
6737
6761
  remainder = remainder % current_seconds;
6738
6762
  if (countDecimals(remainder) > 2) {
@@ -6839,7 +6863,7 @@ function unflatten(data) {
6839
6863
  var m = regex.exec(p);
6840
6864
  while (m) {
6841
6865
  cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
6842
- prop = m[2] || m[1];
6866
+ prop = m[2] || m[1] || "";
6843
6867
  m = regex.exec(p);
6844
6868
  }
6845
6869
  cur[prop] = data[p];
@@ -6851,7 +6875,7 @@ function countDecimals(num) {
6851
6875
  if (Math.floor(num) === num || String(num).indexOf(".") < 0)
6852
6876
  return 0;
6853
6877
  var parts = num.toString().split(".")[1];
6854
- return parts.length || 0;
6878
+ return (parts === null || parts === void 0 ? void 0 : parts.length) || 0;
6855
6879
  }
6856
6880
  function formatMessage(functionName, message, CMIElement) {
6857
6881
  var baseLength = 20;