diff --git a/openassessment/templates/openassessmentblock/edit/oa_edit_basic_settings_list.html b/openassessment/templates/openassessmentblock/edit/oa_edit_basic_settings_list.html index f653072587..fe34dd080b 100644 --- a/openassessment/templates/openassessmentblock/edit/oa_edit_basic_settings_list.html +++ b/openassessment/templates/openassessmentblock/edit/oa_edit_basic_settings_list.html @@ -162,4 +162,24 @@ {% trans "Specify whether learners can see the rubric while they are working on their response." %}

+
  • +
    + + +
    +

    {% trans "Available template variables are: question, student_answer, prompts" %}

    +
  • +
  • +
    +
    + + +
    +
    +
  • diff --git a/openassessment/xblock/ai_processors.py b/openassessment/xblock/ai_processors.py new file mode 100644 index 0000000000..c49a326123 --- /dev/null +++ b/openassessment/xblock/ai_processors.py @@ -0,0 +1,41 @@ +from django.conf import settings +import openai + +def get_openai_key(): + return settings.OPENAI_API_KEY if hasattr(settings, 'OPENAI_API_KEY') else None + +def davinci_model_processor(question: str, messages: list = []) -> str: + """ + The davinci AI processor + """ + openai.api_key = get_openai_key() + if openai.api_key: + return openai.Completion.create( + engine="text-davinci-003", + # engine="gpt-3.5-turbo", + prompt=question, + max_tokens=500, # TODO: move to settings and get from there. Use automatic tokens counter - https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken + stop=[" "], + temperature=1, + ).choices[0].text + return "OpenAI API key not set." + + +def gpt_model_processor(question: str, messages: list = []) -> str: + """ + The Chat-GPT AI processor + """ + openai.api_key = get_openai_key() + if openai.api_key: + if not messages: + messages = [{"role": "user", "content": question}] + + completion = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=messages, + max_tokens=1000, + stop=[" "], + temperature=0.7, + ) + return completion.choices[0].message["content"] + return "OpenAI API key not set." diff --git a/openassessment/xblock/automatic_assessment.py b/openassessment/xblock/automatic_assessment.py new file mode 100644 index 0000000000..e580724e14 --- /dev/null +++ b/openassessment/xblock/automatic_assessment.py @@ -0,0 +1,188 @@ +""" +TODO: Add module description. +""" +import re +import logging + + +from django.conf import settings + +from openassessment.assessment.api import staff as staff_api +from openassessment.assessment.errors import StaffAssessmentInternalError, StaffAssessmentRequestError +from openassessment.workflow import api as workflow_api +from openassessment.xblock import ai_processors + +from .data_conversion import clean_criterion_feedback + +logger = logging.getLogger(__name__) + +AI_MODELS_LIST = { + 'gpt_model_processor': "Chat GPT", + 'davinci_model_processor': "Text-Davinci" +} + + +# TODO: Move methods like below to utils. +def format_prompts(rubric): # TODO: Add docstring. + prompts_text = "" + + options = rubric['options'] + + for index, elem in enumerate(options): + prompts_text += f"{index}: {elem['explanation']}\n" + + return prompts_text + + +def get_student_response_from_ai(question, answer, prompts, ai_prompt, ai_model): + # Tag + # openai.api_key = getattr(settings, 'OPENAI_API_KEY', "") # TODO: Move to settings and get from there + + if ai_model in AI_MODELS_LIST.keys(): + if ai_processor := getattr(ai_processors, ai_model) if hasattr(ai_processors, ai_model) else None: + + + messages = [] + + + prompt = ai_prompt.format(question=question, student_answer=answer, prompts=prompts) + + if ai_model == 'gpt_model_processor': + messages = [ + {"role": "system", "content":f"Instructor enters the following prompt for the ChatGPT: {ai_prompt}"}, + {"role": "system", "content":f"The question to the student is: {question}."}, + {"role": "system", "content":f"The rubric for grading student's response: {prompts}."}, + {"role": "system", "content":f"Please select the most suited rubric number, and include phrase RUBRIC_OPTION_IS: rubric number, also please follow the prompt {ai_prompt}"}, + {"role": "user", "content":f"My answer is: {answer}."}, + ] + + logger.info(f"{AI_MODELS_LIST.get(ai_model)} prompt") + + logger.info(prompt) + return ai_processor(prompt, messages) + + +def process_ai_response(text): + # import pdb; pdb.set_trace() + regexp_expr = r"RUBRIC_OPTION_IS: (?:\d)\.?" # TODO: Move to settings or config model. + resp = re.findall(regexp_expr, text) + + # TODO: refactor for better catching errors and optimizations. + try: + response_option = int(''.join(filter(str.isdigit, resp[0]))) + response_explanation = text.split(resp[0])[-1].strip() + except Exception: + return None, None + + return response_option, response_explanation + + +# TODO: Move to config or Django config model. +# You are the teacher. +QUESTION_TEMPLATE = """ +You are a cisco instructor, critque the answer based on wendell odems cisco press ccna book. +Question prompt is: +{question}\n +Student's answer is: {student_answer}. +Provide response in the format "RIGHT ANSWER IS": . +Choose the most suitable choice from the following: +{prompts} +Write short (200 symbols) feedback about student answer points (What was correct and what was wrong). +Max response length should be up to 200 symbols. +""" + +QUESTION_TEMPLATE1 = """ +You are a cisco instructor, critique the answer based on wendell odems cisco press ccna book. +Question prompt is: +"{question}"\n +Responder's answer is: "{student_answer}". + +Write answer in the format "GRADE FOR STUDENT ANSWER IS": +Rubric: +{prompts}\n +In addition write short feedback (200 words) about student answer points, what was correct and what was wrong. +""" + +QUESTION_TEMPLATE2 = """ +You are a NASA instructor, please grade reflection based on the rubric. +Question prompt is: "{question}"\n +Responder's answer is: "{student_answer}". + +Write short feedback (200 words) about responders answer in first person, do not critique the answer, but respond empathetically. +""" + + +def generate_automatic_assessment(question, criterias, student_answer_data, student_id, rubric_dict, ai_completion, + ai_model): + # import pdb; pdb.set_trace() + result_dict_data = { + # 'options_selected': {'Ideas': 'Poor'}, + 'options_selected': {}, + # 'criterion_feedback': {'Ideas': 'Це просто ужас. Таких студенів треба гнати з платформи.'}, + 'criterion_feedback': {}, + 'overall_feedback': '', + 'submission_uuid': student_answer_data['uuid'], + 'assess_type': 'full-grade' + } + + # TODO: Process getting data for avoiding errors. + + student_answer_text = student_answer_data['answer']['parts'][0]['text'] + + + for criteria in criterias: + prompts = format_prompts(criteria) + response = get_student_response_from_ai(question, student_answer_text, prompts, ai_completion, ai_model) + + logger.info("Response from AI is: {}".format(response)) + if response: + + choice, explanation = process_ai_response(response) + + if not choice: + choice = 0 + explanation = response + + if choice or explanation: + # TODO: Refactor ?? + result_dict_data['options_selected'][criteria['name']] = criteria['options'][choice]['name'] + result_dict_data['criterion_feedback'][criteria['name']] = explanation + + data = result_dict_data + + if not result_dict_data['options_selected']: + # Return here for avoiding settings the empty staff response + return + + # Save as staff response. + + # TODO: Move code below to another method (logic separation is awesome feature) + try: + assessment = staff_api.create_assessment( + data['submission_uuid'], + student_id, + data['options_selected'], + clean_criterion_feedback(criterias, data['criterion_feedback']), + data['overall_feedback'], + rubric_dict, + ) + assess_type = data.get('assess_type', 'regrade') + workflow_api.update_from_assessments( + assessment["submission_uuid"], + None, + override_submitter_requirements=(assess_type == 'regrade') + ) + except StaffAssessmentRequestError: + logger.warning( + "An error occurred while submitting a staff assessment " + "for the submission %s", + data['submission_uuid'], + exc_info=True + ) + return False + except StaffAssessmentInternalError: + logger.exception( + "An error occurred while submitting a staff assessment " + "for the submission %s", + data['submission_uuid'] + ) diff --git a/openassessment/xblock/openassessmentblock.py b/openassessment/xblock/openassessmentblock.py index 4c35719731..824667397b 100644 --- a/openassessment/xblock/openassessmentblock.py +++ b/openassessment/xblock/openassessmentblock.py @@ -51,6 +51,7 @@ from openassessment.xblock.xml import parse_from_xml, serialize_content_to_xml from openassessment.xblock.editor_config import AVAILABLE_EDITORS from openassessment.xblock.load_static import LoadStatic +from openassessment.xblock.automatic_assessment import QUESTION_TEMPLATE1 logger = logging.getLogger(__name__) # pylint: disable=invalid-name @@ -306,6 +307,18 @@ class OpenAssessmentBlock(MessageMixin, help="Should the rubric be visible to learners in the response section?" ) + ai_completion = String( + scope=Scope.settings, + default=QUESTION_TEMPLATE1, + help="AI question template.", + ) + + ai_model = String( + scope=Scope.settings, + default="", + help="AI model.", + ) + @property def course_id(self): return str(self.xmodule_runtime.course_id) # pylint: disable=no-member @@ -901,6 +914,7 @@ def parse_xml(cls, node, runtime, keys, id_generator): block.teams_enabled = config['teams_enabled'] block.selected_teamset_id = config['selected_teamset_id'] block.show_rubric_during_response = config['show_rubric_during_response'] + block.ai_model = config['ai_model'] return block @property @@ -1031,6 +1045,7 @@ def render_assessment(self, path, context_dict=None): context_dict = {} context_dict['text_response_editor'] = self.text_response_editor + context_dict['ai_model'] = self.ai_model template = get_template(path) return Response(template.render(context_dict), content_type='application/html', charset='UTF-8') diff --git a/openassessment/xblock/schema.py b/openassessment/xblock/schema.py index 6aa0de5c58..c537d368bd 100644 --- a/openassessment/xblock/schema.py +++ b/openassessment/xblock/schema.py @@ -171,4 +171,6 @@ def datetime_validator(value): }) ], Required('show_rubric_during_response', default=False): bool, + Required('ai_completion'): utf8_validator, + Required('ai_model'): utf8_validator, }) diff --git a/openassessment/xblock/static/dist/manifest.json b/openassessment/xblock/static/dist/manifest.json index affad5c4eb..caf75c3590 100644 --- a/openassessment/xblock/static/dist/manifest.json +++ b/openassessment/xblock/static/dist/manifest.json @@ -4,8 +4,8 @@ "openassessment-editor-textarea.js.map": "/openassessment-editor-textarea.0babe8f5dfb2d462894a.js.map", "openassessment-editor-tinymce.js": "/openassessment-editor-tinymce.990d808ee1930fbf3200.js", "openassessment-editor-tinymce.js.map": "/openassessment-editor-tinymce.990d808ee1930fbf3200.js.map", - "openassessment-lms.js": "/openassessment-lms.f22003cefb5051270caa.js", - "openassessment-lms.js.map": "/openassessment-lms.f22003cefb5051270caa.js.map", + "openassessment-lms.js": "/openassessment-lms.86fbdc00dc4d8f98fe89.js", + "openassessment-lms.js.map": "/openassessment-lms.86fbdc00dc4d8f98fe89.js.map", "openassessment-ltr.css": "/openassessment-ltr.d387a062a81f7931a1c9.css", "openassessment-ltr.js": "/openassessment-ltr.d387a062a81f7931a1c9.js", "openassessment-ltr.css.map": "/openassessment-ltr.d387a062a81f7931a1c9.css.map", @@ -14,7 +14,7 @@ "openassessment-rtl.js": "/openassessment-rtl.fdcf1f14feb03ce4e582.js", "openassessment-rtl.css.map": "/openassessment-rtl.fdcf1f14feb03ce4e582.css.map", "openassessment-rtl.js.map": "/openassessment-rtl.fdcf1f14feb03ce4e582.js.map", - "openassessment-studio.js": "/openassessment-studio.fd7c3468f116d1200432.js", - "openassessment-studio.js.map": "/openassessment-studio.fd7c3468f116d1200432.js.map", + "openassessment-studio.js": "/openassessment-studio.9038bc371da4ada4afa1.js", + "openassessment-studio.js.map": "/openassessment-studio.9038bc371da4ada4afa1.js.map", "default-avatar.svg": "/95ec738c0b7faac5b5c9126794446bbd.svg" } \ No newline at end of file diff --git a/openassessment/xblock/static/dist/openassessment-editor-textarea.js b/openassessment/xblock/static/dist/openassessment-editor-textarea.js index e0573e6bf0..6a63a5528a 100644 --- a/openassessment/xblock/static/dist/openassessment-editor-textarea.js +++ b/openassessment/xblock/static/dist/openassessment-editor-textarea.js @@ -63,7 +63,7 @@ /******/ /******/ var hotApplyOnUpdate = true; /******/ // eslint-disable-next-line no-unused-vars -/******/ var hotCurrentHash = "7a38f0bcd21a11990cc9"; +/******/ var hotCurrentHash = "1d0a2638b44fd39c78aa"; /******/ var hotRequestTimeout = 10000; /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; diff --git a/openassessment/xblock/static/dist/openassessment-editor-tinymce.js b/openassessment/xblock/static/dist/openassessment-editor-tinymce.js index 645c45c824..6c94b22a11 100644 --- a/openassessment/xblock/static/dist/openassessment-editor-tinymce.js +++ b/openassessment/xblock/static/dist/openassessment-editor-tinymce.js @@ -63,7 +63,7 @@ /******/ /******/ var hotApplyOnUpdate = true; /******/ // eslint-disable-next-line no-unused-vars -/******/ var hotCurrentHash = "7a38f0bcd21a11990cc9"; +/******/ var hotCurrentHash = "1d0a2638b44fd39c78aa"; /******/ var hotRequestTimeout = 10000; /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; diff --git a/openassessment/xblock/static/dist/openassessment-lms.f22003cefb5051270caa.js b/openassessment/xblock/static/dist/openassessment-lms.86fbdc00dc4d8f98fe89.js similarity index 98% rename from openassessment/xblock/static/dist/openassessment-lms.f22003cefb5051270caa.js rename to openassessment/xblock/static/dist/openassessment-lms.86fbdc00dc4d8f98fe89.js index 95ac09f023..4feb3d53c3 100644 --- a/openassessment/xblock/static/dist/openassessment-lms.f22003cefb5051270caa.js +++ b/openassessment/xblock/static/dist/openassessment-lms.86fbdc00dc4d8f98fe89.js @@ -5,7 +5,7 @@ a.version="2.29.1",t=zt,a.fn=_n,a.min=function(){var e=[].slice.call(arguments,0 Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t=0&&n<=a.b}}function C(e){return function(t){return null==t?void 0:t[e]}}var W=C("byteLength"),q=Y(W),R=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var P=a.r?function(e){return a.l?Object(a.l)(e)&&!z(e):q(e)&&R.test(a.t.call(e))}:x(!1),j=C("length");function B(e,t){t=function(e){for(var t={},n=e.length,r=0;r":">",'"':""","'":"'","`":"`"},Pe=qe(Re),je=qe(ue(Re)),Be=I.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},He=/(.)^/,Xe={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Fe=/\\|'|\r|\n|\u2028|\u2029/g;function Ie(e){return"\\"+Xe[e]}var Ue=/^\s*(\w|\$)+\s*$/;function Ve(e,t,n){!t&&n&&(t=n),t=me({},t,I.templateSettings);var r=RegExp([(t.escape||He).source,(t.interpolate||He).source,(t.evaluate||He).source].join("|")+"|$","g"),a=0,i="__p+='";e.replace(r,(function(t,n,r,o,s){return i+=e.slice(a,s).replace(Fe,Ie),a=s+t.length,n?i+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?i+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t})),i+="';\n";var o,s=t.variable;if(s){if(!Ue.test(s))throw new Error("variable is not a bare identifier: "+s)}else i="with(obj||{}){\n"+i+"}\n",s="obj";i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{o=new Function(s,"_",i)}catch(e){throw e.source=i,e}var c=function(e){return o.call(this,e,I)};return c.source="function("+s+"){\n"+i+"}",c}function $e(e,t,n){var r=(t=ye(t)).length;if(!r)return v(n)?n.call(e):n;for(var a=0;a1)rt(s,t-1,n,r),a=r.length;else for(var c=0,u=s.length;ct?(r&&(clearTimeout(r),r=null),s=u,o=e.apply(a,i),r||(a=i=null)):r||!1===n.trailing||(r=setTimeout(c,l)),o};return u.cancel=function(){clearTimeout(r),s=0,r=a=i=null},u}function ut(e,t,n){var r,a,o,s,c,u=function(){var i=We()-a;t>i?r=setTimeout(u,t-i):(r=null,n||(s=e.apply(c,o)),r||(o=c=null))},l=i((function(i){return c=this,o=i,a=We(),r||(r=setTimeout(u,t),n&&(s=e.apply(c,o))),s}));return l.cancel=function(){clearTimeout(r),r=o=c=null},l}function lt(e,t){return et(t,e)}function dt(e){return function(){return!e.apply(this,arguments)}}function ft(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}}function pt(e,t){return function(){if(--e<1)return t.apply(this,arguments)}}function mt(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}}var ht=et(mt,2);function Mt(e,t,n){t=Ne(t,n);for(var r,a=H(e),i=0,o=a.length;i0?0:a-1;i>=0&&i0?s=o>=0?o:Math.max(o+c,s):c=o>=0?Math.min(o+1,c):o+c+1;else if(n&&o&&c)return r[o=n(r,i)]===i?o:-1;if(i!=i)return(o=t(a.q.call(r,s,c),E))>=0?o+s:-1;for(o=e>0?s:c-1;o>=0&&o0?0:o-1;for(a||(r=t[i?i[s]:s],s+=e);s>=0&&s=3;return t(e,ke(n,a,4),r,i)}}var St=Ot(1),Nt=Ot(-1);function Dt(e,t,n){var r=[];return t=Ne(t,n),zt(e,(function(e,n,a){t(e,n,a)&&r.push(e)})),r}function Et(e,t,n){return Dt(e,dt(Ne(t)),n)}function xt(e,t,n){t=Ne(t,n);for(var r=!nt(e)&&H(e),a=(r||e).length,i=0;i=0}var Wt=i((function(e,t,n){var r,a;return v(t)?a=t:(t=ye(t),r=t.slice(0,-1),t=t[t.length-1]),kt(e,(function(e){var i=a;if(!i){if(r&&r.length&&(e=ve(e,r)),null==e)return;i=e[t]}return null==i?i:i.apply(e,n)}))}));function qt(e,t){return kt(e,ze(t))}function Rt(e,t){return Dt(e,we(t))}function Pt(e,t,n){var r,a,i=-1/0,o=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var s=0,c=(e=nt(e)?e:se(e)).length;si&&(i=r);else t=Ne(t,n),zt(e,(function(e,n,r){((a=t(e,n,r))>o||a===-1/0&&i===-1/0)&&(i=e,o=a)}));return i}function jt(e,t,n){var r,a,i=1/0,o=1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var s=0,c=(e=nt(e)?e:se(e)).length;sr||void 0===n)return 1;if(n1&&(r=ke(r,t[1])),t=G(e)):(r=Qt,t=rt(t,!1,!1),e=Object(e));for(var a=0,i=t.length;a1&&(n=t[1])):(t=kt(rt(t,!1,!1),String),r=function(e,n){return!Ct(t,n)}),Zt(e,r,n)}));function tn(e,t,n){return a.q.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))}function nn(e,t,n){return null==e||e.length<1?null==t||n?void 0:[]:null==t||n?e[0]:tn(e,e.length-t)}function rn(e,t,n){return a.q.call(e,null==t||n?1:t)}function an(e,t,n){return null==e||e.length<1?null==t||n?void 0:[]:null==t||n?e[e.length-1]:rn(e,Math.max(0,e.length-t))}function on(e){return Dt(e,Boolean)}function sn(e,t){return rt(e,t,!1)}var cn=i((function(e,t){return t=rt(t,!0,!0),Dt(e,(function(e){return!Ct(t,e)}))})),un=i((function(e,t){return cn(e,t)}));function ln(e,t,n,r){u(t)||(r=n,n=t,t=!1),null!=n&&(n=Ne(n,r));for(var a=[],i=[],o=0,s=j(e);o1?r.rejectWith(this,[gettext("Multiple teams returned for course")]):0===e.count?r.resolveWith(this,[null]):r.resolveWith(this,[e.results[0]])})).fail((function(){r.rejectWith(this,[gettext("Could not load teams information.")])}))})).promise()}},{key:"getUsername",value:function(){var e=this.url("get_student_username");return $.Deferred((function(t){$.ajax({type:"POST",url:e,data:JSON.stringify({}),contentType:a}).done((function(e){null===e.username?t.rejectWith(this,[gettext("User lookup failed")]):t.resolveWith(this,[e.username])})).fail((function(){t.rejectWith(this,[gettext("Error when looking up username")])}))}))}},{key:"cloneRubric",value:function(e){var t=this.url("get_rubric"),n={target_rubric_block_id:String(e)};return $.Deferred((function(e){$.ajax({type:"POST",url:t,data:JSON.stringify(n),contentType:a}).done((function(t){t.success?e.resolveWith(this,[t.rubric]):e.rejectWith(this,[t.msg])})).fail((function(){e.rejectWith(this,[gettext("Failed to clone rubric")])}))}))}}])&&r(t.prototype,n),i&&r(t,i),e}();t.a=i},function(e,t,n){e.exports=n(174)},function(e,t,n){var r;"undefined"!=typeof self&&self,e.exports=(r=n(0),function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t,n){var r=n(1);e.exports=n(8)(r.isElement,!0)},function(e,t,n){"use strict";e.exports=n(7)},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return"-"+e.toLowerCase()}var a=/[A-Z]/g,i=/^ms-/,o={};t.a=function(e){if(o.hasOwnProperty(e))return o[e];var t=e.replace(a,r);return o[e]=i.test(t)?"-"+t:t}},function(e,t,n){"use strict";function r(e){for(var t=1;t1?t-1:0),r=1;r2?n-2:0),a=2;a1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),r)},oneOfType:function(e){if(!Array.isArray(e))return a("Invalid argument supplied to oneOfType, expected an instance of array."),r;for(var t=0;t=0&&n<=a.b}}function C(e){return function(t){return null==t?void 0:t[e]}}var W=C("byteLength"),q=Y(W),R=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var P=a.r?function(e){return a.l?Object(a.l)(e)&&!z(e):q(e)&&R.test(a.t.call(e))}:x(!1),j=C("length");function B(e,t){t=function(e){for(var t={},n=e.length,r=0;r":">",'"':""","'":"'","`":"`"},Pe=qe(Re),je=qe(ue(Re)),Be=I.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},He=/(.)^/,Xe={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Fe=/\\|'|\r|\n|\u2028|\u2029/g;function Ie(e){return"\\"+Xe[e]}var Ue=/^\s*(\w|\$)+\s*$/;function Ve(e,t,n){!t&&n&&(t=n),t=me({},t,I.templateSettings);var r=RegExp([(t.escape||He).source,(t.interpolate||He).source,(t.evaluate||He).source].join("|")+"|$","g"),a=0,i="__p+='";e.replace(r,(function(t,n,r,o,s){return i+=e.slice(a,s).replace(Fe,Ie),a=s+t.length,n?i+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?i+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t})),i+="';\n";var o,s=t.variable;if(s){if(!Ue.test(s))throw new Error("variable is not a bare identifier: "+s)}else i="with(obj||{}){\n"+i+"}\n",s="obj";i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{o=new Function(s,"_",i)}catch(e){throw e.source=i,e}var c=function(e){return o.call(this,e,I)};return c.source="function("+s+"){\n"+i+"}",c}function $e(e,t,n){var r=(t=ye(t)).length;if(!r)return v(n)?n.call(e):n;for(var a=0;a1)rt(s,t-1,n,r),a=r.length;else for(var c=0,u=s.length;ct?(r&&(clearTimeout(r),r=null),s=u,o=e.apply(a,i),r||(a=i=null)):r||!1===n.trailing||(r=setTimeout(c,l)),o};return u.cancel=function(){clearTimeout(r),s=0,r=a=i=null},u}function ut(e,t,n){var r,a,o,s,c,u=function(){var i=We()-a;t>i?r=setTimeout(u,t-i):(r=null,n||(s=e.apply(c,o)),r||(o=c=null))},l=i((function(i){return c=this,o=i,a=We(),r||(r=setTimeout(u,t),n&&(s=e.apply(c,o))),s}));return l.cancel=function(){clearTimeout(r),r=o=c=null},l}function lt(e,t){return et(t,e)}function dt(e){return function(){return!e.apply(this,arguments)}}function ft(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}}function pt(e,t){return function(){if(--e<1)return t.apply(this,arguments)}}function mt(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}}var ht=et(mt,2);function Mt(e,t,n){t=Ne(t,n);for(var r,a=H(e),i=0,o=a.length;i0?0:a-1;i>=0&&i0?s=o>=0?o:Math.max(o+c,s):c=o>=0?Math.min(o+1,c):o+c+1;else if(n&&o&&c)return r[o=n(r,i)]===i?o:-1;if(i!=i)return(o=t(a.q.call(r,s,c),E))>=0?o+s:-1;for(o=e>0?s:c-1;o>=0&&o0?0:o-1;for(a||(r=t[i?i[s]:s],s+=e);s>=0&&s=3;return t(e,ke(n,a,4),r,i)}}var St=Ot(1),Nt=Ot(-1);function Dt(e,t,n){var r=[];return t=Ne(t,n),zt(e,(function(e,n,a){t(e,n,a)&&r.push(e)})),r}function Et(e,t,n){return Dt(e,dt(Ne(t)),n)}function xt(e,t,n){t=Ne(t,n);for(var r=!nt(e)&&H(e),a=(r||e).length,i=0;i=0}var Wt=i((function(e,t,n){var r,a;return v(t)?a=t:(t=ye(t),r=t.slice(0,-1),t=t[t.length-1]),kt(e,(function(e){var i=a;if(!i){if(r&&r.length&&(e=ve(e,r)),null==e)return;i=e[t]}return null==i?i:i.apply(e,n)}))}));function qt(e,t){return kt(e,ze(t))}function Rt(e,t){return Dt(e,we(t))}function Pt(e,t,n){var r,a,i=-1/0,o=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var s=0,c=(e=nt(e)?e:se(e)).length;si&&(i=r);else t=Ne(t,n),zt(e,(function(e,n,r){((a=t(e,n,r))>o||a===-1/0&&i===-1/0)&&(i=e,o=a)}));return i}function jt(e,t,n){var r,a,i=1/0,o=1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var s=0,c=(e=nt(e)?e:se(e)).length;sr||void 0===n)return 1;if(n1&&(r=ke(r,t[1])),t=G(e)):(r=Qt,t=rt(t,!1,!1),e=Object(e));for(var a=0,i=t.length;a1&&(n=t[1])):(t=kt(rt(t,!1,!1),String),r=function(e,n){return!Ct(t,n)}),Zt(e,r,n)}));function tn(e,t,n){return a.q.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))}function nn(e,t,n){return null==e||e.length<1?null==t||n?void 0:[]:null==t||n?e[0]:tn(e,e.length-t)}function rn(e,t,n){return a.q.call(e,null==t||n?1:t)}function an(e,t,n){return null==e||e.length<1?null==t||n?void 0:[]:null==t||n?e[e.length-1]:rn(e,Math.max(0,e.length-t))}function on(e){return Dt(e,Boolean)}function sn(e,t){return rt(e,t,!1)}var cn=i((function(e,t){return t=rt(t,!0,!0),Dt(e,(function(e){return!Ct(t,e)}))})),un=i((function(e,t){return cn(e,t)}));function ln(e,t,n,r){u(t)||(r=n,n=t,t=!1),null!=n&&(n=Ne(n,r));for(var a=[],i=[],o=0,s=j(e);o1?r.rejectWith(this,[gettext("Multiple teams returned for course")]):0===e.count?r.resolveWith(this,[null]):r.resolveWith(this,[e.results[0]])})).fail((function(){r.rejectWith(this,[gettext("Could not load teams information.")])}))})).promise()}},{key:"getUsername",value:function(){var e=this.url("get_student_username");return $.Deferred((function(t){$.ajax({type:"POST",url:e,data:JSON.stringify({}),contentType:a}).done((function(e){null===e.username?t.rejectWith(this,[gettext("User lookup failed")]):t.resolveWith(this,[e.username])})).fail((function(){t.rejectWith(this,[gettext("Error when looking up username")])}))}))}},{key:"cloneRubric",value:function(e){var t=this.url("get_rubric"),n={target_rubric_block_id:String(e)};return $.Deferred((function(e){$.ajax({type:"POST",url:t,data:JSON.stringify(n),contentType:a}).done((function(t){t.success?e.resolveWith(this,[t.rubric]):e.rejectWith(this,[t.msg])})).fail((function(){e.rejectWith(this,[gettext("Failed to clone rubric")])}))}))}}])&&r(t.prototype,n),i&&r(t,i),e}();t.a=i},function(e,t,n){e.exports=n(174)},function(e,t,n){var r;"undefined"!=typeof self&&self,e.exports=(r=n(0),function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t,n){var r=n(1);e.exports=n(8)(r.isElement,!0)},function(e,t,n){"use strict";e.exports=n(7)},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return"-"+e.toLowerCase()}var a=/[A-Z]/g,i=/^ms-/,o={};t.a=function(e){if(o.hasOwnProperty(e))return o[e];var t=e.replace(a,r);return o[e]=i.test(t)?"-"+t:t}},function(e,t,n){"use strict";function r(e){for(var t=1;t1?t-1:0),r=1;r2?n-2:0),a=2;a1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),r)},oneOfType:function(e){if(!Array.isArray(e))return a("Invalid argument supplied to oneOfType, expected an instance of array."),r;for(var t=0;t=y},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,a=e[r];if(!(void 0!==a&&0z(o,n))void 0!==c&&0>z(c,o)?(e[r]=c,e[s]=n,r=s):(e[r]=o,e[i]=n,r=i);else{if(!(void 0!==c&&0>z(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}return null}function z(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var k=[],O=[],S=1,N=null,D=3,E=!1,x=!1,Y=!1;function C(e){for(var t=T(O);null!==t;){if(null===t.callback)w(O);else{if(!(t.startTime<=e))break;w(O),t.sortIndex=t.expirationTime,A(k,t)}t=T(O)}}function W(e){if(Y=!1,C(e),!x)if(null!==T(k))x=!0,r(q);else{var t=T(O);null!==t&&a(W,t.startTime-e)}}function q(e,n){x=!1,Y&&(Y=!1,i()),E=!0;var r=D;try{for(C(n),N=T(k);null!==N&&(!(N.expirationTime>n)||e&&!t.unstable_shouldYield());){var o=N.callback;if("function"==typeof o){N.callback=null,D=N.priorityLevel;var s=o(N.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?N.callback=s:N===T(k)&&w(k),C(n)}else w(k);N=T(k)}if(null!==N)var c=!0;else{var u=T(O);null!==u&&a(W,u.startTime-n),c=!1}return c}finally{N=null,D=r,E=!1}}var R=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){x||E||(x=!0,r(q))},t.unstable_getCurrentPriorityLevel=function(){return D},t.unstable_getFirstCallbackNode=function(){return T(k)},t.unstable_next=function(e){switch(D){case 1:case 2:case 3:var t=3;break;default:t=D}var n=D;D=t;try{return e()}finally{D=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=R,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=D;D=e;try{return t()}finally{D=n}},t.unstable_scheduleCallback=function(e,n,o){var s=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0s?(e.sortIndex=o,A(O,e),null===T(k)&&e===T(O)&&(Y?i():Y=!0,a(W,o-s))):(e.sortIndex=c,A(k,e),x||E||(x=!0,r(q))),e},t.unstable_wrapCallback=function(e){var t=D;return function(){var n=D;D=t;try{return e.apply(this,arguments)}finally{D=n}}}},function(e,t,n){"use strict";var r=n(173);function a(){}function i(){}i.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,i,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:a};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){!function(e,t){"use strict";function n(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(a,i){var o=e.apply(t,r);function s(e){n(o,a,i,s,c,"next",e)}function c(e){n(o,a,i,s,c,"throw",e)}s(void 0)}))}}function a(){return(a=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}function o(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var s={init:"init"},c=function(e){var t=e.value;return void 0===t?"":t},u=function(){return t.createElement(t.Fragment,null," ")},l={Cell:c,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function d(){for(var e=arguments.length,t=new Array(e),n=0;n(i="number"==typeof i?i:1/0)){var o=a;a=i,i=o}return e.filter((function(e){return t.some((function(t){var n=e.values[t];return n>=a&&n<=i}))}))};Ae.autoRemove=function(e){return!e||"number"!=typeof e[0]&&"number"!=typeof e[1]};var Te=Object.freeze({__proto__:null,text:me,exactText:he,exactTextCase:Me,includes:_e,includesAll:be,includesSome:ge,includesValue:ye,exact:ve,equals:Le,between:Ae});s.resetFilters="resetFilters",s.setFilter="setFilter",s.setAllFilters="setAllFilters";var we=function(e){e.stateReducers.push(ze),e.useInstance.push(ke)};function ze(e,t,n,r){if(t.type===s.init)return a({filters:[]},e);if(t.type===s.resetFilters)return a({},e,{filters:r.initialState.filters||[]});if(t.type===s.setFilter){var i=t.columnId,o=t.filterValue,c=r.allColumns,u=r.filterTypes,l=c.find((function(e){return e.id===i}));if(!l)throw new Error("React-Table: Could not find a column with id: "+i);var d=E(l.filter,u||{},Te),f=e.filters.find((function(e){return e.id===i})),p=M(o,f&&f.value);return x(d.autoRemove,p,l)?a({},e,{filters:e.filters.filter((function(e){return e.id!==i}))}):a({},e,f?{filters:e.filters.map((function(e){return e.id===i?{id:i,value:p}:e}))}:{filters:[].concat(e.filters,[{id:i,value:p}])})}if(t.type===s.setAllFilters){var m=t.filters,h=r.allColumns,_=r.filterTypes;return a({},e,{filters:M(m,e.filters).filter((function(e){var t=h.find((function(t){return t.id===e.id}));return!x(E(t.filter,_||{},Te).autoRemove,e.value,t)}))})}}function ke(e){var n=e.data,r=e.rows,a=e.flatRows,i=e.rowsById,o=e.allColumns,c=e.filterTypes,u=e.manualFilters,l=e.defaultCanFilter,d=void 0!==l&&l,f=e.disableFilters,p=e.state.filters,m=e.dispatch,h=e.autoResetFilters,M=void 0===h||h,b=t.useCallback((function(e,t){m({type:s.setFilter,columnId:e,filterValue:t})}),[m]),y=t.useCallback((function(e){m({type:s.setAllFilters,filters:e})}),[m]);o.forEach((function(e){var t=e.id,n=e.accessor,r=e.defaultCanFilter,a=e.disableFilters;e.canFilter=n?O(!0!==a&&void 0,!0!==f&&void 0,!0):O(r,d,!1),e.setFilter=function(t){return b(e.id,t)};var i=p.find((function(e){return e.id===t}));e.filterValue=i&&i.value}));var v=t.useMemo((function(){if(u||!p.length)return[r,a,i];var e=[],t={};return[function n(r,a){void 0===a&&(a=0);var i=r;return(i=p.reduce((function(e,t){var n=t.id,r=t.value,i=o.find((function(e){return e.id===n}));if(!i)return e;0===a&&(i.preFilteredRows=e);var s=E(i.filter,c||{},Te);return s?(i.filteredRows=s(e,[n],r),i.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+i.id+"."),e)}),r)).forEach((function(r){e.push(r),t[r.id]=r,r.subRows&&(r.subRows=r.subRows&&r.subRows.length>0?n(r.subRows,a+1):r.subRows)})),i}(r),e,t]}),[u,p,r,a,i,o,c]),L=v[0],A=v[1],T=v[2];t.useMemo((function(){o.filter((function(e){return!p.find((function(t){return t.id===e.id}))})).forEach((function(e){e.preFilteredRows=L,e.filteredRows=L}))}),[L,p,o]);var w=_(M);g((function(){w()&&m({type:s.resetFilters})}),[m,u?null:n]),Object.assign(e,{preFilteredRows:r,preFilteredFlatRows:a,preFilteredRowsById:i,filteredRows:L,filteredFlatRows:A,filteredRowsById:T,rows:L,flatRows:A,rowsById:T,setFilter:b,setAllFilters:y})}we.pluginName="useFilters",s.resetGlobalFilter="resetGlobalFilter",s.setGlobalFilter="setGlobalFilter";var Oe=function(e){e.stateReducers.push(Se),e.useInstance.push(Ne)};function Se(e,t,n,r){if(t.type===s.resetGlobalFilter)return a({},e,{globalFilter:r.initialState.globalFilter||void 0});if(t.type===s.setGlobalFilter){var o=t.filterValue,c=r.userFilterTypes,u=E(r.globalFilter,c||{},Te),l=M(o,e.globalFilter);return x(u.autoRemove,l)?(e.globalFilter,i(e,["globalFilter"])):a({},e,{globalFilter:l})}}function Ne(e){var n=e.data,r=e.rows,a=e.flatRows,i=e.rowsById,o=e.allColumns,c=e.filterTypes,u=e.globalFilter,l=e.manualGlobalFilter,d=e.state.globalFilter,f=e.dispatch,p=e.autoResetGlobalFilter,m=void 0===p||p,h=e.disableGlobalFilter,M=t.useCallback((function(e){f({type:s.setGlobalFilter,filterValue:e})}),[f]),b=t.useMemo((function(){if(l||void 0===d)return[r,a,i];var e=[],t={},n=E(u,c||{},Te);if(!n)return console.warn("Could not find a valid 'globalFilter' option."),r;o.forEach((function(e){var t=e.disableGlobalFilter;e.canFilter=O(!0!==t&&void 0,!0!==h&&void 0,!0)}));var s=o.filter((function(e){return!0===e.canFilter}));return[function r(a){return(a=n(a,s.map((function(e){return e.id})),d)).forEach((function(n){e.push(n),t[n.id]=n,n.subRows=n.subRows&&n.subRows.length?r(n.subRows):n.subRows})),a}(r),e,t]}),[l,d,u,c,o,r,a,i,h]),y=b[0],v=b[1],L=b[2],A=_(m);g((function(){A()&&f({type:s.resetGlobalFilter})}),[f,l?null:n]),Object.assign(e,{preGlobalFilteredRows:r,preGlobalFilteredFlatRows:a,preGlobalFilteredRowsById:i,globalFilteredRows:y,globalFilteredFlatRows:v,globalFilteredRowsById:L,rows:y,flatRows:v,rowsById:L,setGlobalFilter:M,disableGlobalFilter:h})}function De(e,t){return t.reduce((function(e,t){return e+("number"==typeof t?t:0)}),0)}Oe.pluginName="useGlobalFilter";var Ee=Object.freeze({__proto__:null,sum:De,min:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e))})),t},max:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.max(t,e))})),t},minMax:function(e){var t=e[0]||0,n=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e),n=Math.max(n,e))})),t+".."+n},average:function(e){return De(0,e)/e.length},median:function(e){if(!e.length)return null;var t=Math.floor(e.length/2),n=[].concat(e).sort((function(e,t){return e-t}));return e.length%2!=0?n[t]:(n[t-1]+n[t])/2},unique:function(e){return Array.from(new Set(e).values())},uniqueCount:function(e){return new Set(e).size},count:function(e){return e.length}}),xe=[],Ye={};s.resetGroupBy="resetGroupBy",s.setGroupBy="setGroupBy",s.toggleGroupBy="toggleGroupBy";var Ce=function(e){e.getGroupByToggleProps=[We],e.stateReducers.push(qe),e.visibleColumnsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.groupBy])})),e.visibleColumns.push(Re),e.useInstance.push(je),e.prepareRow.push(Be)};Ce.pluginName="useGroupBy";var We=function(e,t){var n=t.header;return[e,{onClick:n.canGroupBy?function(e){e.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function qe(e,t,n,r){if(t.type===s.init)return a({groupBy:[]},e);if(t.type===s.resetGroupBy)return a({},e,{groupBy:r.initialState.groupBy||[]});if(t.type===s.setGroupBy)return a({},e,{groupBy:t.value});if(t.type===s.toggleGroupBy){var i=t.columnId,o=t.value,c=void 0!==o?o:!e.groupBy.includes(i);return a({},e,c?{groupBy:[].concat(e.groupBy,[i])}:{groupBy:e.groupBy.filter((function(e){return e!==i}))})}}function Re(e,t){var n=t.instance.state.groupBy,r=n.map((function(t){return e.find((function(e){return e.id===t}))})).filter(Boolean),a=e.filter((function(e){return!n.includes(e.id)}));return(e=[].concat(r,a)).forEach((function(e){e.isGrouped=n.includes(e.id),e.groupedIndex=n.indexOf(e.id)})),e}var Pe={};function je(e){var n=e.data,r=e.rows,a=e.flatRows,i=e.rowsById,o=e.allColumns,c=e.flatHeaders,u=e.groupByFn,l=void 0===u?He:u,d=e.manualGroupBy,p=e.aggregations,m=void 0===p?Pe:p,M=e.plugins,b=e.state.groupBy,y=e.dispatch,v=e.autoResetGroupBy,L=void 0===v||v,A=e.disableGroupBy,T=e.defaultCanGroupBy,w=e.getHooks;h(M,["useColumnOrder","useFilters"],"useGroupBy");var z=_(e);o.forEach((function(t){var n=t.accessor,r=t.defaultGroupBy,a=t.disableGroupBy;t.canGroupBy=n?O(t.canGroupBy,!0!==a&&void 0,!0!==A&&void 0,!0):O(t.canGroupBy,r,T,!1),t.canGroupBy&&(t.toggleGroupBy=function(){return e.toggleGroupBy(t.id)}),t.Aggregated=t.Aggregated||t.Cell}));var k=t.useCallback((function(e,t){y({type:s.toggleGroupBy,columnId:e,value:t})}),[y]),S=t.useCallback((function(e){y({type:s.setGroupBy,value:e})}),[y]);c.forEach((function(e){e.getGroupByToggleProps=f(w().getGroupByToggleProps,{instance:z(),header:e})}));var D=t.useMemo((function(){if(d||!b.length)return[r,a,i,xe,Ye,a,i];var e=b.filter((function(e){return o.find((function(t){return t.id===e}))})),t=[],n={},s=[],c={},u=[],f={},p=function r(a,i,d){if(void 0===i&&(i=0),i===e.length)return a;var p=e[i],h=l(a,p);return Object.entries(h).map((function(a,l){var h=a[0],M=a[1],_=p+":"+h,b=r(M,i+1,_=d?d+">"+_:_),g=i?N(M,"leafRows"):M,y=function(t,n,r){var a={};return o.forEach((function(i){if(e.includes(i.id))a[i.id]=n[0]?n[0].values[i.id]:null;else{var o="function"==typeof i.aggregate?i.aggregate:m[i.aggregate]||Ee[i.aggregate];if(o){var s=n.map((function(e){return e.values[i.id]})),c=t.map((function(e){var t=e.values[i.id];if(!r&&i.aggregateValue){var n="function"==typeof i.aggregateValue?i.aggregateValue:m[i.aggregateValue]||Ee[i.aggregateValue];if(!n)throw console.info({column:i}),new Error("React Table: Invalid column.aggregateValue option for column listed above");t=n(t,e,i)}return t}));a[i.id]=o(c,s)}else{if(i.aggregate)throw console.info({column:i}),new Error("React Table: Invalid column.aggregate option for column listed above");a[i.id]=null}}})),a}(g,M,i),v={id:_,isGrouped:!0,groupByID:p,groupByVal:h,values:y,subRows:b,leafRows:g,depth:i,index:l};return b.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),c[e.id]=e):(u.push(e),f[e.id]=e)})),v}))}(r);return p.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),c[e.id]=e):(u.push(e),f[e.id]=e)})),[p,t,n,s,c,u,f]}),[d,b,r,a,i,o,m,l]),E=D[0],x=D[1],Y=D[2],C=D[3],W=D[4],q=D[5],R=D[6],P=_(L);g((function(){P()&&y({type:s.resetGroupBy})}),[y,d?null:n]),Object.assign(e,{preGroupedRows:r,preGroupedFlatRow:a,preGroupedRowsById:i,groupedRows:E,groupedFlatRows:x,groupedRowsById:Y,onlyGroupedFlatRows:C,onlyGroupedRowsById:W,nonGroupedFlatRows:q,nonGroupedRowsById:R,rows:E,flatRows:x,rowsById:Y,toggleGroupBy:k,setGroupBy:S})}function Be(e){e.allCells.forEach((function(t){var n;t.isGrouped=t.column.isGrouped&&t.column.id===e.groupByID,t.isPlaceholder=!t.isGrouped&&t.column.isGrouped,t.isAggregated=!t.isGrouped&&!t.isPlaceholder&&(null==(n=e.subRows)?void 0:n.length)}))}function He(e,t){return e.reduce((function(e,n,r){var a=""+n.values[t];return e[a]=Array.isArray(e[a])?e[a]:[],e[a].push(n),e}),{})}var Xe=/([0-9]+)/gm;function Fe(e,t){return e===t?0:e>t?1:-1}function Ie(e,t){return e.values[t]}function Ue(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}var Ve=Object.freeze({__proto__:null,alphanumeric:function(e,t,n){var r=Ie(e,n),a=Ie(t,n);for(r=Ue(r),a=Ue(a),r=r.split(Xe).filter(Boolean),a=a.split(Xe).filter(Boolean);r.length&&a.length;){var i=r.shift(),o=a.shift(),s=parseInt(i,10),c=parseInt(o,10),u=[s,c].sort();if(isNaN(u[0])){if(i>o)return 1;if(o>i)return-1}else{if(isNaN(u[1]))return isNaN(s)?-1:1;if(s>c)return 1;if(c>s)return-1}}return r.length-a.length},datetime:function(e,t,n){var r=Ie(e,n),a=Ie(t,n);return Fe(r=r.getTime(),a=a.getTime())},basic:function(e,t,n){return Fe(Ie(e,n),Ie(t,n))}});s.resetSortBy="resetSortBy",s.setSortBy="setSortBy",s.toggleSortBy="toggleSortBy",s.clearSortBy="clearSortBy",l.sortType="alphanumeric",l.sortDescFirst=!1;var $e=function(e){e.getSortByToggleProps=[Ge],e.stateReducers.push(Je),e.useInstance.push(Ke)};$e.pluginName="useSortBy";var Ge=function(e,t){var n=t.instance,r=t.column,a=n.isMultiSortEvent,i=void 0===a?function(e){return e.shiftKey}:a;return[e,{onClick:r.canSort?function(e){e.persist(),r.toggleSortBy(void 0,!n.disableMultiSort&&i(e))}:void 0,style:{cursor:r.canSort?"pointer":void 0},title:r.canSort?"Toggle SortBy":void 0}]};function Je(e,t,n,r){if(t.type===s.init)return a({sortBy:[]},e);if(t.type===s.resetSortBy)return a({},e,{sortBy:r.initialState.sortBy||[]});if(t.type===s.clearSortBy)return a({},e,{sortBy:e.sortBy.filter((function(e){return e.id!==t.columnId}))});if(t.type===s.setSortBy)return a({},e,{sortBy:t.sortBy});if(t.type===s.toggleSortBy){var i,o=t.columnId,c=t.desc,u=t.multi,l=r.allColumns,d=r.disableMultiSort,f=r.disableSortRemove,p=r.disableMultiRemove,m=r.maxMultiSortColCount,h=void 0===m?Number.MAX_SAFE_INTEGER:m,M=e.sortBy,_=l.find((function(e){return e.id===o})).sortDescFirst,b=M.find((function(e){return e.id===o})),g=M.findIndex((function(e){return e.id===o})),y=null!=c,v=[];return"toggle"!=(i=!d&&u?b?"toggle":"add":g!==M.length-1||1!==M.length?"replace":b?"toggle":"replace")||f||y||u&&p||!(b&&b.desc&&!_||!b.desc&&_)||(i="remove"),"replace"===i?v=[{id:o,desc:y?c:_}]:"add"===i?(v=[].concat(M,[{id:o,desc:y?c:_}])).splice(0,v.length-h):"toggle"===i?v=M.map((function(e){return e.id===o?a({},e,{desc:y?c:!b.desc}):e})):"remove"===i&&(v=M.filter((function(e){return e.id!==o}))),a({},e,{sortBy:v})}}function Ke(e){var n=e.data,r=e.rows,a=e.flatRows,i=e.allColumns,o=e.orderByFn,c=void 0===o?Qe:o,u=e.sortTypes,l=e.manualSortBy,d=e.defaultCanSort,p=e.disableSortBy,m=e.flatHeaders,M=e.state.sortBy,b=e.dispatch,y=e.plugins,v=e.getHooks,L=e.autoResetSortBy,A=void 0===L||L;h(y,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var T=t.useCallback((function(e){b({type:s.setSortBy,sortBy:e})}),[b]),w=t.useCallback((function(e,t,n){b({type:s.toggleSortBy,columnId:e,desc:t,multi:n})}),[b]),z=_(e);m.forEach((function(e){var t=e.accessor,n=e.canSort,r=e.disableSortBy,a=e.id,i=t?O(!0!==r&&void 0,!0!==p&&void 0,!0):O(d,n,!1);e.canSort=i,e.canSort&&(e.toggleSortBy=function(t,n){return w(e.id,t,n)},e.clearSortBy=function(){b({type:s.clearSortBy,columnId:e.id})}),e.getSortByToggleProps=f(v().getSortByToggleProps,{instance:z(),column:e});var o=M.find((function(e){return e.id===a}));e.isSorted=!!o,e.sortedIndex=M.findIndex((function(e){return e.id===a})),e.isSortedDesc=e.isSorted?o.desc:void 0}));var k=t.useMemo((function(){if(l||!M.length)return[r,a];var e=[],t=M.filter((function(e){return i.find((function(t){return t.id===e.id}))}));return[function n(r){var a=c(r,t.map((function(e){var t=i.find((function(t){return t.id===e.id}));if(!t)throw new Error("React-Table: Could not find a column with id: "+e.id+" while sorting");var n=t.sortType,r=S(n)||(u||{})[n]||Ve[n];if(!r)throw new Error("React-Table: Could not find a valid sortType of '"+n+"' for column '"+e.id+"'.");return function(t,n){return r(t,n,e.id,e.desc)}})),t.map((function(e){var t=i.find((function(t){return t.id===e.id}));return t&&t.sortInverted?e.desc:!e.desc})));return a.forEach((function(t){e.push(t),t.subRows&&0!==t.subRows.length&&(t.subRows=n(t.subRows))})),a}(r),e]}),[l,M,r,a,i,c,u]),N=k[0],D=k[1],E=_(A);g((function(){E()&&b({type:s.resetSortBy})}),[l?null:n]),Object.assign(e,{preSortedRows:r,preSortedFlatRows:a,sortedRows:N,sortedFlatRows:D,rows:N,flatRows:D,setSortBy:T,toggleSortBy:w})}function Qe(e,t,n){return[].concat(e).sort((function(e,r){for(var a=0;ae.pageIndex?u=-1===i?o.length>=e.pageSize:c-1),u?a({},e,{pageIndex:c}):e}if(t.type===s.setPageSize){var l=t.pageSize,d=e.pageSize*e.pageIndex;return a({},e,{pageIndex:Math.floor(d/l),pageSize:l})}}function tt(e){var n=e.rows,r=e.autoResetPage,a=void 0===r||r,i=e.manualExpandedKey,o=void 0===i?"expanded":i,c=e.plugins,u=e.pageCount,l=e.paginateExpandedRows,d=void 0===l||l,f=e.expandSubRows,p=void 0===f||f,m=e.state,M=m.pageSize,b=m.pageIndex,y=m.expanded,v=m.globalFilter,L=m.filters,A=m.groupBy,T=m.sortBy,w=e.dispatch,z=e.data,k=e.manualPagination;h(c,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var O=_(a);g((function(){O()&&w({type:s.resetPage})}),[w,k?null:z,v,L,A,T]);var S=k?u:Math.ceil(n.length/M),N=t.useMemo((function(){return S>0?[].concat(new Array(S)).fill(null).map((function(e,t){return t})):[]}),[S]),E=t.useMemo((function(){var e;if(k)e=n;else{var t=M*b,r=t+M;e=n.slice(t,r)}return d?e:D(e,{manualExpandedKey:o,expanded:y,expandSubRows:p})}),[p,y,o,k,b,M,d,n]),x=b>0,Y=-1===S?E.length>=M:b-1&&i.push(a.splice(t,1)[0])};a.length&&r.length;)o();return[].concat(i,a)}function Dt(e){var n=e.dispatch;e.setColumnOrder=t.useCallback((function(e){return n({type:s.setColumnOrder,columnOrder:e})}),[n])}Ot.pluginName="useColumnOrder",l.canResize=!0,s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize";var Et=function(e){e.getResizerProps=[xt],e.getHeaderProps.push({style:{position:"relative"}}),e.stateReducers.push(Yt),e.useInstance.push(Wt),e.useInstanceBeforeDimensions.push(Ct)},xt=function(e,t){var n=t.instance,r=t.header,a=n.dispatch,i=function(e,t){var n=!1;if("touchstart"===e.type){if(e.touches&&e.touches.length>1)return;n=!0}var r=function(e){var t=[];return function e(n){n.columns&&n.columns.length&&n.columns.map(e),t.push(n)}(e),t}(t).map((function(e){return[e.id,e.totalWidth]})),i=n?Math.round(e.touches[0].clientX):e.clientX,o=function(e){a({type:s.columnResizing,clientX:e})},c=function(){return a({type:s.columnDoneResizing})},u={mouse:{moveEvent:"mousemove",moveHandler:function(e){return o(e.clientX)},upEvent:"mouseup",upHandler:function(e){document.removeEventListener("mousemove",u.mouse.moveHandler),document.removeEventListener("mouseup",u.mouse.upHandler),c()}},touch:{moveEvent:"touchmove",moveHandler:function(e){return e.cancelable&&(e.preventDefault(),e.stopPropagation()),o(e.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(e){document.removeEventListener(u.touch.moveEvent,u.touch.moveHandler),document.removeEventListener(u.touch.upEvent,u.touch.moveHandler),c()}}},l=n?u.touch:u.mouse,d=!!function(){if("boolean"==typeof C)return C;var e=!1;try{var t={get passive(){return e=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){e=!1}return C=e}()&&{passive:!1};document.addEventListener(l.moveEvent,l.moveHandler,d),document.addEventListener(l.upEvent,l.upHandler,d),a({type:s.columnStartResizing,columnId:t.id,columnWidth:t.totalWidth,headerIdWidths:r,clientX:i})};return[e,{onMouseDown:function(e){return e.persist()||i(e,r)},onTouchStart:function(e){return e.persist()||i(e,r)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function Yt(e,t){if(t.type===s.init)return a({columnResizing:{columnWidths:{}}},e);if(t.type===s.resetResize)return a({},e,{columnResizing:{columnWidths:{}}});if(t.type===s.columnStartResizing){var n=t.clientX,r=t.columnId,i=t.columnWidth,o=t.headerIdWidths;return a({},e,{columnResizing:a({},e.columnResizing,{startX:n,headerIdWidths:o,columnWidth:i,isResizingColumn:r})})}if(t.type===s.columnResizing){var c=t.clientX,u=e.columnResizing,l=u.startX,d=u.columnWidth,f=u.headerIdWidths,p=(c-l)/d,m={};return(void 0===f?[]:f).forEach((function(e){var t=e[0],n=e[1];m[t]=Math.max(n+n*p,0)})),a({},e,{columnResizing:a({},e.columnResizing,{columnWidths:a({},e.columnResizing.columnWidths,{},m)})})}return t.type===s.columnDoneResizing?a({},e,{columnResizing:a({},e.columnResizing,{startX:null,isResizingColumn:null})}):void 0}Et.pluginName="useResizeColumns";var Ct=function(e){var t=e.flatHeaders,n=e.disableResizing,r=e.getHooks,a=e.state.columnResizing,i=_(e);t.forEach((function(e){var t=O(!0!==e.disableResizing&&void 0,!0!==n&&void 0,!0);e.canResize=t,e.width=a.columnWidths[e.id]||e.originalWidth||e.width,e.isResizing=a.isResizingColumn===e.id,t&&(e.getResizerProps=f(r().getResizerProps,{instance:i(),header:e}))}))};function Wt(e){var n=e.plugins,r=e.dispatch,a=e.autoResetResize,i=void 0===a||a,o=e.columns;h(n,["useAbsoluteLayout"],"useResizeColumns");var c=_(i);g((function(){c()&&r({type:s.resetResize})}),[o]);var u=t.useCallback((function(){return r({type:s.resetResize})}),[r]);Object.assign(e,{resetResizing:u})}var qt={position:"absolute",top:0},Rt=function(e){e.getTableBodyProps.push(Pt),e.getRowProps.push(Pt),e.getHeaderGroupProps.push(Pt),e.getFooterGroupProps.push(Pt),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:a({},qt,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:a({},qt,{left:n.column.totalLeft+"px",width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:a({},qt,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]}))};Rt.pluginName="useAbsoluteLayout";var Pt=function(e,t){return[e,{style:{position:"relative",width:t.instance.totalColumnsWidth+"px"}}]},jt={display:"inline-block",boxSizing:"border-box"},Bt=function(e,t){return[e,{style:{display:"flex",width:t.instance.totalColumnsWidth+"px"}}]},Ht=function(e){e.getRowProps.push(Bt),e.getHeaderGroupProps.push(Bt),e.getFooterGroupProps.push(Bt),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:a({},jt,{width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:a({},jt,{width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:a({},jt,{width:n.totalWidth+"px"})}]}))};function Xt(e){e.getTableProps.push(Ft),e.getRowProps.push(It),e.getHeaderGroupProps.push(It),e.getFooterGroupProps.push(It),e.getHeaderProps.push(Ut),e.getCellProps.push(Vt),e.getFooterProps.push($t)}Ht.pluginName="useBlockLayout",Xt.pluginName="useFlexLayout";var Ft=function(e,t){return[e,{style:{minWidth:t.instance.totalColumnsMinWidth+"px"}}]},It=function(e,t){return[e,{style:{display:"flex",flex:"1 0 auto",minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Ut=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},Vt=function(e,t){var n=t.cell;return[e,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},$t=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};function Gt(e){e.stateReducers.push(Qt),e.getTableProps.push(Jt),e.getHeaderProps.push(Kt)}Gt.pluginName="useGridLayout";var Jt=function(e,t){return[e,{style:{display:"grid",gridTemplateColumns:t.instance.state.gridLayout.columnWidths.map((function(e){return e})).join(" ")}}]},Kt=function(e,t){return[e,{id:"header-cell-"+t.column.id,style:{position:"sticky"}}]};function Qt(e,t,n,r){if("init"===t.type)return a({gridLayout:{columnWidths:r.columns.map((function(){return"auto"}))}},e);if("columnStartResizing"===t.type){var i=t.columnId,o=r.visibleColumns.findIndex((function(e){return e.id===i})),s=function(e){var t,n=null==(t=document.getElementById("header-cell-"+e))?void 0:t.offsetWidth;if(void 0!==n)return n}(i);return void 0!==s?a({},e,{gridLayout:a({},e.gridLayout,{columnId:i,columnIndex:o,startingWidth:s})}):e}if("columnResizing"===t.type){var c=e.gridLayout,u=c.columnIndex,l=c.startingWidth,d=c.columnWidths,f=l-(e.columnResizing.startX-t.clientX),p=[].concat(d);return p[u]=f+"px",a({},e,{gridLayout:a({},e.gridLayout,{columnWidths:p})})}}e._UNSTABLE_usePivotColumns=nt,e.actions=s,e.defaultColumn=l,e.defaultGroupByFn=He,e.defaultOrderByFn=Qe,e.defaultRenderer=c,e.emptyRenderer=u,e.ensurePluginOrder=h,e.flexRender=v,e.functionalUpdate=M,e.loopHooks=m,e.makePropGetter=f,e.makeRenderer=y,e.reduceHooks=p,e.safeUseLayoutEffect=b,e.useAbsoluteLayout=Rt,e.useAsyncDebounce=function(e,n){void 0===n&&(n=0);var a=t.useRef({}),i=_(e),o=_(n);return t.useCallback(function(){var e=r(regeneratorRuntime.mark((function e(){var t,n,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=c.length,n=new Array(t),s=0;s1?n-1:0),i=1;i>",s=i||n;if(null==t[n])return new Error("The "+a+" `"+s+"` is required to make `"+o+"` accessible for users of assistive technologies such as screen readers.");for(var c=arguments.length,u=Array(c>5?c-5:0),l=5;l'.concat(_.escape(n),":\n").concat(e))}},{key:"response",value:function(e){return this.responseEditorController.response(e)}},{key:"responseChanged",value:function(){var e=this.savedResponse;return this.response().some((function(t,n){return t!==e[n]}))}},{key:"autoSave",value:function(){var e=Date.now()-this.lastChangeTime;this.responseChanged()&&e>this.AUTO_SAVE_WAIT&&!this.errorOnLastSave&&this.save()}},{key:"handleResponseChanged",value:function(){if(this.checkSubmissionAbility(),this.responseChanged()){var e=this.checkSaveAbility();this.saveEnabled(e),this.previewEnabled(e),this.saveStatus(gettext("This response has not been saved.")),this.baseView.unsavedWarningEnabled(!0,this.UNSAVED_WARNING_KEY,gettext("If you leave this page without saving or submitting your response, you will lose any work you have done on the response."))}this.lastChangeTime=Date.now()}},{key:"save",value:function(){this.errorOnLastSave=!1,this.saveStatus(gettext("Saving...")),this.baseView.toggleActionError("save",null),this.baseView.unsavedWarningEnabled(!1,this.UNSAVED_WARNING_KEY);var e=this,t=this.response();this.server.save(t).done((function(){if(e.savedResponse=t,e.checkSubmissionAbility(),e.response().every((function(e,n){return e===t[n]}))){e.saveEnabled(!1);var n=gettext("This response has been saved but not submitted.");e.saveStatus(n),e.baseView.srReadTexts([n])}})).fail((function(t){e.saveStatus(gettext("Error")),e.baseView.toggleActionError("save",t),e.errorOnLastSave=!0}))}},{key:"handleSubmitClicked",value:function(){if(this.submitEnabled(!1),!this.hasPendingUploadFiles()){var e=this,t=gettext("Confirm Submit Response"),n=gettext("You're about to submit your response for this assignment. After you submit this response, you can't change it or submit a new response.");this.confirmationDialog.confirm(t,n,(function(){return e.submit()}),(function(){return e.submitEnabled(!0)}))}}},{key:"submit",value:function(){var e=this,t=this.response();this.baseView.toggleActionError("response",null),this.server.submit(t).done((function(){e.moveToNextStep()})).fail((function(t,n){"ENOMULTI"===t?e.moveToNextStep():(n&&e.baseView.toggleActionError("submit",n),e.submitEnabled(!0))}))}},{key:"moveToNextStep",value:function(){var e=this.baseView,t=e.getUsageID();this.load(t),e.loadAssessmentModules(t),this.announceStatus=!0,e.unsavedWarningEnabled(!1,this.UNSAVED_WARNING_KEY)}},{key:"prepareUpload",value:function(e,t,n){this.files=null,this.filesType=t,this.filesUploaded=!1;for(var r=!1,a=0;athis.MAX_FILE_SIZE){this.baseView.toggleActionError("upload",gettext("Individual file size must be {max_files_mb}MB or less.").replace("{max_files_mb}",this.MAX_FILES_MB)),r=!0;break}if(!this.isUploadSupported(e[a],t)){this.baseView.toggleActionError("upload",gettext("File upload failed: unsupported file type. Only the supported file types can be uploaded. If you have questions, please reach out to the course team.")),r=!0;break}}if(this.getSavedFileCount(!1)+e.length>this.data.MAXIMUM_FILE_UPLOAD_COUNT){var i=gettext("Only ".concat(this.data.MAXIMUM_FILE_UPLOAD_COUNT," files can be saved."));this.baseView.toggleActionError("upload",gettext(i)),r=!0}r||(this.baseView.toggleActionError("upload",null),e.length>0&&(this.files=e),this.updateFilesDescriptionsFields(e,n,t)),null===this.files&&$(this.element).find(".file__upload").prop("disabled",!0)}},{key:"updateFilesDescriptionsFields",value:function(e,t,n){var r=$(this.element).find(".files__descriptions").first(),a=null,i=null,o=null,s=null,c=null,u=null,l=!0;this.filesDescriptions=t||[],this.fileNames=[],$(r).show().html("");for(var d=0;d"),(i=$("
    ")).addClass("submission__file__description__label"),i.text("".concat(gettext("Describe ")+e[d].name," ").concat(gettext("(required):"))),i.appendTo(a),(o=$("
    ")).addClass("submission__file__description"),u=$("",p.noCloneChecked=!!te.cloneNode(!0).lastChild.defaultValue;var se=/^key/,oe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ae=/^([^.]*)(?:\.(.+)|)/;function ue(){return!0}function le(){return!1}function ce(){try{return o.activeElement}catch(e){}}function de(e,t,n,i,r,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)de(e,a,n,i,t[a],s);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=le;else if(!r)return e;return 1===s&&(o=r,(r=function(e){return m().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=m.guid++)),e.each((function(){m.event.add(this,t,r,i,n)}))}m.event={global:{},add:function(e,t,n,i,r){var s,o,a,u,l,c,d,h,f,p,v,g=L.get(e);if(g)for(n.handler&&(n=(s=n).handler,r=s.selector),n.guid||(n.guid=m.guid++),(u=g.events)||(u=g.events={}),(o=g.handle)||(o=g.handle=function(t){return void 0!==m&&m.event.triggered!==t.type?m.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(O)||[""]).length;l--;)f=v=(a=ae.exec(t[l])||[])[1],p=(a[2]||"").split(".").sort(),f&&(d=m.event.special[f]||{},f=(r?d.delegateType:d.bindType)||f,d=m.event.special[f]||{},c=m.extend({type:f,origType:v,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&m.expr.match.needsContext.test(r),namespace:p.join(".")},s),(h=u[f])||((h=u[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,i,p,o)||e.addEventListener&&e.addEventListener(f,o)),d.add&&(d.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,c):h.push(c),m.event.global[f]=!0)},remove:function(e,t,n,i,r){var s,o,a,u,l,c,d,h,f,p,v,g=L.hasData(e)&&L.get(e);if(g&&(u=g.events)){for(l=(t=(t||"").match(O)||[""]).length;l--;)if(f=v=(a=ae.exec(t[l])||[])[1],p=(a[2]||"").split(".").sort(),f){for(d=m.event.special[f]||{},h=u[f=(i?d.delegateType:d.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;s--;)c=h[s],!r&&v!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(h.splice(s,1),c.selector&&h.delegateCount--,d.remove&&d.remove.call(e,c));o&&!h.length&&(d.teardown&&!1!==d.teardown.call(e,p,g.handle)||m.removeEvent(e,f,g.handle),delete u[f])}else for(f in u)m.event.remove(e,f+t[l],n,i,!0);m.isEmptyObject(u)&&L.remove(e,"handle events")}},dispatch:function(e){e=m.event.fix(e);var t,n,i,r,s,o=[],u=a.call(arguments),l=(L.get(this,"events")||{})[e.type]||[],c=m.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(o=m.event.handlers.call(this,e,l),t=0;(r=o[t++])&&!e.isPropagationStopped();)for(e.currentTarget=r.elem,n=0;(s=r.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(s.namespace)||(e.handleObj=s,e.data=s.data,void 0!==(i=((m.event.special[s.origType]||{}).handle||s.handler).apply(r.elem,u))&&!1===(e.result=i)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,i,r,s,o=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&(!0!==u.disabled||"click"!==e.type)){for(i=[],n=0;n-1:m.find(r,this,null,[u]).length),i[r]&&i.push(s);i.length&&o.push({elem:u,handlers:i})}return a]*)\/>/gi,fe=/\s*$/g;function ge(e,t){return m.nodeName(e,"table")&&m.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ye(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function be(e){var t=me.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _e(e,t){var n,i,r,s,o,a,u,l;if(1===t.nodeType){if(L.hasData(e)&&(s=L.access(e),o=L.set(t,s),l=s.events))for(r in delete o.handle,o.events={},l)for(n=0,i=l[r].length;n1&&"string"==typeof v&&!p.checkClone&&pe.test(v))return e.each((function(r){var s=e.eq(r);g&&(t[0]=v.call(this,r,s.html())),xe(s,t,n,i)}));if(h&&(s=(r=re(t,e[0].ownerDocument,!1,e,i)).firstChild,1===r.childNodes.length&&(r=s),s||i)){for(a=(o=m.map(Z(r,"script"),ye)).length;d")},clone:function(e,t,n){var i,r,s,o,a,u,l,c=e.cloneNode(!0),d=m.contains(e.ownerDocument,e);if(!(p.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||m.isXMLDoc(e)))for(o=Z(c),i=0,r=(s=Z(e)).length;i0&&ee(o,!d&&Z(e,"script")),c},cleanData:function(e){for(var t,n,i,r=m.event.special,s=0;void 0!==(n=e[s]);s++)if(P(n)){if(t=n[L.expando]){if(t.events)for(i in t.events)r[i]?m.event.remove(n,i):m.removeEvent(n,i,t.handle);n[L.expando]=void 0}n[M.expando]&&(n[M.expando]=void 0)}}}),m.fn.extend({domManip:xe,detach:function(e){return we(this,e,!0)},remove:function(e){return we(this,e)},text:function(e){return F(this,(function(e){return void 0===e?m.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return xe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||ge(this,e).appendChild(e)}))},prepend:function(){return xe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=ge(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(m.cleanData(Z(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return m.clone(this,e,t)}))},html:function(e){return F(this,(function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!fe.test(e)&&!Q[(Y.exec(e)||["",""])[1].toLowerCase()]){e=m.htmlPrefilter(e);try{for(;n")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),n=Ce(e,t),ke.detach()),Ee[e]=n),n}var $e=/^margin/,Se=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),Ae=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=n),t.getComputedStyle(e)},Ne=function(e,t,n,i){var r,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];for(s in r=n.apply(e,i||[]),t)e.style[s]=o[s];return r},je=o.documentElement;function De(e,t,n){var i,r,s,o,a=e.style;return""!==(o=(n=n||Ae(e))?n.getPropertyValue(t)||n[t]:void 0)&&void 0!==o||m.contains(e.ownerDocument,e)||(o=m.style(e,t)),n&&!p.pixelMarginRight()&&Se.test(o)&&$e.test(t)&&(i=a.width,r=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=o,o=n.width,a.width=i,a.minWidth=r,a.maxWidth=s),void 0!==o?o+"":o}function Re(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){var e,t,i,r,s=o.createElement("div"),a=o.createElement("div");function u(){a.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",a.innerHTML="",je.appendChild(s);var o=n.getComputedStyle(a);e="1%"!==o.top,r="2px"===o.marginLeft,t="4px"===o.width,a.style.marginRight="50%",i="4px"===o.marginRight,je.removeChild(s)}a.style&&(a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",p.clearCloneStyle="content-box"===a.style.backgroundClip,s.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",s.appendChild(a),m.extend(p,{pixelPosition:function(){return u(),e},boxSizingReliable:function(){return null==t&&u(),t},pixelMarginRight:function(){return null==t&&u(),i},reliableMarginLeft:function(){return null==t&&u(),r},reliableMarginRight:function(){var e,t=a.appendChild(o.createElement("div"));return t.style.cssText=a.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",a.style.width="1px",je.appendChild(s),e=!parseFloat(n.getComputedStyle(t).marginRight),je.removeChild(s),a.removeChild(t),e}}))}();var Oe=/^(none|table(?!-c[ea]).+)/,Ie={position:"absolute",visibility:"hidden",display:"block"},Fe={letterSpacing:"0",fontWeight:"400"},Pe=["Webkit","O","Moz","ms"],He=o.createElement("div").style;function Le(e){if(e in He)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=Pe.length;n--;)if((e=Pe[n]+t)in He)return e}function Me(e,t,n){var i=U.exec(t);return i?Math.max(0,i[2]-(n||0))+(i[3]||"px"):t}function Ve(e,t,n,i,r){for(var s=n===(i?"border":"content")?4:"width"===t?1:0,o=0;s<4;s+=2)"margin"===n&&(o+=m.css(e,n+z[s],!0,r)),i?("content"===n&&(o-=m.css(e,"padding"+z[s],!0,r)),"margin"!==n&&(o-=m.css(e,"border"+z[s]+"Width",!0,r))):(o+=m.css(e,"padding"+z[s],!0,r),"padding"!==n&&(o+=m.css(e,"border"+z[s]+"Width",!0,r)));return o}function We(e,t,n){var i=!0,r="width"===t?e.offsetWidth:e.offsetHeight,s=Ae(e),o="border-box"===m.css(e,"boxSizing",!1,s);if(r<=0||null==r){if(((r=De(e,t,s))<0||null==r)&&(r=e.style[t]),Se.test(r))return r;i=o&&(p.boxSizingReliable()||r===e.style[t]),r=parseFloat(r)||0}return r+Ve(e,t,n||(o?"border":"content"),i,s)+"px"}function Be(e,t){for(var n,i,r,s=[],o=0,a=e.length;o1)},show:function(){return Be(this,!0)},hide:function(){return Be(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){G(this)?m(this).show():m(this).hide()}))}}),m.Tween=qe,qe.prototype={constructor:qe,init:function(e,t,n,i,r,s){this.elem=e,this.prop=n,this.easing=r||m.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=s||(m.cssNumber[n]?"":"px")},cur:function(){var e=qe.propHooks[this.prop];return e&&e.get?e.get(this):qe.propHooks._default.get(this)},run:function(e){var t,n=qe.propHooks[this.prop];return this.options.duration?this.pos=t=m.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):qe.propHooks._default.set(this),this}},qe.prototype.init.prototype=qe.prototype,qe.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=m.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){m.fx.step[e.prop]?m.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[m.cssProps[e.prop]]&&!m.cssHooks[e.prop]?e.elem[e.prop]=e.now:m.style(e.elem,e.prop,e.now+e.unit)}}},qe.propHooks.scrollTop=qe.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},m.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},m.fx=qe.prototype.init,m.fx.step={};var Ue,ze,Ge=/^(?:toggle|show|hide)$/,Je=/queueHooks$/;function Xe(){return n.setTimeout((function(){Ue=void 0})),Ue=m.now()}function Ye(e,t){var n,i=0,r={height:e};for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=z[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Ke(e,t,n){for(var i,r=(Qe.tweeners[t]||[]).concat(Qe.tweeners["*"]),s=0,o=r.length;s1)},removeAttr:function(e){return this.each((function(){m.removeAttr(this,e)}))}}),m.extend({attr:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===e.getAttribute?m.prop(e,t,n):(1===s&&m.isXMLDoc(e)||(t=t.toLowerCase(),r=m.attrHooks[t]||(m.expr.match.bool.test(t)?Ze:void 0)),void 0!==n?null===n?void m.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=m.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!p.radioValue&&"radio"===t&&m.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i,r=0,s=t&&t.match(O);if(s&&1===e.nodeType)for(;n=s[r++];)i=m.propFix[n]||n,m.expr.match.bool.test(n)&&(e[i]=!1),e.removeAttribute(n)}}),Ze={set:function(e,t,n){return!1===t?m.removeAttr(e,n):e.setAttribute(n,n),n}},m.each(m.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=et[t]||m.find.attr;et[t]=function(e,t,i){var r,s;return i||(s=et[t],et[t]=r,r=null!=n(e,t,i)?t.toLowerCase():null,et[t]=s),r}}));var tt=/^(?:input|select|textarea|button)$/i,nt=/^(?:a|area)$/i;m.fn.extend({prop:function(e,t){return F(this,m.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[m.propFix[e]||e]}))}}),m.extend({prop:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&m.isXMLDoc(e)||(t=m.propFix[t]||t,r=m.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=m.find.attr(e,"tabindex");return t?parseInt(t,10):tt.test(e.nodeName)||nt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),p.optSelected||(m.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){m.propFix[this.toLowerCase()]=this}));var it=/[\t\r\n\f]/g;function rt(e){return e.getAttribute&&e.getAttribute("class")||""}m.fn.extend({addClass:function(e){var t,n,i,r,s,o,a,u=0;if(m.isFunction(e))return this.each((function(t){m(this).addClass(e.call(this,t,rt(this)))}));if("string"==typeof e&&e)for(t=e.match(O)||[];n=this[u++];)if(r=rt(n),i=1===n.nodeType&&(" "+r+" ").replace(it," ")){for(o=0;s=t[o++];)i.indexOf(" "+s+" ")<0&&(i+=s+" ");r!==(a=m.trim(i))&&n.setAttribute("class",a)}return this},removeClass:function(e){var t,n,i,r,s,o,a,u=0;if(m.isFunction(e))return this.each((function(t){m(this).removeClass(e.call(this,t,rt(this)))}));if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(O)||[];n=this[u++];)if(r=rt(n),i=1===n.nodeType&&(" "+r+" ").replace(it," ")){for(o=0;s=t[o++];)for(;i.indexOf(" "+s+" ")>-1;)i=i.replace(" "+s+" "," ");r!==(a=m.trim(i))&&n.setAttribute("class",a)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):m.isFunction(e)?this.each((function(n){m(this).toggleClass(e.call(this,n,rt(this),t),t)})):this.each((function(){var t,i,r,s;if("string"===n)for(i=0,r=m(this),s=e.match(O)||[];t=s[i++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else void 0!==e&&"boolean"!==n||((t=rt(this))&&L.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":L.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,i=0;for(t=" "+e+" ";n=this[i++];)if(1===n.nodeType&&(" "+rt(n)+" ").replace(it," ").indexOf(t)>-1)return!0;return!1}});var st=/\r/g,ot=/[\x20\t\r\n\f]+/g;m.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=m.isFunction(e),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?e.call(this,n,m(this).val()):e)?r="":"number"==typeof r?r+="":m.isArray(r)&&(r=m.map(r,(function(e){return null==e?"":e+""}))),(t=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))}))):r?(t=m.valHooks[r.type]||m.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(st,""):null==n?"":n:void 0}}),m.extend({valHooks:{option:{get:function(e){var t=m.find.attr(e,"value");return null!=t?t:m.trim(m.text(e)).replace(ot," ")}},select:{get:function(e){for(var t,n,i=e.options,r=e.selectedIndex,s="select-one"===e.type||r<0,o=s?null:[],a=s?r+1:i.length,u=r<0?a:s?r:0;u-1)&&(n=!0);return n||(e.selectedIndex=-1),s}}}}),m.each(["radio","checkbox"],(function(){m.valHooks[this]={set:function(e,t){if(m.isArray(t))return e.checked=m.inArray(m(e).val(),t)>-1}},p.checkOn||(m.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var at=/^(?:focusinfocus|focusoutblur)$/;m.extend(m.event,{trigger:function(e,t,i,r){var s,a,u,l,c,d,h,p=[i||o],v=f.call(e,"type")?e.type:e,g=f.call(e,"namespace")?e.namespace.split("."):[];if(a=u=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!at.test(v+m.event.triggered)&&(v.indexOf(".")>-1&&(g=v.split("."),v=g.shift(),g.sort()),c=v.indexOf(":")<0&&"on"+v,(e=e[m.expando]?e:new m.Event(v,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),t=null==t?[e]:m.makeArray(t,[e]),h=m.event.special[v]||{},r||!h.trigger||!1!==h.trigger.apply(i,t))){if(!r&&!h.noBubble&&!m.isWindow(i)){for(l=h.delegateType||v,at.test(l+v)||(a=a.parentNode);a;a=a.parentNode)p.push(a),u=a;u===(i.ownerDocument||o)&&p.push(u.defaultView||u.parentWindow||n)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?l:h.bindType||v,(d=(L.get(a,"events")||{})[e.type]&&L.get(a,"handle"))&&d.apply(a,t),(d=c&&a[c])&&d.apply&&P(a)&&(e.result=d.apply(a,t),!1===e.result&&e.preventDefault());return e.type=v,r||e.isDefaultPrevented()||h._default&&!1!==h._default.apply(p.pop(),t)||!P(i)||c&&m.isFunction(i[v])&&!m.isWindow(i)&&((u=i[c])&&(i[c]=null),m.event.triggered=v,i[v](),m.event.triggered=void 0,u&&(i[c]=u)),e.result}},simulate:function(e,t,n){var i=m.extend(new m.Event,n,{type:e,isSimulated:!0});m.event.trigger(i,null,t)}}),m.fn.extend({trigger:function(e,t){return this.each((function(){m.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return m.event.trigger(e,t,n,!0)}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),(function(e,t){m.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),m.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),p.focusin="onfocusin"in n,p.focusin||m.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){m.event.simulate(t,e.target,m.event.fix(e))};m.event.special[t]={setup:function(){var i=this.ownerDocument||this,r=L.access(i,t);r||i.addEventListener(e,n,!0),L.access(i,t,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this,r=L.access(i,t)-1;r?L.access(i,t,r):(i.removeEventListener(e,n,!0),L.remove(i,t))}}}));var ut=n.location,lt=m.now(),ct=/\?/;m.parseJSON=function(e){return JSON.parse(e+"")},m.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+e),t};var dt=/#.*$/,ht=/([?&])_=[^&]*/,ft=/^(.*?):[ \t]*([^\r\n]*)$/gm,pt=/^(?:GET|HEAD)$/,mt=/^\/\//,vt={},gt={},yt="*/".concat("*"),bt=o.createElement("a");function _t(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,s=t.toLowerCase().match(O)||[];if(m.isFunction(n))for(;i=s[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function xt(e,t,n,i){var r={},s=e===gt;function o(a){var u;return r[a]=!0,m.each(e[a]||[],(function(e,a){var l=a(t,n,i);return"string"!=typeof l||s||r[l]?s?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)})),u}return o(t.dataTypes[0])||!r["*"]&&o("*")}function wt(e,t){var n,i,r=m.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&m.extend(!0,e,i),e}bt.href=ut.href,m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ut.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(ut.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":yt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?wt(wt(e,m.ajaxSettings),t):wt(m.ajaxSettings,e)},ajaxPrefilter:_t(vt),ajaxTransport:_t(gt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,r,s,a,u,l,c,d,h=m.ajaxSetup({},t),f=h.context||h,p=h.context&&(f.nodeType||f.jquery)?m(f):m.event,v=m.Deferred(),g=m.Callbacks("once memory"),y=h.statusCode||{},b={},_={},x=0,w="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!a)for(a={};t=ft.exec(s);)a[t[1].toLowerCase()]=t[2];t=a[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=_[n]=_[n]||e,b[e]=t),this},overrideMimeType:function(e){return x||(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)y[t]=[y[t],e[t]];else k.always(e[k.status]);return this},abort:function(e){var t=e||w;return i&&i.abort(t),E(0,t),this}};if(v.promise(k).complete=g.add,k.success=k.done,k.error=k.fail,h.url=((e||h.url||ut.href)+"").replace(dt,"").replace(mt,ut.protocol+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=m.trim(h.dataType||"*").toLowerCase().match(O)||[""],null==h.crossDomain){l=o.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=bt.protocol+"//"+bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=m.param(h.data,h.traditional)),xt(vt,h,t,k),2===x)return k;for(d in(c=m.event&&h.global)&&0==m.active++&&m.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!pt.test(h.type),r=h.url,h.hasContent||(h.data&&(r=h.url+=(ct.test(r)?"&":"?")+h.data,delete h.data),!1===h.cache&&(h.url=ht.test(r)?r.replace(ht,"$1_="+lt++):r+(ct.test(r)?"&":"?")+"_="+lt++)),h.ifModified&&(m.lastModified[r]&&k.setRequestHeader("If-Modified-Since",m.lastModified[r]),m.etag[r]&&k.setRequestHeader("If-None-Match",m.etag[r])),(h.data&&h.hasContent&&!1!==h.contentType||t.contentType)&&k.setRequestHeader("Content-Type",h.contentType),k.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+yt+"; q=0.01":""):h.accepts["*"]),h.headers)k.setRequestHeader(d,h.headers[d]);if(h.beforeSend&&(!1===h.beforeSend.call(f,k,h)||2===x))return k.abort();for(d in w="abort",{success:1,error:1,complete:1})k[d](h[d]);if(i=xt(gt,h,t,k)){if(k.readyState=1,c&&p.trigger("ajaxSend",[k,h]),2===x)return k;h.async&&h.timeout>0&&(u=n.setTimeout((function(){k.abort("timeout")}),h.timeout));try{x=1,i.send(b,E)}catch(e){if(!(x<2))throw e;E(-1,e)}}else E(-1,"No Transport");function E(e,t,o,a){var l,d,b,_,w,E=t;2!==x&&(x=2,u&&n.clearTimeout(u),i=void 0,s=a||"",k.readyState=e>0?4:0,l=e>=200&&e<300||304===e,o&&(_=function(e,t,n){for(var i,r,s,o,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){u.unshift(r);break}if(u[0]in n)s=u[0];else{for(r in n){if(!u[0]||e.converters[r+" "+u[0]]){s=r;break}o||(o=r)}s=s||o}if(s)return s!==u[0]&&u.unshift(s),n[s]}(h,k,o)),_=function(e,t,n,i){var r,s,o,a,u,l={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)l[o.toLowerCase()]=e.converters[o];for(s=c.shift();s;)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!u&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=s,s=c.shift())if("*"===s)s=u;else if("*"!==u&&u!==s){if(!(o=l[u+" "+s]||l["* "+s]))for(r in l)if((a=r.split(" "))[1]===s&&(o=l[u+" "+a[0]]||l["* "+a[0]])){!0===o?o=l[r]:!0!==l[r]&&(s=a[0],c.unshift(a[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+u+" to "+s}}}return{state:"success",data:t}}(h,_,k,l),l?(h.ifModified&&((w=k.getResponseHeader("Last-Modified"))&&(m.lastModified[r]=w),(w=k.getResponseHeader("etag"))&&(m.etag[r]=w)),204===e||"HEAD"===h.type?E="nocontent":304===e?E="notmodified":(E=_.state,d=_.data,l=!(b=_.error))):(b=E,!e&&E||(E="error",e<0&&(e=0))),k.status=e,k.statusText=(t||E)+"",l?v.resolveWith(f,[d,E,k]):v.rejectWith(f,[k,E,b]),k.statusCode(y),y=void 0,c&&p.trigger(l?"ajaxSuccess":"ajaxError",[k,h,l?d:b]),g.fireWith(f,[k,E]),c&&(p.trigger("ajaxComplete",[k,h]),--m.active||m.event.trigger("ajaxStop")))}return k},getJSON:function(e,t,n){return m.get(e,t,n,"json")},getScript:function(e,t){return m.get(e,void 0,t,"script")}}),m.each(["get","post"],(function(e,t){m[t]=function(e,n,i,r){return m.isFunction(n)&&(r=r||i,i=n,n=void 0),m.ajax(m.extend({url:e,type:t,dataType:r,data:n,success:i},m.isPlainObject(e)&&e))}})),m._evalUrl=function(e){return m.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},m.fn.extend({wrapAll:function(e){var t;return m.isFunction(e)?this.each((function(t){m(this).wrapAll(e.call(this,t))})):(this[0]&&(t=m(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this)},wrapInner:function(e){return m.isFunction(e)?this.each((function(t){m(this).wrapInner(e.call(this,t))})):this.each((function(){var t=m(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=m.isFunction(e);return this.each((function(n){m(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(){return this.parent().each((function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)})).end()}}),m.expr.filters.hidden=function(e){return!m.expr.filters.visible(e)},m.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var kt=/%20/g,Et=/\[\]$/,Ct=/\r?\n/g,Tt=/^(?:submit|button|image|reset|file)$/i,$t=/^(?:input|select|textarea|keygen)/i;function St(e,t,n,i){var r;if(m.isArray(t))m.each(t,(function(t,r){n||Et.test(e)?i(e,r):St(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)}));else if(n||"object"!==m.type(t))i(e,t);else for(r in t)St(e+"["+r+"]",t[r],n,i)}m.param=function(e,t){var n,i=[],r=function(e,t){t=m.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(e)||e.jquery&&!m.isPlainObject(e))m.each(e,(function(){r(this.name,this.value)}));else for(n in e)St(n,e[n],t,r);return i.join("&").replace(kt,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=m.prop(this,"elements");return e?m.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!m(this).is(":disabled")&&$t.test(this.nodeName)&&!Tt.test(e)&&(this.checked||!X.test(e))})).map((function(e,t){var n=m(this).val();return null==n?null:m.isArray(n)?m.map(n,(function(e){return{name:t.name,value:e.replace(Ct,"\r\n")}})):{name:t.name,value:n.replace(Ct,"\r\n")}})).get()}}),m.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var At={0:200,1223:204},Nt=m.ajaxSettings.xhr();p.cors=!!Nt&&"withCredentials"in Nt,p.ajax=Nt=!!Nt,m.ajaxTransport((function(e){var t,i;if(p.cors||Nt&&!e.crossDomain)return{send:function(r,s){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=i=a.onload=a.onerror=a.onabort=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(At[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),i=a.onerror=t("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout((function(){t&&i()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return m.globalEval(e),e}}}),m.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),m.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain)return{send:function(i,r){t=m("