scorm-again 2.6.7 → 2.6.8
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/.claude/settings.local.json +93 -2
- package/dist/aicc.js +3083 -3058
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +1 -1
- package/dist/aicc.min.js.map +1 -1
- package/dist/esm/aicc.js +3102 -3083
- package/dist/esm/aicc.js.map +1 -1
- package/dist/esm/aicc.min.js +1 -1
- package/dist/esm/aicc.min.js.map +1 -1
- package/dist/esm/scorm-again.js +5605 -5580
- 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 +2822 -2797
- 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 +1955 -1936
- 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 +5605 -5580
- 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 +2821 -2796
- 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 +1798 -1773
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/examples/react-native-offline/.claude/settings.local.json +31 -0
- package/package.json +2 -1
- package/src/Scorm2004API.ts +2 -2
- package/src/constants/default_settings.ts +2 -2
- package/.claude/.claude/settings.local.json +0 -13
package/dist/esm/scorm2004.js
CHANGED
|
@@ -1,1254 +1,137 @@
|
|
|
1
1
|
/******/ var __webpack_modules__ = ({
|
|
2
2
|
|
|
3
|
-
/***/
|
|
3
|
+
/***/ 56:
|
|
4
4
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5
5
|
|
|
6
|
-
// ESM COMPAT FLAG
|
|
7
6
|
__webpack_require__.r(__webpack_exports__);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
/* harmony export */ CompletionStatus: function() { return /* binding */ CompletionStatus; },
|
|
9
|
+
/* harmony export */ LogLevelEnum: function() { return /* binding */ LogLevelEnum; },
|
|
10
|
+
/* harmony export */ NAVBoolean: function() { return /* binding */ NAVBoolean; },
|
|
11
|
+
/* harmony export */ SuccessStatus: function() { return /* binding */ SuccessStatus; }
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
var NAVBoolean;
|
|
14
|
+
(function (NAVBoolean) {
|
|
15
|
+
NAVBoolean["unknown"] = "unknown";
|
|
16
|
+
NAVBoolean["true"] = "true";
|
|
17
|
+
NAVBoolean["false"] = "false";
|
|
18
|
+
})(NAVBoolean || (NAVBoolean = {}));
|
|
19
|
+
var SuccessStatus;
|
|
20
|
+
(function (SuccessStatus) {
|
|
21
|
+
SuccessStatus["passed"] = "passed";
|
|
22
|
+
SuccessStatus["failed"] = "failed";
|
|
23
|
+
SuccessStatus["unknown"] = "unknown";
|
|
24
|
+
})(SuccessStatus || (SuccessStatus = {}));
|
|
25
|
+
var CompletionStatus;
|
|
26
|
+
(function (CompletionStatus) {
|
|
27
|
+
CompletionStatus["completed"] = "completed";
|
|
28
|
+
CompletionStatus["incomplete"] = "incomplete";
|
|
29
|
+
CompletionStatus["unknown"] = "unknown";
|
|
30
|
+
})(CompletionStatus || (CompletionStatus = {}));
|
|
31
|
+
var LogLevelEnum;
|
|
32
|
+
(function (LogLevelEnum) {
|
|
33
|
+
LogLevelEnum[LogLevelEnum["_"] = 0] = "_";
|
|
34
|
+
LogLevelEnum[LogLevelEnum["DEBUG"] = 1] = "DEBUG";
|
|
35
|
+
LogLevelEnum[LogLevelEnum["INFO"] = 2] = "INFO";
|
|
36
|
+
LogLevelEnum[LogLevelEnum["WARN"] = 3] = "WARN";
|
|
37
|
+
LogLevelEnum[LogLevelEnum["ERROR"] = 4] = "ERROR";
|
|
38
|
+
LogLevelEnum[LogLevelEnum["NONE"] = 5] = "NONE";
|
|
39
|
+
})(LogLevelEnum || (LogLevelEnum = {}));
|
|
27
40
|
|
|
28
41
|
|
|
42
|
+
/***/ }),
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
autocommitSeconds: 10,
|
|
33
|
-
asyncCommit: false,
|
|
34
|
-
sendFullCommit: true,
|
|
35
|
-
lmsCommitUrl: false,
|
|
36
|
-
dataCommitFormat: "json",
|
|
37
|
-
commitRequestDataType: "application/json;charset=UTF-8",
|
|
38
|
-
autoProgress: false,
|
|
39
|
-
logLevel: enums.LogLevelEnum.ERROR,
|
|
40
|
-
selfReportSessionTime: false,
|
|
41
|
-
alwaysSendTotalTime: false,
|
|
42
|
-
renderCommonCommitFields: false,
|
|
43
|
-
strict_errors: true,
|
|
44
|
-
xhrHeaders: {},
|
|
45
|
-
xhrWithCredentials: false,
|
|
46
|
-
fetchMode: "cors",
|
|
47
|
-
responseHandler: function (response) {
|
|
48
|
-
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
49
|
-
var responseText, httpResult;
|
|
50
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
51
|
-
switch (_a.label) {
|
|
52
|
-
case 0:
|
|
53
|
-
if (!(typeof response !== "undefined")) return [3, 2];
|
|
54
|
-
return [4, response.text()];
|
|
55
|
-
case 1:
|
|
56
|
-
responseText = _a.sent();
|
|
57
|
-
httpResult = null;
|
|
58
|
-
if (responseText) {
|
|
59
|
-
httpResult = JSON.parse(responseText);
|
|
60
|
-
}
|
|
61
|
-
if (httpResult === null ||
|
|
62
|
-
!{}.hasOwnProperty.call(httpResult, "result")) {
|
|
63
|
-
if (response.status === 200) {
|
|
64
|
-
return [2, {
|
|
65
|
-
result: api_constants.global_constants.SCORM_TRUE,
|
|
66
|
-
errorCode: 0
|
|
67
|
-
}];
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return [2, {
|
|
71
|
-
result: api_constants.global_constants.SCORM_FALSE,
|
|
72
|
-
errorCode: 101
|
|
73
|
-
}];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return [2, {
|
|
78
|
-
result: httpResult.result,
|
|
79
|
-
errorCode: httpResult.errorCode
|
|
80
|
-
? httpResult.errorCode
|
|
81
|
-
: httpResult.result === api_constants.global_constants.SCORM_TRUE
|
|
82
|
-
? 0
|
|
83
|
-
: 101
|
|
84
|
-
}];
|
|
85
|
-
}
|
|
86
|
-
_a.label = 2;
|
|
87
|
-
case 2: return [2, {
|
|
88
|
-
result: api_constants.global_constants.SCORM_FALSE,
|
|
89
|
-
errorCode: 101
|
|
90
|
-
}];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
requestHandler: function (commitObject) {
|
|
96
|
-
return commitObject;
|
|
97
|
-
},
|
|
98
|
-
onLogMessage: function (messageLevel, logMessage) {
|
|
99
|
-
switch (messageLevel) {
|
|
100
|
-
case "4":
|
|
101
|
-
case 4:
|
|
102
|
-
case "ERROR":
|
|
103
|
-
case enums.LogLevelEnum.ERROR:
|
|
104
|
-
console.error(logMessage);
|
|
105
|
-
break;
|
|
106
|
-
case "3":
|
|
107
|
-
case 3:
|
|
108
|
-
case "WARN":
|
|
109
|
-
case enums.LogLevelEnum.WARN:
|
|
110
|
-
console.warn(logMessage);
|
|
111
|
-
break;
|
|
112
|
-
case "2":
|
|
113
|
-
case 2:
|
|
114
|
-
case "INFO":
|
|
115
|
-
case enums.LogLevelEnum.INFO:
|
|
116
|
-
console.info(logMessage);
|
|
117
|
-
break;
|
|
118
|
-
case "1":
|
|
119
|
-
case 1:
|
|
120
|
-
case "DEBUG":
|
|
121
|
-
case enums.LogLevelEnum.DEBUG:
|
|
122
|
-
if (console.debug) {
|
|
123
|
-
console.debug(logMessage);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
console.log(logMessage);
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
scoItemIds: [],
|
|
132
|
-
scoItemIdValidator: false,
|
|
133
|
-
globalObjectiveIds: []
|
|
134
|
-
};
|
|
44
|
+
/***/ 319:
|
|
45
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
135
46
|
|
|
136
|
-
|
|
47
|
+
__webpack_require__.r(__webpack_exports__);
|
|
48
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
49
|
+
/* harmony export */ BaseCMI: function() { return /* binding */ BaseCMI; },
|
|
50
|
+
/* harmony export */ BaseRootCMI: function() { return /* binding */ BaseRootCMI; }
|
|
51
|
+
/* harmony export */ });
|
|
52
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
137
53
|
|
|
138
|
-
var
|
|
139
|
-
function
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
this._timeout = setTimeout(this.wrapper.bind(this), when);
|
|
143
|
-
this._callback = callback;
|
|
54
|
+
var BaseCMI = (function () {
|
|
55
|
+
function BaseCMI() {
|
|
56
|
+
this.jsonString = false;
|
|
57
|
+
this._initialized = false;
|
|
144
58
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
59
|
+
Object.defineProperty(BaseCMI.prototype, "initialized", {
|
|
60
|
+
get: function () {
|
|
61
|
+
return this._initialized;
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(BaseCMI.prototype, "start_time", {
|
|
67
|
+
get: function () {
|
|
68
|
+
return this._start_time;
|
|
69
|
+
},
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true
|
|
72
|
+
});
|
|
73
|
+
BaseCMI.prototype.initialize = function () {
|
|
74
|
+
this._initialized = true;
|
|
150
75
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (!this._cancelled) {
|
|
154
|
-
(function () { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () { return (0,tslib_es6.__generator)(this, function (_a) {
|
|
155
|
-
switch (_a.label) {
|
|
156
|
-
case 0: return [4, this._API.commit(this._callback)];
|
|
157
|
-
case 1: return [2, _a.sent()];
|
|
158
|
-
}
|
|
159
|
-
}); }); })();
|
|
160
|
-
}
|
|
76
|
+
BaseCMI.prototype.setStartTime = function () {
|
|
77
|
+
this._start_time = new Date().getTime();
|
|
161
78
|
};
|
|
162
|
-
return
|
|
79
|
+
return BaseCMI;
|
|
163
80
|
}());
|
|
164
81
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
82
|
+
var BaseRootCMI = (function (_super) {
|
|
83
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BaseRootCMI, _super);
|
|
84
|
+
function BaseRootCMI() {
|
|
85
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
86
|
+
}
|
|
87
|
+
return BaseRootCMI;
|
|
88
|
+
}(BaseCMI));
|
|
169
89
|
|
|
170
90
|
|
|
171
91
|
|
|
92
|
+
/***/ }),
|
|
172
93
|
|
|
94
|
+
/***/ 340:
|
|
95
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
173
96
|
|
|
97
|
+
__webpack_require__.r(__webpack_exports__);
|
|
98
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
99
|
+
/* harmony export */ aicc_constants: function() { return /* binding */ aicc_constants; },
|
|
100
|
+
/* harmony export */ global_constants: function() { return /* binding */ global_constants; },
|
|
101
|
+
/* harmony export */ scorm12_constants: function() { return /* binding */ scorm12_constants; },
|
|
102
|
+
/* harmony export */ scorm2004_constants: function() { return /* binding */ scorm2004_constants; }
|
|
103
|
+
/* harmony export */ });
|
|
104
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
174
105
|
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this.clearScheduledCommit();
|
|
197
|
-
this.currentState = api_constants.global_constants.STATE_NOT_INITIALIZED;
|
|
198
|
-
this.lastErrorCode = "0";
|
|
199
|
-
this.listenerArray = [];
|
|
200
|
-
this.startingData = {};
|
|
201
|
-
};
|
|
202
|
-
BaseAPI.prototype.initialize = function (callbackName, initializeMessage, terminationMessage) {
|
|
203
|
-
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
204
|
-
if (this.isInitialized()) {
|
|
205
|
-
this.throwSCORMError(this._error_codes.INITIALIZED, initializeMessage);
|
|
206
|
-
}
|
|
207
|
-
else if (this.isTerminated()) {
|
|
208
|
-
this.throwSCORMError(this._error_codes.TERMINATED, terminationMessage);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
if (this.selfReportSessionTime) {
|
|
212
|
-
this.cmi.setStartTime();
|
|
213
|
-
}
|
|
214
|
-
this.currentState = api_constants.global_constants.STATE_INITIALIZED;
|
|
215
|
-
this.lastErrorCode = "0";
|
|
216
|
-
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
217
|
-
this.processListeners(callbackName);
|
|
218
|
-
}
|
|
219
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
220
|
-
this.clearSCORMError(returnValue);
|
|
221
|
-
return returnValue;
|
|
222
|
-
};
|
|
223
|
-
BaseAPI.prototype.apiLog = function (functionName, logMessage, messageLevel, CMIElement) {
|
|
224
|
-
logMessage = (0,utilities.formatMessage)(functionName, logMessage, CMIElement);
|
|
225
|
-
if (messageLevel >= this.apiLogLevel) {
|
|
226
|
-
this.settings.onLogMessage(messageLevel, logMessage);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
Object.defineProperty(BaseAPI.prototype, "error_codes", {
|
|
230
|
-
get: function () {
|
|
231
|
-
return this._error_codes;
|
|
106
|
+
var global_constants = {
|
|
107
|
+
SCORM_TRUE: "true",
|
|
108
|
+
SCORM_FALSE: "false",
|
|
109
|
+
STATE_NOT_INITIALIZED: 0,
|
|
110
|
+
STATE_INITIALIZED: 1,
|
|
111
|
+
STATE_TERMINATED: 2,
|
|
112
|
+
};
|
|
113
|
+
var scorm12_constants = {
|
|
114
|
+
cmi_children: "core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions",
|
|
115
|
+
core_children: "student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time",
|
|
116
|
+
score_children: "raw,min,max",
|
|
117
|
+
comments_children: "content,location,time",
|
|
118
|
+
objectives_children: "id,score,status",
|
|
119
|
+
correct_responses_children: "pattern",
|
|
120
|
+
student_data_children: "mastery_score,max_time_allowed,time_limit_action",
|
|
121
|
+
student_preference_children: "audio,language,speed,text",
|
|
122
|
+
interactions_children: "id,objectives,time,type,correct_responses,weighting,student_response,result,latency",
|
|
123
|
+
error_descriptions: {
|
|
124
|
+
"101": {
|
|
125
|
+
basicMessage: "General Exception",
|
|
126
|
+
detailMessage: "No specific error code exists to describe the error. Use LMSGetDiagnostic for more information",
|
|
232
127
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
Object.defineProperty(BaseAPI.prototype, "settings", {
|
|
237
|
-
get: function () {
|
|
238
|
-
return this._settings;
|
|
128
|
+
"201": {
|
|
129
|
+
basicMessage: "Invalid argument error",
|
|
130
|
+
detailMessage: "Indicates that an argument represents an invalid data model element or is otherwise incorrect.",
|
|
239
131
|
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
enumerable: false,
|
|
244
|
-
configurable: true
|
|
245
|
-
});
|
|
246
|
-
BaseAPI.prototype.terminate = function (callbackName, checkTerminated) {
|
|
247
|
-
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
248
|
-
var returnValue, result;
|
|
249
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
250
|
-
switch (_a.label) {
|
|
251
|
-
case 0:
|
|
252
|
-
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
253
|
-
if (!this.checkState(checkTerminated, this._error_codes.TERMINATION_BEFORE_INIT, this._error_codes.MULTIPLE_TERMINATION)) return [3, 2];
|
|
254
|
-
this.currentState = api_constants.global_constants.STATE_TERMINATED;
|
|
255
|
-
return [4, this.storeData(true)];
|
|
256
|
-
case 1:
|
|
257
|
-
result = _a.sent();
|
|
258
|
-
if (typeof result.errorCode !== "undefined" && result.errorCode > 0) {
|
|
259
|
-
this.throwSCORMError(result.errorCode);
|
|
260
|
-
}
|
|
261
|
-
returnValue =
|
|
262
|
-
typeof result !== "undefined" && (result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)
|
|
263
|
-
? api_constants.global_constants.SCORM_TRUE
|
|
264
|
-
: api_constants.global_constants.SCORM_FALSE;
|
|
265
|
-
if (checkTerminated)
|
|
266
|
-
this.lastErrorCode = "0";
|
|
267
|
-
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
268
|
-
this.processListeners(callbackName);
|
|
269
|
-
_a.label = 2;
|
|
270
|
-
case 2:
|
|
271
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
272
|
-
this.clearSCORMError(returnValue);
|
|
273
|
-
return [2, returnValue];
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
};
|
|
278
|
-
BaseAPI.prototype.getValue = function (callbackName, checkTerminated, CMIElement) {
|
|
279
|
-
var returnValue = "";
|
|
280
|
-
if (this.checkState(checkTerminated, this._error_codes.RETRIEVE_BEFORE_INIT, this._error_codes.RETRIEVE_AFTER_TERM)) {
|
|
281
|
-
if (checkTerminated)
|
|
282
|
-
this.lastErrorCode = "0";
|
|
283
|
-
try {
|
|
284
|
-
returnValue = this.getCMIValue(CMIElement);
|
|
285
|
-
}
|
|
286
|
-
catch (e) {
|
|
287
|
-
returnValue = this.handleValueAccessException(e, returnValue);
|
|
288
|
-
}
|
|
289
|
-
this.processListeners(callbackName, CMIElement);
|
|
290
|
-
}
|
|
291
|
-
this.apiLog(callbackName, ": returned: " + returnValue, enums.LogLevelEnum.INFO, CMIElement);
|
|
292
|
-
if (returnValue === undefined) {
|
|
293
|
-
return "";
|
|
294
|
-
}
|
|
295
|
-
this.clearSCORMError(returnValue);
|
|
296
|
-
return returnValue;
|
|
297
|
-
};
|
|
298
|
-
BaseAPI.prototype.setValue = function (callbackName, commitCallback, checkTerminated, CMIElement, value) {
|
|
299
|
-
if (value !== undefined) {
|
|
300
|
-
value = String(value);
|
|
301
|
-
}
|
|
302
|
-
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
303
|
-
if (this.checkState(checkTerminated, this._error_codes.STORE_BEFORE_INIT, this._error_codes.STORE_AFTER_TERM)) {
|
|
304
|
-
if (checkTerminated)
|
|
305
|
-
this.lastErrorCode = "0";
|
|
306
|
-
try {
|
|
307
|
-
returnValue = this.setCMIValue(CMIElement, value);
|
|
308
|
-
}
|
|
309
|
-
catch (e) {
|
|
310
|
-
this.handleValueAccessException(e, returnValue);
|
|
311
|
-
}
|
|
312
|
-
this.processListeners(callbackName, CMIElement, value);
|
|
313
|
-
}
|
|
314
|
-
if (returnValue === undefined) {
|
|
315
|
-
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
316
|
-
}
|
|
317
|
-
if (String(this.lastErrorCode) === "0") {
|
|
318
|
-
if (this.settings.autocommit) {
|
|
319
|
-
this.scheduleCommit(this.settings.autocommitSeconds * 1000, commitCallback);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
this.apiLog(callbackName, ": " + value + ": result: " + returnValue, enums.LogLevelEnum.INFO, CMIElement);
|
|
323
|
-
this.clearSCORMError(returnValue);
|
|
324
|
-
return returnValue;
|
|
325
|
-
};
|
|
326
|
-
BaseAPI.prototype.commit = function (callbackName_1) {
|
|
327
|
-
return (0,tslib_es6.__awaiter)(this, arguments, void 0, function (callbackName, checkTerminated) {
|
|
328
|
-
var returnValue, result;
|
|
329
|
-
if (checkTerminated === void 0) { checkTerminated = false; }
|
|
330
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
331
|
-
switch (_a.label) {
|
|
332
|
-
case 0:
|
|
333
|
-
this.clearScheduledCommit();
|
|
334
|
-
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
335
|
-
if (!this.checkState(checkTerminated, this._error_codes.COMMIT_BEFORE_INIT, this._error_codes.COMMIT_AFTER_TERM)) return [3, 2];
|
|
336
|
-
return [4, this.storeData(false)];
|
|
337
|
-
case 1:
|
|
338
|
-
result = _a.sent();
|
|
339
|
-
if (result.errorCode && result.errorCode > 0) {
|
|
340
|
-
this.throwSCORMError(result.errorCode);
|
|
341
|
-
}
|
|
342
|
-
returnValue =
|
|
343
|
-
typeof result !== "undefined" && (result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)
|
|
344
|
-
? api_constants.global_constants.SCORM_TRUE
|
|
345
|
-
: api_constants.global_constants.SCORM_FALSE;
|
|
346
|
-
this.apiLog(callbackName, " Result: " + returnValue, enums.LogLevelEnum.DEBUG, "HttpRequest");
|
|
347
|
-
if (checkTerminated)
|
|
348
|
-
this.lastErrorCode = "0";
|
|
349
|
-
this.processListeners(callbackName);
|
|
350
|
-
_a.label = 2;
|
|
351
|
-
case 2:
|
|
352
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
353
|
-
this.clearSCORMError(returnValue);
|
|
354
|
-
return [2, returnValue];
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
BaseAPI.prototype.getLastError = function (callbackName) {
|
|
360
|
-
var returnValue = String(this.lastErrorCode);
|
|
361
|
-
this.processListeners(callbackName);
|
|
362
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
363
|
-
return returnValue;
|
|
364
|
-
};
|
|
365
|
-
BaseAPI.prototype.getErrorString = function (callbackName, CMIErrorCode) {
|
|
366
|
-
var returnValue = "";
|
|
367
|
-
if (CMIErrorCode !== null && CMIErrorCode !== "") {
|
|
368
|
-
returnValue = this.getLmsErrorMessageDetails(CMIErrorCode);
|
|
369
|
-
this.processListeners(callbackName);
|
|
370
|
-
}
|
|
371
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
372
|
-
return returnValue;
|
|
373
|
-
};
|
|
374
|
-
BaseAPI.prototype.getDiagnostic = function (callbackName, CMIErrorCode) {
|
|
375
|
-
var returnValue = "";
|
|
376
|
-
if (CMIErrorCode !== null && CMIErrorCode !== "") {
|
|
377
|
-
returnValue = this.getLmsErrorMessageDetails(CMIErrorCode, true);
|
|
378
|
-
this.processListeners(callbackName);
|
|
379
|
-
}
|
|
380
|
-
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
381
|
-
return returnValue;
|
|
382
|
-
};
|
|
383
|
-
BaseAPI.prototype.checkState = function (checkTerminated, beforeInitError, afterTermError) {
|
|
384
|
-
if (this.isNotInitialized()) {
|
|
385
|
-
this.throwSCORMError(beforeInitError);
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
else if (checkTerminated && this.isTerminated()) {
|
|
389
|
-
this.throwSCORMError(afterTermError);
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
return true;
|
|
393
|
-
};
|
|
394
|
-
BaseAPI.prototype.getLmsErrorMessageDetails = function (_errorNumber, _detail) {
|
|
395
|
-
if (_detail === void 0) { _detail = false; }
|
|
396
|
-
throw new Error("The getLmsErrorMessageDetails method has not been implemented");
|
|
397
|
-
};
|
|
398
|
-
BaseAPI.prototype.getCMIValue = function (_CMIElement) {
|
|
399
|
-
throw new Error("The getCMIValue method has not been implemented");
|
|
400
|
-
};
|
|
401
|
-
BaseAPI.prototype.setCMIValue = function (_CMIElement, _value) {
|
|
402
|
-
throw new Error("The setCMIValue method has not been implemented");
|
|
403
|
-
};
|
|
404
|
-
BaseAPI.prototype._commonSetCMIValue = function (methodName, scorm2004, CMIElement, value) {
|
|
405
|
-
if (!CMIElement || CMIElement === "") {
|
|
406
|
-
return api_constants.global_constants.SCORM_FALSE;
|
|
407
|
-
}
|
|
408
|
-
var structure = CMIElement.split(".");
|
|
409
|
-
var refObject = this;
|
|
410
|
-
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
411
|
-
var foundFirstIndex = false;
|
|
412
|
-
var invalidErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") is not a valid SCORM data model element.");
|
|
413
|
-
var invalidErrorCode = scorm2004
|
|
414
|
-
? this._error_codes.UNDEFINED_DATA_MODEL
|
|
415
|
-
: this._error_codes.GENERAL;
|
|
416
|
-
for (var idx = 0; idx < structure.length; idx++) {
|
|
417
|
-
var attribute = structure[idx];
|
|
418
|
-
if (!attribute) {
|
|
419
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
420
|
-
return api_constants.global_constants.SCORM_FALSE;
|
|
421
|
-
}
|
|
422
|
-
if (idx === structure.length - 1) {
|
|
423
|
-
if (scorm2004 && attribute.substring(0, 8) === "{target=") {
|
|
424
|
-
if (this.isInitialized()) {
|
|
425
|
-
this.throwSCORMError(this._error_codes.READ_ONLY_ELEMENT);
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
refObject = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, refObject), { attribute: value });
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
else if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
432
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
if ((0,utilities.stringMatches)(CMIElement, "\\.correct_responses\\.\\d+") &&
|
|
436
|
-
this.isInitialized()) {
|
|
437
|
-
this.validateCorrectResponse(CMIElement, value);
|
|
438
|
-
}
|
|
439
|
-
if (!scorm2004 || this.lastErrorCode === "0") {
|
|
440
|
-
refObject[attribute] = value;
|
|
441
|
-
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
refObject = refObject[attribute];
|
|
447
|
-
if (!refObject) {
|
|
448
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
if (refObject instanceof array.CMIArray) {
|
|
452
|
-
var index = parseInt(structure[idx + 1] || "0", 10);
|
|
453
|
-
if (!isNaN(index)) {
|
|
454
|
-
var item = refObject.childArray[index];
|
|
455
|
-
if (item) {
|
|
456
|
-
refObject = item;
|
|
457
|
-
foundFirstIndex = true;
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
var newChild = this.getChildElement(CMIElement, value, foundFirstIndex);
|
|
461
|
-
foundFirstIndex = true;
|
|
462
|
-
if (!newChild) {
|
|
463
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
if (refObject.initialized)
|
|
467
|
-
newChild.initialize();
|
|
468
|
-
refObject.childArray.push(newChild);
|
|
469
|
-
refObject = newChild;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
idx++;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (returnValue === api_constants.global_constants.SCORM_FALSE) {
|
|
478
|
-
this.apiLog(methodName, "There was an error setting the value for: ".concat(CMIElement, ", value of: ").concat(value), enums.LogLevelEnum.WARN);
|
|
479
|
-
}
|
|
480
|
-
return returnValue;
|
|
481
|
-
};
|
|
482
|
-
BaseAPI.prototype._commonGetCMIValue = function (methodName, scorm2004, CMIElement) {
|
|
483
|
-
if (!CMIElement || CMIElement === "") {
|
|
484
|
-
return "";
|
|
485
|
-
}
|
|
486
|
-
var structure = CMIElement.split(".");
|
|
487
|
-
var refObject = this;
|
|
488
|
-
var attribute = null;
|
|
489
|
-
var uninitializedErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") has not been initialized.");
|
|
490
|
-
var invalidErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") is not a valid SCORM data model element.");
|
|
491
|
-
var invalidErrorCode = scorm2004
|
|
492
|
-
? this._error_codes.UNDEFINED_DATA_MODEL
|
|
493
|
-
: this._error_codes.GENERAL;
|
|
494
|
-
for (var idx = 0; idx < structure.length; idx++) {
|
|
495
|
-
attribute = structure[idx];
|
|
496
|
-
if (!attribute) {
|
|
497
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
if (!scorm2004) {
|
|
501
|
-
if (idx === structure.length - 1) {
|
|
502
|
-
if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
503
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
if (String(attribute).substring(0, 8) === "{target=" &&
|
|
510
|
-
typeof refObject._isTargetValid == "function") {
|
|
511
|
-
var target = String(attribute).substring(8, String(attribute).length - 9);
|
|
512
|
-
return refObject._isTargetValid(target);
|
|
513
|
-
}
|
|
514
|
-
else if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
515
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
refObject = refObject[attribute];
|
|
520
|
-
if (refObject === undefined) {
|
|
521
|
-
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
if (refObject instanceof array.CMIArray) {
|
|
525
|
-
var index = parseInt(structure[idx + 1] || "", 10);
|
|
526
|
-
if (!isNaN(index)) {
|
|
527
|
-
var item = refObject.childArray[index];
|
|
528
|
-
if (item) {
|
|
529
|
-
refObject = item;
|
|
530
|
-
}
|
|
531
|
-
else {
|
|
532
|
-
this.throwSCORMError(this._error_codes.VALUE_NOT_INITIALIZED, uninitializedErrorMessage);
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
idx++;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
if (refObject === null || refObject === undefined) {
|
|
540
|
-
if (!scorm2004) {
|
|
541
|
-
if (attribute === "_children") {
|
|
542
|
-
this.throwSCORMError(this._error_codes.CHILDREN_ERROR);
|
|
543
|
-
}
|
|
544
|
-
else if (attribute === "_count") {
|
|
545
|
-
this.throwSCORMError(this._error_codes.COUNT_ERROR);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
return refObject;
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
BaseAPI.prototype.isInitialized = function () {
|
|
554
|
-
return this.currentState === api_constants.global_constants.STATE_INITIALIZED;
|
|
555
|
-
};
|
|
556
|
-
BaseAPI.prototype.isNotInitialized = function () {
|
|
557
|
-
return this.currentState === api_constants.global_constants.STATE_NOT_INITIALIZED;
|
|
558
|
-
};
|
|
559
|
-
BaseAPI.prototype.isTerminated = function () {
|
|
560
|
-
return this.currentState === api_constants.global_constants.STATE_TERMINATED;
|
|
561
|
-
};
|
|
562
|
-
BaseAPI.prototype.on = function (listenerName, callback) {
|
|
563
|
-
var _a, _c;
|
|
564
|
-
if (!callback)
|
|
565
|
-
return;
|
|
566
|
-
var listenerFunctions = listenerName.split(" ");
|
|
567
|
-
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
568
|
-
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
569
|
-
if (!listenerSplit || listenerSplit.length === 0)
|
|
570
|
-
return;
|
|
571
|
-
var functionName = listenerSplit[0];
|
|
572
|
-
var CMIElement = null;
|
|
573
|
-
if (listenerSplit.length > 1) {
|
|
574
|
-
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
575
|
-
}
|
|
576
|
-
this.listenerArray.push({
|
|
577
|
-
functionName: functionName,
|
|
578
|
-
CMIElement: CMIElement,
|
|
579
|
-
callback: callback
|
|
580
|
-
});
|
|
581
|
-
this.apiLog("on", "Added event listener: ".concat(this.listenerArray.length), enums.LogLevelEnum.INFO, functionName);
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
BaseAPI.prototype.off = function (listenerName, callback) {
|
|
585
|
-
var _a, _c;
|
|
586
|
-
if (!callback)
|
|
587
|
-
return;
|
|
588
|
-
var listenerFunctions = listenerName.split(" ");
|
|
589
|
-
var _loop_1 = function (i) {
|
|
590
|
-
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
591
|
-
if (!listenerSplit || listenerSplit.length === 0)
|
|
592
|
-
return { value: void 0 };
|
|
593
|
-
var functionName = listenerSplit[0];
|
|
594
|
-
var CMIElement = null;
|
|
595
|
-
if (listenerSplit.length > 1) {
|
|
596
|
-
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
597
|
-
}
|
|
598
|
-
var removeIndex = this_1.listenerArray.findIndex(function (obj) {
|
|
599
|
-
return obj.functionName === functionName &&
|
|
600
|
-
obj.CMIElement === CMIElement &&
|
|
601
|
-
obj.callback === callback;
|
|
602
|
-
});
|
|
603
|
-
if (removeIndex !== -1) {
|
|
604
|
-
this_1.listenerArray.splice(removeIndex, 1);
|
|
605
|
-
this_1.apiLog("off", "Removed event listener: ".concat(this_1.listenerArray.length), enums.LogLevelEnum.INFO, functionName);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
var this_1 = this;
|
|
609
|
-
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
610
|
-
var state_1 = _loop_1(i);
|
|
611
|
-
if (typeof state_1 === "object")
|
|
612
|
-
return state_1.value;
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
BaseAPI.prototype.clear = function (listenerName) {
|
|
616
|
-
var _a, _c;
|
|
617
|
-
var listenerFunctions = listenerName.split(" ");
|
|
618
|
-
var _loop_2 = function (i) {
|
|
619
|
-
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
620
|
-
if (!listenerSplit || (listenerSplit === null || listenerSplit === void 0 ? void 0 : listenerSplit.length) === 0)
|
|
621
|
-
return { value: void 0 };
|
|
622
|
-
var functionName = listenerSplit[0];
|
|
623
|
-
var CMIElement = null;
|
|
624
|
-
if (listenerSplit.length > 1) {
|
|
625
|
-
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
626
|
-
}
|
|
627
|
-
this_2.listenerArray = this_2.listenerArray.filter(function (obj) {
|
|
628
|
-
return obj.functionName !== functionName && obj.CMIElement !== CMIElement;
|
|
629
|
-
});
|
|
630
|
-
};
|
|
631
|
-
var this_2 = this;
|
|
632
|
-
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
633
|
-
var state_2 = _loop_2(i);
|
|
634
|
-
if (typeof state_2 === "object")
|
|
635
|
-
return state_2.value;
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
BaseAPI.prototype.processListeners = function (functionName, CMIElement, value) {
|
|
639
|
-
this.apiLog(functionName, value, enums.LogLevelEnum.INFO, CMIElement);
|
|
640
|
-
for (var i = 0; i < this.listenerArray.length; i++) {
|
|
641
|
-
var listener = this.listenerArray[i];
|
|
642
|
-
var functionsMatch = listener.functionName === functionName;
|
|
643
|
-
var listenerHasCMIElement = !!listener.CMIElement;
|
|
644
|
-
var CMIElementsMatch = false;
|
|
645
|
-
if (CMIElement &&
|
|
646
|
-
listener.CMIElement &&
|
|
647
|
-
listener.CMIElement.substring(listener.CMIElement.length - 1) === "*") {
|
|
648
|
-
CMIElementsMatch =
|
|
649
|
-
CMIElement.indexOf(listener.CMIElement.substring(0, listener.CMIElement.length - 1)) === 0;
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
CMIElementsMatch = listener.CMIElement === CMIElement;
|
|
653
|
-
}
|
|
654
|
-
if (functionsMatch && (!listenerHasCMIElement || CMIElementsMatch)) {
|
|
655
|
-
this.apiLog("processListeners", "Processing listener: ".concat(listener.functionName), enums.LogLevelEnum.INFO, CMIElement);
|
|
656
|
-
listener.callback(CMIElement, value);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
BaseAPI.prototype.throwSCORMError = function (errorNumber, message) {
|
|
661
|
-
if (!message) {
|
|
662
|
-
message = this.getLmsErrorMessageDetails(errorNumber);
|
|
663
|
-
}
|
|
664
|
-
this.apiLog("throwSCORMError", errorNumber + ": " + message, enums.LogLevelEnum.ERROR);
|
|
665
|
-
this.lastErrorCode = String(errorNumber);
|
|
666
|
-
};
|
|
667
|
-
BaseAPI.prototype.clearSCORMError = function (success) {
|
|
668
|
-
if (success !== undefined && success !== api_constants.global_constants.SCORM_FALSE) {
|
|
669
|
-
this.lastErrorCode = "0";
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
BaseAPI.prototype.loadFromFlattenedJSON = function (json, CMIElement) {
|
|
673
|
-
var _this = this;
|
|
674
|
-
if (!CMIElement) {
|
|
675
|
-
CMIElement = "";
|
|
676
|
-
}
|
|
677
|
-
if (!this.isNotInitialized()) {
|
|
678
|
-
console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.");
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
function testPattern(a, c, a_pattern) {
|
|
682
|
-
var a_match = a.match(a_pattern);
|
|
683
|
-
var c_match;
|
|
684
|
-
if (a_match !== null && (c_match = c.match(a_pattern)) !== null) {
|
|
685
|
-
var a_num = Number(a_match[2]);
|
|
686
|
-
var c_num = Number(c_match[2]);
|
|
687
|
-
if (a_num === c_num) {
|
|
688
|
-
if (a_match[3] === "id") {
|
|
689
|
-
return -1;
|
|
690
|
-
}
|
|
691
|
-
else if (a_match[3] === "type") {
|
|
692
|
-
if (c_match[3] === "id") {
|
|
693
|
-
return 1;
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
696
|
-
return -1;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
return 1;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return a_num - c_num;
|
|
704
|
-
}
|
|
705
|
-
return null;
|
|
706
|
-
}
|
|
707
|
-
var int_pattern = /^(cmi\.interactions\.)(\d+)\.(.*)$/;
|
|
708
|
-
var obj_pattern = /^(cmi\.objectives\.)(\d+)\.(.*)$/;
|
|
709
|
-
var result = Object.keys(json).map(function (key) {
|
|
710
|
-
return [String(key), json[key]];
|
|
711
|
-
});
|
|
712
|
-
result.sort(function (_a, _c) {
|
|
713
|
-
var a = _a[0], _b = _a[1];
|
|
714
|
-
var c = _c[0], _d = _c[1];
|
|
715
|
-
var test;
|
|
716
|
-
if ((test = testPattern(a, c, int_pattern)) !== null) {
|
|
717
|
-
return test;
|
|
718
|
-
}
|
|
719
|
-
if ((test = testPattern(a, c, obj_pattern)) !== null) {
|
|
720
|
-
return test;
|
|
721
|
-
}
|
|
722
|
-
if (a < c) {
|
|
723
|
-
return -1;
|
|
724
|
-
}
|
|
725
|
-
if (a > c) {
|
|
726
|
-
return 1;
|
|
727
|
-
}
|
|
728
|
-
return 0;
|
|
729
|
-
});
|
|
730
|
-
var obj;
|
|
731
|
-
result.forEach(function (element) {
|
|
732
|
-
obj = {};
|
|
733
|
-
obj[element[0]] = element[1];
|
|
734
|
-
_this.loadFromJSON((0,utilities.unflatten)(obj), CMIElement);
|
|
735
|
-
});
|
|
736
|
-
};
|
|
737
|
-
BaseAPI.prototype.loadFromJSON = function (json, CMIElement) {
|
|
738
|
-
if (CMIElement === void 0) { CMIElement = ""; }
|
|
739
|
-
if ((!CMIElement || CMIElement === "") &&
|
|
740
|
-
!Object.hasOwnProperty.call(json, "cmi") &&
|
|
741
|
-
!Object.hasOwnProperty.call(json, "adl")) {
|
|
742
|
-
CMIElement = "cmi";
|
|
743
|
-
}
|
|
744
|
-
if (!this.isNotInitialized()) {
|
|
745
|
-
console.error("loadFromJSON can only be called before the call to lmsInitialize.");
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
CMIElement = CMIElement !== undefined ? CMIElement : "cmi";
|
|
749
|
-
this.startingData = json;
|
|
750
|
-
for (var key in json) {
|
|
751
|
-
if ({}.hasOwnProperty.call(json, key) && json[key]) {
|
|
752
|
-
var currentCMIElement = (CMIElement ? CMIElement + "." : "") + key;
|
|
753
|
-
var value = json[key];
|
|
754
|
-
if (value["childArray"]) {
|
|
755
|
-
for (var i = 0; i < value["childArray"].length; i++) {
|
|
756
|
-
this.loadFromJSON(value["childArray"][i], currentCMIElement + "." + i);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
else if (value.constructor === Object) {
|
|
760
|
-
this.loadFromJSON(value, currentCMIElement);
|
|
761
|
-
}
|
|
762
|
-
else {
|
|
763
|
-
this.setCMIValue(currentCMIElement, value);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
BaseAPI.prototype.renderCMIToJSONString = function () {
|
|
769
|
-
var cmi = this.cmi;
|
|
770
|
-
if (this.settings.sendFullCommit) {
|
|
771
|
-
return JSON.stringify({ cmi: cmi });
|
|
772
|
-
}
|
|
773
|
-
return JSON.stringify({ cmi: cmi }, function (k, v) { return (v === undefined ? null : v); }, 2);
|
|
774
|
-
};
|
|
775
|
-
BaseAPI.prototype.renderCMIToJSONObject = function () {
|
|
776
|
-
return JSON.parse(this.renderCMIToJSONString());
|
|
777
|
-
};
|
|
778
|
-
BaseAPI.prototype.processHttpRequest = function (url_1, params_1) {
|
|
779
|
-
return (0,tslib_es6.__awaiter)(this, arguments, void 0, function (url, params, immediate) {
|
|
780
|
-
var api, genericError, process;
|
|
781
|
-
var _this = this;
|
|
782
|
-
if (immediate === void 0) { immediate = false; }
|
|
783
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
784
|
-
switch (_a.label) {
|
|
785
|
-
case 0:
|
|
786
|
-
api = this;
|
|
787
|
-
genericError = {
|
|
788
|
-
result: api_constants.global_constants.SCORM_FALSE,
|
|
789
|
-
errorCode: this.error_codes.GENERAL
|
|
790
|
-
};
|
|
791
|
-
if (immediate) {
|
|
792
|
-
params = this.settings.requestHandler(params);
|
|
793
|
-
this.performFetch(url, params).then(function (response) { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
794
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
795
|
-
switch (_a.label) {
|
|
796
|
-
case 0: return [4, this.transformResponse(response)];
|
|
797
|
-
case 1:
|
|
798
|
-
_a.sent();
|
|
799
|
-
return [2];
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
|
-
}); });
|
|
803
|
-
return [2, {
|
|
804
|
-
result: api_constants.global_constants.SCORM_TRUE,
|
|
805
|
-
errorCode: 0
|
|
806
|
-
}];
|
|
807
|
-
}
|
|
808
|
-
process = function (url, params, settings) { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
809
|
-
var response, e_1, message;
|
|
810
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
811
|
-
switch (_a.label) {
|
|
812
|
-
case 0:
|
|
813
|
-
_a.trys.push([0, 2, , 3]);
|
|
814
|
-
params = settings.requestHandler(params);
|
|
815
|
-
return [4, this.performFetch(url, params)];
|
|
816
|
-
case 1:
|
|
817
|
-
response = _a.sent();
|
|
818
|
-
return [2, this.transformResponse(response)];
|
|
819
|
-
case 2:
|
|
820
|
-
e_1 = _a.sent();
|
|
821
|
-
message = e_1 instanceof Error ? e_1.message : String(e_1);
|
|
822
|
-
this.apiLog("processHttpRequest", message, enums.LogLevelEnum.ERROR);
|
|
823
|
-
api.processListeners("CommitError");
|
|
824
|
-
return [2, genericError];
|
|
825
|
-
case 3: return [2];
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
}); };
|
|
829
|
-
return [4, process(url, params, this.settings)];
|
|
830
|
-
case 1: return [2, _a.sent()];
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
});
|
|
834
|
-
};
|
|
835
|
-
BaseAPI.prototype.scheduleCommit = function (when, callback) {
|
|
836
|
-
if (!this._timeout) {
|
|
837
|
-
this._timeout = new ScheduledCommit(this, when, callback);
|
|
838
|
-
this.apiLog("scheduleCommit", "scheduled", enums.LogLevelEnum.DEBUG, "");
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
BaseAPI.prototype.clearScheduledCommit = function () {
|
|
842
|
-
if (this._timeout) {
|
|
843
|
-
this._timeout.cancel();
|
|
844
|
-
this._timeout = undefined;
|
|
845
|
-
this.apiLog("clearScheduledCommit", "cleared", enums.LogLevelEnum.DEBUG, "");
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
BaseAPI.prototype._checkObjectHasProperty = function (refObject, attribute) {
|
|
849
|
-
return (Object.hasOwnProperty.call(refObject, attribute) ||
|
|
850
|
-
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(refObject), attribute) != null ||
|
|
851
|
-
attribute in refObject);
|
|
852
|
-
};
|
|
853
|
-
BaseAPI.prototype.handleValueAccessException = function (e, returnValue) {
|
|
854
|
-
if (e instanceof exceptions.ValidationError) {
|
|
855
|
-
this.lastErrorCode = String(e.errorCode);
|
|
856
|
-
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
if (e instanceof Error && e.message) {
|
|
860
|
-
console.error(e.message);
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
console.error(e);
|
|
864
|
-
}
|
|
865
|
-
this.throwSCORMError(this._error_codes.GENERAL);
|
|
866
|
-
}
|
|
867
|
-
return returnValue;
|
|
868
|
-
};
|
|
869
|
-
BaseAPI.prototype.getCommitObject = function (terminateCommit) {
|
|
870
|
-
var shouldTerminateCommit = terminateCommit || this.settings.alwaysSendTotalTime;
|
|
871
|
-
var commitObject = this.settings.renderCommonCommitFields
|
|
872
|
-
? this.renderCommitObject(shouldTerminateCommit)
|
|
873
|
-
: this.renderCommitCMI(shouldTerminateCommit);
|
|
874
|
-
if ([enums.LogLevelEnum.DEBUG, "1", 1, "DEBUG"].includes(this.apiLogLevel)) {
|
|
875
|
-
console.debug("Commit (terminated: " + (terminateCommit ? "yes" : "no") + "): ");
|
|
876
|
-
console.debug(commitObject);
|
|
877
|
-
}
|
|
878
|
-
return commitObject;
|
|
879
|
-
};
|
|
880
|
-
BaseAPI.prototype.performFetch = function (url, params) {
|
|
881
|
-
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
882
|
-
var init;
|
|
883
|
-
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
884
|
-
init = {
|
|
885
|
-
method: "POST",
|
|
886
|
-
mode: this.settings.fetchMode,
|
|
887
|
-
body: params instanceof Array ? params.join("&") : JSON.stringify(params),
|
|
888
|
-
headers: (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, this.settings.xhrHeaders), { "Content-Type": this.settings.commitRequestDataType }),
|
|
889
|
-
keepalive: true
|
|
890
|
-
};
|
|
891
|
-
if (this.settings.xhrWithCredentials) {
|
|
892
|
-
init = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, init), { credentials: "include" });
|
|
893
|
-
}
|
|
894
|
-
return [2, fetch(url, init)];
|
|
895
|
-
});
|
|
896
|
-
});
|
|
897
|
-
};
|
|
898
|
-
BaseAPI.prototype.transformResponse = function (response) {
|
|
899
|
-
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
900
|
-
var result, _a;
|
|
901
|
-
return (0,tslib_es6.__generator)(this, function (_c) {
|
|
902
|
-
switch (_c.label) {
|
|
903
|
-
case 0:
|
|
904
|
-
if (!(typeof this.settings.responseHandler === "function")) return [3, 2];
|
|
905
|
-
return [4, this.settings.responseHandler(response)];
|
|
906
|
-
case 1:
|
|
907
|
-
_a = _c.sent();
|
|
908
|
-
return [3, 4];
|
|
909
|
-
case 2: return [4, response.json()];
|
|
910
|
-
case 3:
|
|
911
|
-
_a = _c.sent();
|
|
912
|
-
_c.label = 4;
|
|
913
|
-
case 4:
|
|
914
|
-
result = _a;
|
|
915
|
-
if (response.status >= 200 &&
|
|
916
|
-
response.status <= 299 &&
|
|
917
|
-
(result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)) {
|
|
918
|
-
this.processListeners("CommitSuccess");
|
|
919
|
-
}
|
|
920
|
-
else {
|
|
921
|
-
this.processListeners("CommitError");
|
|
922
|
-
}
|
|
923
|
-
return [2, result];
|
|
924
|
-
}
|
|
925
|
-
});
|
|
926
|
-
});
|
|
927
|
-
};
|
|
928
|
-
return BaseAPI;
|
|
929
|
-
}());
|
|
930
|
-
/* harmony default export */ var src_BaseAPI = (BaseAPI);
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
/***/ }),
|
|
934
|
-
|
|
935
|
-
/***/ 589:
|
|
936
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
937
|
-
|
|
938
|
-
__webpack_require__.r(__webpack_exports__);
|
|
939
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
940
|
-
/* harmony export */ CMIArray: function() { return /* binding */ CMIArray; }
|
|
941
|
-
/* harmony export */ });
|
|
942
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
943
|
-
/* harmony import */ var _base_cmi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(319);
|
|
944
|
-
/* harmony import */ var _exceptions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(784);
|
|
945
|
-
/* harmony import */ var _constants_error_codes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(797);
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
var CMIArray = (function (_super) {
|
|
951
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(CMIArray, _super);
|
|
952
|
-
function CMIArray(params) {
|
|
953
|
-
var _this = _super.call(this) || this;
|
|
954
|
-
_this.__children = params.children;
|
|
955
|
-
_this._errorCode = params.errorCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_1__.scorm12_errors.GENERAL;
|
|
956
|
-
_this._errorClass = params.errorClass || _exceptions__WEBPACK_IMPORTED_MODULE_2__.BaseScormValidationError;
|
|
957
|
-
_this.childArray = [];
|
|
958
|
-
return _this;
|
|
959
|
-
}
|
|
960
|
-
CMIArray.prototype.reset = function (wipe) {
|
|
961
|
-
if (wipe === void 0) { wipe = false; }
|
|
962
|
-
this._initialized = false;
|
|
963
|
-
if (wipe) {
|
|
964
|
-
this.childArray = [];
|
|
965
|
-
}
|
|
966
|
-
else {
|
|
967
|
-
for (var i = 0; i < this.childArray.length; i++) {
|
|
968
|
-
this.childArray[i].reset();
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
Object.defineProperty(CMIArray.prototype, "_children", {
|
|
973
|
-
get: function () {
|
|
974
|
-
return this.__children;
|
|
975
|
-
},
|
|
976
|
-
set: function (_children) {
|
|
977
|
-
throw new this._errorClass(this._errorCode);
|
|
978
|
-
},
|
|
979
|
-
enumerable: false,
|
|
980
|
-
configurable: true
|
|
981
|
-
});
|
|
982
|
-
Object.defineProperty(CMIArray.prototype, "_count", {
|
|
983
|
-
get: function () {
|
|
984
|
-
return this.childArray.length;
|
|
985
|
-
},
|
|
986
|
-
set: function (_count) {
|
|
987
|
-
throw new this._errorClass(this._errorCode);
|
|
988
|
-
},
|
|
989
|
-
enumerable: false,
|
|
990
|
-
configurable: true
|
|
991
|
-
});
|
|
992
|
-
CMIArray.prototype.toJSON = function () {
|
|
993
|
-
this.jsonString = true;
|
|
994
|
-
var result = {};
|
|
995
|
-
for (var i = 0; i < this.childArray.length; i++) {
|
|
996
|
-
result[i + ""] = this.childArray[i];
|
|
997
|
-
}
|
|
998
|
-
delete this.jsonString;
|
|
999
|
-
return result;
|
|
1000
|
-
};
|
|
1001
|
-
return CMIArray;
|
|
1002
|
-
}(_base_cmi__WEBPACK_IMPORTED_MODULE_3__.BaseCMI));
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
/***/ }),
|
|
1007
|
-
|
|
1008
|
-
/***/ 319:
|
|
1009
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1010
|
-
|
|
1011
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1012
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1013
|
-
/* harmony export */ BaseCMI: function() { return /* binding */ BaseCMI; },
|
|
1014
|
-
/* harmony export */ BaseRootCMI: function() { return /* binding */ BaseRootCMI; }
|
|
1015
|
-
/* harmony export */ });
|
|
1016
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1017
|
-
|
|
1018
|
-
var BaseCMI = (function () {
|
|
1019
|
-
function BaseCMI() {
|
|
1020
|
-
this.jsonString = false;
|
|
1021
|
-
this._initialized = false;
|
|
1022
|
-
}
|
|
1023
|
-
Object.defineProperty(BaseCMI.prototype, "initialized", {
|
|
1024
|
-
get: function () {
|
|
1025
|
-
return this._initialized;
|
|
1026
|
-
},
|
|
1027
|
-
enumerable: false,
|
|
1028
|
-
configurable: true
|
|
1029
|
-
});
|
|
1030
|
-
Object.defineProperty(BaseCMI.prototype, "start_time", {
|
|
1031
|
-
get: function () {
|
|
1032
|
-
return this._start_time;
|
|
1033
|
-
},
|
|
1034
|
-
enumerable: false,
|
|
1035
|
-
configurable: true
|
|
1036
|
-
});
|
|
1037
|
-
BaseCMI.prototype.initialize = function () {
|
|
1038
|
-
this._initialized = true;
|
|
1039
|
-
};
|
|
1040
|
-
BaseCMI.prototype.setStartTime = function () {
|
|
1041
|
-
this._start_time = new Date().getTime();
|
|
1042
|
-
};
|
|
1043
|
-
return BaseCMI;
|
|
1044
|
-
}());
|
|
1045
|
-
|
|
1046
|
-
var BaseRootCMI = (function (_super) {
|
|
1047
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BaseRootCMI, _super);
|
|
1048
|
-
function BaseRootCMI() {
|
|
1049
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1050
|
-
}
|
|
1051
|
-
return BaseRootCMI;
|
|
1052
|
-
}(BaseCMI));
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
/***/ }),
|
|
1057
|
-
|
|
1058
|
-
/***/ 434:
|
|
1059
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1060
|
-
|
|
1061
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1062
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1063
|
-
/* harmony export */ CMIScore: function() { return /* binding */ CMIScore; }
|
|
1064
|
-
/* harmony export */ });
|
|
1065
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1066
|
-
/* harmony import */ var _constants_api_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(340);
|
|
1067
|
-
/* harmony import */ var _constants_regex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(417);
|
|
1068
|
-
/* harmony import */ var _base_cmi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(319);
|
|
1069
|
-
/* harmony import */ var _validation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(449);
|
|
1070
|
-
/* harmony import */ var _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(797);
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
var CMIScore = (function (_super) {
|
|
1078
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(CMIScore, _super);
|
|
1079
|
-
function CMIScore(params) {
|
|
1080
|
-
var _this = _super.call(this) || this;
|
|
1081
|
-
_this._raw = "";
|
|
1082
|
-
_this._min = "";
|
|
1083
|
-
_this.__children = params.score_children || _constants_api_constants__WEBPACK_IMPORTED_MODULE_1__.scorm12_constants.score_children;
|
|
1084
|
-
_this.__score_range = !params.score_range
|
|
1085
|
-
? false
|
|
1086
|
-
: _constants_regex__WEBPACK_IMPORTED_MODULE_2__.scorm12_regex.score_range;
|
|
1087
|
-
_this._max = params.max || params.max === "" ? params.max : "100";
|
|
1088
|
-
_this.__invalid_error_code =
|
|
1089
|
-
params.invalidErrorCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__.scorm12_errors.INVALID_SET_VALUE;
|
|
1090
|
-
_this.__invalid_type_code =
|
|
1091
|
-
params.invalidTypeCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__.scorm12_errors.TYPE_MISMATCH;
|
|
1092
|
-
_this.__invalid_range_code =
|
|
1093
|
-
params.invalidRangeCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__.scorm12_errors.VALUE_OUT_OF_RANGE;
|
|
1094
|
-
_this.__decimal_regex = params.decimalRegex || _constants_regex__WEBPACK_IMPORTED_MODULE_2__.scorm12_regex.CMIDecimal;
|
|
1095
|
-
_this.__error_class = params.errorClass;
|
|
1096
|
-
return _this;
|
|
1097
|
-
}
|
|
1098
|
-
CMIScore.prototype.reset = function () {
|
|
1099
|
-
this._initialized = false;
|
|
1100
|
-
};
|
|
1101
|
-
Object.defineProperty(CMIScore.prototype, "_children", {
|
|
1102
|
-
get: function () {
|
|
1103
|
-
return this.__children;
|
|
1104
|
-
},
|
|
1105
|
-
set: function (_children) {
|
|
1106
|
-
throw new this.__error_class(this.__invalid_error_code);
|
|
1107
|
-
},
|
|
1108
|
-
enumerable: false,
|
|
1109
|
-
configurable: true
|
|
1110
|
-
});
|
|
1111
|
-
Object.defineProperty(CMIScore.prototype, "raw", {
|
|
1112
|
-
get: function () {
|
|
1113
|
-
return this._raw;
|
|
1114
|
-
},
|
|
1115
|
-
set: function (raw) {
|
|
1116
|
-
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(raw, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1117
|
-
(!this.__score_range ||
|
|
1118
|
-
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(raw, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1119
|
-
this._raw = raw;
|
|
1120
|
-
}
|
|
1121
|
-
},
|
|
1122
|
-
enumerable: false,
|
|
1123
|
-
configurable: true
|
|
1124
|
-
});
|
|
1125
|
-
Object.defineProperty(CMIScore.prototype, "min", {
|
|
1126
|
-
get: function () {
|
|
1127
|
-
return this._min;
|
|
1128
|
-
},
|
|
1129
|
-
set: function (min) {
|
|
1130
|
-
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(min, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1131
|
-
(!this.__score_range ||
|
|
1132
|
-
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(min, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1133
|
-
this._min = min;
|
|
1134
|
-
}
|
|
1135
|
-
},
|
|
1136
|
-
enumerable: false,
|
|
1137
|
-
configurable: true
|
|
1138
|
-
});
|
|
1139
|
-
Object.defineProperty(CMIScore.prototype, "max", {
|
|
1140
|
-
get: function () {
|
|
1141
|
-
return this._max;
|
|
1142
|
-
},
|
|
1143
|
-
set: function (max) {
|
|
1144
|
-
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(max, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1145
|
-
(!this.__score_range ||
|
|
1146
|
-
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(max, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1147
|
-
this._max = max;
|
|
1148
|
-
}
|
|
1149
|
-
},
|
|
1150
|
-
enumerable: false,
|
|
1151
|
-
configurable: true
|
|
1152
|
-
});
|
|
1153
|
-
CMIScore.prototype.toJSON = function () {
|
|
1154
|
-
this.jsonString = true;
|
|
1155
|
-
var result = {
|
|
1156
|
-
raw: this.raw,
|
|
1157
|
-
min: this.min,
|
|
1158
|
-
max: this.max,
|
|
1159
|
-
};
|
|
1160
|
-
delete this.jsonString;
|
|
1161
|
-
return result;
|
|
1162
|
-
};
|
|
1163
|
-
return CMIScore;
|
|
1164
|
-
}(_base_cmi__WEBPACK_IMPORTED_MODULE_5__.BaseCMI));
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
/***/ }),
|
|
1169
|
-
|
|
1170
|
-
/***/ 449:
|
|
1171
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1172
|
-
|
|
1173
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1174
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1175
|
-
/* harmony export */ checkValidFormat: function() { return /* binding */ checkValidFormat; },
|
|
1176
|
-
/* harmony export */ checkValidRange: function() { return /* binding */ checkValidRange; }
|
|
1177
|
-
/* harmony export */ });
|
|
1178
|
-
function checkValidFormat(value, regexPattern, errorCode, errorClass, allowEmptyString) {
|
|
1179
|
-
if (typeof value !== "string") {
|
|
1180
|
-
return false;
|
|
1181
|
-
}
|
|
1182
|
-
var formatRegex = new RegExp(regexPattern);
|
|
1183
|
-
var matches = value.match(formatRegex);
|
|
1184
|
-
if (allowEmptyString && value === "") {
|
|
1185
|
-
return true;
|
|
1186
|
-
}
|
|
1187
|
-
if (value === undefined || !matches || matches[0] === "") {
|
|
1188
|
-
throw new errorClass(errorCode);
|
|
1189
|
-
}
|
|
1190
|
-
return true;
|
|
1191
|
-
}
|
|
1192
|
-
function checkValidRange(value, rangePattern, errorCode, errorClass) {
|
|
1193
|
-
var ranges = rangePattern.split("#");
|
|
1194
|
-
value = value * 1.0;
|
|
1195
|
-
if (ranges[0] && value >= ranges[0]) {
|
|
1196
|
-
if (ranges[1] && (ranges[1] === "*" || value <= ranges[1])) {
|
|
1197
|
-
return true;
|
|
1198
|
-
}
|
|
1199
|
-
else {
|
|
1200
|
-
throw new errorClass(errorCode);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
else {
|
|
1204
|
-
throw new errorClass(errorCode);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
/***/ }),
|
|
1210
|
-
|
|
1211
|
-
/***/ 340:
|
|
1212
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1213
|
-
|
|
1214
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1215
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1216
|
-
/* harmony export */ aicc_constants: function() { return /* binding */ aicc_constants; },
|
|
1217
|
-
/* harmony export */ global_constants: function() { return /* binding */ global_constants; },
|
|
1218
|
-
/* harmony export */ scorm12_constants: function() { return /* binding */ scorm12_constants; },
|
|
1219
|
-
/* harmony export */ scorm2004_constants: function() { return /* binding */ scorm2004_constants; }
|
|
1220
|
-
/* harmony export */ });
|
|
1221
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1222
|
-
|
|
1223
|
-
var global_constants = {
|
|
1224
|
-
SCORM_TRUE: "true",
|
|
1225
|
-
SCORM_FALSE: "false",
|
|
1226
|
-
STATE_NOT_INITIALIZED: 0,
|
|
1227
|
-
STATE_INITIALIZED: 1,
|
|
1228
|
-
STATE_TERMINATED: 2,
|
|
1229
|
-
};
|
|
1230
|
-
var scorm12_constants = {
|
|
1231
|
-
cmi_children: "core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions",
|
|
1232
|
-
core_children: "student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time",
|
|
1233
|
-
score_children: "raw,min,max",
|
|
1234
|
-
comments_children: "content,location,time",
|
|
1235
|
-
objectives_children: "id,score,status",
|
|
1236
|
-
correct_responses_children: "pattern",
|
|
1237
|
-
student_data_children: "mastery_score,max_time_allowed,time_limit_action",
|
|
1238
|
-
student_preference_children: "audio,language,speed,text",
|
|
1239
|
-
interactions_children: "id,objectives,time,type,correct_responses,weighting,student_response,result,latency",
|
|
1240
|
-
error_descriptions: {
|
|
1241
|
-
"101": {
|
|
1242
|
-
basicMessage: "General Exception",
|
|
1243
|
-
detailMessage: "No specific error code exists to describe the error. Use LMSGetDiagnostic for more information",
|
|
1244
|
-
},
|
|
1245
|
-
"201": {
|
|
1246
|
-
basicMessage: "Invalid argument error",
|
|
1247
|
-
detailMessage: "Indicates that an argument represents an invalid data model element or is otherwise incorrect.",
|
|
1248
|
-
},
|
|
1249
|
-
"202": {
|
|
1250
|
-
basicMessage: "Element cannot have children",
|
|
1251
|
-
detailMessage: 'Indicates that LMSGetValue was called with a data model element name that ends in "_children" for a data model element that does not support the "_children" suffix.',
|
|
132
|
+
"202": {
|
|
133
|
+
basicMessage: "Element cannot have children",
|
|
134
|
+
detailMessage: 'Indicates that LMSGetValue was called with a data model element name that ends in "_children" for a data model element that does not support the "_children" suffix.',
|
|
1252
135
|
},
|
|
1253
136
|
"203": {
|
|
1254
137
|
basicMessage: "Element not an array - cannot have count",
|
|
@@ -1416,439 +299,1240 @@ var scorm2004_constants = {
|
|
|
1416
299
|
};
|
|
1417
300
|
|
|
1418
301
|
|
|
1419
|
-
/***/ }),
|
|
302
|
+
/***/ }),
|
|
303
|
+
|
|
304
|
+
/***/ 417:
|
|
305
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
306
|
+
|
|
307
|
+
__webpack_require__.r(__webpack_exports__);
|
|
308
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
309
|
+
/* harmony export */ aicc_regex: function() { return /* binding */ aicc_regex; },
|
|
310
|
+
/* harmony export */ scorm12_regex: function() { return /* binding */ scorm12_regex; },
|
|
311
|
+
/* harmony export */ scorm2004_regex: function() { return /* binding */ scorm2004_regex; }
|
|
312
|
+
/* harmony export */ });
|
|
313
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
314
|
+
|
|
315
|
+
var scorm12_regex = {
|
|
316
|
+
CMIString256: "^.{0,255}$",
|
|
317
|
+
CMIString4096: "^.{0,4096}$",
|
|
318
|
+
CMITime: "^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)$",
|
|
319
|
+
CMITimespan: "^([0-9]{2,}):([0-9]{2}):([0-9]{2})(.[0-9]{1,2})?$",
|
|
320
|
+
CMIInteger: "^\\d+$",
|
|
321
|
+
CMISInteger: "^-?([0-9]+)$",
|
|
322
|
+
CMIDecimal: "^-?([0-9]{0,3})(.[0-9]*)?$",
|
|
323
|
+
CMIIdentifier: "^[\\u0021-\\u007E\\s]{0,255}$",
|
|
324
|
+
CMIFeedback: "^.*$",
|
|
325
|
+
CMIIndex: "[._](\\d+).",
|
|
326
|
+
CMIStatus: "^(passed|completed|failed|incomplete|browsed)$",
|
|
327
|
+
CMIStatus2: "^(passed|completed|failed|incomplete|browsed|not attempted)$",
|
|
328
|
+
CMIExit: "^(time-out|suspend|logout|)$",
|
|
329
|
+
CMIType: "^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$",
|
|
330
|
+
CMIResult: "^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$",
|
|
331
|
+
NAVEvent: "^(previous|continue)$",
|
|
332
|
+
score_range: "0#100",
|
|
333
|
+
audio_range: "-1#100",
|
|
334
|
+
speed_range: "-100#100",
|
|
335
|
+
weighting_range: "-100#100",
|
|
336
|
+
text_range: "-1#1",
|
|
337
|
+
};
|
|
338
|
+
var aicc_regex = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, scorm12_regex), {
|
|
339
|
+
CMIIdentifier: "^\\w{1,255}$",
|
|
340
|
+
});
|
|
341
|
+
var scorm2004_regex = {
|
|
342
|
+
CMIString200: "^[\\u0000-\\uFFFF]{0,200}$",
|
|
343
|
+
CMIString250: "^[\\u0000-\\uFFFF]{0,250}$",
|
|
344
|
+
CMIString1000: "^[\\u0000-\\uFFFF]{0,1000}$",
|
|
345
|
+
CMIString4000: "^[\\u0000-\\uFFFF]{0,4000}$",
|
|
346
|
+
CMIString64000: "^[\\u0000-\\uFFFF]{0,64000}$",
|
|
347
|
+
CMILang: "^([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$",
|
|
348
|
+
CMILangString250: "^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",
|
|
349
|
+
CMILangcr: "^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$",
|
|
350
|
+
CMILangString250cr: "^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$",
|
|
351
|
+
CMILangString4000: "^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",
|
|
352
|
+
CMITime: "^(19[7-9]{1}[0-9]{1}|20[0-2]{1}[0-9]{1}|203[0-8]{1})((-(0[1-9]{1}|1[0-2]{1}))((-(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]{1}))(T([0-1]{1}[0-9]{1}|2[0-3]{1})((:[0-5]{1}[0-9]{1})((:[0-5]{1}[0-9]{1})((\\.[0-9]{1,2})((Z|([+|-]([0-1]{1}[0-9]{1}|2[0-3]{1})))(:[0-5]{1}[0-9]{1})?)?)?)?)?)?)?)?$",
|
|
353
|
+
CMITimespan: "^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?)?$",
|
|
354
|
+
CMIInteger: "^\\d+$",
|
|
355
|
+
CMISInteger: "^-?([0-9]+)$",
|
|
356
|
+
CMIDecimal: "^-?([0-9]{1,5})(\\.[0-9]{1,18})?$",
|
|
357
|
+
CMIIdentifier: "^\\S{1,250}[a-zA-Z0-9]$",
|
|
358
|
+
CMIShortIdentifier: "^[\\w\\.\\-\\_]{1,250}$",
|
|
359
|
+
CMILongIdentifier: "^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",
|
|
360
|
+
CMIFeedback: "^.*$",
|
|
361
|
+
CMIIndex: "[._](\\d+).",
|
|
362
|
+
CMIIndexStore: ".N(\\d+).",
|
|
363
|
+
CMICStatus: "^(completed|incomplete|not attempted|unknown)$",
|
|
364
|
+
CMISStatus: "^(passed|failed|unknown)$",
|
|
365
|
+
CMIExit: "^(time-out|suspend|logout|normal)$",
|
|
366
|
+
CMIType: "^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$",
|
|
367
|
+
CMIResult: "^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$",
|
|
368
|
+
NAVEvent: "^(previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",
|
|
369
|
+
NAVBoolean: "^(unknown|true|false$)",
|
|
370
|
+
NAVTarget: "^{target=\\S{0,}[a-zA-Z0-9-_]+}$",
|
|
371
|
+
scaled_range: "-1#1",
|
|
372
|
+
audio_range: "0#*",
|
|
373
|
+
speed_range: "0#*",
|
|
374
|
+
text_range: "-1#1",
|
|
375
|
+
progress_range: "0#1",
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
/***/ }),
|
|
380
|
+
|
|
381
|
+
/***/ 429:
|
|
382
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
// EXPORTS
|
|
386
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
387
|
+
"default": function() { return /* binding */ src_BaseAPI; }
|
|
388
|
+
});
|
|
389
|
+
// ESM COMPAT FLAG
|
|
390
|
+
__webpack_require__.r(__webpack_exports__);
|
|
391
|
+
|
|
392
|
+
// EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.mjs
|
|
393
|
+
var tslib_es6 = __webpack_require__(635);
|
|
394
|
+
// EXTERNAL MODULE: ./src/cmi/common/array.ts
|
|
395
|
+
var array = __webpack_require__(589);
|
|
396
|
+
// EXTERNAL MODULE: ./src/exceptions.ts
|
|
397
|
+
var exceptions = __webpack_require__(784);
|
|
398
|
+
// EXTERNAL MODULE: ./src/constants/api_constants.ts
|
|
399
|
+
var api_constants = __webpack_require__(340);
|
|
400
|
+
// EXTERNAL MODULE: ./src/utilities.ts
|
|
401
|
+
var utilities = __webpack_require__(864);
|
|
402
|
+
// EXTERNAL MODULE: ./src/constants/enums.ts
|
|
403
|
+
var enums = __webpack_require__(56);
|
|
404
|
+
;// ./src/constants/default_settings.ts
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
var DefaultSettings = {
|
|
409
|
+
autocommit: false,
|
|
410
|
+
autocommitSeconds: 10,
|
|
411
|
+
asyncCommit: false,
|
|
412
|
+
sendFullCommit: true,
|
|
413
|
+
lmsCommitUrl: false,
|
|
414
|
+
dataCommitFormat: "json",
|
|
415
|
+
commitRequestDataType: "application/json;charset=UTF-8",
|
|
416
|
+
autoProgress: false,
|
|
417
|
+
logLevel: enums.LogLevelEnum.ERROR,
|
|
418
|
+
selfReportSessionTime: false,
|
|
419
|
+
alwaysSendTotalTime: false,
|
|
420
|
+
renderCommonCommitFields: false,
|
|
421
|
+
strict_errors: true,
|
|
422
|
+
xhrHeaders: {},
|
|
423
|
+
xhrWithCredentials: false,
|
|
424
|
+
fetchMode: "cors",
|
|
425
|
+
responseHandler: function (response) {
|
|
426
|
+
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
427
|
+
var responseText, httpResult;
|
|
428
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
429
|
+
switch (_a.label) {
|
|
430
|
+
case 0:
|
|
431
|
+
if (!(typeof response !== "undefined")) return [3, 2];
|
|
432
|
+
return [4, response.text()];
|
|
433
|
+
case 1:
|
|
434
|
+
responseText = _a.sent();
|
|
435
|
+
httpResult = null;
|
|
436
|
+
if (responseText) {
|
|
437
|
+
httpResult = JSON.parse(responseText);
|
|
438
|
+
}
|
|
439
|
+
if (httpResult === null ||
|
|
440
|
+
!{}.hasOwnProperty.call(httpResult, "result")) {
|
|
441
|
+
if (response.status === 200) {
|
|
442
|
+
return [2, {
|
|
443
|
+
result: api_constants.global_constants.SCORM_TRUE,
|
|
444
|
+
errorCode: 0
|
|
445
|
+
}];
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
return [2, {
|
|
449
|
+
result: api_constants.global_constants.SCORM_FALSE,
|
|
450
|
+
errorCode: 101
|
|
451
|
+
}];
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
return [2, {
|
|
456
|
+
result: httpResult.result,
|
|
457
|
+
errorCode: typeof httpResult.errorCode === "number"
|
|
458
|
+
? httpResult.errorCode
|
|
459
|
+
: httpResult.result === true || httpResult.result === api_constants.global_constants.SCORM_TRUE
|
|
460
|
+
? 0
|
|
461
|
+
: 101
|
|
462
|
+
}];
|
|
463
|
+
}
|
|
464
|
+
// removed by dead control flow
|
|
465
|
+
|
|
466
|
+
case 2: return [2, {
|
|
467
|
+
result: api_constants.global_constants.SCORM_FALSE,
|
|
468
|
+
errorCode: 101
|
|
469
|
+
}];
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
requestHandler: function (commitObject) {
|
|
475
|
+
return commitObject;
|
|
476
|
+
},
|
|
477
|
+
onLogMessage: function (messageLevel, logMessage) {
|
|
478
|
+
switch (messageLevel) {
|
|
479
|
+
case "4":
|
|
480
|
+
case 4:
|
|
481
|
+
case "ERROR":
|
|
482
|
+
case enums.LogLevelEnum.ERROR:
|
|
483
|
+
console.error(logMessage);
|
|
484
|
+
break;
|
|
485
|
+
case "3":
|
|
486
|
+
case 3:
|
|
487
|
+
case "WARN":
|
|
488
|
+
case enums.LogLevelEnum.WARN:
|
|
489
|
+
console.warn(logMessage);
|
|
490
|
+
break;
|
|
491
|
+
case "2":
|
|
492
|
+
case 2:
|
|
493
|
+
case "INFO":
|
|
494
|
+
case enums.LogLevelEnum.INFO:
|
|
495
|
+
console.info(logMessage);
|
|
496
|
+
break;
|
|
497
|
+
case "1":
|
|
498
|
+
case 1:
|
|
499
|
+
case "DEBUG":
|
|
500
|
+
case enums.LogLevelEnum.DEBUG:
|
|
501
|
+
if (console.debug) {
|
|
502
|
+
console.debug(logMessage);
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
console.log(logMessage);
|
|
506
|
+
}
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
scoItemIds: [],
|
|
511
|
+
scoItemIdValidator: false,
|
|
512
|
+
globalObjectiveIds: []
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
;// ./src/helpers/scheduled_commit.ts
|
|
516
|
+
|
|
517
|
+
var ScheduledCommit = (function () {
|
|
518
|
+
function ScheduledCommit(API, when, callback) {
|
|
519
|
+
this._cancelled = false;
|
|
520
|
+
this._API = API;
|
|
521
|
+
this._timeout = setTimeout(this.wrapper.bind(this), when);
|
|
522
|
+
this._callback = callback;
|
|
523
|
+
}
|
|
524
|
+
ScheduledCommit.prototype.cancel = function () {
|
|
525
|
+
this._cancelled = true;
|
|
526
|
+
if (this._timeout) {
|
|
527
|
+
clearTimeout(this._timeout);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
ScheduledCommit.prototype.wrapper = function () {
|
|
531
|
+
var _this = this;
|
|
532
|
+
if (!this._cancelled) {
|
|
533
|
+
(function () { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () { return (0,tslib_es6.__generator)(this, function (_a) {
|
|
534
|
+
switch (_a.label) {
|
|
535
|
+
case 0: return [4, this._API.commit(this._callback)];
|
|
536
|
+
case 1: return [2, _a.sent()];
|
|
537
|
+
}
|
|
538
|
+
}); }); })();
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
return ScheduledCommit;
|
|
542
|
+
}());
|
|
1420
543
|
|
|
1421
|
-
/***/ 56:
|
|
1422
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1423
544
|
|
|
1424
|
-
|
|
1425
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1426
|
-
/* harmony export */ CompletionStatus: function() { return /* binding */ CompletionStatus; },
|
|
1427
|
-
/* harmony export */ LogLevelEnum: function() { return /* binding */ LogLevelEnum; },
|
|
1428
|
-
/* harmony export */ NAVBoolean: function() { return /* binding */ NAVBoolean; },
|
|
1429
|
-
/* harmony export */ SuccessStatus: function() { return /* binding */ SuccessStatus; }
|
|
1430
|
-
/* harmony export */ });
|
|
1431
|
-
var NAVBoolean;
|
|
1432
|
-
(function (NAVBoolean) {
|
|
1433
|
-
NAVBoolean["unknown"] = "unknown";
|
|
1434
|
-
NAVBoolean["true"] = "true";
|
|
1435
|
-
NAVBoolean["false"] = "false";
|
|
1436
|
-
})(NAVBoolean || (NAVBoolean = {}));
|
|
1437
|
-
var SuccessStatus;
|
|
1438
|
-
(function (SuccessStatus) {
|
|
1439
|
-
SuccessStatus["passed"] = "passed";
|
|
1440
|
-
SuccessStatus["failed"] = "failed";
|
|
1441
|
-
SuccessStatus["unknown"] = "unknown";
|
|
1442
|
-
})(SuccessStatus || (SuccessStatus = {}));
|
|
1443
|
-
var CompletionStatus;
|
|
1444
|
-
(function (CompletionStatus) {
|
|
1445
|
-
CompletionStatus["completed"] = "completed";
|
|
1446
|
-
CompletionStatus["incomplete"] = "incomplete";
|
|
1447
|
-
CompletionStatus["unknown"] = "unknown";
|
|
1448
|
-
})(CompletionStatus || (CompletionStatus = {}));
|
|
1449
|
-
var LogLevelEnum;
|
|
1450
|
-
(function (LogLevelEnum) {
|
|
1451
|
-
LogLevelEnum[LogLevelEnum["_"] = 0] = "_";
|
|
1452
|
-
LogLevelEnum[LogLevelEnum["DEBUG"] = 1] = "DEBUG";
|
|
1453
|
-
LogLevelEnum[LogLevelEnum["INFO"] = 2] = "INFO";
|
|
1454
|
-
LogLevelEnum[LogLevelEnum["WARN"] = 3] = "WARN";
|
|
1455
|
-
LogLevelEnum[LogLevelEnum["ERROR"] = 4] = "ERROR";
|
|
1456
|
-
LogLevelEnum[LogLevelEnum["NONE"] = 5] = "NONE";
|
|
1457
|
-
})(LogLevelEnum || (LogLevelEnum = {}));
|
|
545
|
+
;// ./src/BaseAPI.ts
|
|
1458
546
|
|
|
1459
547
|
|
|
1460
|
-
/***/ }),
|
|
1461
548
|
|
|
1462
|
-
/***/ 797:
|
|
1463
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1464
549
|
|
|
1465
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1466
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1467
|
-
/* harmony export */ global_errors: function() { return /* binding */ global_errors; },
|
|
1468
|
-
/* harmony export */ scorm12_errors: function() { return /* binding */ scorm12_errors; },
|
|
1469
|
-
/* harmony export */ scorm2004_errors: function() { return /* binding */ scorm2004_errors; }
|
|
1470
|
-
/* harmony export */ });
|
|
1471
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1472
550
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
};
|
|
1503
|
-
|
|
1504
|
-
var
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
var BaseAPI = (function () {
|
|
555
|
+
function BaseAPI(error_codes, settings) {
|
|
556
|
+
var _newTarget = this.constructor;
|
|
557
|
+
var _a, _c;
|
|
558
|
+
this._settings = DefaultSettings;
|
|
559
|
+
if (_newTarget === BaseAPI) {
|
|
560
|
+
throw new TypeError("Cannot construct BaseAPI instances directly");
|
|
561
|
+
}
|
|
562
|
+
this.currentState = api_constants.global_constants.STATE_NOT_INITIALIZED;
|
|
563
|
+
this.lastErrorCode = "0";
|
|
564
|
+
this.listenerArray = [];
|
|
565
|
+
this._error_codes = error_codes;
|
|
566
|
+
if (settings) {
|
|
567
|
+
this.settings = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, DefaultSettings), settings);
|
|
568
|
+
}
|
|
569
|
+
this.apiLogLevel = (_a = this.settings.logLevel) !== null && _a !== void 0 ? _a : enums.LogLevelEnum.ERROR;
|
|
570
|
+
this.selfReportSessionTime = (_c = this.settings.selfReportSessionTime) !== null && _c !== void 0 ? _c : false;
|
|
571
|
+
}
|
|
572
|
+
BaseAPI.prototype.commonReset = function (settings) {
|
|
573
|
+
this.apiLog("reset", "Called", enums.LogLevelEnum.INFO);
|
|
574
|
+
this.settings = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, this.settings), settings);
|
|
575
|
+
this.clearScheduledCommit();
|
|
576
|
+
this.currentState = api_constants.global_constants.STATE_NOT_INITIALIZED;
|
|
577
|
+
this.lastErrorCode = "0";
|
|
578
|
+
this.listenerArray = [];
|
|
579
|
+
this.startingData = {};
|
|
580
|
+
};
|
|
581
|
+
BaseAPI.prototype.initialize = function (callbackName, initializeMessage, terminationMessage) {
|
|
582
|
+
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
583
|
+
if (this.isInitialized()) {
|
|
584
|
+
this.throwSCORMError(this._error_codes.INITIALIZED, initializeMessage);
|
|
585
|
+
}
|
|
586
|
+
else if (this.isTerminated()) {
|
|
587
|
+
this.throwSCORMError(this._error_codes.TERMINATED, terminationMessage);
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
if (this.selfReportSessionTime) {
|
|
591
|
+
this.cmi.setStartTime();
|
|
592
|
+
}
|
|
593
|
+
this.currentState = api_constants.global_constants.STATE_INITIALIZED;
|
|
594
|
+
this.lastErrorCode = "0";
|
|
595
|
+
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
596
|
+
this.processListeners(callbackName);
|
|
597
|
+
}
|
|
598
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
599
|
+
this.clearSCORMError(returnValue);
|
|
600
|
+
return returnValue;
|
|
601
|
+
};
|
|
602
|
+
BaseAPI.prototype.apiLog = function (functionName, logMessage, messageLevel, CMIElement) {
|
|
603
|
+
logMessage = (0,utilities.formatMessage)(functionName, logMessage, CMIElement);
|
|
604
|
+
if (messageLevel >= this.apiLogLevel) {
|
|
605
|
+
this.settings.onLogMessage(messageLevel, logMessage);
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
Object.defineProperty(BaseAPI.prototype, "error_codes", {
|
|
609
|
+
get: function () {
|
|
610
|
+
return this._error_codes;
|
|
611
|
+
},
|
|
612
|
+
enumerable: false,
|
|
613
|
+
configurable: true
|
|
614
|
+
});
|
|
615
|
+
Object.defineProperty(BaseAPI.prototype, "settings", {
|
|
616
|
+
get: function () {
|
|
617
|
+
return this._settings;
|
|
618
|
+
},
|
|
619
|
+
set: function (settings) {
|
|
620
|
+
this._settings = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, this._settings), settings);
|
|
621
|
+
},
|
|
622
|
+
enumerable: false,
|
|
623
|
+
configurable: true
|
|
624
|
+
});
|
|
625
|
+
BaseAPI.prototype.terminate = function (callbackName, checkTerminated) {
|
|
626
|
+
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
627
|
+
var returnValue, result;
|
|
628
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
629
|
+
switch (_a.label) {
|
|
630
|
+
case 0:
|
|
631
|
+
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
632
|
+
if (!this.checkState(checkTerminated, this._error_codes.TERMINATION_BEFORE_INIT, this._error_codes.MULTIPLE_TERMINATION)) return [3, 2];
|
|
633
|
+
this.currentState = api_constants.global_constants.STATE_TERMINATED;
|
|
634
|
+
return [4, this.storeData(true)];
|
|
635
|
+
case 1:
|
|
636
|
+
result = _a.sent();
|
|
637
|
+
if (typeof result.errorCode !== "undefined" && result.errorCode > 0) {
|
|
638
|
+
this.throwSCORMError(result.errorCode);
|
|
639
|
+
}
|
|
640
|
+
returnValue =
|
|
641
|
+
typeof result !== "undefined" && (result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)
|
|
642
|
+
? api_constants.global_constants.SCORM_TRUE
|
|
643
|
+
: api_constants.global_constants.SCORM_FALSE;
|
|
644
|
+
if (checkTerminated)
|
|
645
|
+
this.lastErrorCode = "0";
|
|
646
|
+
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
647
|
+
this.processListeners(callbackName);
|
|
648
|
+
_a.label = 2;
|
|
649
|
+
case 2:
|
|
650
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
651
|
+
this.clearSCORMError(returnValue);
|
|
652
|
+
return [2, returnValue];
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
};
|
|
657
|
+
BaseAPI.prototype.getValue = function (callbackName, checkTerminated, CMIElement) {
|
|
658
|
+
var returnValue = "";
|
|
659
|
+
if (this.checkState(checkTerminated, this._error_codes.RETRIEVE_BEFORE_INIT, this._error_codes.RETRIEVE_AFTER_TERM)) {
|
|
660
|
+
if (checkTerminated)
|
|
661
|
+
this.lastErrorCode = "0";
|
|
662
|
+
try {
|
|
663
|
+
returnValue = this.getCMIValue(CMIElement);
|
|
664
|
+
}
|
|
665
|
+
catch (e) {
|
|
666
|
+
returnValue = this.handleValueAccessException(e, returnValue);
|
|
667
|
+
}
|
|
668
|
+
this.processListeners(callbackName, CMIElement);
|
|
669
|
+
}
|
|
670
|
+
this.apiLog(callbackName, ": returned: " + returnValue, enums.LogLevelEnum.INFO, CMIElement);
|
|
671
|
+
if (returnValue === undefined) {
|
|
672
|
+
return "";
|
|
673
|
+
}
|
|
674
|
+
this.clearSCORMError(returnValue);
|
|
675
|
+
return returnValue;
|
|
676
|
+
};
|
|
677
|
+
BaseAPI.prototype.setValue = function (callbackName, commitCallback, checkTerminated, CMIElement, value) {
|
|
678
|
+
if (value !== undefined) {
|
|
679
|
+
value = String(value);
|
|
680
|
+
}
|
|
681
|
+
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
682
|
+
if (this.checkState(checkTerminated, this._error_codes.STORE_BEFORE_INIT, this._error_codes.STORE_AFTER_TERM)) {
|
|
683
|
+
if (checkTerminated)
|
|
684
|
+
this.lastErrorCode = "0";
|
|
685
|
+
try {
|
|
686
|
+
returnValue = this.setCMIValue(CMIElement, value);
|
|
687
|
+
}
|
|
688
|
+
catch (e) {
|
|
689
|
+
this.handleValueAccessException(e, returnValue);
|
|
690
|
+
}
|
|
691
|
+
this.processListeners(callbackName, CMIElement, value);
|
|
692
|
+
}
|
|
693
|
+
if (returnValue === undefined) {
|
|
694
|
+
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
695
|
+
}
|
|
696
|
+
if (String(this.lastErrorCode) === "0") {
|
|
697
|
+
if (this.settings.autocommit) {
|
|
698
|
+
this.scheduleCommit(this.settings.autocommitSeconds * 1000, commitCallback);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
this.apiLog(callbackName, ": " + value + ": result: " + returnValue, enums.LogLevelEnum.INFO, CMIElement);
|
|
702
|
+
this.clearSCORMError(returnValue);
|
|
703
|
+
return returnValue;
|
|
704
|
+
};
|
|
705
|
+
BaseAPI.prototype.commit = function (callbackName_1) {
|
|
706
|
+
return (0,tslib_es6.__awaiter)(this, arguments, void 0, function (callbackName, checkTerminated) {
|
|
707
|
+
var returnValue, result;
|
|
708
|
+
if (checkTerminated === void 0) { checkTerminated = false; }
|
|
709
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
710
|
+
switch (_a.label) {
|
|
711
|
+
case 0:
|
|
712
|
+
this.clearScheduledCommit();
|
|
713
|
+
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
714
|
+
if (!this.checkState(checkTerminated, this._error_codes.COMMIT_BEFORE_INIT, this._error_codes.COMMIT_AFTER_TERM)) return [3, 2];
|
|
715
|
+
return [4, this.storeData(false)];
|
|
716
|
+
case 1:
|
|
717
|
+
result = _a.sent();
|
|
718
|
+
if (result.errorCode && result.errorCode > 0) {
|
|
719
|
+
this.throwSCORMError(result.errorCode);
|
|
720
|
+
}
|
|
721
|
+
returnValue =
|
|
722
|
+
typeof result !== "undefined" && (result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)
|
|
723
|
+
? api_constants.global_constants.SCORM_TRUE
|
|
724
|
+
: api_constants.global_constants.SCORM_FALSE;
|
|
725
|
+
this.apiLog(callbackName, " Result: " + returnValue, enums.LogLevelEnum.DEBUG, "HttpRequest");
|
|
726
|
+
if (checkTerminated)
|
|
727
|
+
this.lastErrorCode = "0";
|
|
728
|
+
this.processListeners(callbackName);
|
|
729
|
+
_a.label = 2;
|
|
730
|
+
case 2:
|
|
731
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
732
|
+
this.clearSCORMError(returnValue);
|
|
733
|
+
return [2, returnValue];
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
};
|
|
738
|
+
BaseAPI.prototype.getLastError = function (callbackName) {
|
|
739
|
+
var returnValue = String(this.lastErrorCode);
|
|
740
|
+
this.processListeners(callbackName);
|
|
741
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
742
|
+
return returnValue;
|
|
743
|
+
};
|
|
744
|
+
BaseAPI.prototype.getErrorString = function (callbackName, CMIErrorCode) {
|
|
745
|
+
var returnValue = "";
|
|
746
|
+
if (CMIErrorCode !== null && CMIErrorCode !== "") {
|
|
747
|
+
returnValue = this.getLmsErrorMessageDetails(CMIErrorCode);
|
|
748
|
+
this.processListeners(callbackName);
|
|
749
|
+
}
|
|
750
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
751
|
+
return returnValue;
|
|
752
|
+
};
|
|
753
|
+
BaseAPI.prototype.getDiagnostic = function (callbackName, CMIErrorCode) {
|
|
754
|
+
var returnValue = "";
|
|
755
|
+
if (CMIErrorCode !== null && CMIErrorCode !== "") {
|
|
756
|
+
returnValue = this.getLmsErrorMessageDetails(CMIErrorCode, true);
|
|
757
|
+
this.processListeners(callbackName);
|
|
758
|
+
}
|
|
759
|
+
this.apiLog(callbackName, "returned: " + returnValue, enums.LogLevelEnum.INFO);
|
|
760
|
+
return returnValue;
|
|
761
|
+
};
|
|
762
|
+
BaseAPI.prototype.checkState = function (checkTerminated, beforeInitError, afterTermError) {
|
|
763
|
+
if (this.isNotInitialized()) {
|
|
764
|
+
this.throwSCORMError(beforeInitError);
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
else if (checkTerminated && this.isTerminated()) {
|
|
768
|
+
this.throwSCORMError(afterTermError);
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
return true;
|
|
772
|
+
};
|
|
773
|
+
BaseAPI.prototype.getLmsErrorMessageDetails = function (_errorNumber, _detail) {
|
|
774
|
+
if (_detail === void 0) { _detail = false; }
|
|
775
|
+
throw new Error("The getLmsErrorMessageDetails method has not been implemented");
|
|
776
|
+
};
|
|
777
|
+
BaseAPI.prototype.getCMIValue = function (_CMIElement) {
|
|
778
|
+
throw new Error("The getCMIValue method has not been implemented");
|
|
779
|
+
};
|
|
780
|
+
BaseAPI.prototype.setCMIValue = function (_CMIElement, _value) {
|
|
781
|
+
throw new Error("The setCMIValue method has not been implemented");
|
|
782
|
+
};
|
|
783
|
+
BaseAPI.prototype._commonSetCMIValue = function (methodName, scorm2004, CMIElement, value) {
|
|
784
|
+
if (!CMIElement || CMIElement === "") {
|
|
785
|
+
return api_constants.global_constants.SCORM_FALSE;
|
|
786
|
+
}
|
|
787
|
+
var structure = CMIElement.split(".");
|
|
788
|
+
var refObject = this;
|
|
789
|
+
var returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
790
|
+
var foundFirstIndex = false;
|
|
791
|
+
var invalidErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") is not a valid SCORM data model element.");
|
|
792
|
+
var invalidErrorCode = scorm2004
|
|
793
|
+
? this._error_codes.UNDEFINED_DATA_MODEL
|
|
794
|
+
: this._error_codes.GENERAL;
|
|
795
|
+
for (var idx = 0; idx < structure.length; idx++) {
|
|
796
|
+
var attribute = structure[idx];
|
|
797
|
+
if (!attribute) {
|
|
798
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
799
|
+
return api_constants.global_constants.SCORM_FALSE;
|
|
800
|
+
}
|
|
801
|
+
if (idx === structure.length - 1) {
|
|
802
|
+
if (scorm2004 && attribute.substring(0, 8) === "{target=") {
|
|
803
|
+
if (this.isInitialized()) {
|
|
804
|
+
this.throwSCORMError(this._error_codes.READ_ONLY_ELEMENT);
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
refObject = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, refObject), { attribute: value });
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
else if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
811
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
812
|
+
}
|
|
813
|
+
else {
|
|
814
|
+
if ((0,utilities.stringMatches)(CMIElement, "\\.correct_responses\\.\\d+") &&
|
|
815
|
+
this.isInitialized()) {
|
|
816
|
+
this.validateCorrectResponse(CMIElement, value);
|
|
817
|
+
}
|
|
818
|
+
if (!scorm2004 || this.lastErrorCode === "0") {
|
|
819
|
+
refObject[attribute] = value;
|
|
820
|
+
returnValue = api_constants.global_constants.SCORM_TRUE;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
refObject = refObject[attribute];
|
|
826
|
+
if (!refObject) {
|
|
827
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
if (refObject instanceof array.CMIArray) {
|
|
831
|
+
var index = parseInt(structure[idx + 1] || "0", 10);
|
|
832
|
+
if (!isNaN(index)) {
|
|
833
|
+
var item = refObject.childArray[index];
|
|
834
|
+
if (item) {
|
|
835
|
+
refObject = item;
|
|
836
|
+
foundFirstIndex = true;
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
var newChild = this.getChildElement(CMIElement, value, foundFirstIndex);
|
|
840
|
+
foundFirstIndex = true;
|
|
841
|
+
if (!newChild) {
|
|
842
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
843
|
+
}
|
|
844
|
+
else {
|
|
845
|
+
if (refObject.initialized)
|
|
846
|
+
newChild.initialize();
|
|
847
|
+
refObject.childArray.push(newChild);
|
|
848
|
+
refObject = newChild;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
idx++;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (returnValue === api_constants.global_constants.SCORM_FALSE) {
|
|
857
|
+
this.apiLog(methodName, "There was an error setting the value for: ".concat(CMIElement, ", value of: ").concat(value), enums.LogLevelEnum.WARN);
|
|
858
|
+
}
|
|
859
|
+
return returnValue;
|
|
860
|
+
};
|
|
861
|
+
BaseAPI.prototype._commonGetCMIValue = function (methodName, scorm2004, CMIElement) {
|
|
862
|
+
if (!CMIElement || CMIElement === "") {
|
|
863
|
+
return "";
|
|
864
|
+
}
|
|
865
|
+
var structure = CMIElement.split(".");
|
|
866
|
+
var refObject = this;
|
|
867
|
+
var attribute = null;
|
|
868
|
+
var uninitializedErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") has not been initialized.");
|
|
869
|
+
var invalidErrorMessage = "The data model element passed to ".concat(methodName, " (").concat(CMIElement, ") is not a valid SCORM data model element.");
|
|
870
|
+
var invalidErrorCode = scorm2004
|
|
871
|
+
? this._error_codes.UNDEFINED_DATA_MODEL
|
|
872
|
+
: this._error_codes.GENERAL;
|
|
873
|
+
for (var idx = 0; idx < structure.length; idx++) {
|
|
874
|
+
attribute = structure[idx];
|
|
875
|
+
if (!attribute) {
|
|
876
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
if (!scorm2004) {
|
|
880
|
+
if (idx === structure.length - 1) {
|
|
881
|
+
if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
882
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
if (String(attribute).substring(0, 8) === "{target=" &&
|
|
889
|
+
typeof refObject._isTargetValid == "function") {
|
|
890
|
+
var target = String(attribute).substring(8, String(attribute).length - 9);
|
|
891
|
+
return refObject._isTargetValid(target);
|
|
892
|
+
}
|
|
893
|
+
else if (!this._checkObjectHasProperty(refObject, attribute)) {
|
|
894
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
refObject = refObject[attribute];
|
|
899
|
+
if (refObject === undefined) {
|
|
900
|
+
this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
if (refObject instanceof array.CMIArray) {
|
|
904
|
+
var index = parseInt(structure[idx + 1] || "", 10);
|
|
905
|
+
if (!isNaN(index)) {
|
|
906
|
+
var item = refObject.childArray[index];
|
|
907
|
+
if (item) {
|
|
908
|
+
refObject = item;
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
this.throwSCORMError(this._error_codes.VALUE_NOT_INITIALIZED, uninitializedErrorMessage);
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
idx++;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
if (refObject === null || refObject === undefined) {
|
|
919
|
+
if (!scorm2004) {
|
|
920
|
+
if (attribute === "_children") {
|
|
921
|
+
this.throwSCORMError(this._error_codes.CHILDREN_ERROR);
|
|
922
|
+
}
|
|
923
|
+
else if (attribute === "_count") {
|
|
924
|
+
this.throwSCORMError(this._error_codes.COUNT_ERROR);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
return refObject;
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
BaseAPI.prototype.isInitialized = function () {
|
|
933
|
+
return this.currentState === api_constants.global_constants.STATE_INITIALIZED;
|
|
934
|
+
};
|
|
935
|
+
BaseAPI.prototype.isNotInitialized = function () {
|
|
936
|
+
return this.currentState === api_constants.global_constants.STATE_NOT_INITIALIZED;
|
|
937
|
+
};
|
|
938
|
+
BaseAPI.prototype.isTerminated = function () {
|
|
939
|
+
return this.currentState === api_constants.global_constants.STATE_TERMINATED;
|
|
940
|
+
};
|
|
941
|
+
BaseAPI.prototype.on = function (listenerName, callback) {
|
|
942
|
+
var _a, _c;
|
|
943
|
+
if (!callback)
|
|
944
|
+
return;
|
|
945
|
+
var listenerFunctions = listenerName.split(" ");
|
|
946
|
+
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
947
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
948
|
+
if (!listenerSplit || listenerSplit.length === 0)
|
|
949
|
+
return;
|
|
950
|
+
var functionName = listenerSplit[0];
|
|
951
|
+
var CMIElement = null;
|
|
952
|
+
if (listenerSplit.length > 1) {
|
|
953
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
954
|
+
}
|
|
955
|
+
this.listenerArray.push({
|
|
956
|
+
functionName: functionName,
|
|
957
|
+
CMIElement: CMIElement,
|
|
958
|
+
callback: callback
|
|
959
|
+
});
|
|
960
|
+
this.apiLog("on", "Added event listener: ".concat(this.listenerArray.length), enums.LogLevelEnum.INFO, functionName);
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
BaseAPI.prototype.off = function (listenerName, callback) {
|
|
964
|
+
var _a, _c;
|
|
965
|
+
if (!callback)
|
|
966
|
+
return;
|
|
967
|
+
var listenerFunctions = listenerName.split(" ");
|
|
968
|
+
var _loop_1 = function (i) {
|
|
969
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
970
|
+
if (!listenerSplit || listenerSplit.length === 0)
|
|
971
|
+
return { value: void 0 };
|
|
972
|
+
var functionName = listenerSplit[0];
|
|
973
|
+
var CMIElement = null;
|
|
974
|
+
if (listenerSplit.length > 1) {
|
|
975
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
976
|
+
}
|
|
977
|
+
var removeIndex = this_1.listenerArray.findIndex(function (obj) {
|
|
978
|
+
return obj.functionName === functionName &&
|
|
979
|
+
obj.CMIElement === CMIElement &&
|
|
980
|
+
obj.callback === callback;
|
|
981
|
+
});
|
|
982
|
+
if (removeIndex !== -1) {
|
|
983
|
+
this_1.listenerArray.splice(removeIndex, 1);
|
|
984
|
+
this_1.apiLog("off", "Removed event listener: ".concat(this_1.listenerArray.length), enums.LogLevelEnum.INFO, functionName);
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
var this_1 = this;
|
|
988
|
+
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
989
|
+
var state_1 = _loop_1(i);
|
|
990
|
+
if (typeof state_1 === "object")
|
|
991
|
+
return state_1.value;
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
BaseAPI.prototype.clear = function (listenerName) {
|
|
995
|
+
var _a, _c;
|
|
996
|
+
var listenerFunctions = listenerName.split(" ");
|
|
997
|
+
var _loop_2 = function (i) {
|
|
998
|
+
var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
|
|
999
|
+
if (!listenerSplit || (listenerSplit === null || listenerSplit === void 0 ? void 0 : listenerSplit.length) === 0)
|
|
1000
|
+
return { value: void 0 };
|
|
1001
|
+
var functionName = listenerSplit[0];
|
|
1002
|
+
var CMIElement = null;
|
|
1003
|
+
if (listenerSplit.length > 1) {
|
|
1004
|
+
CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
|
|
1005
|
+
}
|
|
1006
|
+
this_2.listenerArray = this_2.listenerArray.filter(function (obj) {
|
|
1007
|
+
return obj.functionName !== functionName && obj.CMIElement !== CMIElement;
|
|
1008
|
+
});
|
|
1009
|
+
};
|
|
1010
|
+
var this_2 = this;
|
|
1011
|
+
for (var i = 0; i < listenerFunctions.length; i++) {
|
|
1012
|
+
var state_2 = _loop_2(i);
|
|
1013
|
+
if (typeof state_2 === "object")
|
|
1014
|
+
return state_2.value;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
BaseAPI.prototype.processListeners = function (functionName, CMIElement, value) {
|
|
1018
|
+
this.apiLog(functionName, value, enums.LogLevelEnum.INFO, CMIElement);
|
|
1019
|
+
for (var i = 0; i < this.listenerArray.length; i++) {
|
|
1020
|
+
var listener = this.listenerArray[i];
|
|
1021
|
+
var functionsMatch = listener.functionName === functionName;
|
|
1022
|
+
var listenerHasCMIElement = !!listener.CMIElement;
|
|
1023
|
+
var CMIElementsMatch = false;
|
|
1024
|
+
if (CMIElement &&
|
|
1025
|
+
listener.CMIElement &&
|
|
1026
|
+
listener.CMIElement.substring(listener.CMIElement.length - 1) === "*") {
|
|
1027
|
+
CMIElementsMatch =
|
|
1028
|
+
CMIElement.indexOf(listener.CMIElement.substring(0, listener.CMIElement.length - 1)) === 0;
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
CMIElementsMatch = listener.CMIElement === CMIElement;
|
|
1032
|
+
}
|
|
1033
|
+
if (functionsMatch && (!listenerHasCMIElement || CMIElementsMatch)) {
|
|
1034
|
+
this.apiLog("processListeners", "Processing listener: ".concat(listener.functionName), enums.LogLevelEnum.INFO, CMIElement);
|
|
1035
|
+
listener.callback(CMIElement, value);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
BaseAPI.prototype.throwSCORMError = function (errorNumber, message) {
|
|
1040
|
+
if (!message) {
|
|
1041
|
+
message = this.getLmsErrorMessageDetails(errorNumber);
|
|
1042
|
+
}
|
|
1043
|
+
this.apiLog("throwSCORMError", errorNumber + ": " + message, enums.LogLevelEnum.ERROR);
|
|
1044
|
+
this.lastErrorCode = String(errorNumber);
|
|
1045
|
+
};
|
|
1046
|
+
BaseAPI.prototype.clearSCORMError = function (success) {
|
|
1047
|
+
if (success !== undefined && success !== api_constants.global_constants.SCORM_FALSE) {
|
|
1048
|
+
this.lastErrorCode = "0";
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
BaseAPI.prototype.loadFromFlattenedJSON = function (json, CMIElement) {
|
|
1052
|
+
var _this = this;
|
|
1053
|
+
if (!CMIElement) {
|
|
1054
|
+
CMIElement = "";
|
|
1055
|
+
}
|
|
1056
|
+
if (!this.isNotInitialized()) {
|
|
1057
|
+
console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.");
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
function testPattern(a, c, a_pattern) {
|
|
1061
|
+
var a_match = a.match(a_pattern);
|
|
1062
|
+
var c_match;
|
|
1063
|
+
if (a_match !== null && (c_match = c.match(a_pattern)) !== null) {
|
|
1064
|
+
var a_num = Number(a_match[2]);
|
|
1065
|
+
var c_num = Number(c_match[2]);
|
|
1066
|
+
if (a_num === c_num) {
|
|
1067
|
+
if (a_match[3] === "id") {
|
|
1068
|
+
return -1;
|
|
1069
|
+
}
|
|
1070
|
+
else if (a_match[3] === "type") {
|
|
1071
|
+
if (c_match[3] === "id") {
|
|
1072
|
+
return 1;
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
return -1;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
else {
|
|
1079
|
+
return 1;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return a_num - c_num;
|
|
1083
|
+
}
|
|
1084
|
+
return null;
|
|
1085
|
+
}
|
|
1086
|
+
var int_pattern = /^(cmi\.interactions\.)(\d+)\.(.*)$/;
|
|
1087
|
+
var obj_pattern = /^(cmi\.objectives\.)(\d+)\.(.*)$/;
|
|
1088
|
+
var result = Object.keys(json).map(function (key) {
|
|
1089
|
+
return [String(key), json[key]];
|
|
1090
|
+
});
|
|
1091
|
+
result.sort(function (_a, _c) {
|
|
1092
|
+
var a = _a[0], _b = _a[1];
|
|
1093
|
+
var c = _c[0], _d = _c[1];
|
|
1094
|
+
var test;
|
|
1095
|
+
if ((test = testPattern(a, c, int_pattern)) !== null) {
|
|
1096
|
+
return test;
|
|
1097
|
+
}
|
|
1098
|
+
if ((test = testPattern(a, c, obj_pattern)) !== null) {
|
|
1099
|
+
return test;
|
|
1100
|
+
}
|
|
1101
|
+
if (a < c) {
|
|
1102
|
+
return -1;
|
|
1103
|
+
}
|
|
1104
|
+
if (a > c) {
|
|
1105
|
+
return 1;
|
|
1106
|
+
}
|
|
1107
|
+
return 0;
|
|
1108
|
+
});
|
|
1109
|
+
var obj;
|
|
1110
|
+
result.forEach(function (element) {
|
|
1111
|
+
obj = {};
|
|
1112
|
+
obj[element[0]] = element[1];
|
|
1113
|
+
_this.loadFromJSON((0,utilities.unflatten)(obj), CMIElement);
|
|
1114
|
+
});
|
|
1115
|
+
};
|
|
1116
|
+
BaseAPI.prototype.loadFromJSON = function (json, CMIElement) {
|
|
1117
|
+
if (CMIElement === void 0) { CMIElement = ""; }
|
|
1118
|
+
if ((!CMIElement || CMIElement === "") &&
|
|
1119
|
+
!Object.hasOwnProperty.call(json, "cmi") &&
|
|
1120
|
+
!Object.hasOwnProperty.call(json, "adl")) {
|
|
1121
|
+
CMIElement = "cmi";
|
|
1122
|
+
}
|
|
1123
|
+
if (!this.isNotInitialized()) {
|
|
1124
|
+
console.error("loadFromJSON can only be called before the call to lmsInitialize.");
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
CMIElement = CMIElement !== undefined ? CMIElement : "cmi";
|
|
1128
|
+
this.startingData = json;
|
|
1129
|
+
for (var key in json) {
|
|
1130
|
+
if ({}.hasOwnProperty.call(json, key) && json[key]) {
|
|
1131
|
+
var currentCMIElement = (CMIElement ? CMIElement + "." : "") + key;
|
|
1132
|
+
var value = json[key];
|
|
1133
|
+
if (value["childArray"]) {
|
|
1134
|
+
for (var i = 0; i < value["childArray"].length; i++) {
|
|
1135
|
+
this.loadFromJSON(value["childArray"][i], currentCMIElement + "." + i);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
else if (value.constructor === Object) {
|
|
1139
|
+
this.loadFromJSON(value, currentCMIElement);
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
this.setCMIValue(currentCMIElement, value);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
BaseAPI.prototype.renderCMIToJSONString = function () {
|
|
1148
|
+
var cmi = this.cmi;
|
|
1149
|
+
if (this.settings.sendFullCommit) {
|
|
1150
|
+
return JSON.stringify({ cmi: cmi });
|
|
1151
|
+
}
|
|
1152
|
+
return JSON.stringify({ cmi: cmi }, function (k, v) { return (v === undefined ? null : v); }, 2);
|
|
1153
|
+
};
|
|
1154
|
+
BaseAPI.prototype.renderCMIToJSONObject = function () {
|
|
1155
|
+
return JSON.parse(this.renderCMIToJSONString());
|
|
1156
|
+
};
|
|
1157
|
+
BaseAPI.prototype.processHttpRequest = function (url_1, params_1) {
|
|
1158
|
+
return (0,tslib_es6.__awaiter)(this, arguments, void 0, function (url, params, immediate) {
|
|
1159
|
+
var api, genericError, process;
|
|
1160
|
+
var _this = this;
|
|
1161
|
+
if (immediate === void 0) { immediate = false; }
|
|
1162
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
1163
|
+
switch (_a.label) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
api = this;
|
|
1166
|
+
genericError = {
|
|
1167
|
+
result: api_constants.global_constants.SCORM_FALSE,
|
|
1168
|
+
errorCode: this.error_codes.GENERAL
|
|
1169
|
+
};
|
|
1170
|
+
if (immediate) {
|
|
1171
|
+
params = this.settings.requestHandler(params);
|
|
1172
|
+
this.performFetch(url, params).then(function (response) { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
1173
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
1174
|
+
switch (_a.label) {
|
|
1175
|
+
case 0: return [4, this.transformResponse(response)];
|
|
1176
|
+
case 1:
|
|
1177
|
+
_a.sent();
|
|
1178
|
+
return [2];
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
}); });
|
|
1182
|
+
return [2, {
|
|
1183
|
+
result: api_constants.global_constants.SCORM_TRUE,
|
|
1184
|
+
errorCode: 0
|
|
1185
|
+
}];
|
|
1186
|
+
}
|
|
1187
|
+
process = function (url, params, settings) { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
1188
|
+
var response, e_1, message;
|
|
1189
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
1190
|
+
switch (_a.label) {
|
|
1191
|
+
case 0:
|
|
1192
|
+
_a.trys.push([0, 2, , 3]);
|
|
1193
|
+
params = settings.requestHandler(params);
|
|
1194
|
+
return [4, this.performFetch(url, params)];
|
|
1195
|
+
case 1:
|
|
1196
|
+
response = _a.sent();
|
|
1197
|
+
return [2, this.transformResponse(response)];
|
|
1198
|
+
case 2:
|
|
1199
|
+
e_1 = _a.sent();
|
|
1200
|
+
message = e_1 instanceof Error ? e_1.message : String(e_1);
|
|
1201
|
+
this.apiLog("processHttpRequest", message, enums.LogLevelEnum.ERROR);
|
|
1202
|
+
api.processListeners("CommitError");
|
|
1203
|
+
return [2, genericError];
|
|
1204
|
+
case 3: return [2];
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}); };
|
|
1208
|
+
return [4, process(url, params, this.settings)];
|
|
1209
|
+
case 1: return [2, _a.sent()];
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
});
|
|
1213
|
+
};
|
|
1214
|
+
BaseAPI.prototype.scheduleCommit = function (when, callback) {
|
|
1215
|
+
if (!this._timeout) {
|
|
1216
|
+
this._timeout = new ScheduledCommit(this, when, callback);
|
|
1217
|
+
this.apiLog("scheduleCommit", "scheduled", enums.LogLevelEnum.DEBUG, "");
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
BaseAPI.prototype.clearScheduledCommit = function () {
|
|
1221
|
+
if (this._timeout) {
|
|
1222
|
+
this._timeout.cancel();
|
|
1223
|
+
this._timeout = undefined;
|
|
1224
|
+
this.apiLog("clearScheduledCommit", "cleared", enums.LogLevelEnum.DEBUG, "");
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
BaseAPI.prototype._checkObjectHasProperty = function (refObject, attribute) {
|
|
1228
|
+
return (Object.hasOwnProperty.call(refObject, attribute) ||
|
|
1229
|
+
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(refObject), attribute) != null ||
|
|
1230
|
+
attribute in refObject);
|
|
1231
|
+
};
|
|
1232
|
+
BaseAPI.prototype.handleValueAccessException = function (e, returnValue) {
|
|
1233
|
+
if (e instanceof exceptions.ValidationError) {
|
|
1234
|
+
this.lastErrorCode = String(e.errorCode);
|
|
1235
|
+
returnValue = api_constants.global_constants.SCORM_FALSE;
|
|
1236
|
+
}
|
|
1237
|
+
else {
|
|
1238
|
+
if (e instanceof Error && e.message) {
|
|
1239
|
+
console.error(e.message);
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
console.error(e);
|
|
1243
|
+
}
|
|
1244
|
+
this.throwSCORMError(this._error_codes.GENERAL);
|
|
1245
|
+
}
|
|
1246
|
+
return returnValue;
|
|
1247
|
+
};
|
|
1248
|
+
BaseAPI.prototype.getCommitObject = function (terminateCommit) {
|
|
1249
|
+
var shouldTerminateCommit = terminateCommit || this.settings.alwaysSendTotalTime;
|
|
1250
|
+
var commitObject = this.settings.renderCommonCommitFields
|
|
1251
|
+
? this.renderCommitObject(shouldTerminateCommit)
|
|
1252
|
+
: this.renderCommitCMI(shouldTerminateCommit);
|
|
1253
|
+
if ([enums.LogLevelEnum.DEBUG, "1", 1, "DEBUG"].includes(this.apiLogLevel)) {
|
|
1254
|
+
console.debug("Commit (terminated: " + (terminateCommit ? "yes" : "no") + "): ");
|
|
1255
|
+
console.debug(commitObject);
|
|
1256
|
+
}
|
|
1257
|
+
return commitObject;
|
|
1258
|
+
};
|
|
1259
|
+
BaseAPI.prototype.performFetch = function (url, params) {
|
|
1260
|
+
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
1261
|
+
var init;
|
|
1262
|
+
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
1263
|
+
init = {
|
|
1264
|
+
method: "POST",
|
|
1265
|
+
mode: this.settings.fetchMode,
|
|
1266
|
+
body: params instanceof Array ? params.join("&") : JSON.stringify(params),
|
|
1267
|
+
headers: (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, this.settings.xhrHeaders), { "Content-Type": this.settings.commitRequestDataType }),
|
|
1268
|
+
keepalive: true
|
|
1269
|
+
};
|
|
1270
|
+
if (this.settings.xhrWithCredentials) {
|
|
1271
|
+
init = (0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, init), { credentials: "include" });
|
|
1272
|
+
}
|
|
1273
|
+
return [2, fetch(url, init)];
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
};
|
|
1277
|
+
BaseAPI.prototype.transformResponse = function (response) {
|
|
1278
|
+
return (0,tslib_es6.__awaiter)(this, void 0, void 0, function () {
|
|
1279
|
+
var result, _a;
|
|
1280
|
+
return (0,tslib_es6.__generator)(this, function (_c) {
|
|
1281
|
+
switch (_c.label) {
|
|
1282
|
+
case 0:
|
|
1283
|
+
if (!(typeof this.settings.responseHandler === "function")) return [3, 2];
|
|
1284
|
+
return [4, this.settings.responseHandler(response)];
|
|
1285
|
+
case 1:
|
|
1286
|
+
_a = _c.sent();
|
|
1287
|
+
return [3, 4];
|
|
1288
|
+
case 2: return [4, response.json()];
|
|
1289
|
+
case 3:
|
|
1290
|
+
_a = _c.sent();
|
|
1291
|
+
_c.label = 4;
|
|
1292
|
+
case 4:
|
|
1293
|
+
result = _a;
|
|
1294
|
+
if (response.status >= 200 &&
|
|
1295
|
+
response.status <= 299 &&
|
|
1296
|
+
(result.result === true || result.result === api_constants.global_constants.SCORM_TRUE)) {
|
|
1297
|
+
this.processListeners("CommitSuccess");
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
this.processListeners("CommitError");
|
|
1301
|
+
}
|
|
1302
|
+
return [2, result];
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
});
|
|
1306
|
+
};
|
|
1307
|
+
return BaseAPI;
|
|
1308
|
+
}());
|
|
1309
|
+
/* harmony default export */ var src_BaseAPI = (BaseAPI);
|
|
1505
1310
|
|
|
1506
1311
|
|
|
1507
1312
|
/***/ }),
|
|
1508
1313
|
|
|
1509
|
-
/***/
|
|
1314
|
+
/***/ 434:
|
|
1510
1315
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1511
1316
|
|
|
1512
1317
|
__webpack_require__.r(__webpack_exports__);
|
|
1513
1318
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1514
|
-
/* harmony export */
|
|
1515
|
-
/* harmony export */ scorm12_regex: function() { return /* binding */ scorm12_regex; },
|
|
1516
|
-
/* harmony export */ scorm2004_regex: function() { return /* binding */ scorm2004_regex; }
|
|
1319
|
+
/* harmony export */ CMIScore: function() { return /* binding */ CMIScore; }
|
|
1517
1320
|
/* harmony export */ });
|
|
1518
1321
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1322
|
+
/* harmony import */ var _constants_api_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(340);
|
|
1323
|
+
/* harmony import */ var _constants_regex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(417);
|
|
1324
|
+
/* harmony import */ var _base_cmi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(319);
|
|
1325
|
+
/* harmony import */ var _validation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(449);
|
|
1326
|
+
/* harmony import */ var _constants_error_codes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(797);
|
|
1519
1327
|
|
|
1520
|
-
var scorm12_regex = {
|
|
1521
|
-
CMIString256: "^.{0,255}$",
|
|
1522
|
-
CMIString4096: "^.{0,4096}$",
|
|
1523
|
-
CMITime: "^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)$",
|
|
1524
|
-
CMITimespan: "^([0-9]{2,}):([0-9]{2}):([0-9]{2})(.[0-9]{1,2})?$",
|
|
1525
|
-
CMIInteger: "^\\d+$",
|
|
1526
|
-
CMISInteger: "^-?([0-9]+)$",
|
|
1527
|
-
CMIDecimal: "^-?([0-9]{0,3})(.[0-9]*)?$",
|
|
1528
|
-
CMIIdentifier: "^[\\u0021-\\u007E\\s]{0,255}$",
|
|
1529
|
-
CMIFeedback: "^.*$",
|
|
1530
|
-
CMIIndex: "[._](\\d+).",
|
|
1531
|
-
CMIStatus: "^(passed|completed|failed|incomplete|browsed)$",
|
|
1532
|
-
CMIStatus2: "^(passed|completed|failed|incomplete|browsed|not attempted)$",
|
|
1533
|
-
CMIExit: "^(time-out|suspend|logout|)$",
|
|
1534
|
-
CMIType: "^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$",
|
|
1535
|
-
CMIResult: "^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$",
|
|
1536
|
-
NAVEvent: "^(previous|continue)$",
|
|
1537
|
-
score_range: "0#100",
|
|
1538
|
-
audio_range: "-1#100",
|
|
1539
|
-
speed_range: "-100#100",
|
|
1540
|
-
weighting_range: "-100#100",
|
|
1541
|
-
text_range: "-1#1",
|
|
1542
|
-
};
|
|
1543
|
-
var aicc_regex = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, scorm12_regex), {
|
|
1544
|
-
CMIIdentifier: "^\\w{1,255}$",
|
|
1545
|
-
});
|
|
1546
|
-
var scorm2004_regex = {
|
|
1547
|
-
CMIString200: "^[\\u0000-\\uFFFF]{0,200}$",
|
|
1548
|
-
CMIString250: "^[\\u0000-\\uFFFF]{0,250}$",
|
|
1549
|
-
CMIString1000: "^[\\u0000-\\uFFFF]{0,1000}$",
|
|
1550
|
-
CMIString4000: "^[\\u0000-\\uFFFF]{0,4000}$",
|
|
1551
|
-
CMIString64000: "^[\\u0000-\\uFFFF]{0,64000}$",
|
|
1552
|
-
CMILang: "^([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$",
|
|
1553
|
-
CMILangString250: "^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",
|
|
1554
|
-
CMILangcr: "^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$",
|
|
1555
|
-
CMILangString250cr: "^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$",
|
|
1556
|
-
CMILangString4000: "^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",
|
|
1557
|
-
CMITime: "^(19[7-9]{1}[0-9]{1}|20[0-2]{1}[0-9]{1}|203[0-8]{1})((-(0[1-9]{1}|1[0-2]{1}))((-(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]{1}))(T([0-1]{1}[0-9]{1}|2[0-3]{1})((:[0-5]{1}[0-9]{1})((:[0-5]{1}[0-9]{1})((\\.[0-9]{1,2})((Z|([+|-]([0-1]{1}[0-9]{1}|2[0-3]{1})))(:[0-5]{1}[0-9]{1})?)?)?)?)?)?)?)?$",
|
|
1558
|
-
CMITimespan: "^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?)?$",
|
|
1559
|
-
CMIInteger: "^\\d+$",
|
|
1560
|
-
CMISInteger: "^-?([0-9]+)$",
|
|
1561
|
-
CMIDecimal: "^-?([0-9]{1,5})(\\.[0-9]{1,18})?$",
|
|
1562
|
-
CMIIdentifier: "^\\S{1,250}[a-zA-Z0-9]$",
|
|
1563
|
-
CMIShortIdentifier: "^[\\w\\.\\-\\_]{1,250}$",
|
|
1564
|
-
CMILongIdentifier: "^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",
|
|
1565
|
-
CMIFeedback: "^.*$",
|
|
1566
|
-
CMIIndex: "[._](\\d+).",
|
|
1567
|
-
CMIIndexStore: ".N(\\d+).",
|
|
1568
|
-
CMICStatus: "^(completed|incomplete|not attempted|unknown)$",
|
|
1569
|
-
CMISStatus: "^(passed|failed|unknown)$",
|
|
1570
|
-
CMIExit: "^(time-out|suspend|logout|normal)$",
|
|
1571
|
-
CMIType: "^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$",
|
|
1572
|
-
CMIResult: "^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$",
|
|
1573
|
-
NAVEvent: "^(previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",
|
|
1574
|
-
NAVBoolean: "^(unknown|true|false$)",
|
|
1575
|
-
NAVTarget: "^{target=\\S{0,}[a-zA-Z0-9-_]+}$",
|
|
1576
|
-
scaled_range: "-1#1",
|
|
1577
|
-
audio_range: "0#*",
|
|
1578
|
-
speed_range: "0#*",
|
|
1579
|
-
text_range: "-1#1",
|
|
1580
|
-
progress_range: "0#1",
|
|
1581
|
-
};
|
|
1582
1328
|
|
|
1583
1329
|
|
|
1584
|
-
/***/ }),
|
|
1585
1330
|
|
|
1586
|
-
/***/ 784:
|
|
1587
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1588
1331
|
|
|
1589
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1590
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1591
|
-
/* harmony export */ BaseScormValidationError: function() { return /* binding */ BaseScormValidationError; },
|
|
1592
|
-
/* harmony export */ ValidationError: function() { return /* binding */ ValidationError; }
|
|
1593
|
-
/* harmony export */ });
|
|
1594
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1595
1332
|
|
|
1596
|
-
var
|
|
1597
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(
|
|
1598
|
-
function
|
|
1599
|
-
var _this = _super.call(this
|
|
1600
|
-
_this.
|
|
1601
|
-
_this.
|
|
1333
|
+
var CMIScore = (function (_super) {
|
|
1334
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(CMIScore, _super);
|
|
1335
|
+
function CMIScore(params) {
|
|
1336
|
+
var _this = _super.call(this) || this;
|
|
1337
|
+
_this._raw = "";
|
|
1338
|
+
_this._min = "";
|
|
1339
|
+
_this.__children = params.score_children || _constants_api_constants__WEBPACK_IMPORTED_MODULE_1__.scorm12_constants.score_children;
|
|
1340
|
+
_this.__score_range = !params.score_range
|
|
1341
|
+
? false
|
|
1342
|
+
: _constants_regex__WEBPACK_IMPORTED_MODULE_2__.scorm12_regex.score_range;
|
|
1343
|
+
_this._max = params.max || params.max === "" ? params.max : "100";
|
|
1344
|
+
_this.__invalid_error_code =
|
|
1345
|
+
params.invalidErrorCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_5__.scorm12_errors.INVALID_SET_VALUE;
|
|
1346
|
+
_this.__invalid_type_code =
|
|
1347
|
+
params.invalidTypeCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_5__.scorm12_errors.TYPE_MISMATCH;
|
|
1348
|
+
_this.__invalid_range_code =
|
|
1349
|
+
params.invalidRangeCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_5__.scorm12_errors.VALUE_OUT_OF_RANGE;
|
|
1350
|
+
_this.__decimal_regex = params.decimalRegex || _constants_regex__WEBPACK_IMPORTED_MODULE_2__.scorm12_regex.CMIDecimal;
|
|
1351
|
+
_this.__error_class = params.errorClass;
|
|
1602
1352
|
return _this;
|
|
1603
1353
|
}
|
|
1604
|
-
|
|
1354
|
+
CMIScore.prototype.reset = function () {
|
|
1355
|
+
this._initialized = false;
|
|
1356
|
+
};
|
|
1357
|
+
Object.defineProperty(CMIScore.prototype, "_children", {
|
|
1605
1358
|
get: function () {
|
|
1606
|
-
return this.
|
|
1359
|
+
return this.__children;
|
|
1360
|
+
},
|
|
1361
|
+
set: function (_children) {
|
|
1362
|
+
throw new this.__error_class(this.__invalid_error_code);
|
|
1607
1363
|
},
|
|
1608
1364
|
enumerable: false,
|
|
1609
1365
|
configurable: true
|
|
1610
1366
|
});
|
|
1611
|
-
|
|
1612
|
-
}(Error));
|
|
1613
|
-
|
|
1614
|
-
var ValidationError = (function (_super) {
|
|
1615
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(ValidationError, _super);
|
|
1616
|
-
function ValidationError(errorCode, errorMessage, detailedMessage) {
|
|
1617
|
-
var _this = _super.call(this, errorCode) || this;
|
|
1618
|
-
_this._detailedMessage = "";
|
|
1619
|
-
_this.message = errorMessage;
|
|
1620
|
-
_this._errorMessage = errorMessage;
|
|
1621
|
-
if (detailedMessage) {
|
|
1622
|
-
_this._detailedMessage = detailedMessage;
|
|
1623
|
-
}
|
|
1624
|
-
return _this;
|
|
1625
|
-
}
|
|
1626
|
-
Object.defineProperty(ValidationError.prototype, "errorMessage", {
|
|
1367
|
+
Object.defineProperty(CMIScore.prototype, "raw", {
|
|
1627
1368
|
get: function () {
|
|
1628
|
-
return this.
|
|
1369
|
+
return this._raw;
|
|
1370
|
+
},
|
|
1371
|
+
set: function (raw) {
|
|
1372
|
+
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(raw, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1373
|
+
(!this.__score_range ||
|
|
1374
|
+
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(raw, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1375
|
+
this._raw = raw;
|
|
1376
|
+
}
|
|
1629
1377
|
},
|
|
1630
1378
|
enumerable: false,
|
|
1631
1379
|
configurable: true
|
|
1632
1380
|
});
|
|
1633
|
-
Object.defineProperty(
|
|
1381
|
+
Object.defineProperty(CMIScore.prototype, "min", {
|
|
1634
1382
|
get: function () {
|
|
1635
|
-
return this.
|
|
1383
|
+
return this._min;
|
|
1384
|
+
},
|
|
1385
|
+
set: function (min) {
|
|
1386
|
+
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(min, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1387
|
+
(!this.__score_range ||
|
|
1388
|
+
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(min, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1389
|
+
this._min = min;
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
enumerable: false,
|
|
1393
|
+
configurable: true
|
|
1394
|
+
});
|
|
1395
|
+
Object.defineProperty(CMIScore.prototype, "max", {
|
|
1396
|
+
get: function () {
|
|
1397
|
+
return this._max;
|
|
1398
|
+
},
|
|
1399
|
+
set: function (max) {
|
|
1400
|
+
if ((0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidFormat)(max, this.__decimal_regex, this.__invalid_type_code, this.__error_class) &&
|
|
1401
|
+
(!this.__score_range ||
|
|
1402
|
+
(0,_validation__WEBPACK_IMPORTED_MODULE_4__.checkValidRange)(max, this.__score_range, this.__invalid_range_code, this.__error_class))) {
|
|
1403
|
+
this._max = max;
|
|
1404
|
+
}
|
|
1636
1405
|
},
|
|
1637
1406
|
enumerable: false,
|
|
1638
1407
|
configurable: true
|
|
1639
1408
|
});
|
|
1640
|
-
|
|
1641
|
-
|
|
1409
|
+
CMIScore.prototype.toJSON = function () {
|
|
1410
|
+
this.jsonString = true;
|
|
1411
|
+
var result = {
|
|
1412
|
+
raw: this.raw,
|
|
1413
|
+
min: this.min,
|
|
1414
|
+
max: this.max,
|
|
1415
|
+
};
|
|
1416
|
+
delete this.jsonString;
|
|
1417
|
+
return result;
|
|
1418
|
+
};
|
|
1419
|
+
return CMIScore;
|
|
1420
|
+
}(_base_cmi__WEBPACK_IMPORTED_MODULE_3__.BaseCMI));
|
|
1642
1421
|
|
|
1643
1422
|
|
|
1644
1423
|
|
|
1645
1424
|
/***/ }),
|
|
1646
1425
|
|
|
1647
|
-
/***/
|
|
1426
|
+
/***/ 449:
|
|
1648
1427
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1649
1428
|
|
|
1650
1429
|
__webpack_require__.r(__webpack_exports__);
|
|
1651
1430
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1652
|
-
/* harmony export */
|
|
1653
|
-
/* harmony export */
|
|
1654
|
-
/* harmony export */ SECONDS_PER_MINUTE: function() { return /* binding */ SECONDS_PER_MINUTE; },
|
|
1655
|
-
/* harmony export */ SECONDS_PER_SECOND: function() { return /* binding */ SECONDS_PER_SECOND; },
|
|
1656
|
-
/* harmony export */ addHHMMSSTimeStrings: function() { return /* binding */ addHHMMSSTimeStrings; },
|
|
1657
|
-
/* harmony export */ addTwoDurations: function() { return /* binding */ addTwoDurations; },
|
|
1658
|
-
/* harmony export */ countDecimals: function() { return /* binding */ countDecimals; },
|
|
1659
|
-
/* harmony export */ flatten: function() { return /* binding */ flatten; },
|
|
1660
|
-
/* harmony export */ formatMessage: function() { return /* binding */ formatMessage; },
|
|
1661
|
-
/* harmony export */ getDurationAsSeconds: function() { return /* binding */ getDurationAsSeconds; },
|
|
1662
|
-
/* harmony export */ getSecondsAsHHMMSS: function() { return /* binding */ getSecondsAsHHMMSS; },
|
|
1663
|
-
/* harmony export */ getSecondsAsISODuration: function() { return /* binding */ getSecondsAsISODuration; },
|
|
1664
|
-
/* harmony export */ getTimeAsSeconds: function() { return /* binding */ getTimeAsSeconds; },
|
|
1665
|
-
/* harmony export */ stringMatches: function() { return /* binding */ stringMatches; },
|
|
1666
|
-
/* harmony export */ unflatten: function() { return /* binding */ unflatten; }
|
|
1431
|
+
/* harmony export */ checkValidFormat: function() { return /* binding */ checkValidFormat; },
|
|
1432
|
+
/* harmony export */ checkValidRange: function() { return /* binding */ checkValidRange; }
|
|
1667
1433
|
/* harmony export */ });
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
var SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
|
|
1672
|
-
var designations = {
|
|
1673
|
-
D: SECONDS_PER_DAY,
|
|
1674
|
-
H: SECONDS_PER_HOUR,
|
|
1675
|
-
M: SECONDS_PER_MINUTE,
|
|
1676
|
-
S: SECONDS_PER_SECOND,
|
|
1677
|
-
};
|
|
1678
|
-
function getSecondsAsHHMMSS(totalSeconds) {
|
|
1679
|
-
if (!totalSeconds || totalSeconds <= 0) {
|
|
1680
|
-
return "00:00:00";
|
|
1434
|
+
function checkValidFormat(value, regexPattern, errorCode, errorClass, allowEmptyString) {
|
|
1435
|
+
if (typeof value !== "string") {
|
|
1436
|
+
return false;
|
|
1681
1437
|
}
|
|
1682
|
-
var
|
|
1683
|
-
var
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
var ms = totalSeconds % 1.0;
|
|
1687
|
-
var msStr = "";
|
|
1688
|
-
if (countDecimals(ms) > 0) {
|
|
1689
|
-
if (countDecimals(ms) > 2) {
|
|
1690
|
-
msStr = ms.toFixed(2);
|
|
1691
|
-
}
|
|
1692
|
-
else {
|
|
1693
|
-
msStr = String(ms);
|
|
1694
|
-
}
|
|
1695
|
-
msStr = "." + msStr.split(".")[1];
|
|
1438
|
+
var formatRegex = new RegExp(regexPattern);
|
|
1439
|
+
var matches = value.match(formatRegex);
|
|
1440
|
+
if (allowEmptyString && value === "") {
|
|
1441
|
+
return true;
|
|
1696
1442
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
function getSecondsAsISODuration(seconds) {
|
|
1700
|
-
if (!seconds || seconds <= 0) {
|
|
1701
|
-
return "PT0S";
|
|
1443
|
+
if (value === undefined || !matches || matches[0] === "") {
|
|
1444
|
+
throw new errorClass(errorCode);
|
|
1702
1445
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
if (designationsKey === "S" && remainder > 0) {
|
|
1713
|
-
value += remainder;
|
|
1446
|
+
return true;
|
|
1447
|
+
}
|
|
1448
|
+
function checkValidRange(value, rangePattern, errorCode, errorClass) {
|
|
1449
|
+
var ranges = rangePattern.split("#");
|
|
1450
|
+
value = value * 1.0;
|
|
1451
|
+
if (ranges[0] && value >= ranges[0]) {
|
|
1452
|
+
if (ranges[1] && (ranges[1] === "*" || value <= ranges[1])) {
|
|
1453
|
+
return true;
|
|
1714
1454
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
designationsKey === "H" ||
|
|
1718
|
-
designationsKey === "M" ||
|
|
1719
|
-
designationsKey === "S") &&
|
|
1720
|
-
duration.indexOf("T") === -1) {
|
|
1721
|
-
duration += "T";
|
|
1722
|
-
}
|
|
1723
|
-
duration += "".concat(value).concat(designationsKey);
|
|
1455
|
+
else {
|
|
1456
|
+
throw new errorClass(errorCode);
|
|
1724
1457
|
}
|
|
1725
1458
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
function getTimeAsSeconds(timeString, timeRegex) {
|
|
1729
|
-
if (typeof timeString === "number" || typeof timeString === "boolean") {
|
|
1730
|
-
timeString = String(timeString);
|
|
1731
|
-
}
|
|
1732
|
-
if (typeof timeRegex === "string") {
|
|
1733
|
-
timeRegex = new RegExp(timeRegex);
|
|
1734
|
-
}
|
|
1735
|
-
if (!timeString || !timeString.match(timeRegex)) {
|
|
1736
|
-
return 0;
|
|
1737
|
-
}
|
|
1738
|
-
var parts = timeString.split(":");
|
|
1739
|
-
var hours = Number(parts[0]);
|
|
1740
|
-
var minutes = Number(parts[1]);
|
|
1741
|
-
var seconds = Number(parts[2]);
|
|
1742
|
-
return hours * 3600 + minutes * 60 + seconds;
|
|
1743
|
-
}
|
|
1744
|
-
function getDurationAsSeconds(duration, durationRegex) {
|
|
1745
|
-
if (typeof durationRegex === "string") {
|
|
1746
|
-
durationRegex = new RegExp(durationRegex);
|
|
1747
|
-
}
|
|
1748
|
-
if (!duration || !duration.match(durationRegex)) {
|
|
1749
|
-
return 0;
|
|
1459
|
+
else {
|
|
1460
|
+
throw new errorClass(errorCode);
|
|
1750
1461
|
}
|
|
1751
|
-
var _a = new RegExp(durationRegex).exec(duration) || [], years = _a[1], _ = _a[2], days = _a[4], hours = _a[5], minutes = _a[6], seconds = _a[7];
|
|
1752
|
-
var result = 0.0;
|
|
1753
|
-
result += Number(seconds) || 0.0;
|
|
1754
|
-
result += Number(minutes) * 60.0 || 0.0;
|
|
1755
|
-
result += Number(hours) * 3600.0 || 0.0;
|
|
1756
|
-
result += Number(days) * (60 * 60 * 24.0) || 0.0;
|
|
1757
|
-
result += Number(years) * (60 * 60 * 24 * 365.0) || 0.0;
|
|
1758
|
-
return result;
|
|
1759
|
-
}
|
|
1760
|
-
function addTwoDurations(first, second, durationRegex) {
|
|
1761
|
-
var regex = typeof durationRegex === "string"
|
|
1762
|
-
? new RegExp(durationRegex)
|
|
1763
|
-
: durationRegex;
|
|
1764
|
-
return getSecondsAsISODuration(getDurationAsSeconds(first, regex) + getDurationAsSeconds(second, regex));
|
|
1765
1462
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
/***/ }),
|
|
1466
|
+
|
|
1467
|
+
/***/ 589:
|
|
1468
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1469
|
+
|
|
1470
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1471
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1472
|
+
/* harmony export */ CMIArray: function() { return /* binding */ CMIArray; }
|
|
1473
|
+
/* harmony export */ });
|
|
1474
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1475
|
+
/* harmony import */ var _base_cmi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(319);
|
|
1476
|
+
/* harmony import */ var _exceptions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(784);
|
|
1477
|
+
/* harmony import */ var _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(797);
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
var CMIArray = (function (_super) {
|
|
1483
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(CMIArray, _super);
|
|
1484
|
+
function CMIArray(params) {
|
|
1485
|
+
var _this = _super.call(this) || this;
|
|
1486
|
+
_this.__children = params.children;
|
|
1487
|
+
_this._errorCode = params.errorCode || _constants_error_codes__WEBPACK_IMPORTED_MODULE_3__.scorm12_errors.GENERAL;
|
|
1488
|
+
_this._errorClass = params.errorClass || _exceptions__WEBPACK_IMPORTED_MODULE_2__.BaseScormValidationError;
|
|
1489
|
+
_this.childArray = [];
|
|
1490
|
+
return _this;
|
|
1769
1491
|
}
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
if (Object(cur) !== cur) {
|
|
1776
|
-
result[prop] = cur;
|
|
1777
|
-
}
|
|
1778
|
-
else if (Array.isArray(cur)) {
|
|
1779
|
-
for (var i = 0, l = cur.length; i < l; i++) {
|
|
1780
|
-
recurse(cur[i], prop + "[" + i + "]");
|
|
1781
|
-
if (l === 0)
|
|
1782
|
-
result[prop] = [];
|
|
1783
|
-
}
|
|
1492
|
+
CMIArray.prototype.reset = function (wipe) {
|
|
1493
|
+
if (wipe === void 0) { wipe = false; }
|
|
1494
|
+
this._initialized = false;
|
|
1495
|
+
if (wipe) {
|
|
1496
|
+
this.childArray = [];
|
|
1784
1497
|
}
|
|
1785
1498
|
else {
|
|
1786
|
-
var
|
|
1787
|
-
|
|
1788
|
-
if ({}.hasOwnProperty.call(cur, p)) {
|
|
1789
|
-
isEmpty = false;
|
|
1790
|
-
recurse(cur[p], prop ? prop + "." + p : p);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
if (isEmpty && prop)
|
|
1794
|
-
result[prop] = {};
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
recurse(data, "");
|
|
1798
|
-
return result;
|
|
1799
|
-
}
|
|
1800
|
-
function unflatten(data) {
|
|
1801
|
-
"use strict";
|
|
1802
|
-
if (Object(data) !== data || Array.isArray(data))
|
|
1803
|
-
return data;
|
|
1804
|
-
var regex = /\.?([^.[\]]+)|\[(\d+)]/g;
|
|
1805
|
-
var result = {};
|
|
1806
|
-
for (var p in data) {
|
|
1807
|
-
if ({}.hasOwnProperty.call(data, p)) {
|
|
1808
|
-
var cur = result;
|
|
1809
|
-
var prop = "";
|
|
1810
|
-
var m = regex.exec(p);
|
|
1811
|
-
while (m) {
|
|
1812
|
-
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
|
|
1813
|
-
prop = m[2] || m[1] || "";
|
|
1814
|
-
m = regex.exec(p);
|
|
1499
|
+
for (var i = 0; i < this.childArray.length; i++) {
|
|
1500
|
+
this.childArray[i].reset();
|
|
1815
1501
|
}
|
|
1816
|
-
cur[prop] = data[p];
|
|
1817
1502
|
}
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1503
|
+
};
|
|
1504
|
+
Object.defineProperty(CMIArray.prototype, "_children", {
|
|
1505
|
+
get: function () {
|
|
1506
|
+
return this.__children;
|
|
1507
|
+
},
|
|
1508
|
+
set: function (_children) {
|
|
1509
|
+
throw new this._errorClass(this._errorCode);
|
|
1510
|
+
},
|
|
1511
|
+
enumerable: false,
|
|
1512
|
+
configurable: true
|
|
1513
|
+
});
|
|
1514
|
+
Object.defineProperty(CMIArray.prototype, "_count", {
|
|
1515
|
+
get: function () {
|
|
1516
|
+
return this.childArray.length;
|
|
1517
|
+
},
|
|
1518
|
+
set: function (_count) {
|
|
1519
|
+
throw new this._errorClass(this._errorCode);
|
|
1520
|
+
},
|
|
1521
|
+
enumerable: false,
|
|
1522
|
+
configurable: true
|
|
1523
|
+
});
|
|
1524
|
+
CMIArray.prototype.toJSON = function () {
|
|
1525
|
+
this.jsonString = true;
|
|
1526
|
+
var result = {};
|
|
1527
|
+
for (var i = 0; i < this.childArray.length; i++) {
|
|
1528
|
+
result[i + ""] = this.childArray[i];
|
|
1842
1529
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
function stringMatches(str, tester) {
|
|
1850
|
-
return (str === null || str === void 0 ? void 0 : str.match(tester)) !== null;
|
|
1851
|
-
}
|
|
1530
|
+
delete this.jsonString;
|
|
1531
|
+
return result;
|
|
1532
|
+
};
|
|
1533
|
+
return CMIArray;
|
|
1534
|
+
}(_base_cmi__WEBPACK_IMPORTED_MODULE_1__.BaseCMI));
|
|
1535
|
+
|
|
1852
1536
|
|
|
1853
1537
|
|
|
1854
1538
|
/***/ }),
|
|
@@ -1883,6 +1567,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1883
1567
|
/* harmony export */ __propKey: function() { return /* binding */ __propKey; },
|
|
1884
1568
|
/* harmony export */ __read: function() { return /* binding */ __read; },
|
|
1885
1569
|
/* harmony export */ __rest: function() { return /* binding */ __rest; },
|
|
1570
|
+
/* harmony export */ __rewriteRelativeImportExtension: function() { return /* binding */ __rewriteRelativeImportExtension; },
|
|
1886
1571
|
/* harmony export */ __runInitializers: function() { return /* binding */ __runInitializers; },
|
|
1887
1572
|
/* harmony export */ __setFunctionName: function() { return /* binding */ __setFunctionName; },
|
|
1888
1573
|
/* harmony export */ __spread: function() { return /* binding */ __spread; },
|
|
@@ -1893,381 +1578,721 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1893
1578
|
/******************************************************************************
|
|
1894
1579
|
Copyright (c) Microsoft Corporation.
|
|
1895
1580
|
|
|
1896
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1897
|
-
purpose with or without fee is hereby granted.
|
|
1581
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1582
|
+
purpose with or without fee is hereby granted.
|
|
1583
|
+
|
|
1584
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1585
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1586
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1587
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1588
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1589
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1590
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1591
|
+
***************************************************************************** */
|
|
1592
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
1593
|
+
|
|
1594
|
+
var extendStatics = function(d, b) {
|
|
1595
|
+
extendStatics = Object.setPrototypeOf ||
|
|
1596
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1597
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1598
|
+
return extendStatics(d, b);
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
function __extends(d, b) {
|
|
1602
|
+
if (typeof b !== "function" && b !== null)
|
|
1603
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1604
|
+
extendStatics(d, b);
|
|
1605
|
+
function __() { this.constructor = d; }
|
|
1606
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
var __assign = function() {
|
|
1610
|
+
__assign = Object.assign || function __assign(t) {
|
|
1611
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1612
|
+
s = arguments[i];
|
|
1613
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1614
|
+
}
|
|
1615
|
+
return t;
|
|
1616
|
+
}
|
|
1617
|
+
return __assign.apply(this, arguments);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function __rest(s, e) {
|
|
1621
|
+
var t = {};
|
|
1622
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1623
|
+
t[p] = s[p];
|
|
1624
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1625
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1626
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1627
|
+
t[p[i]] = s[p[i]];
|
|
1628
|
+
}
|
|
1629
|
+
return t;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
function __decorate(decorators, target, key, desc) {
|
|
1633
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1634
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1635
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1636
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
function __param(paramIndex, decorator) {
|
|
1640
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
1644
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
1645
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
1646
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
1647
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
1648
|
+
var _, done = false;
|
|
1649
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1650
|
+
var context = {};
|
|
1651
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
1652
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
1653
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
1654
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
1655
|
+
if (kind === "accessor") {
|
|
1656
|
+
if (result === void 0) continue;
|
|
1657
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
1658
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
1659
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
1660
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
1661
|
+
}
|
|
1662
|
+
else if (_ = accept(result)) {
|
|
1663
|
+
if (kind === "field") initializers.unshift(_);
|
|
1664
|
+
else descriptor[key] = _;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
1668
|
+
done = true;
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
1672
|
+
var useValue = arguments.length > 2;
|
|
1673
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
1674
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
1675
|
+
}
|
|
1676
|
+
return useValue ? value : void 0;
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
function __propKey(x) {
|
|
1680
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
function __setFunctionName(f, name, prefix) {
|
|
1684
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
1685
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
function __metadata(metadataKey, metadataValue) {
|
|
1689
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1693
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1694
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1695
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1696
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1697
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1698
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
function __generator(thisArg, body) {
|
|
1703
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
1704
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1705
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1706
|
+
function step(op) {
|
|
1707
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1708
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
1709
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1710
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1711
|
+
switch (op[0]) {
|
|
1712
|
+
case 0: case 1: t = op; break;
|
|
1713
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1714
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1715
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1716
|
+
default:
|
|
1717
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1718
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1719
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1720
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1721
|
+
if (t[2]) _.ops.pop();
|
|
1722
|
+
_.trys.pop(); continue;
|
|
1723
|
+
}
|
|
1724
|
+
op = body.call(thisArg, _);
|
|
1725
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1726
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
1731
|
+
if (k2 === undefined) k2 = k;
|
|
1732
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1733
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1734
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1735
|
+
}
|
|
1736
|
+
Object.defineProperty(o, k2, desc);
|
|
1737
|
+
}) : (function(o, m, k, k2) {
|
|
1738
|
+
if (k2 === undefined) k2 = k;
|
|
1739
|
+
o[k2] = m[k];
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
function __exportStar(m, o) {
|
|
1743
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
function __values(o) {
|
|
1747
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1748
|
+
if (m) return m.call(o);
|
|
1749
|
+
if (o && typeof o.length === "number") return {
|
|
1750
|
+
next: function () {
|
|
1751
|
+
if (o && i >= o.length) o = void 0;
|
|
1752
|
+
return { value: o && o[i++], done: !o };
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
function __read(o, n) {
|
|
1759
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1760
|
+
if (!m) return o;
|
|
1761
|
+
var i = m.call(o), r, ar = [], e;
|
|
1762
|
+
try {
|
|
1763
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
1764
|
+
}
|
|
1765
|
+
catch (error) { e = { error: error }; }
|
|
1766
|
+
finally {
|
|
1767
|
+
try {
|
|
1768
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
1769
|
+
}
|
|
1770
|
+
finally { if (e) throw e.error; }
|
|
1771
|
+
}
|
|
1772
|
+
return ar;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
/** @deprecated */
|
|
1776
|
+
function __spread() {
|
|
1777
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
1778
|
+
ar = ar.concat(__read(arguments[i]));
|
|
1779
|
+
return ar;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/** @deprecated */
|
|
1783
|
+
function __spreadArrays() {
|
|
1784
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
1785
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
1786
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
1787
|
+
r[k] = a[j];
|
|
1788
|
+
return r;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
function __spreadArray(to, from, pack) {
|
|
1792
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1793
|
+
if (ar || !(i in from)) {
|
|
1794
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1795
|
+
ar[i] = from[i];
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
function __await(v) {
|
|
1802
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
1803
|
+
}
|
|
1898
1804
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1805
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
1806
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1807
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
1808
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
1809
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
1810
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
1811
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
1812
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
1813
|
+
function fulfill(value) { resume("next", value); }
|
|
1814
|
+
function reject(value) { resume("throw", value); }
|
|
1815
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
1816
|
+
}
|
|
1908
1817
|
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1818
|
+
function __asyncDelegator(o) {
|
|
1819
|
+
var i, p;
|
|
1820
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
1821
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
function __asyncValues(o) {
|
|
1825
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1826
|
+
var m = o[Symbol.asyncIterator], i;
|
|
1827
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
1828
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
1829
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
function __makeTemplateObject(cooked, raw) {
|
|
1833
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
1834
|
+
return cooked;
|
|
1914
1835
|
};
|
|
1915
1836
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1837
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
1838
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1839
|
+
}) : function(o, v) {
|
|
1840
|
+
o["default"] = v;
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
var ownKeys = function(o) {
|
|
1844
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
1845
|
+
var ar = [];
|
|
1846
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
1847
|
+
return ar;
|
|
1848
|
+
};
|
|
1849
|
+
return ownKeys(o);
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
function __importStar(mod) {
|
|
1853
|
+
if (mod && mod.__esModule) return mod;
|
|
1854
|
+
var result = {};
|
|
1855
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1856
|
+
__setModuleDefault(result, mod);
|
|
1857
|
+
return result;
|
|
1922
1858
|
}
|
|
1923
1859
|
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1927
|
-
s = arguments[i];
|
|
1928
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1929
|
-
}
|
|
1930
|
-
return t;
|
|
1931
|
-
}
|
|
1932
|
-
return __assign.apply(this, arguments);
|
|
1860
|
+
function __importDefault(mod) {
|
|
1861
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
1933
1862
|
}
|
|
1934
1863
|
|
|
1935
|
-
function
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1940
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1941
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1942
|
-
t[p[i]] = s[p[i]];
|
|
1943
|
-
}
|
|
1944
|
-
return t;
|
|
1864
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
1865
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1866
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1867
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1945
1868
|
}
|
|
1946
1869
|
|
|
1947
|
-
function
|
|
1948
|
-
|
|
1949
|
-
if (
|
|
1950
|
-
|
|
1951
|
-
return
|
|
1870
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1871
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1872
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1873
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1874
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
1952
1875
|
}
|
|
1953
1876
|
|
|
1954
|
-
function
|
|
1955
|
-
|
|
1877
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
1878
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1879
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
1956
1880
|
}
|
|
1957
1881
|
|
|
1958
|
-
function
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1882
|
+
function __addDisposableResource(env, value, async) {
|
|
1883
|
+
if (value !== null && value !== void 0) {
|
|
1884
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
1885
|
+
var dispose, inner;
|
|
1886
|
+
if (async) {
|
|
1887
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
1888
|
+
dispose = value[Symbol.asyncDispose];
|
|
1889
|
+
}
|
|
1890
|
+
if (dispose === void 0) {
|
|
1891
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
1892
|
+
dispose = value[Symbol.dispose];
|
|
1893
|
+
if (async) inner = dispose;
|
|
1894
|
+
}
|
|
1895
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
1896
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
1897
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
1898
|
+
}
|
|
1899
|
+
else if (async) {
|
|
1900
|
+
env.stack.push({ async: true });
|
|
1901
|
+
}
|
|
1902
|
+
return value;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1906
|
+
var e = new Error(message);
|
|
1907
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
function __disposeResources(env) {
|
|
1911
|
+
function fail(e) {
|
|
1912
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
1913
|
+
env.hasError = true;
|
|
1914
|
+
}
|
|
1915
|
+
var r, s = 0;
|
|
1916
|
+
function next() {
|
|
1917
|
+
while (r = env.stack.pop()) {
|
|
1918
|
+
try {
|
|
1919
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
1920
|
+
if (r.dispose) {
|
|
1921
|
+
var result = r.dispose.call(r.value);
|
|
1922
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
1923
|
+
}
|
|
1924
|
+
else s |= 1;
|
|
1976
1925
|
}
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
else descriptor[key] = _;
|
|
1926
|
+
catch (e) {
|
|
1927
|
+
fail(e);
|
|
1980
1928
|
}
|
|
1929
|
+
}
|
|
1930
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
1931
|
+
if (env.hasError) throw env.error;
|
|
1981
1932
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
};
|
|
1933
|
+
return next();
|
|
1934
|
+
}
|
|
1985
1935
|
|
|
1986
|
-
function
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1936
|
+
function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
1937
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
1938
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
1939
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
1940
|
+
});
|
|
1990
1941
|
}
|
|
1991
|
-
return
|
|
1992
|
-
}
|
|
1942
|
+
return path;
|
|
1943
|
+
}
|
|
1993
1944
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1945
|
+
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
1946
|
+
__extends,
|
|
1947
|
+
__assign,
|
|
1948
|
+
__rest,
|
|
1949
|
+
__decorate,
|
|
1950
|
+
__param,
|
|
1951
|
+
__esDecorate,
|
|
1952
|
+
__runInitializers,
|
|
1953
|
+
__propKey,
|
|
1954
|
+
__setFunctionName,
|
|
1955
|
+
__metadata,
|
|
1956
|
+
__awaiter,
|
|
1957
|
+
__generator,
|
|
1958
|
+
__createBinding,
|
|
1959
|
+
__exportStar,
|
|
1960
|
+
__values,
|
|
1961
|
+
__read,
|
|
1962
|
+
__spread,
|
|
1963
|
+
__spreadArrays,
|
|
1964
|
+
__spreadArray,
|
|
1965
|
+
__await,
|
|
1966
|
+
__asyncGenerator,
|
|
1967
|
+
__asyncDelegator,
|
|
1968
|
+
__asyncValues,
|
|
1969
|
+
__makeTemplateObject,
|
|
1970
|
+
__importStar,
|
|
1971
|
+
__importDefault,
|
|
1972
|
+
__classPrivateFieldGet,
|
|
1973
|
+
__classPrivateFieldSet,
|
|
1974
|
+
__classPrivateFieldIn,
|
|
1975
|
+
__addDisposableResource,
|
|
1976
|
+
__disposeResources,
|
|
1977
|
+
__rewriteRelativeImportExtension,
|
|
1978
|
+
});
|
|
1997
1979
|
|
|
1998
|
-
function __setFunctionName(f, name, prefix) {
|
|
1999
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
2000
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
2001
|
-
};
|
|
2002
1980
|
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
1981
|
+
/***/ }),
|
|
1982
|
+
|
|
1983
|
+
/***/ 784:
|
|
1984
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1985
|
+
|
|
1986
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1987
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1988
|
+
/* harmony export */ BaseScormValidationError: function() { return /* binding */ BaseScormValidationError; },
|
|
1989
|
+
/* harmony export */ ValidationError: function() { return /* binding */ ValidationError; }
|
|
1990
|
+
/* harmony export */ });
|
|
1991
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
1992
|
+
|
|
1993
|
+
var BaseScormValidationError = (function (_super) {
|
|
1994
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BaseScormValidationError, _super);
|
|
1995
|
+
function BaseScormValidationError(errorCode) {
|
|
1996
|
+
var _this = _super.call(this, errorCode.toString()) || this;
|
|
1997
|
+
_this._errorCode = errorCode;
|
|
1998
|
+
_this.name = "ScormValidationError";
|
|
1999
|
+
return _this;
|
|
2000
|
+
}
|
|
2001
|
+
Object.defineProperty(BaseScormValidationError.prototype, "errorCode", {
|
|
2002
|
+
get: function () {
|
|
2003
|
+
return this._errorCode;
|
|
2004
|
+
},
|
|
2005
|
+
enumerable: false,
|
|
2006
|
+
configurable: true
|
|
2007
|
+
});
|
|
2008
|
+
return BaseScormValidationError;
|
|
2009
|
+
}(Error));
|
|
2010
|
+
|
|
2011
|
+
var ValidationError = (function (_super) {
|
|
2012
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(ValidationError, _super);
|
|
2013
|
+
function ValidationError(errorCode, errorMessage, detailedMessage) {
|
|
2014
|
+
var _this = _super.call(this, errorCode) || this;
|
|
2015
|
+
_this._detailedMessage = "";
|
|
2016
|
+
_this.message = errorMessage;
|
|
2017
|
+
_this._errorMessage = errorMessage;
|
|
2018
|
+
if (detailedMessage) {
|
|
2019
|
+
_this._detailedMessage = detailedMessage;
|
|
2020
|
+
}
|
|
2021
|
+
return _this;
|
|
2022
|
+
}
|
|
2023
|
+
Object.defineProperty(ValidationError.prototype, "errorMessage", {
|
|
2024
|
+
get: function () {
|
|
2025
|
+
return this._errorMessage;
|
|
2026
|
+
},
|
|
2027
|
+
enumerable: false,
|
|
2028
|
+
configurable: true
|
|
2029
|
+
});
|
|
2030
|
+
Object.defineProperty(ValidationError.prototype, "detailedMessage", {
|
|
2031
|
+
get: function () {
|
|
2032
|
+
return this._detailedMessage;
|
|
2033
|
+
},
|
|
2034
|
+
enumerable: false,
|
|
2035
|
+
configurable: true
|
|
2036
|
+
});
|
|
2037
|
+
return ValidationError;
|
|
2038
|
+
}(BaseScormValidationError));
|
|
2006
2039
|
|
|
2007
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2008
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2009
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2010
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2011
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2012
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2013
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
2040
|
|
|
2017
|
-
function __generator(thisArg, body) {
|
|
2018
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
2019
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2020
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2021
|
-
function step(op) {
|
|
2022
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2023
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
2024
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2025
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2026
|
-
switch (op[0]) {
|
|
2027
|
-
case 0: case 1: t = op; break;
|
|
2028
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2029
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2030
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2031
|
-
default:
|
|
2032
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2033
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2034
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2035
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2036
|
-
if (t[2]) _.ops.pop();
|
|
2037
|
-
_.trys.pop(); continue;
|
|
2038
|
-
}
|
|
2039
|
-
op = body.call(thisArg, _);
|
|
2040
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2041
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
2041
|
|
|
2045
|
-
|
|
2046
|
-
if (k2 === undefined) k2 = k;
|
|
2047
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2048
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2049
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
2050
|
-
}
|
|
2051
|
-
Object.defineProperty(o, k2, desc);
|
|
2052
|
-
}) : (function(o, m, k, k2) {
|
|
2053
|
-
if (k2 === undefined) k2 = k;
|
|
2054
|
-
o[k2] = m[k];
|
|
2055
|
-
});
|
|
2042
|
+
/***/ }),
|
|
2056
2043
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
}
|
|
2044
|
+
/***/ 797:
|
|
2045
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2060
2046
|
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
}
|
|
2069
|
-
};
|
|
2070
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2071
|
-
}
|
|
2047
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2048
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2049
|
+
/* harmony export */ global_errors: function() { return /* binding */ global_errors; },
|
|
2050
|
+
/* harmony export */ scorm12_errors: function() { return /* binding */ scorm12_errors; },
|
|
2051
|
+
/* harmony export */ scorm2004_errors: function() { return /* binding */ scorm2004_errors; }
|
|
2052
|
+
/* harmony export */ });
|
|
2053
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(635);
|
|
2072
2054
|
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2055
|
+
var global_errors = {
|
|
2056
|
+
GENERAL: 101,
|
|
2057
|
+
INITIALIZATION_FAILED: 101,
|
|
2058
|
+
INITIALIZED: 101,
|
|
2059
|
+
TERMINATED: 101,
|
|
2060
|
+
TERMINATION_FAILURE: 101,
|
|
2061
|
+
TERMINATION_BEFORE_INIT: 101,
|
|
2062
|
+
MULTIPLE_TERMINATION: 101,
|
|
2063
|
+
RETRIEVE_BEFORE_INIT: 101,
|
|
2064
|
+
RETRIEVE_AFTER_TERM: 101,
|
|
2065
|
+
STORE_BEFORE_INIT: 101,
|
|
2066
|
+
STORE_AFTER_TERM: 101,
|
|
2067
|
+
COMMIT_BEFORE_INIT: 101,
|
|
2068
|
+
COMMIT_AFTER_TERM: 101,
|
|
2069
|
+
ARGUMENT_ERROR: 101,
|
|
2070
|
+
CHILDREN_ERROR: 101,
|
|
2071
|
+
COUNT_ERROR: 101,
|
|
2072
|
+
GENERAL_GET_FAILURE: 101,
|
|
2073
|
+
GENERAL_SET_FAILURE: 101,
|
|
2074
|
+
GENERAL_COMMIT_FAILURE: 101,
|
|
2075
|
+
UNDEFINED_DATA_MODEL: 101,
|
|
2076
|
+
UNIMPLEMENTED_ELEMENT: 101,
|
|
2077
|
+
VALUE_NOT_INITIALIZED: 101,
|
|
2078
|
+
INVALID_SET_VALUE: 101,
|
|
2079
|
+
READ_ONLY_ELEMENT: 101,
|
|
2080
|
+
WRITE_ONLY_ELEMENT: 101,
|
|
2081
|
+
TYPE_MISMATCH: 101,
|
|
2082
|
+
VALUE_OUT_OF_RANGE: 101,
|
|
2083
|
+
DEPENDENCY_NOT_ESTABLISHED: 101,
|
|
2084
|
+
};
|
|
2085
|
+
var scorm12_errors = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, global_errors), { RETRIEVE_BEFORE_INIT: 301, STORE_BEFORE_INIT: 301, COMMIT_BEFORE_INIT: 301, ARGUMENT_ERROR: 201, CHILDREN_ERROR: 202, COUNT_ERROR: 203, UNDEFINED_DATA_MODEL: 401, UNIMPLEMENTED_ELEMENT: 401, VALUE_NOT_INITIALIZED: 301, INVALID_SET_VALUE: 402, READ_ONLY_ELEMENT: 403, WRITE_ONLY_ELEMENT: 404, TYPE_MISMATCH: 405, VALUE_OUT_OF_RANGE: 407, DEPENDENCY_NOT_ESTABLISHED: 408 });
|
|
2086
|
+
var scorm2004_errors = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, global_errors), { INITIALIZATION_FAILED: 102, INITIALIZED: 103, TERMINATED: 104, TERMINATION_FAILURE: 111, TERMINATION_BEFORE_INIT: 112, MULTIPLE_TERMINATIONS: 113, RETRIEVE_BEFORE_INIT: 122, RETRIEVE_AFTER_TERM: 123, STORE_BEFORE_INIT: 132, STORE_AFTER_TERM: 133, COMMIT_BEFORE_INIT: 142, COMMIT_AFTER_TERM: 143, ARGUMENT_ERROR: 201, GENERAL_GET_FAILURE: 301, GENERAL_SET_FAILURE: 351, GENERAL_COMMIT_FAILURE: 391, UNDEFINED_DATA_MODEL: 401, UNIMPLEMENTED_ELEMENT: 402, VALUE_NOT_INITIALIZED: 403, READ_ONLY_ELEMENT: 404, WRITE_ONLY_ELEMENT: 405, TYPE_MISMATCH: 406, VALUE_OUT_OF_RANGE: 407, DEPENDENCY_NOT_ESTABLISHED: 408 });
|
|
2089
2087
|
|
|
2090
|
-
/** @deprecated */
|
|
2091
|
-
function __spread() {
|
|
2092
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
2093
|
-
ar = ar.concat(__read(arguments[i]));
|
|
2094
|
-
return ar;
|
|
2095
|
-
}
|
|
2096
2088
|
|
|
2097
|
-
|
|
2098
|
-
function __spreadArrays() {
|
|
2099
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
2100
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
2101
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
2102
|
-
r[k] = a[j];
|
|
2103
|
-
return r;
|
|
2104
|
-
}
|
|
2089
|
+
/***/ }),
|
|
2105
2090
|
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
if (ar || !(i in from)) {
|
|
2109
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2110
|
-
ar[i] = from[i];
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2114
|
-
}
|
|
2091
|
+
/***/ 864:
|
|
2092
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2115
2093
|
|
|
2116
|
-
|
|
2117
|
-
|
|
2094
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2095
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2096
|
+
/* harmony export */ SECONDS_PER_DAY: function() { return /* binding */ SECONDS_PER_DAY; },
|
|
2097
|
+
/* harmony export */ SECONDS_PER_HOUR: function() { return /* binding */ SECONDS_PER_HOUR; },
|
|
2098
|
+
/* harmony export */ SECONDS_PER_MINUTE: function() { return /* binding */ SECONDS_PER_MINUTE; },
|
|
2099
|
+
/* harmony export */ SECONDS_PER_SECOND: function() { return /* binding */ SECONDS_PER_SECOND; },
|
|
2100
|
+
/* harmony export */ addHHMMSSTimeStrings: function() { return /* binding */ addHHMMSSTimeStrings; },
|
|
2101
|
+
/* harmony export */ addTwoDurations: function() { return /* binding */ addTwoDurations; },
|
|
2102
|
+
/* harmony export */ countDecimals: function() { return /* binding */ countDecimals; },
|
|
2103
|
+
/* harmony export */ flatten: function() { return /* binding */ flatten; },
|
|
2104
|
+
/* harmony export */ formatMessage: function() { return /* binding */ formatMessage; },
|
|
2105
|
+
/* harmony export */ getDurationAsSeconds: function() { return /* binding */ getDurationAsSeconds; },
|
|
2106
|
+
/* harmony export */ getSecondsAsHHMMSS: function() { return /* binding */ getSecondsAsHHMMSS; },
|
|
2107
|
+
/* harmony export */ getSecondsAsISODuration: function() { return /* binding */ getSecondsAsISODuration; },
|
|
2108
|
+
/* harmony export */ getTimeAsSeconds: function() { return /* binding */ getTimeAsSeconds; },
|
|
2109
|
+
/* harmony export */ stringMatches: function() { return /* binding */ stringMatches; },
|
|
2110
|
+
/* harmony export */ unflatten: function() { return /* binding */ unflatten; }
|
|
2111
|
+
/* harmony export */ });
|
|
2112
|
+
var SECONDS_PER_SECOND = 1.0;
|
|
2113
|
+
var SECONDS_PER_MINUTE = 60;
|
|
2114
|
+
var SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;
|
|
2115
|
+
var SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
|
|
2116
|
+
var designations = {
|
|
2117
|
+
D: SECONDS_PER_DAY,
|
|
2118
|
+
H: SECONDS_PER_HOUR,
|
|
2119
|
+
M: SECONDS_PER_MINUTE,
|
|
2120
|
+
S: SECONDS_PER_SECOND,
|
|
2121
|
+
};
|
|
2122
|
+
function getSecondsAsHHMMSS(totalSeconds) {
|
|
2123
|
+
if (!totalSeconds || totalSeconds <= 0) {
|
|
2124
|
+
return "00:00:00";
|
|
2125
|
+
}
|
|
2126
|
+
var hours = Math.floor(totalSeconds / SECONDS_PER_HOUR);
|
|
2127
|
+
var dateObj = new Date(totalSeconds * 1000);
|
|
2128
|
+
var minutes = dateObj.getUTCMinutes();
|
|
2129
|
+
var seconds = dateObj.getSeconds();
|
|
2130
|
+
var ms = totalSeconds % 1.0;
|
|
2131
|
+
var msStr = "";
|
|
2132
|
+
if (countDecimals(ms) > 0) {
|
|
2133
|
+
if (countDecimals(ms) > 2) {
|
|
2134
|
+
msStr = ms.toFixed(2);
|
|
2135
|
+
}
|
|
2136
|
+
else {
|
|
2137
|
+
msStr = String(ms);
|
|
2138
|
+
}
|
|
2139
|
+
msStr = "." + msStr.split(".")[1];
|
|
2140
|
+
}
|
|
2141
|
+
return ((hours + ":" + minutes + ":" + seconds).replace(/\b\d\b/g, "0$&") + msStr);
|
|
2118
2142
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2143
|
+
function getSecondsAsISODuration(seconds) {
|
|
2144
|
+
if (!seconds || seconds <= 0) {
|
|
2145
|
+
return "PT0S";
|
|
2146
|
+
}
|
|
2147
|
+
var duration = "P";
|
|
2148
|
+
var remainder = seconds;
|
|
2149
|
+
for (var designationsKey in designations) {
|
|
2150
|
+
var current_seconds = designations[designationsKey] || 1;
|
|
2151
|
+
var value = Math.floor(remainder / current_seconds);
|
|
2152
|
+
remainder = remainder % current_seconds;
|
|
2153
|
+
if (countDecimals(remainder) > 2) {
|
|
2154
|
+
remainder = Number(Number(remainder).toFixed(2));
|
|
2155
|
+
}
|
|
2156
|
+
if (designationsKey === "S" && remainder > 0) {
|
|
2157
|
+
value += remainder;
|
|
2158
|
+
}
|
|
2159
|
+
if (value) {
|
|
2160
|
+
if ((duration.indexOf("D") > 0 ||
|
|
2161
|
+
designationsKey === "H" ||
|
|
2162
|
+
designationsKey === "M" ||
|
|
2163
|
+
designationsKey === "S") &&
|
|
2164
|
+
duration.indexOf("T") === -1) {
|
|
2165
|
+
duration += "T";
|
|
2166
|
+
}
|
|
2167
|
+
duration += "".concat(value).concat(designationsKey);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
return duration;
|
|
2131
2171
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2172
|
+
function getTimeAsSeconds(timeString, timeRegex) {
|
|
2173
|
+
if (typeof timeString === "number" || typeof timeString === "boolean") {
|
|
2174
|
+
timeString = String(timeString);
|
|
2175
|
+
}
|
|
2176
|
+
if (typeof timeRegex === "string") {
|
|
2177
|
+
timeRegex = new RegExp(timeRegex);
|
|
2178
|
+
}
|
|
2179
|
+
if (!timeString || !timeString.match(timeRegex)) {
|
|
2180
|
+
return 0;
|
|
2181
|
+
}
|
|
2182
|
+
var parts = timeString.split(":");
|
|
2183
|
+
var hours = Number(parts[0]);
|
|
2184
|
+
var minutes = Number(parts[1]);
|
|
2185
|
+
var seconds = Number(parts[2]);
|
|
2186
|
+
return hours * 3600 + minutes * 60 + seconds;
|
|
2137
2187
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2188
|
+
function getDurationAsSeconds(duration, durationRegex) {
|
|
2189
|
+
if (typeof durationRegex === "string") {
|
|
2190
|
+
durationRegex = new RegExp(durationRegex);
|
|
2191
|
+
}
|
|
2192
|
+
if (!duration || !duration.match(durationRegex)) {
|
|
2193
|
+
return 0;
|
|
2194
|
+
}
|
|
2195
|
+
var _a = new RegExp(durationRegex).exec(duration) || [], years = _a[1], _ = _a[2], days = _a[4], hours = _a[5], minutes = _a[6], seconds = _a[7];
|
|
2196
|
+
var result = 0.0;
|
|
2197
|
+
result += Number(seconds) || 0.0;
|
|
2198
|
+
result += Number(minutes) * 60.0 || 0.0;
|
|
2199
|
+
result += Number(hours) * 3600.0 || 0.0;
|
|
2200
|
+
result += Number(days) * (60 * 60 * 24.0) || 0.0;
|
|
2201
|
+
result += Number(years) * (60 * 60 * 24 * 365.0) || 0.0;
|
|
2202
|
+
return result;
|
|
2145
2203
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
2153
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
2154
|
-
}) : function(o, v) {
|
|
2155
|
-
o["default"] = v;
|
|
2156
|
-
};
|
|
2157
|
-
|
|
2158
|
-
function __importStar(mod) {
|
|
2159
|
-
if (mod && mod.__esModule) return mod;
|
|
2160
|
-
var result = {};
|
|
2161
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
2162
|
-
__setModuleDefault(result, mod);
|
|
2163
|
-
return result;
|
|
2204
|
+
function addTwoDurations(first, second, durationRegex) {
|
|
2205
|
+
var regex = typeof durationRegex === "string"
|
|
2206
|
+
? new RegExp(durationRegex)
|
|
2207
|
+
: durationRegex;
|
|
2208
|
+
return getSecondsAsISODuration(getDurationAsSeconds(first, regex) + getDurationAsSeconds(second, regex));
|
|
2164
2209
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2210
|
+
function addHHMMSSTimeStrings(first, second, timeRegex) {
|
|
2211
|
+
if (typeof timeRegex === "string") {
|
|
2212
|
+
timeRegex = new RegExp(timeRegex);
|
|
2213
|
+
}
|
|
2214
|
+
return getSecondsAsHHMMSS(getTimeAsSeconds(first, timeRegex) + getTimeAsSeconds(second, timeRegex));
|
|
2168
2215
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2216
|
+
function flatten(data) {
|
|
2217
|
+
var result = {};
|
|
2218
|
+
function recurse(cur, prop) {
|
|
2219
|
+
if (Object(cur) !== cur) {
|
|
2220
|
+
result[prop] = cur;
|
|
2221
|
+
}
|
|
2222
|
+
else if (Array.isArray(cur)) {
|
|
2223
|
+
for (var i = 0, l = cur.length; i < l; i++) {
|
|
2224
|
+
recurse(cur[i], prop + "[" + i + "]");
|
|
2225
|
+
if (l === 0)
|
|
2226
|
+
result[prop] = [];
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
else {
|
|
2230
|
+
var isEmpty = true;
|
|
2231
|
+
for (var p in cur) {
|
|
2232
|
+
if ({}.hasOwnProperty.call(cur, p)) {
|
|
2233
|
+
isEmpty = false;
|
|
2234
|
+
recurse(cur[p], prop ? prop + "." + p : p);
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
if (isEmpty && prop)
|
|
2238
|
+
result[prop] = {};
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
recurse(data, "");
|
|
2242
|
+
return result;
|
|
2174
2243
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2244
|
+
function unflatten(data) {
|
|
2245
|
+
"use strict";
|
|
2246
|
+
if (Object(data) !== data || Array.isArray(data))
|
|
2247
|
+
return data;
|
|
2248
|
+
var regex = /\.?([^.[\]]+)|\[(\d+)]/g;
|
|
2249
|
+
var result = {};
|
|
2250
|
+
for (var p in data) {
|
|
2251
|
+
if ({}.hasOwnProperty.call(data, p)) {
|
|
2252
|
+
var cur = result;
|
|
2253
|
+
var prop = "";
|
|
2254
|
+
var m = regex.exec(p);
|
|
2255
|
+
while (m) {
|
|
2256
|
+
cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
|
|
2257
|
+
prop = m[2] || m[1] || "";
|
|
2258
|
+
m = regex.exec(p);
|
|
2259
|
+
}
|
|
2260
|
+
cur[prop] = data[p];
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
return result[""] || result;
|
|
2181
2264
|
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2265
|
+
function countDecimals(num) {
|
|
2266
|
+
if (Math.floor(num) === num || String(num).indexOf(".") < 0)
|
|
2267
|
+
return 0;
|
|
2268
|
+
var parts = num.toString().split(".")[1];
|
|
2269
|
+
return (parts === null || parts === void 0 ? void 0 : parts.length) || 0;
|
|
2186
2270
|
}
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
var
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
dispose = value[Symbol.asyncDispose];
|
|
2195
|
-
}
|
|
2196
|
-
if (dispose === void 0) {
|
|
2197
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
2198
|
-
dispose = value[Symbol.dispose];
|
|
2199
|
-
if (async) inner = dispose;
|
|
2271
|
+
function formatMessage(functionName, message, CMIElement) {
|
|
2272
|
+
var baseLength = 20;
|
|
2273
|
+
var messageString = "";
|
|
2274
|
+
messageString += functionName;
|
|
2275
|
+
var fillChars = baseLength - messageString.length;
|
|
2276
|
+
for (var i = 0; i < fillChars; i++) {
|
|
2277
|
+
messageString += " ";
|
|
2200
2278
|
}
|
|
2201
|
-
|
|
2202
|
-
if (
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
return value;
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2212
|
-
var e = new Error(message);
|
|
2213
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2214
|
-
};
|
|
2215
|
-
|
|
2216
|
-
function __disposeResources(env) {
|
|
2217
|
-
function fail(e) {
|
|
2218
|
-
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
2219
|
-
env.hasError = true;
|
|
2220
|
-
}
|
|
2221
|
-
var r, s = 0;
|
|
2222
|
-
function next() {
|
|
2223
|
-
while (r = env.stack.pop()) {
|
|
2224
|
-
try {
|
|
2225
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
2226
|
-
if (r.dispose) {
|
|
2227
|
-
var result = r.dispose.call(r.value);
|
|
2228
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
2279
|
+
messageString += ": ";
|
|
2280
|
+
if (CMIElement) {
|
|
2281
|
+
var CMIElementBaseLength = 70;
|
|
2282
|
+
messageString += CMIElement;
|
|
2283
|
+
fillChars = CMIElementBaseLength - messageString.length;
|
|
2284
|
+
for (var j = 0; j < fillChars; j++) {
|
|
2285
|
+
messageString += " ";
|
|
2229
2286
|
}
|
|
2230
|
-
else s |= 1;
|
|
2231
|
-
}
|
|
2232
|
-
catch (e) {
|
|
2233
|
-
fail(e);
|
|
2234
|
-
}
|
|
2235
2287
|
}
|
|
2236
|
-
if (
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2288
|
+
if (message) {
|
|
2289
|
+
messageString += message;
|
|
2290
|
+
}
|
|
2291
|
+
return messageString;
|
|
2292
|
+
}
|
|
2293
|
+
function stringMatches(str, tester) {
|
|
2294
|
+
return (str === null || str === void 0 ? void 0 : str.match(tester)) !== null;
|
|
2240
2295
|
}
|
|
2241
|
-
|
|
2242
|
-
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
2243
|
-
__extends,
|
|
2244
|
-
__assign,
|
|
2245
|
-
__rest,
|
|
2246
|
-
__decorate,
|
|
2247
|
-
__param,
|
|
2248
|
-
__metadata,
|
|
2249
|
-
__awaiter,
|
|
2250
|
-
__generator,
|
|
2251
|
-
__createBinding,
|
|
2252
|
-
__exportStar,
|
|
2253
|
-
__values,
|
|
2254
|
-
__read,
|
|
2255
|
-
__spread,
|
|
2256
|
-
__spreadArrays,
|
|
2257
|
-
__spreadArray,
|
|
2258
|
-
__await,
|
|
2259
|
-
__asyncGenerator,
|
|
2260
|
-
__asyncDelegator,
|
|
2261
|
-
__asyncValues,
|
|
2262
|
-
__makeTemplateObject,
|
|
2263
|
-
__importStar,
|
|
2264
|
-
__importDefault,
|
|
2265
|
-
__classPrivateFieldGet,
|
|
2266
|
-
__classPrivateFieldSet,
|
|
2267
|
-
__classPrivateFieldIn,
|
|
2268
|
-
__addDisposableResource,
|
|
2269
|
-
__disposeResources,
|
|
2270
|
-
});
|
|
2271
2296
|
|
|
2272
2297
|
|
|
2273
2298
|
/***/ })
|
|
@@ -2332,11 +2357,6 @@ var __webpack_exports__ = {};
|
|
|
2332
2357
|
// ESM COMPAT FLAG
|
|
2333
2358
|
__webpack_require__.r(__webpack_exports__);
|
|
2334
2359
|
|
|
2335
|
-
// EXPORTS
|
|
2336
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
2337
|
-
Scorm2004API: function() { return /* binding */ Scorm2004Impl; }
|
|
2338
|
-
});
|
|
2339
|
-
|
|
2340
2360
|
// EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.mjs
|
|
2341
2361
|
var tslib_es6 = __webpack_require__(635);
|
|
2342
2362
|
// EXTERNAL MODULE: ./src/BaseAPI.ts + 2 modules
|
|
@@ -4504,13 +4524,13 @@ var Scorm2004Impl = (function (_super) {
|
|
|
4504
4524
|
Scorm2004Impl.prototype.lmsCommit = function () {
|
|
4505
4525
|
var _this = this;
|
|
4506
4526
|
if (this.settings.asyncCommit) {
|
|
4507
|
-
this.scheduleCommit(500, "
|
|
4527
|
+
this.scheduleCommit(500, "Commit");
|
|
4508
4528
|
}
|
|
4509
4529
|
else {
|
|
4510
4530
|
(function () { return (0,tslib_es6.__awaiter)(_this, void 0, void 0, function () {
|
|
4511
4531
|
return (0,tslib_es6.__generator)(this, function (_a) {
|
|
4512
4532
|
switch (_a.label) {
|
|
4513
|
-
case 0: return [4, this.commit("
|
|
4533
|
+
case 0: return [4, this.commit("Commit", false)];
|
|
4514
4534
|
case 1:
|
|
4515
4535
|
_a.sent();
|
|
4516
4536
|
return [2];
|
|
@@ -4919,7 +4939,6 @@ var Scorm2004Impl = (function (_super) {
|
|
|
4919
4939
|
}(BaseAPI["default"]));
|
|
4920
4940
|
|
|
4921
4941
|
|
|
4922
|
-
|
|
4923
|
-
export { __webpack_exports__Scorm2004API as Scorm2004API };
|
|
4942
|
+
export { Scorm2004Impl as Scorm2004API };
|
|
4924
4943
|
|
|
4925
4944
|
//# sourceMappingURL=scorm2004.js.map
|