text: /*! For license information please see commons-90739619948c8361e032.js.LICENSE.txt */
  (window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[0],{"+lMt":function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function i(e,t,n){return(i=o()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&a(o,n.prototype),o}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,r(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),a(o,e)})(e)}n.d(t,"a",(function(){return s}))},"+tC1":function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return o})),n.d(t,"b",(function(){return i}));var r=function(e){return Object.keys(e).map((function(e){return e})).map((function(t){return e[t]})).filter((function(e){return e}))},a=function(e){var t={};return e.forEach((function(e){t[e.key]=e.value})),t},o=function(e){return new Map(e.map((function(e){return[e.key,e.value]})))},i=function(e){return Object.keys(e).map((function(e){return e})).map((function(t){return{key:t,value:e[t]}}))}},"/OUt":function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n("ujs2")),r(n("Q6Uf")),r(n("8LNb")),r(n("bs47")),r(n("Xn6u"))},"2wDJ":function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n("fGyu"),a=n("LOFj");function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=n("EsTT"),l=n("9DGK"),u=n("xWie"),c=n("hsFx");function d(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var m=function(e){var t,n=e.channelKey,i=e.initialState,f=e.reduceState,m=e.reduceClientsState,h=null!==(t=localStorage.getItem("_webMeshClientKey"))&&void 0!==t?t:Date.now()+"-"+Math.floor(999999*Math.random());localStorage.setItem("_webMeshClientKey",h);var p,g,v,b,y,x,w,E,_,S,O,C=Object(s.a)(),T={meshState:i,meshMetaData:{clients:[],firstMessageTimestamp:0,lastMessageTimestamp:0}},k=[],j=setTimeout((function(){}),0),F=(p={websocketsApiUrl:u.a.websocketsApiUrl,channelKey:"wm_"+n},g=function(e){if("close"===e.kind)return clearTimeout(j),T.meshMetaData.clients=T.meshMetaData.clients.filter((function(t){return t.key!==e.c})),T.meshState=m(T.meshState,T.meshMetaData.clients),void C.onStateChange(T.meshState);var t,n,a;if(function(e){var t=Object(r.a)(T.meshMetaData.clients);T.meshMetaData.clients=T.meshMetaData.clients.filter((function(t){return t.key!==e.c})),T.meshMetaData.clients.push({key:e.c,lastActivityTimestamp:e.t}),T.meshMetaData.clients.sort((function(e,t){return-(e.lastActivityTimestamp-t.lastActivityTimestamp)})),t.map((function(e){return e.key})).join(";")!==T.meshMetaData.clients.map((function(e){return e.key})).join(";")&&(T.meshState=m(T.meshState,T.meshMetaData.clients),C.onStateChange(T.meshState))}(e),"pong"===e.kind)return clearTimeout(null!==(t=R)&&void 0!==t?t:0),void(R=null);if("ping"===e.kind)return clearTimeout(null!==(n=R)&&void 0!==n?n:0),R=null,void(e.clientKeys.includes(h)&&setTimeout(P));if("drop"===e.kind)return clearTimeout(null!==(a=R)&&void 0!==a?a:0),R=null,T.meshMetaData.clients=T.meshMetaData.clients.filter((function(t){return!e.clientKeys.some((function(e){return e===t.key}))})),T.meshState=m(T.meshState,T.meshMetaData.clients),void C.onStateChange(T.meshState);if("join"!==e.kind){if("sync"===e.kind){if(e.c===h)return;if(T.meshMetaData.firstMessageTimestamp&&T.meshMetaData.firstMessageTimestamp<e.state.meshMetaData.firstMessageTimestamp)return void(j=setTimeout(D,1e4));clearTimeout(j),T.meshMetaData.firstMessageTimestamp=e.state.meshMetaData.firstMessageTimestamp,T.meshMetaData.lastMessageTimestamp=e.state.meshMetaData.lastMessageTimestamp,T.meshMetaData.clients=Object(c.b)([].concat(Object(r.a)(T.meshMetaData.clients),Object(r.a)(e.state.meshMetaData.clients)),(function(e){return e.key})),T.meshState=e.state.meshState;for(var o,i=d(k.filter((function(e){return e.t>T.meshMetaData.lastMessageTimestamp})));!(o=i()).done;){var s=o.value;if("message"!==s.kind)return;T.meshState=f(T.meshState,s.message),T.meshMetaData.lastMessageTimestamp=s.t}return T.meshState=m(T.meshState,T.meshMetaData.clients),void C.onStateChange(T.meshState)}"message"===e.kind&&(k.push(e),T.meshMetaData.firstMessageTimestamp||(T.meshMetaData.firstMessageTimestamp=e.t),T.meshMetaData.lastMessageTimestamp=e.t,T.meshState=f(T.meshState,e.message),C.onStateChange(T.meshState))}else{if(clearTimeout(j),e.c===h)return;var l=T.meshMetaData.clients.findIndex((function(e){return e.key===h}))-1;j=setTimeout(D,l>=0?2e3*l:1e4)}},v=[],b=[],y={send:null},x=[],w=Object(a.a)({websocketsApiUrl:p.websocketsApiUrl}).connect({channelKey:p.channelKey}),E=w.subscribeMessages((function(e){g(e),v.push(Object.assign({},e,{_r:Date.now()}))})),_=w.subscribeConnectionEvents((function(e){y.send=w.isConnected()?w.send:null,b.push(e)})),S=setInterval((function(){return O()}),250),O=function(){if(y.send)for(var e,t=o(x.splice(0,x.length));!(e=t()).done;){var n=e.value;y.send(n)}},{send:function(e){y.send?(O(),y.send(e)):x.push(e)},unsubscribe:function(){clearInterval(S),y.send=null,E.unsubscribe(),_.unsubscribe(),w.close()},history:{messages:v,events:b}}),A=function(e){F.send(Object.assign({},e,{c:h,t:Date.now()}))},D=function(){T.meshMetaData.clients=T.meshMetaData.clients.filter((function(e){return e.key!==h})),T.meshMetaData.clients.unshift({key:h,lastActivityTimestamp:Date.now()}),A({kind:"sync",state:T})},P=function(){A({kind:"pong"})},R=null,L=setInterval((function(){if(!R)if(T.meshMetaData.clients.filter((function(e){return Date.now()>45e3+e.lastActivityTimestamp})).length>0){var e=T.meshMetaData.clients.findIndex((function(e){return e.key===h}));R=setTimeout((function(){R=null;var e=T.meshMetaData.clients.filter((function(e){return Date.now()>45e3+e.lastActivityTimestamp}));e.length<=0||A({kind:"drop",clientKeys:e.map((function(e){return e.key}))})}),5e3*e)}else{if(!(T.meshMetaData.clients.filter((function(e){return Date.now()>3e4+e.lastActivityTimestamp})).length<=0)){var t=T.meshMetaData.clients.findIndex((function(e){return e.key===h}));R=setTimeout((function(){R=null;var e=T.meshMetaData.clients.filter((function(e){return Date.now()>3e4+e.lastActivityTimestamp}));e.length<=0||A({kind:"ping",clientKeys:e.map((function(e){return e.key}))})}),5e3*t)}}}),5e3),M=!1;return A({kind:"join"}),{_webSocket:{history:F.history},clientKey:h,sendMessage:function(e){if(M)throw new l.b("The connection is closed");A({kind:"message",message:e})},subscribe:C.subscribe,close:function(){M||(M=!0,A({kind:"close"}),F.unsubscribe(),clearInterval(L))}}}},"3bTa":function(e,t,n){"use strict";var r=n("nGXB"),a=n("hVlx"),o=n("k5FF"),i=n("T/ei"),s=n("mWUp"),l=n("Lmbf"),u=n("fwbQ"),c=n("HBB8");r({target:"Promise",proto:!0,real:!0,forced:!!o&&i((function(){o.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=l(this,s("Promise")),n="function"==typeof e;return this.then(n?function(n){return u(t,e()).then((function(){return n}))}:e,n?function(n){return u(t,e()).then((function(){throw n}))}:e)}}),a||"function"!=typeof o||o.prototype.finally||c(o.prototype,"finally",s("Promise").prototype.finally)},"4cHy":function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return a}));var r=function(e){var t=Math.floor(e*Math.random());return t>=e?e-1:t},a=function(e){return e[r(e.length)]}},"4nvH":function(e,t,n){},"5UfP":function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e[e.menu=0]="menu",e[e.back=1]="back",e[e.error=2]="error",e[e.expanded=3]="expanded",e[e.collapsed=4]="collapsed",e[e.copy=5]="copy",e[e.retry=6]="retry",e[e.dashboard=7]="dashboard",e[e.add=8]="add",e[e.remove=9]="remove",e[e.eye=10]="eye",e[e.eyeSlash=11]="eyeSlash",e[e.checkChecked=12]="checkChecked",e[e.checkUnchecked=13]="checkUnchecked",e[e.account=14]="account",e[e.message=15]="message",e[e.subscription=16]="subscription",e[e.calendar=17]="calendar",e[e.contacts=18]="contacts",e[e.keys=19]="keys",e[e.resources=20]="resources",e[e.admin=21]="admin"}(r||(r={}))},"5ZFF":function(e,t,n){"use strict";var r=n("nGXB"),a=n("6em7").end,o=n("wObj")("trimEnd"),i=o?function(){return a(this)}:"".trimEnd;r({target:"String",proto:!0,forced:o},{trimEnd:i,trimRight:i})},"69rG":function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("ERkP"),s=n.n(i),l=n("olhD"),u=n("njmQ"),c={container:{},iFrame:{width:"100%",height:300,border:"solid 4px #888888",background:"#FFFFFF"}},d=function(e){var t=Object(i.useRef)(null),n=Object(i.useRef)(""),r=Object(i.useRef)(""),a=Object(i.useRef)(setInterval((function(){}),1e5)),o=function(e){if(t.current)try{var a,o,i=t.current.clientWidth-8+"px",s=(null!==(a=null===(o=e.contentWindow)||void 0===o?void 0:o.document.body.scrollHeight)&&void 0!==a?a:300)+8+"px";s===r.current&&i===n.current||(n.current=i,r.current=s,e.style.width=i,e.style.height=s,e.style.border="solid 4px #888888")}catch(l){}};return Object(i.useEffect)((function(){return r.current="",clearInterval(a.current),a.current=setInterval((function(){}),1e5),function(){clearInterval(a.current)}}),[e.iFrameUrl]),s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{style:c.container,ref:t},s.a.createElement("iframe",{style:c.iFrame,src:e.iFrameUrl,title:"Preview",onLoad:function(e){var t;t=e.target,o(t),clearInterval(a.current),a.current=setInterval((function(){return o(t)}),100)}})))},f=function(e){var t=e.projectState,n=e.setProjectState,r=Object(u.a)(),c=r.loading,f=(r.error,r.doWork),m=Object(i.useState)(null),h=m[0],p=m[1];return Object(i.useEffect)((function(){f(function(){var e=Object(o.a)(a.a.mark((function e(r){var o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(t);case 2:o=e.sent,p(o.iFrameUrl);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}),[t]),s.a.createElement(s.a.Fragment,null,s.a.createElement(l.a,{loading:c}),!c&&h&&s.a.createElement(d,{iFrameUrl:h}))}},"6Ufa":function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=n("fGyu"),a=n("VtSi"),o=n.n(a),i=(n("3yYM"),n("QsI/")),s=n("4cHy"),l=n("hsFx"),u=n("B8BD"),c=n("GJ35"),d=n("+tC1"),f=n("aEBB"),m=n("PyWT"),h=n("Yh9R"),p=function(){try{var e;return JSON.parse(null!==(e=localStorage.getItem("doodleStorage.v2"))&&void 0!==e?e:"NULL!{}")}catch(t){return null}},g=function(e){localStorage.setItem("doodleStorage.v2",JSON.stringify(e))},v=function(){var e=Object(i.a)(o.a.mark((function e(){var t,n,a,v,b,y,x,w,E,_,S;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b=Object(c.a)({getUploadUrl:function(){var e=Object(i.a)(o.a.mark((function e(){var t,n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null!==(t=null===(n=p())||void 0===n?void 0:n.doodleUploadUrl)&&void 0!==t?t:null);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),setUploadUrl:function(){var e=Object(i.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",g(Object.assign({},null!==(n=p())&&void 0!==n?n:{},{doodleUploadUrl:t})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),uploadApiUrl:u.a.uploadApiUrl,uploadUrlPrefix:h.a.doodleDrawingsPrefix}),y=Object(c.a)({getUploadUrl:function(){var e=Object(i.a)(o.a.mark((function e(){var t,n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null!==(t=null===(n=p())||void 0===n?void 0:n.scoresUploadUrl)&&void 0!==t?t:null);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),setUploadUrl:function(){var e=Object(i.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",g(Object.assign({},null!==(n=p())&&void 0!==n?n:{},{scoresUploadUrl:t})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),uploadApiUrl:u.a.uploadApiUrl,uploadUrlPrefix:h.a.doodleVotesPrefix}),x=function(){var e=Object(i.a)(o.a.mark((function e(){var t,n,r,a,i,s,l,d;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r=null===(t=p())||void 0===t?void 0:t.doodleUploadUrl){e.next=7;break}return a=Object(f.a)(u.a),e.next=6,a.createUploadUrl({});case 6:r=e.sent.uploadUrl;case 7:return i=null===(n=r)||void 0===n?void 0:n.getUrl.replace(r.relativePath,""),s=""+i+h.a.doodleSummary,console.log("getSummaryData",{uploadUrl:r,serverUrl:i,summaryUrl:s}),e.next=12,Object(c.c)(s);case 12:return l=e.sent,d={doodles:l.doodles.map((function(e){return{key:e.k,prompt:e.p,timestamp:e.t,drawing:Object(m.a)(e.d),score:e.s}}))},e.abrupt("return",d);case 17:return e.prev=17,e.t0=e.catch(0),e.abrupt("return",{doodles:[]});case 20:case"end":return e.stop()}}),e,null,[[0,17]])})));return function(){return e.apply(this,arguments)}}(),e.next=5,x();case 5:return w=e.sent,E={doodles:[],doodleScores:[],doodleVotes:[]},e.next=9,b.load();case 9:if(e.t2=n=e.sent,e.t1=null===e.t2,e.t1){e.next=13;break}e.t1=void 0===n;case 13:if(!e.t1){e.next=17;break}e.t3=void 0,e.next=18;break;case 17:e.t3=n.doodles.map((function(e){return{key:e.k,prompt:e.p,timestamp:e.t,drawing:e.d?Object(m.a)(e.d):e.drawing}}));case 18:if(e.t4=t=e.t3,e.t0=null!==e.t4,!e.t0){e.next=22;break}e.t0=void 0!==t;case 22:if(!e.t0){e.next=26;break}e.t5=t,e.next=27;break;case 26:e.t5=[];case 27:return E.doodles=e.t5,e.next=30,y.load();case 30:if(e.t8=v=e.sent,e.t7=null===e.t8,e.t7){e.next=34;break}e.t7=void 0===v;case 34:if(!e.t7){e.next=38;break}e.t9=void 0,e.next=39;break;case 38:e.t9=v.doodleVotes;case 39:if(e.t10=a=e.t9,e.t6=null!==e.t10,!e.t6){e.next=43;break}e.t6=void 0!==a;case 43:if(!e.t6){e.next=47;break}e.t11=a,e.next=48;break;case 47:e.t11=[];case 48:return E.doodleVotes=e.t11,_={},w.doodles.forEach((function(e){var t;_[e.key]=(null!==(t=_[e.key])&&void 0!==t?t:0)+e.score})),E.doodleScores=Object(d.b)(_).map((function(e){return{doodleKey:e.key,score:e.value}})),S={saveDrawing:function(){var e=Object(i.a)(o.a.mark((function e(t,n){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={key:t.substr(0,8)+":"+Date.now()+":"+Math.floor(999999*Math.random()),drawing:n,prompt:t,timestamp:Date.now()},E.doodles.push(r),setTimeout(Object(i.a)(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b.save({doodles:E.doodles.map((function(e){return{k:e.key,p:e.prompt,t:e.timestamp,d:Object(m.d)(e.drawing)}}))});case 2:case"end":return e.stop()}}),e)}))));case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),saveBestDrawingSelection:function(){var e=Object(i.a)(o.a.mark((function e(t){var n,r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E.doodleVotes.push({k:t.key,t:Date.now()}),(r=E.doodleScores.find((function(e){return e.doodleKey===t.key})))||(r={doodleKey:t.key,score:0},E.doodleScores.push(r)),r.score=(null!==(n=r.score)&&void 0!==n?n:0)+1,setTimeout(Object(i.a)(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.save({doodleVotes:E.doodleVotes});case 2:case"end":return e.stop()}}),e)}))));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),getDrawings:function(){var e=Object(i.a)(o.a.mark((function e(t,n){var a,i,u,c,d,f,m,h,p,g;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(a=null!=n?n:{}).includeOtherPrompts,u=void 0!==i&&i,c=a.maxCount,d=void 0===c?4:c,f=Object(l.b)([].concat(Object(r.a)(w.doodles),Object(r.a)(E.doodles.map((function(e){var t,n;return Object.assign({},e,{score:null!==(t=null===(n=E.doodleScores.find((function(t){return t.doodleKey===e.key})))||void 0===n?void 0:n.score)&&void 0!==t?t:0})})))),(function(e){return e.key})),m=f.filter((function(e){return e.prompt===t})).sort((function(e,t){return-(e.score-t.score)})),console.log("getDrawings",{samePromptDrawings:m}),h=u?f.filter((function(e){return e.prompt!==t})):[],p=u?[Object(s.b)(m)].concat(Object(r.a)(Object(l.f)(h).slice(0,d-1))):m,g=Object(l.f)(p).slice(0,d),e.abrupt("return",{doodles:g});case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),getAllDrawings:function(){var e=Object(i.a)(o.a.mark((function e(){var t;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(l.b)([].concat(Object(r.a)(w.doodles),Object(r.a)(E.doodles.map((function(e){var t,n;return Object.assign({},e,{score:null!==(t=null===(n=E.doodleScores.find((function(t){return t.doodleKey===e.key})))||void 0===n?void 0:n.score)&&void 0!==t?t:0})})))),(function(e){return e.key})),e.abrupt("return",{doodles:t});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},e.abrupt("return",S);case 54:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},"7h3R":function(e,t,n){"use strict";n.r(t),n.d(t,"ProgressGameService",(function(){return X})),n.d(t,"createProgressGameProblemService",(function(){return q})),n.d(t,"ProgressGameView",(function(){return K}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("ERkP"),s=n.n(i),l=n("z7rP"),u=n("njmQ"),c=n("DTYs"),d=n("rrTw"),f={container:{flexDirection:"row",flexWrap:"wrap",justifyContent:"space-around"},profileContainer:{flexDirection:"column",alignItems:"center"},profileCharacterView:{width:80,height:80,borderWidth:1,borderStyle:"solid",borderColor:"#888888"},profileCharacterText:{fontSize:48,textAlign:"center"},profileNameView:{},profileNameText:{}},m=function(e){var t=Object(u.a)(),n=(t.loading,t.error,t.doWork),r=Object(i.useState)(null),m=r[0],h=r[1],p=Object(i.useState)(!1),g=p[0],v=p[1],b=function(){return n(function(){var e=Object(o.a)(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.a.get().setup();case 2:return t(),e.next=5,l.a.get().getUserProfiles();case 5:n=e.sent,h(n);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())};return Object(i.useEffect)((function(){b()}),[]),m?g?s.a.createElement(d.UserProfileManagerView,{onClose:function(){v(!1),b()}}):s.a.createElement(c.h,{style:f.container},m.map((function(t){var r;return s.a.createElement(c.g,{key:t.key,onPress:function(){return r=t.key,n(function(){var t=Object(o.a)(a.a.mark((function t(n){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l.a.get().setActiveUser(r);case 2:e.onUserSelected();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());var r}},s.a.createElement(c.h,{style:f.profileContainer},s.a.createElement(c.h,{style:f.profileCharacterView},s.a.createElement(c.e,{style:f.profileCharacterText},null!==(r=t.emoji)&&void 0!==r?r:"👤")),s.a.createElement(c.h,{style:f.profileNameView},s.a.createElement(c.e,{style:f.profileNameText},t.name))))})),s.a.createElement(c.g,{onPress:function(){v(!0)}},s.a.createElement(c.h,{style:f.profileContainer},s.a.createElement(c.h,{style:f.profileCharacterView},s.a.createElement(c.e,{style:f.profileCharacterText}," 👤 ")),s.a.createElement(c.h,{style:f.profileNameView},s.a.createElement(c.e,{style:f.profileNameText},"Edit"))))):s.a.createElement(s.a.Fragment,null)},h=(n("UPNz"),n("hsFx")),p=n("fGyu"),g=n("EsTT"),v=n("+tC1"),b=function(){var e=O+"\n"+T+"\n"+j,t=C+"\n"+k+"\n\n"+E(j),n=x(e,"male"),r=x(t,"female"),a={emoji:S,name:"baby",gender:"baby",pay:0,requirementEmojis:[],startEmoji:null,parent:null,children:[]},o=[a].concat(Object(p.a)(n),Object(p.a)(r)),i=a;o.forEach((function(e){var t=o.find((function(t){return e.startEmoji===t.emoji}));t&&(t.children.push(e),e.parent=t)}));var s=y(F);return o.forEach((function(e){var t=e.requirementEmojis.map((function(e){var t;return null!==(t=s.find((function(t){return t.emoji===e})))&&void 0!==t?t:{emoji:e,cost:0}})),n=t.map((function(e){return e.emoji+" = "+e.cost})).join("\n"),r=t.reduce((function(e,t){return e+=t.cost}),0);e.debug_totalRequirementsCost=r+" =\n"+n})),{allNodes:o,root:i,allRequirements:s}},y=function(e){return e.split("\n").map((function(e){return e.trim()})).filter((function(e){return e})).map((function(e){var t=e.split("=").map((function(e){return e.trim()})).filter((function(e){return e}));return{emoji:t[0],cost:Number.parseInt(t[1],10)}}))},x=function(e,t){return e.split("\n").map((function(e){return e.trim()})).filter((function(e){return e})).map((function(e){return w(e,t)}))},w=function(e,t){var n=e.split(":").map((function(e){return e.trim()})),r=n[0],a=n[1],o=n[2],i=Number.parseInt(a,10),s=o.split("=").map((function(e){return e.trim()})),l=s[0],u=s[1].split("+").map((function(e){return e.trim()}));return{name:r,pay:i,emoji:l,startEmoji:u[0],requirementEmojis:u[1].split(" ").map((function(e){return e.trim()})).filter((function(e){return e})),children:[],parent:null,gender:t}},E=function(e){return e.replace(new RegExp(_.male,"g"),_.female).replace(new RegExp(_.man,"g"),_.woman)},_={man:String.fromCodePoint(128104),woman:String.fromCodePoint(128105),male:String.fromCodePoint(128105),female:String.fromCodePoint(128105)},S="👶",O="boy               : 0 : 👦 = 👶 + 🍼 🧸 👕 👖 🧦 🩲 👟 📖 🪁 🚲 🎮",C="girl            : 0 : 👧 = 👶 + 🍼 🧸 👚 👗 🩰 🩱 🥿 📖 🪁 🚲 🎮",T="  student_boy   : 0 : 👨‍🎓 = 👦 + 🍕 ✏️ 📓 📚 ⏰ 📱 💻 🚗 🧳 🎓",k="student_girl  : 0 : 👩‍🎓 = 👧 + 🍕 ✏️ 📓 📚 ⏰ 📱 💻 🚗 🧳 🎓",j="\nfactory_worker      :   20000 : 👨‍🏭 = 👨‍🎓 + 🧤 🥾 🔧 ⏲ 📋 🚗              \nmechanic            :   30000 : 👨‍🔧 = 👨‍🎓 + 🧤 🥾 🧰 🔧 🔩 🚚         \nconstruction_worker :   75000 : 👷‍♂️ = 👨‍🎓 + 🦺 🥾 🧰 🔧 🔨 ⚒ 🧱 🧨 🚙                    \nartist              :   35000 : 👨‍🎨 = 👨‍🎓 + 🎨 🖌 🖊 🖋 🖍 ✏️ 📒 🖼 💡 📷 🚗          \nsinger              :   40000 : 👨‍🎤 = 👨‍🎓 + 🎤 🎧 🎼 🎹 🥁 🎻 🎥 🚗       \nfarmer              :   50000 : 👨‍🌾 = 👨‍🎓 + 🧢 🥾 🥚 🐕 🐈 🐓 🐄 🐖 🐑 🐐 🚜        \ncook                :   40000 : 👨‍🍳 = 👨‍🎓 + 🍓 🥑 🥕 🥩 🍤 🥚 🥫 🥄 🍴 🧂 ⏰ 🔪 🚗      \nfirefighter         :   55000 : 👨‍🚒 = 👨‍🎓 + ⛑️ 🧯 🥾 🪓 🔔 🚒    \npolice_officer      :   60000 : 👮‍♂️ = 👨‍🎓 + 🧢 ⚖️ 🔫 🥊 🤼 📢 🚓             \ndetective           :   70000 : 🕵️‍♂️ = 👨‍🎓 + 👔 ⚖️ 🔦 🔎 📋 💼 🚓          \nteacher             :   50000 : 👨‍🏫 = 👨‍🎓 + 📝 📒 📕 📗 📘 📙 🚐\noffice_worker       :   60000 : 👨‍💼 = 👨‍🎓 + 👔 💼 💻 🗄 🪑 📁 📊 🚗             \ntechnologist        :   80000 : 👨‍💻 = 👨‍🎓 + 💻 ⌨️ 🖥 📱 🖱 🎮 🤖 🚗              \nscientist           :   90000 : 👨‍🔬 = 👨‍🎓 + 🥼 🥽 🔬 💻 🧫 🧪 ⚗️ 🚗            \njudge               :  120000 : 👨‍⚖️ = 👨‍🎓 + 👔 ⚖️ 💼 📚 🗃 🕰 🚗   \nhealth_worker       :  100000 : 👨‍⚕️ = 👨‍🎓 + 🥼 ⛑ 🔬 🩹 🩺 💊 💉 🧫 ⛑ 🚑\npilot               :  110000 : 👨‍✈️ = 👨‍🎓 + 🧥 🧭 💻 🕹 ✈️       \nastronaut           :  130000 : 👨‍🚀 = 👨‍🎓 + 🧥 🔭 💻 🕹 🚀  \n",F="\n🍼 = 10\n🧸 = 10\n👕 = 20\n👖 = 20\n🧦 = 10\n🩲 = 20\n👟 = 30\n📖 = 50\n🪁 = 25\n🚲 = 150\n🎮 = 200\n\n👚 = 20\n👗 = 20\n🩰 = 10\n🩱 = 20\n🥿 = 30\n\n🍕 = 30\n✏️ = 10\n📓 = 20\n📚 = 500\n⏰ = 15\n📱 = 350\n💻 = 1250\n🚗 = 7000\n🧳 = 800\n🎓 = 10000\n\n🧤 = 20\n🥾 = 80\n🔧 = 110\n⏲ = 25\n📋 = 15\n🧰 = 300\n🔩 = 700\n🚚 = 35000\n🦺 = 150\n🔨 = 75\n⚒ = 150\n🧱 = 3000\n🧨 = 16000\n🚙 = 32000\n🎨 = 100\n🖌 = 70\n🖊 = 50\n🖋 = 35\n🖍 = 15\n📒 = 15\n🖼 = 80\n💡 = 150\n📷 = 400\n🎤 = 150\n🎧 = 120\n🎼 = 750\n🎹 = 320\n🥁 = 450\n🎻 = 320\n🎥 = 1450\n🧢 = 25\n🥚 = 10\n🐕 = 35\n🐈 = 25\n🐓 = 30\n🐄 = 350\n🐖 = 150\n🐑 = 120\n🐐 = 100\n🚜 = 15000\n🍓 = 25\n🥑 = 30\n🥕 = 20\n🥩 = 75\n🍤 = 100\n🥫 = 50\n🥄 = 120\n🍴 = 350\n🧂 = 120\n🔪 = 225\n⛑️ = 150\n🧯 = 250\n🪓 = 50\n🔔 = 75\n🚒 = 135000\n⚖️ = 15000\n🔫 = 750\n🥊 = 500\n🤼 = 1250\n📢 = 150\n🚓 = 55000\n👔 = 250\n🔦 = 55\n🔎 = 85\n💼 = 125\n📝 = 25\n📕 = 75\n📗 = 25\n📘 = 60\n📙 = 30\n🚐 = 16000\n🗄 = 250\n🪑 = 150\n📁 = 50\n📊 = 750\n⌨️ = 75\n🖥 = 150\n🖱 = 50\n🤖 = 1500\n🥼 = 150\n🥽 = 25\n🔬 = 3500\n🧫 = 150\n🧪 = 300\n⚗️ = 250\n🗃 = 150\n🕰 = 650\n⛑ = 150\n🩹 = 100\n🩺 = 120\n💊 = 1200\n💉 = 1500\n🚑 = 75000\n🧥 = 550\n🧭 = 50\n🕹 = 850\n✈️ = 1500000\n🔭 = 350\n🚀 = 150000000\n",A=function(e){localStorage.setItem("EmojiIdleState",JSON.stringify(e))},D=function(){if(!localStorage.getItem("EmojiIdleState"))return null;try{var e;return JSON.parse(null!==(e=localStorage.getItem("EmojiIdleState"))&&void 0!==e?e:"")}catch(t){return null}},P=function(){var e,t=b(),n=Object(v.d)(t.allRequirements.map((function(e){return{key:e.emoji,value:e}}))),r={characterEmoji:t.root.emoji,emotion:"normal",lastEmotionTimestamp:Date.now(),money:0,multiplier:1,lastMultiplierChangeTimestamp:Date.now(),lastPurchaseTimestamp:Date.now(),townState:{characters:[]}},a=null!==(e=D())&&void 0!==e?e:r;a=Object.assign({},r,a);var o=Object(g.a)(a),i=function(e){a=Object.assign({},a,e),o.onStateChange(a),A(a)},s=function(e){i({money:a.money+a.multiplier,multiplier:Math.min(100,a.multiplier+e),lastMultiplierChangeTimestamp:Date.now()})};return setInterval((function(){if(!a.targetEmoji&&!a.targetOptions){var e=t.allNodes.find((function(e){return e.emoji===a.characterEmoji}));if(e){var r=e.children.map((function(e){return{emoji:e.emoji}})),o=r.filter((function(e){return!a.townState.characters.find((function(e){return e.characterEmoji}))}));o.length>0&&(r=o),0===r.length?i({targetOptions:[{emoji:t.root.emoji}]}):i({targetOptions:r})}}if(a.targetEmoji){var s,l=t.allNodes.find((function(e){return e.emoji===a.targetEmoji}));if(l){var u,c,d=l.requirementEmojis.map((function(e){return n.get(e)})).filter((function(e){return e})).map((function(e){return e})),f=d.filter((function(e){var t;return!(null!==(t=a.requirementsPurchased)&&void 0!==t&&t.includes(e.emoji))}));f.sort((function(e,t){return e.cost-t.cost}));var m=f.filter((function(e){return e.cost<=a.money}));m.length!==(null===(u=a.requirementsAvailable)||void 0===u?void 0:u.length)&&i({requirementsNeeded:d,requirementsAvailable:m}),f.length!==(null===(c=a.requirementsRemaining)||void 0===c?void 0:c.length)&&i({requirementsRemaining:f}),f.length<=0&&i({characterEmoji:a.targetEmoji,targetEmoji:void 0,targetOptions:void 0,requirementsAvailable:void 0,requirementsNeeded:void 0,requirementsPurchased:void 0})}if(Date.now()>(null!==(s=a.lastEmotionTimestamp)&&void 0!==s?s:0)+15e3){var h,p=Date.now()>(null!==(h=a.lastPurchaseTimestamp)&&void 0!==h?h:0)+3e5?"angry":"normal";a.emotion!==p&&i({emotion:p,lastEmotionTimestamp:Date.now()})}}}),1e3),{subscribePetStateChange:o.subscribe,reward:function(){return s(1)},reward_major:function(){return s(10)},reward_extreme:function(){return s(100)},punish:function(){i({multiplier:Math.max(1,a.multiplier-5),lastMultiplierChangeTimestamp:Date.now()})},selectOption:function(e){var n,r;null!==(n=a.targetOptions)&&void 0!==n&&n.find((function(t){return t.emoji===e}))&&(e===t.root.emoji&&a.townState.characters.push({characterEmoji:a.characterEmoji,finishedTimestamp:Date.now()}),i({targetEmoji:e,targetOptions:void 0,emotion:"excited",lastEmotionTimestamp:Date.now(),lastPurchaseTimestamp:Date.now(),money:0}));var o,s=null===(r=a.requirementsAvailable)||void 0===r?void 0:r.find((function(t){return t.emoji===e}));s&&s.cost<=a.money&&i({requirementsPurchased:[].concat(Object(p.a)(null!==(o=a.requirementsPurchased)&&void 0!==o?o:[]),[s.emoji]),requirementsRemaining:void 0,money:a.money-s.cost,requirementsAvailable:void 0,emotion:"excited",lastEmotionTimestamp:Date.now(),lastPurchaseTimestamp:Date.now()})}}},R={instance:null},L=function(){var e;return null!==(e=R.instance)&&void 0!==e?e:R.instance=P()},M=function(){R.instance=P()},U={container:{height:40},fixed:{position:"fixed",top:0,right:0,left:0,zIndex:1e3},inner:{position:"relative",height:40},emotionEmoji:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:24},characterEmoji:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:24},characterEmoji_small:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16},costText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#00FF00"},costText_small:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:10,color:"#00FF00"},targetCharacterEmoji:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16},objectEmoji:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:12},money:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:20,color:"#FFFF00",marginLeft:8},money_small:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#FFFF00"},multiplier:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:14,color:"#FF00FF",marginLeft:8},foodText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:12,color:"#333300"}},I=function(e){var t,n,r,a,o=Object(i.useState)(null),l=o[0],u=o[1],d=Object(i.useState)(!1),f=d[0],m=d[1];return Object(i.useEffect)((function(){var e=L().subscribePetStateChange(u);return function(){return e.unsubscribe()}})),f&&l?s.a.createElement(V,{gameState:l,onClose:function(){return m(!1)}}):s.a.createElement(c.h,{style:U.container},s.a.createElement(c.h,{style:U.fixed},s.a.createElement(c.h,{style:U.inner},s.a.createElement(H,{emoji:null!==(t=null==l?void 0:l.characterEmoji)&&void 0!==t?t:"",targetEmoji:null!==(n=null==l?void 0:l.targetEmoji)&&void 0!==n?n:"",emotion:null!==(r=null==l?void 0:l.emotion)&&void 0!==r?r:null,purchased:null!==(a=null==l?void 0:l.requirementsPurchased)&&void 0!==a?a:[],onPress:function(){return m((function(e){return!e}))}}),l&&s.a.createElement(z,{gameState:l}))))},N={container:{background:"#555555"},payText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:14,color:"#FFFFFF"},payText_disabled:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:14,color:"#CCCCCC"},moneyText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#FFFF00"},townMoneyText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#00FF00"}},B=b(),V=function(e){var t,n,r,a,o=e.gameState,i=e.onClose,l=o.townState.characters.map((function(e){var t;return{character:e,skill:null!==(t=B.allNodes.find((function(t){return t.emoji===e.characterEmoji})))&&void 0!==t?t:B.root}})).filter((function(e){return e.skill.pay})).map((function(e){return Object.assign({},e,{years:(Date.now()-e.character.finishedTimestamp)/864e5,money:Math.floor((Date.now()-e.character.finishedTimestamp)/864e5*e.skill.pay)})})),u=B.allNodes.filter((function(e){return e.children.length<=0&&!o.townState.characters.find((function(t){return t.characterEmoji===e.emoji}))})),d=l.reduce((function(e,t){var n;return e+=null!==(n=t.money)&&void 0!==n?n:0}),0);return s.a.createElement(c.h,{style:N.container},s.a.createElement(c.h,null,s.a.createElement(c.h,{style:{background:"#333333",flexDirection:"row",alignItems:"center"}},s.a.createElement(c.h,{style:{position:"relative",width:100,height:40}},s.a.createElement(c.h,{style:{position:"absolute",left:0,top:0,flexDirection:"column",alignItems:"flex-end"}},s.a.createElement(c.g,{onPress:function(){return i()}},s.a.createElement(c.e,{style:U.characterEmoji}," 🏙 ")))),s.a.createElement(c.h,{style:{flex:1}}),s.a.createElement(c.h,{style:{padding:4}},s.a.createElement(c.e,{style:N.townMoneyText},"$"+d.toLocaleString())))),s.a.createElement(c.h,{style:{background:"#333333",flexDirection:"row",alignItems:"center"}},s.a.createElement(c.h,{style:{position:"relative",width:100,height:40}},s.a.createElement(H,{emoji:null!==(t=null==o?void 0:o.characterEmoji)&&void 0!==t?t:"",targetEmoji:null!==(n=null==o?void 0:o.targetEmoji)&&void 0!==n?n:"",emotion:null!==(r=null==o?void 0:o.emotion)&&void 0!==r?r:null,purchased:null!==(a=null==o?void 0:o.requirementsPurchased)&&void 0!==a?a:[],onPress:function(){return i()}}))),l.map((function(e){var t,n,r,a;return s.a.createElement(c.h,{style:{background:"#333333",flexDirection:"row",alignItems:"center"}},s.a.createElement(c.h,{style:{position:"relative",width:100,height:40}},s.a.createElement(H,{emoji:e.character.characterEmoji,targetEmoji:"",emotion:"happy",purchased:null!==(t=null===(n=e.skill)||void 0===n?void 0:n.requirementEmojis)&&void 0!==t?t:[]})),s.a.createElement(c.h,{style:{padding:4}},s.a.createElement(c.e,{style:N.payText},"$"+(null!==(r=null===(a=e.skill)||void 0===a?void 0:a.pay)&&void 0!==r?r:0).toLocaleString())),s.a.createElement(c.h,{style:{padding:4}},s.a.createElement(c.e,{style:N.payText},"x"+e.years.toFixed(1))),s.a.createElement(c.h,{style:{flex:1}}),s.a.createElement(c.h,{style:{padding:4}},s.a.createElement(c.e,{style:N.moneyText},"$"+e.money.toLocaleString())))})),u.map((function(e){return s.a.createElement(c.h,{style:{background:"#555555",flexDirection:"row",alignItems:"center"}},s.a.createElement(c.h,{style:{position:"relative",width:100,height:40,opacity:.5}},s.a.createElement(H,{emoji:e.emoji,targetEmoji:"",emotion:null,purchased:[]})),s.a.createElement(c.h,{style:{padding:4}},s.a.createElement(c.e,{style:N.payText_disabled},"$"+e.pay.toLocaleString())))})))},z=function(e){var t,n=e.gameState,r=Object(i.useState)(0),a=r[0],o=r[1];if(Object(i.useEffect)((function(){o(0)}),[n.targetOptions,n.requirementsAvailable]),n.targetOptions&&n.targetOptions.length>0){var l=n.targetOptions.length;return s.a.createElement(c.h,{style:{position:"absolute",top:0,left:0,right:0}},s.a.createElement(c.h,{style:{flexDirection:"row",justifyContent:"center"}},n.targetOptions.slice(a,a+4).map((function(e){return s.a.createElement(c.g,{key:e.emoji,onPress:function(){return L().selectOption(e.emoji)}},s.a.createElement(c.h,null,s.a.createElement(c.e,{style:U.characterEmoji},e.emoji)))})),l>4&&s.a.createElement(c.g,{onPress:function(){return o((function(e){var t=e+5;return t>=l?0:t}))}},s.a.createElement(c.h,null,s.a.createElement(c.e,{style:U.characterEmoji},a+4<l?"⏩":"⏮")))))}var u=null!==(t=n.requirementsRemaining)&&void 0!==t?t:[];return s.a.createElement(c.h,null,s.a.createElement(W,null!=n?n:{money:0,multiplier:1}),s.a.createElement(c.h,{style:{position:"absolute",left:90,top:0,flexDirection:"row",zIndex:10}},u.slice(0,3).map((function(e){var t=e.cost<=n.money;return s.a.createElement(c.g,{key:e.emoji,onPress:function(){return L().selectOption(e.emoji)}},s.a.createElement(c.h,{style:{flexDirection:"column",alignItems:"center",background:t?"#003300":"#553300",borderRadius:4,paddingLeft:2,paddingRight:2}},s.a.createElement(c.e,{style:U.characterEmoji_small},e.emoji),s.a.createElement(c.e,{style:Object.assign({},U.costText_small,t?{}:{color:"#FF0000"})},"$"+e.cost.toLocaleString())))}))))},W=function(e){var t=e.money,n=e.multiplier,r=Object(i.useState)(0),a=r[0],o=r[1],l=Object(i.useState)(0),u=l[0],d=l[1],f=Object(i.useRef)(n),m=Object(i.useState)(0),h=m[0],p=m[1];return Object(i.useEffect)((function(){o(5);var e=function(){o((function(e){return e>0?e-1:(clearInterval(t),0)}))};e();var t=setInterval(e,25);return function(){return clearInterval(t)}}),[t]),Object(i.useEffect)((function(){d(10),p(n-f.current),f.current=n;var e=function(){d((function(e){return e>0?e-1:(clearInterval(t),0)}))};e();var t=setInterval(e,25);return function(){return clearInterval(t)}}),[n]),s.a.createElement(c.h,{style:{position:"absolute",top:0,right:4}},s.a.createElement(c.h,{style:{flexDirection:"row",justifyContent:"flex-end"}},s.a.createElement(c.h,{style:{transform:"translate(-"+a+"px,"+2*a+"px) scale("+(.1*a+1)+")"}},s.a.createElement(c.e,{style:U.money},"$"+(null!=t?t:0).toLocaleString())),s.a.createElement(c.h,{style:{transform:"translate(-"+u+"px,"+2*u+"px) scale("+(.1*u+1)+")"}},s.a.createElement(c.e,{style:Object.assign({},U.multiplier,h<-5?{color:"#FF0000"}:h<0?{color:"#FFFF00"}:{color:"#00FF00"})},("x"+(null!=n?n:1).toLocaleString()).padStart(4," ")))))},H=function(e){var t=e.emoji,n=e.targetEmoji,r=e.emotion,a=e.purchased,o=e.onPress;return s.a.createElement(s.a.Fragment,null,s.a.createElement(G,{purchased:a}),s.a.createElement(c.h,{style:{position:"absolute",left:20,top:0,flexDirection:"column",alignItems:"flex-end"}},s.a.createElement(c.g,{onPress:function(){return null==o?void 0:o()}},s.a.createElement(Y,{emotion:null!=r?r:null,emoji:t}))),s.a.createElement(c.h,{style:{position:"absolute",left:66,top:0,flexDirection:"column",alignItems:"flex-end"}},s.a.createElement(c.e,{style:U.targetCharacterEmoji},""+n)))},G=function(e){var t=e.purchased,n=Object(i.useState)(0),r=n[0],a=n[1];return Object(i.useEffect)((function(){var e=function(){a((function(e){return e+1}))};e();var t=setInterval(e,200);return function(){return clearInterval(t)}}),[t.length]),s.a.createElement(s.a.Fragment,null,t.map((function(e,t){return s.a.createElement(c.h,{key:e,style:{position:"absolute",left:0,top:0,flexDirection:"column",alignItems:"flex-end"}},s.a.createElement(c.h,{style:{transform:"translate("+(17*t+r)%60+"px,"+(5*t+r)%24+"px)"}},s.a.createElement(c.e,{style:U.objectEmoji},""+e)))})))},Y=function(e){var t=e.emotion,n=e.emoji,r=Object(i.useState)({text:n,isEmotion:!1}),a=r[0],o=r[1];return Object(i.useEffect)((function(){if(!t)return function(){};var e=!1,r=0,a=function(){(e=!e)?o({text:$(t,r++),isEmotion:!0}):o({text:n,isEmotion:!1})};a();var i=setInterval(a,3e3);return function(){return clearInterval(i)}}),[t,n]),s.a.createElement(c.e,{style:a.isEmotion?U.emotionEmoji:U.characterEmoji},a.text)},$=function(e,t){if(!e)return"😶";if("excited"===e){var n=Object(h.f)(["😁","😍","😎","🤩","🤗","🥳","😂"]);return n[t%n.length]}if("happy"===e){var r=["😀","🙂","😄","😃","😊"];return r[t%r.length]}if("normal"===e){var a=["🙂","😋","😮","🙄"];return a[t%a.length]}if("angry"===e){var o=["😳","😟","😤","😣","🥺","😫","😩"];return o[t%o.length]}if("sick"===e){var i=["🤢","🤮","😵","🤧","😬","💩","😞"];return i[t%i.length]}if("dead"===e){var s=["💀","👻","🧟‍♂️"];return s[t%s.length]}return"👾"},X=(Object(h.f)(" \n        🍕 🍔 🍟 🌭 🍿 🥓 🥚 🧇 🥞 🧈 🥐 🍞 🥨 🥖 🥯 🧀 🥗 🥙 🥪 🌯 🌮 \n        🥩 🍗 🍖 🍠 🥟 🥠 🍘 🥡 🍱 🍚 🍙 🍛 🍜 🦪 🍣 🥮 🍥 🍤 🍢 🧆 \n        🥣 🍝 🍲 🥧 🍦 🍧 🍪 🍩 🍨 🎂 🍰 🧁 🍮 🍯 🍵 ".replace("\n"," ").split(" ").map((function(e){return e.trim()})).filter((function(e){return e}))),{onCorrect:function(){L().reward()},onCompleteSection:function(){L().reward_major()},onCompleteSubject:function(){L().reward_extreme()},onWrong:function(){L().punish()}}),q=function(e,t){return Object.assign({},e,{recordAnswer:function(t,n){return n.isCorrect?(X.onCorrect(),!t.isReview&&t.isLastOfSubject?(X.onCompleteSubject(),setTimeout(Object(o.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.a.get().uploadUserData();case 2:case"end":return e.stop()}}),e)}))),1e3)):!t.isReview&&t.isLastOfSection&&(X.onCompleteSection(),setTimeout(Object(o.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.a.get().uploadUserData();case 2:case"end":return e.stop()}}),e)}))),1e3))):X.onWrong(),e.recordAnswer(t,n)}})},K=function(){var e,t,n=Object(u.a)(),r=n.loading,d=(n.error,n.doWork),f=Object(i.useState)(!1),h=f[0],p=f[1],g=Object(i.useState)(null),v=g[0],b=g[1];Object(i.useEffect)((function(){var e;b(null!==(e=l.a.get().getActiveUser())&&void 0!==e?e:null),M();var t,n=(t=Date.now(),L().subscribePetStateChange((function(e){console.log("ProgressGameView subscribePetStateChange",{lastPurchase:t,x:e}),t>=e.lastPurchaseTimestamp||(t=e.lastPurchaseTimestamp,setTimeout(Object(o.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.a.get().uploadUserData();case 2:case"end":return e.stop()}}),e)}))),1e3))})));return function(){n.unsubscribe()}}),[h]),Object(i.useEffect)((function(){d(Object(o.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.a.get().setup();case 2:M();case 3:case"end":return e.stop()}}),e)}))))}),[]);return r?s.a.createElement(s.a.Fragment,null):h?s.a.createElement(s.a.Fragment,null,s.a.createElement(I,null),s.a.createElement(c.h,null,s.a.createElement(c.g,{onPress:function(){"web"===c.c.OS&&window.location.reload()}},s.a.createElement(c.h,{style:{flexDirection:"row",alignItems:"center",justifyContent:"flex-start",padding:4}},s.a.createElement(c.e,{style:{fontSize:32}},null!==(e=null==v?void 0:v.emoji)&&void 0!==e?e:"👤"),s.a.createElement(c.e,{style:{fontSize:14}},null!==(t=null==v?void 0:v.name)&&void 0!==t?t:""))))):s.a.createElement(m,{onUserSelected:function(){return p(!0)}})}},"7vau":function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(e){return e.trim()}},"8LNb":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"9DGK":function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=n("BFfR"),a=n("+lMt"),o=function(e){function t(t,n){var r;return(r=e.call(this)||this).message=t,r.data=n,r}return Object(r.a)(t,e),t}(Object(a.a)(Error)),i=function(e){function t(t,n){var r;return(r=e.call(this)||this).message=t,r.data=n,r}return Object(r.a)(t,e),t}(Object(a.a)(Error));Error,Error},"9u8u":function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n("hsFx"),a=function(e,t){var n=t.maxNewReviewCount,a=void 0===n?3:n,o=t.reviewSequencePreviousLength,i=void 0===o?1:o,s=t.reviewQuestionPrefix,l=void 0===s?"🔄 ":s,u=t.requiredCorrectInRow,c=void 0===u?3:u,d={problemSourceHistory:[],reviewProblems:[],lastReviewProblem:null,reviewSequence:null,repeatState:"new"},f=function(){console.log("createReviewProblemService startReview",d),d.repeatState="review"},m={load:e.load,save:e.save,getSections:e.getSections,gotoSection:e.gotoSection,getNextProblem:function(){if(console.log("createReviewProblemService getNextProblem",d),"review"===d.repeatState){var t=function(){console.log("createReviewProblemService getReviewProblem",d);var e=d.reviewSequence;if(e&&e.iNext>e.iEnd&&(console.log("createReviewProblemService getReviewProblem - End of Sequence",{rSeq:e,state:d}),d.reviewSequence=null),!d.reviewSequence){var t,n,a=d.reviewProblems.find((function(e){var t,n;return e.index>(null!==(t=null===(n=d.lastReviewProblem)||void 0===n?void 0:n.index)&&void 0!==t?t:-1)}));if(!a)return console.log("createReviewProblemService getReviewProblem - No Review Problem (with greater order than last)",{reviewProblems:d.reviewProblems,lastReviewProblem:d.lastReviewProblem,state:d}),d.lastReviewProblem=null,null;var o=null!==(t=null===(n=d.lastReviewProblem)||void 0===n?void 0:n.index)&&void 0!==t?t:-1;d.lastReviewProblem=a,console.log("createReviewProblemService getReviewProblem - Start Review Sequence",d);var s=Math.max(0,a.index-i,o+1);d.reviewSequence={iNext:s,iStart:s,iEnd:a.index}}var u=d.reviewSequence,c=d.problemSourceHistory[u.iNext];return u.iNext++,Object.assign({},c,{question:l+c.question,answers:Object(r.f)(c.answers)})}();if(t)return Object.assign({},t,{isReview:!0});console.log("createReviewProblemService getNextProblem - No Review Problem - Change Mode to NEW",d),d.repeatState="new"}if(d.reviewProblems.filter((function(e){return e.correctsInRow<=1})).length>=a)return f(),m.getNextProblem();var n=e.getNextProblem();return n.question?(d.problemSourceHistory.push(n),n):(f(),m.getNextProblem())},recordAnswer:function(t,n){console.log("createReviewProblemService recordAnswer",d);var r=d.problemSourceHistory.findIndex((function(e){return e.key===t.key}));if(r<0)e.recordAnswer(t,n);else{var a=d.reviewProblems.find((function(e){return e.index===r}));if(n.isCorrect)a&&(a.correctsInRow++,d.reviewProblems=d.reviewProblems.filter((function(e){return e.correctsInRow<=c})));else if(a)a.correctsInRow=0;else{var o={index:r,correctsInRow:0,_debug_problemKey:t.key};d.reviewProblems.push(o),d.reviewProblems.sort((function(e,t){return e.index-t.index}))}e.recordAnswer(t,n)}}};return m}},AJkQ:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));n("5ZFF"),n("E2zO");var r=n("fGyu"),a=n("9DGK");function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=function(){function e(t,n,a){var i=this;this.debug=void 0,this.indexOf=function(e){var t=i.source.indexOf(e,i.start);return t<i.start||t>=i.start+i.length?-1:t},this.lastIndexOf=function(e){var t=i.source.lastIndexOf(e,i.start+i.length);return t<i.start||t>=i.start+i.length?-1:t},this.indexOfAny=function(e){var t=e.map((function(e){return i.source.indexOf(e,i.start)})).filter((function(e){return e>=0}));if(t.length<=0)return-1;var n=Math.min.apply(Math,Object(r.a)(t));return n<0||n>i.start+i.length?-1:n},this.indexOfRegExp=function(e){var t,n;e.lastIndex=i.start;var r=e.exec(i.source),a=null!==(t=null==r?void 0:r.index)&&void 0!==t?t:-1;return a<0||a>i.start+i.length?{index:-1,length:0}:{index:a,length:null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0}},this.lastIndexOfRegex=function(e){var t;e.lastIndex=i.start;for(var n=-1,r=0;(t=e.exec(i.source))&&!(t.index>i.start+i.length)&&!(t.index<0);)n=t.index,r=t.length;return{index:n,length:r}},this.splitOn=function(t,n){void 0===n&&(n=null);for(var r=[],a=i.source,o=i.start,s=i.start+i.length,l=o,u=i.indexOf(t);u>=0&&u<=s&&(!n||r.length<n-1);)r.push(new e(a,l,u-l)),l=u,u=a.indexOf(t,u+t.length);return u=s,r.push(new e(a,l,u-l)),r.filter((function(e){return e.length>0&&e.start>=i.start&&e.start+e.length<=i.start+i.length}))},this.splitOnRegExp=function(t,n){void 0===n&&(n=null);var r=[],a=i.source,o=i.start,s=i.start+i.length,l=o;t.lastIndex=i.start;for(var u=t.exec(a);u&&u.index<=s&&(!n||r.length<n-1);)r.push(new e(a,l,u.index-l)),l=u.index,u=t.exec(a);var c=s;return r.push(new e(a,l,c-l)),r.filter((function(e){return e.length>0&&e.start>=i.start&&e.start+e.length<=i.start+i.length}))},this.startsWith=function(e){return i.source.startsWith(e,i.start)},this.trimStart=function(e){void 0===e&&(e=[" ","\t","\r","\n"]);var t=i.source;e="string"==typeof e?[e]:e;for(var n=i.start,r=-1;n!==r;){r=n;for(var a,s=o(e);!(a=s()).done;){var l=a.value;if(t.startsWith(l,n)){n+=l.length;break}}}return i.transform(n-i.start,0)},this.trimEnd=function(e){void 0===e&&(e=[" ","\t","\r","\n"]);var t=i.source;e="string"==typeof e?[e]:e;for(var n=i.start+i.length,r=-1;n!==r;){r=n;for(var a,s=o(e);!(a=s()).done;){var l=a.value;if(n-l.length>=0&&t.startsWith(l,n-l.length)){n-=l.length;break}}}return i.transform(0,n-(i.start+i.length))},this.trim=function(e){return void 0===e&&(e=[" ","\t","\r","\n"]),i.trimStart(e).trimEnd(e)},this.transform=function(t,n){return new e(i.source,i.start+t,i.length+n-t)},this.newRange=function(t,n){return new e(i.source,t,n)},this.source=t,this.start=null!=n?n:0,this.length=null!=a?a:t.length,this.debug=this.toText()}var t=e.prototype;return t.toText=function(){return this.source.substr(this.start,this.length)},t.getChar=function(e){if(e<this.start||e>=this.start+this.length)throw new a.b("StringSpan.getChar(): Out of range",{index:e,s:this});return this.source[e]},e}()},B8BD:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={uploadApiUrl:"https://s7mrgkmtk5.execute-api.us-east-1.amazonaws.com/prod/upload-api"}},BQ33:function(e,t,n){e.exports=function(){"use strict";var e="millisecond",t="second",n="minute",r="hour",a="day",o="week",i="month",s="quarter",l="year",u="date",c=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},h={s:m,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+m(r,2,"0")+":"+m(a,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),a=t.clone().add(r,i),o=n-a<0,s=t.clone().add(r+(o?-1:1),i);return+(-(r+(n-a)/(o?a-s:s-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(c){return{M:i,y:l,w:o,d:a,D:u,h:r,m:n,s:t,ms:e,Q:s}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},p="en",g={};g[p]=f;var v=function(e){return e instanceof w},b=function(e,t,n){var r;if(!e)return p;if("string"==typeof e)g[e]&&(r=e),t&&(g[e]=t,r=e);else{var a=e.name;g[a]=e,r=a}return!n&&r&&(p=r),r||!n&&p},y=function(e,t){if(v(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new w(n)},x=h;x.l=b,x.i=v,x.w=function(e,t){return y(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var w=function(){function f(e){this.$L=b(e.locale,null,!0),this.parse(e)}var m=f.prototype;return m.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(x.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(c);if(r){var a=r[2]-1||0,o=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},m.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},m.$utils=function(){return x},m.isValid=function(){return!("Invalid Date"===this.$d.toString())},m.isSame=function(e,t){var n=y(e);return this.startOf(t)<=n&&n<=this.endOf(t)},m.isAfter=function(e,t){return y(e)<this.startOf(t)},m.isBefore=function(e,t){return this.endOf(t)<y(e)},m.$g=function(e,t,n){return x.u(e)?this[t]:this.set(n,e)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(e,s){var c=this,d=!!x.u(s)||s,f=x.p(e),m=function(e,t){var n=x.w(c.$u?Date.UTC(c.$y,t,e):new Date(c.$y,t,e),c);return d?n:n.endOf(a)},h=function(e,t){return x.w(c.toDate()[e].apply(c.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(t)),c)},p=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(f){case l:return d?m(1,0):m(31,11);case i:return d?m(1,g):m(0,g+1);case o:var y=this.$locale().weekStart||0,w=(p<y?p+7:p)-y;return m(d?v-w:v+(6-w),g);case a:case u:return h(b+"Hours",0);case r:return h(b+"Minutes",1);case n:return h(b+"Seconds",2);case t:return h(b+"Milliseconds",3);default:return this.clone()}},m.endOf=function(e){return this.startOf(e,!1)},m.$set=function(o,s){var c,d=x.p(o),f="set"+(this.$u?"UTC":""),m=(c={},c[a]=f+"Date",c[u]=f+"Date",c[i]=f+"Month",c[l]=f+"FullYear",c[r]=f+"Hours",c[n]=f+"Minutes",c[t]=f+"Seconds",c[e]=f+"Milliseconds",c)[d],h=d===a?this.$D+(s-this.$W):s;if(d===i||d===l){var p=this.clone().set(u,1);p.$d[m](h),p.init(),this.$d=p.set(u,Math.min(this.$D,p.daysInMonth())).$d}else m&&this.$d[m](h);return this.init(),this},m.set=function(e,t){return this.clone().$set(e,t)},m.get=function(e){return this[x.p(e)]()},m.add=function(e,s){var u,c=this;e=Number(e);var d=x.p(s),f=function(t){var n=y(c);return x.w(n.date(n.date()+Math.round(t*e)),c)};if(d===i)return this.set(i,this.$M+e);if(d===l)return this.set(l,this.$y+e);if(d===a)return f(1);if(d===o)return f(7);var m=(u={},u[n]=6e4,u[r]=36e5,u[t]=1e3,u)[d]||1,h=this.$d.getTime()+e*m;return x.w(h,this)},m.subtract=function(e,t){return this.add(-1*e,t)},m.format=function(e){var t=this;if(!this.isValid())return"Invalid Date";var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=x.z(this),a=this.$locale(),o=this.$H,i=this.$m,s=this.$M,l=a.weekdays,u=a.months,c=function(e,r,a,o){return e&&(e[r]||e(t,n))||a[r].substr(0,o)},f=function(e){return x.s(o%12||12,e,"0")},m=a.meridiem||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r},h={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:x.s(s+1,2,"0"),MMM:c(a.monthsShort,s,u,3),MMMM:c(u,s),D:this.$D,DD:x.s(this.$D,2,"0"),d:String(this.$W),dd:c(a.weekdaysMin,this.$W,l,2),ddd:c(a.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:x.s(o,2,"0"),h:f(1),hh:f(2),a:m(o,i,!0),A:m(o,i,!1),m:String(i),mm:x.s(i,2,"0"),s:String(this.$s),ss:x.s(this.$s,2,"0"),SSS:x.s(this.$ms,3,"0"),Z:r};return n.replace(d,(function(e,t){return t||h[e]||r.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(e,u,c){var d,f=x.p(u),m=y(e),h=6e4*(m.utcOffset()-this.utcOffset()),p=this-m,g=x.m(this,m);return g=(d={},d[l]=g/12,d[i]=g,d[s]=g/3,d[o]=(p-h)/6048e5,d[a]=(p-h)/864e5,d[r]=p/36e5,d[n]=p/6e4,d[t]=p/1e3,d)[f]||p,c?g:x.a(g)},m.daysInMonth=function(){return this.endOf(i).$D},m.$locale=function(){return g[this.$L]},m.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=b(e,t,!0);return r&&(n.$L=r),n},m.clone=function(){return x.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},f}(),E=w.prototype;return y.prototype=E,[["$ms",e],["$s",t],["$m",n],["$H",r],["$W",a],["$M",i],["$y",l],["$D",u]].forEach((function(e){E[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),y.extend=function(e,t){return e.$i||(e(t,w,y),e.$i=!0),y},y.locale=b,y.isDayjs=v,y.unix=function(e){return y(1e3*e)},y.en=g[p],y.Ls=g,y.p={},y}()},CN1R:function(e,t,n){e.exports=function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(t,n,r){var a=n.prototype,o=a.format;r.en.formats=e,a.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var n=this.$locale().formats,r=function(t,n){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,r,a){var o=a&&a.toUpperCase();return r||n[a]||e[a]||n[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(t,void 0===n?{}:n);return o.call(this,r)}}}()},DTYs:function(e,t,n){"use strict";n.d(t,"h",(function(){return m})),n.d(t,"e",(function(){return h})),n.d(t,"f",(function(){return p})),n.d(t,"g",(function(){return g})),n.d(t,"d",(function(){return v})),n.d(t,"a",(function(){return b})),n.d(t,"c",(function(){return x})),n.d(t,"b",(function(){return w}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=(n("S1bJ"),n("ERkP")),s=n.n(i);function l(e){if(Array.isArray(e)){var t,n;if(1===e.length)return null!==(n=l(e[0]))&&void 0!==n?n:{};var r=Object.assign({},l(e[0]));return e.forEach((function(e){r=Object.assign({},r,l(null!=e?e:{}))})),null!==(t=r)&&void 0!==t?t:{}}return e}var u,c={display:"flex",flexDirection:"column"},d={whiteSpace:"pre"},f=function(e){var t=e;return"none"===t.userSelect&&(t.MozUserSelect="none",t.WebkitUserSelect="none"),e},m=function(e){return s.a.createElement("div",{style:l([c,e.style])},e.children)},h=function(e){if(1===e.numberOfLines){var t=l([d,e.style,{overflow:"hidden",whiteSpace:"nowrap",wordWrap:"break-word",textOverflow:"ellipsis"}]);return s.a.createElement("span",{style:f(t)},e.children)}var n=l([d,e.style]);return s.a.createElement("span",{style:f(n)},e.children)},p=function(e){var t,n,r="numeric"===e.keyboardType?"number":e.secureTextEntry?"password":"text",a="username"===e.autoCompleteType?"username":"password"===e.autoCompleteType?"password":void 0,o=e.onSubmitEditing&&function(t){var n;"Enter"!==t.key||t.shiftKey||(t.preventDefault(),null===(n=e.onSubmitEditing)||void 0===n||n.call(e))}||void 0;return e.multiline?s.a.createElement("textarea",{name:a,id:a,style:l([d,e.style]),placeholder:e.placeholder,disabled:!(null===(n=e.editable)||void 0===n||n),value:e.value,onFocus:e.onFocus,onChange:function(t){return e.onChange(t.target.value)},onKeyPress:o,onBlur:e.onBlur,rows:e.numberOfLines,onSelect:function(t){var n,r,a,o=t.target,i={start:null!==(n=o.selectionStart)&&void 0!==n?n:0,end:null!==(r=o.selectionEnd)&&void 0!==r?r:0};(o.selectionStart||o.selectionEnd)&&(null===(a=e.onSelectionChange)||void 0===a||a.call(e,i))}}):s.a.createElement("input",{type:r,name:a,id:a,style:l([d,e.style]),placeholder:e.placeholder,disabled:!(null===(t=e.editable)||void 0===t||t),value:e.value,onFocus:e.onFocus,onChange:function(t){return e.onChange(t.target.value)},onKeyPress:o,onBlur:e.onBlur})},g=function(e){var t=Object(i.useRef)(Date.now()),n=function(){Date.now()<t.current+250||(t.current=Date.now(),e.onPress())},r=Object(i.useRef)(!0);return s.a.createElement("div",{style:l([c,e.style]),onClick:n,onKeyPress:n,onTouchStart:function(){r.current=!0},onTouchMove:function(){r.current=!1},onTouchEnd:function(){r.current&&n()},role:"button",tabIndex:0},e.children)},v=function(e){var t=function(e){var t;return e.preventDefault(),null===(t=e.stopPropagation)||void 0===t||t.call(e),e.cancelBubble=!0,e.returnValue=!1,!1},n=function(n){return e.onPressIn(),t(n)},r=function(n){return e.onPressOut(),t(n)};return s.a.createElement("div",{style:l([c,e.style]),onMouseDown:n,onMouseUp:r,onTouchStart:n,onTouchEnd:r,onTouchCancel:r,onTouchMove:t,onMouseLeave:r,onTouchEndCapture:r,role:"button",tabIndex:0},e.children)},b=function(e){var t=e.size,n=e.color,r="small"===t?16:32;return s.a.createElement(y,{size:r,thickness:r/8,color:n})},y=function(e){var t=e.size,n=e.thickness,r=e.color,a=.6*(2*Math.PI*(t-n)*.5);return s.a.createElement("svg",{style:{maxWidth:t},viewBox:"0 0 "+t+" "+t,xmlns:"http://www.w3.org/2000/svg"},s.a.createElement("circle",{style:{fill:"transparent",stroke:r,strokeWidth:n,opacity:.5},cx:.5*t,cy:.5*t,r:.5*t-n}),s.a.createElement("circle",{className:"activity-spinner",style:{strokeDasharray:a,fill:"transparent",stroke:r,strokeWidth:n,transformOrigin:.5*t+"px "+.5*t+"px"},cx:.5*t,cy:.5*t,r:.5*t-n}))},x={OS:"web"},w={setString:(u=Object(o.a)(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.clipboard.writeText(t);case 2:case"end":return e.stop()}}),e)}))),function(e){return u.apply(this,arguments)})}},"DZ/V":function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=function(e){var t=e.languange,n=e.speechService,i=Object(r.useState)(!0),s=i[0],l=i[1],u=Object(r.useState)(0),c=(u[0],u[1]),d=function(){l(!0),setTimeout((function(){l(!1)}),1e3)};Object(r.useEffect)((function(){d()}),[]);return a.a.createElement(o.h,null,a.a.createElement(o.g,{onPress:d},a.a.createElement(o.e,{style:{fontSize:24}},"Voice for "+t)),s&&a.a.createElement(o.a,{size:"small",color:"red"}),!s&&a.a.createElement(a.a.Fragment,null,n.getVoicesForLanguange(t).map((function(e){return a.a.createElement(o.g,{key:e.voice.name,onPress:function(){var r;r=e.voice,n.setVoiceForLanguange(t,r),c((function(e){return e+1})),n.speak(r.name,t)}},a.a.createElement(o.h,null,a.a.createElement(o.e,{style:{margin:4,fontSize:14,whiteSpace:"normal"}},(e.isSelected?"✅":"🔲")+" "+e.voice.lang+" - "+e.voice.name+" - "+(e.voice.localService?"local":"web"))))}))))}},E2zO:function(e,t,n){"use strict";var r=n("nGXB"),a=n("6em7").start,o=n("wObj")("trimStart"),i=o?function(){return a(this)}:"".trimStart;r({target:"String",proto:!0,forced:o},{trimStart:i,trimLeft:i})},EsTT:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(e){var t=e,n=[];return{subscribe:function(e){var r=n.length;return n.push(e),setTimeout((function(){t&&e(t)})),{unsubscribe:function(){n[r]=null}}},onStateChange:function(e){t=e,n.forEach((function(t){return null==t?void 0:t(e)}))}}}},GJ35:function(e,t,n){"use strict";n.d(t,"c",(function(){return u})),n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return d}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("uTf4"),s=n("9DGK"),l=n("aEBB"),u=function(){var e=Object(o.a)(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(i.a)(t,{method:"GET",headers:{Accept:"application/json"}});case 2:return n=e.sent,e.next=5,n.json();case 5:return r=e.sent,e.abrupt("return",r.data);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),c=function(e){return{uploadData:(n=Object(o.a)(a.a.mark((function t(n){var r;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=JSON.stringify({data:n}),t.next=3,Object(i.a)(e.putUrl,{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json","Content-Length":""+r.length},body:r});case 3:if(t.sent.ok){t.next=6;break}throw new s.b("Upload Failed");case 6:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),downloadData:(t=Object(o.a)(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u(e.getUrl);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})};var t,n},d=function(e){var t,n,r=Object(l.a)(e),i=null,s=function(){var t=Object(o.a)(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=2;break}return t.abrupt("return",i);case 2:return t.next=4,e.getUploadUrl();case 4:if(!(i=t.sent)){t.next=7;break}return t.abrupt("return",i);case 7:return t.next=9,r.createUploadUrl({prefix:e.uploadUrlPrefix});case 9:return i=t.sent.uploadUrl,t.next=12,e.setUploadUrl(i);case 12:return t.abrupt("return",i);case 13:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return{load:(n=Object(o.a)(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s();case 2:return t=e.sent,e.prev=3,e.next=6,u(t.getUrl);case 6:return n=e.sent,e.abrupt("return",n);case 10:return e.prev=10,e.t0=e.catch(3),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,null,[[3,10]])}))),function(){return n.apply(this,arguments)}),save:(t=Object(o.a)(a.a.mark((function t(n){var o,l,u,d,f;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s();case 2:return o=t.sent,t.prev=3,l=c(o),t.next=7,l.uploadData(n);case 7:t.next=20;break;case 9:return t.prev=9,t.t0=t.catch(3),t.next=13,r.renewUploadUrl({uploadUrl:o});case 13:return o=t.sent.uploadUrl,t.next=16,e.setUploadUrl(o);case 16:return i=o,u=c(o),t.next=20,u.uploadData(n);case 20:return t.next=22,r.createUploadUrl({prefix:"backup/"+o.relativePath});case 22:return d=t.sent.uploadUrl,f=c(d),t.next=26,f.uploadData(n);case 26:case"end":return t.stop()}}),t,null,[[3,9]])}))),function(e){return t.apply(this,arguments)})}}},Gcfp:function(e,t){"undefined"==typeof ga&&(ga=function(){})},H5jT:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return m}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("gptL"),s=function(e,t){var n=[];return JSON.stringify(e,(function(e,t){if(null!=t&&"object"==typeof t){if(n.includes(t))return"[OBJ-DUPLICATED]";n.push(t)}return t}),t?2:0)},l=n("gLDK"),u=n("5UfP"),c={view:i.c.view_error,text:i.c.text_error,text_errorMessage:i.c.text_errorMessage,icon:i.c.icon,icon_errorMessage:i.c.icon_errorMessage,button:{outlineColor:i.c.colors.outline}},d=function(e){var t=e.error;return t?a.a.createElement(f,{error:t}):a.a.createElement(a.a.Fragment,null)},f=function(e){var t,n,i=Object(r.useState)(!1),d=i[0],f=i[1],m="string"==typeof e.error?""+e.error:null,h=null!==(t=null!==(n=e.error.message)&&void 0!==n?n:m)&&void 0!==t?t:"Unknown Error",p=e.error.data&&s(e.error.data,!0)||void 0,g=e.error&&s(e.error,!0)||void 0,v=!!p||!!g;return a.a.createElement(o.h,{style:c.view},a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.g,{style:Object.assign({flex:1,flexDirection:"row",alignItems:"center"},c.button),onPress:function(){return f(!d)}},v&&(d?a.a.createElement(l.a,{style:c.icon,kind:u.a.expanded}):a.a.createElement(l.a,{style:c.icon,kind:u.a.collapsed})),a.a.createElement(o.h,{style:{paddingRight:8}},a.a.createElement(l.a,{style:c.icon,kind:u.a.error})),a.a.createElement(o.h,{style:{flex:1,overflow:"hidden"}},a.a.createElement(o.e,{style:c.text,numberOfLines:d?void 0:1},h))),a.a.createElement(o.g,{style:Object.assign({flexDirection:"row",alignItems:"center",paddingLeft:8},c.button),onPress:function(){return o.b.setString(s({errorMessage:h,errorDetails:p,errorObjText:g},!0))}},a.a.createElement(l.a,{style:c.icon,kind:u.a.copy})),e.error.retryCallback&&a.a.createElement(o.g,{style:Object.assign({flexDirection:"row",alignItems:"center",paddingLeft:8},c.button),onPress:e.error.retryCallback},a.a.createElement(l.a,{style:c.icon,kind:u.a.retry}))),v&&d&&!!p&&a.a.createElement(o.e,{style:Object.assign({},c.text)},p),v&&d&&!!g&&a.a.createElement(o.e,{style:Object.assign({},c.text)},g))},m=function(e){return a.a.createElement(o.h,{style:{flexDirection:"row",alignItems:"center"}},a.a.createElement(o.h,{style:{paddingLeft:8,paddingRight:8}},a.a.createElement(l.a,{style:c.icon_errorMessage,kind:u.a.error})),a.a.createElement(o.h,{style:{overflow:"hidden"}},a.a.createElement(o.e,{style:c.text_errorMessage,numberOfLines:1},e.children)))}},"Ig+6":function(e,t,n){"use strict";n.r(t),n.d(t,"styles",(function(){return p})),n.d(t,"DoodleTestView",(function(){return g})),n.d(t,"DoodleDrawerView",(function(){return v})),n.d(t,"DoodleDisplayView",(function(){return b})),n.d(t,"DoodleBrowser",(function(){return x})),n.d(t,"DoodleBrowseView",(function(){return w}));n("xrQq"),n("kNg/");var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("fGyu"),s=n("ERkP"),l=n.n(s),u=n("DTYs"),c=n("hsFx"),d=n("+tC1"),f=n("njmQ"),m=n("PyWT"),h=n("6Ufa"),p={drawing:{width:312,height:312,color:"#FFFFFF",backgroundColor:"#000000"}},g=function(e){var t=Object(s.useState)(Object(m.b)()),n=t[0],r=t[1];return l.a.createElement(l.a.Fragment,null,l.a.createElement(v,{style:p.drawing,drawing:n,onChange:r}),l.a.createElement(b,{style:p.drawing,drawing:n}))},v=function(e){var t=e.style,n=e.drawing,r=e.onChange,a=t.width/n.width,o=Object(s.useState)(null),u=o[0],c=o[1],d=Object(s.useRef)(null),f=Object(s.useRef)(null),h=function(e){return e.preventDefault(),e.stopPropagation(),e.nativeEvent.cancelBubble=!0,e.nativeEvent.returnValue=!1,!1},p=function(e,t){var n,r,o,i,s=f.current;if(!s)return h(e);var l=s.getBoundingClientRect(),u={clientX:null!==(n=null!==(r=null==t?void 0:t.clientX)&&void 0!==r?r:e.clientX)&&void 0!==n?n:0,clientY:null!==(o=null!==(i=null==t?void 0:t.clientY)&&void 0!==i?i:e.clientY)&&void 0!==o?o:0};return d.current={clientX:u.clientX,clientY:u.clientY,x:Math.floor((u.clientX-l.x)/a),y:Math.floor((u.clientY-l.y)/a)},c({points:[{x:d.current.x,y:d.current.y}]}),h(e)},g=function(e){var t=u;return t?(r(Object.assign({},n,{segments:[].concat(Object(i.a)(n.segments),[t])})),c(null),d.current=null,h(e)):h(e)},v=function(e,t){var n,r,o,s;if(!d.current)return h(e);var l=null!==(n=null!==(r=null==t?void 0:t.clientX)&&void 0!==r?r:e.clientX)&&void 0!==n?n:0,u=null!==(o=null!==(s=null==t?void 0:t.clientY)&&void 0!==s?s:e.clientY)&&void 0!==o?o:0;return function(e){c((function(t){if(!t)return null;var n=t.points[t.points.length-1];return Math.abs(n.x-e.x)+Math.abs(n.y-e.y)<=2?t:{points:[].concat(Object(i.a)(t.points),[e])}}))}({x:Math.floor((l-d.current.clientX)/a)+d.current.x,y:Math.floor((u-d.current.clientY)/a)+d.current.y}),h(e)};return Object(s.useEffect)((function(){var e=function(e){return!d.current||(e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0,e.returnValue=!1,!1)};return document.addEventListener("touchmove",e,{passive:!1}),function(){document.removeEventListener("touchmove",e)}}),[]),l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{style:{position:"relative",width:t.width,height:t.height,backgroundColor:t.backgroundColor}},l.a.createElement("svg",{style:{width:t.width,height:t.height},viewBox:"0 0 "+n.width+" "+n.height,preserveAspectRatio:"none",xmlns:"http://www.w3.org/2000/svg"},n.segments.map((function(e,n){return l.a.createElement("path",{key:n,d:Object(m.c)(e),stroke:t.color,fill:"transparent"})})),u&&l.a.createElement("path",{d:Object(m.c)(u),stroke:t.color,fill:"transparent"})),l.a.createElement("div",{ref:f,style:{position:"absolute",left:0,right:0,top:0,bottom:0,zIndex:10},onMouseDown:p,onMouseUp:g,onMouseMove:v,onMouseLeave:g,onTouchStart:function(e){return p(e,e.touches[0])},onTouchEnd:g,onTouchCancel:g,onTouchMove:function(e){return v(e,e.touches[0])},onTouchEndCapture:g})))},b=function(e){var t,n=Object(s.useState)(0),r=n[0],a=n[1];return e.enableRedraw?l.a.createElement(u.g,{onPress:function(){e.enableRedraw&&a((function(e){return e+1}))}},l.a.createElement(y,Object.assign({key:r},e,{shouldAnimate:r>0||(null===(t=e.shouldAnimate)||void 0===t||t)}))):l.a.createElement(y,e)},y=function(e){var t=e.style,n=e.drawing,r=e.shouldAnimate,a=void 0===r||r,o=e.animatePointsPerSecond,u=void 0===o?20:o,c=Object(s.useState)(0),d=c[0],f=c[1],h=n.segments.flatMap((function(e){return e.points})).length;Object(s.useEffect)((function(){if(!a)return function(){};var e=setInterval((function(){f((function(t){return t>h&&clearInterval(e),t+Math.ceil(u/10)}))}),10);return function(){clearInterval(e)}}),[n]);var p=a?d:Number.MAX_SAFE_INTEGER;return l.a.createElement("div",{style:{width:t.width,height:t.height,backgroundColor:t.backgroundColor}},l.a.createElement("svg",{style:{width:t.width,height:t.height},viewBox:"0 0 "+n.width+" "+n.height,preserveAspectRatio:"none",xmlns:"http://www.w3.org/2000/svg"},n.segments.map((function(e,n){var r=p;return p=Math.max(0,p-e.points.length),l.a.createElement("path",{key:n,d:Object(m.c)({points:Object(i.a)(e.points.slice(0,r))}),stroke:t.color,fill:"transparent"})}))))},x=function(){var e=Object(f.a)(),t=e.loading,n=(e.error,e.doWork),r=Object(s.useState)([]),i=r[0],c=r[1];return Object(s.useEffect)((function(){n(Object(o.a)(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.a)();case 2:return t=e.sent,e.next=5,t.getAllDrawings();case 5:n=e.sent,c(n.doodles);case 7:case"end":return e.stop()}}),e)}))))}),[]),t?l.a.createElement(u.a,{size:"large",color:"#FFFF00"}):l.a.createElement(w,{doodles:i})},w=function(e){var t=e.doodles,n=Object(d.b)(Object(c.c)(t,(function(e){return e.prompt})));return l.a.createElement(l.a.Fragment,null,n.map((function(e){return l.a.createElement(u.h,{key:e.key,style:{padding:4}},l.a.createElement(u.e,{style:{fontSize:12}},e.key),l.a.createElement(u.h,{style:{padding:4,flexDirection:"row",flexWrap:"wrap"}},e.value.map((function(e){return l.a.createElement(u.h,{key:e.key,style:{padding:4,alignItems:"center"}},l.a.createElement(b,{style:{width:104,height:104,color:"#FFFFFF",backgroundColor:"#000000"},drawing:e.drawing,shouldAnimate:!1,enableRedraw:!0}),l.a.createElement(u.e,null,""+e.score))}))))})))}},LOFj:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n("EsTT"),a=n("9DGK"),o=function(e){return{connect:function(t){var n=t.channelKey,o=Object(r.a)(),i=Object(r.a)(),s=function(){var t=new WebSocket(""+e.websocketsApiUrl);return t.addEventListener("open",(function(e){if(t===u){i.onStateChange({connectionStatus:"opened"});var r={message:null,key:n};t.send(JSON.stringify(r))}else t.close()})),t.addEventListener("close",(function(e){t===u?(i.onStateChange({connectionStatus:"closed"}),c()):t.close()})),t.addEventListener("error",(function(e){t===u?(i.onStateChange({connectionStatus:"error",error:{message:"Websocket Error",error:e}}),c()):t.close()})),t.addEventListener("message",(function(e){if(t===u){var r=JSON.parse(e.data);r.key===n&&r.message&&o.onStateChange(r.message)}else t.close()})),t},l=!1,u=s(),c=function(){l||setTimeout((function(){u=s()}),50)};return{send:function(e){if(!u||u.readyState!==WebSocket.OPEN)throw new a.b("Websocket is not open");var t={message:e,key:n};u.send(JSON.stringify(t))},isConnected:function(){var e;return(null===(e=u)||void 0===e?void 0:e.readyState)===WebSocket.OPEN},subscribeMessages:o.subscribe,subscribeConnectionEvents:i.subscribe,close:function(){var e;l=!0,null===(e=u)||void 0===e||e.close(),u=null}}}}}},Nm1O:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=function(e,t){void 0===t&&(t=0);for(var n,r=3735928559^t,a=1103547991^t,o=0;o<e.length;o++)n=e.charCodeAt(o),r=Math.imul(r^n,2654435761),a=Math.imul(a^n,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(a^a>>>13,3266489909),4294967296*(2097151&(a=Math.imul(a^a>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)},a=function(e){var t=e.map((function(e){return e.content+":"+e.path+":"+e.language+"::"})).join("");return""+r(t)}},NunO:function(e,t,n){!function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(l){a=!0,o=l}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(){}function s(){}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,s.resetWarningCache=i;var l=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(){function e(e,t,n,r,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:i};return n.PropTypes=n,n}()})),u=function(e){return null!==e&&"object"===n(e)},c=function e(t,n){if(!u(t)||!u(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var a="[object Object]"===Object.prototype.toString.call(t);if(a!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!a&&!r)return!1;var o=Object.keys(t),i=Object.keys(n);if(o.length!==i.length)return!1;for(var s={},l=0;l<o.length;l+=1)s[o[l]]=!0;for(var c=0;c<i.length;c+=1)s[i[c]]=!0;var d=Object.keys(s);if(d.length!==o.length)return!1;var f=t,m=n;return d.every((function(t){return e(f[t],m[t])}))},d=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},f=function(e){if(null===e||u(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},m=function(e){if(function(e){return u(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(f)};var t=f(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},h=t.createContext(null);h.displayName="ElementsContext";var p=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(h),e)},g=function(e){return(0,e.children)(p("mounts <ElementsConsumer>"))};g.propTypes={children:l.func.isRequired};var v=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},b=function(e){return u(e)?(e.paymentRequest,r(e,["paymentRequest"])):{}},y=function(){},x=function(e,n){var r,a="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),o=n?function(e){p("mounts <".concat(a,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,o=n.className,i=n.options,s=void 0===i?{}:i,l=n.onBlur,u=void 0===l?y:l,d=n.onFocus,f=void 0===d?y:d,m=n.onReady,h=void 0===m?y:m,g=n.onChange,x=void 0===g?y:g,w=n.onEscape,E=void 0===w?y:w,_=n.onClick,S=void 0===_?y:_,O=p("mounts <".concat(a,">")).elements,C=t.useRef(null),T=t.useRef(null),k=v(h),j=v(u),F=v(f),A=v(S),D=v(x),P=v(E);t.useLayoutEffect((function(){if(null==C.current&&O&&null!=T.current){var t=O.create(e,s);C.current=t,t.mount(T.current),t.on("ready",(function(){return k(t)})),t.on("change",D),t.on("blur",j),t.on("focus",F),t.on("escape",P),t.on("click",A)}}));var R=t.useRef(s);return t.useEffect((function(){R.current&&R.current.paymentRequest!==s.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=b(s);0===Object.keys(e).length||c(e,b(R.current))||C.current&&(C.current.update(e),R.current=s)}),[s]),t.useEffect((function(){var e=C.current;return function(){e&&e.destroy()}}),[]),t.createElement("div",{id:r,className:o,ref:T})};return o.propTypes={id:l.string,className:l.string,onChange:l.func,onBlur:l.func,onFocus:l.func,onReady:l.func,onClick:l.func,options:l.object},o.displayName=a,o.__elementType=e,o},w="undefined"==typeof window,E=x("auBankAccount",w),_=x("card",w),S=x("cardNumber",w),O=x("cardExpiry",w),C=x("cardCvc",w),T=x("fpxBank",w),k=x("iban",w),j=x("idealBank",w),F=x("paymentRequestButton",w);e.AuBankAccountElement=E,e.CardCvcElement=C,e.CardElement=_,e.CardExpiryElement=O,e.CardNumberElement=S,e.Elements=function(e){var n=e.stripe,r=e.options,o=e.children,i=t.useRef(!1),s=t.useRef(!0),l=t.useMemo((function(){return m(n)}),[n]),u=a(t.useState((function(){return{stripe:null,elements:null}})),2),f=u[0],p=u[1],g=d(n),v=d(r);return null!==g&&(g!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),c(r,v)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),i.current||("sync"===l.tag&&(i.current=!0,p({stripe:l.stripe,elements:l.stripe.elements(r)})),"async"===l.tag&&(i.current=!0,l.stripePromise.then((function(e){e&&s.current&&p({stripe:e,elements:e.elements(r)})})))),t.useEffect((function(){return function(){s.current=!1}}),[]),t.useEffect((function(){var e=f.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.0"})}),[f.stripe]),t.createElement(h.Provider,{value:f},o)},e.ElementsConsumer=g,e.FpxBankElement=T,e.IbanElement=k,e.IdealBankElement=j,e.PaymentRequestButtonElement=F,e.useElements=function(){return p("calls useElements()").elements},e.useStripe=function(){return p("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n("ERkP"))},O6JU:function(e,t,n){"use strict";function r(e){return o(e).corrected}function a(e){return"+1"+o(e).digitsNo1}function o(e){for(var t,n=null!==(t=null==e?void 0:e.replace(/^(\+1|1)/,"").replace(/\D/g,"").split(""))&&void 0!==t?t:[],r="(###) ###-####".split(""),a=0,o=-1,i=0;i<r.length;i++)"#"===r[i]&&a<n.length&&(r[i]=n[a],a++,o=i);var s=r.join("");return{corrected:r.slice(0,o+1).join(""),full:s,digitsNo1:n.join("")}}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return a}))},P5Mp:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return i}));var r=n("Nm1O"),a=function(){var e={path:"test.tsx",content:"\nimport React from 'react';\n\nexport const MinimalReactComponent = (props: {}) => {\n    return (\n        <span>Hello World!</span>\n    );\n};\n        ".trim(),language:"tsx"},t={path:"test0.tsx",content:"\nimport React from 'react';\n\nexport const MinimalReactComponent0 = (props: {}) => {\n    return (\n        <span>Hello World 0!</span>\n    );\n};\n        ".trim(),language:"tsx"},n={path:"test2.tsx",content:"\nimport React from 'react';\n\nexport const MinimalReactComponent2 = (props: {}) => {\n    return (\n        <span>Hello World 2!</span>\n    );\n};\n        ".trim(),language:"tsx"},a=e.content.indexOf("<span>Hello World!</span>"),o="<span>Hello World!</span>".length,i=[t,e,n];return{key:"Lesson-"+Date.now()+"-"+(""+Math.random()).substr(2),projectState:{files:i,filesHashCode:Object(r.a)(i)},focus:{filePath:e.path,index:a,length:o},title:"Test Lesson",objective:"Test the Editor",explanation:"Learn some stuff",task:"Make a test variable true",descriptions:[],experiments:[]}},o=function(e){var t=JSON.parse(JSON.stringify(e));return Object.assign({},t,{key:"Lesson-"+Date.now()+"-"+(""+Math.random()).substr(2)})},i=function(){return{key:"Module-"+Date.now()+"-"+(""+Math.random()).substr(2),title:"Module",lessons:[a()]}}},PJlR:function(e,t,n){"use strict";n.r(t),n.d(t,"LessonModuleEditor",(function(){return w}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("pVhY"),s=n("P5Mp"),l=n("zurd"),u=n("vOCV"),c=n("TFfC"),d=n("69rG"),f=n("Nm1O"),m={container:{background:"#111111"},containerPanel:{background:"#292a2d"},editorModeTabRowView:{flexDirection:"row",paddingLeft:16},editorModeTabView:{background:"#1e1e1e",alignSelf:"flex-start",padding:8,marginRight:1},editorModeTabView_selected:{background:"#292a2d",alignSelf:"flex-start",padding:8,marginRight:1},editorModeTabText:{fontSize:14,color:"#FFFFFFF"},editorModeTabText_selected:{fontSize:14,color:"#FFFF88"},buttonView:{background:"#1e1e1e",alignSelf:"flex-start",padding:8,margin:1},buttonText:{fontSize:14,color:"#FFFFFFF"},sectionHeaderText:{margin:8,fontSize:18,color:"#FFFF88"},infoView:{},infoText:{margin:8,fontSize:12,wrap:"wrap"},lessonFieldView:{flexDirection:"row"},lessonFieldLabelText:{minWidth:80,padding:4,fontSize:12},lessonFieldText:{flex:1,padding:4,fontSize:12,wrap:"wrap"},jsonText:{padding:4,fontSize:12,color:"#FFFFFF",background:"#000000"}},h=function(e,t){var n={constructCode:{lessonData:e},understandCode:{lessonData:e}};return{lesson:e,lessonJson:null!=t?t:JSON.stringify(e,null,2),lessonSteps:n}},p=function(e){var t=Object(r.useState)(h(e.value)),n=t[0],i=t[1],s=Object(r.useState)("edit"),u=s[0],f=s[1],p="edit"===u?"edit":"display",y="edit"===u?"edit":"construct-code"===u?"construct-code":"display",x="edit"===u?"edit":"display",w=function(t){i(t),e.onChange(t.lesson)},E=function(e){w(h(Object.assign({},n.lesson,e)))},_=n.lesson,S=_.projectState,O=_.focus;return a.a.createElement(a.a.Fragment,null,a.a.createElement(o.h,{style:m.container},a.a.createElement(o.h,{style:m.editorModeTabRowView},[{value:"edit",label:"Edit"},{value:"json",label:"Json"},{value:"construct-code",label:"Construct Code"},{value:"understand-code",label:"Understand Code"},{value:"experiment-code",label:"Experiment Code"},{value:"preview",label:"Preview"}].map((function(e){return a.a.createElement(o.g,{key:e.value+u,onPress:function(){return f(e.value)}},a.a.createElement(o.h,{style:e.value===u?m.editorModeTabView_selected:m.editorModeTabView},a.a.createElement(o.e,{style:e.value===u?m.editorModeTabText_selected:m.editorModeTabText},e.label)))}))),a.a.createElement(o.h,{style:m.containerPanel},"json"===u&&a.a.createElement(a.a.Fragment,null,a.a.createElement(o.e,{style:m.sectionHeaderText},"Lesson Data"),a.a.createElement(o.h,null,a.a.createElement(o.f,{style:m.jsonText,value:n.lessonJson,onChange:function(e){w(h(JSON.parse(e),e))},autoCompleteType:"off",keyboardType:"default",multiline:!0,numberOfLines:20}))),"edit"===u&&a.a.createElement(a.a.Fragment,null,a.a.createElement(o.e,{style:m.sectionHeaderText},"Project Files"),a.a.createElement(l.a,{projectData:{projectState:S,focus:O},fileEditorMode_focus:y,fileEditorMode_noFocus:x,projectEditorMode:p,onProjectDataChange:function(e){w(h(Object.assign({},n.lesson,e)))},lessonData:n.lesson}),a.a.createElement(o.e,{style:m.sectionHeaderText},"Lesson"),a.a.createElement(o.h,{style:m.infoView},a.a.createElement(g,{label:"Title",value:n.lesson.title,onChange:function(e){return E({title:e})}}),a.a.createElement(g,{label:"Objective",value:n.lesson.objective,onChange:function(e){return E({objective:e})}}),a.a.createElement(g,{label:"Explanation",value:n.lesson.explanation,onChange:function(e){return E({explanation:e})}}),a.a.createElement(g,{label:"Task",value:n.lesson.task,onChange:function(e){return E({task:e})}}),a.a.createElement(v,{label:"Descriptions",value:n.lesson.descriptions,onChange:function(e){return E({descriptions:e})}}),a.a.createElement(b,{label:"Experiments",value:n.lesson.experiments,onChange:function(e){return E({experiments:e})},lessonData:n.lesson}))),"construct-code"===u&&a.a.createElement(c.a,{data:n.lesson}),"understand-code"===u&&a.a.createElement(c.d,{data:n.lesson}),"experiment-code"===u&&a.a.createElement(c.b,{data:n.lesson,setProjectState:e.setProjectState}),"preview"===u&&a.a.createElement(d.a,{projectState:n.lesson.projectState,setProjectState:e.setProjectState}))))},g=function(e){var t=e.label,n=e.value,r=e.onChange;return a.a.createElement(o.h,{style:m.lessonFieldView},a.a.createElement(o.e,{style:m.lessonFieldLabelText},t),a.a.createElement(o.f,{style:m.lessonFieldText,value:n,onChange:r,autoCompleteType:"off",keyboardType:"default"}))},v=function(e){var t=e.label,n=e.value,r=e.onChange;return a.a.createElement(o.h,{style:m.lessonFieldView},a.a.createElement(o.e,{style:m.lessonFieldLabelText},t),a.a.createElement(o.f,{style:m.lessonFieldText,value:n.join("\n"),onChange:function(e){return r(e.replace(/\r\n/,"\n").split("\n"))},autoCompleteType:"off",keyboardType:"default",multiline:!0,numberOfLines:5}))},b=function(e){var t=e.label,n=e.value,r=e.onChange,i=e.lessonData;return a.a.createElement(o.h,{style:{}},a.a.createElement(o.e,{style:m.lessonFieldLabelText},t),n.map((function(e,t){return a.a.createElement(y,{key:""+t,label:"Experiment "+t,value:e,onChange:function(e){return r(n.map((function(n,r){return t===r?e:n})))},onDelete:function(){n.splice(t,1),r(n)},lessonData:i})})),a.a.createElement(o.g,{onPress:function(){n.push({replacements:[],comment:"",filesHashCode:Object(f.a)([])}),r(n)}},a.a.createElement(o.h,{style:m.buttonView},a.a.createElement(o.e,{style:m.buttonText},"➕ Add Experiment"))))},y=function(e){var t,n=e.label,i=e.value,s=e.onChange,c=e.onDelete,d=e.lessonData,h=Object(r.useState)(d.projectState),p=h[0],g=h[1],v=Object(r.useState)({filePath:p.files[0].path,index:0,length:p.files[0].content.length}),b=v[0],y=v[1],x=Object(r.useState)(null!==(t=i.comment)&&void 0!==t?t:""),w=x[0],E=x[1];Object(r.useEffect)((function(){g((function(e){return Object(u.b)(d.projectState,i.replacements)}))}),[d.projectState]);return a.a.createElement(o.h,{style:{}},a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.e,{style:m.lessonFieldLabelText},n),a.a.createElement(o.h,{style:{flex:1}}),a.a.createElement(o.g,{onPress:c},a.a.createElement(o.h,{style:m.buttonView},a.a.createElement(o.e,{style:m.buttonText},"❌ Delete Experiment")))),a.a.createElement(o.h,{style:m.lessonFieldView},a.a.createElement(o.e,{style:m.lessonFieldLabelText},"Comment"),a.a.createElement(o.f,{style:m.lessonFieldText,value:w,onChange:E,onBlur:function(){return s(Object.assign({},i,{comment:w}))},autoCompleteType:"off",keyboardType:"default"})),a.a.createElement(l.a,{key:p.filesHashCode,projectData:{projectState:p,focus:b},fileEditorMode_focus:"edit",fileEditorMode_noFocus:"edit",projectEditorMode:"display",onProjectDataChange:function(e){e.focus&&y(e.focus),e.projectState&&(g(e.projectState),s(Object.assign({},Object(u.a)(d.projectState,e.projectState),{comment:w,filesHashCode:Object(f.a)(d.projectState.files)})))},lessonData:d}),i.replacements.map((function(e){var t;return a.a.createElement(o.h,{key:e.selection.filePath+e.selection.index},a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.e,{style:{minWidth:80}},"File"),a.a.createElement(o.e,{style:{marginLeft:4,background:"#111111"}},""+e.selection.filePath)),a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.e,{style:{minWidth:80}},"Match"),a.a.createElement(o.e,{style:{marginLeft:4,background:"#111111",color:"#FF8888",textDecoration:"line-through"}},""+(null===(t=d.projectState.files.find((function(t){return t.path===e.selection.filePath})))||void 0===t?void 0:t.content.substr(e.selection.index,e.selection.length)))),a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.e,{style:{minWidth:80}},"Replace"),a.a.createElement(o.e,{style:{marginLeft:4,background:"#111111",color:"#8888FF"}},""+e.content)))})))},x={container:{background:"#111111"},containerPanel:{background:"#292a2d"},sectionHeaderText:{margin:8,fontSize:18,color:"#FFFF88"},jsonText:{padding:4,fontSize:12,color:"#FFFFFF",background:"#000000"}},w=function(e){var t,n=Object(r.useState)(null!==(t=e.value)&&void 0!==t?t:Object(s.c)()),l=n[0],u=n[1],c=Object(r.useState)(l.lessons[0]),d=c[0],f=c[1],m=Object(r.useState)("lesson"),h=m[0],g=m[1];return a.a.createElement(a.a.Fragment,null,a.a.createElement(o.h,{style:x.container},a.a.createElement(i.a,{header:"Module",items:["lesson","json"],getKey:function(e){return e},getLabel:function(e){return e},selected:h,onSelect:g}),a.a.createElement(o.f,{style:x.jsonText,value:l.title,onChange:function(t){u((function(n){var r=Object.assign({},n,{title:t});return setTimeout((function(){var t;null===(t=e.onChange)||void 0===t||t.call(e,r)})),r}))},autoCompleteType:"off",keyboardType:"default"}),"lesson"===h&&a.a.createElement(a.a.Fragment,null,a.a.createElement(i.b,{style:{selectedTabText:{color:"#88FF88"}},header:"Lessons",items:l.lessons,onChange:function(e){return u((function(t){return Object.assign({},t,{lessons:e})}))},getKey:function(e){return e.key},getLabel:function(e){return e.title},selected:d,onSelect:function(e){return f(e)},onCreateNewItem:function(){var e;return null!==(e=Object(s.a)(d))&&void 0!==e?e:Object(s.b)()}}),d&&a.a.createElement(a.a.Fragment,null,a.a.createElement(p,{key:d.key,value:d,onChange:function(t){u((function(n){var r=Object.assign({},n,{lessons:n.lessons.map((function(e){return e===d?t:e}))});return setTimeout((function(){var t;null===(t=e.onChange)||void 0===t||t.call(e,r)})),r})),f(t)},setProjectState:e.setProjectState}))),"json"===h&&a.a.createElement(a.a.Fragment,null,a.a.createElement(o.e,{style:x.sectionHeaderText},"Module Data"),a.a.createElement(o.h,null,a.a.createElement(o.f,{style:x.jsonText,value:JSON.stringify(l,null,2),onChange:function(e){return u(JSON.parse(e))},autoCompleteType:"off",keyboardType:"default",multiline:!0,numberOfLines:20})))))}},PQcI:function(e,t,n){"use strict";n.d(t,"a",(function(){return C}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("ERkP"),s=n.n(i),l=n("NunO"),u="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",f=null,m=function(e){return null!==f?f:f=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(u,'"]')),t=0;t<e.length;t++){var n=e[t];if(c.test(n.src))return n}return null}();r&&e?console.warn(d):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(u).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n}(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(a){return void n(a)}else t(null)}))},h=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:t})}(r,n),r},p=Promise.resolve().then((function(){return m(null)})),g=!1;p.catch((function(e){g||console.warn(e)}));var v,b=n("BFfR"),y=n("+lMt"),x=function(e){function t(t,n){var r;return(r=e.call(this)||this).message=t,r.data=n,r}return Object(b.a)(t,e),t}(Object(y.a)(Error)),w=n("QZUc");!function(e){e[e._01_Client_BeginCreateSavedPaymentMethod=100]="_01_Client_BeginCreateSavedPaymentMethod",e[e._02_Server_SetupSavedPaymentMethod=200]="_02_Server_SetupSavedPaymentMethod",e[e._03_Client_CollectPaymentDetails=300]="_03_Client_CollectPaymentDetails",e[e._04_Server_ObtainPaymentMethod=400]="_04_Server_ObtainPaymentMethod",e[e._05_Server_SavePaymentMethod=500]="_05_Server_SavePaymentMethod"}(v||(v={}));var E,_;(_=E||(E={}))[_._02A_Server_GetOrCreateCustomer=v._02_Server_SetupSavedPaymentMethod+1]="_02A_Server_GetOrCreateCustomer",_[_._02B_Server_CreateSetupIntent=v._02_Server_SetupSavedPaymentMethod+2]="_02B_Server_CreateSetupIntent",_[_._03A_Client_CollectPaymentDetails=v._03_Client_CollectPaymentDetails+1]="_03A_Client_CollectPaymentDetails",_[_._04A_Server_ObtainPaymentMethod=v._04_Server_ObtainPaymentMethod+1]="_04A_Server_ObtainPaymentMethod",_[_._04B_Server_ObtainPaymentMethodDetails=v._04_Server_ObtainPaymentMethod+2]="_04B_Server_ObtainPaymentMethodDetails";var S=function(e,t,n){console.log("CreateSavedPaymentMethod_Stripe: "+E[e]+" "+t,n)},O=function(){var e=Object(o.a)(a.a.mark((function e(t,n){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,S(t,"BEGIN"),e.next=4,n();case 4:return r=e.sent,S(t,"END"),e.abrupt("return",r);case 9:throw e.prev=9,e.t0=e.catch(0),S(t,"FAIL",{error:e.t0}),e.t0;case 13:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t,n){return e.apply(this,arguments)}}(),C=function(e){var t=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];g=!0;var r=Date.now();return p.then((function(e){return h(e,t,r)}))}(e.stripePublicKey);return{AppWrapperComponent:function(e){var n=e.children;return s.a.createElement(l.Elements,{stripe:t},n)},PaymentMethodEntryComponent:function(e){var t,n=e.style,r=e.paymentMethodSetupToken,u=e.onPaymentMethodReady,c=Object(l.useStripe)(),d=Object(l.useElements)(),f=Object(i.useState)(null),m=f[0],h=f[1],p=function(){var e=Object(o.a)(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.preventDefault(),c&&d){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,e.next=6,O(E._03A_Client_CollectPaymentDetails,Object(o.a)(a.a.mark((function e(){var t,n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(w.a)(r),e.next=3,c.confirmCardSetup(t.clientSecret,{payment_method:{card:d.getElement(l.CardElement),billing_details:t.customerBillingDetails}});case 3:if(!(n=e.sent).error&&n.setupIntent){e.next=6;break}throw new x("Stripe Payment Error",n.error);case 6:return e.abrupt("return",n.setupIntent);case 7:case"end":return e.stop()}}),e)}))));case 6:if(n=e.sent){e.next=9;break}return e.abrupt("return");case 9:u(Object(w.c)({setupIntent:n})),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),h({message:"Stripe Payment Error",error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[3,12]])})));return function(t){return e.apply(this,arguments)}}(),g=n,v={base:{color:g.textColor,fontSize:g.fontSize?g.fontSize+"px":"",fontFamily:g.fontFamily,fontSmoothing:"antialiased","::placeholder":{color:g.textColor,opacity:.8}},invalid:{color:g.textColor_invalid,iconColor:g.textColor_invalid}},b={marginBottom:g.elementPadding,padding:g.textPadding,backgroundColor:g.backgroundColor,borderWidth:1,borderStyle:"solid",borderColor:g.borderColor,borderRadius:g.borderRadius},y={color:g.textColor,backgroundColor:g.backgroundColor,borderWidth:1,borderStyle:"solid",borderColor:g.borderColor,borderRadius:g.borderRadius,fontSize:g.fontSize?g.fontSize+"px":"",fontFamily:g.fontFamily,fontSmoothing:"antialiased",fontWeight:"bold",padding:g.textPadding,marginBottom:g.elementPadding},_="left"===g.buttonAlignment?"flex-start":"right"===g.buttonAlignment?"flex-end":"center",S={marginBottom:g.elementPadding,padding:g.textPadding,backgroundColor:g.backgroundColor,borderWidth:1,borderStyle:"solid",borderColor:g.borderColor,borderRadius:g.borderRadius},C={color:g.textColor_invalid,fontSize:g.fontSize?g.fontSize+"px":"",fontFamily:g.fontFamily,fontSmoothing:"antialiased",fontWeight:"bold",padding:g.textPadding,marginBottom:g.elementPadding};return s.a.createElement("form",{onSubmit:p},s.a.createElement("div",{style:b},s.a.createElement(l.CardElement,{options:{style:v}})),m&&s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{style:S},s.a.createElement("span",{style:C},m.message))),!m&&s.a.createElement("div",{style:{display:"flex",flexDirection:"row",justifyContent:_}},s.a.createElement("button",{type:"submit",disabled:!c||!d,style:y},null!==(t=g.buttonText)&&void 0!==t?t:"Subscribe")))}}}},PyWT:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"d",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n("fGyu"),a=function(){return{width:104,height:104,segments:[]}},o=function(e){if(e.length<=0)return"";var t=e[0],n="";return e.slice(1).forEach((function(e){n+=e.x-t.x+","+(e.y-t.y)+";",t=e})),n},i=function(e,t,n){if(!n)return[{x:e,y:t}];var a={x:e,y:t},o=n.split(";").filter((function(e){return e})).map((function(e){var t=e.split(","),n={x:a.x+Number.parseInt(t[0],10),y:a.y+Number.parseInt(t[1],10)};return a=n,n}));return Object(r.a)(o)},s=function(e){var t={w:e.width,h:e.height,s:e.segments.map((function(e){return{x:e.points[0].x,y:e.points[0].y,p:o(e.points)}}))};return{doodleText:JSON.stringify(t)}},l=function(e){var t=JSON.parse(e.doodleText);return{width:t.w,height:t.h,segments:t.s.map((function(e){return{points:[{x:e.x,y:e.y}].concat(Object(r.a)(i(e.x,e.y,e.p)))}}))}},u=function(e){if(e.points.length<=0)return"";if(1===e.points.length)return"M"+e.points[0].x+" "+e.points[0].y+" L"+e.points[0].x+" "+e.points[0].y;var t=e.points[0];return"M"+e.points[0].x+" "+e.points[0].y+" l"+e.points.slice(1).map((function(e){var n=e.x-t.x+" "+(e.y-t.y);return t=e,n})).join(" ")}},Q6Uf:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("bs47");function a(e){return{getLength:function(){return e.length},getElementAtIndex:function(t){return e.charCodeAt(t)}}}t.stringDiff=function(e,t,n){return new l(a(e),a(t)).ComputeDiff(n)};var o=function(){function e(){}return e.Assert=function(e,t){if(!e)throw new Error(t)},e}();t.Debug=o;var i=function(){function e(){}return e.Copy=function(e,t,n,r,a){for(var o=0;o<a;o++)n[r+o]=e[t+o]},e}();t.MyArray=i;var s=function(){function e(){this.m_changes=[],this.m_originalStart=Number.MAX_VALUE,this.m_modifiedStart=Number.MAX_VALUE,this.m_originalCount=0,this.m_modifiedCount=0}return e.prototype.MarkNextChange=function(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new r.DiffChange(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=Number.MAX_VALUE,this.m_modifiedStart=Number.MAX_VALUE},e.prototype.AddOriginalElement=function(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++},e.prototype.AddModifiedElement=function(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++},e.prototype.getChanges=function(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes},e.prototype.getReverseChanges=function(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes},e}(),l=function(){function e(e,t,n){void 0===n&&(n=null),this.OriginalSequence=e,this.ModifiedSequence=t,this.ContinueProcessingPredicate=n,this.m_forwardHistory=[],this.m_reverseHistory=[]}return e.prototype.ElementsAreEqual=function(e,t){return this.OriginalSequence.getElementAtIndex(e)===this.ModifiedSequence.getElementAtIndex(t)},e.prototype.OriginalElementsAreEqual=function(e,t){return this.OriginalSequence.getElementAtIndex(e)===this.OriginalSequence.getElementAtIndex(t)},e.prototype.ModifiedElementsAreEqual=function(e,t){return this.ModifiedSequence.getElementAtIndex(e)===this.ModifiedSequence.getElementAtIndex(t)},e.prototype.ComputeDiff=function(e){return this._ComputeDiff(0,this.OriginalSequence.getLength()-1,0,this.ModifiedSequence.getLength()-1,e)},e.prototype._ComputeDiff=function(e,t,n,r,a){var o=this.ComputeDiffRecursive(e,t,n,r,[!1]);return a?this.PrettifyChanges(o):o},e.prototype.ComputeDiffRecursive=function(e,t,n,a,i){for(i[0]=!1;e<=t&&n<=a&&this.ElementsAreEqual(e,n);)e++,n++;for(;t>=e&&a>=n&&this.ElementsAreEqual(t,a);)t--,a--;if(e>t||n>a){var s=void 0;return n<=a?(o.Assert(e===t+1,"originalStart should only be one more than originalEnd"),s=[new r.DiffChange(e,0,n,a-n+1)]):e<=t?(o.Assert(n===a+1,"modifiedStart should only be one more than modifiedEnd"),s=[new r.DiffChange(e,t-e+1,n,0)]):(o.Assert(e===t+1,"originalStart should only be one more than originalEnd"),o.Assert(n===a+1,"modifiedStart should only be one more than modifiedEnd"),s=[]),s}var l=[0],u=[0],c=this.ComputeRecursionPoint(e,t,n,a,l,u,i),d=l[0],f=u[0];if(null!==c)return c;if(!i[0]){var m=this.ComputeDiffRecursive(e,d,n,f,i),h=[];return h=i[0]?[new r.DiffChange(d+1,t-(d+1)+1,f+1,a-(f+1)+1)]:this.ComputeDiffRecursive(d+1,t,f+1,a,i),this.ConcatenateChanges(m,h)}return[new r.DiffChange(e,t-e+1,n,a-n+1)]},e.prototype.WALKTRACE=function(e,t,n,a,o,i,l,u,c,d,f,m,h,p,g,v,b,y){var x,w,E=null,_=new s,S=t,O=n,C=h[0]-v[0]-a,T=Number.MIN_VALUE,k=this.m_forwardHistory.length-1;do{(w=C+e)===S||w<O&&c[w-1]<c[w+1]?(p=(f=c[w+1])-C-a,f<T&&_.MarkNextChange(),T=f,_.AddModifiedElement(f+1,p),C=w+1-e):(p=(f=c[w-1]+1)-C-a,f<T&&_.MarkNextChange(),T=f-1,_.AddOriginalElement(f,p+1),C=w-1-e),k>=0&&(e=(c=this.m_forwardHistory[k])[0],S=1,O=c.length-1)}while(--k>=-1);if(x=_.getReverseChanges(),y[0]){var j=h[0]+1,F=v[0]+1;if(null!==x&&x.length>0){var A=x[x.length-1];j=Math.max(j,A.getOriginalEnd()),F=Math.max(F,A.getModifiedEnd())}E=[new r.DiffChange(j,m-j+1,F,g-F+1)]}else{_=new s,S=i,O=l,C=h[0]-v[0]-u,T=Number.MAX_VALUE,k=b?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{(w=C+o)===S||w<O&&d[w-1]>=d[w+1]?(p=(f=d[w+1]-1)-C-u,f>T&&_.MarkNextChange(),T=f+1,_.AddOriginalElement(f+1,p+1),C=w+1-o):(p=(f=d[w-1])-C-u,f>T&&_.MarkNextChange(),T=f,_.AddModifiedElement(f+1,p+1),C=w-1-o),k>=0&&(o=(d=this.m_reverseHistory[k])[0],S=1,O=d.length-1)}while(--k>=-1);E=_.getChanges()}return this.ConcatenateChanges(x,E)},e.prototype.ComputeRecursionPoint=function(e,t,n,a,o,s,l){var u,c=0,d=0,f=0,m=0,h=0,p=0;e--,n--,o[0]=0,s[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];var g,v,b=t-e+(a-n),y=b+1,x=new Array(y),w=new Array(y),E=a-n,_=t-e,S=e-n,O=t-a,C=(_-E)%2==0;for(x[E]=e,w[_]=t,l[0]=!1,u=1;u<=b/2+1;u++){var T=0,k=0;for(f=this.ClipDiagonalBound(E-u,u,E,y),m=this.ClipDiagonalBound(E+u,u,E,y),g=f;g<=m;g+=2){for(d=(c=g===f||g<m&&x[g-1]<x[g+1]?x[g+1]:x[g-1]+1)-(g-E)-S,v=c;c<t&&d<a&&this.ElementsAreEqual(c+1,d+1);)c++,d++;if(x[g]=c,c+d>T+k&&(T=c,k=d),!C&&Math.abs(g-_)<=u-1&&c>=w[g])return o[0]=c,s[0]=d,v<=w[g]&&u<=1448?this.WALKTRACE(E,f,m,S,_,h,p,O,x,w,c,t,o,d,a,s,C,l):null}var j=(T-e+(k-n)-u)/2;if(null!==this.ContinueProcessingPredicate&&!this.ContinueProcessingPredicate(T,this.OriginalSequence,j))return l[0]=!0,o[0]=T,s[0]=k,j>0&&u<=1448?this.WALKTRACE(E,f,m,S,_,h,p,O,x,w,c,t,o,d,a,s,C,l):(e++,n++,[new r.DiffChange(e,t-e+1,n,a-n+1)]);for(h=this.ClipDiagonalBound(_-u,u,_,y),p=this.ClipDiagonalBound(_+u,u,_,y),g=h;g<=p;g+=2){for(d=(c=g===h||g<p&&w[g-1]>=w[g+1]?w[g+1]-1:w[g-1])-(g-_)-O,v=c;c>e&&d>n&&this.ElementsAreEqual(c,d);)c--,d--;if(w[g]=c,C&&Math.abs(g-E)<=u&&c<=x[g])return o[0]=c,s[0]=d,v>=x[g]&&u<=1448?this.WALKTRACE(E,f,m,S,_,h,p,O,x,w,c,t,o,d,a,s,C,l):null}if(u<=1447){var F=new Array(m-f+2);F[0]=E-f+1,i.Copy(x,f,F,1,m-f+1),this.m_forwardHistory.push(F),(F=new Array(p-h+2))[0]=_-h+1,i.Copy(w,h,F,1,p-h+1),this.m_reverseHistory.push(F)}}return this.WALKTRACE(E,f,m,S,_,h,p,O,x,w,c,t,o,d,a,s,C,l)},e.prototype.PrettifyChanges=function(e){for(var t=0;t<e.length;t++){for(var n=e[t],r=t<e.length-1?e[t+1].originalStart:this.OriginalSequence.getLength(),a=t<e.length-1?e[t+1].modifiedStart:this.ModifiedSequence.getLength(),o=n.originalLength>0,i=n.modifiedLength>0;n.originalStart+n.originalLength<r&&n.modifiedStart+n.modifiedLength<a&&(!o||this.OriginalElementsAreEqual(n.originalStart,n.originalStart+n.originalLength))&&(!i||this.ModifiedElementsAreEqual(n.modifiedStart,n.modifiedStart+n.modifiedLength));)n.originalStart++,n.modifiedStart++;var s=[null];t<e.length-1&&this.ChangesOverlap(e[t],e[t+1],s)&&(e[t]=s[0],e.splice(t+1,1),t--)}for(t=e.length-1;t>=0;t--){n=e[t],r=0,a=0;if(t>0){var l=e[t-1];l.originalLength>0&&(r=l.originalStart+l.originalLength),l.modifiedLength>0&&(a=l.modifiedStart+l.modifiedLength)}o=n.originalLength>0,i=n.modifiedLength>0;for(var u=0,c=this._boundaryScore(n.originalStart,n.originalLength,n.modifiedStart,n.modifiedLength),d=1;;d++){var f=n.originalStart-d,m=n.modifiedStart-d;if(f<r||m<a)break;if(o&&!this.OriginalElementsAreEqual(f,f+n.originalLength))break;if(i&&!this.ModifiedElementsAreEqual(m,m+n.modifiedLength))break;var h=this._boundaryScore(f,n.originalLength,m,n.modifiedLength);h>c&&(c=h,u=d)}n.originalStart-=u,n.modifiedStart-=u}return e},e.prototype._OriginalIsBoundary=function(e){if(e<=0||e>=this.OriginalSequence.getLength()-1)return!0;var t=this.OriginalSequence.getElementAtIndex(e);return"string"==typeof t&&/^\s*$/.test(t)},e.prototype._OriginalRegionIsBoundary=function(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){var n=e+t;if(this._OriginalIsBoundary(n-1)||this._OriginalIsBoundary(n))return!0}return!1},e.prototype._ModifiedIsBoundary=function(e){if(e<=0||e>=this.ModifiedSequence.getLength()-1)return!0;var t=this.ModifiedSequence.getElementAtIndex(e);return"string"==typeof t&&/^\s*$/.test(t)},e.prototype._ModifiedRegionIsBoundary=function(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){var n=e+t;if(this._ModifiedIsBoundary(n-1)||this._ModifiedIsBoundary(n))return!0}return!1},e.prototype._boundaryScore=function(e,t,n,r){return(this._OriginalRegionIsBoundary(e,t)?1:0)+(this._ModifiedRegionIsBoundary(n,r)?1:0)},e.prototype.ConcatenateChanges=function(e,t){var n=[];if(0===e.length||0===t.length)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],n)){var r=new Array(e.length+t.length-1);return i.Copy(e,0,r,0,e.length-1),r[e.length-1]=n[0],i.Copy(t,1,r,e.length,t.length-1),r}r=new Array(e.length+t.length);return i.Copy(e,0,r,0,e.length),i.Copy(t,0,r,e.length,t.length),r},e.prototype.ChangesOverlap=function(e,t,n){if(o.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),o.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){var a=e.originalStart,i=e.originalLength,s=e.modifiedStart,l=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(i=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(l=t.modifiedStart+t.modifiedLength-e.modifiedStart),n[0]=new r.DiffChange(a,i,s,l),!0}return n[0]=null,!1},e.prototype.ClipDiagonalBound=function(e,t,n,r){if(e>=0&&e<r)return e;var a=t%2==0;return e<0?a===(n%2==0)?0:1:a===((r-n-1)%2==0)?r-1:r-2},e}();t.LcsDiff=l},QZUc:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return o}));var r=function(e){return e},a=function(e){return e},o=function(e){return e}},S1bJ:function(e,t,n){},TFfC:function(e,t,n){"use strict";n.d(t,"c",(function(){return d})),n.d(t,"a",(function(){return f})),n.d(t,"d",(function(){return m})),n.d(t,"b",(function(){return p}));n("UPNz");var r=n("fGyu"),a=n("ERkP"),o=n.n(a),i=n("DTYs"),s=n("vOCV"),l=n("zurd"),u=n("69rG"),c={sectionHeaderText:{margin:8,fontSize:18,color:"#FFFF88",whiteSpace:"pre-wrap"},sectionHeader2Text:{margin:8,fontSize:16,color:"#FFFF88",whiteSpace:"pre-wrap"},infoText:{margin:8,fontSize:12,whiteSpace:"pre-wrap"},buttonView:{margin:8,padding:4,border:"solid 1px #888888"},buttonText:{color:"#88FF88"}},d=function(e){var t=e.data,n=e.onDone,r=e.setProjectState,s=Object(a.useState)(!1),d=s[0],f=s[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.e,{style:c.sectionHeaderText},t.title+" - Preview the Result "+(d?"✅":"🔳")),o.a.createElement(i.h,{style:{flexDirection:"row",alignItems:"center"}},o.a.createElement(i.e,{style:c.infoText},"🔎 Preview the result below"),o.a.createElement(i.h,{style:{flex:1}}),n&&o.a.createElement(i.g,{onPress:function(){return null==n?void 0:n()}},o.a.createElement(i.h,{style:c.buttonView},o.a.createElement(i.e,{style:c.buttonText},"Done")))),o.a.createElement(i.e,{style:c.sectionHeader2Text},"Preview"),o.a.createElement(u.a,{projectState:t.projectState,setProjectState:r}),o.a.createElement(i.e,{style:c.sectionHeader2Text},"Code"),o.a.createElement(l.a,{projectData:{projectState:t.projectState,focus:t.focus},fileEditorMode_focus:"display",fileEditorMode_noFocus:"display",projectEditorMode:"display",onTaskDone:function(){f(!0),null==n||n()},lessonData:t}))},f=function(e){var t=e.data,n=e.onDone,r=Object(a.useState)(!1),s=r[0],u=r[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.e,{style:c.sectionHeaderText},t.title+" - Construct the Code "+(s?"✅":"🔳")),o.a.createElement(i.e,{style:c.infoText},"🎯 "+t.objective),o.a.createElement(i.e,{style:c.infoText},"💡 "+t.explanation),o.a.createElement(i.e,{style:c.infoText},(s?"✅":"🔳")+" "+t.task),o.a.createElement(l.a,{projectData:{projectState:t.projectState,focus:t.focus},fileEditorMode_focus:"construct-code",fileEditorMode_noFocus:"display",projectEditorMode:"display",onTaskDone:function(){u(!0),null==n||n()},lessonData:t}))},m=function(e){var t=e.data,n=e.onDone,r=Object(a.useState)(!1),s=r[0],u=r[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.e,{style:c.sectionHeaderText},t.title+" - Understand the Code "+(s?"✅":"🔳")),o.a.createElement(i.h,{style:{flexDirection:"row",alignItems:"center"}},o.a.createElement(i.e,{style:c.infoText},"🔎 Preview the result below"),o.a.createElement(i.h,{style:{flex:1}}),s&&o.a.createElement(i.g,{onPress:function(){return null==n?void 0:n()}},o.a.createElement(i.h,{style:c.buttonView},o.a.createElement(i.e,{style:c.buttonText},"Done")))),o.a.createElement(l.a,{projectData:{projectState:t.projectState,focus:t.focus},fileEditorMode_focus:"understand-code",fileEditorMode_noFocus:"display",projectEditorMode:"display",onTaskDone:function(){return u(!0)},lessonData:t}))},h={instructionsText:{marginLeft:16,fontSize:16,color:"#88FF88"},experimentView:{padding:16,justifyContent:"flex-start"},experimentItemRow:{flexDirection:"row",alignItems:"center"},experimentItemView:{padding:4},experimentItemView_active:{padding:4,border:"solid 1px #FFFF88",borderLeft:"solid 4px #FFFF88"},experimentItemText:{color:"#FFFF88",whiteSpace:"pre-wrap"}},p=function(e){var t=e.data,n=e.onDone,d=e.setProjectState,f=Object(a.useState)(t.projectState),m=f[0],p=f[1],g=Object(a.useState)(null),v=g[0],b=g[1],y=Object(a.useState)(t.focus),x=y[0],w=y[1],E=function(e){if(b(e),!e)return p(t.projectState),void w(t.focus);p((function(n){return Object(s.b)(t.projectState,e.replacements)}));var n=e.replacements.filter((function(e){return e.selection.filePath===t.focus.filePath})),a=Math.min.apply(Math,Object(r.a)(n.map((function(e){return e.selection.index})))),o=Math.max.apply(Math,Object(r.a)(n.map((function(e){return e.selection.index+e.selection.length})))),i=n.map((function(e){return-e.selection.length+e.content.length})),l=i.reduce((function(e,t){return e+=t}),0);console.log("LessonView_ExperimentCode",{minIndex:a,maxEndIndex:o,lengthDeltas:i,lengthDelta:l,focusReplacements:n}),w(Object.assign({},t.focus,{index:a,length:o-a+l}))};return Object(a.useEffect)((function(){E(null)}),[t.projectState]),o.a.createElement(o.a.Fragment,null,o.a.createElement(i.e,{style:c.sectionHeaderText},t.title+" - Experiment with the Code"),o.a.createElement(i.e,{style:h.instructionsText},"Select an experiment below and view the result"),o.a.createElement(i.h,{style:h.experimentView},o.a.createElement(i.g,{onPress:function(){return E(null)}},o.a.createElement(i.h,{style:h.experimentItemRow},o.a.createElement(i.h,{style:c.buttonView},o.a.createElement(i.e,{style:c.buttonText},"View")),o.a.createElement(i.h,{style:null===v?h.experimentItemView_active:h.experimentItemView},o.a.createElement(i.e,{style:h.experimentItemText},"Completed Code")))),t.experiments.map((function(e,t){var n;return o.a.createElement(i.g,{key:""+t,onPress:function(){return E(e)}},o.a.createElement(i.h,{style:h.experimentItemRow},o.a.createElement(i.h,{style:c.buttonView},o.a.createElement(i.e,{style:c.buttonText},"View")),o.a.createElement(i.h,{style:e===v?h.experimentItemView_active:h.experimentItemView},o.a.createElement(i.e,{style:h.experimentItemText},"🔬 "+(null!==(n=e.comment)&&void 0!==n?n:"Experiment "+t)))))})),n&&o.a.createElement(i.g,{onPress:function(){return null==n?void 0:n()}},o.a.createElement(i.h,{style:h.experimentItemRow},o.a.createElement(i.h,{style:c.buttonView},o.a.createElement(i.e,{style:c.buttonText},"Done")),o.a.createElement(i.h,{style:h.experimentItemView},o.a.createElement(i.e,{style:h.experimentItemText},"▶ Go to next step"))))),o.a.createElement(l.a,{key:m.filesHashCode,projectData:{projectState:m,focus:x},fileEditorMode_focus:"display",fileEditorMode_noFocus:"display",projectEditorMode:"display",onTaskDone:function(){},lessonData:t}),o.a.createElement(u.a,{projectState:m,setProjectState:d}))}},Vwau:function(e,t){!function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t);var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(Prism)},Xn6u:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.firstNonWhitespaceIndex=function(e){for(var t=0,n=e.length;t<n;t++){var r=e.charCodeAt(t);if(32!==r&&9!==r)return t}return-1},t.lastNonWhitespaceIndex=function(e,t){void 0===t&&(t=e.length-1);for(var n=t;n>=0;n--){var r=e.charCodeAt(n);if(32!==r&&9!==r)return n}return-1}},Yh9R:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={doodleSummary:"doodle/summary",doodleDrawingsPrefix:"doodle/drawings",doodlePartyDrawingsPrefix:"doodle/party/drawings",doodleVotesPrefix:"doodle/votes"}},ZUB1:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n("ERkP"),a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},o=r.createContext&&r.createContext(a),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&(n[r[a]]=e[r[a]])}return n};function l(e){return function(t){return r.createElement(u,i({attr:i({},e.attr)},t),function e(t){return t&&t.map((function(t,n){return r.createElement(t.tag,i({key:n},t.attr),e(t.child))}))}(e.child))}}function u(e){var t=function(t){var n,a=e.size||t.size||"1em";t.className&&(n=t.className),e.className&&(n=(n?n+" ":"")+e.className);var o=e.attr,l=e.title,u=s(e,["attr","title"]);return r.createElement("svg",i({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,o,u,{className:n,style:i({color:e.color||t.color},t.style,e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),e.children)};return void 0!==o?r.createElement(o.Consumer,null,(function(e){return t(e)})):t(a)}},aEBB:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("uTf4"),s=function(e){function t(e,t){return n.apply(this,arguments)}function n(){return(n=Object(o.a)(a.a.mark((function t(n,r){var o,s,l;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.uploadApiUrl+"/"+n,s={endpoint:n,data:r},t.next=4,Object(i.b)(o,s);case 4:return l=t.sent,t.abrupt("return",l.data);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return{createUploadUrl:function(e){return t("createUploadUrl",e)},renewUploadUrl:function(e){return t("renewUploadUrl",e)}}}},aLR2:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n("DTYs"),a=function(){if("web"!==r.c.OS)return{speak:function(){},getVoicesForLanguange:function(){return[]},setVoiceForLanguange:function(){}};var e=window.speechSynthesis,t={};return{speak:function(n,r){var a,o=null!==(a=t[null!=r?r:"en"])&&void 0!==a?a:null;try{var i=new SpeechSynthesisUtterance(n);i.voice=o,e.speak(i)}catch(s){}},getVoicesForLanguange:function(n){var r=e.getVoices();return console.log("voices",{voices:r}),r.filter((function(e){return e.lang.startsWith(n)})).map((function(e){return{voice:e,isSelected:t[n]===e}}))},setVoiceForLanguange:function(e,n){t[e]=n}}}},bQih:function(e,t,n){"use strict";n.d(t,"a",(function(){return h}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("gptL"),s=n("olhD"),l=n("H5jT"),u=n("O6JU"),c=n("7vau"),d=n("gLDK"),f=n("5UfP"),m=function(e){var t,n=null!==(t=e.style)&&void 0!==t?t:e.styleAlt?i.c.button_formAction_alt:i.c.button_formAction;return a.a.createElement(o.g,{style:Object(i.b)(n),onPress:e.onPress},a.a.createElement(o.e,{style:Object(i.a)(n)},e.children))},h={Loading:s.a,LoadingInline:s.b,ErrorBox:l.a,ErrorMessage:l.b,View_Panel:function(e){return a.a.createElement(o.h,Object.assign({style:i.c.view_panel},e))},View_Form:function(e){return a.a.createElement(o.h,Object.assign({style:i.c.view_form},e))},View_FormFields:function(e){return a.a.createElement(o.h,Object.assign({style:i.c.view_formFields},e))},View_FieldRow:function(e){return a.a.createElement(o.h,Object.assign({style:i.c.view_fieldRow},e))},View_FormActionRow:function(e){return a.a.createElement(o.h,Object.assign({style:i.c.view_formActionRow},e))},Text_FormTitle:function(e){return a.a.createElement(o.e,Object.assign({style:i.c.text_formTitle},e))},Text_FieldLabel:function(e){return a.a.createElement(o.e,Object.assign({style:i.c.text_fieldLabel,numberOfLines:1},e))},Button_FieldInline:function(e){return a.a.createElement(m,Object.assign({style:e.styleAlt?i.c.button_fieldInline_alt:i.c.button_fieldInline},e))},Button_FormAction:function(e){return a.a.createElement(m,Object.assign({style:e.styleAlt?i.c.button_formAction_alt:i.c.button_formAction},e))},Input_Text:function(e){var t;return a.a.createElement(o.f,{style:null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,keyboardType:"default",autoCompleteType:"off",placeholder:e.placeholder,editable:e.editable,value:""+e.value,onChange:function(t){return e.onChange(t)},onSubmitEditing:e.onSubmit,onFocus:e.onFocus,onBlur:e.onBlur})},Input_Username:function(e){var t;return a.a.createElement(o.f,{style:null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,keyboardType:"default",autoCompleteType:"username",placeholder:e.placeholder,editable:e.editable,value:""+e.value,onChange:function(t){return e.onChange(t)},onSubmitEditing:e.onSubmit})},Input_Password:function(e){var t,n=Object(r.useState)(!1),s=n[0],l=n[1],u=null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,c=u.marginRight;return a.a.createElement(o.h,{style:{flexDirection:"row",alignItems:"center"}},a.a.createElement(o.f,{style:Object.assign({},u,{marginRight:0}),keyboardType:"default",autoCompleteType:"password",secureTextEntry:!s,placeholder:e.placeholder,editable:e.editable,value:""+e.value,onChange:function(t){return e.onChange(t)},onSubmitEditing:e.onSubmit,onBlur:e.onBlur}),a.a.createElement(o.g,{onPress:function(){return l((function(e){return!e}))},style:{outlineColor:i.c.icon.outlineColor}},a.a.createElement(o.h,{style:{paddingLeft:4,paddingRight:4,marginRight:c}},a.a.createElement(d.a,{style:i.c.icon,kind:s?f.a.eye:f.a.eyeSlash}))))},Input_Phone:function(e){var t,n=Object(r.useState)(Object(u.a)(e.value)),s=n[0],l=n[1];return a.a.createElement(o.f,{style:null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,keyboardType:"phone-pad",autoCompleteType:"tel",placeholder:e.placeholder,editable:e.editable,value:s,onChange:function(t){l(Object(u.a)(t)),e.onChange(Object(u.b)(t))},onSubmitEditing:e.onSubmit})},Input_Email:function(e){var t,n=Object(r.useState)(Object(c.a)(e.value)),s=n[0],l=n[1];return a.a.createElement(o.f,{style:null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,keyboardType:"email-address",autoCompleteType:"email",placeholder:e.placeholder,editable:e.editable,value:s,onChange:function(t){l(Object(c.a)(t)),e.onChange(Object(c.a)(t))},onSubmitEditing:e.onSubmit})},Input_Currency:function(e){var t;return a.a.createElement(o.f,{style:null!==(t=e.style)&&void 0!==t?t:i.c.input_fieldEntry,keyboardType:"numeric",autoCompleteType:"off",placeholder:e.placeholder,editable:e.editable,value:""+e.value,onChange:function(t){return e.onChange(Number.parseFloat(t)||0)},onSubmitEditing:e.onSubmit})}}},bnqU:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return c}));var r=n("BQ33"),a=n.n(r),o=n("CN1R"),i=n.n(o),s=n("vm2h"),l=n.n(s);a.a.extend(i.a),a.a.extend(l.a);var u=function(e){return a()(e).format("L")},c=function(e){return a()(e).fromNow()}},bs47:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r){this.originalStart=e,this.originalLength=t,this.modifiedStart=n,this.modifiedLength=r}return e.prototype.getOriginalEnd=function(){return this.originalStart+this.originalLength},e.prototype.getModifiedEnd=function(){return this.modifiedStart+this.modifiedLength},e}();t.DiffChange=r},eCSs:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/"));function i(e){return s.apply(this,arguments)}function s(){return(s=Object(o.a)(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){setTimeout(e,t)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},fRV1:function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"==typeof window&&(n=window)}e.exports=n},gLDK:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n("ERkP"),a=n.n(r),o=n("gptL"),i=n("ilhn"),s=n("3pNR"),l=n("T8kG"),u=n("DTYs"),c=n("5UfP");var d=function(e){var t,n,r,d,f,m=function(e){switch(e){case c.a.menu:return{name:"menu",component:i.f};case c.a.back:return{name:"arrow-back",component:i.a};case c.a.error:return{name:"error-outline",component:i.e};case c.a.expanded:return{name:"chevron-down",component:s.a};case c.a.collapsed:return{name:"chevron-right",component:s.b};case c.a.copy:return{name:"content-copy",component:i.c};case c.a.retry:return{name:"reload",component:l.f};case c.a.dashboard:return{name:"dashboard",component:i.d};case c.a.add:return{name:"plus",component:l.e};case c.a.remove:return{name:"minus",component:l.d};case c.a.eye:return{name:"eye",component:l.b};case c.a.eyeSlash:return{name:"eye-slash",component:l.c};case c.a.checkChecked:return{name:"checked",component:l.a};case c.a.checkUnchecked:return{name:"unchecked",component:l.g};default:return{name:"unknown",component:i.b}}}(e.kind),h=m.component,p=null!==(t=null!==(n=null===(r=e.style)||void 0===r?void 0:r.size)&&void 0!==n?n:o.c.icon.size)&&void 0!==t?t:o.c.sizes.fontSize;return a.a.createElement(u.h,{style:{width:p,height:p}},a.a.createElement(h,{name:m.name,size:p,color:null!==(d=null===(f=e.style)||void 0===f?void 0:f.color)&&void 0!==d?d:o.c.icon.color}))}},gptL:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return c}));var r=function(e){var t,n,r,a,o,i,s,l;return{display:e.display,flexDirection:e.flexDirection,flex:e.flex,justifyContent:e.justifyContent,alignItems:e.alignItems,overflow:e.overflow,background:e.background,margin:e.margin,marginLeft:null!==(t=e.margin)&&void 0!==t?t:e.marginLeft,marginRight:null!==(n=e.margin)&&void 0!==n?n:e.marginRight,marginTop:null!==(r=e.margin)&&void 0!==r?r:e.marginTop,marginBottom:null!==(a=e.margin)&&void 0!==a?a:e.marginBottom,padding:e.padding,paddingRight:null!==(o=e.padding)&&void 0!==o?o:e.paddingRight,paddingLeft:null!==(i=e.padding)&&void 0!==i?i:e.paddingLeft,paddingTop:null!==(s=e.padding)&&void 0!==s?s:e.paddingTop,paddingBottom:null!==(l=e.padding)&&void 0!==l?l:e.paddingBottom,width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth,height:e.height,borderWidth:e.borderWidth,borderRadius:e.borderRadius,borderColor:e.borderColor,borderStyle:e.borderStyle,outlineColor:e.outlineColor}},a=function(e){return{color:e.color,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,outlineColor:e.outlineColor}},o={text:"#333333",text_header:"#333333",text_button:"#333333",text_error:"#333333",text_errorMessage:"#ff3333",border:"#cccccc",border_minor:"#cccccc",border_input:"#cccccc",outline:"#888888",background:"#ffffff",background_field:"#dddddd",background_button:"#eeeeee",background_error:"#ffcccc",loader:"#3333ff",icon:"#3333ff"},i=function(e){var t,n,r,a;return{borderWidth:e.all,borderLeftWidth:null!==(t=e.left)&&void 0!==t?t:e.all,borderRightWidth:null!==(n=e.right)&&void 0!==n?n:e.all,borderTopWidth:null!==(r=e.top)&&void 0!==r?r:e.all,borderBottomWidth:null!==(a=e.bottom)&&void 0!==a?a:e.all}},s={textPadding:4,borderWidth:{all:1},borderWidth_minor:{all:1},borderWidth_input:{all:1},borderRadius:4,sectionGap:16,elementGap:8,rowGap:4,rowPadding:4,fontSize:14,fontSize_input:16,fontSize_button:14,fontSize_header:16,lineHeight:"18px",minWidth_label:120,minWidth_input:120,minWidth_button:120,icon:14},l={fontFamily:'"Trebuchet MS", Helvetica, Roboto, sans-serif',fontWeight_normal:"normal",fontWeight_button:"bold",fontWeight_header:"bold"},u=function(e,t,n){var r=Object.assign({},i(t.borderWidth),{borderRadius:t.borderRadius,borderColor:e.border,borderStyle:"solid",outlineColor:e.outline}),a=Object.assign({},i(t.borderWidth_minor),{borderRadius:t.borderRadius,borderColor:e.border_minor,borderStyle:"solid",outlineColor:e.outline}),o=Object.assign({},i(t.borderWidth_input),{borderRadius:t.borderRadius,borderColor:e.border_input,borderStyle:"solid",outlineColor:e.outline}),s={};return{colors:e,sizes:t,font:n,view_panel:{background:e.background,padding:t.elementGap},view_form:Object.assign({},r,{marginBottom:t.sectionGap,padding:t.elementGap}),text_formTitle:{padding:t.textPadding,color:e.text_header,fontSize:t.fontSize_header,fontFamily:n.fontFamily,fontWeight:n.fontWeight_header},view_formFields:Object.assign({},a,{marginBottom:t.rowGap,background:e.background_field}),view_fieldRow:{marginLeft:t.rowPadding,display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap"},text_fieldLabel:{padding:t.textPadding,color:e.text,fontSize:t.fontSize,fontWeight:n.fontWeight_normal,minWidth:t.minWidth_label},input_fieldEntry:Object.assign({},o,{marginBottom:t.rowGap,marginRight:t.rowGap,padding:t.textPadding,color:e.text,fontSize:t.fontSize_input,fontWeight:n.fontWeight_normal,lineHeight:t.lineHeight,minWidth:t.minWidth_input}),button_fieldInline:s=Object.assign({},r,{marginBottom:t.rowGap,marginRight:t.rowGap,padding:t.textPadding,background:e.background_button,color:e.text_button,fontSize:t.fontSize_button,fontWeight:n.fontWeight_button,lineHeight:t.lineHeight,display:"flex",minWidth:t.minWidth_button}),button_fieldInline_alt:s=Object.assign({},s,{background:e.text_button,color:e.background_button,borderColor:e.background_button}),view_formActionRow:{display:"flex",flexDirection:"row",justifyContent:"flex-end",marginBottom:t.elementGap},button_formAction:s=Object.assign({},r,{marginLeft:t.elementGap,padding:t.textPadding,background:e.background_button,color:e.text_button,fontSize:t.fontSize_button,fontWeight:n.fontWeight_button,lineHeight:t.lineHeight,minWidth:t.minWidth_button}),button_formAction_alt:s=Object.assign({},s,{background:e.text_button,color:e.background_button,borderColor:e.background_button}),view_error:Object.assign({},r,{marginBottom:t.sectionGap,padding:t.rowPadding,background:e.background_error}),text_error:{padding:t.textPadding,color:e.text_error,fontSize:t.fontSize,fontFamily:n.fontFamily,fontWeight:n.fontWeight_button},text_errorMessage:{padding:t.textPadding,color:e.text_errorMessage,fontSize:t.fontSize,fontFamily:n.fontFamily,fontWeight:n.fontWeight_button},icon:{size:t.icon,color:e.icon,outlineColor:e.outline},icon_errorMessage:{size:t.icon,color:e.text_errorMessage,outlineColor:e.outline}}},c=(Object.assign({},o,{text:"#2b2b2b",text_header:"#863d8f",text_button:"#ffffff",border:"#863d8f",border_minor:"#863d8f",border_input:"#aaaaaa",background:"#ffffff",background_field:"#dddddd",background_button:"#863d8f",loader:"#863d8f",icon:"#863d8f"}),Object.assign({},s,{borderWidth:{all:1,bottom:4},borderWidth_minor:{all:0,bottom:1}}),u(o,s,l))},hTyw:function(e,t,n){"use strict";n.d(t,"a",(function(){return Se}));function r(e,t,n,a){if(!function(e,t,n,r){var a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,t,4,4,0,n,r,null);var o=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0),e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE}(e,t,n,a)){var o=e;switch(t){case o.R16F:return r(e,o.RG16F,o.RG,a);case o.RG16F:return r(e,o.RGBA16F,o.RGBA,a);default:throw new Error("Unknown Render Format")}}return{internalFormat:t,format:n}}function a(e,t){var n=e.__state.conversionName.toString(),r=Math.round(e.r),a=Math.round(e.g),o=Math.round(e.b),i=e.a,s=Math.round(e.h),l=e.s.toFixed(1),u=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+r+","+a+","+o+")":"CSS_RGBA"===n?"rgba("+r+","+a+","+o+","+i+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+r+","+a+","+o+"]":"RGBA_ARRAY"===n?"["+r+","+a+","+o+","+i+"]":"RGB_OBJ"===n?"{r:"+r+",g:"+a+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+r+",g:"+a+",b:"+o+",a:"+i+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+l+",v:"+u+",a:"+i+"}":"unknown format"}var o=Array.prototype.forEach,i=Array.prototype.slice,s={BREAK:{},extend:function(e){return this.each(i.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(i.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=i.call(arguments);return function(){for(var t=i.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(o&&e.forEach&&e.forEach===o)e.forEach(t,n);else if(e.length===e.length+0){var r,a=void 0;for(a=0,r=e.length;a<r;a++)if(a in e&&t.call(n,e[a],a)===this.BREAK)return}else for(var i in e)if(t.call(n,e[i],i)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var r=void 0;return function(){var a=this,o=arguments;function i(){r=null,n||e.apply(a,o)}var s=n||!r;clearTimeout(r),r=setTimeout(i,t),s&&e.apply(a,o)}},toArray:function(e){return e.toArray?e.toArray():i.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return isNaN(e)})),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return e instanceof Function}},l=[{litmus:s.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:a},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:a},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:a},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:a}}},{litmus:s.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:s.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:s.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b)&&s.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v)&&s.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],u=void 0,c=void 0,d=function(){c=!1;var e=arguments.length>1?s.toArray(arguments):arguments[0];return s.each(l,(function(t){if(t.litmus(e))return s.each(t.conversions,(function(t,n){if(u=t.read(e),!1===c&&!1!==u)return c=u,u.conversionName=n,u.conversion=t,s.BREAK})),s.BREAK})),c},f=void 0,m={hsv_to_rgb:function(e,t,n){var r=Math.floor(e/60)%6,a=e/60-Math.floor(e/60),o=n*(1-t),i=n*(1-a*t),s=n*(1-(1-a)*t),l=[[n,s,o],[i,n,o],[o,n,s],[o,i,n],[s,o,n],[n,o,i]][r];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var r=Math.min(e,t,n),a=Math.max(e,t,n),o=a-r,i=void 0;return 0===a?{h:NaN,s:0,v:0}:(i=e===a?(t-n)/o:t===a?2+(n-e)/o:4+(e-t)/o,(i/=6)<0&&(i+=1),{h:360*i,s:o/a,v:a/255})},rgb_to_hex:function(e,t,n){var r=this.hex_with_component(0,2,e);return r=this.hex_with_component(r,1,t),r=this.hex_with_component(r,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(f=8*t)|e&~(255<<f)}},h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function e(t,n,r){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,n);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in a)return a.value;var i=a.get;return void 0!==i?i.call(r):void 0},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},y=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},x=function(){function e(){if(p(this,e),this.__state=d.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return g(e,[{key:"toString",value:function(){return a(this)}},{key:"toHexString",value:function(){return a(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function w(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space||x.recalculateRGB(this,t,n),this.__state[t]},set:function(e){"RGB"!==this.__state.space&&(x.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function E(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space||x.recalculateHSV(this),this.__state[t]},set:function(e){"HSV"!==this.__state.space&&(x.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}x.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=m.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");s.extend(e.__state,m.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},x.recalculateHSV=function(e){var t=m.rgb_to_hsv(e.r,e.g,e.b);s.extend(e.__state,{s:t.s,v:t.v}),s.isNaN(t.h)?s.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},x.COMPONENTS=["r","g","b","h","s","v","hex","a"],w(x.prototype,"r",2),w(x.prototype,"g",1),w(x.prototype,"b",0),E(x.prototype,"h"),E(x.prototype,"s"),E(x.prototype,"v"),Object.defineProperty(x.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(x.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=m.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var _=function(){function e(t,n){p(this,e),this.initialValue=t[n],this.domElement=document.createElement("div"),this.object=t,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return g(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),e}(),S={};s.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(e,t){s.each(e,(function(e){S[e]=t}))}));var O=/(\d+(\.\d+)?)px/;function C(e){if("0"===e||s.isUndefined(e))return 0;var t=e.match(O);return s.isNull(t)?0:parseFloat(t[1])}var T={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var r=n,a=t;s.isUndefined(a)&&(a=!0),s.isUndefined(r)&&(r=!0),e.style.position="absolute",a&&(e.style.left=0,e.style.right=0),r&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,r){var a=n||{},o=S[t];if(!o)throw new Error("Event type "+t+" not supported.");var i=document.createEvent(o);switch(o){case"MouseEvents":var l=a.x||a.clientX||0,u=a.y||a.clientY||0;i.initMouseEvent(t,a.bubbles||!1,a.cancelable||!0,window,a.clickCount||1,0,0,l,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=i.initKeyboardEvent||i.initKeyEvent;s.defaults(a,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,a.bubbles||!1,a.cancelable,window,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.keyCode,a.charCode);break;default:i.initEvent(t,a.bubbles||!1,a.cancelable||!0)}s.defaults(i,r),e.dispatchEvent(i)},bind:function(e,t,n,r){var a=r||!1;return e.addEventListener?e.addEventListener(t,n,a):e.attachEvent&&e.attachEvent("on"+t,n),T},unbind:function(e,t,n,r){var a=r||!1;return e.removeEventListener?e.removeEventListener(t,n,a):e.detachEvent&&e.detachEvent("on"+t,n),T},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return T},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),r=n.indexOf(t);-1!==r&&(n.splice(r,1),e.className=n.join(" "))}else e.className=void 0;return T},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return C(t["border-left-width"])+C(t["border-right-width"])+C(t["padding-left"])+C(t["padding-right"])+C(t.width)},getHeight:function(e){var t=getComputedStyle(e);return C(t["border-top-width"])+C(t["border-bottom-width"])+C(t["padding-top"])+C(t["padding-bottom"])+C(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do{n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent}while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},k=function(e){function t(e,n){p(this,t);var r=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=r;return r.__prev=r.getValue(),r.__checkbox=document.createElement("input"),r.__checkbox.setAttribute("type","checkbox"),T.bind(r.__checkbox,"change",(function(){a.setValue(!a.__prev)}),!1),r.domElement.appendChild(r.__checkbox),r.updateDisplay(),r}return b(t,e),g(t,[{key:"setValue",value:function(e){var n=v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_),j=function(e){function t(e,n,r){p(this,t);var a=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r,i=a;if(a.__select=document.createElement("select"),s.isArray(o)){var l={};s.each(o,(function(e){l[e]=e})),o=l}return s.each(o,(function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),i.__select.appendChild(n)})),a.updateDisplay(),T.bind(a.__select,"change",(function(){var e=this.options[this.selectedIndex].value;i.setValue(e)})),a.domElement.appendChild(a.__select),a}return b(t,e),g(t,[{key:"setValue",value:function(e){var n=v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return T.isActive(this.__select)?this:(this.__select.value=this.getValue(),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(_),F=function(e){function t(e,n){p(this,t);var r=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=r;function o(){a.setValue(a.__input.value)}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"keyup",o),T.bind(r.__input,"change",o),T.bind(r.__input,"blur",(function(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())})),T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&this.blur()})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return b(t,e),g(t,[{key:"updateDisplay",value:function(){return T.isActive(this.__input)||(this.__input.value=this.getValue()),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_);function A(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var D=function(e){function t(e,n,r){p(this,t);var a=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r||{};return a.__min=o.min,a.__max=o.max,a.__step=o.step,s.isUndefined(a.__step)?0===a.initialValue?a.__impliedStep=1:a.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(a.initialValue))/Math.LN10))/10:a.__impliedStep=a.__step,a.__precision=A(a.__impliedStep),a}return b(t,e),g(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=A(e),this}}]),t}(_);var P=function(e){function t(e,n,r){p(this,t);var a=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));a.__truncationSuspended=!1;var o=a,i=void 0;function l(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function u(e){var t=i-e.clientY;o.setValue(o.getValue()+t*o.__impliedStep),i=e.clientY}function c(){T.unbind(window,"mousemove",u),T.unbind(window,"mouseup",c),l()}return a.__input=document.createElement("input"),a.__input.setAttribute("type","text"),T.bind(a.__input,"change",(function(){var e=parseFloat(o.__input.value);s.isNaN(e)||o.setValue(e)})),T.bind(a.__input,"blur",(function(){l()})),T.bind(a.__input,"mousedown",(function(e){T.bind(window,"mousemove",u),T.bind(window,"mouseup",c),i=e.clientY})),T.bind(a.__input,"keydown",(function(e){13===e.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,l())})),a.updateDisplay(),a.domElement.appendChild(a.__input),a}return b(t,e),g(t,[{key:"updateDisplay",value:function(){var e,n,r;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,r=Math.pow(10,n),Math.round(e*r)/r),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(D);function R(e,t,n,r,a){return r+(e-t)/(n-t)*(a-r)}var L=function(e){function t(e,n,r,a,o){p(this,t);var i=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:r,max:a,step:o})),s=i;function l(e){e.preventDefault();var t=s.__background.getBoundingClientRect();return s.setValue(R(e.clientX,t.left,t.right,s.__min,s.__max)),!1}function u(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",u),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=e.touches[0].clientX,n=s.__background.getBoundingClientRect();s.setValue(R(t,n.left,n.right,s.__min,s.__max))}function d(){T.unbind(window,"touchmove",c),T.unbind(window,"touchend",d),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}return i.__background=document.createElement("div"),i.__foreground=document.createElement("div"),T.bind(i.__background,"mousedown",(function(e){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",u),l(e)})),T.bind(i.__background,"touchstart",(function(e){if(1!==e.touches.length)return;T.bind(window,"touchmove",c),T.bind(window,"touchend",d),c(e)})),T.addClass(i.__background,"slider"),T.addClass(i.__foreground,"slider-fg"),i.updateDisplay(),i.__background.appendChild(i.__foreground),i.domElement.appendChild(i.__background),i}return b(t,e),g(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(D),M=function(e){function t(e,n,r){p(this,t);var a=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=a;return a.__button=document.createElement("div"),a.__button.innerHTML=void 0===r?"Fire":r,T.bind(a.__button,"click",(function(e){return e.preventDefault(),o.fire(),!1})),T.addClass(a.__button,"button"),a.domElement.appendChild(a.__button),a}return b(t,e),g(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(_),U=function(e){function t(e,n){p(this,t);var r=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));r.__color=new x(r.getValue()),r.__temp=new x(0);var a=r;r.domElement=document.createElement("div"),T.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&m.call(this)})),T.bind(r.__input,"blur",m),T.bind(r.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(a.__selector,"drag")}))})),T.bind(r.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(a.__selector,"drag")}))}));var o,i=document.createElement("div");function l(e){g(e),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",c),T.bind(window,"touchend",c)}function u(e){v(e),T.bind(window,"mousemove",v),T.bind(window,"touchmove",v),T.bind(window,"mouseup",f),T.bind(window,"touchend",f)}function c(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",c),T.unbind(window,"touchend",c),h()}function f(){T.unbind(window,"mousemove",v),T.unbind(window,"touchmove",v),T.unbind(window,"mouseup",f),T.unbind(window,"touchend",f),h()}function m(){var e=d(this.value);!1!==e?(a.__color.__state=e,a.setValue(a.__color.toOriginal())):this.value=a.__color.toString()}function h(){a.__onFinishChange&&a.__onFinishChange.call(a,a.__color.toOriginal())}function g(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=a.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,r=n.clientX,o=n.clientY,i=(r-t.left)/(t.right-t.left),s=1-(o-t.top)/(t.bottom-t.top);return s>1?s=1:s<0&&(s=0),i>1?i=1:i<0&&(i=0),a.__color.v=s,a.__color.s=i,a.setValue(a.__color.toOriginal()),!1}function v(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=a.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),a.__color.h=360*n,a.setValue(a.__color.toOriginal()),!1}return s.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),s.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),s.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),s.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),s.extend(i.style,{width:"100%",height:"100%",background:"none"}),N(i,"top","rgba(0,0,0,0)","#000"),s.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=r.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(r.__saturation_field,"mousedown",l),T.bind(r.__saturation_field,"touchstart",l),T.bind(r.__field_knob,"mousedown",l),T.bind(r.__field_knob,"touchstart",l),T.bind(r.__hue_field,"mousedown",u),T.bind(r.__hue_field,"touchstart",u),r.__saturation_field.appendChild(i),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return b(t,e),g(t,[{key:"updateDisplay",value:function(){var e=d(this.getValue());if(!1!==e){var t=!1;s.each(x.COMPONENTS,(function(n){if(!s.isUndefined(e[n])&&!s.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&s.extend(this.__color.__state,e)}s.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;s.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,N(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),s.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),t}(_),I=["-moz-","-o-","-webkit-","-ms-",""];function N(e,t,n,r){e.style.background="",s.each(I,(function(a){e.style.cssText+="background: "+a+"linear-gradient("+t+", "+n+" 0%, "+r+" 100%); "}))}var B=function(e,t){var n=t||document,r=document.createElement("style");r.type="text/css",r.innerHTML=e;var a=n.getElementsByTagName("head")[0];try{a.appendChild(r)}catch(o){}},V='<div id="dg-save" class="dg dialogue">\n\n  Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n  <textarea id="dg-new-constructor"></textarea>\n\n  <div id="dg-save-locally">\n\n    <input id="dg-local-storage" type="checkbox"/> Automatically save\n    values to <code>localStorage</code> on exit.\n\n    <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n      override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n      easier to work incrementally, but <code>localStorage</code> is fragile,\n      and your friends may not see the same values you do.\n\n    </div>\n\n  </div>\n\n</div>',z=function(e,t){var n=e[t];return s.isArray(arguments[2])||s.isObject(arguments[2])?new j(e,t,arguments[2]):s.isNumber(n)?s.isNumber(arguments[2])&&s.isNumber(arguments[3])?s.isNumber(arguments[4])?new L(e,t,arguments[2],arguments[3],arguments[4]):new L(e,t,arguments[2],arguments[3]):s.isNumber(arguments[4])?new P(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new P(e,t,{min:arguments[2],max:arguments[3]}):s.isString(n)?new F(e,t):s.isFunction(n)?new M(e,t,""):s.isBoolean(n)?new k(e,t):null};var W=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},H=function(){function e(){p(this,e),this.backgroundElement=document.createElement("div"),s.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),s.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;T.bind(this.backgroundElement,"click",(function(){t.hide()}))}return g(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),s.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",T.unbind(e.domElement,"webkitTransitionEnd",t),T.unbind(e.domElement,"transitionend",t),T.unbind(e.domElement,"oTransitionEnd",t)};T.bind(this.domElement,"webkitTransitionEnd",t),T.bind(this.domElement,"transitionend",t),T.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),e}();B(function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var G=function(){try{return!!window.localStorage}catch(e){return!1}}(),Y=void 0,$=!0,X=void 0,q=!1,K=[],J=function e(t){var n=this,r=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=s.defaults(r,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),r=s.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),s.isUndefined(r.load)?r.load={preset:"Default"}:r.preset&&(r.load.preset=r.preset),s.isUndefined(r.parent)&&r.hideable&&K.push(this),r.resizable=s.isUndefined(r.parent)&&r.resizable,r.autoPlace&&s.isUndefined(r.scrollable)&&(r.scrollable=!0);var a,o=G&&"true"===localStorage.getItem(re(this,"isLocal")),i=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(e){n.parent?n.getRoot().preset=e:r.load.preset=e,function(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}(this),n.revert()}},width:{get:function(){return r.width},set:function(e){r.width=e,le(n,e)}},name:{get:function(){return r.name},set:function(e){r.name=e,l&&(l.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(t){r.closed=t,r.closed?T.addClass(n.__ul,e.CLASS_CLOSED):T.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return o},set:function(e){G&&(o=e,e?T.bind(window,"unload",i):T.unbind(window,"unload",i),localStorage.setItem(re(n,"isLocal"),e))}}}),s.isUndefined(r.parent)){if(this.closed=r.closed||!1,T.addClass(this.domElement,e.CLASS_MAIN),T.makeSelectable(this.domElement,!1),G&&o){n.useLocalStorage=!0;var u=localStorage.getItem(re(this,"gui"));u&&(r.load=JSON.parse(u))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,T.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),r.closeOnTop?(T.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(T.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),T.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===r.closed&&(r.closed=!0);var c=document.createTextNode(r.name);T.addClass(c,"controller-name"),l=Q(n,c);T.addClass(this.__ul,e.CLASS_CLOSED),T.addClass(l,"title"),T.bind(l,"click",(function(e){return e.preventDefault(),n.closed=!n.closed,!1})),r.closed||(this.closed=!1)}r.autoPlace&&(s.isUndefined(r.parent)&&($&&(X=document.createElement("div"),T.addClass(X,"dg"),T.addClass(X,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(X),$=!1),X.appendChild(this.domElement),T.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||le(n,r.width)),this.__resizeHandler=function(){n.onResizeDebounced()},T.bind(window,"resize",this.__resizeHandler),T.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),T.bind(this.__ul,"transitionend",this.__resizeHandler),T.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&se(this),i=function(){G&&"true"===localStorage.getItem(re(n,"isLocal"))&&localStorage.setItem(re(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=i,r.parent||((a=n.getRoot()).width+=1,s.defer((function(){a.width-=1})))};function Q(e,t,n){var r=document.createElement("li");return t&&r.appendChild(t),n?e.__ul.insertBefore(r,n):e.__ul.appendChild(r),e.onResize(),r}function Z(e){T.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&T.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function ee(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function te(e,t){var n=e.getRoot(),r=n.__rememberedObjects.indexOf(t.object);if(-1!==r){var a=n.__rememberedObjectIndecesToControllers[r];if(void 0===a&&(a={},n.__rememberedObjectIndecesToControllers[r]=a),a[t.property]=t,n.load&&n.load.remembered){var o=n.load.remembered,i=void 0;if(o[e.preset])i=o[e.preset];else{if(!o.Default)return;i=o.Default}if(i[r]&&void 0!==i[r][t.property]){var s=i[r][t.property];t.initialValue=s,t.setValue(s)}}}}function ne(e,t,n,r){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(r.color)a=new U(t,n);else{var o=[t,n].concat(r.factoryArgs);a=z.apply(e,o)}r.before instanceof _&&(r.before=r.before.__li),te(e,a),T.addClass(a.domElement,"c");var i=document.createElement("span");T.addClass(i,"property-name"),i.innerHTML=a.property;var l=document.createElement("div");l.appendChild(i),l.appendChild(a.domElement);var u=Q(e,l,r.before);return T.addClass(u,J.CLASS_CONTROLLER_ROW),a instanceof U?T.addClass(u,"color"):T.addClass(u,h(a.getValue())),function(e,t,n){if(n.__li=t,n.__gui=e,s.extend(n,{options:function(t){if(arguments.length>1){var r=n.__li.nextElementSibling;return n.remove(),ne(e,n.object,n.property,{before:r,factoryArgs:[s.toArray(arguments)]})}if(s.isArray(t)||s.isObject(t)){var a=n.__li.nextElementSibling;return n.remove(),ne(e,n.object,n.property,{before:a,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof L){var r=new P(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});s.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],a=r[e];n[e]=r[e]=function(){var e=Array.prototype.slice.call(arguments);return a.apply(r,e),t.apply(n,e)}})),T.addClass(t,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof P){var a=function(t){if(s.isNumber(n.__min)&&s.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,a=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=ne(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(r),a&&o.listen(),o}return t};n.min=s.compose(a,n.min),n.max=s.compose(a,n.max)}else n instanceof k?(T.bind(t,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof M?(T.bind(t,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(t,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(t,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof U&&(T.addClass(t,"color"),n.updateDisplay=s.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=s.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&ee(e.getRoot(),!0),t}),n.setValue)}(e,u,a),e.__controllers.push(a),a}function re(e,t){return document.location.href+"."+t}function ae(e,t,n){var r=document.createElement("option");r.innerHTML=t,r.value=t,e.__preset_select.appendChild(r),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function oe(e,t){t.style.display=e.useLocalStorage?"block":"none"}function ie(e){var t=e.__save_row=document.createElement("li");T.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),T.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",T.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",T.addClass(r,"button"),T.addClass(r,"save");var a=document.createElement("span");a.innerHTML="New",T.addClass(a,"button"),T.addClass(a,"save-as");var o=document.createElement("span");o.innerHTML="Revert",T.addClass(o,"button"),T.addClass(o,"revert");var i=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?s.each(e.load.remembered,(function(t,n){ae(e,n,n===e.preset)})):ae(e,"Default",!1),T.bind(i,"change",(function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value})),t.appendChild(i),t.appendChild(n),t.appendChild(r),t.appendChild(a),t.appendChild(o),G){var l=document.getElementById("dg-local-explain"),u=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(re(0,"isLocal"))&&u.setAttribute("checked","checked"),oe(e,l),T.bind(u,"change",(function(){e.useLocalStorage=!e.useLocalStorage,oe(e,l)}))}var c=document.getElementById("dg-new-constructor");T.bind(c,"keydown",(function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||Y.hide()})),T.bind(n,"click",(function(){c.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),Y.show(),c.focus(),c.select()})),T.bind(r,"click",(function(){e.save()})),T.bind(a,"click",(function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)})),T.bind(o,"click",(function(){e.revert()}))}function se(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function r(){T.removeClass(e.__closeButton,J.CLASS_DRAG),T.unbind(window,"mousemove",n),T.unbind(window,"mouseup",r)}function a(a){return a.preventDefault(),t=a.clientX,T.addClass(e.__closeButton,J.CLASS_DRAG),T.bind(window,"mousemove",n),T.bind(window,"mouseup",r),!1}e.__resize_handle=document.createElement("div"),s.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),T.bind(e.__resize_handle,"mousedown",a),T.bind(e.__closeButton,"mousedown",a),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function le(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function ue(e,t){var n={};return s.each(e.__rememberedObjects,(function(r,a){var o={},i=e.__rememberedObjectIndecesToControllers[a];s.each(i,(function(e,n){o[n]=t?e.initialValue:e.getValue()})),n[a]=o})),n}J.toggleHide=function(){q=!q,s.each(K,(function(e){e.domElement.style.display=q?"none":""}))},J.CLASS_AUTO_PLACE="a",J.CLASS_AUTO_PLACE_CONTAINER="ac",J.CLASS_MAIN="main",J.CLASS_CONTROLLER_ROW="cr",J.CLASS_TOO_TALL="taller-than-window",J.CLASS_CLOSED="closed",J.CLASS_CLOSE_BUTTON="close-button",J.CLASS_CLOSE_TOP="close-top",J.CLASS_CLOSE_BOTTOM="close-bottom",J.CLASS_DRAG="drag",J.DEFAULT_WIDTH=245,J.TEXT_CLOSED="Close Controls",J.TEXT_OPEN="Open Controls",J._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||J.toggleHide()},T.bind(window,"keydown",J._keydownHandler,!1),s.extend(J.prototype,{add:function(e,t){return ne(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return ne(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;s.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&X.removeChild(this.domElement);var e=this;s.each(this.__folders,(function(t){e.removeFolder(t)})),T.unbind(window,"keydown",J._keydownHandler,!1),Z(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new J(t);this.__folders[e]=n;var r=Q(this,n.domElement);return T.addClass(r,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],Z(e);var t=this;s.each(e.__folders,(function(t){e.removeFolder(t)})),s.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=T.getOffset(e.__ul).top,n=0;s.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=T.getHeight(t))})),window.innerHeight-t-20<n?(T.addClass(e.domElement,J.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-20+"px"):(T.removeClass(e.domElement,J.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&s.defer((function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"})),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:s.debounce((function(){this.onResize()}),50),remember:function(){if(s.isUndefined(Y)&&((Y=new H).domElement.innerHTML=V),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;s.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&ie(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)})),this.autoPlace&&le(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=ue(this)),e.folders={},s.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=ue(this),ee(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=ue(this,!0)),this.load.remembered[e]=ue(this),this.preset=e,ae(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){s.each(this.__controllers,(function(t){this.getRoot().load.remembered?te(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),s.each(this.__folders,(function(e){e.revert(e)})),e||ee(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&function e(t){0!==t.length&&W.call(window,(function(){e(t)}));s.each(t,(function(e){e.updateDisplay()}))}(this.__listening)},updateDisplay:function(){s.each(this.__controllers,(function(e){e.updateDisplay()})),s.each(this.__folders,(function(e){e.updateDisplay()}))}});var ce=J,de=n("Gcfp");function fe(e){return Math.min(Math.max(e,0),1)}function me(e,t){var n=t.width/t.height;return n<1&&(e*=n),e}function he(e,t){var n=t.width/t.height;return n>1&&(e/=n),e}function pe(){var e=function(e,t,n){var r=Math.floor(6*e),a=6*e-r,o=n*(1-t),i=n*(1-a*t),s=n*(1-(1-a)*t);switch(r%6){case 0:return{r:n,g:s,b:o};case 1:return{r:i,g:n,b:o};case 2:return{r:o,g:n,b:s};case 3:return{r:o,g:i,b:n};case 4:return{r:s,g:o,b:n};case 5:default:return{r:n,g:o,b:i}}}(Math.random(),1,1);return e.r*=.15,e.g*=.15,e.b*=.15,e}function ge(e){var t=window.devicePixelRatio||1;return Math.floor(e*t)}function ve(e){if(!e)return 0;for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}var be=function(e,t){return e+(t-e+1)*Math.random()|0};var ye=function(e,t){var n=e.gl,r=e.ext,a=t.createFrameBufferObject;function o(e){var t=n.drawingBufferWidth/n.drawingBufferHeight;t<1&&(t=1/t);var r=Math.round(e),a=Math.round(e*t);return n.drawingBufferWidth>n.drawingBufferHeight?{width:a,height:r}:{width:r,height:a}}return{captureScreenshot:function(e,t){var i=o(t.resolution),s=a(i.width,i.height,r.formatRGBA.internalFormat,r.formatRGBA.format,r.halfFloatTexType,n.NEAREST);e(s);var l,u,c,d=function(e,t,n){var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)throw new Error("Could not get canvas 2d context");r.width=t,r.height=n;var o=a.createImageData(t,n);return o.data.set(e),a.putImageData(o,0,0),r}(function(e,t,n){for(var r=new Uint8Array(e.length),a=0,o=n-1;o>=0;o--)for(var i=0;i<t;i++){var s=o*t*4+4*i;r[s+0]=255*fe(e[a+0]),r[s+1]=255*fe(e[a+1]),r[s+2]=255*fe(e[a+2]),r[s+3]=255*fe(e[a+3]),a+=4}return r}(function(e){n.bindFramebuffer(n.FRAMEBUFFER,e.frameBuffer);var t=e.width*e.height*4,r=new Float32Array(t);return n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r),r}(s),s.width,s.height),s.width,s.height).toDataURL();l="fluid.png",u=d,(c=document.createElement("a")).download=l,c.href=u,document.body.append(c),c.click(),c.remove(),URL.revokeObjectURL(d)},getResolution:o}},xe=function(){function e(e,t,n){this.factory=e,this.vertexShader=t,this.fragmentShaderSource=n,this.programs=[],this.activeProgram=null,this.uniforms={}}var t=e.prototype;return t.setKeywords=function(e){for(var t=0,n=0;n<e.length;n++)t+=ve(e[n]);var r=this.programs[t];if(null==r){var a=this.factory.compileShader(this.factory.gl.FRAGMENT_SHADER,this.fragmentShaderSource,e);r=this.factory.createProgram(this.vertexShader,a),this.programs[t]=r}r!==this.activeProgram&&(this.uniforms=this.factory.getUniforms(r),this.activeProgram=r)},t.bind=function(){this.factory.gl.useProgram(this.activeProgram)},e}(),we=function(){function e(e,t,n){this.factory=e,this.uniforms={},this.program=this.factory.createProgram(t,n),this.uniforms=this.factory.getUniforms(this.program)}return e.prototype.bind=function(){this.factory.gl.useProgram(this.program)},e}();function Ee(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _e(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Se=function(e,t,n,a){var o,i=null!==(o=null==a?void 0:a.timeProvider)&&void 0!==o?o:{now:function(){return Date.now()},isPaused:function(){return!1}},s=document.createElement("canvas");s.style.width=n.width,s.style.height=n.height,e.append(s),oe();var l=function(){this.id=-1,this.texcoordX=0,this.texcoordY=0,this.prevTexcoordX=0,this.prevTexcoordY=0,this.deltaX=0,this.deltaY=0,this.down=!1,this.moved=!1,this.color={r:30,g:0,b:300},this.size=void 0,this.p={r:0,g:0,b:0}},u=[],c=[];u.push(new l),console.log("runFluidSimulator - 01 getWebGLSystem",{});var d=function(e){var t={alpha:!0,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1},n=e.getContext("webgl2",t);if(n){var a=n;a.getExtension("EXT_color_buffer_float");var o=a.getExtension("OES_texture_float_linear"),i=a.HALF_FLOAT;return a.clearColor(0,0,0,1),{gl:a,ext:{formatRGBA:r(a,a.RGBA16F,a.RGBA,i),formatRG:r(a,a.RG16F,a.RG,i),formatR:r(a,a.R16F,a.RED,i),halfFloatTexType:i,supportLinearFiltering:o}}}var s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);if(!s)return null;var l=s,u=l.getExtension("OES_texture_half_float"),c=l.getExtension("OES_texture_half_float_linear");l.clearColor(0,0,0,1);var d=u.HALF_FLOAT_OES;return{gl:l,ext:{formatRGBA:r(l,l.RGBA,l.RGBA,d),formatRG:r(l,l.RGBA,l.RGBA,d),formatR:r(l,l.RGBA,l.RGBA,d),halfFloatTexType:d,supportLinearFiltering:c}}}(s);if(!d)return null;var f=d.gl,m=d.ext;console.log("runFluidSimulator - 01B getWebGLSystem",{gl:f,ext:m});var h=function(e){var t=e.gl;function n(e,n,r,a,o,i){t.activeTexture(t.TEXTURE0);var s=t.createTexture();if(!s)throw new Error("texture not created");t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,r,e,n,0,a,o,null);var l=t.createFramebuffer();if(!l)throw new Error("frame buffer not created");return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.viewport(0,0,e,n),t.clear(t.COLOR_BUFFER_BIT),{texture:s,frameBuffer:l,width:e,height:n,texelSizeX:1/e,texelSizeY:1/n,attach:function(e){return t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,s),e}}}return{createFrameBufferObject:n,createDoubleFrameBufferObject:function(e,t,r,a,o,i){var s=n(e,t,r,a,o,i),l=n(e,t,r,a,o,i);return{width:e,height:t,texelSizeX:s.texelSizeX,texelSizeY:s.texelSizeY,get read(){return s},set read(e){s=e},get write(){return l},set write(e){l=e},swap:function(){var e=s;s=l,l=e}}}}}(d),p=h.createFrameBufferObject,g=h.createDoubleFrameBufferObject,v=ye(d,h),b=v.captureScreenshot,y=v.getResolution,x=function(e){var t=e.gl,n=e.ext;return{gl:t,ext:n,compileShader:function(e,n,r){n=function(e,t){if(!t)return e;var n="";return t.forEach((function(e){n+="#define "+e+"\n"})),n+e}(n,r);var a=t.createShader(e);if(!a)throw new Error("shader could not be created");return t.shaderSource(a,n),t.compileShader(a),t.getShaderParameter(a,t.COMPILE_STATUS)||console.trace(t.getShaderInfoLog(a)),a},createProgram:function(e,n){var r=t.createProgram();if(!r)throw new Error("program could not be created");return t.attachShader(r,e),t.attachShader(r,n),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS)||console.trace(t.getProgramInfoLog(r)),r},getUniforms:function(e){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),a=0;a<r;a++){var o,i=null===(o=t.getActiveUniform(e,a))||void 0===o?void 0:o.name;n[i]=t.getUniformLocation(e,i)}return n}}}(d),w={SIM_RESOLUTION:128,DYE_RESOLUTION:1024,CAPTURE_RESOLUTION:512,DENSITY_DISSIPATION:1,VELOCITY_DISSIPATION:.2,PRESSURE:.8,PRESSURE_ITERATIONS:20,CURL:30,SPLAT_RADIUS:.25,SPLAT_FORCE:6e3,SHADING:!0,COLORFUL:!0,COLOR_UPDATE_SPEED:10,PAUSED:!1,BACK_COLOR:{r:0,g:0,b:0},TRANSPARENT:!1,BLOOM:!0,BLOOM_ITERATIONS:8,BLOOM_RESOLUTION:256,BLOOM_INTENSITY:.8,BLOOM_THRESHOLD:.6,BLOOM_SOFT_KNEE:.7,SUNRAYS:!0,SUNRAYS_RESOLUTION:196,SUNRAYS_WEIGHT:1,MOTION_X:0,MOTION_Y:0};/mobi|android/i.test(navigator.userAgent)&&(w.DYE_RESOLUTION=512),m.supportLinearFiltering||(w.DYE_RESOLUTION=512,w.SHADING=!1,w.BLOOM=!1,w.SUNRAYS=!1),console.log("runFluidSimulator - 02 startGUI",{});var E=null!=a&&a.disableGui?null:function(e){var t,n=e.config,r=e.splatStack,a=e.initFramebuffers,o=e.updateKeywords,i=e.captureScreenshot,s=new ce({width:300});s.add(n,"DYE_RESOLUTION",{high:1024,medium:512,low:256,"very low":128}).name("quality").onFinishChange(a),s.add(n,"SIM_RESOLUTION",{32:32,64:64,128:128,256:256}).name("sim resolution").onFinishChange(a),s.add(n,"DENSITY_DISSIPATION",0,4).name("density diffusion"),s.add(n,"VELOCITY_DISSIPATION",0,4).name("velocity diffusion"),s.add(n,"PRESSURE",0,1).name("pressure"),s.add(n,"CURL",0,50).name("vorticity").step(1),s.add(n,"SPLAT_RADIUS",.01,1).name("splat radius"),s.add(n,"SHADING").name("shading").onFinishChange(o),s.add(n,"COLORFUL").name("colorful"),s.add(n,"PAUSED").name("paused").listen(),s.add({fun:function(){r.push(be(5,25))}},"fun").name("Random splats");var l=s.addFolder("Bloom");l.add(n,"BLOOM").name("enabled").onFinishChange(o),l.add(n,"BLOOM_INTENSITY",.1,2).name("intensity"),l.add(n,"BLOOM_THRESHOLD",0,1).name("threshold");var u=s.addFolder("Sunrays");u.add(n,"SUNRAYS").name("enabled").onFinishChange(o),u.add(n,"SUNRAYS_WEIGHT",.3,1).name("weight");var c=s.addFolder("Capture");c.addColor(n,"BACK_COLOR").name("background color"),c.add(n,"TRANSPARENT").name("transparent"),c.add({fun:i},"fun").name("take screenshot");var d=s.add({fun:function(){window.open("https://github.com/PavelDoGreat/WebGL-Fluid-Simulation"),Object(de.ga)("send","event","link button","github")}},"fun").name("Github - PavelDoGreat"),f=document.createElement("span");return null===(t=d.domElement.parentElement)||void 0===t||t.append(f),f.className="icon github",s.close(),{gui:s}}({config:w,splatStack:c,initFramebuffers:ee,updateKeywords:te,captureScreenshot:function(){return b(se,{resolution:w.CAPTURE_RESOLUTION})}});console.log("runFluidSimulator - 03 ditheringTexture",{url:t+"/LDR_LLL1_0.png"});var _=function(e){var t=f.createTexture();f.bindTexture(f.TEXTURE_2D,t),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.REPEAT),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.REPEAT),f.texImage2D(f.TEXTURE_2D,0,f.RGB,1,1,0,f.RGB,f.UNSIGNED_BYTE,new Uint8Array([255,255,255]));var n={texture:t,width:1,height:1,attach:function(e){return f.activeTexture(f.TEXTURE0+e),f.bindTexture(f.TEXTURE_2D,t),e}},r=new Image;return r.addEventListener("load",(function(){n.width=r.width,n.height=r.height,f.bindTexture(f.TEXTURE_2D,t),f.texImage2D(f.TEXTURE_2D,0,f.RGB,f.RGB,f.UNSIGNED_BYTE,r)})),r.src=e,n}(t+"/LDR_LLL1_0.png");console.log("runFluidSimulator - 04 createShaders",{});var S,O,C,T,k,j,F,A,D=function(e){var t=e.gl,n=e.ext,r=e.compileShader;return{baseVertexShader:r(t.VERTEX_SHADER,"\n    precision highp float;\n\n    attribute vec2 aPosition;\n    varying vec2 vUv;\n    varying vec2 vL;\n    varying vec2 vR;\n    varying vec2 vT;\n    varying vec2 vB;\n    uniform vec2 texelSize;\n\n    void main () {\n        vUv = aPosition * 0.5 + 0.5;\n        vL = vUv - vec2(texelSize.x, 0.0);\n        vR = vUv + vec2(texelSize.x, 0.0);\n        vT = vUv + vec2(0.0, texelSize.y);\n        vB = vUv - vec2(0.0, texelSize.y);\n        gl_Position = vec4(aPosition, 0.0, 1.0);\n    }\n"),blurVertexShader:r(t.VERTEX_SHADER,"\n    precision highp float;\n\n    attribute vec2 aPosition;\n    varying vec2 vUv;\n    varying vec2 vL;\n    varying vec2 vR;\n    uniform vec2 texelSize;\n\n    void main () {\n        vUv = aPosition * 0.5 + 0.5;\n        float offset = 1.33333333;\n        vL = vUv - texelSize * offset;\n        vR = vUv + texelSize * offset;\n        gl_Position = vec4(aPosition, 0.0, 1.0);\n    }\n"),blurShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying vec2 vUv;\n    varying vec2 vL;\n    varying vec2 vR;\n    uniform sampler2D uTexture;\n\n    void main () {\n        vec4 sum = texture2D(uTexture, vUv) * 0.29411764;\n        sum += texture2D(uTexture, vL) * 0.35294117;\n        sum += texture2D(uTexture, vR) * 0.35294117;\n        gl_FragColor = sum;\n    }\n"),copyShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    uniform sampler2D uTexture;\n\n    void main () {\n        gl_FragColor = texture2D(uTexture, vUv);\n    }\n"),clearShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    uniform sampler2D uTexture;\n    uniform float value;\n\n    void main () {\n        gl_FragColor = value * texture2D(uTexture, vUv);\n    }\n"),colorShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n\n    uniform vec4 color;\n\n    void main () {\n        gl_FragColor = color;\n    }\n"),checkerboardShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uTexture;\n    uniform float aspectRatio;\n\n    #define SCALE 25.0\n\n    void main () {\n        vec2 uv = floor(vUv * SCALE * vec2(aspectRatio, 1.0));\n        float v = mod(uv.x + uv.y, 2.0);\n        v = v * 0.1 + 0.8;\n        gl_FragColor = vec4(vec3(v), 1.0);\n    }\n"),displayShaderSource:"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    varying vec2 vL;\n    varying vec2 vR;\n    varying vec2 vT;\n    varying vec2 vB;\n    uniform sampler2D uTexture;\n    uniform sampler2D uBloom;\n    uniform sampler2D uSunrays;\n    uniform sampler2D uDithering;\n    uniform vec2 ditherScale;\n    uniform vec2 texelSize;\n\n    vec3 linearToGamma (vec3 color) {\n        color = max(color, vec3(0));\n        return max(1.055 * pow(color, vec3(0.416666667)) - 0.055, vec3(0));\n    }\n\n    void main () {\n        vec3 c = texture2D(uTexture, vUv).rgb;\n\n    #ifdef SHADING\n        vec3 lc = texture2D(uTexture, vL).rgb;\n        vec3 rc = texture2D(uTexture, vR).rgb;\n        vec3 tc = texture2D(uTexture, vT).rgb;\n        vec3 bc = texture2D(uTexture, vB).rgb;\n\n        float dx = length(rc) - length(lc);\n        float dy = length(tc) - length(bc);\n\n        vec3 n = normalize(vec3(dx, dy, length(texelSize)));\n        vec3 l = vec3(0.0, 0.0, 1.0);\n\n        float diffuse = clamp(dot(n, l) + 0.7, 0.7, 1.0);\n        c *= diffuse;\n    #endif\n\n    #ifdef BLOOM\n        vec3 bloom = texture2D(uBloom, vUv).rgb;\n    #endif\n\n    #ifdef SUNRAYS\n        float sunrays = texture2D(uSunrays, vUv).r;\n        c *= sunrays;\n    #ifdef BLOOM\n        bloom *= sunrays;\n    #endif\n    #endif\n\n    #ifdef BLOOM\n        float noise = texture2D(uDithering, vUv * ditherScale).r;\n        noise = noise * 2.0 - 1.0;\n        bloom += noise / 255.0;\n        bloom = linearToGamma(bloom);\n        c += bloom;\n    #endif\n\n        float a = max(c.r, max(c.g, c.b));\n        gl_FragColor = vec4(c, a);\n    }\n",bloomPrefilterShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uTexture;\n    uniform vec3 curve;\n    uniform float threshold;\n\n    void main () {\n        vec3 c = texture2D(uTexture, vUv).rgb;\n        float br = max(c.r, max(c.g, c.b));\n        float rq = clamp(br - curve.x, 0.0, curve.y);\n        rq = curve.z * rq * rq;\n        c *= max(rq, br - threshold) / max(br, 0.0001);\n        gl_FragColor = vec4(c, 0.0);\n    }\n"),bloomBlurShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying vec2 vL;\n    varying vec2 vR;\n    varying vec2 vT;\n    varying vec2 vB;\n    uniform sampler2D uTexture;\n\n    void main () {\n        vec4 sum = vec4(0.0);\n        sum += texture2D(uTexture, vL);\n        sum += texture2D(uTexture, vR);\n        sum += texture2D(uTexture, vT);\n        sum += texture2D(uTexture, vB);\n        sum *= 0.25;\n        gl_FragColor = sum;\n    }\n"),bloomFinalShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying vec2 vL;\n    varying vec2 vR;\n    varying vec2 vT;\n    varying vec2 vB;\n    uniform sampler2D uTexture;\n    uniform float intensity;\n\n    void main () {\n        vec4 sum = vec4(0.0);\n        sum += texture2D(uTexture, vL);\n        sum += texture2D(uTexture, vR);\n        sum += texture2D(uTexture, vT);\n        sum += texture2D(uTexture, vB);\n        sum *= 0.25;\n        gl_FragColor = sum * intensity;\n    }\n"),sunraysMaskShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uTexture;\n\n    void main () {\n        vec4 c = texture2D(uTexture, vUv);\n        float br = max(c.r, max(c.g, c.b));\n        c.a = 1.0 - min(max(br * 20.0, 0.0), 0.8);\n        gl_FragColor = c;\n    }\n"),sunraysShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uTexture;\n    uniform float weight;\n\n    #define ITERATIONS 16\n\n    void main () {\n        float Density = 0.3;\n        float Decay = 0.95;\n        float Exposure = 0.7;\n\n        vec2 coord = vUv;\n        vec2 dir = vUv - 0.5;\n\n        dir *= 1.0 / float(ITERATIONS) * Density;\n        float illuminationDecay = 1.0;\n\n        float color = texture2D(uTexture, vUv).a;\n\n        for (int i = 0; i < ITERATIONS; i++)\n        {\n            coord -= dir;\n            float col = texture2D(uTexture, coord).a;\n            color += col * illuminationDecay * weight;\n            illuminationDecay *= Decay;\n        }\n\n        gl_FragColor = vec4(color * Exposure, 0.0, 0.0, 1.0);\n    }\n"),splatShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uTarget;\n    uniform float aspectRatio;\n    uniform vec3 color;\n    uniform vec2 point;\n    uniform float radius;\n\n    void main () {\n        vec2 p = vUv - point.xy;\n        p.x *= aspectRatio;\n        vec3 splat = exp(-dot(p, p) / radius) * color;\n        vec3 base = texture2D(uTarget, vUv).xyz;\n        gl_FragColor = vec4(base + splat, 1.0);\n    }\n"),advectionShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    uniform sampler2D uVelocity;\n    uniform sampler2D uSource;\n    uniform vec2 texelSize;\n    uniform vec2 dyeTexelSize;\n    uniform float dt;\n    uniform float dissipation;\n    uniform vec2 motion;\n\n    vec4 bilerp (sampler2D sam, vec2 uv, vec2 tsize) {\n        vec2 st = uv / tsize - 0.5;\n\n        vec2 iuv = floor(st);\n        vec2 fuv = fract(st);\n\n        vec4 a = texture2D(sam, (iuv + vec2(0.5, 0.5)) * tsize);\n        vec4 b = texture2D(sam, (iuv + vec2(1.5, 0.5)) * tsize);\n        vec4 c = texture2D(sam, (iuv + vec2(0.5, 1.5)) * tsize);\n        vec4 d = texture2D(sam, (iuv + vec2(1.5, 1.5)) * tsize);\n\n        return mix(mix(a, b, fuv.x), mix(c, d, fuv.x), fuv.y);\n    }\n\n    void main () {\n    #ifdef MANUAL_FILTERING\n        vec2 coord = vUv - dt * bilerp(uVelocity, vUv, texelSize).xy * texelSize - dt * motion;\n        vec4 result = bilerp(uSource, coord, dyeTexelSize);\n    #else\n        vec2 coord = vUv - dt * texture2D(uVelocity, vUv).xy * texelSize - dt * motion;\n        vec4 result = texture2D(uSource, coord);\n    #endif\n        float decay = 1.0 + dissipation * dt;\n        gl_FragColor = result / decay;\n    }",n.supportLinearFiltering?null:["MANUAL_FILTERING"]),divergenceShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    varying highp vec2 vL;\n    varying highp vec2 vR;\n    varying highp vec2 vT;\n    varying highp vec2 vB;\n    uniform sampler2D uVelocity;\n\n    void main () {\n        float L = texture2D(uVelocity, vL).x;\n        float R = texture2D(uVelocity, vR).x;\n        float T = texture2D(uVelocity, vT).y;\n        float B = texture2D(uVelocity, vB).y;\n\n        vec2 C = texture2D(uVelocity, vUv).xy;\n        if (vL.x < 0.0) { L = -C.x; }\n        if (vR.x > 1.0) { R = -C.x; }\n        if (vT.y > 1.0) { T = -C.y; }\n        if (vB.y < 0.0) { B = -C.y; }\n\n        float div = 0.5 * (R - L + T - B);\n        gl_FragColor = vec4(div, 0.0, 0.0, 1.0);\n    }\n"),curlShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    varying highp vec2 vL;\n    varying highp vec2 vR;\n    varying highp vec2 vT;\n    varying highp vec2 vB;\n    uniform sampler2D uVelocity;\n\n    void main () {\n        float L = texture2D(uVelocity, vL).y;\n        float R = texture2D(uVelocity, vR).y;\n        float T = texture2D(uVelocity, vT).x;\n        float B = texture2D(uVelocity, vB).x;\n        float vorticity = R - L - T + B;\n        gl_FragColor = vec4(0.5 * vorticity, 0.0, 0.0, 1.0);\n    }\n"),vorticityShader:r(t.FRAGMENT_SHADER,"\n    precision highp float;\n    precision highp sampler2D;\n\n    varying vec2 vUv;\n    varying vec2 vL;\n    varying vec2 vR;\n    varying vec2 vT;\n    varying vec2 vB;\n    uniform sampler2D uVelocity;\n    uniform sampler2D uCurl;\n    uniform float curl;\n    uniform float dt;\n\n    void main () {\n        float L = texture2D(uCurl, vL).x;\n        float R = texture2D(uCurl, vR).x;\n        float T = texture2D(uCurl, vT).x;\n        float B = texture2D(uCurl, vB).x;\n        float C = texture2D(uCurl, vUv).x;\n\n        vec2 force = 0.5 * vec2(abs(T) - abs(B), abs(R) - abs(L));\n        force /= length(force) + 0.0001;\n        force *= curl * C;\n        force.y *= -1.0;\n\n        vec2 velocity = texture2D(uVelocity, vUv).xy;\n        velocity += force * dt;\n        velocity = min(max(velocity, -1000.0), 1000.0);\n        gl_FragColor = vec4(velocity, 0.0, 1.0);\n    }\n"),pressureShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    varying highp vec2 vL;\n    varying highp vec2 vR;\n    varying highp vec2 vT;\n    varying highp vec2 vB;\n    uniform sampler2D uPressure;\n    uniform sampler2D uDivergence;\n\n    void main () {\n        float L = texture2D(uPressure, vL).x;\n        float R = texture2D(uPressure, vR).x;\n        float T = texture2D(uPressure, vT).x;\n        float B = texture2D(uPressure, vB).x;\n        float C = texture2D(uPressure, vUv).x;\n        float divergence = texture2D(uDivergence, vUv).x;\n        float pressure = (L + R + B + T - divergence) * 0.25;\n        gl_FragColor = vec4(pressure, 0.0, 0.0, 1.0);\n    }\n"),gradientSubtractShader:r(t.FRAGMENT_SHADER,"\n    precision mediump float;\n    precision mediump sampler2D;\n\n    varying highp vec2 vUv;\n    varying highp vec2 vL;\n    varying highp vec2 vR;\n    varying highp vec2 vT;\n    varying highp vec2 vB;\n    uniform sampler2D uPressure;\n    uniform sampler2D uVelocity;\n\n    void main () {\n        float L = texture2D(uPressure, vL).x;\n        float R = texture2D(uPressure, vR).x;\n        float T = texture2D(uPressure, vT).x;\n        float B = texture2D(uPressure, vB).x;\n        vec2 velocity = texture2D(uVelocity, vUv).xy;\n        velocity.xy -= vec2(R - L, T - B);\n        gl_FragColor = vec4(velocity, 0.0, 1.0);\n    }\n")}}(x),P=new we(x,D.blurVertexShader,D.blurShader),R=new we(x,D.baseVertexShader,D.copyShader),L=new we(x,D.baseVertexShader,D.clearShader),M=new we(x,D.baseVertexShader,D.colorShader),U=new we(x,D.baseVertexShader,D.checkerboardShader),I=new we(x,D.baseVertexShader,D.bloomPrefilterShader),N=new we(x,D.baseVertexShader,D.bloomBlurShader),B=new we(x,D.baseVertexShader,D.bloomFinalShader),V=new we(x,D.baseVertexShader,D.sunraysMaskShader),z=new we(x,D.baseVertexShader,D.sunraysShader),W=new we(x,D.baseVertexShader,D.splatShader),H=new we(x,D.baseVertexShader,D.advectionShader),G=new we(x,D.baseVertexShader,D.divergenceShader),Y=new we(x,D.baseVertexShader,D.curlShader),$=new we(x,D.baseVertexShader,D.vorticityShader),X=new we(x,D.baseVertexShader,D.pressureShader),q=new we(x,D.baseVertexShader,D.gradientSubtractShader),K=new xe(x,D.baseVertexShader,D.displayShaderSource),J=function(e){var t=e.gl;return{blit:(t.bindBuffer(t.ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,t.createBuffer()),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),t.STATIC_DRAW),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(0),function(e,n){void 0===n&&(n=!1),null==e?(t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.bindFramebuffer(t.FRAMEBUFFER,null)):(t.viewport(0,0,e.width,e.height),t.bindFramebuffer(t.FRAMEBUFFER,e.frameBuffer)),n&&(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT)),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)})}}(d).blit,Q=[];function Z(e,t,n,r,a,o,i){return e.width===t&&e.height===n||(e.read=function(e,t,n,r,a,o,i){var s=p(t,n,r,a,o,i);return R.bind(),f.uniform1i(R.uniforms.uTexture,e.attach(0)),J(s),s}(e.read,t,n,r,a,o,i),e.write=p(t,n,r,a,o,i),e.width=t,e.height=n,e.texelSizeX=1/t,e.texelSizeY=1/n),e}function ee(){var e=y(w.SIM_RESOLUTION),t=y(w.DYE_RESOLUTION),n=m.halfFloatTexType,r=m.formatRGBA,a=m.formatRG,o=m.formatR,i=m.supportLinearFiltering?f.LINEAR:f.NEAREST;f.disable(f.BLEND),S=null==S?g(t.width,t.height,r.internalFormat,r.format,n,i):Z(S,t.width,t.height,r.internalFormat,r.format,n,i),O=null==O?g(e.width,e.height,a.internalFormat,a.format,n,i):Z(O,e.width,e.height,a.internalFormat,a.format,n,i),C=p(e.width,e.height,o.internalFormat,o.format,n,f.NEAREST),T=p(e.width,e.height,o.internalFormat,o.format,n,f.NEAREST),k=g(e.width,e.height,o.internalFormat,o.format,n,f.NEAREST),function(){var e=y(w.BLOOM_RESOLUTION),t=m.halfFloatTexType,n=m.formatRGBA,r=m.supportLinearFiltering?f.LINEAR:f.NEAREST;j=p(e.width,e.height,n.internalFormat,n.format,t,r),Q.length=0;for(var a=0;a<w.BLOOM_ITERATIONS;a++){var o=e.width>>a+1,i=e.height>>a+1;if(o<2||i<2)break;var s=p(o,i,n.internalFormat,n.format,t,r);Q.push(s)}}(),function(){var e=y(w.SUNRAYS_RESOLUTION),t=m.halfFloatTexType,n=m.formatR,r=m.supportLinearFiltering?f.LINEAR:f.NEAREST;F=p(e.width,e.height,n.internalFormat,n.format,t,r),A=p(e.width,e.height,n.internalFormat,n.format,t,r)}()}function te(){var e=[];w.SHADING&&e.push("SHADING"),w.BLOOM&&e.push("BLOOM"),w.SUNRAYS&&e.push("SUNRAYS"),K.setKeywords(e)}var ne=0;function re(){if(i.isPaused())return console.log("runFluidSimulator.update timeProvider.PAUSED",{}),void requestAnimationFrame(re);var e=function(){var e=i.now(),t=(e-ae)/1e3,n=Math.min(t,.016666);return ae=e,n}();oe()&&(te(),ee()),function(e){if(!w.COLORFUL)return;(ie+=e*w.COLOR_UPDATE_SPEED)>=1&&(t=ie,ie=0===(r=1-(n=0))?n:(t-n)%r+n,u.forEach((function(e){e.color=pe()})));var t,n,r}(e),function(){var e=c.pop();null!=e&&(console.log("applyInputs: lastSplat",{lastSplat:e,splatStack:c,pointers:u}),le(e));u.forEach((function(e){var t,n,r;e.moved&&(e.moved=!1,n=(t=e).deltaX*w.SPLAT_FORCE,r=t.deltaY*w.SPLAT_FORCE,ue(t.texcoordX,t.texcoordY,n,r,t.color,t.size))}))}(),w.PAUSED||function(e){f.disable(f.BLEND),Y.bind(),f.uniform2f(Y.uniforms.texelSize,O.texelSizeX,O.texelSizeY),f.uniform1i(Y.uniforms.uVelocity,O.read.attach(0)),J(T),$.bind(),f.uniform2f($.uniforms.texelSize,O.texelSizeX,O.texelSizeY),f.uniform1i($.uniforms.uVelocity,O.read.attach(0)),f.uniform1i($.uniforms.uCurl,T.attach(1)),f.uniform1f($.uniforms.curl,w.CURL),f.uniform1f($.uniforms.dt,e),J(O.write),O.swap(),G.bind(),f.uniform2f(G.uniforms.texelSize,O.texelSizeX,O.texelSizeY),f.uniform1i(G.uniforms.uVelocity,O.read.attach(0)),J(C),L.bind(),f.uniform1i(L.uniforms.uTexture,k.read.attach(0)),f.uniform1f(L.uniforms.value,w.PRESSURE),J(k.write),k.swap(),X.bind(),f.uniform2f(X.uniforms.texelSize,O.texelSizeX,O.texelSizeY),f.uniform1i(X.uniforms.uDivergence,C.attach(0));for(var t=0;t<w.PRESSURE_ITERATIONS;t++)f.uniform1i(X.uniforms.uPressure,k.read.attach(1)),J(k.write),k.swap();q.bind(),f.uniform2f(q.uniforms.texelSize,O.texelSizeX,O.texelSizeY),f.uniform1i(q.uniforms.uPressure,k.read.attach(0)),f.uniform1i(q.uniforms.uVelocity,O.read.attach(1)),J(O.write),O.swap(),H.bind(),f.uniform2f(H.uniforms.texelSize,O.texelSizeX,O.texelSizeY),m.supportLinearFiltering||f.uniform2f(H.uniforms.dyeTexelSize,O.texelSizeX,O.texelSizeY);var n=O.read.attach(0);f.uniform1i(H.uniforms.uVelocity,n),f.uniform1i(H.uniforms.uSource,n),f.uniform1f(H.uniforms.dt,e),f.uniform1f(H.uniforms.dissipation,w.VELOCITY_DISSIPATION),f.uniform2f(H.uniforms.motion,w.MOTION_X,w.MOTION_Y),J(O.write),O.swap(),m.supportLinearFiltering||f.uniform2f(H.uniforms.dyeTexelSize,S.texelSizeX,S.texelSizeY);f.uniform1i(H.uniforms.uVelocity,O.read.attach(0)),f.uniform1i(H.uniforms.uSource,S.read.attach(1)),f.uniform1f(H.uniforms.dissipation,w.DENSITY_DISSIPATION),f.uniform2f(H.uniforms.motion,w.MOTION_X,w.MOTION_Y),J(S.write),S.swap()}(e),se(null),ne++,requestAnimationFrame(re)}var ae=i.now();function oe(){var e=ge(s.clientWidth),t=ge(s.clientHeight);return(s.width!==e||s.height!==t)&&(s.width=e,s.height=t,!0)}var ie=0;function se(e){var t,n,r,a;w.BLOOM&&function(e,t){if(Q.length<2)return;var n=t;f.disable(f.BLEND),I.bind();var r=w.BLOOM_THRESHOLD*w.BLOOM_SOFT_KNEE+1e-4,a=w.BLOOM_THRESHOLD-r,o=2*r,i=.25/r;f.uniform3f(I.uniforms.curve,a,o,i),f.uniform1f(I.uniforms.threshold,w.BLOOM_THRESHOLD),f.uniform1i(I.uniforms.uTexture,e.attach(0)),J(n),N.bind();for(var s,l=Ee(Q);!(s=l()).done;){var u=s.value;f.uniform2f(N.uniforms.texelSize,n.texelSizeX,n.texelSizeY),f.uniform1i(N.uniforms.uTexture,n.attach(0)),J(u),n=u}f.blendFunc(f.ONE,f.ONE),f.enable(f.BLEND);for(var c=Q.length-2;c>=0;c--){var d=Q[c];f.uniform2f(N.uniforms.texelSize,n.texelSizeX,n.texelSizeY),f.uniform1i(N.uniforms.uTexture,n.attach(0)),f.viewport(0,0,d.width,d.height),J(d),n=d}f.disable(f.BLEND),B.bind(),f.uniform2f(B.uniforms.texelSize,n.texelSizeX,n.texelSizeY),f.uniform1i(B.uniforms.uTexture,n.attach(0)),f.uniform1f(B.uniforms.intensity,w.BLOOM_INTENSITY),J(t)}(S.read,j),w.SUNRAYS&&(t=S.read,n=S.write,r=F,f.disable(f.BLEND),V.bind(),f.uniform1i(V.uniforms.uTexture,t.attach(0)),J(n),z.bind(),f.uniform1f(z.uniforms.weight,w.SUNRAYS_WEIGHT),f.uniform1i(z.uniforms.uTexture,n.attach(0)),J(r),function(e,t,n){P.bind();for(var r=0;r<n;r++)f.uniform2f(P.uniforms.texelSize,e.texelSizeX,0),f.uniform1i(P.uniforms.uTexture,e.attach(0)),J(t),f.uniform2f(P.uniforms.texelSize,0,e.texelSizeY),f.uniform1i(P.uniforms.uTexture,t.attach(0)),J(e)}(F,A,1)),null!=e&&w.TRANSPARENT?f.disable(f.BLEND):(f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA),f.enable(f.BLEND)),w.TRANSPARENT||function(e,t){M.bind(),f.uniform4f(M.uniforms.color,t.r,t.g,t.b,1),J(e)}(e,{r:(a=w.BACK_COLOR).r/255,g:a.g/255,b:a.b/255}),null==e&&w.TRANSPARENT&&function(e){U.bind(),f.uniform1f(U.uniforms.aspectRatio,s.width/s.height),J(e)}(e),function(e){var t=null==e?f.drawingBufferWidth:e.width,n=null==e?f.drawingBufferHeight:e.height;K.bind(),w.SHADING&&f.uniform2f(K.uniforms.texelSize,1/t,1/n);if(f.uniform1i(K.uniforms.uTexture,S.read.attach(0)),w.BLOOM){f.uniform1i(K.uniforms.uBloom,j.attach(1)),f.uniform1i(K.uniforms.uDithering,_.attach(2));var r=function(e,t,n){return{x:t/e.width,y:n/e.height}}(_,t,n);f.uniform2f(K.uniforms.ditherScale,r.x,r.y)}w.SUNRAYS&&f.uniform1i(K.uniforms.uSunrays,F.attach(3));J(e)}(e)}function le(e){for(var t=0;t<e;t++){var n=pe();n.r*=10,n.g*=10,n.b*=10,ue(Math.random(),Math.random(),1e3*(Math.random()-.5),1e3*(Math.random()-.5),n)}}function ue(e,t,n,r,a,o){var i;W.bind(),f.uniform1i(W.uniforms.uTarget,O.read.attach(0)),f.uniform1f(W.uniforms.aspectRatio,s.width/s.height),f.uniform2f(W.uniforms.point,e,t),f.uniform3f(W.uniforms.color,n,r,0),f.uniform1f(W.uniforms.radius,function(e){var t=s.width/s.height;t>1&&(e*=t);return e}(.5*(null!==(i=null==o?void 0:o.x)&&void 0!==i?i:2*w.SPLAT_RADIUS)/100)),J(O.write),O.swap(),f.uniform1i(W.uniforms.uTarget,S.read.attach(0)),f.uniform3f(W.uniforms.color,a.r,a.g,a.b),J(S.write),S.swap()}console.log("runFluidSimulator - 08 addEventListeners",{});var fe=[],ve=function(e,t){null!=a&&a.disableInput||(window.addEventListener(e,t),fe.push({name:e,handler:t}))},_e=[],Se=function(e,t){null!=a&&a.disableInput||(s.addEventListener(e,t),_e.push({name:e,handler:t}))};function Oe(e,t,n,r){e.id=t,e.down=!0,e.moved=!1,e.texcoordX=n/s.width,e.texcoordY=1-r/s.height,e.prevTexcoordX=e.texcoordX,e.prevTexcoordY=e.texcoordY,e.deltaX=0,e.deltaY=0,e.color=pe()}function Ce(e,t,n){e.prevTexcoordX=e.texcoordX,e.prevTexcoordY=e.texcoordY,e.texcoordX=t/s.width,e.texcoordY=1-n/s.height,e.deltaX=me(e.texcoordX-e.prevTexcoordX,s),e.deltaY=he(e.texcoordY-e.prevTexcoordY,s),e.moved=Math.abs(e.deltaX)>0||Math.abs(e.deltaY)>0}function Te(e){e.down=!1}Se("mousedown",(function(e){var t=ge(e.offsetX),n=ge(e.offsetY),r=u.find((function(e){return-1===e.id}));null==r&&(r=new l),Oe(r,-1,t,n)})),Se("mousemove",(function(e){var t=u[0];t.down&&Ce(t,ge(e.offsetX),ge(e.offsetY))})),ve("mouseup",(function(){Te(u[0])})),Se("touchstart",(function(e){e.preventDefault();for(var t=e.targetTouches;t.length>=u.length;)u.push(new l);for(var n,r=Ee(t.entries());!(n=r()).done;){var a=n.value,o=a[0],i=a[1],s=ge(i.pageX),c=ge(i.pageY);Oe(u[o+1],i.identifier,s,c)}})),Se("touchmove",(function(e){e.preventDefault();for(var t,n=Ee(e.targetTouches.entries());!(t=n()).done;){var r=t.value,a=r[0],o=r[1],i=u[a+1];if(i.down)Ce(i,ge(o.pageX),ge(o.pageY))}})),ve("touchend",(function(e){for(var t,n=function(){var e=t.value,n=u.find((function(t){return t.id===e.identifier}));if(null==n)return"continue";Te(n)},r=Ee(e.changedTouches);!(t=r()).done;)n()})),ve("keydown",(function(e){"KeyP"===e.code&&(w.PAUSED=!w.PAUSED)," "===e.key&&c.push(be(5,25))})),console.log("runFluidSimulator - 10 DONE",{});var ke=new Map;return{start:function(){oe(),console.log("runFluidSimulator - 05 updateKeywords",{}),te(),console.log("runFluidSimulator - 06 initFramebuffers",{}),ee(),console.log("runFluidSimulator - 07 multipleSplats",{}),null!=a&&a.disableStartupSplats||le(be(5,25)),re()},canvas:s,getDisplaySize:function(){return{width:s.width,height:s.height}},getFrameTick:function(){return ne},config:w,updateConfig:function(){te()},splat:function(e,t,n,r,a,o,i,c){var d=ke.get(e);d||(d=new l,ke.set(e,d),u.push(d),d.id=e),d.down=t,d.moved=t,d.texcoordX=n,d.texcoordY=r,d.prevTexcoordX=n-a,d.prevTexcoordY=r-o,d.deltaX=me(d.texcoordX-d.prevTexcoordX,s),d.deltaY=he(d.texcoordY-d.prevTexcoordY,s),d.color=null!=c?c:pe(),d.size=i},close:function(){var e;null==E||null===(e=E.gui)||void 0===e||e.destroy(),fe.forEach((function(e){var t=e.name,n=e.handler;window.removeEventListener(t,n)})),_e.forEach((function(e){var t=e.name,n=e.handler;s.removeEventListener(t,n)})),f.canvas.width=1,f.canvas.height=1,s.remove()}}}},hsFx:function(e,t,n){"use strict";n.d(t,"d",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"f",(function(){return u})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return d})),n.d(t,"e",(function(){return f}));var r=n("fGyu"),a=n("+tC1");function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=function(e,t,n){var r=t.indexOf(e);if(r<0)throw new Error("moveItem Failed to find an item in the from array: "+JSON.stringify({obj:e,from:t,to:n}));t.splice(r,1),n.push(e)},l=function(e){var t=new Set(e);return Object(r.a)(t)},u=function(e){return e.map((function(e){return{x:e,value:Math.random()}})).sort((function(e,t){return e.value-t.value})).map((function(e){return e.x}))},c=function(e,t){var n={};return e.forEach((function(e){n[t(e)]=e})),Object(a.a)(n)},d=function(e,t){for(var n,r={},a=o(e);!(n=a()).done;){var i,s=n.value;(null!==(i=r[t(s)])&&void 0!==i?i:r[t(s)]=[]).push(s)}return r};function f(e,t){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}},k00s:function(e,t){!function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},keyword:/\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|undefined|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/}),delete e.languages.typescript.parameter;var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism)},kDUE:function(e,t,n){"use strict";var r=n("gpmR"),a=n("JLWX"),o=n("mD7w"),i=function(e,t,n,s,l,u,c,d){for(var f,m=l,h=0,p=!!c&&o(c,d,3);h<s;){if(h in n){if(f=p?p(n[h],h,t):n[h],u>0&&r(f))m=i(e,t,f,a(f.length),m,u-1)-1;else{if(m>=9007199254740991)throw TypeError("Exceed the acceptable array length");e[m]=f}m++}h++}return m};e.exports=i},"kNg/":function(e,t,n){n("M3SG")("flatMap")},la2L:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(e){var t,n=function(e){for(var t=1779033703^e.length,n=0;n<e.length;n++)t=(t=Math.imul(t^e.charCodeAt(n),3432918353))<<13|t>>>19;return function(){return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^=t>>>16)>>>0}}(e)();return{random:(t=n,function(){var e=t+=1831565813;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296})}}},n5u1:function(e,t,n){(function(t){var n=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var a,o;switch(n=n||{},r.util.type(t)){case"Object":if(o=r.util.objId(t),n[o])return n[o];for(var i in a={},n[o]=a,t)t.hasOwnProperty(i)&&(a[i]=e(t[i],n));return a;case"Array":return o=r.util.objId(t),n[o]?n[o]:(a=[],n[o]=a,t.forEach((function(t,r){a[r]=e(t,n)})),a);default:return t}},getLanguage:function(e){for(;e&&!t.test(e.className);)e=e.parentElement;return e?(e.className.match(t)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var o=(a=a||r.languages)[e],i={};for(var s in o)if(o.hasOwnProperty(s)){if(s==t)for(var l in n)n.hasOwnProperty(l)&&(i[l]=n[l]);n.hasOwnProperty(s)||(i[s]=o[s])}var u=a[e];return a[e]=i,r.languages.DFS(r.languages,(function(t,n){n===u&&t!=e&&(this[t]=i)})),i},DFS:function e(t,n,a,o){o=o||{};var i=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],a||s);var l=t[s],u=r.util.type(l);"Object"!==u||o[i(l)]?"Array"!==u||o[i(l)]||(o[i(l)]=!0,e(l,n,s,o)):(o[i(l)]=!0,e(l,n,null,o))}}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),r.hooks.run("before-all-elements-highlight",a);for(var o,i=0;o=a.elements[i++];)r.highlightElement(o,!0===t,a.callback)},highlightElement:function(n,a,o){var i=r.util.getLanguage(n),s=r.languages[i];n.className=n.className.replace(t,"").replace(/\s+/g," ")+" language-"+i;var l=n.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&(l.className=l.className.replace(t,"").replace(/\s+/g," ")+" language-"+i);var u={element:n,language:i,grammar:s,code:n.textContent};function c(e){u.highlightedCode=e,r.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r.hooks.run("after-highlight",u),r.hooks.run("complete",u),o&&o.call(u.element)}if(r.hooks.run("before-sanity-check",u),!u.code)return r.hooks.run("complete",u),void(o&&o.call(u.element));if(r.hooks.run("before-highlight",u),u.grammar)if(a&&e.Worker){var d=new Worker(r.filename);d.onmessage=function(e){c(e.data)},d.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else c(r.highlight(u.code,u.grammar,u.language));else c(r.util.encode(u.code))},highlight:function(e,t,n){var o={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",o),o.tokens=r.tokenize(o.code,o.grammar),r.hooks.run("after-tokenize",o),a.stringify(r.util.encode(o.tokens),o.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var u in n)t[u]=n[u];delete t.rest}var c=new i;return s(c,c.head,e),function e(t,n,i,u,c,d){for(var f in i)if(i.hasOwnProperty(f)&&i[f]){var m=i[f];m=Array.isArray(m)?m:[m];for(var h=0;h<m.length;++h){if(d&&d.cause==f+","+h)return;var p=m[h],g=p.inside,v=!!p.lookbehind,b=!!p.greedy,y=p.alias;if(b&&!p.pattern.global){var x=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,x+"g")}for(var w=p.pattern||p,E=u.next,_=c;E!==n.tail&&!(d&&_>=d.reach);_+=E.value.length,E=E.next){var S=E.value;if(n.length>t.length)return;if(!(S instanceof a)){var O,C=1;if(b){if(!(O=o(w,_,t,v)))break;var T=O.index,k=O.index+O[0].length,j=_;for(j+=E.value.length;T>=j;)E=E.next,j+=E.value.length;if(j-=E.value.length,_=j,E.value instanceof a)continue;for(var F=E;F!==n.tail&&(j<k||"string"==typeof F.value);F=F.next)C++,j+=F.value.length;C--,S=t.slice(_,j),O.index-=_}else if(!(O=o(w,0,S,v)))continue;T=O.index;var A=O[0],D=S.slice(0,T),P=S.slice(T+A.length),R=_+S.length;d&&R>d.reach&&(d.reach=R);var L=E.prev;D&&(L=s(n,L,D),_+=D.length),l(n,L,C);var M=new a(f,g?r.tokenize(A,g):A,y,A);E=s(n,L,M),P&&s(n,E,P),C>1&&e(t,n,i,E.prev,_,{cause:f+","+h,reach:R})}}}}}(e,c,t,c.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(c)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,o=0;a=n[o++];)a(t)}},Token:a};function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var o=a[1].length;a.index+=o,a[0]=a[0].slice(o)}return a}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function l(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}if(e.Prism=r,a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},i=t.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(o.classes,i):o.classes.push(i)),r.hooks.run("wrap",o);var s="";for(var l in o.attributes)s+=" "+l+'="'+(o.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+s+">"+o.content+"</"+o.tag+">"},!e.document)return e.addEventListener?(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,o=n.code,i=n.immediateClose;e.postMessage(r.highlight(o,r.languages[a],a)),i&&e.close()}),!1),r):r;var u=r.util.currentScript();function c(){r.manual||r.highlightAll()}if(u&&(r.filename=u.src,u.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var d=document.readyState;"loading"===d||"interactive"===d&&u&&u.defer?document.addEventListener("DOMContentLoaded",c):window.requestAnimationFrame?window.requestAnimationFrame(c):window.setTimeout(c,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=n),void 0!==t&&(t.Prism=n),n.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};a["language-"+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:a},n.languages.insertBefore("markup","cdata",o)}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:e.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},n.tag))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.markup.tag.addInlined("script","javascript"),n.languages.js=n.languages.javascript,function(){if("undefined"!=typeof self&&self.Prism&&self.document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=window.Prism,t={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},n='pre[data-src]:not([data-src-status="loaded"]):not([data-src-status="loading"])',r=/\blang(?:uage)?-([\w-]+)\b/i;e.hooks.add("before-highlightall",(function(e){e.selector+=", "+n})),e.hooks.add("before-sanity-check",(function(r){var a=r.element;if(a.matches(n)){r.code="",a.setAttribute("data-src-status","loading");var i=a.appendChild(document.createElement("CODE"));i.textContent="Loading…";var s=a.getAttribute("data-src"),l=r.language;if("none"===l){var u=(/\.(\w+)$/.exec(s)||[,"none"])[1];l=t[u]||u}o(i,l),o(a,l);var c=e.plugins.autoloader;c&&c.loadLanguages(l);var d=new XMLHttpRequest;d.open("GET",s,!0),d.onreadystatechange=function(){var t,n;4==d.readyState&&(d.status<400&&d.responseText?(a.setAttribute("data-src-status","loaded"),i.textContent=d.responseText,e.highlightElement(i)):(a.setAttribute("data-src-status","failed"),d.status>=400?i.textContent=(t=d.status,n=d.statusText,"✖ Error "+t+" while fetching file: "+n):i.textContent="✖ Error: File does not exist or is empty"))},d.send(null)}})),e.plugins.fileHighlight={highlight:function(t){for(var r,a=(t||document).querySelectorAll(n),o=0;r=a[o++];)e.highlightElement(r)}};var a=!1;e.fileHighlight=function(){a||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),a=!0),e.plugins.fileHighlight.highlight.apply(this,arguments)}}function o(e,t){var n=e.className;n=n.replace(r," ")+" language-"+t,e.className=n.replace(/\s+/g," ").trim()}}()}).call(this,n("fRV1"))},njmQ:function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return c}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("ERkP"),s=n("hsFx");function l(){var e=Object(i.useRef)(!0);return Object(i.useEffect)((function(){return function(){e.current=!1}}),[]),{mounted:e}}function u(e){void 0===e&&(e=250);var t=l().mounted,n=Object(i.useRef)({timeoutId:setTimeout((function(){})),debounce:function(r){clearTimeout(n.current.timeoutId),n.current.timeoutId=setTimeout((function(){t.current&&r()}),e)}});return n.current}function c(){var e=l().mounted,t=Object(i.useState)({loading:!1,error:null}),n=t[0],r=t[1];return{loading:n.loading,error:n.error,doWork:function(t,n){var i=void 0,l=function(){if(!e.current)throw"unmounted";var t=null==n?void 0:n();if(!Object(s.e)(i,t))throw"changedContext"},u=function(){var s=Object(o.a)(a.a.mark((function o(){var s;return a.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return i=null==n?void 0:n(),r({loading:!0,error:null}),!1,a.prev=3,a.prev=4,a.next=7,t(l);case 7:l(),r({loading:!1,error:null}),a.next=15;break;case 11:if(a.prev=11,a.t0=a.catch(4),"unmounted"===a.t0||"changedContext"===a.t0){a.next=15;break}throw a.t0;case 15:a.next=23;break;case 17:if(a.prev=17,a.t1=a.catch(3),!0,e.current){a.next=22;break}return a.abrupt("return");case 22:r({loading:!1,error:{message:null!==(s=a.t1.message)&&void 0!==s?s:"Unknown Error in doWork",error:a.t1,retryCallback:u}});case 23:case"end":return a.stop()}}),o,null,[[3,17],[4,11]])})));return function(){return s.apply(this,arguments)}}();Object(o.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()}}}},olhD:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return l}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("gptL"),s=function(e){return e.loading?a.a.createElement(o.h,null,a.a.createElement(o.a,{size:"large",color:i.c.colors.loader})):a.a.createElement(a.a.Fragment,null)},l=function(e){return e.loading?a.a.createElement(a.a.Fragment,null,a.a.createElement(o.a,{size:"small",color:i.c.colors.loader})):a.a.createElement(a.a.Fragment,null)}},oo7O:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n("fGyu"),a=n("VtSi"),o=n.n(a),i=(n("3yYM"),n("QsI/")),s=n("hsFx"),l=n("Ti7Q"),u=function(e){var t,n,a=e.speechService,u=e.maxAnswers,c=void 0===u?4:u,d=e.sectionSize,f=void 0===d?25:d,m=a,h=Object(l.a)(),p=Math.ceil(h.length/f),g={nextIndex:0,completedSectionKeys:[]},v=function(e){return""+e};return{load:(n=Object(i.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.load();case 2:(n=e.sent)&&(g=n);case 4:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)}),save:(t=Object(i.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.save(g);case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)}),getSections:function(){return Object(r.a)(new Array(p)).map((function(e,t){return{key:v(t),name:(n=t,"Spelling "+(n+1)),isComplete:g.completedSectionKeys.includes(v(t))};var n}))},gotoSection:function(e){var t=e.key,n=Number.parseInt(t,10);g.nextIndex=n*f,console.log("createSpellingProblemService gotoSection",{key:t,a:n,state:g})},getNextProblem:function(){g.nextIndex>=h.length&&(g.nextIndex=0);var e=g.nextIndex;g.nextIndex++;var t=h[e],n=t.word,a=c-1,o=Object(s.f)(Object(s.a)(t.mispellings)).slice(0,a),i=Object(s.f)([].concat(Object(r.a)(o.map((function(e){return{value:""+e,isCorrect:!1}}))),[{value:""+n,isCorrect:!0}])).map((function(e){return Object.assign({},e,{key:e.value})})),l=(e+1)%f==0,u=e===h.length-1;return{key:""+(e+1),question:"Word "+(e+1),onQuestion:function(){m.speak(n)},answers:i,sectionKey:v(Math.floor(e/f)),isLastOfSection:l,isLastOfSubject:u}},recordAnswer:function(e,t){t.isCorrect&&e.isLastOfSection&&g.completedSectionKeys.push(e.sectionKey)}}}},pVhY:function(e,t,n){"use strict";n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return u}));var r=n("fGyu"),a=n("ERkP"),o=n.n(a),i=n("DTYs"),s={mainView:{flexDirection:"row",flexWrap:"wrap",alignItems:"center"},mainView_column:{flexDirection:"column"},tabView:{flexDirection:"row",alignItems:"center",background:"#1e1e1e",padding:4,marginRight:1},tabView_selected:{flexDirection:"row",alignItems:"center",background:"#292a2d",padding:4,marginRight:1},tabText:{fontSize:14},tabText_selected:{fontSize:14,color:"#FFFF88"},headerTabView:{flexDirection:"row",alignItems:"center",padding:4,marginRight:1},headerTabText:{fontSize:14},moveButtonView:{minWidth:24,justifyContents:"center",alignItems:"center"}},l=function(e){var t=e.items,n=e.onChange,a=e.getLabel,i=e.getKey,s=e.selected,l=e.onSelect,c=e.onCreateNewItem,d=e.header,f=e.style;if(!n)return o.a.createElement(u,{items:t,getLabel:a,getKey:i,selected:s,onSelect:l,header:d,style:f});return o.a.createElement(u,{items:t,getLabel:a,getKey:i,selected:s,onSelect:l,onMove:function(e,a,o){if(!(o<0||o>t.length-1)){var i=Object(r.a)(t);i.splice(a,1),i.splice(o,0,e),n(i)}},onAdd:function(){var e=c();n([].concat(Object(r.a)(t),[e])),l(e)},onDelete:function(){var e=Object(r.a)(t.filter((function(e){return e!==s})));n(e),e.length>0&&l(e[0])},header:d,style:f})},u=function(e){var t=e.items,n=e.getLabel,r=e.getKey,l=e.selected,u=e.onSelect,c=e.onMove,d=e.onAdd,f=e.onDelete,m=e.header,h=e.style,p=Object(a.useState)("row"),g=p[0],v=p[1];return o.a.createElement(i.h,{style:"row"===g?s.mainView:s.mainView_column},!!m&&o.a.createElement(i.g,{onPress:function(){return v((function(e){return"row"===e?"column":"row"}))}},o.a.createElement(i.h,{style:s.headerTabView},o.a.createElement(i.e,{style:s.tabText},"row"===g?"↔ ":"↕ "),o.a.createElement(i.e,{style:s.headerTabText},""+m))),t.map((function(e,a){return o.a.createElement(i.h,{key:r(e,a),style:e===l?s.tabView_selected:s.tabView},"column"===g&&c&&o.a.createElement(o.a.Fragment,null,o.a.createElement(i.g,{onPress:function(){return c(e,a,a-1)}},o.a.createElement(i.h,{style:s.moveButtonView},o.a.createElement(i.e,{style:s.tabText},a<=0?" ":"⬆"))),o.a.createElement(i.g,{onPress:function(){return c(e,a,a+1)}},o.a.createElement(i.h,{style:s.moveButtonView},o.a.createElement(i.e,{style:s.tabText},a>=t.length-1?" ":"⬇")))),o.a.createElement(i.g,{style:{flex:1},onPress:function(){return u(e)}},o.a.createElement(i.h,null,o.a.createElement(i.e,{style:e===l?Object.assign({},s.tabText_selected,null==h?void 0:h.selectedTabText):Object.assign({},s.tabText)},""+n(e)))))})),o.a.createElement(i.h,{style:{flex:1,flexDirection:"row"}},d&&o.a.createElement(o.a.Fragment,null,o.a.createElement(i.g,{onPress:function(){return d()}},o.a.createElement(i.h,{style:s.tabView},o.a.createElement(i.e,{style:s.tabText},"➕ Add")))),o.a.createElement(i.h,{style:{flex:1}}),f&&o.a.createElement(i.g,{onPress:function(){return f()}},o.a.createElement(i.h,{style:s.tabView},o.a.createElement(i.e,{style:s.tabText},"❌ Delete")))))}},pjuZ:function(e,t){!function(e){var t=e.util.clone(e.languages.javascript);e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=/<\/?(?:[\w.:-]+(?:\s+(?:[\w.:$-]+(?:=(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s{'">=]+|\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}))?|\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}))*\s*\/?)?>/i,e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/i,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s'">]+)/i,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.insertBefore("inside","attr-name",{spread:{pattern:/\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}/,inside:{punctuation:/\.{3}|[{}.]/,"attr-value":/\w+/}}},e.languages.jsx.tag),e.languages.insertBefore("inside","attr-value",{script:{pattern:/=(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\})/i,inside:{"script-punctuation":{pattern:/^=(?={)/,alias:"punctuation"},rest:e.languages.jsx},alias:"language-javascript"}},e.languages.jsx.tag);var n=function e(t){return t?"string"==typeof t?t:"string"==typeof t.content?t.content:t.content.map(e).join(""):""};e.hooks.add("after-tokenize",(function(t){"jsx"!==t.language&&"tsx"!==t.language||function t(r){for(var a=[],o=0;o<r.length;o++){var i=r[o],s=!1;if("string"!=typeof i&&("tag"===i.type&&i.content[0]&&"tag"===i.content[0].type?"</"===i.content[0].content[0].content?a.length>0&&a[a.length-1].tagName===n(i.content[0].content[1])&&a.pop():"/>"===i.content[i.content.length-1].content||a.push({tagName:n(i.content[0].content[1]),openedBraces:0}):a.length>0&&"punctuation"===i.type&&"{"===i.content?a[a.length-1].openedBraces++:a.length>0&&a[a.length-1].openedBraces>0&&"punctuation"===i.type&&"}"===i.content?a[a.length-1].openedBraces--:s=!0),(s||"string"==typeof i)&&a.length>0&&0===a[a.length-1].openedBraces){var l=n(i);o<r.length-1&&("string"==typeof r[o+1]||"plain-text"===r[o+1].type)&&(l+=n(r[o+1]),r.splice(o+1,1)),o>0&&("string"==typeof r[o-1]||"plain-text"===r[o-1].type)&&(l=n(r[o-1])+l,r.splice(o-1,1),o--),r[o]=new e.Token("plain-text",l,null,l)}i.content&&"string"!=typeof i.content&&t(i.content)}}(t.tokens)}))}(Prism)},pzhj:function(e,t,n){"use strict";n.r(t),n.d(t,"EducationalGame_StarBlastSideways_Multiples",(function(){return y})),n.d(t,"EducationalGame_StarBlastSideways",(function(){return x}));var r=n("fGyu"),a=n("ERkP"),o=n.n(a),i=n("DTYs"),s=n("VtSi"),l=n.n(s),u=(n("3yYM"),n("QsI/")),c=n("hsFx"),d=function(e){var t=Object(a.useRef)({moveDirection:{x:0,y:0},buttons:e.buttons.map((function(n,r){return{isDown:!1,key:n.key,text:n.text,onPressIn:function(){t.current.buttons[r].isDown=!0,e.onPressStateChange(t.current)},onPressOut:function(){t.current.buttons[r].isDown=!1,e.onPressStateChange(t.current)}}}))});return o.a.createElement(m,Object.assign({},e,{onMovePressIn:function(n){var r=t.current;t.current.moveDirection={x:n.x?n.x:r.moveDirection.x,y:n.y?n.y:r.moveDirection.y},console.log("onMovePressIn",{dir:n,s:r,moveDirection:t.current.moveDirection}),e.onPressStateChange(t.current)},onMovePressOut:function(n){var r=t.current;t.current.moveDirection={x:n.x?0:r.moveDirection.x,y:n.y?0:r.moveDirection.y},e.onPressStateChange(t.current)},buttons:t.current.buttons}))},f={container:{flex:1,alignSelf:"stretch",flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:4},section:{justifyContent:"center",alignItems:"center",padding:4},moveSectionWrapper:{overflow:"hidden"},moveSectionRotation:{transform:"rotate(0.125turn)",margin:0},row:{flexDirection:"row"},cellTouch:{outline:"none"},cellView:{pointerEvents:"none",position:"relative",margin:4,width:56,height:56,justifyContent:"center",alignItems:"center",borderWidth:0,borderStyle:"solid",outline:"none"},cellText:{userSelect:"none",pointerEvents:"none"},moveCellText:{userSelect:"none",pointerEvents:"none",transform:"rotate(-0.125turn)"},cellEmptyView:{margin:2,width:56,height:56},cellTextOcclusionView:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:"red",opacity:0}},m=function(e){var t=e.onMovePressIn,n=e.onMovePressOut,r=Object.assign({},f.cellView,e.style);Object(a.useEffect)((function(){var r=function(e){var t;return e.preventDefault(),null===(t=e.stopPropagation)||void 0===t||t.call(e),!1};if("web"===i.c.OS){var a=function(n){return"ArrowUp"===n.key?(t({x:0,y:1}),r(n)):"ArrowDown"===n.key?(t({x:0,y:-1}),r(n)):"ArrowLeft"===n.key?(t({x:-1,y:0}),r(n)):"ArrowRight"===n.key?(t({x:1,y:0}),r(n)):" "!==n.key||(null===(a=e.buttons[0])||void 0===a||a.onPressIn(),r(n));var a},o=function(t){return"ArrowUp"===t.key?(n({x:0,y:1}),r(t)):"ArrowDown"===t.key?(n({x:0,y:-1}),r(t)):"ArrowLeft"===t.key?(n({x:-1,y:0}),r(t)):"ArrowRight"===t.key?(n({x:1,y:0}),r(t)):" "!==t.key||(null===(a=e.buttons[0])||void 0===a||a.onPressOut(),r(t));var a};return window.addEventListener("keydown",a),window.addEventListener("keyup",o),function(){window.removeEventListener("keydown",a),window.removeEventListener("keyup",o)}}return function(){}}));var s=function(e){var a=e.text,s=e.direction;return o.a.createElement(i.d,{style:f.cellTouch,onPressIn:function(){return t(s)},onPressOut:function(){return n(s)}},o.a.createElement(i.h,{style:r},o.a.createElement(i.e,{style:f.moveCellText},a),o.a.createElement(i.h,{style:f.cellTextOcclusionView})))},l=function(e){var t=e.text,n=e.onPressIn,a=e.onPressOut;return o.a.createElement(i.d,{style:f.cellTouch,onPressIn:n,onPressOut:a},o.a.createElement(i.h,{style:r},o.a.createElement(i.e,{style:f.cellText},t),o.a.createElement(i.h,{style:f.cellTextOcclusionView})))};return o.a.createElement(i.h,{style:f.container},o.a.createElement(i.h,{style:f.moveSectionWrapper},o.a.createElement(i.h,{style:f.moveSectionRotation},o.a.createElement(i.h,{style:f.section},o.a.createElement(i.h,{style:f.row},o.a.createElement(s,{direction:{x:0,y:1},text:"⬆"}),o.a.createElement(s,{direction:{x:1,y:0},text:"➡"})),o.a.createElement(i.h,{style:f.row},o.a.createElement(s,{direction:{x:-1,y:0},text:"⬅"}),o.a.createElement(s,{direction:{x:0,y:-1},text:"⬇"}))))),o.a.createElement(i.h,{style:f.section},o.a.createElement(i.h,{style:f.row},e.buttons.map((function(e){return o.a.createElement(o.a.Fragment,{key:""+e.text},o.a.createElement(i.h,{style:f.cellEmptyView}),o.a.createElement(l,e))})))))},h=function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r},p=n("9u8u"),g=n("7h3R"),v=n("yyXn"),b=n("yxiS"),y=function(e){return o.a.createElement(x,{problemService:Object(v.a)(Object(p.a)((t={min:1,max:12},i=t.min,s=void 0===i?1:i,d=t.max,f=void 0===d?12:d,m=t.maxAnswers,h=void 0===m?4:m,g={n:s-1,m:s,completedSectionKeys:[]},b=function(e){return""+e},{load:(a=Object(u.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.load();case 2:(n=e.sent)&&(g=n);case 4:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)}),save:(n=Object(u.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.save(g);case 2:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)}),getSections:function(){return Object(r.a)(new Array(f-s+1)).map((function(e,t){return{key:b(t+s),name:(n=t+s,"Multiples of "+n),isComplete:g.completedSectionKeys.includes(b(t+s))};var n}))},gotoSection:function(e){var t=e.key,n=Number.parseInt(t,10);g.m=n,g.n=s-1},getNextProblem:function(){g.n++,g.n>f&&(g.n=s,g.m++,g.m>f&&(g.n=s,g.m=s));var e=g,t=e.n,n=e.m,a=t*n,o=h-1,i=Object(c.a)(Object(r.a)(new Array(100)).map((function(){return Math.round(t+1-2*Math.random())*Math.round(n+1-2*Math.random())+Math.round(2-4*Math.random())})).filter((function(e){return e!==a})).filter((function(e){return e>0}))).slice(0,o),l=Object(c.f)([].concat(Object(r.a)(i.map((function(e){return{value:""+e,isCorrect:!1}}))),[{value:""+a,isCorrect:!0}])).map((function(e){return Object.assign({},e,{key:e.value})}));return{key:n+" x "+t,question:n+" x "+t,answers:l,sectionKey:b(n),isLastOfSection:t===f,isLastOfSubject:t===f&&n===f}},recordAnswer:function(e,t){t.isCorrect&&e.isLastOfSection&&g.completedSectionKeys.push(e.sectionKey)}}),{}),"ProblemsMultiples")});var t,n,a,i,s,d,f,m,h,g,b},x=function(e){return o.a.createElement(w,{problemService:Object(g.createProgressGameProblemService)(e.problemService)})},w=function(e){var t=Object(a.useState)({paused:!1}),n=t[0],r=t[1],s=Object(a.useState)({moveDirection:{x:0,y:0},buttons:[]}),l=s[0],u=s[1],c=Object(a.useState)(0),f=c[0],m=c[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.h,null,o.a.createElement(i.h,{style:{alignItems:"center",alignSelf:"stretch"}},o.a.createElement(i.h,{style:{overflow:"hidden",padding:10,paddingTop:4,paddingBottom:64}},o.a.createElement(i.h,{style:{position:"relative"}},o.a.createElement(S,{pressState:l,pauseState:n,problemService:e.problemService,problemSourceKey:""+f}),o.a.createElement(i.h,{style:{zIndex:10,flex:1,alignSelf:"stretch"}},o.a.createElement(d,{style:E.gamepad,onPressStateChange:function(e){u(e)},buttons:[{key:"A",text:"🔥"}]}))))),o.a.createElement(b.a,{problemService:e.problemService,onOpen:function(){return r({paused:!0})},onClose:function(){return r({paused:!1})},onSubjectNavigation:function(){r({paused:!1}),m((function(e){return e+1}))}})))},E={gamepad:{backgroundColor:"#333333",borderColor:"#000033"},viewscreen:{borderColor:"#000033",backgroundColor:"#000000"}},_={directAnswerButtonContainer:{alignSelf:"flex-end",justifyContent:"space-around",height:250,padding:4},directAnswerButton:{width:40,height:40,backgroundColor:"#FFFFFF",opacity:.1},directAnswerButton_hidden:{width:40,height:40},viewscreenView:{height:300,width:300,backgroundColor:E.viewscreen.backgroundColor,borderColor:E.viewscreen.borderColor,borderWidth:1,borderStyle:"solid"},sprite:{viewSize:{width:32,height:32},text:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:32,textAlign:"center"}},answer:{text:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:24,fontSize_small:14,textAlign:"center",whiteSpace:"pre-wrap"}},question:{view:{flex:1,justifyContent:"center",padding:4},text:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:24,fontSize_small:14,whiteSpace:"pre-wrap"}},gameOver:{view:{flex:1,justifyContent:"center",padding:4},text:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:24,textAlign:"center"}}},S=function(e){var t,n,s,l,u,c,d,f=Object(a.useRef)(e.pressState);f.current=e.pressState;var m=Object(a.useRef)(e.pauseState);m.current=e.pauseState;var h=function(){return{lastActualTimeMs:Date.now(),lastGameTime:0,gameSpeed:1,lives:3,score:0}},p=Object(a.useRef)(h()),g=function(){var e=Date.now(),t=(e-p.current.lastActualTimeMs)/1e3;if(p.current.lastActualTimeMs=e,0===t)return{gameTime:p.current.lastGameTime};t>.1&&(t=.1);var n=t*p.current.gameSpeed,r=p.current.lastGameTime+n;return p.current.lastGameTime=r,{gameTime:r}},v=Object(a.useRef)({y:.5*_.viewscreenView.height,x:.15*_.viewscreenView.width,rotation:0}),b=Object(a.useRef)({lastShotActualTime:0,shots:[],debris:[]}),y=Object(a.useRef)({enemies:[]}),x=Object(a.useRef)(null),w=Object(a.useState)(0),E=(w[0],w[1]),S=function(){y.current.enemies.forEach((function(e){e.pos.x+=.5*_.viewscreenView.width})),v.current.y=.5*_.viewscreenView.height,v.current.x=.15*_.viewscreenView.width,p.current=Object.assign({},h(),{lastGameTime:p.current.lastGameTime})};Object(a.useEffect)((function(){!function t(){var n=e.problemService.getNextProblem();if(console.log("gotoNextProblem",{p:n}),n.question){var r=_.viewscreenView.width/(n.answers.length+1),a={problemTime:g().gameTime,question:n.question,answers:n.answers.map((function(e,t){return Object.assign({},e,{key:n.question+" "+e.value,pos:{y:r*(.5+t),x:_.viewscreenView.width-.5*_.sprite.viewSize.width,rotation:0},isAnsweredWrong:!1})}))},o={enemies:a.answers.map((function(a,o){var i={key:n.question+" "+a.value,answer:a,pos:{y:r*(.5+o),x:_.viewscreenView.width-1.5*_.sprite.viewSize.width,rotation:0},vel:{x:-5,y:0},onHit:function(){setTimeout((function(){console.log("onHit",{ans:a}),e.problemService.recordAnswer(n,a),a.isCorrect?(b.current.shots.forEach((function(e){e.ignore=!0})),t(),p.current=Object.assign({},p.current,{score:p.current.score+=1e3*Math.floor(i.pos.x),gameSpeed:Math.min(5,1*p.current.gameSpeed+.1)})):(a.isAnsweredWrong=!0,p.current=Object.assign({},p.current,{score:p.current.score-=1500*Math.floor(i.pos.x),gameSpeed:Math.max(.5,1*p.current.gameSpeed-.2)}))}))},destroyed:!1};return i}))};x.current=a,y.current=o,E((function(e){return e+1})),setTimeout((function(){var e;null===(e=n.onQuestion)||void 0===e||e.call(n)}),250)}}()}),[e.problemSourceKey]),Object(a.useEffect)((function(){var e=g().gameTime;requestAnimationFrame((function t(){var n,r=g().gameTime,a=r-e;if(e=r,m.current.paused||a<=0)requestAnimationFrame(t);else{var o=function(){return{gameTime:r,gameDeltaTime:a,gameState:p.current,pressState:f.current,playerPosition:v.current,projectilesState:b.current,enemiesState:y.current,onLoseLife:function(){p.current.deadTime||p.current.gameOverTime||(b.current.debris.push({key:"player"+r,kind:"player-character",pos:Object.assign({},v.current),vel:{x:0,y:0}}),p.current.lives<=1?p.current=Object.assign({},p.current,{lives:0,gameOverTime:g().gameTime}):p.current=Object.assign({},p.current,{lives:p.current.lives-1,deadTime:r}))}}},i=O(o());if(p.current=i,p.current.gameOverTime)g().gameTime>1+p.current.gameOverTime&&null!==(n=f.current.buttons[0])&&void 0!==n&&n.isDown&&setTimeout((function(){S()}),250);else{var s=C(o());v.current=s.playerPosition}var l=T(o());b.current=l;var u=k(o());y.current=u,requestAnimationFrame(t),E((function(e){return e+1}))}}))}),[]);var A=g().gameTime-(null!==(t=null===(n=x.current)||void 0===n?void 0:n.problemTime)&&void 0!==t?t:0);return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.h,{style:_.viewscreenView},Object(r.a)(new Array(p.current.lives)).map((function(e,t){return o.a.createElement(j,{key:"life"+t,kind:"life",position:{x:_.viewscreenView.width-_.sprite.viewSize.width*(1+t),y:_.viewscreenView.height-.5*_.sprite.viewSize.height,rotation:0}})})),b.current.debris.map((function(e){return o.a.createElement(j,{key:e.key,kind:e.hasHitGround?e.kind+"-splat":e.kind,position:e.pos})})),null===(s=y.current)||void 0===s?void 0:s.enemies.filter((function(e){return!e.destroyed})).map((function(e){return o.a.createElement(o.a.Fragment,{key:e.key},!e.answer.isAnsweredWrong&&o.a.createElement(F,{position:{y:e.pos.y,x:e.pos.x+_.sprite.viewSize.width,rotation:0},text:e.answer.value}),e.answer.isAnsweredWrong&&o.a.createElement(j,{kind:"answer-wrong",position:{y:e.pos.y,x:e.pos.x+_.sprite.viewSize.width,rotation:0}}))})),null===(l=y.current)||void 0===l?void 0:l.enemies.filter((function(e){return!e.destroyed})).map((function(e){var t;return o.a.createElement(o.a.Fragment,{key:e.key},o.a.createElement(j,{kind:e.explodeTime?"enemy-explode":"enemy",position:e.pos}),e===(null===(t=p.current.weaponsLock)||void 0===t?void 0:t.lockedEnemy)&&o.a.createElement(j,{kind:"lock",position:e.pos}))})),!p.current.gameOverTime&&!p.current.deadTime&&o.a.createElement(j,{kind:"player",position:v.current}),b.current.shots.map((function(e){return o.a.createElement(j,{key:e.key,kind:e.explodeTime?"shot-explode":"shot",position:e.pos})})),p.current.gameOverTime&&o.a.createElement(i.h,null,o.a.createElement(i.h,{style:{position:"absolute",top:.5*_.viewscreenView.height,width:_.viewscreenView.width}},o.a.createElement(i.e,{style:_.gameOver.text},"Game Over"),g().gameTime>1+p.current.gameOverTime&&o.a.createElement(i.e,{style:_.gameOver.text},"Continue?"))),o.a.createElement(i.h,{style:_.directAnswerButtonContainer},null===(u=y.current)||void 0===u?void 0:u.enemies.map((function(e){return o.a.createElement(i.g,{key:e.key,onPress:function(){return function(e){if(p.current.gameOverTime)S();else if(!p.current.deadTime&&!e.destroyed&&!e.explodeTime){p.current.weaponsLock={lockedEnemy:e,lockedAtPlayerPosition:v.current};var t=b.current.shots;t.push({key:""+g()+t.length,pos:Object.assign({},v.current),lockedEnemy:e}),p.current.playerTargetPosition={x:v.current.x,y:e.pos.y}}}(e)}},o.a.createElement(i.h,{style:e.destroyed||e.explodeTime?_.directAnswerButton_hidden:_.directAnswerButton}))})))),o.a.createElement(i.h,{style:{position:"relative",height:3*_.question.text.fontSize,alignSelf:"stretch"}},o.a.createElement(F,{text:null!==(c=null===(d=x.current)||void 0===d?void 0:d.question)&&void 0!==c?c:"",position:{x:.25*_.viewscreenView.width,y:1*_.question.text.fontSize-Math.max(0,.5*_.viewscreenView.height-125*A),rotation:0}})))},O=function(e){var t=e.gameTime,n=(e.gameDeltaTime,e.pressState,e.playerPosition),r=e.gameState,a=e.enemiesState;return r.deadTime&&t>3+r.deadTime?(n.y=.5*_.viewscreenView.height,n.x=.15*_.viewscreenView.width,a.enemies.forEach((function(e){e.pos.x+=.5*_.viewscreenView.width})),Object.assign({},r,{deadTime:void 0})):r},C=function(e){e.gameTime;var t=e.gameDeltaTime,n=e.pressState,r=e.playerPosition,a=e.gameState;if(a.deadTime)return{playerPosition:r};var o=n.moveDirection,i=a.playerTargetPosition,s=o.x||o.y?{x:o.x,y:-o.y}:i?{x:i.x-r.x,y:i.y-r.y}:{x:0,y:0};s.x=0===s.x?0:Math.sign(s.x),s.y=0===s.y?0:Math.sign(s.y),a.playerTargetPosition&&console.log("updatePlayer",{dirPress:o,dir:s,targetPos:i,playerPosition:r}),(o.x||o.y)&&(a.playerTargetPosition=void 0),a.playerTargetPosition&&h(r,a.playerTargetPosition)<25&&(a.playerTargetPosition=void 0);var l=.05*s.y,u={x:r.x+s.x*t*250,y:r.y+s.y*t*250,rotation:.9*r.rotation+.1*l},c=_.viewscreenView.width,d=.5*_.sprite.viewSize.width,f=_.viewscreenView.height,m=.5*_.sprite.viewSize.height;return u.x=u.x<d?d:u.x>c-d?c-d:u.x,u.y=u.y<m?m:u.y>f-m?f-m:u.y,{playerPosition:u}},T=function(e){var t,n=e.gameTime,r=e.gameDeltaTime,a=e.pressState,o=e.playerPosition,i=(e.enemiesState,e.projectilesState),s=e.gameState,l=e.onLoseLife,u=i.shots,c=i.debris,d=i.lastShotActualTime,f=!s.deadTime&&!s.gameOverTime&&Date.now()/1e3>.25+d&&(null===(t=a.buttons.find((function(e){return"A"===e.key})))||void 0===t?void 0:t.isDown);if(f){var m,h=null===(m=s.weaponsLock)||void 0===m?void 0:m.lockedEnemy;u.push({key:""+n+u.length,pos:Object.assign({},o),lockedEnemy:h})}u.forEach((function(e){e.explodeTime||(!e.lockedEnemy||e.lockedEnemy.explodeTime||e.lockedEnemy.destoyed?e.pos.x+=250*r:(e.pos.y+=.25*(e.lockedEnemy.pos.y-e.pos.y),e.pos.x+=Math.min(250*r,.5*(e.lockedEnemy.pos.x-e.pos.x))))})),c.forEach((function(e){if(!e.hasHitGround){e.vel.y+=100*r,e.pos.y+=e.vel.y*r,e.pos.x+=e.vel.x*r;var t=.5*_.sprite.viewSize.width,n=_.viewscreenView.width;e.pos.x<t&&(e.pos.x=t,e.vel.x=-e.vel.x),e.pos.x>n-t&&(e.pos.x=n-t,e.vel.x=-e.vel.x);var a=.8*_.sprite.viewSize.width,o=_.viewscreenView.height;e.pos.y>o-a+10*Math.random()&&(e.hasHitGround=!0,"kitten"===e.kind&&l())}})),c.length>25&&c.shift();var p=u.filter((function(e){return e.pos.x<_.viewscreenView.width})).filter((function(e){return!e.explodeTime||n<1+e.explodeTime}));return Object.assign({},i,{lastShotActualTime:f?Date.now()/1e3:d,shots:p})},k=function(e){var t=e.gameTime,n=e.gameDeltaTime,r=e.projectilesState,a=e.enemiesState,o=e.gameState,i=e.playerPosition,s=e.onLoseLife,l=a.enemies,u=r.shots,c=.75*_.sprite.viewSize.width,d=c*c;l.forEach((function(e){return u.forEach((function(n){e.explodeTime||n.explodeTime||n.ignore||n.lockedEnemy&&n.lockedEnemy!==e||h(e.pos,n.pos)<d&&(console.log("Exploded!",{e:e,s:n}),e.explodeTime=t,n.explodeTime=t,e.onHit(),e.answer.isCorrect?r.debris.push({key:e.key+" "+t,kind:"alien",pos:Object.assign({},e.pos),vel:Object.assign({},e.vel)}):r.debris.push({key:e.key+" "+t,kind:"kitten",pos:Object.assign({},e.pos),vel:Object.assign({},e.vel)}))}))}));var f=c*c*1.5*1.5;l.forEach((function(e,t){return l.forEach((function(r,a){if(!(t>=a)&&!e.explodeTime&&!r.explodeTime&&h(e.pos,r.pos)<f){var o=e.vel.y;e.vel.y=.95*r.vel.y,r.vel.y=.95*o;var i=e.pos.y<r.pos.y?e:r,s=e.pos.y<r.pos.y?r:e;i.pos.y-=10*n,s.pos.y+=10*n,i.vel.y-=10*n,s.vel.y+=10*n}}))}));var m=c*c*.8*.8;l.forEach((function(e,t){e.explodeTime||o.deadTime||o.gameOverTime||h(e.pos,i)<m&&s()})),l.forEach((function(e){if(!e.explodeTime){e.vel.y+=250*(2*Math.random()-1)*n,o.deadTime||o.gameOverTime?e.vel.x=0:e.vel.x=-25,e.pos.y>.7*_.viewscreenView.height&&(e.vel.y=-5),e.pos.x>_.viewscreenView.width-2*_.sprite.viewSize.width&&(e.pos.x=_.viewscreenView.width-2*_.sprite.viewSize.width),e.pos.x+=e.vel.x*n,e.pos.y+=e.vel.y*n;var t=.5*_.sprite.viewSize.height,r=_.viewscreenView.height;e.pos.y<t&&(e.pos.y=t,e.vel.y=5),e.pos.y>r-t&&(e.pos.y=r-t,e.vel.y=-e.vel.y);var a=.5*_.sprite.viewSize.width;e.pos.x<a&&(e.pos.x=a)}}));var p,g,v=a.enemies.filter((function(e){return!e.explodeTime&&!e.destroyed})).sort((function(e,t){return Math.abs(e.pos.y-i.y)<Math.abs(t.pos.y-i.y)?-1:1}))[0];(null==v?void 0:v.pos.x)<i.x+.5*_.sprite.viewSize.width?v.pos.y=i.y:(p=v,(null===(g=o.weaponsLock)||void 0===g?void 0:g.lockedAtPlayerPosition.y)!==i.y&&(o.weaponsLock={lockedAtPlayerPosition:i,lockedEnemy:p}));var b=l;return b.filter((function(e){return e.explodeTime&&t>1+e.explodeTime})).forEach((function(e){e.destroyed=!0})),{enemies:b}},j=function(e){var t,n,r,a,s,l=e.kind,u=e.position,c=e.text,d=function(e){switch(e){case"player":return{text:"🚀",rotation:.125,offsetX:0,offsetY:-.25};case"player-character":return{text:"😭"};case"player-character-splat":return{text:"😫",rotation:.15};case"shot":return{text:"🔥",rotation:-.25};case"shot-explode":return{text:"✨",rotation:0,scale:.5};case"lock":return{text:"💢",offsetX:-.25,offsetY:-.125,scale:1.5};case"enemy":return{text:"🛸",offsetX:-.125,offsetY:-.125};case"enemy-explode":return{text:"💥",offsetX:-.125,offsetY:-.125};case"answer-wrong":return{text:"❌",offsetX:-.125,offsetY:-.125};case"alien":return{text:"👽",offsetX:0,offsetY:0};case"kitten":return{text:"🙀",offsetX:0,offsetY:0};case"alien-splat":return{text:"💀",offsetX:0,offsetY:0};case"kitten-splat":return{text:"🥩",offsetX:0,offsetY:0};case"super-kitten":return{text:"🐱‍🏍",offsetX:0,offsetY:0};case"life":return{text:"🚀",scale:.5};case"text":return{text:"",offsetX:0,offsetY:-.125};default:return{text:"😀"}}}(l),f=_.sprite.viewSize,m=_.sprite.text.fontSize,h=Object.assign({position:"absolute"},f,{transform:"translate("+u.x+"px, "+u.y+"px) rotate("+(null!==(t=u.rotation)&&void 0!==t?t:0)+"turn)",pointerEvents:"none"}),p=Object.assign({},f,{transform:"translate( "+(-.5*f.width+Math.floor((null!==(n=d.offsetX)&&void 0!==n?n:0)*m))+"px, "+(-.5*f.height+Math.floor((null!==(r=d.offsetY)&&void 0!==r?r:0)*m))+"px) rotate("+(null!==(a=d.rotation)&&void 0!==a?a:0)+"turn) scale("+(null!==(s=d.scale)&&void 0!==s?s:1)+")"});return o.a.createElement(i.h,{style:h},o.a.createElement(i.h,{style:p},o.a.createElement(i.e,{style:_.sprite.text},null!=c?c:d.text)))},F=function(e){var t,n=e.text,r=e.position,a=_.answer.text,s=n.length>10?a.fontSize_small:a.fontSize,l=.5*-s-4,u={position:"absolute",transform:"translate("+r.x+"px, "+(r.y+l)+"px) rotate("+(null!==(t=r.rotation)&&void 0!==t?t:0)+"turn)",pointerEvents:"none",maxWidth:.5*_.viewscreenView.width};return o.a.createElement(i.h,{style:u},o.a.createElement(i.e,{style:Object.assign({},_.answer.text,{fontSize:s})},n))}},qVe0:function(e,t,n){"use strict";n.d(t,"b",(function(){return h})),n.d(t,"a",(function(){return p})),n.d(t,"c",(function(){return v}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("PyWT"),s=n("Ig+6"),l=(n("xrQq"),n("kNg/"),n("fGyu")),u=n("hsFx"),c={rows:[{keys:"qwertyuiop".split("")},{keys:" asdfghjkl".split("")},{keys:"  zxcvbnm ".split("")}]},d={container:{},rowView:{flex:1,flexDirection:"row"},keyView:{margin:2,padding:2,flex:1,height:20,backgroundColor:"#111111",justifyContent:"center",alignItems:"center"},keyView_disabled:{opacity:.5},keyText:{fontSize:16},keyText_wrong:{fontSize:16,color:"#FF0000"}},f=function(e){var t=e.expectedCharacter,n=e.showHints,i=e.onExpectedKeyPress,s=c,f=Object(r.useState)(null),m=f[0],h=f[1],p=Object(r.useState)([]),g=p[0],v=p[1];Object(r.useEffect)((function(){n||h(null);var e=[t].concat(Object(l.a)(Object(u.f)(s.rows.flatMap((function(e){return e.keys})).map((function(e){return e.trim()})).filter((function(e){return e}))).slice(0,3)));h(e),v([])}),[t,n]);return a.a.createElement(a.a.Fragment,null,a.a.createElement(o.h,{style:d.container},s.rows.map((function(e,r){return a.a.createElement(o.h,{style:d.rowView,key:""+r},e.keys.map((function(e,r){return a.a.createElement(o.g,{key:""+e+r,style:{outline:"none"},onPress:function(){var r;(r=e)!==t?n&&(h((function(e){return(null!=e?e:[]).filter((function(e){return e!==r}))})),v((function(e){return[].concat(Object(l.a)(e),[r])}))):i()}},a.a.createElement(o.h,{style:!m||m.includes(e)?{}:d.keyView_disabled},a.a.createElement(o.h,{style:d.keyView},a.a.createElement(o.e,{style:g.includes(e)?d.keyText_wrong:d.keyText},e))))})))}))))},m={container:{alignItems:"center"},drawing:{width:312,height:312,color:"#FFFFFF",backgroundColor:"#000000"},drawingChoicesView:{maxWidth:332,flexDirection:"row",flexWrap:"wrap"},drawingChoiceWrapper:{padding:4},drawingChoice:{width:78,height:78,color:"#FFFFFF",backgroundColor:"#000000"},titleView:{justifyContent:"center",alignItems:"center"},titleText:{fontSize:20,color:"#FFFFFF"},promptView:{justifyContent:"center",alignItems:"center"},promptText:{fontSize:20,color:"#FFFF00"},hintText:{fontSize:14,color:"#FFFF00"},buttonRowView:{flexDirection:"row"},buttonView:{margin:4,padding:8,backgroundColor:"#111111"},buttonText:{fontSize:20,color:"#FFFF00"}},h=function(e){var t=Object(r.useState)(Object(i.b)()),n=t[0],l=t[1];return Object(r.useEffect)((function(){l(Object(i.b)())}),[e.prompt]),a.a.createElement(o.h,{style:m.container},a.a.createElement(o.h,{style:m.titleView},a.a.createElement(o.e,{style:m.titleText},"Draw")),a.a.createElement(s.DoodleDrawerView,{style:m.drawing,drawing:n,onChange:function(e){l(e)}}),a.a.createElement(o.h,{style:m.promptView},a.a.createElement(o.e,{style:m.promptText},e.prompt),!!e.hint&&a.a.createElement(o.e,{style:m.hintText},e.hint)),a.a.createElement(o.h,{style:m.buttonRowView},!!e.onSkip&&a.a.createElement(o.g,{onPress:function(){var t;null===(t=e.onSkip)||void 0===t||t.call(e)}},a.a.createElement(o.h,{style:m.buttonView},a.a.createElement(o.e,{style:m.buttonText},"Skip"))),a.a.createElement(o.g,{onPress:function(){e.onDone(n)}},a.a.createElement(o.h,{style:m.buttonView},a.a.createElement(o.e,{style:m.buttonText},"Done")))))},p=function(e){return a.a.createElement(o.h,{style:m.container},a.a.createElement(o.h,{style:m.titleView},a.a.createElement(o.e,{style:m.titleText},"Choose Best")),a.a.createElement(o.h,{style:m.promptView},a.a.createElement(o.e,{style:m.promptText},e.prompt)),a.a.createElement(o.h,{style:m.drawingChoicesView},e.drawings.map((function(t){return a.a.createElement(o.g,{key:t.key,onPress:function(){return e.onChooseBest(t)}},a.a.createElement(o.h,{style:m.drawingChoiceWrapper},a.a.createElement(s.DoodleDisplayView,{style:m.drawingChoice,drawing:t.drawing})))}))))},g={completedText:{fontSize:16,color:"#FFFF00"}},v=function(e){var t,n=Object(r.useState)({completed:"",remaining:e.prompt}),i=n[0],l=n[1];Object(r.useEffect)((function(){l({completed:"",remaining:e.prompt})}),[e.prompt,e.drawings]);return a.a.createElement(o.h,{style:m.container},a.a.createElement(o.h,{style:m.titleView},a.a.createElement(o.e,{style:m.titleText},"Type Word")),a.a.createElement(o.h,{style:m.drawingChoicesView},e.drawings.map((function(e){return a.a.createElement(o.h,{key:e.key,style:m.drawingChoiceWrapper},a.a.createElement(s.DoodleDisplayView,{style:m.drawingChoice,drawing:e.drawing}))}))),a.a.createElement(o.g,{onPress:e.sayAgain},a.a.createElement(o.h,{style:m.buttonView},a.a.createElement(o.e,{style:m.buttonText},"Say Again"))),a.a.createElement(o.h,null,a.a.createElement(o.e,{style:g.completedText},i.completed+(i.remaining.length>0?"_":""))),a.a.createElement(f,{expectedCharacter:null!==(t=i.remaining[0])&&void 0!==t?t:" ",showHints:!0,onExpectedKeyPress:function(){l((function(t){t.remaining.length<=1&&e.onDone();var n=t.remaining[0];return{completed:t.completed+n,remaining:t.remaining.substr(1)}}))}}))}},rTbz:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=function(e){var t={saveScore:function(n,r){var a=t.loadScore();a.push({name:n,score:r}),a.sort((function(t,n){return e.sortKey(t.score)<e.sortKey(n.score)?-1:1})),localStorage.setItem(e.storageKey,JSON.stringify(a))},loadScore:function(){var t=localStorage.getItem(e.storageKey);if(!t)return[];var n=JSON.parse(t);return n.sort((function(t,n){return(e.sortKey(t.score)>e.sortKey(n.score)?-1:1)*(e.sortDescending?-1:1)})),n}},n={container:{flex:1,alignItems:"center",margin:16},textInput:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#0000FF"},buttonView:{margin:4,padding:4,borderColor:"#FFFF00",borderStyle:"solid",borderWidth:1,borderRadius:4},buttonText:{fontFamily:'"Lucida Console", Monaco, monospace',fontSize:16,color:"#FFFF00"}},i=function(e){var t=Object(r.useState)(""),i=t[0],s=t[1];return a.a.createElement(o.h,{style:n.container},a.a.createElement(o.f,{style:n.textInput,value:i,onChange:s,placeholder:"Name",keyboardType:"default",autoCompleteType:"off"}),a.a.createElement(o.g,{onPress:function(){return!!i&&e.onSubmit(i)},style:i?{}:{opacity:.5}},a.a.createElement(o.h,{style:n.buttonView},a.a.createElement(o.e,{style:n.buttonText},"Save Score"))))},s={container:{marginTop:16,borderColor:"#FFFFFF",borderStyle:"solid",borderWidth:1,borderRadius:0},scoreView:{flexDirection:"row",justifyContent:"space-around",padding:4,borderColor:"#FFFFFF",borderStyle:"solid",borderWidth:1,borderRadius:0},nameText:{flex:2,fontFamily:'"Lucida Console", Monaco, monospace',fontSize:12,color:"#FFFFFF",overflow:"hidden"},scoreText:{flex:1,textAlign:"right",fontFamily:'"Lucida Console", Monaco, monospace',fontSize:12,color:"#FFFF00"}},l=function(t){return a.a.createElement(o.h,{style:s.container},a.a.createElement(o.h,{style:s.scoreView},a.a.createElement(o.e,{style:s.nameText},"Leaderboard"),e.scoreColumns.map((function(e){return a.a.createElement(o.e,{key:e.name,style:s.scoreText})}))),a.a.createElement(o.h,{style:s.scoreView},a.a.createElement(o.e,{style:s.nameText},"Name"),e.scoreColumns.map((function(e){return a.a.createElement(o.e,{key:e.name,style:s.scoreText},e.name)}))),t.scores.map((function(t){return a.a.createElement(o.h,{style:s.scoreView},a.a.createElement(o.e,{style:s.nameText},t.name),e.scoreColumns.map((function(e){return a.a.createElement(o.e,{key:t.name,style:s.scoreText},e.getValue(t.score))})))})))};return{useLeaderboard:function(e){var n=e.getScore,o=Object(r.useState)({scores:t.loadScore()}),s=o[0],u=o[1];return{LeaderboardArea:function(e){return a.a.createElement(a.a.Fragment,null,!!e.gameOver&&a.a.createElement(i,{onSubmit:function(r){t.saveScore(r,n()),u({scores:t.loadScore()}),e.onScoreSaved()}}),a.a.createElement(l,{scores:s.scores}))}}}}}},rrTw:function(e,t,n){"use strict";n.r(t),n.d(t,"UserProfileManagerView",(function(){return p})),n.d(t,"UserProfileName",(function(){return b}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("ERkP"),s=n.n(i),l=n("DTYs"),u=n("njmQ"),c=n("bQih"),d=n("gLDK"),f=n("5UfP"),m=n("z7rP"),h="\n🐵 🐶 🐺 🐱 🦁 🐯 🦒 🦊 🦝 🐮 🐷 🐗 🐭 🐹 🐰 🐻 🐨 🐼 🐸 🦓 🐴 🦄 🐔 🐲\n".split(" ").map((function(e){return e.trim()})).filter((function(e){return e})),p=function(e){var t=Object(u.a)(),n=t.loading,r=t.error,l=t.doWork,d=Object(i.useState)(null),f=d[0],h=d[1],p=function(){return l(function(){var e=Object(o.a)(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.a.get().setup();case 2:return t(),e.next=5,m.a.get().getUserProfiles();case 5:n=e.sent,h(n);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())};return Object(i.useEffect)((function(){p()}),[]),s.a.createElement(c.a.View_Panel,null,s.a.createElement(c.a.Text_FormTitle,null,"Users"),s.a.createElement(c.a.LoadingInline,{loading:n}),s.a.createElement(c.a.ErrorBox,{error:r}),null==f?void 0:f.map((function(e){return s.a.createElement(v,{key:e.key,userProfile:e,onActiveUserChange:p,onUserProfileChange:p})})),s.a.createElement(c.a.Text_FormTitle,null,"Add User"),s.a.createElement(g,{onUserAdded:p}),!!e.onClose&&s.a.createElement(c.a.View_FormActionRow,null,s.a.createElement(c.a.Button_FormAction,{onPress:function(){var t;return null===(t=e.onClose)||void 0===t?void 0:t.call(e)}},"Done")))},g=function(e){var t=Object(u.a)(),n=t.loading,r=t.error,l=t.doWork,d=Object(i.useState)(null),f=d[0],h=d[1];return s.a.createElement(s.a.Fragment,null,s.a.createElement(c.a.View_Form,null,s.a.createElement(c.a.View_FieldRow,null,s.a.createElement(c.a.LoadingInline,{loading:n}),s.a.createElement(c.a.Input_Text,{value:null!=f?f:"",onChange:h,placeholder:"Enter Share Code"}),s.a.createElement(c.a.Button_FieldInline,{onPress:function(){f&&l(function(){var t=Object(o.a)(a.a.mark((function t(n){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.a.get().addUserFromShareCode(f);case 2:n(),e.onUserAdded(),h(null);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},"Add User")),s.a.createElement(c.a.ErrorBox,{error:r})))},v=function(e){var t=e.userProfile,n=e.onActiveUserChange,r=e.onUserProfileChange,p=Object(u.a)(),g=p.loading,v=p.error,y=p.doWork,x=Object(i.useState)(null),w=x[0],E=x[1],_=Object(i.useState)(null),S=_[0],O=_[1];return S?s.a.createElement(s.a.Fragment,null,s.a.createElement(c.a.View_Form,null,s.a.createElement(l.h,{style:{flexDirection:"row",flexWrap:"wrap"}},S.map((function(e){return s.a.createElement(l.g,{key:e,onPress:function(){return n=e,y(function(){var e=Object(o.a)(a.a.mark((function e(o){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.a.get().setUserProfileInfo(t.key,{emoji:n});case 2:O(null),r();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var n}},s.a.createElement(l.h,null,s.a.createElement(l.e,{style:{fontSize:32}},e)))}))))):s.a.createElement(s.a.Fragment,null,s.a.createElement(c.a.View_Form,null,s.a.createElement(c.a.View_FieldRow,null,s.a.createElement(c.a.LoadingInline,{loading:g}),s.a.createElement(l.g,{onPress:function(){return y(function(){var e=Object(o.a)(a.a.mark((function e(r){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.a.get().setActiveUser(t.key);case 2:r(),n();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},s.a.createElement(d.a,{style:{size:32},kind:t.isActive?f.a.checkChecked:f.a.checkUnchecked})),s.a.createElement(l.g,{onPress:function(){O(h)}},s.a.createElement(l.h,null,s.a.createElement(l.e,{style:{fontSize:32}},t.emoji))),s.a.createElement(b,{userProfile:t,onNameChange:r}),!!w&&s.a.createElement(c.a.Text_FieldLabel,null,w),!w&&s.a.createElement(c.a.Button_FieldInline,{onPress:function(){return y(function(){var e=Object(o.a)(a.a.mark((function e(n){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.a.get().createShareCode(t.key);case 2:r=e.sent,n(),E(r.shareCode);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},"Create Share Code")),s.a.createElement(c.a.ErrorBox,{error:v})))},b=function(e){var t=e.userProfile,n=e.onNameChange,r=Object(u.a)(),d=(r.loading,r.error,r.doWork),f=Object(i.useState)(t.name),h=f[0],p=f[1],g=Object(i.useState)(!1),v=g[0],b=g[1],y=function(){return d(function(){var e=Object(o.a)(a.a.mark((function e(r){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("UserProfileName changeName",{name:h}),e.next=3,m.a.get().setUserProfileInfo(t.key,{name:h});case 3:b(!1),n();case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())};return s.a.createElement(s.a.Fragment,null,!v&&s.a.createElement(l.g,{onPress:function(){return b(!0)}},s.a.createElement(c.a.Text_FieldLabel,null,t.name)),v&&s.a.createElement(s.a.Fragment,null,s.a.createElement(c.a.Input_Text,{value:h,onChange:p,onSubmit:y}),s.a.createElement(c.a.Button_FieldInline,{onPress:y},"Change")))}},t7PJ:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));n("xrQq"),n("kNg/");var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=n("iOfb"),s=n("TFfC"),l={container:{background:"#111111"},containerPanel:{background:"#292a2d"},editorModeTabRowView:{flexDirection:"row",paddingLeft:16},editorModeTabView:{background:"#1e1e1e",alignSelf:"flex-start",padding:8,marginRight:1},editorModeTabView_selected:{background:"#292a2d",alignSelf:"flex-start",padding:8,marginRight:1},editorModeTabText:{fontSize:14,color:"#FFFFFFF"},editorModeTabText_selected:{fontSize:14,color:"#FFFF88"},buttonView:{background:"#1e1e1e",alignSelf:"flex-start",padding:8,margin:1},buttonText:{fontSize:14,color:"#FFFFFFF"},sectionHeaderText:{margin:8,fontSize:18,color:"#FFFF88"},infoView:{},infoText:{margin:8,fontSize:12,wrap:"wrap"},lessonFieldView:{flexDirection:"row"},lessonFieldLabelText:{minWidth:80,padding:4,fontSize:12},lessonFieldText:{flex:1,padding:4,fontSize:12,wrap:"wrap"},jsonText:{padding:4,fontSize:12,color:"#FFFFFF",background:"#000000"}},u=function(e){var t=e.lessons.flatMap((function(e,t){return[{kind:"lesson",lesson:e,label:t+1+". "+e.title},{kind:"preview",lesson:e,label:"  🔎 Preview the Result"},{kind:"construct",lesson:e,label:"  📝 Construct the Code"},{kind:"understand",lesson:e,label:"  💡 Understand the Code"},{kind:"experiment",lesson:e,label:"  🔬 Experiment with the Code"}]})),n=e.lessons[e.lessons.length-1];if(n){var r,a=n.projectState.files.find((function(e){return e.path===n.focus.filePath}));t.unshift({kind:"preview",lesson:Object.assign({},n,{key:"lesson-",focus:Object.assign({},n.focus,{index:0,length:null!==(r=null==a?void 0:a.content.length)&&void 0!==r?r:0})}),label:"🎯 Lesson Objective"})}return t.map((function(e){return Object.assign({},e,{key:e.lesson.key+e.kind})}))},c=function(e){var t=Object(r.useState)(u(e.module)),n=t[0],c=t[1],d=Object(r.useState)(null),m=d[0],h=d[1];Object(r.useEffect)((function(){var t=u(e.module);c(t),p({items:t,useTimeout:!1})}),[e.module]);var p=function(e){var t,r,a,o,i=null!==(t=null==e?void 0:e.items)&&void 0!==t?t:n,s=null!==(r=null==e?void 0:e.activeItem)&&void 0!==r?r:m;if(i){var l=i.filter((function(e){return"lesson"!==e.kind})),u=l.findIndex((function(e){return e.key===(null==s?void 0:s.key)})),c=i.findIndex((function(e){return e.key===(null==s?void 0:s.key)})),d=null!==(a=null!==(o=u>=0?l[u+1]:null)&&void 0!==o?o:c>=0?i[c+1]:null)&&void 0!==a?a:i[0];null!=e&&e.useTimeout?setTimeout((function(){h(d)}),1e3):h(d)}};return a.a.createElement(a.a.Fragment,null,a.a.createElement(o.h,{style:l.container},n&&a.a.createElement(f,{items:n,activeItem:null!=m?m:void 0,onChange:function(e){"lesson"===e.kind?p({items:n,activeItem:e,useTimeout:!1}):h(e)}},a.a.createElement(o.h,{key:null==m?void 0:m.key},"preview"===(null==m?void 0:m.kind)&&a.a.createElement(s.c,{data:m.lesson,setProjectState:e.setProjectState,onDone:p}),"construct"===(null==m?void 0:m.kind)&&a.a.createElement(s.a,{data:m.lesson,onDone:p}),"understand"===(null==m?void 0:m.kind)&&a.a.createElement(s.d,{data:m.lesson,onDone:p}),"experiment"===(null==m?void 0:m.kind)&&a.a.createElement(s.b,{data:m.lesson,setProjectState:e.setProjectState,onDone:p})),a.a.createElement("div",null,a.a.createElement("h3",{style:{borderTop:"solid 1px #3ca4ff",padding:8,margin:0,marginTop:16,textAlign:"center"}},"Community Comments - ",e.module.title),a.a.createElement(i.a,{repo:"ricklove/ricklove-code-lesson-comments"})))))},d={outerContainer:{flexDirection:"row"},contentContainer:{flex:1,overflow:"auto"},container:{flexDirection:"column"},itemsContainer:{background:"#333333"},itemView_header:{flexDirection:"row",alignItems:"center",background:"#333333",padding:4,marginRight:1},itemView:{flexDirection:"row",alignItems:"center",background:"#1e1e1e",padding:4,marginRight:1},itemView_selected:{flexDirection:"row",alignItems:"center",background:"#292a2d",padding:4,marginRight:1},itemText:{fontSize:14},itemText_selected:{fontSize:14,color:"#FFFF88"}},f=function(e){var t=e.items,n=e.activeItem,i=Object(r.useRef)(!1),s=Object(r.useState)(!0),l=s[0],u=s[1],c=Object(r.useState)(!1),f=c[0],m=c[1];Object(r.useEffect)((function(){f&&u(!1)}),[f]),Object(r.useEffect)((function(){var t,r;if(null!=n&&n.key){if(!i.current){i.current=!0;var a=window.location.hash.substr(1),o=e.items.find((function(e){return e.key===a}));if(console.log("LessonModuleNavigator load",{hash:a,matchItem:o}),o)return void e.onChange(o)}window.history.replaceState(null,null!==(t=null==n?void 0:n.label)&&void 0!==t?t:"","#"+(null!==(r=null==n?void 0:n.key)&&void 0!==r?r:""))}}),[n]);return!l&&n?a.a.createElement(a.a.Fragment,null,a.a.createElement(o.g,{onPress:function(){return u((function(){return!0}))}},a.a.createElement(o.h,{style:d.itemView_header},a.a.createElement(o.e,{style:d.itemText_selected},"🧭 Lesson Navigation")),a.a.createElement(o.h,{style:d.itemsContainer},a.a.createElement(o.h,{style:d.itemView_selected},a.a.createElement(o.e,{style:d.itemText_selected},"➡ "+n.label)))),e.children):a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{onLoad:function(e){var t;t=e.target.clientWidth,m(t<600)}},a.a.createElement(o.h,{style:d.outerContainer},a.a.createElement(o.h,{style:d.container},a.a.createElement(o.g,{onPress:function(){return u((function(){return!1}))}},a.a.createElement(o.h,{style:d.itemView_header},a.a.createElement(o.e,{style:d.itemText_selected},"🧭 Lesson Navigation"))),a.a.createElement(o.h,{style:d.itemsContainer},t.map((function(t){return a.a.createElement(o.g,{key:t.key,onPress:function(){var r;(f&&u((function(){return!1})),t.key!==(null==n?void 0:n.key))&&(r=t,e.onChange(r))}},a.a.createElement(o.h,{style:t.key===(null==n?void 0:n.key)?d.itemView_selected:d.itemView},a.a.createElement(o.e,{style:t.key===(null==n?void 0:n.key)?d.itemText_selected:d.itemText},(t.key===(null==n?void 0:n.key)?"➡ ":"")+t.label)))})))),a.a.createElement(o.h,{style:d.contentContainer},e.children))))}},uTf4:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return l}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("9DGK");function s(e,t,n){return void 0===n&&(n=1e4),Promise.race([fetch(e,t),new Promise((function(e,t){return setTimeout((function(){return t(new i.a("Fetch Timeout"))}),n)}))])}function l(e,t,n){return u.apply(this,arguments)}function u(){return(u=Object(o.a)(a.a.mark((function e(t,n,r){var o,l,u,c,d,f;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=JSON.stringify(n),u={method:null!==(o=null==r?void 0:r.method)&&void 0!==o?o:"POST",headers:{Accept:"application/json","Content-Type":"application/json","Content-Length":""+l.length},body:l},e.next=4,s(t,u,null==r?void 0:r.timeoutMs).catch((function(e){throw new i.a("Request Failure",{url:t,data:n,error:e})}));case 4:if((c=e.sent).ok){e.next=23;break}return e.t0=i.a,e.next=9,c.json().catch((function(e){}));case 9:if(e.t2=d=e.sent,e.t1=null!==e.t2,!e.t1){e.next=13;break}e.t1=void 0!==d;case 13:if(!e.t1){e.next=17;break}e.t3=d,e.next=18;break;case 17:e.t3={};case 18:throw e.t4=e.t3,e.t5=c.status,e.t6={url:t,data:n},e.t7={data:e.t4,responseStatus:e.t5,request:e.t6},new e.t0("Api Error",e.t7);case 23:return e.next=25,c.json().catch((function(e){throw new i.a("Request Parse Failure",{url:t,data:n,error:e})}));case 25:return f=e.sent,e.abrupt("return",f);case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},ugeJ:function(e,t,n){var r=n("nGXB"),a=Math.hypot,o=Math.abs,i=Math.sqrt;r({target:"Math",stat:!0,forced:!!a&&a(1/0,NaN)!==1/0},{hypot:function(e,t){for(var n,r,a=0,s=0,l=arguments.length,u=0;s<l;)u<(n=o(arguments[s++]))?(a=a*(r=u/n)*r+1,u=n):a+=n>0?(r=n/u)*r:n;return u===1/0?1/0:u*i(a)}})},ujs2:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("Q6Uf"),a=n("Xn6u");function o(e,t,n,a){return new r.LcsDiff(e,t,n).ComputeDiff(a)}var i=function(){function e(t){for(var n=[],r=[],a=0,o=t.length;a<o;a++)n[a]=e._getFirstNonBlankColumn(t[a],1),r[a]=e._getLastNonBlankColumn(t[a],1);this._lines=t,this._startColumns=n,this._endColumns=r}return e.prototype.getLength=function(){return this._lines.length},e.prototype.getElementAtIndex=function(e){return this._lines[e].substring(this._startColumns[e]-1,this._endColumns[e]-1)},e.prototype.getStartLineNumber=function(e){return e+1},e.prototype.getStartColumn=function(e){return this._startColumns[e]},e.prototype.getEndLineNumber=function(e){return e+1},e.prototype.getEndColumn=function(e){return this._endColumns[e]},e._getFirstNonBlankColumn=function(e,t){var n=a.firstNonWhitespaceIndex(e);return-1===n?t:n+1},e._getLastNonBlankColumn=function(e,t){var n=a.lastNonWhitespaceIndex(e);return-1===n?t:n+2},e.prototype.getCharSequence=function(e,t,n){for(var r=[],a=[],o=[],i=0,l=t;l<=n;l++)for(var u=this._lines[l],c=e?this._startColumns[l]:1,d=e?this._endColumns[l]:u.length+1,f=c;f<d;f++)r[i]=u.charCodeAt(f-1),a[i]=l+1,o[i]=f,i++;return new s(r,a,o)},e}(),s=function(){function e(e,t,n){this._charCodes=e,this._lineNumbers=t,this._columns=n}return e.prototype.getLength=function(){return this._charCodes.length},e.prototype.getElementAtIndex=function(e){return this._charCodes[e]},e.prototype.getStartLineNumber=function(e){return this._lineNumbers[e]},e.prototype.getStartColumn=function(e){return this._columns[e]},e.prototype.getEndLineNumber=function(e){return this._lineNumbers[e]},e.prototype.getEndColumn=function(e){return this._columns[e]+1},e}(),l=function(){function e(e,t,n,r,a,o,i,s){this.originalStartLineNumber=e,this.originalStartColumn=t,this.originalEndLineNumber=n,this.originalEndColumn=r,this.modifiedStartLineNumber=a,this.modifiedStartColumn=o,this.modifiedEndLineNumber=i,this.modifiedEndColumn=s}return e.createFromDiffChange=function(t,n,r){var a,o,i,s,l,u,c,d;return 0===t.originalLength?(a=0,o=0,i=0,s=0):(a=n.getStartLineNumber(t.originalStart),o=n.getStartColumn(t.originalStart),i=n.getEndLineNumber(t.originalStart+t.originalLength-1),s=n.getEndColumn(t.originalStart+t.originalLength-1)),0===t.modifiedLength?(l=0,u=0,c=0,d=0):(l=r.getStartLineNumber(t.modifiedStart),u=r.getStartColumn(t.modifiedStart),c=r.getEndLineNumber(t.modifiedStart+t.modifiedLength-1),d=r.getEndColumn(t.modifiedStart+t.modifiedLength-1)),new e(a,o,i,s,l,u,c,d)},e}();var u=function(){function e(e,t,n,r,a){this.originalStartLineNumber=e,this.originalEndLineNumber=t,this.modifiedStartLineNumber=n,this.modifiedEndLineNumber=r,this.charChanges=a}return e.createFromDiffResult=function(t,n,r,a,i,s,u){var c,d,f,m,h=void 0;if(0===n.originalLength?(c=r.getStartLineNumber(n.originalStart)-1,d=0):(c=r.getStartLineNumber(n.originalStart),d=r.getEndLineNumber(n.originalStart+n.originalLength-1)),0===n.modifiedLength?(f=a.getStartLineNumber(n.modifiedStart)-1,m=0):(f=a.getStartLineNumber(n.modifiedStart),m=a.getEndLineNumber(n.modifiedStart+n.modifiedLength-1)),s&&0!==n.originalLength&&0!==n.modifiedLength&&i()){var p=r.getCharSequence(t,n.originalStart,n.originalStart+n.originalLength-1),g=a.getCharSequence(t,n.modifiedStart,n.modifiedStart+n.modifiedLength-1),v=o(p,g,i,!0);u&&(v=function(e){if(e.length<=1)return e;for(var t=[e[0]],n=t[0],r=1,a=e.length;r<a;r++){var o=e[r],i=o.originalStart-(n.originalStart+n.originalLength),s=o.modifiedStart-(n.modifiedStart+n.modifiedLength);Math.min(i,s)<3?(n.originalLength=o.originalStart+o.originalLength-n.originalStart,n.modifiedLength=o.modifiedStart+o.modifiedLength-n.modifiedStart):(t.push(o),n=o)}return t}(v)),h=[];for(var b=0,y=v.length;b<y;b++)h.push(l.createFromDiffChange(v[b],p,g))}return new e(c,d,f,m,h)},e}(),c=function(){function e(e,t,n){this.shouldComputeCharChanges=n.shouldComputeCharChanges,this.shouldPostProcessCharChanges=n.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=n.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=n.shouldMakePrettyDiff,this.maximumRunTimeMs=5e3,this.originalLines=e,this.modifiedLines=t,this.original=new i(e),this.modified=new i(t)}return e.prototype.computeDiff=function(){if(1===this.original.getLength()&&0===this.original.getElementAtIndex(0).length)return[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.getLength(),charChanges:[{modifiedEndColumn:0,modifiedEndLineNumber:0,modifiedStartColumn:0,modifiedStartLineNumber:0,originalEndColumn:0,originalEndLineNumber:0,originalStartColumn:0,originalStartLineNumber:0}]}];if(1===this.modified.getLength()&&0===this.modified.getElementAtIndex(0).length)return[{originalStartLineNumber:1,originalEndLineNumber:this.original.getLength(),modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:[{modifiedEndColumn:0,modifiedEndLineNumber:0,modifiedStartColumn:0,modifiedStartLineNumber:0,originalEndColumn:0,originalEndLineNumber:0,originalStartColumn:0,originalStartLineNumber:0}]}];this.computationStartTime=(new Date).getTime();var e=o(this.original,this.modified,this._continueProcessingPredicate.bind(this),this.shouldMakePrettyDiff);if(this.shouldIgnoreTrimWhitespace){for(var t=[],n=0,r=e.length;n<r;n++)t.push(u.createFromDiffResult(this.shouldIgnoreTrimWhitespace,e[n],this.original,this.modified,this._continueProcessingPredicate.bind(this),this.shouldComputeCharChanges,this.shouldPostProcessCharChanges));return t}for(var a=[],s=0,l=0,c=(n=-1,e.length);n<c;n++){for(var d=n+1<c?e[n+1]:null,f=d?d.originalStart:this.originalLines.length,m=d?d.modifiedStart:this.modifiedLines.length;s<f&&l<m;){var h=this.originalLines[s],p=this.modifiedLines[l];if(h!==p){for(var g=i._getFirstNonBlankColumn(h,1),v=i._getFirstNonBlankColumn(p,1);g>1&&v>1;){if(h.charCodeAt(g-2)!==p.charCodeAt(v-2))break;g--,v--}(g>1||v>1)&&this._pushTrimWhitespaceCharChange(a,s+1,1,g,l+1,1,v);for(var b=i._getLastNonBlankColumn(h,1),y=i._getLastNonBlankColumn(p,1),x=h.length+1,w=p.length+1;b<x&&y<w;){if(h.charCodeAt(b-1)!==h.charCodeAt(y-1))break;b++,y++}(b<x||y<w)&&this._pushTrimWhitespaceCharChange(a,s+1,b,x,l+1,y,w)}s++,l++}d&&(a.push(u.createFromDiffResult(this.shouldIgnoreTrimWhitespace,d,this.original,this.modified,this._continueProcessingPredicate.bind(this),this.shouldComputeCharChanges,this.shouldPostProcessCharChanges)),s+=d.originalLength,l+=d.modifiedLength)}return a},e.prototype._pushTrimWhitespaceCharChange=function(e,t,n,r,a,o,i){if(!this._mergeTrimWhitespaceCharChange(e,t,n,r,a,o,i)){var s=void 0;this.shouldComputeCharChanges&&(s=[new l(t,n,t,r,a,o,a,i)]),e.push(new u(t,t,a,a,s))}},e.prototype._mergeTrimWhitespaceCharChange=function(e,t,n,r,a,o,i){var s=e.length;if(0===s)return!1;var u=e[s-1];return 0!==u.originalEndLineNumber&&0!==u.modifiedEndLineNumber&&(u.originalEndLineNumber+1===t&&u.modifiedEndLineNumber+1===a&&(u.originalEndLineNumber=t,u.modifiedEndLineNumber=a,this.shouldComputeCharChanges&&u.charChanges.push(new l(t,n,t,r,a,o,a,i)),!0))},e.prototype._continueProcessingPredicate=function(){return 0===this.maximumRunTimeMs||(new Date).getTime()-this.computationStartTime<this.maximumRunTimeMs},e}();t.DiffComputer=c},vOCV:function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return c}));n("xrQq"),n("kNg/");var r=n("hsFx"),a=n("AJkQ"),o=n("/OUt"),i=function(e){if(0===e.endLine){if(0===e.startLine&&e.otherAtStart){return{start:0,afterEnd:0,change:e.span.newRange(0,0),span:e.span,lineSpans:e.lineSpans}}if(0===e.startLine&&e.otherAtEnd){var t=e.span.length,n=t;return{start:t,afterEnd:n,change:e.span.newRange(t,n-t),span:e.span,lineSpans:e.lineSpans}}var r=e.startLine>=e.lineSpans.length?e.span.length:e.lineSpans[e.startLine].start,a=r;return{start:r,afterEnd:a,change:e.span.newRange(r,a-r),span:e.span,lineSpans:e.lineSpans}}if(!e.startColumn||!e.endColumn){var o=e.startLine<=1?0:e.lineSpans[e.startLine-1].start,i=e.endLine>e.lineSpans.length?e.span.length:e.lineSpans[e.endLine-1].start+e.lineSpans[e.endLine-1].length;return{start:o,afterEnd:i,change:e.span.newRange(o,i-o),span:e.span,lineSpans:e.lineSpans}}var s=e.lineSpans[e.startLine-1].start+e.startColumn-1,l=e.lineSpans[e.endLine-1].start+e.endColumn-1;return{start:s,afterEnd:l,change:e.span.newRange(s,l-s),span:e.span,lineSpans:e.lineSpans}},s=function(e,t){var n=new a.a(e),s=new a.a(t),l=n.splitOnRegExp(/\n/g).map((function(e,t){return 0===t?e.transform(0,1):e.transform(1,1)})),u=s.splitOnRegExp(/\n/g).map((function(e,t){return 0===t?e.transform(0,1):e.transform(1,1)})),c=new o.DiffComputer(l.map((function(e){return e.toText()})),u.map((function(e){return e.toText()})),{shouldPostProcessCharChanges:!0,shouldIgnoreTrimWhitespace:!1,shouldMakePrettyDiff:!0,shouldComputeCharChanges:!0}).computeDiff(),d=c.flatMap((function(e){var t,n;return null!==(t=null===(n=e.charChanges)||void 0===n?void 0:n.map((function(t){return Object.assign({line:e},t)})))&&void 0!==t?t:[Object.assign({line:e},e,{originalStartColumn:void 0,originalEndColumn:void 0,modifiedStartColumn:void 0,modifiedEndColumn:void 0})]}));console.log("diff",{charChanges:d,lineChanges:c,aSpan:n,bSpan:s});var f=d.map((function(e){var t,r,a,o;if(0===e.originalStartColumn&&0===e.originalEndColumn||0===e.modifiedStartColumn&&0===e.modifiedEndColumn)return Object.assign({},e,{a:i({span:n,lineSpans:l,startLine:e.line.originalStartLineNumber,endLine:e.line.originalEndLineNumber,startColumn:void 0,endColumn:void 0,otherAtStart:e.modifiedStartLineNumber<=1&&1===(null!==(a=e.modifiedStartColumn)&&void 0!==a?a:1),otherAtEnd:e.modifiedStartLineNumber>=u.length}),b:i({span:s,lineSpans:u,startLine:e.line.modifiedStartLineNumber,endLine:e.line.modifiedEndLineNumber,startColumn:void 0,endColumn:void 0,otherAtStart:e.originalStartLineNumber<=1&&1===(null!==(o=e.originalStartColumn)&&void 0!==o?o:1),otherAtEnd:e.originalStartLineNumber>=l.length})});var c=i({span:n,lineSpans:l,startLine:e.originalStartLineNumber,endLine:e.originalEndLineNumber,startColumn:e.originalStartColumn,endColumn:e.originalEndColumn,otherAtStart:e.modifiedStartLineNumber<=1&&1===(null!==(t=e.modifiedStartColumn)&&void 0!==t?t:1),otherAtEnd:e.modifiedStartLineNumber>=u.length}),d=i({span:s,lineSpans:u,startLine:e.modifiedStartLineNumber,endLine:e.modifiedEndLineNumber,startColumn:e.modifiedStartColumn,endColumn:e.modifiedEndColumn,otherAtStart:e.originalStartLineNumber<=1&&1===(null!==(r=e.originalStartColumn)&&void 0!==r?r:1),otherAtEnd:e.originalStartLineNumber>=l.length});return Object.assign({},e,{a:c,b:d})}));return{changes:Object(r.b)(f,(function(e){return e.a.change.start+":"+e.a.change.length+"=>"+e.b.change.start+":"+e.b.change.length}))}},l=n("Nm1O"),u=function(e,t){var n=e.files.map((function(e){var n=Object.assign({},e);return t.filter((function(t){return t.selection.filePath===e.path})).sort((function(e,t){return-(e.selection.index-t.selection.index)})).forEach((function(e){n.content=""+n.content.substr(0,e.selection.index)+e.content+n.content.substr(e.selection.index+e.selection.length)})),n})),r={files:n,filesHashCode:Object(l.a)(n)};return console.log("lessonExperiments_createReplacementProjectState",r,e,t),r},c=function(e,t){var n=e.files.map((function(e){return{oldFile:e,newFile:t.files.find((function(t){return t.path===e.path}))}})).filter((function(e){return e.newFile})).map((function(e){var t,n;return{filePath:e.oldFile.path,changes:s(e.oldFile.content,null!==(t=null===(n=e.newFile)||void 0===n?void 0:n.content)&&void 0!==t?t:"").changes}})).flatMap((function(e){return e.changes.map((function(t){return{filePath:e.filePath,change:t}}))})).map((function(e){var t,n,r,a;return{selection:{filePath:e.filePath,index:e.change.a.change.start,length:e.change.a.change.length},content:0===(null!==(t=null===(n=e.change.b)||void 0===n?void 0:n.change.length)&&void 0!==t?t:0)?"":null!==(r=null===(a=e.change.b)||void 0===a?void 0:a.change.toText())&&void 0!==r?r:""}}));return console.log("lessonExperiments_calculateProjectStateReplacements",n,e,t),{replacements:n}}},vm2h:function(e,t,n){e.exports=function(){"use strict";return function(e,t,n){e=e||{};var r=t.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function o(e,t,n,a){return r.fromToBase(e,t,n,a)}n.en.relativeTime=a,r.fromToBase=function(t,r,o,i,s){for(var l,u,c,d=o.$locale().relativeTime||a,f=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=f.length,h=0;h<m;h+=1){var p=f[h];p.d&&(l=i?n(t).diff(o,p.d,!0):o.diff(t,p.d,!0));var g=(e.rounding||Math.round)(Math.abs(l));if(c=l>0,g<=p.r||!p.r){g<=1&&h>0&&(p=f[h-1]);var v=d[p.l];s&&(g=s(""+g)),u="string"==typeof v?v.replace("%d",g):v(g,r,p.l,c);break}}if(r)return u;var b=c?d.future:d.past;return"function"==typeof b?b(u):b.replace("%s",u)},r.to=function(e,t){return o(e,t,this,!0)},r.from=function(e,t){return o(e,t,this)};var i=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(i(this),e)},r.fromNow=function(e){return this.from(i(this),e)}}}()},wObj:function(e,t,n){var r=n("T/ei"),a=n("AazG");e.exports=function(e){return r((function(){return!!a[e]()||"​᠎"!="​᠎"[e]()||a[e].name!==e}))}},xWie:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={websocketsApiUrl:"wss://p4w1a7ysk8.execute-api.us-east-1.amazonaws.com/prod"}},xrQq:function(e,t,n){"use strict";var r=n("nGXB"),a=n("kDUE"),o=n("16cg"),i=n("JLWX"),s=n("3zCA"),l=n("9p6f");r({target:"Array",proto:!0},{flatMap:function(e){var t,n=o(this),r=i(n.length);return s(e),(t=l(n,0)).length=a(t,n,n,r,0,1,e,arguments.length>1?arguments[1]:void 0),t}})},yxiS:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i={container:{margin:16},header:{view:{margin:4},text:{fontSize:16}},section:{view:{margin:4,flexDirection:"row"},text:{fontSize:16}}},s=function(e){var t=Object(r.useState)(!1),n=t[0],s=t[1];return a.a.createElement(o.h,{style:i.container},a.a.createElement(o.g,{onPress:function(){n||e.onOpen(),n&&e.onClose(),s((function(e){return!e}))}},a.a.createElement(o.h,{style:i.header.view},a.a.createElement(o.e,{style:i.header.text},"Sections"))),n&&a.a.createElement(o.h,null,e.problemService.getSections().map((function(t){return a.a.createElement(o.g,{key:t.key,onPress:function(){console.log("SubjectNavigator onSection",{s:t}),e.problemService.gotoSection(t),e.onSubjectNavigation(),e.onClose(),s(!1),"web"===o.c.OS&&window.scrollTo(0,0)}},a.a.createElement(o.h,{style:i.section.view},a.a.createElement(o.e,{style:i.section.text},t.isComplete?"✅":"⬜"),a.a.createElement(o.e,{style:i.section.text},t.name)))}))))}},yyXn:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=function(e,t){var n=function(e){var t,n;return{load:(n=Object(o.a)(a.a.mark((function t(){var n;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.abrupt("return",JSON.parse(null!==(n=localStorage.getItem(e))&&void 0!==n?n:"error - NOT FOUND"));case 4:return t.prev=4,t.t0=t.catch(0),t.abrupt("return",null);case 7:case"end":return t.stop()}}),t,null,[[0,4]])}))),function(){return n.apply(this,arguments)}),save:(t=Object(o.a)(a.a.mark((function t(n){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:localStorage.setItem(e,JSON.stringify(n));case 1:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})}}(t);return Object(o.a)(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.load(n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))(),Object.assign({},e,{recordAnswer:function(t,r){e.recordAnswer(t,r),t.isLastOfSection&&Object(o.a)(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.save(n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()}})}},z7rP:function(e,t,n){"use strict";n.d(t,"a",(function(){return h}));var r=n("VtSi"),a=n.n(r),o=(n("3yYM"),n("QsI/")),i=n("aEBB"),s=n("B8BD"),l=n("GJ35"),u=n("9DGK"),c=n("eCSs");function d(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var m={instance:null},h={get:function(){var e,t,n,r,f,h,p,g,v,b,y,x,w,E,_,S,O,C,T;return m.instance||(m.instance=(v=Object(i.a)(s.a),b={getUserDataServiceState:function(){try{var e;return JSON.parse(null!==(e=localStorage.getItem("_USER_DATA_SERVICE_STATE"))&&void 0!==e?e:"NULL !{}")}catch(t){return null}},setUserDataServiceState:function(e){localStorage.setItem("_USER_DATA_SERVICE_STATE",JSON.stringify(e))},getUserData:function(){for(var e,t=b.getUserDataServiceState(),n=t&&t.userProfiles.find((function(e){return e.key===t.activeUserProfileKey})),r={data:{},metadata:{name:null==n?void 0:n.name,emoji:null==n?void 0:n.emoji},timestamp:Date.now()},a=d(Object.keys(localStorage).filter((function(e){return!e.startsWith("_")})));!(e=a()).done;){var o=e.value;r.data[o]=localStorage.getItem(o)}return r},clearUserData:function(){for(var e,t=d(Object.keys(localStorage).filter((function(e){return!e.startsWith("_")})));!(e=t()).done;){var n=e.value;localStorage.removeItem(n)}var r=b.getUserDataServiceState();r&&(r.userProfiles.forEach((function(e){e.lastUploadTimestamp=void 0})),b.setUserDataServiceState(r))},setUserData:function(e){var t,n,r,a;b.clearUserData();for(var o=0,i=Object.keys(e.data);o<i.length;o++){var s=i[o],l=e.data[s];if(!l)return void localStorage.removeItem(s);localStorage.setItem(s,l)}var u=b.getUserDataServiceState(),c=u&&u.userProfiles.find((function(e){return e.key===u.activeUserProfileKey}));u&&c&&(c.emoji=null!==(t=null===(n=e.metadata)||void 0===n?void 0:n.emoji)&&void 0!==t?t:c.emoji,c.name=null!==(r=null===(a=e.metadata)||void 0===a?void 0:a.name)&&void 0!==r?r:c.name,c.lastUploadTimestamp=e.timestamp,b.setUserDataServiceState(u))}},y=function(e){var t=b.getUserDataServiceState();return t?t.userProfiles.find((function(t){return t.key===e})):null},x=function(){var e=b.getUserDataServiceState();return null!=e&&e.activeUserProfileKey?e.userProfiles.find((function(t){return t.key===e.activeUserProfileKey})):null},w=function(){var e=Object(o.a)(a.a.mark((function e(t,n){var r,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.createUploadUrl({prefix:"backup/users/"+t.name+"/"+t.uploadUrl.relativePath+"/"+Date.now()});case 2:return r=e.sent,o=Object(l.b)(r.uploadUrl),e.next=6,o.uploadData(n);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),E=function(){var e=Object(o.a)(a.a.mark((function e(t,n){var r,i,s,u;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=b.getUserDataServiceState(),i=r&&r.userProfiles.find((function(e){return e.key===t})),r&&i){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,w(i,n);case 6:return s=function(){var e=Object(o.a)(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(l.b)(i.uploadUrl),e.next=3,t.uploadData(n);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=7,console.log("uploadWithAutoRenew - Attempt 1"),e.next=11,s();case 11:console.log("uploadWithAutoRenew - UPLOADED"),e.next=25;break;case 14:return e.prev=14,e.t0=e.catch(7),console.log("uploadWithAutoRenew - Attempt 2"),e.next=19,v.renewUploadUrl({uploadUrl:i.uploadUrl});case 19:return u=e.sent,i.uploadUrl=u.uploadUrl,b.setUserDataServiceState(r),e.next=24,s();case 24:console.log("uploadWithAutoRenew - UPLOADED AFTER RENEW");case 25:case"end":return e.stop()}}),e,null,[[7,14]])})));return function(t,n){return e.apply(this,arguments)}}(),_=function(){var e=Object(o.a)(a.a.mark((function e(t){var n,r,o,i,s,u,c,d;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("updateUserProfile",{userProfileKey:t}),u=b.getUserDataServiceState(),c=u&&u.userProfiles.find((function(e){return e.key===t})),u&&c){e.next=6;break}return console.log("updateUserProfile - NO USER STATE",{userProfileKey:t}),e.abrupt("return");case 6:return e.next=8,Object(l.c)(c.uploadUrl.getUrl);case 8:if((d=e.sent).timestamp&&!(d.timestamp<=(null!==(n=c.lastUploadTimestamp)&&void 0!==n?n:0))){e.next=12;break}return console.log("updateUserProfile - NOT NEW",{name:c.name}),e.abrupt("return");case 12:console.log("updateUserProfile - UPDATED USER PROFILE",{name:c.name}),c.emoji=null!==(r=null===(o=d.metadata)||void 0===o?void 0:o.emoji)&&void 0!==r?r:c.emoji,c.name=null!==(i=null===(s=d.metadata)||void 0===s?void 0:s.name)&&void 0!==i?i:c.name,c.lastUploadTimestamp=d.timestamp,b.setUserDataServiceState(u),c.key===u.activeUserProfileKey&&(console.log("updateUserProfile - UPDATED ACTIVE USER DATA",{name:c.name}),b.setUserData(d));case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=Object(o.a)(a.a.mark((function e(){var t,n,r,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=b.getUserDataServiceState()){e.next=3;break}return e.abrupt("return");case 3:n=d(t.userProfiles);case 4:if((r=n()).done){e.next=16;break}return o=r.value,e.prev=6,e.next=9,_(o.key);case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(6),console.log("updateAllProfiles - ERROR Updating user profile",{error:e.t0});case 14:e.next=4;break;case 16:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(){return e.apply(this,arguments)}}(),O=!1,C=!1,T={setup:(g=Object(o.a)(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!O){e.next=7;break}case 1:if(C){e.next=6;break}return e.next=4,Object(c.a)(10);case 4:e.next=1;break;case 6:return e.abrupt("return");case 7:return O=!0,t=function(){var e=Object(o.a)(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("UserDataService:setup"),!x()){e.next=6;break}return e.next=5,S();case 5:return e.abrupt("return");case 6:if(!((t=b.getUserDataServiceState())&&t.userProfiles.length>0)){e.next=13;break}return t.activeUserProfileKey=t.userProfiles[0].key,b.setUserDataServiceState(t),e.next=12,S();case 12:return e.abrupt("return");case 13:return e.next=15,v.createUploadUrl({prefix:"users"});case 15:return n=e.sent,r=null!=t?t:{userProfiles:[{key:n.uploadUrl.relativePath,name:"Player 1",uploadUrl:n.uploadUrl}],activeUserProfileKey:n.uploadUrl.relativePath,changeTimestamp:0},b.setUserDataServiceState(r),e.next=20,T.uploadUserData();case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=9,e.next=12,t();case 12:C=!0,e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(9),C=!0,e.t0;case 19:case"end":return e.stop()}}),e,null,[[9,15]])}))),function(){return g.apply(this,arguments)}),getActiveUser:function(){var e,t=x();return t?{key:t.key,name:t.name,emoji:null!==(e=t.emoji)&&void 0!==e?e:"👤",isActive:!0}:null},setActiveUser:(p=Object(o.a)(a.a.mark((function e(t){var n;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("setActiveUser",{userProfileKey:t}),n=b.getUserDataServiceState()){e.next=4;break}return e.abrupt("return");case 4:if(n.userProfiles.find((function(e){return e.key===t}))){e.next=7;break}throw console.log("setActiveUser - User Profile Not Found",{userProfileKey:t}),new u.b("User Profile not found");case 7:return n.activeUserProfileKey!==t&&(console.log("setActiveUser - user changed - clearing state"),n.activeUserProfileKey=t,n.changeTimestamp=0,b.setUserDataServiceState(n),b.clearUserData()),console.log("setActiveUser - before download",{stateJson:JSON.stringify(b.getUserDataServiceState())}),e.next=11,T.downloadUserDataIfNewer();case 11:case"end":return e.stop()}}),e)}))),function(e){return p.apply(this,arguments)}),getUserProfiles:(h=Object(o.a)(a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(t=b.getUserDataServiceState())&&t.activeUserProfileKey){e.next=3;break}return e.abrupt("return",[]);case 3:return e.abrupt("return",t.userProfiles.map((function(e){var n;return{key:e.key,name:e.name,emoji:null!==(n=e.emoji)&&void 0!==n?n:"👤",isActive:t.activeUserProfileKey===e.key}})));case 4:case"end":return e.stop()}}),e)}))),function(){return h.apply(this,arguments)}),setUserProfileInfo:(f=Object(o.a)(a.a.mark((function e(t,n){var r,o,i,s,u,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=b.getUserDataServiceState()){e.next=4;break}return console.log("uploadUserData - NO STATE"),e.abrupt("return");case 4:if(s=i.userProfiles.find((function(e){return e.key===t}))){e.next=8;break}return console.log("uploadUserData - NO USER STATE"),e.abrupt("return");case 8:return s.emoji=null!==(r=n.emoji)&&void 0!==r?r:s.emoji,s.name=null!==(o=n.name)&&void 0!==o?o:s.name,b.setUserDataServiceState(i),u=Object(l.b)(s.uploadUrl),e.next=14,u.downloadData();case 14:if(c=e.sent){e.next=17;break}return e.abrupt("return");case 17:return c.metadata={name:s.name,emoji:s.emoji},c.timestamp=Date.now(),e.next=21,E(t,c);case 21:case"end":return e.stop()}}),e)}))),function(e,t){return f.apply(this,arguments)}),uploadUserData:(r=Object(o.a)(a.a.mark((function e(){var t,n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("uploadUserData"),t=b.getUserDataServiceState()){e.next=5;break}return console.log("uploadUserData - NO STATE"),e.abrupt("return");case 5:if(n=t.userProfiles.find((function(e){return e.key===t.activeUserProfileKey}))){e.next=9;break}return console.log("uploadUserData - NO user State",{state:t}),e.abrupt("return");case 9:return n.lastUploadTimestamp=Date.now(),b.setUserDataServiceState(t),r=b.getUserData(),e.next=14,E(n.key,r);case 14:console.log("uploadUserData - UPLOADED",{userData:r});case 15:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)}),downloadUserDataIfNewer:(n=Object(o.a)(a.a.mark((function e(){var t,n,r,o,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=b.getUserDataServiceState()){e.next=3;break}return e.abrupt("return");case 3:if(r=n.userProfiles.find((function(e){return e.key===n.activeUserProfileKey}))){e.next=6;break}return e.abrupt("return");case 6:return console.log("downloadUserDataIfNewer"),o=Object(l.b)(r.uploadUrl),e.next=10,o.downloadData();case 10:if((i=e.sent).timestamp&&!(i.timestamp<=(null!==(t=r.lastUploadTimestamp)&&void 0!==t?t:0))){e.next=14;break}return console.log("downloadUserDataIfNewer - Local data is up to date",{state:n,userData:i}),e.abrupt("return");case 14:console.log("downloadUserDataIfNewer - UPDATING",{state:n,userData:i}),b.clearUserData(),b.setUserData(i);case 17:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)}),createShareCode:(t=Object(o.a)(a.a.mark((function e(t){var n,r,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.setup();case 2:if(n=y(t)){e.next=5;break}throw new u.b("user should not be null");case 5:return e.next=7,v.createUploadUrl({shareablePath:!0});case 7:return r=e.sent,o=Object(l.b)(r.uploadUrl),e.next=11,o.uploadData(n.uploadUrl);case 11:return e.abrupt("return",{shareCode:r.uploadUrl.relativePath});case 12:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)}),addUserFromShareCode:(e=Object(o.a)(a.a.mark((function e(t){var n,r,o,i;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("addUserFromShareCode",{shareCode:t}),e.next=3,v.createUploadUrl({shareablePath:!0});case 3:return n=e.sent,r=n.uploadUrl.getUrl.replace(n.uploadUrl.relativePath,t.toUpperCase()),e.next=7,Object(l.c)(r);case 7:if((o=e.sent).putUrl){e.next=11;break}throw console.log("addUserFromShareCode - FAILED TO GET PROFILE"),new u.b("Failed to get user profile");case 11:if(i=b.getUserDataServiceState()){e.next=15;break}throw console.log("addUserFromShareCode - NO STATE"),new u.b("UserDataService is not setup");case 15:if(!i.userProfiles.find((function(e){return e.key===o.relativePath}))){e.next=18;break}return console.log("addUserFromShareCode - ALREADY HAS USER",{userKey:o.relativePath}),e.abrupt("return");case 18:return i.userProfiles.push({key:o.relativePath,name:"Player "+(i.userProfiles.length+1),uploadUrl:o}),b.setUserDataServiceState(i),console.log("addUserFromShareCode - ADDED",{userKey:o.relativePath}),e.next=23,_(o.relativePath);case 23:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})})),m.instance}}},zkcw:function(e,t,n){"use strict";n.d(t,"b",(function(){return o}));var r=n("fGyu"),a=n("eCSs");n.d(t,"a",(function(){return a.a}));n("4cHy"),n("+tC1"),n("hsFx");var o=function(e){return String.fromCharCode.apply(String,Object(r.a)(Object(r.a)(new Array(e)).map((function(e){return 94*Math.random()+32}))))}},zurd:function(e,t,n){"use strict";n.d(t,"a",(function(){return j}));var r=n("ERkP"),a=n.n(r),o=n("DTYs"),i=(n("xrQq"),n("kNg/"),n("E2zO"),n("fGyu")),s=n("hsFx"),l=n("AJkQ"),u=n("n5u1");n("k00s"),n("pjuZ"),n("Vwau"),n("4nvH");function c(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=function(e,t,n){var r=function(e){var t=new l.a(e,0,e.length).splitOnRegExp(/<[^>]*>/g).filter((function(e){return e.length>0})).map((function(e){var t=e.indexOf(">");if(t<0)return{raw:e,tag:e,code:e};var n=t-e.start+1;return{raw:e,tag:e.newRange(e.start,n),code:e.newRange(t+1,e.length-n)}})),n=[],r=t.map((function(e){return e.tag.startsWith("</")?n.pop():e.tag.startsWith("<")&&n.push(e.tag),Object.assign({},e,{context:[].concat(n)})})).map((function(e){var t=e.context.map((function(e){var t=e.splitOnRegExp(/class=('|")/g);if(t.length<=1)return{raw:e,cParts:t};var n=t[1].splitOnRegExp(/('|")/g),r=n[1].trimStart(['"',"'"]);return r?{raw:e,cParts:t,classContentParts:n,classContent:r.toText(),classes:r.toText().split(" ").filter((function(e){return e})).map((function(e){return e}))}:{raw:e,cParts:t,classContentParts:n}}));return Object.assign({},e,{classInfos:t,classes:Object(s.a)(t.flatMap((function(e){var t;return null!==(t=e.classes)&&void 0!==t?t:[]})))})})),a=r.map((function(e){return{code:e.code.toText().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),classes:e.classes}})).filter((function(e){return e.code}));return console.log("parseHighlightedSpans",{codeWithClasses:a,tagsWithClasses:r,summary:a.map((function(e){return"<span class='"+e.classes.join(" ")+"'>"+e.code+"</span>"})).join("")}),a}(Object(u.highlight)(e,u.languages[t],t)),a=0,o=r.map((function(t){var n={code:t.code,classes:t.classes,index:a,length:t.code.length,indexAfterEnd:a+t.code.length,_rawCode:e.substr(a,t.code.length)};return a+=t.code.length,n}));o.some((function(e){return e.code!==e._rawCode}))&&console.error("getCodeParts FAILED",{codeParts:r,codePartsFailed:o.filter((function(e){return e.code!==e._rawCode}))});var i=null!=n?n:{index:0,length:e.length},c=m(o.map((function(e){return Object.assign({},e,{isInSelection:!0,indexAfterEnd:e.index+e.length})})),i,(function(e,t){return Object.assign({},e,{isInSelection:t})}));return console.log("getCodeParts",{codePartsAll:c,code:e,selection:n}),c.some((function(t){return t.code!==e.substr(t.index,t.length)}))&&console.error("getCodeParts FAILED",{codeParts:r,codePartsFailed:o.filter((function(e){return e.code!==e._rawCode}))}),{codeFocus:e.substr(i.index,i.length),codeParts:c,selection:n}},m=function(e,t,n){for(var r,a=Object.assign({},t,{indexAfterEnd:t.index+t.length}),o=[],s=c(e);!(r=s()).done;){var l=r.value;if(l.indexAfterEnd<a.index)o.push(n(l,!1));else if(l.index>a.indexAfterEnd)o.push(n(l,!1));else if(l.index>=a.index&&l.indexAfterEnd<=a.indexAfterEnd)o.push(n(l,!0));else{var u=l.index<a.index,d=l.indexAfterEnd>a.indexAfterEnd,f=u?a.index-l.index:0,m=d?a.indexAfterEnd-l.index:l.length,h=l.code.substr(0,f),p=l.code.substr(f,m-f),g=l.code.substr(m,l.length-m);o.push.apply(o,Object(i.a)([n(Object.assign({},l,{code:h,index:l.index,length:f}),!1),n(Object.assign({},l,{code:p,index:l.index+f,length:m-f}),!0),n(Object.assign({},l,{code:g,index:l.index+m,length:l.length-m}),!1)].filter((function(e){return e.length>0}))))}}return o},h=function(e,t){var n,r,a=e.codeParts,o=e.selection;if(!o||null==t||o.length===t.length)return null;var l=a.findIndex((function(e){return e.index>o.index+t.length})),u=l<0?a.length:l,c=null===(n=a[u-1])||void 0===n?void 0:n.code,d=null===(r=a[u-1])||void 0===r?void 0:r.index;if(null==c||!c.trim())return null;var f=t.length+o.index-d,m=c.substr(0,f),h=Object(s.a)(a.filter((function(e){return!!m&&e.code.startsWith(m)||!m&&(t=e.code,n=c,!(!/^\d+$/g.test(t)||!/^\d+$/g.test(n))||!(!/^\w+$/g.test(t)||!/^\w+$/g.test(n))||!(!/^\W+$/g.test(t)||!/^\W+$/g.test(n)));var t,n})).map((function(e){return e.code})).filter((function(e){return e!==c})).filter((function(e){return!!e.trim()}))),p=[c].concat(Object(i.a)(Object(s.f)(h).slice(0,3))).map((function(e){return{textCompleted:e.substr(0,f),text:e.substr(f)}}));return console.log("updateAutoComplete",{iDone:d,activePartText:c,codeFocusCompleted:t,codeParts:a,activePartTextCompleted:m,matchWords:h,choices:p}),{choices:Object(s.f)(p).map((function(e,t){return Object.assign({},e,{isSelected:0===t,isWrong:!1})})),activeIndex:d}},p=function(e){var t=e.codeParts,n=e.language,i=e.inputOptions,s=Object(r.useMemo)((function(){var e;return a.a.createElement(v,{isActive:null!==(e=null==i?void 0:i.isActive)&&void 0!==e&&e})}),[null==i?void 0:i.isActive]);return console.log("CodeDisplay",{inputOptions:i,codeParts:t}),a.a.createElement(o.h,null,a.a.createElement("pre",{style:{margin:0,paddingBottom:i?100:0},className:"language-"+n},a.a.createElement("code",{className:"language-"+n},a.a.createElement(g,{key:"-1",code:{code:"\n",index:-1,indexAfterEnd:0,length:1,classes:[],isInSelection:!1},Cursor:s,inputOptions:null!=i?i:{}}),t.map((function(e){return a.a.createElement(g,{key:e.code+":"+e.index+":"+e.code.length,code:e,Cursor:s,inputOptions:null!=i?i:{}})})))))},g=function(e){var t=e.code,n=e.Cursor,r=e.inputOptions,i=r.cursorIndex,s=r.activeIndex,l=void 0===s?r.cursorIndex:s,u=r.promptIndex,c=!!(null!=i&&i>=t.index&&i<t.index+t.code.length),d=!!(null!=l&&l>=t.index&&l<t.index+t.code.length),f=!!(null!=u&&u>=t.index&&u<t.index+t.code.length);return a.a.createElement(a.a.Fragment,null,c&&n,d&&a.a.createElement(a.a.Fragment,null,a.a.createElement(y,{inputOptions:r})),f&&a.a.createElement(a.a.Fragment,null,a.a.createElement(w,{inputOptions:r})),!t.onPress&&a.a.createElement("span",{className:t.classes.join(" "),style:t.isInSelection?{}:{opacity:.5}},""+t.code),t.onPress&&a.a.createElement(o.g,{style:{display:"inline"},onPress:function(){var e;return null===(e=t.onPress)||void 0===e?void 0:e.call(t,t)}},a.a.createElement("span",{className:t.classes.join(" "),style:t.isInSelection?{}:{opacity:.5}},""+t.code)))},v=function(e){var t=e.isActive,n=Object(r.useState)(!0),o=n[0],i=n[1];return Object(r.useEffect)((function(){var e=setInterval((function(){i((function(e){return!e}))}),500);return function(){clearInterval(e)}}),[]),a.a.createElement("span",{style:{display:"inline-block",width:0,margin:0,position:"relative",left:-4,opacity:t?1:.5}},o?" ":"|")},b={wrapper:{display:"inline-block",position:"relative",top:4,width:0},inner:{display:"block",position:"absolute",zIndex:100,background:"#000000",border:"solid 1 #CCCCFF"},item:{display:"block",padding:4,color:"#FFFFFF"},item_selected:{display:"block",padding:4,color:"#CCCCFF",background:"#111133",minWidth:60},textCompleted:{color:"#CCCCFF",opacity:.5},textNew:{color:"#CCCCFF"}},y=function(e){var t=e.inputOptions,n=t.autoComplete;if(!n)return a.a.createElement(a.a.Fragment,null);var r=b;return console.log("AutoCompleteComponent",{autoComplete:n}),a.a.createElement(a.a.Fragment,null,a.a.createElement("span",{style:r.wrapper},a.a.createElement("span",{style:r.inner},n.map((function(e){return a.a.createElement(o.g,{key:e.text,onPress:function(){var n;null===(n=t.onAutocomplete)||void 0===n||n.call(t,e.text)}},a.a.createElement("span",{style:e.isSelected?r.item_selected:r.item},a.a.createElement("span",{style:r.textCompleted},e.isWrong?"❌ ":"",e.textCompleted),a.a.createElement("span",{style:r.textNew},e.text)))})))))},x={wrapper:{position:"relative",background:"#111111",margin:4,padding:4,marginLeft:20,borderRadius:4,border:"1px solid #555555",marginBottom:-16},text:{whiteSpace:"pre-wrap"},text_positive:{whiteSpace:"pre-wrap",color:"#88FF88"},text_negative:{whiteSpace:"pre-wrap",color:"#FF8888"},emoji:{position:"absolute",fontSize:20,left:-24,top:0}},w=function(e){var t=e.inputOptions,n=t.prompt,o=t.feedback,i=Object(r.useState)(!0),s=i[0],l=i[1];Object(r.useEffect)((function(){var e;l(!1);var t=setTimeout((function(){l(!0)}),null!==(e=null==o?void 0:o.timeoutMs)&&void 0!==e?e:3e3);return function(){clearTimeout(t)}}),[o]);var u=o&&!s,c=x,d=u&&o?o.isNegative?c.text_negative:c.text_positive:c.text,f=u?o:n;return f?a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{style:c.wrapper},a.a.createElement("div",{style:c.emoji},f.emoji),a.a.createElement("span",{style:d},f.message))):a.a.createElement(a.a.Fragment,null)},E=n("pVhY"),_=n("4cHy"),S="😎 😁 😆 🤓 🐱‍🏍 🐱‍🐉 🐱‍🚀 🐱‍👤".split(" "),O="😥 😪 😫 😝 😲 🙀 😾 😿".split(" "),C=function(e){var t,n=e.code,s=e.language,l=e.selection,u=e.onDone,c=e.lessonData,d=Object(r.useState)(null),g=d[0],v=d[1],b=Object(r.useRef)(null);Object(r.useEffect)((function(){var e=f(n,s,l);v(e),P(null);var t=setTimeout((function(){var e;null===(e=b.current)||void 0===e||e.focus()}),250);return function(){clearTimeout(t)}}),[n]);var y=Object(r.useState)(""),x=y[0],w=y[1],E=Object(r.useState)(!1),C=E[0],T=E[1],k=Object(r.useState)(null),j=k[0],F=k[1],A=Object(r.useState)(null),D=A[0],P=A[1];Object(r.useEffect)((function(){var e=setTimeout((function(){var e=null==g?void 0:g.codeFocus.substr(x.length).trim()[0];e&&F((function(t){return{message:"⬇ Type: "+e,emoji:"😀",timestamp:Date.now(),timeoutMs:5e3}}))}),5e3);return function(){clearTimeout(e)}}),[g,x]);var R=function(e){var t,n;if(g){var r=g.codeFocus,a=e.substr(x.length),o=e.length<x.length,i=e.endsWith("\t"),s=e.endsWith("\n"),l=e.endsWith("."),c=e.endsWith(" "),d=r.substr(x.length),f=d.trimStart()!==d,m=r.startsWith(e),p=D&&!m&&(i||s||l||c),v=null==D?void 0:D.choices.find((function(e){return e.isSelected})),y=m?e:p?x+(null!==(t=null==v?void 0:v.text)&&void 0!==t?t:""):(s||i||c)&&f?r.substr(0,r.length-d.trimStart().length):e,E=d.trimStart().startsWith(a),C=E?r.substr(0,r.length-d.trimStart().length+a.length):y,k=r.startsWith(C);if(console.log("changeInputText",{wasBackspace:o,wasTab:i,wasReturn:s,wasPeriod:l,wasSpace:c,wasCorrectRaw:m,wasAutoComplete:p,activeAutoComplete:v,value:C,value2:y,valueRaw:e,codeFocus:r,remaining:d,isWhitespace:f,wasCorrect:k,wasCorrect_ignoreWhitespace:E}),r!==x)if(o)F({isNegative:!0,emoji:Object(_.b)(O),message:"❌ You're right so far, no need to backspace.",timestamp:Date.now()});else if(k){var j=r===C;j&&u(),T(!0),w(C),F(j?{emoji:Object(_.b)(S),message:"✔",timestamp:Date.now()}:null);var A=h(g,C);P(A),null===(n=b.current)||void 0===n||n.focus()}else{if(p&&v&&(v.isWrong=!0),!v){var R=h(g,x);P(R)}F({isNegative:!0,emoji:Object(_.b)(O),message:"❌ "+Object(_.b)(["Wrong","Incorrect","No","Try Again"]),timestamp:Date.now()})}else F({emoji:Object(_.b)(S),message:"✔ You're already done.",timestamp:Date.now()})}};if(!g||!n)return a.a.createElement(a.a.Fragment,null);var L=null!=l?l:{index:0,length:n.length},M=L.index+x.length,U=null!==(t=null==D?void 0:D.activeIndex)&&void 0!==t?t:M,I=n.lastIndexOf("\n",n.lastIndexOf("\n",L.index)-1),N=function(e,t,n){var r=m(e,t,(function(e,t){return Object.assign({},e,{isIncomplete:t})}));return null!=n&&n.showBlank?r.map((function(e){return Object.assign({},e,{code:e.isIncomplete?e.code.replace(/./g," "):e.code})})):r.filter((function(e){return!e.isIncomplete}))}(g.codeParts,{index:M,length:g.codeFocus.length-x.length},{showBlank:!0}),B=n.substr(M,1),V={emoji:"👨‍💻",message:c.task,timestamp:Date.now()};return console.log("CodeEditor_TypeSelection",{nextChar:B,inputText:x,codeParts:g,activeCodeParts:N,isActive:C,cursorIndex:M,activeIndex:U,feedback:j,autoComplete:null==D?void 0:D.choices}),a.a.createElement(a.a.Fragment,null,a.a.createElement(o.g,{onPress:function(){var e;return null===(e=b.current)||void 0===e?void 0:e.focus()}},a.a.createElement(o.h,{style:{position:"relative"}},a.a.createElement(o.h,null,a.a.createElement(p,{codeParts:N,language:s,inputOptions:{isActive:C,cursorIndex:M,activeIndex:U,promptIndex:I,feedback:null!=j?j:void 0,prompt:null!=V?V:void 0,autoComplete:null==D?void 0:D.choices,onAutocomplete:function(e){if(D){D.choices.forEach((function(e){e.isSelected=!1}));var t=D.choices.find((function(t){return t.text===e}));t&&(t.isSelected=!0,R(x+e))}}}})),a.a.createElement(o.h,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,opacity:0}},a.a.createElement("textarea",{style:{width:"100%",height:"100%",background:"#FF0000"},value:x,onChange:function(e){return R(e.target.value)},onFocus:function(){return T(!0)},onBlur:function(){return T(!1)},onKeyDown:function(e){return function(e){return 9===e.keyCode?(e.preventDefault(),e.stopPropagation(),R(x+"\t"),!1):13===e.keyCode?(e.preventDefault(),e.stopPropagation(),R(x+"\n"),!1):(38===e.keyCode&&P((function(e){if(!e)return null;var t=e.choices.findIndex((function(e){return e.isSelected})),n=Math.max(0,t-1);return Object.assign({},e,{choices:Object(i.a)(e.choices.map((function(e,t){return Object.assign({},e,{isSelected:n===t})})))})})),40===e.keyCode&&P((function(e){if(!e)return null;var t=e.choices.findIndex((function(e){return e.isSelected})),n=Math.min(e.choices.length-1,t+1);return Object.assign({},e,{choices:Object(i.a)(e.choices.map((function(e,t){return Object.assign({},e,{isSelected:n===t})})))})})),!0)}(e)},ref:b})))))},T=function(e){var t=e.code,n=e.language,i=e.selection,s=e.onDone,l=e.lessonData,u=Object(r.useState)(null),c=u[0],d=u[1],m=Object(r.useState)(null),h=m[0],g=m[1],v=Object(r.useState)(null),b=v[0],y=v[1],x=Object(r.useState)(null),w=x[0],E=x[1];Object(r.useEffect)((function(){var e,r=f(t,n,i);d(r);var a=l.descriptions.map((function(e){var t=e;return r.codeParts.filter((function(e){return e.isInSelection})).map((function(e){return e.code.trim()})).filter((function(e){return!!e})).forEach((function(e){t=t.replace(" "+e+" "," ___ ")})),console.log("LessonFileContentEditor_UnderstandCode - create fill in blank",{parts:r,d:t,x:e}),{textWithBlanks:t,textWithoutBlanks:e}}));g(a),y(null!==(e=a[0])&&void 0!==e?e:null)}),[t]);var C=function(e){if(b&&h){var t=b.textWithBlanks.indexOf("___"),n=b.textWithBlanks.replace("___",e.code.trim()),r=n.startsWith(b.textWithoutBlanks.substr(0,t+e.length));if(console.log("onPressCodePart",{part:e,iBlank:t,withoutBlank:n,isCorrect:r,fillInBlank:b}),r){if(E({emoji:Object(_.b)(S),message:"✔",timestamp:Date.now(),timeoutMs:1e3}),!n.includes("___")){var a,o=h.filter((function(e){return e.textWithoutBlanks!==b.textWithoutBlanks}));return g(o),y(null!==(a=o[0])&&void 0!==a?a:null),void(o.length<=0&&s())}y({textWithoutBlanks:b.textWithoutBlanks,textWithBlanks:n})}else E({isNegative:!0,emoji:Object(_.b)(O),message:"❌ "+Object(_.b)(["Wrong","Incorrect","No","Try Again"]),timestamp:Date.now()})}};if(!c)return a.a.createElement(a.a.Fragment,null);var T=null!=i?i:{index:0,length:t.length},k=t.lastIndexOf("\n",t.lastIndexOf("\n",T.index)-1),j=c.codeParts.map((function(e){return Object.assign({},e,{onPress:C})})),F={emoji:b?"🤔":Object(_.b)(S),message:b?b.textWithBlanks+"\r\n\r\n🔎 Select the correct word below":""+l.descriptions.map((function(e){return"✅ "+e})).join("\r\n"),timestamp:Date.now()};return console.log("LessonFileContentEditor_UnderstandCode render",{fillInBlank:b,activePrompt:F}),a.a.createElement(a.a.Fragment,null,a.a.createElement(o.h,{style:{position:"relative"}},a.a.createElement(o.h,null,a.a.createElement(p,{codeParts:j,language:n,inputOptions:{prompt:F,promptIndex:k,feedback:null!=w?w:void 0}}))))},k=n("Nm1O"),j=function(e){var t,n,o=e.projectData,i=e.projectEditorMode,s=e.fileEditorMode_focus,l=e.fileEditorMode_noFocus,u=e.onProjectDataChange,c=void 0===u?function(){}:u,d=e.onTaskDone,f=void 0===d?function(){}:d,m=e.lessonData,h=o.projectState,p=o.focus,g=Object(r.useState)(p.filePath),v=g[0],b=g[1],y=Object(r.useRef)(null);Object(r.useEffect)((function(){var e,t,n,r,a=h.files.find((function(e){return e.path===p.filePath}));if(h.files.length>0&&(!a||p.length<=0||p.index>=(null!==(e=null==a?void 0:a.content.length)&&void 0!==e?e:0))&&y.current!==p){var o,i=null!==(o=h.files.find((function(e){return e.path===p.filePath})))&&void 0!==o?o:h.files[0],s={filePath:i.path,index:0,length:i.content.length};return y.current=s,void c({focus:s})}var l=null!==(t=null!==(n=null==a?void 0:a.path)&&void 0!==n?n:null===(r=h.files[0])||void 0===r?void 0:r.path)&&void 0!==t?t:void 0;b(l)}),[h,p]);console.log("ProjectCodeEditor",{activeFilePath:v,focus:p,projectState:h});var x=null!==(t=null!==(n=h.files.find((function(e){return e.path===v})))&&void 0!==n?n:h.files[0])&&void 0!==t?t:void 0;return a.a.createElement(a.a.Fragment,null,a.a.createElement(E.b,{header:"Files",items:h.files,onChange:"edit"!==i?void 0:function(e){return c({projectState:{files:e,filesHashCode:Object(k.a)(e)}})},getKey:function(e){return e.path},getLabel:function(e){return p.filePath===e.path?"📝 "+e.path:e.path},selected:x,onSelect:function(e){return b(e.path)},onCreateNewItem:function(){for(var e="new.ts",t=1;h.files.some((function(t){return t.path===e}));)e="new"+t+".ts",t++;return{path:e,content:"",language:"tsx"}}}),x&&a.a.createElement(F,{key:x.path,projectEditorMode:i,file:x,selection:p.filePath===x.path?p:void 0,fileEditorMode:p.filePath===x.path?s:l,onChange:function(e){var t=h.files.map((function(t){return t.path===e.path?e:t}));c({projectState:{files:t,filesHashCode:Object(k.a)(t)}})},onSelectionChange:function(e){var t=h.files.find((function(e){return e.path===v}));if(t){console.log("changeSelection",Object.assign({},e));var n=t;c({focus:Object.assign({filePath:n.path},e)})}},onTaskDone:f,lessonData:m}))},F=function(e){var t=e.projectEditorMode,n=e.fileEditorMode,i=e.file,s=e.onChange,l=e.selection,u=e.onSelectionChange,c=e.onTaskDone,d=e.lessonData,f=Object(r.useState)(i.path),m=f[0],h=f[1];return a.a.createElement(a.a.Fragment,null,"edit"===t&&a.a.createElement(o.h,{style:{flexDirection:"row"}},a.a.createElement(o.f,{style:{padding:4,fontSize:12,color:"#FFFFFF",background:"#000000"},value:m,onChange:h,onBlur:function(){i.path=m,s(Object.assign({},i,{path:m}))},autoCompleteType:"off",keyboardType:"default"})),a.a.createElement(A,{file:i,onCodeChange:function(e){return s(Object.assign({},i,{content:e}))},mode:n,selection:l,onSelectionChange:u,onTaskDone:c,lessonData:d}))},A=function(e){var t=e.file,n=e.selection,r=e.mode,i=e.onCodeChange,s=e.onSelectionChange,l=e.onTaskDone,u=e.lessonData;return a.a.createElement(o.h,{style:{}},a.a.createElement(o.h,{style:{padding:0}},"display"===r&&a.a.createElement(D,{code:t.content,language:t.language,selection:n}),"edit"===r&&a.a.createElement(P,{code:t.content,language:t.language,selection:n,onCodeChange:i,onSelectionChange:s}),"construct-code"===r&&a.a.createElement(C,{code:t.content,language:t.language,selection:n,onDone:l,lessonData:u}),"understand-code"===r&&a.a.createElement(T,{code:t.content,language:t.language,selection:n,onDone:l,lessonData:u})))},D=function(e){var t=e.code,n=e.language,r=e.selection,o=f(t,n,r);return a.a.createElement(p,{codeParts:o.codeParts,language:n})},P=function(e){var t=e.code,n=e.language,i=e.selection,s=e.onCodeChange,l=e.onSelectionChange,u=Object(r.useState)(t),c=u[0],d=u[1],m=Object(r.useState)(null),h=m[0],g=m[1];return Object(r.useEffect)((function(){var e=f(t,n,i);g(e)}),[t,i]),a.a.createElement(o.h,null,a.a.createElement(o.h,{style:{}},a.a.createElement(o.f,{style:{padding:4,fontSize:12,color:"#FFFFFF",background:"#000000"},value:c,onChange:function(e){d(e);var r=f(t,n,i);g(r)},onBlur:function(){d(c);var e=f(t,n,i);g(e),s(c)},autoCompleteType:"off",keyboardType:"default",multiline:!0,numberOfLines:16,onSelectionChange:function(e){return l({index:e.start,length:e.end-e.start})}})),a.a.createElement(o.h,null,h&&a.a.createElement(p,{codeParts:h.codeParts,language:n})))}}}]);
  //# sourceMappingURL=commons-90739619948c8361e032.js.map