text: (window.webpackJsonp=window.webpackJsonp||[]).push([[8],{164:function(t,e,i){"use strict";i(165),i(21);var n=[{key:"javascript",text:"⚛️ Javascript",buttonText:"Javascript"},{key:"csharp",text:"⚛️ C#",buttonText:"C#"},{key:"elm",text:"⚛️ Elm",buttonText:"Elm"}],s=[{key:"computer",text:"💻 Computer required",buttonText:"Computer"},{key:"nocomputer",text:"⛔️💻 No computer needed",buttonText:"No Computer"},{key:"whiteboard",text:"✏️ You may want a whiteboard",buttonText:"Whiteboard"},{key:"nowhiteboard",text:"⛔️✏️ No whiteboarding",buttonText:"No Whiteboard"}],a=[{key:"easy",text:"😅 Easy",buttonText:"😅 Easy"},{key:"medium",text:"🤔 Medium",buttonText:"🤔 Medium"},{key:"hard",text:"😨 Hard",buttonText:"😨 Hard"},{key:"unknown",text:"😵 Not so sure about this one",buttonText:"😵 Unknown"},{key:"impossible",text:"☠️ Impossible",buttonText:"☠️ Impossible"}],r=n.concat(s).reduce(function(t,e){return t[e.key]=e.text,t},{}),o=a.reduce(function(t,e){return t[e.key]=e.text,t},{});e.a={difficultyRatings:a,languages:n,categories:s,categoryText:r,difficultyRatingText:o,isValidDifficulty:function(t){return a.filter(function(e){return e.key===t}).length>0},isValidCategory:function(t){return s.filter(function(e){return e.key===t}).length>0}}},165:function(t,e,i){"use strict";var n=i(2),s=i(166);n(n.P+n.F*!i(17)([].reduce,!0),"Array",{reduce:function(t){return s(this,t,arguments.length,arguments[1],!1)}})},166:function(t,e,i){var n=i(22),s=i(23),a=i(51),r=i(50);t.exports=function(t,e,i,o,c){n(e);var u=s(t),l=a(u),g=r(u.length),f=c?g-1:0,d=c?-1:1;if(i<2)for(;;){if(f in l){o=l[f],f+=d;break}if(f+=d,c?f<0:g<=f)throw TypeError("Reduce of empty array with no initial value")}for(;c?f>=0:g>f;f+=d)f in l&&(o=e(o,l[f],f,u));return o}},171:function(t,e,i){},176:function(t,e,i){"use strict";var n=i(171);i.n(n).a},178:function(t,e,i){"use strict";i.r(e);i(87),i(21);var n=i(164),s={javascript:[{title:"1. Name two programming paradigms important for JavaScript developers.",slug:"_1-name-two-programming-paradigms-important-for-javascript-developers",url:"/javascript/#_1-name-two-programming-paradigms-important-for-javascript-developers",difficulty:"easy",categories:["nocomputer","nowhiteboard"]}]};var a=function(t){return t&&t.language||console.error("Invalid Parameters provided."),new Promise(function(e,i){s[t.language]||i("Invalid language provided for question");var n=JSON.parse(JSON.stringify(s[t.language]));t.difficulty&&t.difficulty.length>0&&(n=n.filter(function(e){return t.difficulty.filter(function(t){return t===e.difficulty}).length>0})),0===n.length&&i("No question found after difficulty filter applied"),t.categories&&t.categories.length>0&&(n=n.filter(function(e){return t.categories.filter(function(t){return e.categories.filter(function(e){return t===e}).length>0}).length>0})),0===n.length&&i("No question found after category filter applied");var a=n[function(t,e){return Math.floor(Math.random()*(e-t+1))+t}(0,n.length-1)];a&&e(a),i("No question found.")})},r=function(t){var e={left:[],center:[],right:[]},i=Math.floor(t.length/3),n=t.length-3*i;return e.left=t.slice(0,i),e.center=t.slice(i,2*i),e.right=t.slice(2*i,3*i),n>0&&(e.left.push(t.slice(3*i)[0]),n>1&&e.center.push(t.slice(3*i)[1])),e},o={data:function(){return{languages:{},categories:{},ratings:{},selectedLanguage:"",selectedDifficulties:[],selectedCategories:[],ratingsExpanded:!1,categoriesExpanded:!1,noResults:!1}},mounted:function(){var t=this;if(this.languages=r(n.a.languages),this.categories=r(n.a.categories),this.ratings=r(n.a.difficultyRatings),n.a.languages.filter(function(e){return e.key===t.$route.query.language}).length>0&&(this.selectedLanguage=this.$route.query.language,this.ratingsExpanded=!0),this.$route.query.difficulty){var e=this.$route.query.difficulty.split("|");if(e&&e.length>0){var i=e.filter(function(t){return n.a.isValidDifficulty(t)});i&&i.length>0&&(this.selectedDifficulties=i,this.categoriesExpanded=!0)}}if(this.$route.query.categories){var s=this.$route.query.categories.split("|");if(s&&s.length>0){var a=s.filter(function(t){return n.a.isValidCategory(t)});a&&a.length>0&&(this.selectedCategories=a)}}},computed:{filterRatingsText:function(){var t="Filter by question difficulty";return this.ratingsExpanded?t+" ↑":t+" ↓"},filterCategoriesText:function(){var t="Filter by question categories";return this.categoriesExpanded?t+" ↑":t+" ↓"},selectionValid:function(){return!!this.selectedLanguage}},methods:{setLanguage:function(t){this.selectedLanguage=t,this.ratingsExpanded=!0},toggleDifficulty:function(t){this.difficultySet(t)?this.selectedDifficulties=this.selectedDifficulties.filter(function(e){return e!==t}):(this.selectedDifficulties.push(t),this.categoriesExpanded=!0)},difficultySet:function(t){return this.selectedDifficulties.filter(function(e){return e===t}).length>0},toggleCategory:function(t){this.categorySet(t)?this.selectedCategories=this.selectedCategories.filter(function(e){return e!==t}):this.selectedCategories.push(t)},categorySet:function(t){return this.selectedCategories.filter(function(e){return e===t}).length>0},findQuestion:function(){var t=this;this.selectionValid&&a({language:this.selectedLanguage,categories:this.selectedCategories,difficulty:this.selectedDifficulties}).then(function(e){e&&e.url&&t.$router.push({path:e.url,query:t.getParameters()})}).catch(function(e){console.debug(e),t.noResults=!0})},getParameters:function(){var t={language:this.selectedLanguage};return this.selectedCategories&&this.selectedCategories.length>0&&(t.categories=this.selectedCategories.join("|")),this.selectedDifficulties&&this.selectedDifficulties.length>0&&(t.difficulty=this.selectedDifficulties.join("|")),t}}},c=(i(176),i(0)),u=Object(c.a)(o,function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"question-finder"},[t._m(0),i("div",{staticClass:"programming-langs"},[i("div",{staticClass:"programming-lang-column"},t._l(t.languages.left,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.selectedLanguage===e.key},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.setLanguage(e.key)}}})])})),i("div",{staticClass:"programming-lang-column"},t._l(t.languages.center,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.selectedLanguage===e.key},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.setLanguage(e.key)}}})])})),i("div",{staticClass:"programming-lang-column"},t._l(t.languages.right,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.selectedLanguage===e.key},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.setLanguage(e.key)}}})])}))]),i("p",[i("a",{staticClass:"toggle",domProps:{innerHTML:t._s(t.filterRatingsText)},on:{click:function(e){t.ratingsExpanded=!t.ratingsExpanded}}})]),i("transition",{attrs:{name:"fade"}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.ratingsExpanded,expression:"ratingsExpanded"}],staticClass:"question-categories"},[i("div",{staticClass:"question-category-column"},t._l(t.ratings.left,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.difficultySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleDifficulty(e.key)}}})])})),i("div",{staticClass:"question-category-column"},t._l(t.ratings.center,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.difficultySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleDifficulty(e.key)}}})])})),i("div",{staticClass:"question-category-column"},t._l(t.ratings.right,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.difficultySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleDifficulty(e.key)}}})])}))])]),i("p",[i("a",{staticClass:"toggle",domProps:{innerHTML:t._s(t.filterCategoriesText)},on:{click:function(e){t.categoriesExpanded=!t.categoriesExpanded}}})]),i("transition",{attrs:{name:"fade"}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.categoriesExpanded,expression:"categoriesExpanded"}],staticClass:"question-categories"},[i("div",{staticClass:"question-category-column"},t._l(t.categories.left,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.categorySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleCategory(e.key)}}})])})),i("div",{staticClass:"question-category-column"},t._l(t.categories.center,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.categorySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleCategory(e.key)}}})])})),i("div",{staticClass:"question-category-column"},t._l(t.categories.right,function(e){return i("div",[i("a",{staticClass:"filter-button custom",class:{selected:t.categorySet(e.key)},domProps:{innerHTML:t._s(e.buttonText)},on:{click:function(i){t.toggleCategory(e.key)}}})])}))])]),i("div",{staticClass:"finished"},[i("a",{staticClass:"find-button",class:{disabled:!t.selectionValid},on:{click:t.findQuestion}},[t._v("Get Question")])]),i("transition",{attrs:{name:"fade"}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.noResults,expression:"noResults"}],staticClass:"warning custom-block"},[i("p",{staticClass:"custom-block-title"}),i("p",[t._v("😭 No questions could be found with those filters ")]),i("p")])])],1)},[function(){var t=this.$createElement,e=this._self._c||t;return e("p",[e("strong",[this._v("Select a programming language")])])}],!1,null,null,null);u.options.__file="QuestionFinder.vue";e.default=u.exports}}]);