scorm-again 3.1.5 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cross-frame-api.js +6 -13
- package/dist/cross-frame-api.js.map +1 -1
- package/dist/cross-frame-api.min.js +1 -1
- package/dist/cross-frame-lms.js +2 -6
- package/dist/cross-frame-lms.js.map +1 -1
- package/dist/esm/scorm-again.js +48 -11
- package/dist/esm/scorm-again.js.map +1 -1
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -1
- package/dist/esm/scorm12.js +46 -10
- package/dist/esm/scorm12.js.map +1 -1
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -1
- package/dist/esm/scorm2004.js +48 -11
- package/dist/esm/scorm2004.js.map +1 -1
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -1
- package/dist/scorm-again.js +697 -1070
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm12.js +293 -406
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm2004.js +597 -911
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/types/BaseAPI.d.ts +1 -1
- package/dist/types/interfaces/services.d.ts +1 -1
- package/dist/types/services/AsynchronousHttpService.d.ts +1 -0
- package/dist/types/services/ErrorHandlingService.d.ts +4 -4
- package/dist/types/services/SynchronousHttpService.d.ts +1 -0
- package/dist/types/types/api_types.d.ts +4 -0
- package/dist/types/utilities/core.d.ts +2 -0
- package/package.json +4 -4
package/dist/scorm2004.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
this.Scorm2004API=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}var r={D:86400,H:3600,M:60,S:1},o=function(e){if(!e||0>=e)return"PT0S";var i="P",n=e;return Object.entries(r).forEach(function(e){var r=t(e,2),o=r[0],a=r[1],s=Math.floor(n/a);(function(e){var t,i,n,r;if(Math.floor(e)===e||0>(null===(n=e+"")||void 0===n||null===(i=n.indexOf)||void 0===i?void 0:i.call(n,".")))return 0;var o=null===(r=(""+e).split("."))||void 0===r?void 0:r[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0})(n%=a)>2&&(n=+(+n).toFixed(2)),"S"===o&&n>0&&(s+=n),s&&((i.indexOf("D")>0||["H","M","S"].includes(o))&&-1===i.indexOf("T")&&(i+="T"),i+="".concat(s).concat(o))}),i},a=u(function(e,i){var n,r,o,a;if("string"==typeof i&&(i=RegExp(i)),!e||!(null==e||null===(r=e.match)||void 0===r?void 0:r.call(e,i)))return 0;var s=t(null!==(n=null===(o=(a=RegExp(i)).exec)||void 0===o?void 0:o.call(a,e))&&void 0!==n?n:[],8),result=0;return result+=+s[7]||0,result+=60*+s[6]||0,result+=3600*+s[5]||0,result+=86400*+s[4]||0,result+=604800*+s[3]||0,(result+=2592e3*+s[2]||0)+(31536e3*+s[1]||0)},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat(null!=e?e:"",":").concat(n)}),s=u(function(e,t){var i;return"string"==typeof t&&(t=RegExp(t)),!(!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))});function l(e){var result={};return function e(t,i){if(Object(t)!==t)result[i]=t;else if(Array.isArray(t))t.forEach(function(t,n){e(t,"".concat(i,"[").concat(n,"]"))}),0===t.length&&(result[i]=[]);else{var n=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),r=0===n.length;n.forEach(function(n){e(t[n],i?"".concat(i,".").concat(n):n)}),r&&i&&(result[i]={})}}(e,""),result}function c(e,t){return"string"==typeof e&&RegExp(t).test(e)}function u(e,t,n){var r=new Map;return function(){for(var o=arguments.length,a=Array(o),s=0;o>s;s++)a[s]=arguments[s];var result,l=t?t.apply(void 0,i(a)):JSON.stringify(a);return void 0!==(null==n?void 0:n.maxKeyLength)&&l.length>n.maxKeyLength?e.apply(void 0,i(a)):r.has(l)?r.get(l):(result=e.apply(void 0,i(a)),void 0===(null==n?void 0:n.maxEntries)||n.maxEntries>r.size||r.delete(r.keys().next().value),r.set(l,result),result)}}var d=function(e,t,i){var n=e.indexOf("#"),r=-1===n?e:e.slice(0,n),o=-1===n?"":e.slice(n),a=r.includes("?")?r.endsWith("?")||r.endsWith("&")?"":"&":"?",s="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i+""));return"".concat(r).concat(a).concat(s).concat(o)};function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function p(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function y(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!result})()}var g=Object.defineProperty,b=function(e,t,i){return function(e,t,i){return t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":p(t))?t+"":t,i)},_=function(){function e(t){v(this,e),b(this,"jsonString",!1),b(this,"_cmi_element"),b(this,"_initialized",!1),this._cmi_element=t}return f(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),S=function(e){function t(){var e;return v(this,t),e=function(e,t,i){return t=h(t),n=e,!(r=y()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))||"object"!==p(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,arguments),b(e,"_start_time"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(t,e),f(t,[{key:"start_time",get:function(){return this._start_time}},{key:"setStartTime",value:function(){if(void 0!==this._start_time)throw Error("Start time has already been set.");this._start_time=(new Date).getTime()}}]),t}(_);function w(e,t,i){return t=E(t),n=e,!(r=T()?Reflect.construct(t,i||[],E(e).constructor):t.apply(e,i))||"object"!==R(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t,i){return O=T()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&j(r,i.prototype),r},O.apply(null,arguments)}function A(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function k(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}function j(e,t){return j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},j(e,t)}function R(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function M(e){var t="function"==typeof Map?new Map:void 0;return M=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return O(e,arguments,E(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),j(i,e)},M(e)}function T(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!result})()}var x=Object.defineProperty,I=function(e,t,i){return function(e,t,i){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":R(t))?t+"":t,i)},P=function(e){function t(e,i){var n;return C(this,t),n=w(this,t,["".concat(e," : ").concat(""+i)]),I(n,"_errorCode"),n._errorCode=i,Object.setPrototypeOf(n,t.prototype),n}return k(t,e),A(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(M(Error)),N=function(e){function t(e,i,n,r){var o;return C(this,t),o=w(this,t,[e,i]),I(o,"_errorMessage"),I(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(n),o._errorMessage=n,r&&(o._detailedMessage=r),Object.setPrototypeOf(o,t.prototype),o}return k(t,e),A(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(P),q="true",D="false",L={cmi_children:"_version,comments_from_learner,comments_from_lms,completion_status,completion_threshold,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time",comments_children:"comment,timestamp,location",score_children:"max,raw,scaled,min",objectives_children:"progress_measure,completion_status,success_status,description,score,id",correct_responses_children:"pattern",student_preference_children:"audio_level,audio_captioning,delivery_speed,language",interactions_children:"id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",adl_data_children:"id,store",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},102:{basicMessage:"General Initialization Failure",detailMessage:"Call to Initialize failed for an unknown reason."},103:{basicMessage:"Already Initialized",detailMessage:"Call to Initialize failed because Initialize was already called."},104:{basicMessage:"Content Instance Terminated",detailMessage:"Call to Initialize failed because Terminate was already called."},111:{basicMessage:"General Termination Failure",detailMessage:"Call to Terminate failed for an unknown reason."},112:{basicMessage:"Termination Before Initialization",detailMessage:"Call to Terminate failed because it was made before the call to Initialize."},113:{basicMessage:"Termination After Termination",detailMessage:"Call to Terminate failed because Terminate was already called."},122:{basicMessage:"Retrieve Data Before Initialization",detailMessage:"Call to GetValue failed because it was made before the call to Initialize."},123:{basicMessage:"Retrieve Data After Termination",detailMessage:"Call to GetValue failed because it was made after the call to Terminate."},132:{basicMessage:"Store Data Before Initialization",detailMessage:"Call to SetValue failed because it was made before the call to Initialize."},133:{basicMessage:"Store Data After Termination",detailMessage:"Call to SetValue failed because it was made after the call to Terminate."},142:{basicMessage:"Commit Before Initialization",detailMessage:"Call to Commit failed because it was made before the call to Initialize."},143:{basicMessage:"Commit After Termination",detailMessage:"Call to Commit failed because it was made after the call to Terminate."},201:{basicMessage:"General Argument Error",detailMessage:"An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument."},301:{basicMessage:"General Get Failure",detailMessage:"Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},351:{basicMessage:"General Set Failure",detailMessage:"Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},391:{basicMessage:"General Commit Failure",detailMessage:"Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information."},401:{basicMessage:"Undefined Data Model Element",detailMessage:"The data model element name passed to GetValue or SetValue is not a valid SCORM data model element."},402:{basicMessage:"Unimplemented Data Model Element",detailMessage:"The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant."},403:{basicMessage:"Data Model Element Value Not Initialized",detailMessage:"Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO."},404:{basicMessage:"Data Model Element Is Read Only",detailMessage:"SetValue was called with a data model element that can only be read."},405:{basicMessage:"Data Model Element Is Write Only",detailMessage:"GetValue was called on a data model element that can only be written to."},406:{basicMessage:"Data Model Element Type Mismatch",detailMessage:"SetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Data Model Element Value Out Of Range",detailMessage:"The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}};function z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e,t,i){return t=B(t),n=e,!(r=H()?Reflect.construct(t,i||[],B(e).constructor):t.apply(e,i))||"object"!=((o=r)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)&&"function"!=typeof r?z(n):r;var n,r,o}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},B(e)}function V(e,t){return V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},V(e,t)}function H(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!result})()}var U={0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},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."}},G=function(e){function t(e,i){var n,r,o,a,s,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(U,i+"")?F(this,t,[e,i,(null===(r=U[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=U[i+""])||void 0===o?void 0:o.detailMessage]):F(this,t,[e,101,null!==(a=null===(s=U[101])||void 0===s?void 0:s.basicMessage)&&void 0!==a?a:"General error",null===(l=U[101])||void 0===l?void 0:l.detailMessage]),Object.setPrototypeOf(z(n),t.prototype),z(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&V(e,t)}(t,e),t}(N);function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e,t,i){return t=W(t),n=e,!(r=X()?Reflect.construct(t,i||[],W(e).constructor):t.apply(e,i))||"object"!=((o=r)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)&&"function"!=typeof r?K(n):r;var n,r,o}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function J(e,t){return J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},J(e,t)}function X(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(X=function(){return!!result})()}var $=L.error_descriptions,Q=function(e){function t(e,i){var n,r,o,a,s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call($,i+"")?Y(this,t,[e,i,(null===(r=$[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=$[i+""])||void 0===o?void 0:o.detailMessage]):Y(this,t,[e,101,(null===(a=$[101])||void 0===a?void 0:a.basicMessage)||"General error",null===(s=$[101])||void 0===s?void 0:s.detailMessage]),Object.setPrototypeOf(K(n),t.prototype),K(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,e),t}(N);function Z(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ee(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Z(e,t,i[t])})}return e}function te(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var ie={GENERAL:101,INITIALIZATION_FAILED:101,INITIALIZED:101,TERMINATED:101,TERMINATION_FAILURE:101,TERMINATION_BEFORE_INIT:101,MULTIPLE_TERMINATION:101,RETRIEVE_BEFORE_INIT:101,RETRIEVE_AFTER_TERM:101,STORE_BEFORE_INIT:101,STORE_AFTER_TERM:101,COMMIT_BEFORE_INIT:101,COMMIT_AFTER_TERM:101,ARGUMENT_ERROR:101,CHILDREN_ERROR:101,COUNT_ERROR:101,GENERAL_GET_FAILURE:101,GENERAL_SET_FAILURE:101,GENERAL_COMMIT_FAILURE:101,UNDEFINED_DATA_MODEL:101,UNIMPLEMENTED_ELEMENT:101,VALUE_NOT_INITIALIZED:101,INVALID_SET_VALUE:101,READ_ONLY_ELEMENT:101,WRITE_ONLY_ELEMENT:101,TYPE_MISMATCH:101,VALUE_OUT_OF_RANGE:101,DEPENDENCY_NOT_ESTABLISHED:101},ne=te(ee({},ie),{RETRIEVE_BEFORE_INIT:301,STORE_BEFORE_INIT:301,COMMIT_BEFORE_INIT:301,ARGUMENT_ERROR:201,CHILDREN_ERROR:202,COUNT_ERROR:203,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:401,VALUE_NOT_INITIALIZED:301,INVALID_SET_VALUE:402,READ_ONLY_ELEMENT:403,WRITE_ONLY_ELEMENT:404,TYPE_MISMATCH:405,VALUE_OUT_OF_RANGE:405,DEPENDENCY_NOT_ESTABLISHED:408}),re=te(ee({},ie),{INITIALIZATION_FAILED:102,INITIALIZED:103,TERMINATED:104,TERMINATION_FAILURE:111,TERMINATION_BEFORE_INIT:112,MULTIPLE_TERMINATION:113,MULTIPLE_TERMINATIONS:113,RETRIEVE_BEFORE_INIT:122,RETRIEVE_AFTER_TERM:123,STORE_BEFORE_INIT:132,STORE_AFTER_TERM:133,COMMIT_BEFORE_INIT:142,COMMIT_AFTER_TERM:143,ARGUMENT_ERROR:201,GENERAL_GET_FAILURE:301,GENERAL_SET_FAILURE:351,GENERAL_COMMIT_FAILURE:391,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:402,VALUE_NOT_INITIALIZED:403,READ_ONLY_ELEMENT:404,WRITE_ONLY_ELEMENT:405,TYPE_MISMATCH:406,VALUE_OUT_OF_RANGE:407,DEPENDENCY_NOT_ESTABLISHED:408});function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ae(e,t){return ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ae(e,t)}function se(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function le(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(le=function(){return!!result})()}var ce=Object.defineProperty,ue=function(e,t,i){return function(e,t,i){return t in e?ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":se(t))?t+"":t,i)},de=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=oe(t),n=e,!(r=le()?Reflect.construct(t,i||[],oe(e).constructor):t.apply(e,i))||"object"!==se(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),ue(i,"_errorCode"),ue(i,"_errorClass"),ue(i,"__children"),ue(i,"childArray"),i.__children=e.children,i._errorCode=null!==(n=e.errorCode)&&void 0!==n?n:ne.GENERAL,i._errorClass=e.errorClass||P,i.childArray=[],i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,e),i=t,n=[{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._initialized=!1,e)this.childArray=[];else for(var t=0;this.childArray.length>t;t++){var i;null===(i=this.childArray[t])||void 0===i||i.reset()}}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this._errorClass(this._cmi_element+"._children",this._errorCode)}},{key:"_count",get:function(){return this.childArray.length},set:function(_count){throw new this._errorClass(this._cmi_element+"._count",this._errorCode)}},{key:"toJSON",value:function(){this.jsonString=!0;for(var result={},e=0;this.childArray.length>e;e++)result[e+""]=this.childArray[e];return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_),ve="unknown",fe="true",he="false",me="passed",pe="failed",ye="unknown",ge="completed",be="incomplete",_e="unknown",Se={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function we(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}var Ce={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:Se.ERROR,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,i;return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,function(n){switch(n.label){case 0:if(void 0===e)return[3,8];t=null,n.label=1;case 1:return n.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=n.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(i=n.sent())&&(t=JSON.parse(i)),n.label=5;case 5:return[3,7];case 6:return n.sent(),[3,7];case 7:return null!==t&&{}.hasOwnProperty.call(t,"result")?[2,{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===q?0:101}]:200===e.status?[2,{result:q,errorCode:0}]:[2,{result:D,errorCode:101}];case 8:return[2,{result:D,errorCode:101}]}})},function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(e){we(o,n,r,a,s,"next",e)}function s(e){we(o,n,r,a,s,"throw",e)}a(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:D,errorCode:101};try{t=JSON.parse(e.responseText)}catch(e){}return null!==t&&{}.hasOwnProperty.call(t,"result")?{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===q?0:101}:{result:q,errorCode:0}}return{result:D,errorCode:101}},requestHandler:function(e){return e},onLogMessage:Oe,mastery_override:!1,score_overrides_status:!1,completion_status_on_failed:"completed",scoItemIds:[],scoItemIdValidator:!1,globalObjectiveIds:[],enableOfflineSupport:!1,courseId:"",syncOnInitialize:!0,syncOnTerminate:!0,maxSyncAttempts:5,scoId:"",autoPopulateCommitMetadata:!1,httpService:null,globalStudentPreferences:!1};function Oe(e,t){switch(e){case"4":case 4:case"ERROR":case Se.ERROR:console.error(t);break;case"3":case 3:case"WARN":case Se.WARN:console.warn(t);break;case"2":case 2:case"INFO":case Se.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case Se.DEBUG:console.debug?console.debug(t):console.log(t)}}var Ae="^-?([0-9]+)$",Ee="^[\\u0000-\\uFFFF]{0,4000}$",ke="^[\\u0000-\\uFFFF]{0,64000}$",je="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",Re="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).*$)?$",Me="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",Te="^(19[7-9][0-9]|[2-9][0-9]{3})((-(0[1-9]|1[0-2]))((-(0[1-9]|[1-2][0-9]|3[0-1]))(T([0-1][0-9]|2[0-3])((:[0-5][0-9])((:[0-5][0-9])((\\.[0-9]{1,6})((Z|([+|-]([0-1][0-9]|2[0-3])))(:[0-5][0-9])?)?)?)?)?)?)?)?$",xe="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$",Ie="^-?([0-9]{1,10})(\\.[0-9]{1,18})?$",Pe="^(?=.*\\w)[\\w\\-\\(\\)\\+\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\%\\/\\#]{1,250}$",Ne="^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",qe="^(completed|incomplete|not attempted|unknown)$",De="^(passed|failed|unknown)$",Le="^(_?(start|resumeAll|previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",ze="^(unknown|true|false)$",Fe="^{target=\\S{0,}[a-zA-Z0-9-_]+}$",Be="^$|"+Pe,Ve="(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}",He={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:Ne,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:je,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:Me,max:1,delimiter:"",unique:!1},matching:{format:Pe,format2:Pe,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:Be,format2:"^(?:|"+Ve+")$",max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:Pe,max:36,delimiter:"[,]",unique:!1},likert:{format:Pe,max:1,delimiter:"",unique:!1},numeric:{format:Ie,max:1,delimiter:"",unique:!1},other:{format:Ee,max:1,delimiter:"",unique:!1}},Ue={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:Ne},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:"^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$"},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:Me},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:Pe,format2:Pe},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:Be,format2:"^(?:|(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?|"+Ve+")$"},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:Pe},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:Pe,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:Ie,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:Ee,limit:1}};function Ge(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}!function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Ge(e,t,i[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var Ke=["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mo","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","sh","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu","aar","abk","ave","afr","aka","amh","arg","ara","asm","ava","aym","aze","bak","bel","bul","bih","bis","bam","ben","tib","bod","bre","bos","cat","che","cha","cos","cre","cze","ces","chu","chv","wel","cym","dan","ger","deu","div","dzo","ewe","gre","ell","eng","epo","spa","est","baq","eus","per","fas","ful","fin","fij","fao","fre","fra","fry","gle","gla","glg","grn","guj","glv","hau","heb","hin","hmo","hrv","hat","hun","arm","hye","her","ina","ind","ile","ibo","iii","ipk","ido","ice","isl","ita","iku","jpn","jav","geo","kat","kon","kik","kua","kaz","kal","khm","kan","kor","kau","kas","kur","kom","cor","kir","lat","ltz","lug","lim","lin","lao","lit","lub","lav","mlg","mah","mao","mri","mac","mkd","mal","mon","mol","mar","may","msa","mlt","bur","mya","nau","nob","nde","nep","ndo","dut","nld","nno","nor","nbl","nav","nya","oci","oji","orm","ori","oss","pan","pli","pol","pus","por","que","roh","run","rum","ron","rus","kin","san","srd","snd","sme","sag","slo","sin","slk","slv","smo","sna","som","alb","sqi","srp","ssw","sot","sun","swe","swa","tam","tel","tgk","tha","tir","tuk","tgl","tsn","ton","tur","tso","tat","twi","tah","uig","ukr","urd","uzb","ven","vie","vol","wln","wol","xho","yid","yor","zha","chi","zho","zul"];function Ye(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}var We=Object.defineProperty,Je=function(e,t,i){return function(e,t,i){return t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xe=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Je(this,"_API"),Je(this,"_cancelled",!1),Je(this,"_timeout"),Je(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),i),this._callback=n}return t=e,i=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Ye(o,n,r,a,s,"next",e)}function s(e){Ye(o,n,r,a,s,"throw",e)}a(void 0)})}).call(this)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),$e=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"];function Qe(e,t,i){return t=it(t),n=e,!(r=st()?Reflect.construct(t,i||[],it(e).constructor):t.apply(e,i))||"object"!==at(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function et(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function tt(e,t,i){return t&&et(e.prototype,t),i&&et(e,i),e}function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},it(e)}function nt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ot(e,t)}function rt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ot(e,t){return ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ot(e,t)}function at(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function st(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(st=function(){return!!result})()}var lt=Object.defineProperty,ct=function(e,t,i){return function(e,t,i){return t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":at(t))?t+"":t,i)},ut=function(e){return e.SKIP="skip",e.DISABLED="disabled",e.HIDE_FROM_CHOICE="hiddenFromChoice",e.STOP_FORWARD_TRAVERSAL="stopForwardTraversal",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.EXIT="exit",e}(ut||{});var dt=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return Ze(this,t),e=Qe(this,t,["ruleCondition"]),ct(e,"_condition","always"),ct(e,"_operator",null),ct(e,"_parameters",new Map),ct(e,"_referencedObjective",null),e._condition=i,e._operator=n,e._parameters=r,e}return nt(t,e),tt(t,[{key:"reset",value:function(){this._initialized=!1,this._condition="always",this._operator=null,this._parameters=new Map}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"operator",get:function(){return this._operator},set:function(e){this._operator=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"referencedObjective",get:function(){return this._referencedObjective},set:function(e){this._referencedObjective=e}},{key:"resolveReferencedObjective",value:function(e){var t,i=this;return this._referencedObjective?(null===(t=e.primaryObjective)||void 0===t?void 0:t.id)===this._referencedObjective?e.primaryObjective:(e.objectives||[]).find(function(e){return e.id===i._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,i=null!==this._referencedObjective,n=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=!(i&&!n)&&(n?n.satisfiedStatusKnown||n.progressStatus?!0===n.satisfiedStatus:"unknown":e.objectiveSatisfiedStatusKnown?!0===e.objectiveSatisfiedStatus:e.successStatus!==ye?e.successStatus===me:"unknown");break;case"objectiveStatusKnown":result=!(i&&!n||(n?!n.satisfiedStatusKnown:!e.objectiveSatisfiedStatusKnown));break;case"objectiveMeasureKnown":result=!(i&&!n||(n?!n.measureStatus:!e.objectiveMeasureStatus));break;case"objectiveMeasureGreaterThan":if(i&&!n){result=!1;break}var r=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?(n?n.normalizedMeasure:e.objectiveNormalizedMeasure)>r:"unknown";break;case"objectiveMeasureLessThan":if(i&&!n){result=!1;break}var o=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?o>(n?n.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(i&&!n)&&(n?n.completionStatus===_e?"unknown":n.completionStatus===ge:e.completionStatus===_e?"unknown":e.completionStatus===ge);break;case"progressKnown":case"activityProgressKnown":result=!(i&&!n)&&(n?n.completionStatus!==_e:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var i=e.timeLimitDuration;if(!i&&e.attemptAbsoluteDurationLimit&&(i=e.attemptAbsoluteDurationLimit),!i)return!1;var n=a(i,xe);if(0>=n)return!1;var r=0;if(t._getElapsedSecondsHook)try{var o=t._getElapsedSecondsHook(e);"number"!=typeof o||Number.isNaN(o)||0>o||(r=o)}catch(e){r=0}if(0===r&&e.attemptExperiencedDuration){var s=a(e.attemptExperiencedDuration,xe);s>0&&(r=s)}if(0===r&&e.attemptAbsoluteStartTime)try{var l=new Date(e.attemptAbsoluteStartTime).getTime(),c=t._now().getTime();Number.isNaN(l)||Number.isNaN(c)||l>c||(r=(c-l)/1e3)}catch(e){r=0}return r>n}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var i=e.beginTimeLimit,n=e.endTimeLimit;if(!i&&!n)return!1;var r=t._now();return!(!i||r>=new Date(i))||!(!n||new Date(n)>=r)}},{key:"parseISO8601Duration",value:function(e){return 1e3*a(e,xe)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,operator:this._operator,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}],[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}]),t}(_);ct(dt,"_now",function(){return new Date}),ct(dt,"_getElapsedSecondsHook");var vt=dt,ft=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"skip",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and";return Ze(this,t),e=Qe(this,t,["sequencingRule"]),ct(e,"_conditions",[]),ct(e,"_action","skip"),ct(e,"_conditionCombination","and"),e._action=i,e._conditionCombination=n,e}return nt(t,e),tt(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[],this._action="skip",this._conditionCombination="and"}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!rt(e,vt))throw new Q(this._cmi_element+".conditions",re.TYPE_MISMATCH);this._conditions.includes(e)||this._conditions.push(e)}},{key:"removeCondition",value:function(e){if(!rt(e,vt))throw new Q(this._cmi_element+".conditions",re.TYPE_MISMATCH);var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"conditionCombination",get:function(){return this._conditionCombination},set:function(e){this._conditionCombination=e}},{key:"evaluate",value:function(e){return!0===(t=this._conditions.map(function(t){return t.evaluate(e)}),i=this._conditionCombination,0!==t.length&&("all"===i||"and"===i?function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!1===s)return!1;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!t||"unknown"}(t):("any"===i||"or"===i)&&function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!0===s)return!0;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!!t&&"unknown"}(t)));var t,i}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,conditionCombination:this._conditionCombination};return this.jsonString=!1,result}}]),t}(_),ht=function(e){function t(){var e;return Ze(this,t),e=Qe(this,t,["sequencingRules"]),ct(e,"_preConditionRules",[]),ct(e,"_exitConditionRules",[]),ct(e,"_postConditionRules",[]),e}return nt(t,e),tt(t,[{key:"reset",value:function(){this._initialized=!1,this._preConditionRules=[],this._exitConditionRules=[],this._postConditionRules=[]}},{key:"preConditionRules",get:function(){return this._preConditionRules}},{key:"addPreConditionRule",value:function(e){if(!rt(e,ft))throw new Q(this._cmi_element+".preConditionRules",re.TYPE_MISMATCH);this._preConditionRules.push(e)}},{key:"exitConditionRules",get:function(){return this._exitConditionRules}},{key:"addExitConditionRule",value:function(e){if(!rt(e,ft))throw new Q(this._cmi_element+".exitConditionRules",re.TYPE_MISMATCH);this._exitConditionRules.push(e)}},{key:"postConditionRules",get:function(){return this._postConditionRules}},{key:"addPostConditionRule",value:function(e){if(!rt(e,ft))throw new Q(this._cmi_element+".postConditionRules",re.TYPE_MISMATCH);this._postConditionRules.push(e)}},{key:"evaluatePreConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluateExitConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._exitConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluatePostConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._postConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={preConditionRules:this._preConditionRules,exitConditionRules:this._exitConditionRules,postConditionRules:this._postConditionRules};return this.jsonString=!1,result}}]),t}(_);var mt=Object.defineProperty,pt=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=t,function(e,t,i){t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="activityTree")?i+"":i,n)}return t=e,(i=[{key:"isInTree",value:function(e){return this.activityTree.getAllActivities().includes(e)}},{key:"isAncestorOf",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){if(!e||!t)return null;for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"findChildInPath",value:function(e,t){for(var i=t;i&&i.parent;){if(i.parent===e)return i;i=i.parent}return null}},{key:"isLastInTree",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"getCurrentInParent",value:function(e){if(e.children){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.isActive)return a}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return null}},{key:"isMandatory",value:function(e){if(e.sequencingRules&&e.sequencingRules.preConditionRules){var t=!0,i=!1,n=void 0;try{for(var r,o=e.sequencingRules.preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if("skip"===a.action&&a.conditions&&0===a.conditions.length)return!1}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return!0===e.mandatory}},{key:"isCompleted",value:function(e){return"completed"===e.completionStatus||"passed"===e.completionStatus||"passed"===e.successStatus}},{key:"isAvailableForChoice",value:function(e){return e.isVisible&&!e.isHiddenFromChoice&&e.isAvailable&&(!e.sequencingControls||e.sequencingControls.choice)}},{key:"getAncestors",value:function(e){for(var t=[],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"getPathToRoot",value:function(e){for(var t=[e],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"isLeaf",value:function(e){return 0===e.children.length}},{key:"isCluster",value:function(e){return e.children.length>0}},{key:"getDepth",value:function(e){for(var t=0,i=e.parent;i;)t++,i=i.parent;return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var yt=Object.defineProperty,gt=function(e,t,i){return function(e,t,i){return t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},bt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),gt(this,"activityTree",t),gt(this,"treeQueries",i)}return t=e,i=[{key:"validateChoice",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.treeQueries.isInTree(t))return{valid:!1,exception:"SB.2.9-2"};if(t===this.activityTree.root)return{valid:!1,exception:"SB.2.9-3"};var n=this.validatePathToRoot(t);if(!n.valid)return n;if(i.checkAvailability&&!t.isAvailable)return{valid:!1,exception:"SB.2.9-7"};if(!e)return{valid:!0,exception:null};var r=this.validateChoiceExit(e,t);if(!r.valid)return r;var o=this.validateAncestorConstraints(e,t);return o.valid?{valid:!0,exception:null}:o}},{key:"validatePathToRoot",value:function(e){for(var t=e;t;){if(t.isHiddenFromChoice)return{valid:!1,exception:"SB.2.9-4"};if(t.parent&&!t.parent.sequencingControls.choice)return{valid:!1,exception:"SB.2.9-5"};if(t.parent&&t.parent.sequencingControls.preventActivation&&0===e.attemptCount&&!e.isActive)return{valid:!1,exception:"SB.2.9-6"};t=t.parent}return{valid:!0,exception:null}}},{key:"validateChoiceExit",value:function(e,t){for(var i=e.parent;i;){if(i.isActive&&!i.sequencingControls.choiceExit){if(!this.treeQueries.isAncestorOf(i,t))return{valid:!1,exception:"SB.2.9-8"};break}i=i.parent}return{valid:!0,exception:null}}},{key:"validateAncestorConstraints",value:function(e,t){for(var i=t.parent;i;){var n=this.validateConstraintsAtLevel(i,e,t);if(!n.valid)return n;i=i.parent}return{valid:!0,exception:null}}},{key:"validateConstraintsAtLevel",value:function(e,t,i){var n=this.treeQueries.findChildInPath(e,i),r=this.treeQueries.findChildInPath(e,t);if(!n||!r)return{valid:!0,exception:null};var o=e.children,a=o.indexOf(n),s=o.indexOf(r);if(-1===a||-1===s)return{valid:!0,exception:null};if(e.sequencingControls.forwardOnly&&s>a)return{valid:!1,exception:"SB.2.9-5"};if(a>s)for(var l=s+1;a>l;l++){var c=o[l];if(c&&this.treeQueries.isMandatory(c)&&!this.treeQueries.isCompleted(c))return{valid:!1,exception:"SB.2.9-6"}}if(e.sequencingControls.constrainChoice){if(a>s+1)return{valid:!1,exception:"SB.2.9-7"};if(s>a&&"completed"!==i.completionStatus&&"passed"!==i.completionStatus)return{valid:!1,exception:"SB.2.9-7"}}return e.sequencingControls.preventActivation&&0===i.attemptCount&&!i.isActive?{valid:!1,exception:"SB.2.9-6"}:{valid:!0,exception:null}}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return{valid:!1,exception:"SB.2.9-5"};t=t.parent}return{valid:!0,exception:null}}},{key:"isAvailableForChoice",value:function(e){return this.treeQueries.isAvailableForChoice(e)}},{key:"validateFlowConstraints",value:function(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;this.meetsFlowConstraints(l,e)&&i.push(l)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{valid:i.length>0,validChildren:i}}},{key:"meetsFlowConstraints",value:function(e,t){return!(!e.isAvailable||e.isHiddenFromChoice)&&(!t.sequencingControls.constrainChoice||this.validateConstrainChoiceForFlow(e,t))}},{key:"validateConstrainChoiceForFlow",value:function(e,t){if(!t.sequencingControls||!t.sequencingControls.constrainChoice)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(t.sequencingControls.flow?t.sequencingControls.forwardOnly&&o>n?"completed"===e.completionStatus||"passed"===e.completionStatus:o>n?o>n&&("completed"===e.completionStatus||"passed"===e.completionStatus)&&this.isAvailableForChoice(e):(n===o||n===o+1)&&this.isAvailableForChoice(e):this.isAvailableForChoice(e)&&("completed"===e.completionStatus||"unknown"===e.completionStatus||"incomplete"===e.completionStatus))}},{key:"validateTraversalConstraints",value:function(e){var t,i,n=!0,r=!0;return(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&(n=this.evaluateConstrainChoiceForTraversal(e)),e.sequencingControls&&e.sequencingControls.stopForwardTraversal&&(r=!1),(null===(i=e.parent)||void 0===i?void 0:i.sequencingControls.forwardOnly)&&(r=this.evaluateForwardOnlyForChoice(e)),{canTraverse:n,canTraverseInto:r}}},{key:"evaluateConstrainChoiceForTraversal",value:function(e){if(!e.parent)return!0;for(var t=e.parent;t;){if(t.sequencingControls&&t.sequencingControls.constrainChoice){var i=t.children,n=this.treeQueries.findChildInPath(t,e);if(n){var r=i.indexOf(n),o=this.treeQueries.getCurrentInParent(t);if(o){var a=i.indexOf(o);if(-1!==a&&-1!==r){if(r>a)for(var s=a+1;r>s;s++){var l=i[s];if(l&&this.treeQueries.isMandatory(l)&&!this.treeQueries.isCompleted(l))return!1}if(t.sequencingControls.forwardOnly&&a>r&&!this.treeQueries.isCompleted(e))return!1}}}}t=t.parent}return this.isAvailableForChoice(e)}},{key:"evaluateForwardOnlyForChoice",value:function(e){if(!e.parent)return!0;var t=e.parent;if(!t.sequencingControls||!t.sequencingControls.forwardOnly)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(o>n?!("completed"!==e.completionStatus&&"passed"!==e.completionStatus||!e.sequencingControls||!e.sequencingControls.choice):this.isAvailableForChoice(e))}},{key:"hasTimeBoundaryViolation",value:function(e,t){if(e.beginTimeLimit)try{if(new Date(e.beginTimeLimit)>t)return!0}catch(e){}if(e.endTimeLimit)try{if(t>new Date(e.endTimeLimit))return!0}catch(e){}return!1}},{key:"hasAttemptLimitViolation",value:function(e){return!(!e.attemptLimit||e.attemptLimit>e.attemptCount)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function _t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var St=Object.defineProperty,wt=function(e,t,i){return function(e,t,i){return t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ct=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e}(Ct||{}),Ot=function(e){return e.DELIVER="deliver",e.DO_NOT_DELIVER="doNotDeliver",e}(Ot||{}),At=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"doNotDeliver",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];_t(this,e),wt(this,"deliveryRequest"),wt(this,"targetActivity"),wt(this,"exception"),wt(this,"endSequencingSession"),this.deliveryRequest=t,this.targetActivity=i,this.exception=n,this.endSequencingSession=r},Et=function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];_t(this,e),wt(this,"identifiedActivity"),wt(this,"deliverable"),wt(this,"exception"),wt(this,"endSequencingSession"),this.identifiedActivity=t,this.deliverable=i,this.exception=n,this.endSequencingSession=r},kt=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_t(this,e),wt(this,"activity"),wt(this,"exception"),this.activity=t,this.exception=i},jt=function(e){return e.FORWARD="forward",e.BACKWARD="backward",e}(jt||{});var Rt=Object.defineProperty,Mt=function(e,t,i){return function(e,t,i){return t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Tt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Mt(this,"now"),Mt(this,"getAttemptElapsedSecondsHook"),this.now=t.now||function(){return new Date},this.getAttemptElapsedSecondsHook=t.getAttemptElapsedSecondsHook||null}return t=e,(i=[{key:"checkSequencingRules",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(this.checkRuleSubprocess(e,s))return s.action}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"checkRuleSubprocess",value:function(e,t){return t.evaluate(e)}},{key:"evaluateExitRules",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.exitConditionRules);return t===ut.EXIT||t===ut.EXIT_PARENT||t===ut.EXIT_ALL?t:null}},{key:"evaluatePostConditionAction",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.postConditionRules);return t&&[ut.EXIT_PARENT,ut.EXIT_ALL,ut.RETRY,ut.RETRY_ALL,ut.CONTINUE,ut.PREVIOUS,ut.STOP_FORWARD_TRAVERSAL].includes(t)?t:null}},{key:"evaluatePostConditions",value:function(e){var t=this.evaluatePostConditionAction(e);if(!t)return{sequencingRequest:null,terminationRequest:null};switch(t){case ut.EXIT_PARENT:return{sequencingRequest:null,terminationRequest:Ct.EXIT_PARENT};case ut.EXIT_ALL:return{sequencingRequest:null,terminationRequest:Ct.EXIT_ALL};case ut.RETRY:return{sequencingRequest:Ct.RETRY,terminationRequest:null};case ut.RETRY_ALL:return{sequencingRequest:Ct.RETRY,terminationRequest:Ct.EXIT_ALL};case ut.CONTINUE:return{sequencingRequest:Ct.CONTINUE,terminationRequest:null};case ut.PREVIOUS:return{sequencingRequest:Ct.PREVIOUS,terminationRequest:null};case ut.STOP_FORWARD_TRAVERSAL:return e.sequencingControls.stopForwardTraversal=!0,{sequencingRequest:null,terminationRequest:null};default:return{sequencingRequest:null,terminationRequest:null}}}},{key:"checkLimitConditions",value:function(e){if(null!==e.attemptLimit&&e.attemptCount>=e.attemptLimit)return!0;if(null!==e.attemptAbsoluteDurationLimit){var t=this.parseDuration(e.attemptAbsoluteDurationLimit);if(t>0&&this.parseDuration(e.attemptExperiencedDuration)>=t)return!0}if(null!==e.activityAbsoluteDurationLimit){var i=this.parseDuration(e.activityAbsoluteDurationLimit);if(i>0&&this.parseDuration(e.activityExperiencedDuration)>=i)return!0}return!1}},{key:"parseDuration",value:function(e){if(!e||"string"!=typeof e)return 0;var t=e.match(/^P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!t||"P"===e||e.endsWith("T"))return 0;var i=0;return i+=315576e5*parseFloat(t[1]||"0"),i+=30.44*24*parseFloat(t[2]||"0")*36e5,i+=6048e5*parseFloat(t[3]||"0"),i+=864e5*parseFloat(t[4]||"0"),i+=36e5*parseFloat(t[5]||"0"),(i+=6e4*parseFloat(t[6]||"0"))+1e3*parseFloat(t[7]||"0")}},{key:"getElapsedSeconds",value:function(e){if(this.getAttemptElapsedSecondsHook)try{return this.getAttemptElapsedSecondsHook(e)||0}catch(e){return 0}if(e.attemptAbsoluteStartTime){var t=new Date(e.attemptAbsoluteStartTime).getTime(),i=this.now().getTime();if(!Number.isNaN(t)&&i>t)return Math.max(0,(i-t)/1e3)}return 0}},{key:"isTimeLimitExceeded",value:function(e){var t=e.timeLimitDuration;if(!t&&e.attemptAbsoluteDurationLimit&&(t=e.attemptAbsoluteDurationLimit),!t)return!1;var i=a(t,xe);return i>0&&this.getElapsedSeconds(e)>i}},{key:"isOutsideAvailableTimeRange",value:function(e){var t=this.now();if(e.beginTimeLimit)try{var i=new Date(e.beginTimeLimit);if(!Number.isNaN(i.getTime())&&i>t)return!0}catch(e){}if(e.endTimeLimit)try{var n=new Date(e.endTimeLimit);if(!Number.isNaN(n.getTime())&&t>n)return!0}catch(e){}return!1}},{key:"canDeliverActivity",value:function(e){if(this.checkLimitConditions(e))return{canDeliver:!1,wasSkipped:!1};var t=this.checkSequencingRules(e,e.sequencingRules.preConditionRules);return{canDeliver:t!==ut.SKIP&&t!==ut.DISABLED,wasSkipped:t===ut.SKIP}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function xt(e){return xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xt(e)}function It(e,t){return It=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},It(e,t)}function Pt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Nt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Nt=function(){return!!result})()}var qt=Object.defineProperty,Dt=function(e,t,i){return function(e,t,i){return t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Pt(t))?t+"":t,i)},Lt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Lt||{}),zt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(zt||{}),Ft=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=xt(t),n=e,!(r=Nt()?Reflect.construct(t,i||[],xt(e).constructor):t.apply(e,i))||"object"!==Pt(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencingControls"]),Dt(e,"_enabled",!0),Dt(e,"_choice",!0),Dt(e,"_choiceExit",!0),Dt(e,"_flow",!0),Dt(e,"_forwardOnly",!1),Dt(e,"_useCurrentAttemptObjectiveInfo",!0),Dt(e,"_useCurrentAttemptProgressInfo",!0),Dt(e,"_preventActivation",!1),Dt(e,"_constrainChoice",!1),Dt(e,"_stopForwardTraversal",!1),Dt(e,"_rollupObjectiveSatisfied",!0),Dt(e,"_rollupProgressCompletion",!0),Dt(e,"_objectiveMeasureWeight",1),Dt(e,"_selectionTiming","never"),Dt(e,"_selectCount",null),Dt(e,"_selectionCountStatus",!1),Dt(e,"_randomizeChildren",!1),Dt(e,"_randomizationTiming","never"),Dt(e,"_reorderChildren",!1),Dt(e,"_completionSetByContent",!1),Dt(e,"_objectiveSetByContent",!1),Dt(e,"_tracked",!0),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&It(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._enabled=!0,this._choice=!0,this._choiceExit=!0,this._flow=!0,this._forwardOnly=!1,this._useCurrentAttemptObjectiveInfo=!0,this._useCurrentAttemptProgressInfo=!0,this._preventActivation=!1,this._constrainChoice=!1,this._stopForwardTraversal=!1,this._rollupObjectiveSatisfied=!0,this._rollupProgressCompletion=!0,this._objectiveMeasureWeight=1,this._selectionTiming="never",this._selectCount=null,this._selectionCountStatus=!1,this._randomizeChildren=!1,this._randomizationTiming="never",this._reorderChildren=!1,this._completionSetByContent=!1,this._objectiveSetByContent=!1,this._tracked=!0}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"choice",get:function(){return this._choice},set:function(e){this._choice=e}},{key:"choiceExit",get:function(){return this._choiceExit},set:function(e){this._choiceExit=e}},{key:"flow",get:function(){return this._flow},set:function(e){this._flow=e}},{key:"forwardOnly",get:function(){return this._forwardOnly},set:function(e){this._forwardOnly=e}},{key:"useCurrentAttemptObjectiveInfo",get:function(){return this._useCurrentAttemptObjectiveInfo},set:function(e){this._useCurrentAttemptObjectiveInfo=e}},{key:"useCurrentAttemptProgressInfo",get:function(){return this._useCurrentAttemptProgressInfo},set:function(e){this._useCurrentAttemptProgressInfo=e}},{key:"preventActivation",get:function(){return this._preventActivation},set:function(e){this._preventActivation=e}},{key:"constrainChoice",get:function(){return this._constrainChoice},set:function(e){this._constrainChoice=e}},{key:"stopForwardTraversal",get:function(){return this._stopForwardTraversal},set:function(e){this._stopForwardTraversal=e}},{key:"rollupObjectiveSatisfied",get:function(){return this._rollupObjectiveSatisfied},set:function(e){this._rollupObjectiveSatisfied=e}},{key:"rollupProgressCompletion",get:function(){return this._rollupProgressCompletion},set:function(e){this._rollupProgressCompletion=e}},{key:"objectiveMeasureWeight",get:function(){return this._objectiveMeasureWeight},set:function(e){0>e||(this._objectiveMeasureWeight=e)}},{key:"isChoiceNavigationAllowed",value:function(){return this._enabled&&!this._constrainChoice}},{key:"isFlowNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isForwardNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isBackwardNavigationAllowed",value:function(){return this._enabled&&this._flow&&!this._forwardOnly}},{key:"selectionTiming",get:function(){return this._selectionTiming},set:function(e){this._selectionTiming=e}},{key:"selectCount",get:function(){return this._selectCount},set:function(e){(null===e||e>0)&&(this._selectCount=e)}},{key:"selectionCountStatus",get:function(){return this._selectionCountStatus},set:function(e){this._selectionCountStatus=e}},{key:"randomizeChildren",get:function(){return this._randomizeChildren},set:function(e){this._randomizeChildren=e}},{key:"randomizationTiming",get:function(){return this._randomizationTiming},set:function(e){this._randomizationTiming=e}},{key:"reorderChildren",get:function(){return this._reorderChildren},set:function(e){this._reorderChildren=e}},{key:"completionSetByContent",get:function(){return this._completionSetByContent},set:function(e){this._completionSetByContent=e}},{key:"objectiveSetByContent",get:function(){return this._objectiveSetByContent},set:function(e){this._objectiveSetByContent=e}},{key:"tracked",get:function(){return this._tracked},set:function(e){this._tracked=e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={enabled:this._enabled,choice:this._choice,choiceExit:this._choiceExit,flow:this._flow,forwardOnly:this._forwardOnly,useCurrentAttemptObjectiveInfo:this._useCurrentAttemptObjectiveInfo,useCurrentAttemptProgressInfo:this._useCurrentAttemptProgressInfo,preventActivation:this._preventActivation,constrainChoice:this._constrainChoice,stopForwardTraversal:this._stopForwardTraversal,rollupObjectiveSatisfied:this._rollupObjectiveSatisfied,rollupProgressCompletion:this._rollupProgressCompletion,objectiveMeasureWeight:this._objectiveMeasureWeight,selectionTiming:this._selectionTiming,selectCount:this._selectCount,selectionCountStatus:this._selectionCountStatus,randomizeChildren:this._randomizeChildren,randomizationTiming:this._randomizationTiming,reorderChildren:this._reorderChildren,completionSetByContent:this._completionSetByContent,objectiveSetByContent:this._objectiveSetByContent,tracked:this._tracked};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Vt(e){return function(e){if(Array.isArray(e))return Bt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Bt(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Bt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ht=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,i=Vt(e.children);if(t.selectionTiming===Lt.NEVER)return i;if(t.selectionTiming===Lt.ONCE&&t.selectionCountStatus)return i;if(t.selectionTiming!==Lt.ONCE&&!t.selectionCountStatus)return i;var n=t.selectCount;if(null===n||n>=i.length)return t.selectionTiming===Lt.ONCE&&(t.selectionCountStatus=!0),i;for(var r=[],o=i.map(function(e,t){return t}),a=0;n>a&&0!==o.length;a++){var s=Math.floor(Math.random()*o.length),l=o[s];void 0!==l&&i[l]&&r.push(i[l]),o.splice(s,1)}t.selectionTiming===Lt.ONCE&&(t.selectionCountStatus=!0);var c=!0,u=!1,d=void 0;try{for(var v,f=i[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;r.includes(h)||(h.isHiddenFromChoice=!0,h.isAvailable=!1)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return r}},{key:"randomizeChildrenProcess",value:function(e){var t,i=e.sequencingControls,n=Vt(e.children);if(i.randomizationTiming===zt.NEVER)return n;if(i.randomizationTiming===zt.ONCE&&i.reorderChildren)return n;if(!i.randomizeChildren)return n;for(var r=Vt(n),o=r.length-1;o>0;o--){var a=Math.floor(Math.random()*(o+1)),s=r[o],l=r[a];s&&l&&(r[o]=l,r[a]=s)}return i.randomizationTiming===zt.ONCE&&(i.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Vt(r)),r}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var n=!1,r=!1;i.selectionTiming===Lt.ON_EACH_NEW_ATTEMPT?(n=t,t&&(i.selectionCountStatus=!0)):i.selectionTiming===Lt.ONCE&&(n=!i.selectionCountStatus),i.randomizationTiming===zt.ON_EACH_NEW_ATTEMPT?(r=t,t&&(i.reorderChildren=!1)):i.randomizationTiming===zt.ONCE&&(r=!i.reorderChildren),n&&this.selectChildrenProcess(e),r&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==Lt.NEVER&&(t.selectionTiming!==Lt.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==zt.NEVER&&(t.randomizationTiming!==zt.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t,i),e;var t,i}();var Ut=Object.defineProperty,Gt=function(e,t,i){return function(e,t,i){return t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Kt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gt(this,"activityTree",t),Gt(this,"ruleEngine",i)}return t=e,i=[{key:"flowSubprocess",value:function(e,t){for(var i=e,n=!0,r=!1,o=t,a=null;i;){var s=this.flowTreeTraversalSubprocess(i,o,n,a);if(!s.activity){var l=null;return s.exception?l=s.exception:t===jt.BACKWARD?l="SB.2.1-3":r&&(l="SB.2.1-2"),new Et(i,!1,l,s.endSequencingSession)}var c=s.direction||o;s.forwardOnlyCluster&&(a=s.forwardOnlyCluster),r=s.activity.children.length>0&&0===s.activity.getAvailableChildren().length;var u=this.flowActivityTraversalSubprocess(s.activity,c===jt.FORWARD,!0,c);if(u)return new Et(u,!0,null,!1);i=s.activity,o=c,n=!1}return new Et(null,!1,null,!1)}},{key:"flowTreeTraversalSubprocess",value:function(e,t){return t===jt.FORWARD?this.traverseForward(e,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:null):this.traverseBackward(e)}},{key:"traverseForward",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&!this.isDescendantOfOrSelf(e,i))return{activity:null,endSequencingSession:!1};if(!i&&t&&this.isActivityLastOverall(e))return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0};if(!t){this.ensureSelectionAndRandomization(e);var n=e.getAvailableChildren();if(n.length>0)return{activity:n[0]||null,endSequencingSession:!1}}for(var r=e;r;){var o=this.activityTree.getNextSibling(r);if(o)return{activity:o,endSequencingSession:!1};if(i&&(r===i||r.parent===i))return{activity:null,endSequencingSession:!1};r=r.parent}return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0}}},{key:"traverseBackward",value:function(e){if(e.parent&&e.parent.sequencingControls.forwardOnly)return{activity:null,endSequencingSession:!1,exception:"SB.2.1-4"};var t=this.activityTree.getPreviousSibling(e);if(t)return this.getBackwardTraversalEntry(t);for(var i=e,n=0;i&&i.parent;){if(++n>1e4)throw Error("Infinite loop detected in backward traversal");var r=this.activityTree.getPreviousSibling(i.parent);if(r)return this.getBackwardTraversalEntry(r);i=i.parent}return{activity:null,endSequencingSession:!1}}},{key:"getBackwardTraversalEntry",value:function(e){for(var t=e,i=0;;){if(++i>1e4)throw Error("Infinite loop detected while getting backward traversal entry");this.ensureSelectionAndRandomization(t);var n=t.getAvailableChildren();if(0===n.length)break;if(t.sequencingControls.forwardOnly)return{activity:n[0]||null,endSequencingSession:!1,direction:jt.FORWARD,forwardOnlyCluster:t};var r=n[n.length-1];if(!r)break;t=r}return{activity:t,endSequencingSession:!1}}},{key:"isDescendantOfOrSelf",value:function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parent}return!1}},{key:"flowActivityTraversalSubprocess",value:function(e,t,i,mode){var n=e.parent;if(n&&!n.sequencingControls.flow)return null;if(!e.isAvailable)return null;if(mode===jt.FORWARD&&e.sequencingControls.stopForwardTraversal)return null;if(i){this.ensureSelectionAndRandomization(e);var r=e.getAvailableChildren(),o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=this.flowActivityTraversalSubprocess(l.value,mode===jt.FORWARD,!0,mode);if(u)return u}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}return 0===e.children.length&&this.checkActivityProcess(e)?e:null}},{key:"checkActivityProcess",value:function(e){if(!e.isAvailable)return!1;if(0===e.children.length&&!e.isVisible)return!1;if(this.ruleEngine.checkLimitConditions(e))return!1;var t=this.ruleEngine.canDeliverActivity(e);return e.wasSkipped=t.wasSkipped,t.canDeliver}},{key:"ensureSelectionAndRandomization",value:function(e){e.getAvailableChildren()===e.children&&(Ht.isSelectionNeeded(e)||Ht.isRandomizationNeeded(e))&&Ht.applySelectionAndRandomization(e,e.isNewAttempt)}},{key:"isActivityLastOverall",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"findFirstDeliverableActivity",value:function(e){if(0===e.children.length)return this.checkActivityProcess(e)?e:null;this.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.flowActivityTraversalSubprocess(o.value,!0,!0,jt.FORWARD);if(s)return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"canDeliver",value:function(e){return this.checkActivityProcess(e)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Yt=Object.defineProperty,Wt=function(e,t,i){return function(e,t,i){return t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Jt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Wt(this,"activityTree",t),Wt(this,"traversalService",i)}return t=e,(i=[{key:"handleStart",value:function(){var result=new At;if(!this.activityTree.root)return result.exception="SB.2.5-1",result;if(this.activityTree.currentActivity)return result.exception="SB.2.5-2",result;var e=this.traversalService.findFirstDeliverableActivity(this.activityTree.root);return e?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=e,result):(result.exception="SB.2.5-3",result)}},{key:"handleResumeAll",value:function(){var result=new At;return this.activityTree.suspendedActivity?this.activityTree.currentActivity?(result.exception="SB.2.6-2",result):(result.deliveryRequest=Ot.DELIVER,result.targetActivity=this.activityTree.suspendedActivity,result):(result.exception="SB.2.6-1",result)}},{key:"handleContinue",value:function(e){var result=new At;if(e.isActive)return result.exception="SB.2.7-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.7-2",result;var t=this.traversalService.flowSubprocess(e,jt.FORWARD);return result.endSequencingSession=t.endSequencingSession,t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.7-2",result)}},{key:"handlePrevious",value:function(e){var result=new At;if(e.isActive)return result.exception="SB.2.8-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.8-2",result;var t=this.checkForwardOnlyViolation(e);if(t)return result.exception=t,result;var i=this.traversalService.flowSubprocess(e,jt.BACKWARD);return i.deliverable&&i.identifiedActivity?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=i.identifiedActivity,result):(result.exception=i.exception||"SB.2.8-3",result)}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return"SB.2.9-5";t=t.parent}return null}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Xt=Object.defineProperty,$t=function(e,t,i){return function(e,t,i){return t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Qt=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$t(this,"activityTree",t),$t(this,"constraintValidator",i),$t(this,"traversalService",n),$t(this,"treeQueries",r)}return t=e,i=[{key:"handleChoice",value:function(e,t){var result=new At,i=this.activityTree.getActivity(e);if(!i)return result.exception="SB.2.9-1",result;if(t&&t.isActive)return result.exception="SB.2.9-6",result;var n=this.constraintValidator.validateChoice(t,i,{checkAvailability:!0});if(!n.valid)return result.exception=n.exception,result;var r=this.treeQueries.findCommonAncestor(t,i);t&&this.terminateDescendentAttemptsProcess(r||this.activityTree.root);var o=this.buildActivityPath(i,r),a=!0,s=!1,l=void 0;try{for(var c,u=o[Symbol.iterator]();!(a=(c=u.next()).done);a=!0)if(!this.traversalService.checkActivityProcess(c.value))return result}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}var d=i;if(i.children.length>0){var v=this.choiceFlowSubprocess(i);if(!v)return result.exception="SB.2.9-7",result;d=v}return result.deliveryRequest=Ot.DELIVER,result.targetActivity=d,result}},{key:"handleJump",value:function(e){var result=new At,t=this.activityTree.getActivity(e);return t?this.treeQueries.isInTree(t)?t.isAvailable?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.13-3",result):(result.exception="SB.2.13-2",result):(result.exception="SB.2.13-1",result)}},{key:"getAvailableChoices",value:function(){var e=this.activityTree.getAllActivities(),t=this.activityTree.currentActivity,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l!==this.activityTree.root&&!l.isHiddenFromChoice&&l.isAvailable&&l.isVisible&&(l.parent&&!l.parent.sequencingControls.choice||this.constraintValidator.validateChoice(t,l).valid&&i.push(l))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"buildActivityPath",value:function(e,t){for(var i=[],n=e;n&&n!==t;)i.unshift(n),n=n.parent;return i}},{key:"choiceFlowSubprocess",value:function(e){return 0===e.children.length?e:this.choiceFlowTreeTraversal(e)}},{key:"choiceFlowTreeTraversal",value:function(e){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=this.constraintValidator.validateFlowConstraints(e,t);if(!i.valid)return null;var n=!0,r=!1,o=void 0;try{for(var a,s=i.validChildren[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=this.enhancedChoiceTraversal(a.value);if(l.activity)return l.activity}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return null}},{key:"enhancedChoiceTraversal",value:function(e){var t;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&e===this.activityTree.root)return new kt(null,"SB.2.4-3");if(!e.isAvailable)return new kt(null,null);if(e.isHiddenFromChoice)return new kt(null,null);if(e.sequencingControls&&e.sequencingControls.stopForwardTraversal)return new kt(null,"SB.2.4-1");var i=this.constraintValidator.validateTraversalConstraints(e);if(!i.canTraverse)return new kt(null,null);if(0===e.children.length)return this.traversalService.checkActivityProcess(e)?new kt(e,null):new kt(null,null);if((null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&!i.canTraverseInto)return new kt(null,"SB.2.4-2");if(i.canTraverseInto){var n=this.choiceFlowTreeTraversal(e);return new kt(n,null)}return new kt(null,null)}},{key:"terminateDescendentAttemptsProcess",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttemptsProcess(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Zt=Object.defineProperty,ei=function(e,t,i){return function(e,t,i){return t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ti=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ei(this,"activityTree",t),ei(this,"ruleEngine",i)}return t=e,i=[{key:"handleExit",value:function(e){var result=new At;return e.parent?e.parent.sequencingControls.choiceExit?(this.terminateDescendentAttempts(e),result):(result.exception="SB.2.11-2",result):(result.exception="SB.2.11-1",result)}},{key:"handleExitAll",value:function(){var result=new At;return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),result}},{key:"handleAbandon",value:function(e){var result=new At;return e.isActive=!1,this.activityTree.currentActivity=e.parent,result}},{key:"handleAbandonAll",value:function(){var result=new At;return this.activityTree.currentActivity=null,result}},{key:"handleSuspendAll",value:function(e){var result=new At;return e===this.activityTree.root?(result.exception="SB.2.15-1",result):(e.isSuspended=!0,this.activityTree.suspendedActivity=e,this.activityTree.currentActivity=null,result)}},{key:"terminateDescendentAttempts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;t||(i=this.ruleEngine.evaluateExitRules(e)),e.isActive=!1;var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.terminateDescendentAttempts(a.value,t)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}i&&!t&&this.processDeferredExitAction(i,e)}},{key:"processDeferredExitAction",value:function(e,t){switch(e){case ut.EXIT:break;case ut.EXIT_PARENT:t.parent&&t.parent.isActive&&this.terminateDescendentAttempts(t.parent,!0);break;case ut.EXIT_ALL:this.activityTree.root&&this.activityTree.root!==t&&this.activityTree.getAllActivities().some(function(e){return e.isActive})&&this.terminateDescendentAttempts(this.activityTree.root,!0)}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ii=Object.defineProperty,ni=function(e,t,i){return function(e,t,i){return t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ri=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ni(this,"activityTree",t),ni(this,"traversalService",i)}return t=e,(i=[{key:"handleRetry",value:function(e){var result=new At;if(e.isActive||e.isSuspended)return result.exception="SB.2.10-2",result;if(e.children.length>0){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=null,n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&!(i=this.traversalService.flowActivityTraversalSubprocess(a.value,!0,!0,jt.FORWARD));n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=i,result):(result.exception="SB.2.10-3",result)}return this.terminateDescendentAttempts(e),result.deliveryRequest=Ot.DELIVER,result.targetActivity=e,result}},{key:"handleRetryAll",value:function(){if(this.activityTree.currentActivity=null,!this.activityTree.root){var e=new At;return e.exception="SB.2.10-1",e}var t=this.traversalService.findFirstDeliverableActivity(this.activityTree.root),result=new At;return t?(result.deliveryRequest=Ot.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.10-3",result)}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var oi=Object.defineProperty,ai=function(e,t,i){return function(e,t,i){return t in e?oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},si=function(){function e(t,i,n){var r=arguments.length>4?arguments[4]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ai(this,"activityTree"),ai(this,"treeQueries"),ai(this,"constraintValidator"),ai(this,"ruleEngine"),ai(this,"traversalService"),ai(this,"flowHandler"),ai(this,"choiceHandler"),ai(this,"exitHandler"),ai(this,"retryHandler"),ai(this,"_now"),ai(this,"_getAttemptElapsedSecondsHook"),this.activityTree=t,this._now=(null==r?void 0:r.now)||function(){return new Date},this._getAttemptElapsedSecondsHook=null==r?void 0:r.getAttemptElapsedSeconds,this.treeQueries=new pt(t),this.ruleEngine=new Tt({now:this._now,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.constraintValidator=new bt(t,this.treeQueries),this.traversalService=new Kt(t,this.ruleEngine),this.flowHandler=new Jt(t,this.traversalService),this.choiceHandler=new Qt(t,this.constraintValidator,this.traversalService,this.treeQueries),this.exitHandler=new ti(t,this.ruleEngine),this.retryHandler=new ri(t,this.traversalService)}return t=e,i=[{key:"now",get:function(){return this._now},set:function(e){this._now=e,vt.setNowProvider(e),this.ruleEngine=new Tt({now:e,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.traversalService=new Kt(this.activityTree,this.ruleEngine),this.flowHandler=new Jt(this.activityTree,this.traversalService),this.choiceHandler=new Qt(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new ri(this.activityTree,this.traversalService)}},{key:"getAttemptElapsedSecondsHook",get:function(){return this._getAttemptElapsedSecondsHook},set:function(e){this._getAttemptElapsedSecondsHook=e,vt.setElapsedSecondsHook(e),this.ruleEngine=new Tt({now:this._now,getAttemptElapsedSecondsHook:e}),this.traversalService=new Kt(this.activityTree,this.ruleEngine),this.flowHandler=new Jt(this.activityTree,this.traversalService),this.choiceHandler=new Qt(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new ri(this.activityTree,this.traversalService)}},{key:"sequencingRequestProcess",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=this.activityTree.currentActivity;switch(request){case Ct.START:return this.flowHandler.handleStart();case Ct.RESUME_ALL:return this.flowHandler.handleResumeAll();case Ct.CONTINUE:return t?this.flowHandler.handleContinue(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.PREVIOUS:return t?this.flowHandler.handlePrevious(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.CHOICE:return e?this.choiceHandler.handleChoice(e,t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-5");case Ct.JUMP:return e?this.choiceHandler.handleJump(e):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-5");case Ct.EXIT:return t?this.exitHandler.handleExit(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.EXIT_ALL:return t?this.exitHandler.handleExitAll():new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.ABANDON:return t?this.exitHandler.handleAbandon(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.ABANDON_ALL:return t?this.exitHandler.handleAbandonAll():new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.SUSPEND_ALL:return t?this.exitHandler.handleSuspendAll(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.RETRY:return t?this.retryHandler.handleRetry(t):new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-1");case Ct.RETRY_ALL:return this.retryHandler.handleRetryAll();default:return new At(Ot.DO_NOT_DELIVER,null,"SB.2.12-6")}}},{key:"evaluatePostConditionRules",value:function(e){return this.ruleEngine.evaluatePostConditions(e)}},{key:"canActivityBeDelivered",value:function(e){return this.traversalService.canDeliver(e)}},{key:"validateNavigationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!Object.values(Ct).includes(request))return{valid:!1,exception:"SB.2.12-6"};switch(request){case Ct.CONTINUE:case Ct.PREVIOUS:if(!t)return{valid:!1,exception:"SB.2.12-1"};if(t.isActive)return{valid:!1,exception:request===Ct.CONTINUE?"SB.2.7-1":"SB.2.8-1"};if(t.parent&&!t.parent.sequencingControls.flow)return{valid:!1,exception:request===Ct.CONTINUE?"SB.2.7-2":"SB.2.8-2"};if(request===Ct.PREVIOUS){var i=this.constraintValidator.checkForwardOnlyViolation(t);if(!i.valid)return i}break;case Ct.CHOICE:if(!e)return{valid:!1,exception:"SB.2.12-5"};var n=this.activityTree.getActivity(e);if(!n)return{valid:!1,exception:"SB.2.9-1"};var r=this.constraintValidator.validateChoice(t,n,{checkAvailability:!0});if(!r.valid)return r;if(!this.traversalService.canDeliver(n))return{valid:!1,exception:"SB.2.9-6"};if(this.ruleEngine.checkSequencingRules(n,n.sequencingRules.preConditionRules)===ut.HIDE_FROM_CHOICE)return{valid:!1,exception:"SB.2.9-4"};break;case Ct.JUMP:if(!e)return{valid:!1,exception:"SB.2.12-5"};if(!this.activityTree.getActivity(e))return{valid:!1,exception:"SB.2.13-1"}}return{valid:!0,exception:null}}},{key:"getAvailableChoices",value:function(){return this.choiceHandler.getAvailableChoices()}},{key:"getTreeQueries",value:function(){return this.treeQueries}},{key:"getConstraintValidator",value:function(){return this.constraintValidator}},{key:"getRuleEngine",value:function(){return this.ruleEngine}},{key:"getTraversalService",value:function(){return this.traversalService}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function li(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var ci=Object.defineProperty,ui=function(e,t,i){return function(e,t,i){return t in e?ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},di=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ui(this,"eventService"),ui(this,"loggingService"),ui(this,"callbacks"),ui(this,"currentDeliveredActivity",null),ui(this,"pendingDelivery",null),this.eventService=t,this.loggingService=i,this.callbacks=n}return t=e,i=[{key:"processSequencingResult",value:function(result){var e,t,i,n;if(result.exception)return this.loggingService.error("Sequencing error: ".concat(result.exception)),void(null===(i=(n=this.callbacks).onSequencingError)||void 0===i||i.call(n,result.exception));result.deliveryRequest===Ot.DELIVER&&result.targetActivity?this.deliverActivity(result.targetActivity):this.loggingService.info("Sequencing completed with no delivery request"),null===(e=(t=this.callbacks).onSequencingComplete)||void 0===e||e.call(t,result)}},{key:"deliverActivity",value:function(e){var t,i;this.currentDeliveredActivity!==e?(this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.pendingDelivery=e,this.loggingService.info("Delivering activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityDelivery",e.id,e),null===(t=(i=this.callbacks).onDeliverActivity)||void 0===t||t.call(i,e),this.currentDeliveredActivity=e,this.pendingDelivery=null,e.isActive=!0):this.loggingService.info("Skipping delivery - activity already delivered: ".concat(e.id))}},{key:"unloadActivity",value:function(e){var t,i;this.loggingService.info("Unloading activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityUnload",e.id,e),null===(t=(i=this.callbacks).onUnloadActivity)||void 0===t||t.call(i,e),e.isActive=!1}},{key:"getCurrentDeliveredActivity",value:function(){return this.currentDeliveredActivity}},{key:"getPendingDelivery",value:function(){return this.pendingDelivery}},{key:"updateCallbacks",value:function(e){this.callbacks=function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){li(e,t,i[t])})}return e}({},this.callbacks,e)}},{key:"reset",value:function(){this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.currentDeliveredActivity=null,this.pendingDelivery=null}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function vi(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function fi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){vi(o,n,r,a,s,"next",e)}function s(e){vi(o,n,r,a,s,"throw",e)}a(void 0)})}}function hi(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function mi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function pi(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){hi(e,t,i[t])})}return e}function yi(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var gi=Object.defineProperty,bi=function(e,t,i){return function(e,t,i){return t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},_i=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),bi(this,"reportsRequestCompletion",!0),bi(this,"settings"),bi(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){return this._performAsyncRequest(e,t,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0),{result:q,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,i,n,r,o,a){return fi(function(){var s,l,c,result,u,d;return yi(this,function(v){switch(v.label){case 0:return v.trys.push([0,6,7,8]),s=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),l=s,i&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,l)]:[3,2];case 1:return c=v.sent(),[3,4];case 2:return[4,this.performFetch(e,l)];case 3:c=v.sent(),v.label=4;case 4:return[4,this.transformResponse(c,r)];case 5:return result=v.sent(),this._isSuccessResponse(c,result)?r("CommitSuccess"):r("CommitError",void 0,result.errorCode),[3,8];case 6:return u=v.sent(),d=mi(u,Error)?u.message:u+"",n("processHttpRequest","Async request failed: ".concat(d),Se.ERROR),r("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==a||a(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:mi(e,Array)?e.join("&"):JSON.stringify(e),contentType:mi(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return fi(function(){var i,n,r;return yi(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(i=this._prepareRequestBody(t),n=i.contentType,r={method:"POST",mode:this.settings.fetchMode,body:i.body,headers:(a=pi({},this.settings.xhrHeaders),s={"Content-Type":n},s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),keepalive:!0},this.settings.xhrWithCredentials&&(r.credentials="include"),[2,fetch(e,r)]);var a,s})}).call(this)}},{key:"performBeacon",value:function(e,t){return fi(function(){var i,n,r;return yi(this,function(o){return i=this,n=this._prepareRequestBody(t),r=navigator.sendBeacon(e,new Blob([n.body],{type:n.contentType})),[2,Promise.resolve({status:r?200:0,ok:r,json:function(){return fi(function(){return yi(this,function(e){return[2,{result:r?"true":"false",errorCode:r?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(i)},text:function(){return fi(function(){return yi(this,function(e){return[2,JSON.stringify({result:r?"true":"false",errorCode:r?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(i)}})]})}).call(this)}},{key:"transformResponse",value:function(e,t){return fi(function(){var result,t,i,n;return yi(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=r.sent(),[3,4];case 2:return[4,e.json()];case 3:t=r.sent(),r.label=4;case 4:return result=t,[3,7];case 5:return i=r.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return n=r.sent(),[2,{result:D,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(mi(i,Error)?i.message:i+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:n.substring(0,500),parseError:mi(i,Error)?i.message:i+""})}];case 7:return Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this._isSuccessResponse(e,result)?0:this.error_codes.GENERAL_COMMIT_FAILURE||391),this._isSuccessResponse(e,result)||(result.errorDetails=pi({status:e.status,statusText:e.statusText,url:e.url},result.errorDetails)),[2,result]}})}).call(this)}},{key:"_isSuccessResponse",value:function(e,result){var t=result.result;return!(200>e.status||e.status>299||!0!==t&&"true"!==t&&t!==q)}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Si(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var wi=Object.defineProperty,Ci="{target=";function Oi(e,t){var i,n=e[t];return void 0===n?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(i=e.GENERAL)&&void 0!==i?i:0):n}var Ai=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"getUndefinedDataModelErrorCode",value:function(){return Oi(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,i,n){if(!i||""===i)return t&&this.context.throwSCORMError(i,Oi(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),D;this.context.setLastErrorCode("0");for(var r=i.split("."),o=this.context.getDataModel(),a=D,s=!1,l="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),u=0;r.length>u;u++){if(u===r.length-1){a=this.setFinalAttribute(o,r[u],n,i,t,c,l);break}var d=this.traverseToNextLevel(o,r,u,n,i,t,s,c,l);if(d.error)break;o=d.refObject,u=d.idx,s=d.foundFirstIndex}return a===D&&this.context.apiLog(e,"There was an error setting the value for: ".concat(i,", value of: ").concat(n),Se.WARN),a}},{key:"getCMIValue",value:function(e,t,i){if(!i||""===i)return t&&this.context.throwSCORMError(i,Oi(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&i.endsWith("._version")&&"cmi._version"!==i)return this.context.throwSCORMError(i,Oi(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var n=i.split("."),r=this.context.getDataModel(),o=null,a="The data model element passed to ".concat(e," (").concat(i,") has not been initialized."),s="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),c=0;n.length>c;c++){var u=this.validateGetAttribute(r,o=n[c],i,t,l,s,c===n.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(i,l,s);break}if(void 0===(r=r[o])){this.context.throwSCORMError(i,l,s);break}if(Si(r,de)){var d=this.handleGetArrayAccess(r,n,c,i,a);if(d.error)return"";r=d.refObject,c=d.idx}}return null==r?(t||("_children"===o?this.context.throwSCORMError(i,Oi(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(i,Oi(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):r}},{key:"setFinalAttribute",value:function(e,t,i,n,r,o,a){return r&&(null==t?void 0:t.startsWith(Ci))?this.context.isInitialized()?(this.context.throwSCORMError(n,Oi(this.context.errorCodes,"READ_ONLY_ELEMENT")),D):q:void 0!==t&&this.context.checkObjectHasProperty(e,t)?c(n,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(n,i),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(n,Oi(this.context.errorCodes,"TYPE_MISMATCH")),D):r&&"0"!==this.context.getLastErrorCode()?D:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(n,o,a),D):r&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(n,i)?(this.context.throwSCORMError(n,Oi(this.context.errorCodes,"GENERAL_SET_FAILURE")),D):(e[t]=i,q):(this.context.throwSCORMError(n,o,a),D)}},{key:"traverseToNextLevel",value:function(e,t,i,n,r,o,a,s,l){var c=t[i];if(void 0===c||!this.context.checkObjectHasProperty(e,c))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(!(e=e[c]))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(Si(e,de)){var u=this.handleSetArrayAccess(e,t,i,n,r,o,a,s,l);return u.error?{refObject:e,idx:i,foundFirstIndex:a,error:!0}:u}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,i,n,r,o,a,s,l){var c=parseInt(t[i+1]||"0",10);if(!isNaN(c)){var u=e.childArray[c];if(u)return{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1};if(c>e.childArray.length){var d=o?Oi(this.context.errorCodes,"GENERAL_SET_FAILURE"):Oi(this.context.errorCodes,"INVALID_SET_VALUE")||Oi(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(r,d,"Cannot set array element at index ".concat(c,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:i,foundFirstIndex:a,error:!0}}var v=this.context.getChildElement(r,n,a);return v?(e.initialized&&v.initialize(),e.childArray[c]=v,{refObject:v,idx:i+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0})}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"validateGetAttribute",value:function(e,t,i,n,r,o,a){if(n){var s=t+"";if(s.startsWith(Ci)&&"function"==typeof e._isTargetValid){var l=s.substring(8,s.length-1);return{error:!1,returnValue:e._isTargetValid(l)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(i,Oi(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(i,Oi(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element is not a collection and therefore does not have a count"),{error:!0}):(this.context.throwSCORMError(i,r,o),{error:!0})}else if(a&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(i,Oi(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(i,Oi(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(i,r,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,i,n,r){var o=parseInt(t[i+1]||"",10);if(!isNaN(o)){var a=e.childArray[o];return a?{refObject:a,idx:i+1,error:!1}:(this.context.throwSCORMError(n,Oi(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),r),{refObject:e,idx:i,error:!0})}return{refObject:e,idx:i,error:!1}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ei(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var ki=Object.defineProperty,ji=function(e,t,i){return function(e,t,i){return t in e?ki(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ri=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ji(this,"_logLevel",Se.ERROR),ji(this,"_logHandler"),this._logHandler=Oe}var t,i,n;return t=e,n=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(i=[{key:"setLogLevel",value:function(e){this._logLevel=e}},{key:"getLogLevel",value:function(){return this._logLevel}},{key:"setLogHandler",value:function(e){this._logHandler=e}},{key:"log",value:function(e,t){this.shouldLog(e)&&this._logHandler(e,t)}},{key:"error",value:function(e){this.log(Se.ERROR,e)}},{key:"warn",value:function(e){this.log(Se.WARN,e)}},{key:"info",value:function(e){this.log(Se.INFO,e)}},{key:"debug",value:function(e){this.log(Se.DEBUG,e)}},{key:"shouldLog",value:function(e){return this.getNumericLevel(e)>=this.getNumericLevel(this._logLevel)}},{key:"getNumericLevel",value:function(e){if(void 0===e)return Se.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return Se.DEBUG;case"2":case"INFO":return Se.INFO;case"3":case"WARN":return Se.WARN;case"4":case"ERROR":default:return Se.ERROR;case"5":case"NONE":return Se.NONE}}}])&&Ei(t.prototype,i),n&&Ei(t,n),e}();ji(Ri,"_instance");var Mi=Ri;function Ti(){return Mi.getInstance()}function xi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ii=Object.defineProperty,Pi=function(e,t,i){return function(e,t,i){return t in e?Ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ni=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pi(this,"_lastErrorCode","0"),Pi(this,"_lastDiagnostic",""),Pi(this,"_errorCodes"),Pi(this,"_apiLog"),Pi(this,"_getLmsErrorMessageDetails"),Pi(this,"_loggingService"),this._errorCodes=t,this._apiLog=i,this._getLmsErrorMessageDetails=n,this._loggingService=r||Ti()}return t=e,(i=[{key:"lastErrorCode",get:function(){return this._lastErrorCode},set:function(e){this._lastErrorCode=e}},{key:"lastDiagnostic",get:function(){return this._lastDiagnostic}},{key:"throwSCORMError",value:function(e,t,i){this._lastDiagnostic=i||"",i||(i=this._getLmsErrorMessageDetails(t,!0));var n="SCORM Error ".concat(t,": ").concat(i).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+i,Se.ERROR,e),this._loggingService.error(n),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==D&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,i){if(xi(t,N)){var n=t;this._lastErrorCode=n.errorCode+"",this._lastDiagnostic="";var r="Validation Error ".concat(n.errorCode,": ").concat(n.message," [Element: ").concat(e,"]");this._loggingService.warn(r),i=D}else if(xi(t,Error)){var o=t.constructor.name,a="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),s=t.stack||"";this._loggingService.error("".concat(a,"\n").concat(s)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),i=D}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var l=JSON.stringify(t);this._loggingService.error("Error details: ".concat(l))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),i=D}return i}},{key:"errorCodes",get:function(){return this._errorCodes}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var qi=Object.defineProperty,Di=function(e,t,i){return function(e,t,i){return t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Li=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Di(this,"listenerMap",new Map),Di(this,"listenerCount",0),Di(this,"apiLog"),this.apiLog=t}return t=e,(i=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),i=t[0],n=null;return t.length>1&&(n=e.replace("".concat(i,"."),"")),{functionName:null!=i?i:e,CMIElement:n}}},{key:"on",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l,c=this.parseListenerName(a.value);if(c){var u=c.functionName,d=c.CMIElement,v=null!==(l=this.listenerMap.get(u))&&void 0!==l?l:[];v.push({functionName:u,CMIElement:d,callback:t}),this.listenerMap.set(u,v),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),Se.INFO,u)}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}}},{key:"off",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s,l=function(){var e=a.parseListenerName(s.value);if(!e)return"continue";var i=e.functionName,n=e.CMIElement,r=a.listenerMap.get(i);if(!r)return"continue";var o=r.findIndex(function(e){return e.CMIElement===n&&e.callback===t});-1!==o&&(r.splice(o,1),a.listenerCount--,0===r.length&&a.listenerMap.delete(i),a.apiLog("off","Removed event listener: ".concat(a.listenerCount),Se.INFO,i))},c=i[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)a=this,l()}catch(e){r=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),i=!0,n=!1,r=void 0;try{for(var o,a,s=function(){var e=o.parseListenerName(a.value);if(!e)return"continue";var t=e.functionName,i=e.CMIElement;if(o.listenerMap.has(t)){var n=o.listenerMap.get(t),r=null===i?[]:n.filter(function(e){return e.CMIElement!==i});o.listenerCount-=n.length-r.length,0===r.length?o.listenerMap.delete(t):o.listenerMap.set(t,r)}},l=t[Symbol.iterator]();!(i=(a=l.next()).done);i=!0)o=this,s()}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}}},{key:"processListeners",value:function(e,t,i,n){this.apiLog(e,i,Se.INFO,t);var r=this.listenerMap.get(e);if(r){var o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!!u.CMIElement,v=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var f=u.CMIElement.slice(0,-1);v=t.startsWith(f)}else v=u.CMIElement===t;d&&!v||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),Se.DEBUG,t),e.startsWith("Sequence")?u.callback(i):"CommitError"===e?void 0!==n?u.callback(i,n):u.callback(i):"CommitSuccess"===e?void 0!==n?u.callback(n):u.callback():u.callback(t,i))}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function zi(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Fi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){zi(o,n,r,a,s,"next",e)}function s(e){zi(o,n,r,a,s,"throw",e)}a(void 0)})}}function Bi(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Vi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Hi(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Bi(e,t,i[t])})}return e}function Ui(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var Gi=Object.defineProperty,Ki=function(e,t,i){return function(e,t,i){return t in e?Gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Yi=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ki(this,"apiLog",n),Ki(this,"settings"),Ki(this,"error_codes"),Ki(this,"storeName","scorm_again_offline_data"),Ki(this,"syncQueue","scorm_again_sync_queue"),Ki(this,"isOnline",navigator.onLine),Ki(this,"syncInProgress",!1),Ki(this,"boundOnlineStatusChangeHandler"),Ki(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=i,this.boundOnlineStatusChangeHandler=this.handleOnlineStatusChange.bind(this),this.boundCustomNetworkStatusHandler=this.handleCustomNetworkStatus.bind(this),window.addEventListener("online",this.boundOnlineStatusChangeHandler),window.addEventListener("offline",this.boundOnlineStatusChangeHandler),window.addEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}return t=e,(i=[{key:"handleOnlineStatusChange",value:function(){var e=this,t=this.isOnline;this.isOnline=navigator.onLine,!t&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Se.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",Se.INFO):e.apiLog("OfflineStorageService","Sync failed",Se.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),Se.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Se.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(Vi(e,CustomEvent)){var i=e.detail.online;if("boolean"==typeof i){var n=this.isOnline;this.isOnline=i,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(i?"online":"offline"),Se.INFO),!n&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Se.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",Se.INFO):t.apiLog("OfflineStorageService","Sync failed",Se.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),Se.ERROR)})):n&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Se.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",Se.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",Se.WARN)}},{key:"storeOffline",value:function(e,t,i){try{var n=Hi({id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9)),courseId:e,timestamp:Date.now(),data:t,syncAttempts:0},void 0!==(null==i?void 0:i.isTerminateCommit)?{isTerminateCommit:i.isTerminateCommit}:{},void 0!==(null==i?void 0:i.sequence)?{sequence:i.sequence}:{}),r=this.getFromStorage(this.syncQueue)||[];return r.push(n),this.saveToStorage(this.syncQueue,r),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),Se.INFO),{result:q,errorCode:0}}catch(t){var o,a=(Vi(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",a?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),Se.ERROR),{result:D,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return Fi(function(){return Ui(this,function(t){try{return[2,this.getFromStorage("".concat(this.storeName,"_").concat(e))||null]}catch(e){return this.apiLog("OfflineStorageService","Error retrieving offline data: ".concat(e),Se.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return Fi(function(){var e,t,i,n,r,o,a,s,l,c,u,d,v,f;return Ui(this,function(h){switch(h.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,h.label=1;case 1:if(h.trys.push([1,12,,13]),0===(e=this.getFromStorage(this.syncQueue)||[]).length)return this.syncInProgress=!1,[2,!0];this.apiLog("OfflineStorageService","Found ".concat(e.length," items to sync"),Se.INFO),t=[],i=!0,n=!1,r=void 0,h.label=2;case 2:h.trys.push([2,9,10,11]),o=e[Symbol.iterator](),h.label=3;case 3:if(i=(a=o.next()).done)return[3,8];if(c=null!==(l=this.settings.maxSyncAttempts)&&void 0!==l?l:5,(s=a.value).syncAttempts>=c)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(s.id," after ").concat(c," failed sync attempts"),Se.WARN),[3,7];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.sendDataToLMS(s.data,Hi({},void 0!==s.isTerminateCommit?{isTerminateCommit:s.isTerminateCommit}:{},void 0!==s.sequence?{sequence:s.sequence}:{}))];case 5:return!0===(u=h.sent()).result||u.result===q?this.apiLog("OfflineStorageService","Successfully synced item ".concat(s.id),Se.INFO):(s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Failed to sync item ".concat(s.id,", attempt #").concat(s.syncAttempts),Se.WARN)),[3,7];case 6:return d=h.sent(),s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Error syncing item ".concat(s.id,": ").concat(d),Se.ERROR),[3,7];case 7:return i=!0,[3,3];case 8:return[3,11];case 9:return v=h.sent(),n=!0,r=v,[3,11];case 10:try{i||null==o.return||o.return()}finally{if(n)throw r}return[7];case 11:return this.saveToStorage(this.syncQueue,t),this.apiLog("OfflineStorageService","Sync completed. ".concat(e.length-t.length," items synced, ").concat(t.length," items remaining"),Se.INFO),this.syncInProgress=!1,[2,!0];case 12:return f=h.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(f),Se.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return Fi(function(){var i,n,r,o,a,s,l,result,c,u;return Ui(this,function(v){switch(v.label){case 0:if(!(i=this.settings.lmsCommitUrl))return[2,{result:D,errorCode:this.error_codes.GENERAL||101}];v.label=1;case 1:return v.trys.push([1,7,,8]),r=i+"",o=this.settings.requestHandler(e,Hi({isTerminateCommit:null!==(n=null==t?void 0:t.isTerminateCommit)&&void 0!==n&&n,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),a=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?d(r,this.settings.terminateCommitParam,"true"):r,s={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(f=Hi({},this.settings.xhrHeaders),h={"Content-Type":this.settings.commitRequestDataType},h=null!=h?h:{},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(h)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(h)).forEach(function(e){Object.defineProperty(f,e,Object.getOwnPropertyDescriptor(h,e))}),f)},this.settings.xhrWithCredentials&&(s.credentials="include"),[4,fetch(a,s)];case 2:return l=v.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(l)];case 3:return c=v.sent(),[3,6];case 4:return[4,l.json()];case 5:c=v.sent(),v.label=6;case 6:return result=c,200>l.status||l.status>299||!0!==result.result&&result.result!==q?(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this.error_codes.GENERAL),[2,result]):(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=0),[2,result]);case 7:return u=v.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(u),Se.ERROR),[2,{result:D,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var f,h})}).call(this)}},{key:"isDeviceOnline",value:function(){return this.isOnline}},{key:"getFromStorage",value:function(e){var t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return null}return null}},{key:"saveToStorage",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){if(Vi(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return Fi(function(){return Ui(this,function(t){return[2,(this.getFromStorage(this.syncQueue)||[]).some(function(t){return t.courseId===e})]})}).call(this)}},{key:"updateSettings",value:function(e){this.settings=e}},{key:"destroy",value:function(){window.removeEventListener("online",this.boundOnlineStatusChangeHandler),window.removeEventListener("offline",this.boundOnlineStatusChangeHandler),window.removeEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),Wi=u(function(e,t,i,n,r,o){if("string"!=typeof t)return!1;var a=RegExp(i),s=t.match(a);if(o&&""===t)return!0;if(!s||""===s[0])throw new r(e,n);return!0},function(e,t,i,n,r,o){var a,s="string"==typeof t?t:"[".concat(void 0===t?"undefined":(a=t)&&"undefined"!=typeof Symbol&&a.constructor===Symbol?"symbol":typeof a,"]");return"".concat(e,":").concat(s,":").concat(i,":").concat(n,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),Ji=u(function(e,t,i,n,r){var o=i.split("#");if(isNaN(t=+t))throw new r(e,n);var a=o[0],s=o[1],l=void 0!==s&&""!==s&&"*"!==s;if(void 0!==a&&""!==a&&+a>t)throw new r(e,n);if(l&&t>+s)throw new r(e,n);return!0},function(e,t,i,n,r){return"".concat(e,":").concat(t,":").concat(i,":").concat(n)},{maxEntries:1e3});function Xi(e,t,i,n){return Wi(e,t,i,re.TYPE_MISMATCH,Q,n)}function $i(e,t,i){return Ji(e,t,i,re.VALUE_OUT_OF_RANGE,Q)}function Qi(e,t,i){return t=tn(t),n=e,!(r=ln()?Reflect.construct(t,i||[],tn(e).constructor):t.apply(e,i))||"object"!==sn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function en(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function tn(e){return tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},tn(e)}function nn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&an(e,t)}function rn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function an(e,t){return an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},an(e,t)}function sn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ln(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ln=function(){return!!result})()}var cn=Object.defineProperty,un=function(e,t,i){return function(e,t,i){return t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":sn(t))?t+"":t,i)},dn=function(e){return e.SATISFIED="satisfied",e.NOT_SATISFIED="notSatisfied",e.COMPLETED="completed",e.INCOMPLETE="incomplete",e}(dn||{}),vn=function(e){return e.ALL="all",e.ANY="any",e.NONE="none",e.AT_LEAST_COUNT="atLeastCount",e.AT_LEAST_PERCENT="atLeastPercent",e}(vn||{}),fn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return Zi(this,t),e=Qi(this,t,["rollupCondition"]),un(e,"_condition","always"),un(e,"_parameters",new Map),e._condition=i,e._parameters=n,e}return nn(t,e),en(t,[{key:"reset",value:function(){this._initialized=!1}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"evaluate",value:function(e){switch(this._condition){case"satisfied":return!0===e.objectiveSatisfiedStatus||e.successStatus===me;case"objectiveStatusKnown":return e.objectiveSatisfiedStatusKnown;case"objectiveMeasureKnown":return e.objectiveMeasureStatus;case"objectiveMeasureGreaterThan":var t=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&e.objectiveNormalizedMeasure>t;case"objectiveMeasureLessThan":var i=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&i>e.objectiveNormalizedMeasure;case"completed":return e.isCompleted;case"progressKnown":return e.completionStatus!==_e;case"attempted":return e.attemptCount>0;case"notAttempted":return 0===e.attemptCount;case"always":return!0;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}]),t}(_),hn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"satisfied",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Zi(this,t),e=Qi(this,t,["rollupRule"]),un(e,"_conditions",[]),un(e,"_action","satisfied"),un(e,"_consideration","all"),un(e,"_minimumCount",0),un(e,"_minimumPercent",0),e._action=i,e._consideration=n,e._minimumCount=r,e._minimumPercent=o,e}return nn(t,e),en(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[]}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!rn(e,fn))throw new Q(this._cmi_element+".conditions",re.TYPE_MISMATCH);this._conditions.push(e)}},{key:"removeCondition",value:function(e){var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"consideration",get:function(){return this._consideration},set:function(e){this._consideration=e}},{key:"minimumCount",get:function(){return this._minimumCount},set:function(e){0>e||(this._minimumCount=e)}},{key:"minimumPercent",get:function(){return this._minimumPercent},set:function(e){0>e||e>100||(this._minimumPercent=e)}},{key:"evaluate",value:function(e){var t=this;if(0===e.length)return!1;var i=e.filter(function(e){return t._conditions.every(function(t){return t.evaluate(e)})});switch(this._consideration){case"all":return i.length===e.length;case"any":return i.length>0;case"none":return 0===i.length;case"atLeastCount":return i.length>=this._minimumCount;case"atLeastPercent":return i.length/e.length*100>=this._minimumPercent;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,consideration:this._consideration,minimumCount:this._minimumCount,minimumPercent:this._minimumPercent};return this.jsonString=!1,result}}]),t}(_),mn=function(e){function t(){var e;return Zi(this,t),e=Qi(this,t,["rollupRules"]),un(e,"_rules",[]),e}return nn(t,e),en(t,[{key:"reset",value:function(){this._initialized=!1,this._rules=[]}},{key:"rules",get:function(){return this._rules}},{key:"addRule",value:function(e){if(!rn(e,hn))throw new Q(this._cmi_element+".rules",re.TYPE_MISMATCH);this._rules.push(e)}},{key:"removeRule",value:function(e){var t=this._rules.indexOf(e);return-1!==t&&(this._rules.splice(t,1),!0)}},{key:"processRollup",value:function(e){if(e&&0!==e.children.length){var t=e.getAvailableChildren(),i=!1,n=!1;if(e.sequencingControls.rollupObjectiveSatisfied&&null!==this._objectiveRollupUsingMeasure(e,t)&&(n=!0),!n){var r=!0,o=!1,a=void 0;try{for(var s,l=this._rules[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c.evaluate(t))switch(c.action){case"satisfied":e.successStatus=me,n=!0;break;case"notSatisfied":e.successStatus=pe,n=!0;break;case"completed":e.completionStatus=ge,e.isCompleted=!0,i=!0;break;case"incomplete":e.completionStatus=be,e.isCompleted=!1,i=!0}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}}i||this._defaultCompletionRollup(e,t),n||this._defaultSuccessRollup(e,t)}}},{key:"_defaultCompletionRollup",value:function(e,t){t.every(function(e){return e.isCompleted})?(e.completionStatus=ge,e.isCompleted=!0):t.some(function(e){return e.completionStatus===be})&&(e.completionStatus=be,e.isCompleted=!1)}},{key:"_objectiveRollupUsingMeasure",value:function(e,t){if(0>=e.sequencingControls.objectiveMeasureWeight)return null;var i=0,n=0,r=!1,o=!0,a=!1,s=void 0;try{for(var l,c=t[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;if(u.sequencingControls.rollupObjectiveSatisfied&&u.objectiveMeasureStatus&&!0===u.objectiveMeasureStatus){var d=u.sequencingControls.objectiveMeasureWeight;d>0&&(n+=u.objectiveNormalizedMeasure*d,i+=d,r=!0)}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}if(!r||0===i)return null;var v=n/i;return e.objectiveNormalizedMeasure=v,e.objectiveMeasureStatus=!0,e.scaledPassingScore>v?(e.successStatus=pe,e.objectiveSatisfiedStatus=!1,!1):(e.successStatus=me,e.objectiveSatisfiedStatus=!0,!0)}},{key:"_defaultSuccessRollup",value:function(e,t){t.every(function(e){return e.successStatus===me})?e.successStatus=me:t.some(function(e){return e.successStatus===pe})&&(e.successStatus=pe)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={rules:this._rules};return this.jsonString=!1,result}}]),t}(_);function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function yn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bn(e,t,i){return t&&gn(e.prototype,t),i&&gn(e,i),e}function _n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Sn(e,t,i){return Sn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=wn(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Sn(e,t,i||e)}function wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},wn(e)}function Cn(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){_n(e,t,i[t])})}return e}function On(e,t){return On=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},On(e,t)}function An(e){return function(e){if(Array.isArray(e))return pn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return pn(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?pn(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function En(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function kn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(kn=function(){return!!result})()}var jn=Object.defineProperty,Rn=function(e,t,i){return function(e,t,i){return t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":En(t))?t+"":t,i)},Mn=function(){function e(id){var t,i,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yn(this,e),Rn(this,"_id"),Rn(this,"_description"),Rn(this,"_satisfiedByMeasure"),Rn(this,"_minNormalizedMeasure"),Rn(this,"_mapInfo"),Rn(this,"_isPrimary"),Rn(this,"_satisfiedStatus",!1),Rn(this,"_satisfiedStatusKnown",!1),Rn(this,"_measureStatus",!1),Rn(this,"_normalizedMeasure",0),Rn(this,"_rawScore",""),Rn(this,"_rawScoreKnown",!1),Rn(this,"_minScore",""),Rn(this,"_minScoreKnown",!1),Rn(this,"_maxScore",""),Rn(this,"_maxScoreKnown",!1),Rn(this,"_progressMeasure",0),Rn(this,"_progressMeasureStatus",!1),Rn(this,"_completionStatus",_e),Rn(this,"_progressStatus",!1),Rn(this,"_satisfiedStatusDirty",!1),Rn(this,"_normalizedMeasureDirty",!1),Rn(this,"_completionStatusDirty",!1),Rn(this,"_progressMeasureDirty",!1),Rn(this,"_rawScoreDirty",!1),Rn(this,"_minScoreDirty",!1),Rn(this,"_maxScoreDirty",!1),this._id=id,this._description=null!==(t=o.description)&&void 0!==t?t:null,this._satisfiedByMeasure=null!==(i=o.satisfiedByMeasure)&&void 0!==i&&i,this._minNormalizedMeasure=null!==(n=o.minNormalizedMeasure)&&void 0!==n?n:null,this._mapInfo=o.mapInfo?An(o.mapInfo):[],this._isPrimary=null!==(r=o.isPrimary)&&void 0!==r&&r}return bn(e,[{key:"id",get:function(){return this._id}},{key:"description",get:function(){return this._description}},{key:"satisfiedByMeasure",get:function(){return this._satisfiedByMeasure},set:function(e){this._satisfiedByMeasure=e}},{key:"minNormalizedMeasure",get:function(){return this._minNormalizedMeasure},set:function(e){this._minNormalizedMeasure=e}},{key:"mapInfo",get:function(){return this._mapInfo},set:function(e){this._mapInfo=An(e)}},{key:"isPrimary",get:function(){return this._isPrimary},set:function(e){this._isPrimary=e}},{key:"satisfiedStatus",get:function(){return this._satisfiedStatus},set:function(e){this._satisfiedStatus!==e&&(this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._satisfiedStatusKnown=!0,this._progressStatus=!0)}},{key:"satisfiedStatusKnown",get:function(){return this._satisfiedStatusKnown},set:function(e){this._satisfiedStatusKnown=e}},{key:"measureStatus",get:function(){return this._measureStatus},set:function(e){this._measureStatus=e}},{key:"normalizedMeasure",get:function(){return this._normalizedMeasure},set:function(e){this._normalizedMeasure!==e&&(this._normalizedMeasure=e,this._normalizedMeasureDirty=!0)}},{key:"rawScore",get:function(){return this._rawScore},set:function(e){this._rawScore!==e&&(this._rawScore=e,this._rawScoreDirty=!0),this._rawScoreKnown=""!==e}},{key:"rawScoreKnown",get:function(){return this._rawScoreKnown},set:function(e){this._rawScoreKnown=e}},{key:"minScore",get:function(){return this._minScore},set:function(e){this._minScore!==e&&(this._minScore=e,this._minScoreDirty=!0),this._minScoreKnown=""!==e}},{key:"minScoreKnown",get:function(){return this._minScoreKnown},set:function(e){this._minScoreKnown=e}},{key:"maxScore",get:function(){return this._maxScore},set:function(e){this._maxScore!==e&&(this._maxScore=e,this._maxScoreDirty=!0),this._maxScoreKnown=""!==e}},{key:"maxScoreKnown",get:function(){return this._maxScoreKnown},set:function(e){this._maxScoreKnown=e}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure!==e&&(this._progressMeasure=e,this._progressMeasureDirty=!0)}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus!==e&&(this._completionStatus=e,this._completionStatusDirty=!0)}},{key:"progressStatus",get:function(){return this._progressStatus},set:function(e){this._progressStatus=e}},{key:"isDirty",value:function(e){switch(e){case"satisfiedStatus":return this._satisfiedStatusDirty;case"normalizedMeasure":return this._normalizedMeasureDirty;case"completionStatus":return this._completionStatusDirty;case"progressMeasure":return this._progressMeasureDirty;case"rawScore":return this._rawScoreDirty;case"minScore":return this._minScoreDirty;case"maxScore":return this._maxScoreDirty}}},{key:"clearDirty",value:function(e){switch(e){case"satisfiedStatus":this._satisfiedStatusDirty=!1;break;case"normalizedMeasure":this._normalizedMeasureDirty=!1;break;case"completionStatus":this._completionStatusDirty=!1;break;case"progressMeasure":this._progressMeasureDirty=!1;break;case"rawScore":this._rawScoreDirty=!1;break;case"minScore":this._minScoreDirty=!1;break;case"maxScore":this._maxScoreDirty=!1}}},{key:"clearAllDirty",value:function(){this._satisfiedStatusDirty=!1,this._normalizedMeasureDirty=!1,this._completionStatusDirty=!1,this._progressMeasureDirty=!1,this._rawScoreDirty=!1,this._minScoreDirty=!1,this._maxScoreDirty=!1}},{key:"initializeFromCMI",value:function(e,t,i){this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._normalizedMeasure=t,this._normalizedMeasureDirty=!0,this._measureStatus=i}},{key:"initializeScoreFromCMI",value:function(score){void 0!==score.rawScore&&""!==score.rawScore&&(this._rawScore=score.rawScore,this._rawScoreKnown=!0,this._rawScoreDirty=!0),void 0!==score.minScore&&""!==score.minScore&&(this._minScore=score.minScore,this._minScoreKnown=!0,this._minScoreDirty=!0),void 0!==score.maxScore&&""!==score.maxScore&&(this._maxScore=score.maxScore,this._maxScoreKnown=!0,this._maxScoreDirty=!0)}},{key:"applyReadMappedState",value:function(e){void 0!==e.satisfiedStatus&&(this._satisfiedStatus=e.satisfiedStatus,this._satisfiedStatusKnown=!0,this._progressStatus=!0),void 0!==e.normalizedMeasure&&(this._normalizedMeasure=e.normalizedMeasure,this._measureStatus=!0),void 0!==e.completionStatus&&(this._completionStatus=e.completionStatus),void 0!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureStatus=!0),void 0!==e.rawScore&&(this._rawScore=e.rawScore,this._rawScoreKnown=!0),void 0!==e.minScore&&(this._minScore=e.minScore,this._minScoreKnown=!0),void 0!==e.maxScore&&(this._maxScore=e.maxScore,this._maxScoreKnown=!0)}},{key:"resetState",value:function(){this._satisfiedStatus=!1,this._satisfiedStatusKnown=!1,this._measureStatus=!1,this._normalizedMeasure=0,this._rawScore="",this._rawScoreKnown=!1,this._minScore="",this._minScoreKnown=!1,this._maxScore="",this._maxScoreKnown=!1,this._progressMeasure=0,this._progressMeasureStatus=!1,this._completionStatus=_e,this._progressStatus=!1,this.clearAllDirty()}},{key:"updateFromActivity",value:function(e){this._satisfiedStatus!==e.objectiveSatisfiedStatus&&(this._satisfiedStatus=e.objectiveSatisfiedStatus,this._satisfiedStatusDirty=!0),this._satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,this._measureStatus=e.objectiveMeasureStatus,this._normalizedMeasure!==e.objectiveNormalizedMeasure&&(this._normalizedMeasure=e.objectiveNormalizedMeasure,this._normalizedMeasureDirty=!0),this._progressMeasure!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureDirty=!0),this._progressMeasureStatus=e.progressMeasureStatus,this._completionStatus!==e.completionStatus&&(this._completionStatus=e.completionStatus,this._completionStatusDirty=!0)}},{key:"applyToActivity",value:function(e){this._isPrimary&&e.setPrimaryObjectiveState(this._satisfiedStatus,this._measureStatus,this._normalizedMeasure,this._progressMeasure,this._progressMeasureStatus,this._completionStatus,this._progressStatus||this._satisfiedStatusKnown)}}]),e}(),Tn=function(e){function t(){var e,id=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return yn(this,t),e=function(e,t,i){return t=wn(t),n=e,!(r=kn()?Reflect.construct(t,i||[],wn(e).constructor):t.apply(e,i))||"object"!==En(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activity"]),Rn(e,"_id",""),Rn(e,"_title",""),Rn(e,"_children",[]),Rn(e,"_parent",null),Rn(e,"_isVisible",!0),Rn(e,"_isActive",!1),Rn(e,"_isSuspended",!1),Rn(e,"_isCompleted",!1),Rn(e,"_completionStatus",_e),Rn(e,"_successStatus",ye),Rn(e,"_attemptCount",0),Rn(e,"_attemptCompletionAmount",0),Rn(e,"_attemptAbsoluteDuration","PT0H0M0S"),Rn(e,"_attemptExperiencedDuration","PT0H0M0S"),Rn(e,"_activityAbsoluteDuration","PT0H0M0S"),Rn(e,"_activityExperiencedDuration","PT0H0M0S"),Rn(e,"_attemptAbsoluteDurationValue","PT0H0M0S"),Rn(e,"_attemptExperiencedDurationValue","PT0H0M0S"),Rn(e,"_activityAbsoluteDurationValue","PT0H0M0S"),Rn(e,"_activityExperiencedDurationValue","PT0H0M0S"),Rn(e,"_activityStartTimestampUtc",null),Rn(e,"_attemptStartTimestampUtc",null),Rn(e,"_activityEndedDate",null),Rn(e,"_objectiveSatisfiedStatus",!1),Rn(e,"_objectiveSatisfiedStatusKnown",!1),Rn(e,"_objectiveMeasureStatus",!1),Rn(e,"_objectiveNormalizedMeasure",0),Rn(e,"_scaledPassingScore",.7),Rn(e,"_objectiveSatisfiedStatusDirty",!1),Rn(e,"_objectiveNormalizedMeasureDirty",!1),Rn(e,"_objectiveMeasureStatusDirty",!1),Rn(e,"_progressMeasure",0),Rn(e,"_progressMeasureStatus",!1),Rn(e,"_location",""),Rn(e,"_attemptAbsoluteStartTime",""),Rn(e,"_learnerPrefs",null),Rn(e,"_activityAttemptActive",!1),Rn(e,"_isHiddenFromChoice",!1),Rn(e,"_isAvailable",!0),Rn(e,"_hideLmsUi",[]),Rn(e,"_auxiliaryResources",[]),Rn(e,"_attemptLimit",null),Rn(e,"_attemptAbsoluteDurationLimit",null),Rn(e,"_activityAbsoluteDurationLimit",null),Rn(e,"_timeLimitAction",null),Rn(e,"_timeLimitDuration",null),Rn(e,"_beginTimeLimit",null),Rn(e,"_endTimeLimit",null),Rn(e,"_launchData",""),Rn(e,"_credit","credit"),Rn(e,"_maxTimeAllowed",""),Rn(e,"_completionThreshold",""),Rn(e,"_sequencingControls"),Rn(e,"_sequencingRules"),Rn(e,"_rollupRules"),Rn(e,"_processedChildren",null),Rn(e,"_isNewAttempt",!1),Rn(e,"_primaryObjective",null),Rn(e,"_objectives",[]),Rn(e,"_rollupConsiderations",{requiredForSatisfied:"always",requiredForNotSatisfied:"always",requiredForCompleted:"always",requiredForIncomplete:"always",measureSatisfactionIfActive:!0}),Rn(e,"_requiredForSatisfied","always"),Rn(e,"_requiredForNotSatisfied","always"),Rn(e,"_requiredForCompleted","always"),Rn(e,"_requiredForIncomplete","always"),Rn(e,"_wasSkipped",!1),Rn(e,"_attemptProgressStatus",!1),Rn(e,"_wasAutoCompleted",!1),Rn(e,"_wasAutoSatisfied",!1),Rn(e,"_completedByMeasure",!1),Rn(e,"_minProgressMeasure",1),Rn(e,"_progressWeight",1),Rn(e,"_attemptCompletionAmountStatus",!1),e._id=id,e._title=i,e._sequencingControls=new Ft,e._sequencingRules=new ht,e._rollupRules=new mn,e._primaryObjective=null,e._objectives=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&On(e,t)}(t,e),bn(t,[{key:"initialize",value:function(){Sn(wn(t.prototype),"initialize",this).call(this);var e=!0,i=!1,n=void 0;try{for(var r,o=this._children[Symbol.iterator]();!(e=(r=o.next()).done);e=!0)r.value.initialize()}catch(e){i=!0,n=e}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"reset",value:function(){this._initialized=!1,this._isActive=!1,this._isSuspended=!1,this._isCompleted=!1,this._completionStatus=_e,this._successStatus=ye,this._attemptCount=0,this._attemptCompletionAmount=0,this._attemptAbsoluteDuration="PT0H0M0S",this._attemptExperiencedDuration="PT0H0M0S",this._activityAbsoluteDuration="PT0H0M0S",this._activityExperiencedDuration="PT0H0M0S",this._attemptAbsoluteDurationValue="PT0H0M0S",this._attemptExperiencedDurationValue="PT0H0M0S",this._activityAbsoluteDurationValue="PT0H0M0S",this._activityExperiencedDurationValue="PT0H0M0S",this._activityStartTimestampUtc=null,this._attemptStartTimestampUtc=null,this._activityEndedDate=null,this._objectiveSatisfiedStatus=!1,this._objectiveSatisfiedStatusKnown=!1,this._objectiveMeasureStatus=!1,this._objectiveNormalizedMeasure=0,this._progressMeasure=0,this._progressMeasureStatus=!1,this._location="",this._attemptAbsoluteStartTime="",this._learnerPrefs=null,this._activityAttemptActive=!1,this._primaryObjective&&(this._primaryObjective.resetState(),this._primaryObjective.updateFromActivity(this));var e=!0,t=!1,i=void 0;try{for(var n,r=this._objectives[Symbol.iterator]();!(e=(n=r.next()).done);e=!0)n.value.resetState()}catch(e){t=!0,i=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw i}}var o=!0,a=!1,s=void 0;try{for(var l,c=this._children[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)l.value.reset()}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}this._wasSkipped=!1,this._attemptProgressStatus=!1,this._wasAutoCompleted=!1,this._wasAutoSatisfied=!1,this._completedByMeasure=!1,this._minProgressMeasure=1,this._progressWeight=1,this._attemptCompletionAmountStatus=!1,this.clearAllObjectiveDirty()}},{key:"id",get:function(){return this._id},set:function(id){Xi(this._cmi_element+".id",id,Ne)&&(this._id=id)}},{key:"title",get:function(){return this._title},set:function(e){Xi(this._cmi_element+".title",e,je)&&(this._title=e)}},{key:"children",get:function(){return this._children}},{key:"addChild",value:function(e){if(i=e,!(null!=(n=t)&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](i):i instanceof n))throw new Q(this._cmi_element+".children",re.TYPE_MISMATCH);var i,n;e._parent=this,this._children.push(e)}},{key:"setChildOrder",value:function(e){if(0!==e.length){var t,i=new Map(this._children.map(function(e){return[e.id,e]})),n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var id=s.value,c=i.get(id);c&&(n.push(c),i.delete(id))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}if(i.size>0){var u=!0,d=!1,v=void 0;try{for(var f,h=this._children[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value;i.has(m.id)&&(n.push(m),i.delete(m.id))}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}}n.length===this._children.length&&(t=this._children).splice.apply(t,[0,this._children.length].concat(An(n)))}}},{key:"removeChild",value:function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e._parent=null,!0)}},{key:"parent",get:function(){return this._parent}},{key:"isVisible",get:function(){return this._isVisible},set:function(e){this._isVisible=e}},{key:"isActive",get:function(){return this._isActive},set:function(e){this._isActive=e}},{key:"isSuspended",get:function(){return this._isSuspended},set:function(e){this._isSuspended=e}},{key:"isCompleted",get:function(){return this._isCompleted},set:function(e){this._isCompleted=e,this._completionStatus=e?ge:be}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus=e,this._isCompleted=e===ge,this.updatePrimaryObjectiveFromActivity()}},{key:"successStatus",get:function(){return this._successStatus},set:function(e){this._successStatus=e}},{key:"attemptCount",get:function(){return this._attemptCount},set:function(e){this._attemptCount=e}},{key:"attemptCompletionAmount",get:function(){return this._attemptCompletionAmount},set:function(e){this._attemptCompletionAmount=e}},{key:"incrementAttemptCount",value:function(){this._attemptCount++,this._isNewAttempt=!0;var e=this._sequencingControls;"onEachNewAttempt"!==e.selectionTiming&&"onEachNewAttempt"!==e.randomizationTiming||(this._processedChildren=null)}},{key:"objectiveSatisfiedStatus",get:function(){return this._objectiveSatisfiedStatus},set:function(e){this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=!0,this._successStatus=e?me:pe,this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveSatisfiedStatusKnown",get:function(){return this._objectiveSatisfiedStatusKnown},set:function(e){this._objectiveSatisfiedStatusKnown=e}},{key:"objectiveMeasureStatus",get:function(){return this._objectiveMeasureStatus},set:function(e){this._objectiveMeasureStatus!==e&&(this._objectiveMeasureStatus=e,this._objectiveMeasureStatusDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveNormalizedMeasure",get:function(){return this._objectiveNormalizedMeasure},set:function(e){this._objectiveNormalizedMeasure!==e&&(this._objectiveNormalizedMeasure=e,this._objectiveNormalizedMeasureDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"scaledPassingScore",get:function(){return this._scaledPassingScore},set:function(e){-1>e||e>1||(this._scaledPassingScore=e)}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure=e,this.updatePrimaryObjectiveFromActivity()}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e,this.updatePrimaryObjectiveFromActivity()}},{key:"location",get:function(){return this._location},set:function(location){this._location=location}},{key:"attemptAbsoluteStartTime",get:function(){return this._attemptAbsoluteStartTime},set:function(e){this._attemptAbsoluteStartTime=e}},{key:"learnerPrefs",get:function(){return this._learnerPrefs},set:function(e){this._learnerPrefs=e}},{key:"activityAttemptActive",get:function(){return this._activityAttemptActive},set:function(e){this._activityAttemptActive=e}},{key:"isHiddenFromChoice",get:function(){return this._isHiddenFromChoice},set:function(e){this._isHiddenFromChoice=e}},{key:"isAvailable",get:function(){return this._isAvailable},set:function(e){this._isAvailable=e}},{key:"attemptLimit",get:function(){return this._attemptLimit},set:function(e){this._attemptLimit=e}},{key:"hasAttemptLimitExceeded",value:function(){return null!==this._attemptLimit&&this._attemptCount>=this._attemptLimit}},{key:"timeLimitDuration",get:function(){return this._timeLimitDuration},set:function(e){this._timeLimitDuration=e}},{key:"timeLimitAction",get:function(){return this._timeLimitAction},set:function(e){this._timeLimitAction=e}},{key:"beginTimeLimit",get:function(){return this._beginTimeLimit},set:function(e){this._beginTimeLimit=e}},{key:"endTimeLimit",get:function(){return this._endTimeLimit},set:function(e){this._endTimeLimit=e}},{key:"attemptAbsoluteDurationLimit",get:function(){return this._attemptAbsoluteDurationLimit},set:function(e){if(null!==e&&!s(e,xe))throw new Q(this._cmi_element+".attemptAbsoluteDurationLimit",re.TYPE_MISMATCH);this._attemptAbsoluteDurationLimit=e}},{key:"attemptExperiencedDuration",get:function(){return this._attemptExperiencedDuration},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".attemptExperiencedDuration",re.TYPE_MISMATCH);this._attemptExperiencedDuration=e}},{key:"activityAbsoluteDurationLimit",get:function(){return this._activityAbsoluteDurationLimit},set:function(e){if(null!==e&&!s(e,xe))throw new Q(this._cmi_element+".activityAbsoluteDurationLimit",re.TYPE_MISMATCH);this._activityAbsoluteDurationLimit=e}},{key:"activityExperiencedDuration",get:function(){return this._activityExperiencedDuration},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".activityExperiencedDuration",re.TYPE_MISMATCH);this._activityExperiencedDuration=e}},{key:"attemptAbsoluteDuration",get:function(){return this._attemptAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._attemptAbsoluteDurationLimit=e}},{key:"activityAbsoluteDuration",get:function(){return this._activityAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._activityAbsoluteDurationLimit=e}},{key:"attemptAbsoluteDurationValue",get:function(){return this._attemptAbsoluteDurationValue},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".attemptAbsoluteDurationValue",re.TYPE_MISMATCH);this._attemptAbsoluteDurationValue=e}},{key:"attemptExperiencedDurationValue",get:function(){return this._attemptExperiencedDurationValue},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".attemptExperiencedDurationValue",re.TYPE_MISMATCH);this._attemptExperiencedDurationValue=e}},{key:"activityAbsoluteDurationValue",get:function(){return this._activityAbsoluteDurationValue},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".activityAbsoluteDurationValue",re.TYPE_MISMATCH);this._activityAbsoluteDurationValue=e}},{key:"activityExperiencedDurationValue",get:function(){return this._activityExperiencedDurationValue},set:function(e){if(!s(e,xe))throw new Q(this._cmi_element+".activityExperiencedDurationValue",re.TYPE_MISMATCH);this._activityExperiencedDurationValue=e}},{key:"activityStartTimestampUtc",get:function(){return this._activityStartTimestampUtc},set:function(timestamp){this._activityStartTimestampUtc=timestamp}},{key:"attemptStartTimestampUtc",get:function(){return this._attemptStartTimestampUtc},set:function(timestamp){this._attemptStartTimestampUtc=timestamp}},{key:"activityEndedDate",get:function(){return this._activityEndedDate},set:function(e){this._activityEndedDate=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){this._sequencingControls=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){this._sequencingRules=e}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){this._rollupRules=e}},{key:"rollupConsiderations",get:function(){return Cn({},this._rollupConsiderations)},set:function(e){this._rollupConsiderations=Cn({},e)}},{key:"applyRollupConsiderations",value:function(e){this._rollupConsiderations=Cn({},this._rollupConsiderations,e)}},{key:"requiredForSatisfied",get:function(){return this._requiredForSatisfied},set:function(e){this._requiredForSatisfied=e}},{key:"requiredForNotSatisfied",get:function(){return this._requiredForNotSatisfied},set:function(e){this._requiredForNotSatisfied=e}},{key:"requiredForCompleted",get:function(){return this._requiredForCompleted},set:function(e){this._requiredForCompleted=e}},{key:"requiredForIncomplete",get:function(){return this._requiredForIncomplete},set:function(e){this._requiredForIncomplete=e}},{key:"wasSkipped",get:function(){return this._wasSkipped},set:function(e){this._wasSkipped=e}},{key:"attemptProgressStatus",get:function(){return this._attemptProgressStatus},set:function(e){this._attemptProgressStatus=e}},{key:"wasAutoCompleted",get:function(){return this._wasAutoCompleted},set:function(e){this._wasAutoCompleted=e}},{key:"wasAutoSatisfied",get:function(){return this._wasAutoSatisfied},set:function(e){this._wasAutoSatisfied=e}},{key:"completedByMeasure",get:function(){return this._completedByMeasure},set:function(e){this._completedByMeasure=e}},{key:"minProgressMeasure",get:function(){return this._minProgressMeasure},set:function(e){if(0>e||e>1)throw new Q(this._cmi_element+".minProgressMeasure",re.TYPE_MISMATCH);this._minProgressMeasure=e}},{key:"progressWeight",get:function(){return this._progressWeight},set:function(e){if(0>e)throw new Q(this._cmi_element+".progressWeight",re.TYPE_MISMATCH);this._progressWeight=e}},{key:"attemptCompletionAmountStatus",get:function(){return this._attemptCompletionAmountStatus},set:function(e){this._attemptCompletionAmountStatus=e}},{key:"primaryObjective",get:function(){return this._primaryObjective},set:function(e){var t;(this._primaryObjective=e,this._primaryObjective)&&(this._primaryObjective.isPrimary=!0,null!==this._primaryObjective.minNormalizedMeasure&&(this._scaledPassingScore=null!==(t=this._primaryObjective.minNormalizedMeasure)&&void 0!==t?t:this._scaledPassingScore),this._primaryObjective.updateFromActivity(this));this.syncPrimaryObjectiveCollection()}},{key:"objectives",get:function(){var e=this;return this._objectives.filter(function(t){var i;return t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)})},set:function(objectives){this._objectives=An(objectives),this.syncPrimaryObjectiveCollection()}},{key:"addObjective",value:function(e){this._objectives.find(function(t){return t.id===e.id})||this._objectives.push(e)}},{key:"syncPrimaryObjectiveCollection",value:function(){var e=this;if(this._primaryObjective){var t=this._objectives.findIndex(function(t){var i;return t.id===(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});0>t?this._objectives=[this._primaryObjective].concat(An(this._objectives)):this._objectives[t]=this._primaryObjective}else this._objectives=this._objectives.filter(function(e){return!e.isPrimary})}},{key:"getObjectiveById",value:function(e){var t;if((null===(t=this._primaryObjective)||void 0===t?void 0:t.id)===e)return{objective:this._primaryObjective,isPrimary:!0};var i=this._objectives.find(function(t){return t.id===e});return i?{objective:i,isPrimary:!1}:null}},{key:"getAllObjectives",value:function(){var e=this,objectives=[];this._primaryObjective&&objectives.push(this._primaryObjective);var t=this._objectives.filter(function(t){var i;return t!==e._primaryObjective&&t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});return objectives.concat(t)}},{key:"updatePrimaryObjectiveFromActivity",value:function(){this._primaryObjective&&this._primaryObjective.updateFromActivity(this)}},{key:"isObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":return this._objectiveSatisfiedStatusDirty;case"normalizedMeasure":return this._objectiveNormalizedMeasureDirty;case"measureStatus":return this._objectiveMeasureStatusDirty}}},{key:"clearObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":this._objectiveSatisfiedStatusDirty=!1;break;case"normalizedMeasure":this._objectiveNormalizedMeasureDirty=!1;break;case"measureStatus":this._objectiveMeasureStatusDirty=!1}}},{key:"clearAllObjectiveDirty",value:function(){this._objectiveSatisfiedStatusDirty=!1,this._objectiveNormalizedMeasureDirty=!1,this._objectiveMeasureStatusDirty=!1}},{key:"setPrimaryObjectiveState",value:function(e,t,i,n,r,o){var a=6>=arguments.length||void 0===arguments[6]||arguments[6];this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=a,this._objectiveMeasureStatus!==t&&(this._objectiveMeasureStatus=t,this._objectiveMeasureStatusDirty=!0),this._objectiveNormalizedMeasure!==i&&(this._objectiveNormalizedMeasure=i,this._objectiveNormalizedMeasureDirty=!0),this._progressMeasure=n,this._progressMeasureStatus=r,this._completionStatus=o,this._primaryObjective&&(this._primaryObjective.satisfiedStatus=e,this._primaryObjective.measureStatus=t,this._primaryObjective.normalizedMeasure=i,this._primaryObjective.progressMeasure=n,this._primaryObjective.progressMeasureStatus=r,this._primaryObjective.completionStatus=o,this._primaryObjective.satisfiedStatusKnown=a,this._primaryObjective.progressStatus=a)}},{key:"getObjectiveStateSnapshot",value:function(){var e;return{primary:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this.objectiveSatisfiedStatus,measureStatus:this.objectiveMeasureStatus,normalizedMeasure:this.objectiveNormalizedMeasure,rawScore:this._primaryObjective.rawScore,rawScoreKnown:this._primaryObjective.rawScoreKnown,minScore:this._primaryObjective.minScore,minScoreKnown:this._primaryObjective.minScoreKnown,maxScore:this._primaryObjective.maxScore,maxScoreKnown:this._primaryObjective.maxScoreKnown,progressMeasure:null!==(e=this.progressMeasure)&&void 0!==e?e:0,progressMeasureStatus:this.progressMeasureStatus,progressStatus:this._primaryObjective.progressStatus,completionStatus:this.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,rawScore:e.rawScore,rawScoreKnown:e.rawScoreKnown,minScore:e.minScore,minScoreKnown:e.minScoreKnown,maxScore:e.maxScore,maxScoreKnown:e.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,progressStatus:e.progressStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure}})}}},{key:"applyObjectiveStateSnapshot",value:function(e){if(e.primary){var t=this.getObjectiveById(e.primary.id);if(t&&t.isPrimary){var i,n=e.primary;t.objective.satisfiedByMeasure=null!==(i=n.satisfiedByMeasure)&&void 0!==i?i:t.objective.satisfiedByMeasure,t.objective.minNormalizedMeasure=void 0!==n.minNormalizedMeasure?n.minNormalizedMeasure:t.objective.minNormalizedMeasure,this.setPrimaryObjectiveState(n.satisfiedStatus,n.measureStatus,n.normalizedMeasure,n.progressMeasure,n.progressMeasureStatus,n.completionStatus,n.progressStatus),this.applyObjectiveScoreSnapshot(t.objective,n)}}var r=!0,o=!1,a=void 0;try{for(var s,l=e.objectives[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value,u=this.getObjectiveById(c.id);if(u&&!u.isPrimary){var d,v=u.objective;v.satisfiedStatus=c.satisfiedStatus,v.measureStatus=c.measureStatus,v.normalizedMeasure=c.normalizedMeasure,v.progressMeasure=c.progressMeasure,v.progressMeasureStatus=c.progressMeasureStatus,v.completionStatus=c.completionStatus,this.applyObjectiveScoreSnapshot(v,c),v.satisfiedByMeasure=null!==(d=c.satisfiedByMeasure)&&void 0!==d?d:v.satisfiedByMeasure,v.minNormalizedMeasure=void 0!==c.minNormalizedMeasure?c.minNormalizedMeasure:v.minNormalizedMeasure}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}}},{key:"applyObjectiveScoreSnapshot",value:function(e,t){var i={};t.rawScoreKnown&&(i.rawScore=t.rawScore),t.minScoreKnown&&(i.minScore=t.minScore),t.maxScoreKnown&&(i.maxScore=t.maxScore),e.applyReadMappedState(i)}},{key:"getAvailableChildren",value:function(){return 0===this._children.length?[]:null!==this._processedChildren?this._processedChildren:this._children}},{key:"setProcessedChildren",value:function(e){this._processedChildren=e}},{key:"resetProcessedChildren",value:function(){this._processedChildren=null}},{key:"isNewAttempt",get:function(){return this._isNewAttempt},set:function(e){this._isNewAttempt=e}},{key:"launchData",get:function(){return this._launchData},set:function(e){this._launchData=e}},{key:"credit",get:function(){return this._credit},set:function(credit){this._credit=credit}},{key:"maxTimeAllowed",get:function(){return this._maxTimeAllowed},set:function(e){this._maxTimeAllowed=e}},{key:"completionThreshold",get:function(){return this._completionThreshold},set:function(e){this._completionThreshold=e}},{key:"getSuspensionState",value:function(){return{id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,attemptAbsoluteDurationValue:this._attemptAbsoluteDurationValue,attemptExperiencedDurationValue:this._attemptExperiencedDurationValue,activityAbsoluteDurationValue:this._activityAbsoluteDurationValue,activityExperiencedDurationValue:this._activityExperiencedDurationValue,activityStartTimestampUtc:this._activityStartTimestampUtc,attemptStartTimestampUtc:this._attemptStartTimestampUtc,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,scaledPassingScore:this._scaledPassingScore,progressMeasure:this._progressMeasure,progressMeasureStatus:this._progressMeasureStatus,location:this._location,attemptAbsoluteStartTime:this._attemptAbsoluteStartTime,activityAttemptActive:this._activityAttemptActive,isHiddenFromChoice:this._isHiddenFromChoice,isAvailable:this._isAvailable,rollupConsiderations:Cn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,attemptProgressStatus:this._attemptProgressStatus,wasAutoCompleted:this._wasAutoCompleted,wasAutoSatisfied:this._wasAutoSatisfied,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,processedChildren:this._processedChildren?this._processedChildren.map(function(e){return e.id}):null,isNewAttempt:this._isNewAttempt,selectionCountStatus:this._sequencingControls.selectionCountStatus,reorderChildren:this._sequencingControls.reorderChildren,primaryObjective:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this._primaryObjective.satisfiedStatus,measureStatus:this._primaryObjective.measureStatus,normalizedMeasure:this._primaryObjective.normalizedMeasure,progressMeasure:this._primaryObjective.progressMeasure,progressMeasureStatus:this._primaryObjective.progressMeasureStatus,completionStatus:this._primaryObjective.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure,progressStatus:this._primaryObjective.progressStatus,mapInfo:this._primaryObjective.mapInfo}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure,progressStatus:e.progressStatus,mapInfo:e.mapInfo}}),children:this._children.map(function(e){return e.getSuspensionState()})}}},{key:"restoreSuspensionState",value:function(e){var t,i,n,r,o,a,s,l,c,u,d,v,f,h,m,p,y,g,b,_,S,w,C,O,A,E,k,j,R,M,T,x,I,P,N,q,D,L,z;if(e){if(this._isVisible=null!==(t=e.isVisible)&&void 0!==t?t:this._isVisible,this._isActive=null!==(i=e.isActive)&&void 0!==i?i:this._isActive,this._isSuspended=null!==(n=e.isSuspended)&&void 0!==n?n:this._isSuspended,this._isCompleted=null!==(r=e.isCompleted)&&void 0!==r?r:this._isCompleted,this._completionStatus=null!==(o=e.completionStatus)&&void 0!==o?o:this._completionStatus,this._successStatus=null!==(a=e.successStatus)&&void 0!==a?a:this._successStatus,this._attemptCount=null!==(s=e.attemptCount)&&void 0!==s?s:this._attemptCount,this._attemptCompletionAmount=null!==(l=e.attemptCompletionAmount)&&void 0!==l?l:this._attemptCompletionAmount,this._attemptAbsoluteDuration=null!==(c=e.attemptAbsoluteDuration)&&void 0!==c?c:this._attemptAbsoluteDuration,this._attemptExperiencedDuration=null!==(u=e.attemptExperiencedDuration)&&void 0!==u?u:this._attemptExperiencedDuration,this._activityAbsoluteDuration=null!==(d=e.activityAbsoluteDuration)&&void 0!==d?d:this._activityAbsoluteDuration,this._activityExperiencedDuration=null!==(v=e.activityExperiencedDuration)&&void 0!==v?v:this._activityExperiencedDuration,this._attemptAbsoluteDurationValue=null!==(f=e.attemptAbsoluteDurationValue)&&void 0!==f?f:this._attemptAbsoluteDurationValue,this._attemptExperiencedDurationValue=null!==(h=e.attemptExperiencedDurationValue)&&void 0!==h?h:this._attemptExperiencedDurationValue,this._activityAbsoluteDurationValue=null!==(m=e.activityAbsoluteDurationValue)&&void 0!==m?m:this._activityAbsoluteDurationValue,this._activityExperiencedDurationValue=null!==(p=e.activityExperiencedDurationValue)&&void 0!==p?p:this._activityExperiencedDurationValue,this._activityStartTimestampUtc=null!==(y=e.activityStartTimestampUtc)&&void 0!==y?y:this._activityStartTimestampUtc,this._attemptStartTimestampUtc=null!==(g=e.attemptStartTimestampUtc)&&void 0!==g?g:this._attemptStartTimestampUtc,this._objectiveSatisfiedStatus=null!==(b=e.objectiveSatisfiedStatus)&&void 0!==b?b:this._objectiveSatisfiedStatus,this._objectiveSatisfiedStatusKnown=null!==(_=e.objectiveSatisfiedStatusKnown)&&void 0!==_?_:this._objectiveSatisfiedStatusKnown,this._objectiveMeasureStatus=null!==(S=e.objectiveMeasureStatus)&&void 0!==S?S:this._objectiveMeasureStatus,this._objectiveNormalizedMeasure=null!==(w=e.objectiveNormalizedMeasure)&&void 0!==w?w:this._objectiveNormalizedMeasure,this._scaledPassingScore=null!==(C=e.scaledPassingScore)&&void 0!==C?C:this._scaledPassingScore,this._progressMeasure=null!==(O=e.progressMeasure)&&void 0!==O?O:this._progressMeasure,this._progressMeasureStatus=null!==(A=e.progressMeasureStatus)&&void 0!==A?A:this._progressMeasureStatus,this._location=null!==(E=e.location)&&void 0!==E?E:this._location,this._attemptAbsoluteStartTime=null!==(k=e.attemptAbsoluteStartTime)&&void 0!==k?k:this._attemptAbsoluteStartTime,this._activityAttemptActive=null!==(j=e.activityAttemptActive)&&void 0!==j?j:this._activityAttemptActive,this._isHiddenFromChoice=null!==(R=e.isHiddenFromChoice)&&void 0!==R?R:this._isHiddenFromChoice,this._isAvailable=null!==(M=e.isAvailable)&&void 0!==M?M:this._isAvailable,e.rollupConsiderations&&(this._rollupConsiderations=Cn({},e.rollupConsiderations)),this._wasSkipped=null!==(T=e.wasSkipped)&&void 0!==T?T:this._wasSkipped,this._attemptProgressStatus=null!==(x=e.attemptProgressStatus)&&void 0!==x?x:this._attemptProgressStatus,this._wasAutoCompleted=null!==(I=e.wasAutoCompleted)&&void 0!==I?I:this._wasAutoCompleted,this._wasAutoSatisfied=null!==(P=e.wasAutoSatisfied)&&void 0!==P?P:this._wasAutoSatisfied,this._completedByMeasure=null!==(N=e.completedByMeasure)&&void 0!==N?N:this._completedByMeasure,this._minProgressMeasure=null!==(q=e.minProgressMeasure)&&void 0!==q?q:this._minProgressMeasure,this._progressWeight=null!==(D=e.progressWeight)&&void 0!==D?D:this._progressWeight,this._attemptCompletionAmountStatus=null!==(L=e.attemptCompletionAmountStatus)&&void 0!==L?L:this._attemptCompletionAmountStatus,this._isNewAttempt=null!==(z=e.isNewAttempt)&&void 0!==z?z:this._isNewAttempt,void 0!==e.selectionCountStatus&&(this._sequencingControls.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(this._sequencingControls.reorderChildren=e.reorderChildren),e.processedChildren){var F=new Map(this._children.map(function(e){return[e.id,e]}));this._processedChildren=e.processedChildren.map(function(id){return F.get(id)}).filter(function(e){return void 0!==e})}else this._processedChildren=null;var B,V,H,U,G,K,Y;if(e.primaryObjective&&this._primaryObjective&&(this._primaryObjective.satisfiedStatus=null!==(B=e.primaryObjective.satisfiedStatus)&&void 0!==B?B:this._primaryObjective.satisfiedStatus,this._primaryObjective.measureStatus=null!==(V=e.primaryObjective.measureStatus)&&void 0!==V?V:this._primaryObjective.measureStatus,this._primaryObjective.normalizedMeasure=null!==(H=e.primaryObjective.normalizedMeasure)&&void 0!==H?H:this._primaryObjective.normalizedMeasure,this._primaryObjective.progressMeasure=null!==(U=e.primaryObjective.progressMeasure)&&void 0!==U?U:this._primaryObjective.progressMeasure,this._primaryObjective.progressMeasureStatus=null!==(G=e.primaryObjective.progressMeasureStatus)&&void 0!==G?G:this._primaryObjective.progressMeasureStatus,this._primaryObjective.completionStatus=null!==(K=e.primaryObjective.completionStatus)&&void 0!==K?K:this._primaryObjective.completionStatus,this._primaryObjective.progressStatus=null!==(Y=e.primaryObjective.progressStatus)&&void 0!==Y?Y:this._primaryObjective.progressStatus),e.objectives){var W=!0,J=!1,X=void 0;try{for(var $,Q,Z=function(){var e,t,i,n,r,o,a,s=Q.value,l=$._objectives.find(function(e){return e.id===s.id});l&&(l.satisfiedStatus=null!==(e=s.satisfiedStatus)&&void 0!==e?e:l.satisfiedStatus,l.measureStatus=null!==(t=s.measureStatus)&&void 0!==t?t:l.measureStatus,l.normalizedMeasure=null!==(i=s.normalizedMeasure)&&void 0!==i?i:l.normalizedMeasure,l.progressMeasure=null!==(n=s.progressMeasure)&&void 0!==n?n:l.progressMeasure,l.progressMeasureStatus=null!==(r=s.progressMeasureStatus)&&void 0!==r?r:l.progressMeasureStatus,l.completionStatus=null!==(o=s.completionStatus)&&void 0!==o?o:l.completionStatus,l.progressStatus=null!==(a=s.progressStatus)&&void 0!==a?a:l.progressStatus)},ee=e.objectives[Symbol.iterator]();!(W=(Q=ee.next()).done);W=!0)$=this,Z()}catch(e){J=!0,X=e}finally{try{W||null==ee.return||ee.return()}finally{if(J)throw X}}}if(e.children&&Array.isArray(e.children))for(var te,ie=function(t){var i=e.children[t],n=te._children.find(function(e){return e.id===i.id});n&&n.restoreSuspensionState(i)},ne=0;e.children.length>ne&&this._children.length>ne;ne++)te=this,ie(ne)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,rollupConsiderations:Cn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,hideLmsUi:An(this._hideLmsUi),auxiliaryResources:this._auxiliaryResources.map(function(e){return Cn({},e)}),children:this._children.map(function(e){return e.toJSON()})};return this.jsonString=!1,result}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return Cn({},e)})},set:function(e){var t=[],i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=(e||[])[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l){var c="string"==typeof l.resourceId?l.resourceId.trim():"",u="string"==typeof l.purpose?l.purpose.trim():"";c&&!i.has(c)&&(i.add(c),t.push({resourceId:c,purpose:u}))}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this._auxiliaryResources=t}},{key:"addAuxiliaryResource",value:function(e){this.auxiliaryResources=An(this._auxiliaryResources).concat([e])}},{key:"captureRollupStatus",value:function(){return{measureStatus:this._objectiveMeasureStatus,normalizedMeasure:this._objectiveNormalizedMeasure,objectiveProgressStatus:null!=this._objectiveSatisfiedStatus,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,attemptProgressStatus:this._completionStatus!==_e,attemptCompletionStatus:this._completionStatus===ge}}},{key:"hideLmsUi",get:function(){return An(this._hideLmsUi)},set:function(e){var t=new Set($e),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}this._hideLmsUi=n}}],[{key:"compareRollupStatus",value:function(e,t){return e.measureStatus===t.measureStatus&&1e-4>Math.abs(e.normalizedMeasure-t.normalizedMeasure)&&e.objectiveProgressStatus===t.objectiveProgressStatus&&e.objectiveSatisfiedStatus===t.objectiveSatisfiedStatus&&e.attemptProgressStatus===t.attemptProgressStatus&&e.attemptCompletionStatus===t.attemptCompletionStatus}}]),t}(_);var xn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"checkChildForRollupSubprocess",value:function(e,t,i){if(!1===e.sequencingControls.tracked)return!1;var n=!1;if("measure"===t||"objective"===t){if(!e.sequencingControls.rollupObjectiveSatisfied)return!1;n=!0;var r=e.requiredForSatisfied,o=e.requiredForNotSatisfied;"satisfied"===i&&"ifNotSuspended"===r||"notSatisfied"===i&&"ifNotSuspended"===o?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"satisfied"===i&&"ifAttempted"===r||"notSatisfied"===i&&"ifAttempted"===o?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("satisfied"===i&&"ifNotSkipped"===r||"notSatisfied"===i&&"ifNotSkipped"===o)&&e.wasSkipped&&(n=!1)}if("progress"===t){if(!e.sequencingControls.rollupProgressCompletion)return!1;n=!0;var a=e.requiredForCompleted,s=e.requiredForIncomplete;"completed"===i&&"ifNotSuspended"===a||"incomplete"===i&&"ifNotSuspended"===s?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"completed"===i&&"ifAttempted"===a||"incomplete"===i&&"ifAttempted"===s?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("completed"===i&&"ifNotSkipped"===a||"incomplete"===i&&"ifNotSkipped"===s)&&e.wasSkipped&&(n=!1)}return!(n&&!e.isAvailable)&&n}},{key:"filterChildrenForRequirement",value:function(e,t,mode,i){var n=this;return e.filter(function(e){return n.shouldIncludeChildForRollup(e,t,mode,i)})}},{key:"shouldIncludeChildForRollup",value:function(e,t,mode,i){return!(!this.checkChildForRollupSubprocess(e,t,mode)||"objective"===t&&!i.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))}},{key:"isChildSatisfiedForRollup",value:function(e){return!0===e.objectiveSatisfiedStatus||!1!==e.objectiveSatisfiedStatus&&e.successStatus===me}},{key:"isChildCompletedForRollup",value:function(e){return!("completed"!==e.completionStatus&&!e.isCompleted)}},{key:"getTrackableChildren",value:function(e){return e.children.filter(function(e){return!1!==e.sequencingControls.tracked})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var In=Object.defineProperty,Pn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="childFilter")?i+"":i,n),this.childFilter=t}return t=e,(i=[{key:"evaluateRollupRule",value:function(e,t){var i=e.getAvailableChildren(),n=0,r=0,o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!1;switch(t.action){case dn.SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","satisfied");break;case dn.NOT_SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","notSatisfied");break;case dn.COMPLETED:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","completed");break;case dn.INCOMPLETE:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","incomplete")}d&&(n++,this.evaluateRollupConditionsSubprocess(u,t)&&r++)}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return t.consideration===vn.ALL?n>0&&r===n:null!==t.minimumCount?r>=t.minimumCount:null!==t.minimumPercent?(n>0?r/n:0)>=t.minimumPercent:n>0&&r===n}},{key:"evaluateRollupConditionsSubprocess",value:function(e,t){if(0===t.conditions.length)return!0;switch(t.consideration){case vn.ALL:return t.conditions.every(function(t){return t.evaluate(e)});case vn.ANY:return t.conditions.some(function(t){return t.evaluate(e)});case vn.NONE:return!t.conditions.some(function(t){return t.evaluate(e)});case vn.AT_LEAST_COUNT:case vn.AT_LEAST_PERCENT:return t.conditions.every(function(t){return t.evaluate(e)});default:return!1}}},{key:"evaluateRulesForAction",value:function(e,t,i){var n=t.filter(function(e){return e.action===i});if(0===n.length)return null;var r=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Nn=Object.defineProperty,qn=function(e,t,i){return function(e,t,i){return t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Dn=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qn(this,"childFilter"),qn(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,i=[{key:"measureRollupProcess",value:function(e){var t=this;if(!e.sequencingControls.rollupObjectiveSatisfied)return[];var i=e.getAvailableChildren();if(0===i.length)return[];var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"measure")||!e.objectiveMeasureStatus||null===e.objectiveNormalizedMeasure||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});if(0===r.length)return e.objectiveMeasureStatus=!1,[];var o=this.calculateComplexWeightedMeasure(e,r,{enableThresholdBias:!1});return e.objectiveNormalizedMeasure=o,e.objectiveMeasureStatus=!0,this.identifyActivityClusters(r)}},{key:"completionMeasureRollupProcess",value:function(e){var t=e.getAvailableChildren();if(0!==t.length){var i=t.filter(function(e){return e.attemptCompletionAmountStatus});if(0!==i.length){var n=0,r=0,o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;n+=u.attemptCompletionAmount*u.progressWeight,r+=u.progressWeight}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}r>0&&(e.attemptCompletionAmount=n/r,e.attemptCompletionAmountStatus=!0)}else e.attemptCompletionAmountStatus=!1}}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){var n,r,o=0,a=0,s=[],l=null===(n=null==i?void 0:i.enableThresholdBias)||void 0===n||n,c=!0,u=!1,d=void 0;try{for(var v,f=t[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(this.childFilter.checkChildForRollupSubprocess(h,"measure")&&h.objectiveMeasureStatus&&null!==h.objectiveNormalizedMeasure){var m=this.calculateAdjustedWeight(h,h.sequencingControls.objectiveMeasureWeight,l);o+=h.objectiveNormalizedMeasure*m,a+=m,s.push({childId:h.id,measure:h.objectiveNormalizedMeasure,weight:m})}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return null===(r=this.eventCallback)||void 0===r||r.call(this,"complex_weighting_calculated",{activityId:e.id,weightingDetails:s,totalWeight:a,totalWeightedMeasure:o,result:a>0?o/a:0}),a>0?o/a:0}},{key:"calculateAdjustedWeight",value:function(e,t){var i,n=2>=arguments.length||void 0===arguments[2]||arguments[2],r=t;return"completed"!==e.completionStatus&&(r*=.8),e.attemptCount>1&&(r*=Math.max(.5,1-.1*(e.attemptCount-1))),e.hasAttemptLimitExceeded()&&(r*=.6),n&&e.objectiveMeasureStatus&&(r*=(null!==(i=e.scaledPassingScore)&&void 0!==i?i:.7)>e.objectiveNormalizedMeasure?.95:1.05),Math.max(0,r)}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Ln=Object.defineProperty,zn=function(e,t,i){return function(e,t,i){return t in e?Ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Fn=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),zn(this,"childFilter"),zn(this,"ruleEvaluator"),zn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.eventCallback=n||null}return t=e,(i=[{key:"objectiveRollupProcess",value:function(e){var t=this.objectiveRollupUsingRules(e,e.rollupRules.rules);if(null!==t)return e.objectiveSatisfiedStatus=t,void this.syncPrimaryObjectiveFromActivity(e);var i=this.objectiveRollupUsingMeasure(e);if(null!==i)return e.objectiveSatisfiedStatus=i,void this.syncPrimaryObjectiveFromActivity(e);e.objectiveSatisfiedStatus=this.objectiveRollupUsingDefault(e),this.syncPrimaryObjectiveFromActivity(e)}},{key:"objectiveRollupUsingRules",value:function(e,t){var i=t.filter(function(e){return e.action===dn.SATISFIED}),n=t.filter(function(e){return e.action===dn.NOT_SATISFIED}),r=!0,o=!1,a=void 0;try{for(var s,l=i[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.ruleEvaluator.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}var c=!0,u=!1,d=void 0;try{for(var v,f=n[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)if(this.ruleEvaluator.evaluateRollupRule(e,v.value))return!1}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return null}},{key:"objectiveRollupUsingMeasure",value:function(e){return e.objectiveMeasureStatus&&null!==e.scaledPassingScore?e.objectiveNormalizedMeasure>=e.scaledPassingScore:null}},{key:"objectiveRollupUsingDefault",value:function(e){var t=this,i=e.getAvailableChildren();if(0===i.length)return!1;var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")||!t.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});return 0!==r.length&&!r.some(function(e){return!t.childFilter.isChildSatisfiedForRollup(e)})&&r.every(function(e){return t.childFilter.isChildSatisfiedForRollup(e)})}},{key:"syncPrimaryObjectiveFromActivity",value:function(e){e.primaryObjective&&(e.primaryObjective.satisfiedStatus=e.objectiveSatisfiedStatus,e.primaryObjective.satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,e.primaryObjective.measureStatus=e.objectiveMeasureStatus,e.primaryObjective.normalizedMeasure=e.objectiveNormalizedMeasure,e.primaryObjective.progressMeasure=e.progressMeasure,e.primaryObjective.progressMeasureStatus=e.progressMeasureStatus,e.primaryObjective.completionStatus=e.completionStatus)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Bn=Object.defineProperty,Vn=function(e,t,i){return function(e,t,i){return t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Hn=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vn(this,"childFilter"),Vn(this,"ruleEvaluator"),Vn(this,"objectiveProcessor"),Vn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.objectiveProcessor=n,this.eventCallback=r||null}return t=e,(i=[{key:"activityProgressRollupProcess",value:function(e){var t=this;if(!this.activityProgressRollupUsingMeasure(e)){var i=e.rollupRules,n=i.rules.filter(function(e){return e.action===dn.COMPLETED}),r=i.rules.filter(function(e){return e.action===dn.INCOMPLETE}),o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)if(this.ruleEvaluator.evaluateRollupRule(e,l.value))return e.completionStatus=ge,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=!0,d=!1,v=void 0;try{for(var f,h=r[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)if(this.ruleEvaluator.evaluateRollupRule(e,f.value))return e.completionStatus=be,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var m=e.getAvailableChildren().filter(function(e){return t.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&t.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")});if(0===m.length)return e.completionStatus=be,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);if(m.some(function(e){return!t.childFilter.isChildCompletedForRollup(e)}))return e.completionStatus=be,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);e.completionStatus=ge,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}}},{key:"activityProgressRollupUsingMeasure",value:function(e){return!!e.completedByMeasure&&(e.attemptCompletionAmountStatus?(e.completionStatus=e.minProgressMeasure>e.attemptCompletionAmount?be:ge,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0):(e.completionStatus=_e,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Un=Object.defineProperty,Gn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}return t=e,(i=[{key:"durationRollupProcess",value:function(e){if(0!==e.children.length){var t=e.getAvailableChildren();if(0!==t.length){var i=null,n=null,r=null,s=null,l=0,c=0,u=!0,d=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value;m.activityStartTimestampUtc&&(i&&m.activityStartTimestampUtc>=i||(i=m.activityStartTimestampUtc)),m.activityEndedDate&&(r&&r>=m.activityEndedDate||(r=m.activityEndedDate));var p="PT0H0M0S"!==m.activityExperiencedDurationValue?m.activityExperiencedDurationValue:m.activityExperiencedDuration;if(p&&"PT0H0M0S"!==p&&(l+=a(p,xe)),!e.attemptStartTimestampUtc||m.attemptStartTimestampUtc&&m.attemptStartTimestampUtc>=e.attemptStartTimestampUtc){m.attemptStartTimestampUtc&&(n&&m.attemptStartTimestampUtc>=n||(n=m.attemptStartTimestampUtc)),m.activityEndedDate&&(s&&s>=m.activityEndedDate||(s=m.activityEndedDate));var y="PT0H0M0S"!==m.attemptExperiencedDurationValue?m.attemptExperiencedDurationValue:m.attemptExperiencedDuration;y&&"PT0H0M0S"!==y&&(c+=a(y,xe))}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}if(null!==i){var g;if(e.activityStartTimestampUtc=i,!e.attemptStartTimestampUtc&&n&&(e.attemptStartTimestampUtc=n),e.activityEndedDate=r,r&&e.activityStartTimestampUtc){var b=new Date(e.activityStartTimestampUtc),_=r.getTime()-b.getTime();e.activityAbsoluteDurationValue=o(Math.max(0,_/1e3))}if(s&&e.attemptStartTimestampUtc){var S=new Date(e.attemptStartTimestampUtc),w=s.getTime()-S.getTime();e.attemptAbsoluteDurationValue=o(Math.max(0,w/1e3))}e.activityExperiencedDurationValue=o(l),e.attemptExperiencedDurationValue=o(c),null===(g=this.eventCallback)||void 0===g||g.call(this,"duration_rollup_completed",{activityId:e.id,activityAbsoluteDuration:e.activityAbsoluteDurationValue,attemptAbsoluteDuration:e.attemptAbsoluteDurationValue,activityExperiencedDuration:e.activityExperiencedDurationValue,attemptExperiencedDuration:e.attemptExperiencedDurationValue,childCount:t.length})}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Kn=Object.defineProperty,Yn=function(e,t,i){return function(e,t,i){return t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Wn=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Yn(this,"measureProcessor"),Yn(this,"objectiveProcessor"),Yn(this,"progressProcessor"),Yn(this,"eventCallback"),Yn(this,"processingClusters",new Set),this.measureProcessor=t,this.objectiveProcessor=i,this.progressProcessor=n,this.eventCallback=r||null}return t=e,i=[{key:"processCrossClusterDependencies",value:function(e,t){var i,n,r,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(10>a)if(this.processingClusters.has(e.id))null===(i=this.eventCallback)||void 0===i||i.call(this,"cross_cluster_skip_reentrant",{activityId:e.id});else try{var s,l;this.processingClusters.add(e.id),null===(s=this.eventCallback)||void 0===s||s.call(this,"cross_cluster_processing_started",{activityId:e.id,clusterCount:t.length,depth:a});var c=new Map,u=!0,d=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.analyzeCrossClusterDependencies(f.value,c)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var m=this.resolveDependencyOrder(c),p=!0,y=!1,g=void 0;try{for(var b,_,S=function(){var e=_.value,i=t.find(function(t){return t.id===e});i&&b.processClusterRollup(i,a)},w=m[Symbol.iterator]();!(p=(_=w.next()).done);p=!0)b=this,S()}catch(e){y=!0,g=e}finally{try{p||null==w.return||w.return()}finally{if(y)throw g}}null===(l=this.eventCallback)||void 0===l||l.call(this,"cross_cluster_processing_completed",{activityId:e.id,processedClusters:m.length,dependencyMap:Array.from(c.entries())})}catch(t){var C;null===(C=this.eventCallback)||void 0===C||C.call(this,"cross_cluster_processing_error",{activityId:e.id,error:(n=t,r=Error,(null!=r&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)?t.message:t+"")})}finally{this.processingClusters.delete(e.id)}else null===(o=this.eventCallback)||void 0===o||o.call(this,"cross_cluster_max_depth_reached",{activityId:e.id,depth:a,maxDepth:10})}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"analyzeCrossClusterDependencies",value:function(e,t){t.set(e.id,[])}},{key:"resolveDependencyOrder",value:function(e){var t=this,i=[],n=new Set,r=function(id){if(!i.includes(id))if(n.has(id)){var o,a;null===(o=(a=t).eventCallback)||void 0===o||o.call(a,"circular_dependency_detected",{activityId:id})}else{n.add(id);var s=e.get(id)||[],l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)r(d.value)}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}n.delete(id),i.push(id)}},o=!0,a=!1,s=void 0;try{for(var l,c=Array.from(e.keys())[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)r(l.value)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return i}},{key:"processClusterRollup",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.measureProcessor.measureRollupProcess(e);e.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(e),e.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(e),i.length>1&&this.processCrossClusterDependencies(e,i,t+1)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Jn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Xn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var $n=Object.defineProperty,Qn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}var t,i,n;return t=e,n=[{key:"getGlobalObjectiveReadState",value:function(e,t,i,n){var r={};if(i.readSatisfiedStatus&&n.satisfiedStatusKnown&&(r.satisfiedStatus=n.satisfiedStatus),i.readNormalizedMeasure&&n.normalizedMeasureKnown&&(r.normalizedMeasure=n.normalizedMeasure,t.satisfiedByMeasure)){var o,a,s=null!==(o=null!==(a=t.minNormalizedMeasure)&&void 0!==a?a:e.scaledPassingScore)&&void 0!==o?o:.7;r.satisfiedStatus=n.normalizedMeasure>=s}return i.readCompletionStatus&&n.completionStatusKnown&&(r.completionStatus=n.completionStatus),i.readProgressMeasure&&n.progressMeasureKnown&&(r.progressMeasure=n.progressMeasure),i.readRawScore&&n.rawScoreKnown&&(r.rawScore=n.rawScore),i.readMinScore&&n.minScoreKnown&&(r.minScore=n.minScore),i.readMaxScore&&n.maxScoreKnown&&(r.maxScore=n.maxScore),r}}],(i=[{key:"processGlobalObjectiveMapping",value:function(e,t){try{var i,n;null===(i=this.eventCallback)||void 0===i||i.call(this,"global_objective_processing_started",{activityId:e.id,globalObjectiveCount:t.size});var r=[];this.collectActivitiesRecursive(e,r);var o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)this.syncGlobalObjectivesWritePhase(l.value,t)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=!0,d=!1,v=void 0;try{for(var f,h=r[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.syncGlobalObjectivesReadPhase(f.value,t)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}null===(n=this.eventCallback)||void 0===n||n.call(this,"global_objective_processing_completed",{activityId:e.id,processedObjectives:t.size})}catch(t){var m;null===(m=this.eventCallback)||void 0===m||m.call(this,"global_objective_processing_error",{activityId:e.id,error:Xn(t,Error)?t.message:t+""})}}},{key:"collectActivitiesRecursive",value:function(e,result){result.push(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.collectActivitiesRecursive(r.value,result)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"syncGlobalObjectivesWritePhase",value:function(e,t){if(this.canWriteGlobalObjectives(e)){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],c=new Set,u=!0,d=!1,v=void 0;try{for(var f,h=l[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value,p=this.ensureGlobalObjectiveEntry(t,m.targetObjectiveID||s.id,s);if(m.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(s)&&s.isDirty("satisfiedStatus")&&(p.satisfiedStatus=s.satisfiedStatus,p.satisfiedStatusKnown=!0,c.add("satisfiedStatus")),m.writeNormalizedMeasure&&s.measureStatus&&s.isDirty("normalizedMeasure")&&(p.normalizedMeasure=s.normalizedMeasure,p.normalizedMeasureKnown=!0,c.add("normalizedMeasure"),m.writeSatisfiedStatus&&s.satisfiedByMeasure)){var y,g,b=null!==(y=null!==(g=s.minNormalizedMeasure)&&void 0!==g?g:e.scaledPassingScore)&&void 0!==y?y:.7;p.satisfiedStatus=s.normalizedMeasure>=b,p.satisfiedStatusKnown=!0,c.add("satisfiedStatus")}m.writeCompletionStatus&&s.completionStatus!==_e&&s.isDirty("completionStatus")&&(p.completionStatus=s.completionStatus,p.completionStatusKnown=!0,c.add("completionStatus")),m.writeRawScore&&s.rawScoreKnown&&s.isDirty("rawScore")&&(p.rawScore=s.rawScore,p.rawScoreKnown=!0,c.add("rawScore")),m.writeMinScore&&s.minScoreKnown&&s.isDirty("minScore")&&(p.minScore=s.minScore,p.minScoreKnown=!0,c.add("minScore")),m.writeMaxScore&&s.maxScoreKnown&&s.isDirty("maxScore")&&(p.maxScore=s.maxScore,p.maxScoreKnown=!0,c.add("maxScore")),m.writeProgressMeasure&&s.progressMeasureStatus&&s.isDirty("progressMeasure")&&(p.progressMeasure=s.progressMeasure,p.progressMeasureKnown=!0,c.add("progressMeasure")),m.updateAttemptData&&this.updateActivityAttemptData(e,p,s)}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var _=!0,S=!1,w=void 0;try{for(var C,O=c[Symbol.iterator]();!(_=(C=O.next()).done);_=!0)s.clearDirty(C.value)}catch(e){S=!0,w=e}finally{try{_||null==O.return||O.return()}finally{if(S)throw w}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"syncGlobalObjectivesReadPhase",value:function(t,i){var objectives=t.getAllObjectives(),n=!0,r=!1,o=void 0;try{for(var a,s=objectives[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,c=l.mapInfo.length>0?l.mapInfo:[this.createDefaultMapInfo(l)],u=!0,d=!1,v=void 0;try{for(var f,h=c[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m,p=f.value,y=i.get(p.targetObjectiveID||l.id);if(y){var g=l.isPrimary,b=e.getGlobalObjectiveReadState(t,l,p,y);this.applyGlobalObjectiveReadState(l,b),g&&l.applyToActivity(t),null===(m=this.eventCallback)||void 0===m||m.call(this,"objective_synchronized",{activityId:t.id,objectiveId:l.id,globalState:y,synchronizationTime:(new Date).toISOString()})}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"synchronizeGlobalObjectives",value:function(e,t){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value,m=this.ensureGlobalObjectiveEntry(t,h.targetObjectiveID||s.id,s);this.syncObjectiveState(e,s,h,m)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"syncObjectiveState",value:function(t,i,n,r){try{var o,a=this.getLocalObjectiveState(t,i,i.isPrimary),s=e.getGlobalObjectiveReadState(t,i,n,r);if(this.applyGlobalObjectiveReadState(i,s),i.isPrimary&&i.applyToActivity(t),this.canWriteGlobalObjectives(t)){if(n.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(i)&&(r.satisfiedStatus=i.satisfiedStatus,r.satisfiedStatusKnown=!0),n.writeNormalizedMeasure&&i.measureStatus&&(r.normalizedMeasure=i.normalizedMeasure,r.normalizedMeasureKnown=!0,n.writeSatisfiedStatus&&i.satisfiedByMeasure)){var l,c,u=null!==(l=null!==(c=i.minNormalizedMeasure)&&void 0!==c?c:t.scaledPassingScore)&&void 0!==l?l:.7;r.satisfiedStatus=i.normalizedMeasure>=u,r.satisfiedStatusKnown=!0}n.writeCompletionStatus&&i.completionStatus!==_e&&(r.completionStatus=i.completionStatus,r.completionStatusKnown=!0),n.writeRawScore&&i.rawScoreKnown&&(r.rawScore=i.rawScore,r.rawScoreKnown=!0),n.writeMinScore&&i.minScoreKnown&&(r.minScore=i.minScore,r.minScoreKnown=!0),n.writeMaxScore&&i.maxScoreKnown&&(r.maxScore=i.maxScore,r.maxScoreKnown=!0),n.writeProgressMeasure&&i.progressMeasureStatus&&(r.progressMeasure=i.progressMeasure,r.progressMeasureKnown=!0),n.updateAttemptData&&this.updateActivityAttemptData(t,r,i)}null===(o=this.eventCallback)||void 0===o||o.call(this,"objective_synchronized",{activityId:t.id,objectiveId:i.id,localState:a,globalState:r,synchronizationTime:(new Date).toISOString()})}catch(e){var d;null===(d=this.eventCallback)||void 0===d||d.call(this,"objective_sync_error",{activityId:t.id,objectiveId:i.id,error:Xn(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"applyGlobalObjectiveReadState",value:function(e,t){e.applyReadMappedState(t)}},{key:"ensureGlobalObjectiveEntry",value:function(e,t,i){return e.has(t)||e.set(t,{id:t,satisfiedStatus:!1,satisfiedStatusKnown:!1,normalizedMeasure:0,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:0,progressMeasureKnown:!1,completionStatus:_e,completionStatusKnown:!1,satisfiedByMeasure:i.satisfiedByMeasure,minNormalizedMeasure:i.minNormalizedMeasure}),e.get(t)}},{key:"createDefaultMapInfo",value:function(e){return{targetObjectiveID:e.id,readSatisfiedStatus:!1,writeSatisfiedStatus:!0,readNormalizedMeasure:!1,writeNormalizedMeasure:!0,readCompletionStatus:!1,writeCompletionStatus:!0,readProgressMeasure:!1,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,updateAttemptData:e.isPrimary}}},{key:"hasKnownSatisfiedStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown}},{key:"canWriteGlobalObjectives",value:function(e){return!1!==e.sequencingControls.tracked}},{key:"getLocalObjectiveState",value:function(e,t,i){return i?{id:t.id,satisfiedStatus:e.objectiveSatisfiedStatus,measureStatus:e.objectiveMeasureStatus,normalizedMeasure:e.objectiveNormalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,scaledPassingScore:e.scaledPassingScore}:{id:t.id,satisfiedStatus:t.satisfiedStatus,measureStatus:t.measureStatus,normalizedMeasure:t.normalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:t.progressMeasure,progressMeasureStatus:t.progressMeasureStatus,completionStatus:t.completionStatus,scaledPassingScore:t.minNormalizedMeasure}}},{key:"updateActivityAttemptData",value:function(e,t,i){try{if(!i.isPrimary&&!t.updateAttemptData)return;var n=e.rollupRules.rules.some(function(e){return"completed"===e.action||"incomplete"===e.action});t.satisfiedStatusKnown&&t.satisfiedStatus&&(n||e.sequencingControls.completionSetByContent||e.attemptProgressStatus||e.completionStatus!==_e&&e.completionStatus!==be||(e.completionStatus=ge),"unknown"===e.successStatus&&(e.successStatus="passed")),t.attemptCount&&t.attemptCount>e.attemptCount&&(e.attemptCount=t.attemptCount),t.progressMeasureKnown&&void 0!==t.progressMeasure&&(e.attemptCompletionAmount=t.progressMeasure),t.attemptAbsoluteDuration&&(e.attemptAbsoluteDuration=t.attemptAbsoluteDuration),t.attemptExperiencedDuration&&(e.attemptExperiencedDuration=t.attemptExperiencedDuration),t.activityAbsoluteDuration&&(e.activityAbsoluteDuration=t.activityAbsoluteDuration),t.activityExperiencedDuration&&(e.activityExperiencedDuration=t.activityExperiencedDuration),void 0!==t.location&&(e.location=t.location),void 0!==t.suspendData&&(e.isSuspended=t.suspendData.length>0)}catch(t){var r;null===(r=this.eventCallback)||void 0===r||r.call(this,"attempt_data_update_error",{activityId:e.id,error:Xn(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}}}])&&Jn(t.prototype,i),n&&Jn(t,n),e}();function Zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var er=Object.defineProperty,tr=function(e,t,i){return function(e,t,i){return t in e?er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ir=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),tr(this,"rollupStateLog",[]),tr(this,"childFilter"),tr(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,(i=[{key:"validateRollupStateConsistency",value:function(e){try{var t,i;null===(t=this.eventCallback)||void 0===t||t.call(this,"rollup_validation_started",{activityId:e.id,timestamp:(new Date).toISOString()});var n,r=[];return this.validateActivityRollupState(e,r),r.length>0?(null===(n=this.eventCallback)||void 0===n||n.call(this,"rollup_state_inconsistencies",{activityId:e.id,inconsistencies:r,count:r.length}),!1):(null===(i=this.eventCallback)||void 0===i||i.call(this,"rollup_validation_completed",{activityId:e.id,result:"consistent"}),!0)}catch(t){var o;return null===(o=this.eventCallback)||void 0===o||o.call(this,"rollup_validation_error",{activityId:e.id,error:(a=t,s=Error,(null!=s&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](a):a instanceof s)?t.message:t+"")}),!1}var a,s}},{key:"validateActivityRollupState",value:function(e,t){var i=this,n=e.id;e.objectiveMeasureStatus&&null===e.objectiveNormalizedMeasure&&t.push("Activity ".concat(n,": measure status true but normalized measure is null")),e.objectiveMeasureStatus&&null!==e.scaledPassingScore&&"unknown"!==e.successStatus&&e.objectiveSatisfiedStatus!==e.objectiveNormalizedMeasure>=e.scaledPassingScore&&t.push("Activity ".concat(n,": satisfaction status inconsistent with measure"));var r=e.sequencingControls,o=e.getAvailableChildren();if(o.length>0&&r.rollupObjectiveSatisfied){var a=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")&&i.childFilter.isChildSatisfiedForRollup(e)}),s=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")&&!i.childFilter.isChildSatisfiedForRollup(e)});a.length>0&&0===s.length&&!1===e.objectiveSatisfiedStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children satisfied but parent is not satisfied (no rollup rules to override)"))}if(o.length>0&&r.rollupProgressCompletion){var l=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&i.childFilter.isChildCompletedForRollup(e)}),c=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")&&!i.childFilter.isChildCompletedForRollup(e)});l.length>0&&0===c.length&&"completed"!==e.completionStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children completed but parent is incomplete (no rollup rules to override)"))}var u=!0,d=!1,v=void 0;try{for(var f,h=o[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.validateActivityRollupState(f.value,t)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}this.rollupStateLog.push({activity:n,timestamp:(new Date).toISOString(),state:{measureStatus:e.objectiveMeasureStatus,measure:e.objectiveNormalizedMeasure,satisfiedStatus:e.objectiveSatisfiedStatus,completionStatus:e.completionStatus}})}},{key:"getRollupStateLog",value:function(){return function(e){if(Array.isArray(e))return Zn(e)}(e=this.rollupStateLog)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Zn(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zn(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e}},{key:"clearRollupStateLog",value:function(){this.rollupStateLog=[]}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var nr=Object.defineProperty,rr=function(e,t,i){return function(e,t,i){return t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},or=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rr(this,"childFilter"),rr(this,"ruleEvaluator"),rr(this,"measureProcessor"),rr(this,"objectiveProcessor"),rr(this,"progressProcessor"),rr(this,"durationProcessor"),rr(this,"globalObjectiveSynchronizer"),rr(this,"stateValidator"),rr(this,"crossClusterProcessor"),rr(this,"eventCallback"),this.eventCallback=t||null,this.childFilter=new xn,this.ruleEvaluator=new Pn(this.childFilter),this.measureProcessor=new Dn(this.childFilter,t),this.objectiveProcessor=new Fn(this.childFilter,this.ruleEvaluator,t),this.progressProcessor=new Hn(this.childFilter,this.ruleEvaluator,this.objectiveProcessor,t),this.durationProcessor=new Gn(t),this.globalObjectiveSynchronizer=new Qn(t),this.stateValidator=new ir(this.childFilter,t),this.crossClusterProcessor=new Wn(this.measureProcessor,this.objectiveProcessor,this.progressProcessor,t)}return t=e,(i=[{key:"overallRollupProcess",value:function(e){for(var t=[],i=e.parent,n=!1,r=!0;i;){if(i.children.length>0&&this.durationProcessor.durationRollupProcess(i),!n){var o=i.captureRollupStatus();if(i.sequencingControls.rollupObjectiveSatisfied||i.sequencingControls.rollupProgressCompletion){if(i.children.length>0){var a=this.measureProcessor.measureRollupProcess(i);this.measureProcessor.completionMeasureRollupProcess(i),a.length>1&&this.crossClusterProcessor.processCrossClusterDependencies(i,a)}i.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(i),i.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(i)}var s,l=i.captureRollupStatus();r||Tn.compareRollupStatus(o,l)&&(null===(s=this.eventCallback)||void 0===s||s.call(this,"rollup_optimization_activated",{activityId:i.id,depth:t.length}),n=!0),!r&&Tn.compareRollupStatus(o,l)||t.push(i)}i=i.parent,r=!1}return t}},{key:"validateRollupStateConsistency",value:function(e){return this.stateValidator.validateRollupStateConsistency(e)}},{key:"processGlobalObjectiveMapping",value:function(e,t){this.globalObjectiveSynchronizer.processGlobalObjectiveMapping(e,t)}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){return this.measureProcessor.calculateComplexWeightedMeasure(e,t,i)}},{key:"processCrossClusterDependencies",value:function(e,t){this.crossClusterProcessor.processCrossClusterDependencies(e,t)}},{key:"getChildFilter",value:function(){return this.childFilter}},{key:"getRuleEvaluator",value:function(){return this.ruleEvaluator}},{key:"getMeasureProcessor",value:function(){return this.measureProcessor}},{key:"getObjectiveProcessor",value:function(){return this.objectiveProcessor}},{key:"getProgressProcessor",value:function(){return this.progressProcessor}},{key:"getDurationProcessor",value:function(){return this.durationProcessor}},{key:"getGlobalObjectiveSynchronizer",value:function(){return this.globalObjectiveSynchronizer}},{key:"getStateValidator",value:function(){return this.stateValidator}},{key:"getCrossClusterProcessor",value:function(){return this.crossClusterProcessor}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function ar(e){var t=e.completionThreshold,i=e.progressMeasure,n=e.storedCompletionStatus;if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r)){if(""!==i&&null!=i){var o=parseFloat(i+"");if(!isNaN(o))return r>o?be:ge}return _e}}return n||_e}var sr=Object.defineProperty,lr=[ge,be,_e],cr=[me,pe,ye];function ur(e){return e&&lr.includes(e)?e:null}function dr(e){return e&&cr.includes(e)?e:null}var vr=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"transferRteData",value:function(e){if(this.context.getCMIData){var t=this.context.getCMIData();t&&(this.transferPrimaryObjective(e,t),this.transferNonPrimaryObjectives(e,t),this.context.fireEvent("onRteDataTransfer",{activityId:e.id,timestamp:(new Date).toISOString()}))}}},{key:"transferPrimaryObjective",value:function(e,t){var i=!1;if(t.progress_measure&&""!==t.progress_measure){var n=parseFloat(t.progress_measure);isNaN(n)||(i=!0,e.progressMeasure=n,e.progressMeasureStatus=!0,e.attemptCompletionAmount=n,e.attemptCompletionAmountStatus=!0,e.primaryObjective&&(e.primaryObjective.progressMeasure=n,e.primaryObjective.progressMeasureStatus=!0))}if(i||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var r=ar({completionThreshold:e.minProgressMeasure,progressMeasure:t.progress_measure,storedCompletionStatus:_e});e.completionStatus=r,e.attemptProgressStatus=r!==_e}else{var o=ur(t.completion_status);o&&o!==_e&&(e.completionStatus=o,e.attemptProgressStatus=!0)}var a=!1,s=!1,l=!1,c=0,u=dr(t.success_status);if(u&&u!==ye&&(a=!0,e.objectiveSatisfiedStatus=s=u===me,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=u),t.score){var d;null===(d=e.primaryObjective)||void 0===d||d.initializeScoreFromCMI(this.getObjectiveScoreState(t.score));var v=this.normalizeScore(t.score);null!==v&&(l=!0,e.objectiveNormalizedMeasure=c=v,e.objectiveMeasureStatus=!0)}e.primaryObjective&&(a||l)&&(e.primaryObjective.initializeFromCMI(a?s:e.primaryObjective.satisfiedStatus,l?c:e.primaryObjective.normalizedMeasure,l),a&&(e.primaryObjective.satisfiedStatusKnown=!0,e.primaryObjective.progressStatus=!0))}},{key:"transferNonPrimaryObjectives",value:function(e,t){if(t.objectives&&0!==t.objectives.length){var i=!0,n=!1,r=void 0;try{for(var o,a=t.objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.id){var l=e.getObjectiveById(s.id);if(l){var c=l.objective,u=l.isPrimary,d=!1,v=!1,f=!1,h=0,m=!1,p=!1,y=dr(s.success_status);y&&y!==ye&&(v=y===me,d=!0,c.progressStatus=!0);var g=ur(s.completion_status);if(g&&g!==_e&&(c.completionStatus=g,m=!0),s.score){c.initializeScoreFromCMI(this.getObjectiveScoreState(s.score));var b=this.normalizeScore(s.score);null!==b&&(h=b,f=!0)}if((d||f)&&(c.initializeFromCMI(d?v:c.satisfiedStatus,f?h:c.normalizedMeasure,f),d&&(c.satisfiedStatusKnown=!0)),s.progress_measure&&""!==s.progress_measure){var _=parseFloat(s.progress_measure);isNaN(_)||(c.progressMeasure=_,c.progressMeasureStatus=!0,p=!0)}u&&(d||f||m||p)&&(c.applyToActivity(e),y&&y!==ye&&(e.successStatus=y),m&&(e.attemptProgressStatus=!0),p&&(e.attemptCompletionAmount=c.progressMeasure,e.attemptCompletionAmountStatus=!0))}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"normalizeScore",value:function(score){if(score.scaled&&""!==score.scaled){var e=parseFloat(score.scaled);if(!isNaN(e))return e}if(score.raw&&""!==score.raw&&score.min&&""!==score.min&&score.max&&""!==score.max){var t=parseFloat(score.raw),i=parseFloat(score.min),n=parseFloat(score.max);if(!isNaN(t)&&!isNaN(i)&&!isNaN(n)&&n>i)return Math.max(-1,Math.min(1,(t-i)/(n-i)))}return null}},{key:"getObjectiveScoreState",value:function(score){var e={};return void 0!==score.raw&&(e.rawScore=score.raw),void 0!==score.min&&(e.minScore=score.min),void 0!==score.max&&(e.maxScore=score.max),e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var fr=Object.defineProperty,hr=function(e,t,i){return function(e,t,i){return t in e?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},mr=function(){function e(t,i,n,r){var o=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hr(this,"activityTree"),hr(this,"sequencingProcess"),hr(this,"rollupProcess"),hr(this,"globalObjectiveMap"),hr(this,"eventCallback"),hr(this,"getCMIData"),hr(this,"is4thEdition"),hr(this,"invalidateCacheCallback",null),hr(this,"_rteDataTransferService"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.globalObjectiveMap=r,this.eventCallback=a,this.getCMIData=(null==s?void 0:s.getCMIData)||null,this.is4thEdition=(null==s?void 0:s.is4thEdition)||!1,this._rteDataTransferService=new vr({getCMIData:this.getCMIData,fireEvent:function(e,t){return o.fireEvent(e,t)}})}return t=e,i=[{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"processTerminationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2?arguments[2]:void 0,i=this.activityTree.currentActivity;if(!i)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if((request===Ct.EXIT||request===Ct.ABANDON)&&!i.isActive)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-2",valid:!1};if(this.fireEvent("onTerminationRequestProcessing",{request:request,hasSequencingRequest:e,currentActivity:i.id,exitType:t}),"logout"===t)return this.fireEvent("onSequencingDebug",{message:"cmi.exit='logout' detected, treating as EXIT_ALL",activityId:i.id}),this.handleExitAll(i);switch(request){case Ct.EXIT:return this.handleExit(i,e);case Ct.EXIT_ALL:return this.handleExitAll(i);case Ct.ABANDON:return this.handleAbandon(i,e);case Ct.ABANDON_ALL:return this.handleAbandonAll(i);case Ct.SUSPEND_ALL:return this.handleSuspendAll(i);default:return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-7",valid:!1}}}},{key:"handleExitTermination",value:function(e,t){return this.handleExit(e,t)}},{key:"handleExit",value:function(e,t){e.children.length>0&&this.terminateDescendants(e),this.endAttempt(e);var i=this.evaluateExitRules(e);if("EXIT_ALL"===i.action)return this.handleExitAll(e);"EXIT_PARENT"===i.action&&e.parent&&(this.activityTree.currentActivity=e.parent,this.endAttempt(this.activityTree.currentActivity));var n,r,o=this.applyAncestorExitActionRules(e);if("EXIT_ALL"===o.action)return this.handleExitAll(o.activity||e);if(o.exception)return{terminationRequest:Ct.EXIT,sequencingRequest:null,exception:o.exception,valid:!1};do{if(n=!1,(r=this.evaluatePostConditions(this.activityTree.currentActivity||e)).terminationRequest===Ct.EXIT_ALL)return this.fireEvent("onPostConditionExitAll",{activity:(this.activityTree.currentActivity||e).id}),this.handleExitAll(this.activityTree.root);if(r.terminationRequest===Ct.EXIT_PARENT){var a=this.activityTree.currentActivity||e;if(!a.parent)return{terminationRequest:Ct.EXIT_PARENT,sequencingRequest:null,exception:"TB.2.3-4",valid:!1};this.activityTree.currentActivity=a.parent,this.endAttempt(this.activityTree.currentActivity),n=!0,this.fireEvent("onPostConditionExitParent",{fromActivity:a.id,toActivity:this.activityTree.currentActivity.id})}if(!n&&(this.activityTree.currentActivity||e)===this.activityTree.root&&r.sequencingRequest!==Ct.RETRY)return{terminationRequest:Ct.EXIT,sequencingRequest:Ct.EXIT,exception:null,valid:!0}}while(n);return{terminationRequest:Ct.EXIT,sequencingRequest:r.sequencingRequest,exception:null,valid:!0}}},{key:"handleExitAll",value:function(e){return this.activityTree.root&&this.handleMultiLevelExit(this.activityTree.root),this.activityTree.root&&this.endAttempt(this.activityTree.root),this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Ct.EXIT_ALL,sequencingRequest:Ct.EXIT,exception:null,valid:!0}}},{key:"handleAbandon",value:function(e,t){return e.isActive=!1,t||(this.activityTree.currentActivity=e.parent),{terminationRequest:Ct.ABANDON,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleAbandonAll",value:function(e){for(var t=[],i=e;null!==i;)t.push(i),i=i.parent;if(0===t.length)return{terminationRequest:Ct.ABANDON_ALL,sequencingRequest:null,exception:"TB.2.3-6",valid:!1};var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)a.value.isActive=!1}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Ct.ABANDON_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleSuspendAll",value:function(e){var t=this.processSuspendAllRequest(e);return t.valid?{terminationRequest:Ct.SUSPEND_ALL,sequencingRequest:Ct.EXIT,exception:null,valid:!0}:t}},{key:"processSuspendAllRequest",value:function(e){var t=this.activityTree.root;if(!e||!t)return this.fireEvent("onSuspendError",{exception:"TB.2.3-1",message:"No current activity to suspend",activity:null==e?void 0:e.id}),{terminationRequest:Ct.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if(e===t&&!e.isActive&&!e.isSuspended)return this.fireEvent("onSuspendError",{exception:"TB.2.3-3",message:"Nothing to suspend (root activity)",activity:e.id}),{terminationRequest:Ct.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-3",valid:!1};this.activityTree.suspendedActivity=e;for(var i=e,n=[],r=i;null!==r;)n.push(r),r=r.parent;if(0===n.length)return this.fireEvent("onSuspendError",{exception:"TB.2.3-5",message:"Activity path is empty",activity:null==i?void 0:i.id}),{terminationRequest:Ct.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-5",valid:!1};var o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;u.isActive=!1,u.isSuspended=!0}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return this.activityTree.currentActivity=t,t.isActive=!1,this.fireEvent("onActivitySuspended",{activity:null==i?void 0:i.id,suspendedPath:n.map(function(e){return e.id}),pathLength:n.length,timestamp:(new Date).toISOString()}),{terminationRequest:Ct.SUSPEND_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"evaluateExitRules",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t++;var i=e.sequencingRules.exitConditionRules,n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l.evaluate(e)){if(l.action===ut.EXIT)return{action:"EXIT",recursionDepth:t};if(l.action===ut.EXIT_PARENT)return{action:"EXIT_PARENT",recursionDepth:t};if(l.action===ut.EXIT_ALL)return{action:"EXIT_ALL",recursionDepth:t}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null,recursionDepth:t}}},{key:"evaluatePostConditions",value:function(e){var t=this.sequencingProcess.evaluatePostConditionRules(e);return(t.sequencingRequest||t.terminationRequest)&&this.fireEvent("onPostConditionEvaluated",{activity:e.id,sequencingRequest:t.sequencingRequest,terminationRequest:t.terminationRequest,timestamp:(new Date).toISOString()}),t}},{key:"handleMultiLevelExit",value:function(e){this.processExitAtLevel(e,0),this.terminateAll(e)}},{key:"applyAncestorExitActionRules",value:function(e){for(var t=[],i=e.parent;i;)t.unshift(i),i=i.parent;var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,c=this.exitActionRulesSubprocess(l);if("EXIT_ALL"===c)return this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT_ALL",activity:l};if("EXIT_PARENT"===c)return l.parent?(this.terminateDescendants(l.parent),this.activityTree.currentActivity=l.parent,this.endAttempt(l.parent),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c,currentActivity:l.parent.id}),{action:"EXIT_PARENT",activity:l.parent}):{action:"EXIT_PARENT",activity:l,exception:"TB.2.3-4"};if("EXIT"===c)return this.terminateDescendants(l),this.activityTree.currentActivity=l,this.endAttempt(l),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT",activity:l}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null}}},{key:"processExitAtLevel",value:function(e,t){var i=this.evaluateExitRules(e,0);i.action&&this.fireEvent("onMultiLevelExitAction",{activity:e.id,level:t,action:i.action});var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.processExitAtLevel(a.value,t+1)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"cleanupSuspendedActivity",value:function(){var e=this.activityTree.suspendedActivity;if(e){for(var t=e,i=[];t;)t.isSuspended&&(t.isSuspended=!1,i.push(t.id)),t=t.parent;this.activityTree.suspendedActivity=null,this.fireEvent("onSuspendedActivityCleanup",{cleanedActivities:i,originalSuspendedActivity:e.id})}}},{key:"terminateAll",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateAll(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}e.isActive&&this.endAttempt(e)}},{key:"terminateDescendants",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.children.length>0&&this.terminateDescendants(a);var s=this.exitActionRulesSubprocess(a);a.isActive&&("EXIT_ALL"===s&&this.terminateDescendants(a),this.endAttempt(a))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"exitActionRulesSubprocess",value:function(e){var t=e.sequencingRules.exitConditionRules,i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.evaluate(e)){if(s.action===ut.EXIT)return"EXIT";if(s.action===ut.EXIT_PARENT)return"EXIT_PARENT";if(s.action===ut.EXIT_ALL)return"EXIT_ALL"}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"clearSuspendedActivity",value:function(){if(this.activityTree.suspendedActivity){for(var e=this.activityTree.suspendedActivity;e;)e.isSuspended=!1,e=e.parent;this.activityTree.suspendedActivity=null}}},{key:"endAttempt",value:function(e){if(e.isActive){if(this._rteDataTransferService.transferRteData(e),e.isActive=!1,e.activityAttemptActive=!1,0===e.children.length){if(!e.isSuspended&&(e.sequencingControls.completionSetByContent||e.attemptProgressStatus||(e.attemptProgressStatus=!0,e.completionStatus="completed",e.wasAutoCompleted=!0,this.fireEvent("onAutoCompletion",{activityId:e.id,timestamp:(new Date).toISOString()})),!e.sequencingControls.objectiveSetByContent)){var t=e.primaryObjective;t&&(t.progressStatus||(t.progressStatus=!0,t.satisfiedStatus=!0,e.objectiveSatisfiedStatus=!0,e.successStatus="passed",e.wasAutoSatisfied=!0,this.fireEvent("onAutoSatisfaction",{activityId:e.id,timestamp:(new Date).toISOString()})))}}else{var i=e.children.some(function(e){return e.isSuspended});e.isSuspended=i}"unknown"===e.completionStatus&&(e.completionStatus="incomplete"),"unknown"===e.successStatus&&e.objectiveSatisfiedStatus&&(e.successStatus=e.objectiveSatisfiedStatus?"passed":"failed"),this.rollupProcess.processGlobalObjectiveMapping(this.activityTree.root||e,this.globalObjectiveMap),this.rollupProcess.overallRollupProcess(e),this.invalidateCacheCallback&&this.invalidateCacheCallback(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root),Ht.applySelectionAndRandomization(e,!1)}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function br(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){gr(e,t,i[t])})}return e}function _r(e){return function(e){if(Array.isArray(e))return pr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return pr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?pr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Sr=Object.defineProperty,wr=function(e,t,i){return function(e,t,i){return t in e?Sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Cr=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;yr(this,e),wr(this,"valid"),wr(this,"targetActivity"),wr(this,"exception"),this.valid=t,this.targetActivity=i,this.exception=n},Or=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;yr(this,e),wr(this,"activityTree"),wr(this,"rollupProcess"),wr(this,"globalObjectiveMap"),wr(this,"adlNav"),wr(this,"eventCallback"),wr(this,"now"),wr(this,"defaultHideLmsUi"),wr(this,"defaultAuxiliaryResources"),wr(this,"_deliveryInProgress",!1),wr(this,"contentDelivered",!1),wr(this,"checkActivityCallback",null),wr(this,"invalidateCacheCallback",null),wr(this,"updateNavigationValidityCallback",null),wr(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=i,this.globalObjectiveMap=n,this.adlNav=r,this.eventCallback=o,this.now=(null==a?void 0:a.now)||function(){return new Date},this.defaultHideLmsUi=(null==a?void 0:a.defaultHideLmsUi)?_r(a.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==a?void 0:a.defaultAuxiliaryResources)?a.defaultAuxiliaryResources.map(function(e){return br({},e)}):[]}return t=e,i=[{key:"setCheckActivityCallback",value:function(e){this.checkActivityCallback=e}},{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"setUpdateNavigationValidityCallback",value:function(e){this.updateNavigationValidityCallback=e}},{key:"setClearSuspendedActivityCallback",value:function(e){this.clearSuspendedActivityCallback=e}},{key:"isDeliveryInProgress",value:function(){return this._deliveryInProgress}},{key:"hasContentBeenDelivered",value:function(){return this.contentDelivered}},{key:"resetContentDelivered",value:function(){this.contentDelivered=!1}},{key:"setContentDelivered",value:function(e){this.contentDelivered=e}},{key:"processDeliveryRequest",value:function(e){if(this.fireEvent("onDeliveryRequestProcessing",{activity:e.id,timestamp:(new Date).toISOString()}),e.children.length>0)return new Cr(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Cr(!1,null,"DB.1.1-2");var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new Cr(!1,null,"DB.1.1-3")}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return new Cr(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var i=this.getActivityPath(e,!0),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l.isActive||(t||l.isSuspended?l.isSuspended=!1:l.incrementAttemptCount(),l.isActive=!0,Ht.applySelectionAndRandomization(l,1>=l.attemptCount))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=this.defaultHideLmsUi[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)i.add(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}for(var l=t;l;){var c=!0,u=!1,d=void 0;try{for(var v,f=l.hideLmsUi[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)i.add(v.value)}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}l=l.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return i.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,i=!0,n=!1,r=void 0;try{for(var o,a=this.defaultAuxiliaryResources[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.resourceId&&t.set(s.resourceId,br({},s))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}for(var l=[],c=e;c;)l.push(c),c=c.parent;var u=!0,d=!1,v=void 0;try{for(var f,h=l.reverse()[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value,p=!0,y=!1,g=void 0;try{for(var b,_=m.auxiliaryResources[Symbol.iterator]();!(p=(b=_.next()).done);p=!0){var S=b.value;S.resourceId&&t.set(S.resourceId,br({},S))}}catch(e){y=!0,g=e}finally{try{p||null==_.return||_.return()}finally{if(y)throw g}}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}return Array.from(t.values())}},{key:"getContentActivityData",value:function(e){var t;return{hideLmsUi:this.getEffectiveHideLmsUi(e),auxiliaryResources:this.getEffectiveAuxiliaryResources(e),location:e.location||"",credit:e.credit||"credit",launchData:e.launchData||"",maxTimeAllowed:e.attemptAbsoluteDurationLimit||"",completionThreshold:(null===(t=e.completionThreshold)||void 0===t?void 0:""+t)||"",timeLimitAction:e.timeLimitAction||"continue,no message"}}},{key:"getActivityPath",value:function(e){for(var t=1>=arguments.length||void 0===arguments[1]||arguments[1],i=[],n=e;null!==n;)i.unshift(n),n=n.parent;return!t&&i.length>0&&i.pop(),i}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();wr(Or,"HIDE_LMS_UI_ORDER",_r($e));var Ar=Or;var Er=Object.defineProperty,kr=function(e,t,i){return function(e,t,i){return t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},jr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),kr(this,"activityTree"),kr(this,"sequencingProcess"),kr(this,"cache",null),kr(this,"isDirty",!0),this.activityTree=t,this.sequencingProcess=i}return t=e,(i=[{key:"predictContinueEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.continueEnabled)&&void 0!==e&&e}},{key:"predictPreviousEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.previousEnabled)&&void 0!==e&&e}},{key:"predictChoiceEnabled",value:function(e){var t,i;return this.ensureCacheValid(),null!==(t=null===(i=this.cache)||void 0===i?void 0:i.choiceEnabledMap.get(e))&&void 0!==t&&t}},{key:"getAvailableChoices",value:function(){var e,t;return this.ensureCacheValid(),Array.from(null!==(e=null===(t=this.cache)||void 0===t?void 0:t.availableChoices)&&void 0!==e?e:[])}},{key:"getAllPredictions",value:function(){var e,t,i,n,r,o;return this.ensureCacheValid(),{continueEnabled:null!==(e=null===(n=this.cache)||void 0===n?void 0:n.continueEnabled)&&void 0!==e&&e,previousEnabled:null!==(t=null===(r=this.cache)||void 0===r?void 0:r.previousEnabled)&&void 0!==t&&t,availableChoices:Array.from(null!==(i=null===(o=this.cache)||void 0===o?void 0:o.availableChoices)&&void 0!==i?i:[])}}},{key:"invalidateCache",value:function(){this.isDirty=!0}},{key:"updateCache",value:function(){this.isDirty=!0,this.ensureCacheValid()}},{key:"ensureCacheValid",value:function(){var e=this.calculateTreeStateHash();!this.isDirty&&this.cache&&this.cache.treeStateHash===e||(this.recalculateCache(e),this.isDirty=!1)}},{key:"recalculateCache",value:function(e){var t=this.activityTree.currentActivity;this.cache={continueEnabled:!1,previousEnabled:!1,availableChoices:new Set,choiceEnabledMap:new Map,treeStateHash:e},t?(this.cache.continueEnabled=this.predictContinueInternal(t),this.cache.previousEnabled=this.predictPreviousInternal(t),this.calculateAvailableChoices()):this.calculateAvailableChoicesFromRoot()}},{key:"predictContinueInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&this.hasAvailableNextActivity(e)}},{key:"hasAvailableNextActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(i.length-1>n)for(var r=n+1;i.length>r;r++){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableForward(o))return!0}return!(!t.parent||!t.sequencingControls.flow)&&this.hasAvailableNextActivity(t)}},{key:"predictPreviousInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&!e.parent.sequencingControls.forwardOnly&&this.hasAvailablePreviousActivity(e)}},{key:"hasAvailablePreviousActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(n>0)for(var r=n-1;r>=0;r--){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableBackward(o))return!0}return!(!t.parent||!t.sequencingControls.flow||t.sequencingControls.forwardOnly)&&this.hasAvailablePreviousActivity(t)}},{key:"calculateAvailableChoicesFromRoot",value:function(){}},{key:"calculateAvailableChoices",value:function(){this.cache&&this.activityTree.root&&this.recursivelyCheckChoiceAvailability(this.activityTree.root)}},{key:"recursivelyCheckChoiceAvailability",value:function(e){if(this.cache){var t=this.sequencingProcess.validateNavigationRequest(Ct.CHOICE,e.id,this.activityTree.currentActivity).valid;if(this.cache.choiceEnabledMap.set(e.id,t),t&&this.cache.availableChoices.add(e.id),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.recursivelyCheckChoiceAvailability(o.value)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}},{key:"isActivityPotentiallyDeliverableForward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return!!e.isVisible&&this.sequencingProcess.canActivityBeDelivered(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableForward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityPotentiallyDeliverableBackward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return e.isVisible;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableBackward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"calculateTreeStateHash",value:function(){var e,t,i=this.activityTree.currentActivity,n=this.activityTree.suspendedActivity;return[null!==(e=null==i?void 0:i.id)&&void 0!==e?e:"none",null!==(t=null==n?void 0:n.id)&&void 0!==t?t:"none",this.getActivityTreeStateSignature()].join("|")}},{key:"getActivityTreeStateSignature",value:function(){if(!this.activityTree.root)return"empty";var e=[];return this.collectActivitySignatures(this.activityTree.root,e),e.join(":")}},{key:"collectActivitySignatures",value:function(e,t){if(t.push(e.id+(e.isActive?"A":"-")+(e.isSuspended?"S":"-")+e.completionStatus+e.successStatus+e.attemptCount),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActivitySignatures(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Rr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Mr=Object.defineProperty,Tr=function(e,t,i){return function(e,t,i){return t in e?Mr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},xr=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.NOT_VALID="_none_",e}(xr||{}),Ir=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;Rr(this,e),Tr(this,"valid"),Tr(this,"terminationRequest"),Tr(this,"sequencingRequest"),Tr(this,"targetActivityId"),Tr(this,"exception"),this.valid=t,this.terminationRequest=i,this.sequencingRequest=n,this.targetActivityId=r,this.exception=o},Pr=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Rr(this,e),Tr(this,"activityTree"),Tr(this,"sequencingProcess"),Tr(this,"adlNav"),Tr(this,"eventCallback"),Tr(this,"navigationLookAhead"),Tr(this,"getEffectiveHideLmsUiCallback",null),this.activityTree=t,this.sequencingProcess=i,this.adlNav=n,this.eventCallback=r,this.navigationLookAhead=new jr(t,i)}return t=e,i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"getNavigationLookAhead",value:function(){return this.navigationLookAhead}},{key:"validateRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.fireEvent("onNavigationRequestProcessing",{request:request,targetActivityId:e});var t=this.activityTree.currentActivity;switch(request){case"start":return this.validateStartRequest(t);case"resumeAll":return this.validateResumeRequest(t);case"continue":return this.validateContinueRequest(t);case"previous":return this.validatePreviousRequest(t);case"choice":return this.validateChoiceRequest(t,e);case"jump":return this.validateJumpRequest(e);case"exit":return this.validateExitRequest(t);case"exitAll":return this.validateExitAllRequest(t);case"abandon":return this.validateAbandonRequest(t);case"abandonAll":return this.validateAbandonAllRequest(t);case"suspendAll":return this.validateSuspendAllRequest(t);default:return new Ir(!1,null,null,null,"NB.2.1-18")}}},{key:"validateStartRequest",value:function(e){return null!==e?new Ir(!1,null,null,null,"NB.2.1-1"):new Ir(!0,null,Ct.START,null)}},{key:"validateResumeRequest",value:function(e){return null!==e?new Ir(!1,null,null,null,"NB.2.1-2"):null===this.activityTree.suspendedActivity?new Ir(!1,null,null,null,"NB.2.1-3"):new Ir(!0,null,Ct.RESUME_ALL,null)}},{key:"validateContinueRequest",value:function(e){return e?e.parent&&e.parent.sequencingControls.flow?new Ir(!0,e.isActive?Ct.EXIT:null,Ct.CONTINUE,null):new Ir(!1,null,null,null,"NB.2.1-5"):new Ir(!1,null,null,null,"NB.2.1-4")}},{key:"validatePreviousRequest",value:function(e){if(!e)return new Ir(!1,null,null,null,"NB.2.1-6");if(!e.parent||!e.parent.sequencingControls.flow)return new Ir(!1,null,null,null,"NB.2.1-7");var t=this.validateForwardOnlyConstraints(e);return t.valid?new Ir(!0,e.isActive?Ct.EXIT:null,Ct.PREVIOUS,null):new Ir(!1,null,null,null,t.exception)}},{key:"validateChoiceRequest",value:function(e,t){if(!t)return new Ir(!1,null,null,null,"NB.2.1-9");var i=this.activityTree.getActivity(t);if(!i)return new Ir(!1,null,null,null,"NB.2.1-10");var n=this.validateChoicePath(e,i);return n.valid?new Ir(!0,(null==e?void 0:e.isActive)?Ct.EXIT:null,Ct.CHOICE,t):new Ir(!1,null,null,null,n.exception)}},{key:"validateJumpRequest",value:function(e){return e?new Ir(!0,null,Ct.JUMP,e):new Ir(!1,null,null,null,"NB.2.1-12")}},{key:"validateExitRequest",value:function(e){return e?new Ir(!0,e===this.activityTree.root?Ct.EXIT_ALL:Ct.EXIT,null,null):new Ir(!1,null,null,null,"NB.2.1-13")}},{key:"validateExitAllRequest",value:function(e){return e?new Ir(!0,Ct.EXIT_ALL,null,null):new Ir(!1,null,null,null,"NB.2.1-14")}},{key:"validateAbandonRequest",value:function(e){return e?new Ir(!0,Ct.ABANDON,null,null):new Ir(!1,null,null,null,"NB.2.1-15")}},{key:"validateAbandonAllRequest",value:function(e){return e?new Ir(!0,Ct.ABANDON_ALL,null,null):new Ir(!1,null,null,null,"NB.2.1-16")}},{key:"validateSuspendAllRequest",value:function(e){return e?new Ir(!0,Ct.SUSPEND_ALL,null,null):new Ir(!1,null,null,null,"NB.2.1-17")}},{key:"validateChoicePath",value:function(e,t){if(t.isHiddenFromChoice)return{valid:!1,exception:"NB.2.1-11"};if(!t.isAvailable)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityDisabled(t))return{valid:!1,exception:"NB.2.1-11"};if(e){var i=this.findCommonAncestor(e,t);if(!i)return{valid:!1,exception:"NB.2.1-11"};for(var n=e;n&&n!==i;){if(!0===n.isActive&&n.sequencingControls&&!1===n.sequencingControls.choiceExit&&t!==n&&!this.activityContains(n,t))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}var r=this.validateConstrainChoice(e,t,i);if(!r.valid)return r;var o=this.validateChoiceSet(e,t,i);if(!o.valid)return o}for(var a=t;a;){if(a.parent&&!a.parent.sequencingControls.choice)return{valid:!1,exception:"NB.2.1-11"};a=a.parent}return{valid:!0,exception:null}}},{key:"validateForwardOnlyConstraints",value:function(e){var t,i;if(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};for(var n=null===(i=e.parent)||void 0===i?void 0:i.parent;n;){if(n.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};n=n.parent}return{valid:!0,exception:null}}},{key:"validateConstrainChoice",value:function(e,t,i){for(var n=i;n;){var r,o;if((null===(r=n.sequencingControls)||void 0===r?void 0:r.constrainChoice)||(null===(o=n.sequencingControls)||void 0===o?void 0:o.preventActivation)){var a,s,l=this.findChildContaining(n,e);if(!l)return{valid:!1,exception:"NB.2.1-11"};if(t===n)return{valid:!1,exception:"NB.2.1-11"};var c=this.findChildContaining(n,t);if(!c)return{valid:!1,exception:"NB.2.1-11"};if((null===(a=n.sequencingControls)||void 0===a?void 0:a.constrainChoice)&&c!==l)return{valid:!1,exception:"NB.2.1-11"};if((null===(s=n.sequencingControls)||void 0===s?void 0:s.preventActivation)&&c!==l&&this.requiresNewActivation(c,t))return{valid:!1,exception:"NB.2.1-11"}}n=n.parent}return this.validateAncestors(i,e,t)}},{key:"validateChoiceSet",value:function(e,t,i){if(!this.activityContains(i,t)&&t!==i)return{valid:!1,exception:"NB.2.1-11"};for(var n=t;n&&n!==i;){if(!n.isAvailable||n.isHiddenFromChoice||this.isActivityDisabled(n))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}return{valid:!0,exception:null}}},{key:"isActivityDisabled",value:function(e){if(!e.isAvailable)return!0;if(e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return!!t&&(t===ut.DISABLED||t===ut.HIDE_FROM_CHOICE||t===ut.STOP_FORWARD_TRAVERSAL)}},{key:"findChildContaining",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s===t)return s;if(this.activityContains(s,t))return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"activityContains",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"validateAncestors",value:function(e,t,i){var n=e.children;if(!n||0===n.length)return{valid:!0,exception:null};var r=this.findChildContaining(e,t),o=this.findChildContaining(e,i);if(!r||!o)return{valid:!1,exception:"NB.2.1-11"};var a=n.indexOf(r),s=n.indexOf(o);if(e.sequencingControls.forwardOnly&&a>s)return{valid:!1,exception:"NB.2.1-8"};var l=n.findIndex(function(e){return null==e?void 0:e.sequencingControls.stopForwardTraversal});if(r.sequencingControls.stopForwardTraversal&&s>a)return{valid:!1,exception:"NB.2.1-11"};if(-1!==l&&s>l)return{valid:!1,exception:"NB.2.1-11"};if(s>a&&e.sequencingControls.forwardOnly)for(var c=a+1;s>c;c++){var u=n[c];if(u){if(u.sequencingControls.stopForwardTraversal)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityMandatory(u)&&!this.isActivityCompleted(u))return{valid:!1,exception:"NB.2.1-11"}}}return{valid:!0,exception:null}}},{key:"requiresNewActivation",value:function(e,t){return!this.branchHasActiveAttempt(e)&&!t.activityAttemptActive&&!t.isActive}},{key:"branchHasActiveAttempt",value:function(e){if(e.activityAttemptActive||e.isActive)return!0;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.branchHasActiveAttempt(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityMandatory",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!1;var t=this.evaluatePreConditionRulesForChoice(e);return t!==ut.SKIP&&t!==ut.DISABLED&&t!==ut.HIDE_FROM_CHOICE&&t!==ut.STOP_FORWARD_TRAVERSAL&&!this.isActivityDisabled(e)&&!1!==e.mandatory}},{key:"isActivityCompleted",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return t===ut.SKIP||t===ut.DISABLED||t===ut.HIDE_FROM_CHOICE||t===ut.STOP_FORWARD_TRAVERSAL||!!this.isActivityDisabled(e)||"completed"===e.completionStatus||"passed"===e.successStatus||"passed"===e.successStatus}},{key:"evaluatePreConditionRulesForChoice",value:function(e){return e.sequencingRules&&e.sequencingRules.evaluatePreConditionRules(e)||null}},{key:"updateNavigationValidity",value:function(){if(this.adlNav&&this.activityTree.currentActivity){this.navigationLookAhead.invalidateCache();var e=this.navigationLookAhead.predictContinueEnabled();try{this.adlNav.request_valid.continue=e?"true":"false"}catch(e){}var t=this.navigationLookAhead.predictPreviousEnabled();try{this.adlNav.request_valid.previous=t?"true":"false"}catch(e){}var i=this.activityTree.getAllActivities(),n={},r={},o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=this.validateRequest("choice",u.id);n[u.id]=d.valid?"true":"false";var v=this.validateRequest("jump",u.id);r[u.id]=v.valid?"true":"false"}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}try{this.adlNav.request_valid.choice=n}catch(e){}try{this.adlNav.request_valid.jump=r}catch(e){}var f=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[];this.fireEvent("onNavigationValidityUpdate",{continue:e,previous:t,choice:n,jump:r,hideLmsUi:f})}}},{key:"getAllPredictions",value:function(){return this.navigationLookAhead.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationLookAhead.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationLookAhead.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationLookAhead.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationLookAhead.getAvailableChoices()}},{key:"invalidateCache",value:function(){this.navigationLookAhead.invalidateCache()}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Nr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function qr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Dr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Lr(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){qr(e,t,i[t])})}return e}function zr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Nr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Fr=Object.defineProperty,Br=function(e,t,i){return function(e,t,i){return t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Vr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Br(this,"globalObjectiveMap",new Map),Br(this,"eventCallback",null),this.eventCallback=t||null}return t=e,(i=[{key:"initialize",value:function(e){try{this.globalObjectiveMap.clear(),e&&this.collectObjectives(e),this.fireEvent("onGlobalObjectiveMapInitialized",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}catch(e){this.fireEvent("onGlobalObjectiveMapError",{error:Dr(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"collectObjectives",value:function(e){var objectives=e.getAllObjectives();if(0===objectives.length){var t="".concat(e.id,"_default_objective");this.globalObjectiveMap.has(t)||this.globalObjectiveMap.set(t,{id:t,satisfiedStatus:e.objectiveSatisfiedStatus,satisfiedStatusKnown:e.objectiveSatisfiedStatusKnown,normalizedMeasure:e.objectiveNormalizedMeasure,normalizedMeasureKnown:e.objectiveMeasureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:e.progressMeasure,progressMeasureKnown:e.progressMeasureStatus,completionStatus:e.completionStatus,completionStatusKnown:e.completionStatus!==_e,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,satisfiedByMeasure:null!==e.scaledPassingScore,minNormalizedMeasure:e.scaledPassingScore,updateAttemptData:!0})}var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[{targetObjectiveID:s.id,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,updateAttemptData:s.isPrimary}],c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h,m,p,y,g,b,_,S,w,C,O,A,E,k,j,R=v.value,M=R.targetObjectiveID||s.id;this.globalObjectiveMap.has(M)||this.globalObjectiveMap.set(M,{id:M,satisfiedStatus:s.satisfiedStatus,satisfiedStatusKnown:s.satisfiedStatusKnown||s.progressStatus,normalizedMeasure:s.normalizedMeasure,normalizedMeasureKnown:s.measureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:s.progressMeasure,progressMeasureKnown:s.progressMeasureStatus,completionStatus:s.completionStatus,completionStatusKnown:s.completionStatus!==_e,readSatisfiedStatus:null!==(h=R.readSatisfiedStatus)&&void 0!==h&&h,writeSatisfiedStatus:null!==(m=R.writeSatisfiedStatus)&&void 0!==m&&m,readNormalizedMeasure:null!==(p=R.readNormalizedMeasure)&&void 0!==p&&p,writeNormalizedMeasure:null!==(y=R.writeNormalizedMeasure)&&void 0!==y&&y,readProgressMeasure:null!==(g=R.readProgressMeasure)&&void 0!==g&&g,writeProgressMeasure:null!==(b=R.writeProgressMeasure)&&void 0!==b&&b,readCompletionStatus:null!==(_=R.readCompletionStatus)&&void 0!==_&&_,writeCompletionStatus:null!==(S=R.writeCompletionStatus)&&void 0!==S&&S,readRawScore:null!==(w=R.readRawScore)&&void 0!==w&&w,writeRawScore:null!==(C=R.writeRawScore)&&void 0!==C&&C,readMinScore:null!==(O=R.readMinScore)&&void 0!==O&&O,writeMinScore:null!==(A=R.writeMinScore)&&void 0!==A&&A,readMaxScore:null!==(E=R.readMaxScore)&&void 0!==E&&E,writeMaxScore:null!==(k=R.writeMaxScore)&&void 0!==k&&k,satisfiedByMeasure:s.satisfiedByMeasure,minNormalizedMeasure:s.minNormalizedMeasure,updateAttemptData:null!==(j=R.updateAttemptData)&&void 0!==j?j:s.isPrimary})}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var T=!0,x=!1,I=void 0;try{for(var P,N=e.children[Symbol.iterator]();!(T=(P=N.next()).done);T=!0)this.collectObjectives(P.value)}catch(e){x=!0,I=e}finally{try{T||null==N.return||N.return()}finally{if(x)throw I}}}},{key:"getMap",value:function(){return this.globalObjectiveMap}},{key:"getSnapshot",value:function(){return this.serialize()}},{key:"restoreSnapshot",value:function(e){this.restore(e)}},{key:"updateObjective",value:function(e,t){try{this.globalObjectiveMap.set(e,(i=Lr({},this.globalObjectiveMap.get(e),t),n=null!=(n={lastUpdated:(new Date).toISOString()})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(n)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(n,e))}),i)),this.fireEvent("onGlobalObjectiveUpdated",{objectiveId:e,data:t,timestamp:(new Date).toISOString()})}catch(t){this.fireEvent("onGlobalObjectiveUpdateError",{objectiveId:e,error:Dr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}var i,n}},{key:"synchronize",value:function(e,t){e&&t.processGlobalObjectiveMapping(e,this.globalObjectiveMap)}},{key:"getObjective",value:function(e){return this.globalObjectiveMap.get(e)}},{key:"hasObjective",value:function(e){return this.globalObjectiveMap.has(e)}},{key:"getObjectiveIds",value:function(){return Array.from(this.globalObjectiveMap.keys())}},{key:"getObjectiveCount",value:function(){return this.globalObjectiveMap.size}},{key:"clear",value:function(){this.globalObjectiveMap.clear(),this.fireEvent("onGlobalObjectiveMapCleared",{timestamp:(new Date).toISOString()})}},{key:"serialize",value:function(){var e={};return this.globalObjectiveMap.forEach(function(t,id){e[id]=Lr({},t)}),e}},{key:"restore",value:function(e){if(this.globalObjectiveMap.clear(),e){var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=zr(r.value,2);this.globalObjectiveMap.set(a[0],Lr({},a[1]))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this.fireEvent("onGlobalObjectiveMapRestored",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire global objective event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Hr=Object.defineProperty,Ur=function(e,t,i){return function(e,t,i){return t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Gr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ur(this,"activityTree"),Ur(this,"globalObjectiveService"),Ur(this,"rollupProcess"),Ur(this,"adlNav"),Ur(this,"eventCallback"),Ur(this,"getEffectiveHideLmsUiCallback",null),Ur(this,"getEffectiveAuxiliaryResourcesCallback",null),Ur(this,"contentDeliveredGetter",null),Ur(this,"contentDeliveredSetter",null),this.activityTree=t,this.globalObjectiveService=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o}return t=e,(i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"setGetEffectiveAuxiliaryResourcesCallback",value:function(e){this.getEffectiveAuxiliaryResourcesCallback=e}},{key:"setContentDeliveredAccessors",value:function(e,t){this.contentDeliveredGetter=e,this.contentDeliveredSetter=t}},{key:"getState",value:function(){var e,t;return{version:"1.0",timestamp:(new Date).toISOString(),contentDelivered:!!this.contentDeliveredGetter&&this.contentDeliveredGetter(),currentActivity:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivity:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,activityStates:this.serializeActivities(),navigationState:this.getNavigationState(),globalObjectiveMap:this.globalObjectiveService.getSnapshot()}}},{key:"restoreState",value:function(e){try{if(!e||"1.0"!==e.version)return console.warn("Incompatible sequencing state version"),!1;if(this.contentDeliveredSetter&&this.contentDeliveredSetter(e.contentDelivered||!1),e.globalObjectiveMap&&this.globalObjectiveService.restoreSnapshot(e.globalObjectiveMap),e.activityStates&&this.deserializeActivities(e.activityStates),e.currentActivity){var t=this.activityTree.getActivity(e.currentActivity);t&&(this.activityTree.currentActivity=t,t.isActive=!0)}if(e.suspendedActivity){var i=this.activityTree.getActivity(e.suspendedActivity);i&&(this.activityTree.suspendedActivity=i,i.isSuspended=!0)}return e.navigationState&&this.restoreNavigationState(e.navigationState),this.activityTree.root&&this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess),console.debug("Sequencing state restored successfully"),!0}catch(e){return console.error("Failed to restore sequencing state: ".concat(e)),!1}}},{key:"serializeActivities",value:function(){var e={},t=function(i){e[i.id]={id:i.id,title:i.title,isActive:i.isActive,isSuspended:i.isSuspended,isCompleted:i.isCompleted,completionStatus:i.completionStatus,successStatus:i.successStatus,attemptCount:i.attemptCount,attemptCompletionAmount:i.attemptCompletionAmount,attemptAbsoluteDuration:i.attemptAbsoluteDuration,attemptExperiencedDuration:i.attemptExperiencedDuration,activityAbsoluteDuration:i.activityAbsoluteDuration,activityExperiencedDuration:i.activityExperiencedDuration,objectiveSatisfiedStatus:i.objectiveSatisfiedStatus,objectiveMeasureStatus:i.objectiveMeasureStatus,objectiveNormalizedMeasure:i.objectiveNormalizedMeasure,progressMeasure:i.progressMeasure,progressMeasureStatus:i.progressMeasureStatus,isAvailable:i.isAvailable,isHiddenFromChoice:i.isHiddenFromChoice,location:i.location,attemptAbsoluteStartTime:i.attemptAbsoluteStartTime,objectives:i.getObjectiveStateSnapshot(),auxiliaryResources:i.auxiliaryResources,selectionRandomizationState:{selectionCountStatus:i.sequencingControls.selectionCountStatus,reorderChildren:i.sequencingControls.reorderChildren,childOrder:i.children.map(function(e){return e.id}),selectedChildIds:i.children.filter(function(e){return e.isAvailable}).map(function(e){return e.id}),hiddenFromChoiceChildIds:i.children.filter(function(e){return e.isHiddenFromChoice}).map(function(e){return e.id})}};var n=!0,r=!1,o=void 0;try{for(var a,s=i.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)t(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}};return this.activityTree.root&&t(this.activityTree.root),e}},{key:"deserializeActivities",value:function(e){var t=function(i){var n,r=e[i.id];r&&(i.isActive=r.isActive||!1,i.isSuspended=r.isSuspended||!1,i.isCompleted=r.isCompleted||!1,i.completionStatus=r.completionStatus||"unknown",i.successStatus=r.successStatus||"unknown",i.attemptCount=r.attemptCount||0,i.attemptCompletionAmount=r.attemptCompletionAmount||0,i.attemptAbsoluteDuration=r.attemptAbsoluteDuration||"PT0H0M0S",i.attemptExperiencedDuration=r.attemptExperiencedDuration||"PT0H0M0S",i.activityAbsoluteDuration=r.activityAbsoluteDuration||"PT0H0M0S",i.activityExperiencedDuration=r.activityExperiencedDuration||"PT0H0M0S",i.objectiveSatisfiedStatus=r.objectiveSatisfiedStatus||!1,i.objectiveMeasureStatus=r.objectiveMeasureStatus||!1,i.objectiveNormalizedMeasure=r.objectiveNormalizedMeasure||0,i.progressMeasure=null!==(n=r.progressMeasure)&&void 0!==n?n:0,i.progressMeasureStatus=r.progressMeasureStatus||!1,i.isAvailable=!1!==r.isAvailable,i.isHiddenFromChoice=!0===r.isHiddenFromChoice,i.location=r.location||"",i.attemptAbsoluteStartTime=r.attemptAbsoluteStartTime||"",Array.isArray(r.auxiliaryResources)&&(i.auxiliaryResources=r.auxiliaryResources),r.objectives&&i.applyObjectiveStateSnapshot(r.objectives));var o=!0,a=!1,s=void 0;try{for(var l,c=i.children[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)t(l.value)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}if(null==r?void 0:r.selectionRandomizationState){var u=r.selectionRandomizationState,d=i.sequencingControls;void 0!==u.selectionCountStatus&&(d.selectionCountStatus=u.selectionCountStatus),void 0!==u.reorderChildren&&(d.reorderChildren=u.reorderChildren),u.childOrder&&u.childOrder.length>0&&i.setChildOrder(u.childOrder);var v=Array.isArray(u.selectedChildIds)?new Set(u.selectedChildIds):null,f=Array.isArray(u.hiddenFromChoiceChildIds)?new Set(u.hiddenFromChoiceChildIds):null;if(v||f){var h=!0,m=!1,p=void 0;try{for(var y,g=i.children[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;if(v){var _=v.has(b.id);b.isAvailable=_,f||(b.isHiddenFromChoice=!_)}f&&(b.isHiddenFromChoice=f.has(b.id))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}i.setProcessedChildren(i.children.filter(function(e){return e.isAvailable}))}else i.resetProcessedChildren()};this.activityTree.root&&t(this.activityTree.root)}},{key:"getNavigationState",value:function(){var e,t,i,n,r,o,a;if(!this.adlNav)return null;var s=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[],l=this.getEffectiveAuxiliaryResourcesCallback?this.getEffectiveAuxiliaryResourcesCallback(this.activityTree.currentActivity):[];return{request:this.adlNav.request||"_none_",requestValid:{continue:(null===(e=this.adlNav.request_valid)||void 0===e?void 0:e.continue)||"false",previous:(null===(t=this.adlNav.request_valid)||void 0===t?void 0:t.previous)||"false",choice:"unknown",jump:"unknown",exit:(null===(i=this.adlNav.request_valid)||void 0===i?void 0:i.exit)||"false",exitAll:(null===(n=this.adlNav.request_valid)||void 0===n?void 0:n.exitAll)||"false",abandon:(null===(r=this.adlNav.request_valid)||void 0===r?void 0:r.abandon)||"false",abandonAll:(null===(o=this.adlNav.request_valid)||void 0===o?void 0:o.abandonAll)||"false",suspendAll:(null===(a=this.adlNav.request_valid)||void 0===a?void 0:a.suspendAll)||"false"},hideLmsUi:s,auxiliaryResources:l}}},{key:"restoreNavigationState",value:function(e){if(this.adlNav&&e)try{if(e.requestValid){var t=e.requestValid;this.adlNav.request_valid.continue=t.continue||"false",this.adlNav.request_valid.previous=t.previous||"false",this.adlNav.request_valid.exit=t.exit||"false",this.adlNav.request_valid.exitAll=t.exitAll||"false",this.adlNav.request_valid.abandon=t.abandon||"false",this.adlNav.request_valid.abandonAll=t.abandonAll||"false",this.adlNav.request_valid.suspendAll=t.suspendAll||"false"}}catch(e){console.warn("Could not fully restore navigation state: ".concat(e))}}},{key:"getSuspensionState",value:function(){var e,t,i={activityTree:this.activityTree.root?this.activityTree.root.getSuspensionState():null,currentActivityId:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivityId:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,globalObjectives:this.globalObjectiveService.getSnapshot(),timestamp:(new Date).toISOString()};return this.fireEvent("onSuspensionStateCaptured",{hasActivityTree:!!i.activityTree,currentActivityId:i.currentActivityId,suspendedActivityId:i.suspendedActivityId,globalObjectiveCount:Object.keys(i.globalObjectives).length,timestamp:i.timestamp}),i}},{key:"restoreSuspensionState",value:function(e){var t,i;if(e)try{if(e.globalObjectives&&this.globalObjectiveService.restoreSnapshot(e.globalObjectives),e.activityTree&&this.activityTree.root&&this.activityTree.root.restoreSuspensionState(e.activityTree),e.currentActivityId){var n=this.activityTree.getActivity(e.currentActivityId);n&&(this.activityTree.currentActivity=n)}if(e.suspendedActivityId){var r=this.activityTree.getActivity(e.suspendedActivityId);r&&(this.activityTree.suspendedActivity=r)}this.fireEvent("onSuspensionStateRestored",{currentActivityId:e.currentActivityId,suspendedActivityId:e.suspendedActivityId,globalObjectiveCount:e.globalObjectives?Object.keys(e.globalObjectives).length:0,originalTimestamp:e.timestamp,restoreTimestamp:(new Date).toISOString()})}catch(e){throw this.fireEvent("onSuspensionStateRestoreError",{error:(t=e,i=Error,(null!=i&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?i[Symbol.hasInstance](t):t instanceof i)?e.message:e+""),timestamp:(new Date).toISOString()}),e}else this.fireEvent("onSuspensionStateRestoreError",{error:"No suspension state provided",timestamp:(new Date).toISOString()})}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire state manager event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Yr(e){return function(e){if(Array.isArray(e))return Kr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Kr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Kr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Wr=Object.defineProperty,Jr=function(e,t,i){return function(e,t,i){return t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xr=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Jr(this,"activityTree"),Jr(this,"eventCallback"),Jr(this,"now"),Jr(this,"contentDeliveredGetter",null),this.activityTree=t,this.eventCallback=i,this.now=(null==n?void 0:n.now)||function(){return new Date}}return t=e,(i=[{key:"setContentDeliveredGetter",value:function(e){this.contentDeliveredGetter=e}},{key:"validateTreeConsistency",value:function(e){if(!this.activityTree.root)return{consistent:!1,exception:"DB.1.1-4"};if(!this.isActivityPartOfTree(e,this.activityTree.root))return{consistent:!1,exception:"DB.1.1-5"};var t=this.getActiveActivities();if(t.length>1)return this.fireEvent("onStateInconsistency",{activeActivities:t.map(function(e){return e.id}),targetActivity:e.id}),{consistent:!1,exception:"DB.1.1-6"};for(var i=e;null==i?void 0:i.parent;){if(!i.parent.children.includes(i))return{consistent:!1,exception:"DB.1.1-7"};i=i.parent}return{consistent:!0,exception:null}}},{key:"validateResources",value:function(e){var t=this.getRequiredResources(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isResourceAvailable(o.value))return{available:!1,exception:"DB.1.1-8"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return this.checkSystemLimits().adequate?{available:!0,exception:null}:{available:!1,exception:"DB.1.1-9"}}},{key:"validateConcurrentDelivery",value:function(e){return this.contentDeliveredGetter&&this.contentDeliveredGetter()&&this.activityTree.currentActivity&&this.activityTree.currentActivity!==e?{allowed:!1,exception:"DB.1.1-10"}:this.hasPendingDeliveryRequests()?{allowed:!1,exception:"DB.1.1-11"}:this.isDeliveryLocked()?{allowed:!1,exception:"DB.1.1-12"}:{allowed:!0,exception:null}}},{key:"validateDependencies",value:function(e){var t=this.getPrerequisites(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isPrerequisiteSatisfied(o.value,e))return{satisfied:!1,exception:"DB.1.1-13"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var s=this.getObjectiveDependencies(e),l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)if(!this.isObjectiveDependencySatisfied(d.value))return{satisfied:!1,exception:"DB.1.1-14"}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}return this.getSequencingRuleDependencies(e).satisfied?{satisfied:!0,exception:null}:{satisfied:!1,exception:"DB.1.1-15"}}},{key:"checkActivity",value:function(e){return!!e.isAvailable&&!!this.checkLimitConditions(e)}},{key:"checkLimitConditions",value:function(e){var result=!0,t="";if(null!==e.attemptLimit&&e.attemptLimit>0&&(e.attemptLimit>e.attemptCount||(result=!1,t="Attempt limit exceeded")),result&&e.attemptAbsoluteDurationLimit){var i=a(e.attemptAbsoluteDurationLimit,xe);i>0&&(i>a(e.attemptAbsoluteDuration||"PT0H0M0S",xe)||(result=!1,t="Attempt duration limit exceeded"))}if(result&&e.activityAbsoluteDurationLimit){var n=a(e.activityAbsoluteDurationLimit,xe);n>0&&(n>a(e.activityAbsoluteDuration||"PT0H0M0S",xe)||(result=!1,t="Activity duration limit exceeded"))}if(result&&e.beginTimeLimit){var r=this.now();new Date(e.beginTimeLimit)>r&&(result=!1,t="Not yet time to begin")}return result&&e.endTimeLimit&&this.now()>new Date(e.endTimeLimit)&&(result=!1,t="Time limit expired"),this.fireEvent("onLimitConditionCheck",{activity:e,result:result,failureReason:t,checks:{attemptLimit:e.attemptLimit,attemptCount:e.attemptCount,attemptDurationLimit:e.attemptAbsoluteDurationLimit,activityDurationLimit:e.activityAbsoluteDurationLimit,beginTimeLimit:e.beginTimeLimit,endTimeLimit:e.endTimeLimit}}),result}},{key:"isActivityPartOfTree",value:function(e,t){if(e===t)return!0;var i=!0,n=!1,r=void 0;try{for(var o,a=t.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.isActivityPartOfTree(e,o.value))return!0}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!1}},{key:"getActiveActivities",value:function(){var e=[];return this.activityTree.root&&this.collectActiveActivities(this.activityTree.root,e),e}},{key:"collectActiveActivities",value:function(e,t){e.isActive&&t.push(e);var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActiveActivities(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"getRequiredResources",value:function(e){var t=[],i=(e.title+" "+e.location).toLowerCase();return(i.includes("video")||i.includes("multimedia"))&&t.push("video-codec"),(i.includes("audio")||i.includes("sound"))&&t.push("audio-codec"),(i.includes("flash")||i.includes(".swf"))&&t.push("flash-plugin"),(i.includes("java")||i.includes("applet"))&&t.push("java-runtime"),e.children&&e.children.length>0&&t.push("high-bandwidth"),e.attemptAbsoluteDurationLimit&&this.parseDurationToMinutes(e.attemptAbsoluteDurationLimit)>60&&t.push("extended-storage"),e.attemptLimit&&e.attemptLimit>1&&t.push("persistent-storage"),t}},{key:"isResourceAvailable",value:function(e){try{switch(e){case"video-codec":return!!document.createElement("video").canPlayType;case"audio-codec":return!!document.createElement("audio").canPlayType;case"flash-plugin":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Shockwave Flash"===e.name});case"java-runtime":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Java"===e.name});case"high-bandwidth":if("connection"in navigator){var t=navigator.connection;return"4g"===t.effectiveType||t.downlink>5}return!0;case"extended-storage":default:return!0;case"persistent-storage":return"localStorage"in window&&"sessionStorage"in window}}catch(e){return!1}}},{key:"checkSystemLimits",value:function(){try{var e=!0;if("memory"in performance){var t=performance.memory;t.usedJSHeapSize/t.jsHeapSizeLimit>.8&&(e=!1)}if("deviceMemory"in navigator&&2>navigator.deviceMemory&&(e=!1),"hardwareConcurrency"in navigator&&2>navigator.hardwareConcurrency&&(e=!1),"connection"in navigator){var i=navigator.connection;(i.saveData||"slow-2g"===i.effectiveType)&&(e=!1)}return{adequate:e}}catch(e){return{adequate:!0}}}},{key:"hasPendingDeliveryRequests",value:function(){return this.activityTree&&this.activityTree.pendingRequests?this.activityTree.pendingRequests.length>0:!("undefined"==typeof window||!window.pendingScormRequests)&&window.pendingScormRequests>0}},{key:"isDeliveryLocked",value:function(){return!((!this.activityTree||!this.activityTree.navigationLocked)&&(!this.activityTree||!this.activityTree.terminationInProgress)&&this.checkSystemLimits().adequate&&("undefined"==typeof window||!window.scormMaintenanceMode))}},{key:"getPrerequisites",value:function(e){var t,i=[];if(e.sequencingRules&&e.sequencingRules.preConditionRules){var n=!0,r=!1,o=void 0;try{for(var a,s=e.sequencingRules.preConditionRules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l.conditions&&l.conditions.length>0){var c=!0,u=!1,d=void 0;try{for(var v,f=l.conditions[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;h.referencedObjectiveID&&h.referencedObjectiveID!==e.id&&i.push(h.referencedObjectiveID)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}if(e.parent&&e.sequencingControls&&!e.sequencingControls.choiceExit){var m=e.parent.children;if(m)for(var p=m.indexOf(e),y=0;p>y;y++){var g=m[y];g&&i.push(g.id)}}return e.prerequisiteActivities&&(t=i).push.apply(t,Yr(e.prerequisiteActivities)),Array.from(new Set(i))}},{key:"isPrerequisiteSatisfied",value:function(e,t){var i=this.activityTree.getActivity(e);return!!i&&"completed"===i.completionStatus}},{key:"getObjectiveDependencies",value:function(e){var t=[],objectives=e.objectives;if(objectives&&objectives.length>0){var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.globalObjectiveID&&t.push(s.globalObjectiveID),!s.satisfiedByMeasure&&s.readNormalizedMeasure&&t.push(s.id+"_measure")}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules){var l=Yr(e.sequencingRules.preConditionRules||[]).concat(Yr(e.sequencingRules.exitConditionRules||[]),Yr(e.sequencingRules.postConditionRules||[])),c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(h.conditions&&h.conditions.length>0){var m=!0,p=!1,y=void 0;try{for(var g,b=h.conditions[Symbol.iterator]();!(m=(g=b.next()).done);m=!0){var _=g.value;_.objectiveReference&&_.objectiveReference!==e.id&&t.push(_.objectiveReference)}}catch(e){p=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(p)throw y}}}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}return Array.from(new Set(t))}},{key:"isObjectiveDependencySatisfied",value:function(e){if(this.activityTree&&this.activityTree.globalObjectives){var t=this.activityTree.globalObjectives[e];if(t)return!0===t.satisfied&&!0===t.statusKnown}if(e.endsWith("_measure")){var i=e.replace("_measure","");if(this.activityTree&&this.activityTree.globalObjectives){var n=this.activityTree.globalObjectives[i];if(n)return!0===n.measureKnown&&n.normalizedMeasure>=0}}var r=this.activityTree.getActivity(e);return!!r&&r.objectiveSatisfiedStatus&&r.objectiveMeasureStatus}},{key:"getSequencingRuleDependencies",value:function(e){var t=!0;try{if(e.sequencingRules&&e.sequencingRules.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=e.sequencingRules.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.conditions&&s.conditions.length>0){var l=!0,c=!1,u=void 0;try{for(var d,v=s.conditions[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value;switch(f.conditionType||f.condition){case"activityProgressKnown":e.progressMeasureStatus||(t=!1);break;case"objectiveStatusKnown":case"objectiveSatisfied":this.isObjectiveDependencySatisfied(f.referencedObjectiveID||e.id)||(t=!1);break;case"attemptLimitExceeded":null===e.attemptLimit&&(t=!1);break;case"timeLimitExceeded":e.attemptAbsoluteDurationLimit||e.activityAbsoluteDurationLimit||(t=!1);break;case"always":case"never":break;default:t=!1}}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules&&e.sequencingRules.exitConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=e.sequencingRules.exitConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;if(b.conditions&&b.conditions.length>0){var _=!0,S=!1,w=void 0;try{for(var C,O=b.conditions[Symbol.iterator]();!(_=(C=O.next()).done);_=!0){var A=C.value;["objectiveStatusKnown","objectiveSatisfied"].includes(A.conditionType||A.condition)&&(this.isObjectiveDependencySatisfied(A.referencedObjectiveID||e.id)||(t=!1))}}catch(e){S=!0,w=e}finally{try{_||null==O.return||O.return()}finally{if(S)throw w}}}}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}if(e.rollupRules&&e.rollupRules.rules){var E=!0,k=!1,j=void 0;try{for(var R,M=e.rollupRules.rules[Symbol.iterator]();!(E=(R=M.next()).done);E=!0){var T=R.value;if(T.conditions&&T.conditions.length>0&&e.children&&e.children.length>0){var x=!0,I=!1,P=void 0;try{for(var N,q=e.children[Symbol.iterator]();!(x=(N=q.next()).done);x=!0)if(!N.value.isCompleted){t=!1;break}}catch(e){I=!0,P=e}finally{try{x||null==q.return||q.return()}finally{if(I)throw P}}}}}catch(e){k=!0,j=e}finally{try{E||null==M.return||M.return()}finally{if(k)throw j}}}}catch(e){t=!1}return{satisfied:t}}},{key:"parseDurationToMinutes",value:function(e){return a(e,xe)/60}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire delivery validator event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var $r=Object.defineProperty,Qr=function(e,t,i){return function(e,t,i){return t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Zr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qr(this,"activityTree"),Qr(this,"sequencingProcess"),Qr(this,"rollupProcess"),Qr(this,"adlNav"),Qr(this,"eventCallback",null),Qr(this,"terminationHandler"),Qr(this,"deliveryHandler"),Qr(this,"navigationValidityService"),Qr(this,"globalObjectiveService"),Qr(this,"stateManager"),Qr(this,"deliveryValidator"),Qr(this,"navigationLookAhead"),Qr(this,"enhancedDeliveryValidation"),Qr(this,"is4thEdition"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o,this.enhancedDeliveryValidation=!0===(null==a?void 0:a.enhancedDeliveryValidation),this.is4thEdition=(null==a?void 0:a.is4thEdition)||!1,this.globalObjectiveService=new Vr(o||void 0),this.globalObjectiveService.initialize(t.root);var s={};(null==a?void 0:a.now)&&(s.now=a.now),this.deliveryValidator=new Xr(t,o,s);var l={};(null==a?void 0:a.getCMIData)&&(l.getCMIData=a.getCMIData),void 0!==(null==a?void 0:a.is4thEdition)&&(l.is4thEdition=a.is4thEdition),this.terminationHandler=new mr(t,i,n,this.globalObjectiveService.getMap(),o,l);var c={};(null==a?void 0:a.now)&&(c.now=a.now),(null==a?void 0:a.defaultHideLmsUi)&&(c.defaultHideLmsUi=a.defaultHideLmsUi),(null==a?void 0:a.defaultAuxiliaryResources)&&(c.defaultAuxiliaryResources=a.defaultAuxiliaryResources),this.deliveryHandler=new Ar(t,n,this.globalObjectiveService.getMap(),r,o,c),this.navigationValidityService=new Pr(t,i,r,o),this.stateManager=new Gr(t,this.globalObjectiveService,n,r,o),this.navigationLookAhead=this.navigationValidityService.getNavigationLookAhead(),this.setupCallbacks()}return t=e,i=[{key:"setupCallbacks",value:function(){var e=this;this.terminationHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setCheckActivityCallback(function(t){return e.deliveryValidator.checkActivity(t)}),this.deliveryHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setUpdateNavigationValidityCallback(function(){e.navigationValidityService.updateNavigationValidity()}),this.deliveryHandler.setClearSuspendedActivityCallback(function(){e.terminationHandler.clearSuspendedActivity()}),this.deliveryValidator.setContentDeliveredGetter(function(){return e.deliveryHandler.hasContentBeenDelivered()}),this.navigationValidityService.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveAuxiliaryResourcesCallback(function(t){return e.deliveryHandler.getEffectiveAuxiliaryResources(t)}),this.stateManager.setContentDeliveredAccessors(function(){return e.deliveryHandler.hasContentBeenDelivered()},function(t){return e.deliveryHandler.setContentDelivered(t)})}},{key:"processNavigationRequest",value:function(e){var t=arguments.length>2?arguments[2]:void 0,i=this.navigationValidityService.validateRequest(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);if(!i.valid)return new Cr(!1,null,i.exception);if(i.terminationRequest){var n=!!i.sequencingRequest,r=this.terminationHandler.processTerminationRequest(i.terminationRequest,n,t);if(!r.valid)return new Cr(!1,null,r.exception||"TB.2.3-1");if(null!==r.sequencingRequest&&(n||r.sequencingRequest!==Ct.EXIT)&&(i.sequencingRequest=r.sequencingRequest),!i.sequencingRequest)return i.terminationRequest!==Ct.EXIT_ALL&&i.terminationRequest!==Ct.ABANDON_ALL||this.fireEvent("onSequencingSessionEnd",{reason:i.terminationRequest===Ct.EXIT_ALL?"exit_all":"abandon_all",navigationRequest:e}),new Cr(!0,null)}if(i.sequencingRequest){var o=this.sequencingProcess.sequencingRequestProcess(i.sequencingRequest,i.targetActivityId);if(o.endSequencingSession)return this.fireEvent("onSequencingSessionEnd",{reason:"end_of_content",exception:o.exception,navigationRequest:e}),new Cr(!1,null,o.exception||"SESSION_ENDED");if(o.exception)return new Cr(!1,null,o.exception);if(o.deliveryRequest===Ot.DELIVER&&o.targetActivity)return this.activityTree.root&&(this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)||this.fireEvent("onSequencingDebug",{message:"Rollup state inconsistency detected before delivery",activityId:this.activityTree.root.id})),this.rollupProcess.processGlobalObjectiveMapping(o.targetActivity,this.globalObjectiveService.getMap()),this.processDelivery(o.targetActivity)}return new Cr(!1,null,"OP.1-1")}},{key:"processDelivery",value:function(e){if(this.enhancedDeliveryValidation){var t=this.deliveryValidator.validateTreeConsistency(e);if(!t.consistent)return new Cr(!1,null,t.exception);var i=this.deliveryValidator.validateResources(e);if(!i.available)return new Cr(!1,null,i.exception);var n=this.deliveryValidator.validateConcurrentDelivery(e);if(!n.allowed)return new Cr(!1,null,n.exception);var r=this.deliveryValidator.validateDependencies(e);if(!r.satisfied)return new Cr(!1,null,r.exception)}var o=this.deliveryHandler.processDeliveryRequest(e);return o.valid&&(this.deliveryHandler.contentDeliveryEnvironmentProcess(o.targetActivity),this.navigationLookAhead.invalidateCache(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)),o}},{key:"hasContentBeenDelivered",value:function(){return this.deliveryHandler.hasContentBeenDelivered()}},{key:"isDeliveryInProgress",value:function(){return this.deliveryHandler.isDeliveryInProgress()}},{key:"resetContentDelivered",value:function(){this.deliveryHandler.resetContentDelivered()}},{key:"setContentDelivered",value:function(e){this.deliveryHandler.setContentDelivered(e)}},{key:"updateNavigationValidity",value:function(){this.navigationValidityService.updateNavigationValidity()}},{key:"synchronizeGlobalObjectives",value:function(){this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess)}},{key:"getGlobalObjectiveMap",value:function(){return this.globalObjectiveService.getMap()}},{key:"getGlobalObjectiveMapSnapshot",value:function(){return this.globalObjectiveService.getSnapshot()}},{key:"restoreGlobalObjectiveMapSnapshot",value:function(e){this.globalObjectiveService.restoreSnapshot(e)}},{key:"updateGlobalObjective",value:function(e,t){this.globalObjectiveService.updateObjective(e,t)}},{key:"getSequencingState",value:function(){return this.stateManager.getState()}},{key:"restoreSequencingState",value:function(e){return this.stateManager.restoreState(e)}},{key:"getSuspensionState",value:function(){return this.stateManager.getSuspensionState()}},{key:"restoreSuspensionState",value:function(e){this.stateManager.restoreSuspensionState(e)}},{key:"getNavigationLookAhead",value:function(){return this.navigationValidityService.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationValidityService.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationValidityService.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationValidityService.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationValidityService.getAvailableChoices()}},{key:"invalidateNavigationCache",value:function(){this.navigationValidityService.invalidateCache()}},{key:"applyDeliveryControls",value:function(e){e.sequencingControls.completionSetByContent||e.completionStatus===_e&&(e.completionStatus=ge,e.wasAutoCompleted=!0),e.sequencingControls.objectiveSetByContent||e.successStatus===ye&&(e.successStatus=me,e.wasAutoSatisfied=!0)}},{key:"getEffectiveHideLmsUi",value:function(e){return this.deliveryHandler.getEffectiveHideLmsUi(e)}},{key:"getEffectiveAuxiliaryResources",value:function(e){return this.deliveryHandler.getEffectiveAuxiliaryResources(e)}},{key:"getContentActivityData",value:function(e){return this.deliveryHandler.getContentActivityData(e)}},{key:"terminationRequestProcess",value:function(request,e,t){return this.terminationHandler.processTerminationRequest(request,e,t)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this.deliveryHandler.contentDeliveryEnvironmentProcess(e)}},{key:"endAttemptProcess",value:function(e){this.terminationHandler.endAttempt(e)}},{key:"handleExitTermination",value:function(e,t){return this.terminationHandler.handleExitTermination(e,t)}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function to(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function io(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){to(e,t,i[t])})}return e}function no(e){return function(e){if(Array.isArray(e))return eo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return eo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?eo(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ro=Object.defineProperty,oo=function(e,t,i){return function(e,t,i){return t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ao=function(){function e(t,cmi,adl,i,n){var r=this,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oo(this,"sequencing"),oo(this,"cmi"),oo(this,"adl"),oo(this,"eventService"),oo(this,"loggingService"),oo(this,"activityDeliveryService"),oo(this,"rollupProcess"),oo(this,"overallSequencingProcess",null),oo(this,"sequencingProcess",null),oo(this,"eventListeners",{}),oo(this,"configuration"),oo(this,"isInitialized",!1),oo(this,"isSequencingActive",!1),oo(this,"lastCMIValues",new Map),oo(this,"lastSequencingResult",null),this.sequencing=t,this.cmi=cmi,this.adl=adl,this.eventService=i,this.loggingService=n,this.configuration=io({autoRollupOnCMIChange:!0,autoProgressOnCompletion:!1,validateNavigationRequests:!0,enableEventSystem:!0,logLevel:"info",now:function(){return new Date}},o),this.activityDeliveryService=new di(i,n,{onDeliverActivity:function(e){return r.handleActivityDelivery(e)},onUnloadActivity:function(e){return r.handleActivityUnload(e)},onSequencingComplete:function(result){return r.handleSequencingComplete(result)},onSequencingError:function(e){return r.handleSequencingError(e)}}),this.rollupProcess=new or,this.configuration.now&&vt.setNowProvider(this.configuration.now),this.setupCMIChangeWatchers(),this.createSequencingProcesses()}return t=e,i=[{key:"createSequencingProcesses",value:function(){var e=this;try{if(this.sequencing.initialized||this.sequencing.initialize(),this.sequencing.adlNav=this.adl.nav,this.sequencing.activityTree.root){var t={};this.configuration.now&&(t.now=this.configuration.now),this.configuration.getAttemptElapsedSeconds&&(t.getAttemptElapsedSeconds=this.configuration.getAttemptElapsedSeconds),this.configuration.getActivityElapsedSeconds&&(t.getActivityElapsedSeconds=this.configuration.getActivityElapsedSeconds),this.sequencingProcess=new si(this.sequencing.activityTree,this.sequencing.sequencingRules,this.sequencing.sequencingControls,this.adl.nav,t);var i={};this.configuration.now&&(i.now=this.configuration.now),i.defaultHideLmsUi=no(this.sequencing.hideLmsUi),this.sequencing.auxiliaryResources.length>0&&(i.defaultAuxiliaryResources=this.sequencing.auxiliaryResources.map(function(e){return{resourceId:e.resourceId,purpose:e.purpose}})),i.getCMIData=function(){return e.getCMIDataForTransfer()},this.overallSequencingProcess=new Zr(this.sequencing.activityTree,this.sequencingProcess,this.rollupProcess,this.adl.nav,function(t,i){return e.handleSequencingProcessEvent(t,i)},i),this.sequencing.overallSequencingProcess=this.overallSequencingProcess,this.isInitialized=!0,this.log("info","Sequencing processes created and ready for navigation")}}catch(e){this.log("error","Failed to create sequencing processes: ".concat(e))}}},{key:"initialize",value:function(){try{return this.log("info","Initializing sequencing service for SCO session"),this.isInitialized||this.createSequencingProcesses(),this.shouldAutoStartSequencing()&&!this.isSequencingActive&&this.startSequencing(),this.initializeCMITracking(),this.fireEvent("onSequencingStart",this.sequencing.getCurrentActivity()),this.log("info","Sequencing service initialized successfully"),q}catch(t){var e="Failed to initialize sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"initialization"),D}}},{key:"terminate",value:function(){try{return this.log("info","Terminating sequencing service"),this.triggerFinalRollup(),this.endSequencing(),this.isInitialized=!1,this.fireEvent("onSequencingEnd"),this.log("info","Sequencing service terminated successfully"),q}catch(t){var e="Failed to terminate sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"termination"),D}}},{key:"processNavigationRequest",value:function(request,e,t){if(!this.isInitialized||!this.overallSequencingProcess)return this.log("warn","Navigation request '".concat(request,"' ignored - sequencing not initialized")),!1;try{this.log("info","Processing navigation request: ".concat(request).concat(e?" (target: ".concat(e,")"):"").concat(t?" (exit: ".concat(t,")"):"")),this.fireEvent("onNavigationRequest",request,e);var i=this.parseNavigationRequest(request);if(null===i)return this.log("warn","Invalid navigation request: ".concat(request)),!1;var n=this.overallSequencingProcess.processNavigationRequest(i,e||null,t),r={deliveryRequest:n.valid?Ot.DELIVER:Ot.DO_NOT_DELIVER,targetActivity:n.targetActivity,exception:n.exception||null,endSequencingSession:!1};return this.lastSequencingResult=r,n.valid&&n.targetActivity?(this.activityDeliveryService.processSequencingResult(r),this.overallSequencingProcess.updateNavigationValidity(),this.log("info","Navigation request '".concat(request,"' resulted in activity delivery: ").concat(n.targetActivity.id)),!0):(n.exception?(this.log("warn","Navigation request '".concat(request,"' failed: ").concat(n.exception)),this.fireEvent("onSequencingError",n.exception,"navigation")):this.log("info","Navigation request '".concat(request,"' completed with no activity delivery")),n.valid)}catch(e){var o="Error processing navigation request '".concat(request,"': ").concat(e);return this.log("error",o),this.fireEvent("onSequencingError",o,"navigation"),!1}}},{key:"triggerRollupOnCMIChange",value:function(e,t,i){if(this.configuration.autoRollupOnCMIChange&&this.isInitialized&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.progress_measure","cmi.objectives.n.success_status","cmi.objectives.n.completion_status","cmi.objectives.n.score.scaled"].some(function(t){return e.startsWith(t)}))try{this.log("debug","Triggering rollup due to CMI change: ".concat(e," = ").concat(i," (was ").concat(t,")"));var n=this.sequencing.getCurrentActivity();if(!n)return void this.log("debug","No current activity for rollup");this.updateActivityFromCMI(n),this.rollupProcess.overallRollupProcess(n),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.overallSequencingProcess&&this.overallSequencingProcess.updateNavigationValidity(),this.fireEvent("onRollupComplete",n),this.log("debug","Rollup completed for activity: ".concat(n.id))}catch(e){var r="Error during rollup on CMI change: ".concat(e);this.log("error",r),this.fireEvent("onSequencingError",r,"rollup")}}},{key:"setEventListeners",value:function(e){this.eventListeners=io({},this.eventListeners,e),this.log("debug","Sequencing event listeners updated")}},{key:"updateConfiguration",value:function(e){this.configuration=io({},this.configuration,e),this.log("debug","Sequencing configuration updated")}},{key:"getSequencingState",value:function(){return{isInitialized:this.isInitialized,isActive:this.isSequencingActive,currentActivity:this.sequencing.getCurrentActivity(),rootActivity:this.sequencing.getRootActivity(),lastSequencingResult:this.lastSequencingResult}}},{key:"getOverallSequencingProcess",value:function(){return this.overallSequencingProcess}},{key:"isDeliveryInProgress",value:function(){var e,t;return null!==(e=null===(t=this.overallSequencingProcess)||void 0===t?void 0:t.isDeliveryInProgress())&&void 0!==e&&e}},{key:"setupCMIChangeWatchers",value:function(){}},{key:"initializeCMITracking",value:function(){this.lastCMIValues.set("cmi.completion_status",this.cmi.completion_status),this.lastCMIValues.set("cmi.success_status",this.cmi.success_status),this.lastCMIValues.set("cmi.progress_measure",this.cmi.progress_measure),this.cmi.score&&(this.lastCMIValues.set("cmi.score.scaled",this.cmi.score.scaled),this.lastCMIValues.set("cmi.score.raw",this.cmi.score.raw))}},{key:"shouldAutoStartSequencing",value:function(){return!(!this.sequencing.activityTree.root||this.sequencing.getCurrentActivity())}},{key:"startSequencing",value:function(){if(this.overallSequencingProcess)try{this.processNavigationRequest("start")&&(this.isSequencingActive=!0,this.log("info","Automatic sequencing started"))}catch(e){this.log("error","Failed to start automatic sequencing: ".concat(e))}}},{key:"endSequencing",value:function(){this.isSequencingActive=!1,this.activityDeliveryService.reset()}},{key:"triggerFinalRollup",value:function(){try{var e=this.sequencing.getCurrentActivity();e&&(this.updateActivityFromCMI(e),this.rollupProcess.overallRollupProcess(e),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.log("info","Final rollup completed"))}catch(e){this.log("error","Error during final rollup: ".concat(e))}}},{key:"updateActivityFromCMI",value:function(e){var t=!1;if(""!==this.cmi.progress_measure){var i=parseFloat(this.cmi.progress_measure);isNaN(i)||(t=!0,e.progressMeasure=i,e.progressMeasureStatus=!0,e.attemptCompletionAmount=i,e.attemptCompletionAmountStatus=!0)}if(t||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var n=ar({completionThreshold:e.minProgressMeasure,progressMeasure:this.cmi.progress_measure,storedCompletionStatus:_e});e.completionStatus=n,e.attemptProgressStatus=n!==_e}else"unknown"!==this.cmi.completion_status&&(e.completionStatus=this.cmi.completion_status,e.attemptProgressStatus=!0);if("unknown"!==this.cmi.success_status&&(e.successStatus=this.cmi.success_status,e.objectiveSatisfiedStatus="passed"===this.cmi.success_status,e.primaryObjective&&(e.primaryObjective.progressStatus=!0)),this.cmi.score&&""!==this.cmi.score.scaled){var r=parseFloat(this.cmi.score.scaled);isNaN(r)||(e.objectiveNormalizedMeasure=r,e.objectiveMeasureStatus=!0,e.primaryObjective&&(e.primaryObjective.progressStatus=!0))}e.primaryObjective&&this.cmi.score&&(""!==this.cmi.score.raw&&(e.primaryObjective.rawScore=this.cmi.score.raw),""!==this.cmi.score.min&&(e.primaryObjective.minScore=this.cmi.score.min),""!==this.cmi.score.max&&(e.primaryObjective.maxScore=this.cmi.score.max)),e.primaryObjective&&e.primaryObjective.updateFromActivity(e)}},{key:"getCMIDataForTransfer",value:function(){var e,t,i,n,r={completion_status:this.cmi.completion_status,success_status:this.cmi.success_status,progress_measure:this.cmi.progress_measure,score:{scaled:(null===(e=this.cmi.score)||void 0===e?void 0:e.scaled)||"",raw:(null===(t=this.cmi.score)||void 0===t?void 0:t.raw)||"",min:(null===(i=this.cmi.score)||void 0===i?void 0:i.min)||"",max:(null===(n=this.cmi.score)||void 0===n?void 0:n.max)||""},objectives:[]};if(this.cmi.objectives&&this.cmi.objectives.childArray){var o=!0,a=!1,s=void 0;try{for(var l,c=this.cmi.objectives.childArray[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u,d,v,f,h=l.value;h.id&&r.objectives.push({id:h.id,success_status:h.success_status,completion_status:h.completion_status,progress_measure:h.progress_measure,score:{scaled:(null===(u=h.score)||void 0===u?void 0:u.scaled)||"",raw:(null===(d=h.score)||void 0===d?void 0:d.raw)||"",min:(null===(v=h.score)||void 0===v?void 0:v.min)||"",max:(null===(f=h.score)||void 0===f?void 0:f.max)||""}})}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}return r}},{key:"parseNavigationRequest",value:function(request){var e=request;if(e.startsWith("_")&&"_none_"!==e&&(e=e.substring(1)),request.includes("choice"))return xr.CHOICE;if(request.includes("jump"))return xr.JUMP;switch(e){case"start":return xr.START;case"resumeAll":return xr.RESUME_ALL;case"continue":return xr.CONTINUE;case"previous":return xr.PREVIOUS;case"exit":return xr.EXIT;case"exitAll":return xr.EXIT_ALL;case"abandon":return xr.ABANDON;case"abandonAll":return xr.ABANDON_ALL;case"suspendAll":return xr.SUSPEND_ALL;case"_none_":return xr.NOT_VALID;default:return null}}},{key:"handleActivityDelivery",value:function(e){this.log("info","Activity delivered: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityDelivery",e)}},{key:"handleActivityUnload",value:function(e){this.log("info","Activity unloaded: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityUnload",e)}},{key:"handleSequencingComplete",value:function(result){this.log("debug","Sequencing completed",result)}},{key:"handleSequencingError",value:function(e){this.log("error","Sequencing error: ".concat(e)),this.fireEvent("onSequencingError",e,"sequencing")}},{key:"fireEvent",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];if(this.configuration.enableEventSystem){"onSequencingDebug"!==e&&this.fireDebugEvent("".concat(e," fired"),{eventType:e,argsLength:i.length});try{var r=this.eventListeners[e];if(r&&"function"==typeof r)try{r.apply(void 0,no(i)),this.log("debug","Internal listener for ".concat(e," executed successfully"))}catch(t){this.log("error","Internal listener for ".concat(e," failed: ").concat(t))}try{var o;(o=this.eventService).processListeners.apply(o,["Sequencing.".concat(e),i[0]].concat(no(i.slice(1)))),this.log("debug","Event service listeners for ".concat(e," processed"))}catch(t){this.log("warn","Event service failed for ".concat(e,": ").concat(t))}try{if("undefined"!=typeof window&&window.scormSequencingEvents){var a,s=window.scormSequencingEvents;s[e]&&"function"==typeof s[e]&&((a=s)[e].apply(a,no(i)),this.log("debug","Global listener for ".concat(e," executed")))}}catch(t){this.log("warn","Global listener for ".concat(e," failed: ").concat(t))}}catch(t){this.log("error","Critical error firing event ".concat(e,": ").concat(t))}}}},{key:"fireDebugEvent",value:function(e,t){try{var i=this.eventListeners.onSequencingDebug;i&&"function"==typeof i&&i(e,io({timestamp:(new Date).toISOString()},t));try{this.eventService.processListeners("Sequencing.onSequencingDebug",e,io({timestamp:(new Date).toISOString()},t))}catch(e){}}catch(e){console.debug("Debug event failed: ".concat(e))}}},{key:"fireActivityAttemptStart",value:function(e){this.fireEvent("onActivityAttemptStart",e),this.fireDebugEvent("Activity attempt started",{activityId:e.id,title:e.title,attemptCount:e.attemptCount})}},{key:"fireActivityAttemptEnd",value:function(e){this.fireEvent("onActivityAttemptEnd",e),this.fireDebugEvent("Activity attempt ended",{activityId:e.id,title:e.title,completionStatus:e.completionStatus,successStatus:e.successStatus})}},{key:"fireLimitConditionCheck",value:function(e,result){this.fireEvent("onLimitConditionCheck",e,result),this.fireDebugEvent("Limit condition check",{activityId:e.id,result:result,attemptCount:e.attemptCount,attemptLimit:e.attemptLimit})}},{key:"fireNavigationValidityUpdate",value:function(e){this.fireEvent("onNavigationValidityUpdate",e),this.fireDebugEvent("Navigation validity updated",{validity:e})}},{key:"fireSequencingStateChange",value:function(e){this.fireEvent("onSequencingStateChange",e),this.fireDebugEvent("Sequencing state changed",{stateKeys:Object.keys(e)})}},{key:"handleSequencingProcessEvent",value:function(e,t){try{switch(e){case"onActivityDelivery":this.fireEvent("onActivityDelivery",t);break;case"onLimitConditionCheck":this.fireLimitConditionCheck(t.activity,t.result);break;case"onActivityAttemptStart":this.fireActivityAttemptStart(t);break;case"onActivityAttemptEnd":this.fireActivityAttemptEnd(t);break;case"onNavigationValidityUpdate":this.fireNavigationValidityUpdate(t);break;case"onSequencingSessionEnd":this.fireEvent("onSequencingSessionEnd",t);break;default:this.fireDebugEvent("Sequencing process event: ".concat(e),t)}}catch(t){this.log("error","Error handling sequencing process event ".concat(e,": ").concat(t))}}},{key:"log",value:function(e,t,i){var n=["debug","info","warn","error"],r=this.configuration.logLevel||"info";if(n.indexOf(e)>=n.indexOf(r))switch(e){case"debug":this.loggingService.debug("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"info":this.loggingService.info("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"warn":this.loggingService.warn("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"error":this.loggingService.error("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var so=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(r()){var a=/^(cmi\.interactions\.)(\d+)\.(.*)$/,s=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],l=[];for(var c in e)if({}.hasOwnProperty.call(e,c)){var u=c.match(a);if(u){interactions.push({key:c,value:e[c],index:+u[2],field:u[3]||""});continue}var d=c.match(s);if(d){objectives.push({key:c,value:e[c],index:+d[2],field:d[3]||""});continue}l.push({key:c,value:e[c]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),l.sort(function(e,t){return e.key.localeCompare(t.key)});var v=function(e){e.forEach(function(e){var a={};a[e.key]=e.value,t.loadFromJSON(function(e){var t;if(Object(e)!==e||Array.isArray(e))return e;var result={},pattern=/\.?([^.[\]]+)|\[(\d+)]/g;return Object.keys(e).filter(function(t){return{}.hasOwnProperty.call(e,t)}).forEach(function(t){var i,n,r=result,o="",a=RegExp(pattern);Array.from({length:null!==(i=null===(n=t.match(RegExp(pattern,"g")))||void 0===n?void 0:n.length)&&void 0!==i?i:0},function(){return a.exec(t)}).forEach(function(e){var t;e&&(r=null!==(t=r[o])&&void 0!==t?t:r[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),r[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(a),i,n,r,o)})};v(interactions),v(objectives),v(l)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(n()){for(var o in t=void 0!==t?t:"cmi",r(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var a=(t?t+".":"")+o,s=e[o];if(s.constructor===Array){for(var l=0;s.length>l;l++)if(s[l]){var c=s[l],u="".concat(a,".").concat(l);c.constructor===Object?this.loadFromJSON(c,u,i,n,r):i(u,c)}}else s.constructor===Object?this.loadFromJSON(s,a,i,n,r):i(a,s)}}else console.error("loadFromJSON can only be called before the call to lmsInitialize.")}},{key:"renderCMIToJSONString",value:function(cmi,e){return e?JSON.stringify({cmi:cmi}):JSON.stringify({cmi:cmi},function(e,t){return void 0===t?null:t},2)}},{key:"renderCMIToJSONObject",value:function(cmi,e){return JSON.parse(this.renderCMIToJSONString(cmi,e))}},{key:"getCommitObject",value:function(e,t,i,n,r,o){var a=t||e,s=i?n(e,a):r(e,a);return[Se.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(s)),s}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function co(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var uo=Object.defineProperty,vo=function(e,t,i){return function(e,t,i){return t in e?uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},fo=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),vo(this,"settings"),vo(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){var i=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,i):this._performSyncXHR(e,t,i)}},{key:"_handleImmediateRequest",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t).body,o=navigator.sendBeacon(e,new Blob([r],{type:"text/plain;charset=UTF-8"}));return{result:o?"true":"false",errorCode:o?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_performSyncXHR",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t),o=r.body,a=r.contentType,s=new XMLHttpRequest;s.open("POST",e,!1),s.setRequestHeader("Content-Type",a),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return lo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?lo(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());s.setRequestHeader(n[0],n[1]+"")}),this.settings.xhrWithCredentials&&(s.withCredentials=!0);try{return s.send(o),this.settings.xhrResponseHandler(s)}catch(e){var l=co(e,Error)?e.message:e+"";return{result:D,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:l}}}},{key:"_prepareRequestBody",value:function(e){return{body:co(e,Array)?e.join("&"):JSON.stringify(e),contentType:co(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function ho(e,t,i,n){return Wi(e,t,i,ne.TYPE_MISMATCH,G,n)}function mo(e,t,i,n){if(""===t)throw new G(e,ne.VALUE_OUT_OF_RANGE);return Ji(e,t,i,ne.VALUE_OUT_OF_RANGE,G)}var po=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"validateScore",value:function(e,t,i,n,r,o,a){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||Wi(e,t,i,r,a)&&(!n||Ji(e,t,n,o,a))}},{key:"validateScorm12Audio",value:function(e,t){return ho(e,t,Ae)&&mo(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return ho(e,t,"^[\\s\\S]{0,255}$")}},{key:"validateScorm12Speed",value:function(e,t){return ho(e,t,Ae)&&mo(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return ho(e,t,Ae)&&mo(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new G(e,ne.READ_ONLY_ELEMENT)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),yo=new po;function go(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function bo(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _o(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function So(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){bo(e,t,i[t])})}return e}function wo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function Co(e){return function(e){if(Array.isArray(e))return go(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return go(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?go(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ao=Object.defineProperty,Eo=function(e,t,i){return function(e,t,i){return t in e?Ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Oo(t))?t+"":t,i)},ko=function(){function e(t,i,n,r,o,a,s,l,c){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Eo(this,"_timeout"),Eo(this,"_error_codes"),Eo(this,"_settings",Ce),Eo(this,"_httpService"),Eo(this,"_eventService"),Eo(this,"_serializationService"),Eo(this,"_errorHandlingService"),Eo(this,"_loggingService"),Eo(this,"_offlineStorageService"),Eo(this,"_cmiValueAccessService"),Eo(this,"_courseId",""),Eo(this,"_pendingCommitCount",0),Eo(this,"_commitSequence",0),Eo(this,"_commitSettleWaiters",[]),Eo(this,"_setCMIElements",new Set),Eo(this,"startingData"),Eo(this,"currentState"),(_o(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,i&&(this.settings=So({},Ce,i)),void 0!==(null==i?void 0:i.asyncCommit)&&void 0===i.useAsynchronousCommits&&void 0===i.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),i.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=l||Ti(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:Oe),n?this._httpService=n:this.settings.httpService?this._httpService=this.settings.httpService:this.settings.useAsynchronousCommits?(console.warn("WARNING: useAsynchronousCommits=true is not SCORM compliant. Commit failures will not be reported to the SCO, which may cause data loss. This setting should only be used for specific legacy compatibility cases."),this._httpService=new _i(this.settings,this._error_codes)):this._httpService=new fo(this.settings,this._error_codes),this._eventService=r||new Li(function(e,t,i,n){return u.apiLog(e,t,i,n)}),this._serializationService=o||new so,this._errorHandlingService=s||new Ni(this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i||Se.ERROR,n)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=c||new Yi(this.settings,this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i,n)}),this.settings.courseId&&(this._courseId=this.settings.courseId),this.settings.syncOnTerminate&&this._eventService.on("BeforeTerminate",function(){var e;(null===(e=u._offlineStorageService)||void 0===e?void 0:e.isDeviceOnline())&&u._courseId&&u._offlineStorageService.hasPendingOfflineData(u._courseId).then(function(e){var t;if(e)return u.apiLog("BeforeTerminate","Syncing pending offline data before termination",Se.INFO),null===(t=u._offlineStorageService)||void 0===t?void 0:t.syncOfflineData()}).then(function(e){e?u.processListeners("OfflineDataSynced"):!1===e&&u.processListeners("OfflineDataSyncFailed")}).catch(function(e){u.apiLog("BeforeTerminate","Error syncing offline data: ".concat(e),Se.ERROR),u.processListeners("OfflineDataSyncFailed")})}),this._offlineStorageService&&this._courseId&&this._offlineStorageService.getOfflineData(this._courseId).then(function(e){e&&(u.apiLog("constructor","Found offline data to restore",Se.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),Se.ERROR)})),this._cmiValueAccessService=new Ai({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,i){return u.throwSCORMError(e,t,i)},isInitialized:function(){return u.isInitialized()},validateCorrectResponse:function(e,t){return u.validateCorrectResponse(e,t)},checkForDuplicateId:function(e,t){return u._checkForDuplicateId(e,t)},getChildElement:function(e,t,i){return u.getChildElement(e,t,i)},apiLog:function(e,t,i){return u.apiLog(e,t,i)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,i=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",Se.INFO),this.settings=So({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,i){var n=this,r=D;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,i):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",r=q,this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._courseId&&this.settings.syncOnInitialize&&this._offlineStorageService.isDeviceOnline()&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(t){var i;t&&(n.apiLog(e,"Syncing pending offline data on initialization",Se.INFO),null===(i=n._offlineStorageService)||void 0===i||i.syncOfflineData().then(function(t){t&&(n.apiLog(e,"Successfully synced offline data",Se.INFO),n.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+r,Se.INFO),this.clearSCORMError(r),r}},{key:"apiLog",value:function(e,t,i,n){t=function(e,t,i){var n=e?"".concat((e+"").padEnd(20),": "):"";return i&&(n=(n+=i).padEnd(70)),n+(null!=t?t:"")}(e,t,n),this._loggingService.log(i,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,i,n,r=this._settings;this._settings=So({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==r.logLevel&&(null===(i=this._loggingService)||void 0===i||i.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==r.onLogMessage&&(null===(n=this._loggingService)||void 0===n||n.setLogHandler(e.onLogMessage))}},{key:"pendingCommitCount",get:function(){return this._pendingCommitCount}},{key:"whenCommitsSettled",value:function(e){var t=this;return 0===this._pendingCommitCount?Promise.resolve():new Promise(function(i){var n={resolve:i};void 0!==(null==e?void 0:e.timeoutMs)&&(n.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(n);-1!==e&&(t._commitSettleWaiters.splice(e,1),i())},e.timeoutMs)),t._commitSettleWaiters.push(n)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;void 0!==a.timeoutId&&clearTimeout(a.timeoutId),a.resolve()}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"terminate",value:function(e,t){var i=q,n=!1;if(this.isNotInitialized()){var r,o=null!==(r=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==r?r:0;this.throwSCORMError("api",o),112===o&&(i=D)}else if(t&&this.isTerminated()){var a,s=null!==(a=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==a?a:0;this.throwSCORMError("api",s),113===s&&(i=D)}else{var l;n=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(l=result.errorCode)&&void 0!==l?l:0)>0){var c;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),Se.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),Se.DEBUG),this.throwSCORMError("api",null!==(c=result.errorCode)&&void 0!==c?c:0),i=D}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:q;i="boolean"==typeof d?d+"":d}this.processListeners(e)}return this.apiLog(e,"returned: "+i,Se.INFO),n&&this.clearSCORMError(i),i}},{key:"getValue",value:function(e,t,i){var n,r,o="";if(this.checkState(t,null!==(n=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==n?n:0,null!==(r=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==r?r:0)){try{o=this.getCMIValue(i)}catch(e){o=this.handleValueAccessException(i,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(i,o),this.processListeners(e,i)}return this.apiLog(e,": returned: "+o,Se.INFO,i),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,i,n,r){var o,a;void 0!==r&&(r+="");var s=D;if(this.checkState(i,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(a=this._error_codes.STORE_AFTER_TERM)&&void 0!==a?a:0)){try{s=this.setCMIValue(n,r)}catch(e){s=this.handleValueAccessException(n,e,s)}this.processListeners(e,n,r)}return void 0===s&&(s=D),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+r+": result: "+s,Se.INFO,n),"0"===this.lastErrorCode&&this.clearSCORMError(s),s}},{key:"commit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var r=q;if(this.isNotInitialized()){var o,a=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",a),142===a&&(r=D)}else if(i&&this.isTerminated()){var s,l=null!==(s=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==s?s:0;this.throwSCORMError("api",l),143===l&&(r=D)}else{var c,u,result=this.storeData(!1,n),d=null!==(c=result.errorCode)&&void 0!==c?c:0;d>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),Se.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),Se.DEBUG),this.throwSCORMError("api",d));var v=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:D;this.apiLog(e," Result: "+(r="boolean"==typeof v?v+"":v),Se.DEBUG,"HttpRequest"),i&&0===d&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(i){var n;i&&(t.apiLog(e,"Syncing pending offline data",Se.INFO),null===(n=t._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(i){i?(t.apiLog(e,"Successfully synced offline data",Se.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",Se.WARN)}))})}return this.apiLog(e,"returned: "+r,Se.INFO),this.isNotInitialized()||i&&this.isTerminated()||this.clearSCORMError(r),r}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,Se.INFO),t}},{key:"getErrorString",value:function(e,t){var i="";return null!==t&&""!==t&&(i=this.getLmsErrorMessageDetails(t),this.processListeners(e)),i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Se.INFO),i}},{key:"getDiagnostic",value:function(e,t){var i="",n=""===t?this.lastErrorCode+"":t;if(null!==n&&""!==n){var r=this._errorHandlingService.lastDiagnostic;i=r&&n+""==this.lastErrorCode+""?r:this.getLmsErrorMessageDetails(n,!0),this.processListeners(e)}return i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Se.INFO),i}},{key:"checkState",value:function(e,t,i){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",i),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var i=function(e,t){if(e&&"object"===(void 0===e?"undefined":Oo(e))&&t in e){var i=e[t];return _o(i,de)?i:void 0}},n=function(e,t,i){for(var n=0;e.childArray.length>n;n++)if(n!==t){var r=e.childArray[n];if(r&&"object"===(void 0===r?"undefined":Oo(r))&&"id"in r&&r.id===i)return!0}return!1},r=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(r&&r[1]){var o=parseInt(r[1],10),objectives=i(this.cmi,"objectives");return!!objectives&&n(objectives,o,t)}var a=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(a&&a[1]){var s=parseInt(a[1],10),interactions=i(this.cmi,"interactions");return!!interactions&&n(interactions,s,t)}var l=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(l&&l[1]&&l[2]){var c=parseInt(l[1],10),u=parseInt(l[2],10),d=i(this.cmi,"interactions");if(d){var v=d.childArray[c];if(v){var f=i(v,"objectives");if(f)return n(f,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,i,n){var result=this._cmiValueAccessService.setCMIValue(e,t,i,n);return result===q&&this._setCMIElements.add(i),result}},{key:"_commonGetCMIValue",value:function(e,t,i){return this._cmiValueAccessService.getCMIValue(e,t,i)}},{key:"checkUninitializedGet",value:function(e,t){}},{key:"isInitialized",value:function(){return 1===this.currentState}},{key:"isNotInitialized",value:function(){return 0===this.currentState}},{key:"isTerminated",value:function(){return 2===this.currentState}},{key:"on",value:function(e,t){this._eventService.on(e,t)}},{key:"off",value:function(e,t){this._eventService.off(e,t)}},{key:"clear",value:function(e){this._eventService.clear(e)}},{key:"processListeners",value:function(e,t,i,n){void 0!==n?this._eventService.processListeners(e,t,i,n):this._eventService.processListeners(e,t,i)}},{key:"throwSCORMError",value:function(e,t,i){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,i)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var i=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return i.setCMIValue(e,t)},function(){return i.isNotInitialized()},function(e){i.startingData=e})}},{key:"getFlattenedCMI",value:function(){return l(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";i&&""!==i||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(i="cmi"),this._serializationService.loadFromJSON(e,i,function(e,i){return t.setCMIValue(e,i)},function(){return t.isNotInitialized()},function(e){t.startingData=e})}},{key:"renderCMIToJSONString",value:function(){return this._serializationService.renderCMIToJSONString(this.cmi,this.settings.sendFullCommit)}},{key:"renderCMIToJSONObject",value:function(){return this._serializationService.renderCMIToJSONObject(this.cmi,this.settings.sendFullCommit)}},{key:"processHttpRequest",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var a=!1,s=!1,l=function(){a||(a=!0,i._pendingCommitCount-=1,0===i._pendingCommitCount&&i._flushCommitSettleWaiters())};try{var c=null!=r?r:n?"terminate":"manual",u=t;if(n&&this.settings.terminateCommitPayloadField){var v=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=Co(u).concat(["".concat(encodeURIComponent(v),"=true")]):u&&"object"===(void 0===u?"undefined":Oo(u))&&(u=wo(So({},u),bo({},v,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=Co(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":Oo(u))&&(u=wo(So({},u),{commitSequence:o})));var f,h=n&&this.settings.terminateCommitParam?d(e,this.settings.terminateCommitParam,"true"):e,m={isTerminateCommit:n,trigger:c,sequence:o},p={url:h,trigger:c,isTerminateCommit:n,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",Se.INFO),u&&"object"===(void 0===u?"undefined":Oo(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:n,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",Se.ERROR),{result:D,errorCode:null!==(f=this._error_codes.GENERAL)&&void 0!==f?f:101});var result=this._httpService.processHttpRequest(h,u,n,function(e,t,n,r){return i.apiLog(e,t,n,r)},function(e,t,n){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof n&&(p.errorCode=n),l(),i.processListeners(e,t,n,p)):i.processListeners(e,t,n)},m,l);return s=!0===this._httpService.reportsRequestCompletion,result}finally{s||l()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new Xe(this,e,t),this.apiLog("scheduleCommit","scheduled",Se.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",Se.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Oo(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,i){return _o(t,N)?(this.lastErrorCode=t.errorCode+"",""!==i&&(i=D),this.throwSCORMError(e,t.errorCode,t.errorMessage)):_o(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),i}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,i){return t.renderCommitObject(e,i)},function(e,i){return t.renderCommitCMI(e,i)},this.settings.logLevel)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function jo(e){return jo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},jo(e)}function Ro(e,t){return Ro=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ro(e,t)}function Mo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function To(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(To=function(){return!!result})()}var xo=Object.defineProperty,Io=function(e,t,i){return function(e,t,i){return t in e?xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Mo(t))?t+"":t,i)},Po=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=jo(t),n=e,!(r=To()?Reflect.construct(t,i||[],jo(e).constructor):t.apply(e,i))||"object"!==Mo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.learner_preference"]),Io(e,"__children",L.student_preference_children),Io(e,"_audio_level","1"),Io(e,"_language",""),Io(e,"_delivery_speed","1"),Io(e,"_audio_captioning","0"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ro(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",re.READ_ONLY_ELEMENT)}},{key:"audio_level",get:function(){return this._audio_level},set:function(audio_level){Xi(this._cmi_element+".audio_level",audio_level,Ie)&&$i(this._cmi_element+".audio_level",audio_level,"0#999.9999999")&&(this._audio_level=audio_level)}},{key:"language",get:function(){return this._language},set:function(language){Xi(this._cmi_element+".language",language,"^([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$")&&(this._language=language)}},{key:"delivery_speed",get:function(){return this._delivery_speed},set:function(delivery_speed){if(Xi(this._cmi_element+".delivery_speed",delivery_speed,Ie)&&$i(this._cmi_element+".delivery_speed",delivery_speed,"0#999.9999999")){if(0===parseFloat(delivery_speed))throw new Q(this._cmi_element+".delivery_speed",re.VALUE_OUT_OF_RANGE);this._delivery_speed=delivery_speed}}},{key:"audio_captioning",get:function(){return this._audio_captioning},set:function(audio_captioning){Xi(this._cmi_element+".audio_captioning",audio_captioning,"^-?([0-9]+)$")&&$i(this._cmi_element+".audio_captioning",audio_captioning,"-1#1")&&(this._audio_captioning=audio_captioning)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function No(e){return e.replace(/[[\]]/g,"")}function qo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Do(e,t){if(!t)return[e];if(e.includes(t))return e.split(t);var i=No(t);if(!i)return[e];var n=RegExp("(?<!\\\\)".concat(qo(i)),"g"),r=RegExp("\\\\".concat(qo(i)),"g");return e.split(n).map(function(e){return e.replace(r,i)})}function Lo(e,t){var i;if(!t)return[e];if(e.includes(t)){var n=e.indexOf(t);return[e.slice(0,n),e.slice(n+t.length)]}var r=No(t);if(!r)return[e];var o=RegExp("(?<!\\\\)".concat(qo(r))),a=RegExp("\\\\".concat(qo(r)),"g"),s=e.split(o),l=(null!==(i=s[0])&&void 0!==i?i:"").replace(a,r);return 1===s.length?[l]:[l,s.slice(1).join(r).replace(a,r)]}function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Fo(e,t,i){return t=Uo(t),n=e,!(r=Jo()?Reflect.construct(t,i||[],Uo(e).constructor):t.apply(e,i))||"object"!==Wo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Bo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vo(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Ho(e,t,i){return Ho="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Uo(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ho(e,t,i||e)}function Uo(e){return Uo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Uo(e)}function Go(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ko(e,t)}function Ko(e,t){return Ko=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ko(e,t)}function Yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return zo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?zo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Jo(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jo=function(){return!!result})()}var Xo=Object.defineProperty,$o=function(e,t,i){return function(e,t,i){return t in e?Xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Wo(t))?t+"":t,i)},Qo=function(e){function t(){return Bo(this,t),Fo(this,t,[{CMIElement:"cmi.interactions",children:L.interactions_children,errorCode:re.READ_ONLY_ELEMENT,errorClass:Q}])}return Go(t,e),t}(de),Zo=function(e){function t(){var e;return Bo(this,t),e=Fo(this,t,["cmi.interactions.n"]),$o(e,"_id",""),$o(e,"_idIsSet",!1),$o(e,"_type",""),$o(e,"_timestamp",""),$o(e,"_weighting",""),$o(e,"_learner_response",""),$o(e,"_result",""),$o(e,"_latency",""),$o(e,"_description",""),$o(e,"objectives"),$o(e,"correct_responses"),e.objectives=new de({CMIElement:"cmi.interactions.n.objectives",errorCode:re.READ_ONLY_ELEMENT,errorClass:Q,children:L.objectives_children}),e.correct_responses=new de({CMIElement:"cmi.interactions.n.correct_responses",errorCode:re.READ_ONLY_ELEMENT,errorClass:Q,children:L.correct_responses_children}),e}return Go(t,e),Vo(t,[{key:"initialize",value:function(){var e,i;Ho(Uo(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._id="",this._idIsSet=!1,this._type="",this._timestamp="",this._weighting="",this._learner_response="",this._result="",this._latency="",this._description="",this.objectives=new de({CMIElement:"cmi.interactions.n.objectives",errorCode:re.READ_ONLY_ELEMENT,errorClass:Q,children:L.objectives_children}),this.correct_responses=new de({CMIElement:"cmi.interactions.n.correct_responses",errorCode:re.READ_ONLY_ELEMENT,errorClass:Q,children:L.correct_responses_children})}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new Q(this._cmi_element+".id",re.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new Q(this._cmi_element+".id",re.GENERAL_SET_FAILURE);Xi(this._cmi_element+".id",id,Ne)&&(this._id=id,this._idIsSet=!0)}},{key:"type",get:function(){return this._type},set:function(type){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".type",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".type",type,"^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$")&&(this._type=type)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".timestamp",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".timestamp",timestamp,Te)&&(this._timestamp=timestamp)}},{key:"weighting",get:function(){return this._weighting},set:function(weighting){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".weighting",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".weighting",weighting,Ie)&&(this._weighting=weighting)}},{key:"learner_response",get:function(){return this._learner_response},set:function(learner_response){if(this.initialized&&(""===this._type||""===this._id))throw new Q(this._cmi_element+".learner_response",re.DEPENDENCY_NOT_ESTABLISHED);var e=[],t=He[this.type];if(!t)throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH);if((null==t?void 0:t.delimiter)?e=Do(learner_response,t.delimiter):e[0]=learner_response,0>=e.length||e.length>t.max)throw new Q(this._cmi_element+".learner_response",re.GENERAL_SET_FAILURE);for(var i=RegExp(t.format),n=0;e.length>n;n++)if(null==t?void 0:t.delimiter2){var r,o,a,s=null!==(r=e[n])&&void 0!==r?r:"",l="performance"===this.type?Lo(s,t.delimiter2):Do(s,t.delimiter2);if(2!==(null==l?void 0:l.length))throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH);if("performance"===this.type&&""===l[0]&&""===l[1])throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH);if(!(null===(o=l[0])||void 0===o?void 0:o.match(i)))throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH);if(!t.format2||!(null===(a=l[1])||void 0===a?void 0:a.match(RegExp(t.format2))))throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH)}else{var c;if(!(null===(c=e[n])||void 0===c?void 0:c.match(i)))throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH);if(""!==e[n]&&t.unique)for(var u=0;n>u;u++)if(e[n]===e[u])throw new Q(this._cmi_element+".learner_response",re.TYPE_MISMATCH)}this._learner_response=learner_response}},{key:"result",get:function(){return this._result},set:function(result){Xi(this._cmi_element+".result",result,"^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$")&&(this._result=result)}},{key:"latency",get:function(){return this._latency},set:function(latency){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".latency",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".latency",latency,xe)&&(this._latency=latency)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".description",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".description",description,Re,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={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 this.jsonString=!1,result}}]),t}(_),ea=function(e){function t(){var e;return Bo(this,t),e=Fo(this,t,["cmi.interactions.n.objectives.n"]),$o(e,"_id",""),e}return Go(t,e),Vo(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new Q(this._cmi_element+".id",re.TYPE_MISMATCH);Xi(this._cmi_element+".id",id,Ne)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(_),ta=/^\{(?:lang|case_matters|order_matters)=[^}]+\}/;function ia(e){for(var result=e;ta.test(result);)result=result.replace(ta,"");return result}var na=function(e){function t(e){var i;return Bo(this,t),i=Fo(this,t,["cmi.interactions.n.correct_responses.n"]),$o(i,"_pattern",""),$o(i,"_interactionType"),i._interactionType=e,i}return Go(t,e),Vo(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){return this._pattern},set:function(pattern){if("fill-in"!==this._interactionType||""!==pattern){if(Xi(this._cmi_element+".pattern",pattern,"^.*$")){if(this._interactionType){var e=Ue[this._interactionType];e&&("matching"===this._interactionType&&/\\[.,]/.test(pattern)||function(type,pattern,e){if(pattern.trim()!==pattern)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);var t=e.delimiter?Do(pattern,e.delimiter):[pattern],i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.trim()!==s)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}if("fill-in"!==type||""!==pattern){var l=e.delimiter?Do(pattern,e.delimiter):[pattern];if(!e.delimiter&&pattern.includes(","))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);if("numeric"!==type&&(e.unique||!1===e.duplicate)&&new Set(l).size!==l.length)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);if(0===l.length||l.length>e.max)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.GENERAL_SET_FAILURE);var c=RegExp(e.format),u=e.format2?RegExp(e.format2):null,d=function(e){if(!c.test(e))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH)},v=function(e,t){if(!t)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);var i=Do(e,t);if(2!==i.length||""===i[0]||""===i[1])throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);if(void 0!==i[0]&&!c.test(i[0])||u&&void 0!==i[1]&&!u.test(i[1]))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH)},f=!0,h=!1,m=void 0;try{for(var p,y=l[Symbol.iterator]();!(f=(p=y.next()).done);f=!0){var g=p.value;switch(type){case"numeric":if(""===g){if(2>l.length||!e.delimiter||!pattern.includes(e.delimiter))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);break}d(g);break;case"performance":var b=e.delimiter2;if(!b)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);var _=Lo(ia(g),b);if(2!==_.length)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);var S=Yo(_,2),w=S[0],C=S[1];if(""===w&&""===C)throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);if(void 0===w||!c.test(w))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);if(u&&void 0!==C&&!u.test(C))throw new Q("cmi.interactions.n.correct_responses.n.pattern",re.TYPE_MISMATCH);break;default:e.delimiter2?v(g,e.delimiter2):d(g)}}}catch(e){h=!0,m=e}finally{try{f||null==y.return||y.return()}finally{if(h)throw m}}}}(this._interactionType,pattern,e))}this._pattern=pattern}}else this._pattern=""}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this.pattern};return this.jsonString=!1,result}}]),t}(_);function ra(e){return ra=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ra(e)}function oa(e,t){return oa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},oa(e,t)}function aa(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function sa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(sa=function(){return!!result})()}var la=Object.defineProperty,ca=function(e,t,i){return function(e,t,i){return t in e?la(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":aa(t))?t+"":t,i)},ua=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=ra(t),n=e,!(r=sa()?Reflect.construct(t,i||[],ra(e).constructor):t.apply(e,i))||"object"!==aa(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),ca(i,"__children"),ca(i,"__score_range"),ca(i,"__invalid_error_code"),ca(i,"__invalid_type_code"),ca(i,"__invalid_range_code"),ca(i,"__decimal_regex"),ca(i,"__error_class"),ca(i,"__allow_empty_string"),ca(i,"_raw",""),ca(i,"_min",""),ca(i,"_max"),i.__children=e.score_children||"raw,min,max",i.__score_range=!!e.score_range&&"0#100",i._max=e.max||""===e.max?e.max:"100",i.__invalid_error_code=e.invalidErrorCode||ne.INVALID_SET_VALUE,i.__invalid_type_code=e.invalidTypeCode||ne.TYPE_MISMATCH,i.__invalid_range_code=e.invalidRangeCode||ne.VALUE_OUT_OF_RANGE,i.__decimal_regex=e.decimalRegex||"^-?([0-9]{0,10})(\\.[0-9]*)?$",i.__error_class=e.errorClass,i.__allow_empty_string=null!==(n=e.allowEmptyString)&&void 0!==n&&n,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oa(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._raw="",this._min=""}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this.__error_class(this._cmi_element+"._children",this.__invalid_error_code)}},{key:"raw",get:function(){return this._raw},set:function(e){yo.validateScore(this._cmi_element+".raw",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._raw=e)}},{key:"min",get:function(){return this._min},set:function(e){yo.validateScore(this._cmi_element+".min",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._min=e)}},{key:"max",get:function(){return this._max},set:function(e){yo.validateScore(this._cmi_element+".max",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._max=e)}},{key:"getScoreObject",value:function(){var e={};return Number.isNaN(Number.parseFloat(this.raw))||(e.raw=Number.parseFloat(this.raw)),Number.isNaN(Number.parseFloat(this.min))||(e.min=Number.parseFloat(this.min)),Number.isNaN(Number.parseFloat(this.max))||(e.max=Number.parseFloat(this.max)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function da(e,t,i){return da="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=va(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},da(e,t,i||e)}function va(e){return va=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},va(e)}function fa(e,t){return fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},fa(e,t)}function ha(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ma(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ma=function(){return!!result})()}var pa=Object.defineProperty,ya=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=va(t),n=e,!(r=ma()?Reflect.construct(t,i||[],va(e).constructor):t.apply(e,i))||"object"!==ha(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[{CMIElement:"cmi.score",score_children:L.score_children,max:"",invalidErrorCode:re.READ_ONLY_ELEMENT,invalidTypeCode:re.TYPE_MISMATCH,invalidRangeCode:re.VALUE_OUT_OF_RANGE,decimalRegex:Ie,errorClass:Q}]),n="",function(e,t,i){t in e?pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==ha(i="_scaled")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fa(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._scaled="",this._raw="",this._min="",this._max=""}},{key:"scaled",get:function(){return this._scaled},set:function(e){Xi(this._cmi_element+".scaled",e,Ie)&&$i(this._cmi_element+".scaled",e,"-1#1")&&(this._scaled=e)}},{key:"getScoreObject",value:function(){var e=da(va(t.prototype),"getScoreObject",this).call(this);return Number.isNaN(Number.parseFloat(this.scaled))||(e.scaled=Number.parseFloat(this.scaled)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={scaled:this.scaled,raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(ua);function ga(e,t,i){return t=_a(t),n=e,!(r=Oa()?Reflect.construct(t,i||[],_a(e).constructor):t.apply(e,i))||"object"!==Ca(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function ba(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _a(e){return _a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_a(e)}function Sa(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wa(e,t)}function wa(e,t){return wa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},wa(e,t)}function Ca(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Oa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Oa=function(){return!!result})()}var Aa=Object.defineProperty,Ea=function(e,t,i){return function(e,t,i){return t in e?Aa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ca(t))?t+"":t,i)},ka=function(e){function t(){return ba(this,t),ga(this,t,[{CMIElement:"cmi.comments_from_lms",children:L.comments_children,errorCode:re.READ_ONLY_ELEMENT,errorClass:Q}])}return Sa(t,e),t}(de),ja=function(e){function t(){return ba(this,t),ga(this,t,[{CMIElement:"cmi.comments_from_learner",children:L.comments_children,errorCode:re.READ_ONLY_ELEMENT,errorClass:Q}])}return Sa(t,e),t}(de),Ra=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return ba(this,t),e=ga(this,t,["cmi.comments_from_learner.n"]),Ea(e,"_comment",""),Ea(e,"_location",""),Ea(e,"_timestamp",""),Ea(e,"_readOnlyAfterInit"),e._comment="",e._location="",e._timestamp="",e._readOnlyAfterInit=i,e}return Sa(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"comment",get:function(){return this._comment},set:function(comment){if(this.initialized&&this._readOnlyAfterInit)throw new Q(this._cmi_element+".comment",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".comment",comment,Me,!0)&&(this._comment=comment)}},{key:"location",get:function(){return this._location},set:function(location){if(this.initialized&&this._readOnlyAfterInit)throw new Q(this._cmi_element+".location",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,250}$")&&(this._location=location)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&this._readOnlyAfterInit)throw new Q(this._cmi_element+".timestamp",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".timestamp",timestamp,Te)&&(this._timestamp=timestamp)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={comment:this.comment,location:this.location,timestamp:this.timestamp};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Ma(e,t,i){return t=Pa(t),n=e,!(r=La()?Reflect.construct(t,i||[],Pa(e).constructor):t.apply(e,i))||"object"!==Da(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Ta(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xa(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Ia(e,t,i){return Ia="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Pa(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ia(e,t,i||e)}function Pa(e){return Pa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Pa(e)}function Na(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qa(e,t)}function qa(e,t){return qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qa(e,t)}function Da(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function La(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(La=function(){return!!result})()}var za=Object.defineProperty,Fa=function(e,t,i){return function(e,t,i){return t in e?za(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Da(t))?t+"":t,i)},Ba=function(e){function t(){return Ta(this,t),Ma(this,t,[{CMIElement:"cmi.objectives",children:L.objectives_children,errorCode:re.READ_ONLY_ELEMENT,errorClass:Q}])}return Na(t,e),xa(t,[{key:"findObjectiveById",value:function(id){return this.childArray.find(function(e){return e.id===id})}},{key:"findObjectiveByIndex",value:function(e){return this.childArray[e]}},{key:"setObjectiveByIndex",value:function(e,t){this.childArray[e]=t}}]),t}(de),Va=function(e){function t(){var e;return Ta(this,t),e=Ma(this,t,["cmi.objectives.n"]),Fa(e,"_id",""),Fa(e,"_idIsSet",!1),Fa(e,"_success_status","unknown"),Fa(e,"_completion_status","unknown"),Fa(e,"_progress_measure",""),Fa(e,"_description",""),Fa(e,"score"),e.score=new ya,e}return Na(t,e),xa(t,[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._idIsSet=!1,this._success_status="unknown",this._completion_status="unknown",this._progress_measure="",this._description="",null===(e=this.score)||void 0===e||e.reset()}},{key:"initialize",value:function(){var e;Ia(Pa(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new Q(this._cmi_element+".id",re.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new Q(this._cmi_element+".id",re.GENERAL_SET_FAILURE);Xi(this._cmi_element+".id",id,Ne)&&(this._id=id,this._idIsSet=!0)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".success_status",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".success_status",success_status,De)&&(this._success_status=success_status)}},{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".completion_status",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".completion_status",completion_status,qe)&&(this._completion_status=completion_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".progress_measure",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".progress_measure",progress_measure,Ie)&&$i(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new Q(this._cmi_element+".description",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".description",description,Re,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,success_status:this.success_status,completion_status:this.completion_status,progress_measure:this.progress_measure,description:this.description,score:this.score};return this.jsonString=!1,result}},{key:"fromJSON",value:function(e){e&&"object"===(void 0===e?"undefined":Da(e))&&("string"==typeof e.id&&(this.id=e.id),"string"==typeof e.success_status&&(this.success_status=e.success_status),"string"==typeof e.completion_status&&(this.completion_status=e.completion_status),void 0!==e.progress_measure&&(this.progress_measure=e.progress_measure+""),"string"==typeof e.description&&(this.description=e.description),e.score&&"object"===Da(e.score)&&(void 0!==e.score.scaled&&(this.score.scaled=e.score.scaled+""),void 0!==e.score.raw&&(this.score.raw=e.score.raw+""),void 0!==e.score.min&&(this.score.min=e.score.min+""),void 0!==e.score.max&&(this.score.max=e.score.max+"")))}}]),t}(_);function Ha(e){return Ha=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ha(e)}function Ua(e,t){return Ua=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ua(e,t)}function Ga(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ka(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ka=function(){return!!result})()}var Ya=Object.defineProperty,Wa=function(e,t,i){return function(e,t,i){return t in e?Ya(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ga(t))?t+"":t,i)},Ja=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ha(t),n=e,!(r=Ka()?Reflect.construct(t,i||[],Ha(e).constructor):t.apply(e,i))||"object"!==Ga(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Wa(e,"__version","1.0"),Wa(e,"__children",L.cmi_children),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ua(e,t)}(t,e),i=t,(n=[{key:"_version",get:function(){return this.__version},set:function(_version){throw new Q(this._cmi_element+"._version",re.READ_ONLY_ELEMENT)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",re.READ_ONLY_ELEMENT)}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Xa(e){return Xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Xa(e)}function $a(e,t){return $a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$a(e,t)}function Qa(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Za(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Za=function(){return!!result})()}var es=Object.defineProperty,ts=function(e,t,i){return function(e,t,i){return t in e?es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Qa(t))?t+"":t,i)},is=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Xa(t),n=e,!(r=Za()?Reflect.construct(t,i||[],Xa(e).constructor):t.apply(e,i))||"object"!==Qa(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),ts(e,"_learner_id",""),ts(e,"_learner_name",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$a(e,t)}(t,e),i=t,(n=[{key:"learner_id",get:function(){return this._learner_id},set:function(learner_id){if(this.initialized)throw new Q(this._cmi_element+".learner_id",re.READ_ONLY_ELEMENT);this._learner_id=learner_id}},{key:"learner_name",get:function(){return this._learner_name},set:function(learner_name){if(this.initialized)throw new Q(this._cmi_element+".learner_name",re.READ_ONLY_ELEMENT);this._learner_name=learner_name}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function ns(e){return ns=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ns(e)}function rs(e,t){return rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rs(e,t)}function os(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function as(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(as=function(){return!!result})()}var ss=Object.defineProperty,ls=function(e,t,i){return function(e,t,i){return t in e?ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":os(t))?t+"":t,i)},cs=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=ns(t),n=e,!(r=as()?Reflect.construct(t,i||[],ns(e).constructor):t.apply(e,i))||"object"!==os(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),ls(e,"_completion_status","unknown"),ls(e,"_success_status","unknown"),ls(e,"_progress_measure",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rs(e,t)}(t,e),i=t,(n=[{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){Xi(this._cmi_element+".completion_status",completion_status,qe)&&(this._completion_status=completion_status)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){Xi(this._cmi_element+".success_status",success_status,De)&&(this._success_status=success_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){Xi(this._cmi_element+".progress_measure",progress_measure,Ie)&&$i(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"reset",value:function(){this._initialized=!1,this._completion_status="unknown",this._success_status="unknown",this._progress_measure=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function us(e){return us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},us(e)}function ds(e,t){return ds=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ds(e,t)}function vs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function fs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fs=function(){return!!result})()}var hs=Object.defineProperty,ms=function(e,t,i){return function(e,t,i){return t in e?hs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":vs(t))?t+"":t,i)},ps=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=us(t),n=e,!(r=fs()?Reflect.construct(t,i||[],us(e).constructor):t.apply(e,i))||"object"!==vs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),ms(e,"_entry",""),ms(e,"_exit",""),ms(e,"_session_time","PT0H0M0S"),ms(e,"_total_time","PT0S"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ds(e,t)}(t,e),i=t,(n=[{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new Q(this._cmi_element+".entry",re.READ_ONLY_ELEMENT);this._entry=entry}},{key:"exit",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".exit",re.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"logout"===exit&&console.warn('SCORM 2004: cmi.exit value "logout" is deprecated per 4th Edition. Consider using "normal" or "suspend" instead.'),Xi(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|normal)$",!0)&&(this._exit=exit)}},{key:"getExitValueInternal",value:function(){return this._exit}},{key:"session_time",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".session_time",re.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){Xi(this._cmi_element+".session_time",session_time,xe)&&(this._session_time=session_time)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new Q(this._cmi_element+".total_time",re.READ_ONLY_ELEMENT);this._total_time=total_time}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;return void 0!==e&&(r=o(((new Date).getTime()-e)/1e3)),t=this._total_time,i=r,n=RegExp(xe),o(a(t,n)+a(i,n))}},{key:"reset",value:function(){this._initialized=!1,this._entry="ab-initio",this._exit="",this._session_time="PT0H0M0S"}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function ys(e){return ys=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ys(e)}function gs(e,t){return gs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},gs(e,t)}function bs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _s(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_s=function(){return!!result})()}var Ss=Object.defineProperty,ws=function(e,t,i){return function(e,t,i){return t in e?Ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":bs(t))?t+"":t,i)},Cs=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=ys(t),n=e,!(r=_s()?Reflect.construct(t,i||[],ys(e).constructor):t.apply(e,i))||"object"!==bs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),ws(e,"_location",""),ws(e,"_launch_data",""),ws(e,"_suspend_data",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gs(e,t)}(t,e),i=t,(n=[{key:"location",get:function(){return this._location},set:function(location){Xi(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,1000}$")&&(this._location=location)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new Q(this._cmi_element+".launch_data",re.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){Xi(this._cmi_element+".suspend_data",suspend_data,ke,!0)&&(this._suspend_data=suspend_data)}},{key:"reset",value:function(){this._initialized=!1,this._location="",this._suspend_data=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Os(e){return Os=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Os(e)}function As(e,t){return As=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},As(e,t)}function Es(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ks(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ks=function(){return!!result})()}var js=Object.defineProperty,Rs=function(e,t,i){return function(e,t,i){return t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Es(t))?t+"":t,i)},Ms=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Os(t),n=e,!(r=ks()?Reflect.construct(t,i||[],Os(e).constructor):t.apply(e,i))||"object"!==Es(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Rs(e,"_credit","credit"),Rs(e,"_mode","normal"),Rs(e,"_time_limit_action","continue,no message"),Rs(e,"_max_time_allowed",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&As(e,t)}(t,e),i=t,(n=[{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new Q(this._cmi_element+".credit",re.READ_ONLY_ELEMENT);if(!/^(credit|no-credit)$/.test(credit))throw new Q(this._cmi_element+".credit",re.TYPE_MISMATCH);this._credit=credit}},{key:"mode",get:function(){return this._mode},set:function(mode){if(this.initialized)throw new Q(this._cmi_element+".mode",re.READ_ONLY_ELEMENT);if(!/^(browse|normal|review)$/.test(mode))throw new Q(this._cmi_element+".mode",re.TYPE_MISMATCH);this._mode=mode}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(this.initialized)throw new Q(this._cmi_element+".time_limit_action",re.READ_ONLY_ELEMENT);if(!/^(exit,message|exit,no message|continue,message|continue,no message)$/.test(time_limit_action))throw new Q(this._cmi_element+".time_limit_action",re.TYPE_MISMATCH);this._time_limit_action=time_limit_action}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(this.initialized)throw new Q(this._cmi_element+".max_time_allowed",re.READ_ONLY_ELEMENT);if(""!==max_time_allowed){if(!RegExp(xe).test(max_time_allowed))throw new Q(this._cmi_element+".max_time_allowed",re.TYPE_MISMATCH);this._max_time_allowed=max_time_allowed}else this._max_time_allowed=max_time_allowed}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Ts(e){return Ts=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ts(e)}function xs(e,t){return xs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xs(e,t)}function Is(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ps(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ps=function(){return!!result})()}var Ns=Object.defineProperty,qs=function(e,t,i){return function(e,t,i){return t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Is(t))?t+"":t,i)},Ds=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ts(t),n=e,!(r=Ps()?Reflect.construct(t,i||[],Ts(e).constructor):t.apply(e,i))||"object"!==Is(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),qs(e,"_scaled_passing_score",""),qs(e,"_completion_threshold",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xs(e,t)}(t,e),i=t,(n=[{key:"scaled_passing_score",get:function(){return this._scaled_passing_score},set:function(scaled_passing_score){var e;if(this.initialized)throw new Q(this._cmi_element+".scaled_passing_score",null!==(e=re.READ_ONLY_ELEMENT)&&void 0!==e?e:404);if(""!==scaled_passing_score){var t;if(!RegExp(Ie).test(scaled_passing_score))throw new Q(this._cmi_element+".scaled_passing_score",null!==(t=re.TYPE_MISMATCH)&&void 0!==t?t:406);var i,n=parseFloat(scaled_passing_score);if(-1>n||n>1)throw new Q(this._cmi_element+".scaled_passing_score",null!==(i=re.VALUE_OUT_OF_RANGE)&&void 0!==i?i:407);this._scaled_passing_score=scaled_passing_score}else this._scaled_passing_score=scaled_passing_score}},{key:"completion_threshold",get:function(){return this._completion_threshold},set:function(e){var t;if(this.initialized)throw new Q(this._cmi_element+".completion_threshold",null!==(t=re.READ_ONLY_ELEMENT)&&void 0!==t?t:404);if(""!==e){var i;if(!RegExp(Ie).test(e))throw new Q(this._cmi_element+".completion_threshold",null!==(i=re.TYPE_MISMATCH)&&void 0!==i?i:406);var n,r=parseFloat(e);if(0>r||r>1)throw new Q(this._cmi_element+".completion_threshold",null!==(n=re.VALUE_OUT_OF_RANGE)&&void 0!==n?n:407);this._completion_threshold=e}else this._completion_threshold=e}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Ls(e,t,i){return Ls="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=zs(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ls(e,t,i||e)}function zs(e){return zs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zs(e)}function Fs(e,t){return Fs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fs(e,t)}function Bs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Vs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Vs=function(){return!!result})()}var Hs=Object.defineProperty,Us=function(e,t,i){return function(e,t,i){return t in e?Hs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Bs(t))?t+"":t,i)},Gs=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=zs(t),n=e,!(r=Vs()?Reflect.construct(t,i||[],zs(e).constructor):t.apply(e,i))||"object"!==Bs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Us(e,"metadata"),Us(e,"learner"),Us(e,"status"),Us(e,"session"),Us(e,"content"),Us(e,"settings"),Us(e,"thresholds"),Us(e,"learner_preference"),Us(e,"score"),Us(e,"comments_from_learner"),Us(e,"comments_from_lms"),Us(e,"interactions"),Us(e,"objectives"),e.metadata=new Ja,e.learner=new is,e.status=new cs,e.session=new ps,e.content=new Cs,e.settings=new Ms,e.thresholds=new Ds,e.learner_preference=new Po,e.score=new ya,e.comments_from_learner=new ja,e.comments_from_lms=new ka,e.interactions=new Qo,e.objectives=new Ba,i&&e.initialize(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fs(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e,i,n,r,o,a,s,l,c,u,d,v,f;Ls(zs(t.prototype),"initialize",this).call(this),null===(e=this.metadata)||void 0===e||e.initialize(),null===(i=this.learner)||void 0===i||i.initialize(),null===(n=this.status)||void 0===n||n.initialize(),null===(r=this.session)||void 0===r||r.initialize(),null===(o=this.content)||void 0===o||o.initialize(),null===(a=this.settings)||void 0===a||a.initialize(),null===(s=this.thresholds)||void 0===s||s.initialize(),null===(l=this.learner_preference)||void 0===l||l.initialize(),null===(c=this.score)||void 0===c||c.initialize(),null===(u=this.comments_from_learner)||void 0===u||u.initialize(),null===(d=this.comments_from_lms)||void 0===d||d.initialize(),null===(v=this.interactions)||void 0===v||v.initialize(),null===(f=this.objectives)||void 0===f||f.initialize()}},{key:"reset",value:function(){var e,t,i,n,r,o,a,s,l,c,u,d,v;this._initialized=!1,this._start_time=void 0,null===(e=this.metadata)||void 0===e||e.reset(),null===(t=this.learner)||void 0===t||t.reset(),null===(i=this.status)||void 0===i||i.reset(),null===(n=this.session)||void 0===n||n.reset(),null===(r=this.content)||void 0===r||r.reset(),null===(o=this.settings)||void 0===o||o.reset(),null===(a=this.thresholds)||void 0===a||a.reset(),null===(s=this.objectives)||void 0===s||s.reset(!0),null===(l=this.interactions)||void 0===l||l.reset(!0),null===(c=this.score)||void 0===c||c.reset(),null===(u=this.comments_from_learner)||void 0===u||u.reset(),null===(d=this.comments_from_lms)||void 0===d||d.reset(),null===(v=this.learner_preference)||void 0===v||v.reset()}},{key:"_version",get:function(){return this.metadata._version},set:function(_version){this.metadata._version=_version}},{key:"_children",get:function(){return this.metadata._children},set:function(_children){this.metadata._children=_children}},{key:"completion_status",get:function(){return this.status.completion_status},set:function(completion_status){this.status.completion_status=completion_status}},{key:"completion_threshold",get:function(){return this.thresholds.completion_threshold},set:function(e){this.thresholds.completion_threshold=e}},{key:"credit",get:function(){return this.settings.credit},set:function(credit){this.settings.credit=credit}},{key:"entry",get:function(){return this.session.entry},set:function(entry){this.session.entry=entry}},{key:"exit",get:function(){return this.session.jsonString=this.jsonString,this.session.exit},set:function(exit){this.session.exit=exit}},{key:"getExitValueInternal",value:function(){return this.session.getExitValueInternal()}},{key:"launch_data",get:function(){return this.content.launch_data},set:function(launch_data){this.content.launch_data=launch_data}},{key:"learner_id",get:function(){return this.learner.learner_id},set:function(learner_id){this.learner.learner_id=learner_id}},{key:"learner_name",get:function(){return this.learner.learner_name},set:function(learner_name){this.learner.learner_name=learner_name}},{key:"location",get:function(){return this.content.location},set:function(location){this.content.location=location}},{key:"max_time_allowed",get:function(){return this.settings.max_time_allowed},set:function(max_time_allowed){this.settings.max_time_allowed=max_time_allowed}},{key:"mode",get:function(){return this.settings.mode},set:function(mode){this.settings.mode=mode}},{key:"progress_measure",get:function(){return this.status.progress_measure},set:function(progress_measure){this.status.progress_measure=progress_measure}},{key:"scaled_passing_score",get:function(){return this.thresholds.scaled_passing_score},set:function(scaled_passing_score){this.thresholds.scaled_passing_score=scaled_passing_score}},{key:"session_time",get:function(){return this.session.jsonString=this.jsonString,this.session.session_time},set:function(session_time){this.session.session_time=session_time}},{key:"success_status",get:function(){return this.status.success_status},set:function(success_status){this.status.success_status=success_status}},{key:"suspend_data",get:function(){return this.content.suspend_data},set:function(suspend_data){this.content.suspend_data=suspend_data}},{key:"time_limit_action",get:function(){return this.settings.time_limit_action},set:function(time_limit_action){this.settings.time_limit_action=time_limit_action}},{key:"total_time",get:function(){return this.session.total_time},set:function(total_time){this.session.total_time=total_time}},{key:"getCurrentTotalTime",value:function(){return this.session.getCurrentTotalTime(this.start_time)}},{key:"toJSON",value:function(){this.jsonString=!0,this.session.jsonString=!0;var result={comments_from_learner:this.comments_from_learner,comments_from_lms:this.comments_from_lms,completion_status:this.completion_status,completion_threshold:this.completion_threshold,credit:this.credit,entry:this.entry,exit:this.exit,interactions:this.interactions,launch_data:this.launch_data,learner_id:this.learner_id,learner_name:this.learner_name,learner_preference:this.learner_preference,location:this.location,max_time_allowed:this.max_time_allowed,mode:this.mode,objectives:this.objectives,progress_measure:this.progress_measure,scaled_passing_score:this.scaled_passing_score,score:this.score,session_time:this.session_time,success_status:this.success_status,suspend_data:this.suspend_data,time_limit_action:this.time_limit_action,total_time:this.total_time};return this.jsonString=!1,this.session.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(S);function Ks(e,t,i){return t=$s(t),n=e,!(r=il()?Reflect.construct(t,i||[],$s(e).constructor):t.apply(e,i))||"object"!==tl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Ys(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ws(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Js(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Xs(e,t,i){return Xs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=$s(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Xs(e,t,i||e)}function $s(e){return $s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$s(e)}function Qs(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&el(e,t)}function Zs(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Js(e,t,i[t])})}return e}function el(e,t){return el=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},el(e,t)}function tl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function il(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(il=function(){return!!result})()}var nl=Object.defineProperty,rl=function(e,t,i){return function(e,t,i){return t in e?nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":tl(t))?t+"":t,i)},ol=function(e){function t(){var e;return Ys(this,t),e=Ks(this,t,["adl"]),rl(e,"nav"),rl(e,"data",new sl),rl(e,"_sequencing",null),e.nav=new al,e.data=new sl,e}return Qs(t,e),Ws(t,[{key:"initialize",value:function(){var e;Xs($s(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,null===(e=this.nav)||void 0===e||e.reset()}},{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e,e&&(e.adlNav=this.nav,this.nav.sequencing=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={nav:this.nav,data:this.data};return this.jsonString=!1,result}}]),t}(_),al=function(e){function t(){var e;return Ys(this,t),e=Ks(this,t,["adl.nav"]),rl(e,"_request","_none_"),rl(e,"_sequencing",null),rl(e,"request_valid"),e.request_valid=new dl,e.request_valid.setParentNav(e),e}return Qs(t,e),Ws(t,[{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e}},{key:"initialize",value:function(){var e;Xs($s(t.prototype),"initialize",this).call(this),null===(e=this.request_valid)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._request="_none_",this._sequencing&&(this._sequencing.adlNav=null),this._sequencing=null,null===(e=this.request_valid)||void 0===e||e.reset()}},{key:"request",get:function(){return this._request},set:function(request){Xi(this._cmi_element+".request",request,Le)&&(this._request=request)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={request:this.request};return this.jsonString=!1,result}}]),t}(_),sl=function(e){function t(){return Ys(this,t),Ks(this,t,[{CMIElement:"adl.data",children:L.adl_data_children,errorCode:re.READ_ONLY_ELEMENT,errorClass:Q}])}return Qs(t,e),t}(de),ll=function(e){function t(){var e;return Ys(this,t),e=Ks(this,t,["adl.data.n"]),rl(e,"_id",""),rl(e,"_store",""),rl(e,"_idIsSet",!1),rl(e,"_storeIsSet",!1),e}return Qs(t,e),Ws(t,[{key:"reset",value:function(){this._initialized=!1,this._idIsSet=!1,this._storeIsSet=!1}},{key:"id",get:function(){return this._id},set:function(id){if(this.initialized)throw new Q(this._cmi_element+".id",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".id",id,Ne)&&(this._id=id,this._idIsSet=!0)}},{key:"store",get:function(){if(this.initialized&&!this._storeIsSet)throw new Q(this._cmi_element+".store",re.VALUE_NOT_INITIALIZED);return this._store},set:function(e){if(this.initialized&&!this._idIsSet)throw new Q(this._cmi_element+".store",re.DEPENDENCY_NOT_ESTABLISHED);Xi(this._cmi_element+".store",e,ke)&&(this._store=e,this._storeIsSet=!0)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,store:this._store};return this.jsonString=!1,result}}]),t}(_),cl=function(){function e(){Ys(this,e),rl(this,"_parentNav",null),rl(this,"_staticValues",{})}return Ws(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.overallSequencingProcess){var n=this._parentNav.sequencing.overallSequencingProcess;if(n.predictChoiceEnabled)return n.predictChoiceEnabled(e)?"true":"false"}var r=this._staticValues[e];return r===fe?"true":r===he?"false":"unknown"}},{key:"getAll",value:function(){return Zs({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=Zs({},e)}}]),e}(),ul=function(){function e(){Ys(this,e),rl(this,"_parentNav",null),rl(this,"_staticValues",{})}return Ws(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.activityTree)return this._parentNav.sequencing.activityTree.getActivity(e)?"true":"false";var n=this._staticValues[e];return n===fe?"true":n===he?"false":"unknown"}},{key:"getAll",value:function(){return Zs({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=Zs({},e)}}]),e}(),dl=function(e){function t(){var e;return Ys(this,t),e=Ks(this,t,["adl.nav.request_valid"]),rl(e,"_continue","unknown"),rl(e,"_previous","unknown"),rl(e,"_choice"),rl(e,"_jump"),rl(e,"_exit","unknown"),rl(e,"_exitAll","unknown"),rl(e,"_abandon","unknown"),rl(e,"_abandonAll","unknown"),rl(e,"_suspendAll","unknown"),rl(e,"_parentNav",null),e._choice=new cl,e._jump=new ul,e}return Qs(t,e),Ws(t,[{key:"setParentNav",value:function(nav){this._parentNav=nav,this._choice.setParentNav(nav),this._jump.setParentNav(nav)}},{key:"reset",value:function(){this._initialized=!1,this._continue="unknown",this._previous="unknown",this._choice.setAll({}),this._jump.setAll({}),this._exit="unknown",this._exitAll="unknown",this._abandon="unknown",this._abandonAll="unknown",this._suspendAll="unknown"}},{key:"continue",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictContinueEnabled)return i.predictContinueEnabled()?"true":"false"}return this._continue},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".continue",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".continue",e,ze)&&(this._continue=e)}},{key:"previous",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictPreviousEnabled)return i.predictPreviousEnabled()?"true":"false"}return this._previous},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".previous",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".previous",e,ze)&&(this._previous=e)}},{key:"choice",get:function(){return this._choice},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".choice",re.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":tl(e)))throw new Q(this._cmi_element+".choice",re.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&Xi(this._cmi_element+".choice."+i,e[i]||"",ze)&&Xi(this._cmi_element+".choice."+i,i,Fe)){var n=e[i];"true"===n?t[i]=fe:"false"===n?t[i]=he:"unknown"===n&&(t[i]=ve)}this._choice.setAll(t)}},{key:"jump",get:function(){return this._jump},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".jump",re.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":tl(e)))throw new Q(this._cmi_element+".jump",re.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&Xi(this._cmi_element+".jump."+i,e[i]||"",ze)&&Xi(this._cmi_element+".jump."+i,i,Fe)){var n=e[i];"true"===n?t[i]=fe:"false"===n?t[i]=he:"unknown"===n&&(t[i]=ve)}this._jump.setAll(t)}},{key:"exit",get:function(){return this._exit},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".exit",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".exit",e,ze)&&(this._exit=e)}},{key:"exitAll",get:function(){return this._exitAll},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".exitAll",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".exitAll",e,ze)&&(this._exitAll=e)}},{key:"abandon",get:function(){return this._abandon},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".abandon",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".abandon",e,ze)&&(this._abandon=e)}},{key:"abandonAll",get:function(){return this._abandonAll},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".abandonAll",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".abandonAll",e,ze)&&(this._abandonAll=e)}},{key:"suspendAll",get:function(){return this._suspendAll},set:function(e){if(this.initialized)throw new Q(this._cmi_element+".suspendAll",re.READ_ONLY_ELEMENT);Xi(this._cmi_element+".suspendAll",e,ze)&&(this._suspendAll=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={previous:this.previous,continue:this.continue,choice:this._choice.getAll(),jump:this._jump.getAll(),exit:this.exit,exitAll:this.exitAll,abandon:this.abandon,abandonAll:this.abandonAll,suspendAll:this.suspendAll};return this.jsonString=!1,result}}]),t}(_);function vl(e,t,i){return vl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=fl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},vl(e,t,i||e)}function fl(e){return fl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fl(e)}function hl(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ml(e,t){return ml=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ml(e,t)}function pl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function yl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(yl=function(){return!!result})()}var gl=Object.defineProperty,bl=function(e,t,i){return function(e,t,i){return t in e?gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":pl(t))?t+"":t,i)},_l=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=fl(t),n=e,!(r=yl()?Reflect.construct(t,i||[],fl(e).constructor):t.apply(e,i))||"object"!==pl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activityTree"]),bl(i,"_root",null),bl(i,"_currentActivity",null),bl(i,"_suspendedActivity",null),bl(i,"_activities",new Map),e&&(i.root=e),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ml(e,t)}(t,e),i=t,n=[{key:"initialize",value:function(){vl(fl(t.prototype),"initialize",this).call(this),this._root&&this._root.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._currentActivity=null,this._suspendedActivity=null,this._activities.clear(),this._root&&(this._root.reset(),this._activities.set(this._root.id,this._root),this._addActivitiesToMap(this._root))}},{key:"root",get:function(){return this._root},set:function(e){if(null!==e&&!hl(e,Tn))throw new Q(this._cmi_element+".root",re.TYPE_MISMATCH);this._activities.clear(),this._root=e,e&&(this._activities.set(e.id,e),this._addActivitiesToMap(e))}},{key:"_addActivitiesToMap",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this._activities.set(a.id,a),this._addActivitiesToMap(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"currentActivity",get:function(){return this._currentActivity},set:function(e){if(null!==e&&!hl(e,Tn))throw new Q(this._cmi_element+".currentActivity",re.TYPE_MISMATCH);if(this._currentActivity){this._currentActivity.isActive=!1;for(var t=this._currentActivity.parent;t;)t.isActive=!1,t=t.parent}if(this._currentActivity=e,e){e.isActive=!0;for(var i=e.parent;i;)i.isActive=!0,i=i.parent}}},{key:"setCurrentActivityWithoutActivation",value:function(e){if(null!==e&&!hl(e,Tn))throw new Q(this._cmi_element+".currentActivity",re.TYPE_MISMATCH);if(this._currentActivity){var t=new Set;if(e){t.add(e);for(var i=e.parent;i;)t.add(i),i=i.parent}this._currentActivity.isActive=!1;for(var n=this._currentActivity.parent;n;)t.has(n)||(n.isActive=!1),n=n.parent}this._currentActivity=e}},{key:"suspendedActivity",get:function(){return this._suspendedActivity},set:function(e){if(null!==e&&!hl(e,Tn))throw new Q(this._cmi_element+".suspendedActivity",re.TYPE_MISMATCH);if(this._suspendedActivity){this._suspendedActivity.isSuspended=!1;for(var t=this._suspendedActivity.parent;t;)t.isSuspended=!1,t=t.parent}if(this._suspendedActivity=e,e){e.isSuspended=!0;for(var i=e.parent;i;)i.isSuspended=!0,i=i.parent}}},{key:"getActivity",value:function(id){return this._activities.get(id)||null}},{key:"getAllActivities",value:function(){return Array.from(this._activities.values())}},{key:"getParent",value:function(e){return e.parent}},{key:"getChildren",value:function(e){return 1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children}},{key:"getSiblings",value:function(e){return e.parent?e.parent.children.filter(function(t){return t!==e}):[]}},{key:"getNextSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),-1===r||r===n.length-1?null:null!==(t=n[r+1])&&void 0!==t?t:null}},{key:"getPreviousSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),r>0&&null!==(t=n[r-1])&&void 0!==t?t:null}},{key:"getFirstChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[0])&&void 0!==t?t:null}},{key:"getLastChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[i.length-1])&&void 0!==t?t:null}},{key:"getCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.unshift(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={root:this._root,currentActivity:this._currentActivity?this._currentActivity.id:null,suspendedActivity:this._suspendedActivity?this._suspendedActivity.id:null};return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);function Sl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function wl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Cl(e,t,i){return Cl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ol(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Cl(e,t,i||e)}function Ol(e){return Ol=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ol(e)}function Al(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function El(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){wl(e,t,i[t])})}return e}function kl(e,t){return kl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},kl(e,t)}function jl(e){return function(e){if(Array.isArray(e))return Sl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Sl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Sl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ml(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ml=function(){return!!result})()}var Tl=Object.defineProperty,xl=function(e,t,i){return function(e,t,i){return t in e?Tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Rl(t))?t+"":t,i)},Il=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ol(t),n=e,!(r=Ml()?Reflect.construct(t,i||[],Ol(e).constructor):t.apply(e,i))||"object"!==Rl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencing"]),xl(e,"_activityTree"),xl(e,"_sequencingRules"),xl(e,"_sequencingControls"),xl(e,"_rollupRules"),xl(e,"_adlNav",null),xl(e,"_hideLmsUi",[]),xl(e,"_auxiliaryResources",[]),xl(e,"_overallSequencingProcess",null),e._activityTree=new _l,e._sequencingRules=new ht,e._sequencingControls=new Ft,e._rollupRules=new mn,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&kl(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){Cl(Ol(t.prototype),"initialize",this).call(this),this._activityTree.initialize(),this._sequencingRules.initialize(),this._sequencingControls.initialize(),this._rollupRules.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._activityTree.reset(),this._sequencingRules.reset(),this._sequencingControls.reset(),this._rollupRules.reset(),this._hideLmsUi=[],this._auxiliaryResources=[]}},{key:"activityTree",get:function(){return this._activityTree},set:function(e){if(!Al(e,_l))throw new Q(this._cmi_element+".activityTree",re.TYPE_MISMATCH);this._activityTree=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){if(!Al(e,ht))throw new Q(this._cmi_element+".sequencingRules",re.TYPE_MISMATCH);this._sequencingRules=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){if(!Al(e,Ft))throw new Q(this._cmi_element+".sequencingControls",re.TYPE_MISMATCH);this._sequencingControls=e}},{key:"hideLmsUi",get:function(){return jl(this._hideLmsUi)},set:function(e){this._hideLmsUi=jl(e)}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return El({},e)})},set:function(e){this._auxiliaryResources=e.map(function(e){return El({},e)})}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){if(!Al(e,mn))throw new Q(this._cmi_element+".rollupRules",re.TYPE_MISMATCH);this._rollupRules=e}},{key:"adlNav",get:function(){return this._adlNav},set:function(e){this._adlNav=e}},{key:"overallSequencingProcess",get:function(){return this._overallSequencingProcess},set:function(e){this._overallSequencingProcess=e}},{key:"processRollup",value:function(){var e=this._activityTree.root;e&&this._processRollupRecursive(e)}},{key:"_processRollupRecursive",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this._processRollupRecursive(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this._rollupRules.processRollup(e)}},{key:"getCurrentActivity",value:function(){return this._activityTree.currentActivity}},{key:"getRootActivity",value:function(){return this._activityTree.root}},{key:"toJSON",value:function(){this.jsonString=!0;var result={activityTree:this._activityTree,sequencingRules:this._sequencingRules,sequencingControls:this._sequencingControls,rollupRules:this._rollupRules,adlNav:this._adlNav};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(_);var Pl=Object.defineProperty,Nl=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"checkValidResponseType",value:function(e,t,i,n){var r=[];(null==t?void 0:t.delimiter)?r=Do(i+"",t.delimiter):r[0]=i,r.length>0&&t.max>=r.length?this.context.checkCorrectResponseValue?this.context.checkCorrectResponseValue(e,n,r,i):this.checkCorrectResponseValue(e,n,r,i):r.length>t.max&&this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"Data Model Element Pattern Too Long: ".concat(i))}},{key:"checkDuplicateChoiceResponse",value:function(e,t,i){var n=t.correct_responses._count;if("choice"===t.type)for(var r=0;n>r&&"0"===this.context.getLastErrorCode();r++){var o=t.correct_responses.childArray[r];(null==o?void 0:o.pattern)===i&&this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"".concat(i))}}},{key:"validateCorrectResponse",value:function(e,t,i){var n=+e.split(".")[4];if(t){var r=t.correct_responses._count;this.checkDuplicateChoiceResponse(e,t,i);var o=Ue[t.type];o&&(void 0===o.limit||o.limit>r)?(this.checkValidResponseType(e,o,i,t.type),"0"===this.context.getLastErrorCode()&&(!o.duplicate||!this.checkDuplicatedPattern(t.correct_responses,n,i))||"0"===this.context.getLastErrorCode()&&""===i||"0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"Data Model Element Pattern Already Exists: ".concat(e," - ").concat(i))):this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e," - ").concat(i))}else this.context.throwSCORMError(e,re.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"checkDuplicatedPattern",value:function(e,t,i){for(var n=!1,r=e._count,o=0;r>o&&!n;o++)if(o!==t){var a=e.childArray[o];(null==a?void 0:a.pattern)===i&&(n=!0)}return n}},{key:"checkCorrectResponseValue",value:function(e,t,i,n){var r=Ue[t];if(r)for(var o=RegExp(r.format),a=0;i.length>a&&"0"===this.context.getLastErrorCode();a++)if(t.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")&&(i[a]=this.removeCorrectResponsePrefixes(e,i[a])),null==r?void 0:r.delimiter2){var s,l,c="performance"===t?Lo(i[a],r.delimiter2):Do(i[a],r.delimiter2);2===c.length?"performance"===t&&""===c[0]&&""===c[1]?this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n)):(null===(s=c[0])||void 0===s?void 0:s.match(o))&&r.format2&&(null===(l=c[1])||void 0===l?void 0:l.match(RegExp(r.format2)))||this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n)):this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else{if("numeric"===t&&i.length>1&&""===i[a]&&r.delimiter&&(n+"").includes(r.delimiter))continue;var u=i[a].match(o);if(!u&&""!==n||!u&&"true-false"===t)this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if("numeric"===t&&i.length>1)""!==i[0]&&""!==i[1]&&+i[0]>+i[1]&&this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if(""!==i[a]&&r.unique)for(var d=0;a>d&&"0"===this.context.getLastErrorCode();d++)i[a]===i[d]&&this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else this.context.throwSCORMError(e,re.TYPE_MISMATCH,"Incorrect Response Type: ".concat(t))}},{key:"removeCorrectResponsePrefixes",value:function(e,t){for(var i,n=!1,r=!1,o=!1,a=RegExp("^({(lang|case_matters|order_matters)=([^}]+)})"),s=t.match(a);s;){var l;switch(s[2]){case"lang":if(i=t.match("^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$")){var c=i[3];void 0!==c&&c.length>0&&(Ke.includes(c.toLowerCase())||this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t)))}o=!0;break;case"case_matters":o||n||r||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t)),r=!0;break;case"order_matters":r||o||n||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,re.TYPE_MISMATCH,"".concat(t)),n=!0}s=(t=t.substring((null===(l=s[1])||void 0===l?void 0:l.length)||0)).match(a)}return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ql=Object.defineProperty,Dl=function(e,t,i){return function(e,t,i){return t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ll=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Dl(this,"context"),Dl(this,"responseValidator"),this.context=t,this.responseValidator=i}return t=e,(i=[{key:"getChildElement",value:function(e,t,i){if(c(e,"cmi\\.objectives\\.\\d+"))return new Va;if(i){if(c(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+"))return this.createCorrectResponsesObject(e,t);if(c(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+"))return new ea}else if(c(e,"cmi\\.interactions\\.\\d+"))return new Zo;return c(e,"cmi\\.comments_from_learner\\.\\d+")?new Ra:c(e,"cmi\\.comments_from_lms\\.\\d+")?new Ra(!0):c(e,"adl\\.data\\.\\d+")?new ll:null}},{key:"createCorrectResponsesObject",value:function(e,t){var i=e.split("."),n=this.context.cmi.interactions.childArray[+i[2]];if(this.context.isInitialized()){if(void 0===n||!n.type)return this.context.throwSCORMError(e,re.DEPENDENCY_NOT_ESTABLISHED,e),null;var r=Ue[n.type];if(r&&void 0!==r.limit&&n.correct_responses._count>=r.limit)return this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e)),null;if(this.responseValidator.checkDuplicateChoiceResponse(e,n,t),!r)return this.context.throwSCORMError(e,re.GENERAL_SET_FAILURE,"Incorrect Response Type: ".concat(n.type)),null;this.responseValidator.checkValidResponseType(e,r,t,n.type)}return"0"===this.context.getLastErrorCode()?new na(null==n?void 0:n.type):null}},{key:"evaluateCompletionStatus",value:function(){return ar({completionThreshold:this.context.cmi.completion_threshold,progressMeasure:this.context.cmi.progress_measure,storedCompletionStatus:this.context.cmi.completion_status})}},{key:"evaluateSuccessStatus",value:function(){var e=this.context.cmi.scaled_passing_score,t=this.context.cmi.score.scaled,i=this.context.cmi.success_status;if(""!==e&&null!=e){var n=parseFloat(e+"");if(!isNaN(n)){if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r))return n>r?pe:me}return ye}}return i||ye}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Fl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Bl(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Fl(e,t,i[t])})}return e}function Vl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||Ul(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hl(e){return function(e){if(Array.isArray(e))return zl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ul(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ul(e,t){if(e){if("string"==typeof e)return zl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?zl(e,t):void 0}}var Gl=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"applySequencingControlsSettings",value:function(e,t){void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.choice&&(e.choice=t.choice),void 0!==t.choiceExit&&(e.choiceExit=t.choiceExit),void 0!==t.flow&&(e.flow=t.flow),void 0!==t.forwardOnly&&(e.forwardOnly=t.forwardOnly),void 0!==t.useCurrentAttemptObjectiveInfo&&(e.useCurrentAttemptObjectiveInfo=t.useCurrentAttemptObjectiveInfo),void 0!==t.useCurrentAttemptProgressInfo&&(e.useCurrentAttemptProgressInfo=t.useCurrentAttemptProgressInfo),void 0!==t.preventActivation&&(e.preventActivation=t.preventActivation),void 0!==t.constrainChoice&&(e.constrainChoice=t.constrainChoice),void 0!==t.stopForwardTraversal&&(e.stopForwardTraversal=t.stopForwardTraversal),void 0!==t.rollupObjectiveSatisfied&&(e.rollupObjectiveSatisfied=t.rollupObjectiveSatisfied),void 0!==t.rollupProgressCompletion&&(e.rollupProgressCompletion=t.rollupProgressCompletion),void 0!==t.objectiveMeasureWeight&&(e.objectiveMeasureWeight=t.objectiveMeasureWeight),void 0!==t.selectionTiming&&(e.selectionTiming=t.selectionTiming),void 0!==t.selectCount&&(e.selectCount=t.selectCount),void 0!==t.randomizeChildren&&(e.randomizeChildren=t.randomizeChildren),void 0!==t.randomizationTiming&&(e.randomizationTiming=t.randomizationTiming),void 0!==t.selectionCountStatus&&(e.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(e.reorderChildren=t.reorderChildren),void 0!==t.completionSetByContent&&(e.completionSetByContent=t.completionSetByContent),void 0!==t.objectiveSetByContent&&(e.objectiveSetByContent=t.objectiveSetByContent),void 0!==t.tracked&&(e.tracked=t.tracked)}},{key:"applySequencingRulesSettings",value:function(e,t){if(t){if(t.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createSequencingRule(o.value);e.addPreConditionRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(t.exitConditionRules){var l=!0,c=!1,u=void 0;try{for(var d,v=t.exitConditionRules[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=this.createSequencingRule(d.value);e.addExitConditionRule(f)}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}if(t.postConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=t.postConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=this.createSequencingRule(y.value);e.addPostConditionRule(b)}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}}}},{key:"createSequencingRule",value:function(e){var t=new ft(e.action,e.conditionCombination),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=new vt(s.condition,s.operator,new Map(Object.entries(s.parameters||{})));s.referencedObjective&&(l.referencedObjective=s.referencedObjective),t.addCondition(l)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"applyRollupRulesSettings",value:function(e,t){if(null==t?void 0:t.rules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.rules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createRollupRule(o.value);e.addRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"createRollupRule",value:function(e){var t=new hn(e.action,e.consideration,e.minimumCount,e.minimumPercent),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=new fn(s.condition,new Map(Object.entries(s.parameters||{})));t.addCondition(l)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"sanitizeSequencingCollections",value:function(e){if(!e)return{};var t={},i=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=Vl(o.value,2),l=s[1],c=s[0].trim();if(c){var u,d={};if(l.sequencingControls&&(d.sequencingControls=Bl({},l.sequencingControls)),l.sequencingRules){var v=function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return void 0!==e.operator&&(t.operator=e.operator),e.parameters&&(t.parameters=Bl({},e.parameters)),void 0!==e.referencedObjective&&(t.referencedObjective=e.referencedObjective),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),t};d.sequencingRules={},l.sequencingRules.preConditionRules&&(d.sequencingRules.preConditionRules=l.sequencingRules.preConditionRules.map(v)),l.sequencingRules.exitConditionRules&&(d.sequencingRules.exitConditionRules=l.sequencingRules.exitConditionRules.map(v)),l.sequencingRules.postConditionRules&&(d.sequencingRules.postConditionRules=l.sequencingRules.postConditionRules.map(v))}l.rollupRules&&(d.rollupRules={rules:null===(u=l.rollupRules.rules)||void 0===u?void 0:u.map(function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return e.parameters&&(t.parameters=Bl({},e.parameters)),t})};return void 0!==e.consideration&&(t.consideration=e.consideration),void 0!==e.minimumCount&&(t.minimumCount=e.minimumCount),void 0!==e.minimumPercent&&(t.minimumPercent=e.minimumPercent),t})}),l.rollupConsiderations&&(d.rollupConsiderations=Bl({},l.rollupConsiderations)),l.selectionRandomizationState&&(d.selectionRandomizationState=this.cloneSelectionRandomizationState(l.selectionRandomizationState)),l.hideLmsUi&&(d.hideLmsUi=this.sanitizeHideLmsUi(l.hideLmsUi)),l.auxiliaryResources&&(d.auxiliaryResources=this.sanitizeAuxiliaryResources(l.auxiliaryResources)),t[c]=d}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"normalizeCollectionRefs",value:function(e){if(!e)return[];var t=Array.isArray(e)?e:[e],i=new Set,result=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value.trim();l&&!i.has(l)&&(i.add(l),result.push(l))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return result}},{key:"applySequencingCollection",value:function(e,t,i){if(t){if(t.sequencingControls&&this.applySequencingControlsSettings(e.sequencingControls,t.sequencingControls),t.sequencingRules&&this.applySequencingRulesSettings(e.sequencingRules,t.sequencingRules),t.rollupRules&&this.applyRollupRulesSettings(e.rollupRules,t.rollupRules),t.rollupConsiderations&&e.applyRollupConsiderations(t.rollupConsiderations),t.hideLmsUi){var n=this.mergeHideLmsUi(e.hideLmsUi,t.hideLmsUi);n.length>0&&(e.hideLmsUi=n)}if(t.auxiliaryResources){var r=this.sanitizeAuxiliaryResources(t.auxiliaryResources);r.length>0&&(e.auxiliaryResources=this.mergeAuxiliaryResources(e.auxiliaryResources,r))}t.selectionRandomizationState&&i.push(this.cloneSelectionRandomizationState(t.selectionRandomizationState))}}},{key:"sanitizeHideLmsUi",value:function(e){if(!e)return[];var t=new Set($e),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return n}},{key:"mergeHideLmsUi",value:function(e,t){return t&&0!==t.length?this.sanitizeHideLmsUi(Hl(e).concat(Hl(t))):e}},{key:"sanitizeAuxiliaryResources",value:function(e){if(!e)return[];var t=new Set,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l&&l.resourceId&&"string"==typeof l.resourceId&&l.purpose&&"string"==typeof l.purpose){var c=l.resourceId.trim(),u=l.purpose.trim();if(c&&u){var d="".concat(c,"::").concat(u);t.has(d)||(t.add(d),i.push({resourceId:c,purpose:u}))}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"mergeAuxiliaryResources",value:function(e,t){var i=[],n=new Set,r=!0,o=!1,a=void 0;try{for(var s,l=Hl(null!=e?e:[]).concat(Hl(null!=t?t:[]))[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c){var u=c.resourceId;u&&!n.has(u)&&(n.add(u),i.push({resourceId:u,purpose:c.purpose}))}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return i}},{key:"cloneSelectionRandomizationState",value:function(e){var t={};return e.childOrder&&(t.childOrder=Hl(e.childOrder)),e.selectedChildIds&&(t.selectedChildIds=Hl(e.selectedChildIds)),e.hiddenFromChoiceChildIds&&(t.hiddenFromChoiceChildIds=Hl(e.hiddenFromChoiceChildIds)),void 0!==e.selectionCountStatus&&(t.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(t.reorderChildren=e.reorderChildren),t}},{key:"applySelectionRandomizationState",value:function(e,t){var i=e.sequencingControls;void 0!==t.selectionCountStatus&&(i.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(i.reorderChildren=t.reorderChildren);var n=t.selectedChildIds?new Set(t.selectedChildIds):null,r=t.hiddenFromChoiceChildIds?new Set(t.hiddenFromChoiceChildIds):null;t.childOrder&&t.childOrder.length>0&&e.setChildOrder(t.childOrder);var o=!1;if(n||r){var a=!0,s=!1,l=void 0;try{for(var c,u=e.children[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;if(n){var v=n.has(d.id);d.isAvailable=v,r||(d.isHiddenFromChoice=!v),o=!0}r&&(d.isHiddenFromChoice=r.has(d.id),o=!0)}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}(o||n||void 0!==t.selectionCountStatus||void 0!==t.reorderChildren||t.childOrder&&t.childOrder.length>0)&&e.setProcessedChildren(e.children.filter(function(e){return e.isAvailable}))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Kl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Yl(e){return function(e){if(Array.isArray(e))return Kl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Kl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Kl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Wl=Object.defineProperty,Jl=function(e,t,i){return function(e,t,i){return t in e?Wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xl=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Jl(this,"sequencingCollections"),Jl(this,"sequencingConfigBuilder"),this.sequencingCollections=t||{},this.sequencingConfigBuilder=i||new Gl}return t=e,(i=[{key:"setSequencingCollections",value:function(e){this.sequencingCollections=e}},{key:"createActivity",value:function(e){var t=new Tn(e.id,e.title),i=[],n=this.sequencingConfigBuilder.normalizeCollectionRefs(e.sequencingCollectionRefs),r=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=this.sequencingCollections[s.value];c&&this.sequencingConfigBuilder.applySequencingCollection(t,c,i)}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}if(void 0!==e.isVisible&&(t.isVisible=e.isVisible),void 0!==e.isActive&&(t.isActive=e.isActive),void 0!==e.isSuspended&&(t.isSuspended=e.isSuspended),void 0!==e.isCompleted&&(t.isCompleted=e.isCompleted),void 0!==e.isHiddenFromChoice&&(t.isHiddenFromChoice=e.isHiddenFromChoice),void 0!==e.isAvailable&&(t.isAvailable=e.isAvailable),void 0!==e.attemptLimit&&(t.attemptLimit=e.attemptLimit),void 0!==e.attemptAbsoluteDurationLimit&&(t.attemptAbsoluteDurationLimit=e.attemptAbsoluteDurationLimit),void 0!==e.activityAbsoluteDurationLimit&&(t.activityAbsoluteDurationLimit=e.activityAbsoluteDurationLimit),void 0!==e.timeLimitAction&&(t.timeLimitAction=e.timeLimitAction),void 0!==e.timeLimitDuration&&(t.timeLimitDuration=e.timeLimitDuration),void 0!==e.beginTimeLimit&&(t.beginTimeLimit=e.beginTimeLimit),void 0!==e.endTimeLimit&&(t.endTimeLimit=e.endTimeLimit),e.primaryObjective){var u=this.createActivityObjectiveFromSettings(e.primaryObjective,!0);t.primaryObjective=u,null!==u.minNormalizedMeasure&&(t.scaledPassingScore=u.minNormalizedMeasure)}if(e.objectives){var d=!0,v=!1,f=void 0;try{for(var h,m=e.objectives[Symbol.iterator]();!(d=(h=m.next()).done);d=!0){var p=h.value,y=!0===p.isPrimary,g=this.createActivityObjectiveFromSettings(p,y);y?t.primaryObjective=g:t.addObjective(g)}}catch(e){v=!0,f=e}finally{try{d||null==m.return||m.return()}finally{if(v)throw f}}}if(e.sequencingControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.sequencingControls),e.deliveryControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.deliveryControls),e.sequencingRules&&this.sequencingConfigBuilder.applySequencingRulesSettings(t.sequencingRules,e.sequencingRules),e.rollupRules&&this.sequencingConfigBuilder.applyRollupRulesSettings(t.rollupRules,e.rollupRules),e.rollupConsiderations&&t.applyRollupConsiderations(e.rollupConsiderations),e.completionThreshold){var b=e.completionThreshold;void 0!==b.completedByMeasure&&(t.completedByMeasure=b.completedByMeasure),void 0!==b.minProgressMeasure?(t.minProgressMeasure=b.minProgressMeasure,t.completionThreshold=""+b.minProgressMeasure):b.completedByMeasure&&(t.completionThreshold=""+t.minProgressMeasure),void 0!==b.progressWeight&&(t.progressWeight=b.progressWeight)}if(e.hideLmsUi){var _=this.sequencingConfigBuilder.mergeHideLmsUi(t.hideLmsUi,e.hideLmsUi);_.length>0&&(t.hideLmsUi=_)}if(e.auxiliaryResources){var S=this.sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources);S.length>0&&(t.auxiliaryResources=this.sequencingConfigBuilder.mergeAuxiliaryResources(t.auxiliaryResources,S))}if(e.children){var w=!0,C=!1,O=void 0;try{for(var A,E=e.children[Symbol.iterator]();!(w=(A=E.next()).done);w=!0){var k=this.createActivity(A.value);t.addChild(k)}}catch(e){C=!0,O=e}finally{try{w||null==E.return||E.return()}finally{if(C)throw O}}}e.selectionRandomizationState&&i.push(this.sequencingConfigBuilder.cloneSelectionRandomizationState(e.selectionRandomizationState));var j=!0,R=!1,M=void 0;try{for(var T,x=i[Symbol.iterator]();!(j=(T=x.next()).done);j=!0)this.sequencingConfigBuilder.applySelectionRandomizationState(t,T.value)}catch(e){R=!0,M=e}finally{try{j||null==x.return||x.return()}finally{if(R)throw M}}return t}},{key:"extractActivityIds",value:function(e){var t=[e.id],i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s;(s=t).push.apply(s,Yl(this.extractActivityIds(o.value)))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"createActivityObjectiveFromSettings",value:function(e,t){var i,n,r,o=(e.mapInfo||[]).map(function(e){var t,i,n,r,o,a,s,l,c,u,d,v,f,h,m;return{targetObjectiveID:e.targetObjectiveID,readSatisfiedStatus:null===(t=e.readSatisfiedStatus)||void 0===t||t,readNormalizedMeasure:null===(i=e.readNormalizedMeasure)||void 0===i||i,writeSatisfiedStatus:null!==(n=e.writeSatisfiedStatus)&&void 0!==n&&n,writeNormalizedMeasure:null!==(r=e.writeNormalizedMeasure)&&void 0!==r&&r,readCompletionStatus:null===(o=e.readCompletionStatus)||void 0===o||o,writeCompletionStatus:null!==(a=e.writeCompletionStatus)&&void 0!==a&&a,readProgressMeasure:null===(s=e.readProgressMeasure)||void 0===s||s,writeProgressMeasure:null!==(l=e.writeProgressMeasure)&&void 0!==l&&l,readRawScore:null===(c=e.readRawScore)||void 0===c||c,writeRawScore:null!==(u=e.writeRawScore)&&void 0!==u&&u,readMinScore:null===(d=e.readMinScore)||void 0===d||d,writeMinScore:null!==(v=e.writeMinScore)&&void 0!==v&&v,readMaxScore:null===(f=e.readMaxScore)||void 0===f||f,writeMaxScore:null!==(h=e.writeMaxScore)&&void 0!==h&&h,updateAttemptData:null!==(m=e.updateAttemptData)&&void 0!==m&&m}});return new Mn(e.objectiveID,{description:null!==(i=e.description)&&void 0!==i?i:null,satisfiedByMeasure:null!==(n=e.satisfiedByMeasure)&&void 0!==n&&n,minNormalizedMeasure:null!==(r=e.minNormalizedMeasure)&&void 0!==r?r:null,mapInfo:o,isPrimary:t})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function $l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Ql(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Zl(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Ql(e,t,i[t])})}return e}function ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $l(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ic=Object.defineProperty,nc=function(e,t,i){return function(e,t,i){return t in e?ic(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":tc(t))?t+"":t,i)},rc=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nc(this,"_globalObjectives",[]),nc(this,"context"),this.context=t}return t=e,(i=[{key:"globalObjectives",get:function(){return this._globalObjectives},set:function(objectives){this._globalObjectives=objectives}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"syncGlobalObjectiveIdsFromSequencing",value:function(){if(this.context.sequencingService){var e=this.context.sequencingService.getOverallSequencingProcess();if(e){var t=e.getGlobalObjectiveMap();if(t&&0!==t.size){var i=Array.from(t.keys()),n=this.context.getSettings(),r=Array.from(new Set((n.globalObjectiveIds||[]).concat(i)));n.globalObjectiveIds=r}}}}},{key:"restoreGlobalObjectivesToCMI",value:function(){if(0!==this._globalObjectives.length)for(var e=0;this._globalObjectives.length>e;e++){var t=this._globalObjectives[e];if(t&&t.id&&!this.context.cmi.objectives.findObjectiveById(t.id)){var i=this.context.cmi.objectives.childArray.length;this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".id"),t.id),t.success_status&&"unknown"!==t.success_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".success_status"),t.success_status),t.completion_status&&"unknown"!==t.completion_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".completion_status"),t.completion_status),""!==t.score.scaled&&null!==t.score.scaled&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.scaled"),t.score.scaled),""!==t.score.raw&&null!==t.score.raw&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.raw"),t.score.raw),""!==t.score.min&&null!==t.score.min&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.min"),t.score.min),""!==t.score.max&&null!==t.score.max&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.max"),t.score.max),""!==t.progress_measure&&null!==t.progress_measure&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".progress_measure"),t.progress_measure),""!==t.description&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".description"),t.description)}}}},{key:"updateGlobalObjectiveFromCMI",value:function(e,t){var i,n,r,o;if(e&&this.context.sequencingService){var a=this.context.sequencingService.getOverallSequencingProcess();if(a)if(a.getGlobalObjectiveMap().has(e)){var s={};t.success_status&&t.success_status!==ye&&(s.satisfiedStatus=t.success_status===me,s.satisfiedStatusKnown=!0);var l=this.parseObjectiveNumber(null===(i=t.score)||void 0===i?void 0:i.scaled);null!==l&&(s.normalizedMeasure=l,s.normalizedMeasureKnown=!0),void 0!==(null===(n=t.score)||void 0===n?void 0:n.raw)&&""!==t.score.raw&&(s.rawScore=t.score.raw,s.rawScoreKnown=!0),void 0!==(null===(r=t.score)||void 0===r?void 0:r.min)&&""!==t.score.min&&(s.minScore=t.score.min,s.minScoreKnown=!0),void 0!==(null===(o=t.score)||void 0===o?void 0:o.max)&&""!==t.score.max&&(s.maxScore=t.score.max,s.maxScoreKnown=!0);var c=this.parseObjectiveNumber(t.progress_measure);null!==c&&(s.progressMeasure=c,s.progressMeasureKnown=!0),t.completion_status&&t.completion_status!==_e&&(s.completionStatus=t.completion_status,s.completionStatusKnown=!0),0!==Object.keys(s).length&&a.updateGlobalObjective(e,s)}else{var u=this.buildObjectiveMapEntryFromCMI(t);a.updateGlobalObjective(e,u)}}}},{key:"buildObjectiveMapEntryFromCMI",value:function(e){var t,i,n,r,entry={id:e.id,satisfiedStatusKnown:!1,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasureKnown:!1,completionStatusKnown:!1,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!0,writeRawScore:!0,readMinScore:!0,writeMinScore:!0,readMaxScore:!0,writeMaxScore:!0};e.success_status&&e.success_status!==ye&&(entry.satisfiedStatus=e.success_status===me,entry.satisfiedStatusKnown=!0);var o=this.parseObjectiveNumber(null===(t=e.score)||void 0===t?void 0:t.scaled);null!==o&&(entry.normalizedMeasure=o,entry.normalizedMeasureKnown=!0),void 0!==(null===(i=e.score)||void 0===i?void 0:i.raw)&&""!==e.score.raw&&(entry.rawScore=e.score.raw,entry.rawScoreKnown=!0),void 0!==(null===(n=e.score)||void 0===n?void 0:n.min)&&""!==e.score.min&&(entry.minScore=e.score.min,entry.minScoreKnown=!0),void 0!==(null===(r=e.score)||void 0===r?void 0:r.max)&&""!==e.score.max&&(entry.maxScore=e.score.max,entry.maxScoreKnown=!0);var a=this.parseObjectiveNumber(e.progress_measure);return null!==a&&(entry.progressMeasure=a,entry.progressMeasureKnown=!0),e.completion_status&&e.completion_status!==_e&&(entry.completionStatus=e.completion_status,entry.completionStatusKnown=!0),entry}},{key:"buildCMIObjectivesFromMap",value:function(e){var objectives=[];if(!e||"object"!==(void 0===e?"undefined":tc(e)))return objectives;var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a,s=ec(r.value,2),l=s[0],entry=s[1];if(entry&&"object"===(void 0===entry?"undefined":tc(entry))){var c=new Va;c.id=null!==(a=entry.id)&&void 0!==a?a:l,!0===entry.satisfiedStatusKnown&&(c.success_status=entry.satisfiedStatus?me:pe);var u,d,v,f=this.parseObjectiveNumber(entry.normalizedMeasure);!0===entry.normalizedMeasureKnown&&null!==f&&(c.score.scaled=f+""),!0===entry.rawScoreKnown&&(c.score.raw=(null!==(u=entry.rawScore)&&void 0!==u?u:"")+""),!0===entry.minScoreKnown&&(c.score.min=(null!==(d=entry.minScore)&&void 0!==d?d:"")+""),!0===entry.maxScoreKnown&&(c.score.max=(null!==(v=entry.maxScore)&&void 0!==v?v:"")+"");var h=this.parseObjectiveNumber(entry.progressMeasure);!0===entry.progressMeasureKnown&&null!==h&&(c.progress_measure=h+""),!0===entry.completionStatusKnown&&"string"==typeof entry.completionStatus&&(c.completion_status=entry.completionStatus),objectives.push(c)}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return objectives}},{key:"buildCMIObjectiveFromJSON",value:function(e){var t=new Va;if(!e||"object"!==(void 0===e?"undefined":tc(e)))return t;"string"==typeof e.id&&(t.id=e.id),"string"==typeof e.success_status&&(t.success_status=e.success_status),"string"==typeof e.completion_status&&(t.completion_status=e.completion_status),"string"==typeof e.progress_measure&&""!==e.progress_measure&&(t.progress_measure=e.progress_measure),"string"==typeof e.description&&(t.description=e.description);var score=e.score;return score&&"object"===(void 0===score?"undefined":tc(score))&&("string"==typeof score.scaled&&""!==score.scaled?t.score.scaled=score.scaled:"number"==typeof score.scaled&&Number.isFinite(score.scaled)&&(t.score.scaled=score.scaled+""),"string"==typeof score.raw&&""!==score.raw?t.score.raw=score.raw:"number"==typeof score.raw&&Number.isFinite(score.raw)&&(t.score.raw=score.raw+""),"string"==typeof score.min&&""!==score.min?t.score.min=score.min:"number"==typeof score.min&&Number.isFinite(score.min)&&(t.score.min=score.min+""),"string"==typeof score.max&&""!==score.max?t.score.max=score.max:"number"==typeof score.max&&Number.isFinite(score.max)&&(t.score.max=score.max+"")),t}},{key:"captureGlobalObjectiveSnapshot",value:function(e){var t,i,n={},r=null!==(t=null!=e?e:null===(i=this.context.sequencingService)||void 0===i?void 0:i.getOverallSequencingProcess())&&void 0!==t?t:null;if(r){var o=r.getGlobalObjectiveMapSnapshot(),a=!0,s=!1,l=void 0;try{for(var c,u=Object.entries(o)[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=ec(c.value,2);n[d[0]]=Zl({},d[1])}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}var v=!0,f=!1,h=void 0;try{for(var m,p=this._globalObjectives[Symbol.iterator]();!(v=(m=p.next()).done);v=!0){var y=m.value;y.id&&!n[y.id]&&(n[y.id]=this.buildObjectiveMapEntryFromCMI(y))}}catch(e){f=!0,h=e}finally{try{v||null==p.return||p.return()}finally{if(f)throw h}}return n}},{key:"parseObjectiveNumber",value:function(e){if(null==e)return null;if("number"==typeof e&&Number.isFinite(e))return e;var t=parseFloat(e+"");return Number.isFinite(t)?t:null}},{key:"syncCmiToSequencingActivity",value:function(e,t,i){if(this.context.sequencing){var n=this.context.sequencing.getCurrentActivity();if(n&&n.primaryObjective){var r=n.primaryObjective;t!==ye&&(r.satisfiedStatus=t===me,r.satisfiedStatusKnown=!0,r.measureStatus=!0,n.objectiveMeasureStatus=!0,n.objectiveSatisfiedStatus=t===me,n.objectiveSatisfiedStatusKnown=!0),e!==_e&&(r.completionStatus=e),void 0!==(null==i?void 0:i.scaled)&&null!==i.scaled&&(r.normalizedMeasure=i.scaled,r.measureStatus=!0),void 0!==(null==i?void 0:i.raw)&&null!==i.raw&&(r.rawScore=i.raw+""),void 0!==(null==i?void 0:i.min)&&null!==i.min&&(r.minScore=i.min+""),void 0!==(null==i?void 0:i.max)&&null!==i.max&&(r.maxScore=i.max+"")}}}},{key:"findOrCreateGlobalObjective",value:function(e){var t=this._globalObjectives.findIndex(function(t){return t.id===e});if(-1===t){t=this._globalObjectives.length;var i=new Va;i.id=e,this._globalObjectives.push(i)}return{index:t,objective:this._globalObjectives[t]}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function oc(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function ac(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){oc(o,n,r,a,s,"next",e)}function s(e){oc(o,n,r,a,s,"throw",e)}a(void 0)})}}function sc(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lc(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function cc(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){sc(e,t,i[t])})}return e}function uc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function dc(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var vc=Object.defineProperty,fc=function(e,t,i){return function(e,t,i){return t in e?vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":uc(t))?t+"":t,i)},hc=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fc(this,"context"),fc(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i}return t=e,(i=[{key:"saveSequencingState",value:function(e){return ac(function(){var t,i,n,r,o,a,s;return dc(this,function(l){switch(l.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("saveSequencingState","No persistence configuration provided",Se.WARN),[2,!1];l.label=1;case 1:if(l.trys.push([1,3,,4]),i=this.serializeSequencingState(),n=cc({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,lastUpdated:(new Date).toISOString(),version:t.sequencingStatePersistence.stateVersion||"1.0"},e),o=i,!1!==(r=t.sequencingStatePersistence).compress&&(o=this.compressStateData(i)),r.maxStateSize&&o.length>r.maxStateSize)throw Error("State size ".concat(o.length," exceeds limit ").concat(r.maxStateSize));return[4,r.persistence.saveState(o,n)];case 2:return a=l.sent(),r.debugPersistence&&this.context.apiLog("saveSequencingState","State save ".concat(a?"succeeded":"failed",": size=").concat(o.length),a?Se.INFO:Se.WARN),[2,a];case 3:return s=l.sent(),this.context.apiLog("saveSequencingState","Error saving sequencing state: ".concat(lc(s,Error)?s.message:s+""),Se.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"loadSequencingState",value:function(e){return ac(function(){var t,i,n,r,o,a,s;return dc(this,function(l){switch(l.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("loadSequencingState","No persistence configuration provided",Se.WARN),[2,!1];l.label=1;case 1:return l.trys.push([1,3,,4]),i=cc({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,version:t.sequencingStatePersistence.stateVersion||"1.0"},e),[4,(n=t.sequencingStatePersistence).persistence.loadState(i)];case 2:return(r=l.sent())?(o=r,!1!==n.compress&&(o=this.decompressStateData(r)),a=this.deserializeSequencingState(o),n.debugPersistence&&this.context.apiLog("loadSequencingState","State load ".concat(a?"succeeded":"failed",": size=").concat(r.length),a?Se.INFO:Se.WARN),[2,a]):(n.debugPersistence&&this.context.apiLog("loadSequencingState","No sequencing state found to load",Se.INFO),[2,!1]);case 3:return s=l.sent(),this.context.apiLog("loadSequencingState","Error loading sequencing state: ".concat(lc(s,Error)?s.message:s+""),Se.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"serializeSequencingState",value:function(){var e,t={version:(null===(e=this.context.getSettings().sequencingStatePersistence)||void 0===e?void 0:e.stateVersion)||"1.0",timestamp:(new Date).toISOString(),sequencing:null,currentActivityId:null,globalObjectives:this.globalObjectiveManager.globalObjectives.map(function(e){return e.toJSON()}),globalObjectiveMap:{},adlNavState:{request:this.context.adl.nav.request,request_valid:this.context.adl.nav.request_valid},contentDelivered:!1};if(this.context.sequencingService){var i=this.context.sequencingService.getOverallSequencingProcess();if(i){var n=i.getSequencingState();t.sequencing=n,t.contentDelivered=i.hasContentBeenDelivered(),t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot(i)}var r=this.context.sequencing.getCurrentActivity();r&&(t.currentActivityId=r.id)}return t.globalObjectiveMap&&0!==Object.keys(t.globalObjectiveMap).length||(t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot()),JSON.stringify(t)}},{key:"deserializeSequencingState",value:function(e){var t=this;try{var i,n=JSON.parse(e),r=(null===(i=this.context.getSettings().sequencingStatePersistence)||void 0===i?void 0:i.stateVersion)||"1.0";if(n.version!==r&&this.context.apiLog("deserializeSequencingState","State version mismatch: ".concat(n.version," vs expected ").concat(r),Se.WARN),n.globalObjectiveMap&&n.sequencing&&!n.sequencing.globalObjectiveMap&&(n.sequencing.globalObjectiveMap=n.globalObjectiveMap),n.sequencing&&this.context.sequencingService){var o=this.context.sequencingService.getOverallSequencingProcess();o&&(o.restoreSequencingState(n.sequencing),n.contentDelivered&&o.setContentDelivered(!0))}var a=new Map;if(Array.isArray(n.globalObjectives)){var s=!0,l=!1,c=void 0;try{for(var u,d=n.globalObjectives[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var v=this.globalObjectiveManager.buildCMIObjectiveFromJSON(u.value);v.id&&a.set(v.id,v)}}catch(e){l=!0,c=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw c}}}if(n.globalObjectiveMap&&"object"===uc(n.globalObjectiveMap)){var f=this.globalObjectiveManager.buildCMIObjectivesFromMap(n.globalObjectiveMap),h=!0,m=!1,p=void 0;try{for(var y,g=f[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;b.id&&(a.has(b.id)||a.set(b.id,b))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}return a.size>0&&(this.globalObjectiveManager.globalObjectives=Array.from(a.values()),this.globalObjectiveManager.globalObjectives.forEach(function(e){e.id&&t.globalObjectiveManager.updateGlobalObjectiveFromCMI(e.id,e)})),n.adlNavState&&(this.context.adl.nav.request=n.adlNavState.request||"_none_",this.context.adl.nav.request_valid=n.adlNavState.request_valid||{}),!0}catch(e){return this.context.apiLog("deserializeSequencingState","Error deserializing sequencing state: ".concat(lc(e,Error)?e.message:e+""),Se.ERROR),!1}}},{key:"compressStateData",value:function(e){return"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function mc(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var pc=Object.defineProperty,yc=function(e,t,i){return function(e,t,i){return t in e?pc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},gc=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yc(this,"context"),yc(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i||null}return t=e,i=[{key:"setGlobalObjectiveManager",value:function(e){this.globalObjectiveManager=e}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.context.renderCMIToJSONObject();e||t?i.cmi.total_time=this.context.cmi.getCurrentTotalTime():delete i.cmi.total_time;var n=l(i);switch(this.context.getSettings().dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return mc(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?mc(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.renderCommitCMI(e,n),o=e||n?this.context.cmi.getCurrentTotalTime():"",s=a(o,xe),l=_e,c=ye;this.context.cmi.completion_status&&("completed"===this.context.cmi.completion_status?l=ge:"incomplete"===this.context.cmi.completion_status&&(l=be)),this.context.cmi.success_status&&("passed"===this.context.cmi.success_status?c=me:"failed"===this.context.cmi.success_status&&(c=pe));var u=(null===(i=this.context.cmi)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},d={completionStatus:l,successStatus:c,totalTimeSeconds:s,runtimeData:r};u&&(d.score=u);var v=this.context.getSettings();if(v.autoPopulateCommitMetadata){var f,h;v.courseId&&(d.courseId=v.courseId),v.scoId&&(d.scoId=v.scoId),this.context.cmi.learner_id&&(d.learnerId=this.context.cmi.learner_id),this.context.cmi.learner_name&&(d.learnerName=this.context.cmi.learner_name);var m=null===(f=this.context.sequencingService)||void 0===f?void 0:f.getSequencingState();(null==m||null===(h=m.currentActivity)||void 0===h?void 0:h.id)&&(d.activityId=m.currentActivity.id)}return this.globalObjectiveManager&&this.globalObjectiveManager.syncCmiToSequencingActivity(l,c,u),d}},{key:"determineEntryValue",value:function(e,t){var i=null==e?void 0:e.trim();return""===e||null==e||""===i?"ab-initio":"suspend"===e?"resume":"logout"===e||"normal"===e?"":"time-out"===e&&t?"resume":""}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function _c(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Sc(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){_c(o,n,r,a,s,"next",e)}function s(e){_c(o,n,r,a,s,"throw",e)}a(void 0)})}}function wc(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Cc(e){return Cc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Cc(e)}function Oc(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ac(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){wc(e,t,i[t])})}return e}function Ec(e,t){return Ec=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ec(e,t)}function kc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function jc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(jc=function(){return!!result})()}function Rc(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var Mc=Object.defineProperty,Tc=function(e,t,i){return function(e,t,i){return t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":kc(t))?t+"":t,i)},xc=new Set(["cmi.suspend_data","cmi.location","cmi.scaled_passing_score","cmi.max_time_allowed","cmi.completion_threshold","cmi.progress_measure","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.objectives.N.score.scaled","cmi.objectives.N.score.raw","cmi.objectives.N.score.min","cmi.objectives.N.score.max","cmi.objectives.N.progress_measure","cmi.objectives.N.description","cmi.interactions.N.weighting","cmi.interactions.N.type","cmi.interactions.N.timestamp","cmi.interactions.N.result","cmi.interactions.N.latency","cmi.interactions.N.learner_response","cmi.interactions.N.description","cmi.comments_from_learner.N.timestamp"]),Scorm2004API=function(e){function Scorm2004API(e,t){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scorm2004API);var n=e?Ac({},e):void 0;n&&void 0===n.mastery_override&&(n.mastery_override=!1),i=function(e,t,i){return t=Cc(t),n=e,!(r=jc()?Reflect.construct(t,i||[],Cc(e).constructor):t.apply(e,i))||"object"!==kc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,Scorm2004API,[re,n,t]),Tc(i,"_version","1.0"),Tc(i,"_sequencing"),Tc(i,"_sequencingService",null),Tc(i,"_extractedScoItemIds",[]),Tc(i,"_sequencingCollections",{}),Tc(i,"_responseValidator"),Tc(i,"_cmiHandler"),Tc(i,"_activityTreeBuilder"),Tc(i,"_sequencingConfigBuilder"),Tc(i,"_globalObjectiveManager"),Tc(i,"_statePersistence",null),Tc(i,"_dataSerializer"),Tc(i,"cmi"),Tc(i,"adl"),Tc(i,"Initialize"),Tc(i,"Terminate"),Tc(i,"GetValue"),Tc(i,"SetValue"),Tc(i,"Commit"),Tc(i,"GetLastError"),Tc(i,"GetErrorString"),Tc(i,"GetDiagnostic"),i.cmi=new Gs,i.adl=new ol,i._sequencing=new Il,i.adl.sequencing=i._sequencing,i._sequencingConfigBuilder=new Gl,i._activityTreeBuilder=new Xl({},i._sequencingConfigBuilder);var r={throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode},checkCorrectResponseValue:function(e,t,n,r){return i._responseValidator.checkCorrectResponseValue(e,t,n,r)}};i._responseValidator=new Nl(r);var o={cmi:i.cmi,isInitialized:function(){return i.isInitialized()},throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode}};i._cmiHandler=new Ll(o,i._responseValidator);var a={getSettings:function(){return i.settings},cmi:i.cmi,sequencing:i._sequencing,sequencingService:i._sequencingService,commonSetCMIValue:i._commonSetCMIValue.bind(i)};i._globalObjectiveManager=new rc(a);var s={getSettings:function(){return i.settings},cmi:i.cmi,sequencingService:i._sequencingService,renderCMIToJSONObject:i.renderCMIToJSONObject.bind(i)};return i._dataSerializer=new gc(s,i._globalObjectiveManager),(null==n?void 0:n.sequencing)&&i.configureSequencing(n.sequencing),i.initializeSequencingService(n),i.Initialize=i.lmsInitialize,i.Terminate=i.lmsFinish,i.GetValue=i.lmsGetValue,i.SetValue=i.lmsSetValue,i.Commit=i.lmsCommit,i.GetLastError=i.lmsGetLastError,i.GetErrorString=i.lmsGetErrorString,i.GetDiagnostic=i.lmsGetDiagnostic,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ec(e,t)}(Scorm2004API,e),t=Scorm2004API,i=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),this.applyCurrentActivityLaunchData(),null===(i=this.adl)||void 0===i||i.reset()}},{key:"applyCurrentActivityLaunchData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();t&&this.applyActivityLaunchData(t)}},{key:"applyDeliveredActivityLaunchData",value:function(e){this.isNotInitialized()&&this.applyActivityLaunchData(e)}},{key:"applyActivityLaunchData",value:function(e){var t,i,n,r;if(this.cmi){var o=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getContentActivityData(e),a=null!==(t=null!==(i=null==o?void 0:o.completionThreshold)&&void 0!==i?i:null===(r=e.completionThreshold)||void 0===r?void 0:""+r)&&void 0!==t?t:"";this.cmi.completion_threshold=a,this.seedCurrentActivityObjectives(e)}}},{key:"applyCurrentActivityObjectiveData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();this.cmi&&t&&this.seedCurrentActivityObjectives(t)}},{key:"seedCurrentActivityObjectives",value:function(e){var t,i,n=[];e.primaryObjective&&n.push(e.primaryObjective),(t=n).push.apply(t,function(e){if(Array.isArray(e))return bc(e)}(i=e.objectives)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return bc(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?bc(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var r=new Set,o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=this.getSeedableObjectiveId(u);if(d&&!r.has(d)){r.add(d);var v=this.findOrSeedCMIObjective(d);if(null!==v){var f=this.cmi.objectives.findObjectiveByIndex(v);f&&this.cmi.objectives.initialized&&!f.initialized&&f.initialize();var h=this.getActivityObjectiveSuccessStatus(u);h&&this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(v,".success_status"),h),this.seedObjectiveReadMapValues(e,u,v)}}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}},{key:"seedObjectiveReadMapValues",value:function(e,t,i){var n,r=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getGlobalObjectiveMap();if(r&&0!==t.mapInfo.length){var o=!0,a=!1,s=void 0;try{for(var l,c=t.mapInfo[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=r.get(u.targetObjectiveID||t.id);if(d){var v=Qn.getGlobalObjectiveReadState(e,t,u,d);this.applyObjectiveReadStateToCMI(i,v)}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}}},{key:"applyObjectiveReadStateToCMI",value:function(e,t){void 0!==t.satisfiedStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".success_status"),t.satisfiedStatus?me:pe),void 0!==t.normalizedMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.scaled"),t.normalizedMeasure+""),void 0!==t.completionStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".completion_status"),t.completionStatus),void 0!==t.progressMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".progress_measure"),t.progressMeasure+""),void 0!==t.rawScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.raw"),t.rawScore),void 0!==t.minScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.min"),t.minScore),void 0!==t.maxScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.max"),t.maxScore)}},{key:"getSeedableObjectiveId",value:function(e){var t=e.id;return"string"!=typeof t||""===t.trim()?null:t}},{key:"findOrSeedCMIObjective",value:function(e){var t=this.cmi.objectives.childArray.findIndex(function(t){return t.id===e});if(t>=0)return t;var i=this.cmi.objectives.childArray.length;return this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(i,".id"),e)===q?i:null}},{key:"getActivityObjectiveSuccessStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown?e.satisfiedStatus?me:pe:null}},{key:"version",get:function(){return this._version}},{key:"globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives}},{key:"_globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives},set:function(objectives){this._globalObjectiveManager.globalObjectives=objectives}},{key:"compressStateData",value:function(e){return this._statePersistence?this._statePersistence.compressStateData(e):"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if(this._statePersistence)return this._statePersistence.decompressStateData(e);if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}},{key:"lmsInitialize",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),D;this.cmi.initialize();var result=this.initialize("Initialize","LMS was already initialized!","LMS is already finished!");return result===q&&this._sequencingService&&(this._sequencingService.initialize(),this.applyCurrentActivityObjectiveData()),result===q&&this._globalObjectiveManager.restoreGlobalObjectivesToCMI(),result===q&&this.settings.sequencingStatePersistence&&this.loadSequencingState().catch(function(){e.apiLog("lmsInitialize","Failed to auto-load sequencing state",Se.WARN)}),result}},{key:"lmsFinish",value:function(){var e,t,i,n,r;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),D;var o=(null===(i=this.adl)||void 0===i||null===(t=i.nav)||void 0===t?void 0:t.request)||"_none_",a=(null===(n=this.cmi)||void 0===n?void 0:n.getExitValueInternal())||"",s=this.isTerminated(),l=null!==(e=null===(r=this._sequencingService)||void 0===r?void 0:r.isDeliveryInProgress())&&void 0!==e&&e,result=this.terminate("Terminate",!0);if(result===q&&!s&&!l){var c=!1,u=null,d=o,v="",f=RegExp(Le);if("_none_"!==o){var h,m,p,y=o.match(f);if(y)if(null===(h=y.groups)||void 0===h?void 0:h.choice_target)v=null===(p=y.groups)||void 0===p?void 0:p.choice_target,d="choice";else if(null===(m=y.groups)||void 0===m?void 0:m.jump_target){var g;v=null===(g=y.groups)||void 0===g?void 0:g.jump_target,d="jump"}}if(this._sequencingService)try{var b,_=null;"_none_"!==d?(_=d,b=v||void 0):this._sequencing.getCurrentActivity()&&(_="exit"),_&&(c=this._sequencingService.processNavigationRequest(_,b,a),u=_)}catch(e){this.apiLog("lmsFinish","Sequencing navigation failed, falling back to event-based navigation: ".concat(e),Se.WARN),c=!1}if(!c)if("_none_"!==o){var S={continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll"}[d];S&&this.processListeners(S,"adl.nav.request",v)}else this.settings.autoProgress&&this.processListeners("SequenceNext",void 0,"next");this._sequencingService&&u&&["exitAll","abandonAll","suspendAll"].includes(u)&&this._sequencingService.terminate(),this.adl.nav.request="_none_"}return result}},{key:"lmsGetValue",value:function(e){if(this.isTerminated())return this.lastErrorCode=re.RETRIEVE_AFTER_TERM+"","";if(!this.isInitialized())return this.lastErrorCode=re.RETRIEVE_BEFORE_INIT+"","";if("adl.nav.request"===e)return this.throwSCORMError(e,re.WRITE_ONLY_ELEMENT,"adl.nav.request is write-only"),"";var t="^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=([a-zA-Z0-9-_]+)}$";if(c(e,t)){var i=e.match(t);if(i){var n,request=i[1],r=(null===(n=i[2])||void 0===n?void 0:n.replace(/{target=/g,"").replace(/}/g,""))||"";if("choice"===request||"jump"===request){var o,a,s,l=null===(o=this._sequencing)||void 0===o?void 0:o.overallSequencingProcess;return this.settings.scoItemIdValidator?this.settings.scoItemIdValidator(r)+"":(null==l?void 0:l.predictChoiceEnabled)&&"choice"===request?l.predictChoiceEnabled(r)?"true":"false":(null==l?void 0:l.predictJumpEnabled)&&"jump"===request?l.predictJumpEnabled(r)?"true":"false":this._extractedScoItemIds.length>0?this._extractedScoItemIds.includes(r)+"":(null===(s=this.settings)||void 0===s||null===(a=s.scoItemIds)||void 0===a?void 0:a.includes(r))+""}}}return"cmi.completion_status"===e?this._cmiHandler.evaluateCompletionStatus():"cmi.success_status"===e?this._cmiHandler.evaluateSuccessStatus():this.getValue("GetValue",!0,e)}},{key:"lmsSetValue",value:function(e,t){var i,n=this,r=this._peekCMIValue(e),result=this.setValue("SetValue","Commit",!0,e,t);if(result===q&&this._sequencingService)try{this._sequencingService.triggerRollupOnCMIChange(e,r,t)}catch(t){console.warn("Sequencing rollup failed for ".concat(e,": ").concat(t))}return result===q&&"setValue"===(null===(i=this.settings.sequencingStatePersistence)||void 0===i?void 0:i.autoSaveOn)&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.objectives","adl.nav.request"].some(function(t){return e.startsWith(t)})&&this.saveSequencingState().catch(function(){n.apiLog("lmsSetValue","Failed to auto-save sequencing state",Se.WARN)}),result}},{key:"lmsCommit",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),D;if(this.settings.throttleCommits)return this.scheduleCommit(500,"Commit"),q;var t,result=this.commit("Commit",!0);return result===q&&"commit"===(null===(t=this.settings.sequencingStatePersistence)||void 0===t?void 0:t.autoSaveOn)&&this.saveSequencingState().catch(function(){e.apiLog("lmsCommit","Failed to auto-save sequencing state",Se.WARN)}),result}},{key:"lmsGetLastError",value:function(){return this.getLastError("GetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("GetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("GetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){if(c(e,"cmi\\.objectives\\.\\d+")){var i,n,r=+e.split(".")[2],o="cmi.objectives.".concat(r);if(c(e,"cmi\\.objectives\\.\\d+\\.id"))n=t;else{var a=this.cmi.objectives.findObjectiveByIndex(r);n=a?a.id:void 0}if(n&&(null===(i=this.settings.globalObjectiveIds)||void 0===i?void 0:i.includes(n))&&this.currentActivityAllowsGlobalObjectiveWrites()){var s=this._globalObjectiveManager.findOrCreateGlobalObjective(n).index,l=e.replace(o,"_globalObjectives.".concat(s));this._commonSetCMIValue("SetGlobalObjectiveValue",!0,l,t);var u=this._globalObjectiveManager.globalObjectives[s];n&&u&&this._globalObjectiveManager.updateGlobalObjectiveFromCMI(n,u)}}return this._commonSetCMIValue("SetValue",!0,e,t)}},{key:"currentActivityAllowsGlobalObjectiveWrites",value:function(){var e,t;return!1!==(null===(t=this._sequencing)||void 0===t||null===(e=t.getCurrentActivity())||void 0===e?void 0:e.sequencingControls.tracked)}},{key:"getChildElement",value:function(e,t,i){return this._cmiHandler.getChildElement(e,t,i)}},{key:"validateCorrectResponse",value:function(e,t){var i=e.split("."),n=this.cmi.interactions.childArray[+i[2]];n?this._responseValidator.validateCorrectResponse(e,n,t):this.throwSCORMError(e,re.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"_peekCMIValue",value:function(e){if(!e||"string"!=typeof e)return null;for(var t=e.split("."),i=this,n=0;t.length>n;n++){var r=t[n];if(null==i)return null;try{i=i[r]}catch(e){return null}if(Oc(i,de)){var o=n+1;if(o>=t.length)return i;var a=+t[o];if(!Number.isNaN(a)&&Number.isInteger(a)&&a>=0){if(a>=i.childArray.length)return null;i=i.childArray[a],n++}}}return null!=i?i:null}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("GetValue",!0,e)}},{key:"checkUninitializedGet",value:function(e,t){var i;""===t&&(this._setCMIElements.has(e)||xc.has(function(e){return e.replace(/\.\d+(?=\.|$)/g,".N")}(e))&&this.throwSCORMError(e,null!==(i=this._error_codes.VALUE_NOT_INITIALIZED)&&void 0!==i?i:403,"The data model element passed to GetValue (".concat(e,") has not been initialized.")))}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i="",n="",r=L.error_descriptions[e+=""];return r&&(i=r.basicMessage,n=r.detailMessage),t?n:i}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.adl=e.adl}},{key:"renderCommitCMI",value:function(e){return this._dataSerializer.renderCommitCMI(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"renderCommitObject",value:function(e){return this._dataSerializer.renderCommitObject(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"storeData",value:function(e,t){var i,n,r,o,a;e&&"normal"===this.cmi.mode&&"credit"===this.cmi.credit&&(this.cmi.completion_threshold&&this.cmi.progress_measure&&(this.cmi.completion_status=parseFloat(this.cmi.completion_threshold)>parseFloat(this.cmi.progress_measure)?"incomplete":"completed"),this.cmi.scaled_passing_score&&this.cmi.score.scaled&&(this.cmi.success_status=parseFloat(this.cmi.scaled_passing_score)>parseFloat(this.cmi.score.scaled)?"failed":"passed"));var s=!1;this.adl.nav.request!==(null===(r=this.startingData)||void 0===r||null===(n=r.adl)||void 0===n||null===(i=n.nav)||void 0===i?void 0:i.request)&&"_none_"!==this.adl.nav.request&&(s=!0);var l=this.getCommitObject(e),c=(null===(a=this.cmi)||void 0===a||null===(o=a.score)||void 0===o?void 0:o.getScoreObject())||{},u=_e;"completed"===this.cmi.completion_status?u=ge:"incomplete"===this.cmi.completion_status&&(u=be);var d=ye;if("passed"===this.cmi.success_status?d=me:"failed"===this.cmi.success_status&&(d=pe),this._globalObjectiveManager.syncCmiToSequencingActivity(u,d,c),"string"==typeof this.settings.lmsCommitUrl){var result=this.processHttpRequest(this.settings.lmsCommitUrl,l,e,t);if(s&&void 0!==result.navRequest&&""!==result.navRequest&&"string"==typeof result.navRequest){var v=function(e){var t=new Set(["start","resumeAll","continue","previous","choice","jump","exit","exitAll","abandon","abandonAll","suspendAll","_none_"]),i=e.trim();if(!i)return{command:"_none_",targetActivityId:null,valid:!1,error:"Empty navigation request"};if(t.has(i))return{command:i,targetActivityId:null,valid:!0};var n=i.indexOf(".");if(n>0){var r=i.substring(0,n),o=i.substring(n+1);if(("choice"===r||"jump"===r)&&o)return/^[a-zA-Z0-9._-]+$/.test(o)?{command:r,targetActivityId:o,valid:!0}:{command:"_none_",targetActivityId:null,valid:!1,error:"Invalid target activity ID: contains disallowed characters"}}return{command:"_none_",targetActivityId:null,valid:!1,error:'Unrecognized navigation command: "'.concat(i,'"')}}(result.navRequest);if(v.valid){var f={start:"SequenceStart",resumeAll:"SequenceResumeAll",continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll",suspendAll:"SequenceSuspendAll"}[v.command];f&&this.processListeners(f,"adl.nav.request",v.targetActivityId)}else this.apiLog("storeData","Invalid navigation request from LMS: ".concat(v.error),Se.WARN)}else(null==result?void 0:result.navRequest)&&!s&&"object"===kc(result.navRequest)&&Object.hasOwnProperty.call(result.navRequest,"name")&&result.navRequest.name&&this.processListeners(result.navRequest.name,result.navRequest.data);return result}return{result:q,errorCode:0}}},{key:"configureSequencing",value:function(e){this._sequencingCollections=this._sequencingConfigBuilder.sanitizeSequencingCollections(e.collections),this._activityTreeBuilder.setSequencingCollections(this._sequencingCollections),e.activityTree&&this.configureActivityTree(e.activityTree),e.sequencingRules&&this.configureSequencingRules(e.sequencingRules),e.sequencingControls&&this.configureSequencingControls(e.sequencingControls),e.rollupRules&&this.configureRollupRules(e.rollupRules),this._sequencing.hideLmsUi=e.hideLmsUi?this._sequencingConfigBuilder.sanitizeHideLmsUi(e.hideLmsUi):[],this._sequencing.auxiliaryResources=e.auxiliaryResources?this._sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources):[]}},{key:"configureActivityTree",value:function(e){var t=this._activityTreeBuilder.createActivity(e);this._sequencing.activityTree.root=t,this._extractedScoItemIds=this._activityTreeBuilder.extractActivityIds(t)}},{key:"configureSequencingRules",value:function(e){this._sequencingConfigBuilder.applySequencingRulesSettings(this._sequencing.sequencingRules,e)}},{key:"configureSequencingControls",value:function(e){this._sequencingConfigBuilder.applySequencingControlsSettings(this._sequencing.sequencingControls,e)}},{key:"configureRollupRules",value:function(e){this._sequencingConfigBuilder.applyRollupRulesSettings(this._sequencing.rollupRules,e)}},{key:"initializeSequencingService",value:function(e){var t=this;try{var i,n,r,o,a,s,l,c,u,d,v,f={autoRollupOnCMIChange:null===(i=null==e||null===(s=e.sequencing)||void 0===s?void 0:s.autoRollupOnCMIChange)||void 0===i||i,autoProgressOnCompletion:null!==(n=null==e||null===(l=e.sequencing)||void 0===l?void 0:l.autoProgressOnCompletion)&&void 0!==n&&n,validateNavigationRequests:null===(r=null==e||null===(c=e.sequencing)||void 0===c?void 0:c.validateNavigationRequests)||void 0===r||r,enableEventSystem:null===(o=null==e||null===(u=e.sequencing)||void 0===u?void 0:u.enableEventSystem)||void 0===o||o,logLevel:null!==(a=null==e||null===(d=e.sequencing)||void 0===d?void 0:d.logLevel)&&void 0!==a?a:"info"};if(this._sequencingService=new ao(this._sequencing,this.cmi,this.adl,this.eventService||this,this.loggingService,f),this._sequencingService.setEventListeners(this.buildSequencingEventListeners(null==e||null===(v=e.sequencing)||void 0===v?void 0:v.eventListeners)),this._globalObjectiveManager.updateSequencingService(this._sequencingService),this._dataSerializer.updateSequencingService(this._sequencingService),null==e?void 0:e.sequencingStatePersistence){var h={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};this._statePersistence=new hc(h,this._globalObjectiveManager)}this._globalObjectiveManager.syncGlobalObjectiveIdsFromSequencing()}catch(e){console.warn("Failed to initialize sequencing service:",e),this._sequencingService=null}}},{key:"buildSequencingEventListeners",value:function(e){var t,i,n=this;return t=Ac({},e),i=null!=(i={onActivityDelivery:function(t){var i;n.applyDeliveredActivityLaunchData(t),null==e||null===(i=e.onActivityDelivery)||void 0===i||i.call(e,t)}})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}},{key:"getSequencingService",value:function(){return this._sequencingService}},{key:"setSequencingEventListeners",value:function(e){this._sequencingService&&this._sequencingService.setEventListeners(this.buildSequencingEventListeners(e))}},{key:"updateSequencingConfiguration",value:function(e){this._sequencingService&&this._sequencingService.updateConfiguration(e)}},{key:"getSequencingState",value:function(){return this._sequencingService?this._sequencingService.getSequencingState():{isInitialized:!1,isActive:!1,currentActivity:null,rootActivity:this._sequencing.getRootActivity(),lastSequencingResult:null}}},{key:"processNavigationRequest",value:function(request,e){return!!this._sequencingService&&this._sequencingService.processNavigationRequest(request,e)}},{key:"resetSequencingState",value:function(){var e,t;null===(e=this._sequencing)||void 0===e||e.reset(),null===(t=this._sequencingService)||void 0===t||t.setEventListeners({})}},{key:"getActivityTrackingData",value:function(e){var t,i;if(!(null===(i=this._sequencing)||void 0===i?void 0:i.activityTree))return null;var n=this._sequencing.activityTree.getActivity(e);return n?{completionStatus:n.completionStatus||"unknown",successStatus:n.successStatus||"unknown",progressMeasure:null!==(t=n.progressMeasure)&&void 0!==t?t:null,score:n.objectiveMeasureStatus?n.objectiveNormalizedMeasure:null}:null}},{key:"saveSequencingState",value:function(e){return Sc(function(){var t,i;return Rc(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.saveSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new hc(i,this._globalObjectiveManager).saveSequencingState(e)]):(this.apiLog("saveSequencingState","No persistence configuration provided",Se.WARN),[2,!1])})}).call(this)}},{key:"loadSequencingState",value:function(e){return Sc(function(){var t,i;return Rc(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.loadSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new hc(i,this._globalObjectiveManager).loadSequencingState(e)]):(this.apiLog("loadSequencingState","No persistence configuration provided",Se.WARN),[2,!1])})}).call(this)}},{key:"serializeSequencingState",value:function(){var e=this;if(this._statePersistence)return this._statePersistence.serializeSequencingState();var t={getSettings:function(){return e.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new hc(t,this._globalObjectiveManager).serializeSequencingState()}},{key:"deserializeSequencingState",value:function(e){var t=this;if(this._statePersistence)return this._statePersistence.deserializeSequencingState(e);var i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new hc(i,this._globalObjectiveManager).deserializeSequencingState(e)}},{key:"determineEntryValue",value:function(e,t){return this._dataSerializer.determineEntryValue(e,t)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),Scorm2004API;var t,i}(ko);return Scorm2004API}();
|
|
1
|
+
this.Scorm2004API=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}var r=["text/plain","application/x-www-form-urlencoded","multipart/form-data"];function o(e){var t,i=(null!==(t=(e||"").split(";")[0])&&void 0!==t?t:"").trim().toLowerCase();return r.includes(i)}function a(e){if("undefined"==typeof location||!location||!location.origin)return!1;try{return new URL(e,location.href).origin!==location.origin}catch(e){return!1}}var s={D:86400,H:3600,M:60,S:1},l=function(e){if(!e||0>=e)return"PT0S";var i="P",n=e;return Object.entries(s).forEach(function(e){var r=t(e,2),o=r[0],a=r[1],s=Math.floor(n/a);(function(e){var t,i,n,r;if(Math.floor(e)===e||0>(null===(n=e+"")||void 0===n||null===(i=n.indexOf)||void 0===i?void 0:i.call(n,".")))return 0;var o=null===(r=(""+e).split("."))||void 0===r?void 0:r[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0})(n%=a)>2&&(n=+(+n).toFixed(2)),"S"===o&&n>0&&(s+=n),s&&((i.indexOf("D")>0||["H","M","S"].includes(o))&&-1===i.indexOf("T")&&(i+="T"),i+="".concat(s).concat(o))}),i},c=f(function(e,i){var n,r,o,a;if("string"==typeof i&&(i=RegExp(i)),!e||!(null==e||null===(r=e.match)||void 0===r?void 0:r.call(e,i)))return 0;var s=t(null!==(n=null===(o=(a=RegExp(i)).exec)||void 0===o?void 0:o.call(a,e))&&void 0!==n?n:[],8),result=0;return result+=+s[7]||0,result+=60*+s[6]||0,result+=3600*+s[5]||0,result+=86400*+s[4]||0,result+=604800*+s[3]||0,(result+=2592e3*+s[2]||0)+(31536e3*+s[1]||0)},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat(null!=e?e:"",":").concat(n)}),u=f(function(e,t){var i;return"string"==typeof t&&(t=RegExp(t)),!(!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))});function d(e){var result={};return function e(t,i){if(Object(t)!==t)result[i]=t;else if(Array.isArray(t))t.forEach(function(t,n){e(t,"".concat(i,"[").concat(n,"]"))}),0===t.length&&(result[i]=[]);else{var n=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),r=0===n.length;n.forEach(function(n){e(t[n],i?"".concat(i,".").concat(n):n)}),r&&i&&(result[i]={})}}(e,""),result}function v(e,t){return"string"==typeof e&&RegExp(t).test(e)}function f(e,t,n){var r=new Map;return function(){for(var o=arguments.length,a=Array(o),s=0;o>s;s++)a[s]=arguments[s];var result,l=t?t.apply(void 0,i(a)):JSON.stringify(a);return void 0!==(null==n?void 0:n.maxKeyLength)&&l.length>n.maxKeyLength?e.apply(void 0,i(a)):r.has(l)?r.get(l):(result=e.apply(void 0,i(a)),void 0===(null==n?void 0:n.maxEntries)||n.maxEntries>r.size||r.delete(r.keys().next().value),r.set(l,result),result)}}var h=function(e,t,i){var n=e.indexOf("#"),r=-1===n?e:e.slice(0,n),o=-1===n?"":e.slice(n),a=r.includes("?")?r.endsWith("?")||r.endsWith("&")?"":"&":"?",s="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i+""));return"".concat(r).concat(a).concat(s).concat(o)};function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function g(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!result})()}function b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(e,t)}function _(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var S=Object.defineProperty,w=function(e,t,i){return function(e,t,i){return t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":_(t))?t+"":t,i)},C=function(){function e(t){m(this,e),w(this,"jsonString",!1),w(this,"_cmi_element"),w(this,"_initialized",!1),this._cmi_element=t}return p(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),O=function(e){function t(){var e;return m(this,t),e=function(e,t,i){return t=y(t),n=e,!(r=g()?Reflect.construct(t,i||[],y(e).constructor):t.apply(e,i))||"object"!==_(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,arguments),w(e,"_start_time"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,e),p(t,[{key:"start_time",get:function(){return this._start_time}},{key:"setStartTime",value:function(){if(void 0!==this._start_time)throw Error("Start time has already been set.");this._start_time=(new Date).getTime()}}]),t}(C);function A(e,t,i){return t=R(t),n=e,!(r=T()?Reflect.construct(t,i||[],R(e).constructor):t.apply(e,i))||"object"!==I(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t,i){return k=T()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&x(r,i.prototype),r},k.apply(null,arguments)}function j(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function M(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}function T(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!result})()}function x(e,t){return x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},x(e,t)}function I(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function P(e){var t="function"==typeof Map?new Map:void 0;return P=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return k(e,arguments,R(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),x(i,e)},P(e)}var N=Object.defineProperty,q=function(e,t,i){return function(e,t,i){return t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":I(t))?t+"":t,i)},D=function(e){function t(e,i){var n;return E(this,t),n=A(this,t,["".concat(e," : ").concat(""+i)]),q(n,"_errorCode"),n._errorCode=i,Object.setPrototypeOf(n,t.prototype),n}return M(t,e),j(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(P(Error)),L=function(e){function t(e,i,n,r){var o;return E(this,t),o=A(this,t,[e,i]),q(o,"_errorMessage"),q(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(n),o._errorMessage=n,r&&(o._detailedMessage=r),Object.setPrototypeOf(o,t.prototype),o}return M(t,e),j(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(D),z="true",F="false",B={cmi_children:"_version,comments_from_learner,comments_from_lms,completion_status,completion_threshold,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time",comments_children:"comment,timestamp,location",score_children:"max,raw,scaled,min",objectives_children:"progress_measure,completion_status,success_status,description,score,id",correct_responses_children:"pattern",student_preference_children:"audio_level,audio_captioning,delivery_speed,language",interactions_children:"id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",adl_data_children:"id,store",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},102:{basicMessage:"General Initialization Failure",detailMessage:"Call to Initialize failed for an unknown reason."},103:{basicMessage:"Already Initialized",detailMessage:"Call to Initialize failed because Initialize was already called."},104:{basicMessage:"Content Instance Terminated",detailMessage:"Call to Initialize failed because Terminate was already called."},111:{basicMessage:"General Termination Failure",detailMessage:"Call to Terminate failed for an unknown reason."},112:{basicMessage:"Termination Before Initialization",detailMessage:"Call to Terminate failed because it was made before the call to Initialize."},113:{basicMessage:"Termination After Termination",detailMessage:"Call to Terminate failed because Terminate was already called."},122:{basicMessage:"Retrieve Data Before Initialization",detailMessage:"Call to GetValue failed because it was made before the call to Initialize."},123:{basicMessage:"Retrieve Data After Termination",detailMessage:"Call to GetValue failed because it was made after the call to Terminate."},132:{basicMessage:"Store Data Before Initialization",detailMessage:"Call to SetValue failed because it was made before the call to Initialize."},133:{basicMessage:"Store Data After Termination",detailMessage:"Call to SetValue failed because it was made after the call to Terminate."},142:{basicMessage:"Commit Before Initialization",detailMessage:"Call to Commit failed because it was made before the call to Initialize."},143:{basicMessage:"Commit After Termination",detailMessage:"Call to Commit failed because it was made after the call to Terminate."},201:{basicMessage:"General Argument Error",detailMessage:"An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument."},301:{basicMessage:"General Get Failure",detailMessage:"Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},351:{basicMessage:"General Set Failure",detailMessage:"Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},391:{basicMessage:"General Commit Failure",detailMessage:"Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information."},401:{basicMessage:"Undefined Data Model Element",detailMessage:"The data model element name passed to GetValue or SetValue is not a valid SCORM data model element."},402:{basicMessage:"Unimplemented Data Model Element",detailMessage:"The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant."},403:{basicMessage:"Data Model Element Value Not Initialized",detailMessage:"Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO."},404:{basicMessage:"Data Model Element Is Read Only",detailMessage:"SetValue was called with a data model element that can only be read."},405:{basicMessage:"Data Model Element Is Write Only",detailMessage:"GetValue was called on a data model element that can only be written to."},406:{basicMessage:"Data Model Element Type Mismatch",detailMessage:"SetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Data Model Element Value Out Of Range",detailMessage:"The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}};function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H(e,t,i){return t=U(t),r=e,!(o=G()?Reflect.construct(t,i||[],U(e).constructor):t.apply(e,i))||"object"!=((n=o)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof o?V(r):o;var n,r,o}function U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function G(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!result})()}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}var Y={0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},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."}},W=function(e){function t(e,i){var n,r,o,a,s,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(Y,i+"")?H(this,t,[e,i,(null===(r=Y[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=Y[i+""])||void 0===o?void 0:o.detailMessage]):H(this,t,[e,101,null!==(a=null===(s=Y[101])||void 0===s?void 0:s.basicMessage)&&void 0!==a?a:"General error",null===(l=Y[101])||void 0===l?void 0:l.detailMessage]),Object.setPrototypeOf(V(n),t.prototype),V(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(t,e),t}(L);function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X(e,t,i){return t=$(t),r=e,!(o=Q()?Reflect.construct(t,i||[],$(e).constructor):t.apply(e,i))||"object"!=((n=o)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof o?J(r):o;var n,r,o}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function Q(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!result})()}function Z(e,t){return Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Z(e,t)}var ee=B.error_descriptions,te=function(e){function t(e,i){var n,r,o,a,s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(ee,i+"")?X(this,t,[e,i,(null===(r=ee[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=ee[i+""])||void 0===o?void 0:o.detailMessage]):X(this,t,[e,101,(null===(a=ee[101])||void 0===a?void 0:a.basicMessage)||"General error",null===(s=ee[101])||void 0===s?void 0:s.detailMessage]),Object.setPrototypeOf(J(n),t.prototype),J(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),t}(L);function ie(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ne(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ie(e,t,i[t])})}return e}function re(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var oe={GENERAL:101,INITIALIZATION_FAILED:101,INITIALIZED:101,TERMINATED:101,TERMINATION_FAILURE:101,TERMINATION_BEFORE_INIT:101,MULTIPLE_TERMINATION:101,RETRIEVE_BEFORE_INIT:101,RETRIEVE_AFTER_TERM:101,STORE_BEFORE_INIT:101,STORE_AFTER_TERM:101,COMMIT_BEFORE_INIT:101,COMMIT_AFTER_TERM:101,ARGUMENT_ERROR:101,CHILDREN_ERROR:101,COUNT_ERROR:101,GENERAL_GET_FAILURE:101,GENERAL_SET_FAILURE:101,GENERAL_COMMIT_FAILURE:101,UNDEFINED_DATA_MODEL:101,UNIMPLEMENTED_ELEMENT:101,VALUE_NOT_INITIALIZED:101,INVALID_SET_VALUE:101,READ_ONLY_ELEMENT:101,WRITE_ONLY_ELEMENT:101,TYPE_MISMATCH:101,VALUE_OUT_OF_RANGE:101,DEPENDENCY_NOT_ESTABLISHED:101},ae=re(ne({},oe),{RETRIEVE_BEFORE_INIT:301,STORE_BEFORE_INIT:301,COMMIT_BEFORE_INIT:301,ARGUMENT_ERROR:201,CHILDREN_ERROR:202,COUNT_ERROR:203,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:401,VALUE_NOT_INITIALIZED:301,INVALID_SET_VALUE:402,READ_ONLY_ELEMENT:403,WRITE_ONLY_ELEMENT:404,TYPE_MISMATCH:405,VALUE_OUT_OF_RANGE:405,DEPENDENCY_NOT_ESTABLISHED:408}),se=re(ne({},oe),{INITIALIZATION_FAILED:102,INITIALIZED:103,TERMINATED:104,TERMINATION_FAILURE:111,TERMINATION_BEFORE_INIT:112,MULTIPLE_TERMINATION:113,MULTIPLE_TERMINATIONS:113,RETRIEVE_BEFORE_INIT:122,RETRIEVE_AFTER_TERM:123,STORE_BEFORE_INIT:132,STORE_AFTER_TERM:133,COMMIT_BEFORE_INIT:142,COMMIT_AFTER_TERM:143,ARGUMENT_ERROR:201,GENERAL_GET_FAILURE:301,GENERAL_SET_FAILURE:351,GENERAL_COMMIT_FAILURE:391,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:402,VALUE_NOT_INITIALIZED:403,READ_ONLY_ELEMENT:404,WRITE_ONLY_ELEMENT:405,TYPE_MISMATCH:406,VALUE_OUT_OF_RANGE:407,DEPENDENCY_NOT_ESTABLISHED:408});function le(e){return le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},le(e)}function ce(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ce=function(){return!!result})()}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function de(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ve=Object.defineProperty,fe=function(e,t,i){return function(e,t,i){return t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":de(t))?t+"":t,i)},he=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=le(t),n=e,!(r=ce()?Reflect.construct(t,i||[],le(e).constructor):t.apply(e,i))||"object"!==de(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),fe(i,"_errorCode"),fe(i,"_errorClass"),fe(i,"__children"),fe(i,"childArray"),i.__children=e.children,i._errorCode=null!==(n=e.errorCode)&&void 0!==n?n:ae.GENERAL,i._errorClass=e.errorClass||D,i.childArray=[],i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),i=t,n=[{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._initialized=!1,e)this.childArray=[];else for(var t=0;this.childArray.length>t;t++){var i;null===(i=this.childArray[t])||void 0===i||i.reset()}}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this._errorClass(this._cmi_element+"._children",this._errorCode)}},{key:"_count",get:function(){return this.childArray.length},set:function(_count){throw new this._errorClass(this._cmi_element+"._count",this._errorCode)}},{key:"toJSON",value:function(){this.jsonString=!0;for(var result={},e=0;this.childArray.length>e;e++)result[e+""]=this.childArray[e];return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C),me="unknown",pe="true",ye="false",ge="passed",be="failed",_e="unknown",Se="completed",we="incomplete",Ce="unknown",Oe={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function Ae(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}var Ee={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",terminationCommitContentType:"text/plain;charset=UTF-8",autoProgress:!1,logLevel:Oe.ERROR,uninitializedGetLogLevel:Oe.WARN,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,i;return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,function(n){switch(n.label){case 0:if(void 0===e)return[3,8];t=null,n.label=1;case 1:return n.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=n.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(i=n.sent())&&(t=JSON.parse(i)),n.label=5;case 5:return[3,7];case 6:return n.sent(),[3,7];case 7:return null!==t&&{}.hasOwnProperty.call(t,"result")?[2,{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===z?0:101}]:200===e.status?[2,{result:z,errorCode:0}]:[2,{result:F,errorCode:101}];case 8:return[2,{result:F,errorCode:101}]}})},function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(e){Ae(o,n,r,a,s,"next",e)}function s(e){Ae(o,n,r,a,s,"throw",e)}a(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:F,errorCode:101};try{t=JSON.parse(e.responseText)}catch(e){}return null!==t&&{}.hasOwnProperty.call(t,"result")?{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===z?0:101}:{result:z,errorCode:0}}return{result:F,errorCode:101}},requestHandler:function(e){return e},onLogMessage:ke,mastery_override:!1,score_overrides_status:!1,completion_status_on_failed:"completed",scoItemIds:[],scoItemIdValidator:!1,globalObjectiveIds:[],enableOfflineSupport:!1,courseId:"",syncOnInitialize:!0,syncOnTerminate:!0,maxSyncAttempts:5,scoId:"",autoPopulateCommitMetadata:!1,httpService:null,globalStudentPreferences:!1};function ke(e,t){switch(e){case"4":case 4:case"ERROR":case Oe.ERROR:console.error(t);break;case"3":case 3:case"WARN":case Oe.WARN:console.warn(t);break;case"2":case 2:case"INFO":case Oe.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case Oe.DEBUG:console.debug?console.debug(t):console.log(t)}}var je="^-?([0-9]+)$",Re="^[\\u0000-\\uFFFF]{0,4000}$",Me="^[\\u0000-\\uFFFF]{0,64000}$",Te="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",xe="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).*$)?$",Ie="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",Pe="^(19[7-9][0-9]|[2-9][0-9]{3})((-(0[1-9]|1[0-2]))((-(0[1-9]|[1-2][0-9]|3[0-1]))(T([0-1][0-9]|2[0-3])((:[0-5][0-9])((:[0-5][0-9])((\\.[0-9]{1,6})((Z|([+|-]([0-1][0-9]|2[0-3])))(:[0-5][0-9])?)?)?)?)?)?)?)?$",Ne="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$",qe="^-?([0-9]{1,10})(\\.[0-9]{1,18})?$",De="^(?=.*\\w)[\\w\\-\\(\\)\\+\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\%\\/\\#]{1,250}$",Le="^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",ze="^(completed|incomplete|not attempted|unknown)$",Fe="^(passed|failed|unknown)$",Be="^(_?(start|resumeAll|previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",Ve="^(unknown|true|false)$",He="^{target=\\S{0,}[a-zA-Z0-9-_]+}$",Ue="^$|"+De,Ge="(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}",Ke={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:Le,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:Te,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:Ie,max:1,delimiter:"",unique:!1},matching:{format:De,format2:De,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:Ue,format2:"^(?:|"+Ge+")$",max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:De,max:36,delimiter:"[,]",unique:!1},likert:{format:De,max:1,delimiter:"",unique:!1},numeric:{format:qe,max:1,delimiter:"",unique:!1},other:{format:Re,max:1,delimiter:"",unique:!1}},Ye={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:Le},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:"^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$"},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:Ie},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:De,format2:De},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:Ue,format2:"^(?:|(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?|"+Ge+")$"},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:De},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:De,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:qe,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:Re,limit:1}};function We(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}!function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){We(e,t,i[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var Je=["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mo","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","sh","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu","aar","abk","ave","afr","aka","amh","arg","ara","asm","ava","aym","aze","bak","bel","bul","bih","bis","bam","ben","tib","bod","bre","bos","cat","che","cha","cos","cre","cze","ces","chu","chv","wel","cym","dan","ger","deu","div","dzo","ewe","gre","ell","eng","epo","spa","est","baq","eus","per","fas","ful","fin","fij","fao","fre","fra","fry","gle","gla","glg","grn","guj","glv","hau","heb","hin","hmo","hrv","hat","hun","arm","hye","her","ina","ind","ile","ibo","iii","ipk","ido","ice","isl","ita","iku","jpn","jav","geo","kat","kon","kik","kua","kaz","kal","khm","kan","kor","kau","kas","kur","kom","cor","kir","lat","ltz","lug","lim","lin","lao","lit","lub","lav","mlg","mah","mao","mri","mac","mkd","mal","mon","mol","mar","may","msa","mlt","bur","mya","nau","nob","nde","nep","ndo","dut","nld","nno","nor","nbl","nav","nya","oci","oji","orm","ori","oss","pan","pli","pol","pus","por","que","roh","run","rum","ron","rus","kin","san","srd","snd","sme","sag","slo","sin","slk","slv","smo","sna","som","alb","sqi","srp","ssw","sot","sun","swe","swa","tam","tel","tgk","tha","tir","tuk","tgl","tsn","ton","tur","tso","tat","twi","tah","uig","ukr","urd","uzb","ven","vie","vol","wln","wol","xho","yid","yor","zha","chi","zho","zul"];function Xe(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}var $e=Object.defineProperty,Qe=function(e,t,i){return function(e,t,i){return t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ze=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qe(this,"_API"),Qe(this,"_cancelled",!1),Qe(this,"_timeout"),Qe(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),i),this._callback=n}return t=e,i=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Xe(o,n,r,a,s,"next",e)}function s(e){Xe(o,n,r,a,s,"throw",e)}a(void 0)})}).call(this)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),et=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"];function tt(e,t,i){return t=ot(t),n=e,!(r=lt()?Reflect.construct(t,i||[],ot(e).constructor):t.apply(e,i))||"object"!==ut(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function it(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nt(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rt(e,t,i){return t&&nt(e.prototype,t),i&&nt(e,i),e}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ot(e)}function at(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ct(e,t)}function st(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function lt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(lt=function(){return!!result})()}function ct(e,t){return ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ct(e,t)}function ut(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var dt=Object.defineProperty,vt=function(e,t,i){return function(e,t,i){return t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ut(t))?t+"":t,i)},ft=function(e){return e.SKIP="skip",e.DISABLED="disabled",e.HIDE_FROM_CHOICE="hiddenFromChoice",e.STOP_FORWARD_TRAVERSAL="stopForwardTraversal",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.EXIT="exit",e}(ft||{});var ht=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return it(this,t),e=tt(this,t,["ruleCondition"]),vt(e,"_condition","always"),vt(e,"_operator",null),vt(e,"_parameters",new Map),vt(e,"_referencedObjective",null),e._condition=i,e._operator=n,e._parameters=r,e}return at(t,e),rt(t,[{key:"reset",value:function(){this._initialized=!1,this._condition="always",this._operator=null,this._parameters=new Map}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"operator",get:function(){return this._operator},set:function(e){this._operator=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"referencedObjective",get:function(){return this._referencedObjective},set:function(e){this._referencedObjective=e}},{key:"resolveReferencedObjective",value:function(e){var t,i=this;return this._referencedObjective?(null===(t=e.primaryObjective)||void 0===t?void 0:t.id)===this._referencedObjective?e.primaryObjective:(e.objectives||[]).find(function(e){return e.id===i._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,i=null!==this._referencedObjective,n=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=!(i&&!n)&&(n?n.satisfiedStatusKnown||n.progressStatus?!0===n.satisfiedStatus:"unknown":e.objectiveSatisfiedStatusKnown?!0===e.objectiveSatisfiedStatus:e.successStatus!==_e?e.successStatus===ge:"unknown");break;case"objectiveStatusKnown":result=!(i&&!n||(n?!n.satisfiedStatusKnown:!e.objectiveSatisfiedStatusKnown));break;case"objectiveMeasureKnown":result=!(i&&!n||(n?!n.measureStatus:!e.objectiveMeasureStatus));break;case"objectiveMeasureGreaterThan":if(i&&!n){result=!1;break}var r=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?(n?n.normalizedMeasure:e.objectiveNormalizedMeasure)>r:"unknown";break;case"objectiveMeasureLessThan":if(i&&!n){result=!1;break}var o=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?o>(n?n.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(i&&!n)&&(n?n.completionStatus===Ce?"unknown":n.completionStatus===Se:e.completionStatus===Ce?"unknown":e.completionStatus===Se);break;case"progressKnown":case"activityProgressKnown":result=!(i&&!n)&&(n?n.completionStatus!==Ce:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var i=e.timeLimitDuration;if(!i&&e.attemptAbsoluteDurationLimit&&(i=e.attemptAbsoluteDurationLimit),!i)return!1;var n=c(i,Ne);if(0>=n)return!1;var r=0;if(t._getElapsedSecondsHook)try{var o=t._getElapsedSecondsHook(e);"number"!=typeof o||Number.isNaN(o)||0>o||(r=o)}catch(e){r=0}if(0===r&&e.attemptExperiencedDuration){var a=c(e.attemptExperiencedDuration,Ne);a>0&&(r=a)}if(0===r&&e.attemptAbsoluteStartTime)try{var s=new Date(e.attemptAbsoluteStartTime).getTime(),l=t._now().getTime();Number.isNaN(s)||Number.isNaN(l)||s>l||(r=(l-s)/1e3)}catch(e){r=0}return r>n}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var i=e.beginTimeLimit,n=e.endTimeLimit;if(!i&&!n)return!1;var r=t._now();return!(!i||r>=new Date(i))||!(!n||new Date(n)>=r)}},{key:"parseISO8601Duration",value:function(e){return 1e3*c(e,Ne)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,operator:this._operator,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}],[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}]),t}(C);vt(ht,"_now",function(){return new Date}),vt(ht,"_getElapsedSecondsHook");var mt=ht,pt=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"skip",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and";return it(this,t),e=tt(this,t,["sequencingRule"]),vt(e,"_conditions",[]),vt(e,"_action","skip"),vt(e,"_conditionCombination","and"),e._action=i,e._conditionCombination=n,e}return at(t,e),rt(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[],this._action="skip",this._conditionCombination="and"}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!st(e,mt))throw new te(this._cmi_element+".conditions",se.TYPE_MISMATCH);this._conditions.includes(e)||this._conditions.push(e)}},{key:"removeCondition",value:function(e){if(!st(e,mt))throw new te(this._cmi_element+".conditions",se.TYPE_MISMATCH);var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"conditionCombination",get:function(){return this._conditionCombination},set:function(e){this._conditionCombination=e}},{key:"evaluate",value:function(e){return!0===(t=this._conditions.map(function(t){return t.evaluate(e)}),i=this._conditionCombination,0!==t.length&&("all"===i||"and"===i?function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!1===s)return!1;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!t||"unknown"}(t):("any"===i||"or"===i)&&function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!0===s)return!0;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!!t&&"unknown"}(t)));var t,i}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,conditionCombination:this._conditionCombination};return this.jsonString=!1,result}}]),t}(C),yt=function(e){function t(){var e;return it(this,t),e=tt(this,t,["sequencingRules"]),vt(e,"_preConditionRules",[]),vt(e,"_exitConditionRules",[]),vt(e,"_postConditionRules",[]),e}return at(t,e),rt(t,[{key:"reset",value:function(){this._initialized=!1,this._preConditionRules=[],this._exitConditionRules=[],this._postConditionRules=[]}},{key:"preConditionRules",get:function(){return this._preConditionRules}},{key:"addPreConditionRule",value:function(e){if(!st(e,pt))throw new te(this._cmi_element+".preConditionRules",se.TYPE_MISMATCH);this._preConditionRules.push(e)}},{key:"exitConditionRules",get:function(){return this._exitConditionRules}},{key:"addExitConditionRule",value:function(e){if(!st(e,pt))throw new te(this._cmi_element+".exitConditionRules",se.TYPE_MISMATCH);this._exitConditionRules.push(e)}},{key:"postConditionRules",get:function(){return this._postConditionRules}},{key:"addPostConditionRule",value:function(e){if(!st(e,pt))throw new te(this._cmi_element+".postConditionRules",se.TYPE_MISMATCH);this._postConditionRules.push(e)}},{key:"evaluatePreConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluateExitConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._exitConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluatePostConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._postConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={preConditionRules:this._preConditionRules,exitConditionRules:this._exitConditionRules,postConditionRules:this._postConditionRules};return this.jsonString=!1,result}}]),t}(C);var gt=Object.defineProperty,bt=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=t,function(e,t,i){t in e?gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="activityTree")?i+"":i,n)}return t=e,(i=[{key:"isInTree",value:function(e){return this.activityTree.getAllActivities().includes(e)}},{key:"isAncestorOf",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){if(!e||!t)return null;for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"findChildInPath",value:function(e,t){for(var i=t;i&&i.parent;){if(i.parent===e)return i;i=i.parent}return null}},{key:"isLastInTree",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"getCurrentInParent",value:function(e){if(e.children){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.isActive)return a}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return null}},{key:"isMandatory",value:function(e){if(e.sequencingRules&&e.sequencingRules.preConditionRules){var t=!0,i=!1,n=void 0;try{for(var r,o=e.sequencingRules.preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if("skip"===a.action&&a.conditions&&0===a.conditions.length)return!1}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return!0===e.mandatory}},{key:"isCompleted",value:function(e){return"completed"===e.completionStatus||"passed"===e.completionStatus||"passed"===e.successStatus}},{key:"isAvailableForChoice",value:function(e){return e.isVisible&&!e.isHiddenFromChoice&&e.isAvailable&&(!e.sequencingControls||e.sequencingControls.choice)}},{key:"getAncestors",value:function(e){for(var t=[],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"getPathToRoot",value:function(e){for(var t=[e],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"isLeaf",value:function(e){return 0===e.children.length}},{key:"isCluster",value:function(e){return e.children.length>0}},{key:"getDepth",value:function(e){for(var t=0,i=e.parent;i;)t++,i=i.parent;return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var _t=Object.defineProperty,St=function(e,t,i){return function(e,t,i){return t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},wt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),St(this,"activityTree",t),St(this,"treeQueries",i)}return t=e,i=[{key:"validateChoice",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.treeQueries.isInTree(t))return{valid:!1,exception:"SB.2.9-2"};if(t===this.activityTree.root)return{valid:!1,exception:"SB.2.9-3"};var n=this.validatePathToRoot(t);if(!n.valid)return n;if(i.checkAvailability&&!t.isAvailable)return{valid:!1,exception:"SB.2.9-7"};if(!e)return{valid:!0,exception:null};var r=this.validateChoiceExit(e,t);if(!r.valid)return r;var o=this.validateAncestorConstraints(e,t);return o.valid?{valid:!0,exception:null}:o}},{key:"validatePathToRoot",value:function(e){for(var t=e;t;){if(t.isHiddenFromChoice)return{valid:!1,exception:"SB.2.9-4"};if(t.parent&&!t.parent.sequencingControls.choice)return{valid:!1,exception:"SB.2.9-5"};if(t.parent&&t.parent.sequencingControls.preventActivation&&0===e.attemptCount&&!e.isActive)return{valid:!1,exception:"SB.2.9-6"};t=t.parent}return{valid:!0,exception:null}}},{key:"validateChoiceExit",value:function(e,t){for(var i=e.parent;i;){if(i.isActive&&!i.sequencingControls.choiceExit){if(!this.treeQueries.isAncestorOf(i,t))return{valid:!1,exception:"SB.2.9-8"};break}i=i.parent}return{valid:!0,exception:null}}},{key:"validateAncestorConstraints",value:function(e,t){for(var i=t.parent;i;){var n=this.validateConstraintsAtLevel(i,e,t);if(!n.valid)return n;i=i.parent}return{valid:!0,exception:null}}},{key:"validateConstraintsAtLevel",value:function(e,t,i){var n=this.treeQueries.findChildInPath(e,i),r=this.treeQueries.findChildInPath(e,t);if(!n||!r)return{valid:!0,exception:null};var o=e.children,a=o.indexOf(n),s=o.indexOf(r);if(-1===a||-1===s)return{valid:!0,exception:null};if(e.sequencingControls.forwardOnly&&s>a)return{valid:!1,exception:"SB.2.9-5"};if(a>s)for(var l=s+1;a>l;l++){var c=o[l];if(c&&this.treeQueries.isMandatory(c)&&!this.treeQueries.isCompleted(c))return{valid:!1,exception:"SB.2.9-6"}}if(e.sequencingControls.constrainChoice){if(a>s+1)return{valid:!1,exception:"SB.2.9-7"};if(s>a&&"completed"!==i.completionStatus&&"passed"!==i.completionStatus)return{valid:!1,exception:"SB.2.9-7"}}return e.sequencingControls.preventActivation&&0===i.attemptCount&&!i.isActive?{valid:!1,exception:"SB.2.9-6"}:{valid:!0,exception:null}}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return{valid:!1,exception:"SB.2.9-5"};t=t.parent}return{valid:!0,exception:null}}},{key:"isAvailableForChoice",value:function(e){return this.treeQueries.isAvailableForChoice(e)}},{key:"validateFlowConstraints",value:function(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;this.meetsFlowConstraints(l,e)&&i.push(l)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{valid:i.length>0,validChildren:i}}},{key:"meetsFlowConstraints",value:function(e,t){return!(!e.isAvailable||e.isHiddenFromChoice)&&(!t.sequencingControls.constrainChoice||this.validateConstrainChoiceForFlow(e,t))}},{key:"validateConstrainChoiceForFlow",value:function(e,t){if(!t.sequencingControls||!t.sequencingControls.constrainChoice)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(t.sequencingControls.flow?t.sequencingControls.forwardOnly&&o>n?"completed"===e.completionStatus||"passed"===e.completionStatus:o>n?o>n&&("completed"===e.completionStatus||"passed"===e.completionStatus)&&this.isAvailableForChoice(e):(n===o||n===o+1)&&this.isAvailableForChoice(e):this.isAvailableForChoice(e)&&("completed"===e.completionStatus||"unknown"===e.completionStatus||"incomplete"===e.completionStatus))}},{key:"validateTraversalConstraints",value:function(e){var t,i,n=!0,r=!0;return(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&(n=this.evaluateConstrainChoiceForTraversal(e)),e.sequencingControls&&e.sequencingControls.stopForwardTraversal&&(r=!1),(null===(i=e.parent)||void 0===i?void 0:i.sequencingControls.forwardOnly)&&(r=this.evaluateForwardOnlyForChoice(e)),{canTraverse:n,canTraverseInto:r}}},{key:"evaluateConstrainChoiceForTraversal",value:function(e){if(!e.parent)return!0;for(var t=e.parent;t;){if(t.sequencingControls&&t.sequencingControls.constrainChoice){var i=t.children,n=this.treeQueries.findChildInPath(t,e);if(n){var r=i.indexOf(n),o=this.treeQueries.getCurrentInParent(t);if(o){var a=i.indexOf(o);if(-1!==a&&-1!==r){if(r>a)for(var s=a+1;r>s;s++){var l=i[s];if(l&&this.treeQueries.isMandatory(l)&&!this.treeQueries.isCompleted(l))return!1}if(t.sequencingControls.forwardOnly&&a>r&&!this.treeQueries.isCompleted(e))return!1}}}}t=t.parent}return this.isAvailableForChoice(e)}},{key:"evaluateForwardOnlyForChoice",value:function(e){if(!e.parent)return!0;var t=e.parent;if(!t.sequencingControls||!t.sequencingControls.forwardOnly)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(o>n?!("completed"!==e.completionStatus&&"passed"!==e.completionStatus||!e.sequencingControls||!e.sequencingControls.choice):this.isAvailableForChoice(e))}},{key:"hasTimeBoundaryViolation",value:function(e,t){if(e.beginTimeLimit)try{if(new Date(e.beginTimeLimit)>t)return!0}catch(e){}if(e.endTimeLimit)try{if(t>new Date(e.endTimeLimit))return!0}catch(e){}return!1}},{key:"hasAttemptLimitViolation",value:function(e){return!(!e.attemptLimit||e.attemptLimit>e.attemptCount)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ot=Object.defineProperty,At=function(e,t,i){return function(e,t,i){return t in e?Ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Et=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e}(Et||{}),kt=function(e){return e.DELIVER="deliver",e.DO_NOT_DELIVER="doNotDeliver",e}(kt||{}),jt=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"doNotDeliver",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Ct(this,e),At(this,"deliveryRequest"),At(this,"targetActivity"),At(this,"exception"),At(this,"endSequencingSession"),this.deliveryRequest=t,this.targetActivity=i,this.exception=n,this.endSequencingSession=r},Rt=function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Ct(this,e),At(this,"identifiedActivity"),At(this,"deliverable"),At(this,"exception"),At(this,"endSequencingSession"),this.identifiedActivity=t,this.deliverable=i,this.exception=n,this.endSequencingSession=r},Mt=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Ct(this,e),At(this,"activity"),At(this,"exception"),this.activity=t,this.exception=i},Tt=function(e){return e.FORWARD="forward",e.BACKWARD="backward",e}(Tt||{});var xt=Object.defineProperty,It=function(e,t,i){return function(e,t,i){return t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Pt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),It(this,"now"),It(this,"getAttemptElapsedSecondsHook"),this.now=t.now||function(){return new Date},this.getAttemptElapsedSecondsHook=t.getAttemptElapsedSecondsHook||null}return t=e,(i=[{key:"checkSequencingRules",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(this.checkRuleSubprocess(e,s))return s.action}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"checkRuleSubprocess",value:function(e,t){return t.evaluate(e)}},{key:"evaluateExitRules",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.exitConditionRules);return t===ft.EXIT||t===ft.EXIT_PARENT||t===ft.EXIT_ALL?t:null}},{key:"evaluatePostConditionAction",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.postConditionRules);return t&&[ft.EXIT_PARENT,ft.EXIT_ALL,ft.RETRY,ft.RETRY_ALL,ft.CONTINUE,ft.PREVIOUS,ft.STOP_FORWARD_TRAVERSAL].includes(t)?t:null}},{key:"evaluatePostConditions",value:function(e){var t=this.evaluatePostConditionAction(e);if(!t)return{sequencingRequest:null,terminationRequest:null};switch(t){case ft.EXIT_PARENT:return{sequencingRequest:null,terminationRequest:Et.EXIT_PARENT};case ft.EXIT_ALL:return{sequencingRequest:null,terminationRequest:Et.EXIT_ALL};case ft.RETRY:return{sequencingRequest:Et.RETRY,terminationRequest:null};case ft.RETRY_ALL:return{sequencingRequest:Et.RETRY,terminationRequest:Et.EXIT_ALL};case ft.CONTINUE:return{sequencingRequest:Et.CONTINUE,terminationRequest:null};case ft.PREVIOUS:return{sequencingRequest:Et.PREVIOUS,terminationRequest:null};case ft.STOP_FORWARD_TRAVERSAL:return e.sequencingControls.stopForwardTraversal=!0,{sequencingRequest:null,terminationRequest:null};default:return{sequencingRequest:null,terminationRequest:null}}}},{key:"checkLimitConditions",value:function(e){if(null!==e.attemptLimit&&e.attemptCount>=e.attemptLimit)return!0;if(null!==e.attemptAbsoluteDurationLimit){var t=this.parseDuration(e.attemptAbsoluteDurationLimit);if(t>0&&this.parseDuration(e.attemptExperiencedDuration)>=t)return!0}if(null!==e.activityAbsoluteDurationLimit){var i=this.parseDuration(e.activityAbsoluteDurationLimit);if(i>0&&this.parseDuration(e.activityExperiencedDuration)>=i)return!0}return!1}},{key:"parseDuration",value:function(e){if(!e||"string"!=typeof e)return 0;var t=e.match(/^P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!t||"P"===e||e.endsWith("T"))return 0;var i=0;return i+=315576e5*parseFloat(t[1]||"0"),i+=30.44*24*parseFloat(t[2]||"0")*36e5,i+=6048e5*parseFloat(t[3]||"0"),i+=864e5*parseFloat(t[4]||"0"),i+=36e5*parseFloat(t[5]||"0"),(i+=6e4*parseFloat(t[6]||"0"))+1e3*parseFloat(t[7]||"0")}},{key:"getElapsedSeconds",value:function(e){if(this.getAttemptElapsedSecondsHook)try{return this.getAttemptElapsedSecondsHook(e)||0}catch(e){return 0}if(e.attemptAbsoluteStartTime){var t=new Date(e.attemptAbsoluteStartTime).getTime(),i=this.now().getTime();if(!Number.isNaN(t)&&i>t)return Math.max(0,(i-t)/1e3)}return 0}},{key:"isTimeLimitExceeded",value:function(e){var t=e.timeLimitDuration;if(!t&&e.attemptAbsoluteDurationLimit&&(t=e.attemptAbsoluteDurationLimit),!t)return!1;var i=c(t,Ne);return i>0&&this.getElapsedSeconds(e)>i}},{key:"isOutsideAvailableTimeRange",value:function(e){var t=this.now();if(e.beginTimeLimit)try{var i=new Date(e.beginTimeLimit);if(!Number.isNaN(i.getTime())&&i>t)return!0}catch(e){}if(e.endTimeLimit)try{var n=new Date(e.endTimeLimit);if(!Number.isNaN(n.getTime())&&t>n)return!0}catch(e){}return!1}},{key:"canDeliverActivity",value:function(e){if(this.checkLimitConditions(e))return{canDeliver:!1,wasSkipped:!1};var t=this.checkSequencingRules(e,e.sequencingRules.preConditionRules);return{canDeliver:t!==ft.SKIP&&t!==ft.DISABLED,wasSkipped:t===ft.SKIP}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Nt(e)}function qt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(qt=function(){return!!result})()}function Dt(e,t){return Dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Dt(e,t)}function Lt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var zt=Object.defineProperty,Ft=function(e,t,i){return function(e,t,i){return t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Lt(t))?t+"":t,i)},Bt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Bt||{}),Vt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Vt||{}),Ht=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Nt(t),n=e,!(r=qt()?Reflect.construct(t,i||[],Nt(e).constructor):t.apply(e,i))||"object"!==Lt(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencingControls"]),Ft(e,"_enabled",!0),Ft(e,"_choice",!0),Ft(e,"_choiceExit",!0),Ft(e,"_flow",!0),Ft(e,"_forwardOnly",!1),Ft(e,"_useCurrentAttemptObjectiveInfo",!0),Ft(e,"_useCurrentAttemptProgressInfo",!0),Ft(e,"_preventActivation",!1),Ft(e,"_constrainChoice",!1),Ft(e,"_stopForwardTraversal",!1),Ft(e,"_rollupObjectiveSatisfied",!0),Ft(e,"_rollupProgressCompletion",!0),Ft(e,"_objectiveMeasureWeight",1),Ft(e,"_selectionTiming","never"),Ft(e,"_selectCount",null),Ft(e,"_selectionCountStatus",!1),Ft(e,"_randomizeChildren",!1),Ft(e,"_randomizationTiming","never"),Ft(e,"_reorderChildren",!1),Ft(e,"_completionSetByContent",!1),Ft(e,"_objectiveSetByContent",!1),Ft(e,"_tracked",!0),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Dt(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._enabled=!0,this._choice=!0,this._choiceExit=!0,this._flow=!0,this._forwardOnly=!1,this._useCurrentAttemptObjectiveInfo=!0,this._useCurrentAttemptProgressInfo=!0,this._preventActivation=!1,this._constrainChoice=!1,this._stopForwardTraversal=!1,this._rollupObjectiveSatisfied=!0,this._rollupProgressCompletion=!0,this._objectiveMeasureWeight=1,this._selectionTiming="never",this._selectCount=null,this._selectionCountStatus=!1,this._randomizeChildren=!1,this._randomizationTiming="never",this._reorderChildren=!1,this._completionSetByContent=!1,this._objectiveSetByContent=!1,this._tracked=!0}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"choice",get:function(){return this._choice},set:function(e){this._choice=e}},{key:"choiceExit",get:function(){return this._choiceExit},set:function(e){this._choiceExit=e}},{key:"flow",get:function(){return this._flow},set:function(e){this._flow=e}},{key:"forwardOnly",get:function(){return this._forwardOnly},set:function(e){this._forwardOnly=e}},{key:"useCurrentAttemptObjectiveInfo",get:function(){return this._useCurrentAttemptObjectiveInfo},set:function(e){this._useCurrentAttemptObjectiveInfo=e}},{key:"useCurrentAttemptProgressInfo",get:function(){return this._useCurrentAttemptProgressInfo},set:function(e){this._useCurrentAttemptProgressInfo=e}},{key:"preventActivation",get:function(){return this._preventActivation},set:function(e){this._preventActivation=e}},{key:"constrainChoice",get:function(){return this._constrainChoice},set:function(e){this._constrainChoice=e}},{key:"stopForwardTraversal",get:function(){return this._stopForwardTraversal},set:function(e){this._stopForwardTraversal=e}},{key:"rollupObjectiveSatisfied",get:function(){return this._rollupObjectiveSatisfied},set:function(e){this._rollupObjectiveSatisfied=e}},{key:"rollupProgressCompletion",get:function(){return this._rollupProgressCompletion},set:function(e){this._rollupProgressCompletion=e}},{key:"objectiveMeasureWeight",get:function(){return this._objectiveMeasureWeight},set:function(e){0>e||(this._objectiveMeasureWeight=e)}},{key:"isChoiceNavigationAllowed",value:function(){return this._enabled&&!this._constrainChoice}},{key:"isFlowNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isForwardNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isBackwardNavigationAllowed",value:function(){return this._enabled&&this._flow&&!this._forwardOnly}},{key:"selectionTiming",get:function(){return this._selectionTiming},set:function(e){this._selectionTiming=e}},{key:"selectCount",get:function(){return this._selectCount},set:function(e){(null===e||e>0)&&(this._selectCount=e)}},{key:"selectionCountStatus",get:function(){return this._selectionCountStatus},set:function(e){this._selectionCountStatus=e}},{key:"randomizeChildren",get:function(){return this._randomizeChildren},set:function(e){this._randomizeChildren=e}},{key:"randomizationTiming",get:function(){return this._randomizationTiming},set:function(e){this._randomizationTiming=e}},{key:"reorderChildren",get:function(){return this._reorderChildren},set:function(e){this._reorderChildren=e}},{key:"completionSetByContent",get:function(){return this._completionSetByContent},set:function(e){this._completionSetByContent=e}},{key:"objectiveSetByContent",get:function(){return this._objectiveSetByContent},set:function(e){this._objectiveSetByContent=e}},{key:"tracked",get:function(){return this._tracked},set:function(e){this._tracked=e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={enabled:this._enabled,choice:this._choice,choiceExit:this._choiceExit,flow:this._flow,forwardOnly:this._forwardOnly,useCurrentAttemptObjectiveInfo:this._useCurrentAttemptObjectiveInfo,useCurrentAttemptProgressInfo:this._useCurrentAttemptProgressInfo,preventActivation:this._preventActivation,constrainChoice:this._constrainChoice,stopForwardTraversal:this._stopForwardTraversal,rollupObjectiveSatisfied:this._rollupObjectiveSatisfied,rollupProgressCompletion:this._rollupProgressCompletion,objectiveMeasureWeight:this._objectiveMeasureWeight,selectionTiming:this._selectionTiming,selectCount:this._selectCount,selectionCountStatus:this._selectionCountStatus,randomizeChildren:this._randomizeChildren,randomizationTiming:this._randomizationTiming,reorderChildren:this._reorderChildren,completionSetByContent:this._completionSetByContent,objectiveSetByContent:this._objectiveSetByContent,tracked:this._tracked};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Gt(e){return function(e){if(Array.isArray(e))return Ut(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ut(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ut(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Kt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,i=Gt(e.children);if(t.selectionTiming===Bt.NEVER)return i;if(t.selectionTiming===Bt.ONCE&&t.selectionCountStatus)return i;if(t.selectionTiming!==Bt.ONCE&&!t.selectionCountStatus)return i;var n=t.selectCount;if(null===n||n>=i.length)return t.selectionTiming===Bt.ONCE&&(t.selectionCountStatus=!0),i;for(var r=[],o=i.map(function(e,t){return t}),a=0;n>a&&0!==o.length;a++){var s=Math.floor(Math.random()*o.length),l=o[s];void 0!==l&&i[l]&&r.push(i[l]),o.splice(s,1)}t.selectionTiming===Bt.ONCE&&(t.selectionCountStatus=!0);var c=!0,u=!1,d=void 0;try{for(var v,f=i[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;r.includes(h)||(h.isHiddenFromChoice=!0,h.isAvailable=!1)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return r}},{key:"randomizeChildrenProcess",value:function(e){var t,i=e.sequencingControls,n=Gt(e.children);if(i.randomizationTiming===Vt.NEVER)return n;if(i.randomizationTiming===Vt.ONCE&&i.reorderChildren)return n;if(!i.randomizeChildren)return n;for(var r=Gt(n),o=r.length-1;o>0;o--){var a=Math.floor(Math.random()*(o+1)),s=r[o],l=r[a];s&&l&&(r[o]=l,r[a]=s)}return i.randomizationTiming===Vt.ONCE&&(i.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Gt(r)),r}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var n=!1,r=!1;i.selectionTiming===Bt.ON_EACH_NEW_ATTEMPT?(n=t,t&&(i.selectionCountStatus=!0)):i.selectionTiming===Bt.ONCE&&(n=!i.selectionCountStatus),i.randomizationTiming===Vt.ON_EACH_NEW_ATTEMPT?(r=t,t&&(i.reorderChildren=!1)):i.randomizationTiming===Vt.ONCE&&(r=!i.reorderChildren),n&&this.selectChildrenProcess(e),r&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==Bt.NEVER&&(t.selectionTiming!==Bt.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==Vt.NEVER&&(t.randomizationTiming!==Vt.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t,i),e;var t,i}();var Yt=Object.defineProperty,Wt=function(e,t,i){return function(e,t,i){return t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Jt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Wt(this,"activityTree",t),Wt(this,"ruleEngine",i)}return t=e,i=[{key:"flowSubprocess",value:function(e,t){for(var i=e,n=!0,r=!1,o=t,a=null;i;){var s=this.flowTreeTraversalSubprocess(i,o,n,a);if(!s.activity){var l=null;return s.exception?l=s.exception:t===Tt.BACKWARD?l="SB.2.1-3":r&&(l="SB.2.1-2"),new Rt(i,!1,l,s.endSequencingSession)}var c=s.direction||o;s.forwardOnlyCluster&&(a=s.forwardOnlyCluster),r=s.activity.children.length>0&&0===s.activity.getAvailableChildren().length;var u=this.flowActivityTraversalSubprocess(s.activity,c===Tt.FORWARD,!0,c);if(u)return new Rt(u,!0,null,!1);i=s.activity,o=c,n=!1}return new Rt(null,!1,null,!1)}},{key:"flowTreeTraversalSubprocess",value:function(e,t){return t===Tt.FORWARD?this.traverseForward(e,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:null):this.traverseBackward(e)}},{key:"traverseForward",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&!this.isDescendantOfOrSelf(e,i))return{activity:null,endSequencingSession:!1};if(!i&&t&&this.isActivityLastOverall(e))return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0};if(!t){this.ensureSelectionAndRandomization(e);var n=e.getAvailableChildren();if(n.length>0)return{activity:n[0]||null,endSequencingSession:!1}}for(var r=e;r;){var o=this.activityTree.getNextSibling(r);if(o)return{activity:o,endSequencingSession:!1};if(i&&(r===i||r.parent===i))return{activity:null,endSequencingSession:!1};r=r.parent}return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0}}},{key:"traverseBackward",value:function(e){if(e.parent&&e.parent.sequencingControls.forwardOnly)return{activity:null,endSequencingSession:!1,exception:"SB.2.1-4"};var t=this.activityTree.getPreviousSibling(e);if(t)return this.getBackwardTraversalEntry(t);for(var i=e,n=0;i&&i.parent;){if(++n>1e4)throw Error("Infinite loop detected in backward traversal");var r=this.activityTree.getPreviousSibling(i.parent);if(r)return this.getBackwardTraversalEntry(r);i=i.parent}return{activity:null,endSequencingSession:!1}}},{key:"getBackwardTraversalEntry",value:function(e){for(var t=e,i=0;;){if(++i>1e4)throw Error("Infinite loop detected while getting backward traversal entry");this.ensureSelectionAndRandomization(t);var n=t.getAvailableChildren();if(0===n.length)break;if(t.sequencingControls.forwardOnly)return{activity:n[0]||null,endSequencingSession:!1,direction:Tt.FORWARD,forwardOnlyCluster:t};var r=n[n.length-1];if(!r)break;t=r}return{activity:t,endSequencingSession:!1}}},{key:"isDescendantOfOrSelf",value:function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parent}return!1}},{key:"flowActivityTraversalSubprocess",value:function(e,t,i,mode){var n=e.parent;if(n&&!n.sequencingControls.flow)return null;if(!e.isAvailable)return null;if(mode===Tt.FORWARD&&e.sequencingControls.stopForwardTraversal)return null;if(i){this.ensureSelectionAndRandomization(e);var r=e.getAvailableChildren(),o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=this.flowActivityTraversalSubprocess(l.value,mode===Tt.FORWARD,!0,mode);if(u)return u}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}return 0===e.children.length&&this.checkActivityProcess(e)?e:null}},{key:"checkActivityProcess",value:function(e){if(!e.isAvailable)return!1;if(0===e.children.length&&!e.isVisible)return!1;if(this.ruleEngine.checkLimitConditions(e))return!1;var t=this.ruleEngine.canDeliverActivity(e);return e.wasSkipped=t.wasSkipped,t.canDeliver}},{key:"ensureSelectionAndRandomization",value:function(e){e.getAvailableChildren()===e.children&&(Kt.isSelectionNeeded(e)||Kt.isRandomizationNeeded(e))&&Kt.applySelectionAndRandomization(e,e.isNewAttempt)}},{key:"isActivityLastOverall",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"findFirstDeliverableActivity",value:function(e){if(0===e.children.length)return this.checkActivityProcess(e)?e:null;this.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.flowActivityTraversalSubprocess(o.value,!0,!0,Tt.FORWARD);if(s)return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"canDeliver",value:function(e){return this.checkActivityProcess(e)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Xt=Object.defineProperty,$t=function(e,t,i){return function(e,t,i){return t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Qt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$t(this,"activityTree",t),$t(this,"traversalService",i)}return t=e,(i=[{key:"handleStart",value:function(){var result=new jt;if(!this.activityTree.root)return result.exception="SB.2.5-1",result;if(this.activityTree.currentActivity)return result.exception="SB.2.5-2",result;var e=this.traversalService.findFirstDeliverableActivity(this.activityTree.root);return e?(result.deliveryRequest=kt.DELIVER,result.targetActivity=e,result):(result.exception="SB.2.5-3",result)}},{key:"handleResumeAll",value:function(){var result=new jt;return this.activityTree.suspendedActivity?this.activityTree.currentActivity?(result.exception="SB.2.6-2",result):(result.deliveryRequest=kt.DELIVER,result.targetActivity=this.activityTree.suspendedActivity,result):(result.exception="SB.2.6-1",result)}},{key:"handleContinue",value:function(e){var result=new jt;if(e.isActive)return result.exception="SB.2.7-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.7-2",result;var t=this.traversalService.flowSubprocess(e,Tt.FORWARD);return result.endSequencingSession=t.endSequencingSession,t.deliverable&&t.identifiedActivity?(result.deliveryRequest=kt.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.7-2",result)}},{key:"handlePrevious",value:function(e){var result=new jt;if(e.isActive)return result.exception="SB.2.8-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.8-2",result;var t=this.checkForwardOnlyViolation(e);if(t)return result.exception=t,result;var i=this.traversalService.flowSubprocess(e,Tt.BACKWARD);return i.deliverable&&i.identifiedActivity?(result.deliveryRequest=kt.DELIVER,result.targetActivity=i.identifiedActivity,result):(result.exception=i.exception||"SB.2.8-3",result)}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return"SB.2.9-5";t=t.parent}return null}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Zt=Object.defineProperty,ei=function(e,t,i){return function(e,t,i){return t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ti=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ei(this,"activityTree",t),ei(this,"constraintValidator",i),ei(this,"traversalService",n),ei(this,"treeQueries",r)}return t=e,i=[{key:"handleChoice",value:function(e,t){var result=new jt,i=this.activityTree.getActivity(e);if(!i)return result.exception="SB.2.9-1",result;if(t&&t.isActive)return result.exception="SB.2.9-6",result;var n=this.constraintValidator.validateChoice(t,i,{checkAvailability:!0});if(!n.valid)return result.exception=n.exception,result;var r=this.treeQueries.findCommonAncestor(t,i);t&&this.terminateDescendentAttemptsProcess(r||this.activityTree.root);var o=this.buildActivityPath(i,r),a=!0,s=!1,l=void 0;try{for(var c,u=o[Symbol.iterator]();!(a=(c=u.next()).done);a=!0)if(!this.traversalService.checkActivityProcess(c.value))return result}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}var d=i;if(i.children.length>0){var v=this.choiceFlowSubprocess(i);if(!v)return result.exception="SB.2.9-7",result;d=v}return result.deliveryRequest=kt.DELIVER,result.targetActivity=d,result}},{key:"handleJump",value:function(e){var result=new jt,t=this.activityTree.getActivity(e);return t?this.treeQueries.isInTree(t)?t.isAvailable?(result.deliveryRequest=kt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.13-3",result):(result.exception="SB.2.13-2",result):(result.exception="SB.2.13-1",result)}},{key:"getAvailableChoices",value:function(){var e=this.activityTree.getAllActivities(),t=this.activityTree.currentActivity,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l!==this.activityTree.root&&!l.isHiddenFromChoice&&l.isAvailable&&l.isVisible&&(l.parent&&!l.parent.sequencingControls.choice||this.constraintValidator.validateChoice(t,l).valid&&i.push(l))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"buildActivityPath",value:function(e,t){for(var i=[],n=e;n&&n!==t;)i.unshift(n),n=n.parent;return i}},{key:"choiceFlowSubprocess",value:function(e){return 0===e.children.length?e:this.choiceFlowTreeTraversal(e)}},{key:"choiceFlowTreeTraversal",value:function(e){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=this.constraintValidator.validateFlowConstraints(e,t);if(!i.valid)return null;var n=!0,r=!1,o=void 0;try{for(var a,s=i.validChildren[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=this.enhancedChoiceTraversal(a.value);if(l.activity)return l.activity}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return null}},{key:"enhancedChoiceTraversal",value:function(e){var t;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&e===this.activityTree.root)return new Mt(null,"SB.2.4-3");if(!e.isAvailable)return new Mt(null,null);if(e.isHiddenFromChoice)return new Mt(null,null);if(e.sequencingControls&&e.sequencingControls.stopForwardTraversal)return new Mt(null,"SB.2.4-1");var i=this.constraintValidator.validateTraversalConstraints(e);if(!i.canTraverse)return new Mt(null,null);if(0===e.children.length)return this.traversalService.checkActivityProcess(e)?new Mt(e,null):new Mt(null,null);if((null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&!i.canTraverseInto)return new Mt(null,"SB.2.4-2");if(i.canTraverseInto){var n=this.choiceFlowTreeTraversal(e);return new Mt(n,null)}return new Mt(null,null)}},{key:"terminateDescendentAttemptsProcess",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttemptsProcess(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ii=Object.defineProperty,ni=function(e,t,i){return function(e,t,i){return t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ri=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ni(this,"activityTree",t),ni(this,"ruleEngine",i)}return t=e,i=[{key:"handleExit",value:function(e){var result=new jt;return e.parent?e.parent.sequencingControls.choiceExit?(this.terminateDescendentAttempts(e),result):(result.exception="SB.2.11-2",result):(result.exception="SB.2.11-1",result)}},{key:"handleExitAll",value:function(){var result=new jt;return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),result}},{key:"handleAbandon",value:function(e){var result=new jt;return e.isActive=!1,this.activityTree.currentActivity=e.parent,result}},{key:"handleAbandonAll",value:function(){var result=new jt;return this.activityTree.currentActivity=null,result}},{key:"handleSuspendAll",value:function(e){var result=new jt;return e===this.activityTree.root?(result.exception="SB.2.15-1",result):(e.isSuspended=!0,this.activityTree.suspendedActivity=e,this.activityTree.currentActivity=null,result)}},{key:"terminateDescendentAttempts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;t||(i=this.ruleEngine.evaluateExitRules(e)),e.isActive=!1;var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.terminateDescendentAttempts(a.value,t)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}i&&!t&&this.processDeferredExitAction(i,e)}},{key:"processDeferredExitAction",value:function(e,t){switch(e){case ft.EXIT:break;case ft.EXIT_PARENT:t.parent&&t.parent.isActive&&this.terminateDescendentAttempts(t.parent,!0);break;case ft.EXIT_ALL:this.activityTree.root&&this.activityTree.root!==t&&this.activityTree.getAllActivities().some(function(e){return e.isActive})&&this.terminateDescendentAttempts(this.activityTree.root,!0)}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var oi=Object.defineProperty,ai=function(e,t,i){return function(e,t,i){return t in e?oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},si=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ai(this,"activityTree",t),ai(this,"traversalService",i)}return t=e,(i=[{key:"handleRetry",value:function(e){var result=new jt;if(e.isActive||e.isSuspended)return result.exception="SB.2.10-2",result;if(e.children.length>0){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=null,n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&!(i=this.traversalService.flowActivityTraversalSubprocess(a.value,!0,!0,Tt.FORWARD));n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i?(result.deliveryRequest=kt.DELIVER,result.targetActivity=i,result):(result.exception="SB.2.10-3",result)}return this.terminateDescendentAttempts(e),result.deliveryRequest=kt.DELIVER,result.targetActivity=e,result}},{key:"handleRetryAll",value:function(){if(this.activityTree.currentActivity=null,!this.activityTree.root){var e=new jt;return e.exception="SB.2.10-1",e}var t=this.traversalService.findFirstDeliverableActivity(this.activityTree.root),result=new jt;return t?(result.deliveryRequest=kt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.10-3",result)}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var li=Object.defineProperty,ci=function(e,t,i){return function(e,t,i){return t in e?li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ui=function(){function e(t,i,n){var r=arguments.length>4?arguments[4]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ci(this,"activityTree"),ci(this,"treeQueries"),ci(this,"constraintValidator"),ci(this,"ruleEngine"),ci(this,"traversalService"),ci(this,"flowHandler"),ci(this,"choiceHandler"),ci(this,"exitHandler"),ci(this,"retryHandler"),ci(this,"_now"),ci(this,"_getAttemptElapsedSecondsHook"),this.activityTree=t,this._now=(null==r?void 0:r.now)||function(){return new Date},this._getAttemptElapsedSecondsHook=null==r?void 0:r.getAttemptElapsedSeconds,this.treeQueries=new bt(t),this.ruleEngine=new Pt({now:this._now,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.constraintValidator=new wt(t,this.treeQueries),this.traversalService=new Jt(t,this.ruleEngine),this.flowHandler=new Qt(t,this.traversalService),this.choiceHandler=new ti(t,this.constraintValidator,this.traversalService,this.treeQueries),this.exitHandler=new ri(t,this.ruleEngine),this.retryHandler=new si(t,this.traversalService)}return t=e,i=[{key:"now",get:function(){return this._now},set:function(e){this._now=e,mt.setNowProvider(e),this.ruleEngine=new Pt({now:e,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.traversalService=new Jt(this.activityTree,this.ruleEngine),this.flowHandler=new Qt(this.activityTree,this.traversalService),this.choiceHandler=new ti(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new si(this.activityTree,this.traversalService)}},{key:"getAttemptElapsedSecondsHook",get:function(){return this._getAttemptElapsedSecondsHook},set:function(e){this._getAttemptElapsedSecondsHook=e,mt.setElapsedSecondsHook(e),this.ruleEngine=new Pt({now:this._now,getAttemptElapsedSecondsHook:e}),this.traversalService=new Jt(this.activityTree,this.ruleEngine),this.flowHandler=new Qt(this.activityTree,this.traversalService),this.choiceHandler=new ti(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new si(this.activityTree,this.traversalService)}},{key:"sequencingRequestProcess",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=this.activityTree.currentActivity;switch(request){case Et.START:return this.flowHandler.handleStart();case Et.RESUME_ALL:return this.flowHandler.handleResumeAll();case Et.CONTINUE:return t?this.flowHandler.handleContinue(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.PREVIOUS:return t?this.flowHandler.handlePrevious(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.CHOICE:return e?this.choiceHandler.handleChoice(e,t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-5");case Et.JUMP:return e?this.choiceHandler.handleJump(e):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-5");case Et.EXIT:return t?this.exitHandler.handleExit(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.EXIT_ALL:return t?this.exitHandler.handleExitAll():new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.ABANDON:return t?this.exitHandler.handleAbandon(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.ABANDON_ALL:return t?this.exitHandler.handleAbandonAll():new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.SUSPEND_ALL:return t?this.exitHandler.handleSuspendAll(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.RETRY:return t?this.retryHandler.handleRetry(t):new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-1");case Et.RETRY_ALL:return this.retryHandler.handleRetryAll();default:return new jt(kt.DO_NOT_DELIVER,null,"SB.2.12-6")}}},{key:"evaluatePostConditionRules",value:function(e){return this.ruleEngine.evaluatePostConditions(e)}},{key:"canActivityBeDelivered",value:function(e){return this.traversalService.canDeliver(e)}},{key:"validateNavigationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!Object.values(Et).includes(request))return{valid:!1,exception:"SB.2.12-6"};switch(request){case Et.CONTINUE:case Et.PREVIOUS:if(!t)return{valid:!1,exception:"SB.2.12-1"};if(t.isActive)return{valid:!1,exception:request===Et.CONTINUE?"SB.2.7-1":"SB.2.8-1"};if(t.parent&&!t.parent.sequencingControls.flow)return{valid:!1,exception:request===Et.CONTINUE?"SB.2.7-2":"SB.2.8-2"};if(request===Et.PREVIOUS){var i=this.constraintValidator.checkForwardOnlyViolation(t);if(!i.valid)return i}break;case Et.CHOICE:if(!e)return{valid:!1,exception:"SB.2.12-5"};var n=this.activityTree.getActivity(e);if(!n)return{valid:!1,exception:"SB.2.9-1"};var r=this.constraintValidator.validateChoice(t,n,{checkAvailability:!0});if(!r.valid)return r;if(!this.traversalService.canDeliver(n))return{valid:!1,exception:"SB.2.9-6"};if(this.ruleEngine.checkSequencingRules(n,n.sequencingRules.preConditionRules)===ft.HIDE_FROM_CHOICE)return{valid:!1,exception:"SB.2.9-4"};break;case Et.JUMP:if(!e)return{valid:!1,exception:"SB.2.12-5"};if(!this.activityTree.getActivity(e))return{valid:!1,exception:"SB.2.13-1"}}return{valid:!0,exception:null}}},{key:"getAvailableChoices",value:function(){return this.choiceHandler.getAvailableChoices()}},{key:"getTreeQueries",value:function(){return this.treeQueries}},{key:"getConstraintValidator",value:function(){return this.constraintValidator}},{key:"getRuleEngine",value:function(){return this.ruleEngine}},{key:"getTraversalService",value:function(){return this.traversalService}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function di(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var vi=Object.defineProperty,fi=function(e,t,i){return function(e,t,i){return t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},hi=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fi(this,"eventService"),fi(this,"loggingService"),fi(this,"callbacks"),fi(this,"currentDeliveredActivity",null),fi(this,"pendingDelivery",null),this.eventService=t,this.loggingService=i,this.callbacks=n}return t=e,i=[{key:"processSequencingResult",value:function(result){var e,t,i,n;if(result.exception)return this.loggingService.error("Sequencing error: ".concat(result.exception)),void(null===(i=(n=this.callbacks).onSequencingError)||void 0===i||i.call(n,result.exception));result.deliveryRequest===kt.DELIVER&&result.targetActivity?this.deliverActivity(result.targetActivity):this.loggingService.info("Sequencing completed with no delivery request"),null===(e=(t=this.callbacks).onSequencingComplete)||void 0===e||e.call(t,result)}},{key:"deliverActivity",value:function(e){var t,i;this.currentDeliveredActivity!==e?(this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.pendingDelivery=e,this.loggingService.info("Delivering activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityDelivery",e.id,e),null===(t=(i=this.callbacks).onDeliverActivity)||void 0===t||t.call(i,e),this.currentDeliveredActivity=e,this.pendingDelivery=null,e.isActive=!0):this.loggingService.info("Skipping delivery - activity already delivered: ".concat(e.id))}},{key:"unloadActivity",value:function(e){var t,i;this.loggingService.info("Unloading activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityUnload",e.id,e),null===(t=(i=this.callbacks).onUnloadActivity)||void 0===t||t.call(i,e),e.isActive=!1}},{key:"getCurrentDeliveredActivity",value:function(){return this.currentDeliveredActivity}},{key:"getPendingDelivery",value:function(){return this.pendingDelivery}},{key:"updateCallbacks",value:function(e){this.callbacks=function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){di(e,t,i[t])})}return e}({},this.callbacks,e)}},{key:"reset",value:function(){this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.currentDeliveredActivity=null,this.pendingDelivery=null}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function mi(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function pi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){mi(o,n,r,a,s,"next",e)}function s(e){mi(o,n,r,a,s,"throw",e)}a(void 0)})}}function yi(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function gi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function bi(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){yi(e,t,i[t])})}return e}function _i(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var Si=Object.defineProperty,wi=function(e,t,i){return function(e,t,i){return t in e?Si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ci=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),wi(this,"reportsRequestCompletion",!0),wi(this,"settings"),wi(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){return this._performAsyncRequest(e,t,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0),{result:z,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,i,n,r,o,a){return pi(function(){var s,l,c,result,u,d;return _i(this,function(v){switch(v.label){case 0:return v.trys.push([0,6,7,8]),s=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),l=s,i&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,l)]:[3,2];case 1:return c=v.sent(),[3,4];case 2:return[4,this.performFetch(e,l)];case 3:c=v.sent(),v.label=4;case 4:return[4,this.transformResponse(c,r)];case 5:return result=v.sent(),this._isSuccessResponse(c,result)?r("CommitSuccess"):r("CommitError",void 0,result.errorCode),[3,8];case 6:return u=v.sent(),d=gi(u,Error)?u.message:u+"",n("processHttpRequest","Async request failed: ".concat(d),Oe.ERROR),r("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==a||a(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:gi(e,Array)?e.join("&"):JSON.stringify(e),contentType:gi(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return pi(function(){var i,n,r;return _i(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(i=this._prepareRequestBody(t),n=i.contentType,r={method:"POST",mode:this.settings.fetchMode,body:i.body,headers:(a=bi({},this.settings.xhrHeaders),s={"Content-Type":n},s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),keepalive:!0},this.settings.xhrWithCredentials&&(r.credentials="include"),[2,fetch(e,r)]);var a,s})}).call(this)}},{key:"performBeacon",value:function(e,t){return pi(function(){var i,n,r,o,a,s;return _i(this,function(l){return i=this,n=this._prepareRequestBody(t),r=n.body,o=n.contentType,this._warnIfBeaconContentTypeUnsafe(e,a=Array.isArray(t)?o:this.settings.terminationCommitContentType),s=navigator.sendBeacon(e,new Blob([r],{type:a})),[2,Promise.resolve({status:s?200:0,ok:s,json:function(){return pi(function(){return _i(this,function(e){return[2,{result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(i)},text:function(){return pi(function(){return _i(this,function(e){return[2,JSON.stringify({result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(i)}})]})}).call(this)}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var i,n;a(e)&&!o(t)&&(null===(i=(n=this.settings).onLogMessage)||void 0===i||i.call(n,Oe.WARN,'sendBeacon to cross-origin URL with non-CORS-safelisted Content-Type "'.concat(t,'" may be silently dropped by the browser (Beacon cannot preflight). Use fetch (useAsynchronousCommits + asyncModeBeaconBehavior:"never") for cross-origin JSON/auth on terminate.')))}},{key:"transformResponse",value:function(e,t){return pi(function(){var result,t,i,n;return _i(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=r.sent(),[3,4];case 2:return[4,e.json()];case 3:t=r.sent(),r.label=4;case 4:return result=t,[3,7];case 5:return i=r.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return n=r.sent(),[2,{result:F,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(gi(i,Error)?i.message:i+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:n.substring(0,500),parseError:gi(i,Error)?i.message:i+""})}];case 7:return Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this._isSuccessResponse(e,result)?0:this.error_codes.GENERAL_COMMIT_FAILURE||391),this._isSuccessResponse(e,result)||(result.errorDetails=bi({status:e.status,statusText:e.statusText,url:e.url},result.errorDetails)),[2,result]}})}).call(this)}},{key:"_isSuccessResponse",value:function(e,result){var t=result.result;return!(200>e.status||e.status>299||!0!==t&&"true"!==t&&t!==z)}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Oi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ai=Object.defineProperty,Ei="{target=";function ki(e,t){var i,n=e[t];return void 0===n?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(i=e.GENERAL)&&void 0!==i?i:0):n}var ji=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"getUndefinedDataModelErrorCode",value:function(){return ki(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,i,n){if(!i||""===i)return t&&this.context.throwSCORMError(i,ki(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),F;this.context.setLastErrorCode("0");for(var r=i.split("."),o=this.context.getDataModel(),a=F,s=!1,l="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),u=0;r.length>u;u++){if(u===r.length-1){a=this.setFinalAttribute(o,r[u],n,i,t,c,l);break}var d=this.traverseToNextLevel(o,r,u,n,i,t,s,c,l);if(d.error)break;o=d.refObject,u=d.idx,s=d.foundFirstIndex}return a===F&&this.context.apiLog(e,"There was an error setting the value for: ".concat(i,", value of: ").concat(n),Oe.WARN),a}},{key:"getCMIValue",value:function(e,t,i){if(!i||""===i)return t&&this.context.throwSCORMError(i,ki(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&i.endsWith("._version")&&"cmi._version"!==i)return this.context.throwSCORMError(i,ki(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var n=i.split("."),r=this.context.getDataModel(),o=null,a="The data model element passed to ".concat(e," (").concat(i,") has not been initialized."),s="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),c=0;n.length>c;c++){var u=this.validateGetAttribute(r,o=n[c],i,t,l,s,c===n.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(i,l,s);break}if(void 0===(r=r[o])){this.context.throwSCORMError(i,l,s);break}if(Oi(r,he)){var d=this.handleGetArrayAccess(r,n,c,i,a);if(d.error)return"";r=d.refObject,c=d.idx}}return null==r?(t||("_children"===o?this.context.throwSCORMError(i,ki(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(i,ki(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):r}},{key:"setFinalAttribute",value:function(e,t,i,n,r,o,a){return r&&(null==t?void 0:t.startsWith(Ei))?this.context.isInitialized()?(this.context.throwSCORMError(n,ki(this.context.errorCodes,"READ_ONLY_ELEMENT")),F):z:void 0!==t&&this.context.checkObjectHasProperty(e,t)?v(n,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(n,i),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(n,ki(this.context.errorCodes,"TYPE_MISMATCH")),F):r&&"0"!==this.context.getLastErrorCode()?F:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(n,o,a),F):r&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(n,i)?(this.context.throwSCORMError(n,ki(this.context.errorCodes,"GENERAL_SET_FAILURE")),F):(e[t]=i,z):(this.context.throwSCORMError(n,o,a),F)}},{key:"traverseToNextLevel",value:function(e,t,i,n,r,o,a,s,l){var c=t[i];if(void 0===c||!this.context.checkObjectHasProperty(e,c))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(!(e=e[c]))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(Oi(e,he)){var u=this.handleSetArrayAccess(e,t,i,n,r,o,a,s,l);return u.error?{refObject:e,idx:i,foundFirstIndex:a,error:!0}:u}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,i,n,r,o,a,s,l){var c=parseInt(t[i+1]||"0",10);if(!isNaN(c)){var u=e.childArray[c];if(u)return{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1};if(c>e.childArray.length){var d=o?ki(this.context.errorCodes,"GENERAL_SET_FAILURE"):ki(this.context.errorCodes,"INVALID_SET_VALUE")||ki(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(r,d,"Cannot set array element at index ".concat(c,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:i,foundFirstIndex:a,error:!0}}var v=this.context.getChildElement(r,n,a);return v?(e.initialized&&v.initialize(),e.childArray[c]=v,{refObject:v,idx:i+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0})}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"validateGetAttribute",value:function(e,t,i,n,r,o,a){if(n){var s=t+"";if(s.startsWith(Ei)&&"function"==typeof e._isTargetValid){var l=s.substring(8,s.length-1);return{error:!1,returnValue:e._isTargetValid(l)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(i,ki(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(i,ki(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element is not a collection and therefore does not have a count"),{error:!0}):(this.context.throwSCORMError(i,r,o),{error:!0})}else if(a&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(i,ki(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(i,ki(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(i,r,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,i,n,r){var o=parseInt(t[i+1]||"",10);if(!isNaN(o)){var a=e.childArray[o];return a?{refObject:a,idx:i+1,error:!1}:(this.context.throwSCORMError(n,ki(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),r),{refObject:e,idx:i,error:!0})}return{refObject:e,idx:i,error:!1}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ri(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Mi=Object.defineProperty,Ti=function(e,t,i){return function(e,t,i){return t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},xi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ti(this,"_logLevel",Oe.ERROR),Ti(this,"_logHandler"),this._logHandler=ke}var t,i,n;return t=e,n=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(i=[{key:"setLogLevel",value:function(e){this._logLevel=e}},{key:"getLogLevel",value:function(){return this._logLevel}},{key:"setLogHandler",value:function(e){this._logHandler=e}},{key:"log",value:function(e,t){this.shouldLog(e)&&this._logHandler(e,t)}},{key:"error",value:function(e){this.log(Oe.ERROR,e)}},{key:"warn",value:function(e){this.log(Oe.WARN,e)}},{key:"info",value:function(e){this.log(Oe.INFO,e)}},{key:"debug",value:function(e){this.log(Oe.DEBUG,e)}},{key:"shouldLog",value:function(e){return this.getNumericLevel(e)>=this.getNumericLevel(this._logLevel)}},{key:"getNumericLevel",value:function(e){if(void 0===e)return Oe.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return Oe.DEBUG;case"2":case"INFO":return Oe.INFO;case"3":case"WARN":return Oe.WARN;case"4":case"ERROR":default:return Oe.ERROR;case"5":case"NONE":return Oe.NONE}}}])&&Ri(t.prototype,i),n&&Ri(t,n),e}();Ti(xi,"_instance");var Ii=xi;function Pi(){return Ii.getInstance()}function Ni(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var qi=Object.defineProperty,Di=function(e,t,i){return function(e,t,i){return t in e?qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Li=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Di(this,"_lastErrorCode","0"),Di(this,"_lastDiagnostic",""),Di(this,"_errorCodes"),Di(this,"_apiLog"),Di(this,"_getLmsErrorMessageDetails"),Di(this,"_loggingService"),this._errorCodes=t,this._apiLog=i,this._getLmsErrorMessageDetails=n,this._loggingService=r||Pi()}return t=e,i=[{key:"lastErrorCode",get:function(){return this._lastErrorCode},set:function(e){this._lastErrorCode=e}},{key:"lastDiagnostic",get:function(){return this._lastDiagnostic}},{key:"throwSCORMError",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oe.ERROR;this._lastDiagnostic=i||"",i||(i=this._getLmsErrorMessageDetails(t,!0));var r="SCORM Error ".concat(t,": ").concat(i).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+i,n,e),this._loggingService.log(n,r),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==F&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,i){if(Ni(t,L)){var n=t;this._lastErrorCode=n.errorCode+"",this._lastDiagnostic="";var r="Validation Error ".concat(n.errorCode,": ").concat(n.message," [Element: ").concat(e,"]");this._loggingService.warn(r),i=F}else if(Ni(t,Error)){var o=t.constructor.name,a="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),s=t.stack||"";this._loggingService.error("".concat(a,"\n").concat(s)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),i=F}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var l=JSON.stringify(t);this._loggingService.error("Error details: ".concat(l))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),i=F}return i}},{key:"errorCodes",get:function(){return this._errorCodes}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var zi=Object.defineProperty,Fi=function(e,t,i){return function(e,t,i){return t in e?zi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Bi=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Fi(this,"listenerMap",new Map),Fi(this,"listenerCount",0),Fi(this,"apiLog"),this.apiLog=t}return t=e,(i=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),i=t[0],n=null;return t.length>1&&(n=e.replace("".concat(i,"."),"")),{functionName:null!=i?i:e,CMIElement:n}}},{key:"on",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l,c=this.parseListenerName(a.value);if(c){var u=c.functionName,d=c.CMIElement,v=null!==(l=this.listenerMap.get(u))&&void 0!==l?l:[];v.push({functionName:u,CMIElement:d,callback:t}),this.listenerMap.set(u,v),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),Oe.INFO,u)}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}}},{key:"off",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s,l=function(){var e=a.parseListenerName(s.value);if(!e)return"continue";var i=e.functionName,n=e.CMIElement,r=a.listenerMap.get(i);if(!r)return"continue";var o=r.findIndex(function(e){return e.CMIElement===n&&e.callback===t});-1!==o&&(r.splice(o,1),a.listenerCount--,0===r.length&&a.listenerMap.delete(i),a.apiLog("off","Removed event listener: ".concat(a.listenerCount),Oe.INFO,i))},c=i[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)a=this,l()}catch(e){r=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),i=!0,n=!1,r=void 0;try{for(var o,a,s=function(){var e=o.parseListenerName(a.value);if(!e)return"continue";var t=e.functionName,i=e.CMIElement;if(o.listenerMap.has(t)){var n=o.listenerMap.get(t),r=null===i?[]:n.filter(function(e){return e.CMIElement!==i});o.listenerCount-=n.length-r.length,0===r.length?o.listenerMap.delete(t):o.listenerMap.set(t,r)}},l=t[Symbol.iterator]();!(i=(a=l.next()).done);i=!0)o=this,s()}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}}},{key:"processListeners",value:function(e,t,i,n){this.apiLog(e,i,Oe.INFO,t);var r=this.listenerMap.get(e);if(r){var o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!!u.CMIElement,v=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var f=u.CMIElement.slice(0,-1);v=t.startsWith(f)}else v=u.CMIElement===t;d&&!v||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),Oe.DEBUG,t),e.startsWith("Sequence")?u.callback(i):"CommitError"===e?void 0!==n?u.callback(i,n):u.callback(i):"CommitSuccess"===e?void 0!==n?u.callback(n):u.callback():u.callback(t,i))}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Vi(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Hi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Vi(o,n,r,a,s,"next",e)}function s(e){Vi(o,n,r,a,s,"throw",e)}a(void 0)})}}function Ui(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Gi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ki(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Ui(e,t,i[t])})}return e}function Yi(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var Wi=Object.defineProperty,Ji=function(e,t,i){return function(e,t,i){return t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xi=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ji(this,"apiLog",n),Ji(this,"settings"),Ji(this,"error_codes"),Ji(this,"storeName","scorm_again_offline_data"),Ji(this,"syncQueue","scorm_again_sync_queue"),Ji(this,"isOnline",navigator.onLine),Ji(this,"syncInProgress",!1),Ji(this,"boundOnlineStatusChangeHandler"),Ji(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=i,this.boundOnlineStatusChangeHandler=this.handleOnlineStatusChange.bind(this),this.boundCustomNetworkStatusHandler=this.handleCustomNetworkStatus.bind(this),window.addEventListener("online",this.boundOnlineStatusChangeHandler),window.addEventListener("offline",this.boundOnlineStatusChangeHandler),window.addEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}return t=e,(i=[{key:"handleOnlineStatusChange",value:function(){var e=this,t=this.isOnline;this.isOnline=navigator.onLine,!t&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Oe.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",Oe.INFO):e.apiLog("OfflineStorageService","Sync failed",Oe.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),Oe.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Oe.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(Gi(e,CustomEvent)){var i=e.detail.online;if("boolean"==typeof i){var n=this.isOnline;this.isOnline=i,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(i?"online":"offline"),Oe.INFO),!n&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Oe.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",Oe.INFO):t.apiLog("OfflineStorageService","Sync failed",Oe.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),Oe.ERROR)})):n&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Oe.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",Oe.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",Oe.WARN)}},{key:"storeOffline",value:function(e,t,i){try{var n=Ki({id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9)),courseId:e,timestamp:Date.now(),data:t,syncAttempts:0},void 0!==(null==i?void 0:i.isTerminateCommit)?{isTerminateCommit:i.isTerminateCommit}:{},void 0!==(null==i?void 0:i.sequence)?{sequence:i.sequence}:{}),r=this.getFromStorage(this.syncQueue)||[];return r.push(n),this.saveToStorage(this.syncQueue,r),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),Oe.INFO),{result:z,errorCode:0}}catch(t){var o,a=(Gi(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",a?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),Oe.ERROR),{result:F,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return Hi(function(){return Yi(this,function(t){try{return[2,this.getFromStorage("".concat(this.storeName,"_").concat(e))||null]}catch(e){return this.apiLog("OfflineStorageService","Error retrieving offline data: ".concat(e),Oe.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return Hi(function(){var e,t,i,n,r,o,a,s,l,c,u,d,v,f;return Yi(this,function(h){switch(h.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,h.label=1;case 1:if(h.trys.push([1,12,,13]),0===(e=this.getFromStorage(this.syncQueue)||[]).length)return this.syncInProgress=!1,[2,!0];this.apiLog("OfflineStorageService","Found ".concat(e.length," items to sync"),Oe.INFO),t=[],i=!0,n=!1,r=void 0,h.label=2;case 2:h.trys.push([2,9,10,11]),o=e[Symbol.iterator](),h.label=3;case 3:if(i=(a=o.next()).done)return[3,8];if(c=null!==(l=this.settings.maxSyncAttempts)&&void 0!==l?l:5,(s=a.value).syncAttempts>=c)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(s.id," after ").concat(c," failed sync attempts"),Oe.WARN),[3,7];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.sendDataToLMS(s.data,Ki({},void 0!==s.isTerminateCommit?{isTerminateCommit:s.isTerminateCommit}:{},void 0!==s.sequence?{sequence:s.sequence}:{}))];case 5:return!0===(u=h.sent()).result||u.result===z?this.apiLog("OfflineStorageService","Successfully synced item ".concat(s.id),Oe.INFO):(s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Failed to sync item ".concat(s.id,", attempt #").concat(s.syncAttempts),Oe.WARN)),[3,7];case 6:return d=h.sent(),s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Error syncing item ".concat(s.id,": ").concat(d),Oe.ERROR),[3,7];case 7:return i=!0,[3,3];case 8:return[3,11];case 9:return v=h.sent(),n=!0,r=v,[3,11];case 10:try{i||null==o.return||o.return()}finally{if(n)throw r}return[7];case 11:return this.saveToStorage(this.syncQueue,t),this.apiLog("OfflineStorageService","Sync completed. ".concat(e.length-t.length," items synced, ").concat(t.length," items remaining"),Oe.INFO),this.syncInProgress=!1,[2,!0];case 12:return f=h.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(f),Oe.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return Hi(function(){var i,n,r,o,a,s,l,result,c,u;return Yi(this,function(d){switch(d.label){case 0:if(!(i=this.settings.lmsCommitUrl))return[2,{result:F,errorCode:this.error_codes.GENERAL||101}];d.label=1;case 1:return d.trys.push([1,7,,8]),r=i+"",o=this.settings.requestHandler(e,Ki({isTerminateCommit:null!==(n=null==t?void 0:t.isTerminateCommit)&&void 0!==n&&n,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),a=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?h(r,this.settings.terminateCommitParam,"true"):r,s={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(v=Ki({},this.settings.xhrHeaders),f={"Content-Type":this.settings.commitRequestDataType},f=null!=f?f:{},Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(f)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(f)).forEach(function(e){Object.defineProperty(v,e,Object.getOwnPropertyDescriptor(f,e))}),v)},this.settings.xhrWithCredentials&&(s.credentials="include"),[4,fetch(a,s)];case 2:return l=d.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(l)];case 3:return c=d.sent(),[3,6];case 4:return[4,l.json()];case 5:c=d.sent(),d.label=6;case 6:return result=c,200>l.status||l.status>299||!0!==result.result&&result.result!==z?(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this.error_codes.GENERAL),[2,result]):(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=0),[2,result]);case 7:return u=d.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(u),Oe.ERROR),[2,{result:F,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var v,f})}).call(this)}},{key:"isDeviceOnline",value:function(){return this.isOnline}},{key:"getFromStorage",value:function(e){var t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return null}return null}},{key:"saveToStorage",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){if(Gi(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return Hi(function(){return Yi(this,function(t){return[2,(this.getFromStorage(this.syncQueue)||[]).some(function(t){return t.courseId===e})]})}).call(this)}},{key:"updateSettings",value:function(e){this.settings=e}},{key:"destroy",value:function(){window.removeEventListener("online",this.boundOnlineStatusChangeHandler),window.removeEventListener("offline",this.boundOnlineStatusChangeHandler),window.removeEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),$i=f(function(e,t,i,n,r,o){if("string"!=typeof t)return!1;var a=RegExp(i),s=t.match(a);if(o&&""===t)return!0;if(!s||""===s[0])throw new r(e,n);return!0},function(e,t,i,n,r,o){var a,s="string"==typeof t?t:"[".concat(void 0===t?"undefined":(a=t)&&"undefined"!=typeof Symbol&&a.constructor===Symbol?"symbol":typeof a,"]");return"".concat(e,":").concat(s,":").concat(i,":").concat(n,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),Qi=f(function(e,t,i,n,r){var o=i.split("#");if(isNaN(t=+t))throw new r(e,n);var a=o[0],s=o[1],l=void 0!==s&&""!==s&&"*"!==s;if(void 0!==a&&""!==a&&+a>t)throw new r(e,n);if(l&&t>+s)throw new r(e,n);return!0},function(e,t,i,n,r){return"".concat(e,":").concat(t,":").concat(i,":").concat(n)},{maxEntries:1e3});function Zi(e,t,i,n){return $i(e,t,i,se.TYPE_MISMATCH,te,n)}function en(e,t,i){return Qi(e,t,i,se.VALUE_OUT_OF_RANGE,te)}function tn(e,t,i){return t=an(t),n=e,!(r=cn()?Reflect.construct(t,i||[],an(e).constructor):t.apply(e,i))||"object"!==dn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rn(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function an(e){return an=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},an(e)}function sn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&un(e,t)}function ln(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function cn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(cn=function(){return!!result})()}function un(e,t){return un=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},un(e,t)}function dn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var vn=Object.defineProperty,fn=function(e,t,i){return function(e,t,i){return t in e?vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":dn(t))?t+"":t,i)},hn=function(e){return e.SATISFIED="satisfied",e.NOT_SATISFIED="notSatisfied",e.COMPLETED="completed",e.INCOMPLETE="incomplete",e}(hn||{}),mn=function(e){return e.ALL="all",e.ANY="any",e.NONE="none",e.AT_LEAST_COUNT="atLeastCount",e.AT_LEAST_PERCENT="atLeastPercent",e}(mn||{}),pn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return nn(this,t),e=tn(this,t,["rollupCondition"]),fn(e,"_condition","always"),fn(e,"_parameters",new Map),e._condition=i,e._parameters=n,e}return sn(t,e),rn(t,[{key:"reset",value:function(){this._initialized=!1}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"evaluate",value:function(e){switch(this._condition){case"satisfied":return!0===e.objectiveSatisfiedStatus||e.successStatus===ge;case"objectiveStatusKnown":return e.objectiveSatisfiedStatusKnown;case"objectiveMeasureKnown":return e.objectiveMeasureStatus;case"objectiveMeasureGreaterThan":var t=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&e.objectiveNormalizedMeasure>t;case"objectiveMeasureLessThan":var i=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&i>e.objectiveNormalizedMeasure;case"completed":return e.isCompleted;case"progressKnown":return e.completionStatus!==Ce;case"attempted":return e.attemptCount>0;case"notAttempted":return 0===e.attemptCount;case"always":return!0;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}]),t}(C),yn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"satisfied",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return nn(this,t),e=tn(this,t,["rollupRule"]),fn(e,"_conditions",[]),fn(e,"_action","satisfied"),fn(e,"_consideration","all"),fn(e,"_minimumCount",0),fn(e,"_minimumPercent",0),e._action=i,e._consideration=n,e._minimumCount=r,e._minimumPercent=o,e}return sn(t,e),rn(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[]}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!ln(e,pn))throw new te(this._cmi_element+".conditions",se.TYPE_MISMATCH);this._conditions.push(e)}},{key:"removeCondition",value:function(e){var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"consideration",get:function(){return this._consideration},set:function(e){this._consideration=e}},{key:"minimumCount",get:function(){return this._minimumCount},set:function(e){0>e||(this._minimumCount=e)}},{key:"minimumPercent",get:function(){return this._minimumPercent},set:function(e){0>e||e>100||(this._minimumPercent=e)}},{key:"evaluate",value:function(e){var t=this;if(0===e.length)return!1;var i=e.filter(function(e){return t._conditions.every(function(t){return t.evaluate(e)})});switch(this._consideration){case"all":return i.length===e.length;case"any":return i.length>0;case"none":return 0===i.length;case"atLeastCount":return i.length>=this._minimumCount;case"atLeastPercent":return i.length/e.length*100>=this._minimumPercent;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,consideration:this._consideration,minimumCount:this._minimumCount,minimumPercent:this._minimumPercent};return this.jsonString=!1,result}}]),t}(C),gn=function(e){function t(){var e;return nn(this,t),e=tn(this,t,["rollupRules"]),fn(e,"_rules",[]),e}return sn(t,e),rn(t,[{key:"reset",value:function(){this._initialized=!1,this._rules=[]}},{key:"rules",get:function(){return this._rules}},{key:"addRule",value:function(e){if(!ln(e,yn))throw new te(this._cmi_element+".rules",se.TYPE_MISMATCH);this._rules.push(e)}},{key:"removeRule",value:function(e){var t=this._rules.indexOf(e);return-1!==t&&(this._rules.splice(t,1),!0)}},{key:"processRollup",value:function(e){if(e&&0!==e.children.length){var t=e.getAvailableChildren(),i=!1,n=!1;if(e.sequencingControls.rollupObjectiveSatisfied&&null!==this._objectiveRollupUsingMeasure(e,t)&&(n=!0),!n){var r=!0,o=!1,a=void 0;try{for(var s,l=this._rules[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c.evaluate(t))switch(c.action){case"satisfied":e.successStatus=ge,n=!0;break;case"notSatisfied":e.successStatus=be,n=!0;break;case"completed":e.completionStatus=Se,e.isCompleted=!0,i=!0;break;case"incomplete":e.completionStatus=we,e.isCompleted=!1,i=!0}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}}i||this._defaultCompletionRollup(e,t),n||this._defaultSuccessRollup(e,t)}}},{key:"_defaultCompletionRollup",value:function(e,t){t.every(function(e){return e.isCompleted})?(e.completionStatus=Se,e.isCompleted=!0):t.some(function(e){return e.completionStatus===we})&&(e.completionStatus=we,e.isCompleted=!1)}},{key:"_objectiveRollupUsingMeasure",value:function(e,t){if(0>=e.sequencingControls.objectiveMeasureWeight)return null;var i=0,n=0,r=!1,o=!0,a=!1,s=void 0;try{for(var l,c=t[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;if(u.sequencingControls.rollupObjectiveSatisfied&&u.objectiveMeasureStatus&&!0===u.objectiveMeasureStatus){var d=u.sequencingControls.objectiveMeasureWeight;d>0&&(n+=u.objectiveNormalizedMeasure*d,i+=d,r=!0)}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}if(!r||0===i)return null;var v=n/i;return e.objectiveNormalizedMeasure=v,e.objectiveMeasureStatus=!0,e.scaledPassingScore>v?(e.successStatus=be,e.objectiveSatisfiedStatus=!1,!1):(e.successStatus=ge,e.objectiveSatisfiedStatus=!0,!0)}},{key:"_defaultSuccessRollup",value:function(e,t){t.every(function(e){return e.successStatus===ge})?e.successStatus=ge:t.some(function(e){return e.successStatus===be})&&(e.successStatus=be)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={rules:this._rules};return this.jsonString=!1,result}}]),t}(C);function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wn(e,t,i){return t&&Sn(e.prototype,t),i&&Sn(e,i),e}function Cn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function On(e,t,i){return On="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=An(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},On(e,t,i||e)}function An(e){return An=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},An(e)}function En(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(En=function(){return!!result})()}function kn(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Cn(e,t,i[t])})}return e}function jn(e,t){return jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},jn(e,t)}function Rn(e){return function(e){if(Array.isArray(e))return bn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return bn(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?bn(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Tn=Object.defineProperty,xn=function(e,t,i){return function(e,t,i){return t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Mn(t))?t+"":t,i)},In=function(){function e(id){var t,i,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_n(this,e),xn(this,"_id"),xn(this,"_description"),xn(this,"_satisfiedByMeasure"),xn(this,"_minNormalizedMeasure"),xn(this,"_mapInfo"),xn(this,"_isPrimary"),xn(this,"_satisfiedStatus",!1),xn(this,"_satisfiedStatusKnown",!1),xn(this,"_measureStatus",!1),xn(this,"_normalizedMeasure",0),xn(this,"_rawScore",""),xn(this,"_rawScoreKnown",!1),xn(this,"_minScore",""),xn(this,"_minScoreKnown",!1),xn(this,"_maxScore",""),xn(this,"_maxScoreKnown",!1),xn(this,"_progressMeasure",0),xn(this,"_progressMeasureStatus",!1),xn(this,"_completionStatus",Ce),xn(this,"_progressStatus",!1),xn(this,"_satisfiedStatusDirty",!1),xn(this,"_normalizedMeasureDirty",!1),xn(this,"_completionStatusDirty",!1),xn(this,"_progressMeasureDirty",!1),xn(this,"_rawScoreDirty",!1),xn(this,"_minScoreDirty",!1),xn(this,"_maxScoreDirty",!1),this._id=id,this._description=null!==(t=o.description)&&void 0!==t?t:null,this._satisfiedByMeasure=null!==(i=o.satisfiedByMeasure)&&void 0!==i&&i,this._minNormalizedMeasure=null!==(n=o.minNormalizedMeasure)&&void 0!==n?n:null,this._mapInfo=o.mapInfo?Rn(o.mapInfo):[],this._isPrimary=null!==(r=o.isPrimary)&&void 0!==r&&r}return wn(e,[{key:"id",get:function(){return this._id}},{key:"description",get:function(){return this._description}},{key:"satisfiedByMeasure",get:function(){return this._satisfiedByMeasure},set:function(e){this._satisfiedByMeasure=e}},{key:"minNormalizedMeasure",get:function(){return this._minNormalizedMeasure},set:function(e){this._minNormalizedMeasure=e}},{key:"mapInfo",get:function(){return this._mapInfo},set:function(e){this._mapInfo=Rn(e)}},{key:"isPrimary",get:function(){return this._isPrimary},set:function(e){this._isPrimary=e}},{key:"satisfiedStatus",get:function(){return this._satisfiedStatus},set:function(e){this._satisfiedStatus!==e&&(this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._satisfiedStatusKnown=!0,this._progressStatus=!0)}},{key:"satisfiedStatusKnown",get:function(){return this._satisfiedStatusKnown},set:function(e){this._satisfiedStatusKnown=e}},{key:"measureStatus",get:function(){return this._measureStatus},set:function(e){this._measureStatus=e}},{key:"normalizedMeasure",get:function(){return this._normalizedMeasure},set:function(e){this._normalizedMeasure!==e&&(this._normalizedMeasure=e,this._normalizedMeasureDirty=!0)}},{key:"rawScore",get:function(){return this._rawScore},set:function(e){this._rawScore!==e&&(this._rawScore=e,this._rawScoreDirty=!0),this._rawScoreKnown=""!==e}},{key:"rawScoreKnown",get:function(){return this._rawScoreKnown},set:function(e){this._rawScoreKnown=e}},{key:"minScore",get:function(){return this._minScore},set:function(e){this._minScore!==e&&(this._minScore=e,this._minScoreDirty=!0),this._minScoreKnown=""!==e}},{key:"minScoreKnown",get:function(){return this._minScoreKnown},set:function(e){this._minScoreKnown=e}},{key:"maxScore",get:function(){return this._maxScore},set:function(e){this._maxScore!==e&&(this._maxScore=e,this._maxScoreDirty=!0),this._maxScoreKnown=""!==e}},{key:"maxScoreKnown",get:function(){return this._maxScoreKnown},set:function(e){this._maxScoreKnown=e}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure!==e&&(this._progressMeasure=e,this._progressMeasureDirty=!0)}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus!==e&&(this._completionStatus=e,this._completionStatusDirty=!0)}},{key:"progressStatus",get:function(){return this._progressStatus},set:function(e){this._progressStatus=e}},{key:"isDirty",value:function(e){switch(e){case"satisfiedStatus":return this._satisfiedStatusDirty;case"normalizedMeasure":return this._normalizedMeasureDirty;case"completionStatus":return this._completionStatusDirty;case"progressMeasure":return this._progressMeasureDirty;case"rawScore":return this._rawScoreDirty;case"minScore":return this._minScoreDirty;case"maxScore":return this._maxScoreDirty}}},{key:"clearDirty",value:function(e){switch(e){case"satisfiedStatus":this._satisfiedStatusDirty=!1;break;case"normalizedMeasure":this._normalizedMeasureDirty=!1;break;case"completionStatus":this._completionStatusDirty=!1;break;case"progressMeasure":this._progressMeasureDirty=!1;break;case"rawScore":this._rawScoreDirty=!1;break;case"minScore":this._minScoreDirty=!1;break;case"maxScore":this._maxScoreDirty=!1}}},{key:"clearAllDirty",value:function(){this._satisfiedStatusDirty=!1,this._normalizedMeasureDirty=!1,this._completionStatusDirty=!1,this._progressMeasureDirty=!1,this._rawScoreDirty=!1,this._minScoreDirty=!1,this._maxScoreDirty=!1}},{key:"initializeFromCMI",value:function(e,t,i){this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._normalizedMeasure=t,this._normalizedMeasureDirty=!0,this._measureStatus=i}},{key:"initializeScoreFromCMI",value:function(score){void 0!==score.rawScore&&""!==score.rawScore&&(this._rawScore=score.rawScore,this._rawScoreKnown=!0,this._rawScoreDirty=!0),void 0!==score.minScore&&""!==score.minScore&&(this._minScore=score.minScore,this._minScoreKnown=!0,this._minScoreDirty=!0),void 0!==score.maxScore&&""!==score.maxScore&&(this._maxScore=score.maxScore,this._maxScoreKnown=!0,this._maxScoreDirty=!0)}},{key:"applyReadMappedState",value:function(e){void 0!==e.satisfiedStatus&&(this._satisfiedStatus=e.satisfiedStatus,this._satisfiedStatusKnown=!0,this._progressStatus=!0),void 0!==e.normalizedMeasure&&(this._normalizedMeasure=e.normalizedMeasure,this._measureStatus=!0),void 0!==e.completionStatus&&(this._completionStatus=e.completionStatus),void 0!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureStatus=!0),void 0!==e.rawScore&&(this._rawScore=e.rawScore,this._rawScoreKnown=!0),void 0!==e.minScore&&(this._minScore=e.minScore,this._minScoreKnown=!0),void 0!==e.maxScore&&(this._maxScore=e.maxScore,this._maxScoreKnown=!0)}},{key:"resetState",value:function(){this._satisfiedStatus=!1,this._satisfiedStatusKnown=!1,this._measureStatus=!1,this._normalizedMeasure=0,this._rawScore="",this._rawScoreKnown=!1,this._minScore="",this._minScoreKnown=!1,this._maxScore="",this._maxScoreKnown=!1,this._progressMeasure=0,this._progressMeasureStatus=!1,this._completionStatus=Ce,this._progressStatus=!1,this.clearAllDirty()}},{key:"updateFromActivity",value:function(e){this._satisfiedStatus!==e.objectiveSatisfiedStatus&&(this._satisfiedStatus=e.objectiveSatisfiedStatus,this._satisfiedStatusDirty=!0),this._satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,this._measureStatus=e.objectiveMeasureStatus,this._normalizedMeasure!==e.objectiveNormalizedMeasure&&(this._normalizedMeasure=e.objectiveNormalizedMeasure,this._normalizedMeasureDirty=!0),this._progressMeasure!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureDirty=!0),this._progressMeasureStatus=e.progressMeasureStatus,this._completionStatus!==e.completionStatus&&(this._completionStatus=e.completionStatus,this._completionStatusDirty=!0)}},{key:"applyToActivity",value:function(e){this._isPrimary&&e.setPrimaryObjectiveState(this._satisfiedStatus,this._measureStatus,this._normalizedMeasure,this._progressMeasure,this._progressMeasureStatus,this._completionStatus,this._progressStatus||this._satisfiedStatusKnown)}}]),e}(),Pn=function(e){function t(){var e,id=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return _n(this,t),e=function(e,t,i){return t=An(t),n=e,!(r=En()?Reflect.construct(t,i||[],An(e).constructor):t.apply(e,i))||"object"!==Mn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activity"]),xn(e,"_id",""),xn(e,"_title",""),xn(e,"_children",[]),xn(e,"_parent",null),xn(e,"_isVisible",!0),xn(e,"_isActive",!1),xn(e,"_isSuspended",!1),xn(e,"_isCompleted",!1),xn(e,"_completionStatus",Ce),xn(e,"_successStatus",_e),xn(e,"_attemptCount",0),xn(e,"_attemptCompletionAmount",0),xn(e,"_attemptAbsoluteDuration","PT0H0M0S"),xn(e,"_attemptExperiencedDuration","PT0H0M0S"),xn(e,"_activityAbsoluteDuration","PT0H0M0S"),xn(e,"_activityExperiencedDuration","PT0H0M0S"),xn(e,"_attemptAbsoluteDurationValue","PT0H0M0S"),xn(e,"_attemptExperiencedDurationValue","PT0H0M0S"),xn(e,"_activityAbsoluteDurationValue","PT0H0M0S"),xn(e,"_activityExperiencedDurationValue","PT0H0M0S"),xn(e,"_activityStartTimestampUtc",null),xn(e,"_attemptStartTimestampUtc",null),xn(e,"_activityEndedDate",null),xn(e,"_objectiveSatisfiedStatus",!1),xn(e,"_objectiveSatisfiedStatusKnown",!1),xn(e,"_objectiveMeasureStatus",!1),xn(e,"_objectiveNormalizedMeasure",0),xn(e,"_scaledPassingScore",.7),xn(e,"_objectiveSatisfiedStatusDirty",!1),xn(e,"_objectiveNormalizedMeasureDirty",!1),xn(e,"_objectiveMeasureStatusDirty",!1),xn(e,"_progressMeasure",0),xn(e,"_progressMeasureStatus",!1),xn(e,"_location",""),xn(e,"_attemptAbsoluteStartTime",""),xn(e,"_learnerPrefs",null),xn(e,"_activityAttemptActive",!1),xn(e,"_isHiddenFromChoice",!1),xn(e,"_isAvailable",!0),xn(e,"_hideLmsUi",[]),xn(e,"_auxiliaryResources",[]),xn(e,"_attemptLimit",null),xn(e,"_attemptAbsoluteDurationLimit",null),xn(e,"_activityAbsoluteDurationLimit",null),xn(e,"_timeLimitAction",null),xn(e,"_timeLimitDuration",null),xn(e,"_beginTimeLimit",null),xn(e,"_endTimeLimit",null),xn(e,"_launchData",""),xn(e,"_credit","credit"),xn(e,"_maxTimeAllowed",""),xn(e,"_completionThreshold",""),xn(e,"_sequencingControls"),xn(e,"_sequencingRules"),xn(e,"_rollupRules"),xn(e,"_processedChildren",null),xn(e,"_isNewAttempt",!1),xn(e,"_primaryObjective",null),xn(e,"_objectives",[]),xn(e,"_rollupConsiderations",{requiredForSatisfied:"always",requiredForNotSatisfied:"always",requiredForCompleted:"always",requiredForIncomplete:"always",measureSatisfactionIfActive:!0}),xn(e,"_requiredForSatisfied","always"),xn(e,"_requiredForNotSatisfied","always"),xn(e,"_requiredForCompleted","always"),xn(e,"_requiredForIncomplete","always"),xn(e,"_wasSkipped",!1),xn(e,"_attemptProgressStatus",!1),xn(e,"_wasAutoCompleted",!1),xn(e,"_wasAutoSatisfied",!1),xn(e,"_completedByMeasure",!1),xn(e,"_minProgressMeasure",1),xn(e,"_progressWeight",1),xn(e,"_attemptCompletionAmountStatus",!1),e._id=id,e._title=i,e._sequencingControls=new Ht,e._sequencingRules=new yt,e._rollupRules=new gn,e._primaryObjective=null,e._objectives=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jn(e,t)}(t,e),wn(t,[{key:"initialize",value:function(){On(An(t.prototype),"initialize",this).call(this);var e=!0,i=!1,n=void 0;try{for(var r,o=this._children[Symbol.iterator]();!(e=(r=o.next()).done);e=!0)r.value.initialize()}catch(e){i=!0,n=e}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"reset",value:function(){this._initialized=!1,this._isActive=!1,this._isSuspended=!1,this._isCompleted=!1,this._completionStatus=Ce,this._successStatus=_e,this._attemptCount=0,this._attemptCompletionAmount=0,this._attemptAbsoluteDuration="PT0H0M0S",this._attemptExperiencedDuration="PT0H0M0S",this._activityAbsoluteDuration="PT0H0M0S",this._activityExperiencedDuration="PT0H0M0S",this._attemptAbsoluteDurationValue="PT0H0M0S",this._attemptExperiencedDurationValue="PT0H0M0S",this._activityAbsoluteDurationValue="PT0H0M0S",this._activityExperiencedDurationValue="PT0H0M0S",this._activityStartTimestampUtc=null,this._attemptStartTimestampUtc=null,this._activityEndedDate=null,this._objectiveSatisfiedStatus=!1,this._objectiveSatisfiedStatusKnown=!1,this._objectiveMeasureStatus=!1,this._objectiveNormalizedMeasure=0,this._progressMeasure=0,this._progressMeasureStatus=!1,this._location="",this._attemptAbsoluteStartTime="",this._learnerPrefs=null,this._activityAttemptActive=!1,this._primaryObjective&&(this._primaryObjective.resetState(),this._primaryObjective.updateFromActivity(this));var e=!0,t=!1,i=void 0;try{for(var n,r=this._objectives[Symbol.iterator]();!(e=(n=r.next()).done);e=!0)n.value.resetState()}catch(e){t=!0,i=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw i}}var o=!0,a=!1,s=void 0;try{for(var l,c=this._children[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)l.value.reset()}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}this._wasSkipped=!1,this._attemptProgressStatus=!1,this._wasAutoCompleted=!1,this._wasAutoSatisfied=!1,this._completedByMeasure=!1,this._minProgressMeasure=1,this._progressWeight=1,this._attemptCompletionAmountStatus=!1,this.clearAllObjectiveDirty()}},{key:"id",get:function(){return this._id},set:function(id){Zi(this._cmi_element+".id",id,Le)&&(this._id=id)}},{key:"title",get:function(){return this._title},set:function(e){Zi(this._cmi_element+".title",e,Te)&&(this._title=e)}},{key:"children",get:function(){return this._children}},{key:"addChild",value:function(e){if(i=e,!(null!=(n=t)&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](i):i instanceof n))throw new te(this._cmi_element+".children",se.TYPE_MISMATCH);var i,n;e._parent=this,this._children.push(e)}},{key:"setChildOrder",value:function(e){if(0!==e.length){var t,i=new Map(this._children.map(function(e){return[e.id,e]})),n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var id=s.value,c=i.get(id);c&&(n.push(c),i.delete(id))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}if(i.size>0){var u=!0,d=!1,v=void 0;try{for(var f,h=this._children[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value;i.has(m.id)&&(n.push(m),i.delete(m.id))}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}}n.length===this._children.length&&(t=this._children).splice.apply(t,[0,this._children.length].concat(Rn(n)))}}},{key:"removeChild",value:function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e._parent=null,!0)}},{key:"parent",get:function(){return this._parent}},{key:"isVisible",get:function(){return this._isVisible},set:function(e){this._isVisible=e}},{key:"isActive",get:function(){return this._isActive},set:function(e){this._isActive=e}},{key:"isSuspended",get:function(){return this._isSuspended},set:function(e){this._isSuspended=e}},{key:"isCompleted",get:function(){return this._isCompleted},set:function(e){this._isCompleted=e,this._completionStatus=e?Se:we}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus=e,this._isCompleted=e===Se,this.updatePrimaryObjectiveFromActivity()}},{key:"successStatus",get:function(){return this._successStatus},set:function(e){this._successStatus=e}},{key:"attemptCount",get:function(){return this._attemptCount},set:function(e){this._attemptCount=e}},{key:"attemptCompletionAmount",get:function(){return this._attemptCompletionAmount},set:function(e){this._attemptCompletionAmount=e}},{key:"incrementAttemptCount",value:function(){this._attemptCount++,this._isNewAttempt=!0;var e=this._sequencingControls;"onEachNewAttempt"!==e.selectionTiming&&"onEachNewAttempt"!==e.randomizationTiming||(this._processedChildren=null)}},{key:"objectiveSatisfiedStatus",get:function(){return this._objectiveSatisfiedStatus},set:function(e){this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=!0,this._successStatus=e?ge:be,this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveSatisfiedStatusKnown",get:function(){return this._objectiveSatisfiedStatusKnown},set:function(e){this._objectiveSatisfiedStatusKnown=e}},{key:"objectiveMeasureStatus",get:function(){return this._objectiveMeasureStatus},set:function(e){this._objectiveMeasureStatus!==e&&(this._objectiveMeasureStatus=e,this._objectiveMeasureStatusDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveNormalizedMeasure",get:function(){return this._objectiveNormalizedMeasure},set:function(e){this._objectiveNormalizedMeasure!==e&&(this._objectiveNormalizedMeasure=e,this._objectiveNormalizedMeasureDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"scaledPassingScore",get:function(){return this._scaledPassingScore},set:function(e){-1>e||e>1||(this._scaledPassingScore=e)}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure=e,this.updatePrimaryObjectiveFromActivity()}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e,this.updatePrimaryObjectiveFromActivity()}},{key:"location",get:function(){return this._location},set:function(location){this._location=location}},{key:"attemptAbsoluteStartTime",get:function(){return this._attemptAbsoluteStartTime},set:function(e){this._attemptAbsoluteStartTime=e}},{key:"learnerPrefs",get:function(){return this._learnerPrefs},set:function(e){this._learnerPrefs=e}},{key:"activityAttemptActive",get:function(){return this._activityAttemptActive},set:function(e){this._activityAttemptActive=e}},{key:"isHiddenFromChoice",get:function(){return this._isHiddenFromChoice},set:function(e){this._isHiddenFromChoice=e}},{key:"isAvailable",get:function(){return this._isAvailable},set:function(e){this._isAvailable=e}},{key:"attemptLimit",get:function(){return this._attemptLimit},set:function(e){this._attemptLimit=e}},{key:"hasAttemptLimitExceeded",value:function(){return null!==this._attemptLimit&&this._attemptCount>=this._attemptLimit}},{key:"timeLimitDuration",get:function(){return this._timeLimitDuration},set:function(e){this._timeLimitDuration=e}},{key:"timeLimitAction",get:function(){return this._timeLimitAction},set:function(e){this._timeLimitAction=e}},{key:"beginTimeLimit",get:function(){return this._beginTimeLimit},set:function(e){this._beginTimeLimit=e}},{key:"endTimeLimit",get:function(){return this._endTimeLimit},set:function(e){this._endTimeLimit=e}},{key:"attemptAbsoluteDurationLimit",get:function(){return this._attemptAbsoluteDurationLimit},set:function(e){if(null!==e&&!u(e,Ne))throw new te(this._cmi_element+".attemptAbsoluteDurationLimit",se.TYPE_MISMATCH);this._attemptAbsoluteDurationLimit=e}},{key:"attemptExperiencedDuration",get:function(){return this._attemptExperiencedDuration},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".attemptExperiencedDuration",se.TYPE_MISMATCH);this._attemptExperiencedDuration=e}},{key:"activityAbsoluteDurationLimit",get:function(){return this._activityAbsoluteDurationLimit},set:function(e){if(null!==e&&!u(e,Ne))throw new te(this._cmi_element+".activityAbsoluteDurationLimit",se.TYPE_MISMATCH);this._activityAbsoluteDurationLimit=e}},{key:"activityExperiencedDuration",get:function(){return this._activityExperiencedDuration},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".activityExperiencedDuration",se.TYPE_MISMATCH);this._activityExperiencedDuration=e}},{key:"attemptAbsoluteDuration",get:function(){return this._attemptAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._attemptAbsoluteDurationLimit=e}},{key:"activityAbsoluteDuration",get:function(){return this._activityAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._activityAbsoluteDurationLimit=e}},{key:"attemptAbsoluteDurationValue",get:function(){return this._attemptAbsoluteDurationValue},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".attemptAbsoluteDurationValue",se.TYPE_MISMATCH);this._attemptAbsoluteDurationValue=e}},{key:"attemptExperiencedDurationValue",get:function(){return this._attemptExperiencedDurationValue},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".attemptExperiencedDurationValue",se.TYPE_MISMATCH);this._attemptExperiencedDurationValue=e}},{key:"activityAbsoluteDurationValue",get:function(){return this._activityAbsoluteDurationValue},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".activityAbsoluteDurationValue",se.TYPE_MISMATCH);this._activityAbsoluteDurationValue=e}},{key:"activityExperiencedDurationValue",get:function(){return this._activityExperiencedDurationValue},set:function(e){if(!u(e,Ne))throw new te(this._cmi_element+".activityExperiencedDurationValue",se.TYPE_MISMATCH);this._activityExperiencedDurationValue=e}},{key:"activityStartTimestampUtc",get:function(){return this._activityStartTimestampUtc},set:function(timestamp){this._activityStartTimestampUtc=timestamp}},{key:"attemptStartTimestampUtc",get:function(){return this._attemptStartTimestampUtc},set:function(timestamp){this._attemptStartTimestampUtc=timestamp}},{key:"activityEndedDate",get:function(){return this._activityEndedDate},set:function(e){this._activityEndedDate=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){this._sequencingControls=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){this._sequencingRules=e}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){this._rollupRules=e}},{key:"rollupConsiderations",get:function(){return kn({},this._rollupConsiderations)},set:function(e){this._rollupConsiderations=kn({},e)}},{key:"applyRollupConsiderations",value:function(e){this._rollupConsiderations=kn({},this._rollupConsiderations,e)}},{key:"requiredForSatisfied",get:function(){return this._requiredForSatisfied},set:function(e){this._requiredForSatisfied=e}},{key:"requiredForNotSatisfied",get:function(){return this._requiredForNotSatisfied},set:function(e){this._requiredForNotSatisfied=e}},{key:"requiredForCompleted",get:function(){return this._requiredForCompleted},set:function(e){this._requiredForCompleted=e}},{key:"requiredForIncomplete",get:function(){return this._requiredForIncomplete},set:function(e){this._requiredForIncomplete=e}},{key:"wasSkipped",get:function(){return this._wasSkipped},set:function(e){this._wasSkipped=e}},{key:"attemptProgressStatus",get:function(){return this._attemptProgressStatus},set:function(e){this._attemptProgressStatus=e}},{key:"wasAutoCompleted",get:function(){return this._wasAutoCompleted},set:function(e){this._wasAutoCompleted=e}},{key:"wasAutoSatisfied",get:function(){return this._wasAutoSatisfied},set:function(e){this._wasAutoSatisfied=e}},{key:"completedByMeasure",get:function(){return this._completedByMeasure},set:function(e){this._completedByMeasure=e}},{key:"minProgressMeasure",get:function(){return this._minProgressMeasure},set:function(e){if(0>e||e>1)throw new te(this._cmi_element+".minProgressMeasure",se.TYPE_MISMATCH);this._minProgressMeasure=e}},{key:"progressWeight",get:function(){return this._progressWeight},set:function(e){if(0>e)throw new te(this._cmi_element+".progressWeight",se.TYPE_MISMATCH);this._progressWeight=e}},{key:"attemptCompletionAmountStatus",get:function(){return this._attemptCompletionAmountStatus},set:function(e){this._attemptCompletionAmountStatus=e}},{key:"primaryObjective",get:function(){return this._primaryObjective},set:function(e){var t;(this._primaryObjective=e,this._primaryObjective)&&(this._primaryObjective.isPrimary=!0,null!==this._primaryObjective.minNormalizedMeasure&&(this._scaledPassingScore=null!==(t=this._primaryObjective.minNormalizedMeasure)&&void 0!==t?t:this._scaledPassingScore),this._primaryObjective.updateFromActivity(this));this.syncPrimaryObjectiveCollection()}},{key:"objectives",get:function(){var e=this;return this._objectives.filter(function(t){var i;return t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)})},set:function(objectives){this._objectives=Rn(objectives),this.syncPrimaryObjectiveCollection()}},{key:"addObjective",value:function(e){this._objectives.find(function(t){return t.id===e.id})||this._objectives.push(e)}},{key:"syncPrimaryObjectiveCollection",value:function(){var e=this;if(this._primaryObjective){var t=this._objectives.findIndex(function(t){var i;return t.id===(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});0>t?this._objectives=[this._primaryObjective].concat(Rn(this._objectives)):this._objectives[t]=this._primaryObjective}else this._objectives=this._objectives.filter(function(e){return!e.isPrimary})}},{key:"getObjectiveById",value:function(e){var t;if((null===(t=this._primaryObjective)||void 0===t?void 0:t.id)===e)return{objective:this._primaryObjective,isPrimary:!0};var i=this._objectives.find(function(t){return t.id===e});return i?{objective:i,isPrimary:!1}:null}},{key:"getAllObjectives",value:function(){var e=this,objectives=[];this._primaryObjective&&objectives.push(this._primaryObjective);var t=this._objectives.filter(function(t){var i;return t!==e._primaryObjective&&t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});return objectives.concat(t)}},{key:"updatePrimaryObjectiveFromActivity",value:function(){this._primaryObjective&&this._primaryObjective.updateFromActivity(this)}},{key:"isObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":return this._objectiveSatisfiedStatusDirty;case"normalizedMeasure":return this._objectiveNormalizedMeasureDirty;case"measureStatus":return this._objectiveMeasureStatusDirty}}},{key:"clearObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":this._objectiveSatisfiedStatusDirty=!1;break;case"normalizedMeasure":this._objectiveNormalizedMeasureDirty=!1;break;case"measureStatus":this._objectiveMeasureStatusDirty=!1}}},{key:"clearAllObjectiveDirty",value:function(){this._objectiveSatisfiedStatusDirty=!1,this._objectiveNormalizedMeasureDirty=!1,this._objectiveMeasureStatusDirty=!1}},{key:"setPrimaryObjectiveState",value:function(e,t,i,n,r,o){var a=6>=arguments.length||void 0===arguments[6]||arguments[6];this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=a,this._objectiveMeasureStatus!==t&&(this._objectiveMeasureStatus=t,this._objectiveMeasureStatusDirty=!0),this._objectiveNormalizedMeasure!==i&&(this._objectiveNormalizedMeasure=i,this._objectiveNormalizedMeasureDirty=!0),this._progressMeasure=n,this._progressMeasureStatus=r,this._completionStatus=o,this._primaryObjective&&(this._primaryObjective.satisfiedStatus=e,this._primaryObjective.measureStatus=t,this._primaryObjective.normalizedMeasure=i,this._primaryObjective.progressMeasure=n,this._primaryObjective.progressMeasureStatus=r,this._primaryObjective.completionStatus=o,this._primaryObjective.satisfiedStatusKnown=a,this._primaryObjective.progressStatus=a)}},{key:"getObjectiveStateSnapshot",value:function(){var e;return{primary:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this.objectiveSatisfiedStatus,measureStatus:this.objectiveMeasureStatus,normalizedMeasure:this.objectiveNormalizedMeasure,rawScore:this._primaryObjective.rawScore,rawScoreKnown:this._primaryObjective.rawScoreKnown,minScore:this._primaryObjective.minScore,minScoreKnown:this._primaryObjective.minScoreKnown,maxScore:this._primaryObjective.maxScore,maxScoreKnown:this._primaryObjective.maxScoreKnown,progressMeasure:null!==(e=this.progressMeasure)&&void 0!==e?e:0,progressMeasureStatus:this.progressMeasureStatus,progressStatus:this._primaryObjective.progressStatus,completionStatus:this.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,rawScore:e.rawScore,rawScoreKnown:e.rawScoreKnown,minScore:e.minScore,minScoreKnown:e.minScoreKnown,maxScore:e.maxScore,maxScoreKnown:e.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,progressStatus:e.progressStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure}})}}},{key:"applyObjectiveStateSnapshot",value:function(e){if(e.primary){var t=this.getObjectiveById(e.primary.id);if(t&&t.isPrimary){var i,n=e.primary;t.objective.satisfiedByMeasure=null!==(i=n.satisfiedByMeasure)&&void 0!==i?i:t.objective.satisfiedByMeasure,t.objective.minNormalizedMeasure=void 0!==n.minNormalizedMeasure?n.minNormalizedMeasure:t.objective.minNormalizedMeasure,this.setPrimaryObjectiveState(n.satisfiedStatus,n.measureStatus,n.normalizedMeasure,n.progressMeasure,n.progressMeasureStatus,n.completionStatus,n.progressStatus),this.applyObjectiveScoreSnapshot(t.objective,n)}}var r=!0,o=!1,a=void 0;try{for(var s,l=e.objectives[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value,u=this.getObjectiveById(c.id);if(u&&!u.isPrimary){var d,v=u.objective;v.satisfiedStatus=c.satisfiedStatus,v.measureStatus=c.measureStatus,v.normalizedMeasure=c.normalizedMeasure,v.progressMeasure=c.progressMeasure,v.progressMeasureStatus=c.progressMeasureStatus,v.completionStatus=c.completionStatus,this.applyObjectiveScoreSnapshot(v,c),v.satisfiedByMeasure=null!==(d=c.satisfiedByMeasure)&&void 0!==d?d:v.satisfiedByMeasure,v.minNormalizedMeasure=void 0!==c.minNormalizedMeasure?c.minNormalizedMeasure:v.minNormalizedMeasure}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}}},{key:"applyObjectiveScoreSnapshot",value:function(e,t){var i={};t.rawScoreKnown&&(i.rawScore=t.rawScore),t.minScoreKnown&&(i.minScore=t.minScore),t.maxScoreKnown&&(i.maxScore=t.maxScore),e.applyReadMappedState(i)}},{key:"getAvailableChildren",value:function(){return 0===this._children.length?[]:null!==this._processedChildren?this._processedChildren:this._children}},{key:"setProcessedChildren",value:function(e){this._processedChildren=e}},{key:"resetProcessedChildren",value:function(){this._processedChildren=null}},{key:"isNewAttempt",get:function(){return this._isNewAttempt},set:function(e){this._isNewAttempt=e}},{key:"launchData",get:function(){return this._launchData},set:function(e){this._launchData=e}},{key:"credit",get:function(){return this._credit},set:function(credit){this._credit=credit}},{key:"maxTimeAllowed",get:function(){return this._maxTimeAllowed},set:function(e){this._maxTimeAllowed=e}},{key:"completionThreshold",get:function(){return this._completionThreshold},set:function(e){this._completionThreshold=e}},{key:"getSuspensionState",value:function(){return{id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,attemptAbsoluteDurationValue:this._attemptAbsoluteDurationValue,attemptExperiencedDurationValue:this._attemptExperiencedDurationValue,activityAbsoluteDurationValue:this._activityAbsoluteDurationValue,activityExperiencedDurationValue:this._activityExperiencedDurationValue,activityStartTimestampUtc:this._activityStartTimestampUtc,attemptStartTimestampUtc:this._attemptStartTimestampUtc,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,scaledPassingScore:this._scaledPassingScore,progressMeasure:this._progressMeasure,progressMeasureStatus:this._progressMeasureStatus,location:this._location,attemptAbsoluteStartTime:this._attemptAbsoluteStartTime,activityAttemptActive:this._activityAttemptActive,isHiddenFromChoice:this._isHiddenFromChoice,isAvailable:this._isAvailable,rollupConsiderations:kn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,attemptProgressStatus:this._attemptProgressStatus,wasAutoCompleted:this._wasAutoCompleted,wasAutoSatisfied:this._wasAutoSatisfied,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,processedChildren:this._processedChildren?this._processedChildren.map(function(e){return e.id}):null,isNewAttempt:this._isNewAttempt,selectionCountStatus:this._sequencingControls.selectionCountStatus,reorderChildren:this._sequencingControls.reorderChildren,primaryObjective:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this._primaryObjective.satisfiedStatus,measureStatus:this._primaryObjective.measureStatus,normalizedMeasure:this._primaryObjective.normalizedMeasure,progressMeasure:this._primaryObjective.progressMeasure,progressMeasureStatus:this._primaryObjective.progressMeasureStatus,completionStatus:this._primaryObjective.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure,progressStatus:this._primaryObjective.progressStatus,mapInfo:this._primaryObjective.mapInfo}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure,progressStatus:e.progressStatus,mapInfo:e.mapInfo}}),children:this._children.map(function(e){return e.getSuspensionState()})}}},{key:"restoreSuspensionState",value:function(e){var t,i,n,r,o,a,s,l,c,u,d,v,f,h,m,p,y,g,b,_,S,w,C,O,A,E,k,j,R,M,T,x,I,P,N,q,D,L,z;if(e){if(this._isVisible=null!==(t=e.isVisible)&&void 0!==t?t:this._isVisible,this._isActive=null!==(i=e.isActive)&&void 0!==i?i:this._isActive,this._isSuspended=null!==(n=e.isSuspended)&&void 0!==n?n:this._isSuspended,this._isCompleted=null!==(r=e.isCompleted)&&void 0!==r?r:this._isCompleted,this._completionStatus=null!==(o=e.completionStatus)&&void 0!==o?o:this._completionStatus,this._successStatus=null!==(a=e.successStatus)&&void 0!==a?a:this._successStatus,this._attemptCount=null!==(s=e.attemptCount)&&void 0!==s?s:this._attemptCount,this._attemptCompletionAmount=null!==(l=e.attemptCompletionAmount)&&void 0!==l?l:this._attemptCompletionAmount,this._attemptAbsoluteDuration=null!==(c=e.attemptAbsoluteDuration)&&void 0!==c?c:this._attemptAbsoluteDuration,this._attemptExperiencedDuration=null!==(u=e.attemptExperiencedDuration)&&void 0!==u?u:this._attemptExperiencedDuration,this._activityAbsoluteDuration=null!==(d=e.activityAbsoluteDuration)&&void 0!==d?d:this._activityAbsoluteDuration,this._activityExperiencedDuration=null!==(v=e.activityExperiencedDuration)&&void 0!==v?v:this._activityExperiencedDuration,this._attemptAbsoluteDurationValue=null!==(f=e.attemptAbsoluteDurationValue)&&void 0!==f?f:this._attemptAbsoluteDurationValue,this._attemptExperiencedDurationValue=null!==(h=e.attemptExperiencedDurationValue)&&void 0!==h?h:this._attemptExperiencedDurationValue,this._activityAbsoluteDurationValue=null!==(m=e.activityAbsoluteDurationValue)&&void 0!==m?m:this._activityAbsoluteDurationValue,this._activityExperiencedDurationValue=null!==(p=e.activityExperiencedDurationValue)&&void 0!==p?p:this._activityExperiencedDurationValue,this._activityStartTimestampUtc=null!==(y=e.activityStartTimestampUtc)&&void 0!==y?y:this._activityStartTimestampUtc,this._attemptStartTimestampUtc=null!==(g=e.attemptStartTimestampUtc)&&void 0!==g?g:this._attemptStartTimestampUtc,this._objectiveSatisfiedStatus=null!==(b=e.objectiveSatisfiedStatus)&&void 0!==b?b:this._objectiveSatisfiedStatus,this._objectiveSatisfiedStatusKnown=null!==(_=e.objectiveSatisfiedStatusKnown)&&void 0!==_?_:this._objectiveSatisfiedStatusKnown,this._objectiveMeasureStatus=null!==(S=e.objectiveMeasureStatus)&&void 0!==S?S:this._objectiveMeasureStatus,this._objectiveNormalizedMeasure=null!==(w=e.objectiveNormalizedMeasure)&&void 0!==w?w:this._objectiveNormalizedMeasure,this._scaledPassingScore=null!==(C=e.scaledPassingScore)&&void 0!==C?C:this._scaledPassingScore,this._progressMeasure=null!==(O=e.progressMeasure)&&void 0!==O?O:this._progressMeasure,this._progressMeasureStatus=null!==(A=e.progressMeasureStatus)&&void 0!==A?A:this._progressMeasureStatus,this._location=null!==(E=e.location)&&void 0!==E?E:this._location,this._attemptAbsoluteStartTime=null!==(k=e.attemptAbsoluteStartTime)&&void 0!==k?k:this._attemptAbsoluteStartTime,this._activityAttemptActive=null!==(j=e.activityAttemptActive)&&void 0!==j?j:this._activityAttemptActive,this._isHiddenFromChoice=null!==(R=e.isHiddenFromChoice)&&void 0!==R?R:this._isHiddenFromChoice,this._isAvailable=null!==(M=e.isAvailable)&&void 0!==M?M:this._isAvailable,e.rollupConsiderations&&(this._rollupConsiderations=kn({},e.rollupConsiderations)),this._wasSkipped=null!==(T=e.wasSkipped)&&void 0!==T?T:this._wasSkipped,this._attemptProgressStatus=null!==(x=e.attemptProgressStatus)&&void 0!==x?x:this._attemptProgressStatus,this._wasAutoCompleted=null!==(I=e.wasAutoCompleted)&&void 0!==I?I:this._wasAutoCompleted,this._wasAutoSatisfied=null!==(P=e.wasAutoSatisfied)&&void 0!==P?P:this._wasAutoSatisfied,this._completedByMeasure=null!==(N=e.completedByMeasure)&&void 0!==N?N:this._completedByMeasure,this._minProgressMeasure=null!==(q=e.minProgressMeasure)&&void 0!==q?q:this._minProgressMeasure,this._progressWeight=null!==(D=e.progressWeight)&&void 0!==D?D:this._progressWeight,this._attemptCompletionAmountStatus=null!==(L=e.attemptCompletionAmountStatus)&&void 0!==L?L:this._attemptCompletionAmountStatus,this._isNewAttempt=null!==(z=e.isNewAttempt)&&void 0!==z?z:this._isNewAttempt,void 0!==e.selectionCountStatus&&(this._sequencingControls.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(this._sequencingControls.reorderChildren=e.reorderChildren),e.processedChildren){var F=new Map(this._children.map(function(e){return[e.id,e]}));this._processedChildren=e.processedChildren.map(function(id){return F.get(id)}).filter(function(e){return void 0!==e})}else this._processedChildren=null;var B,V,H,U,G,K,Y;if(e.primaryObjective&&this._primaryObjective&&(this._primaryObjective.satisfiedStatus=null!==(B=e.primaryObjective.satisfiedStatus)&&void 0!==B?B:this._primaryObjective.satisfiedStatus,this._primaryObjective.measureStatus=null!==(V=e.primaryObjective.measureStatus)&&void 0!==V?V:this._primaryObjective.measureStatus,this._primaryObjective.normalizedMeasure=null!==(H=e.primaryObjective.normalizedMeasure)&&void 0!==H?H:this._primaryObjective.normalizedMeasure,this._primaryObjective.progressMeasure=null!==(U=e.primaryObjective.progressMeasure)&&void 0!==U?U:this._primaryObjective.progressMeasure,this._primaryObjective.progressMeasureStatus=null!==(G=e.primaryObjective.progressMeasureStatus)&&void 0!==G?G:this._primaryObjective.progressMeasureStatus,this._primaryObjective.completionStatus=null!==(K=e.primaryObjective.completionStatus)&&void 0!==K?K:this._primaryObjective.completionStatus,this._primaryObjective.progressStatus=null!==(Y=e.primaryObjective.progressStatus)&&void 0!==Y?Y:this._primaryObjective.progressStatus),e.objectives){var W=!0,J=!1,X=void 0;try{for(var $,Q,Z=function(){var e,t,i,n,r,o,a,s=Q.value,l=$._objectives.find(function(e){return e.id===s.id});l&&(l.satisfiedStatus=null!==(e=s.satisfiedStatus)&&void 0!==e?e:l.satisfiedStatus,l.measureStatus=null!==(t=s.measureStatus)&&void 0!==t?t:l.measureStatus,l.normalizedMeasure=null!==(i=s.normalizedMeasure)&&void 0!==i?i:l.normalizedMeasure,l.progressMeasure=null!==(n=s.progressMeasure)&&void 0!==n?n:l.progressMeasure,l.progressMeasureStatus=null!==(r=s.progressMeasureStatus)&&void 0!==r?r:l.progressMeasureStatus,l.completionStatus=null!==(o=s.completionStatus)&&void 0!==o?o:l.completionStatus,l.progressStatus=null!==(a=s.progressStatus)&&void 0!==a?a:l.progressStatus)},ee=e.objectives[Symbol.iterator]();!(W=(Q=ee.next()).done);W=!0)$=this,Z()}catch(e){J=!0,X=e}finally{try{W||null==ee.return||ee.return()}finally{if(J)throw X}}}if(e.children&&Array.isArray(e.children))for(var te,ie=function(t){var i=e.children[t],n=te._children.find(function(e){return e.id===i.id});n&&n.restoreSuspensionState(i)},ne=0;e.children.length>ne&&this._children.length>ne;ne++)te=this,ie(ne)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,rollupConsiderations:kn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,hideLmsUi:Rn(this._hideLmsUi),auxiliaryResources:this._auxiliaryResources.map(function(e){return kn({},e)}),children:this._children.map(function(e){return e.toJSON()})};return this.jsonString=!1,result}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return kn({},e)})},set:function(e){var t=[],i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=(e||[])[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l){var c="string"==typeof l.resourceId?l.resourceId.trim():"",u="string"==typeof l.purpose?l.purpose.trim():"";c&&!i.has(c)&&(i.add(c),t.push({resourceId:c,purpose:u}))}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this._auxiliaryResources=t}},{key:"addAuxiliaryResource",value:function(e){this.auxiliaryResources=Rn(this._auxiliaryResources).concat([e])}},{key:"captureRollupStatus",value:function(){return{measureStatus:this._objectiveMeasureStatus,normalizedMeasure:this._objectiveNormalizedMeasure,objectiveProgressStatus:null!=this._objectiveSatisfiedStatus,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,attemptProgressStatus:this._completionStatus!==Ce,attemptCompletionStatus:this._completionStatus===Se}}},{key:"hideLmsUi",get:function(){return Rn(this._hideLmsUi)},set:function(e){var t=new Set(et),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}this._hideLmsUi=n}}],[{key:"compareRollupStatus",value:function(e,t){return e.measureStatus===t.measureStatus&&1e-4>Math.abs(e.normalizedMeasure-t.normalizedMeasure)&&e.objectiveProgressStatus===t.objectiveProgressStatus&&e.objectiveSatisfiedStatus===t.objectiveSatisfiedStatus&&e.attemptProgressStatus===t.attemptProgressStatus&&e.attemptCompletionStatus===t.attemptCompletionStatus}}]),t}(C);var Nn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"checkChildForRollupSubprocess",value:function(e,t,i){if(!1===e.sequencingControls.tracked)return!1;var n=!1;if("measure"===t||"objective"===t){if(!e.sequencingControls.rollupObjectiveSatisfied)return!1;n=!0;var r=e.requiredForSatisfied,o=e.requiredForNotSatisfied;"satisfied"===i&&"ifNotSuspended"===r||"notSatisfied"===i&&"ifNotSuspended"===o?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"satisfied"===i&&"ifAttempted"===r||"notSatisfied"===i&&"ifAttempted"===o?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("satisfied"===i&&"ifNotSkipped"===r||"notSatisfied"===i&&"ifNotSkipped"===o)&&e.wasSkipped&&(n=!1)}if("progress"===t){if(!e.sequencingControls.rollupProgressCompletion)return!1;n=!0;var a=e.requiredForCompleted,s=e.requiredForIncomplete;"completed"===i&&"ifNotSuspended"===a||"incomplete"===i&&"ifNotSuspended"===s?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"completed"===i&&"ifAttempted"===a||"incomplete"===i&&"ifAttempted"===s?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("completed"===i&&"ifNotSkipped"===a||"incomplete"===i&&"ifNotSkipped"===s)&&e.wasSkipped&&(n=!1)}return!(n&&!e.isAvailable)&&n}},{key:"filterChildrenForRequirement",value:function(e,t,mode,i){var n=this;return e.filter(function(e){return n.shouldIncludeChildForRollup(e,t,mode,i)})}},{key:"shouldIncludeChildForRollup",value:function(e,t,mode,i){return!(!this.checkChildForRollupSubprocess(e,t,mode)||"objective"===t&&!i.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))}},{key:"isChildSatisfiedForRollup",value:function(e){return!0===e.objectiveSatisfiedStatus||!1!==e.objectiveSatisfiedStatus&&e.successStatus===ge}},{key:"isChildCompletedForRollup",value:function(e){return!("completed"!==e.completionStatus&&!e.isCompleted)}},{key:"getTrackableChildren",value:function(e){return e.children.filter(function(e){return!1!==e.sequencingControls.tracked})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var qn=Object.defineProperty,Dn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?qn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="childFilter")?i+"":i,n),this.childFilter=t}return t=e,(i=[{key:"evaluateRollupRule",value:function(e,t){var i=e.getAvailableChildren(),n=0,r=0,o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!1;switch(t.action){case hn.SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","satisfied");break;case hn.NOT_SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","notSatisfied");break;case hn.COMPLETED:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","completed");break;case hn.INCOMPLETE:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","incomplete")}d&&(n++,this.evaluateRollupConditionsSubprocess(u,t)&&r++)}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return t.consideration===mn.ALL?n>0&&r===n:null!==t.minimumCount?r>=t.minimumCount:null!==t.minimumPercent?(n>0?r/n:0)>=t.minimumPercent:n>0&&r===n}},{key:"evaluateRollupConditionsSubprocess",value:function(e,t){if(0===t.conditions.length)return!0;switch(t.consideration){case mn.ALL:return t.conditions.every(function(t){return t.evaluate(e)});case mn.ANY:return t.conditions.some(function(t){return t.evaluate(e)});case mn.NONE:return!t.conditions.some(function(t){return t.evaluate(e)});case mn.AT_LEAST_COUNT:case mn.AT_LEAST_PERCENT:return t.conditions.every(function(t){return t.evaluate(e)});default:return!1}}},{key:"evaluateRulesForAction",value:function(e,t,i){var n=t.filter(function(e){return e.action===i});if(0===n.length)return null;var r=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Ln=Object.defineProperty,zn=function(e,t,i){return function(e,t,i){return t in e?Ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Fn=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),zn(this,"childFilter"),zn(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,i=[{key:"measureRollupProcess",value:function(e){var t=this;if(!e.sequencingControls.rollupObjectiveSatisfied)return[];var i=e.getAvailableChildren();if(0===i.length)return[];var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"measure")||!e.objectiveMeasureStatus||null===e.objectiveNormalizedMeasure||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});if(0===r.length)return e.objectiveMeasureStatus=!1,[];var o=this.calculateComplexWeightedMeasure(e,r,{enableThresholdBias:!1});return e.objectiveNormalizedMeasure=o,e.objectiveMeasureStatus=!0,this.identifyActivityClusters(r)}},{key:"completionMeasureRollupProcess",value:function(e){var t=e.getAvailableChildren();if(0!==t.length){var i=t.filter(function(e){return e.attemptCompletionAmountStatus});if(0!==i.length){var n=0,r=0,o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;n+=u.attemptCompletionAmount*u.progressWeight,r+=u.progressWeight}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}r>0&&(e.attemptCompletionAmount=n/r,e.attemptCompletionAmountStatus=!0)}else e.attemptCompletionAmountStatus=!1}}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){var n,r,o=0,a=0,s=[],l=null===(n=null==i?void 0:i.enableThresholdBias)||void 0===n||n,c=!0,u=!1,d=void 0;try{for(var v,f=t[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(this.childFilter.checkChildForRollupSubprocess(h,"measure")&&h.objectiveMeasureStatus&&null!==h.objectiveNormalizedMeasure){var m=this.calculateAdjustedWeight(h,h.sequencingControls.objectiveMeasureWeight,l);o+=h.objectiveNormalizedMeasure*m,a+=m,s.push({childId:h.id,measure:h.objectiveNormalizedMeasure,weight:m})}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return null===(r=this.eventCallback)||void 0===r||r.call(this,"complex_weighting_calculated",{activityId:e.id,weightingDetails:s,totalWeight:a,totalWeightedMeasure:o,result:a>0?o/a:0}),a>0?o/a:0}},{key:"calculateAdjustedWeight",value:function(e,t){var i,n=2>=arguments.length||void 0===arguments[2]||arguments[2],r=t;return"completed"!==e.completionStatus&&(r*=.8),e.attemptCount>1&&(r*=Math.max(.5,1-.1*(e.attemptCount-1))),e.hasAttemptLimitExceeded()&&(r*=.6),n&&e.objectiveMeasureStatus&&(r*=(null!==(i=e.scaledPassingScore)&&void 0!==i?i:.7)>e.objectiveNormalizedMeasure?.95:1.05),Math.max(0,r)}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Bn=Object.defineProperty,Vn=function(e,t,i){return function(e,t,i){return t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Hn=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vn(this,"childFilter"),Vn(this,"ruleEvaluator"),Vn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.eventCallback=n||null}return t=e,(i=[{key:"objectiveRollupProcess",value:function(e){var t=this.objectiveRollupUsingRules(e,e.rollupRules.rules);if(null!==t)return e.objectiveSatisfiedStatus=t,void this.syncPrimaryObjectiveFromActivity(e);var i=this.objectiveRollupUsingMeasure(e);if(null!==i)return e.objectiveSatisfiedStatus=i,void this.syncPrimaryObjectiveFromActivity(e);e.objectiveSatisfiedStatus=this.objectiveRollupUsingDefault(e),this.syncPrimaryObjectiveFromActivity(e)}},{key:"objectiveRollupUsingRules",value:function(e,t){var i=t.filter(function(e){return e.action===hn.SATISFIED}),n=t.filter(function(e){return e.action===hn.NOT_SATISFIED}),r=!0,o=!1,a=void 0;try{for(var s,l=i[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.ruleEvaluator.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}var c=!0,u=!1,d=void 0;try{for(var v,f=n[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)if(this.ruleEvaluator.evaluateRollupRule(e,v.value))return!1}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return null}},{key:"objectiveRollupUsingMeasure",value:function(e){return e.objectiveMeasureStatus&&null!==e.scaledPassingScore?e.objectiveNormalizedMeasure>=e.scaledPassingScore:null}},{key:"objectiveRollupUsingDefault",value:function(e){var t=this,i=e.getAvailableChildren();if(0===i.length)return!1;var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")||!t.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});return 0!==r.length&&!r.some(function(e){return!t.childFilter.isChildSatisfiedForRollup(e)})&&r.every(function(e){return t.childFilter.isChildSatisfiedForRollup(e)})}},{key:"syncPrimaryObjectiveFromActivity",value:function(e){e.primaryObjective&&(e.primaryObjective.satisfiedStatus=e.objectiveSatisfiedStatus,e.primaryObjective.satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,e.primaryObjective.measureStatus=e.objectiveMeasureStatus,e.primaryObjective.normalizedMeasure=e.objectiveNormalizedMeasure,e.primaryObjective.progressMeasure=e.progressMeasure,e.primaryObjective.progressMeasureStatus=e.progressMeasureStatus,e.primaryObjective.completionStatus=e.completionStatus)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Un=Object.defineProperty,Gn=function(e,t,i){return function(e,t,i){return t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Kn=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gn(this,"childFilter"),Gn(this,"ruleEvaluator"),Gn(this,"objectiveProcessor"),Gn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.objectiveProcessor=n,this.eventCallback=r||null}return t=e,(i=[{key:"activityProgressRollupProcess",value:function(e){var t=this;if(!this.activityProgressRollupUsingMeasure(e)){var i=e.rollupRules,n=i.rules.filter(function(e){return e.action===hn.COMPLETED}),r=i.rules.filter(function(e){return e.action===hn.INCOMPLETE}),o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)if(this.ruleEvaluator.evaluateRollupRule(e,l.value))return e.completionStatus=Se,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=!0,d=!1,v=void 0;try{for(var f,h=r[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)if(this.ruleEvaluator.evaluateRollupRule(e,f.value))return e.completionStatus=we,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var m=e.getAvailableChildren().filter(function(e){return t.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&t.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")});if(0===m.length)return e.completionStatus=we,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);if(m.some(function(e){return!t.childFilter.isChildCompletedForRollup(e)}))return e.completionStatus=we,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);e.completionStatus=Se,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}}},{key:"activityProgressRollupUsingMeasure",value:function(e){return!!e.completedByMeasure&&(e.attemptCompletionAmountStatus?(e.completionStatus=e.minProgressMeasure>e.attemptCompletionAmount?we:Se,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0):(e.completionStatus=Ce,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Yn=Object.defineProperty,Wn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}return t=e,(i=[{key:"durationRollupProcess",value:function(e){if(0!==e.children.length){var t=e.getAvailableChildren();if(0!==t.length){var i=null,n=null,r=null,o=null,a=0,s=0,u=!0,d=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value;m.activityStartTimestampUtc&&(i&&m.activityStartTimestampUtc>=i||(i=m.activityStartTimestampUtc)),m.activityEndedDate&&(r&&r>=m.activityEndedDate||(r=m.activityEndedDate));var p="PT0H0M0S"!==m.activityExperiencedDurationValue?m.activityExperiencedDurationValue:m.activityExperiencedDuration;if(p&&"PT0H0M0S"!==p&&(a+=c(p,Ne)),!e.attemptStartTimestampUtc||m.attemptStartTimestampUtc&&m.attemptStartTimestampUtc>=e.attemptStartTimestampUtc){m.attemptStartTimestampUtc&&(n&&m.attemptStartTimestampUtc>=n||(n=m.attemptStartTimestampUtc)),m.activityEndedDate&&(o&&o>=m.activityEndedDate||(o=m.activityEndedDate));var y="PT0H0M0S"!==m.attemptExperiencedDurationValue?m.attemptExperiencedDurationValue:m.attemptExperiencedDuration;y&&"PT0H0M0S"!==y&&(s+=c(y,Ne))}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}if(null!==i){var g;if(e.activityStartTimestampUtc=i,!e.attemptStartTimestampUtc&&n&&(e.attemptStartTimestampUtc=n),e.activityEndedDate=r,r&&e.activityStartTimestampUtc){var b=new Date(e.activityStartTimestampUtc),_=r.getTime()-b.getTime();e.activityAbsoluteDurationValue=l(Math.max(0,_/1e3))}if(o&&e.attemptStartTimestampUtc){var S=new Date(e.attemptStartTimestampUtc),w=o.getTime()-S.getTime();e.attemptAbsoluteDurationValue=l(Math.max(0,w/1e3))}e.activityExperiencedDurationValue=l(a),e.attemptExperiencedDurationValue=l(s),null===(g=this.eventCallback)||void 0===g||g.call(this,"duration_rollup_completed",{activityId:e.id,activityAbsoluteDuration:e.activityAbsoluteDurationValue,attemptAbsoluteDuration:e.attemptAbsoluteDurationValue,activityExperiencedDuration:e.activityExperiencedDurationValue,attemptExperiencedDuration:e.attemptExperiencedDurationValue,childCount:t.length})}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Jn=Object.defineProperty,Xn=function(e,t,i){return function(e,t,i){return t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},$n=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Xn(this,"measureProcessor"),Xn(this,"objectiveProcessor"),Xn(this,"progressProcessor"),Xn(this,"eventCallback"),Xn(this,"processingClusters",new Set),this.measureProcessor=t,this.objectiveProcessor=i,this.progressProcessor=n,this.eventCallback=r||null}return t=e,i=[{key:"processCrossClusterDependencies",value:function(e,t){var i,n,r,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(10>a)if(this.processingClusters.has(e.id))null===(i=this.eventCallback)||void 0===i||i.call(this,"cross_cluster_skip_reentrant",{activityId:e.id});else try{var s,l;this.processingClusters.add(e.id),null===(s=this.eventCallback)||void 0===s||s.call(this,"cross_cluster_processing_started",{activityId:e.id,clusterCount:t.length,depth:a});var c=new Map,u=!0,d=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.analyzeCrossClusterDependencies(f.value,c)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var m=this.resolveDependencyOrder(c),p=!0,y=!1,g=void 0;try{for(var b,_,S=function(){var e=_.value,i=t.find(function(t){return t.id===e});i&&b.processClusterRollup(i,a)},w=m[Symbol.iterator]();!(p=(_=w.next()).done);p=!0)b=this,S()}catch(e){y=!0,g=e}finally{try{p||null==w.return||w.return()}finally{if(y)throw g}}null===(l=this.eventCallback)||void 0===l||l.call(this,"cross_cluster_processing_completed",{activityId:e.id,processedClusters:m.length,dependencyMap:Array.from(c.entries())})}catch(t){var C;null===(C=this.eventCallback)||void 0===C||C.call(this,"cross_cluster_processing_error",{activityId:e.id,error:(n=t,r=Error,(null!=r&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)?t.message:t+"")})}finally{this.processingClusters.delete(e.id)}else null===(o=this.eventCallback)||void 0===o||o.call(this,"cross_cluster_max_depth_reached",{activityId:e.id,depth:a,maxDepth:10})}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"analyzeCrossClusterDependencies",value:function(e,t){t.set(e.id,[])}},{key:"resolveDependencyOrder",value:function(e){var t=this,i=[],n=new Set,r=function(id){if(!i.includes(id))if(n.has(id)){var o,a;null===(o=(a=t).eventCallback)||void 0===o||o.call(a,"circular_dependency_detected",{activityId:id})}else{n.add(id);var s=e.get(id)||[],l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)r(d.value)}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}n.delete(id),i.push(id)}},o=!0,a=!1,s=void 0;try{for(var l,c=Array.from(e.keys())[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)r(l.value)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return i}},{key:"processClusterRollup",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.measureProcessor.measureRollupProcess(e);e.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(e),e.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(e),i.length>1&&this.processCrossClusterDependencies(e,i,t+1)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Qn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var er=Object.defineProperty,tr=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}var t,i,n;return t=e,n=[{key:"getGlobalObjectiveReadState",value:function(e,t,i,n){var r={};if(i.readSatisfiedStatus&&n.satisfiedStatusKnown&&(r.satisfiedStatus=n.satisfiedStatus),i.readNormalizedMeasure&&n.normalizedMeasureKnown&&(r.normalizedMeasure=n.normalizedMeasure,t.satisfiedByMeasure)){var o,a,s=null!==(o=null!==(a=t.minNormalizedMeasure)&&void 0!==a?a:e.scaledPassingScore)&&void 0!==o?o:.7;r.satisfiedStatus=n.normalizedMeasure>=s}return i.readCompletionStatus&&n.completionStatusKnown&&(r.completionStatus=n.completionStatus),i.readProgressMeasure&&n.progressMeasureKnown&&(r.progressMeasure=n.progressMeasure),i.readRawScore&&n.rawScoreKnown&&(r.rawScore=n.rawScore),i.readMinScore&&n.minScoreKnown&&(r.minScore=n.minScore),i.readMaxScore&&n.maxScoreKnown&&(r.maxScore=n.maxScore),r}}],(i=[{key:"processGlobalObjectiveMapping",value:function(e,t){try{var i,n;null===(i=this.eventCallback)||void 0===i||i.call(this,"global_objective_processing_started",{activityId:e.id,globalObjectiveCount:t.size});var r=[];this.collectActivitiesRecursive(e,r);var o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)this.syncGlobalObjectivesWritePhase(l.value,t)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=!0,d=!1,v=void 0;try{for(var f,h=r[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.syncGlobalObjectivesReadPhase(f.value,t)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}null===(n=this.eventCallback)||void 0===n||n.call(this,"global_objective_processing_completed",{activityId:e.id,processedObjectives:t.size})}catch(t){var m;null===(m=this.eventCallback)||void 0===m||m.call(this,"global_objective_processing_error",{activityId:e.id,error:Zn(t,Error)?t.message:t+""})}}},{key:"collectActivitiesRecursive",value:function(e,result){result.push(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.collectActivitiesRecursive(r.value,result)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"syncGlobalObjectivesWritePhase",value:function(e,t){if(this.canWriteGlobalObjectives(e)){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],c=new Set,u=!0,d=!1,v=void 0;try{for(var f,h=l[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value,p=this.ensureGlobalObjectiveEntry(t,m.targetObjectiveID||s.id,s);if(m.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(s)&&s.isDirty("satisfiedStatus")&&(p.satisfiedStatus=s.satisfiedStatus,p.satisfiedStatusKnown=!0,c.add("satisfiedStatus")),m.writeNormalizedMeasure&&s.measureStatus&&s.isDirty("normalizedMeasure")&&(p.normalizedMeasure=s.normalizedMeasure,p.normalizedMeasureKnown=!0,c.add("normalizedMeasure"),m.writeSatisfiedStatus&&s.satisfiedByMeasure)){var y,g,b=null!==(y=null!==(g=s.minNormalizedMeasure)&&void 0!==g?g:e.scaledPassingScore)&&void 0!==y?y:.7;p.satisfiedStatus=s.normalizedMeasure>=b,p.satisfiedStatusKnown=!0,c.add("satisfiedStatus")}m.writeCompletionStatus&&s.completionStatus!==Ce&&s.isDirty("completionStatus")&&(p.completionStatus=s.completionStatus,p.completionStatusKnown=!0,c.add("completionStatus")),m.writeRawScore&&s.rawScoreKnown&&s.isDirty("rawScore")&&(p.rawScore=s.rawScore,p.rawScoreKnown=!0,c.add("rawScore")),m.writeMinScore&&s.minScoreKnown&&s.isDirty("minScore")&&(p.minScore=s.minScore,p.minScoreKnown=!0,c.add("minScore")),m.writeMaxScore&&s.maxScoreKnown&&s.isDirty("maxScore")&&(p.maxScore=s.maxScore,p.maxScoreKnown=!0,c.add("maxScore")),m.writeProgressMeasure&&s.progressMeasureStatus&&s.isDirty("progressMeasure")&&(p.progressMeasure=s.progressMeasure,p.progressMeasureKnown=!0,c.add("progressMeasure")),m.updateAttemptData&&this.updateActivityAttemptData(e,p,s)}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var _=!0,S=!1,w=void 0;try{for(var C,O=c[Symbol.iterator]();!(_=(C=O.next()).done);_=!0)s.clearDirty(C.value)}catch(e){S=!0,w=e}finally{try{_||null==O.return||O.return()}finally{if(S)throw w}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"syncGlobalObjectivesReadPhase",value:function(t,i){var objectives=t.getAllObjectives(),n=!0,r=!1,o=void 0;try{for(var a,s=objectives[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,c=l.mapInfo.length>0?l.mapInfo:[this.createDefaultMapInfo(l)],u=!0,d=!1,v=void 0;try{for(var f,h=c[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m,p=f.value,y=i.get(p.targetObjectiveID||l.id);if(y){var g=l.isPrimary,b=e.getGlobalObjectiveReadState(t,l,p,y);this.applyGlobalObjectiveReadState(l,b),g&&l.applyToActivity(t),null===(m=this.eventCallback)||void 0===m||m.call(this,"objective_synchronized",{activityId:t.id,objectiveId:l.id,globalState:y,synchronizationTime:(new Date).toISOString()})}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"synchronizeGlobalObjectives",value:function(e,t){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value,m=this.ensureGlobalObjectiveEntry(t,h.targetObjectiveID||s.id,s);this.syncObjectiveState(e,s,h,m)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"syncObjectiveState",value:function(t,i,n,r){try{var o,a=this.getLocalObjectiveState(t,i,i.isPrimary),s=e.getGlobalObjectiveReadState(t,i,n,r);if(this.applyGlobalObjectiveReadState(i,s),i.isPrimary&&i.applyToActivity(t),this.canWriteGlobalObjectives(t)){if(n.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(i)&&(r.satisfiedStatus=i.satisfiedStatus,r.satisfiedStatusKnown=!0),n.writeNormalizedMeasure&&i.measureStatus&&(r.normalizedMeasure=i.normalizedMeasure,r.normalizedMeasureKnown=!0,n.writeSatisfiedStatus&&i.satisfiedByMeasure)){var l,c,u=null!==(l=null!==(c=i.minNormalizedMeasure)&&void 0!==c?c:t.scaledPassingScore)&&void 0!==l?l:.7;r.satisfiedStatus=i.normalizedMeasure>=u,r.satisfiedStatusKnown=!0}n.writeCompletionStatus&&i.completionStatus!==Ce&&(r.completionStatus=i.completionStatus,r.completionStatusKnown=!0),n.writeRawScore&&i.rawScoreKnown&&(r.rawScore=i.rawScore,r.rawScoreKnown=!0),n.writeMinScore&&i.minScoreKnown&&(r.minScore=i.minScore,r.minScoreKnown=!0),n.writeMaxScore&&i.maxScoreKnown&&(r.maxScore=i.maxScore,r.maxScoreKnown=!0),n.writeProgressMeasure&&i.progressMeasureStatus&&(r.progressMeasure=i.progressMeasure,r.progressMeasureKnown=!0),n.updateAttemptData&&this.updateActivityAttemptData(t,r,i)}null===(o=this.eventCallback)||void 0===o||o.call(this,"objective_synchronized",{activityId:t.id,objectiveId:i.id,localState:a,globalState:r,synchronizationTime:(new Date).toISOString()})}catch(e){var d;null===(d=this.eventCallback)||void 0===d||d.call(this,"objective_sync_error",{activityId:t.id,objectiveId:i.id,error:Zn(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"applyGlobalObjectiveReadState",value:function(e,t){e.applyReadMappedState(t)}},{key:"ensureGlobalObjectiveEntry",value:function(e,t,i){return e.has(t)||e.set(t,{id:t,satisfiedStatus:!1,satisfiedStatusKnown:!1,normalizedMeasure:0,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:0,progressMeasureKnown:!1,completionStatus:Ce,completionStatusKnown:!1,satisfiedByMeasure:i.satisfiedByMeasure,minNormalizedMeasure:i.minNormalizedMeasure}),e.get(t)}},{key:"createDefaultMapInfo",value:function(e){return{targetObjectiveID:e.id,readSatisfiedStatus:!1,writeSatisfiedStatus:!0,readNormalizedMeasure:!1,writeNormalizedMeasure:!0,readCompletionStatus:!1,writeCompletionStatus:!0,readProgressMeasure:!1,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,updateAttemptData:e.isPrimary}}},{key:"hasKnownSatisfiedStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown}},{key:"canWriteGlobalObjectives",value:function(e){return!1!==e.sequencingControls.tracked}},{key:"getLocalObjectiveState",value:function(e,t,i){return i?{id:t.id,satisfiedStatus:e.objectiveSatisfiedStatus,measureStatus:e.objectiveMeasureStatus,normalizedMeasure:e.objectiveNormalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,scaledPassingScore:e.scaledPassingScore}:{id:t.id,satisfiedStatus:t.satisfiedStatus,measureStatus:t.measureStatus,normalizedMeasure:t.normalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:t.progressMeasure,progressMeasureStatus:t.progressMeasureStatus,completionStatus:t.completionStatus,scaledPassingScore:t.minNormalizedMeasure}}},{key:"updateActivityAttemptData",value:function(e,t,i){try{if(!i.isPrimary&&!t.updateAttemptData)return;var n=e.rollupRules.rules.some(function(e){return"completed"===e.action||"incomplete"===e.action});t.satisfiedStatusKnown&&t.satisfiedStatus&&(n||e.sequencingControls.completionSetByContent||e.attemptProgressStatus||e.completionStatus!==Ce&&e.completionStatus!==we||(e.completionStatus=Se),"unknown"===e.successStatus&&(e.successStatus="passed")),t.attemptCount&&t.attemptCount>e.attemptCount&&(e.attemptCount=t.attemptCount),t.progressMeasureKnown&&void 0!==t.progressMeasure&&(e.attemptCompletionAmount=t.progressMeasure),t.attemptAbsoluteDuration&&(e.attemptAbsoluteDuration=t.attemptAbsoluteDuration),t.attemptExperiencedDuration&&(e.attemptExperiencedDuration=t.attemptExperiencedDuration),t.activityAbsoluteDuration&&(e.activityAbsoluteDuration=t.activityAbsoluteDuration),t.activityExperiencedDuration&&(e.activityExperiencedDuration=t.activityExperiencedDuration),void 0!==t.location&&(e.location=t.location),void 0!==t.suspendData&&(e.isSuspended=t.suspendData.length>0)}catch(t){var r;null===(r=this.eventCallback)||void 0===r||r.call(this,"attempt_data_update_error",{activityId:e.id,error:Zn(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}}}])&&Qn(t.prototype,i),n&&Qn(t,n),e}();function ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var nr=Object.defineProperty,rr=function(e,t,i){return function(e,t,i){return t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},or=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rr(this,"rollupStateLog",[]),rr(this,"childFilter"),rr(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,(i=[{key:"validateRollupStateConsistency",value:function(e){try{var t,i;null===(t=this.eventCallback)||void 0===t||t.call(this,"rollup_validation_started",{activityId:e.id,timestamp:(new Date).toISOString()});var n,r=[];return this.validateActivityRollupState(e,r),r.length>0?(null===(n=this.eventCallback)||void 0===n||n.call(this,"rollup_state_inconsistencies",{activityId:e.id,inconsistencies:r,count:r.length}),!1):(null===(i=this.eventCallback)||void 0===i||i.call(this,"rollup_validation_completed",{activityId:e.id,result:"consistent"}),!0)}catch(t){var o;return null===(o=this.eventCallback)||void 0===o||o.call(this,"rollup_validation_error",{activityId:e.id,error:(a=t,s=Error,(null!=s&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](a):a instanceof s)?t.message:t+"")}),!1}var a,s}},{key:"validateActivityRollupState",value:function(e,t){var i=this,n=e.id;e.objectiveMeasureStatus&&null===e.objectiveNormalizedMeasure&&t.push("Activity ".concat(n,": measure status true but normalized measure is null")),e.objectiveMeasureStatus&&null!==e.scaledPassingScore&&"unknown"!==e.successStatus&&e.objectiveSatisfiedStatus!==e.objectiveNormalizedMeasure>=e.scaledPassingScore&&t.push("Activity ".concat(n,": satisfaction status inconsistent with measure"));var r=e.sequencingControls,o=e.getAvailableChildren();if(o.length>0&&r.rollupObjectiveSatisfied){var a=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")&&i.childFilter.isChildSatisfiedForRollup(e)}),s=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")&&!i.childFilter.isChildSatisfiedForRollup(e)});a.length>0&&0===s.length&&!1===e.objectiveSatisfiedStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children satisfied but parent is not satisfied (no rollup rules to override)"))}if(o.length>0&&r.rollupProgressCompletion){var l=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&i.childFilter.isChildCompletedForRollup(e)}),c=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")&&!i.childFilter.isChildCompletedForRollup(e)});l.length>0&&0===c.length&&"completed"!==e.completionStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children completed but parent is incomplete (no rollup rules to override)"))}var u=!0,d=!1,v=void 0;try{for(var f,h=o[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.validateActivityRollupState(f.value,t)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}this.rollupStateLog.push({activity:n,timestamp:(new Date).toISOString(),state:{measureStatus:e.objectiveMeasureStatus,measure:e.objectiveNormalizedMeasure,satisfiedStatus:e.objectiveSatisfiedStatus,completionStatus:e.completionStatus}})}},{key:"getRollupStateLog",value:function(){return function(e){if(Array.isArray(e))return ir(e)}(e=this.rollupStateLog)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ir(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e}},{key:"clearRollupStateLog",value:function(){this.rollupStateLog=[]}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ar=Object.defineProperty,sr=function(e,t,i){return function(e,t,i){return t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},lr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),sr(this,"childFilter"),sr(this,"ruleEvaluator"),sr(this,"measureProcessor"),sr(this,"objectiveProcessor"),sr(this,"progressProcessor"),sr(this,"durationProcessor"),sr(this,"globalObjectiveSynchronizer"),sr(this,"stateValidator"),sr(this,"crossClusterProcessor"),sr(this,"eventCallback"),this.eventCallback=t||null,this.childFilter=new Nn,this.ruleEvaluator=new Dn(this.childFilter),this.measureProcessor=new Fn(this.childFilter,t),this.objectiveProcessor=new Hn(this.childFilter,this.ruleEvaluator,t),this.progressProcessor=new Kn(this.childFilter,this.ruleEvaluator,this.objectiveProcessor,t),this.durationProcessor=new Wn(t),this.globalObjectiveSynchronizer=new tr(t),this.stateValidator=new or(this.childFilter,t),this.crossClusterProcessor=new $n(this.measureProcessor,this.objectiveProcessor,this.progressProcessor,t)}return t=e,(i=[{key:"overallRollupProcess",value:function(e){for(var t=[],i=e.parent,n=!1,r=!0;i;){if(i.children.length>0&&this.durationProcessor.durationRollupProcess(i),!n){var o=i.captureRollupStatus();if(i.sequencingControls.rollupObjectiveSatisfied||i.sequencingControls.rollupProgressCompletion){if(i.children.length>0){var a=this.measureProcessor.measureRollupProcess(i);this.measureProcessor.completionMeasureRollupProcess(i),a.length>1&&this.crossClusterProcessor.processCrossClusterDependencies(i,a)}i.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(i),i.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(i)}var s,l=i.captureRollupStatus();r||Pn.compareRollupStatus(o,l)&&(null===(s=this.eventCallback)||void 0===s||s.call(this,"rollup_optimization_activated",{activityId:i.id,depth:t.length}),n=!0),!r&&Pn.compareRollupStatus(o,l)||t.push(i)}i=i.parent,r=!1}return t}},{key:"validateRollupStateConsistency",value:function(e){return this.stateValidator.validateRollupStateConsistency(e)}},{key:"processGlobalObjectiveMapping",value:function(e,t){this.globalObjectiveSynchronizer.processGlobalObjectiveMapping(e,t)}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){return this.measureProcessor.calculateComplexWeightedMeasure(e,t,i)}},{key:"processCrossClusterDependencies",value:function(e,t){this.crossClusterProcessor.processCrossClusterDependencies(e,t)}},{key:"getChildFilter",value:function(){return this.childFilter}},{key:"getRuleEvaluator",value:function(){return this.ruleEvaluator}},{key:"getMeasureProcessor",value:function(){return this.measureProcessor}},{key:"getObjectiveProcessor",value:function(){return this.objectiveProcessor}},{key:"getProgressProcessor",value:function(){return this.progressProcessor}},{key:"getDurationProcessor",value:function(){return this.durationProcessor}},{key:"getGlobalObjectiveSynchronizer",value:function(){return this.globalObjectiveSynchronizer}},{key:"getStateValidator",value:function(){return this.stateValidator}},{key:"getCrossClusterProcessor",value:function(){return this.crossClusterProcessor}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function cr(e){var t=e.completionThreshold,i=e.progressMeasure,n=e.storedCompletionStatus;if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r)){if(""!==i&&null!=i){var o=parseFloat(i+"");if(!isNaN(o))return r>o?we:Se}return Ce}}return n||Ce}var ur=Object.defineProperty,dr=[Se,we,Ce],vr=[ge,be,_e];function fr(e){return e&&dr.includes(e)?e:null}function hr(e){return e&&vr.includes(e)?e:null}var mr=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"transferRteData",value:function(e){if(this.context.getCMIData){var t=this.context.getCMIData();t&&(this.transferPrimaryObjective(e,t),this.transferNonPrimaryObjectives(e,t),this.context.fireEvent("onRteDataTransfer",{activityId:e.id,timestamp:(new Date).toISOString()}))}}},{key:"transferPrimaryObjective",value:function(e,t){var i=!1;if(t.progress_measure&&""!==t.progress_measure){var n=parseFloat(t.progress_measure);isNaN(n)||(i=!0,e.progressMeasure=n,e.progressMeasureStatus=!0,e.attemptCompletionAmount=n,e.attemptCompletionAmountStatus=!0,e.primaryObjective&&(e.primaryObjective.progressMeasure=n,e.primaryObjective.progressMeasureStatus=!0))}if(i||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var r=cr({completionThreshold:e.minProgressMeasure,progressMeasure:t.progress_measure,storedCompletionStatus:Ce});e.completionStatus=r,e.attemptProgressStatus=r!==Ce}else{var o=fr(t.completion_status);o&&o!==Ce&&(e.completionStatus=o,e.attemptProgressStatus=!0)}var a=!1,s=!1,l=!1,c=0,u=hr(t.success_status);if(u&&u!==_e&&(a=!0,e.objectiveSatisfiedStatus=s=u===ge,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=u),t.score){var d;null===(d=e.primaryObjective)||void 0===d||d.initializeScoreFromCMI(this.getObjectiveScoreState(t.score));var v=this.normalizeScore(t.score);null!==v&&(l=!0,e.objectiveNormalizedMeasure=c=v,e.objectiveMeasureStatus=!0)}e.primaryObjective&&(a||l)&&(e.primaryObjective.initializeFromCMI(a?s:e.primaryObjective.satisfiedStatus,l?c:e.primaryObjective.normalizedMeasure,l),a&&(e.primaryObjective.satisfiedStatusKnown=!0,e.primaryObjective.progressStatus=!0))}},{key:"transferNonPrimaryObjectives",value:function(e,t){if(t.objectives&&0!==t.objectives.length){var i=!0,n=!1,r=void 0;try{for(var o,a=t.objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.id){var l=e.getObjectiveById(s.id);if(l){var c=l.objective,u=l.isPrimary,d=!1,v=!1,f=!1,h=0,m=!1,p=!1,y=hr(s.success_status);y&&y!==_e&&(v=y===ge,d=!0,c.progressStatus=!0);var g=fr(s.completion_status);if(g&&g!==Ce&&(c.completionStatus=g,m=!0),s.score){c.initializeScoreFromCMI(this.getObjectiveScoreState(s.score));var b=this.normalizeScore(s.score);null!==b&&(h=b,f=!0)}if((d||f)&&(c.initializeFromCMI(d?v:c.satisfiedStatus,f?h:c.normalizedMeasure,f),d&&(c.satisfiedStatusKnown=!0)),s.progress_measure&&""!==s.progress_measure){var _=parseFloat(s.progress_measure);isNaN(_)||(c.progressMeasure=_,c.progressMeasureStatus=!0,p=!0)}u&&(d||f||m||p)&&(c.applyToActivity(e),y&&y!==_e&&(e.successStatus=y),m&&(e.attemptProgressStatus=!0),p&&(e.attemptCompletionAmount=c.progressMeasure,e.attemptCompletionAmountStatus=!0))}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"normalizeScore",value:function(score){if(score.scaled&&""!==score.scaled){var e=parseFloat(score.scaled);if(!isNaN(e))return e}if(score.raw&&""!==score.raw&&score.min&&""!==score.min&&score.max&&""!==score.max){var t=parseFloat(score.raw),i=parseFloat(score.min),n=parseFloat(score.max);if(!isNaN(t)&&!isNaN(i)&&!isNaN(n)&&n>i)return Math.max(-1,Math.min(1,(t-i)/(n-i)))}return null}},{key:"getObjectiveScoreState",value:function(score){var e={};return void 0!==score.raw&&(e.rawScore=score.raw),void 0!==score.min&&(e.minScore=score.min),void 0!==score.max&&(e.maxScore=score.max),e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var pr=Object.defineProperty,yr=function(e,t,i){return function(e,t,i){return t in e?pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},gr=function(){function e(t,i,n,r){var o=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yr(this,"activityTree"),yr(this,"sequencingProcess"),yr(this,"rollupProcess"),yr(this,"globalObjectiveMap"),yr(this,"eventCallback"),yr(this,"getCMIData"),yr(this,"is4thEdition"),yr(this,"invalidateCacheCallback",null),yr(this,"_rteDataTransferService"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.globalObjectiveMap=r,this.eventCallback=a,this.getCMIData=(null==s?void 0:s.getCMIData)||null,this.is4thEdition=(null==s?void 0:s.is4thEdition)||!1,this._rteDataTransferService=new mr({getCMIData:this.getCMIData,fireEvent:function(e,t){return o.fireEvent(e,t)}})}return t=e,i=[{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"processTerminationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2?arguments[2]:void 0,i=this.activityTree.currentActivity;if(!i)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if((request===Et.EXIT||request===Et.ABANDON)&&!i.isActive)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-2",valid:!1};if(this.fireEvent("onTerminationRequestProcessing",{request:request,hasSequencingRequest:e,currentActivity:i.id,exitType:t}),"logout"===t)return this.fireEvent("onSequencingDebug",{message:"cmi.exit='logout' detected, treating as EXIT_ALL",activityId:i.id}),this.handleExitAll(i);switch(request){case Et.EXIT:return this.handleExit(i,e);case Et.EXIT_ALL:return this.handleExitAll(i);case Et.ABANDON:return this.handleAbandon(i,e);case Et.ABANDON_ALL:return this.handleAbandonAll(i);case Et.SUSPEND_ALL:return this.handleSuspendAll(i);default:return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-7",valid:!1}}}},{key:"handleExitTermination",value:function(e,t){return this.handleExit(e,t)}},{key:"handleExit",value:function(e,t){e.children.length>0&&this.terminateDescendants(e),this.endAttempt(e);var i=this.evaluateExitRules(e);if("EXIT_ALL"===i.action)return this.handleExitAll(e);"EXIT_PARENT"===i.action&&e.parent&&(this.activityTree.currentActivity=e.parent,this.endAttempt(this.activityTree.currentActivity));var n,r,o=this.applyAncestorExitActionRules(e);if("EXIT_ALL"===o.action)return this.handleExitAll(o.activity||e);if(o.exception)return{terminationRequest:Et.EXIT,sequencingRequest:null,exception:o.exception,valid:!1};do{if(n=!1,(r=this.evaluatePostConditions(this.activityTree.currentActivity||e)).terminationRequest===Et.EXIT_ALL)return this.fireEvent("onPostConditionExitAll",{activity:(this.activityTree.currentActivity||e).id}),this.handleExitAll(this.activityTree.root);if(r.terminationRequest===Et.EXIT_PARENT){var a=this.activityTree.currentActivity||e;if(!a.parent)return{terminationRequest:Et.EXIT_PARENT,sequencingRequest:null,exception:"TB.2.3-4",valid:!1};this.activityTree.currentActivity=a.parent,this.endAttempt(this.activityTree.currentActivity),n=!0,this.fireEvent("onPostConditionExitParent",{fromActivity:a.id,toActivity:this.activityTree.currentActivity.id})}if(!n&&(this.activityTree.currentActivity||e)===this.activityTree.root&&r.sequencingRequest!==Et.RETRY)return{terminationRequest:Et.EXIT,sequencingRequest:Et.EXIT,exception:null,valid:!0}}while(n);return{terminationRequest:Et.EXIT,sequencingRequest:r.sequencingRequest,exception:null,valid:!0}}},{key:"handleExitAll",value:function(e){return this.activityTree.root&&this.handleMultiLevelExit(this.activityTree.root),this.activityTree.root&&this.endAttempt(this.activityTree.root),this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Et.EXIT_ALL,sequencingRequest:Et.EXIT,exception:null,valid:!0}}},{key:"handleAbandon",value:function(e,t){return e.isActive=!1,t||(this.activityTree.currentActivity=e.parent),{terminationRequest:Et.ABANDON,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleAbandonAll",value:function(e){for(var t=[],i=e;null!==i;)t.push(i),i=i.parent;if(0===t.length)return{terminationRequest:Et.ABANDON_ALL,sequencingRequest:null,exception:"TB.2.3-6",valid:!1};var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)a.value.isActive=!1}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Et.ABANDON_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleSuspendAll",value:function(e){var t=this.processSuspendAllRequest(e);return t.valid?{terminationRequest:Et.SUSPEND_ALL,sequencingRequest:Et.EXIT,exception:null,valid:!0}:t}},{key:"processSuspendAllRequest",value:function(e){var t=this.activityTree.root;if(!e||!t)return this.fireEvent("onSuspendError",{exception:"TB.2.3-1",message:"No current activity to suspend",activity:null==e?void 0:e.id}),{terminationRequest:Et.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if(e===t&&!e.isActive&&!e.isSuspended)return this.fireEvent("onSuspendError",{exception:"TB.2.3-3",message:"Nothing to suspend (root activity)",activity:e.id}),{terminationRequest:Et.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-3",valid:!1};this.activityTree.suspendedActivity=e;for(var i=e,n=[],r=i;null!==r;)n.push(r),r=r.parent;if(0===n.length)return this.fireEvent("onSuspendError",{exception:"TB.2.3-5",message:"Activity path is empty",activity:null==i?void 0:i.id}),{terminationRequest:Et.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-5",valid:!1};var o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;u.isActive=!1,u.isSuspended=!0}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}return this.activityTree.currentActivity=t,t.isActive=!1,this.fireEvent("onActivitySuspended",{activity:null==i?void 0:i.id,suspendedPath:n.map(function(e){return e.id}),pathLength:n.length,timestamp:(new Date).toISOString()}),{terminationRequest:Et.SUSPEND_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"evaluateExitRules",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t++;var i=e.sequencingRules.exitConditionRules,n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l.evaluate(e)){if(l.action===ft.EXIT)return{action:"EXIT",recursionDepth:t};if(l.action===ft.EXIT_PARENT)return{action:"EXIT_PARENT",recursionDepth:t};if(l.action===ft.EXIT_ALL)return{action:"EXIT_ALL",recursionDepth:t}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null,recursionDepth:t}}},{key:"evaluatePostConditions",value:function(e){var t=this.sequencingProcess.evaluatePostConditionRules(e);return(t.sequencingRequest||t.terminationRequest)&&this.fireEvent("onPostConditionEvaluated",{activity:e.id,sequencingRequest:t.sequencingRequest,terminationRequest:t.terminationRequest,timestamp:(new Date).toISOString()}),t}},{key:"handleMultiLevelExit",value:function(e){this.processExitAtLevel(e,0),this.terminateAll(e)}},{key:"applyAncestorExitActionRules",value:function(e){for(var t=[],i=e.parent;i;)t.unshift(i),i=i.parent;var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,c=this.exitActionRulesSubprocess(l);if("EXIT_ALL"===c)return this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT_ALL",activity:l};if("EXIT_PARENT"===c)return l.parent?(this.terminateDescendants(l.parent),this.activityTree.currentActivity=l.parent,this.endAttempt(l.parent),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c,currentActivity:l.parent.id}),{action:"EXIT_PARENT",activity:l.parent}):{action:"EXIT_PARENT",activity:l,exception:"TB.2.3-4"};if("EXIT"===c)return this.terminateDescendants(l),this.activityTree.currentActivity=l,this.endAttempt(l),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT",activity:l}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null}}},{key:"processExitAtLevel",value:function(e,t){var i=this.evaluateExitRules(e,0);i.action&&this.fireEvent("onMultiLevelExitAction",{activity:e.id,level:t,action:i.action});var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.processExitAtLevel(a.value,t+1)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"cleanupSuspendedActivity",value:function(){var e=this.activityTree.suspendedActivity;if(e){for(var t=e,i=[];t;)t.isSuspended&&(t.isSuspended=!1,i.push(t.id)),t=t.parent;this.activityTree.suspendedActivity=null,this.fireEvent("onSuspendedActivityCleanup",{cleanedActivities:i,originalSuspendedActivity:e.id})}}},{key:"terminateAll",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateAll(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}e.isActive&&this.endAttempt(e)}},{key:"terminateDescendants",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.children.length>0&&this.terminateDescendants(a);var s=this.exitActionRulesSubprocess(a);a.isActive&&("EXIT_ALL"===s&&this.terminateDescendants(a),this.endAttempt(a))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"exitActionRulesSubprocess",value:function(e){var t=e.sequencingRules.exitConditionRules,i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.evaluate(e)){if(s.action===ft.EXIT)return"EXIT";if(s.action===ft.EXIT_PARENT)return"EXIT_PARENT";if(s.action===ft.EXIT_ALL)return"EXIT_ALL"}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"clearSuspendedActivity",value:function(){if(this.activityTree.suspendedActivity){for(var e=this.activityTree.suspendedActivity;e;)e.isSuspended=!1,e=e.parent;this.activityTree.suspendedActivity=null}}},{key:"endAttempt",value:function(e){if(e.isActive){if(this._rteDataTransferService.transferRteData(e),e.isActive=!1,e.activityAttemptActive=!1,0===e.children.length){if(!e.isSuspended&&(e.sequencingControls.completionSetByContent||e.attemptProgressStatus||(e.attemptProgressStatus=!0,e.completionStatus="completed",e.wasAutoCompleted=!0,this.fireEvent("onAutoCompletion",{activityId:e.id,timestamp:(new Date).toISOString()})),!e.sequencingControls.objectiveSetByContent)){var t=e.primaryObjective;t&&(t.progressStatus||(t.progressStatus=!0,t.satisfiedStatus=!0,e.objectiveSatisfiedStatus=!0,e.successStatus="passed",e.wasAutoSatisfied=!0,this.fireEvent("onAutoSatisfaction",{activityId:e.id,timestamp:(new Date).toISOString()})))}}else{var i=e.children.some(function(e){return e.isSuspended});e.isSuspended=i}"unknown"===e.completionStatus&&(e.completionStatus="incomplete"),"unknown"===e.successStatus&&e.objectiveSatisfiedStatus&&(e.successStatus=e.objectiveSatisfiedStatus?"passed":"failed"),this.rollupProcess.processGlobalObjectiveMapping(this.activityTree.root||e,this.globalObjectiveMap),this.rollupProcess.overallRollupProcess(e),this.invalidateCacheCallback&&this.invalidateCacheCallback(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root),Kt.applySelectionAndRandomization(e,!1)}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function br(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function _r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function wr(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Sr(e,t,i[t])})}return e}function Cr(e){return function(e){if(Array.isArray(e))return br(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return br(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?br(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Or=Object.defineProperty,Ar=function(e,t,i){return function(e,t,i){return t in e?Or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Er=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;_r(this,e),Ar(this,"valid"),Ar(this,"targetActivity"),Ar(this,"exception"),this.valid=t,this.targetActivity=i,this.exception=n},kr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;_r(this,e),Ar(this,"activityTree"),Ar(this,"rollupProcess"),Ar(this,"globalObjectiveMap"),Ar(this,"adlNav"),Ar(this,"eventCallback"),Ar(this,"now"),Ar(this,"defaultHideLmsUi"),Ar(this,"defaultAuxiliaryResources"),Ar(this,"_deliveryInProgress",!1),Ar(this,"contentDelivered",!1),Ar(this,"checkActivityCallback",null),Ar(this,"invalidateCacheCallback",null),Ar(this,"updateNavigationValidityCallback",null),Ar(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=i,this.globalObjectiveMap=n,this.adlNav=r,this.eventCallback=o,this.now=(null==a?void 0:a.now)||function(){return new Date},this.defaultHideLmsUi=(null==a?void 0:a.defaultHideLmsUi)?Cr(a.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==a?void 0:a.defaultAuxiliaryResources)?a.defaultAuxiliaryResources.map(function(e){return wr({},e)}):[]}return t=e,i=[{key:"setCheckActivityCallback",value:function(e){this.checkActivityCallback=e}},{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"setUpdateNavigationValidityCallback",value:function(e){this.updateNavigationValidityCallback=e}},{key:"setClearSuspendedActivityCallback",value:function(e){this.clearSuspendedActivityCallback=e}},{key:"isDeliveryInProgress",value:function(){return this._deliveryInProgress}},{key:"hasContentBeenDelivered",value:function(){return this.contentDelivered}},{key:"resetContentDelivered",value:function(){this.contentDelivered=!1}},{key:"setContentDelivered",value:function(e){this.contentDelivered=e}},{key:"processDeliveryRequest",value:function(e){if(this.fireEvent("onDeliveryRequestProcessing",{activity:e.id,timestamp:(new Date).toISOString()}),e.children.length>0)return new Er(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Er(!1,null,"DB.1.1-2");var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new Er(!1,null,"DB.1.1-3")}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return new Er(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var i=this.getActivityPath(e,!0),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;l.isActive||(t||l.isSuspended?l.isSuspended=!1:l.incrementAttemptCount(),l.isActive=!0,Kt.applySelectionAndRandomization(l,1>=l.attemptCount))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=this.defaultHideLmsUi[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)i.add(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}for(var l=t;l;){var c=!0,u=!1,d=void 0;try{for(var v,f=l.hideLmsUi[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)i.add(v.value)}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}l=l.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return i.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,i=!0,n=!1,r=void 0;try{for(var o,a=this.defaultAuxiliaryResources[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.resourceId&&t.set(s.resourceId,wr({},s))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}for(var l=[],c=e;c;)l.push(c),c=c.parent;var u=!0,d=!1,v=void 0;try{for(var f,h=l.reverse()[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value,p=!0,y=!1,g=void 0;try{for(var b,_=m.auxiliaryResources[Symbol.iterator]();!(p=(b=_.next()).done);p=!0){var S=b.value;S.resourceId&&t.set(S.resourceId,wr({},S))}}catch(e){y=!0,g=e}finally{try{p||null==_.return||_.return()}finally{if(y)throw g}}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}return Array.from(t.values())}},{key:"getContentActivityData",value:function(e){var t;return{hideLmsUi:this.getEffectiveHideLmsUi(e),auxiliaryResources:this.getEffectiveAuxiliaryResources(e),location:e.location||"",credit:e.credit||"credit",launchData:e.launchData||"",maxTimeAllowed:e.attemptAbsoluteDurationLimit||"",completionThreshold:(null===(t=e.completionThreshold)||void 0===t?void 0:""+t)||"",timeLimitAction:e.timeLimitAction||"continue,no message"}}},{key:"getActivityPath",value:function(e){for(var t=1>=arguments.length||void 0===arguments[1]||arguments[1],i=[],n=e;null!==n;)i.unshift(n),n=n.parent;return!t&&i.length>0&&i.pop(),i}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();Ar(kr,"HIDE_LMS_UI_ORDER",Cr(et));var jr=kr;var Rr=Object.defineProperty,Mr=function(e,t,i){return function(e,t,i){return t in e?Rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Tr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Mr(this,"activityTree"),Mr(this,"sequencingProcess"),Mr(this,"cache",null),Mr(this,"isDirty",!0),this.activityTree=t,this.sequencingProcess=i}return t=e,(i=[{key:"predictContinueEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.continueEnabled)&&void 0!==e&&e}},{key:"predictPreviousEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.previousEnabled)&&void 0!==e&&e}},{key:"predictChoiceEnabled",value:function(e){var t,i;return this.ensureCacheValid(),null!==(t=null===(i=this.cache)||void 0===i?void 0:i.choiceEnabledMap.get(e))&&void 0!==t&&t}},{key:"getAvailableChoices",value:function(){var e,t;return this.ensureCacheValid(),Array.from(null!==(e=null===(t=this.cache)||void 0===t?void 0:t.availableChoices)&&void 0!==e?e:[])}},{key:"getAllPredictions",value:function(){var e,t,i,n,r,o;return this.ensureCacheValid(),{continueEnabled:null!==(e=null===(n=this.cache)||void 0===n?void 0:n.continueEnabled)&&void 0!==e&&e,previousEnabled:null!==(t=null===(r=this.cache)||void 0===r?void 0:r.previousEnabled)&&void 0!==t&&t,availableChoices:Array.from(null!==(i=null===(o=this.cache)||void 0===o?void 0:o.availableChoices)&&void 0!==i?i:[])}}},{key:"invalidateCache",value:function(){this.isDirty=!0}},{key:"updateCache",value:function(){this.isDirty=!0,this.ensureCacheValid()}},{key:"ensureCacheValid",value:function(){var e=this.calculateTreeStateHash();!this.isDirty&&this.cache&&this.cache.treeStateHash===e||(this.recalculateCache(e),this.isDirty=!1)}},{key:"recalculateCache",value:function(e){var t=this.activityTree.currentActivity;this.cache={continueEnabled:!1,previousEnabled:!1,availableChoices:new Set,choiceEnabledMap:new Map,treeStateHash:e},t?(this.cache.continueEnabled=this.predictContinueInternal(t),this.cache.previousEnabled=this.predictPreviousInternal(t),this.calculateAvailableChoices()):this.calculateAvailableChoicesFromRoot()}},{key:"predictContinueInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&this.hasAvailableNextActivity(e)}},{key:"hasAvailableNextActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(i.length-1>n)for(var r=n+1;i.length>r;r++){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableForward(o))return!0}return!(!t.parent||!t.sequencingControls.flow)&&this.hasAvailableNextActivity(t)}},{key:"predictPreviousInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&!e.parent.sequencingControls.forwardOnly&&this.hasAvailablePreviousActivity(e)}},{key:"hasAvailablePreviousActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(n>0)for(var r=n-1;r>=0;r--){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableBackward(o))return!0}return!(!t.parent||!t.sequencingControls.flow||t.sequencingControls.forwardOnly)&&this.hasAvailablePreviousActivity(t)}},{key:"calculateAvailableChoicesFromRoot",value:function(){}},{key:"calculateAvailableChoices",value:function(){this.cache&&this.activityTree.root&&this.recursivelyCheckChoiceAvailability(this.activityTree.root)}},{key:"recursivelyCheckChoiceAvailability",value:function(e){if(this.cache){var t=this.sequencingProcess.validateNavigationRequest(Et.CHOICE,e.id,this.activityTree.currentActivity).valid;if(this.cache.choiceEnabledMap.set(e.id,t),t&&this.cache.availableChoices.add(e.id),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.recursivelyCheckChoiceAvailability(o.value)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}},{key:"isActivityPotentiallyDeliverableForward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return!!e.isVisible&&this.sequencingProcess.canActivityBeDelivered(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableForward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityPotentiallyDeliverableBackward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return e.isVisible;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableBackward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"calculateTreeStateHash",value:function(){var e,t,i=this.activityTree.currentActivity,n=this.activityTree.suspendedActivity;return[null!==(e=null==i?void 0:i.id)&&void 0!==e?e:"none",null!==(t=null==n?void 0:n.id)&&void 0!==t?t:"none",this.getActivityTreeStateSignature()].join("|")}},{key:"getActivityTreeStateSignature",value:function(){if(!this.activityTree.root)return"empty";var e=[];return this.collectActivitySignatures(this.activityTree.root,e),e.join(":")}},{key:"collectActivitySignatures",value:function(e,t){if(t.push(e.id+(e.isActive?"A":"-")+(e.isSuspended?"S":"-")+e.completionStatus+e.successStatus+e.attemptCount),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActivitySignatures(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ir=Object.defineProperty,Pr=function(e,t,i){return function(e,t,i){return t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Nr=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.NOT_VALID="_none_",e}(Nr||{}),qr=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;xr(this,e),Pr(this,"valid"),Pr(this,"terminationRequest"),Pr(this,"sequencingRequest"),Pr(this,"targetActivityId"),Pr(this,"exception"),this.valid=t,this.terminationRequest=i,this.sequencingRequest=n,this.targetActivityId=r,this.exception=o},Dr=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;xr(this,e),Pr(this,"activityTree"),Pr(this,"sequencingProcess"),Pr(this,"adlNav"),Pr(this,"eventCallback"),Pr(this,"navigationLookAhead"),Pr(this,"getEffectiveHideLmsUiCallback",null),this.activityTree=t,this.sequencingProcess=i,this.adlNav=n,this.eventCallback=r,this.navigationLookAhead=new Tr(t,i)}return t=e,i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"getNavigationLookAhead",value:function(){return this.navigationLookAhead}},{key:"validateRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.fireEvent("onNavigationRequestProcessing",{request:request,targetActivityId:e});var t=this.activityTree.currentActivity;switch(request){case"start":return this.validateStartRequest(t);case"resumeAll":return this.validateResumeRequest(t);case"continue":return this.validateContinueRequest(t);case"previous":return this.validatePreviousRequest(t);case"choice":return this.validateChoiceRequest(t,e);case"jump":return this.validateJumpRequest(e);case"exit":return this.validateExitRequest(t);case"exitAll":return this.validateExitAllRequest(t);case"abandon":return this.validateAbandonRequest(t);case"abandonAll":return this.validateAbandonAllRequest(t);case"suspendAll":return this.validateSuspendAllRequest(t);default:return new qr(!1,null,null,null,"NB.2.1-18")}}},{key:"validateStartRequest",value:function(e){return null!==e?new qr(!1,null,null,null,"NB.2.1-1"):new qr(!0,null,Et.START,null)}},{key:"validateResumeRequest",value:function(e){return null!==e?new qr(!1,null,null,null,"NB.2.1-2"):null===this.activityTree.suspendedActivity?new qr(!1,null,null,null,"NB.2.1-3"):new qr(!0,null,Et.RESUME_ALL,null)}},{key:"validateContinueRequest",value:function(e){return e?e.parent&&e.parent.sequencingControls.flow?new qr(!0,e.isActive?Et.EXIT:null,Et.CONTINUE,null):new qr(!1,null,null,null,"NB.2.1-5"):new qr(!1,null,null,null,"NB.2.1-4")}},{key:"validatePreviousRequest",value:function(e){if(!e)return new qr(!1,null,null,null,"NB.2.1-6");if(!e.parent||!e.parent.sequencingControls.flow)return new qr(!1,null,null,null,"NB.2.1-7");var t=this.validateForwardOnlyConstraints(e);return t.valid?new qr(!0,e.isActive?Et.EXIT:null,Et.PREVIOUS,null):new qr(!1,null,null,null,t.exception)}},{key:"validateChoiceRequest",value:function(e,t){if(!t)return new qr(!1,null,null,null,"NB.2.1-9");var i=this.activityTree.getActivity(t);if(!i)return new qr(!1,null,null,null,"NB.2.1-10");var n=this.validateChoicePath(e,i);return n.valid?new qr(!0,(null==e?void 0:e.isActive)?Et.EXIT:null,Et.CHOICE,t):new qr(!1,null,null,null,n.exception)}},{key:"validateJumpRequest",value:function(e){return e?new qr(!0,null,Et.JUMP,e):new qr(!1,null,null,null,"NB.2.1-12")}},{key:"validateExitRequest",value:function(e){return e?new qr(!0,e===this.activityTree.root?Et.EXIT_ALL:Et.EXIT,null,null):new qr(!1,null,null,null,"NB.2.1-13")}},{key:"validateExitAllRequest",value:function(e){return e?new qr(!0,Et.EXIT_ALL,null,null):new qr(!1,null,null,null,"NB.2.1-14")}},{key:"validateAbandonRequest",value:function(e){return e?new qr(!0,Et.ABANDON,null,null):new qr(!1,null,null,null,"NB.2.1-15")}},{key:"validateAbandonAllRequest",value:function(e){return e?new qr(!0,Et.ABANDON_ALL,null,null):new qr(!1,null,null,null,"NB.2.1-16")}},{key:"validateSuspendAllRequest",value:function(e){return e?new qr(!0,Et.SUSPEND_ALL,null,null):new qr(!1,null,null,null,"NB.2.1-17")}},{key:"validateChoicePath",value:function(e,t){if(t.isHiddenFromChoice)return{valid:!1,exception:"NB.2.1-11"};if(!t.isAvailable)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityDisabled(t))return{valid:!1,exception:"NB.2.1-11"};if(e){var i=this.findCommonAncestor(e,t);if(!i)return{valid:!1,exception:"NB.2.1-11"};for(var n=e;n&&n!==i;){if(!0===n.isActive&&n.sequencingControls&&!1===n.sequencingControls.choiceExit&&t!==n&&!this.activityContains(n,t))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}var r=this.validateConstrainChoice(e,t,i);if(!r.valid)return r;var o=this.validateChoiceSet(e,t,i);if(!o.valid)return o}for(var a=t;a;){if(a.parent&&!a.parent.sequencingControls.choice)return{valid:!1,exception:"NB.2.1-11"};a=a.parent}return{valid:!0,exception:null}}},{key:"validateForwardOnlyConstraints",value:function(e){var t,i;if(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};for(var n=null===(i=e.parent)||void 0===i?void 0:i.parent;n;){if(n.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};n=n.parent}return{valid:!0,exception:null}}},{key:"validateConstrainChoice",value:function(e,t,i){for(var n=i;n;){var r,o;if((null===(r=n.sequencingControls)||void 0===r?void 0:r.constrainChoice)||(null===(o=n.sequencingControls)||void 0===o?void 0:o.preventActivation)){var a,s,l=this.findChildContaining(n,e);if(!l)return{valid:!1,exception:"NB.2.1-11"};if(t===n)return{valid:!1,exception:"NB.2.1-11"};var c=this.findChildContaining(n,t);if(!c)return{valid:!1,exception:"NB.2.1-11"};if((null===(a=n.sequencingControls)||void 0===a?void 0:a.constrainChoice)&&c!==l)return{valid:!1,exception:"NB.2.1-11"};if((null===(s=n.sequencingControls)||void 0===s?void 0:s.preventActivation)&&c!==l&&this.requiresNewActivation(c,t))return{valid:!1,exception:"NB.2.1-11"}}n=n.parent}return this.validateAncestors(i,e,t)}},{key:"validateChoiceSet",value:function(e,t,i){if(!this.activityContains(i,t)&&t!==i)return{valid:!1,exception:"NB.2.1-11"};for(var n=t;n&&n!==i;){if(!n.isAvailable||n.isHiddenFromChoice||this.isActivityDisabled(n))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}return{valid:!0,exception:null}}},{key:"isActivityDisabled",value:function(e){if(!e.isAvailable)return!0;if(e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return!!t&&(t===ft.DISABLED||t===ft.HIDE_FROM_CHOICE||t===ft.STOP_FORWARD_TRAVERSAL)}},{key:"findChildContaining",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s===t)return s;if(this.activityContains(s,t))return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"activityContains",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"validateAncestors",value:function(e,t,i){var n=e.children;if(!n||0===n.length)return{valid:!0,exception:null};var r=this.findChildContaining(e,t),o=this.findChildContaining(e,i);if(!r||!o)return{valid:!1,exception:"NB.2.1-11"};var a=n.indexOf(r),s=n.indexOf(o);if(e.sequencingControls.forwardOnly&&a>s)return{valid:!1,exception:"NB.2.1-8"};var l=n.findIndex(function(e){return null==e?void 0:e.sequencingControls.stopForwardTraversal});if(r.sequencingControls.stopForwardTraversal&&s>a)return{valid:!1,exception:"NB.2.1-11"};if(-1!==l&&s>l)return{valid:!1,exception:"NB.2.1-11"};if(s>a&&e.sequencingControls.forwardOnly)for(var c=a+1;s>c;c++){var u=n[c];if(u){if(u.sequencingControls.stopForwardTraversal)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityMandatory(u)&&!this.isActivityCompleted(u))return{valid:!1,exception:"NB.2.1-11"}}}return{valid:!0,exception:null}}},{key:"requiresNewActivation",value:function(e,t){return!this.branchHasActiveAttempt(e)&&!t.activityAttemptActive&&!t.isActive}},{key:"branchHasActiveAttempt",value:function(e){if(e.activityAttemptActive||e.isActive)return!0;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.branchHasActiveAttempt(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityMandatory",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!1;var t=this.evaluatePreConditionRulesForChoice(e);return t!==ft.SKIP&&t!==ft.DISABLED&&t!==ft.HIDE_FROM_CHOICE&&t!==ft.STOP_FORWARD_TRAVERSAL&&!this.isActivityDisabled(e)&&!1!==e.mandatory}},{key:"isActivityCompleted",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return t===ft.SKIP||t===ft.DISABLED||t===ft.HIDE_FROM_CHOICE||t===ft.STOP_FORWARD_TRAVERSAL||!!this.isActivityDisabled(e)||"completed"===e.completionStatus||"passed"===e.successStatus||"passed"===e.successStatus}},{key:"evaluatePreConditionRulesForChoice",value:function(e){return e.sequencingRules&&e.sequencingRules.evaluatePreConditionRules(e)||null}},{key:"updateNavigationValidity",value:function(){if(this.adlNav&&this.activityTree.currentActivity){this.navigationLookAhead.invalidateCache();var e=this.navigationLookAhead.predictContinueEnabled();try{this.adlNav.request_valid.continue=e?"true":"false"}catch(e){}var t=this.navigationLookAhead.predictPreviousEnabled();try{this.adlNav.request_valid.previous=t?"true":"false"}catch(e){}var i=this.activityTree.getAllActivities(),n={},r={},o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=this.validateRequest("choice",u.id);n[u.id]=d.valid?"true":"false";var v=this.validateRequest("jump",u.id);r[u.id]=v.valid?"true":"false"}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}try{this.adlNav.request_valid.choice=n}catch(e){}try{this.adlNav.request_valid.jump=r}catch(e){}var f=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[];this.fireEvent("onNavigationValidityUpdate",{continue:e,previous:t,choice:n,jump:r,hideLmsUi:f})}}},{key:"getAllPredictions",value:function(){return this.navigationLookAhead.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationLookAhead.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationLookAhead.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationLookAhead.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationLookAhead.getAvailableChoices()}},{key:"invalidateCache",value:function(){this.navigationLookAhead.invalidateCache()}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function zr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Fr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Br(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){zr(e,t,i[t])})}return e}function Vr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Lr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Hr=Object.defineProperty,Ur=function(e,t,i){return function(e,t,i){return t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Gr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ur(this,"globalObjectiveMap",new Map),Ur(this,"eventCallback",null),this.eventCallback=t||null}return t=e,(i=[{key:"initialize",value:function(e){try{this.globalObjectiveMap.clear(),e&&this.collectObjectives(e),this.fireEvent("onGlobalObjectiveMapInitialized",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}catch(e){this.fireEvent("onGlobalObjectiveMapError",{error:Fr(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"collectObjectives",value:function(e){var objectives=e.getAllObjectives();if(0===objectives.length){var t="".concat(e.id,"_default_objective");this.globalObjectiveMap.has(t)||this.globalObjectiveMap.set(t,{id:t,satisfiedStatus:e.objectiveSatisfiedStatus,satisfiedStatusKnown:e.objectiveSatisfiedStatusKnown,normalizedMeasure:e.objectiveNormalizedMeasure,normalizedMeasureKnown:e.objectiveMeasureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:e.progressMeasure,progressMeasureKnown:e.progressMeasureStatus,completionStatus:e.completionStatus,completionStatusKnown:e.completionStatus!==Ce,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,satisfiedByMeasure:null!==e.scaledPassingScore,minNormalizedMeasure:e.scaledPassingScore,updateAttemptData:!0})}var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=s.mapInfo.length>0?s.mapInfo:[{targetObjectiveID:s.id,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,updateAttemptData:s.isPrimary}],c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h,m,p,y,g,b,_,S,w,C,O,A,E,k,j,R=v.value,M=R.targetObjectiveID||s.id;this.globalObjectiveMap.has(M)||this.globalObjectiveMap.set(M,{id:M,satisfiedStatus:s.satisfiedStatus,satisfiedStatusKnown:s.satisfiedStatusKnown||s.progressStatus,normalizedMeasure:s.normalizedMeasure,normalizedMeasureKnown:s.measureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:s.progressMeasure,progressMeasureKnown:s.progressMeasureStatus,completionStatus:s.completionStatus,completionStatusKnown:s.completionStatus!==Ce,readSatisfiedStatus:null!==(h=R.readSatisfiedStatus)&&void 0!==h&&h,writeSatisfiedStatus:null!==(m=R.writeSatisfiedStatus)&&void 0!==m&&m,readNormalizedMeasure:null!==(p=R.readNormalizedMeasure)&&void 0!==p&&p,writeNormalizedMeasure:null!==(y=R.writeNormalizedMeasure)&&void 0!==y&&y,readProgressMeasure:null!==(g=R.readProgressMeasure)&&void 0!==g&&g,writeProgressMeasure:null!==(b=R.writeProgressMeasure)&&void 0!==b&&b,readCompletionStatus:null!==(_=R.readCompletionStatus)&&void 0!==_&&_,writeCompletionStatus:null!==(S=R.writeCompletionStatus)&&void 0!==S&&S,readRawScore:null!==(w=R.readRawScore)&&void 0!==w&&w,writeRawScore:null!==(C=R.writeRawScore)&&void 0!==C&&C,readMinScore:null!==(O=R.readMinScore)&&void 0!==O&&O,writeMinScore:null!==(A=R.writeMinScore)&&void 0!==A&&A,readMaxScore:null!==(E=R.readMaxScore)&&void 0!==E&&E,writeMaxScore:null!==(k=R.writeMaxScore)&&void 0!==k&&k,satisfiedByMeasure:s.satisfiedByMeasure,minNormalizedMeasure:s.minNormalizedMeasure,updateAttemptData:null!==(j=R.updateAttemptData)&&void 0!==j?j:s.isPrimary})}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var T=!0,x=!1,I=void 0;try{for(var P,N=e.children[Symbol.iterator]();!(T=(P=N.next()).done);T=!0)this.collectObjectives(P.value)}catch(e){x=!0,I=e}finally{try{T||null==N.return||N.return()}finally{if(x)throw I}}}},{key:"getMap",value:function(){return this.globalObjectiveMap}},{key:"getSnapshot",value:function(){return this.serialize()}},{key:"restoreSnapshot",value:function(e){this.restore(e)}},{key:"updateObjective",value:function(e,t){try{this.globalObjectiveMap.set(e,(i=Br({},this.globalObjectiveMap.get(e),t),n=null!=(n={lastUpdated:(new Date).toISOString()})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(n)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(n,e))}),i)),this.fireEvent("onGlobalObjectiveUpdated",{objectiveId:e,data:t,timestamp:(new Date).toISOString()})}catch(t){this.fireEvent("onGlobalObjectiveUpdateError",{objectiveId:e,error:Fr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}var i,n}},{key:"synchronize",value:function(e,t){e&&t.processGlobalObjectiveMapping(e,this.globalObjectiveMap)}},{key:"getObjective",value:function(e){return this.globalObjectiveMap.get(e)}},{key:"hasObjective",value:function(e){return this.globalObjectiveMap.has(e)}},{key:"getObjectiveIds",value:function(){return Array.from(this.globalObjectiveMap.keys())}},{key:"getObjectiveCount",value:function(){return this.globalObjectiveMap.size}},{key:"clear",value:function(){this.globalObjectiveMap.clear(),this.fireEvent("onGlobalObjectiveMapCleared",{timestamp:(new Date).toISOString()})}},{key:"serialize",value:function(){var e={};return this.globalObjectiveMap.forEach(function(t,id){e[id]=Br({},t)}),e}},{key:"restore",value:function(e){if(this.globalObjectiveMap.clear(),e){var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=Vr(r.value,2);this.globalObjectiveMap.set(a[0],Br({},a[1]))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this.fireEvent("onGlobalObjectiveMapRestored",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire global objective event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Kr=Object.defineProperty,Yr=function(e,t,i){return function(e,t,i){return t in e?Kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Wr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Yr(this,"activityTree"),Yr(this,"globalObjectiveService"),Yr(this,"rollupProcess"),Yr(this,"adlNav"),Yr(this,"eventCallback"),Yr(this,"getEffectiveHideLmsUiCallback",null),Yr(this,"getEffectiveAuxiliaryResourcesCallback",null),Yr(this,"contentDeliveredGetter",null),Yr(this,"contentDeliveredSetter",null),this.activityTree=t,this.globalObjectiveService=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o}return t=e,(i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"setGetEffectiveAuxiliaryResourcesCallback",value:function(e){this.getEffectiveAuxiliaryResourcesCallback=e}},{key:"setContentDeliveredAccessors",value:function(e,t){this.contentDeliveredGetter=e,this.contentDeliveredSetter=t}},{key:"getState",value:function(){var e,t;return{version:"1.0",timestamp:(new Date).toISOString(),contentDelivered:!!this.contentDeliveredGetter&&this.contentDeliveredGetter(),currentActivity:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivity:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,activityStates:this.serializeActivities(),navigationState:this.getNavigationState(),globalObjectiveMap:this.globalObjectiveService.getSnapshot()}}},{key:"restoreState",value:function(e){try{if(!e||"1.0"!==e.version)return console.warn("Incompatible sequencing state version"),!1;if(this.contentDeliveredSetter&&this.contentDeliveredSetter(e.contentDelivered||!1),e.globalObjectiveMap&&this.globalObjectiveService.restoreSnapshot(e.globalObjectiveMap),e.activityStates&&this.deserializeActivities(e.activityStates),e.currentActivity){var t=this.activityTree.getActivity(e.currentActivity);t&&(this.activityTree.currentActivity=t,t.isActive=!0)}if(e.suspendedActivity){var i=this.activityTree.getActivity(e.suspendedActivity);i&&(this.activityTree.suspendedActivity=i,i.isSuspended=!0)}return e.navigationState&&this.restoreNavigationState(e.navigationState),this.activityTree.root&&this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess),console.debug("Sequencing state restored successfully"),!0}catch(e){return console.error("Failed to restore sequencing state: ".concat(e)),!1}}},{key:"serializeActivities",value:function(){var e={},t=function(i){e[i.id]={id:i.id,title:i.title,isActive:i.isActive,isSuspended:i.isSuspended,isCompleted:i.isCompleted,completionStatus:i.completionStatus,successStatus:i.successStatus,attemptCount:i.attemptCount,attemptCompletionAmount:i.attemptCompletionAmount,attemptAbsoluteDuration:i.attemptAbsoluteDuration,attemptExperiencedDuration:i.attemptExperiencedDuration,activityAbsoluteDuration:i.activityAbsoluteDuration,activityExperiencedDuration:i.activityExperiencedDuration,objectiveSatisfiedStatus:i.objectiveSatisfiedStatus,objectiveMeasureStatus:i.objectiveMeasureStatus,objectiveNormalizedMeasure:i.objectiveNormalizedMeasure,progressMeasure:i.progressMeasure,progressMeasureStatus:i.progressMeasureStatus,isAvailable:i.isAvailable,isHiddenFromChoice:i.isHiddenFromChoice,location:i.location,attemptAbsoluteStartTime:i.attemptAbsoluteStartTime,objectives:i.getObjectiveStateSnapshot(),auxiliaryResources:i.auxiliaryResources,selectionRandomizationState:{selectionCountStatus:i.sequencingControls.selectionCountStatus,reorderChildren:i.sequencingControls.reorderChildren,childOrder:i.children.map(function(e){return e.id}),selectedChildIds:i.children.filter(function(e){return e.isAvailable}).map(function(e){return e.id}),hiddenFromChoiceChildIds:i.children.filter(function(e){return e.isHiddenFromChoice}).map(function(e){return e.id})}};var n=!0,r=!1,o=void 0;try{for(var a,s=i.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)t(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}};return this.activityTree.root&&t(this.activityTree.root),e}},{key:"deserializeActivities",value:function(e){var t=function(i){var n,r=e[i.id];r&&(i.isActive=r.isActive||!1,i.isSuspended=r.isSuspended||!1,i.isCompleted=r.isCompleted||!1,i.completionStatus=r.completionStatus||"unknown",i.successStatus=r.successStatus||"unknown",i.attemptCount=r.attemptCount||0,i.attemptCompletionAmount=r.attemptCompletionAmount||0,i.attemptAbsoluteDuration=r.attemptAbsoluteDuration||"PT0H0M0S",i.attemptExperiencedDuration=r.attemptExperiencedDuration||"PT0H0M0S",i.activityAbsoluteDuration=r.activityAbsoluteDuration||"PT0H0M0S",i.activityExperiencedDuration=r.activityExperiencedDuration||"PT0H0M0S",i.objectiveSatisfiedStatus=r.objectiveSatisfiedStatus||!1,i.objectiveMeasureStatus=r.objectiveMeasureStatus||!1,i.objectiveNormalizedMeasure=r.objectiveNormalizedMeasure||0,i.progressMeasure=null!==(n=r.progressMeasure)&&void 0!==n?n:0,i.progressMeasureStatus=r.progressMeasureStatus||!1,i.isAvailable=!1!==r.isAvailable,i.isHiddenFromChoice=!0===r.isHiddenFromChoice,i.location=r.location||"",i.attemptAbsoluteStartTime=r.attemptAbsoluteStartTime||"",Array.isArray(r.auxiliaryResources)&&(i.auxiliaryResources=r.auxiliaryResources),r.objectives&&i.applyObjectiveStateSnapshot(r.objectives));var o=!0,a=!1,s=void 0;try{for(var l,c=i.children[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)t(l.value)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}if(null==r?void 0:r.selectionRandomizationState){var u=r.selectionRandomizationState,d=i.sequencingControls;void 0!==u.selectionCountStatus&&(d.selectionCountStatus=u.selectionCountStatus),void 0!==u.reorderChildren&&(d.reorderChildren=u.reorderChildren),u.childOrder&&u.childOrder.length>0&&i.setChildOrder(u.childOrder);var v=Array.isArray(u.selectedChildIds)?new Set(u.selectedChildIds):null,f=Array.isArray(u.hiddenFromChoiceChildIds)?new Set(u.hiddenFromChoiceChildIds):null;if(v||f){var h=!0,m=!1,p=void 0;try{for(var y,g=i.children[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;if(v){var _=v.has(b.id);b.isAvailable=_,f||(b.isHiddenFromChoice=!_)}f&&(b.isHiddenFromChoice=f.has(b.id))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}i.setProcessedChildren(i.children.filter(function(e){return e.isAvailable}))}else i.resetProcessedChildren()};this.activityTree.root&&t(this.activityTree.root)}},{key:"getNavigationState",value:function(){var e,t,i,n,r,o,a;if(!this.adlNav)return null;var s=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[],l=this.getEffectiveAuxiliaryResourcesCallback?this.getEffectiveAuxiliaryResourcesCallback(this.activityTree.currentActivity):[];return{request:this.adlNav.request||"_none_",requestValid:{continue:(null===(e=this.adlNav.request_valid)||void 0===e?void 0:e.continue)||"false",previous:(null===(t=this.adlNav.request_valid)||void 0===t?void 0:t.previous)||"false",choice:"unknown",jump:"unknown",exit:(null===(i=this.adlNav.request_valid)||void 0===i?void 0:i.exit)||"false",exitAll:(null===(n=this.adlNav.request_valid)||void 0===n?void 0:n.exitAll)||"false",abandon:(null===(r=this.adlNav.request_valid)||void 0===r?void 0:r.abandon)||"false",abandonAll:(null===(o=this.adlNav.request_valid)||void 0===o?void 0:o.abandonAll)||"false",suspendAll:(null===(a=this.adlNav.request_valid)||void 0===a?void 0:a.suspendAll)||"false"},hideLmsUi:s,auxiliaryResources:l}}},{key:"restoreNavigationState",value:function(e){if(this.adlNav&&e)try{if(e.requestValid){var t=e.requestValid;this.adlNav.request_valid.continue=t.continue||"false",this.adlNav.request_valid.previous=t.previous||"false",this.adlNav.request_valid.exit=t.exit||"false",this.adlNav.request_valid.exitAll=t.exitAll||"false",this.adlNav.request_valid.abandon=t.abandon||"false",this.adlNav.request_valid.abandonAll=t.abandonAll||"false",this.adlNav.request_valid.suspendAll=t.suspendAll||"false"}}catch(e){console.warn("Could not fully restore navigation state: ".concat(e))}}},{key:"getSuspensionState",value:function(){var e,t,i={activityTree:this.activityTree.root?this.activityTree.root.getSuspensionState():null,currentActivityId:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivityId:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,globalObjectives:this.globalObjectiveService.getSnapshot(),timestamp:(new Date).toISOString()};return this.fireEvent("onSuspensionStateCaptured",{hasActivityTree:!!i.activityTree,currentActivityId:i.currentActivityId,suspendedActivityId:i.suspendedActivityId,globalObjectiveCount:Object.keys(i.globalObjectives).length,timestamp:i.timestamp}),i}},{key:"restoreSuspensionState",value:function(e){var t,i;if(e)try{if(e.globalObjectives&&this.globalObjectiveService.restoreSnapshot(e.globalObjectives),e.activityTree&&this.activityTree.root&&this.activityTree.root.restoreSuspensionState(e.activityTree),e.currentActivityId){var n=this.activityTree.getActivity(e.currentActivityId);n&&(this.activityTree.currentActivity=n)}if(e.suspendedActivityId){var r=this.activityTree.getActivity(e.suspendedActivityId);r&&(this.activityTree.suspendedActivity=r)}this.fireEvent("onSuspensionStateRestored",{currentActivityId:e.currentActivityId,suspendedActivityId:e.suspendedActivityId,globalObjectiveCount:e.globalObjectives?Object.keys(e.globalObjectives).length:0,originalTimestamp:e.timestamp,restoreTimestamp:(new Date).toISOString()})}catch(e){throw this.fireEvent("onSuspensionStateRestoreError",{error:(t=e,i=Error,(null!=i&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?i[Symbol.hasInstance](t):t instanceof i)?e.message:e+""),timestamp:(new Date).toISOString()}),e}else this.fireEvent("onSuspensionStateRestoreError",{error:"No suspension state provided",timestamp:(new Date).toISOString()})}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire state manager event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Xr(e){return function(e){if(Array.isArray(e))return Jr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Jr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Jr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var $r=Object.defineProperty,Qr=function(e,t,i){return function(e,t,i){return t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Zr=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qr(this,"activityTree"),Qr(this,"eventCallback"),Qr(this,"now"),Qr(this,"contentDeliveredGetter",null),this.activityTree=t,this.eventCallback=i,this.now=(null==n?void 0:n.now)||function(){return new Date}}return t=e,(i=[{key:"setContentDeliveredGetter",value:function(e){this.contentDeliveredGetter=e}},{key:"validateTreeConsistency",value:function(e){if(!this.activityTree.root)return{consistent:!1,exception:"DB.1.1-4"};if(!this.isActivityPartOfTree(e,this.activityTree.root))return{consistent:!1,exception:"DB.1.1-5"};var t=this.getActiveActivities();if(t.length>1)return this.fireEvent("onStateInconsistency",{activeActivities:t.map(function(e){return e.id}),targetActivity:e.id}),{consistent:!1,exception:"DB.1.1-6"};for(var i=e;null==i?void 0:i.parent;){if(!i.parent.children.includes(i))return{consistent:!1,exception:"DB.1.1-7"};i=i.parent}return{consistent:!0,exception:null}}},{key:"validateResources",value:function(e){var t=this.getRequiredResources(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isResourceAvailable(o.value))return{available:!1,exception:"DB.1.1-8"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return this.checkSystemLimits().adequate?{available:!0,exception:null}:{available:!1,exception:"DB.1.1-9"}}},{key:"validateConcurrentDelivery",value:function(e){return this.contentDeliveredGetter&&this.contentDeliveredGetter()&&this.activityTree.currentActivity&&this.activityTree.currentActivity!==e?{allowed:!1,exception:"DB.1.1-10"}:this.hasPendingDeliveryRequests()?{allowed:!1,exception:"DB.1.1-11"}:this.isDeliveryLocked()?{allowed:!1,exception:"DB.1.1-12"}:{allowed:!0,exception:null}}},{key:"validateDependencies",value:function(e){var t=this.getPrerequisites(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isPrerequisiteSatisfied(o.value,e))return{satisfied:!1,exception:"DB.1.1-13"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var s=this.getObjectiveDependencies(e),l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)if(!this.isObjectiveDependencySatisfied(d.value))return{satisfied:!1,exception:"DB.1.1-14"}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}return this.getSequencingRuleDependencies(e).satisfied?{satisfied:!0,exception:null}:{satisfied:!1,exception:"DB.1.1-15"}}},{key:"checkActivity",value:function(e){return!!e.isAvailable&&!!this.checkLimitConditions(e)}},{key:"checkLimitConditions",value:function(e){var result=!0,t="";if(null!==e.attemptLimit&&e.attemptLimit>0&&(e.attemptLimit>e.attemptCount||(result=!1,t="Attempt limit exceeded")),result&&e.attemptAbsoluteDurationLimit){var i=c(e.attemptAbsoluteDurationLimit,Ne);i>0&&(i>c(e.attemptAbsoluteDuration||"PT0H0M0S",Ne)||(result=!1,t="Attempt duration limit exceeded"))}if(result&&e.activityAbsoluteDurationLimit){var n=c(e.activityAbsoluteDurationLimit,Ne);n>0&&(n>c(e.activityAbsoluteDuration||"PT0H0M0S",Ne)||(result=!1,t="Activity duration limit exceeded"))}if(result&&e.beginTimeLimit){var r=this.now();new Date(e.beginTimeLimit)>r&&(result=!1,t="Not yet time to begin")}return result&&e.endTimeLimit&&this.now()>new Date(e.endTimeLimit)&&(result=!1,t="Time limit expired"),this.fireEvent("onLimitConditionCheck",{activity:e,result:result,failureReason:t,checks:{attemptLimit:e.attemptLimit,attemptCount:e.attemptCount,attemptDurationLimit:e.attemptAbsoluteDurationLimit,activityDurationLimit:e.activityAbsoluteDurationLimit,beginTimeLimit:e.beginTimeLimit,endTimeLimit:e.endTimeLimit}}),result}},{key:"isActivityPartOfTree",value:function(e,t){if(e===t)return!0;var i=!0,n=!1,r=void 0;try{for(var o,a=t.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.isActivityPartOfTree(e,o.value))return!0}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!1}},{key:"getActiveActivities",value:function(){var e=[];return this.activityTree.root&&this.collectActiveActivities(this.activityTree.root,e),e}},{key:"collectActiveActivities",value:function(e,t){e.isActive&&t.push(e);var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActiveActivities(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"getRequiredResources",value:function(e){var t=[],i=(e.title+" "+e.location).toLowerCase();return(i.includes("video")||i.includes("multimedia"))&&t.push("video-codec"),(i.includes("audio")||i.includes("sound"))&&t.push("audio-codec"),(i.includes("flash")||i.includes(".swf"))&&t.push("flash-plugin"),(i.includes("java")||i.includes("applet"))&&t.push("java-runtime"),e.children&&e.children.length>0&&t.push("high-bandwidth"),e.attemptAbsoluteDurationLimit&&this.parseDurationToMinutes(e.attemptAbsoluteDurationLimit)>60&&t.push("extended-storage"),e.attemptLimit&&e.attemptLimit>1&&t.push("persistent-storage"),t}},{key:"isResourceAvailable",value:function(e){try{switch(e){case"video-codec":return!!document.createElement("video").canPlayType;case"audio-codec":return!!document.createElement("audio").canPlayType;case"flash-plugin":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Shockwave Flash"===e.name});case"java-runtime":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Java"===e.name});case"high-bandwidth":if("connection"in navigator){var t=navigator.connection;return"4g"===t.effectiveType||t.downlink>5}return!0;case"extended-storage":default:return!0;case"persistent-storage":return"localStorage"in window&&"sessionStorage"in window}}catch(e){return!1}}},{key:"checkSystemLimits",value:function(){try{var e=!0;if("memory"in performance){var t=performance.memory;t.usedJSHeapSize/t.jsHeapSizeLimit>.8&&(e=!1)}if("deviceMemory"in navigator&&2>navigator.deviceMemory&&(e=!1),"hardwareConcurrency"in navigator&&2>navigator.hardwareConcurrency&&(e=!1),"connection"in navigator){var i=navigator.connection;(i.saveData||"slow-2g"===i.effectiveType)&&(e=!1)}return{adequate:e}}catch(e){return{adequate:!0}}}},{key:"hasPendingDeliveryRequests",value:function(){return this.activityTree&&this.activityTree.pendingRequests?this.activityTree.pendingRequests.length>0:!("undefined"==typeof window||!window.pendingScormRequests)&&window.pendingScormRequests>0}},{key:"isDeliveryLocked",value:function(){return!((!this.activityTree||!this.activityTree.navigationLocked)&&(!this.activityTree||!this.activityTree.terminationInProgress)&&this.checkSystemLimits().adequate&&("undefined"==typeof window||!window.scormMaintenanceMode))}},{key:"getPrerequisites",value:function(e){var t,i=[];if(e.sequencingRules&&e.sequencingRules.preConditionRules){var n=!0,r=!1,o=void 0;try{for(var a,s=e.sequencingRules.preConditionRules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l.conditions&&l.conditions.length>0){var c=!0,u=!1,d=void 0;try{for(var v,f=l.conditions[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;h.referencedObjectiveID&&h.referencedObjectiveID!==e.id&&i.push(h.referencedObjectiveID)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}if(e.parent&&e.sequencingControls&&!e.sequencingControls.choiceExit){var m=e.parent.children;if(m)for(var p=m.indexOf(e),y=0;p>y;y++){var g=m[y];g&&i.push(g.id)}}return e.prerequisiteActivities&&(t=i).push.apply(t,Xr(e.prerequisiteActivities)),Array.from(new Set(i))}},{key:"isPrerequisiteSatisfied",value:function(e,t){var i=this.activityTree.getActivity(e);return!!i&&"completed"===i.completionStatus}},{key:"getObjectiveDependencies",value:function(e){var t=[],objectives=e.objectives;if(objectives&&objectives.length>0){var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.globalObjectiveID&&t.push(s.globalObjectiveID),!s.satisfiedByMeasure&&s.readNormalizedMeasure&&t.push(s.id+"_measure")}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules){var l=Xr(e.sequencingRules.preConditionRules||[]).concat(Xr(e.sequencingRules.exitConditionRules||[]),Xr(e.sequencingRules.postConditionRules||[])),c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(h.conditions&&h.conditions.length>0){var m=!0,p=!1,y=void 0;try{for(var g,b=h.conditions[Symbol.iterator]();!(m=(g=b.next()).done);m=!0){var _=g.value;_.objectiveReference&&_.objectiveReference!==e.id&&t.push(_.objectiveReference)}}catch(e){p=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(p)throw y}}}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}}return Array.from(new Set(t))}},{key:"isObjectiveDependencySatisfied",value:function(e){if(this.activityTree&&this.activityTree.globalObjectives){var t=this.activityTree.globalObjectives[e];if(t)return!0===t.satisfied&&!0===t.statusKnown}if(e.endsWith("_measure")){var i=e.replace("_measure","");if(this.activityTree&&this.activityTree.globalObjectives){var n=this.activityTree.globalObjectives[i];if(n)return!0===n.measureKnown&&n.normalizedMeasure>=0}}var r=this.activityTree.getActivity(e);return!!r&&r.objectiveSatisfiedStatus&&r.objectiveMeasureStatus}},{key:"getSequencingRuleDependencies",value:function(e){var t=!0;try{if(e.sequencingRules&&e.sequencingRules.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=e.sequencingRules.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.conditions&&s.conditions.length>0){var l=!0,c=!1,u=void 0;try{for(var d,v=s.conditions[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value;switch(f.conditionType||f.condition){case"activityProgressKnown":e.progressMeasureStatus||(t=!1);break;case"objectiveStatusKnown":case"objectiveSatisfied":this.isObjectiveDependencySatisfied(f.referencedObjectiveID||e.id)||(t=!1);break;case"attemptLimitExceeded":null===e.attemptLimit&&(t=!1);break;case"timeLimitExceeded":e.attemptAbsoluteDurationLimit||e.activityAbsoluteDurationLimit||(t=!1);break;case"always":case"never":break;default:t=!1}}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules&&e.sequencingRules.exitConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=e.sequencingRules.exitConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;if(b.conditions&&b.conditions.length>0){var _=!0,S=!1,w=void 0;try{for(var C,O=b.conditions[Symbol.iterator]();!(_=(C=O.next()).done);_=!0){var A=C.value;["objectiveStatusKnown","objectiveSatisfied"].includes(A.conditionType||A.condition)&&(this.isObjectiveDependencySatisfied(A.referencedObjectiveID||e.id)||(t=!1))}}catch(e){S=!0,w=e}finally{try{_||null==O.return||O.return()}finally{if(S)throw w}}}}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}if(e.rollupRules&&e.rollupRules.rules){var E=!0,k=!1,j=void 0;try{for(var R,M=e.rollupRules.rules[Symbol.iterator]();!(E=(R=M.next()).done);E=!0){var T=R.value;if(T.conditions&&T.conditions.length>0&&e.children&&e.children.length>0){var x=!0,I=!1,P=void 0;try{for(var N,q=e.children[Symbol.iterator]();!(x=(N=q.next()).done);x=!0)if(!N.value.isCompleted){t=!1;break}}catch(e){I=!0,P=e}finally{try{x||null==q.return||q.return()}finally{if(I)throw P}}}}}catch(e){k=!0,j=e}finally{try{E||null==M.return||M.return()}finally{if(k)throw j}}}}catch(e){t=!1}return{satisfied:t}}},{key:"parseDurationToMinutes",value:function(e){return c(e,Ne)/60}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire delivery validator event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var eo=Object.defineProperty,to=function(e,t,i){return function(e,t,i){return t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},io=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),to(this,"activityTree"),to(this,"sequencingProcess"),to(this,"rollupProcess"),to(this,"adlNav"),to(this,"eventCallback",null),to(this,"terminationHandler"),to(this,"deliveryHandler"),to(this,"navigationValidityService"),to(this,"globalObjectiveService"),to(this,"stateManager"),to(this,"deliveryValidator"),to(this,"navigationLookAhead"),to(this,"enhancedDeliveryValidation"),to(this,"is4thEdition"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o,this.enhancedDeliveryValidation=!0===(null==a?void 0:a.enhancedDeliveryValidation),this.is4thEdition=(null==a?void 0:a.is4thEdition)||!1,this.globalObjectiveService=new Gr(o||void 0),this.globalObjectiveService.initialize(t.root);var s={};(null==a?void 0:a.now)&&(s.now=a.now),this.deliveryValidator=new Zr(t,o,s);var l={};(null==a?void 0:a.getCMIData)&&(l.getCMIData=a.getCMIData),void 0!==(null==a?void 0:a.is4thEdition)&&(l.is4thEdition=a.is4thEdition),this.terminationHandler=new gr(t,i,n,this.globalObjectiveService.getMap(),o,l);var c={};(null==a?void 0:a.now)&&(c.now=a.now),(null==a?void 0:a.defaultHideLmsUi)&&(c.defaultHideLmsUi=a.defaultHideLmsUi),(null==a?void 0:a.defaultAuxiliaryResources)&&(c.defaultAuxiliaryResources=a.defaultAuxiliaryResources),this.deliveryHandler=new jr(t,n,this.globalObjectiveService.getMap(),r,o,c),this.navigationValidityService=new Dr(t,i,r,o),this.stateManager=new Wr(t,this.globalObjectiveService,n,r,o),this.navigationLookAhead=this.navigationValidityService.getNavigationLookAhead(),this.setupCallbacks()}return t=e,i=[{key:"setupCallbacks",value:function(){var e=this;this.terminationHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setCheckActivityCallback(function(t){return e.deliveryValidator.checkActivity(t)}),this.deliveryHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setUpdateNavigationValidityCallback(function(){e.navigationValidityService.updateNavigationValidity()}),this.deliveryHandler.setClearSuspendedActivityCallback(function(){e.terminationHandler.clearSuspendedActivity()}),this.deliveryValidator.setContentDeliveredGetter(function(){return e.deliveryHandler.hasContentBeenDelivered()}),this.navigationValidityService.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveAuxiliaryResourcesCallback(function(t){return e.deliveryHandler.getEffectiveAuxiliaryResources(t)}),this.stateManager.setContentDeliveredAccessors(function(){return e.deliveryHandler.hasContentBeenDelivered()},function(t){return e.deliveryHandler.setContentDelivered(t)})}},{key:"processNavigationRequest",value:function(e){var t=arguments.length>2?arguments[2]:void 0,i=this.navigationValidityService.validateRequest(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);if(!i.valid)return new Er(!1,null,i.exception);if(i.terminationRequest){var n=!!i.sequencingRequest,r=this.terminationHandler.processTerminationRequest(i.terminationRequest,n,t);if(!r.valid)return new Er(!1,null,r.exception||"TB.2.3-1");if(null!==r.sequencingRequest&&(n||r.sequencingRequest!==Et.EXIT)&&(i.sequencingRequest=r.sequencingRequest),!i.sequencingRequest)return i.terminationRequest!==Et.EXIT_ALL&&i.terminationRequest!==Et.ABANDON_ALL||this.fireEvent("onSequencingSessionEnd",{reason:i.terminationRequest===Et.EXIT_ALL?"exit_all":"abandon_all",navigationRequest:e}),new Er(!0,null)}if(i.sequencingRequest){var o=this.sequencingProcess.sequencingRequestProcess(i.sequencingRequest,i.targetActivityId);if(o.endSequencingSession)return this.fireEvent("onSequencingSessionEnd",{reason:"end_of_content",exception:o.exception,navigationRequest:e}),new Er(!1,null,o.exception||"SESSION_ENDED");if(o.exception)return new Er(!1,null,o.exception);if(o.deliveryRequest===kt.DELIVER&&o.targetActivity)return this.activityTree.root&&(this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)||this.fireEvent("onSequencingDebug",{message:"Rollup state inconsistency detected before delivery",activityId:this.activityTree.root.id})),this.rollupProcess.processGlobalObjectiveMapping(o.targetActivity,this.globalObjectiveService.getMap()),this.processDelivery(o.targetActivity)}return new Er(!1,null,"OP.1-1")}},{key:"processDelivery",value:function(e){if(this.enhancedDeliveryValidation){var t=this.deliveryValidator.validateTreeConsistency(e);if(!t.consistent)return new Er(!1,null,t.exception);var i=this.deliveryValidator.validateResources(e);if(!i.available)return new Er(!1,null,i.exception);var n=this.deliveryValidator.validateConcurrentDelivery(e);if(!n.allowed)return new Er(!1,null,n.exception);var r=this.deliveryValidator.validateDependencies(e);if(!r.satisfied)return new Er(!1,null,r.exception)}var o=this.deliveryHandler.processDeliveryRequest(e);return o.valid&&(this.deliveryHandler.contentDeliveryEnvironmentProcess(o.targetActivity),this.navigationLookAhead.invalidateCache(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)),o}},{key:"hasContentBeenDelivered",value:function(){return this.deliveryHandler.hasContentBeenDelivered()}},{key:"isDeliveryInProgress",value:function(){return this.deliveryHandler.isDeliveryInProgress()}},{key:"resetContentDelivered",value:function(){this.deliveryHandler.resetContentDelivered()}},{key:"setContentDelivered",value:function(e){this.deliveryHandler.setContentDelivered(e)}},{key:"updateNavigationValidity",value:function(){this.navigationValidityService.updateNavigationValidity()}},{key:"synchronizeGlobalObjectives",value:function(){this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess)}},{key:"getGlobalObjectiveMap",value:function(){return this.globalObjectiveService.getMap()}},{key:"getGlobalObjectiveMapSnapshot",value:function(){return this.globalObjectiveService.getSnapshot()}},{key:"restoreGlobalObjectiveMapSnapshot",value:function(e){this.globalObjectiveService.restoreSnapshot(e)}},{key:"updateGlobalObjective",value:function(e,t){this.globalObjectiveService.updateObjective(e,t)}},{key:"getSequencingState",value:function(){return this.stateManager.getState()}},{key:"restoreSequencingState",value:function(e){return this.stateManager.restoreState(e)}},{key:"getSuspensionState",value:function(){return this.stateManager.getSuspensionState()}},{key:"restoreSuspensionState",value:function(e){this.stateManager.restoreSuspensionState(e)}},{key:"getNavigationLookAhead",value:function(){return this.navigationValidityService.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationValidityService.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationValidityService.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationValidityService.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationValidityService.getAvailableChoices()}},{key:"invalidateNavigationCache",value:function(){this.navigationValidityService.invalidateCache()}},{key:"applyDeliveryControls",value:function(e){e.sequencingControls.completionSetByContent||e.completionStatus===Ce&&(e.completionStatus=Se,e.wasAutoCompleted=!0),e.sequencingControls.objectiveSetByContent||e.successStatus===_e&&(e.successStatus=ge,e.wasAutoSatisfied=!0)}},{key:"getEffectiveHideLmsUi",value:function(e){return this.deliveryHandler.getEffectiveHideLmsUi(e)}},{key:"getEffectiveAuxiliaryResources",value:function(e){return this.deliveryHandler.getEffectiveAuxiliaryResources(e)}},{key:"getContentActivityData",value:function(e){return this.deliveryHandler.getContentActivityData(e)}},{key:"terminationRequestProcess",value:function(request,e,t){return this.terminationHandler.processTerminationRequest(request,e,t)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this.deliveryHandler.contentDeliveryEnvironmentProcess(e)}},{key:"endAttemptProcess",value:function(e){this.terminationHandler.endAttempt(e)}},{key:"handleExitTermination",value:function(e,t){return this.terminationHandler.handleExitTermination(e,t)}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function no(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ro(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function oo(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ro(e,t,i[t])})}return e}function ao(e){return function(e){if(Array.isArray(e))return no(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return no(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?no(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var so=Object.defineProperty,lo=function(e,t,i){return function(e,t,i){return t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},co=function(){function e(t,cmi,adl,i,n){var r=this,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lo(this,"sequencing"),lo(this,"cmi"),lo(this,"adl"),lo(this,"eventService"),lo(this,"loggingService"),lo(this,"activityDeliveryService"),lo(this,"rollupProcess"),lo(this,"overallSequencingProcess",null),lo(this,"sequencingProcess",null),lo(this,"eventListeners",{}),lo(this,"configuration"),lo(this,"isInitialized",!1),lo(this,"isSequencingActive",!1),lo(this,"lastCMIValues",new Map),lo(this,"lastSequencingResult",null),this.sequencing=t,this.cmi=cmi,this.adl=adl,this.eventService=i,this.loggingService=n,this.configuration=oo({autoRollupOnCMIChange:!0,autoProgressOnCompletion:!1,validateNavigationRequests:!0,enableEventSystem:!0,logLevel:"info",now:function(){return new Date}},o),this.activityDeliveryService=new hi(i,n,{onDeliverActivity:function(e){return r.handleActivityDelivery(e)},onUnloadActivity:function(e){return r.handleActivityUnload(e)},onSequencingComplete:function(result){return r.handleSequencingComplete(result)},onSequencingError:function(e){return r.handleSequencingError(e)}}),this.rollupProcess=new lr,this.configuration.now&&mt.setNowProvider(this.configuration.now),this.setupCMIChangeWatchers(),this.createSequencingProcesses()}return t=e,i=[{key:"createSequencingProcesses",value:function(){var e=this;try{if(this.sequencing.initialized||this.sequencing.initialize(),this.sequencing.adlNav=this.adl.nav,this.sequencing.activityTree.root){var t={};this.configuration.now&&(t.now=this.configuration.now),this.configuration.getAttemptElapsedSeconds&&(t.getAttemptElapsedSeconds=this.configuration.getAttemptElapsedSeconds),this.configuration.getActivityElapsedSeconds&&(t.getActivityElapsedSeconds=this.configuration.getActivityElapsedSeconds),this.sequencingProcess=new ui(this.sequencing.activityTree,this.sequencing.sequencingRules,this.sequencing.sequencingControls,this.adl.nav,t);var i={};this.configuration.now&&(i.now=this.configuration.now),i.defaultHideLmsUi=ao(this.sequencing.hideLmsUi),this.sequencing.auxiliaryResources.length>0&&(i.defaultAuxiliaryResources=this.sequencing.auxiliaryResources.map(function(e){return{resourceId:e.resourceId,purpose:e.purpose}})),i.getCMIData=function(){return e.getCMIDataForTransfer()},this.overallSequencingProcess=new io(this.sequencing.activityTree,this.sequencingProcess,this.rollupProcess,this.adl.nav,function(t,i){return e.handleSequencingProcessEvent(t,i)},i),this.sequencing.overallSequencingProcess=this.overallSequencingProcess,this.isInitialized=!0,this.log("info","Sequencing processes created and ready for navigation")}}catch(e){this.log("error","Failed to create sequencing processes: ".concat(e))}}},{key:"initialize",value:function(){try{return this.log("info","Initializing sequencing service for SCO session"),this.isInitialized||this.createSequencingProcesses(),this.shouldAutoStartSequencing()&&!this.isSequencingActive&&this.startSequencing(),this.initializeCMITracking(),this.fireEvent("onSequencingStart",this.sequencing.getCurrentActivity()),this.log("info","Sequencing service initialized successfully"),z}catch(t){var e="Failed to initialize sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"initialization"),F}}},{key:"terminate",value:function(){try{return this.log("info","Terminating sequencing service"),this.triggerFinalRollup(),this.endSequencing(),this.isInitialized=!1,this.fireEvent("onSequencingEnd"),this.log("info","Sequencing service terminated successfully"),z}catch(t){var e="Failed to terminate sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"termination"),F}}},{key:"processNavigationRequest",value:function(request,e,t){if(!this.isInitialized||!this.overallSequencingProcess)return this.log("warn","Navigation request '".concat(request,"' ignored - sequencing not initialized")),!1;try{this.log("info","Processing navigation request: ".concat(request).concat(e?" (target: ".concat(e,")"):"").concat(t?" (exit: ".concat(t,")"):"")),this.fireEvent("onNavigationRequest",request,e);var i=this.parseNavigationRequest(request);if(null===i)return this.log("warn","Invalid navigation request: ".concat(request)),!1;var n=this.overallSequencingProcess.processNavigationRequest(i,e||null,t),r={deliveryRequest:n.valid?kt.DELIVER:kt.DO_NOT_DELIVER,targetActivity:n.targetActivity,exception:n.exception||null,endSequencingSession:!1};return this.lastSequencingResult=r,n.valid&&n.targetActivity?(this.activityDeliveryService.processSequencingResult(r),this.overallSequencingProcess.updateNavigationValidity(),this.log("info","Navigation request '".concat(request,"' resulted in activity delivery: ").concat(n.targetActivity.id)),!0):(n.exception?(this.log("warn","Navigation request '".concat(request,"' failed: ").concat(n.exception)),this.fireEvent("onSequencingError",n.exception,"navigation")):this.log("info","Navigation request '".concat(request,"' completed with no activity delivery")),n.valid)}catch(e){var o="Error processing navigation request '".concat(request,"': ").concat(e);return this.log("error",o),this.fireEvent("onSequencingError",o,"navigation"),!1}}},{key:"triggerRollupOnCMIChange",value:function(e,t,i){if(this.configuration.autoRollupOnCMIChange&&this.isInitialized&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.progress_measure","cmi.objectives.n.success_status","cmi.objectives.n.completion_status","cmi.objectives.n.score.scaled"].some(function(t){return e.startsWith(t)}))try{this.log("debug","Triggering rollup due to CMI change: ".concat(e," = ").concat(i," (was ").concat(t,")"));var n=this.sequencing.getCurrentActivity();if(!n)return void this.log("debug","No current activity for rollup");this.updateActivityFromCMI(n),this.rollupProcess.overallRollupProcess(n),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.overallSequencingProcess&&this.overallSequencingProcess.updateNavigationValidity(),this.fireEvent("onRollupComplete",n),this.log("debug","Rollup completed for activity: ".concat(n.id))}catch(e){var r="Error during rollup on CMI change: ".concat(e);this.log("error",r),this.fireEvent("onSequencingError",r,"rollup")}}},{key:"setEventListeners",value:function(e){this.eventListeners=oo({},this.eventListeners,e),this.log("debug","Sequencing event listeners updated")}},{key:"updateConfiguration",value:function(e){this.configuration=oo({},this.configuration,e),this.log("debug","Sequencing configuration updated")}},{key:"getSequencingState",value:function(){return{isInitialized:this.isInitialized,isActive:this.isSequencingActive,currentActivity:this.sequencing.getCurrentActivity(),rootActivity:this.sequencing.getRootActivity(),lastSequencingResult:this.lastSequencingResult}}},{key:"getOverallSequencingProcess",value:function(){return this.overallSequencingProcess}},{key:"isDeliveryInProgress",value:function(){var e,t;return null!==(e=null===(t=this.overallSequencingProcess)||void 0===t?void 0:t.isDeliveryInProgress())&&void 0!==e&&e}},{key:"setupCMIChangeWatchers",value:function(){}},{key:"initializeCMITracking",value:function(){this.lastCMIValues.set("cmi.completion_status",this.cmi.completion_status),this.lastCMIValues.set("cmi.success_status",this.cmi.success_status),this.lastCMIValues.set("cmi.progress_measure",this.cmi.progress_measure),this.cmi.score&&(this.lastCMIValues.set("cmi.score.scaled",this.cmi.score.scaled),this.lastCMIValues.set("cmi.score.raw",this.cmi.score.raw))}},{key:"shouldAutoStartSequencing",value:function(){return!(!this.sequencing.activityTree.root||this.sequencing.getCurrentActivity())}},{key:"startSequencing",value:function(){if(this.overallSequencingProcess)try{this.processNavigationRequest("start")&&(this.isSequencingActive=!0,this.log("info","Automatic sequencing started"))}catch(e){this.log("error","Failed to start automatic sequencing: ".concat(e))}}},{key:"endSequencing",value:function(){this.isSequencingActive=!1,this.activityDeliveryService.reset()}},{key:"triggerFinalRollup",value:function(){try{var e=this.sequencing.getCurrentActivity();e&&(this.updateActivityFromCMI(e),this.rollupProcess.overallRollupProcess(e),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.log("info","Final rollup completed"))}catch(e){this.log("error","Error during final rollup: ".concat(e))}}},{key:"updateActivityFromCMI",value:function(e){var t=!1;if(""!==this.cmi.progress_measure){var i=parseFloat(this.cmi.progress_measure);isNaN(i)||(t=!0,e.progressMeasure=i,e.progressMeasureStatus=!0,e.attemptCompletionAmount=i,e.attemptCompletionAmountStatus=!0)}if(t||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var n=cr({completionThreshold:e.minProgressMeasure,progressMeasure:this.cmi.progress_measure,storedCompletionStatus:Ce});e.completionStatus=n,e.attemptProgressStatus=n!==Ce}else"unknown"!==this.cmi.completion_status&&(e.completionStatus=this.cmi.completion_status,e.attemptProgressStatus=!0);if("unknown"!==this.cmi.success_status&&(e.successStatus=this.cmi.success_status,e.objectiveSatisfiedStatus="passed"===this.cmi.success_status,e.primaryObjective&&(e.primaryObjective.progressStatus=!0)),this.cmi.score&&""!==this.cmi.score.scaled){var r=parseFloat(this.cmi.score.scaled);isNaN(r)||(e.objectiveNormalizedMeasure=r,e.objectiveMeasureStatus=!0,e.primaryObjective&&(e.primaryObjective.progressStatus=!0))}e.primaryObjective&&this.cmi.score&&(""!==this.cmi.score.raw&&(e.primaryObjective.rawScore=this.cmi.score.raw),""!==this.cmi.score.min&&(e.primaryObjective.minScore=this.cmi.score.min),""!==this.cmi.score.max&&(e.primaryObjective.maxScore=this.cmi.score.max)),e.primaryObjective&&e.primaryObjective.updateFromActivity(e)}},{key:"getCMIDataForTransfer",value:function(){var e,t,i,n,r={completion_status:this.cmi.completion_status,success_status:this.cmi.success_status,progress_measure:this.cmi.progress_measure,score:{scaled:(null===(e=this.cmi.score)||void 0===e?void 0:e.scaled)||"",raw:(null===(t=this.cmi.score)||void 0===t?void 0:t.raw)||"",min:(null===(i=this.cmi.score)||void 0===i?void 0:i.min)||"",max:(null===(n=this.cmi.score)||void 0===n?void 0:n.max)||""},objectives:[]};if(this.cmi.objectives&&this.cmi.objectives.childArray){var o=!0,a=!1,s=void 0;try{for(var l,c=this.cmi.objectives.childArray[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u,d,v,f,h=l.value;h.id&&r.objectives.push({id:h.id,success_status:h.success_status,completion_status:h.completion_status,progress_measure:h.progress_measure,score:{scaled:(null===(u=h.score)||void 0===u?void 0:u.scaled)||"",raw:(null===(d=h.score)||void 0===d?void 0:d.raw)||"",min:(null===(v=h.score)||void 0===v?void 0:v.min)||"",max:(null===(f=h.score)||void 0===f?void 0:f.max)||""}})}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}return r}},{key:"parseNavigationRequest",value:function(request){var e=request;if(e.startsWith("_")&&"_none_"!==e&&(e=e.substring(1)),request.includes("choice"))return Nr.CHOICE;if(request.includes("jump"))return Nr.JUMP;switch(e){case"start":return Nr.START;case"resumeAll":return Nr.RESUME_ALL;case"continue":return Nr.CONTINUE;case"previous":return Nr.PREVIOUS;case"exit":return Nr.EXIT;case"exitAll":return Nr.EXIT_ALL;case"abandon":return Nr.ABANDON;case"abandonAll":return Nr.ABANDON_ALL;case"suspendAll":return Nr.SUSPEND_ALL;case"_none_":return Nr.NOT_VALID;default:return null}}},{key:"handleActivityDelivery",value:function(e){this.log("info","Activity delivered: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityDelivery",e)}},{key:"handleActivityUnload",value:function(e){this.log("info","Activity unloaded: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityUnload",e)}},{key:"handleSequencingComplete",value:function(result){this.log("debug","Sequencing completed",result)}},{key:"handleSequencingError",value:function(e){this.log("error","Sequencing error: ".concat(e)),this.fireEvent("onSequencingError",e,"sequencing")}},{key:"fireEvent",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];if(this.configuration.enableEventSystem){"onSequencingDebug"!==e&&this.fireDebugEvent("".concat(e," fired"),{eventType:e,argsLength:i.length});try{var r=this.eventListeners[e];if(r&&"function"==typeof r)try{r.apply(void 0,ao(i)),this.log("debug","Internal listener for ".concat(e," executed successfully"))}catch(t){this.log("error","Internal listener for ".concat(e," failed: ").concat(t))}try{var o;(o=this.eventService).processListeners.apply(o,["Sequencing.".concat(e),i[0]].concat(ao(i.slice(1)))),this.log("debug","Event service listeners for ".concat(e," processed"))}catch(t){this.log("warn","Event service failed for ".concat(e,": ").concat(t))}try{if("undefined"!=typeof window&&window.scormSequencingEvents){var a,s=window.scormSequencingEvents;s[e]&&"function"==typeof s[e]&&((a=s)[e].apply(a,ao(i)),this.log("debug","Global listener for ".concat(e," executed")))}}catch(t){this.log("warn","Global listener for ".concat(e," failed: ").concat(t))}}catch(t){this.log("error","Critical error firing event ".concat(e,": ").concat(t))}}}},{key:"fireDebugEvent",value:function(e,t){try{var i=this.eventListeners.onSequencingDebug;i&&"function"==typeof i&&i(e,oo({timestamp:(new Date).toISOString()},t));try{this.eventService.processListeners("Sequencing.onSequencingDebug",e,oo({timestamp:(new Date).toISOString()},t))}catch(e){}}catch(e){console.debug("Debug event failed: ".concat(e))}}},{key:"fireActivityAttemptStart",value:function(e){this.fireEvent("onActivityAttemptStart",e),this.fireDebugEvent("Activity attempt started",{activityId:e.id,title:e.title,attemptCount:e.attemptCount})}},{key:"fireActivityAttemptEnd",value:function(e){this.fireEvent("onActivityAttemptEnd",e),this.fireDebugEvent("Activity attempt ended",{activityId:e.id,title:e.title,completionStatus:e.completionStatus,successStatus:e.successStatus})}},{key:"fireLimitConditionCheck",value:function(e,result){this.fireEvent("onLimitConditionCheck",e,result),this.fireDebugEvent("Limit condition check",{activityId:e.id,result:result,attemptCount:e.attemptCount,attemptLimit:e.attemptLimit})}},{key:"fireNavigationValidityUpdate",value:function(e){this.fireEvent("onNavigationValidityUpdate",e),this.fireDebugEvent("Navigation validity updated",{validity:e})}},{key:"fireSequencingStateChange",value:function(e){this.fireEvent("onSequencingStateChange",e),this.fireDebugEvent("Sequencing state changed",{stateKeys:Object.keys(e)})}},{key:"handleSequencingProcessEvent",value:function(e,t){try{switch(e){case"onActivityDelivery":this.fireEvent("onActivityDelivery",t);break;case"onLimitConditionCheck":this.fireLimitConditionCheck(t.activity,t.result);break;case"onActivityAttemptStart":this.fireActivityAttemptStart(t);break;case"onActivityAttemptEnd":this.fireActivityAttemptEnd(t);break;case"onNavigationValidityUpdate":this.fireNavigationValidityUpdate(t);break;case"onSequencingSessionEnd":this.fireEvent("onSequencingSessionEnd",t);break;default:this.fireDebugEvent("Sequencing process event: ".concat(e),t)}}catch(t){this.log("error","Error handling sequencing process event ".concat(e,": ").concat(t))}}},{key:"log",value:function(e,t,i){var n=["debug","info","warn","error"],r=this.configuration.logLevel||"info";if(n.indexOf(e)>=n.indexOf(r))switch(e){case"debug":this.loggingService.debug("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"info":this.loggingService.info("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"warn":this.loggingService.warn("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"error":this.loggingService.error("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var uo=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(r()){var a=/^(cmi\.interactions\.)(\d+)\.(.*)$/,s=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],l=[];for(var c in e)if({}.hasOwnProperty.call(e,c)){var u=c.match(a);if(u){interactions.push({key:c,value:e[c],index:+u[2],field:u[3]||""});continue}var d=c.match(s);if(d){objectives.push({key:c,value:e[c],index:+d[2],field:d[3]||""});continue}l.push({key:c,value:e[c]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),l.sort(function(e,t){return e.key.localeCompare(t.key)});var v=function(e){e.forEach(function(e){var a={};a[e.key]=e.value,t.loadFromJSON(function(e){var t;if(Object(e)!==e||Array.isArray(e))return e;var result={},pattern=/\.?([^.[\]]+)|\[(\d+)]/g;return Object.keys(e).filter(function(t){return{}.hasOwnProperty.call(e,t)}).forEach(function(t){var i,n,r=result,o="",a=RegExp(pattern);Array.from({length:null!==(i=null===(n=t.match(RegExp(pattern,"g")))||void 0===n?void 0:n.length)&&void 0!==i?i:0},function(){return a.exec(t)}).forEach(function(e){var t;e&&(r=null!==(t=r[o])&&void 0!==t?t:r[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),r[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(a),i,n,r,o)})};v(interactions),v(objectives),v(l)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(n()){for(var o in t=void 0!==t?t:"cmi",r(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var a=(t?t+".":"")+o,s=e[o];if(s.constructor===Array){for(var l=0;s.length>l;l++)if(s[l]){var c=s[l],u="".concat(a,".").concat(l);c.constructor===Object?this.loadFromJSON(c,u,i,n,r):i(u,c)}}else s.constructor===Object?this.loadFromJSON(s,a,i,n,r):i(a,s)}}else console.error("loadFromJSON can only be called before the call to lmsInitialize.")}},{key:"renderCMIToJSONString",value:function(cmi,e){return e?JSON.stringify({cmi:cmi}):JSON.stringify({cmi:cmi},function(e,t){return void 0===t?null:t},2)}},{key:"renderCMIToJSONObject",value:function(cmi,e){return JSON.parse(this.renderCMIToJSONString(cmi,e))}},{key:"getCommitObject",value:function(e,t,i,n,r,o){var a=t||e,s=i?n(e,a):r(e,a);return[Oe.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(s)),s}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function fo(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var ho=Object.defineProperty,mo=function(e,t,i){return function(e,t,i){return t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},po=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mo(this,"settings"),mo(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){var i=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,i):this._performSyncXHR(e,t,i)}},{key:"_handleImmediateRequest",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t).body,o=this.settings.terminationCommitContentType;this._warnIfBeaconContentTypeUnsafe(e,o);var a=navigator.sendBeacon(e,new Blob([r],{type:o}));return{result:a?"true":"false",errorCode:a?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var i,n;a(e)&&!o(t)&&(null===(i=(n=this.settings).onLogMessage)||void 0===i||i.call(n,Oe.WARN,'sendBeacon to cross-origin URL with non-CORS-safelisted Content-Type "'.concat(t,'" may be silently dropped by the browser (Beacon cannot preflight). Use fetch (useAsynchronousCommits + asyncModeBeaconBehavior:"never") for cross-origin JSON/auth on terminate.')))}},{key:"_performSyncXHR",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t),o=r.body,a=r.contentType,s=new XMLHttpRequest;s.open("POST",e,!1),s.setRequestHeader("Content-Type",a),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return vo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?vo(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());s.setRequestHeader(n[0],n[1]+"")}),this.settings.xhrWithCredentials&&(s.withCredentials=!0);try{return s.send(o),this.settings.xhrResponseHandler(s)}catch(e){var l=fo(e,Error)?e.message:e+"";return{result:F,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:l}}}},{key:"_prepareRequestBody",value:function(e){return{body:fo(e,Array)?e.join("&"):JSON.stringify(e),contentType:fo(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function yo(e,t,i,n){return $i(e,t,i,ae.TYPE_MISMATCH,W,n)}function go(e,t,i,n){if(""===t)throw new W(e,ae.VALUE_OUT_OF_RANGE);return Qi(e,t,i,ae.VALUE_OUT_OF_RANGE,W)}var bo=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"validateScore",value:function(e,t,i,n,r,o,a){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||$i(e,t,i,r,a)&&(!n||Qi(e,t,n,o,a))}},{key:"validateScorm12Audio",value:function(e,t){return yo(e,t,je)&&go(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return yo(e,t,"^[\\s\\S]{0,255}$")}},{key:"validateScorm12Speed",value:function(e,t){return yo(e,t,je)&&go(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return yo(e,t,je)&&go(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new W(e,ae.READ_ONLY_ELEMENT)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),_o=new bo;function So(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function wo(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Co(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Oo(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){wo(e,t,i[t])})}return e}function Ao(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function Eo(e){return function(e){if(Array.isArray(e))return So(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return So(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?So(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ko(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var jo=Object.defineProperty,Ro=function(e,t,i){return function(e,t,i){return t in e?jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ko(t))?t+"":t,i)},Mo=function(){function e(t,i,n,r,o,a,s,l,c){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ro(this,"_timeout"),Ro(this,"_error_codes"),Ro(this,"_settings",Ee),Ro(this,"_httpService"),Ro(this,"_eventService"),Ro(this,"_serializationService"),Ro(this,"_errorHandlingService"),Ro(this,"_loggingService"),Ro(this,"_offlineStorageService"),Ro(this,"_cmiValueAccessService"),Ro(this,"_courseId",""),Ro(this,"_pendingCommitCount",0),Ro(this,"_commitSequence",0),Ro(this,"_commitSettleWaiters",[]),Ro(this,"_setCMIElements",new Set),Ro(this,"startingData"),Ro(this,"currentState"),(Co(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,i&&(this.settings=Oo({},Ee,i)),void 0!==(null==i?void 0:i.asyncCommit)&&void 0===i.useAsynchronousCommits&&void 0===i.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),i.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=l||Pi(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:ke),n?this._httpService=n:this.settings.httpService?this._httpService=this.settings.httpService:this.settings.useAsynchronousCommits?(console.warn("WARNING: useAsynchronousCommits=true is not SCORM compliant. Commit failures will not be reported to the SCO, which may cause data loss. This setting should only be used for specific legacy compatibility cases."),this._httpService=new Ci(this.settings,this._error_codes)):this._httpService=new po(this.settings,this._error_codes),this._eventService=r||new Bi(function(e,t,i,n){return u.apiLog(e,t,i,n)}),this._serializationService=o||new uo,this._errorHandlingService=s||new Li(this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i||Oe.ERROR,n)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=c||new Xi(this.settings,this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i,n)}),this.settings.courseId&&(this._courseId=this.settings.courseId),this.settings.syncOnTerminate&&this._eventService.on("BeforeTerminate",function(){var e;(null===(e=u._offlineStorageService)||void 0===e?void 0:e.isDeviceOnline())&&u._courseId&&u._offlineStorageService.hasPendingOfflineData(u._courseId).then(function(e){var t;if(e)return u.apiLog("BeforeTerminate","Syncing pending offline data before termination",Oe.INFO),null===(t=u._offlineStorageService)||void 0===t?void 0:t.syncOfflineData()}).then(function(e){e?u.processListeners("OfflineDataSynced"):!1===e&&u.processListeners("OfflineDataSyncFailed")}).catch(function(e){u.apiLog("BeforeTerminate","Error syncing offline data: ".concat(e),Oe.ERROR),u.processListeners("OfflineDataSyncFailed")})}),this._offlineStorageService&&this._courseId&&this._offlineStorageService.getOfflineData(this._courseId).then(function(e){e&&(u.apiLog("constructor","Found offline data to restore",Oe.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),Oe.ERROR)})),this._cmiValueAccessService=new ji({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,i){return u.throwSCORMError(e,t,i)},isInitialized:function(){return u.isInitialized()},validateCorrectResponse:function(e,t){return u.validateCorrectResponse(e,t)},checkForDuplicateId:function(e,t){return u._checkForDuplicateId(e,t)},getChildElement:function(e,t,i){return u.getChildElement(e,t,i)},apiLog:function(e,t,i){return u.apiLog(e,t,i)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,i=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",Oe.INFO),this.settings=Oo({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,i){var n=this,r=F;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,i):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",r=z,this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._courseId&&this.settings.syncOnInitialize&&this._offlineStorageService.isDeviceOnline()&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(t){var i;t&&(n.apiLog(e,"Syncing pending offline data on initialization",Oe.INFO),null===(i=n._offlineStorageService)||void 0===i||i.syncOfflineData().then(function(t){t&&(n.apiLog(e,"Successfully synced offline data",Oe.INFO),n.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+r,Oe.INFO),this.clearSCORMError(r),r}},{key:"apiLog",value:function(e,t,i,n){t=function(e,t,i){var n=e?"".concat((e+"").padEnd(20),": "):"";return i&&(n=(n+=i).padEnd(70)),n+(null!=t?t:"")}(e,t,n),this._loggingService.log(i,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,i,n,r=this._settings;this._settings=Oo({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==r.logLevel&&(null===(i=this._loggingService)||void 0===i||i.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==r.onLogMessage&&(null===(n=this._loggingService)||void 0===n||n.setLogHandler(e.onLogMessage))}},{key:"pendingCommitCount",get:function(){return this._pendingCommitCount}},{key:"whenCommitsSettled",value:function(e){var t=this;return 0===this._pendingCommitCount?Promise.resolve():new Promise(function(i){var n={resolve:i};void 0!==(null==e?void 0:e.timeoutMs)&&(n.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(n);-1!==e&&(t._commitSettleWaiters.splice(e,1),i())},e.timeoutMs)),t._commitSettleWaiters.push(n)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;void 0!==a.timeoutId&&clearTimeout(a.timeoutId),a.resolve()}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"terminate",value:function(e,t){var i=z,n=!1;if(this.isNotInitialized()){var r,o=null!==(r=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==r?r:0;this.throwSCORMError("api",o),112===o&&(i=F)}else if(t&&this.isTerminated()){var a,s=null!==(a=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==a?a:0;this.throwSCORMError("api",s),113===s&&(i=F)}else{var l;n=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(l=result.errorCode)&&void 0!==l?l:0)>0){var c;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),Oe.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),Oe.DEBUG),this.throwSCORMError("api",null!==(c=result.errorCode)&&void 0!==c?c:0),i=F}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:z;i="boolean"==typeof d?d+"":d}this.processListeners(e)}return this.apiLog(e,"returned: "+i,Oe.INFO),n&&this.clearSCORMError(i),i}},{key:"getValue",value:function(e,t,i){var n,r,o="";if(this.checkState(t,null!==(n=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==n?n:0,null!==(r=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==r?r:0)){try{o=this.getCMIValue(i)}catch(e){o=this.handleValueAccessException(i,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(i,o),this.processListeners(e,i)}return this.apiLog(e,": returned: "+o,Oe.INFO,i),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,i,n,r){var o,a;void 0!==r&&(r+="");var s=F;if(this.checkState(i,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(a=this._error_codes.STORE_AFTER_TERM)&&void 0!==a?a:0)){try{s=this.setCMIValue(n,r)}catch(e){s=this.handleValueAccessException(n,e,s)}this.processListeners(e,n,r)}return void 0===s&&(s=F),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+r+": result: "+s,Oe.INFO,n),"0"===this.lastErrorCode&&this.clearSCORMError(s),s}},{key:"commit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var r=z;if(this.isNotInitialized()){var o,a=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",a),142===a&&(r=F)}else if(i&&this.isTerminated()){var s,l=null!==(s=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==s?s:0;this.throwSCORMError("api",l),143===l&&(r=F)}else{var c,u,result=this.storeData(!1,n),d=null!==(c=result.errorCode)&&void 0!==c?c:0;d>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),Oe.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),Oe.DEBUG),this.throwSCORMError("api",d));var v=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:F;this.apiLog(e," Result: "+(r="boolean"==typeof v?v+"":v),Oe.DEBUG,"HttpRequest"),i&&0===d&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(i){var n;i&&(t.apiLog(e,"Syncing pending offline data",Oe.INFO),null===(n=t._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(i){i?(t.apiLog(e,"Successfully synced offline data",Oe.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",Oe.WARN)}))})}return this.apiLog(e,"returned: "+r,Oe.INFO),this.isNotInitialized()||i&&this.isTerminated()||this.clearSCORMError(r),r}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,Oe.INFO),t}},{key:"getErrorString",value:function(e,t){var i="";return null!==t&&""!==t&&(i=this.getLmsErrorMessageDetails(t),this.processListeners(e)),i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Oe.INFO),i}},{key:"getDiagnostic",value:function(e,t){var i="",n=""===t?this.lastErrorCode+"":t;if(null!==n&&""!==n){var r=this._errorHandlingService.lastDiagnostic;i=r&&n+""==this.lastErrorCode+""?r:this.getLmsErrorMessageDetails(n,!0),this.processListeners(e)}return i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Oe.INFO),i}},{key:"checkState",value:function(e,t,i){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",i),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var i=function(e,t){if(e&&"object"===(void 0===e?"undefined":ko(e))&&t in e){var i=e[t];return Co(i,he)?i:void 0}},n=function(e,t,i){for(var n=0;e.childArray.length>n;n++)if(n!==t){var r=e.childArray[n];if(r&&"object"===(void 0===r?"undefined":ko(r))&&"id"in r&&r.id===i)return!0}return!1},r=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(r&&r[1]){var o=parseInt(r[1],10),objectives=i(this.cmi,"objectives");return!!objectives&&n(objectives,o,t)}var a=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(a&&a[1]){var s=parseInt(a[1],10),interactions=i(this.cmi,"interactions");return!!interactions&&n(interactions,s,t)}var l=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(l&&l[1]&&l[2]){var c=parseInt(l[1],10),u=parseInt(l[2],10),d=i(this.cmi,"interactions");if(d){var v=d.childArray[c];if(v){var f=i(v,"objectives");if(f)return n(f,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,i,n){var result=this._cmiValueAccessService.setCMIValue(e,t,i,n);return result===z&&this._setCMIElements.add(i),result}},{key:"_commonGetCMIValue",value:function(e,t,i){return this._cmiValueAccessService.getCMIValue(e,t,i)}},{key:"checkUninitializedGet",value:function(e,t){}},{key:"isInitialized",value:function(){return 1===this.currentState}},{key:"isNotInitialized",value:function(){return 0===this.currentState}},{key:"isTerminated",value:function(){return 2===this.currentState}},{key:"on",value:function(e,t){this._eventService.on(e,t)}},{key:"off",value:function(e,t){this._eventService.off(e,t)}},{key:"clear",value:function(e){this._eventService.clear(e)}},{key:"processListeners",value:function(e,t,i,n){void 0!==n?this._eventService.processListeners(e,t,i,n):this._eventService.processListeners(e,t,i)}},{key:"throwSCORMError",value:function(e,t,i,n){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,i,n)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var i=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return i.setCMIValue(e,t)},function(){return i.isNotInitialized()},function(e){i.startingData=e})}},{key:"getFlattenedCMI",value:function(){return d(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";i&&""!==i||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(i="cmi"),this._serializationService.loadFromJSON(e,i,function(e,i){return t.setCMIValue(e,i)},function(){return t.isNotInitialized()},function(e){t.startingData=e})}},{key:"renderCMIToJSONString",value:function(){return this._serializationService.renderCMIToJSONString(this.cmi,this.settings.sendFullCommit)}},{key:"renderCMIToJSONObject",value:function(){return this._serializationService.renderCMIToJSONObject(this.cmi,this.settings.sendFullCommit)}},{key:"processHttpRequest",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var a=!1,s=!1,l=function(){a||(a=!0,i._pendingCommitCount-=1,0===i._pendingCommitCount&&i._flushCommitSettleWaiters())};try{var c=null!=r?r:n?"terminate":"manual",u=t;if(n&&this.settings.terminateCommitPayloadField){var d=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=Eo(u).concat(["".concat(encodeURIComponent(d),"=true")]):u&&"object"===(void 0===u?"undefined":ko(u))&&(u=Ao(Oo({},u),wo({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=Eo(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":ko(u))&&(u=Ao(Oo({},u),{commitSequence:o})));var v,f=n&&this.settings.terminateCommitParam?h(e,this.settings.terminateCommitParam,"true"):e,m={isTerminateCommit:n,trigger:c,sequence:o},p={url:f,trigger:c,isTerminateCommit:n,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",Oe.INFO),u&&"object"===(void 0===u?"undefined":ko(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:n,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",Oe.ERROR),{result:F,errorCode:null!==(v=this._error_codes.GENERAL)&&void 0!==v?v:101});var result=this._httpService.processHttpRequest(f,u,n,function(e,t,n,r){return i.apiLog(e,t,n,r)},function(e,t,n){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof n&&(p.errorCode=n),l(),i.processListeners(e,t,n,p)):i.processListeners(e,t,n)},m,l);return s=!0===this._httpService.reportsRequestCompletion,result}finally{s||l()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new Ze(this,e,t),this.apiLog("scheduleCommit","scheduled",Oe.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",Oe.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":ko(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,i){return Co(t,L)?(this.lastErrorCode=t.errorCode+"",""!==i&&(i=F),this.throwSCORMError(e,t.errorCode,t.errorMessage)):Co(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),i}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,i){return t.renderCommitObject(e,i)},function(e,i){return t.renderCommitCMI(e,i)},this.settings.logLevel)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function To(e){return To=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},To(e)}function xo(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(xo=function(){return!!result})()}function Io(e,t){return Io=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Io(e,t)}function Po(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var No=Object.defineProperty,qo=function(e,t,i){return function(e,t,i){return t in e?No(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Po(t))?t+"":t,i)},Do=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=To(t),n=e,!(r=xo()?Reflect.construct(t,i||[],To(e).constructor):t.apply(e,i))||"object"!==Po(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.learner_preference"]),qo(e,"__children",B.student_preference_children),qo(e,"_audio_level","1"),qo(e,"_language",""),qo(e,"_delivery_speed","1"),qo(e,"_audio_captioning","0"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Io(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new te(this._cmi_element+"._children",se.READ_ONLY_ELEMENT)}},{key:"audio_level",get:function(){return this._audio_level},set:function(audio_level){Zi(this._cmi_element+".audio_level",audio_level,qe)&&en(this._cmi_element+".audio_level",audio_level,"0#999.9999999")&&(this._audio_level=audio_level)}},{key:"language",get:function(){return this._language},set:function(language){Zi(this._cmi_element+".language",language,"^([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$")&&(this._language=language)}},{key:"delivery_speed",get:function(){return this._delivery_speed},set:function(delivery_speed){if(Zi(this._cmi_element+".delivery_speed",delivery_speed,qe)&&en(this._cmi_element+".delivery_speed",delivery_speed,"0#999.9999999")){if(0===parseFloat(delivery_speed))throw new te(this._cmi_element+".delivery_speed",se.VALUE_OUT_OF_RANGE);this._delivery_speed=delivery_speed}}},{key:"audio_captioning",get:function(){return this._audio_captioning},set:function(audio_captioning){Zi(this._cmi_element+".audio_captioning",audio_captioning,"^-?([0-9]+)$")&&en(this._cmi_element+".audio_captioning",audio_captioning,"-1#1")&&(this._audio_captioning=audio_captioning)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Lo(e){return e.replace(/[[\]]/g,"")}function zo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fo(e,t){if(!t)return[e];if(e.includes(t))return e.split(t);var i=Lo(t);if(!i)return[e];var n=RegExp("(?<!\\\\)".concat(zo(i)),"g"),r=RegExp("\\\\".concat(zo(i)),"g");return e.split(n).map(function(e){return e.replace(r,i)})}function Bo(e,t){var i;if(!t)return[e];if(e.includes(t)){var n=e.indexOf(t);return[e.slice(0,n),e.slice(n+t.length)]}var r=Lo(t);if(!r)return[e];var o=RegExp("(?<!\\\\)".concat(zo(r))),a=RegExp("\\\\".concat(zo(r)),"g"),s=e.split(o),l=(null!==(i=s[0])&&void 0!==i?i:"").replace(a,r);return 1===s.length?[l]:[l,s.slice(1).join(r).replace(a,r)]}function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Ho(e,t,i){return t=Yo(t),n=e,!(r=Jo()?Reflect.construct(t,i||[],Yo(e).constructor):t.apply(e,i))||"object"!==Qo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Uo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Go(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Ko(e,t,i){return Ko="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Yo(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ko(e,t,i||e)}function Yo(e){return Yo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Yo(e)}function Wo(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xo(e,t)}function Jo(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jo=function(){return!!result})()}function Xo(e,t){return Xo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Xo(e,t)}function $o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Zo=Object.defineProperty,ea=function(e,t,i){return function(e,t,i){return t in e?Zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Qo(t))?t+"":t,i)},ta=function(e){function t(){return Uo(this,t),Ho(this,t,[{CMIElement:"cmi.interactions",children:B.interactions_children,errorCode:se.READ_ONLY_ELEMENT,errorClass:te}])}return Wo(t,e),t}(he),ia=function(e){function t(){var e;return Uo(this,t),e=Ho(this,t,["cmi.interactions.n"]),ea(e,"_id",""),ea(e,"_idIsSet",!1),ea(e,"_type",""),ea(e,"_timestamp",""),ea(e,"_weighting",""),ea(e,"_learner_response",""),ea(e,"_result",""),ea(e,"_latency",""),ea(e,"_description",""),ea(e,"objectives"),ea(e,"correct_responses"),e.objectives=new he({CMIElement:"cmi.interactions.n.objectives",errorCode:se.READ_ONLY_ELEMENT,errorClass:te,children:B.objectives_children}),e.correct_responses=new he({CMIElement:"cmi.interactions.n.correct_responses",errorCode:se.READ_ONLY_ELEMENT,errorClass:te,children:B.correct_responses_children}),e}return Wo(t,e),Go(t,[{key:"initialize",value:function(){var e,i;Ko(Yo(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._id="",this._idIsSet=!1,this._type="",this._timestamp="",this._weighting="",this._learner_response="",this._result="",this._latency="",this._description="",this.objectives=new he({CMIElement:"cmi.interactions.n.objectives",errorCode:se.READ_ONLY_ELEMENT,errorClass:te,children:B.objectives_children}),this.correct_responses=new he({CMIElement:"cmi.interactions.n.correct_responses",errorCode:se.READ_ONLY_ELEMENT,errorClass:te,children:B.correct_responses_children})}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new te(this._cmi_element+".id",se.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new te(this._cmi_element+".id",se.GENERAL_SET_FAILURE);Zi(this._cmi_element+".id",id,Le)&&(this._id=id,this._idIsSet=!0)}},{key:"type",get:function(){return this._type},set:function(type){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".type",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".type",type,"^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$")&&(this._type=type)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".timestamp",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".timestamp",timestamp,Pe)&&(this._timestamp=timestamp)}},{key:"weighting",get:function(){return this._weighting},set:function(weighting){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".weighting",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".weighting",weighting,qe)&&(this._weighting=weighting)}},{key:"learner_response",get:function(){return this._learner_response},set:function(learner_response){if(this.initialized&&(""===this._type||""===this._id))throw new te(this._cmi_element+".learner_response",se.DEPENDENCY_NOT_ESTABLISHED);var e=[],t=Ke[this.type];if(!t)throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH);if((null==t?void 0:t.delimiter)?e=Fo(learner_response,t.delimiter):e[0]=learner_response,0>=e.length||e.length>t.max)throw new te(this._cmi_element+".learner_response",se.GENERAL_SET_FAILURE);for(var i=RegExp(t.format),n=0;e.length>n;n++)if(null==t?void 0:t.delimiter2){var r,o,a,s=null!==(r=e[n])&&void 0!==r?r:"",l="performance"===this.type?Bo(s,t.delimiter2):Fo(s,t.delimiter2);if(2!==(null==l?void 0:l.length))throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH);if("performance"===this.type&&""===l[0]&&""===l[1])throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH);if(!(null===(o=l[0])||void 0===o?void 0:o.match(i)))throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH);if(!t.format2||!(null===(a=l[1])||void 0===a?void 0:a.match(RegExp(t.format2))))throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH)}else{var c;if(!(null===(c=e[n])||void 0===c?void 0:c.match(i)))throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH);if(""!==e[n]&&t.unique)for(var u=0;n>u;u++)if(e[n]===e[u])throw new te(this._cmi_element+".learner_response",se.TYPE_MISMATCH)}this._learner_response=learner_response}},{key:"result",get:function(){return this._result},set:function(result){Zi(this._cmi_element+".result",result,"^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$")&&(this._result=result)}},{key:"latency",get:function(){return this._latency},set:function(latency){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".latency",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".latency",latency,Ne)&&(this._latency=latency)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".description",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".description",description,xe,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={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 this.jsonString=!1,result}}]),t}(C),na=function(e){function t(){var e;return Uo(this,t),e=Ho(this,t,["cmi.interactions.n.objectives.n"]),ea(e,"_id",""),e}return Wo(t,e),Go(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new te(this._cmi_element+".id",se.TYPE_MISMATCH);Zi(this._cmi_element+".id",id,Le)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(C),ra=/^\{(?:lang|case_matters|order_matters)=[^}]+\}/;function oa(e){for(var result=e;ra.test(result);)result=result.replace(ra,"");return result}var aa=function(e){function t(e){var i;return Uo(this,t),i=Ho(this,t,["cmi.interactions.n.correct_responses.n"]),ea(i,"_pattern",""),ea(i,"_interactionType"),i._interactionType=e,i}return Wo(t,e),Go(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){return this._pattern},set:function(pattern){if("fill-in"!==this._interactionType||""!==pattern){if(Zi(this._cmi_element+".pattern",pattern,"^.*$")){if(this._interactionType){var e=Ye[this._interactionType];e&&("matching"===this._interactionType&&/\\[.,]/.test(pattern)||function(type,pattern,e){if(pattern.trim()!==pattern)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);var t=e.delimiter?Fo(pattern,e.delimiter):[pattern],i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.trim()!==s)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}if("fill-in"!==type||""!==pattern){var l=e.delimiter?Fo(pattern,e.delimiter):[pattern];if(!e.delimiter&&pattern.includes(","))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);if("numeric"!==type&&(e.unique||!1===e.duplicate)&&new Set(l).size!==l.length)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);if(0===l.length||l.length>e.max)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.GENERAL_SET_FAILURE);var c=RegExp(e.format),u=e.format2?RegExp(e.format2):null,d=function(e){if(!c.test(e))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH)},v=function(e,t){if(!t)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);var i=Fo(e,t);if(2!==i.length||""===i[0]||""===i[1])throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);if(void 0!==i[0]&&!c.test(i[0])||u&&void 0!==i[1]&&!u.test(i[1]))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH)},f=!0,h=!1,m=void 0;try{for(var p,y=l[Symbol.iterator]();!(f=(p=y.next()).done);f=!0){var g=p.value;switch(type){case"numeric":if(""===g){if(2>l.length||!e.delimiter||!pattern.includes(e.delimiter))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);break}d(g);break;case"performance":var b=e.delimiter2;if(!b)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);var _=Bo(oa(g),b);if(2!==_.length)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);var S=$o(_,2),w=S[0],C=S[1];if(""===w&&""===C)throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);if(void 0===w||!c.test(w))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);if(u&&void 0!==C&&!u.test(C))throw new te("cmi.interactions.n.correct_responses.n.pattern",se.TYPE_MISMATCH);break;default:e.delimiter2?v(g,e.delimiter2):d(g)}}}catch(e){h=!0,m=e}finally{try{f||null==y.return||y.return()}finally{if(h)throw m}}}}(this._interactionType,pattern,e))}this._pattern=pattern}}else this._pattern=""}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this.pattern};return this.jsonString=!1,result}}]),t}(C);function sa(e){return sa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},sa(e)}function la(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(la=function(){return!!result})()}function ca(e,t){return ca=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ca(e,t)}function ua(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var da=Object.defineProperty,va=function(e,t,i){return function(e,t,i){return t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ua(t))?t+"":t,i)},fa=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=sa(t),n=e,!(r=la()?Reflect.construct(t,i||[],sa(e).constructor):t.apply(e,i))||"object"!==ua(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),va(i,"__children"),va(i,"__score_range"),va(i,"__invalid_error_code"),va(i,"__invalid_type_code"),va(i,"__invalid_range_code"),va(i,"__decimal_regex"),va(i,"__error_class"),va(i,"__allow_empty_string"),va(i,"_raw",""),va(i,"_min",""),va(i,"_max"),i.__children=e.score_children||"raw,min,max",i.__score_range=!!e.score_range&&"0#100",i._max=e.max||""===e.max?e.max:"100",i.__invalid_error_code=e.invalidErrorCode||ae.INVALID_SET_VALUE,i.__invalid_type_code=e.invalidTypeCode||ae.TYPE_MISMATCH,i.__invalid_range_code=e.invalidRangeCode||ae.VALUE_OUT_OF_RANGE,i.__decimal_regex=e.decimalRegex||"^-?([0-9]{0,10})(\\.[0-9]*)?$",i.__error_class=e.errorClass,i.__allow_empty_string=null!==(n=e.allowEmptyString)&&void 0!==n&&n,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ca(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._raw="",this._min=""}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this.__error_class(this._cmi_element+"._children",this.__invalid_error_code)}},{key:"raw",get:function(){return this._raw},set:function(e){_o.validateScore(this._cmi_element+".raw",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._raw=e)}},{key:"min",get:function(){return this._min},set:function(e){_o.validateScore(this._cmi_element+".min",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._min=e)}},{key:"max",get:function(){return this._max},set:function(e){_o.validateScore(this._cmi_element+".max",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._max=e)}},{key:"getScoreObject",value:function(){var e={};return Number.isNaN(Number.parseFloat(this.raw))||(e.raw=Number.parseFloat(this.raw)),Number.isNaN(Number.parseFloat(this.min))||(e.min=Number.parseFloat(this.min)),Number.isNaN(Number.parseFloat(this.max))||(e.max=Number.parseFloat(this.max)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function ha(e,t,i){return ha="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ma(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},ha(e,t,i||e)}function ma(e){return ma=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ma(e)}function pa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(pa=function(){return!!result})()}function ya(e,t){return ya=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ya(e,t)}function ga(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ba=Object.defineProperty,_a=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=ma(t),n=e,!(r=pa()?Reflect.construct(t,i||[],ma(e).constructor):t.apply(e,i))||"object"!==ga(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[{CMIElement:"cmi.score",score_children:B.score_children,max:"",invalidErrorCode:se.READ_ONLY_ELEMENT,invalidTypeCode:se.TYPE_MISMATCH,invalidRangeCode:se.VALUE_OUT_OF_RANGE,decimalRegex:qe,errorClass:te}]),n="",function(e,t,i){t in e?ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==ga(i="_scaled")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ya(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._scaled="",this._raw="",this._min="",this._max=""}},{key:"scaled",get:function(){return this._scaled},set:function(e){Zi(this._cmi_element+".scaled",e,qe)&&en(this._cmi_element+".scaled",e,"-1#1")&&(this._scaled=e)}},{key:"getScoreObject",value:function(){var e=ha(ma(t.prototype),"getScoreObject",this).call(this);return Number.isNaN(Number.parseFloat(this.scaled))||(e.scaled=Number.parseFloat(this.scaled)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={scaled:this.scaled,raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(fa);function Sa(e,t,i){return t=Ca(t),n=e,!(r=Aa()?Reflect.construct(t,i||[],Ca(e).constructor):t.apply(e,i))||"object"!==ka(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ca(e){return Ca=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ca(e)}function Oa(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ea(e,t)}function Aa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Aa=function(){return!!result})()}function Ea(e,t){return Ea=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ea(e,t)}function ka(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ja=Object.defineProperty,Ra=function(e,t,i){return function(e,t,i){return t in e?ja(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ka(t))?t+"":t,i)},Ma=function(e){function t(){return wa(this,t),Sa(this,t,[{CMIElement:"cmi.comments_from_lms",children:B.comments_children,errorCode:se.READ_ONLY_ELEMENT,errorClass:te}])}return Oa(t,e),t}(he),Ta=function(e){function t(){return wa(this,t),Sa(this,t,[{CMIElement:"cmi.comments_from_learner",children:B.comments_children,errorCode:se.READ_ONLY_ELEMENT,errorClass:te}])}return Oa(t,e),t}(he),xa=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return wa(this,t),e=Sa(this,t,["cmi.comments_from_learner.n"]),Ra(e,"_comment",""),Ra(e,"_location",""),Ra(e,"_timestamp",""),Ra(e,"_readOnlyAfterInit"),e._comment="",e._location="",e._timestamp="",e._readOnlyAfterInit=i,e}return Oa(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"comment",get:function(){return this._comment},set:function(comment){if(this.initialized&&this._readOnlyAfterInit)throw new te(this._cmi_element+".comment",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".comment",comment,Ie,!0)&&(this._comment=comment)}},{key:"location",get:function(){return this._location},set:function(location){if(this.initialized&&this._readOnlyAfterInit)throw new te(this._cmi_element+".location",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,250}$")&&(this._location=location)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&this._readOnlyAfterInit)throw new te(this._cmi_element+".timestamp",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".timestamp",timestamp,Pe)&&(this._timestamp=timestamp)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={comment:this.comment,location:this.location,timestamp:this.timestamp};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Ia(e,t,i){return t=Da(t),n=e,!(r=za()?Reflect.construct(t,i||[],Da(e).constructor):t.apply(e,i))||"object"!==Ba(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Pa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Na(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function qa(e,t,i){return qa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Da(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},qa(e,t,i||e)}function Da(e){return Da=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Da(e)}function La(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fa(e,t)}function za(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(za=function(){return!!result})()}function Fa(e,t){return Fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fa(e,t)}function Ba(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Va=Object.defineProperty,Ha=function(e,t,i){return function(e,t,i){return t in e?Va(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ba(t))?t+"":t,i)},Ua=function(e){function t(){return Pa(this,t),Ia(this,t,[{CMIElement:"cmi.objectives",children:B.objectives_children,errorCode:se.READ_ONLY_ELEMENT,errorClass:te}])}return La(t,e),Na(t,[{key:"findObjectiveById",value:function(id){return this.childArray.find(function(e){return e.id===id})}},{key:"findObjectiveByIndex",value:function(e){return this.childArray[e]}},{key:"setObjectiveByIndex",value:function(e,t){this.childArray[e]=t}}]),t}(he),Ga=function(e){function t(){var e;return Pa(this,t),e=Ia(this,t,["cmi.objectives.n"]),Ha(e,"_id",""),Ha(e,"_idIsSet",!1),Ha(e,"_success_status","unknown"),Ha(e,"_completion_status","unknown"),Ha(e,"_progress_measure",""),Ha(e,"_description",""),Ha(e,"score"),e.score=new _a,e}return La(t,e),Na(t,[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._idIsSet=!1,this._success_status="unknown",this._completion_status="unknown",this._progress_measure="",this._description="",null===(e=this.score)||void 0===e||e.reset()}},{key:"initialize",value:function(){var e;qa(Da(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new te(this._cmi_element+".id",se.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new te(this._cmi_element+".id",se.GENERAL_SET_FAILURE);Zi(this._cmi_element+".id",id,Le)&&(this._id=id,this._idIsSet=!0)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".success_status",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".success_status",success_status,Fe)&&(this._success_status=success_status)}},{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".completion_status",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".completion_status",completion_status,ze)&&(this._completion_status=completion_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".progress_measure",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".progress_measure",progress_measure,qe)&&en(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new te(this._cmi_element+".description",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".description",description,xe,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,success_status:this.success_status,completion_status:this.completion_status,progress_measure:this.progress_measure,description:this.description,score:this.score};return this.jsonString=!1,result}},{key:"fromJSON",value:function(e){e&&"object"===(void 0===e?"undefined":Ba(e))&&("string"==typeof e.id&&(this.id=e.id),"string"==typeof e.success_status&&(this.success_status=e.success_status),"string"==typeof e.completion_status&&(this.completion_status=e.completion_status),void 0!==e.progress_measure&&(this.progress_measure=e.progress_measure+""),"string"==typeof e.description&&(this.description=e.description),e.score&&"object"===Ba(e.score)&&(void 0!==e.score.scaled&&(this.score.scaled=e.score.scaled+""),void 0!==e.score.raw&&(this.score.raw=e.score.raw+""),void 0!==e.score.min&&(this.score.min=e.score.min+""),void 0!==e.score.max&&(this.score.max=e.score.max+"")))}}]),t}(C);function Ka(e){return Ka=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ka(e)}function Ya(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ya=function(){return!!result})()}function Wa(e,t){return Wa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Wa(e,t)}function Ja(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Xa=Object.defineProperty,$a=function(e,t,i){return function(e,t,i){return t in e?Xa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ja(t))?t+"":t,i)},Qa=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ka(t),n=e,!(r=Ya()?Reflect.construct(t,i||[],Ka(e).constructor):t.apply(e,i))||"object"!==Ja(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),$a(e,"__version","1.0"),$a(e,"__children",B.cmi_children),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wa(e,t)}(t,e),i=t,(n=[{key:"_version",get:function(){return this.__version},set:function(_version){throw new te(this._cmi_element+"._version",se.READ_ONLY_ELEMENT)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new te(this._cmi_element+"._children",se.READ_ONLY_ELEMENT)}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Za(e){return Za=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Za(e)}function es(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(es=function(){return!!result})()}function ts(e,t){return ts=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ts(e,t)}function is(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ns=Object.defineProperty,rs=function(e,t,i){return function(e,t,i){return t in e?ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":is(t))?t+"":t,i)},os=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Za(t),n=e,!(r=es()?Reflect.construct(t,i||[],Za(e).constructor):t.apply(e,i))||"object"!==is(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),rs(e,"_learner_id",""),rs(e,"_learner_name",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ts(e,t)}(t,e),i=t,(n=[{key:"learner_id",get:function(){return this._learner_id},set:function(learner_id){if(this.initialized)throw new te(this._cmi_element+".learner_id",se.READ_ONLY_ELEMENT);this._learner_id=learner_id}},{key:"learner_name",get:function(){return this._learner_name},set:function(learner_name){if(this.initialized)throw new te(this._cmi_element+".learner_name",se.READ_ONLY_ELEMENT);this._learner_name=learner_name}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function as(e){return as=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},as(e)}function ss(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ss=function(){return!!result})()}function ls(e,t){return ls=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ls(e,t)}function cs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var us=Object.defineProperty,ds=function(e,t,i){return function(e,t,i){return t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":cs(t))?t+"":t,i)},vs=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=as(t),n=e,!(r=ss()?Reflect.construct(t,i||[],as(e).constructor):t.apply(e,i))||"object"!==cs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),ds(e,"_completion_status","unknown"),ds(e,"_success_status","unknown"),ds(e,"_progress_measure",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ls(e,t)}(t,e),i=t,(n=[{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){Zi(this._cmi_element+".completion_status",completion_status,ze)&&(this._completion_status=completion_status)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){Zi(this._cmi_element+".success_status",success_status,Fe)&&(this._success_status=success_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){Zi(this._cmi_element+".progress_measure",progress_measure,qe)&&en(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"reset",value:function(){this._initialized=!1,this._completion_status="unknown",this._success_status="unknown",this._progress_measure=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fs(e)}function hs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(hs=function(){return!!result})()}function ms(e,t){return ms=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ms(e,t)}function ps(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ys=Object.defineProperty,gs=function(e,t,i){return function(e,t,i){return t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ps(t))?t+"":t,i)},bs=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=fs(t),n=e,!(r=hs()?Reflect.construct(t,i||[],fs(e).constructor):t.apply(e,i))||"object"!==ps(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),gs(e,"_entry",""),gs(e,"_exit",""),gs(e,"_session_time","PT0H0M0S"),gs(e,"_total_time","PT0S"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ms(e,t)}(t,e),i=t,(n=[{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new te(this._cmi_element+".entry",se.READ_ONLY_ELEMENT);this._entry=entry}},{key:"exit",get:function(){if(!this.jsonString)throw new te(this._cmi_element+".exit",se.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"logout"===exit&&console.warn('SCORM 2004: cmi.exit value "logout" is deprecated per 4th Edition. Consider using "normal" or "suspend" instead.'),Zi(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|normal)$",!0)&&(this._exit=exit)}},{key:"getExitValueInternal",value:function(){return this._exit}},{key:"session_time",get:function(){if(!this.jsonString)throw new te(this._cmi_element+".session_time",se.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){Zi(this._cmi_element+".session_time",session_time,Ne)&&(this._session_time=session_time)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new te(this._cmi_element+".total_time",se.READ_ONLY_ELEMENT);this._total_time=total_time}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;if(void 0!==e){var o=(new Date).getTime()-e;r=l(o/1e3)}return t=this._total_time,i=r,n=RegExp(Ne),l(c(t,n)+c(i,n))}},{key:"reset",value:function(){this._initialized=!1,this._entry="ab-initio",this._exit="",this._session_time="PT0H0M0S"}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function _s(e){return _s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_s(e)}function Ss(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ss=function(){return!!result})()}function ws(e,t){return ws=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ws(e,t)}function Cs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Os=Object.defineProperty,As=function(e,t,i){return function(e,t,i){return t in e?Os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Cs(t))?t+"":t,i)},Es=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=_s(t),n=e,!(r=Ss()?Reflect.construct(t,i||[],_s(e).constructor):t.apply(e,i))||"object"!==Cs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),As(e,"_location",""),As(e,"_launch_data",""),As(e,"_suspend_data",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ws(e,t)}(t,e),i=t,(n=[{key:"location",get:function(){return this._location},set:function(location){Zi(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,1000}$")&&(this._location=location)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new te(this._cmi_element+".launch_data",se.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){Zi(this._cmi_element+".suspend_data",suspend_data,Me,!0)&&(this._suspend_data=suspend_data)}},{key:"reset",value:function(){this._initialized=!1,this._location="",this._suspend_data=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function ks(e){return ks=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ks(e)}function js(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(js=function(){return!!result})()}function Rs(e,t){return Rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Rs(e,t)}function Ms(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ts=Object.defineProperty,xs=function(e,t,i){return function(e,t,i){return t in e?Ts(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ms(t))?t+"":t,i)},Is=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=ks(t),n=e,!(r=js()?Reflect.construct(t,i||[],ks(e).constructor):t.apply(e,i))||"object"!==Ms(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),xs(e,"_credit","credit"),xs(e,"_mode","normal"),xs(e,"_time_limit_action","continue,no message"),xs(e,"_max_time_allowed",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rs(e,t)}(t,e),i=t,(n=[{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new te(this._cmi_element+".credit",se.READ_ONLY_ELEMENT);if(!/^(credit|no-credit)$/.test(credit))throw new te(this._cmi_element+".credit",se.TYPE_MISMATCH);this._credit=credit}},{key:"mode",get:function(){return this._mode},set:function(mode){if(this.initialized)throw new te(this._cmi_element+".mode",se.READ_ONLY_ELEMENT);if(!/^(browse|normal|review)$/.test(mode))throw new te(this._cmi_element+".mode",se.TYPE_MISMATCH);this._mode=mode}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(this.initialized)throw new te(this._cmi_element+".time_limit_action",se.READ_ONLY_ELEMENT);if(!/^(exit,message|exit,no message|continue,message|continue,no message)$/.test(time_limit_action))throw new te(this._cmi_element+".time_limit_action",se.TYPE_MISMATCH);this._time_limit_action=time_limit_action}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(this.initialized)throw new te(this._cmi_element+".max_time_allowed",se.READ_ONLY_ELEMENT);if(""!==max_time_allowed){if(!RegExp(Ne).test(max_time_allowed))throw new te(this._cmi_element+".max_time_allowed",se.TYPE_MISMATCH);this._max_time_allowed=max_time_allowed}else this._max_time_allowed=max_time_allowed}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Ps(e){return Ps=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ps(e)}function Ns(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ns=function(){return!!result})()}function qs(e,t){return qs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qs(e,t)}function Ds(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ls=Object.defineProperty,zs=function(e,t,i){return function(e,t,i){return t in e?Ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ds(t))?t+"":t,i)},Fs=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ps(t),n=e,!(r=Ns()?Reflect.construct(t,i||[],Ps(e).constructor):t.apply(e,i))||"object"!==Ds(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),zs(e,"_scaled_passing_score",""),zs(e,"_completion_threshold",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qs(e,t)}(t,e),i=t,(n=[{key:"scaled_passing_score",get:function(){return this._scaled_passing_score},set:function(scaled_passing_score){var e;if(this.initialized)throw new te(this._cmi_element+".scaled_passing_score",null!==(e=se.READ_ONLY_ELEMENT)&&void 0!==e?e:404);if(""!==scaled_passing_score){var t;if(!RegExp(qe).test(scaled_passing_score))throw new te(this._cmi_element+".scaled_passing_score",null!==(t=se.TYPE_MISMATCH)&&void 0!==t?t:406);var i,n=parseFloat(scaled_passing_score);if(-1>n||n>1)throw new te(this._cmi_element+".scaled_passing_score",null!==(i=se.VALUE_OUT_OF_RANGE)&&void 0!==i?i:407);this._scaled_passing_score=scaled_passing_score}else this._scaled_passing_score=scaled_passing_score}},{key:"completion_threshold",get:function(){return this._completion_threshold},set:function(e){var t;if(this.initialized)throw new te(this._cmi_element+".completion_threshold",null!==(t=se.READ_ONLY_ELEMENT)&&void 0!==t?t:404);if(""!==e){var i;if(!RegExp(qe).test(e))throw new te(this._cmi_element+".completion_threshold",null!==(i=se.TYPE_MISMATCH)&&void 0!==i?i:406);var n,r=parseFloat(e);if(0>r||r>1)throw new te(this._cmi_element+".completion_threshold",null!==(n=se.VALUE_OUT_OF_RANGE)&&void 0!==n?n:407);this._completion_threshold=e}else this._completion_threshold=e}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Bs(e,t,i){return Bs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Vs(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Bs(e,t,i||e)}function Vs(e){return Vs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Vs(e)}function Hs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Hs=function(){return!!result})()}function Us(e,t){return Us=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Us(e,t)}function Gs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ks=Object.defineProperty,Ys=function(e,t,i){return function(e,t,i){return t in e?Ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gs(t))?t+"":t,i)},Ws=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Vs(t),n=e,!(r=Hs()?Reflect.construct(t,i||[],Vs(e).constructor):t.apply(e,i))||"object"!==Gs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Ys(e,"metadata"),Ys(e,"learner"),Ys(e,"status"),Ys(e,"session"),Ys(e,"content"),Ys(e,"settings"),Ys(e,"thresholds"),Ys(e,"learner_preference"),Ys(e,"score"),Ys(e,"comments_from_learner"),Ys(e,"comments_from_lms"),Ys(e,"interactions"),Ys(e,"objectives"),e.metadata=new Qa,e.learner=new os,e.status=new vs,e.session=new bs,e.content=new Es,e.settings=new Is,e.thresholds=new Fs,e.learner_preference=new Do,e.score=new _a,e.comments_from_learner=new Ta,e.comments_from_lms=new Ma,e.interactions=new ta,e.objectives=new Ua,i&&e.initialize(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Us(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e,i,n,r,o,a,s,l,c,u,d,v,f;Bs(Vs(t.prototype),"initialize",this).call(this),null===(e=this.metadata)||void 0===e||e.initialize(),null===(i=this.learner)||void 0===i||i.initialize(),null===(n=this.status)||void 0===n||n.initialize(),null===(r=this.session)||void 0===r||r.initialize(),null===(o=this.content)||void 0===o||o.initialize(),null===(a=this.settings)||void 0===a||a.initialize(),null===(s=this.thresholds)||void 0===s||s.initialize(),null===(l=this.learner_preference)||void 0===l||l.initialize(),null===(c=this.score)||void 0===c||c.initialize(),null===(u=this.comments_from_learner)||void 0===u||u.initialize(),null===(d=this.comments_from_lms)||void 0===d||d.initialize(),null===(v=this.interactions)||void 0===v||v.initialize(),null===(f=this.objectives)||void 0===f||f.initialize()}},{key:"reset",value:function(){var e,t,i,n,r,o,a,s,l,c,u,d,v;this._initialized=!1,this._start_time=void 0,null===(e=this.metadata)||void 0===e||e.reset(),null===(t=this.learner)||void 0===t||t.reset(),null===(i=this.status)||void 0===i||i.reset(),null===(n=this.session)||void 0===n||n.reset(),null===(r=this.content)||void 0===r||r.reset(),null===(o=this.settings)||void 0===o||o.reset(),null===(a=this.thresholds)||void 0===a||a.reset(),null===(s=this.objectives)||void 0===s||s.reset(!0),null===(l=this.interactions)||void 0===l||l.reset(!0),null===(c=this.score)||void 0===c||c.reset(),null===(u=this.comments_from_learner)||void 0===u||u.reset(),null===(d=this.comments_from_lms)||void 0===d||d.reset(),null===(v=this.learner_preference)||void 0===v||v.reset()}},{key:"_version",get:function(){return this.metadata._version},set:function(_version){this.metadata._version=_version}},{key:"_children",get:function(){return this.metadata._children},set:function(_children){this.metadata._children=_children}},{key:"completion_status",get:function(){return this.status.completion_status},set:function(completion_status){this.status.completion_status=completion_status}},{key:"completion_threshold",get:function(){return this.thresholds.completion_threshold},set:function(e){this.thresholds.completion_threshold=e}},{key:"credit",get:function(){return this.settings.credit},set:function(credit){this.settings.credit=credit}},{key:"entry",get:function(){return this.session.entry},set:function(entry){this.session.entry=entry}},{key:"exit",get:function(){return this.session.jsonString=this.jsonString,this.session.exit},set:function(exit){this.session.exit=exit}},{key:"getExitValueInternal",value:function(){return this.session.getExitValueInternal()}},{key:"launch_data",get:function(){return this.content.launch_data},set:function(launch_data){this.content.launch_data=launch_data}},{key:"learner_id",get:function(){return this.learner.learner_id},set:function(learner_id){this.learner.learner_id=learner_id}},{key:"learner_name",get:function(){return this.learner.learner_name},set:function(learner_name){this.learner.learner_name=learner_name}},{key:"location",get:function(){return this.content.location},set:function(location){this.content.location=location}},{key:"max_time_allowed",get:function(){return this.settings.max_time_allowed},set:function(max_time_allowed){this.settings.max_time_allowed=max_time_allowed}},{key:"mode",get:function(){return this.settings.mode},set:function(mode){this.settings.mode=mode}},{key:"progress_measure",get:function(){return this.status.progress_measure},set:function(progress_measure){this.status.progress_measure=progress_measure}},{key:"scaled_passing_score",get:function(){return this.thresholds.scaled_passing_score},set:function(scaled_passing_score){this.thresholds.scaled_passing_score=scaled_passing_score}},{key:"session_time",get:function(){return this.session.jsonString=this.jsonString,this.session.session_time},set:function(session_time){this.session.session_time=session_time}},{key:"success_status",get:function(){return this.status.success_status},set:function(success_status){this.status.success_status=success_status}},{key:"suspend_data",get:function(){return this.content.suspend_data},set:function(suspend_data){this.content.suspend_data=suspend_data}},{key:"time_limit_action",get:function(){return this.settings.time_limit_action},set:function(time_limit_action){this.settings.time_limit_action=time_limit_action}},{key:"total_time",get:function(){return this.session.total_time},set:function(total_time){this.session.total_time=total_time}},{key:"getCurrentTotalTime",value:function(){return this.session.getCurrentTotalTime(this.start_time)}},{key:"toJSON",value:function(){this.jsonString=!0,this.session.jsonString=!0;var result={comments_from_learner:this.comments_from_learner,comments_from_lms:this.comments_from_lms,completion_status:this.completion_status,completion_threshold:this.completion_threshold,credit:this.credit,entry:this.entry,exit:this.exit,interactions:this.interactions,launch_data:this.launch_data,learner_id:this.learner_id,learner_name:this.learner_name,learner_preference:this.learner_preference,location:this.location,max_time_allowed:this.max_time_allowed,mode:this.mode,objectives:this.objectives,progress_measure:this.progress_measure,scaled_passing_score:this.scaled_passing_score,score:this.score,session_time:this.session_time,success_status:this.success_status,suspend_data:this.suspend_data,time_limit_action:this.time_limit_action,total_time:this.total_time};return this.jsonString=!1,this.session.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Js(e,t,i){return t=el(t),n=e,!(r=il()?Reflect.construct(t,i||[],el(e).constructor):t.apply(e,i))||"object"!==ol(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $s(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Qs(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Zs(e,t,i){return Zs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=el(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Zs(e,t,i||e)}function el(e){return el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},el(e)}function tl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rl(e,t)}function il(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(il=function(){return!!result})()}function nl(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Qs(e,t,i[t])})}return e}function rl(e,t){return rl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rl(e,t)}function ol(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var al=Object.defineProperty,sl=function(e,t,i){return function(e,t,i){return t in e?al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ol(t))?t+"":t,i)},ll=function(e){function t(){var e;return Xs(this,t),e=Js(this,t,["adl"]),sl(e,"nav"),sl(e,"data",new ul),sl(e,"_sequencing",null),e.nav=new cl,e.data=new ul,e}return tl(t,e),$s(t,[{key:"initialize",value:function(){var e;Zs(el(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,null===(e=this.nav)||void 0===e||e.reset()}},{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e,e&&(e.adlNav=this.nav,this.nav.sequencing=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={nav:this.nav,data:this.data};return this.jsonString=!1,result}}]),t}(C),cl=function(e){function t(){var e;return Xs(this,t),e=Js(this,t,["adl.nav"]),sl(e,"_request","_none_"),sl(e,"_sequencing",null),sl(e,"request_valid"),e.request_valid=new hl,e.request_valid.setParentNav(e),e}return tl(t,e),$s(t,[{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e}},{key:"initialize",value:function(){var e;Zs(el(t.prototype),"initialize",this).call(this),null===(e=this.request_valid)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._request="_none_",this._sequencing&&(this._sequencing.adlNav=null),this._sequencing=null,null===(e=this.request_valid)||void 0===e||e.reset()}},{key:"request",get:function(){return this._request},set:function(request){Zi(this._cmi_element+".request",request,Be)&&(this._request=request)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={request:this.request};return this.jsonString=!1,result}}]),t}(C),ul=function(e){function t(){return Xs(this,t),Js(this,t,[{CMIElement:"adl.data",children:B.adl_data_children,errorCode:se.READ_ONLY_ELEMENT,errorClass:te}])}return tl(t,e),t}(he),dl=function(e){function t(){var e;return Xs(this,t),e=Js(this,t,["adl.data.n"]),sl(e,"_id",""),sl(e,"_store",""),sl(e,"_idIsSet",!1),sl(e,"_storeIsSet",!1),e}return tl(t,e),$s(t,[{key:"reset",value:function(){this._initialized=!1,this._idIsSet=!1,this._storeIsSet=!1}},{key:"id",get:function(){return this._id},set:function(id){if(this.initialized)throw new te(this._cmi_element+".id",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".id",id,Le)&&(this._id=id,this._idIsSet=!0)}},{key:"store",get:function(){if(this.initialized&&!this._storeIsSet)throw new te(this._cmi_element+".store",se.VALUE_NOT_INITIALIZED);return this._store},set:function(e){if(this.initialized&&!this._idIsSet)throw new te(this._cmi_element+".store",se.DEPENDENCY_NOT_ESTABLISHED);Zi(this._cmi_element+".store",e,Me)&&(this._store=e,this._storeIsSet=!0)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,store:this._store};return this.jsonString=!1,result}}]),t}(C),vl=function(){function e(){Xs(this,e),sl(this,"_parentNav",null),sl(this,"_staticValues",{})}return $s(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.overallSequencingProcess){var n=this._parentNav.sequencing.overallSequencingProcess;if(n.predictChoiceEnabled)return n.predictChoiceEnabled(e)?"true":"false"}var r=this._staticValues[e];return r===pe?"true":r===ye?"false":"unknown"}},{key:"getAll",value:function(){return nl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=nl({},e)}}]),e}(),fl=function(){function e(){Xs(this,e),sl(this,"_parentNav",null),sl(this,"_staticValues",{})}return $s(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.activityTree)return this._parentNav.sequencing.activityTree.getActivity(e)?"true":"false";var n=this._staticValues[e];return n===pe?"true":n===ye?"false":"unknown"}},{key:"getAll",value:function(){return nl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=nl({},e)}}]),e}(),hl=function(e){function t(){var e;return Xs(this,t),e=Js(this,t,["adl.nav.request_valid"]),sl(e,"_continue","unknown"),sl(e,"_previous","unknown"),sl(e,"_choice"),sl(e,"_jump"),sl(e,"_exit","unknown"),sl(e,"_exitAll","unknown"),sl(e,"_abandon","unknown"),sl(e,"_abandonAll","unknown"),sl(e,"_suspendAll","unknown"),sl(e,"_parentNav",null),e._choice=new vl,e._jump=new fl,e}return tl(t,e),$s(t,[{key:"setParentNav",value:function(nav){this._parentNav=nav,this._choice.setParentNav(nav),this._jump.setParentNav(nav)}},{key:"reset",value:function(){this._initialized=!1,this._continue="unknown",this._previous="unknown",this._choice.setAll({}),this._jump.setAll({}),this._exit="unknown",this._exitAll="unknown",this._abandon="unknown",this._abandonAll="unknown",this._suspendAll="unknown"}},{key:"continue",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictContinueEnabled)return i.predictContinueEnabled()?"true":"false"}return this._continue},set:function(e){if(this.initialized)throw new te(this._cmi_element+".continue",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".continue",e,Ve)&&(this._continue=e)}},{key:"previous",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictPreviousEnabled)return i.predictPreviousEnabled()?"true":"false"}return this._previous},set:function(e){if(this.initialized)throw new te(this._cmi_element+".previous",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".previous",e,Ve)&&(this._previous=e)}},{key:"choice",get:function(){return this._choice},set:function(e){if(this.initialized)throw new te(this._cmi_element+".choice",se.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":ol(e)))throw new te(this._cmi_element+".choice",se.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&Zi(this._cmi_element+".choice."+i,e[i]||"",Ve)&&Zi(this._cmi_element+".choice."+i,i,He)){var n=e[i];"true"===n?t[i]=pe:"false"===n?t[i]=ye:"unknown"===n&&(t[i]=me)}this._choice.setAll(t)}},{key:"jump",get:function(){return this._jump},set:function(e){if(this.initialized)throw new te(this._cmi_element+".jump",se.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":ol(e)))throw new te(this._cmi_element+".jump",se.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&Zi(this._cmi_element+".jump."+i,e[i]||"",Ve)&&Zi(this._cmi_element+".jump."+i,i,He)){var n=e[i];"true"===n?t[i]=pe:"false"===n?t[i]=ye:"unknown"===n&&(t[i]=me)}this._jump.setAll(t)}},{key:"exit",get:function(){return this._exit},set:function(e){if(this.initialized)throw new te(this._cmi_element+".exit",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".exit",e,Ve)&&(this._exit=e)}},{key:"exitAll",get:function(){return this._exitAll},set:function(e){if(this.initialized)throw new te(this._cmi_element+".exitAll",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".exitAll",e,Ve)&&(this._exitAll=e)}},{key:"abandon",get:function(){return this._abandon},set:function(e){if(this.initialized)throw new te(this._cmi_element+".abandon",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".abandon",e,Ve)&&(this._abandon=e)}},{key:"abandonAll",get:function(){return this._abandonAll},set:function(e){if(this.initialized)throw new te(this._cmi_element+".abandonAll",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".abandonAll",e,Ve)&&(this._abandonAll=e)}},{key:"suspendAll",get:function(){return this._suspendAll},set:function(e){if(this.initialized)throw new te(this._cmi_element+".suspendAll",se.READ_ONLY_ELEMENT);Zi(this._cmi_element+".suspendAll",e,Ve)&&(this._suspendAll=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={previous:this.previous,continue:this.continue,choice:this._choice.getAll(),jump:this._jump.getAll(),exit:this.exit,exitAll:this.exitAll,abandon:this.abandon,abandonAll:this.abandonAll,suspendAll:this.suspendAll};return this.jsonString=!1,result}}]),t}(C);function ml(e,t,i){return ml="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=pl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},ml(e,t,i||e)}function pl(e){return pl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},pl(e)}function yl(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function gl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gl=function(){return!!result})()}function bl(e,t){return bl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},bl(e,t)}function _l(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Sl=Object.defineProperty,wl=function(e,t,i){return function(e,t,i){return t in e?Sl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":_l(t))?t+"":t,i)},Cl=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=pl(t),n=e,!(r=gl()?Reflect.construct(t,i||[],pl(e).constructor):t.apply(e,i))||"object"!==_l(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activityTree"]),wl(i,"_root",null),wl(i,"_currentActivity",null),wl(i,"_suspendedActivity",null),wl(i,"_activities",new Map),e&&(i.root=e),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bl(e,t)}(t,e),i=t,n=[{key:"initialize",value:function(){ml(pl(t.prototype),"initialize",this).call(this),this._root&&this._root.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._currentActivity=null,this._suspendedActivity=null,this._activities.clear(),this._root&&(this._root.reset(),this._activities.set(this._root.id,this._root),this._addActivitiesToMap(this._root))}},{key:"root",get:function(){return this._root},set:function(e){if(null!==e&&!yl(e,Pn))throw new te(this._cmi_element+".root",se.TYPE_MISMATCH);this._activities.clear(),this._root=e,e&&(this._activities.set(e.id,e),this._addActivitiesToMap(e))}},{key:"_addActivitiesToMap",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this._activities.set(a.id,a),this._addActivitiesToMap(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"currentActivity",get:function(){return this._currentActivity},set:function(e){if(null!==e&&!yl(e,Pn))throw new te(this._cmi_element+".currentActivity",se.TYPE_MISMATCH);if(this._currentActivity){this._currentActivity.isActive=!1;for(var t=this._currentActivity.parent;t;)t.isActive=!1,t=t.parent}if(this._currentActivity=e,e){e.isActive=!0;for(var i=e.parent;i;)i.isActive=!0,i=i.parent}}},{key:"setCurrentActivityWithoutActivation",value:function(e){if(null!==e&&!yl(e,Pn))throw new te(this._cmi_element+".currentActivity",se.TYPE_MISMATCH);if(this._currentActivity){var t=new Set;if(e){t.add(e);for(var i=e.parent;i;)t.add(i),i=i.parent}this._currentActivity.isActive=!1;for(var n=this._currentActivity.parent;n;)t.has(n)||(n.isActive=!1),n=n.parent}this._currentActivity=e}},{key:"suspendedActivity",get:function(){return this._suspendedActivity},set:function(e){if(null!==e&&!yl(e,Pn))throw new te(this._cmi_element+".suspendedActivity",se.TYPE_MISMATCH);if(this._suspendedActivity){this._suspendedActivity.isSuspended=!1;for(var t=this._suspendedActivity.parent;t;)t.isSuspended=!1,t=t.parent}if(this._suspendedActivity=e,e){e.isSuspended=!0;for(var i=e.parent;i;)i.isSuspended=!0,i=i.parent}}},{key:"getActivity",value:function(id){return this._activities.get(id)||null}},{key:"getAllActivities",value:function(){return Array.from(this._activities.values())}},{key:"getParent",value:function(e){return e.parent}},{key:"getChildren",value:function(e){return 1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children}},{key:"getSiblings",value:function(e){return e.parent?e.parent.children.filter(function(t){return t!==e}):[]}},{key:"getNextSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),-1===r||r===n.length-1?null:null!==(t=n[r+1])&&void 0!==t?t:null}},{key:"getPreviousSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),r>0&&null!==(t=n[r-1])&&void 0!==t?t:null}},{key:"getFirstChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[0])&&void 0!==t?t:null}},{key:"getLastChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[i.length-1])&&void 0!==t?t:null}},{key:"getCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.unshift(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={root:this._root,currentActivity:this._currentActivity?this._currentActivity.id:null,suspendedActivity:this._suspendedActivity?this._suspendedActivity.id:null};return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Al(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function El(e,t,i){return El="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=kl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},El(e,t,i||e)}function kl(e){return kl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},kl(e)}function jl(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Rl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Rl=function(){return!!result})()}function Ml(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Al(e,t,i[t])})}return e}function Tl(e,t){return Tl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Tl(e,t)}function xl(e){return function(e){if(Array.isArray(e))return Ol(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ol(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ol(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Il(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Pl=Object.defineProperty,Nl=function(e,t,i){return function(e,t,i){return t in e?Pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Il(t))?t+"":t,i)},ql=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=kl(t),n=e,!(r=Rl()?Reflect.construct(t,i||[],kl(e).constructor):t.apply(e,i))||"object"!==Il(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencing"]),Nl(e,"_activityTree"),Nl(e,"_sequencingRules"),Nl(e,"_sequencingControls"),Nl(e,"_rollupRules"),Nl(e,"_adlNav",null),Nl(e,"_hideLmsUi",[]),Nl(e,"_auxiliaryResources",[]),Nl(e,"_overallSequencingProcess",null),e._activityTree=new Cl,e._sequencingRules=new yt,e._sequencingControls=new Ht,e._rollupRules=new gn,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tl(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){El(kl(t.prototype),"initialize",this).call(this),this._activityTree.initialize(),this._sequencingRules.initialize(),this._sequencingControls.initialize(),this._rollupRules.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._activityTree.reset(),this._sequencingRules.reset(),this._sequencingControls.reset(),this._rollupRules.reset(),this._hideLmsUi=[],this._auxiliaryResources=[]}},{key:"activityTree",get:function(){return this._activityTree},set:function(e){if(!jl(e,Cl))throw new te(this._cmi_element+".activityTree",se.TYPE_MISMATCH);this._activityTree=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){if(!jl(e,yt))throw new te(this._cmi_element+".sequencingRules",se.TYPE_MISMATCH);this._sequencingRules=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){if(!jl(e,Ht))throw new te(this._cmi_element+".sequencingControls",se.TYPE_MISMATCH);this._sequencingControls=e}},{key:"hideLmsUi",get:function(){return xl(this._hideLmsUi)},set:function(e){this._hideLmsUi=xl(e)}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return Ml({},e)})},set:function(e){this._auxiliaryResources=e.map(function(e){return Ml({},e)})}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){if(!jl(e,gn))throw new te(this._cmi_element+".rollupRules",se.TYPE_MISMATCH);this._rollupRules=e}},{key:"adlNav",get:function(){return this._adlNav},set:function(e){this._adlNav=e}},{key:"overallSequencingProcess",get:function(){return this._overallSequencingProcess},set:function(e){this._overallSequencingProcess=e}},{key:"processRollup",value:function(){var e=this._activityTree.root;e&&this._processRollupRecursive(e)}},{key:"_processRollupRecursive",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this._processRollupRecursive(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this._rollupRules.processRollup(e)}},{key:"getCurrentActivity",value:function(){return this._activityTree.currentActivity}},{key:"getRootActivity",value:function(){return this._activityTree.root}},{key:"toJSON",value:function(){this.jsonString=!0;var result={activityTree:this._activityTree,sequencingRules:this._sequencingRules,sequencingControls:this._sequencingControls,rollupRules:this._rollupRules,adlNav:this._adlNav};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);var Dl=Object.defineProperty,Ll=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"checkValidResponseType",value:function(e,t,i,n){var r=[];(null==t?void 0:t.delimiter)?r=Fo(i+"",t.delimiter):r[0]=i,r.length>0&&t.max>=r.length?this.context.checkCorrectResponseValue?this.context.checkCorrectResponseValue(e,n,r,i):this.checkCorrectResponseValue(e,n,r,i):r.length>t.max&&this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"Data Model Element Pattern Too Long: ".concat(i))}},{key:"checkDuplicateChoiceResponse",value:function(e,t,i){var n=t.correct_responses._count;if("choice"===t.type)for(var r=0;n>r&&"0"===this.context.getLastErrorCode();r++){var o=t.correct_responses.childArray[r];(null==o?void 0:o.pattern)===i&&this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"".concat(i))}}},{key:"validateCorrectResponse",value:function(e,t,i){var n=+e.split(".")[4];if(t){var r=t.correct_responses._count;this.checkDuplicateChoiceResponse(e,t,i);var o=Ye[t.type];o&&(void 0===o.limit||o.limit>r)?(this.checkValidResponseType(e,o,i,t.type),"0"===this.context.getLastErrorCode()&&(!o.duplicate||!this.checkDuplicatedPattern(t.correct_responses,n,i))||"0"===this.context.getLastErrorCode()&&""===i||"0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"Data Model Element Pattern Already Exists: ".concat(e," - ").concat(i))):this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e," - ").concat(i))}else this.context.throwSCORMError(e,se.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"checkDuplicatedPattern",value:function(e,t,i){for(var n=!1,r=e._count,o=0;r>o&&!n;o++)if(o!==t){var a=e.childArray[o];(null==a?void 0:a.pattern)===i&&(n=!0)}return n}},{key:"checkCorrectResponseValue",value:function(e,t,i,n){var r=Ye[t];if(r)for(var o=RegExp(r.format),a=0;i.length>a&&"0"===this.context.getLastErrorCode();a++)if(t.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")&&(i[a]=this.removeCorrectResponsePrefixes(e,i[a])),null==r?void 0:r.delimiter2){var s,l,c="performance"===t?Bo(i[a],r.delimiter2):Fo(i[a],r.delimiter2);2===c.length?"performance"===t&&""===c[0]&&""===c[1]?this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n)):(null===(s=c[0])||void 0===s?void 0:s.match(o))&&r.format2&&(null===(l=c[1])||void 0===l?void 0:l.match(RegExp(r.format2)))||this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n)):this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else{if("numeric"===t&&i.length>1&&""===i[a]&&r.delimiter&&(n+"").includes(r.delimiter))continue;var u=i[a].match(o);if(!u&&""!==n||!u&&"true-false"===t)this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if("numeric"===t&&i.length>1)""!==i[0]&&""!==i[1]&&+i[0]>+i[1]&&this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if(""!==i[a]&&r.unique)for(var d=0;a>d&&"0"===this.context.getLastErrorCode();d++)i[a]===i[d]&&this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else this.context.throwSCORMError(e,se.TYPE_MISMATCH,"Incorrect Response Type: ".concat(t))}},{key:"removeCorrectResponsePrefixes",value:function(e,t){for(var i,n=!1,r=!1,o=!1,a=RegExp("^({(lang|case_matters|order_matters)=([^}]+)})"),s=t.match(a);s;){var l;switch(s[2]){case"lang":if(i=t.match("^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$")){var c=i[3];void 0!==c&&c.length>0&&(Je.includes(c.toLowerCase())||this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t)))}o=!0;break;case"case_matters":o||n||r||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t)),r=!0;break;case"order_matters":r||o||n||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,se.TYPE_MISMATCH,"".concat(t)),n=!0}s=(t=t.substring((null===(l=s[1])||void 0===l?void 0:l.length)||0)).match(a)}return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var zl=Object.defineProperty,Fl=function(e,t,i){return function(e,t,i){return t in e?zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Bl=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Fl(this,"context"),Fl(this,"responseValidator"),this.context=t,this.responseValidator=i}return t=e,(i=[{key:"getChildElement",value:function(e,t,i){if(v(e,"cmi\\.objectives\\.\\d+"))return new Ga;if(i){if(v(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+"))return this.createCorrectResponsesObject(e,t);if(v(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+"))return new na}else if(v(e,"cmi\\.interactions\\.\\d+"))return new ia;return v(e,"cmi\\.comments_from_learner\\.\\d+")?new xa:v(e,"cmi\\.comments_from_lms\\.\\d+")?new xa(!0):v(e,"adl\\.data\\.\\d+")?new dl:null}},{key:"createCorrectResponsesObject",value:function(e,t){var i=e.split("."),n=this.context.cmi.interactions.childArray[+i[2]];if(this.context.isInitialized()){if(void 0===n||!n.type)return this.context.throwSCORMError(e,se.DEPENDENCY_NOT_ESTABLISHED,e),null;var r=Ye[n.type];if(r&&void 0!==r.limit&&n.correct_responses._count>=r.limit)return this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e)),null;if(this.responseValidator.checkDuplicateChoiceResponse(e,n,t),!r)return this.context.throwSCORMError(e,se.GENERAL_SET_FAILURE,"Incorrect Response Type: ".concat(n.type)),null;this.responseValidator.checkValidResponseType(e,r,t,n.type)}return"0"===this.context.getLastErrorCode()?new aa(null==n?void 0:n.type):null}},{key:"evaluateCompletionStatus",value:function(){return cr({completionThreshold:this.context.cmi.completion_threshold,progressMeasure:this.context.cmi.progress_measure,storedCompletionStatus:this.context.cmi.completion_status})}},{key:"evaluateSuccessStatus",value:function(){var e=this.context.cmi.scaled_passing_score,t=this.context.cmi.score.scaled,i=this.context.cmi.success_status;if(""!==e&&null!=e){var n=parseFloat(e+"");if(!isNaN(n)){if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r))return n>r?be:ge}return _e}}return i||_e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Hl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ul(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Hl(e,t,i[t])})}return e}function Gl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||Yl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kl(e){return function(e){if(Array.isArray(e))return Vl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Yl(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yl(e,t){if(e){if("string"==typeof e)return Vl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Vl(e,t):void 0}}var Wl=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"applySequencingControlsSettings",value:function(e,t){void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.choice&&(e.choice=t.choice),void 0!==t.choiceExit&&(e.choiceExit=t.choiceExit),void 0!==t.flow&&(e.flow=t.flow),void 0!==t.forwardOnly&&(e.forwardOnly=t.forwardOnly),void 0!==t.useCurrentAttemptObjectiveInfo&&(e.useCurrentAttemptObjectiveInfo=t.useCurrentAttemptObjectiveInfo),void 0!==t.useCurrentAttemptProgressInfo&&(e.useCurrentAttemptProgressInfo=t.useCurrentAttemptProgressInfo),void 0!==t.preventActivation&&(e.preventActivation=t.preventActivation),void 0!==t.constrainChoice&&(e.constrainChoice=t.constrainChoice),void 0!==t.stopForwardTraversal&&(e.stopForwardTraversal=t.stopForwardTraversal),void 0!==t.rollupObjectiveSatisfied&&(e.rollupObjectiveSatisfied=t.rollupObjectiveSatisfied),void 0!==t.rollupProgressCompletion&&(e.rollupProgressCompletion=t.rollupProgressCompletion),void 0!==t.objectiveMeasureWeight&&(e.objectiveMeasureWeight=t.objectiveMeasureWeight),void 0!==t.selectionTiming&&(e.selectionTiming=t.selectionTiming),void 0!==t.selectCount&&(e.selectCount=t.selectCount),void 0!==t.randomizeChildren&&(e.randomizeChildren=t.randomizeChildren),void 0!==t.randomizationTiming&&(e.randomizationTiming=t.randomizationTiming),void 0!==t.selectionCountStatus&&(e.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(e.reorderChildren=t.reorderChildren),void 0!==t.completionSetByContent&&(e.completionSetByContent=t.completionSetByContent),void 0!==t.objectiveSetByContent&&(e.objectiveSetByContent=t.objectiveSetByContent),void 0!==t.tracked&&(e.tracked=t.tracked)}},{key:"applySequencingRulesSettings",value:function(e,t){if(t){if(t.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createSequencingRule(o.value);e.addPreConditionRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(t.exitConditionRules){var l=!0,c=!1,u=void 0;try{for(var d,v=t.exitConditionRules[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=this.createSequencingRule(d.value);e.addExitConditionRule(f)}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}if(t.postConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=t.postConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=this.createSequencingRule(y.value);e.addPostConditionRule(b)}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}}}},{key:"createSequencingRule",value:function(e){var t=new pt(e.action,e.conditionCombination),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=new mt(s.condition,s.operator,new Map(Object.entries(s.parameters||{})));s.referencedObjective&&(l.referencedObjective=s.referencedObjective),t.addCondition(l)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"applyRollupRulesSettings",value:function(e,t){if(null==t?void 0:t.rules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.rules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createRollupRule(o.value);e.addRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"createRollupRule",value:function(e){var t=new yn(e.action,e.consideration,e.minimumCount,e.minimumPercent),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,l=new pn(s.condition,new Map(Object.entries(s.parameters||{})));t.addCondition(l)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"sanitizeSequencingCollections",value:function(e){if(!e)return{};var t={},i=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=Gl(o.value,2),l=s[1],c=s[0].trim();if(c){var u,d={};if(l.sequencingControls&&(d.sequencingControls=Ul({},l.sequencingControls)),l.sequencingRules){var v=function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return void 0!==e.operator&&(t.operator=e.operator),e.parameters&&(t.parameters=Ul({},e.parameters)),void 0!==e.referencedObjective&&(t.referencedObjective=e.referencedObjective),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),t};d.sequencingRules={},l.sequencingRules.preConditionRules&&(d.sequencingRules.preConditionRules=l.sequencingRules.preConditionRules.map(v)),l.sequencingRules.exitConditionRules&&(d.sequencingRules.exitConditionRules=l.sequencingRules.exitConditionRules.map(v)),l.sequencingRules.postConditionRules&&(d.sequencingRules.postConditionRules=l.sequencingRules.postConditionRules.map(v))}l.rollupRules&&(d.rollupRules={rules:null===(u=l.rollupRules.rules)||void 0===u?void 0:u.map(function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return e.parameters&&(t.parameters=Ul({},e.parameters)),t})};return void 0!==e.consideration&&(t.consideration=e.consideration),void 0!==e.minimumCount&&(t.minimumCount=e.minimumCount),void 0!==e.minimumPercent&&(t.minimumPercent=e.minimumPercent),t})}),l.rollupConsiderations&&(d.rollupConsiderations=Ul({},l.rollupConsiderations)),l.selectionRandomizationState&&(d.selectionRandomizationState=this.cloneSelectionRandomizationState(l.selectionRandomizationState)),l.hideLmsUi&&(d.hideLmsUi=this.sanitizeHideLmsUi(l.hideLmsUi)),l.auxiliaryResources&&(d.auxiliaryResources=this.sanitizeAuxiliaryResources(l.auxiliaryResources)),t[c]=d}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"normalizeCollectionRefs",value:function(e){if(!e)return[];var t=Array.isArray(e)?e:[e],i=new Set,result=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value.trim();l&&!i.has(l)&&(i.add(l),result.push(l))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return result}},{key:"applySequencingCollection",value:function(e,t,i){if(t){if(t.sequencingControls&&this.applySequencingControlsSettings(e.sequencingControls,t.sequencingControls),t.sequencingRules&&this.applySequencingRulesSettings(e.sequencingRules,t.sequencingRules),t.rollupRules&&this.applyRollupRulesSettings(e.rollupRules,t.rollupRules),t.rollupConsiderations&&e.applyRollupConsiderations(t.rollupConsiderations),t.hideLmsUi){var n=this.mergeHideLmsUi(e.hideLmsUi,t.hideLmsUi);n.length>0&&(e.hideLmsUi=n)}if(t.auxiliaryResources){var r=this.sanitizeAuxiliaryResources(t.auxiliaryResources);r.length>0&&(e.auxiliaryResources=this.mergeAuxiliaryResources(e.auxiliaryResources,r))}t.selectionRandomizationState&&i.push(this.cloneSelectionRandomizationState(t.selectionRandomizationState))}}},{key:"sanitizeHideLmsUi",value:function(e){if(!e)return[];var t=new Set(et),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return n}},{key:"mergeHideLmsUi",value:function(e,t){return t&&0!==t.length?this.sanitizeHideLmsUi(Kl(e).concat(Kl(t))):e}},{key:"sanitizeAuxiliaryResources",value:function(e){if(!e)return[];var t=new Set,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;if(l&&l.resourceId&&"string"==typeof l.resourceId&&l.purpose&&"string"==typeof l.purpose){var c=l.resourceId.trim(),u=l.purpose.trim();if(c&&u){var d="".concat(c,"::").concat(u);t.has(d)||(t.add(d),i.push({resourceId:c,purpose:u}))}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"mergeAuxiliaryResources",value:function(e,t){var i=[],n=new Set,r=!0,o=!1,a=void 0;try{for(var s,l=Kl(null!=e?e:[]).concat(Kl(null!=t?t:[]))[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c){var u=c.resourceId;u&&!n.has(u)&&(n.add(u),i.push({resourceId:u,purpose:c.purpose}))}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return i}},{key:"cloneSelectionRandomizationState",value:function(e){var t={};return e.childOrder&&(t.childOrder=Kl(e.childOrder)),e.selectedChildIds&&(t.selectedChildIds=Kl(e.selectedChildIds)),e.hiddenFromChoiceChildIds&&(t.hiddenFromChoiceChildIds=Kl(e.hiddenFromChoiceChildIds)),void 0!==e.selectionCountStatus&&(t.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(t.reorderChildren=e.reorderChildren),t}},{key:"applySelectionRandomizationState",value:function(e,t){var i=e.sequencingControls;void 0!==t.selectionCountStatus&&(i.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(i.reorderChildren=t.reorderChildren);var n=t.selectedChildIds?new Set(t.selectedChildIds):null,r=t.hiddenFromChoiceChildIds?new Set(t.hiddenFromChoiceChildIds):null;t.childOrder&&t.childOrder.length>0&&e.setChildOrder(t.childOrder);var o=!1;if(n||r){var a=!0,s=!1,l=void 0;try{for(var c,u=e.children[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;if(n){var v=n.has(d.id);d.isAvailable=v,r||(d.isHiddenFromChoice=!v),o=!0}r&&(d.isHiddenFromChoice=r.has(d.id),o=!0)}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}(o||n||void 0!==t.selectionCountStatus||void 0!==t.reorderChildren||t.childOrder&&t.childOrder.length>0)&&e.setProcessedChildren(e.children.filter(function(e){return e.isAvailable}))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Jl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Xl(e){return function(e){if(Array.isArray(e))return Jl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Jl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Jl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var $l=Object.defineProperty,Ql=function(e,t,i){return function(e,t,i){return t in e?$l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Zl=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ql(this,"sequencingCollections"),Ql(this,"sequencingConfigBuilder"),this.sequencingCollections=t||{},this.sequencingConfigBuilder=i||new Wl}return t=e,(i=[{key:"setSequencingCollections",value:function(e){this.sequencingCollections=e}},{key:"createActivity",value:function(e){var t=new Pn(e.id,e.title),i=[],n=this.sequencingConfigBuilder.normalizeCollectionRefs(e.sequencingCollectionRefs),r=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=this.sequencingCollections[s.value];c&&this.sequencingConfigBuilder.applySequencingCollection(t,c,i)}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}if(void 0!==e.isVisible&&(t.isVisible=e.isVisible),void 0!==e.isActive&&(t.isActive=e.isActive),void 0!==e.isSuspended&&(t.isSuspended=e.isSuspended),void 0!==e.isCompleted&&(t.isCompleted=e.isCompleted),void 0!==e.isHiddenFromChoice&&(t.isHiddenFromChoice=e.isHiddenFromChoice),void 0!==e.isAvailable&&(t.isAvailable=e.isAvailable),void 0!==e.attemptLimit&&(t.attemptLimit=e.attemptLimit),void 0!==e.attemptAbsoluteDurationLimit&&(t.attemptAbsoluteDurationLimit=e.attemptAbsoluteDurationLimit),void 0!==e.activityAbsoluteDurationLimit&&(t.activityAbsoluteDurationLimit=e.activityAbsoluteDurationLimit),void 0!==e.timeLimitAction&&(t.timeLimitAction=e.timeLimitAction),void 0!==e.timeLimitDuration&&(t.timeLimitDuration=e.timeLimitDuration),void 0!==e.beginTimeLimit&&(t.beginTimeLimit=e.beginTimeLimit),void 0!==e.endTimeLimit&&(t.endTimeLimit=e.endTimeLimit),e.primaryObjective){var u=this.createActivityObjectiveFromSettings(e.primaryObjective,!0);t.primaryObjective=u,null!==u.minNormalizedMeasure&&(t.scaledPassingScore=u.minNormalizedMeasure)}if(e.objectives){var d=!0,v=!1,f=void 0;try{for(var h,m=e.objectives[Symbol.iterator]();!(d=(h=m.next()).done);d=!0){var p=h.value,y=!0===p.isPrimary,g=this.createActivityObjectiveFromSettings(p,y);y?t.primaryObjective=g:t.addObjective(g)}}catch(e){v=!0,f=e}finally{try{d||null==m.return||m.return()}finally{if(v)throw f}}}if(e.sequencingControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.sequencingControls),e.deliveryControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.deliveryControls),e.sequencingRules&&this.sequencingConfigBuilder.applySequencingRulesSettings(t.sequencingRules,e.sequencingRules),e.rollupRules&&this.sequencingConfigBuilder.applyRollupRulesSettings(t.rollupRules,e.rollupRules),e.rollupConsiderations&&t.applyRollupConsiderations(e.rollupConsiderations),e.completionThreshold){var b=e.completionThreshold;void 0!==b.completedByMeasure&&(t.completedByMeasure=b.completedByMeasure),void 0!==b.minProgressMeasure?(t.minProgressMeasure=b.minProgressMeasure,t.completionThreshold=""+b.minProgressMeasure):b.completedByMeasure&&(t.completionThreshold=""+t.minProgressMeasure),void 0!==b.progressWeight&&(t.progressWeight=b.progressWeight)}if(e.hideLmsUi){var _=this.sequencingConfigBuilder.mergeHideLmsUi(t.hideLmsUi,e.hideLmsUi);_.length>0&&(t.hideLmsUi=_)}if(e.auxiliaryResources){var S=this.sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources);S.length>0&&(t.auxiliaryResources=this.sequencingConfigBuilder.mergeAuxiliaryResources(t.auxiliaryResources,S))}if(e.children){var w=!0,C=!1,O=void 0;try{for(var A,E=e.children[Symbol.iterator]();!(w=(A=E.next()).done);w=!0){var k=this.createActivity(A.value);t.addChild(k)}}catch(e){C=!0,O=e}finally{try{w||null==E.return||E.return()}finally{if(C)throw O}}}e.selectionRandomizationState&&i.push(this.sequencingConfigBuilder.cloneSelectionRandomizationState(e.selectionRandomizationState));var j=!0,R=!1,M=void 0;try{for(var T,x=i[Symbol.iterator]();!(j=(T=x.next()).done);j=!0)this.sequencingConfigBuilder.applySelectionRandomizationState(t,T.value)}catch(e){R=!0,M=e}finally{try{j||null==x.return||x.return()}finally{if(R)throw M}}return t}},{key:"extractActivityIds",value:function(e){var t=[e.id],i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s;(s=t).push.apply(s,Xl(this.extractActivityIds(o.value)))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"createActivityObjectiveFromSettings",value:function(e,t){var i,n,r,o=(e.mapInfo||[]).map(function(e){var t,i,n,r,o,a,s,l,c,u,d,v,f,h,m;return{targetObjectiveID:e.targetObjectiveID,readSatisfiedStatus:null===(t=e.readSatisfiedStatus)||void 0===t||t,readNormalizedMeasure:null===(i=e.readNormalizedMeasure)||void 0===i||i,writeSatisfiedStatus:null!==(n=e.writeSatisfiedStatus)&&void 0!==n&&n,writeNormalizedMeasure:null!==(r=e.writeNormalizedMeasure)&&void 0!==r&&r,readCompletionStatus:null===(o=e.readCompletionStatus)||void 0===o||o,writeCompletionStatus:null!==(a=e.writeCompletionStatus)&&void 0!==a&&a,readProgressMeasure:null===(s=e.readProgressMeasure)||void 0===s||s,writeProgressMeasure:null!==(l=e.writeProgressMeasure)&&void 0!==l&&l,readRawScore:null===(c=e.readRawScore)||void 0===c||c,writeRawScore:null!==(u=e.writeRawScore)&&void 0!==u&&u,readMinScore:null===(d=e.readMinScore)||void 0===d||d,writeMinScore:null!==(v=e.writeMinScore)&&void 0!==v&&v,readMaxScore:null===(f=e.readMaxScore)||void 0===f||f,writeMaxScore:null!==(h=e.writeMaxScore)&&void 0!==h&&h,updateAttemptData:null!==(m=e.updateAttemptData)&&void 0!==m&&m}});return new In(e.objectiveID,{description:null!==(i=e.description)&&void 0!==i?i:null,satisfiedByMeasure:null!==(n=e.satisfiedByMeasure)&&void 0!==n&&n,minNormalizedMeasure:null!==(r=e.minNormalizedMeasure)&&void 0!==r?r:null,mapInfo:o,isPrimary:t})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function tc(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ic(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){tc(e,t,i[t])})}return e}function nc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ec(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ec(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var oc=Object.defineProperty,ac=function(e,t,i){return function(e,t,i){return t in e?oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":rc(t))?t+"":t,i)},sc=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ac(this,"_globalObjectives",[]),ac(this,"context"),this.context=t}return t=e,(i=[{key:"globalObjectives",get:function(){return this._globalObjectives},set:function(objectives){this._globalObjectives=objectives}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"syncGlobalObjectiveIdsFromSequencing",value:function(){if(this.context.sequencingService){var e=this.context.sequencingService.getOverallSequencingProcess();if(e){var t=e.getGlobalObjectiveMap();if(t&&0!==t.size){var i=Array.from(t.keys()),n=this.context.getSettings(),r=Array.from(new Set((n.globalObjectiveIds||[]).concat(i)));n.globalObjectiveIds=r}}}}},{key:"restoreGlobalObjectivesToCMI",value:function(){if(0!==this._globalObjectives.length)for(var e=0;this._globalObjectives.length>e;e++){var t=this._globalObjectives[e];if(t&&t.id&&!this.context.cmi.objectives.findObjectiveById(t.id)){var i=this.context.cmi.objectives.childArray.length;this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".id"),t.id),t.success_status&&"unknown"!==t.success_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".success_status"),t.success_status),t.completion_status&&"unknown"!==t.completion_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".completion_status"),t.completion_status),""!==t.score.scaled&&null!==t.score.scaled&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.scaled"),t.score.scaled),""!==t.score.raw&&null!==t.score.raw&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.raw"),t.score.raw),""!==t.score.min&&null!==t.score.min&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.min"),t.score.min),""!==t.score.max&&null!==t.score.max&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.max"),t.score.max),""!==t.progress_measure&&null!==t.progress_measure&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".progress_measure"),t.progress_measure),""!==t.description&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".description"),t.description)}}}},{key:"updateGlobalObjectiveFromCMI",value:function(e,t){var i,n,r,o;if(e&&this.context.sequencingService){var a=this.context.sequencingService.getOverallSequencingProcess();if(a)if(a.getGlobalObjectiveMap().has(e)){var s={};t.success_status&&t.success_status!==_e&&(s.satisfiedStatus=t.success_status===ge,s.satisfiedStatusKnown=!0);var l=this.parseObjectiveNumber(null===(i=t.score)||void 0===i?void 0:i.scaled);null!==l&&(s.normalizedMeasure=l,s.normalizedMeasureKnown=!0),void 0!==(null===(n=t.score)||void 0===n?void 0:n.raw)&&""!==t.score.raw&&(s.rawScore=t.score.raw,s.rawScoreKnown=!0),void 0!==(null===(r=t.score)||void 0===r?void 0:r.min)&&""!==t.score.min&&(s.minScore=t.score.min,s.minScoreKnown=!0),void 0!==(null===(o=t.score)||void 0===o?void 0:o.max)&&""!==t.score.max&&(s.maxScore=t.score.max,s.maxScoreKnown=!0);var c=this.parseObjectiveNumber(t.progress_measure);null!==c&&(s.progressMeasure=c,s.progressMeasureKnown=!0),t.completion_status&&t.completion_status!==Ce&&(s.completionStatus=t.completion_status,s.completionStatusKnown=!0),0!==Object.keys(s).length&&a.updateGlobalObjective(e,s)}else{var u=this.buildObjectiveMapEntryFromCMI(t);a.updateGlobalObjective(e,u)}}}},{key:"buildObjectiveMapEntryFromCMI",value:function(e){var t,i,n,r,entry={id:e.id,satisfiedStatusKnown:!1,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasureKnown:!1,completionStatusKnown:!1,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!0,writeRawScore:!0,readMinScore:!0,writeMinScore:!0,readMaxScore:!0,writeMaxScore:!0};e.success_status&&e.success_status!==_e&&(entry.satisfiedStatus=e.success_status===ge,entry.satisfiedStatusKnown=!0);var o=this.parseObjectiveNumber(null===(t=e.score)||void 0===t?void 0:t.scaled);null!==o&&(entry.normalizedMeasure=o,entry.normalizedMeasureKnown=!0),void 0!==(null===(i=e.score)||void 0===i?void 0:i.raw)&&""!==e.score.raw&&(entry.rawScore=e.score.raw,entry.rawScoreKnown=!0),void 0!==(null===(n=e.score)||void 0===n?void 0:n.min)&&""!==e.score.min&&(entry.minScore=e.score.min,entry.minScoreKnown=!0),void 0!==(null===(r=e.score)||void 0===r?void 0:r.max)&&""!==e.score.max&&(entry.maxScore=e.score.max,entry.maxScoreKnown=!0);var a=this.parseObjectiveNumber(e.progress_measure);return null!==a&&(entry.progressMeasure=a,entry.progressMeasureKnown=!0),e.completion_status&&e.completion_status!==Ce&&(entry.completionStatus=e.completion_status,entry.completionStatusKnown=!0),entry}},{key:"buildCMIObjectivesFromMap",value:function(e){var objectives=[];if(!e||"object"!==(void 0===e?"undefined":rc(e)))return objectives;var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a,s=nc(r.value,2),l=s[0],entry=s[1];if(entry&&"object"===(void 0===entry?"undefined":rc(entry))){var c=new Ga;c.id=null!==(a=entry.id)&&void 0!==a?a:l,!0===entry.satisfiedStatusKnown&&(c.success_status=entry.satisfiedStatus?ge:be);var u,d,v,f=this.parseObjectiveNumber(entry.normalizedMeasure);!0===entry.normalizedMeasureKnown&&null!==f&&(c.score.scaled=f+""),!0===entry.rawScoreKnown&&(c.score.raw=(null!==(u=entry.rawScore)&&void 0!==u?u:"")+""),!0===entry.minScoreKnown&&(c.score.min=(null!==(d=entry.minScore)&&void 0!==d?d:"")+""),!0===entry.maxScoreKnown&&(c.score.max=(null!==(v=entry.maxScore)&&void 0!==v?v:"")+"");var h=this.parseObjectiveNumber(entry.progressMeasure);!0===entry.progressMeasureKnown&&null!==h&&(c.progress_measure=h+""),!0===entry.completionStatusKnown&&"string"==typeof entry.completionStatus&&(c.completion_status=entry.completionStatus),objectives.push(c)}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return objectives}},{key:"buildCMIObjectiveFromJSON",value:function(e){var t=new Ga;if(!e||"object"!==(void 0===e?"undefined":rc(e)))return t;"string"==typeof e.id&&(t.id=e.id),"string"==typeof e.success_status&&(t.success_status=e.success_status),"string"==typeof e.completion_status&&(t.completion_status=e.completion_status),"string"==typeof e.progress_measure&&""!==e.progress_measure&&(t.progress_measure=e.progress_measure),"string"==typeof e.description&&(t.description=e.description);var score=e.score;return score&&"object"===(void 0===score?"undefined":rc(score))&&("string"==typeof score.scaled&&""!==score.scaled?t.score.scaled=score.scaled:"number"==typeof score.scaled&&Number.isFinite(score.scaled)&&(t.score.scaled=score.scaled+""),"string"==typeof score.raw&&""!==score.raw?t.score.raw=score.raw:"number"==typeof score.raw&&Number.isFinite(score.raw)&&(t.score.raw=score.raw+""),"string"==typeof score.min&&""!==score.min?t.score.min=score.min:"number"==typeof score.min&&Number.isFinite(score.min)&&(t.score.min=score.min+""),"string"==typeof score.max&&""!==score.max?t.score.max=score.max:"number"==typeof score.max&&Number.isFinite(score.max)&&(t.score.max=score.max+"")),t}},{key:"captureGlobalObjectiveSnapshot",value:function(e){var t,i,n={},r=null!==(t=null!=e?e:null===(i=this.context.sequencingService)||void 0===i?void 0:i.getOverallSequencingProcess())&&void 0!==t?t:null;if(r){var o=r.getGlobalObjectiveMapSnapshot(),a=!0,s=!1,l=void 0;try{for(var c,u=Object.entries(o)[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=nc(c.value,2);n[d[0]]=ic({},d[1])}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}var v=!0,f=!1,h=void 0;try{for(var m,p=this._globalObjectives[Symbol.iterator]();!(v=(m=p.next()).done);v=!0){var y=m.value;y.id&&!n[y.id]&&(n[y.id]=this.buildObjectiveMapEntryFromCMI(y))}}catch(e){f=!0,h=e}finally{try{v||null==p.return||p.return()}finally{if(f)throw h}}return n}},{key:"parseObjectiveNumber",value:function(e){if(null==e)return null;if("number"==typeof e&&Number.isFinite(e))return e;var t=parseFloat(e+"");return Number.isFinite(t)?t:null}},{key:"syncCmiToSequencingActivity",value:function(e,t,i){if(this.context.sequencing){var n=this.context.sequencing.getCurrentActivity();if(n&&n.primaryObjective){var r=n.primaryObjective;t!==_e&&(r.satisfiedStatus=t===ge,r.satisfiedStatusKnown=!0,r.measureStatus=!0,n.objectiveMeasureStatus=!0,n.objectiveSatisfiedStatus=t===ge,n.objectiveSatisfiedStatusKnown=!0),e!==Ce&&(r.completionStatus=e),void 0!==(null==i?void 0:i.scaled)&&null!==i.scaled&&(r.normalizedMeasure=i.scaled,r.measureStatus=!0),void 0!==(null==i?void 0:i.raw)&&null!==i.raw&&(r.rawScore=i.raw+""),void 0!==(null==i?void 0:i.min)&&null!==i.min&&(r.minScore=i.min+""),void 0!==(null==i?void 0:i.max)&&null!==i.max&&(r.maxScore=i.max+"")}}}},{key:"findOrCreateGlobalObjective",value:function(e){var t=this._globalObjectives.findIndex(function(t){return t.id===e});if(-1===t){t=this._globalObjectives.length;var i=new Ga;i.id=e,this._globalObjectives.push(i)}return{index:t,objective:this._globalObjectives[t]}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function lc(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function cc(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){lc(o,n,r,a,s,"next",e)}function s(e){lc(o,n,r,a,s,"throw",e)}a(void 0)})}}function uc(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function dc(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function vc(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){uc(e,t,i[t])})}return e}function fc(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function hc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var mc=Object.defineProperty,pc=function(e,t,i){return function(e,t,i){return t in e?mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":hc(t))?t+"":t,i)},yc=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),pc(this,"context"),pc(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i}return t=e,(i=[{key:"saveSequencingState",value:function(e){return cc(function(){var t,i,n,r,o,a,s;return fc(this,function(l){switch(l.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("saveSequencingState","No persistence configuration provided",Oe.WARN),[2,!1];l.label=1;case 1:if(l.trys.push([1,3,,4]),i=this.serializeSequencingState(),n=vc({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,lastUpdated:(new Date).toISOString(),version:t.sequencingStatePersistence.stateVersion||"1.0"},e),o=i,!1!==(r=t.sequencingStatePersistence).compress&&(o=this.compressStateData(i)),r.maxStateSize&&o.length>r.maxStateSize)throw Error("State size ".concat(o.length," exceeds limit ").concat(r.maxStateSize));return[4,r.persistence.saveState(o,n)];case 2:return a=l.sent(),r.debugPersistence&&this.context.apiLog("saveSequencingState","State save ".concat(a?"succeeded":"failed",": size=").concat(o.length),a?Oe.INFO:Oe.WARN),[2,a];case 3:return s=l.sent(),this.context.apiLog("saveSequencingState","Error saving sequencing state: ".concat(dc(s,Error)?s.message:s+""),Oe.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"loadSequencingState",value:function(e){return cc(function(){var t,i,n,r,o,a,s;return fc(this,function(l){switch(l.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("loadSequencingState","No persistence configuration provided",Oe.WARN),[2,!1];l.label=1;case 1:return l.trys.push([1,3,,4]),i=vc({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,version:t.sequencingStatePersistence.stateVersion||"1.0"},e),[4,(n=t.sequencingStatePersistence).persistence.loadState(i)];case 2:return(r=l.sent())?(o=r,!1!==n.compress&&(o=this.decompressStateData(r)),a=this.deserializeSequencingState(o),n.debugPersistence&&this.context.apiLog("loadSequencingState","State load ".concat(a?"succeeded":"failed",": size=").concat(r.length),a?Oe.INFO:Oe.WARN),[2,a]):(n.debugPersistence&&this.context.apiLog("loadSequencingState","No sequencing state found to load",Oe.INFO),[2,!1]);case 3:return s=l.sent(),this.context.apiLog("loadSequencingState","Error loading sequencing state: ".concat(dc(s,Error)?s.message:s+""),Oe.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"serializeSequencingState",value:function(){var e,t={version:(null===(e=this.context.getSettings().sequencingStatePersistence)||void 0===e?void 0:e.stateVersion)||"1.0",timestamp:(new Date).toISOString(),sequencing:null,currentActivityId:null,globalObjectives:this.globalObjectiveManager.globalObjectives.map(function(e){return e.toJSON()}),globalObjectiveMap:{},adlNavState:{request:this.context.adl.nav.request,request_valid:this.context.adl.nav.request_valid},contentDelivered:!1};if(this.context.sequencingService){var i=this.context.sequencingService.getOverallSequencingProcess();if(i){var n=i.getSequencingState();t.sequencing=n,t.contentDelivered=i.hasContentBeenDelivered(),t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot(i)}var r=this.context.sequencing.getCurrentActivity();r&&(t.currentActivityId=r.id)}return t.globalObjectiveMap&&0!==Object.keys(t.globalObjectiveMap).length||(t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot()),JSON.stringify(t)}},{key:"deserializeSequencingState",value:function(e){var t=this;try{var i,n=JSON.parse(e),r=(null===(i=this.context.getSettings().sequencingStatePersistence)||void 0===i?void 0:i.stateVersion)||"1.0";if(n.version!==r&&this.context.apiLog("deserializeSequencingState","State version mismatch: ".concat(n.version," vs expected ").concat(r),Oe.WARN),n.globalObjectiveMap&&n.sequencing&&!n.sequencing.globalObjectiveMap&&(n.sequencing.globalObjectiveMap=n.globalObjectiveMap),n.sequencing&&this.context.sequencingService){var o=this.context.sequencingService.getOverallSequencingProcess();o&&(o.restoreSequencingState(n.sequencing),n.contentDelivered&&o.setContentDelivered(!0))}var a=new Map;if(Array.isArray(n.globalObjectives)){var s=!0,l=!1,c=void 0;try{for(var u,d=n.globalObjectives[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var v=this.globalObjectiveManager.buildCMIObjectiveFromJSON(u.value);v.id&&a.set(v.id,v)}}catch(e){l=!0,c=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw c}}}if(n.globalObjectiveMap&&"object"===hc(n.globalObjectiveMap)){var f=this.globalObjectiveManager.buildCMIObjectivesFromMap(n.globalObjectiveMap),h=!0,m=!1,p=void 0;try{for(var y,g=f[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=y.value;b.id&&(a.has(b.id)||a.set(b.id,b))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}return a.size>0&&(this.globalObjectiveManager.globalObjectives=Array.from(a.values()),this.globalObjectiveManager.globalObjectives.forEach(function(e){e.id&&t.globalObjectiveManager.updateGlobalObjectiveFromCMI(e.id,e)})),n.adlNavState&&(this.context.adl.nav.request=n.adlNavState.request||"_none_",this.context.adl.nav.request_valid=n.adlNavState.request_valid||{}),!0}catch(e){return this.context.apiLog("deserializeSequencingState","Error deserializing sequencing state: ".concat(dc(e,Error)?e.message:e+""),Oe.ERROR),!1}}},{key:"compressStateData",value:function(e){return"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function gc(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var bc=Object.defineProperty,_c=function(e,t,i){return function(e,t,i){return t in e?bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Sc=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_c(this,"context"),_c(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i||null}return t=e,i=[{key:"setGlobalObjectiveManager",value:function(e){this.globalObjectiveManager=e}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.context.renderCMIToJSONObject();e||t?i.cmi.total_time=this.context.cmi.getCurrentTotalTime():delete i.cmi.total_time;var n=d(i);switch(this.context.getSettings().dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return gc(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gc(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.renderCommitCMI(e,n),o=e||n?this.context.cmi.getCurrentTotalTime():"",a=c(o,Ne),s=Ce,l=_e;this.context.cmi.completion_status&&("completed"===this.context.cmi.completion_status?s=Se:"incomplete"===this.context.cmi.completion_status&&(s=we)),this.context.cmi.success_status&&("passed"===this.context.cmi.success_status?l=ge:"failed"===this.context.cmi.success_status&&(l=be));var u=(null===(i=this.context.cmi)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},d={completionStatus:s,successStatus:l,totalTimeSeconds:a,runtimeData:r};u&&(d.score=u);var v=this.context.getSettings();if(v.autoPopulateCommitMetadata){var f,h;v.courseId&&(d.courseId=v.courseId),v.scoId&&(d.scoId=v.scoId),this.context.cmi.learner_id&&(d.learnerId=this.context.cmi.learner_id),this.context.cmi.learner_name&&(d.learnerName=this.context.cmi.learner_name);var m=null===(f=this.context.sequencingService)||void 0===f?void 0:f.getSequencingState();(null==m||null===(h=m.currentActivity)||void 0===h?void 0:h.id)&&(d.activityId=m.currentActivity.id)}return this.globalObjectiveManager&&this.globalObjectiveManager.syncCmiToSequencingActivity(s,l,u),d}},{key:"determineEntryValue",value:function(e,t){var i=null==e?void 0:e.trim();return""===e||null==e||""===i?"ab-initio":"suspend"===e?"resume":"logout"===e||"normal"===e?"":"time-out"===e&&t?"resume":""}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function wc(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Cc(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Oc(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Cc(o,n,r,a,s,"next",e)}function s(e){Cc(o,n,r,a,s,"throw",e)}a(void 0)})}}function Ac(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ec(e){return Ec=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ec(e)}function kc(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function jc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(jc=function(){return!!result})()}function Rc(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Ac(e,t,i[t])})}return e}function Mc(e,t){return Mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Mc(e,t)}function Tc(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function xc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ic=Object.defineProperty,Pc=function(e,t,i){return function(e,t,i){return t in e?Ic(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":xc(t))?t+"":t,i)},Nc=new Set(["cmi.suspend_data","cmi.location","cmi.scaled_passing_score","cmi.max_time_allowed","cmi.completion_threshold","cmi.progress_measure","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.objectives.N.score.scaled","cmi.objectives.N.score.raw","cmi.objectives.N.score.min","cmi.objectives.N.score.max","cmi.objectives.N.progress_measure","cmi.objectives.N.description","cmi.interactions.N.weighting","cmi.interactions.N.type","cmi.interactions.N.timestamp","cmi.interactions.N.result","cmi.interactions.N.latency","cmi.interactions.N.learner_response","cmi.interactions.N.description","cmi.comments_from_learner.N.timestamp"]),Scorm2004API=function(e){function Scorm2004API(e,t){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scorm2004API);var n=e?Rc({},e):void 0;n&&void 0===n.mastery_override&&(n.mastery_override=!1),i=function(e,t,i){return t=Ec(t),n=e,!(r=jc()?Reflect.construct(t,i||[],Ec(e).constructor):t.apply(e,i))||"object"!==xc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,Scorm2004API,[se,n,t]),Pc(i,"_version","1.0"),Pc(i,"_sequencing"),Pc(i,"_sequencingService",null),Pc(i,"_extractedScoItemIds",[]),Pc(i,"_sequencingCollections",{}),Pc(i,"_responseValidator"),Pc(i,"_cmiHandler"),Pc(i,"_activityTreeBuilder"),Pc(i,"_sequencingConfigBuilder"),Pc(i,"_globalObjectiveManager"),Pc(i,"_statePersistence",null),Pc(i,"_dataSerializer"),Pc(i,"cmi"),Pc(i,"adl"),Pc(i,"Initialize"),Pc(i,"Terminate"),Pc(i,"GetValue"),Pc(i,"SetValue"),Pc(i,"Commit"),Pc(i,"GetLastError"),Pc(i,"GetErrorString"),Pc(i,"GetDiagnostic"),i.cmi=new Ws,i.adl=new ll,i._sequencing=new ql,i.adl.sequencing=i._sequencing,i._sequencingConfigBuilder=new Wl,i._activityTreeBuilder=new Zl({},i._sequencingConfigBuilder);var r={throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode},checkCorrectResponseValue:function(e,t,n,r){return i._responseValidator.checkCorrectResponseValue(e,t,n,r)}};i._responseValidator=new Ll(r);var o={cmi:i.cmi,isInitialized:function(){return i.isInitialized()},throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode}};i._cmiHandler=new Bl(o,i._responseValidator);var a={getSettings:function(){return i.settings},cmi:i.cmi,sequencing:i._sequencing,sequencingService:i._sequencingService,commonSetCMIValue:i._commonSetCMIValue.bind(i)};i._globalObjectiveManager=new sc(a);var s={getSettings:function(){return i.settings},cmi:i.cmi,sequencingService:i._sequencingService,renderCMIToJSONObject:i.renderCMIToJSONObject.bind(i)};return i._dataSerializer=new Sc(s,i._globalObjectiveManager),(null==n?void 0:n.sequencing)&&i.configureSequencing(n.sequencing),i.initializeSequencingService(n),i.Initialize=i.lmsInitialize,i.Terminate=i.lmsFinish,i.GetValue=i.lmsGetValue,i.SetValue=i.lmsSetValue,i.Commit=i.lmsCommit,i.GetLastError=i.lmsGetLastError,i.GetErrorString=i.lmsGetErrorString,i.GetDiagnostic=i.lmsGetDiagnostic,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mc(e,t)}(Scorm2004API,e),t=Scorm2004API,i=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),this.applyCurrentActivityLaunchData(),null===(i=this.adl)||void 0===i||i.reset()}},{key:"applyCurrentActivityLaunchData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();t&&this.applyActivityLaunchData(t)}},{key:"applyDeliveredActivityLaunchData",value:function(e){this.isNotInitialized()&&this.applyActivityLaunchData(e)}},{key:"applyActivityLaunchData",value:function(e){var t,i,n,r;if(this.cmi){var o=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getContentActivityData(e),a=null!==(t=null!==(i=null==o?void 0:o.completionThreshold)&&void 0!==i?i:null===(r=e.completionThreshold)||void 0===r?void 0:""+r)&&void 0!==t?t:"";this.cmi.completion_threshold=a,this.seedCurrentActivityObjectives(e)}}},{key:"applyCurrentActivityObjectiveData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();this.cmi&&t&&this.seedCurrentActivityObjectives(t)}},{key:"seedCurrentActivityObjectives",value:function(e){var t,i,n=[];e.primaryObjective&&n.push(e.primaryObjective),(t=n).push.apply(t,function(e){if(Array.isArray(e))return wc(e)}(i=e.objectives)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return wc(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?wc(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var r=new Set,o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=this.getSeedableObjectiveId(u);if(d&&!r.has(d)){r.add(d);var v=this.findOrSeedCMIObjective(d);if(null!==v){var f=this.cmi.objectives.findObjectiveByIndex(v);f&&this.cmi.objectives.initialized&&!f.initialized&&f.initialize();var h=this.getActivityObjectiveSuccessStatus(u);h&&this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(v,".success_status"),h),this.seedObjectiveReadMapValues(e,u,v)}}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}},{key:"seedObjectiveReadMapValues",value:function(e,t,i){var n,r=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getGlobalObjectiveMap();if(r&&0!==t.mapInfo.length){var o=!0,a=!1,s=void 0;try{for(var l,c=t.mapInfo[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=r.get(u.targetObjectiveID||t.id);if(d){var v=tr.getGlobalObjectiveReadState(e,t,u,d);this.applyObjectiveReadStateToCMI(i,v)}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}}},{key:"applyObjectiveReadStateToCMI",value:function(e,t){void 0!==t.satisfiedStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".success_status"),t.satisfiedStatus?ge:be),void 0!==t.normalizedMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.scaled"),t.normalizedMeasure+""),void 0!==t.completionStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".completion_status"),t.completionStatus),void 0!==t.progressMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".progress_measure"),t.progressMeasure+""),void 0!==t.rawScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.raw"),t.rawScore),void 0!==t.minScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.min"),t.minScore),void 0!==t.maxScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.max"),t.maxScore)}},{key:"getSeedableObjectiveId",value:function(e){var t=e.id;return"string"!=typeof t||""===t.trim()?null:t}},{key:"findOrSeedCMIObjective",value:function(e){var t=this.cmi.objectives.childArray.findIndex(function(t){return t.id===e});if(t>=0)return t;var i=this.cmi.objectives.childArray.length;return this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(i,".id"),e)===z?i:null}},{key:"getActivityObjectiveSuccessStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown?e.satisfiedStatus?ge:be:null}},{key:"version",get:function(){return this._version}},{key:"globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives}},{key:"_globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives},set:function(objectives){this._globalObjectiveManager.globalObjectives=objectives}},{key:"compressStateData",value:function(e){return this._statePersistence?this._statePersistence.compressStateData(e):"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if(this._statePersistence)return this._statePersistence.decompressStateData(e);if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}},{key:"lmsInitialize",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;this.cmi.initialize();var result=this.initialize("Initialize","LMS was already initialized!","LMS is already finished!");return result===z&&this._sequencingService&&(this._sequencingService.initialize(),this.applyCurrentActivityObjectiveData()),result===z&&this._globalObjectiveManager.restoreGlobalObjectivesToCMI(),result===z&&this.settings.sequencingStatePersistence&&this.loadSequencingState().catch(function(){e.apiLog("lmsInitialize","Failed to auto-load sequencing state",Oe.WARN)}),result}},{key:"lmsFinish",value:function(){var e,t,i,n,r;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;var o=(null===(i=this.adl)||void 0===i||null===(t=i.nav)||void 0===t?void 0:t.request)||"_none_",a=(null===(n=this.cmi)||void 0===n?void 0:n.getExitValueInternal())||"",s=this.isTerminated(),l=null!==(e=null===(r=this._sequencingService)||void 0===r?void 0:r.isDeliveryInProgress())&&void 0!==e&&e,result=this.terminate("Terminate",!0);if(result===z&&!s&&!l){var c=!1,u=null,d=o,v="",f=RegExp(Be);if("_none_"!==o){var h,m,p,y=o.match(f);if(y)if(null===(h=y.groups)||void 0===h?void 0:h.choice_target)v=null===(p=y.groups)||void 0===p?void 0:p.choice_target,d="choice";else if(null===(m=y.groups)||void 0===m?void 0:m.jump_target){var g;v=null===(g=y.groups)||void 0===g?void 0:g.jump_target,d="jump"}}if(this._sequencingService)try{var b,_=null;"_none_"!==d?(_=d,b=v||void 0):this._sequencing.getCurrentActivity()&&(_="exit"),_&&(c=this._sequencingService.processNavigationRequest(_,b,a),u=_)}catch(e){this.apiLog("lmsFinish","Sequencing navigation failed, falling back to event-based navigation: ".concat(e),Oe.WARN),c=!1}if(!c)if("_none_"!==o){var S={continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll"}[d];S&&this.processListeners(S,"adl.nav.request",v)}else this.settings.autoProgress&&this.processListeners("SequenceNext",void 0,"next");this._sequencingService&&u&&["exitAll","abandonAll","suspendAll"].includes(u)&&this._sequencingService.terminate(),this.adl.nav.request="_none_"}return result}},{key:"lmsGetValue",value:function(e){if(this.isTerminated())return this.lastErrorCode=se.RETRIEVE_AFTER_TERM+"","";if(!this.isInitialized())return this.lastErrorCode=se.RETRIEVE_BEFORE_INIT+"","";if("adl.nav.request"===e)return this.throwSCORMError(e,se.WRITE_ONLY_ELEMENT,"adl.nav.request is write-only"),"";var t="^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=([a-zA-Z0-9-_]+)}$";if(v(e,t)){var i=e.match(t);if(i){var n,request=i[1],r=(null===(n=i[2])||void 0===n?void 0:n.replace(/{target=/g,"").replace(/}/g,""))||"";if("choice"===request||"jump"===request){var o,a,s,l=null===(o=this._sequencing)||void 0===o?void 0:o.overallSequencingProcess;return this.settings.scoItemIdValidator?this.settings.scoItemIdValidator(r)+"":(null==l?void 0:l.predictChoiceEnabled)&&"choice"===request?l.predictChoiceEnabled(r)?"true":"false":(null==l?void 0:l.predictJumpEnabled)&&"jump"===request?l.predictJumpEnabled(r)?"true":"false":this._extractedScoItemIds.length>0?this._extractedScoItemIds.includes(r)+"":(null===(s=this.settings)||void 0===s||null===(a=s.scoItemIds)||void 0===a?void 0:a.includes(r))+""}}}return"cmi.completion_status"===e?this._cmiHandler.evaluateCompletionStatus():"cmi.success_status"===e?this._cmiHandler.evaluateSuccessStatus():this.getValue("GetValue",!0,e)}},{key:"lmsSetValue",value:function(e,t){var i,n=this,r=this._peekCMIValue(e),result=this.setValue("SetValue","Commit",!0,e,t);if(result===z&&this._sequencingService)try{this._sequencingService.triggerRollupOnCMIChange(e,r,t)}catch(t){console.warn("Sequencing rollup failed for ".concat(e,": ").concat(t))}return result===z&&"setValue"===(null===(i=this.settings.sequencingStatePersistence)||void 0===i?void 0:i.autoSaveOn)&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.objectives","adl.nav.request"].some(function(t){return e.startsWith(t)})&&this.saveSequencingState().catch(function(){n.apiLog("lmsSetValue","Failed to auto-save sequencing state",Oe.WARN)}),result}},{key:"lmsCommit",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;if(this.settings.throttleCommits)return this.scheduleCommit(500,"Commit"),z;var t,result=this.commit("Commit",!0);return result===z&&"commit"===(null===(t=this.settings.sequencingStatePersistence)||void 0===t?void 0:t.autoSaveOn)&&this.saveSequencingState().catch(function(){e.apiLog("lmsCommit","Failed to auto-save sequencing state",Oe.WARN)}),result}},{key:"lmsGetLastError",value:function(){return this.getLastError("GetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("GetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("GetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){if(v(e,"cmi\\.objectives\\.\\d+")){var i,n,r=+e.split(".")[2],o="cmi.objectives.".concat(r);if(v(e,"cmi\\.objectives\\.\\d+\\.id"))n=t;else{var a=this.cmi.objectives.findObjectiveByIndex(r);n=a?a.id:void 0}if(n&&(null===(i=this.settings.globalObjectiveIds)||void 0===i?void 0:i.includes(n))&&this.currentActivityAllowsGlobalObjectiveWrites()){var s=this._globalObjectiveManager.findOrCreateGlobalObjective(n).index,l=e.replace(o,"_globalObjectives.".concat(s));this._commonSetCMIValue("SetGlobalObjectiveValue",!0,l,t);var c=this._globalObjectiveManager.globalObjectives[s];n&&c&&this._globalObjectiveManager.updateGlobalObjectiveFromCMI(n,c)}}return this._commonSetCMIValue("SetValue",!0,e,t)}},{key:"currentActivityAllowsGlobalObjectiveWrites",value:function(){var e,t;return!1!==(null===(t=this._sequencing)||void 0===t||null===(e=t.getCurrentActivity())||void 0===e?void 0:e.sequencingControls.tracked)}},{key:"getChildElement",value:function(e,t,i){return this._cmiHandler.getChildElement(e,t,i)}},{key:"validateCorrectResponse",value:function(e,t){var i=e.split("."),n=this.cmi.interactions.childArray[+i[2]];n?this._responseValidator.validateCorrectResponse(e,n,t):this.throwSCORMError(e,se.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"_peekCMIValue",value:function(e){if(!e||"string"!=typeof e)return null;for(var t=e.split("."),i=this,n=0;t.length>n;n++){var r=t[n];if(null==i)return null;try{i=i[r]}catch(e){return null}if(kc(i,he)){var o=n+1;if(o>=t.length)return i;var a=+t[o];if(!Number.isNaN(a)&&Number.isInteger(a)&&a>=0){if(a>=i.childArray.length)return null;i=i.childArray[a],n++}}}return null!=i?i:null}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("GetValue",!0,e)}},{key:"checkUninitializedGet",value:function(e,t){var i;""===t&&(this._setCMIElements.has(e)||Nc.has(function(e){return e.replace(/\.\d+(?=\.|$)/g,".N")}(e))&&this.throwSCORMError(e,null!==(i=this._error_codes.VALUE_NOT_INITIALIZED)&&void 0!==i?i:403,"The data model element passed to GetValue (".concat(e,") has not been initialized."),this.settings.uninitializedGetLogLevel))}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i="",n="",r=B.error_descriptions[e+=""];return r&&(i=r.basicMessage,n=r.detailMessage),t?n:i}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.adl=e.adl}},{key:"renderCommitCMI",value:function(e){return this._dataSerializer.renderCommitCMI(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"renderCommitObject",value:function(e){return this._dataSerializer.renderCommitObject(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"storeData",value:function(e,t){var i,n,r,o,a;e&&"normal"===this.cmi.mode&&"credit"===this.cmi.credit&&(this.cmi.completion_threshold&&this.cmi.progress_measure&&(this.cmi.completion_status=parseFloat(this.cmi.completion_threshold)>parseFloat(this.cmi.progress_measure)?"incomplete":"completed"),this.cmi.scaled_passing_score&&this.cmi.score.scaled&&(this.cmi.success_status=parseFloat(this.cmi.scaled_passing_score)>parseFloat(this.cmi.score.scaled)?"failed":"passed"));var s=!1;this.adl.nav.request!==(null===(r=this.startingData)||void 0===r||null===(n=r.adl)||void 0===n||null===(i=n.nav)||void 0===i?void 0:i.request)&&"_none_"!==this.adl.nav.request&&(s=!0);var l=this.getCommitObject(e),c=(null===(a=this.cmi)||void 0===a||null===(o=a.score)||void 0===o?void 0:o.getScoreObject())||{},u=Ce;"completed"===this.cmi.completion_status?u=Se:"incomplete"===this.cmi.completion_status&&(u=we);var d=_e;if("passed"===this.cmi.success_status?d=ge:"failed"===this.cmi.success_status&&(d=be),this._globalObjectiveManager.syncCmiToSequencingActivity(u,d,c),"string"==typeof this.settings.lmsCommitUrl){var result=this.processHttpRequest(this.settings.lmsCommitUrl,l,e,t);if(s&&void 0!==result.navRequest&&""!==result.navRequest&&"string"==typeof result.navRequest){var v=function(e){var t=new Set(["start","resumeAll","continue","previous","choice","jump","exit","exitAll","abandon","abandonAll","suspendAll","_none_"]),i=e.trim();if(!i)return{command:"_none_",targetActivityId:null,valid:!1,error:"Empty navigation request"};if(t.has(i))return{command:i,targetActivityId:null,valid:!0};var n=i.indexOf(".");if(n>0){var r=i.substring(0,n),o=i.substring(n+1);if(("choice"===r||"jump"===r)&&o)return/^[a-zA-Z0-9._-]+$/.test(o)?{command:r,targetActivityId:o,valid:!0}:{command:"_none_",targetActivityId:null,valid:!1,error:"Invalid target activity ID: contains disallowed characters"}}return{command:"_none_",targetActivityId:null,valid:!1,error:'Unrecognized navigation command: "'.concat(i,'"')}}(result.navRequest);if(v.valid){var f={start:"SequenceStart",resumeAll:"SequenceResumeAll",continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll",suspendAll:"SequenceSuspendAll"}[v.command];f&&this.processListeners(f,"adl.nav.request",v.targetActivityId)}else this.apiLog("storeData","Invalid navigation request from LMS: ".concat(v.error),Oe.WARN)}else(null==result?void 0:result.navRequest)&&!s&&"object"===xc(result.navRequest)&&Object.hasOwnProperty.call(result.navRequest,"name")&&result.navRequest.name&&this.processListeners(result.navRequest.name,result.navRequest.data);return result}return{result:z,errorCode:0}}},{key:"configureSequencing",value:function(e){this._sequencingCollections=this._sequencingConfigBuilder.sanitizeSequencingCollections(e.collections),this._activityTreeBuilder.setSequencingCollections(this._sequencingCollections),e.activityTree&&this.configureActivityTree(e.activityTree),e.sequencingRules&&this.configureSequencingRules(e.sequencingRules),e.sequencingControls&&this.configureSequencingControls(e.sequencingControls),e.rollupRules&&this.configureRollupRules(e.rollupRules),this._sequencing.hideLmsUi=e.hideLmsUi?this._sequencingConfigBuilder.sanitizeHideLmsUi(e.hideLmsUi):[],this._sequencing.auxiliaryResources=e.auxiliaryResources?this._sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources):[]}},{key:"configureActivityTree",value:function(e){var t=this._activityTreeBuilder.createActivity(e);this._sequencing.activityTree.root=t,this._extractedScoItemIds=this._activityTreeBuilder.extractActivityIds(t)}},{key:"configureSequencingRules",value:function(e){this._sequencingConfigBuilder.applySequencingRulesSettings(this._sequencing.sequencingRules,e)}},{key:"configureSequencingControls",value:function(e){this._sequencingConfigBuilder.applySequencingControlsSettings(this._sequencing.sequencingControls,e)}},{key:"configureRollupRules",value:function(e){this._sequencingConfigBuilder.applyRollupRulesSettings(this._sequencing.rollupRules,e)}},{key:"initializeSequencingService",value:function(e){var t=this;try{var i,n,r,o,a,s,l,c,u,d,v,f={autoRollupOnCMIChange:null===(i=null==e||null===(s=e.sequencing)||void 0===s?void 0:s.autoRollupOnCMIChange)||void 0===i||i,autoProgressOnCompletion:null!==(n=null==e||null===(l=e.sequencing)||void 0===l?void 0:l.autoProgressOnCompletion)&&void 0!==n&&n,validateNavigationRequests:null===(r=null==e||null===(c=e.sequencing)||void 0===c?void 0:c.validateNavigationRequests)||void 0===r||r,enableEventSystem:null===(o=null==e||null===(u=e.sequencing)||void 0===u?void 0:u.enableEventSystem)||void 0===o||o,logLevel:null!==(a=null==e||null===(d=e.sequencing)||void 0===d?void 0:d.logLevel)&&void 0!==a?a:"info"};if(this._sequencingService=new co(this._sequencing,this.cmi,this.adl,this.eventService||this,this.loggingService,f),this._sequencingService.setEventListeners(this.buildSequencingEventListeners(null==e||null===(v=e.sequencing)||void 0===v?void 0:v.eventListeners)),this._globalObjectiveManager.updateSequencingService(this._sequencingService),this._dataSerializer.updateSequencingService(this._sequencingService),null==e?void 0:e.sequencingStatePersistence){var h={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};this._statePersistence=new yc(h,this._globalObjectiveManager)}this._globalObjectiveManager.syncGlobalObjectiveIdsFromSequencing()}catch(e){console.warn("Failed to initialize sequencing service:",e),this._sequencingService=null}}},{key:"buildSequencingEventListeners",value:function(e){var t,i,n=this;return t=Rc({},e),i=null!=(i={onActivityDelivery:function(t){var i;n.applyDeliveredActivityLaunchData(t),null==e||null===(i=e.onActivityDelivery)||void 0===i||i.call(e,t)}})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}},{key:"getSequencingService",value:function(){return this._sequencingService}},{key:"setSequencingEventListeners",value:function(e){this._sequencingService&&this._sequencingService.setEventListeners(this.buildSequencingEventListeners(e))}},{key:"updateSequencingConfiguration",value:function(e){this._sequencingService&&this._sequencingService.updateConfiguration(e)}},{key:"getSequencingState",value:function(){return this._sequencingService?this._sequencingService.getSequencingState():{isInitialized:!1,isActive:!1,currentActivity:null,rootActivity:this._sequencing.getRootActivity(),lastSequencingResult:null}}},{key:"processNavigationRequest",value:function(request,e){return!!this._sequencingService&&this._sequencingService.processNavigationRequest(request,e)}},{key:"resetSequencingState",value:function(){var e,t;null===(e=this._sequencing)||void 0===e||e.reset(),null===(t=this._sequencingService)||void 0===t||t.setEventListeners({})}},{key:"getActivityTrackingData",value:function(e){var t,i;if(!(null===(i=this._sequencing)||void 0===i?void 0:i.activityTree))return null;var n=this._sequencing.activityTree.getActivity(e);return n?{completionStatus:n.completionStatus||"unknown",successStatus:n.successStatus||"unknown",progressMeasure:null!==(t=n.progressMeasure)&&void 0!==t?t:null,score:n.objectiveMeasureStatus?n.objectiveNormalizedMeasure:null}:null}},{key:"saveSequencingState",value:function(e){return Oc(function(){var t,i;return Tc(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.saveSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new yc(i,this._globalObjectiveManager).saveSequencingState(e)]):(this.apiLog("saveSequencingState","No persistence configuration provided",Oe.WARN),[2,!1])})}).call(this)}},{key:"loadSequencingState",value:function(e){return Oc(function(){var t,i;return Tc(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.loadSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new yc(i,this._globalObjectiveManager).loadSequencingState(e)]):(this.apiLog("loadSequencingState","No persistence configuration provided",Oe.WARN),[2,!1])})}).call(this)}},{key:"serializeSequencingState",value:function(){var e=this;if(this._statePersistence)return this._statePersistence.serializeSequencingState();var t={getSettings:function(){return e.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new yc(t,this._globalObjectiveManager).serializeSequencingState()}},{key:"deserializeSequencingState",value:function(e){var t=this;if(this._statePersistence)return this._statePersistence.deserializeSequencingState(e);var i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new yc(i,this._globalObjectiveManager).deserializeSequencingState(e)}},{key:"determineEntryValue",value:function(e,t){return this._dataSerializer.determineEntryValue(e,t)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),Scorm2004API;var t,i}(Mo);return Scorm2004API}();
|
|
2
2
|
//# sourceMappingURL=scorm2004.min.js.map
|