Files
Probability-and-Statistics-…/_static/420.c6d66adb2d61ad16.js
T
2026-08-01 15:00:14 +00:00

3 lines
102 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see 420.c6d66adb2d61ad16.js.LICENSE.txt */
(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[420],{29119:(e,t,i)=>{"use strict";(0,i(54250).Hh)({"sr-Cyrl":{msg_parson_check_me:"Провери",msg_parson_reset:"Поништи",msg_parson_help:"Помоћ",msg_parson_too_short:"Искористи све блокове у решењу",msg_parson_drag_from_here:"Превуци одавде",msg_parson_drag_to_here:"Превуци овде",msg_parson_correct_first_try:"Одлично! Успео си из првог покушаја!",msg_parson_correct:"Одлично! Решио си у само $1 покушаја. Одабери Поништи ако желиш да решиш из првог покушаја.",msg_parson_wrong_indent:"Овај блок није тачно увучен. Превуци га лево или десно да пронађеш прави ниво.",msg_parson_wrong_indents:"Ови блокви нису тачно увучени. Превуци их лево или десно да им пронађеш прави ниво.",msg_parson_wrong_order:"Означени блокови у твом програму су нетачни или у погрешном редоследу. Промени редослед или избаци блок из решења.",msg_parson_arrow_navigate:"Користи стрелице за кретње а Спејс да означииш блок који помераш.",msg_parson_help_info:"Одабери Помоћ ако желиш да олакшаш задатак",msg_parson_not_solution:"Одстранили смо блок који није део решења.",msg_parson_provided_indent:"Увукли смо блок.",msg_parson_combined_blocks:"Спојили смо два блока.",msg_parson_remove_incorrect:"Уклонићемо нетачне блокове из одговора.",msg_parson_will_combine:"Спојићемо два блока.",msg_parson_atleast_three_attempts:"Мораш пробати бар 3 могућа решења пре него што погледаш помоћ.",msg_parson_three_blocks_left:"Остало је још 3 тачна блока. Пронађи им редослед.",msg_parson_will_provide_indent:"Увућићемо блок."}})},52420:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>C});var s=i(78673),n=i(54250),r=i(34089);i(75794),i(56906),i(29119),i(78811);class o{constructor(e){this.problem=e}inverseLISIndices(e){for(var t=[],i=0;i<e.length;i++){for(var s=[e[i]],n=0;n<i;n++)e[n]<e[i]&&t[n].length+1>s.length&&(s=t[n].concat(e[i]));t.push(s)}var r,o=-1;for(let e in t){var a=t[e];a.length>o&&(o=a.length,r=a)}var l=[],h=0;for(let t=0;t<e.length;t++)h>r.length?l.push(t):e[t]==r[h]?h+=1:l.push(t);return l}grade(){var e=this.problem;e.clearFeedback(),this.correctLines=0,this.percentLines=0,this.incorrectIndents=0;var t,i=e.solution,s=e.answerLines();this.percentLines=Math.min(s.length,i.length)/Math.max(s.length,i.length),s.length<i.length?(t="incorrectTooShort",this.correctLength=!1):s.length==i.length?this.correctLength=!0:(t="incorrectMoveBlocks",this.correctLength=!1);let n=this.checkCorrectOrdering(i,s);return this.checkCorrectIndentation(i,s)&&n&&this.correctLength?t="correct":this.correctLength&&n?t="incorrectIndent":n||"incorrectTooShort"==t||(t="incorrectMoveBlocks"),this.calculatePercent(),this.graderState=t,t}checkCorrectIndentation(e,t){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];let i=Math.min(e.length,t.length);for(let s=0;s<i;s++)t[s].viewIndent()<e[s].indent?this.indentRight.push(t[s]):t[s].viewIndent()>e[s].indent&&this.indentLeft.push(t[s]);return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){let i=!0;this.correctLines=0,this.solutionLength=e.length;let s=Math.min(e.length,t.length);for(let n=0;n<s;n++)t[n].text!==e[n].text?i=!1:this.correctLines+=1;return i}calculatePercent(){let e=.2*this.percentLines,t=this.problem.answerLines().length,i=e+this.correctLines/t*.4+(this.correctLines-this.incorrectIndents)/t*.4;i=Math.max(i,0),this.problem.percent=i}}function a(e,{source:t,target:i}){try{!function(e,t,i){for(var[s,n,r]=function(e,t,i){if((s=t)===(n=i)||"object"==typeof s&&s.toString()===n.toString())return[new Map([[t,null]]),new Map([[i,null]]),t];var s,n,r,o;r=e.predecessorsIter.bind(e),o=e.successorsIter.bind(e);for(var a,l=new Map([[t,null]]),h=new Map([[i,null]]),c=[t],d=[i];c.length>0&&d.length>0;)if(c.length<=d.length){a=c,c=[];for(let e of a)for(let t of o(e))if(l.has(t)||(c.push(t),l.set(t,e)),h.has(t))return[l,h,t]}else{a=d,d=[];for(let e of a)for(let t of r(e))if(h.has(t)||(d.push(t),h.set(t,e)),l.has(t))return[l,h,t]}throw new p("No path between "+t.toString()+" and "+i.toString()+".")}(e,t,i),o=[];null!=r;)o.push(r),r=s.get(r);for(r=n.get(o[0]),o.reverse();null!=r;)o.push(r),r=n.get(r)}(e,t,i)}catch(e){if(e instanceof p)return!1;throw e}return!0}class l{constructor(){this.graph={},this.node=new Map,this.adj=new Map,this.pred=new Map,this.succ=this.adj,this.edge=this.adj}addNode(e){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e))}addEdge(e,t){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e,{})),this.succ.has(t)||(this.succ.set(t,new Map),this.pred.set(t,new Map),this.node.set(t,{}));var i=this.adj.get(e).get(t)||{};this.succ.get(e).set(t,i),this.pred.get(t).set(e,i)}nodes(e=!1){return Array.from(e?this.node.entries():this.node.keys())}edges(e,t=!1){return Array.from(this.edgesIter(e,t))}nodesIter(e=!1){return e?toIterator(this.node):this.node.keys()}get(e){var t=this.adj.get(e);if(void 0===t)throw new KeyError("Graph does not contain node "+e+".");return t}numberOfNodes(){return this.node.size}*nbunchIter(e){if(null==e)yield*this.adj.keys();else if(this.hasNode(e))yield e;else{var t=this.adj;try{for(var i of toIterator(e))t.has(i)&&(yield i)}catch(e){if(e instanceof TypeError)throw new d("nbunch is not a node or a sequence of nodes")}}}*edgesIter(e,t=!1){var i;for(var s of((!0===(i=e)||!1===i||function(e){return!!e&&"object"==typeof e}(i)&&"[object Boolean]"==Object.prototype.toString.call(i))&&(t=e,e=void 0),void 0===e?this.adj:mapIterator(this.nbunchIter(e),(e=>tuple2(e,this.adj.get(e))))))for(var n of s[1]){var r=[s[0],n[0]];t&&(r[2]=n[1]),yield r}}reverse(e=!0){var t;if(e)(t=new this.constructor(null,{name:"Reverse of ("+this.name+")"})).addNodesFrom(this),t.addEdgesFrom(mapIterator(this.edgesIter(null,!0),(e=>tuple3c(e[1],e[0],deepcopy(e[2]),e)))),t.graph=deepcopy(this.graph),t.node=deepcopy(this.node);else{var i=this.pred,s=this.succ;this.succ=i,this.pred=s,this.adj=this.succ,t=this}return t}successorsIter(e){var t=this.succ.get(e);if(void 0!==t)return t.keys();throw new d(sprintf('The node "%j" is not in the digraph.',e))}predecessorsIter(e){var t=this.pred.get(e);if(void 0!==t)return t.keys();throw new d(sprintf('The node "%j" is not in the digraph.',e))}successors(e){return Array.from(this.successorsIter(e))}predecessors(e){return Array.from(this.predecessorsIter(e))}}class h{constructor(e){this.name="JSNetworkXException",this.message=e}}class c extends h{constructor(e){super(e),this.name="JSNetworkXAlgorithmError"}}class d extends h{constructor(e){super(e),this.name="JSNetworkXError"}}class u extends c{constructor(e){super(e),this.name="JSNetworkXUnfeasible"}}class p extends u{constructor(e){super(e),this.name="JSNetworkXNoPath"}}function g(e){var t=new l;for(let i of e){t.addNode(i.tag);for(let e of i.depends)t.addEdge(e,i.tag)}return t}function v(e,t){for(let i of e.edges())if(!t.has(i[0])&&!t.has(i[1]))return!1;return!0}class f extends o{inverseLISIndices(e,t){var i=this.problem.solution,s=t.map((e=>e.lines[0]));let n=g(i),r=new Set,o=new l;for(let e of s){for(let t of r)a(n,{source:e.tag,target:t.tag})&&o.addEdge(e.tag,t.tag);r.add(e)}let h=null,c=function(e){let t={};for(let i=0;i<=e.length;i++)t[i]=[];for(let i=0;i<Math.pow(2,e.length);i++){let s=i.toString(2);for(;s.length<e.length;)s="0"+s;let n=new Set;for(let t=0;t<s.length;t++)"1"==s[t]&&n.add(e[t]);t[n.size].push(n)}return t}(o.nodes());for(let e=0;e<=o.numberOfNodes();e++){for(let t of c[e])if(v(o,t)){h=t;break}if(null!=h)break}return[...h].map((e=>{for(let t=0;t<s.length;t++)if(s[t].tag===e)return t}))}checkCorrectIndentation(){if(!this.problem.usesIndentation())return!0;this.indentLeft=[],this.indentRight=[];for(const e of this.problem.blocks){if(e.isDistractor())continue;const t=e.indent,i=e.solutionIndent();t<i?this.indentRight.push(e.lines[0]):t>i&&this.indentLeft.push(e.lines[0])}return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){if(!function(e){try{return function(e,t){var i=new Set,s=[],n=new Set;null==t&&(t=e.nodesIter());for(let l of t){if(n.has(l))return;for(var r=[l];r.length>0;){var o=r[r.length-1];if(n.has(o))r.pop();else{i.add(o);var a=[];e.get(o).forEach((function(e,t){if(!n.has(t)){if(i.has(t))throw new u("Graph contains a cycle.");a.push(t)}})),a.length>0?r.push.apply(r,a):(n.add(o),s.unshift(o))}}}}(e),!0}catch(e){if(e instanceof u)return!1;throw e}}(g(e)))throw"Dependency between blocks does not form a Directed Acyclic Graph; Problem unsolvable.";let i=new Set,s=!0;this.correctLines=0,this.solutionLength=e.length;let n=Math.min(e.length,t.length);for(let e=0;e<n;e++){let n=t[e];if(n.distractor)s=!1;else for(let e=0;e<n.depends.length;e++)i.has(n.depends[e])||(s=!1);s&&(this.correctLines+=1),i.add(n.tag)}return s}}class m{constructor(e,t,i){this.problem=e,this.index=e.lines.length;var s,n=t.replace(/\s*$/,"");if(!0===this.problem.options.scaffolding)if(this.problem.noindent?this.text=n:this.text=n.replace(/^\s*/,""),"java"==this.problem.options.language)this.text=this.text.replace(/\t/g," "),this.text.toLowerCase().startsWith("public class")?this.indent=0:this.indent=n.length-this.text.length;else{const e=this.problem.lines;this.text.toLowerCase().startsWith("import")&&(this.indent=0),e.some((({text:e})=>e.trimStart().toLowerCase().startsWith("class ")))?this.text.toLowerCase().startsWith("class")?this.indent=0:this.indent=n.length-this.text.length:this.text.toLowerCase().startsWith("def")?this.indent=0:this.indent=n.length-this.text.length}else this.text=n.replace(/^\s*/,""),this.indent=n.length-this.text.length;"natural"==e.options.language||"math"==e.options.language?s=i?document.createElement("div"):document.createElement("p"):(s=document.createElement("code"),e.options.prettifyLanguage&&s.classList.add(...e.options.prettifyLanguage.split(" "))),s.id=e.counterId+"-line-"+this.index,s.innerHTML+=this.text,this.view=s,e.lines.push(this)}initializeWidth(){this.width=(0,r.Gq)(this.view)-this.problem.options.pixelsPerIndent*this.indent,this.view.fontSize=window.getComputedStyle(this.view,null).getPropertyValue("font-size"),this.view.pixelsPerIndent=this.problem.options.pixelsPerIndent,this.view.indent=this.indent;var e=document.createElement("canvas").getContext("2d"),t=window.getComputedStyle(this.view,null).getPropertyValue("font-family").split(", "),i="abcdefghijklmnopqrstuvwxyz0123456789,./!@#$%^&*-+";e.font=this.view.fontSize+" serif";var s=e.measureText(i).width;for(let n=0;n<t.length;n++)if(t[n].includes('"')&&(t[n]=t[n].replaceAll('"',"")),t[n].includes("'")&&(t[n]=t[n].replaceAll("'","")),e.font=this.view.fontSize+" "+t[n],e.measureText(i).width!==s){this.view.fontFamily=t[n];break}}block(){for(let i=0;i<this.problem.blocks.length;i++)for(var e=this.problem.blocks[i],t=0;t<e.lines.length;t++)if(e.lines[t]===this)return e}viewIndent(){if(this.problem.noindent)return this.indent;var e=this.block();return this.indent-e.solutionIndent()+e.indent}}var b=i(88210),w=i.n(b);const y=["indent1","indent2","indent3","indent4","indent5","indent6"];class k{constructor(e,t){this.problem=e,this.lines=t,this.indent=0,this.labels=[];var i=document.createElement("div");i.id=e.counterId+"-block-"+e.blockIndex,e.blockIndex+=1,i.classList.add("block");var s=t[0].indent;for(let e=1;e<t.length;e++)s=Math.min(s,t[e].indent);var n=document.createElement("div");n.classList.add("lines"),i.append(n);for(let i=0;i<t.length;i++){var r,o=t[i];r=e.noindent?o.indent:o.indent-s,o.view.classList.remove(...y),"natural"!=this.problem.options.language&&"math"!=this.problem.options.language&&r>0&&o.view.classList.add("indent"+r),n.appendChild(o.view)}var a=document.createElement("div");a.classList.add("labels"),"left"==this.problem.options.numbered?(n.classList.add("border_left"),i.prepend(a),i.style.justifyContent="flex-start"):"right"==this.problem.options.numbered&&(a.classList.add("border_left"),a.style.float="right",i.style.justifyContent="space-between",i.append(a)),this.view=i,this.isPlaceholder=!1}addLine(e){if(e.view.classList.remove(...y),this.problem.noindent)e.indent>0&&e.view.classList.add("indent"+e.indent);else{var t=this.lines,i=t[0].indent;for(let e=1;e<t.length;e++)i=Math.min(i,t[e].indent);if(i<e.indent)e.view.classList.add("indent"+(e.indent-i));else if(i>e.indent)for(let i=0;i<t.length;i++)t[i].view.classList.remove(...y),"natural"!==this.problem.options.language&&"math"!==this.problem.options.language&&t[i].view.classList.add("indent"+(t[i].indent-e.indent))}this.lines.push(e),this.view.querySelector(".lines").appendChild(e.view)}consumeBlock(e){for(let t=0;t<e.lines.length;t++)this.addLine(e.lines[t]);"0"==e.view.getAttribute("tabindex")&&this.makeTabIndex(),e.view.remove();var t=[];for(let i=0;i<this.problem.blocks.length;i++)this.problem.blocks[i]!==e&&t.push(this.problem.blocks[i]);for(let t=0;t<e.labels.length;t++)this.addLabel(e.labels[t][0],this.lines.length-e.lines.length+e.labels[t][1]);this.problem.blocks=t,this.problem.state=void 0,this.problem.updateView()}addIndent(){for(let t=0;t<this.lines.length;t++){var e=this.lines[t];e.indent>0&&(e.view.classList.remove(...y),e.view.classList.add("indent"+e.indent))}this.indent=0,this.view.style.paddingLeft="",this.view.style.width=this.problem.areaWidth-22+"px"}addLabel(e,t){var i=document.createElement("div");i.classList.add("block-label"),"right"==this.problem.options.numbered&&i.classList.add("right-label"),"left"==this.problem.options.numbered&&i.classList.add("left-label"),i.append(document.createTextNode(e)),this.view.querySelector(".labels").append(i),0!=this.labels.length&&(i.style.marginTop=(t-this.labels[this.labels.length-1][1]-1)*this.lines[t].view.offsetHeight+"px"),this.labels.push([e,t])}initializeInteractivity(){if(this.view.classList.contains("disabled"))return this;this.view.setAttribute("tabindex","-1"),this.hammer=new(w().Manager)(this.view,{recognizers:[[w().Pan,{direction:w().DIRECTION_ALL,threshold:0,pointers:1}]]});var e=this;this.hammer.on("panstart",(function(t){e.panStart(t)})),this.hammer.on("panend",(function(t){e.panEnd(t)})),this.hammer.on("panmove",(function(t){e.panMove(t)}))}enabled(){return null!==this.view.getAttribute("tabindex")}isDistractor(){return this.lines[0].distractor}inSourceArea(){var e=this.problem.sourceArea.childNodes;for(let t=0;t<e.length;t++)if(e[t].id==this.view.id)return!0;return!1}pageXCenter(){var e=this.view.getBoundingClientRect();return window.pageXOffset+e.left+e.width/2}pageYCenter(){var e=this.view.getBoundingClientRect();return window.pageYOffset+e.top+e.height/2}minimumLineIndent(){var e=this.lines[0].indent;for(let t=1;t<this.lines.length;t++)e=Math.min(this.lines[t].indent,e);return e}slideUnderBlock(){var e=this.problem.sourceBlocks();if(0!=e.length){var t=this.pairedBin();if(-1==t)return e[e.length-1];for(let s=e.length-1;s>=0;s--){var i=e[s];if(i.pairedBin()==t)return i}return e[e.length-1]}}pairedBin(){for(var e=this.problem.pairedBins,t=0;t<e.length;t++)if(this.matchesBin(e[t]))return t;return-1}matchesBin(e){for(var t=0;t<this.lines.length;t++){var i=this.lines[t].index;if(-1==e.indexOf(i))return!1}return!0}validSourceIndexes(){var e,t,i=this.problem.sourceBlocks(),s=[],n=this.pairedBin();if(n>=0){for(e=0;e<i.length;e++){var r=i[e];if(r.view.id!==this.view.id){var o=r.pairedBin();(o==n||t==n)&&s.push(e),t=o}}if(t==n&&s.push(i.length),s.length>0)return s}for(e=0;e<i.length;e++){let n=i[e];if(n.view.id!==this.view.id){let i=n.pairedBin();(i!==t||-1==i)&&s.push(e),t=i}}return s.push(i.length),s}verticalOffset(){var e;return e=this.inSourceArea()?this.problem.sourceArea.getBoundingClientRect().top:this.problem.answerArea.getBoundingClientRect().top,this.view.getBoundingClientRect().top+this.view.getBoundingClientRect().bottom-2*e}newFocus(){null==this.problem.textFocus?(this.problem.enterKeyboardMode(),this.problem.textFocus=this,this.problem.textMove=!1,this.view.classList.add("down")):this.problem.textFocus==this?this.problem.textMove?this.view.classList.add("up"):this.view.classList.add("down"):(this.problem.textFocus=this,this.problem.textMove=!1,this.view.classList.add("down")),this.problem.textMoving=!1}releaseFocus(){this.view.classList.remove("down","up"),this.problem.textFocus==this?this.problem.textMoving||(this.problem.textFocus=void 0,this.problem.textMove&&(this.problem.logMove("kmove"),this.problem.textMove=!1,this.problem.updatePlaceholders()),this.problem.exitKeyboardMode()):(this.view.setAttribute("tabindex","-1"),this.view.removeEventListener("focus",this.focusHandler),this.view.removeEventListener("blur",this.blurHandler),this.view.removeEventListener("keydown",this.keydownHandler))}makeTabIndex(){this.view.setAttribute("tabindex","0"),void 0===this.focusHandler&&(this.focusHandler=()=>this.newFocus(),this.blurHandler=()=>this.releaseFocus(),this.keydownHandler=e=>this.keyDown(e)),this.view.addEventListener("focus",this.focusHandler),this.view.addEventListener("blur",this.blurHandler),this.view.addEventListener("keydown",this.keydownHandler)}disable(){void 0!==this.hammer&&this.hammer.set({enable:!1}),"0"==this.view.getAttribute("tabindex")?(this.releaseFocus(),this.view.removeAttribute("tabindex"),this.problem.initializeTabIndex()):this.view.removeAttribute("tabindex")}resetView(){void 0!==this.hammer&&this.hammer.set({enable:!0}),this.view.hasAttribute("tabindex")||this.view.setAttribute("tabindex","-1"),this.view.style.opacity=""}destroy(){void 0!==this.hammer&&(this.hammer.destroy(),delete this.hammer),"0"==this.view.getAttribute("tabindex")&&this.releaseFocus(),this.view.removeAttribute("tabindex")}panStart(e){this.problem.clearFeedback(),null==this.problem.started&&(this.problem.started=!0,this.problem.logMove("start")),void 0!==this.problem.textFocus&&this.problem.textFocus.releaseFocus(),this.problem.moving=this,this.problem.movingX=e.srcEvent.pageX,this.problem.movingY=e.srcEvent.pageY,this.problem.updateView()}panEnd(e){this.problem.isAnswered=!0,delete this.problem.moving,delete this.problem.movingX,delete this.problem.movingY,this.problem.updateView(),this.problem.logMove("move"),this.problem.updatePlaceholders()}panMove(e){this.problem.movingX=e.srcEvent.pageX,this.problem.movingY=e.srcEvent.pageY,this.problem.updateView()}keyDown(e){switch(null==this.problem.started&&(this.problem.started=!0,this.problem.logMove("kstart")),e.keyCode){case 37:this.problem.textMove?this.moveLeft():this.selectLeft();break;case 38:this.problem.textMove?this.moveUp():this.selectUp(),e.preventDefault();break;case 39:this.problem.textMove?this.moveRight():this.selectRight(),e.preventDefault();break;case 40:this.problem.textMove?this.moveDown():this.selectDown(),e.preventDefault();break;case 32:case 13:this.toggleMove(),e.preventDefault()}}moveLeft(){var e,t;if(!this.inSourceArea()){if(0==this.indent){for(var i=this.problem.sourceBlocks(),s=this.verticalOffset(),n=this.validSourceIndexes(),r=0;r<n.length;r++){if((e=n[r])==i.length)return this.problem.textMoving=!0,this.problem.sourceArea.appendChild(this.view),this.view.focus(),this.problem.state=void 0,this.problem.updateView(),this;if((t=i[e]).verticalOffset()>=s)break}this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,t.view),this.view.focus()}else this.indent=this.indent-1;this.problem.state=void 0,this.problem.updateView()}}moveUp(){if(this.inSourceArea()){let n=this.problem.sourceBlocks();var e=this.verticalOffset(),t=this.validSourceIndexes();for(let r=0;r<t.length;r++){var i=t[t.length-1-r];if(i<n.length){var s=n[i];if(s.verticalOffset()<e)return this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,s.view),this.view.focus(),this.problem.state=void 0,this.problem.updateView(),this}}}else{let e=this.problem.answerBlocks();for(let t=0;t<e.length;t++)if(e[t].view.id==this.view.id){if(0==t)return this;this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,e[t-1].view),this.view.focus(),this.problem.state=void 0,this.problem.updateView()}}}moveRight(){if(this.inSourceArea()){this.indent=0;for(var e=this.verticalOffset(),t=this.problem.answerBlocks(),i=0;i<t.length;i++){var s=t[i];if(s.verticalOffset()>=e)return this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,s.view),this.view.focus(),this.problem.state=void 0,this.problem.updateView(),this}this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view),this.view.focus(),this.problem.state=void 0,this.problem.updateView()}else this.indent!==this.problem.indent&&(this.indent=this.indent+1,this.problem.state=void 0,this.problem.updateView())}moveDown(){if(this.inSourceArea()){let s=this.problem.sourceBlocks();var e=this.validSourceIndexes();for(let e=0;e<s.length;e++)if(s[e].view.id==this.view.id)var t=e;for(let n=0;n<e.length;n++){var i=e[n];if(i==s.length)return this.problem.textMoving=!0,this.problem.sourceArea.appendChild(this.view),this.view.focus(),this.problem.state=void 0,this.problem.updateView(),this;if(i-t>1)return this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,s[i].view),this.view.focus(),this.problem.state=void 0,this.problem.updateView(),this}}else{let e=this.problem.answerBlocks();for(var s=0;s<e.length;s++)if(e[s].view.id==this.view.id){if(s==e.length-1)return this;s==e.length-2?(this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view)):(this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,e[s+2].view)),this.view.focus(),this.problem.state=void 0,this.problem.updateView()}}}selectLeft(){if(!this.inSourceArea()){var e=this.verticalOffset(),t=this.problem.enabledSourceBlocks();if(0==t.length)return this;for(var i=t[0],s=i.verticalOffset()-e,n=1;n<t.length;n++){var r=t[n],o=r.verticalOffset()-e;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),i.view.focus()}}selectUp(){for(var e,t=!1,i=(e=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks()).length-1;i>=0;i--){var s=e[i];if(t)return this.problem.textFocus=s,s.makeTabIndex(),s.view.focus(),this;s.view.id==this.view.id&&(t=!0)}}selectRight(){if(this.inSourceArea()){var e=this.verticalOffset(),t=this.problem.enabledAnswerBlocks();if(0==t.length)return this;for(var i=t[0],s=i.verticalOffset()-e,n=1;n<t.length;n++){var r=t[n],o=r.verticalOffset()-e;Math.abs(o)<Math.abs(s)&&(i=r,s=o)}this.problem.textFocus=i,i.makeTabIndex(),i.view.focus()}}selectDown(){var e,t=!1;e=this.inSourceArea()?this.problem.enabledSourceBlocks():this.problem.enabledAnswerBlocks();for(var i=0;i<e.length;i++){var s=e[i];if(t)return this.problem.textFocus=s,s.makeTabIndex(),s.view.focus(),this;s.view.id==this.view.id&&(t=!0)}}toggleMove(){this.problem.textMove?(this.view.classList.remove("up"),this.view.classList.add("down"),this.problem.textMove=!1,this.problem.logMove("kmove"),this.isPlaceholder||this.problem.updatePlaceholders()):(this.view.classList.remove("down"),this.view.classList.add("up"),this.problem.textMove=!0)}hash(){for(var e="",t=0;t<this.lines.length;t++)e+=this.lines[t].index+"_";return e+this.indent}solutionIndent(){for(var e=this.lines[0].indent,t=1;t<this.lines.length;t++)e=Math.min(e,this.lines[t].indent);return e}}class x extends k{constructor(e,t,i,s){super(e,t),this.placeholderLines=t,this.afterSettledBlockCount=s,this.view.classList.add("placeholder-block","disabled"),this.placeholderSize=i;var n=document.createElement("div");n.classList.add("placeholder-text"),n.innerText=i>1?`${i} blocks are missing here`:`${i} block is missing here`,this.view.append(n),this.isPlaceholder=!0}}class _ extends m{constructor(e){super(e,"placeholder",!1),this.isPlaceholderLine=!0}}class S extends k{constructor(e,t){super(e,t),this.isSettled=!0,this.view.classList.add("settled-block","disabled"),this.tooltipSpan=document.createElement("span"),this.tooltipSpan.classList.add("settled-tooltip"),this.view.append(this.tooltipSpan),this.tooltipSpan.textContent="OK"}setBlocksBefore(e){this.blocksBefore=e;var t=e>1?"s":"";if(this.blocksAfter){var i=this.blocksAfter>1?"s":"";this.tooltipSpan.innerHTML=`${e} block${t} ⬆️), ${this.blocksAfter} block${i} ⬇️`}else this.tooltipSpan.innerHTML=`${e} block${t} ⬆️`}setBlocksAfter(e){this.blocksAfter=e;var t=e>1?"s":"";if(this.blocksBefore){var i=this.blocksBefore>1?"s":"";this.tooltipSpan.innerHTML=`${this.blocksBefore} block${i} ⬆️, ${e} block${t} ⬇️`}else this.tooltipSpan.innerHTML=`${e} block${t} ️⬇️`}}class A extends s.A{constructor(e){super(e);var t=e.orig;this.containerDiv=t,this.origElem=t.querySelector("pre.parsonsblocks"),this.question=t.querySelector(".parsons_question"),this.useRunestoneServices=e.useRunestoneServices,this.divid=e.orig.id;var i=super.localStorageKey();this.storageId=i,this.children=this.origElem.childNodes,this.contentArray=[],A.counter++,this.counterId="parsons-"+A.counter,this.initializeOptions(),this.grader="dag"===this.options.grader?new f(this):new o(this),this.grader.showfeedback=this.showfeedback;var s=this.origElem.innerHTML;this.blockIndex=0,this.checkCount=0,this.numDistinct=0,this.hasSolved=!1,this.initializeLines(s.trim()),this.initializeView(),this.caption="Parsons",this.addCaption("runestone"),this.checkServer("parsons",!0),this.runnableDiv=null}initializeOptions(){var e={pixelsPerIndent:30},t=(0,r.Qt)(this.origElem,"maxdist"),i=(0,r.Qt)(this.origElem,"order"),s=(0,r.Qt)(this.origElem,"noindent"),n=(0,r.Qt)(this.origElem,"adaptive"),o=(0,r.Qt)(this.origElem,"numbered"),a=(0,r.Qt)(this.origElem,"grader"),l=(0,r.Qt)(this.origElem,"scaffolding");if(e.numbered=o,e.grader=a,e.scaffolding=l,void 0!==t&&(e.maxdist=t),void 0!==i){i=i.match(/\d+/g);for(var h=0;h<i.length;h++)i[h]=parseInt(i[h]);e.order=i}null==s&&(s=!1),e.noindent=s,this.noindent=s,null==n?n=!1:n&&this.initializeAdaptive(),e.adaptive=n;var c=eBookConfig.locale;null==c&&(c="en"),e.locale=c;var d=(0,r.Qt)(this.origElem,"language");null==d&&null==(d=eBookConfig.language)&&(d="python"),e.language=d;var u={python:"prettyprint lang-py",java:"prettyprint lang-java",javascript:"prettyprint lang-js",html:"prettyprint lang-html",c:"prettyprint lang-c","c++":"prettyprint lang-cpp",cpp:"prettyprint lang-cpp",ruby:"prettyprint lang-rb"}[d];null==u&&(u=""),e.prettifyLanguage=u,e.runnable=(0,r.Qt)(this.origElem,"runnable");var p=this.origElem.getAttribute("data-explanations");if(p)try{this.blockExplanations=JSON.parse(p)}catch(e){this.blockExplanations={}}else this.blockExplanations={};this.options=e}initializeView(){this.outerDiv=document.createElement("div"),this.outerDiv.classList.add("parsons"),this.outerDiv.id=this.counterId;let e=this.containerDiv.querySelector(".parsons-text");e&&!e.classList.contains("exercise-statement")&&e.classList.add("exercise-statement"),this.keyboardTip=document.createElement("div"),this.keyboardTip.setAttribute("role","tooltip"),this.keyboardTip.id=this.counterId+"-tip",this.keyboardTip.innerHTML=(0,n.t)("msg_parson_arrow_navigate"),this.outerDiv.appendChild(this.keyboardTip),this.keyboardTip.style.display="none",this.sortContainerDiv=document.createElement("div"),this.sortContainerDiv.classList.add("sortable-code-container"),this.sortContainerDiv.setAttribute("aria-describedby",this.counterId+"-tip"),this.outerDiv.appendChild(this.sortContainerDiv),this.sourceRegionDiv=document.createElement("div"),this.sourceRegionDiv.id=this.counterId+"-sourceRegion",this.sourceRegionDiv.classList.add("sortable-code"),this.sourceLabel=document.createElement("div"),this.sourceLabel.setAttribute("role","tooltip"),this.sourceLabel.id=this.counterId+"-sourceTip",this.sourceLabel.innerHTML=(0,n.t)("msg_parson_drag_from_here"),this.sourceRegionDiv.appendChild(this.sourceLabel),this.sortContainerDiv.appendChild(this.sourceRegionDiv),this.sourceArea=document.createElement("div"),this.sourceArea.id=this.counterId+"-source",this.sourceArea.classList.add("source"),this.sourceArea.setAttribute("aria-describedby",this.counterId+"-sourceTip"),this.sourceRegionDiv.appendChild(this.sourceArea),this.answerRegionDiv=document.createElement("div"),this.answerRegionDiv.id=this.counterId+"-answerRegion",this.answerRegionDiv.classList.add("sortable-code"),this.answerLabel=document.createElement("div"),this.answerLabel.setAttribute("role","tooltip"),this.answerLabel.id=this.counterId+"-answerTip",this.answerLabel.innerHTML=(0,n.t)("msg_parson_drag_to_here"),this.answerRegionDiv.appendChild(this.answerLabel),this.sortContainerDiv.appendChild(this.answerRegionDiv),this.answerArea=document.createElement("div"),this.answerArea.id=this.counterId+"-answer",this.answerArea.setAttribute("aria-describedby",this.counterId+"-answerTip"),this.answerRegionDiv.appendChild(this.answerArea),this.parsonsControlDiv=document.createElement("div"),this.parsonsControlDiv.classList.add("parsons-controls"),this.outerDiv.appendChild(this.parsonsControlDiv);var t=this;this.checkButton=document.createElement("button"),this.checkButton.className="btn btn-success",this.checkButton.textContent=(0,n.t)("msg_parson_check_me"),this.checkButton.id=this.counterId+"-check",this.parsonsControlDiv.appendChild(this.checkButton),this.checkButton.type="button",this.checkButton.addEventListener("click",(function(e){e.preventDefault(),t.checkCurrentAnswer(),t.logCurrentAnswer(),t.renderFeedback()})),this.resetButton=document.createElement("button"),this.resetButton.className="btn btn-default",this.resetButton.textContent=(0,n.t)("msg_parson_reset"),this.resetButton.id=this.counterId+"-reset",this.resetButton.type="button",this.parsonsControlDiv.appendChild(this.resetButton),this.resetButton.addEventListener("click",(function(e){e.preventDefault(),t.clearFeedback(),t.checkButton.disabled=!1,t.resetView(),t.checkCount=0,t.logMove("reset"),t.setLocalStorage()})),this.options.adaptive&&(this.helpButton=document.createElement("button"),this.helpButton.className="btn btn-primary",this.helpButton.textContent=(0,n.t)("msg_parson_help"),this.helpButton.id=this.counterId+"-help",this.helpButton.disabled=!1,this.parsonsControlDiv.appendChild(this.helpButton),this.helpButton.addEventListener("click",(function(e){e.preventDefault(),t.helpMe()}))),this.messageDiv=document.createElement("div"),this.messageDiv.id=this.counterId+"-message",this.messageDiv.setAttribute("aria-live","polite"),this.messageDiv.setAttribute("role","status"),this.parsonsControlDiv.appendChild(this.messageDiv),this.messageDiv.style.visibility="hidden",this.origElem.replaceWith(this.outerDiv);const i=this.outerDiv.closest(".sqcontainer");i&&(i.style.maxWidth="none"),this.outerDiv&&(this.question.innerHTML.match(/^\s+$/)?this.question.remove():this.outerDiv.prepend(this.question))}initializeLines(e){this.lines=[];var t=e.split("---");1===t.length&&(t=e.split("\n"));var i=[],s=[];if(!0===this.options.scaffolding){for(var n=!1,r=0;r<t.length;r++){var o=t[r],a={},l="",h=[];if(o.includes("#paired:"))b=o.indexOf("#paired:"),l=o.substring(b+8,o.length).trim(),o=o.substring(0,b+7);else if(o.includes("#distractor:"))b=o.indexOf("#distractor:"),l=o.substring(b+12,o.length).trim(),o=o.substring(0,b+11);else if(o.includes("#settled")){var c=o.indexOf("#settled");l=o.substring(c+8,o.length).trim(),o=o.substring(0,c+8)}else if(o.includes("#tag:")){w=(o=o.replace(/#tag:.*;.*;/,(e=>e.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),k=o.indexOf(";depends:");let e=o.substring(k+9,o.indexOf(";",k+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/#(paired|distractor|settled|tag:.*;.*;)/,(function(e,t){return a[t]=!0,""})),a.settled&&r>0&&u.length>0&&!u[u.length-1].isSettled){var d=new _(this);u.push(d),d.distractor=!0,d.paired=!1,d.distractHelptext="",d.groupWithNext=!1,d.indent=0}a.settled&&(n=!0);var u=[];if(a.displaymath)p=[o];else var p=o.split("\n");for(var g=0;g<p.length;g++){var v=p[g];if(!/^\s*$/.test(v)){var f=new m(this,v,a.displaymath);u.push(f),a.paired?(f.distractor=!0,f.paired=!0,f.distractHelptext=l):a.distractor?(f.distractor=!0,f.paired=!1,f.distractHelptext=l):a.settled?(f.distractor=!1,f.paired=!1,f.isSettled=!0,i.push(f)):(f.distractor=!1,f.paired=!1,"dag"===this.options.grader&&(f.tag=y,f.depends=h),i.push(f)),-1==s.indexOf(f.indent)&&s.push(f.indent)}}if(u.length>0){for(g=0;g<u.length-1;g++)u[g].groupWithNext=!0;u[u.length-1].groupWithNext=!1}}if(n&&!u[u.length-1].isSettled&&(d=new _(this),u.push(d),d.distractor=!0,d.paired=!1,d.distractHelptext="",d.groupWithNext=!1),"java"===this.options.language){let e=null,t=null;for(let i=0;i<this.lines.length;i++){const s=this.lines[i].text;if(null===e&&(s.includes("public class")||s.startsWith("import"))&&(e=this.lines[i].indent),null===t&&s.includes("public static")&&(t=this.lines[i].indent),null!==e&&null!==t)break}if(0===e&&8===t){s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e],i=t.indent,n=s.indexOf(i);n>0&&(n-=1),t.indent=n}}else{s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e];t.indent=s.indexOf(t.indent)}}}else{s=s.sort((function(e,t){return e-t}));for(let e=0;e<this.lines.length;e++){let t=this.lines[e];t.indent=s.indexOf(t.indent)}}this.solution=i}else{for(r=0;r<t.length;r++){var b,w,y,k;if(o=t[r],a={},l="",h=[],o.includes("#paired:"))b=o.indexOf("#paired:"),l=o.substring(b+8,o.length).trim(),o=o.substring(0,b+7);else if(o.includes("#distractor:"))b=o.indexOf("#distractor:"),l=o.substring(b+12,o.length).trim(),o=o.substring(0,b+11);else if(o.includes("#tag:")){w=(o=o.replace(/#tag:.*;.*;/,(e=>e.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),k=o.indexOf(";depends:");let e=o.substring(k+9,o.indexOf(";",k+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/\s*#(paired|distractor|tag:.*;.*;)\s*/g,(function(e,t){return a[t]=!0,""})),u=[],a.displaymath)p=[o];else p=o.split("\n");for(g=0;g<p.length;g++)v=p[g],(!/^\s*$/.test(v)||0!=g&&g!=p.length-1)&&(f=new m(this,v,a.displaymath),u.push(f),a.paired?(f.distractor=!0,f.paired=!0,f.distractHelptext=l):a.distractor?(f.distractor=!0,f.paired=!1,f.distractHelptext=l):(f.distractor=!1,f.paired=!1,"dag"===this.options.grader&&(f.tag=y,f.depends=h),i.push(f)),-1==s.indexOf(f.indent)&&s.push(f.indent));if(u.length>0){for(g=0;g<u.length-1;g++)u[g].groupWithNext=!0;u[u.length-1].groupWithNext=!1}}for(s=s.sort((function(e,t){return e-t})),r=0;r<this.lines.length;r++)(f=this.lines[r]).indent=s.indexOf(f.indent);this.solution=i}}async initializeAreas(e,t,i){const s=this.outerDiv.parentNode;var n,r,o=[];for(n=0;n<e.length;n++)r=e[n],o.push(r),this.sourceArea.appendChild(r.view);for(n=0;n<t.length;n++)r=t[n],o.push(r),this.answerArea.appendChild(r.view);this.blocks=o;var a=i.disabled;if(void 0!==a)for(n=0;n<o.length;n++)r=o[n],a.includes(r.lines[0].index)&&r.view.classList.add("disabled");var l=0;this.noindent||(l="natural"==this.options.language?this.solutionIndent():Math.max(0,this.solutionIndent())),this.indent=l;var h,c=null==this.outerDiv.offsetParent;c&&(h=document.createElement("div"),s&&s.replaceChild(h,this.outerDiv),this.outerDiv.classList.add("runestone-sphinx"),document.body.appendChild(this.outerDiv)),""!==this.options.prettifyLanguage&&"undefined"==typeof Prism&&prettyPrint();const d=this.options.language;if(d&&"undefined"!=typeof Prism){const e=this.containerDiv.querySelectorAll("code");for(const t of e)t.classList.add(`language-${d}`);Prism.highlightAllUnder(this.containerDiv)}for(let e=0;e<this.lines.length;e++)this.lines[e].initializeWidth();let u=(this.outerDiv.offsetWidth-this.options.pixelsPerIndent*this.indent-80)/2;var p,g;null!=this.options.numbered&&(u-=25),this.sourceArea.style.width=u+"px",g=20;var v=0;null!=this.options.numbered&&(v=1),p=0;let f=this;const m="natural"==this.options.language||"math"==this.options.language;for(n=0;n<o.length;n++){const e=o[n].view;m&&("undefined"!=typeof runestoneMathReady?await runestoneMathReady.then((async()=>await f.queueMathJax(e))):"undefined"!=typeof MathJax&&void 0!==MathJax.startup&&await f.queueMathJax(e)),p=Math.max(p,e.getBoundingClientRect().width)}for(n=0;n<o.length;n++){const e=o[n].view;e.style.width=p-22+"px";var b=3.8;const t=getComputedStyle(e),i=e.getBoundingClientRect().height+parseFloat(t.marginTop)+parseFloat(t.marginBottom);38!=i&&(b=3.1*(i-38)/21),g+=i+v*b}this.isTimed&&g<38*o.length&&(g=50*o.length),this.areaWidth=p,null!=this.options.numbered&&(this.areaWidth+=25),l>0&&l<=4?this.answerArea.classList.add("answer"+l):this.answerArea.classList.add("answer");var w=[],y=[];for(n=0;n<this.lines.length;n++){var k=this.lines[n];null==k.block()?y.length>0&&(w.push(y),y=[]):(y.push(k),k.groupWithNext||(w.push(y),y=[]))}var x,_=[],S=[],A=[];if(this.pairDistractors||!this.options.adaptive){for(n=w.length-1;n>-1;n--)if((y=w[n])[0].paired)for(x=y.length-1;x>-1;x--)S.unshift(y[x].index);else if(S.length>0){for(x=y.length-1;x>-1;x--)S.unshift(y[x].index);_.unshift(S),S=[]}for(n=0;n<_.length;n++){var C=document.createElement("div");C.classList.add("paired"),C.innerHTML="<span id='st' style='vertical-align: middle; font-weight: bold'>or{</span>",A.push(C),this.sourceArea.appendChild(C)}}else _=[];this.areaHeight=g,this.sourceArea.style.width=`${this.areaWidth+2}px`,this.sourceArea.style.height=`${this.areaHeight}px`,this.answerArea.style.width=`${this.options.pixelsPerIndent*l+this.areaWidth+2}px`,this.answerArea.style.height=`${this.areaHeight}px`,this.pairedBins=_,this.pairedDivs=A,null!=this.options.numbered&&this.addBlockLabels(e.concat(t)),this.state=void 0,this.updateView(),c&&h.parentNode.replaceChild(this.outerDiv,h)}initializeInteractivity(){for(var e=0;e<this.blocks.length;e++)this.blocks[e].initializeInteractivity();this.initializeTabIndex();let t=this;"natural"!=this.options.language&&"math"!=this.options.language||"undefined"!=typeof MathJax&&void 0!==MathJax.startup&&t.aQueue.enqueue(t.outerDiv).then((()=>{for(var e=0,i=20,s=null!=t.options.numbered?1:0,n=t.sourceBlocks(),r=t.answerBlocks(),o=n.concat(r),a=0;a<o.length;a++){var l=o[a].view;l.style.width="";var h=getComputedStyle(l),c=l.getBoundingClientRect().width+parseFloat(h.marginLeft||0)+parseFloat(h.marginRight||0);e=Math.max(e,c)}var d=e-22,u=e+t.indent*t.options.pixelsPerIndent-22;for(a=0;a<o.length;a++){var p=o[a].view;p.style.width=d+"px";var g=getComputedStyle(p),v=p.getBoundingClientRect().height+parseFloat(g.marginTop||0)+parseFloat(g.marginBottom||0),f=3.8;38!=v&&(f=3.1*(v-38)/21),i+=v+s*f}t.areaWidth=e,t.areaHeight=i,t.sourceArea.style.width=e+2+"px",t.sourceArea.style.height=i+"px",t.answerArea.style.width=t.options.pixelsPerIndent*t.indent+e+2+"px",t.answerArea.style.height=i+"px";var m=0;for(a=0;a<n.length;a++){var b=n[a].view;b.style.left="0px",b.style.top=m+"px",b.style.width=d+"px",b.style.zIndex=2;var w=getComputedStyle(b);m+=b.getBoundingClientRect().height+parseFloat(w.marginTop||0)+parseFloat(w.marginBottom||0)}for(a=0;a<t.pairedBins.length;a++){for(var y=t.pairedBins[a],k=[],x=0;x<n.length;x++)n[x].matchesBin(y)&&k.push(n[x]);var _=t.pairedDivs[a];if(0==k.length)_.style.display="none";else{_.style.display="";var S=-5,A=k[k.length-1].view,C=k[0].view;S+=parseFloat(getComputedStyle(A).top)||0,S-=parseFloat(getComputedStyle(C).top)||0;var I=getComputedStyle(A);S+=A.getBoundingClientRect().height+parseFloat(I.marginTop||0)+parseFloat(I.marginBottom||0),_.style.left="-6px",_.style.top=getComputedStyle(C).top,_.style.width=d+34+"px",_.style.height=S+"px",_.style.zIndex=1,_.style.textIndent="-30px",_.style.paddingTop=(S-70)/2+"px",_.style.overflow="visible",_.style.fontSize="43px",_.style.verticalAlign="middle",_.style.color="#7e7ee7",_.innerHTML="<span id='st' style='vertical-align: middle; font-weight: bold; font-size: 15px'>or</span>{"}}for(m=0,a=0;a<r.length;a++){var T=r[a],L=T.indent*t.options.pixelsPerIndent,B=T.view;B.style.left=L+"px",B.style.top=m+"px",B.style.width=u-L+"px",B.style.zIndex=2;var D=getComputedStyle(B);m+=B.getBoundingClientRect().height+parseFloat(D.marginTop||0)+parseFloat(D.marginBottom||0)}}))}initializeTabIndex(){for(var e=0;e<this.blocks.length;e++){var t=this.blocks[e];if(t.enabled())return t.makeTabIndex(),this}}newerData(e,t){var i=e.timestamp,s=t.timestamp;return null==i?t:null==s||(i=this.dateFromTimestamp(i))>(s=this.dateFromTimestamp(s))?e:t}async loadData(e){try{if(!0===this.options.scaffolding){null==(i=e.source)&&(i=e.trash);var t=e.answer;void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),await this.initializeAreas(this.blocksFromSource(),this.settledBlocksFromSource(),n)}else{var i,s,n;null==(i=e.source)&&(i=e.trash),t=e.answer,void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),null==i||null==t||1==t.length?await this.initializeAreas(this.blocksFromSource(),[],n):(this.initializeAreas(this.blocksFromHash(i),this.blocksFromHash(t),n),this.grade=this.grader.grade(),"correct"==this.grade?this.correct=!0:0==this.answerLines().length?this.correct=null:this.correct=!1)}}catch(t){await this.initializeAreas(this.blocksFromSource(),[],n),console.log(`Error restoring answer for student ${e.sid} in ${e.div_id}. Defaulting to original state.`)}!0!==this.needsReinitialization&&(this.initializeInteractivity(),this.isTimed&&!this.assessmentTaken&&this.resetView())}localData(){var e=localStorage.getItem(this.storageId);return null!==e&&"{"==e.charAt(0)?JSON.parse(e):{}}restoreAnswers(e){this.loadData(e)}checkLocalStorage(){if(this.graderactive)return;const e=this.localData();e.timestamp&&e.timestamp<eBookConfig.termStartDate&&(localStorage.removeItem(this.storageId),e={}),this.loadData(e)}setLocalStorage(e){var t;if(null==e){t={source:this.sourceHash(),answer:this.answerHash(),timestamp:new Date};var i=this.adaptiveHash();i.length>0&&(t.adaptive=i)}else t=e;localStorage.setItem(this.storageId,JSON.stringify(t))}async updatePlaceholders(){setTimeout((()=>{var e,t,i,s=this.answerBlocks();for(e=0;e<s.length;++e)if(s[e].isPlaceholder&&(i=s[e],t=!1,e>0&&!s[e-1].isSettled&&!s[e-1].isPlaceholder&&(t=!0),e<s.length-1&&!s[e+1].isSettled&&!s[e+1].isPlaceholder&&(t=!0),t&&!i.view.classList.contains("hide"))){i.view.classList.add("hide");for(var n=0;n<s.length-1-e;n++)i.moveDown()}}),5),setTimeout((()=>{for(var e=this.answerBlocks(),t=0;t<e.length&&!e[t].view.classList.contains("hide");)t++;var i=!0;this.firstBlockSettled&&(i=!1);var s,n,r=0;for(s=0;s<t&&(!e[s].isSettled||!i);++s)e[s].isSettled?(i=!0,r++):i=!1;if(s<t||e[t-1]&&e[t-1].isSettled&&!this.lastBlockSettled){var o;for(o=e.length-1;o>=t;o--)if(e[o].afterSettledBlockCount==r){n=e[o];break}if(e[o].afterSettledBlockCount!=r)return void console.log("error moving up; no placeholder found");if(n.view.classList.contains("hide")){n.view.classList.remove("hide");for(var a=0;a<o-s;a++)n.moveUp()}}}),10)}logMove(e){var t={event:"parsonsMove",div_id:this.divid,storageid:super.localStorageKey()},i=e+"|"+this.sourceHash()+"|"+this.answerHash(),s=this.adaptiveHash();""!==s&&(i=i+"|"+s),t.act=i,this.logBookEvent(t)}async logCurrentAnswer(e){var t={event:"parsons",div_id:this.divid},i=this.answerHash();t.answer=i;var s=this.sourceHash();t.source=s;var n=s+"|"+i,r=this.adaptiveHash();""!==r&&(t.adaptive=r,n=n+"|"+r),"correct"==this.grade?(n="correct|"+n,t.correct="T"):(n="incorrect|"+n,t.correct="F"),t.act=n,void 0!==e&&(t.sid=e),await this.logBookEvent(t)}adaptiveHash(){if(!this.options.adaptive)return"";for(var e=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t];i.enabled()||e.push("d"+i.lines[0].index)}return this.noindent!==this.options.noindent&&e.push("i"),e.push("c"+this.checkCount),this.hasSolved&&e.push("s"),e.join("-")}optionsFromHash(e){var t;t="-"===e||""===e||null===e?[]:e.split("-");for(var i={},s=[],n=0;n<t.length;n++){var r=t[n];"i"==r[0]?i.noindent=!0:"d"==r[0]?s.push(parseInt(r.slice(1))):"s"==r[0]?i.hasSolved=!0:"c"==r[0]&&(i.checkCount=parseInt(r.slice(1)))}return s.length>0&&(i.disabled=s),i}answerHash(){for(var e=[],t=this.answerBlocks(),i=0;i<t.length;i++)e.push(t[i].hash());return 0===e.length?"-":e.join("-")}sourceHash(){for(var e=[],t=this.sourceBlocks(),i=0;i<t.length;i++)e.push(t[i].hash());return 0===e.length?"-":e.join("-")}adaptBlocks(e){for(var t,i=[],s=[],n=0;n<e.length;n++)(t=e[n]).isDistractor()?s.push(t):i.push(t);this.recentAttempts=localStorage.getItem(this.adaptiveId+"recentAttempts"),null!=this.recentAttempts&&"NaN"!=this.recentAttempts||(this.recentAttempts=3);var r=this.recentAttempts,o=i.length,a=0,l=s.length,h=0;this.pairDistractors=!0,r<2?(this.pairDistractors=!1,this.limitDistractors=!1):r<4||r<6?this.pairDistractors=!0:r<8?(h=.5*l,this.pairDistractors=!0):(h=l,this.pairDistractors=!0),a=Math.min(a,o-3),s=(s=this.shuffled(s)).slice(0,h);var c=[];for(n=0;n<e.length;n++)(t=e[n]).isDistractor()?-1==s.indexOf(t)&&c.push(t):c.push(t);var d=[];for(n=0;n<this.lines.length;n++)for(var u=0;u<c.length;u++)c[u].lines[0].index==n&&d.push(c[u]);for(let e=0;e<a;e++){var p=-10,g=-10;for(u=0;u<d.length-1;u++){t=d[u];var v=d[u+1],f=10-t.lines.length-v.lines.length,m=t.minimumLineIndent(),b=v.minimumLineIndent();m==b?f+=2:m>b&&(f-=1),t.lines[t.lines.length-1].indent==v.lines[0].indent&&(f+=1),f>=p&&(p=f,g=u)}for(t=d[g],v=d[g+1],u=0;u<v.lines.length;u++)t.addLine(v.lines[u]);var w=[];for(u=0;u<d.length;u++)u!==g+1&&w.push(d[u]);d=w}var y=[];for(n=0;n<c.length;n++)for(u=0;u<d.length;u++)c[n].lines[0].index==d[u].lines[0].index&&y.push(d[u]);return y}blocksFromSource(){var e,t,i,s,n=[],r=[],o=[];for(s=0;s<this.lines.length;s++)(i=this.lines[s]).isPlaceholderLine||i.isSettled||(o.push(i),i.groupWithNext||(n.push(new k(this,o)),o=[]));e=n;var a=[];if(void 0!==this.options.maxdist){var l=this.options.maxdist,h=[];for(s=0;s<n.length;s++)(t=n[s]).lines[0].distractor&&h.push(t);if(l<h.length){for(h=(h=this.shuffled(h)).slice(0,l),s=0;s<n.length;s++)(t=n[s]).lines[0].distractor?h.indexOf(t)>-1?r.push(t):a.push(s):r.push(t);n=r,r=[]}}if(this.recentAttempts<2?this.pairDistractors=!1:this.pairDistractors=!0,void 0===this.options.order){var c=[],d=[];for(s=0;s<n.length;s++)(t=n[s]).lines[0].paired&&this.pairDistractors?d.push(t):((d=[]).push(t),c.push(d));for(c=this.shuffled(c),s=0;s<c.length;s++)if((d=c[s]).length>1)for(d=this.shuffled(d),p=0;p<d.length;p++)r.push(d[p]);else r.push(d[0])}else for(s=0;s<this.options.order.length;s++)void 0!==(t=e[this.options.order[s]])&&a.indexOf(this.options.order[s])<0&&r.push(t);if(this.pairDistractors=!0,this.options.adaptive&&(this.limitDistractors=!0,r=this.adaptBlocks(r),!this.limitDistractors))for(s=0;s<a.length;s++){var u=null==this.options.order?Math.random(0,r.length):this.options.order.indexOf(a[s]);r.splice(u,0,e[a[s]])}if(this.pairDistractors&&null!=this.options.order)for(s=1;s<e.length;s++)if(e[s].lines[0].paired&&r.indexOf(e[s])>=0){for(var p=s;r.indexOf(e[p-1])<0;)p--;var g=r.indexOf(e[p-1]),v=r.indexOf(e[s]);r.splice(v,1),r.splice(g,0,e[s])}return r}blockFromHash(e){for(var t=e.split("_"),i=[],s=0;s<t.length-1;s++)i.push(this.lines[t[s]]);var n=new k(this,i);return this.noindent?n.indent=0:n.indent=Number(t[t.length-1]),n}blocksFromHash(e){var t;t="-"===e||""===e||null===e?[]:e.split("-");for(var i=[],s=0;s<t.length;s++)i.push(this.blockFromHash(t[s]));return this.options.adaptive?this.adaptBlocks(i):i}settledBlocksFromSource(){var e,t,i=[],s=[],n=0,r=0,o=void 0,a=0;for(t=0;t<this.lines.length;t++)if(e=this.lines[t],s.push(e),!e.groupWithNext)if(e.isPlaceholderLine)i.push(new x(this,s,n,r)),o&&o.setBlocksAfter(n),a=n,n=0,s=[];else if(e.isSettled){0==i.length&&(this.firstBlockSettled=!0);var l=new S(this,s);this.noindent||(l.indent=s[0].indent),console.log("settled block set",l),i.push(l),a>0&&l.setBlocksBefore(a),o=l,r++,n=0,s=[]}else s[0].distractor||n++,s=[];return i.length>0&&i[i.length-1].isSettled&&(this.lastBlockSettled=!0),console.log("settledblocksfromsource",i),i}getBlockById(e){for(var t=0;t<this.blocks.length;t++){var i=this.blocks[t];if(i.view.id==e)return i}}solutionBlocks(){for(var e=[],t=[],i=0;i<this.lines.length;i++)this.lines[i].distractor||t.push(this.lines[i]);var s=t[0].block();e.push(s);for(let i=1;i<t.length;i++){var n=t[i].block();s!==n&&(s=n,e.push(s))}return e}sourceBlocks(){for(var e=[],t=this.sourceArea.children,i=0;i<t.length;i++){var s=t[i];s.classList.contains("block")&&e.push(this.getBlockById(s.id))}return e}enabledSourceBlocks(){for(var e=this.sourceBlocks(),t=[],i=0;i<e.length;i++){var s=e[i];s.enabled()&&t.push(s)}return t}answerBlocks(){for(var e=[],t=this.answerArea.childNodes,i=0;i<t.length;i++){var s=this.getBlockById(t[i].id);void 0!==s&&e.push(s)}return e}enabledAnswerBlocks(){for(var e=this.answerBlocks(),t=[],i=0;i<e.length;i++){var s=e[i];s.enabled()&&t.push(s)}return t}answerLines(){for(var e=[],t=this.answerBlocks(),i=0;i<t.length;i++){var s=t[i];if(!s.isPlaceholder)for(var n=0;n<s.lines.length;n++)e.push(s.lines[n])}return e}getBlockFor(e){for(var t=e;!t.classList.contains("block");)t=t.parentElement;return t}solutionIndent(){for(var e=0,t=0;t<this.blocks.length;t++){var i=this.blocks[t];e=Math.max(e,i.solutionIndent())}return e}checkCurrentAnswer(){if(!this.hasSolved){if(this.checkCount++,this.clearFeedback(),null==this.adaptiveId&&(this.adaptiveId=this.storageId),this.grader.showfeedback=!1,this.grade=this.grader.grade(),"correct"==this.grade){if(this.hasSolved=!0,this.correct=!0,this.checkButton.disabled=!0,this.hasSolved&&this.options.scaffolding){const e=document.querySelector(`#copy-answer-button-${this.divid}`);e&&e.classList.remove("copy-button-hide")}localStorage.setItem(this.adaptiveId+"Solved",!0),this.recentAttempts=this.checkCount,localStorage.setItem(this.adaptiveId+"recentAttempts",this.recentAttempts)}if(localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),this.setLocalStorage(),!this.hasSolved&&"incorrectTooShort"!==this.grade&&this.canHelp){var e=this.answerHash();this.lastAnswerHash!==e&&(this.numDistinct++,this.lastAnswerHash=e),3!=this.numDistinct||this.gotHelp||alert((0,n.t)("msg_parson_help_info"))}}this.hasSolved&&this.options.runnable&&(this.runnableDiv?this.runnableDiv.style.display=null:this.generateRunableVersion())}generateRunableVersion(){this.runnableDiv=document.getElementById(this.divid+"-runnable"),this.runnableDiv.style.display=null;let e="";for(let t of this.answerBlocks())for(let i of t.lines)e+=" ".repeat(i.indent)+i.text+"\n";e=e.slice(0,-1);const t=this.runnableDiv.querySelector("textarea");t.innerHTML=t.innerHTML.replace("==PARSONSCODE==",e),this.runnableDiv.querySelector('[data-component="parsons-runnable"]').dataset.component="activecode",window.runestoneComponents.renderOneComponent(this.runnableDiv)}renderFeedback(){this.grader.showfeedback=!0,this.grade=this.grader.graderState;var e=this.answerArea,t=!0===this.showfeedback?this.messageDiv:null,i=(e,i)=>{t&&(t.setAttribute("class",e),setTimeout((()=>{t.innerHTML=i}),10))};if("correct"===this.grade){e.classList.add("correct"),this.messageDiv.style.visibility="visible";let t=this.checkCount>1?(0,n.t)("msg_parson_correct",this.checkCount):(0,n.t)("msg_parson_correct_first_try");this.options.runnable&&(t+=" "+(0,n.t)("msg_parson_correct_runnable")),i("alert alert-info",t),this.showBlockExplanations()}if("incorrectTooShort"===this.grade&&(e.classList.add("incorrect"),this.messageDiv.style.visibility="visible",i("alert alert-danger",(0,n.t)("msg_parson_too_short"))),"incorrectIndent"===this.grade){var s=[];for(let e=0;e<this.grader.indentLeft.length;e++)h=this.grader.indentLeft[e].block(),-1==s.indexOf(h)&&(s.push(h),h.view.classList.add("indentLeft"));for(let e=0;e<this.grader.indentRight.length;e++)h=this.grader.indentRight[e].block(),-1==s.indexOf(h)&&(s.push(h),h.view.classList.add("indentRight"));this.messageDiv.style.visibility="visible",i("alert alert-danger",1==s.length?(0,n.t)("msg_parson_wrong_indent"):(0,n.t)("msg_parson_wrong_indents"))}if("incorrectMoveBlocks"===this.grade){var r=this.answerBlocks(),o=[],a=[],l=[];for(let e=0;e<r.length;e++){var h=r[e],c=this.solution.indexOf(h.lines[0]);-1==c?l.push(h):(o.push(h),a.push(c))}var d=this.grader.inverseLISIndices(a,o);for(let e=0;e<d.length;e++)l.push(o[d[e]]);if(e.classList.add("incorrect"),this.messageDiv.style.visibility="visible",!0===this.showfeedback)for(let e=0;e<l.length;e++)l[e].view.classList.add("incorrectPosition");i("alert alert-danger",(0,n.t)("msg_parson_wrong_order"))}}showBlockExplanations(){if(this.blockExplanations&&0!==Object.keys(this.blockExplanations).length){this.hideBlockExplanations();for(var e=this.answerBlocks(),t=0;t<e.length;t++){var i=e[t],s=i.lines[0].index,n=this.blockExplanations[String(s)];n||(n=this.blockExplanations[String(t)]),n&&(i.view.setAttribute("data-toggle","tooltip"),i.view.setAttribute("title",n),i.view.classList.add("has-explanation"))}}}hideBlockExplanations(){for(const e of this.answerArea.querySelectorAll(".has-explanation"))e.removeAttribute("data-toggle"),e.removeAttribute("title"),e.removeAttribute("data-original-title"),e.classList.remove("has-explanation")}initializeAdaptive(){if(this.adaptiveId=super.localStorageKey(),this.canHelp=!0,this.checkCount=0,this.numDistinct=0,this.gotHelp=!1,localStorage.getItem(this.adaptiveId+"Problem")==this.divid)return this.checkCount=localStorage.getItem(this.adaptiveId+this.divid+"Count"),null==this.checkCount&&(this.checkCount=0),this;var e=localStorage.getItem(this.adaptiveId+this.divid+"Count");null!=e&&"NaN"!=e||(e=0),this.checkCount=e,this.recentAttempts=localStorage.getItem(this.adaptiveId+"recentAttempts"),null!=this.recentAttempts&&"NaN"!=this.recentAttempts||(this.recentAttempts=3),localStorage.setItem(this.adaptiveId+"recentAttempts",this.recentAttempts),localStorage.setItem(this.adaptiveId+"Problem",this.divid),localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),localStorage.setItem(this.adaptiveId+"Solved",!1)}usesIndentation(){return!this.noindent&&0!=this.solutionIndent()}distractorToRemove(){var e,t=this.enabledAnswerBlocks();for(let i=0;i<t.length;i++)if((e=t[i]).isDistractor())return e;t=this.enabledSourceBlocks();for(let i=0;i<t.length;i++)if((e=t[i]).isDistractor())return e}numberOfBlocks(e=!0){for(var t=0,i=0;i<this.blocks.length;i++)!this.blocks[i].enabled()||!e&&this.blocks[i].isDistractor()||(t+=1);return t}removeDistractor(e){var t=this.messageDiv;if(this.messageDiv.style.visibility="visible",t.setAttribute("class","alert alert-info"),setTimeout((()=>{t.innerHTML=(0,n.t)("msg_parson_not_solution")}),10),e.lines[0].distractHelptext&&(e.view.setAttribute("data-toggle","tooltip"),e.view.setAttribute("title",e.lines[0].distractHelptext)),e.disable(),e.inSourceArea())e.view.style.borderColor="#000",e.view.style.backgroundColor="#fff",(0,r.i0)(e.view,{opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:2e3,complete:function(){e.view.style.borderColor="",e.view.style.backgroundColor=""}});else{var i=this.sourceArea.getBoundingClientRect(),s=e.pageXCenter()-1,o=e.pageYCenter(),a=i.left+window.pageXOffset+i.width/2,l=i.top+window.pageYOffset+e.view.getBoundingClientRect().height/2,h=e.slideUnderBlock();void 0!==h&&(l+=h.view.getBoundingClientRect().height+20,l+=parseInt(getComputedStyle(h.view).top)||0);var c=this;e.view.style.borderColor="#000",e.view.style.backgroundColor="#fff",(0,r.i0)(e.view,{opacity:1},{duration:4*Math.sqrt(Math.pow(l-o,2)+Math.pow(a-s,2))+500,start:function(){c.moving=e,c.movingX=s,c.movingY=o,c.updateView()},progress:function(e,t,i){c.movingX=s*(1-t)+a*t,c.movingY=o*(1-t)+l*t,c.updateView()},complete:function(){delete c.moving,delete c.movingX,delete c.movingY,c.updateView(),(0,r.i0)(e.view,{opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){e.view.style.opacity="",e.view.style.borderColor="",e.view.style.backgroundColor="",e.view.classList.add("disabled")}})}})}}removeIndentation(){var e=this.messageDiv;this.messageDiv.style.visibility="visible",e.setAttribute("class","alert alert-info"),setTimeout((()=>{e.innerHTML=(0,n.t)("msg_parson_provided_indent")}),10);for(var t,i,s=200,o=0;o<this.lines.length;o++){var a=this.lines[o],l=a.width+a.indent*this.options.pixelsPerIndent+30;s=Math.max(s,l)}null!=this.options.numbered&&(s+=25),this.areaWidth=s+22;var h=this.sourceBlocks();for(let e=0;e<h.length;e++)0==(i=(t=h[e]).solutionIndent())?(0,r.i0)(t.view,{width:s},{duration:1e3}):(0,r.i0)(t.view,{width:s-i*this.options.pixelsPerIndent,"padding-left":i*this.options.pixelsPerIndent+10},{duration:1e3});for(let e=0;e<this.pairedDivs.length;e++)(0,r.i0)(this.pairedDivs[e],{width:s+34},{duration:1e3});var c=this.answerBlocks();for(let e=0;e<c.length;e++)0==(i=(t=c[e]).solutionIndent())?(0,r.i0)(t.view,{left:0,width:s},{duration:1e3}):(0,r.i0)(t.view,{left:0,width:s-i*this.options.pixelsPerIndent,"padding-left":i*this.options.pixelsPerIndent+10},{duration:1e3});this.answerArea.classList.remove("answer1","answer2","answer3","answer4"),this.answerArea.classList.add("answer"),this.indent=0,this.noindent=!0,(0,r.i0)(this.sourceArea,{width:this.areaWidth+2},{duration:1e3}),(0,r.i0)(this.answerArea,{width:this.areaWidth+2},{duration:1e3}),(0,r.i0)(this.answerArea,{opacity:1},{duration:1100,complete:function(){for(let e=0;e<h.length;e++)h[e].addIndent();for(let e=0;e<c.length;e++)c[e].addIndent()}})}getSolutionBlockInSource(){for(var e=this.solutionBlocks(),t=this.answerBlocks(),i=this.sourceBlocks(),s=null,n=0;n<i.length;n++)if(s=i[n],e.indexOf(s)>0&&t.indexOf(s)<0)return s;return null}getFurthestBlock(){for(var e=this.solutionBlocks(),t=this.answerBlocks(),i=0,s=0,n=null,r=null,o=0,a=null,l=0,h=0;h<t.length;h++)r=t[h],(o=e.indexOf(r))>0&&(a=e[o-1],l=t.indexOf(a),(s=Math.abs(h-l))>i&&(i=s,n=r));return n}combineBlocks(){var e=this.solutionBlocks(),t=this.answerBlocks(),i=this.sourceBlocks(),s=this.messageDiv;this.messageDiv.style.visibility="visible",s.setAttribute("class","alert alert-info"),setTimeout((()=>{s.innerHTML=(0,n.t)("msg_parson_combined_blocks")}),10);var o=null,a=null;null==(a=this.getSolutionBlockInSource())&&(a=this.getFurthestBlock());var l=e.indexOf(a);o=e[l-1];var h=t.indexOf(o),c=t.indexOf(a),d=!1;h>=0&&c>=0?d=h+1!==c:h<0&&c<0?d=(h=i.indexOf(o))+1!==(c=i.indexOf(a)):(d=!0,h<0&&(h=i.indexOf(o)),c<0&&(c=i.indexOf(a)));var u=c<h;if(d){var p=a.pageXCenter()-1,g=a.pageYCenter(),v=o.pageXCenter()-1,f=o.pageYCenter()+o.view.getBoundingClientRect().height/2+5;u?f-=a.view.getBoundingClientRect().height/2:f+=a.view.getBoundingClientRect().height/2;var m=this;(0,r.i0)(a.view,{opacity:1},{duration:1e3,start:function(){o.view.style.borderColor="#000",o.view.style.backgroundColor="#fff",a.view.style.borderColor="#000",a.view.style.backgroundColor="#fff",a.lines[0].index+=1e3,m.moving=a,m.movingX=p,m.movingY=g,m.updateView()},progress:function(e,t,i){m.movingX=p*(1-t)+v*t,m.movingY=g*(1-t)+f*t,m.updateView()},complete:function(){delete m.moving,delete m.movingX,delete m.movingY,m.updateView(),a.lines[0].index-=1e3,o.consumeBlock(a),(0,r.i0)(o.view,{"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){o.view.style.borderColor="",o.view.style.backgroundColor=""}})}})}else(0,r.i0)(a.view,{opacity:1},{duration:1e3,start:function(){o.view.style.borderColor="#000",o.view.style.backgroundColor="#fff",a.view.style.borderColor="#000",a.view.style.backgroundColor="#fff"},complete:function(){o.consumeBlock(a),(0,r.i0)(o.view,{"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){o.view.style.borderColor="",o.view.style.backgroundColor=""}})}})}makeEasier(){var e=this.distractorToRemove();void 0===e||e.inSourceArea()?this.numberOfBlocks(!1)>3?(alert((0,n.t)("msg_parson_will_combine")),this.combineBlocks(),this.logMove("combinedBlocks")):(alert((0,n.t)("msg_parson_three_blocks_left")),this.canHelp=!1):(alert((0,n.t)("msg_parson_remove_incorrect")),this.removeDistractor(e),this.logMove("removedDistractor-"+e.hash()))}helpMe(){this.clearFeedback(),this.numDistinct<3?alert((0,n.t)("msg_parson_atleast_three_attempts")):(this.gotHelp=!0,this.makeEasier())}dateFromTimestamp(e){var t=new Date(e);if(isNaN(t.getTime())){var i=e.split(/[- :]/);t=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5])}return t}shuffled(e){for(var t,i,s=e.length,n=e.slice();0!==s;)i=Math.floor(Math.random()*s),t=n[s-=1],n[s]=n[i],n[i]=t;return n}enterKeyboardMode(){this.keyboardTip.style.display="",this.sourceLabel.style.display="none",this.answerLabel.style.display="none",this.clearFeedback()}exitKeyboardMode(){this.keyboardTip.style.display="none",this.sourceLabel.style.display="",this.answerLabel.style.display=""}clearFeedback(){this.answerArea.classList.remove("incorrect","correct");for(var e=this.answerArea.children,t=0;t<e.length;t++)e[t].classList.remove("correctPosition","incorrectPosition","indentLeft","indentRight");this.messageDiv.style.visibility="hidden",this.hideBlockExplanations()}async disableInteraction(){if(await this.checkServerComplete,console.log("disabling blocks"),void 0!==this.blocks)for(var e=0;e<this.blocks.length;e++)this.blocks[e].disable();this.checkButton.style.display="none",this.resetButton.style.display="none"}movingState(){if(null==this.moving)return"rest";var e=this.movingX-window.pageXOffset,t=this.movingY-window.pageYOffset,i=this.answerArea.getBoundingClientRect();return e>=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom?"answer":e>=(i=this.sourceArea.getBoundingClientRect()).left&&e<=i.right&&t>=i.top&&t<=i.bottom?"source":"moving"}placeView(e,t,i,s,n){e.style.left=t+"px",e.style.top=i+"px",e.style.width=s+"px",e.style.zIndex=n}updateView(){var e,t,i,s=this.state,n=this.movingState(),o=!0,a=!0,l="moving"==n;s==n&&("rest"==n?(o=!1,a=!1):"source"==n?a=!1:"answer"==n?o=!1:"moving"==n&&(a=!1,o=!1)),void 0!==this.moving&&(e=(0,r.DK)(this.moving.view),this.moving.view.remove());var h,c,d=this.areaWidth-22;if(o){t=0;var u=this.sourceBlocks();if("source"==n){var p=!1,g=this.moving.pairedBin(),v=[];for(x=0;x<u.length;x++)v.push(u[x].pairedBin());v.includes(g)||(g=-1);var f=[];if(0==v.length)f.push(0);else{for((-1==g||v[0]==g)&&f.push(0),x=1;x<u.length;x++)(v[x-1]==g||v[x]==g||-1==g&&v[x-1]!=v[x])&&f.push(x);(-1==g||v[v.length-1]==g)&&f.push(v.length)}var m=this.movingX-this.sourceArea.getBoundingClientRect().left-window.pageXOffset-d/2-11,b=this.movingY-this.sourceArea.getBoundingClientRect().top-window.pageYOffset;for(x=0;x<u.length;x++){var w,y=u[x];if(!p&&f.includes(x)){var k=(0,r.DK)(y.view);for(w=x+1;w<u.length&&!f.includes(w);w++)k+=(0,r.DK)(u[w].view);(b-t<e+k/2||x==f[f.length-1])&&(p=!0,this.sourceArea.insertBefore(this.moving.view,y.view),this.placeView(this.moving.view,m,b-e/2,d,3),t+=e)}this.placeView(y.view,0,t,d,2),t+=(0,r.DK)(y.view)}p||(this.sourceArea.appendChild(this.moving.view),this.placeView(this.moving.view,m,b-(0,r.DK)(this.moving.view)/2,d,3))}else for(var x=0;x<u.length;x++)y=u[x],this.placeView(y.view,0,t,d,2),t+=(0,r.DK)(y.view);for(x=0;x<this.pairedBins.length;x++){var _=this.pairedBins[x],S=[];for(w=0;w<u.length;w++)(h=u[w]).matchesBin(_)&&S.push(h);var A=this.pairedDivs[x];if(0==S.length)A.style.display="none";else{A.style.display="";var C=-5,I=S[S.length-1].view;C+=parseInt(getComputedStyle(I).top),C-=parseInt(getComputedStyle(S[0].view).top),C+=(0,r.DK)(I),A.style.left="-6px",A.style.top=getComputedStyle(S[0].view).top,A.style.width=d+34+"px",A.style.height=C+"px",A.style.zIndex=1,A.style.textIndent="-30px",A.style.paddingTop=(C-70)/2+"px",A.style.overflow="visible",A.style.fontSize="43px",A.style.verticalAlign="middle",A.style.color="#7e7ee7",A.innerHTML="<span id= 'st' style = 'vertical-align: middle; font-weight: bold; font-size: 15px'>or</span>{"}1==S.length&&(A.innerHTML="")}}if(a)if(t=0,i=this.areaWidth+this.indent*this.options.pixelsPerIndent-22,u=this.answerBlocks(),"answer"==n){p=!1,m=this.movingX-this.answerArea.getBoundingClientRect().left-window.pageXOffset-d/2-11;var T=Math.round(m/this.options.pixelsPerIndent);for(T<0?T=0:T>this.indent?T=this.indent:m=T*this.options.pixelsPerIndent,b=this.movingY-this.answerArea.getBoundingClientRect().top-window.pageYOffset,this.moving.indent=T,x=0;x<u.length;x++)h=u[x],p||b-t<(e+(0,r.DK)(h.view))/2&&(p=!0,this.answerArea.insertBefore(this.moving.view,h.view),this.placeView(this.moving.view,m,b-e/2,d,3),t+=e),c=h.indent*this.options.pixelsPerIndent,this.placeView(h.view,c,t,i-c,2),t+=(0,r.DK)(h.view);p||(this.answerArea.appendChild(this.moving.view),this.placeView(this.moving.view,m,b-(0,r.DK)(this.moving.view)/2,d,3))}else for(let e=0;e<u.length;e++)c=(h=u[e]).indent*this.options.pixelsPerIndent,this.placeView(h.view,c,t,i-c,2),t+=(0,r.DK)(h.view);if(l){if(-1==(g=this.moving.pairedBin()))this.sourceArea.appendChild(this.moving.view);else{var L;for(u=this.sourceBlocks,x=0;x<u.length;x++)(h=u[x]).pairedBin()==g&&(L=x+1);null==L||L==u.length?this.sourceArea.appendChild(this.moving.view):this.sourceArea.insertBefore(this.moving.view,u[L].view)}this.placeView(this.moving.view,this.movingX-this.sourceArea.getBoundingClientRect().left-window.pageXOffset-(0,r.Gq)(this.moving.view)/2,this.movingY-this.sourceArea.getBoundingClientRect().top-window.pageYOffset-e/2,d,3)}s=n,this.state=s}addBlockLabels(e){var t=-1,i=0,s=0,n=0;for(let t=0;t<e.length;t++)-1==e[t].pairedBin()&&n++;for(let a=0;a<e.length;a++){var r=e[a].pairedBin();-1!=r&&r==t||(t=r,s=0,i++);var o=""+i+(-1!=r?String.fromCharCode(97+s):" ");i<10&&n+this.pairedBins.length>=10&&(o+=" "),e[a].addLabel(o,0),s++}n+this.pairedBins.length>=10&&(this.areaWidth+=5,this.sourceArea.style.width=(parseFloat(getComputedStyle(this.sourceArea).width)||0)+5+"px",this.answerArea.style.width=(parseFloat(getComputedStyle(this.answerArea).width)||0)+5+"px")}resetView(){if(this.clearFeedback(),!0===this.options.scaffolding){const e=document.querySelector(`#copy-answer-button-${this.divid}`);e&&e.classList.add("copy-button-hide")}var e,t=document.body.scrollTop;for(let t=0;t<this.blocks.length;t++){e=this.blocks[t];for(var i=0;i<e.lines.length;i++)for(var s=e.lines[i].view.querySelectorAll(".block-label"),n=0;n<s.length;n++)s[n].remove();e.destroy(),this.blocks[t].view.remove()}if(delete this.blocks,this.blockIndex=0,this.pairedDivs)for(let e=0;e<this.pairedDivs.length;e++)this.pairedDivs[e].remove();this.sourceArea.setAttribute("style",""),this.answerArea.className="",this.answerArea.setAttribute("style",""),this.noindent=this.options.noindent,this.hasSolved&&(this.checkCount=0,this.numDistinct=0,this.hasSolved=!1,this.options.adaptive&&(this.canHelp=!0),localStorage.setItem(this.adaptiveId+"Problem",this.divid),localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),localStorage.setItem(this.adaptiveId+"Solved",!1)),!0===this.options.scaffolding?this.initializeAreas(this.blocksFromSource(),this.settledBlocksFromSource(),{}):this.initializeAreas(this.blocksFromSource(),[],{}),this.initializeInteractivity(),document.body.scrollTop=t,this.runnableDiv&&(this.runnableDiv.style.display="none")}}A.counter=0,document.addEventListener("runestone:login-complete",(function(){for(const e of document.querySelectorAll("[data-component=parsons]"))if(null===e.closest("[data-component=timedAssessment]"))try{window.componentMap[e.id]=new A({orig:e,useRunestoneServices:eBookConfig.useRunestoneServices})}catch(t){console.log(`Error rendering Parsons Problem ${e.id}\n Details: ${t}`),console.log(t.stack)}}));class C extends A{constructor(e){super(e),e.timedfeedback?this.showfeedback=!0:this.showfeedback=!1,this.grader.showfeedback=this.showfeedback,this.hideFeedback(),this.checkButton.style.display="none",this.helpButton&&(this.helpButton.style.display="none"),this.resetButton.style.display="none"}checkCorrectTimed(){return this.correct?"T":"F"}hideFeedback(){this.messageDiv.style.display="none"}}void 0===window.component_factory&&(window.component_factory={}),window.component_factory.parsons=function(e){return e.timed?new C(e):new A(e)}},56906:(e,t,i)=>{"use strict";(0,i(54250).Hh)({"pt-br":{msg_parson_check_me:"Verificar",msg_parson_reset:"Resetar",msg_parson_help:"Ajuda",msg_parson_too_short:"Seu programa é muito curto. Adicione mais blocos.",msg_parson_drag_from_here:"Arraste daqui",msg_parson_drag_to_here:"Largue os blocos aqui",msg_parson_correct_first_try:"Perfeito! Você levou apenas uma tentativa para resolver. Bom trabalho!",msg_parson_correct:"Perfeito! Você levou $1 tentativas para resolver. Clique em Resetar para tentar resolver em uma tentativa.",msg_parson_wrong_indent:"Este bloco não está indentado corretamente. Indente mais arrastando-o para a direita ou reduza a indentação arrastando para a esquerda.",msg_parson_wrong_indents:"Estes blocos não estão indentados corretamente. Para indentar mais, arraste o bloco para a direita. Para reduzir a indentação, arraste para a esquerda.",msg_parson_wrong_order:"Blocos destacados no seu programa estão errados ou estão na ordem errada. Isso pode ser resolvido movendo, excluindo ou substituindo os blocos destacados.",msg_parson_arrow_navigate:"Use as teclas de setas para navegar. Espaço para selecionar/ desmarcar blocos para mover.",msg_parson_help_info:"Clique no botão Ajuda se você quiser facilitar o problema",msg_parson_not_solution:"Foi desabilitado um bloco de código desnecessário (que não faz parte da solução).",msg_parson_provided_indent:"Foi fornecida a indentação.",msg_parson_combined_blocks:"Dois blocos de códigos foram combinados em um.",msg_parson_remove_incorrect:"Será removido um bloco de código incorreto da área de resposta",msg_parson_will_combine:"Serão combinados dois blocos",msg_parson_atleast_three_attempts:"Você deve tentar pelo menos três vezes antes de pedir ajuda",msg_parson_three_blocks_left:"Restam apenas 3 blocos corretos. Você deve colocá-los em ordem",msg_parson_will_provide_indent:"Será fornecida a indentação"}})},75794:(e,t,i)=>{"use strict";(0,i(54250).Hh)({en:{msg_parson_check_me:"Check",msg_parson_reset:"Reset",msg_parson_help:"Help me",msg_parson_too_short:"Your answer is too short. Add more blocks.",msg_parson_drag_from_here:"Drag from here",msg_parson_drag_to_here:"Drop blocks here",msg_parson_correct_first_try:"Perfect! It took you only one try to solve this. Great job!",msg_parson_correct:"Perfect! It took you $1 tries to solve this. Click Reset to try to solve it in one attempt.",msg_parson_correct_runnable:"Click Run below to test out your solution.",msg_parson_wrong_indent:"This block is not indented correctly. Either indent it more by dragging it right or reduce the indention by dragging it left.",msg_parson_wrong_indents:"These blocks are not indented correctly. To indent a block more, drag it to the right. To reduce the indention, drag it to the left.",msg_parson_wrong_order:"Highlighted blocks in your answer are wrong or are in the wrong order. This can be fixed by moving, removing, or replacing highlighted blocks.",msg_parson_arrow_navigate:"Arrow keys to navigate. Space to select / deselect block to move.",msg_parson_help_info:"Click on the Help Me button if you want to make the problem easier",msg_parson_not_solution:"Disabled an unneeded code block (one that is not part of the solution).",msg_parson_provided_indent:"Provided the indentation.",msg_parson_combined_blocks:"Combined two code blocks into one.",msg_parson_remove_incorrect:"Will remove an incorrect code block from answer area",msg_parson_will_combine:"Will combine two blocks",msg_parson_atleast_three_attempts:"You must make at least three distinct full attempts at a solution before you can get help",msg_parson_three_blocks_left:"There are only 3 correct blocks left. You should be able to put them in order",msg_parson_will_provide_indent:"Will provide indentation"}})},78811:()=>{function e(){var t=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);return e=function(){return t},t}!function(){var t="break continue do else for if return while ",i=t+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try ",s=i+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",n=i+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",r=i+"debugger eval export function get null set undefined var with Infinity NaN ",o="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",a=t+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",l=t+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",h=t+"case done elif esac eval fi function in local set then until ",c=s+(n+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ")+r+o+a+l+h;function d(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function u(e,t,i,s){e.unshift(i,s||0);try{t.splice.apply(t,e)}finally{e.splice(0,2)}}var p=function(){for(var e=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],t="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)",i=0;i<e.length;++i){var s=e[i];t+=d(s.charAt(0))?"|\\b"+s:"|"+s.replace(/([^=<>:&])/g,"\\$1")}return t+="|^)\\s*$",new RegExp(t)}(),g=/&/g,v=/</g,f=/>/g,m=/\"/g;function b(e){return e.replace(g,"&amp;").replace(v,"&lt;").replace(f,"&gt;")}var w=/&lt;/g,y=/&gt;/g,k=/&apos;/g,x=/&quot;/g,_=/&amp;/g,S=/&nbsp;/g;function A(e){var t=e.indexOf("&");if(t<0)return e;for(--t;(t=e.indexOf("&#",t+1))>=0;){var i=e.indexOf(";",t);if(i>=0){var s=e.substring(t+3,i),n=10;s&&"x"===s.charAt(0)&&(s=s.substring(1),n=16);var r=parseInt(s,n);isNaN(r)||(e=e.substring(0,t)+String.fromCharCode(r)+e.substring(i+1))}}return e.replace(w,"<").replace(y,">").replace(k,"'").replace(x,'"').replace(_,"&").replace(S," ")}function C(e){return"XMP"===e.tagName}function I(e,t){switch(e.nodeType){case 1:var i=e.tagName.toLowerCase();t.push("<",i);for(var s=0;s<e.attributes.length;++s){var n=e.attributes[s];n.specified&&(t.push(" "),I(n,t))}t.push(">");for(var r=e.firstChild;r;r=r.nextSibling)I(r,t);!e.firstChild&&/^(?:br|link|img)$/.test(i)||t.push("</",i,">");break;case 2:t.push(e.name.toLowerCase(),'="',function(e){return e.replace(g,"&amp;").replace(v,"&lt;").replace(f,"&gt;").replace(m,"&quot;")}(e.value),'"');break;case 3:case 4:t.push(b(e.nodeValue))}}var T=null;function L(e){if(null===T){var t=document.createElement("PRE");t.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />')),T=!/</.test(t.innerHTML)}if(T){var i=e.innerHTML;return C(e)&&(i=b(i)),i}for(var s=[],n=e.firstChild;n;n=n.nextSibling)I(n,s);return s.join("")}var B=/(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g,D=/^<!--/,E=/^<\[CDATA\[/,M=/^<br\b/i;function R(e,t){var i={};!function(){for(var s=e.concat(t),n=s.length;--n>=0;){var r=s[n],o=r[3];if(o)for(var a=o.length;--a>=0;)i[o.charAt(a)]=r}}();var s=t.length;return function(e,n){for(var r=[n=n||0,"pln"],o="",a=0,l=e;l.length;){var h,c,d=null,u=i[l.charAt(0)];if(u)d=(c=l.match(u[1]))[0],h=u[0];else{for(var p=0;p<s;++p){var g=(u=t[p])[2];if((!g||g.test(o))&&(c=l.match(u[1]))){d=c[0],h=u[0];break}}d||(h="pln",d=l.substring(0,1))}r.push(n+a,h),a+=d.length,l=l.substring(d.length),"com"!==h&&/\S/.test(d)&&(o=d)}return r}}var O=R([],[["pln",/^[^<]+/,null],["dec",/^<!\w[^>]*(?:>|$)/,null],["com",/^<!--[\s\S]*?(?:--\>|$)/,null],["src",/^<\?[\s\S]*?(?:\?>|$)/,null],["src",/^<%[\s\S]*?(?:%>|$)/,null],["src",/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],["tag",/^<\/?\w[^<>]*>/,null]]),P=R([["atv",/^\'[^\']*(?:\'|$)/,null,"'"],["atv",/^\"[^\"]*(?:\"|$)/,null,'"'],["pun",/^[<>\/=]+/,null,"<>/="]],[["tag",/^[\w:\-]+/,/^</],["atv",/^[\w\-]+/,/^=/],["atn",/^[\w:\-]+/,null],["pln",/^\s+/,null," \t\r\n"]]);function N(e){var t=[],i=[];e.tripleQuotedStrings?t.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),i.push(["pln",/^(?:[^\'\"\`\/\#]+)/,null," \r\n"]),e.hashComments&&t.push(["com",/^#[^\r\n]*/,null,"#"]),e.cStyleComments&&i.push(["com",/^\/\/[^\r\n]*/,null]),e.regexLiterals&&i.push(["str",/^\/(?:[^\\\*\/\[]|\\[\s\S]|\[(?:[^\]\\]|\\.)*(?:\]|$))+(?:\/|$)/,p]),e.cStyleComments&&i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]);var s=function(e){for(var t={},i=(e=e.split(/ /g)).length;--i>=0;){var s=e[i];s&&(t[s]=null)}return t}(e.keywords);e=null;var n=R(t,i),r=R([],[["pln",/^\s+/,null," \r\n"],["pln",/^[a-z_$@][a-z_$@0-9]*/i,null],["lit",/^0x[a-f0-9]+[a-z]/i,null],["lit",/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i,null,"123456789"],["pun",/^[^\s\w\.$@]+/,null]]);return function(e){var t=n(e);return t=function(e,t){for(var i=0;i<t.length;i+=2)if("pln"===t[i+1]){var n,o,a,l;n=t[i],o=i+2<t.length?t[i+2]:e.length,a=e.substring(n,o);for(var h=0,c=(l=r(a,n)).length;h<c;h+=2)if("pln"===l[h+1]){var d=l[h],p=h+2<c?l[h+2]:a.length,g=e.substring(d,p);"."===g?l[h+1]="pun":g in s?l[h+1]="kwd":/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(g)&&(l[h+1]="@"===g.charAt(0)?"lit":"typ")}u(l,t,i,2),i+=l.length-2}return t}(e,t),t}}var F=N({keywords:c,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),H={};function z(e,t){for(var i=t.length;--i>=0;){var s=t[i];H.hasOwnProperty(s)?"console"in window&&console.log("cannot override language handler %s",s):H[s]=e}}function $(e,t){try{var i=function(e){var t=e.match(B),i=[],s=0,n=[];if(t)for(var r=0,o=t.length;r<o;++r){var a=t[r];if(a.length>1&&"<"===a.charAt(0)){if(D.test(a))continue;E.test(a)?(i.push(a.substring(9,a.length-3)),s+=a.length-12):M.test(a)?(i.push("\n"),++s):n.push(s,a)}else{var l=A(a);i.push(l),s+=l.length}}return{source:i.join(""),tags:n}}(e),s=i.source,n=i.tags;return H.hasOwnProperty(t)||(t=/^\s*</.test(s)?"default-markup":"default-code"),function(e,t,i){var s=[],n=0,r=null,o=null,a=0,l=0,h=function(){var e=0;return function(t){for(var i=null,s=0,n=0,r=t.length;n<r;++n)switch(t.charAt(n)){case"\t":i||(i=[]),i.push(t.substring(s,n));var o=8-e%8;for(e+=o;o>=0;o-=16)i.push(" ".substring(0,o));s=n+1;break;case"\n":e=0;break;default:++e}return i?(i.push(t.substring(s)),i.join("")):t}}();function c(t){if(t>n){r&&r!==o&&(s.push("</span>"),r=null),!r&&o&&(r=o,s.push('<span class="',r,'">'));var i=b(h(e.substring(n,t))).replace(/(\r\n?|\n| ) /g,"$1&nbsp;").replace(/\r\n?|\n/g,"<br />");s.push(i),n=t}}for(;;)if(a<t.length&&(!(l<i.length)||t[a]<=i[l]))c(t[a]),r&&(s.push("</span>"),r=null),s.push(t[a+1]),a+=2;else{if(!(l<i.length))break;c(i[l]),o=i[l+1],l+=2}return c(e.length),r&&s.push("</span>"),s.join("")}(s,n,H[t].call({},s))}catch(t){return"console"in window&&(console.log(t),console.trace()),e}}z(F,["default-code"]),z((function(e){var t=function(e){for(var t=O(e),i=0;i<t.length;i+=2)if("src"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;var r=e.substring(s,n).match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);r&&t.splice(i,2,s,"tag",s+r[1].length,"src",s+r[1].length+(r[2]||"").length,"tag")}return t}(e);return t=function(e,t){for(var i=0;i<t.length;i+=2)if("tag"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;var r=e.substring(s,n),o=P(r,s);u(o,t,i,2),i+=o.length-2}return t}(e,t),t=function(e,t){for(var i=0;i<t.length;i+=2)if("src"===t[i+1]){var s,n;s=t[i],n=i+2<t.length?t[i+2]:e.length;for(var r=F(e.substring(s,n)),o=0,a=r.length;o<a;o+=2)r[o]+=s;u(r,t,i,2),i+=r.length-2}return t}(e,t),function(e,t){for(var i=!1,s=0;s<t.length;s+=2){var n,r,o=t[s+1];if("atn"===o)n=t[s],r=s+2<t.length?t[s+2]:e.length,i=/^on|^style$/i.test(e.substring(n,r));else if("atv"===o){if(i){n=t[s],r=s+2<t.length?t[s+2]:e.length;var a,l,h,c=e.substring(n,r),d=c.length,p=d>=2&&/^[\"\']/.test(c)&&c.charAt(0)===c.charAt(d-1);p?(l=n+1,h=r-1,a=c):(l=n+1,h=r-1,a=c.substring(1,c.length-1));for(var g=F(a),v=0,f=g.length;v<f;v+=2)g[v]+=l;p?(g.push(h,"atv"),u(g,t,s+2,0)):u(g,t,s,2)}i=!1}}return t}(e,t)}),["default-markup","html","htm","xhtml","xml","xsl"]),z(N({keywords:s,hashComments:!0,cStyleComments:!0}),["c","cc","cpp","cs","cxx","cyc"]),z(N({keywords:n,cStyleComments:!0}),["java"]),z(N({keywords:h,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),z(N({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),z(N({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),z(N({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),z(N({keywords:r,cStyleComments:!0,regexLiterals:!0}),["js"]),window.PR_normalizedHtml=I,window.prettyPrintOne=$,window.prettyPrint=function(t){for(var i=e(),s=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("li"),document.getElementsByTagName("xmp")],n=[],r=0;r<s.length;++r)for(var o=0;o<s[r].length;++o)n.push(s[r][o]);s=null;var a=0;!function e(){for(var s=(new Date).getTime()+250;a<n.length&&(new Date).getTime()<s;a++){var r=n[a];if(r.className&&r.className.indexOf("prettyprint")>=0){var o=r.className.match(/\blang-(\w+)\b/);o&&(o=o[1]);for(var l=!1,h=r.parentNode;h;h=h.parentNode)if(("pre"===h.tagName||"code"===h.tagName||"xmp"===h.tagName)&&h.className&&h.className.indexOf("prettyprint")>=0){l=!0;break}if(!l){var c=L(r),d=$(c=c.replace(/(?:\r\n?|\n)$/,""),o);if(C(r)){for(var u=document.createElement("PRE"),p=0;p<r.attributes.length;++p){var g=r.attributes[p];g.specified&&u.setAttribute(g.name,g.value)}u.innerHTML=d,r.parentNode.replaceChild(u,r),u=r}else r.innerHTML=d;if(i&&"PRE"===r.tagName)for(var v=r.getElementsByTagName("br"),f=v.length;--f>=0;){var m=v[f];m.parentNode.replaceChild(document.createTextNode("\r\n"),m)}}}}a<n.length?setTimeout(e,250):t&&t()}()},window.PR={createSimpleLexer:R,registerLangHandler:z,sourceDecorator:N,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}}()},88210:(e,t,i)=>{var s;!function(n,r,o,a){"use strict";function l(e,t,i){return setTimeout(p(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(c(e,i[t],i),!0)}function c(e,t,i){var s;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(s=0;s<e.length;)t.call(i,e[s],s,e),s++;else for(s in e)e.hasOwnProperty(s)&&t.call(i,e[s],s,e)}function d(e,t,i){var s="DEPRECATED METHOD: "+t+"\n"+i+" AT \n";return function(){var t=new Error("get-stack-trace"),i=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=n.console&&(n.console.warn||n.console.log);return r&&r.call(n.console,s,i),e.apply(this,arguments)}}function u(e,t,i){var s,n=t.prototype;(s=e.prototype=Object.create(n)).constructor=e,s._super=n,i&&ae(s,i)}function p(e,t){return function(){return e.apply(t,arguments)}}function g(e,t){return typeof e==ce?e.apply(t&&t[0]||a,t):e}function v(e,t){return e===a?t:e}function f(e,t,i){c(y(t),(function(t){e.addEventListener(t,i,!1)}))}function m(e,t,i){c(y(t),(function(t){e.removeEventListener(t,i,!1)}))}function b(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function y(e){return e.trim().split(/\s+/g)}function k(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var s=0;s<e.length;){if(i&&e[s][i]==t||!i&&e[s]===t)return s;s++}return-1}function x(e){return Array.prototype.slice.call(e,0)}function _(e,t,i){for(var s=[],n=[],r=0;r<e.length;){var o=t?e[r][t]:e[r];k(n,o)<0&&s.push(e[r]),n[r]=o,r++}return i&&(s=t?s.sort((function(e,i){return e[t]>i[t]})):s.sort()),s}function S(e,t){for(var i,s,n=t[0].toUpperCase()+t.slice(1),r=0;r<le.length;){if((s=(i=le[r])?i+n:t)in e)return s;r++}return a}function A(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||n}function C(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){g(e.options.enable,[e])&&i.handler(t)},this.init()}function I(e,t,i){var s=i.pointers.length,n=i.changedPointers.length,r=t&_e&&s-n==0,o=t&(Ae|Ce)&&s-n==0;i.isFirst=!!r,i.isFinal=!!o,r&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,s=t.pointers,n=s.length;i.firstInput||(i.firstInput=L(t)),n>1&&!i.firstMultiple?i.firstMultiple=L(t):1===n&&(i.firstMultiple=!1);var r=i.firstInput,o=i.firstMultiple,a=o?o.center:r.center,l=t.center=B(s);t.timeStamp=pe(),t.deltaTime=t.timeStamp-r.timeStamp,t.angle=R(a,l),t.distance=M(a,l),function(e,t){var i=t.center,s=e.offsetDelta||{},n=e.prevDelta||{},r=e.prevInput||{};t.eventType!==_e&&r.eventType!==Ae||(n=e.prevDelta={x:r.deltaX||0,y:r.deltaY||0},s=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-s.x),t.deltaY=n.y+(i.y-s.y)}(i,t),t.offsetDirection=E(t.deltaX,t.deltaY);var h=D(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=ue(h.x)>ue(h.y)?h.x:h.y,t.scale=o?function(e,t){return M(t[0],t[1],Pe)/M(e[0],e[1],Pe)}(o.pointers,s):1,t.rotation=o?function(e,t){return R(t[1],t[0],Pe)+R(e[1],e[0],Pe)}(o.pointers,s):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,T(i,t);var c=e.element;b(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function T(e,t){var i,s,n,r,o=e.lastInterval||t,l=t.timeStamp-o.timeStamp;if(t.eventType!=Ce&&(l>xe||o.velocity===a)){var h=t.deltaX-o.deltaX,c=t.deltaY-o.deltaY,d=D(l,h,c);s=d.x,n=d.y,i=ue(d.x)>ue(d.y)?d.x:d.y,r=E(h,c),e.lastInterval=t}else i=o.velocity,s=o.velocityX,n=o.velocityY,r=o.direction;t.velocity=i,t.velocityX=s,t.velocityY=n,t.direction=r}function L(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:de(e.pointers[i].clientX),clientY:de(e.pointers[i].clientY)},i++;return{timeStamp:pe(),pointers:t,center:B(t),deltaX:e.deltaX,deltaY:e.deltaY}}function B(e){var t=e.length;if(1===t)return{x:de(e[0].clientX),y:de(e[0].clientY)};for(var i=0,s=0,n=0;t>n;)i+=e[n].clientX,s+=e[n].clientY,n++;return{x:de(i/t),y:de(s/t)}}function D(e,t,i){return{x:t/e||0,y:i/e||0}}function E(e,t){return e===t?Ie:ue(e)>=ue(t)?0>e?Te:Le:0>t?Be:De}function M(e,t,i){i||(i=Oe);var s=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(s*s+n*n)}function R(e,t,i){i||(i=Oe);var s=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,s)/Math.PI}function O(){this.evEl=Fe,this.evWin=He,this.pressed=!1,C.apply(this,arguments)}function P(){this.evEl=Ve,this.evWin=Xe,C.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=We,this.evWin=qe,this.started=!1,C.apply(this,arguments)}function F(e,t){var i=x(e.touches),s=x(e.changedTouches);return t&(Ae|Ce)&&(i=_(i.concat(s),"identifier",!0)),[i,s]}function H(){this.evTarget=Ue,this.targetIds={},C.apply(this,arguments)}function z(e,t){var i=x(e.touches),s=this.targetIds;if(t&(_e|Se)&&1===i.length)return s[i[0].identifier]=!0,[i,i];var n,r,o=x(e.changedTouches),a=[],l=this.target;if(r=i.filter((function(e){return b(e.target,l)})),t===_e)for(n=0;n<r.length;)s[r[n].identifier]=!0,n++;for(n=0;n<o.length;)s[o[n].identifier]&&a.push(o[n]),t&(Ae|Ce)&&delete s[o[n].identifier],n++;return a.length?[_(r.concat(a),"identifier",!0),a]:void 0}function $(){C.apply(this,arguments);var e=p(this.handler,this);this.touch=new H(this.manager,e),this.mouse=new O(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function V(e,t){e&_e?(this.primaryTouch=t.changedPointers[0].identifier,X.call(this,t)):e&(Ae|Ce)&&X.call(this,t)}function X(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var s=this.lastTouches;setTimeout((function(){var e=s.indexOf(i);e>-1&&s.splice(e,1)}),Ke)}}function Y(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,s=0;s<this.lastTouches.length;s++){var n=this.lastTouches[s],r=Math.abs(t-n.x),o=Math.abs(i-n.y);if(Ge>=r&&Ge>=o)return!0}return!1}function W(e,t){this.manager=e,this.set(t)}function q(e){this.options=ae({},this.defaults,e||{}),this.id=fe++,this.manager=null,this.options.enable=v(this.options.enable,!0),this.state=ot,this.simultaneous={},this.requireFail=[]}function j(e){return e&dt?"cancel":e&ht?"end":e&lt?"move":e&at?"start":""}function U(e){return e==De?"down":e==Be?"up":e==Te?"left":e==Le?"right":""}function K(e,t){var i=t.manager;return i?i.get(e):e}function G(){q.apply(this,arguments)}function J(){G.apply(this,arguments),this.pX=null,this.pY=null}function Q(){G.apply(this,arguments)}function Z(){q.apply(this,arguments),this._timer=null,this._input=null}function ee(){G.apply(this,arguments)}function te(){G.apply(this,arguments)}function ie(){q.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function se(e,t){return(t=t||{}).recognizers=v(t.recognizers,se.defaults.preset),new ne(e,t)}function ne(e,t){this.options=ae({},se.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=function(e){return new(e.options.inputClass||(be?P:we?H:me?$:O))(e,I)}(this),this.touchAction=new W(this,this.options.touchAction),re(this,!0),c(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function re(e,t){var i,s=e.element;s.style&&(c(e.options.cssProps,(function(n,r){i=S(s.style,r),t?(e.oldCssProps[i]=s.style[i],s.style[i]=n):s.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}function oe(e,t){var i=r.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=t,t.target.dispatchEvent(i)}var ae,le=["","webkit","Moz","MS","ms","o"],he=r.createElement("div"),ce="function",de=Math.round,ue=Math.abs,pe=Date.now;ae="function"!=typeof Object.assign?function(e){if(e===a||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(s!==a&&null!==s)for(var n in s)s.hasOwnProperty(n)&&(t[n]=s[n])}return t}:Object.assign;var ge=d((function(e,t,i){for(var s=Object.keys(t),n=0;n<s.length;)(!i||i&&e[s[n]]===a)&&(e[s[n]]=t[s[n]]),n++;return e}),"extend","Use `assign`."),ve=d((function(e,t){return ge(e,t,!0)}),"merge","Use `assign`."),fe=1,me="ontouchstart"in n,be=S(n,"PointerEvent")!==a,we=me&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),ye="touch",ke="mouse",xe=25,_e=1,Se=2,Ae=4,Ce=8,Ie=1,Te=2,Le=4,Be=8,De=16,Ee=Te|Le,Me=Be|De,Re=Ee|Me,Oe=["x","y"],Pe=["clientX","clientY"];C.prototype={handler:function(){},init:function(){this.evEl&&f(this.element,this.evEl,this.domHandler),this.evTarget&&f(this.target,this.evTarget,this.domHandler),this.evWin&&f(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(A(this.element),this.evWin,this.domHandler)}};var Ne={mousedown:_e,mousemove:Se,mouseup:Ae},Fe="mousedown",He="mousemove mouseup";u(O,C,{handler:function(e){var t=Ne[e.type];t&_e&&0===e.button&&(this.pressed=!0),t&Se&&1!==e.which&&(t=Ae),this.pressed&&(t&Ae&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ke,srcEvent:e}))}});var ze={pointerdown:_e,pointermove:Se,pointerup:Ae,pointercancel:Ce,pointerout:Ce},$e={2:ye,3:"pen",4:ke,5:"kinect"},Ve="pointerdown",Xe="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&(Ve="MSPointerDown",Xe="MSPointerMove MSPointerUp MSPointerCancel"),u(P,C,{handler:function(e){var t=this.store,i=!1,s=e.type.toLowerCase().replace("ms",""),n=ze[s],r=$e[e.pointerType]||e.pointerType,o=r==ye,a=k(t,e.pointerId,"pointerId");n&_e&&(0===e.button||o)?0>a&&(t.push(e),a=t.length-1):n&(Ae|Ce)&&(i=!0),0>a||(t[a]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:r,srcEvent:e}),i&&t.splice(a,1))}});var Ye={touchstart:_e,touchmove:Se,touchend:Ae,touchcancel:Ce},We="touchstart",qe="touchstart touchmove touchend touchcancel";u(N,C,{handler:function(e){var t=Ye[e.type];if(t===_e&&(this.started=!0),this.started){var i=F.call(this,e,t);t&(Ae|Ce)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:ye,srcEvent:e})}}});var je={touchstart:_e,touchmove:Se,touchend:Ae,touchcancel:Ce},Ue="touchstart touchmove touchend touchcancel";u(H,C,{handler:function(e){var t=je[e.type],i=z.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:ye,srcEvent:e})}});var Ke=2500,Ge=25;u($,C,{handler:function(e,t,i){var s=i.pointerType==ye,n=i.pointerType==ke;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(s)V.call(this,t,i);else if(n&&Y.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Je=S(he.style,"touchAction"),Qe=Je!==a,Ze="compute",et="auto",tt="manipulation",it="none",st="pan-x",nt="pan-y",rt=function(){if(!Qe)return!1;var e={},t=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!t||n.CSS.supports("touch-action",i)})),e}();W.prototype={set:function(e){e==Ze&&(e=this.compute()),Qe&&this.manager.element.style&&rt[e]&&(this.manager.element.style[Je]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,(function(t){g(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(w(e,it))return it;var t=w(e,st),i=w(e,nt);return t&&i?it:t||i?t?st:nt:w(e,tt)?tt:et}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(!this.manager.session.prevented){var s=this.actions,n=w(s,it)&&!rt[it],r=w(s,nt)&&!rt[nt],o=w(s,st)&&!rt[st];if(n){var a=1===e.pointers.length,l=e.distance<2,h=e.deltaTime<250;if(a&&l&&h)return}return o&&r?void 0:n||r&&i&Ee||o&&i&Me?this.preventSrc(t):void 0}t.preventDefault()},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var ot=1,at=2,lt=4,ht=8,ct=ht,dt=16,ut=32;q.prototype={defaults:{},set:function(e){return ae(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=K(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)||(e=K(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===k(t,e=K(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=K(e,this);var t=k(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){i.manager.emit(t,e)}var i=this,s=this.state;ht>s&&t(i.options.event+j(s)),t(i.options.event),e.additionalEvent&&t(e.additionalEvent),s>=ht&&t(i.options.event+j(s))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=ut)},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(ut|ot)))return!1;e++}return!0},recognize:function(e){var t=ae({},e);return g(this.options.enable,[this,t])?(this.state&(ct|dt|ut)&&(this.state=ot),this.state=this.process(t),void(this.state&(at|lt|ht|dt)&&this.tryEmit(t))):(this.reset(),void(this.state=ut))},process:function(e){},getTouchAction:function(){},reset:function(){}},u(G,q,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,s=t&(at|lt),n=this.attrTest(e);return s&&(i&Ce||!n)?t|dt:s||n?i&Ae?t|ht:t&at?t|lt:at:ut}}),u(J,G,{defaults:{event:"pan",threshold:10,pointers:1,direction:Re},getTouchAction:function(){var e=this.options.direction,t=[];return e&Ee&&t.push(nt),e&Me&&t.push(st),t},directionTest:function(e){var t=this.options,i=!0,s=e.distance,n=e.direction,r=e.deltaX,o=e.deltaY;return n&t.direction||(t.direction&Ee?(n=0===r?Ie:0>r?Te:Le,i=r!=this.pX,s=Math.abs(e.deltaX)):(n=0===o?Ie:0>o?Be:De,i=o!=this.pY,s=Math.abs(e.deltaY))),e.direction=n,i&&s>t.threshold&&n&t.direction},attrTest:function(e){return G.prototype.attrTest.call(this,e)&&(this.state&at||!(this.state&at)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=U(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),u(Q,G,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&at)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),u(Z,q,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[et]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,s=e.distance<t.threshold,n=e.deltaTime>t.time;if(this._input=e,!s||!i||e.eventType&(Ae|Ce)&&!n)this.reset();else if(e.eventType&_e)this.reset(),this._timer=l((function(){this.state=ct,this.tryEmit()}),t.time,this);else if(e.eventType&Ae)return ct;return ut},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===ct&&(e&&e.eventType&Ae?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=pe(),this.manager.emit(this.options.event,this._input)))}}),u(ee,G,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&at)}}),u(te,G,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ee|Me,pointers:1},getTouchAction:function(){return J.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(Ee|Me)?t=e.overallVelocity:i&Ee?t=e.overallVelocityX:i&Me&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&ue(t)>this.options.velocity&&e.eventType&Ae},emit:function(e){var t=U(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),u(ie,q,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tt]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,s=e.distance<t.threshold,n=e.deltaTime<t.time;if(this.reset(),e.eventType&_e&&0===this.count)return this.failTimeout();if(s&&n&&i){if(e.eventType!=Ae)return this.failTimeout();var r=!this.pTime||e.timeStamp-this.pTime<t.interval,o=!this.pCenter||M(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,o&&r?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=l((function(){this.state=ct,this.tryEmit()}),t.interval,this),at):ct}return ut},failTimeout:function(){return this._timer=l((function(){this.state=ut}),this.options.interval,this),ut},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ct&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),se.VERSION="2.0.8",se.defaults={domEvents:!1,touchAction:Ze,enable:!0,inputTarget:null,inputClass:null,preset:[[ee,{enable:!1}],[Q,{enable:!1},["rotate"]],[te,{direction:Ee}],[J,{direction:Ee},["swipe"]],[ie],[ie,{event:"doubletap",taps:2},["tap"]],[Z]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},ne.prototype={set:function(e){return ae(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var i,s=this.recognizers,n=t.curRecognizer;(!n||n&&n.state&ct)&&(n=t.curRecognizer=null);for(var r=0;r<s.length;)i=s[r],2===t.stopped||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(e),!n&&i.state&(at|lt|ht)&&(n=t.curRecognizer=i),r++}},get:function(e){if(e instanceof q)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=k(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==a&&t!==a){var i=this.handlers;return c(y(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==a){var i=this.handlers;return c(y(e),(function(e){t?i[e]&&i[e].splice(k(i[e],t),1):delete i[e]})),this}},emit:function(e,t){this.options.domEvents&&oe(e,t);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var s=0;s<i.length;)i[s](t),s++}},destroy:function(){this.element&&re(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},ae(se,{INPUT_START:_e,INPUT_MOVE:Se,INPUT_END:Ae,INPUT_CANCEL:Ce,STATE_POSSIBLE:ot,STATE_BEGAN:at,STATE_CHANGED:lt,STATE_ENDED:ht,STATE_RECOGNIZED:ct,STATE_CANCELLED:dt,STATE_FAILED:ut,DIRECTION_NONE:Ie,DIRECTION_LEFT:Te,DIRECTION_RIGHT:Le,DIRECTION_UP:Be,DIRECTION_DOWN:De,DIRECTION_HORIZONTAL:Ee,DIRECTION_VERTICAL:Me,DIRECTION_ALL:Re,Manager:ne,Input:C,TouchAction:W,TouchInput:H,MouseInput:O,PointerEventInput:P,TouchMouseInput:$,SingleTouchInput:N,Recognizer:q,AttrRecognizer:G,Tap:ie,Pan:J,Swipe:te,Pinch:Q,Rotate:ee,Press:Z,on:f,off:m,each:c,merge:ve,extend:ge,assign:ae,inherit:u,bindFn:p,prefixed:S}),(void 0!==n?n:"undefined"!=typeof self?self:{}).Hammer=se,void 0===(s=function(){return se}.call(t,i,t,e))||(e.exports=s)}(window,document)}}]);
//# sourceMappingURL=420.c6d66adb2d61ad16.js.map