@liascript/exporter 2.5.6--0.10.30 → 2.5.7--0.10.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ !function(){function t(t,e,i,n){Object.defineProperty(t,e,{get:i,set:n,enumerable:!0,configurable:!0})}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequire55a5;e.register("7MiC9",(function(i,n){t(i.exports,"Connector",(function(){return v}));var r=e("kxanC"),o=e("hWDD9"),s=e("cksMj"),a=e("mBz5n"),c=e("9oGi2"),l=e("giCK6"),u=e("irPpa"),f={SingleChoice:"sc",MultipleChoice:"mc",Text:"tx",Select:"st",Matrix:"mx",Generic:"gn",error_msg:"err"},d=Object.entries(f).reduce((function(t,e){var i=(0,a.default)(e,2),n=i[0];return t[i[1]]=n,t}),{});function h(t,e){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map((function(t){return h(t,e)}));var i={},n=!0,r=!1,o=void 0;try{for(var s,c=Object.entries(t)[Symbol.iterator]();!(n=(s=c.next()).done);n=!0){var l=(0,a.default)(s.value,2),u=l[0],f=l[1];i[e[u]||u]=h(f,e)}}catch(t){r=!0,o=t}finally{try{n||null==c.return||c.return()}finally{if(r)throw o}}return i}var v=function(t){"use strict";(0,s.default)(i,t);var e=(0,l.default)(i);function i(){var t,n;if((0,r.default)(this,i),(t=e.call(this)).active=!1,t.scaled_passing_score=null,t.db={quiz:[],survey:[],task:[]},t.id={quiz:[],survey:[],task:[]},window.API_1484_11||(null===(n=window.top)||void 0===n?void 0:n.API_1484_11)){var o;g("successfully opened API"),t.scorm=window.API_1484_11||(null===(o=window.top)||void 0===o?void 0:o.API_1484_11),g("loading quizzes ...");try{t.db.quiz=window.config_.quiz||[[]],g(" ... done")}catch(t){y("... failed",t)}g("loading surveys ...");try{t.db.survey=window.config_.survey||[[]],g(" ... done")}catch(t){y("... failed",t)}g("loading tasks ...");try{t.db.task=window.config_.task||[[]],g(" ... done")}catch(t){y("... failed",t)}t.init()}else console.warn("SCORM2004: Could not find API");return t}return(0,o.default)(i,[{key:"init",value:function(){if(this.scorm){g("Initialize ",this.scorm.Initialize(""));var t=this.scorm.GetValue("cmi.mode");if(this.active="normal"===t,console.warn("SCORM2004: Running in",t,"mode, results will ",this.active?"":"NOT","be stored!"),this.scaled_passing_score=JSON.parse(this.scorm.GetValue("cmi.scaled_passing_score")),g("open location ..."),this.location=function(t){try{return JSON.parse(t)}catch(t){}return null}(this.scorm.GetValue("cmi.location")),g("... ",this.location),null===this.location){this.slide(0);var e=0;e=this.initFirst("quiz",e),e=this.initFirst("survey",e),e=this.initFirst("task",e)}else{var i=0;i=this.initSecond("quiz",i),i=this.initSecond("survey",i),i=this.initSecond("task",i)}window.SCORE=0,this.score()}}},{key:"initFirst",value:function(t,e){for(var i=0;i<this.db[t].length;i++){this.id[t].push([]);for(var n=0;n<this.db[t][i].length;n++)this.setInteraction(e,"".concat(t,":").concat(i,"-").concat(n)),this.id[t][i].push(e),e++}return e}},{key:"initSecond",value:function(t,e){for(var i=0;i<this.db[t].length;i++){this.id[t].push([]);for(var n=0;n<this.db[t][i].length;n++){var r=this.getInteraction(e);r&&(this.db[t][i][n]=r),this.id[t][i].push(e),e++}}return e}},{key:"open",value:function(t,e,i){null!==this.location&&window.LIA.goto(this.location)}},{key:"load",value:function(t){if(this.active)switch(t.table){case"quiz":case"survey":case"task":return g("loading ",t.table,t.id,this.db.task[t.id]),this.db[t.table][t.id]}}},{key:"store",value:function(t){if(this.active)switch(t.table){case"quiz":this.storeHelper(t),this.score();break;case"survey":case"task":this.storeHelper(t)}}},{key:"storeHelper",value:function(t){for(var e=0;e<this.db[t.table][t.id].length;e++)i=t.data[e],n=this.db[t.table][t.id][e],JSON.stringify(i)!=JSON.stringify(n)&&(this.updateInteraction(this.id[t.table][t.id][e],t.data[e]),this.db[t.table][t.id][e]=t.data[e],"quiz"==t.table&&this.updateQuiz(this.id[t.table][t.id][e],t.data[e]));var i,n}},{key:"score",value:function(){if(this.active&&this.scaled_passing_score){for(var t=0,e=0,i=0,n=0,r=0;r<this.db.quiz.length;r++)for(var o=0;o<this.db.quiz[r].length;o++)switch(t+=n=this.db.quiz[r][o].score,this.db.quiz[r][o].solved){case 1:e+=n;case-1:i+=n}var s=0===e?0:e/t;this.write("cmi.score.min","0"),this.write("cmi.score.max",JSON.stringify(t)),this.write("cmi.score.scaled",JSON.stringify(s)),this.write("cmi.score.raw",JSON.stringify(e)),s>=this.scaled_passing_score?(this.write("cmi.success_status","passed"),this.write("cmi.completion_status","completed")):i+e===t&&(this.write("cmi.success_status","failed"),this.write("cmi.completion_status","completed")),window.SCORE=s}}},{key:"write",value:function(t,e){if(this.scorm){if(g("write: ",t,e),"false"===this.scorm.SetValue(t,e)){console.warn("error occurred for",t,e);var i=this.scorm.GetLastError();console.warn("GetLastError:",i),i?(console.warn("GetErrorString:",this.scorm.GetErrorString(i)),console.warn("GetDiagnostic:",this.scorm.GetDiagnostic(i))):console.warn("GetDiagnostic:",this.scorm.GetDiagnostic(""))}this.scorm.Commit("")}}},{key:"slide",value:function(t){this.location=t,this.write("cmi.location",JSON.stringify(t))}},{key:"setInteraction",value:function(t,e){this.write("cmi.interactions.".concat(t,".id"),e),this.write("cmi.interactions.".concat(t,".type"),"long-fill-in")}},{key:"updateQuiz",value:function(t,e){if(this.active)switch(e.solved){case 0:e.trial>0&&this.write("cmi.interactions.".concat(t,".result"),"incorrect");break;case 1:this.write("cmi.interactions.".concat(t,".result"),"correct");break;case-1:this.write("cmi.interactions.".concat(t,".result"),"neutral")}}},{key:"updateInteraction",value:function(t,e){var i;this.write("cmi.interactions.".concat(t,".learner_response"),(i=e,JSON.stringify(h(i,f))))}},{key:"getInteraction",value:function(t){if(!this.active)return null;try{if(this.scorm)return e=this.scorm.GetValue("cmi.interactions.".concat(t,".learner_response")),h(JSON.parse(e),d)}catch(t){console.warn("SCORM2004: getInteraction => ",t)}var e;return null}}]),i}(u.Connector);function g(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n;(n=console).log.apply(n,["SCORM2004: "].concat((0,c.default)(e)))}function y(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n;(n=console).log.apply(n,["SCORM2004: "].concat((0,c.default)(e)))}})),e.register("irPpa",(function(i,n){t(i.exports,"Connector",(function(){return u}));var r=e("2swew"),o=e("kxanC"),s=e("hWDD9"),a=e("eQNFO"),c=e("2QbWq"),l=e("aOvOw"),u=function(){"use strict";function t(){(0,o.default)(this,t)}return(0,s.default)(t,[{key:"hasIndex",value:function(){return!1}},{key:"storage",value:function(){return new c.LiaStorage}},{key:"initSettings",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return l.Settings.init(t,e)}},{key:"setSettings",value:function(t){try{localStorage.setItem(l.Settings.PORT,JSON.stringify(t))}catch(t){console.warn("cannot write to localStorage")}}},{key:"getSettings",value:function(){var t="";try{t=localStorage.getItem(l.Settings.PORT)}catch(t){console.warn("cannot write to localStorage")}var e=null;if("string"==typeof t){try{e=JSON.parse(t)}catch(t){console.warn("getSettings =>",t)}e||(e=l.Settings.default),window.innerWidth<=768&&(e.table_of_contents=!1)}return e}},{key:"open",value:function(t,e,i){}},{key:"load",value:function(t){}},{key:"store",value:function(t){}},{key:"update",value:function(t,e){}},{key:"slide",value:function(t){}},{key:"getIndex",value:function(){}},{key:"deleteFromIndex",value:function(t){}},{key:"storeToIndex",value:function(t){}},{key:"restoreFromIndex",value:function(t,e){}},{key:"reset",value:function(t,e){this.initSettings(null,!0)}},{key:"getFromIndex",value:function(t){return(0,r.default)((function(){return(0,a.__generator)(this,(function(t){return[2,null]}))}))()}}]),t}()})),e.register("2QbWq",(function(i,n){t(i.exports,"LiaStorage",(function(){return a}));var r=e("kxanC"),o=e("hWDD9"),s=e("mBz5n"),a=function(){"use strict";function t(){(0,r.default)(this,t)}return(0,o.default)(t,[{key:"getItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"==typeof t&&(t=[t]);for(var e={},i=0;i<t.length;i++){var n=localStorage.getItem(t[i]);e[t[i]]=n?JSON.parse(n):n}return e}},{key:"setItems",value:function(t){this._setLocal(t)}},{key:"_setLocal",value:function(t){var e=!0,i=!1,n=void 0;if("object"==typeof t)try{for(var r,o=Object.entries(t)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var a=(0,s.default)(r.value,2),c=a[0],l=a[1];localStorage.setItem(c,JSON.stringify(l))}}catch(t){i=!0,n=t}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}}]),t}()}))}();
@@ -0,0 +1 @@
1
+ function t(t,e,i,s){Object.defineProperty(t,e,{get:i,set:s,enumerable:!0,configurable:!0})}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequire55a5;e.register("ajKoV",(function(i,s){t(i.exports,"Connector",(()=>a));var r=e("e32Bb");const n={SingleChoice:"sc",MultipleChoice:"mc",Text:"tx",Select:"st",Matrix:"mx",Generic:"gn",error_msg:"err"},o=Object.entries(n).reduce(((t,[e,i])=>(t[i]=e,t)),{});function c(t,e){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map((t=>c(t,e)));const i={};for(const[s,r]of Object.entries(t)){i[e[s]||s]=c(r,e)}return i}class a extends r.Connector{init(){if(this.scorm){l("Initialize ",this.scorm.Initialize(""));let t=this.scorm.GetValue("cmi.mode");if(this.active="normal"===t,console.warn("SCORM2004: Running in",t,"mode, results will ",this.active?"":"NOT","be stored!"),this.scaled_passing_score=JSON.parse(this.scorm.GetValue("cmi.scaled_passing_score")),l("open location ..."),this.location=function(t){try{return JSON.parse(t)}catch(t){}return null}(this.scorm.GetValue("cmi.location")),l("... ",this.location),null===this.location){this.slide(0);let t=0;t=this.initFirst("quiz",t),t=this.initFirst("survey",t),t=this.initFirst("task",t)}else{let t=0;t=this.initSecond("quiz",t),t=this.initSecond("survey",t),t=this.initSecond("task",t)}window.SCORE=0,this.score()}}initFirst(t,e){for(let i=0;i<this.db[t].length;i++){this.id[t].push([]);for(let s=0;s<this.db[t][i].length;s++)this.setInteraction(e,`${t}:${i}-${s}`),this.id[t][i].push(e),e++}return e}initSecond(t,e){for(let i=0;i<this.db[t].length;i++){this.id[t].push([]);for(let s=0;s<this.db[t][i].length;s++){let r=this.getInteraction(e);r&&(this.db[t][i][s]=r),this.id[t][i].push(e),e++}}return e}open(t,e,i){null!==this.location&&window.LIA.goto(this.location)}load(t){if(this.active)switch(t.table){case"quiz":case"survey":case"task":return l("loading ",t.table,t.id,this.db.task[t.id]),this.db[t.table][t.id]}}store(t){if(this.active)switch(t.table){case"quiz":this.storeHelper(t),this.score();break;case"survey":case"task":this.storeHelper(t)}}storeHelper(t){for(let s=0;s<this.db[t.table][t.id].length;s++)e=t.data[s],i=this.db[t.table][t.id][s],JSON.stringify(e)!=JSON.stringify(i)&&(this.updateInteraction(this.id[t.table][t.id][s],t.data[s]),this.db[t.table][t.id][s]=t.data[s],"quiz"==t.table&&this.updateQuiz(this.id[t.table][t.id][s],t.data[s]));var e,i}score(){if(!this.active||!this.scaled_passing_score)return;let t=0,e=0,i=0,s=0;for(let r=0;r<this.db.quiz.length;r++)for(let n=0;n<this.db.quiz[r].length;n++)switch(s=this.db.quiz[r][n].score,t+=s,this.db.quiz[r][n].solved){case 1:e+=s;case-1:i+=s}const r=0===e?0:e/t;this.write("cmi.score.min","0"),this.write("cmi.score.max",JSON.stringify(t)),this.write("cmi.score.scaled",JSON.stringify(r)),this.write("cmi.score.raw",JSON.stringify(e)),r>=this.scaled_passing_score?(this.write("cmi.success_status","passed"),this.write("cmi.completion_status","completed")):i+e===t&&(this.write("cmi.success_status","failed"),this.write("cmi.completion_status","completed")),window.SCORE=r}write(t,e){if(this.scorm){if(l("write: ",t,e),"false"===this.scorm.SetValue(t,e)){console.warn("error occurred for",t,e);let i=this.scorm.GetLastError();console.warn("GetLastError:",i),i?(console.warn("GetErrorString:",this.scorm.GetErrorString(i)),console.warn("GetDiagnostic:",this.scorm.GetDiagnostic(i))):console.warn("GetDiagnostic:",this.scorm.GetDiagnostic(""))}this.scorm.Commit("")}}slide(t){this.location=t,this.write("cmi.location",JSON.stringify(t))}setInteraction(t,e){this.write(`cmi.interactions.${t}.id`,e),this.write(`cmi.interactions.${t}.type`,"long-fill-in")}updateQuiz(t,e){if(this.active)switch(e.solved){case 0:e.trial>0&&this.write(`cmi.interactions.${t}.result`,"incorrect");break;case 1:this.write(`cmi.interactions.${t}.result`,"correct");break;case-1:this.write(`cmi.interactions.${t}.result`,"neutral")}}updateInteraction(t,e){var i;this.write(`cmi.interactions.${t}.learner_response`,(i=e,JSON.stringify(c(i,n))))}getInteraction(t){if(!this.active)return null;try{if(this.scorm)return e=this.scorm.GetValue(`cmi.interactions.${t}.learner_response`),c(JSON.parse(e),o)}catch(t){console.warn("SCORM2004: getInteraction => ",t)}var e;return null}constructor(){var t;if(super(),this.active=!1,this.scaled_passing_score=null,this.db={quiz:[],survey:[],task:[]},this.id={quiz:[],survey:[],task:[]},window.API_1484_11||(null===(t=window.top)||void 0===t?void 0:t.API_1484_11)){var e;l("successfully opened API"),this.scorm=window.API_1484_11||(null===(e=window.top)||void 0===e?void 0:e.API_1484_11),l("loading quizzes ...");try{this.db.quiz=window.config_.quiz||[[]],l(" ... done")}catch(t){h("... failed",t)}l("loading surveys ...");try{this.db.survey=window.config_.survey||[[]],l(" ... done")}catch(t){h("... failed",t)}l("loading tasks ...");try{this.db.task=window.config_.task||[[]],l(" ... done")}catch(t){h("... failed",t)}this.init()}else console.warn("SCORM2004: Could not find API")}}function l(...t){console.log("SCORM2004: ",...t)}function h(...t){console.log("SCORM2004: ",...t)}})),e.register("e32Bb",(function(i,s){t(i.exports,"Connector",(()=>o));var r=e("4ssuu"),n=e("XOp0e");class o{hasIndex(){return!1}storage(){return new r.LiaStorage}initSettings(t,e=!1){return n.Settings.init(t,e)}setSettings(t){try{localStorage.setItem(n.Settings.PORT,JSON.stringify(t))}catch(t){console.warn("cannot write to localStorage")}}getSettings(){let t="";try{t=localStorage.getItem(n.Settings.PORT)}catch(t){console.warn("cannot write to localStorage")}let e=null;if("string"==typeof t){try{e=JSON.parse(t)}catch(t){console.warn("getSettings =>",t)}e||(e=n.Settings.default),window.innerWidth<=768&&(e.table_of_contents=!1)}return e}open(t,e,i){}load(t){}store(t){}update(t,e){}slide(t){}getIndex(){}deleteFromIndex(t){}storeToIndex(t){}restoreFromIndex(t,e){}reset(t,e){this.initSettings(null,!0)}async getFromIndex(t){return null}constructor(){}}})),e.register("4ssuu",(function(e,i){t(e.exports,"LiaStorage",(()=>s));class s{getItems(t=[]){"string"==typeof t&&(t=[t]);let e={};for(let i=0;i<t.length;i++){let s=localStorage.getItem(t[i]);e[t[i]]=s?JSON.parse(s):s}return e}setItems(t){this._setLocal(t)}_setLocal(t){if("object"==typeof t)for(const[e,i]of Object.entries(t))localStorage.setItem(e,JSON.stringify(i))}constructor(){}}}));