-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11-es2015.6b02af23bee91bad30c9.js
1 lines (1 loc) · 5.89 KB
/
11-es2015.6b02af23bee91bad30c9.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{DOAJ:function(n,e,t){"use strict";t.r(e),t.d(e,"LearnNumsPageModule",(function(){return y}));var i=t("ofXK"),o=t("3Pt+"),c=t("TEn/"),s=t("tyNb"),r=t("fXoL"),a=t("Bcx0");let b=(()=>{class n{constructor(){}check(n,e){return e.length==n.length?this.checkSameLength(n,e):e.length<n.length?this.checkDifferentLength(n,e):this.checkDifferentLength(e,n)}checkDifferentLength(n,e){const t=this.checkSameLength(n.substr(-e.length),e),i=n.substring(0,n.length-e.length).split("").map((e,t)=>({digit:+e,exp:n.length-t-1}));return t.bads=t.bads.concat(i),t}checkSameLength(n,e){const t=n.length-1,i=n.split("").map((n,i)=>({q:+n,a:+e[i],exponent:t-i})),o=i.filter(n=>n.a==n.q).map(n=>({digit:n.a,exp:n.exponent})),c=i.filter(n=>n.a!=n.q).map(n=>[{digit:n.a,exp:n.exponent},{digit:n.q,exp:n.exponent}]);return{goods:o,bads:[].concat(...c)}}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=r.Db({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var h=t("Zjgs");let u=(()=>{class n{newHint(n){let e=0;const t=this.indexesInRandomOrder(n.length);return()=>{const i=Array(n.length).fill("?"),o=t[e];return e=e>=t.length-1?0:e+1,i[o]=n[o],i.join("")}}indexesInRandomOrder(n){return Array(n).fill(0).map((n,e)=>e).map(n=>[Math.random(),n]).sort().map(n=>n[1])}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=r.Db({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();const d=["numberInput"];function l(n,e){if(1&n){const n=r.Lb();r.Kb(0,"ion-button",13),r.Sb("click",(function(){return r.cc(n),r.Ub().checkAnswer()})),r.Ib(1,"ion-icon",14),r.Jb()}if(2&n){const n=r.Ub();r.Zb("disabled",n.answerIsEmpty)}}function p(n,e){if(1&n){const n=r.Lb();r.Kb(0,"ion-button",15),r.Sb("click",(function(){return r.cc(n),r.Ub().newQuestion()})),r.Ib(1,"ion-icon",16),r.Jb()}}function g(n,e){if(1&n){const n=r.Lb();r.Kb(0,"ion-button",17),r.Sb("click",(function(){r.cc(n);const e=r.Ub();return e.say(e.answer)})),r.Ib(1,"ion-icon",1),r.Jb()}}let f=(()=>{class n{constructor(n,e,t,i){this.probdbService=n,this.answerChecker=e,this.speechService=t,this.hintService=i,this.wrongAnswer=!1,this.answerIsEmpty=!0,this.hint=""}newQuestion(){const n=this.probdbService.getNumberToAsk();this.question=n.join(""),this.answer="",this.wrongAnswer=!1,this.say(this.question),this.hintFunction=this.hintService.newHint(this.question),this.hint="?".repeat(this.question.length),setTimeout(()=>this.numberInput.setFocus(),0)}checkAnswer(){const n=this.answerChecker.check(this.question,""+this.answer);n.bads.forEach(n=>this.probdbService.bad(n.exp,n.digit)),n.goods.forEach(n=>this.probdbService.good(n.exp,n.digit)),this.wrongAnswer=n.bads.length>0,this.wrongAnswer?this.hint=this.question:this.newQuestion()}inputChanged(n){this.answerIsEmpty=!n||""==n}say(n){this.speechService.say(n)}showHint(){this.hint=this.hintFunction()}}return n.\u0275fac=function(e){return new(e||n)(r.Hb(a.a),r.Hb(b),r.Hb(h.a),r.Hb(u))},n.\u0275cmp=r.Bb({type:n,selectors:[["teacher"]],viewQuery:function(n,e){var t;1&n&&r.jc(d,!0),2&n&&r.bc(t=r.Tb())&&(e.numberInput=t.first)},decls:16,vars:11,consts:[["name","say",3,"click"],["name","megaphone"],["name","hint",3,"disabled","click"],["autofocus","true","type","number","inputmode","numeric",3,"disabled","ngModel","ionChange","ngModelChange"],["numberInput",""],["name","check",3,"disabled","click",4,"ngIf"],["name","new",3,"click",4,"ngIf"],["color","danger","name","sayAnswer",3,"click",4,"ngIf"],["min","0","max","100","step","1","ticks","10",3,"disabled","ngModel"],["slot","start"],["name","rainy"],["slot","end"],["name","happy"],["name","check",3,"disabled","click"],["name","checkmark"],["name","new",3,"click"],["name","caret-forward"],["color","danger","name","sayAnswer",3,"click"]],template:function(n,e){1&n&&(r.Kb(0,"p"),r.Kb(1,"ion-button",0),r.Sb("click",(function(){return e.say(e.question)})),r.Ib(2,"ion-icon",1),r.Jb(),r.Kb(3,"ion-button",2),r.Sb("click",(function(){return e.showHint()})),r.gc(4),r.Jb(),r.Kb(5,"ion-input",3,4),r.Sb("ionChange",(function(n){return e.inputChanged(n.detail.value)}))("ngModelChange",(function(n){return e.answer=n})),r.Jb(),r.fc(7,l,2,1,"ion-button",5),r.fc(8,p,2,0,"ion-button",6),r.fc(9,g,2,0,"ion-button",7),r.Kb(10,"ion-range",8),r.Vb(11,"async"),r.Kb(12,"span",9),r.Ib(13,"ion-icon",10),r.Jb(),r.Kb(14,"span",11),r.Ib(15,"ion-icon",12),r.Jb(),r.Jb(),r.Jb()),2&n&&(r.xb(3),r.Zb("disabled",e.wrongAnswer),r.xb(1),r.hc(e.hint),r.xb(1),r.Zb("disabled",e.wrongAnswer)("ngModel",e.answer),r.xb(2),r.Zb("ngIf",!e.wrongAnswer),r.xb(1),r.Zb("ngIf",e.wrongAnswer),r.xb(1),r.Zb("ngIf",e.wrongAnswer),r.xb(1),r.Zb("disabled",!0)("ngModel",r.Wb(11,9,e.probdbService.watchScore())))},directives:[c.d,c.h,c.i,c.x,o.d,o.e,i.j,c.o,c.A],pipes:[i.b],styles:["ion-input[_ngcontent-%COMP%]{--background:#ddd;width:10em}"]}),n})();const m=[{path:"",component:(()=>{class n{constructor(n){this.service=n}ionViewDidEnter(){this.teacherComponent&&this.teacherComponent.newQuestion()}}return n.\u0275fac=function(e){return new(e||n)(r.Hb(a.a))},n.\u0275cmp=r.Bb({type:n,selectors:[["app-learn-nums"]],viewQuery:function(n,e){var t;1&n&&r.jc(f,!0),2&n&&r.bc(t=r.Tb())&&(e.teacherComponent=t.first)},decls:11,vars:3,consts:[["slot","start"],["color","dark"],["name","school"]],template:function(n,e){1&n&&(r.Kb(0,"ion-header"),r.Kb(1,"ion-toolbar"),r.Kb(2,"ion-buttons",0),r.Ib(3,"ion-menu-button",1),r.Ib(4,"ion-back-button"),r.Jb(),r.Kb(5,"ion-title"),r.Ib(6,"ion-icon",2),r.gc(7),r.Vb(8,"async"),r.Jb(),r.Jb(),r.Jb(),r.Kb(9,"ion-content"),r.Ib(10,"teacher"),r.Jb()),2&n&&(r.xb(7),r.hc(r.Wb(8,1,e.service.watchName())))},directives:[c.g,c.t,c.e,c.m,c.b,c.c,c.s,c.h,c.f,f],pipes:[i.b],styles:[""]}),n})()}];let w=(()=>{class n{}return n.\u0275mod=r.Fb({type:n}),n.\u0275inj=r.Eb({factory:function(e){return new(e||n)},imports:[[s.i.forChild(m)],s.i]}),n})();var k=t("mmKz");let y=(()=>{class n{}return n.\u0275mod=r.Fb({type:n}),n.\u0275inj=r.Eb({factory:function(e){return new(e||n)},imports:[[i.c,o.a,c.u,k.a,w]]}),n})()}}]);