@robotical/martyblocks 2.1.8-code-assess → 2.1.9-code-assess
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.min.js +4 -4
- package/package.json +1 -1
package/dist/lib.min.js
CHANGED
|
@@ -6668,7 +6668,7 @@ var Fn;const Rn=Object(g.m)("authIdTokenMaxAge")||300;let Yn=null;function Un(e=
|
|
|
6668
6668
|
* See the License for the specific language governing permissions and
|
|
6669
6669
|
* limitations under the License.
|
|
6670
6670
|
*/
|
|
6671
|
-
function(e,t){if((e=Object(c.b)(e,"auth")).isInitialized()){const o=e.getImmediate();var n=e.getOptions();if(Object(g.h)(n,null!=t?t:{}))return o;l(o,"already-initialized")}const o=e.initialize({options:t});return o}(e,{popupRedirectResolver:kn,persistence:[Lt,vt,Tt]});var o,i,a,t=Object(g.m)("authTokenSyncURL");if(t){a=t;const s=async e=>{var e=e&&await e.getIdTokenResult(),t=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;t&&t>Rn||(t=null==e?void 0:e.token,Yn!==t&&(Yn=t,await fetch(a,{method:t?"POST":"DELETE",headers:t?{Authorization:"Bearer "+t}:{}})))};e=n,t=s,r=()=>s(n.currentUser),Object(g.n)(e).beforeAuthStateChanged(t,r),e=n,t=e=>s(e),Object(g.n)(e).onIdTokenChanged(t,o,i)}var r=Object(g.k)("auth");return r&&Ve(n,"http://"+r),n}Fn="Browser",Object(c.c)(new t.a("auth",(e,{options:t})=>{var n=e.getProvider("app").getImmediate(),o=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options,i=(h(i&&!i.includes(":"),"invalid-api-key",{appName:n.name}),{apiKey:i,authDomain:a,clientPlatform:Fn,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Re(Fn)}),a=new Le(n,o,e,i);return n=a,e=(null==(o=t)?void 0:o.persistence)||[],e=(Array.isArray(e)?e:[e]).map(u),null!=o&&o.errorMap&&n._updateErrorMap(o.errorMap),n._initializeWithPersistence(e,null==o?void 0:o.popupRedirectResolver),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Object(c.c)(new t.a("auth-internal",e=>{var e=Ge(e.getProvider("auth").getImmediate());return e=e,new _n(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Object(c.g)(On,"1.5.1",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Fn)),Object(c.g)(On,"1.5.1","esm2017");var E,w=e(21);const Ln={apiKey:"AIzaSyD8Kwib8K_I4jTw2eTbQPWRMKA4SjeonIw",authDomain:"northern-net-403811.firebaseapp.com",projectId:"northern-net-403811",storageBucket:"northern-net-403811.appspot.com",messagingSenderId:"766117397217",appId:"1:766117397217:web:32e639ee12d7b2d7d1ada0",measurementId:"G-3X2F1HT4YE"};(t=E=E||{})[t.Ready=0]="Ready",t[t.InProgress=1]="InProgress",t[t.Done=2]="Done";class Gn{constructor(e){this.firebaseInitialisedFlag=E.Ready,this.app=null,this.auth=null,this.API=e}hasFirebaseBeenInitialised(){return this.firebaseInitialisedFlag==E.Done}initialiseFirestore(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");let n;this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{var o=A.credential(this.API.gapiConnectionAPI.id_token,this.API.gapiConnectionAPI.access_token);console.log("credential",o),n=await ft(this.auth,o)}catch(e){return console.log("Error signing in: ",e),t(e)}if(n.user){this.firebaseInitialisedFlag=E.Done;try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return console.log("Successfully signed in to Firebase."),e(!0)}return this.firebaseInitialisedFlag=E.Ready,console.log("Couldn't connect to Firebase. User not signed in google."),t("User not signed in Google.")})}initialiseFirestoreWithoutSignIn(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return this.firebaseInitialisedFlag=E.Done,console.log("Successfully initialized Firebase."),e(!0)})}}var Pn=e(227);Pn.enc.Utf8.parse("some_fixed_iv_here");class y{static generateKey(e){return Pn.SHA256(e).toString()}static encrypt(e,t){return e}static decrypt(e,t){return e}}class Hn{constructor(e,t,n,o,i){this.studentSubmissions=null,this.id=e,this.classId=t,this.title=n,this.description=o,this.API=i}async addAttachment(e,t,n){await this.requestStudentSubmissionsList();var o=null==(o=this.studentSubmissions)?void 0:o.find(e=>e.userId===t);return o?await this.API.gapiClassroomAPI.addAttachementInCourseWork(this.classId,e,o.id,n):(console.error("StudentSubmission not found"),!1)}async getListOfStudentSubmissions(){return this.studentSubmissions||await this.requestStudentSubmissionsList(),this.studentSubmissions||[]}async requestStudentSubmissionsList(){var e=await this.API.gapiClassroomAPI.listStudentSubmissions(this.classId,this.id);this.studentSubmissions=e}}class jn{static calculateCompositeScore({algorithmsCompoScores:e,analysisCompoScores:t,decompositionCompoScores:n,patternRecAndDataRepCompoScores:o,generalisationAndAbstrCompoScores:i,badgesScores:a}){var r=a;let s=0,A=0,l=0,u=0,c=0,g=0;for(const h in r){var d=r[h];d[0]&&(s+=d[0],A++),d[1]&&(l+=d[1],u++),d[2]&&(c+=d[2],g++)}return e+t+n+o+i+s+l+c}}class C{static calculatePatternRecognitionAndDataRepresentationScore(e,t){let n=t["Duplicate Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e["Data Types"]*t+e.Loops*t+e["Variables and Data Structures"]*t}static calculateDecompositionScore(e){return e.Functions+e.Parallelism+e.Sequencing}static calculateGeneralisationAndAbstractionScore(e){return e["Function Reuse"]+e["Functions with Arguments"]+e["Variables Instead of Literals"]}static calculateAlgorithmsScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Conditionals*t+e.Operators*t+e["Synchronization and Messages"]*t}static calculateAnalysisScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Comments*t+e.Debugging*t+e.Naming*t}}var zn,Jn,On=e(208),b=e.n(On),t=e(794),Wn=e.n(t),On=e(795),Vn=e.n(On);const Kn=()=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()().tz("Europe/London").format()),I=e=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()(e).tz("Europe/London")),Xn=(e,t,n="seconds")=>{e=b()(e),t=b()(t);return e.diff(t,n)};(t=zn=zn||{}).STARTED="STARTED",t.STOPPED="STOPPED",(Jn=Jn||{}).LAST_HEARTBEAT="lastUploadTime";var qn=class{constructor(){this.heartbeatInterval=null,this.heartbeatCallbacks={},this.status=zn.STOPPED}startHeartbeat(){this.heartbeatInterval?console.warn("Heartbeat already started."):(this.heartbeatInterval=setInterval(()=>{Object.values(this.heartbeatCallbacks).forEach(e=>e())},5e3),this.status=zn.STARTED)}stopHeartbeat(){this.heartbeatInterval?(console.debug("stopping heartbeat"),clearInterval(this.heartbeatInterval),this.heartbeatInterval=null,this.status=zn.STOPPED):console.warn("Heartbeat not running.")}setHeartbeatCallback(e,t){this.heartbeatCallbacks[e]&&console.warn(`Callback with id ${e} already set. Overwriting.`),this.heartbeatCallbacks[e]=t}removeHeartbeatCallback(e){this.heartbeatCallbacks[e]?delete this.heartbeatCallbacks[e]:console.warn(`Callback with id ${e} does not exist.`)}},v=e(37);const Zn={Loops:[v.Loops_1.progressionRanges,v.Loops_2.progressionRanges,v.Loops_3.progressionRanges],Functions:[v.Functions_1.progressionRanges,v.Functions_2.progressionRanges,v.Functions_3.progressionRanges],Conditionals:[v.Conditionals_1.progressionRanges,v.Conditionals_2.progressionRanges,v.Conditionals_3.progressionRanges],"Data Types":[v.DataTypes_1.progressionRanges,v.DataTypes_2.progressionRanges,v.DataTypes_3.progressionRanges],Operators:[v.Operators_1.progressionRanges,v.Operators_2.progressionRanges,v.Operators_3.progressionRanges],Parallelism:[v.Parallelism_1.progressionRanges,v.Parallelism_2.progressionRanges],"Variables and Lists":[v.VariablesAndLists_1.progressionRanges,v.VariablesAndLists_2.progressionRanges,v.VariablesAndLists_3.progressionRanges]};class $n{static toStars(e){var t={};for(const a in Zn){t[a]=[[],[]];var n=e[a];for(let e=0;e<n.length;e++){var[o,i]=function(t,n){var o=["#cd7f32","silver","gold"];for(let e=0;e<n.length;e++){var i=n[e][0],a=n[e][1];if(i<t&&t<=a)return[o[e%o.length],(t-i)/(a-i)]}return t>=n[n.length-1][1]?["gold",1]:["white",0]}(n[e],Zn[a][e]);o&&(t[a][0].push(o),t[a][1].push(i))}}return t}}class eo{constructor(e,t,n,o,i,a,r,s){this.heartbeat=null,this.scoresOverTime=null,this.reactionsOverTime=null,this.badges=null,this.lastHeartbeat=null,this.onStudentDataDocChangeCbs=new Map,this.studentId=t,this.classId=e,this.id=o||eo.compileStudentDataId(e,t),this.API=n,this.scoresOverTime=i||null,this.badges=a||new v.BadgesCounts,this.lastHeartbeat=r||null,this.reactionsOverTime=s||null}static compileStudentDataId(e,t){return e+"_"+t}initialiseHeartbeat(){this.heartbeat&&(console.warn("Heartbeat already created. Removing this heartbeat and creating a new one"),this.heartbeat.stopHeartbeat()),this.heartbeat=new qn,this.startSendingLastHeartbeatTime()}startSendingLastHeartbeatTime(){var e;this.heartbeat||(console.warn("Heartbeat not created, creating heartbeat"),this.initialiseHeartbeat()),console.debug("setting heartbeat callback"),null!=(e=this.heartbeat)&&e.setHeartbeatCallback(Jn.LAST_HEARTBEAT,this.sendLastHeartbeatTime.bind(this)),null!=(e=this.heartbeat)&&e.startHeartbeat()}sendLastHeartbeatTime(){this.API.firestoreStudentDataAPI.updateLastHeartbeatTime(this.classId,this.studentId)}stopHeartbeat(){this.heartbeat&&(this.heartbeat.stopHeartbeat(),this.heartbeat=null)}async sendStudentAssessmentScores(e){e={scoresOverTime:{[Kn()]:e}};await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e)}async sendStudentBadgesData(e){await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,{badges:e})}async sendStudentEmojiReaction(e){e={reactionsOverTime:{[Kn()]:e}};try{return await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e),!0}catch(e){return console.error("Failed to send student reaction to database",e),!1}}async subscribeToDbDocChanges(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onStudentDataDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreStudentDataAPI.subscribeToStudentDataDocChanges(this.classId,this.studentId,t=>{this.onStudentDataDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onStudentDataDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onStudentDataDocChangeCbs.has(e)?this.onStudentDataDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.onStudentDataDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}getLastScore(){var e;return this.scoresOverTime&&(e=Object.keys(this.scoresOverTime).sort().reverse()[0])?{[e]:this.scoresOverTime[e]}:null}badgesToStars(){return this.badges?$n.toStars(this.badges):(console.warn("badges is null"),null)}}var M=eo;class to{constructor(e,t,n){this.classess=null,this.studentData=null,this.joinedClass=null,this.id=e,this.name=t,this.API=n}async joinClass(t){await this.getListOfClassess();var e,n=null==(n=this.classess)?void 0:n.find(e=>e.id===t);return n?(e=await this.requestStudentData(t))?(e.initialiseHeartbeat(),this.joinedClass=n,await this.listenForClassAnnouncements(this.API.codeAssess.onNewClassAnnouncement.bind(this.API.codeAssess)),!0):(console.error("Student data not found"),!1):(console.error("Class not found"),!1)}async exitClass(){return this.joinedClass?(await this.requestStudentData(this.joinedClass.id),this.studentData?(this.studentData.stopHeartbeat(),this.joinedClass.unsubscribeFromDbDocChanges(),this.joinedClass=null,!(this.studentData=null)):(console.error("Student data not found"),!1)):(console.error("Student is not in a class"),!1)}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async requestStudentData(e){if(this.doesStudentDataExist(e))return console.log("StudentData already exists"),this.studentData;let t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);if(t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id)))return console.debug("fetched studentData",t),e=new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime),this.addStudentData(e),e;console.error("Failed to create student data in db")}async fetchStudentData(e){var t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);return t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id))?new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime):void console.error("Failed to create student data in db")}addStudentData(e){this.doesStudentDataExist(e.classId)?console.warn("StudentData already exists"):(this.studentData&&this.studentData.stopHeartbeat(),this.studentData=e)}doesStudentDataExist(e){return!!this.studentData&&this.studentData.classId===e}getActivityStatus(e){if(!e.lastHeartbeat)return"offline";var t=Kn(),n=e.lastHeartbeat;if(7<Xn(t,n,"seconds"))return"offline";if(console.log("studentData.scoresOverTime",e.scoresOverTime),!e.scoresOverTime)return"inactive";n=e.getLastScore();if(!n)return"inactive";console.log("lastScore",n);e=Object.keys(n)[0],n=I(e);return 30<Xn(t,n.toString(),"seconds")?"inactive":"active"}getCompositeScore(e,t=!0){var n;return e.scoresOverTime&&(n=e.getLastScore(),t=t?e.badges:{},n)&&Object.keys(n)[0]?(e=Object.values(n)[0],jn.calculateCompositeScore({algorithmsCompoScores:C.calculateAlgorithmsScore(e.Algorithms,e["Dead Code"]),analysisCompoScores:C.calculateAnalysisScore(e.Analysis,e["Dead Code"]),decompositionCompoScores:C.calculateDecompositionScore(e.Decomposition),patternRecAndDataRepCompoScores:C.calculatePatternRecognitionAndDataRepresentationScore(e["Pattern Recognition and Data Representation"],e.Repetition),generalisationAndAbstrCompoScores:C.calculateGeneralisationAndAbstractionScore(e["Generalisation and Abstraction"]),badgesScores:t})):0}async listenForClassAnnouncements(n){return this.joinedClass?(await this.joinedClass.subscribeToDbDocChanges("studentJoinedClassAnnouncements",async t=>{if(t.announcements)if(0===t.announcements.length)console.warn("No announcements in class");else{t=await t.getActiveAnnouncements();if(t&&0!==t.length){let e=t[0];1<t.length&&(console.warn("More than one active announcement, using the last one"),e=t[t.length-1]),e?n(e):console.error("Announcement not found")}else console.warn("No active announcements")}}),!0):(console.warn("Student has not joined a class, cannot listen for joined class announcements"),!1)}async getAnnouncement(e){return this.joinedClass?await this.API.firestoreClassAnnouncementsAPI.get(e,this.joinedClass.id):(console.warn("Student has not joined a class, cannot get announcement"),null)}async sendEmojiFeedback(e,t){if(!this.joinedClass)return console.warn("Student has not joined a class, cannot send emoji feedback"),!1;e=await this.getAnnouncement(e);if(!e)return console.error("Announcement not found"),!1;var n=await this.requestStudentData(this.joinedClass.id);if(!n)return console.error("Student data not found"),!1;n=await n.sendStudentEmojiReaction({reaction:t});if(n&&!await e.respond(this.id,this.name,t))return console.error("Failed to respond to announcement"),!1;return!0}}class no{constructor(e,t,n,o,i,a,r,s){this.courseWorks=null,this.students=null,this.announcements=[],this.onDocChangeCbs=new Map,this.id=e,this.teacherId=t,this.name=n,this.API=o,this.section=i,this.subject=a,this.room=r,this.announcements=s||[]}async getListOfCourseWorks(){return this.courseWorks||await this.requestListOfCourseWorks(),this.courseWorks||[]}async getListOfStudents(){return this.students||await this.requestListOfStudents(),this.students||[]}async createCourseWork(e,t){var e=await this.API.gapiClassroomAPI.createCourseWork(this.id,e,t),t=new Hn(e.id,this.id,e.title,e.description,this.API);return null!=(e=this.courseWorks)&&e.push(t),t}async requestListOfCourseWorks(){var e=(await this.API.gapiClassroomAPI.listCourseWorks(this.id)).map(e=>new Hn(e.id,this.id,e.title,e.description,this.API));this.courseWorks=e}async requestListOfStudents(){var e=(await this.API.gapiClassroomAPI.listStudents(this.id)).map(e=>new to(e.userId,e.profile.name.fullName,this.API));this.students=e}async createStudentDataForAllStudentsIfNotExists(){if(this.students||await this.requestListOfStudents(),this.students){const n=[];await Promise.all(this.students.map(async e=>{var t=await this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(this.id,e.id);n.push({[e.id]:t})})),console.log("wasStudentDataCreatedSuccessfully?",n)}}async getStudentDataForAllStudents(){return this.students||await this.requestListOfStudents(),this.students?(await Promise.all(this.students.map(async e=>{return await this.API.firestoreStudentDataAPI.getStudentData(this.id,e.id)}))).map(e=>e?new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime):null):[]}async appendFetchedStudentDataToStudents(){var e;this.students||await this.requestListOfStudents(),await this.createStudentDataForAllStudentsIfNotExists();const n=await this.API.firestoreStudentDataAPI.getStudentDataListGivenClassId(this.id);null!=(e=this.students)&&e.forEach(t=>{var e=n.find(e=>e.studentId===t.id);e&&(e=new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime),t.addStudentData(e))})}async announce(e,t){e=await this.API.firestoreClassAnnouncementsAPI.create(this.id,e,t);return e?await this.API.firestoreClassesAPI.addClassAnnouncement(this.id,e)?e:(console.warn("Failed to add announcement to class"),!1):(console.warn("Failed to create announcement -- announcementId is falsy"),!1)}async removeAnnouncement(e){return!!await this.API.firestoreClassesAPI.removeClassAnnouncement(this.id,e)||(console.warn("Failed to remove announcement from class"),!1)}async deactivateAnnouncement(e){var t=await e.deactivate();return"text"!==e.type||await this.removeAnnouncement(e.id)?!!t||(console.warn("Failed to deactivate announcement"),!1):(console.warn("Failed to remove announcement"),!1)}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassesAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async getAnnouncements(){var e=await this.API.firestoreClassesAPI.getClassAnnouncementIds(this.id)||[];return(await Promise.all(e.map(async e=>{var t=await this.API.firestoreClassAnnouncementsAPI.get(e,this.id);return t||(console.warn(`Announcement with ID ${e} does not exist`),null)}))).filter(e=>null!==e)}async getActiveAnnouncements(){var e=await this.API.firestoreClassAnnouncementsAPI.getActiveAnnouncements(this.id);return e&&0!==e.length?e.filter(e=>null!==e):(console.warn("There are no active announcements for class with ID "+this.id),[])}}const oo="Classes";class io{constructor(e){this.API=e}async createClass(e,t,n){var o;return this.API.firestoreDb?(o=y.encrypt(e,e),o=Object(w.c)(this.API.firestoreDb,oo,o),(await Object(w.d)(o)).exists()?(console.log("Class already exists"),!1):(n=y.encrypt(n,e),t=y.encrypt(t,e),await Object(w.i)(o,{name:t,teacherId:n}),console.log("Class created"),!0)):(console.error("Firestore db not initialized"),!1)}async getClass(t){var e,n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(n=await Object(w.d)(n)).exists()?(n=n.data(),{name:y.decrypt(n.name,t),teacherId:y.decrypt(n.teacherId,t),students:null==(e=n.students)?void 0:e.map(e=>y.decrypt(e,t)),announcements:n.announcements}):(console.log("Class does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateClassStudents(t,e){var n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(await Object(w.d)(n)).exists()?(e=e.map(e=>y.encrypt(e,t)),await Object(w.i)(n,{students:e},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async addClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.announcements)||[],await Object(w.i)(e,{announcements:[...n,t]},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async removeClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=((null==(n=n.data())?void 0:n.announcements)||[]).filter(e=>e!==t),await Object(w.i)(e,{announcements:n},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=y.encrypt(t,t),e=Object(w.c)(this.API.firestoreDb,oo,e),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new no(t,y.decrypt(e.teacherId,t),y.decrypt(e.name,t),this.API,void 0,void 0,void 0,e.announcements),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async getClassAnnouncementIds(e){return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(e=await Object(w.d)(e)).exists()?e.data().announcements:(console.log("Class does not exist"),[])):(console.error("Firestore db not initialized"),[])}}class ao{constructor(e){this.firestoreDb=null,this.API=e}async createClassIfDoesntExist(e,t,n){var o;return this.API.firestoreDb?(o=await this.API.firestoreClassesAPI.getClass(e))?(console.log("Class exists",o),!0):(console.log("Class does not exist, creating class"),await this.API.firestoreClassesAPI.createClass(e,t,n)?(console.log("Class created",e),o=await this.API.firestoreClassesAPI.getClass(e),console.log("Class data",o),!0):(console.error("Failed to create class"),!1)):(console.error("Firestore db not initialized"),!1)}async addStudentToClassIfHasntBeenAddedAlready(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreClassesAPI.getClass(e))?((n=n.students||[]).includes(t)?console.log("Student has already been added to class"):(console.log("Student has not been added to class, adding student to class"),n.push(t),await this.API.firestoreClassesAPI.updateClassStudents(e,n),console.log("Student added to class")),!0):(console.log("Class does not exist"),!1):(console.error("Firestore db not initialized"),!1)}async createTeacherIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreTeachersAPI.getTeacher(e))?(console.log("Teacher exists",n),!0):(console.log("Teacher does not exist, creating teacher"),await this.API.firestoreTeachersAPI.createTeacher(e,t)?(console.log("Teacher created",e),n=await this.API.firestoreTeachersAPI.getTeacher(e),console.log("Teacher data",n),!0):(console.error("Failed to create teacher"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentsAPI.getStudent(e))?(console.log("Student exists",n),!0):(console.log("Student does not exist, creating student"),await this.API.firestoreStudentsAPI.createStudent(e,t)?(console.log("Student created",e),n=await this.API.firestoreStudentsAPI.getStudent(e),console.log("Student data",n),!0):(console.error("Failed to create student"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentDataIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentDataAPI.getStudentData(e,t))?(console.log("StudentData exists",n),!0):(console.log("StudentData does not exist, creating studentData"),await this.API.firestoreStudentDataAPI.createStudentData(e,t)?(console.log("StudentData created",e,t),n=await this.API.firestoreStudentDataAPI.getStudentData(e,t),console.log("StudentData data",n),!0):(console.error("Failed to create studentData"),!1)):(console.error("Firestore db not initialized"),!1)}}class ro{constructor(e){this.API=e}async createTeacher(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Teachers",n),(await Object(w.d)(n)).exists()?(console.log("Teacher already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Teacher created"),!0)):(console.error("Firestore db not initialized"),!1)}async getTeacher(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Teachers",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Teacher does not exist"),null)):(console.error("Firestore db not initialized"),null)}}class so{constructor(e){this.API=e}async createStudent(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Students",n),(await Object(w.d)(n)).exists()?(console.log("Student already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Student created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudent(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Students",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Student does not exist"),null)):(console.error("Firestore db not initialized"),null)}}const Ao=e=>{if(!e)return console.warn("minifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={Decomposition:n.dec,"Pattern Recognition and Data Representation":n.pat,"Generalisation and Abstraction":n.gen,Algorithms:n.alg,Analysis:n.ana,Repetition:n.rep,"Dead Code":n.dea};t[o]=n}return t},lo="StudentData";class uo{constructor(e){this.API=e}async createStudentData(e,t){var n,o;return this.API.firestoreDb?(n=M.compileStudentDataId(e,t),n=y.encrypt(n,e),console.debug("encryptedStudentDataId used for creating student data: ",n),o=Object(w.c)(this.API.firestoreDb,lo,n),(await Object(w.d)(o)).exists()?(console.log("StudentData already exists"),!1):(await Object(w.i)(o,{classId:y.encrypt(e,e),studentId:y.encrypt(t,e),id:n}),console.log("StudentData created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudentData(e,t){return this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),console.debug("encryptedStudentDataId used for getting student data: ",t),t=Object(w.c)(this.API.firestoreDb,lo,t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{id:y.decrypt(t.id,e),classId:y.decrypt(t.classId,e),studentId:y.decrypt(t.studentId,e),scoresOverTime:Ao(t.scoresOverTime),badges:t.badges,lastHeartbeat:t.lastHeartbeat,reactionsOverTime:t.reactionsOverTime}):(console.log("StudentData does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateStudentData(e,t,n){this.API.firestoreDb?(n.scoresOverTime&&(n.scoresOverTime=(e=>{if(!e)return console.warn("unminifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={dec:Object.assign({},n.Decomposition),pat:Object.assign({},n["Pattern Recognition and Data Representation"]),gen:Object.assign({},n["Generalisation and Abstraction"]),alg:Object.assign({},n.Algorithms),ana:Object.assign({},n.Analysis),rep:Object.assign({},n.Repetition),dea:Object.assign({},n["Dead Code"])};t[o]=n}return t})(n.scoresOverTime)),t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,n,{merge:!0})):console.error("Firestore db not initialized")}updateLastHeartbeatTime(e,t){this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,{lastHeartbeat:Kn()},{merge:!0})):console.error("Firestore db not initialized")}async getStudentDataListGivenClassId(t){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve([]);const n=[];try{var e=y.encrypt(t,t),o=Object(w.h)(Object(w.a)(this.API.firestoreDb,lo),Object(w.j)("classId","==",e));return(await Object(w.e)(o)).forEach(e=>{e=e.data(),e={classId:y.decrypt(e.classId,t),id:y.decrypt(e.id,t),studentId:y.decrypt(e.studentId,t),lastHeartbeat:e.lastHeartbeat,badges:e.badges,scoresOverTime:Ao(e.scoresOverTime),reactionsOverTime:e.reactionsOverTime};n.push(e)}),n}catch(e){return console.error("Error getting documents: ",e),Promise.resolve([])}}async subscribeToStudentDataDocChanges(n,e,o){if(this.API.firestoreDb)return e=M.compileStudentDataId(n,e),e=y.encrypt(e,n),e=Object(w.c)(this.API.firestoreDb,lo,e),Object(w.g)(e,e=>{var t;e.exists()?(t=e.data(),e=new M(y.decrypt(t.classId,n),y.decrypt(t.studentId,n),this.API,y.decrypt(e.id,n),Ao(t.scoresOverTime),t.badges,t.lastHeartbeat,t.reactionsOverTime),o(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}}class co{constructor(e,t,n,o,i,a,r,s=!0){this.isActive=!0,this.responses=[],this.onDocChangeCbs=new Map,this.id=e,this.type=t,this.API=n,this.classId=o,this.text=i,this.timestamp=a,this.responses=r,this.isActive=s}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassAnnouncementsAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async respond(e,t,n){n={response:n,studentId:e,studentName:t,timestamp:Kn()};return this.API.firestoreClassAnnouncementsAPI.addResponse(this.id,n)}async deactivate(){return"text"===this.type?this.API.firestoreClassAnnouncementsAPI.delete(this.id):this.API.firestoreClassAnnouncementsAPI.deactivate(this.id)}async refresh(){var e=await this.API.firestoreClassAnnouncementsAPI.get(this.id,this.classId);if(e)return e;throw new Error("Could not get fresh class announcement")}}const T="ClassAnnouncements";class go{constructor(e){this.API=e}async create(e,t,n){var o;return this.API.firestoreDb?(e=y.encrypt(e,e),o=Object(w.a)(this.API.firestoreDb,T),o=Object(w.c)(o),await Object(w.i)(o,{classId:e,text:t,timestamp:Kn(),announcementType:n,responses:[],isActive:!0}),console.info("Class announcement created"),o.id):(console.error("Firestore db not initialized"),!1)}async get(e,t){var n;return this.API.firestoreDb?(n=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(n)).exists()?(n=n.data(),new co(e,n.announcementType,this.API,y.decrypt(n.classId,t),n.text,n.timestamp,n.responses,!!n.isActive)):(console.log("Class announcement does not exist"),null)):(console.error("Firestore db not initialized"),null)}async getActiveAnnouncements(n){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve(null);var e=Object(w.a)(this.API.firestoreDb,T),e=Object(w.h)(e,Object(w.j)("classId","==",y.encrypt(n,n)),Object(w.j)("isActive","==",!0)),e=await Object(w.e)(e);const o=[];return e.forEach(e=>{var t=e.data(),e=new co(e.id,t.announcementType,this.API,y.decrypt(t.classId,n),t.text,t.timestamp,t.responses,!!t.isActive);o.push(e)}),o}async update(e,t){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,t,{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=Object(w.c)(this.API.firestoreDb,T,t),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new co(t,e.announcementType,this.API,y.decrypt(e.classId,t),e.text,e.timestamp,e.responses,!!e.isActive),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async addResponse(e,t){var n;return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.responses)||[],await Object(w.i)(e,{responses:[...n,t]},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async deactivate(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,{isActive:!1},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async delete(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.b)(e),console.info("Class announcement deleted"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}}class ho{constructor(e,t,n){this.classess=null,this.id=e,this.name=t,this.API=n}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var t=await this.API.gapiClassroomAPI.listClassess(),n=[];for(let e=0;e<10;e++){var o=t[0];0===e?n.push(new no(o.id,o.ownerId,o.name,this.API,o.section,o.subject,o.room,o.announcement)):n.push(new no(""+e,o.ownerId,"Class "+e,this.API,"Section "+e,"Subject "+e,"Room "+e,o.announcement))}this.classess=n}async determineIfStudentOrTeacherInClass(t){await this.requestListOfClasses();var e=null==(e=this.classess)?void 0:e.find(e=>e.id===t);return e?(console.debug("classToCheck",e),e.teacherId===this.id?Bo.TEACHER:Bo.STUDENT):(console.warn("Could not find class with id",t),null)}}const S={CREATE_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,GET_USER_PROFILE:()=>"https://classroom.googleapis.com/v1/userProfiles/me",LIST_ALL_COURSES:()=>"https://classroom.googleapis.com/v1/courses",LIST_ALL_STUDENTS:e=>`https://classroom.googleapis.com/v1/courses/${e}/students`,LIST_ALL_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,LIST_ALL_STUDENT_SUBMISSIONS:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions`,MODIFY_ATTACHEMENTS_OF_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:modifyAttachments`,PATCH_COURSEWORK:(e,t,n,o)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}?updateMask=`+encodeURIComponent(o),REGISTER_STUDENT:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/students?enrollmentCode=`+t,TURN_IN_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:turnIn`},po=["https://www.googleapis.com/auth/classroom.courses.readonly","https://www.googleapis.com/auth/classroom.rosters.readonly","openid"];class mo{constructor(e){this.gapi_client=null,this.firestoreDb=null,this.gapiConnectionAPI=new G(this),this.gapiClassroomAPI=new P(this),this.firestoreConnectionAPI=new Gn(this),this.firestoreClassesAPI=new io(this),this.firestoreTeachersAPI=new ro(this),this.firestoreStudentsAPI=new so(this),this.firestoreStudentDataAPI=new uo(this),this.firestoreClassAnnouncementsAPI=new go(this),this.firestoreHOCAPI=new ao(this),this.codeAssess=e}async initGapiClient(){return new Promise((t,n)=>{const e=()=>{gapi.client.init({}).then(async()=>{if(console.log("this.gapi_client loaded"),!this.gapiConnectionAPI.access_token)return console.error("access_token is null"),n(!1);gapi.client.setToken({access_token:this.gapiConnectionAPI.access_token}),this.gapi_client=gapi.client;var e=await this.requestCurrentUserProfile();if(!e)return console.error("userProfile is null"),n(!1);this.codeAssess.setUserProfile(new ho(e.id,e.name.fullName,this)),t(!0)}).catch(e=>{console.error("Error loading gapi client for API",e),n(!1)})};gapi.load("client:auth2",()=>e())})}async requestCurrentUserProfile(){try{var e;if(this.gapi_client)return e=await this.gapi_client.request({path:S.GET_USER_PROFILE()}),console.log("response",e.result),e.result;throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while getting current user profile:",e),null}}}class fo{constructor(e,t,n){this.classess=null,this.monitoredAnnouncements=new Map,this.id=e,this.name=t,this.API=n,this.requestListOfClasses()}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=await this.API.gapiClassroomAPI.listClassess(),e=(console.debug("fetchedClassess",e),e.map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement)));this.classess=e}async createCourseWorkForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);return o?o.createCourseWork(e,n):(console.error("Could not find class with id",t),!1)}async makeAnnouncementForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);if(!o)return console.error("Could not find class with id",t),!1;for(const i of await o.getActiveAnnouncements())await i.deactivate();return o.announce(e,n)}async askForEmojiFeedback(e,t){e=await this.makeAnnouncementForClass(e,t,"emoji-feedback");return e||(console.error("Could not make announcement"),!1)}async getAnnouncement(t,e){var n;return(null==(n=this.classess)?void 0:n.find(e=>e.id===t))?await this.API.firestoreClassAnnouncementsAPI.get(e,t):(console.error("Could not find class with id",t),null)}async monitorAnnouncementResponses(e,t,n){e=await this.getAnnouncement(e,t);return e?(await e.subscribeToDbDocChanges(t,e=>{n(e.responses||[])}),this.monitoredAnnouncements.set(t,e),!0):(console.error("Could not get announcement"),!1)}stopMonitoringAnnouncementResponse(e){var t=this.monitoredAnnouncements.get(e);return t?(t.unsubscribeFromDbDocChanges(),this.monitoredAnnouncements.delete(e),!0):(console.error("Could not find announcement with id",e),!1)}stopMonitoringAllAnnouncements(){this.monitoredAnnouncements.forEach(e=>{e.unsubscribeFromDbDocChanges()}),this.monitoredAnnouncements.clear()}}var Bo,Eo=class{static studentAssessmentScoresOverTimeToLineGraphData(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const s=a[e];var r=i.map(e=>n[e][s]),r={x:i,y:r,name:s,type:"scatter",mode:"markers"};o.push(r)}return o}static averageScoresOverTime(e){return{}}static transformDataForStackedAreaChart(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const A=a[e];var r=i.map(e=>n[e][A]),s=0===e?"tozeroy":"tonexty",r={x:i,y:r,name:A,type:"scatter",mode:"lines",fill:s};o.push(r)}return o}static transformDataForSpiderChart(e){let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t,o=Object.keys(t).sort();return 0===o.length?(console.warn("No scores over time data provided"),[]):{type:"scatterpolar",r:(e=Object.keys(t[o[0]]).sort()).map(t=>{var e=o.map(e=>n[e][t]);return e[e.length-1]}),theta:e,fill:"toself"}}static getLatestScores(e){let t;var n;return!(t=Array.isArray(e)?this.averageScoresOverTime(e):e)||(e=t,0===(n=Object.keys(t).sort()).length)?(console.warn("No scores over time data provided"),[]):e[n[n.length-1]]}static transformDataForStackedAreaChartForTheLastMinutes(e,t){if(!e)return console.warn("No scores over time data provided"),[];let n;if(!(n=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const o=n;var i=[],e=Object.keys(n).sort();if(0===e.length)return console.warn("No scores over time data provided"),[];const a=b()(Kn());var r=e.filter(e=>{return Xn(a.format(),e,"minutes")<=t});if(0===r.length)return console.warn("No scores in the last "+t+" minutes"),[];var s=Object.keys(n[r[0]]).sort();for(let e=0;e<s.length;e++){const u=s[e];var A=r.map(e=>o[e][u]),l=0===e?"tozeroy":"tonexty",A={x:r,y:A,name:u,type:"scatter",mode:"lines",fill:l};i.push(A)}return i}};(On=Bo=Bo||{}).STUDENT="student",On.TEACHER="teacher";(class ko{});t=class extends class ko{constructor(){if(this.constructor===ko)throw new TypeError('Abstract class "CodeAssessObservable" cannot be instantiated directly.')}}{constructor(){super(),this.userProfile=null,this.teacher=null,this.student=null,this.dataTransformationUtils=Eo,this.platform="staging",this.API=new mo(this),this.observers=[],this.studentOrTeacher=null,this.isUserLoggedIn=!1,this.TypesOfPublishedEvents=i}async logUserIn(){var e=await this.API.gapiConnectionAPI.login(),t=await this.API.firestoreConnectionAPI.initialiseFirestore();return!(!e||!t||(this.setIsUserLoggedIn(!0),0))}async logUserOut(){await this.API.gapiConnectionAPI.logout(),this.setIsUserLoggedIn(!1)}async createTeacherIfDoesntExist(){return this.teacher?this.API.firestoreHOCAPI.createTeacherIfDoesntExist(this.teacher.id,this.teacher.name):(console.error("Teacher not set"),!1)}async createStudentIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentIfDoesntExist(e,t)}async createStudentDataIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(e,t)}async createClassIfDoesntExist(e,t,n){return this.API.firestoreHOCAPI.createClassIfDoesntExist(e,t,n)}async addStudentToClass(e,t,n,o){var i=await this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);if(!i&&await this.createClassIfDoesntExist(e,t,n))return this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);return i}setStudentOrTeacher(e){var t;this.studentOrTeacher=e,this.publish(i.STUDENT_OR_TEACHER_CHANGED),this.userProfile?e===Bo.STUDENT?((t=new to(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setStudent(t)):e===Bo.TEACHER&&((t=new fo(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setTeacher(t)):console.error("User profile not set")}setUserProfile(e){this.userProfile=e}setTeacher(e){this.teacher=e}setStudent(e){this.student=e}setIsUserLoggedIn(e){this.isUserLoggedIn=e,this.publish(i.IS_USER_LOGGED_IN_CHANGED)}onNewClassAnnouncement(e){this.publish(i.NEW_CLASS_ANNOUNCEMENT,e)}subscribe(e,t,n){if(!Object.values(i).includes(t))throw new TypeError(`The type of event "${t}" is not valid. Valid types are: `+Object.values(i).join(", "));const o=new Y(e,t,n);e=this.observers.findIndex(e=>e.id===o.id);-1!==e&&this.observers.splice(e,1),this.observers.push(o)}unsubscribe(t){var e=this.observers.findIndex(e=>e.id===t);-1!==e&&this.observers.splice(e,1)}publish(t,n){this.observers.forEach(e=>e.notify(t,n))}};class k{static calculateWeightedAverageForScoreGivenIndicesAndWeights(t,n,o){if(0===n.length||0===t.length||0===o.length)return[0];let i=0;for(let e=0;e<n[0].length;e++){var a=n[0][e],r=o[e],a=t[a];i+=r*a}return[i/n[0].length]}static calculateWeightsGivenIndicesAndDates(e,t,n="automatic",o="minutes"){if(0===e.length||0===t.length)return[];var i=e[0].map(e=>t[e]).map(e=>I(e));const a=i[0];if("automatic"===n){var r=[];for(let e=0;e<i.length;e++){var s=Math.abs(a.diff(i[e],o));r.push(s)}const u=Math.max(...r),A=r.map(e=>{return 0===e&&0===u?1:e/u});return A}const A=i.map(e=>{e=a.diff(e,o);return Math.pow(.5,e/n)}),l=Math.max(...A);return A.map(e=>e/l)}}class wo{static calculateCIGivenMeanAndStd(e,t,n,o=1.96){return n<=0||t<0||o<=0?[NaN,NaN]:[e-(o=o*(t/Math.sqrt(n))),e+o]}}wo.boundUpperCI=(e,t)=>t;var yo=wo;class D{static calculateLeakyIntegratorScores(t,n,o,i=.1,a=.1,r=.1,s=1){var A=[0],l=[[0,1]];for(let e=1;e<t.length;e++){var u=A[e-1],c=this.adjustLowerBound(t[e],l[e-1][0],0,1,i,a),g=this.adjustUpperBound(0<t[e]?1:0,0===t[e]?l[e-1][1]:0,0,1,r,s),u=this.calculateLeakyScore(t[e],u,c,g,n,o);A.push(u),l.push([c,g])}return{leakyIntegratorScores:A,cis:l}}static calculateLeakyScore(e,t,n,o,i,a){var r=e-t;return 0<r?Math.max(n,Math.min(o,t+e*a*r)):0===e?Math.min(o,Math.max(n,t+(e-(e-n)-t)*i)):Math.max(n,Math.min(o,t+e*i*r))}static adjustUpperBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}static adjustLowerBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}}class Co{static calculateWindowIndices(e,t,n="minutes"){var o=e.map(e=>I(e)),i=[];let a=0;for(;a<o.length;){var r=o[a],s=i.length;for(let e=a;e<o.length;e++){if(!(o[e].diff(r,n)<=t)){a=e;break}if(e===o.length-1)return i[s]||(i[s]=[]),i[s].push(e),i;i[s]||(i[s]=[]),i[s].push(e)}}return i}}class Q extends Co{static calculateMovingAverageForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=0;for(let e=0;e<a.length;e++)t+=n[a[e]];i.push(t/a.length)}return i}static calculateMovingAverageForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]].valueOf();var r=t/a.length,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(r)}return i}static calculateMovingAverageForScore(t,n){if(n<=0||0===t.length)return[];var o=[];let i=0,a=0;for(let e=0;e<t.length;e++)i+=t[e],e>=n-1&&(o.push(i/n),i-=t[a],a++);return o}static calculateMovingAverageForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=0;for(let e=n;e<n+o;e++)t+=i[e].valueOf();var r=t/o,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class x extends Co{static calculateMovingMaxForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=n[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<n.length&&(t=Math.max(t,n[r]))}i.push(t)}return i}static calculateMovingMaxForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=o[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<o.length&&(r=o[r]).isAfter(t)&&(t=r)}var s=t.format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(s)}return i}static calculateMovingMaxForScore(t,n){if(n<=0||0===t.length)return[];var o=[],i=[];for(let e=0;e<t.length;e++)i.push(t[e]),n<i.length&&i.shift(),e>=n-1&&o.push(Math.max(...i));return o}static calculateMovingMaxForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=i[n];for(let e=n;e<n+o;e++)i[e].isAfter(t)&&(t=i[e]);var r=t.format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class N extends Co{static calculateMovingStdForScoreGivenIndices(o,t){if(0===t.length||0===o.length)return[];var i=[];for(let e=0;e<t.length;e++){var a=t[e];if(0===a.length)i.push(0);else{let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]];var r=t/a.length;let n=0;for(let e=0;e<a.length;e++)n+=Math.pow(o[a[e]]-r,2);i.push(Math.sqrt(n/a.length))}}return i}static calculateMovingStdForScore(t,n){if(n<=0||0===t.length)return[];var o,i=[];let a=0,r=0,s=0;for(let e=0;e<t.length;e++)a+=t[e],r+=t[e]*t[e],e>=n-1&&(o=a/n,o=r/n-o*o,i.push(Math.sqrt(o)),a-=t[s],r-=t[s]*t[s],s++);return i}}class O{static normaliseScores(e,t){const n=t[0],o=t[1];return e.map(e=>(e-n)/(o-n))}}const bo={Conditionals:"Algorithms",Operators:"Algorithms","Synchronization and Messages":"Algorithms","Algorithms Dead Code Penalty":"Algorithms","Algorithms Composite Score":"Algorithms",Comments:"Analysis",Debugging:"Analysis",Naming:"Analysis","Analysis Dead Code Penalty":"Analysis","Analysis Composite Score":"Analysis",Functions:"Decomposition",Sequencing:"Decomposition",Parallelism:"Decomposition","Decomposition Composite Score":"Decomposition","Data Types":"Pattern Recognition and Data Representation","Variables and Data Structures":"Pattern Recognition and Data Representation",Loops:"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Repetition Penalty":"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Composite Score":"Pattern Recognition and Data Representation","Function Reuse":"Generalisation and Abstraction","Functions with Arguments":"Generalisation and Abstraction","Variables Instead of Literals":"Generalisation and Abstraction","Generalisation and Abstraction Composite Score":"Generalisation and Abstraction",Composite:"Composite"};function _(){return{average:[],std:[],n:[],ci:[],leaky:[]}}class Io{constructor(e){this.dates=[],this.conditionalsScores={scores:[]},this.operatorsScores={scores:[]},this.syncAndMessagesScores={scores:[]},this.algorithmsCompoScores={scores:[]},this.algorithmsDeadCodePenaltyScores={scores:[]},this.commentsScores={scores:[]},this.debuggingScores={scores:[]},this.namingScores={scores:[]},this.analysisCompoScores={scores:[]},this.analysisDeadCodePenaltyScores={scores:[]},this.functionsScores={scores:[]},this.sequencingScores={scores:[]},this.parallelismScores={scores:[]},this.decompositionCompoScores={scores:[]},this.dataTypesScores={scores:[]},this.variablesAndDataStructScores={scores:[]},this.loopsScores={scores:[]},this.patternRecAndDataRepPenaltyScores={scores:[]},this.patternRecAndDataRepCompoScores={scores:[]},this.functionReuseScores={scores:[]},this.functionWithArgsScores={scores:[]},this.variablesInsteadOfLiteralsScores={scores:[]},this.generalisationAndAbstrCompoScores={scores:[]},this.compositeScores={scores:[]},this.isSorted=!1,this.data=e,this.init()}init(){var e=Object.keys(this.data);const n=e.map(e=>this.data[e]["Dead Code"]["Dead Scripts Count"]),o=e.map(e=>this.data[e]["Dead Code"]["Total Scripts Count"]),i=e.map(e=>this.data[e].Repetition["Duplicate Scripts Count"]),a=e.map(e=>this.data[e].Repetition["Total Scripts Count"]);this.conditionalsScores.scores=e.map(e=>this.data[e].Algorithms.Conditionals),this.operatorsScores.scores=e.map(e=>this.data[e].Algorithms.Operators),this.syncAndMessagesScores.scores=e.map(e=>this.data[e].Algorithms["Synchronization and Messages"]),this.algorithmsDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.algorithmsCompoScores.scores=e.map((e,t)=>C.calculateAlgorithmsScore({"Synchronization and Messages":this.syncAndMessagesScores.scores[t],Operators:this.operatorsScores.scores[t],Conditionals:this.conditionalsScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.commentsScores.scores=e.map(e=>this.data[e].Analysis.Comments),this.debuggingScores.scores=e.map(e=>this.data[e].Analysis.Debugging),this.namingScores.scores=e.map(e=>this.data[e].Analysis.Naming),this.analysisDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.analysisCompoScores.scores=e.map((e,t)=>C.calculateAnalysisScore({Comments:this.commentsScores.scores[t],Debugging:this.debuggingScores.scores[t],Naming:this.namingScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.functionsScores.scores=e.map(e=>this.data[e].Decomposition.Functions),this.sequencingScores.scores=e.map(e=>this.data[e].Decomposition.Sequencing),this.parallelismScores.scores=e.map(e=>this.data[e].Decomposition.Parallelism),this.decompositionCompoScores.scores=e.map((e,t)=>C.calculateDecompositionScore({Functions:this.functionsScores.scores[t],Sequencing:this.sequencingScores.scores[t],Parallelism:this.parallelismScores.scores[t]})),this.dataTypesScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Data Types"]),this.variablesAndDataStructScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Variables and Data Structures"]),this.loopsScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"].Loops),this.patternRecAndDataRepPenaltyScores.scores=e.map((e,t)=>i[t]/a[t]),this.patternRecAndDataRepCompoScores.scores=e.map((e,t)=>C.calculatePatternRecognitionAndDataRepresentationScore({"Data Types":this.dataTypesScores.scores[t],"Variables and Data Structures":this.variablesAndDataStructScores.scores[t],Loops:this.loopsScores.scores[t]},{"Duplicate Scripts Count":i[t],"Total Scripts Count":a[t]})),this.functionReuseScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Function Reuse"]),this.functionWithArgsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Functions with Arguments"]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Variables Instead of Literals"]),this.generalisationAndAbstrCompoScores.scores=e.map((e,t)=>C.calculateGeneralisationAndAbstractionScore({"Function Reuse":this.functionReuseScores.scores[t],"Functions with Arguments":this.functionWithArgsScores.scores[t],"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores.scores[t]})),this.compositeScores.scores=e.map((e,t)=>jn.calculateCompositeScore({Algorithms:this.algorithmsCompoScores.scores[t],Analysis:this.analysisCompoScores.scores[t],Decomposition:this.decompositionCompoScores.scores[t],"Pattern Recognition and Data Representation":this.patternRecAndDataRepCompoScores.scores[t],"Generalisation and Abstraction":this.generalisationAndAbstrCompoScores.scores[t]})),this.dates=e}categoryNamesMap(){return{Conditionals:this.conditionalsScores,Operators:this.operatorsScores,"Synchronization and Messages":this.syncAndMessagesScores,"Algorithms Dead Code Penalty":this.algorithmsDeadCodePenaltyScores,"Algorithms Composite Score":this.algorithmsCompoScores,Comments:this.commentsScores,Debugging:this.debuggingScores,Naming:this.namingScores,"Analysis Dead Code Penalty":this.analysisDeadCodePenaltyScores,"Analysis Composite Score":this.analysisCompoScores,Functions:this.functionsScores,Sequencing:this.sequencingScores,Parallelism:this.parallelismScores,"Decomposition Composite Score":this.decompositionCompoScores,"Data Types":this.dataTypesScores,"Variables and Data Structures":this.variablesAndDataStructScores,Loops:this.loopsScores,"Pattern Recognition and Data Representation Repetition Penalty":this.patternRecAndDataRepPenaltyScores,"Pattern Recognition and Data Representation Composite Score":this.patternRecAndDataRepCompoScores,"Function Reuse":this.functionReuseScores,"Functions with Arguments":this.functionWithArgsScores,"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores,"Generalisation and Abstraction Composite Score":this.generalisationAndAbstrCompoScores,Composite:this.compositeScores}}sort(){var e;this.isSorted||(e=this.dates.map((e,t)=>t).sort((e,t)=>{e=new Date(this.dates[e]),t=new Date(this.dates[t]);return e.getTime()-t.getTime()}),this.dates=e.map(e=>this.dates[e]),this.conditionalsScores.scores=e.map(e=>this.conditionalsScores.scores[e]),this.operatorsScores.scores=e.map(e=>this.operatorsScores.scores[e]),this.syncAndMessagesScores.scores=e.map(e=>this.syncAndMessagesScores.scores[e]),this.algorithmsDeadCodePenaltyScores.scores=e.map(e=>this.algorithmsDeadCodePenaltyScores.scores[e]),this.algorithmsCompoScores.scores=e.map(e=>this.algorithmsCompoScores.scores[e]),this.commentsScores.scores=e.map(e=>this.commentsScores.scores[e]),this.debuggingScores.scores=e.map(e=>this.debuggingScores.scores[e]),this.namingScores.scores=e.map(e=>this.namingScores.scores[e]),this.analysisDeadCodePenaltyScores.scores=e.map(e=>this.analysisDeadCodePenaltyScores.scores[e]),this.analysisCompoScores.scores=e.map(e=>this.analysisCompoScores.scores[e]),this.functionsScores.scores=e.map(e=>this.functionsScores.scores[e]),this.sequencingScores.scores=e.map(e=>this.sequencingScores.scores[e]),this.parallelismScores.scores=e.map(e=>this.parallelismScores.scores[e]),this.decompositionCompoScores.scores=e.map(e=>this.decompositionCompoScores.scores[e]),this.dataTypesScores.scores=e.map(e=>this.dataTypesScores.scores[e]),this.variablesAndDataStructScores.scores=e.map(e=>this.variablesAndDataStructScores.scores[e]),this.loopsScores.scores=e.map(e=>this.loopsScores.scores[e]),this.patternRecAndDataRepPenaltyScores.scores=e.map(e=>this.patternRecAndDataRepPenaltyScores.scores[e]),this.patternRecAndDataRepCompoScores.scores=e.map(e=>this.patternRecAndDataRepCompoScores.scores[e]),this.functionReuseScores.scores=e.map(e=>this.functionReuseScores.scores[e]),this.functionWithArgsScores.scores=e.map(e=>this.functionWithArgsScores.scores[e]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.variablesInsteadOfLiteralsScores.scores[e]),this.generalisationAndAbstrCompoScores.scores=e.map(e=>this.generalisationAndAbstrCompoScores.scores[e]),this.compositeScores.scores=e.map(e=>this.compositeScores.scores[e]),this.isSorted=!0)}calculateMovingStdBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScore(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScore(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScore(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,e)}calculateMovingStdBasedOnDates(e,t="minutes"){e=N.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScore(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScore(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScore(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=Q.calculateMovingAverageForScore(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDates(e,t="minutes"){e=Q.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e)}calculateMovingConfidenceIntervals(e,t,n="minutes"){let o;o="dataPoints"===t?this.getMovingAverageAndStdBasedOnDataPoints(e):this.getMovingAverageAndStdBasedOnDates(e,n);var i={"Algorithms Composite Score":_(),"Analysis Composite Score":_(),"Decomposition Composite Score":_(),"Pattern Recognition and Data Representation Composite Score":_(),"Generalisation and Abstraction Composite Score":_(),Composite:_(),"Algorithms Dead Code Penalty":_(),"Analysis Dead Code Penalty":_(),"Pattern Recognition and Data Representation Repetition Penalty":_(),Conditionals:_(),Operators:_(),"Synchronization and Messages":_(),Comments:_(),Debugging:_(),Naming:_(),Functions:_(),Sequencing:_(),Parallelism:_(),"Data Types":_(),"Variables and Data Structures":_(),Loops:_(),"Function Reuse":_(),"Functions with Arguments":_(),"Variables Instead of Literals":_()};for(const s of Object.keys(o))if("dates"!==s){var a=o[s];for(let e=0;e<a.average.length;e++){var r=yo.calculateCIGivenMeanAndStd(a.average[e],a.std[e],a.n[e]);a.ci||(a.ci=[]),a.ci.push(yo.boundUpperCI(s,r))}i[s]={average:a.average,std:a.std,n:a.n,ci:a.ci}}this.conditionalsScores={scores:i.Conditionals.average,averages:i.Conditionals.average,stds:i.Conditionals.std,cis:i.Conditionals.ci},this.operatorsScores={scores:i.Operators.average,averages:i.Operators.average,stds:i.Operators.std,cis:i.Operators.ci},this.syncAndMessagesScores={scores:i["Synchronization and Messages"].average,averages:i["Synchronization and Messages"].average,stds:i["Synchronization and Messages"].std,cis:i["Synchronization and Messages"].ci},this.algorithmsDeadCodePenaltyScores={scores:i["Algorithms Dead Code Penalty"].average,averages:i["Algorithms Dead Code Penalty"].average,stds:i["Algorithms Dead Code Penalty"].std,cis:i["Algorithms Dead Code Penalty"].ci},this.algorithmsCompoScores={scores:i["Algorithms Composite Score"].average,averages:i["Algorithms Composite Score"].average,stds:i["Algorithms Composite Score"].std,cis:i["Algorithms Composite Score"].ci},this.commentsScores={scores:i.Comments.average,averages:i.Comments.average,stds:i.Comments.std,cis:i.Comments.ci},this.debuggingScores={scores:i.Debugging.average,averages:i.Debugging.average,stds:i.Debugging.std,cis:i.Debugging.ci},this.namingScores={scores:i.Naming.average,averages:i.Naming.average,stds:i.Naming.std,cis:i.Naming.ci},this.analysisDeadCodePenaltyScores={scores:i["Analysis Dead Code Penalty"].average,averages:i["Analysis Dead Code Penalty"].average,stds:i["Analysis Dead Code Penalty"].std,cis:i["Analysis Dead Code Penalty"].ci},this.analysisCompoScores={scores:i["Analysis Composite Score"].average,averages:i["Analysis Composite Score"].average,stds:i["Analysis Composite Score"].std,cis:i["Analysis Composite Score"].ci},this.functionsScores={scores:i.Functions.average,averages:i.Functions.average,stds:i.Functions.std,cis:i.Functions.ci},this.sequencingScores={scores:i.Sequencing.average,averages:i.Sequencing.average,stds:i.Sequencing.std,cis:i.Sequencing.ci},this.parallelismScores={scores:i.Parallelism.average,averages:i.Parallelism.average,stds:i.Parallelism.std,cis:i.Parallelism.ci},this.decompositionCompoScores={scores:i["Decomposition Composite Score"].average,averages:i["Decomposition Composite Score"].average,stds:i["Decomposition Composite Score"].std,cis:i["Decomposition Composite Score"].ci},this.dataTypesScores={scores:i["Data Types"].average,averages:i["Data Types"].average,stds:i["Data Types"].std,cis:i["Data Types"].ci},this.variablesAndDataStructScores={scores:i["Variables and Data Structures"].average,averages:i["Variables and Data Structures"].average,stds:i["Variables and Data Structures"].std,cis:i["Variables and Data Structures"].ci},this.loopsScores={scores:i.Loops.average,averages:i.Loops.average,stds:i.Loops.std,cis:i.Loops.ci},this.patternRecAndDataRepPenaltyScores={scores:i["Pattern Recognition and Data Representation Repetition Penalty"].average,averages:i["Pattern Recognition and Data Representation Repetition Penalty"].average,stds:i["Pattern Recognition and Data Representation Repetition Penalty"].std,cis:i["Pattern Recognition and Data Representation Repetition Penalty"].ci},this.patternRecAndDataRepCompoScores={scores:i["Pattern Recognition and Data Representation Composite Score"].average,averages:i["Pattern Recognition and Data Representation Composite Score"].average,stds:i["Pattern Recognition and Data Representation Composite Score"].std,cis:i["Pattern Recognition and Data Representation Composite Score"].ci},this.functionReuseScores={scores:i["Function Reuse"].average,averages:i["Function Reuse"].average,stds:i["Function Reuse"].std,cis:i["Function Reuse"].ci},this.functionWithArgsScores={scores:i["Functions with Arguments"].average,averages:i["Functions with Arguments"].average,stds:i["Functions with Arguments"].std,cis:i["Functions with Arguments"].ci},this.variablesInsteadOfLiteralsScores={scores:i["Variables Instead of Literals"].average,averages:i["Variables Instead of Literals"].average,stds:i["Variables Instead of Literals"].std,cis:i["Variables Instead of Literals"].ci},this.generalisationAndAbstrCompoScores={scores:i["Generalisation and Abstraction Composite Score"].average,averages:i["Generalisation and Abstraction Composite Score"].average,stds:i["Generalisation and Abstraction Composite Score"].std,cis:i["Generalisation and Abstraction Composite Score"].ci},this.compositeScores={scores:i.Composite.average,averages:i.Composite.average,stds:i.Composite.std,cis:i.Composite.ci}}normaliseScores(){this.conditionalsScores.scores=O.normaliseScores(this.conditionalsScores.scores,v.Conditionals.range),this.operatorsScores.scores=O.normaliseScores(this.operatorsScores.scores,v.Operators.range),this.syncAndMessagesScores.scores=O.normaliseScores(this.syncAndMessagesScores.scores,v.SynchAndMessages.range),this.algorithmsCompoScores.scores=O.normaliseScores(this.algorithmsCompoScores.scores,v.Algorithms.range),this.commentsScores.scores=O.normaliseScores(this.commentsScores.scores,v.Comments.range),this.debuggingScores.scores=O.normaliseScores(this.debuggingScores.scores,v.Debugging.range),this.namingScores.scores=O.normaliseScores(this.namingScores.scores,v.Naming.range),this.analysisCompoScores.scores=O.normaliseScores(this.analysisCompoScores.scores,v.Analysis.range),this.functionsScores.scores=O.normaliseScores(this.functionsScores.scores,v.Functions.range),this.sequencingScores.scores=O.normaliseScores(this.sequencingScores.scores,v.Sequencing.range),this.parallelismScores.scores=O.normaliseScores(this.parallelismScores.scores,v.Parallelism.range),this.decompositionCompoScores.scores=O.normaliseScores(this.decompositionCompoScores.scores,v.Decomposition.range),this.dataTypesScores.scores=O.normaliseScores(this.dataTypesScores.scores,v.DataTypes.range),this.variablesAndDataStructScores.scores=O.normaliseScores(this.variablesAndDataStructScores.scores,v.VariablesAndDataStructures.range),this.loopsScores.scores=O.normaliseScores(this.loopsScores.scores,v.Loops.range),this.patternRecAndDataRepCompoScores.scores=O.normaliseScores(this.patternRecAndDataRepCompoScores.scores,v.PatternRecognitionAndDataRepresentation.range),this.functionReuseScores.scores=O.normaliseScores(this.functionReuseScores.scores,v.FunctionReUse.range),this.functionWithArgsScores.scores=O.normaliseScores(this.functionWithArgsScores.scores,v.Functions.range),this.variablesInsteadOfLiteralsScores.scores=O.normaliseScores(this.variablesInsteadOfLiteralsScores.scores,v.VariablesInsteadOfLiterals.range),this.generalisationAndAbstrCompoScores.scores=O.normaliseScores(this.generalisationAndAbstrCompoScores.scores,v.GeneralisationAndAbstraction.range)}calculateMovingMaxBasedOnDates(e,t="minutes"){e=Co.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.compositeScores.scores,e)}calculateLeakyIntegrator(e,t,n,o,i,a){var r=D.calculateLeakyIntegratorScores(this.conditionalsScores.scores,e,t,n,o,i,a),r=(this.conditionalsScores.leakyScores=r.leakyIntegratorScores,this.conditionalsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.operatorsScores.scores,e,t,n,o,i,a)),r=(this.operatorsScores.leakyScores=r.leakyIntegratorScores,this.operatorsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.syncAndMessagesScores.scores,e,t,n,o,i,a)),r=(this.syncAndMessagesScores.leakyScores=r.leakyIntegratorScores,this.syncAndMessagesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.algorithmsDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.algorithmsDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsCompoScores.scores,e,t,n,o,i,a)),r=(this.algorithmsCompoScores.leakyScores=r.leakyIntegratorScores,this.algorithmsCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.commentsScores.scores,e,t,n,o,i,a)),r=(this.commentsScores.leakyScores=r.leakyIntegratorScores,this.commentsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.debuggingScores.scores,e,t,n,o,i,a)),r=(this.debuggingScores.leakyScores=r.leakyIntegratorScores,this.debuggingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.namingScores.scores,e,t,n,o,i,a)),r=(this.namingScores.leakyScores=r.leakyIntegratorScores,this.namingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.analysisDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.analysisDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisCompoScores.scores,e,t,n,o,i,a)),r=(this.analysisCompoScores.leakyScores=r.leakyIntegratorScores,this.analysisCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionsScores.scores,e,t,n,o,i,a)),r=(this.functionsScores.leakyScores=r.leakyIntegratorScores,this.functionsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.sequencingScores.scores,e,t,n,o,i,a)),r=(this.sequencingScores.leakyScores=r.leakyIntegratorScores,this.sequencingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.parallelismScores.scores,e,t,n,o,i,a)),r=(this.parallelismScores.leakyScores=r.leakyIntegratorScores,this.parallelismScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.decompositionCompoScores.scores,e,t,n,o,i,a)),r=(this.decompositionCompoScores.leakyScores=r.leakyIntegratorScores,this.decompositionCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.dataTypesScores.scores,e,t,n,o,i,a)),r=(this.dataTypesScores.leakyScores=r.leakyIntegratorScores,this.dataTypesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesAndDataStructScores.scores,e,t,n,o,i,a)),r=(this.variablesAndDataStructScores.leakyScores=r.leakyIntegratorScores,this.variablesAndDataStructScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.loopsScores.scores,e,t,n,o,i,a)),r=(this.loopsScores.leakyScores=r.leakyIntegratorScores,this.loopsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepPenaltyScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepPenaltyScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepPenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepCompoScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepCompoScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionReuseScores.scores,e,t,n,o,i,a)),r=(this.functionReuseScores.leakyScores=r.leakyIntegratorScores,this.functionReuseScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionWithArgsScores.scores,e,t,n,o,i,a)),r=(this.functionWithArgsScores.leakyScores=r.leakyIntegratorScores,this.functionWithArgsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesInsteadOfLiteralsScores.scores,e,t,n,o,i,a)),r=(this.variablesInsteadOfLiteralsScores.leakyScores=r.leakyIntegratorScores,this.variablesInsteadOfLiteralsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.generalisationAndAbstrCompoScores.scores,e,t,n,o,i,a)),r=(this.generalisationAndAbstrCompoScores.leakyScores=r.leakyIntegratorScores,this.generalisationAndAbstrCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.compositeScores.scores,e,t,n,o,i,a));this.compositeScores.leakyScores=r.leakyIntegratorScores,this.compositeScores.cis=r.cis}getMovingAverageAndStdBasedOnDataPoints(t){this.dates=Q.calculateMovingAverageForDates(this.dates,t);var e=this.dates.map(e=>t),n={average:Q.calculateMovingAverageForScore(this.conditionalsScores.scores,t),std:N.calculateMovingStdForScore(this.conditionalsScores.scores,t),n:e},o={average:Q.calculateMovingAverageForScore(this.operatorsScores.scores,t),std:N.calculateMovingStdForScore(this.operatorsScores.scores,t),n:e},i={average:Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,t),std:N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,t),n:e},a={average:Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,t),n:e},r={average:Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,t),n:e},s={average:Q.calculateMovingAverageForScore(this.commentsScores.scores,t),std:N.calculateMovingStdForScore(this.commentsScores.scores,t),n:e},A={average:Q.calculateMovingAverageForScore(this.debuggingScores.scores,t),std:N.calculateMovingStdForScore(this.debuggingScores.scores,t),n:e},l={average:Q.calculateMovingAverageForScore(this.namingScores.scores,t),std:N.calculateMovingStdForScore(this.namingScores.scores,t),n:e},u={average:Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,t),n:e},c={average:Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,t),std:N.calculateMovingStdForScore(this.analysisCompoScores.scores,t),n:e},g={average:Q.calculateMovingAverageForScore(this.functionsScores.scores,t),std:N.calculateMovingStdForScore(this.functionsScores.scores,t),n:e},d={average:Q.calculateMovingAverageForScore(this.sequencingScores.scores,t),std:N.calculateMovingStdForScore(this.sequencingScores.scores,t),n:e},h={average:Q.calculateMovingAverageForScore(this.parallelismScores.scores,t),std:N.calculateMovingStdForScore(this.parallelismScores.scores,t),n:e},p={average:Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,t),std:N.calculateMovingStdForScore(this.decompositionCompoScores.scores,t),n:e},m={average:Q.calculateMovingAverageForScore(this.dataTypesScores.scores,t),std:N.calculateMovingStdForScore(this.dataTypesScores.scores,t),n:e},f={average:Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,t),std:N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,t),n:e},B={average:Q.calculateMovingAverageForScore(this.loopsScores.scores,t),std:N.calculateMovingStdForScore(this.loopsScores.scores,t),n:e},E={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,t),n:e},w={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,t),n:e},y={average:Q.calculateMovingAverageForScore(this.functionReuseScores.scores,t),std:N.calculateMovingStdForScore(this.functionReuseScores.scores,t),n:e},C={average:Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,t),std:N.calculateMovingStdForScore(this.functionWithArgsScores.scores,t),n:e},b={average:Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,t),std:N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,t),n:e},I={average:Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,t),std:N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,t),n:e},e={average:Q.calculateMovingAverageForScore(this.compositeScores.scores,t),std:N.calculateMovingStdForScore(this.compositeScores.scores,t),n:e};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}getMovingAverageAndStdBasedOnDates(e,t="minutes"){var e=Q.calculateWindowIndices(this.dates,e,t),t=e.map(e=>e.length),n=(this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),{average:Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),n:t}),o={average:Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),n:t},i={average:Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),n:t},a={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),n:t},r={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),n:t},s={average:Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),n:t},A={average:Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),n:t},l={average:Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),n:t},u={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),n:t},c={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),n:t},g={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),n:t},d={average:Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),n:t},h={average:Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),n:t},p={average:Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),n:t},m={average:Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),n:t},f={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),n:t},B={average:Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),n:t},E={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),n:t},w={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),n:t},y={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),n:t},C={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),n:t},b={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),n:t},I={average:Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),n:t},e={average:Q.calculateMovingAverageForScoreGivenIndices(this.compositeScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e),n:t};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}calculateCompositeScoreOverTime(){var t=[];for(let e=0;e<this.dates.length;e++){var n=jn.calculateCompositeScore({algorithmsCompoScores:this.algorithmsCompoScores.scores[e],analysisCompoScores:this.analysisCompoScores.scores[e],decompositionCompoScores:this.decompositionCompoScores.scores[e],patternRecAndDataRepCompoScores:this.patternRecAndDataRepCompoScores.scores[e],generalisationAndAbstrCompoScores:this.generalisationAndAbstrCompoScores.scores[e]});t.push(n)}this.compositeScores.scores=t}calculateAverageGivenTimeWindow(e,t,n="minutes"){this.isSorted||this.sort();e=class{static calculateWindowIndicesFromLastTimestamp(t,n,o="minutes"){var i=t.map(e=>I(e)),a=[],t=i.length-1,r=i[t],s=a.length;for(let e=t;0<=e;e--)r.diff(i[e],o)<=n?(a[s]||(a[s]=[]),a[s].push(e)):e;return a}}.calculateWindowIndicesFromLastTimestamp(this.dates,e,n),t=k.calculateWeightsGivenIndicesAndDates(e,this.dates,t,n);this.conditionalsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.conditionalsScores.scores,e,t),this.operatorsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.operatorsScores.scores,e,t),this.syncAndMessagesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.syncAndMessagesScores.scores,e,t),this.algorithmsDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsDeadCodePenaltyScores.scores,e,t),this.algorithmsCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsCompoScores.scores,e,t),this.commentsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.commentsScores.scores,e,t),this.debuggingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.debuggingScores.scores,e,t),this.namingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.namingScores.scores,e,t),this.analysisDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisDeadCodePenaltyScores.scores,e,t),this.analysisCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisCompoScores.scores,e,t),this.functionsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionsScores.scores,e,t),this.sequencingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.sequencingScores.scores,e,t),this.parallelismScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.parallelismScores.scores,e,t),this.decompositionCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.decompositionCompoScores.scores,e,t),this.dataTypesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.dataTypesScores.scores,e,t),this.variablesAndDataStructScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesAndDataStructScores.scores,e,t),this.loopsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.loopsScores.scores,e,t),this.patternRecAndDataRepPenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepPenaltyScores.scores,e,t),this.patternRecAndDataRepCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepCompoScores.scores,e,t),this.functionReuseScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionReuseScores.scores,e,t),this.functionWithArgsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionWithArgsScores.scores,e,t),this.variablesInsteadOfLiteralsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesInsteadOfLiteralsScores.scores,e,t),this.generalisationAndAbstrCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.generalisationAndAbstrCompoScores.scores,e,t),this.compositeScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.compositeScores.scores,e,t)}exportToLineGraphData(t,e){var n=[];if("scores"===e)for(let e=0;e<t.length;e++){const r=t[e],s=bo[r];n.push({x:this.dates,y:this.categoryNamesMap()[r].scores,name:vo(r,20),legendgroup:s,hoverinfo:"text",text:this.categoryNamesMap()[r].scores.map((e,t)=>`${s}<br>${r}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"})}else{if("ci"!==e)return[];for(let e=0;e<t.length;e++){const A=t[e],l=bo[A];var o=this.categoryNamesMap()[A],i=null==(i=o.cis)?void 0:i.map(e=>e[0]),a=null==(a=o.cis)?void 0:a.map(e=>e[1]);n.push({x:this.dates,y:o.scores,name:vo(A,20),legendgroup:l,hoverinfo:"text",text:o.scores.map((e,t)=>`${l}<br>${A}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),n.push({x:this.dates,y:a,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),n.push({x:this.dates,y:i,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}}return n}exportToSpiderGraphData(t,e,n=!1){var o={};if("scores"!==e)return[];if(n)for(let e=0;e<t.length;e++){var i=t[e],a=bo[i];o[a]||(o[a]={type:"scatterpolar",r:[],theta:[],fill:"",name:a}),o[a].r.push(this.categoryNamesMap()[i].scores[0]),o[a].theta.push(i)}else o.Average={type:"scatterpolar",r:t.map(e=>this.categoryNamesMap()[e].scores[0]),theta:t.map(e=>bo[e]),fill:"toself",name:"Average"};return Object.values(o)}exportToHeatMapData(t,e){var n=[];if("scores"!==e)return[];var o=[];for(let e=0;e<t.length;e++){var i=t[e];o.push(this.categoryNamesMap()[i].scores)}return n.push({x:this.dates,y:t,z:o,type:"heatmap",colorscale:"BuGn"}),n}exportToLeakyIntegratorData(n){var o=[];for(let t=0;t<n.length;t++){const s=n[t],A=bo[s];var i=this.categoryNamesMap()[s];let e=!1;i.cis&&0<i.cis.length&&(e=!0);var a=null==(a=i.cis)?void 0:a.map(e=>e[0]),r=null==(r=i.cis)?void 0:r.map(e=>e[1]);o.push({x:this.dates.map((e,t)=>t),y:i.scores,name:vo(s,20),type:"bar"}),o.push({x:this.dates.map((e,t)=>t),y:i.leakyScores,name:vo("Leaky "+s,20),legendgroup:A,hoverinfo:"text",text:null==(i=i.leakyScores)?void 0:i.map((e,t)=>`${A}<br>${s}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),e&&o.push({x:this.dates.map((e,t)=>t),y:r,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),e&&o.push({x:this.dates.map((e,t)=>t),y:a,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}return o}}function vo(e,t){return e.length>t?e.substr(0,t-1)+"...":e}class Mo{constructor(e){this.data=new Io(e)}sortData(){return this.data.sort(),this}normaliseScores(){return this.data.normaliseScores(),this}calculateMovingAverageBasedOnDataPoints(e){return this.data.calculateMovingAverageBasedOnDataPoints(e),this}calculateMovingAverageBasedOnDates(e,t="minutes"){return this.data.calculateMovingAverageBasedOnDates(e,t),this}calculateMovingStdBasedOnDataPoints(e){return this.data.calculateMovingStdBasedOnDataPoints(e),this}calculateMovingStdBasedOnDates(e,t="minutes"){return this.data.calculateMovingStdBasedOnDates(e,t),this}calculateCompositeScoreOverTime(){return this.data.calculateCompositeScoreOverTime(),this}calculateAverageGivenTimeWindow(e,t="automatic",n="minutes"){return this.data.calculateAverageGivenTimeWindow(e,t,n),this}calculateMovingConfidenceIntervals(e,t="dataPoints",n="minutes"){return this.data.calculateMovingConfidenceIntervals(e,t,n),this}calculateMovingMaxBasedOnDates(e,t="minutes"){return this.data.calculateMovingMaxBasedOnDates(e,t),this}calculateLeakyIntegrator(e,t,n,o,i,a){return this.data.calculateLeakyIntegrator(e,t,n,o,i,a),this}exportToLineGraphData(e=[],t="scores"){return this.data.exportToLineGraphData(e,t)}exportToSpiderGraphData(e=[],t="scores",n=!1){return this.data.exportToSpiderGraphData(e,t,n)}exportToHeatMapData(e=[],t="scores"){return this.data.exportToHeatMapData(e,t)}exportToLeakyIntegratorData(e=[]){return this.data.exportToLeakyIntegratorData(e)}}class To{static compareStars(i){const a={},r=To.previousStars;return r?(Object.keys(i).forEach(e=>{const n=r[e]?r[e][1]:[];var t=i[e][1];const o=i[e][0];a[e]=t.map((e,t)=>1===e&&1!==n[t]&&o[t])}),To.previousStars=i):(To.previousStars=i,Object.keys(i).forEach(e=>{var t=i[e][1];const n=i[e][0];a[e]=t.map((e,t)=>1===e&&n[t])})),a}}To.previousStars=null;var So=To;R.default=t},function(F,R,e){"use strict";var i;e.r(R),e.d(R,"Preprocessor",function(){return Mo}),e.d(R,"ScoresUtils",function(){return C}),e.d(R,"StarProgressTracker",function(){return So}),e.d(R,"DataToStars",function(){return $n}),(t=i=i||{}).STUDENT_OR_TEACHER_CHANGED="studentOrTeacherChanged",t.IS_USER_LOGGED_IN_CHANGED="isUserLoggedInChanged",t.NEW_CLASS_ANNOUNCEMENT="newClassAnnouncement",t.NEW_CLASS_ANNOUNCEMENT_RESPONSE="newClassAnnouncementResponse";class Y{constructor(e,t,n){if(this.id=e,this.typeOfEventToListenFor=t,this.cb=n,!this.id||!this.cb||!this.typeOfEventToListenFor)throw new TypeError('The subclass must define the "id", "typeOfEventToListenFor" and "cb" properties.')}notify(e,t){e===this.typeOfEventToListenFor&&this.cb(t)}}const U={EXCHANGE_CODE:"exchange_code",REFRESH_TOKEN:"refresh_token"},L={web:"https://codemarty.com",staging:"https://marty-webapp--code-assess-nf60oacq.web.app",mobile:"com.robotical.app://oauth2redirect","dev-mb":"http://localhost:8601","dev-webapp":"http://localhost:3000"};class G{constructor(e){this.verifier=null,this.access_token=null,this.expiry_date=null,this.refresh_token=null,this.API=e,this.id_token=null}async checkSession(){var e=localStorage.getItem("accessToken"),t=localStorage.getItem("idToken"),n=localStorage.getItem("expiryDate");if(e&&t&&n){this.access_token=e,this.id_token=t,this.expiry_date=n;try{if(!await this.API.initGapiClient())return console.warn("error initializing gapi client with pre-existing credentials"),!1}catch(e){return console.error("error initializing gapi client",e),!1}return!0}return!1}clearSession(){localStorage.removeItem("accessToken"),localStorage.removeItem("idToken"),localStorage.removeItem("expiryDate")}async login(){return await this.checkSession()?(console.log("User already logged in with a valid session."),!0):!0===await new Promise((e,t)=>{var n=document.createElement("script");n.src="https://accounts.google.com/gsi/client",n.onload=()=>{e(!0)},n.onerror=e=>{t(e)},document.body.appendChild(n)})?new Promise((n,o)=>{var e=google.accounts.oauth2.initCodeClient({client_id:"766117397217-omuiqp8095susapkpn5oivhe7tt245ot.apps.googleusercontent.com",scope:po.join(" "),ux_mode:"popup",error_callback:e=>{console.log("init code client error callback",e),o(e)},callback:e=>{console.log("init code client",e);var t=L[this.API.codeAssess.platform];fetch("https://ocsqy2jx5b.execute-api.us-east-1.amazonaws.com/prod/exchange_code",{method:"POST",body:JSON.stringify({endpoint:U.EXCHANGE_CODE,code:e.code,redirect_uri:window.redirect_uri||t}),headers:{"Content-Type":"application/json"}}).then(e=>(console.log("response",e),e.json())).then(async e=>{if(200===e.statusCode)try{e=JSON.parse(e.body)}catch(e){console.log("error parsing data",e)}e.success?(console.log("user logged in successfully",e),this.access_token=e.tokens.access_token,this.id_token=e.tokens.id_token,this.expiry_date=e.tokens.expiry_date,this.refresh_token=e.tokens.refresh_token||null,localStorage.setItem("accessToken",this.access_token||""),localStorage.setItem("idToken",this.id_token||""),localStorage.setItem("expiryDate",this.expiry_date||""),await this.API.initGapiClient(),n(!0)):(console.log("user login failed",e),o(e))}).catch(e=>{console.log("error trying to exchange",e),o(e)})}}).requestCode();console.log("code",e)}):(console.error("Error loading GSI script."),!1)}async logout(){fetch("https://accounts.google.com/o/oauth2/revoke?token="+this.access_token,{method:"POST"}).then(e=>{console.log("logout response",e),this.access_token=null,this.id_token=null,this.expiry_date=null,this.refresh_token=null}).catch(e=>console.error("Error:",e))}}class P{constructor(e){this.loadGAPIScript=()=>new Promise((e,t)=>{var n=document.createElement("script");n.src="https://apis.google.com/js/api.js",n.onload=()=>{e(!0)},n.onerror=e=>{t(e)},document.body.appendChild(n)}),this.API=e,this.loadGAPIScript()}async createCourseWork(e,t,n,o="ASSIGNMENT"){try{var i,a;if(this.API.gapi_client)return i={title:t,description:n,state:"PUBLISHED",workType:o},a=await this.API.gapi_client.request({method:"POST",path:S.CREATE_COURSEWORK(e),body:i}),console.log("Created course work:",a.result),a.result||null;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error creating course work:",e),e}}async listClassess(){var e,t;try{if(this.API.gapi_client)return t=await this.API.gapi_client.request({path:S.LIST_ALL_COURSES(),params:{pageSize:10}}),console.log("listClassess response",t.result.courses),(null==(e=t.result)?void 0:e.courses)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while listing classrooms:",e),[]}}async listCourseWorks(t){var e,n;try{if(this.API.gapi_client)return n=await this.API.gapi_client.request({path:S.LIST_ALL_COURSEWORK(t),params:{pageSize:10}}),console.log("listCourseWorks response",n.result.courseWork),(null==(e=n.result)?void 0:e.courseWork)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing courseWork for course ${t}:`,e),[]}}async listStudents(t){var e,n;try{if(this.API.gapi_client)return n=await this.API.gapi_client.request({path:S.LIST_ALL_STUDENTS(t),params:{pageSize:10}}),console.log("listStudents response",n.result.students),(null==(e=n.result)?void 0:e.students)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing students for course ${t}:`,e),[]}}async listStudentSubmissions(t,n){var e,o;try{if(this.API.gapi_client)return o=await this.API.gapi_client.request({path:S.LIST_ALL_STUDENT_SUBMISSIONS(t,n),params:{pageSize:10}}),console.log("studentSubmissions response",o.result.studentSubmissions),(null==(e=o.result)?void 0:e.studentSubmissions)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing studentSubmissions for course ${t} and courseWork ${n}:`,e),[]}}async addAttachementInCourseWork(e,t,n,o){try{var i,a;if(this.API.gapi_client)return i={addAttachments:[{youTubeVideo:{id:o}}]},a=await this.API.gapi_client.request({method:"POST",path:S.MODIFY_ATTACHEMENTS_OF_COURSEWORK(e,t,n),body:i}),console.log("Added attachment in course work:",a.result),a.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error turning in assignment:",e),e}}async turnInCourseWork(e,t,n){try{var o;if(this.API.gapi_client)return o=await this.API.gapi_client.request({method:"POST",path:S.TURN_IN_COURSEWORK(e,t,n)}),console.log("Turned in assignment:",o.result),o.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error turning in assignment:",e),e}}async patchCourseWork(e,t,n,o,i){try{var a;if(this.API.gapi_client)return a=await this.API.gapi_client.request({method:"PATCH",path:S.PATCH_COURSEWORK(e,t,n,i),body:o}),console.log("Patched course work:",a.result),a.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error patching course work:",e),e}}}var c=e(87),g=e(12),H=e(123);function j(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]]);return n}Object.create;Object.create;var t=e(189);function z(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const J=z,W=new g.b("auth","Firebase",z());
|
|
6671
|
+
function(e,t){if((e=Object(c.b)(e,"auth")).isInitialized()){const o=e.getImmediate();var n=e.getOptions();if(Object(g.h)(n,null!=t?t:{}))return o;l(o,"already-initialized")}const o=e.initialize({options:t});return o}(e,{popupRedirectResolver:kn,persistence:[Lt,vt,Tt]});var o,i,a,t=Object(g.m)("authTokenSyncURL");if(t){a=t;const s=async e=>{var e=e&&await e.getIdTokenResult(),t=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;t&&t>Rn||(t=null==e?void 0:e.token,Yn!==t&&(Yn=t,await fetch(a,{method:t?"POST":"DELETE",headers:t?{Authorization:"Bearer "+t}:{}})))};e=n,t=s,r=()=>s(n.currentUser),Object(g.n)(e).beforeAuthStateChanged(t,r),e=n,t=e=>s(e),Object(g.n)(e).onIdTokenChanged(t,o,i)}var r=Object(g.k)("auth");return r&&Ve(n,"http://"+r),n}Fn="Browser",Object(c.c)(new t.a("auth",(e,{options:t})=>{var n=e.getProvider("app").getImmediate(),o=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options,i=(h(i&&!i.includes(":"),"invalid-api-key",{appName:n.name}),{apiKey:i,authDomain:a,clientPlatform:Fn,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Re(Fn)}),a=new Le(n,o,e,i);return n=a,e=(null==(o=t)?void 0:o.persistence)||[],e=(Array.isArray(e)?e:[e]).map(u),null!=o&&o.errorMap&&n._updateErrorMap(o.errorMap),n._initializeWithPersistence(e,null==o?void 0:o.popupRedirectResolver),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Object(c.c)(new t.a("auth-internal",e=>{var e=Ge(e.getProvider("auth").getImmediate());return e=e,new _n(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Object(c.g)(On,"1.5.1",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Fn)),Object(c.g)(On,"1.5.1","esm2017");var E,w=e(21);const Ln={apiKey:"AIzaSyD8Kwib8K_I4jTw2eTbQPWRMKA4SjeonIw",authDomain:"northern-net-403811.firebaseapp.com",projectId:"northern-net-403811",storageBucket:"northern-net-403811.appspot.com",messagingSenderId:"766117397217",appId:"1:766117397217:web:32e639ee12d7b2d7d1ada0",measurementId:"G-3X2F1HT4YE"};(t=E=E||{})[t.Ready=0]="Ready",t[t.InProgress=1]="InProgress",t[t.Done=2]="Done";class Gn{constructor(e){this.firebaseInitialisedFlag=E.Ready,this.app=null,this.auth=null,this.API=e}hasFirebaseBeenInitialised(){return this.firebaseInitialisedFlag==E.Done}initialiseFirestore(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");let n;this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{var o=A.credential(this.API.gapiConnectionAPI.id_token,this.API.gapiConnectionAPI.access_token);console.log("credential",o),n=await ft(this.auth,o)}catch(e){return console.log("Error signing in: ",e),t(e)}if(n.user){this.firebaseInitialisedFlag=E.Done;try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return console.log("Successfully signed in to Firebase."),e(!0)}return this.firebaseInitialisedFlag=E.Ready,console.log("Couldn't connect to Firebase. User not signed in google."),t("User not signed in Google.")})}initialiseFirestoreWithoutSignIn(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return this.firebaseInitialisedFlag=E.Done,console.log("Successfully initialized Firebase."),e(!0)})}}var Pn=e(227);Pn.enc.Utf8.parse("some_fixed_iv_here");class y{static generateKey(e){return Pn.SHA256(e).toString()}static encrypt(e,t){return e}static decrypt(e,t){return e}}class Hn{constructor(e,t,n,o,i){this.studentSubmissions=null,this.id=e,this.classId=t,this.title=n,this.description=o,this.API=i}async addAttachment(e,t,n){await this.requestStudentSubmissionsList();var o=null==(o=this.studentSubmissions)?void 0:o.find(e=>e.userId===t);return o?await this.API.gapiClassroomAPI.addAttachementInCourseWork(this.classId,e,o.id,n):(console.error("StudentSubmission not found"),!1)}async getListOfStudentSubmissions(){return this.studentSubmissions||await this.requestStudentSubmissionsList(),this.studentSubmissions||[]}async requestStudentSubmissionsList(){var e=await this.API.gapiClassroomAPI.listStudentSubmissions(this.classId,this.id);this.studentSubmissions=e}}class jn{static calculateCompositeScore({algorithmsCompoScores:e,analysisCompoScores:t,decompositionCompoScores:n,patternRecAndDataRepCompoScores:o,generalisationAndAbstrCompoScores:i,badgesScores:a}){var r=a;let s=0,A=0,l=0,u=0,c=0,g=0;for(const h in r){var d=r[h];d[0]&&(s+=d[0],A++),d[1]&&(l+=d[1],u++),d[2]&&(c+=d[2],g++)}return e+t+n+o+i+s+l+c}}class C{static calculatePatternRecognitionAndDataRepresentationScore(e,t){let n=t["Duplicate Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e["Data Types"]*t+e.Loops*t+e["Variables and Data Structures"]*t}static calculateDecompositionScore(e){return e.Functions+e.Parallelism+e.Sequencing}static calculateGeneralisationAndAbstractionScore(e){return e["Function Reuse"]+e["Functions with Arguments"]+e["Variables Instead of Literals"]}static calculateAlgorithmsScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Conditionals*t+e.Operators*t+e["Synchronization and Messages"]*t}static calculateAnalysisScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Comments*t+e.Debugging*t+e.Naming*t}}var zn,Jn,On=e(208),b=e.n(On),t=e(794),Wn=e.n(t),On=e(795),Vn=e.n(On);const Kn=()=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()().tz("Europe/London").format()),I=e=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()(e).tz("Europe/London")),Xn=(e,t,n="seconds")=>{e=b()(e),t=b()(t);return e.diff(t,n)};(t=zn=zn||{}).STARTED="STARTED",t.STOPPED="STOPPED",(Jn=Jn||{}).LAST_HEARTBEAT="lastUploadTime";var qn=class{constructor(){this.heartbeatInterval=null,this.heartbeatCallbacks={},this.status=zn.STOPPED}startHeartbeat(){this.heartbeatInterval?console.warn("Heartbeat already started."):(this.heartbeatInterval=setInterval(()=>{Object.values(this.heartbeatCallbacks).forEach(e=>e())},5e3),this.status=zn.STARTED)}stopHeartbeat(){this.heartbeatInterval?(console.debug("stopping heartbeat"),clearInterval(this.heartbeatInterval),this.heartbeatInterval=null,this.status=zn.STOPPED):console.warn("Heartbeat not running.")}setHeartbeatCallback(e,t){this.heartbeatCallbacks[e]&&console.warn(`Callback with id ${e} already set. Overwriting.`),this.heartbeatCallbacks[e]=t}removeHeartbeatCallback(e){this.heartbeatCallbacks[e]?delete this.heartbeatCallbacks[e]:console.warn(`Callback with id ${e} does not exist.`)}},v=e(37);const Zn={Loops:[v.Loops_1.progressionRanges,v.Loops_2.progressionRanges,v.Loops_3.progressionRanges],Functions:[v.Functions_1.progressionRanges,v.Functions_2.progressionRanges,v.Functions_3.progressionRanges],Conditionals:[v.Conditionals_1.progressionRanges,v.Conditionals_2.progressionRanges,v.Conditionals_3.progressionRanges],"Data Types":[v.DataTypes_1.progressionRanges,v.DataTypes_2.progressionRanges,v.DataTypes_3.progressionRanges],Operators:[v.Operators_1.progressionRanges,v.Operators_2.progressionRanges,v.Operators_3.progressionRanges],Parallelism:[v.Parallelism_1.progressionRanges,v.Parallelism_2.progressionRanges],"Variables and Lists":[v.VariablesAndLists_1.progressionRanges,v.VariablesAndLists_2.progressionRanges,v.VariablesAndLists_3.progressionRanges]};class $n{static toStars(e){var t={};for(const a in Zn){t[a]=[[],[]];var n=e[a];for(let e=0;e<n.length;e++){var[o,i]=function(t,n){var o=["#cd7f32","silver","gold"];for(let e=0;e<n.length;e++){var i=n[e][0],a=n[e][1];if(i<t&&t<=a)return[o[e%o.length],(t-i)/(a-i)]}return t>=n[n.length-1][1]?["gold",1]:["white",0]}(n[e],Zn[a][e]);o&&(t[a][0].push(o),t[a][1].push(i))}}return t}}class eo{constructor(e,t,n,o,i,a,r,s){this.heartbeat=null,this.scoresOverTime=null,this.reactionsOverTime=null,this.badges=null,this.lastHeartbeat=null,this.onStudentDataDocChangeCbs=new Map,this.studentId=t,this.classId=e,this.id=o||eo.compileStudentDataId(e,t),this.API=n,this.scoresOverTime=i||null,this.badges=a||new v.BadgesCounts,this.lastHeartbeat=r||null,this.reactionsOverTime=s||null}static compileStudentDataId(e,t){return e+"_"+t}initialiseHeartbeat(){this.heartbeat&&(console.warn("Heartbeat already created. Removing this heartbeat and creating a new one"),this.heartbeat.stopHeartbeat()),this.heartbeat=new qn,this.startSendingLastHeartbeatTime()}startSendingLastHeartbeatTime(){var e;this.heartbeat||(console.warn("Heartbeat not created, creating heartbeat"),this.initialiseHeartbeat()),console.debug("setting heartbeat callback"),null!=(e=this.heartbeat)&&e.setHeartbeatCallback(Jn.LAST_HEARTBEAT,this.sendLastHeartbeatTime.bind(this)),null!=(e=this.heartbeat)&&e.startHeartbeat()}sendLastHeartbeatTime(){this.API.firestoreStudentDataAPI.updateLastHeartbeatTime(this.classId,this.studentId)}stopHeartbeat(){this.heartbeat&&(this.heartbeat.stopHeartbeat(),this.heartbeat=null)}async sendStudentAssessmentScores(e){e={scoresOverTime:{[Kn()]:e}};await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e)}async sendStudentBadgesData(e){await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,{badges:e})}async sendStudentEmojiReaction(e){e={reactionsOverTime:{[Kn()]:e}};try{return await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e),!0}catch(e){return console.error("Failed to send student reaction to database",e),!1}}async subscribeToDbDocChanges(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onStudentDataDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreStudentDataAPI.subscribeToStudentDataDocChanges(this.classId,this.studentId,t=>{this.onStudentDataDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onStudentDataDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onStudentDataDocChangeCbs.has(e)?this.onStudentDataDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.onStudentDataDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}getLastScore(){var e;return this.scoresOverTime&&(e=Object.keys(this.scoresOverTime).sort().reverse()[0])?{[e]:this.scoresOverTime[e]}:null}badgesToStars(){return this.badges?$n.toStars(this.badges):(console.warn("badges is null"),null)}}var M=eo;class to{constructor(e,t,n){this.classess=null,this.studentData=null,this.joinedClass=null,this.id=e,this.name=t,this.API=n}async joinClass(t){await this.getListOfClassess();var e,n=null==(n=this.classess)?void 0:n.find(e=>e.id===t);return n?(e=await this.requestStudentData(t))?(e.initialiseHeartbeat(),this.joinedClass=n,await this.listenForClassAnnouncements(this.API.codeAssess.onNewClassAnnouncement.bind(this.API.codeAssess)),!0):(console.error("Student data not found"),!1):(console.error("Class not found"),!1)}async exitClass(){return this.joinedClass?(await this.requestStudentData(this.joinedClass.id),this.studentData?(this.studentData.stopHeartbeat(),this.joinedClass.unsubscribeFromDbDocChanges(),this.joinedClass=null,!(this.studentData=null)):(console.error("Student data not found"),!1)):(console.error("Student is not in a class"),!1)}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async requestStudentData(e){if(this.doesStudentDataExist(e))return console.log("StudentData already exists"),this.studentData;let t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);if(t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id)))return console.debug("fetched studentData",t),e=new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime),this.addStudentData(e),e;console.error("Failed to create student data in db")}async fetchStudentData(e){var t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);return t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id))?new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime):void console.error("Failed to create student data in db")}addStudentData(e){this.doesStudentDataExist(e.classId)?console.warn("StudentData already exists"):(this.studentData&&this.studentData.stopHeartbeat(),this.studentData=e)}doesStudentDataExist(e){return!!this.studentData&&this.studentData.classId===e}getActivityStatus(e){if(!e.lastHeartbeat)return"offline";var t=Kn(),n=e.lastHeartbeat;if(7<Xn(t,n,"seconds"))return"offline";if(console.log("studentData.scoresOverTime",e.scoresOverTime),!e.scoresOverTime)return"inactive";n=e.getLastScore();if(!n)return"inactive";console.log("lastScore",n);e=Object.keys(n)[0],n=I(e);return 30<Xn(t,n.toString(),"seconds")?"inactive":"active"}getCompositeScore(e,t=!0){var n;return e.scoresOverTime&&(n=e.getLastScore(),t=t?e.badges:{},n)&&Object.keys(n)[0]?(e=Object.values(n)[0],jn.calculateCompositeScore({algorithmsCompoScores:C.calculateAlgorithmsScore(e.Algorithms,e["Dead Code"]),analysisCompoScores:C.calculateAnalysisScore(e.Analysis,e["Dead Code"]),decompositionCompoScores:C.calculateDecompositionScore(e.Decomposition),patternRecAndDataRepCompoScores:C.calculatePatternRecognitionAndDataRepresentationScore(e["Pattern Recognition and Data Representation"],e.Repetition),generalisationAndAbstrCompoScores:C.calculateGeneralisationAndAbstractionScore(e["Generalisation and Abstraction"]),badgesScores:t})):0}async listenForClassAnnouncements(n){return this.joinedClass?(await this.joinedClass.subscribeToDbDocChanges("studentJoinedClassAnnouncements",async t=>{if(t.announcements)if(0===t.announcements.length)console.warn("No announcements in class");else{t=await t.getActiveAnnouncements();if(t&&0!==t.length){let e=t[0];1<t.length&&(console.warn("More than one active announcement, using the last one"),e=t[t.length-1]),e?n(e):console.error("Announcement not found")}else console.warn("No active announcements")}}),!0):(console.warn("Student has not joined a class, cannot listen for joined class announcements"),!1)}async getAnnouncement(e){return this.joinedClass?await this.API.firestoreClassAnnouncementsAPI.get(e,this.joinedClass.id):(console.warn("Student has not joined a class, cannot get announcement"),null)}async sendEmojiFeedback(e,t){if(!this.joinedClass)return console.warn("Student has not joined a class, cannot send emoji feedback"),!1;e=await this.getAnnouncement(e);if(!e)return console.error("Announcement not found"),!1;var n=await this.requestStudentData(this.joinedClass.id);if(!n)return console.error("Student data not found"),!1;n=await n.sendStudentEmojiReaction({reaction:t});if(n&&!await e.respond(this.id,this.name,t))return console.error("Failed to respond to announcement"),!1;return!0}}class no{constructor(e,t,n,o,i,a,r,s){this.courseWorks=null,this.students=null,this.announcements=[],this.onDocChangeCbs=new Map,this.id=e,this.teacherId=t,this.name=n,this.API=o,this.section=i,this.subject=a,this.room=r,this.announcements=s||[]}async getListOfCourseWorks(){return this.courseWorks||await this.requestListOfCourseWorks(),this.courseWorks||[]}async getListOfStudents(){return this.students||await this.requestListOfStudents(),this.students||[]}async createCourseWork(e,t){var e=await this.API.gapiClassroomAPI.createCourseWork(this.id,e,t),t=new Hn(e.id,this.id,e.title,e.description,this.API);return null!=(e=this.courseWorks)&&e.push(t),t}async requestListOfCourseWorks(){var e=(await this.API.gapiClassroomAPI.listCourseWorks(this.id)).map(e=>new Hn(e.id,this.id,e.title,e.description,this.API));this.courseWorks=e}async requestListOfStudents(){var e=(await this.API.gapiClassroomAPI.listStudents(this.id)).map(e=>new to(e.userId,e.profile.name.fullName,this.API));this.students=e}async createStudentDataForAllStudentsIfNotExists(){if(this.students||await this.requestListOfStudents(),this.students){const n=[];await Promise.all(this.students.map(async e=>{var t=await this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(this.id,e.id);n.push({[e.id]:t})})),console.log("wasStudentDataCreatedSuccessfully?",n)}}async getStudentDataForAllStudents(){return this.students||await this.requestListOfStudents(),this.students?(await Promise.all(this.students.map(async e=>{return await this.API.firestoreStudentDataAPI.getStudentData(this.id,e.id)}))).map(e=>e?new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime):null):[]}async appendFetchedStudentDataToStudents(){var e;this.students||await this.requestListOfStudents(),await this.createStudentDataForAllStudentsIfNotExists();const n=await this.API.firestoreStudentDataAPI.getStudentDataListGivenClassId(this.id);null!=(e=this.students)&&e.forEach(t=>{var e=n.find(e=>e.studentId===t.id);e&&(e=new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime),t.addStudentData(e))})}async announce(e,t){e=await this.API.firestoreClassAnnouncementsAPI.create(this.id,e,t);return e?await this.API.firestoreClassesAPI.addClassAnnouncement(this.id,e)?e:(console.warn("Failed to add announcement to class"),!1):(console.warn("Failed to create announcement -- announcementId is falsy"),!1)}async removeAnnouncement(e){return!!await this.API.firestoreClassesAPI.removeClassAnnouncement(this.id,e)||(console.warn("Failed to remove announcement from class"),!1)}async deactivateAnnouncement(e){var t=await e.deactivate();return"text"!==e.type||await this.removeAnnouncement(e.id)?!!t||(console.warn("Failed to deactivate announcement"),!1):(console.warn("Failed to remove announcement"),!1)}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassesAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async getAnnouncements(){var e=await this.API.firestoreClassesAPI.getClassAnnouncementIds(this.id)||[];return(await Promise.all(e.map(async e=>{var t=await this.API.firestoreClassAnnouncementsAPI.get(e,this.id);return t||(console.warn(`Announcement with ID ${e} does not exist`),null)}))).filter(e=>null!==e)}async getActiveAnnouncements(){var e=await this.API.firestoreClassAnnouncementsAPI.getActiveAnnouncements(this.id);return e&&0!==e.length?e.filter(e=>null!==e):(console.warn("There are no active announcements for class with ID "+this.id),[])}}const oo="Classes";class io{constructor(e){this.API=e}async createClass(e,t,n){var o;return this.API.firestoreDb?(o=y.encrypt(e,e),o=Object(w.c)(this.API.firestoreDb,oo,o),(await Object(w.d)(o)).exists()?(console.log("Class already exists"),!1):(n=y.encrypt(n,e),t=y.encrypt(t,e),await Object(w.i)(o,{name:t,teacherId:n}),console.log("Class created"),!0)):(console.error("Firestore db not initialized"),!1)}async getClass(t){var e,n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(n=await Object(w.d)(n)).exists()?(n=n.data(),{name:y.decrypt(n.name,t),teacherId:y.decrypt(n.teacherId,t),students:null==(e=n.students)?void 0:e.map(e=>y.decrypt(e,t)),announcements:n.announcements}):(console.log("Class does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateClassStudents(t,e){var n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(await Object(w.d)(n)).exists()?(e=e.map(e=>y.encrypt(e,t)),await Object(w.i)(n,{students:e},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async addClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.announcements)||[],await Object(w.i)(e,{announcements:[...n,t]},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async removeClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=((null==(n=n.data())?void 0:n.announcements)||[]).filter(e=>e!==t),await Object(w.i)(e,{announcements:n},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=y.encrypt(t,t),e=Object(w.c)(this.API.firestoreDb,oo,e),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new no(t,y.decrypt(e.teacherId,t),y.decrypt(e.name,t),this.API,void 0,void 0,void 0,e.announcements),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async getClassAnnouncementIds(e){return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(e=await Object(w.d)(e)).exists()?e.data().announcements:(console.log("Class does not exist"),[])):(console.error("Firestore db not initialized"),[])}}class ao{constructor(e){this.firestoreDb=null,this.API=e}async createClassIfDoesntExist(e,t,n){var o;return this.API.firestoreDb?(o=await this.API.firestoreClassesAPI.getClass(e))?(console.log("Class exists",o),!0):(console.log("Class does not exist, creating class"),await this.API.firestoreClassesAPI.createClass(e,t,n)?(console.log("Class created",e),o=await this.API.firestoreClassesAPI.getClass(e),console.log("Class data",o),!0):(console.error("Failed to create class"),!1)):(console.error("Firestore db not initialized"),!1)}async addStudentToClassIfHasntBeenAddedAlready(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreClassesAPI.getClass(e))?((n=n.students||[]).includes(t)?console.log("Student has already been added to class"):(console.log("Student has not been added to class, adding student to class"),n.push(t),await this.API.firestoreClassesAPI.updateClassStudents(e,n),console.log("Student added to class")),!0):(console.log("Class does not exist"),!1):(console.error("Firestore db not initialized"),!1)}async createTeacherIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreTeachersAPI.getTeacher(e))?(console.log("Teacher exists",n),!0):(console.log("Teacher does not exist, creating teacher"),await this.API.firestoreTeachersAPI.createTeacher(e,t)?(console.log("Teacher created",e),n=await this.API.firestoreTeachersAPI.getTeacher(e),console.log("Teacher data",n),!0):(console.error("Failed to create teacher"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentsAPI.getStudent(e))?(console.log("Student exists",n),!0):(console.log("Student does not exist, creating student"),await this.API.firestoreStudentsAPI.createStudent(e,t)?(console.log("Student created",e),n=await this.API.firestoreStudentsAPI.getStudent(e),console.log("Student data",n),!0):(console.error("Failed to create student"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentDataIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentDataAPI.getStudentData(e,t))?(console.log("StudentData exists",n),!0):(console.log("StudentData does not exist, creating studentData"),await this.API.firestoreStudentDataAPI.createStudentData(e,t)?(console.log("StudentData created",e,t),n=await this.API.firestoreStudentDataAPI.getStudentData(e,t),console.log("StudentData data",n),!0):(console.error("Failed to create studentData"),!1)):(console.error("Firestore db not initialized"),!1)}}class ro{constructor(e){this.API=e}async createTeacher(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Teachers",n),(await Object(w.d)(n)).exists()?(console.log("Teacher already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Teacher created"),!0)):(console.error("Firestore db not initialized"),!1)}async getTeacher(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Teachers",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Teacher does not exist"),null)):(console.error("Firestore db not initialized"),null)}}class so{constructor(e){this.API=e}async createStudent(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Students",n),(await Object(w.d)(n)).exists()?(console.log("Student already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Student created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudent(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Students",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Student does not exist"),null)):(console.error("Firestore db not initialized"),null)}}const Ao=e=>{if(!e)return console.warn("minifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={Decomposition:n.dec,"Pattern Recognition and Data Representation":n.pat,"Generalisation and Abstraction":n.gen,Algorithms:n.alg,Analysis:n.ana,Repetition:n.rep,"Dead Code":n.dea};t[o]=n}return t},lo="StudentData";class uo{constructor(e){this.API=e}async createStudentData(e,t){var n,o;return this.API.firestoreDb?(n=M.compileStudentDataId(e,t),n=y.encrypt(n,e),console.debug("encryptedStudentDataId used for creating student data: ",n),o=Object(w.c)(this.API.firestoreDb,lo,n),(await Object(w.d)(o)).exists()?(console.log("StudentData already exists"),!1):(await Object(w.i)(o,{classId:y.encrypt(e,e),studentId:y.encrypt(t,e),id:n}),console.log("StudentData created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudentData(e,t){return this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),console.debug("encryptedStudentDataId used for getting student data: ",t),t=Object(w.c)(this.API.firestoreDb,lo,t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{id:y.decrypt(t.id,e),classId:y.decrypt(t.classId,e),studentId:y.decrypt(t.studentId,e),scoresOverTime:Ao(t.scoresOverTime),badges:t.badges,lastHeartbeat:t.lastHeartbeat,reactionsOverTime:t.reactionsOverTime}):(console.log("StudentData does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateStudentData(e,t,n){this.API.firestoreDb?(n.scoresOverTime&&(n.scoresOverTime=(e=>{if(!e)return console.warn("unminifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={dec:Object.assign({},n.Decomposition),pat:Object.assign({},n["Pattern Recognition and Data Representation"]),gen:Object.assign({},n["Generalisation and Abstraction"]),alg:Object.assign({},n.Algorithms),ana:Object.assign({},n.Analysis),rep:Object.assign({},n.Repetition),dea:Object.assign({},n["Dead Code"])};t[o]=n}return t})(n.scoresOverTime)),t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,n,{merge:!0})):console.error("Firestore db not initialized")}updateLastHeartbeatTime(e,t){this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,{lastHeartbeat:Kn()},{merge:!0})):console.error("Firestore db not initialized")}async getStudentDataListGivenClassId(t){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve([]);const n=[];try{var e=y.encrypt(t,t),o=Object(w.h)(Object(w.a)(this.API.firestoreDb,lo),Object(w.j)("classId","==",e));return(await Object(w.e)(o)).forEach(e=>{e=e.data(),e={classId:y.decrypt(e.classId,t),id:y.decrypt(e.id,t),studentId:y.decrypt(e.studentId,t),lastHeartbeat:e.lastHeartbeat,badges:e.badges,scoresOverTime:Ao(e.scoresOverTime),reactionsOverTime:e.reactionsOverTime};n.push(e)}),n}catch(e){return console.error("Error getting documents: ",e),Promise.resolve([])}}async subscribeToStudentDataDocChanges(n,e,o){if(this.API.firestoreDb)return e=M.compileStudentDataId(n,e),e=y.encrypt(e,n),e=Object(w.c)(this.API.firestoreDb,lo,e),Object(w.g)(e,e=>{var t;e.exists()?(t=e.data(),e=new M(y.decrypt(t.classId,n),y.decrypt(t.studentId,n),this.API,y.decrypt(e.id,n),Ao(t.scoresOverTime),t.badges,t.lastHeartbeat,t.reactionsOverTime),o(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}}class co{constructor(e,t,n,o,i,a,r,s=!0){this.isActive=!0,this.responses=[],this.onDocChangeCbs=new Map,this.id=e,this.type=t,this.API=n,this.classId=o,this.text=i,this.timestamp=a,this.responses=r,this.isActive=s}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassAnnouncementsAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async respond(e,t,n){n={response:n,studentId:e,studentName:t,timestamp:Kn()};return this.API.firestoreClassAnnouncementsAPI.addResponse(this.id,n)}async deactivate(){return"text"===this.type?this.API.firestoreClassAnnouncementsAPI.delete(this.id):this.API.firestoreClassAnnouncementsAPI.deactivate(this.id)}async refresh(){var e=await this.API.firestoreClassAnnouncementsAPI.get(this.id,this.classId);if(e)return e;throw new Error("Could not get fresh class announcement")}}const T="ClassAnnouncements";class go{constructor(e){this.API=e}async create(e,t,n){var o;return this.API.firestoreDb?(e=y.encrypt(e,e),o=Object(w.a)(this.API.firestoreDb,T),o=Object(w.c)(o),await Object(w.i)(o,{classId:e,text:t,timestamp:Kn(),announcementType:n,responses:[],isActive:!0}),console.info("Class announcement created"),o.id):(console.error("Firestore db not initialized"),!1)}async get(e,t){var n;return this.API.firestoreDb?(n=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(n)).exists()?(n=n.data(),new co(e,n.announcementType,this.API,y.decrypt(n.classId,t),n.text,n.timestamp,n.responses,!!n.isActive)):(console.log("Class announcement does not exist"),null)):(console.error("Firestore db not initialized"),null)}async getActiveAnnouncements(n){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve(null);var e=Object(w.a)(this.API.firestoreDb,T),e=Object(w.h)(e,Object(w.j)("classId","==",y.encrypt(n,n)),Object(w.j)("isActive","==",!0)),e=await Object(w.e)(e);const o=[];return e.forEach(e=>{var t=e.data(),e=new co(e.id,t.announcementType,this.API,y.decrypt(t.classId,n),t.text,t.timestamp,t.responses,!!t.isActive);o.push(e)}),o}async update(e,t){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,t,{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=Object(w.c)(this.API.firestoreDb,T,t),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new co(t,e.announcementType,this.API,y.decrypt(e.classId,t),e.text,e.timestamp,e.responses,!!e.isActive),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async addResponse(e,t){var n;return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.responses)||[],await Object(w.i)(e,{responses:[...n,t]},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async deactivate(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,{isActive:!1},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async delete(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.b)(e),console.info("Class announcement deleted"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}}class ho{constructor(e,t,n){this.classess=null,this.id=e,this.name=t,this.API=n}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async determineIfStudentOrTeacherInClass(t){await this.requestListOfClasses();var e=null==(e=this.classess)?void 0:e.find(e=>e.id===t);return e?(console.debug("classToCheck",e),e.teacherId===this.id?Bo.TEACHER:Bo.STUDENT):(console.warn("Could not find class with id",t),null)}}const S={CREATE_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,GET_USER_PROFILE:()=>"https://classroom.googleapis.com/v1/userProfiles/me",LIST_ALL_COURSES:()=>"https://classroom.googleapis.com/v1/courses",LIST_ALL_STUDENTS:e=>`https://classroom.googleapis.com/v1/courses/${e}/students`,LIST_ALL_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,LIST_ALL_STUDENT_SUBMISSIONS:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions`,MODIFY_ATTACHEMENTS_OF_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:modifyAttachments`,PATCH_COURSEWORK:(e,t,n,o)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}?updateMask=`+encodeURIComponent(o),REGISTER_STUDENT:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/students?enrollmentCode=`+t,TURN_IN_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:turnIn`},po=["https://www.googleapis.com/auth/classroom.courses.readonly","https://www.googleapis.com/auth/classroom.rosters.readonly","openid"];class mo{constructor(e){this.gapi_client=null,this.firestoreDb=null,this.gapiConnectionAPI=new G(this),this.gapiClassroomAPI=new P(this),this.firestoreConnectionAPI=new Gn(this),this.firestoreClassesAPI=new io(this),this.firestoreTeachersAPI=new ro(this),this.firestoreStudentsAPI=new so(this),this.firestoreStudentDataAPI=new uo(this),this.firestoreClassAnnouncementsAPI=new go(this),this.firestoreHOCAPI=new ao(this),this.codeAssess=e}async initGapiClient(){return new Promise((t,n)=>{const e=()=>{gapi.client.init({}).then(async()=>{if(console.log("this.gapi_client loaded"),!this.gapiConnectionAPI.access_token)return console.error("access_token is null"),n(!1);gapi.client.setToken({access_token:this.gapiConnectionAPI.access_token}),this.gapi_client=gapi.client;var e=await this.requestCurrentUserProfile();if(!e)return console.error("userProfile is null"),n(!1);this.codeAssess.setUserProfile(new ho(e.id,e.name.fullName,this)),t(!0)}).catch(e=>{console.error("Error loading gapi client for API",e),n(!1)})};gapi.load("client:auth2",()=>e())})}async requestCurrentUserProfile(){try{var e;if(this.gapi_client)return e=await this.gapi_client.request({path:S.GET_USER_PROFILE()}),console.log("response",e.result),e.result;throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while getting current user profile:",e),null}}}class fo{constructor(e,t,n){this.classess=null,this.monitoredAnnouncements=new Map,this.id=e,this.name=t,this.API=n,this.requestListOfClasses()}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=await this.API.gapiClassroomAPI.listClassess(),e=(console.debug("fetchedClassess",e),e.map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement)));this.classess=e}async createCourseWorkForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);return o?o.createCourseWork(e,n):(console.error("Could not find class with id",t),!1)}async makeAnnouncementForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);if(!o)return console.error("Could not find class with id",t),!1;for(const i of await o.getActiveAnnouncements())await i.deactivate();return o.announce(e,n)}async askForEmojiFeedback(e,t){e=await this.makeAnnouncementForClass(e,t,"emoji-feedback");return e||(console.error("Could not make announcement"),!1)}async getAnnouncement(t,e){var n;return(null==(n=this.classess)?void 0:n.find(e=>e.id===t))?await this.API.firestoreClassAnnouncementsAPI.get(e,t):(console.error("Could not find class with id",t),null)}async monitorAnnouncementResponses(e,t,n){e=await this.getAnnouncement(e,t);return e?(await e.subscribeToDbDocChanges(t,e=>{n(e.responses||[])}),this.monitoredAnnouncements.set(t,e),!0):(console.error("Could not get announcement"),!1)}stopMonitoringAnnouncementResponse(e){var t=this.monitoredAnnouncements.get(e);return t?(t.unsubscribeFromDbDocChanges(),this.monitoredAnnouncements.delete(e),!0):(console.error("Could not find announcement with id",e),!1)}stopMonitoringAllAnnouncements(){this.monitoredAnnouncements.forEach(e=>{e.unsubscribeFromDbDocChanges()}),this.monitoredAnnouncements.clear()}}var Bo,Eo=class{static studentAssessmentScoresOverTimeToLineGraphData(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const s=a[e];var r=i.map(e=>n[e][s]),r={x:i,y:r,name:s,type:"scatter",mode:"markers"};o.push(r)}return o}static averageScoresOverTime(e){return{}}static transformDataForStackedAreaChart(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const A=a[e];var r=i.map(e=>n[e][A]),s=0===e?"tozeroy":"tonexty",r={x:i,y:r,name:A,type:"scatter",mode:"lines",fill:s};o.push(r)}return o}static transformDataForSpiderChart(e){let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t,o=Object.keys(t).sort();return 0===o.length?(console.warn("No scores over time data provided"),[]):{type:"scatterpolar",r:(e=Object.keys(t[o[0]]).sort()).map(t=>{var e=o.map(e=>n[e][t]);return e[e.length-1]}),theta:e,fill:"toself"}}static getLatestScores(e){let t;var n;return!(t=Array.isArray(e)?this.averageScoresOverTime(e):e)||(e=t,0===(n=Object.keys(t).sort()).length)?(console.warn("No scores over time data provided"),[]):e[n[n.length-1]]}static transformDataForStackedAreaChartForTheLastMinutes(e,t){if(!e)return console.warn("No scores over time data provided"),[];let n;if(!(n=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const o=n;var i=[],e=Object.keys(n).sort();if(0===e.length)return console.warn("No scores over time data provided"),[];const a=b()(Kn());var r=e.filter(e=>{return Xn(a.format(),e,"minutes")<=t});if(0===r.length)return console.warn("No scores in the last "+t+" minutes"),[];var s=Object.keys(n[r[0]]).sort();for(let e=0;e<s.length;e++){const u=s[e];var A=r.map(e=>o[e][u]),l=0===e?"tozeroy":"tonexty",A={x:r,y:A,name:u,type:"scatter",mode:"lines",fill:l};i.push(A)}return i}};(On=Bo=Bo||{}).STUDENT="student",On.TEACHER="teacher";(class ko{});t=class extends class ko{constructor(){if(this.constructor===ko)throw new TypeError('Abstract class "CodeAssessObservable" cannot be instantiated directly.')}}{constructor(){super(),this.userProfile=null,this.teacher=null,this.student=null,this.dataTransformationUtils=Eo,this.platform="staging",this.API=new mo(this),this.observers=[],this.studentOrTeacher=null,this.isUserLoggedIn=!1,this.TypesOfPublishedEvents=i}async logUserIn(){var e=await this.API.gapiConnectionAPI.login(),t=await this.API.firestoreConnectionAPI.initialiseFirestore();return!(!e||!t||(this.setIsUserLoggedIn(!0),0))}async logUserOut(){await this.API.gapiConnectionAPI.logout(),this.setIsUserLoggedIn(!1)}async createTeacherIfDoesntExist(){return this.teacher?this.API.firestoreHOCAPI.createTeacherIfDoesntExist(this.teacher.id,this.teacher.name):(console.error("Teacher not set"),!1)}async createStudentIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentIfDoesntExist(e,t)}async createStudentDataIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(e,t)}async createClassIfDoesntExist(e,t,n){return this.API.firestoreHOCAPI.createClassIfDoesntExist(e,t,n)}async addStudentToClass(e,t,n,o){var i=await this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);if(!i&&await this.createClassIfDoesntExist(e,t,n))return this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);return i}setStudentOrTeacher(e){var t;this.studentOrTeacher=e,this.publish(i.STUDENT_OR_TEACHER_CHANGED),this.userProfile?e===Bo.STUDENT?((t=new to(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setStudent(t)):e===Bo.TEACHER&&((t=new fo(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setTeacher(t)):console.error("User profile not set")}setUserProfile(e){this.userProfile=e}setTeacher(e){this.teacher=e}setStudent(e){this.student=e}setIsUserLoggedIn(e){this.isUserLoggedIn=e,this.publish(i.IS_USER_LOGGED_IN_CHANGED)}onNewClassAnnouncement(e){this.publish(i.NEW_CLASS_ANNOUNCEMENT,e)}subscribe(e,t,n){if(!Object.values(i).includes(t))throw new TypeError(`The type of event "${t}" is not valid. Valid types are: `+Object.values(i).join(", "));const o=new Y(e,t,n);e=this.observers.findIndex(e=>e.id===o.id);-1!==e&&this.observers.splice(e,1),this.observers.push(o)}unsubscribe(t){var e=this.observers.findIndex(e=>e.id===t);-1!==e&&this.observers.splice(e,1)}publish(t,n){this.observers.forEach(e=>e.notify(t,n))}};class k{static calculateWeightedAverageForScoreGivenIndicesAndWeights(t,n,o){if(0===n.length||0===t.length||0===o.length)return[0];let i=0;for(let e=0;e<n[0].length;e++){var a=n[0][e],r=o[e],a=t[a];i+=r*a}return[i/n[0].length]}static calculateWeightsGivenIndicesAndDates(e,t,n="automatic",o="minutes"){if(0===e.length||0===t.length)return[];var i=e[0].map(e=>t[e]).map(e=>I(e));const a=i[0];if("automatic"===n){var r=[];for(let e=0;e<i.length;e++){var s=Math.abs(a.diff(i[e],o));r.push(s)}const u=Math.max(...r),A=r.map(e=>{return 0===e&&0===u?1:e/u});return A}const A=i.map(e=>{e=a.diff(e,o);return Math.pow(.5,e/n)}),l=Math.max(...A);return A.map(e=>e/l)}}class wo{static calculateCIGivenMeanAndStd(e,t,n,o=1.96){return n<=0||t<0||o<=0?[NaN,NaN]:[e-(o=o*(t/Math.sqrt(n))),e+o]}}wo.boundUpperCI=(e,t)=>t;var yo=wo;class D{static calculateLeakyIntegratorScores(t,n,o,i=.1,a=.1,r=.1,s=1){var A=[0],l=[[0,1]];for(let e=1;e<t.length;e++){var u=A[e-1],c=this.adjustLowerBound(t[e],l[e-1][0],0,1,i,a),g=this.adjustUpperBound(0<t[e]?1:0,0===t[e]?l[e-1][1]:0,0,1,r,s),u=this.calculateLeakyScore(t[e],u,c,g,n,o);A.push(u),l.push([c,g])}return{leakyIntegratorScores:A,cis:l}}static calculateLeakyScore(e,t,n,o,i,a){var r=e-t;return 0<r?Math.max(n,Math.min(o,t+e*a*r)):0===e?Math.min(o,Math.max(n,t+(e-(e-n)-t)*i)):Math.max(n,Math.min(o,t+e*i*r))}static adjustUpperBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}static adjustLowerBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}}class Co{static calculateWindowIndices(e,t,n="minutes"){var o=e.map(e=>I(e)),i=[];let a=0;for(;a<o.length;){var r=o[a],s=i.length;for(let e=a;e<o.length;e++){if(!(o[e].diff(r,n)<=t)){a=e;break}if(e===o.length-1)return i[s]||(i[s]=[]),i[s].push(e),i;i[s]||(i[s]=[]),i[s].push(e)}}return i}}class Q extends Co{static calculateMovingAverageForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=0;for(let e=0;e<a.length;e++)t+=n[a[e]];i.push(t/a.length)}return i}static calculateMovingAverageForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]].valueOf();var r=t/a.length,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(r)}return i}static calculateMovingAverageForScore(t,n){if(n<=0||0===t.length)return[];var o=[];let i=0,a=0;for(let e=0;e<t.length;e++)i+=t[e],e>=n-1&&(o.push(i/n),i-=t[a],a++);return o}static calculateMovingAverageForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=0;for(let e=n;e<n+o;e++)t+=i[e].valueOf();var r=t/o,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class x extends Co{static calculateMovingMaxForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=n[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<n.length&&(t=Math.max(t,n[r]))}i.push(t)}return i}static calculateMovingMaxForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=o[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<o.length&&(r=o[r]).isAfter(t)&&(t=r)}var s=t.format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(s)}return i}static calculateMovingMaxForScore(t,n){if(n<=0||0===t.length)return[];var o=[],i=[];for(let e=0;e<t.length;e++)i.push(t[e]),n<i.length&&i.shift(),e>=n-1&&o.push(Math.max(...i));return o}static calculateMovingMaxForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=i[n];for(let e=n;e<n+o;e++)i[e].isAfter(t)&&(t=i[e]);var r=t.format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class N extends Co{static calculateMovingStdForScoreGivenIndices(o,t){if(0===t.length||0===o.length)return[];var i=[];for(let e=0;e<t.length;e++){var a=t[e];if(0===a.length)i.push(0);else{let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]];var r=t/a.length;let n=0;for(let e=0;e<a.length;e++)n+=Math.pow(o[a[e]]-r,2);i.push(Math.sqrt(n/a.length))}}return i}static calculateMovingStdForScore(t,n){if(n<=0||0===t.length)return[];var o,i=[];let a=0,r=0,s=0;for(let e=0;e<t.length;e++)a+=t[e],r+=t[e]*t[e],e>=n-1&&(o=a/n,o=r/n-o*o,i.push(Math.sqrt(o)),a-=t[s],r-=t[s]*t[s],s++);return i}}class O{static normaliseScores(e,t){const n=t[0],o=t[1];return e.map(e=>(e-n)/(o-n))}}const bo={Conditionals:"Algorithms",Operators:"Algorithms","Synchronization and Messages":"Algorithms","Algorithms Dead Code Penalty":"Algorithms","Algorithms Composite Score":"Algorithms",Comments:"Analysis",Debugging:"Analysis",Naming:"Analysis","Analysis Dead Code Penalty":"Analysis","Analysis Composite Score":"Analysis",Functions:"Decomposition",Sequencing:"Decomposition",Parallelism:"Decomposition","Decomposition Composite Score":"Decomposition","Data Types":"Pattern Recognition and Data Representation","Variables and Data Structures":"Pattern Recognition and Data Representation",Loops:"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Repetition Penalty":"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Composite Score":"Pattern Recognition and Data Representation","Function Reuse":"Generalisation and Abstraction","Functions with Arguments":"Generalisation and Abstraction","Variables Instead of Literals":"Generalisation and Abstraction","Generalisation and Abstraction Composite Score":"Generalisation and Abstraction",Composite:"Composite"};function _(){return{average:[],std:[],n:[],ci:[],leaky:[]}}class Io{constructor(e){this.dates=[],this.conditionalsScores={scores:[]},this.operatorsScores={scores:[]},this.syncAndMessagesScores={scores:[]},this.algorithmsCompoScores={scores:[]},this.algorithmsDeadCodePenaltyScores={scores:[]},this.commentsScores={scores:[]},this.debuggingScores={scores:[]},this.namingScores={scores:[]},this.analysisCompoScores={scores:[]},this.analysisDeadCodePenaltyScores={scores:[]},this.functionsScores={scores:[]},this.sequencingScores={scores:[]},this.parallelismScores={scores:[]},this.decompositionCompoScores={scores:[]},this.dataTypesScores={scores:[]},this.variablesAndDataStructScores={scores:[]},this.loopsScores={scores:[]},this.patternRecAndDataRepPenaltyScores={scores:[]},this.patternRecAndDataRepCompoScores={scores:[]},this.functionReuseScores={scores:[]},this.functionWithArgsScores={scores:[]},this.variablesInsteadOfLiteralsScores={scores:[]},this.generalisationAndAbstrCompoScores={scores:[]},this.compositeScores={scores:[]},this.isSorted=!1,this.data=e,this.init()}init(){var e=Object.keys(this.data);const n=e.map(e=>this.data[e]["Dead Code"]["Dead Scripts Count"]),o=e.map(e=>this.data[e]["Dead Code"]["Total Scripts Count"]),i=e.map(e=>this.data[e].Repetition["Duplicate Scripts Count"]),a=e.map(e=>this.data[e].Repetition["Total Scripts Count"]);this.conditionalsScores.scores=e.map(e=>this.data[e].Algorithms.Conditionals),this.operatorsScores.scores=e.map(e=>this.data[e].Algorithms.Operators),this.syncAndMessagesScores.scores=e.map(e=>this.data[e].Algorithms["Synchronization and Messages"]),this.algorithmsDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.algorithmsCompoScores.scores=e.map((e,t)=>C.calculateAlgorithmsScore({"Synchronization and Messages":this.syncAndMessagesScores.scores[t],Operators:this.operatorsScores.scores[t],Conditionals:this.conditionalsScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.commentsScores.scores=e.map(e=>this.data[e].Analysis.Comments),this.debuggingScores.scores=e.map(e=>this.data[e].Analysis.Debugging),this.namingScores.scores=e.map(e=>this.data[e].Analysis.Naming),this.analysisDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.analysisCompoScores.scores=e.map((e,t)=>C.calculateAnalysisScore({Comments:this.commentsScores.scores[t],Debugging:this.debuggingScores.scores[t],Naming:this.namingScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.functionsScores.scores=e.map(e=>this.data[e].Decomposition.Functions),this.sequencingScores.scores=e.map(e=>this.data[e].Decomposition.Sequencing),this.parallelismScores.scores=e.map(e=>this.data[e].Decomposition.Parallelism),this.decompositionCompoScores.scores=e.map((e,t)=>C.calculateDecompositionScore({Functions:this.functionsScores.scores[t],Sequencing:this.sequencingScores.scores[t],Parallelism:this.parallelismScores.scores[t]})),this.dataTypesScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Data Types"]),this.variablesAndDataStructScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Variables and Data Structures"]),this.loopsScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"].Loops),this.patternRecAndDataRepPenaltyScores.scores=e.map((e,t)=>i[t]/a[t]),this.patternRecAndDataRepCompoScores.scores=e.map((e,t)=>C.calculatePatternRecognitionAndDataRepresentationScore({"Data Types":this.dataTypesScores.scores[t],"Variables and Data Structures":this.variablesAndDataStructScores.scores[t],Loops:this.loopsScores.scores[t]},{"Duplicate Scripts Count":i[t],"Total Scripts Count":a[t]})),this.functionReuseScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Function Reuse"]),this.functionWithArgsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Functions with Arguments"]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Variables Instead of Literals"]),this.generalisationAndAbstrCompoScores.scores=e.map((e,t)=>C.calculateGeneralisationAndAbstractionScore({"Function Reuse":this.functionReuseScores.scores[t],"Functions with Arguments":this.functionWithArgsScores.scores[t],"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores.scores[t]})),this.compositeScores.scores=e.map((e,t)=>jn.calculateCompositeScore({Algorithms:this.algorithmsCompoScores.scores[t],Analysis:this.analysisCompoScores.scores[t],Decomposition:this.decompositionCompoScores.scores[t],"Pattern Recognition and Data Representation":this.patternRecAndDataRepCompoScores.scores[t],"Generalisation and Abstraction":this.generalisationAndAbstrCompoScores.scores[t]})),this.dates=e}categoryNamesMap(){return{Conditionals:this.conditionalsScores,Operators:this.operatorsScores,"Synchronization and Messages":this.syncAndMessagesScores,"Algorithms Dead Code Penalty":this.algorithmsDeadCodePenaltyScores,"Algorithms Composite Score":this.algorithmsCompoScores,Comments:this.commentsScores,Debugging:this.debuggingScores,Naming:this.namingScores,"Analysis Dead Code Penalty":this.analysisDeadCodePenaltyScores,"Analysis Composite Score":this.analysisCompoScores,Functions:this.functionsScores,Sequencing:this.sequencingScores,Parallelism:this.parallelismScores,"Decomposition Composite Score":this.decompositionCompoScores,"Data Types":this.dataTypesScores,"Variables and Data Structures":this.variablesAndDataStructScores,Loops:this.loopsScores,"Pattern Recognition and Data Representation Repetition Penalty":this.patternRecAndDataRepPenaltyScores,"Pattern Recognition and Data Representation Composite Score":this.patternRecAndDataRepCompoScores,"Function Reuse":this.functionReuseScores,"Functions with Arguments":this.functionWithArgsScores,"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores,"Generalisation and Abstraction Composite Score":this.generalisationAndAbstrCompoScores,Composite:this.compositeScores}}sort(){var e;this.isSorted||(e=this.dates.map((e,t)=>t).sort((e,t)=>{e=new Date(this.dates[e]),t=new Date(this.dates[t]);return e.getTime()-t.getTime()}),this.dates=e.map(e=>this.dates[e]),this.conditionalsScores.scores=e.map(e=>this.conditionalsScores.scores[e]),this.operatorsScores.scores=e.map(e=>this.operatorsScores.scores[e]),this.syncAndMessagesScores.scores=e.map(e=>this.syncAndMessagesScores.scores[e]),this.algorithmsDeadCodePenaltyScores.scores=e.map(e=>this.algorithmsDeadCodePenaltyScores.scores[e]),this.algorithmsCompoScores.scores=e.map(e=>this.algorithmsCompoScores.scores[e]),this.commentsScores.scores=e.map(e=>this.commentsScores.scores[e]),this.debuggingScores.scores=e.map(e=>this.debuggingScores.scores[e]),this.namingScores.scores=e.map(e=>this.namingScores.scores[e]),this.analysisDeadCodePenaltyScores.scores=e.map(e=>this.analysisDeadCodePenaltyScores.scores[e]),this.analysisCompoScores.scores=e.map(e=>this.analysisCompoScores.scores[e]),this.functionsScores.scores=e.map(e=>this.functionsScores.scores[e]),this.sequencingScores.scores=e.map(e=>this.sequencingScores.scores[e]),this.parallelismScores.scores=e.map(e=>this.parallelismScores.scores[e]),this.decompositionCompoScores.scores=e.map(e=>this.decompositionCompoScores.scores[e]),this.dataTypesScores.scores=e.map(e=>this.dataTypesScores.scores[e]),this.variablesAndDataStructScores.scores=e.map(e=>this.variablesAndDataStructScores.scores[e]),this.loopsScores.scores=e.map(e=>this.loopsScores.scores[e]),this.patternRecAndDataRepPenaltyScores.scores=e.map(e=>this.patternRecAndDataRepPenaltyScores.scores[e]),this.patternRecAndDataRepCompoScores.scores=e.map(e=>this.patternRecAndDataRepCompoScores.scores[e]),this.functionReuseScores.scores=e.map(e=>this.functionReuseScores.scores[e]),this.functionWithArgsScores.scores=e.map(e=>this.functionWithArgsScores.scores[e]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.variablesInsteadOfLiteralsScores.scores[e]),this.generalisationAndAbstrCompoScores.scores=e.map(e=>this.generalisationAndAbstrCompoScores.scores[e]),this.compositeScores.scores=e.map(e=>this.compositeScores.scores[e]),this.isSorted=!0)}calculateMovingStdBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScore(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScore(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScore(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,e)}calculateMovingStdBasedOnDates(e,t="minutes"){e=N.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScore(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScore(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScore(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=Q.calculateMovingAverageForScore(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDates(e,t="minutes"){e=Q.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e)}calculateMovingConfidenceIntervals(e,t,n="minutes"){let o;o="dataPoints"===t?this.getMovingAverageAndStdBasedOnDataPoints(e):this.getMovingAverageAndStdBasedOnDates(e,n);var i={"Algorithms Composite Score":_(),"Analysis Composite Score":_(),"Decomposition Composite Score":_(),"Pattern Recognition and Data Representation Composite Score":_(),"Generalisation and Abstraction Composite Score":_(),Composite:_(),"Algorithms Dead Code Penalty":_(),"Analysis Dead Code Penalty":_(),"Pattern Recognition and Data Representation Repetition Penalty":_(),Conditionals:_(),Operators:_(),"Synchronization and Messages":_(),Comments:_(),Debugging:_(),Naming:_(),Functions:_(),Sequencing:_(),Parallelism:_(),"Data Types":_(),"Variables and Data Structures":_(),Loops:_(),"Function Reuse":_(),"Functions with Arguments":_(),"Variables Instead of Literals":_()};for(const s of Object.keys(o))if("dates"!==s){var a=o[s];for(let e=0;e<a.average.length;e++){var r=yo.calculateCIGivenMeanAndStd(a.average[e],a.std[e],a.n[e]);a.ci||(a.ci=[]),a.ci.push(yo.boundUpperCI(s,r))}i[s]={average:a.average,std:a.std,n:a.n,ci:a.ci}}this.conditionalsScores={scores:i.Conditionals.average,averages:i.Conditionals.average,stds:i.Conditionals.std,cis:i.Conditionals.ci},this.operatorsScores={scores:i.Operators.average,averages:i.Operators.average,stds:i.Operators.std,cis:i.Operators.ci},this.syncAndMessagesScores={scores:i["Synchronization and Messages"].average,averages:i["Synchronization and Messages"].average,stds:i["Synchronization and Messages"].std,cis:i["Synchronization and Messages"].ci},this.algorithmsDeadCodePenaltyScores={scores:i["Algorithms Dead Code Penalty"].average,averages:i["Algorithms Dead Code Penalty"].average,stds:i["Algorithms Dead Code Penalty"].std,cis:i["Algorithms Dead Code Penalty"].ci},this.algorithmsCompoScores={scores:i["Algorithms Composite Score"].average,averages:i["Algorithms Composite Score"].average,stds:i["Algorithms Composite Score"].std,cis:i["Algorithms Composite Score"].ci},this.commentsScores={scores:i.Comments.average,averages:i.Comments.average,stds:i.Comments.std,cis:i.Comments.ci},this.debuggingScores={scores:i.Debugging.average,averages:i.Debugging.average,stds:i.Debugging.std,cis:i.Debugging.ci},this.namingScores={scores:i.Naming.average,averages:i.Naming.average,stds:i.Naming.std,cis:i.Naming.ci},this.analysisDeadCodePenaltyScores={scores:i["Analysis Dead Code Penalty"].average,averages:i["Analysis Dead Code Penalty"].average,stds:i["Analysis Dead Code Penalty"].std,cis:i["Analysis Dead Code Penalty"].ci},this.analysisCompoScores={scores:i["Analysis Composite Score"].average,averages:i["Analysis Composite Score"].average,stds:i["Analysis Composite Score"].std,cis:i["Analysis Composite Score"].ci},this.functionsScores={scores:i.Functions.average,averages:i.Functions.average,stds:i.Functions.std,cis:i.Functions.ci},this.sequencingScores={scores:i.Sequencing.average,averages:i.Sequencing.average,stds:i.Sequencing.std,cis:i.Sequencing.ci},this.parallelismScores={scores:i.Parallelism.average,averages:i.Parallelism.average,stds:i.Parallelism.std,cis:i.Parallelism.ci},this.decompositionCompoScores={scores:i["Decomposition Composite Score"].average,averages:i["Decomposition Composite Score"].average,stds:i["Decomposition Composite Score"].std,cis:i["Decomposition Composite Score"].ci},this.dataTypesScores={scores:i["Data Types"].average,averages:i["Data Types"].average,stds:i["Data Types"].std,cis:i["Data Types"].ci},this.variablesAndDataStructScores={scores:i["Variables and Data Structures"].average,averages:i["Variables and Data Structures"].average,stds:i["Variables and Data Structures"].std,cis:i["Variables and Data Structures"].ci},this.loopsScores={scores:i.Loops.average,averages:i.Loops.average,stds:i.Loops.std,cis:i.Loops.ci},this.patternRecAndDataRepPenaltyScores={scores:i["Pattern Recognition and Data Representation Repetition Penalty"].average,averages:i["Pattern Recognition and Data Representation Repetition Penalty"].average,stds:i["Pattern Recognition and Data Representation Repetition Penalty"].std,cis:i["Pattern Recognition and Data Representation Repetition Penalty"].ci},this.patternRecAndDataRepCompoScores={scores:i["Pattern Recognition and Data Representation Composite Score"].average,averages:i["Pattern Recognition and Data Representation Composite Score"].average,stds:i["Pattern Recognition and Data Representation Composite Score"].std,cis:i["Pattern Recognition and Data Representation Composite Score"].ci},this.functionReuseScores={scores:i["Function Reuse"].average,averages:i["Function Reuse"].average,stds:i["Function Reuse"].std,cis:i["Function Reuse"].ci},this.functionWithArgsScores={scores:i["Functions with Arguments"].average,averages:i["Functions with Arguments"].average,stds:i["Functions with Arguments"].std,cis:i["Functions with Arguments"].ci},this.variablesInsteadOfLiteralsScores={scores:i["Variables Instead of Literals"].average,averages:i["Variables Instead of Literals"].average,stds:i["Variables Instead of Literals"].std,cis:i["Variables Instead of Literals"].ci},this.generalisationAndAbstrCompoScores={scores:i["Generalisation and Abstraction Composite Score"].average,averages:i["Generalisation and Abstraction Composite Score"].average,stds:i["Generalisation and Abstraction Composite Score"].std,cis:i["Generalisation and Abstraction Composite Score"].ci},this.compositeScores={scores:i.Composite.average,averages:i.Composite.average,stds:i.Composite.std,cis:i.Composite.ci}}normaliseScores(){this.conditionalsScores.scores=O.normaliseScores(this.conditionalsScores.scores,v.Conditionals.range),this.operatorsScores.scores=O.normaliseScores(this.operatorsScores.scores,v.Operators.range),this.syncAndMessagesScores.scores=O.normaliseScores(this.syncAndMessagesScores.scores,v.SynchAndMessages.range),this.algorithmsCompoScores.scores=O.normaliseScores(this.algorithmsCompoScores.scores,v.Algorithms.range),this.commentsScores.scores=O.normaliseScores(this.commentsScores.scores,v.Comments.range),this.debuggingScores.scores=O.normaliseScores(this.debuggingScores.scores,v.Debugging.range),this.namingScores.scores=O.normaliseScores(this.namingScores.scores,v.Naming.range),this.analysisCompoScores.scores=O.normaliseScores(this.analysisCompoScores.scores,v.Analysis.range),this.functionsScores.scores=O.normaliseScores(this.functionsScores.scores,v.Functions.range),this.sequencingScores.scores=O.normaliseScores(this.sequencingScores.scores,v.Sequencing.range),this.parallelismScores.scores=O.normaliseScores(this.parallelismScores.scores,v.Parallelism.range),this.decompositionCompoScores.scores=O.normaliseScores(this.decompositionCompoScores.scores,v.Decomposition.range),this.dataTypesScores.scores=O.normaliseScores(this.dataTypesScores.scores,v.DataTypes.range),this.variablesAndDataStructScores.scores=O.normaliseScores(this.variablesAndDataStructScores.scores,v.VariablesAndDataStructures.range),this.loopsScores.scores=O.normaliseScores(this.loopsScores.scores,v.Loops.range),this.patternRecAndDataRepCompoScores.scores=O.normaliseScores(this.patternRecAndDataRepCompoScores.scores,v.PatternRecognitionAndDataRepresentation.range),this.functionReuseScores.scores=O.normaliseScores(this.functionReuseScores.scores,v.FunctionReUse.range),this.functionWithArgsScores.scores=O.normaliseScores(this.functionWithArgsScores.scores,v.Functions.range),this.variablesInsteadOfLiteralsScores.scores=O.normaliseScores(this.variablesInsteadOfLiteralsScores.scores,v.VariablesInsteadOfLiterals.range),this.generalisationAndAbstrCompoScores.scores=O.normaliseScores(this.generalisationAndAbstrCompoScores.scores,v.GeneralisationAndAbstraction.range)}calculateMovingMaxBasedOnDates(e,t="minutes"){e=Co.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.compositeScores.scores,e)}calculateLeakyIntegrator(e,t,n,o,i,a){var r=D.calculateLeakyIntegratorScores(this.conditionalsScores.scores,e,t,n,o,i,a),r=(this.conditionalsScores.leakyScores=r.leakyIntegratorScores,this.conditionalsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.operatorsScores.scores,e,t,n,o,i,a)),r=(this.operatorsScores.leakyScores=r.leakyIntegratorScores,this.operatorsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.syncAndMessagesScores.scores,e,t,n,o,i,a)),r=(this.syncAndMessagesScores.leakyScores=r.leakyIntegratorScores,this.syncAndMessagesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.algorithmsDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.algorithmsDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsCompoScores.scores,e,t,n,o,i,a)),r=(this.algorithmsCompoScores.leakyScores=r.leakyIntegratorScores,this.algorithmsCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.commentsScores.scores,e,t,n,o,i,a)),r=(this.commentsScores.leakyScores=r.leakyIntegratorScores,this.commentsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.debuggingScores.scores,e,t,n,o,i,a)),r=(this.debuggingScores.leakyScores=r.leakyIntegratorScores,this.debuggingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.namingScores.scores,e,t,n,o,i,a)),r=(this.namingScores.leakyScores=r.leakyIntegratorScores,this.namingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.analysisDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.analysisDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisCompoScores.scores,e,t,n,o,i,a)),r=(this.analysisCompoScores.leakyScores=r.leakyIntegratorScores,this.analysisCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionsScores.scores,e,t,n,o,i,a)),r=(this.functionsScores.leakyScores=r.leakyIntegratorScores,this.functionsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.sequencingScores.scores,e,t,n,o,i,a)),r=(this.sequencingScores.leakyScores=r.leakyIntegratorScores,this.sequencingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.parallelismScores.scores,e,t,n,o,i,a)),r=(this.parallelismScores.leakyScores=r.leakyIntegratorScores,this.parallelismScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.decompositionCompoScores.scores,e,t,n,o,i,a)),r=(this.decompositionCompoScores.leakyScores=r.leakyIntegratorScores,this.decompositionCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.dataTypesScores.scores,e,t,n,o,i,a)),r=(this.dataTypesScores.leakyScores=r.leakyIntegratorScores,this.dataTypesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesAndDataStructScores.scores,e,t,n,o,i,a)),r=(this.variablesAndDataStructScores.leakyScores=r.leakyIntegratorScores,this.variablesAndDataStructScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.loopsScores.scores,e,t,n,o,i,a)),r=(this.loopsScores.leakyScores=r.leakyIntegratorScores,this.loopsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepPenaltyScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepPenaltyScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepPenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepCompoScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepCompoScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionReuseScores.scores,e,t,n,o,i,a)),r=(this.functionReuseScores.leakyScores=r.leakyIntegratorScores,this.functionReuseScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionWithArgsScores.scores,e,t,n,o,i,a)),r=(this.functionWithArgsScores.leakyScores=r.leakyIntegratorScores,this.functionWithArgsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesInsteadOfLiteralsScores.scores,e,t,n,o,i,a)),r=(this.variablesInsteadOfLiteralsScores.leakyScores=r.leakyIntegratorScores,this.variablesInsteadOfLiteralsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.generalisationAndAbstrCompoScores.scores,e,t,n,o,i,a)),r=(this.generalisationAndAbstrCompoScores.leakyScores=r.leakyIntegratorScores,this.generalisationAndAbstrCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.compositeScores.scores,e,t,n,o,i,a));this.compositeScores.leakyScores=r.leakyIntegratorScores,this.compositeScores.cis=r.cis}getMovingAverageAndStdBasedOnDataPoints(t){this.dates=Q.calculateMovingAverageForDates(this.dates,t);var e=this.dates.map(e=>t),n={average:Q.calculateMovingAverageForScore(this.conditionalsScores.scores,t),std:N.calculateMovingStdForScore(this.conditionalsScores.scores,t),n:e},o={average:Q.calculateMovingAverageForScore(this.operatorsScores.scores,t),std:N.calculateMovingStdForScore(this.operatorsScores.scores,t),n:e},i={average:Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,t),std:N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,t),n:e},a={average:Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,t),n:e},r={average:Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,t),n:e},s={average:Q.calculateMovingAverageForScore(this.commentsScores.scores,t),std:N.calculateMovingStdForScore(this.commentsScores.scores,t),n:e},A={average:Q.calculateMovingAverageForScore(this.debuggingScores.scores,t),std:N.calculateMovingStdForScore(this.debuggingScores.scores,t),n:e},l={average:Q.calculateMovingAverageForScore(this.namingScores.scores,t),std:N.calculateMovingStdForScore(this.namingScores.scores,t),n:e},u={average:Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,t),n:e},c={average:Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,t),std:N.calculateMovingStdForScore(this.analysisCompoScores.scores,t),n:e},g={average:Q.calculateMovingAverageForScore(this.functionsScores.scores,t),std:N.calculateMovingStdForScore(this.functionsScores.scores,t),n:e},d={average:Q.calculateMovingAverageForScore(this.sequencingScores.scores,t),std:N.calculateMovingStdForScore(this.sequencingScores.scores,t),n:e},h={average:Q.calculateMovingAverageForScore(this.parallelismScores.scores,t),std:N.calculateMovingStdForScore(this.parallelismScores.scores,t),n:e},p={average:Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,t),std:N.calculateMovingStdForScore(this.decompositionCompoScores.scores,t),n:e},m={average:Q.calculateMovingAverageForScore(this.dataTypesScores.scores,t),std:N.calculateMovingStdForScore(this.dataTypesScores.scores,t),n:e},f={average:Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,t),std:N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,t),n:e},B={average:Q.calculateMovingAverageForScore(this.loopsScores.scores,t),std:N.calculateMovingStdForScore(this.loopsScores.scores,t),n:e},E={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,t),n:e},w={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,t),n:e},y={average:Q.calculateMovingAverageForScore(this.functionReuseScores.scores,t),std:N.calculateMovingStdForScore(this.functionReuseScores.scores,t),n:e},C={average:Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,t),std:N.calculateMovingStdForScore(this.functionWithArgsScores.scores,t),n:e},b={average:Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,t),std:N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,t),n:e},I={average:Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,t),std:N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,t),n:e},e={average:Q.calculateMovingAverageForScore(this.compositeScores.scores,t),std:N.calculateMovingStdForScore(this.compositeScores.scores,t),n:e};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}getMovingAverageAndStdBasedOnDates(e,t="minutes"){var e=Q.calculateWindowIndices(this.dates,e,t),t=e.map(e=>e.length),n=(this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),{average:Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),n:t}),o={average:Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),n:t},i={average:Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),n:t},a={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),n:t},r={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),n:t},s={average:Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),n:t},A={average:Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),n:t},l={average:Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),n:t},u={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),n:t},c={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),n:t},g={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),n:t},d={average:Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),n:t},h={average:Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),n:t},p={average:Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),n:t},m={average:Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),n:t},f={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),n:t},B={average:Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),n:t},E={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),n:t},w={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),n:t},y={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),n:t},C={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),n:t},b={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),n:t},I={average:Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),n:t},e={average:Q.calculateMovingAverageForScoreGivenIndices(this.compositeScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e),n:t};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}calculateCompositeScoreOverTime(){var t=[];for(let e=0;e<this.dates.length;e++){var n=jn.calculateCompositeScore({algorithmsCompoScores:this.algorithmsCompoScores.scores[e],analysisCompoScores:this.analysisCompoScores.scores[e],decompositionCompoScores:this.decompositionCompoScores.scores[e],patternRecAndDataRepCompoScores:this.patternRecAndDataRepCompoScores.scores[e],generalisationAndAbstrCompoScores:this.generalisationAndAbstrCompoScores.scores[e]});t.push(n)}this.compositeScores.scores=t}calculateAverageGivenTimeWindow(e,t,n="minutes"){this.isSorted||this.sort();e=class{static calculateWindowIndicesFromLastTimestamp(t,n,o="minutes"){var i=t.map(e=>I(e)),a=[],t=i.length-1,r=i[t],s=a.length;for(let e=t;0<=e;e--)r.diff(i[e],o)<=n?(a[s]||(a[s]=[]),a[s].push(e)):e;return a}}.calculateWindowIndicesFromLastTimestamp(this.dates,e,n),t=k.calculateWeightsGivenIndicesAndDates(e,this.dates,t,n);this.conditionalsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.conditionalsScores.scores,e,t),this.operatorsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.operatorsScores.scores,e,t),this.syncAndMessagesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.syncAndMessagesScores.scores,e,t),this.algorithmsDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsDeadCodePenaltyScores.scores,e,t),this.algorithmsCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsCompoScores.scores,e,t),this.commentsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.commentsScores.scores,e,t),this.debuggingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.debuggingScores.scores,e,t),this.namingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.namingScores.scores,e,t),this.analysisDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisDeadCodePenaltyScores.scores,e,t),this.analysisCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisCompoScores.scores,e,t),this.functionsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionsScores.scores,e,t),this.sequencingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.sequencingScores.scores,e,t),this.parallelismScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.parallelismScores.scores,e,t),this.decompositionCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.decompositionCompoScores.scores,e,t),this.dataTypesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.dataTypesScores.scores,e,t),this.variablesAndDataStructScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesAndDataStructScores.scores,e,t),this.loopsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.loopsScores.scores,e,t),this.patternRecAndDataRepPenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepPenaltyScores.scores,e,t),this.patternRecAndDataRepCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepCompoScores.scores,e,t),this.functionReuseScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionReuseScores.scores,e,t),this.functionWithArgsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionWithArgsScores.scores,e,t),this.variablesInsteadOfLiteralsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesInsteadOfLiteralsScores.scores,e,t),this.generalisationAndAbstrCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.generalisationAndAbstrCompoScores.scores,e,t),this.compositeScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.compositeScores.scores,e,t)}exportToLineGraphData(t,e){var n=[];if("scores"===e)for(let e=0;e<t.length;e++){const r=t[e],s=bo[r];n.push({x:this.dates,y:this.categoryNamesMap()[r].scores,name:vo(r,20),legendgroup:s,hoverinfo:"text",text:this.categoryNamesMap()[r].scores.map((e,t)=>`${s}<br>${r}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"})}else{if("ci"!==e)return[];for(let e=0;e<t.length;e++){const A=t[e],l=bo[A];var o=this.categoryNamesMap()[A],i=null==(i=o.cis)?void 0:i.map(e=>e[0]),a=null==(a=o.cis)?void 0:a.map(e=>e[1]);n.push({x:this.dates,y:o.scores,name:vo(A,20),legendgroup:l,hoverinfo:"text",text:o.scores.map((e,t)=>`${l}<br>${A}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),n.push({x:this.dates,y:a,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),n.push({x:this.dates,y:i,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}}return n}exportToSpiderGraphData(t,e,n=!1){var o={};if("scores"!==e)return[];if(n)for(let e=0;e<t.length;e++){var i=t[e],a=bo[i];o[a]||(o[a]={type:"scatterpolar",r:[],theta:[],fill:"",name:a}),o[a].r.push(this.categoryNamesMap()[i].scores[0]),o[a].theta.push(i)}else o.Average={type:"scatterpolar",r:t.map(e=>this.categoryNamesMap()[e].scores[0]),theta:t.map(e=>bo[e]),fill:"toself",name:"Average"};return Object.values(o)}exportToHeatMapData(t,e){var n=[];if("scores"!==e)return[];var o=[];for(let e=0;e<t.length;e++){var i=t[e];o.push(this.categoryNamesMap()[i].scores)}return n.push({x:this.dates,y:t,z:o,type:"heatmap",colorscale:"BuGn"}),n}exportToLeakyIntegratorData(n){var o=[];for(let t=0;t<n.length;t++){const s=n[t],A=bo[s];var i=this.categoryNamesMap()[s];let e=!1;i.cis&&0<i.cis.length&&(e=!0);var a=null==(a=i.cis)?void 0:a.map(e=>e[0]),r=null==(r=i.cis)?void 0:r.map(e=>e[1]);o.push({x:this.dates.map((e,t)=>t),y:i.scores,name:vo(s,20),type:"bar"}),o.push({x:this.dates.map((e,t)=>t),y:i.leakyScores,name:vo("Leaky "+s,20),legendgroup:A,hoverinfo:"text",text:null==(i=i.leakyScores)?void 0:i.map((e,t)=>`${A}<br>${s}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),e&&o.push({x:this.dates.map((e,t)=>t),y:r,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),e&&o.push({x:this.dates.map((e,t)=>t),y:a,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}return o}}function vo(e,t){return e.length>t?e.substr(0,t-1)+"...":e}class Mo{constructor(e){this.data=new Io(e)}sortData(){return this.data.sort(),this}normaliseScores(){return this.data.normaliseScores(),this}calculateMovingAverageBasedOnDataPoints(e){return this.data.calculateMovingAverageBasedOnDataPoints(e),this}calculateMovingAverageBasedOnDates(e,t="minutes"){return this.data.calculateMovingAverageBasedOnDates(e,t),this}calculateMovingStdBasedOnDataPoints(e){return this.data.calculateMovingStdBasedOnDataPoints(e),this}calculateMovingStdBasedOnDates(e,t="minutes"){return this.data.calculateMovingStdBasedOnDates(e,t),this}calculateCompositeScoreOverTime(){return this.data.calculateCompositeScoreOverTime(),this}calculateAverageGivenTimeWindow(e,t="automatic",n="minutes"){return this.data.calculateAverageGivenTimeWindow(e,t,n),this}calculateMovingConfidenceIntervals(e,t="dataPoints",n="minutes"){return this.data.calculateMovingConfidenceIntervals(e,t,n),this}calculateMovingMaxBasedOnDates(e,t="minutes"){return this.data.calculateMovingMaxBasedOnDates(e,t),this}calculateLeakyIntegrator(e,t,n,o,i,a){return this.data.calculateLeakyIntegrator(e,t,n,o,i,a),this}exportToLineGraphData(e=[],t="scores"){return this.data.exportToLineGraphData(e,t)}exportToSpiderGraphData(e=[],t="scores",n=!1){return this.data.exportToSpiderGraphData(e,t,n)}exportToHeatMapData(e=[],t="scores"){return this.data.exportToHeatMapData(e,t)}exportToLeakyIntegratorData(e=[]){return this.data.exportToLeakyIntegratorData(e)}}class To{static compareStars(i){const a={},r=To.previousStars;return r?(Object.keys(i).forEach(e=>{const n=r[e]?r[e][1]:[];var t=i[e][1];const o=i[e][0];a[e]=t.map((e,t)=>1===e&&1!==n[t]&&o[t])}),To.previousStars=i):(To.previousStars=i,Object.keys(i).forEach(e=>{var t=i[e][1];const n=i[e][0];a[e]=t.map((e,t)=>1===e&&n[t])})),a}}To.previousStars=null;var So=To;R.default=t},function(F,R,e){"use strict";var i;e.r(R),e.d(R,"Preprocessor",function(){return Mo}),e.d(R,"ScoresUtils",function(){return C}),e.d(R,"StarProgressTracker",function(){return So}),e.d(R,"DataToStars",function(){return $n}),(t=i=i||{}).STUDENT_OR_TEACHER_CHANGED="studentOrTeacherChanged",t.IS_USER_LOGGED_IN_CHANGED="isUserLoggedInChanged",t.NEW_CLASS_ANNOUNCEMENT="newClassAnnouncement",t.NEW_CLASS_ANNOUNCEMENT_RESPONSE="newClassAnnouncementResponse";class Y{constructor(e,t,n){if(this.id=e,this.typeOfEventToListenFor=t,this.cb=n,!this.id||!this.cb||!this.typeOfEventToListenFor)throw new TypeError('The subclass must define the "id", "typeOfEventToListenFor" and "cb" properties.')}notify(e,t){e===this.typeOfEventToListenFor&&this.cb(t)}}const U={EXCHANGE_CODE:"exchange_code",REFRESH_TOKEN:"refresh_token"},L={web:"https://codemarty.com",staging:"https://marty-webapp--code-assess-nf60oacq.web.app",mobile:"com.robotical.app://oauth2redirect","dev-mb":"http://localhost:8601","dev-webapp":"http://localhost:3000"};class G{constructor(e){this.verifier=null,this.access_token=null,this.expiry_date=null,this.refresh_token=null,this.API=e,this.id_token=null}async checkSession(){var e=localStorage.getItem("accessToken"),t=localStorage.getItem("idToken"),n=localStorage.getItem("expiryDate");if(e&&t&&n){this.access_token=e,this.id_token=t,this.expiry_date=n;try{if(!await this.API.initGapiClient())return console.warn("error initializing gapi client with pre-existing credentials"),!1}catch(e){return console.error("error initializing gapi client",e),!1}return!0}return!1}clearSession(){localStorage.removeItem("accessToken"),localStorage.removeItem("idToken"),localStorage.removeItem("expiryDate")}async login(){return await this.checkSession()?(console.log("User already logged in with a valid session."),!0):!0===await new Promise((e,t)=>{var n=document.createElement("script");n.src="https://accounts.google.com/gsi/client",n.onload=()=>{e(!0)},n.onerror=e=>{t(e)},document.body.appendChild(n)})?new Promise((n,o)=>{var e=google.accounts.oauth2.initCodeClient({client_id:"766117397217-omuiqp8095susapkpn5oivhe7tt245ot.apps.googleusercontent.com",scope:po.join(" "),ux_mode:"popup",error_callback:e=>{console.log("init code client error callback",e),o(e)},callback:e=>{console.log("init code client",e);var t=L[this.API.codeAssess.platform];fetch("https://ocsqy2jx5b.execute-api.us-east-1.amazonaws.com/prod/exchange_code",{method:"POST",body:JSON.stringify({endpoint:U.EXCHANGE_CODE,code:e.code,redirect_uri:window.redirect_uri||t}),headers:{"Content-Type":"application/json"}}).then(e=>(console.log("response",e),e.json())).then(async e=>{if(200===e.statusCode)try{e=JSON.parse(e.body)}catch(e){console.log("error parsing data",e)}e.success?(console.log("user logged in successfully",e),this.access_token=e.tokens.access_token,this.id_token=e.tokens.id_token,this.expiry_date=e.tokens.expiry_date,this.refresh_token=e.tokens.refresh_token||null,localStorage.setItem("accessToken",this.access_token||""),localStorage.setItem("idToken",this.id_token||""),localStorage.setItem("expiryDate",this.expiry_date||""),await this.API.initGapiClient(),n(!0)):(console.log("user login failed",e),o(e))}).catch(e=>{console.log("error trying to exchange",e),o(e)})}}).requestCode();console.log("code",e)}):(console.error("Error loading GSI script."),!1)}async logout(){fetch("https://accounts.google.com/o/oauth2/revoke?token="+this.access_token,{method:"POST"}).then(e=>{console.log("logout response",e),this.access_token=null,this.id_token=null,this.expiry_date=null,this.refresh_token=null}).catch(e=>console.error("Error:",e))}}class P{constructor(e){this.loadGAPIScript=()=>new Promise((e,t)=>{var n=document.createElement("script");n.src="https://apis.google.com/js/api.js",n.onload=()=>{e(!0)},n.onerror=e=>{t(e)},document.body.appendChild(n)}),this.API=e,this.loadGAPIScript()}async createCourseWork(e,t,n,o="ASSIGNMENT"){try{var i,a;if(this.API.gapi_client)return i={title:t,description:n,state:"PUBLISHED",workType:o},a=await this.API.gapi_client.request({method:"POST",path:S.CREATE_COURSEWORK(e),body:i}),console.log("Created course work:",a.result),a.result||null;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error creating course work:",e),e}}async listClassess(){var e,t;try{if(this.API.gapi_client)return t=await this.API.gapi_client.request({path:S.LIST_ALL_COURSES(),params:{pageSize:10}}),console.log("listClassess response",t.result.courses),(null==(e=t.result)?void 0:e.courses)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while listing classrooms:",e),[]}}async listCourseWorks(t){var e,n;try{if(this.API.gapi_client)return n=await this.API.gapi_client.request({path:S.LIST_ALL_COURSEWORK(t),params:{pageSize:10}}),console.log("listCourseWorks response",n.result.courseWork),(null==(e=n.result)?void 0:e.courseWork)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing courseWork for course ${t}:`,e),[]}}async listStudents(t){var e,n;try{if(this.API.gapi_client)return n=await this.API.gapi_client.request({path:S.LIST_ALL_STUDENTS(t),params:{pageSize:10}}),console.log("listStudents response",n.result.students),(null==(e=n.result)?void 0:e.students)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing students for course ${t}:`,e),[]}}async listStudentSubmissions(t,n){var e,o;try{if(this.API.gapi_client)return o=await this.API.gapi_client.request({path:S.LIST_ALL_STUDENT_SUBMISSIONS(t,n),params:{pageSize:10}}),console.log("studentSubmissions response",o.result.studentSubmissions),(null==(e=o.result)?void 0:e.studentSubmissions)||[];throw new Error("gapi_client is not initialized.")}catch(e){return console.error(`Error while listing studentSubmissions for course ${t} and courseWork ${n}:`,e),[]}}async addAttachementInCourseWork(e,t,n,o){try{var i,a;if(this.API.gapi_client)return i={addAttachments:[{youTubeVideo:{id:o}}]},a=await this.API.gapi_client.request({method:"POST",path:S.MODIFY_ATTACHEMENTS_OF_COURSEWORK(e,t,n),body:i}),console.log("Added attachment in course work:",a.result),a.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error turning in assignment:",e),e}}async turnInCourseWork(e,t,n){try{var o;if(this.API.gapi_client)return o=await this.API.gapi_client.request({method:"POST",path:S.TURN_IN_COURSEWORK(e,t,n)}),console.log("Turned in assignment:",o.result),o.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error turning in assignment:",e),e}}async patchCourseWork(e,t,n,o,i){try{var a;if(this.API.gapi_client)return a=await this.API.gapi_client.request({method:"PATCH",path:S.PATCH_COURSEWORK(e,t,n,i),body:o}),console.log("Patched course work:",a.result),a.result;throw new Error("gapi_client is not initialized.")}catch(e){throw console.error("Error patching course work:",e),e}}}var c=e(87),g=e(12),H=e(123);function j(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]]);return n}Object.create;Object.create;var t=e(189);function z(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const J=z,W=new g.b("auth","Firebase",z());
|
|
6672
6672
|
/**
|
|
6673
6673
|
* @license
|
|
6674
6674
|
* Copyright 2020 Google LLC
|
|
@@ -8062,7 +8062,7 @@ var Fn;const Rn=Object(g.m)("authIdTokenMaxAge")||300;let Yn=null;function Un(e=
|
|
|
8062
8062
|
* See the License for the specific language governing permissions and
|
|
8063
8063
|
* limitations under the License.
|
|
8064
8064
|
*/
|
|
8065
|
-
function(e,t){if((e=Object(c.b)(e,"auth")).isInitialized()){const o=e.getImmediate();var n=e.getOptions();if(Object(g.h)(n,null!=t?t:{}))return o;l(o,"already-initialized")}const o=e.initialize({options:t});return o}(e,{popupRedirectResolver:kn,persistence:[Lt,vt,Tt]});var o,i,a,t=Object(g.m)("authTokenSyncURL");if(t){a=t;const s=async e=>{var e=e&&await e.getIdTokenResult(),t=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;t&&t>Rn||(t=null==e?void 0:e.token,Yn!==t&&(Yn=t,await fetch(a,{method:t?"POST":"DELETE",headers:t?{Authorization:"Bearer "+t}:{}})))};e=n,t=s,r=()=>s(n.currentUser),Object(g.n)(e).beforeAuthStateChanged(t,r),e=n,t=e=>s(e),Object(g.n)(e).onIdTokenChanged(t,o,i)}var r=Object(g.k)("auth");return r&&Ve(n,"http://"+r),n}Fn="Browser",Object(c.c)(new t.a("auth",(e,{options:t})=>{var n=e.getProvider("app").getImmediate(),o=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options,i=(h(i&&!i.includes(":"),"invalid-api-key",{appName:n.name}),{apiKey:i,authDomain:a,clientPlatform:Fn,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Re(Fn)}),a=new Le(n,o,e,i);return n=a,e=(null==(o=t)?void 0:o.persistence)||[],e=(Array.isArray(e)?e:[e]).map(u),null!=o&&o.errorMap&&n._updateErrorMap(o.errorMap),n._initializeWithPersistence(e,null==o?void 0:o.popupRedirectResolver),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Object(c.c)(new t.a("auth-internal",e=>{var e=Ge(e.getProvider("auth").getImmediate());return e=e,new _n(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Object(c.g)(On,"1.5.1",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Fn)),Object(c.g)(On,"1.5.1","esm2017");var E,w=e(22);const Ln={apiKey:"AIzaSyD8Kwib8K_I4jTw2eTbQPWRMKA4SjeonIw",authDomain:"northern-net-403811.firebaseapp.com",projectId:"northern-net-403811",storageBucket:"northern-net-403811.appspot.com",messagingSenderId:"766117397217",appId:"1:766117397217:web:32e639ee12d7b2d7d1ada0",measurementId:"G-3X2F1HT4YE"};(t=E=E||{})[t.Ready=0]="Ready",t[t.InProgress=1]="InProgress",t[t.Done=2]="Done";class Gn{constructor(e){this.firebaseInitialisedFlag=E.Ready,this.app=null,this.auth=null,this.API=e}hasFirebaseBeenInitialised(){return this.firebaseInitialisedFlag==E.Done}initialiseFirestore(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");let n;this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{var o=A.credential(this.API.gapiConnectionAPI.id_token,this.API.gapiConnectionAPI.access_token);console.log("credential",o),n=await ft(this.auth,o)}catch(e){return console.log("Error signing in: ",e),t(e)}if(n.user){this.firebaseInitialisedFlag=E.Done;try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return console.log("Successfully signed in to Firebase."),e(!0)}return this.firebaseInitialisedFlag=E.Ready,console.log("Couldn't connect to Firebase. User not signed in google."),t("User not signed in Google.")})}initialiseFirestoreWithoutSignIn(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return this.firebaseInitialisedFlag=E.Done,console.log("Successfully initialized Firebase."),e(!0)})}}var Pn=e(228);Pn.enc.Utf8.parse("some_fixed_iv_here");class y{static generateKey(e){return Pn.SHA256(e).toString()}static encrypt(e,t){return e}static decrypt(e,t){return e}}class Hn{constructor(e,t,n,o,i){this.studentSubmissions=null,this.id=e,this.classId=t,this.title=n,this.description=o,this.API=i}async addAttachment(e,t,n){await this.requestStudentSubmissionsList();var o=null==(o=this.studentSubmissions)?void 0:o.find(e=>e.userId===t);return o?await this.API.gapiClassroomAPI.addAttachementInCourseWork(this.classId,e,o.id,n):(console.error("StudentSubmission not found"),!1)}async getListOfStudentSubmissions(){return this.studentSubmissions||await this.requestStudentSubmissionsList(),this.studentSubmissions||[]}async requestStudentSubmissionsList(){var e=await this.API.gapiClassroomAPI.listStudentSubmissions(this.classId,this.id);this.studentSubmissions=e}}class jn{static calculateCompositeScore({algorithmsCompoScores:e,analysisCompoScores:t,decompositionCompoScores:n,patternRecAndDataRepCompoScores:o,generalisationAndAbstrCompoScores:i,badgesScores:a}){var r=a;let s=0,A=0,l=0,u=0,c=0,g=0;for(const h in r){var d=r[h];d[0]&&(s+=d[0],A++),d[1]&&(l+=d[1],u++),d[2]&&(c+=d[2],g++)}return e+t+n+o+i+s+l+c}}class C{static calculatePatternRecognitionAndDataRepresentationScore(e,t){let n=t["Duplicate Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e["Data Types"]*t+e.Loops*t+e["Variables and Data Structures"]*t}static calculateDecompositionScore(e){return e.Functions+e.Parallelism+e.Sequencing}static calculateGeneralisationAndAbstractionScore(e){return e["Function Reuse"]+e["Functions with Arguments"]+e["Variables Instead of Literals"]}static calculateAlgorithmsScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Conditionals*t+e.Operators*t+e["Synchronization and Messages"]*t}static calculateAnalysisScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Comments*t+e.Debugging*t+e.Naming*t}}var zn,Jn,On=e(209),b=e.n(On),t=e(796),Wn=e.n(t),On=e(797),Vn=e.n(On);const Kn=()=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()().tz("Europe/London").format()),I=e=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()(e).tz("Europe/London")),Xn=(e,t,n="seconds")=>{e=b()(e),t=b()(t);return e.diff(t,n)};(t=zn=zn||{}).STARTED="STARTED",t.STOPPED="STOPPED",(Jn=Jn||{}).LAST_HEARTBEAT="lastUploadTime";var qn=class{constructor(){this.heartbeatInterval=null,this.heartbeatCallbacks={},this.status=zn.STOPPED}startHeartbeat(){this.heartbeatInterval?console.warn("Heartbeat already started."):(this.heartbeatInterval=setInterval(()=>{Object.values(this.heartbeatCallbacks).forEach(e=>e())},5e3),this.status=zn.STARTED)}stopHeartbeat(){this.heartbeatInterval?(console.debug("stopping heartbeat"),clearInterval(this.heartbeatInterval),this.heartbeatInterval=null,this.status=zn.STOPPED):console.warn("Heartbeat not running.")}setHeartbeatCallback(e,t){this.heartbeatCallbacks[e]&&console.warn(`Callback with id ${e} already set. Overwriting.`),this.heartbeatCallbacks[e]=t}removeHeartbeatCallback(e){this.heartbeatCallbacks[e]?delete this.heartbeatCallbacks[e]:console.warn(`Callback with id ${e} does not exist.`)}},v=e(38);const Zn={Loops:[v.Loops_1.progressionRanges,v.Loops_2.progressionRanges,v.Loops_3.progressionRanges],Functions:[v.Functions_1.progressionRanges,v.Functions_2.progressionRanges,v.Functions_3.progressionRanges],Conditionals:[v.Conditionals_1.progressionRanges,v.Conditionals_2.progressionRanges,v.Conditionals_3.progressionRanges],"Data Types":[v.DataTypes_1.progressionRanges,v.DataTypes_2.progressionRanges,v.DataTypes_3.progressionRanges],Operators:[v.Operators_1.progressionRanges,v.Operators_2.progressionRanges,v.Operators_3.progressionRanges],Parallelism:[v.Parallelism_1.progressionRanges,v.Parallelism_2.progressionRanges],"Variables and Lists":[v.VariablesAndLists_1.progressionRanges,v.VariablesAndLists_2.progressionRanges,v.VariablesAndLists_3.progressionRanges]};class $n{static toStars(e){var t={};for(const a in Zn){t[a]=[[],[]];var n=e[a];for(let e=0;e<n.length;e++){var[o,i]=function(t,n){var o=["#cd7f32","silver","gold"];for(let e=0;e<n.length;e++){var i=n[e][0],a=n[e][1];if(i<t&&t<=a)return[o[e%o.length],(t-i)/(a-i)]}return t>=n[n.length-1][1]?["gold",1]:["white",0]}(n[e],Zn[a][e]);o&&(t[a][0].push(o),t[a][1].push(i))}}return t}}class eo{constructor(e,t,n,o,i,a,r,s){this.heartbeat=null,this.scoresOverTime=null,this.reactionsOverTime=null,this.badges=null,this.lastHeartbeat=null,this.onStudentDataDocChangeCbs=new Map,this.studentId=t,this.classId=e,this.id=o||eo.compileStudentDataId(e,t),this.API=n,this.scoresOverTime=i||null,this.badges=a||new v.BadgesCounts,this.lastHeartbeat=r||null,this.reactionsOverTime=s||null}static compileStudentDataId(e,t){return e+"_"+t}initialiseHeartbeat(){this.heartbeat&&(console.warn("Heartbeat already created. Removing this heartbeat and creating a new one"),this.heartbeat.stopHeartbeat()),this.heartbeat=new qn,this.startSendingLastHeartbeatTime()}startSendingLastHeartbeatTime(){var e;this.heartbeat||(console.warn("Heartbeat not created, creating heartbeat"),this.initialiseHeartbeat()),console.debug("setting heartbeat callback"),null!=(e=this.heartbeat)&&e.setHeartbeatCallback(Jn.LAST_HEARTBEAT,this.sendLastHeartbeatTime.bind(this)),null!=(e=this.heartbeat)&&e.startHeartbeat()}sendLastHeartbeatTime(){this.API.firestoreStudentDataAPI.updateLastHeartbeatTime(this.classId,this.studentId)}stopHeartbeat(){this.heartbeat&&(this.heartbeat.stopHeartbeat(),this.heartbeat=null)}async sendStudentAssessmentScores(e){e={scoresOverTime:{[Kn()]:e}};await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e)}async sendStudentBadgesData(e){await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,{badges:e})}async sendStudentEmojiReaction(e){e={reactionsOverTime:{[Kn()]:e}};try{return await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e),!0}catch(e){return console.error("Failed to send student reaction to database",e),!1}}async subscribeToDbDocChanges(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onStudentDataDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreStudentDataAPI.subscribeToStudentDataDocChanges(this.classId,this.studentId,t=>{this.onStudentDataDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onStudentDataDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onStudentDataDocChangeCbs.has(e)?this.onStudentDataDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.onStudentDataDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}getLastScore(){var e;return this.scoresOverTime&&(e=Object.keys(this.scoresOverTime).sort().reverse()[0])?{[e]:this.scoresOverTime[e]}:null}badgesToStars(){return this.badges?$n.toStars(this.badges):(console.warn("badges is null"),null)}}var M=eo;class to{constructor(e,t,n){this.classess=null,this.studentData=null,this.joinedClass=null,this.id=e,this.name=t,this.API=n}async joinClass(t){await this.getListOfClassess();var e,n=null==(n=this.classess)?void 0:n.find(e=>e.id===t);return n?(e=await this.requestStudentData(t))?(e.initialiseHeartbeat(),this.joinedClass=n,await this.listenForClassAnnouncements(this.API.codeAssess.onNewClassAnnouncement.bind(this.API.codeAssess)),!0):(console.error("Student data not found"),!1):(console.error("Class not found"),!1)}async exitClass(){return this.joinedClass?(await this.requestStudentData(this.joinedClass.id),this.studentData?(this.studentData.stopHeartbeat(),this.joinedClass.unsubscribeFromDbDocChanges(),this.joinedClass=null,!(this.studentData=null)):(console.error("Student data not found"),!1)):(console.error("Student is not in a class"),!1)}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async requestStudentData(e){if(this.doesStudentDataExist(e))return console.log("StudentData already exists"),this.studentData;let t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);if(t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id)))return console.debug("fetched studentData",t),e=new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime),this.addStudentData(e),e;console.error("Failed to create student data in db")}async fetchStudentData(e){var t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);return t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id))?new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime):void console.error("Failed to create student data in db")}addStudentData(e){this.doesStudentDataExist(e.classId)?console.warn("StudentData already exists"):(this.studentData&&this.studentData.stopHeartbeat(),this.studentData=e)}doesStudentDataExist(e){return!!this.studentData&&this.studentData.classId===e}getActivityStatus(e){if(!e.lastHeartbeat)return"offline";var t=Kn(),n=e.lastHeartbeat;if(7<Xn(t,n,"seconds"))return"offline";if(console.log("studentData.scoresOverTime",e.scoresOverTime),!e.scoresOverTime)return"inactive";n=e.getLastScore();if(!n)return"inactive";console.log("lastScore",n);e=Object.keys(n)[0],n=I(e);return 30<Xn(t,n.toString(),"seconds")?"inactive":"active"}getCompositeScore(e,t=!0){var n;return e.scoresOverTime&&(n=e.getLastScore(),t=t?e.badges:{},n)&&Object.keys(n)[0]?(e=Object.values(n)[0],jn.calculateCompositeScore({algorithmsCompoScores:C.calculateAlgorithmsScore(e.Algorithms,e["Dead Code"]),analysisCompoScores:C.calculateAnalysisScore(e.Analysis,e["Dead Code"]),decompositionCompoScores:C.calculateDecompositionScore(e.Decomposition),patternRecAndDataRepCompoScores:C.calculatePatternRecognitionAndDataRepresentationScore(e["Pattern Recognition and Data Representation"],e.Repetition),generalisationAndAbstrCompoScores:C.calculateGeneralisationAndAbstractionScore(e["Generalisation and Abstraction"]),badgesScores:t})):0}async listenForClassAnnouncements(n){return this.joinedClass?(await this.joinedClass.subscribeToDbDocChanges("studentJoinedClassAnnouncements",async t=>{if(t.announcements)if(0===t.announcements.length)console.warn("No announcements in class");else{t=await t.getActiveAnnouncements();if(t&&0!==t.length){let e=t[0];1<t.length&&(console.warn("More than one active announcement, using the last one"),e=t[t.length-1]),e?n(e):console.error("Announcement not found")}else console.warn("No active announcements")}}),!0):(console.warn("Student has not joined a class, cannot listen for joined class announcements"),!1)}async getAnnouncement(e){return this.joinedClass?await this.API.firestoreClassAnnouncementsAPI.get(e,this.joinedClass.id):(console.warn("Student has not joined a class, cannot get announcement"),null)}async sendEmojiFeedback(e,t){if(!this.joinedClass)return console.warn("Student has not joined a class, cannot send emoji feedback"),!1;e=await this.getAnnouncement(e);if(!e)return console.error("Announcement not found"),!1;var n=await this.requestStudentData(this.joinedClass.id);if(!n)return console.error("Student data not found"),!1;n=await n.sendStudentEmojiReaction({reaction:t});if(n&&!await e.respond(this.id,this.name,t))return console.error("Failed to respond to announcement"),!1;return!0}}class no{constructor(e,t,n,o,i,a,r,s){this.courseWorks=null,this.students=null,this.announcements=[],this.onDocChangeCbs=new Map,this.id=e,this.teacherId=t,this.name=n,this.API=o,this.section=i,this.subject=a,this.room=r,this.announcements=s||[]}async getListOfCourseWorks(){return this.courseWorks||await this.requestListOfCourseWorks(),this.courseWorks||[]}async getListOfStudents(){return this.students||await this.requestListOfStudents(),this.students||[]}async createCourseWork(e,t){var e=await this.API.gapiClassroomAPI.createCourseWork(this.id,e,t),t=new Hn(e.id,this.id,e.title,e.description,this.API);return null!=(e=this.courseWorks)&&e.push(t),t}async requestListOfCourseWorks(){var e=(await this.API.gapiClassroomAPI.listCourseWorks(this.id)).map(e=>new Hn(e.id,this.id,e.title,e.description,this.API));this.courseWorks=e}async requestListOfStudents(){var e=(await this.API.gapiClassroomAPI.listStudents(this.id)).map(e=>new to(e.userId,e.profile.name.fullName,this.API));this.students=e}async createStudentDataForAllStudentsIfNotExists(){if(this.students||await this.requestListOfStudents(),this.students){const n=[];await Promise.all(this.students.map(async e=>{var t=await this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(this.id,e.id);n.push({[e.id]:t})})),console.log("wasStudentDataCreatedSuccessfully?",n)}}async getStudentDataForAllStudents(){return this.students||await this.requestListOfStudents(),this.students?(await Promise.all(this.students.map(async e=>{return await this.API.firestoreStudentDataAPI.getStudentData(this.id,e.id)}))).map(e=>e?new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime):null):[]}async appendFetchedStudentDataToStudents(){var e;this.students||await this.requestListOfStudents(),await this.createStudentDataForAllStudentsIfNotExists();const n=await this.API.firestoreStudentDataAPI.getStudentDataListGivenClassId(this.id);null!=(e=this.students)&&e.forEach(t=>{var e=n.find(e=>e.studentId===t.id);e&&(e=new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime),t.addStudentData(e))})}async announce(e,t){e=await this.API.firestoreClassAnnouncementsAPI.create(this.id,e,t);return e?await this.API.firestoreClassesAPI.addClassAnnouncement(this.id,e)?e:(console.warn("Failed to add announcement to class"),!1):(console.warn("Failed to create announcement -- announcementId is falsy"),!1)}async removeAnnouncement(e){return!!await this.API.firestoreClassesAPI.removeClassAnnouncement(this.id,e)||(console.warn("Failed to remove announcement from class"),!1)}async deactivateAnnouncement(e){var t=await e.deactivate();return"text"!==e.type||await this.removeAnnouncement(e.id)?!!t||(console.warn("Failed to deactivate announcement"),!1):(console.warn("Failed to remove announcement"),!1)}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassesAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async getAnnouncements(){var e=await this.API.firestoreClassesAPI.getClassAnnouncementIds(this.id)||[];return(await Promise.all(e.map(async e=>{var t=await this.API.firestoreClassAnnouncementsAPI.get(e,this.id);return t||(console.warn(`Announcement with ID ${e} does not exist`),null)}))).filter(e=>null!==e)}async getActiveAnnouncements(){var e=await this.API.firestoreClassAnnouncementsAPI.getActiveAnnouncements(this.id);return e&&0!==e.length?e.filter(e=>null!==e):(console.warn("There are no active announcements for class with ID "+this.id),[])}}const oo="Classes";class io{constructor(e){this.API=e}async createClass(e,t,n){var o;return this.API.firestoreDb?(o=y.encrypt(e,e),o=Object(w.c)(this.API.firestoreDb,oo,o),(await Object(w.d)(o)).exists()?(console.log("Class already exists"),!1):(n=y.encrypt(n,e),t=y.encrypt(t,e),await Object(w.i)(o,{name:t,teacherId:n}),console.log("Class created"),!0)):(console.error("Firestore db not initialized"),!1)}async getClass(t){var e,n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(n=await Object(w.d)(n)).exists()?(n=n.data(),{name:y.decrypt(n.name,t),teacherId:y.decrypt(n.teacherId,t),students:null==(e=n.students)?void 0:e.map(e=>y.decrypt(e,t)),announcements:n.announcements}):(console.log("Class does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateClassStudents(t,e){var n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(await Object(w.d)(n)).exists()?(e=e.map(e=>y.encrypt(e,t)),await Object(w.i)(n,{students:e},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async addClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.announcements)||[],await Object(w.i)(e,{announcements:[...n,t]},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async removeClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=((null==(n=n.data())?void 0:n.announcements)||[]).filter(e=>e!==t),await Object(w.i)(e,{announcements:n},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=y.encrypt(t,t),e=Object(w.c)(this.API.firestoreDb,oo,e),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new no(t,y.decrypt(e.teacherId,t),y.decrypt(e.name,t),this.API,void 0,void 0,void 0,e.announcements),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async getClassAnnouncementIds(e){return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(e=await Object(w.d)(e)).exists()?e.data().announcements:(console.log("Class does not exist"),[])):(console.error("Firestore db not initialized"),[])}}class ao{constructor(e){this.firestoreDb=null,this.API=e}async createClassIfDoesntExist(e,t,n){var o;return this.API.firestoreDb?(o=await this.API.firestoreClassesAPI.getClass(e))?(console.log("Class exists",o),!0):(console.log("Class does not exist, creating class"),await this.API.firestoreClassesAPI.createClass(e,t,n)?(console.log("Class created",e),o=await this.API.firestoreClassesAPI.getClass(e),console.log("Class data",o),!0):(console.error("Failed to create class"),!1)):(console.error("Firestore db not initialized"),!1)}async addStudentToClassIfHasntBeenAddedAlready(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreClassesAPI.getClass(e))?((n=n.students||[]).includes(t)?console.log("Student has already been added to class"):(console.log("Student has not been added to class, adding student to class"),n.push(t),await this.API.firestoreClassesAPI.updateClassStudents(e,n),console.log("Student added to class")),!0):(console.log("Class does not exist"),!1):(console.error("Firestore db not initialized"),!1)}async createTeacherIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreTeachersAPI.getTeacher(e))?(console.log("Teacher exists",n),!0):(console.log("Teacher does not exist, creating teacher"),await this.API.firestoreTeachersAPI.createTeacher(e,t)?(console.log("Teacher created",e),n=await this.API.firestoreTeachersAPI.getTeacher(e),console.log("Teacher data",n),!0):(console.error("Failed to create teacher"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentsAPI.getStudent(e))?(console.log("Student exists",n),!0):(console.log("Student does not exist, creating student"),await this.API.firestoreStudentsAPI.createStudent(e,t)?(console.log("Student created",e),n=await this.API.firestoreStudentsAPI.getStudent(e),console.log("Student data",n),!0):(console.error("Failed to create student"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentDataIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentDataAPI.getStudentData(e,t))?(console.log("StudentData exists",n),!0):(console.log("StudentData does not exist, creating studentData"),await this.API.firestoreStudentDataAPI.createStudentData(e,t)?(console.log("StudentData created",e,t),n=await this.API.firestoreStudentDataAPI.getStudentData(e,t),console.log("StudentData data",n),!0):(console.error("Failed to create studentData"),!1)):(console.error("Firestore db not initialized"),!1)}}class ro{constructor(e){this.API=e}async createTeacher(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Teachers",n),(await Object(w.d)(n)).exists()?(console.log("Teacher already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Teacher created"),!0)):(console.error("Firestore db not initialized"),!1)}async getTeacher(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Teachers",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Teacher does not exist"),null)):(console.error("Firestore db not initialized"),null)}}class so{constructor(e){this.API=e}async createStudent(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Students",n),(await Object(w.d)(n)).exists()?(console.log("Student already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Student created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudent(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Students",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Student does not exist"),null)):(console.error("Firestore db not initialized"),null)}}const Ao=e=>{if(!e)return console.warn("minifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={Decomposition:n.dec,"Pattern Recognition and Data Representation":n.pat,"Generalisation and Abstraction":n.gen,Algorithms:n.alg,Analysis:n.ana,Repetition:n.rep,"Dead Code":n.dea};t[o]=n}return t},lo="StudentData";class uo{constructor(e){this.API=e}async createStudentData(e,t){var n,o;return this.API.firestoreDb?(n=M.compileStudentDataId(e,t),n=y.encrypt(n,e),console.debug("encryptedStudentDataId used for creating student data: ",n),o=Object(w.c)(this.API.firestoreDb,lo,n),(await Object(w.d)(o)).exists()?(console.log("StudentData already exists"),!1):(await Object(w.i)(o,{classId:y.encrypt(e,e),studentId:y.encrypt(t,e),id:n}),console.log("StudentData created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudentData(e,t){return this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),console.debug("encryptedStudentDataId used for getting student data: ",t),t=Object(w.c)(this.API.firestoreDb,lo,t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{id:y.decrypt(t.id,e),classId:y.decrypt(t.classId,e),studentId:y.decrypt(t.studentId,e),scoresOverTime:Ao(t.scoresOverTime),badges:t.badges,lastHeartbeat:t.lastHeartbeat,reactionsOverTime:t.reactionsOverTime}):(console.log("StudentData does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateStudentData(e,t,n){this.API.firestoreDb?(n.scoresOverTime&&(n.scoresOverTime=(e=>{if(!e)return console.warn("unminifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={dec:Object.assign({},n.Decomposition),pat:Object.assign({},n["Pattern Recognition and Data Representation"]),gen:Object.assign({},n["Generalisation and Abstraction"]),alg:Object.assign({},n.Algorithms),ana:Object.assign({},n.Analysis),rep:Object.assign({},n.Repetition),dea:Object.assign({},n["Dead Code"])};t[o]=n}return t})(n.scoresOverTime)),t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,n,{merge:!0})):console.error("Firestore db not initialized")}updateLastHeartbeatTime(e,t){this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,{lastHeartbeat:Kn()},{merge:!0})):console.error("Firestore db not initialized")}async getStudentDataListGivenClassId(t){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve([]);const n=[];try{var e=y.encrypt(t,t),o=Object(w.h)(Object(w.a)(this.API.firestoreDb,lo),Object(w.j)("classId","==",e));return(await Object(w.e)(o)).forEach(e=>{e=e.data(),e={classId:y.decrypt(e.classId,t),id:y.decrypt(e.id,t),studentId:y.decrypt(e.studentId,t),lastHeartbeat:e.lastHeartbeat,badges:e.badges,scoresOverTime:Ao(e.scoresOverTime),reactionsOverTime:e.reactionsOverTime};n.push(e)}),n}catch(e){return console.error("Error getting documents: ",e),Promise.resolve([])}}async subscribeToStudentDataDocChanges(n,e,o){if(this.API.firestoreDb)return e=M.compileStudentDataId(n,e),e=y.encrypt(e,n),e=Object(w.c)(this.API.firestoreDb,lo,e),Object(w.g)(e,e=>{var t;e.exists()?(t=e.data(),e=new M(y.decrypt(t.classId,n),y.decrypt(t.studentId,n),this.API,y.decrypt(e.id,n),Ao(t.scoresOverTime),t.badges,t.lastHeartbeat,t.reactionsOverTime),o(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}}class co{constructor(e,t,n,o,i,a,r,s=!0){this.isActive=!0,this.responses=[],this.onDocChangeCbs=new Map,this.id=e,this.type=t,this.API=n,this.classId=o,this.text=i,this.timestamp=a,this.responses=r,this.isActive=s}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassAnnouncementsAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async respond(e,t,n){n={response:n,studentId:e,studentName:t,timestamp:Kn()};return this.API.firestoreClassAnnouncementsAPI.addResponse(this.id,n)}async deactivate(){return"text"===this.type?this.API.firestoreClassAnnouncementsAPI.delete(this.id):this.API.firestoreClassAnnouncementsAPI.deactivate(this.id)}async refresh(){var e=await this.API.firestoreClassAnnouncementsAPI.get(this.id,this.classId);if(e)return e;throw new Error("Could not get fresh class announcement")}}const T="ClassAnnouncements";class go{constructor(e){this.API=e}async create(e,t,n){var o;return this.API.firestoreDb?(e=y.encrypt(e,e),o=Object(w.a)(this.API.firestoreDb,T),o=Object(w.c)(o),await Object(w.i)(o,{classId:e,text:t,timestamp:Kn(),announcementType:n,responses:[],isActive:!0}),console.info("Class announcement created"),o.id):(console.error("Firestore db not initialized"),!1)}async get(e,t){var n;return this.API.firestoreDb?(n=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(n)).exists()?(n=n.data(),new co(e,n.announcementType,this.API,y.decrypt(n.classId,t),n.text,n.timestamp,n.responses,!!n.isActive)):(console.log("Class announcement does not exist"),null)):(console.error("Firestore db not initialized"),null)}async getActiveAnnouncements(n){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve(null);var e=Object(w.a)(this.API.firestoreDb,T),e=Object(w.h)(e,Object(w.j)("classId","==",y.encrypt(n,n)),Object(w.j)("isActive","==",!0)),e=await Object(w.e)(e);const o=[];return e.forEach(e=>{var t=e.data(),e=new co(e.id,t.announcementType,this.API,y.decrypt(t.classId,n),t.text,t.timestamp,t.responses,!!t.isActive);o.push(e)}),o}async update(e,t){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,t,{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=Object(w.c)(this.API.firestoreDb,T,t),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new co(t,e.announcementType,this.API,y.decrypt(e.classId,t),e.text,e.timestamp,e.responses,!!e.isActive),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async addResponse(e,t){var n;return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.responses)||[],await Object(w.i)(e,{responses:[...n,t]},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async deactivate(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,{isActive:!1},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async delete(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.b)(e),console.info("Class announcement deleted"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}}class ho{constructor(e,t,n){this.classess=null,this.id=e,this.name=t,this.API=n}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var t=await this.API.gapiClassroomAPI.listClassess(),n=[];for(let e=0;e<10;e++){var o=t[0];0===e?n.push(new no(o.id,o.ownerId,o.name,this.API,o.section,o.subject,o.room,o.announcement)):n.push(new no(""+e,o.ownerId,"Class "+e,this.API,"Section "+e,"Subject "+e,"Room "+e,o.announcement))}this.classess=n}async determineIfStudentOrTeacherInClass(t){await this.requestListOfClasses();var e=null==(e=this.classess)?void 0:e.find(e=>e.id===t);return e?(console.debug("classToCheck",e),e.teacherId===this.id?Bo.TEACHER:Bo.STUDENT):(console.warn("Could not find class with id",t),null)}}const S={CREATE_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,GET_USER_PROFILE:()=>"https://classroom.googleapis.com/v1/userProfiles/me",LIST_ALL_COURSES:()=>"https://classroom.googleapis.com/v1/courses",LIST_ALL_STUDENTS:e=>`https://classroom.googleapis.com/v1/courses/${e}/students`,LIST_ALL_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,LIST_ALL_STUDENT_SUBMISSIONS:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions`,MODIFY_ATTACHEMENTS_OF_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:modifyAttachments`,PATCH_COURSEWORK:(e,t,n,o)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}?updateMask=`+encodeURIComponent(o),REGISTER_STUDENT:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/students?enrollmentCode=`+t,TURN_IN_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:turnIn`},po=["https://www.googleapis.com/auth/classroom.courses.readonly","https://www.googleapis.com/auth/classroom.rosters.readonly","openid"];class mo{constructor(e){this.gapi_client=null,this.firestoreDb=null,this.gapiConnectionAPI=new G(this),this.gapiClassroomAPI=new P(this),this.firestoreConnectionAPI=new Gn(this),this.firestoreClassesAPI=new io(this),this.firestoreTeachersAPI=new ro(this),this.firestoreStudentsAPI=new so(this),this.firestoreStudentDataAPI=new uo(this),this.firestoreClassAnnouncementsAPI=new go(this),this.firestoreHOCAPI=new ao(this),this.codeAssess=e}async initGapiClient(){return new Promise((t,n)=>{const e=()=>{gapi.client.init({}).then(async()=>{if(console.log("this.gapi_client loaded"),!this.gapiConnectionAPI.access_token)return console.error("access_token is null"),n(!1);gapi.client.setToken({access_token:this.gapiConnectionAPI.access_token}),this.gapi_client=gapi.client;var e=await this.requestCurrentUserProfile();if(!e)return console.error("userProfile is null"),n(!1);this.codeAssess.setUserProfile(new ho(e.id,e.name.fullName,this)),t(!0)}).catch(e=>{console.error("Error loading gapi client for API",e),n(!1)})};gapi.load("client:auth2",()=>e())})}async requestCurrentUserProfile(){try{var e;if(this.gapi_client)return e=await this.gapi_client.request({path:S.GET_USER_PROFILE()}),console.log("response",e.result),e.result;throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while getting current user profile:",e),null}}}class fo{constructor(e,t,n){this.classess=null,this.monitoredAnnouncements=new Map,this.id=e,this.name=t,this.API=n,this.requestListOfClasses()}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=await this.API.gapiClassroomAPI.listClassess(),e=(console.debug("fetchedClassess",e),e.map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement)));this.classess=e}async createCourseWorkForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);return o?o.createCourseWork(e,n):(console.error("Could not find class with id",t),!1)}async makeAnnouncementForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);if(!o)return console.error("Could not find class with id",t),!1;for(const i of await o.getActiveAnnouncements())await i.deactivate();return o.announce(e,n)}async askForEmojiFeedback(e,t){e=await this.makeAnnouncementForClass(e,t,"emoji-feedback");return e||(console.error("Could not make announcement"),!1)}async getAnnouncement(t,e){var n;return(null==(n=this.classess)?void 0:n.find(e=>e.id===t))?await this.API.firestoreClassAnnouncementsAPI.get(e,t):(console.error("Could not find class with id",t),null)}async monitorAnnouncementResponses(e,t,n){e=await this.getAnnouncement(e,t);return e?(await e.subscribeToDbDocChanges(t,e=>{n(e.responses||[])}),this.monitoredAnnouncements.set(t,e),!0):(console.error("Could not get announcement"),!1)}stopMonitoringAnnouncementResponse(e){var t=this.monitoredAnnouncements.get(e);return t?(t.unsubscribeFromDbDocChanges(),this.monitoredAnnouncements.delete(e),!0):(console.error("Could not find announcement with id",e),!1)}stopMonitoringAllAnnouncements(){this.monitoredAnnouncements.forEach(e=>{e.unsubscribeFromDbDocChanges()}),this.monitoredAnnouncements.clear()}}var Bo,Eo=class{static studentAssessmentScoresOverTimeToLineGraphData(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const s=a[e];var r=i.map(e=>n[e][s]),r={x:i,y:r,name:s,type:"scatter",mode:"markers"};o.push(r)}return o}static averageScoresOverTime(e){return{}}static transformDataForStackedAreaChart(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const A=a[e];var r=i.map(e=>n[e][A]),s=0===e?"tozeroy":"tonexty",r={x:i,y:r,name:A,type:"scatter",mode:"lines",fill:s};o.push(r)}return o}static transformDataForSpiderChart(e){let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t,o=Object.keys(t).sort();return 0===o.length?(console.warn("No scores over time data provided"),[]):{type:"scatterpolar",r:(e=Object.keys(t[o[0]]).sort()).map(t=>{var e=o.map(e=>n[e][t]);return e[e.length-1]}),theta:e,fill:"toself"}}static getLatestScores(e){let t;var n;return!(t=Array.isArray(e)?this.averageScoresOverTime(e):e)||(e=t,0===(n=Object.keys(t).sort()).length)?(console.warn("No scores over time data provided"),[]):e[n[n.length-1]]}static transformDataForStackedAreaChartForTheLastMinutes(e,t){if(!e)return console.warn("No scores over time data provided"),[];let n;if(!(n=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const o=n;var i=[],e=Object.keys(n).sort();if(0===e.length)return console.warn("No scores over time data provided"),[];const a=b()(Kn());var r=e.filter(e=>{return Xn(a.format(),e,"minutes")<=t});if(0===r.length)return console.warn("No scores in the last "+t+" minutes"),[];var s=Object.keys(n[r[0]]).sort();for(let e=0;e<s.length;e++){const u=s[e];var A=r.map(e=>o[e][u]),l=0===e?"tozeroy":"tonexty",A={x:r,y:A,name:u,type:"scatter",mode:"lines",fill:l};i.push(A)}return i}};(On=Bo=Bo||{}).STUDENT="student",On.TEACHER="teacher";(class ko{});t=class extends class ko{constructor(){if(this.constructor===ko)throw new TypeError('Abstract class "CodeAssessObservable" cannot be instantiated directly.')}}{constructor(){super(),this.userProfile=null,this.teacher=null,this.student=null,this.dataTransformationUtils=Eo,this.platform="staging",this.API=new mo(this),this.observers=[],this.studentOrTeacher=null,this.isUserLoggedIn=!1,this.TypesOfPublishedEvents=i}async logUserIn(){var e=await this.API.gapiConnectionAPI.login(),t=await this.API.firestoreConnectionAPI.initialiseFirestore();return!(!e||!t||(this.setIsUserLoggedIn(!0),0))}async logUserOut(){await this.API.gapiConnectionAPI.logout(),this.setIsUserLoggedIn(!1)}async createTeacherIfDoesntExist(){return this.teacher?this.API.firestoreHOCAPI.createTeacherIfDoesntExist(this.teacher.id,this.teacher.name):(console.error("Teacher not set"),!1)}async createStudentIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentIfDoesntExist(e,t)}async createStudentDataIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(e,t)}async createClassIfDoesntExist(e,t,n){return this.API.firestoreHOCAPI.createClassIfDoesntExist(e,t,n)}async addStudentToClass(e,t,n,o){var i=await this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);if(!i&&await this.createClassIfDoesntExist(e,t,n))return this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);return i}setStudentOrTeacher(e){var t;this.studentOrTeacher=e,this.publish(i.STUDENT_OR_TEACHER_CHANGED),this.userProfile?e===Bo.STUDENT?((t=new to(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setStudent(t)):e===Bo.TEACHER&&((t=new fo(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setTeacher(t)):console.error("User profile not set")}setUserProfile(e){this.userProfile=e}setTeacher(e){this.teacher=e}setStudent(e){this.student=e}setIsUserLoggedIn(e){this.isUserLoggedIn=e,this.publish(i.IS_USER_LOGGED_IN_CHANGED)}onNewClassAnnouncement(e){this.publish(i.NEW_CLASS_ANNOUNCEMENT,e)}subscribe(e,t,n){if(!Object.values(i).includes(t))throw new TypeError(`The type of event "${t}" is not valid. Valid types are: `+Object.values(i).join(", "));const o=new Y(e,t,n);e=this.observers.findIndex(e=>e.id===o.id);-1!==e&&this.observers.splice(e,1),this.observers.push(o)}unsubscribe(t){var e=this.observers.findIndex(e=>e.id===t);-1!==e&&this.observers.splice(e,1)}publish(t,n){this.observers.forEach(e=>e.notify(t,n))}};class k{static calculateWeightedAverageForScoreGivenIndicesAndWeights(t,n,o){if(0===n.length||0===t.length||0===o.length)return[0];let i=0;for(let e=0;e<n[0].length;e++){var a=n[0][e],r=o[e],a=t[a];i+=r*a}return[i/n[0].length]}static calculateWeightsGivenIndicesAndDates(e,t,n="automatic",o="minutes"){if(0===e.length||0===t.length)return[];var i=e[0].map(e=>t[e]).map(e=>I(e));const a=i[0];if("automatic"===n){var r=[];for(let e=0;e<i.length;e++){var s=Math.abs(a.diff(i[e],o));r.push(s)}const u=Math.max(...r),A=r.map(e=>{return 0===e&&0===u?1:e/u});return A}const A=i.map(e=>{e=a.diff(e,o);return Math.pow(.5,e/n)}),l=Math.max(...A);return A.map(e=>e/l)}}class wo{static calculateCIGivenMeanAndStd(e,t,n,o=1.96){return n<=0||t<0||o<=0?[NaN,NaN]:[e-(o=o*(t/Math.sqrt(n))),e+o]}}wo.boundUpperCI=(e,t)=>t;var yo=wo;class D{static calculateLeakyIntegratorScores(t,n,o,i=.1,a=.1,r=.1,s=1){var A=[0],l=[[0,1]];for(let e=1;e<t.length;e++){var u=A[e-1],c=this.adjustLowerBound(t[e],l[e-1][0],0,1,i,a),g=this.adjustUpperBound(0<t[e]?1:0,0===t[e]?l[e-1][1]:0,0,1,r,s),u=this.calculateLeakyScore(t[e],u,c,g,n,o);A.push(u),l.push([c,g])}return{leakyIntegratorScores:A,cis:l}}static calculateLeakyScore(e,t,n,o,i,a){var r=e-t;return 0<r?Math.max(n,Math.min(o,t+e*a*r)):0===e?Math.min(o,Math.max(n,t+(e-(e-n)-t)*i)):Math.max(n,Math.min(o,t+e*i*r))}static adjustUpperBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}static adjustLowerBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}}class Co{static calculateWindowIndices(e,t,n="minutes"){var o=e.map(e=>I(e)),i=[];let a=0;for(;a<o.length;){var r=o[a],s=i.length;for(let e=a;e<o.length;e++){if(!(o[e].diff(r,n)<=t)){a=e;break}if(e===o.length-1)return i[s]||(i[s]=[]),i[s].push(e),i;i[s]||(i[s]=[]),i[s].push(e)}}return i}}class Q extends Co{static calculateMovingAverageForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=0;for(let e=0;e<a.length;e++)t+=n[a[e]];i.push(t/a.length)}return i}static calculateMovingAverageForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]].valueOf();var r=t/a.length,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(r)}return i}static calculateMovingAverageForScore(t,n){if(n<=0||0===t.length)return[];var o=[];let i=0,a=0;for(let e=0;e<t.length;e++)i+=t[e],e>=n-1&&(o.push(i/n),i-=t[a],a++);return o}static calculateMovingAverageForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=0;for(let e=n;e<n+o;e++)t+=i[e].valueOf();var r=t/o,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class x extends Co{static calculateMovingMaxForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=n[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<n.length&&(t=Math.max(t,n[r]))}i.push(t)}return i}static calculateMovingMaxForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=o[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<o.length&&(r=o[r]).isAfter(t)&&(t=r)}var s=t.format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(s)}return i}static calculateMovingMaxForScore(t,n){if(n<=0||0===t.length)return[];var o=[],i=[];for(let e=0;e<t.length;e++)i.push(t[e]),n<i.length&&i.shift(),e>=n-1&&o.push(Math.max(...i));return o}static calculateMovingMaxForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=i[n];for(let e=n;e<n+o;e++)i[e].isAfter(t)&&(t=i[e]);var r=t.format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class N extends Co{static calculateMovingStdForScoreGivenIndices(o,t){if(0===t.length||0===o.length)return[];var i=[];for(let e=0;e<t.length;e++){var a=t[e];if(0===a.length)i.push(0);else{let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]];var r=t/a.length;let n=0;for(let e=0;e<a.length;e++)n+=Math.pow(o[a[e]]-r,2);i.push(Math.sqrt(n/a.length))}}return i}static calculateMovingStdForScore(t,n){if(n<=0||0===t.length)return[];var o,i=[];let a=0,r=0,s=0;for(let e=0;e<t.length;e++)a+=t[e],r+=t[e]*t[e],e>=n-1&&(o=a/n,o=r/n-o*o,i.push(Math.sqrt(o)),a-=t[s],r-=t[s]*t[s],s++);return i}}class O{static normaliseScores(e,t){const n=t[0],o=t[1];return e.map(e=>(e-n)/(o-n))}}const bo={Conditionals:"Algorithms",Operators:"Algorithms","Synchronization and Messages":"Algorithms","Algorithms Dead Code Penalty":"Algorithms","Algorithms Composite Score":"Algorithms",Comments:"Analysis",Debugging:"Analysis",Naming:"Analysis","Analysis Dead Code Penalty":"Analysis","Analysis Composite Score":"Analysis",Functions:"Decomposition",Sequencing:"Decomposition",Parallelism:"Decomposition","Decomposition Composite Score":"Decomposition","Data Types":"Pattern Recognition and Data Representation","Variables and Data Structures":"Pattern Recognition and Data Representation",Loops:"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Repetition Penalty":"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Composite Score":"Pattern Recognition and Data Representation","Function Reuse":"Generalisation and Abstraction","Functions with Arguments":"Generalisation and Abstraction","Variables Instead of Literals":"Generalisation and Abstraction","Generalisation and Abstraction Composite Score":"Generalisation and Abstraction",Composite:"Composite"};function _(){return{average:[],std:[],n:[],ci:[],leaky:[]}}class Io{constructor(e){this.dates=[],this.conditionalsScores={scores:[]},this.operatorsScores={scores:[]},this.syncAndMessagesScores={scores:[]},this.algorithmsCompoScores={scores:[]},this.algorithmsDeadCodePenaltyScores={scores:[]},this.commentsScores={scores:[]},this.debuggingScores={scores:[]},this.namingScores={scores:[]},this.analysisCompoScores={scores:[]},this.analysisDeadCodePenaltyScores={scores:[]},this.functionsScores={scores:[]},this.sequencingScores={scores:[]},this.parallelismScores={scores:[]},this.decompositionCompoScores={scores:[]},this.dataTypesScores={scores:[]},this.variablesAndDataStructScores={scores:[]},this.loopsScores={scores:[]},this.patternRecAndDataRepPenaltyScores={scores:[]},this.patternRecAndDataRepCompoScores={scores:[]},this.functionReuseScores={scores:[]},this.functionWithArgsScores={scores:[]},this.variablesInsteadOfLiteralsScores={scores:[]},this.generalisationAndAbstrCompoScores={scores:[]},this.compositeScores={scores:[]},this.isSorted=!1,this.data=e,this.init()}init(){var e=Object.keys(this.data);const n=e.map(e=>this.data[e]["Dead Code"]["Dead Scripts Count"]),o=e.map(e=>this.data[e]["Dead Code"]["Total Scripts Count"]),i=e.map(e=>this.data[e].Repetition["Duplicate Scripts Count"]),a=e.map(e=>this.data[e].Repetition["Total Scripts Count"]);this.conditionalsScores.scores=e.map(e=>this.data[e].Algorithms.Conditionals),this.operatorsScores.scores=e.map(e=>this.data[e].Algorithms.Operators),this.syncAndMessagesScores.scores=e.map(e=>this.data[e].Algorithms["Synchronization and Messages"]),this.algorithmsDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.algorithmsCompoScores.scores=e.map((e,t)=>C.calculateAlgorithmsScore({"Synchronization and Messages":this.syncAndMessagesScores.scores[t],Operators:this.operatorsScores.scores[t],Conditionals:this.conditionalsScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.commentsScores.scores=e.map(e=>this.data[e].Analysis.Comments),this.debuggingScores.scores=e.map(e=>this.data[e].Analysis.Debugging),this.namingScores.scores=e.map(e=>this.data[e].Analysis.Naming),this.analysisDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.analysisCompoScores.scores=e.map((e,t)=>C.calculateAnalysisScore({Comments:this.commentsScores.scores[t],Debugging:this.debuggingScores.scores[t],Naming:this.namingScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.functionsScores.scores=e.map(e=>this.data[e].Decomposition.Functions),this.sequencingScores.scores=e.map(e=>this.data[e].Decomposition.Sequencing),this.parallelismScores.scores=e.map(e=>this.data[e].Decomposition.Parallelism),this.decompositionCompoScores.scores=e.map((e,t)=>C.calculateDecompositionScore({Functions:this.functionsScores.scores[t],Sequencing:this.sequencingScores.scores[t],Parallelism:this.parallelismScores.scores[t]})),this.dataTypesScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Data Types"]),this.variablesAndDataStructScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Variables and Data Structures"]),this.loopsScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"].Loops),this.patternRecAndDataRepPenaltyScores.scores=e.map((e,t)=>i[t]/a[t]),this.patternRecAndDataRepCompoScores.scores=e.map((e,t)=>C.calculatePatternRecognitionAndDataRepresentationScore({"Data Types":this.dataTypesScores.scores[t],"Variables and Data Structures":this.variablesAndDataStructScores.scores[t],Loops:this.loopsScores.scores[t]},{"Duplicate Scripts Count":i[t],"Total Scripts Count":a[t]})),this.functionReuseScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Function Reuse"]),this.functionWithArgsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Functions with Arguments"]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Variables Instead of Literals"]),this.generalisationAndAbstrCompoScores.scores=e.map((e,t)=>C.calculateGeneralisationAndAbstractionScore({"Function Reuse":this.functionReuseScores.scores[t],"Functions with Arguments":this.functionWithArgsScores.scores[t],"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores.scores[t]})),this.compositeScores.scores=e.map((e,t)=>jn.calculateCompositeScore({Algorithms:this.algorithmsCompoScores.scores[t],Analysis:this.analysisCompoScores.scores[t],Decomposition:this.decompositionCompoScores.scores[t],"Pattern Recognition and Data Representation":this.patternRecAndDataRepCompoScores.scores[t],"Generalisation and Abstraction":this.generalisationAndAbstrCompoScores.scores[t]})),this.dates=e}categoryNamesMap(){return{Conditionals:this.conditionalsScores,Operators:this.operatorsScores,"Synchronization and Messages":this.syncAndMessagesScores,"Algorithms Dead Code Penalty":this.algorithmsDeadCodePenaltyScores,"Algorithms Composite Score":this.algorithmsCompoScores,Comments:this.commentsScores,Debugging:this.debuggingScores,Naming:this.namingScores,"Analysis Dead Code Penalty":this.analysisDeadCodePenaltyScores,"Analysis Composite Score":this.analysisCompoScores,Functions:this.functionsScores,Sequencing:this.sequencingScores,Parallelism:this.parallelismScores,"Decomposition Composite Score":this.decompositionCompoScores,"Data Types":this.dataTypesScores,"Variables and Data Structures":this.variablesAndDataStructScores,Loops:this.loopsScores,"Pattern Recognition and Data Representation Repetition Penalty":this.patternRecAndDataRepPenaltyScores,"Pattern Recognition and Data Representation Composite Score":this.patternRecAndDataRepCompoScores,"Function Reuse":this.functionReuseScores,"Functions with Arguments":this.functionWithArgsScores,"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores,"Generalisation and Abstraction Composite Score":this.generalisationAndAbstrCompoScores,Composite:this.compositeScores}}sort(){var e;this.isSorted||(e=this.dates.map((e,t)=>t).sort((e,t)=>{e=new Date(this.dates[e]),t=new Date(this.dates[t]);return e.getTime()-t.getTime()}),this.dates=e.map(e=>this.dates[e]),this.conditionalsScores.scores=e.map(e=>this.conditionalsScores.scores[e]),this.operatorsScores.scores=e.map(e=>this.operatorsScores.scores[e]),this.syncAndMessagesScores.scores=e.map(e=>this.syncAndMessagesScores.scores[e]),this.algorithmsDeadCodePenaltyScores.scores=e.map(e=>this.algorithmsDeadCodePenaltyScores.scores[e]),this.algorithmsCompoScores.scores=e.map(e=>this.algorithmsCompoScores.scores[e]),this.commentsScores.scores=e.map(e=>this.commentsScores.scores[e]),this.debuggingScores.scores=e.map(e=>this.debuggingScores.scores[e]),this.namingScores.scores=e.map(e=>this.namingScores.scores[e]),this.analysisDeadCodePenaltyScores.scores=e.map(e=>this.analysisDeadCodePenaltyScores.scores[e]),this.analysisCompoScores.scores=e.map(e=>this.analysisCompoScores.scores[e]),this.functionsScores.scores=e.map(e=>this.functionsScores.scores[e]),this.sequencingScores.scores=e.map(e=>this.sequencingScores.scores[e]),this.parallelismScores.scores=e.map(e=>this.parallelismScores.scores[e]),this.decompositionCompoScores.scores=e.map(e=>this.decompositionCompoScores.scores[e]),this.dataTypesScores.scores=e.map(e=>this.dataTypesScores.scores[e]),this.variablesAndDataStructScores.scores=e.map(e=>this.variablesAndDataStructScores.scores[e]),this.loopsScores.scores=e.map(e=>this.loopsScores.scores[e]),this.patternRecAndDataRepPenaltyScores.scores=e.map(e=>this.patternRecAndDataRepPenaltyScores.scores[e]),this.patternRecAndDataRepCompoScores.scores=e.map(e=>this.patternRecAndDataRepCompoScores.scores[e]),this.functionReuseScores.scores=e.map(e=>this.functionReuseScores.scores[e]),this.functionWithArgsScores.scores=e.map(e=>this.functionWithArgsScores.scores[e]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.variablesInsteadOfLiteralsScores.scores[e]),this.generalisationAndAbstrCompoScores.scores=e.map(e=>this.generalisationAndAbstrCompoScores.scores[e]),this.compositeScores.scores=e.map(e=>this.compositeScores.scores[e]),this.isSorted=!0)}calculateMovingStdBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScore(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScore(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScore(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,e)}calculateMovingStdBasedOnDates(e,t="minutes"){e=N.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScore(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScore(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScore(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=Q.calculateMovingAverageForScore(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDates(e,t="minutes"){e=Q.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e)}calculateMovingConfidenceIntervals(e,t,n="minutes"){let o;o="dataPoints"===t?this.getMovingAverageAndStdBasedOnDataPoints(e):this.getMovingAverageAndStdBasedOnDates(e,n);var i={"Algorithms Composite Score":_(),"Analysis Composite Score":_(),"Decomposition Composite Score":_(),"Pattern Recognition and Data Representation Composite Score":_(),"Generalisation and Abstraction Composite Score":_(),Composite:_(),"Algorithms Dead Code Penalty":_(),"Analysis Dead Code Penalty":_(),"Pattern Recognition and Data Representation Repetition Penalty":_(),Conditionals:_(),Operators:_(),"Synchronization and Messages":_(),Comments:_(),Debugging:_(),Naming:_(),Functions:_(),Sequencing:_(),Parallelism:_(),"Data Types":_(),"Variables and Data Structures":_(),Loops:_(),"Function Reuse":_(),"Functions with Arguments":_(),"Variables Instead of Literals":_()};for(const s of Object.keys(o))if("dates"!==s){var a=o[s];for(let e=0;e<a.average.length;e++){var r=yo.calculateCIGivenMeanAndStd(a.average[e],a.std[e],a.n[e]);a.ci||(a.ci=[]),a.ci.push(yo.boundUpperCI(s,r))}i[s]={average:a.average,std:a.std,n:a.n,ci:a.ci}}this.conditionalsScores={scores:i.Conditionals.average,averages:i.Conditionals.average,stds:i.Conditionals.std,cis:i.Conditionals.ci},this.operatorsScores={scores:i.Operators.average,averages:i.Operators.average,stds:i.Operators.std,cis:i.Operators.ci},this.syncAndMessagesScores={scores:i["Synchronization and Messages"].average,averages:i["Synchronization and Messages"].average,stds:i["Synchronization and Messages"].std,cis:i["Synchronization and Messages"].ci},this.algorithmsDeadCodePenaltyScores={scores:i["Algorithms Dead Code Penalty"].average,averages:i["Algorithms Dead Code Penalty"].average,stds:i["Algorithms Dead Code Penalty"].std,cis:i["Algorithms Dead Code Penalty"].ci},this.algorithmsCompoScores={scores:i["Algorithms Composite Score"].average,averages:i["Algorithms Composite Score"].average,stds:i["Algorithms Composite Score"].std,cis:i["Algorithms Composite Score"].ci},this.commentsScores={scores:i.Comments.average,averages:i.Comments.average,stds:i.Comments.std,cis:i.Comments.ci},this.debuggingScores={scores:i.Debugging.average,averages:i.Debugging.average,stds:i.Debugging.std,cis:i.Debugging.ci},this.namingScores={scores:i.Naming.average,averages:i.Naming.average,stds:i.Naming.std,cis:i.Naming.ci},this.analysisDeadCodePenaltyScores={scores:i["Analysis Dead Code Penalty"].average,averages:i["Analysis Dead Code Penalty"].average,stds:i["Analysis Dead Code Penalty"].std,cis:i["Analysis Dead Code Penalty"].ci},this.analysisCompoScores={scores:i["Analysis Composite Score"].average,averages:i["Analysis Composite Score"].average,stds:i["Analysis Composite Score"].std,cis:i["Analysis Composite Score"].ci},this.functionsScores={scores:i.Functions.average,averages:i.Functions.average,stds:i.Functions.std,cis:i.Functions.ci},this.sequencingScores={scores:i.Sequencing.average,averages:i.Sequencing.average,stds:i.Sequencing.std,cis:i.Sequencing.ci},this.parallelismScores={scores:i.Parallelism.average,averages:i.Parallelism.average,stds:i.Parallelism.std,cis:i.Parallelism.ci},this.decompositionCompoScores={scores:i["Decomposition Composite Score"].average,averages:i["Decomposition Composite Score"].average,stds:i["Decomposition Composite Score"].std,cis:i["Decomposition Composite Score"].ci},this.dataTypesScores={scores:i["Data Types"].average,averages:i["Data Types"].average,stds:i["Data Types"].std,cis:i["Data Types"].ci},this.variablesAndDataStructScores={scores:i["Variables and Data Structures"].average,averages:i["Variables and Data Structures"].average,stds:i["Variables and Data Structures"].std,cis:i["Variables and Data Structures"].ci},this.loopsScores={scores:i.Loops.average,averages:i.Loops.average,stds:i.Loops.std,cis:i.Loops.ci},this.patternRecAndDataRepPenaltyScores={scores:i["Pattern Recognition and Data Representation Repetition Penalty"].average,averages:i["Pattern Recognition and Data Representation Repetition Penalty"].average,stds:i["Pattern Recognition and Data Representation Repetition Penalty"].std,cis:i["Pattern Recognition and Data Representation Repetition Penalty"].ci},this.patternRecAndDataRepCompoScores={scores:i["Pattern Recognition and Data Representation Composite Score"].average,averages:i["Pattern Recognition and Data Representation Composite Score"].average,stds:i["Pattern Recognition and Data Representation Composite Score"].std,cis:i["Pattern Recognition and Data Representation Composite Score"].ci},this.functionReuseScores={scores:i["Function Reuse"].average,averages:i["Function Reuse"].average,stds:i["Function Reuse"].std,cis:i["Function Reuse"].ci},this.functionWithArgsScores={scores:i["Functions with Arguments"].average,averages:i["Functions with Arguments"].average,stds:i["Functions with Arguments"].std,cis:i["Functions with Arguments"].ci},this.variablesInsteadOfLiteralsScores={scores:i["Variables Instead of Literals"].average,averages:i["Variables Instead of Literals"].average,stds:i["Variables Instead of Literals"].std,cis:i["Variables Instead of Literals"].ci},this.generalisationAndAbstrCompoScores={scores:i["Generalisation and Abstraction Composite Score"].average,averages:i["Generalisation and Abstraction Composite Score"].average,stds:i["Generalisation and Abstraction Composite Score"].std,cis:i["Generalisation and Abstraction Composite Score"].ci},this.compositeScores={scores:i.Composite.average,averages:i.Composite.average,stds:i.Composite.std,cis:i.Composite.ci}}normaliseScores(){this.conditionalsScores.scores=O.normaliseScores(this.conditionalsScores.scores,v.Conditionals.range),this.operatorsScores.scores=O.normaliseScores(this.operatorsScores.scores,v.Operators.range),this.syncAndMessagesScores.scores=O.normaliseScores(this.syncAndMessagesScores.scores,v.SynchAndMessages.range),this.algorithmsCompoScores.scores=O.normaliseScores(this.algorithmsCompoScores.scores,v.Algorithms.range),this.commentsScores.scores=O.normaliseScores(this.commentsScores.scores,v.Comments.range),this.debuggingScores.scores=O.normaliseScores(this.debuggingScores.scores,v.Debugging.range),this.namingScores.scores=O.normaliseScores(this.namingScores.scores,v.Naming.range),this.analysisCompoScores.scores=O.normaliseScores(this.analysisCompoScores.scores,v.Analysis.range),this.functionsScores.scores=O.normaliseScores(this.functionsScores.scores,v.Functions.range),this.sequencingScores.scores=O.normaliseScores(this.sequencingScores.scores,v.Sequencing.range),this.parallelismScores.scores=O.normaliseScores(this.parallelismScores.scores,v.Parallelism.range),this.decompositionCompoScores.scores=O.normaliseScores(this.decompositionCompoScores.scores,v.Decomposition.range),this.dataTypesScores.scores=O.normaliseScores(this.dataTypesScores.scores,v.DataTypes.range),this.variablesAndDataStructScores.scores=O.normaliseScores(this.variablesAndDataStructScores.scores,v.VariablesAndDataStructures.range),this.loopsScores.scores=O.normaliseScores(this.loopsScores.scores,v.Loops.range),this.patternRecAndDataRepCompoScores.scores=O.normaliseScores(this.patternRecAndDataRepCompoScores.scores,v.PatternRecognitionAndDataRepresentation.range),this.functionReuseScores.scores=O.normaliseScores(this.functionReuseScores.scores,v.FunctionReUse.range),this.functionWithArgsScores.scores=O.normaliseScores(this.functionWithArgsScores.scores,v.Functions.range),this.variablesInsteadOfLiteralsScores.scores=O.normaliseScores(this.variablesInsteadOfLiteralsScores.scores,v.VariablesInsteadOfLiterals.range),this.generalisationAndAbstrCompoScores.scores=O.normaliseScores(this.generalisationAndAbstrCompoScores.scores,v.GeneralisationAndAbstraction.range)}calculateMovingMaxBasedOnDates(e,t="minutes"){e=Co.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.compositeScores.scores,e)}calculateLeakyIntegrator(e,t,n,o,i,a){var r=D.calculateLeakyIntegratorScores(this.conditionalsScores.scores,e,t,n,o,i,a),r=(this.conditionalsScores.leakyScores=r.leakyIntegratorScores,this.conditionalsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.operatorsScores.scores,e,t,n,o,i,a)),r=(this.operatorsScores.leakyScores=r.leakyIntegratorScores,this.operatorsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.syncAndMessagesScores.scores,e,t,n,o,i,a)),r=(this.syncAndMessagesScores.leakyScores=r.leakyIntegratorScores,this.syncAndMessagesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.algorithmsDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.algorithmsDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsCompoScores.scores,e,t,n,o,i,a)),r=(this.algorithmsCompoScores.leakyScores=r.leakyIntegratorScores,this.algorithmsCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.commentsScores.scores,e,t,n,o,i,a)),r=(this.commentsScores.leakyScores=r.leakyIntegratorScores,this.commentsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.debuggingScores.scores,e,t,n,o,i,a)),r=(this.debuggingScores.leakyScores=r.leakyIntegratorScores,this.debuggingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.namingScores.scores,e,t,n,o,i,a)),r=(this.namingScores.leakyScores=r.leakyIntegratorScores,this.namingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.analysisDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.analysisDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisCompoScores.scores,e,t,n,o,i,a)),r=(this.analysisCompoScores.leakyScores=r.leakyIntegratorScores,this.analysisCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionsScores.scores,e,t,n,o,i,a)),r=(this.functionsScores.leakyScores=r.leakyIntegratorScores,this.functionsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.sequencingScores.scores,e,t,n,o,i,a)),r=(this.sequencingScores.leakyScores=r.leakyIntegratorScores,this.sequencingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.parallelismScores.scores,e,t,n,o,i,a)),r=(this.parallelismScores.leakyScores=r.leakyIntegratorScores,this.parallelismScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.decompositionCompoScores.scores,e,t,n,o,i,a)),r=(this.decompositionCompoScores.leakyScores=r.leakyIntegratorScores,this.decompositionCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.dataTypesScores.scores,e,t,n,o,i,a)),r=(this.dataTypesScores.leakyScores=r.leakyIntegratorScores,this.dataTypesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesAndDataStructScores.scores,e,t,n,o,i,a)),r=(this.variablesAndDataStructScores.leakyScores=r.leakyIntegratorScores,this.variablesAndDataStructScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.loopsScores.scores,e,t,n,o,i,a)),r=(this.loopsScores.leakyScores=r.leakyIntegratorScores,this.loopsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepPenaltyScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepPenaltyScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepPenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepCompoScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepCompoScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionReuseScores.scores,e,t,n,o,i,a)),r=(this.functionReuseScores.leakyScores=r.leakyIntegratorScores,this.functionReuseScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionWithArgsScores.scores,e,t,n,o,i,a)),r=(this.functionWithArgsScores.leakyScores=r.leakyIntegratorScores,this.functionWithArgsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesInsteadOfLiteralsScores.scores,e,t,n,o,i,a)),r=(this.variablesInsteadOfLiteralsScores.leakyScores=r.leakyIntegratorScores,this.variablesInsteadOfLiteralsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.generalisationAndAbstrCompoScores.scores,e,t,n,o,i,a)),r=(this.generalisationAndAbstrCompoScores.leakyScores=r.leakyIntegratorScores,this.generalisationAndAbstrCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.compositeScores.scores,e,t,n,o,i,a));this.compositeScores.leakyScores=r.leakyIntegratorScores,this.compositeScores.cis=r.cis}getMovingAverageAndStdBasedOnDataPoints(t){this.dates=Q.calculateMovingAverageForDates(this.dates,t);var e=this.dates.map(e=>t),n={average:Q.calculateMovingAverageForScore(this.conditionalsScores.scores,t),std:N.calculateMovingStdForScore(this.conditionalsScores.scores,t),n:e},o={average:Q.calculateMovingAverageForScore(this.operatorsScores.scores,t),std:N.calculateMovingStdForScore(this.operatorsScores.scores,t),n:e},i={average:Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,t),std:N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,t),n:e},a={average:Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,t),n:e},r={average:Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,t),n:e},s={average:Q.calculateMovingAverageForScore(this.commentsScores.scores,t),std:N.calculateMovingStdForScore(this.commentsScores.scores,t),n:e},A={average:Q.calculateMovingAverageForScore(this.debuggingScores.scores,t),std:N.calculateMovingStdForScore(this.debuggingScores.scores,t),n:e},l={average:Q.calculateMovingAverageForScore(this.namingScores.scores,t),std:N.calculateMovingStdForScore(this.namingScores.scores,t),n:e},u={average:Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,t),n:e},c={average:Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,t),std:N.calculateMovingStdForScore(this.analysisCompoScores.scores,t),n:e},g={average:Q.calculateMovingAverageForScore(this.functionsScores.scores,t),std:N.calculateMovingStdForScore(this.functionsScores.scores,t),n:e},d={average:Q.calculateMovingAverageForScore(this.sequencingScores.scores,t),std:N.calculateMovingStdForScore(this.sequencingScores.scores,t),n:e},h={average:Q.calculateMovingAverageForScore(this.parallelismScores.scores,t),std:N.calculateMovingStdForScore(this.parallelismScores.scores,t),n:e},p={average:Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,t),std:N.calculateMovingStdForScore(this.decompositionCompoScores.scores,t),n:e},m={average:Q.calculateMovingAverageForScore(this.dataTypesScores.scores,t),std:N.calculateMovingStdForScore(this.dataTypesScores.scores,t),n:e},f={average:Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,t),std:N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,t),n:e},B={average:Q.calculateMovingAverageForScore(this.loopsScores.scores,t),std:N.calculateMovingStdForScore(this.loopsScores.scores,t),n:e},E={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,t),n:e},w={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,t),n:e},y={average:Q.calculateMovingAverageForScore(this.functionReuseScores.scores,t),std:N.calculateMovingStdForScore(this.functionReuseScores.scores,t),n:e},C={average:Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,t),std:N.calculateMovingStdForScore(this.functionWithArgsScores.scores,t),n:e},b={average:Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,t),std:N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,t),n:e},I={average:Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,t),std:N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,t),n:e},e={average:Q.calculateMovingAverageForScore(this.compositeScores.scores,t),std:N.calculateMovingStdForScore(this.compositeScores.scores,t),n:e};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}getMovingAverageAndStdBasedOnDates(e,t="minutes"){var e=Q.calculateWindowIndices(this.dates,e,t),t=e.map(e=>e.length),n=(this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),{average:Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),n:t}),o={average:Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),n:t},i={average:Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),n:t},a={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),n:t},r={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),n:t},s={average:Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),n:t},A={average:Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),n:t},l={average:Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),n:t},u={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),n:t},c={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),n:t},g={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),n:t},d={average:Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),n:t},h={average:Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),n:t},p={average:Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),n:t},m={average:Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),n:t},f={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),n:t},B={average:Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),n:t},E={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),n:t},w={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),n:t},y={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),n:t},C={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),n:t},b={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),n:t},I={average:Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),n:t},e={average:Q.calculateMovingAverageForScoreGivenIndices(this.compositeScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e),n:t};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}calculateCompositeScoreOverTime(){var t=[];for(let e=0;e<this.dates.length;e++){var n=jn.calculateCompositeScore({algorithmsCompoScores:this.algorithmsCompoScores.scores[e],analysisCompoScores:this.analysisCompoScores.scores[e],decompositionCompoScores:this.decompositionCompoScores.scores[e],patternRecAndDataRepCompoScores:this.patternRecAndDataRepCompoScores.scores[e],generalisationAndAbstrCompoScores:this.generalisationAndAbstrCompoScores.scores[e]});t.push(n)}this.compositeScores.scores=t}calculateAverageGivenTimeWindow(e,t,n="minutes"){this.isSorted||this.sort();e=class{static calculateWindowIndicesFromLastTimestamp(t,n,o="minutes"){var i=t.map(e=>I(e)),a=[],t=i.length-1,r=i[t],s=a.length;for(let e=t;0<=e;e--)r.diff(i[e],o)<=n?(a[s]||(a[s]=[]),a[s].push(e)):e;return a}}.calculateWindowIndicesFromLastTimestamp(this.dates,e,n),t=k.calculateWeightsGivenIndicesAndDates(e,this.dates,t,n);this.conditionalsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.conditionalsScores.scores,e,t),this.operatorsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.operatorsScores.scores,e,t),this.syncAndMessagesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.syncAndMessagesScores.scores,e,t),this.algorithmsDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsDeadCodePenaltyScores.scores,e,t),this.algorithmsCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsCompoScores.scores,e,t),this.commentsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.commentsScores.scores,e,t),this.debuggingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.debuggingScores.scores,e,t),this.namingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.namingScores.scores,e,t),this.analysisDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisDeadCodePenaltyScores.scores,e,t),this.analysisCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisCompoScores.scores,e,t),this.functionsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionsScores.scores,e,t),this.sequencingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.sequencingScores.scores,e,t),this.parallelismScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.parallelismScores.scores,e,t),this.decompositionCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.decompositionCompoScores.scores,e,t),this.dataTypesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.dataTypesScores.scores,e,t),this.variablesAndDataStructScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesAndDataStructScores.scores,e,t),this.loopsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.loopsScores.scores,e,t),this.patternRecAndDataRepPenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepPenaltyScores.scores,e,t),this.patternRecAndDataRepCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepCompoScores.scores,e,t),this.functionReuseScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionReuseScores.scores,e,t),this.functionWithArgsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionWithArgsScores.scores,e,t),this.variablesInsteadOfLiteralsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesInsteadOfLiteralsScores.scores,e,t),this.generalisationAndAbstrCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.generalisationAndAbstrCompoScores.scores,e,t),this.compositeScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.compositeScores.scores,e,t)}exportToLineGraphData(t,e){var n=[];if("scores"===e)for(let e=0;e<t.length;e++){const r=t[e],s=bo[r];n.push({x:this.dates,y:this.categoryNamesMap()[r].scores,name:vo(r,20),legendgroup:s,hoverinfo:"text",text:this.categoryNamesMap()[r].scores.map((e,t)=>`${s}<br>${r}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"})}else{if("ci"!==e)return[];for(let e=0;e<t.length;e++){const A=t[e],l=bo[A];var o=this.categoryNamesMap()[A],i=null==(i=o.cis)?void 0:i.map(e=>e[0]),a=null==(a=o.cis)?void 0:a.map(e=>e[1]);n.push({x:this.dates,y:o.scores,name:vo(A,20),legendgroup:l,hoverinfo:"text",text:o.scores.map((e,t)=>`${l}<br>${A}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),n.push({x:this.dates,y:a,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),n.push({x:this.dates,y:i,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}}return n}exportToSpiderGraphData(t,e,n=!1){var o={};if("scores"!==e)return[];if(n)for(let e=0;e<t.length;e++){var i=t[e],a=bo[i];o[a]||(o[a]={type:"scatterpolar",r:[],theta:[],fill:"",name:a}),o[a].r.push(this.categoryNamesMap()[i].scores[0]),o[a].theta.push(i)}else o.Average={type:"scatterpolar",r:t.map(e=>this.categoryNamesMap()[e].scores[0]),theta:t.map(e=>bo[e]),fill:"toself",name:"Average"};return Object.values(o)}exportToHeatMapData(t,e){var n=[];if("scores"!==e)return[];var o=[];for(let e=0;e<t.length;e++){var i=t[e];o.push(this.categoryNamesMap()[i].scores)}return n.push({x:this.dates,y:t,z:o,type:"heatmap",colorscale:"BuGn"}),n}exportToLeakyIntegratorData(n){var o=[];for(let t=0;t<n.length;t++){const s=n[t],A=bo[s];var i=this.categoryNamesMap()[s];let e=!1;i.cis&&0<i.cis.length&&(e=!0);var a=null==(a=i.cis)?void 0:a.map(e=>e[0]),r=null==(r=i.cis)?void 0:r.map(e=>e[1]);o.push({x:this.dates.map((e,t)=>t),y:i.scores,name:vo(s,20),type:"bar"}),o.push({x:this.dates.map((e,t)=>t),y:i.leakyScores,name:vo("Leaky "+s,20),legendgroup:A,hoverinfo:"text",text:null==(i=i.leakyScores)?void 0:i.map((e,t)=>`${A}<br>${s}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),e&&o.push({x:this.dates.map((e,t)=>t),y:r,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),e&&o.push({x:this.dates.map((e,t)=>t),y:a,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}return o}}function vo(e,t){return e.length>t?e.substr(0,t-1)+"...":e}class Mo{constructor(e){this.data=new Io(e)}sortData(){return this.data.sort(),this}normaliseScores(){return this.data.normaliseScores(),this}calculateMovingAverageBasedOnDataPoints(e){return this.data.calculateMovingAverageBasedOnDataPoints(e),this}calculateMovingAverageBasedOnDates(e,t="minutes"){return this.data.calculateMovingAverageBasedOnDates(e,t),this}calculateMovingStdBasedOnDataPoints(e){return this.data.calculateMovingStdBasedOnDataPoints(e),this}calculateMovingStdBasedOnDates(e,t="minutes"){return this.data.calculateMovingStdBasedOnDates(e,t),this}calculateCompositeScoreOverTime(){return this.data.calculateCompositeScoreOverTime(),this}calculateAverageGivenTimeWindow(e,t="automatic",n="minutes"){return this.data.calculateAverageGivenTimeWindow(e,t,n),this}calculateMovingConfidenceIntervals(e,t="dataPoints",n="minutes"){return this.data.calculateMovingConfidenceIntervals(e,t,n),this}calculateMovingMaxBasedOnDates(e,t="minutes"){return this.data.calculateMovingMaxBasedOnDates(e,t),this}calculateLeakyIntegrator(e,t,n,o,i,a){return this.data.calculateLeakyIntegrator(e,t,n,o,i,a),this}exportToLineGraphData(e=[],t="scores"){return this.data.exportToLineGraphData(e,t)}exportToSpiderGraphData(e=[],t="scores",n=!1){return this.data.exportToSpiderGraphData(e,t,n)}exportToHeatMapData(e=[],t="scores"){return this.data.exportToHeatMapData(e,t)}exportToLeakyIntegratorData(e=[]){return this.data.exportToLeakyIntegratorData(e)}}class To{static compareStars(i){const a={},r=To.previousStars;return r?(Object.keys(i).forEach(e=>{const n=r[e]?r[e][1]:[];var t=i[e][1];const o=i[e][0];a[e]=t.map((e,t)=>1===e&&1!==n[t]&&o[t])}),To.previousStars=i):(To.previousStars=i,Object.keys(i).forEach(e=>{var t=i[e][1];const n=i[e][0];a[e]=t.map((e,t)=>1===e&&n[t])})),a}}To.previousStars=null;var So=To;R.default=t},function(F,e,t){"use strict";function n(e,t){return e.parent===t.parent?1:2}function c(e,t){return e+t.x}function g(e,t){return Math.max(e,t.y)}t.r(e),t.d(e,"cluster",function(){return o}),t.d(e,"hierarchy",function(){return a}),t.d(e,"pack",function(){return P}),t.d(e,"packSiblings",function(){return L}),t.d(e,"packEnclose",function(){return p}),t.d(e,"partition",function(){return H}),t.d(e,"stratify",function(){return W}),t.d(e,"tree",function(){return K}),t.d(e,"treemap",function(){return X}),t.d(e,"treemapBinary",function(){return q}),t.d(e,"treemapDice",function(){return S}),t.d(e,"treemapSlice",function(){return N}),t.d(e,"treemapSliceDice",function(){return Z}),t.d(e,"treemapSquarify",function(){return _}),t.d(e,"treemapResquarify",function(){return $});var o=function(){var s=n,A=1,l=1,u=!1;function t(t){var o,i=0,e=(t.eachAfter(function(e){var t,n=e.children;n?(e.x=(t=n).reduce(c,0)/t.length,e.y=1+n.reduce(g,0)):(e.x=o?i+=s(e,o):0,e.y=0,o=e)}),function(e){for(var t;t=e.children;)e=t[0];return e}(t)),n=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(t),a=e.x-s(e,n)/2,r=n.x+s(n,e)/2;return t.eachAfter(u?function(e){e.x=(e.x-t.x)*A,e.y=(t.y-e.y)*l}:function(e){e.x=(e.x-a)/(r-a)*A,e.y=(1-(t.y?e.y/t.y:1))*l})}return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=!1,A=+e[0],l=+e[1],t):u?null:[A,l]},t.nodeSize=function(e){return arguments.length?(u=!0,A=+e[0],l=+e[1],t):u?[A,l]:null},t};function i(e){var t=0,n=e.children,o=n&&n.length;if(o)for(;0<=--o;)t+=n[o].value;else t=1;e.value=t}function a(e,t){var n,o,i,a,r,s=new h(e),A=+e.value&&(s.value=e.value),l=[s];for(null==t&&(t=R);n=l.pop();)if(A&&(n.value=+n.data.value),(i=t(n.data))&&(r=i.length))for(n.children=new Array(r),a=r-1;0<=a;--a)l.push(o=n.children[a]=new h(i[a])),o.parent=n,o.depth=n.depth+1;return s.eachBefore(d)}function R(e){return e.children}function Y(e){e.data=e.data.data}function d(e){for(var t=0;e.height=t,(e=e.parent)&&e.height<++t;);}function h(e){this.data=e,this.depth=this.height=0,this.parent=null}h.prototype=a.prototype={constructor:h,count:function(){return this.eachAfter(i)},each:function(e){var t,n,o,i,a,r=[this];do{for(n=r.reverse(),r=[];t=n.pop();)if(e(t),o=t.children)for(i=0,a=o.length;i<a;++i)r.push(o[i])}while(r.length);return this},eachAfter:function(e){for(var t,n,o,i=this,a=[i],r=[];i=a.pop();)if(r.push(i),t=i.children)for(n=0,o=t.length;n<o;++n)a.push(t[n]);for(;i=r.pop();)e(i);return this},eachBefore:function(e){for(var t,n,o,i=[this];t=i.pop();)if(e(t),n=t.children)for(o=n.length-1;0<=o;--o)i.push(n[o]);return this},sum:function(i){return this.eachAfter(function(e){for(var t=+i(e.data)||0,n=e.children,o=n&&n.length;0<=--o;)t+=n[o].value;e.value=t})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),o=t.ancestors(),i=null;e=n.pop(),t=o.pop();for(;e===t;)i=e,e=n.pop(),t=o.pop();return i}(t,e),o=[t];t!==n;)t=t.parent,o.push(t);for(var i=o.length;e!==n;)o.splice(i,0,e),e=e.parent;return o},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return a(this).eachBefore(Y)}};var U=Array.prototype.slice;var p=function(e){for(var t,n,o=0,i=(e=function(e){for(var t,n,o=e.length;o;)n=Math.random()*o--|0,t=e[o],e[o]=e[n],e[n]=t;return e}(U.call(e))).length,a=[];o<i;)t=e[o],n&&s(n,t)?++o:(n=function(e){switch(e.length){case 1:return function(e){return{x:e.x,y:e.y,r:e.r}}(e[0]);case 2:return l(e[0],e[1]);case 3:return u(e[0],e[1],e[2])}}(a=function(e,t){var n,o;if(A(t,e))return[t];for(n=0;n<e.length;++n)if(r(t,e[n])&&A(l(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(o=n+1;o<e.length;++o)if(r(l(e[n],e[o]),t)&&r(l(e[n],t),e[o])&&r(l(e[o],t),e[n])&&A(u(e[n],e[o],t),e))return[e[n],e[o],t];throw new Error}(a,t)),o=0);return n};function r(e,t){var n=e.r-t.r,o=t.x-e.x,t=t.y-e.y;return n<0||n*n<o*o+t*t}function s(e,t){var n=e.r-t.r+1e-6,o=t.x-e.x,t=t.y-e.y;return 0<n&&o*o+t*t<n*n}function A(e,t){for(var n=0;n<t.length;++n)if(!s(e,t[n]))return;return 1}function l(e,t){var n=e.x,o=e.y,e=e.r,i=t.x,a=t.y,t=t.r,r=i-n,s=a-o,A=t-e,l=Math.sqrt(r*r+s*s);return{x:(n+i+r/l*A)/2,y:(o+a+s/l*A)/2,r:(l+e+t)/2}}function u(e,t,n){var o=e.x,i=e.y,e=e.r,a=t.x,r=t.y,t=t.r,s=n.x,A=n.y,n=n.r,l=o-a,u=o-s,c=i-r,g=i-A,d=t-e,h=n-e,p=o*o+i*i-e*e,a=p-a*a-r*r+t*t,r=p-s*s-A*A+n*n,t=u*c-l*g,p=(c*r-g*a)/(2*t)-o,s=(g*d-c*h)/t,A=(u*a-l*r)/(2*t)-i,n=(l*h-u*d)/t,g=s*s+n*n-1,c=2*(e+p*s+A*n),a=p*p+A*A-e*e,r=-(g?(c+Math.sqrt(c*c-4*g*a))/(2*g):a/c);return{x:o+p+s*r,y:i+A+n*r,r:r}}function m(e,t,n){var o,i,a,r,s=e.x-t.x,A=e.y-t.y,l=s*s+A*A;l?(i=t.r+n.r,r=e.r+n.r,(r*=r)<(i*=i)?(o=(l+r-i)/(2*l),a=Math.sqrt(Math.max(0,r/l-o*o)),n.x=e.x-o*s-a*A,n.y=e.y-o*A+a*s):(o=(l+i-r)/(2*l),a=Math.sqrt(Math.max(0,i/l-o*o)),n.x=t.x+o*s-a*A,n.y=t.y+o*A+a*s)):(n.x=t.x+n.r,n.y=t.y)}function f(e,t){var n=e.r+t.r-1e-6,o=t.x-e.x,t=t.y-e.y;return 0<n&&o*o+t*t<n*n}function B(e){var t=e._,e=e.next._,n=t.r+e.r,o=(t.x*e.r+e.x*t.r)/n,e=(t.y*e.r+e.y*t.r)/n;return o*o+e*e}function E(e){this._=e,this.next=null,this.previous=null}function w(e){if(!(o=e.length))return 0;var t,n,o,i,a,r,s,A,l,u,c=e[0];if(c.x=0,c.y=0,!(1<o))return c.r;if(t=e[1],c.x=-t.r,t.x=c.r,t.y=0,!(2<o))return c.r+t.r;m(t,c,n=e[2]),c=new E(c),t=new E(t),n=new E(n),((c.next=n.previous=t).next=c.previous=n).next=t.previous=c;e:for(r=3;r<o;++r){m(c._,t._,n=e[r]),n=new E(n),s=t.next,A=c.previous,l=t._.r,u=c._.r;do{if(l<=u){if(f(s._,n._)){t=s,(c.next=t).previous=c,--r;continue e}l+=s._.r,s=s.next}else{if(f(A._,n._)){((c=A).next=t).previous=c,--r;continue e}u+=A._.r,A=A.previous}}while(s!==A.next);for(n.previous=c,n.next=t,c.next=t.previous=t=n,i=B(c);(n=n.next)!==t;)(a=B(n))<i&&(c=n,i=a);t=c.next}for(c=[t._],n=t;(n=n.next)!==t;)c.push(n._);for(n=p(c),r=0;r<o;++r)(c=e[r]).x-=n.x,c.y-=n.y;return n.r}var L=function(e){return w(e),e};function y(e){if("function"!=typeof e)throw new Error;return e}function C(){return 0}function b(e){return function(){return e}}function G(e){return Math.sqrt(e.value)}var P=function(){var t=null,n=1,o=1,i=C;function a(e){return e.x=n/2,e.y=o/2,t?e.eachBefore(I(t)).eachAfter(v(i,.5)).eachBefore(M(1)):e.eachBefore(I(G)).eachAfter(v(C,1)).eachAfter(v(i,e.r/Math.min(n,o))).eachBefore(M(Math.min(n,o)/(2*e.r))),e}return a.radius=function(e){return arguments.length?(t=null==(e=e)?null:y(e),a):t},a.size=function(e){return arguments.length?(n=+e[0],o=+e[1],a):[n,o]},a.padding=function(e){return arguments.length?(i="function"==typeof e?e:b(+e),a):i},a};function I(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function v(r,s){return function(e){if(t=e.children){var t,n,o,i=t.length,a=r(e)*s||0;if(a)for(n=0;n<i;++n)t[n].r+=a;if(o=w(t),a)for(n=0;n<i;++n)t[n].r-=a;e.r=o+a}}}function M(n){return function(e){var t=e.parent;e.r*=n,t&&(e.x=t.x+n*e.x,e.y=t.y+n*e.y)}}function T(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var S=function(e,t,n,o,i){for(var a,r=e.children,s=-1,A=r.length,l=e.value&&(o-t)/e.value;++s<A;)(a=r[s]).y0=n,a.y1=i,a.x0=t,a.x1=t+=a.value*l},H=function(){var n=1,o=1,s=0,i=!1;function t(e){var a,r,t=e.height+1;return e.x0=e.y0=s,e.x1=n,e.y1=o/t,e.eachBefore((a=o,r=t,function(e){e.children&&S(e,e.x0,a*(e.depth+1)/r,e.x1,a*(e.depth+2)/r);var t=e.x0,n=e.y0,o=e.x1-s,i=e.y1-s;o<t&&(t=o=(t+o)/2),i<n&&(n=i=(n+i)/2),e.x0=t,e.y0=n,e.x1=o,e.y1=i})),i&&e.eachBefore(T),e}return t.round=function(e){return arguments.length?(i=!!e,t):i},t.size=function(e){return arguments.length?(n=+e[0],o=+e[1],t):[n,o]},t.padding=function(e){return arguments.length?(s=+e,t):s},t},j={depth:-1},k={};function z(e){return e.id}function J(e){return e.parentId}var W=function(){var u=z,c=J;function t(e){for(var t,n,o,i,a,r=e.length,s=new Array(r),A={},l=0;l<r;++l)a=e[l],o=s[l]=new h(a),null!=(i=u(a,l,e))&&(i+="")&&(A[a="$"+(o.id=i)]=a in A?k:o);for(l=0;l<r;++l)if(o=s[l],null!=(i=c(e[l],l,e))&&(i+="")){if(!(n=A["$"+i]))throw new Error("missing: "+i);if(n===k)throw new Error("ambiguous: "+i);n.children?n.children.push(o):n.children=[o],o.parent=n}else{if(t)throw new Error("multiple roots");t=o}if(!t)throw new Error("no root");if(t.parent=j,t.eachBefore(function(e){e.depth=e.parent.depth+1,--r}).eachBefore(d),t.parent=null,0<r)throw new Error("cycle");return t}return t.id=function(e){return arguments.length?(u=y(e),t):u},t.parentId=function(e){return arguments.length?(c=y(e),t):c},t};function V(e,t){return e.parent===t.parent?1:2}function D(e){var t=e.children;return t?t[0]:e.t}function Q(e){var t=e.children;return t?t[t.length-1]:e.t}function x(e,t){this._=e,this.parent=null,this.children=null,this.A=null,(this.a=this).z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}x.prototype=Object.create(h.prototype);var K=function(){var g=V,A=1,l=1,u=null;function t(e){var t,n,o,i,a,r,s=function(e){for(var t,n,o,i,a,r=[e=new x(e,0)];t=r.pop();)if(o=t._.children)for(t.children=new Array(a=o.length),i=a-1;0<=i;--i)r.push(n=t.children[i]=new x(o[i],i)),n.parent=t;return(e.parent=new x(null,0)).children=[e],e}(e);return s.eachAfter(c),s.parent.m=-s.z,s.eachBefore(d),u?e.eachBefore(h):((o=n=t=e).eachBefore(function(e){e.x<t.x&&(t=e),e.x>n.x&&(n=e),e.depth>o.depth&&(o=e)}),s=t===n?1:g(t,n)/2,i=s-t.x,a=A/(n.x+s+i),r=l/(o.depth||1),e.eachBefore(function(e){e.x=(e.x+i)*a,e.y=e.depth*r})),e}function c(e){var t=e.children,n=e.parent.children,o=e.i?n[e.i-1]:null;if(t){for(var i,a=0,r=0,s=e.children,A=s.length;0<=--A;)(i=s[A]).z+=a,i.m+=a,a+=i.s+(r+=i.c);t=(t[0].z+t[t.length-1].z)/2;o?(e.z=o.z+g(e._,o._),e.m=e.z-t):e.z=t}else o&&(e.z=o.z+g(e._,o._));e.parent.A=function(e,t,n){if(t){for(var o,i=e,a=e,r=t,s=i.parent.children[0],A=i.m,l=a.m,u=r.m,c=s.m;r=Q(r),i=D(i),r&&i;)s=D(s),(a=Q(a)).a=e,0<(o=r.z+u-i.z-A+g(r._,i._))&&(function(e,t,n){var o=n/(t.i-e.i);t.c-=o,t.s+=n,e.c+=o,t.z+=n,t.m+=n}(function(e,t,n){return e.a.parent===t.parent?e.a:n}(r,e,n),e,o),A+=o,l+=o),u+=r.m,A+=i.m,c+=s.m,l+=a.m;r&&!Q(a)&&(a.t=r,a.m+=u-l),i&&!D(s)&&(s.t=i,s.m+=A-c,n=e)}return n}(e,o,e.parent.A||n[0])}function d(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function h(e){e.x*=A,e.y=e.depth*l}return t.separation=function(e){return arguments.length?(g=e,t):g},t.size=function(e){return arguments.length?(u=!1,A=+e[0],l=+e[1],t):u?null:[A,l]},t.nodeSize=function(e){return arguments.length?(u=!0,A=+e[0],l=+e[1],t):u?[A,l]:null},t},N=function(e,t,n,o,i){for(var a,r=e.children,s=-1,A=r.length,l=e.value&&(i-n)/e.value;++s<A;)(a=r[s]).x0=t,a.x1=o,a.y0=n,a.y1=n+=a.value*l},t=(1+Math.sqrt(5))/2;function O(e,t,n,o,i,a){for(var r,s,A,l,u,c,g,d,h,p,m,f=[],B=t.children,E=0,w=0,y=B.length,C=t.value;E<y;){for(A=i-n,l=a-o;!(u=B[w++].value)&&w<y;);for(m=(c=g=u)*u*(p=Math.max(l/A,A/l)/(C*e)),h=Math.max(g/m,m/c);w<y;++w){if(u+=s=B[w].value,s<c&&(c=s),g<s&&(g=s),m=u*u*p,h<(d=Math.max(g/m,m/c))){u-=s;break}h=d}f.push(r={value:u,dice:A<l,children:B.slice(E,w)}),r.dice?S(r,n,o,i,C?o+=l*u/C:a):N(r,n,o,C?n+=A*u/C:i,a),C-=u,E=w}return f}var _=function t(a){function e(e,t,n,o,i){O(a,e,t,n,o,i)}return e.ratio=function(e){return t(1<(e=+e)?e:1)},e}(t),X=function(){var r=_,t=!1,n=1,o=1,s=[0],A=C,l=C,u=C,c=C,g=C;function i(e){return e.x0=e.y0=0,e.x1=n,e.y1=o,e.eachBefore(a),s=[0],t&&e.eachBefore(T),e}function a(e){var t=s[e.depth],n=e.x0+t,o=e.y0+t,i=e.x1-t,a=e.y1-t;i<n&&(n=i=(n+i)/2),a<o&&(o=a=(o+a)/2),e.x0=n,e.y0=o,e.x1=i,e.y1=a,e.children&&(t=s[e.depth+1]=A(e)/2,n+=g(e)-t,o+=l(e)-t,(i-=u(e)-t)<n&&(n=i=(n+i)/2),(a-=c(e)-t)<o&&(o=a=(o+a)/2),r(e,n,o,i,a))}return i.round=function(e){return arguments.length?(t=!!e,i):t},i.size=function(e){return arguments.length?(n=+e[0],o=+e[1],i):[n,o]},i.tile=function(e){return arguments.length?(r=y(e),i):r},i.padding=function(e){return arguments.length?i.paddingInner(e).paddingOuter(e):i.paddingInner()},i.paddingInner=function(e){return arguments.length?(A="function"==typeof e?e:b(+e),i):A},i.paddingOuter=function(e){return arguments.length?i.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):i.paddingTop()},i.paddingTop=function(e){return arguments.length?(l="function"==typeof e?e:b(+e),i):l},i.paddingRight=function(e){return arguments.length?(u="function"==typeof e?e:b(+e),i):u},i.paddingBottom=function(e){return arguments.length?(c="function"==typeof e?e:b(+e),i):c},i.paddingLeft=function(e){return arguments.length?(g="function"==typeof e?e:b(+e),i):g},i},q=function(e,t,n,o,i){var a,r,p=e.children,s=p.length,m=new Array(s+1);for(m[0]=r=a=0;a<s;++a)m[a+1]=r+=p[a].value;!function e(t,n,o,i,a,r,s){if(n-1<=t)return(A=p[t]).x0=i,A.y0=a,A.x1=r,void(A.y1=s);var A=m[t],l=o/2+A,u=t+1,c=n-1;for(;u<c;){var g=u+c>>>1;m[g]<l?u=1+g:c=g}l-m[u-1]<m[u]-l&&t+1<u&&--u;var A=m[u]-A,d=o-A;{var h;s-a<r-i?(e(t,u,A,i,a,h=(i*d+r*A)/o,s),e(u,n,d,h,a,r,s)):(e(t,u,A,i,a,r,h=(a*d+s*A)/o),e(u,n,d,i,h,r,s))}}(0,s,e.value,t,n,o,i)},Z=function(e,t,n,o,i){(1&e.depth?N:S)(e,t,n,o,i)},$=function t(d){function e(e,t,n,o,i){if((a=e._squarify)&&a.ratio===d)for(var a,r,s,A,l,u=-1,c=a.length,g=e.value;++u<c;){for(s=(r=a[u]).children,A=r.value=0,l=s.length;A<l;++A)r.value+=s[A].value;r.dice?S(r,t,n,o,n+=(i-n)*r.value/g):N(r,t,n,t+=(o-t)*r.value/g,i),g-=r.value}else e._squarify=a=O(d,e,t,n,o,i),a.ratio=d}return e.ratio=function(e){return t(1<(e=+e)?e:1)},e}(t)},function(e,t,n){n=n(1656);e.exports={TextEncoder:n.TextEncoder,TextDecoder:n.TextDecoder}},function(e,t,n){"use strict";var f=n(51),r=n(545),B=n(3),E=n(379),o=n(573);t.a=function(i){var p=Object(B.g)(i),a=6*B.r,c=0<p,g=Object(B.a)(p)>B.i;function d(e,t){return Object(B.g)(e)*Object(B.g)(t)>p}function h(e,t,n){var o,i,a,r,s,A,l,u=Object(f.a)(e),c=Object(f.a)(t),g=[1,0,0],u=Object(f.c)(u,c),c=Object(f.d)(u,u),d=u[0],h=c-d*d;return h?(c=p*c/h,d=-p*d/h,h=Object(f.c)(g,u),g=Object(f.f)(g,c),c=Object(f.f)(u,d),Object(f.b)(g,c),u=h,(h=(d=Object(f.d)(g,u))*d-(c=Object(f.d)(u,u))*(Object(f.d)(g,g)-1))<0?void 0:(h=Object(B.u)(h),o=Object(f.f)(u,(-d-h)/c),Object(f.b)(o,g),o=Object(f.g)(o),n?(i=e[0],a=t[0],r=e[1],t=t[1],a<i&&(l=i,i=a,a=l),s=a-i,!(A=Object(B.a)(s-B.o)<B.i)&&t<r&&(l=r,r=t,t=l),(A||s<B.i?A?0<r+t^o[1]<(Object(B.a)(o[0]-i)<B.i?r:t):r<=o[1]&&o[1]<=t:s>B.o^(i<=o[0]&&o[0]<=a))?(l=Object(f.f)(u,(-d+h)/c),Object(f.b)(l,g),[o,Object(f.g)(l)]):void 0):o)):!n&&e}function m(e,t){var n=c?i:B.o-i,o=0;return e<-n?o|=1:n<e&&(o|=2),t<-n?o|=4:n<t&&(o|=8),o}return Object(o.a)(d,function(a){var r,s,A,l,u;return{lineStart:function(){l=A=!1,u=1},point:function(e,t){var n,o=[e,t],i=d(e,t),e=c?i?0:m(e,t):i?m(e+(e<0?B.o:-B.o),t):0;!r&&(l=A=i)&&a.lineStart(),i===A||(n=h(r,o))&&!Object(E.a)(r,n)&&!Object(E.a)(o,n)||(o[2]=1),i!==A?(u=0,i?(a.lineStart(),n=h(o,r),a.point(n[0],n[1])):(n=h(r,o),a.point(n[0],n[1],2),a.lineEnd()),r=n):g&&r&&c^i&&(e&s||!(t=h(o,r,!0))||(u=0,c?(a.lineStart(),a.point(t[0][0],t[0][1]),a.point(t[1][0],t[1][1]),a.lineEnd()):(a.point(t[1][0],t[1][1]),a.lineEnd(),a.lineStart(),a.point(t[0][0],t[0][1],3)))),!i||r&&Object(E.a)(r,o)||a.point(o[0],o[1]),r=o,A=i,s=e},lineEnd:function(){A&&a.lineEnd(),r=null},clean:function(){return u|(l&&A)<<1}}},function(e,t,n,o){Object(r.a)(o,i,a,n,e,t)},c?[0,-i]:[-B.o,i-B.o])}},function(e,t,n){"use strict";n.d(t,"a",function(){return d});function l(e){return function(){return e}}var c=n(51),g=n(3),u=n(278);function d(e,t,n,o,i,a){if(n){var r=Object(g.g)(t),s=Object(g.t)(t),A=o*n;null==i?(i=t+o*g.w,a=t-A/2):(i=h(r,i),a=h(r,a),(0<o?i<a:a<i)&&(i+=o*g.w));for(var l,u=i;0<o?a<u:u<a;u-=A)l=Object(c.g)([r,-s*Object(g.g)(u),-s*Object(g.t)(u)]),e.point(l[0],l[1])}}function h(e,t){(t=Object(c.a)(t))[0]-=e,Object(c.e)(t);e=Object(g.b)(-t[1]);return((-t[2]<0?-e:e)+g.w-g.i)%g.w}t.b=function(){var o,i,a=l([0,0]),r=l(90),s=l(6),A={point:function(e,t){o.push(e=i(e,t)),e[0]*=g.h,e[1]*=g.h}};function t(){var e=a.apply(this,arguments),t=r.apply(this,arguments)*g.r,n=s.apply(this,arguments)*g.r;return o=[],i=Object(u.b)(-e[0]*g.r,-e[1]*g.r,0).invert,d(A,t,n,1),e={type:"Polygon",coordinates:[o]},o=i=null,e}return t.center=function(e){return arguments.length?(a="function"==typeof e?e:l([+e[0],+e[1]]),t):a},t.radius=function(e){return arguments.length?(r="function"==typeof e?e:l(+e),t):r},t.precision=function(e){return arguments.length?(s="function"==typeof e?e:l(+e),t):s},t}},function(e,t,n){"use strict";var o=n(2),n=n(9);t.a=Object(n.b)(function(e){return{key:e.locales.locale,locale:e.locales.locale,messages:e.locales.messages}})(o.b)},function(e,t,n){e.exports=n.p+"static/assets/6be143c7cb9d23c787f7f20674a76f72.svg"},function(e,t,n){e.exports=n.p+"static/assets/3286e2838658ebdb82f62d062b14e951.svg"},function(e,t,n){e.exports=n.p+"static/assets/0f9efe3bd6e80747dfa3aeb9e19997b5.svg"},function(e,t,n){e.exports=n.p+"static/assets/3d9e2585d6ed12b9fb994438e0c4c42a.svg"},function(e,t,n){e.exports=n.p+"static/assets/7b6399d516d5921bb199f57cdd8bbbbe.svg"},function(e,t,n){"use strict";var o=n(23),f=n.n(o);function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,a=[],r=!0,s=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);r=!0);}catch(e){s=!0,i=e}finally{try{r||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||E(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){var n;if(e)return"string"==typeof e?i(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function w(e){return e.replace(/[<>&'"]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}})}var y=n(2942),C='<sep gap="36"/>',b='<sep gap="36"/>';t.a=function(e){function t(t){var e=l.findIndex(function(e){return e.id===t});if(0<=e)return B(l.splice(e,1),1)[0].xml}var n,o,i,a,r,s=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],A=2<arguments.length?arguments[2]:void 0,l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[],u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"",c=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"",g=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"",s=e||s,d=[C],u=w(u),c=w(c),g=w(g),l=l.slice(),h=['<xml style="display: none">',t("motion")||(n=s,i=A,o=f.a.ScratchMsgs.translate("MOTION_STAGE_SELECTED","Stage selected: no motion blocks"),'\n <category name="%{BKY_CATEGORY_MOTION}" id="motion" colour="#4C97FF" secondaryColour="#3373CC">\n '.concat(n?'\n <label text="'.concat(o,'"></label>\n '):y.MartyBlocksToolbox_motion()+"\n\n ".concat(b,'\n\n <block type="motion_movesteps">\n <value name="STEPS">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_turnright">\n <value name="DEGREES">\n <shadow type="math_number">\n <field name="NUM">15</field>\n </shadow>\n </value>\n </block>\n <block type="motion_turnleft">\n <value name="DEGREES">\n <shadow type="math_number">\n <field name="NUM">15</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_goto">\n <value name="TO">\n <shadow type="motion_goto_menu">\n </shadow>\n </value>\n </block>\n <block type="motion_gotoxy">\n <value name="X">\n <shadow id="movex" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n <value name="Y">\n <shadow id="movey" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="motion_glideto" id="motion_glideto">\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="TO">\n <shadow type="motion_glideto_menu">\n </shadow>\n </value>\n </block>\n <block type="motion_glidesecstoxy">\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="X">\n <shadow id="glidex" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n <value name="Y">\n <shadow id="glidey" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_pointindirection">\n <value name="DIRECTION">\n <shadow type="math_angle">\n <field name="NUM">90</field>\n </shadow>\n </value>\n </block>\n <block type="motion_pointtowards">\n <value name="TOWARDS">\n <shadow type="motion_pointtowards_menu">\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_changexby">\n <value name="DX">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_setx">\n <value name="X">\n <shadow id="setx" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="motion_changeyby">\n <value name="DY">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_sety">\n <value name="Y">\n <shadow id="sety" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_ifonedgebounce"/>\n ').concat(b,'\n <block type="motion_setrotationstyle"/>\n ').concat(b,'\n <block id="').concat(i,'_xposition" type="motion_xposition"/>\n <block id="').concat(i,'_yposition" type="motion_yposition"/>\n <block id="').concat(i,'_direction" type="motion_direction"/>'),"\n ").concat(C,"\n </category>\n ")),d,t("looks")||(n=s,o=A,i=u,u=c,c=f.a.ScratchMsgs.translate("LOOKS_HELLO","Hello!"),a=f.a.ScratchMsgs.translate("LOOKS_HMM","Hmm..."),'\n <category name="%{BKY_CATEGORY_LOOKS}" id="looks" colour="#9966FF" secondaryColour="#774DCB">\n '+y.MartyBlocksToolbox_disco()+"\n\n ".concat(n?"":'\n <block type="looks_sayforsecs">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">'.concat(c,'</field>\n </shadow>\n </value>\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">2</field>\n </shadow>\n </value>\n </block>\n <block type="looks_say">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(c,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_thinkforsecs">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(a,'</field>\n </shadow>\n </value>\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">2</field>\n </shadow>\n </value>\n </block>\n <block type="looks_think">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(a,"</field>\n </shadow>\n </value>\n </block>\n ").concat(b,"\n "),"\n ").concat(n?'\n <block type="looks_switchbackdropto">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">'.concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_switchbackdroptoandwait">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">').concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextbackdrop"/>\n '):'\n <block id="'.concat(o,'_switchcostumeto" type="looks_switchcostumeto">\n <value name="COSTUME">\n <shadow type="looks_costume">\n <field name="COSTUME">').concat(i,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextcostume"/>\n <block type="looks_switchbackdropto">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">').concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextbackdrop"/>\n ').concat(b,'\n <block type="looks_changesizeby">\n <value name="CHANGE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="looks_setsizeto">\n <value name="SIZE">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n '),"\n ").concat(b,'\n <block type="looks_changeeffectby">\n <value name="CHANGE">\n <shadow type="math_number">\n <field name="NUM">25</field>\n </shadow>\n </value>\n </block>\n <block type="looks_seteffectto">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="looks_cleargraphiceffects"/>\n ').concat(b,"\n ").concat(n?"":'\n <block type="looks_show"/>\n <block type="looks_hide"/>\n '.concat(b,'\n <block type="looks_gotofrontback"/>\n <block type="looks_goforwardbackwardlayers">\n <value name="NUM">\n <shadow type="math_integer">\n <field name="NUM">1</field>\n </shadow>\n </value>\n </block>\n '),"\n ").concat(n?'\n <block id="backdropnumbername" type="looks_backdropnumbername"/>\n ':'\n <block id="'.concat(o,'_costumenumbername" type="looks_costumenumbername"/>\n <block id="backdropnumbername" type="looks_backdropnumbername"/>\n <block id="').concat(o,'_size" type="looks_size"/>\n '),"\n ").concat(C,"\n </category>\n ")),d,t("sound")||(c=A,a=g,'\n <category name="%{BKY_CATEGORY_SOUND}" id="sound" colour="#D65CD6" secondaryColour="#BD42BD">\n '+y.MartyBlocksToolbox_sound(a)+"\n ".concat(b,'\n\n \x3c!--Default blocks--\x3e\n\n <block id="').concat(c,'_sound_playuntildone" type="sound_playuntildone">\n <value name="SOUND_MENU">\n <shadow type="sound_sounds_menu">\n <field name="SOUND_MENU">').concat(a,'</field>\n </shadow>\n </value>\n </block>\n <block id="').concat(c,'_sound_play" type="sound_play">\n <value name="SOUND_MENU">\n <shadow type="sound_sounds_menu">\n <field name="SOUND_MENU">').concat(a,'</field>\n </shadow>\n </value>\n </block>\n <block type="sound_stopallsounds"/>\n ').concat(b,'\n <block type="sound_changeeffectby">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="sound_seteffectto">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n <block type="sound_cleareffects"/>\n ').concat(b,'\n <block type="sound_changevolumeby">\n <value name="VOLUME">\n <shadow type="math_number">\n <field name="NUM">-10</field>\n </shadow>\n </value>\n </block>\n <block type="sound_setvolumeto">\n <value name="VOLUME">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n <block id="').concat(c,'_volume" type="sound_volume"/>\n ').concat(C,"\n </category>\n ")),d,t("event")||'\n <category name="%{BKY_CATEGORY_EVENTS}" id="events" colour="#FFD500" secondaryColour="#CC9900">\n <block type="event_whenflagclicked"/>\n <block type="event_whenkeypressed">\n </block>\n '.concat(s?'\n <block type="event_whenstageclicked"/>\n ':'\n <block type="event_whenthisspriteclicked"/>\n ','\n <block type="event_whenbackdropswitchesto">\n </block>\n ').concat(b,'\n <block type="event_whengreaterthan">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="event_whenbroadcastreceived">\n </block>\n <block type="event_broadcast">\n <value name="BROADCAST_INPUT">\n <shadow type="event_broadcast_menu"></shadow>\n </value>\n </block>\n <block type="event_broadcastandwait">\n <value name="BROADCAST_INPUT">\n <shadow type="event_broadcast_menu"></shadow>\n </value>\n </block>\n ').concat(C,"\n </category>\n "),d,t("control")||(u=s,'\n <category name="%{BKY_CATEGORY_CONTROL}" id="control" colour="#FFAB19" secondaryColour="#CF8B17">\n <block type="control_wait">\n <value name="DURATION">\n <shadow type="math_positive_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n </block>\n '.concat(b,'\n <block type="control_repeat">\n <value name="TIMES">\n <shadow type="math_whole_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block id="forever" type="control_forever"/>\n ').concat(b,'\n <block type="control_if"/>\n <block type="control_if_else"/>\n <block id="wait_until" type="control_wait_until"/>\n <block id="repeat_until" type="control_repeat_until"/>\n ').concat(b,'\n <block type="control_stop"/>\n ').concat(b,"\n ").concat(u?'\n <block type="control_create_clone_of">\n <value name="CLONE_OPTION">\n <shadow type="control_create_clone_of_menu"/>\n </value>\n </block>\n ':'\n <block type="control_start_as_clone"/>\n <block type="control_create_clone_of">\n <value name="CLONE_OPTION">\n <shadow type="control_create_clone_of_menu"/>\n </value>\n </block>\n <block type="control_delete_this_clone"/>\n ',"\n ").concat(C,"\n </category>\n ")),d,t("sensing")||(A=e,g=s,c=f.a.ScratchMsgs.translate("SENSING_ASK_TEXT","What's your name?"),'\n <category name="%{BKY_CATEGORY_SENSING}" id="sensing" colour="#4CBFE6" secondaryColour="#2E8EB8">\n '.concat(g?"":'\n\n <block type="XAxisMovement" />\n\n <block type="YAxisMovement" />\n\n <block type="ZAxisMovement" />\n\n <block type="BatteryPercentage" />\n\n <block type="ServoCurrent" >\n <value>\n <field name="SERVOCHOICE"></field>\n </value>\n </block>\n\n <block type="ServoPosition" >\n <value>\n <field name="SERVOCHOICE"></field>\n </value>\n </block>\n\n <block type="mv2_obstaclesense" />\n\n <block type="mv2_groundsense" />\n\n <block type="mv2_coloursense" />\n\n <block type="mv2_coloursense_hex" />\n\n <block type="mv2_coloursenseraw" />\n\n <block type="mv2_distancesense" />\n\n <block type="mv2_lightsense" />\n\n <block type="mv2_noisesense" />\n\n \x3c!--<block type="mv2_current" />--\x3e\n\n \x3c!--<block type="mv2_accelerometer" />--\x3e\n\n \x3c!--<block type="mv2_proximity" />--\x3e\n\n \x3c!--<block type="mv2_demo_sensor" />--\x3e\n\n \x3c!--<block type="mv2_set_demo_sensor" >\n <value name="SENSORVAL">\n <shadow type="math_number">\n <field name="NUM">42</field>\n </shadow>\n </value>\n </block>--\x3e\n\n\n\n '.concat(b,'\n\n \x3c!-- SCRATCH DEFAULT BLOCKS --\x3e\n\n <block type="sensing_touchingobject">\n <value name="TOUCHINGOBJECTMENU">\n <shadow type="sensing_touchingobjectmenu"/>\n </value>\n </block>\n <block type="sensing_touchingcolor">\n <value name="COLOR">\n <shadow type="colour_picker"/>\n </value>\n </block>\n <block type="sensing_coloristouchingcolor">\n <value name="COLOR">\n <shadow type="colour_picker"/>\n </value>\n <value name="COLOR2">\n <shadow type="colour_picker"/>\n </value>\n </block>\n <block type="sensing_distanceto">\n <value name="DISTANCETOMENU">\n <shadow type="sensing_distancetomenu"/>\n </value>\n </block>\n ').concat(b,"\n "),"\n ").concat(A?"":'\n <block id="askandwait" type="sensing_askandwait">\n <value name="QUESTION">\n <shadow type="text">\n <field name="TEXT">'.concat(c,"</field>\n </shadow>\n </value>\n </block>\n "),'\n <block id="answer" type="sensing_answer"/>\n ').concat(b,'\n <block type="sensing_keypressed">\n <value name="KEY_OPTION">\n <shadow type="sensing_keyoptions"/>\n </value>\n </block>\n <block type="sensing_mousedown"/>\n <block type="sensing_mousex"/>\n <block type="sensing_mousey"/>\n ').concat(g?"":"\n ".concat(b,'\n \'<block type="sensing_setdragmode" id="sensing_setdragmode"></block>\'+\n ').concat(b,"\n "),"\n ").concat(b,'\n <block id="loudness" type="sensing_loudness"/>\n ').concat(b,'\n <block id="timer" type="sensing_timer"/>\n <block type="sensing_resettimer"/>\n ').concat(b,'\n <block id="of" type="sensing_of">\n <value name="OBJECT">\n <shadow id="sensing_of_object_menu" type="sensing_of_object_menu"/>\n </value>\n </block>\n ').concat(b,'\n <block id="current" type="sensing_current"/>\n <block type="sensing_dayssince2000"/>\n ').concat(b,'\n <block type="sensing_username"/>\n ').concat(C,"\n </category>\n ")),d,t("operators")||(u=e,s=f.a.ScratchMsgs.translate("OPERATORS_JOIN_APPLE","apple"),A=f.a.ScratchMsgs.translate("OPERATORS_JOIN_BANANA","banana"),c=f.a.ScratchMsgs.translate("OPERATORS_LETTEROF_APPLE","a"),'\n <category name="%{BKY_CATEGORY_OPERATORS}" id="operators" colour="#40BF4A" secondaryColour="#389438">\n <block type="operator_add">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_subtract">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_multiply">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_divide">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n '.concat(b,'\n <block type="operator_random">\n <value name="FROM">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="TO">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_gt">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n <block type="operator_lt">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n <block type="operator_equals">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_and"/>\n <block type="operator_or"/>\n <block type="operator_not"/>\n ').concat(b,"\n ").concat(u?"":'\n <block type="operator_join">\n <value name="STRING1">\n <shadow type="text">\n <field name="TEXT">'.concat(s,' </field>\n </shadow>\n </value>\n <value name="STRING2">\n <shadow type="text">\n <field name="TEXT">').concat(A,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_letter_of">\n <value name="LETTER">\n <shadow type="math_whole_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="STRING">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_length">\n <value name="STRING">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_contains" id="operator_contains">\n <value name="STRING1">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n <value name="STRING2">\n <shadow type="text">\n <field name="TEXT">').concat(c,"</field>\n </shadow>\n </value>\n </block>\n "),"\n ").concat(b,'\n <block type="operator_mod">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_round">\n <value name="NUM">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_mathop">\n <value name="NUM">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n ').concat(C,"\n </category>\n ")),d,t("data")||'\n <category\n name="%{BKY_CATEGORY_VARIABLES}"\n id="variables"\n colour="#FF8C1A"\n secondaryColour="#DB6E00"\n custom="VARIABLE">\n </category>\n ',d,t("procedures")||'\n <category\n name="%{BKY_CATEGORY_MYBLOCKS}"\n id="myBlocks"\n colour="#FF6680"\n secondaryColour="#FF4D6A"\n custom="PROCEDURE">\n </category>\n '],p=function(e,t){var n,o,i,a,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return o=!(n=!0),{s:function(){r=r.call(e)},n:function(){var e=r.next();return n=e.done,e},e:function(e){o=!0,i=e},f:function(){try{n||null==r.return||r.return()}finally{if(o)throw i}}};if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(l);try{for(p.s();!(r=p.n()).done;){var m=r.value;h.push(d,m.xml)}}catch(e){p.e(e)}finally{p.f()}return h.push("</xml>"),h.join("\n")}},function(module,exports,__webpack_require__){!function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;
|
|
8065
|
+
function(e,t){if((e=Object(c.b)(e,"auth")).isInitialized()){const o=e.getImmediate();var n=e.getOptions();if(Object(g.h)(n,null!=t?t:{}))return o;l(o,"already-initialized")}const o=e.initialize({options:t});return o}(e,{popupRedirectResolver:kn,persistence:[Lt,vt,Tt]});var o,i,a,t=Object(g.m)("authTokenSyncURL");if(t){a=t;const s=async e=>{var e=e&&await e.getIdTokenResult(),t=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;t&&t>Rn||(t=null==e?void 0:e.token,Yn!==t&&(Yn=t,await fetch(a,{method:t?"POST":"DELETE",headers:t?{Authorization:"Bearer "+t}:{}})))};e=n,t=s,r=()=>s(n.currentUser),Object(g.n)(e).beforeAuthStateChanged(t,r),e=n,t=e=>s(e),Object(g.n)(e).onIdTokenChanged(t,o,i)}var r=Object(g.k)("auth");return r&&Ve(n,"http://"+r),n}Fn="Browser",Object(c.c)(new t.a("auth",(e,{options:t})=>{var n=e.getProvider("app").getImmediate(),o=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=n.options,i=(h(i&&!i.includes(":"),"invalid-api-key",{appName:n.name}),{apiKey:i,authDomain:a,clientPlatform:Fn,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Re(Fn)}),a=new Le(n,o,e,i);return n=a,e=(null==(o=t)?void 0:o.persistence)||[],e=(Array.isArray(e)?e:[e]).map(u),null!=o&&o.errorMap&&n._updateErrorMap(o.errorMap),n._initializeWithPersistence(e,null==o?void 0:o.popupRedirectResolver),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Object(c.c)(new t.a("auth-internal",e=>{var e=Ge(e.getProvider("auth").getImmediate());return e=e,new _n(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Object(c.g)(On,"1.5.1",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Fn)),Object(c.g)(On,"1.5.1","esm2017");var E,w=e(22);const Ln={apiKey:"AIzaSyD8Kwib8K_I4jTw2eTbQPWRMKA4SjeonIw",authDomain:"northern-net-403811.firebaseapp.com",projectId:"northern-net-403811",storageBucket:"northern-net-403811.appspot.com",messagingSenderId:"766117397217",appId:"1:766117397217:web:32e639ee12d7b2d7d1ada0",measurementId:"G-3X2F1HT4YE"};(t=E=E||{})[t.Ready=0]="Ready",t[t.InProgress=1]="InProgress",t[t.Done=2]="Done";class Gn{constructor(e){this.firebaseInitialisedFlag=E.Ready,this.app=null,this.auth=null,this.API=e}hasFirebaseBeenInitialised(){return this.firebaseInitialisedFlag==E.Done}initialiseFirestore(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");let n;this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{var o=A.credential(this.API.gapiConnectionAPI.id_token,this.API.gapiConnectionAPI.access_token);console.log("credential",o),n=await ft(this.auth,o)}catch(e){return console.log("Error signing in: ",e),t(e)}if(n.user){this.firebaseInitialisedFlag=E.Done;try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return console.log("Successfully signed in to Firebase."),e(!0)}return this.firebaseInitialisedFlag=E.Ready,console.log("Couldn't connect to Firebase. User not signed in google."),t("User not signed in Google.")})}initialiseFirestoreWithoutSignIn(){return new Promise(async(e,t)=>{if(this.firebaseInitialisedFlag===E.Done)return e(!1);if(this.firebaseInitialisedFlag===E.InProgress)return t("Firebase is already being initialised.");this.firebaseInitialisedFlag=E.InProgress;try{this.app=Object(c.f)(Ln)}catch(e){return console.log("Error initializing firebase: ",e),t(e)}try{this.auth=Un(this.app)}catch(e){return console.log("Error authenticating app: ",e),t(e)}try{this.API.firestoreDb=Object(w.f)(this.app)}catch(e){return console.log("Error getting firestore instance: ",e),t(e)}return this.firebaseInitialisedFlag=E.Done,console.log("Successfully initialized Firebase."),e(!0)})}}var Pn=e(228);Pn.enc.Utf8.parse("some_fixed_iv_here");class y{static generateKey(e){return Pn.SHA256(e).toString()}static encrypt(e,t){return e}static decrypt(e,t){return e}}class Hn{constructor(e,t,n,o,i){this.studentSubmissions=null,this.id=e,this.classId=t,this.title=n,this.description=o,this.API=i}async addAttachment(e,t,n){await this.requestStudentSubmissionsList();var o=null==(o=this.studentSubmissions)?void 0:o.find(e=>e.userId===t);return o?await this.API.gapiClassroomAPI.addAttachementInCourseWork(this.classId,e,o.id,n):(console.error("StudentSubmission not found"),!1)}async getListOfStudentSubmissions(){return this.studentSubmissions||await this.requestStudentSubmissionsList(),this.studentSubmissions||[]}async requestStudentSubmissionsList(){var e=await this.API.gapiClassroomAPI.listStudentSubmissions(this.classId,this.id);this.studentSubmissions=e}}class jn{static calculateCompositeScore({algorithmsCompoScores:e,analysisCompoScores:t,decompositionCompoScores:n,patternRecAndDataRepCompoScores:o,generalisationAndAbstrCompoScores:i,badgesScores:a}){var r=a;let s=0,A=0,l=0,u=0,c=0,g=0;for(const h in r){var d=r[h];d[0]&&(s+=d[0],A++),d[1]&&(l+=d[1],u++),d[2]&&(c+=d[2],g++)}return e+t+n+o+i+s+l+c}}class C{static calculatePatternRecognitionAndDataRepresentationScore(e,t){let n=t["Duplicate Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e["Data Types"]*t+e.Loops*t+e["Variables and Data Structures"]*t}static calculateDecompositionScore(e){return e.Functions+e.Parallelism+e.Sequencing}static calculateGeneralisationAndAbstractionScore(e){return e["Function Reuse"]+e["Functions with Arguments"]+e["Variables Instead of Literals"]}static calculateAlgorithmsScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Conditionals*t+e.Operators*t+e["Synchronization and Messages"]*t}static calculateAnalysisScore(e,t){let n=t["Dead Scripts Count"]/t["Total Scripts Count"];t=1-(n=isNaN(n)?0:n);return e.Comments*t+e.Debugging*t+e.Naming*t}}var zn,Jn,On=e(209),b=e.n(On),t=e(796),Wn=e.n(t),On=e(797),Vn=e.n(On);const Kn=()=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()().tz("Europe/London").format()),I=e=>(b.a.extend(Wn.a),b.a.extend(Vn.a),b()(e).tz("Europe/London")),Xn=(e,t,n="seconds")=>{e=b()(e),t=b()(t);return e.diff(t,n)};(t=zn=zn||{}).STARTED="STARTED",t.STOPPED="STOPPED",(Jn=Jn||{}).LAST_HEARTBEAT="lastUploadTime";var qn=class{constructor(){this.heartbeatInterval=null,this.heartbeatCallbacks={},this.status=zn.STOPPED}startHeartbeat(){this.heartbeatInterval?console.warn("Heartbeat already started."):(this.heartbeatInterval=setInterval(()=>{Object.values(this.heartbeatCallbacks).forEach(e=>e())},5e3),this.status=zn.STARTED)}stopHeartbeat(){this.heartbeatInterval?(console.debug("stopping heartbeat"),clearInterval(this.heartbeatInterval),this.heartbeatInterval=null,this.status=zn.STOPPED):console.warn("Heartbeat not running.")}setHeartbeatCallback(e,t){this.heartbeatCallbacks[e]&&console.warn(`Callback with id ${e} already set. Overwriting.`),this.heartbeatCallbacks[e]=t}removeHeartbeatCallback(e){this.heartbeatCallbacks[e]?delete this.heartbeatCallbacks[e]:console.warn(`Callback with id ${e} does not exist.`)}},v=e(38);const Zn={Loops:[v.Loops_1.progressionRanges,v.Loops_2.progressionRanges,v.Loops_3.progressionRanges],Functions:[v.Functions_1.progressionRanges,v.Functions_2.progressionRanges,v.Functions_3.progressionRanges],Conditionals:[v.Conditionals_1.progressionRanges,v.Conditionals_2.progressionRanges,v.Conditionals_3.progressionRanges],"Data Types":[v.DataTypes_1.progressionRanges,v.DataTypes_2.progressionRanges,v.DataTypes_3.progressionRanges],Operators:[v.Operators_1.progressionRanges,v.Operators_2.progressionRanges,v.Operators_3.progressionRanges],Parallelism:[v.Parallelism_1.progressionRanges,v.Parallelism_2.progressionRanges],"Variables and Lists":[v.VariablesAndLists_1.progressionRanges,v.VariablesAndLists_2.progressionRanges,v.VariablesAndLists_3.progressionRanges]};class $n{static toStars(e){var t={};for(const a in Zn){t[a]=[[],[]];var n=e[a];for(let e=0;e<n.length;e++){var[o,i]=function(t,n){var o=["#cd7f32","silver","gold"];for(let e=0;e<n.length;e++){var i=n[e][0],a=n[e][1];if(i<t&&t<=a)return[o[e%o.length],(t-i)/(a-i)]}return t>=n[n.length-1][1]?["gold",1]:["white",0]}(n[e],Zn[a][e]);o&&(t[a][0].push(o),t[a][1].push(i))}}return t}}class eo{constructor(e,t,n,o,i,a,r,s){this.heartbeat=null,this.scoresOverTime=null,this.reactionsOverTime=null,this.badges=null,this.lastHeartbeat=null,this.onStudentDataDocChangeCbs=new Map,this.studentId=t,this.classId=e,this.id=o||eo.compileStudentDataId(e,t),this.API=n,this.scoresOverTime=i||null,this.badges=a||new v.BadgesCounts,this.lastHeartbeat=r||null,this.reactionsOverTime=s||null}static compileStudentDataId(e,t){return e+"_"+t}initialiseHeartbeat(){this.heartbeat&&(console.warn("Heartbeat already created. Removing this heartbeat and creating a new one"),this.heartbeat.stopHeartbeat()),this.heartbeat=new qn,this.startSendingLastHeartbeatTime()}startSendingLastHeartbeatTime(){var e;this.heartbeat||(console.warn("Heartbeat not created, creating heartbeat"),this.initialiseHeartbeat()),console.debug("setting heartbeat callback"),null!=(e=this.heartbeat)&&e.setHeartbeatCallback(Jn.LAST_HEARTBEAT,this.sendLastHeartbeatTime.bind(this)),null!=(e=this.heartbeat)&&e.startHeartbeat()}sendLastHeartbeatTime(){this.API.firestoreStudentDataAPI.updateLastHeartbeatTime(this.classId,this.studentId)}stopHeartbeat(){this.heartbeat&&(this.heartbeat.stopHeartbeat(),this.heartbeat=null)}async sendStudentAssessmentScores(e){e={scoresOverTime:{[Kn()]:e}};await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e)}async sendStudentBadgesData(e){await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,{badges:e})}async sendStudentEmojiReaction(e){e={reactionsOverTime:{[Kn()]:e}};try{return await this.API.firestoreStudentDataAPI.updateStudentData(this.classId,this.studentId,e),!0}catch(e){return console.error("Failed to send student reaction to database",e),!1}}async subscribeToDbDocChanges(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onStudentDataDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreStudentDataAPI.subscribeToStudentDataDocChanges(this.classId,this.studentId,t=>{this.onStudentDataDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onStudentDataDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onStudentDataDocChangeCbs.has(e)?this.onStudentDataDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onStudentDataDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onStudentDataDocChangeCbs.delete(e)),this.onStudentDataDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}getLastScore(){var e;return this.scoresOverTime&&(e=Object.keys(this.scoresOverTime).sort().reverse()[0])?{[e]:this.scoresOverTime[e]}:null}badgesToStars(){return this.badges?$n.toStars(this.badges):(console.warn("badges is null"),null)}}var M=eo;class to{constructor(e,t,n){this.classess=null,this.studentData=null,this.joinedClass=null,this.id=e,this.name=t,this.API=n}async joinClass(t){await this.getListOfClassess();var e,n=null==(n=this.classess)?void 0:n.find(e=>e.id===t);return n?(e=await this.requestStudentData(t))?(e.initialiseHeartbeat(),this.joinedClass=n,await this.listenForClassAnnouncements(this.API.codeAssess.onNewClassAnnouncement.bind(this.API.codeAssess)),!0):(console.error("Student data not found"),!1):(console.error("Class not found"),!1)}async exitClass(){return this.joinedClass?(await this.requestStudentData(this.joinedClass.id),this.studentData?(this.studentData.stopHeartbeat(),this.joinedClass.unsubscribeFromDbDocChanges(),this.joinedClass=null,!(this.studentData=null)):(console.error("Student data not found"),!1)):(console.error("Student is not in a class"),!1)}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async requestStudentData(e){if(this.doesStudentDataExist(e))return console.log("StudentData already exists"),this.studentData;let t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);if(t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id)))return console.debug("fetched studentData",t),e=new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime),this.addStudentData(e),e;console.error("Failed to create student data in db")}async fetchStudentData(e){var t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id);return t||(console.warn("StudentData does not exist in db, creating"),await this.API.firestoreStudentDataAPI.createStudentData(e,this.id),t=await this.API.firestoreStudentDataAPI.getStudentData(e,this.id))?new M(t.classId,t.studentId,this.API,t.id,t.scoresOverTime,t.badges,t.lastHeartbeat,t.reactionsOverTime):void console.error("Failed to create student data in db")}addStudentData(e){this.doesStudentDataExist(e.classId)?console.warn("StudentData already exists"):(this.studentData&&this.studentData.stopHeartbeat(),this.studentData=e)}doesStudentDataExist(e){return!!this.studentData&&this.studentData.classId===e}getActivityStatus(e){if(!e.lastHeartbeat)return"offline";var t=Kn(),n=e.lastHeartbeat;if(7<Xn(t,n,"seconds"))return"offline";if(console.log("studentData.scoresOverTime",e.scoresOverTime),!e.scoresOverTime)return"inactive";n=e.getLastScore();if(!n)return"inactive";console.log("lastScore",n);e=Object.keys(n)[0],n=I(e);return 30<Xn(t,n.toString(),"seconds")?"inactive":"active"}getCompositeScore(e,t=!0){var n;return e.scoresOverTime&&(n=e.getLastScore(),t=t?e.badges:{},n)&&Object.keys(n)[0]?(e=Object.values(n)[0],jn.calculateCompositeScore({algorithmsCompoScores:C.calculateAlgorithmsScore(e.Algorithms,e["Dead Code"]),analysisCompoScores:C.calculateAnalysisScore(e.Analysis,e["Dead Code"]),decompositionCompoScores:C.calculateDecompositionScore(e.Decomposition),patternRecAndDataRepCompoScores:C.calculatePatternRecognitionAndDataRepresentationScore(e["Pattern Recognition and Data Representation"],e.Repetition),generalisationAndAbstrCompoScores:C.calculateGeneralisationAndAbstractionScore(e["Generalisation and Abstraction"]),badgesScores:t})):0}async listenForClassAnnouncements(n){return this.joinedClass?(await this.joinedClass.subscribeToDbDocChanges("studentJoinedClassAnnouncements",async t=>{if(t.announcements)if(0===t.announcements.length)console.warn("No announcements in class");else{t=await t.getActiveAnnouncements();if(t&&0!==t.length){let e=t[0];1<t.length&&(console.warn("More than one active announcement, using the last one"),e=t[t.length-1]),e?n(e):console.error("Announcement not found")}else console.warn("No active announcements")}}),!0):(console.warn("Student has not joined a class, cannot listen for joined class announcements"),!1)}async getAnnouncement(e){return this.joinedClass?await this.API.firestoreClassAnnouncementsAPI.get(e,this.joinedClass.id):(console.warn("Student has not joined a class, cannot get announcement"),null)}async sendEmojiFeedback(e,t){if(!this.joinedClass)return console.warn("Student has not joined a class, cannot send emoji feedback"),!1;e=await this.getAnnouncement(e);if(!e)return console.error("Announcement not found"),!1;var n=await this.requestStudentData(this.joinedClass.id);if(!n)return console.error("Student data not found"),!1;n=await n.sendStudentEmojiReaction({reaction:t});if(n&&!await e.respond(this.id,this.name,t))return console.error("Failed to respond to announcement"),!1;return!0}}class no{constructor(e,t,n,o,i,a,r,s){this.courseWorks=null,this.students=null,this.announcements=[],this.onDocChangeCbs=new Map,this.id=e,this.teacherId=t,this.name=n,this.API=o,this.section=i,this.subject=a,this.room=r,this.announcements=s||[]}async getListOfCourseWorks(){return this.courseWorks||await this.requestListOfCourseWorks(),this.courseWorks||[]}async getListOfStudents(){return this.students||await this.requestListOfStudents(),this.students||[]}async createCourseWork(e,t){var e=await this.API.gapiClassroomAPI.createCourseWork(this.id,e,t),t=new Hn(e.id,this.id,e.title,e.description,this.API);return null!=(e=this.courseWorks)&&e.push(t),t}async requestListOfCourseWorks(){var e=(await this.API.gapiClassroomAPI.listCourseWorks(this.id)).map(e=>new Hn(e.id,this.id,e.title,e.description,this.API));this.courseWorks=e}async requestListOfStudents(){var e=(await this.API.gapiClassroomAPI.listStudents(this.id)).map(e=>new to(e.userId,e.profile.name.fullName,this.API));this.students=e}async createStudentDataForAllStudentsIfNotExists(){if(this.students||await this.requestListOfStudents(),this.students){const n=[];await Promise.all(this.students.map(async e=>{var t=await this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(this.id,e.id);n.push({[e.id]:t})})),console.log("wasStudentDataCreatedSuccessfully?",n)}}async getStudentDataForAllStudents(){return this.students||await this.requestListOfStudents(),this.students?(await Promise.all(this.students.map(async e=>{return await this.API.firestoreStudentDataAPI.getStudentData(this.id,e.id)}))).map(e=>e?new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime):null):[]}async appendFetchedStudentDataToStudents(){var e;this.students||await this.requestListOfStudents(),await this.createStudentDataForAllStudentsIfNotExists();const n=await this.API.firestoreStudentDataAPI.getStudentDataListGivenClassId(this.id);null!=(e=this.students)&&e.forEach(t=>{var e=n.find(e=>e.studentId===t.id);e&&(e=new M(e.classId,e.studentId,this.API,e.id,e.scoresOverTime,e.badges,e.lastHeartbeat,e.reactionsOverTime),t.addStudentData(e))})}async announce(e,t){e=await this.API.firestoreClassAnnouncementsAPI.create(this.id,e,t);return e?await this.API.firestoreClassesAPI.addClassAnnouncement(this.id,e)?e:(console.warn("Failed to add announcement to class"),!1):(console.warn("Failed to create announcement -- announcementId is falsy"),!1)}async removeAnnouncement(e){return!!await this.API.firestoreClassesAPI.removeClassAnnouncement(this.id,e)||(console.warn("Failed to remove announcement from class"),!1)}async deactivateAnnouncement(e){var t=await e.deactivate();return"text"!==e.type||await this.removeAnnouncement(e.id)?!!t||(console.warn("Failed to deactivate announcement"),!1):(console.warn("Failed to remove announcement"),!1)}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassesAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async getAnnouncements(){var e=await this.API.firestoreClassesAPI.getClassAnnouncementIds(this.id)||[];return(await Promise.all(e.map(async e=>{var t=await this.API.firestoreClassAnnouncementsAPI.get(e,this.id);return t||(console.warn(`Announcement with ID ${e} does not exist`),null)}))).filter(e=>null!==e)}async getActiveAnnouncements(){var e=await this.API.firestoreClassAnnouncementsAPI.getActiveAnnouncements(this.id);return e&&0!==e.length?e.filter(e=>null!==e):(console.warn("There are no active announcements for class with ID "+this.id),[])}}const oo="Classes";class io{constructor(e){this.API=e}async createClass(e,t,n){var o;return this.API.firestoreDb?(o=y.encrypt(e,e),o=Object(w.c)(this.API.firestoreDb,oo,o),(await Object(w.d)(o)).exists()?(console.log("Class already exists"),!1):(n=y.encrypt(n,e),t=y.encrypt(t,e),await Object(w.i)(o,{name:t,teacherId:n}),console.log("Class created"),!0)):(console.error("Firestore db not initialized"),!1)}async getClass(t){var e,n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(n=await Object(w.d)(n)).exists()?(n=n.data(),{name:y.decrypt(n.name,t),teacherId:y.decrypt(n.teacherId,t),students:null==(e=n.students)?void 0:e.map(e=>y.decrypt(e,t)),announcements:n.announcements}):(console.log("Class does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateClassStudents(t,e){var n;return this.API.firestoreDb?(n=y.encrypt(t,t),n=Object(w.c)(this.API.firestoreDb,oo,n),(await Object(w.d)(n)).exists()?(e=e.map(e=>y.encrypt(e,t)),await Object(w.i)(n,{students:e},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async addClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.announcements)||[],await Object(w.i)(e,{announcements:[...n,t]},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async removeClassAnnouncement(e,t){var n;return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(n=await Object(w.d)(e)).exists()?(n=((null==(n=n.data())?void 0:n.announcements)||[]).filter(e=>e!==t),await Object(w.i)(e,{announcements:n},{merge:!0}),console.info("Class updated"),!0):(console.log("Class does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=y.encrypt(t,t),e=Object(w.c)(this.API.firestoreDb,oo,e),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new no(t,y.decrypt(e.teacherId,t),y.decrypt(e.name,t),this.API,void 0,void 0,void 0,e.announcements),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async getClassAnnouncementIds(e){return this.API.firestoreDb?(e=y.encrypt(e,e),e=Object(w.c)(this.API.firestoreDb,oo,e),(e=await Object(w.d)(e)).exists()?e.data().announcements:(console.log("Class does not exist"),[])):(console.error("Firestore db not initialized"),[])}}class ao{constructor(e){this.firestoreDb=null,this.API=e}async createClassIfDoesntExist(e,t,n){var o;return this.API.firestoreDb?(o=await this.API.firestoreClassesAPI.getClass(e))?(console.log("Class exists",o),!0):(console.log("Class does not exist, creating class"),await this.API.firestoreClassesAPI.createClass(e,t,n)?(console.log("Class created",e),o=await this.API.firestoreClassesAPI.getClass(e),console.log("Class data",o),!0):(console.error("Failed to create class"),!1)):(console.error("Firestore db not initialized"),!1)}async addStudentToClassIfHasntBeenAddedAlready(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreClassesAPI.getClass(e))?((n=n.students||[]).includes(t)?console.log("Student has already been added to class"):(console.log("Student has not been added to class, adding student to class"),n.push(t),await this.API.firestoreClassesAPI.updateClassStudents(e,n),console.log("Student added to class")),!0):(console.log("Class does not exist"),!1):(console.error("Firestore db not initialized"),!1)}async createTeacherIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreTeachersAPI.getTeacher(e))?(console.log("Teacher exists",n),!0):(console.log("Teacher does not exist, creating teacher"),await this.API.firestoreTeachersAPI.createTeacher(e,t)?(console.log("Teacher created",e),n=await this.API.firestoreTeachersAPI.getTeacher(e),console.log("Teacher data",n),!0):(console.error("Failed to create teacher"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentsAPI.getStudent(e))?(console.log("Student exists",n),!0):(console.log("Student does not exist, creating student"),await this.API.firestoreStudentsAPI.createStudent(e,t)?(console.log("Student created",e),n=await this.API.firestoreStudentsAPI.getStudent(e),console.log("Student data",n),!0):(console.error("Failed to create student"),!1)):(console.error("Firestore db not initialized"),!1)}async createStudentDataIfDoesntExist(e,t){var n;return this.API.firestoreDb?(n=await this.API.firestoreStudentDataAPI.getStudentData(e,t))?(console.log("StudentData exists",n),!0):(console.log("StudentData does not exist, creating studentData"),await this.API.firestoreStudentDataAPI.createStudentData(e,t)?(console.log("StudentData created",e,t),n=await this.API.firestoreStudentDataAPI.getStudentData(e,t),console.log("StudentData data",n),!0):(console.error("Failed to create studentData"),!1)):(console.error("Firestore db not initialized"),!1)}}class ro{constructor(e){this.API=e}async createTeacher(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Teachers",n),(await Object(w.d)(n)).exists()?(console.log("Teacher already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Teacher created"),!0)):(console.error("Firestore db not initialized"),!1)}async getTeacher(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Teachers",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Teacher does not exist"),null)):(console.error("Firestore db not initialized"),null)}}class so{constructor(e){this.API=e}async createStudent(e,t){var n;return this.API.firestoreDb?(n=y.encrypt(e,e),n=Object(w.c)(this.API.firestoreDb,"Students",n),(await Object(w.d)(n)).exists()?(console.log("Student already exists"),!1):(t=y.encrypt(t,e),await Object(w.i)(n,{name:t}),console.log("Student created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudent(e){var t;return this.API.firestoreDb?(t=y.encrypt(e,e),t=Object(w.c)(this.API.firestoreDb,"Students",t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{name:y.decrypt(t.name,e)}):(console.log("Student does not exist"),null)):(console.error("Firestore db not initialized"),null)}}const Ao=e=>{if(!e)return console.warn("minifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={Decomposition:n.dec,"Pattern Recognition and Data Representation":n.pat,"Generalisation and Abstraction":n.gen,Algorithms:n.alg,Analysis:n.ana,Repetition:n.rep,"Dead Code":n.dea};t[o]=n}return t},lo="StudentData";class uo{constructor(e){this.API=e}async createStudentData(e,t){var n,o;return this.API.firestoreDb?(n=M.compileStudentDataId(e,t),n=y.encrypt(n,e),console.debug("encryptedStudentDataId used for creating student data: ",n),o=Object(w.c)(this.API.firestoreDb,lo,n),(await Object(w.d)(o)).exists()?(console.log("StudentData already exists"),!1):(await Object(w.i)(o,{classId:y.encrypt(e,e),studentId:y.encrypt(t,e),id:n}),console.log("StudentData created"),!0)):(console.error("Firestore db not initialized"),!1)}async getStudentData(e,t){return this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),console.debug("encryptedStudentDataId used for getting student data: ",t),t=Object(w.c)(this.API.firestoreDb,lo,t),(t=await Object(w.d)(t)).exists()?(t=t.data(),{id:y.decrypt(t.id,e),classId:y.decrypt(t.classId,e),studentId:y.decrypt(t.studentId,e),scoresOverTime:Ao(t.scoresOverTime),badges:t.badges,lastHeartbeat:t.lastHeartbeat,reactionsOverTime:t.reactionsOverTime}):(console.log("StudentData does not exist"),null)):(console.error("Firestore db not initialized"),null)}async updateStudentData(e,t,n){this.API.firestoreDb?(n.scoresOverTime&&(n.scoresOverTime=(e=>{if(!e)return console.warn("unminifiedScoresOverTime is null"),null;var t={};for(const o in e){var n=e[o],n={dec:Object.assign({},n.Decomposition),pat:Object.assign({},n["Pattern Recognition and Data Representation"]),gen:Object.assign({},n["Generalisation and Abstraction"]),alg:Object.assign({},n.Algorithms),ana:Object.assign({},n.Analysis),rep:Object.assign({},n.Repetition),dea:Object.assign({},n["Dead Code"])};t[o]=n}return t})(n.scoresOverTime)),t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,n,{merge:!0})):console.error("Firestore db not initialized")}updateLastHeartbeatTime(e,t){this.API.firestoreDb?(t=M.compileStudentDataId(e,t),t=y.encrypt(t,e),e=Object(w.c)(this.API.firestoreDb,lo,t),Object(w.i)(e,{lastHeartbeat:Kn()},{merge:!0})):console.error("Firestore db not initialized")}async getStudentDataListGivenClassId(t){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve([]);const n=[];try{var e=y.encrypt(t,t),o=Object(w.h)(Object(w.a)(this.API.firestoreDb,lo),Object(w.j)("classId","==",e));return(await Object(w.e)(o)).forEach(e=>{e=e.data(),e={classId:y.decrypt(e.classId,t),id:y.decrypt(e.id,t),studentId:y.decrypt(e.studentId,t),lastHeartbeat:e.lastHeartbeat,badges:e.badges,scoresOverTime:Ao(e.scoresOverTime),reactionsOverTime:e.reactionsOverTime};n.push(e)}),n}catch(e){return console.error("Error getting documents: ",e),Promise.resolve([])}}async subscribeToStudentDataDocChanges(n,e,o){if(this.API.firestoreDb)return e=M.compileStudentDataId(n,e),e=y.encrypt(e,n),e=Object(w.c)(this.API.firestoreDb,lo,e),Object(w.g)(e,e=>{var t;e.exists()?(t=e.data(),e=new M(y.decrypt(t.classId,n),y.decrypt(t.studentId,n),this.API,y.decrypt(e.id,n),Ao(t.scoresOverTime),t.badges,t.lastHeartbeat,t.reactionsOverTime),o(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}}class co{constructor(e,t,n,o,i,a,r,s=!0){this.isActive=!0,this.responses=[],this.onDocChangeCbs=new Map,this.id=e,this.type=t,this.API=n,this.classId=o,this.text=i,this.timestamp=a,this.responses=r,this.isActive=s}async subscribeToDbDocChanges(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.dbUnsubscribe&&(console.warn("Already subscribed to db doc changes, removing this subscription and creating a new one"),this.unsubscribeFromDbDocChanges()),this.onDocChangeCbs.set(e,t),this.dbUnsubscribe=await this.API.firestoreClassAnnouncementsAPI.subscribeToDocChanges(this.id,t=>{this.onDocChangeCbs.forEach(e=>{e(t)})})}removeAllDbDocChangeCallbacks(){this.onDocChangeCbs.clear()}removeDbDocChangeCallback(e){this.onDocChangeCbs.has(e)?this.onDocChangeCbs.delete(e):console.warn(`Callback with id ${e} does not exist.`)}addDbDocChangeCallback(e,t){this.onDocChangeCbs.has(e)&&(console.warn(`A callback with the ID ${e} is already subscribed. Overwriting.`),this.onDocChangeCbs.delete(e)),this.onDocChangeCbs.set(e,t)}unsubscribeFromDbDocChanges(){console.debug("unsubscribing from db doc changes"),this.dbUnsubscribe&&(this.dbUnsubscribe(),this.dbUnsubscribe=void 0,this.removeAllDbDocChangeCallbacks())}async respond(e,t,n){n={response:n,studentId:e,studentName:t,timestamp:Kn()};return this.API.firestoreClassAnnouncementsAPI.addResponse(this.id,n)}async deactivate(){return"text"===this.type?this.API.firestoreClassAnnouncementsAPI.delete(this.id):this.API.firestoreClassAnnouncementsAPI.deactivate(this.id)}async refresh(){var e=await this.API.firestoreClassAnnouncementsAPI.get(this.id,this.classId);if(e)return e;throw new Error("Could not get fresh class announcement")}}const T="ClassAnnouncements";class go{constructor(e){this.API=e}async create(e,t,n){var o;return this.API.firestoreDb?(e=y.encrypt(e,e),o=Object(w.a)(this.API.firestoreDb,T),o=Object(w.c)(o),await Object(w.i)(o,{classId:e,text:t,timestamp:Kn(),announcementType:n,responses:[],isActive:!0}),console.info("Class announcement created"),o.id):(console.error("Firestore db not initialized"),!1)}async get(e,t){var n;return this.API.firestoreDb?(n=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(n)).exists()?(n=n.data(),new co(e,n.announcementType,this.API,y.decrypt(n.classId,t),n.text,n.timestamp,n.responses,!!n.isActive)):(console.log("Class announcement does not exist"),null)):(console.error("Firestore db not initialized"),null)}async getActiveAnnouncements(n){if(!this.API.firestoreDb)return console.error("Firestore db not initialized"),Promise.resolve(null);var e=Object(w.a)(this.API.firestoreDb,T),e=Object(w.h)(e,Object(w.j)("classId","==",y.encrypt(n,n)),Object(w.j)("isActive","==",!0)),e=await Object(w.e)(e);const o=[];return e.forEach(e=>{var t=e.data(),e=new co(e.id,t.announcementType,this.API,y.decrypt(t.classId,n),t.text,t.timestamp,t.responses,!!t.isActive);o.push(e)}),o}async update(e,t){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,t,{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async subscribeToDocChanges(t,n){var e;if(this.API.firestoreDb)return e=Object(w.c)(this.API.firestoreDb,T,t),Object(w.g)(e,e=>{e.exists()?(e=e.data(),e=new co(t,e.announcementType,this.API,y.decrypt(e.classId,t),e.text,e.timestamp,e.responses,!!e.isActive),n(e)):console.warn("Current data: null")});console.error("Firestore db not initialized")}async addResponse(e,t){var n;return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(n=await Object(w.d)(e)).exists()?(n=(null==(n=n.data())?void 0:n.responses)||[],await Object(w.i)(e,{responses:[...n,t]},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async deactivate(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.i)(e,{isActive:!1},{merge:!0}),console.info("Class announcement updated"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}async delete(e){return this.API.firestoreDb?(e=Object(w.c)(this.API.firestoreDb,T,e),(await Object(w.d)(e)).exists()?(await Object(w.b)(e),console.info("Class announcement deleted"),!0):(console.log("Class announcement does not exist"),!1)):(console.error("Firestore db not initialized"),!1)}}class ho{constructor(e,t,n){this.classess=null,this.id=e,this.name=t,this.API=n}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=(await this.API.gapiClassroomAPI.listClassess()).map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement));this.classess=e}async determineIfStudentOrTeacherInClass(t){await this.requestListOfClasses();var e=null==(e=this.classess)?void 0:e.find(e=>e.id===t);return e?(console.debug("classToCheck",e),e.teacherId===this.id?Bo.TEACHER:Bo.STUDENT):(console.warn("Could not find class with id",t),null)}}const S={CREATE_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,GET_USER_PROFILE:()=>"https://classroom.googleapis.com/v1/userProfiles/me",LIST_ALL_COURSES:()=>"https://classroom.googleapis.com/v1/courses",LIST_ALL_STUDENTS:e=>`https://classroom.googleapis.com/v1/courses/${e}/students`,LIST_ALL_COURSEWORK:e=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork`,LIST_ALL_STUDENT_SUBMISSIONS:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions`,MODIFY_ATTACHEMENTS_OF_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:modifyAttachments`,PATCH_COURSEWORK:(e,t,n,o)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}?updateMask=`+encodeURIComponent(o),REGISTER_STUDENT:(e,t)=>`https://classroom.googleapis.com/v1/courses/${e}/students?enrollmentCode=`+t,TURN_IN_COURSEWORK:(e,t,n)=>`https://classroom.googleapis.com/v1/courses/${e}/courseWork/${t}/studentSubmissions/${n}:turnIn`},po=["https://www.googleapis.com/auth/classroom.courses.readonly","https://www.googleapis.com/auth/classroom.rosters.readonly","openid"];class mo{constructor(e){this.gapi_client=null,this.firestoreDb=null,this.gapiConnectionAPI=new G(this),this.gapiClassroomAPI=new P(this),this.firestoreConnectionAPI=new Gn(this),this.firestoreClassesAPI=new io(this),this.firestoreTeachersAPI=new ro(this),this.firestoreStudentsAPI=new so(this),this.firestoreStudentDataAPI=new uo(this),this.firestoreClassAnnouncementsAPI=new go(this),this.firestoreHOCAPI=new ao(this),this.codeAssess=e}async initGapiClient(){return new Promise((t,n)=>{const e=()=>{gapi.client.init({}).then(async()=>{if(console.log("this.gapi_client loaded"),!this.gapiConnectionAPI.access_token)return console.error("access_token is null"),n(!1);gapi.client.setToken({access_token:this.gapiConnectionAPI.access_token}),this.gapi_client=gapi.client;var e=await this.requestCurrentUserProfile();if(!e)return console.error("userProfile is null"),n(!1);this.codeAssess.setUserProfile(new ho(e.id,e.name.fullName,this)),t(!0)}).catch(e=>{console.error("Error loading gapi client for API",e),n(!1)})};gapi.load("client:auth2",()=>e())})}async requestCurrentUserProfile(){try{var e;if(this.gapi_client)return e=await this.gapi_client.request({path:S.GET_USER_PROFILE()}),console.log("response",e.result),e.result;throw new Error("gapi_client is not initialized.")}catch(e){return console.error("Error while getting current user profile:",e),null}}}class fo{constructor(e,t,n){this.classess=null,this.monitoredAnnouncements=new Map,this.id=e,this.name=t,this.API=n,this.requestListOfClasses()}async getListOfClassess(){return this.classess||await this.requestListOfClasses(),this.classess||[]}async requestListOfClasses(){var e=await this.API.gapiClassroomAPI.listClassess(),e=(console.debug("fetchedClassess",e),e.map(e=>new no(e.id,e.ownerId,e.name,this.API,e.section,e.subject,e.room,e.announcement)));this.classess=e}async createCourseWorkForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);return o?o.createCourseWork(e,n):(console.error("Could not find class with id",t),!1)}async makeAnnouncementForClass(t,e,n){var o=null==(o=this.classess)?void 0:o.find(e=>e.id===t);if(!o)return console.error("Could not find class with id",t),!1;for(const i of await o.getActiveAnnouncements())await i.deactivate();return o.announce(e,n)}async askForEmojiFeedback(e,t){e=await this.makeAnnouncementForClass(e,t,"emoji-feedback");return e||(console.error("Could not make announcement"),!1)}async getAnnouncement(t,e){var n;return(null==(n=this.classess)?void 0:n.find(e=>e.id===t))?await this.API.firestoreClassAnnouncementsAPI.get(e,t):(console.error("Could not find class with id",t),null)}async monitorAnnouncementResponses(e,t,n){e=await this.getAnnouncement(e,t);return e?(await e.subscribeToDbDocChanges(t,e=>{n(e.responses||[])}),this.monitoredAnnouncements.set(t,e),!0):(console.error("Could not get announcement"),!1)}stopMonitoringAnnouncementResponse(e){var t=this.monitoredAnnouncements.get(e);return t?(t.unsubscribeFromDbDocChanges(),this.monitoredAnnouncements.delete(e),!0):(console.error("Could not find announcement with id",e),!1)}stopMonitoringAllAnnouncements(){this.monitoredAnnouncements.forEach(e=>{e.unsubscribeFromDbDocChanges()}),this.monitoredAnnouncements.clear()}}var Bo,Eo=class{static studentAssessmentScoresOverTimeToLineGraphData(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const s=a[e];var r=i.map(e=>n[e][s]),r={x:i,y:r,name:s,type:"scatter",mode:"markers"};o.push(r)}return o}static averageScoresOverTime(e){return{}}static transformDataForStackedAreaChart(e){if(!e)return console.warn("No scores over time data provided"),[];let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t;var o=[],i=Object.keys(t).sort();if(0===i.length)return console.warn("No scores over time data provided"),[];var a=Object.keys(t[i[0]]).sort();for(let e=0;e<a.length;e++){const A=a[e];var r=i.map(e=>n[e][A]),s=0===e?"tozeroy":"tonexty",r={x:i,y:r,name:A,type:"scatter",mode:"lines",fill:s};o.push(r)}return o}static transformDataForSpiderChart(e){let t;if(!(t=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const n=t,o=Object.keys(t).sort();return 0===o.length?(console.warn("No scores over time data provided"),[]):{type:"scatterpolar",r:(e=Object.keys(t[o[0]]).sort()).map(t=>{var e=o.map(e=>n[e][t]);return e[e.length-1]}),theta:e,fill:"toself"}}static getLatestScores(e){let t;var n;return!(t=Array.isArray(e)?this.averageScoresOverTime(e):e)||(e=t,0===(n=Object.keys(t).sort()).length)?(console.warn("No scores over time data provided"),[]):e[n[n.length-1]]}static transformDataForStackedAreaChartForTheLastMinutes(e,t){if(!e)return console.warn("No scores over time data provided"),[];let n;if(!(n=Array.isArray(e)?this.averageScoresOverTime(e):e))return console.warn("No scores over time data provided"),[];const o=n;var i=[],e=Object.keys(n).sort();if(0===e.length)return console.warn("No scores over time data provided"),[];const a=b()(Kn());var r=e.filter(e=>{return Xn(a.format(),e,"minutes")<=t});if(0===r.length)return console.warn("No scores in the last "+t+" minutes"),[];var s=Object.keys(n[r[0]]).sort();for(let e=0;e<s.length;e++){const u=s[e];var A=r.map(e=>o[e][u]),l=0===e?"tozeroy":"tonexty",A={x:r,y:A,name:u,type:"scatter",mode:"lines",fill:l};i.push(A)}return i}};(On=Bo=Bo||{}).STUDENT="student",On.TEACHER="teacher";(class ko{});t=class extends class ko{constructor(){if(this.constructor===ko)throw new TypeError('Abstract class "CodeAssessObservable" cannot be instantiated directly.')}}{constructor(){super(),this.userProfile=null,this.teacher=null,this.student=null,this.dataTransformationUtils=Eo,this.platform="staging",this.API=new mo(this),this.observers=[],this.studentOrTeacher=null,this.isUserLoggedIn=!1,this.TypesOfPublishedEvents=i}async logUserIn(){var e=await this.API.gapiConnectionAPI.login(),t=await this.API.firestoreConnectionAPI.initialiseFirestore();return!(!e||!t||(this.setIsUserLoggedIn(!0),0))}async logUserOut(){await this.API.gapiConnectionAPI.logout(),this.setIsUserLoggedIn(!1)}async createTeacherIfDoesntExist(){return this.teacher?this.API.firestoreHOCAPI.createTeacherIfDoesntExist(this.teacher.id,this.teacher.name):(console.error("Teacher not set"),!1)}async createStudentIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentIfDoesntExist(e,t)}async createStudentDataIfDoesntExist(e,t){return this.API.firestoreHOCAPI.createStudentDataIfDoesntExist(e,t)}async createClassIfDoesntExist(e,t,n){return this.API.firestoreHOCAPI.createClassIfDoesntExist(e,t,n)}async addStudentToClass(e,t,n,o){var i=await this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);if(!i&&await this.createClassIfDoesntExist(e,t,n))return this.API.firestoreHOCAPI.addStudentToClassIfHasntBeenAddedAlready(e,o);return i}setStudentOrTeacher(e){var t;this.studentOrTeacher=e,this.publish(i.STUDENT_OR_TEACHER_CHANGED),this.userProfile?e===Bo.STUDENT?((t=new to(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setStudent(t)):e===Bo.TEACHER&&((t=new fo(this.userProfile.id,this.userProfile.name,this.API)).classess=this.userProfile.classess,this.setTeacher(t)):console.error("User profile not set")}setUserProfile(e){this.userProfile=e}setTeacher(e){this.teacher=e}setStudent(e){this.student=e}setIsUserLoggedIn(e){this.isUserLoggedIn=e,this.publish(i.IS_USER_LOGGED_IN_CHANGED)}onNewClassAnnouncement(e){this.publish(i.NEW_CLASS_ANNOUNCEMENT,e)}subscribe(e,t,n){if(!Object.values(i).includes(t))throw new TypeError(`The type of event "${t}" is not valid. Valid types are: `+Object.values(i).join(", "));const o=new Y(e,t,n);e=this.observers.findIndex(e=>e.id===o.id);-1!==e&&this.observers.splice(e,1),this.observers.push(o)}unsubscribe(t){var e=this.observers.findIndex(e=>e.id===t);-1!==e&&this.observers.splice(e,1)}publish(t,n){this.observers.forEach(e=>e.notify(t,n))}};class k{static calculateWeightedAverageForScoreGivenIndicesAndWeights(t,n,o){if(0===n.length||0===t.length||0===o.length)return[0];let i=0;for(let e=0;e<n[0].length;e++){var a=n[0][e],r=o[e],a=t[a];i+=r*a}return[i/n[0].length]}static calculateWeightsGivenIndicesAndDates(e,t,n="automatic",o="minutes"){if(0===e.length||0===t.length)return[];var i=e[0].map(e=>t[e]).map(e=>I(e));const a=i[0];if("automatic"===n){var r=[];for(let e=0;e<i.length;e++){var s=Math.abs(a.diff(i[e],o));r.push(s)}const u=Math.max(...r),A=r.map(e=>{return 0===e&&0===u?1:e/u});return A}const A=i.map(e=>{e=a.diff(e,o);return Math.pow(.5,e/n)}),l=Math.max(...A);return A.map(e=>e/l)}}class wo{static calculateCIGivenMeanAndStd(e,t,n,o=1.96){return n<=0||t<0||o<=0?[NaN,NaN]:[e-(o=o*(t/Math.sqrt(n))),e+o]}}wo.boundUpperCI=(e,t)=>t;var yo=wo;class D{static calculateLeakyIntegratorScores(t,n,o,i=.1,a=.1,r=.1,s=1){var A=[0],l=[[0,1]];for(let e=1;e<t.length;e++){var u=A[e-1],c=this.adjustLowerBound(t[e],l[e-1][0],0,1,i,a),g=this.adjustUpperBound(0<t[e]?1:0,0===t[e]?l[e-1][1]:0,0,1,r,s),u=this.calculateLeakyScore(t[e],u,c,g,n,o);A.push(u),l.push([c,g])}return{leakyIntegratorScores:A,cis:l}}static calculateLeakyScore(e,t,n,o,i,a){var r=e-t;return 0<r?Math.max(n,Math.min(o,t+e*a*r)):0===e?Math.min(o,Math.max(n,t+(e-(e-n)-t)*i)):Math.max(n,Math.min(o,t+e*i*r))}static adjustUpperBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}static adjustLowerBound(e,t,n,o,i,a){return this.calculateLeakyScore(e,t,n,o,i,a)}}class Co{static calculateWindowIndices(e,t,n="minutes"){var o=e.map(e=>I(e)),i=[];let a=0;for(;a<o.length;){var r=o[a],s=i.length;for(let e=a;e<o.length;e++){if(!(o[e].diff(r,n)<=t)){a=e;break}if(e===o.length-1)return i[s]||(i[s]=[]),i[s].push(e),i;i[s]||(i[s]=[]),i[s].push(e)}}return i}}class Q extends Co{static calculateMovingAverageForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=0;for(let e=0;e<a.length;e++)t+=n[a[e]];i.push(t/a.length)}return i}static calculateMovingAverageForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]].valueOf();var r=t/a.length,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(r)}return i}static calculateMovingAverageForScore(t,n){if(n<=0||0===t.length)return[];var o=[];let i=0,a=0;for(let e=0;e<t.length;e++)i+=t[e],e>=n-1&&(o.push(i/n),i-=t[a],a++);return o}static calculateMovingAverageForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=0;for(let e=n;e<n+o;e++)t+=i[e].valueOf();var r=t/o,r=I(r).format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class x extends Co{static calculateMovingMaxForScoreGivenIndices(n,o){if(0===o.length||0===n.length)return[];var i=[];for(let e=0;e<o.length;e++){var a=o[e];let t=n[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<n.length&&(t=Math.max(t,n[r]))}i.push(t)}return i}static calculateMovingMaxForDatesGivenIndices(e,n){if(0===n.length||0===e.length)return[];var o=e.map(e=>I(e)),i=[];for(let e=0;e<n.length;e++){var a=n[e];let t=o[a[0]];for(let e=0;e<a.length;e++){var r=a[e];r<o.length&&(r=o[r]).isAfter(t)&&(t=r)}var s=t.format("YYYY-MM-DDTHH:mm:ss[Z]");i.push(s)}return i}static calculateMovingMaxForScore(t,n){if(n<=0||0===t.length)return[];var o=[],i=[];for(let e=0;e<t.length;e++)i.push(t[e]),n<i.length&&i.shift(),e>=n-1&&o.push(Math.max(...i));return o}static calculateMovingMaxForDates(e,o){if(o<=0||0===e.length)return[];var i=e.map(e=>I(e)),a=[];for(let n=0;n<=i.length-o;n++){let t=i[n];for(let e=n;e<n+o;e++)i[e].isAfter(t)&&(t=i[e]);var r=t.format("YYYY-MM-DDTHH:mm:ss[Z]");a.push(r)}return a}}class N extends Co{static calculateMovingStdForScoreGivenIndices(o,t){if(0===t.length||0===o.length)return[];var i=[];for(let e=0;e<t.length;e++){var a=t[e];if(0===a.length)i.push(0);else{let t=0;for(let e=0;e<a.length;e++)t+=o[a[e]];var r=t/a.length;let n=0;for(let e=0;e<a.length;e++)n+=Math.pow(o[a[e]]-r,2);i.push(Math.sqrt(n/a.length))}}return i}static calculateMovingStdForScore(t,n){if(n<=0||0===t.length)return[];var o,i=[];let a=0,r=0,s=0;for(let e=0;e<t.length;e++)a+=t[e],r+=t[e]*t[e],e>=n-1&&(o=a/n,o=r/n-o*o,i.push(Math.sqrt(o)),a-=t[s],r-=t[s]*t[s],s++);return i}}class O{static normaliseScores(e,t){const n=t[0],o=t[1];return e.map(e=>(e-n)/(o-n))}}const bo={Conditionals:"Algorithms",Operators:"Algorithms","Synchronization and Messages":"Algorithms","Algorithms Dead Code Penalty":"Algorithms","Algorithms Composite Score":"Algorithms",Comments:"Analysis",Debugging:"Analysis",Naming:"Analysis","Analysis Dead Code Penalty":"Analysis","Analysis Composite Score":"Analysis",Functions:"Decomposition",Sequencing:"Decomposition",Parallelism:"Decomposition","Decomposition Composite Score":"Decomposition","Data Types":"Pattern Recognition and Data Representation","Variables and Data Structures":"Pattern Recognition and Data Representation",Loops:"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Repetition Penalty":"Pattern Recognition and Data Representation","Pattern Recognition and Data Representation Composite Score":"Pattern Recognition and Data Representation","Function Reuse":"Generalisation and Abstraction","Functions with Arguments":"Generalisation and Abstraction","Variables Instead of Literals":"Generalisation and Abstraction","Generalisation and Abstraction Composite Score":"Generalisation and Abstraction",Composite:"Composite"};function _(){return{average:[],std:[],n:[],ci:[],leaky:[]}}class Io{constructor(e){this.dates=[],this.conditionalsScores={scores:[]},this.operatorsScores={scores:[]},this.syncAndMessagesScores={scores:[]},this.algorithmsCompoScores={scores:[]},this.algorithmsDeadCodePenaltyScores={scores:[]},this.commentsScores={scores:[]},this.debuggingScores={scores:[]},this.namingScores={scores:[]},this.analysisCompoScores={scores:[]},this.analysisDeadCodePenaltyScores={scores:[]},this.functionsScores={scores:[]},this.sequencingScores={scores:[]},this.parallelismScores={scores:[]},this.decompositionCompoScores={scores:[]},this.dataTypesScores={scores:[]},this.variablesAndDataStructScores={scores:[]},this.loopsScores={scores:[]},this.patternRecAndDataRepPenaltyScores={scores:[]},this.patternRecAndDataRepCompoScores={scores:[]},this.functionReuseScores={scores:[]},this.functionWithArgsScores={scores:[]},this.variablesInsteadOfLiteralsScores={scores:[]},this.generalisationAndAbstrCompoScores={scores:[]},this.compositeScores={scores:[]},this.isSorted=!1,this.data=e,this.init()}init(){var e=Object.keys(this.data);const n=e.map(e=>this.data[e]["Dead Code"]["Dead Scripts Count"]),o=e.map(e=>this.data[e]["Dead Code"]["Total Scripts Count"]),i=e.map(e=>this.data[e].Repetition["Duplicate Scripts Count"]),a=e.map(e=>this.data[e].Repetition["Total Scripts Count"]);this.conditionalsScores.scores=e.map(e=>this.data[e].Algorithms.Conditionals),this.operatorsScores.scores=e.map(e=>this.data[e].Algorithms.Operators),this.syncAndMessagesScores.scores=e.map(e=>this.data[e].Algorithms["Synchronization and Messages"]),this.algorithmsDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.algorithmsCompoScores.scores=e.map((e,t)=>C.calculateAlgorithmsScore({"Synchronization and Messages":this.syncAndMessagesScores.scores[t],Operators:this.operatorsScores.scores[t],Conditionals:this.conditionalsScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.commentsScores.scores=e.map(e=>this.data[e].Analysis.Comments),this.debuggingScores.scores=e.map(e=>this.data[e].Analysis.Debugging),this.namingScores.scores=e.map(e=>this.data[e].Analysis.Naming),this.analysisDeadCodePenaltyScores.scores=e.map((e,t)=>n[t]/o[t]),this.analysisCompoScores.scores=e.map((e,t)=>C.calculateAnalysisScore({Comments:this.commentsScores.scores[t],Debugging:this.debuggingScores.scores[t],Naming:this.namingScores.scores[t]},{"Dead Scripts Count":n[t],"Total Scripts Count":o[t]})),this.functionsScores.scores=e.map(e=>this.data[e].Decomposition.Functions),this.sequencingScores.scores=e.map(e=>this.data[e].Decomposition.Sequencing),this.parallelismScores.scores=e.map(e=>this.data[e].Decomposition.Parallelism),this.decompositionCompoScores.scores=e.map((e,t)=>C.calculateDecompositionScore({Functions:this.functionsScores.scores[t],Sequencing:this.sequencingScores.scores[t],Parallelism:this.parallelismScores.scores[t]})),this.dataTypesScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Data Types"]),this.variablesAndDataStructScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"]["Variables and Data Structures"]),this.loopsScores.scores=e.map(e=>this.data[e]["Pattern Recognition and Data Representation"].Loops),this.patternRecAndDataRepPenaltyScores.scores=e.map((e,t)=>i[t]/a[t]),this.patternRecAndDataRepCompoScores.scores=e.map((e,t)=>C.calculatePatternRecognitionAndDataRepresentationScore({"Data Types":this.dataTypesScores.scores[t],"Variables and Data Structures":this.variablesAndDataStructScores.scores[t],Loops:this.loopsScores.scores[t]},{"Duplicate Scripts Count":i[t],"Total Scripts Count":a[t]})),this.functionReuseScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Function Reuse"]),this.functionWithArgsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Functions with Arguments"]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.data[e]["Generalisation and Abstraction"]["Variables Instead of Literals"]),this.generalisationAndAbstrCompoScores.scores=e.map((e,t)=>C.calculateGeneralisationAndAbstractionScore({"Function Reuse":this.functionReuseScores.scores[t],"Functions with Arguments":this.functionWithArgsScores.scores[t],"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores.scores[t]})),this.compositeScores.scores=e.map((e,t)=>jn.calculateCompositeScore({Algorithms:this.algorithmsCompoScores.scores[t],Analysis:this.analysisCompoScores.scores[t],Decomposition:this.decompositionCompoScores.scores[t],"Pattern Recognition and Data Representation":this.patternRecAndDataRepCompoScores.scores[t],"Generalisation and Abstraction":this.generalisationAndAbstrCompoScores.scores[t]})),this.dates=e}categoryNamesMap(){return{Conditionals:this.conditionalsScores,Operators:this.operatorsScores,"Synchronization and Messages":this.syncAndMessagesScores,"Algorithms Dead Code Penalty":this.algorithmsDeadCodePenaltyScores,"Algorithms Composite Score":this.algorithmsCompoScores,Comments:this.commentsScores,Debugging:this.debuggingScores,Naming:this.namingScores,"Analysis Dead Code Penalty":this.analysisDeadCodePenaltyScores,"Analysis Composite Score":this.analysisCompoScores,Functions:this.functionsScores,Sequencing:this.sequencingScores,Parallelism:this.parallelismScores,"Decomposition Composite Score":this.decompositionCompoScores,"Data Types":this.dataTypesScores,"Variables and Data Structures":this.variablesAndDataStructScores,Loops:this.loopsScores,"Pattern Recognition and Data Representation Repetition Penalty":this.patternRecAndDataRepPenaltyScores,"Pattern Recognition and Data Representation Composite Score":this.patternRecAndDataRepCompoScores,"Function Reuse":this.functionReuseScores,"Functions with Arguments":this.functionWithArgsScores,"Variables Instead of Literals":this.variablesInsteadOfLiteralsScores,"Generalisation and Abstraction Composite Score":this.generalisationAndAbstrCompoScores,Composite:this.compositeScores}}sort(){var e;this.isSorted||(e=this.dates.map((e,t)=>t).sort((e,t)=>{e=new Date(this.dates[e]),t=new Date(this.dates[t]);return e.getTime()-t.getTime()}),this.dates=e.map(e=>this.dates[e]),this.conditionalsScores.scores=e.map(e=>this.conditionalsScores.scores[e]),this.operatorsScores.scores=e.map(e=>this.operatorsScores.scores[e]),this.syncAndMessagesScores.scores=e.map(e=>this.syncAndMessagesScores.scores[e]),this.algorithmsDeadCodePenaltyScores.scores=e.map(e=>this.algorithmsDeadCodePenaltyScores.scores[e]),this.algorithmsCompoScores.scores=e.map(e=>this.algorithmsCompoScores.scores[e]),this.commentsScores.scores=e.map(e=>this.commentsScores.scores[e]),this.debuggingScores.scores=e.map(e=>this.debuggingScores.scores[e]),this.namingScores.scores=e.map(e=>this.namingScores.scores[e]),this.analysisDeadCodePenaltyScores.scores=e.map(e=>this.analysisDeadCodePenaltyScores.scores[e]),this.analysisCompoScores.scores=e.map(e=>this.analysisCompoScores.scores[e]),this.functionsScores.scores=e.map(e=>this.functionsScores.scores[e]),this.sequencingScores.scores=e.map(e=>this.sequencingScores.scores[e]),this.parallelismScores.scores=e.map(e=>this.parallelismScores.scores[e]),this.decompositionCompoScores.scores=e.map(e=>this.decompositionCompoScores.scores[e]),this.dataTypesScores.scores=e.map(e=>this.dataTypesScores.scores[e]),this.variablesAndDataStructScores.scores=e.map(e=>this.variablesAndDataStructScores.scores[e]),this.loopsScores.scores=e.map(e=>this.loopsScores.scores[e]),this.patternRecAndDataRepPenaltyScores.scores=e.map(e=>this.patternRecAndDataRepPenaltyScores.scores[e]),this.patternRecAndDataRepCompoScores.scores=e.map(e=>this.patternRecAndDataRepCompoScores.scores[e]),this.functionReuseScores.scores=e.map(e=>this.functionReuseScores.scores[e]),this.functionWithArgsScores.scores=e.map(e=>this.functionWithArgsScores.scores[e]),this.variablesInsteadOfLiteralsScores.scores=e.map(e=>this.variablesInsteadOfLiteralsScores.scores[e]),this.generalisationAndAbstrCompoScores.scores=e.map(e=>this.generalisationAndAbstrCompoScores.scores[e]),this.compositeScores.scores=e.map(e=>this.compositeScores.scores[e]),this.isSorted=!0)}calculateMovingStdBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScore(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScore(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScore(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,e)}calculateMovingStdBasedOnDates(e,t="minutes"){e=N.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDataPoints(e){this.dates=Q.calculateMovingAverageForDates(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScore(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScore(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScore(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScore(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScore(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScore(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScore(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScore(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScore(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScore(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScore(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=Q.calculateMovingAverageForScore(this.compositeScores.scores,e)}calculateMovingAverageBasedOnDates(e,t="minutes"){e=Q.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.analysisCompoScores.scores=Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e)}calculateMovingConfidenceIntervals(e,t,n="minutes"){let o;o="dataPoints"===t?this.getMovingAverageAndStdBasedOnDataPoints(e):this.getMovingAverageAndStdBasedOnDates(e,n);var i={"Algorithms Composite Score":_(),"Analysis Composite Score":_(),"Decomposition Composite Score":_(),"Pattern Recognition and Data Representation Composite Score":_(),"Generalisation and Abstraction Composite Score":_(),Composite:_(),"Algorithms Dead Code Penalty":_(),"Analysis Dead Code Penalty":_(),"Pattern Recognition and Data Representation Repetition Penalty":_(),Conditionals:_(),Operators:_(),"Synchronization and Messages":_(),Comments:_(),Debugging:_(),Naming:_(),Functions:_(),Sequencing:_(),Parallelism:_(),"Data Types":_(),"Variables and Data Structures":_(),Loops:_(),"Function Reuse":_(),"Functions with Arguments":_(),"Variables Instead of Literals":_()};for(const s of Object.keys(o))if("dates"!==s){var a=o[s];for(let e=0;e<a.average.length;e++){var r=yo.calculateCIGivenMeanAndStd(a.average[e],a.std[e],a.n[e]);a.ci||(a.ci=[]),a.ci.push(yo.boundUpperCI(s,r))}i[s]={average:a.average,std:a.std,n:a.n,ci:a.ci}}this.conditionalsScores={scores:i.Conditionals.average,averages:i.Conditionals.average,stds:i.Conditionals.std,cis:i.Conditionals.ci},this.operatorsScores={scores:i.Operators.average,averages:i.Operators.average,stds:i.Operators.std,cis:i.Operators.ci},this.syncAndMessagesScores={scores:i["Synchronization and Messages"].average,averages:i["Synchronization and Messages"].average,stds:i["Synchronization and Messages"].std,cis:i["Synchronization and Messages"].ci},this.algorithmsDeadCodePenaltyScores={scores:i["Algorithms Dead Code Penalty"].average,averages:i["Algorithms Dead Code Penalty"].average,stds:i["Algorithms Dead Code Penalty"].std,cis:i["Algorithms Dead Code Penalty"].ci},this.algorithmsCompoScores={scores:i["Algorithms Composite Score"].average,averages:i["Algorithms Composite Score"].average,stds:i["Algorithms Composite Score"].std,cis:i["Algorithms Composite Score"].ci},this.commentsScores={scores:i.Comments.average,averages:i.Comments.average,stds:i.Comments.std,cis:i.Comments.ci},this.debuggingScores={scores:i.Debugging.average,averages:i.Debugging.average,stds:i.Debugging.std,cis:i.Debugging.ci},this.namingScores={scores:i.Naming.average,averages:i.Naming.average,stds:i.Naming.std,cis:i.Naming.ci},this.analysisDeadCodePenaltyScores={scores:i["Analysis Dead Code Penalty"].average,averages:i["Analysis Dead Code Penalty"].average,stds:i["Analysis Dead Code Penalty"].std,cis:i["Analysis Dead Code Penalty"].ci},this.analysisCompoScores={scores:i["Analysis Composite Score"].average,averages:i["Analysis Composite Score"].average,stds:i["Analysis Composite Score"].std,cis:i["Analysis Composite Score"].ci},this.functionsScores={scores:i.Functions.average,averages:i.Functions.average,stds:i.Functions.std,cis:i.Functions.ci},this.sequencingScores={scores:i.Sequencing.average,averages:i.Sequencing.average,stds:i.Sequencing.std,cis:i.Sequencing.ci},this.parallelismScores={scores:i.Parallelism.average,averages:i.Parallelism.average,stds:i.Parallelism.std,cis:i.Parallelism.ci},this.decompositionCompoScores={scores:i["Decomposition Composite Score"].average,averages:i["Decomposition Composite Score"].average,stds:i["Decomposition Composite Score"].std,cis:i["Decomposition Composite Score"].ci},this.dataTypesScores={scores:i["Data Types"].average,averages:i["Data Types"].average,stds:i["Data Types"].std,cis:i["Data Types"].ci},this.variablesAndDataStructScores={scores:i["Variables and Data Structures"].average,averages:i["Variables and Data Structures"].average,stds:i["Variables and Data Structures"].std,cis:i["Variables and Data Structures"].ci},this.loopsScores={scores:i.Loops.average,averages:i.Loops.average,stds:i.Loops.std,cis:i.Loops.ci},this.patternRecAndDataRepPenaltyScores={scores:i["Pattern Recognition and Data Representation Repetition Penalty"].average,averages:i["Pattern Recognition and Data Representation Repetition Penalty"].average,stds:i["Pattern Recognition and Data Representation Repetition Penalty"].std,cis:i["Pattern Recognition and Data Representation Repetition Penalty"].ci},this.patternRecAndDataRepCompoScores={scores:i["Pattern Recognition and Data Representation Composite Score"].average,averages:i["Pattern Recognition and Data Representation Composite Score"].average,stds:i["Pattern Recognition and Data Representation Composite Score"].std,cis:i["Pattern Recognition and Data Representation Composite Score"].ci},this.functionReuseScores={scores:i["Function Reuse"].average,averages:i["Function Reuse"].average,stds:i["Function Reuse"].std,cis:i["Function Reuse"].ci},this.functionWithArgsScores={scores:i["Functions with Arguments"].average,averages:i["Functions with Arguments"].average,stds:i["Functions with Arguments"].std,cis:i["Functions with Arguments"].ci},this.variablesInsteadOfLiteralsScores={scores:i["Variables Instead of Literals"].average,averages:i["Variables Instead of Literals"].average,stds:i["Variables Instead of Literals"].std,cis:i["Variables Instead of Literals"].ci},this.generalisationAndAbstrCompoScores={scores:i["Generalisation and Abstraction Composite Score"].average,averages:i["Generalisation and Abstraction Composite Score"].average,stds:i["Generalisation and Abstraction Composite Score"].std,cis:i["Generalisation and Abstraction Composite Score"].ci},this.compositeScores={scores:i.Composite.average,averages:i.Composite.average,stds:i.Composite.std,cis:i.Composite.ci}}normaliseScores(){this.conditionalsScores.scores=O.normaliseScores(this.conditionalsScores.scores,v.Conditionals.range),this.operatorsScores.scores=O.normaliseScores(this.operatorsScores.scores,v.Operators.range),this.syncAndMessagesScores.scores=O.normaliseScores(this.syncAndMessagesScores.scores,v.SynchAndMessages.range),this.algorithmsCompoScores.scores=O.normaliseScores(this.algorithmsCompoScores.scores,v.Algorithms.range),this.commentsScores.scores=O.normaliseScores(this.commentsScores.scores,v.Comments.range),this.debuggingScores.scores=O.normaliseScores(this.debuggingScores.scores,v.Debugging.range),this.namingScores.scores=O.normaliseScores(this.namingScores.scores,v.Naming.range),this.analysisCompoScores.scores=O.normaliseScores(this.analysisCompoScores.scores,v.Analysis.range),this.functionsScores.scores=O.normaliseScores(this.functionsScores.scores,v.Functions.range),this.sequencingScores.scores=O.normaliseScores(this.sequencingScores.scores,v.Sequencing.range),this.parallelismScores.scores=O.normaliseScores(this.parallelismScores.scores,v.Parallelism.range),this.decompositionCompoScores.scores=O.normaliseScores(this.decompositionCompoScores.scores,v.Decomposition.range),this.dataTypesScores.scores=O.normaliseScores(this.dataTypesScores.scores,v.DataTypes.range),this.variablesAndDataStructScores.scores=O.normaliseScores(this.variablesAndDataStructScores.scores,v.VariablesAndDataStructures.range),this.loopsScores.scores=O.normaliseScores(this.loopsScores.scores,v.Loops.range),this.patternRecAndDataRepCompoScores.scores=O.normaliseScores(this.patternRecAndDataRepCompoScores.scores,v.PatternRecognitionAndDataRepresentation.range),this.functionReuseScores.scores=O.normaliseScores(this.functionReuseScores.scores,v.FunctionReUse.range),this.functionWithArgsScores.scores=O.normaliseScores(this.functionWithArgsScores.scores,v.Functions.range),this.variablesInsteadOfLiteralsScores.scores=O.normaliseScores(this.variablesInsteadOfLiteralsScores.scores,v.VariablesInsteadOfLiterals.range),this.generalisationAndAbstrCompoScores.scores=O.normaliseScores(this.generalisationAndAbstrCompoScores.scores,v.GeneralisationAndAbstraction.range)}calculateMovingMaxBasedOnDates(e,t="minutes"){e=Co.calculateWindowIndices(this.dates,e,t);this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),this.conditionalsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.conditionalsScores.scores,e),this.operatorsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.operatorsScores.scores,e),this.syncAndMessagesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.syncAndMessagesScores.scores,e),this.algorithmsDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),this.algorithmsCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.algorithmsCompoScores.scores,e),this.commentsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.commentsScores.scores,e),this.debuggingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.debuggingScores.scores,e),this.namingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.namingScores.scores,e),this.analysisDeadCodePenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),this.analysisCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.analysisCompoScores.scores,e),this.functionsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionsScores.scores,e),this.sequencingScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.sequencingScores.scores,e),this.parallelismScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.parallelismScores.scores,e),this.decompositionCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.decompositionCompoScores.scores,e),this.dataTypesScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.dataTypesScores.scores,e),this.variablesAndDataStructScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),this.loopsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.loopsScores.scores,e),this.patternRecAndDataRepPenaltyScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),this.patternRecAndDataRepCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),this.functionReuseScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionReuseScores.scores,e),this.functionWithArgsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.functionWithArgsScores.scores,e),this.variablesInsteadOfLiteralsScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),this.generalisationAndAbstrCompoScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),this.compositeScores.scores=x.calculateMovingMaxForScoreGivenIndices(this.compositeScores.scores,e)}calculateLeakyIntegrator(e,t,n,o,i,a){var r=D.calculateLeakyIntegratorScores(this.conditionalsScores.scores,e,t,n,o,i,a),r=(this.conditionalsScores.leakyScores=r.leakyIntegratorScores,this.conditionalsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.operatorsScores.scores,e,t,n,o,i,a)),r=(this.operatorsScores.leakyScores=r.leakyIntegratorScores,this.operatorsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.syncAndMessagesScores.scores,e,t,n,o,i,a)),r=(this.syncAndMessagesScores.leakyScores=r.leakyIntegratorScores,this.syncAndMessagesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.algorithmsDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.algorithmsDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.algorithmsCompoScores.scores,e,t,n,o,i,a)),r=(this.algorithmsCompoScores.leakyScores=r.leakyIntegratorScores,this.algorithmsCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.commentsScores.scores,e,t,n,o,i,a)),r=(this.commentsScores.leakyScores=r.leakyIntegratorScores,this.commentsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.debuggingScores.scores,e,t,n,o,i,a)),r=(this.debuggingScores.leakyScores=r.leakyIntegratorScores,this.debuggingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.namingScores.scores,e,t,n,o,i,a)),r=(this.namingScores.leakyScores=r.leakyIntegratorScores,this.namingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisDeadCodePenaltyScores.scores,e,t,n,o,i,a)),r=(this.analysisDeadCodePenaltyScores.leakyScores=r.leakyIntegratorScores,this.analysisDeadCodePenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.analysisCompoScores.scores,e,t,n,o,i,a)),r=(this.analysisCompoScores.leakyScores=r.leakyIntegratorScores,this.analysisCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionsScores.scores,e,t,n,o,i,a)),r=(this.functionsScores.leakyScores=r.leakyIntegratorScores,this.functionsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.sequencingScores.scores,e,t,n,o,i,a)),r=(this.sequencingScores.leakyScores=r.leakyIntegratorScores,this.sequencingScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.parallelismScores.scores,e,t,n,o,i,a)),r=(this.parallelismScores.leakyScores=r.leakyIntegratorScores,this.parallelismScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.decompositionCompoScores.scores,e,t,n,o,i,a)),r=(this.decompositionCompoScores.leakyScores=r.leakyIntegratorScores,this.decompositionCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.dataTypesScores.scores,e,t,n,o,i,a)),r=(this.dataTypesScores.leakyScores=r.leakyIntegratorScores,this.dataTypesScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesAndDataStructScores.scores,e,t,n,o,i,a)),r=(this.variablesAndDataStructScores.leakyScores=r.leakyIntegratorScores,this.variablesAndDataStructScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.loopsScores.scores,e,t,n,o,i,a)),r=(this.loopsScores.leakyScores=r.leakyIntegratorScores,this.loopsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepPenaltyScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepPenaltyScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepPenaltyScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.patternRecAndDataRepCompoScores.scores,e,t,n,o,i,a)),r=(this.patternRecAndDataRepCompoScores.leakyScores=r.leakyIntegratorScores,this.patternRecAndDataRepCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionReuseScores.scores,e,t,n,o,i,a)),r=(this.functionReuseScores.leakyScores=r.leakyIntegratorScores,this.functionReuseScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.functionWithArgsScores.scores,e,t,n,o,i,a)),r=(this.functionWithArgsScores.leakyScores=r.leakyIntegratorScores,this.functionWithArgsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.variablesInsteadOfLiteralsScores.scores,e,t,n,o,i,a)),r=(this.variablesInsteadOfLiteralsScores.leakyScores=r.leakyIntegratorScores,this.variablesInsteadOfLiteralsScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.generalisationAndAbstrCompoScores.scores,e,t,n,o,i,a)),r=(this.generalisationAndAbstrCompoScores.leakyScores=r.leakyIntegratorScores,this.generalisationAndAbstrCompoScores.cis=r.cis,D.calculateLeakyIntegratorScores(this.compositeScores.scores,e,t,n,o,i,a));this.compositeScores.leakyScores=r.leakyIntegratorScores,this.compositeScores.cis=r.cis}getMovingAverageAndStdBasedOnDataPoints(t){this.dates=Q.calculateMovingAverageForDates(this.dates,t);var e=this.dates.map(e=>t),n={average:Q.calculateMovingAverageForScore(this.conditionalsScores.scores,t),std:N.calculateMovingStdForScore(this.conditionalsScores.scores,t),n:e},o={average:Q.calculateMovingAverageForScore(this.operatorsScores.scores,t),std:N.calculateMovingStdForScore(this.operatorsScores.scores,t),n:e},i={average:Q.calculateMovingAverageForScore(this.syncAndMessagesScores.scores,t),std:N.calculateMovingStdForScore(this.syncAndMessagesScores.scores,t),n:e},a={average:Q.calculateMovingAverageForScore(this.algorithmsDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsDeadCodePenaltyScores.scores,t),n:e},r={average:Q.calculateMovingAverageForScore(this.algorithmsCompoScores.scores,t),std:N.calculateMovingStdForScore(this.algorithmsCompoScores.scores,t),n:e},s={average:Q.calculateMovingAverageForScore(this.commentsScores.scores,t),std:N.calculateMovingStdForScore(this.commentsScores.scores,t),n:e},A={average:Q.calculateMovingAverageForScore(this.debuggingScores.scores,t),std:N.calculateMovingStdForScore(this.debuggingScores.scores,t),n:e},l={average:Q.calculateMovingAverageForScore(this.namingScores.scores,t),std:N.calculateMovingStdForScore(this.namingScores.scores,t),n:e},u={average:Q.calculateMovingAverageForScore(this.analysisDeadCodePenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.analysisDeadCodePenaltyScores.scores,t),n:e},c={average:Q.calculateMovingAverageForScore(this.analysisCompoScores.scores,t),std:N.calculateMovingStdForScore(this.analysisCompoScores.scores,t),n:e},g={average:Q.calculateMovingAverageForScore(this.functionsScores.scores,t),std:N.calculateMovingStdForScore(this.functionsScores.scores,t),n:e},d={average:Q.calculateMovingAverageForScore(this.sequencingScores.scores,t),std:N.calculateMovingStdForScore(this.sequencingScores.scores,t),n:e},h={average:Q.calculateMovingAverageForScore(this.parallelismScores.scores,t),std:N.calculateMovingStdForScore(this.parallelismScores.scores,t),n:e},p={average:Q.calculateMovingAverageForScore(this.decompositionCompoScores.scores,t),std:N.calculateMovingStdForScore(this.decompositionCompoScores.scores,t),n:e},m={average:Q.calculateMovingAverageForScore(this.dataTypesScores.scores,t),std:N.calculateMovingStdForScore(this.dataTypesScores.scores,t),n:e},f={average:Q.calculateMovingAverageForScore(this.variablesAndDataStructScores.scores,t),std:N.calculateMovingStdForScore(this.variablesAndDataStructScores.scores,t),n:e},B={average:Q.calculateMovingAverageForScore(this.loopsScores.scores,t),std:N.calculateMovingStdForScore(this.loopsScores.scores,t),n:e},E={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepPenaltyScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepPenaltyScores.scores,t),n:e},w={average:Q.calculateMovingAverageForScore(this.patternRecAndDataRepCompoScores.scores,t),std:N.calculateMovingStdForScore(this.patternRecAndDataRepCompoScores.scores,t),n:e},y={average:Q.calculateMovingAverageForScore(this.functionReuseScores.scores,t),std:N.calculateMovingStdForScore(this.functionReuseScores.scores,t),n:e},C={average:Q.calculateMovingAverageForScore(this.functionWithArgsScores.scores,t),std:N.calculateMovingStdForScore(this.functionWithArgsScores.scores,t),n:e},b={average:Q.calculateMovingAverageForScore(this.variablesInsteadOfLiteralsScores.scores,t),std:N.calculateMovingStdForScore(this.variablesInsteadOfLiteralsScores.scores,t),n:e},I={average:Q.calculateMovingAverageForScore(this.generalisationAndAbstrCompoScores.scores,t),std:N.calculateMovingStdForScore(this.generalisationAndAbstrCompoScores.scores,t),n:e},e={average:Q.calculateMovingAverageForScore(this.compositeScores.scores,t),std:N.calculateMovingStdForScore(this.compositeScores.scores,t),n:e};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}getMovingAverageAndStdBasedOnDates(e,t="minutes"){var e=Q.calculateWindowIndices(this.dates,e,t),t=e.map(e=>e.length),n=(this.dates=Q.calculateMovingAverageForDatesGivenIndices(this.dates,e),{average:Q.calculateMovingAverageForScoreGivenIndices(this.conditionalsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.conditionalsScores.scores,e),n:t}),o={average:Q.calculateMovingAverageForScoreGivenIndices(this.operatorsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.operatorsScores.scores,e),n:t},i={average:Q.calculateMovingAverageForScoreGivenIndices(this.syncAndMessagesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.syncAndMessagesScores.scores,e),n:t},a={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsDeadCodePenaltyScores.scores,e),n:t},r={average:Q.calculateMovingAverageForScoreGivenIndices(this.algorithmsCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.algorithmsCompoScores.scores,e),n:t},s={average:Q.calculateMovingAverageForScoreGivenIndices(this.commentsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.commentsScores.scores,e),n:t},A={average:Q.calculateMovingAverageForScoreGivenIndices(this.debuggingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.debuggingScores.scores,e),n:t},l={average:Q.calculateMovingAverageForScoreGivenIndices(this.namingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.namingScores.scores,e),n:t},u={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisDeadCodePenaltyScores.scores,e),n:t},c={average:Q.calculateMovingAverageForScoreGivenIndices(this.analysisCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.analysisCompoScores.scores,e),n:t},g={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionsScores.scores,e),n:t},d={average:Q.calculateMovingAverageForScoreGivenIndices(this.sequencingScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.sequencingScores.scores,e),n:t},h={average:Q.calculateMovingAverageForScoreGivenIndices(this.parallelismScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.parallelismScores.scores,e),n:t},p={average:Q.calculateMovingAverageForScoreGivenIndices(this.decompositionCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.decompositionCompoScores.scores,e),n:t},m={average:Q.calculateMovingAverageForScoreGivenIndices(this.dataTypesScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.dataTypesScores.scores,e),n:t},f={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesAndDataStructScores.scores,e),n:t},B={average:Q.calculateMovingAverageForScoreGivenIndices(this.loopsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.loopsScores.scores,e),n:t},E={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepPenaltyScores.scores,e),n:t},w={average:Q.calculateMovingAverageForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.patternRecAndDataRepCompoScores.scores,e),n:t},y={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionReuseScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionReuseScores.scores,e),n:t},C={average:Q.calculateMovingAverageForScoreGivenIndices(this.functionWithArgsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.functionWithArgsScores.scores,e),n:t},b={average:Q.calculateMovingAverageForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.variablesInsteadOfLiteralsScores.scores,e),n:t},I={average:Q.calculateMovingAverageForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.generalisationAndAbstrCompoScores.scores,e),n:t},e={average:Q.calculateMovingAverageForScoreGivenIndices(this.compositeScores.scores,e),std:N.calculateMovingStdForScoreGivenIndices(this.compositeScores.scores,e),n:t};return{dates:this.dates,"Algorithms Composite Score":r,"Algorithms Dead Code Penalty":a,"Analysis Composite Score":c,"Analysis Dead Code Penalty":u,Conditionals:n,Comments:s,"Data Types":m,"Decomposition Composite Score":p,Debugging:A,"Pattern Recognition and Data Representation Repetition Penalty":E,Sequencing:d,"Function Reuse":y,"Functions with Arguments":C,Functions:g,"Generalisation and Abstraction Composite Score":I,Parallelism:h,Loops:B,Naming:l,Operators:o,"Pattern Recognition and Data Representation Composite Score":w,"Synchronization and Messages":i,"Variables and Data Structures":f,"Variables Instead of Literals":b,Composite:e}}calculateCompositeScoreOverTime(){var t=[];for(let e=0;e<this.dates.length;e++){var n=jn.calculateCompositeScore({algorithmsCompoScores:this.algorithmsCompoScores.scores[e],analysisCompoScores:this.analysisCompoScores.scores[e],decompositionCompoScores:this.decompositionCompoScores.scores[e],patternRecAndDataRepCompoScores:this.patternRecAndDataRepCompoScores.scores[e],generalisationAndAbstrCompoScores:this.generalisationAndAbstrCompoScores.scores[e]});t.push(n)}this.compositeScores.scores=t}calculateAverageGivenTimeWindow(e,t,n="minutes"){this.isSorted||this.sort();e=class{static calculateWindowIndicesFromLastTimestamp(t,n,o="minutes"){var i=t.map(e=>I(e)),a=[],t=i.length-1,r=i[t],s=a.length;for(let e=t;0<=e;e--)r.diff(i[e],o)<=n?(a[s]||(a[s]=[]),a[s].push(e)):e;return a}}.calculateWindowIndicesFromLastTimestamp(this.dates,e,n),t=k.calculateWeightsGivenIndicesAndDates(e,this.dates,t,n);this.conditionalsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.conditionalsScores.scores,e,t),this.operatorsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.operatorsScores.scores,e,t),this.syncAndMessagesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.syncAndMessagesScores.scores,e,t),this.algorithmsDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsDeadCodePenaltyScores.scores,e,t),this.algorithmsCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.algorithmsCompoScores.scores,e,t),this.commentsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.commentsScores.scores,e,t),this.debuggingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.debuggingScores.scores,e,t),this.namingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.namingScores.scores,e,t),this.analysisDeadCodePenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisDeadCodePenaltyScores.scores,e,t),this.analysisCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.analysisCompoScores.scores,e,t),this.functionsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionsScores.scores,e,t),this.sequencingScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.sequencingScores.scores,e,t),this.parallelismScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.parallelismScores.scores,e,t),this.decompositionCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.decompositionCompoScores.scores,e,t),this.dataTypesScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.dataTypesScores.scores,e,t),this.variablesAndDataStructScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesAndDataStructScores.scores,e,t),this.loopsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.loopsScores.scores,e,t),this.patternRecAndDataRepPenaltyScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepPenaltyScores.scores,e,t),this.patternRecAndDataRepCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.patternRecAndDataRepCompoScores.scores,e,t),this.functionReuseScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionReuseScores.scores,e,t),this.functionWithArgsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.functionWithArgsScores.scores,e,t),this.variablesInsteadOfLiteralsScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.variablesInsteadOfLiteralsScores.scores,e,t),this.generalisationAndAbstrCompoScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.generalisationAndAbstrCompoScores.scores,e,t),this.compositeScores.scores=k.calculateWeightedAverageForScoreGivenIndicesAndWeights(this.compositeScores.scores,e,t)}exportToLineGraphData(t,e){var n=[];if("scores"===e)for(let e=0;e<t.length;e++){const r=t[e],s=bo[r];n.push({x:this.dates,y:this.categoryNamesMap()[r].scores,name:vo(r,20),legendgroup:s,hoverinfo:"text",text:this.categoryNamesMap()[r].scores.map((e,t)=>`${s}<br>${r}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"})}else{if("ci"!==e)return[];for(let e=0;e<t.length;e++){const A=t[e],l=bo[A];var o=this.categoryNamesMap()[A],i=null==(i=o.cis)?void 0:i.map(e=>e[0]),a=null==(a=o.cis)?void 0:a.map(e=>e[1]);n.push({x:this.dates,y:o.scores,name:vo(A,20),legendgroup:l,hoverinfo:"text",text:o.scores.map((e,t)=>`${l}<br>${A}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),n.push({x:this.dates,y:a,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),n.push({x:this.dates,y:i,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}}return n}exportToSpiderGraphData(t,e,n=!1){var o={};if("scores"!==e)return[];if(n)for(let e=0;e<t.length;e++){var i=t[e],a=bo[i];o[a]||(o[a]={type:"scatterpolar",r:[],theta:[],fill:"",name:a}),o[a].r.push(this.categoryNamesMap()[i].scores[0]),o[a].theta.push(i)}else o.Average={type:"scatterpolar",r:t.map(e=>this.categoryNamesMap()[e].scores[0]),theta:t.map(e=>bo[e]),fill:"toself",name:"Average"};return Object.values(o)}exportToHeatMapData(t,e){var n=[];if("scores"!==e)return[];var o=[];for(let e=0;e<t.length;e++){var i=t[e];o.push(this.categoryNamesMap()[i].scores)}return n.push({x:this.dates,y:t,z:o,type:"heatmap",colorscale:"BuGn"}),n}exportToLeakyIntegratorData(n){var o=[];for(let t=0;t<n.length;t++){const s=n[t],A=bo[s];var i=this.categoryNamesMap()[s];let e=!1;i.cis&&0<i.cis.length&&(e=!0);var a=null==(a=i.cis)?void 0:a.map(e=>e[0]),r=null==(r=i.cis)?void 0:r.map(e=>e[1]);o.push({x:this.dates.map((e,t)=>t),y:i.scores,name:vo(s,20),type:"bar"}),o.push({x:this.dates.map((e,t)=>t),y:i.leakyScores,name:vo("Leaky "+s,20),legendgroup:A,hoverinfo:"text",text:null==(i=i.leakyScores)?void 0:i.map((e,t)=>`${A}<br>${s}<br>Score: ${e.toFixed(2)}<br>Date: `+this.dates[t]),type:"scatter",mode:"markers+lines"}),e&&o.push({x:this.dates.map((e,t)=>t),y:r,name:"Upper bound",type:"scatter",mode:"markers+lines",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}}),e&&o.push({x:this.dates.map((e,t)=>t),y:a,name:"Lower bound",type:"scatter",mode:"markers+lines",fill:"tonexty",fillcolor:"rgba(255, 0, 0, 0.2)",line:{color:"rgba(255, 0, 0, 0.2)"}})}return o}}function vo(e,t){return e.length>t?e.substr(0,t-1)+"...":e}class Mo{constructor(e){this.data=new Io(e)}sortData(){return this.data.sort(),this}normaliseScores(){return this.data.normaliseScores(),this}calculateMovingAverageBasedOnDataPoints(e){return this.data.calculateMovingAverageBasedOnDataPoints(e),this}calculateMovingAverageBasedOnDates(e,t="minutes"){return this.data.calculateMovingAverageBasedOnDates(e,t),this}calculateMovingStdBasedOnDataPoints(e){return this.data.calculateMovingStdBasedOnDataPoints(e),this}calculateMovingStdBasedOnDates(e,t="minutes"){return this.data.calculateMovingStdBasedOnDates(e,t),this}calculateCompositeScoreOverTime(){return this.data.calculateCompositeScoreOverTime(),this}calculateAverageGivenTimeWindow(e,t="automatic",n="minutes"){return this.data.calculateAverageGivenTimeWindow(e,t,n),this}calculateMovingConfidenceIntervals(e,t="dataPoints",n="minutes"){return this.data.calculateMovingConfidenceIntervals(e,t,n),this}calculateMovingMaxBasedOnDates(e,t="minutes"){return this.data.calculateMovingMaxBasedOnDates(e,t),this}calculateLeakyIntegrator(e,t,n,o,i,a){return this.data.calculateLeakyIntegrator(e,t,n,o,i,a),this}exportToLineGraphData(e=[],t="scores"){return this.data.exportToLineGraphData(e,t)}exportToSpiderGraphData(e=[],t="scores",n=!1){return this.data.exportToSpiderGraphData(e,t,n)}exportToHeatMapData(e=[],t="scores"){return this.data.exportToHeatMapData(e,t)}exportToLeakyIntegratorData(e=[]){return this.data.exportToLeakyIntegratorData(e)}}class To{static compareStars(i){const a={},r=To.previousStars;return r?(Object.keys(i).forEach(e=>{const n=r[e]?r[e][1]:[];var t=i[e][1];const o=i[e][0];a[e]=t.map((e,t)=>1===e&&1!==n[t]&&o[t])}),To.previousStars=i):(To.previousStars=i,Object.keys(i).forEach(e=>{var t=i[e][1];const n=i[e][0];a[e]=t.map((e,t)=>1===e&&n[t])})),a}}To.previousStars=null;var So=To;R.default=t},function(F,e,t){"use strict";function n(e,t){return e.parent===t.parent?1:2}function c(e,t){return e+t.x}function g(e,t){return Math.max(e,t.y)}t.r(e),t.d(e,"cluster",function(){return o}),t.d(e,"hierarchy",function(){return a}),t.d(e,"pack",function(){return P}),t.d(e,"packSiblings",function(){return L}),t.d(e,"packEnclose",function(){return p}),t.d(e,"partition",function(){return H}),t.d(e,"stratify",function(){return W}),t.d(e,"tree",function(){return K}),t.d(e,"treemap",function(){return X}),t.d(e,"treemapBinary",function(){return q}),t.d(e,"treemapDice",function(){return S}),t.d(e,"treemapSlice",function(){return N}),t.d(e,"treemapSliceDice",function(){return Z}),t.d(e,"treemapSquarify",function(){return _}),t.d(e,"treemapResquarify",function(){return $});var o=function(){var s=n,A=1,l=1,u=!1;function t(t){var o,i=0,e=(t.eachAfter(function(e){var t,n=e.children;n?(e.x=(t=n).reduce(c,0)/t.length,e.y=1+n.reduce(g,0)):(e.x=o?i+=s(e,o):0,e.y=0,o=e)}),function(e){for(var t;t=e.children;)e=t[0];return e}(t)),n=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(t),a=e.x-s(e,n)/2,r=n.x+s(n,e)/2;return t.eachAfter(u?function(e){e.x=(e.x-t.x)*A,e.y=(t.y-e.y)*l}:function(e){e.x=(e.x-a)/(r-a)*A,e.y=(1-(t.y?e.y/t.y:1))*l})}return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=!1,A=+e[0],l=+e[1],t):u?null:[A,l]},t.nodeSize=function(e){return arguments.length?(u=!0,A=+e[0],l=+e[1],t):u?[A,l]:null},t};function i(e){var t=0,n=e.children,o=n&&n.length;if(o)for(;0<=--o;)t+=n[o].value;else t=1;e.value=t}function a(e,t){var n,o,i,a,r,s=new h(e),A=+e.value&&(s.value=e.value),l=[s];for(null==t&&(t=R);n=l.pop();)if(A&&(n.value=+n.data.value),(i=t(n.data))&&(r=i.length))for(n.children=new Array(r),a=r-1;0<=a;--a)l.push(o=n.children[a]=new h(i[a])),o.parent=n,o.depth=n.depth+1;return s.eachBefore(d)}function R(e){return e.children}function Y(e){e.data=e.data.data}function d(e){for(var t=0;e.height=t,(e=e.parent)&&e.height<++t;);}function h(e){this.data=e,this.depth=this.height=0,this.parent=null}h.prototype=a.prototype={constructor:h,count:function(){return this.eachAfter(i)},each:function(e){var t,n,o,i,a,r=[this];do{for(n=r.reverse(),r=[];t=n.pop();)if(e(t),o=t.children)for(i=0,a=o.length;i<a;++i)r.push(o[i])}while(r.length);return this},eachAfter:function(e){for(var t,n,o,i=this,a=[i],r=[];i=a.pop();)if(r.push(i),t=i.children)for(n=0,o=t.length;n<o;++n)a.push(t[n]);for(;i=r.pop();)e(i);return this},eachBefore:function(e){for(var t,n,o,i=[this];t=i.pop();)if(e(t),n=t.children)for(o=n.length-1;0<=o;--o)i.push(n[o]);return this},sum:function(i){return this.eachAfter(function(e){for(var t=+i(e.data)||0,n=e.children,o=n&&n.length;0<=--o;)t+=n[o].value;e.value=t})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),o=t.ancestors(),i=null;e=n.pop(),t=o.pop();for(;e===t;)i=e,e=n.pop(),t=o.pop();return i}(t,e),o=[t];t!==n;)t=t.parent,o.push(t);for(var i=o.length;e!==n;)o.splice(i,0,e),e=e.parent;return o},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return a(this).eachBefore(Y)}};var U=Array.prototype.slice;var p=function(e){for(var t,n,o=0,i=(e=function(e){for(var t,n,o=e.length;o;)n=Math.random()*o--|0,t=e[o],e[o]=e[n],e[n]=t;return e}(U.call(e))).length,a=[];o<i;)t=e[o],n&&s(n,t)?++o:(n=function(e){switch(e.length){case 1:return function(e){return{x:e.x,y:e.y,r:e.r}}(e[0]);case 2:return l(e[0],e[1]);case 3:return u(e[0],e[1],e[2])}}(a=function(e,t){var n,o;if(A(t,e))return[t];for(n=0;n<e.length;++n)if(r(t,e[n])&&A(l(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(o=n+1;o<e.length;++o)if(r(l(e[n],e[o]),t)&&r(l(e[n],t),e[o])&&r(l(e[o],t),e[n])&&A(u(e[n],e[o],t),e))return[e[n],e[o],t];throw new Error}(a,t)),o=0);return n};function r(e,t){var n=e.r-t.r,o=t.x-e.x,t=t.y-e.y;return n<0||n*n<o*o+t*t}function s(e,t){var n=e.r-t.r+1e-6,o=t.x-e.x,t=t.y-e.y;return 0<n&&o*o+t*t<n*n}function A(e,t){for(var n=0;n<t.length;++n)if(!s(e,t[n]))return;return 1}function l(e,t){var n=e.x,o=e.y,e=e.r,i=t.x,a=t.y,t=t.r,r=i-n,s=a-o,A=t-e,l=Math.sqrt(r*r+s*s);return{x:(n+i+r/l*A)/2,y:(o+a+s/l*A)/2,r:(l+e+t)/2}}function u(e,t,n){var o=e.x,i=e.y,e=e.r,a=t.x,r=t.y,t=t.r,s=n.x,A=n.y,n=n.r,l=o-a,u=o-s,c=i-r,g=i-A,d=t-e,h=n-e,p=o*o+i*i-e*e,a=p-a*a-r*r+t*t,r=p-s*s-A*A+n*n,t=u*c-l*g,p=(c*r-g*a)/(2*t)-o,s=(g*d-c*h)/t,A=(u*a-l*r)/(2*t)-i,n=(l*h-u*d)/t,g=s*s+n*n-1,c=2*(e+p*s+A*n),a=p*p+A*A-e*e,r=-(g?(c+Math.sqrt(c*c-4*g*a))/(2*g):a/c);return{x:o+p+s*r,y:i+A+n*r,r:r}}function m(e,t,n){var o,i,a,r,s=e.x-t.x,A=e.y-t.y,l=s*s+A*A;l?(i=t.r+n.r,r=e.r+n.r,(r*=r)<(i*=i)?(o=(l+r-i)/(2*l),a=Math.sqrt(Math.max(0,r/l-o*o)),n.x=e.x-o*s-a*A,n.y=e.y-o*A+a*s):(o=(l+i-r)/(2*l),a=Math.sqrt(Math.max(0,i/l-o*o)),n.x=t.x+o*s-a*A,n.y=t.y+o*A+a*s)):(n.x=t.x+n.r,n.y=t.y)}function f(e,t){var n=e.r+t.r-1e-6,o=t.x-e.x,t=t.y-e.y;return 0<n&&o*o+t*t<n*n}function B(e){var t=e._,e=e.next._,n=t.r+e.r,o=(t.x*e.r+e.x*t.r)/n,e=(t.y*e.r+e.y*t.r)/n;return o*o+e*e}function E(e){this._=e,this.next=null,this.previous=null}function w(e){if(!(o=e.length))return 0;var t,n,o,i,a,r,s,A,l,u,c=e[0];if(c.x=0,c.y=0,!(1<o))return c.r;if(t=e[1],c.x=-t.r,t.x=c.r,t.y=0,!(2<o))return c.r+t.r;m(t,c,n=e[2]),c=new E(c),t=new E(t),n=new E(n),((c.next=n.previous=t).next=c.previous=n).next=t.previous=c;e:for(r=3;r<o;++r){m(c._,t._,n=e[r]),n=new E(n),s=t.next,A=c.previous,l=t._.r,u=c._.r;do{if(l<=u){if(f(s._,n._)){t=s,(c.next=t).previous=c,--r;continue e}l+=s._.r,s=s.next}else{if(f(A._,n._)){((c=A).next=t).previous=c,--r;continue e}u+=A._.r,A=A.previous}}while(s!==A.next);for(n.previous=c,n.next=t,c.next=t.previous=t=n,i=B(c);(n=n.next)!==t;)(a=B(n))<i&&(c=n,i=a);t=c.next}for(c=[t._],n=t;(n=n.next)!==t;)c.push(n._);for(n=p(c),r=0;r<o;++r)(c=e[r]).x-=n.x,c.y-=n.y;return n.r}var L=function(e){return w(e),e};function y(e){if("function"!=typeof e)throw new Error;return e}function C(){return 0}function b(e){return function(){return e}}function G(e){return Math.sqrt(e.value)}var P=function(){var t=null,n=1,o=1,i=C;function a(e){return e.x=n/2,e.y=o/2,t?e.eachBefore(I(t)).eachAfter(v(i,.5)).eachBefore(M(1)):e.eachBefore(I(G)).eachAfter(v(C,1)).eachAfter(v(i,e.r/Math.min(n,o))).eachBefore(M(Math.min(n,o)/(2*e.r))),e}return a.radius=function(e){return arguments.length?(t=null==(e=e)?null:y(e),a):t},a.size=function(e){return arguments.length?(n=+e[0],o=+e[1],a):[n,o]},a.padding=function(e){return arguments.length?(i="function"==typeof e?e:b(+e),a):i},a};function I(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function v(r,s){return function(e){if(t=e.children){var t,n,o,i=t.length,a=r(e)*s||0;if(a)for(n=0;n<i;++n)t[n].r+=a;if(o=w(t),a)for(n=0;n<i;++n)t[n].r-=a;e.r=o+a}}}function M(n){return function(e){var t=e.parent;e.r*=n,t&&(e.x=t.x+n*e.x,e.y=t.y+n*e.y)}}function T(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var S=function(e,t,n,o,i){for(var a,r=e.children,s=-1,A=r.length,l=e.value&&(o-t)/e.value;++s<A;)(a=r[s]).y0=n,a.y1=i,a.x0=t,a.x1=t+=a.value*l},H=function(){var n=1,o=1,s=0,i=!1;function t(e){var a,r,t=e.height+1;return e.x0=e.y0=s,e.x1=n,e.y1=o/t,e.eachBefore((a=o,r=t,function(e){e.children&&S(e,e.x0,a*(e.depth+1)/r,e.x1,a*(e.depth+2)/r);var t=e.x0,n=e.y0,o=e.x1-s,i=e.y1-s;o<t&&(t=o=(t+o)/2),i<n&&(n=i=(n+i)/2),e.x0=t,e.y0=n,e.x1=o,e.y1=i})),i&&e.eachBefore(T),e}return t.round=function(e){return arguments.length?(i=!!e,t):i},t.size=function(e){return arguments.length?(n=+e[0],o=+e[1],t):[n,o]},t.padding=function(e){return arguments.length?(s=+e,t):s},t},j={depth:-1},k={};function z(e){return e.id}function J(e){return e.parentId}var W=function(){var u=z,c=J;function t(e){for(var t,n,o,i,a,r=e.length,s=new Array(r),A={},l=0;l<r;++l)a=e[l],o=s[l]=new h(a),null!=(i=u(a,l,e))&&(i+="")&&(A[a="$"+(o.id=i)]=a in A?k:o);for(l=0;l<r;++l)if(o=s[l],null!=(i=c(e[l],l,e))&&(i+="")){if(!(n=A["$"+i]))throw new Error("missing: "+i);if(n===k)throw new Error("ambiguous: "+i);n.children?n.children.push(o):n.children=[o],o.parent=n}else{if(t)throw new Error("multiple roots");t=o}if(!t)throw new Error("no root");if(t.parent=j,t.eachBefore(function(e){e.depth=e.parent.depth+1,--r}).eachBefore(d),t.parent=null,0<r)throw new Error("cycle");return t}return t.id=function(e){return arguments.length?(u=y(e),t):u},t.parentId=function(e){return arguments.length?(c=y(e),t):c},t};function V(e,t){return e.parent===t.parent?1:2}function D(e){var t=e.children;return t?t[0]:e.t}function Q(e){var t=e.children;return t?t[t.length-1]:e.t}function x(e,t){this._=e,this.parent=null,this.children=null,this.A=null,(this.a=this).z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}x.prototype=Object.create(h.prototype);var K=function(){var g=V,A=1,l=1,u=null;function t(e){var t,n,o,i,a,r,s=function(e){for(var t,n,o,i,a,r=[e=new x(e,0)];t=r.pop();)if(o=t._.children)for(t.children=new Array(a=o.length),i=a-1;0<=i;--i)r.push(n=t.children[i]=new x(o[i],i)),n.parent=t;return(e.parent=new x(null,0)).children=[e],e}(e);return s.eachAfter(c),s.parent.m=-s.z,s.eachBefore(d),u?e.eachBefore(h):((o=n=t=e).eachBefore(function(e){e.x<t.x&&(t=e),e.x>n.x&&(n=e),e.depth>o.depth&&(o=e)}),s=t===n?1:g(t,n)/2,i=s-t.x,a=A/(n.x+s+i),r=l/(o.depth||1),e.eachBefore(function(e){e.x=(e.x+i)*a,e.y=e.depth*r})),e}function c(e){var t=e.children,n=e.parent.children,o=e.i?n[e.i-1]:null;if(t){for(var i,a=0,r=0,s=e.children,A=s.length;0<=--A;)(i=s[A]).z+=a,i.m+=a,a+=i.s+(r+=i.c);t=(t[0].z+t[t.length-1].z)/2;o?(e.z=o.z+g(e._,o._),e.m=e.z-t):e.z=t}else o&&(e.z=o.z+g(e._,o._));e.parent.A=function(e,t,n){if(t){for(var o,i=e,a=e,r=t,s=i.parent.children[0],A=i.m,l=a.m,u=r.m,c=s.m;r=Q(r),i=D(i),r&&i;)s=D(s),(a=Q(a)).a=e,0<(o=r.z+u-i.z-A+g(r._,i._))&&(function(e,t,n){var o=n/(t.i-e.i);t.c-=o,t.s+=n,e.c+=o,t.z+=n,t.m+=n}(function(e,t,n){return e.a.parent===t.parent?e.a:n}(r,e,n),e,o),A+=o,l+=o),u+=r.m,A+=i.m,c+=s.m,l+=a.m;r&&!Q(a)&&(a.t=r,a.m+=u-l),i&&!D(s)&&(s.t=i,s.m+=A-c,n=e)}return n}(e,o,e.parent.A||n[0])}function d(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function h(e){e.x*=A,e.y=e.depth*l}return t.separation=function(e){return arguments.length?(g=e,t):g},t.size=function(e){return arguments.length?(u=!1,A=+e[0],l=+e[1],t):u?null:[A,l]},t.nodeSize=function(e){return arguments.length?(u=!0,A=+e[0],l=+e[1],t):u?[A,l]:null},t},N=function(e,t,n,o,i){for(var a,r=e.children,s=-1,A=r.length,l=e.value&&(i-n)/e.value;++s<A;)(a=r[s]).x0=t,a.x1=o,a.y0=n,a.y1=n+=a.value*l},t=(1+Math.sqrt(5))/2;function O(e,t,n,o,i,a){for(var r,s,A,l,u,c,g,d,h,p,m,f=[],B=t.children,E=0,w=0,y=B.length,C=t.value;E<y;){for(A=i-n,l=a-o;!(u=B[w++].value)&&w<y;);for(m=(c=g=u)*u*(p=Math.max(l/A,A/l)/(C*e)),h=Math.max(g/m,m/c);w<y;++w){if(u+=s=B[w].value,s<c&&(c=s),g<s&&(g=s),m=u*u*p,h<(d=Math.max(g/m,m/c))){u-=s;break}h=d}f.push(r={value:u,dice:A<l,children:B.slice(E,w)}),r.dice?S(r,n,o,i,C?o+=l*u/C:a):N(r,n,o,C?n+=A*u/C:i,a),C-=u,E=w}return f}var _=function t(a){function e(e,t,n,o,i){O(a,e,t,n,o,i)}return e.ratio=function(e){return t(1<(e=+e)?e:1)},e}(t),X=function(){var r=_,t=!1,n=1,o=1,s=[0],A=C,l=C,u=C,c=C,g=C;function i(e){return e.x0=e.y0=0,e.x1=n,e.y1=o,e.eachBefore(a),s=[0],t&&e.eachBefore(T),e}function a(e){var t=s[e.depth],n=e.x0+t,o=e.y0+t,i=e.x1-t,a=e.y1-t;i<n&&(n=i=(n+i)/2),a<o&&(o=a=(o+a)/2),e.x0=n,e.y0=o,e.x1=i,e.y1=a,e.children&&(t=s[e.depth+1]=A(e)/2,n+=g(e)-t,o+=l(e)-t,(i-=u(e)-t)<n&&(n=i=(n+i)/2),(a-=c(e)-t)<o&&(o=a=(o+a)/2),r(e,n,o,i,a))}return i.round=function(e){return arguments.length?(t=!!e,i):t},i.size=function(e){return arguments.length?(n=+e[0],o=+e[1],i):[n,o]},i.tile=function(e){return arguments.length?(r=y(e),i):r},i.padding=function(e){return arguments.length?i.paddingInner(e).paddingOuter(e):i.paddingInner()},i.paddingInner=function(e){return arguments.length?(A="function"==typeof e?e:b(+e),i):A},i.paddingOuter=function(e){return arguments.length?i.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):i.paddingTop()},i.paddingTop=function(e){return arguments.length?(l="function"==typeof e?e:b(+e),i):l},i.paddingRight=function(e){return arguments.length?(u="function"==typeof e?e:b(+e),i):u},i.paddingBottom=function(e){return arguments.length?(c="function"==typeof e?e:b(+e),i):c},i.paddingLeft=function(e){return arguments.length?(g="function"==typeof e?e:b(+e),i):g},i},q=function(e,t,n,o,i){var a,r,p=e.children,s=p.length,m=new Array(s+1);for(m[0]=r=a=0;a<s;++a)m[a+1]=r+=p[a].value;!function e(t,n,o,i,a,r,s){if(n-1<=t)return(A=p[t]).x0=i,A.y0=a,A.x1=r,void(A.y1=s);var A=m[t],l=o/2+A,u=t+1,c=n-1;for(;u<c;){var g=u+c>>>1;m[g]<l?u=1+g:c=g}l-m[u-1]<m[u]-l&&t+1<u&&--u;var A=m[u]-A,d=o-A;{var h;s-a<r-i?(e(t,u,A,i,a,h=(i*d+r*A)/o,s),e(u,n,d,h,a,r,s)):(e(t,u,A,i,a,r,h=(a*d+s*A)/o),e(u,n,d,i,h,r,s))}}(0,s,e.value,t,n,o,i)},Z=function(e,t,n,o,i){(1&e.depth?N:S)(e,t,n,o,i)},$=function t(d){function e(e,t,n,o,i){if((a=e._squarify)&&a.ratio===d)for(var a,r,s,A,l,u=-1,c=a.length,g=e.value;++u<c;){for(s=(r=a[u]).children,A=r.value=0,l=s.length;A<l;++A)r.value+=s[A].value;r.dice?S(r,t,n,o,n+=(i-n)*r.value/g):N(r,t,n,t+=(o-t)*r.value/g,i),g-=r.value}else e._squarify=a=O(d,e,t,n,o,i),a.ratio=d}return e.ratio=function(e){return t(1<(e=+e)?e:1)},e}(t)},function(e,t,n){n=n(1656);e.exports={TextEncoder:n.TextEncoder,TextDecoder:n.TextDecoder}},function(e,t,n){"use strict";var f=n(51),r=n(545),B=n(3),E=n(379),o=n(573);t.a=function(i){var p=Object(B.g)(i),a=6*B.r,c=0<p,g=Object(B.a)(p)>B.i;function d(e,t){return Object(B.g)(e)*Object(B.g)(t)>p}function h(e,t,n){var o,i,a,r,s,A,l,u=Object(f.a)(e),c=Object(f.a)(t),g=[1,0,0],u=Object(f.c)(u,c),c=Object(f.d)(u,u),d=u[0],h=c-d*d;return h?(c=p*c/h,d=-p*d/h,h=Object(f.c)(g,u),g=Object(f.f)(g,c),c=Object(f.f)(u,d),Object(f.b)(g,c),u=h,(h=(d=Object(f.d)(g,u))*d-(c=Object(f.d)(u,u))*(Object(f.d)(g,g)-1))<0?void 0:(h=Object(B.u)(h),o=Object(f.f)(u,(-d-h)/c),Object(f.b)(o,g),o=Object(f.g)(o),n?(i=e[0],a=t[0],r=e[1],t=t[1],a<i&&(l=i,i=a,a=l),s=a-i,!(A=Object(B.a)(s-B.o)<B.i)&&t<r&&(l=r,r=t,t=l),(A||s<B.i?A?0<r+t^o[1]<(Object(B.a)(o[0]-i)<B.i?r:t):r<=o[1]&&o[1]<=t:s>B.o^(i<=o[0]&&o[0]<=a))?(l=Object(f.f)(u,(-d+h)/c),Object(f.b)(l,g),[o,Object(f.g)(l)]):void 0):o)):!n&&e}function m(e,t){var n=c?i:B.o-i,o=0;return e<-n?o|=1:n<e&&(o|=2),t<-n?o|=4:n<t&&(o|=8),o}return Object(o.a)(d,function(a){var r,s,A,l,u;return{lineStart:function(){l=A=!1,u=1},point:function(e,t){var n,o=[e,t],i=d(e,t),e=c?i?0:m(e,t):i?m(e+(e<0?B.o:-B.o),t):0;!r&&(l=A=i)&&a.lineStart(),i===A||(n=h(r,o))&&!Object(E.a)(r,n)&&!Object(E.a)(o,n)||(o[2]=1),i!==A?(u=0,i?(a.lineStart(),n=h(o,r),a.point(n[0],n[1])):(n=h(r,o),a.point(n[0],n[1],2),a.lineEnd()),r=n):g&&r&&c^i&&(e&s||!(t=h(o,r,!0))||(u=0,c?(a.lineStart(),a.point(t[0][0],t[0][1]),a.point(t[1][0],t[1][1]),a.lineEnd()):(a.point(t[1][0],t[1][1]),a.lineEnd(),a.lineStart(),a.point(t[0][0],t[0][1],3)))),!i||r&&Object(E.a)(r,o)||a.point(o[0],o[1]),r=o,A=i,s=e},lineEnd:function(){A&&a.lineEnd(),r=null},clean:function(){return u|(l&&A)<<1}}},function(e,t,n,o){Object(r.a)(o,i,a,n,e,t)},c?[0,-i]:[-B.o,i-B.o])}},function(e,t,n){"use strict";n.d(t,"a",function(){return d});function l(e){return function(){return e}}var c=n(51),g=n(3),u=n(278);function d(e,t,n,o,i,a){if(n){var r=Object(g.g)(t),s=Object(g.t)(t),A=o*n;null==i?(i=t+o*g.w,a=t-A/2):(i=h(r,i),a=h(r,a),(0<o?i<a:a<i)&&(i+=o*g.w));for(var l,u=i;0<o?a<u:u<a;u-=A)l=Object(c.g)([r,-s*Object(g.g)(u),-s*Object(g.t)(u)]),e.point(l[0],l[1])}}function h(e,t){(t=Object(c.a)(t))[0]-=e,Object(c.e)(t);e=Object(g.b)(-t[1]);return((-t[2]<0?-e:e)+g.w-g.i)%g.w}t.b=function(){var o,i,a=l([0,0]),r=l(90),s=l(6),A={point:function(e,t){o.push(e=i(e,t)),e[0]*=g.h,e[1]*=g.h}};function t(){var e=a.apply(this,arguments),t=r.apply(this,arguments)*g.r,n=s.apply(this,arguments)*g.r;return o=[],i=Object(u.b)(-e[0]*g.r,-e[1]*g.r,0).invert,d(A,t,n,1),e={type:"Polygon",coordinates:[o]},o=i=null,e}return t.center=function(e){return arguments.length?(a="function"==typeof e?e:l([+e[0],+e[1]]),t):a},t.radius=function(e){return arguments.length?(r="function"==typeof e?e:l(+e),t):r},t.precision=function(e){return arguments.length?(s="function"==typeof e?e:l(+e),t):s},t}},function(e,t,n){"use strict";var o=n(2),n=n(9);t.a=Object(n.b)(function(e){return{key:e.locales.locale,locale:e.locales.locale,messages:e.locales.messages}})(o.b)},function(e,t,n){e.exports=n.p+"static/assets/6be143c7cb9d23c787f7f20674a76f72.svg"},function(e,t,n){e.exports=n.p+"static/assets/3286e2838658ebdb82f62d062b14e951.svg"},function(e,t,n){e.exports=n.p+"static/assets/0f9efe3bd6e80747dfa3aeb9e19997b5.svg"},function(e,t,n){e.exports=n.p+"static/assets/3d9e2585d6ed12b9fb994438e0c4c42a.svg"},function(e,t,n){e.exports=n.p+"static/assets/7b6399d516d5921bb199f57cdd8bbbbe.svg"},function(e,t,n){"use strict";var o=n(23),f=n.n(o);function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,a=[],r=!0,s=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);r=!0);}catch(e){s=!0,i=e}finally{try{r||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||E(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){var n;if(e)return"string"==typeof e?i(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function w(e){return e.replace(/[<>&'"]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}})}var y=n(2942),C='<sep gap="36"/>',b='<sep gap="36"/>';t.a=function(e){function t(t){var e=l.findIndex(function(e){return e.id===t});if(0<=e)return B(l.splice(e,1),1)[0].xml}var n,o,i,a,r,s=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],A=2<arguments.length?arguments[2]:void 0,l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[],u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"",c=5<arguments.length&&void 0!==arguments[5]?arguments[5]:"",g=6<arguments.length&&void 0!==arguments[6]?arguments[6]:"",s=e||s,d=[C],u=w(u),c=w(c),g=w(g),l=l.slice(),h=['<xml style="display: none">',t("motion")||(n=s,i=A,o=f.a.ScratchMsgs.translate("MOTION_STAGE_SELECTED","Stage selected: no motion blocks"),'\n <category name="%{BKY_CATEGORY_MOTION}" id="motion" colour="#4C97FF" secondaryColour="#3373CC">\n '.concat(n?'\n <label text="'.concat(o,'"></label>\n '):y.MartyBlocksToolbox_motion()+"\n\n ".concat(b,'\n\n <block type="motion_movesteps">\n <value name="STEPS">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_turnright">\n <value name="DEGREES">\n <shadow type="math_number">\n <field name="NUM">15</field>\n </shadow>\n </value>\n </block>\n <block type="motion_turnleft">\n <value name="DEGREES">\n <shadow type="math_number">\n <field name="NUM">15</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_goto">\n <value name="TO">\n <shadow type="motion_goto_menu">\n </shadow>\n </value>\n </block>\n <block type="motion_gotoxy">\n <value name="X">\n <shadow id="movex" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n <value name="Y">\n <shadow id="movey" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="motion_glideto" id="motion_glideto">\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="TO">\n <shadow type="motion_glideto_menu">\n </shadow>\n </value>\n </block>\n <block type="motion_glidesecstoxy">\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="X">\n <shadow id="glidex" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n <value name="Y">\n <shadow id="glidey" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_pointindirection">\n <value name="DIRECTION">\n <shadow type="math_angle">\n <field name="NUM">90</field>\n </shadow>\n </value>\n </block>\n <block type="motion_pointtowards">\n <value name="TOWARDS">\n <shadow type="motion_pointtowards_menu">\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_changexby">\n <value name="DX">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_setx">\n <value name="X">\n <shadow id="setx" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="motion_changeyby">\n <value name="DY">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="motion_sety">\n <value name="Y">\n <shadow id="sety" type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="motion_ifonedgebounce"/>\n ').concat(b,'\n <block type="motion_setrotationstyle"/>\n ').concat(b,'\n <block id="').concat(i,'_xposition" type="motion_xposition"/>\n <block id="').concat(i,'_yposition" type="motion_yposition"/>\n <block id="').concat(i,'_direction" type="motion_direction"/>'),"\n ").concat(C,"\n </category>\n ")),d,t("looks")||(n=s,o=A,i=u,u=c,c=f.a.ScratchMsgs.translate("LOOKS_HELLO","Hello!"),a=f.a.ScratchMsgs.translate("LOOKS_HMM","Hmm..."),'\n <category name="%{BKY_CATEGORY_LOOKS}" id="looks" colour="#9966FF" secondaryColour="#774DCB">\n '+y.MartyBlocksToolbox_disco()+"\n\n ".concat(n?"":'\n <block type="looks_sayforsecs">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">'.concat(c,'</field>\n </shadow>\n </value>\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">2</field>\n </shadow>\n </value>\n </block>\n <block type="looks_say">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(c,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_thinkforsecs">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(a,'</field>\n </shadow>\n </value>\n <value name="SECS">\n <shadow type="math_number">\n <field name="NUM">2</field>\n </shadow>\n </value>\n </block>\n <block type="looks_think">\n <value name="MESSAGE">\n <shadow type="text">\n <field name="TEXT">').concat(a,"</field>\n </shadow>\n </value>\n </block>\n ").concat(b,"\n "),"\n ").concat(n?'\n <block type="looks_switchbackdropto">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">'.concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_switchbackdroptoandwait">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">').concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextbackdrop"/>\n '):'\n <block id="'.concat(o,'_switchcostumeto" type="looks_switchcostumeto">\n <value name="COSTUME">\n <shadow type="looks_costume">\n <field name="COSTUME">').concat(i,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextcostume"/>\n <block type="looks_switchbackdropto">\n <value name="BACKDROP">\n <shadow type="looks_backdrops">\n <field name="BACKDROP">').concat(u,'</field>\n </shadow>\n </value>\n </block>\n <block type="looks_nextbackdrop"/>\n ').concat(b,'\n <block type="looks_changesizeby">\n <value name="CHANGE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="looks_setsizeto">\n <value name="SIZE">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n '),"\n ").concat(b,'\n <block type="looks_changeeffectby">\n <value name="CHANGE">\n <shadow type="math_number">\n <field name="NUM">25</field>\n </shadow>\n </value>\n </block>\n <block type="looks_seteffectto">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">0</field>\n </shadow>\n </value>\n </block>\n <block type="looks_cleargraphiceffects"/>\n ').concat(b,"\n ").concat(n?"":'\n <block type="looks_show"/>\n <block type="looks_hide"/>\n '.concat(b,'\n <block type="looks_gotofrontback"/>\n <block type="looks_goforwardbackwardlayers">\n <value name="NUM">\n <shadow type="math_integer">\n <field name="NUM">1</field>\n </shadow>\n </value>\n </block>\n '),"\n ").concat(n?'\n <block id="backdropnumbername" type="looks_backdropnumbername"/>\n ':'\n <block id="'.concat(o,'_costumenumbername" type="looks_costumenumbername"/>\n <block id="backdropnumbername" type="looks_backdropnumbername"/>\n <block id="').concat(o,'_size" type="looks_size"/>\n '),"\n ").concat(C,"\n </category>\n ")),d,t("sound")||(c=A,a=g,'\n <category name="%{BKY_CATEGORY_SOUND}" id="sound" colour="#D65CD6" secondaryColour="#BD42BD">\n '+y.MartyBlocksToolbox_sound(a)+"\n ".concat(b,'\n\n \x3c!--Default blocks--\x3e\n\n <block id="').concat(c,'_sound_playuntildone" type="sound_playuntildone">\n <value name="SOUND_MENU">\n <shadow type="sound_sounds_menu">\n <field name="SOUND_MENU">').concat(a,'</field>\n </shadow>\n </value>\n </block>\n <block id="').concat(c,'_sound_play" type="sound_play">\n <value name="SOUND_MENU">\n <shadow type="sound_sounds_menu">\n <field name="SOUND_MENU">').concat(a,'</field>\n </shadow>\n </value>\n </block>\n <block type="sound_stopallsounds"/>\n ').concat(b,'\n <block type="sound_changeeffectby">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block type="sound_seteffectto">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n <block type="sound_cleareffects"/>\n ').concat(b,'\n <block type="sound_changevolumeby">\n <value name="VOLUME">\n <shadow type="math_number">\n <field name="NUM">-10</field>\n </shadow>\n </value>\n </block>\n <block type="sound_setvolumeto">\n <value name="VOLUME">\n <shadow type="math_number">\n <field name="NUM">100</field>\n </shadow>\n </value>\n </block>\n <block id="').concat(c,'_volume" type="sound_volume"/>\n ').concat(C,"\n </category>\n ")),d,t("event")||'\n <category name="%{BKY_CATEGORY_EVENTS}" id="events" colour="#FFD500" secondaryColour="#CC9900">\n <block type="event_whenflagclicked"/>\n <block type="event_whenkeypressed">\n </block>\n '.concat(s?'\n <block type="event_whenstageclicked"/>\n ':'\n <block type="event_whenthisspriteclicked"/>\n ','\n <block type="event_whenbackdropswitchesto">\n </block>\n ').concat(b,'\n <block type="event_whengreaterthan">\n <value name="VALUE">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="event_whenbroadcastreceived">\n </block>\n <block type="event_broadcast">\n <value name="BROADCAST_INPUT">\n <shadow type="event_broadcast_menu"></shadow>\n </value>\n </block>\n <block type="event_broadcastandwait">\n <value name="BROADCAST_INPUT">\n <shadow type="event_broadcast_menu"></shadow>\n </value>\n </block>\n ').concat(C,"\n </category>\n "),d,t("control")||(u=s,'\n <category name="%{BKY_CATEGORY_CONTROL}" id="control" colour="#FFAB19" secondaryColour="#CF8B17">\n <block type="control_wait">\n <value name="DURATION">\n <shadow type="math_positive_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n </block>\n '.concat(b,'\n <block type="control_repeat">\n <value name="TIMES">\n <shadow type="math_whole_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n <block id="forever" type="control_forever"/>\n ').concat(b,'\n <block type="control_if"/>\n <block type="control_if_else"/>\n <block id="wait_until" type="control_wait_until"/>\n <block id="repeat_until" type="control_repeat_until"/>\n ').concat(b,'\n <block type="control_stop"/>\n ').concat(b,"\n ").concat(u?'\n <block type="control_create_clone_of">\n <value name="CLONE_OPTION">\n <shadow type="control_create_clone_of_menu"/>\n </value>\n </block>\n ':'\n <block type="control_start_as_clone"/>\n <block type="control_create_clone_of">\n <value name="CLONE_OPTION">\n <shadow type="control_create_clone_of_menu"/>\n </value>\n </block>\n <block type="control_delete_this_clone"/>\n ',"\n ").concat(C,"\n </category>\n ")),d,t("sensing")||(A=e,g=s,c=f.a.ScratchMsgs.translate("SENSING_ASK_TEXT","What's your name?"),'\n <category name="%{BKY_CATEGORY_SENSING}" id="sensing" colour="#4CBFE6" secondaryColour="#2E8EB8">\n '.concat(g?"":'\n\n <block type="XAxisMovement" />\n\n <block type="YAxisMovement" />\n\n <block type="ZAxisMovement" />\n\n <block type="BatteryPercentage" />\n\n <block type="ServoCurrent" >\n <value>\n <field name="SERVOCHOICE"></field>\n </value>\n </block>\n\n <block type="ServoPosition" >\n <value>\n <field name="SERVOCHOICE"></field>\n </value>\n </block>\n\n <block type="mv2_obstaclesense" />\n\n <block type="mv2_groundsense" />\n\n <block type="mv2_coloursense" />\n\n <block type="mv2_coloursense_hex" />\n\n <block type="mv2_coloursenseraw" />\n\n <block type="mv2_distancesense" />\n\n <block type="mv2_lightsense" />\n\n <block type="mv2_noisesense" />\n\n \x3c!--<block type="mv2_current" />--\x3e\n\n \x3c!--<block type="mv2_accelerometer" />--\x3e\n\n \x3c!--<block type="mv2_proximity" />--\x3e\n\n \x3c!--<block type="mv2_demo_sensor" />--\x3e\n\n \x3c!--<block type="mv2_set_demo_sensor" >\n <value name="SENSORVAL">\n <shadow type="math_number">\n <field name="NUM">42</field>\n </shadow>\n </value>\n </block>--\x3e\n\n\n\n '.concat(b,'\n\n \x3c!-- SCRATCH DEFAULT BLOCKS --\x3e\n\n <block type="sensing_touchingobject">\n <value name="TOUCHINGOBJECTMENU">\n <shadow type="sensing_touchingobjectmenu"/>\n </value>\n </block>\n <block type="sensing_touchingcolor">\n <value name="COLOR">\n <shadow type="colour_picker"/>\n </value>\n </block>\n <block type="sensing_coloristouchingcolor">\n <value name="COLOR">\n <shadow type="colour_picker"/>\n </value>\n <value name="COLOR2">\n <shadow type="colour_picker"/>\n </value>\n </block>\n <block type="sensing_distanceto">\n <value name="DISTANCETOMENU">\n <shadow type="sensing_distancetomenu"/>\n </value>\n </block>\n ').concat(b,"\n "),"\n ").concat(A?"":'\n <block id="askandwait" type="sensing_askandwait">\n <value name="QUESTION">\n <shadow type="text">\n <field name="TEXT">'.concat(c,"</field>\n </shadow>\n </value>\n </block>\n "),'\n <block id="answer" type="sensing_answer"/>\n ').concat(b,'\n <block type="sensing_keypressed">\n <value name="KEY_OPTION">\n <shadow type="sensing_keyoptions"/>\n </value>\n </block>\n <block type="sensing_mousedown"/>\n <block type="sensing_mousex"/>\n <block type="sensing_mousey"/>\n ').concat(g?"":"\n ".concat(b,'\n \'<block type="sensing_setdragmode" id="sensing_setdragmode"></block>\'+\n ').concat(b,"\n "),"\n ").concat(b,'\n <block id="loudness" type="sensing_loudness"/>\n ').concat(b,'\n <block id="timer" type="sensing_timer"/>\n <block type="sensing_resettimer"/>\n ').concat(b,'\n <block id="of" type="sensing_of">\n <value name="OBJECT">\n <shadow id="sensing_of_object_menu" type="sensing_of_object_menu"/>\n </value>\n </block>\n ').concat(b,'\n <block id="current" type="sensing_current"/>\n <block type="sensing_dayssince2000"/>\n ').concat(b,'\n <block type="sensing_username"/>\n ').concat(C,"\n </category>\n ")),d,t("operators")||(u=e,s=f.a.ScratchMsgs.translate("OPERATORS_JOIN_APPLE","apple"),A=f.a.ScratchMsgs.translate("OPERATORS_JOIN_BANANA","banana"),c=f.a.ScratchMsgs.translate("OPERATORS_LETTEROF_APPLE","a"),'\n <category name="%{BKY_CATEGORY_OPERATORS}" id="operators" colour="#40BF4A" secondaryColour="#389438">\n <block type="operator_add">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_subtract">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_multiply">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_divide">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n '.concat(b,'\n <block type="operator_random">\n <value name="FROM">\n <shadow type="math_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="TO">\n <shadow type="math_number">\n <field name="NUM">10</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_gt">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n <block type="operator_lt">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n <block type="operator_equals">\n <value name="OPERAND1">\n <shadow type="text">\n <field name="TEXT"/>\n </shadow>\n </value>\n <value name="OPERAND2">\n <shadow type="text">\n <field name="TEXT">50</field>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_and"/>\n <block type="operator_or"/>\n <block type="operator_not"/>\n ').concat(b,"\n ").concat(u?"":'\n <block type="operator_join">\n <value name="STRING1">\n <shadow type="text">\n <field name="TEXT">'.concat(s,' </field>\n </shadow>\n </value>\n <value name="STRING2">\n <shadow type="text">\n <field name="TEXT">').concat(A,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_letter_of">\n <value name="LETTER">\n <shadow type="math_whole_number">\n <field name="NUM">1</field>\n </shadow>\n </value>\n <value name="STRING">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_length">\n <value name="STRING">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n </block>\n <block type="operator_contains" id="operator_contains">\n <value name="STRING1">\n <shadow type="text">\n <field name="TEXT">').concat(s,'</field>\n </shadow>\n </value>\n <value name="STRING2">\n <shadow type="text">\n <field name="TEXT">').concat(c,"</field>\n </shadow>\n </value>\n </block>\n "),"\n ").concat(b,'\n <block type="operator_mod">\n <value name="NUM1">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n <value name="NUM2">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n <block type="operator_round">\n <value name="NUM">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n ').concat(b,'\n <block type="operator_mathop">\n <value name="NUM">\n <shadow type="math_number">\n <field name="NUM"/>\n </shadow>\n </value>\n </block>\n ').concat(C,"\n </category>\n ")),d,t("data")||'\n <category\n name="%{BKY_CATEGORY_VARIABLES}"\n id="variables"\n colour="#FF8C1A"\n secondaryColour="#DB6E00"\n custom="VARIABLE">\n </category>\n ',d,t("procedures")||'\n <category\n name="%{BKY_CATEGORY_MYBLOCKS}"\n id="myBlocks"\n colour="#FF6680"\n secondaryColour="#FF4D6A"\n custom="PROCEDURE">\n </category>\n '],p=function(e,t){var n,o,i,a,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return o=!(n=!0),{s:function(){r=r.call(e)},n:function(){var e=r.next();return n=e.done,e},e:function(e){o=!0,i=e},f:function(){try{n||null==r.return||r.return()}finally{if(o)throw i}}};if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(l);try{for(p.s();!(r=p.n()).done;){var m=r.value;h.push(d,m.xml)}}catch(e){p.e(e)}finally{p.f()}return h.push("</xml>"),h.join("\n")}},function(module,exports,__webpack_require__){!function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;
|
|
8066
8066
|
/**
|
|
8067
8067
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
8068
8068
|
*
|
|
@@ -29191,7 +29191,7 @@ return a / b;`,packedOpSnippet:`
|
|
|
29191
29191
|
* See the License for the specific language governing permissions and
|
|
29192
29192
|
* limitations under the License.
|
|
29193
29193
|
* =============================================================================
|
|
29194
|
-
*/var wGe,Wl=HC,ql=kg,Dg=sA,yGe=Hc,iu=kc,CGe=Xp,gg=yl,$l=Lp,zp=i,Ig=Kp,gA=qp,mi=Tc,Wl=(EGe.version_vis=Og.version,{barchart:Wl.barchart,table:gg.table,histogram:yGe.histogram,linechart:iu.linechart,scatterplot:CGe.scatterplot,confusionMatrix:ql.confusionMatrix,heatmap:Dg.heatmap}),gg=(EGe.render=Wl,{accuracy:mi.accuracy,perClassAccuracy:mi.perClassAccuracy,confusionMatrix:mi.confusionMatrix}),yGe=(EGe.metrics=gg,{history:$l.history,fitCallbacks:$l.fitCallbacks,perClassAccuracy:Ig.perClassAccuracy,valuesDistribution:gA.valuesDistribution,layer:zp.layer,modelSummary:zp.modelSummary}),iu=(EGe.show=yGe,vg),bGe=(EGe.visor=iu.visor,hC);for(wGe in bGe)EGe.hasOwnProperty(wGe)||(EGe[wGe]=bGe[wGe]);mg=H({__proto__:null,default:hi(kp)},[kp]);g.AudioTrainingOptions=class{constructor(){A(this,"spectrogramDurationMillis"),A(this,"fftSize",1024),A(this,"sampleRateHz",44100),A(this,"durationMultiplier"),A(this,"durationSec"),A(this,"audioTrackConstraints"),A(this,"snippetDurationSec"),A(this,"onSnippet"),A(this,"includeRawAudio",!1),A(this,"overlapFactor",0),A(this,"columnTruncateLength",232)}},g.BACKGROUND_NOISE_TAG=ZM,g.ClassAction=_M,g.ClassActionAndParams=class{constructor(e,t){this.action=e,this.params=t}},g.ClassActionParams=class{constructor(e,t){this.text=e,this.commandToRun=t}},g.ClassActionType=AC,g.IMAGE_SIZE=224,g.MLModel=Fg,g.MLModelPrediction=class{constructor(){A(this,"label",""),A(this,"confidence",0)}},g.MLModelPredictions=dT,g.MLModelWorkerCommand=hT,g.MLWorkerCommandMessage=class{constructor(){A(this,"command","TRAIN"),A(this,"trainingData",null),A(this,"imagePixels",null),A(this,"digits",0),A(this,"trainingSize",0),A(this,"rnnType",""),A(this,"layers",0),A(this,"hiddenSize",0),A(this,"batchSize",0),A(this,"trainIterations",0),A(this,"numTestExamples",0),A(this,"modelJSON",null),A(this,"weightBuffers",[]),A(this,"weightInfo",[]),A(this,"tmModelUrl",""),A(this,"modelType","image-device"),A(this,"streamedAudioData"),A(this,"audioAlphabeticalWords",[])}},g.MLWorkerStatusMessage=mT,g.MLWorkerTrainingData=pT,g.MOBILE_NET_INPUT_HEIGHT=224,g.MOBILE_NET_INPUT_WIDTH=224,g.TrainingDataAction=class{constructor(){A(this,"type","TD_ACTION_NONE"),A(this,"payload",{})}},g.TrainingDataActionTypes=cC,g.TrainingDataHelper=LM,g.arrayToBase64=CT,g.classNoActionString="No Action",g.convertJpegToUtilsPixelsImage=a=>M(this,null,function*(){const i=new Image;return i.src="data:image/jpeg;base64,"+a.jpegBase64,new Promise((o,t)=>{i.onload=()=>{var e=document.createElement("canvas"),e=(e.width=i.width,e.height=i.height,e.getContext("2d"));if(e){e.drawImage(i,0,0);var n=e.getImageData(0,0,i.width,i.height);let t=n.data;if(n.data.length!=i.width*i.height*a.depth){t=new Uint8ClampedArray(i.width*i.height*a.depth);for(let e=0;e<n.data.length;e+=4)t[e]=n.data[e],t[e+1]=n.data[e+1],t[e+2]=n.data[e+2]}e={pixelsBase64:CT(t),width:n.width,height:n.height,depth:Math.round(t.length/(n.width*n.height))};o(e)}t()}})}),g.tfvis=mg,g.trainingDataReducer=(e,t)=>{var n,o=t.payload;switch(t.type){case"TD_CHANGE_CLASS_NAME":return void 0!==o.id&&void 0!==o.name?LM.renameClass(e,o.id,o.name):e;case"TD_ADD_CLASS":return void 0!==o.name?LM.addClass(e,o.name):e;case"TD_REMOVE_CLASS":return void 0!==o.id?LM.removeClass(e,o.id):e;case"TD_ADD_SAMPLE":return"audio"===o.sampleType?void 0!==o.id&&void 0!==o.timeDataQueue&&void 0!==o.freqDataQueue&&void 0!==o.image?LM.addAudioToClass(e,o.id,o.timeDataQueue,o.freqDataQueue,o.image):e:"image"===o.sampleType&&void 0!==o.id&&void 0!==o.image?LM.addImageToClass(e,o.id,o.image,o.canvas):e;case"TD_REMOVE_SAMPLE":return void 0!==o.id&&void 0!==o.sampleIdx?LM.removeSampleFromClass(e,o.id,o.sampleIdx):e;case"TD_SAVE":return LM.storeToLocalStorage(e,"trainingData"),e;case"TD_LOAD":return LM.loadFromLocalStorage("trainingData");case"TD_CHANGE_CLASS_ACTION":return void 0!==o.id&&void 0!==o.actionAndParams?((n=LM.cloneTrainingData(e)).classes[o.id].actionAndParams=o.actionAndParams,n):e;default:return e}},Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(t)}.call(this,qGe(36),qGe(111),qGe(97).Buffer,qGe(298).setImmediate)},function(e,t,n){"use strict";t.byteLength=function(e){var e=u(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){var t,n,o=u(e),i=o[0],o=o[1],a=new l(function(e,t){return 3*(e+t)/4-t}(i,o)),r=0,s=0<o?i-4:i;for(n=0;n<s;n+=4)t=A[e.charCodeAt(n)]<<18|A[e.charCodeAt(n+1)]<<12|A[e.charCodeAt(n+2)]<<6|A[e.charCodeAt(n+3)],a[r++]=t>>16&255,a[r++]=t>>8&255,a[r++]=255&t;2===o&&(t=A[e.charCodeAt(n)]<<2|A[e.charCodeAt(n+1)]>>4,a[r++]=255&t);1===o&&(t=A[e.charCodeAt(n)]<<10|A[e.charCodeAt(n+1)]<<4|A[e.charCodeAt(n+2)]>>2,a[r++]=t>>8&255,a[r++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,r=n-o;a<r;a+=16383)i.push(function(e,t,n){for(var o,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(function(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}(o));return i.join("")}(e,a,r<a+16383?r:a+16383));1==o?(t=e[n-1],i.push(s[t>>2]+s[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return i.join("")};for(var s=[],A=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=o.length;i<a;++i)s[i]=o[i],A[o.charCodeAt(i)]=i;function u(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("="),t=(e=-1===e?t:e)===t?0:4-e%4;return[e,t]}A["-".charCodeAt(0)]=62,A["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,o,i){var a,r,s=8*i-o-1,A=(1<<s)-1,l=A>>1,u=-7,c=n?i-1:0,g=n?-1:1,i=e[t+c];for(c+=g,a=i&(1<<-u)-1,i>>=-u,u+=s;0<u;a=256*a+e[t+c],c+=g,u-=8);for(r=a&(1<<-u)-1,a>>=-u,u+=o;0<u;r=256*r+e[t+c],c+=g,u-=8);if(0===a)a=1-l;else{if(a===A)return r?NaN:1/0*(i?-1:1);r+=Math.pow(2,o),a-=l}return(i?-1:1)*r*Math.pow(2,a-o)},t.write=function(e,t,n,o,i,a){var r,s,A=8*a-i-1,l=(1<<A)-1,u=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=o?0:a-1,d=o?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+u?c/o:c*Math.pow(2,1-u))*o&&(r++,o/=2),l<=r+u?(s=0,r=l):1<=r+u?(s=(t*o-1)*Math.pow(2,i),r+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),r=0));8<=i;e[n+g]=255&s,g+=d,s/=256,i-=8);for(r=r<<i|s,A+=i;0<A;e[n+g]=255&r,g+=d,r/=256,A-=8);e[n+g-d]|=128*a}},function(e,t,n){!function(e,d){!function(n,a){"use strict";var o,r,s,i,A,l,t,e;function u(e){delete r[e]}function c(e){if(s)setTimeout(c,0,e);else{var t=r[e];if(t){s=!0;try{var n=t,o=n.callback,i=n.args;switch(i.length){case 0:o();break;case 1:o(i[0]);break;case 2:o(i[0],i[1]);break;case 3:o(i[0],i[1],i[2]);break;default:o.apply(a,i)}}finally{u(e),s=!1}}}}function g(){function e(e){e.source===n&&"string"==typeof e.data&&0===e.data.indexOf(t)&&c(+e.data.slice(t.length))}var t="setImmediate$"+Math.random()+"$";n.addEventListener?n.addEventListener("message",e,!1):n.attachEvent("onmessage",e),A=function(e){n.postMessage(t+e,"*")}}n.setImmediate||(o=1,s=!(r={}),i=n.document,e=(e=Object.getPrototypeOf&&Object.getPrototypeOf(n))&&e.setTimeout?e:n,"[object process]"==={}.toString.call(n.process)?A=function(e){d.nextTick(function(){c(e)})}:!function(){var e,t;if(n.postMessage&&!n.importScripts)return e=!0,t=n.onmessage,n.onmessage=function(){e=!1},n.postMessage("","*"),n.onmessage=t,e}()?A=n.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):i&&"onreadystatechange"in i.createElement("script")?(l=i.documentElement,function(e){var t=i.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,l.removeChild(t),t=null},l.appendChild(t)}):function(e){setTimeout(c,0,e)}:g(),e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];return r[o]={callback:e,args:t},A(o),o++},e.clearImmediate=u)}("undefined"==typeof self?void 0===e?this:e:self)}.call(this,n(36),n(111))},function(n,o,e){"use strict";!function(e){var t=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();n.exports=o=t.fetch,t.fetch&&(o.default=t.fetch.bind(t)),o.Headers=t.Headers,o.Request=t.Request,o.Response=t.Response}.call(this,e(36))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){const o=n(37).assess,i=n(37).assessBadges,a=n(37).BadgesManager,r=n(540).default,s=n(540).Preprocessor,A=n(540).StarProgressTracker,l=n(540).DataToStars;e.exports=class{constructor(){this.codeAssessLib=new r,this.codeAssessLib.platform="dev-mb",this.BadgesManager=a,this.isProjectLoaded=!1,this.Preprocessor=s,this.StarProgressTracker=A}setIsProjectLoaded(t){setTimeout(()=>{try{vm.runtime.targets.reduce((e,t)=>e+Object.keys(t.blocks._blocks).length,0)<10&&(this.isProjectLoaded=!1)}catch(e){this.isProjectLoaded=t}},5e3),this.isProjectLoaded=t}assess(e){return o(e)}assessBadges(e){if(!this.isProjectLoaded)return{badgesCount:(e=i(e)).badgesCount,hasCountChanged:e.hasChanged}}hasStarAchieved(e){e=l.toStars(e),e=this.StarProgressTracker.compareStars(e);return{achievedStars:e,anyStarAchieved:Object.values(e).some(e=>e.some(e=>e))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(610),r=n(611),s=n(612);class A extends i.default{constructor(e){super(),this.score=new o.AlgorithmsScores,this.name="Algorithms",this.targets=e}execute(){return this.score.Conditionals=new a.default(this.targets).execute(),this.score.Operators=new r.default(this.targets).execute(),this.score["Synchronization and Messages"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(613),r=n(614),s=n(615);class A extends i.default{constructor(e){super(),this.score=new o.AnalysisScores,this.name="Analysis",this.targets=e}execute(){return this.score.Comments=new a.default(this.targets).execute(),this.score.Debugging=new r.default(this.targets).execute(),this.score.Naming=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(616),r=n(617),s=n(618);class A extends i.default{constructor(e){super(),this.score=new o.DecompositionScores,this.name="Decomposition",this.targets=e}execute(){return this.score.Functions=new a.default(this.targets).execute(),this.score.Parallelism=new r.default(this.targets).execute(),this.score.Sequencing=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(619),r=n(620),s=n(621);class A extends i.default{constructor(e){super(),this.score=new o.GeneralisationAndAbstractionScores,this.name="Generalisation and Abstraction",this.targets=e}execute(){return this.score["Function Reuse"]=new a.default(this.targets).execute(),this.score["Functions with Arguments"]=new r.default(this.targets).execute(),this.score["Variables Instead of Literals"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(622),r=n(623);var s=n(466);const A=n(466);class l extends i.default{constructor(e){super(),this.score=new o.PatternRecAndDataRepScores,this.name="Pattern Recognition and Data Representation",this.targets=e}execute(){return this.score["Data Types"]=new a.default(this.targets).execute(),this.score.Loops=new r.default(this.targets).execute(),this.score["Variables and Data Structures"]=new A.default(this.targets).execute(),this.score}}l.range=[a.default.range[0]+r.default.range[0]+s.default.range[0]+A.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]+A.default.range[1]],t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);t.default=class{constructor(){this.scores=new o.Scores,this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return this.analyzers.forEach(e=>{var t=e.execute(),e=e.name;this.scores[e]=t}),this.scores}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n=n(845);class o{constructor(){this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return o.haveBadgesBeenInitialised?this.analyzers.forEach(e=>{var t,n=e.execute();e.wasCountMoreThanMax&&(t=e.star-1,e=e.name,o.counts[e][t]+=n)}):console.warn("BadgesManager counts have not been initialised"),o.counts}static initialiseBadgeCounts(e){o.counts=e,o.haveBadgesBeenInitialised=!0}}o.counts=new n.BadgesCounts,o.haveBadgesBeenInitialised=!0,t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_forever"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_repeat"];class r extends o.default{constructor(e){super(),this.star=2,this.name="Loops",this.newSessionCount=0,this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_repeat_until"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if_else"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if","control_if_else"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let n=0;i.default.iterateBlocks(this.targets,(e,t)=>(a.includes(e.opcode)&&(console.log("parentBlock",e),t)&&i.default.iterateThroughAllNestedBlocksFromBlock(e,t,e=>(console.log("childBlock",e),a.includes(e.opcode)&&n++,!1)),!1),!0),this.setCount(n)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0<Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const t={};i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&(t[e.opcode]=t[e.opcode]?t[e.opcode]+1:1),!1),!0);var e=Object.values(t);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["math_number","math_integer"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["text"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["martymachine_isImageLabelDetected","martymachine_menu_sound_labels_menu","sensing_mousedown","sensing_coloristouchingcolor","martymachine_isSoundLabelDetected","sensing_touchingobject","operator_equals","operator_contains","operator_gt","sensing_keypressed","operator_lt","sensing_keyoptions","operator_not","sensing_touchingobjectmenu","operator_or","martymachine_menu_image_labels_menu","sensing_touchingcolor","operator_and"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_equals","operator_gt","operator_lt","operator_and","operator_or","operator_not"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_add","operator_subtract","operator_multiply","operator_divide","operator_random","operator_round","operator_mathop","operator_mod"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_join","operator_letter_of","operator_length","operator_contains"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["event_whenflagclicked","event_whenthisspriteclicked","event_whenkeypressed","event_whenbroadcastreceived","event_whengreaterthan","event_whenbackdropswitchesto","event_videoon","event_whenloudnessgreater","event_whenstageclicked"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const n={};i.default.iterateScripts(this.targets,(e,t)=>(a.includes(e.opcode)&&!i.default.isScriptDeadCode(e,t)&&(n[e.opcode]=n[e.opcode]?n[e.opcode]+1:1),!1),!0);var e=Object.values(n);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["event_whenbroadcastreceived"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_variable"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_listcontents"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_deleteoflist","data_deletealloflist","data_insertatlist","data_replaceitemoflist","data_addtolist","data_itemoflist","data_itemnumoflist","data_lengthoflist","data_listcontainsitem"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t){},function(e,t,n){var o;e.exports=(o=n(58),function(){var e,i;"function"==typeof ArrayBuffer&&(e=o.lib.WordArray,i=e.init,(e.init=function(e){if((e=(e=e instanceof ArrayBuffer?new Uint8Array(e):e)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e)instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;i.call(this,n,t)}else i.apply(this,arguments)}).prototype=e)}(),o.lib.WordArray)},function(e,t,n){function r(e){return e<<8&4278255360|e>>>8&16711935}var i;e.exports=(e=n(58),i=e.lib.WordArray,(n=e.enc).Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return i.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=r(t[i>>>2]>>>16-i%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return i.create(n,2*t)}},e.enc.Utf16)},function(e,t,n){function r(e,t,n){for(var o,i,a=[],r=0,s=0;s<t;s++)s%4&&(o=n[e.charCodeAt(s-1)]<<s%4*2,i=n[e.charCodeAt(s)]>>>6-s%4*2,a[r>>>2]|=(o|i)<<24-r%4*8,r++);return A.create(a,r)}var A;e.exports=(e=n(58),A=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t){for(var n=e.words,o=e.sigBytes,i=(t=void 0===t?!0:t)?this._safe_map:this._map,a=(e.clamp(),[]),r=0;r<o;r+=3)for(var s=(n[r>>>2]>>>24-r%4*8&255)<<16|(n[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|n[r+2>>>2]>>>24-(r+2)%4*8&255,A=0;A<4&&r+.75*A<o;A++)a.push(i.charAt(s>>>6*(3-A)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){var n=e.length,o=(t=void 0===t?!0:t)?this._safe_map:this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],a=0;a<o.length;a++)i[o.charCodeAt(a)]=a;var t=o.charAt(64);return t&&-1!==(t=e.indexOf(t))&&(n=t),r(e,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url)},function(e,t,n){var o,i,a;e.exports=(e=n(58),n(624),o=(n=e).lib.WordArray,a=n.algo,i=a.SHA256,a=a.SHA224=i.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=i._createHelper(a),n.HmacSHA224=i._createHmacHelper(a),e.SHA224)},function(e,t,n){var o,i,a,r;e.exports=(e=n(58),n(467),n(847),r=(n=e).x64,o=r.Word,i=r.WordArray,r=n.algo,a=r.SHA512,r=r.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=a._createHelper(r),n.HmacSHA384=a._createHmacHelper(r),e.SHA384)},function(e,t,n){e.exports=function(e){for(var d=Math,t=e,n=t.lib,h=n.WordArray,o=n.Hasher,i,a=t.x64.Word,r=t.algo,k=[],D=[],Q=[],s=1,A=0,l=0;l<24;l++){k[s+5*A]=(l+1)*(l+2)/2%64;var u=A%5;var c=(2*s+3*A)%5;s=u;A=c}for(var s=0;s<5;s++)for(var A=0;A<5;A++)D[s+5*A]=A+(2*s+3*A)%5*5;for(var g=1,p=0;p<24;p++){var m=0;var f=0;for(var B=0;B<7;B++){if(g&1){var E=(1<<B)-1;if(E<32)f^=1<<E;else m^=1<<E-32}if(g&128)g=g<<1^113;else g<<=1}Q[p]=a.create(m,f)}for(var x=[],w=0;w<25;w++)x[w]=a.create();var y=r.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){var e=this._state=[];for(var t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){var n=this._state;var o=this.blockSize/2;for(var i=0;i<o;i++){var a=e[t+2*i];var r=e[t+2*i+1];a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;r=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360;var s=n[i];s.high^=r;s.low^=a}for(var A=0;A<24;A++){for(var l=0;l<5;l++){var u=0,c=0;for(var g=0;g<5;g++){var s=n[l+5*g];u^=s.high;c^=s.low}var d=x[l];d.high=u;d.low=c}for(var l=0;l<5;l++){var h=x[(l+4)%5];var p=x[(l+1)%5];var m=p.high;var f=p.low;var u=h.high^(m<<1|f>>>31);var c=h.low^(f<<1|m>>>31);for(var g=0;g<5;g++){var s=n[l+5*g];s.high^=u;s.low^=c}}for(var B=1;B<25;B++){var u;var c;var s=n[B];var E=s.high;var w=s.low;var y=k[B];if(y<32){u=E<<y|w>>>32-y;c=w<<y|E>>>32-y}else{u=w<<y-32|E>>>64-y;c=E<<y-32|w>>>64-y}var C=x[D[B]];C.high=u;C.low=c}var b=x[0];var I=n[0];b.high=I.high;b.low=I.low;for(var l=0;l<5;l++)for(var g=0;g<5;g++){var B=l+5*g;var s=n[B];var v=x[B];var M=x[(l+1)%5+5*g];var T=x[(l+2)%5+5*g];s.high=v.high^~M.high&T.high;s.low=v.low^~M.low&T.low}var s=n[0];var S=Q[A];s.high^=S.high;s.low^=S.low}},_doFinalize:function(){var e=this._data;var t=e.words;var n=this._nDataBytes*8;var o=e.sigBytes*8;var i=this.blockSize*32;t[o>>>5]|=1<<24-o%32;t[(d.ceil((o+1)/i)*i>>>5)-1]|=128;e.sigBytes=t.length*4;this._process();var a=this._state;var r=this.cfg.outputLength/8;var s=r/8;var A=[];for(var l=0;l<s;l++){var u=a[l];var c=u.high;var g=u.low;c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;g=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;A.push(g);A.push(c)}return new h.init(A,r)},clone:function(){var e=o.clone.call(this);var t=e._state=this._state.slice(0);for(var n=0;n<25;n++)t[n]=t[n].clone();return e}});return t.SHA3=o._createHelper(y),t.HmacSHA3=o._createHmacHelper(y),e.SHA3}(n(58),n(467))},function(e,t,n){function b(e,t,n){return e&t|~e&n}function I(e,t,n){return e&n|t&~n}function v(e,t){return e<<t|e>>>32-t}var o,i,M,T,S,k,D,Q,a;e.exports=(e=n(58),Math,a=(n=e).lib,o=a.WordArray,i=a.Hasher,a=n.algo,M=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),T=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),k=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),D=o.create([0,1518500249,1859775393,2400959708,2840853838]),Q=o.create([1352829926,1548603684,1836072691,2053994217,0]),a=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var o=t+n,i=e[o];e[o]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}for(var a,r,s,A,l,u,c=this._hash.words,g=D.words,d=Q.words,h=M.words,p=T.words,m=S.words,f=k.words,B=a=c[0],E=r=c[1],w=s=c[2],y=A=c[3],C=l=c[4],n=0;n<80;n+=1)u=(u=v(u=(u=a+e[t+h[n]]|0)+(n<16?(r^s^A)+g[0]:n<32?b(r,s,A)+g[1]:n<48?((r|~s)^A)+g[2]:n<64?I(r,s,A)+g[3]:(r^(s|~A))+g[4])|0,m[n]))+l|0,a=l,l=A,A=v(s,10),s=r,r=u,u=(u=v(u=(u=B+e[t+p[n]]|0)+(n<16?(E^(w|~y))+d[0]:n<32?I(E,w,y)+d[1]:n<48?((E|~w)^y)+d[2]:n<64?b(E,w,y)+d[3]:(E^w^y)+d[4])|0,f[n]))+C|0,B=C,C=y,y=v(w,10),w=E,E=u;u=c[1]+s+y|0,c[1]=c[2]+A+C|0,c[2]=c[3]+l+B|0,c[3]=c[4]+a+E|0,c[4]=c[0]+r+w|0,c[0]=u},_doFinalize:function(){for(var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes,o=(t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),i=o.words,a=0;a<5;a++){var r=i[a];i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),n.RIPEMD160=i._createHelper(a),n.HmacRIPEMD160=i._createHmacHelper(a),e.RIPEMD160)},function(e,t,n){var o,f,i,a,B,r;e.exports=(e=n(58),n(624),n(625),i=(n=e).lib,o=i.Base,f=i.WordArray,i=n.algo,a=i.SHA256,B=i.HMAC,r=i.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=B.create(n.hasher,e),i=f.create(),a=f.create([1]),r=i.words,s=a.words,A=n.keySize,l=n.iterations;r.length<A;){for(var u=o.update(t).finalize(a),c=(o.reset(),u.words),g=c.length,d=u,h=1;h<l;h++){d=o.finalize(d),o.reset();for(var p=d.words,m=0;m<g;m++)c[m]^=p[m]}i.concat(u),s[0]++}return i.sigBytes=4*A,i}}),n.PBKDF2=function(e,t,n){return r.create(n).compute(e,t)},e.PBKDF2)},function(e,t,n){var o;e.exports=(o=n(58),n(129),o.mode.CFB=function(){var e=o.lib.BlockCipherMode.extend();function a(e,t,n,o){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,o.encryptBlock(i,0);for(var r=0;r<n;r++)e[t+r]^=i[r]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;a.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);a.call(this,e,t,o,n),this._prevBlock=i}}),e}(),o.mode.CFB)},function(e,t,n){var o;e.exports=(o=n(58),n(129),o.mode.CTR=function(){var e=o.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=this._iv,a=this._counter,r=(i&&(a=this._counter=i.slice(0),this._iv=void 0),a.slice(0));n.encryptBlock(r,0),a[o-1]=a[o-1]+1|0;for(var s=0;s<o;s++)e[t+s]^=r[s]}});return e.Decryptor=t,e}(),o.mode.CTR)},function(e,t,n){var o;e.exports=(o=n(58),n(129),
|
|
29194
|
+
*/var wGe,Wl=HC,ql=kg,Dg=sA,yGe=Hc,iu=kc,CGe=Xp,gg=yl,$l=Lp,zp=i,Ig=Kp,gA=qp,mi=Tc,Wl=(EGe.version_vis=Og.version,{barchart:Wl.barchart,table:gg.table,histogram:yGe.histogram,linechart:iu.linechart,scatterplot:CGe.scatterplot,confusionMatrix:ql.confusionMatrix,heatmap:Dg.heatmap}),gg=(EGe.render=Wl,{accuracy:mi.accuracy,perClassAccuracy:mi.perClassAccuracy,confusionMatrix:mi.confusionMatrix}),yGe=(EGe.metrics=gg,{history:$l.history,fitCallbacks:$l.fitCallbacks,perClassAccuracy:Ig.perClassAccuracy,valuesDistribution:gA.valuesDistribution,layer:zp.layer,modelSummary:zp.modelSummary}),iu=(EGe.show=yGe,vg),bGe=(EGe.visor=iu.visor,hC);for(wGe in bGe)EGe.hasOwnProperty(wGe)||(EGe[wGe]=bGe[wGe]);mg=H({__proto__:null,default:hi(kp)},[kp]);g.AudioTrainingOptions=class{constructor(){A(this,"spectrogramDurationMillis"),A(this,"fftSize",1024),A(this,"sampleRateHz",44100),A(this,"durationMultiplier"),A(this,"durationSec"),A(this,"audioTrackConstraints"),A(this,"snippetDurationSec"),A(this,"onSnippet"),A(this,"includeRawAudio",!1),A(this,"overlapFactor",0),A(this,"columnTruncateLength",232)}},g.BACKGROUND_NOISE_TAG=ZM,g.ClassAction=_M,g.ClassActionAndParams=class{constructor(e,t){this.action=e,this.params=t}},g.ClassActionParams=class{constructor(e,t){this.text=e,this.commandToRun=t}},g.ClassActionType=AC,g.IMAGE_SIZE=224,g.MLModel=Fg,g.MLModelPrediction=class{constructor(){A(this,"label",""),A(this,"confidence",0)}},g.MLModelPredictions=dT,g.MLModelWorkerCommand=hT,g.MLWorkerCommandMessage=class{constructor(){A(this,"command","TRAIN"),A(this,"trainingData",null),A(this,"imagePixels",null),A(this,"digits",0),A(this,"trainingSize",0),A(this,"rnnType",""),A(this,"layers",0),A(this,"hiddenSize",0),A(this,"batchSize",0),A(this,"trainIterations",0),A(this,"numTestExamples",0),A(this,"modelJSON",null),A(this,"weightBuffers",[]),A(this,"weightInfo",[]),A(this,"tmModelUrl",""),A(this,"modelType","image-device"),A(this,"streamedAudioData"),A(this,"audioAlphabeticalWords",[])}},g.MLWorkerStatusMessage=mT,g.MLWorkerTrainingData=pT,g.MOBILE_NET_INPUT_HEIGHT=224,g.MOBILE_NET_INPUT_WIDTH=224,g.TrainingDataAction=class{constructor(){A(this,"type","TD_ACTION_NONE"),A(this,"payload",{})}},g.TrainingDataActionTypes=cC,g.TrainingDataHelper=LM,g.arrayToBase64=CT,g.classNoActionString="No Action",g.convertJpegToUtilsPixelsImage=a=>M(this,null,function*(){const i=new Image;return i.src="data:image/jpeg;base64,"+a.jpegBase64,new Promise((o,t)=>{i.onload=()=>{var e=document.createElement("canvas"),e=(e.width=i.width,e.height=i.height,e.getContext("2d"));if(e){e.drawImage(i,0,0);var n=e.getImageData(0,0,i.width,i.height);let t=n.data;if(n.data.length!=i.width*i.height*a.depth){t=new Uint8ClampedArray(i.width*i.height*a.depth);for(let e=0;e<n.data.length;e+=4)t[e]=n.data[e],t[e+1]=n.data[e+1],t[e+2]=n.data[e+2]}e={pixelsBase64:CT(t),width:n.width,height:n.height,depth:Math.round(t.length/(n.width*n.height))};o(e)}t()}})}),g.tfvis=mg,g.trainingDataReducer=(e,t)=>{var n,o=t.payload;switch(t.type){case"TD_CHANGE_CLASS_NAME":return void 0!==o.id&&void 0!==o.name?LM.renameClass(e,o.id,o.name):e;case"TD_ADD_CLASS":return void 0!==o.name?LM.addClass(e,o.name):e;case"TD_REMOVE_CLASS":return void 0!==o.id?LM.removeClass(e,o.id):e;case"TD_ADD_SAMPLE":return"audio"===o.sampleType?void 0!==o.id&&void 0!==o.timeDataQueue&&void 0!==o.freqDataQueue&&void 0!==o.image?LM.addAudioToClass(e,o.id,o.timeDataQueue,o.freqDataQueue,o.image):e:"image"===o.sampleType&&void 0!==o.id&&void 0!==o.image?LM.addImageToClass(e,o.id,o.image,o.canvas):e;case"TD_REMOVE_SAMPLE":return void 0!==o.id&&void 0!==o.sampleIdx?LM.removeSampleFromClass(e,o.id,o.sampleIdx):e;case"TD_SAVE":return LM.storeToLocalStorage(e,"trainingData"),e;case"TD_LOAD":return LM.loadFromLocalStorage("trainingData");case"TD_CHANGE_CLASS_ACTION":return void 0!==o.id&&void 0!==o.actionAndParams?((n=LM.cloneTrainingData(e)).classes[o.id].actionAndParams=o.actionAndParams,n):e;default:return e}},Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(t)}.call(this,qGe(36),qGe(111),qGe(97).Buffer,qGe(298).setImmediate)},function(e,t,n){"use strict";t.byteLength=function(e){var e=u(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){var t,n,o=u(e),i=o[0],o=o[1],a=new l(function(e,t){return 3*(e+t)/4-t}(i,o)),r=0,s=0<o?i-4:i;for(n=0;n<s;n+=4)t=A[e.charCodeAt(n)]<<18|A[e.charCodeAt(n+1)]<<12|A[e.charCodeAt(n+2)]<<6|A[e.charCodeAt(n+3)],a[r++]=t>>16&255,a[r++]=t>>8&255,a[r++]=255&t;2===o&&(t=A[e.charCodeAt(n)]<<2|A[e.charCodeAt(n+1)]>>4,a[r++]=255&t);1===o&&(t=A[e.charCodeAt(n)]<<10|A[e.charCodeAt(n+1)]<<4|A[e.charCodeAt(n+2)]>>2,a[r++]=t>>8&255,a[r++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,r=n-o;a<r;a+=16383)i.push(function(e,t,n){for(var o,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(function(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}(o));return i.join("")}(e,a,r<a+16383?r:a+16383));1==o?(t=e[n-1],i.push(s[t>>2]+s[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return i.join("")};for(var s=[],A=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=o.length;i<a;++i)s[i]=o[i],A[o.charCodeAt(i)]=i;function u(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("="),t=(e=-1===e?t:e)===t?0:4-e%4;return[e,t]}A["-".charCodeAt(0)]=62,A["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,o,i){var a,r,s=8*i-o-1,A=(1<<s)-1,l=A>>1,u=-7,c=n?i-1:0,g=n?-1:1,i=e[t+c];for(c+=g,a=i&(1<<-u)-1,i>>=-u,u+=s;0<u;a=256*a+e[t+c],c+=g,u-=8);for(r=a&(1<<-u)-1,a>>=-u,u+=o;0<u;r=256*r+e[t+c],c+=g,u-=8);if(0===a)a=1-l;else{if(a===A)return r?NaN:1/0*(i?-1:1);r+=Math.pow(2,o),a-=l}return(i?-1:1)*r*Math.pow(2,a-o)},t.write=function(e,t,n,o,i,a){var r,s,A=8*a-i-1,l=(1<<A)-1,u=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=o?0:a-1,d=o?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+u?c/o:c*Math.pow(2,1-u))*o&&(r++,o/=2),l<=r+u?(s=0,r=l):1<=r+u?(s=(t*o-1)*Math.pow(2,i),r+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),r=0));8<=i;e[n+g]=255&s,g+=d,s/=256,i-=8);for(r=r<<i|s,A+=i;0<A;e[n+g]=255&r,g+=d,r/=256,A-=8);e[n+g-d]|=128*a}},function(e,t,n){!function(e,d){!function(n,a){"use strict";var o,r,s,i,A,l,t,e;function u(e){delete r[e]}function c(e){if(s)setTimeout(c,0,e);else{var t=r[e];if(t){s=!0;try{var n=t,o=n.callback,i=n.args;switch(i.length){case 0:o();break;case 1:o(i[0]);break;case 2:o(i[0],i[1]);break;case 3:o(i[0],i[1],i[2]);break;default:o.apply(a,i)}}finally{u(e),s=!1}}}}function g(){function e(e){e.source===n&&"string"==typeof e.data&&0===e.data.indexOf(t)&&c(+e.data.slice(t.length))}var t="setImmediate$"+Math.random()+"$";n.addEventListener?n.addEventListener("message",e,!1):n.attachEvent("onmessage",e),A=function(e){n.postMessage(t+e,"*")}}n.setImmediate||(o=1,s=!(r={}),i=n.document,e=(e=Object.getPrototypeOf&&Object.getPrototypeOf(n))&&e.setTimeout?e:n,"[object process]"==={}.toString.call(n.process)?A=function(e){d.nextTick(function(){c(e)})}:!function(){var e,t;if(n.postMessage&&!n.importScripts)return e=!0,t=n.onmessage,n.onmessage=function(){e=!1},n.postMessage("","*"),n.onmessage=t,e}()?A=n.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):i&&"onreadystatechange"in i.createElement("script")?(l=i.documentElement,function(e){var t=i.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,l.removeChild(t),t=null},l.appendChild(t)}):function(e){setTimeout(c,0,e)}:g(),e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];return r[o]={callback:e,args:t},A(o),o++},e.clearImmediate=u)}("undefined"==typeof self?void 0===e?this:e:self)}.call(this,n(36),n(111))},function(n,o,e){"use strict";!function(e){var t=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();n.exports=o=t.fetch,t.fetch&&(o.default=t.fetch.bind(t)),o.Headers=t.Headers,o.Request=t.Request,o.Response=t.Response}.call(this,e(36))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){const o=n(37).assess,i=n(37).assessBadges,a=n(37).BadgesManager,r=n(540).default,s=n(540).Preprocessor,A=n(540).StarProgressTracker,l=n(540).DataToStars;e.exports=class{constructor(){this.codeAssessLib=new r,this.codeAssessLib.platform="staging",this.BadgesManager=a,this.isProjectLoaded=!1,this.Preprocessor=s,this.StarProgressTracker=A}setIsProjectLoaded(t){setTimeout(()=>{try{vm.runtime.targets.reduce((e,t)=>e+Object.keys(t.blocks._blocks).length,0)<10&&(this.isProjectLoaded=!1)}catch(e){this.isProjectLoaded=t}},5e3),this.isProjectLoaded=t}assess(e){return o(e)}assessBadges(e){if(!this.isProjectLoaded)return{badgesCount:(e=i(e)).badgesCount,hasCountChanged:e.hasChanged}}hasStarAchieved(e){e=l.toStars(e),e=this.StarProgressTracker.compareStars(e);return{achievedStars:e,anyStarAchieved:Object.values(e).some(e=>e.some(e=>e))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(610),r=n(611),s=n(612);class A extends i.default{constructor(e){super(),this.score=new o.AlgorithmsScores,this.name="Algorithms",this.targets=e}execute(){return this.score.Conditionals=new a.default(this.targets).execute(),this.score.Operators=new r.default(this.targets).execute(),this.score["Synchronization and Messages"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(613),r=n(614),s=n(615);class A extends i.default{constructor(e){super(),this.score=new o.AnalysisScores,this.name="Analysis",this.targets=e}execute(){return this.score.Comments=new a.default(this.targets).execute(),this.score.Debugging=new r.default(this.targets).execute(),this.score.Naming=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(616),r=n(617),s=n(618);class A extends i.default{constructor(e){super(),this.score=new o.DecompositionScores,this.name="Decomposition",this.targets=e}execute(){return this.score.Functions=new a.default(this.targets).execute(),this.score.Parallelism=new r.default(this.targets).execute(),this.score.Sequencing=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(619),r=n(620),s=n(621);class A extends i.default{constructor(e){super(),this.score=new o.GeneralisationAndAbstractionScores,this.name="Generalisation and Abstraction",this.targets=e}execute(){return this.score["Function Reuse"]=new a.default(this.targets).execute(),this.score["Functions with Arguments"]=new r.default(this.targets).execute(),this.score["Variables Instead of Literals"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);var i=n(105);const a=n(622),r=n(623);var s=n(466);const A=n(466);class l extends i.default{constructor(e){super(),this.score=new o.PatternRecAndDataRepScores,this.name="Pattern Recognition and Data Representation",this.targets=e}execute(){return this.score["Data Types"]=new a.default(this.targets).execute(),this.score.Loops=new r.default(this.targets).execute(),this.score["Variables and Data Structures"]=new A.default(this.targets).execute(),this.score}}l.range=[a.default.range[0]+r.default.range[0]+s.default.range[0]+A.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]+A.default.range[1]],t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(233);t.default=class{constructor(){this.scores=new o.Scores,this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return this.analyzers.forEach(e=>{var t=e.execute(),e=e.name;this.scores[e]=t}),this.scores}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n=n(845);class o{constructor(){this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return o.haveBadgesBeenInitialised?this.analyzers.forEach(e=>{var t,n=e.execute();e.wasCountMoreThanMax&&(t=e.star-1,e=e.name,o.counts[e][t]+=n)}):console.warn("BadgesManager counts have not been initialised"),o.counts}static initialiseBadgeCounts(e){o.counts=e,o.haveBadgesBeenInitialised=!0}}o.counts=new n.BadgesCounts,o.haveBadgesBeenInitialised=!0,t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_forever"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_repeat"];class r extends o.default{constructor(e){super(),this.star=2,this.name="Loops",this.newSessionCount=0,this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_repeat_until"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if_else"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["control_if","control_if_else"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let n=0;i.default.iterateBlocks(this.targets,(e,t)=>(a.includes(e.opcode)&&(console.log("parentBlock",e),t)&&i.default.iterateThroughAllNestedBlocksFromBlock(e,t,e=>(console.log("childBlock",e),a.includes(e.opcode)&&n++,!1)),!1),!0),this.setCount(n)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0<Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const t={};i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&(t[e.opcode]=t[e.opcode]?t[e.opcode]+1:1),!1),!0);var e=Object.values(t);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["math_number","math_integer"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["text"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["martymachine_isImageLabelDetected","martymachine_menu_sound_labels_menu","sensing_mousedown","sensing_coloristouchingcolor","martymachine_isSoundLabelDetected","sensing_touchingobject","operator_equals","operator_contains","operator_gt","sensing_keypressed","operator_lt","sensing_keyoptions","operator_not","sensing_touchingobjectmenu","operator_or","martymachine_menu_image_labels_menu","sensing_touchingcolor","operator_and"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_equals","operator_gt","operator_lt","operator_and","operator_or","operator_not"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_add","operator_subtract","operator_multiply","operator_divide","operator_random","operator_round","operator_mathop","operator_mod"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["operator_join","operator_letter_of","operator_length","operator_contains"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["event_whenflagclicked","event_whenthisspriteclicked","event_whenkeypressed","event_whenbroadcastreceived","event_whengreaterthan","event_whenbackdropswitchesto","event_videoon","event_whenloudnessgreater","event_whenstageclicked"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const n={};i.default.iterateScripts(this.targets,(e,t)=>(a.includes(e.opcode)&&!i.default.isScriptDeadCode(e,t)&&(n[e.opcode]=n[e.opcode]?n[e.opcode]+1:1),!1),!0);var e=Object.values(n);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["event_whenbroadcastreceived"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_variable"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_listcontents"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(116);const i=n(49),a=["data_deleteoflist","data_deletealloflist","data_insertatlist","data_replaceitemoflist","data_addtolist","data_itemoflist","data_itemnumoflist","data_lengthoflist","data_listcontainsitem"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t){},function(e,t,n){var o;e.exports=(o=n(58),function(){var e,i;"function"==typeof ArrayBuffer&&(e=o.lib.WordArray,i=e.init,(e.init=function(e){if((e=(e=e instanceof ArrayBuffer?new Uint8Array(e):e)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e)instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;i.call(this,n,t)}else i.apply(this,arguments)}).prototype=e)}(),o.lib.WordArray)},function(e,t,n){function r(e){return e<<8&4278255360|e>>>8&16711935}var i;e.exports=(e=n(58),i=e.lib.WordArray,(n=e.enc).Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return i.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=r(t[i>>>2]>>>16-i%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return i.create(n,2*t)}},e.enc.Utf16)},function(e,t,n){function r(e,t,n){for(var o,i,a=[],r=0,s=0;s<t;s++)s%4&&(o=n[e.charCodeAt(s-1)]<<s%4*2,i=n[e.charCodeAt(s)]>>>6-s%4*2,a[r>>>2]|=(o|i)<<24-r%4*8,r++);return A.create(a,r)}var A;e.exports=(e=n(58),A=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t){for(var n=e.words,o=e.sigBytes,i=(t=void 0===t?!0:t)?this._safe_map:this._map,a=(e.clamp(),[]),r=0;r<o;r+=3)for(var s=(n[r>>>2]>>>24-r%4*8&255)<<16|(n[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|n[r+2>>>2]>>>24-(r+2)%4*8&255,A=0;A<4&&r+.75*A<o;A++)a.push(i.charAt(s>>>6*(3-A)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){var n=e.length,o=(t=void 0===t?!0:t)?this._safe_map:this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],a=0;a<o.length;a++)i[o.charCodeAt(a)]=a;var t=o.charAt(64);return t&&-1!==(t=e.indexOf(t))&&(n=t),r(e,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url)},function(e,t,n){var o,i,a;e.exports=(e=n(58),n(624),o=(n=e).lib.WordArray,a=n.algo,i=a.SHA256,a=a.SHA224=i.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=i._createHelper(a),n.HmacSHA224=i._createHmacHelper(a),e.SHA224)},function(e,t,n){var o,i,a,r;e.exports=(e=n(58),n(467),n(847),r=(n=e).x64,o=r.Word,i=r.WordArray,r=n.algo,a=r.SHA512,r=r.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=a._createHelper(r),n.HmacSHA384=a._createHmacHelper(r),e.SHA384)},function(e,t,n){e.exports=function(e){for(var d=Math,t=e,n=t.lib,h=n.WordArray,o=n.Hasher,i,a=t.x64.Word,r=t.algo,k=[],D=[],Q=[],s=1,A=0,l=0;l<24;l++){k[s+5*A]=(l+1)*(l+2)/2%64;var u=A%5;var c=(2*s+3*A)%5;s=u;A=c}for(var s=0;s<5;s++)for(var A=0;A<5;A++)D[s+5*A]=A+(2*s+3*A)%5*5;for(var g=1,p=0;p<24;p++){var m=0;var f=0;for(var B=0;B<7;B++){if(g&1){var E=(1<<B)-1;if(E<32)f^=1<<E;else m^=1<<E-32}if(g&128)g=g<<1^113;else g<<=1}Q[p]=a.create(m,f)}for(var x=[],w=0;w<25;w++)x[w]=a.create();var y=r.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){var e=this._state=[];for(var t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){var n=this._state;var o=this.blockSize/2;for(var i=0;i<o;i++){var a=e[t+2*i];var r=e[t+2*i+1];a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;r=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360;var s=n[i];s.high^=r;s.low^=a}for(var A=0;A<24;A++){for(var l=0;l<5;l++){var u=0,c=0;for(var g=0;g<5;g++){var s=n[l+5*g];u^=s.high;c^=s.low}var d=x[l];d.high=u;d.low=c}for(var l=0;l<5;l++){var h=x[(l+4)%5];var p=x[(l+1)%5];var m=p.high;var f=p.low;var u=h.high^(m<<1|f>>>31);var c=h.low^(f<<1|m>>>31);for(var g=0;g<5;g++){var s=n[l+5*g];s.high^=u;s.low^=c}}for(var B=1;B<25;B++){var u;var c;var s=n[B];var E=s.high;var w=s.low;var y=k[B];if(y<32){u=E<<y|w>>>32-y;c=w<<y|E>>>32-y}else{u=w<<y-32|E>>>64-y;c=E<<y-32|w>>>64-y}var C=x[D[B]];C.high=u;C.low=c}var b=x[0];var I=n[0];b.high=I.high;b.low=I.low;for(var l=0;l<5;l++)for(var g=0;g<5;g++){var B=l+5*g;var s=n[B];var v=x[B];var M=x[(l+1)%5+5*g];var T=x[(l+2)%5+5*g];s.high=v.high^~M.high&T.high;s.low=v.low^~M.low&T.low}var s=n[0];var S=Q[A];s.high^=S.high;s.low^=S.low}},_doFinalize:function(){var e=this._data;var t=e.words;var n=this._nDataBytes*8;var o=e.sigBytes*8;var i=this.blockSize*32;t[o>>>5]|=1<<24-o%32;t[(d.ceil((o+1)/i)*i>>>5)-1]|=128;e.sigBytes=t.length*4;this._process();var a=this._state;var r=this.cfg.outputLength/8;var s=r/8;var A=[];for(var l=0;l<s;l++){var u=a[l];var c=u.high;var g=u.low;c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;g=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;A.push(g);A.push(c)}return new h.init(A,r)},clone:function(){var e=o.clone.call(this);var t=e._state=this._state.slice(0);for(var n=0;n<25;n++)t[n]=t[n].clone();return e}});return t.SHA3=o._createHelper(y),t.HmacSHA3=o._createHmacHelper(y),e.SHA3}(n(58),n(467))},function(e,t,n){function b(e,t,n){return e&t|~e&n}function I(e,t,n){return e&n|t&~n}function v(e,t){return e<<t|e>>>32-t}var o,i,M,T,S,k,D,Q,a;e.exports=(e=n(58),Math,a=(n=e).lib,o=a.WordArray,i=a.Hasher,a=n.algo,M=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),T=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),k=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),D=o.create([0,1518500249,1859775393,2400959708,2840853838]),Q=o.create([1352829926,1548603684,1836072691,2053994217,0]),a=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var o=t+n,i=e[o];e[o]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}for(var a,r,s,A,l,u,c=this._hash.words,g=D.words,d=Q.words,h=M.words,p=T.words,m=S.words,f=k.words,B=a=c[0],E=r=c[1],w=s=c[2],y=A=c[3],C=l=c[4],n=0;n<80;n+=1)u=(u=v(u=(u=a+e[t+h[n]]|0)+(n<16?(r^s^A)+g[0]:n<32?b(r,s,A)+g[1]:n<48?((r|~s)^A)+g[2]:n<64?I(r,s,A)+g[3]:(r^(s|~A))+g[4])|0,m[n]))+l|0,a=l,l=A,A=v(s,10),s=r,r=u,u=(u=v(u=(u=B+e[t+p[n]]|0)+(n<16?(E^(w|~y))+d[0]:n<32?I(E,w,y)+d[1]:n<48?((E|~w)^y)+d[2]:n<64?b(E,w,y)+d[3]:(E^w^y)+d[4])|0,f[n]))+C|0,B=C,C=y,y=v(w,10),w=E,E=u;u=c[1]+s+y|0,c[1]=c[2]+A+C|0,c[2]=c[3]+l+B|0,c[3]=c[4]+a+E|0,c[4]=c[0]+r+w|0,c[0]=u},_doFinalize:function(){for(var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes,o=(t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),i=o.words,a=0;a<5;a++){var r=i[a];i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),n.RIPEMD160=i._createHelper(a),n.HmacRIPEMD160=i._createHmacHelper(a),e.RIPEMD160)},function(e,t,n){var o,f,i,a,B,r;e.exports=(e=n(58),n(624),n(625),i=(n=e).lib,o=i.Base,f=i.WordArray,i=n.algo,a=i.SHA256,B=i.HMAC,r=i.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=B.create(n.hasher,e),i=f.create(),a=f.create([1]),r=i.words,s=a.words,A=n.keySize,l=n.iterations;r.length<A;){for(var u=o.update(t).finalize(a),c=(o.reset(),u.words),g=c.length,d=u,h=1;h<l;h++){d=o.finalize(d),o.reset();for(var p=d.words,m=0;m<g;m++)c[m]^=p[m]}i.concat(u),s[0]++}return i.sigBytes=4*A,i}}),n.PBKDF2=function(e,t,n){return r.create(n).compute(e,t)},e.PBKDF2)},function(e,t,n){var o;e.exports=(o=n(58),n(129),o.mode.CFB=function(){var e=o.lib.BlockCipherMode.extend();function a(e,t,n,o){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,o.encryptBlock(i,0);for(var r=0;r<n;r++)e[t+r]^=i[r]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;a.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);a.call(this,e,t,o,n),this._prevBlock=i}}),e}(),o.mode.CFB)},function(e,t,n){var o;e.exports=(o=n(58),n(129),o.mode.CTR=function(){var e=o.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=this._iv,a=this._counter,r=(i&&(a=this._counter=i.slice(0),this._iv=void 0),a.slice(0));n.encryptBlock(r,0),a[o-1]=a[o-1]+1|0;for(var s=0;s<o;s++)e[t+s]^=r[s]}});return e.Decryptor=t,e}(),o.mode.CTR)},function(e,t,n){var o;e.exports=(o=n(58),n(129),
|
|
29195
29195
|
/** @preserve
|
|
29196
29196
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
29197
29197
|
* derived from CryptoJS.mode.CTR
|
|
@@ -50258,7 +50258,7 @@ return a / b;`,packedOpSnippet:`
|
|
|
50258
50258
|
* See the License for the specific language governing permissions and
|
|
50259
50259
|
* limitations under the License.
|
|
50260
50260
|
* =============================================================================
|
|
50261
|
-
*/var lGe,wl=HC,Yl=vg,Ll=_g,uGe=kg,eu=_l,cGe=Xp,kc=Qr,Kl=Lp,Sc=i,$l=Kp,Dg=qp,iu=Rs,wl=(AGe.version_vis=Og.version,{barchart:wl.barchart,table:kc.table,histogram:uGe.histogram,linechart:eu.linechart,scatterplot:cGe.scatterplot,confusionMatrix:Yl.confusionMatrix,heatmap:Ll.heatmap}),kc=(AGe.render=wl,{accuracy:iu.accuracy,perClassAccuracy:iu.perClassAccuracy,confusionMatrix:iu.confusionMatrix}),uGe=(AGe.metrics=kc,{history:Kl.history,fitCallbacks:Kl.fitCallbacks,perClassAccuracy:$l.perClassAccuracy,valuesDistribution:Dg.valuesDistribution,layer:Sc.layer,modelSummary:Sc.modelSummary}),eu=(AGe.show=uGe,Pp),gGe=(AGe.visor=eu.visor,lp);for(lGe in gGe)AGe.hasOwnProperty(lGe)||(AGe[lGe]=gGe[lGe]);gg=H({__proto__:null,default:hi(Dp)},[Dp]);g.AudioTrainingOptions=class{constructor(){A(this,"spectrogramDurationMillis"),A(this,"fftSize",1024),A(this,"sampleRateHz",44100),A(this,"durationMultiplier"),A(this,"durationSec"),A(this,"audioTrackConstraints"),A(this,"snippetDurationSec"),A(this,"onSnippet"),A(this,"includeRawAudio",!1),A(this,"overlapFactor",0),A(this,"columnTruncateLength",232)}},g.BACKGROUND_NOISE_TAG=ZM,g.ClassAction=_M,g.ClassActionAndParams=class{constructor(e,t){this.action=e,this.params=t}},g.ClassActionParams=class{constructor(e,t){this.text=e,this.commandToRun=t}},g.ClassActionType=AC,g.IMAGE_SIZE=224,g.MLModel=Fg,g.MLModelPrediction=class{constructor(){A(this,"label",""),A(this,"confidence",0)}},g.MLModelPredictions=dT,g.MLModelWorkerCommand=hT,g.MLWorkerCommandMessage=class{constructor(){A(this,"command","TRAIN"),A(this,"trainingData",null),A(this,"imagePixels",null),A(this,"digits",0),A(this,"trainingSize",0),A(this,"rnnType",""),A(this,"layers",0),A(this,"hiddenSize",0),A(this,"batchSize",0),A(this,"trainIterations",0),A(this,"numTestExamples",0),A(this,"modelJSON",null),A(this,"weightBuffers",[]),A(this,"weightInfo",[]),A(this,"tmModelUrl",""),A(this,"modelType","image-device"),A(this,"streamedAudioData"),A(this,"audioAlphabeticalWords",[])}},g.MLWorkerStatusMessage=mT,g.MLWorkerTrainingData=pT,g.MOBILE_NET_INPUT_HEIGHT=224,g.MOBILE_NET_INPUT_WIDTH=224,g.TrainingDataAction=class{constructor(){A(this,"type","TD_ACTION_NONE"),A(this,"payload",{})}},g.TrainingDataActionTypes=cC,g.TrainingDataHelper=LM,g.arrayToBase64=CT,g.classNoActionString="No Action",g.convertJpegToUtilsPixelsImage=a=>M(this,null,function*(){const i=new Image;return i.src="data:image/jpeg;base64,"+a.jpegBase64,new Promise((o,t)=>{i.onload=()=>{var e=document.createElement("canvas"),e=(e.width=i.width,e.height=i.height,e.getContext("2d"));if(e){e.drawImage(i,0,0);var n=e.getImageData(0,0,i.width,i.height);let t=n.data;if(n.data.length!=i.width*i.height*a.depth){t=new Uint8ClampedArray(i.width*i.height*a.depth);for(let e=0;e<n.data.length;e+=4)t[e]=n.data[e],t[e+1]=n.data[e+1],t[e+2]=n.data[e+2]}e={pixelsBase64:CT(t),width:n.width,height:n.height,depth:Math.round(t.length/(n.width*n.height))};o(e)}t()}})}),g.tfvis=gg,g.trainingDataReducer=(e,t)=>{var n,o=t.payload;switch(t.type){case"TD_CHANGE_CLASS_NAME":return void 0!==o.id&&void 0!==o.name?LM.renameClass(e,o.id,o.name):e;case"TD_ADD_CLASS":return void 0!==o.name?LM.addClass(e,o.name):e;case"TD_REMOVE_CLASS":return void 0!==o.id?LM.removeClass(e,o.id):e;case"TD_ADD_SAMPLE":return"audio"===o.sampleType?void 0!==o.id&&void 0!==o.timeDataQueue&&void 0!==o.freqDataQueue&&void 0!==o.image?LM.addAudioToClass(e,o.id,o.timeDataQueue,o.freqDataQueue,o.image):e:"image"===o.sampleType&&void 0!==o.id&&void 0!==o.image?LM.addImageToClass(e,o.id,o.image,o.canvas):e;case"TD_REMOVE_SAMPLE":return void 0!==o.id&&void 0!==o.sampleIdx?LM.removeSampleFromClass(e,o.id,o.sampleIdx):e;case"TD_SAVE":return LM.storeToLocalStorage(e,"trainingData"),e;case"TD_LOAD":return LM.loadFromLocalStorage("trainingData");case"TD_CHANGE_CLASS_ACTION":return void 0!==o.id&&void 0!==o.actionAndParams?((n=LM.cloneTrainingData(e)).classes[o.id].actionAndParams=o.actionAndParams,n):e;default:return e}},Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(t)}.call(this,LGe(36),LGe(111),LGe(97).Buffer,LGe(298).setImmediate)},function(n,o,e){"use strict";!function(e){var t=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();n.exports=o=t.fetch,t.fetch&&(o.default=t.fetch.bind(t)),o.Headers=t.Headers,o.Request=t.Request,o.Response=t.Response}.call(this,e(36))},function(e,t,n){const o=n(38).assess,i=n(38).assessBadges,a=n(38).BadgesManager,r=n(541).default,s=n(541).Preprocessor,A=n(541).StarProgressTracker,l=n(541).DataToStars;e.exports=class{constructor(){this.codeAssessLib=new r,this.codeAssessLib.platform="dev-mb",this.BadgesManager=a,this.isProjectLoaded=!1,this.Preprocessor=s,this.StarProgressTracker=A}setIsProjectLoaded(t){setTimeout(()=>{try{vm.runtime.targets.reduce((e,t)=>e+Object.keys(t.blocks._blocks).length,0)<10&&(this.isProjectLoaded=!1)}catch(e){this.isProjectLoaded=t}},5e3),this.isProjectLoaded=t}assess(e){return o(e)}assessBadges(e){if(!this.isProjectLoaded)return{badgesCount:(e=i(e)).badgesCount,hasCountChanged:e.hasChanged}}hasStarAchieved(e){e=l.toStars(e),e=this.StarProgressTracker.compareStars(e);return{achievedStars:e,anyStarAchieved:Object.values(e).some(e=>e.some(e=>e))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(634),r=n(635),s=n(636);class A extends i.default{constructor(e){super(),this.score=new o.AlgorithmsScores,this.name="Algorithms",this.targets=e}execute(){return this.score.Conditionals=new a.default(this.targets).execute(),this.score.Operators=new r.default(this.targets).execute(),this.score["Synchronization and Messages"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(637),r=n(638),s=n(639);class A extends i.default{constructor(e){super(),this.score=new o.AnalysisScores,this.name="Analysis",this.targets=e}execute(){return this.score.Comments=new a.default(this.targets).execute(),this.score.Debugging=new r.default(this.targets).execute(),this.score.Naming=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(640),r=n(641),s=n(642);class A extends i.default{constructor(e){super(),this.score=new o.DecompositionScores,this.name="Decomposition",this.targets=e}execute(){return this.score.Functions=new a.default(this.targets).execute(),this.score.Parallelism=new r.default(this.targets).execute(),this.score.Sequencing=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(643),r=n(644),s=n(645);class A extends i.default{constructor(e){super(),this.score=new o.GeneralisationAndAbstractionScores,this.name="Generalisation and Abstraction",this.targets=e}execute(){return this.score["Function Reuse"]=new a.default(this.targets).execute(),this.score["Functions with Arguments"]=new r.default(this.targets).execute(),this.score["Variables Instead of Literals"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(646),r=n(647);var s=n(474);const A=n(474);class l extends i.default{constructor(e){super(),this.score=new o.PatternRecAndDataRepScores,this.name="Pattern Recognition and Data Representation",this.targets=e}execute(){return this.score["Data Types"]=new a.default(this.targets).execute(),this.score.Loops=new r.default(this.targets).execute(),this.score["Variables and Data Structures"]=new A.default(this.targets).execute(),this.score}}l.range=[a.default.range[0]+r.default.range[0]+s.default.range[0]+A.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]+A.default.range[1]],t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);t.default=class{constructor(){this.scores=new o.Scores,this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return this.analyzers.forEach(e=>{var t=e.execute(),e=e.name;this.scores[e]=t}),this.scores}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n=n(881);class o{constructor(){this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return o.haveBadgesBeenInitialised?this.analyzers.forEach(e=>{var t,n=e.execute();e.wasCountMoreThanMax&&(t=e.star-1,e=e.name,o.counts[e][t]+=n)}):console.warn("BadgesManager counts have not been initialised"),o.counts}static initialiseBadgeCounts(e){o.counts=e,o.haveBadgesBeenInitialised=!0}}o.counts=new n.BadgesCounts,o.haveBadgesBeenInitialised=!0,t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_forever"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_repeat"];class r extends o.default{constructor(e){super(),this.star=2,this.name="Loops",this.newSessionCount=0,this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_repeat_until"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if_else"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if","control_if_else"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let n=0;i.default.iterateBlocks(this.targets,(e,t)=>(a.includes(e.opcode)&&(console.log("parentBlock",e),t)&&i.default.iterateThroughAllNestedBlocksFromBlock(e,t,e=>(console.log("childBlock",e),a.includes(e.opcode)&&n++,!1)),!1),!0),this.setCount(n)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0<Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const t={};i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&(t[e.opcode]=t[e.opcode]?t[e.opcode]+1:1),!1),!0);var e=Object.values(t);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["math_number","math_integer"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["text"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["martymachine_isImageLabelDetected","martymachine_menu_sound_labels_menu","sensing_mousedown","sensing_coloristouchingcolor","martymachine_isSoundLabelDetected","sensing_touchingobject","operator_equals","operator_contains","operator_gt","sensing_keypressed","operator_lt","sensing_keyoptions","operator_not","sensing_touchingobjectmenu","operator_or","martymachine_menu_image_labels_menu","sensing_touchingcolor","operator_and"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_equals","operator_gt","operator_lt","operator_and","operator_or","operator_not"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_add","operator_subtract","operator_multiply","operator_divide","operator_random","operator_round","operator_mathop","operator_mod"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_join","operator_letter_of","operator_length","operator_contains"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["event_whenflagclicked","event_whenthisspriteclicked","event_whenkeypressed","event_whenbroadcastreceived","event_whengreaterthan","event_whenbackdropswitchesto","event_videoon","event_whenloudnessgreater","event_whenstageclicked"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const n={};i.default.iterateScripts(this.targets,(e,t)=>(a.includes(e.opcode)&&!i.default.isScriptDeadCode(e,t)&&(n[e.opcode]=n[e.opcode]?n[e.opcode]+1:1),!1),!0);var e=Object.values(n);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["event_whenbroadcastreceived"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_variable"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_listcontents"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_deleteoflist","data_deletealloflist","data_insertatlist","data_replaceitemoflist","data_addtolist","data_itemoflist","data_itemnumoflist","data_lengthoflist","data_listcontainsitem"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t){},function(e,t,n){var o;e.exports=(o=n(59),function(){var e,i;"function"==typeof ArrayBuffer&&(e=o.lib.WordArray,i=e.init,(e.init=function(e){if((e=(e=e instanceof ArrayBuffer?new Uint8Array(e):e)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e)instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;i.call(this,n,t)}else i.apply(this,arguments)}).prototype=e)}(),o.lib.WordArray)},function(e,t,n){function r(e){return e<<8&4278255360|e>>>8&16711935}var i;e.exports=(e=n(59),i=e.lib.WordArray,(n=e.enc).Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return i.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=r(t[i>>>2]>>>16-i%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return i.create(n,2*t)}},e.enc.Utf16)},function(e,t,n){function r(e,t,n){for(var o,i,a=[],r=0,s=0;s<t;s++)s%4&&(o=n[e.charCodeAt(s-1)]<<s%4*2,i=n[e.charCodeAt(s)]>>>6-s%4*2,a[r>>>2]|=(o|i)<<24-r%4*8,r++);return A.create(a,r)}var A;e.exports=(e=n(59),A=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t){for(var n=e.words,o=e.sigBytes,i=(t=void 0===t?!0:t)?this._safe_map:this._map,a=(e.clamp(),[]),r=0;r<o;r+=3)for(var s=(n[r>>>2]>>>24-r%4*8&255)<<16|(n[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|n[r+2>>>2]>>>24-(r+2)%4*8&255,A=0;A<4&&r+.75*A<o;A++)a.push(i.charAt(s>>>6*(3-A)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){var n=e.length,o=(t=void 0===t?!0:t)?this._safe_map:this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],a=0;a<o.length;a++)i[o.charCodeAt(a)]=a;var t=o.charAt(64);return t&&-1!==(t=e.indexOf(t))&&(n=t),r(e,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url)},function(e,t,n){var o,i,a;e.exports=(e=n(59),n(648),o=(n=e).lib.WordArray,a=n.algo,i=a.SHA256,a=a.SHA224=i.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=i._createHelper(a),n.HmacSHA224=i._createHmacHelper(a),e.SHA224)},function(e,t,n){var o,i,a,r;e.exports=(e=n(59),n(475),n(883),r=(n=e).x64,o=r.Word,i=r.WordArray,r=n.algo,a=r.SHA512,r=r.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=a._createHelper(r),n.HmacSHA384=a._createHmacHelper(r),e.SHA384)},function(e,t,n){e.exports=function(e){for(var d=Math,t=e,n=t.lib,h=n.WordArray,o=n.Hasher,i,a=t.x64.Word,r=t.algo,k=[],D=[],Q=[],s=1,A=0,l=0;l<24;l++){k[s+5*A]=(l+1)*(l+2)/2%64;var u=A%5;var c=(2*s+3*A)%5;s=u;A=c}for(var s=0;s<5;s++)for(var A=0;A<5;A++)D[s+5*A]=A+(2*s+3*A)%5*5;for(var g=1,p=0;p<24;p++){var m=0;var f=0;for(var B=0;B<7;B++){if(g&1){var E=(1<<B)-1;if(E<32)f^=1<<E;else m^=1<<E-32}if(g&128)g=g<<1^113;else g<<=1}Q[p]=a.create(m,f)}for(var x=[],w=0;w<25;w++)x[w]=a.create();var y=r.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){var e=this._state=[];for(var t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){var n=this._state;var o=this.blockSize/2;for(var i=0;i<o;i++){var a=e[t+2*i];var r=e[t+2*i+1];a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;r=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360;var s=n[i];s.high^=r;s.low^=a}for(var A=0;A<24;A++){for(var l=0;l<5;l++){var u=0,c=0;for(var g=0;g<5;g++){var s=n[l+5*g];u^=s.high;c^=s.low}var d=x[l];d.high=u;d.low=c}for(var l=0;l<5;l++){var h=x[(l+4)%5];var p=x[(l+1)%5];var m=p.high;var f=p.low;var u=h.high^(m<<1|f>>>31);var c=h.low^(f<<1|m>>>31);for(var g=0;g<5;g++){var s=n[l+5*g];s.high^=u;s.low^=c}}for(var B=1;B<25;B++){var u;var c;var s=n[B];var E=s.high;var w=s.low;var y=k[B];if(y<32){u=E<<y|w>>>32-y;c=w<<y|E>>>32-y}else{u=w<<y-32|E>>>64-y;c=E<<y-32|w>>>64-y}var C=x[D[B]];C.high=u;C.low=c}var b=x[0];var I=n[0];b.high=I.high;b.low=I.low;for(var l=0;l<5;l++)for(var g=0;g<5;g++){var B=l+5*g;var s=n[B];var v=x[B];var M=x[(l+1)%5+5*g];var T=x[(l+2)%5+5*g];s.high=v.high^~M.high&T.high;s.low=v.low^~M.low&T.low}var s=n[0];var S=Q[A];s.high^=S.high;s.low^=S.low}},_doFinalize:function(){var e=this._data;var t=e.words;var n=this._nDataBytes*8;var o=e.sigBytes*8;var i=this.blockSize*32;t[o>>>5]|=1<<24-o%32;t[(d.ceil((o+1)/i)*i>>>5)-1]|=128;e.sigBytes=t.length*4;this._process();var a=this._state;var r=this.cfg.outputLength/8;var s=r/8;var A=[];for(var l=0;l<s;l++){var u=a[l];var c=u.high;var g=u.low;c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;g=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;A.push(g);A.push(c)}return new h.init(A,r)},clone:function(){var e=o.clone.call(this);var t=e._state=this._state.slice(0);for(var n=0;n<25;n++)t[n]=t[n].clone();return e}});return t.SHA3=o._createHelper(y),t.HmacSHA3=o._createHmacHelper(y),e.SHA3}(n(59),n(475))},function(e,t,n){function b(e,t,n){return e&t|~e&n}function I(e,t,n){return e&n|t&~n}function v(e,t){return e<<t|e>>>32-t}var o,i,M,T,S,k,D,Q,a;e.exports=(e=n(59),Math,a=(n=e).lib,o=a.WordArray,i=a.Hasher,a=n.algo,M=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),T=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),k=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),D=o.create([0,1518500249,1859775393,2400959708,2840853838]),Q=o.create([1352829926,1548603684,1836072691,2053994217,0]),a=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var o=t+n,i=e[o];e[o]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}for(var a,r,s,A,l,u,c=this._hash.words,g=D.words,d=Q.words,h=M.words,p=T.words,m=S.words,f=k.words,B=a=c[0],E=r=c[1],w=s=c[2],y=A=c[3],C=l=c[4],n=0;n<80;n+=1)u=(u=v(u=(u=a+e[t+h[n]]|0)+(n<16?(r^s^A)+g[0]:n<32?b(r,s,A)+g[1]:n<48?((r|~s)^A)+g[2]:n<64?I(r,s,A)+g[3]:(r^(s|~A))+g[4])|0,m[n]))+l|0,a=l,l=A,A=v(s,10),s=r,r=u,u=(u=v(u=(u=B+e[t+p[n]]|0)+(n<16?(E^(w|~y))+d[0]:n<32?I(E,w,y)+d[1]:n<48?((E|~w)^y)+d[2]:n<64?b(E,w,y)+d[3]:(E^w^y)+d[4])|0,f[n]))+C|0,B=C,C=y,y=v(w,10),w=E,E=u;u=c[1]+s+y|0,c[1]=c[2]+A+C|0,c[2]=c[3]+l+B|0,c[3]=c[4]+a+E|0,c[4]=c[0]+r+w|0,c[0]=u},_doFinalize:function(){for(var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes,o=(t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),i=o.words,a=0;a<5;a++){var r=i[a];i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),n.RIPEMD160=i._createHelper(a),n.HmacRIPEMD160=i._createHmacHelper(a),e.RIPEMD160)},function(e,t,n){var o,f,i,a,B,r;e.exports=(e=n(59),n(648),n(649),i=(n=e).lib,o=i.Base,f=i.WordArray,i=n.algo,a=i.SHA256,B=i.HMAC,r=i.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=B.create(n.hasher,e),i=f.create(),a=f.create([1]),r=i.words,s=a.words,A=n.keySize,l=n.iterations;r.length<A;){for(var u=o.update(t).finalize(a),c=(o.reset(),u.words),g=c.length,d=u,h=1;h<l;h++){d=o.finalize(d),o.reset();for(var p=d.words,m=0;m<g;m++)c[m]^=p[m]}i.concat(u),s[0]++}return i.sigBytes=4*A,i}}),n.PBKDF2=function(e,t,n){return r.create(n).compute(e,t)},e.PBKDF2)},function(e,t,n){var o;e.exports=(o=n(59),n(130),o.mode.CFB=function(){var e=o.lib.BlockCipherMode.extend();function a(e,t,n,o){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,o.encryptBlock(i,0);for(var r=0;r<n;r++)e[t+r]^=i[r]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;a.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);a.call(this,e,t,o,n),this._prevBlock=i}}),e}(),o.mode.CFB)},function(e,t,n){var o;e.exports=(o=n(59),n(130),o.mode.CTR=function(){var e=o.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=this._iv,a=this._counter,r=(i&&(a=this._counter=i.slice(0),this._iv=void 0),a.slice(0));n.encryptBlock(r,0),a[o-1]=a[o-1]+1|0;for(var s=0;s<o;s++)e[t+s]^=r[s]}});return e.Decryptor=t,e}(),o.mode.CTR)},function(e,t,n){var o;e.exports=(o=n(59),n(130),
|
|
50261
|
+
*/var lGe,wl=HC,Yl=vg,Ll=_g,uGe=kg,eu=_l,cGe=Xp,kc=Qr,Kl=Lp,Sc=i,$l=Kp,Dg=qp,iu=Rs,wl=(AGe.version_vis=Og.version,{barchart:wl.barchart,table:kc.table,histogram:uGe.histogram,linechart:eu.linechart,scatterplot:cGe.scatterplot,confusionMatrix:Yl.confusionMatrix,heatmap:Ll.heatmap}),kc=(AGe.render=wl,{accuracy:iu.accuracy,perClassAccuracy:iu.perClassAccuracy,confusionMatrix:iu.confusionMatrix}),uGe=(AGe.metrics=kc,{history:Kl.history,fitCallbacks:Kl.fitCallbacks,perClassAccuracy:$l.perClassAccuracy,valuesDistribution:Dg.valuesDistribution,layer:Sc.layer,modelSummary:Sc.modelSummary}),eu=(AGe.show=uGe,Pp),gGe=(AGe.visor=eu.visor,lp);for(lGe in gGe)AGe.hasOwnProperty(lGe)||(AGe[lGe]=gGe[lGe]);gg=H({__proto__:null,default:hi(Dp)},[Dp]);g.AudioTrainingOptions=class{constructor(){A(this,"spectrogramDurationMillis"),A(this,"fftSize",1024),A(this,"sampleRateHz",44100),A(this,"durationMultiplier"),A(this,"durationSec"),A(this,"audioTrackConstraints"),A(this,"snippetDurationSec"),A(this,"onSnippet"),A(this,"includeRawAudio",!1),A(this,"overlapFactor",0),A(this,"columnTruncateLength",232)}},g.BACKGROUND_NOISE_TAG=ZM,g.ClassAction=_M,g.ClassActionAndParams=class{constructor(e,t){this.action=e,this.params=t}},g.ClassActionParams=class{constructor(e,t){this.text=e,this.commandToRun=t}},g.ClassActionType=AC,g.IMAGE_SIZE=224,g.MLModel=Fg,g.MLModelPrediction=class{constructor(){A(this,"label",""),A(this,"confidence",0)}},g.MLModelPredictions=dT,g.MLModelWorkerCommand=hT,g.MLWorkerCommandMessage=class{constructor(){A(this,"command","TRAIN"),A(this,"trainingData",null),A(this,"imagePixels",null),A(this,"digits",0),A(this,"trainingSize",0),A(this,"rnnType",""),A(this,"layers",0),A(this,"hiddenSize",0),A(this,"batchSize",0),A(this,"trainIterations",0),A(this,"numTestExamples",0),A(this,"modelJSON",null),A(this,"weightBuffers",[]),A(this,"weightInfo",[]),A(this,"tmModelUrl",""),A(this,"modelType","image-device"),A(this,"streamedAudioData"),A(this,"audioAlphabeticalWords",[])}},g.MLWorkerStatusMessage=mT,g.MLWorkerTrainingData=pT,g.MOBILE_NET_INPUT_HEIGHT=224,g.MOBILE_NET_INPUT_WIDTH=224,g.TrainingDataAction=class{constructor(){A(this,"type","TD_ACTION_NONE"),A(this,"payload",{})}},g.TrainingDataActionTypes=cC,g.TrainingDataHelper=LM,g.arrayToBase64=CT,g.classNoActionString="No Action",g.convertJpegToUtilsPixelsImage=a=>M(this,null,function*(){const i=new Image;return i.src="data:image/jpeg;base64,"+a.jpegBase64,new Promise((o,t)=>{i.onload=()=>{var e=document.createElement("canvas"),e=(e.width=i.width,e.height=i.height,e.getContext("2d"));if(e){e.drawImage(i,0,0);var n=e.getImageData(0,0,i.width,i.height);let t=n.data;if(n.data.length!=i.width*i.height*a.depth){t=new Uint8ClampedArray(i.width*i.height*a.depth);for(let e=0;e<n.data.length;e+=4)t[e]=n.data[e],t[e+1]=n.data[e+1],t[e+2]=n.data[e+2]}e={pixelsBase64:CT(t),width:n.width,height:n.height,depth:Math.round(t.length/(n.width*n.height))};o(e)}t()}})}),g.tfvis=gg,g.trainingDataReducer=(e,t)=>{var n,o=t.payload;switch(t.type){case"TD_CHANGE_CLASS_NAME":return void 0!==o.id&&void 0!==o.name?LM.renameClass(e,o.id,o.name):e;case"TD_ADD_CLASS":return void 0!==o.name?LM.addClass(e,o.name):e;case"TD_REMOVE_CLASS":return void 0!==o.id?LM.removeClass(e,o.id):e;case"TD_ADD_SAMPLE":return"audio"===o.sampleType?void 0!==o.id&&void 0!==o.timeDataQueue&&void 0!==o.freqDataQueue&&void 0!==o.image?LM.addAudioToClass(e,o.id,o.timeDataQueue,o.freqDataQueue,o.image):e:"image"===o.sampleType&&void 0!==o.id&&void 0!==o.image?LM.addImageToClass(e,o.id,o.image,o.canvas):e;case"TD_REMOVE_SAMPLE":return void 0!==o.id&&void 0!==o.sampleIdx?LM.removeSampleFromClass(e,o.id,o.sampleIdx):e;case"TD_SAVE":return LM.storeToLocalStorage(e,"trainingData"),e;case"TD_LOAD":return LM.loadFromLocalStorage("trainingData");case"TD_CHANGE_CLASS_ACTION":return void 0!==o.id&&void 0!==o.actionAndParams?((n=LM.cloneTrainingData(e)).classes[o.id].actionAndParams=o.actionAndParams,n):e;default:return e}},Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})})(t)}.call(this,LGe(36),LGe(111),LGe(97).Buffer,LGe(298).setImmediate)},function(n,o,e){"use strict";!function(e){var t=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();n.exports=o=t.fetch,t.fetch&&(o.default=t.fetch.bind(t)),o.Headers=t.Headers,o.Request=t.Request,o.Response=t.Response}.call(this,e(36))},function(e,t,n){const o=n(38).assess,i=n(38).assessBadges,a=n(38).BadgesManager,r=n(541).default,s=n(541).Preprocessor,A=n(541).StarProgressTracker,l=n(541).DataToStars;e.exports=class{constructor(){this.codeAssessLib=new r,this.codeAssessLib.platform="staging",this.BadgesManager=a,this.isProjectLoaded=!1,this.Preprocessor=s,this.StarProgressTracker=A}setIsProjectLoaded(t){setTimeout(()=>{try{vm.runtime.targets.reduce((e,t)=>e+Object.keys(t.blocks._blocks).length,0)<10&&(this.isProjectLoaded=!1)}catch(e){this.isProjectLoaded=t}},5e3),this.isProjectLoaded=t}assess(e){return o(e)}assessBadges(e){if(!this.isProjectLoaded)return{badgesCount:(e=i(e)).badgesCount,hasCountChanged:e.hasChanged}}hasStarAchieved(e){e=l.toStars(e),e=this.StarProgressTracker.compareStars(e);return{achievedStars:e,anyStarAchieved:Object.values(e).some(e=>e.some(e=>e))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(634),r=n(635),s=n(636);class A extends i.default{constructor(e){super(),this.score=new o.AlgorithmsScores,this.name="Algorithms",this.targets=e}execute(){return this.score.Conditionals=new a.default(this.targets).execute(),this.score.Operators=new r.default(this.targets).execute(),this.score["Synchronization and Messages"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(637),r=n(638),s=n(639);class A extends i.default{constructor(e){super(),this.score=new o.AnalysisScores,this.name="Analysis",this.targets=e}execute(){return this.score.Comments=new a.default(this.targets).execute(),this.score.Debugging=new r.default(this.targets).execute(),this.score.Naming=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(640),r=n(641),s=n(642);class A extends i.default{constructor(e){super(),this.score=new o.DecompositionScores,this.name="Decomposition",this.targets=e}execute(){return this.score.Functions=new a.default(this.targets).execute(),this.score.Parallelism=new r.default(this.targets).execute(),this.score.Sequencing=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(643),r=n(644),s=n(645);class A extends i.default{constructor(e){super(),this.score=new o.GeneralisationAndAbstractionScores,this.name="Generalisation and Abstraction",this.targets=e}execute(){return this.score["Function Reuse"]=new a.default(this.targets).execute(),this.score["Functions with Arguments"]=new r.default(this.targets).execute(),this.score["Variables Instead of Literals"]=new s.default(this.targets).execute(),this.score}}A.range=[a.default.range[0]+r.default.range[0]+s.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]],t.default=A},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);var i=n(107);const a=n(646),r=n(647);var s=n(474);const A=n(474);class l extends i.default{constructor(e){super(),this.score=new o.PatternRecAndDataRepScores,this.name="Pattern Recognition and Data Representation",this.targets=e}execute(){return this.score["Data Types"]=new a.default(this.targets).execute(),this.score.Loops=new r.default(this.targets).execute(),this.score["Variables and Data Structures"]=new A.default(this.targets).execute(),this.score}}l.range=[a.default.range[0]+r.default.range[0]+s.default.range[0]+A.default.range[0],a.default.range[1]+r.default.range[1]+s.default.range[1]+A.default.range[1]],t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(234);t.default=class{constructor(){this.scores=new o.Scores,this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return this.analyzers.forEach(e=>{var t=e.execute(),e=e.name;this.scores[e]=t}),this.scores}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n=n(881);class o{constructor(){this.analyzers=[]}registerAnalyzer(e){this.analyzers.push(e)}analyze(){return o.haveBadgesBeenInitialised?this.analyzers.forEach(e=>{var t,n=e.execute();e.wasCountMoreThanMax&&(t=e.star-1,e=e.name,o.counts[e][t]+=n)}):console.warn("BadgesManager counts have not been initialised"),o.counts}static initialiseBadgeCounts(e){o.counts=e,o.haveBadgesBeenInitialised=!0}}o.counts=new n.BadgesCounts,o.haveBadgesBeenInitialised=!0,t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_forever"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_repeat"];class r extends o.default{constructor(e){super(),this.star=2,this.name="Loops",this.newSessionCount=0,this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_repeat_until"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Loops",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if_else"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["control_if","control_if_else"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Conditionals",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let n=0;i.default.iterateBlocks(this.targets,(e,t)=>(a.includes(e.opcode)&&(console.log("parentBlock",e),t)&&i.default.iterateThroughAllNestedBlocksFromBlock(e,t,e=>(console.log("childBlock",e),a.includes(e.opcode)&&n++,!1)),!1),!0),this.setCount(n)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0<Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["procedures_call"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Functions",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const t={};i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&(t[e.opcode]=t[e.opcode]?t[e.opcode]+1:1),!1),!0);var e=Object.values(t);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["math_number","math_integer"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["text"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&i.default.iterateBlockFields(e,e=>(e.value&&t++,!1)),!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["martymachine_isImageLabelDetected","martymachine_menu_sound_labels_menu","sensing_mousedown","sensing_coloristouchingcolor","martymachine_isSoundLabelDetected","sensing_touchingobject","operator_equals","operator_contains","operator_gt","sensing_keypressed","operator_lt","sensing_keyoptions","operator_not","sensing_touchingobjectmenu","operator_or","martymachine_menu_image_labels_menu","sensing_touchingcolor","operator_and"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Data Types",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_equals","operator_gt","operator_lt","operator_and","operator_or","operator_not"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_add","operator_subtract","operator_multiply","operator_divide","operator_random","operator_round","operator_mathop","operator_mod"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["operator_join","operator_letter_of","operator_length","operator_contains"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Operators",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["event_whenflagclicked","event_whenthisspriteclicked","event_whenkeypressed","event_whenbroadcastreceived","event_whengreaterthan","event_whenbackdropswitchesto","event_videoon","event_whenloudnessgreater","event_whenstageclicked"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){const n={};i.default.iterateScripts(this.targets,(e,t)=>(a.includes(e.opcode)&&!i.default.isScriptDeadCode(e,t)&&(n[e.opcode]=n[e.opcode]?n[e.opcode]+1:1),!1),!0);var e=Object.values(n);if(0<e.length){let t=0;return e.forEach(e=>{1<e&&t++}),this.setCount(t)}this.setCount(0)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["event_whenbroadcastreceived"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Parallelism",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_variable"];class r extends o.default{constructor(e){super(),this.star=1,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_listcontents"];class r extends o.default{constructor(e){super(),this.star=2,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&e.inputs&&0===Object.keys(e.inputs).length&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(117);const i=n(50),a=["data_deleteoflist","data_deletealloflist","data_insertatlist","data_replaceitemoflist","data_addtolist","data_itemoflist","data_itemnumoflist","data_lengthoflist","data_listcontainsitem"];class r extends o.default{constructor(e){super(),this.star=3,this.newSessionCount=0,this.name="Variables and Lists",this.wasCountMoreThanMax=!1,this.targets=e}execute(){return this.count(),this.newSessionCount}count(){let t=0;i.default.iterateBlocks(this.targets,e=>(a.includes(e.opcode)&&t++,!1),!0),this.setCount(t)}setCount(e){e>r.count?(this.newSessionCount=e-r.count,r.count=e,this.wasCountMoreThanMax=!0):this.wasCountMoreThanMax=!1}}r.count=0,r.progressionRanges=[[0,1],[1,20],[20,100]],t.default=r},function(e,t){},function(e,t,n){var o;e.exports=(o=n(59),function(){var e,i;"function"==typeof ArrayBuffer&&(e=o.lib.WordArray,i=e.init,(e.init=function(e){if((e=(e=e instanceof ArrayBuffer?new Uint8Array(e):e)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e)instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;i.call(this,n,t)}else i.apply(this,arguments)}).prototype=e)}(),o.lib.WordArray)},function(e,t,n){function r(e){return e<<8&4278255360|e>>>8&16711935}var i;e.exports=(e=n(59),i=e.lib.WordArray,(n=e.enc).Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return i.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],i=0;i<n;i+=2){var a=r(t[i>>>2]>>>16-i%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return i.create(n,2*t)}},e.enc.Utf16)},function(e,t,n){function r(e,t,n){for(var o,i,a=[],r=0,s=0;s<t;s++)s%4&&(o=n[e.charCodeAt(s-1)]<<s%4*2,i=n[e.charCodeAt(s)]>>>6-s%4*2,a[r>>>2]|=(o|i)<<24-r%4*8,r++);return A.create(a,r)}var A;e.exports=(e=n(59),A=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t){for(var n=e.words,o=e.sigBytes,i=(t=void 0===t?!0:t)?this._safe_map:this._map,a=(e.clamp(),[]),r=0;r<o;r+=3)for(var s=(n[r>>>2]>>>24-r%4*8&255)<<16|(n[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|n[r+2>>>2]>>>24-(r+2)%4*8&255,A=0;A<4&&r+.75*A<o;A++)a.push(i.charAt(s>>>6*(3-A)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){var n=e.length,o=(t=void 0===t?!0:t)?this._safe_map:this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],a=0;a<o.length;a++)i[o.charCodeAt(a)]=a;var t=o.charAt(64);return t&&-1!==(t=e.indexOf(t))&&(n=t),r(e,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url)},function(e,t,n){var o,i,a;e.exports=(e=n(59),n(648),o=(n=e).lib.WordArray,a=n.algo,i=a.SHA256,a=a.SHA224=i.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=i._createHelper(a),n.HmacSHA224=i._createHmacHelper(a),e.SHA224)},function(e,t,n){var o,i,a,r;e.exports=(e=n(59),n(475),n(883),r=(n=e).x64,o=r.Word,i=r.WordArray,r=n.algo,a=r.SHA512,r=r.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=a._createHelper(r),n.HmacSHA384=a._createHmacHelper(r),e.SHA384)},function(e,t,n){e.exports=function(e){for(var d=Math,t=e,n=t.lib,h=n.WordArray,o=n.Hasher,i,a=t.x64.Word,r=t.algo,k=[],D=[],Q=[],s=1,A=0,l=0;l<24;l++){k[s+5*A]=(l+1)*(l+2)/2%64;var u=A%5;var c=(2*s+3*A)%5;s=u;A=c}for(var s=0;s<5;s++)for(var A=0;A<5;A++)D[s+5*A]=A+(2*s+3*A)%5*5;for(var g=1,p=0;p<24;p++){var m=0;var f=0;for(var B=0;B<7;B++){if(g&1){var E=(1<<B)-1;if(E<32)f^=1<<E;else m^=1<<E-32}if(g&128)g=g<<1^113;else g<<=1}Q[p]=a.create(m,f)}for(var x=[],w=0;w<25;w++)x[w]=a.create();var y=r.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){var e=this._state=[];for(var t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){var n=this._state;var o=this.blockSize/2;for(var i=0;i<o;i++){var a=e[t+2*i];var r=e[t+2*i+1];a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;r=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360;var s=n[i];s.high^=r;s.low^=a}for(var A=0;A<24;A++){for(var l=0;l<5;l++){var u=0,c=0;for(var g=0;g<5;g++){var s=n[l+5*g];u^=s.high;c^=s.low}var d=x[l];d.high=u;d.low=c}for(var l=0;l<5;l++){var h=x[(l+4)%5];var p=x[(l+1)%5];var m=p.high;var f=p.low;var u=h.high^(m<<1|f>>>31);var c=h.low^(f<<1|m>>>31);for(var g=0;g<5;g++){var s=n[l+5*g];s.high^=u;s.low^=c}}for(var B=1;B<25;B++){var u;var c;var s=n[B];var E=s.high;var w=s.low;var y=k[B];if(y<32){u=E<<y|w>>>32-y;c=w<<y|E>>>32-y}else{u=w<<y-32|E>>>64-y;c=E<<y-32|w>>>64-y}var C=x[D[B]];C.high=u;C.low=c}var b=x[0];var I=n[0];b.high=I.high;b.low=I.low;for(var l=0;l<5;l++)for(var g=0;g<5;g++){var B=l+5*g;var s=n[B];var v=x[B];var M=x[(l+1)%5+5*g];var T=x[(l+2)%5+5*g];s.high=v.high^~M.high&T.high;s.low=v.low^~M.low&T.low}var s=n[0];var S=Q[A];s.high^=S.high;s.low^=S.low}},_doFinalize:function(){var e=this._data;var t=e.words;var n=this._nDataBytes*8;var o=e.sigBytes*8;var i=this.blockSize*32;t[o>>>5]|=1<<24-o%32;t[(d.ceil((o+1)/i)*i>>>5)-1]|=128;e.sigBytes=t.length*4;this._process();var a=this._state;var r=this.cfg.outputLength/8;var s=r/8;var A=[];for(var l=0;l<s;l++){var u=a[l];var c=u.high;var g=u.low;c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;g=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;A.push(g);A.push(c)}return new h.init(A,r)},clone:function(){var e=o.clone.call(this);var t=e._state=this._state.slice(0);for(var n=0;n<25;n++)t[n]=t[n].clone();return e}});return t.SHA3=o._createHelper(y),t.HmacSHA3=o._createHmacHelper(y),e.SHA3}(n(59),n(475))},function(e,t,n){function b(e,t,n){return e&t|~e&n}function I(e,t,n){return e&n|t&~n}function v(e,t){return e<<t|e>>>32-t}var o,i,M,T,S,k,D,Q,a;e.exports=(e=n(59),Math,a=(n=e).lib,o=a.WordArray,i=a.Hasher,a=n.algo,M=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),T=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),k=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),D=o.create([0,1518500249,1859775393,2400959708,2840853838]),Q=o.create([1352829926,1548603684,1836072691,2053994217,0]),a=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var o=t+n,i=e[o];e[o]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}for(var a,r,s,A,l,u,c=this._hash.words,g=D.words,d=Q.words,h=M.words,p=T.words,m=S.words,f=k.words,B=a=c[0],E=r=c[1],w=s=c[2],y=A=c[3],C=l=c[4],n=0;n<80;n+=1)u=(u=v(u=(u=a+e[t+h[n]]|0)+(n<16?(r^s^A)+g[0]:n<32?b(r,s,A)+g[1]:n<48?((r|~s)^A)+g[2]:n<64?I(r,s,A)+g[3]:(r^(s|~A))+g[4])|0,m[n]))+l|0,a=l,l=A,A=v(s,10),s=r,r=u,u=(u=v(u=(u=B+e[t+p[n]]|0)+(n<16?(E^(w|~y))+d[0]:n<32?I(E,w,y)+d[1]:n<48?((E|~w)^y)+d[2]:n<64?b(E,w,y)+d[3]:(E^w^y)+d[4])|0,f[n]))+C|0,B=C,C=y,y=v(w,10),w=E,E=u;u=c[1]+s+y|0,c[1]=c[2]+A+C|0,c[2]=c[3]+l+B|0,c[3]=c[4]+a+E|0,c[4]=c[0]+r+w|0,c[0]=u},_doFinalize:function(){for(var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes,o=(t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),i=o.words,a=0;a<5;a++){var r=i[a];i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),n.RIPEMD160=i._createHelper(a),n.HmacRIPEMD160=i._createHmacHelper(a),e.RIPEMD160)},function(e,t,n){var o,f,i,a,B,r;e.exports=(e=n(59),n(648),n(649),i=(n=e).lib,o=i.Base,f=i.WordArray,i=n.algo,a=i.SHA256,B=i.HMAC,r=i.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=B.create(n.hasher,e),i=f.create(),a=f.create([1]),r=i.words,s=a.words,A=n.keySize,l=n.iterations;r.length<A;){for(var u=o.update(t).finalize(a),c=(o.reset(),u.words),g=c.length,d=u,h=1;h<l;h++){d=o.finalize(d),o.reset();for(var p=d.words,m=0;m<g;m++)c[m]^=p[m]}i.concat(u),s[0]++}return i.sigBytes=4*A,i}}),n.PBKDF2=function(e,t,n){return r.create(n).compute(e,t)},e.PBKDF2)},function(e,t,n){var o;e.exports=(o=n(59),n(130),o.mode.CFB=function(){var e=o.lib.BlockCipherMode.extend();function a(e,t,n,o){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,o.encryptBlock(i,0);for(var r=0;r<n;r++)e[t+r]^=i[r]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;a.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);a.call(this,e,t,o,n),this._prevBlock=i}}),e}(),o.mode.CFB)},function(e,t,n){var o;e.exports=(o=n(59),n(130),o.mode.CTR=function(){var e=o.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=this._iv,a=this._counter,r=(i&&(a=this._counter=i.slice(0),this._iv=void 0),a.slice(0));n.encryptBlock(r,0),a[o-1]=a[o-1]+1|0;for(var s=0;s<o;s++)e[t+s]^=r[s]}});return e.Decryptor=t,e}(),o.mode.CTR)},function(e,t,n){var o;e.exports=(o=n(59),n(130),
|
|
50262
50262
|
/** @preserve
|
|
50263
50263
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
50264
50264
|
* derived from CryptoJS.mode.CTR
|