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.
- package/README.md +19 -4
- package/dist/esm/scorm-again.js +133 -68
- package/dist/esm/scorm-again.js.map +1 -1
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -1
- package/dist/esm/scorm12.js +20 -5
- package/dist/esm/scorm12.js.map +1 -1
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -1
- package/dist/esm/scorm2004.js +133 -68
- package/dist/esm/scorm2004.js.map +1 -1
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -1
- package/dist/scorm-again.js +261 -166
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm-again.min.js.map +1 -1
- package/dist/scorm12.js +14 -6
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm12.min.js.map +1 -1
- package/dist/scorm2004.js +261 -166
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/dist/types/cmi/scorm2004/interaction_delimiters.d.ts +4 -0
- package/package.json +46 -25
package/dist/scorm2004.js
CHANGED
|
@@ -198,14 +198,14 @@ this.Scorm2004API = (function () {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
var __defProp$
|
|
202
|
-
var __defNormalProp$
|
|
201
|
+
var __defProp$15 = Object.defineProperty;
|
|
202
|
+
var __defNormalProp$15 = (obj, key, value) => key in obj ? __defProp$15(obj, key, {
|
|
203
203
|
enumerable: true,
|
|
204
204
|
configurable: true,
|
|
205
205
|
writable: true,
|
|
206
206
|
value
|
|
207
207
|
}) : obj[key] = value;
|
|
208
|
-
var __publicField$
|
|
208
|
+
var __publicField$15 = (obj, key, value) => __defNormalProp$15(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
209
209
|
class BaseCMI {
|
|
210
210
|
/**
|
|
211
211
|
* Constructor for BaseCMI
|
|
@@ -217,9 +217,9 @@ this.Scorm2004API = (function () {
|
|
|
217
217
|
* When true, getters can be accessed before the API is initialized, which is necessary
|
|
218
218
|
* for serializing the CMI data structure to JSON format.
|
|
219
219
|
*/
|
|
220
|
-
__publicField$
|
|
221
|
-
__publicField$
|
|
222
|
-
__publicField$
|
|
220
|
+
__publicField$15(this, "jsonString", false);
|
|
221
|
+
__publicField$15(this, "_cmi_element");
|
|
222
|
+
__publicField$15(this, "_initialized", false);
|
|
223
223
|
this._cmi_element = cmi_element;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
@@ -239,7 +239,7 @@ this.Scorm2004API = (function () {
|
|
|
239
239
|
class BaseRootCMI extends BaseCMI {
|
|
240
240
|
constructor() {
|
|
241
241
|
super(...arguments);
|
|
242
|
-
__publicField$
|
|
242
|
+
__publicField$15(this, "_start_time");
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
245
|
* Start time of the session
|
|
@@ -261,18 +261,18 @@ this.Scorm2004API = (function () {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
var __defProp$
|
|
265
|
-
var __defNormalProp$
|
|
264
|
+
var __defProp$14 = Object.defineProperty;
|
|
265
|
+
var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, {
|
|
266
266
|
enumerable: true,
|
|
267
267
|
configurable: true,
|
|
268
268
|
writable: true,
|
|
269
269
|
value
|
|
270
270
|
}) : obj[key] = value;
|
|
271
|
-
var __publicField$
|
|
271
|
+
var __publicField$14 = (obj, key, value) => __defNormalProp$14(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
272
272
|
class BaseScormValidationError extends Error {
|
|
273
273
|
constructor(CMIElement, errorCode) {
|
|
274
274
|
super(`${CMIElement} : ${errorCode.toString()}`);
|
|
275
|
-
__publicField$
|
|
275
|
+
__publicField$14(this, "_errorCode");
|
|
276
276
|
this._errorCode = errorCode;
|
|
277
277
|
Object.setPrototypeOf(this, BaseScormValidationError.prototype);
|
|
278
278
|
}
|
|
@@ -294,8 +294,8 @@ this.Scorm2004API = (function () {
|
|
|
294
294
|
*/
|
|
295
295
|
constructor(CMIElement, errorCode, errorMessage, detailedMessage) {
|
|
296
296
|
super(CMIElement, errorCode);
|
|
297
|
-
__publicField$
|
|
298
|
-
__publicField$
|
|
297
|
+
__publicField$14(this, "_errorMessage");
|
|
298
|
+
__publicField$14(this, "_detailedMessage", "");
|
|
299
299
|
this.message = `${CMIElement} : ${errorMessage}`;
|
|
300
300
|
this._errorMessage = errorMessage;
|
|
301
301
|
if (detailedMessage) {
|
|
@@ -600,14 +600,14 @@ this.Scorm2004API = (function () {
|
|
|
600
600
|
DEPENDENCY_NOT_ESTABLISHED: 408
|
|
601
601
|
};
|
|
602
602
|
|
|
603
|
-
var __defProp$
|
|
604
|
-
var __defNormalProp$
|
|
603
|
+
var __defProp$13 = Object.defineProperty;
|
|
604
|
+
var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, {
|
|
605
605
|
enumerable: true,
|
|
606
606
|
configurable: true,
|
|
607
607
|
writable: true,
|
|
608
608
|
value
|
|
609
609
|
}) : obj[key] = value;
|
|
610
|
-
var __publicField$
|
|
610
|
+
var __publicField$13 = (obj, key, value) => __defNormalProp$13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
611
611
|
class CMIArray extends BaseCMI {
|
|
612
612
|
/**
|
|
613
613
|
* Constructor cmi *.n arrays
|
|
@@ -615,10 +615,10 @@ this.Scorm2004API = (function () {
|
|
|
615
615
|
*/
|
|
616
616
|
constructor(params) {
|
|
617
617
|
super(params.CMIElement);
|
|
618
|
-
__publicField$
|
|
619
|
-
__publicField$
|
|
620
|
-
__publicField$
|
|
621
|
-
__publicField$
|
|
618
|
+
__publicField$13(this, "_errorCode");
|
|
619
|
+
__publicField$13(this, "_errorClass");
|
|
620
|
+
__publicField$13(this, "__children");
|
|
621
|
+
__publicField$13(this, "childArray");
|
|
622
622
|
this.__children = params.children;
|
|
623
623
|
this._errorCode = params.errorCode ?? scorm12_errors.GENERAL;
|
|
624
624
|
this._errorClass = params.errorClass || BaseScormValidationError;
|
|
@@ -943,6 +943,11 @@ this.Scorm2004API = (function () {
|
|
|
943
943
|
progress_range: "0#1"
|
|
944
944
|
};
|
|
945
945
|
|
|
946
|
+
const PERFORMANCE_STEP_NAME = "^$|" + scorm2004_regex.CMIShortIdentifier;
|
|
947
|
+
const PERFORMANCE_CHARACTERSTRING = "(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}";
|
|
948
|
+
const PERFORMANCE_NUMERIC_RANGE = "(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?";
|
|
949
|
+
const CR_PERFORMANCE_STEP_ANSWER = "^(?:|" + PERFORMANCE_NUMERIC_RANGE + "|" + PERFORMANCE_CHARACTERSTRING + ")$";
|
|
950
|
+
const LR_PERFORMANCE_STEP_ANSWER = "^(?:|" + PERFORMANCE_CHARACTERSTRING + ")$";
|
|
946
951
|
const LearnerResponses = {
|
|
947
952
|
"true-false": {
|
|
948
953
|
format: "^true$|^false$",
|
|
@@ -977,8 +982,8 @@ this.Scorm2004API = (function () {
|
|
|
977
982
|
unique: false
|
|
978
983
|
},
|
|
979
984
|
performance: {
|
|
980
|
-
format:
|
|
981
|
-
format2:
|
|
985
|
+
format: PERFORMANCE_STEP_NAME,
|
|
986
|
+
format2: LR_PERFORMANCE_STEP_ANSWER,
|
|
982
987
|
max: 250,
|
|
983
988
|
delimiter: "[,]",
|
|
984
989
|
delimiter2: "[.]",
|
|
@@ -1054,10 +1059,10 @@ this.Scorm2004API = (function () {
|
|
|
1054
1059
|
delimiter2: "[.]",
|
|
1055
1060
|
unique: false,
|
|
1056
1061
|
duplicate: false,
|
|
1057
|
-
// step_name
|
|
1058
|
-
format:
|
|
1059
|
-
// step_answer
|
|
1060
|
-
format2:
|
|
1062
|
+
// step_name: optional short_identifier_type
|
|
1063
|
+
format: PERFORMANCE_STEP_NAME,
|
|
1064
|
+
// step_answer: optional characterstring (spaces allowed) or numeric range
|
|
1065
|
+
format2: CR_PERFORMANCE_STEP_ANSWER
|
|
1061
1066
|
},
|
|
1062
1067
|
sequencing: {
|
|
1063
1068
|
max: 36,
|
|
@@ -1094,14 +1099,14 @@ this.Scorm2004API = (function () {
|
|
|
1094
1099
|
|
|
1095
1100
|
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"];
|
|
1096
1101
|
|
|
1097
|
-
var __defProp$
|
|
1098
|
-
var __defNormalProp$
|
|
1102
|
+
var __defProp$12 = Object.defineProperty;
|
|
1103
|
+
var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, {
|
|
1099
1104
|
enumerable: true,
|
|
1100
1105
|
configurable: true,
|
|
1101
1106
|
writable: true,
|
|
1102
1107
|
value
|
|
1103
1108
|
}) : obj[key] = value;
|
|
1104
|
-
var __publicField$
|
|
1109
|
+
var __publicField$12 = (obj, key, value) => __defNormalProp$12(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1105
1110
|
class ScheduledCommit {
|
|
1106
1111
|
/**
|
|
1107
1112
|
* Constructor for ScheduledCommit
|
|
@@ -1110,10 +1115,10 @@ this.Scorm2004API = (function () {
|
|
|
1110
1115
|
* @param {string} callback
|
|
1111
1116
|
*/
|
|
1112
1117
|
constructor(API, when, callback) {
|
|
1113
|
-
__publicField$
|
|
1114
|
-
__publicField$
|
|
1115
|
-
__publicField$
|
|
1116
|
-
__publicField$
|
|
1118
|
+
__publicField$12(this, "_API");
|
|
1119
|
+
__publicField$12(this, "_cancelled", false);
|
|
1120
|
+
__publicField$12(this, "_timeout");
|
|
1121
|
+
__publicField$12(this, "_callback");
|
|
1117
1122
|
this._API = API;
|
|
1118
1123
|
this._timeout = setTimeout(this.wrapper.bind(this), when);
|
|
1119
1124
|
this._callback = callback;
|
|
@@ -1141,14 +1146,14 @@ this.Scorm2004API = (function () {
|
|
|
1141
1146
|
|
|
1142
1147
|
const HIDE_LMS_UI_TOKENS = ["continue", "previous", "exit", "exitAll", "abandon", "abandonAll", "suspendAll"];
|
|
1143
1148
|
|
|
1144
|
-
var __defProp$
|
|
1145
|
-
var __defNormalProp$
|
|
1149
|
+
var __defProp$11 = Object.defineProperty;
|
|
1150
|
+
var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, {
|
|
1146
1151
|
enumerable: true,
|
|
1147
1152
|
configurable: true,
|
|
1148
1153
|
writable: true,
|
|
1149
1154
|
value
|
|
1150
1155
|
}) : obj[key] = value;
|
|
1151
|
-
var __publicField$
|
|
1156
|
+
var __publicField$11 = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1152
1157
|
var RuleConditionOperator = /* @__PURE__ */(RuleConditionOperator2 => {
|
|
1153
1158
|
RuleConditionOperator2["NOT"] = "not";
|
|
1154
1159
|
RuleConditionOperator2["AND"] = "and";
|
|
@@ -1181,10 +1186,10 @@ this.Scorm2004API = (function () {
|
|
|
1181
1186
|
let operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1182
1187
|
let parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /* @__PURE__ */new Map();
|
|
1183
1188
|
super("ruleCondition");
|
|
1184
|
-
__publicField$
|
|
1185
|
-
__publicField$
|
|
1186
|
-
__publicField$
|
|
1187
|
-
__publicField$
|
|
1189
|
+
__publicField$11(this, "_condition", "always" /* ALWAYS */);
|
|
1190
|
+
__publicField$11(this, "_operator", null);
|
|
1191
|
+
__publicField$11(this, "_parameters", /* @__PURE__ */new Map());
|
|
1192
|
+
__publicField$11(this, "_referencedObjective", null);
|
|
1188
1193
|
this._condition = condition;
|
|
1189
1194
|
this._operator = operator;
|
|
1190
1195
|
this._parameters = parameters;
|
|
@@ -1455,9 +1460,9 @@ this.Scorm2004API = (function () {
|
|
|
1455
1460
|
}
|
|
1456
1461
|
};
|
|
1457
1462
|
// Optional, overridable provider for current time (LMS may set via SequencingService)
|
|
1458
|
-
__publicField$
|
|
1463
|
+
__publicField$11(_RuleCondition, "_now", () => /* @__PURE__ */new Date());
|
|
1459
1464
|
// Optional, overridable hook for getting elapsed seconds
|
|
1460
|
-
__publicField$
|
|
1465
|
+
__publicField$11(_RuleCondition, "_getElapsedSecondsHook");
|
|
1461
1466
|
let RuleCondition = _RuleCondition;
|
|
1462
1467
|
class SequencingRule extends BaseCMI {
|
|
1463
1468
|
/**
|
|
@@ -1469,9 +1474,9 @@ this.Scorm2004API = (function () {
|
|
|
1469
1474
|
let action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "skip";
|
|
1470
1475
|
let conditionCombination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "and";
|
|
1471
1476
|
super("sequencingRule");
|
|
1472
|
-
__publicField$
|
|
1473
|
-
__publicField$
|
|
1474
|
-
__publicField$
|
|
1477
|
+
__publicField$11(this, "_conditions", []);
|
|
1478
|
+
__publicField$11(this, "_action", "skip" /* SKIP */);
|
|
1479
|
+
__publicField$11(this, "_conditionCombination", "and" /* AND */);
|
|
1475
1480
|
this._action = action;
|
|
1476
1481
|
this._conditionCombination = conditionCombination;
|
|
1477
1482
|
}
|
|
@@ -1584,9 +1589,9 @@ this.Scorm2004API = (function () {
|
|
|
1584
1589
|
*/
|
|
1585
1590
|
constructor() {
|
|
1586
1591
|
super("sequencingRules");
|
|
1587
|
-
__publicField$
|
|
1588
|
-
__publicField$
|
|
1589
|
-
__publicField$
|
|
1592
|
+
__publicField$11(this, "_preConditionRules", []);
|
|
1593
|
+
__publicField$11(this, "_exitConditionRules", []);
|
|
1594
|
+
__publicField$11(this, "_postConditionRules", []);
|
|
1590
1595
|
}
|
|
1591
1596
|
/**
|
|
1592
1597
|
* Called when the API needs to be reset
|
|
@@ -1703,9 +1708,17 @@ this.Scorm2004API = (function () {
|
|
|
1703
1708
|
}
|
|
1704
1709
|
}
|
|
1705
1710
|
|
|
1711
|
+
var __defProp$10 = Object.defineProperty;
|
|
1712
|
+
var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, {
|
|
1713
|
+
enumerable: true,
|
|
1714
|
+
configurable: true,
|
|
1715
|
+
writable: true,
|
|
1716
|
+
value
|
|
1717
|
+
}) : obj[key] = value;
|
|
1718
|
+
var __publicField$10 = (obj, key, value) => __defNormalProp$10(obj, key + "" , value);
|
|
1706
1719
|
class ActivityTreeQueries {
|
|
1707
1720
|
constructor(activityTree) {
|
|
1708
|
-
this
|
|
1721
|
+
__publicField$10(this, "activityTree", activityTree);
|
|
1709
1722
|
}
|
|
1710
1723
|
/**
|
|
1711
1724
|
* Check if activity is in the activity tree
|
|
@@ -1901,10 +1914,18 @@ this.Scorm2004API = (function () {
|
|
|
1901
1914
|
}
|
|
1902
1915
|
}
|
|
1903
1916
|
|
|
1917
|
+
var __defProp$$ = Object.defineProperty;
|
|
1918
|
+
var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, {
|
|
1919
|
+
enumerable: true,
|
|
1920
|
+
configurable: true,
|
|
1921
|
+
writable: true,
|
|
1922
|
+
value
|
|
1923
|
+
}) : obj[key] = value;
|
|
1924
|
+
var __publicField$$ = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1904
1925
|
class ChoiceConstraintValidator {
|
|
1905
1926
|
constructor(activityTree, treeQueries) {
|
|
1906
|
-
this
|
|
1907
|
-
this
|
|
1927
|
+
__publicField$$(this, "activityTree", activityTree);
|
|
1928
|
+
__publicField$$(this, "treeQueries", treeQueries);
|
|
1908
1929
|
}
|
|
1909
1930
|
/**
|
|
1910
1931
|
* Main entry point - consolidates ALL constraint validation for choice navigation
|
|
@@ -2356,14 +2377,14 @@ this.Scorm2004API = (function () {
|
|
|
2356
2377
|
}
|
|
2357
2378
|
}
|
|
2358
2379
|
|
|
2359
|
-
var __defProp$
|
|
2360
|
-
var __defNormalProp$
|
|
2380
|
+
var __defProp$_ = Object.defineProperty;
|
|
2381
|
+
var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, {
|
|
2361
2382
|
enumerable: true,
|
|
2362
2383
|
configurable: true,
|
|
2363
2384
|
writable: true,
|
|
2364
2385
|
value
|
|
2365
2386
|
}) : obj[key] = value;
|
|
2366
|
-
var __publicField$
|
|
2387
|
+
var __publicField$_ = (obj, key, value) => __defNormalProp$_(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2367
2388
|
var SequencingRequestType = /* @__PURE__ */(SequencingRequestType2 => {
|
|
2368
2389
|
SequencingRequestType2["START"] = "start";
|
|
2369
2390
|
SequencingRequestType2["RESUME_ALL"] = "resumeAll";
|
|
@@ -2392,10 +2413,10 @@ this.Scorm2004API = (function () {
|
|
|
2392
2413
|
let targetActivity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2393
2414
|
let exception = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2394
2415
|
let endSequencingSession = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2395
|
-
__publicField$
|
|
2396
|
-
__publicField$
|
|
2397
|
-
__publicField$
|
|
2398
|
-
__publicField$
|
|
2416
|
+
__publicField$_(this, "deliveryRequest");
|
|
2417
|
+
__publicField$_(this, "targetActivity");
|
|
2418
|
+
__publicField$_(this, "exception");
|
|
2419
|
+
__publicField$_(this, "endSequencingSession");
|
|
2399
2420
|
this.deliveryRequest = deliveryRequest;
|
|
2400
2421
|
this.targetActivity = targetActivity;
|
|
2401
2422
|
this.exception = exception;
|
|
@@ -2406,10 +2427,10 @@ this.Scorm2004API = (function () {
|
|
|
2406
2427
|
constructor(identifiedActivity, deliverable) {
|
|
2407
2428
|
let exception = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2408
2429
|
let endSequencingSession = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2409
|
-
__publicField$
|
|
2410
|
-
__publicField$
|
|
2411
|
-
__publicField$
|
|
2412
|
-
__publicField$
|
|
2430
|
+
__publicField$_(this, "identifiedActivity");
|
|
2431
|
+
__publicField$_(this, "deliverable");
|
|
2432
|
+
__publicField$_(this, "exception");
|
|
2433
|
+
__publicField$_(this, "endSequencingSession");
|
|
2413
2434
|
this.identifiedActivity = identifiedActivity;
|
|
2414
2435
|
this.deliverable = deliverable;
|
|
2415
2436
|
this.exception = exception;
|
|
@@ -2419,8 +2440,8 @@ this.Scorm2004API = (function () {
|
|
|
2419
2440
|
class ChoiceTraversalResult {
|
|
2420
2441
|
constructor(activity) {
|
|
2421
2442
|
let exception = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2422
|
-
__publicField$
|
|
2423
|
-
__publicField$
|
|
2443
|
+
__publicField$_(this, "activity");
|
|
2444
|
+
__publicField$_(this, "exception");
|
|
2424
2445
|
this.activity = activity;
|
|
2425
2446
|
this.exception = exception;
|
|
2426
2447
|
}
|
|
@@ -2431,19 +2452,19 @@ this.Scorm2004API = (function () {
|
|
|
2431
2452
|
return FlowSubprocessMode2;
|
|
2432
2453
|
})(FlowSubprocessMode || {});
|
|
2433
2454
|
|
|
2434
|
-
var __defProp$
|
|
2435
|
-
var __defNormalProp$
|
|
2455
|
+
var __defProp$Z = Object.defineProperty;
|
|
2456
|
+
var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, {
|
|
2436
2457
|
enumerable: true,
|
|
2437
2458
|
configurable: true,
|
|
2438
2459
|
writable: true,
|
|
2439
2460
|
value
|
|
2440
2461
|
}) : obj[key] = value;
|
|
2441
|
-
var __publicField$
|
|
2462
|
+
var __publicField$Z = (obj, key, value) => __defNormalProp$Z(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2442
2463
|
class RuleEvaluationEngine {
|
|
2443
2464
|
constructor() {
|
|
2444
2465
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2445
|
-
__publicField$
|
|
2446
|
-
__publicField$
|
|
2466
|
+
__publicField$Z(this, "now");
|
|
2467
|
+
__publicField$Z(this, "getAttemptElapsedSecondsHook");
|
|
2447
2468
|
this.now = options.now || (() => /* @__PURE__ */new Date());
|
|
2448
2469
|
this.getAttemptElapsedSecondsHook = options.getAttemptElapsedSecondsHook || null;
|
|
2449
2470
|
}
|
|
@@ -2714,14 +2735,14 @@ this.Scorm2004API = (function () {
|
|
|
2714
2735
|
}
|
|
2715
2736
|
}
|
|
2716
2737
|
|
|
2717
|
-
var __defProp$
|
|
2718
|
-
var __defNormalProp$
|
|
2738
|
+
var __defProp$Y = Object.defineProperty;
|
|
2739
|
+
var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, {
|
|
2719
2740
|
enumerable: true,
|
|
2720
2741
|
configurable: true,
|
|
2721
2742
|
writable: true,
|
|
2722
2743
|
value
|
|
2723
2744
|
}) : obj[key] = value;
|
|
2724
|
-
var __publicField$
|
|
2745
|
+
var __publicField$Y = (obj, key, value) => __defNormalProp$Y(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2725
2746
|
var SelectionTiming = /* @__PURE__ */(SelectionTiming2 => {
|
|
2726
2747
|
SelectionTiming2["NEVER"] = "never";
|
|
2727
2748
|
SelectionTiming2["ONCE"] = "once";
|
|
@@ -2741,36 +2762,36 @@ this.Scorm2004API = (function () {
|
|
|
2741
2762
|
constructor() {
|
|
2742
2763
|
super("sequencingControls");
|
|
2743
2764
|
// Sequencing Control Modes
|
|
2744
|
-
__publicField$
|
|
2745
|
-
__publicField$
|
|
2746
|
-
__publicField$
|
|
2765
|
+
__publicField$Y(this, "_enabled", true);
|
|
2766
|
+
__publicField$Y(this, "_choice", true);
|
|
2767
|
+
__publicField$Y(this, "_choiceExit", true);
|
|
2747
2768
|
// Per SCORM 2004 Sequencing & Navigation, flow defaults to true
|
|
2748
|
-
__publicField$
|
|
2749
|
-
__publicField$
|
|
2750
|
-
__publicField$
|
|
2751
|
-
__publicField$
|
|
2769
|
+
__publicField$Y(this, "_flow", true);
|
|
2770
|
+
__publicField$Y(this, "_forwardOnly", false);
|
|
2771
|
+
__publicField$Y(this, "_useCurrentAttemptObjectiveInfo", true);
|
|
2772
|
+
__publicField$Y(this, "_useCurrentAttemptProgressInfo", true);
|
|
2752
2773
|
// Constrain Choice Controls
|
|
2753
|
-
__publicField$
|
|
2754
|
-
__publicField$
|
|
2774
|
+
__publicField$Y(this, "_preventActivation", false);
|
|
2775
|
+
__publicField$Y(this, "_constrainChoice", false);
|
|
2755
2776
|
// Rule-driven traversal limiter (e.g., post-condition stopForwardTraversal)
|
|
2756
|
-
__publicField$
|
|
2777
|
+
__publicField$Y(this, "_stopForwardTraversal", false);
|
|
2757
2778
|
// Rollup Controls
|
|
2758
|
-
__publicField$
|
|
2759
|
-
__publicField$
|
|
2760
|
-
__publicField$
|
|
2779
|
+
__publicField$Y(this, "_rollupObjectiveSatisfied", true);
|
|
2780
|
+
__publicField$Y(this, "_rollupProgressCompletion", true);
|
|
2781
|
+
__publicField$Y(this, "_objectiveMeasureWeight", 1);
|
|
2761
2782
|
// Selection Controls
|
|
2762
|
-
__publicField$
|
|
2763
|
-
__publicField$
|
|
2764
|
-
__publicField$
|
|
2765
|
-
__publicField$
|
|
2783
|
+
__publicField$Y(this, "_selectionTiming", "never" /* NEVER */);
|
|
2784
|
+
__publicField$Y(this, "_selectCount", null);
|
|
2785
|
+
__publicField$Y(this, "_selectionCountStatus", false);
|
|
2786
|
+
__publicField$Y(this, "_randomizeChildren", false);
|
|
2766
2787
|
// Randomization Controls
|
|
2767
|
-
__publicField$
|
|
2768
|
-
__publicField$
|
|
2788
|
+
__publicField$Y(this, "_randomizationTiming", "never" /* NEVER */);
|
|
2789
|
+
__publicField$Y(this, "_reorderChildren", false);
|
|
2769
2790
|
// Auto-completion/satisfaction controls
|
|
2770
|
-
__publicField$
|
|
2771
|
-
__publicField$
|
|
2791
|
+
__publicField$Y(this, "_completionSetByContent", false);
|
|
2792
|
+
__publicField$Y(this, "_objectiveSetByContent", false);
|
|
2772
2793
|
// Delivery Controls
|
|
2773
|
-
__publicField$
|
|
2794
|
+
__publicField$Y(this, "_tracked", true);
|
|
2774
2795
|
}
|
|
2775
2796
|
/**
|
|
2776
2797
|
* Reset the sequencing controls to their default values
|
|
@@ -3331,10 +3352,18 @@ this.Scorm2004API = (function () {
|
|
|
3331
3352
|
}
|
|
3332
3353
|
}
|
|
3333
3354
|
|
|
3355
|
+
var __defProp$X = Object.defineProperty;
|
|
3356
|
+
var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, {
|
|
3357
|
+
enumerable: true,
|
|
3358
|
+
configurable: true,
|
|
3359
|
+
writable: true,
|
|
3360
|
+
value
|
|
3361
|
+
}) : obj[key] = value;
|
|
3362
|
+
var __publicField$X = (obj, key, value) => __defNormalProp$X(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3334
3363
|
class FlowTraversalService {
|
|
3335
3364
|
constructor(activityTree, ruleEngine) {
|
|
3336
|
-
this
|
|
3337
|
-
this
|
|
3365
|
+
__publicField$X(this, "activityTree", activityTree);
|
|
3366
|
+
__publicField$X(this, "ruleEngine", ruleEngine);
|
|
3338
3367
|
}
|
|
3339
3368
|
/**
|
|
3340
3369
|
* Flow Subprocess (SB.2.3)
|
|
@@ -3625,10 +3654,18 @@ this.Scorm2004API = (function () {
|
|
|
3625
3654
|
}
|
|
3626
3655
|
}
|
|
3627
3656
|
|
|
3657
|
+
var __defProp$W = Object.defineProperty;
|
|
3658
|
+
var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, {
|
|
3659
|
+
enumerable: true,
|
|
3660
|
+
configurable: true,
|
|
3661
|
+
writable: true,
|
|
3662
|
+
value
|
|
3663
|
+
}) : obj[key] = value;
|
|
3664
|
+
var __publicField$W = (obj, key, value) => __defNormalProp$W(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3628
3665
|
class FlowRequestHandler {
|
|
3629
3666
|
constructor(activityTree, traversalService) {
|
|
3630
|
-
this
|
|
3631
|
-
this
|
|
3667
|
+
__publicField$W(this, "activityTree", activityTree);
|
|
3668
|
+
__publicField$W(this, "traversalService", traversalService);
|
|
3632
3669
|
}
|
|
3633
3670
|
/**
|
|
3634
3671
|
* Start Sequencing Request Process (SB.2.5)
|
|
@@ -3746,12 +3783,20 @@ this.Scorm2004API = (function () {
|
|
|
3746
3783
|
}
|
|
3747
3784
|
}
|
|
3748
3785
|
|
|
3786
|
+
var __defProp$V = Object.defineProperty;
|
|
3787
|
+
var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, {
|
|
3788
|
+
enumerable: true,
|
|
3789
|
+
configurable: true,
|
|
3790
|
+
writable: true,
|
|
3791
|
+
value
|
|
3792
|
+
}) : obj[key] = value;
|
|
3793
|
+
var __publicField$V = (obj, key, value) => __defNormalProp$V(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3749
3794
|
class ChoiceRequestHandler {
|
|
3750
3795
|
constructor(activityTree, constraintValidator, traversalService, treeQueries) {
|
|
3751
|
-
this
|
|
3752
|
-
this
|
|
3753
|
-
this
|
|
3754
|
-
this
|
|
3796
|
+
__publicField$V(this, "activityTree", activityTree);
|
|
3797
|
+
__publicField$V(this, "constraintValidator", constraintValidator);
|
|
3798
|
+
__publicField$V(this, "traversalService", traversalService);
|
|
3799
|
+
__publicField$V(this, "treeQueries", treeQueries);
|
|
3755
3800
|
}
|
|
3756
3801
|
/**
|
|
3757
3802
|
* Choice Sequencing Request Process (SB.2.9)
|
|
@@ -3952,10 +3997,18 @@ this.Scorm2004API = (function () {
|
|
|
3952
3997
|
}
|
|
3953
3998
|
}
|
|
3954
3999
|
|
|
4000
|
+
var __defProp$U = Object.defineProperty;
|
|
4001
|
+
var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, {
|
|
4002
|
+
enumerable: true,
|
|
4003
|
+
configurable: true,
|
|
4004
|
+
writable: true,
|
|
4005
|
+
value
|
|
4006
|
+
}) : obj[key] = value;
|
|
4007
|
+
var __publicField$U = (obj, key, value) => __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3955
4008
|
class ExitRequestHandler {
|
|
3956
4009
|
constructor(activityTree, ruleEngine) {
|
|
3957
|
-
this
|
|
3958
|
-
this
|
|
4010
|
+
__publicField$U(this, "activityTree", activityTree);
|
|
4011
|
+
__publicField$U(this, "ruleEngine", ruleEngine);
|
|
3959
4012
|
}
|
|
3960
4013
|
/**
|
|
3961
4014
|
* Exit Sequencing Request Process (SB.2.11)
|
|
@@ -4068,10 +4121,18 @@ this.Scorm2004API = (function () {
|
|
|
4068
4121
|
}
|
|
4069
4122
|
}
|
|
4070
4123
|
|
|
4124
|
+
var __defProp$T = Object.defineProperty;
|
|
4125
|
+
var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, {
|
|
4126
|
+
enumerable: true,
|
|
4127
|
+
configurable: true,
|
|
4128
|
+
writable: true,
|
|
4129
|
+
value
|
|
4130
|
+
}) : obj[key] = value;
|
|
4131
|
+
var __publicField$T = (obj, key, value) => __defNormalProp$T(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4071
4132
|
class RetryRequestHandler {
|
|
4072
4133
|
constructor(activityTree, traversalService) {
|
|
4073
|
-
this
|
|
4074
|
-
this
|
|
4134
|
+
__publicField$T(this, "activityTree", activityTree);
|
|
4135
|
+
__publicField$T(this, "traversalService", traversalService);
|
|
4075
4136
|
}
|
|
4076
4137
|
/**
|
|
4077
4138
|
* Retry Sequencing Request Process (SB.2.10)
|
|
@@ -5026,7 +5087,13 @@ this.Scorm2004API = (function () {
|
|
|
5026
5087
|
if (!scorm2004) {
|
|
5027
5088
|
if (isFinalAttribute) {
|
|
5028
5089
|
if (typeof attribute === "undefined" || !this.context.checkObjectHasProperty(refObject, attribute)) {
|
|
5029
|
-
|
|
5090
|
+
if (attribute === "_children") {
|
|
5091
|
+
this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "CHILDREN_ERROR"));
|
|
5092
|
+
} else if (attribute === "_count") {
|
|
5093
|
+
this.context.throwSCORMError(CMIElement, getErrorCode(this.context.errorCodes, "COUNT_ERROR"));
|
|
5094
|
+
} else {
|
|
5095
|
+
this.context.throwSCORMError(CMIElement, invalidErrorCode, invalidErrorMessage);
|
|
5096
|
+
}
|
|
5030
5097
|
return {
|
|
5031
5098
|
error: true
|
|
5032
5099
|
};
|
|
@@ -5234,7 +5301,8 @@ this.Scorm2004API = (function () {
|
|
|
5234
5301
|
getNumericLevel(level) {
|
|
5235
5302
|
if (level === void 0) return LogLevelEnum.NONE;
|
|
5236
5303
|
if (typeof level === "number") return level;
|
|
5237
|
-
|
|
5304
|
+
const normalized = typeof level === "string" ? level.toUpperCase() : level;
|
|
5305
|
+
switch (normalized) {
|
|
5238
5306
|
case "1":
|
|
5239
5307
|
case "DEBUG":
|
|
5240
5308
|
return LogLevelEnum.DEBUG;
|
|
@@ -5615,7 +5683,7 @@ ${stackTrace}`);
|
|
|
5615
5683
|
* @param {Function} apiLog - The logging function
|
|
5616
5684
|
*/
|
|
5617
5685
|
constructor(settings, error_codes, apiLog) {
|
|
5618
|
-
this
|
|
5686
|
+
__publicField$L(this, "apiLog", apiLog);
|
|
5619
5687
|
__publicField$L(this, "settings");
|
|
5620
5688
|
__publicField$L(this, "error_codes");
|
|
5621
5689
|
__publicField$L(this, "storeName", "scorm_again_offline_data");
|
|
@@ -15279,19 +15347,20 @@ ${stackTrace}`);
|
|
|
15279
15347
|
if (errorCode === 143) returnValue = global_constants.SCORM_FALSE;
|
|
15280
15348
|
} else {
|
|
15281
15349
|
const result = this.storeData(false);
|
|
15282
|
-
|
|
15350
|
+
const errorCode = result.errorCode ?? 0;
|
|
15351
|
+
if (errorCode > 0) {
|
|
15283
15352
|
if (result.errorMessage) {
|
|
15284
15353
|
this.apiLog("commit", `Commit failed with error: ${result.errorMessage}`, LogLevelEnum.ERROR);
|
|
15285
15354
|
}
|
|
15286
15355
|
if (result.errorDetails) {
|
|
15287
15356
|
this.apiLog("commit", `Error details: ${JSON.stringify(result.errorDetails)}`, LogLevelEnum.DEBUG);
|
|
15288
15357
|
}
|
|
15289
|
-
this.throwSCORMError("api",
|
|
15358
|
+
this.throwSCORMError("api", errorCode);
|
|
15290
15359
|
}
|
|
15291
15360
|
const resultValue = result?.result ?? global_constants.SCORM_FALSE;
|
|
15292
15361
|
returnValue = typeof resultValue === "boolean" ? String(resultValue) : resultValue;
|
|
15293
15362
|
this.apiLog(callbackName, " Result: " + returnValue, LogLevelEnum.DEBUG, "HttpRequest");
|
|
15294
|
-
if (checkTerminated) this.lastErrorCode = "0";
|
|
15363
|
+
if (checkTerminated && errorCode === 0) this.lastErrorCode = "0";
|
|
15295
15364
|
this.processListeners(callbackName);
|
|
15296
15365
|
if (this.settings.enableOfflineSupport && this._offlineStorageService && this._offlineStorageService.isDeviceOnline() && this._courseId) {
|
|
15297
15366
|
this._offlineStorageService.hasPendingOfflineData(this._courseId).then(hasPendingData => {
|
|
@@ -16008,6 +16077,49 @@ ${stackTrace}`);
|
|
|
16008
16077
|
}
|
|
16009
16078
|
}
|
|
16010
16079
|
|
|
16080
|
+
function stripBrackets(delim) {
|
|
16081
|
+
return delim.replace(/[[\]]/g, "");
|
|
16082
|
+
}
|
|
16083
|
+
function escapeRegex(s) {
|
|
16084
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16085
|
+
}
|
|
16086
|
+
function splitDelimited(value, bracketed) {
|
|
16087
|
+
if (!bracketed) {
|
|
16088
|
+
return [value];
|
|
16089
|
+
}
|
|
16090
|
+
if (value.includes(bracketed)) {
|
|
16091
|
+
return value.split(bracketed);
|
|
16092
|
+
}
|
|
16093
|
+
const bare = stripBrackets(bracketed);
|
|
16094
|
+
if (!bare) {
|
|
16095
|
+
return [value];
|
|
16096
|
+
}
|
|
16097
|
+
const splitRe = new RegExp(`(?<!\\\\)${escapeRegex(bare)}`, "g");
|
|
16098
|
+
const unescapeRe = new RegExp(`\\\\${escapeRegex(bare)}`, "g");
|
|
16099
|
+
return value.split(splitRe).map(part => part.replace(unescapeRe, bare));
|
|
16100
|
+
}
|
|
16101
|
+
function splitFirstDelimited(value, bracketed) {
|
|
16102
|
+
if (!bracketed) {
|
|
16103
|
+
return [value];
|
|
16104
|
+
}
|
|
16105
|
+
if (value.includes(bracketed)) {
|
|
16106
|
+
const idx = value.indexOf(bracketed);
|
|
16107
|
+
return [value.slice(0, idx), value.slice(idx + bracketed.length)];
|
|
16108
|
+
}
|
|
16109
|
+
const bare = stripBrackets(bracketed);
|
|
16110
|
+
if (!bare) {
|
|
16111
|
+
return [value];
|
|
16112
|
+
}
|
|
16113
|
+
const splitRe = new RegExp(`(?<!\\\\)${escapeRegex(bare)}`);
|
|
16114
|
+
const unescapeRe = new RegExp(`\\\\${escapeRegex(bare)}`, "g");
|
|
16115
|
+
const parts = value.split(splitRe);
|
|
16116
|
+
const first = (parts[0] ?? "").replace(unescapeRe, bare);
|
|
16117
|
+
if (parts.length === 1) {
|
|
16118
|
+
return [first];
|
|
16119
|
+
}
|
|
16120
|
+
return [first, parts.slice(1).join(bare).replace(unescapeRe, bare)];
|
|
16121
|
+
}
|
|
16122
|
+
|
|
16011
16123
|
var __defProp$m = Object.defineProperty;
|
|
16012
16124
|
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, {
|
|
16013
16125
|
enumerable: true,
|
|
@@ -16203,8 +16315,7 @@ ${stackTrace}`);
|
|
|
16203
16315
|
const response_type = LearnerResponses[this.type];
|
|
16204
16316
|
if (response_type) {
|
|
16205
16317
|
if (response_type?.delimiter) {
|
|
16206
|
-
|
|
16207
|
-
nodes = learner_response.split(delimiter);
|
|
16318
|
+
nodes = splitDelimited(learner_response, response_type.delimiter);
|
|
16208
16319
|
} else {
|
|
16209
16320
|
nodes[0] = learner_response;
|
|
16210
16321
|
}
|
|
@@ -16212,10 +16323,10 @@ ${stackTrace}`);
|
|
|
16212
16323
|
const formatRegex = new RegExp(response_type.format);
|
|
16213
16324
|
for (let i = 0; i < nodes.length; i++) {
|
|
16214
16325
|
if (response_type?.delimiter2) {
|
|
16215
|
-
const
|
|
16216
|
-
const values =
|
|
16326
|
+
const node = nodes[i] ?? "";
|
|
16327
|
+
const values = this.type === "performance" ? splitFirstDelimited(node, response_type.delimiter2) : splitDelimited(node, response_type.delimiter2);
|
|
16217
16328
|
if (values?.length === 2) {
|
|
16218
|
-
if (this.type === "performance" &&
|
|
16329
|
+
if (this.type === "performance" && values[0] === "" && values[1] === "") {
|
|
16219
16330
|
throw new Scorm2004ValidationError(this._cmi_element + ".learner_response", scorm2004_errors.TYPE_MISMATCH);
|
|
16220
16331
|
}
|
|
16221
16332
|
if (!values[0]?.match(formatRegex)) {
|
|
@@ -16396,37 +16507,19 @@ ${stackTrace}`);
|
|
|
16396
16507
|
return result;
|
|
16397
16508
|
}
|
|
16398
16509
|
}
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
}
|
|
16405
|
-
function splitUnescaped(text, delim) {
|
|
16406
|
-
const reDelim = escapeRegex(delim);
|
|
16407
|
-
const splitRe = new RegExp(`(?<!\\\\)${reDelim}`, "g");
|
|
16408
|
-
const unescapeRe = new RegExp(`\\\\${reDelim}`, "g");
|
|
16409
|
-
return text.split(splitRe).map(part => part.replace(unescapeRe, delim));
|
|
16410
|
-
}
|
|
16411
|
-
function splitFirstUnescaped(text, delim) {
|
|
16412
|
-
const reDelim = escapeRegex(delim);
|
|
16413
|
-
const splitRe = new RegExp(`(?<!\\\\)${reDelim}`);
|
|
16414
|
-
const unescapeRe = new RegExp(`\\\\${reDelim}`, "g");
|
|
16415
|
-
const parts = text.split(splitRe);
|
|
16416
|
-
const firstPart = parts[0] ?? "";
|
|
16417
|
-
if (parts.length === 1) {
|
|
16418
|
-
return [firstPart.replace(unescapeRe, delim)];
|
|
16510
|
+
const RESPONSE_PREFIX_RE = /^\{(?:lang|case_matters|order_matters)=[^}]+\}/;
|
|
16511
|
+
function stripResponsePrefixes(node) {
|
|
16512
|
+
let result = node;
|
|
16513
|
+
while (RESPONSE_PREFIX_RE.test(result)) {
|
|
16514
|
+
result = result.replace(RESPONSE_PREFIX_RE, "");
|
|
16419
16515
|
}
|
|
16420
|
-
|
|
16421
|
-
const part2 = parts.slice(1).join(delim).replace(unescapeRe, delim);
|
|
16422
|
-
return [part1, part2];
|
|
16516
|
+
return result;
|
|
16423
16517
|
}
|
|
16424
16518
|
function validatePattern(type, pattern, responseDef) {
|
|
16425
16519
|
if (pattern.trim() !== pattern) {
|
|
16426
16520
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16427
16521
|
}
|
|
16428
|
-
const
|
|
16429
|
-
const rawNodes = subDelim1 ? splitUnescaped(pattern, subDelim1) : [pattern];
|
|
16522
|
+
const rawNodes = responseDef.delimiter ? splitDelimited(pattern, responseDef.delimiter) : [pattern];
|
|
16430
16523
|
for (const raw of rawNodes) {
|
|
16431
16524
|
if (raw.trim() !== raw) {
|
|
16432
16525
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
@@ -16435,17 +16528,11 @@ ${stackTrace}`);
|
|
|
16435
16528
|
if (type === "fill-in" && pattern === "") {
|
|
16436
16529
|
return;
|
|
16437
16530
|
}
|
|
16438
|
-
const
|
|
16439
|
-
let nodes;
|
|
16440
|
-
if (delim1) {
|
|
16441
|
-
nodes = splitUnescaped(pattern, delim1);
|
|
16442
|
-
} else {
|
|
16443
|
-
nodes = [pattern];
|
|
16444
|
-
}
|
|
16531
|
+
const nodes = responseDef.delimiter ? splitDelimited(pattern, responseDef.delimiter) : [pattern];
|
|
16445
16532
|
if (!responseDef.delimiter && pattern.includes(",")) {
|
|
16446
16533
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16447
16534
|
}
|
|
16448
|
-
if (responseDef.unique || responseDef.duplicate === false) {
|
|
16535
|
+
if (type !== "numeric" && (responseDef.unique || responseDef.duplicate === false)) {
|
|
16449
16536
|
const seen = new Set(nodes);
|
|
16450
16537
|
if (seen.size !== nodes.length) {
|
|
16451
16538
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
@@ -16465,8 +16552,7 @@ ${stackTrace}`);
|
|
|
16465
16552
|
if (!delimBracketed) {
|
|
16466
16553
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16467
16554
|
}
|
|
16468
|
-
const
|
|
16469
|
-
const parts = value.split(new RegExp(`(?<!\\\\)${escapeRegex(delim)}`, "g")).map(n => n.replace(new RegExp(`\\\\${escapeRegex(delim)}`, "g"), delim));
|
|
16555
|
+
const parts = splitDelimited(value, delimBracketed);
|
|
16470
16556
|
if (parts.length !== 2 || parts[0] === "" || parts[1] === "") {
|
|
16471
16557
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16472
16558
|
}
|
|
@@ -16478,12 +16564,14 @@ ${stackTrace}`);
|
|
|
16478
16564
|
switch (type) {
|
|
16479
16565
|
case "numeric":
|
|
16480
16566
|
{
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
|
|
16567
|
+
if (node === "") {
|
|
16568
|
+
const bracketedRange = nodes.length >= 2 && !!responseDef.delimiter && pattern.includes(responseDef.delimiter);
|
|
16569
|
+
if (!bracketedRange) {
|
|
16570
|
+
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16571
|
+
}
|
|
16572
|
+
break;
|
|
16485
16573
|
}
|
|
16486
|
-
|
|
16574
|
+
checkSingle(node);
|
|
16487
16575
|
break;
|
|
16488
16576
|
}
|
|
16489
16577
|
case "performance":
|
|
@@ -16492,13 +16580,13 @@ ${stackTrace}`);
|
|
|
16492
16580
|
if (!delimBracketed) {
|
|
16493
16581
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16494
16582
|
}
|
|
16495
|
-
const
|
|
16496
|
-
const parts =
|
|
16583
|
+
const record = stripResponsePrefixes(node);
|
|
16584
|
+
const parts = splitFirstDelimited(record, delimBracketed);
|
|
16497
16585
|
if (parts.length !== 2) {
|
|
16498
16586
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16499
16587
|
}
|
|
16500
16588
|
const [part1, part2] = parts;
|
|
16501
|
-
if (part1 === ""
|
|
16589
|
+
if (part1 === "" && part2 === "") {
|
|
16502
16590
|
throw new Scorm2004ValidationError("cmi.interactions.n.correct_responses.n.pattern", scorm2004_errors.TYPE_MISMATCH);
|
|
16503
16591
|
}
|
|
16504
16592
|
if (part1 === void 0 || !fmt1.test(part1)) {
|
|
@@ -19453,7 +19541,7 @@ ${stackTrace}`);
|
|
|
19453
19541
|
checkValidResponseType(CMIElement, response_type, value, interaction_type) {
|
|
19454
19542
|
let nodes = [];
|
|
19455
19543
|
if (response_type?.delimiter) {
|
|
19456
|
-
nodes = String(value)
|
|
19544
|
+
nodes = splitDelimited(String(value), response_type.delimiter);
|
|
19457
19545
|
} else {
|
|
19458
19546
|
nodes[0] = value;
|
|
19459
19547
|
}
|
|
@@ -19551,26 +19639,33 @@ ${stackTrace}`);
|
|
|
19551
19639
|
nodes[i] = this.removeCorrectResponsePrefixes(CMIElement, nodes[i]);
|
|
19552
19640
|
}
|
|
19553
19641
|
if (response?.delimiter2) {
|
|
19554
|
-
const values = nodes[i].
|
|
19642
|
+
const values = interaction_type === "performance" ? splitFirstDelimited(nodes[i], response.delimiter2) : splitDelimited(nodes[i], response.delimiter2);
|
|
19555
19643
|
if (values.length === 2) {
|
|
19556
|
-
|
|
19557
|
-
if (!matches) {
|
|
19644
|
+
if (interaction_type === "performance" && values[0] === "" && values[1] === "") {
|
|
19558
19645
|
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19559
19646
|
} else {
|
|
19560
|
-
|
|
19647
|
+
const matches = values[0]?.match(formatRegex);
|
|
19648
|
+
if (!matches) {
|
|
19561
19649
|
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19650
|
+
} else {
|
|
19651
|
+
if (!response.format2 || !values[1]?.match(new RegExp(response.format2))) {
|
|
19652
|
+
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19653
|
+
}
|
|
19562
19654
|
}
|
|
19563
19655
|
}
|
|
19564
19656
|
} else {
|
|
19565
19657
|
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19566
19658
|
}
|
|
19567
19659
|
} else {
|
|
19660
|
+
if (interaction_type === "numeric" && nodes.length > 1 && nodes[i] === "" && !!response.delimiter && String(value).includes(response.delimiter)) {
|
|
19661
|
+
continue;
|
|
19662
|
+
}
|
|
19568
19663
|
const matches = nodes[i].match(formatRegex);
|
|
19569
19664
|
if (!matches && value !== "" || !matches && interaction_type === "true-false") {
|
|
19570
19665
|
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19571
19666
|
} else {
|
|
19572
19667
|
if (interaction_type === "numeric" && nodes.length > 1) {
|
|
19573
|
-
if (Number(nodes[0]) > Number(nodes[1])) {
|
|
19668
|
+
if (nodes[0] !== "" && nodes[1] !== "" && Number(nodes[0]) > Number(nodes[1])) {
|
|
19574
19669
|
this.context.throwSCORMError(CMIElement, scorm2004_errors.TYPE_MISMATCH, `${interaction_type}: ${value}`);
|
|
19575
19670
|
}
|
|
19576
19671
|
} else {
|