(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8896],{87068:function(n,e,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[nodeKey]",function(){return r(65185)}])},65185:function(n,e,r){"use strict";r.r(e),r.d(e,{default:function(){return k}});var t=r(85893),o=r(67294),i=r(11163),a=r(49254),c=r(82954),u=r(11691);const l=n=>{const e=typeof n;return null!==n&&("object"===e||"function"===e)},s=new Set(["__proto__","prototype","constructor"]),d=new Set("0123456789");function f(n){const e=[];let r="",t="start",o=!1;for(const i of n)switch(i){case"\\":if("index"===t)throw new Error("Invalid character in an index");if("indexEnd"===t)throw new Error("Invalid character after an index");o&&(r+=i),t="property",o=!o;break;case".":if("index"===t)throw new Error("Invalid character in an index");if("indexEnd"===t){t="property";break}if(o){o=!1,r+=i;break}if(s.has(r))return[];e.push(r),r="",t="property";break;case"[":if("index"===t)throw new Error("Invalid character in an index");if("indexEnd"===t){t="index";break}if(o){o=!1,r+=i;break}if("property"===t){if(s.has(r))return[];e.push(r),r=""}t="index";break;case"]":if("index"===t){e.push(Number.parseInt(r,10)),r="",t="indexEnd";break}if("indexEnd"===t)throw new Error("Invalid character after an index");default:if("index"===t&&!d.has(i))throw new Error("Invalid character in an index");if("indexEnd"===t)throw new Error("Invalid character after an index");"start"===t&&(t="property"),o&&(o=!1,r+="\\"),r+=i}switch(o&&(r+="\\"),t){case"property":if(s.has(r))return[];e.push(r);break;case"index":throw new Error("Index was not closed");case"start":e.push("")}return e}function p(n,e){if("number"!==typeof e&&Array.isArray(n)){const r=Number.parseInt(e,10);return Number.isInteger(r)&&n[r]===n[e]}return!1}function v(n,e,r){if(!l(n)||"string"!==typeof e)return void 0===r?n:r;const t=f(e);if(0===t.length)return r;for(let o=0;o<t.length;o++){const e=t[o];if(void 0===(n=p(n,e)?o===t.length-1?void 0:null:n[e])||null===n){if(o!==t.length-1)return r;break}}return void 0===n?r:n}function h(n){if("string"!==typeof n)throw new TypeError("Expected a string");return n.replaceAll(/[\\.[]/g,"\\$&")}function y(n){const e=Object.entries(n);return Array.isArray(n)?e.map((([n,e])=>[Number(n),e])):e}function*w(n,e=[]){var r;if(!l(n)||l(r=n)&&0===Object.keys(r).length)e.length>0&&(yield function(n){let e="";for(let[r,t]of y(n))"number"===typeof t?e+=`[${t}]`:(t=h(t),e+=0===r?t:`.${t}`);return e}(e));else for(const[t,o]of y(n))yield*w(o,[...e,t])}function x(n){var e,r,t,o=n.enrollmentData,i=n.progressKey,a=n.nodeKey,c=null,u=null,l=null,s=null===o||void 0===o||null===(e=o.user)||void 0===e?void 0:e.enrollments,d=null===s||void 0===s?void 0:s.find((function(n){return(null===n||void 0===n?void 0:n.key)===a})),f=null!==(t=null===d||void 0===d||null===(r=d.root_node)||void 0===r?void 0:r.semantic_type)&&void 0!==t?t:null;if(d&&f){if(!i||"string"!==typeof i)return _(f,a);var p,h,y,x,b,k,E=function(n,e,r){var t,o=null===e||void 0===e||null===(t=e.user)||void 0===t?void 0:t.enrollments,i=null===o||void 0===o?void 0:o.find((function(e){return(null===e||void 0===e?void 0:e.key)===n}));if(!i)return null;var a=!0,c=!1,u=void 0;try{for(var l,s=(h=i,[...w(h)])[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var d=l.value;if(v(i,d)===r){var f=d.split(".");f.splice(f.length-1,1);var p=v(i,f.join("."));if(p)return{node:p,path:d}}}}catch(y){c=!0,u=y}finally{try{a||null==s.return||s.return()}finally{if(c)throw u}}var h;return null}(a,o,i);if(!E)return _(f,a);if("Concept"===E.node.semantic_type)c=E.node.key,u=null!==(y=null===(p=g(d,"semantic_type","Lesson",E.path))||void 0===p?void 0:p.key)&&void 0!==y?y:null,l=null!==(x=null===(h=g(d,"semantic_type","Part",E.path))||void 0===h?void 0:h.key)&&void 0!==x?x:null;if("Lesson"===E.node.semantic_type)u=E.node.key,l=null!==(k=null===(b=g(d,"semantic_type","Part",E.path))||void 0===b?void 0:b.key)&&void 0!==k?k:null;if("Part"===E.node.semantic_type&&(l=E.node.key),"Degree"===f){if(c&&u&&l)return"/nanodegrees/".concat(a,"/parts/").concat(l,"/lessons/").concat(u,"/concepts/").concat(c);if(u&&l)return"/nanodegrees/".concat(a,"/parts/").concat(l,"/lessons/").concat(u);if(l)return"/nanodegrees/".concat(a,"/parts/").concat(l)}if("Course"===f){if(c&&u)return"/courses/".concat(a,"/lessons/").concat(u,"/concepts/").concat(c);if(u)return"/courses/".concat(a,"/lessons/").concat(u)}if("Part"===f){if(c&&u)return"/paid-courses/".concat(a,"/lessons/").concat(u,"/concepts/").concat(c);if(u)return"/paid-courses/".concat(a,"/lessons/").concat(u)}return _(f,a)}}function g(n,e,r,t){for(var o=t.split(".");o.length>0;){o.splice(o.length-1,1);var i=v(n,o.join("."));if(i&&i[e]===r)return i}return null}function _(n,e){return"Degree"===n?"/nanodegrees/".concat(e):"Course"===n?"/courses/".concat(e):"Part"===n?"/paid-courses/".concat(e):void 0}var b=r(83615),k=function(){var n=function(){var n,r;f?null===window||void 0===window||null===(n=window.location)||void 0===n||null===(r=n.replace)||void 0===r||r.call(n,p):e.push("/")},e=(0,i.useRouter)(),r=(0,a._N)(),l=r.data,s=r.error,d=(0,b.Q)(),f=d.shouldSeeDashboard,p=d.dashboardUrl;return(0,o.useEffect)((function(){if(e&&l){var r=e.query,t=r.progressKey,o=r.nodeKey;if(o&&"string"===typeof o){var i=x({enrollmentData:l,progressKey:t,nodeKey:o});i?e.push(i):n()}else n()}}),[l,e]),(0,o.useEffect)((function(){s&&n()}),[e,s]),(0,t.jsx)(u.X,{children:(0,t.jsx)(c.S,{})})}}},function(n){n.O(0,[2678,4885,3817,1397,2246,5462,2353,3320,9774,2888,179],(function(){return e=87068,n(n.s=e);var e}));var e=n.O();_N_E=e}]);