(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[18],{"2qu3":function(e,t,n){"use strict";var r=n("oI91"),o=n("/GRZ"),a=n("i2R6");function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw a}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[];return new Promise((function(t){var n=function(){return y=!0,t()};k(b,e).then(n,n)}))},window.__NEXT_PRELOADREADY=w.preloadReady;var j=w;t.default=j},JcwL:function(e,t,n){e.exports={gf:"MathInputField_gf__2Qvar",focused:"MathInputField_focused__BdtFy",gfc:"MathInputField_gfc__hnWs9",s:"MathInputField_s__1Ka4t",t:"MathInputField_t__31l6o",k:"MathInputField_k__PnFRD",sp:"MathInputField_sp__2pJoa"}},P7uI:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var r=function(e){try{return decodeURIComponent(e).replace(/`/g,"\\")}catch(t){}return""},o=function(e){try{return encodeURIComponent(e.replace(/\\/g,"`"))}catch(t){}return""}},VgLo:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r,o,a=n("vJKn"),i=n.n(a),u=n("rg98"),c=n("q1tI"),s=n.n(c),l=n("baAy"),d=n("JcwL"),f=n.n(d),p=n("pLT7"),h=n("hBjZ"),b=n("eF4C"),y=n("VaKt"),m=n("O0Jb"),v=n("TjI8"),g=n("a6RD"),O=n.n(g),_=n("L6Lp"),w=n("V4iQ"),k=n("JBGY"),j=n("DnYU"),I=n("9/5/"),S=n.n(I),E=n("tTo/"),x=s.a.createElement,P=O()((function(){return Promise.all([n.e(27),n.e(105)]).then(n.bind(null,"Chw/"))}),{ssr:!1,loadableGenerated:{webpack:function(){return["Chw/"]},modules:["../input/sketch2/AppSketchComponent"]}});!function(e){e[e.Closed=0]="Closed",e[e.DesktopOpen=1]="DesktopOpen",e[e.MobileOpen=2]="MobileOpen",e[e.BothOpen=3]="BothOpen"}(r||(r={})),function(e){e[e.None=0]="None",e[e.Keyboard=1]="Keyboard",e[e.Sketch=2]="Sketch"}(o||(o={}));var C={};C[r.Closed]=o.None,C[r.DesktopOpen]=o.Keyboard,C[r.MobileOpen]=o.Keyboard,C[r.BothOpen]=o.Keyboard;var M=s.a.forwardRef((function(e,t){var n=Object(c.useState)(null),a=n[0],d=n[1],g=Object(c.useState)(e.initialExpression||""),O=g[0],I=g[1],C=Object(c.useState)(""),M=C[0],D=C[1],N=Object(c.useState)(b.e.Unknown),R=N[0],F=N[1],L=Object(c.useContext)(m.a),A=Object(c.useState)(!1),T=A[0],K=A[1],q=Object(c.useState)(e.keyboardInitialState===r.Closed?o.None:o.Keyboard),B=q[0],H=q[1],G=Object(c.useRef)();Object(c.useImperativeHandle)(t,(function(){return{focus:function(){G.current&&G.current.focus()}}}));var J=function(){var t=Object(u.a)(i.a.mark((function t(n){var r,o,a,u,c;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n&&n.length>0)){t.next=22;break}return r=n.replace("data:image/png;base64,",""),t.prev=2,K(!0),t.next=6,p.a.GetExpressionFromImageBase64(r,"Sketch");case 6:o=t.sent,a=o.latex,u=o.solution,c=o.keyboardLatexInput,I(c||a),e.isInstantAnswerEnabled&&D(Object(E.a)(u)||""),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(2),k.a.LogEvent(j.a.SketchInputPage_RecognizeError,{Source:"MathInputField",Error:t.t0});case 17:return t.prev=17,K(!1),t.finish(17);case 20:t.next=24;break;case 22:I(""),e.isInstantAnswerEnabled&&D("");case 24:case"end":return t.stop()}}),t,null,[[2,14,17,20]])})));return function(e){return t.apply(this,arguments)}}(),U=function(){var e=Object(u.a)(i.a.mark((function e(t){var n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.a.SolveSimpleLatex(t);case 2:n=e.sent,D(Object(E.a)(n)||"");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),V=Object(c.useRef)(S()(U,300)).current,Y=function(t){H(o.None),e.onExpressionSubmit&&e.onExpressionSubmit(t)},Q=function(){e.preventClosedState?H(o.Sketch):H(B===o.Sketch?o.None:o.Sketch),e.onInputModalityChanged&&e.onInputModalityChanged()},W=Object(c.useCallback)((function(){Y(O)}),[O]);Object(c.useEffect)((function(){F(Object(b.c)())}),[]),Object(c.useEffect)((function(){I(e.initialExpression||"")}),[e.initialExpression]),Object(c.useEffect)((function(){e.onExpressionUpdated&&e.onExpressionUpdated(O)}),[O]);var Z=[];return e.isSketchEnabled&&Z.push(Object(b.d)(R)?x(y.IconButton,{key:"sketch","aria-label":L.MathHeadItem_Draw,styles:{root:{height:38,width:32}},iconProps:{iconName:"SketchMode",style:{height:20,width:20,color:B===o.Sketch?"#147F8F":"#767676"}},onClick:Q}):x(y.IconButton,{key:"draw","aria-label":L.MathHeadItem_Draw,styles:{root:{height:38,width:32}},iconProps:{iconName:"DrawMode",style:{height:20,width:20,color:B===o.Sketch?"#147F8F":"#767676"}},onClick:Q})),Z.push(x(y.IconButton,{key:"keyboard","aria-label":L.MathHeadItem_Type,styles:{root:{height:38,width:32}},iconProps:{iconName:"KeyboardMode",style:{height:25,width:25,color:B===o.Keyboard?"#147F8F":"#767676"}},onClick:function(){e.preventClosedState?H(o.Keyboard):H(B===o.Keyboard?o.None:o.Keyboard),e.onInputModalityChanged&&e.onInputModalityChanged()}})),Z.push(x("div",{key:"space",style:{width:10}})),x(s.a.Fragment,null,x("div",{className:e.className},x("div",{className:f.a.gfc},x(h.a,{id:e.id,className:f.a.gf,focusedClassName:f.a.focused,onGuppyLoaded:d,onSubmit:Y,onChange:function(t){I(t),e.isInstantAnswerEnabled&&(t?V(t):D(""))},expression:O,instantAnswer:M,placeholderTextOverride:B===o.Sketch?L.SK_Info:void 0,iconButtons:Z}),!e.hideSubmit&&x(y.PrimaryButton,{styles:{root:{height:40,borderRadius:3}},onClick:W,className:f.a.s,text:L.K_Solve})),x("div",{style:{height:12}}),B===o.Keyboard&&x(w.a,{className:f.a.k,onSubmitButtonClicked:W,activeGuppy:a,initialPageIndex:e.initialPageIndex,isMobile:Object(b.d)(R),keyPages:Object(b.d)(R)?_.a:v.a})),T?x(l.ProgressIndicator,{styles:{itemProgress:{padding:0,height:3,opacity:1}}}):x("div",{style:{height:3}}),B===o.Sketch&&x("div",{className:f.a.sp,style:{height:e.sketchHeight}},x(P,{onImageUpdate:J})))}));t.b=M},a6RD:function(e,t,n){"use strict";var r=n("oI91");function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t