pxt-core 7.2.10 → 7.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/pxt.js +5 -4
- package/built/pxteditor.d.ts +6 -1
- package/built/pxteditor.js +4 -0
- package/built/pxtlib.js +5 -4
- package/built/pxtrunner.js +8 -3
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxteditor.js +1 -1
- package/built/web/pxtembed.js +1 -1
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtrunner.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlsemantic.css +2 -2
- package/built/web/semantic.css +2 -2
- package/built/web/skillmap/css/{main.3ebf2087.chunk.css → main.9d95a1b2.chunk.css} +1 -1
- package/built/web/skillmap/js/main.0408feb7.chunk.js +1 -0
- package/package.json +1 -1
- package/theme/common-components.less +10 -0
- package/theme/keymap.less +16 -8
- package/theme/themes/pxt/collections/menu.overrides +13 -0
- package/theme/themes/pxt/globals/site.variables +2 -0
- package/theme/tutorial-sidebar.less +70 -11
- package/webapp/public/skillmap.html +2 -2
- package/built/web/skillmap/js/main.1de8694a.chunk.js +0 -1
|
@@ -41,6 +41,31 @@
|
|
|
41
41
|
span.docs.inlineblock {
|
|
42
42
|
white-space: break-spaces;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
p {
|
|
46
|
+
line-height: 1.5em;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/*******************************
|
|
51
|
+
Exit Tutorial
|
|
52
|
+
*******************************/
|
|
53
|
+
|
|
54
|
+
.tutorial-exit {
|
|
55
|
+
position: absolute;
|
|
56
|
+
margin-right: 1rem;
|
|
57
|
+
top: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
color: @white;
|
|
60
|
+
font-family: @segoeUIFont;
|
|
61
|
+
font-size: @smallFontSize;
|
|
62
|
+
text-transform: uppercase;
|
|
63
|
+
line-height: 3.5rem;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tutorial-exit:hover {
|
|
68
|
+
text-decoration: underline;
|
|
44
69
|
}
|
|
45
70
|
|
|
46
71
|
/*******************************
|
|
@@ -62,6 +87,21 @@
|
|
|
62
87
|
margin-right: 0.5rem;
|
|
63
88
|
}
|
|
64
89
|
|
|
90
|
+
.tutorial-step-label {
|
|
91
|
+
display: flex;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tutorial-step-title {
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
text-overflow: ellipsis;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tutorial-step-number {
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
margin-left: 0.5rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
65
105
|
.tutorial-step-bar {
|
|
66
106
|
height: 1rem;
|
|
67
107
|
overflow: hidden;
|
|
@@ -97,8 +137,8 @@
|
|
|
97
137
|
margin-bottom: 1rem;
|
|
98
138
|
|
|
99
139
|
.ui.button {
|
|
100
|
-
margin: 0
|
|
101
|
-
color: @
|
|
140
|
+
margin: 0 1rem;
|
|
141
|
+
color: @white;
|
|
102
142
|
background: @tutorialPrimaryColor;
|
|
103
143
|
font-size: @tutorialFontSize;
|
|
104
144
|
white-space: nowrap;
|
|
@@ -134,7 +174,7 @@
|
|
|
134
174
|
top: unset;
|
|
135
175
|
right: unset;
|
|
136
176
|
bottom: 11rem;
|
|
137
|
-
left:
|
|
177
|
+
left: 3rem;
|
|
138
178
|
max-width: 50%;
|
|
139
179
|
}
|
|
140
180
|
|
|
@@ -183,6 +223,9 @@
|
|
|
183
223
|
background-color: @tutorialPrimaryColor;
|
|
184
224
|
line-height: 2.5rem;
|
|
185
225
|
}
|
|
226
|
+
.formatted-bullet-ul .formatted-bullet-li:last-child {
|
|
227
|
+
min-height: 3.5rem;
|
|
228
|
+
}
|
|
186
229
|
.formatted-bullet-ul .formatted-bullet-li:last-child .formatted-bullet:after {
|
|
187
230
|
content: " ";
|
|
188
231
|
position: absolute;
|
|
@@ -203,6 +246,7 @@
|
|
|
203
246
|
.tab-simulator .simPanel {
|
|
204
247
|
height: 100%;
|
|
205
248
|
padding: 1rem 0.5rem 1rem 1rem;
|
|
249
|
+
margin-top: 0;
|
|
206
250
|
overflow-x: hidden;
|
|
207
251
|
overflow-y: scroll;
|
|
208
252
|
}
|
|
@@ -219,7 +263,13 @@
|
|
|
219
263
|
#boardview { display: inline-block; }
|
|
220
264
|
|
|
221
265
|
.simtoolbar, #miniSimOverlay { display: block; }
|
|
222
|
-
.
|
|
266
|
+
.sidebar-button, .play-button { display: block !important; }
|
|
267
|
+
.expand-button, .fullscreen-button { display: none !important; }
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
.tab-simulator.tab-content:not(.hidden) {
|
|
271
|
+
.simPanel {
|
|
272
|
+
.sidebar-button { display: none !important; }
|
|
223
273
|
}
|
|
224
274
|
}
|
|
225
275
|
}
|
|
@@ -260,18 +310,18 @@
|
|
|
260
310
|
}
|
|
261
311
|
}
|
|
262
312
|
|
|
263
|
-
|
|
264
313
|
/*******************************
|
|
265
|
-
|
|
314
|
+
Keymap
|
|
266
315
|
*******************************/
|
|
267
316
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
.tab-tutorial .tutorialhint {
|
|
271
|
-
left: 2rem;
|
|
272
|
-
}
|
|
317
|
+
.tutorialVertical .keymap.above {
|
|
318
|
+
top: calc(5.5rem + @mainMenuHeight);
|
|
273
319
|
}
|
|
274
320
|
|
|
321
|
+
/*******************************
|
|
322
|
+
Media Adjustments
|
|
323
|
+
*******************************/
|
|
324
|
+
|
|
275
325
|
/* <= Tablet (Mobile + Tablet) */
|
|
276
326
|
@media only screen and (max-width: @largestTabletScreen) {
|
|
277
327
|
#root.tutorialVertical,
|
|
@@ -302,6 +352,15 @@
|
|
|
302
352
|
padding: 1rem;
|
|
303
353
|
}
|
|
304
354
|
|
|
355
|
+
/*******************************
|
|
356
|
+
Exit Tutorial
|
|
357
|
+
*******************************/
|
|
358
|
+
|
|
359
|
+
.tab-simulator.hidden .tutorial-exit {
|
|
360
|
+
// Shift in tutorial tab to make space for step counter
|
|
361
|
+
right: 14rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
305
364
|
/*******************************
|
|
306
365
|
Tutorial Top Buttons
|
|
307
366
|
*******************************/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>MakeCode Skill Map</title>
|
|
7
7
|
<link rel="stylesheet" data-rtl="/blb/rtlsemantic.css" href="/blb/semantic.css">
|
|
8
8
|
<link rel="stylesheet" href="/blb/icons.css">
|
|
9
|
-
<link href="/blb/skillmap/css/main.
|
|
9
|
+
<link href="/blb/skillmap/css/main.9d95a1b2.chunk.css" rel="stylesheet"></head>
|
|
10
10
|
<body>
|
|
11
11
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
12
12
|
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
<!-- end usabilla live embed code -->
|
|
28
28
|
|
|
29
29
|
<!-- @include thin-footer.html -->
|
|
30
|
-
<script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this.webpackJsonpskillsmap=this.webpackJsonpskillsmap||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/blb/skillmap/js/2.fbe3f08f.chunk.js"></script><script src="/blb/skillmap/js/main.
|
|
30
|
+
<script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this.webpackJsonpskillsmap=this.webpackJsonpskillsmap||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/blb/skillmap/js/2.fbe3f08f.chunk.js"></script><script src="/blb/skillmap/js/main.0408feb7.chunk.js"></script></body>
|
|
31
31
|
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(this.webpackJsonpskillsmap=this.webpackJsonpskillsmap||[]).push([[0],{41:function(e,t,a){},42:function(e,t,a){},43:function(e,t,a){},44:function(e,t,a){},45:function(e,t,a){},46:function(e,t,a){},47:function(e,t,a){},48:function(e,t,a){},49:function(e,t,a){"use strict";a.r(t);var r,n,i=a(0),o=a.n(i),c=a(23),s=a.n(c),l=a(8),u=a(17),d=a(9),p=a(1),h="ADD_SKILL_MAP",v="CLEAR_SKILL_MAPS",m="CLEAR_METADATA",f="CHANGE_SELECTED_ITEM",y="SET_SKILL_MAP_COMPLETED",b="SET_HEADERID_FOR_ACTIVITY",g="OPEN_ACTIVITY",k="CLOSE_ACTIVITY",I="SAVE_AND_CLOSE_ACTIVITY",O="RESTART_ACTIVITY",S="SET_USER",w="UPDATE_USER_COMPLETED_TAGS",C="RESET_USER",x="SET_PAGE_TITLE",j="SET_PAGE_DESCRIPTION",E="SET_PAGE_INFO_URL",A="SET_PAGE_BACKGROUND_IMAGE_URL",N="SET_PAGE_BANNER_IMAGE_URL",U="SET_PAGE_THEME",P="SET_PAGE_SOURCE_URL",M="SET_PAGE_ALTERNATE_URLS",T="SHOW_COMPLETION_MODAL",L="SHOW_RESTART_ACTIVITY_MODAL",R="SHOW_REPORT_ABUSE_MODAL",_="SHOW_RESET_USER_MODAL",H="SHOW_CARRYOVER_MODAL",B="SHOW_SHARE_MODAL",D="SHOW_LOGIN_MODAL",F="SHOW_LOGIN_PROMPT",V="SHOW_DELETE_ACCOUNT_MODAL",W="HIDE_MODAL",G="SET_USER_PROFILE",z="SET_USER_PREFERENCES",q="USER_LOG_OUT",Y="SHOW_USER_PROFILE",K="HIDE_USER_PROFILE",$="SET_SHARE_STATUS",Q="SET_CLOUD_STATUS",J=a(2),X=a.n(J),Z=a(3),ee="-SHOWN-LOGIN-PROMPT";function te(e){var t={cmd:"",arg:""},a=/^(\w+)(:([:./\-+=\w]+))?/.exec((e||window.location.hash).replace(/^#/,""));return a&&(t={cmd:a[1],arg:a[3]||""}),t}function ae(){var e={},t=window.location.search;return t&&new URLSearchParams(t).forEach((function(t,a){"true"!==t.toLowerCase()&&"1"!==t||(t="true"),e[a]=t})),e}function re(e,t){return ne.apply(this,arguments)}function ne(){return(ne=Object(Z.a)(X.a.mark((function e(t,a){var r,n,i;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&a){e.next=2;break}return e.abrupt("return",void 0);case 2:n="unknown",e.t0=t,e.next="docs"===e.t0?6:"github"===e.t0?9:"local"===e.t0?12:15;break;case 6:return r=le(a),n="approved",e.abrupt("break",17);case 9:return e.next=11,ie(a);case 11:return e.abrupt("return",e.sent);case 12:return e.next=14,ce(a);case 14:return e.abrupt("return",e.sent);case 15:return r=a,e.abrupt("break",17);case 17:if(!pxt.BrowserUtils.isSafari()){e.next=31;break}return e.prev=18,e.next=21,pe(r);case 21:i=e.sent,e.next=29;break;case 24:return e.prev=24,e.t1=e.catch(18),e.next=28,pe(r);case 28:i=e.sent;case 29:e.next=34;break;case 31:return e.next=33,pe(r);case 33:i=e.sent;case 34:return e.abrupt("return",{text:i,identifier:r,status:n});case 35:case"end":return e.stop()}}),e,null,[[18,24]])})))).apply(this,arguments)}function ie(e){return oe.apply(this,arguments)}function oe(){return(oe=Object(Z.a)(X.a.mark((function e(t){var a,r,n,i,o,c,s,l,u,d,p;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=pxt.github.parseRepoId(t),e.next=3,pxt.packagesConfigAsync();case 3:r=e.sent,n=pxt.github.parseRepoId(a.slug),i=pxt.github.repoStatus(n,r),o="unknown",e.t0=i,e.next=e.t0===pxt.github.GitRepoStatus.Banned?10:e.t0===pxt.github.GitRepoStatus.Approved?13:16;break;case 10:return o="banned",c="https://github.com/"+a.fullName,e.abrupt("break",18);case 13:return o="approved",c=void 0,e.abrupt("break",18);case 16:return c="https://github.com/"+a.fullName,e.abrupt("break",18);case 18:if(e.t1=a.tag,e.t1){e.next=23;break}return e.next=22,pxt.github.latestVersionAsync(a.slug,r,!0);case 22:e.t1=e.sent;case 23:if(s=e.t1){e.next=27;break}return pxt.log("skillmap github tag not found at ".concat(a.fullName)),e.abrupt("return",void 0);case 27:return a.tag=s,e.next=30,pxt.github.downloadPackageAsync("".concat(a.slug,"#").concat(a.tag),r);case 30:if(!(l=e.sent)){e.next=34;break}return u=ue(a),d=u.identifier,p=u.fileName,e.abrupt("return",{text:pxt.tutorial.resolveLocalizedMarkdown(a,l.files,p),identifier:d,reportId:c,status:o});case 34:return e.abrupt("return",void 0);case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(e){return se.apply(this,arguments)}function se(){return(se=Object(Z.a)(X.a.mark((function e(t){var a,r;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!me()){e.next=9;break}return t=t.replace(/^\//,"").replace(/\.md$/,""),e.next=4,fetch("docs/"+t+".md");case 4:return a=e.sent,e.next=7,a.text();case 7:return r=e.sent,e.abrupt("return",{text:r,identifier:t,status:"approved"});case 9:return e.abrupt("return",void 0);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(e){var t;e=e.trim().replace(/^[\\/]/i,"").replace(/\.md$/i,"");var a=(null===(t=window.pxtTargetBundle)||void 0===t?void 0:t.name)||"arcade";return"".concat("https://www.makecode.com/api","/md/").concat(a,"/").concat(e)}function ue(e){var t=function(e){return(e=(e=e.replace(/^\/?blob\/main\//,"")).replace(/^\/?blob\/master\//,"")).replace(/\.md$/,"")}(e.fileName||"skillmap");return{identifier:e.fullName+"#"+t,fileName:t}}function de(){return(de=Object(Z.a)(X.a.mark((function e(t,a){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,he("/api/".concat(encodeURIComponent(t),"/abusereports"),a);case 3:return e.abrupt("return");case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pe(e){return new Promise((function(t,a){var r=new XMLHttpRequest;r.addEventListener("error",(function(e){a(e)})),r.addEventListener("load",(function(){try{t(r.responseText)}catch(e){a(e)}})),r.open("GET",e),r.send()}))}function he(e,t){return new Promise((function(a,r){var n=new XMLHttpRequest;n.addEventListener("error",(function(e){r(e)})),n.addEventListener("load",(function(){try{a(n.responseText)}catch(e){r(e)}})),n.open("POST",e,!0),n.setRequestHeader("Content-type","application/json"),n.send(JSON.stringify(t))}))}function ve(){function e(){return(65536|function(){var e=new Uint8Array(4);return function(e){if(window.crypto)window.crypto.getRandomValues(e);else for(var t=0;t<e.length;++t)e[t]=Math.floor(255*Math.random())}(e),new Uint32Array(e.buffer)[0]}()).toString(16).slice(-4)}return e()+e()+"-"+e()+"-4"+e().slice(-3)+"-"+e()+"-"+e()+e()+e()}function me(){return"localhost"===window.location.hostname}function fe(e){return"".concat(me()?"":"/static/skillmap","/").concat(e.replace(/^\//,""))}function ye(e){n=e}function be(e,t){var a,i;(t=t||{}).page=n,t.pageTitle=r,null===(a=(i=window).pxtTickEvent)||void 0===a||a.call(i,e,t)}var ge=a(10);function ke(e,t,a,r){return!Object.keys(null==a?void 0:a.activities).some((function(n){var i,o;return!(null===(i=Ce(e,t,a.mapId))||void 0===i||null===(o=i.activityState[n])||void 0===o?void 0:o.isCompleted)&&n!==r}))}function Ie(e,t,a,r){var n;return!!(null===(n=xe(e,t,a,r))||void 0===n?void 0:n.isCompleted)}function Oe(e,t,a,r){var n,i,o,c=e&&a&&we(e,t,a,r)?"notstarted":"locked";if(e)if(a&&t&&!function(e,t,a){var r,n=Object(ge.a)(t.prerequisites);try{for(n.s();!(r=n.n()).done;){var i=r.value;if("tag"===i.type){if(!e.completedTags[a])return!1;var o=e.completedTags[a][i.tag];if(void 0===o||o<i.numberCompleted)return!1}else if("map"===i.type&&!ke(e,a,t))return!1}}catch(e){n.e(e)}finally{n.f()}return!0}(e,a,t))c="locked";else{var s=xe(e,t,a.mapId,r);s&&(s.isCompleted?(c=s.currentStep&&s.maxSteps&&s.currentStep<s.maxSteps?"restarted":"completed",o=s.headerId):s.headerId&&(c="inprogress"),n=null==s?void 0:s.currentStep,i=null==s?void 0:s.maxSteps)}return{status:c,currentStep:n,maxSteps:i,completedHeadedId:o}}function Se(e,t,a){var r,n={},i=Object(ge.a)(a);try{for(i.s();!(r=i.n()).done;)for(var o=r.value,c=0,s=Object.keys(o.activities);c<s.length;c++){var l=s[c],u=o.activities[l];if(Ie(e,t,o.mapId,u.activityId)&&"activity"===u.kind){var d,p=Object(ge.a)(u.tags);try{for(p.s();!(d=p.n()).done;){var h=d.value;n[h]||(n[h]=0),n[h]++}}catch(e){p.e(e)}finally{p.f()}}}}catch(e){i.e(e)}finally{i.f()}return n}function we(e,t,a,r){return a.root.activityId===r||function n(i){if(Ie(e,t,a.mapId,i.activityId)){if(i.next.some((function(e){return e.activityId===r})))return!0;var o,c=Object(ge.a)(i.next);try{for(c.s();!(o=c.n()).done;){if(n(o.value))return!0}}catch(e){c.e(e)}finally{c.f()}}return!1}(a.root)}function Ce(e,t,a){return e.mapProgress[t]?e.mapProgress[t][a]:void 0}function xe(e,t,a,r){var n;return null===(n=Ce(e,t,a))||void 0===n?void 0:n.activityState[r]}function je(e,t){return Object.keys(e.activities).filter((function(t){return!Pe(e.activities[t])})).filter((function(a){return Ue(e.activities[a]).map((function(e){return e.activityId})).some((function(e){return e===t}))})).map((function(t){return e.activities[t]}))}function Ee(e,t,a,r){return je(a,r).map((function(r){return xe(e,t,a.mapId,r.activityId)})).filter((function(e){return!!e}))}function Ae(e,t,a,r){var n=Ee(e,t,a,r).filter((function(e){return(null==e?void 0:e.isCompleted)&&e.maxSteps===e.currentStep})).sort((function(e,t){return(t.completedTime||0)-(e.completedTime||0)}));return null==n?void 0:n[0]}function Ne(e,t,a,r){if(!e||!a||!r||"activity"!==r.kind)return!1;var n=Ee(e,t,a,r.activityId),i=null==n?void 0:n.some((function(e){return(null==e?void 0:e.isCompleted)&&e.maxSteps===e.currentStep}));return r.allowCodeCarryover&&n.length>0&&i&&we(e,t,a,r.activityId)}function Ue(e){if(Pe(e)){var t=[];return e.next.forEach((function(e){return t=t.concat(Ue(e))})),t}return e.next}function Pe(e){return"reward"===e.kind||"completion"===e.kind}function Me(e,t,a){var r;return Object.values(null!==(r=e.mapProgress[t])&&void 0!==r?r:[]).filter((function(e){var r;return!a||!(null===(r=a.mapProgress[t])||void 0===r?void 0:r[e.mapId])||0===Object.keys(a.mapProgress[t][e.mapId].activityState).length})).map((function(e){return Object.values(e.activityState)})).reduce((function(e,t){return e.concat(t,[])}),[]).map((function(e){return e.headerId})).filter((function(e){return!!e}))}function Te(e,t,a,r){var n=pxt.semver.parse(e.version||"0.0.0"),i=pxt.semver.parse(t),o=e;if(0===pxt.semver.cmp(n,i))return o;if(0===pxt.semver.cmp(n,pxt.semver.parse("0.0.0"))){var c=(null==e?void 0:e.mapProgress)&&Object.keys(null==e?void 0:e.mapProgress);if((null==c?void 0:c.length)>0&&e.mapProgress[c[0]].activityState){var s=e,l={};Object.keys(r).forEach((function(e){s.mapProgress[e]&&(l[e]=s.mapProgress[e])})),o=Object(p.a)(Object(p.a)({},s),{},{mapProgress:Object(d.a)({},a,l)})}}return o}function Le(e,t,a){if(0===a.length)return e;var r=e.mapProgress[t]||{};return a.forEach((function(t){var a=te(t),n=a.cmd,i=a.arg,o=i;switch(n){case"github":var c=pxt.github.parseRepoId(i),s=c&&ue(c);o=(null==s?void 0:s.identifier)||i;break;case"docs":o=le(i)}var l=e.mapProgress[o];l&&Object.keys(l).forEach((function(e){if(r[e]){var t=l[e].activityState;Object.keys(t).forEach((function(a){r[e].activityState[a]||(r[e].activityState[a]=t[a])}))}else r[e]=l[e]}))})),Object(p.a)(Object(p.a)({},e),{},{mapProgress:Object(p.a)(Object(p.a)({},e.mapProgress),{},Object(d.a)({},t,r))})}var Re={title:lf("Game Maker Guide"),description:lf("Level up your game making skills by completing the tutorials in this guide."),pageSourceStatus:"unknown",pageSourceUrl:"default",user:{version:pxt.skillmap.USER_VERSION,isDebug:!0,id:ve(),mapProgress:{},completedTags:{}},theme:{backgroundColor:"var(--body-background-color)",pathColor:"#BFBFBF",strokeColor:"#000000",rewardNodeColor:"var(--primary-color)",rewardNodeForeground:"#000000",unlockedNodeColor:"var(--secondary-color)",unlockedNodeForeground:"#000000",lockedNodeColor:"#BFBFBF",lockedNodeForeground:"#000000",completedNodeColor:"var(--secondary-color)",completedNodeForeground:"#000000",selectedStrokeColor:"var(--hover-color)",pathOpacity:.5},maps:{},auth:{signedIn:!1},cloudState:{}};function _e(e,t,a,r,n,i,o){var c,s,l=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u=a.mapId,h=xe(e,t,u,r);h||(h={isCompleted:!1,activityId:r,currentStep:i,maxSteps:o,headerId:n});var v=(null===(c=e.mapProgress)||void 0===c?void 0:c[t])||{};return Object(p.a)(Object(p.a)({},e),{},{mapProgress:Object(p.a)(Object(p.a)({},e.mapProgress),{},Object(d.a)({},t,Object(p.a)(Object(p.a)({},v),{},Object(d.a)({},u,Object(p.a)(Object(p.a)({},(null==v?void 0:v[u])||{mapId:u}),{},{activityState:Object(p.a)(Object(p.a)({},(null==v||null===(s=v[u])||void 0===s?void 0:s.activityState)||{}),{},Object(d.a)({},r,Object(p.a)(Object(p.a)({},h),{},{headerId:n,currentStep:i,maxSteps:o,isCompleted:h.isCompleted||l})))})))))})}function He(e,t,a,r){var n,i,o,c=a.mapId,s=!1,l={};r.forEach((function(r){var n=xe(e,t,c,r);s=s||Pe(a.activities[r])&&!(null==n?void 0:n.isCompleted),l[r]=n||{isCompleted:!0,activityId:r,headerId:"",currentStep:0},l[r].isCompleted=!0,l[r].completedTime=Date.now()}));var u=(null===(n=e.mapProgress)||void 0===n?void 0:n[t])||{};return Object(p.a)(Object(p.a)({},e),{},{mapProgress:Object(p.a)(Object(p.a)({},e.mapProgress),{},Object(d.a)({},t,Object(p.a)(Object(p.a)({},u),{},Object(d.a)({},c,Object(p.a)(Object(p.a)({},(null==u?void 0:u[c])||{mapId:c}),{},{activityState:Object(p.a)(Object(p.a)({},(null==u||null===(i=u[c])||void 0===i?void 0:i.activityState)||{}),l),completionState:s?"transitioning":null==u||null===(o=u[c])||void 0===o?void 0:o.completionState})))))})}function Be(e,t){var a=[e.activities[t]],r=e.activities[t].next.filter((function(e){return Pe(e)}));return a.concat(r)}var De,Fe,Ve=Object(u.b)((function(){var e,t,a,r,n,i,o,c,s,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Re,u=arguments.length>1?arguments[1]:void 0;switch(u.type){case h:return Object(p.a)(Object(p.a)({},l),{},{maps:Object(p.a)(Object(p.a)({},l.maps),{},Object(d.a)({},u.map.mapId,u.map))});case v:return Object(p.a)(Object(p.a)({},l),{},{maps:{}});case m:return Object(p.a)(Object(p.a)({},l),{},{title:Re.title,description:Re.description,infoUrl:Re.infoUrl,backgroundImageUrl:void 0,bannerImageUrl:void 0,alternateSourceUrls:void 0,theme:Object(p.a)({},Re.theme)});case f:return Object(p.a)(Object(p.a)({},l),{},{selectedItem:{mapId:u.mapId,activityId:u.activityId}});case y:return Object(p.a)(Object(p.a)({},l),{},{user:Object(p.a)(Object(p.a)({},l.user),{},{mapProgress:Object(p.a)(Object(p.a)({},l.user.mapProgress),{},Object(d.a)({},l.pageSourceUrl,Object(p.a)(Object(p.a)({},null===(e=l.user.mapProgress)||void 0===e?void 0:e[l.pageSourceUrl]),{},Object(d.a)({},u.mapId,Object(p.a)(Object(p.a)({},null===(t=l.user.mapProgress)||void 0===t||null===(a=t[l.pageSourceUrl])||void 0===a?void 0:a[u.mapId]),{},{completionState:"completed"})))))})});case g:return Object(p.a)(Object(p.a)({},l),{},{editorView:{currentMapId:u.mapId,currentActivityId:u.activityId,state:"active",allowCodeCarryover:!!u.carryoverCode,previousHeaderId:u.previousHeaderId,currentHeaderId:null===(r=xe(l.user,l.pageSourceUrl,u.mapId,u.activityId))||void 0===r?void 0:r.headerId}});case I:return Object(p.a)(Object(p.a)({},l),{},{editorView:Object(p.a)(Object(p.a)({},l.editorView),{},{state:"saving"})});case k:var J=l.maps[l.editorView.currentMapId],X=l.editorView.currentActivityId,Z=u.finished?Be(J,X):[],te=Z.find((function(e){return Pe(e)})),ae=te&&(null===(n=l.user.mapProgress[l.pageSourceUrl])||void 0===n||null===(i=n[J.mapId])||void 0===i?void 0:i.activityState[te.activityId]);return Object(p.a)(Object(p.a)({},l),{},{selectedItem:te&&!ae?{mapId:J.mapId,activityId:te.activityId}:l.selectedItem,editorView:void 0,user:u.finished?He(l.user,l.pageSourceUrl,J,Z.map((function(e){return e.activityId}))):l.user});case O:return Object(p.a)(Object(p.a)({},l),{},{modal:void 0,editorView:{state:"active",currentMapId:u.mapId,currentActivityId:u.activityId,allowCodeCarryover:!!u.carryoverCode,previousHeaderId:u.previousHeaderId},user:_e(l.user,l.pageSourceUrl,l.maps[u.mapId],u.activityId)});case b:var re=(null===(o=l.editorView)||void 0===o?void 0:o.currentActivityId)===u.activityId&&(null===(c=l.editorView)||void 0===c?void 0:c.currentMapId)===u.mapId;return Object(p.a)(Object(p.a)({},l),{},{editorView:re?Object(p.a)(Object(p.a)({},l.editorView),{},{currentHeaderId:u.id}):l.editorView,user:_e(l.user,l.pageSourceUrl,l.maps[u.mapId],u.activityId,u.id,u.currentStep,u.maxSteps,u.isCompleted)});case S:var ne=l.pageSourceUrl,ie=Te(u.user,pxt.skillmap.USER_VERSION,ne,l.maps);return l.alternateSourceUrls&&(ie=Le(ie,ne,l.alternateSourceUrls)),ie.mapProgress[ne]||(ie.mapProgress[ne]={}),Object.keys(l.maps).forEach((function(e){ie.mapProgress[ne][e]||(ie.mapProgress[ne][e]={completionState:"incomplete",mapId:e,activityState:{}})})),Object(p.a)(Object(p.a)({},l),{},{user:ie});case C:return pxt.storage.removeLocal(l.pageSourceUrl+ee),Object(p.a)(Object(p.a)({},l),{},{user:Object(p.a)(Object(p.a)({},l.user),{},{completedTags:Object(p.a)(Object(p.a)({},l.user.completedTags),{},Object(d.a)({},l.pageSourceUrl,{})),mapProgress:Object(p.a)(Object(p.a)({},l.user.mapProgress),{},Object(d.a)({},l.pageSourceUrl,{}))})});case w:return l.pageSourceUrl?Object(p.a)(Object(p.a)({},l),{},{user:Object(p.a)(Object(p.a)({},l.user),{},{completedTags:Object(p.a)(Object(p.a)({},l.user.completedTags),{},Object(d.a)({},l.pageSourceUrl,Se(l.user,l.pageSourceUrl,Object.keys(l.maps).map((function(e){return l.maps[e]})))))})}):l;case $:return Object(p.a)(Object(p.a)({},l),{},{shareState:u.headerId||u.url?{headerId:u.headerId,url:u.url}:void 0});case Q:return Object(p.a)(Object(p.a)({},l),{},{cloudState:Object(p.a)(Object(p.a)({},l.cloudState),{},Object(d.a)({},u.headerId,u.status))});case x:return Object(p.a)(Object(p.a)({},l),{},{title:u.title});case j:return Object(p.a)(Object(p.a)({},l),{},{description:u.description});case E:return Object(p.a)(Object(p.a)({},l),{},{infoUrl:u.infoUrl});case A:return Object(p.a)(Object(p.a)({},l),{},{backgroundImageUrl:u.backgroundImageUrl});case N:return Object(p.a)(Object(p.a)({},l),{},{bannerImageUrl:u.bannerImageUrl});case U:return Object(p.a)(Object(p.a)({},l),{},{theme:u.theme});case P:return Object(p.a)(Object(p.a)({},l),{},{pageSourceUrl:u.url,pageSourceStatus:u.status});case M:return Object(p.a)(Object(p.a)({},l),{},{alternateSourceUrls:u.urls});case T:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"completion",currentMapId:u.mapId,currentActivityId:u.activityId}});case H:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"carryover",currentMapId:u.mapId,currentActivityId:u.activityId}});case L:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"restart-warning",currentMapId:u.mapId,currentActivityId:u.activityId}});case R:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"report-abuse",currentMapId:u.mapId,currentActivityId:u.activityId}});case _:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"reset"}});case B:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"share",currentMapId:u.mapId,currentActivityId:u.activityId}});case D:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"login"}});case F:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"login-prompt"}});case V:return Object(p.a)(Object(p.a)({},l),{},{modal:{type:"delete-account"}});case Y:return Object(p.a)(Object(p.a)({},l),{},{showProfile:!0});case K:return Object(p.a)(Object(p.a)({},l),{},{showProfile:!1});case W:return Object(p.a)(Object(p.a)({},l),{},{modal:void 0});case G:return Object(p.a)(Object(p.a)({},l),{},{auth:Object(p.a)(Object(p.a)({},l.auth),{},{profile:u.profile,signedIn:!!(null===(s=u.profile)||void 0===s?void 0:s.id)})});case z:return Object(p.a)(Object(p.a)({},l),{},{auth:Object(p.a)(Object(p.a)({},l.auth),{},{preferences:u.preferences})});case q:return Object(p.a)(Object(p.a)({},l),{},{auth:Object(p.a)(Object(p.a)({},l.auth),{},{signedIn:!1})});default:return l}})),We=a(4),Ge=a(5),ze=a(7),qe=a(6),Ye=a(29),Ke=a(12),$e=function(e,t,a,r){return{type:g,mapId:e,activityId:t,previousHeaderId:a,carryoverCode:r}},Qe=function(){return{type:I}},Je=function(e,t){return{type:T,mapId:e,activityId:t}},Xe=function(e,t){return{type:H,mapId:e,activityId:t}},Ze=function(){return{type:D}},et=function(){return{type:K}},tt=function(e,t){return{type:$,headerId:e,url:t}};function at(){return Fe||(De=new pxt.skillmap.IndexedDBWorkspace,Fe=De.initAsync().then((function(e){return De}))),Fe}function rt(){return nt.apply(this,arguments)}function nt(){return(nt=Object(Z.a)(X.a.mark((function e(){var t,a;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,at();case 2:return t=e.sent,e.next=5,t.getUserStateAsync();case 5:return(a=e.sent)||(a={id:ve(),completedTags:{},mapProgress:{},version:pxt.skillmap.USER_VERSION}),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function it(){return ot.apply(this,arguments)}function ot(){return(ot=Object(Z.a)(X.a.mark((function e(){var t,a,r,n;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rt();case 2:return r=e.sent,e.next=5,St();case 5:return n=e.sent,r=Object(p.a)(Object(p.a)({},r),{},{mapProgress:null!==(t=null==n?void 0:n.mapProgress)&&void 0!==t?t:r.mapProgress,completedTags:null!==(a=null==n?void 0:n.completedTags)&&void 0!==a?a:r.completedTags}),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ct(e){return st.apply(this,arguments)}function st(){return(st=Object(Z.a)(X.a.mark((function e(t){var a,r;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.isDebug){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,at();case 4:return r=e.sent,e.next=7,null===(a=pxt.auth.client())||void 0===a?void 0:a.loggedInAsync();case 7:if(e.sent){e.next=10;break}return e.next=10,r.saveUserStateAsync(t);case 10:return e.next=12,It({mapProgress:t.mapProgress,completedTags:t.completedTags});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var lt,ut=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){return Object(We.a)(this,a),t.apply(this,arguments)}return Object(Ge.a)(a,[{key:"onSignedIn",value:function(){return Promise.resolve()}},{key:"onSignedOut",value:function(){return Ve.dispatch({type:q}),Promise.resolve()}},{key:"onSignInFailed",value:function(){return Promise.resolve()}},{key:"onUserProfileChanged",value:function(){var e,t=this.getState();return t.profile&&pxt.auth.generateUserProfilePicDataUrl(t.profile),Ve.dispatch((e=t.profile,{type:G,profile:e})),Promise.resolve()}},{key:"onUserPreferencesChanged",value:function(e){return Promise.resolve()}},{key:"onStateCleared",value:function(){return Promise.resolve()}},{key:"onProfileDeleted",value:function(e){return Promise.resolve()}},{key:"onApiError",value:function(e){return Promise.resolve()}},{key:"logoutAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(t){var r,n;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ve.getState(),n=r.user,e.next=4,ct(n);case 4:Object(Ye.a)(Object(Ke.a)(a.prototype),"logoutAsync",this).call(this,t);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),a}(pxt.auth.AuthClient);function dt(){return pt.apply(this,arguments)}function pt(){return(pt=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pxt.auth.hasIdentity()){e.next=2;break}return e.abrupt("return",void 0);case 2:if(!lt){e.next=4;break}return e.abrupt("return",lt);case 4:return lt=new Promise(function(){var e=Object(Z.a)(X.a.mark((function e(t,a){var r;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new ut,e.next=3,r.initAsync();case 3:return e.next=5,r.authCheckAsync();case 5:return e.next=7,r.initialUserPreferencesAsync();case 7:t(r);case 8:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}()),e.abrupt("return",lt);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ht(){return vt.apply(this,arguments)}function vt(){return(vt=Object(Z.a)(X.a.mark((function e(){var t;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt();case 2:return t=e.sent,e.next=5,null==t?void 0:t.authCheckAsync();case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mt(){return ft.apply(this,arguments)}function ft(){return(ft=Object(Z.a)(X.a.mark((function e(){var t;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt();case 2:return t=e.sent,e.next=5,null==t?void 0:t.loggedInAsync();case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yt(e){return bt.apply(this,arguments)}function bt(){return(bt=Object(Z.a)(X.a.mark((function e(t){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pxt.auth.loginCallbackAsync(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gt(e){return kt.apply(this,arguments)}function kt(){return(kt=Object(Z.a)(X.a.mark((function e(t){var a;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt();case 2:return a=e.sent,e.next=5,null==a?void 0:a.logoutAsync(t);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function It(e){return Ot.apply(this,arguments)}function Ot(){return(Ot=Object(Z.a)(X.a.mark((function e(t){var a;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt();case 2:return a=e.sent,e.next=5,null==a?void 0:a.patchUserPreferencesAsync({op:"replace",path:["skillmap"],value:t});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function St(){return wt.apply(this,arguments)}function wt(){return(wt=Object(Z.a)(X.a.mark((function e(){var t,a;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt();case 2:if(!(t=e.sent)){e.next=8;break}return e.next=6,t.userPreferencesAsync();case 6:return a=e.sent,e.abrupt("return",null==a?void 0:a.skillmap);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}a(41);var Ct=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).handleOnClick=function(){r.setState({expanded:!r.state.expanded})},r.handleOnBlur=function(){r.setState({expanded:!1})},r.state={expanded:!1},r}return Object(Ge.a)(a,[{key:"getItemOnClick",value:function(e){return function(){return e.onClick(e.id)}}},{key:"render",value:function(){var e=this,t=this.props,a=t.icon,r=t.picture,n=t.items,o=t.className,c=this.state.expanded;return i.createElement("div",{className:"dropdown ".concat(o," ").concat(c?"expanded":""),tabIndex:0,role:"button",onClick:this.handleOnClick,onBlur:this.handleOnBlur},r||i.createElement("i",{className:"icon ".concat(a)}),c&&i.createElement("div",{className:"dropdown-menu"},n.map((function(t,a){return i.createElement("div",{key:a,className:"dropdown-item",onClick:e.getItemOnClick(t),role:"menuitem"},t.label)}))))}}]),a}(i.Component),xt=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){var e;Object(We.a)(this,a);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))).reportAbuseUrl="https://github.com/contact/report-content",e.onBackClicked=function(){var t=e.props;be("skillmap.activity.back",{path:t.currentMapId||"",activity:t.currentActivityId||""}),e.props.dispatchSaveAndCloseActivity()},e.onHomeClicked=function(){var e;be("skillmap.home");var t,a,r=null===(e=pxt.webConfig)||void 0===e?void 0:e.relprefix.substr(0,pxt.webConfig.relprefix.length-3);pxt.appTarget.appTheme.homeUrl&&r?((null===(t=pxt.appTarget.appTheme.homeUrl)||void 0===t?void 0:t.lastIndexOf("/"))===(null===(a=pxt.appTarget.appTheme.homeUrl)||void 0===a?void 0:a.length)-1&&(r=r.substr(1)),window.open(pxt.appTarget.appTheme.homeUrl+r)):window.open(pxt.appTarget.appTheme.homeUrl)},e.onBugClicked=function(){var e,t;be("skillmap.bugreport"),null===(e=(t=window).usabilla_live)||void 0===e||e.call(t,"click")},e.onLogoutClicked=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pxt.tickEvent("skillmap.usermenu.signout"),e.next=3,gt(location.hash);case 3:case"end":return e.stop()}}),e)}))),e.onProfileClicked=function(){pxt.tickEvent("skillmap.profile"),e.props.dispatchShowUserProfile()},e}return Object(Ge.a)(a,[{key:"getSettingItems",value:function(){var e=this,t=[];return this.props.showReportAbuse&&t.push({id:"report",label:lf("Report Abuse"),onClick:function(t){be("skillmap.reportabuse"),window.open(e.reportAbuseUrl)}}),this.props.activityOpen||t.push({id:"reset",label:lf("Reset All"),onClick:function(){be("skillmap.reset.warning"),e.props.dispatchShowResetUserModal()}}),t}},{key:"getOrganizationLogo",value:function(e){var t=e.organizationWideLogo;return i.createElement("div",{className:"header-logo"},t?i.createElement("img",{src:me()?"./assets/".concat(t):t,alt:lf("{0} Logo",e.organization)}):i.createElement("span",{className:"name"},e.organization))}},{key:"getTargetLogo",value:function(e){var t=this.props.activityOpen;return i.createElement("div",{className:"ui item logo brand ".concat(t?"":"noclick")},e.useTextLogo?[i.createElement("span",{className:"name",key:"org-name",onClick:this.onBackClicked},e.organizationText),i.createElement("span",{className:"name-short",key:"org-name-short",onClick:this.onBackClicked},e.organizationShortText||e.organizationText)]:e.logo||e.portraitLogo?i.createElement("img",{className:"logo",src:e.logo||e.portraitLogo,alt:lf("{0} Logo",e.boardName)}):i.createElement("span",{className:"name"}," ",e.boardName))}},{key:"getHelpItems",value:function(){var e=[];return this.props.activityOpen&&e.push({id:"feedback",label:lf("Feedback"),onClick:this.onBugClicked}),e}},{key:"getUserMenu",value:function(){var e,t,a,r,n,o,c=this,s=this.props.signedIn,l=[],u=null===(e=pxt.auth.client())||void 0===e?void 0:e.getState().profile;s&&l.push({id:"profile",label:lf("My Profile"),onClick:this.onProfileClicked},{id:"signout",label:lf("Sign Out"),onClick:this.onLogoutClicked});var d=(null==u||null===(t=u.idp)||void 0===t||null===(a=t.picture)||void 0===a?void 0:a.dataUrl)?i.createElement("div",{className:"avatar"},i.createElement("img",{src:null==u||null===(r=u.idp)||void 0===r||null===(n=r.picture)||void 0===n?void 0:n.dataUrl,alt:lf("User Menu")})):void 0,p=(null==u||null===(o=u.idp)||void 0===o?void 0:o.displayName)?i.createElement("span",{className:"circle"},pxt.auth.userInitials(u)):void 0;return i.createElement("div",{className:"user-menu"},s?i.createElement(Ct,{icon:"star",items:l,picture:d||p,className:"header-dropdown"}):i.createElement(jt,{className:"sign-in",icon:"xicon icon cloud-user",title:lf("Sign In"),label:lf("Sign In"),onClick:function(){pxt.tickEvent("skillmap.usermenu.signin"),c.props.dispatchShowLoginModal()}}))}},{key:"render",value:function(){var e,t=this.props.activityOpen,a=pxt.auth.hasIdentity(),r=null===(e=pxt.appTarget)||void 0===e?void 0:e.appTheme,n=this.getSettingItems(),o=this.getHelpItems();return i.createElement("div",{className:"header"},i.createElement("div",{className:"header-left"},this.getOrganizationLogo(r),this.getTargetLogo(r)),i.createElement("div",{className:"spacer"}),i.createElement("div",{className:"header-right"},t&&i.createElement(jt,{icon:"icon arrow left",title:lf("Return to activity selection"),onClick:this.onBackClicked}),i.createElement(jt,{icon:"icon home",title:lf("Return to the editor homepage"),onClick:this.onHomeClicked}),(null==o?void 0:o.length)>0&&i.createElement(Ct,{icon:"help circle",className:"header-dropdown",items:o}),(null==n?void 0:n.length)>0&&i.createElement(Ct,{icon:"setting",className:"header-dropdown",items:n}),a&&this.getUserMenu()))}}]),a}(i.Component),jt=function(e){var t=e.icon,a=e.label,r=e.title,n=e.onClick,o=e.className;return i.createElement("div",{className:"header-button ".concat(a?"with-label":"icon-only"," ").concat(o),title:r,role:"button",onClick:n},i.createElement("i",{className:t}),a&&i.createElement("span",{className:"header-button-label"},a))},Et={dispatchSaveAndCloseActivity:Qe,dispatchShowResetUserModal:function(){return{type:_}},dispatchShowLoginModal:Ze,dispatchShowUserProfile:function(){return{type:Y}}},At=Object(l.b)((function(e,t){var a,r,n,i;if(!e)return{};(null===(a=e.editorView)||void 0===a?void 0:a.currentHeaderId)&&Ie(e.user,e.pageSourceUrl,e.editorView.currentMapId,e.editorView.currentActivityId)&&e.editorView.currentHeaderId;var o,c=!!e.editorView;return(null===(r=e.editorView)||void 0===r?void 0:r.currentActivityId)&&(null===(o=e.maps[e.editorView.currentMapId])||void 0===o||o.activities[e.editorView.currentActivityId]),{activityOpen:c,currentMapId:c&&(null===(n=e.editorView)||void 0===n?void 0:n.currentMapId),currentActivityId:c&&(null===(i=e.editorView)||void 0===i?void 0:i.currentActivityId),showReportAbuse:"unknown"===e.pageSourceStatus,signedIn:e.auth.signedIn}}),Et)(xt),Nt=(a(42),me()?"http://localhost:3232/index.html":function(e){var t,a;if(!pxt.webConfig&&window.pxtConfig&&pxt.setupWebConfig(window.pxtConfig),(null===(t=pxt.webConfig)||void 0===t?void 0:t.targetUrl)&&(null===(a=pxt.webConfig)||void 0===a?void 0:a.relprefix))return pxt.webConfig.targetUrl+pxt.webConfig.relprefix.substr(0,pxt.webConfig.relprefix.length-3);var r=/\/([\da-zA-Z\.]+)(?:--)?/i.exec(window.location.pathname);return"".concat(e.replace(/\/$/,""),"/").concat((null==r?void 0:r[1])||"")}(window.pxtTargetBundle.appTheme.embedUrl)),Ut=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).ref=void 0,r.messageQueue=[],r.finishedActivityState=void 0,r.nextId=0,r.pendingMessages={},r.isNewActivity=!1,r.handleFrameRef=function(e){if(e&&e.contentWindow){window.addEventListener("message",r.onMessageReceived),e.addEventListener("load",r.handleFrameReload),r.ref=e,Pt(".usabilla_live_button_container",!1),Pt("footer",!1);var t=document.getElementById("root");t&&pxt.BrowserUtils.addClass(t,"editor"),r.props.onFrameLoaded((function(e){return r.sendMessageAsync(e)}))}},r.handleFrameReload=function(){r.setState({frameState:"loading"})},r.onMessageReceived=function(e){var t=e.data;if("opening-project"===r.state.frameState&&r.setState({loadPercent:Math.min((r.state.loadPercent||0)+4,95)}),"pxteditor"===t.type&&t.id&&r.pendingMessages[t.id])return r.pendingMessages[t.id].handler(t),void delete r.pendingMessages[t.id];switch(t.action){case"newproject":"loading"===r.state.frameState&&r.setState({frameState:"no-project"});break;case"tutorialevent":r.handleTutorialEvent(t);break;case"projectcloudstatus":var a=t;r.props.dispatchSetCloudStatus(a.headerId,a.status)}},r.state={frameState:"loading",workspaceReady:!1,loadPercent:0,pendingShare:!1},r}return Object(Ge.a)(a,[{key:"componentDidUpdate",value:function(){var e=Object(Z.a)(X.a.mark((function e(){var t,a,r,n,i=this;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.props.shareHeaderId,a=this.state,r=a.frameState,n=a.pendingShare,"project-open"===r&&this.props.save?this.setState({frameState:"closing-project"},Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.closeActivityAsync();case 2:case"end":return e.stop()}}),e)})))):"no-project"===r&&this.props.activityId&&this.setState({frameState:"opening-project",loadPercent:0},Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.startActivityAsync();case 2:case"end":return e.stop()}}),e)})))),t&&!n&&this.setState({pendingShare:!0},Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.shareProjectAsync();case 2:case"end":return e.stop()}}),e)}))));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"componentWillUnmount",value:function(){window.removeEventListener("message",this.onMessageReceived),Pt(".usabilla_live_button_container",!0),Pt("footer",!0);var e=document.getElementById("root");e&&pxt.BrowserUtils.removeClass(e,"editor")}},{key:"render",value:function(){var e=this.props,t=e.title,a=e.activityId,r=this.state,n=r.frameState,o=r.loadPercent,c=lf("Loading..."),s="opening-project"===n,l=s||"closing-project"===n,u=Nt;return"/"!==Nt.charAt(Nt.length-1)||me()||(u=Nt.substr(0,Nt.length-1)),u+="?controller=1&skillsMap=1&noproject=1&nocookiebanner=1&ws=browser",i.createElement("div",{className:"makecode-frame-outer",style:{display:a?"block":"none"}},i.createElement("div",{className:"makecode-frame-loader ".concat(l?"":"hidden")},i.createElement("img",{src:fe("assets/logo.svg"),alt:"MakeCode Logo"}),s&&i.createElement("div",{className:"makecode-frame-loader-bar"},i.createElement("div",{className:"makecode-frame-loader-fill",style:{width:o+"%"}})),i.createElement("div",{className:"makecode-frame-loader-text"},c)),i.createElement("iframe",{className:"makecode-frame",src:u,title:t,ref:this.handleFrameRef}))}},{key:"sendMessageAsync",value:function(e){var t=this;return new Promise((function(a){var r=function(e){e.response=!0,e.id=t.nextId+++"",t.pendingMessages[e.id]={original:e,handler:a},t.ref.contentWindow.postMessage(e,"*")};if(t.ref)if(t.ref.contentWindow){for(;t.messageQueue.length;)r(t.messageQueue.shift());r(e)}else t.messageQueue.push(e)}))}},{key:"startActivityAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.props.activityHeaderId){e.next=5;break}return e.next=3,this.sendMessageAsync({type:"pxteditor",action:"openheader",headerId:this.props.activityHeaderId});case 3:e.next=8;break;case 5:return this.isNewActivity=!0,e.next=8,this.sendMessageAsync({type:"pxteditor",action:"startactivity",path:this.props.tutorialPath,title:this.props.title,activityType:"tutorial",carryoverPreviousCode:this.props.carryoverCode,previousProjectHeaderId:this.props.previousHeaderId});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"closeActivityAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sendMessageAsync({type:"pxteditor",action:"saveproject"});case 2:return this.props.dispatchCloseActivity("finished"===this.finishedActivityState),this.props.dispatchUpdateUserCompletedTags(),this.finishedActivityState=void 0,e.next=7,this.sendMessageAsync({type:"pxteditor",action:"unloadproject"});case 7:this.setState({frameState:"no-project"});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"shareProjectAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){var t,a,r,n;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.props,a=t.shareHeaderId,r=t.dispatchSetShareStatus,e.next=3,this.sendMessageAsync({type:"pxteditor",action:"shareproject",headerId:a});case 3:n=e.sent,r(a,n.resp.shortid),this.setState({pendingShare:!1});case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"handleTutorialEvent",value:function(e){var t=this.props,a=t.dispatchSetHeaderIdForActivity,r=t.mapId,n=t.activityId,i=t.progress;switch(e.tutorialEvent){case"progress":n&&a(r,n,e.projectHeaderId,e.currentStep+1,e.totalSteps,e.isCompleted||!!(null==i?void 0:i.isCompleted));break;case"loaded":this.onEditorLoaded();break;case"completed":this.onTutorialFinished()}}},{key:"onEditorLoaded",value:function(){var e=this.props,t=e.mapId,a=e.activityId;t&&a&&(be("skillmap.activity.loaded",{path:t,activity:a}),this.setState({frameState:"project-open"}),this.isNewActivity&&(this.isNewActivity=!1))}},{key:"onTutorialFinished",value:function(){var e=this.props,t=e.mapId,a=e.activityId,r=e.signedIn,n=e.pageSourceUrl;be("skillmap.activity.complete",{path:t,activity:a}),this.finishedActivityState="finished",this.props.dispatchSaveAndCloseActivity();var i=pxt.storage.getLocal(n+ee);r||i||(this.props.dispatchShowLoginPrompt(),pxt.storage.setLocal(n+ee,"true"))}}]),a}(i.Component);function Pt(e,t){var a=document.querySelector(e);(null==a?void 0:a.style)&&(a.style.display=t?"":"none")}var Mt={dispatchSetHeaderIdForActivity:function(e,t,a,r,n,i){return{type:b,mapId:e,activityId:t,id:a,currentStep:r,maxSteps:n,isCompleted:i}},dispatchCloseActivity:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:k,finished:e}},dispatchSaveAndCloseActivity:Qe,dispatchUpdateUserCompletedTags:function(){return{type:w}},dispatchSetShareStatus:tt,dispatchShowLoginPrompt:function(){return{type:F}},dispatchSetCloudStatus:function(e,t){return{type:Q,headerId:e,status:t}}},Tt=Object(l.b)((function(e,t){var a,r,n=(null===(a=e.shareState)||void 0===a?void 0:a.url)||null===(r=e.shareState)||void 0===r?void 0:r.headerId;if(!e||!e.editorView)return{shareHeaderId:n};var i,o=e.editorView,c=o.currentActivityId,s=o.currentMapId,l=o.currentHeaderId,u=o.state,d=o.allowCodeCarryover,p=o.previousHeaderId,h=e.maps[s],v=null==h?void 0:h.activities[c];i=null==v?void 0:v.displayName;var m=xe(e.user,e.pageSourceUrl,s,c);return{tutorialPath:v.url,title:i,mapId:s,activityId:c,activityHeaderId:l,activityType:v.type,carryoverCode:d,previousHeaderId:p,progress:m,save:"saving"===u,shareHeaderId:n,signedIn:e.auth.signedIn,pageSourceUrl:e.pageSourceUrl}}),Mt)(Ut),Lt=(a(43),function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){var e;Object(We.a)(this,a);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))).handleModalClick=function(e){e.stopPropagation()},e.handleCloseClick=function(){e.props.onClose&&e.props.onClose(),e.setState({visible:!1})},e}return Object(Ge.a)(a,[{key:"render",value:function(){var e=this.props,t=e.title,a=e.actions,r=e.className,n=e.fullscreen;return i.createElement("div",{className:"modal-overlay ".concat(r||""," ").concat(n&&"fullscreen"),onClick:this.handleCloseClick,role:"region"},i.createElement("div",{className:"modal",onClick:this.handleModalClick,role:"dialog"},i.createElement("div",{className:"modal-header"},n&&i.createElement("div",{className:"close button",onClick:this.handleCloseClick},i.createElement("i",{className:"icon arrow left"}),lf("Go Back")),i.createElement("div",{className:"modal-title"},t),!n&&i.createElement("div",{className:"spacer"}),!n&&i.createElement("div",{className:"modal-close-icon",onClick:this.handleCloseClick,role:"button"},i.createElement("i",{className:"icon close"}))),i.createElement("div",{className:"modal-body"},this.props.children),a&&a.length>0&&i.createElement("div",{className:"modal-actions"},a.map((function(e,t){return e.url?i.createElement("a",{key:t,className:"modal-button ".concat(e.className||""),href:e.url,onClick:e.onClick,target:"_blank",rel:"noopener noreferrer",role:"button"},e.label):i.createElement("div",{key:t,className:"modal-button ".concat(e.className||""),onClick:e.onClick,role:"button"},e.label)})))))}}]),a}(i.Component)),Rt=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).handleOnClose=function(){r.setState({loading:!1,data:void 0,checkboxSelected:!1}),r.props.dispatchHideModal(),r.props.dispatchSetShareStatus()},r.handleRewardClick=function(){var e=r.props,t=e.mapId,a=e.skillMap,n=(e.type,e.activity);be("skillmap.reward",{path:t,activity:n.activityId}),window.open(n.url||a.completionUrl)},r.handleShareInputClick=function(e){e.target.select()},r.handleShareCopyClick=function(){var e=r.props;be("skillmap.share.copy",{path:e.mapId,activity:e.activity.activityId});var t=document.querySelector(".share-input input");t&&(t.select(),document.execCommand("copy"))},r.state={},r}return Object(Ge.a)(a,[{key:"render",value:function(){var e=this.props,t=e.activity;switch(e.type){case"completion":return t?this.renderCompletionModal():i.createElement("div",null);case"restart-warning":return t?this.renderRestartWarning():i.createElement("div",null);case"report-abuse":return this.renderReportAbuse();case"reset":return this.renderResetWarning();case"carryover":return this.renderCodeCarryoverModal();case"share":return this.renderShareModal();case"login":return this.renderLoginModal(!1);case"login-prompt":return this.renderLoginModal(!0);case"delete-account":return this.renderDeleteAccountModal();default:return i.createElement("div",null)}}},{key:"getCompletionActionText",value:function(e){switch(e.kind){case"activity":return lf("Start Activity");case"map":return lf("Start Skill Map");case"editor":return lf("Keep Building");case"docs":default:return lf("Learn More")}}},{key:"getCompletionActions",value:function(e){var t=this,a=this.props,r=a.userState,n=a.pageSourceUrl,i=a.mapId,o=a.skillMap,c=a.activity,s=a.dispatchOpenActivity,l=a.dispatchShowCarryoverModal,u=c,d=[];return null==e||e.forEach((function(e){var a={label:e.label||t.getCompletionActionText(e),url:e.url};switch(e.kind){case"activity":var p=null==o?void 0:o.activities[e.activityId||""];p&&(a.onClick=function(){be("skillmap.reward.action.activity",{path:i,activity:u.activityId,nextActivityId:p.activityId}),t.handleOnClose(),Ne(r,n,o,p)?l(o.mapId,p.activityId):s(i,p.activityId)},d.push(a));break;case"editor":var h=Ae(r,n,o,c.activityId);(null==h?void 0:h.headerId)&&(a.onClick=function(){be("skillmap.reward.action.editor",{path:i,activity:u.activityId}),window.open("".concat(Nt,"#skillmapimport:").concat(h.headerId))},d.push(a));break;case"map":case"docs":default:a.onClick=function(){return be("skillmap.reward.action.".concat(e.kind),{path:i,activity:u.activityId,url:a.url||""})},d.push(a)}})),d}},{key:"renderCompletionModal",value:function(){var e=this.props,t=e.skillMap,a=e.type,r=e.activity;if(!a||!t)return i.createElement("div",null);var n=r,o=lf("You Did It!"),c=lf("Congratulations on completing {0}. Take some time to explore any activities you missed, or reset your progress to try again. But first, be sure to claim your reward using the button below.","{0}").split("{0}");return i.createElement("div",{className:"confetti-container"},i.createElement(Lt,{title:o,actions:this.getCompletionActions(n.actions),className:"completion",onClose:this.handleOnClose},c[0],i.createElement("strong",null,t.displayName),c[1],i.createElement("div",{className:"completion-reward",onClick:this.handleRewardClick},i.createElement("i",{className:"icon gift"}),i.createElement("span",null,lf("Claim your reward!")))),Array(100).fill(0).map((function(e,t){var a={animationDelay:"".concat(t%100*.1,"s"),left:"".concat(1*Math.floor(100*Math.random()),"%")};return i.createElement("div",{key:t,style:a,className:"confetti ".concat(Math.random()>.5?"reverse":""," color-").concat(Math.floor(9*Math.random()))})})))}},{key:"renderRestartWarning",value:function(){var e=this.props,t=e.mapId,a=e.activity,r=e.dispatchRestartActivity,n=e.showCodeCarryoverModal,o=e.dispatchShowCarryoverModal,c=lf("Restart Activity?"),s=lf("Are you sure you want to restart {0}? You won't lose your path progress but the code you have written for this activity will be deleted.","{0}").split("{0}"),l=[{label:lf("CANCEL"),onClick:this.handleOnClose},{label:lf("RESTART"),onClick:function(){be("skillmap.activity.restart",{path:t,activity:a.activityId}),n?o(t,a.activityId):r(t,a.activityId)}}];return i.createElement(Lt,{title:c,actions:l,onClose:this.handleOnClose},s[0],i.createElement("strong",null,a.displayName),s[1])}},{key:"renderResetWarning",value:function(){var e=this.props,t=e.dispatchResetUser,a=e.dispatchHideModal,r=lf("Reset All Activities?"),n=lf("Are you sure you want to reset? This will permanently erase all progress and delete the project created for each tutorial. This action cannot be undone."),o=[{label:lf("CANCEL"),onClick:this.handleOnClose},{label:lf("RESET"),onClick:function(){be("skillmap.reset"),t(),a()}}];return i.createElement(Lt,{title:r,actions:o,onClose:this.handleOnClose},n)}},{key:"renderReportAbuse",value:function(){var e=this.props,t=e.pageSourceUrl,a=e.dispatchHideModal,r=[{label:"REPORT",onClick:function(){be("skillmap.reportabuse"),function(e,t){de.apply(this,arguments)}(t||"",{text:document.querySelector(".report-abuse-text").value}),a()}}];return i.createElement(Lt,{title:"Report Abuse",actions:r,onClose:this.handleOnClose},i.createElement("textarea",{className:"report-abuse-text",placeholder:"Describe the content and explain why you are reporting it for abuse. Provide as much detail as possible!"}))}},{key:"renderCodeCarryoverModal",value:function(){var e=this.props,t=e.skillMap,a=e.activity,r=e.pageSourceUrl,n=e.userState,o=e.dispatchHideModal,c=e.dispatchRestartActivity,s=lf("Keep code from previous activity?"),l=lf("Do you want to start with your code from {0} or start fresh with starter code? Your images, tilemaps, tiles, and animations will stick around either way.").split("{0}"),u=Ae(n,r,t,a.activityId),d=t.activities[null==u?void 0:u.activityId];if(!d)return i.createElement("div",null);var p=[{label:lf("START FRESH"),onClick:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:be("skillmap.startfresh",{path:t.mapId,activity:a.activityId,previousActivity:d.activityId}),c(t.mapId,a.activityId,u.headerId,!1),o();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{label:lf("KEEP CODE"),onClick:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:be("skillmap.keepcode",{path:t.mapId,activity:a.activityId,previousActivity:d.activityId}),c(t.mapId,a.activityId,u.headerId,!0),o();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}];return i.createElement(Lt,{title:s,actions:p,onClose:this.handleOnClose},l[0],i.createElement("strong",null,d.displayName),l[1])}},{key:"renderShareModal",value:function(){var e=this,t=this.props,a=t.userState,r=t.pageSourceUrl,n=t.mapId,o=t.activity,c=t.shareState,s=t.dispatchSetShareStatus,l=this.state.loading,u=null==c?void 0:c.url,d=u?lf("Share Project"):lf("Publish Project"),p=[];return u||(p.push({label:lf("Cancel"),onClick:function(){return e.handleOnClose}}),p.push({label:lf("Publish"),onClick:function(){var t=Object(Z.a)(X.a.mark((function t(){var i;return X.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:be("skillmap.share",{path:n,activity:o.activityId}),e.setState({loading:!0}),i=xe(a,r,n,o.activityId),s(null==i?void 0:i.headerId);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()})),i.createElement(Lt,{title:d,actions:p,onClose:this.handleOnClose},u?i.createElement("div",null,lf("Your project is ready! Use the address below to share your projects.")):i.createElement("div",{className:"share-disclaimer"},lf("You need to publish your project to share it or embed it in other web pages. You acknowledge having consent to publish this project.")),l&&!u&&i.createElement("div",{className:"share-loader"},i.createElement("div",{className:"ui active inline loader"}),i.createElement("span",null,lf("Loading..."))),u&&i.createElement("div",{className:"share-input"},i.createElement("input",{type:"text",readOnly:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,value:"https://makecode.com/".concat(u),onClick:this.handleShareInputClick}),i.createElement("div",{className:"share-copy",onClick:this.handleShareCopyClick,role:"button"},i.createElement("i",{className:"icon copy"}),lf("Copy"))))}},{key:"renderLoginModal",value:function(e){var t,a=this,r=null!==(t=this.state.checkboxSelected)&&void 0!==t&&t,n=lf("Sign in icon"),o=pxt.auth.identityProvider("microsoft"),c=[];return c.push({label:lf("Sign In"),onClick:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:pxt.tickEvent("skillmap.signindialog.signin",{provider:o.name?o.name:"",rememberMe:r.toString()}),pxt.auth.client().loginAsync(o.id,r,{hash:location.hash});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}),i.createElement(Lt,{title:e?lf("Save your Completed Activity"):lf("Sign into MakeCode Arcade"),onClose:this.handleOnClose,actions:c,className:"sign-in"},i.createElement("div",{className:"description"},i.createElement("p",null,lf("Sign in with your Microsoft Account. We'll save your projects to the cloud, where they're accessible from anywhere.")),i.createElement("div",{className:"container"},e&&i.createElement("img",{src:fe("/assets/cloud-user.svg"),alt:n,className:"icon cloud-user"}),i.createElement("p",null,lf("Don't have a Microsoft Account? Start signing in to create one!"),i.createElement("a",{href:"https://aka.ms/cloudsave",target:"_blank",onClick:function(){be("skillmap.signindialog.learn"),window.open("https://aka.ms/cloudsave","_blank")}},i.createElement("i",{className:"icon external alternate"}),lf("Learn more")))),i.createElement("div",{className:"remember",onClick:function(){var e=!r;be("skillmap.signindialog.rememberme",{rememberMe:e.toString()}),a.setState({checkboxSelected:e})}},i.createElement("i",{className:"icon square outline ".concat(r?"check":"")}),lf("Remember me"))))}},{key:"renderDeleteAccountModal",value:function(){var e=this,t=this.state.checkboxSelected,a=[];return a.push({label:lf("Confirm"),className:t?"confirm":"confirm disabled",onClick:function(){var a=Object(Z.a)(X.a.mark((function a(){return X.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(!t){a.next=7;break}return be("skillmap.profile.delete"),e.props.dispatchHideModal(),e.props.dispatchCloseUserProfile(),a.next=6,pxt.auth.client().deleteProfileAsync();case 6:location.reload();case 7:case"end":return a.stop()}}),a)})));return function(){return a.apply(this,arguments)}}()}),a.push({label:lf("Back to safety"),className:"disagree",onClick:this.props.dispatchHideModal}),i.createElement(Lt,{title:lf("Delete Profile"),className:"delete",actions:a,onClose:this.handleOnClose},i.createElement("div",null," ",lf("Are you sure? This cannot be reversed! Your cloud-saved projects will be converted to local projects on this device.")),i.createElement("div",{className:"confirm-delete checkbox",onClick:function(){e.setState({checkboxSelected:!t})}},i.createElement("i",{className:"icon square outline ".concat(t?"check":"")}),lf("I understand this is permanent. No undo.")))}}]),a}(i.Component),_t={dispatchHideModal:function(){return{type:W}},dispatchRestartActivity:function(e,t,a,r){return{type:O,mapId:e,activityId:t,previousHeaderId:a,carryoverCode:r}},dispatchOpenActivity:$e,dispatchResetUser:function(){return{type:C}},dispatchShowCarryoverModal:Xe,dispatchCloseUserProfile:et,dispatchSetShareStatus:tt},Ht=Object(l.b)((function(e,t){var a;if(!e)return{};var r=e.pageSourceUrl,n=e.shareState,i=e.modal||{},o=i.currentMapId,c=i.currentActivityId,s=i.type,l=e.editorView?e.maps[e.editorView.currentMapId]:o&&e.maps[o],u=o&&c?null===(a=e.maps[o])||void 0===a?void 0:a.activities[c]:void 0;return{type:s,pageSourceUrl:r,skillMap:l,userState:e.user,showCodeCarryoverModal:l&&u&&Ne(e.user,e.pageSourceUrl,l,u),mapId:o,activity:o&&c?e.maps[o].activities[c]:void 0,shareState:n}}),_t)(Rt),Bt=(a(44),function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).handleClick=function(){r.props.onItemSelect&&r.props.onItemSelect(r.props.activityId,r.props.kind)},r.handleDoubleClick=function(){r.props.onItemDoubleClick&&r.props.onItemDoubleClick(r.props.activityId,r.props.kind)},r.handleRef=function(e){e&&(e.addEventListener("mouseenter",(function(){r.setState({hover:!0})})),e.addEventListener("mouseleave",(function(){r.setState({hover:!1})})))},r.state={hover:!1},r}return Object(Ge.a)(a,[{key:"getIcon",value:function(e,t){switch(t){case"reward":return"";case"completion":return"";default:switch(e){case"locked":return"";case"completed":return"";default:return""}}}},{key:"getIconClass",value:function(e,t){switch(t){case"reward":case"completion":return"graph-icon";default:switch(e){case"locked":case"completed":return"graph-icon";default:return"graph-icon-x"}}}},{key:"getNodeMarker",value:function(e,t,a,r){var n,o,c=t/50,s=t/576;switch(e){case"notstarted":return i.createElement("g",{transform:"translate(".concat(t/2-12*c," ").concat(-t/2-9*c,")")},i.createElement("title",null,lf("Not Started")),i.createElement("g",{transform:"scale(".concat(s/2,")")},(n=a,o=r,i.createElement("path",{fill:n,stroke:o,strokeWidth:"50",d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"}))));default:return i.createElement("g",null)}}},{key:"render",value:function(){var e=this.state.hover,t=this.props,a=t.width,r=t.position,n=t.selected,o=t.status,c=t.kind,s=t.theme,l=e?s.unlockedNodeColor:s.unlockedNodeForeground,u=e?s.unlockedNodeForeground:s.unlockedNodeColor;"locked"===o?(u=e?s.lockedNodeForeground:s.lockedNodeColor,l=e?s.lockedNodeColor:s.lockedNodeForeground):"activity"!==c?(u=e?s.rewardNodeForeground:s.rewardNodeColor,l=e?s.rewardNodeColor:s.rewardNodeForeground):"completed"===o&&(u=e?s.completedNodeForeground:s.completedNodeColor,l=e?s.completedNodeColor:s.completedNodeForeground);var d=a/8,p=a/12.5;return i.createElement("g",{className:"graph-activity ".concat(n?"selected":""," ").concat(e?"hover":""),transform:"translate(".concat(r.x," ").concat(r.y,")"),onClick:this.handleClick,onDoubleClick:this.handleDoubleClick,ref:this.handleRef},n&&("activity"!==c?i.createElement("circle",{className:"highlight",cx:0,cy:0,r:a/2+d,stroke:s.selectedStrokeColor}):i.createElement("rect",{className:"highlight",x:-a/2-d,y:-a/2-d,width:a+2*d,height:a+2*d,rx:a/6,stroke:s.selectedStrokeColor})),"activity"!==c?i.createElement("circle",{cx:0,cy:0,r:a/2,fill:u,stroke:l,strokeWidth:"2"}):i.createElement("rect",{x:-a/2,y:-a/2,width:a,height:a,rx:a/10,fill:u,stroke:l,strokeWidth:"2"}),"activity"===c&&this.getNodeMarker(o,a,s.selectedStrokeColor,s.strokeColor),i.createElement("text",{dy:p,textAnchor:"middle",alignmentBaseline:"middle",dominantBaseline:"middle",fill:l,className:this.getIconClass(o,c)},this.getIcon(o,c)))}}]),a}(i.Component)),Dt=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){return Object(We.a)(this,a),t.apply(this,arguments)}return Object(Ge.a)(a,[{key:"render",value:function(){var e,t,a=this.props,r=a.points,n=a.strokeWidth,o=a.color,c="M 0 0",s="";return r.forEach((function(a){var r,n,i,o;e=a,t&&(c+=" l ".concat(((null===(r=e)||void 0===r?void 0:r.x)||0)-t.x," ").concat(((null===(n=e)||void 0===n?void 0:n.y)||0)-t.y),s=" l ".concat(t.x-((null===(i=e)||void 0===i?void 0:i.x)||0)," ").concat(t.y-((null===(o=e)||void 0===o?void 0:o.y)||0)," ").concat(s)),t=e})),i.createElement("g",{transform:"translate(".concat(r[0].x||0," ").concat(r[0].y||0,")")},i.createElement("path",{stroke:o,strokeWidth:n,d:"".concat(c," ").concat(s)}))}}]),a}(i.Component),Ft=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).onItemSelect=function(e,t){var a=r.props,n=a.user,i=a.pageSourceUrl,o=a.map,c=(a.completionState,a.selectedActivityId),s=a.dispatchChangeSelectedItem,l=a.dispatchShowCompletionModal,u=Oe(n,i,o,e).status;"completion"===t&&"completed"===u?(be("skillmap.graph.reward.select",{path:o.mapId,activity:e}),s(o.mapId,e),l(o.mapId,e)):e!==c?(be("skillmap.graph.item.select",{path:o.mapId,activity:e}),s(o.mapId,e)):(be("skillmap.graph.item.deselect",{path:o.mapId,activity:e}),s(void 0))},r.onItemDoubleClick=function(e,t){var a=r.props,n=a.user,i=a.pageSourceUrl,o=a.map,c=a.dispatchOpenActivity,s=a.dispatchShowCarryoverModal,l=Oe(n,i,o,e).status,u=o.activities[e];be("skillmap.activity.open.doubleclick",{path:o.mapId,activity:e,status:l||""});var d=xe(n,i,o.mapId,u.activityId);Ne(n,i,o,u)&&!(null==d?void 0:d.headerId)?s(o.mapId,e):"activity"==t&&"locked"!==l&&c(o.mapId,e)},r}return Object(Ge.a)(a,[{key:"componentDidUpdate",value:function(e){"transitioning"===e.completionState&&setTimeout((function(){be("skillmap.graph.reward.auto",{path:e.map.mapId,activity:e.selectedActivityId||""}),e.dispatchSetSkillMapCompleted(e.map.mapId),e.dispatchShowCompletionModal(e.map.mapId,e.selectedActivityId)}),400)}},{key:"render",value:function(){var e=this,t=this.props,a=t.unit,r=t.items,n=t.paths,o=t.map,c=t.user,s=t.selectedActivityId,l=t.pageSourceUrl,u=t.theme;return i.createElement("g",{className:"skill-graph"},i.createElement("g",{opacity:u.pathOpacity},n.map((function(e,t){return i.createElement(Dt,{key:"graph-activity-".concat(t),strokeWidth:3*a,color:u.strokeColor,points:e.points})})),n.map((function(e,t){return i.createElement(Dt,{key:"graph-activity-".concat(t),strokeWidth:3*a-4,color:u.pathColor,points:e.points})}))),r.map((function(t,r){return i.createElement(Bt,{key:"graph-activity-".concat(r),theme:u,kind:t.activity.kind,activityId:t.activity.activityId,position:t.position,width:5*a,selected:t.activity.activityId===s,onItemSelect:e.onItemSelect,onItemDoubleClick:e.onItemDoubleClick,status:Oe(c,l,o,t.activity.activityId).status})})))}}]),a}(i.Component),Vt={dispatchChangeSelectedItem:function(e,t){return{type:f,mapId:e,activityId:t}},dispatchShowCompletionModal:Je,dispatchSetSkillMapCompleted:function(e){return{type:y,mapId:e}},dispatchOpenActivity:$e,dispatchShowCarryoverModal:Xe},Wt=Object(l.b)((function(e,t){var a,r,n,i;if(!e)return{};var o=null===(a=e.user)||void 0===a||null===(r=a.mapProgress)||void 0===r?void 0:r[e.pageSourceUrl];return{user:e.user,pageSourceUrl:e.pageSourceUrl,theme:e.theme,selectedActivityId:e.selectedItem&&(null===(n=t.map)||void 0===n?void 0:n.mapId)==e.selectedItem.mapId?e.selectedItem.activityId:void 0,completionState:null==o||null===(i=o[t.map.mapId])||void 0===i?void 0:i.completionState}}),Vt)(Ft),Gt=(a(20),10);function zt(e,t){return{x:qt(e),y:Yt(t)}}function qt(e){return(12*e+4)*Gt}function Yt(e){return(9*e+4)*Gt}function Kt(e){for(var t=[],a=[e],r={};a.length>0;){var n=a.shift();n&&!r[n.activityId]&&(r[n.activityId]=!0,t.push(n),a=n.next.concat(a))}return t}function $t(e){var t=function(e){for(var t=[],a=[e],r={};a.length>0;){var n=a.shift();n&&!r[n.activityId]&&(r[n.activityId]=!0,t.push(n),a=a.concat(n.next))}return t}(e),a={};return t.forEach((function(e){var t=e.next.slice();e.next.length=0,a[e.activityId]=JSON.parse(JSON.stringify(e)),e.next=t})),Object.keys(a).forEach((function(e){return a[e].next=a[e].nextIds.map((function(e){return a[e]}))})),a[e.activityId]}a(45);var Qt=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).onImageLoad=function(e){r.setState({backgroundSize:{width:e.target.naturalWidth,height:e.target.naturalHeight}})},r.state={backgroundSize:{width:0,height:0}},r}return Object(Ge.a)(a,[{key:"render",value:function(){var e=this.props,t=e.graphs,a=e.graphSize,r=e.backgroundImageUrl,n=this.state.backgroundSize,o=0,c=a.width/a.height,s=n.width/n.height,l=r&&n.width>0&&n.height>0,u=Math.max(400,a.height),d=Math.max(600,a.width);l&&(c-s>.05?u=d*(1/s):c-s<-.05&&(d=u*s));var p=Math.max(u-a.height,0)/2,h=Math.max(d-a.width,0)/2;return i.createElement("div",{className:"skill-graph-wrapper"},i.createElement("div",{className:"skill-graph-content ".concat(l?"has-background":"")},i.createElement("div",{className:"skill-graph-activities"},i.createElement("svg",{viewBox:"-".concat(h+40," -").concat(p+40," ").concat(d+80," ").concat(u+80),preserveAspectRatio:"xMidYMid meet"},t.map((function(e,t){return o+=e.height,i.createElement("g",{key:t,transform:"translate(0, ".concat(o-e.height,")")},i.createElement(Wt,Object.assign({unit:Gt},e)))})))),r&&i.createElement("div",{className:"skill-graph-background"},i.createElement("img",{src:r,alt:lf("Background Image"),onLoad:this.onImageLoad}))))}}]),a}(i.Component),Jt=Object(l.b)((function(e,t){if(!e)return{};var a=t.maps.map((function(e){return function(e){var t=[];switch(e.layout){case"manual":t=t.concat(function(e){var t=[],a=Kt($t(e)).filter((function(e){return"layout"!==e.kind}));return a.forEach((function(e){if(t.indexOf(e.activityId)<0){var a,r;t.push(e.activityId),e.depth=(null===(a=e.position)||void 0===a?void 0:a.depth)||0,e.offset=(null===(r=e.position)||void 0===r?void 0:r.offset)||0;var n=[];e.next.forEach((function(t,a){var r,i,o,c=(null===(r=t.position)||void 0===r?void 0:r.depth)||0,s=(null===(i=t.position)||void 0===i?void 0:i.offset)||0,l=[{depth:e.depth,offset:e.offset}];(null===(o=e.edges)||void 0===o?void 0:o[a])&&e.edges[a].forEach((function(e){var t=l[l.length-1];e.depth!==t.depth&&e.offset!==t.offset&&l.push({depth:t.depth,offset:e.offset}),l.push(e)}));var u=l[l.length-1];c!==u.depth&&s!==u.offset&&l.push({depth:u.depth,offset:s}),l.push({depth:c,offset:s}),n.push(l)})),e.edges=n}})),a}(e.root));break;case"ortho":default:t=t.concat(function(e){for(var t=$t(e),a=[t],r={},n={},i=0,o=function(){var e=a.shift();if(e&&!n[e.activityId]){var t;n[e.activityId]=!0;var o=null===(t=e.parents)||void 0===t?void 0:t[0];if(o){var c=r[o.activityId]||{depth:0,offset:0};0==c.depth?(c.depth=1,e.offset=o.offset+c.offset):(i+=1,c.offset=i,e.offset=i),e.depth=o.depth+c.depth,r[o.activityId]=c}else e.depth=0,e.offset=0;var s=e.next.map((function(t){var a=t;return a.parents?a.parents.push(e):a.parents=[e],a}));s.filter((function(e){return n[e.activityId]})).forEach((function(t){(function(e,t){return!(!e.parents||!t.parents||(e.parents.forEach((function(e){t.parents.indexOf(e)>=0&&(a=e)})),!a||1!=Math.abs(a.nextIds.indexOf(e.activityId)-a.nextIds.indexOf(t.activityId))||e.depth!=t.depth));var a})(t,e)||(t.offset+=1,i=Math.max(i,t.offset),t.depth=Math.max(t.depth,e.depth+1))})),a=s.concat(a)}};a.length>0;)o();var c=Kt(t).filter((function(e){return"layout"!==e.kind})),s={};return c.forEach((function(e){null==s[e.depth]&&(s[e.depth]=[]),s[e.depth].push(e.offset)})),c.forEach((function(e){var t;if((!e.next||0==e.next.length)&&1==(null===(t=e.parents)||void 0===t?void 0:t.length)){var a=e.parents[0],r=s[e.depth],n=r[r.indexOf(e.offset)-1];(n?e.offset-n:Math.abs(e.depth-a.depth)+Math.abs(e.offset-a.offset))>2&&(e.depth=a.depth,e.offset=(n||a.offset)+1)}})),c.forEach((function(e){if(e.parents){e.edges=[];var t=e.parents.some((function(t){return t.offset==e.offset}))||e.parents.length>2;e.parents.forEach((function(a){var r,n=[{depth:a.depth,offset:a.offset}];if(t){var i=s[e.depth],o=i.indexOf(e.offset),c=e.offset>a.offset&&!(i[o+1]-i[o]<e.offset-a.offset),l=e.offset<a.offset&&!(i[o]-i[o-1]<a.offset-e.offset);c||l?n.push({depth:e.depth,offset:a.offset}):n.push({depth:a.depth,offset:e.offset})}else n.push({depth:a.depth,offset:e.offset});n.push({depth:e.depth,offset:e.offset}),null===(r=e.edges)||void 0===r||r.push(n)}))}})),c}(e.root))}var a,r=0,n=0,i=[],o=[],c=Object(ge.a)(t);try{for(c.s();!(a=c.n()).done;){var s=a.value,l=s.depth,u=s.offset;i.push({activity:s,position:zt(l,u)}),s.edges&&s.edges.forEach((function(e){var t=[];e.forEach((function(e){return t.push(zt(e.depth,e.offset))})),o.push({points:t})})),r=Math.max(r,s.depth),n=Math.max(n,s.offset)}}catch(e){c.e(e)}finally{c.f()}var d=qt(r)+40,p=Yt(n)+40;return{map:e,items:i,paths:o,width:d,height:p}}(e)})),r=(null==a?void 0:a.length)?a.map((function(e){return e.width})).reduce((function(e,t){return Math.max(e,t)})):0,n=(null==a?void 0:a.length)?a.map((function(e){return e.height})).reduce((function(e,t){return e+t})):0;return{graphs:a,graphSize:{width:r,height:n}}}))(Qt),Xt=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){var e;Object(We.a)(this,a);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))).handleActionButtonClick=function(){var t=e.props,a=t.status,r=t.mapId,n=t.activityId,i=t.dispatchOpenActivity,o=t.dispatchShowCarryoverModal,c=t.showCodeCarryoverModal;if("locked"!==a)switch(be("skillmap.activity.open",{path:r,activity:n,status:a||""}),a){case"notstarted":c?o(r,n):i(r,n);break;case"completed":case"inprogress":case"restarted":default:i(r,n)}},e.handleRestartButtonClick=function(){var t=e.props,a=t.mapId,r=t.activityId,n=t.status,i=t.dispatchShowRestartActivityWarning;be("skillmap.sidebar.restart",{path:a,activity:r,status:n||""}),i(a,r)},e.handleShareButtonClick=function(){var t=e.props,a=t.mapId,r=t.activityId,n=t.status,i=t.dispatchShowShareModal;be("skillmap.sidebar.share",{path:a,activity:r,status:n||""}),i(a,r)},e.handleSaveToProjectsClick=function(){var t=e.props,a=t.completedHeaderId;be("skillmap.export",{path:t.mapId||"",activity:t.activityId||""}),window.open("".concat(Nt,"#skillmapimport:").concat(a))},e}return Object(Ge.a)(a,[{key:"getActivityActionText",value:function(){switch(this.props.status){case"locked":return lf("LOCKED");case"completed":return lf("VIEW CODE");case"inprogress":case"restarted":return lf("CONTINUE");case"notstarted":default:return lf("START")}}},{key:"isCompleted",value:function(e){return"completed"===e||"restarted"===e}},{key:"render",value:function(){var e=this.props,t=e.status,a=e.completedHeaderId,r=t&&"notstarted"!==t&&"locked"!==t;return"locked"===t?i.createElement("div",null):i.createElement("div",{className:"actions ".concat(a?"grid":"")},i.createElement("div",{className:"action-button",role:"button",onClick:this.handleActionButtonClick},this.getActivityActionText()),r&&i.createElement("div",{className:"action-button",role:"button",onClick:this.handleRestartButtonClick},lf("Restart")),r&&i.createElement("div",{className:"action-button",role:"button",onClick:this.handleShareButtonClick},lf("Share")),a&&i.createElement("div",{className:"action-button",role:"button",onClick:this.handleSaveToProjectsClick},lf("Save to My Projects")))}}]),a}(i.Component),Zt={dispatchOpenActivity:$e,dispatchShowRestartActivityWarning:function(e,t){return{type:L,mapId:e,activityId:t}},dispatchShowShareModal:function(e,t){return{type:B,mapId:e,activityId:t}},dispatchShowCarryoverModal:Xe},ea=Object(l.b)((function(e,t){if(!e)return{};var a=t,r=e.maps[a.mapId],n=r.activities[a.activityId];return{showCodeCarryoverModal:Ne(e.user,e.pageSourceUrl,r,n)}}),Zt)(Xt),ta=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){var e;Object(We.a)(this,a);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))).handleActionButtonClick=function(){var t=e.props,a=t.status,r=t.mapId,n=t.activityId,i=t.dispatchShowCompletionModal;switch(a){case"locked":break;default:return be("skillmap.sidebar.reward",{path:r,activity:n}),i(r,n)}},e}return Object(Ge.a)(a,[{key:"getRewardActionText",value:function(){switch(this.props.type){case"certificate":return lf("Claim Certificate");default:return lf("Claim Reward")}}},{key:"render",value:function(){return"locked"===this.props.status?i.createElement("div",null):i.createElement("div",{className:"actions"},i.createElement("div",{className:"action-button",role:"button",onClick:this.handleActionButtonClick},this.getRewardActionText()))}}]),a}(i.Component),aa={dispatchOpenActivity:$e,dispatchShowCompletionModal:Je},ra=Object(l.b)(null,aa)(ta),na=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){return Object(We.a)(this,a),t.apply(this,arguments)}return Object(Ge.a)(a,[{key:"render",value:function(){var e=pxt.cloud.cloudStatus[this.props.cloudStatus];return i.createElement("div",{className:"cloud-action"},this.props.signedIn?i.createElement("div",{className:"cloud-indicator"},i.createElement("div",{className:"ui tiny cloudicon xicon ".concat(e.icon),title:e.tooltip,tabIndex:-1}),e.longStatus):i.createElement("div",{className:"sign-in-button",onClick:this.props.dispatchShowLoginModal},lf("Sign in to Save")))}}]),a}(i.Component),ia={dispatchShowLoginModal:Ze},oa=Object(l.b)((function(e,t){var a=e.user,r=e.pageSourceUrl,n=e.selectedItem,i="none";if(null==n?void 0:n.activityId){var o,c=null===(o=xe(a,r,n.mapId,n.activityId))||void 0===o?void 0:o.headerId;c&&(i=e.cloudState&&e.cloudState[c]||i)}else i="synced";return{signedIn:e.auth.signedIn,cloudStatus:i}}),ia)(na),ca=(a(46),function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){return Object(We.a)(this,a),t.apply(this,arguments)}return Object(Ge.a)(a,[{key:"getStatusLabel",value:function(e){switch(e){case"locked":return lf("Locked");case"completed":return lf("Completed");default:return null}}},{key:"getStatusIcon",value:function(e){switch(e){case"locked":return"lock";case"completed":return"check circle";default:return null}}},{key:"render",value:function(){var e=this.props,t=e.mapId,a=e.title,r=e.subtitle,n=e.description,o=e.infoUrl,c=e.imageUrl,s=e.details,l=e.node,u=e.status,d=e.completedHeaderId,p=this.getStatusLabel(u),h=!l,v=l&&!Pe(l),m=v&&l.tags||void 0,f=pxt.auth.hasIdentity();return i.createElement("div",{className:"info-panel"},i.createElement("div",{className:"info-panel-image"},c?i.createElement("img",{src:c,alt:lf("Preview of activity content")}):i.createElement("i",{className:"icon image"})),i.createElement("div",{className:"info-panel-content"},r&&i.createElement("div",{className:"info-panel-subtitle"},r),i.createElement("div",{className:"info-panel-title"},a),p&&i.createElement("div",{className:"info-panel-label"},i.createElement("i",{className:"ui icon ".concat(this.getStatusIcon(u))}),i.createElement("span",null,p)),i.createElement("div",{className:"info-panel-description"},n),h&&o&&i.createElement("a",{className:"info-panel-link",href:o,target:"_blank",rel:"noopener noreferrer"},lf("Learning Outcomes")),m&&m.length>0&&i.createElement("div",{className:"info-panel-tags"},m.map((function(e,t){return i.createElement("div",{key:t},e)}))),i.createElement("div",{className:"info-panel-detail"},null==s?void 0:s.map((function(e,t){return i.createElement("div",{key:"detail_".concat(t)},e)}))),i.createElement("div",{className:"tablet-spacer"}),!h&&(v?i.createElement(ea,{mapId:t,activityId:l.activityId,status:u,completedHeaderId:d}):i.createElement(ra,{mapId:t,activityId:l.activityId,status:u,type:l.type})),f&&i.createElement(oa,null)))}}]),a}(i.Component)),sa=Object(l.b)((function(e,t){var a,r,n,i,o=e.user,c=e.pageSourceUrl,s=e.maps,l=e.selectedItem,u=e.infoUrl,d=l&&(null===(a=e.maps[l.mapId])||void 0===a?void 0:a.activities[l.activityId]),p="activity"===(null==d?void 0:d.kind),h=[];if(s)if((null==l?void 0:l.activityId)&&s[l.mapId]){var v=s[l.mapId],m=Oe(e.user,e.pageSourceUrl,v,l.activityId),f=m.status,y=m.currentStep,b=m.maxSteps;r=f,i=m.completedHeadedId,p&&(h.push(b?"".concat(y,"/").concat(b," ").concat(lf("Steps")):lf("Not Started")),h.push(p?d.type:"")),v&&(n=v.displayName)}else if(o){var g=Object.keys(s),k=0,I=0,O=0,S=0;g.forEach((function(e){var t=s[e].activities;Object.keys(t).filter((function(e){return"activity"==t[e].kind})).forEach((function(t){return++I&&Ie(o,c,e,t)&&++k})),Object.keys(t).filter((function(e){return Pe(t[e])})).forEach((function(t){return++S&&Ie(o,c,e,t)&&++O}))})),h.push("".concat(k,"/").concat(I," ").concat(lf("Complete"))),h.push(S?"".concat(O,"/").concat(S," ").concat(lf("Reward(s)")):"")}return{mapId:null==l?void 0:l.mapId,title:(null==d?void 0:d.displayName)||e.title,subtitle:n,description:p?d.description:e.description,infoUrl:u,imageUrl:d?null==d?void 0:d.imageUrl:e.bannerImageUrl,node:d,status:r,details:h,completedHeaderId:i}}))(ca),la=a(28);function ua(e){var t=function(e){var t,a=e.split("\n"),r=[],n=null,i=null,o=null,c=Object(ge.a)(a);try{for(c.s();!(t=c.n()).done;){var s=t.value;if(s.trim()){if(s.startsWith("#")){var l=/^(#+)\s*(.+)$/.exec(s);if(l){p(),n={headerKind:1===l[1].length?"single":2===l[1].length?"double":"triple",header:l[2],attributes:{}},i=null,o=null;continue}}if(n){var u=/^[*-]\s+(?:([^:]+):)?(.*)$/.exec(s),d=/^ {4}([*-])\s+(.*)$/.exec(s);u?u[1]?(i&&o&&(n.attributes[i]=o.trim()),i=u[1].toLowerCase(),o=u[2]):i&&(o+=u[2]):d&&i&&(n.listAttributes||(n.listAttributes={}),n.listAttributes[i]||(n.listAttributes[i]=[]),d[2]&&n.listAttributes[i].push(d[2].trim()))}}else o&&(o+="\n")}}catch(e){c.e(e)}finally{c.f()}return p(),r;function p(){n&&(i&&o&&(n.attributes[i]=o.trim()),r.push(n))}}(e);(null==t?void 0:t.length)||ka("Cannot parse content: ".concat(e));for(var a,r=[],n=-1,i=0;i<t.length;i++)"single"===t[i].headerKind?a=va(t[i]):"double"===t[i].headerKind&&(n>=0&&r.push(da(t[n],t.slice(n+1,i))),n=i);return(n>0||0===r.length)&&r.push(da(t[n],t.slice(n+1,t.length))),{maps:r,metadata:a}}function da(e,t){var a=function(e){var t={mapId:e.header.toLowerCase(),displayName:e.attributes.name||e.header,description:e.attributes.description,completionUrl:e.attributes.completionurl,prerequisites:[],activities:{},allowCodeCarryover:!e.attributes.allowcodecarryover||!ha(e.attributes.allowcodecarryover)};if("manual"===e.attributes.layout&&(t.layout="manual"),e.attributes.required){var a,r=e.attributes.required.split(","),n=Object(ge.a)(r);try{for(n.s();!(a=n.n()).done;){var i=a.value,o=/^\s*(?:(\d+) +)?(.+)$/.exec(i);o[1]?t.prerequisites.push({type:"tag",tag:o[2].trim(),numberCompleted:parseInt(o[1])}):t.prerequisites.push({type:"map",mapId:o[2].trim()})}}catch(e){n.e(e)}finally{n.f()}}return t}(e),r=t.map(pa),n=r.filter((function(e){return"activity"===e.kind}));a.allowCodeCarryover&&n.forEach((function(e){void 0===e.allowCodeCarryover&&(e.allowCodeCarryover=!0)})),a.root=r[0];var i,o=Object(ge.a)(r);try{for(o.s();!(i=o.n()).done;){var c=i.value;a.activities[c.activityId]&&ka("Duplicate activity id '".concat(c.activityId,"' in map '").concat(a.mapId,"'")),a.activities[c.activityId]=c}}catch(e){o.e(e)}finally{o.f()}var s,l=Object(ge.a)(r);try{for(l.s();!(s=l.n()).done;){var u,d=s.value,h=Object(ge.a)(d.nextIds);try{for(h.s();!(u=h.n()).done;){var v=u.value;a.activities[v]||ka("Unknown activity id '".concat(v,"' in map '").concat(a.mapId,"'")),d.next.push(a.activities[v])}}catch(e){h.e(e)}finally{h.f()}}}catch(e){l.e(e)}finally{l.f()}var m={};!function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[t.activityId])console.warn("Loop in map '".concat(a.mapId,"' detected"));else{r[t.activityId]=!0,m[t.activityId]=!0;var n,i=Object(ge.a)(t.next);try{for(i.s();!(n=i.n()).done;){var o=n.value;e(o,Object(p.a)({},r))}}catch(e){i.e(e)}finally{i.f()}}}(a.root);var f,y=Object(ge.a)(r);try{for(y.s();!(f=y.n()).done;){var b=f.value;m[b.activityId]||console.warn("Unreachable activity detected '".concat(b.activityId,"' in map '").concat(a.mapId,"'"))}}catch(e){y.e(e)}finally{y.f()}return a}function pa(e){var t={activityId:e.header.toLowerCase(),imageUrl:e.attributes.imageurl,next:[],displayName:e.attributes.name||e.header,nextIds:ga(e.attributes.next)};if(e.attributes.position){var a=e.attributes.position.split(" ");t.position={depth:parseInt(a[0])||0,offset:parseInt(a[1])||0}}if(e.attributes.edges){var r;t.edges=[];var n=ga(e.attributes.edges,!1,";");null===(r=t.nextIds)||void 0===r||r.forEach((function(e,a){var r,i=ga(n[a])||[];null===(r=t.edges)||void 0===r||r.push(i.map((function(e){var t=e.split(" ");return{depth:parseInt(t[0])||0,offset:parseInt(t[1])||0}})))}))}return"reward"===e.attributes.kind||"completion"===e.attributes.kind?function(e,t){var a,r=Object(p.a)(Object(p.a)({},t),{},{kind:e.attributes.kind||"reward",url:e.attributes.url});if(e.attributes.type){var n=e.attributes.type.toLowerCase();switch(n){case"certificate":r.type=n}}if(null===(a=e.listAttributes)||void 0===a?void 0:a.actions){var i,o=[],c=e.listAttributes.actions,s=Object(ge.a)(c);try{for(s.s();!(i=s.n()).done;){var l=i.value.split(":"),u=Object(la.a)(l),d=u[0],h=u.slice(1),v=/\s*\[\s*(.*)\s*\](?:\(([^\s]+)\))?/gi.exec(h.join(":")),m=null==v?void 0:v[1],f=null==v?void 0:v[2];switch(d){case"activity":o.push({kind:"activity",label:m,activityId:f});break;case"map":if(f){var y=fa(f)?"github":ya(f)?"docs":void 0;y||ka("URL: ".concat(f," must be to Github or MakeCode documentation")),o.push({kind:"map",label:m,url:"#".concat(y,":").concat(f)})}break;case"docs":if(f){var b=(f.startsWith("/")?"":"/")+f;ya(b)||ka("URL: ".concat(b," must be to MakeCode documentation")),o.push({kind:"docs",label:m,url:b})}break;case"editor":o.push({kind:"editor",label:m})}}}catch(e){s.e(e)}finally{s.f()}o.length&&(r.actions=o)}return r}(e,t):"layout"===e.attributes.kind?function(e,t){return Object(p.a)(Object(p.a)({},t),{},{kind:"layout",next:[]})}(0,t):function(e,t){var a=Object(p.a)(Object(p.a)({},t),{},{kind:"activity",description:e.attributes.description,url:e.attributes.url,tags:ga(e.attributes.tags),allowCodeCarryover:!e.attributes.allowcodecarryover||!ha(e.attributes.allowcodecarryover)});if(e.attributes.type){var r=e.attributes.type.toLowerCase();switch(r){case"tutorial":a.type=r}}if(e.attributes.editor){var n=e.attributes.editor.toLowerCase();switch(n){case"py":case"blocks":case"js":a.editor=n;break;default:a.editor="blocks"}}return a.url||ka("Activity '".concat(a.activityId,"' is missing attribute 'url'")),a.type||ka("Activity '".concat(a.activityId,"' is missing attribute 'type'")),a}(e,t)}function ha(e){if(!e)return!1;switch(e.toLowerCase().trim()){case"0":case"no":case"n":case"off":case"false":return!0;default:return!1}}function va(e){var t=e.attributes.primarycolor,a=e.attributes.secondarycolor,r=e.attributes.tertiarycolor,n=e.attributes.highlightcolor,i=e.attributes.unlockednodecolor,o=e.attributes.lockednodecolor,c=e.attributes.completednodecolor;return{title:e.attributes.name||e.header,description:e.attributes.description,infoUrl:ba(e.attributes.infourl),backgroundImageUrl:e.attributes.backgroundurl,bannerImageUrl:e.attributes.bannerurl,alternateSources:ga(e.attributes.alternatesources),theme:{backgroundColor:r||"var(--body-background-color)",pathColor:t||"#BFBFBF",strokeColor:"#000000",rewardNodeColor:n||"var(--primary-color)",rewardNodeForeground:n?ma(n):"#000000",unlockedNodeColor:i||a||"var(--secondary-color)",unlockedNodeForeground:i||a?ma(i||a):"#000000",lockedNodeColor:o||t||"#BFBFBF",lockedNodeForeground:o||t?ma(o||t):"#000000",completedNodeColor:c||a||"var(--secondary-color)",completedNodeForeground:c||a?ma(c||a):"#000000",selectedStrokeColor:n||"var(--primary-color)",pathOpacity:.5}}}function ma(e){return e=e.replace("#",""),Number.parseInt(e.slice(0,2),16)+Number.parseInt(e.slice(2,4),16)+Number.parseInt(e.slice(4),16)>382.5?"#000000":"#ffffff"}function fa(e){return e.match(/^(https?:\/\/)?(www\.)?github\.com\//gi)}function ya(e){return e.indexOf(".")<0}function ba(e){if(e)return fa(e)?e.replace(/\?[\s\S]+$/gi,""):ya(e)?"".concat(e.startsWith("/")?"":"/").concat(e):void ka("URL: ".concat(e," must be to Github or MakeCode documentation"))}function ga(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:",";if(!e)return[];var r=e.split(a).map((function(e){return e.trim().toLowerCase()})).filter((function(e){return!!e}));if(!t){var n={};return r.forEach((function(e){return n[e]=e})),Object.keys(n)}return r}function ka(e){throw e}a(47),a(48);var Ia=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(){var e;Object(We.a)(this,a);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))).renderUserProfile=function(){var t,a=e.props.profile;return i.createElement(Lt,{title:(null==a||null===(t=a.idp)||void 0===t?void 0:t.displayName)||"",fullscreen:!0,onClose:e.handleOnClose},i.createElement("div",{className:"profiledialog"},e.getAccountPanel(),e.getFeedbackPanel()))},e.getAccountPanel=function(){var t,a,r,n,o,c,s,l,u,d,p=e.props.profile,h=(null==p||null===(t=p.idp)||void 0===t?void 0:t.provider)&&pxt.auth.identityProvider(null==p||null===(a=p.idp)||void 0===a?void 0:a.provider),v=i.createElement("div",{className:"profile-pic avatar"},i.createElement("img",{src:null==p||null===(r=p.idp)||void 0===r||null===(n=r.picture)||void 0===n?void 0:n.dataUrl,alt:lf("User")})),m=i.createElement("div",{className:"profile-pic avatar"},i.createElement("span",null,pxt.auth.userInitials(p)));return i.createElement("div",{className:"account panel ui card"},i.createElement("div",{className:"header-text"},i.createElement("label",null,lf("Profile"))),(null==p||null===(o=p.idp)||void 0===o||null===(c=o.picture)||void 0===c?void 0:c.dataUrl)?v:m,i.createElement("div",{className:"row-span-two"},i.createElement("label",{className:"title"},lf("Name")),i.createElement("p",{className:"value"},(null==p||null===(s=p.idp)||void 0===s?void 0:s.displayName)||(null==p||null===(l=p.idp)||void 0===l?void 0:l.username))),i.createElement("div",{className:"row-span-two"},i.createElement("label",{className:"title"},lf("Username")),i.createElement("p",{className:"value"},null==p||null===(u=p.idp)||void 0===u?void 0:u.username)),i.createElement("div",{className:"row-span-two"},i.createElement("label",{className:"title"},lf("Provider")),i.createElement("p",{className:"value"},null==h?void 0:h.name)),i.createElement("div",{className:"row-span-two",onClick:e.handleSignout},i.createElement("div",{className:"ui icon button"},i.createElement("span",{className:"xicon ".concat(null==p||null===(d=p.idp)||void 0===d?void 0:d.provider)}),i.createElement("span",null," ",lf("Sign out")," "))),i.createElement("div",{className:"row-span-two"},i.createElement("a",{className:"ui",title:lf("delete profile"),onClick:e.handleDeleteAccountClick},lf("I want to delete my profile")," ")))},e.handleOnClose=function(){e.props.dispatchCloseUserProfile()},e.getFeedbackPanel=function(){return i.createElement("div",{className:"feedback panel ui card"},i.createElement("div",{className:"header-text"},i.createElement("label",null,lf("Feedback"))),i.createElement("div",{className:"row-span-two"},lf("What do you think about the Sign In & Cloud Save feature? Is there something you'd like to change? Did you encounter issues? Please let us know!")),i.createElement("div",{className:"row-span-two"},i.createElement("a",{className:"ui",title:lf("Provide feedback in a from"),href:"https://aka.ms/AAcnpaj",target:"_blank"},i.createElement("i",{className:"icon external alternate"}),lf("Take the Survey"))))},e.handleSignout=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:pxt.tickEvent("skillmap.userprofile.signout"),gt(location.hash);case 2:case"end":return e.stop()}}),e)}))),e.handleDeleteAccountClick=Object(Z.a)(X.a.mark((function t(){return X.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.dispatchShowDeleteAccountModal();case 1:case"end":return t.stop()}}),t)}))),e}return Object(Ge.a)(a,[{key:"render",value:function(){return this.props.showProfile?this.renderUserProfile():i.createElement("div",null)}}]),a}(i.Component),Oa={dispatchCloseUserProfile:et,dispatchShowDeleteAccountModal:function(){return{type:V}}},Sa=Object(l.b)((function(e,t){return e?{signedIn:e.auth.signedIn,profile:e.auth.profile,showProfile:e.showProfile}:{}}),Oa)(Ia),wa=function(e){Object(ze.a)(a,e);var t=Object(qe.a)(a);function a(e){var r;return Object(We.a)(this,a),(r=t.call(this,e)).queryFlags={},r.unsubscribeChangeListener=void 0,r.loadedUser=void 0,r.sendMessageAsync=void 0,r.handleHashChange=function(){var e=Object(Z.a)(X.a.mark((function e(t){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.parseHashAsync();case 2:t.stopPropagation(),t.preventDefault();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.handleError=function(e){var t=e||lf("Oops! Couldn't load content, please check the URL and markdown file.");console.error(t),r.setState({error:t})},r.onMakeCodeFrameLoaded=function(){var e=Object(Z.a)(X.a.mark((function e(t){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.sendMessageAsync=t,e.next=3,r.cloudSyncCheckAsync();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.onStoreChange=Object(Z.a)(X.a.mark((function e(){var t,a;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ve.getState(),(a=t.user)===r.loadedUser||r.loadedUser&&a.id!==r.loadedUser.id){e.next=5;break}return e.next=4,ct(a);case 4:r.loadedUser=a;case 5:case"end":return e.stop()}}),e)}))),r.state={},window.addEventListener("hashchange",r.handleHashChange),r}return Object(Ge.a)(a,[{key:"parseHashAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){var t,a,r,n,i,o;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pxt.targetConfigAsync();case 2:return r=e.sent,i=window.location.hash.replace("#",""),n=i&&(null===(t=r.skillMap)||void 0===t||null===(a=t.pathAliases)||void 0===a?void 0:a[i])?te(r.skillMap.pathAliases[i]):te(window.location.hash||(null===(o=r.skillMap)||void 0===o?void 0:o.defaultPath)),e.next=7,this.fetchAndParseSkillMaps(n.cmd,n.arg);case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"initLocalizationAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){var t,a,r,n,i,o,c,s;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=pxt.appTarget.appTheme,a=window.location.href,r=!1,n=void 0,/[&?]translate=1/.test(a)&&!pxt.BrowserUtils.isIE()?n=ts.pxtc.Util.TRANSLATION_LOCALE:((i=/(live)?(force)?lang=([a-z]{2,}(-[A-Z]+)?)/i.exec(window.location.href))&&window.location.hash.indexOf(i[0])>=0&&pxt.BrowserUtils.changeHash(window.location.hash.replace(i[0],"")),n=i?i[3]:pxt.BrowserUtils.getCookieLang()||t.defaultLocale||navigator.userLanguage||navigator.language,r=!!i&&!!i[2]),o=pxt.appTarget.id,c=pxt.appTarget.versions.pxtCrowdinBranch,s=pxt.appTarget.versions.targetCrowdinBranch,pxt.BrowserUtils.isLocalHostDev()&&(pxt.appTarget.appTheme.defaultLocale||"en")===n||pxt.BrowserUtils.isPxtElectron()||pxt.Util.enableLiveLocalizationUpdates(),e.next=12,Ca({targetId:o,baseUrl:"",code:n,pxtBranch:c,targetBranch:s,force:r});case 12:pxt.Util.isLocaleEnabled(n)&&pxt.BrowserUtils.setCookieLang(n);case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"fetchAndParseSkillMaps",value:function(){var e=Object(Z.a)(X.a.mark((function e(t,a){var n,i,o,c,s,l,u,d,p,h,v,m,f,y,b,g,k=this;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,re(t,a);case 2:if(n=e.sent,i=null==n?void 0:n.text,o=null==n?void 0:n.identifier,c=null==n?void 0:n.status,i&&o&&c)try{"banned"===c?this.handleError(lf("This GitHub repository has been banned.")):(ye(o),this.props.dispatchSetPageSourceUrl(o,c),this.props.dispatchClearMetadata()),l=ua(i),u=l.maps,d=l.metadata,(null==u?void 0:u.length)>0&&(s=u,this.props.dispatchClearSkillMaps(),u.forEach((function(e){k.props.dispatchAddSkillMap(e)}))),d&&(p=d.title,h=d.description,v=d.infoUrl,m=d.backgroundImageUrl,f=d.bannerImageUrl,y=d.theme,b=d.alternateSources,r=p,this.props.dispatchSetPageTitle(p),h&&this.props.dispatchSetPageDescription(h),v&&this.props.dispatchSetPageInfoUrl(v),m&&this.props.dispatchSetPageBackgroundImageUrl(m),f&&this.props.dispatchSetPageBannerImageUrl(f),b&&this.props.dispatchSetPageAlternateUrls(b),y&&this.props.dispatchSetPageTheme(y)),this.setState({error:void 0})}catch(e){this.handleError(e)}else this.setState({error:lf("No content loaded.")});return e.next=9,it();case 9:g=e.sent,o&&!g.completedTags[o]&&(g.completedTags[o]={}),this.applyQueryFlags(g,s,o),this.loadedUser=g,this.props.dispatchSetUser(g);case 14:case"end":return e.stop()}}),e,this)})));return function(t,a){return e.apply(this,arguments)}}()},{key:"cloudSyncCheckAsync",value:function(){var e=Object(Z.a)(X.a.mark((function e(){var t,a,r,n,i,o,c,s,l,u,d,h,v,m,f,y,b,g,k,I,O,S,w,C,x,j,E;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,mt();case 2:if(e.t1=e.sent,!e.t1){e.next=5;break}e.t1=this.sendMessageAsync;case 5:if(e.t0=e.t1,!e.t0){e.next=8;break}e.t0=this.loadedUser;case 8:if(!e.t0){e.next=55;break}return t=Ve.getState(),e.next=12,rt();case 12:return a=e.sent,e.next=15,it();case 15:return r=e.sent,n=Me(a,t.pageSourceUrl,r),e.next=19,this.sendMessageAsync({type:"pxteditor",action:"savelocalprojectstocloud",headerIds:n});case 19:if(!(i=e.sent.resp.headerIdMap)){e.next=53;break}n=n.map((function(e){return i[e]||e})),o=Object.keys(r.mapProgress),c=Object(p.a)(Object(p.a)({},r),{},{mapProgress:{}}),s=0,l=o;case 25:if(!(s<l.length)){e.next=49;break}if(u=l[s],c.mapProgress[u]=Object(p.a)({},r.mapProgress[u]),a.mapProgress[u]){e.next=30;break}return e.abrupt("continue",46);case 30:d=Object.keys(a.mapProgress[u]),h=0,v=d;case 32:if(!(h<v.length)){e.next=46;break}if(m=v[h],c.mapProgress[u][m]=Object(p.a)({},r.mapProgress[u][m]),0===Object.keys(c.mapProgress[u][m].activityState).length){e.next=37;break}return e.abrupt("continue",43);case 37:for(f={},c.mapProgress[u][m].activityState=f,y=r.mapProgress[u][m].activityState,b=a.mapProgress[u][m].activityState,g=0,k=Object.keys(y);g<k.length;g++)I=k[g],O=y[I],f[I]=Object(p.a)(Object(p.a)({},O),{},{headerId:O.headerId&&i[O.headerId]||O.headerId});for(S=0,w=Object.keys(b);S<w.length;S++)C=w[S],x=y[C],j=b[C],x&&x.headerId||!j.headerId||(E=x||j,f[C]=Object(p.a)(Object(p.a)({},E),{},{headerId:j.headerId&&i[j.headerId]||j.headerId}));case 43:h++,e.next=32;break;case 46:s++,e.next=25;break;case 49:return this.props.dispatchSetUser(c),e.next=52,ct(c);case 52:r=c;case 53:return e.next=55,this.sendMessageAsync({type:"pxteditor",action:"requestprojectcloudstatus",headerIds:Me(r,t.pageSourceUrl)});case 55:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"componentDidMount",value:function(){var e=Object(Z.a)(X.a.mark((function e(){return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.unsubscribeChangeListener=Ve.subscribe(this.onStoreChange),this.queryFlags=ae(),!this.queryFlags.authcallback){e.next=5;break}return e.next=5,yt(this.queryFlags);case 5:return e.next=7,ht();case 7:return e.next=9,this.initLocalizationAsync();case 9:return e.next=11,this.parseHashAsync();case 11:return e.next=13,this.cloudSyncCheckAsync();case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"componentWillUnmount",value:function(){window.removeEventListener("hashchange",this.handleHashChange),this.unsubscribeChangeListener&&this.unsubscribeChangeListener()}},{key:"render",value:function(){var e=this.props,t=e.skillMaps,a=e.activityOpen,r=e.backgroundImageUrl,n=e.theme,i=this.state.error,c=Object.keys(t).map((function(e){return t[e]}));return o.a.createElement("div",{className:"app-container ".concat(pxt.appTarget.id)},o.a.createElement(At,null),o.a.createElement("div",{className:"skill-map-container ".concat(a?"hidden":""),style:{backgroundColor:n.backgroundColor}},i?o.a.createElement("div",{className:"skill-map-error"},i):o.a.createElement(Jt,{maps:c,backgroundImageUrl:r}),!i&&o.a.createElement(sa,null)),o.a.createElement(Tt,{onFrameLoaded:this.onMakeCodeFrameLoaded}),o.a.createElement(Ht,null),o.a.createElement(Sa,null))}},{key:"applyQueryFlags",value:function(e,t,a){var r=a||"default";if("true"===this.queryFlags.debugNewUser&&(e.isDebug=!0,e.mapProgress=Object(d.a)({},r,{}),e.completedTags={}),"true"===this.queryFlags.debugCompleted&&(e.isDebug=!0,e.mapProgress=Object(d.a)({},r,{}),t)){var n,i=Object(ge.a)(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;e.mapProgress[r][o.mapId]={completionState:"completed",mapId:o.mapId,activityState:{}};for(var c=0,s=Object.keys(o.activities);c<s.length;c++){var l,u=s[c],p=o.activities[u];if(e.mapProgress[r][o.mapId].activityState[p.activityId]?e.mapProgress[r][o.mapId].activityState[p.activityId].isCompleted=!0:e.mapProgress[r][o.mapId].activityState[p.activityId]={activityId:p.activityId,isCompleted:!0},"activity"===p.kind&&(null===(l=p.tags)||void 0===l?void 0:l.length)&&a){var h,v=Object(ge.a)(p.tags);try{for(v.s();!(h=v.n()).done;){var m=h.value;e.completedTags[a][m]||(e.completedTags[a][m]=0),e.completedTags[a][m]++}}catch(e){v.e(e)}finally{v.f()}}}}}catch(e){i.e(e)}finally{i.f()}}}}]),a}(o.a.Component);function Ca(e){return xa.apply(this,arguments)}function xa(){return(xa=Object(Z.a)(X.a.mark((function e(t){var a,r,n,i,o,c;return X.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.targetId,r=t.baseUrl,n=t.pxtBranch,i=t.targetBranch,t.force,o=t.code,e.next=4,pxt.Util.downloadTranslationsAsync(a,r,o,n,i,pxt.Util.liveLocalizationEnabled(),ts.pxtc.Util.TranslationsKind.SkillMap);case 4:c=e.sent,pxt.Util.setUserLanguage(o),c&&pxt.Util.setLocalizedStrings(c);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ja={dispatchAddSkillMap:function(e){return{type:h,map:e}},dispatchClearSkillMaps:function(){return{type:v}},dispatchClearMetadata:function(){return{type:m}},dispatchSetPageTitle:function(e){return{type:x,title:e}},dispatchSetPageDescription:function(e){return{type:j,description:e}},dispatchSetPageInfoUrl:function(e){return{type:E,infoUrl:e}},dispatchSetUser:function(e){return{type:S,user:e}},dispatchSetPageSourceUrl:function(e,t){return{type:P,url:e,status:t}},dispatchSetPageAlternateUrls:function(e){return{type:M,urls:e}},dispatchSetPageBackgroundImageUrl:function(e){return{type:A,backgroundImageUrl:e}},dispatchSetPageBannerImageUrl:function(e){return{type:N,bannerImageUrl:e}},dispatchSetPageTheme:function(e){return{type:U,theme:e}}},Ea=Object(l.b)((function(e,t){return e?{skillMaps:e.maps,activityOpen:!!e.editorView,backgroundImageUrl:e.backgroundImageUrl,theme:e.theme,signedIn:e.auth.signedIn}:{}}),ja)(wa),Aa=window.pxtTargetBundle;Aa.bundledpkgs={},pxt.setAppTarget(Aa),pxt.Cloud.apiRoot="https://www.makecode.com/api/",me()||pxt.setupWebConfig(window.pxtConfig),s.a.render(o.a.createElement(l.a,{store:Ve},o.a.createElement(Ea,null)),document.getElementById("root"))}},[[49,1,2]]]);
|