<commit_before>/* khan-exercise.js

    The main entry point here is essentially the onjQueryLoaded method around
    line 750. It loads in many of the pre-reqs and then calls, one way or
    another, setUserExercise and loadModule for each required module in utils/.

    setProblemNum updates some instance vars that get looked at by other
    functions.

    loadModule will load an individual exercise util module (e.g.,
    word-problems.js, etc). It _also_ loads in the Khan Academy site skin and
    exercise template via injectSite which runs prepareSite first then
    makeProblemBag and makeProblem when it finishes loading dependencies.

    prepareSite and makeProblem are both fairly heavyweight functions.

    If you are trying to register some behavior when the page loads, you
    probably want it to go in either prepareSite here or, if it makes sense, in
    problemTemplateRendered in interface.js. By the time prepareSite is called,
    jQuery and any core plugins are already available.

    If you are trying to do something each time a problem loads, you probably
    want to look at makeProblem.

    At the end of evaluation, the inner Khan object is returned/exposed as well
    as the inner Util object.


    Catalog of events fired on the Khan object by khan-exercises:

    * newProblem -- when a new problem has completely finished rendering

    * hintUsed -- when a hint has been used by the user

    * allHintsUsed -- when all possible hints have been used by the user

    * checkAnswer -- when the user attempts to check an answer, incorrect or
      correct

    * problemDone -- when the user has completed a problem which, in this case,
      usually means supplying the correct answer. Note the user may have made
      multiple attempts to finally get at the correct answer. A summary object
      including {attempts: <number>, card: <Object>} is included as an
      event parameter.

    * attemptError -- when an error occurs during an API attempt

    * apiRequestStarted / apiRequestEnded -- when an API request is sent
      outbound or completed, respectively. Listeners can keep track of whether
      or not khan-exercises is still waiting on API responses.

    * updateUserExercise -- when an updated userExercise has been received
      and is being used by khan-exercises, either via the result of an API
      call or initialization

    * showGuess -- when a guess is populated in the answer area in problem
      history mode
*/

/**
 * Extracts, decodes and returns the given parameter from the URL
 *   - Based on http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
**/
function getURLParam(name) {
  var param = new RegExp('[?|&]' + name + '=' + '(.+?)(&|$)').exec(location.href)

  return (param) ? decodeURIComponent(param[1]) : "";
}

// The path of khan-exercise.js. By <NAME>
window.urlBaseOverride = "../../ODSAkhan-exercises-new/";

// The address of the server where the data is sent
var SERVER_URL = getURLParam('serverURL');

// The domain where the OpenDSA modules are hosted, used by postMessage to send data to the parent module page
var MODULE_ORIGIN = getURLParam('moduleOrigin');

// The name of the module in which the KA exercises is embedded
var MODULE_NAME = getURLParam('module');

// The name of the book
var BOOK_NAME = getURLParam('bookName');

var Khan = (function() {
    // Numbers which are coprime to the number of bins, used for jumping through
    // exercises.  To quickly test a number in python use code like:<commit_msg>Sent the book hash to the back end.<commit_after>/* khan-exercise.js

    The main entry point here is essentially the onjQueryLoaded method around
    line 750. It loads in many of the pre-reqs and then calls, one way or
    another, setUserExercise and loadModule for each required module in utils/.

    setProblemNum updates some instance vars that get looked at by other
    functions.

    loadModule will load an individual exercise util module (e.g.,
    word-problems.js, etc). It _also_ loads in the Khan Academy site skin and
    exercise template via injectSite which runs prepareSite first then
    makeProblemBag and makeProblem when it finishes loading dependencies.

    prepareSite and makeProblem are both fairly heavyweight functions.

    If you are trying to register some behavior when the page loads, you
    probably want it to go in either prepareSite here or, if it makes sense, in
    problemTemplateRendered in interface.js. By the time prepareSite is called,
    jQuery and any core plugins are already available.

    If you are trying to do something each time a problem loads, you probably
    want to look at makeProblem.

    At the end of evaluation, the inner Khan object is returned/exposed as well
    as the inner Util object.


    Catalog of events fired on the Khan object by khan-exercises:

    * newProblem -- when a new problem has completely finished rendering

    * hintUsed -- when a hint has been used by the user

    * allHintsUsed -- when all possible hints have been used by the user

    * checkAnswer -- when the user attempts to check an answer, incorrect or
      correct

    * problemDone -- when the user has completed a problem which, in this case,
      usually means supplying the correct answer. Note the user may have made
      multiple attempts to finally get at the correct answer. A summary object
      including {attempts: <number>, card: <Object>} is included as an
      event parameter.

    * attemptError -- when an error occurs during an API attempt

    * apiRequestStarted / apiRequestEnded -- when an API request is sent
      outbound or completed, respectively. Listeners can keep track of whether
      or not khan-exercises is still waiting on API responses.

    * updateUserExercise -- when an updated userExercise has been received
      and is being used by khan-exercises, either via the result of an API
      call or initialization

    * showGuess -- when a guess is populated in the answer area in problem
      history mode
*/

/**
 * Extracts, decodes and returns the given parameter from the URL
 *   - Based on http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
**/
function getURLParam(name) {
  var param = new RegExp('[?|&]' + name + '=' + '(.+?)(&|$)').exec(location.href)

  return (param) ? decodeURIComponent(param[1]) : "";
}

// The path of khan-exercise.js. By <NAME>
window.urlBaseOverride = "../../ODSAkhan-exercises-new/";

// The address of the server where the data is sent
var SERVER_URL = getURLParam('serverURL');

// The domain where the OpenDSA modules are hosted, used by postMessage to send data to the parent module page
var MODULE_ORIGIN = getURLParam('moduleOrigin');

// The name of the module in which the KA exercises is embedded
var MODULE_NAME = getURLParam('module');

// The name of the book
var BOOK_NAME = getURLParam('book');

var Khan = (function() {
    // Numbers which are coprime to the number of bins, used for jumping through
    // exercises.  To quickly test a number in python use code like:
{'fraction_non_alphanumeric': 0.06327508455467869, 'fraction_numerical': 0.0031003382187147687, 'mean_word_length': 3.283041641520821, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6256624', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1802, 'n_words': 942}