(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function findChildOrAdd(t,a){var e=$(t).find("."+a);return 0===e.length?$("<span>").addClass(a).appendTo($(t)):e}function doCallback(t,a){var e=0;!function r(){var n=t.scrollHeight;n>18||e>=10?a():(e++,setTimeout(r,100))}()}$.extend(KhanUtil,{processMath:function(t,a,e,r){var n=$(t);if(null==n.attr("data-math-formula")||e){var i=findChildOrAdd(n,"katex-holder"),l=findChildOrAdd(n,"mathjax-holder"),o=l.find("script[type='math/tex']")[0];if(null==a&&(n.attr("data-math-formula")?a=n.attr("data-math-formula"):o&&(a=o.text||o.textContent)),a=null!=a?a+"":"",KhanUtil.cleanMath&&(a=KhanUtil.cleanMath(a)),n.attr("data-math-formula",a),Exercises.useKatex)try{if(katex.render(a,i[0]),"mathjax"===n.attr("data-math-type")){var u=MathJax.Hub.getJaxFor(o);if(u){var h=u.SourceElement();h.previousSibling&&h.previousSibling.className&&u.Remove()}}return n.attr("data-math-type","katex"),void(r&&doCallback(t,r))}catch(d){if(d.__proto__!==katex.ParseError.prototype)throw d}n.attr("data-math-type","mathjax"),o?"text"in o?o.text=a:o.textContent=a:l.append("<script type='math/tex'>"+a.replace(/<\//g,"< /")+"</script>"),"undefined"!=typeof MathJax&&(MathJax.Hub.Queue(["Reprocess",MathJax.Hub,l[0]]),MathJax.Hub.Queue(function(){KhanUtil.debugLog("MathJax done typesetting ("+a+")")}),r&&MathJax.Hub.Queue(function(){var a=MathJax.Callback(function(){});return doCallback(t,function(){r(),a()}),a}))}},processAllMath:function(t,a){var e=$(t);e.filter("code").add(e.find("code")).each(function(){var t=$(this),e=t.attr("data-math-formula");null==e&&(e=t.text(),t.empty()),KhanUtil.processMath(this,e,a)})},cleanupMath:function(t){var a=$(t);if(a.attr("data-math-formula")){if("undefined"!=typeof MathJax){var e=MathJax.Hub.getJaxFor(a.find("script")[0]);if(e){var r=e.SourceElement();r.previousSibling&&r.previousSibling.className&&e.Remove()}}a.text(a.attr("data-math-formula")),a.attr("data-math-formula",null),a.attr("data-math-type",null)}return t},retrieveMathFormula:function(t){return $(t).attr("data-math-formula")}}),$.fn.tex=function(){return KhanUtil.processAllMath(this,!1),this},$.fn.texCleanup=function(){return this.filter("code").add(this.find("code")).each(function(){KhanUtil.cleanupMath(this)}),this};
},{}]},{},[1]);
