Files
scorm-again/dist/scorm-again.min.js
Jonathan Putney 63f8beee89 Fixing build
2019-11-13 21:19:45 -05:00

1421 lines
141 KiB
JavaScript

(function() {
function r(e, n, t) {
function o(i, f) {
if (!n[i]) {
if (!e[i]) {
const c='function'==typeof require&&require; if (!f&&c) return c(i, !0); if (u) return u(i, !0); const a=new Error('Cannot find module \''+i+'\''); throw a.code='MODULE_NOT_FOUND', a;
} const p=n[i]={exports: {}}; e[i][0].call(p.exports, function(r) {
const n=e[i][1][r]; return o(n||r);
}, p, p.exports, r, e, n, t);
} return n[i].exports;
} for (var u='function'==typeof require&&require, i=0; i<t.length; i++)o(t[i]); return o;
} return r;
})()({1: [function(require, module, exports) {
'use strict'; function _interopRequireDefault(e) {
return e&&e.__esModule?e:{default: e};
} function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let r=0; r<t.length; r++) {
const o=t[r]; o.enumerable=o.enumerable||!1, o.configurable=!0, 'value'in o&&(o.writable=!0), Object.defineProperty(e, o.key, o);
}
} function _createClass(e, t, r) {
return t&&_defineProperties(e.prototype, t), r&&_defineProperties(e, r), e;
} function _possibleConstructorReturn(e, t) {
return !t||'object'!==_typeof(t)&&'function'!=typeof t?_assertThisInitialized(e):t;
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _get(e, t, r) {
return (_get='undefined'!=typeof Reflect&&Reflect.get?Reflect.get:function(e, t, r) {
const o=_superPropBase(e, t); if (o) {
const n=Object.getOwnPropertyDescriptor(o, t); return n.get?n.get.call(r):n.value;
}
})(e, t, r||e);
} function _superPropBase(e, t) {
for (;!Object.prototype.hasOwnProperty.call(e, t)&&null!==(e=_getPrototypeOf(e)););return e;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _inherits(e, t) {
if ('function'!=typeof t&&null!==t) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(t&&t.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), t&&_setPrototypeOf(e, t);
} function _setPrototypeOf(e, t) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, t) {
return e.__proto__=t, e;
})(e, t);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.default=void 0; const _Scorm12API2=_interopRequireDefault(require('./Scorm12API')); const _aicc_cmi=require('./cmi/aicc_cmi'); const AICC=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), e.cmi=new _aicc_cmi.CMI(_assertThisInitialized(e)), e.nav=new _aicc_cmi.NAV(_assertThisInitialized(e)), e;
} return _inherits(t, e), _createClass(t, [{key: 'getChildElement', value: function(e, r) {
let o=_get(_getPrototypeOf(t.prototype), 'getChildElement', this).call(this, e); return o||(this.stringContains(e, 'cmi.evaluation.comments')?o=new _aicc_cmi.CMIEvaluationCommentsObject(this):this.stringContains(e, 'cmi.student_data.tries')&&(o=new _aicc_cmi.CMITriesObject(this))), o;
}}, {key: 'replaceWithAnotherScormAPI', value: function(e) {
this.cmi=e.cmi, this.nav=e.nav;
}}]), t;
}(_Scorm12API2.default); exports.default=AICC;
}, {'./Scorm12API': 3, './cmi/aicc_cmi': 5}], 2: [function(require, module, exports) {
'use strict'; function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let r=0; r<t.length; r++) {
const i=t[r]; i.enumerable=i.enumerable||!1, i.configurable=!0, 'value'in i&&(i.writable=!0), Object.defineProperty(e, i.key, i);
}
} function _createClass(e, t, r) {
return t&&_defineProperties(e.prototype, t), r&&_defineProperties(e, r), e;
} function _defineProperty(e, t, r) {
return t in e?Object.defineProperty(e, t, {value: r, enumerable: !0, configurable: !0, writable: !0}):e[t]=r, e;
} function _classPrivateFieldGet(e, t) {
const r=t.get(e); if (!r) throw new TypeError('attempted to get private field on non-instance'); return r.get?r.get.call(e):r.value;
} function _classPrivateFieldSet(e, t, r) {
const i=t.get(e); if (!i) throw new TypeError('attempted to set private field on non-instance'); if (i.set)i.set.call(e, r); else {
if (!i.writable) throw new TypeError('attempted to set read only private field'); i.value=r;
} return r;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.default=void 0; const _common=require('./cmi/common'); const api_constants={SCORM_TRUE: 'true', SCORM_FALSE: 'false', STATE_NOT_INITIALIZED: 0, STATE_INITIALIZED: 1, STATE_TERMINATED: 2, LOG_LEVEL_DEBUG: 1, LOG_LEVEL_INFO: 2, LOG_LEVEL_WARNING: 3, LOG_LEVEL_ERROR: 4, LOG_LEVEL_NONE: 5}; const BaseAPI=function() {
function e(t) {
_classCallCheck(this, e), _timeout.set(this, {writable: !0, value: void 0}), _error_codes.set(this, {writable: !0, value: void 0}), _defineProperty(this, 'cmi', void 0), this.currentState=api_constants.STATE_NOT_INITIALIZED, this.apiLogLevel=api_constants.LOG_LEVEL_ERROR, this.lastErrorCode=0, this.listenerArray=[], _classPrivateFieldSet(this, _timeout, null), _classPrivateFieldSet(this, _error_codes, t);
} return _createClass(e, [{key: 'initialize', value: function(e, t, r) {
let i=api_constants.SCORM_FALSE; return this.isInitialized()?this.throwSCORMError(_classPrivateFieldGet(this, _error_codes).INITIALIZED, t):this.isTerminated()?this.throwSCORMError(_classPrivateFieldGet(this, _error_codes).TERMINATED, r):(this.currentState=api_constants.STATE_INITIALIZED, this.lastErrorCode=0, i=api_constants.SCORM_TRUE, this.processListeners(e)), this.apiLog(e, null, 'returned: '+i, api_constants.LOG_LEVEL_INFO), this.clearSCORMError(i), i;
}}, {key: 'terminate', value: function(e, t) {
let r=api_constants.SCORM_FALSE; return this.checkState(t, _classPrivateFieldGet(this, _error_codes).TERMINATION_BEFORE_INIT, _classPrivateFieldGet(this, _error_codes).MULTIPLE_TERMINATION)&&(t&&(this.lastErrorCode=0), this.currentState=api_constants.STATE_TERMINATED, r=api_constants.SCORM_TRUE, this.processListeners(e)), this.apiLog(e, null, 'returned: '+r, api_constants.LOG_LEVEL_INFO), this.clearSCORMError(r), r;
}}, {key: 'getValue', value: function(e, t, r) {
let i=''; return this.checkState(t, _classPrivateFieldGet(this, _error_codes).RETRIEVE_BEFORE_INIT, _classPrivateFieldGet(this, _error_codes).RETRIEVE_AFTER_TERM)&&(t&&(this.lastErrorCode=0), i=this.getCMIValue(r), this.processListeners(e, r)), this.apiLog(e, r, ': returned: '+i, api_constants.LOG_LEVEL_INFO), this.clearSCORMError(i), i;
}}, {key: 'setValue', value: function(e, t, r, i) {
let s=''; return this.checkState(t, _classPrivateFieldGet(this, _error_codes).STORE_BEFORE_INIT, _classPrivateFieldGet(this, _error_codes).STORE_AFTER_TERM)&&(t&&(this.lastErrorCode=0), s=this.setCMIValue(r, i), this.processListeners(e, r, i)), this.apiLog(e, r, ': '+i+': result: '+s, api_constants.LOG_LEVEL_INFO), this.clearSCORMError(s), s;
}}, {key: 'commit', value: function(e, t) {
let r=api_constants.SCORM_FALSE; return this.checkState(t, _classPrivateFieldGet(this, _error_codes).COMMIT_BEFORE_INIT, _classPrivateFieldGet(this, _error_codes).COMMIT_AFTER_TERM)&&(t&&(this.lastErrorCode=0), r=api_constants.SCORM_TRUE, this.processListeners(e)), this.apiLog(e, null, 'returned: '+r, api_constants.LOG_LEVEL_INFO), this.clearSCORMError(r), r;
}}, {key: 'getLastError', value: function(e) {
const t=String(this.lastErrorCode); return this.processListeners(e), this.apiLog(e, null, 'returned: '+t, api_constants.LOG_LEVEL_INFO), t;
}}, {key: 'getErrorString', value: function(e, t) {
let r=''; return null!==t&&''!==t&&(r=this.getLmsErrorMessageDetails(t), this.processListeners(e)), this.apiLog(e, null, 'returned: '+r, api_constants.LOG_LEVEL_INFO), r;
}}, {key: 'getDiagnostic', value: function(e, t) {
let r=''; return null!==t&&''!==t&&(r=this.getLmsErrorMessageDetails(t, !0), this.processListeners(e)), this.apiLog(e, null, 'returned: '+r, api_constants.LOG_LEVEL_INFO), r;
}}, {key: 'checkState', value: function(e, t, r) {
return this.isNotInitialized()?(this.throwSCORMError(t), !1):!e||!this.isTerminated()||(this.throwSCORMError(r), !1);
}}, {key: 'apiLog', value: function(e, t, r, i) {
if (r=this.formatMessage(e, t, r), i>=this.apiLogLevel) {
switch (i) {
case api_constants.LOG_LEVEL_ERROR: console.error(r); break; case api_constants.LOG_LEVEL_WARNING: console.warn(r); break; case api_constants.LOG_LEVEL_INFO: console.info(r);
}
}
}}, {key: 'formatMessage', value: function(e, t, r) {
let i=''; i+=e; for (var s=20-i.length, a=0; a<s; a++)i+=' '; if (i+=': ', t) {
i+=t, s=70-i.length; for (let n=0; n<s; n++)i+=' ';
} return r&&(i+=r), i;
}}, {key: 'stringContains', value: function(e, t) {
return e.indexOf(t)>-1;
}}, {key: 'getLmsErrorMessageDetails', value: function(e, t) {
return 'No error';
}}, {key: 'getCMIValue', value: function(e) {
return '';
}}, {key: 'setCMIValue', value: function(e, t) {}}, {key: '_commonSetCMIValue', value: function(e, t, r, i) {
if (!r||''===r) return api_constants.SCORM_FALSE; for (var s=r.split('.'), a=this, n=api_constants.SCORM_FALSE, o='The data model element passed to '.concat(e, ' (').concat(r, ') is not a valid SCORM data model element.'), l=t?_classPrivateFieldGet(this, _error_codes).UNDEFINED_DATA_MODEL:_classPrivateFieldGet(this, _error_codes).GENERAL, c=0; c<s.length; c++) {
const _=s[c]; if (c===s.length-1)t&&'{target='===_.substr(0, 8)&&'function'==typeof a._isTargetValid?this.throwSCORMError(_classPrivateFieldGet(this, _error_codes).READ_ONLY_ELEMENT):!{}.hasOwnProperty.call(a, _)?this.throwSCORMError(l, o):(this.stringContains(r, '.correct_responses')&&this.validateCorrectResponse(r, i), t&&0!==this.lastErrorCode||(a[_]=i, n=api_constants.SCORM_TRUE)); else {
if (!(a=a[_])) {
this.throwSCORMError(l, o); break;
} if (a instanceof _common.CMIArray) {
const u=parseInt(s[c+1], 10); if (!isNaN(u)) {
const h=a.childArray[u]; if (h)a=h; else {
const E=this.getChildElement(r, i); E?(a.childArray.push(E), a=E):this.throwSCORMError(l, o);
}c++;
}
}
}
} return n===api_constants.SCORM_FALSE&&this.apiLog(e, null, 'There was an error setting the value for: '.concat(r, ', value of: ').concat(i), api_constants.LOG_LEVEL_WARNING), n;
}}, {key: 'validateCorrectResponse', value: function(e, t) {}}, {key: 'getChildElement', value: function(e, t) {
return null;
}}, {key: '_commonGetCMIValue', value: function(e, t, r) {
if (!r||''===r) return ''; for (var i=r.split('.'), s=this, a=null, n=0; n<i.length; n++) {
if (a=i[n], t) {
if ('{target='===String(a).substr(0, 8)&&'function'==typeof s._isTargetValid) {
const o=String(a).substr(8, String(a).length-9); return s._isTargetValid(o);
} if (!{}.hasOwnProperty.call(s, a)) return this.throwSCORMError(401, 'The data model element passed to GetValue ('+r+') is not a valid SCORM data model element.'), '';
} else n===i.length-1&&({}.hasOwnProperty.call(s, a)||this.throwSCORMError(101, 'getCMIValue did not find a value for: '+r)); s=s[a];
} return null===s||void 0===s?(t||('_children'===a?this.throwSCORMError(202):'_count'===a&&this.throwSCORMError(203)), ''):s;
}}, {key: 'isInitialized', value: function() {
return this.currentState===api_constants.STATE_INITIALIZED;
}}, {key: 'isNotInitialized', value: function() {
return this.currentState===api_constants.STATE_NOT_INITIALIZED;
}}, {key: 'isTerminated', value: function() {
return this.currentState===api_constants.STATE_TERMINATED;
}}, {key: 'on', value: function(e, t) {
if (t) {
for (let r=e.split(' '), i=0; i<r.length; i++) {
const s=r[i].split('.'); if (0===s.length) return; const a=s[0]; let n=null; s.length>1&&(n=e.replace(a+'.', '')), this.listenerArray.push({functionName: a, CMIElement: n, callback: t});
}
}
}}, {key: 'processListeners', value: function(e, t, r) {
for (let i=0; i<this.listenerArray.length; i++) {
const s=this.listenerArray[i]; const a=s.functionName===e; const n=!!s.CMIElement; const o=s.CMIElement===t; !a||n&&!o||s.callback(t, r);
}
}}, {key: 'throwSCORMError', value: function(e, t) {
t||(t=this.getLmsErrorMessageDetails(e)), this.apiLog('throwSCORMError', null, e+': '+t, api_constants.LOG_LEVEL_ERROR), this.lastErrorCode=String(e);
}}, {key: 'clearSCORMError', value: function(e) {
e!==api_constants.SCORM_FALSE&&(this.lastErrorCode=0);
}}, {key: 'loadFromJSON', value: function(e, t) {
if (!this.isNotInitialized()) return void console.error('loadFromJSON can only be called before the call to lmsInitialize.'); t=t||'cmi'; for (const r in e) {
if ({}.hasOwnProperty.call(e, r)&&e[r]) {
const i=t+'.'+r; const s=e[r]; if (s.childArray) for (let a=0; a<s.childArray.length; a++) this.loadFromJSON(s.childArray[a], i+'.'+a); else s.constructor===Object?this.loadFromJSON(s, i):this.setCMIValue(i, s);
}
}
}}, {key: 'renderCMIToJSON', value: function() {
const e=this.cmi; return JSON.stringify({cmi: e});
}}, {key: 'scheduleCommit', value: function(e) {
_classPrivateFieldSet(this, _timeout, new ScheduledCommit(this, e));
}}, {key: 'clearScheduledCommit', value: function() {
_classPrivateFieldGet(this, _timeout)&&(_classPrivateFieldGet(this, _timeout).cancel(), _classPrivateFieldSet(this, _timeout, null));
}}]), e;
}(); exports.default=BaseAPI; var _timeout=new WeakMap; var _error_codes=new WeakMap; var ScheduledCommit=function() {
function e(t, r) {
_classCallCheck(this, e), _API.set(this, {writable: !0, value: void 0}), _cancelled.set(this, {writable: !0, value: void 0}), _timeout2.set(this, {writable: !0, value: void 0}), _classPrivateFieldSet(this, _API, t), _classPrivateFieldSet(this, _timeout2, setTimeout(this.wrapper, r));
} return _createClass(e, [{key: 'cancel', value: function() {
_classPrivateFieldSet(this, _cancelled, !0), _classPrivateFieldGet(this, _timeout2)&&clearTimeout(_classPrivateFieldGet(this, _timeout2));
}}, {key: 'wrapper', value: function() {
_classPrivateFieldGet(this, _cancelled)||_classPrivateFieldGet(this, _API).commit();
}}]), e;
}(); var _API=new WeakMap; var _cancelled=new WeakMap; var _timeout2=new WeakMap;
}, {'./cmi/common': 6}], 3: [function(require, module, exports) {
'use strict'; function _getRequireWildcardCache() {
if ('function'!=typeof WeakMap) return null; const e=new WeakMap; return _getRequireWildcardCache=function() {
return e;
}, e;
} function _interopRequireWildcard(e) {
if (e&&e.__esModule) return e; if (null===e||'object'!==_typeof(e)&&'function'!=typeof e) return {default: e}; const t=_getRequireWildcardCache(); if (t&&t.has(e)) return t.get(e); const r={}; const i=Object.defineProperty&&Object.getOwnPropertyDescriptor; for (const n in e) {
if (Object.prototype.hasOwnProperty.call(e, n)) {
const o=i?Object.getOwnPropertyDescriptor(e, n):null; o&&(o.get||o.set)?Object.defineProperty(r, n, o):r[n]=e[n];
}
} return r.default=e, t&&t.set(e, r), r;
} function _interopRequireDefault(e) {
return e&&e.__esModule?e:{default: e};
} function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let r=0; r<t.length; r++) {
const i=t[r]; i.enumerable=i.enumerable||!1, i.configurable=!0, 'value'in i&&(i.writable=!0), Object.defineProperty(e, i.key, i);
}
} function _createClass(e, t, r) {
return t&&_defineProperties(e.prototype, t), r&&_defineProperties(e, r), e;
} function _possibleConstructorReturn(e, t) {
return !t||'object'!==_typeof(t)&&'function'!=typeof t?_assertThisInitialized(e):t;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _inherits(e, t) {
if ('function'!=typeof t&&null!==t) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(t&&t.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), t&&_setPrototypeOf(e, t);
} function _setPrototypeOf(e, t) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, t) {
return e.__proto__=t, e;
})(e, t);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.default=void 0; const _BaseAPI2=_interopRequireDefault(require('./BaseAPI')); const _scorm12_cmi=require('./cmi/scorm12_cmi'); const Utilities=_interopRequireWildcard(require('./utilities')); const _api_constants=require('./constants/api_constants'); const _error_codes=require('./constants/error_codes'); const _regex=require('./constants/regex'); const constants=_api_constants.scorm12_constants; const Scorm12API=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this, _error_codes.scorm12_error_codes)), e.cmi=new _scorm12_cmi.CMI(_assertThisInitialized(e)), e.LMSInitialize=e.lmsInitialize, e.LMSFinish=e.lmsFinish, e.LMSGetValue=e.lmsGetValue, e.LMSSetValue=e.lmsSetValue, e.LMSCommit=e.lmsCommit, e.LMSGetLastError=e.lmsGetLastError, e.LMSGetErrorString=e.lmsGetErrorString, e.LMSGetDiagnostic=e.lmsGetDiagnostic, e;
} return _inherits(t, e), _createClass(t, [{key: 'lmsInitialize', value: function() {
return this.initialize('LMSInitialize', 'LMS was already initialized!', 'LMS is already finished!');
}}, {key: 'lmsFinish', value: function() {
return this.terminate('LMSFinish', !1);
}}, {key: 'lmsGetValue', value: function(e) {
return this.getValue('LMSGetValue', !1, e);
}}, {key: 'lmsSetValue', value: function(e, t) {
return this.setValue('LMSSetValue', !1, e, t);
}}, {key: 'lmsCommit', value: function() {
return this.commit('LMSCommit', !1);
}}, {key: 'lmsGetLastError', value: function() {
return this.getLastError('LMSGetLastError');
}}, {key: 'lmsGetErrorString', value: function(e) {
return this.getErrorString('LMSGetErrorString', e);
}}, {key: 'lmsGetDiagnostic', value: function(e) {
return this.getDiagnostic('LMSGetDiagnostic', e);
}}, {key: 'setCMIValue', value: function(e, t) {
this._commonSetCMIValue('LMSSetValue', !1, e, t);
}}, {key: 'getCMIValue', value: function(e) {
return this._commonGetCMIValue('getCMIValue', !1, e);
}}, {key: 'getChildElement', value: function(e, t) {
let r; return this.stringContains(e, 'cmi.objectives')?r=new _scorm12_cmi.CMIObjectivesObject(this):this.stringContains(e, '.correct_responses')?r=new _scorm12_cmi.CMIInteractionsCorrectResponsesObject(this):this.stringContains(e, '.objectives')?r=new _scorm12_cmi.CMIInteractionsObjectivesObject(this):this.stringContains(e, 'cmi.interactions')&&(r=new _scorm12_cmi.CMIInteractionsObject(this)), r;
}}, {key: 'validateCorrectResponse', value: function(e, t) {
return !0;
}}, {key: 'getLmsErrorMessageDetails', value: function(e, t) {
let r='No Error'; let i='No Error'; return e=String(e), constants.error_descriptions[e]&&(r=constants.error_descriptions[e].basicMessage, i=constants.error_descriptions[e].detailMessage), t?i:r;
}}, {key: 'getCurrentTotalTime', value: function() {
const e=new RegExp(_regex.scorm12_regex.CMITime); const t=this.cmi.core.total_time; const r=this.cmi.core.session_time; return Utilities.addHHMMSSTimeStrings(t, r, e);
}}, {key: 'replaceWithAnotherScormAPI', value: function(e) {
this.cmi=e.cmi;
}}]), t;
}(_BaseAPI2.default); exports.default=Scorm12API;
}, {'./BaseAPI': 2, './cmi/scorm12_cmi': 7, './constants/api_constants': 9, './constants/error_codes': 10, './constants/regex': 13, './utilities': 16}], 4: [function(require, module, exports) {
'use strict'; function _getRequireWildcardCache() {
if ('function'!=typeof WeakMap) return null; const e=new WeakMap; return _getRequireWildcardCache=function() {
return e;
}, e;
} function _interopRequireWildcard(e) {
if (e&&e.__esModule) return e; if (null===e||'object'!==_typeof(e)&&'function'!=typeof e) return {default: e}; const r=_getRequireWildcardCache(); if (r&&r.has(e)) return r.get(e); const t={}; const o=Object.defineProperty&&Object.getOwnPropertyDescriptor; for (const s in e) {
if (Object.prototype.hasOwnProperty.call(e, s)) {
const i=o?Object.getOwnPropertyDescriptor(e, s):null; i&&(i.get||i.set)?Object.defineProperty(t, s, i):t[s]=e[s];
}
} return t.default=e, r&&r.set(e, t), t;
} function _interopRequireDefault(e) {
return e&&e.__esModule?e:{default: e};
} function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function _classCallCheck(e, r) {
if (!(e instanceof r)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, r) {
for (let t=0; t<r.length; t++) {
const o=r[t]; o.enumerable=o.enumerable||!1, o.configurable=!0, 'value'in o&&(o.writable=!0), Object.defineProperty(e, o.key, o);
}
} function _createClass(e, r, t) {
return r&&_defineProperties(e.prototype, r), t&&_defineProperties(e, t), e;
} function _possibleConstructorReturn(e, r) {
return !r||'object'!==_typeof(r)&&'function'!=typeof r?_assertThisInitialized(e):r;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _inherits(e, r) {
if ('function'!=typeof r&&null!==r) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(r&&r.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), r&&_setPrototypeOf(e, r);
} function _setPrototypeOf(e, r) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, r) {
return e.__proto__=r, e;
})(e, r);
} function _defineProperty(e, r, t) {
return r in e?Object.defineProperty(e, r, {value: t, enumerable: !0, configurable: !0, writable: !0}):e[r]=t, e;
} function _classPrivateFieldGet(e, r) {
const t=r.get(e); if (!t) throw new TypeError('attempted to get private field on non-instance'); return t.get?t.get.call(e):t.value;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.default=void 0; const _BaseAPI2=_interopRequireDefault(require('./BaseAPI')); const _scorm2004_cmi=require('./cmi/scorm2004_cmi'); const Util=_interopRequireWildcard(require('./utilities')); const _api_constants=require('./constants/api_constants'); const _error_codes=require('./constants/error_codes'); const _response_constants=require('./constants/response_constants'); const _language_constants=require('./constants/language_constants'); const _regex=require('./constants/regex'); const constants=_api_constants.scorm2004_constants; const Scorm2004API=function(e) {
function r() {
let e; return _classCallCheck(this, r), e=_possibleConstructorReturn(this, _getPrototypeOf(r).call(this, _error_codes.scorm2004_error_codes)), _version.set(_assertThisInitialized(e), {writable: !0, value: void 0}), _defineProperty(_assertThisInitialized(e), 'checkDuplicatedPattern', function(e, r, t) {
for (var o=!1, s=e._count, i=0; i<s&&!o; i++)i!==r&&e.childArray[i]===t&&(o=!0); return o;
}), e.cmi=new _scorm2004_cmi.CMI(_assertThisInitialized(e)), e.adl=new _scorm2004_cmi.ADL(_assertThisInitialized(e)), e.Initialize=e.lmsInitialize, e.Terminate=e.lmsTerminate, e.GetValue=e.lmsGetValue, e.SetValue=e.lmsSetValue, e.Commit=e.lmsCommit, e.GetLastError=e.lmsGetLastError, e.GetErrorString=e.lmsGetErrorString, e.GetDiagnostic=e.lmsGetDiagnostic, e;
} return _inherits(r, e), _createClass(r, [{key: 'lmsInitialize', value: function() {
return this.initialize('Initialize');
}}, {key: 'lmsTerminate', value: function() {
return this.terminate('Terminate', !0);
}}, {key: 'lmsGetValue', value: function(e) {
return this.getValue('GetValue', !0, e);
}}, {key: 'lmsSetValue', value: function(e, r) {
return this.setValue('SetValue', !0, e, r);
}}, {key: 'lmsCommit', value: function() {
return this.commit('Commit');
}}, {key: 'lmsGetLastError', value: function() {
return this.getLastError('GetLastError');
}}, {key: 'lmsGetErrorString', value: function(e) {
return this.getErrorString('GetErrorString', e);
}}, {key: 'lmsGetDiagnostic', value: function(e) {
return this.getDiagnostic('GetDiagnostic', e);
}}, {key: 'setCMIValue', value: function(e, r) {
this._commonSetCMIValue('SetValue', !0, e, r);
}}, {key: 'getChildElement', value: function(e, r) {
let t; if (this.stringContains(e, 'cmi.objectives'))t=new _scorm2004_cmi.CMIObjectivesObject(this); else if (this.stringContains(e, '.correct_responses')) {
const o=e.split('.'); const s=Number(o[2]); const i=this.cmi.interactions.childArray[s]; if (void 0===i.type) this.throwSCORMError(_error_codes.scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED); else {
const n=i.type; const c=i.correct_responses._count; if ('choice'===n) {
for (let a=0; a<c&&0===this.lastErrorCode; a++) {
const l=i.correct_responses.childArray[a]; l.pattern===r&&this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE);
}
} const _=_response_constants.correct_responses[n]; let u=[]; ''!==_.delimiter?u=String(r).split(_.delimiter):u[0]=r, u.length>0&&u.length<=_.max?this.checkCorrectResponseValue(n, u, r):u.length>_.max&&this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE, 'Data Model Element Pattern Too Long');
}0===this.lastErrorCode&&(t=new _scorm2004_cmi.CMIInteractionsCorrectResponsesObject(this));
} else this.stringContains(e, '.objectives')?t=new _scorm2004_cmi.CMIInteractionsObjectivesObject(this):this.stringContains(e, 'cmi.interactions')?t=new _scorm2004_cmi.CMIInteractionsObject(this):this.stringContains(e, 'cmi.comments_from_learner')?t=new _scorm2004_cmi.CMICommentsFromLearnerObject(this):this.stringContains(e, 'cmi.comments_from_lms')&&(t=new _scorm2004_cmi.CMICommentsFromLMSObject(this)); return t;
}}, {key: 'validateCorrectResponse', value: function(e, r) {
const t=e.split('.'); const o=Number(t[2]); const s=Number(t[4]); const i=this.cmi.interactions.childArray[o]; const n=i.type; const c=i.correct_responses._count; if ('choice'===n) {
for (let a=0; a<c&&0===this.lastErrorCode; a++) {
const l=i.correct_responses.childArray[a]; l.pattern===r&&this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE);
}
} const _=_api_constants.scorm2004_constants.correct_responses[n]; if (void 0!==_.limit||c<_.limit) {
let u=[]; ''!==_.delimiter?u=String(r).split(_.delimiter):u[0]=r, u.length>0&&u.length<=_.max?this.checkCorrectResponseValue(n, u, r):u.length>_.max&&this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE, 'Data Model Element Pattern Too Long'), 0===this.lastErrorCode&&(!_.duplicate||!this.checkDuplicatedPattern(i.correct_responses, s, r))||0===this.lastErrorCode&&''===r||0===this.lastErrorCode&&this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE, 'Data Model Element Pattern Already Exists');
} else this.throwSCORMError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE, 'Data Model Element Collection Limit Reached');
}}, {key: 'getCMIValue', value: function(e) {
return this._commonGetCMIValue('GetValue', !0, e);
}}, {key: 'getLmsErrorMessageDetails', value: function(e, r) {
let t=''; let o=''; return e=String(e), constants.error_descriptions[e]&&(t=constants.error_descriptions[e].basicMessage, o=constants.error_descriptions[e].detailMessage), r?o:t;
}}, {key: 'checkCorrectResponseValue', value: function(e, r, t) {
for (let o=_response_constants.correct_responses[e], s=new RegExp(o.format), i=0; i<r.length&&0===this.lastErrorCode; i++) {
if (e.match('^(fill-in|long-fill-in|matching|performance|sequencing)$')&&(r[i]=this.removeCorrectResponsePrefixes(r[i])), void 0!==o.delimiter2) {
const n=r[i].split(o.delimiter2); if (2===n.length) {
const c=n[0].match(s); c?n[1].match(new RegExp(o.format2))||this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH):this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH);
} else this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH);
} else {
const a=r[i].match(s); if (!a&&''!==t||!a&&'true-false'===e) this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH); else if ('numeric'===e&&r.length>1)Number(r[0])>Number(r[1])&&this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH); else if (''!==r[i]&&o.unique) for (let l=0; l<i&&0===this.lastErrorCode; l++)r[i]===r[l]&&this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH);
}
}
}}, {key: 'removeCorrectResponsePrefixes', value: function(e) {
for (let r=!1, t=!1, o=!1, s=new RegExp('^({(lang|case_matters|order_matters)=([^}]+)})'), i=e.match(s), n=null; i;) {
switch (i[2]) {
case 'lang': if (n=e.match(_regex.scorm2004_regex.CMILangcr)) {
const c=n[3]; void 0!==c&&c.length>0&&void 0===_language_constants.valid_languages[c.toLowerCase()]&&this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH);
}o=!0; break; case 'case_matters': o||r||t||'true'!==i[3]&&'false'!==i[3]&&this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH), t=!0; break; case 'order_matters': t||o||r||'true'!==i[3]&&'false'!==i[3]&&this.throwSCORMError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH), r=!0;
}e=e.substr(i[1].length), i=e.match(s);
} return e;
}}, {key: 'replaceWithAnotherScormAPI', value: function(e) {
this.cmi=e.cmi, this.adl=e.adl;
}}, {key: 'getCurrentTotalTime', value: function() {
const e=this.cmi.total_time; const r=this.cmi.session_time; return Util.addTwoDurations(e, r, _regex.scorm2004_regex.CMITimespan);
}}, {key: 'version', get: function() {
return _classPrivateFieldGet(this, _version);
}}]), r;
}(_BaseAPI2.default); exports.default=Scorm2004API; var _version=new WeakMap;
}, {'./BaseAPI': 2, './cmi/scorm2004_cmi': 8, './constants/api_constants': 9, './constants/error_codes': 10, './constants/language_constants': 12, './constants/regex': 13, './constants/response_constants': 14, './utilities': 16}], 5: [function(require, module, exports) {
'use strict'; function _getRequireWildcardCache() {
if ('function'!=typeof WeakMap) return null; const t=new WeakMap; return _getRequireWildcardCache=function() {
return t;
}, t;
} function _interopRequireWildcard(t) {
if (t&&t.__esModule) return t; if (null===t||'object'!==_typeof(t)&&'function'!=typeof t) return {default: t}; const e=_getRequireWildcardCache(); if (e&&e.has(t)) return e.get(t); const r={}; const i=Object.defineProperty&&Object.getOwnPropertyDescriptor; for (const n in t) {
if (Object.prototype.hasOwnProperty.call(t, n)) {
const o=i?Object.getOwnPropertyDescriptor(t, n):null; o&&(o.get||o.set)?Object.defineProperty(r, n, o):r[n]=t[n];
}
} return r.default=t, e&&e.set(t, r), r;
} function _typeof(t) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t) {
return typeof t;
}:function(t) {
return t&&'function'==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?'symbol':typeof t;
})(t);
} function _classPrivateFieldSet(t, e, r) {
const i=e.get(t); if (!i) throw new TypeError('attempted to set private field on non-instance'); if (i.set)i.set.call(t, r); else {
if (!i.writable) throw new TypeError('attempted to set read only private field'); i.value=r;
} return r;
} function _classPrivateFieldGet(t, e) {
const r=e.get(t); if (!r) throw new TypeError('attempted to get private field on non-instance'); return r.get?r.get.call(t):r.value;
} function _classCallCheck(t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(t, e) {
for (let r=0; r<e.length; r++) {
const i=e[r]; i.enumerable=i.enumerable||!1, i.configurable=!0, 'value'in i&&(i.writable=!0), Object.defineProperty(t, i.key, i);
}
} function _createClass(t, e, r) {
return e&&_defineProperties(t.prototype, e), r&&_defineProperties(t, r), t;
} function _possibleConstructorReturn(t, e) {
return !e||'object'!==_typeof(e)&&'function'!=typeof e?_assertThisInitialized(t):e;
} function _assertThisInitialized(t) {
if (void 0===t) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return t;
} function _get(t, e, r) {
return (_get='undefined'!=typeof Reflect&&Reflect.get?Reflect.get:function(t, e, r) {
const i=_superPropBase(t, e); if (i) {
const n=Object.getOwnPropertyDescriptor(i, e); return n.get?n.get.call(r):n.value;
}
})(t, e, r||t);
} function _superPropBase(t, e) {
for (;!Object.prototype.hasOwnProperty.call(t, e)&&null!==(t=_getPrototypeOf(t)););return t;
} function _getPrototypeOf(t) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t) {
return t.__proto__||Object.getPrototypeOf(t);
})(t);
} function _inherits(t, e) {
if ('function'!=typeof e&&null!==e) throw new TypeError('Super expression must either be null or a function'); t.prototype=Object.create(e&&e.prototype, {constructor: {value: t, writable: !0, configurable: !0}}), e&&_setPrototypeOf(t, e);
} function _setPrototypeOf(t, e) {
return (_setPrototypeOf=Object.setPrototypeOf||function(t, e) {
return t.__proto__=e, t;
})(t, e);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.NAV=exports.CMIEvaluationCommentsObject=exports.CMITriesObject=exports.CMITries=exports.CMI=void 0; const Scorm12CMI=_interopRequireWildcard(require('./scorm12_cmi')); const _common=require('./common'); const _api_constants=require('../constants/api_constants'); const _regex=require('../constants/regex'); const _error_codes=require('../constants/error_codes'); const constants=_api_constants.aicc_constants; const regex=_regex.aicc_regex; const CMI=function(t) {
function e(t) {
let r; return _classCallCheck(this, e), r=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this, constants.cmi_children)), t&&r.initialize(), r.student_data=new AICCCMIStudentData, r.evaluation=new CMIEvaluation, r;
} return _inherits(e, t), _createClass(e, [{key: 'initialize', value: function() {
let t; let r; _get(_getPrototypeOf(e.prototype), 'initialize', this).call(this), null===(t=this.student_data)||void 0===t||t.initialize(), null===(r=this.evaluation)||void 0===r||r.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const t={suspend_data: this.suspend_data, launch_data: this.launch_data, comments: this.comments, comments_from_lms: this.comments_from_lms, core: this.core, objectives: this.objectives, student_data: this.student_data, student_preference: this.student_preference, interactions: this.interactions, evaluation: this.evaluation}; return delete this.jsonString, t;
}}]), e;
}(Scorm12CMI.CMI); exports.CMI=CMI; var CMIEvaluation=function(t) {
function e() {
let t; return _classCallCheck(this, e), t=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this)), t.comments=new CMIEvaluationComments, t;
} return _inherits(e, t), _createClass(e, [{key: 'initialize', value: function() {
let t; _get(_getPrototypeOf(e.prototype), 'initialize', this).call(this), null===(t=this.comments)||void 0===t||t.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const t={comments: this.comments}; return delete this.jsonString, t;
}}]), e;
}(_common.BaseCMI); var CMIEvaluationComments=function(t) {
function e() {
return _classCallCheck(this, e), _possibleConstructorReturn(this, _getPrototypeOf(e).call(this, constants.comments_children, _error_codes.scorm12_error_codes.INVALID_SET_VALUE));
} return _inherits(e, t), e;
}(_common.CMIArray); var AICCCMIStudentData=function(t) {
function e() {
let t; return _classCallCheck(this, e), t=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this, constants.student_data_children)), _tries_during_lesson.set(_assertThisInitialized(t), {writable: !0, value: ''}), t.tries=new CMITries, t;
} return _inherits(e, t), _createClass(e, [{key: 'initialize', value: function() {
let t; _get(_getPrototypeOf(e.prototype), 'initialize', this).call(this), null===(t=this.tries)||void 0===t||t.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const t={mastery_score: this.mastery_score, max_time_allowed: this.max_time_allowed, time_limit_action: this.time_limit_action, tries: this.tries}; return delete this.jsonString, t;
}}, {key: 'tries_during_lesson', get: function() {
return _classPrivateFieldGet(this, _tries_during_lesson);
}, set: function(t) {
this.initialized?(0, Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this, _tries_during_lesson, t);
}}]), e;
}(Scorm12CMI.CMIStudentData); var _tries_during_lesson=new WeakMap; var CMITries=function(t) {
function e() {
return _classCallCheck(this, e), _possibleConstructorReturn(this, _getPrototypeOf(e).call(this, _api_constants.aicc_constants.tries_children));
} return _inherits(e, t), e;
}(_common.CMIArray); exports.CMITries=CMITries; const CMITriesObject=function(t) {
function e() {
let t; return _classCallCheck(this, e), t=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this)), _status.set(_assertThisInitialized(t), {writable: !0, value: ''}), _time.set(_assertThisInitialized(t), {writable: !0, value: ''}), t.score=new _common.CMIScore({score_children: constants.score_children, score_range: regex.score_range, invalidErrorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE, invalidTypeCode: _error_codes.scorm12_error_codes.TYPE_MISMATCH, invalidRangeCode: _error_codes.scorm12_error_codes.VALUE_OUT_OF_RANGE}), t;
} return _inherits(e, t), _createClass(e, [{key: 'initialize', value: function() {
let t; _get(_getPrototypeOf(e.prototype), 'initialize', this).call(this), null===(t=this.score)||void 0===t||t.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const t={status: this.status, time: this.time, score: this.score}; return delete this.jsonString, t;
}}, {key: 'status', get: function() {
return _classPrivateFieldGet(this, _status);
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.CMIStatus2)&&_classPrivateFieldSet(this, _status, t);
}}, {key: 'time', get: function() {
return _classPrivateFieldGet(this, _time);
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.CMITime)&&_classPrivateFieldSet(this, _time, t);
}}]), e;
}(_common.BaseCMI); exports.CMITriesObject=CMITriesObject; var _status=new WeakMap; var _time=new WeakMap; const CMIEvaluationCommentsObject=function(t) {
function e() {
let t; return _classCallCheck(this, e), t=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this)), _content.set(_assertThisInitialized(t), {writable: !0, value: ''}), _location.set(_assertThisInitialized(t), {writable: !0, value: ''}), _time2.set(_assertThisInitialized(t), {writable: !0, value: ''}), t;
} return _inherits(e, t), _createClass(e, [{key: 'toJSON', value: function() {
this.jsonString=!0; const t={content: this.content, location: this.location, time: this.time}; return delete this.jsonString, t;
}}, {key: 'content', get: function() {
return _classPrivateFieldGet(this, _content);
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.CMIString256)&&_classPrivateFieldSet(this, _content, t);
}}, {key: 'location', get: function() {
return _classPrivateFieldGet(this, _location);
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.CMIString256)&&_classPrivateFieldSet(this, _location, t);
}}, {key: 'time', get: function() {
return _classPrivateFieldGet(this, _time2);
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.CMITime)&&_classPrivateFieldSet(this, _time2, t);
}}]), e;
}(_common.BaseCMI); exports.CMIEvaluationCommentsObject=CMIEvaluationCommentsObject; var _content=new WeakMap; var _location=new WeakMap; var _time2=new WeakMap; const NAV=function(t) {
function e() {
let t; return _classCallCheck(this, e), t=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this)), _event.set(_assertThisInitialized(t), {writable: !0, value: ''}), t;
} return _inherits(e, t), _createClass(e, [{key: 'toJSON', value: function() {
this.jsonString=!0; const t={event: this.event}; return delete this.jsonString, t;
}}, {key: 'event', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _event):(0, Scorm12CMI.throwWriteOnlyError)();
}, set: function(t) {
(0, Scorm12CMI.check12ValidFormat)(t, regex.NAVEvent)&&_classPrivateFieldSet(this, _event, t);
}}]), e;
}(_common.BaseCMI); exports.NAV=NAV; var _event=new WeakMap;
}, {'../constants/api_constants': 9, '../constants/error_codes': 10, '../constants/regex': 13, './common': 6, './scorm12_cmi': 7}], 6: [function(require, module, exports) {
'use strict'; function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function _possibleConstructorReturn(e, t) {
return !t||'object'!==_typeof(t)&&'function'!=typeof t?_assertThisInitialized(e):t;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _inherits(e, t) {
if ('function'!=typeof t&&null!==t) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(t&&t.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), t&&_setPrototypeOf(e, t);
} function _setPrototypeOf(e, t) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, t) {
return e.__proto__=t, e;
})(e, t);
} function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let i=0; i<t.length; i++) {
const r=t[i]; r.enumerable=r.enumerable||!1, r.configurable=!0, 'value'in r&&(r.writable=!0), Object.defineProperty(e, r.key, r);
}
} function _createClass(e, t, i) {
return t&&_defineProperties(e.prototype, t), i&&_defineProperties(e, i), e;
} function _defineProperty(e, t, i) {
return t in e?Object.defineProperty(e, t, {value: i, enumerable: !0, configurable: !0, writable: !0}):e[t]=i, e;
} function _classPrivateFieldSet(e, t, i) {
const r=t.get(e); if (!r) throw new TypeError('attempted to set private field on non-instance'); if (r.set)r.set.call(e, i); else {
if (!r.writable) throw new TypeError('attempted to set read only private field'); r.value=i;
} return i;
} function _classPrivateFieldGet(e, t) {
const i=t.get(e); if (!i) throw new TypeError('attempted to get private field on non-instance'); return i.get?i.get.call(e):i.value;
} function checkValidFormat(e, t, i, r) {
const a=new RegExp(t); const s=e.match(a); if (r&&''===e) return !0; if (void 0===e||!s||''===s[0]) throw new _exceptions.ValidationError(i); return !0;
} function checkValidRange(e, t, i) {
const r=t.split('#'); if ((e*=1)>=r[0]) {
if ('*'===r[1]||e<=r[1]) return !0; throw new _exceptions.ValidationError(i);
} throw new _exceptions.ValidationError(i);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.checkValidFormat=checkValidFormat, exports.checkValidRange=checkValidRange, exports.CMIArray=exports.CMIScore=exports.BaseCMI=void 0; const _api_constants=require('../constants/api_constants'); const _error_codes=require('../constants/error_codes'); var _exceptions=require('../exceptions'); const _regex=require('../constants/regex'); const BaseCMI=function() {
function e() {
_classCallCheck(this, e), _defineProperty(this, 'jsonString', !1), _initialized.set(this, {writable: !0, value: !1});
} return _createClass(e, [{key: 'initialize', value: function() {
_classPrivateFieldSet(this, _initialized, !0);
}}, {key: 'initialized', get: function() {
return _classPrivateFieldGet(this, _initialized);
}}]), e;
}(); exports.BaseCMI=BaseCMI; var _initialized=new WeakMap; const CMIScore=function(e) {
function t(e) {
let i; const r=e.score_children; const a=e.score_range; const s=e.max; const n=e.invalidErrorCode; const o=e.invalidTypeCode; const l=e.invalidRangeCode; const _=e.decimalRegex; return _classCallCheck(this, t), i=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children2.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _score_range.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _invalid_error_code.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _invalid_type_code.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _invalid_range_code.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _decimal_regex.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _raw.set(_assertThisInitialized(i), {writable: !0, value: ''}), _min.set(_assertThisInitialized(i), {writable: !0, value: ''}), _max.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _classPrivateFieldSet(_assertThisInitialized(i), _children2, r||_api_constants.scorm12_constants.score_children), _classPrivateFieldSet(_assertThisInitialized(i), _score_range, !!a&&_regex.scorm12_regex.score_range), _classPrivateFieldSet(_assertThisInitialized(i), _max, s||''===s?s:'100'), _classPrivateFieldSet(_assertThisInitialized(i), _invalid_error_code, n||_error_codes.scorm12_error_codes.INVALID_SET_VALUE), _classPrivateFieldSet(_assertThisInitialized(i), _invalid_type_code, o||_error_codes.scorm12_error_codes.TYPE_MISMATCH), _classPrivateFieldSet(_assertThisInitialized(i), _invalid_range_code, l||_error_codes.scorm12_error_codes.VALUE_OUT_OF_RANGE), _classPrivateFieldSet(_assertThisInitialized(i), _decimal_regex, _||_regex.scorm12_regex.CMIDecimal), i;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
return {raw: this.raw, min: this.min, max: this.max};
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children2);
}, set: function(e) {
throw new _exceptions.ValidationError(_classPrivateFieldGet(this, _invalid_error_code));
}}, {key: 'raw', get: function() {
return _classPrivateFieldGet(this, _raw);
}, set: function(e) {
!checkValidFormat(e, _classPrivateFieldGet(this, _decimal_regex), _classPrivateFieldGet(this, _invalid_type_code))||_classPrivateFieldGet(this, _score_range)&&!checkValidRange(e, _classPrivateFieldGet(this, _score_range), _classPrivateFieldGet(this, _invalid_range_code))||_classPrivateFieldSet(this, _raw, e);
}}, {key: 'min', get: function() {
return _classPrivateFieldGet(this, _min);
}, set: function(e) {
!checkValidFormat(e, _classPrivateFieldGet(this, _decimal_regex), _classPrivateFieldGet(this, _invalid_type_code))||_classPrivateFieldGet(this, _score_range)&&!checkValidRange(e, _classPrivateFieldGet(this, _score_range), _classPrivateFieldGet(this, _invalid_range_code))||_classPrivateFieldSet(this, _min, e);
}}, {key: 'max', get: function() {
return _classPrivateFieldGet(this, _max);
}, set: function(e) {
!checkValidFormat(e, _classPrivateFieldGet(this, _decimal_regex), _classPrivateFieldGet(this, _invalid_type_code))||_classPrivateFieldGet(this, _score_range)&&!checkValidRange(e, _classPrivateFieldGet(this, _score_range), _classPrivateFieldGet(this, _invalid_range_code))||_classPrivateFieldSet(this, _max, e);
}}]), t;
}(BaseCMI); exports.CMIScore=CMIScore; var _children2=new WeakMap; var _score_range=new WeakMap; var _invalid_error_code=new WeakMap; var _invalid_type_code=new WeakMap; var _invalid_range_code=new WeakMap; var _decimal_regex=new WeakMap; var _raw=new WeakMap; var _min=new WeakMap; var _max=new WeakMap; const CMIArray=function(e) {
function t(e) {
let i; const r=e.children; const a=e.errorCode; return _classCallCheck(this, t), i=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _errorCode.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _children3.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _classPrivateFieldSet(_assertThisInitialized(i), _children3, r), _classPrivateFieldSet(_assertThisInitialized(i), _errorCode, a), i.childArray=[], i;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; for (var e={}, t=0; t<this.childArray.length; t++)e[t+'']=this.childArray[t]; return delete this.jsonString, e;
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children3);
}, set: function(e) {
throw new _exceptions.ValidationError(_classPrivateFieldGet(this, _errorCode));
}}, {key: '_count', get: function() {
return this.childArray.length;
}, set: function(e) {
throw new _exceptions.ValidationError(_classPrivateFieldGet(this, _errorCode));
}}]), t;
}(BaseCMI); exports.CMIArray=CMIArray; var _errorCode=new WeakMap; var _children3=new WeakMap;
}, {'../constants/api_constants': 9, '../constants/error_codes': 10, '../constants/regex': 13, '../exceptions': 15}], 7: [function(require, module, exports) {
'use strict'; function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let i=0; i<t.length; i++) {
const r=t[i]; r.enumerable=r.enumerable||!1, r.configurable=!0, 'value'in r&&(r.writable=!0), Object.defineProperty(e, r.key, r);
}
} function _createClass(e, t, i) {
return t&&_defineProperties(e.prototype, t), i&&_defineProperties(e, i), e;
} function _possibleConstructorReturn(e, t) {
return !t||'object'!==_typeof(t)&&'function'!=typeof t?_assertThisInitialized(e):t;
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _get(e, t, i) {
return (_get='undefined'!=typeof Reflect&&Reflect.get?Reflect.get:function(e, t, i) {
const r=_superPropBase(e, t); if (r) {
const s=Object.getOwnPropertyDescriptor(r, t); return s.get?s.get.call(i):s.value;
}
})(e, t, i||e);
} function _superPropBase(e, t) {
for (;!Object.prototype.hasOwnProperty.call(e, t)&&null!==(e=_getPrototypeOf(e)););return e;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _inherits(e, t) {
if ('function'!=typeof t&&null!==t) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(t&&t.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), t&&_setPrototypeOf(e, t);
} function _setPrototypeOf(e, t) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, t) {
return e.__proto__=t, e;
})(e, t);
} function _defineProperty(e, t, i) {
return t in e?Object.defineProperty(e, t, {value: i, enumerable: !0, configurable: !0, writable: !0}):e[t]=i, e;
} function _classPrivateFieldGet(e, t) {
const i=t.get(e); if (!i) throw new TypeError('attempted to get private field on non-instance'); return i.get?i.get.call(e):i.value;
} function _classPrivateFieldSet(e, t, i) {
const r=t.get(e); if (!r) throw new TypeError('attempted to set private field on non-instance'); if (r.set)r.set.call(e, i); else {
if (!r.writable) throw new TypeError('attempted to set read only private field'); r.value=i;
} return i;
} function throwReadOnlyError() {
throw new _exceptions.ValidationError(_error_codes.scorm12_error_codes.READ_ONLY_ELEMENT);
} function throwWriteOnlyError() {
throw new _exceptions.ValidationError(_error_codes.scorm12_error_codes.WRITE_ONLY_ELEMENT);
} function throwInvalidValueError() {
throw new _exceptions.ValidationError(_error_codes.scorm12_error_codes.INVALID_SET_VALUE);
} function check12ValidFormat(e, t) {
return (0, _common.checkValidFormat)(e, t, _error_codes.scorm12_error_codes.TYPE_MISMATCH);
} function check12ValidRange(e, t) {
return (0, _common.checkValidRange)(e, t, _error_codes.scorm12_error_codes.VALUE_OUT_OF_RANGE);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.throwReadOnlyError=throwReadOnlyError, exports.throwWriteOnlyError=throwWriteOnlyError, exports.check12ValidFormat=check12ValidFormat, exports.check12ValidRange=check12ValidRange, exports.CMIInteractionsCorrectResponsesObject=exports.CMIInteractionsObjectivesObject=exports.CMIObjectivesObject=exports.CMIInteractionsObject=exports.CMIStudentData=exports.CMI=void 0; var _common=require('./common'); const _api_constants=require('../constants/api_constants'); var _error_codes=require('../constants/error_codes'); const _regex=require('../constants/regex'); var _exceptions=require('../exceptions'); const constants=_api_constants.scorm12_constants; const regex=_regex.scorm12_regex; const CMI=function(e) {
function t(e, i, r) {
let s; return _classCallCheck(this, t), s=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children2.set(_assertThisInitialized(s), {writable: !0, value: ''}), _version2.set(_assertThisInitialized(s), {writable: !0, value: '3.4'}), _suspend_data.set(_assertThisInitialized(s), {writable: !0, value: ''}), _launch_data.set(_assertThisInitialized(s), {writable: !0, value: ''}), _comments.set(_assertThisInitialized(s), {writable: !0, value: ''}), _comments_from_lms.set(_assertThisInitialized(s), {writable: !0, value: ''}), _defineProperty(_assertThisInitialized(s), 'student_data', null), r&&s.initialize(), _classPrivateFieldSet(_assertThisInitialized(s), _children2, e||constants.cmi_children), s.core=new CMICore, s.objectives=new CMIObjectives, s.student_data=i||new CMIStudentData, s.student_preference=new CMIStudentPreference, s.interactions=new CMIInteractions, s;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; let i; let r; let s; let n; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.core)||void 0===e||e.initialize(), null===(i=this.objectives)||void 0===i||i.initialize(), null===(r=this.student_data)||void 0===r||r.initialize(), null===(s=this.student_preference)||void 0===s||s.initialize(), null===(n=this.interactions)||void 0===n||n.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={suspend_data: this.suspend_data, launch_data: this.launch_data, comments: this.comments, comments_from_lms: this.comments_from_lms, core: this.core, objectives: this.objectives, student_data: this.student_data, student_preference: this.student_preference, interactions: this.interactions}; return delete this.jsonString, e;
}}, {key: '_version', get: function() {
return _classPrivateFieldGet(this, _version2);
}, set: function(e) {
throwInvalidValueError();
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children2);
}, set: function(e) {
throwInvalidValueError();
}}, {key: 'suspend_data', get: function() {
return _classPrivateFieldGet(this, _suspend_data);
}, set: function(e) {
check12ValidFormat(e, regex.CMIString4096)&&_classPrivateFieldSet(this, _suspend_data, e);
}}, {key: 'launch_data', get: function() {
return _classPrivateFieldGet(this, _launch_data);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _launch_data, e);
}}, {key: 'comments', get: function() {
return _classPrivateFieldGet(this, _comments);
}, set: function(e) {
check12ValidFormat(e, regex.CMIString4096)&&_classPrivateFieldSet(this, _comments, e);
}}, {key: 'comments_from_lms', get: function() {
return _classPrivateFieldGet(this, _comments_from_lms);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _comments_from_lms, e);
}}]), t;
}(_common.BaseCMI); exports.CMI=CMI; var _children2=new WeakMap; var _version2=new WeakMap; var _suspend_data=new WeakMap; var _launch_data=new WeakMap; var _comments=new WeakMap; var _comments_from_lms=new WeakMap; var CMICore=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children3.set(_assertThisInitialized(e), {writable: !0, value: constants.core_children}), _student_id.set(_assertThisInitialized(e), {writable: !0, value: ''}), _student_name.set(_assertThisInitialized(e), {writable: !0, value: ''}), _lesson_location.set(_assertThisInitialized(e), {writable: !0, value: ''}), _credit.set(_assertThisInitialized(e), {writable: !0, value: ''}), _lesson_status.set(_assertThisInitialized(e), {writable: !0, value: ''}), _entry.set(_assertThisInitialized(e), {writable: !0, value: ''}), _total_time.set(_assertThisInitialized(e), {writable: !0, value: ''}), _lesson_mode.set(_assertThisInitialized(e), {writable: !0, value: 'normal'}), _exit.set(_assertThisInitialized(e), {writable: !0, value: ''}), _session_time.set(_assertThisInitialized(e), {writable: !0, value: '00:00:00'}), e.score=new _common.CMIScore({score_children: constants.score_children, score_range: regex.score_range, invalidErrorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE, invalidTypeCode: _error_codes.scorm12_error_codes.TYPE_MISMATCH, invalidRangeCode: _error_codes.scorm12_error_codes.VALUE_OUT_OF_RANGE}), e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.score)||void 0===e||e.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={student_id: this.student_id, student_name: this.student_name, lesson_location: this.lesson_location, credit: this.credit, lesson_status: this.lesson_status, entry: this.entry, total_time: this.total_time, lesson_mode: this.lesson_mode, exit: this.exit, session_time: this.session_time, score: this.score}; return delete this.jsonString, e;
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children3);
}, set: function(e) {
throwInvalidValueError();
}}, {key: 'student_id', get: function() {
return _classPrivateFieldGet(this, _student_id);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _student_id, e);
}}, {key: 'student_name', get: function() {
return _classPrivateFieldGet(this, _student_name);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _student_name, e);
}}, {key: 'lesson_location', get: function() {
return _classPrivateFieldGet(this, _lesson_location);
}, set: function(e) {
check12ValidFormat(e, regex.CMIString256)&&_classPrivateFieldSet(this, _lesson_location, e);
}}, {key: 'credit', get: function() {
return _classPrivateFieldGet(this, _credit);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _credit, e);
}}, {key: 'lesson_status', get: function() {
return _classPrivateFieldGet(this, _lesson_status);
}, set: function(e) {
check12ValidFormat(e, regex.CMIStatus)&&_classPrivateFieldSet(this, _lesson_status, e);
}}, {key: 'entry', get: function() {
return _classPrivateFieldGet(this, _entry);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _entry, e);
}}, {key: 'total_time', get: function() {
return _classPrivateFieldGet(this, _total_time);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _total_time, e);
}}, {key: 'lesson_mode', get: function() {
return _classPrivateFieldGet(this, _lesson_mode);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _lesson_mode, e);
}}, {key: 'exit', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _exit):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIExit)&&_classPrivateFieldSet(this, _exit, e);
}}, {key: 'session_time', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _session_time):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMITimespan)&&_classPrivateFieldSet(this, _session_time, e);
}}]), t;
}(_common.BaseCMI); var _children3=new WeakMap; var _student_id=new WeakMap; var _student_name=new WeakMap; var _lesson_location=new WeakMap; var _credit=new WeakMap; var _lesson_status=new WeakMap; var _entry=new WeakMap; var _total_time=new WeakMap; var _lesson_mode=new WeakMap; var _exit=new WeakMap; var _session_time=new WeakMap; var CMIObjectives=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.objectives_children, errorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE}));
} return _inherits(t, e), t;
}(_common.CMIArray); var CMIStudentData=function(e) {
function t(e) {
let i; return _classCallCheck(this, t), i=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children4.set(_assertThisInitialized(i), {writable: !0, value: void 0}), _mastery_score.set(_assertThisInitialized(i), {writable: !0, value: ''}), _max_time_allowed.set(_assertThisInitialized(i), {writable: !0, value: ''}), _time_limit_action.set(_assertThisInitialized(i), {writable: !0, value: ''}), _classPrivateFieldSet(_assertThisInitialized(i), _children4, e||constants.student_data_children), i;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={mastery_score: this.mastery_score, max_time_allowed: this.max_time_allowed, time_limit_action: this.time_limit_action}; return delete this.jsonString, e;
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children4);
}, set: function(e) {
throwInvalidValueError();
}}, {key: 'mastery_score', get: function() {
return _classPrivateFieldGet(this, _mastery_score);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _mastery_score, e);
}}, {key: 'max_time_allowed', get: function() {
return _classPrivateFieldGet(this, _max_time_allowed);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _max_time_allowed, e);
}}, {key: 'time_limit_action', get: function() {
return _classPrivateFieldGet(this, _time_limit_action);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _time_limit_action, e);
}}]), t;
}(_common.BaseCMI); exports.CMIStudentData=CMIStudentData; var _children4=new WeakMap; var _mastery_score=new WeakMap; var _max_time_allowed=new WeakMap; var _time_limit_action=new WeakMap; var CMIStudentPreference=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children5.set(_assertThisInitialized(e), {writable: !0, value: constants.student_preference_children}), _audio.set(_assertThisInitialized(e), {writable: !0, value: ''}), _language.set(_assertThisInitialized(e), {writable: !0, value: ''}), _speed.set(_assertThisInitialized(e), {writable: !0, value: ''}), _text.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={audio: this.audio, language: this.language, speed: this.speed, text: this.text}; return delete this.jsonString, e;
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children5);
}, set: function(e) {
throwInvalidValueError();
}}, {key: 'audio', get: function() {
return _classPrivateFieldGet(this, _audio);
}, set: function(e) {
check12ValidFormat(e, regex.CMISInteger)&&check12ValidRange(e, regex.audio_range)&&_classPrivateFieldSet(this, _audio, e);
}}, {key: 'language', get: function() {
return _classPrivateFieldGet(this, _language);
}, set: function(e) {
check12ValidFormat(e, regex.CMIString256)&&_classPrivateFieldSet(this, _language, e);
}}, {key: 'speed', get: function() {
return _classPrivateFieldGet(this, _speed);
}, set: function(e) {
check12ValidFormat(e, regex.CMISInteger)&&check12ValidRange(e, regex.speed_range)&&_classPrivateFieldSet(this, _speed, e);
}}, {key: 'text', get: function() {
return _classPrivateFieldGet(this, _text);
}, set: function(e) {
check12ValidFormat(e, regex.CMISInteger)&&check12ValidRange(e, regex.text_range)&&_classPrivateFieldSet(this, _text, e);
}}]), t;
}(_common.BaseCMI); var _children5=new WeakMap; var _audio=new WeakMap; var _language=new WeakMap; var _speed=new WeakMap; var _text=new WeakMap; var CMIInteractions=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.interactions_children, errorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE}));
} return _inherits(t, e), t;
}(_common.CMIArray); const CMIInteractionsObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id.set(_assertThisInitialized(e), {writable: !0, value: ''}), _time.set(_assertThisInitialized(e), {writable: !0, value: ''}), _type.set(_assertThisInitialized(e), {writable: !0, value: ''}), _weighting.set(_assertThisInitialized(e), {writable: !0, value: ''}), _student_response.set(_assertThisInitialized(e), {writable: !0, value: ''}), _result.set(_assertThisInitialized(e), {writable: !0, value: ''}), _latency.set(_assertThisInitialized(e), {writable: !0, value: ''}), e.objectives=new _common.CMIArray({errorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE, children: constants.objectives_children}), e.correct_responses=new _common.CMIArray({errorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE, children: constants.correct_responses_children}), e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; let i; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.objectives)||void 0===e||e.initialize(), null===(i=this.correct_responses)||void 0===i||i.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id, time: this.time, type: this.type, weighting: this.weighting, student_response: this.student_response, result: this.result, latency: this.latency, objectives: this.objectives, correct_responses: this.correct_responses}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _id):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIIdentifier)&&_classPrivateFieldSet(this, _id, e);
}}, {key: 'time', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _time):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMITime)&&_classPrivateFieldSet(this, _time, e);
}}, {key: 'type', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _type):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIType)&&_classPrivateFieldSet(this, _type, e);
}}, {key: 'weighting', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _weighting):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIDecimal)&&check12ValidRange(e, regex.weighting_range)&&_classPrivateFieldSet(this, _weighting, e);
}}, {key: 'student_response', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _student_response):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIFeedback)&&_classPrivateFieldSet(this, _student_response, e);
}}, {key: 'result', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _result):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIResult)&&_classPrivateFieldSet(this, _result, e);
}}, {key: 'latency', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _latency):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMITimespan)&&_classPrivateFieldSet(this, _latency, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsObject=CMIInteractionsObject; var _id=new WeakMap; var _time=new WeakMap; var _type=new WeakMap; var _weighting=new WeakMap; var _student_response=new WeakMap; var _result=new WeakMap; var _latency=new WeakMap; const CMIObjectivesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id2.set(_assertThisInitialized(e), {writable: !0, value: ''}), _status.set(_assertThisInitialized(e), {writable: !0, value: ''}), e.score=new _common.CMIScore({score_children: constants.score_children, score_range: regex.score_range, invalidErrorCode: _error_codes.scorm12_error_codes.INVALID_SET_VALUE, invalidTypeCode: _error_codes.scorm12_error_codes.TYPE_MISMATCH, invalidRangeCode: _error_codes.scorm12_error_codes.VALUE_OUT_OF_RANGE}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id, status: this.status, score: this.score}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return _classPrivateFieldGet(this, _id2);
}, set: function(e) {
check12ValidFormat(e, regex.CMIIdentifier)&&_classPrivateFieldSet(this, _id2, e);
}}, {key: 'status', get: function() {
return _classPrivateFieldGet(this, _status);
}, set: function(e) {
check12ValidFormat(e, regex.CMIStatus2)&&_classPrivateFieldSet(this, _status, e);
}}]), t;
}(_common.BaseCMI); exports.CMIObjectivesObject=CMIObjectivesObject; var _id2=new WeakMap; var _status=new WeakMap; const CMIInteractionsObjectivesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id3.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return _classPrivateFieldGet(this, _id3);
}, set: function(e) {
check12ValidFormat(e, regex.CMIIdentifier)&&_classPrivateFieldSet(this, _id3, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsObjectivesObject=CMIInteractionsObjectivesObject; var _id3=new WeakMap; const CMIInteractionsCorrectResponsesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _pattern.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={pattern: this.pattern}; return delete this.jsonString, e;
}}, {key: 'pattern', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _pattern):throwWriteOnlyError();
}, set: function(e) {
check12ValidFormat(e, regex.CMIFeedback)&&_classPrivateFieldSet(this, _pattern, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsCorrectResponsesObject=CMIInteractionsCorrectResponsesObject; var _pattern=new WeakMap;
}, {'../constants/api_constants': 9, '../constants/error_codes': 10, '../constants/regex': 13, '../exceptions': 15, './common': 6}], 8: [function(require, module, exports) {
'use strict'; function _typeof(e) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e) {
return typeof e;
}:function(e) {
return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e;
})(e);
} function set(e, t, i, r) {
return (set='undefined'!=typeof Reflect&&Reflect.set?Reflect.set:function(e, t, i, r) {
let s; const n=_superPropBase(e, t); if (n) {
if (s=Object.getOwnPropertyDescriptor(n, t), s.set) return s.set.call(r, i), !0; if (!s.writable) return !1;
} if (s=Object.getOwnPropertyDescriptor(r, t)) {
if (!s.writable) return !1; s.value=i, Object.defineProperty(r, t, s);
} else _defineProperty(r, t, i); return !0;
})(e, t, i, r);
} function _set(e, t, i, r, s) {
if (!set(e, t, i, r||e)&&s) throw new Error('failed to set property'); return i;
} function _defineProperty(e, t, i) {
return t in e?Object.defineProperty(e, t, {value: i, enumerable: !0, configurable: !0, writable: !0}):e[t]=i, e;
} function _classCallCheck(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(e, t) {
for (let i=0; i<t.length; i++) {
const r=t[i]; r.enumerable=r.enumerable||!1, r.configurable=!0, 'value'in r&&(r.writable=!0), Object.defineProperty(e, r.key, r);
}
} function _createClass(e, t, i) {
return t&&_defineProperties(e.prototype, t), i&&_defineProperties(e, i), e;
} function _possibleConstructorReturn(e, t) {
return !t||'object'!==_typeof(t)&&'function'!=typeof t?_assertThisInitialized(e):t;
} function _assertThisInitialized(e) {
if (void 0===e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return e;
} function _get(e, t, i) {
return (_get='undefined'!=typeof Reflect&&Reflect.get?Reflect.get:function(e, t, i) {
const r=_superPropBase(e, t); if (r) {
const s=Object.getOwnPropertyDescriptor(r, t); return s.get?s.get.call(i):s.value;
}
})(e, t, i||e);
} function _superPropBase(e, t) {
for (;!Object.prototype.hasOwnProperty.call(e, t)&&null!==(e=_getPrototypeOf(e)););return e;
} function _getPrototypeOf(e) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e) {
return e.__proto__||Object.getPrototypeOf(e);
})(e);
} function _inherits(e, t) {
if ('function'!=typeof t&&null!==t) throw new TypeError('Super expression must either be null or a function'); e.prototype=Object.create(t&&t.prototype, {constructor: {value: e, writable: !0, configurable: !0}}), t&&_setPrototypeOf(e, t);
} function _setPrototypeOf(e, t) {
return (_setPrototypeOf=Object.setPrototypeOf||function(e, t) {
return e.__proto__=t, e;
})(e, t);
} function _classPrivateFieldSet(e, t, i) {
const r=t.get(e); if (!r) throw new TypeError('attempted to set private field on non-instance'); if (r.set)r.set.call(e, i); else {
if (!r.writable) throw new TypeError('attempted to set read only private field'); r.value=i;
} return i;
} function _classPrivateFieldGet(e, t) {
const i=t.get(e); if (!i) throw new TypeError('attempted to get private field on non-instance'); return i.get?i.get.call(e):i.value;
} function throwReadOnlyError() {
throw new _exceptions.ValidationError(_error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT);
} function throwWriteOnlyError() {
throw new _exceptions.ValidationError(_error_codes.scorm2004_error_codes.WRITE_ONLY_ELEMENT);
} function throwTypeMismatchError() {
throw new _exceptions.ValidationError(_error_codes.scorm2004_error_codes.TYPE_MISMATCH);
} function check2004ValidFormat(e, t, i) {
return (0, _common.checkValidFormat)(e, t, _error_codes.scorm2004_error_codes.TYPE_MISMATCH, i);
} function check2004ValidRange(e, t) {
return (0, _common.checkValidRange)(e, t, _error_codes.scorm2004_error_codes.VALUE_OUT_OF_RANGE);
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.ADL=exports.CMIInteractionsCorrectResponsesObject=exports.CMIInteractionsObjectivesObject=exports.CMICommentsFromLMSObject=exports.CMICommentsFromLearnerObject=exports.CMIObjectivesObject=exports.CMIInteractionsObject=exports.CMI=void 0; var _common=require('./common'); const _api_constants=require('../constants/api_constants'); const _regex=require('../constants/regex'); var _error_codes=require('../constants/error_codes'); const _response_constants=require('../constants/response_constants'); var _exceptions=require('../exceptions'); const constants=_api_constants.scorm2004_constants; const regex=_regex.scorm2004_regex; const CMI=function(e) {
function t(e) {
let i; return _classCallCheck(this, t), i=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _version2.set(_assertThisInitialized(i), {writable: !0, value: '1.0'}), _children2.set(_assertThisInitialized(i), {writable: !0, value: constants.cmi_children}), _completion_status.set(_assertThisInitialized(i), {writable: !0, value: 'unknown'}), _completion_threshold.set(_assertThisInitialized(i), {writable: !0, value: ''}), _credit.set(_assertThisInitialized(i), {writable: !0, value: 'credit'}), _entry.set(_assertThisInitialized(i), {writable: !0, value: ''}), _exit.set(_assertThisInitialized(i), {writable: !0, value: ''}), _launch_data.set(_assertThisInitialized(i), {writable: !0, value: ''}), _learner_id.set(_assertThisInitialized(i), {writable: !0, value: ''}), _learner_name.set(_assertThisInitialized(i), {writable: !0, value: ''}), _location.set(_assertThisInitialized(i), {writable: !0, value: ''}), _max_time_allowed.set(_assertThisInitialized(i), {writable: !0, value: ''}), _mode.set(_assertThisInitialized(i), {writable: !0, value: 'normal'}), _progress_measure.set(_assertThisInitialized(i), {writable: !0, value: ''}), _scaled_passing_score.set(_assertThisInitialized(i), {writable: !0, value: ''}), _session_time.set(_assertThisInitialized(i), {writable: !0, value: 'PT0H0M0S'}), _success_status.set(_assertThisInitialized(i), {writable: !0, value: 'unknown'}), _suspend_data.set(_assertThisInitialized(i), {writable: !0, value: ''}), _time_limit_action.set(_assertThisInitialized(i), {writable: !0, value: 'continue,no message'}), _total_time.set(_assertThisInitialized(i), {writable: !0, value: '0'}), e&&i.initialize(), i.learner_preference=new CMILearnerPreference, i.score=new Scorm2004CMIScore, i.comments_from_learner=new CMICommentsFromLearner, i.comments_from_lms=new CMICommentsFromLMS, i.interactions=new CMIInteractions, i.objectives=new CMIObjectives, i;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; let i; let r; let s; let n; let a; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.learner_preference)||void 0===e||e.initialize(), null===(i=this.score)||void 0===i||i.initialize(), null===(r=this.comments_from_learner)||void 0===r||r.initialize(), null===(s=this.comments_from_lms)||void 0===s||s.initialize(), null===(n=this.interactions)||void 0===n||n.initialize(), null===(a=this.objectives)||void 0===a||a.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={comments_from_learner: this.comments_from_learner, comments_from_lms: this.comments_from_lms, completion_status: this.completion_status, completion_threshold: this.completion_threshold, credit: this.credit, entry: this.entry, exit: this.exit, interactions: this.interactions, launch_data: this.launch_data, learner_id: this.learner_id, learner_name: this.learner_name, learner_preference: this.learner_preference, location: this.location, max_time_allowed: this.max_time_allowed, mode: this.mode, objectives: this.objectives, progress_measure: this.progress_measure, scaled_passing_score: this.scaled_passing_score, score: this.score, session_time: this.session_time, success_status: this.success_status, suspend_data: this.suspend_data, time_limit_action: this.time_limit_action, total_time: this.total_time}; return delete this.jsonString, e;
}}, {key: '_version', get: function() {
return _classPrivateFieldGet(this, _version2);
}, set: function(e) {
throwReadOnlyError();
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children2);
}, set: function(e) {
throwReadOnlyError();
}}, {key: 'completion_status', get: function() {
return _classPrivateFieldGet(this, _completion_status);
}, set: function(e) {
check2004ValidFormat(e, regex.CMICStatus)&&_classPrivateFieldSet(this, _completion_status, e);
}}, {key: 'completion_threshold', get: function() {
return _classPrivateFieldGet(this, _completion_threshold);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _completion_threshold, e);
}}, {key: 'credit', get: function() {
return _classPrivateFieldGet(this, _credit);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _credit, e);
}}, {key: 'entry', get: function() {
return _classPrivateFieldGet(this, _entry);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _entry, e);
}}, {key: 'exit', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _exit):throwWriteOnlyError();
}, set: function(e) {
check2004ValidFormat(e, regex.CMIExit)&&_classPrivateFieldSet(this, _exit, e);
}}, {key: 'launch_data', get: function() {
return _classPrivateFieldGet(this, _launch_data);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _launch_data, e);
}}, {key: 'learner_id', get: function() {
return _classPrivateFieldGet(this, _learner_id);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _learner_id, e);
}}, {key: 'learner_name', get: function() {
return _classPrivateFieldGet(this, _learner_name);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _learner_name, e);
}}, {key: 'location', get: function() {
return _classPrivateFieldGet(this, _location);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIString1000)&&_classPrivateFieldSet(this, _location, e);
}}, {key: 'max_time_allowed', get: function() {
return _classPrivateFieldGet(this, _max_time_allowed);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _max_time_allowed, e);
}}, {key: 'mode', get: function() {
return _classPrivateFieldGet(this, _mode);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _mode, e);
}}, {key: 'progress_measure', get: function() {
return _classPrivateFieldGet(this, _progress_measure);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&check2004ValidRange(e, regex.progress_range)&&_classPrivateFieldSet(this, _progress_measure, e);
}}, {key: 'scaled_passing_score', get: function() {
return _classPrivateFieldGet(this, _scaled_passing_score);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _scaled_passing_score, e);
}}, {key: 'session_time', get: function() {
return this.jsonString?_classPrivateFieldGet(this, _session_time):throwWriteOnlyError();
}, set: function(e) {
check2004ValidFormat(e, regex.CMITimespan)&&_classPrivateFieldSet(this, _session_time, e);
}}, {key: 'success_status', get: function() {
return _classPrivateFieldGet(this, _success_status);
}, set: function(e) {
check2004ValidFormat(e, regex.CMISStatus)&&_classPrivateFieldSet(this, _success_status, e);
}}, {key: 'suspend_data', get: function() {
return _classPrivateFieldGet(this, _suspend_data);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIString64000)&&_classPrivateFieldSet(this, _suspend_data, e);
}}, {key: 'time_limit_action', get: function() {
return _classPrivateFieldGet(this, _time_limit_action);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _time_limit_action, e);
}}, {key: 'total_time', get: function() {
return _classPrivateFieldGet(this, _total_time);
}, set: function(e) {
this.initialized?throwReadOnlyError():_classPrivateFieldSet(this, _total_time, e);
}}]), t;
}(_common.BaseCMI); exports.CMI=CMI; var _version2=new WeakMap; var _children2=new WeakMap; var _completion_status=new WeakMap; var _completion_threshold=new WeakMap; var _credit=new WeakMap; var _entry=new WeakMap; var _exit=new WeakMap; var _launch_data=new WeakMap; var _learner_id=new WeakMap; var _learner_name=new WeakMap; var _location=new WeakMap; var _max_time_allowed=new WeakMap; var _mode=new WeakMap; var _progress_measure=new WeakMap; var _scaled_passing_score=new WeakMap; var _session_time=new WeakMap; var _success_status=new WeakMap; var _suspend_data=new WeakMap; var _time_limit_action=new WeakMap; var _total_time=new WeakMap; var CMILearnerPreference=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _children3.set(_assertThisInitialized(e), {writable: !0, value: constants.student_preference_children}), _audio_level.set(_assertThisInitialized(e), {writable: !0, value: '1'}), _language.set(_assertThisInitialized(e), {writable: !0, value: ''}), _delivery_speed.set(_assertThisInitialized(e), {writable: !0, value: '1'}), _audio_captioning.set(_assertThisInitialized(e), {writable: !0, value: '0'}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={audio_level: this.audio_level, language: this.language, delivery_speed: this.delivery_speed, audio_captioning: this.audio_captioning}; return delete this.jsonString, e;
}}, {key: '_children', get: function() {
return _classPrivateFieldGet(this, _children3);
}, set: function(e) {
throwReadOnlyError();
}}, {key: 'audio_level', get: function() {
return _classPrivateFieldGet(this, _audio_level);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&check2004ValidRange(e, regex.audio_range)&&_classPrivateFieldSet(this, _audio_level, e);
}}, {key: 'language', get: function() {
return _classPrivateFieldGet(this, _language);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILang)&&_classPrivateFieldSet(this, _language, e);
}}, {key: 'delivery_speed', get: function() {
return _classPrivateFieldGet(this, _delivery_speed);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&check2004ValidRange(e, regex.speed_range)&&_classPrivateFieldSet(this, _delivery_speed, e);
}}, {key: 'audio_captioning', get: function() {
return _classPrivateFieldGet(this, _audio_captioning);
}, set: function(e) {
check2004ValidFormat(e, regex.CMISInteger)&&check2004ValidRange(e, regex.text_range)&&_classPrivateFieldSet(this, _audio_captioning, e);
}}]), t;
}(_common.BaseCMI); var _children3=new WeakMap; var _audio_level=new WeakMap; var _language=new WeakMap; var _delivery_speed=new WeakMap; var _audio_captioning=new WeakMap; var CMIInteractions=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.interactions_children, errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT}));
} return _inherits(t, e), t;
}(_common.CMIArray); var CMIObjectives=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.objectives_children, errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT}));
} return _inherits(t, e), t;
}(_common.CMIArray); var CMICommentsFromLMS=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.comments_children, errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT}));
} return _inherits(t, e), t;
}(_common.CMIArray); var CMICommentsFromLearner=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {children: constants.comments_children, errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT}));
} return _inherits(t, e), t;
}(_common.CMIArray); const CMIInteractionsObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id.set(_assertThisInitialized(e), {writable: !0, value: ''}), _type.set(_assertThisInitialized(e), {writable: !0, value: ''}), _timestamp.set(_assertThisInitialized(e), {writable: !0, value: ''}), _weighting.set(_assertThisInitialized(e), {writable: !0, value: ''}), _learner_response.set(_assertThisInitialized(e), {writable: !0, value: ''}), _result.set(_assertThisInitialized(e), {writable: !0, value: ''}), _latency.set(_assertThisInitialized(e), {writable: !0, value: ''}), _description.set(_assertThisInitialized(e), {writable: !0, value: ''}), e.objectives=new _common.CMIArray({errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT, children: constants.objectives_children}), e.correct_responses=new _common.CMIArray({errorCode: _error_codes.scorm2004_error_codes.READ_ONLY_ELEMENT, children: constants.correct_responses_children}), e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; let i; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.objectives)||void 0===e||e.initialize(), null===(i=this.correct_responses)||void 0===i||i.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id, type: this.type, objectives: this.objectives, timestamp: this.timestamp, weighting: this.weighting, learner_response: this.learner_response, result: this.result, latency: this.latency, description: this.description, correct_responses: this.correct_responses}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return _classPrivateFieldGet(this, _id);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILongIdentifier)&&_classPrivateFieldSet(this, _id, e);
}}, {key: 'type', get: function() {
return _classPrivateFieldGet(this, _type);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIType)&&_classPrivateFieldSet(this, _type, e);
}}, {key: 'timestamp', get: function() {
return _classPrivateFieldGet(this, _timestamp);
}, set: function(e) {
check2004ValidFormat(e, regex.CMITime)&&_classPrivateFieldSet(this, _timestamp, e);
}}, {key: 'weighting', get: function() {
return _classPrivateFieldGet(this, _weighting);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&_classPrivateFieldSet(this, _weighting, e);
}}, {key: 'learner_response', get: function() {
return _classPrivateFieldGet(this, _learner_response);
}, set: function(e) {
if (void 0===this.type) throw new _exceptions.ValidationError(_error_codes.scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED); let t=[]; const i=_response_constants.learner_responses[this.type]; if (''!==i.delimiter?t=e.split(i.delimiter):t[0]=e, !(t.length>0&&t.length<=i.max)) throw new _exceptions.ValidationError(_error_codes.scorm2004_error_codes.GENERAL_SET_FAILURE); for (let r=new RegExp(i.format), s=0; s<t.length; s++) {
if (void 0!==i.delimiter2) {
const n=t[s].split(i.delimiter2); 2===n.length&&n[0].match(r)?n[1].match(new RegExp(i.format2))||throwTypeMismatchError():throwTypeMismatchError();
} else if (t[s].match(r)) {
if (''!==t[s]&&i.unique) for (let a=0; a<s; a++)t[s]===t[a]&&throwTypeMismatchError();
} else throwTypeMismatchError();
}
}}, {key: 'result', get: function() {
return _classPrivateFieldGet(this, _result);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIResult)&&_classPrivateFieldSet(this, _result, e);
}}, {key: 'latency', get: function() {
return _classPrivateFieldGet(this, _latency);
}, set: function(e) {
check2004ValidFormat(e, regex.CMITimespan)&&_classPrivateFieldSet(this, _latency, e);
}}, {key: 'description', get: function() {
return _classPrivateFieldGet(this, _description);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILangString250, !0)&&_classPrivateFieldSet(this, _description, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsObject=CMIInteractionsObject; var _id=new WeakMap; var _type=new WeakMap; var _timestamp=new WeakMap; var _weighting=new WeakMap; var _learner_response=new WeakMap; var _result=new WeakMap; var _latency=new WeakMap; var _description=new WeakMap; const CMIObjectivesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id2.set(_assertThisInitialized(e), {writable: !0, value: ''}), _success_status2.set(_assertThisInitialized(e), {writable: !0, value: 'unknown'}), _completion_status2.set(_assertThisInitialized(e), {writable: !0, value: 'unknown'}), _progress_measure2.set(_assertThisInitialized(e), {writable: !0, value: ''}), _description2.set(_assertThisInitialized(e), {writable: !0, value: ''}), e.score=new Scorm2004CMIScore, e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.score)||void 0===e||e.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id, success_status: this.success_status, completion_status: this.completion_status, progress_measure: this.progress_measure, description: this.description, score: this.score}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return _classPrivateFieldGet(this, _id2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILongIdentifier)&&_classPrivateFieldSet(this, _id2, e);
}}, {key: 'success_status', get: function() {
return _classPrivateFieldGet(this, _success_status2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMISStatus)&&_classPrivateFieldSet(this, _success_status2, e);
}}, {key: 'completion_status', get: function() {
return _classPrivateFieldGet(this, _completion_status2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMICStatus)&&_classPrivateFieldSet(this, _completion_status2, e);
}}, {key: 'progress_measure', get: function() {
return _classPrivateFieldGet(this, _progress_measure2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&check2004ValidRange(e, regex.progress_range)&&_classPrivateFieldSet(this, _progress_measure2, e);
}}, {key: 'description', get: function() {
return _classPrivateFieldGet(this, _description2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILangString250, !0)&&_classPrivateFieldSet(this, _description2, e);
}}]), t;
}(_common.BaseCMI); exports.CMIObjectivesObject=CMIObjectivesObject; var _id2=new WeakMap; var _success_status2=new WeakMap; var _completion_status2=new WeakMap; var _progress_measure2=new WeakMap; var _description2=new WeakMap; var Scorm2004CMIScore=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this, {score_children: constants.score_children, max: '', invalidErrorCode: _error_codes.scorm2004_error_codes.INVALID_SET_VALUE, invalidTypeCode: _error_codes.scorm2004_error_codes.TYPE_MISMATCH, invalidRangeCode: _error_codes.scorm2004_error_codes.VALUE_OUT_OF_RANGE, decimalRegex: _regex.scorm2004_regex.CMIDecimal})), _scaled.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={scaled: this.scaled, raw: _get(_getPrototypeOf(t.prototype), 'raw', this), min: _get(_getPrototypeOf(t.prototype), 'min', this), max: _get(_getPrototypeOf(t.prototype), 'max', this)}; return delete this.jsonString, e;
}}, {key: 'scaled', get: function() {
return _classPrivateFieldGet(this, _scaled);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIDecimal)&&check2004ValidRange(e, regex.scaled_range)&&_classPrivateFieldSet(this, _scaled, e);
}}]), t;
}(_common.CMIScore); var _scaled=new WeakMap; const CMICommentsFromLearnerObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _comment.set(_assertThisInitialized(e), {writable: !0, value: ''}), _location2.set(_assertThisInitialized(e), {writable: !0, value: ''}), _timestamp2.set(_assertThisInitialized(e), {writable: !0, value: ''}), _classPrivateFieldSet(_assertThisInitialized(e), _comment, ''), _classPrivateFieldSet(_assertThisInitialized(e), _location2, ''), _classPrivateFieldSet(_assertThisInitialized(e), _timestamp2, ''), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={comment: this.comment, location: this.location, timestamp: this.timestamp}; return delete this.jsonString, e;
}}, {key: 'comment', get: function() {
return _classPrivateFieldGet(this, _comment);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILangString4000, !0)&&_classPrivateFieldSet(this, _comment, e);
}}, {key: 'location', get: function() {
return _classPrivateFieldGet(this, _location2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIString250)&&_classPrivateFieldSet(this, _location2, e);
}}, {key: 'timestamp', get: function() {
return _classPrivateFieldGet(this, _timestamp2);
}, set: function(e) {
check2004ValidFormat(e, regex.CMITime)&&_classPrivateFieldSet(this, _timestamp2, e);
}}]), t;
}(_common.BaseCMI); exports.CMICommentsFromLearnerObject=CMICommentsFromLearnerObject; var _comment=new WeakMap; var _location2=new WeakMap; var _timestamp2=new WeakMap; const CMICommentsFromLMSObject=function(e) {
function t() {
return _classCallCheck(this, t), _possibleConstructorReturn(this, _getPrototypeOf(t).call(this));
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
return _get(_getPrototypeOf(t.prototype), 'toJSON', this).call(this);
}}, {key: 'comment', get: function() {
return _get(_getPrototypeOf(t.prototype), 'comment', this);
}, set: function(e) {
this.initialized?throwReadOnlyError():_set(_getPrototypeOf(t.prototype), 'comment', e, this, !0);
}}, {key: 'location', get: function() {
return _get(_getPrototypeOf(t.prototype), 'location', this);
}, set: function(e) {
this.initialized?throwReadOnlyError():_set(_getPrototypeOf(t.prototype), 'location', e, this, !0);
}}, {key: 'timestamp', get: function() {
return _get(_getPrototypeOf(t.prototype), 'timestamp', this);
}, set: function(e) {
this.initialized?throwReadOnlyError():_set(_getPrototypeOf(t.prototype), 'timestamp', e, this, !0);
}}]), t;
}(CMICommentsFromLearnerObject); exports.CMICommentsFromLMSObject=CMICommentsFromLMSObject; const CMIInteractionsObjectivesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _id3.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={id: this.id}; return delete this.jsonString, e;
}}, {key: 'id', get: function() {
return _classPrivateFieldGet(this, _id3);
}, set: function(e) {
check2004ValidFormat(e, regex.CMILongIdentifier)&&_classPrivateFieldSet(this, _id3, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsObjectivesObject=CMIInteractionsObjectivesObject; var _id3=new WeakMap; const CMIInteractionsCorrectResponsesObject=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _pattern.set(_assertThisInitialized(e), {writable: !0, value: ''}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={pattern: this.pattern}; return delete this.jsonString, e;
}}, {key: 'pattern', get: function() {
return _classPrivateFieldGet(this, _pattern);
}, set: function(e) {
check2004ValidFormat(e, regex.CMIFeedback)&&_classPrivateFieldSet(this, _pattern, e);
}}]), t;
}(_common.BaseCMI); exports.CMIInteractionsCorrectResponsesObject=CMIInteractionsCorrectResponsesObject; var _pattern=new WeakMap; const ADL=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), e.nav=new ADLNav, e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.nav)||void 0===e||e.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={nav: this.nav}; return delete this.jsonString, e;
}}]), t;
}(_common.BaseCMI); exports.ADL=ADL; var ADLNav=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _request.set(_assertThisInitialized(e), {writable: !0, value: '_none_'}), e.request_valid=new ADLNavRequestValid, e;
} return _inherits(t, e), _createClass(t, [{key: 'initialize', value: function() {
let e; _get(_getPrototypeOf(t.prototype), 'initialize', this).call(this), null===(e=this.request_valid)||void 0===e||e.initialize();
}}, {key: 'toJSON', value: function() {
this.jsonString=!0; const e={request: this.request}; return delete this.jsonString, e;
}}, {key: 'request', get: function() {
return _classPrivateFieldGet(this, _request);
}, set: function(e) {
check2004ValidFormat(e, regex.NAVEvent)&&_classPrivateFieldSet(this, _request, e);
}}]), t;
}(_common.BaseCMI); var _request=new WeakMap; var ADLNavRequestValid=function(e) {
function t() {
let e; return _classCallCheck(this, t), e=_possibleConstructorReturn(this, _getPrototypeOf(t).call(this)), _continue.set(_assertThisInitialized(e), {writable: !0, value: 'unknown'}), _previous.set(_assertThisInitialized(e), {writable: !0, value: 'unknown'}), _defineProperty(_assertThisInitialized(e), 'choice', function e() {
_classCallCheck(this, e), _defineProperty(this, '_isTargetValid', function(e) {
return 'unknown';
});
}), _defineProperty(_assertThisInitialized(e), 'jump', function e() {
_classCallCheck(this, e), _defineProperty(this, '_isTargetValid', function(e) {
return 'unknown';
});
}), e;
} return _inherits(t, e), _createClass(t, [{key: 'toJSON', value: function() {
this.jsonString=!0; const e={previous: this.previous, continue: this.continue}; return delete this.jsonString, e;
}}, {key: 'continue', get: function() {
return _classPrivateFieldGet(this, _continue);
}, set: function(e) {
throwReadOnlyError();
}}, {key: 'previous', get: function() {
return _classPrivateFieldGet(this, _previous);
}, set: function(e) {
throwReadOnlyError();
}}]), t;
}(_common.BaseCMI); var _continue=new WeakMap; var _previous=new WeakMap;
}, {'../constants/api_constants': 9, '../constants/error_codes': 10, '../constants/regex': 13, '../constants/response_constants': 14, '../exceptions': 15, './common': 6}], 9: [function(require, module, exports) {
'use strict'; function ownKeys(e, a) {
const t=Object.keys(e); if (Object.getOwnPropertySymbols) {
let s=Object.getOwnPropertySymbols(e); a&&(s=s.filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
})), t.push.apply(t, s);
} return t;
} function _objectSpread(e) {
for (let a=1; a<arguments.length; a++) {
var t=null!=arguments[a]?arguments[a]:{}; a%2?ownKeys(t, !0).forEach(function(a) {
_defineProperty(e, a, t[a]);
}):Object.getOwnPropertyDescriptors?Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)):ownKeys(t).forEach(function(a) {
Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(t, a));
});
} return e;
} function _defineProperty(e, a, t) {
return a in e?Object.defineProperty(e, a, {value: t, enumerable: !0, configurable: !0, writable: !0}):e[a]=t, e;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.scorm2004_constants=exports.aicc_constants=exports.scorm12_constants=void 0; const scorm12_constants={cmi_children: 'core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions', core_children: 'student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time', score_children: 'raw,min,max', comments_children: 'content,location,time', objectives_children: 'id,score,status', correct_responses_children: 'pattern', student_data_children: 'mastery_score,max_time_allowed,time_limit_action', student_preference_children: 'audio,language,speed,text', interactions_children: 'id,objectives,time,type,correct_responses,weighting,student_response,result,latency', error_descriptions: {101: {basicMessage: 'General Exception', detailMessage: 'No specific error code exists to describe the error. Use LMSGetDiagnostic for more information'}, 201: {basicMessage: 'Invalid argument error', detailMessage: 'Indicates that an argument represents an invalid data model element or is otherwise incorrect.'}, 202: {basicMessage: 'Element cannot have children', 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.'}, 203: {basicMessage: 'Element not an array - cannot have count', detailMessage: 'Indicates that LMSGetValue was called with a data model element name that ends in "_count" for a data model element that does not support the "_count" suffix.'}, 301: {basicMessage: 'Not initialized', detailMessage: 'Indicates that an API call was made before the call to lmsInitialize.'}, 401: {basicMessage: 'Not implemented error', detailMessage: 'The data model element indicated in a call to LMSGetValue or LMSSetValue is valid, but was not implemented by this LMS. SCORM 1.2 defines a set of data model elements as being optional for an LMS to implement.'}, 402: {basicMessage: 'Invalid set value, element is a keyword', detailMessage: 'Indicates that LMSSetValue was called on a data model element that represents a keyword (elements that end in "_children" and "_count").'}, 403: {basicMessage: 'Element is read only', detailMessage: 'LMSSetValue was called with a data model element that can only be read.'}, 404: {basicMessage: 'Element is write only', detailMessage: 'LMSGetValue was called on a data model element that can only be written to.'}, 405: {basicMessage: 'Incorrect Data Type', detailMessage: 'LMSSetValue was called with a value that is not consistent with the data format of the supplied data model element.'}}}; exports.scorm12_constants=scorm12_constants; const aicc_constants=_objectSpread({}, scorm12_constants, {}, {cmi_children: 'core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions,evaluation', student_data_children: 'attempt_number,tries,mastery_score,max_time_allowed,time_limit_action', tries_children: 'time,status,score'}); exports.aicc_constants=aicc_constants; const scorm2004_constants={cmi_children: '_version,comments_from_learner,comments_from_lms,completion_status,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time', comments_children: 'comment,timestamp,location', score_children: 'max,raw,scaled,min', objectives_children: 'progress_measure,completion_status,success_status,description,score,id', correct_responses_children: 'pattern', student_data_children: 'mastery_score,max_time_allowed,time_limit_action', student_preference_children: 'audio_level,audio_captioning,delivery_speed,language', interactions_children: 'id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description', error_descriptions: {0: {basicMessage: 'No Error', detailMessage: 'No error occurred, the previous API call was successful.'}, 101: {basicMessage: 'General Exception', detailMessage: 'No specific error code exists to describe the error. Use GetDiagnostic for more information.'}, 102: {basicMessage: 'General Initialization Failure', detailMessage: 'Call to Initialize failed for an unknown reason.'}, 103: {basicMessage: 'Already Initialized', detailMessage: 'Call to Initialize failed because Initialize was already called.'}, 104: {basicMessage: 'Content Instance Terminated', detailMessage: 'Call to Initialize failed because Terminate was already called.'}, 111: {basicMessage: 'General Termination Failure', detailMessage: 'Call to Terminate failed for an unknown reason.'}, 112: {basicMessage: 'Termination Before Initialization', detailMessage: 'Call to Terminate failed because it was made before the call to Initialize.'}, 113: {basicMessage: 'Termination After Termination', detailMessage: 'Call to Terminate failed because Terminate was already called.'}, 122: {basicMessage: 'Retrieve Data Before Initialization', detailMessage: 'Call to GetValue failed because it was made before the call to Initialize.'}, 123: {basicMessage: 'Retrieve Data After Termination', detailMessage: 'Call to GetValue failed because it was made after the call to Terminate.'}, 132: {basicMessage: 'Store Data Before Initialization', detailMessage: 'Call to SetValue failed because it was made before the call to Initialize.'}, 133: {basicMessage: 'Store Data After Termination', detailMessage: 'Call to SetValue failed because it was made after the call to Terminate.'}, 142: {basicMessage: 'Commit Before Initialization', detailMessage: 'Call to Commit failed because it was made before the call to Initialize.'}, 143: {basicMessage: 'Commit After Termination', detailMessage: 'Call to Commit failed because it was made after the call to Terminate.'}, 201: {basicMessage: 'General Argument Error', detailMessage: 'An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument.'}, 301: {basicMessage: 'General Get Failure', detailMessage: 'Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information.'}, 351: {basicMessage: 'General Set Failure', detailMessage: 'Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information.'}, 391: {basicMessage: 'General Commit Failure', detailMessage: 'Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information.'}, 401: {basicMessage: 'Undefined Data Model Element', detailMessage: 'The data model element name passed to GetValue or SetValue is not a valid SCORM data model element.'}, 402: {basicMessage: 'Unimplemented Data Model Element', detailMessage: 'The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant.'}, 403: {basicMessage: 'Data Model Element Value Not Initialized', detailMessage: 'Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO.'}, 404: {basicMessage: 'Data Model Element Is Read Only', detailMessage: 'SetValue was called with a data model element that can only be read.'}, 405: {basicMessage: 'Data Model Element Is Write Only', detailMessage: 'GetValue was called on a data model element that can only be written to.'}, 406: {basicMessage: 'Data Model Element Type Mismatch', detailMessage: 'SetValue was called with a value that is not consistent with the data format of the supplied data model element.'}, 407: {basicMessage: 'Data Model Element Value Out Of Range', detailMessage: 'The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element.'}, 408: {basicMessage: 'Data Model Dependency Not Established', detailMessage: 'Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element.'}}}; exports.scorm2004_constants=scorm2004_constants;
}, {}], 10: [function(require, module, exports) {
'use strict'; function ownKeys(E, _) {
const r=Object.keys(E); if (Object.getOwnPropertySymbols) {
let T=Object.getOwnPropertySymbols(E); _&&(T=T.filter(function(_) {
return Object.getOwnPropertyDescriptor(E, _).enumerable;
})), r.push.apply(r, T);
} return r;
} function _objectSpread(E) {
for (let _=1; _<arguments.length; _++) {
var r=null!=arguments[_]?arguments[_]:{}; _%2?ownKeys(r, !0).forEach(function(_) {
_defineProperty(E, _, r[_]);
}):Object.getOwnPropertyDescriptors?Object.defineProperties(E, Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(_) {
Object.defineProperty(E, _, Object.getOwnPropertyDescriptor(r, _));
});
} return E;
} function _defineProperty(E, _, r) {
return _ in E?Object.defineProperty(E, _, {value: r, enumerable: !0, configurable: !0, writable: !0}):E[_]=r, E;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.scorm2004_error_codes=exports.scorm12_error_codes=exports.error_codes=void 0; const error_codes={GENERAL: 101, INITIALIZATION_FAILED: 101, INITIALIZED: 101, TERMINATED: 101, TERMINATION_FAILURE: 101, TERMINATION_BEFORE_INIT: 101, MULTIPLE_TERMINATION: 101, RETRIEVE_BEFORE_INIT: 101, RETRIEVE_AFTER_TERM: 101, STORE_BEFORE_INIT: 101, STORE_AFTER_TERM: 101, COMMIT_BEFORE_INIT: 101, COMMIT_AFTER_TERM: 101, ARGUMENT_ERROR: 101, CHILDREN_ERROR: 101, COUNT_ERROR: 101, GENERAL_GET_FAILURE: 101, GENERAL_SET_FAILURE: 101, GENERAL_COMMIT_FAILURE: 101, UNDEFINED_DATA_MODEL: 101, UNIMPLEMENTED_ELEMENT: 101, VALUE_NOT_INITIALIZED: 101, INVALID_SET_VALUE: 101, READ_ONLY_ELEMENT: 101, WRITE_ONLY_ELEMENT: 101, TYPE_MISMATCH: 101, VALUE_OUT_OF_RANGE: 101, DEPENDENCY_NOT_ESTABLISHED: 101}; exports.error_codes=error_codes; const scorm12_error_codes=_objectSpread({}, error_codes, {}, {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}); exports.scorm12_error_codes=scorm12_error_codes; const scorm2004_error_codes=_objectSpread({}, error_codes, {}, {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}); exports.scorm2004_error_codes=scorm2004_error_codes;
}, {}], 11: [function(require, module, exports) {
'use strict'; function ownKeys(e, n) {
const a=Object.keys(e); if (Object.getOwnPropertySymbols) {
let i=Object.getOwnPropertySymbols(e); n&&(i=i.filter(function(n) {
return Object.getOwnPropertyDescriptor(e, n).enumerable;
})), a.push.apply(a, i);
} return a;
} function _objectSpread(e) {
for (let n=1; n<arguments.length; n++) {
var a=null!=arguments[n]?arguments[n]:{}; n%2?ownKeys(a, !0).forEach(function(n) {
_defineProperty(e, n, a[n]);
}):Object.getOwnPropertyDescriptors?Object.defineProperties(e, Object.getOwnPropertyDescriptors(a)):ownKeys(a).forEach(function(n) {
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(a, n));
});
} return e;
} function _defineProperty(e, n, a) {
return n in e?Object.defineProperty(e, n, {value: a, enumerable: !0, configurable: !0, writable: !0}):e[n]=a, e;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.scorm2004_values=exports.scorm12_values=void 0; const common_values={validResult: ['correct', 'wrong', 'unanticipated', 'neutral'], invalidResult: ['-10000', '10000', 'invalid'], valid0To1Range: ['0.0', '0.25', '0.5', '1.0'], invalid0To1Range: ['-1', '-0.1', '1.1', '.25'], valid0To100Range: ['1', '50', '100'], invalid0To100Range: ['invalid', 'a100', '-1'], validScaledRange: ['1', '0.5', '0', '-0.5', '-1'], invalidScaledRange: ['-101', '25.1', '50.5', '75', '100'], validIntegerScaledRange: ['1', '0', '-1'], invalidIntegerScaledRange: ['-101', '-0.5', '0.5', '25.1', '50.5', '75', '100']}; const scorm12_values=_objectSpread({}, common_values, {}, {validLessonStatus: ['passed', 'completed', 'failed', 'incomplete', 'browsed'], invalidLessonStatus: ['Passed', 'P', 'F', 'p', 'true', 'false', 'complete'], validExit: ['time-out', 'suspend', 'logout'], invalidExit: ['close', 'exit', 'crash'], validType: ['true-false', 'choice', 'fill-in', 'matching', 'performance', 'sequencing', 'likert', 'numeric'], invalidType: ['correct', 'wrong', 'logout'], validSpeedRange: ['1', '50', '100', '-1', '-50', '-100'], invalidSpeedRange: ['invalid', 'a100', '-101', '101', '-100000', '100000'], validScoreRange: ['1', '50.25', '100'], invalidScoreRange: ['invalid', 'a100', '-1', '101', '-100000', '100000'], invalid0To100Range: ['invalid', 'a100', '-2'], validTime: ['10:06:57', '23:59:59', '00:00:00'], invalidTime: ['47:59:59', '00:00:01.56', '06:5:13', '23:59:59.123', 'P1DT23H59M59S'], validTimestamp: ['10:06:57', '00:00:01.56', '23:59:59', '47:59:59'], invalidTimestamp: ['06:5:13', '23:59:59.123', 'P1DT23H59M59S']}); exports.scorm12_values=scorm12_values; const scorm2004_values=_objectSpread({}, common_values, {}, {validTimestamps: ['2019-06-25', '2019-06-25T23:59', '2019-06-25T23:59:59.99', '1970-01-01'], invalidTimestamps: ['2019-06-25T', '2019-06-25T23:59:59.999', '2019-06-25T25:59:59.99', '2019-13-31', '1969-12-31', '-00:00:30', '0:50:30', '23:00:30.'], validCStatus: ['completed', 'incomplete', 'not attempted', 'unknown'], invalidCStatus: ['complete', 'passed', 'failed'], validSStatus: ['passed', 'failed', 'unknown'], invalidSStatus: ['complete', 'incomplete', 'P', 'f'], validExit: ['time-out', 'suspend', 'logout', 'normal'], invalidExit: ['close', 'exit', 'crash'], validType: ['true-false', 'choice', 'fill-in', 'long-fill-in', 'matching', 'performance', 'sequencing', 'likert', 'numeric', 'other'], invalidType: ['correct', 'wrong', 'logout'], validScoreRange: ['1', '50', '100', '-10000', '-1', '10000'], invalidScoreRange: ['invalid', 'a100', '-100000', '100000'], validISO8601Durations: ['P1Y34DT23H45M15S', 'PT1M45S', 'P0S', 'PT75M'], invalidISO8601Durations: ['00:08:45', '-P1H', '1y45D', '0'], validComment: ['{lang=en-98} learner comment', '{lang=eng-98-9} learner comment', '{lang=eng-98-9fhgj}'+'x'.repeat(4e3), 'learner comment', 'learner comment}', '{lang=i-xx}', '{lang=i}', ''], invalidComment: ['{lang=i-}', '{lang=i-x}', '{lang=eng-98-9fhgj}{ learner comment', '{learner comment', '{lang=eng-98-9fhgj}'+'x'.repeat(4001), '{lang=eng-98-9fhgj}{'+'x'.repeat(3999)], validDescription: ['{lang=en-98} learner comment', '{lang=eng-98-9} learner comment', '{lang=eng-98-9fhgj}'+'x'.repeat(250), 'learner comment', 'learner comment}', '{lang=i-xx}', '{lang=i}', ''], invalidDescription: ['{lang=i-}', '{lang=i-x}', '{lang=eng-98-9fhgj}{ learner comment', '{learner comment', '{lang=eng-98-9fhgj}'+'x'.repeat(251), '{lang=eng-98-9fhgj}{'+'x'.repeat(249)], validNavRequest: ['previous', 'continue', 'exit', 'exitAll', 'abandon', 'abandonAll', 'suspendAll'], invalidNavRequest: ['close', 'quit', 'next', 'before']}); exports.scorm2004_values=scorm2004_values;
}, {}], 12: [function(require, module, exports) {
'use strict'; Object.defineProperty(exports, '__esModule', {value: !0}), exports.valid_languages=void 0; const valid_languages={aa: 'aa', ab: 'ab', ae: 'ae', af: 'af', ak: 'ak', am: 'am', an: 'an', ar: 'ar', as: 'as', av: 'av', ay: 'ay', az: 'az', ba: 'ba', be: 'be', bg: 'bg', bh: 'bh', bi: 'bi', bm: 'bm', bn: 'bn', bo: 'bo', br: 'br', bs: 'bs', ca: 'ca', ce: 'ce', ch: 'ch', co: 'co', cr: 'cr', cs: 'cs', cu: 'cu', cv: 'cv', cy: 'cy', da: 'da', de: 'de', dv: 'dv', dz: 'dz', ee: 'ee', el: 'el', en: 'en', eo: 'eo', es: 'es', et: 'et', eu: 'eu', fa: 'fa', ff: 'ff', fi: 'fi', fj: 'fj', fo: 'fo', fr: 'fr', fy: 'fy', ga: 'ga', gd: 'gd', gl: 'gl', gn: 'gn', gu: 'gu', gv: 'gv', ha: 'ha', he: 'he', hi: 'hi', ho: 'ho', hr: 'hr', ht: 'ht', hu: 'hu', hy: 'hy', hz: 'hz', ia: 'ia', id: 'id', ie: 'ie', ig: 'ig', ii: 'ii', ik: 'ik', io: 'io', is: 'is', it: 'it', iu: 'iu', ja: 'ja', jv: 'jv', ka: 'ka', kg: 'kg', ki: 'ki', kj: 'kj', kk: 'kk', kl: 'kl', km: 'km', kn: 'kn', ko: 'ko', kr: 'kr', ks: 'ks', ku: 'ku', kv: 'kv', kw: 'kw', ky: 'ky', la: 'la', lb: 'lb', lg: 'lg', li: 'li', ln: 'ln', lo: 'lo', lt: 'lt', lu: 'lu', lv: 'lv', mg: 'mg', mh: 'mh', mi: 'mi', mk: 'mk', ml: 'ml', mn: 'mn', mo: 'mo', mr: 'mr', ms: 'ms', mt: 'mt', my: 'my', na: 'na', nb: 'nb', nd: 'nd', ne: 'ne', ng: 'ng', nl: 'nl', nn: 'nn', no: 'no', nr: 'nr', nv: 'nv', ny: 'ny', oc: 'oc', oj: 'oj', om: 'om', or: 'or', os: 'os', pa: 'pa', pi: 'pi', pl: 'pl', ps: 'ps', pt: 'pt', qu: 'qu', rm: 'rm', rn: 'rn', ro: 'ro', ru: 'ru', rw: 'rw', sa: 'sa', sc: 'sc', sd: 'sd', se: 'se', sg: 'sg', sh: 'sh', si: 'si', sk: 'sk', sl: 'sl', sm: 'sm', sn: 'sn', so: 'so', sq: 'sq', sr: 'sr', ss: 'ss', st: 'st', su: 'su', sv: 'sv', sw: 'sw', ta: 'ta', te: 'te', tg: 'tg', th: 'th', ti: 'ti', tk: 'tk', tl: 'tl', tn: 'tn', to: 'to', tr: 'tr', ts: 'ts', tt: 'tt', tw: 'tw', ty: 'ty', ug: 'ug', uk: 'uk', ur: 'ur', uz: 'uz', ve: 've', vi: 'vi', vo: 'vo', wa: 'wa', wo: 'wo', xh: 'xh', yi: 'yi', yo: 'yo', za: 'za', zh: 'zh', zu: 'zu', aar: 'aar', abk: 'abk', ave: 'ave', afr: 'afr', aka: 'aka', amh: 'amh', arg: 'arg', ara: 'ara', asm: 'asm', ava: 'ava', aym: 'aym', aze: 'aze', bak: 'bak', bel: 'bel', bul: 'bul', bih: 'bih', bis: 'bis', bam: 'bam', ben: 'ben', tib: 'tib', bod: 'bod', bre: 'bre', bos: 'bos', cat: 'cat', che: 'che', cha: 'cha', cos: 'cos', cre: 'cre', cze: 'cze', ces: 'ces', chu: 'chu', chv: 'chv', wel: 'wel', cym: 'cym', dan: 'dan', ger: 'ger', deu: 'deu', div: 'div', dzo: 'dzo', ewe: 'ewe', gre: 'gre', ell: 'ell', eng: 'eng', epo: 'epo', spa: 'spa', est: 'est', baq: 'baq', eus: 'eus', per: 'per', fas: 'fas', ful: 'ful', fin: 'fin', fij: 'fij', fao: 'fao', fre: 'fre', fra: 'fra', fry: 'fry', gle: 'gle', gla: 'gla', glg: 'glg', grn: 'grn', guj: 'guj', glv: 'glv', hau: 'hau', heb: 'heb', hin: 'hin', hmo: 'hmo', hrv: 'hrv', hat: 'hat', hun: 'hun', arm: 'arm', hye: 'hye', her: 'her', ina: 'ina', ind: 'ind', ile: 'ile', ibo: 'ibo', iii: 'iii', ipk: 'ipk', ido: 'ido', ice: 'ice', isl: 'isl', ita: 'ita', iku: 'iku', jpn: 'jpn', jav: 'jav', geo: 'geo', kat: 'kat', kon: 'kon', kik: 'kik', kua: 'kua', kaz: 'kaz', kal: 'kal', khm: 'khm', kan: 'kan', kor: 'kor', kau: 'kau', kas: 'kas', kur: 'kur', kom: 'kom', cor: 'cor', kir: 'kir', lat: 'lat', ltz: 'ltz', lug: 'lug', lim: 'lim', lin: 'lin', lao: 'lao', lit: 'lit', lub: 'lub', lav: 'lav', mlg: 'mlg', mah: 'mah', mao: 'mao', mri: 'mri', mac: 'mac', mkd: 'mkd', mal: 'mal', mon: 'mon', mol: 'mol', mar: 'mar', may: 'may', msa: 'msa', mlt: 'mlt', bur: 'bur', mya: 'mya', nau: 'nau', nob: 'nob', nde: 'nde', nep: 'nep', ndo: 'ndo', dut: 'dut', nld: 'nld', nno: 'nno', nor: 'nor', nbl: 'nbl', nav: 'nav', nya: 'nya', oci: 'oci', oji: 'oji', orm: 'orm', ori: 'ori', oss: 'oss', pan: 'pan', pli: 'pli', pol: 'pol', pus: 'pus', por: 'por', que: 'que', roh: 'roh', run: 'run', rum: 'rum', ron: 'ron', rus: 'rus', kin: 'kin', san: 'san', srd: 'srd', snd: 'snd', sme: 'sme', sag: 'sag', slo: 'slo', sin: 'sin', slk: 'slk', slv: 'slv', smo: 'smo', sna: 'sna', som: 'som', alb: 'alb', sqi: 'sqi', srp: 'srp', ssw: 'ssw', sot: 'sot', sun: 'sun', swe: 'swe', swa: 'swa', tam: 'tam', tel: 'tel', tgk: 'tgk', tha: 'tha', tir: 'tir', tuk: 'tuk', tgl: 'tgl', tsn: 'tsn', ton: 'ton', tur: 'tur', tso: 'tso', tat: 'tat', twi: 'twi', tah: 'tah', uig: 'uig', ukr: 'ukr', urd: 'urd', uzb: 'uzb', ven: 'ven', vie: 'vie', vol: 'vol', wln: 'wln', wol: 'wol', xho: 'xho', yid: 'yid', yor: 'yor', zha: 'zha', chi: 'chi', zho: 'zho', zul: 'zul'}; exports.valid_languages=valid_languages;
}, {}], 13: [function(require, module, exports) {
'use strict'; function ownKeys(e, r) {
const t=Object.keys(e); if (Object.getOwnPropertySymbols) {
let a=Object.getOwnPropertySymbols(e); r&&(a=a.filter(function(r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, a);
} return t;
} function _objectSpread(e) {
for (let r=1; r<arguments.length; r++) {
var t=null!=arguments[r]?arguments[r]:{}; r%2?ownKeys(t, !0).forEach(function(r) {
_defineProperty(e, r, t[r]);
}):Object.getOwnPropertyDescriptors?Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)):ownKeys(t).forEach(function(r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
} return e;
} function _defineProperty(e, r, t) {
return r in e?Object.defineProperty(e, r, {value: t, enumerable: !0, configurable: !0, writable: !0}):e[r]=t, e;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.scorm2004_regex=exports.aicc_regex=exports.scorm12_regex=void 0; const _field_values=require('./field_values'); const scorm12_regex={CMIString256: '^.{0,255}$', CMIString4096: '^.{0,4096}$', CMITime: '^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)$', CMITimespan: '^([0-9]{2,}):([0-9]{2}):([0-9]{2})(.[0-9]{1,2})?$', CMIInteger: '^\\d+$', CMISInteger: '^-?([0-9]+)$', CMIDecimal: '^-?([0-9]{0,3})(.[0-9]*)?$', CMIIdentifier: '^[\\u0021-\\u007E]{0,255}$', CMIFeedback: '^.{0,255}$', CMIIndex: '[._](\\d+).', CMIStatus: '^('+_field_values.scorm12_values.validLessonStatus.join('|')+')$', CMIStatus2: '^('+_field_values.scorm12_values.validLessonStatus.join('|')+'|not attempted)$', CMIExit: '^('+_field_values.scorm12_values.validExit.join('|')+'|)$', CMIType: '^('+_field_values.scorm12_values.validType.join('|')+')$', CMIResult: '^('+_field_values.scorm12_values.validResult.join('|')+'|([0-9]{0,3})?(\\.[0-9]*)?)$', NAVEvent: '^(previous|continue)$', score_range: '0#100', audio_range: '-1#100', speed_range: '-100#100', weighting_range: '-100#100', text_range: '-1#1'}; exports.scorm12_regex=scorm12_regex; const aicc_regex=_objectSpread({}, scorm12_regex, {}, {CMIIdentifier: '^\\w{1,255}$'}); exports.aicc_regex=aicc_regex; const scorm2004_regex={CMIString200: '^[\\u0000-\\uFFFF]{0,200}$', CMIString250: '^[\\u0000-\\uFFFF]{0,250}$', CMIString1000: '^[\\u0000-\\uFFFF]{0,1000}$', CMIString4000: '^[\\u0000-\\uFFFF]{0,4000}$', CMIString64000: '^[\\u0000-\\uFFFF]{0,64000}$', CMILang: '^([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$', CMILangString250: '^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$', CMILangcr: '^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$', CMILangString250cr: '^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$', CMILangString4000: '^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$', 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})?)?)?)?)?)?)?)?$', CMITimespan: '^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?)?$', CMIInteger: '^\\d+$', CMISInteger: '^-?([0-9]+)$', CMIDecimal: '^-?([0-9]{1,5})(\\.[0-9]{1,18})?$', CMIIdentifier: '^\\S{1,250}[a-zA-Z0-9]$', CMIShortIdentifier: '^[\\w.]{1,250}$', CMILongIdentifier: '^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000})$', CMIFeedback: '^.*$', CMIIndex: '[._](\\d+).', CMIIndexStore: '.N(\\d+).', CMICStatus: '^('+_field_values.scorm2004_values.validCStatus.join('|')+')$', CMISStatus: '^('+_field_values.scorm2004_values.validSStatus.join('|')+')$', CMIExit: '^('+_field_values.scorm2004_values.validExit.join('|')+')$', CMIType: '^('+_field_values.scorm2004_values.validType.join('|')+')$', CMIResult: '^('+_field_values.scorm2004_values.validResult.join('|')+'|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$', NAVEvent: '^('+_field_values.scorm2004_values.validNavRequest.join('|')+'|{target=\\S{0,200}[a-zA-Z0-9]}choice|jump)$', NAVBoolean: '^(unknown|true|false$)', NAVTarget: '^(previous|continue|choice.{target=\\S{0,200}[a-zA-Z0-9]})$', scaled_range: '-1#1', audio_range: '0#*', speed_range: '0#*', text_range: '-1#1', progress_range: '0#1'}; exports.scorm2004_regex=scorm2004_regex;
}, {'./field_values': 11}], 14: [function(require, module, exports) {
'use strict'; Object.defineProperty(exports, '__esModule', {value: !0}), exports.correct_responses=exports.learner_responses=void 0; const _regex=require('./regex'); const learner_responses={'true-false': {format: '^true$|^false$', max: 1, delimiter: '', unique: !1}, 'choice': {format: _regex.scorm2004_regex.CMIShortIdentifier, max: 36, delimiter: '[,]', unique: !0}, 'fill-in': {format: _regex.scorm2004_regex.CMILangString250, max: 10, delimiter: '[,]', unique: !1}, 'long-fill-in': {format: _regex.scorm2004_regex.CMILangString4000, max: 1, delimiter: '', unique: !1}, 'matching': {format: _regex.scorm2004_regex.CMIShortIdentifier, format2: _regex.scorm2004_regex.CMIShortIdentifier, max: 36, delimiter: '[,]', delimiter2: '[.]', unique: !1}, 'performance': {format: '^$|'+_regex.scorm2004_regex.CMIShortIdentifier, format2: _regex.scorm2004_regex.CMIDecimal+'|^$|'+_regex.scorm2004_regex.CMIShortIdentifier, max: 250, delimiter: '[,]', delimiter2: '[.]', unique: !1}, 'sequencing': {format: _regex.scorm2004_regex.CMIShortIdentifier, max: 36, delimiter: '[,]', unique: !1}, 'likert': {format: _regex.scorm2004_regex.CMIShortIdentifier, max: 1, delimiter: '', unique: !1}, 'numeric': {format: _regex.scorm2004_regex.CMIDecimal, max: 1, delimiter: '', unique: !1}, 'other': {format: _regex.scorm2004_regex.CMIString4000, max: 1, delimiter: '', unique: !1}}; exports.learner_responses=learner_responses; const correct_responses={'true-false': {max: 1, delimiter: '', unique: !1, duplicate: !1, format: '^true$|^false$', limit: 1}, 'choice': {max: 36, delimiter: '[,]', unique: !0, duplicate: !1, format: _regex.scorm2004_regex.CMIShortIdentifier}, 'fill-in': {max: 10, delimiter: '[,]', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMILangString250cr}, 'long-fill-in': {max: 1, delimiter: '', unique: !1, duplicate: !0, format: _regex.scorm2004_regex.CMILangString4000}, 'matching': {max: 36, delimiter: '[,]', delimiter2: '[.]', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMIShortIdentifier, format2: _regex.scorm2004_regex.CMIShortIdentifier}, 'performance': {max: 250, delimiter: '[,]', delimiter2: '[.]', unique: !1, duplicate: !1, format: '^$|'+_regex.scorm2004_regex.CMIShortIdentifier, format2: _regex.scorm2004_regex.CMIDecimal+'|^$|'+_regex.scorm2004_regex.CMIShortIdentifier}, 'sequencing': {max: 36, delimiter: '[,]', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMIShortIdentifier}, 'likert': {max: 1, delimiter: '', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMIShortIdentifier, limit: 1}, 'numeric': {max: 2, delimiter: '[:]', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMIDecimal, limit: 1}, 'other': {max: 1, delimiter: '', unique: !1, duplicate: !1, format: _regex.scorm2004_regex.CMIString4000, limit: 1}}; exports.correct_responses=correct_responses;
}, {'./regex': 13}], 15: [function(require, module, exports) {
'use strict'; function _typeof(t) {
return (_typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t) {
return typeof t;
}:function(t) {
return t&&'function'==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?'symbol':typeof t;
})(t);
} function _classCallCheck(t, e) {
if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function');
} function _defineProperties(t, e) {
for (let r=0; r<e.length; r++) {
const o=e[r]; o.enumerable=o.enumerable||!1, o.configurable=!0, 'value'in o&&(o.writable=!0), Object.defineProperty(t, o.key, o);
}
} function _createClass(t, e, r) {
return e&&_defineProperties(t.prototype, e), r&&_defineProperties(t, r), t;
} function _possibleConstructorReturn(t, e) {
return !e||'object'!==_typeof(e)&&'function'!=typeof e?_assertThisInitialized(t):e;
} function _assertThisInitialized(t) {
if (void 0===t) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); return t;
} function _inherits(t, e) {
if ('function'!=typeof e&&null!==e) throw new TypeError('Super expression must either be null or a function'); t.prototype=Object.create(e&&e.prototype, {constructor: {value: t, writable: !0, configurable: !0}}), e&&_setPrototypeOf(t, e);
} function _wrapNativeSuper(t) {
const e='function'==typeof Map?new Map:void 0; return (_wrapNativeSuper=function(t) {
function r() {
return _construct(t, arguments, _getPrototypeOf(this).constructor);
} if (null===t||!_isNativeFunction(t)) return t; if ('function'!=typeof t) throw new TypeError('Super expression must either be null or a function'); if (void 0!==e) {
if (e.has(t)) return e.get(t); e.set(t, r);
} return r.prototype=Object.create(t.prototype, {constructor: {value: r, enumerable: !1, writable: !0, configurable: !0}}), _setPrototypeOf(r, t);
})(t);
} function isNativeReflectConstruct() {
if ('undefined'==typeof Reflect||!Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ('function'==typeof Proxy) return !0; try {
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0;
} catch (t) {
return !1;
}
} function _construct(t, e, r) {
return _construct=isNativeReflectConstruct()?Reflect.construct:function(t, e, r) {
const o=[null]; o.push.apply(o, e); const n=Function.bind.apply(t, o); const i=new n; return r&&_setPrototypeOf(i, r.prototype), i;
}, _construct.apply(null, arguments);
} function _isNativeFunction(t) {
return -1!==Function.toString.call(t).indexOf('[native code]');
} function _setPrototypeOf(t, e) {
return (_setPrototypeOf=Object.setPrototypeOf||function(t, e) {
return t.__proto__=e, t;
})(t, e);
} function _getPrototypeOf(t) {
return (_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t) {
return t.__proto__||Object.getPrototypeOf(t);
})(t);
} function _classPrivateFieldGet(t, e) {
const r=e.get(t); if (!r) throw new TypeError('attempted to get private field on non-instance'); return r.get?r.get.call(t):r.value;
} function _classPrivateFieldSet(t, e, r) {
const o=e.get(t); if (!o) throw new TypeError('attempted to set private field on non-instance'); if (o.set)o.set.call(t, r); else {
if (!o.writable) throw new TypeError('attempted to set read only private field'); o.value=r;
} return r;
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.ValidationError=void 0; const ValidationError=function(t) {
function e(t) {
let r; return _classCallCheck(this, e), r=_possibleConstructorReturn(this, _getPrototypeOf(e).call(this, t)), _errorCode.set(_assertThisInitialized(r), {writable: !0, value: void 0}), _classPrivateFieldSet(_assertThisInitialized(r), _errorCode, t), r;
} return _inherits(e, t), _createClass(e, [{key: 'errorCode', get: function() {
return _classPrivateFieldGet(this, _errorCode);
}}, {key: 'message', get: function() {
return _classPrivateFieldGet(this, _errorCode)+'';
}}]), e;
}(_wrapNativeSuper(Error)); exports.ValidationError=ValidationError; var _errorCode=new WeakMap;
}, {}], 16: [function(require, module, exports) {
'use strict'; function _slicedToArray(e, t) {
return _arrayWithHoles(e)||_iterableToArrayLimit(e, t)||_nonIterableRest();
} function _nonIterableRest() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
} function _iterableToArrayLimit(e, t) {
if (Symbol.iterator in Object(e)||'[object Arguments]'===Object.prototype.toString.call(e)) {
const r=[]; let n=!0; let o=!1; let S=void 0; try {
for (var s, i=e[Symbol.iterator](); !(n=(s=i.next()).done)&&(r.push(s.value), !t||r.length!==t); n=!0);
} catch (e) {
o=!0, S=e;
} finally {
try {
n||null==i.return||i.return();
} finally {
if (o) throw S;
}
} return r;
}
} function _arrayWithHoles(e) {
if (Array.isArray(e)) return e;
} function getSecondsAsHHMMSS(e) {
if (!e||e<=0) return '00:00:00'; const t=Math.floor(e/SECONDS_PER_HOUR); const r=new Date(1e3*e); const n=r.getUTCMinutes(); const o=r.getSeconds()+e%1; return t.toString().padStart(2, '0')+':'+n.toString().padStart(2, '0')+':'+o.toString().padStart(2, '0');
} function getSecondsAsISODuration(e) {
if (!e||e<=0) return 'P0S'; let t='P'; let r=e; return designations.forEach(function(e) {
const n=_slicedToArray(e, 2); const o=n[0]; const S=n[1]; let s=Math.floor(r/S); r%=S, 'S'===o&&r>0&&(s+=r), s&&(t+=''.concat(s).concat(o));
}), t;
} function getTimeAsSeconds(e, t) {
if (!e||'string'!=typeof e||!e.match(t)) return 0; const r=e.split(':'); return 3600*Number(r[0])+60*Number(r[1])+Number(r[2]);
} function getDurationAsSeconds(e, t) {
if (!e||!e.match(t)) return 0; const r=new RegExp(t).exec(e)||[]; const n=_slicedToArray(r, 8); const o=n[1]; const S=n[2]; const s=n[4]; const i=n[5]; const a=n[6]; const u=n[7]; const E=new Date; const _=new Date(E); if (_.setFullYear(_.getFullYear()+Number(o||0)), _.setMonth(_.getMonth()+Number(S||0)), _.setDate(_.getDate()+Number(s||0)), _.setHours(_.getHours()+Number(i||0)), _.setMinutes(_.getMinutes()+Number(a||0)), _.setSeconds(_.getSeconds()+Number(u||0)), u&&String(u).indexOf('.')>0) {
const c=1e3*Number(Number(u)%1).toFixed(6); _.setMilliseconds(_.getMilliseconds()+c);
} return (1*_-E)/1e3;
} function addTwoDurations(e, t, r) {
return getSecondsAsISODuration(getDurationAsSeconds(e, r)+getDurationAsSeconds(t, r));
} function addHHMMSSTimeStrings(e, t, r) {
return getSecondsAsHHMMSS(getTimeAsSeconds(e, r)+getTimeAsSeconds(t, r));
}Object.defineProperty(exports, '__esModule', {value: !0}), exports.getSecondsAsHHMMSS=getSecondsAsHHMMSS, exports.getSecondsAsISODuration=getSecondsAsISODuration, exports.getTimeAsSeconds=getTimeAsSeconds, exports.getDurationAsSeconds=getDurationAsSeconds, exports.addTwoDurations=addTwoDurations, exports.addHHMMSSTimeStrings=addHHMMSSTimeStrings, exports.SECONDS_PER_DAY=exports.SECONDS_PER_HOUR=exports.SECONDS_PER_MINUTE=exports.SECONDS_PER_SECOND=void 0; const SECONDS_PER_SECOND=1; exports.SECONDS_PER_SECOND=SECONDS_PER_SECOND; const SECONDS_PER_MINUTE=60; exports.SECONDS_PER_MINUTE=SECONDS_PER_MINUTE; var SECONDS_PER_HOUR=60*SECONDS_PER_MINUTE; exports.SECONDS_PER_HOUR=SECONDS_PER_HOUR; const SECONDS_PER_DAY=24*SECONDS_PER_HOUR; exports.SECONDS_PER_DAY=SECONDS_PER_DAY; var designations=[['D', SECONDS_PER_DAY], ['H', SECONDS_PER_HOUR], ['M', SECONDS_PER_MINUTE], ['S', SECONDS_PER_SECOND]];
}, {}]}, {}, [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 3, 4, 16]);
// # sourceMappingURL=scorm-again.js.map