UNPKG

scorm-again

Version:

A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004

1 lines 91.6 kB
!function(){"use strict";var e={429:function(e,t,r){r.r(t),r.d(t,{default:function(){return d}});var n=r(635),i=r(589),o=r(784),s=r(340),a=r(864),c=r(56),l={autocommit:!1,autocommitSeconds:10,asyncCommit:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:c.LogLevelEnum.ERROR,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",responseHandler:function(e){return(0,n.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return void 0===e?[3,2]:[4,e.text()];case 1:return t=n.sent(),r=null,t&&(r=JSON.parse(t)),null!==r&&{}.hasOwnProperty.call(r,"result")?[2,{result:r.result,errorCode:r.errorCode?r.errorCode:r.result===s.global_constants.SCORM_TRUE?0:101}]:200===e.status?[2,{result:s.global_constants.SCORM_TRUE,errorCode:0}]:[2,{result:s.global_constants.SCORM_FALSE,errorCode:101}];case 2:return[2,{result:s.global_constants.SCORM_FALSE,errorCode:101}]}}))}))},requestHandler:function(e){return e},onLogMessage:function(e,t){switch(e){case"4":case 4:case"ERROR":case c.LogLevelEnum.ERROR:console.error(t);break;case"3":case 3:case"WARN":case c.LogLevelEnum.WARN:console.warn(t);break;case"2":case 2:case"INFO":case c.LogLevelEnum.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case c.LogLevelEnum.DEBUG:console.debug?console.debug(t):console.log(t)}},scoItemIds:[],scoItemIdValidator:!1,globalObjectiveIds:[]},u=function(){function e(e,t,r){this._cancelled=!1,this._API=e,this._timeout=setTimeout(this.wrapper.bind(this),t),this._callback=r}return e.prototype.cancel=function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)},e.prototype.wrapper=function(){this._cancelled||(0,n.__awaiter)(this,void 0,void 0,(function(){return(0,n.__generator)(this,(function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback)];case 1:return[2,e.sent()]}}))}))},e}(),_=function(){function e(t,r){var i,o,a=this.constructor;if(this._settings=l,a===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=s.global_constants.STATE_NOT_INITIALIZED,this.lastErrorCode="0",this.listenerArray=[],this._error_codes=t,r&&(this.settings=(0,n.__assign)((0,n.__assign)({},l),r)),this.apiLogLevel=null!==(i=this.settings.logLevel)&&void 0!==i?i:c.LogLevelEnum.ERROR,this.selfReportSessionTime=null!==(o=this.settings.selfReportSessionTime)&&void 0!==o&&o}return e.prototype.commonReset=function(e){this.apiLog("reset","Called",c.LogLevelEnum.INFO),this.settings=(0,n.__assign)((0,n.__assign)({},this.settings),e),this.clearScheduledCommit(),this.currentState=s.global_constants.STATE_NOT_INITIALIZED,this.lastErrorCode="0",this.listenerArray=[],this.startingData={}},e.prototype.initialize=function(e,t,r){var n=s.global_constants.SCORM_FALSE;return this.isInitialized()?this.throwSCORMError(this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError(this._error_codes.TERMINATED,r):(this.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=s.global_constants.STATE_INITIALIZED,this.lastErrorCode="0",n=s.global_constants.SCORM_TRUE,this.processListeners(e)),this.apiLog(e,"returned: "+n,c.LogLevelEnum.INFO),this.clearSCORMError(n),n},e.prototype.apiLog=function(e,t,r,n){t=(0,a.formatMessage)(e,t,n),r>=this.apiLogLevel&&this.settings.onLogMessage(r,t)},Object.defineProperty(e.prototype,"error_codes",{get:function(){return this._error_codes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"settings",{get:function(){return this._settings},set:function(e){this._settings=(0,n.__assign)((0,n.__assign)({},this._settings),e)},enumerable:!1,configurable:!0}),e.prototype.terminate=function(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function(){var r,i;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return r=s.global_constants.SCORM_FALSE,this.checkState(t,this._error_codes.TERMINATION_BEFORE_INIT,this._error_codes.MULTIPLE_TERMINATION)?(this.currentState=s.global_constants.STATE_TERMINATED,[4,this.storeData(!0)]):[3,2];case 1:void 0!==(i=n.sent()).errorCode&&i.errorCode>0&&this.throwSCORMError(i.errorCode),r=void 0===i||!0!==i.result&&i.result!==s.global_constants.SCORM_TRUE?s.global_constants.SCORM_FALSE:s.global_constants.SCORM_TRUE,t&&(this.lastErrorCode="0"),r=s.global_constants.SCORM_TRUE,this.processListeners(e),n.label=2;case 2:return this.apiLog(e,"returned: "+r,c.LogLevelEnum.INFO),this.clearSCORMError(r),[2,r]}}))}))},e.prototype.getValue=function(e,t,r){var n="";if(this.checkState(t,this._error_codes.RETRIEVE_BEFORE_INIT,this._error_codes.RETRIEVE_AFTER_TERM)){t&&(this.lastErrorCode="0");try{n=this.getCMIValue(r)}catch(e){n=this.handleValueAccessException(e,n)}this.processListeners(e,r)}return this.apiLog(e,": returned: "+n,c.LogLevelEnum.INFO,r),void 0===n?"":(this.clearSCORMError(n),n)},e.prototype.setValue=function(e,t,r,n,i){void 0!==i&&(i=String(i));var o=s.global_constants.SCORM_FALSE;if(this.checkState(r,this._error_codes.STORE_BEFORE_INIT,this._error_codes.STORE_AFTER_TERM)){r&&(this.lastErrorCode="0");try{o=this.setCMIValue(n,i)}catch(e){this.handleValueAccessException(e,o)}this.processListeners(e,n,i)}return void 0===o&&(o=s.global_constants.SCORM_FALSE),"0"===String(this.lastErrorCode)&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+i+": result: "+o,c.LogLevelEnum.INFO,n),this.clearSCORMError(o),o},e.prototype.commit=function(e){return(0,n.__awaiter)(this,arguments,void 0,(function(e,t){var r,i;return void 0===t&&(t=!1),(0,n.__generator)(this,(function(n){switch(n.label){case 0:return this.clearScheduledCommit(),r=s.global_constants.SCORM_FALSE,this.checkState(t,this._error_codes.COMMIT_BEFORE_INIT,this._error_codes.COMMIT_AFTER_TERM)?[4,this.storeData(!1)]:[3,2];case 1:(i=n.sent()).errorCode&&i.errorCode>0&&this.throwSCORMError(i.errorCode),r=void 0===i||!0!==i.result&&i.result!==s.global_constants.SCORM_TRUE?s.global_constants.SCORM_FALSE:s.global_constants.SCORM_TRUE,this.apiLog(e," Result: "+r,c.LogLevelEnum.DEBUG,"HttpRequest"),t&&(this.lastErrorCode="0"),this.processListeners(e),n.label=2;case 2:return this.apiLog(e,"returned: "+r,c.LogLevelEnum.INFO),this.clearSCORMError(r),[2,r]}}))}))},e.prototype.getLastError=function(e){var t=String(this.lastErrorCode);return this.processListeners(e),this.apiLog(e,"returned: "+t,c.LogLevelEnum.INFO),t},e.prototype.getErrorString=function(e,t){var r="";return null!==t&&""!==t&&(r=this.getLmsErrorMessageDetails(t),this.processListeners(e)),this.apiLog(e,"returned: "+r,c.LogLevelEnum.INFO),r},e.prototype.getDiagnostic=function(e,t){var r="";return null!==t&&""!==t&&(r=this.getLmsErrorMessageDetails(t,!0),this.processListeners(e)),this.apiLog(e,"returned: "+r,c.LogLevelEnum.INFO),r},e.prototype.checkState=function(e,t,r){return this.isNotInitialized()?(this.throwSCORMError(t),!1):!e||!this.isTerminated()||(this.throwSCORMError(r),!1)},e.prototype.getLmsErrorMessageDetails=function(e,t){throw void 0===t&&(t=!1),new Error("The getLmsErrorMessageDetails method has not been implemented")},e.prototype.getCMIValue=function(e){throw new Error("The getCMIValue method has not been implemented")},e.prototype.setCMIValue=function(e,t){throw new Error("The setCMIValue method has not been implemented")},e.prototype._commonSetCMIValue=function(e,t,r,o){if(!r||""===r)return s.global_constants.SCORM_FALSE;for(var l=r.split("."),u=this,_=s.global_constants.SCORM_FALSE,d=!1,h="The data model element passed to ".concat(e," (").concat(r,") is not a valid SCORM data model element."),f=t?this._error_codes.UNDEFINED_DATA_MODEL:this._error_codes.GENERAL,m=0;m<l.length;m++){var p=l[m];if(!p)return this.throwSCORMError(f,h),s.global_constants.SCORM_FALSE;if(m===l.length-1)t&&"{target="===p.substring(0,8)?this.isInitialized()?this.throwSCORMError(this._error_codes.READ_ONLY_ELEMENT):u=(0,n.__assign)((0,n.__assign)({},u),{attribute:o}):this._checkObjectHasProperty(u,p)?((0,a.stringMatches)(r,"\\.correct_responses\\.\\d+")&&this.isInitialized()&&this.validateCorrectResponse(r,o),t&&"0"!==this.lastErrorCode||(u[p]=o,_=s.global_constants.SCORM_TRUE)):this.throwSCORMError(f,h);else{if(!(u=u[p])){this.throwSCORMError(f,h);break}if(u instanceof i.CMIArray){var g=parseInt(l[m+1]||"0",10);if(!isNaN(g)){var E=u.childArray[g];if(E)u=E,d=!0;else{var y=this.getChildElement(r,o,d);d=!0,y?(u.initialized&&y.initialize(),u.childArray.push(y),u=y):this.throwSCORMError(f,h)}m++}}}}return _===s.global_constants.SCORM_FALSE&&this.apiLog(e,"There was an error setting the value for: ".concat(r,", value of: ").concat(o),c.LogLevelEnum.WARN),_},e.prototype._commonGetCMIValue=function(e,t,r){if(!r||""===r)return"";for(var n=r.split("."),o=this,s=null,a="The data model element passed to ".concat(e," (").concat(r,") has not been initialized."),c="The data model element passed to ".concat(e," (").concat(r,") is not a valid SCORM data model element."),l=t?this._error_codes.UNDEFINED_DATA_MODEL:this._error_codes.GENERAL,u=0;u<n.length;u++){if(!(s=n[u]))return void this.throwSCORMError(l,c);if(t){if("{target="===String(s).substring(0,8)&&"function"==typeof o._isTargetValid){var _=String(s).substring(8,String(s).length-9);return o._isTargetValid(_)}if(!this._checkObjectHasProperty(o,s))return void this.throwSCORMError(l,c)}else if(u===n.length-1&&!this._checkObjectHasProperty(o,s))return void this.throwSCORMError(l,c);if(void 0===(o=o[s])){this.throwSCORMError(l,c);break}if(o instanceof i.CMIArray){var d=parseInt(n[u+1]||"",10);if(!isNaN(d)){var h=o.childArray[d];if(!h){this.throwSCORMError(this._error_codes.VALUE_NOT_INITIALIZED,a);break}o=h,u++}}}if(null!=o)return o;t||("_children"===s?this.throwSCORMError(this._error_codes.CHILDREN_ERROR):"_count"===s&&this.throwSCORMError(this._error_codes.COUNT_ERROR))},e.prototype.isInitialized=function(){return this.currentState===s.global_constants.STATE_INITIALIZED},e.prototype.isNotInitialized=function(){return this.currentState===s.global_constants.STATE_NOT_INITIALIZED},e.prototype.isTerminated=function(){return this.currentState===s.global_constants.STATE_TERMINATED},e.prototype.on=function(e,t){var r,n;if(t)for(var i=e.split(" "),o=0;o<i.length;o++){var s=null===(r=i[o])||void 0===r?void 0:r.split(".");if(!s||0===s.length)return;var a=s[0],l=null;s.length>1&&(l=null===(n=i[o])||void 0===n?void 0:n.replace(a+".","")),this.listenerArray.push({functionName:a,CMIElement:l,callback:t}),this.apiLog("on","Added event listener: ".concat(this.listenerArray.length),c.LogLevelEnum.INFO,a)}},e.prototype.off=function(e,t){var r,n;if(t)for(var i=e.split(" "),o=function(e){var o=null===(r=i[e])||void 0===r?void 0:r.split(".");if(!o||0===o.length)return{value:void 0};var a=o[0],l=null;o.length>1&&(l=null===(n=i[e])||void 0===n?void 0:n.replace(a+".",""));var u=s.listenerArray.findIndex((function(e){return e.functionName===a&&e.CMIElement===l&&e.callback===t}));-1!==u&&(s.listenerArray.splice(u,1),s.apiLog("off","Removed event listener: ".concat(s.listenerArray.length),c.LogLevelEnum.INFO,a))},s=this,a=0;a<i.length;a++){var l=o(a);if("object"==typeof l)return l.value}},e.prototype.clear=function(e){for(var t,r,n=e.split(" "),i=function(e){var i=null===(t=n[e])||void 0===t?void 0:t.split(".");if(!i||0===(null==i?void 0:i.length))return{value:void 0};var s=i[0],a=null;i.length>1&&(a=null===(r=n[e])||void 0===r?void 0:r.replace(s+".","")),o.listenerArray=o.listenerArray.filter((function(e){return e.functionName!==s&&e.CMIElement!==a}))},o=this,s=0;s<n.length;s++){var a=i(s);if("object"==typeof a)return a.value}},e.prototype.processListeners=function(e,t,r){this.apiLog(e,r,c.LogLevelEnum.INFO,t);for(var n=0;n<this.listenerArray.length;n++){var i,o=this.listenerArray[n],s=o.functionName===e,a=!!o.CMIElement;i=t&&o.CMIElement&&"*"===o.CMIElement.substring(o.CMIElement.length-1)?0===t.indexOf(o.CMIElement.substring(0,o.CMIElement.length-1)):o.CMIElement===t,!s||a&&!i||(this.apiLog("processListeners","Processing listener: ".concat(o.functionName),c.LogLevelEnum.INFO,t),o.callback(t,r))}},e.prototype.throwSCORMError=function(e,t){t||(t=this.getLmsErrorMessageDetails(e)),this.apiLog("throwSCORMError",e+": "+t,c.LogLevelEnum.ERROR),this.lastErrorCode=String(e)},e.prototype.clearSCORMError=function(e){void 0!==e&&e!==s.global_constants.SCORM_FALSE&&(this.lastErrorCode="0")},e.prototype.loadFromFlattenedJSON=function(e,t){var r=this;if(t||(t=""),this.isNotInitialized()){var n,i=/^(cmi\.interactions\.)(\d+)\.(.*)$/,o=/^(cmi\.objectives\.)(\d+)\.(.*)$/,s=Object.keys(e).map((function(t){return[String(t),e[t]]}));s.sort((function(e,t){var r,n=e[0],s=(e[1],t[0]);return t[1],null!==(r=c(n,s,i))||null!==(r=c(n,s,o))?r:n<s?-1:n>s?1:0})),s.forEach((function(e){(n={})[e[0]]=e[1],r.loadFromJSON((0,a.unflatten)(n),t)}))}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.");function c(e,t,r){var n,i=e.match(r);if(null!==i&&null!==(n=t.match(r))){var o=Number(i[2]),s=Number(n[2]);return o===s?"id"===i[3]?-1:"type"===i[3]?"id"===n[3]?1:-1:1:o-s}return null}},e.prototype.loadFromJSON=function(e,t){if(void 0===t&&(t=""),t&&""!==t||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(t="cmi"),this.isNotInitialized()){for(var r in t=void 0!==t?t:"cmi",this.startingData=e,e)if({}.hasOwnProperty.call(e,r)&&e[r]){var n=(t?t+".":"")+r,i=e[r];if(i.childArray)for(var o=0;o<i.childArray.length;o++)this.loadFromJSON(i.childArray[o],n+"."+o);else i.constructor===Object?this.loadFromJSON(i,n):this.setCMIValue(n,i)}}else console.error("loadFromJSON can only be called before the call to lmsInitialize.")},e.prototype.renderCMIToJSONString=function(){var e=this.cmi;return this.settings.sendFullCommit?JSON.stringify({cmi:e}):JSON.stringify({cmi:e},(function(e,t){return void 0===t?null:t}),2)},e.prototype.renderCMIToJSONObject=function(){return JSON.parse(this.renderCMIToJSONString())},e.prototype.processHttpRequest=function(e,t){return(0,n.__awaiter)(this,arguments,void 0,(function(e,t,r){var i,o,a,l=this;return void 0===r&&(r=!1),(0,n.__generator)(this,(function(u){switch(u.label){case 0:return i=this,o={result:s.global_constants.SCORM_FALSE,errorCode:this.error_codes.GENERAL},r?(t=this.settings.requestHandler(t),this.performFetch(e,t).then((function(e){return(0,n.__awaiter)(l,void 0,void 0,(function(){return(0,n.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.transformResponse(e)];case 1:return t.sent(),[2]}}))}))})),[2,{result:s.global_constants.SCORM_TRUE,errorCode:0}]):(a=function(e,t,r){return(0,n.__awaiter)(l,void 0,void 0,(function(){var s,a,l;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=r.requestHandler(t),[4,this.performFetch(e,t)];case 1:return s=n.sent(),[2,this.transformResponse(s)];case 2:return a=n.sent(),l=a instanceof Error?a.message:String(a),this.apiLog("processHttpRequest",l,c.LogLevelEnum.ERROR),i.processListeners("CommitError"),[2,o];case 3:return[2]}}))}))},[4,a(e,t,this.settings)]);case 1:return[2,u.sent()]}}))}))},e.prototype.scheduleCommit=function(e,t){this._timeout||(this._timeout=new u(this,e,t),this.apiLog("scheduleCommit","scheduled",c.LogLevelEnum.DEBUG,""))},e.prototype.clearScheduledCommit=function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",c.LogLevelEnum.DEBUG,""))},e.prototype._checkObjectHasProperty=function(e,t){return Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e},e.prototype.handleValueAccessException=function(e,t){return e instanceof o.ValidationError?(this.lastErrorCode=String(e.errorCode),t=s.global_constants.SCORM_FALSE):(e instanceof Error&&e.message?console.error(e.message):console.error(e),this.throwSCORMError(this._error_codes.GENERAL)),t},e.prototype.getCommitObject=function(e){var t=e||this.settings.alwaysSendTotalTime,r=this.settings.renderCommonCommitFields?this.renderCommitObject(t):this.renderCommitCMI(t);return[c.LogLevelEnum.DEBUG,"1",1,"DEBUG"].includes(this.apiLogLevel)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(r)),r},e.prototype.performFetch=function(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function(){var r;return(0,n.__generator)(this,(function(i){return r={method:"POST",mode:this.settings.fetchMode,body:t instanceof Array?t.join("&"):JSON.stringify(t),headers:(0,n.__assign)((0,n.__assign)({},this.settings.xhrHeaders),{"Content-Type":this.settings.commitRequestDataType}),keepalive:!0},this.settings.xhrWithCredentials&&(r=(0,n.__assign)((0,n.__assign)({},r),{credentials:"include"})),[2,fetch(e,r)]}))}))},e.prototype.transformResponse=function(e){return(0,n.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return r=n.sent(),[3,4];case 2:return[4,e.json()];case 3:r=n.sent(),n.label=4;case 4:return t=r,e.status>=200&&e.status<=299&&(!0===t.result||t.result===s.global_constants.SCORM_TRUE)?this.processListeners("CommitSuccess"):this.processListeners("CommitError"),[2,t]}}))}))},e}(),d=_},941:function(e,t,r){r.r(t),r.d(t,{Scorm12API:function(){return f}});var n=r(635),i=r(989),o=r(864),s=r(340),a=r(797),c=r(176),l=r(833),u=r(331),_=r(56),d=r(429),h=r(417),f=function(e){function t(t){var r=this;return t&&void 0===t.mastery_override&&(t.mastery_override=!1),(r=e.call(this,a.scorm12_errors,t)||this).statusSetByModule=!1,r.cmi=new i.CMI,r.nav=new u.NAV,r.LMSInitialize=r.lmsInitialize,r.LMSFinish=r.lmsFinish,r.LMSGetValue=r.lmsGetValue,r.LMSSetValue=r.lmsSetValue,r.LMSCommit=r.lmsCommit,r.LMSGetLastError=r.lmsGetLastError,r.LMSGetErrorString=r.lmsGetErrorString,r.LMSGetDiagnostic=r.lmsGetDiagnostic,r}return(0,n.__extends)(t,e),t.prototype.reset=function(e){var t,r;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),null===(r=this.nav)||void 0===r||r.reset()},t.prototype.lmsInitialize=function(){return this.cmi.initialize(),this.cmi.core.lesson_status?this.statusSetByModule=!0:this.cmi.core.lesson_status="not attempted",this.initialize("LMSInitialize","LMS was already initialized!","LMS is already finished!")},t.prototype.lmsFinish=function(){return(0,n.__awaiter)(this,void 0,void 0,(function(){return(0,n.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.internalFinish()];case 1:return e.sent(),[2]}}))})),s.global_constants.SCORM_TRUE},t.prototype.internalFinish=function(){return(0,n.__awaiter)(this,void 0,void 0,(function(){var e;return(0,n.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.terminate("LMSFinish",!0)];case 1:return(e=t.sent())===s.global_constants.SCORM_TRUE&&(""!==this.nav.event?"continue"===this.nav.event?this.processListeners("SequenceNext"):this.processListeners("SequencePrevious"):this.settings.autoProgress&&this.processListeners("SequenceNext")),[2,e]}}))}))},t.prototype.lmsGetValue=function(e){return this.getValue("LMSGetValue",!1,e)},t.prototype.lmsSetValue=function(e,t){return"cmi.core.lesson_status"===e&&(this.statusSetByModule=!0),this.setValue("LMSSetValue","LMSCommit",!1,e,t)},t.prototype.lmsCommit=function(){return this.settings.asyncCommit?this.scheduleCommit(500,"LMSCommit"):(0,n.__awaiter)(this,void 0,void 0,(function(){return(0,n.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.commit("LMSCommit",!1)];case 1:return e.sent(),[2]}}))})),s.global_constants.SCORM_TRUE},t.prototype.lmsGetLastError=function(){return this.getLastError("LMSGetLastError")},t.prototype.lmsGetErrorString=function(e){return this.getErrorString("LMSGetErrorString",e)},t.prototype.lmsGetDiagnostic=function(e){return this.getDiagnostic("LMSGetDiagnostic",e)},t.prototype.setCMIValue=function(e,t){return this._commonSetCMIValue("LMSSetValue",!1,e,t)},t.prototype.getCMIValue=function(e){return this._commonGetCMIValue("getCMIValue",!1,e)},t.prototype.getChildElement=function(e,t,r){return(0,o.stringMatches)(e,"cmi\\.objectives\\.\\d+")?new c.CMIObjectivesObject:r&&(0,o.stringMatches)(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?new l.CMIInteractionsCorrectResponsesObject:r&&(0,o.stringMatches)(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new l.CMIInteractionsObjectivesObject:!r&&(0,o.stringMatches)(e,"cmi\\.interactions\\.\\d+")?new l.CMIInteractionsObject:null},t.prototype.validateCorrectResponse=function(e,t){},t.prototype.getLmsErrorMessageDetails=function(e,t){var r,n,i="No Error",o="No Error";return e=String(e),s.scorm12_constants.error_descriptions[e]&&(i=(null===(r=s.scorm12_constants.error_descriptions[e])||void 0===r?void 0:r.basicMessage)||"General Error",o=(null===(n=s.scorm12_constants.error_descriptions[e])||void 0===n?void 0:n.detailMessage)||""),t?o:i},t.prototype.replaceWithAnotherScormAPI=function(e){this.cmi=e.cmi},t.prototype.renderCommitCMI=function(e){var t=this.renderCMIToJSONObject();e&&(t.cmi.core.total_time=this.cmi.getCurrentTotalTime());var r=[],n=o.flatten(t);switch(this.settings.dataCommitFormat){case"flattened":return o.flatten(t);case"params":for(var i in n)({}).hasOwnProperty.call(n,i)&&r.push("".concat(i,"=").concat(n[i]));return r;default:return t}},t.prototype.renderCommitObject=function(e){var t=this.renderCommitCMI(e),r=this.cmi.getCurrentTotalTime(),n=o.getTimeAsSeconds(r,h.scorm12_regex.CMITimespan),i=this.cmi.core.lesson_status,s=_.CompletionStatus.unknown,a=_.SuccessStatus.unknown;i&&(s="completed"===i||"passed"===i?_.CompletionStatus.completed:_.CompletionStatus.incomplete,"passed"===i?a=_.SuccessStatus.passed:"failed"===i&&(a=_.SuccessStatus.failed));var c=this.cmi.core.score,l={};c&&(Number.isNaN(Number.parseFloat(c.raw))||(l.raw=Number.parseFloat(c.raw)),Number.isNaN(Number.parseFloat(c.min))||(l.min=Number.parseFloat(c.min)),Number.isNaN(Number.parseFloat(c.max))||(l.max=Number.parseFloat(c.max)));var u={successStatus:a,completionStatus:s,runtimeData:t,totalTimeSeconds:n};return l&&(u.score=l),u},t.prototype.storeData=function(e){return(0,n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,o,a;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return e&&(t=this.cmi.core.lesson_status,this.cmi.core.lesson_status&&(this.statusSetByModule||"not attempted"!==this.cmi.core.lesson_status)||(this.cmi.core.lesson_status="completed"),"normal"===this.cmi.core.lesson_mode?"credit"===this.cmi.core.credit&&this.settings.mastery_override&&""!==this.cmi.student_data.mastery_score&&""!==this.cmi.core.score.raw&&(this.cmi.core.lesson_status=parseFloat(this.cmi.core.score.raw)>=parseFloat(this.cmi.student_data.mastery_score)?"passed":"failed"):"browse"===this.cmi.core.lesson_mode&&""===((null===(a=null===(o=null===(i=this.startingData)||void 0===i?void 0:i.cmi)||void 0===o?void 0:o.core)||void 0===a?void 0:a.lesson_status)||"")&&"not attempted"===t&&(this.cmi.core.lesson_status="browsed")),r=this.getCommitObject(e),"string"!=typeof this.settings.lmsCommitUrl?[3,2]:[4,this.processHttpRequest(this.settings.lmsCommitUrl,r,e)];case 1:return[2,n.sent()];case 2:return[2,{result:s.global_constants.SCORM_TRUE,errorCode:0}]}}))}))},t}(d.default)},589:function(e,t,r){r.r(t),r.d(t,{CMIArray:function(){return a}});var n=r(635),i=r(319),o=r(784),s=r(797),a=function(e){function t(t){var r=e.call(this)||this;return r.__children=t.children,r._errorCode=t.errorCode||s.scorm12_errors.GENERAL,r._errorClass=t.errorClass||o.BaseScormValidationError,r.childArray=[],r}return(0,n.__extends)(t,e),t.prototype.reset=function(e){if(void 0===e&&(e=!1),this._initialized=!1,e)this.childArray=[];else for(var t=0;t<this.childArray.length;t++)this.childArray[t].reset()},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new this._errorClass(this._errorCode)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_count",{get:function(){return this.childArray.length},set:function(e){throw new this._errorClass(this._errorCode)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;for(var e={},t=0;t<this.childArray.length;t++)e[t+""]=this.childArray[t];return delete this.jsonString,e},t}(i.BaseCMI)},319:function(e,t,r){r.r(t),r.d(t,{BaseCMI:function(){return i},BaseRootCMI:function(){return o}});var n=r(635),i=function(){function e(){this.jsonString=!1,this._initialized=!1}return Object.defineProperty(e.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start_time",{get:function(){return this._start_time},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){this._initialized=!0},e.prototype.setStartTime=function(){this._start_time=(new Date).getTime()},e}(),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.__extends)(t,e),t}(i)},434:function(e,t,r){r.r(t),r.d(t,{CMIScore:function(){return l}});var n=r(635),i=r(340),o=r(417),s=r(319),a=r(449),c=r(797),l=function(e){function t(t){var r=e.call(this)||this;return r._raw="",r._min="",r.__children=t.score_children||i.scorm12_constants.score_children,r.__score_range=!!t.score_range&&o.scorm12_regex.score_range,r._max=t.max||""===t.max?t.max:"100",r.__invalid_error_code=t.invalidErrorCode||c.scorm12_errors.INVALID_SET_VALUE,r.__invalid_type_code=t.invalidTypeCode||c.scorm12_errors.TYPE_MISMATCH,r.__invalid_range_code=t.invalidRangeCode||c.scorm12_errors.VALUE_OUT_OF_RANGE,r.__decimal_regex=t.decimalRegex||o.scorm12_regex.CMIDecimal,r.__error_class=t.errorClass,r}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new this.__error_class(this.__invalid_error_code)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"raw",{get:function(){return this._raw},set:function(e){!(0,a.checkValidFormat)(e,this.__decimal_regex,this.__invalid_type_code,this.__error_class)||this.__score_range&&!(0,a.checkValidRange)(e,this.__score_range,this.__invalid_range_code,this.__error_class)||(this._raw=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"min",{get:function(){return this._min},set:function(e){!(0,a.checkValidFormat)(e,this.__decimal_regex,this.__invalid_type_code,this.__error_class)||this.__score_range&&!(0,a.checkValidRange)(e,this.__score_range,this.__invalid_range_code,this.__error_class)||(this._min=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._max},set:function(e){!(0,a.checkValidFormat)(e,this.__decimal_regex,this.__invalid_type_code,this.__error_class)||this.__score_range&&!(0,a.checkValidRange)(e,this.__score_range,this.__invalid_range_code,this.__error_class)||(this._max=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={raw:this.raw,min:this.min,max:this.max};return delete this.jsonString,e},t}(s.BaseCMI)},449:function(e,t,r){function n(e,t,r,n,i){if("string"!=typeof e)return!1;var o=new RegExp(t),s=e.match(o);if(i&&""===e)return!0;if(void 0===e||!s||""===s[0])throw new n(r);return!0}function i(e,t,r,n){var i=t.split("#");if(e*=1,i[0]&&e>=i[0]){if(i[1]&&("*"===i[1]||e<=i[1]))return!0;throw new n(r)}throw new n(r)}r.r(t),r.d(t,{checkValidFormat:function(){return n},checkValidRange:function(){return i}})},989:function(e,t,r){r.r(t),r.d(t,{CMI:function(){return g}});var n=r(635),i=r(340),o=r(797),s=r(417),a=r(179),c=r(319),l=r(915),u=r(434),_=r(864),d=function(e){function t(){var t=e.call(this)||this;return t.__children=i.scorm12_constants.core_children,t._student_id="",t._student_name="",t._lesson_location="",t._credit="",t._lesson_status="not attempted",t._entry="",t._total_time="",t._lesson_mode="normal",t._exit="",t._session_time="00:00:00",t._suspend_data="",t.score=new u.CMIScore({score_children:i.scorm12_constants.score_children,score_range:s.scorm12_regex.score_range,invalidErrorCode:o.scorm12_errors.INVALID_SET_VALUE,invalidTypeCode:o.scorm12_errors.TYPE_MISMATCH,invalidRangeCode:o.scorm12_errors.VALUE_OUT_OF_RANGE,errorClass:a.Scorm12ValidationError}),t}return(0,n.__extends)(t,e),t.prototype.initialize=function(){var t;e.prototype.initialize.call(this),null===(t=this.score)||void 0===t||t.initialize()},t.prototype.reset=function(){var e;this._initialized=!1,this._exit="",this._entry="",this._session_time="00:00:00",null===(e=this.score)||void 0===e||e.reset()},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new a.Scorm12ValidationError(o.scorm12_errors.INVALID_SET_VALUE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"student_id",{get:function(){return this._student_id},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._student_id=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"student_name",{get:function(){return this._student_name},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._student_name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lesson_location",{get:function(){return this._lesson_location},set:function(e){(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIString256,!0)&&(this._lesson_location=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"credit",{get:function(){return this._credit},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._credit=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lesson_status",{get:function(){return this._lesson_status},set:function(e){this.initialized?(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIStatus)&&(this._lesson_status=e):(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIStatus2)&&(this._lesson_status=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"entry",{get:function(){return this._entry},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._entry=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"total_time",{get:function(){return this._total_time},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._total_time=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lesson_mode",{get:function(){return this._lesson_mode},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._lesson_mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"exit",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(o.scorm12_errors.WRITE_ONLY_ELEMENT);return this._exit},set:function(e){(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIExit,!0)&&(this._exit=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"session_time",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(o.scorm12_errors.WRITE_ONLY_ELEMENT);return this._session_time},set:function(e){(0,l.check12ValidFormat)(e,s.scorm12_regex.CMITimespan)&&(this._session_time=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"suspend_data",{get:function(){return this._suspend_data},set:function(e){(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIString4096,!0)&&(this._suspend_data=e)},enumerable:!1,configurable:!0}),t.prototype.getCurrentTotalTime=function(e){var t=this._session_time,r=e;if(null!=r){var n=(new Date).getTime()-r;t=_.getSecondsAsHHMMSS(n/1e3)}return _.addHHMMSSTimeStrings(this._total_time,t,new RegExp(s.scorm12_regex.CMITimespan))},t.prototype.toJSON=function(){this.jsonString=!0;var 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,lesson_mode:this.lesson_mode,exit:this.exit,session_time:this.session_time,score:this.score};return delete this.jsonString,e},t}(c.BaseCMI),h=r(176),f=r(532),m=r(181),p=r(833),g=function(e){function t(t,r,n){var o=e.call(this)||this;return o.__children="",o.__version="3.4",o._launch_data="",o._comments="",o._comments_from_lms="",n&&o.initialize(),o.__children=t||i.scorm12_constants.cmi_children,o.core=new d,o.objectives=new h.CMIObjectives,o.student_data=r||new f.CMIStudentData,o.student_preference=new m.CMIStudentPreference,o.interactions=new p.CMIInteractions,o}return(0,n.__extends)(t,e),t.prototype.reset=function(){var e,t,r;this._initialized=!1,this._launch_data="",this._comments="",null===(e=this.core)||void 0===e||e.reset(),this.objectives=new h.CMIObjectives,this.interactions=new p.CMIInteractions,null===(t=this.student_data)||void 0===t||t.reset(),null===(r=this.student_preference)||void 0===r||r.reset()},t.prototype.initialize=function(){var t,r,n,i,o;e.prototype.initialize.call(this),null===(t=this.core)||void 0===t||t.initialize(),null===(r=this.objectives)||void 0===r||r.initialize(),null===(n=this.student_data)||void 0===n||n.initialize(),null===(i=this.student_preference)||void 0===i||i.initialize(),null===(o=this.interactions)||void 0===o||o.initialize()},t.prototype.toJSON=function(){this.jsonString=!0;var 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},Object.defineProperty(t.prototype,"_version",{get:function(){return this.__version},set:function(e){throw new a.Scorm12ValidationError(o.scorm12_errors.INVALID_SET_VALUE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new a.Scorm12ValidationError(o.scorm12_errors.INVALID_SET_VALUE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"suspend_data",{get:function(){var e;return null===(e=this.core)||void 0===e?void 0:e.suspend_data},set:function(e){this.core&&(this.core.suspend_data=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"launch_data",{get:function(){return this._launch_data},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._launch_data=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"comments",{get:function(){return this._comments},set:function(e){(0,l.check12ValidFormat)(e,s.scorm12_regex.CMIString4096,!0)&&(this._comments=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"comments_from_lms",{get:function(){return this._comments_from_lms},set:function(e){if(this.initialized)throw new a.Scorm12ValidationError(o.scorm12_errors.READ_ONLY_ELEMENT);this._comments_from_lms=e},enumerable:!1,configurable:!0}),t.prototype.getCurrentTotalTime=function(){return this.core.getCurrentTotalTime(this.start_time)},t}(c.BaseRootCMI)},833:function(e,t,r){r.r(t),r.d(t,{CMIInteractions:function(){return _},CMIInteractionsCorrectResponsesObject:function(){return f},CMIInteractionsObject:function(){return d},CMIInteractionsObjectivesObject:function(){return h}});var n=r(635),i=r(589),o=r(340),s=r(797),a=r(179),c=r(319),l=r(915),u=r(417),_=function(e){function t(){return e.call(this,{children:o.scorm12_constants.interactions_children,errorCode:s.scorm12_errors.INVALID_SET_VALUE,errorClass:a.Scorm12ValidationError})||this}return(0,n.__extends)(t,e),t}(i.CMIArray),d=function(e){function t(){var t=e.call(this)||this;return t._id="",t._time="",t._type="",t._weighting="",t._student_response="",t._result="",t._latency="",t.objectives=new i.CMIArray({errorCode:s.scorm12_errors.INVALID_SET_VALUE,errorClass:a.Scorm12ValidationError,children:o.scorm12_constants.objectives_children}),t.correct_responses=new i.CMIArray({errorCode:s.scorm12_errors.INVALID_SET_VALUE,errorClass:a.Scorm12ValidationError,children:o.scorm12_constants.correct_responses_children}),t}return(0,n.__extends)(t,e),t.prototype.initialize=function(){var t,r;e.prototype.initialize.call(this),null===(t=this.objectives)||void 0===t||t.initialize(),null===(r=this.correct_responses)||void 0===r||r.initialize()},t.prototype.reset=function(){var e,t;this._initialized=!1,this._id="",this._time="",this._type="",this._weighting="",this._student_response="",this._result="",this._latency="",null===(e=this.objectives)||void 0===e||e.reset(),null===(t=this.correct_responses)||void 0===t||t.reset()},Object.defineProperty(t.prototype,"id",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._id},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIIdentifier)&&(this._id=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._time},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMITime)&&(this._time=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._type},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIType)&&(this._type=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weighting",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._weighting},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIDecimal)&&(0,l.check12ValidRange)(e,u.scorm12_regex.weighting_range)&&(this._weighting=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"student_response",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._student_response},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIFeedback,!0)&&(this._student_response=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"result",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._result},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIResult)&&(this._result=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"latency",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._latency},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMITimespan)&&(this._latency=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var 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},t}(c.BaseCMI),h=function(e){function t(){var t=e.call(this)||this;return t._id="",t}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._id=""},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIIdentifier)&&(this._id=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={id:this.id};return delete this.jsonString,e},t}(c.BaseCMI),f=function(e){function t(){var t=e.call(this)||this;return t._pattern="",t}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._pattern=""},Object.defineProperty(t.prototype,"pattern",{get:function(){if(!this.jsonString)throw new a.Scorm12ValidationError(s.scorm12_errors.WRITE_ONLY_ELEMENT);return this._pattern},set:function(e){(0,l.check12ValidFormat)(e,u.scorm12_regex.CMIFeedback,!0)&&(this._pattern=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={pattern:this._pattern};return delete this.jsonString,e},t}(c.BaseCMI)},331:function(e,t,r){r.r(t),r.d(t,{NAV:function(){return a}});var n=r(635),i=r(319),o=r(915),s=r(417),a=function(e){function t(){var t=e.call(this)||this;return t._event="",t}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._event="",this._initialized=!1},Object.defineProperty(t.prototype,"event",{get:function(){return this._event},set:function(e){(0,o.check12ValidFormat)(e,s.scorm12_regex.NAVEvent)&&(this._event=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={event:this.event};return delete this.jsonString,e},t}(i.BaseCMI)},176:function(e,t,r){r.r(t),r.d(t,{CMIObjectives:function(){return _},CMIObjectivesObject:function(){return d}});var n=r(635),i=r(319),o=r(434),s=r(340),a=r(417),c=r(797),l=r(179),u=r(915),_=function(e){function t(){return e.call(this,{children:s.scorm12_constants.objectives_children,errorCode:c.scorm12_errors.INVALID_SET_VALUE,errorClass:l.Scorm12ValidationError})||this}return(0,n.__extends)(t,e),t}(r(589).CMIArray),d=function(e){function t(){var t=e.call(this)||this;return t._id="",t._status="",t.score=new o.CMIScore({score_children:s.scorm12_constants.score_children,score_range:a.scorm12_regex.score_range,invalidErrorCode:c.scorm12_errors.INVALID_SET_VALUE,invalidTypeCode:c.scorm12_errors.TYPE_MISMATCH,invalidRangeCode:c.scorm12_errors.VALUE_OUT_OF_RANGE,errorClass:l.Scorm12ValidationError}),t}return(0,n.__extends)(t,e),t.prototype.reset=function(){var e;this._initialized=!1,this._id="",this._status="",null===(e=this.score)||void 0===e||e.reset()},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},set:function(e){(0,u.check12ValidFormat)(e,a.scorm12_regex.CMIIdentifier)&&(this._id=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},set:function(e){(0,u.check12ValidFormat)(e,a.scorm12_regex.CMIStatus2)&&(this._status=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={id:this.id,status:this.status,score:this.score};return delete this.jsonString,e},t}(i.BaseCMI)},532:function(e,t,r){r.r(t),r.d(t,{CMIStudentData:function(){return c}});var n=r(635),i=r(319),o=r(340),s=r(179),a=r(797),c=function(e){function t(t){var r=e.call(this)||this;return r._mastery_score="",r._max_time_allowed="",r._time_limit_action="",r.__children=t||o.scorm12_constants.student_data_children,r}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new s.Scorm12ValidationError(a.scorm12_errors.INVALID_SET_VALUE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mastery_score",{get:function(){return this._mastery_score},set:function(e){if(this.initialized)throw new s.Scorm12ValidationError(a.scorm12_errors.READ_ONLY_ELEMENT);this._mastery_score=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max_time_allowed",{get:function(){return this._max_time_allowed},set:function(e){if(this.initialized)throw new s.Scorm12ValidationError(a.scorm12_errors.READ_ONLY_ELEMENT);this._max_time_allowed=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time_limit_action",{get:function(){return this._time_limit_action},set:function(e){if(this.initialized)throw new s.Scorm12ValidationError(a.scorm12_errors.READ_ONLY_ELEMENT);this._time_limit_action=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var 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},t}(i.BaseCMI)},181:function(e,t,r){r.r(t),r.d(t,{CMIStudentPreference:function(){return u}});var n=r(635),i=r(319),o=r(340),s=r(179),a=r(915),c=r(417),l=r(797),u=function(e){function t(t){var r=e.call(this)||this;return r._audio="",r._language="",r._speed="",r._text="",r.__children=t||o.scorm12_constants.student_preference_children,r}return(0,n.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},set:function(e){throw new s.Scorm12ValidationError(l.scorm12_errors.INVALID_SET_VALUE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"audio",{get:function(){return this._audio},set:function(e){(0,a.check12ValidFormat)(e,c.scorm12_regex.CMISInteger)&&(0,a.check12ValidRange)(e,c.scorm12_regex.audio_range)&&(this._audio=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"language",{get:function(){return this._language},set:function(e){(0,a.check12ValidFormat)(e,c.scorm12_regex.CMIString256)&&(this._language=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"speed",{get:function(){return this._speed},set:function(e){(0,a.check12ValidFormat)(e,c.scorm12_regex.CMISInteger)&&(0,a.check12ValidRange)(e,c.scorm12_regex.speed_range)&&(this._speed=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){(0,a.check12ValidFormat)(e,c.scorm12_regex.CMISInteger)&&(0,a.check12ValidRange)(e,c.scorm12_regex.text_range)&&(this._text=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={audio:this.audio,language:this.language,speed:this.speed,text:this.text};return delete this.jsonString,e},t}(i.BaseCMI)},915:function(e,t,r){r.r(t),r.d(t,{check12ValidFormat:function(){return s},check12ValidRange:function(){return a}});var n=r(449),i=r(797),o=r(179);function s(e,t,r){return(0,n.checkValidFormat)(e,t,i.scorm12_errors.TYPE_MISMATCH,o.Scorm12ValidationError,r)}function a(e,t,r){if(!r&&""===e)throw new o.Scorm12ValidationError(i.scorm12_errors.VALUE_OUT_OF_RANGE);return(0,n.checkValidRange)(e,t,i.scorm12_errors.VALUE_OUT_OF_RANGE,o.Scorm12ValidationError)}},340:function(e,t,r){r.r(t),r.d(t,{aicc_constants:function(){return s},global_constants:function(){return i},scorm12_constants:function(){return o},scorm2004_constants:function(){return a}});var n=r(635),i={SCORM_TRUE:"true",SCORM_FALSE:"false",STATE_NOT_INITIALIZED:0,STATE_INITIALIZED:1,STATE_TERMINATED:2},o={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."},407:{basicMessage:"Element Value Out Of Range",detailMessage:"The numeric value supplied to a LMSSetValue 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."}}},s=(0,n.__assign)((0,n.__assign)({},o),{cmi_children:"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions,evaluation",student_preference_children:"audio,language,lesson_type,speed,text,text_color,text_location,text_size,video,windows",student_data_children:"attempt_number,tries,mastery_score,max_time_allowed,time_limit_action",student_demographics_children:"city,class,company,country,experience,familiar_name,instructor_name,title,native_language,state,str