text: (this["webpackJsonptrivia-app"]=this["webpackJsonptrivia-app"]||[]).push([[0],[,,,,,,,,,,,,,function(e,t,n){},function(e,t,n){},,function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var c=n(0),s=n(1),o=n.n(s),a=n(6),r=n.n(a),l=(n(13),n(14),n(2)),u=n.n(l),i=n(5),p=n(3),h=(n(16),{getToken:"https://opentdb.com/api_token.php?command=request",resetToken:"https://opentdb.com/api_token.php?command=reset&token=",easy:"https://opentdb.com/api.php?amount=1&difficulty=easy&type=multiple",medium:"https://opentdb.com/api.php?amount=1&difficulty=medium&type=multiple",hard:"https://opentdb.com/api.php?amount=1&difficulty=hard&type=multiple"}),j=n(7),d=n.n(j);n(17);var m=function(e){return Object(c.jsxs)("div",{className:"steps",children:[Object(c.jsx)("span",{className:e.count[e.count.length-5]?"incomplete":"complete",children:e.count[e.count.length-5]?e.count[e.count.length-5]:""}),Object(c.jsx)("span",{className:e.count[e.count.length-4]?"incomplete":"complete",children:e.count[e.count.length-4]?e.count[e.count.length-4]:""}),Object(c.jsx)("span",{className:e.count[e.count.length-3]?"incomplete":"complete",children:e.count[e.count.length-3]?e.count[e.count.length-3]:""}),Object(c.jsx)("span",{className:e.count[e.count.length-2]?"incomplete":"complete",children:e.count[e.count.length-2]?e.count[e.count.length-2]:""}),Object(c.jsx)("span",{className:e.count[e.count.length-1]?"incomplete":"complete",children:e.count[e.count.length-1]?e.count[e.count.length-1]:""}),Object(c.jsx)("div",{className:"line"})]})};var b="",f=[1,2,3,4,5];var g=function(){var e=Object(s.useState)(""),t=Object(p.a)(e,2),n=t[0],o=t[1],a=Object(s.useState)(""),r=Object(p.a)(a,2),l=r[0],j=r[1],g=Object(s.useState)([]),O=Object(p.a)(g,2),v=O[0],x=O[1],y=Object(s.useState)([]),N=Object(p.a)(y,2),k=N[0],C=N[1];function w(){return q.apply(this,arguments)}function q(){return(q=Object(i.a)(u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(h.easy+"&token="+b).then((function(e){return e.json()})).then((function(e){console.log(e);var t=[];t.push("(C)"+_(e.results[0].correct_answer),"(I)"+_(e.results[0].incorrect_answers[0]),"(I)"+_(e.results[0].incorrect_answers[1]),"(I)"+_(e.results[0].incorrect_answers[2])),d()(t),console.log(t),x(t),j(e.results[0].category),o(_(e.results[0].question))}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value}return Object(s.useEffect)((function(){function e(){return(e=Object(i.a)(u.a.mark((function e(){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(h.getToken).then((function(e){return e.json()})).then((function(e){b=e.token,C(f),w()}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]),Object(c.jsxs)("div",{className:"questions",children:[Object(c.jsx)(m,{count:k}),Object(c.jsxs)("h1",{children:[" ",l," "]}),Object(c.jsx)("div",{className:"question",children:n}),Object(c.jsx)("div",{className:"container-answers",children:v.map((function(e){return Object(c.jsx)("div",{className:"answer",onClick:function(t){return n=t.target,void("(C)"==e.substring(0,3)?(f.shift(),f.length>0?(C(f),w()):alert("Hai vinto!")):""!=n.textContent&&alert("sbagliato"));var n},children:e.substring(3,e.length)})}))}),Object(c.jsx)("div",{className:"helps",children:Object(c.jsx)("div",{className:"help",children:Object(c.jsxs)("div",{className:"pop-up",children:[Object(c.jsx)("div",{className:"change",onClick:function(){w(),document.querySelector(".closeHelpChange").style.display="block"},children:Object(c.jsx)("p",{className:"change__question",children:"Change question"})}),Object(c.jsx)("div",{className:"cut",onClick:function(){return function(e){console.log(e);for(var t=document.querySelectorAll(".answer"),n=2;n>0;){var c=Math.floor(Math.random()*e.length);"(C)"!=e[c].substring(0,3)&&(console.log(e[c].substring(0,3)),t[c].textContent="",n--)}document.querySelector(".closeHelpCut").style.display="block"}(v)},children:Object(c.jsx)("p",{className:"cut__question",children:"Remove two response"})}),Object(c.jsx)("div",{className:"closeHelpCut"}),Object(c.jsx)("div",{className:"closeHelpChange"})]})})})]})};var O=function(){return Object(c.jsx)("div",{className:"App",children:Object(c.jsx)(g,{})})},v=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,19)).then((function(t){var n=t.getCLS,c=t.getFID,s=t.getFCP,o=t.getLCP,a=t.getTTFB;n(e),c(e),s(e),o(e),a(e)}))};r.a.render(Object(c.jsx)(o.a.StrictMode,{children:Object(c.jsx)(O,{})}),document.getElementById("root")),v()}],[[18,1,2]]]);
  //# sourceMappingURL=main.7bb17091.chunk.js.map