// version: 7.12.0.a.1.6.7
// sha: 04d5c62096c01fb7b57fefc794eec50087e604a5
/*! Copyright © 2003-2018 Rustici Software, LLC  All Rights Reserved. www.rusticisoftware.com */
var VERSION="7.12.0.a.1.6.7",PREFERENCE_DEFAULT=0,PREFERENCE_OFF=-1,PREFERENCE_ON=1,LESSON_STATUS_PASSED=1,LESSON_STATUS_COMPLETED=2,LESSON_STATUS_FAILED=3,LESSON_STATUS_INCOMPLETE=4,LESSON_STATUS_BROWSED=5,LESSON_STATUS_NOT_ATTEMPTED=6,ENTRY_REVIEW=1,ENTRY_FIRST_TIME=2,ENTRY_RESUME=3,MODE_NORMAL=1,MODE_BROWSE=2,MODE_REVIEW=3,MAX_CMI_TIME=36002439990,NO_ERROR=0,ERROR_LMS=1,ERROR_INVALID_PREFERENCE=2,ERROR_INVALID_NUMBER=3,ERROR_INVALID_ID=4,ERROR_INVALID_STATUS=5,ERROR_INVALID_RESPONSE=6,ERROR_NOT_LOADED=7,ERROR_INVALID_INTERACTION_RESPONSE=8,EXIT_TYPE_SUSPEND="SUSPEND",EXIT_TYPE_FINISH="FINISH",EXIT_TYPE_TIMEOUT="TIMEOUT",EXIT_TYPE_UNLOAD="UNLOAD",INTERACTION_RESULT_CORRECT="CORRECT",INTERACTION_RESULT_WRONG="WRONG",INTERACTION_RESULT_UNANTICIPATED="UNANTICIPATED",INTERACTION_RESULT_NEUTRAL="NEUTRAL",INTERACTION_TYPE_TRUE_FALSE="true-false",INTERACTION_TYPE_CHOICE="choice",INTERACTION_TYPE_FILL_IN="fill-in",INTERACTION_TYPE_LONG_FILL_IN="long-fill-in",INTERACTION_TYPE_MATCHING="matching",INTERACTION_TYPE_PERFORMANCE="performance",INTERACTION_TYPE_SEQUENCING="sequencing",INTERACTION_TYPE_LIKERT="likert",INTERACTION_TYPE_NUMERIC="numeric",DATA_CHUNK_PAIR_SEPARATOR="###",DATA_CHUNK_VALUE_SEPARATOR="$$",APPID="__APPID__",CLOUDURL="__CLOUDURL__",blnDebug=!0,strLMSStandard="AUTO",DEFAULT_EXIT_TYPE=EXIT_TYPE_SUSPEND,AICC_LESSON_ID="1",EXIT_BEHAVIOR="SCORM_RECOMMENDED",EXIT_TARGET="goodbye.html",AICC_COMM_DISABLE_XMLHTTP=!1,AICC_COMM_DISABLE_IFRAME=!1,AICC_COMM_PREPEND_HTTP_IF_MISSING=!0,AICC_REPORT_MIN_MAX_SCORE=!0,SHOW_DEBUG_ON_LAUNCH=!1,DO_NOT_REPORT_INTERACTIONS=!1,SCORE_CAN_ONLY_IMPROVE=!1,REVIEW_MODE_IS_READ_ONLY=!0,TCAPI_DONT_USE_BROKEN_URN_IDS=!0,TCAPI_LRS_ENDPOINT="",TCAPI_LRS_KEY="",TCAPI_LRS_SECRET="",TCAPI_LRS_ACTOR="",AICC_RE_CHECK_LOADED_INTERVAL=250,AICC_RE_CHECK_ATTEMPTS_BEFORE_TIMEOUT=240,USE_AICC_KILL_TIME=!0,AICC_ENTRY_FLAG_DEFAULT=ENTRY_REVIEW,AICC_USE_CUSTOM_COMMS=!1,FORCED_COMMIT_TIME="0",ALLOW_NONE_STANDARD=!0,USE_2004_SUSPENDALL_NAVREQ=!1,USE_STRICT_SUSPEND_DATA_LIMITS=!0,EXIT_SUSPEND_IF_COMPLETED=!1,EXIT_NORMAL_IF_PASSED=!1,AICC_ENCODE_PARAMETER_VALUES=!0,PASS_FAIL_SETS_COMPLETION_FOR_2004=!0,ALLOW_INTERACTION_NULL_LEARNER_RESPONSE=!1,PREVENT_STATUS_CHANGE_DURING_INIT=!1,USE_LEGACY_IDENTIFIERS_FOR_2004=!1,URI_IDENTIFIER_PREFIX="urn:scormdriver:",noop=Function.prototype;function GetQueryStringValue(e,t){var r;return null===(r=SearchQueryStringPairs((t=t.substring(1)).split("&"),e))&&(r=SearchQueryStringPairs(t.split(/[\?\&]/),e)),null===r?(WriteToDebug("GetQueryStringValue Element '"+e+"' Not Found, Returning: empty string"),""):(WriteToDebug("GetQueryStringValue for '"+e+"' Returning: "+r),r)}function SearchQueryStringPairs(e,t){var r,n,i="";for(t=t.toLowerCase(),r=0;r<e.length;r++)if(-1!=(n=e[r].indexOf("="))&&EqualsIgnoreCase(e[r].substring(0,n),t))return i=e[r].substring(n+1),i=(i=new String(i)).replace(/\+/g,"%20"),i=unescape(i),new String(i);return null}function ConvertStringToBoolean(e){var t;return!(!EqualsIgnoreCase(e,"true")&&!EqualsIgnoreCase(e,"t")&&0!=e.toLowerCase().indexOf("t"))||(1==(t=parseInt(e,10))||-1==t)}function EqualsIgnoreCase(e,t){return e=new String(e),t=new String(t),e.toLowerCase()==t.toLowerCase()}function ValidInteger(e){WriteToDebug("In ValidInteger intNum="+e);var t=new String(e);0==t.indexOf("-",0)&&(t=t.substring(1,t.length-1));var r=new RegExp("[^0-9]");return-1==t.search(r)?(WriteToDebug("Returning true"),!0):(WriteToDebug("Returning false"),!1)}function ConvertDateToIso8601TimeStamp(e){var t,r=(e=new Date(e)).getFullYear(),n=e.getMonth()+1,i=e.getDate(),o=e.getHours(),a=e.getMinutes(),s=e.getSeconds();t=r+"-"+(n=ZeroPad(n,2))+"-"+(i=ZeroPad(i,2))+"T"+(o=ZeroPad(o,2))+":"+(a=ZeroPad(a,2))+":"+(s=ZeroPad(s,2));var u=-e.getTimezoneOffset()/60;if(0!=u)if(t+=".0",u>0)if(-1!=(""+u).indexOf(".")){var c="0"+(""+u).substr((""+u).indexOf("."),(""+u).length);t+="+"+ZeroPad((""+u).substr(0,(""+u).indexOf("."))+"."+(c*=60),2)}else t+="+"+ZeroPad(u,2);else t+=ZeroPad(u,2);return t}function ConvertIso8601TimeStampToDate(e){e=new String(e);var t=new Array,r=(t=e.split(/[\:T+-]/))[0],n=t[1]-1,i=t[2],o=t[3],a=t[4],s=t[5];return new Date(r,n,i,o,a,s,0)}function ConvertDateToCMIDate(e){var t,r,n;return WriteToDebug("In ConvertDateToCMIDate"),t=(e=new Date(e)).getFullYear(),r=e.getMonth()+1,n=e.getDate(),ZeroPad(t,4)+"/"+ZeroPad(r,2)+"/"+ZeroPad(n,2)}function ConvertDateToCMITime(e){var t,r,n;return t=(e=new Date(e)).getHours(),r=e.getMinutes(),n=e.getSeconds(),ZeroPad(t,2)+":"+ZeroPad(r,2)+":"+ZeroPad(n,2)}function ConvertCMITimeSpanToMS(e){var t,r,n,i,o;return WriteToDebug("In ConvertCMITimeSpanToMS, strTime="+e),t=e.split(":"),IsValidCMITimeSpan(e)?(WriteToDebug("intHours="+(r=t[0])+" intMinutes="+(n=t[1])+" intSeconds="+(i=t[2])),o=36e5*r+6e4*n+1e3*i,WriteToDebug("Returning "+(o=Math.round(o))),o):(WriteToDebug("ERROR - Invalid TimeSpan"),SetErrorInfo(SCORM_ERROR_GENERAL,"LMS ERROR - Invalid time span passed to ConvertCMITimeSpanToMS, please contact technical support"),0)}function ConvertScorm2004TimeToMS(e){WriteToDebug("In ConvertScorm2004TimeToMS, strIso8601Time="+e);var t,r,n,i=0,o=0,a=0,s=0,u=0,c=0,l=0,C=36e5,I=864e5,_=26298e5;e=new String(e),t="",r="",n=!1;for(var S=1;S<e.length;S++)if(IsIso8601SectionDelimiter(r=e.charAt(S))){switch(r.toUpperCase()){case"Y":l=parseInt(t,10);break;case"M":n?a=parseInt(t,10):c=parseInt(t,10);break;case"D":u=parseInt(t,10);break;case"H":s=parseInt(t,10);break;case"S":o=parseFloat(t);break;case"T":n=!0}t=""}else t+=""+r;return WriteToDebug("Years="+l+"\nMonths="+c+"\nDays="+u+"\nHours="+s+"\nMinutes="+a+"\nSeconds="+o+"\n"),i=315576e5*l+c*_+u*I+s*C+6e4*a+1e3*o,WriteToDebug("returning-"+(i=Math.round(i))),i}function IsIso8601SectionDelimiter(e){return e.search(/[PYMDTHS]/)>=0}function IsValidCMITimeSpan(e){WriteToDebug("In IsValidCMITimeSpan strValue="+e);return e.search(/^\d?\d?\d?\d:\d?\d:\d?\d(.\d\d?)?$/)>-1?(WriteToDebug("Returning True"),!0):(WriteToDebug("Returning False"),!1)}function IsValidIso8601TimeSpan(e){WriteToDebug("In IsValidIso8601TimeSpan strValue="+e);return e.search(/^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(.\d\d?)?S)?)?$/)>-1?(WriteToDebug("Returning True"),!0):(WriteToDebug("Returning False"),!1)}function ConvertMilliSecondsToTCAPITime(e,t){var r,n,i,o,a,s;return WriteToDebug("In ConvertMilliSecondsToTCAPITime, intTotalMilliseconds = "+e+", blnIncludeFraction = "+t),null!=t&&null!=t||(t=!0),WriteToDebug("Separated Parts, intHours="+(r=(e-(o=e%1e3)-1e3*(i=(e-o)/1e3%60)-6e4*(n=(e-o-1e3*i)/6e4%60))/36e5)+", intMinutes="+n+", intSeconds="+i+", intMilliseconds="+o),1e4==r&&(WriteToDebug("Max intHours detected"),100==(n=(e-36e5*(r=9999))/6e4)&&(n=99),100==(i=(e-36e5*r-6e4*(n=Math.floor(n)))/1e3)&&(i=99),WriteToDebug("Separated Parts, intHours="+r+", intMinutes="+n+", intSeconds="+(i=Math.floor(i))+", intMilliseconds="+(o=e-36e5*r-6e4*n-1e3*i))),a=Math.floor(o/10),s=ZeroPad(r,4)+":"+ZeroPad(n,2)+":"+ZeroPad(i,2),t&&(s+="."+a),WriteToDebug("strCMITimeSpan="+s),r>9999&&(s="9999:99:99",t&&(s+=".99")),WriteToDebug("returning "+s),s}function ConvertMilliSecondsToSCORMTime(e,t){var r,n,i,o,a,s;return WriteToDebug("In ConvertMilliSecondsToSCORMTime, intTotalMilliseconds = "+e+", blnIncludeFraction = "+t),null!=t&&null!=t||(t=!0),WriteToDebug("Separated Parts, intHours="+(r=(e-(o=e%1e3)-1e3*(i=(e-o)/1e3%60)-6e4*(n=(e-o-1e3*i)/6e4%60))/36e5)+", intMinutes="+n+", intSeconds="+i+", intMilliseconds="+o),1e4==r&&(WriteToDebug("Max intHours detected"),100==(n=(e-36e5*(r=9999))/6e4)&&(n=99),100==(i=(e-36e5*r-6e4*(n=Math.floor(n)))/1e3)&&(i=99),WriteToDebug("Separated Parts, intHours="+r+", intMinutes="+n+", intSeconds="+(i=Math.floor(i))+", intMilliseconds="+(o=e-36e5*r-6e4*n-1e3*i))),a=Math.floor(o/10),s=ZeroPad(r,4)+":"+ZeroPad(n,2)+":"+ZeroPad(i,2),t&&(s+="."+a),WriteToDebug("strCMITimeSpan="+s),r>9999&&(s="9999:99:99",t&&(s+=".99")),WriteToDebug("returning "+s),s}function ConvertMilliSecondsIntoSCORM2004Time(e){WriteToDebug("In ConvertMilliSecondsIntoSCORM2004Time intTotalMilliseconds="+e);var t,r,n,i,o,a,s,u="",c=6e3,l=36e4,C=864e4,I=26298e4,_=315576e4;return t=Math.floor(e/10),t-=(s=Math.floor(t/_))*_,t-=(a=Math.floor(t/I))*I,t-=(o=Math.floor(t/C))*C,t-=(i=Math.floor(t/l))*l,t-=(n=Math.floor(t/c))*c,s>0&&(u+=s+"Y"),a>0&&(u+=a+"M"),o>0&&(u+=o+"D"),(t-=100*(r=Math.floor(t/100)))+r+n+i>0&&(u+="T",i>0&&(u+=i+"H"),n>0&&(u+=n+"M"),t+r>0&&(u+=r,t>0&&(u+="."+t),u+="S")),""==u&&(u="T0S"),WriteToDebug("Returning-"+(u="P"+u)),u}function ZeroPad(e,t){var r,n,i,o;WriteToDebug("In ZeroPad intNum="+e+" intNumDigits="+t);var a=!1;if(-1!=(r=new String(e)).indexOf("-")&&(a=!0,r=r.substr(1,r.length)),-1!=r.indexOf(".")&&(r.replace(".",""),i=r.substr(r.indexOf(".")+1,r.length),r=r.substr(0,r.indexOf("."))),(n=r.length)>t)WriteToDebug("Length of string is greater than num digits, trimming string"),r=r.substr(0,t);else for(o=n;o<t;o++)r="0"+r;return 1==a&&(r="-"+r),null!=i&&""!=i&&(1==i.length?r+=":"+i+"0":r+=":"+i),WriteToDebug("Returning - "+r),r}function IsValidDecimalRange(e){WriteToDebug("In IsDecimalRange, strValue="+e);var t,r,n;return 2===(t=(e=new String(e)).split("[:]")).length?(r=Trim(t[0]),n=Trim(t[1]),r.length>0&&!IsValidDecimal(r)?(WriteToDebug("Returning False - min value supplied range is not a valid decimal, min="+r),!1):n.length>0&&!IsValidDecimal(n)?(WriteToDebug("Returning False - max value supplied for range is not a valid decimal, max="+n),!1):!(r.length>0&&n.length>0&&parseFloat(r)>parseFloat(n))||(WriteToDebug("Returning False - min value supplied for range is greater than the max, min="+r+", max="+n),!1)):(WriteToDebug("Returning false - string supplied for range has incorrect number of parts, parts="+t.length+", strValue="+e),!1)}function ConvertDecimalRangeToDecimalBasedOnLearnerResponse(e,t,r){WriteToDebug("In ConvertDecimalRangeToDecimalBasedOnLearnerResponse strValue="+e+",strLearnerResponse="+t+",blnCorrect="+r);var n,i,o;if(r)return WriteToDebug("Returning strLearnerResponse"),t;if(2===(n=(e=new String(e)).split("[:]")).length){if(i=Trim(n[0]),o=Trim(n[1]),i.length>0)return WriteToDebug("Returning strMin"),i;if(o.length>0)return WriteToDebug("Returning strMax"),o}return WriteToDebug("Returning null"),null}function IsValidDecimal(e){return WriteToDebug("In IsValidDecimal, strValue="+e),(e=new String(e)).search(/[^.\d-]/)>-1?(WriteToDebug("Returning False - character other than a digit, dash or period found"),!1):e.search("-")>-1&&e.indexOf("-",1)>-1?(WriteToDebug("Returning False - dash found in the middle of the string"),!1):e.indexOf(".")!=e.lastIndexOf(".")?(WriteToDebug("Returning False - more than one decimal point found"),!1):e.search(/\d/)<0?(WriteToDebug("Returning False - no digits found"),!1):(WriteToDebug("Returning True"),!0)}function IsAlphaNumeric(e){return WriteToDebug("In IsAlphaNumeric"),(window&&Object.hasOwnProperty.call(window,"ActiveXObject")&&!window.ActiveXObject?e.search(RegExp("\\w")):e.search(RegExp("\\p{L}|\\p{N}","u")))<0?(WriteToDebug("Returning false"),!1):(WriteToDebug("Returning true"),!0)}function ReverseNameSequence(e){var t,r,n;return""==e&&(e="Not Found, Learner Name"),n=e.indexOf(","),t=e.slice(n+1),r=e.slice(0,n),(t=Trim(t))+" "+(r=Trim(r))}function LTrim(e){return(e=new String(e)).replace(/^\s+/,"")}function RTrim(e){return(e=new String(e)).replace(/\s+$/,"")}function Trim(e){return LTrim(RTrim(e)).replace(/\s{2,}/g," ")}function GetValueFromDataChunk(e){var t,r=new String(GetDataChunk()),n=new Array,i=new Array;for(n=r.split(parent.DATA_CHUNK_PAIR_SEPARATOR),t=0;t<n.length;t++)if((i=n[t].split(parent.DATA_CHUNK_VALUE_SEPARATOR))[0]==e)return i[1];return""}function SetDataChunkValue(e,t){var r,n=new String(GetDataChunk()),i=new Array,o=new Array,a=new Boolean(!1);for(i=n.split(parent.DATA_CHUNK_PAIR_SEPARATOR),r=0;r<i.length;r++)(o=i[r].split(parent.DATA_CHUNK_VALUE_SEPARATOR))[0]==e&&(o[1]=t,a=!0,i[r]=o[0]+parent.DATA_CHUNK_VALUE_SEPARATOR+o[1]);return 1==a?n=i.join(parent.DATA_CHUNK_PAIR_SEPARATOR):""==n?n=e+parent.DATA_CHUNK_VALUE_SEPARATOR+t:n+=parent.DATA_CHUNK_PAIR_SEPARATOR+e+parent.DATA_CHUNK_VALUE_SEPARATOR+t,SetDataChunk(n),!0}function GetLastDirAndPageName(e){var t=new String(e),r=t.lastIndexOf("/"),n=t.lastIndexOf("/",r-1);return t.substr(n+1)}function RoundToPrecision(e,t){return e=parseFloat(e),Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function IsAbsoluteUrl(e){return null!=e&&(0==e.indexOf("http://")||0==e.indexOf("https://"))}function TouchCloud(){if(null!=APPID&&""!=APPID&&"__APPID__"!=APPID&&null!==CLOUDURL&&0===CLOUDURL.indexOf("http")){var e=document.createElement("form");e.name="cloudform",e.id="cloudform",e.style="display:none;",document.body.appendChild(e);var t=document.createElement("input");t.name="appId",t.value=APPID,t.type="hidden",e.appendChild(t);var r=document.createElement("input");r.name="servingUrl",r.type="hidden",r.value=document.location.href,e.appendChild(r);var n=document.createElement("input");return n.name="version",n.type="hidden",n.value=VERSION,e.appendChild(n),e.target="rusticisoftware_aicc_results",e.action=CLOUDURL,document.getElementById("cloudform").submit(),!0}return!1}function IsNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}function loadScript(e,t){var r=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.src=e,!n.addEventListener||document.documentMode&&document.documentMode<9?n.onreadystatechange=function(){/loaded|complete/.test(n.readyState)&&(n.onreadystatechange=null,t())}:n.addEventListener("load",t,!1),r.appendChild(n)}loadDriverOptions(window);var STANDARD="SCORM2004",SCORM2004_LOGOUT="logout",SCORM2004_SUSPEND="suspend",SCORM2004_NORMAL_EXIT="normal",SCORM2004_TIMEOUT="time-out",SCORM2004_PASSED="passed",SCORM2004_FAILED="failed",SCORM2004_UNKNOWN="unknown",SCORM2004_COMPLETED="completed",SCORM2004_INCOMPLETE="incomplete",SCORM2004_NOT_ATTEMPTED="not attempted",SCORM2004_CREDIT="credit",SCORM2004_NO_CREDIT="no-credit",SCORM2004_BROWSE="browse",SCORM2004_NORMAL="normal",SCORM2004_REVIEW="review",SCORM2004_ENTRY_ABINITIO="ab-initio",SCORM2004_ENTRY_RESUME="resume",SCORM2004_ENTRY_NORMAL="",SCORM2004_TLA_EXIT_MESSAGE="exit,message",SCORM2004_TLA_EXIT_NO_MESSAGE="exit,no message",SCORM2004_TLA_CONTINUE_MESSAGE="continue,message",SCORM2004_TLA_CONTINUE_NO_MESSAGE="continue,no message",SCORM2004_RESULT_CORRECT="correct",SCORM2004_RESULT_WRONG="incorrect",SCORM2004_RESULT_UNANTICIPATED="unanticipated",SCORM2004_RESULT_NEUTRAL="neutral",SCORM2004_INTERACTION_TYPE_TRUE_FALSE="true-false",SCORM2004_INTERACTION_TYPE_CHOICE="choice",SCORM2004_INTERACTION_TYPE_FILL_IN="fill-in",SCORM2004_INTERACTION_TYPE_LONG_FILL_IN="long-fill-in",SCORM2004_INTERACTION_TYPE_MATCHING="matching",SCORM2004_INTERACTION_TYPE_PERFORMANCE="performance",SCORM2004_INTERACTION_TYPE_SEQUENCING="sequencing",SCORM2004_INTERACTION_TYPE_LIKERT="likert",SCORM2004_INTERACTION_TYPE_NUMERIC="numeric",SCORM2004_NO_ERROR="0",SCORM2004_ERROR_INVALID_PREFERENCE="-1",SCORM2004_ERROR_INVALID_STATUS="-2",SCORM2004_ERROR_INVALID_SPEED="-3",SCORM2004_ERROR_INVALID_TIMESPAN="-4",SCORM2004_ERROR_INVALID_TIME_LIMIT_ACTION="-5",SCORM2004_ERROR_INVALID_DECIMAL="-6",SCORM2004_ERROR_INVALID_CREDIT="-7",SCORM2004_ERROR_INVALID_LESSON_MODE="-8",SCORM2004_ERROR_INVALID_ENTRY="-9",SCORM2004_TRUE="true",SCORM2004_FALSE="false",SCORM2004_EARLIEST_DATE=new Date("1/1/1900"),intSCORM2004Error=SCORM2004_NO_ERROR,strSCORM2004ErrorString="",strSCORM2004ErrorDiagnostic="",SCORM2004_objAPI=null,blnReviewModeSoReadOnly=!1,blnSCORM2004_SSP_Is_Supported=null;function SCORM2004_Initialize(){WriteToDebug("In SCORM2004_Initialize");var e=!0;SCORM2004_ClearErrorInfo(),WriteToDebug("Grabbing API");try{SCORM2004_objAPI=SCORM2004_GrabAPI()}catch(e){WriteToDebug("Error grabbing 1.2 API-"+e.name+":"+e.message)}return void 0===SCORM2004_objAPI||null==SCORM2004_objAPI?(WriteToDebug("Unable to acquire SCORM API:"),WriteToDebug("SCORM2004_objAPI="+typeof SCORM2004_objAPI),InitializeExecuted(!1,"Error - unable to acquire LMS API, content may not play properly and results may not be recorded.  Please contact technical support."),!1):(WriteToDebug("Calling LMSInit"),(e=SCORM2004_CallInitialize())?(PREVENT_STATUS_CHANGE_DURING_INIT||SCORM2004_GetStatus()==LESSON_STATUS_NOT_ATTEMPTED&&(WriteToDebug("Setting Status to Incomplete"),e=SCORM2004_CallSetValue("cmi.completion_status",SCORM2004_INCOMPLETE)),e=SCORM2004_CallSetValue("cmi.exit",SCORM2004_TranslateExitTypeToSCORM(DEFAULT_EXIT_TYPE))&&e,SCORM2004_GetLessonMode()==MODE_REVIEW&&void 0!==REVIEW_MODE_IS_READ_ONLY&&!0===REVIEW_MODE_IS_READ_ONLY&&(blnReviewModeSoReadOnly=!0),WriteToDebug("Calling InitializeExecuted with parameter-"+e),void InitializeExecuted(e,"")):(WriteToDebug("ERROR Initializing LMS"),InitializeExecuted(!1,"Error initializing communications with LMS"),!1))}function SCORM2004_Finish(e,t){var r;WriteToDebug("In SCORM2004_Finish strExitType="+e+", blnStatusWasSet="+t);var n=!0;return SCORM2004_ClearErrorInfo(),e!=EXIT_TYPE_FINISH||t||(WriteToDebug("Getting completion status"),WriteToDebug("Setting completion status to "+(r=SCORM2004_GetCompletionStatus())),n=SCORM2004_CallSetValue("cmi.completion_status",r)&&n),e==EXIT_TYPE_SUSPEND&&USE_2004_SUSPENDALL_NAVREQ&&(WriteToDebug("Setting adl.nav.request to suspendAll"),n=SCORM2004_CallSetValue("adl.nav.request","suspendAll")),WriteToDebug("Setting Exit"),n=SCORM2004_CallSetValue("cmi.exit",SCORM2004_TranslateExitTypeToSCORM(e))&&n,WriteToDebug("Calling Commit"),n=SCORM2004_CallCommit()&&n,WriteToDebug("Calling Finish"),WriteToDebug("Returning "+(n=SCORM2004_CallTerminate()&&n)),n}function SCORM2004_CommitData(){return WriteToDebug("In SCORM2004_CommitData"),SCORM2004_ClearErrorInfo(),SCORM2004_CallCommit()}function SCORM2004_GetStudentID(){return WriteToDebug("In SCORM2004_GetStudentID"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.learner_id")}function SCORM2004_GetStudentName(){return WriteToDebug("In SCORM2004_GetStudentName"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.learner_name")}function SCORM2004_GetBookmark(){return WriteToDebug("In SCORM2004_GetBookmark"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.location")}function SCORM2004_SetBookmark(e){return WriteToDebug("In SCORM2004_SetBookmark strBookmark="+e),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.location",e)}function SCORM2004_GetDataChunk(){return WriteToDebug("In SCORM2004_GetDataChunk"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.suspend_data")}function SCORM2004_SetDataChunk(e){return WriteToDebug("In SCORM2004_SetDataChunk"),SCORM2004_ClearErrorInfo(),1==USE_STRICT_SUSPEND_DATA_LIMITS&&e.length>4e3?(WriteToDebug("SCORM2004_SetDataChunk - suspend_data too large for SCORM 2004 2nd ed (4000 character limit) but will try to persist anyway."),e.length>64e3?(WriteToDebug("SCORM2004_SetDataChunk - suspend_data too large for SCORM 2004 3rd & 4th ed (64000 character limit) so failing to persist."),!1):SCORM2004_CallSetValue("cmi.suspend_data",e)):SCORM2004_CallSetValue("cmi.suspend_data",e)}function SCORM2004_GetLaunchData(){return WriteToDebug("In SCORM2004_GetLaunchData"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.launch_data")}function SCORM2004_GetComments(){var e;WriteToDebug("In SCORM2004_GetComments"),SCORM2004_ClearErrorInfo();var t="";e=SCORM2004_CallGetValue("cmi.comments_from_learner._count");for(var r=0;r<e;r++)t.length>0&&(t+=" | "),t+=SCORM2004_CallGetValue("cmi.comments_from_learner."+r+".comment");return t}function SCORM2004_WriteComment(e){var t,r;return WriteToDebug("In SCORM2004_WriteComment strComment="+e),SCORM2004_ClearErrorInfo(),0==e.search(/ \| /)&&(e=e.substr(3)),e.replace(/\|\|/g,"|"),r=SCORM2004_CallSetValue("cmi.comments_from_learner."+(t=SCORM2004_CallGetValue("cmi.comments_from_learner._count"))+".comment",e),r=SCORM2004_CallSetValue("cmi.comments_from_learner."+t+".timestamp",ConvertDateToIso8601TimeStamp(new Date))&&r}function SCORM2004_GetLMSComments(){var e;WriteToDebug("In SCORM2004_GetLMSComments"),SCORM2004_ClearErrorInfo();var t="";e=SCORM2004_CallGetValue("cmi.comments_from_lms._count");for(var r=0;r<e;r++)t.length>0&&(t+=" \r\n"),t+=SCORM2004_CallGetValue("cmi.comments_from_lms."+r+".comment");return t}function SCORM2004_GetAudioPlayPreference(){var e;return WriteToDebug("In SCORM2004_GetAudioPlayPreference"),SCORM2004_ClearErrorInfo(),""==(e=SCORM2004_CallGetValue("cmi.learner_preference.audio_level"))&&(e=0),WriteToDebug("intTempPreference="+(e=parseInt(e,10))),e>0?(WriteToDebug("Returning On"),PREFERENCE_ON):e<=0?(WriteToDebug("Returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+e),null)}function SCORM2004_GetAudioVolumePreference(){var e;return WriteToDebug("In SCORM2004_GetAudioVollumePreference"),SCORM2004_ClearErrorInfo(),WriteToDebug("intTempPreference="+(e=SCORM2004_CallGetValue("cmi.learner_preference.audio_level"))),""==e&&(e=100),(e=parseInt(e,10))<=0&&(WriteToDebug("Setting to 100"),e=100),e>0&&e<=100?(WriteToDebug("Returning "+e),e):(WriteToDebug("ERROR: invalid preference"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+e),null)}function SCORM2004_SetAudioPreference(e,t){return WriteToDebug("In SCORM2004_SetAudioPreference PlayPreference="+e+", intPercentOfMaxVolume="+t),SCORM2004_ClearErrorInfo(),e==PREFERENCE_OFF&&(WriteToDebug("Setting percent to 0"),t=0),SCORM2004_CallSetValue("cmi.learner_preference.audio_level",t)}function SCORM2004_SetLanguagePreference(e){return WriteToDebug("In SCORM2004_SetLanguagePreference strLanguage="+e),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.learner_preference.language",e)}function SCORM2004_GetLanguagePreference(){return WriteToDebug("In SCORM2004_GetLanguagePreference"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.learner_preference.language")}function SCORM2004_SetSpeedPreference(e){return WriteToDebug("In SCORM2004_SetSpeedPreference intPercentOfMax="+e),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.learner_preference.delivery_speed",e)}function SCORM2004_GetSpeedPreference(){var e;return WriteToDebug("In SCORM2004_GetSpeedPreference"),SCORM2004_ClearErrorInfo(),WriteToDebug("intSCORMSpeed="+(e=SCORM2004_CallGetValue("cmi.learner_preference.delivery_speed"))),""==e&&(WriteToDebug("Detected empty string, defaulting to 100"),e=100),(e=parseInt(e,10))<0?(WriteToDebug("ERROR - out of range"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range","intSCORMSpeed="+e),null):(WriteToDebug("intSCORMSpeed "+e),e)}function SCORM2004_SetTextPreference(e){return WriteToDebug("In SCORM2004_SetTextPreference intPreference="+e),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.learner_preference.audio_captioning",e)}function SCORM2004_GetTextPreference(){var e;return WriteToDebug("In SCORM2004_GetTextPreference"),SCORM2004_ClearErrorInfo(),e=SCORM2004_CallGetValue("cmi.learner_preference.audio_captioning"),WriteToDebug("intTempPreference="+(e=parseInt(e,10))),e>0?(WriteToDebug("Returning On"),PREFERENCE_ON):0==e||""==e?(WriteToDebug("Returning Default"),PREFERENCE_DEFAULT):e<0?(WriteToDebug("Returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+e),null)}function SCORM2004_GetPreviouslyAccumulatedTime(){var e,t;return WriteToDebug("In SCORM2004_GetPreviouslyAccumulatedTime"),SCORM2004_ClearErrorInfo(),WriteToDebug("strIso8601Time="+(e=SCORM2004_CallGetValue("cmi.total_time"))),IsValidIso8601TimeSpan(e)?(WriteToDebug("Returning "+(t=ConvertScorm2004TimeToMS(e))),t):(WriteToDebug("ERROR - Invalid Iso8601Time"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+e),null)}function SCORM2004_SaveTime(e){var t;return WriteToDebug("In SCORM2004_SaveTime intMilliSeconds="+e),SCORM2004_ClearErrorInfo(),WriteToDebug("strISO8601Time="+(t=ConvertMilliSecondsIntoSCORM2004Time(e))),SCORM2004_CallSetValue("cmi.session_time",t)}function SCORM2004_GetMaxTimeAllowed(){var e,t;return WriteToDebug("In SCORM2004_GetMaxTimeAllowed"),SCORM2004_ClearErrorInfo(),WriteToDebug("strIso8601Time="+(e=SCORM2004_CallGetValue("cmi.max_time_allowed"))),""==e&&(e="20Y"),IsValidIso8601TimeSpan(e)?(WriteToDebug("intMilliseconds="+(t=ConvertScorm2004TimeToMS(ConvertScorm2004TimeToMS))),t):(WriteToDebug("ERROR - Invalid Iso8601Time"),SCORM2004_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strIso8601Time="+e),null)}function SCORM2004_DisplayMessageOnTimeout(){var e;return WriteToDebug("In SCORM2004_DisplayMessageOnTimeout"),SCORM2004_ClearErrorInfo(),WriteToDebug("strTLA="+(e=SCORM2004_CallGetValue("cmi.time_limit_action"))),e==SCORM2004_TLA_EXIT_MESSAGE||e==SCORM2004_TLA_CONTINUE_MESSAGE?(WriteToDebug("returning true"),!0):e==SCORM2004_TLA_EXIT_NO_MESSAGE||e==SCORM2004_TLA_CONTINUE_NO_MESSAGE||""==e?(WriteToDebug("returning false"),!1):(WriteToDebug("Error invalid TLA"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+e),null)}function SCORM2004_ExitOnTimeout(){var e;return WriteToDebug("In SCORM2004_ExitOnTimeout"),SCORM2004_ClearErrorInfo(),WriteToDebug("strTLA="+(e=SCORM2004_CallGetValue("cmi.time_limit_action"))),e==SCORM2004_TLA_EXIT_MESSAGE||e==SCORM2004_TLA_EXIT_NO_MESSAGE?(WriteToDebug("returning true"),!0):e==SCORM2004_TLA_CONTINUE_MESSAGE||e==SCORM2004_TLA_CONTINUE_NO_MESSAGE||""==e?(WriteToDebug("returning false"),!1):(WriteToDebug("ERROR invalid TLA"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+e),null)}function SCORM2004_GetPassingScore(){var e;return WriteToDebug("In SCORM2004_GetPassingScore"),SCORM2004_ClearErrorInfo(),WriteToDebug("fltScore="+(e=SCORM2004_CallGetValue("cmi.scaled_passing_score"))),""==e&&(e=0),IsValidDecimal(e)?(e=parseFloat(e),WriteToDebug("returning fltScore-"+(e*=100)),e):(WriteToDebug("Error - score is not a valid decimal"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_DECIMAL,"Invalid mastery score received from LMS","fltScore="+e),null)}function SCORM2004_SetScore(e,t,r){var n,i;return WriteToDebug("In SCORM2004_SetScore intScore="+(e=RoundToPrecision(e,7))+", intMaxScore="+(t=RoundToPrecision(t,7))+", intMinScore="+(r=RoundToPrecision(r,7))),SCORM2004_ClearErrorInfo(),i=RoundToPrecision(e/100,7),n=SCORM2004_CallSetValue("cmi.score.raw",e),n=SCORM2004_CallSetValue("cmi.score.max",t)&&n,n=SCORM2004_CallSetValue("cmi.score.min",r)&&n,WriteToDebug("Returning "+(n=SCORM2004_CallSetValue("cmi.score.scaled",i)&&n)),n}function SCORM2004_GetScore(){return WriteToDebug("In SCORM2004_GetScore"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.score.raw")}function SCORM2004_GetScaledScore(){return WriteToDebug("In SCORM2004_GetScaledScore"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.score.scaled")}function SCORM2004_RecordInteraction(e,t,r,n,i,o,a,s,u,c){var l,C,I;return IsNumeric(r)||(r=new String(r)),SCORM2004_ClearErrorInfo(),WriteToDebug("intInteractionIndex="+(C=SCORM2004_CallGetValue("cmi.interactions._count"))),""==C&&(WriteToDebug("Setting Interaction Index to 0"),C=0),WriteToDebug("strResult="+(I=1==r||"true"==r||r==INTERACTION_RESULT_CORRECT?SCORM2004_RESULT_CORRECT:"false"==String(r)||r==INTERACTION_RESULT_WRONG?SCORM2004_RESULT_WRONG:r==INTERACTION_RESULT_UNANTICIPATED?SCORM2004_RESULT_UNANTICIPATED:r==INTERACTION_RESULT_NEUTRAL?SCORM2004_RESULT_NEUTRAL:IsNumeric(r)?r:"")),l=SCORM2004_CallSetValue("cmi.interactions."+C+".id",e=CreateValidIdentifier(e)),l=SCORM2004_CallSetValue("cmi.interactions."+C+".type",c)&&l,null!==t&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".learner_response",t)&&l),null!=I&&null!=I&&""!=I&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".result",I)&&l),null!=n&&null!=n&&""!=n&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".correct_responses.0.pattern",n)&&l),null!=i&&null!=i&&""!=i&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".description",i)&&l),null!=o&&null!=o&&""!=o&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".weighting",o)&&l),null!=a&&null!=a&&""!=a&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".latency",ConvertMilliSecondsIntoSCORM2004Time(a))&&l),null!=s&&null!=s&&""!=s&&(l=SCORM2004_CallSetValue("cmi.interactions."+C+".objectives.0.id",s)&&l),WriteToDebug("Returning "+(l=SCORM2004_CallSetValue("cmi.interactions."+C+".timestamp",ConvertDateToIso8601TimeStamp(u))&&l)),l}function SCORM2004_RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM2004_RecordTrueFalseInteraction strID="+e+", strResponse="+c+", blnCorrect="+r+", strCorrectResponse="+l+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null;return t?c="true":null!==t&&(c="false"),1==n?l="true":0==n&&(l="false"),SCORM2004_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_TRUE_FALSE)}function SCORM2004_RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM2004_RecordMultipleChoiceInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l="";if(null!==t){c="";for(var C=0;C<t.length;C++)c.length>0&&(c+="[,]"),c+=t[C].Long}for(C=0;C<n.length;C++)l.length>0&&(l+="[,]"),l+=n[C].Long;return SCORM2004_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_CHOICE)}function SCORM2004_RecordFillInInteraction(e,t,r,n,i,o,a,s,u){var c;return WriteToDebug("In SCORM2004_RecordFillInInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null==n&&(n=""),c=(n=new String(n)).length>250||t.length>250?SCORM2004_INTERACTION_TYPE_LONG_FILL_IN:SCORM2004_INTERACTION_TYPE_FILL_IN,n.length>4e3&&(n=n.substr(0,4e3)),SCORM2004_RecordInteraction(e,t,r,n,i,o,a,s,u,c)}function SCORM2004_RecordMatchingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM2004_RecordMatchingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l="";if(null!==t){c="";for(var C=0;C<t.length;C++)c.length>0&&(c+="[,]"),c+=t[C].Source.Long+"[.]"+t[C].Target.Long}for(C=0;C<n.length;C++)l.length>0&&(l+="[,]"),l+=n[C].Source.Long+"[.]"+n[C].Target.Long;return SCORM2004_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_MATCHING)}function SCORM2004_RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In SCORM2004_RecordPerformanceInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!==t&&((t=new String(t)).length>250&&(t=t.substr(0,250)),t="[.]"+t),null==n&&(n=""),(n=new String(n)).length>250&&(n=n.substr(0,250)),SCORM2004_RecordInteraction(e,t,r,n="[.]"+n,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_PERFORMANCE)}function SCORM2004_RecordSequencingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM2004_RecordSequencingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l="";if(null!==t){c="";for(var C=0;C<t.length;C++)c.length>0&&(c+="[,]"),c+=t[C].Long}for(C=0;C<n.length;C++)l.length>0&&(l+="[,]"),l+=n[C].Long;return SCORM2004_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_SEQUENCING)}function SCORM2004_RecordLikertInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In RecordLikertInteraction strID="+e+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l="";return null!==t&&(c=t.Long),null!=n&&(l=n.Long),SCORM2004_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_LIKERT)}function SCORM2004_RecordNumericInteraction(e,t,r,n,i,o,a,s,u){if(WriteToDebug("In SCORM2004_RecordNumericInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!=n&&null!=n){if(IsValidDecimal(n)&&WriteToDebug("SCORM2004_RecordNumericInteraction received decimal correct response and converted to range, strCorrectResponse="+(n=n+"[:]"+n)),!IsValidDecimalRange(n))return WriteToDebug("Returning False - SCORM2004_RecordNumericInteraction received invalid correct response decimal range, strCorrectResponse="+n),!1;if(null===ConvertDecimalRangeToDecimalBasedOnLearnerResponse(n,t,r))return WriteToDebug("Returning False - SCORM2004_RecordNumericInteraction received invalid correct response decimal range, response and correct indicator, strCorrectResponse="+n+", strResponse="+t+", blnCorrect="+r),!1}return SCORM2004_RecordInteraction(e,t,r,n,i,o,a,s,u,SCORM2004_INTERACTION_TYPE_NUMERIC)}function SCORM2004_GetEntryMode(){var e;return WriteToDebug("In SCORM2004_GetEntryMode"),SCORM2004_ClearErrorInfo(),WriteToDebug("strEntry="+(e=SCORM2004_CallGetValue("cmi.entry"))),e==SCORM2004_ENTRY_ABINITIO?(WriteToDebug("Returning first time"),ENTRY_FIRST_TIME):e==SCORM2004_ENTRY_RESUME?(WriteToDebug("Returning resume"),ENTRY_RESUME):e==SCORM2004_ENTRY_NORMAL?(WriteToDebug("returning normal"),ENTRY_REVIEW):(WriteToDebug("ERROR - invalid entry mode"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_ENTRY,"Invalid entry vocab received from LMS","strEntry="+e),null)}function SCORM2004_GetLessonMode(){var e;return WriteToDebug("In SCORM2004_GetLessonMode"),SCORM2004_ClearErrorInfo(),WriteToDebug("strLessonMode="+(e=SCORM2004_CallGetValue("cmi.mode"))),e==SCORM2004_BROWSE?(WriteToDebug("Returning browse"),MODE_BROWSE):e==SCORM2004_NORMAL?(WriteToDebug("returning normal"),MODE_NORMAL):e==SCORM2004_REVIEW?(WriteToDebug("Returning Review"),MODE_REVIEW):(WriteToDebug("ERROR - invalid lesson mode"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_LESSON_MODE,"Invalid lesson_mode vocab received from LMS","strLessonMode="+e),null)}function SCORM2004_GetTakingForCredit(){var e;return WriteToDebug("In SCORM2004_GetTakingForCredit"),SCORM2004_ClearErrorInfo(),WriteToDebug("strCredit="+(e=SCORM2004_CallGetValue("cmi.credit"))),"credit"==e?(WriteToDebug("Returning true"),!0):"no-credit"==e?(WriteToDebug("Returning false"),!1):(WriteToDebug("ERROR - invalid credit"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_CREDIT,"Invalid credit vocab received from LMS","strCredit="+e),null)}function SCORM2004_SetObjectiveScore(e,t,r,n){var i,o,a;return WriteToDebug("In SCORM2004_SetObjectiveScore, strObejctiveID="+e+", intScore="+(t=RoundToPrecision(t,7))+", intMaxScore="+(r=RoundToPrecision(r,7))+", intMinScore="+(n=RoundToPrecision(n,7))),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(i=SCORM2004_FindObjectiveIndexFromID(e))),a=RoundToPrecision(t/100,7),o=SCORM2004_CallSetValue("cmi.objectives."+i+".id",e),o=SCORM2004_CallSetValue("cmi.objectives."+i+".score.raw",t)&&o,o=SCORM2004_CallSetValue("cmi.objectives."+i+".score.max",r)&&o,o=SCORM2004_CallSetValue("cmi.objectives."+i+".score.min",n)&&o,WriteToDebug("Returning "+(o=SCORM2004_CallSetValue("cmi.objectives."+i+".score.scaled",a)&&o)),o}function SCORM2004_SetObjectiveStatus(e,t){var r,n,i="",o="";return WriteToDebug("In SCORM2004_SetObjectiveStatus strObjectiveID="+e+", Lesson_Status="+t),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(r=SCORM2004_FindObjectiveIndexFromID(e))),t==LESSON_STATUS_PASSED?(i=SCORM2004_PASSED,o=SCORM2004_COMPLETED):t==LESSON_STATUS_FAILED?(i=SCORM2004_FAILED,o=SCORM2004_COMPLETED):t==LESSON_STATUS_COMPLETED||t==LESSON_STATUS_BROWSED?(i=SCORM2004_UNKNOWN,o=SCORM2004_COMPLETED):t==LESSON_STATUS_INCOMPLETE?(i=SCORM2004_UNKNOWN,o=SCORM2004_INCOMPLETE):t==LESSON_STATUS_NOT_ATTEMPTED&&(i=SCORM2004_UNKNOWN,o=SCORM2004_NOT_ATTEMPTED),WriteToDebug("strSCORMSuccessStatus="+i),WriteToDebug("strSCORMCompletionStatus="+o),n=SCORM2004_CallSetValue("cmi.objectives."+r+".id",e),n=SCORM2004_CallSetValue("cmi.objectives."+r+".success_status",i)&&n,WriteToDebug("Returning "+(n=SCORM2004_CallSetValue("cmi.objectives."+r+".completion_status",o)&&n)),n}function SCORM2004_SetObjectiveDescription(e,t){var r;return WriteToDebug("In SCORM2004_SetObjectiveDescription strObjectiveID="+e+", strObjectiveDescription="+t),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(r=SCORM2004_FindObjectiveIndexFromID(e))),blnResult=SCORM2004_CallSetValue("cmi.objectives."+r+".id",e),blnResult=SCORM2004_CallSetValue("cmi.objectives."+r+".description",t)&&blnResult,WriteToDebug("Returning "+blnResult),blnResult}function SCORM2004_GetObjectiveScore(e){var t;return WriteToDebug("In SCORM2004_GetObjectiveScore, strObejctiveID="+e),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(t=SCORM2004_FindObjectiveIndexFromID(e))),SCORM2004_CallGetValue("cmi.objectives."+t+".score.raw")}function SCORM2004_GetObjectiveStatus(e){var t,r,n;return WriteToDebug("In SCORM2004_GetObjectiveStatus, strObejctiveID="+e),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(t=SCORM2004_FindObjectiveIndexFromID(e))),r=SCORM2004_CallGetValue("cmi.objectives."+t+".success_status"),n=SCORM2004_CallGetValue("cmi.objectives."+t+".completion_status"),r==SCORM2004_PASSED?(WriteToDebug("returning Passed"),LESSON_STATUS_PASSED):r==SCORM2004_FAILED?(WriteToDebug("Returning Failed"),LESSON_STATUS_FAILED):n==SCORM2004_COMPLETED?(WriteToDebug("Returning Completed"),LESSON_STATUS_COMPLETED):n==SCORM2004_INCOMPLETE?(WriteToDebug("Returning Incomplete"),LESSON_STATUS_INCOMPLETE):n==SCORM2004_NOT_ATTEMPTED||n==SCORM2004_UNKNOWN||""==n?(WriteToDebug("Returning Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED):(WriteToDebug("ERROR - status not found"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_STATUS,"Invalid objective status received from LMS or initial status not yet recorded for objective","strCompletionStatus="+n),null)}function SCORM2004_GetObjectiveProgressMeasure(e){return SCORM2004_CallGetValue("cmi.objectives."+e+".progress_measure")}function SCORM2004_GetObjectiveDescription(e){var t;return WriteToDebug("In SCORM2004_GetObjectiveDescription, strObejctiveID="+e),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(t=SCORM2004_FindObjectiveIndexFromID(e))),strDescription=SCORM2004_CallGetValue("cmi.objectives."+t+".description"),strDescription}function SCORM2004_FindObjectiveIndexFromID(e){var t,r,n;if(WriteToDebug("In SCORM2004_FindObjectiveIndexFromID"),""==(t=SCORM2004_CallGetValue("cmi.objectives._count")))return WriteToDebug("Setting intCount=0"),0;for(WriteToDebug("intCount="+(t=parseInt(t,10))),r=0;r<t;r++)if(WriteToDebug("Checking index "+r),WriteToDebug("ID="+(n=SCORM2004_CallGetValue("cmi.objectives."+r+".id"))),n==e)return WriteToDebug("Found Matching index"),r;return WriteToDebug("Did not find match, returning count"),t}function SCORM2004_CreateValidIdentifier(e){return USE_LEGACY_IDENTIFIERS_FOR_2004?CreateValidIdentifierLegacy(e):CreateUriIdentifier(e)}function SCORM2004_SetFailed(){var e;return WriteToDebug("In SCORM2004_SetFailed"),SCORM2004_ClearErrorInfo(),e=SCORM2004_CallSetValue("cmi.success_status",SCORM2004_FAILED),PASS_FAIL_SETS_COMPLETION_FOR_2004?e=SCORM2004_CallSetValue("cmi.completion_status",SCORM2004_COMPLETED)&&e:SCORM2004_CallGetValue("cmi.completion_status")!==SCORM2004_COMPLETED&&(WriteToDebug("Overriding blnStatusWasSet to false."),blnStatusWasSet=!1),e}function SCORM2004_SetPassed(){var e;return WriteToDebug("In SCORM2004_SetPassed"),SCORM2004_ClearErrorInfo(),e=SCORM2004_CallSetValue("cmi.success_status",SCORM2004_PASSED),PASS_FAIL_SETS_COMPLETION_FOR_2004?e=SCORM2004_CallSetValue("cmi.completion_status",SCORM2004_COMPLETED)&&e:SCORM2004_CallGetValue("cmi.completion_status")!==SCORM2004_COMPLETED&&(WriteToDebug("Overriding blnStatusWasSet to false."),blnStatusWasSet=!1),e}function SCORM2004_SetCompleted(){return WriteToDebug("In SCORM2004_SetCompleted"),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.completion_status",SCORM2004_COMPLETED)}function SCORM2004_ResetStatus(){var e;return WriteToDebug("In SCORM2004_ResetStatus"),SCORM2004_ClearErrorInfo(),e=SCORM2004_CallSetValue("cmi.success_status",SCORM2004_UNKNOWN),e=SCORM2004_CallSetValue("cmi.completion_status",SCORM2004_INCOMPLETE)&&e}function SCORM2004_GetStatus(){var e,t;return WriteToDebug("In SCORM2004_GetStatus"),SCORM2004_ClearErrorInfo(),e=SCORM2004_CallGetValue("cmi.success_status"),t=SCORM2004_CallGetValue("cmi.completion_status"),WriteToDebug("strSuccessStatus="+e),WriteToDebug("strCompletionStatus="+t),e==SCORM2004_PASSED?(WriteToDebug("returning Passed"),LESSON_STATUS_PASSED):e==SCORM2004_FAILED?(WriteToDebug("Returning Failed"),LESSON_STATUS_FAILED):t==SCORM2004_COMPLETED?(WriteToDebug("Returning Completed"),LESSON_STATUS_COMPLETED):t==SCORM2004_INCOMPLETE?(WriteToDebug("Returning Incomplete"),LESSON_STATUS_INCOMPLETE):t==SCORM2004_NOT_ATTEMPTED||t==SCORM2004_UNKNOWN?(WriteToDebug("Returning Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED):(WriteToDebug("ERROR - status not found"),SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_STATUS,"Invalid lesson status received from LMS","strCompletionStatus="+t),null)}function SCORM2004_GetProgressMeasure(){return WriteToDebug("In SCORM2004_GetProgressMeasure"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("cmi.progress_measure")}function SCORM2004_SetProgressMeasure(e){return WriteToDebug("In SCORM2004_SetProgressMeasure"),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.progress_measure",e)}function SCORM2004_SetObjectiveProgressMeasure(e,t){var r;return WriteToDebug("In SCORM2004_SetObjectiveProgressMeasure"),WriteToDebug("In SCORM2004_SetObjectiveProgressMeasure, strObejctiveID="+e+", numMeasure="+t),SCORM2004_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(r=SCORM2004_FindObjectiveIndexFromID(e))),SCORM2004_ClearErrorInfo(),SCORM2004_CallSetValue("cmi.objectives."+r+".progress_measure",t)}function SCORM2004_IsContentInBrowseMode(){var e;return WriteToDebug("In SCORM2004_IsContentInBrowseMode"),WriteToDebug("SCORM2004_IsContentInBrowseMode,  strLessonMode="+(e=SCORM2004_CallGetValue("cmi.mode"))),e==SCORM2004_BROWSE?(WriteToDebug("Returning true"),!0):(WriteToDebug("Returning false"),!1)}function SCORM2004_TranslateExitTypeToSCORM(e){return WriteToDebug("In SCORM2004_TranslatgeExitTypeToSCORM strExitType-"+e),e==EXIT_TYPE_SUSPEND?(WriteToDebug("Returning suspend"),SCORM2004_SUSPEND):e==EXIT_TYPE_UNLOAD?(WriteToDebug("Returning Exit"),SCORM2004_NORMAL_EXIT):e==EXIT_TYPE_FINISH?(WriteToDebug("Returning Logout"),SCORM2004_NORMAL_EXIT):e==EXIT_TYPE_TIMEOUT?(WriteToDebug("Returning Timout"),SCORM2004_TIMEOUT):void 0}function SCORM2004_GetCompletionStatus(){return WriteToDebug("In SCORM2004_GetCompletionStatus"),SCORM2004_COMPLETED}function SCORM2004_SetPointBasedScore(e,t,r){var n,i;return WriteToDebug("In SCORM2004_SetPointBasedScore intScore="+e+", intMaxScore="+t+", intMinScore="+r),SCORM2004_ClearErrorInfo(),e>=r?i=e/t:(WriteToDebug("intScore is lower than intMinScore. Overriding score with minscore for cmi.score.scaled"),i=r/t),i=RoundToPrecision(i,7),n=SCORM2004_CallSetValue("cmi.score.raw",e),n=SCORM2004_CallSetValue("cmi.score.max",t)&&n,n=SCORM2004_CallSetValue("cmi.score.min",r)&&n,WriteToDebug("Returning "+(n=SCORM2004_CallSetValue("cmi.score.scaled",i)&&n)),n}function SCORM2004_FindInteractionIndexFromID(e){var t,r,n,i,o=new Date,a=new Date("1/1/1900");if(WriteToDebug("In SCORM2004_FindInteractionIndexFromID"),""==(t=SCORM2004_CallGetValue("cmi.interactions._count")))return WriteToDebug("Setting intCount=0"),null;for(WriteToDebug("intCount="+(t=parseInt(t,10))),r=0;r<t;r++)WriteToDebug("Checking index "+r),WriteToDebug("ID="+(n=SCORM2004_CallGetValue("cmi.interactions."+r+".id"))),n==e&&(WriteToDebug("Found Matching index: "+r),WriteToDebug("timestamp for "+r+": "+(o=ConvertIso8601TimeStampToDate(SCORM2004_CallGetValue("cmi.interactions."+r+".timestamp")))),o>a&&(i=r,a=o));return i>=0?i:(WriteToDebug("Did not find match, returning null"),null)}function SCORM2004_GetInteractionType(e){var t;if(WriteToDebug("In SCORM2004_GetInteractionType, strInteractionID="+e),SCORM2004_ClearErrorInfo(),null==(t=SCORM2004_FindInteractionIndexFromID(e))||null==t)return null;switch(WriteToDebug("intInteractionIndex="+t),SCORM2004_CallGetValue("cmi.interactions."+t+".type")){case SCORM2004_INTERACTION_TYPE_FILL_IN:return INTERACTION_TYPE_FILL_IN;case SCORM2004_INTERACTION_TYPE_LONG_FILL_IN:return INTERACTION_TYPE_LONG_FILL_IN;case SCORM2004_INTERACTION_TYPE_CHOICE:return INTERACTION_TYPE_CHOICE;case SCORM2004_INTERACTION_TYPE_LIKERT:return INTERACTION_TYPE_LIKERT;case SCORM2004_INTERACTION_TYPE_MATCHING:return INTERACTION_TYPE_MATCHING;case SCORM2004_INTERACTION_TYPE_NUMERIC:return INTERACTION_TYPE_NUMERIC;case SCORM2004_INTERACTION_TYPE_PERFORMANCE:return INTERACTION_TYPE_PERFORMANCE;case SCORM2004_INTERACTION_TYPE_SEQUENCING:return INTERACTION_TYPE_SEQUENCING;case SCORM2004_INTERACTION_TYPE_TRUE_FALSE:return INTERACTION_TYPE_TRUE_FALSE;default:return""}}function SCORM2004_GetInteractionTimestamp(e){WriteToDebug("In SCORM2004_GetInteractionTimestamp, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);return WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t?null:SCORM2004_CallGetValue(ConvertIso8601TimeStampToDate("cmi.interactions."+t+".timestamp"))}function SCORM2004_GetInteractionCorrectResponses(e){WriteToDebug("In SCORM2004_GetInteractionCorrectResponses, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);if(WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t)return null;var r=SCORM2004_CallGetValue("cmi.interactions."+t+".type"),n=SCORM2004_CallGetValue("cmi.interactions."+t+".correct_responses._count");if(""==n)return WriteToDebug("Setting intCorrectResponseCount=0"),0;if(WriteToDebug("intCorrectResponseCount="+(n=parseInt(n,10))),0==n)return new Array;n>1&&WriteToDebug("SCORM Driver is not currently implemented to support multiple correct response combinations and will only return the first");var i=new String(SCORM2004_CallGetValue("cmi.interactions."+t+".correct_responses.0.pattern")).split("[,]");return WriteToDebug("aryResponse.length = "+i.length),WriteToDebug("aryResponse.length = "+(i=SCORM2004_ProcessResponseArray(r,i)).length),i}function SCORM2004_GetInteractionWeighting(e){WriteToDebug("In SCORM2004_GetInteractionWeighting, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);return WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t?null:SCORM2004_CallGetValue("cmi.interactions."+t+".weighting")}function SCORM2004_GetInteractionLearnerResponses(e){WriteToDebug("In SCORM2004_GetInteractionLearnerResponses, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);if(WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t)return null;var r=SCORM2004_CallGetValue("cmi.interactions."+t+".type"),n=new String(SCORM2004_CallGetValue("cmi.interactions."+t+".learner_response")).split("[,]");return WriteToDebug("aryResponses.length = "+n.length),n=SCORM2004_ProcessResponseArray(r,n)}function SCORM2004_ProcessResponseArray(e,t){WriteToDebug("Processing Response Array with "+t.length+" pieces");for(var r=0;r<t.length;r++)e==SCORM2004_INTERACTION_TYPE_MATCHING&&(WriteToDebug("processing matching type, i="+r),t[r]=CreateMatchingResponse(t[r]));return t}function SCORM2004_GetInteractionResult(e){WriteToDebug("In SCORM2004_GetInteractionResult, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);return WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t?null:SCORM2004_CallGetValue("cmi.interactions."+t+".result")}function SCORM2004_GetInteractionLatency(e){WriteToDebug("In SCORM2004_GetInteractionLatency, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);if(WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t)return null;var r=SCORM2004_CallGetValue("cmi.interactions."+t+".latency");WriteToDebug("latency returns: "+r);var n=ConvertScorm2004TimeToMS(r);return WriteToDebug("latency in milliseconds: "+n),n}function SCORM2004_GetInteractionDescription(e){WriteToDebug("In SCORM2004_GetInteractionDescription, strInteractionID="+e);var t=SCORM2004_FindInteractionIndexFromID(e);return WriteToDebug("intInteractionIndex="+t),SCORM2004_ClearErrorInfo(),null==t||null==t?null:SCORM2004_CallGetValue("cmi.interactions."+t+".description")}function SCORM2004_CreateDataBucket(e,t,r,n){return WriteToDebug("In SCORM2004_CreateDataBucket, strBucketId="+e+", intMinSize="+t+", intMaxSize="+r+", course="+n),SCORM2004_DetectSSPSupport()?1==SCORM2004_DoesBucketExist(e)?(WriteToDebug("Bucket already exists and can't be re-allocated."),!1):SCORM2004_CallSetValue("ssp.allocate","{bucketID="+e+"}{requested="+r+"}{minimum="+t+"}{reducible=true}{persistence="+n+"}"):(WriteToDebug("SSP is not supported in this LMS, returning false."),!1)}function SCORM2004_GetDataFromBucket(e){return WriteToDebug("In SCORM2004_GetDataFromBucket, strBucketId="+e),SCORM2004_DetectSSPSupport()?SCORM2004_CallGetValue("ssp.data.{bucketID="+e+"}"):(WriteToDebug("SSP is not supported in this LMS, returning empty string."),"")}function SCORM2004_PutDataInBucket(e,t,r){return WriteToDebug("In SCORM2004_PutDataInBucket, strBucketId="+e+", blnAppendToEnd="+r+", strData="+t),SCORM2004_DetectSSPSupport()?SCORM2004_CallSetValue(1==r?"ssp.appendData":"ssp.data","{bucketID="+e+"}"+t):(WriteToDebug("SSP is not supported in this LMS, returning false."),!1)}function SCORM2004_DetectSSPSupport(){if(WriteToDebug("In SCORM2004_DetectSSPSupport"),1==blnSCORM2004_SSP_Is_Supported)return WriteToDebug("Support already detected, returning true"),!0;if(0==blnSCORM2004_SSP_Is_Supported)return WriteToDebug("Support already determined to me missing, returning false"),!1;SCORM2004_CallGetValue("ssp._count");return SCORM2004_GetLastError()==NO_ERROR?(WriteToDebug("SSP data model call succeeded, SSP is supported"),blnSCORM2004_SSP_Is_Supported=!0,!0):(WriteToDebug("SSP data model call failed, SSP is NOT supported"),blnSCORM2004_SSP_Is_Supported=!1,!1)}function SCORM2004_GetBucketInfo(e){WriteToDebug("In SCORM2004_GetBucketInfo, strBucketId="+e);var t=0,r=0,n=new String(SCORM2004_CallGetValue("ssp.bucket_state.{bucketID="+e+"}"));if(""==n||null==n||null==n)return WriteToDebug("Could not retrieve bucket state, returning 0 total size and 0 used size"),new SSPBucketSize(0,0);var i=n.split("{");for(var o in i)0==(o=(o=new String(i[o])).replace("}","")).indexOf("totalSpace",0)?(WriteToDebug("Found total space"),WriteToDebug("total space="+(t=parseInt(o.substr(11),10)))):0==o.indexOf("used",0)&&(WriteToDebug("Found used space"),WriteToDebug("used="+(r=parseInt(o.substr(5),10))));return new SSPBucketSize(t,r)}function SCORM2004_DoesBucketExist(e){WriteToDebug("In SCORM2004_DoesBucketExist, strBucketId="+e);var t=SCORM2004_CallGetValue("ssp._count");t=parseInt(t,10);for(var r=0;r<t;r++)if(e==SCORM2004_CallGetValue("ssp."+r+".id"))return WriteToDebug("Bucket '"+e+"' Exists"),!0;return WriteToDebug("Bucket '"+e+"' DOES NOT Exist"),!1}function SCORM2004_SetNavigationRequest(e){WriteToDebug("In SCORM2004_SetNavigationRequest, strNavRequest="+e),SCORM2004_ClearErrorInfo();if(e.match(/^\{target=[.A-Za-z0-9_-]+\}choice$/))return SCORM2004_CallSetValue("adl.nav.request",e),!0;switch(e){case"continue":case"previous":case"exit":case"exitAll":case"abandon":case"abandonAll":case"suspendAll":case"_none_":break;default:return WriteToDebug("In SCORM2004_SetNavigationRequest, NavRequest is not valid - strNavRequest="+e),!1}return SCORM2004_CallSetValue("adl.nav.request",e),!0}function SCORM2004_GetNavigationRequest(){return WriteToDebug("In SCORM2004_GetNavigationRequest"),SCORM2004_ClearErrorInfo(),SCORM2004_CallGetValue("adl.nav.request")}function SCORM2004_CallInitialize(){var e;return WriteToDebug("In SCORM2004_CallInitialize"),SCORM2004_objAPI=SCORM2004_GrabAPI(),WriteToDebug("Calling Initialize"),e=SCORM2004_objAPI.Initialize(""),WriteToDebug("strResult="+(e+="")),e==SCORM2004_FALSE?(WriteToDebug("Detected failed call to initialize"),SCORM2004_SetErrorInfo(),WriteToDebug("Error calling Initialize:"),WriteToDebug("              Error Number="+intSCORM2004Error),WriteToDebug("              Error String="+strSCORM2004ErrorString),WriteToDebug("              Diagnostic="+strSCORM2004ErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0)}function SCORM2004_CallSetValue(e,t){var r;return WriteToDebug("SCORM2004_CallSetValue strElement="+e+", strValue="+t),!0===blnReviewModeSoReadOnly?(WriteToDebug("Mode is Review and configuration setting dictates this should be read only so exiting."),!0):(SCORM2004_objAPI=SCORM2004_GrabAPI(),WriteToDebug("Calling SetValue"),e+="",t+="",r=SCORM2004_objAPI.SetValue(e,t),WriteToDebug("strResult="+(r+="")),r==SCORM2004_FALSE?(WriteToDebug("Detected Failed call to SetValue"),SCORM2004_SetErrorInfo(),WriteToDebug("Error calling SetValue:"),WriteToDebug("              strElement="+e),WriteToDebug("              strValue="+t),WriteToDebug("              Error Number="+intSCORM2004Error),WriteToDebug("              Error String="+strSCORM2004ErrorString),WriteToDebug("              Diagnostic="+strSCORM2004ErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0))}function SCORM2004_CallGetValue(e){var t;return WriteToDebug("In SCORM2004_CallGetValue strElement="+e),SCORM2004_objAPI=SCORM2004_GrabAPI(),WriteToDebug("Call GetValue"),e+="",WriteToDebug("strResult="+(t=SCORM2004_objAPI.GetValue(e)+"")),intSCORM2004Error=SCORM2004_objAPI.GetLastError(),WriteToDebug("intSCORM2004Error="+(intSCORM2004Error+="")),intSCORM2004Error!=SCORM2004_NO_ERROR&&(WriteToDebug("Detected failed called to GetValue"),SCORM2004_SetErrorInfo(),WriteToDebug("Error calling LMSGetValue:"),WriteToDebug("              strElement="+e),WriteToDebug("              Error Number="+intSCORM2004Error),WriteToDebug("              Error String="+strSCORM2004ErrorString),WriteToDebug("              Diagnostic="+strSCORM2004ErrorDiagnostic)),WriteToDebug("Returning "+t),t}function SCORM2004_CallCommit(){var e;return WriteToDebug("In SCORM2004_CallCommit"),SCORM2004_objAPI=SCORM2004_GrabAPI(),WriteToDebug("Calling Commit"),e=SCORM2004_objAPI.Commit(""),WriteToDebug("strResult="+(e+="")),e==SCORM2004_FALSE?(WriteToDebug("Detected failed call to Commit"),SCORM2004_SetErrorInfo(),WriteToDebug("Error calling Commit:"),WriteToDebug("              Error Number="+intSCORM2004Error),WriteToDebug("              Error String="+strSCORM2004ErrorString),WriteToDebug("              Diagnostic="+strSCORM2004ErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0)}function SCORM2004_CallTerminate(){var e;return WriteToDebug("In SCORM2004_CallTerminate"),SCORM2004_objAPI=SCORM2004_GrabAPI(),WriteToDebug("Calling Terminate"),e=SCORM2004_objAPI.Terminate(""),WriteToDebug("strResult="+(e+="")),e==SCORM2004_FALSE?(WriteToDebug("Detected failed call to Terminate"),SCORM2004_SetErrorInfo(),WriteToDebug("Error calling Terminate:"),WriteToDebug("              Error Number="+intSCORM2004Error),WriteToDebug("              Error String="+strSCORM2004ErrorString),WriteToDebug("              Diagnostic="+strSCORM2004ErrorDiagnostic),!1):(WriteToDebug("Returning True"),!0)}function SCORM2004_ClearErrorInfo(){WriteToDebug("In SCORM2004_ClearErrorInfo"),intSCORM2004Error=SCORM2004_NO_ERROR,strSCORM2004ErrorString="",strSCORM2004ErrorDiagnostic=""}function SCORM2004_SetErrorInfo(){WriteToDebug("In SCORM2004_SetErrorInfo"),intSCORM2004Error=SCORM2004_objAPI.GetLastError(),strSCORM2004ErrorString=SCORM2004_objAPI.GetErrorString(intSCORM2004Error),strSCORM2004ErrorDiagnostic=SCORM2004_objAPI.GetDiagnostic(""),strSCORM2004ErrorString+="",strSCORM2004ErrorDiagnostic+="",WriteToDebug("intSCORM2004Error="+(intSCORM2004Error+="")),WriteToDebug("strSCORM2004ErrorString="+strSCORM2004ErrorString),WriteToDebug("strSCORM2004ErrorDiagnostic="+strSCORM2004ErrorDiagnostic)}function SCORM2004_SetErrorInfoManually(e,t,r){WriteToDebug("In SCORM2004_SetErrorInfoManually"),WriteToDebug("ERROR-Num="+e),WriteToDebug("      String="+t),WriteToDebug("      Diag="+r),intSCORM2004Error=e,strSCORM2004ErrorString=t,strSCORM2004ErrorDiagnostic=r}function SCORM2004_GetLastError(){return WriteToDebug("In SCORM2004_GetLastError"),intSCORM2004Error==SCORM2004_NO_ERROR?(WriteToDebug("Returning No Error"),NO_ERROR):(WriteToDebug("Returning "+intSCORMError),intSCORM2004Error)}function SCORM2004_GetLastErrorDesc(){return WriteToDebug("In SCORM2004_GetLastErrorDesc, "+strSCORM2004ErrorString+"\n"+strSCORM2004ErrorDiagnostic),strSCORM2004ErrorString+"\n"+strSCORM2004ErrorDiagnostic}function SCORM2004_GrabAPI(){return WriteToDebug("In SCORM2004_GrabAPI"),void 0!==SCORM2004_objAPI&&null!=SCORM2004_objAPI||(WriteToDebug("Searching with Rustici Software algorithm"),SCORM2004_objAPI=SCORM2004_GetAPI()),void 0!==SCORM2004_objAPI&&null!=SCORM2004_objAPI&&0!=SCORM2004_objAPI||(WriteToDebug("Searching with SearchForAPI"),SCORM2004_objAPI=SCORM2004_SearchForAPI(window)),WriteToDebug("Grab API, returning, found API = "+(null!=SCORM2004_objAPI)),SCORM2004_objAPI}function SCORM2004_ScanParentsForApi(e){for(var t=0;(null==e.API_1484_11||null==e.API_1484_11)&&null!=e.parent&&e.parent!=e&&t<=500;)t++,e=e.parent;return e.API_1484_11}function SCORM2004_GetAPI(){var e=null;return null!=window.API_1484_11?(WriteToDebug("SCORM_GetAPI, bypassing normal processes and grabbing proxy API..."),window.API_1484_11):(null!=window.parent&&window.parent!=window&&(e=SCORM2004_ScanParentsForApi(window.parent)),null==e&&null!=window.top.opener&&(e=SCORM2004_ScanParentsForApi(window.top.opener)),e)}function SCORM2004_SearchForAPI(e){WriteToDebug("SCORM2004_SearchForAPI");var t,r=null;return t="Name="+e.name+", href="+e.location.href,SCORM2004_APIFound(r=e.API_1484_11)?(WriteToDebug("Found API in this window - "+t),r):(SCORM2004_WindowHasParent(e)&&(WriteToDebug("Searching Parent - "+t),r=SCORM2004_SearchForAPI(e.parent)),SCORM2004_APIFound(r)?(WriteToDebug("Found API in a parent - "+t),r):(SCORM2004_WindowHasOpener(e)&&(WriteToDebug("Searching Opener - "+t),r=SCORM2004_SearchForAPI(e.opener)),SCORM2004_APIFound(r)?(WriteToDebug("Found API in an opener - "+t),r):(WriteToDebug("Looking in children - "+t),SCORM2004_APIFound(r=SCORM2004_LookInChildren(e))?(WriteToDebug("Found API in Children - "+t),r):(WriteToDebug("Didn't find API in this window - "+t),null))))}function SCORM2004_LookInChildren(e){WriteToDebug("SCORM2004_LookInChildren");var t,r=null;t="Name="+e.name+", href="+e.location.href;for(var n=0;n<e.frames.length;n++){if(WriteToDebug("Looking in child frame "+n),SCORM2004_APIFound(r=e.frames[n].API_1484_11))return WriteToDebug("Found API in child frame of "+t),r;if(WriteToDebug("Looking in this child's children "+t),SCORM2004_APIFound(r=SCORM2004_LookInChildren(e.frames[n])))return WriteToDebug("API found in this child's children "+t),r}return null}function SCORM2004_WindowHasOpener(e){return WriteToDebug("In SCORM2004_WindowHasOpener"),null!=e.opener&&e.opener!=e&&void 0!==e.opener?(WriteToDebug("Window Does Have Opener"),!0):(WriteToDebug("Window Does Not Have Opener"),!1)}function SCORM2004_WindowHasParent(e){return WriteToDebug("In SCORM2004_WindowHasParent"),null!=e.parent&&e.parent!=e&&void 0!==e.parent?(WriteToDebug("Window Does Have Parent"),!0):(WriteToDebug("Window Does Not Have Parent"),!1)}function SCORM2004_APIFound(e){return WriteToDebug("In SCORM2004_APIFound"),null==e||void 0===e?(WriteToDebug("API NOT Found"),!1):(WriteToDebug("API Found"),!0)}STANDARD="SCORM";var SCORM_LOGOUT="logout",SCORM_SUSPEND="suspend",SCORM_NORMAL_EXIT="",SCORM_TIMEOUT="time-out",SCORM_PASSED="passed",SCORM_FAILED="failed",SCORM_COMPLETED="completed",SCORM_BROWSED="browsed",SCORM_INCOMPLETE="incomplete",SCORM_NOT_ATTEMPTED="not attempted",SCORM_CREDIT="credit",SCORM_NO_CREDIT="no-credit",SCORM_BROWSE="browse",SCORM_NORMAL="normal",SCORM_REVIEW="review",SCORM_ENTRY_ABINITIO="ab-initio",SCORM_ENTRY_RESUME="resume",SCORM_ENTRY_NORMAL="",SCORM_TLA_EXIT_MESSAGE="exit,message",SCORM_TLA_EXIT_NO_MESSAGE="exit,no message",SCORM_TLA_CONTINUE_MESSAGE="continue,message",SCORM_TLA_CONTINUE_NO_MESSAGE="continue,no message",SCORM_RESULT_CORRECT="correct",SCORM_RESULT_WRONG="wrong",SCORM_RESULT_UNANTICIPATED="unanticipated",SCORM_RESULT_NEUTRAL="neutral",SCORM_INTERACTION_TYPE_TRUE_FALSE="true-false",SCORM_INTERACTION_TYPE_CHOICE="choice",SCORM_INTERACTION_FILL_IN="fill-in",SCORM_INTERACTION_TYPE_MATCHING="matching",SCORM_INTERACTION_TYPE_PERFORMANCE="performance",SCORM_INTERACTION_TYPE_SEQUENCING="sequencing",SCORM_INTERACTION_TYPE_LIKERT="likert",SCORM_INTERACTION_TYPE_NUMERIC="numeric",SCORM_NO_ERROR="0",SCORM_ERROR_INVALID_PREFERENCE="-1",SCORM_ERROR_INVALID_STATUS="-2",SCORM_ERROR_INVALID_SPEED="-3",SCORM_ERROR_INVALID_TIMESPAN="-4",SCORM_ERROR_INVALID_TIME_LIMIT_ACTION="-5",SCORM_ERROR_INVALID_DECIMAL="-6",SCORM_ERROR_INVALID_CREDIT="-7",SCORM_ERROR_INVALID_LESSON_MODE="-8",SCORM_ERROR_INVALID_ENTRY="-9",SCORM_TRUE="true",SCORM_FALSE="false",SCORM_findAPITries=0,SCORM_objAPI=null,SCORM_blnUsingProxyAPI=!1,intSCORMError=SCORM_NO_ERROR,strSCORMErrorString="",strSCORMErrorDiagnostic="";blnReviewModeSoReadOnly=!1;function SCORM_Initialize(){var e=!0;WriteToDebug("In SCORM_Initialize"),SCORM_ClearErrorInfo(),WriteToDebug("Grabbing API");try{SCORM_objAPI=SCORM_GrabAPI()}catch(e){WriteToDebug("Error grabbing 1.2 API-"+e.name+":"+e.message)}return void 0===SCORM_objAPI||null==SCORM_objAPI?(WriteToDebug("Unable to acquire SCORM API:"),WriteToDebug("SCORM_objAPI="+typeof SCORM_objAPI),InitializeExecuted(!1,"Error - unable to acquire LMS API, content may not play properly and results may not be recorded.  Please contact technical support."),!1):(WriteToDebug("Calling LMSInit"),(e=SCORM_CallLMSInitialize())?(SCORM_GetLessonMode()!=MODE_REVIEW?(SCORM_IsContentInBrowseMode()?(WriteToDebug("Setting Status to Browsed"),e=SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_BROWSED)):PREVENT_STATUS_CHANGE_DURING_INIT||SCORM_GetStatus()==LESSON_STATUS_NOT_ATTEMPTED&&(WriteToDebug("Setting Status to Incomplete"),e=SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_INCOMPLETE)),e=SCORM_CallLMSSetValue("cmi.core.exit",SCORM_TranslateExitTypeToSCORM(DEFAULT_EXIT_TYPE))&&e):void 0!==REVIEW_MODE_IS_READ_ONLY&&!0===REVIEW_MODE_IS_READ_ONLY&&(blnReviewModeSoReadOnly=!0),WriteToDebug("Calling InitializeExecuted with parameter-"+e),void InitializeExecuted(e,"")):(WriteToDebug("ERROR Initializing LMS"),InitializeExecuted(!1,"Error initializing communications with LMS"),!1))}function SCORM_Finish(e,t){var r,n=!0;return WriteToDebug("In SCORM_Finish strExitType="+e+", blnStatusWasSet="+t),SCORM_ClearErrorInfo(),e!=EXIT_TYPE_FINISH||t||(WriteToDebug("Getting completion status"),WriteToDebug("Setting completion status to "+(r=SCORM_GetCompletionStatus())),n=SCORM_CallLMSSetValue("cmi.core.lesson_status",r)&&n),WriteToDebug("Setting Exit"),n=SCORM_CallLMSSetValue("cmi.core.exit",SCORM_TranslateExitTypeToSCORM(e))&&n,WriteToDebug("Calling Commit"),n=SCORM_CallLMSCommit()&&n,WriteToDebug("Calling Finish"),WriteToDebug("Returning "+(n=SCORM_CallLMSFinish()&&n)),n}function SCORM_CommitData(){return WriteToDebug("In SCORM_CommitData"),SCORM_ClearErrorInfo(),SCORM_CallLMSCommit()}function SCORM_GetStudentID(){return WriteToDebug("In SCORM_GetStudentID"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.core.student_id")}function SCORM_GetStudentName(){return WriteToDebug("In SCORM_GetStudentName"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.core.student_name")}function SCORM_GetBookmark(){return WriteToDebug("In SCORM_GetBookmark"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.core.lesson_location")}function SCORM_SetBookmark(e){return WriteToDebug("In SCORM_SetBookmark strBookmark="+e),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.core.lesson_location",e)}function SCORM_GetDataChunk(){return WriteToDebug("In SCORM_GetDataChunk"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.suspend_data")}function SCORM_SetDataChunk(e){return WriteToDebug("In SCORM_SetDataChunk"),SCORM_ClearErrorInfo(),1==USE_STRICT_SUSPEND_DATA_LIMITS&&e.length>4096?(WriteToDebug("SCORM_SetDataChunk - suspend_data too large (4096 character limit for SCORM 1.2)"),!1):SCORM_CallLMSSetValue("cmi.suspend_data",e)}function SCORM_GetLaunchData(){return WriteToDebug("In SCORM_GetLaunchData"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.launch_data")}function SCORM_GetComments(){return WriteToDebug("In SCORM_GetComments"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.comments")}function SCORM_WriteComment(e){return WriteToDebug("In SCORM_WriteComment strComment="+e),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.comments",e)}function SCORM_GetLMSComments(){return WriteToDebug("In SCORM_GetLMSComments"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.comments_from_lms")}function SCORM_GetAudioPlayPreference(){var e;return WriteToDebug("In SCORM_GetAudioPlayPreference"),SCORM_ClearErrorInfo(),""==(e=SCORM_CallLMSGetValue("cmi.student_preference.audio"))&&(e=0),WriteToDebug("intTempPreference="+(e=parseInt(e,10))),e>0?(WriteToDebug("Returning On"),PREFERENCE_ON):0==e?(WriteToDebug("Returning Default"),PREFERENCE_DEFAULT):e<0?(WriteToDebug("returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+e),null)}function SCORM_GetAudioVolumePreference(){var e;return WriteToDebug("In SCORM_GetAudioVollumePreference"),SCORM_ClearErrorInfo(),WriteToDebug("intTempPreference="+(e=SCORM_CallLMSGetValue("cmi.student_preference.audio"))),""==e&&(e=100),(e=parseInt(e,10))<=0&&(WriteToDebug("Setting to 100"),e=100),e>0&&e<=100?(WriteToDebug("Returning "+e),e):(WriteToDebug("ERROR: invalid preference"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+e),null)}function SCORM_SetAudioPreference(e,t){return WriteToDebug("In SCORM_SetAudioPreference PlayPreference="+e+", intPercentOfMaxVolume="+t),SCORM_ClearErrorInfo(),e==PREFERENCE_OFF&&(WriteToDebug("Setting percent to -1 - OFF"),t=-1),SCORM_CallLMSSetValue("cmi.student_preference.audio",t)}function SCORM_SetLanguagePreference(e){return WriteToDebug("In SCORM_SetLanguagePreference strLanguage="+e),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.student_preference.language",e)}function SCORM_GetLanguagePreference(){return WriteToDebug("In SCORM_GetLanguagePreference"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.student_preference.language")}function SCORM_SetSpeedPreference(e){var t;return WriteToDebug("In SCORM_SetSpeedPreference intPercentOfMax="+e),SCORM_ClearErrorInfo(),WriteToDebug("intSCORMSpeed="+(t=2*e-100)),SCORM_CallLMSSetValue("cmi.student_preference.speed",t)}function SCORM_GetSpeedPreference(){var e,t;return WriteToDebug("In SCORM_GetSpeedPreference"),SCORM_ClearErrorInfo(),WriteToDebug("intSCORMSpeed="+(e=SCORM_CallLMSGetValue("cmi.student_preference.speed"))),""==e&&(WriteToDebug("Detected empty string, defaulting to 100"),e=100),ValidInteger(e)?(e=parseInt(e,10))<-100||e>100?(WriteToDebug("ERROR - out of range"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range","intSCORMSpeed="+e),null):(t=(e+100)/2,WriteToDebug("Returning "+(t=parseInt(t,10))),t):(WriteToDebug("ERROR - invalid integer"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer","intSCORMSpeed="+e),null)}function SCORM_SetTextPreference(e){return WriteToDebug("In SCORM_SetTextPreference intPreference="+e),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.student_preference.text",e)}function SCORM_GetTextPreference(){var e;return WriteToDebug("In SCORM_GetTextPreference"),SCORM_ClearErrorInfo(),e=SCORM_CallLMSGetValue("cmi.student_preference.text"),WriteToDebug("intTempPreference="+(e=parseInt(e,10))),e>0?(WriteToDebug("Returning On"),PREFERENCE_ON):0==e||""==e?(WriteToDebug("Returning Default"),PREFERENCE_DEFAULT):e<0?(WriteToDebug("returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+e),null)}function SCORM_GetPreviouslyAccumulatedTime(){var e,t;return WriteToDebug("In SCORM_GetPreviouslyAccumulatedTime"),SCORM_ClearErrorInfo(),WriteToDebug("strCMITime="+(e=SCORM_CallLMSGetValue("cmi.core.total_time"))),IsValidCMITimeSpan(e)?(WriteToDebug("Returning "+(t=ConvertCMITimeSpanToMS(e))),t):(WriteToDebug("ERROR - Invalid CMITimeSpan"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+e),null)}function SCORM_SaveTime(e){var t;return WriteToDebug("In SCORM_SaveTime intMilliSeconds="+e),SCORM_ClearErrorInfo(),WriteToDebug("strCMITime="+(t=ConvertMilliSecondsToSCORMTime(e,!0))),SCORM_CallLMSSetValue("cmi.core.session_time",t)}function SCORM_GetMaxTimeAllowed(){var e,t;return WriteToDebug("In SCORM_GetMaxTimeAllowed"),SCORM_ClearErrorInfo(),WriteToDebug("strCMITime="+(e=SCORM_CallLMSGetValue("cmi.student_data.max_time_allowed"))),""==e&&(e="9999:99:99.99"),IsValidCMITimeSpan(e)?(WriteToDebug("intMilliseconds="+(t=ConvertCMITimeSpanToMS(e))),t):(WriteToDebug("ERROR - Invalid CMITimeSpan"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+e),null)}function SCORM_DisplayMessageOnTimeout(){var e;return SCORM_ClearErrorInfo(),WriteToDebug("In SCORM_DisplayMessageOnTimeout"),WriteToDebug("strTLA="+(e=SCORM_CallLMSGetValue("cmi.student_data.time_limit_action"))),e==SCORM_TLA_EXIT_MESSAGE||e==SCORM_TLA_CONTINUE_MESSAGE?(WriteToDebug("returning true"),!0):e==SCORM_TLA_EXIT_NO_MESSAGE||e==SCORM_TLA_CONTINUE_NO_MESSAGE||""==e?(WriteToDebug("returning false"),!1):(WriteToDebug("Error invalid TLA"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+e),null)}function SCORM_ExitOnTimeout(){var e;return WriteToDebug("In SCORM_ExitOnTimeout"),SCORM_ClearErrorInfo(),WriteToDebug("strTLA="+(e=SCORM_CallLMSGetValue("cmi.student_data.time_limit_action"))),e==SCORM_TLA_EXIT_MESSAGE||e==SCORM_TLA_EXIT_NO_MESSAGE?(WriteToDebug("returning true"),!0):e==SCORM_TLA_CONTINUE_MESSAGE||e==SCORM_TLA_CONTINUE_NO_MESSAGE||""==e?(WriteToDebug("returning false"),!1):(WriteToDebug("ERROR invalid TLA"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+e),null)}function SCORM_GetPassingScore(){var e;return WriteToDebug("In SCORM_GetPassingScore"),SCORM_ClearErrorInfo(),WriteToDebug("fltScore="+(e=SCORM_CallLMSGetValue("cmi.student_data.mastery_score"))),""==e&&(e=0),IsValidDecimal(e)?(e=parseFloat(e),WriteToDebug("returning fltScore"),e):(WriteToDebug("Error - score is not a valid decimal"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_DECIMAL,"Invalid mastery score received from LMS","fltScore="+e),null)}function SCORM_SetScore(e,t,r){var n;return WriteToDebug("In SCORM_SetScore intScore="+(e=RoundToPrecision(e,7))+", intMaxScore="+(t=RoundToPrecision(t,7))+", intMinScore="+(r=RoundToPrecision(r,7))),SCORM_ClearErrorInfo(),n=SCORM_CallLMSSetValue("cmi.core.score.raw",e),n=SCORM_CallLMSSetValue("cmi.core.score.max",t)&&n,WriteToDebug("Returning "+(n=SCORM_CallLMSSetValue("cmi.core.score.min",r)&&n)),n}function SCORM_GetScore(){return WriteToDebug("In SCORM_GetScore"),SCORM_ClearErrorInfo(),SCORM_CallLMSGetValue("cmi.core.score.raw")}function SCORM_SetPointBasedScore(e,t,r){return WriteToDebug("SCORM_SetPointBasedScore - SCORM 1.1 and 1.2 do not support SetPointBasedScore, falling back to SetScore"),SCORM_SetScore(e,t,r)}function SCORM_GetScaledScore(e,t,r){return WriteToDebug("SCORM_GetScaledScore - SCORM 1.1 and 1.2 do not support GetScaledScore, returning false"),!1}function SCORM_RecordInteraction(e,t,r,n,i,o,a,s,u,c,l,C){var I,_,S,T;return SCORM_ClearErrorInfo(),WriteToDebug("intInteractionIndex="+(S=SCORM_CallLMSGetValue("cmi.interactions._count"))),""==S&&(WriteToDebug("Setting Interaction Index to 0"),S=0),IsNumeric(r)?T=r:1==r||r==INTERACTION_RESULT_CORRECT?T=SCORM_RESULT_CORRECT:""==r||"false"==r||r==INTERACTION_RESULT_WRONG?T=SCORM_RESULT_WRONG:r==INTERACTION_RESULT_UNANTICIPATED?T=SCORM_RESULT_UNANTICIPATED:r==INTERACTION_RESULT_NEUTRAL&&(T=SCORM_RESULT_NEUTRAL),WriteToDebug("strResult="+T),I=SCORM_CallLMSSetValue("cmi.interactions."+S+".id",e),I=SCORM_CallLMSSetValue("cmi.interactions."+S+".type",c)&&I,null!==t&&0==(_=SCORM_CallLMSSetValue("cmi.interactions."+S+".student_response",t))&&null!==l&&1==(_=SCORM_CallLMSSetValue("cmi.interactions."+S+".student_response",l))&&SCORM_ClearErrorInfo(),I=I&&_,null!=n&&null!=n&&""!=n&&(0==(_=SCORM_CallLMSSetValue("cmi.interactions."+S+".correct_responses.0.pattern",n))&&1==(_=SCORM_CallLMSSetValue("cmi.interactions."+S+".correct_responses.0.pattern",C))&&SCORM_ClearErrorInfo(),I=I&&_),null!=T&&null!=T&&""!=T&&(I=SCORM_CallLMSSetValue("cmi.interactions."+S+".result",T)&&I),null!=o&&null!=o&&""!=o&&(I=SCORM_CallLMSSetValue("cmi.interactions."+S+".weighting",o)&&I),null!=a&&null!=a&&""!=a&&(I=SCORM_CallLMSSetValue("cmi.interactions."+S+".latency",ConvertMilliSecondsToSCORMTime(a,!0))&&I),null!=s&&null!=s&&""!=s&&(I=SCORM_CallLMSSetValue("cmi.interactions."+S+".objectives.0.id",s)&&I),WriteToDebug("Returning "+(I=SCORM_CallLMSSetValue("cmi.interactions."+S+".time",ConvertDateToCMITime(u))&&I)),I}function SCORM_RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM_RecordTrueFalseInteraction strID="+e+", strResponse="+c+", blnCorrect="+r+", strCorrectResponse="+l+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null;return 1==t?c="t":null!==t&&(c="f"),1==n?l="t":0==n&&(l="f"),SCORM_RecordInteraction(e,c,r,l,i,o,a,s,u,SCORM_INTERACTION_TYPE_TRUE_FALSE,c,l)}function SCORM_RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM_RecordMultipleChoiceInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C="",I="";if(null!==t){c="",l="";for(var _=0;_<t.length;_++)c.length>0&&(c+=","),l.length>0&&(l+=","),c+=t[_].Short,l+=t[_].Long}for(_=0;_<n.length;_++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=n[_].Short,I+=n[_].Long;return SCORM_blnUsingProxyAPI?SCORM_RecordInteraction(e,c,r,C,i,o,a,s,u,SCORM_INTERACTION_TYPE_CHOICE,l,I):SCORM_RecordInteraction(e,l,r,I,i,o,a,s,u,SCORM_INTERACTION_TYPE_CHOICE,c,C)}function SCORM_RecordFillInInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In SCORM_RecordFillInInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),(t=new String(t)).length>255&&(t=t.substr(0,255)),null==n&&(n=""),(n=new String(n)).length>255&&(n=n.substr(0,255)),SCORM_RecordInteraction(e,t,r,n,i,o,a,s,u,SCORM_INTERACTION_FILL_IN,t,n)}function SCORM_RecordMatchingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM_RecordMatchingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C="",I="";if(null!==t){c="",l="";for(var _=0;_<t.length;_++)c.length>0&&(c+=","),l.length>0&&(l+=","),c+=t[_].Source.Short+"."+t[_].Target.Short,l+=t[_].Source.Long+"."+t[_].Target.Long}for(_=0;_<n.length;_++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=n[_].Source.Short+"."+n[_].Target.Short,I+=n[_].Source.Long+"."+n[_].Target.Long;return SCORM_blnUsingProxyAPI?SCORM_RecordInteraction(e,c,r,C,i,o,a,s,u,SCORM_INTERACTION_TYPE_MATCHING,l,I):SCORM_RecordInteraction(e,l,r,I,i,o,a,s,u,SCORM_INTERACTION_TYPE_MATCHING,c,C)}function SCORM_RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In SCORM_RecordPerformanceInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!==t&&(t=new String(t)).length>255&&(t=t.substr(0,255)),null==n&&(n=""),(n=new String(n)).length>255&&(n=n.substr(0,255)),SCORM_RecordInteraction(e,t,r,n,i,o,a,s,u,SCORM_INTERACTION_TYPE_PERFORMANCE,t,n)}function SCORM_RecordSequencingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM_RecordSequencingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C="",I="";if(null!==t){c="",l="";for(var _=0;_<t.length;_++)c.length>0&&(c+=","),l.length>0&&(l+=","),c+=t[_].Short,l+=t[_].Long}for(_=0;_<n.length;_++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=n[_].Short,I+=n[_].Long;return SCORM_blnUsingProxyAPI?SCORM_RecordInteraction(e,c,r,C,i,o,a,s,u,SCORM_INTERACTION_TYPE_SEQUENCING,l,I):SCORM_RecordInteraction(e,l,r,I,i,o,a,s,u,SCORM_INTERACTION_TYPE_SEQUENCING,c,C)}function SCORM_RecordLikertInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In SCORM_RecordLikertInteraction strID="+e+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C="",I="";return null!==t&&(c=t.Short,l=t.Long),null!=n&&(C=n.Short,I=n.Long),SCORM_blnUsingProxyAPI?SCORM_RecordInteraction(e,c,r,C,i,o,a,s,u,SCORM_INTERACTION_TYPE_LIKERT,l,I):SCORM_RecordInteraction(e,l,r,I,i,o,a,s,u,SCORM_INTERACTION_TYPE_LIKERT,c,C)}function SCORM_RecordNumericInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In SCORM_RecordNumericInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null==n||null==n||(IsValidDecimalRange(n)&&(n=ConvertDecimalRangeToDecimalBasedOnLearnerResponse(n,t,r)),IsValidDecimal(n))?SCORM_RecordInteraction(e,t,r,n,i,o,a,s,u,SCORM_INTERACTION_TYPE_NUMERIC,t,n):(WriteToDebug("Returning False - SCORM_RecordNumericInteraction received invalid correct response (not a decimal), strCorrectResponse="+n),!1)}function SCORM_GetEntryMode(){var e;return WriteToDebug("In SCORM_GetEntryMode"),SCORM_ClearErrorInfo(),WriteToDebug("strEntry="+(e=SCORM_CallLMSGetValue("cmi.core.entry"))),e==SCORM_ENTRY_ABINITIO?(WriteToDebug("Returning first time"),ENTRY_FIRST_TIME):e==SCORM_ENTRY_RESUME?(WriteToDebug("Returning resume"),ENTRY_RESUME):e==SCORM_ENTRY_NORMAL?(WriteToDebug("returning normal"),ENTRY_REVIEW):(WriteToDebug("ERROR - invalide entry mode"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_ENTRY,"Invalid entry vocab received from LMS","strEntry="+e),null)}function SCORM_GetLessonMode(){var e;return WriteToDebug("In SCORM_GetLessonMode"),SCORM_ClearErrorInfo(),WriteToDebug("strLessonMode="+(e=SCORM_CallLMSGetValue("cmi.core.lesson_mode"))),e==SCORM_BROWSE?(WriteToDebug("Returning browse"),MODE_BROWSE):e==SCORM_NORMAL?(WriteToDebug("returning normal"),MODE_NORMAL):e==SCORM_REVIEW?(WriteToDebug("Returning Review"),MODE_REVIEW):(WriteToDebug("ERROR - invalid lesson mode"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_LESSON_MODE,"Invalid lesson_mode vocab received from LMS","strLessonMode="+e),null)}function SCORM_GetTakingForCredit(){var e;return WriteToDebug("In SCORM_GetTakingForCredit"),SCORM_ClearErrorInfo(),WriteToDebug("strCredit="+(e=SCORM_CallLMSGetValue("cmi.core.credit"))),"credit"==e?(WriteToDebug("Returning true"),!0):"no-credit"==e?(WriteToDebug("Returning false"),!1):(WriteToDebug("ERROR - invalid credit"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_CREDIT,"Invalid credit vocab received from LMS","strCredit="+e),null)}function SCORM_SetObjectiveScore(e,t,r,n){var i,o;return WriteToDebug("In SCORM_SetObjectiveScore, strObejctiveID="+e+", intScore="+(t=RoundToPrecision(t,7))+", intMaxScore="+(r=RoundToPrecision(r,7))+", intMinScore="+(n=RoundToPrecision(n,7))),SCORM_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(i=SCORM_FindObjectiveIndexFromID(e))),o=SCORM_CallLMSSetValue("cmi.objectives."+i+".id",e),o=SCORM_CallLMSSetValue("cmi.objectives."+i+".score.raw",t)&&o,o=SCORM_CallLMSSetValue("cmi.objectives."+i+".score.max",r)&&o,WriteToDebug("Returning "+(o=SCORM_CallLMSSetValue("cmi.objectives."+i+".score.min",n)&&o)),o}function SCORM_SetObjectiveDescription(e,t){var r;return WriteToDebug("In SCORM_SetObjectiveDescription, strObjectiveDescription="+t),WriteToDebug("Objective Descriptions are not supported prior to SCORM 2004"),SCORM_ClearErrorInfo(),WriteToDebug("Returning "+(r=SCORM_TRUE)),r}function SCORM_SetObjectiveStatus(e,t){var r,n,i="";return WriteToDebug("In SCORM_SetObjectiveStatus strObjectiveID="+e+", Lesson_Status="+t),SCORM_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(r=SCORM_FindObjectiveIndexFromID(e))),t==LESSON_STATUS_PASSED?i=SCORM_PASSED:t==LESSON_STATUS_FAILED?i=SCORM_FAILED:t==LESSON_STATUS_COMPLETED?i=SCORM_COMPLETED:t==LESSON_STATUS_BROWSED?i=SCORM_BROWSED:t==LESSON_STATUS_INCOMPLETE?i=SCORM_INCOMPLETE:t==LESSON_STATUS_NOT_ATTEMPTED&&(i=SCORM_NOT_ATTEMPTED),WriteToDebug("strSCORMStatus="+i),n=SCORM_CallLMSSetValue("cmi.objectives."+r+".id",e),WriteToDebug("Returning "+(n=SCORM_CallLMSSetValue("cmi.objectives."+r+".status",i)&&n)),n}function SCORM_GetObjectiveScore(e){var t;return WriteToDebug("In SCORM_GetObjectiveScore, strObejctiveID="+e),SCORM_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(t=SCORM_FindObjectiveIndexFromID(e))),SCORM_CallLMSGetValue("cmi.objectives."+t+".score.raw")}function SCORM_GetObjectiveDescription(e){return WriteToDebug("In SCORM_GetObjectiveDescription, strObejctiveID="+e),WriteToDebug("ObjectiveDescription is not supported prior to SCORM 2004"),""}function SCORM_GetObjectiveStatus(e){var t,r;return WriteToDebug("In SCORM_GetObjectiveStatus, strObejctiveID="+e),SCORM_ClearErrorInfo(),WriteToDebug("intObjectiveIndex="+(t=SCORM_FindObjectiveIndexFromID(e))),(r=SCORM_CallLMSGetValue("cmi.objectives."+t+".status"))==SCORM_PASSED?(WriteToDebug("returning Passed"),LESSON_STATUS_PASSED):r==SCORM_FAILED?(WriteToDebug("Returning Failed"),LESSON_STATUS_FAILED):r==SCORM_COMPLETED?(WriteToDebug("Returning Completed"),LESSON_STATUS_COMPLETED):r==SCORM_BROWSED?(WriteToDebug("Returning Browsed"),LESSON_STATUS_BROWSED):r==SCORM_INCOMPLETE?(WriteToDebug("Returning Incomplete"),LESSON_STATUS_INCOMPLETE):r==SCORM_NOT_ATTEMPTED||""==r?(WriteToDebug("Returning Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED):(WriteToDebug("ERROR - status not found"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_STATUS,"Invalid objective status received from LMS or initial status not yet recorded for objective","strStatus="+r),null)}function SCORM_FindObjectiveIndexFromID(e){var t,r,n;if(WriteToDebug("In SCORM_FindObjectiveIndexFromID"),""==(t=SCORM_CallLMSGetValue("cmi.objectives._count")))return WriteToDebug("Setting intCount=0"),0;for(WriteToDebug("intCount="+(t=parseInt(t,10))),r=0;r<t;r++)if(WriteToDebug("Checking index "+r),WriteToDebug("ID="+(n=SCORM_CallLMSGetValue("cmi.objectives."+r+".id"))),n==e)return WriteToDebug("Found Matching index"),r;return WriteToDebug("Did not find match, returning count"),t}function SCORM_CreateValidIdentifier(e){return CreateValidIdentifierLegacy(e)}function SCORM_FindInteractionIndexFromID(e){return WriteToDebug("SCORM_FindInteractionIndexFromID - SCORM does not support interaction retrieval, returning null"),null}function SCORM_GetInteractionType(e){return WriteToDebug("SCORM_GetInteractionType - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_GetInteractionTimestamp(e){return WriteToDebug("SCORM_GetInteractionTimestamp - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_GetInteractionCorrectResponses(e){return WriteToDebug("SCORM_GetInteractionCorrectResponses - SCORM does not support interaction retrieval, returning empty array"),new Array}function SCORM_GetInteractionWeighting(e){return WriteToDebug("SCORM_GetInteractionWeighting - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_GetInteractionLearnerResponses(e){return WriteToDebug("SCORM_GetInteractionLearnerResponses - SCORM does not support interaction retrieval, returning empty array"),new Array}function SCORM_GetInteractionResult(e){return WriteToDebug("SCORM_GetInteractionResult - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_GetInteractionLatency(e){return WriteToDebug("SCORM_GetInteractionDescription - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_GetInteractionDescription(e){return WriteToDebug("SCORM_GetInteractionDescription - SCORM does not support interaction retrieval, returning empty string"),""}function SCORM_CreateDataBucket(e,t,r){return WriteToDebug("SCORM_CreateDataBucket - SCORM 1.1 and 1.2 do not support SSP, returning false"),!1}function SCORM_GetDataFromBucket(e){return WriteToDebug("SCORM_GetDataFromBucket - SCORM 1.1 and 1.2 do not support SSP, returning empty string"),""}function SCORM_PutDataInBucket(e,t,r){return WriteToDebug("SCORM_PutDataInBucket - SCORM 1.1 and 1.2 do not support SSP, returning false"),!1}function SCORM_DetectSSPSupport(){return WriteToDebug("SCORM_DetectSSPSupport - SCORM 1.1 and 1.2 do not support SSP, returning false"),!1}function SCORM_GetBucketInfo(e){return WriteToDebug("AICC_DetectSSPSupport - SCORM 1.1 and 1.2 do not support SSP, returning empty SSPBucketSize"),new SSPBucketSize(0,0)}function SCORM_SetFailed(){return WriteToDebug("In SCORM_SetFailed"),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_FAILED)}function SCORM_SetPassed(){return WriteToDebug("In SCORM_SetPassed"),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_PASSED)}function SCORM_SetCompleted(){return WriteToDebug("In SCORM_SetCompleted"),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_COMPLETED)}function SCORM_ResetStatus(){return WriteToDebug("In SCORM_ResetStatus"),SCORM_ClearErrorInfo(),SCORM_CallLMSSetValue("cmi.core.lesson_status",SCORM_INCOMPLETE)}function SCORM_GetStatus(){var e;return WriteToDebug("In SCORM_GetStatus"),SCORM_ClearErrorInfo(),WriteToDebug("strStatus="+(e=SCORM_CallLMSGetValue("cmi.core.lesson_status"))),e==SCORM_PASSED?(WriteToDebug("returning Passed"),LESSON_STATUS_PASSED):e==SCORM_FAILED?(WriteToDebug("Returning Failed"),LESSON_STATUS_FAILED):e==SCORM_COMPLETED?(WriteToDebug("Returning Completed"),LESSON_STATUS_COMPLETED):e==SCORM_BROWSED?(WriteToDebug("Returning Browsed"),LESSON_STATUS_BROWSED):e==SCORM_INCOMPLETE?(WriteToDebug("Returning Incomplete"),LESSON_STATUS_INCOMPLETE):e==SCORM_NOT_ATTEMPTED?(WriteToDebug("Returning Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED):(WriteToDebug("ERROR - status not found"),SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_STATUS,"Invalid lesson status received from LMS","strStatus="+e),null)}function SCORM_GetProgressMeasure(){return WriteToDebug("SCORM_GetProgressMeasure - SCORM 1.1 and 1.2 do not support progress_measure, returning false"),!1}function SCORM_SetProgressMeasure(){return WriteToDebug("SCORM_SetProgressMeasure - SCORM 1.1 and 1.2 do not support progress_measure, returning false"),!1}function SCORM_GetObjectiveProgressMeasure(){return WriteToDebug("SCORM_GetObjectiveProgressMeasure - SCORM 1.1 and 1.2 do not support progress_measure, returning false"),!1}function SCORM_SetObjectiveProgressMeasure(){return WriteToDebug("SCORM_SetObjectiveProgressMeasure - SCORM 1.1 and 1.2 do not support progress_measure, returning false"),!1}function SCORM_IsContentInBrowseMode(){var e;return WriteToDebug("In SCORM_IsContentInBrowseMode"),WriteToDebug("SCORM_IsContentInBrowseMode,  strLessonMode="+(e=SCORM_CallLMSGetValue("cmi.core.lesson_mode"))),e==SCORM_BROWSE?(WriteToDebug("Returning true"),!0):(WriteToDebug("Returning false"),!1)}function SCORM_TranslateExitTypeToSCORM(e){return WriteToDebug("In SCORM_TranslatgeExitTypeToSCORM strExitType-"+e),e==EXIT_TYPE_SUSPEND?(WriteToDebug("Returning suspend"),SCORM_SUSPEND):e==EXIT_TYPE_UNLOAD?(WriteToDebug("Returning Exit"),SCORM_NORMAL_EXIT):e==EXIT_TYPE_FINISH?(WriteToDebug("Returning Logout"),SCORM_NORMAL_EXIT):e==EXIT_TYPE_TIMEOUT?(WriteToDebug("Returning Timout"),SCORM_TIMEOUT):void 0}function SCORM_GetCompletionStatus(){return WriteToDebug("In SCORM_GetCompletionStatus"),SCORM_IsContentInBrowseMode()?(WriteToDebug("Returning browsed"),SCORM_BROWSED):(WriteToDebug("Returning Completed"),SCORM_COMPLETED)}function SCORM_SetNavigationRequest(e){return WriteToDebug("SCORM_GetNavigationRequest - SCORM 1.1 and 1.2 do not support navigation requests, returning false"),!1}function SCORM_GetNavigationRequest(){return WriteToDebug("SCORM_GetNavigationRequest - SCORM 1.1 and 1.2 do not support navigation requests, returning false"),!1}function SCORM_CallLMSInitialize(){var e;return WriteToDebug("In SCORM_CallLMSInitialize"),SCORM_objAPI=SCORM_GrabAPI(),WriteToDebug("Calling LMSInitialize"),e=SCORM_objAPI.LMSInitialize(""),WriteToDebug("strResult="+(e+="")),e==SCORM_FALSE?(WriteToDebug("Detected failed call to initialize"),SCORM_SetErrorInfo(),WriteToDebug("Error calling LMSInitialize:"),WriteToDebug("              intSCORMError="+intSCORMError),WriteToDebug("              SCORMErrorString="+strSCORMErrorString),WriteToDebug("              Diagnostic="+strSCORMErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0)}function SCORM_CallLMSSetValue(e,t){var r;return WriteToDebug("SCORM_CallLMSSetValue strElement="+e+", strValue="+t),!0===blnReviewModeSoReadOnly?(WriteToDebug("Mode is Review and configuration setting dictates this should be read only so exiting."),!0):(SCORM_objAPI=SCORM_GrabAPI(),WriteToDebug("Calling LMSSetValue"),e+="",t+="",r=SCORM_objAPI.LMSSetValue(e,t),WriteToDebug("strResult="+(r+="")),r==SCORM_FALSE?(WriteToDebug("Detected Failed call to LMSSetvalue"),SCORM_SetErrorInfo(),WriteToDebug("Error calling LMSSetValue:"),WriteToDebug("              strElement="+e),WriteToDebug("              strValue="+t),WriteToDebug("              intSCORMError="+intSCORMError),WriteToDebug("              SCORMErrorString="+strSCORMErrorString),WriteToDebug("              Diagnostic="+strSCORMErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0))}function SCORM_CallLMSGetValue(e){var t;return WriteToDebug("In SCORM_CallLMSGetValue strElement="+e),SCORM_objAPI=SCORM_GrabAPI(),WriteToDebug("Call LMSGetValue"),e+="",WriteToDebug("strResult="+(t=SCORM_objAPI.LMSGetValue(e)+"")),intSCORMError=SCORM_objAPI.LMSGetLastError(),WriteToDebug("intSCORMError="+(intSCORMError+="")),intSCORMError!=SCORM_NO_ERROR&&(WriteToDebug("Detected failed called to LMSGetValue"),SCORM_SetErrorInfo(),WriteToDebug("Error calling LMSGetValue:"),WriteToDebug("              strElement="+e),WriteToDebug("              intSCORMError="+intSCORMError),WriteToDebug("              SCORMErrorString="+strSCORMErrorString),WriteToDebug("              Diagnostic="+strSCORMErrorDiagnostic)),WriteToDebug("Returning "+t),t}function SCORM_CallLMSCommit(){var e;return WriteToDebug("In SCORM_CallLMSCommit"),SCORM_objAPI=SCORM_GrabAPI(),WriteToDebug("Calling LMSCommit"),e=SCORM_objAPI.LMSCommit(""),WriteToDebug("strResult="+(e+="")),e==SCORM_FALSE?(WriteToDebug("Detected failed call to LMSCommit"),SCORM_SetErrorInfo(),WriteToDebug("Error calling LMSCommit:"),WriteToDebug("              intSCORMError="+intSCORMError),WriteToDebug("              SCORMErrorString="+strSCORMErrorString),WriteToDebug("              Diagnostic="+strSCORMErrorDiagnostic),!1):(WriteToDebug("Returning true"),!0)}function SCORM_CallLMSFinish(){var e;return WriteToDebug("In SCORM_CallLMSFinish"),SCORM_objAPI=SCORM_GrabAPI(),WriteToDebug("Calling LMS Finish"),e=SCORM_objAPI.LMSFinish(""),WriteToDebug("strResult="+(e+="")),e==SCORM_FALSE?(WriteToDebug("Detected failed call to LMSFinish"),SCORM_SetErrorInfo(),WriteToDebug("Error calling LMSFinish:"),WriteToDebug("              intSCORMError="+intSCORMError),WriteToDebug("              SCORMErrorString="+strSCORMErrorString),WriteToDebug("              Diagnostic="+strSCORMErrorDiagnostic),!1):(WriteToDebug("Returning True"),!0)}function SCORM_ClearErrorInfo(){WriteToDebug("In SCORM_ClearErrorInfo"),intSCORMError=SCORM_NO_ERROR,strSCORMErrorString="",strSCORMErrorDiagnostic=""}function SCORM_SetErrorInfo(){WriteToDebug("In SCORM_SetErrorInfo"),intSCORMError=SCORM_objAPI.LMSGetLastError(),strSCORMErrorString=SCORM_objAPI.LMSGetErrorString(intSCORMError),strSCORMErrorDiagnostic=SCORM_objAPI.LMSGetDiagnostic(""),strSCORMErrorString+="",strSCORMErrorDiagnostic+="",WriteToDebug("intSCORMError="+(intSCORMError+="")),WriteToDebug("strSCORMErrorString="+strSCORMErrorString),WriteToDebug("strSCORMErrorDiagnostic="+strSCORMErrorDiagnostic)}function SCORM_SetErrorInfoManually(e,t,r){WriteToDebug("In SCORM_SetErrorInfoManually"),WriteToDebug("ERROR-Num="+e),WriteToDebug("      String="+t),WriteToDebug("      Diag="+r),intSCORMError=e,strSCORMErrorString=t,strSCORMErrorDiagnostic=r}function SCORM_GetLastError(){return WriteToDebug("In SCORM_GetLastError"),intSCORMError==SCORM_NO_ERROR?(WriteToDebug("Returning No Error"),NO_ERROR):(WriteToDebug("Returning "+intSCORMError),intSCORMError)}function SCORM_GetLastErrorDesc(){return WriteToDebug("In SCORM_GetLastErrorDesc, "+strSCORMErrorString+"\n"+strSCORMErrorDiagnostic),strSCORMErrorString+"\n"+strSCORMErrorDiagnostic}function SCORM_GrabAPI(){return WriteToDebug("In SCORM_GrabAPI"),void 0!==SCORM_objAPI&&null!=SCORM_objAPI||(WriteToDebug("Searching with improved ADL algorithm"),SCORM_objAPI=SCORM_GetAPI()),void 0!==SCORM_objAPI&&null!=SCORM_objAPI||(SCORM_objAPI=SCORM_SearchForAPI(window)),WriteToDebug("SCORM_GrabAPI, returning"),SCORM_objAPI}function SCORM_SearchForAPI(e){WriteToDebug("SCORM_SearchForAPI");var t,r=null;return t="Name="+e.name+", href="+e.location.href,SCORM_APIFound(r=e.API)?(WriteToDebug("Found API in this window - "+t),r):(SCORM_WindowHasParent(e)&&(WriteToDebug("Searching Parent - "+t),r=SCORM_SearchForAPI(e.parent)),SCORM_APIFound(r)?(WriteToDebug("Found API in a parent - "+t),r):(SCORM_WindowHasOpener(e)&&(WriteToDebug("Searching Opener - "+t),r=SCORM_SearchForAPI(e.opener)),SCORM_APIFound(r)?(WriteToDebug("Found API in an opener - "+t),r):(WriteToDebug("Looking in children - "+t),SCORM_APIFound(r=SCORM_LookInChildren(e))?(WriteToDebug("Found API in Children - "+t),r):(WriteToDebug("Didn't find API in this window - "+t),null))))}function SCORM_LookInChildren(e){WriteToDebug("SCORM_LookInChildren");var t,r=null;t="Name="+e.name+", href="+e.location.href;for(var n=0;n<e.frames.length;n++){if(WriteToDebug("Looking in child frame "+n),SCORM_APIFound(r=e.frames[n].API))return WriteToDebug("Found API in child frame of "+t),r;if(WriteToDebug("Looking in this child's children "+t),SCORM_APIFound(r=SCORM_LookInChildren(e.frames[n])))return WriteToDebug("API found in this child's children "+t),r}return null}function SCORM_WindowHasOpener(e){return WriteToDebug("In SCORM_WindowHasOpener"),null!=e.opener&&e.opener!=e&&void 0!==e.opener?(WriteToDebug("Window Does Have Opener"),!0):(WriteToDebug("Window Does Not Have Opener"),!1)}function SCORM_WindowHasParent(e){return WriteToDebug("In SCORM_WindowHasParent"),null!=e.parent&&e.parent!=e&&void 0!==e.parent?(WriteToDebug("Window Does Have Parent"),!0):(WriteToDebug("Window Does Not Have Parent"),!1)}function SCORM_APIFound(e){return WriteToDebug("In SCORM_APIFound"),null==e||void 0===e?(WriteToDebug("API NOT Found"),!1):(WriteToDebug("API Found"),!0)}function SCORM_ScanParentsForApi(e){WriteToDebug("In SCORM_ScanParentsForApi, win="+e.location);for(var t=0;(null==e.API||void 0===e.API)&&null!=e.parent&&e.parent!=e&&t<=500;)t++,e=e.parent;return e.API}function SCORM_GetAPI(){WriteToDebug("In SCORM_GetAPI");var e=null;return null!=window.API?(WriteToDebug("SCORM_GetAPI, bypassing normal processes and grabbing proxy API..."),SCORM_blnUsingProxyAPI=!0,window.API):(null!=window.parent&&window.parent!=window&&(WriteToDebug("SCORM_GetAPI, searching parent"),e=SCORM_ScanParentsForApi(window.parent)),null==e&&null!=window.top.opener&&(WriteToDebug("SCORM_GetAPI, searching opener"),e=SCORM_ScanParentsForApi(window.top.opener)),e)}STANDARD="AICC";var blnDirtyAICCData=!1,blnCommitSavedData=!1,intAICCErrorNum=NO_ERROR,strAICCErrorDesc="",aryAICCFoundItems=new Array,blnUseLongInteractionResultValues=!0,AICC_LMS_Version=(blnReviewModeSoReadOnly=!1,""),AICC_Student_ID="",AICC_Student_Name="",AICC_Lesson_Location="",AICC_Score="",AICC_Credit="",AICC_Lesson_Status="",AICC_Time="",AICC_Mastery_Score="",AICC_Lesson_Mode="",AICC_Max_Time_Allowed="",AICC_Time_Limit_Action="",AICC_Audio="",AICC_Speed="",AICC_Language="",AICC_Text="",AICC_Launch_Data="",AICC_Data_Chunk="",AICC_Comments="",AICC_Objectives=null,AICC_CourseID="",AICC_fltScoreRaw="",AICC_fltScoreMax="",AICC_fltScoreMin="",AICC_blnCredit=!0,AICC_strLessonMode=MODE_NORMAL,AICC_intPreviouslyAccumulatedMilliseconds=0,AICC_intMaxTimeAllowedMilliseconds=MAX_CMI_TIME,AICC_blnExitOnTimeout=!1,AICC_blnShowMessageOnTimeout=!0,AICC_TextPreference=PREFERENCE_DEFAULT,AICC_Status=LESSON_STATUS_NOT_ATTEMPTED,AICC_Entry=AICC_ENTRY_FLAG_DEFAULT,AICC_AudioPlayPreference=PREFERENCE_DEFAULT,AICC_intAudioVolume=100,AICC_intPercentOfMaxSpeed=100,AICC_intSessionTimeMilliseconds=0,AICC_aryObjectivesRead=new Array,AICC_aryObjectivesWrite=new Array,AICC_aryCommentsFromLearner=new Array,AICC_aryInteractions=new Array,AICC_OBJ_ARRAY_ID=0,AICC_OBJ_ARRAY_SCORE=1,AICC_OBJ_ARRAY_STATUS=2,AICC_INTERACTIONS_ID=0,AICC_INTERACTIONS_RESPONSE=1,AICC_INTERACTIONS_CORRECT=2,AICC_INTERACTIONS_CORRECT_RESPONSE=3,AICC_INTERACTIONS_TIME_STAMP=4,AICC_INTERACTIONS_TYPE=5,AICC_INTERACTIONS_WEIGHTING=6,AICC_INTERACTIONS_LATENCY=7,AICC_INTERACTIONS_RESPONSE_LONG=8,AICC_INTERACTIONS_CORRECT_RESPONSE_LONG=9,AICC_INTERACTION_TYPE_TRUE_FALSE="T",AICC_INTERACTION_TYPE_CHOICE="C",AICC_INTERACTION_TYPE_FILL_IN="F",AICC_INTERACTION_TYPE_MATCHING="M",AICC_INTERACTION_TYPE_PERFORMANCE="P",AICC_INTERACTION_TYPE_SEQUENCING="S",AICC_INTERACTION_TYPE_LIKERT="L",AICC_INTERACTION_TYPE_NUMERIC="N",AICC_RESULT_CORRECT="C",AICC_RESULT_WRONG="W",AICC_RESULT_UNANTICIPATED="U",AICC_RESULT_NEUTRAL="N",AICC_NO_ERROR="0",AICC_ERROR_INVALID_PREFERENCE="-1",AICC_ERROR_INVALID_STATUS="-2",AICC_ERROR_INVALID_SPEED="-3",AICC_ERROR_INVALID_TIMESPAN="-4",AICC_ERROR_INVALID_TIME_LIMIT_ACTION="-5",AICC_ERROR_INVALID_DECIMAL="-6",AICC_ERROR_INVALID_CREDIT="-7",AICC_ERROR_INVALID_LESSON_MODE="-8",AICC_ERROR_INVALID_ENTRY="-9";blnReviewModeSoReadOnly=!1;function AICC_Initialize(){WriteToDebug("In AICC_Initialize"),window.AICCComm.MakeGetParamRequest()}function AICC_InitializeExecuted(){WriteToDebug("In AICC_InitializeExecuted"),AICC_GetLessonMode()!=MODE_REVIEW?AICC_GetStatus()==LESSON_STATUS_NOT_ATTEMPTED&&(WriteToDebug("Setting Status to Incomplete"),AICC_Status=LESSON_STATUS_INCOMPLETE):void 0!==REVIEW_MODE_IS_READ_ONLY&&!0===REVIEW_MODE_IS_READ_ONLY&&(blnReviewModeSoReadOnly=!0)}function AICC_Finish(e,t){return WriteToDebug("In AICC_Finish, strExitType="+e+", blnStatusWasSet="+t),t||(e==EXIT_TYPE_FINISH?(WriteToDebug("Setting status to complete"),AICC_Status=LESSON_STATUS_COMPLETED):AICC_Status!=LESSON_STATUS_COMPLETED&&(WriteToDebug("Setting status to incomplete"),AICC_Status=LESSON_STATUS_INCOMPLETE)),AICC_CommitData(),1==blnCommitSavedData&&KillTime(),window.AICCComm.MakeExitAURequest(),!0}function AICC_CommitData(){var e;return WriteToDebug("In AICC_CommitData"),!0===blnReviewModeSoReadOnly?(WriteToDebug("Mode is Review and configuration setting dictates this should be read only so exiting."),!0):(blnCommitSavedData=!1,IsThereDirtyAICCData()&&(blnCommitSavedData=!0,WriteToDebug("Found Dirty Data"),e=FormAICCPostData(),window.AICCComm.MakePutParamRequest(e),AICC_aryInteractions.length>0&&(WriteToDebug("Saving Interactions"),KillTime(),AICC_SendInteractions()),ClearDirtyAICCData()),!0)}function KillTime(){if(WriteToDebug("In KillTime"),!1!==USE_AICC_KILL_TIME){var e=new Date;if(0==window.AICCComm.blnCanUseXMLHTTP)if(1==window.AICCComm.blnXMLHTTPIsAvailable)for(var t=0;t<3;t++)window.AICCComm.GetBlankHtmlPage(t);else{window.NothingFrame.document.open();for(t=0;t<1e3;t++)window.NothingFrame.document.write("waiting");window.NothingFrame.document.close()}WriteToDebug("Killed "+(new Date-e)+"milliseconds.")}else WriteToDebug("Configuration disallows use of KillTime, exiting")}function AICC_SendInteractions(){if(WriteToDebug("In AICC_SendInteractions."),!0===blnReviewModeSoReadOnly)return WriteToDebug("Mode is Review and configuration setting dictates this should be read only so exiting."),!0;var e=FormAICCInteractionsData();window.AICCComm.MakePutInteractionsRequest(e),AICC_aryInteractions=new Array}function AICC_GetStudentID(){return WriteToDebug("In AICC_GetStudentID, Returning "+AICC_Student_ID),AICC_Student_ID}function AICC_GetStudentName(){return WriteToDebug("In AICC_GetStudentName, Returning "+AICC_Student_Name),AICC_Student_Name}function AICC_GetBookmark(){return WriteToDebug("In AICC_GetBookmark, Returning "+AICC_Lesson_Location),AICC_Lesson_Location}function AICC_SetBookmark(e){return WriteToDebug("In AICC_SetBookmark, strBookmark="+e),SetDirtyAICCData(),AICC_Lesson_Location=e,!0}function AICC_GetDataChunk(){return WriteToDebug("In AICC_GetDataChunk, Returning "+AICC_Data_Chunk),AICC_Data_Chunk}function AICC_SetDataChunk(e){return WriteToDebug("In AICC_SetDataChunk, strData="+e),1==USE_STRICT_SUSPEND_DATA_LIMITS&&e.length>4096?(WriteToDebug("SCORM_SetDataChunk - suspend_data too large (4096 character limit for AICC)"),!1):(SetDirtyAICCData(),AICC_Data_Chunk=e,!0)}function AICC_GetLaunchData(){return WriteToDebug("In AICC_GetLaunchData, Returning "+AICC_Launch_Data),AICC_Launch_Data}function AICC_GetComments(){return WriteToDebug("In AICC_GetComments, Returning "+AICC_aryCommentsFromLearner.join(" | ")),AICC_aryCommentsFromLearner.join(" | ")}function AICC_WriteComment(e){var t;return WriteToDebug("In AICC_WriteComment, strComment="+e),0==e.search(/ \| /)&&(e=e.substr(3)),e.replace(/\|\|/g,"|"),t=AICC_aryCommentsFromLearner.length,WriteToDebug("Adding comment to array"),AICC_aryCommentsFromLearner[t]=e,SetDirtyAICCData(),!0}function AICC_GetLMSComments(){return WriteToDebug("In AICC_GetLMSComments, Returning "+AICC_Comments),AICC_Comments}function AICC_GetAudioPlayPreference(){return WriteToDebug("In AICC_GetAudioPlayPreference, Returning "+AICC_AudioPlayPreference),AICC_AudioPlayPreference}function AICC_GetAudioVolumePreference(){return WriteToDebug("In AICC_GetAudioVolumePreference, Returning "+AICC_intAudioVolume),AICC_intAudioVolume}function AICC_SetAudioPreference(e,t){return WriteToDebug("In AICC_SetAudioPreference, Returning true"),AICC_AudioPlayPreference=e,AICC_intAudioVolume=t,SetDirtyAICCData(),!0}function AICC_SetLanguagePreference(e){return WriteToDebug("In AICC_SetLanguagePreference, Returning true"),SetDirtyAICCData(),AICC_Language=e,!0}function AICC_GetLanguagePreference(){return WriteToDebug("In AICC_GetLanguagePreference, Returning "+AICC_Language),AICC_Language}function AICC_SetSpeedPreference(e){return WriteToDebug("In AICC_SetSpeedPreference, Returning true"),AICC_intPercentOfMaxSpeed=e,SetDirtyAICCData(),!0}function AICC_GetSpeedPreference(){return WriteToDebug("In AICC_GetSpeedPreference, Returning "+AICC_intPercentOfMaxSpeed),AICC_intPercentOfMaxSpeed}function AICC_SetTextPreference(e){return WriteToDebug("In AICC_SetTextPreference, Returning true"),AICC_TextPreference=e,SetDirtyAICCData(),!0}function AICC_GetTextPreference(){return WriteToDebug("In AICC_GetTextPreference, Returning "+AICC_TextPreference),AICC_TextPreference}function AICC_GetPreviouslyAccumulatedTime(){return WriteToDebug("In AICC_GetPreviouslyAccumulatedTime, Returning "+AICC_intPreviouslyAccumulatedMilliseconds),AICC_intPreviouslyAccumulatedMilliseconds}function AICC_SaveTime(e){return WriteToDebug("In intMilliSeconds, Returning true"),AICC_intSessionTimeMilliseconds=e,SetDirtyAICCData(),!0}function AICC_GetMaxTimeAllowed(){return WriteToDebug("In AICC_GetMaxTimeAllowed, Returning "+AICC_intMaxTimeAllowedMilliseconds),AICC_intMaxTimeAllowedMilliseconds}function AICC_DisplayMessageOnTimeout(){return WriteToDebug("In AICC_DisplayMessageOnTimeout, Returning "+AICC_blnShowMessageOnTimeout),AICC_blnShowMessageOnTimeout}function AICC_ExitOnTimeout(){return WriteToDebug("In AICC_ExitOnTimeout, Returning "+AICC_blnExitOnTimeout),AICC_blnExitOnTimeout}function AICC_GetPassingScore(){return WriteToDebug("In AICC_GetPassingScore, Returning "+AICC_Mastery_Score),AICC_Mastery_Score}function AICC_GetScore(){return WriteToDebug("In AICC_GetScore, Returning "+AICC_fltScoreRaw),AICC_fltScoreRaw}function AICC_SetScore(e,t,r){return WriteToDebug("In AICC_SetScore, fltScore="+e+", fltMaxScore="+t+", fltMinScore="+r),AICC_fltScoreRaw=e,AICC_fltScoreMax=t,AICC_fltScoreMin=r,SetDirtyAICCData(),!0}function AICC_RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordTrueFalseInteraction strID="+e+", blnResponse="+t+", blnCorrect="+r+", blnCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r="");var C="",I="";return null!==t&&(C=t?"t":"f"),1==n?I="t":0==n&&(I="f"),l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=C,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=I,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_TRUE_FALSE,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=C,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=I,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordMultipleChoiceInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r="");var C="",I="",_="",S="";if(null!==t)for(var T=0;T<t.length;T++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=t[T].Short.replace(",",""),I+=t[T].Long.replace(",","");for(T=0;T<n.length;T++)_.length>0&&(_+=","),S.length>0&&(S+=","),_+=n[T].Short.replace(",",""),S+=n[T].Long.replace(",","");return l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=C,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=_,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_CHOICE,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=I,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=S,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordFillInInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordFillInInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);return c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r=""),null===t&&(t=""),null!=n&&null!=n||(n=""),(t=new String(t)).length>255&&(t=t.substr(0,255)),(n=new String(n)).length>255&&(n=n.substr(0,255)),l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=t,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=n,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_FILL_IN,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=t,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=n,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordMatchingInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordMatchingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r="");var C="",I="",_="",S="";if(null!==t)for(var T=0;T<t.length;T++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=t[T].Source.Short.replace(",","").replace(".","")+"."+t[T].Target.Short.replace(",","").replace(".",""),I+=t[T].Source.Long.replace(",","").replace(".","")+"."+t[T].Target.Long.replace(",","").replace(".","");for(T=0;T<n.length;T++)_.length>0&&(_+=","),S.length>0&&(S+=","),""!=n[T].Source.Short&&""!=n[T].Source.Long&&(_+=n[T].Source.Short.replace(",","").replace(".","")+"."+n[T].Target.Short.replace(",","").replace(".",""),S+=n[T].Source.Long.replace(",","").replace(".","")+"."+n[T].Target.Long.replace(",","").replace(".",""));return l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=C,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=_,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_MATCHING,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=I,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=S,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordPerformanceInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);return c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r=""),null===t&&(t=""),null!=n&&null!=n||(n=""),(t=new String(t)).length>255&&(t=t.substr(0,255)),(n=new String(n)).length>255&&(n=n.substr(0,255)),l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=t,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=n,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_PERFORMANCE,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=t,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=n,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordSequencingInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordSequencingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r="");var C="",I="",_="",S="";if(null!==t)for(var T=0;T<t.length;T++)C.length>0&&(C+=","),I.length>0&&(I+=","),C+=t[T].Short.replace(",",""),I+=t[T].Long.replace(",","");for(T=0;T<n.length;T++)_.length>0&&(_+=","),S.length>0&&(S+=","),_+=n[T].Short.replace(",",""),S+=n[T].Long.replace(",","");return l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=C,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=_,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_SEQUENCING,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=I,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=S,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordLikertInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In RecordLikertInteraction strID="+e+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r="");var C="",I="";null!==t&&(C=t.Short,I=t.Long);var _="",S="";return null!=n&&(_=n.Short,S=n.Long),l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=C,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=_,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_LIKERT,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=I,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=S,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_RecordNumericInteraction(e,t,r,n,i,o,a,s,u){var c;WriteToDebug("In AICC_RecordNumericInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var l=new Array(10);if(c=AICC_aryInteractions.length,null!=o&&null!=o||(o=""),null!=a&&null!=a||(a=""),null!=r&&null!=r||(r=""),null===t&&(t=""),null!=n&&null!=n){if(IsValidDecimalRange(n)&&(n=ConvertDecimalRangeToDecimalBasedOnLearnerResponse(n,t,r)),!IsValidDecimal(n))return WriteToDebug("Returning False - AICC_RecordNumericInteraction received invalid correct response (not a decimal), strCorrectResponse="+n),!1}else n="";return l[AICC_INTERACTIONS_ID]=e,l[AICC_INTERACTIONS_RESPONSE]=t,l[AICC_INTERACTIONS_CORRECT]=r,l[AICC_INTERACTIONS_CORRECT_RESPONSE]=n,l[AICC_INTERACTIONS_TIME_STAMP]=u,l[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_NUMERIC,l[AICC_INTERACTIONS_WEIGHTING]=o,l[AICC_INTERACTIONS_LATENCY]=a,l[AICC_INTERACTIONS_RESPONSE_LONG]=t,l[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=n,AICC_aryInteractions[c]=l,WriteToDebug("Added to interactions array, index="+c),SetDirtyAICCData(),!0}function AICC_GetEntryMode(){return WriteToDebug("In AICC_GetEntryMode, Returning "+AICC_Entry),AICC_Entry}function AICC_GetLessonMode(){return WriteToDebug("In AICC_GetLessonMode, Returning "+AICC_strLessonMode),AICC_strLessonMode}function AICC_GetTakingForCredit(){return WriteToDebug("In AICC_GetTakingForCredit, Returning "+AICC_blnCredit),AICC_blnCredit}function AICC_SetObjectiveScore(e,t,r,n){var i,o;WriteToDebug("In AICC_SetObjectiveScore, strObjectiveID="+e+", intScore="+t+", intMaxScore="+r+", intMinScore="+n);var a="";return null!=(o=FindObjectiveById(e,AICC_aryObjectivesRead))?(WriteToDebug("Found read objective"),AICC_aryObjectivesRead[o][AICC_OBJ_ARRAY_SCORE]=t):(WriteToDebug("Adding new read objective"),i=AICC_aryObjectivesRead.length,AICC_aryObjectivesRead[parseInt(i,10)]=new Array(3),AICC_aryObjectivesRead[parseInt(i,10)][AICC_OBJ_ARRAY_ID]=e,AICC_aryObjectivesRead[parseInt(i,10)][AICC_OBJ_ARRAY_SCORE]=t,AICC_aryObjectivesRead[parseInt(i,10)][AICC_OBJ_ARRAY_STATUS]=""),null!=(o=FindObjectiveById(e,AICC_aryObjectivesWrite))?(WriteToDebug("Found write objective"),AICC_aryObjectivesWrite[o][AICC_OBJ_ARRAY_SCORE]=t):(WriteToDebug("Adding new write objective"),i=AICC_aryObjectivesWrite.length,AICC_aryObjectivesWrite[parseInt(i,10)]=new Array(3),a=t,AICC_LMS_Version<3&&""!=a&&(a=parseInt(a,10)),(null==AICC_REPORT_MIN_MAX_SCORE||!0===AICC_REPORT_MIN_MAX_SCORE)&&AICC_LMS_Version>=3&&(""==r&&""==n||(WriteToDebug("Appending Max and Min scores"),a+=","+r+","+n)),AICC_aryObjectivesWrite[parseInt(i,10)][AICC_OBJ_ARRAY_ID]=e,AICC_aryObjectivesWrite[parseInt(i,10)][AICC_OBJ_ARRAY_SCORE]=a,AICC_aryObjectivesWrite[parseInt(i,10)][AICC_OBJ_ARRAY_STATUS]=""),SetDirtyAICCData(),!0}function AICC_SetObjectiveStatus(e,t){var r,n;return WriteToDebug("In AICC_SetObjectiveStatus, strObjectiveID="+e+", Lesson_Status="+t),null!=(n=FindObjectiveById(e,AICC_aryObjectivesRead))?(WriteToDebug("Found read objective"),AICC_aryObjectivesRead[n][AICC_OBJ_ARRAY_STATUS]=t):(WriteToDebug("Adding new read objective"),r=AICC_aryObjectivesRead.length,AICC_aryObjectivesRead[parseInt(r,10)]=new Array(3),AICC_aryObjectivesRead[parseInt(r,10)][AICC_OBJ_ARRAY_ID]=e,AICC_aryObjectivesRead[parseInt(r,10)][AICC_OBJ_ARRAY_STATUS]=t,AICC_aryObjectivesRead[parseInt(r,10)][AICC_OBJ_ARRAY_SCORE]=""),null!=(n=FindObjectiveById(e,AICC_aryObjectivesWrite))?(WriteToDebug("Found write objective"),AICC_aryObjectivesWrite[n][AICC_OBJ_ARRAY_STATUS]=t):(WriteToDebug("Adding new write objective"),r=AICC_aryObjectivesWrite.length,AICC_aryObjectivesWrite[parseInt(r,10)]=new Array(3),AICC_aryObjectivesWrite[parseInt(r,10)][AICC_OBJ_ARRAY_ID]=e,AICC_aryObjectivesWrite[parseInt(r,10)][AICC_OBJ_ARRAY_STATUS]=t,AICC_aryObjectivesWrite[parseInt(r,10)][AICC_OBJ_ARRAY_SCORE]=""),SetDirtyAICCData(),!0}function AICC_SetObjectiveDescription(e,t){return WriteToDebug("In AICC_SetObjectiveDescription, strObjectiveID="+e+", strObjectiveDescription="+t),WriteToDebug("Objective descriptions are not supported prior to SCORM 2004"),!0}function AICC_GetObjectiveScore(e){WriteToDebug("In AICC_SetObjectiveScore, strObjectiveID="+e);var t=FindObjectiveById(e,AICC_aryObjectivesRead);return null!=t?(WriteToDebug("Found objective, returning "+AICC_aryObjectivesRead[t][AICC_OBJ_ARRAY_SCORE]),AICC_aryObjectivesRead[t][AICC_OBJ_ARRAY_SCORE]):(WriteToDebug("Did not find objective, returning ''"),"")}function AICC_GetObjectiveDescription(e){return WriteToDebug("In AICC_GetObjectiveDescription, strObjectiveID="+e),WriteToDebug("Objective descriptions are not supported prior to SCORM 2004"),""}function AICC_GetObjectiveStatus(e){WriteToDebug("In AICC_SetObjectiveStatus, strObjectiveID="+e);var t=FindObjectiveById(e,AICC_aryObjectivesRead);return null!=t?(WriteToDebug("Found objective, returning "+AICC_aryObjectivesRead[t][AICC_OBJ_ARRAY_STATUS]),AICC_aryObjectivesRead[t][AICC_OBJ_ARRAY_STATUS]):(WriteToDebug("Did not find objective, returning "+LESSON_STATUS_NOT_ATTEMPTED),LESSON_STATUS_NOT_ATTEMPTED)}function AICC_SetFailed(){return WriteToDebug("In AICC_SetFailed, Returning true"),AICC_Status=LESSON_STATUS_FAILED,SetDirtyAICCData(),!0}function AICC_SetPassed(){return WriteToDebug("In AICC_SetPassed, Returning true"),AICC_Status=LESSON_STATUS_PASSED,SetDirtyAICCData(),!0}function AICC_SetCompleted(){return WriteToDebug("In AICC_SetCompleted, Returning true"),AICC_Status=LESSON_STATUS_COMPLETED,SetDirtyAICCData(),!0}function AICC_ResetStatus(){return WriteToDebug("In AICC_ResetStatus, Returning true"),AICC_Status=LESSON_STATUS_INCOMPLETE,SetDirtyAICCData(),!0}function AICC_GetStatus(){return WriteToDebug("In AICC_GetStatus, Returning "+AICC_Status),AICC_Status}function AICC_GetProgressMeasure(){return WriteToDebug("AICC_GetProgressMeasure - AICC does not support progress_measure, returning false"),!1}function AICC_SetProgressMeasure(){return WriteToDebug("AICC_SetProgressMeasure - AICC does not support progress_measure, returning false"),!1}function AICC_GetObjectiveProgressMeasure(){return WriteToDebug("AICC_GetObjectiveProgressMeasure - AICC does not support progress_measure, returning false"),!1}function AICC_SetObjectiveProgressMeasure(){return WriteToDebug("AICC_SetObjectiveProgressMeasure - AICC does not support progress_measure, returning false"),!1}function AICC_SetPointBasedScore(e,t,r){return WriteToDebug("AICC_SetPointBasedScore - AICC does not support SetPointBasedScore, falling back to SetScore"),AICC_SetScore(e,t,r)}function AICC_GetScaledScore(e,t,r){return WriteToDebug("AICC_GetScaledScore - AICC does not support GetScaledScore, returning false"),!1}function AICC_GetLastError(){return WriteToDebug("In AICC_GetLastError, Returning "+intAICCErrorNum),intAICCErrorNum}function AICC_GetLastErrorDesc(){return WriteToDebug("In AICC_GetLastErrorDesc, Returning '"+strAICCErrorDesc+"'"),strAICCErrorDesc}function AICC_PutParamFailed(){WriteToDebug("ERROR: In AICC_PutParamFailed"),SetDirtyAICCData()}function AICC_PutInteractionsFailed(){WriteToDebug("ERROR: In AICC_PutInteractionsFailed"),SetDirtyAICCData(),1==parent.blnUseLongInteractionResultValues&&(parent.blnUseLongInteractionResultValues=!1,parent.AICC_CommitData())}function AICC_SetErrorInfo(e,t){WriteToDebug("ERROR: In AICC_SetErrorInfo, strErrorNumLine="+e+", strErrorDescLine="+t),-1==e.toLowerCase().search(/error\s*=\s*0/)?(WriteToDebug("Detected No Error"),intAICCErrorNum=NO_ERROR,strAICCErrorDesc=""):(WriteToDebug("Setting Error Info"),AICC_SetError(GetValueFromAICCLine(strAICCErrorLine),GetValueFromAICCLine(strAICCErrorDesc)))}function AICC_SetError(e,t){WriteToDebug("ERROR: In AICC_SetError, intErrorNum="+e+", strErrorDesc="+t),intAICCErrorNum=e}function SetDirtyAICCData(){WriteToDebug("In SetDirtyAICCData"),blnDirtyAICCData=!0}function ClearDirtyAICCData(){WriteToDebug("In ClearDirtyAICCData"),blnDirtyAICCData=!1}function IsThereDirtyAICCData(){return WriteToDebug("In IsThereDirtyAICCData, returning "+blnDirtyAICCData),blnDirtyAICCData}function GetValueFromAICCLine(e){var t;WriteToDebug("In GetValueFromAICCLine, strLine="+e);var r,n="";return WriteToDebug("intPos="+(t=(e=new String(e)).indexOf("="))),t>-1&&t+1<e.length&&(WriteToDebug("Grabbing value"),WriteToDebug("strTemp="+(r=e.substring(t+1))),n=r=(r=r.replace(/^\s*/,"")).replace(/\s*$/,"")),WriteToDebug("returning "+n),n}function GetNameFromAICCLine(e){var t,r;WriteToDebug("In GetNameFromAICCLine, strLine="+e);var n="";return WriteToDebug("intPos="+(t=(e=new String(e)).indexOf("="))),t>-1&&t<e.length?(WriteToDebug("Grabbing name from name/value pair"),WriteToDebug("strTemp="+(r=e.substring(0,t))),n=r=(r=r.replace(/^\s*/,"")).replace(/\s*$/,"")):(WriteToDebug("Grabbing name from group / section heading"),WriteToDebug("intPos="+(t=e.indexOf("["))),t>-1&&(WriteToDebug("Replacing []"),WriteToDebug("strTemp="+(r=e.replace(/[\[|\]]/g,""))),n=r=(r=r.replace(/^\s*/,"")).replace(/\s*$/,""))),WriteToDebug("returning "+n),n}function GetIndexFromAICCName(e){var t;WriteToDebug("In GetIndexFromAICCName, strLineName="+e);var r="",n="";return strLine=new String(e),WriteToDebug("intPos="+(t=strLine.indexOf("."))),t>-1&&t+1<strLine.length&&(WriteToDebug("Grabbing index"),WriteToDebug("strTemp="+(n=strLine.substring(t+1))),WriteToDebug("Checking for equal sign"),(t=n.indexOf("="))>-1&&t<n.length&&(WriteToDebug("Found and removing equal sign"),n=strLine.substring(0,t)),WriteToDebug("Removing white space"),r=n=(n=n.replace(/^\s*/,"")).replace(/\s*$/,"")),WriteToDebug("returning "+r),r}function ParseGetParamData(e){var t,r,n,i,o,a;for(WriteToDebug("In ParseGetParamData"),t=(e=new String(e)).split("\n"),WriteToDebug("Split String"),o=0;o<t.length;o++)if(WriteToDebug("Processing Line #"+o+": "+t[o]),n="",i="",(r=t[o]).length>0&&(WriteToDebug("Found non-zero length string"),"\r"==r.charAt(0)&&(WriteToDebug("Detected leading \\r"),r=r.substr(1)),"\r"==r.charAt(r.length-1)&&(WriteToDebug("Detected trailing \\r"),r=r.substr(0,r.length-1)),";"!=r.charAt(0)&&(WriteToDebug("Found non-comment line"),WriteToDebug("strLineName="+(n=GetNameFromAICCLine(r))+", strLineValue="+(i=GetValueFromAICCLine(r))))),!AICC_HasItemBeenFound(n=n.toLowerCase()))switch(WriteToDebug("Detected an un-found item"),AICC_FoundItem(n),n){case"version":WriteToDebug("Item is version");var s=parseFloat(i);isNaN(s)&&(s=0),AICC_LMS_Version=s;break;case"student_id":WriteToDebug("Item is student_id"),AICC_Student_ID=i;break;case"student_name":WriteToDebug("Item is student_name"),AICC_Student_Name=i;break;case"lesson_location":WriteToDebug("Item is lesson_location"),AICC_Lesson_Location=i;break;case"score":WriteToDebug("Item is score"),AICC_SeperateScoreValues(AICC_Score=i);break;case"credit":WriteToDebug("Item is credit"),AICC_TranslateCredit(AICC_Credit=i);break;case"lesson_status":WriteToDebug("Item is lesson_status"),AICC_TranslateLessonStatus(AICC_Lesson_Status=i);break;case"time":WriteToDebug("Item is time"),AICC_TranslateTimeToMilliseconds(AICC_Time=i);break;case"mastery_score":WriteToDebug("Item is mastery_score"),AICC_ValidateMasteryScore(AICC_Mastery_Score=i);break;case"lesson_mode":WriteToDebug("Item is lesson_mode"),AICC_TranslateLessonMode(AICC_Lesson_Mode=i);break;case"max_time_allowed":WriteToDebug("Item is max_time_allowed"),AICC_TranslateMaxTimeToMilliseconds(AICC_Max_Time_Allowed=i);break;case"time_limit_action":WriteToDebug("Item is time_limit_action"),AICC_TranslateTimeLimitAction(AICC_Time_Limit_Action=i);break;case"audio":WriteToDebug("Item is audio"),AICC_TranslateAudio(AICC_Audio=i);break;case"speed":WriteToDebug("Item is speed"),AICC_TranslateSpeed(AICC_Speed=i);break;case"language":WriteToDebug("Item is language"),AICC_Language=i;break;case"text":WriteToDebug("Item is text"),AICC_TranslateTextPreference(AICC_Text=i);break;case"course_id":WriteToDebug("Item is course id"),AICC_CourseID=i;break;case"core_vendor":for(WriteToDebug("Item is core_vendor"),AICC_Launch_Data="",r="",o+(a=1)<t.length&&(r=t[o+a]);o+a<t.length&&!IsGroupIdentifier(r);)";"!=r.charAt(0)&&(AICC_Launch_Data+=r+"\n"),o+(a+=1)<t.length&&(r=t[o+a]);o=o+a-1,AICC_Launch_Data=AICC_Launch_Data.replace(/\s*$/,"");break;case"core_lesson":for(WriteToDebug("Item is core_lesson"),AICC_Data_Chunk="",r="",o+(a=1)<t.length&&(r=t[o+a]);o+a<t.length&&!IsGroupIdentifier(r);)";"!=r.charAt(0)&&(AICC_Data_Chunk+=r+"\n"),o+(a+=1)<t.length&&(r=t[o+a]);o=o+a-1,AICC_Data_Chunk=AICC_Data_Chunk.replace(/\s*$/,"");break;case"comments":for(WriteToDebug("Item is comments"),AICC_Comments="",r="",o+(a=1)<t.length&&(r=t[o+a]);o+a<t.length&&!IsGroupIdentifier(r);)";"!=r.charAt(0)&&(AICC_Comments+=r+"\n"),o+(a+=1)<t.length&&(r=t[o+a]);o=o+a-1,AICC_Comments=AICC_Comments.replace(/\s*$/,"");break;case"objectives_status":for(WriteToDebug("Item is objectives_status"),AICC_Objectives="",r="",o+(a=1)<t.length&&(r=t[o+a]);o+a<t.length&&!IsGroupIdentifier(r);)";"!=r.charAt(0)&&(AICC_Objectives+=r+"\n"),o+(a+=1)<t.length&&(r=t[o+a]);o=o+a-1,AICC_FormatObjectives(AICC_Objectives=AICC_Objectives.replace(/\s*$/,""));break;default:WriteToDebug("Unknown Item Found")}return!0}function IsGroupIdentifier(e){var t;return WriteToDebug("In IsGroupIdentifier, strLine="+e),WriteToDebug("intPos="+(t=(e=e.replace(/^\s*/,"")).search(/\[[\w]+\]/))),0==t?(WriteToDebug("Returning True"),!0):(WriteToDebug("Returning False"),!1)}function AICC_FoundItem(e){WriteToDebug("In AICC_FoundItem, strItem="+e),aryAICCFoundItems[e]=!0}function AICC_HasItemBeenFound(e){return WriteToDebug("In AICC_HasItemBeenFound, strItem="+e),1==aryAICCFoundItems[e]?(WriteToDebug("Returning True"),!0):(WriteToDebug("Returning False"),!1)}function AICC_SeperateScoreValues(e){WriteToDebug("In AICC_SeperateScoreValues, AICC_Score="+e),aryScore=e.split(","),IsValidDecimal(AICC_fltScoreRaw=aryScore[0])?(WriteToDebug("Found a valid decimal"),AICC_fltScoreRaw=parseFloat(AICC_fltScoreRaw)):(WriteToDebug("ERROR - score from LMS is not a valid decimal"),AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"score is not a valid decimal")),aryScore.length>1&&(WriteToDebug("Max score found"),IsValidDecimal(AICC_fltScoreMax=aryScore[1])?(WriteToDebug("Found a valid decimal"),AICC_fltScoreMax=parseFloat(AICC_fltScoreMax)):(WriteToDebug("ERROR - max score from LMS is not a valid decimal"),AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"max score is not a valid decimal"))),aryScore.length>2&&(WriteToDebug("Max score found"),IsValidDecimal(AICC_fltScoreMin=aryScore[2])?(WriteToDebug("Found a valid decimal"),AICC_fltScoreMin=parseFloat(AICC_fltScoreMin)):(WriteToDebug("ERROR - min score from LMS is not a valid decimal"),AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"min score is not a valid decimal")))}function AICC_ValidateMasteryScore(e){WriteToDebug("In AICC_ValidateMasteryScore, strScore="+e),IsValidDecimal(e)?AICC_Mastery_Score=parseFloat(e):(WriteToDebug("ERROR - mastery score from LMS is not a valid decimal"),AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"mastery score is not a valid decimal"))}function AICC_TranslateCredit(e){var t;WriteToDebug("In AICC_TranslateCredit, strCredit="+e),"c"==(t=e.toLowerCase().charAt(0))?(WriteToDebug("Credit = true"),AICC_blnCredit=!0):"n"==t?(WriteToDebug("Credit = false"),AICC_blnCredit=!1):(WriteToDebug("ERROR - credit value from LMS is not a valid"),AICC_SetError(AICC_ERROR_INVALID_CREDIT,"credit value from LMS is not a valid"))}function AICC_TranslateLessonMode(e){var t;WriteToDebug("In AICC_TranslateLessonMode, strMode="+e),"b"==(t=e.toLowerCase().charAt(0))?(WriteToDebug("Lesson Mode = Browse"),AICC_strLessonMode=MODE_BROWSE):"n"==t?(WriteToDebug("Lesson Mode = normal"),AICC_strLessonMode=MODE_NORMAL):"r"==t?(WriteToDebug("Lesson Mode = review"),AICC_strLessonMode=MODE_REVIEW,void 0!==REVIEW_MODE_IS_READ_ONLY&&!0===REVIEW_MODE_IS_READ_ONLY&&(blnReviewModeSoReadOnly=!0)):(WriteToDebug("ERROR - lesson_mode value from LMS is not a valid"),AICC_SetError(AICC_ERROR_INVALID_LESSON_MODE,"lesson_mode value from LMS is not a valid"))}function AICC_TranslateTimeToMilliseconds(e){WriteToDebug("In AICC_TranslateTimeToMilliseconds, strCMITime="+e),IsValidCMITimeSpan(e)?AICC_intPreviouslyAccumulatedMilliseconds=ConvertCMITimeSpanToMS(e):(WriteToDebug("ERROR - Invalid CMITimeSpan"),AICC_SetError(AICC_ERROR_INVALID_TIMESPAN,"Invalid timespan (previously accumulated time) received from LMS"))}function AICC_TranslateMaxTimeToMilliseconds(e){WriteToDebug("In AICC_TranslateMaxTimeToMilliseconds, strCMITime="+e),IsValidCMITimeSpan(e)?AICC_intMaxTimeAllowedMilliseconds=ConvertCMITimeSpanToMS(e):(WriteToDebug("ERROR - Invalid CMITimeSpan"),AICC_SetError(AICC_ERROR_INVALID_TIMESPAN,"Invalid timespan (max time allowed) received from LMS"))}function AICC_TranslateTimeLimitAction(e){var t;WriteToDebug("In AICC_TranslateTimeLimitAction, strTimeLimitAction="+e);var r=!1,n="",i="";2==(t=e.split(",")).length?(WriteToDebug("Found 2 elements"),WriteToDebug("Got characters, strChar1="+(n=t[0].charAt(0).toLowerCase())+", strChar2="+(i=t[1].charAt(0).toLowerCase())),("e"!=n&&"c"!=n&&"m"!=n&&"n"!=n||"e"!=i&&"c"!=i&&"m"!=i&&"n"!=i||n==i)&&(r=!0,WriteToDebug("Found an invalid character, or 2 identical characters")),"e"!=n&&"e"!=i||(AICC_blnExitOnTimeout=!0),"c"!=n&&"c"!=i||(AICC_blnExitOnTimeout=!1),"n"!=n&&"n"!=i||(AICC_blnShowMessageOnTimeout=!1),"m"!=n&&"m"!=i||(AICC_blnShowMessageOnTimeout=!0),WriteToDebug("AICC_blnExitOnTimeout="+AICC_blnExitOnTimeout+", AICC_blnShowMessageOnTimeout"+AICC_blnShowMessageOnTimeout)):(WriteToDebug("Line does not contain two comma-delimited elements"),r=!0),r&&(WriteToDebug("ERROR - Invalid Time Limit Action"),AICC_SetError(AICC_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS"))}function AICC_TranslateTextPreference(e){WriteToDebug("In AICC_TranslateTextPreference, strPreference="+e),-1==e?(WriteToDebug("Text Preference = off"),AICC_TextPreference=PREFERENCE_OFF):0==e?(WriteToDebug("Text Preference = default"),AICC_TextPreference=PREFERENCE_DEFAULT):1==e?(WriteToDebug("Text Preference = on"),AICC_TextPreference=PREFERENCE_ON):(WriteToDebug("ERROR - Invalid Text Preference"),AICC_SetError(AICC_ERROR_INVALID_PREFERENCE,"Invalid Text Preference received from LMS"))}function AICC_TranslateLessonStatus(e){var t,r;WriteToDebug("In AICC_TranslateLessonStatus, strStatus="+e),t=e.charAt(0).toLowerCase(),WriteToDebug("AICC_Status="+(AICC_Status=AICC_ConvertAICCStatusIntoLocalStatus(t))),(r=e.indexOf(","))>0&&("a"==(t=e.substr(r).replace(/,/,"").charAt(0).toLowerCase())?(WriteToDebug("Entry is Ab initio"),AICC_Entry=ENTRY_FIRST_TIME):"r"==t?(WriteToDebug("Entry is Resume"),AICC_Entry=ENTRY_RESUME):(WriteToDebug("ERROR - entry not found"),AICC_SetError(AICC_ERROR_INVALID_ENTRY,"Invalid lesson status received from LMS")))}function AICC_ConvertAICCStatusIntoLocalStatus(e){return WriteToDebug("In AICC_ConvertAICCStatusIntoLocalStatus, strFirstCharOfAICCStatus="+e),"p"==e?(WriteToDebug("Status is Passed"),LESSON_STATUS_PASSED):"f"==e?(WriteToDebug("Status is Failed"),LESSON_STATUS_FAILED):"c"==e?(WriteToDebug("Status is Completed"),LESSON_STATUS_COMPLETED):"b"==e?(WriteToDebug("Status is Browsed"),LESSON_STATUS_BROWSED):"i"==e?(WriteToDebug("Status is Incomplete"),LESSON_STATUS_INCOMPLETE):"n"==e?(WriteToDebug("Status is Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED):(WriteToDebug("ERROR - status not found"),AICC_SetError(SCORM_ERROR_INVALID_STATUS,"Invalid status"),LESSON_STATUS_NOT_ATTEMPTED)}function AICC_TranslateAudio(e){WriteToDebug("In AICC_TranslateAudio, strAudio="+e);var t=parseInt(e,10);WriteToDebug("intTempPreference="+t),t>0&&t<=100?(WriteToDebug("Returning On"),AICC_AudioPlayPreference=PREFERENCE_ON,AICC_intAudioVolume=t):0==t?(WriteToDebug("Returning Default"),AICC_AudioPlayPreference=PREFERENCE_DEFAULT):t<0?(WriteToDebug("returning Off"),AICC_AudioPlayPreference=PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),AICC_SetError(AICC_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS"))}function AICC_TranslateSpeed(e){var t;return WriteToDebug("In AICC_TranslateSpeed, intAICCSpeed="+e),ValidInteger(e)?(e=parseInt(e,10))<-100||e>100?(WriteToDebug("ERROR - out of range"),void AICC_SetError(AICC_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range")):(AICC_Speed=e,t=(e+100)/2,WriteToDebug("Returning "+(t=parseInt(t,10))),void(AICC_intPercentOfMaxSpeed=t)):(WriteToDebug("ERROR - invalid integer"),void AICC_SetError(AICC_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer"))}function AICC_FormatObjectives(e){var t,r,n,i,o,a;for(WriteToDebug("In AICC_FormatObjectives, strObjectivesFromLMS="+e),t=e.split("\n"),r=0;r<t.length;r++)WriteToDebug("Extracting Index From Line: "+t[r]),a=GetIndexFromAICCName(n=GetNameFromAICCLine(t[r])),WriteToDebug("strIndex: "+(a=parseInt(a,10))),AICC_aryObjectivesRead[parseInt(a,10)]=new Array(3);for(r=0;r<t.length;r++)WriteToDebug("Populating Line "+t[r]),n=GetNameFromAICCLine(t[r]),i=GetValueFromAICCLine(t[r]),a=GetIndexFromAICCName(n),WriteToDebug("strLineName: "+n),WriteToDebug("strLineValue: "+i),WriteToDebug("strIndex: "+a),"j_id"==(o=n.substr(0,4).toLowerCase())?(WriteToDebug("Found ID"),AICC_aryObjectivesRead[parseInt(a,10)][AICC_OBJ_ARRAY_ID]=i):"j_st"==o?(WriteToDebug("Found Status"),AICC_aryObjectivesRead[parseInt(a,10)][AICC_OBJ_ARRAY_STATUS]=AICC_ConvertAICCStatusIntoLocalStatus(i.charAt(0).toLowerCase())):"j_sc"==o?(WriteToDebug("Found Score"),AICC_aryObjectivesRead[parseInt(a,10)][AICC_OBJ_ARRAY_SCORE]=AICC_ExtractSingleScoreFromObjective(i)):WriteToDebug("WARNING - unidentified objective data found - "+t[r])}function AICC_ExtractSingleScoreFromObjective(e){var t;return WriteToDebug("In AICC_ExtractSingleScoreFromObjective, strLineValue="+e),WriteToDebug("returning "+(t=(t=e.split(";"))[0].split(","))[0]),t[0]}function FindObjectiveById(e,t){WriteToDebug("In FindObjectiveById, strID="+e);for(var r=0;r<=t.length;r++)if(WriteToDebug("Searching element "+r),t[r]&&(WriteToDebug("Element Exists"),t[r][AICC_OBJ_ARRAY_ID].toString()==e.toString()))return WriteToDebug("Element matches"),r;return null}function AICC_CreateValidIdentifier(e){return CreateValidIdentifierLegacy(e)}function AICC_FindInteractionIndexFromID(e){return WriteToDebug("AICC_FindInteractionIndexFromID - AICC does not support interaction retrieval, returning null"),null}function AICC_GetInteractionType(e){return WriteToDebug("AICC_GetInteractionType - AICC does not support interaction retrieval, returning empty string"),""}function AICC_GetInteractionTimestamp(e){return WriteToDebug("AICC_GetInteractionTimestamp - AICC does not support interaction retrieval, returning empty string"),""}function AICC_GetInteractionCorrectResponses(e){return WriteToDebug("AICC_GetInteractionCorrectResponses - AICC does not support interaction retrieval, returning empty array"),new Array}function AICC_GetInteractionWeighting(e){return WriteToDebug("AICC_GetInteractionWeighting - AICC does not support interaction retrieval, returning empty string"),""}function AICC_GetInteractionLearnerResponses(e){return WriteToDebug("AICC_GetInteractionLearnerResponses - AICC does not support interaction retrieval, returning empty array"),new Array}function AICC_GetInteractionResult(e){return WriteToDebug("AICC_GetInteractionResult - AICC does not support interaction retrieval, returning empty string"),""}function AICC_GetInteractionLatency(e){return WriteToDebug("AICC_GetInteractionDescription - AICC does not support interaction retrieval, returning empty string"),""}function AICC_GetInteractionDescription(e){return WriteToDebug("AICC_GetInteractionDescription - AICC does not support interaction retrieval, returning empty string"),""}function AICC_CreateDataBucket(e,t,r){return WriteToDebug("AICC_CreateDataBucket - AICC does not support SSP, returning false"),!1}function AICC_GetDataFromBucket(e){return WriteToDebug("AICC_GetDataFromBucket - AICC does not support SSP, returning empty string"),""}function AICC_PutDataInBucket(e,t,r){return WriteToDebug("AICC_PutDataInBucket - AICC does not support SSP, returning false"),!1}function AICC_DetectSSPSupport(){return WriteToDebug("AICC_DetectSSPSupport - AICC does not support SSP, returning false"),!1}function AICC_GetBucketInfo(e){return WriteToDebug("AICC_DetectSSPSupport - AICC does not support SSP, returning empty SSPBucketSize"),new SSPBucketSize(0,0)}function AICC_SetNavigationRequest(e){return WriteToDebug("AICC_SetNavigationRequest - AICC does not support navigation requests, returning false"),!1}function AICC_GetNavigationRequest(){return WriteToDebug("AICC_SetNavigationRequest - AICC does not support navigation requests, returning false"),!1}function FormAICCPostData(){WriteToDebug("In FormAICCPostData");var e="";return e+="[Core]\r\n",e+="Lesson_Location="+AICC_Lesson_Location+"\r\n",e+="Lesson_Status="+AICC_TranslateLessonStatusToAICC(AICC_Status)+"\r\n",e+="Score="+AICC_TranslateScoreToAICC()+"\r\n",e+="Time="+AICC_TranslateTimeToAICC()+"\r\n",e+="[Comments]\r\n"+AICC_TranslateCommentsToAICC()+"\r\n",e+="[Objectives_Status]\r\n"+AICC_TranslateObjectivesToAICC()+"\r\n",e+="[Student_Preferences]\r\n",e+="Audio="+AICC_TranslateAudioToAICC()+"\r\n",e+="Language="+AICC_Language+"\r\n",e+="Speed="+AICC_TranslateSpeedToAICC()+"\r\n",e+="Text="+AICC_TranslateTextToAICC()+"\r\n",e+="[Core_Lesson]\r\n",WriteToDebug("FormAICCPostData returning: "+(e+=AICC_Data_Chunk)),e}function AICC_TranslateLessonStatusToAICC(e){switch(WriteToDebug("In AICC_TranslateLessonStatusToAICC"),e){case LESSON_STATUS_PASSED:WriteToDebug("Status is passed"),AICC_Lesson_Status="P";break;case LESSON_STATUS_COMPLETED:WriteToDebug("Status is completed"),AICC_Lesson_Status="C";break;case LESSON_STATUS_FAILED:WriteToDebug("Status is failed"),AICC_Lesson_Status="F";break;case LESSON_STATUS_INCOMPLETE:WriteToDebug("Status is incomplete"),AICC_Lesson_Status="I";break;case LESSON_STATUS_BROWSED:WriteToDebug("Status is browsed"),AICC_Lesson_Status="B";break;case LESSON_STATUS_NOT_ATTEMPTED:WriteToDebug("Status is not attempted"),AICC_Lesson_Status="N"}return AICC_Lesson_Status}function AICC_TranslateScoreToAICC(){return WriteToDebug("In AICC_TranslateScoreToAICC"),AICC_Score=AICC_fltScoreRaw,AICC_LMS_Version<3&&""!=AICC_fltScoreRaw&&(AICC_Score=parseInt(AICC_Score,10)),(null==AICC_REPORT_MIN_MAX_SCORE||!0===AICC_REPORT_MIN_MAX_SCORE)&&AICC_LMS_Version>=3&&(WriteToDebug("Using max and min values if available."),""==AICC_fltScoreMax&&""==AICC_fltScoreMin||(WriteToDebug("Appending Max and Min scores"),AICC_Score+=","+AICC_fltScoreMax+","+AICC_fltScoreMin)),WriteToDebug("AICC_Score="+AICC_Score),AICC_Score}function AICC_TranslateTimeToAICC(){return WriteToDebug("In AICC_TranslateTimeToAICC"),ConvertMilliSecondsToSCORMTime(AICC_intSessionTimeMilliseconds,!1)}function AICC_TranslateCommentsToAICC(){WriteToDebug("In AICC_TranslateCommentsToAICC");for(var e="",t=0;t<AICC_aryCommentsFromLearner.length;t++)e+="<"+(t+1)+">"+AICC_aryCommentsFromLearner[t]+"<e."+(t+1)+">";return e}function AICC_TranslateObjectivesToAICC(){WriteToDebug("In AICC_TranslateObjectivesToAICC");for(var e="",t=0;t<AICC_aryObjectivesWrite.length;t++)WriteToDebug("Looking at index: "+t),AICC_aryObjectivesWrite[t]&&(WriteToDebug("Element "+t+" exists, id="+AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_ID]+", score="+AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_SCORE]+", status="+AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_STATUS]),e+="J_ID."+(t+1)+"="+AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_ID]+"\r\n",""!=AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_SCORE]&&(e+="J_Score."+(t+1)+"="+AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_SCORE]+"\r\n"),""!=AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_STATUS]&&(e+="J_Status."+(t+1)+"="+AICC_TranslateLessonStatusToAICC(AICC_aryObjectivesWrite[t][AICC_OBJ_ARRAY_STATUS])+"\r\n"));return e}function AICC_TranslateAudioToAICC(){var e;switch(WriteToDebug("In AICC_TranslateAudioToAICC"),AICC_AudioPlayPreference){case PREFERENCE_ON:WriteToDebug("Preference is ON"),e=AICC_intAudioVolume;break;case PREFERENCE_DEFAULT:WriteToDebug("Preference is DEFAULT"),e=0;break;case PREFERENCE_OFF:WriteToDebug("Preference is OFF"),e=-1}return e}function AICC_TranslateSpeedToAICC(){return WriteToDebug("In AICC_TranslateSpeedToAICC"),2*AICC_intPercentOfMaxSpeed-100}function AICC_TranslateTextToAICC(){WriteToDebug("In AICC_TranslateTextToAICC");var e=0;return AICC_TextPreference==PREFERENCE_OFF?e=-1:AICC_TextPreference==PREFERENCE_DEFAULT?e=0:AICC_TextPreference==PREFERENCE_ON&&(e=1),e}function FormAICCInteractionsData(){var e,t,r;WriteToDebug("In FormAICCInteractionsData");var n="";e='"course_id","student_id","lesson_id","date","time","interaction_id","objective_id","type_interaction","correct_response","student_response","result","weighting","latency"\r\n';for(var i="",o="",a="",s="",u=0;u<AICC_aryInteractions.length;u++){n="",1==(i=AICC_aryInteractions[u][AICC_INTERACTIONS_CORRECT])||i==INTERACTION_RESULT_CORRECT?n=AICC_RESULT_CORRECT:"false"==i||i==INTERACTION_RESULT_WRONG?n=AICC_RESULT_WRONG:i==INTERACTION_RESULT_UNANTICIPATED?n=AICC_RESULT_UNANTICIPATED:i==INTERACTION_RESULT_NEUTRAL&&(n=AICC_RESULT_NEUTRAL),t=ConvertDateToCMIDate(AICC_aryInteractions[u][AICC_INTERACTIONS_TIME_STAMP]),r=ConvertDateToCMITime(AICC_aryInteractions[u][AICC_INTERACTIONS_TIME_STAMP]),1==blnUseLongInteractionResultValues?(o=AICC_aryInteractions[u][AICC_INTERACTIONS_RESPONSE_LONG],a=AICC_aryInteractions[u][AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]):(o=AICC_aryInteractions[u][AICC_INTERACTIONS_RESPONSE],a=AICC_aryInteractions[u][AICC_INTERACTIONS_CORRECT_RESPONSE]),o=new String(o),a=new String(a);var c=AICC_aryInteractions[u][AICC_INTERACTIONS_LATENCY];null!=c&&""!=c&&(s=ConvertMilliSecondsToSCORMTime(c,!1)),e+='"'+AICC_CourseID.replace('"',"")+'","'+AICC_Student_ID.replace('"',"")+'","'+AICC_LESSON_ID.replace('"',"")+'","'+t+'","'+r+'","'+AICC_aryInteractions[u][AICC_INTERACTIONS_ID].replace('"',"")+'","","'+AICC_aryInteractions[u][AICC_INTERACTIONS_TYPE]+'","'+a.replace('"',"")+'","'+o.replace('"',"")+'","'+n+'","'+AICC_aryInteractions[u][AICC_INTERACTIONS_WEIGHTING]+'","'+s+'"\r\n'}return e}function DisplayAICCVariables(){var e="";e+="AICC_Student_ID = "+AICC_Student_ID+"\n",e+="AICC_Student_Name = "+AICC_Student_Name+"\n",e+="AICC_Lesson_Location = "+AICC_Lesson_Location+"\n",e+="AICC_Score = "+AICC_Score+"\n",e+="AICC_Credit = "+AICC_Credit+"\n",e+="AICC_Lesson_Status = "+AICC_Lesson_Status+"\n",e+="AICC_Time = "+AICC_Time+"\n",e+="AICC_Mastery_Score = "+AICC_Mastery_Score+"\n",e+="AICC_Lesson_Mode = "+AICC_Lesson_Mode+"\n",e+="AICC_Max_Time_Allowed = "+AICC_Max_Time_Allowed+"\n",e+="AICC_Time_Limit_Action = "+AICC_Time_Limit_Action+"\n",e+="AICC_Audio = "+AICC_Audio+"\n",e+="AICC_Speed = "+AICC_Speed+"\n",e+="AICC_Language = "+AICC_Language+"\n",e+="AICC_Text = "+AICC_Text+"\n",e+="AICC_Launch_Data = "+AICC_Launch_Data+"\n",e+="AICC_Data_Chunk = "+AICC_Data_Chunk+"\n",e+="AICC_Comments = "+AICC_Comments+"\n",e+="AICC_Objectives = "+AICC_Objectives+"\n",alert(e)}function NONE_Initialize(){return WriteToDebug("In NONE_Initialize, Returning true"),InitializeExecuted(!0,""),!0}function NONE_Finish(e,t){return WriteToDebug("In NONE_Finish, Returning true"),!0}function NONE_CommitData(){return WriteToDebug("In NONE_CommitData, Returning true"),!0}function NONE_GetStudentID(){return WriteToDebug("In NONE_GetStudentID, Returning ''"),""}function NONE_GetStudentName(){return WriteToDebug("In NONE_GetStudentName, Returning ''"),""}function NONE_GetBookmark(){return WriteToDebug("In NONE_GetBookmark, Returning ''"),""}function NONE_SetBookmark(e){return WriteToDebug("In NONE_SetBookmark, Returning true"),!0}function NONE_GetDataChunk(){return WriteToDebug("In NONE_GetDataChunk, Returning ''"),""}function NONE_SetDataChunk(e){return WriteToDebug("In NONE_SetDataChunk, Returning true"),!0}function NONE_GetLaunchData(){return WriteToDebug("In NONE_GetLaunchData, Returning ''"),""}function NONE_GetComments(){return WriteToDebug("In NONE_GetComments, Returning ''"),""}function NONE_WriteComment(e){return WriteToDebug("In NONE_WriteComment, Returning true"),!0}function NONE_GetLMSComments(){return WriteToDebug("In NONE_GetLMSComments, Returning ''"),""}function NONE_GetAudioPlayPreference(){return WriteToDebug("In NONE_GetAudioPlayPreference, Returning "+PREFERENCE_DEFAULT),PREFERENCE_DEFAULT}function NONE_GetAudioVolumePreference(){return WriteToDebug("In NONE_GetAudioVolumePreference, Returning 100"),100}function NONE_SetAudioPreference(e,t){return WriteToDebug("In NONE_SetAudioPreference, Returning true"),!0}function NONE_SetLanguagePreference(e){return WriteToDebug("In NONE_SetLanguagePreference, Returning true"),!0}function NONE_GetLanguagePreference(){return WriteToDebug("In NONE_GetLanguagePreference, Returning ''"),""}function NONE_SetSpeedPreference(e){return WriteToDebug("In NONE_SetSpeedPreference, Returning true"),!0}function NONE_GetSpeedPreference(){return WriteToDebug("In NONE_GetSpeedPreference, Returning 100"),100}function NONE_SetTextPreference(e){return WriteToDebug("In NONE_SetTextPreference, Returning true"),!0}function NONE_GetTextPreference(){return WriteToDebug("In NONE_GetTextPreference, Returning "+PREFERENCE_DEFAULT),PREFERENCE_DEFAULT}function NONE_GetPreviouslyAccumulatedTime(){return WriteToDebug("In NONE_GetPreviouslyAccumulatedTime, Returning 0"),0}function NONE_SaveTime(e){return WriteToDebug("In intMilliSeconds, Returning true"),!0}function NONE_GetMaxTimeAllowed(){return WriteToDebug("In NONE_GetMaxTimeAllowed, Returning 36002439999"),MAX_CMI_TIME}function NONE_DisplayMessageOnTimeout(){return WriteToDebug("In NONE_DisplayMessageOnTimeout, Returning false"),!1}function NONE_ExitOnTimeout(){return WriteToDebug("In NONE_ExitOnTimeout, Returning false"),!1}function NONE_GetPassingScore(){return WriteToDebug("In NONE_GetPassingScore, Returning ''"),""}function NONE_GetScore(){return WriteToDebug("In NONE_GetScore, Returning 0"),0}function NONE_SetScore(e,t,r){return WriteToDebug("In NONE_SetScore, Returning true"),!0}function NONE_RecordTrueFalseInteraction(){return WriteToDebug("In NONE_RecordTrueFalseInteraction, Returning true"),!0}function NONE_RecordMultipleChoiceInteraction(e,t,r,n){return WriteToDebug("In NONE_RecordMultipleChoiceInteraction, Returning true"),!0}function NONE_RecordFillInInteraction(){return WriteToDebug("In NONE_RecordFillInInteraction, Returning true"),!0}function NONE_RecordMatchingInteraction(){return WriteToDebug("In NONE_RecordMatchingInteraction, Returning true"),!0}function NONE_RecordPerformanceInteraction(){return WriteToDebug("In NONE_RecordPerformanceInteraction, Returning true"),!0}function NONE_RecordSequencingInteraction(){return WriteToDebug("In NONE_RecordSequencingInteraction, Returning true"),!0}function NONE_RecordLikertInteraction(){return WriteToDebug("In RecordLikertInteraction, Returning true"),!0}function NONE_RecordNumericInteraction(){return WriteToDebug("In NONE_RecordNumericInteraction, Returning true"),!0}function NONE_GetEntryMode(){return WriteToDebug("In NONE_GetEntryMode, Returning "+ENTRY_FIRST_TIME),ENTRY_FIRST_TIME}function NONE_GetLessonMode(){return WriteToDebug("In NONE_GetLessonMode, Returning "+MODE_NORMAL),MODE_NORMAL}function NONE_GetTakingForCredit(){return WriteToDebug("In NONE_GetTakingForCredit, Returning true"),!0}function NONE_SetObjectiveScore(e,t,r,n){return WriteToDebug("In NONE_SetObjectiveScore, Returning true"),!0}function NONE_SetObjectiveStatus(e,t){return WriteToDebug("In NONE_SetObjectiveStatus, Returning true"),!0}function NONE_SetObjectiveDescription(e,t){return WriteToDebug("In NONE_SetObjectiveDescription, Returning true"),!0}function NONE_GetObjectiveScore(e){return WriteToDebug("In NONE_SetObjectiveScore, Returning ''"),""}function NONE_GetObjectiveStatus(e){return WriteToDebug("In NONE_SetObjectiveStatus, Returning Not Attempted"),LESSON_STATUS_NOT_ATTEMPTED}function NONE_GetObjectiveDescription(e){return WriteToDebug("In NONE_GetObjectiveDescription, ''"),""}function NONE_CreateValidIdentifier(e){return CreateUriIdentifier(e)}function NONE_FindInteractionIndexFromID(e){return WriteToDebug("NONE_FindInteractionIndexFromID - NONE does not support interaction retrieval, returning null"),null}function NONE_GetInteractionType(e){return WriteToDebug("NONE_GetInteractionType - NONE does not support interaction retrieval, returning empty string"),""}function NONE_GetInteractionTimestamp(e){return WriteToDebug("NONE_GetInteractionTimestamp - NONE does not support interaction retrieval, returning empty string"),""}function NONE_GetInteractionCorrectResponses(e){return WriteToDebug("NONE_GetInteractionCorrectResponses - NONE does not support interaction retrieval, returning empty array"),new Array}function NONE_GetInteractionWeighting(e){return WriteToDebug("NONE_GetInteractionWeighting - NONE does not support interaction retrieval, returning empty string"),""}function NONE_GetInteractionLearnerResponses(e){return WriteToDebug("NONE_GetInteractionLearnerResponses - NONE does not support interaction retrieval, returning empty array"),new Array}function NONE_GetInteractionResult(e){return WriteToDebug("NONE_GetInteractionResult - NONE does not support interaction retrieval, returning empty string"),""}function NONE_GetInteractionLatency(e){return WriteToDebug("NONE_GetInteractionDescription - NONE does not support interaction retrieval, returning empty string"),""}function NONE_GetInteractionDescription(e){return WriteToDebug("NONE_GetInteractionDescription - NONE does not support interaction retrieval, returning empty string"),""}function NONE_CreateDataBucket(e,t,r){return WriteToDebug("NONE_CreateDataBucket - NONE does not support SSP, returning false"),!1}function NONE_GetDataFromBucket(e){return WriteToDebug("NONE_GetDataFromBucket - NONE does not support SSP, returning empty string"),""}function NONE_PutDataInBucket(e,t,r){return WriteToDebug("NONE_PutDataInBucket - NONE does not support SSP, returning false"),!1}function NONE_DetectSSPSupport(){return WriteToDebug("NONE_DetectSSPSupport - NONE does not support SSP, returning false"),!1}function NONE_GetBucketInfo(e){return WriteToDebug("NONE_DetectSSPSupport - NONE does not support SSP, returning empty SSPBucketSize"),new SSPBucketSize(0,0)}function NONE_SetNavigationRequest(e){return WriteToDebug("NONE_SetNavigationRequest - NONE does not support navigation requests, returning false"),!1}function NONE_GetNavigationRequest(){return WriteToDebug("NONE_GetNavigationRequest - NONE does not support navigation requests, returning false"),!1}function NONE_SetFailed(){return WriteToDebug("In NONE_SetFailed, Returning true"),!0}function NONE_SetPassed(){return WriteToDebug("In NONE_SetPassed, Returning true"),!0}function NONE_SetCompleted(){return WriteToDebug("In NONE_SetCompleted, Returning true"),!0}function NONE_ResetStatus(){return WriteToDebug("In NONE_ResetStatus, Returning true"),!0}function NONE_GetStatus(){return WriteToDebug("In NONE_GetStatus, Returning "+LESSON_STATUS_INCOMPLETE),LESSON_STATUS_INCOMPLETE}function NONE_GetProgressMeasure(){return WriteToDebug("NONE_GetProgressMeasure - NONE does not support progress_measure, returning false"),!1}function NONE_SetProgressMeasure(){return WriteToDebug("NONE_SetProgressMeasure - NONE does not support progress_measure, returning false"),!1}function NONE_GetObjectiveProgressMeasure(){return WriteToDebug("NONE_GetObjectiveProgressMeasure - NONE does not support progress_measure, returning false"),!1}function NONE_SetObjectiveProgressMeasure(){return WriteToDebug("NONE_SetObjectiveProgressMeasure - NONE does not support progress_measure, returning false"),!1}function NONE_SetPointBasedScore(e,t,r){return WriteToDebug("NONE_SetPointBasedScore - NONE does not support SetPointBasedScore, returning false"),!1}function NONE_GetScaledScore(e,t,r){return WriteToDebug("NONE_GetScaledScore - NONE does not support GetScaledScore, returning false"),!1}function NONE_GetLastError(){return WriteToDebug("In NONE_GetLastError, Returning "+NO_ERROR),NO_ERROR}function NONE_GetLastErrorDesc(){return WriteToDebug("In NONE_GetLastErrorDesc, Returning ''"),""}var CryptoJS=CryptoJS||function(e){var t={},r=t.lib={},n=function(){},i=r.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes;if(e=e.sigBytes,this.clamp(),n%4)for(var i=0;i<e;i++)t[n+i>>>2]|=(r[i>>>2]>>>24-i%4*8&255)<<24-(n+i)%4*8;else if(65535<r.length)for(i=0;i<e;i+=4)t[n+i>>>2]=r[i>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*e.random()|0);return new o.init(r,t)}}),a=t.enc={},s=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++){var i=t[n>>>2]>>>24-n%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++)r.push(String.fromCharCode(t[n>>>2]>>>24-n%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},l=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,i=e.min(4*t,i),t){for(var u=0;u<t;u+=a)this._doProcessBlock(n,u);u=n.splice(0,t),r.sigBytes-=i}return new o.init(u,i)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=l.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new C.HMAC.init(e,r).finalize(t)}}});var C=t.algo={};return t}(Math);!function(){var e=CryptoJS,t=(i=e.lib).WordArray,r=i.Hasher,n=[],i=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],o=r[1],a=r[2],s=r[3],u=r[4],c=0;80>c;c++){if(16>c)n[c]=0|e[t+c];else{var l=n[c-3]^n[c-8]^n[c-14]^n[c-16];n[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+n[c],l=20>c?l+(1518500249+(o&a|~o&s)):40>c?l+(1859775393+(o^a^s)):60>c?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),u=s,s=a,a=o<<30|o>>>2,o=i,i=l}r[0]=r[0]+i|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)}();var TinCan,Cmi5,TC_COURSE_ID,TC_COURSE_NAME,TC_COURSE_DESC,TC_RECORD_STORES;CryptoJS=CryptoJS||function(e){var t={},r=t.lib={},n=function(){},i=r.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes;if(e=e.sigBytes,this.clamp(),n%4)for(var i=0;i<e;i++)t[n+i>>>2]|=(r[i>>>2]>>>24-i%4*8&255)<<24-(n+i)%4*8;else if(65535<r.length)for(i=0;i<e;i+=4)t[n+i>>>2]=r[i>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*e.random()|0);return new o.init(r,t)}}),a=t.enc={},s=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++){var i=t[n>>>2]>>>24-n%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++)r.push(String.fromCharCode(t[n>>>2]>>>24-n%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},l=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,i=e.min(4*t,i),t){for(var u=0;u<t;u+=a)this._doProcessBlock(n,u);u=n.splice(0,t),r.sigBytes-=i}return new o.init(u,i)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=l.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new C.HMAC.init(e,r).finalize(t)}}});var C=t.algo={};return t}(Math);!function(e){for(var t=CryptoJS,r=(i=t.lib).WordArray,n=i.Hasher,i=t.algo,o=[],a=[],s=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var C=e.sqrt(l),I=2;I<=C;I++)if(!(l%I)){l=!1;break e}l=!0}l&&(8>c&&(o[c]=s(e.pow(u,.5))),a[c]=s(e.pow(u,1/3)),c++),u++}var _=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],C=r[7],I=0;64>I;I++){if(16>I)_[I]=0|e[t+I];else{var S=_[I-15],T=_[I-2];_[I]=((S<<25|S>>>7)^(S<<14|S>>>18)^S>>>3)+_[I-7]+((T<<15|T>>>17)^(T<<13|T>>>19)^T>>>10)+_[I-16]}S=C+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[I]+_[I],T=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&o^i&o),C=l,l=c,c=u,u=s+S|0,s=o,o=i,i=n,n=S+T|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0,r[5]=r[5]+c|0,r[6]=r[6]+l|0,r[7]=r[7]+C|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(i),t.HmacSHA256=n._createHmacHelper(i)}(Math),function(){var e=CryptoJS,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var r=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(r=o)}for(var a=[],s=0,u=0;u<r;u++)if(u%4){var c=n.indexOf(e.charAt(u-1))<<u%4*2,l=n.indexOf(e.charAt(u))>>>6-u%4*2;a[s>>>2]|=(c|l)<<24-s%4*8,s++}return t.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(){if("function"==typeof ArrayBuffer){var e=CryptoJS.lib.WordArray,t=e.init,r=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};r.prototype=e}}(),function(){"use strict";var e={statementId:!0,voidedStatementId:!0,verb:!0,object:!0,registration:!0,context:!0,actor:!0,since:!0,until:!0,limit:!0,authoritative:!0,sparse:!0,instructor:!0,ascending:!0,continueToken:!0,agent:!0,activityId:!0,stateId:!0,profileId:!0,activity_platform:!0,grouping:!0,"Accept-Language":!0};(TinCan=function(e){this.log("constructor"),this.recordStores=[],this.actor=null,this.activity=null,this.registration=null,this.context=null,this.init(e)}).prototype={LOG_SRC:"TinCan",log:function(e,t){TinCan.DEBUG&&"undefined"!=typeof console&&console.log&&(t=t||this.LOG_SRC||"TinCan",console.log("TinCan."+t+": "+e))},init:function(e){var t;if(this.log("init"),(e=e||{}).hasOwnProperty("url")&&""!==e.url&&this._initFromQueryString(e.url),e.hasOwnProperty("recordStores")&&void 0!==e.recordStores)for(t=0;t<e.recordStores.length;t+=1)this.addRecordStore(e.recordStores[t]);e.hasOwnProperty("activity")&&(e.activity instanceof TinCan.Activity?this.activity=e.activity:this.activity=new TinCan.Activity(e.activity)),e.hasOwnProperty("actor")&&(e.actor instanceof TinCan.Agent?this.actor=e.actor:this.actor=new TinCan.Agent(e.actor)),e.hasOwnProperty("context")&&(e.context instanceof TinCan.Context?this.context=e.context:this.context=new TinCan.Context(e.context)),e.hasOwnProperty("registration")&&(this.registration=e.registration)},_initFromQueryString:function(t){this.log("_initFromQueryString");var r,n,i,o=TinCan.Utils.parseURL(t).params,a=["endpoint","auth"],s={},u=null;if(o.hasOwnProperty("actor")){this.log("_initFromQueryString - found actor: "+o.actor);try{this.actor=TinCan.Agent.fromJSON(o.actor),delete o.actor}catch(e){this.log("_initFromQueryString - failed to set actor: "+e)}}else{var c=TCAPI_GetStaticActor();null!==c&&(this.log("_initFromQueryString - using static actor from driver options"),this.actor=c)}if(o.hasOwnProperty("activity_id")&&(this.activity=new TinCan.Activity({id:o.activity_id}),delete o.activity_id),(o.hasOwnProperty("activity_platform")||o.hasOwnProperty("registration")||o.hasOwnProperty("grouping"))&&(i={},o.hasOwnProperty("activity_platform")&&(i.platform=o.activity_platform,delete o.activity_platform),o.hasOwnProperty("registration")&&(i.registration=this.registration=o.registration,delete o.registration),o.hasOwnProperty("grouping")&&(i.contextActivities={},i.contextActivities.grouping=o.grouping,delete o.grouping),this.context=new TinCan.Context(i)),o.hasOwnProperty("endpoint")){for(r=0;r<a.length;r+=1)n=a[r],o.hasOwnProperty(n)&&(s[n]=o[n],delete o[n]);for(r in o)o.hasOwnProperty(r)&&(e.hasOwnProperty(r)?delete o[r]:(u=u||{})[r]=o[r]);null!==u&&(s.extended=u),s.allowFail=!1,this.addRecordStore(s)}else{var l=TCAPI_GetStaticLRSConfig();null!==l&&(this.log("_initFromQueryString - using static LRS configuration from driver options"),this.addRecordStore(l))}},addRecordStore:function(e){var t;this.log("addRecordStore"),t=e instanceof TinCan.LRS?e:new TinCan.LRS(e),this.recordStores.push(t)},prepareStatement:function(e){return this.log("prepareStatement"),e instanceof TinCan.Statement||(e=new TinCan.Statement(e)),null===e.actor&&null!==this.actor&&(e.actor=this.actor),null===e.target&&null!==this.activity&&(e.target=this.activity),null!==this.context&&(null===e.context?e.context=this.context:(null===e.context.registration&&(e.context.registration=this.context.registration),null===e.context.platform&&(e.context.platform=this.context.platform),null!==this.context.contextActivities&&(null===e.context.contextActivities?e.context.contextActivities=this.context.contextActivities:(null!==this.context.contextActivities.grouping&&null===e.context.contextActivities.grouping&&(e.context.contextActivities.grouping=this.context.contextActivities.grouping),null!==this.context.contextActivities.parent&&null===e.context.contextActivities.parent&&(e.context.contextActivities.parent=this.context.contextActivities.parent),null!==this.context.contextActivities.other&&null===e.context.contextActivities.other&&(e.context.contextActivities.other=this.context.contextActivities.other))))),e},sendStatement:function(e,t){this.log("sendStatement");var r,n,i,o=this,a=this.prepareStatement(e),s=this.recordStores.length,u=[],c=[];if(s>0)for("function"==typeof t&&(i=function(e,r){var n;o.log("sendStatement - callbackWrapper: "+s),s>1?(s-=1,c.push({err:e,xhr:r})):1===s?(c.push({err:e,xhr:r}),n=[c,a],t.apply(this,n)):o.log("sendStatement - unexpected record store count: "+s)}),n=0;n<s;n+=1)r=this.recordStores[n],u.push(r.saveStatement(a,{callback:i}));else this.log("[warning] sendStatement: No LRSs added yet (statement not sent)"),"function"==typeof t&&t.apply(this,[null,a]);return{statement:a,results:u}},getStatement:function(e,t,r){if(this.log("getStatement"),(r=r||{}).params=r.params||{},this.recordStores.length>0)return this.recordStores[0].retrieveStatement(e,{callback:t,params:r.params});this.log("[warning] getStatement: No LRSs added yet (statement not retrieved)")},voidStatement:function(e,t,r){this.log("voidStatement");var n,i,o,a,s,u=this,c=this.recordStores.length,l=[],C=[];if(e instanceof TinCan.Statement&&(e=e.id),void 0!==r.actor?i=r.actor:null!==this.actor&&(i=this.actor),o=new TinCan.Statement({actor:i,verb:{id:"http://adlnet.gov/expapi/verbs/voided"},target:{objectType:"StatementRef",id:e}}),c>0)for("function"==typeof t&&(s=function(e,r){var n;u.log("voidStatement - callbackWrapper: "+c),c>1?(c-=1,C.push({err:e,xhr:r})):1===c?(C.push({err:e,xhr:r}),n=[C,o],t.apply(this,n)):u.log("voidStatement - unexpected record store count: "+c)}),a=0;a<c;a+=1)n=this.recordStores[a],l.push(n.saveStatement(o,{callback:s}));else this.log("[warning] voidStatement: No LRSs added yet (statement not sent)"),"function"==typeof t&&t.apply(this,[null,o]);return{statement:o,results:l}},getVoidedStatement:function(e,t){if(this.log("getVoidedStatement"),this.recordStores.length>0)return this.recordStores[0].retrieveVoidedStatement(e,{callback:t});this.log("[warning] getVoidedStatement: No LRSs added yet (statement not retrieved)")},sendStatements:function(e,t){this.log("sendStatements");var r,n,i,o=this,a=[],s=this.recordStores.length,u=[],c=[];if(0===e.length)"function"==typeof t&&t.apply(this,[null,a]);else{for(n=0;n<e.length;n+=1)a.push(this.prepareStatement(e[n]));if(s>0)for("function"==typeof t&&(i=function(e,r){var n;o.log("sendStatements - callbackWrapper: "+s),s>1?(s-=1,c.push({err:e,xhr:r})):1===s?(c.push({err:e,xhr:r}),n=[c,a],t.apply(this,n)):o.log("sendStatements - unexpected record store count: "+s)}),n=0;n<s;n+=1)r=this.recordStores[n],u.push(r.saveStatements(a,{callback:i}));else this.log("[warning] sendStatements: No LRSs added yet (statements not sent)"),"function"==typeof t&&t.apply(this,[null,a])}return{statements:a,results:u}},getStatements:function(e){this.log("getStatements");var t,r,n={};if(this.recordStores.length>0)return t=this.recordStores[0],r=(e=e||{}).params||{},e.sendActor&&null!==this.actor&&("0.9"===t.version||"0.95"===t.version?r.actor=this.actor:r.agent=this.actor),e.sendActivity&&null!==this.activity&&("0.9"===t.version||"0.95"===t.version?r.target=this.activity:r.activity=this.activity),void 0===r.registration&&null!==this.registration&&(r.registration=this.registration),n={params:r},void 0!==e.callback&&(n.callback=e.callback),t.queryStatements(n);this.log("[warning] getStatements: No LRSs added yet (statements not read)")},getState:function(e,t){var r,n;if(this.log("getState"),this.recordStores.length>0)return n=this.recordStores[0],r={agent:void 0!==(t=t||{}).agent?t.agent:this.actor,activity:void 0!==t.activity?t.activity:this.activity},void 0!==t.registration?r.registration=t.registration:null!==this.registration&&(r.registration=this.registration),void 0!==t.callback&&(r.callback=t.callback),n.retrieveState(e,r);this.log("[warning] getState: No LRSs added yet (state not retrieved)")},setState:function(e,t,r){var n,i;if(this.log("setState"),this.recordStores.length>0)return i=this.recordStores[0],n={agent:void 0!==(r=r||{}).agent?r.agent:this.actor,activity:void 0!==r.activity?r.activity:this.activity},void 0!==r.registration?n.registration=r.registration:null!==this.registration&&(n.registration=this.registration),void 0!==r.lastSHA1&&(n.lastSHA1=r.lastSHA1),void 0!==r.contentType&&(n.contentType=r.contentType,void 0!==r.overwriteJSON&&!r.overwriteJSON&&TinCan.Utils.isApplicationJSON(r.contentType)&&(n.method="POST")),void 0!==r.callback&&(n.callback=r.callback),i.saveState(e,t,n);this.log("[warning] setState: No LRSs added yet (state not saved)")},deleteState:function(e,t){var r,n;if(this.log("deleteState"),this.recordStores.length>0)return n=this.recordStores[0],r={agent:void 0!==(t=t||{}).agent?t.agent:this.actor,activity:void 0!==t.activity?t.activity:this.activity},void 0!==t.registration?r.registration=t.registration:null!==this.registration&&(r.registration=this.registration),void 0!==t.callback&&(r.callback=t.callback),n.dropState(e,r);this.log("[warning] deleteState: No LRSs added yet (state not deleted)")},getActivityProfile:function(e,t){var r,n;if(this.log("getActivityProfile"),this.recordStores.length>0)return n=this.recordStores[0],r={activity:void 0!==(t=t||{}).activity?t.activity:this.activity},void 0!==t.callback&&(r.callback=t.callback),n.retrieveActivityProfile(e,r);this.log("[warning] getActivityProfile: No LRSs added yet (activity profile not retrieved)")},setActivityProfile:function(e,t,r){var n,i;if(this.log("setActivityProfile"),this.recordStores.length>0)return i=this.recordStores[0],n={activity:void 0!==(r=r||{}).activity?r.activity:this.activity},void 0!==r.callback&&(n.callback=r.callback),void 0!==r.lastSHA1&&(n.lastSHA1=r.lastSHA1),void 0!==r.contentType&&(n.contentType=r.contentType,void 0!==r.overwriteJSON&&!r.overwriteJSON&&TinCan.Utils.isApplicationJSON(r.contentType)&&(n.method="POST")),i.saveActivityProfile(e,t,n);this.log("[warning] setActivityProfile: No LRSs added yet (activity profile not saved)")},deleteActivityProfile:function(e,t){var r,n;if(this.log("deleteActivityProfile"),this.recordStores.length>0)return n=this.recordStores[0],r={activity:void 0!==(t=t||{}).activity?t.activity:this.activity},void 0!==t.callback&&(r.callback=t.callback),n.dropActivityProfile(e,r);this.log("[warning] deleteActivityProfile: No LRSs added yet (activity profile not deleted)")},getAgentProfile:function(e,t){var r,n;if(this.log("getAgentProfile"),this.recordStores.length>0)return n=this.recordStores[0],r={agent:void 0!==(t=t||{}).agent?t.agent:this.actor},void 0!==t.callback&&(r.callback=t.callback),n.retrieveAgentProfile(e,r);this.log("[warning] getAgentProfile: No LRSs added yet (agent profile not retrieved)")},setAgentProfile:function(e,t,r){var n,i;if(this.log("setAgentProfile"),this.recordStores.length>0)return i=this.recordStores[0],n={agent:void 0!==(r=r||{}).agent?r.agent:this.actor},void 0!==r.callback&&(n.callback=r.callback),void 0!==r.lastSHA1&&(n.lastSHA1=r.lastSHA1),void 0!==r.contentType&&(n.contentType=r.contentType,void 0!==r.overwriteJSON&&!r.overwriteJSON&&TinCan.Utils.isApplicationJSON(r.contentType)&&(n.method="POST")),i.saveAgentProfile(e,t,n);this.log("[warning] setAgentProfile: No LRSs added yet (agent profile not saved)")},deleteAgentProfile:function(e,t){var r,n;if(this.log("deleteAgentProfile"),this.recordStores.length>0)return n=this.recordStores[0],r={agent:void 0!==(t=t||{}).agent?t.agent:this.actor},void 0!==t.callback&&(r.callback=t.callback),n.dropAgentProfile(e,r);this.log("[warning] deleteAgentProfile: No LRSs added yet (agent profile not deleted)")}},TinCan.DEBUG=!1,TinCan.enableDebug=function(){TinCan.DEBUG=!0},TinCan.disableDebug=function(){TinCan.DEBUG=!1},TinCan.versions=function(){return["1.0.2","1.0.1","1.0.0","0.95","0.9"]},"object"==typeof module&&(module.exports=TinCan)}(),function(){"use strict";TinCan.Utils={defaultEncoding:"utf8",getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},getISODateString:function(e){function t(e,t){var r,n;for(null==e&&(e=0),null==t&&(t=2),r=Math.pow(10,t-1),n=e.toString();e<r&&r>1;)n="0"+n,r/=10;return n}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+t(e.getUTCMilliseconds(),3)+"Z"},convertISO8601DurationToMilliseconds:function(e){var t,r,n,i,o=e.indexOf("-")>=0,a=e.indexOf("T"),s=e.indexOf("H"),u=e.indexOf("M"),c=e.indexOf("S");if(-1===a||-1!==u&&u<a||-1!==e.indexOf("D")||-1!==e.indexOf("Y"))throw new Error("ISO 8601 timestamps including years, months and/or days are not currently supported");return-1===s?(s=a,t=0):t=parseInt(e.slice(a+1,s),10),-1===u?(u=a,r=0):r=parseInt(e.slice(s+1,u),10),n=parseFloat(e.slice(u+1,c)),i=parseInt(1e3*(60*(60*t+r)+n),10),isNaN(i)&&(i=0),o&&(i*=-1),i},convertMillisecondsToISO8601Duration:function(e){var t,r,n,i=parseInt(e,10),o="",a="";return(n=Math.round(i/10))<0&&(o="-",n*=-1),a=o+"PT",(t=parseInt(n/36e4,10))>0&&(a+=t+"H"),(r=parseInt(n%36e4/6e3,10))>0&&(a+=r+"M"),a+=n%36e4%6e3/100+"S"},getSHA1String:function(e){return CryptoJS.SHA1(e).toString(CryptoJS.enc.Hex)},getSHA256String:function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)&&(e=CryptoJS.lib.WordArray.create(e)),CryptoJS.SHA256(e).toString(CryptoJS.enc.Hex)},getBase64String:function(e){return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(e))},getLangDictionaryValue:function(e,t){var r,n=this[e];if(void 0!==t&&void 0!==n[t])return n[t];if(void 0!==n.und)return n.und;if(void 0!==n["en-US"])return n["en-US"];for(r in n)if(n.hasOwnProperty(r))return n[r];return""},parseURL:function(e,t){var r,n,i,o,a="/"===e.charAt(0),s=["(/[^?#]*)","(\\?[^#]*|)","(#.*|)$"],u=/\+/g,c=/([^&=]+)=?([^&]*)/g,l=function(e){return decodeURIComponent(e.replace(u," "))};if(t=t||{},a){if(void 0===t.allowRelative||!t.allowRelative)throw new Error("Refusing to parse relative URL without 'allowRelative' option")}else s.unshift("^(https?:)//","(([^:/?#]*)(?::([0-9]+))?)"),-1===e.indexOf("/",8)&&(e+="/");if(r=new RegExp(s.join("")),null===(n=e.match(r)))throw new Error("Unable to parse URL regular expression did not match: '"+e+"'");if(a?(i={protocol:null,host:null,hostname:null,port:null,path:null,pathname:n[1],search:n[2],hash:n[3],params:{}}).path=i.pathname:(i={protocol:n[1],host:n[2],hostname:n[3],port:n[4],pathname:n[5],search:n[6],hash:n[7],params:{}}).path=i.protocol+"//"+i.host+i.pathname,""!==i.search)for(;o=c.exec(i.search.substring(1));)i.params[l(o[1])]=l(o[2]);return i},getServerRoot:function(e){var t=e.split("/");return t[0]+"//"+t[2]},getContentTypeFromHeader:function(e){return String(e).split(";")[0]},isApplicationJSON:function(e){return 0===TinCan.Utils.getContentTypeFromHeader(e).toLowerCase().indexOf("application/json")},stringToArrayBuffer:function(){TinCan.prototype.log("stringToArrayBuffer not overloaded - no environment loaded?")},stringFromArrayBuffer:function(){TinCan.prototype.log("stringFromArrayBuffer not overloaded - no environment loaded?")}}}(),function(){"use strict";var e=TinCan.LRS=function(e){this.log("constructor"),this.endpoint=null,this.version=null,this.auth=null,this.allowFail=!0,this.extended=null,this.init(e)};e.prototype={LOG_SRC:"LRS",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=TinCan.versions(),n=!1;if((e=e||{}).hasOwnProperty("alertOnRequestFailure")&&this.log("'alertOnRequestFailure' is deprecated (alerts have been removed) no need to set it now"),!e.hasOwnProperty("endpoint")||null===e.endpoint||""===e.endpoint)throw this.log("[error] LRS invalid: no endpoint"),{code:3,mesg:"LRS invalid: no endpoint"};if(this.endpoint=String(e.endpoint),"/"!==this.endpoint.slice(-1)&&(this.log("adding trailing slash to endpoint"),this.endpoint+="/"),e.hasOwnProperty("allowFail")&&(this.allowFail=e.allowFail),e.hasOwnProperty("auth")?this.auth=e.auth:e.hasOwnProperty("username")&&e.hasOwnProperty("password")&&(this.auth="Basic "+TinCan.Utils.getBase64String(e.username+":"+e.password)),e.hasOwnProperty("extended")&&(this.extended=e.extended),this._initByEnvironment(e),void 0!==e.version){for(this.log("version: "+e.version),t=0;t<r.length;t+=1)if(r[t]===e.version){n=!0;break}if(!n)throw this.log("[error] LRS invalid: version not supported ("+e.version+")"),{code:5,mesg:"LRS invalid: version not supported ("+e.version+")"};this.version=e.version}else this.version=r[0]},_getBoundary:function(){return TinCan.Utils.getUUID().replace(/-/g,"")},_initByEnvironment:function(){this.log("_initByEnvironment not overloaded - no environment loaded?")},_makeRequest:function(){this.log("_makeRequest not overloaded - no environment loaded?")},_getMultipartRequestData:function(){this.log("_getMultipartRequestData not overloaded - no environment loaded?")},_IEModeConversion:function(){this.log("_IEModeConversion not overloaded - browser environment not loaded.")},_processGetStatementResult:function(e,t){var r,n,i,o,a={};if(!t.attachments)return TinCan.Statement.fromJSON(e.responseText);for(r=e.getResponseHeader("Content-Type").split("boundary=")[1],n=this._parseMultipart(r,e.response),i=JSON.parse(n[0].body),o=1;o<n.length;o+=1)a[n[o].headers["X-Experience-API-Hash"]]=n[o].body;return this._assignAttachmentContent([i],a),new TinCan.Statement(i)},sendRequest:function(e){this.log("sendRequest");var t,r=this.endpoint+e.url,n={};if(0===e.url.indexOf("http")&&(r=e.url),null!==this.extended)for(t in e.params=e.params||{},this.extended)this.extended.hasOwnProperty(t)&&(e.params.hasOwnProperty(t)||null!==this.extended[t]&&(e.params[t]=this.extended[t]));for(t in n.Authorization=this.auth,"0.9"!==this.version&&(n["X-Experience-API-Version"]=this.version),e.headers)e.headers.hasOwnProperty(t)&&(n[t]=e.headers[t]);return this._makeRequest(r,n,e)},about:function(e){var t,r,n;if(this.log("about"),t={url:"about",method:"GET",params:{}},void 0!==(e=e||{}).callback&&(n=function(t,r){var n=r;null===t&&(n=TinCan.About.fromJSON(r.responseText)),e.callback(t,n)},t.callback=n),r=this.sendRequest(t),!n)return null===r.err&&(r.xhr=TinCan.About.fromJSON(r.xhr.responseText)),r},saveStatement:function(e,t){this.log("saveStatement");var r,n,i,o={url:"statements",headers:{}},a=[];t=t||{};try{r=e.asVersion(this.version)}catch(e){return this.allowFail?(this.log("[warning] statement could not be serialized in version ("+this.version+"): "+e),void 0!==t.callback?void t.callback(null,null):{err:null,xhr:null}):(this.log("[error] statement could not be serialized in version ("+this.version+"): "+e),void 0!==t.callback?void t.callback(e,null):{err:e,xhr:null})}if(r.hasOwnProperty("attachments")&&e.hasAttachmentWithContent()){for(n=this._getBoundary(),o.headers["Content-Type"]="multipart/mixed; boundary="+n,i=0;i<e.attachments.length;i+=1)null!==e.attachments[i].content&&a.push(e.attachments[i]);try{o.data=this._getMultipartRequestData(n,r,a)}catch(e){return this.allowFail?(this.log("[warning] multipart request data could not be created (attachments probably not supported): "+e),void 0!==t.callback?void t.callback(null,null):{err:null,xhr:null}):(this.log("[error] multipart request data could not be created (attachments probably not supported): "+e),void 0!==t.callback?void t.callback(e,null):{err:e,xhr:null})}}else o.headers["Content-Type"]="application/json",o.data=JSON.stringify(r);return null!==e.id?(o.method="PUT",o.params={statementId:e.id}):o.method="POST",void 0!==t.callback&&(o.callback=t.callback),this.sendRequest(o)},retrieveStatement:function(e,t){this.log("retrieveStatement");var r,n,i,o=this;return(t=t||{}).params=t.params||{},r={url:"statements",method:"GET",params:{statementId:e}},t.params.attachments&&(r.params.attachments=!0,r.expectMultipart=!0),void 0!==t.callback&&(i=function(e,r){var n=r;null===e&&(n=o._processGetStatementResult(r,t.params)),t.callback(e,n)},r.callback=i),n=this.sendRequest(r),i||(n.statement=null,null===n.err&&(n.statement=o._processGetStatementResult(n.xhr,t.params))),n},retrieveVoidedStatement:function(e,t){this.log("retrieveVoidedStatement");var r,n,i,o=this;return(t=t||{}).params=t.params||{},r={url:"statements",method:"GET",params:{}},"0.9"===this.version||"0.95"===this.version?r.params.statementId=e:(r.params.voidedStatementId=e,t.params.attachments&&(r.params.attachments=!0,r.expectMultipart=!0)),void 0!==t.callback&&(i=function(e,r){var n=r;null===e&&(n=o._processGetStatementResult(r,t.params)),t.callback(e,n)},r.callback=i),n=this.sendRequest(r),i||(n.statement=null,null===n.err&&(n.statement=o._processGetStatementResult(n.xhr,t.params))),n},saveStatements:function(e,t){this.log("saveStatements");var r,n,i,o,a={url:"statements",method:"POST",headers:{}},s=[],u=[];if(t=t||{},0===e.length)return void 0!==t.callback?void t.callback(new Error("no statements"),null):{err:new Error("no statements"),xhr:null};for(i=0;i<e.length;i+=1){try{r=e[i].asVersion(this.version)}catch(e){return this.allowFail?(this.log("[warning] statement could not be serialized in version ("+this.version+"): "+e),void 0!==t.callback?void t.callback(null,null):{err:null,xhr:null}):(this.log("[error] statement could not be serialized in version ("+this.version+"): "+e),void 0!==t.callback?void t.callback(e,null):{err:e,xhr:null})}if(e[i].hasAttachmentWithContent())for(o=0;o<e[i].attachments.length;o+=1)null!==e[i].attachments[o].content&&u.push(e[i].attachments[o]);s.push(r)}if(0!==u.length){n=this._getBoundary(),a.headers["Content-Type"]="multipart/mixed; boundary="+n;try{a.data=this._getMultipartRequestData(n,s,u)}catch(e){return this.allowFail?(this.log("[warning] multipart request data could not be created (attachments probably not supported): "+e),void 0!==t.callback?void t.callback(null,null):{err:null,xhr:null}):(this.log("[error] multipart request data could not be created (attachments probably not supported): "+e),void 0!==t.callback?void t.callback(e,null):{err:e,xhr:null})}}else a.headers["Content-Type"]="application/json",a.data=JSON.stringify(s);return void 0!==t.callback&&(a.callback=t.callback),this.sendRequest(a)},queryStatements:function(e){this.log("queryStatements");var t,r,n,i=this;(e=e||{}).params=e.params||{};try{t=this._queryStatementsRequestCfg(e),e.params.attachments&&(t.expectMultipart=!0)}catch(t){return this.log("[error] Query statements failed - "+t),void 0!==e.callback&&e.callback(t,{}),{err:t,statementsResult:null}}return void 0!==e.callback&&(n=function(t,r){var n,o,a,s,u=r,c={};if(null===t)if(e.params.attachments){for(o=r.getResponseHeader("Content-Type").split("boundary=")[1],n=i._parseMultipart(o,r.response),a=JSON.parse(n[0].body),s=1;s<n.length;s+=1)c[n[s].headers["X-Experience-API-Hash"]]=n[s].body;for(i._assignAttachmentContent(a.statements,c),u=new TinCan.StatementsResult({statements:a.statements}),s=0;s<u.statements.length;s+=1)u.statements[s]instanceof TinCan.Statement||(u.statements[s]=new TinCan.Statement(u.statements[s]))}else u=TinCan.StatementsResult.fromJSON(r.responseText);e.callback(t,u)},t.callback=n),(r=this.sendRequest(t)).config=t,n||(r.statementsResult=null,null===r.err&&(r.statementsResult=TinCan.StatementsResult.fromJSON(r.xhr.responseText))),r},_queryStatementsRequestCfg:function(e){this.log("_queryStatementsRequestCfg");var t,r,n={},i={url:"statements",method:"GET",params:n},o=["agent","actor","object","instructor"],a=["verb","activity"],s=["registration","context","since","until","limit","authoritative","sparse","ascending","related_activities","related_agents","format","attachments"],u={verb:!0,registration:!0,since:!0,until:!0,limit:!0,ascending:!0},c={.9:{supported:{actor:!0,instructor:!0,target:!0,object:!0,context:!0,authoritative:!0,sparse:!0}},"1.0.0":{supported:{agent:!0,activity:!0,related_activities:!0,related_agents:!0,format:!0,attachments:!0}}};for(r in c[.95]=c[.9],c["1.0.1"]=c["1.0.0"],c["1.0.2"]=c["1.0.0"],e.params.hasOwnProperty("target")&&(e.params.object=e.params.target),e.params)if(e.params.hasOwnProperty(r)&&void 0===u[r]&&void 0===c[this.version].supported[r])throw"Unrecognized query parameter configured: "+r;for(t=0;t<o.length;t+=1)void 0!==e.params[o[t]]&&(n[o[t]]=JSON.stringify(e.params[o[t]].asVersion(this.version)));for(t=0;t<a.length;t+=1)void 0!==e.params[a[t]]&&(void 0===e.params[a[t]].id?n[a[t]]=e.params[a[t]]:n[a[t]]=e.params[a[t]].id);for(t=0;t<s.length;t+=1)void 0!==e.params[s[t]]&&null!==e.params[s[t]]&&(n[s[t]]=e.params[s[t]]);return i},_assignAttachmentContent:function(e,t){var r,n;for(r=0;r<e.length;r+=1)if(e[r].hasOwnProperty("attachments")&&null!==e[r].attachments)for(n=0;n<e[r].attachments.length;n+=1)t.hasOwnProperty(e[r].attachments[n].sha2)&&(e[r].attachments[n].content=t[e[r].attachments[n].sha2])},_parseMultipart:function(e,t){var r,n,i,o,a,s,u,c,l,C,I,_="--"+e,S=[];for(r=new Uint8Array(t),i=(n=this.__uint8ToString(r)).indexOf(_+"--"),o=n.indexOf(_);-1!==o;)a=n.indexOf(_,o+_.length),s=o+_.length+2,c=(u=n.indexOf("\r\n\r\n",o))+2+2,l=a-2,C=this._parseHeaders(this.__uint8ToString(new Uint8Array(t.slice(s,u)))),I=t.slice(c,l),0===S.length&&(I=TinCan.Utils.stringFromArrayBuffer(I)),S.push({headers:C,body:I}),o=a===i?-1:a;return S},__uint8ToString:function(e){var t,r="",n=e.byteLength;for(t=0;t<n;t+=1)r+=String.fromCharCode(e[t]);return r},_parseHeaders:function(e){var t,r,n,i={};for(t=e.split("\n"),n=0;n<t.length;n+=1)null!==(r=t[n].split(":",2))[1]?(i[r[0]]=r[1].replace(/^\s+|\s+$/g,""),r[0]):"\t"===r[0].substring(0,1)&&(i[r[0]]=r[1].replace(/^\s+|\s+$/g,""));return i},moreStatements:function(e){var t,r,n,i,o;return this.log("moreStatements: "+e.url),e=e||{},i=TinCan.Utils.parseURL(e.url,{allowRelative:!0}),o=TinCan.Utils.getServerRoot(this.endpoint),0===i.path.indexOf("/statements")&&(i.path=this.endpoint.replace(o,"")+i.path,this.log("converting non-standard more URL to "+i.path)),0!==i.path.indexOf("/")&&(i.path="/"+i.path),t={method:"GET",url:o+i.path,params:i.params},void 0!==e.callback&&(n=function(t,r){var n=r;null===t&&(n=TinCan.StatementsResult.fromJSON(r.responseText)),e.callback(t,n)},t.callback=n),(r=this.sendRequest(t)).config=t,n||(r.statementsResult=null,null===r.err&&(r.statementsResult=TinCan.StatementsResult.fromJSON(r.xhr.responseText))),r},retrieveState:function(e,t){this.log("retrieveState");var r,n,i,o={},a={},s=this;if(i=t.requestHeaders||{},o={stateId:e,activityId:t.activity.id},"0.9"===this.version?o.actor=JSON.stringify(t.agent.asVersion(this.version)):o.agent=JSON.stringify(t.agent.asVersion(this.version)),void 0!==t.registration&&null!==t.registration&&("0.9"===this.version?o.registrationId=t.registration:o.registration=t.registration),a={url:"activities/state",method:"GET",params:o,ignore404:!0,headers:i},void 0!==t.callback&&(n=function(r,n){var i=n;if(null===r)if(404===n.status)i=null;else if(i=new TinCan.State({id:e,contents:n.responseText}),void 0!==n.getResponseHeader&&null!==n.getResponseHeader("ETag")&&""!==n.getResponseHeader("ETag")?i.etag=n.getResponseHeader("ETag"):i.etag='"'+TinCan.Utils.getSHA1String(n.responseText)+'"',void 0!==n.contentType?i.contentType=n.contentType:void 0!==n.getResponseHeader&&null!==n.getResponseHeader("Content-Type")&&""!==n.getResponseHeader("Content-Type")&&(i.contentType=n.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(i.contentType))try{i.contents=JSON.parse(i.contents)}catch(e){s.log("retrieveState - failed to deserialize JSON: "+e)}t.callback(r,i)},a.callback=n),r=this.sendRequest(a),!n&&(r.state=null,null===r.err&&404!==r.xhr.status&&(r.state=new TinCan.State({id:e,contents:r.xhr.responseText}),void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("ETag")&&""!==r.xhr.getResponseHeader("ETag")?r.state.etag=r.xhr.getResponseHeader("ETag"):r.state.etag='"'+TinCan.Utils.getSHA1String(r.xhr.responseText)+'"',void 0!==r.xhr.contentType?r.state.contentType=r.xhr.contentType:void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("Content-Type")&&""!==r.xhr.getResponseHeader("Content-Type")&&(r.state.contentType=r.xhr.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(r.state.contentType))))try{r.state.contents=JSON.parse(r.state.contents)}catch(e){this.log("retrieveState - failed to deserialize JSON: "+e)}return r},retrieveStateIds:function(e){this.log("retrieveStateIds");var t,r,n,i,o={};if(r=(e=e||{}).requestHeaders||{},o.activityId=e.activity.id,"0.9"===this.version?o.actor=JSON.stringify(e.agent.asVersion(this.version)):o.agent=JSON.stringify(e.agent.asVersion(this.version)),void 0!==e.registration&&null!==e.registration&&("0.9"===this.version?o.registrationId=e.registration:o.registration=e.registration),t={url:"activities/state",method:"GET",params:o,headers:r,ignore404:!0},void 0!==e.callback&&(i=function(t,r){var n=r;if(null===t){if(404===r.status)n=[];else try{n=JSON.parse(r.responseText)}catch(e){t="Response JSON parse error: "+e}e.callback(t,n)}else e.callback(t,n)},t.callback=i),void 0!==e.since&&(t.params.since=e.since),n=this.sendRequest(t),!i){if(n.profileIds=null,null!==n.err)return n;if(404===n.xhr.status)n.profileIds=[];else try{n.profileIds=JSON.parse(n.xhr.responseText)}catch(e){n.err="retrieveStateIds - JSON parse error: "+e}}return n},saveState:function(e,t,r){var n,i,o;return this.log("saveState"),o=r.requestHeaders||{},void 0===r.contentType&&(r.contentType="application/octet-stream"),o["Content-Type"]=r.contentType,"object"==typeof t&&TinCan.Utils.isApplicationJSON(r.contentType)&&(t=JSON.stringify(t)),void 0!==r.method&&"POST"===r.method||(r.method="PUT"),n={stateId:e,activityId:r.activity.id},"0.9"===this.version?n.actor=JSON.stringify(r.agent.asVersion(this.version)):n.agent=JSON.stringify(r.agent.asVersion(this.version)),void 0!==r.registration&&null!==r.registration&&("0.9"===this.version?n.registrationId=r.registration:n.registration=r.registration),i={url:"activities/state",method:r.method,params:n,data:t,headers:o},void 0!==r.callback&&(i.callback=r.callback),void 0!==r.lastSHA1&&null!==r.lastSHA1&&(i.headers["If-Match"]=r.lastSHA1),this.sendRequest(i)},dropState:function(e,t){var r,n,i;return this.log("dropState"),i=t.requestHeaders||{},r={activityId:t.activity.id},"0.9"===this.version?r.actor=JSON.stringify(t.agent.asVersion(this.version)):r.agent=JSON.stringify(t.agent.asVersion(this.version)),null!==e&&(r.stateId=e),void 0!==t.registration&&null!==t.registration&&("0.9"===this.version?r.registrationId=t.registration:r.registration=t.registration),n={url:"activities/state",method:"DELETE",params:r,headers:i},void 0!==t.callback&&(n.callback=t.callback),this.sendRequest(n)},retrieveActivity:function(e,t){this.log("retrieveActivity");var r,n,i,o={};return i=t.requestHeaders||{},o={url:"activities",method:"GET",params:{activityId:e},ignore404:!0,headers:i},void 0!==t.callback&&(n=function(r,n){var i=n;null===r&&(i=404===n.status?new TinCan.Activity({id:e}):TinCan.Activity.fromJSON(n.responseText)),t.callback(r,i)},o.callback=n),r=this.sendRequest(o),n||(r.activity=null,null===r.err&&(404===r.xhr.status?r.activity=new TinCan.Activity({id:e}):r.activity=TinCan.Activity.fromJSON(r.xhr.responseText))),r},retrieveActivityProfile:function(e,t){this.log("retrieveActivityProfile");var r,n,i,o={},a=this;if(i=t.requestHeaders||{},o={url:"activities/profile",method:"GET",params:{profileId:e,activityId:t.activity.id},ignore404:!0,headers:i},void 0!==t.callback&&(n=function(r,n){var i=n;if(null===r)if(404===n.status)i=null;else if(i=new TinCan.ActivityProfile({id:e,activity:t.activity,contents:n.responseText}),void 0!==n.getResponseHeader&&null!==n.getResponseHeader("ETag")&&""!==n.getResponseHeader("ETag")?i.etag=n.getResponseHeader("ETag"):i.etag='"'+TinCan.Utils.getSHA1String(n.responseText)+'"',void 0!==n.contentType?i.contentType=n.contentType:void 0!==n.getResponseHeader&&null!==n.getResponseHeader("Content-Type")&&""!==n.getResponseHeader("Content-Type")&&(i.contentType=n.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(i.contentType))try{i.contents=JSON.parse(i.contents)}catch(e){a.log("retrieveActivityProfile - failed to deserialize JSON: "+e)}t.callback(r,i)},o.callback=n),r=this.sendRequest(o),!n&&(r.profile=null,null===r.err&&404!==r.xhr.status&&(r.profile=new TinCan.ActivityProfile({id:e,activity:t.activity,contents:r.xhr.responseText}),void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("ETag")&&""!==r.xhr.getResponseHeader("ETag")?r.profile.etag=r.xhr.getResponseHeader("ETag"):r.profile.etag='"'+TinCan.Utils.getSHA1String(r.xhr.responseText)+'"',void 0!==r.xhr.contentType?r.profile.contentType=r.xhr.contentType:void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("Content-Type")&&""!==r.xhr.getResponseHeader("Content-Type")&&(r.profile.contentType=r.xhr.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(r.profile.contentType))))try{r.profile.contents=JSON.parse(r.profile.contents)}catch(e){this.log("retrieveActivityProfile - failed to deserialize JSON: "+e)}return r},retrieveActivityProfileIds:function(e){var t,r,n,i;if(this.log("retrieveActivityProfileIds"),r=(e=e||{}).requestHeaders||{},t={url:"activities/profile",method:"GET",params:{activityId:e.activity.id},headers:r,ignore404:!0},void 0!==e.callback&&(i=function(t,r){var n=r;if(null===t){if(404===r.status)n=[];else try{n=JSON.parse(r.responseText)}catch(e){t="Response JSON parse error: "+e}e.callback(t,n)}else e.callback(t,n)},t.callback=i),void 0!==e.since&&(t.params.since=e.since),n=this.sendRequest(t),!i){if(n.profileIds=null,null!==n.err)return n;if(404===n.xhr.status)n.profileIds=[];else try{n.profileIds=JSON.parse(n.xhr.responseText)}catch(e){n.err="retrieveActivityProfileIds - JSON parse error: "+e}}return n},saveActivityProfile:function(e,t,r){var n,i;return this.log("saveActivityProfile"),i=r.requestHeaders||{},void 0===r.contentType&&(r.contentType="application/octet-stream"),i["Content-Type"]=r.contentType,void 0!==r.method&&"POST"===r.method||(r.method="PUT"),"object"==typeof t&&TinCan.Utils.isApplicationJSON(r.contentType)&&(t=JSON.stringify(t)),n={url:"activities/profile",method:r.method,params:{profileId:e,activityId:r.activity.id},data:t,headers:i},void 0!==r.callback&&(n.callback=r.callback),void 0!==r.lastSHA1&&null!==r.lastSHA1?n.headers["If-Match"]=r.lastSHA1:n.headers["If-None-Match"]="*",this.sendRequest(n)},dropActivityProfile:function(e,t){var r,n;return this.log("dropActivityProfile"),n=t.requestHeaders||{},r={url:"activities/profile",method:"DELETE",params:{profileId:e,activityId:t.activity.id},headers:n},void 0!==t.callback&&(r.callback=t.callback),this.sendRequest(r)},retrieveAgentProfile:function(e,t){this.log("retrieveAgentProfile");var r,n,i,o={},a=this;if(i=t.requestHeaders||{},o={method:"GET",params:{profileId:e},ignore404:!0,headers:i},"0.9"===this.version?(o.url="actors/profile",o.params.actor=JSON.stringify(t.agent.asVersion(this.version))):(o.url="agents/profile",o.params.agent=JSON.stringify(t.agent.asVersion(this.version))),void 0!==t.callback&&(n=function(r,n){var i=n;if(null===r)if(404===n.status)i=null;else if(i=new TinCan.AgentProfile({id:e,agent:t.agent,contents:n.responseText}),void 0!==n.getResponseHeader&&null!==n.getResponseHeader("ETag")&&""!==n.getResponseHeader("ETag")?i.etag=n.getResponseHeader("ETag"):i.etag='"'+TinCan.Utils.getSHA1String(n.responseText)+'"',void 0!==n.contentType?i.contentType=n.contentType:void 0!==n.getResponseHeader&&null!==n.getResponseHeader("Content-Type")&&""!==n.getResponseHeader("Content-Type")&&(i.contentType=n.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(i.contentType))try{i.contents=JSON.parse(i.contents)}catch(e){a.log("retrieveAgentProfile - failed to deserialize JSON: "+e)}t.callback(r,i)},o.callback=n),r=this.sendRequest(o),!n&&(r.profile=null,null===r.err&&404!==r.xhr.status&&(r.profile=new TinCan.AgentProfile({id:e,agent:t.agent,contents:r.xhr.responseText}),void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("ETag")&&""!==r.xhr.getResponseHeader("ETag")?r.profile.etag=r.xhr.getResponseHeader("ETag"):r.profile.etag='"'+TinCan.Utils.getSHA1String(r.xhr.responseText)+'"',void 0!==r.xhr.contentType?r.profile.contentType=r.xhr.contentType:void 0!==r.xhr.getResponseHeader&&null!==r.xhr.getResponseHeader("Content-Type")&&""!==r.xhr.getResponseHeader("Content-Type")&&(r.profile.contentType=r.xhr.getResponseHeader("Content-Type")),TinCan.Utils.isApplicationJSON(r.profile.contentType))))try{r.profile.contents=JSON.parse(r.profile.contents)}catch(e){this.log("retrieveAgentProfile - failed to deserialize JSON: "+e)}return r},retrieveAgentProfileIds:function(e){this.log("retrieveAgentProfileIds");var t,r,n,i={};if(t={method:"GET",params:i,headers:(e=e||{}).requestHeaders||{},ignore404:!0},"0.9"===this.version?(t.url="actors/profile",i.actor=JSON.stringify(e.agent.asVersion(this.version))):(t.url="agents/profile",i.agent=JSON.stringify(e.agent.asVersion(this.version))),void 0!==e.callback&&(n=function(t,r){var n=r;if(null===t){if(404===r.status)n=[];else try{n=JSON.parse(r.responseText)}catch(e){t="Response JSON parse error: "+e}e.callback(t,n)}else e.callback(t,n)},t.callback=n),void 0!==e.since&&(t.params.since=e.since),r=this.sendRequest(t),!n){if(r.profileIds=null,null!==r.err)return r;if(404===r.xhr.status)r.profileIds=[];else try{r.profileIds=JSON.parse(r.xhr.responseText)}catch(e){r.err="retrieveAgentProfileIds - JSON parse error: "+e}}return r},saveAgentProfile:function(e,t,r){var n,i;return this.log("saveAgentProfile"),i=r.requestHeaders||{},void 0===r.contentType&&(r.contentType="application/octet-stream"),i["Content-Type"]=r.contentType,void 0!==r.method&&"POST"===r.method||(r.method="PUT"),"object"==typeof t&&TinCan.Utils.isApplicationJSON(r.contentType)&&(t=JSON.stringify(t)),n={method:r.method,params:{profileId:e},data:t,headers:i},"0.9"===this.version?(n.url="actors/profile",n.params.actor=JSON.stringify(r.agent.asVersion(this.version))):(n.url="agents/profile",n.params.agent=JSON.stringify(r.agent.asVersion(this.version))),void 0!==r.callback&&(n.callback=r.callback),void 0!==r.lastSHA1&&null!==r.lastSHA1?n.headers["If-Match"]=r.lastSHA1:n.headers["If-None-Match"]="*",this.sendRequest(n)},dropAgentProfile:function(e,t){var r,n;return this.log("dropAgentProfile"),n={method:"DELETE",params:r={profileId:e},headers:t.requestHeaders||{}},"0.9"===this.version?(n.url="actors/profile",r.actor=JSON.stringify(t.agent.asVersion(this.version))):(n.url="agents/profile",r.agent=JSON.stringify(t.agent.asVersion(this.version))),void 0!==t.callback&&(n.callback=t.callback),this.sendRequest(n)}},e.syncEnabled=null}(),function(){"use strict";var e=TinCan.AgentAccount=function(e){this.log("constructor"),this.homePage=null,this.name=null,this.init(e)};e.prototype={LOG_SRC:"AgentAccount",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["name","homePage"];for(void 0!==(e=e||{}).accountServiceHomePage&&(e.homePage=e.accountServiceHomePage),void 0!==e.accountName&&(e.name=e.accountName),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},toString:function(){this.log("toString");var e="";return null!==this.name||null!==this.homePage?(e+=null!==this.name?this.name:"-",e+=":",e+=null!==this.homePage?this.homePage:"-"):e="AgentAccount: unidentified",e},asVersion:function(e){this.log("asVersion: "+e);var t={};return"0.9"===(e=e||TinCan.versions()[0])?(t.accountName=this.name,t.accountServiceHomePage=this.homePage):(t.name=this.name,t.homePage=this.homePage),t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Agent=function(e){this.log("constructor"),this.name=null,this.mbox=null,this.mbox_sha1sum=null,this.openid=null,this.account=null,this.degraded=!1,this.init(e)};e.prototype={objectType:"Agent",LOG_SRC:"Agent",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r,n=["name","mbox","mbox_sha1sum","openid"];for(void 0!==(e=e||{}).lastName||void 0!==e.firstName?(e.name="",void 0!==e.firstName&&e.firstName.length>0&&(e.name=e.firstName[0],e.firstName.length>1&&(this.degraded=!0)),""!==e.name&&(e.name+=" "),void 0!==e.lastName&&e.lastName.length>0&&(e.name+=e.lastName[0],e.lastName.length>1&&(this.degraded=!0))):void 0===e.familyName&&void 0===e.givenName||(e.name="",void 0!==e.givenName&&e.givenName.length>0&&(e.name=e.givenName[0],e.givenName.length>1&&(this.degraded=!0)),""!==e.name&&(e.name+=" "),void 0!==e.familyName&&e.familyName.length>0&&(e.name+=e.familyName[0],e.familyName.length>1&&(this.degraded=!0))),"object"==typeof e.name&&null!==e.name&&(e.name.length>1&&(this.degraded=!0),e.name=e.name[0]),"object"==typeof e.mbox&&null!==e.mbox&&(e.mbox.length>1&&(this.degraded=!0),e.mbox=e.mbox[0]),"object"==typeof e.mbox_sha1sum&&null!==e.mbox_sha1sum&&(e.mbox_sha1sum.length>1&&(this.degraded=!0),e.mbox_sha1sum=e.mbox_sha1sum[0]),"object"==typeof e.openid&&null!==e.openid&&(e.openid.length>1&&(this.degraded=!0),e.openid=e.openid[0]),"object"==typeof e.account&&null!==e.account&&void 0===e.account.homePage&&void 0===e.account.name&&(0===e.account.length?delete e.account:(e.account.length>1&&(this.degraded=!0),e.account=e.account[0])),e.hasOwnProperty("account")&&(e.account instanceof TinCan.AgentAccount?this.account=e.account:this.account=new TinCan.AgentAccount(e.account)),t=0;t<n.length;t+=1)e.hasOwnProperty(n[t])&&null!==e[n[t]]&&(r=e[n[t]],"mbox"===n[t]&&-1===r.indexOf("mailto:")&&(r="mailto:"+r),this[n[t]]=r)},toString:function(){return this.log("toString"),null!==this.name?this.name:null!==this.mbox?this.mbox.replace("mailto:",""):null!==this.mbox_sha1sum?this.mbox_sha1sum:null!==this.openid?this.openid:null!==this.account?this.account.toString():this.objectType+": unidentified"},asVersion:function(e){this.log("asVersion: "+e);var t={objectType:this.objectType};return"0.9"===(e=e||TinCan.versions()[0])?(null!==this.mbox?t.mbox=[this.mbox]:null!==this.mbox_sha1sum?t.mbox_sha1sum=[this.mbox_sha1sum]:null!==this.openid?t.openid=[this.openid]:null!==this.account&&(t.account=[this.account.asVersion(e)]),null!==this.name&&(t.name=[this.name])):(null!==this.mbox?t.mbox=this.mbox:null!==this.mbox_sha1sum?t.mbox_sha1sum=this.mbox_sha1sum:null!==this.openid?t.openid=this.openid:null!==this.account&&(t.account=this.account.asVersion(e)),null!==this.name&&(t.name=this.name)),t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Group=function(e){this.log("constructor"),this.name=null,this.mbox=null,this.mbox_sha1sum=null,this.openid=null,this.account=null,this.member=[],this.init(e)};e.prototype={objectType:"Group",LOG_SRC:"Group",log:TinCan.prototype.log,init:function(e){var t;if(this.log("init"),e=e||{},TinCan.Agent.prototype.init.call(this,e),void 0!==e.member)for(t=0;t<e.member.length;t+=1)e.member[t]instanceof TinCan.Agent?this.member.push(e.member[t]):this.member.push(new TinCan.Agent(e.member[t]))},toString:function(e){this.log("toString");var t=TinCan.Agent.prototype.toString.call(this,e);return t!==this.objectType+": unidentified"&&(t=this.objectType+": "+t),t},asVersion:function(e){var t,r;if(this.log("asVersion: "+e),e=e||TinCan.versions()[0],t=TinCan.Agent.prototype.asVersion.call(this,e),this.member.length>0)for(t.member=[],r=0;r<this.member.length;r+=1)t.member.push(this.member[r].asVersion(e));return t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e={"http://adlnet.gov/expapi/verbs/experienced":"experienced","http://adlnet.gov/expapi/verbs/attended":"attended","http://adlnet.gov/expapi/verbs/attempted":"attempted","http://adlnet.gov/expapi/verbs/completed":"completed","http://adlnet.gov/expapi/verbs/passed":"passed","http://adlnet.gov/expapi/verbs/failed":"failed","http://adlnet.gov/expapi/verbs/answered":"answered","http://adlnet.gov/expapi/verbs/interacted":"interacted","http://adlnet.gov/expapi/verbs/imported":"imported","http://adlnet.gov/expapi/verbs/created":"created","http://adlnet.gov/expapi/verbs/shared":"shared","http://adlnet.gov/expapi/verbs/voided":"voided"},t=TinCan.Verb=function(e){this.log("constructor"),this.id=null,this.display=null,this.init(e)};t.prototype={LOG_SRC:"Verb",log:TinCan.prototype.log,init:function(t){this.log("init");var r,n,i=["id","display"];if("string"==typeof t){for(n in this.id=t,this.display={und:this.id},e)if(e.hasOwnProperty(n)&&e[n]===t){this.id=n;break}}else{for(t=t||{},r=0;r<i.length;r+=1)t.hasOwnProperty(i[r])&&null!==t[i[r]]&&(this[i[r]]=t[i[r]]);null===this.display&&void 0!==e[this.id]&&(this.display={und:e[this.id]})}},toString:function(e){return this.log("toString"),null!==this.display?this.getLangDictionaryValue("display",e):this.id},asVersion:function(t){var r;return this.log("asVersion"),"0.9"===(t=t||TinCan.versions()[0])?r=e[this.id]:(r={id:this.id},null!==this.display&&(r.display=this.display)),r},getLangDictionaryValue:TinCan.Utils.getLangDictionaryValue},t.fromJSON=function(e){t.prototype.log("fromJSON");var r=JSON.parse(e);return new t(r)}}(),function(){"use strict";var e=TinCan.Result=function(e){this.log("constructor"),this.score=null,this.success=null,this.completion=null,this.duration=null,this.response=null,this.extensions=null,this.init(e)};e.prototype={LOG_SRC:"Result",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["completion","duration","extensions","response","success"];for((e=e||{}).hasOwnProperty("score")&&null!==e.score&&(e.score instanceof TinCan.Score?this.score=e.score:this.score=new TinCan.Score(e.score)),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]]);"Completed"===this.completion&&(this.completion=!0)},asVersion:function(e){this.log("asVersion");var t,r={},n=["success","duration","response","extensions"],i=["score"];for(e=e||TinCan.versions()[0],t=0;t<n.length;t+=1)null!==this[n[t]]&&(r[n[t]]=this[n[t]]);for(t=0;t<i.length;t+=1)null!==this[i[t]]&&(r[i[t]]=this[i[t]].asVersion(e));return null!==this.completion&&("0.9"===e?this.completion&&(r.completion="Completed"):r.completion=this.completion),r}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Score=function(e){this.log("constructor"),this.scaled=null,this.raw=null,this.min=null,this.max=null,this.init(e)};e.prototype={LOG_SRC:"Score",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["scaled","raw","min","max"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},asVersion:function(e){this.log("asVersion");var t,r={},n=["scaled","raw","min","max"];for(e=e||TinCan.versions()[0],t=0;t<n.length;t+=1)null!==this[n[t]]&&(r[n[t]]=this[n[t]]);return r}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.InteractionComponent=function(e){this.log("constructor"),this.id=null,this.description=null,this.init(e)};e.prototype={LOG_SRC:"InteractionComponent",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id","description"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},asVersion:function(e){this.log("asVersion");var t,r,n={id:this.id},i=["description"];for(e=e||TinCan.versions()[0],t=0;t<i.length;t+=1)null!==this[r=i[t]]&&(n[r]=this[r]);return n},getLangDictionaryValue:TinCan.Utils.getLangDictionaryValue},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e={"http://adlnet.gov/expapi/activities/course":"course","http://adlnet.gov/expapi/activities/module":"module","http://adlnet.gov/expapi/activities/meeting":"meeting","http://adlnet.gov/expapi/activities/media":"media","http://adlnet.gov/expapi/activities/performance":"performance","http://adlnet.gov/expapi/activities/simulation":"simulation","http://adlnet.gov/expapi/activities/assessment":"assessment","http://adlnet.gov/expapi/activities/interaction":"interaction","http://adlnet.gov/expapi/activities/cmi.interaction":"cmi.interaction","http://adlnet.gov/expapi/activities/question":"question","http://adlnet.gov/expapi/activities/objective":"objective","http://adlnet.gov/expapi/activities/link":"link"},t=TinCan.ActivityDefinition=function(e){this.log("constructor"),this.name=null,this.description=null,this.type=null,this.moreInfo=null,this.extensions=null,this.interactionType=null,this.correctResponsesPattern=null,this.choices=null,this.scale=null,this.source=null,this.target=null,this.steps=null,this.init(e)};t.prototype={LOG_SRC:"ActivityDefinition",log:TinCan.prototype.log,init:function(t){this.log("init");var r,n,i,o=["name","description","moreInfo","extensions","correctResponsesPattern"],a=[];if((t=t||{}).hasOwnProperty("type")&&null!==t.type){for(i in e)e.hasOwnProperty(i)&&e[i]===t.type&&(t.type=e[i]);this.type=t.type}if(t.hasOwnProperty("interactionType")&&null!==t.interactionType&&(this.interactionType=t.interactionType,"choice"===t.interactionType||"sequencing"===t.interactionType?a.push("choices"):"likert"===t.interactionType?a.push("scale"):"matching"===t.interactionType?(a.push("source"),a.push("target")):"performance"===t.interactionType&&a.push("steps"),a.length>0))for(r=0;r<a.length;r+=1)if(i=a[r],t.hasOwnProperty(i)&&null!==t[i])for(this[i]=[],n=0;n<t[i].length;n+=1)t[i][n]instanceof TinCan.InteractionComponent?this[i].push(t[i][n]):this[i].push(new TinCan.InteractionComponent(t[i][n]));for(r=0;r<o.length;r+=1)t.hasOwnProperty(o[r])&&null!==t[o[r]]&&(this[o[r]]=t[o[r]])},toString:function(e){return this.log("toString"),null!==this.name?this.getLangDictionaryValue("name",e):null!==this.description?this.getLangDictionaryValue("description",e):""},asVersion:function(t){this.log("asVersion");var r,n,i,o={},a=["name","description","interactionType","correctResponsesPattern","extensions"],s=["choices","scale","source","target","steps"];for(t=t||TinCan.versions()[0],null!==this.type&&(o.type="0.9"===t?e[this.type]:this.type),r=0;r<a.length;r+=1)null!==this[i=a[r]]&&(o[i]=this[i]);for(r=0;r<s.length;r+=1)if(null!==this[i=s[r]])for(o[i]=[],n=0;n<this[i].length;n+=1)o[i].push(this[i][n].asVersion(t));return 0!==t.indexOf("0.9")&&null!==this.moreInfo&&(o.moreInfo=this.moreInfo),o},getLangDictionaryValue:TinCan.Utils.getLangDictionaryValue},t.fromJSON=function(e){t.prototype.log("fromJSON");var r=JSON.parse(e);return new t(r)}}(),function(){"use strict";var e=TinCan.Activity=function(e){this.log("constructor"),this.objectType="Activity",this.id=null,this.definition=null,this.init(e)};e.prototype={LOG_SRC:"Activity",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id"];for((e=e||{}).hasOwnProperty("definition")&&(e.definition instanceof TinCan.ActivityDefinition?this.definition=e.definition:this.definition=new TinCan.ActivityDefinition(e.definition)),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},toString:function(e){this.log("toString");var t="";return null!==this.definition&&""!==(t=this.definition.toString(e))?t:null!==this.id?this.id:"Activity: unidentified"},asVersion:function(e){this.log("asVersion");var t={id:this.id,objectType:this.objectType};return e=e||TinCan.versions()[0],null!==this.definition&&(t.definition=this.definition.asVersion(e)),t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.ContextActivities=function(e){this.log("constructor"),this.category=null,this.parent=null,this.grouping=null,this.other=null,this.init(e)};e.prototype={LOG_SRC:"ContextActivities",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r,n,i,o=["category","parent","grouping","other"];for(e=e||{},t=0;t<o.length;t+=1)if(n=o[t],e.hasOwnProperty(n)&&null!==e[n])if("[object Array]"===Object.prototype.toString.call(e[n]))for(r=0;r<e[n].length;r+=1)this.add(n,e[n][r]);else i=e[n],this.add(n,i)},add:function(e,t){if("category"===e||"parent"===e||"grouping"===e||"other"===e)return null===this[e]&&(this[e]=[]),t instanceof TinCan.Activity||(t="string"==typeof t?{id:t}:t,t=new TinCan.Activity(t)),this[e].push(t),this[e].length-1},asVersion:function(e){this.log("asVersion");var t,r,n={},i=["parent","grouping","other"];for(e=e||TinCan.versions()[0],t=0;t<i.length;t+=1)if(null!==this[i[t]]&&this[i[t]].length>0)if("0.9"===e||"0.95"===e)this[i[t]].length>1&&this.log("[warning] version does not support multiple values in: "+i[t]),n[i[t]]=this[i[t]][0].asVersion(e);else for(n[i[t]]=[],r=0;r<this[i[t]].length;r+=1)n[i[t]].push(this[i[t]][r].asVersion(e));if(null!==this.category&&this.category.length>0){if("0.9"===e||"0.95"===e)throw this.log("[error] version does not support the 'category' property: "+e),new Error(e+" does not support the 'category' property");for(n.category=[],t=0;t<this.category.length;t+=1)n.category.push(this.category[t].asVersion(e))}return n}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Context=function(e){this.log("constructor"),this.registration=null,this.instructor=null,this.team=null,this.contextActivities=null,this.revision=null,this.platform=null,this.language=null,this.statement=null,this.extensions=null,this.init(e)};e.prototype={LOG_SRC:"Context",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r,n,i=["registration","revision","platform","language","extensions"],o=["instructor","team"];for(e=e||{},t=0;t<i.length;t+=1)r=i[t],e.hasOwnProperty(r)&&null!==e[r]&&(this[r]=e[r]);for(t=0;t<o.length;t+=1)r=o[t],e.hasOwnProperty(r)&&null!==e[r]&&(void 0!==(n=e[r]).objectType&&"Person"!==n.objectType||(n.objectType="Agent"),"Agent"!==n.objectType||n instanceof TinCan.Agent?"Group"!==n.objectType||n instanceof TinCan.Group||(n=new TinCan.Group(n)):n=new TinCan.Agent(n),this[r]=n);e.hasOwnProperty("contextActivities")&&null!==e.contextActivities&&(e.contextActivities instanceof TinCan.ContextActivities?this.contextActivities=e.contextActivities:this.contextActivities=new TinCan.ContextActivities(e.contextActivities)),e.hasOwnProperty("statement")&&null!==e.statement&&(e.statement instanceof TinCan.StatementRef||e.statement instanceof TinCan.SubStatement?this.statement=e.statement:"StatementRef"===e.statement.objectType?this.statement=new TinCan.StatementRef(e.statement):"SubStatement"===e.statement.objectType?this.statement=new TinCan.SubStatement(e.statement):this.log("Unable to parse statement.context.statement property."))},asVersion:function(e){this.log("asVersion");var t,r={},n=["registration","revision","platform","language","extensions"],i=["instructor","team","contextActivities","statement"];if(e=e||TinCan.versions()[0],this.statement instanceof TinCan.SubStatement&&"0.9"!==e&&"0.95"!==e)throw this.log("[error] version does not support SubStatements in the 'statement' property: "+e),new Error(e+" does not support SubStatements in the 'statement' property");for(t=0;t<n.length;t+=1)null!==this[n[t]]&&(r[n[t]]=this[n[t]]);for(t=0;t<i.length;t+=1)null!==this[i[t]]&&(r[i[t]]=this[i[t]].asVersion(e));return r}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.StatementRef=function(e){this.log("constructor"),this.id=null,this.init(e)};e.prototype={objectType:"StatementRef",LOG_SRC:"StatementRef",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},toString:function(){return this.log("toString"),this.id},asVersion:function(e){this.log("asVersion");var t={objectType:this.objectType,id:this.id};return"0.9"===e&&(t.objectType="Statement"),t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.SubStatement=function(e){this.log("constructor"),this.actor=null,this.verb=null,this.target=null,this.result=null,this.context=null,this.timestamp=null,this.init(e)};e.prototype={objectType:"SubStatement",LOG_SRC:"SubStatement",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["timestamp"];for((e=e||{}).hasOwnProperty("object")&&(e.target=e.object),e.hasOwnProperty("actor")&&(void 0!==e.actor.objectType&&"Person"!==e.actor.objectType||(e.actor.objectType="Agent"),"Agent"===e.actor.objectType?e.actor instanceof TinCan.Agent?this.actor=e.actor:this.actor=new TinCan.Agent(e.actor):"Group"===e.actor.objectType&&(e.actor instanceof TinCan.Group?this.actor=e.actor:this.actor=new TinCan.Group(e.actor))),e.hasOwnProperty("verb")&&(e.verb instanceof TinCan.Verb?this.verb=e.verb:this.verb=new TinCan.Verb(e.verb)),e.hasOwnProperty("target")&&(e.target instanceof TinCan.Activity||e.target instanceof TinCan.Agent||e.target instanceof TinCan.Group||e.target instanceof TinCan.SubStatement||e.target instanceof TinCan.StatementRef?this.target=e.target:(void 0===e.target.objectType&&(e.target.objectType="Activity"),"Activity"===e.target.objectType?this.target=new TinCan.Activity(e.target):"Agent"===e.target.objectType?this.target=new TinCan.Agent(e.target):"Group"===e.target.objectType?this.target=new TinCan.Group(e.target):"SubStatement"===e.target.objectType?this.target=new TinCan.SubStatement(e.target):"StatementRef"===e.target.objectType?this.target=new TinCan.StatementRef(e.target):this.log("Unrecognized target type: "+e.target.objectType))),e.hasOwnProperty("result")&&(e.result instanceof TinCan.Result?this.result=e.result:this.result=new TinCan.Result(e.result)),e.hasOwnProperty("context")&&(e.context instanceof TinCan.Context?this.context=e.context:this.context=new TinCan.Context(e.context)),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])},toString:function(e){return this.log("toString"),(null!==this.actor?this.actor.toString(e):"")+" "+(null!==this.verb?this.verb.toString(e):"")+" "+(null!==this.target?this.target.toString(e):"")},asVersion:function(e){this.log("asVersion");var t,r,n=["timestamp"],i=["actor","verb","result","context"];for(t={objectType:this.objectType},e=e||TinCan.versions()[0],r=0;r<n.length;r+=1)null!==this[n[r]]&&(t[n[r]]=this[n[r]]);for(r=0;r<i.length;r+=1)null!==this[i[r]]&&(t[i[r]]=this[i[r]].asVersion(e));return null!==this.target&&(t.object=this.target.asVersion(e)),"0.9"===e&&(t.objectType="Statement"),t}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Statement=function(e,t){this.log("constructor"),void 0===(t="number"==typeof t?{storeOriginal:t}:t||{}).storeOriginal&&(t.storeOriginal=null),void 0===t.doStamp&&(t.doStamp=!0),this.id=null,this.actor=null,this.verb=null,this.target=null,this.result=null,this.context=null,this.timestamp=null,this.stored=null,this.authority=null,this.attachments=null,this.version=null,this.degraded=!1,this.voided=null,this.inProgress=null,this.originalJSON=null,this.init(e,t)};e.prototype={LOG_SRC:"Statement",log:TinCan.prototype.log,init:function(e,t){this.log("init");var r,n=["id","stored","timestamp","version","inProgress","voided"];if(e=e||{},t.storeOriginal&&(this.originalJSON=JSON.stringify(e,null,t.storeOriginal)),e.hasOwnProperty("object")&&(e.target=e.object),e.hasOwnProperty("actor")&&(void 0!==e.actor.objectType&&"Person"!==e.actor.objectType||(e.actor.objectType="Agent"),"Agent"===e.actor.objectType?e.actor instanceof TinCan.Agent?this.actor=e.actor:this.actor=new TinCan.Agent(e.actor):"Group"===e.actor.objectType&&(e.actor instanceof TinCan.Group?this.actor=e.actor:this.actor=new TinCan.Group(e.actor))),e.hasOwnProperty("authority")&&(void 0!==e.authority.objectType&&"Person"!==e.authority.objectType||(e.authority.objectType="Agent"),"Agent"===e.authority.objectType?e.authority instanceof TinCan.Agent?this.authority=e.authority:this.authority=new TinCan.Agent(e.authority):"Group"===e.authority.objectType&&(e.actor instanceof TinCan.Group?this.authority=e.authority:this.authority=new TinCan.Group(e.authority))),e.hasOwnProperty("verb")&&(e.verb instanceof TinCan.Verb?this.verb=e.verb:this.verb=new TinCan.Verb(e.verb)),e.hasOwnProperty("target")&&(e.target instanceof TinCan.Activity||e.target instanceof TinCan.Agent||e.target instanceof TinCan.Group||e.target instanceof TinCan.SubStatement||e.target instanceof TinCan.StatementRef?this.target=e.target:(void 0===e.target.objectType&&(e.target.objectType="Activity"),"Activity"===e.target.objectType?this.target=new TinCan.Activity(e.target):"Agent"===e.target.objectType?this.target=new TinCan.Agent(e.target):"Group"===e.target.objectType?this.target=new TinCan.Group(e.target):"SubStatement"===e.target.objectType?this.target=new TinCan.SubStatement(e.target):"StatementRef"===e.target.objectType?this.target=new TinCan.StatementRef(e.target):this.log("Unrecognized target type: "+e.target.objectType))),e.hasOwnProperty("result")&&(e.result instanceof TinCan.Result?this.result=e.result:this.result=new TinCan.Result(e.result)),e.hasOwnProperty("context")&&(e.context instanceof TinCan.Context?this.context=e.context:this.context=new TinCan.Context(e.context)),e.hasOwnProperty("attachments")&&null!==e.attachments)for(this.attachments=[],r=0;r<e.attachments.length;r+=1)e.attachments[r]instanceof TinCan.Attachment?this.attachments.push(e.attachments[r]):this.attachments.push(new TinCan.Attachment(e.attachments[r]));for(r=0;r<n.length;r+=1)e.hasOwnProperty(n[r])&&null!==e[n[r]]&&(this[n[r]]=e[n[r]]);t.doStamp&&this.stamp()},toString:function(e){return this.log("toString"),(null!==this.actor?this.actor.toString(e):"")+" "+(null!==this.verb?this.verb.toString(e):"")+" "+(null!==this.target?this.target.toString(e):"")},asVersion:function(e){this.log("asVersion");var t,r={},n=["id","timestamp"],i=["actor","verb","result","context","authority"];for(e=e||TinCan.versions()[0],t=0;t<n.length;t+=1)null!==this[n[t]]&&(r[n[t]]=this[n[t]]);for(t=0;t<i.length;t+=1)null!==this[i[t]]&&(r[i[t]]=this[i[t]].asVersion(e));if(null!==this.target&&(r.object=this.target.asVersion(e)),"0.9"!==e&&"0.95"!==e||null!==this.voided&&(r.voided=this.voided),"0.9"===e&&null!==this.inProgress&&(r.inProgress=this.inProgress),null!==this.attachments&&"0.9"!==e&&"0.95"!==e)for(r.attachments=[],t=0;t<this.attachments.length;t+=1)this.attachments[t]instanceof TinCan.Attachment?r.attachments.push(this.attachments[t].asVersion(e)):r.attachments.push(new TinCan.Attachment(this.attachments[t]).asVersion(e));return r},stamp:function(){this.log("stamp"),null===this.id&&(this.id=TinCan.Utils.getUUID()),null===this.timestamp&&(this.timestamp=TinCan.Utils.getISODateString(new Date))},hasAttachmentWithContent:function(){var e;if(this.log("hasAttachmentWithContent"),null===this.attachments)return!1;for(e=0;e<this.attachments.length;e+=1)if(null!==this.attachments[e].content)return!0;return!1}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.StatementsResult=function(e){this.log("constructor"),this.statements=null,this.more=null,this.init(e)};e.prototype={LOG_SRC:"StatementsResult",log:TinCan.prototype.log,init:function(e){this.log("init"),(e=e||{}).hasOwnProperty("statements")&&(this.statements=e.statements),e.hasOwnProperty("more")&&(this.more=e.more)}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r,n,i,o=[];try{r=JSON.parse(t)}catch(t){e.prototype.log("fromJSON - JSON.parse error: "+t)}if(r){for(i=0;i<r.statements.length;i+=1){try{n=new TinCan.Statement(r.statements[i],4)}catch(t){e.prototype.log("fromJSON - statement instantiation failed: "+t+" ("+JSON.stringify(r.statements[i])+")"),n=new TinCan.Statement({id:r.statements[i].id},4)}o.push(n)}r.statements=o}return new e(r)}}(),function(){"use strict";var e=TinCan.State=function(e){this.log("constructor"),this.id=null,this.updated=null,this.contents=null,this.etag=null,this.contentType=null,this.init(e)};e.prototype={LOG_SRC:"State",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id","contents","etag","contentType"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]]);this.updated=!1}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.ActivityProfile=function(e){this.log("constructor"),this.id=null,this.activity=null,this.updated=null,this.contents=null,this.etag=null,this.contentType=null,this.init(e)};e.prototype={LOG_SRC:"ActivityProfile",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id","contents","etag","contentType"];for((e=e||{}).hasOwnProperty("activity")&&(e.activity instanceof TinCan.Activity?this.activity=e.activity:this.activity=new TinCan.Activity(e.activity)),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]]);this.updated=!1}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.AgentProfile=function(e){this.log("constructor"),this.id=null,this.agent=null,this.updated=null,this.contents=null,this.etag=null,this.contentType=null,this.init(e)};e.prototype={LOG_SRC:"AgentProfile",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["id","contents","etag","contentType"];for((e=e||{}).hasOwnProperty("agent")&&(e.agent instanceof TinCan.Agent?this.agent=e.agent:this.agent=new TinCan.Agent(e.agent)),t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]]);this.updated=!1}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.About=function(e){this.log("constructor"),this.version=null,this.init(e)};e.prototype={LOG_SRC:"About",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["version"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]])}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)}}(),function(){"use strict";var e=TinCan.Attachment=function(e){this.log("constructor"),this.usageType=null,this.display=null,this.contentType=null,this.length=null,this.sha2=null,this.description=null,this.fileUrl=null,this.content=null,this.init(e)};e.prototype={LOG_SRC:"Attachment",log:TinCan.prototype.log,init:function(e){this.log("init");var t,r=["contentType","length","sha2","usageType","display","description","fileUrl"];for(e=e||{},t=0;t<r.length;t+=1)e.hasOwnProperty(r[t])&&null!==e[r[t]]&&(this[r[t]]=e[r[t]]);e.hasOwnProperty("content")&&null!==e.content&&("string"==typeof e.content?this.setContentFromString(e.content):this.setContent(e.content))},asVersion:function(e){var t;return this.log("asVersion"),"0.9"===(e=e||TinCan.versions()[0])||"0.95"===e?t=null:(t={contentType:this.contentType,display:this.display,length:this.length,sha2:this.sha2,usageType:this.usageType},null!==this.fileUrl&&(t.fileUrl=this.fileUrl),null!==this.description&&(t.description=this.description)),t},getLangDictionaryValue:TinCan.Utils.getLangDictionaryValue,setContent:function(e){this.content=e,this.length=e.byteLength,this.sha2=TinCan.Utils.getSHA256String(e)},setContentFromString:function(e){var t;t=TinCan.Utils.stringToArrayBuffer(e),this.setContent(t)},getContentAsString:function(){return TinCan.Utils.stringFromArrayBuffer(this.content)}},e.fromJSON=function(t){e.prototype.log("fromJSON");var r=JSON.parse(t);return new e(r)},e._defaultEncoding="utf-8"}(),function(){"use strict";var e,t,r,n,i,o,a,s="Environment.Browser",u={},c=TinCan.prototype.log;"undefined"!=typeof window?(Date.now||(Date.now=function(){return+new Date}),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(null==this)throw new TypeError;var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError;var n,i=arguments[1];for(n=0;n<r;n+=1)n in t&&e.call(i,t[n],n,t)}),u.hasCORS=!1,u.useXDR=!1,"undefined"!=typeof XMLHttpRequest&&void 0!==(new XMLHttpRequest).withCredentials?u.hasCORS=!0:"undefined"!=typeof XDomainRequest&&(u.hasCORS=!0,u.useXDR=!0),e=function(e,t,r){var n,i,o;return c("requestComplete: "+r.finished+", xhr.status: "+e.status,s),o=void 0===e.status?r.fakeStatus:1223===e.status?204:e.status,r.finished?n:(r.finished=!0,i=t.ignore404&&404===o,o>=200&&o<400||i?t.callback?void t.callback(null,e):n={err:null,xhr:e}:(n={err:o,xhr:e},c(0===o?"[warning] There was a problem communicating with the Learning Record Store. Aborted, offline, or invalid CORS endpoint ("+o+")":"[warning] There was a problem communicating with the Learning Record Store. ("+o+" | "+e.responseText+")",s),t.callback&&t.callback(o,e),n))},t=function(e,t,r,n){var i;for(i in t)t.hasOwnProperty(i)&&r.push(i+"="+encodeURIComponent(t[i]));return void 0!==n.data&&r.push("content="+encodeURIComponent(n.data)),t["Content-Type"]="application/x-www-form-urlencoded",e+="?method="+n.method,n.method="POST",n.params={},r.length>0&&(n.data=r.join("&")),e},r=function(r,n,i){c("sendRequest using XMLHttpRequest",s);var o,a,u,l,C=this,I=[],_={finished:!1,fakeStatus:null},S=void 0!==i.callback,T=r;for(a in c("sendRequest using XMLHttpRequest - async: "+S,s),i.params)i.params.hasOwnProperty(a)&&I.push(a+"="+encodeURIComponent(i.params[a]));if(I.length>0&&(T+="?"+I.join("&")),T.length>=2048){if(void 0===i.method)return l=new Error("method must not be undefined for an IE Mode Request conversion"),void 0!==i.callback&&i.callback(l,null),{err:l,xhr:null};r=t(r,n,I,i)}else r=T;if("undefined"!=typeof XMLHttpRequest)o=new XMLHttpRequest;else if(o=new ActiveXObject("Microsoft.XMLHTTP"),i.expectMultipart)return l=new Error("Attachment support not available"),void 0!==i.callback&&i.callback(l,null),{err:l,xhr:null};for(a in o.open(i.method,r,S),i.expectMultipart&&(o.responseType="arraybuffer"),n)n.hasOwnProperty(a)&&o.setRequestHeader(a,n[a]);u=i.data,S&&(o.onreadystatechange=function(){c("xhr.onreadystatechange - xhr.readyState: "+o.readyState,s),4===o.readyState&&e.call(C,o,i,_)});try{o.send(u)}catch(e){c("sendRequest caught send exception: "+e,s)}return S?o:e.call(this,o,i,_)},n=function(t,r,n){c("sendRequest using XDomainRequest",s);var i,o,u,l,C,I=this,_=[],S={finished:!1,fakeStatus:null};if(n.expectMultipart)return C=new Error("Attachment support not available"),void 0!==n.callback&&n.callback(C,null),{err:C,xhr:null};for(u in t+="?method="+n.method,n.params)n.params.hasOwnProperty(u)&&_.push(u+"="+encodeURIComponent(n.params[u]));for(u in r)r.hasOwnProperty(u)&&_.push(u+"="+encodeURIComponent(r[u]));void 0!==n.data&&_.push("content="+encodeURIComponent(n.data)),o=_.join("&"),(i=new XDomainRequest).open("POST",t),n.callback?(i.onload=function(){S.fakeStatus=200,e.call(I,i,n,S)},i.onerror=function(){S.fakeStatus=400,e.call(I,i,n,S)},i.ontimeout=function(){S.fakeStatus=0,e.call(I,i,n,S)}):(i.onload=function(){S.fakeStatus=200},i.onerror=function(){S.fakeStatus=400},i.ontimeout=function(){S.fakeStatus=0}),i.onprogress=function(){},i.timeout=0;try{i.send(o)}catch(e){c("sendRequest caught send exception: "+e,s)}if(!n.callback){for(l=1e4+Date.now(),c("sendRequest - until: "+l+", finished: "+S.finished,s);Date.now()<l&&null===S.fakeStatus;)a();return e.call(I,i,n,S)}return i},TinCan.LRS.prototype._initByEnvironment=function(e){var i,o,a;if(c("_initByEnvironment",s),e=e||{},this._makeRequest=r,this._IEModeConversion=t,null===(i=this.endpoint.toLowerCase().match(/([A-Za-z]+:)\/\/([^:\/]+):?(\d+)?(\/.*)?$/)))throw c("[error] LRS invalid: failed to divide URL parts",s),{code:4,mesg:"LRS invalid: failed to divide URL parts"};if(a=location.port,o=location.protocol.toLowerCase()===i[1],""===a&&(a="http:"===location.protocol.toLowerCase()?"80":"https:"===location.protocol.toLowerCase()?"443":""),!o||location.hostname.toLowerCase()!==i[2]||a!==(null!==i[3]&&void 0!==i[3]&&""!==i[3]?i[3]:"http:"===i[1]?"80":"https:"===i[1]?"443":""))if(u.hasCORS){if(u.useXDR&&o)this._makeRequest=n;else if(u.useXDR&&!o){if(!e.allowFail)throw c("[error] LRS invalid: cross domain request for differing scheme in IE with XDR",s),{code:2,mesg:"LRS invalid: cross domain request for differing scheme in IE with XDR"};c("[warning] LRS invalid: cross domain request for differing scheme in IE with XDR (allowed to fail)",s)}}else{if(!e.allowFail)throw c("[error] LRS invalid: cross domain requests not supported in this browser",s),{code:1,mesg:"LRS invalid: cross domain requests not supported in this browser"};c("[warning] LRS invalid: cross domain requests not supported in this browser (allowed to fail)",s)}},a=function(){var e=new XMLHttpRequest,t=window.location+"?forcenocache="+TinCan.Utils.getUUID();e.open("GET",t,!1),e.send(null)},TinCan.LRS.syncEnabled=!0,TinCan.LRS.prototype._getMultipartRequestData=function(e,t,r){var n,a=[];for(a.push(i(e,t)),n=0;n<r.length;n+=1)null!==r[n].content&&a.push(o(e,r[n].content,r[n].sha2,r[n].contentType));return a.push("\r\n--"+e+"--\r\n"),new Blob(a)},i=function(e,t){var r=["--"+e,"Content-Type: application/json","",JSON.stringify(t)].join("\r\n");return r+="\r\n"},o=function(e,t,r,n){var i=[],o=["--"+e,"Content-Type: "+n,"Content-Transfer-Encoding: binary","X-Experience-API-Hash: "+r].join("\r\n");return o+="\r\n\r\n",i.push(o),i.push(t),new Blob(i)},TinCan.Utils.stringToArrayBuffer=function(e,t){return t||(t=TinCan.Utils.defaultEncoding),new TextEncoder(t).encode(e).buffer},TinCan.Utils.stringFromArrayBuffer=function(e,t){return t||(t=TinCan.Utils.defaultEncoding),new TextDecoder(t).decode(e)}):c("'window' not defined",s)}(),function(e){"use strict";var t=void 0;function r(e){switch(typeof e){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return null===e?"null":"object"}}function n(e){return Object.prototype.toString.call(e).replace(/^\[object *|\]$/g,"")}function i(e){return"function"==typeof e}function o(e){if(null===e||e===t)throw TypeError();return Object(e)}function a(e){return e|0}function s(e){return e>>>0}var u,c,l=Math.LN2,C=Math.abs,I=Math.floor,_=Math.log,S=Math.max,T=Math.min,d=Math.pow,g=Math.round;function R(e,t){var r=32-t;return e<<r>>r}function f(e,t){var r=32-t;return e<<r>>>r}function E(e){return[255&e]}function p(e){return R(e[0],8)}function O(e){return[255&e]}function h(e){return f(e[0],8)}function A(e){return[(e=g(Number(e)))<0?0:e>255?255:255&e]}function m(e){return[255&e,e>>8&255]}function M(e){return R(e[1]<<8|e[0],16)}function b(e){return[255&e,e>>8&255]}function D(e){return f(e[1]<<8|e[0],16)}function v(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function N(e){return R(e[3]<<24|e[2]<<16|e[1]<<8|e[0],32)}function P(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function y(e){return f(e[3]<<24|e[2]<<16|e[1]<<8|e[0],32)}function L(e,t,r){var n,i,o,a=(1<<t-1)-1;function s(e){var t=I(e),r=e-t;return r<.5?t:r>.5||t%2?t+1:t}if(e!=e)i=(1<<t)-1,o=d(2,r-1),n=0;else if(e===1/0||e===-1/0)i=(1<<t)-1,o=0,n=e<0?1:0;else if(0===e)i=0,o=0,n=1/e==-1/0?1:0;else if(n=e<0,(e=C(e))>=d(2,1-a)){i=T(I(_(e)/l),1023);var u=e/d(2,i);u<1&&(i-=1,u*=2),u>=2&&(i+=1,u/=2);var c=d(2,r);i+=a,(o=s(u*c)-c)/c>=1&&(i+=1,o=0),i>2*a&&(i=(1<<t)-1,o=0)}else i=0,o=s(e/d(2,1-a-r));var S,g=[];for(S=r;S;S-=1)g.push(o%2?1:0),o=I(o/2);for(S=t;S;S-=1)g.push(i%2?1:0),i=I(i/2);g.push(n?1:0),g.reverse();for(var R=g.join(""),f=[];R.length;)f.unshift(parseInt(R.substring(0,8),2)),R=R.substring(8);return f}function W(e,t,r){var n,i,o,a,s,u,c,l,C=[];for(n=0;n<e.length;++n)for(o=e[n],i=8;i;i-=1)C.push(o%2?1:0),o>>=1;return C.reverse(),a=C.join(""),s=(1<<t-1)-1,u=parseInt(a.substring(0,1),2)?-1:1,c=parseInt(a.substring(1,1+t),2),l=parseInt(a.substring(1+t),2),c===(1<<t)-1?0!==l?NaN:u*(1/0):c>0?u*d(2,c-s)*(1+l/d(2,r)):0!==l?u*d(2,-(s-1))*(l/d(2,r)):u<0?-0:0}function w(e){return W(e,11,52)}function G(e){return L(e,11,52)}function x(e){return W(e,8,23)}function U(e){return L(e,8,23)}u=Object.defineProperty,c=!function(){try{return Object.defineProperty({},"x",{})}catch(e){return!1}}(),u&&!c||(Object.defineProperty=function(e,t,r){if(u)try{return u(e,t,r)}catch(e){}if(e!==Object(e))throw TypeError("Object.defineProperty called on non-object");return Object.prototype.__defineGetter__&&"get"in r&&Object.prototype.__defineGetter__.call(e,t,r.get),Object.prototype.__defineSetter__&&"set"in r&&Object.prototype.__defineSetter__.call(e,t,r.set),"value"in r&&(e[t]=r.value),e}),function(){function u(e){if((e=a(e))<0)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:e}),Object.defineProperty(this,"_bytes",{value:Array(e)});for(var t=0;t<e;t+=1)this._bytes[t]=0}function c(){if(!arguments.length||"object"!=typeof arguments[0])return function(e){if((e=a(e))<0)throw RangeError("length is not a small enough positive integer.");Object.defineProperty(this,"length",{value:e}),Object.defineProperty(this,"byteLength",{value:e*this.BYTES_PER_ELEMENT}),Object.defineProperty(this,"buffer",{value:new u(this.byteLength)}),Object.defineProperty(this,"byteOffset",{value:0})}.apply(this,arguments);if(arguments.length>=1&&"object"===r(arguments[0])&&arguments[0]instanceof c)return function(e){if(this.constructor!==e.constructor)throw TypeError();var t=e.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new u(t)}),Object.defineProperty(this,"byteLength",{value:t}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:e.length});for(var r=0;r<this.length;r+=1)this._setter(r,e._getter(r))}.apply(this,arguments);if(arguments.length>=1&&"object"===r(arguments[0])&&!(arguments[0]instanceof c)&&!(arguments[0]instanceof u||"ArrayBuffer"===n(arguments[0])))return function(e){var t=e.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new u(t)}),Object.defineProperty(this,"byteLength",{value:t}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:e.length});for(var r=0;r<this.length;r+=1){var n=e[r];this._setter(r,Number(n))}}.apply(this,arguments);if(arguments.length>=1&&"object"===r(arguments[0])&&(arguments[0]instanceof u||"ArrayBuffer"===n(arguments[0])))return function(e,r,n){if((r=s(r))>e.byteLength)throw RangeError("byteOffset out of range");if(r%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size.");if(n===t){var i=e.byteLength-r;if(i%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");n=i/this.BYTES_PER_ELEMENT}else i=(n=s(n))*this.BYTES_PER_ELEMENT;if(r+i>e.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:e}),Object.defineProperty(this,"byteLength",{value:i}),Object.defineProperty(this,"byteOffset",{value:r}),Object.defineProperty(this,"length",{value:n})}.apply(this,arguments);throw TypeError()}e.ArrayBuffer=e.ArrayBuffer||u,Object.defineProperty(c,"from",{value:function(e){return new this(e)}}),Object.defineProperty(c,"of",{value:function(){return new this(arguments)}});var l={};function _(t,r,n){var i=function(){Object.defineProperty(this,"constructor",{value:i}),c.apply(this,arguments),function(t){if(!("TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS"in e)){if(t.length>1e5)throw RangeError("Array too large for polyfill");var r;for(r=0;r<t.length;r+=1)n(r)}function n(e){Object.defineProperty(t,e,{get:function(){return t._getter(e)},set:function(r){t._setter(e,r)},enumerable:!0,configurable:!1})}}(this)};"__proto__"in i?i.__proto__=c:(i.from=c.from,i.of=c.of),i.BYTES_PER_ELEMENT=t;var o=function(){};return o.prototype=l,i.prototype=new o,Object.defineProperty(i.prototype,"BYTES_PER_ELEMENT",{value:t}),Object.defineProperty(i.prototype,"_pack",{value:r}),Object.defineProperty(i.prototype,"_unpack",{value:n}),i}c.prototype=l,Object.defineProperty(c.prototype,"_getter",{value:function(e){if(arguments.length<1)throw SyntaxError("Not enough arguments");if((e=s(e))>=this.length)return t;var r,n,i=[];for(r=0,n=this.byteOffset+e*this.BYTES_PER_ELEMENT;r<this.BYTES_PER_ELEMENT;r+=1,n+=1)i.push(this.buffer._bytes[n]);return this._unpack(i)}}),Object.defineProperty(c.prototype,"get",{value:c.prototype._getter}),Object.defineProperty(c.prototype,"_setter",{value:function(e,t){if(arguments.length<2)throw SyntaxError("Not enough arguments");if(!((e=s(e))>=this.length)){var r,n,i=this._pack(t);for(r=0,n=this.byteOffset+e*this.BYTES_PER_ELEMENT;r<this.BYTES_PER_ELEMENT;r+=1,n+=1)this.buffer._bytes[n]=i[r]}}}),Object.defineProperty(c.prototype,"constructor",{value:c}),Object.defineProperty(c.prototype,"copyWithin",{value:function(e,r){var n=arguments[2],i=o(this),u=s(i.length);u=S(u,0);var c,l=a(e);c=l<0?S(u+l,0):T(l,u);var C,I,_,d=a(r);C=d<0?S(u+d,0):T(d,u),_=(I=n===t?u:a(n))<0?S(u+I,0):T(I,u);var g,R=T(_-C,u-c);for(C<c&&c<C+R?(g=-1,C=C+R-1,c=c+R-1):g=1;R>0;)i._setter(c,i._getter(C)),C+=g,c+=g,R-=1;return i}}),Object.defineProperty(c.prototype,"every",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();for(var o=arguments[1],a=0;a<n;a++)if(!e.call(o,r._getter(a),a,r))return!1;return!0}}),Object.defineProperty(c.prototype,"fill",{value:function(e){var r=arguments[1],n=arguments[2],i=o(this),u=s(i.length);u=S(u,0);var c,l,C,I=a(r);for(c=I<0?S(u+I,0):T(I,u),C=(l=n===t?u:a(n))<0?S(u+l,0):T(l,u);c<C;)i._setter(c,e),c+=1;return i}}),Object.defineProperty(c.prototype,"filter",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();for(var o=[],a=arguments[1],u=0;u<n;u++){var c=r._getter(u);e.call(a,c,u,r)&&o.push(c)}return new this.constructor(o)}}),Object.defineProperty(c.prototype,"find",{value:function(e){var r=o(this),n=s(r.length);if(!i(e))throw TypeError();for(var a=arguments.length>1?arguments[1]:t,u=0;u<n;){var c=r._getter(u),l=e.call(a,c,u,r);if(Boolean(l))return c;++u}return t}}),Object.defineProperty(c.prototype,"findIndex",{value:function(e){var r=o(this),n=s(r.length);if(!i(e))throw TypeError();for(var a=arguments.length>1?arguments[1]:t,u=0;u<n;){var c=r._getter(u),l=e.call(a,c,u,r);if(Boolean(l))return u;++u}return-1}}),Object.defineProperty(c.prototype,"forEach",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();for(var o=arguments[1],a=0;a<n;a++)e.call(o,r._getter(a),a,r)}}),Object.defineProperty(c.prototype,"indexOf",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(0===n)return-1;var i=0;if(arguments.length>0&&((i=Number(arguments[1]))!=i?i=0:0!==i&&i!==1/0&&i!==-1/0&&(i=(i>0||-1)*I(C(i)))),i>=n)return-1;for(var o=i>=0?i:S(n-C(i),0);o<n;o++)if(r._getter(o)===e)return o;return-1}}),Object.defineProperty(c.prototype,"join",{value:function(e){if(this===t||null===this)throw TypeError();for(var r=Object(this),n=s(r.length),i=Array(n),o=0;o<n;++o)i[o]=r._getter(o);return i.join(e===t?",":e)}}),Object.defineProperty(c.prototype,"lastIndexOf",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(0===n)return-1;var i=n;arguments.length>1&&((i=Number(arguments[1]))!=i?i=0:0!==i&&i!==1/0&&i!==-1/0&&(i=(i>0||-1)*I(C(i))));for(var o=i>=0?T(i,n-1):n-C(i);o>=0;o--)if(r._getter(o)===e)return o;return-1}}),Object.defineProperty(c.prototype,"map",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();var o=[];o.length=n;for(var a=arguments[1],u=0;u<n;u++)o[u]=e.call(a,r._getter(u),u,r);return new this.constructor(o)}}),Object.defineProperty(c.prototype,"reduce",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();if(0===n&&1===arguments.length)throw TypeError();var o,a=0;for(o=arguments.length>=2?arguments[1]:r._getter(a++);a<n;)o=e.call(t,o,r._getter(a),a,r),a++;return o}}),Object.defineProperty(c.prototype,"reduceRight",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();if(0===n&&1===arguments.length)throw TypeError();var o,a=n-1;for(o=arguments.length>=2?arguments[1]:r._getter(a--);a>=0;)o=e.call(t,o,r._getter(a),a,r),a--;return o}}),Object.defineProperty(c.prototype,"reverse",{value:function(){if(this===t||null===this)throw TypeError();for(var e=Object(this),r=s(e.length),n=I(r/2),i=0,o=r-1;i<n;++i,--o){var a=e._getter(i);e._setter(i,e._getter(o)),e._setter(o,a)}return e}}),Object.defineProperty(c.prototype,"set",{value:function(e,t){if(arguments.length<1)throw SyntaxError("Not enough arguments");var r,n,i,o,a,u,c,l,C,I;if("object"==typeof arguments[0]&&arguments[0].constructor===this.constructor){if(r=arguments[0],(i=s(arguments[1]))+r.length>this.length)throw RangeError("Offset plus length of array is out of range");if(l=this.byteOffset+i*this.BYTES_PER_ELEMENT,C=r.length*this.BYTES_PER_ELEMENT,r.buffer===this.buffer){for(I=[],a=0,u=r.byteOffset;a<C;a+=1,u+=1)I[a]=r.buffer._bytes[u];for(a=0,c=l;a<C;a+=1,c+=1)this.buffer._bytes[c]=I[a]}else for(a=0,u=r.byteOffset,c=l;a<C;a+=1,u+=1,c+=1)this.buffer._bytes[c]=r.buffer._bytes[u]}else{if("object"!=typeof arguments[0]||void 0===arguments[0].length)throw TypeError("Unexpected argument type(s)");if(o=s((n=arguments[0]).length),(i=s(arguments[1]))+o>this.length)throw RangeError("Offset plus length of array is out of range");for(a=0;a<o;a+=1)u=n[a],this._setter(i+a,Number(u))}}}),Object.defineProperty(c.prototype,"slice",{value:function(e,r){for(var n=o(this),i=s(n.length),u=a(e),c=u<0?S(i+u,0):T(u,i),l=r===t?i:a(r),C=l<0?S(i+l,0):T(l,i),I=C-c,_=new(0,n.constructor)(I),d=0;c<C;){var g=n._getter(c);_._setter(d,g),++c,++d}return _}}),Object.defineProperty(c.prototype,"some",{value:function(e){if(this===t||null===this)throw TypeError();var r=Object(this),n=s(r.length);if(!i(e))throw TypeError();for(var o=arguments[1],a=0;a<n;a++)if(e.call(o,r._getter(a),a,r))return!0;return!1}}),Object.defineProperty(c.prototype,"sort",{value:function(e){if(this===t||null===this)throw TypeError();for(var r=Object(this),n=s(r.length),i=Array(n),o=0;o<n;++o)i[o]=r._getter(o);for(e?i.sort(e):i.sort(),o=0;o<n;++o)r._setter(o,i[o]);return r}}),Object.defineProperty(c.prototype,"subarray",{value:function(e,t){function r(e,t,r){return e<t?t:e>r?r:e}e=a(e),t=a(t),arguments.length<1&&(e=0),arguments.length<2&&(t=this.length),e<0&&(e=this.length+e),t<0&&(t=this.length+t),e=r(e,0,this.length);var n=(t=r(t,0,this.length))-e;return n<0&&(n=0),new this.constructor(this.buffer,this.byteOffset+e*this.BYTES_PER_ELEMENT,n)}});var d=_(1,E,p),g=_(1,O,h),R=_(1,A,h),f=_(2,m,M),L=_(2,b,D),W=_(4,v,N),F=_(4,P,y),j=_(4,U,x),k=_(8,G,w);e.Int8Array=e.Int8Array||d,e.Uint8Array=e.Uint8Array||g,e.Uint8ClampedArray=e.Uint8ClampedArray||R,e.Int16Array=e.Int16Array||f,e.Uint16Array=e.Uint16Array||L,e.Int32Array=e.Int32Array||W,e.Uint32Array=e.Uint32Array||F,e.Float32Array=e.Float32Array||j,e.Float64Array=e.Float64Array||k}(),function(){function r(e,t){return i(e.get)?e.get(t):e[t]}var o,a=(o=new Uint16Array([4660]),18===r(new Uint8Array(o.buffer),0));function u(e,r,i){if(!(e instanceof ArrayBuffer||"ArrayBuffer"===n(e)))throw TypeError();if((r=s(r))>e.byteLength)throw RangeError("byteOffset out of range");if(r+(i=i===t?e.byteLength-r:s(i))>e.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:e}),Object.defineProperty(this,"byteLength",{value:i}),Object.defineProperty(this,"byteOffset",{value:r})}function c(e){return function(t,n){if((t=s(t))+e.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");t+=this.byteOffset;for(var i=new Uint8Array(this.buffer,t,e.BYTES_PER_ELEMENT),o=[],u=0;u<e.BYTES_PER_ELEMENT;u+=1)o.push(r(i,u));return Boolean(n)===Boolean(a)&&o.reverse(),r(new e(new Uint8Array(o).buffer),0)}}function l(e){return function(t,n,i){if((t=s(t))+e.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");var o,u=new e([n]),c=new Uint8Array(u.buffer),l=[];for(o=0;o<e.BYTES_PER_ELEMENT;o+=1)l.push(r(c,o));Boolean(i)===Boolean(a)&&l.reverse(),new Uint8Array(this.buffer,t,e.BYTES_PER_ELEMENT).set(l)}}Object.defineProperty(u.prototype,"getUint8",{value:c(Uint8Array)}),Object.defineProperty(u.prototype,"getInt8",{value:c(Int8Array)}),Object.defineProperty(u.prototype,"getUint16",{value:c(Uint16Array)}),Object.defineProperty(u.prototype,"getInt16",{value:c(Int16Array)}),Object.defineProperty(u.prototype,"getUint32",{value:c(Uint32Array)}),Object.defineProperty(u.prototype,"getInt32",{value:c(Int32Array)}),Object.defineProperty(u.prototype,"getFloat32",{value:c(Float32Array)}),Object.defineProperty(u.prototype,"getFloat64",{value:c(Float64Array)}),Object.defineProperty(u.prototype,"setUint8",{value:l(Uint8Array)}),Object.defineProperty(u.prototype,"setInt8",{value:l(Int8Array)}),Object.defineProperty(u.prototype,"setUint16",{value:l(Uint16Array)}),Object.defineProperty(u.prototype,"setInt16",{value:l(Int16Array)}),Object.defineProperty(u.prototype,"setUint32",{value:l(Uint32Array)}),Object.defineProperty(u.prototype,"setInt32",{value:l(Int32Array)}),Object.defineProperty(u.prototype,"setFloat32",{value:l(Float32Array)}),Object.defineProperty(u.prototype,"setFloat64",{value:l(Float64Array)}),e.DataView=e.DataView||u}()}(self),function(){"use strict";function e(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(t,r){var n=this.byteLength,i=e(t,n),o=n;if(undefined!==r&&(o=e(r,n)),i>o)return new ArrayBuffer(0);var a=o-i,s=new ArrayBuffer(a),u=new Uint8Array(s),c=new Uint8Array(this,i,a);return u.set(c),s})}(),"undefined"!=typeof module&&module.exports&&(this["encoding-indexes"]=require("./encoding-indexes.js")["encoding-indexes"]),function(e){"use strict";function t(e,t,r){return t<=e&&e<=r}var r=Math.floor;function n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function i(e){return 0<=e&&e<=127}var o=i,a=-1;function s(e){this.tokens=[].slice.call(e),this.tokens.reverse()}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():a},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var u=-1;function c(e,t){if(e)throw TypeError("Decoder error");return t||65533}function l(e){throw TypeError("The code point "+e+" could not be encoded.")}function C(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(_,e)?_[e]:null}var I=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],_={};I.forEach(function(e){e.encodings.forEach(function(e){e.labels.forEach(function(t){_[t]=e})})});var S={},T={};function d(e,t){return t&&t[e]||null}function g(e,t){var r=t.indexOf(e);return-1===r?null:r}function R(t){if(!("encoding-indexes"in e))throw Error("Indexes missing. Did you forget to include encoding-indexes.js?");return e["encoding-indexes"][t]}var f="utf-8";function E(e,t){if(!(this instanceof E))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0!==e?String(e):f,t=n(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=C(e);if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!T[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js?");var i=this;return i._encoding=r,Boolean(t.fatal)&&(i._error_mode="fatal"),Boolean(t.ignoreBOM)&&(i._ignoreBOM=!0),Object.defineProperty||(this.encoding=i._encoding.name.toLowerCase(),this.fatal="fatal"===i._error_mode,this.ignoreBOM=i._ignoreBOM),i}function p(t,r){if(!(this instanceof p))throw TypeError("Called as a function. Did you forget 'new'?");r=n(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement";var i=this;if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){var o=C(t=void 0!==t?String(t):f);if(null===o||"replacement"===o.name)throw RangeError("Unknown encoding: "+t);if(!S[o.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js?");i._encoding=o}else i._encoding=C("utf-8"),void 0!==t&&"console"in e&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=i._encoding.name.toLowerCase()),i}function O(e){var r=e.fatal,n=0,i=0,o=0,s=128,l=191;this.handler=function(e,C){if(C===a&&0!==o)return o=0,c(r);if(C===a)return u;if(0===o){if(t(C,0,127))return C;if(t(C,194,223))o=1,n=C-192;else if(t(C,224,239))224===C&&(s=160),237===C&&(l=159),o=2,n=C-224;else{if(!t(C,240,244))return c(r);240===C&&(s=144),244===C&&(l=143),o=3,n=C-240}return n<<=6*o,null}if(!t(C,s,l))return n=o=i=0,s=128,l=191,e.prepend(C),c(r);if(s=128,l=191,n+=C-128<<6*(o-(i+=1)),i!==o)return null;var I=n;return n=o=i=0,I}}function h(e){e.fatal;this.handler=function(e,r){if(r===a)return u;if(t(r,0,127))return r;var n,i;t(r,128,2047)?(n=1,i=192):t(r,2048,65535)?(n=2,i=224):t(r,65536,1114111)&&(n=3,i=240);for(var o=[(r>>6*n)+i];n>0;){var s=r>>6*(n-1);o.push(128|63&s),n-=1}return o}}function A(e,t){var r=t.fatal;this.handler=function(t,n){if(n===a)return u;if(i(n))return n;var o=e[n-128];return null===o?c(r):o}}function m(e,t){t.fatal;this.handler=function(t,r){if(r===a)return u;if(o(r))return r;var n=g(r,e);return null===n&&l(r),n+128}}function M(e){var r=e.fatal,n=0,o=0,s=0;this.handler=function(e,l){if(l===a&&0===n&&0===o&&0===s)return u;var C;if(l!==a||0===n&&0===o&&0===s||(n=0,o=0,s=0,c(r)),0!==s){C=null,t(l,48,57)&&(C=function(e){if(e>39419&&e<189e3||e>1237575)return null;if(7457===e)return 59335;var t,r=0,n=0,i=R("gb18030");for(t=0;t<i.length;++t){var o=i[t];if(!(o[0]<=e))break;r=o[0],n=o[1]}return n+e-r}(10*(126*(10*(n-129)+(o-48))+(s-129))+l-48));var I=[o,s,l];return n=0,o=0,s=0,null===C?(e.prepend(I),c(r)):C}if(0!==o)return t(l,129,254)?(s=l,null):(e.prepend([o,l]),n=0,o=0,c(r));if(0!==n){if(t(l,48,57))return o=l,null;var _=n,S=null;n=0;var T=l<127?64:65;return(t(l,64,126)||t(l,128,254))&&(S=190*(_-129)+(l-T)),null===(C=null===S?null:d(S,R("gb18030")))&&i(l)&&e.prepend(l),null===C?c(r):C}return i(l)?l:128===l?8364:t(l,129,254)?(n=l,null):c(r)}}function b(e,t){e.fatal;this.handler=function(e,n){if(n===a)return u;if(o(n))return n;if(58853===n)return l(n);if(t&&8364===n)return 128;var i=g(n,R("gb18030"));if(null!==i){var s=i%190;return[r(i/190)+129,s+(s<63?64:65)]}if(t)return l(n);i=function(e){if(59335===e)return 7457;var t,r=0,n=0,i=R("gb18030");for(t=0;t<i.length;++t){var o=i[t];if(!(o[1]<=e))break;r=o[1],n=o[0]}return n+e-r}(n);var c=r(i/10/126/10),C=r((i-=10*c*126*10)/10/126),I=r((i-=10*C*126)/10);return[c+129,C+48,I+129,i-10*I+48]}}function D(e){var r=e.fatal,n=0;this.handler=function(e,o){if(o===a&&0!==n)return n=0,c(r);if(o===a&&0===n)return u;if(0!==n){var s=n,l=null;n=0;var C=o<127?64:98;switch((t(o,64,126)||t(o,161,254))&&(l=157*(s-129)+(o-C)),l){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var I=null===l?null:d(l,R("big5"));return null===I&&i(o)&&e.prepend(o),null===I?c(r):I}return i(o)?o:t(o,129,254)?(n=o,null):c(r)}}function v(e){e.fatal;this.handler=function(e,t){if(t===a)return u;if(o(t))return t;var n=function(e){var t=R("big5");return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):g(e,t)}(t);if(null===n)return l(t);var i=r(n/157)+129;if(i<161)return l(t);var s=n%157;return[i,s+(s<63?64:98)]}}function N(e){var r=e.fatal,n=!1,o=0;this.handler=function(e,s){if(s===a&&0!==o)return o=0,c(r);if(s===a&&0===o)return u;if(142===o&&t(s,161,223))return o=0,65377+s-161;if(143===o&&t(s,161,254))return n=!0,o=s,null;if(0!==o){var l=o;o=0;var C=null;return t(l,161,254)&&t(s,161,254)&&(C=d(94*(l-161)+(s-161),R(n?"jis0212":"jis0208"))),n=!1,t(s,161,254)||e.prepend(s),null===C?c(r):C}return i(s)?s:142===s||143===s||t(s,161,254)?(o=s,null):c(r)}}function P(e){e.fatal;this.handler=function(e,n){if(n===a)return u;if(o(n))return n;if(165===n)return 92;if(8254===n)return 126;if(t(n,65377,65439))return[142,n-65377+161];8722===n&&(n=65293);var i=g(n,R("jis0208"));return null===i?l(n):[r(i/94)+161,i%94+161]}}function y(e){var r=e.fatal,n=0,i=1,o=2,s=3,l=4,C=5,I=6,_=n,S=n,T=0,g=!1;this.handler=function(e,f){switch(_){default:case n:return 27===f?(_=C,null):t(f,0,127)&&14!==f&&15!==f&&27!==f?(g=!1,f):f===a?u:(g=!1,c(r));case i:return 27===f?(_=C,null):92===f?(g=!1,165):126===f?(g=!1,8254):t(f,0,127)&&14!==f&&15!==f&&27!==f&&92!==f&&126!==f?(g=!1,f):f===a?u:(g=!1,c(r));case o:return 27===f?(_=C,null):t(f,33,95)?(g=!1,65377+f-33):f===a?u:(g=!1,c(r));case s:return 27===f?(_=C,null):t(f,33,126)?(g=!1,T=f,_=l,null):f===a?u:(g=!1,c(r));case l:if(27===f)return _=C,c(r);if(t(f,33,126)){_=s;var E=d(94*(T-33)+f-33,R("jis0208"));return null===E?c(r):E}return f===a?(_=s,e.prepend(f),c(r)):(_=s,c(r));case C:return 36===f||40===f?(T=f,_=I,null):(e.prepend(f),g=!1,_=S,c(r));case I:var p=T;T=0;var O=null;if(40===p&&66===f&&(O=n),40===p&&74===f&&(O=i),40===p&&73===f&&(O=o),36!==p||64!==f&&66!==f||(O=s),null!==O){_=_=O;var h=g;return g=!0,h?c(r):null}return e.prepend([p,f]),g=!1,_=S,c(r)}}}function L(e){e.fatal;var t=0,n=1,i=2,s=t;this.handler=function(e,c){if(c===a&&s!==t)return e.prepend(c),s=t,[27,40,66];if(c===a&&s===t)return u;if(!(s!==t&&s!==n||14!==c&&15!==c&&27!==c))return l(65533);if(s===t&&o(c))return c;if(s===n&&(o(c)&&92!==c&&126!==c||165==c||8254==c)){if(o(c))return c;if(165===c)return 92;if(8254===c)return 126}if(o(c)&&s!==t)return e.prepend(c),s=t,[27,40,66];if((165===c||8254===c)&&s!==n)return e.prepend(c),s=n,[27,40,74];8722===c&&(c=65293);var C=g(c,R("jis0208"));return null===C?l(c):s!==i?(e.prepend(c),s=i,[27,36,66]):[r(C/94)+33,C%94+33]}}function W(e){var r=e.fatal,n=0;this.handler=function(e,o){if(o===a&&0!==n)return n=0,c(r);if(o===a&&0===n)return u;if(0!==n){var s=n,l=null;n=0;var C=o<127?64:65,I=s<160?129:193;(t(o,64,126)||t(o,128,252))&&(l=188*(s-I)+o-C);var _=null===l?null:d(l,R("jis0208"));return null===_&&null!==l&&t(l,8836,10528)?57344+l-8836:(null===_&&i(o)&&e.prepend(o),null===_?c(r):_)}return i(o)||128===o?o:t(o,161,223)?65377+o-161:t(o,129,159)||t(o,224,252)?(n=o,null):c(r)}}function w(e){e.fatal;this.handler=function(e,n){if(n===a)return u;if(o(n)||128===n)return n;if(165===n)return 92;if(8254===n)return 126;if(t(n,65377,65439))return n-65377+161;8722===n&&(n=65293);var i=function(e){var r=g(e,R("jis0208"));return null===r||t(r,8272,8835)?null:r}(n);if(null===i)return l(n);var s=r(i/188),c=i%188;return[s+(s<31?129:193),c+(c<63?64:65)]}}function G(e){var r=e.fatal,n=0;this.handler=function(e,o){if(o===a&&0!==n)return n=0,c(r);if(o===a&&0===n)return u;if(0!==n){var s=n,l=null;n=0,t(o,65,254)&&(l=190*(s-129)+(o-65));var C=null===l?null:d(l,R("euc-kr"));return null===l&&i(o)&&e.prepend(o),null===C?c(r):C}return i(o)?o:t(o,129,254)?(n=o,null):c(r)}}function x(e){e.fatal;this.handler=function(e,t){if(t===a)return u;if(o(t))return t;var n=g(t,R("euc-kr"));return null===n?l(t):[r(n/190)+129,n%190+65]}}function U(e,t){var r=e>>8,n=255&e;return t?[r,n]:[n,r]}function F(e,r){var n=r.fatal,i=null,o=null;this.handler=function(r,s){if(s===a&&(null!==i||null!==o))return c(n);if(s===a&&null===i&&null===o)return u;if(null===i)return i=s,null;var l;if(l=e?(i<<8)+s:(s<<8)+i,i=null,null!==o){var C=o;return o=null,t(l,56320,57343)?65536+1024*(C-55296)+(l-56320):(r.prepend(U(l,e)),c(n))}return t(l,55296,56319)?(o=l,null):t(l,56320,57343)?c(n):l}}function j(e,r){r.fatal;this.handler=function(r,n){if(n===a)return u;if(t(n,0,65535))return U(n,e);var i=U(55296+(n-65536>>10),e),o=U(56320+(n-65536&1023),e);return i.concat(o)}}function k(e){e.fatal;this.handler=function(e,t){return t===a?u:i(t)?t:63360+t-128}}function V(e){e.fatal;this.handler=function(e,r){return r===a?u:o(r)?r:t(r,63360,63487)?r-63360+128:l(r)}}Object.defineProperty&&(Object.defineProperty(E.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(E.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(E.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),E.prototype.decode=function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=n(t),this._do_not_flush||(this._decoder=T[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var i,o=new s(r),c=[];;){var l=o.read();if(l===a)break;if((i=this._decoder.handler(o,l))===u)break;null!==i&&(Array.isArray(i)?c.push.apply(c,i):c.push(i))}if(!this._do_not_flush){do{if((i=this._decoder.handler(o,o.read()))===u)break;null!==i&&(Array.isArray(i)?c.push.apply(c,i):c.push(i))}while(!o.endOfStream());this._decoder=null}return function(e){var t,r;return t=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===t.indexOf(r)||this._ignoreBOM||this._BOMseen||(e.length>0&&65279===e[0]?(this._BOMseen=!0,e.shift()):e.length>0&&(this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(e)}.call(this,c)},Object.defineProperty&&Object.defineProperty(p.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),p.prototype.encode=function(e,t){e=e?String(e):"",t=n(t),this._do_not_flush||(this._encoder=S[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(t.stream);for(var r,i=new s(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var o=t.charCodeAt(n);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(n===r-1)i.push(65533);else{var a=e.charCodeAt(n+1);if(56320<=a&&a<=57343){var s=1023&o,u=1023&a;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e)),o=[];;){var c=i.read();if(c===a)break;if((r=this._encoder.handler(i,c))===u)break;Array.isArray(r)?o.push.apply(o,r):o.push(r)}if(!this._do_not_flush){for(;(r=this._encoder.handler(i,i.read()))!==u;)Array.isArray(r)?o.push.apply(o,r):o.push(r);this._encoder=null}return new Uint8Array(o)},S["UTF-8"]=function(e){return new h(e)},T["UTF-8"]=function(e){return new O(e)},"encoding-indexes"in e&&I.forEach(function(e){"Legacy single-byte encodings"===e.heading&&e.encodings.forEach(function(e){var t=e.name,r=R(t.toLowerCase());T[t]=function(e){return new A(r,e)},S[t]=function(e){return new m(r,e)}})}),T.GBK=function(e){return new M(e)},S.GBK=function(e){return new b(e,!0)},S.gb18030=function(e){return new b(e)},T.gb18030=function(e){return new M(e)},S.Big5=function(e){return new v(e)},T.Big5=function(e){return new D(e)},S["EUC-JP"]=function(e){return new P(e)},T["EUC-JP"]=function(e){return new N(e)},S["ISO-2022-JP"]=function(e){return new L(e)},T["ISO-2022-JP"]=function(e){return new y(e)},S.Shift_JIS=function(e){return new w(e)},T.Shift_JIS=function(e){return new W(e)},S["EUC-KR"]=function(e){return new x(e)},T["EUC-KR"]=function(e){return new G(e)},S["UTF-16BE"]=function(e){return new j(!0,e)},T["UTF-16BE"]=function(e){return new F(!0,e)},S["UTF-16LE"]=function(e){return new j(!1,e)},T["UTF-16LE"]=function(e){return new F(!1,e)},S["x-user-defined"]=function(e){return new V(e)},T["x-user-defined"]=function(e){return new k(e)},e.TextEncoder||(e.TextEncoder=p),e.TextDecoder||(e.TextDecoder=E),"undefined"!=typeof module&&module.exports&&(module.exports={TextEncoder:e.TextEncoder,TextDecoder:e.TextDecoder,EncodingIndexes:e["encoding-indexes"]})}(this),function(){var e;"function"==typeof fetch&&"keepalive"in new Request("")&&(e=TinCan.LRS.prototype._initByEnvironment,TinCan.LRS.prototype._initByEnvironment=function(t){var r,n=this;e.call(this,t),r=this._makeRequest,this._makeRequest=function(e,t,i){var o,a=r.apply(n,arguments),s=[],u=e;if(void 0!==i.callback)return a;if(!blnUnloading)return a;if(void 0===a.err||null===a.err||0!==a.err)return a;for(prop in i.params)i.params.hasOwnProperty(prop)&&s.push(prop+"="+encodeURIComponent(i.params[prop]));u=n._IEModeConversion(u,t,s,i),o={mode:"cors",cache:"no-cache",credentials:"include",keepalive:!0,method:i.method,headers:{"Content-Type":t["Content-Type"]},body:i.data};try{return fetch(u,o).then(function(e){n.log("Overridden request Fetch with KeepAlive finished with status "+e.status+":"+e.statusText)}).catch(function(e){n.log("Overridden request Fetch with KeepAlive returned error: "+e.message)}),{err:null}}catch(e){return n.log("Overridden request Fetch with KeepAlive threw error: "+e.message),{err:e.message,xhr:null}}}})}(),function(e){var t="object"==typeof exports&&exports,r="object"==typeof module&&module&&module.exports==t&&module,n="object"==typeof global&&global;n.global!==n&&n.window!==n||(e=n);var i,o,a=2147483647,s=36,u=/^xn--/,c=/[^ -~]/,l=/\x2E|\u3002|\uFF0E|\uFF61/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=Math.floor,_=String.fromCharCode;function S(e){throw RangeError(C[e])}function T(e,t){for(var r=e.length;r--;)e[r]=t(e[r]);return e}function d(e,t){return T(e.split(l),t).join(".")}function g(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function R(e){return T(e,function(e){var t="";return e>65535&&(t+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=_(e)}).join("")}function f(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:s}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,r){var n=0;for(e=r?I(e/700):e>>1,e+=I(e/t);e>455;n+=s)e=I(e/35);return I(n+36*e/(e+38))}function O(e){var t,r,n,i,o,u,c,l,C,_,T=[],d=e.length,g=0,E=128,O=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&S("not-basic"),T.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<d;){for(o=g,u=1,c=s;i>=d&&S("invalid-input"),((l=f(e.charCodeAt(i++)))>=s||l>I((a-g)/u))&&S("overflow"),g+=l*u,!(l<(C=c<=O?1:c>=O+26?26:c-O));c+=s)u>I(a/(_=s-C))&&S("overflow"),u*=_;O=p(g-o,t=T.length+1,0==o),I(g/t)>a-E&&S("overflow"),E+=I(g/t),g%=t,T.splice(g++,0,E)}return R(T)}function h(e){var t,r,n,i,o,u,c,l,C,T,d,R,f,O,h,A=[];for(R=(e=g(e)).length,t=128,r=0,o=72,u=0;u<R;++u)(d=e[u])<128&&A.push(_(d));for(n=i=A.length,i&&A.push("-");n<R;){for(c=a,u=0;u<R;++u)(d=e[u])>=t&&d<c&&(c=d);for(c-t>I((a-r)/(f=n+1))&&S("overflow"),r+=(c-t)*f,t=c,u=0;u<R;++u)if((d=e[u])<t&&++r>a&&S("overflow"),d==t){for(l=r,C=s;!(l<(T=C<=o?1:C>=o+26?26:C-o));C+=s)h=l-T,O=s-T,A.push(_(E(T+h%O,0))),l=I(h/O);A.push(_(E(l,0))),o=p(r,f,n==i),r=0,++n}++r,++t}return A.join("")}if(i={version:"1.2.3",ucs2:{decode:g,encode:R},decode:O,encode:h,toASCII:function(e){return d(e,function(e){return c.test(e)?"xn--"+h(e):e})},toUnicode:function(e){return d(e,function(e){return u.test(e)?O(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return i});else if(t&&!t.nodeType)if(r)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(this),
/*!
 * URI.js - Mutating URLs
 *
 * Version: 1.14.2
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *   GPL v3 http://opensource.org/licenses/GPL-3.0
 *
 */
function(e,t){"use strict";"object"==typeof exports?module.exports=t(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"==typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)}(this,function(e,t,r,n){"use strict";var i=n&&n.URI;function o(e,t){if(!(this instanceof o))return new o(e,t);if(void 0===e){if(arguments.length)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.14.2";var a=o.prototype,s=Object.prototype.hasOwnProperty;function u(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function c(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function l(e){return"Array"===c(e)}function C(e,t){var r,n;if(l(t)){for(r=0,n=t.length;r<n;r++)if(!C(e,t[r]))return!1;return!0}var i=c(t);for(r=0,n=e.length;r<n;r++)if("RegExp"===i){if("string"==typeof e[r]&&e[r].match(t))return!0}else if(e[r]===t)return!0;return!1}function I(e,t){if(!l(e)||!l(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function _(e){return escape(e)}function S(e){return encodeURIComponent(e).replace(/[!'()*]/g,_).replace(/\*/g,"%2A")}function T(e){return 45===e||46===e||95===e||126===e||e>=48&&e<64||e>=65&&e<91||e>=97&&e<123||e>=160&&e<55296||e>=57344&&e<63743||e>=63744&&e<64976||e>=65008&&e<65520||e>=65536&&e<131070||e>=131072&&e<196606||e>=196608&&e<262142||e>=262144&&e<327678||e>=327680&&e<393214||e>=393216&&e<458750||e>=458752&&e<524286||e>=524288&&e<589822||e>=589824&&e<655358||e>=655360&&e<720894||e>=720896&&e<786430||e>=786432&&e<851966||e>=851968&&e<917502||e>=917504&&e<983038||e>=983040&&e<1048574||e>=1048576&&e<1114110}function d(t){for(var r=e.ucs2.decode(t),n="",i=0;i<r.length;i++){var o=r[i];if(T(o))n+=e.ucs2.encode([o]);else n+=S(e.ucs2.encode([o]))}return n}function g(t){return o.punycode_expression.test(t)&&(t=e.toUnicode(t)),d(t)}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\.-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»]+$/},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o._defaultRecodeHostname=e?e.toASCII:function(e){return e},o.iso8859=function(){o.recodeHostname=o._defaultRecodeHostname,o.encode=escape,o.decode=unescape},o.unicode=function(){o.recodeHostname=o._defaultRecodeHostname,o.encode=S,o.decode=decodeURIComponent},o.iri=function(){o.recodeHostname=g,o.encode=d,o.decode=decodeURIComponent},o.unicode(),o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(e,t){var r=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?r.replace(/%20/g,"+"):r},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var R,f={encode:"encode",decode:"decode"},E=function(e,t){return function(r){try{return o[t](r+"").replace(o.characters[e][t].expression,function(r){return o.characters[e][t].map[r]})}catch(e){return r}}};for(R in f)o[R+"PathSegment"]=E("pathname",f[R]),o[R+"UrnPathSegment"]=E("urnpath",f[R]);var p=function(e,t,r){return function(n){var i;i=r?function(e){return o[t](o[r](e))}:o[t];for(var a=(n+"").split(e),s=0,u=a.length;s<u;s++)a[s]=i(a[s]);return a.join(e)}};function O(e){return function(t,r){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!r),this)}}function h(e,t){return function(r,n){return void 0===r?this._parts[e]||"":(null!==r&&(r+="").charAt(0)===t&&(r=r.substring(1)),this._parts[e]=r,this.build(!n),this)}}o.decodePath=p("/","decodePathSegment"),o.decodeUrnPath=p(":","decodeUrnPathSegment"),o.recodePath=p("/","encodePathSegment","decode"),o.recodeUrnPath=p(":","encodeUrnPathSegment","decode"),o.encodeReserved=E("reserved","encode"),o.parse=function(e,t){var r;return t||(t={}),(r=e.indexOf("#"))>-1&&(t.fragment=e.substring(r+1)||null,e=e.substring(0,r)),(r=e.indexOf("?"))>-1&&(t.query=e.substring(r+1)||null,e=e.substring(0,r)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(r=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,r)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(r+1,r+3)?(e=e.substring(r+3),e=o.parseAuthority(e,t)):(e=e.substring(r+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){var r,n,i=e.indexOf("/");if(-1===i&&(i=e.length),"["===e.charAt(0))r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,i)||null,"/"===t.port&&(t.port=null);else{var o=e.indexOf(":"),a=e.indexOf("/"),s=e.indexOf(":",o+1);-1!==s&&(-1===a||s<a)?(t.hostname=e.substring(0,i)||null,t.port=null):(n=e.substring(0,i).split(":"),t.hostname=n[0]||null,t.port=n[1]||null)}return t.hostname&&"/"!==e.substring(i).charAt(0)&&(i++,e="/"+e),e.substring(i)||"/"},o.parseAuthority=function(e,t){return e=o.parseUserinfo(e,t),o.parseHost(e,t)},o.parseUserinfo=function(e,t){var r,n=e.indexOf("/"),i=e.lastIndexOf("@",n>-1?n:e.length-1);return i>-1&&(-1===n||i<n)?(r=e.substring(0,i).split(":"),t.username=r[0]?o.decode(r[0]):null,r.shift(),t.password=r[0]?o.decode(r.join(":")):null,e=e.substring(i+1)):(t.username=null,t.password=null),e},o.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var r,n,i,a={},u=e.split("&"),c=u.length,l=0;l<c;l++)r=u[l].split("="),n=o.decodeQuery(r.shift(),t),i=r.length?o.decodeQuery(r.join("="),t):null,s.call(a,n)?("string"==typeof a[n]&&(a[n]=[a[n]]),a[n].push(i)):a[n]=i;return a},o.build=function(e){var t="";return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//"),t+=o.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&"string"==typeof e.hostname&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},o.buildHost=function(e){var t="";return e.hostname?(o.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},o.buildAuthority=function(e){return o.buildUserinfo(e)+o.buildHost(e)},o.buildUserinfo=function(e){var t="";return e.username&&(t+=o.encode(e.username),e.password&&(t+=":"+o.encode(e.password)),t+="@"),t},o.buildQuery=function(e,t,r){var n,i,a,u,c="";for(i in e)if(s.call(e,i)&&i)if(l(e[i]))for(n={},a=0,u=e[i].length;a<u;a++)void 0!==e[i][a]&&void 0===n[e[i][a]+""]&&(c+="&"+o.buildQueryParameter(i,e[i][a],r),!0!==t&&(n[e[i][a]+""]=!0));else void 0!==e[i]&&(c+="&"+o.buildQueryParameter(i,e[i],r));return c.substring(1)},o.buildQueryParameter=function(e,t,r){return o.encodeQuery(e,r)+(null!==t?"="+o.encodeQuery(t,r):"")},o.addQuery=function(e,t,r){if("object"==typeof t)for(var n in t)s.call(t,n)&&o.addQuery(e,n,t[n]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=r);"string"==typeof e[t]&&(e[t]=[e[t]]),l(r)||(r=[r]),e[t]=(e[t]||[]).concat(r)}},o.removeQuery=function(e,t,r){var n,i,a;if(l(t))for(n=0,i=t.length;n<i;n++)e[t[n]]=void 0;else if("object"==typeof t)for(a in t)s.call(t,a)&&o.removeQuery(e,a,t[a]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string as the first parameter");void 0!==r?e[t]===r?e[t]=void 0:l(e[t])&&(e[t]=function(e,t){var r,n,i={};if(l(t))for(r=0,n=t.length;r<n;r++)i[t[r]]=!0;else i[t]=!0;for(r=0,n=e.length;r<n;r++)void 0!==i[e[r]]&&(e.splice(r,1),n--,r--);return e}(e[t],r)):e[t]=void 0}},o.hasQuery=function(e,t,r,n){if("object"==typeof t){for(var i in t)if(s.call(t,i)&&!o.hasQuery(e,i,t[i]))return!1;return!0}if("string"!=typeof t)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(c(r)){case"Undefined":return t in e;case"Boolean":return r===Boolean(l(e[t])?e[t].length:e[t]);case"Function":return!!r(e[t],t,e);case"Array":return!!l(e[t])&&(n?C:I)(e[t],r);case"RegExp":return l(e[t])?!!n&&C(e[t],r):Boolean(e[t]&&e[t].match(r));case"Number":r=String(r);case"String":return l(e[t])?!!n&&C(e[t],r):e[t]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.commonPath=function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r)){r--;break}return r<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(r)&&"/"===t.charAt(r)||(r=e.substring(0,r).lastIndexOf("/")),e.substring(0,r+1))},o.withinString=function(e,t,r){r||(r={});var n=r.start||o.findUri.start,i=r.end||o.findUri.end,a=r.trim||o.findUri.trim,s=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var u=n.exec(e);if(!u)break;var c=u.index;if(r.ignoreHtml){var l=e.slice(Math.max(c-3,0),c);if(l&&s.test(l))continue}var C=c+e.slice(c).search(i),I=e.slice(c,C).replace(a,"");if(!r.ignore||!r.ignore.test(I)){var _=t(I,c,C=c+I.length,e);e=e.slice(0,c)+_+e.slice(C),n.lastIndex=c+_.length}}return n.lastIndex=0,e},o.ensureValidHostname=function(t){if(t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(t.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(t.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=n.SecondLevelDomains.noConflict()),t}return n.URI===this&&(n.URI=i),this},a.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},a.clone=function(){return new o(this)},a.valueOf=a.toString=function(){return this.build(!1)._string},a.protocol=O("protocol"),a.username=O("username"),a.password=O("password"),a.hostname=O("hostname"),a.port=O("port"),a.query=h("query","?"),a.fragment=h("fragment","#"),a.search=function(e,t){var r=this.query(e,t);return"string"==typeof r&&r.length?"?"+r:r},a.hash=function(e,t){var r=this.fragment(e,t);return"string"==typeof r&&r.length?"#"+r:r},a.pathname=function(e,t){if(void 0===e||!0===e){var r=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(r):r}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},a.path=a.pathname,a.href=function(e,t){var r;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var n=e instanceof o,i="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[o.getDomAttribute(e)]||"",i=!1);if(!n&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!n&&!i)throw new TypeError("invalid input");var a=n?e._parts:e;for(r in a)s.call(this._parts,r)&&(this._parts[r]=a[r])}return this.build(!t),this},a.is=function(e){var t=!1,n=!1,i=!1,a=!1,s=!1,u=!1,c=!1,l=!this._parts.urn;switch(this._parts.hostname&&(l=!1,n=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),s=(a=!(t=n||i))&&r&&r.has(this._parts.hostname),u=a&&o.idn_expression.test(this._parts.hostname),c=a&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return a;case"sld":return s;case"ip":return t;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return i;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return c}return null};var A=a.protocol,m=a.port,M=a.hostname;a.protocol=function(e,t){if(void 0!==e&&e&&!(e=e.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return A.call(this,e,t)},a.scheme=a.protocol,a.port=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),e.match(/[^0-9]/))))throw new TypeError('Port "'+e+'" contains characters other than [0-9]');return m.call(this,e,t)},a.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var r={};o.parseHost(e,r),e=r.hostname}return M.call(this,e,t)},a.host=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?o.buildHost(this._parts):"":(o.parseHost(e,this._parts),this.build(!t),this)},a.authority=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?o.buildAuthority(this._parts):"":(o.parseAuthority(e,this._parts),this.build(!t),this)},a.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.username)return"";var r=o.buildUserinfo(this._parts);return r.substring(0,r.length-1)}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},a.resource=function(e,t){var r;return void 0===e?this.path()+this.search()+this.hash():(r=o.parse(e),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!t),this)},a.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,n),a=new RegExp("^"+u(i));return e&&"."!==e.charAt(e.length-1)&&(e+="."),e&&o.ensureValidHostname(e),this._parts.hostname=this._parts.hostname.replace(a,e),this.build(!t),this},a.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!e)throw new TypeError("cannot set domain empty");if(o.ensureValidHostname(e),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(u(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this.build(!t),this},a.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(n+1);return!0!==t&&r&&r.list[i.toLowerCase()]&&r.get(this._parts.hostname)||i}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},a.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?o.decodePath(n):n}var i=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,i),s=new RegExp("^"+u(a));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),this.build(!t),this},a.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?o.decodePathSegment(n):n}var i=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var a=new RegExp(u(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e),i?this.normalizePath(t):this.build(!t),this},a.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,i=this.filename(),a=i.lastIndexOf(".");return-1===a?"":(r=i.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?o.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var s,c=this.suffix();if(c)s=e?new RegExp(u(c)+"$"):new RegExp(u("."+c)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return s&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e)),this.build(!t),this},a.segment=function(e,t,r){var n=this._parts.urn?":":"/",i=this.path(),o="/"===i.substring(0,1),a=i.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(o&&a.shift(),e<0&&(e=Math.max(a.length+e,0)),void 0===t)return void 0===e?a:a[e];if(null===e||void 0===a[e])if(l(t)){a=[];for(var s=0,u=t.length;s<u;s++)(t[s].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(t[s]))}else(t||"string"==typeof t)&&(""===a[a.length-1]?a[a.length-1]=t:a.push(t));else t?a[e]=t:a.splice(e,1);return o&&a.unshift(""),this.path(a.join(n),r)},a.segmentCoded=function(e,t,r){var n,i,a;if("number"!=typeof e&&(r=t,t=e,e=void 0),void 0===t){if(l(n=this.segment(e,t,r)))for(i=0,a=n.length;i<a;i++)n[i]=o.decode(n[i]);else n=void 0!==n?o.decode(n):void 0;return n}if(l(t))for(i=0,a=t.length;i<a;i++)t[i]=o.decode(t[i]);else t="string"==typeof t||t instanceof String?o.encode(t):t;return this.segment(e,t,r)};var b=a.query;function D(e,t,r){return function(){var e=o.recodeHostname,n=o.encode,i=o.decode;o.encode=t,o.decode=r;try{this.normalize()}finally{o.recodeHostname=e,o.encode=n,o.decode=i}return this}}return a.query=function(e,t){if(!0===e)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=e.call(this,r);return this._parts.query=o.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=o.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):b.call(this,e,t)},a.setQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)n[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in e)s.call(e,i)&&(n[i]=e[i])}return this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},a.addQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(n,e,void 0===t?null:t),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},a.removeQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(n,e,t),this._parts.query=o.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},a.hasQuery=function(e,t,r){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(n,e,t,r)},a.setSearch=a.setQuery,a.addSearch=a.addQuery,a.removeSearch=a.removeQuery,a.hasSearch=a.hasQuery,a.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},a.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},a.normalizeHostname=function(e){return this._parts.hostname&&(this.is("IDN")||this.is("punycode")?this._parts.hostname=o.recodeHostname(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!e)),this},a.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},a.normalizePath=function(e){var t,r=this._parts.path;if(!r)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var n,i,a="";for("/"!==r.charAt(0)&&(t=!0,r="/"+r),r=r.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(a=r.substring(1).match(/^(\.\.\/)+/)||"")&&(a=a[0]);-1!==(n=r.indexOf("/.."));)0!==n?(-1===(i=r.substring(0,n).lastIndexOf("/"))&&(i=n),r=r.substring(0,i)+r.substring(n+3)):r=r.substring(3);return t&&this.is("relative")&&(r=a+r.substring(1)),r=o.recodePath(r),this._parts.path=r,this.build(!e),this},a.normalizePathname=a.normalizePath,a.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},a.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},a.normalizeSearch=a.normalizeQuery,a.normalizeHash=a.normalizeFragment,a.iso8859=D(o._defaultRecodeHostname,escape,decodeURIComponent),a.unicode=D(o._defaultRecodeHostname,S,unescape),a.iri=D(0,d,decodeURIComponent),a.readable=function(){var t=this.clone();t.username("").password("").normalize();var r="";if(t._parts.protocol&&(r+=t._parts.protocol+(t._parts.urn?":":"://")),t._parts.hostname&&(t.is("punycode")&&e?(r+=e.toUnicode(t._parts.hostname),t._parts.port&&(r+=":"+t._parts.port)):r+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(r+="/"),r+=t.path(!0),t._parts.query){for(var n="",i=0,a=t._parts.query.split("&"),s=a.length;i<s;i++){var u=(a[i]||"").split("=");n+="&"+o.decodeQuery(u[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==u[1]&&(n+="="+o.decodeQuery(u[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=o.decodeQuery(t.hash(),!0)},a.absoluteTo=function(e){var t,r,n,i=this.clone(),a=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof o||(e=new o(e)),i._parts.protocol||(i._parts.protocol=e._parts.protocol),this._parts.hostname)return i;for(r=0;n=a[r];r++)i._parts[n]=e._parts[n];return i._parts.path?".."===i._parts.path.substring(-2)&&(i._parts.path+="/"):(i._parts.path=e._parts.path,i._parts.query||(i._parts.query=e._parts.query)),"/"!==i.path().charAt(0)&&(t=e.directory(),i._parts.path=(t?t+"/":"")+i._parts.path,i.normalizePath()),i.build(),i},a.relativeTo=function(e){var t,r,n,i,a,s=this.clone().normalize();if(s._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new o(e).normalize(),t=s._parts,r=e._parts,i=s.path(),a=e.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==a.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===r.protocol&&(t.protocol=null),t.username!==r.username||t.password!==r.password)return s.build();if(null!==t.protocol||null!==t.username||null!==t.password)return s.build();if(t.hostname!==r.hostname||t.port!==r.port)return s.build();if(t.hostname=null,t.port=null,i===a)return t.path="",s.build();if(!(n=o.commonPath(s.path(),e.path())))return s.build();var u=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=u+t.path.substring(n.length),s.build()},a.equals=function(e){var t,r,n,i,a,u=this.clone(),c=new o(e),C={};if(u.normalize(),c.normalize(),u.toString()===c.toString())return!0;if(n=u.query(),i=c.query(),u.query(""),c.query(""),u.toString()!==c.toString())return!1;if(n.length!==i.length)return!1;for(a in t=o.parseQuery(n,this._parts.escapeQuerySpace),r=o.parseQuery(i,this._parts.escapeQuerySpace),t)if(s.call(t,a)){if(l(t[a])){if(!I(t[a],r[a]))return!1}else if(t[a]!==r[a])return!1;C[a]=!0}for(a in r)if(s.call(r,a)&&!C[a])return!1;return!0},a.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},a.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},o}),function(){"use strict";var e,t,r,n,i,o="<%= pkg.version %>",a="<%= pkg.name %>",s="<%= pkg.description %>",u={},c="LMS.LaunchData",l="Normal",C="cmi5LearnerPreferences",I=new TinCan.Activity({id:"https://w3id.org/xapi/cmi5/context/categories/cmi5"}),_=new TinCan.Activity({id:"https://w3id.org/xapi/cmi5/context/categories/moveon"}),S=new TinCan.Activity({id:"http://id.tincanapi.com/activity/software/"+a+"/"+o,definition:{name:{"en-US":a+" ("+o+")"},description:{"en-US":s},type:"http://id.tincanapi.com/activitytype/source"}}),T="https://w3id.org/xapi/cmi5/context/extensions/masteryscore",d="http://adlnet.gov/expapi/verbs/initialized",g="http://adlnet.gov/expapi/verbs/terminated",R="http://adlnet.gov/expapi/verbs/completed",f="http://adlnet.gov/expapi/verbs/passed",E="http://adlnet.gov/expapi/verbs/failed",p={},O=["endpoint","fetch","actor","activityId","registration"];i=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},p[d]={_template:"initialized"},p[g]={_template:"terminated"},p["http://adlnet.gov/expapi/verbs/answered"]={_template:"answered"},p["http://adlnet.gov/expapi/verbs/experienced"]={_template:"experienced"},p["http://adlnet.gov/expapi/verbs/attempted"]={_template:"attempted"},p["http://adlnet.gov/expapi/verbs/completed"]={_template:"completed"},p[f]={_template:"passed"},p[E]={_template:"failed"},u.hasCORS=!1,u.useXDR=!1,"undefined"!=typeof XMLHttpRequest&&void 0!==(new XMLHttpRequest).withCredentials?u.hasCORS=!0:"undefined"!=typeof XDomainRequest&&(u.hasCORS=!0,u.useXDR=!0),(Cmi5=function(e){var t,r;if(this.log("constructor",e),void 0!==e){for(t=new URI(e).search(!0),r=0;r<O.length;r+=1)if(void 0===t[O[r]]||""===t[O[r]])throw new Error("Invalid launch string missing or empty parameter: "+O[r]);this.setFetch(t.fetch),this.setLRS(t.endpoint),this.setActor(t.actor),this.setActivity(t.activityId),this.setRegistration(t.registration)}}).VERSION=o,Cmi5.DEBUG=!1,Cmi5.prototype={_fetch:null,_endpoint:null,_actor:null,_registration:null,_activity:null,_lrs:null,_fetchRequest:null,_fetchContent:null,_lmsLaunchData:null,_contextTemplate:null,_learnerPrefs:null,_isActive:!1,_initialized:null,_passed:null,_failed:null,_completed:null,_terminated:null,_durationStart:null,_progress:null,_includeSourceActivity:!0,start:function(e,t){this.log("start");var r=this;t=t||{},r.postFetch(function(n){var i="Failed to start AU - ";void 0!==t.postFetch&&t.postFetch.apply(this,arguments),null===n?r.loadLMSLaunchData(function(n){void 0!==t.launchData&&t.launchData.apply(this,arguments),null===n?r.loadLearnerPrefs(function(n){void 0!==t.learnerPrefs&&t.learnerPrefs.apply(this,arguments),null===n?r.initialize(function(r){void 0!==t.initializeStatement&&t.initializeStatement.apply(this,arguments),e(null===r?null:new Error(i+" send initialized statement: "+r))}):e(new Error(i+" load learner preferences: "+n))}):e(new Error(i+" load LMS LaunchData: "+n))}):e(new Error(i+" POST to fetch: "+n))})},postFetch:function(e){this.log("postFetch");var t,r=this;if(null!==this._fetch)return e&&(t=function(t,n){r.log("postFetch::cbWrapper"),r.log("postFetch::cbWrapper",t),r.log("postFetch::cbWrapper",n);var i,o,a=n.responseText;if(null===t){try{i=JSON.parse(a)}catch(t){return r.log("postFetch::cbWrapper - failed to parse JSON response: "+t),void e(new Error("Post fetch response malformed: failed to parse JSON response ("+t+")"),n)}if(null===i||"object"!=typeof i||void 0===i["auth-token"])return r.log("postFetch::cbWrapper - failed to access 'auth-token' property"),void e(new Error("Post fetch response malformed: failed to access 'auth-token' in ("+a+")"),n,i);r._fetchContent=i,r._lrs.auth="Basic "+i["auth-token"],e(t,n,i)}else{if(0===t)t="Aborted, offline, or invalid CORS endpoint";else if(/^\d+$/.test(t))if(void 0!==n.getResponseHeader?o=n.getResponseHeader("Content-Type"):void 0!==n.contentType&&(o=n.contentType),TinCan.Utils.isApplicationJSON(o))try{t=void 0!==(i=JSON.parse(a))["error-text"]?i["error-text"]+" ("+i["error-code"]+")":"Failed to detect 'error-text' property in JSON error response"}catch(e){t="Failed to parse JSON error response: "+e}else t=n.responseText;else t=n.responseText;e(new Error(t),n,i)}}),this._fetchRequest(this._fetch,{method:"POST"},t);e(new Error("Can't POST to fetch URL without setFetch"))},loadLMSLaunchData:function(e){this.log("loadLMSLaunchData");var t=this;null!==this._fetchContent?this._lrs.retrieveState(c,{activity:this._activity,agent:this._actor,registration:this._registration,callback:function(r,n){null===r?null!==n?(t._lmsLaunchData=n.contents,t._contextTemplate=JSON.stringify(t._lmsLaunchData.contextTemplate),e(null,n)):e(new Error(c+" State not found"),n):e(new Error("Failed to retrieve "+c+" State: "+r),n)}}):e(new Error("Can't retrieve LMS Launch Data without successful postFetch"))},loadLearnerPrefs:function(e){this.log("loadLearnerPrefs");var t=this;null!==this._lmsLaunchData?this._lrs.retrieveAgentProfile(C,{agent:this._actor,callback:function(r,n){null===r?(t._learnerPrefs=null!==n?n:new TinCan.AgentProfile({id:C,contentType:"application/json",contents:{}}),e(null,n)):e(new Error("Failed to retrieve "+C+" Agent Profile"+r),n)}}):e(new Error("Can't retrieve Learner Preferences without successful loadLMSLaunchData"))},saveLearnerPrefs:function(e){this.log("saveLearnerPrefs");var t,r,n=this;return null===this._learnerPrefs?(t=new Error("Can't save Learner Preferences without first loading them"),e?void e(t):t):(e&&(r=function(t,r){n.log("saveLearnerPrefs - saveAgentProfile callback",t,r),null===t?(n._learnerPrefs.etag=TinCan.Utils.getSHA1String("object"==typeof n._learnerPrefs.contents&&TinCan.Utils.isApplicationJSON(n._learnerPrefs.contentType)?JSON.stringify(n._learnerPrefs.contents):n._learnerPrefs.contents),e(null,r)):e(new Error("Failed to save "+C+" Agent Profile: "+t),r)}),t=this._lrs.saveAgentProfile(C,this._learnerPrefs.contents,{agent:this._actor,lastSHA1:this._learnerPrefs.etag,contentType:this._learnerPrefs.contentType,callback:r}),r?void 0:null!==t.err?new Error("Failed to save "+C+" Agent Profile: "+t.err):void(n._learnerPrefs.etag=TinCan.Utils.getSHA1String("object"==typeof n._learnerPrefs.contents&&TinCan.Utils.isApplicationJSON(n._learnerPrefs.contentType)?JSON.stringify(n._learnerPrefs.contents):n._learnerPrefs.contents)))},initialize:function(e){var t,r,n,i;if(this.log("initialize"),null===this._learnerPrefs){if(r=new Error("Can't send initialized statement without successful loadLearnerPrefs"),e)return void e(r);throw r}if(this._initialized){if(this.log("initialize - already initialized"),r=new Error("AU already initialized"),e)return void e(r);throw r}return t=this.initializedStatement(),e&&(n=function(t){this.log("initialize - callbackWrapper: "+t),null===t&&(this._initialized=!0,this._isActive=!0,this._durationStart=(new Date).getTime()),e.apply(this,arguments)}.bind(this)),i=this.sendStatement(t,n),this.log("initialize - result: ",i),e||null!==i.response.err||(this._initialized=!0,this._isActive=!0,this._durationStart=(new Date).getTime()),i},terminate:function(e){var t,r,n,i;if(this.log("terminate"),!this._initialized){if(this.log("terminate - not initialized"),r=new Error("AU not initialized"),e)return void e(r);throw r}if(this._terminated){if(this.log("terminate - already terminated"),r=new Error("AU already terminated"),e)return void e(r);throw r}return t=this.terminatedStatement(),e&&(n=function(t){this.log("terminate - callbackWrapper: "+t),null===t&&(this._terminated=!0,this._isActive=!1),e.apply(this,arguments)}.bind(this)),i=this.sendStatement(t,n),this.log("terminate - result: ",i),e||null!==i.response.err||(this._terminated=!0,this._isActive=!1),i},completed:function(e){var t,r,n,i;if(this.log("completed"),!this.isActive()){if(this.log("completed - not active"),r=new Error("AU not active"),e)return void e(r);throw r}if(this.getLaunchMode()!==l){if(this.log("completed - non-Normal launch mode: ",this.getLaunchMode()),r=new Error("AU not in Normal launch mode"),e)return void e(r);throw r}if(this._completed){if(this.log("completed - already completed"),r=new Error("AU already completed"),e)return void e(r);throw r}return t=this.completedStatement(),e&&(n=function(t){this.log("completed - callbackWrapper: "+t),null===t&&(this.setProgress(null),this._completed=!0),e.apply(this,arguments)}.bind(this)),i=this.sendStatement(t,n),this.log("completed - result: ",i),e||null!==i.response.err||(this.setProgress(null),this._completed=!0),i},passed:function(e,t){var r,n,i,o;if(this.log("passed"),!this.isActive()){if(this.log("passed - not active"),n=new Error("AU not active"),t)return void t(n);throw n}if(this.getLaunchMode()!==l){if(this.log("passed - non-Normal launch mode: ",this.getLaunchMode()),n=new Error("AU not in Normal launch mode"),t)return void t(n);throw n}if(null!==this._passed){if(this.log("passed - already passed"),n=new Error("AU already passed"),t)return void t(n);throw n}try{r=this.passedStatement(e)}catch(e){if(this.log("passed - failed to create passed statement: "+e),t)return void t("Failed to create passed statement - "+e);throw e}return t&&(i=function(e){this.log("passed - callbackWrapper: "+e),null===e&&(this._passed=!0),t.apply(this,arguments)}.bind(this)),o=this.sendStatement(r,i),this.log("passed - result: ",o),t||null!==o.response.err||(this._passed=!0),o},failed:function(e,t){var r,n,i,o;if(this.log("failed"),!this.isActive()){if(this.log("failed - not active"),n=new Error("AU not active"),t)return void t(n);throw n}if(this.getLaunchMode()!==l){if(this.log("failed - non-Normal launch mode: ",this.getLaunchMode()),n=new Error("AU not in Normal launch mode"),t)return void t(n);throw n}if(null!==this._failed||null!==this._passed){if(this.log("failed - already passed/failed"),n=new Error("AU already passed/failed"),t)return void t(n);throw n}try{r=this.failedStatement(e)}catch(e){if(this.log("failed - failed to create failed statement: "+e),t)return void t("Failed to create failed statement - "+e);throw e}return t&&(i=function(e){this.log("failed - callbackWrapper: "+e),null===e&&(this._failed=!0),t.apply(this,arguments)}.bind(this)),o=this.sendStatement(r,i),this.log("failed - result: ",o),t||null!==o.response.err||(this._failed=!0),o},isActive:function(){return this.log("isActive"),this._isActive},log:function(){Cmi5.DEBUG&&"undefined"!=typeof console&&console.log&&(arguments[0]="cmi5.js:"+arguments[0],console.log.apply(console,arguments))},includeSourceActivity:function(e){this._includeSourceActivity=!!e},getLaunchMethod:function(){if(this.log("getLaunchMethod"),null===this._lmsLaunchData)throw new Error("Can't determine launchMethod until LMS LaunchData has been loaded");return this._lmsLaunchData.launchMethod},getLaunchMode:function(){if(this.log("getLaunchMode"),null===this._lmsLaunchData)throw new Error("Can't determine launchMode until LMS LaunchData has been loaded");return this._lmsLaunchData.launchMode},getLaunchParameters:function(){this.log("getLaunchParameters");var e=null;if(null===this._lmsLaunchData)throw new Error("Can't determine LaunchParameters until LMS LaunchData has been loaded");return void 0!==this._lmsLaunchData.launchParameters&&(e=this._lmsLaunchData.launchParameters),e},getSessionId:function(){if(this.log("getSessionId"),null===this._lmsLaunchData)throw new Error("Can't determine session id until LMS LaunchData has been loaded");return this._lmsLaunchData.contextTemplate.extensions["https://w3id.org/xapi/cmi5/context/extensions/sessionid"]},getMoveOn:function(){if(this.log("getMoveOn"),null===this._lmsLaunchData)throw new Error("Can't determine moveOn until LMS LaunchData has been loaded");return this._lmsLaunchData.moveOn},getMasteryScore:function(){this.log("getMasteryScore");var e=null;if(null===this._lmsLaunchData)throw new Error("Can't determine masteryScore until LMS LaunchData has been loaded");return void 0!==this._lmsLaunchData.masteryScore&&(e=this._lmsLaunchData.masteryScore),e},getReturnURL:function(){this.log("getReturnURL");var e=null;if(null===this._lmsLaunchData)throw new Error("Can't determine returnURL until LMS LaunchData has been loaded");return void 0!==this._lmsLaunchData.returnURL&&(e=this._lmsLaunchData.returnURL),e},getEntitlementKey:function(){this.log("getEntitlementKey");var e=null;if(null===this._lmsLaunchData)throw new Error("Can't determine entitlementKey until LMS LaunchData has been loaded");return void 0!==this._lmsLaunchData.entitlementKey&&(void 0!==this._lmsLaunchData.entitlementKey.alternate?e=this._lmsLaunchData.entitlementKey.alternate:void 0!==this._lmsLaunchData.entitlementKey.courseStructure&&(e=this._lmsLaunchData.entitlementKey.courseStructure)),e},getLanguagePreference:function(){this.log("getLanguagePreference");var e=null;if(null===this._learnerPrefs)throw new Error("Can't determine language preference until learner preferences have been loaded");return void 0!==this._learnerPrefs.contents.languagePreference&&(e=this._learnerPrefs.contents.languagePreference),e},setLanguagePreference:function(e){if(this.log("setLanguagePreference"),null===this._learnerPrefs)throw new Error("Can't set language preference until learner preferences have been loaded");""===e&&(e=null),this._learnerPrefs.contents.languagePreference=e},getAudioPreference:function(){this.log("getAudioPreference");var e=null;if(null===this._learnerPrefs)throw new Error("Can't determine audio preference until learner preferences have been loaded");return void 0!==this._learnerPrefs.contents.audioPreference&&(e=this._learnerPrefs.contents.audioPreference),e},setAudioPreference:function(e){if(this.log("setAudioPreference"),null===this._learnerPrefs)throw new Error("Can't set audio preference until learner preferences have been loaded");if("on"!==e&&"off"!==e&&null!==e)throw new Error("Unrecognized value for audio preference: "+e);this._learnerPrefs.contents.audioPreference=e},getDuration:function(){return this.log("getDuration"),(new Date).getTime()-this._durationStart},setProgress:function(e){if(this.log("setProgress: ",e),null!==e){if(!i(e))throw new Error("Invalid progress measure (not an integer): "+e);if(e<0||e>100)throw new Error("Invalid progress measure must be greater than or equal to 0 and less than or equal to 100: "+e)}this._progress=e},getProgress:function(){return this.log("getProgress"),this._progress},setFetch:function(r){var n,i,o;if(this.log("setFetch: ",r),this._fetch=r,this._fetchRequest=e,null===(n=r.toLowerCase().match(/([A-Za-z]+:)\/\/([^:\/]+):?(\d+)?(\/.*)?$/)))throw new Error("URL invalid: failed to divide URL parts");if(o=location.port,i=location.protocol.toLowerCase()===n[1],""===o&&(o="http:"===location.protocol.toLowerCase()?"80":"https:"===location.protocol.toLowerCase()?"443":""),!i||location.hostname.toLowerCase()!==n[2]||o!==(null!==n[3]&&void 0!==n[3]&&""!==n[3]?n[3]:"http:"===n[1]?"80":"https:"===n[1]?"443":"")){if(!u.hasCORS)throw this.log("[error] URL invalid: cross domain requests not supported in this browser"),new Error("URL invalid: cross domain requests not supported in this browser");if(u.useXDR&&i)this._fetchRequest=t;else if(u.useXDR&&!i)throw this.log("[error] URL invalid: cross domain request for differing scheme in IE with XDR"),new Error("URL invalid: cross domain request for differing scheme in IE with XDR")}},getFetch:function(){return this._fetch},setLRS:function(e,t){this.log("setLRS: ",e,t),null!==this._lrs?((void 0===t&&null===e||null!==e)&&(this._endpoint=this._lrs.endpoint=e),null!=t&&(this._lrs.auth=t)):this._lrs=new TinCan.LRS({endpoint:e,auth:t,allowFail:!1})},getLRS:function(){return this._lrs},setActor:function(e){if(e instanceof TinCan.Agent||(e=TinCan.Agent.fromJSON(e)),!(null!==e.account&&e.account instanceof TinCan.AgentAccount))throw new Error("Invalid actor: missing or invalid account");if(null===e.account.name)throw new Error("Invalid actor: name is null");if(""===e.account.name)throw new Error("Invalid actor: name is empty");if(null===e.account.homePage)throw new Error("Invalid actor: homePage is null");if(""===e.account.homePage)throw new Error("Invalid actor: homePage is empty");this._actor=e},getActor:function(){return this._actor},setActivity:function(e){if(e instanceof TinCan.Activity||(e=new TinCan.Activity({id:e})),null===e.id)throw new Error("Invalid activity: id is null");if(""===e.id)throw new Error("Invalid activity: id is empty");this._activity=e},getActivity:function(){return this._activity},setRegistration:function(e){if(null===e)throw new Error("Invalid registration: null");if(""===e)throw new Error("Invalid registration: empty");this._registration=e},getRegistration:function(){return this._registration},validateScore:function(e){if(null==e)throw new Error("cannot validate score (score not provided): "+e);if(void 0!==e.min&&!i(e.min))throw new Error("score.min is not an integer");if(void 0!==e.max&&!i(e.max))throw new Error("score.max is not an integer");if(void 0!==e.scaled){if(!/^(\-|\+)?[01]+(\.[0-9]+)?$/.test(e.scaled))throw new Error("scaled score not a recognized number: "+e.scaled);if(e.scaled<0)throw new Error("scaled score must be greater than or equal to 0");if(e.scaled>1)throw new Error("scaled score must be less than or equal to 1")}if(void 0!==e.raw){if(!i(e.raw))throw new Error("score.raw is not an integer");if(void 0===e.min)throw new Error("minimum score must be provided when including a raw score");if(void 0===e.max)throw new Error("maximum score must be provided when including a raw score");if(e.raw<e.min)throw new Error("raw score must be greater than or equal to minimum score");if(e.raw>e.max)throw new Error("raw score must be less than or equal to maximum score")}return!0},_getLanguageTag:function(){return TCAPI_GetLanguageTag()},_updateVerbDisplayLanguage:function(e,t){return CMI5_UpdateVerbDisplayLanguage(e,t)},prepareStatement:function(e){var t={actor:this._actor,verb:{id:e},target:this._activity,context:this._prepareContext()},r=this.getProgress(),n=this._getLanguageTag();return void 0!==p[e]&&(t.verb.display=this._updateVerbDisplayLanguage(p[e],n)),e!==R&&null!==r&&(t.result={extensions:{"https://w3id.org/xapi/cmi5/result/extensions/progress":r}}),new TinCan.Statement(t)},sendStatement:function(e,t){var r,n;if(t&&(r=function(r,n){null===r?t(r,n,e):t(new Error(r),n)}),n=this._lrs.saveStatement(e,{callback:r}),!t)return{response:n,statement:e}},initializedStatement:function(){return this.log("initializedStatement"),this._prepareStatement(d)},terminatedStatement:function(){this.log("terminatedStatement");var e=this._prepareStatement(g);return e.result=e.result||new TinCan.Result,e.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration()),e},passedStatement:function(e){this.log("passedStatement");var t,r=this._prepareStatement(f);if(r.result=r.result||new TinCan.Result,r.result.success=!0,r.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration()),e){try{this.validateScore(e)}catch(e){throw new Error("Invalid score - "+e)}if(null!==(t=this.getMasteryScore())&&void 0!==e.scaled){if(e.scaled<t)throw new Error("Invalid score - scaled score does not meet or exceed mastery score ("+e.scaled+" < "+t+")");r.context.extensions=r.context.extensions||{},r.context.extensions[T]=t}r.result.score=new TinCan.Score(e)}return r.context.contextActivities.category.push(_),r},failedStatement:function(e){this.log("failedStatement");var t,r=this._prepareStatement(E);if(r.result=r.result||new TinCan.Result,r.result.success=!1,r.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration()),e){try{this.validateScore(e)}catch(e){throw new Error("Invalid score - "+e)}if(null!==(t=this.getMasteryScore())&&void 0!==e.scaled){if(e.scaled>=t)throw new Error("Invalid score - scaled score exceeds mastery score ("+e.scaled+" >= "+t+")");r.context.extensions=r.context.extensions||{},r.context.extensions[T]=t}r.result.score=new TinCan.Score(e)}return r.context.contextActivities.category.push(_),r},completedStatement:function(){this.log("completedStatement");var e=this._prepareStatement(R);return e.result=e.result||new TinCan.Result,e.result.completion=!0,e.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration()),e.context.contextActivities.category.push(_),e},_prepareContext:function(){var e=JSON.parse(this._contextTemplate);return e.registration=this._registration,this._includeSourceActivity&&(e.contextActivities=e.contextActivities||new TinCan.ContextActivities,e.contextActivities.other=e.contextActivities.other||[],e.contextActivities.other.push(S)),e},_prepareStatement:function(e){var t=this.prepareStatement(e);return t.context.contextActivities=t.context.contextActivities||new TinCan.ContextActivities,t.context.contextActivities.category=t.context.contextActivities.category||[],t.context.contextActivities.category.push(I),t}},Cmi5.enableDebug=function(e){Cmi5.DEBUG=!0,e&&TinCan.enableDebug()},Cmi5.disableDebug=function(e){Cmi5.DEBUG=!1,e&&TinCan.disableDebug()},r=function(e,t,r,n){var i,o,a;return this.log("requestComplete: "+r.finished+", xhr.status: "+e.status),a=void 0===e.status?r.fakeStatus:1223===e.status?204:e.status,r.finished?i:(r.finished=!0,o=t.ignore404&&404===a,a>=200&&a<400||o?n?void n(null,e):i={err:null,xhr:e}:(i={err:a,xhr:e},0===a?this.log("[warning] There was a problem communicating with the server. Aborted, offline, or invalid CORS endpoint ("+a+")"):this.log("[warning] There was a problem communicating with the server. ("+a+" | "+e.responseText+")"),n&&n(a,e),i))},e=function(e,t,n){this.log("sendRequest using XMLHttpRequest");var i,o,a,s,u=this,c=[],l={finished:!1,fakeStatus:null},C=e;for(o in this.log("sendRequest using XMLHttpRequest - async: "+s),(t=t||{}).params=t.params||{},t.headers=t.headers||{},s=void 0!==n,t.params)t.params.hasOwnProperty(o)&&c.push(o+"="+encodeURIComponent(t.params[o]));for(o in c.length>0&&(C+="?"+c.join("&")),(i=new XMLHttpRequest).open(t.method,C,s),t.headers)t.headers.hasOwnProperty(o)&&i.setRequestHeader(o,t.headers[o]);void 0!==t.data&&(t.data+=""),a=t.data,s&&(i.onreadystatechange=function(){u.log("xhr.onreadystatechange - xhr.readyState: "+i.readyState),4===i.readyState&&r.call(u,i,t,l,n)});try{i.send(a)}catch(e){this.log("sendRequest caught send exception: "+e)}if(!s)return r.call(this,i,t,l)},t=function(e,t,i){this.log("sendRequest using XDomainRequest");var o,a,s,u,c=this,l=[],C={finished:!1,fakeStatus:null};if((t=t||{}).params=t.params||{},t.headers=t.headers||{},void 0!==t.headers["Content-Type"]&&"application/json"!==t.headers["Content-Type"])return u=new Error("Unsupported content type for IE Mode request"),i?(i(u,null),null):{err:u,xhr:null};for(a in t.params)t.params.hasOwnProperty(a)&&l.push(a+"="+encodeURIComponent(t.params[a]));l.length>0&&(e+="?"+l.join("&")),(o=new XDomainRequest).open("POST",e),i?(o.onload=function(){C.fakeStatus=200,r.call(c,o,t,C,i)},o.onerror=function(){C.fakeStatus=400,r.call(c,o,t,C,i)},o.ontimeout=function(){C.fakeStatus=0,r.call(c,o,t,C,i)}):(o.onload=function(){C.fakeStatus=200},o.onerror=function(){C.fakeStatus=400},o.ontimeout=function(){C.fakeStatus=0}),o.onprogress=function(){},o.timeout=0;try{o.send(undefined)}catch(e){this.log("sendRequest caught send exception: "+e)}if(!i){for(s=1e4+Date.now(),this.log("sendRequest - until: "+s+", finished: "+C.finished);Date.now()<s&&null===C.fakeStatus;)n();return r.call(c,o,t,C)}},n=function(){var e=new XMLHttpRequest,t=window.location+"?forcenocache="+TinCan.Utils.getUUID();e.open("GET",t,!1),e.send(null)}}();var intTCAPIError,strTCAPIErrorString,strTCAPIErrorDiagnostic,tincan,tcapi_cache,TCAPI_STATUS="",TCAPI_STATUS_CHANGED=!1,TCAPI_SCORE={},TCAPI_COMPLETION_STATUS="",TCAPI_SATISFACTION_STATUS=null,TCAPI_UPDATES_PENDING=!1,TCAPI_IN_PROGRESS=!1,TCAPI_NO_ERROR="",TCAPI_VERB_COMPLETED="completed",TCAPI_VERB_EXPERIENCED="experienced",TCAPI_VERB_ATTEMPTED="attempted",TCAPI_VERB_ANSWERED="answered",TCAPI_VERB_PASSED="passed",TCAPI_VERB_FAILED="failed",TCAPI_VERB_PROGRESSED="progressed",TCAPI_VERB_PROGRESSED_ID="http://adlnet.gov/expapi/verbs/progressed",TCAPI_PROGRESS_EXTENSION="https://w3id.org/xapi/cmi5/result/extensions/progress",TCAPI_INIT_VERB=TCAPI_VERB_ATTEMPTED,TCAPI_COURSE_ACTIVITY_TYPE="http://adlnet.gov/expapi/activities/course",TCAPI_INTERACTION="http://adlnet.gov/expapi/activities/cmi.interaction",TCAPI_INTERACTION_TYPE_TRUE_FALSE="true-false",TCAPI_INTERACTION_TYPE_CHOICE="choice",TCAPI_INTERACTION_TYPE_FILL_IN="fill-in",TCAPI_INTERACTION_TYPE_MATCHING="matching",TCAPI_INTERACTION_TYPE_PERFORMANCE="performance",TCAPI_INTERACTION_TYPE_SEQUENCING="sequencing",TCAPI_INTERACTION_TYPE_LIKERT="likert",TCAPI_INTERACTION_TYPE_NUMERIC="numeric",TCAPI_STATE_BOOKMARK="bookmark",TCAPI_STATE_TOTAL_TIME="cumulative_time",TCAPI_STATE_SUSPEND_DATA="suspend_data",TCAPI_STATE_LANGUAGE_PREFERENCE="language_preference",TCAPI_STATE_AUDIO_PREFERENCE="audio_preference",TCAPI_STATE_SPEED_PREFERENCE="speed_preference",TCAPI_STATE_TEXT_PREFERENCE="text_preference",TCAPI_CONN_ERROR=998,TCAPI_DEP_ERROR=999,TCAPI_ERROR_INVALID_PREFERENCE=0,TCAPI_ERROR_INVALID_TIMESPAN=1,TCAPI_FUNC_NOOP=function(){};function _TCAPI_HandleRequestErrorResult(e,t){var r,n,i=t;null!==e.err?(/^\d+$/.test(e.err)?0===e.err?(r=TCAPI_CONN_ERROR,n="Aborted, offline, or invalid CORS endpoint"):(r=e.err,n=e.xhr.responseText):(r=TCAPI_DEP_ERROR,n=e.err),TCAPI_SetErrorInfoManually(r,i,n)):WriteToDebug("Unexpected result object, `result.err` null?")}function TCAPI_GetLaunchUrl(){return WriteToDebug("In TCAPI_GetLaunchUrl"),location.href}function TCAPI_Initialize(){WriteToDebug("In TCAPI_Initialize"),tcapi_cache={totalPrevDuration:null,statementQueue:[]},TinCan.prototype.log=TinCan.LRS.prototype.log=function(e,t){WriteToDebug("TinCan."+(t=t||this.LOG_SRC||"TinCan")+": "+e)};var e=TCAPI_GetLaunchUrl(),t=TCAPI_GetActivityIdForStatements(e);try{tincan=new TinCan({url:e,recordStores:TC_RECORD_STORES,activity:{id:t,definition:{type:TCAPI_COURSE_ACTIVITY_TYPE,name:TC_COURSE_NAME,description:TC_COURSE_DESC}}})}catch(e){return void WriteToDebug("TCAPI_Initialize - TinCan construction failed: "+JSON.stringify(e))}if(0!==tincan.recordStores.length){WriteToDebug("TCAPI_Initialize - fetching cumulative time from state: "+TCAPI_STATE_TOTAL_TIME),tincan.getState(TCAPI_STATE_TOTAL_TIME,{callback:function(e,t){WriteToDebug("TCAPI_Initialize - getState callback"),null===e?(WriteToDebug("TCAPI_Initialize - getState callback - state: "+t),null!==t&&null!==t.contents&&t.contents.match(/^\d+$/)?tcapi_cache.totalPrevDuration=Number(t.contents):tcapi_cache.totalPrevDuration=0):WriteToDebug("TCAPI_Initialize - getState callback: "+e.responseText+" ("+e.status+")")}}),TCAPI_STATUS=TCAPI_INIT_VERB,TCAPI_IN_PROGRESS=!0,WriteToDebug("TCAPI_Initialize - record initial launch statement");var r=TCAPI_GetLanguageTag(),n={id:"http://adlnet.gov/expapi/verbs/attempted",display:{}};return n.display[r]="attempted",tincan.sendStatement({verb:n,inProgress:TCAPI_IN_PROGRESS},function(e,t){null===e[0].err?WriteToDebug("TCAPI_Initialize - record initial launch statement success: "+t.id):WriteToDebug("TCAPI_Initialize - record initial launch statement - err: "+e[0].err.responseText+" ("+e[0].err.status+")")}),InitializeExecuted(!0,""),!0}WriteToDebug("TCAPI_Initialize - resulted in no LRS: DATA CANNOT BE STORED")}function _TCAPI_SetStateSafe(e,t){var r;try{r=tincan.setState(e,t)}catch(e){WriteToDebug("In _TCAPI_SetStateSafe - caught exception from setState: "+e.message)}return!r||null===r.err||(_TCAPI_HandleRequestErrorResult(r,"Failed to save state ("+e+")"),!1)}function TCAPI_GetStudentID(){return WriteToDebug("In TCAPI_GetStudentID"),null!==tincan.actor.mbox?tincan.actor.mbox:null!==tincan.actor.mbox_sha1sum?tincan.actor.mbox_sha1sum:null!==tincan.actor.openid?tincan.actor.openid:null!==tincan.actor.account?tincan.actor.account.name:null}function TCAPI_GetStudentName(){return WriteToDebug("In TCAPI_GetStudentName"),null!==tincan.actor?tincan.actor.toString():""}function TCAPI_GetBookmark(){WriteToDebug("In TCAPI_GetBookmark");var e="",t=tincan.getState(TCAPI_STATE_BOOKMARK);return null!==t.state&&(e=t.state.contents),e}function TCAPI_SetBookmark(e,t){if(WriteToDebug("In TCAPI_SetBookmark - value: "+e+", name: "+t),TCAPI_ClearErrorInfo(),!_TCAPI_SetStateSafe(TCAPI_STATE_BOOKMARK,e))return!1;WriteToDebug("In TCAPI_SetBookmark - sending statement: "+e);var r=TCAPI_GetLanguageTag(),n={id:"http://adlnet.gov/expapi/verbs/experienced",display:{}};n.display[r]="experienced";var i={name:{}};return i.name[r]=void 0!==t&&""!==t?t:e,tincan.sendStatement({verb:n,object:{id:tincan.activity.id+"/"+e,definition:i},context:{contextActivities:{parent:tincan.activity}}},function(t,r){null===t[0].err?WriteToDebug("TCAPI_SetBookmark - sending statement success: "+e+" - id: "+r.id):WriteToDebug("TCAPI_SetBookmark - sending statement: "+e+" - err: "+t[0].err.responseText+" ("+t[0].err.status+")")}),!0}function TCAPI_GetDataChunk(){WriteToDebug("In TCAPI_GetDataChunk");var e="",t=tincan.getState(TCAPI_STATE_SUSPEND_DATA);return null!==t.state&&(e=t.state.contents),e}function TCAPI_SetDataChunk(e){return WriteToDebug("In TCAPI_SetDataChunk"),TCAPI_ClearErrorInfo(),_TCAPI_SetStateSafe(TCAPI_STATE_SUSPEND_DATA,e)}function TCAPI_CommitData(){WriteToDebug("In TCAPI_CommitData - TCAPI_STATUS:"+TCAPI_STATUS),WriteToDebug("In TCAPI_CommitData - TCAPI_UPDATES_PENDING: "+TCAPI_UPDATES_PENDING);var e,t,r,n=!1;if(TCAPI_ClearErrorInfo(),TCAPI_UPDATES_PENDING){var i=TCAPI_GetLanguageTag(),o={id:"",display:{}};TCAPI_STATUS===TCAPI_VERB_COMPLETED?(o.id="http://adlnet.gov/expapi/verbs/completed",o.display[i]="completed"):TCAPI_STATUS===TCAPI_VERB_PASSED?(o.id="http://adlnet.gov/expapi/verbs/passed",o.display[i]="passed"):TCAPI_STATUS===TCAPI_VERB_FAILED?(o.id="http://adlnet.gov/expapi/verbs/failed",o.display[i]="failed"):(o.id="http://adlnet.gov/expapi/verbs/attempted",o.display[i]="attempted"),e={verb:o,inProgress:TCAPI_IN_PROGRESS,result:{}},""===TCAPI_COMPLETION_STATUS&&TCAPI_IN_PROGRESS||(e.result.duration=ConvertMilliSecondsIntoSCORM2004Time(GetSessionAccumulatedTime()+TCAPI_GetPreviouslyAccumulatedTime())),""!==TCAPI_COMPLETION_STATUS&&(e.result.completion=!0),null!==TCAPI_SATISFACTION_STATUS&&(e.result.success=TCAPI_SATISFACTION_STATUS),void 0!==TCAPI_SCORE.raw&&(e.result.score=TCAPI_SCORE),tcapi_cache.statementQueue.push(e),n=!0,TCAPI_UPDATES_PENDING=!1}if(tcapi_cache.statementQueue.length>0){if(void 0!==(t=tincan.sendStatements(tcapi_cache.statementQueue)).results&&t.results.length>0&&null!==(r=t.results[0]).err)return _TCAPI_HandleRequestErrorResult(r,"Failed to commit data: statements"),n&&(tcapi_cache.statementQueue.pop(),TCAPI_UPDATES_PENDING=!0),!1;tcapi_cache.statementQueue=[]}return!0}function TCAPI_Finish(e,t){return WriteToDebug("In TCAPI_Finish - exitType: "+e),TCAPI_ClearErrorInfo(),e===EXIT_TYPE_SUSPEND&&(_TCAPI_SetStateSafe(TCAPI_STATE_TOTAL_TIME,TCAPI_GetPreviouslyAccumulatedTime()+GetSessionAccumulatedTime()),TCAPI_SetSuspended()),TCAPI_CommitData(),!0}function TCAPI_GetAudioPlayPreference(){WriteToDebug("In TCAPI_GetAudioPlayPreference");var e,t=0;return TCAPI_ClearErrorInfo(),null!==(e=tincan.getState(TCAPI_STATE_AUDIO_PREFERENCE)).state&&(t=e.state.contents),WriteToDebug("intTempPreference="+(t=parseInt(t,10))),t>0?(WriteToDebug("Returning On"),PREFERENCE_ON):0==t?(WriteToDebug("Returning Default"),PREFERENCE_DEFAULT):t<0?(WriteToDebug("returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+t),null)}function TCAPI_GetAudioVolumePreference(){WriteToDebug("In TCAPI_GetAudioVollumePreference");var e,t=100;return TCAPI_ClearErrorInfo(),null!==(e=tincan.getState(TCAPI_STATE_AUDIO_PREFERENCE)).state&&(t=e.state.contents),WriteToDebug("intTempPreference="+t),(t=parseInt(t,10))<=0&&(WriteToDebug("Setting to 100"),t=100),t>100?(WriteToDebug("ERROR: invalid preference"),TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+t),null):(WriteToDebug("Returning "+t),t)}function TCAPI_SetAudioPreference(e,t){return WriteToDebug("In TCAPI_SetAudioPreference PlayPreference="+e+", intPercentOfMaxVolume="+t),TCAPI_ClearErrorInfo(),e==PREFERENCE_OFF&&(WriteToDebug("Setting percent to -1 - OFF"),t=-1),_TCAPI_SetStateSafe(TCAPI_STATE_AUDIO_PREFERENCE,t)}function TCAPI_SetLanguagePreference(e){return WriteToDebug("In TCAPI_SetLanguagePreference strLanguage="+e),TCAPI_ClearErrorInfo(),_TCAPI_SetStateSafe(TCAPI_STATE_LANGUAGE_PREFERENCE,e)}function TCAPI_GetLanguagePreference(){var e,t;return WriteToDebug("In TCAPI_GetLanguagePreference"),TCAPI_ClearErrorInfo(),null!==(t=tincan.getState(TCAPI_STATE_LANGUAGE_PREFERENCE)).state&&(e=t.state.contents),e}function TCAPI_SetSpeedPreference(e){var t;return WriteToDebug("In TCAPI_SetSpeedPreference intPercentOfMax="+e),TCAPI_ClearErrorInfo(),WriteToDebug("intTCAPISpeed="+(t=2*e-100)),_TCAPI_SetStateSafe(TCAPI_STATE_SPEED_PREFERENCE,t)}function TCAPI_GetSpeedPreference(){WriteToDebug("In TCAPI_GetSpeedPreference");var e,t,r=100;return TCAPI_ClearErrorInfo(),null!==(t=tincan.getState(TCAPI_STATE_SPEED_PREFERENCE)).state&&(r=t.state.contents),WriteToDebug("intTCAPISpeed="+r),ValidInteger(r)?(r=parseInt(r,10))<-100||r>100?(WriteToDebug("ERROR - out of range"),TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range","intTCAPISpeed="+r),null):(e=(r+100)/2,WriteToDebug("Returning "+(e=parseInt(e,10))),e):(WriteToDebug("ERROR - invalid integer"),TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer","intTCAPISpeed="+r),null)}function TCAPI_SetTextPreference(e){return WriteToDebug("In TCAPI_SetTextPreference intPreference="+e),TCAPI_ClearErrorInfo(),_TCAPI_SetStateSafe(TCAPI_STATE_TEXT_PREFERENCE,e)}function TCAPI_GetTextPreference(){WriteToDebug("In TCAPI_GetTextPreference");var e,t=0;return TCAPI_ClearErrorInfo(),null!==(e=tincan.getState(TCAPI_STATE_TEXT_PREFERENCE)).state&&(t=e.state.contents),WriteToDebug("intTempPreference="+(t=parseInt(t,10))),t>0?(WriteToDebug("Returning On"),PREFERENCE_ON):0==t||""==t?(WriteToDebug("Returning Default"),PREFERENCE_DEFAULT):t<0?(WriteToDebug("returning Off"),PREFERENCE_OFF):(WriteToDebug("Error: Invalid preference"),TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+t),null)}function TCAPI_GetPreviouslyAccumulatedTime(){WriteToDebug("In TCAPI_GetPreviouslyAccumulatedTime");var e,t=0;return WriteToDebug("In TCAPI_GetPreviouslyAccumulatedTime - cached: "+tcapi_cache.totalPrevDuration),null===tcapi_cache.totalPrevDuration&&(null!==(e=tincan.getState(TCAPI_STATE_TOTAL_TIME)).state&&(t=Number(e.state.contents)),tcapi_cache.totalPrevDuration=NaN===t?0:t),tcapi_cache.totalPrevDuration}function TCAPI_SaveTime(e){return WriteToDebug("In TCAPI_SaveTime"),!0}function TCAPI_GetMaxTimeAllowed(){return WriteToDebug("In TCAPI_GetMaxTimeAllowed"),null}function TCAPI_SetScore(e,t,r){return WriteToDebug("In TCAPI_SetScore intScore="+e+", intMaxScore="+t+", intMinScore="+r),TCAPI_ClearErrorInfo(),TCAPI_SCORE.raw=e,TCAPI_SCORE.max=t,TCAPI_SCORE.min=r,WriteToDebug("Returning "+TCAPI_SCORE),TCAPI_UPDATES_PENDING=!0,!0}function TCAPI_GetScore(){return WriteToDebug("In TCAPI_GetScore"),TCAPI_ClearErrorInfo(),WriteToDebug("Returning "+TCAPI_SCORE.raw),TCAPI_SCORE.raw}function TCAPI_SetPointBasedScore(e,t,r){return WriteToDebug("TCAPI_SetPointBasedScore - TCAPI does not support SetPointBasedScore, falling back to SetScore"),TCAPI_SetScore(e,t,r)}function TCAPI_GetScaledScore(e,t,r){return WriteToDebug("TCAPI_GetScaledScore - TCAPI does not support GetScaledScore, returning false"),!1}function TCAPI_RecordInteraction(e,t,r,n,i,o,a,s,u,c,l,C,I){var _,S,T={},d=TCAPI_GetLanguageTag();switch(interactionActivityId=e,interactionActivityType=TCAPI_INTERACTION,TCAPI_ClearErrorInfo(),S=0==e.indexOf(tincan.activity.id+"-")?e.substring(tincan.activity.id.length+1):e,TCAPI_DONT_USE_BROKEN_URN_IDS||(interactionActivityId=tincan.activity.id+"-urn:scormdriver:"+S),S&&""!==S||(S=e),c){case"true-false":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"true-false",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"choice":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"choice",name:{}}}).definition.description[d]=i,T.definition.name[d]=i,I&&I.length>0&&(T.definition.choices=I.map(function(e){var t={};return t[d]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})}));break;case"fill-in":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"fill-in",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"matching":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"matching",name:{}}}).definition.description[d]=i,T.definition.name[d]=i,I&&"object"==typeof I&&(I.source&&I.source.length>0&&(T.definition.source=I.source.map(function(e){var t={};return t[d]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})})),I.target&&I.target.length>0&&(T.definition.target=I.target.map(function(e){var t={};return t[d]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})})));break;case"performance":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"performance",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"sequencing":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"sequencing",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"likert":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"likert",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"numeric":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"numeric",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;case"other":(T={id:interactionActivityId,definition:{description:{},type:interactionActivityType,interactionType:"other",name:{}}}).definition.description[d]=i,T.definition.name[d]=i;break;default:return WriteToDebug("TCAPI_RecordInteraction received an invalid TCPAIInteractionType of "+c),!1}if(null!==T.id){null!==n&&""!==n&&(T.definition.correctResponsesPattern=[n]);var g={id:"http://adlnet.gov/expapi/verbs/answered",display:{}};g.display[d]="answered",_={verb:g,object:T,context:{contextActivities:{parent:tincan.activity,grouping:{id:tincan.activity.id+"-"+s}}}},(null!==t||null!==a&&""!==a||null!==o&&""!==o)&&(_.result={},null!==t&&(_.result.response=t,!0===r||r===INTERACTION_RESULT_CORRECT?_.result.success=!0:!1!==r&&""!==r&&"false"!==r&&r!==INTERACTION_RESULT_WRONG||(_.result.success=!1)),null!==a&&""!==a&&(_.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(a)),null!==o&&""!==o&&(_.result.extensions=_.result.extensions||{},_.result.extensions["http://id.tincanapi.com/extension/cmi-interaction-weighting"]=o)),tcapi_cache.statementQueue.push(_)}return!0}function TCAPI_RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In TCAPI_RecordTrueFalseInteraction strID="+e+", blnResponse="+t+", blnCorrect="+r+", blnCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null;return!0===t?c="true":!1===t&&(c="false"),!0===n?l="true":!1===n&&(l="false"),TCAPI_RecordInteraction(e,c,r,l,i,o,a,s,u,TCAPI_INTERACTION_TYPE_TRUE_FALSE,c,l)}function TCAPI_RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u,c){WriteToDebug("In TCAPI_RecordMultipleChoiceInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u+", choices="+JSON.stringify(c));var l=null,C=null,I="",_="";if(null!==t){l="",C="";for(var S=0;S<t.length;S++){l.length>0&&(l+="[,]"),C.length>0&&(C+="[,]");var T=SafeExtractResponseId(t[S],!0);l+=T,C+=T}}for(S=0;S<n.length;S++){I.length>0&&(I+="[,]"),_.length>0&&(_+="[,]");var d=SafeExtractResponseId(n[S],!0);I+=d,_+=d}return TCAPI_RecordInteraction(e,C,r,_,i,o,a,s,u,TCAPI_INTERACTION_TYPE_CHOICE,l,I,c)}function TCAPI_RecordFillInInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In TCAPI_RecordFillInInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!==t&&(t=new String(t)).length>255&&(t=t.substr(0,255)),null!==n&&(n=new String(n)).length>255&&(n=n.substr(0,255)),TCAPI_RecordInteraction(e,t,r,n,i,o,a,s,u,TCAPI_INTERACTION_TYPE_FILL_IN,t,n)}function TCAPI_RecordMatchingInteraction(e,t,r,n,i,o,a,s,u,c){WriteToDebug("In TCAPI_RecordMatchingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u+", choices="+JSON.stringify(c));var l=null,C=null,I="",_="";if(null!==t){l="",C="";for(var S=0;S<t.length;S++){l.length>0&&(l+="[,]"),C.length>0&&(C+="[,]"),l+=(T=SafeExtractResponseId(t[S].Source,!0))+"[.]"+(d=SafeExtractResponseId(t[S].Target,!0)),C+=T+"[.]"+d}}for(S=0;S<n.length;S++){var T,d;I.length>0&&(I+="[,]"),_.length>0&&(_+="[,]"),I+=(T=SafeExtractResponseId(n[S].Source,!0))+"[.]"+(d=SafeExtractResponseId(n[S].Target,!0)),_+=T+"[.]"+d}return TCAPI_RecordInteraction(e,C,r,_,i,o,a,s,u,TCAPI_INTERACTION_TYPE_MATCHING,l,I,c)}function TCAPI_RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In TCAPI_RecordPerformanceInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!==t&&(t=new String(t)).length>255&&(t=t.substr(0,255)),null!==n&&(n=new String(n)).length>255&&(n=n.substr(0,255)),TCAPI_RecordInteraction(e,t,r,n,i,o,a,s,u,TCAPI_INTERACTION_TYPE_PERFORMANCE,t,n)}function TCAPI_RecordSequencingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In TCAPI_RecordSequencingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C="",I="";if(null!==t){c="",l="";for(var _=0;_<t.length;_++){c.length>0&&(c+="[,]"),l.length>0&&(l+="[,]");var S=SafeExtractResponseId(t[_],!0);c+=S,l+=S}}for(_=0;_<n.length;_++){C.length>0&&(C+="[,]"),I.length>0&&(I+="[,]");var T=SafeExtractResponseId(n[_],!0);C+=T,I+=T}return TCAPI_RecordInteraction(e,l,r,I,i,o,a,s,u,TCAPI_INTERACTION_TYPE_SEQUENCING,c,C)}function TCAPI_RecordLikertInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In TCAPI_RecordLikertInteraction strID="+e+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null,C=null,I=null;return null!==t&&(c=SafeExtractResponseId(t,!0),l=SafeExtractResponseId(t,!0)),null!==n&&(C=SafeExtractResponseId(n,!0),I=SafeExtractResponseId(n,!0)),TCAPI_RecordInteraction(e,l,r,I,i,o,a,s,u,TCAPI_INTERACTION_TYPE_LIKERT,c,C)}function TCAPI_RecordNumericInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In TCAPI_RecordNumericInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null==n||IsValidDecimalRange(n)||IsValidDecimal(n)?(null!=t&&(t=String(t)),null!=n&&(n=String(n)),TCAPI_RecordInteraction(e,t,r,n,i,o,a,s,u,TCAPI_INTERACTION_TYPE_NUMERIC,t,n)):(WriteToDebug("Returning False -  TCAPI_RecordNumericInteraction received invalid correct response (not a decimal or range), strCorrectResponse="+n),!1)}function TCAPI_GetEntryMode(){return WriteToDebug("In TCAPI_GetEntryMode"),null}function TCAPI_GetLessonMode(){return WriteToDebug("In TCAPI_GetLessonMode"),null}function TCAPI_GetTakingForCredit(){return WriteToDebug("In TCAPI_GetTakingForCredit"),null}function TCAPI_SetObjectiveScore(e,t,r,n){return WriteToDebug("In TCAPI_SetObjectiveScore, strObejctiveID="+e+", intScore="+t+", intMaxScore="+r+", intMinScore="+n),!1}function TCAPI_SetObjectiveDescription(e,t){return WriteToDebug("In TCAPI_SetObjectiveDescription, strObjectiveDescription="+t),!1}function TCAPI_SetObjectiveStatus(e,t){return WriteToDebug("In TCAPI_SetObjectiveStatus strObjectiveID="+e+", Lesson_Status="+t),!1}function TCAPI_GetObjectiveScore(e){return WriteToDebug("In TCAPI_GetObjectiveScore, strObejctiveID="+e),!1}function TCAPI_GetObjectiveDescription(e){return WriteToDebug("In TCAPI_GetObjectiveDescription, strObejctiveID="+e),!1}function TCAPI_GetObjectiveStatus(e){return WriteToDebug("In TCAPI_GetObjectiveStatus, strObejctiveID="+e),!1}function TCAPI_SetSuspended(){return WriteToDebug("In TCAPI_SetSuspended"),TCAPI_IN_PROGRESS&&(TCAPI_IN_PROGRESS=!1,TCAPI_UPDATES_PENDING=!0),!0}function TCAPI_SetFailed(){return WriteToDebug("In TCAPI_SetFailed"),TCAPI_STATUS=TCAPI_VERB_FAILED,TCAPI_STATUS_CHANGED=!0,TCAPI_SATISFACTION_STATUS=!1,TCAPI_IN_PROGRESS=!1,TCAPI_UPDATES_PENDING=!0,!0}function TCAPI_SetPassed(){return WriteToDebug("In TCAPI_SetPassed"),TCAPI_STATUS=TCAPI_VERB_PASSED,TCAPI_STATUS_CHANGED=!0,TCAPI_SATISFACTION_STATUS=!0,TCAPI_IN_PROGRESS=!1,TCAPI_UPDATES_PENDING=!0,!0}function TCAPI_SetCompleted(){return WriteToDebug("In TCAPI_SetCompleted"),TCAPI_ClearErrorInfo(),TCAPI_STATUS===TCAPI_INIT_VERB&&(TCAPI_STATUS=TCAPI_VERB_COMPLETED,TCAPI_STATUS_CHANGED=!0),TCAPI_COMPLETION_STATUS=TCAPI_VERB_COMPLETED,TCAPI_IN_PROGRESS=!1,TCAPI_UPDATES_PENDING=!0,TCAPI_SendProgressed(100),!0}function TCAPI_ResetStatus(){return WriteToDebug("In TCAPI_ResetStatus"),TCAPI_ClearErrorInfo(),TCAPI_STATUS=TCAPI_INIT_VERB,TCAPI_STATUS_CHANGED=!0,TCAPI_COMPLETION_STATUS="",TCAPI_SATISFACTION_STATUS=null,TCAPI_IN_PROGRESS=!0,TCAPI_UPDATES_PENDING=!0,!0}function TCAPI_GetStatus(){WriteToDebug("In TCAPI_GetStatus");var e="";return TCAPI_ClearErrorInfo(),WriteToDebug("In TCAPI_GetStatus - strStatus="+(e=TCAPI_STATUS===TCAPI_VERB_COMPLETED?"completed":TCAPI_STATUS===TCAPI_VERB_ATTEMPTED?"attempted":TCAPI_STATUS===TCAPI_VERB_PASSED?"passed":TCAPI_STATUS===TCAPI_VERB_FAILED?"failed":TCAPI_STATUS)),e}function TCAPI_CreateValidIdentifier(e){return"TCAPI"===strLMSStandard?tincan.activity.id+"/"+e:tincan.activity.id+"-"+encodeURIComponent(e)}function TCAPI_SetNavigationRequest(e){return WriteToDebug("TCAPI_GetNavigationRequest - TCAPI does not support navigation requests, returning false"),!1}function TCAPI_GetNavigationRequest(){return WriteToDebug("TCAPI_GetNavigationRequest - TCAPI does not support navigation requests, returning false"),!1}function TCAPI_CreateDataBucket(e,t,r){return WriteToDebug("TCAPI_CreateDataBucket - TCAPI does not support SSP, returning false"),!1}function TCAPI_GetDataFromBucket(e){return WriteToDebug("TCAPI_GetDataFromBucket - TCAPI does not support SSP, returning empty string"),""}function TCAPI_PutDataInBucket(e,t,r){return WriteToDebug("TCAPI_PutDataInBucket - TCAPI does not support SSP, returning false"),!1}function TCAPI_DetectSSPSupport(){return WriteToDebug("TCAPI_DetectSSPSupport - TCAPI does not support SSP, returning false"),!1}function TCAPI_GetBucketInfo(e){return WriteToDebug("TCAPI_GetBucketInfo - TCAPI does not support SSP, returning empty SSPBucketSize"),new SSPBucketSize(0,0)}function TCAPI_WriteComment(e){return WriteToDebug("In TCAPI_WriteComment - TCAPI does not support comments"),!1}function TCAPI_GetComments(){return WriteToDebug("In TCAPI_GetComments - TCAPI does not support comments"),""}function TCAPI_GetLMSComments(){return WriteToDebug("In TCAPI_GetLMSComments - TCAPI does not support LMS comments"),""}function TCAPI_GetLaunchData(){return WriteToDebug("In TCAPI_GetLaunchData - TCAPI does not support launch data"),!1}function TCAPI_DisplayMessageOnTimeout(){return TCAPI_ClearErrorInfo(),WriteToDebug("In TCAPI_DisplayMessageOnTimeout - TCAPI does not support MessageOnTimeout"),!1}function TCAPI_ExitOnTimeout(){return WriteToDebug("In TCAPI_ExitOnTimeout - TCAPI does not support ExitOnTimeout"),!1}function TCAPI_GetPassingScore(){return WriteToDebug("In TCAPI_GetPassingScore - TCAPI does not support GetPassingScore"),!1}function TCAPI_GetProgressMeasure(){return WriteToDebug("TCAPI_GetProgressMeasure - TCAPI does not support progress_measure, returning false"),!1}function TCAPI_SetProgressMeasure(e){return WriteToDebug("In TCAPI_SetProgressMeasure - numMeasure: "+e),TCAPI_ClearErrorInfo(),TCAPI_SendProgressed(e)}function TCAPI_GetObjectiveProgressMeasure(){return WriteToDebug("TCAPI_GetObjectiveProgressMeasure - TCAPI does not support progress_measure, returning false"),!1}function TCAPI_SetObjectiveProgressMeasure(){return WriteToDebug("TCAPI_SetObjectiveProgressMeasure - TCAPI does not support progress_measure, returning false"),!1}function TCAPI_GetInteractionType(e){return WriteToDebug("TCAPI_GetInteractionType - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_GetInteractionTimestamp(e){return WriteToDebug("TCAPI_GetInteractionTimestamp - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_GetInteractionCorrectResponses(e){return WriteToDebug("TCAPI_GetInteractionCorrectResponses - TCAPI does not support interaction retrieval, returning empty array"),[]}function TCAPI_GetInteractionWeighting(e){return WriteToDebug("TCAPI_GetInteractionWeighting - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_GetInteractionLearnerResponses(e){return WriteToDebug("TCAPI_GetInteractionLearnerResponses - TCAPI does not support interaction retrieval, returning empty array"),[]}function TCAPI_GetInteractionResult(e){return WriteToDebug("TCAPI_GetInteractionResult - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_GetInteractionLatency(e){return WriteToDebug("TCAPI_GetInteractionDescription - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_GetInteractionDescription(e){return WriteToDebug("TCAPI_GetInteractionDescription - TCAPI does not support interaction retrieval, returning empty string"),""}function TCAPI_ClearErrorInfo(){WriteToDebug("In TCAPI_ClearErrorInfo"),intTCAPIError=TCAPI_NO_ERROR,strTCAPIErrorString="",strTCAPIErrorDiagnostic=""}function TCAPI_SetErrorInfoManually(e,t,r){WriteToDebug("In TCAPI_SetErrorInfoManually"),WriteToDebug("ERROR-Num="+e),WriteToDebug("      String="+t),WriteToDebug("      Diag="+r),intTCAPIError=e,strTCAPIErrorString=t,strTCAPIErrorDiagnostic=r}function TCAPI_GetLastError(){return WriteToDebug("In TCAPI_GetLastError"),intTCAPIError===TCAPI_NO_ERROR?(WriteToDebug("Returning No Error"),NO_ERROR):(WriteToDebug("Returning "+intTCAPIError),intTCAPIError)}function TCAPI_GetLastErrorDesc(){return WriteToDebug("In TCAPI_GetLastErrorDesc, "+strTCAPIErrorString+"\n"+strTCAPIErrorDiagnostic),strTCAPIErrorString+"\n"+strTCAPIErrorDiagnostic}var cmi5,CMI5_PENDING_STATUS={completion:null,success:null,score:null},CMI5_COMMITTED_STATUS={completion:null,success:null,score:null,launchModes:[]},CMI5_STATEMENT_QUEUE=[],CMI5_SESSION_DURATION=null,CMI5_TOTAL_PREV_DURATION=null,CMI5_ENTRY_MODE=null,CMI5_INTERACTIONS={},CMI5_SSP_BUCKETS={},CMI5_VERB_ID_FAILED="http://adlnet.gov/expapi/verbs/failed",CMI5_VERB_ID_PASSED="http://adlnet.gov/expapi/verbs/passed",CMI5_VERB_ID_COMPLETED="http://adlnet.gov/expapi/verbs/completed",CMI5_EXTENSION_MASTERY_SCORE="https://w3id.org/xapi/cmi5/context/extensions/masteryscore",CMI5_PREF_AUDIO_PLAY=null,CMI5_PREF_AUDIO_VOLUME=null,CMI5_PREF_LANGUAGE=null,CMI5_PREF_SPEED=null,CMI5_PREF_TEXT=null,CMI5_INTERACTION_ACTIVITY_TYPE="http://adlnet.gov/expapi/activities/cmi.interaction",CMI5_INTERACTION_TYPE_TRUE_FALSE="true-false",CMI5_INTERACTION_TYPE_CHOICE="choice",CMI5_INTERACTION_TYPE_FILL_IN="fill-in",CMI5_INTERACTION_TYPE_LONG_FILL_IN="long-fill-in",CMI5_INTERACTION_TYPE_MATCHING="matching",CMI5_INTERACTION_TYPE_PERFORMANCE="performance",CMI5_INTERACTION_TYPE_SEQUENCING="sequencing",CMI5_INTERACTION_TYPE_LIKERT="likert",CMI5_INTERACTION_TYPE_NUMERIC="numeric",CMI5_STATE_BOOKMARK="bookmark",CMI5_STATE_GENERIC_DATA="generic_data",CMI5_STATE_TOTAL_TIME="cumulative_time",CMI5_STATE_COMMITTED_STATUS="status",CMI5_STATE_COMMENTS="learner_comments",CMI5_STATE_SSP_BUCKET_PREFIX="sspBucket",CMI5_STATE_LANGUAGE_PREFERENCE="language_preference",CMI5_STATE_VOLUME_PREFERENCE="audio_preference",CMI5_STATE_SPEED_PREFERENCE="speed_preference",CMI5_STATE_TEXT_PREFERENCE="text_preference",CMI5_NO_ERROR="",CMI5_CONN_ERROR=998,CMI5_DEP_ERROR=999,CMI5_ERROR_NOT_IMPLEMENTED=998,CMI5_ERROR_INVALID_SCORE=1,CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET=2,CMI5_ERROR_UNRECOGNIZED_INTERACTION=3,CMI5_ERROR_NON_NORMAL_MODE=4,CMI5_ERROR_ALREADY_COMMITTED=5,CMI5_ERROR_INVALID_STATUS_BASED_ON_SCORE=6,CMI5_ERROR_SSP_BUCKET_LOAD_FAILED=7,CMI5_ERROR_SSP_BUCKET_ALREADY_EXISTS=8,CMI5_ERROR_SSP_BUCKET_INVALID_JSON=9,CMI5_ERROR_INTERACTION_INVALID_JSON=10,CMI5_ERROR_INTERACTION_LOAD_FAILED=11,intCMI5Error=CMI5_NO_ERROR,strCMI5ErrorString="",strCMI5ErrorDiagnostic="";function CMI5_SaveState(e,t,r,n,i){WriteToDebug("In CMI5_SaveState - key: "+e+", value: "+t);var o,a,s,u,c={agent:cmi5.getActor(),activity:cmi5.getActivity(),contentType:r};return i&&(WriteToDebug("In CMI5_SaveState - Setting callback to async!"),c.callback=i),(null==n||n)&&(c.registration=cmi5.getRegistration()),o=cmi5.getLRS().saveState(e,t,c),void 0!==c.callback||null===o.err||(WriteToDebug("Failed to save "+e+" in state: "+o.err),s="Failed to save state: "+e,/^\d+$/.test(o.err)?(a=o.err,u=0===o.err?"Aborted, offline, or invalid CORS endpoint":o.xhr.responseText):(a=CMI5_DEP_ERROR,u=o.err),CMI5_SetErrorInfoManually(a,s,u),!1)}function CMI5_RetrieveState(e,t){WriteToDebug("In CMI5_RetrieveState - key: "+e);var r,n,i,o,a={agent:cmi5.getActor(),activity:cmi5.getActivity()},s="";return(null==t||t)&&(a.registration=cmi5.getRegistration()),null!==(r=cmi5.getLRS().retrieveState(e,a)).err?(WriteToDebug("Failed to retrieve "+e+" from state: "+r.err),i="Failed to retrieve state: "+e,/^\d+$/.test(r.err)?(n=r.err,o=0===r.err?"Aborted, offline, or invalid CORS endpoint":r.xhr.responseText):(n=CMI5_DEP_ERROR,o=r.err),CMI5_SetErrorInfoManually(n,i,o),""):(null!==r.state&&(s=r.state.contents),s)}function CMI5_GetLaunchUrl(){return WriteToDebug("In CMI5_GetLaunchUrl"),document.location.href}function CMI5_Initialize(){var e;WriteToDebug("In CMI5_Initialize"),Cmi5.prototype.log=function(){var e,t="cmi5.js:";for(e=0;e<arguments.length;e+=1)t+=" ",t+="string"==typeof arguments[e]?arguments[e]:JSON.stringify(arguments[e]);WriteToDebug(t)},TinCan.LRS.prototype.log=function(e,t){WriteToDebug("TinCan."+(t=t||this.LOG_SRC||"LRS")+": "+e)};try{WriteToDebug("CMI5_Initialize - instantiating cmi5 object from launch URL = "+(e=CMI5_GetLaunchUrl())),(cmi5=new Cmi5(e)).includeSourceActivity(!1)}catch(e){return void InitializeExecuted(!1,"Failed to initialize cmi5 object (caught exception): "+e)}return WriteToDebug("CMI5_Initialize - calling start on cmi5 instance"),cmi5.start(function(e){var t;if(null!==e)return WriteToDebug("CMI5_Initialize - cmi5 start failed: "+e),void InitializeExecuted(!1,"Failed to initialize: "+e.message);if(WriteToDebug("CMI5_Initialize - cmi5 start succeeded"),t=CMI5_RetrieveState(CMI5_STATE_COMMITTED_STATUS),intCMI5Error)return WriteToDebug("CMI5_Initialize - failed to retrieve state for committed status: "+strCMI5ErrorString),void InitializeExecuted(!1,"Failed to initialize: "+strCMI5ErrorString);if(""!==t){if(void 0===t.launchModes)return WriteToDebug("CMI5_Initialize - failed to retrieve state for committed status: likely invalid JSON parse failure"),void InitializeExecuted(!1,"Failed to initialize: likely invalid JSON parse failure");CMI5_COMMITTED_STATUS=t}CMI5_ENTRY_MODE=!0===CMI5_COMMITTED_STATUS.completion?ENTRY_REVIEW:CMI5_COMMITTED_STATUS.launchModes.length>0?ENTRY_RESUME:ENTRY_FIRST_TIME,CMI5_COMMITTED_STATUS.launchModes.push(cmi5.getLaunchMode()),CMI5_SaveState(CMI5_STATE_COMMITTED_STATUS,CMI5_COMMITTED_STATUS,"application/json",void 0,function(e){if(e)return WriteToDebug("CMI5_Initialize - failed to store committed status"),void InitializeExecuted(!1,"Failed to initialize - failed to store committed status");WriteToDebug("CMI5_Initialize - succeeded"),InitializeExecuted(!0,"")}),window.setTimeout(function(){CMI5_GetPreviouslyAccumulatedTime()},200)},{postFetch:function(e,t,r){var n;null===e&&(n=cmi5.getActivity(),cmi5.getLRS().retrieveActivity(n.id,{callback:function(e,t){null===e&&cmi5.setActivity(t)}}))}}),!0}function CMI5_CommitData(){WriteToDebug("In CMI5_CommitData");var e,t,r,n,i,o=!1,a=new TinCan.Activity({id:"http://id.tincanapi.com/activity/software/scormdriver/"+VERSION,definition:{name:{"en-US":"ScormDriver ("+VERSION+")"},description:{"en-US":"ScormDriver ("+VERSION+")"},type:"http://id.tincanapi.com/activitytype/source"}});if(CMI5_ClearErrorInfo(),null!==CMI5_PENDING_STATUS.completion&&(o=!0,CMI5_COMMITTED_STATUS.completion=CMI5_PENDING_STATUS.completion),null!==CMI5_PENDING_STATUS.success&&(o=!0,CMI5_COMMITTED_STATUS.success=CMI5_PENDING_STATUS.success,null!==CMI5_PENDING_STATUS.score&&(CMI5_COMMITTED_STATUS.score=CMI5_PENDING_STATUS.score)),o&&(result=CMI5_SaveState(CMI5_STATE_COMMITTED_STATUS,CMI5_COMMITTED_STATUS,"application/json"),!result))return WriteToDebug("CMI5_CommitData - failed to commit status"),result;if(CMI5_STATEMENT_QUEUE.length>0){if(null!==CMI5_PENDING_STATUS.score&&null!==CMI5_PENDING_STATUS.success)for(r=cmi5.getActivity().id,e=0;e<CMI5_STATEMENT_QUEUE.length;e+=1)(t=CMI5_STATEMENT_QUEUE[e]).target.id!==r||t.verb.id!==CMI5_VERB_ID_FAILED&&t.verb.id!==CMI5_VERB_ID_PASSED||(t.result=t.result||new TinCan.Result,t.result.score=new TinCan.Score(CMI5_PENDING_STATUS.score));for(e=0;e<CMI5_STATEMENT_QUEUE.length;e+=1)(t=CMI5_STATEMENT_QUEUE[e]).context.contextActivities.grouping=t.context.contextActivities.grouping||[],t.context.contextActivities.grouping.push(a);if(result=cmi5.getLRS().saveStatements(CMI5_STATEMENT_QUEUE),null!==result.err)return/^\d+$/.test(result.err)?0===result.err?(n=CMI5_CONN_ERROR,i="Aborted, offline, or invalid CORS endpoint"):(n=result.err,i=result.xhr.responseText):(n=CMI5_DEP_ERROR,i=result.err),CMI5_SetErrorInfoManually(n,"Failed to commit data: statements",i),!1;CMI5_STATEMENT_QUEUE=[]}return!0}function CMI5_Finish(e,t){WriteToDebug("In CMI5_Finish - exitType: "+e);var r=cmi5.terminatedStatement();return CMI5_ClearErrorInfo(),CMI5_SetDurationInStatement(r),CMI5_STATEMENT_QUEUE.push(r),CMI5_SaveState(CMI5_STATE_TOTAL_TIME,CMI5_GetPreviouslyAccumulatedTime()+GetSessionAccumulatedTime(),"text/plain")?!!CMI5_CommitData()||(WriteToDebug("CMI5_Finish - failed to commit data"),!1):(WriteToDebug("CMI5_Finish - failed to record total time to State"),!1)}function CMI5_ConcedeControl(){WriteToDebug("In CMI5_ConcedeControl");var e=cmi5.getReturnURL(),t=SearchParentsForContentRoot();return null!==e&&null!==t?(t.location.assign(e),!0):null===t||(t.close(),!0)}function CMI5_GetStudentID(){return WriteToDebug("In CMI5_GetStudentID"),cmi5.getActor().account.name}function CMI5_GetStudentName(){return WriteToDebug("In CMI5_GetStudentName"),cmi5.getActor().toString()}function CMI5_GetBookmark(){return WriteToDebug("In CMI5_GetBookmark"),CMI5_RetrieveState(CMI5_STATE_BOOKMARK)}function CMI5_SetBookmark(e,t){WriteToDebug("In CMI5_SetBookmark - location: "+e+", description: "+t);var r,n=CreateValidIdentifier(e);return""!==n?((r=cmi5.prepareStatement("http://adlnet.gov/expapi/verbs/experienced")).context.contextActivities=r.context.contextActivities||new TinCan.ContextActivities,r.context.contextActivities.parent=r.context.contextActivities.parent||[],r.context.contextActivities.parent.push(r.target),r.target=new TinCan.Activity({id:n}),CMI5_SetDurationInStatement(r),CMI5_STATEMENT_QUEUE.push(r)):WriteToDebug("WARNING - No bookmarking statement written, empty location"),CMI5_SaveState(CMI5_STATE_BOOKMARK,e,"text/plain",void 0,noop)}function CMI5_GetDataChunk(){return WriteToDebug("In CMI5_GetDataChunk"),CMI5_RetrieveState(CMI5_STATE_GENERIC_DATA)}function CMI5_SetDataChunk(e){return WriteToDebug("In CMI5_SetDataChunk"),CMI5_SaveState(CMI5_STATE_GENERIC_DATA,e,"text/plain",void 0,noop)}function CMI5_GetLaunchData(){WriteToDebug("In CMI5_GetLaunchData");var e=cmi5.getLaunchParameters();return null===e&&(e=""),e}function CMI5_GetAudioPlayPreference(){var e;return WriteToDebug("In CMI5_GetAudioPlayPreference"),CMI5_ClearErrorInfo(),null===CMI5_PREF_AUDIO_PLAY&&("on"===(e=cmi5.getAudioPreference())?(WriteToDebug("    Caching On"),CMI5_PREF_AUDIO_PLAY=PREFERENCE_ON):"off"===e?(WriteToDebug("    Caching Off"),CMI5_PREF_AUDIO_PLAY=PREFERENCE_OFF):(WriteToDebug("    Caching Default"),CMI5_PREF_AUDIO_PLAY=PREFERENCE_DEFAULT)),WriteToDebug("Returning preference: "+CMI5_PREF_AUDIO_PLAY),CMI5_PREF_AUDIO_PLAY}function CMI5_GetAudioVolumePreference(){var e;return WriteToDebug("In CMI5_GetAudioVolumePreference"),CMI5_ClearErrorInfo(),null===CMI5_PREF_AUDIO_VOLUME&&(""===(e=CMI5_RetrieveState(CMI5_STATE_VOLUME_PREFERENCE,!1))&&(e=100),CMI5_PREF_AUDIO_VOLUME=parseInt(e,10)),WriteToDebug("Returning "+CMI5_PREF_AUDIO_VOLUME),CMI5_PREF_AUDIO_VOLUME}function CMI5_SetAudioPreference(e,t){WriteToDebug("In CMI5_SetAudioPreference PlayPreference="+e+", intPercentOfMaxVolume="+t);var r,n=cmi5.getAudioPreference(),i=!0,o=!1;return CMI5_ClearErrorInfo(),CMI5_PREF_AUDIO_PLAY=e,CMI5_PREF_AUDIO_VOLUME=t,e!=PREFERENCE_OFF||null!==n&&"on"!==n?e==PREFERENCE_OFF||null!==n&&"off"!==n||(cmi5.setAudioPreference("on"),o=!0):(cmi5.setAudioPreference("off"),o=!0),o&&(r=cmi5.saveLearnerPrefs())&&(WriteToDebug("  failed to save learner prefs, setting overall result to false"),i=!1,CMI5_SetErrorInfoManually(CMI5_DEP_ERROR,"Failed to save learner preferences",r)),CMI5_SaveState(CMI5_STATE_VOLUME_PREFERENCE,t,"text/plain",!1,function(e){if(e)return WriteToDebug("  failed to save volume preference in state, setting overall result to false"),i=!1;WriteToDebug("CMI5_SetAudioPreference - succeeded")}),i}function CMI5_SetLanguagePreference(e){return WriteToDebug("In CMI5_SetLanguagePreference strLanguage="+e),CMI5_ClearErrorInfo(),CMI5_PREF_LANGUAGE=e,CMI5_SaveState(CMI5_STATE_LANGUAGE_PREFERENCE,e,"text/plain",!1,noop)}function CMI5_GetLanguagePreference(){return WriteToDebug("In CMI5_GetLanguagePreference"),CMI5_ClearErrorInfo(),null===CMI5_PREF_LANGUAGE&&(CMI5_PREF_LANGUAGE=CMI5_RetrieveState(CMI5_STATE_LANGUAGE_PREFERENCE,!1)),CMI5_PREF_LANGUAGE}function CMI5_SetSpeedPreference(e){return WriteToDebug("In CMI5_SetSpeedPreference intPercentOfMax="+e),CMI5_ClearErrorInfo(),CMI5_PREF_SPEED=e,CMI5_SaveState(CMI5_STATE_SPEED_PREFERENCE,e,"text/plain",!1,noop)}function CMI5_GetSpeedPreference(){var e;return WriteToDebug("In CMI5_GetSpeedPreference"),CMI5_ClearErrorInfo(),null===CMI5_PREF_SPEED&&(""===(e=CMI5_RetrieveState(CMI5_STATE_SPEED_PREFERENCE,!1))&&(e=100),CMI5_PREF_SPEED=e),CMI5_PREF_SPEED}function CMI5_SetTextPreference(e){return WriteToDebug("In CMI5_SetTextPreference intPreference="+e),CMI5_ClearErrorInfo(),CMI5_PREF_TEXT=e,CMI5_SaveState(CMI5_STATE_TEXT_PREFERENCE,e,"text/plain",!1,noop)}function CMI5_GetTextPreference(){return WriteToDebug("In CMI5_GetTextPreference"),CMI5_ClearErrorInfo(),null===CMI5_PREF_TEXT&&""===(CMI5_PREF_TEXT=CMI5_RetrieveState(CMI5_STATE_TEXT_PREFERENCE,!1))&&(CMI5_PREF_TEXT=PREFERENCE_DEFAULT),CMI5_PREF_TEXT}function CMI5_GetEntryMode(){return WriteToDebug("In CMI5_GetEntryMode"),CMI5_ClearErrorInfo(),CMI5_ENTRY_MODE}function CMI5_GetLessonMode(){WriteToDebug("In CMI5_GetLessonMode - launchMode: "+cmi5.getLaunchMode());var e=cmi5.getLaunchMode();return CMI5_ClearErrorInfo(),"Normal"===e?MODE_NORMAL:"Browse"===e?MODE_BROWSE:"Review"===e?MODE_REVIEW:(CMI5_SetErrorInfoManually(CMI5_DEP_ERROR,"Invalid launch mode from LMS","launchMode = "+e),null)}function CMI5_GetTakingForCredit(){return WriteToDebug("In CMI5_GetTakingForCredit - launchMode: "+cmi5.getLaunchMode()),"Normal"===cmi5.getLaunchMode()}function CMI5_GetPreviouslyAccumulatedTime(){var e;return WriteToDebug("In CMI5_GetPreviouslyAccumulatedTime - cached: "+CMI5_TOTAL_PREV_DURATION),null===CMI5_TOTAL_PREV_DURATION&&(WriteToDebug("   fetched previous duration for caching: "+(e=CMI5_RetrieveState(CMI5_STATE_TOTAL_TIME))),""===e?(WriteToDebug("   empty value converting to zero"),CMI5_TOTAL_PREV_DURATION=0):CMI5_TOTAL_PREV_DURATION=parseInt(e,10)),CMI5_TOTAL_PREV_DURATION}function CMI5_SaveTime(e){return WriteToDebug("In CMI5_SaveTime"),CMI5_SESSION_DURATION=e,!0}function CMI5_GetMaxTimeAllowed(){return WriteToDebug("In CMI5_GetMaxTimeAllowed"),MAX_CMI_TIME}function CMI5_SetScore(e,t,r){var n;if(WriteToDebug("In CMI5_SetScore intScore="+e+", intMaxScore="+t+", intMinScore="+r),CMI5_ClearErrorInfo(),"Normal"!==cmi5.getLaunchMode())return CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to SetScore: "+e,"launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1;if(!0===CMI5_COMMITTED_STATUS.success)return CMI5_SetErrorInfoManually(CMI5_ERROR_ALREADY_COMMITTED,"Failed to SetScore: "+e,"success status already committed"),!1;n={raw:Math.round(e),max:t,min:r,scaled:RoundToPrecision(e/100,2)};try{cmi5.validateScore(n)}catch(t){return CMI5_SetErrorInfoManually(CMI5_ERROR_INVALID_SCORE,"Failed to SetScore: "+e,"invalid score: "+t.message),!1}return CMI5_PENDING_STATUS.score=n,!0}function CMI5_GetScore(){WriteToDebug("In CMI5_GetScore");var e="";return CMI5_ClearErrorInfo(),null!==CMI5_COMMITTED_STATUS&&void 0!==CMI5_COMMITTED_STATUS.score&&null!==CMI5_COMMITTED_STATUS.score?e=CMI5_COMMITTED_STATUS.score.raw:null!==CMI5_PENDING_STATUS.score&&(e=CMI5_PENDING_STATUS.score.raw),e}function CMI5_GetScaledScore(){WriteToDebug("CMI5_GetScaledScore");var e="";return CMI5_ClearErrorInfo(),null!==CMI5_COMMITTED_STATUS&&void 0!==CMI5_COMMITTED_STATUS.score&&null!==CMI5_COMMITTED_STATUS.score?e=CMI5_COMMITTED_STATUS.score.scaled:null!==CMI5_PENDING_STATUS.score&&(e=CMI5_PENDING_STATUS.score.scaled),e}function CMI5_SetPointBasedScore(e,t,r){return WriteToDebug("CMI5_SetPointBasedScore - cmi5 does not support SetPointBasedScore, falling back to SetScore"),CMI5_SetScore(e,t,r)}function CMI5_RecordInteraction(e,t,r,n,i,o,a,s,u,c,l,C,I){var _;return CMI5_ClearErrorInfo(),"Normal"!==cmi5.getLaunchMode()?(CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to RecordInteraction: launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1):((_=cmi5.prepareStatement("http://adlnet.gov/expapi/verbs/answered")).result=_.result||new TinCan.Result,null!==t&&(_.result.response=t),!0===r||r===INTERACTION_RESULT_CORRECT?_.result.success=!0:!1!==r&&""!==r&&"false"!==r&&r!==INTERACTION_RESULT_WRONG||(_.result.success=!1),null!==a&&""!==a&&(_.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(a)),null!==o&&""!==o&&(_.result.extensions=_.result.extensions||{},_.result.extensions["http://id.tincanapi.com/extension/cmi-interaction-weighting"]=o),_.context.contextActivities=_.context.contextActivities||new TinCan.ContextActivities,_.context.contextActivities.parent=_.context.contextActivities.parent||[],_.context.contextActivities.parent.push(_.target),""!==s&&(_.context.contextActivities.grouping=_.context.contextActivities.grouping||[],_.context.contextActivities.grouping.push(new TinCan.Activity({id:s}))),_.target=new TinCan.Activity({id:e,definition:{type:CMI5_INTERACTION_ACTIVITY_TYPE,interactionType:c}}),null!==i&&""!==i&&CMI5_ApplyInteractionDefinitionLanguage(_.target.definition,i,c,I),null!==n&&""!==n&&(_.target.definition.correctResponsesPattern=[n]),CMI5_STATEMENT_QUEUE.push(_),CMI5_CreateInteraction.apply(this,arguments),CMI5_SaveInteraction(e),!0)}function CMI5_RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In CMI5_RecordTrueFalseInteraction strID="+e+", strResponse="+c+", blnCorrect="+r+", strCorrectResponse="+l+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l=null;return!0===t?c="true":!1===t&&(c="false"),!0===n?l="true":!1===n&&(l="false"),CMI5_RecordInteraction(e,c,r,l,i,o,a,s,u,CMI5_INTERACTION_TYPE_TRUE_FALSE)}function CMI5_RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u,c){WriteToDebug("In CMI5_RecordMultipleChoiceInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u+", choices="+JSON.stringify(c));var l,C=null,I="";if(null!==t)for(C="",l=0;l<t.length;l+=1)C.length>0&&(C+="[,]"),C+=SafeExtractResponseId(t[l]);for(l=0;l<n.length;l+=1)I.length>0&&(I+="[,]"),I+=SafeExtractResponseId(n[l]);return CMI5_RecordInteraction(e,C,r,I,i,o,a,s,u,CMI5_INTERACTION_TYPE_CHOICE,null,null,c)}function CMI5_RecordFillInInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In CMI5_RecordFillInInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=CMI5_INTERACTION_TYPE_FILL_IN;return null!==t&&(t=new String(t)),null!==n&&(n=new String(n)).length>250&&(c=CMI5_INTERACTION_TYPE_LONG_FILL_IN),CMI5_RecordInteraction(e,t,r,n,i,o,a,s,u,c)}function CMI5_RecordMatchingInteraction(e,t,r,n,i,o,a,s,u,c){WriteToDebug("In CMI5_RecordMatchingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u+", choices="+JSON.stringify(c));var l,C=null,I="";if(null!==t)for(C="",l=0;l<t.length;l+=1){C.length>0&&(C+="[,]"),C+=SafeExtractResponseId(t[l].Source)+"[.]"+SafeExtractResponseId(t[l].Target)}for(l=0;l<n.length;l+=1){I.length>0&&(I+="[,]"),I+=SafeExtractResponseId(n[l].Source)+"[.]"+SafeExtractResponseId(n[l].Target)}return CMI5_RecordInteraction(e,C,r,I,i,o,a,s,u,CMI5_INTERACTION_TYPE_MATCHING,null,null,c)}function CMI5_RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In CMI5_RecordPerformanceInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null!==t&&(t=new String(t)),null!==n&&(n=new String(n)),CMI5_RecordInteraction(e,t,r,n,i,o,a,s,u,CMI5_INTERACTION_TYPE_PERFORMANCE)}function CMI5_RecordSequencingInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In CMI5_RecordSequencingInteraction strID="+e+", aryResponse="+t+", blnCorrect="+r+", aryCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c,l=null,C="";if(null!==t)for(l="",c=0;c<t.length;c+=1)l.length>0&&(l+="[,]"),l+=SafeExtractResponseId(t[c]);for(c=0;c<n.length;c+=1)C.length>0&&(C+="[,]"),C+=SafeExtractResponseId(n[c]);return CMI5_RecordInteraction(e,l,r,C,i,o,a,s,u,CMI5_INTERACTION_TYPE_SEQUENCING)}function CMI5_RecordLikertInteraction(e,t,r,n,i,o,a,s,u){WriteToDebug("In CMI5_RecordLikertInteraction strID="+e+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u);var c=null,l="";return null!==t&&(c=""!==t.Long?t.Long:t.Short),null!==n&&(l=""!==n.Long?n.Long:n.Short),CMI5_RecordInteraction(e,c,r,l,i,o,a,s,u,CMI5_INTERACTION_TYPE_LIKERT)}function CMI5_RecordNumericInteraction(e,t,r,n,i,o,a,s,u){return WriteToDebug("In CMI5_RecordNumericInteraction strID="+e+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+s+", dtmTime="+u),null==n||IsValidDecimalRange(n)||IsValidDecimal(n)?(null!=t&&(t=String(t)),null!=n&&(n=String(n)),CMI5_RecordInteraction(e,t,r,n,i,o,a,s,u,CMI5_INTERACTION_TYPE_NUMERIC)):(WriteToDebug("Returning False - CMI5_RecordNumericInteraction received invalid correct response (not a decimal or range), strCorrectResponse="+n),!1)}function CMI5_CreateInteraction(e,t,r,n,i,o,a,s,u,c,l,C){CMI5_INTERACTIONS[e]={type:c,timestamp:u.toJSON(),correctResponses:n,learnerResponses:t,weighting:o,result:r,latency:a,description:i}}function CMI5_LoadInteraction(e){var t;return WriteToDebug("CMI5_LoadInteraction - strInteractionId = "+e),void 0!==CMI5_INTERACTIONS[e]?(WriteToDebug("    already locally cached, returning"),!0):(t=CMI5_RetrieveState(e),intCMI5Error?(WriteToDebug("    failed to retrieve state for interaction: "+strCMI5ErrorString),!1):""!==t&&void 0===t.timestamp?(CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_INVALID_JSON,"Invalid JSON for interaction in State","result= "+t),!1):(""===t||(CMI5_INTERACTIONS[e]=t,WriteToDebug("    cached interaction locally")),!0))}function CMI5_SaveInteraction(e){return WriteToDebug("CMI5_SaveInteraction - strInteractionId = "+e),void 0===CMI5_INTERACTIONS[e]?(CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_INTERACTION,"Cannot save unknown interaction: "+e),!1):CMI5_SaveState(e,CMI5_INTERACTIONS[e],"application/json",void 0,noop)}function CMI5_GetInteractionType(e){return WriteToDebug("CMI5_GetInteractionType - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?CMI5_INTERACTIONS[e].type:"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction type: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionTimestamp(e){return WriteToDebug("CMI5_GetInteractionTimestamp - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?new Date(CMI5_INTERACTIONS[e].timestamp):"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction timestamp: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionCorrectResponses(e){WriteToDebug("CMI5_GetInteractionCorrectResponses - strInteractionID = "+e);var t=[];return CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?(void 0!==CMI5_INTERACTIONS[e]&&(t=CMI5_INTERACTIONS[e].correctResponses.split("[,]"),CMI5_INTERACTIONS[e].type===CMI5_INTERACTION_TYPE_MATCHING&&(t=CMI5_ProcessResponseArray(t))),t):(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction correct responses: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionLearnerResponses(e){WriteToDebug("CMI5_GetInteractionLearnerResponses - strInteractionID = "+e);var t=[];return CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?(void 0!==CMI5_INTERACTIONS[e]&&(t=CMI5_INTERACTIONS[e].learnerResponses.split("[,]"),CMI5_INTERACTIONS[e].type===CMI5_INTERACTION_TYPE_MATCHING&&(t=CMI5_ProcessResponseArray(t))),t):(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction learner responses: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_ProcessResponseArray(e){var t;for(t=0;t<e.length;t+=1)e[t]=CreateMatchingResponse(e[t]);return e}function CMI5_GetInteractionWeighting(e){return WriteToDebug("CMI5_GetInteractionWeighting - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?CMI5_INTERACTIONS[e].weighting:"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction weighting: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionResult(e){return WriteToDebug("CMI5_GetInteractionResult - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?CMI5_INTERACTIONS[e].result:"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction result: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionLatency(e){return WriteToDebug("CMI5_GetInteractionLatency - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?CMI5_INTERACTIONS[e].latency:"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction latency: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetInteractionDescription(e){return WriteToDebug("CMI5_GetInteractionDescription - strInteractionID = "+e),CMI5_ClearErrorInfo(),CMI5_LoadInteraction(e)?void 0!==CMI5_INTERACTIONS[e]?CMI5_INTERACTIONS[e].description:"":(WriteToDebug("Failed to load interaction: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction description: "+e,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_SetObjectiveScore(e,t,r,n){return WriteToDebug("In CMI5_SetObjectiveScore, strObjectiveID="+e+", intScore="+t+", intMaxScore="+r+", intMinScore="+n),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetObjectiveScore not implemented in cmi5",""),!1}function CMI5_SetObjectiveDescription(e,t){return WriteToDebug("In CMI5_SetObjectiveDescription, strObjectiveDescription="+t),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetObjectiveDescription not implemented in cmi5",""),!1}function CMI5_SetObjectiveStatus(e,t){return WriteToDebug("In CMI5_SetObjectiveStatus strObjectiveID="+e+", Lesson_Status="+t),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetObjectiveStatus not implemented in cmi5",""),!1}function CMI5_SetObjectiveProgressMeasure(){return WriteToDebug("In CMI5_SetObjectiveProgressMeasure"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetObjectiveProgressMeasure not implemented in cmi5",""),!1}function CMI5_GetObjectiveScore(e){return WriteToDebug("In CMI5_GetObjectiveScore, strObjectiveID="+e),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetObjectiveScore not implemented in cmi5",""),!1}function CMI5_GetObjectiveDescription(e){return WriteToDebug("In CMI5_GetObjectiveDescription, strObjectiveID="+e),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetObjectiveDescription not implemented in cmi5",""),!1}function CMI5_GetObjectiveStatus(e){return WriteToDebug("In CMI5_GetObjectiveStatus, strObjectiveID="+e),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetObjectiveStatus not implemented in cmi5",""),!1}function CMI5_GetObjectiveProgressMeasure(){return WriteToDebug("CMI5_GetObjectiveProgressMeasure"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetObjectiveProgressMeasure not implemented in cmi5",""),!1}function CMI5_SetFailed(){var e,t,r,n,i;if(WriteToDebug("In CMI5_SetFailed"),CMI5_ClearErrorInfo(),CMI5_ResetBlnStatusWasSetIfAppropriate(),"Normal"!==cmi5.getLaunchMode())return CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to SetFailed","Launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1;if(!0===CMI5_COMMITTED_STATUS.success)return CMI5_SetErrorInfoManually(CMI5_ERROR_ALREADY_COMMITTED,"Failed to SetFailed","Success status already committed"),!1;if(!1===CMI5_PENDING_STATUS.success)return!0;if(e=cmi5.getMasteryScore(),null!==CMI5_PENDING_STATUS.score&&null!==e&&CMI5_PENDING_STATUS.score.scaled>=e)return CMI5_SetErrorInfoManually(CMI5_ERROR_INVALID_STATUS_BASED_ON_SCORE,"Failed to SetFailed","Pending score conflicts with failure"),!1;if(!0===CMI5_PENDING_STATUS.success)for(t=cmi5.getActivity().id,n=0;n<CMI5_STATEMENT_QUEUE.length;n+=1)(r=CMI5_STATEMENT_QUEUE[n]).target.id===t&&r.verb.id===CMI5_VERB_ID_PASSED&&CMI5_STATEMENT_QUEUE.splice(n,n+1);return CMI5_PENDING_STATUS.success=!1,i=cmi5.failedStatement(),null!==e&&(i.context.extensions=i.context.extensions||{},i.context.extensions[CMI5_EXTENSION_MASTERY_SCORE]=e),CMI5_SetDurationInStatement(i),CMI5_STATEMENT_QUEUE.push(i),!0}function CMI5_SetPassed(){var e,t;return WriteToDebug("In CMI5_SetPassed"),CMI5_ClearErrorInfo(),CMI5_ResetBlnStatusWasSetIfAppropriate(),"Normal"!==cmi5.getLaunchMode()?(CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to SetPassed","Launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1):!0===CMI5_COMMITTED_STATUS.success?(CMI5_SetErrorInfoManually(CMI5_ERROR_ALREADY_COMMITTED,"Failed to SetPassed","Success status already committed"),!1):!0===CMI5_PENDING_STATUS.success||(e=cmi5.getMasteryScore(),null!==CMI5_PENDING_STATUS.score&&null!==e&&CMI5_PENDING_STATUS.score.scaled<e?(CMI5_SetErrorInfoManually(CMI5_ERROR_INVALID_STATUS_BASED_ON_SCORE,"Failed to SetPassed","Pending score conflicts with failure"),!1):(CMI5_PENDING_STATUS.success=!0,t=cmi5.passedStatement(),null!==e&&(t.context.extensions=t.context.extensions||{},t.context.extensions[CMI5_EXTENSION_MASTERY_SCORE]=e),CMI5_SetDurationInStatement(t),CMI5_STATEMENT_QUEUE.push(t),!0))}function CMI5_SetCompleted(){var e;return WriteToDebug("In CMI5_SetCompleted"),CMI5_ClearErrorInfo(),"Normal"!==cmi5.getLaunchMode()?(CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to SetCompleted","Launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1):null!==CMI5_COMMITTED_STATUS.completion?(CMI5_SetErrorInfoManually(CMI5_ERROR_ALREADY_COMMITTED,"Failed to SetCompleted","Completion status already committed"),!1):(null!==CMI5_PENDING_STATUS.completion||(CMI5_PENDING_STATUS.completion=!0,e=cmi5.completedStatement(),CMI5_STATEMENT_QUEUE.push(e),CMI5_SetDurationInStatement(e)),!0)}function CMI5_ResetStatus(){var e,t,r;if(WriteToDebug("In CMI5_ResetStatus"),CMI5_ClearErrorInfo(),"Normal"!==cmi5.getLaunchMode())return CMI5_SetErrorInfoManually(CMI5_ERROR_NON_NORMAL_MODE,"Failed to ResetStatus","Launch mode ("+cmi5.getLaunchMode()+") not a recording mode"),!1;if(null!==CMI5_COMMITTED_STATUS.completion||!0===CMI5_COMMITTED_STATUS.success)return CMI5_SetErrorInfoManually(CMI5_ERROR_ALREADY_COMMITTED,"Failed to ResetStatus","Success and/or completion status has already been committed"),!1;for(CMI5_PENDING_STATUS.completion=null,CMI5_PENDING_STATUS.success=null,e=cmi5.getActivity().id,t=0;t<CMI5_STATEMENT_QUEUE.length;t+=1)((r=CMI5_STATEMENT_QUEUE[t]).target.id=e&&(r.verb.id===CMI5_VERB_ID_COMPLETED||r.verb.id===CMI5_VERB_ID_PASSED||r.verb.id===CMI5_VERB_ID_FAILED))&&CMI5_STATEMENT_QUEUE.splice(t,t+1);return!0}function CMI5_GetStatus(){WriteToDebug("In CMI5_GetStatus");var e,t,r=0;if(CMI5_ClearErrorInfo(),!0===CMI5_COMMITTED_STATUS.success||!0===CMI5_PENDING_STATUS.success)e=LESSON_STATUS_PASSED;else if(!1===CMI5_COMMITTED_STATUS.success||!1===CMI5_PENDING_STATUS.success)e=LESSON_STATUS_FAILED;else if(!0===CMI5_COMMITTED_STATUS.completion||!0===CMI5_PENDING_STATUS.completion)e=LESSON_STATUS_COMPLETED;else{for(t=0;t<CMI5_COMMITTED_STATUS.launchModes.length;t+=1)"Normal"===CMI5_COMMITTED_STATUS.launchModes[t]&&(r+=1);e=0===r?LESSON_STATUS_BROWSED:CMI5_ENTRY_MODE===ENTRY_FIRST_TIME?LESSON_STATUS_NOT_ATTEMPTED:LESSON_STATUS_INCOMPLETE}return WriteToDebug("In CMI5_GetStatus - result = "+e),e}function CMI5_GetPassingScore(){var e;return WriteToDebug("In CMI5_GetPassingScore"),CMI5_ClearErrorInfo(),null===(e=cmi5.getMasteryScore())?0:e*=100}function CMI5_DetectSSPSupport(){return WriteToDebug("CMI5_DetectSSPSupport - implemented via state"),ClearErrorInfo(),!0}function CMI5_CreateDataBucket(e,t,r){return WriteToDebug("CMI5_CreateDataBucket - strBucketId = "+e),ClearErrorInfo(),CMI5_LoadBucket(e)?void 0!==CMI5_SSP_BUCKETS[e]?(WriteToDebug("Bucket already exists and can't be re-allocated."),CMI5_SetErrorInfoManually(CMI5_ERROR_SSP_BUCKET_ALREADY_EXISTS,"Failed to create bucket: "+e,""),!1):(CMI5_SSP_BUCKETS[e]={allocatedSpace:r,contents:""},CMI5_SaveBucket(e)):(WriteToDebug("Failed pre-existing bucket check, bucket can't be allocated"),CMI5_SetErrorInfoManually(CMI5_ERROR_SSP_BUCKET_LOAD_FAILED,"Failed to create bucket: "+e,"pre-existence check load failure: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetDataFromBucket(e){return WriteToDebug("CMI5_GetDataFromBucket - strBucketId = "+e),ClearErrorInfo(),CMI5_LoadBucket(e)?void 0===CMI5_SSP_BUCKETS[e]?(CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET,"Cannot get data from bucket: "+e,"unknown after load"),!1):CMI5_SSP_BUCKETS[e].contents:(WriteToDebug("Failed to load bucket: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_SSP_BUCKET_LOAD_FAILED,"Cannot get data from bucket: "+e,"Failed to load bucket: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_PutDataInBucket(e,t,r){return WriteToDebug("CMI5_PutDataInBucket - strBucketId = "+e),ClearErrorInfo(),CMI5_LoadBucket(e)?void 0===CMI5_SSP_BUCKETS[e]?(CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET,"Cannot put data into bucket: "+e,"unknown after load"),!1):(CMI5_SSP_BUCKETS[e].contents=r?CMI5_SSP_BUCKETS[e].contents+t:t,CMI5_SaveBucket(e)):(WriteToDebug("Failed to load bucket: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_SSP_BUCKET_LOAD_FAILED,"Cannot put data into bucket: "+e,"Failed to load bucket: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_GetBucketInfo(e){return WriteToDebug("CMI5_GetBucketInfo - strBucketId = "+e),ClearErrorInfo(),CMI5_LoadBucket(e)?void 0===CMI5_SSP_BUCKETS[e]?(CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET,"Cannot get info for bucket: "+e,"unknown after load"),!1):new SSPBucketSize(CMI5_SSP_BUCKETS[e].allocatedSpace,CMI5_SSP_BUCKETS[e].contents.length):(WriteToDebug("Failed to load bucket: "+e),CMI5_SetErrorInfoManually(CMI5_ERROR_SSP_BUCKET_LOAD_FAILED,"Cannot get info for bucket: "+e,"Failed to load bucket: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")"),!1)}function CMI5_LoadBucket(e){var t;return WriteToDebug("CMI5_LoadBucket - strBucketId = "+e),void 0!==CMI5_SSP_BUCKETS[e]?(WriteToDebug("    already locally cached, returning"),!0):(t=CMI5_RetrieveState(CMI5_STATE_SSP_BUCKET_PREFIX+"-"+e),intCMI5Error?(WriteToDebug("    failed to retrieve state for possible existing bucket: "+strCMI5ErrorString),!1):""!==t&&void 0===t.allocatedSpace?(CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_INVALID_JSON,"Invalid JSON for bucket in State","result= "+t),!1):(""===t||(CMI5_SSP_BUCKETS[e]=t,WriteToDebug("    cached bucket locally")),!0))}function CMI5_SaveBucket(e){return WriteToDebug("CMI5_SaveBucket - strBucketId = "+e),void 0===CMI5_SSP_BUCKETS[e]?(CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET,"Cannot save unknown bucket: "+e),!1):CMI5_SaveState(CMI5_STATE_SSP_BUCKET_PREFIX+"-"+e,CMI5_SSP_BUCKETS[e],"application/json",void 0,noop)}function CMI5_SetDurationInStatement(e){var t;t=null!==CMI5_SESSION_DURATION?CMI5_SESSION_DURATION:GetSessionAccumulatedTime(),e.result=e.result||new TinCan.Result,e.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(t)}function CMI5_CreateValidIdentifier(e){if(void 0===e||""===e||null===e)return WriteToDebug("WARNING - returning invalid identifier, invalid argument provided: "+e),"";URI.iri();var t,r=new URI(e),n=URI.encode;return r.is("absolute")||(""===(r=new URI(cmi5.getActivity().id)).fragment()?r.hash(n(e)):r.hash(r.fragment()+"-"+n(e))),r.iri(),t=r.toString(),URI.unicode(),t}function CMI5_GetComments(){return WriteToDebug("In CMI5_GetComments"),CMI5_RetrieveState(CMI5_STATE_COMMENTS)}function CMI5_WriteComment(e){return WriteToDebug("In CMI5_WriteComment - comment: "+e),CMI5_SaveState(CMI5_STATE_COMMENTS,e,"text/plain",void 0,noop)}function CMI5_GetLMSComments(){return WriteToDebug("In CMI5_GetLMSComments - cmi5 does not support LMS comments"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetLMSComments not implemented in cmi5",""),""}function CMI5_SetNavigationRequest(e){return WriteToDebug("CMI5_GetNavigationRequest - cmi5 does not support navigation requests, returning false"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetNavigationRequest not implemented in cmi5",""),!1}function CMI5_GetNavigationRequest(){return WriteToDebug("CMI5_GetNavigationRequest - cmi5 does not support navigation requests, returning false"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetNavigationRequest not implemented in cmi5",""),!1}function CMI5_GetProgressMeasure(){return WriteToDebug("CMI5_GetProgressMeasure - cmi5 does not support progress_measure, returning false"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"GetProgressMeasure not implemented in cmi5",""),!1}function CMI5_SetProgressMeasure(){return WriteToDebug("CMI5_SetProgressMeasure - cmi5 does not support progress_measure, returning false"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"SetProgressMeasure not implemented in cmi5",""),!1}function CMI5_DisplayMessageOnTimeout(){return WriteToDebug("In CMI5_DisplayMessageOnTimeout - cmi5 does not support MessageOnTimeout"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"DisplayMessageOnTimeout not implemented in cmi5",""),!1}function CMI5_ExitOnTimeout(){return WriteToDebug("In CMI5_ExitOnTimeout - cmi5 does not support ExitOnTimeout"),ClearErrorInfo(),CMI5_SetErrorInfoManually(CMI5_ERROR_NOT_IMPLEMENTED,"ExitOnTimeout not implemented in cmi5",""),!1}function CMI5_ResetBlnStatusWasSetIfAppropriate(){CMI5_PENDING_STATUS.completion||CMI5_COMMITTED_STATUS.completion||(WriteToDebug("Overriding blnStatusWasSet to false."),blnStatusWasSet=!1)}function CMI5_ClearErrorInfo(){WriteToDebug("In CMI5_ClearErrorInfo"),intCMI5Error=CMI5_NO_ERROR,strCMI5ErrorString="",strCMI5ErrorDiagnostic=""}function CMI5_SetErrorInfoManually(e,t,r){WriteToDebug("In CMI5_SetErrorInfoManually"),WriteToDebug("ERROR-Num="+e),WriteToDebug("      String="+t),WriteToDebug("      Diag="+r),intCMI5Error=e,strCMI5ErrorString=t,strCMI5ErrorDiagnostic=r}function CMI5_GetLastError(){return WriteToDebug("In CMI5_GetLastError"),intCMI5Error===CMI5_NO_ERROR?(WriteToDebug("Returning No Error"),NO_ERROR):(WriteToDebug("Returning "+intCMI5Error),intCMI5Error)}function CMI5_GetLastErrorDesc(){return WriteToDebug("In CMI5_GetLastErrorDesc, "+strCMI5ErrorString+"\n"+strCMI5ErrorDiagnostic),strCMI5ErrorString+"\n"+strCMI5ErrorDiagnostic}function LMSStandardAPI(e){var t,r=["Initialize","Finish","CommitData","GetStudentID","GetStudentName","GetBookmark","SetBookmark","GetDataChunk","SetDataChunk","GetLaunchData","GetComments","WriteComment","GetLMSComments","GetAudioPlayPreference","GetAudioVolumePreference","SetAudioPreference","SetLanguagePreference","GetLanguagePreference","SetSpeedPreference","GetSpeedPreference","SetTextPreference","GetTextPreference","GetPreviouslyAccumulatedTime","SaveTime","GetMaxTimeAllowed","DisplayMessageOnTimeout","ExitOnTimeout","GetPassingScore","SetScore","GetScore","GetScaledScore","RecordTrueFalseInteraction","RecordMultipleChoiceInteraction","RecordFillInInteraction","RecordMatchingInteraction","RecordPerformanceInteraction","RecordSequencingInteraction","RecordLikertInteraction","RecordNumericInteraction","GetEntryMode","GetLessonMode","GetTakingForCredit","SetObjectiveScore","SetObjectiveStatus","GetObjectiveScore","GetObjectiveStatus","SetObjectiveDescription","GetObjectiveDescription","SetFailed","SetPassed","SetCompleted","ResetStatus","GetStatus","GetLastError","GetLastErrorDesc","GetInteractionType","GetInteractionTimestamp","GetInteractionCorrectResponses","GetInteractionWeighting","GetInteractionLearnerResponses","GetInteractionResult","GetInteractionLatency","GetInteractionDescription","CreateDataBucket","GetDataFromBucket","PutDataInBucket","DetectSSPSupport","GetBucketInfo","GetProgressMeasure","SetProgressMeasure","SetPointBasedScore","SetNavigationRequest","GetNavigationRequest","SetObjectiveProgressMeasure","GetObjectiveProgressMeasure","CreateValidIdentifier","ConcedeControl"];for(WriteToDebug("In LMSStandardAPI strStandard="+e),""==e&&(WriteToDebug("No standard specified, using NONE"),e="NONE"),this.Standard=e,t=0;t<r.length;t+=1)void 0!==window[e+"_"+r[t]]?this[r[t]]=window[e+"_"+r[t]]:WriteToDebug("In LMSStandardAPI missing interface method="+r[t])}var winDebug,blnCalledFinish=!1,blnStandAlone=!1,blnLoaded=!1,blnReachedEnd=!1,blnStatusWasSet=!1,blnLmsPresent=!1,blnUnloading=!1,dtmStart=null,dtmEnd=null,intAccumulatedMS=0,blnOverrodeTime=!1,intTimeOverrideMS=null,aryDebug=new Array,strDebug="",intError=NO_ERROR,strErrorDesc="",objLMS=null;function Start(){var e,t,r=null,n="",i="",o="";if(WriteToDebug("<h1>SCORM Driver starting up</h1>"),WriteToDebug("----------------------------------------"),WriteToDebug("----------------------------------------"),WriteToDebug("In Start - Version: "+VERSION+"  Last Modified="+window.document.lastModified),WriteToDebug("Browser Info ("+navigator.appName+" "+navigator.appVersion+")"),WriteToDebug("URL: "+window.document.location.href),WriteToDebug("----------------------------------------"),WriteToDebug("----------------------------------------"),ClearErrorInfo(),WriteToDebug("strStandAlone="+(e=GetQueryStringValue("StandAlone",window.location.search))+"  strShowInteractiveDebug="+(t=GetQueryStringValue("ShowDebug",window.location.search))),ConvertStringToBoolean(e)&&(WriteToDebug("Entering Stand Alone Mode"),blnStandAlone=!0),blnStandAlone)WriteToDebug("Using NONE Standard"),objLMS=new LMSStandardAPI("NONE");else if(WriteToDebug("Standard From Configuration File - "+strLMSStandard),"AUTO"==strLMSStandard.toUpperCase())if(WriteToDebug("Searching for recognized querystring parameters"),n=GetQueryStringValue("AICC_URL",document.location.search),i=GetQueryStringValue("endpoint",document.location.search),o=GetQueryStringValue("fetch",document.location.search),null!=n&&""!=n)WriteToDebug("Found AICC querystring parameters, using AICC"),objLMS=new LMSStandardAPI("AICC"),blnLmsPresent=!0;else if(null!=i&&""!=i)WriteToDebug("Found endpoint querystring parameter - checking cmi5 or Tin Can"),null!=o&&""!=o?(WriteToDebug("Found fetch querystring parameter, using cmi5"),objLMS=new LMSStandardAPI("CMI5"),blnLmsPresent=!0):(WriteToDebug("Did not find fetch querystring parameter, using Tin Can"),objLMS=new LMSStandardAPI("TCAPI"),blnLmsPresent=!0,strLMSStandard="TCAPI");else{WriteToDebug("Auto-detecting standard - Searching for SCORM 2004 API");try{r=SCORM2004_GrabAPI()}catch(e){WriteToDebug("Error grabbing 2004 API-"+e.name+":"+e.message)}if(void 0!==r&&null!=r)WriteToDebug("Found SCORM 2004 API, using SCORM 2004"),objLMS=new LMSStandardAPI("SCORM2004"),blnLmsPresent=!0;else{WriteToDebug("Searching for SCORM 1.2 API");try{r=SCORM_GrabAPI()}catch(e){WriteToDebug("Error grabbing 1.2 API-"+e.name+":"+e.message)}if(void 0!==r&&null!=r)WriteToDebug("Found SCORM API, using SCORM"),objLMS=new LMSStandardAPI("SCORM"),blnLmsPresent=!0;else{if(!0!==ALLOW_NONE_STANDARD)return WriteToDebug("Could not determine standard, Stand Alone is disabled in configuration"),void DisplayError("Could not determine standard. SCORM, AICC, Tin Can, and CMI5 APIs could not be found");WriteToDebug("Could not determine standard, defaulting to Stand Alone"),objLMS=new LMSStandardAPI("NONE")}}}else WriteToDebug("Using Standard From Configuration File - "+strLMSStandard),objLMS=new LMSStandardAPI(strLMSStandard),blnLmsPresent=!0;(ConvertStringToBoolean(t)||void 0!==SHOW_DEBUG_ON_LAUNCH&&!0===SHOW_DEBUG_ON_LAUNCH)&&(WriteToDebug("Showing Interactive Debug Windows"),ShowDebugWindow()),WriteToDebug("Calling Standard Initialize"),"TCAPI"==strLMSStandard.toUpperCase()?loadScript("../tc-config.js",objLMS.Initialize):objLMS.Initialize(),TouchCloud()}function InitializeExecuted(e,t){if(WriteToDebug("In InitializeExecuted, blnSuccess="+e+", strErrorMessage="+t),!e)return WriteToDebug("ERROR - LMS Initialize Failed"),""==t&&(t="An Error Has Occurred"),blnLmsPresent=!1,void DisplayError(t);"AICC"==objLMS.Standard&&AICC_InitializeExecuted(),blnLoaded=!0,dtmStart=new Date,LoadContent()}function ExecFinish(e){return WriteToDebug("In ExecFinish, ExiType="+e),ClearErrorInfo(),!(blnLoaded&&!blnCalledFinish)||(WriteToDebug("Haven't called finish before, finishing"),blnCalledFinish=!0,blnReachedEnd&&!EXIT_SUSPEND_IF_COMPLETED&&(WriteToDebug("Reached End, overiding exit type to FINISH"),e=EXIT_TYPE_FINISH),1==EXIT_NORMAL_IF_PASSED&&objLMS.GetStatus()==LESSON_STATUS_PASSED&&(WriteToDebug("Passed status and config value set, overiding exit type to FINISH"),e=EXIT_TYPE_FINISH),blnOverrodeTime||(WriteToDebug("Did not override time"),dtmEnd=new Date,AccumulateTime(),objLMS.SaveTime(intAccumulatedMS)),blnLoaded=!1,WriteToDebug("Calling LMS Finish"),objLMS.Finish(e,blnStatusWasSet))}function IsLoaded(){return WriteToDebug("In IsLoaded, returning -"+blnLoaded),blnLoaded}function WriteToDebug(e){if(blnDebug){var t,r=new Date;t=aryDebug.length+":"+r.toString()+" - "+e,aryDebug[aryDebug.length]=t,winDebug&&!winDebug.closed&&(winDebug.document.body.appendChild(winDebug.document.createTextNode(t)),winDebug.document.body.appendChild(winDebug.document.createElement("br")))}}function ShowDebugWindow(){var e=function(){var e,t=aryDebug.length;for(winDebug.document.body.innerHTML="",e=0;e<t;e+=1)winDebug.document.body.appendChild(winDebug.document.createTextNode(aryDebug[e])),winDebug.document.body.appendChild(winDebug.document.createElement("br"))};winDebug&&!winDebug.closed&&winDebug.close(),null===(winDebug=window.open("blank.html","Debug","width=600,height=300,resizable,scrollbars"))?alert("Debug window could not be opened, popup blocker in place?"):((winDebug.addEventListener||winDebug.attachEvent)&&winDebug[winDebug.addEventListener?"addEventListener":"attachEvent"]((winDebug.attachEvent?"on":"")+"load",e,!1),e(),winDebug.document.close(),winDebug.focus())}function DisplayError(e){WriteToDebug("In DisplayError, strMessage="+e),confirm("An error has occurred:\n\n"+e+"\n\nPress 'OK' to view debug information to send to technical support.")&&ShowDebugWindow()}function GetLastError(){return WriteToDebug("In GetLastError, intError="+intError),intError!=NO_ERROR?(WriteToDebug("Returning API Error"),intError):IsLoaded()&&objLMS.GetLastError()!=NO_ERROR?(WriteToDebug("Returning LMS Error"),ERROR_LMS):(WriteToDebug("Returning No Error"),NO_ERROR)}function GetLastLMSErrorCode(){WriteToDebug("In GetLastLMSErrorCode, intError="+intError);var e=objLMS.GetLastError();return IsLoaded()&&e!=NO_ERROR?(WriteToDebug("Returning LMS Error: "+e),e):(WriteToDebug("Returning No Error"),NO_ERROR)}function GetLastErrorDesc(){return WriteToDebug("In GetLastErrorDesc"),intError!=NO_ERROR?(WriteToDebug("Returning API Error - "+strErrorDesc),strErrorDesc):IsLoaded()&&objLMS.GetLastError()!=NO_ERROR?(WriteToDebug("Returning LMS Error"),objLMS.GetLastErrorDesc()):(WriteToDebug("Returning No Error"),"")}function SetErrorInfo(e,t){WriteToDebug("In SetErrorInfo - Num="+e+" Desc="+t),intError=e,strErrorDesc=t}function ClearErrorInfo(){WriteToDebug("In ClearErrorInfo")}function CommitData(){return WriteToDebug("In CommitData"),ClearErrorInfo(),IsLoaded()?(blnOverrodeTime||(WriteToDebug("Did not override time, saving incremental time"),dtmEnd=new Date,AccumulateTime(),dtmStart=new Date,objLMS.SaveTime(intAccumulatedMS)),objLMS.CommitData()):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function Suspend(){return WriteToDebug("In Suspend"),ClearErrorInfo(),ExecFinish(EXIT_TYPE_SUSPEND)}function Finish(){return WriteToDebug("In Finish"),ClearErrorInfo(),ExecFinish(EXIT_TYPE_FINISH)}function TimeOut(){return WriteToDebug("In TimeOut"),ClearErrorInfo(),ExecFinish(EXIT_TYPE_TIMEOUT)}function Unload(){return WriteToDebug("In Unload"),ClearErrorInfo(),blnUnloading=!0,ExecFinish(DEFAULT_EXIT_TYPE)}function SetReachedEnd(){return WriteToDebug("In SetReachedEnd"),ClearErrorInfo(),IsLoaded()?(0==blnStatusWasSet&&objLMS.SetCompleted(),blnReachedEnd=!0,!0):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function ConcedeControl(){if(WriteToDebug("Conceding control with type: "+EXIT_BEHAVIOR),ClearErrorInfo(),void 0!==objLMS.ConcedeControl)return Suspend(),objLMS.ConcedeControl();var e=null,t=null;switch(EXIT_BEHAVIOR){case"SCORM_RECOMMENDED":(e=SearchParentsForContentRoot())==window.top?(Suspend(),e.window.close()):(Suspend(),null!=e&&(IsAbsoluteUrl(EXIT_TARGET)?e.scormdriver_content.location.href=EXIT_TARGET:(t=GetContentRootUrlBase(e),e.scormdriver_content.location.href=t+EXIT_TARGET)));break;case"ALWAYS_CLOSE":Suspend(),window.close();break;case"ALWAYS_CLOSE_TOP":Suspend(),window.top.close();break;case"ALWAYS_CLOSE_PARENT":Suspend(),window.parent.close();break;case"NOTHING":Suspend();break;case"REDIR_CONTENT_FRAME":Suspend(),null!=(e=SearchParentsForContentRoot())&&(IsAbsoluteUrl(EXIT_TARGET)?e.scormdriver_content.location.href=EXIT_TARGET:(t=GetContentRootUrlBase(e),e.scormdriver_content.location.href=t+EXIT_TARGET))}return!0}function GetContentRootUrlBase(e){var t=e.location.href.split("?")[0].split("/");return delete t[t.length-1],e=t.join("/")}function SearchParentsForContentRoot(){var e=null,t=window,r=0;if(t.scormdriver_content)return e=t;for(;null==e&&t!=window.top&&r++<100;){if(t.scormdriver_content)return e=t;t=t.parent}return WriteToDebug("Unable to locate content root"),null}function GetStudentID(){return WriteToDebug("In GetStudentID"),ClearErrorInfo(),IsLoaded()?objLMS.GetStudentID():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function GetStudentName(){return WriteToDebug("In GetStudentName"),ClearErrorInfo(),IsLoaded()?objLMS.GetStudentName():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function GetBookmark(){return WriteToDebug("In GetBookmark"),ClearErrorInfo(),IsLoaded()?objLMS.GetBookmark():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function SetBookmark(e,t){return WriteToDebug("In SetBookmark - strBookmark="+e+", strDesc="+t),ClearErrorInfo(),IsLoaded()?objLMS.SetBookmark(e,t):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetDataChunk(){return WriteToDebug("In GetDataChunk"),ClearErrorInfo(),IsLoaded()?objLMS.GetDataChunk():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function SetDataChunk(e){return WriteToDebug("In SetDataChunk strData="+e),ClearErrorInfo(),IsLoaded()?objLMS.SetDataChunk(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetLaunchData(){return WriteToDebug("In GetLaunchData"),ClearErrorInfo(),IsLoaded()?objLMS.GetLaunchData():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function GetComments(){var e,t,r;if(WriteToDebug("In GetComments"),ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),null;if(WriteToDebug("strCommentString="+(e=objLMS.GetComments())),""!=(e=new String(e)))for(t=e.split(" | "),r=0;r<t.length;r++)WriteToDebug("Returning Comment #"+r),t[r]=new String(t[r]),t[r]=t[r].replace(/\|\|/g,"|"),WriteToDebug("Comment #"+r+"="+t[r]);else t=new Array(0);return t}function WriteComment(e){var t;return WriteToDebug("In WriteComment strComment="+e),ClearErrorInfo(),e=new String(e),IsLoaded()?(e=e.replace(/\|/g,"||"),""!=(t=objLMS.GetComments())&&"undefined"!=t&&(e=t+" | "+e),objLMS.WriteComment(e)):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetLMSComments(){return WriteToDebug("In GetLMSComments"),ClearErrorInfo(),IsLoaded()?objLMS.GetLMSComments():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function GetAudioPlayPreference(){return WriteToDebug("In GetAudioPlayPreference"),ClearErrorInfo(),IsLoaded()?objLMS.GetAudioPlayPreference():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),PREFERENCE_DEFAULT)}function GetAudioVolumePreference(){return WriteToDebug("GetAudioVolumePreference"),ClearErrorInfo(),IsLoaded()?objLMS.GetAudioVolumePreference():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),100)}function SetAudioPreference(e,t){return WriteToDebug("In SetAudioPreference PlayPreference="+e+" intPercentOfMaxVolume="+t),ClearErrorInfo(),IsLoaded()?e!=PREFERENCE_OFF&&e!=PREFERENCE_ON?(WriteToDebug("Error Invalid PlayPreference"),SetErrorInfo(ERROR_INVALID_PREFERENCE,"Invalid PlayPreference passed to SetAudioPreference, PlayPreference="+e),!1):ValidInteger(t)?(t=parseInt(t,10))<1||t>100?(WriteToDebug("Error Invalid PercentOfMaxVolume - out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid PercentOfMaxVolume passed to SetAudioPreference (must be between 1 and 100), intPercentOfMaxVolume="+t),!1):(WriteToDebug("Calling to LMS"),objLMS.SetAudioPreference(e,t)):(WriteToDebug("Error Invalid PercentOfMaxVolume - not an integer"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid PercentOfMaxVolume passed to SetAudioPreference (not an integer), intPercentOfMaxVolume="+t),!1):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetLanguagePreference(){return WriteToDebug("In GetLanguagePreference"),ClearErrorInfo(),IsLoaded()?objLMS.GetLanguagePreference():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),"")}function SetLanguagePreference(e){return WriteToDebug("In SetLanguagePreference strLanguage="+e),ClearErrorInfo(),IsLoaded()?objLMS.SetLanguagePreference(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetSpeedPreference(){return WriteToDebug("In GetSpeedPreference"),ClearErrorInfo(),IsLoaded()?objLMS.GetSpeedPreference():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),100)}function SetSpeedPreference(e){return WriteToDebug("In SetSpeedPreference intPercentOfMax="+e),ClearErrorInfo(),IsLoaded()?ValidInteger(e)?(e=parseInt(e,10))<0||e>100?(WriteToDebug("ERROR Invalid Percent of MaxSpeed, out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid PercentOfMaxSpeed passed to SetSpeedPreference (must be between 1 and 100), intPercentOfMax="+e),!1):(WriteToDebug("Calling to LMS"),objLMS.SetSpeedPreference(e)):(WriteToDebug("ERROR Invalid Percent of MaxSpeed, not an integer"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid PercentOfMaxSpeed passed to SetSpeedPreference (not an integer), intPercentOfMax="+e),!1):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetTextPreference(){return WriteToDebug("In GetTextPreference"),ClearErrorInfo(),IsLoaded()?objLMS.GetTextPreference():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetTextPreference(e){return WriteToDebug("In SetTextPreference intPreference="+e),ClearErrorInfo(),IsLoaded()?e!=PREFERENCE_DEFAULT&&e!=PREFERENCE_OFF&&e!=PREFERENCE_ON?(WriteToDebug("Error - Invalid Preference"),SetErrorInfo(ERROR_INVALID_PREFERENCE,"Invalid Preference passed to SetTextPreference, intPreference="+e),!1):objLMS.SetTextPreference(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetPreviouslyAccumulatedTime(){return WriteToDebug("In GetPreviouslyAccumulatedTime"),ClearErrorInfo(),IsLoaded()?objLMS.GetPreviouslyAccumulatedTime():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),0)}function AccumulateTime(){WriteToDebug("In AccumulateTime dtmStart="+dtmStart+" dtmEnd="+dtmEnd+" intAccumulatedMS="+intAccumulatedMS),null!=dtmEnd&&null!=dtmStart&&(WriteToDebug("Accumulating Time"),WriteToDebug("intAccumulatedMS="+(intAccumulatedMS+=dtmEnd.getTime()-dtmStart.getTime())))}function GetSessionAccumulatedTime(){return WriteToDebug("In GetSessionAccumulatedTime"),ClearErrorInfo(),WriteToDebug("Setting dtmEnd to now"),dtmEnd=new Date,WriteToDebug("Accumulating Time"),AccumulateTime(),null!=dtmStart&&(WriteToDebug("Resetting dtmStart"),dtmStart=new Date),WriteToDebug("Setting dtmEnd to null"),dtmEnd=null,WriteToDebug("Returning "+intAccumulatedMS),intAccumulatedMS}function SetSessionTime(e){return WriteToDebug("In SetSessionTime"),ClearErrorInfo(),ValidInteger(e)?(e=parseInt(e,10))<0?(WriteToDebug("Error, parameter is less than 0"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMilliseconds passed to SetSessionTime (must be greater than 0), intMilliseconds="+e),!1):(blnOverrodeTime=!0,intTimeOverrideMS=e,objLMS.SaveTime(intTimeOverrideMS),!0):(WriteToDebug("ERROR parameter is not an integer"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMilliseconds passed to SetSessionTime (not an integer), intMilliseconds="+e),!1)}function PauseTimeTracking(){return WriteToDebug("In PauseTimeTracking"),ClearErrorInfo(),WriteToDebug("Setting dtmEnd to now"),dtmEnd=new Date,WriteToDebug("Accumulating Time"),AccumulateTime(),WriteToDebug("Setting Start and End times to null"),dtmStart=null,dtmEnd=null,!0}function ResumeTimeTracking(){return WriteToDebug("In ResumeTimeTracking"),ClearErrorInfo(),WriteToDebug("Setting dtmStart to now"),dtmStart=new Date,!0}function GetMaxTimeAllowed(){return WriteToDebug("In GetMaxTimeAllowed"),ClearErrorInfo(),IsLoaded()?objLMS.GetMaxTimeAllowed():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),MAX_CMI_TIME)}function DisplayMessageOnTimeout(){return WriteToDebug("In DisplayMessageOnTimeOut"),ClearErrorInfo(),IsLoaded()?objLMS.DisplayMessageOnTimeout():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function ExitOnTimeout(){return WriteToDebug("In ExitOnTimeOut"),ClearErrorInfo(),IsLoaded()?objLMS.ExitOnTimeout():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetPassingScore(){return WriteToDebug("In GetPassingScore"),ClearErrorInfo(),IsLoaded()?objLMS.GetPassingScore():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),0)}function GetScore(){return WriteToDebug("In GetScore"),ClearErrorInfo(),IsLoaded()?objLMS.GetScore():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),0)}function GetScaledScore(){return WriteToDebug("In GetScaledScore"),ClearErrorInfo(),IsLoaded()?objLMS.GetScaledScore():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),0)}function SetScore(e,t,r){if(WriteToDebug("In SetScore, intScore="+e+", intMaxScore="+t+", intMinScore="+r),ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;if(!IsValidDecimal(e))return WriteToDebug("ERROR - intScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (not a valid decimal), intScore="+e),!1;if(!IsValidDecimal(t))return WriteToDebug("ERROR - intMaxScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (not a valid decimal), intMaxScore="+t),!1;if(!IsValidDecimal(r))return WriteToDebug("ERROR - intMinScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (not a valid decimal), intMinScore="+r),!1;if(WriteToDebug("Converting SCORES to floats"),e=parseFloat(e),t=parseFloat(t),r=parseFloat(r),"SCORM"==strLMSStandard){if(WriteToDebug("DEBUG - SCORM 1.2 so checking max score length"),e<0||e>100)return WriteToDebug("ERROR - intScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (must be between 0-100), intScore="+e),!1;if(t<0||t>100)return WriteToDebug("ERROR - intMaxScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (must be between 0-100), intMaxScore="+t),!1;if(r<0||r>100)return WriteToDebug("ERROR - intMinScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (must be between 0-100), intMinScore="+r),!1}if(!0===SCORE_CAN_ONLY_IMPROVE){var n=GetScore();if(null!=n&&""!=n&&n>e)return WriteToDebug("Previous score was greater than new score, configuration only allows scores to improve, returning."),!0}return WriteToDebug("Calling to LMS"),objLMS.SetScore(e,t,r)}function SetPointBasedScore(e,t,r){if(WriteToDebug("In SetPointBasedScore, intScore="+e+", intMaxScore="+t+", intMinScore="+r),ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;if(!IsValidDecimal(e))return WriteToDebug("ERROR - intScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (not a valid decimal), intScore="+e),!1;if(!IsValidDecimal(t))return WriteToDebug("ERROR - intMaxScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (not a valid decimal), intMaxScore="+t),!1;if(!IsValidDecimal(r))return WriteToDebug("ERROR - intMinScore not a valid decimal"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (not a valid decimal), intMinScore="+r),!1;if(WriteToDebug("Converting SCORES to floats"),e=parseFloat(e),t=parseFloat(t),r=parseFloat(r),"SCORM"==strLMSStandard){if(e<0||e>100)return WriteToDebug("ERROR - intScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (must be between 0-100), intScore="+e),!1;if(t<0||t>100)return WriteToDebug("ERROR - intMaxScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (must be between 0-100), intMaxScore="+t),!1;if(r<0||r>100)return WriteToDebug("ERROR - intMinScore out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (must be between 0-100), intMinScore="+r),!1}if(!0===SCORE_CAN_ONLY_IMPROVE){var n=GetScore();if(null!=n&&""!=n&&n>e)return WriteToDebug("Previous score was greater than new score, configuration only allows scores to improve, returning."),!0}return WriteToDebug("Calling to LMS"),objLMS.SetPointBasedScore(e,t,r)}function CreateResponseIdentifier(e,t){return""==e.replace(" ","")?(WriteToDebug("Short Identifier is empty"),SetErrorInfo(ERROR_INVALID_ID,"Invalid short identifier, strShort="+e),!1):1!=e.length?(WriteToDebug("ERROR - Short Identifier  not 1 character"),SetErrorInfo(ERROR_INVALID_ID,"Invalid short identifier, strShort="+e),!1):IsAlphaNumeric(t)?new ResponseIdentifier(e=e.toLowerCase(),t=CreateValidIdentifier(t)):(WriteToDebug("ERROR - Short Identifier  not alpha numeric"),SetErrorInfo(ERROR_INVALID_ID,"Invalid short identifier, strLong="+t),!1)}function ResponseIdentifier(e,t){this.Short=new String(e),this.Long=new String(t),this.toString=function(){return"[Response Identifier "+this.Short+", "+this.Long+"]"}}function MatchingResponse(e,t){e.constructor==String&&(e=CreateResponseIdentifier(e,e)),t.constructor==String&&(t=CreateResponseIdentifier(t,t)),this.Source=e,this.Target=t,this.toString=function(){return"[Matching Response "+this.Source+", "+this.Target+"]"}}function CreateMatchingResponse(e){var t=new Array,r=new Array;t=(e=new String(e)).split("[,]");for(var n=0;n<t.length;n++){WriteToDebug("Matching Response ["+n+"]  source: "+(r=new String(t[n]).split("[.]"))[0]+"  target: "+r[1]),t[n]=new MatchingResponse(r[0],r[1])}return WriteToDebug("pattern: "+e+" becomes "+t[0]),0==t.length?t[0]:t}function CreateValidIdentifier(e){return objLMS.CreateValidIdentifier(e)}function CreateUriIdentifier(e,t){if(null==e||""===e)return"";e=Trim(e);var r=new URI(e);return r.is("absolute")||(e=URI_IDENTIFIER_PREFIX+encodeURIComponent(e),r=new URI(e)),r.normalize(),t&&r.iri(),r.toString()}function CreateValidIdentifierLegacy(e){return null!=e||""!=e?(e=new String(e),0==(e=Trim(e)).toLowerCase().indexOf("urn:")&&(e=e.substr(4)),e=e.replace(/[^\w\-\(\)\+\.\:\=\@\;\$\_\!\*\'\%]/g,"_")):""}function Trim(e){return e=(e=(e+="").replace(/^\s*/,"")).replace(/\s*$/,"")}function RecordTrueFalseInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordTrueFalseInteraction strID="+(e=CreateValidIdentifier(e))+", blnResponse="+t+", blnCorrect="+r+", blnCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;if(1!=t&&0!=t&&null!==t||null===t&&!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The Response parameter must be a valid boolean value."),!1;if(null!=n&&1!=n&&0!=n)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The Correct Response parameter must be a valid boolean value or null."),!1;var u=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordTrueFalseInteraction(e,t,r,n,i,o,a,s,u)}function RecordMultipleChoiceInteraction(e,t,r,n,i,o,a,s,u){if(WriteToDebug("In RecordMultipleChoiceInteraction strID="+(e=CreateValidIdentifier(e))+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))+", choices="+JSON.stringify(u)),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var c,l;if(e=new String(e),null===t){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"),!1;c=null}else if(t.constructor==String){c=new Array;var C=CreateResponseIdentifier(t,t);if(0==C)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;c[0]=C}else if(t.constructor==ResponseIdentifier)(c=new Array)[0]=t;else if(t.constructor==Array||t.constructor.toString().search("Array")>0)c=t;else{if(!(window.console&&"(Internal Function)"==t.constructor.toString()&&t.length>0))return window.console&&window.console.log("ERROR_INVALID_INTERACTION_RESPONSE :: The response is not in the correct format."),SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;c=t}if(null!=n&&null!=n&&""!=n)if(n.constructor==String){if(l=new Array,0==(C=CreateResponseIdentifier(n,n)))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format"),!1;l[0]=C}else if(n.constructor==ResponseIdentifier)(l=new Array)[0]=n;else if(n.constructor==Array||n.constructor.toString().search("Array")>0)l=n;else{if(!(window.console&&"(Internal Function)"==n.constructor.toString()&&n.length>0))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format"),!1;l=n}else l=new Array;var I=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordMultipleChoiceInteraction(e,c,r,l,i,o,a,s,I,u)}function RecordFillInInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordFillInInteraction strID="+(e=CreateValidIdentifier(e))+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var u=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordFillInInteraction(e,t,r,n,i,o,a,s,u)}function RecordMatchingInteraction(e,t,r,n,i,o,a,s,u){if(WriteToDebug("In RecordMatchingInteraction strID="+(e=CreateValidIdentifier(e))+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))+", choices="+JSON.stringify(u)),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var c,l;if(null===t){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"),!1;c=null}else if(t.constructor==MatchingResponse)(c=new Array)[0]=t;else if(t.constructor==Array||t.constructor.toString().search("Array")>0)c=t;else{if(!(window.console&&"(Internal Function)"==t.constructor.toString()&&t.length>0))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;c=t}if(null!=n&&null!=n)if(n.constructor==MatchingResponse)(l=new Array)[0]=n;else if(n.constructor==Array||n.constructor.toString().search("Array")>0)l=n;else{if(!(window.console&&"(Internal Function)"==n.constructor.toString()&&n.length>0))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;l=n}else l=new Array;var C=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordMatchingInteraction(e,c,r,l,i,o,a,s,C,u)}function RecordPerformanceInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordPerformanceInteraction strID="+(e=CreateValidIdentifier(e))+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var u=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordPerformanceInteraction(e,t,r,n,i,o,a,s,u)}function RecordSequencingInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordSequencingInteraction strID="+(e=CreateValidIdentifier(e))+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var u,c;if(null===t){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"),!1;u=null}else if(t.constructor==String){u=new Array;var l=CreateResponseIdentifier(t,t);if(0==l)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;u[0]=l}else if(t.constructor==ResponseIdentifier)(u=new Array)[0]=t;else if(t.constructor==Array||t.constructor.toString().search("Array")>0)u=t;else{if(!(window.console&&"(Internal Function)"==t.constructor.toString()&&t.length>0))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;u=t}if(null!=n&&null!=n&&""!=n)if(n.constructor==String){if(c=new Array,0==(l=CreateResponseIdentifier(n,n)))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format"),!1;c[0]=l}else if(n.constructor==ResponseIdentifier)(c=new Array)[0]=n;else if(n.constructor==Array||n.constructor.toString().search("Array")>0)c=n;else{if(!(window.console&&"(Internal Function)"==n.constructor.toString()&&n.length>0))return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format"),!1;c=n}else c=new Array;var C=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordSequencingInteraction(e,u,r,c,i,o,a,s,C)}function RecordLikertInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordLikertInteraction strID="+(e=CreateValidIdentifier(e))+", response="+t+", blnCorrect="+r+", correctResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;var u,c;if(null===t){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"),!1;u=null}else if(t.constructor==String)u=CreateResponseIdentifier(t,t);else{if(t.constructor!=ResponseIdentifier)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;u=t}if(null==n||null==n)c=null;else if(n.constructor==ResponseIdentifier)c=n;else{if(n.constructor!=String)return SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"),!1;c=CreateResponseIdentifier(n,n)}var l=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordLikertInteraction(e,u,r,c,i,o,a,s,l)}function RecordNumericInteraction(e,t,r,n,i,o,a,s){if(WriteToDebug("In RecordNumericInteraction strID="+(e=CreateValidIdentifier(e))+", strResponse="+t+", blnCorrect="+r+", strCorrectResponse="+n+", strDescription="+i+", intWeighting="+o+", intLatency="+a+", strLearningObjectiveID="+(s=CreateValidIdentifier(s))),void 0!==DO_NOT_REPORT_INTERACTIONS&&!0===DO_NOT_REPORT_INTERACTIONS)return WriteToDebug("Configuration specifies interactions should not be reported, exiting."),!0;if(ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;if(null===t&&!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE||null!==t&&!IsValidDecimal(t))return WriteToDebug("ERROR - Invalid Response, not a valid decmial"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Response passed to RecordNumericInteraction (not a valid decimal), strResponse="+t),!1;var u=new Date;return WriteToDebug("Calling to LMS"),objLMS.RecordNumericInteraction(e,t,r,n,i,o,a,s,u)}function GetStatus(){return WriteToDebug("In GetStatus"),ClearErrorInfo(),IsLoaded()?objLMS.GetStatus():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),LESSON_STATUS_INCOMPLETE)}function ResetStatus(){return WriteToDebug("In ResetStatus"),ClearErrorInfo(),IsLoaded()?(WriteToDebug("Setting blnStatusWasSet to false"),blnStatusWasSet=!1,objLMS.ResetStatus()):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetProgressMeasure(){return WriteToDebug("In GetProgressMeasure"),ClearErrorInfo(),IsLoaded()?objLMS.GetProgressMeasure():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),LESSON_STATUS_INCOMPLETE)}function SetProgressMeasure(e){return WriteToDebug("In SetProgressMeasure, passing in: "+e),ClearErrorInfo(),IsLoaded()?objLMS.SetProgressMeasure(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),LESSON_STATUS_INCOMPLETE)}function SetPassed(){return WriteToDebug("In SetPassed"),ClearErrorInfo(),IsLoaded()?(WriteToDebug("Setting blnStatusWasSet to true"),blnStatusWasSet=!0,objLMS.SetPassed()):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetFailed(){return WriteToDebug("In SetFailed"),ClearErrorInfo(),IsLoaded()?(WriteToDebug("Setting blnStatusWasSet to true"),blnStatusWasSet=!0,objLMS.SetFailed()):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetEntryMode(){return WriteToDebug("In GetEntryMode"),ClearErrorInfo(),IsLoaded()?objLMS.GetEntryMode():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),ENTRY_FIRST_TIME)}function GetLessonMode(){return WriteToDebug("In GetLessonMode"),ClearErrorInfo(),IsLoaded()?objLMS.GetLessonMode():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),MODE_NORMAL)}function GetTakingForCredit(){return WriteToDebug("In GetTakingForCredit"),ClearErrorInfo(),IsLoaded()?objLMS.GetTakingForCredit():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetObjectiveScore(e,t,r,n){return WriteToDebug("In SetObjectiveScore, intObjectiveID="+e+", intScore="+t+", intMaxScore="+r+", intMinScore="+n),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid ObjectiveID, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveScore (must have a value), strObjectiveID="+e),!1):IsValidDecimal(t)?IsValidDecimal(r)?IsValidDecimal(n)?(WriteToDebug("Converting Scores to floats"),t=parseFloat(t),r=parseFloat(r),n=parseFloat(n),t<0||t>100?(WriteToDebug("ERROR - Invalid Score, out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetObjectiveScore (must be between 0-100), intScore="+t),!1):r<0||r>100?(WriteToDebug("ERROR - Invalid Max Score, out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetObjectiveScore (must be between 0-100), intMaxScore="+r),!1):n<0||n>100?(WriteToDebug("ERROR - Invalid Min Score, out of range"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetObjectiveScore (must be between 0-100), intMinScore="+n),!1):(WriteToDebug("Calling To LMS"),objLMS.SetObjectiveScore(e,t,r,n))):(WriteToDebug("ERROR - Invalid Min Score, not a valid decmial"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetObjectiveScore (not a valid decimal), intMinScore="+n),!1):(WriteToDebug("ERROR - Invalid Max Score, not a valid decmial"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetObjectiveScore (not a valid decimal), intMaxScore="+r),!1):(WriteToDebug("ERROR - Invalid Score, not a valid decmial"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetObjectiveScore (not a valid decimal), intScore="+t),!1):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetObjectiveStatus(e,t){return WriteToDebug("In SetObjectiveStatus strObjectiveID="+e+", Lesson_Status="+t),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid ObjectiveID, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveStatus (must have a value), strObjectiveID="+e),!1):t!=LESSON_STATUS_PASSED&&t!=LESSON_STATUS_COMPLETED&&t!=LESSON_STATUS_FAILED&&t!=LESSON_STATUS_INCOMPLETE&&t!=LESSON_STATUS_BROWSED&&t!=LESSON_STATUS_NOT_ATTEMPTED?(WriteToDebug("ERROR - Invalid Status"),SetErrorInfo(ERROR_INVALID_STATUS,"Invalid status passed to SetObjectiveStatus, Lesson_Status="+t),!1):(WriteToDebug("Calling To LMS"),objLMS.SetObjectiveStatus(e,t)):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetObjectiveStatus(e){return WriteToDebug("In GetObjectiveStatus, strObjectiveID="+e),ClearErrorInfo(),IsLoaded()?objLMS.GetObjectiveStatus(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetObjectiveDescription(e,t){return WriteToDebug("In SetObjectiveDescription strObjectiveID="+e+", strObjectiveDescription="+t),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid ObjectiveID, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveStatus (must have a value), strObjectiveID="+e),!1):(WriteToDebug("Calling To LMS"),objLMS.SetObjectiveDescription(e,t)):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetObjectiveDescription(e){return WriteToDebug("In GetObjectiveDescription, strObjectiveID="+e),ClearErrorInfo(),IsLoaded()?objLMS.GetObjectiveDescription(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetObjectiveScore(e){return WriteToDebug("In GetObjectiveScore, strObjectiveID="+e),ClearErrorInfo(),IsLoaded()?objLMS.GetObjectiveScore(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function IsLmsPresent(){return blnLmsPresent}function SetObjectiveProgressMeasure(e,t){return WriteToDebug("In SetObjectiveProgressMeasure strObjectiveID="+e+", strObjectiveProgressMeasure="+t),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid ObjectiveID, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveProgressMeasure (must have a value), strObjectiveID="+e),!1):(WriteToDebug("Calling To LMS"),objLMS.SetObjectiveProgressMeasure(e,t)):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetObjectiveProgressMeasure(e){return WriteToDebug("In GetObjectiveProgressMeasure, strObjectiveID="+e),ClearErrorInfo(),IsLoaded()?objLMS.GetObjectiveProgressMeasure(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function SetNavigationRequest(e){return WriteToDebug("In SetNavigationRequest"),ClearErrorInfo(),IsLoaded()?objLMS.SetNavigationRequest(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetNavigationRequest(){return WriteToDebug("In GetNavigationRequest"),ClearErrorInfo(),IsLoaded()?objLMS.GetNavigationRequest():(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionType(e){return WriteToDebug("In GetInteractionType, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionType(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionTimestamp(e){return WriteToDebug("In GetInteractionTimestamp, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionTimestamp(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionCorrectResponses(e){return WriteToDebug("In GetInteractionCorrectResponses, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionCorrectResponses(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionWeighting(e){return WriteToDebug("In GetInteractionWeighting, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionWeighting(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionLearnerResponses(e){return WriteToDebug("In GetInteractionLearnerResponses, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionLearnerResponses(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionResult(e){return WriteToDebug("In GetInteractionResult, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionResult(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionLatency(e){return WriteToDebug("In GetInteractionLatency, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionLatency(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetInteractionDescription(e){return WriteToDebug("In GetInteractionDescription, strInteractionID="+(e=CreateValidIdentifier(e))),ClearErrorInfo(),IsLoaded()?objLMS.GetInteractionDescription(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function CreateDataBucket(e,t,r){return WriteToDebug("In CreateDataBucket, strBucketId="+e+", intMinSize="+t+", intMaxSize="+r),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid BucketId, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to CreateDataBucket (must have a value), strBucketId="+e),!1):ValidInteger(t)?ValidInteger(r)?(t=parseInt(t,10),r=parseInt(r,10),t<0?(WriteToDebug("ERROR Invalid Min Size, must be greater than or equal to 0"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Size passed to CreateDataBucket (must be greater than or equal to 0), intMinSize="+t),!1):r<=0?(WriteToDebug("ERROR Invalid Max Size, must be greater than 0"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Size passed to CreateDataBucket (must be greater than 0), intMaxSize="+r),!1):(t*=2,r*=2,objLMS.CreateDataBucket(e,t,r))):(WriteToDebug("ERROR Invalid Max Size, not an integer"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMaxSize passed to CreateDataBucket (not an integer), intMaxSize="+r),!1):(WriteToDebug("ERROR Invalid Min Size, not an integer"),SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMinSize passed to CreateDataBucket (not an integer), intMinSize="+t),!1):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function GetDataFromBucket(e){return WriteToDebug("In GetDataFromBucket, strBucketId="+e),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid BucketId, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to GetDataFromBucket (must have a value), strBucketId="+e),!1):objLMS.GetDataFromBucket(e):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function PutDataInBucket(e,t,r){return WriteToDebug("In PutDataInBucket, strBucketId="+e+", blnAppendToEnd="+r+", strData="+t),ClearErrorInfo(),IsLoaded()?""==(e=new String(e)).replace(" ","")?(WriteToDebug("ERROR - Invalid BucketId, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to PutDataInBucket (must have a value), strBucketId="+e),!1):(1!=r&&(WriteToDebug("blnAppendToEnd was not explicitly true so setting it to false, blnAppendToEnd="+r),r=!1),objLMS.PutDataInBucket(e,t,r)):(SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1)}function DetectSSPSupport(){return objLMS.DetectSSPSupport()}function GetBucketInfo(e){if(WriteToDebug("In GetBucketInfo, strBucketId="+e),ClearErrorInfo(),!IsLoaded())return SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start"),!1;if(""==(e=new String(e)).replace(" ",""))return WriteToDebug("ERROR - Invalid BucketId, empty string"),SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to GetBucketInfo (must have a value), strBucketId="+e),!1;var t=objLMS.GetBucketInfo(e);return t.TotalSpace=t.TotalSpace/2,t.UsedSpace=t.UsedSpace/2,WriteToDebug("GetBucketInfo returning "+t),t}function SSPBucketSize(e,t){this.TotalSpace=e,this.UsedSpace=t,this.toString=function(){return"[SSPBucketSize "+this.TotalSpace+", "+this.UsedSpace+"]"}}function SafeExtractResponseId(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(t)if(-1!==(r=e.lastIndexOf("/"))&&0===e.indexOf("http"))return e.substring(r+1);return e}if(null==e)return"";if(t){var r,n=null;if(void 0!==e.Long&&null!==e.Long&&""!==e.Long?n=String(e.Long):void 0!==e.id&&null!==e.id&&""!==e.id?n=String(e.id):void 0!==e.Short&&null!==e.Short&&""!==e.Short&&(n=String(e.Short)),null!==n)return-1!==(r=n.lastIndexOf("/"))&&0===n.indexOf("http")?n.substring(r+1):n}else{if(void 0!==e.Long&&null!==e.Long&&""!==e.Long)return String(e.Long);if(void 0!==e.Short&&null!==e.Short&&""!==e.Short)return String(e.Short);if(void 0!==e.id&&null!==e.id&&""!==e.id)return String(e.id)}try{return String(e)}catch(e){return""}}function TCAPI_GetLanguageTag(){var e="en-US",t=null;WriteToDebug("TCAPI_GetLanguageTag - Starting language detection");try{(t=TCAPI_GetLanguagePreference())&&""!==t&&WriteToDebug("TCAPI_GetLanguageTag - Found TCAPI language preference: "+t)}catch(e){WriteToDebug("TCAPI_GetLanguageTag - TCAPI_GetLanguagePreference failed: "+e)}if(!t||""===t)try{"undefined"!=typeof Runtime&&Runtime.getLocale&&WriteToDebug("TCAPI_GetLanguageTag - Found Runtime.getLocale(): "+(t=Runtime.getLocale()))}catch(e){WriteToDebug("TCAPI_GetLanguageTag - Runtime.getLocale failed: "+e)}if(!t||""===t)try{(t=CMI5_GetLanguagePreference())&&""!==t&&WriteToDebug("TCAPI_GetLanguageTag - Found CMI5 language preference: "+t)}catch(e){WriteToDebug("TCAPI_GetLanguageTag - CMI5_GetLanguagePreference failed: "+e)}if(!t||""===t)try{"undefined"!=typeof window&&window.locale&&WriteToDebug("TCAPI_GetLanguageTag - Found window.locale: "+(t=window.locale))}catch(e){WriteToDebug("TCAPI_GetLanguageTag - window.locale failed: "+e)}return WriteToDebug(t&&"string"==typeof t&&""!==t?"TCAPI_GetLanguageTag - Final normalized language tag: "+(e=TCAPI_NormalizeLanguageTag(t)):"TCAPI_GetLanguageTag - No language preference found, using default: "+e),e}function TCAPI_NormalizeLanguageTag(e){var t={en:"en-US",jp:"ja-JP",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",it:"it-IT",pt:"pt-BR",ru:"ru-RU",zh:"zh-CN","zh-cn":"zh-CN","zh-tw":"zh-TW",ko:"ko-KR",ar:"ar-SA",hi:"hi-IN",th:"th-TH",vi:"vi-VN",nl:"nl-NL",sv:"sv-SE",da:"da-DK",no:"no-NO",fi:"fi-FI",pl:"pl-PL",cs:"cs-CZ",hu:"hu-HU",tr:"tr-TR",he:"he-IL",el:"el-GR"}[e=e.toLowerCase()];return t?(WriteToDebug("TCAPI_NormalizeLanguageTag - mapped '"+e+"' to '"+t+"'"),t):-1!==e.indexOf("-")?(WriteToDebug("TCAPI_NormalizeLanguageTag - using existing format: "+e),e):(WriteToDebug("TCAPI_NormalizeLanguageTag - created generic dialect: "+(t=e+"-"+e.toUpperCase())),t)}function TCAPI_GetStaticActor(){if(WriteToDebug("In TCAPI_GetStaticActor"),void 0===TCAPI_LRS_ACTOR||""===TCAPI_LRS_ACTOR)return WriteToDebug("TCAPI_GetStaticActor - No static actor configured"),null;try{var e=TinCan.Agent.fromJSON(TCAPI_LRS_ACTOR);return WriteToDebug("TCAPI_GetStaticActor - Using static actor: "+TCAPI_LRS_ACTOR),e}catch(e){return WriteToDebug("TCAPI_GetStaticActor - Failed to parse static actor: "+e),null}}function TCAPI_GetStaticLRSConfig(){if(WriteToDebug("In TCAPI_GetStaticLRSConfig"),void 0===TCAPI_LRS_ENDPOINT||""===TCAPI_LRS_ENDPOINT)return WriteToDebug("TCAPI_GetStaticLRSConfig - No static LRS endpoint configured"),null;var e={endpoint:TCAPI_LRS_ENDPOINT,allowFail:!1};return WriteToDebug("TCAPI_GetStaticLRSConfig - Using static endpoint: "+TCAPI_LRS_ENDPOINT),void 0!==TCAPI_LRS_KEY&&""!==TCAPI_LRS_KEY&&void 0!==TCAPI_LRS_SECRET&&""!==TCAPI_LRS_SECRET&&(e.auth="Basic "+btoa(TCAPI_LRS_KEY+":"+TCAPI_LRS_SECRET),WriteToDebug("TCAPI_GetStaticLRSConfig - Generated auth from key/secret")),e}function TCAPI_SendProgressed(e,t){WriteToDebug("In TCAPI_SendProgressed - courseProgress: "+e),TCAPI_ClearErrorInfo();var r=e;if("number"==typeof e&&e>0&&e<1&&WriteToDebug("TCAPI_SendProgressed - Converted decimal progress to percentage: "+(r=Math.round(100*e))),"number"!=typeof r||r<0||r>100)return WriteToDebug("TCAPI_SendProgressed - Invalid progress value: "+e),!1;var n=TCAPI_GetLanguageTag(),i={id:TCAPI_VERB_PROGRESSED_ID,display:{}};i.display[n]=TCAPI_VERB_PROGRESSED;var o={verb:i,result:{extensions:{}}};return o.result.extensions[TCAPI_PROGRESS_EXTENSION]=r,WriteToDebug("TCAPI_SendProgressed - Sending progressed statement with progress: "+r),tincan.sendStatement(o,function(e,r){if(null!==e[0].err)return WriteToDebug("TCAPI_SendProgressed - err: "+e[0].err.responseText+" ("+e[0].err.status+")"),void("function"==typeof t&&t(e[0].err,null));WriteToDebug("TCAPI_SendProgressed - success: "+r.id),"function"==typeof t&&t(null,r)}),!0}function TCAPI_GetActivityIdForStatements(e){WriteToDebug("In TCAPI_GetActivityIdForStatements");var t=TinCan.Utils.parseURL(e),r=TC_COURSE_ID;return t.params&&"activity_id"in t.params?WriteToDebug("TCAPI_GetActivityIdForStatements - using activity_id from URL: "+(r=t.params.activity_id)):WriteToDebug("TCAPI_GetActivityIdForStatements - using TC_COURSE_ID: "+r),r}function CMI5_UpdateVerbDisplayLanguage(e,t){var r,n={};if(WriteToDebug("CMI5_UpdateVerbDisplayLanguage - originalDisplay: "+JSON.stringify(e)),WriteToDebug("CMI5_UpdateVerbDisplayLanguage - target languageTag: "+t),e._template)r=e._template;else if(e["en-US"])r=e["en-US"];else if(e.und)r=e.und;else for(var i in e)if(e.hasOwnProperty(i)){r=e[i];break}return r?(n[t]=r,WriteToDebug("CMI5_UpdateVerbDisplayLanguage - updated display: "+JSON.stringify(n)),n):(WriteToDebug("CMI5_UpdateVerbDisplayLanguage - no verb text found, returning original"),e)}function CMI5_ApplyInteractionDefinitionLanguage(e,t,r,n){var i="en-US";try{i=TCAPI_GetLanguageTag()}catch(e){WriteToDebug("CMI5_ApplyInteractionDefinitionLanguage - language detection failed, using default")}e.description={},e.description[i]=t,e.name={},e.name[i]=t,n&&n.length>0&&"choice"===r&&(e.choices=n.map(function(e){var t={};return t[i]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})})),n&&"object"==typeof n&&"matching"===r&&(n.source&&n.source.length>0&&(e.source=n.source.map(function(e){var t={};return t[i]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})})),n.target&&n.target.length>0&&(e.target=n.target.map(function(e){var t={};return t[i]=e.description,new TinCan.InteractionComponent({id:e.id,description:t})})))}