UNPKG

scorm-again

Version:

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

1 lines 132 kB
!function(){"use strict";var e={916:function(e,t,r){r.r(t),r.d(t,{AICC:function(){return x}});var i=r(635),n=r(941),o=r(989),s=r(340),a=r(589),c=r(784),l=s.aicc_constants.error_descriptions,u=function(e){function t(t){var r,i,n,o;return{}.hasOwnProperty.call(l,String(t))?e.call(this,t,(null===(r=l[String(t)])||void 0===r?void 0:r.basicMessage)||"Unknown rror",null===(i=l[String(t)])||void 0===i?void 0:i.detailMessage)||this:e.call(this,101,(null===(n=l[101])||void 0===n?void 0:n.basicMessage)||"General error",null===(o=l[101])||void 0===o?void 0:o.detailMessage)||this}return(0,i.__extends)(t,e),t}(c.ValidationError),_=r(319),d=r(797),h=r(449);function m(e,t,r){return(0,h.checkValidFormat)(e,t,d.scorm12_errors.TYPE_MISMATCH,u,r)}var f=r(417),p=function(e){function t(){var t=e.call(this)||this;return t.comments=new g,t}return(0,i.__extends)(t,e),t.prototype.initialize=function(){var t;e.prototype.initialize.call(this),null===(t=this.comments)||void 0===t||t.initialize()},t.prototype.reset=function(){var e;this._initialized=!1,null===(e=this.comments)||void 0===e||e.reset()},t.prototype.toJSON=function(){this.jsonString=!0;var e={comments:this.comments};return delete this.jsonString,e},t}(_.BaseCMI),g=function(e){function t(){return e.call(this,{children:s.aicc_constants.comments_children,errorCode:d.scorm12_errors.INVALID_SET_VALUE,errorClass:u})||this}return(0,i.__extends)(t,e),t}(a.CMIArray),E=function(e){function t(){var t=e.call(this)||this;return t._content="",t._location="",t._time="",t}return(0,i.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._content="",this._location="",this._time=""},Object.defineProperty(t.prototype,"content",{get:function(){return this._content},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._content=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"location",{get:function(){return this._location},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._location=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this._time},set:function(e){m(e,f.aicc_regex.CMITime)&&(this._time=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={content:this.content,location:this.location,time:this.time};return delete this.jsonString,e},t}(_.BaseCMI),y=function(e){function t(){var t=e.call(this,s.aicc_constants.student_preference_children)||this;return t._lesson_type="",t._text_color="",t._text_location="",t._text_size="",t._video="",t.windows=new a.CMIArray({errorCode:d.scorm12_errors.INVALID_SET_VALUE,errorClass:u,children:""}),t}return(0,i.__extends)(t,e),t.prototype.initialize=function(){var t;e.prototype.initialize.call(this),null===(t=this.windows)||void 0===t||t.initialize()},Object.defineProperty(t.prototype,"lesson_type",{get:function(){return this._lesson_type},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._lesson_type=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text_color",{get:function(){return this._text_color},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._text_color=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text_location",{get:function(){return this._text_location},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._text_location=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text_size",{get:function(){return this._text_size},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._text_size=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"video",{get:function(){return this._video},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._video=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={audio:this.audio,language:this.language,lesson_type:this.lesson_type,speed:this.speed,text:this.text,text_color:this.text_color,text_location:this.text_location,text_size:this.text_size,video:this.video,windows:this.windows};return delete this.jsonString,e},t}(r(181).CMIStudentPreference),b=function(e){function t(){var t=e.call(this)||this;return t.__children=s.aicc_constants.student_demographics_children,t._city="",t._class="",t._company="",t._country="",t._experience="",t._familiar_name="",t._instructor_name="",t._title="",t._native_language="",t._state="",t._street_address="",t._telephone="",t._years_experience="",t}return(0,i.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1},Object.defineProperty(t.prototype,"_children",{get:function(){return this.__children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"city",{get:function(){return this._city},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._city=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"class",{get:function(){return this._class},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._class=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"company",{get:function(){return this._company},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._company=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"country",{get:function(){return this._country},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._country=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"experience",{get:function(){return this._experience},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._experience=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"familiar_name",{get:function(){return this._familiar_name},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._familiar_name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"instructor_name",{get:function(){return this._instructor_name},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._instructor_name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this._title},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._title=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"native_language",{get:function(){return this._native_language},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._native_language=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._state=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"street_address",{get:function(){return this._street_address},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._street_address=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"telephone",{get:function(){return this._telephone},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._telephone=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"years_experience",{get:function(){return this._years_experience},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._years_experience=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={city:this.city,class:this.class,company:this.company,country:this.country,experience:this.experience,familiar_name:this.familiar_name,instructor_name:this.instructor_name,title:this.title,native_language:this.native_language,state:this.state,street_address:this.street_address,telephone:this.telephone,years_experience:this.years_experience};return delete this.jsonString,e},t}(_.BaseCMI),v=r(434),M=function(e){function t(){return e.call(this,{children:s.aicc_constants.tries_children})||this}return(0,i.__extends)(t,e),t}(a.CMIArray),S=function(e){function t(){var t=e.call(this)||this;return t._status="",t._time="",t.score=new v.CMIScore({score_children:s.aicc_constants.score_children,score_range:f.aicc_regex.score_range,invalidErrorCode:d.scorm12_errors.INVALID_SET_VALUE,invalidTypeCode:d.scorm12_errors.TYPE_MISMATCH,invalidRangeCode:d.scorm12_errors.VALUE_OUT_OF_RANGE,errorClass:u}),t}return(0,i.__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._status="",this._time="",null===(e=this.score)||void 0===e||e.reset()},Object.defineProperty(t.prototype,"status",{get:function(){return this._status},set:function(e){m(e,f.aicc_regex.CMIStatus2)&&(this._status=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this._time},set:function(e){m(e,f.aicc_regex.CMITime)&&(this._time=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={status:this.status,time:this.time,score:this.score};return delete this.jsonString,e},t}(_.BaseCMI),I=r(532),C=function(e){function t(){return e.call(this,{children:s.aicc_constants.attempt_records_children})||this}return(0,i.__extends)(t,e),t}(a.CMIArray),O=function(e){function t(){var t=e.call(this)||this;return t._lesson_status="",t.score=new v.CMIScore({score_children:s.aicc_constants.score_children,score_range:f.aicc_regex.score_range,invalidErrorCode:d.scorm12_errors.INVALID_SET_VALUE,invalidTypeCode:d.scorm12_errors.TYPE_MISMATCH,invalidRangeCode:d.scorm12_errors.VALUE_OUT_OF_RANGE,errorClass:u}),t}return(0,i.__extends)(t,e),t.prototype.initialize=function(){var t;e.prototype.initialize.call(this),this._lesson_status="",null===(t=this.score)||void 0===t||t.initialize()},t.prototype.reset=function(){var e;this._initialized=!1,null===(e=this.score)||void 0===e||e.reset()},Object.defineProperty(t.prototype,"lesson_status",{get:function(){return this._lesson_status},set:function(e){m(e,f.aicc_regex.CMIStatus2)&&(this._lesson_status=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={lesson_status:this.lesson_status,score:this.score};return delete this.jsonString,e},t}(_.BaseCMI),w=function(e){function t(){var t=e.call(this,s.aicc_constants.student_data_children)||this;return t._tries_during_lesson="",t.tries=new M,t.attempt_records=new C,t}return(0,i.__extends)(t,e),t.prototype.initialize=function(){var t,r;e.prototype.initialize.call(this),null===(t=this.tries)||void 0===t||t.initialize(),null===(r=this.attempt_records)||void 0===r||r.initialize()},t.prototype.reset=function(){var e,t;this._initialized=!1,null===(e=this.tries)||void 0===e||e.reset(!0),null===(t=this.attempt_records)||void 0===t||t.reset(!0)},Object.defineProperty(t.prototype,"tries_during_lesson",{get:function(){return this._tries_during_lesson},set:function(e){if(this.initialized)throw new u(d.scorm12_errors.READ_ONLY_ELEMENT);this._tries_during_lesson=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,tries:this.tries,attempt_records:this.attempt_records};return delete this.jsonString,e},t}(I.CMIStudentData),T=function(e){function t(){return e.call(this,{children:s.aicc_constants.paths_children})||this}return(0,i.__extends)(t,e),t}(a.CMIArray),N=function(e){function t(){var t=e.call(this)||this;return t._location_id="",t._date="",t._time="",t._status="",t._why_left="",t._time_in_element="",t}return(0,i.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._location_id="",this._date="",this._time="",this._status="",this._why_left="",this._time_in_element=""},Object.defineProperty(t.prototype,"location_id",{get:function(){return this._location_id},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._location_id=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"date",{get:function(){return this._date},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._date=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this._time},set:function(e){m(e,f.aicc_regex.CMITime)&&(this._time=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},set:function(e){m(e,f.aicc_regex.CMIStatus2)&&(this._status=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"why_left",{get:function(){return this._why_left},set:function(e){m(e,f.aicc_regex.CMIString256)&&(this._why_left=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time_in_element",{get:function(){return this._time_in_element},set:function(e){m(e,f.aicc_regex.CMITime)&&(this._time_in_element=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={location_id:this.location_id,date:this.date,time:this.time,status:this.status,why_left:this.why_left,time_in_element:this.time_in_element};return delete this.jsonString,e},t}(_.BaseCMI),L=function(e){function t(t){void 0===t&&(t=!1);var r=e.call(this,s.aicc_constants.cmi_children)||this;return t&&r.initialize(),r.student_preference=new y,r.student_data=new w,r.student_demographics=new b,r.evaluation=new p,r.paths=new T,r}return(0,i.__extends)(t,e),t.prototype.initialize=function(){var t,r,i,n,o;e.prototype.initialize.call(this),null===(t=this.student_preference)||void 0===t||t.initialize(),null===(r=this.student_data)||void 0===r||r.initialize(),null===(i=this.student_demographics)||void 0===i||i.initialize(),null===(n=this.evaluation)||void 0===n||n.initialize(),null===(o=this.paths)||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,student_demographics:this.student_demographics,interactions:this.interactions,evaluation:this.evaluation,paths:this.paths};return delete this.jsonString,e},t}(o.CMI),R=r(331),A=r(864),x=function(e){function t(t){var r=e.call(this,t)||this;return r.cmi=new L,r.nav=new R.NAV,r}return(0,i.__extends)(t,e),t.prototype.getChildElement=function(t,r,i){var n=e.prototype.getChildElement.call(this,t,r,i);return n||((0,A.stringMatches)(t,"cmi\\.evaluation\\.comments\\.\\d+")?n=new E:(0,A.stringMatches)(t,"cmi\\.student_data\\.tries\\.\\d+")?n=new S:(0,A.stringMatches)(t,"cmi\\.student_data\\.attempt_records\\.\\d+")?n=new O:(0,A.stringMatches)(t,"cmi\\.paths\\.\\d+")&&(n=new N)),n},t.prototype.replaceWithAnotherScormAPI=function(e){this.cmi=e.cmi,this.nav=e.nav},t}(n.Scorm12API)},429:function(e,t,r){r.r(t),r.d(t,{default:function(){return d}});var i=r(635),n=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,i.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return void 0===e?[3,2]:[4,e.text()];case 1:return t=i.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,i.__awaiter)(this,void 0,void 0,(function(){return(0,i.__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 n,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,i.__assign)((0,i.__assign)({},l),r)),this.apiLogLevel=null!==(n=this.settings.logLevel)&&void 0!==n?n: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,i.__assign)((0,i.__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 i=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",i=s.global_constants.SCORM_TRUE,this.processListeners(e)),this.apiLog(e,"returned: "+i,c.LogLevelEnum.INFO),this.clearSCORMError(i),i},e.prototype.apiLog=function(e,t,r,i){t=(0,a.formatMessage)(e,t,i),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,i.__assign)((0,i.__assign)({},this._settings),e)},enumerable:!1,configurable:!0}),e.prototype.terminate=function(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function(){var r,n;return(0,i.__generator)(this,(function(i){switch(i.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!==(n=i.sent()).errorCode&&n.errorCode>0&&this.throwSCORMError(n.errorCode),r=void 0===n||!0!==n.result&&n.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),i.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 i="";if(this.checkState(t,this._error_codes.RETRIEVE_BEFORE_INIT,this._error_codes.RETRIEVE_AFTER_TERM)){t&&(this.lastErrorCode="0");try{i=this.getCMIValue(r)}catch(e){i=this.handleValueAccessException(e,i)}this.processListeners(e,r)}return this.apiLog(e,": returned: "+i,c.LogLevelEnum.INFO,r),void 0===i?"":(this.clearSCORMError(i),i)},e.prototype.setValue=function(e,t,r,i,n){void 0!==n&&(n=String(n));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(i,n)}catch(e){this.handleValueAccessException(e,o)}this.processListeners(e,i,n)}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,": "+n+": result: "+o,c.LogLevelEnum.INFO,i),this.clearSCORMError(o),o},e.prototype.commit=function(e){return(0,i.__awaiter)(this,arguments,void 0,(function(e,t){var r,n;return void 0===t&&(t=!1),(0,i.__generator)(this,(function(i){switch(i.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:(n=i.sent()).errorCode&&n.errorCode>0&&this.throwSCORMError(n.errorCode),r=void 0===n||!0!==n.result&&n.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),i.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."),m=t?this._error_codes.UNDEFINED_DATA_MODEL:this._error_codes.GENERAL,f=0;f<l.length;f++){var p=l[f];if(!p)return this.throwSCORMError(m,h),s.global_constants.SCORM_FALSE;if(f===l.length-1)t&&"{target="===p.substring(0,8)?this.isInitialized()?this.throwSCORMError(this._error_codes.READ_ONLY_ELEMENT):u=(0,i.__assign)((0,i.__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(m,h);else{if(!(u=u[p])){this.throwSCORMError(m,h);break}if(u instanceof n.CMIArray){var g=parseInt(l[f+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(m,h)}f++}}}}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 i=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<i.length;u++){if(!(s=i[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===i.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 n.CMIArray){var d=parseInt(i[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,i;if(t)for(var n=e.split(" "),o=0;o<n.length;o++){var s=null===(r=n[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===(i=n[o])||void 0===i?void 0:i.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,i;if(t)for(var n=e.split(" "),o=function(e){var o=null===(r=n[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===(i=n[e])||void 0===i?void 0:i.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<n.length;a++){var l=o(a);if("object"==typeof l)return l.value}},e.prototype.clear=function(e){for(var t,r,i=e.split(" "),n=function(e){var n=null===(t=i[e])||void 0===t?void 0:t.split(".");if(!n||0===(null==n?void 0:n.length))return{value:void 0};var s=n[0],a=null;n.length>1&&(a=null===(r=i[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<i.length;s++){var a=n(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 i=0;i<this.listenerArray.length;i++){var n,o=this.listenerArray[i],s=o.functionName===e,a=!!o.CMIElement;n=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&&!n||(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 i,n=/^(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,i=e[0],s=(e[1],t[0]);return t[1],null!==(r=c(i,s,n))||null!==(r=c(i,s,o))?r:i<s?-1:i>s?1:0})),s.forEach((function(e){(i={})[e[0]]=e[1],r.loadFromJSON((0,a.unflatten)(i),t)}))}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.");function c(e,t,r){var i,n=e.match(r);if(null!==n&&null!==(i=t.match(r))){var o=Number(n[2]),s=Number(i[2]);return o===s?"id"===n[3]?-1:"type"===n[3]?"id"===i[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 i=(t?t+".":"")+r,n=e[r];if(n.childArray)for(var o=0;o<n.childArray.length;o++)this.loadFromJSON(n.childArray[o],i+"."+o);else n.constructor===Object?this.loadFromJSON(n,i):this.setCMIValue(i,n)}}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,i.__awaiter)(this,arguments,void 0,(function(e,t,r){var n,o,a,l=this;return void 0===r&&(r=!1),(0,i.__generator)(this,(function(u){switch(u.label){case 0:return n=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,i.__awaiter)(l,void 0,void 0,(function(){return(0,i.__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,i.__awaiter)(l,void 0,void 0,(function(){var s,a,l;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=r.requestHandler(t),[4,this.performFetch(e,t)];case 1:return s=i.sent(),[2,this.transformResponse(s)];case 2:return a=i.sent(),l=a instanceof Error?a.message:String(a),this.apiLog("processHttpRequest",l,c.LogLevelEnum.ERROR),n.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,i.__awaiter)(this,void 0,void 0,(function(){var r;return(0,i.__generator)(this,(function(n){return r={method:"POST",mode:this.settings.fetchMode,body:t instanceof Array?t.join("&"):JSON.stringify(t),headers:(0,i.__assign)((0,i.__assign)({},this.settings.xhrHeaders),{"Content-Type":this.settings.commitRequestDataType}),keepalive:!0},this.settings.xhrWithCredentials&&(r=(0,i.__assign)((0,i.__assign)({},r),{credentials:"include"})),[2,fetch(e,r)]}))}))},e.prototype.transformResponse=function(e){return(0,i.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return r=i.sent(),[3,4];case 2:return[4,e.json()];case 3:r=i.sent(),i.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 m}});var i=r(635),n=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),m=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 n.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,i.__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,i.__awaiter)(this,void 0,void 0,(function(){return(0,i.__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,i.__awaiter)(this,void 0,void 0,(function(){var e;return(0,i.__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,i.__awaiter)(this,void 0,void 0,(function(){return(0,i.__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,i,n="No Error",o="No Error";return e=String(e),s.scorm12_constants.error_descriptions[e]&&(n=(null===(r=s.scorm12_constants.error_descriptions[e])||void 0===r?void 0:r.basicMessage)||"General Error",o=(null===(i=s.scorm12_constants.error_descriptions[e])||void 0===i?void 0:i.detailMessage)||""),t?o:n},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=[],i=o.flatten(t);switch(this.settings.dataCommitFormat){case"flattened":return o.flatten(t);case"params":for(var n in i)({}).hasOwnProperty.call(i,n)&&r.push("".concat(n,"=").concat(i[n]));return r;default:return t}},t.prototype.renderCommitObject=function(e){var t=this.renderCommitCMI(e),r=this.cmi.getCurrentTotalTime(),i=o.getTimeAsSeconds(r,h.scorm12_regex.CMITimespan),n=this.cmi.core.lesson_status,s=_.CompletionStatus.unknown,a=_.SuccessStatus.unknown;n&&(s="completed"===n||"passed"===n?_.CompletionStatus.completed:_.CompletionStatus.incomplete,"passed"===n?a=_.SuccessStatus.passed:"failed"===n&&(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:i};return l&&(u.score=l),u},t.prototype.storeData=function(e){return(0,i.__awaiter)(this,void 0,void 0,(function(){var t,r,n,o,a;return(0,i.__generator)(this,(function(i){switch(i.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===(n=this.startingData)||void 0===n?void 0:n.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,i.sent()];case 2:return[2,{result:s.global_constants.SCORM_TRUE,errorCode:0}]}}))}))},t}(d.default)},809:function(e,t,r){r.r(t),r.d(t,{Scorm2004API:function(){return z}});var i=r(635),n=r(429),o=r(340),s=r(417),a=r(797),c=r(784),l=o.scorm2004_constants.error_descriptions,u=function(e){function t(t){var r,i,n,o;return{}.hasOwnProperty.call(l,String(t))?e.call(this,t,(null===(r=l[String(t)])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(i=l[String(t)])||void 0===i?void 0:i.detailMessage)||this:e.call(this,101,(null===(n=l[101])||void 0===n?void 0:n.basicMessage)||"General error",null===(o=l[101])||void 0===o?void 0:o.detailMessage)||this}return(0,i.__extends)(t,e),t}(c.ValidationError),_=r(864),d=r(319),h=r(449);function m(e,t,r){return(0,h.checkValidFormat)(e,t,a.scorm2004_errors.TYPE_MISMATCH,u,r)}function f(e,t){return(0,h.checkValidRange)(e,t,a.scorm2004_errors.VALUE_OUT_OF_RANGE,u)}var p=function(e){function t(){var t=e.call(this)||this;return t.__children=o.scorm2004_constants.student_preference_children,t._audio_level="1",t._language="",t._delivery_speed="1",t._audio_captioning="0",t}return(0,i.__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 u(a.scorm2004_errors.READ_ONLY_ELEMENT)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"audio_level",{get:function(){return this._audio_level},set:function(e){m(e,s.scorm2004_regex.CMIDecimal)&&f(e,s.scorm2004_regex.audio_range)&&(this._audio_level=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"language",{get:function(){return this._language},set:function(e){m(e,s.scorm2004_regex.CMILang)&&(this._language=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"delivery_speed",{get:function(){return this._delivery_speed},set:function(e){m(e,s.scorm2004_regex.CMIDecimal)&&f(e,s.scorm2004_regex.speed_range)&&(this._delivery_speed=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"audio_captioning",{get:function(){return this._audio_captioning},set:function(e){m(e,s.scorm2004_regex.CMISInteger)&&f(e,s.scorm2004_regex.text_range)&&(this._audio_captioning=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return delete this.jsonString,e},t}(d.BaseCMI),g=r(589),E={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:s.scorm2004_regex.CMILongIdentifier,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:s.scorm2004_regex.CMILangString250,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:s.scorm2004_regex.CMILangString4000,max:1,delimiter:"",unique:!1},matching:{format:s.scorm2004_regex.CMIShortIdentifier,format2:s.scorm2004_regex.CMIShortIdentifier,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:"^$|"+s.scorm2004_regex.CMIShortIdentifier,format2:s.scorm2004_regex.CMIDecimal+"|^$|"+s.scorm2004_regex.CMIShortIdentifier,max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:s.scorm2004_regex.CMIShortIdentifier,max:36,delimiter:"[,]",unique:!1},likert:{format:s.scorm2004_regex.CMIShortIdentifier,max:1,delimiter:"",unique:!1},numeric:{format:s.scorm2004_regex.CMIDecimal,max:1,delimiter:"",unique:!1},other:{format:s.scorm2004_regex.CMIString4000,max:1,delimiter:"",unique:!1}},y={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:s.scorm2004_regex.CMILongIdentifier},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMILangString250cr},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:s.scorm2004_regex.CMILangString4000},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMIShortIdentifier,format2:s.scorm2004_regex.CMIShortIdentifier},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",delimiter3:"[:]",unique:!1,duplicate:!1,format:"^$|"+s.scorm2004_regex.CMIShortIdentifier,format2:s.scorm2004_regex.CMIDecimal+"|^$|"+s.scorm2004_regex.CMIShortIdentifier},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMIShortIdentifier},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMIShortIdentifier,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMIDecimal,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:s.scorm2004_regex.CMIString4000,limit:1}},b=function(e){function t(){return e.call(this,{children:o.scorm2004_constants.interactions_children,errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u})||this}return(0,i.__extends)(t,e),t}(g.CMIArray),v=function(e){function t(){var t=e.call(this)||this;return t._id="",t._type="",t._timestamp="",t._weighting="",t._learner_response="",t._result="",t._latency="",t._description="",t.objectives=new g.CMIArray({errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u,children:o.scorm2004_constants.objectives_children}),t.correct_responses=new g.CMIArray({errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u,children:o.scorm2004_constants.correct_responses_children}),t}return(0,i.__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(){this._initialized=!1,this._id="",this._type="",this._timestamp="",this._weighting="",this._learner_response="",this._result="",this._latency="",this._description="",this.objectives=new g.CMIArray({errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u,children:o.scorm2004_constants.objectives_children}),this.correct_responses=new g.CMIArray({errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u,children:o.scorm2004_constants.correct_responses_children})},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},set:function(e){m(e,s.scorm2004_regex.CMILongIdentifier)&&(this._id=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},set:function(e){if(this.initialized&&""===this._id)throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);m(e,s.scorm2004_regex.CMIType)&&(this._type=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestamp",{get:function(){return this._timestamp},set:function(e){if(this.initialized&&""===this._id)throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);m(e,s.scorm2004_regex.CMITime)&&(this._timestamp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weighting",{get:function(){return this._weighting},set:function(e){if(this.initialized&&""===this._id)throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);m(e,s.scorm2004_regex.CMIDecimal)&&(this._weighting=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"learner_response",{get:function(){return this._learner_response},set:function(e){var t,r,i,n;if(this.initialized&&(""===this._type||""===this._id))throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);var o=[],s=E[this.type];if(!s)throw new u(a.scorm2004_errors.TYPE_MISMATCH);if((null==s?void 0:s.delimiter)?o=e.split(s.delimiter):o[0]=e,!(o.length>0&&o.length<=s.max))throw new u(a.scorm2004_errors.GENERAL_SET_FAILURE);for(var c=new RegExp(s.format),l=0;l<o.length;l++)if(null==s?void 0:s.delimiter2){var _=null===(t=o[l])||void 0===t?void 0:t.split(s.delimiter2);if(2!==(null==_?void 0:_.length))throw new u(a.scorm2004_errors.TYPE_MISMATCH);if(!(null===(r=_[0])||void 0===r?void 0:r.match(c)))throw new u(a.scorm2004_errors.TYPE_MISMATCH);if(!s.format2||!(null===(i=_[1])||void 0===i?void 0:i.match(new RegExp(s.format2))))throw new u(a.scorm2004_errors.TYPE_MISMATCH)}else{if(!(null===(n=o[l])||void 0===n?void 0:n.match(c)))throw new u(a.scorm2004_errors.TYPE_MISMATCH);if(""!==o[l]&&s.unique)for(var d=0;d<l;d++)if(o[l]===o[d])throw new u(a.scorm2004_errors.TYPE_MISMATCH)}this._learner_response=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"result",{get:function(){return this._result},set:function(e){m(e,s.scorm2004_regex.CMIResult)&&(this._result=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"latency",{get:function(){return this._latency},set:function(e){if(this.initialized&&""===this._id)throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);m(e,s.scorm2004_regex.CMITimespan)&&(this._latency=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._description},set:function(e){if(this.initialized&&""===this._id)throw new u(a.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);m(e,s.scorm2004_regex.CMILangString250,!0)&&(this._description=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var 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},t}(d.BaseCMI),M=function(e){function t(){var t=e.call(this)||this;return t._id="",t}return(0,i.__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){m(e,s.scorm2004_regex.CMILongIdentifier)&&(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}(d.BaseCMI),S=function(e){function t(){var t=e.call(this)||this;return t._pattern="",t}return(0,i.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._pattern=""},Object.defineProperty(t.prototype,"pattern",{get:function(){return this._pattern},set:function(e){m(e,s.scorm2004_regex.CMIFeedback)&&(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}(d.BaseCMI),I=function(e){function t(){var t=e.call(this,{score_children:o.scorm2004_constants.score_children,max:"",invalidErrorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,invalidTypeCode:a.scorm2004_errors.TYPE_MISMATCH,invalidRangeCode:a.scorm2004_errors.VALUE_OUT_OF_RANGE,decimalRegex:s.scorm2004_regex.CMIDecimal,errorClass:u})||this;return t._scaled="",t}return(0,i.__extends)(t,e),t.prototype.reset=function(){this._initialized=!1,this._scaled="",this._raw="",this._min="",this._max=""},Object.defineProperty(t.prototype,"scaled",{get:function(){return this._scaled},set:function(e){m(e,s.scorm2004_regex.CMIDecimal)&&f(e,s.scorm2004_regex.scaled_range)&&(this._scaled=e)},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){this.jsonString=!0;var e={scaled:this.scaled,raw:this.raw,min:this.min,max:this.max};return delete this.jsonString,e},t}(r(434).CMIScore),C=function(e){function t(){return e.call(this,{children:o.scorm2004_constants.comments_children,errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u})||this}return(0,i.__extends)(t,e),t}(g.CMIArray),O=function(e){function t(){return e.call(this,{children:o.scorm2004_constants.comments_children,errorCode:a.scorm2004_errors.READ_ONLY_ELEMENT,errorClass:u})||this}return(0,i.__extends)(t,e),t}(g.CMIArray),w=function(e){function t(t){void 0===t&&(t=!1);var r=e.call(this)||this;return r._comment="",r._location="",r._timestamp="",r._comment="",r._location="",r._timestamp="",r._readOn