jQuery((function(e){function s(e,s){e.select2({width:"100%",allowClear:!0,placeholder:"",multiple:!1,maximumSelectionSize:1,minimumInputLength:0,style:"30px",ajax:{url:LearnDashQuizCreationAi.ajaxurl,method:"GET",dataType:"json",delay:300,data(e){return{page:e.page||1,keyword:e.term,...s}},processResults(e){return{results:e.data.results,pagination:e.data.pagination}},cache:!1}})}function t(s){const t={action:LearnDashQuizCreationAi.action,nonce:LearnDashQuizCreationAi.nonce};switch(s){case"course_id":t.post_type=LearnDashQuizCreationAi.post_types.course;break;case"lesson_id":t.course_ids=e('select[name="course_id"]').val(),t.post_type=LearnDashQuizCreationAi.post_types.lesson;break;case"topic_id":t.course_ids=e('select[name="course_id"]').val(),t.lesson_ids=e('select[name="lesson_id"]').val(),t.post_type=LearnDashQuizCreationAi.post_types.topic;break;case"quiz":t.course_ids=e('select[name="course_id"]').val(),t.lesson_ids=e('select[name="lesson_id"]').val(),t.topic_ids=e('select[name="topic_id"]').val(),t.quiz_ids=e('select[name="quiz"]').val(),t.post_type=LearnDashQuizCreationAi.post_types.quiz}return t}e(".submenu-ldlms-quizzes").addClass("current"),e(document).on("change",'select[name="course_id"]',(function(){s(e('select[name="lesson_id"]'),t("lesson_id")),s(e('select[name="topic_id"]'),t("topic_id")),s(e('select[name="quiz"]'),t("quiz"))})),e(document).on("change",'select[name="lesson_id"]',(function(){s(e('select[name="topic_id"]'),t("topic_id")),s(e('select[name="quiz"]'),t("quiz"))})),e(document).on("change",'select[name="topic_id"]',(function(){s(e('select[name="quiz"]'),t("quiz"))}));const i=e("select.select2");e.each(i,(function(){const i=t(e(this).attr("name"));s(e(this),i)}))}));