Current File : /home/getxxhzo/xpertbee.com/wp-content/plugins/tutor/assets/js/tutor-front.min.js |
(()=>{var n={3676:()=>{window.readyState_complete=function(e){var r=function t(e){return e()};document.addEventListener("readystatechange",function(t){return t.target.readyState==="complete"?typeof e=="function"?setTimeout(function(){return r(e)}):"":""})};window.addBodyClass=function(t){var e=new URL(t);var r=e.searchParams.get("tab_page");var n=e.searchParams.get("edit")&&"_edit";document.body.classList.add(r);document.body.classList.add(r+n)};window.selectorById=function(t){return document.getElementById(t)};window.selectorByClass=function(t){return document.getElementsByClassName(t)};window.json_download=function(t,e){var r=new Blob([t],{type:"application/json"});var n=document.createElement("a");n.href=URL.createObjectURL(r);n.download=e;n.click()}},4367:()=>{window.selectSearchField=function(t){var r=document.querySelectorAll(t);(function(){r.forEach(function(o){if(o&&!o.classList.contains("tutor-js-form-select")&&!o.hasAttribute("noDropdown")&&!o.classList.contains("no-tutor-dropdown")){var t=o.options[o.selectedIndex];o.style.display="none";var i,e,r,a,n,u,c,s;o.insertAdjacentHTML("afterend",p(o.options));i=o.nextElementSibling;e=i.querySelector(".tutor-form-select-search");r=e&&e.querySelector("input");s=i.querySelector(".tutor-form-select-dropdown");var l=i.querySelector(".tutor-form-select-label");l.innerText=t&&t.text;i.onclick=function(t){t.stopPropagation();f(document.querySelectorAll(".tutor-js-form-select"));i.classList.toggle("is-active");setTimeout(function(){r.focus()},100);s.onclick=function(t){t.stopPropagation()}};f(document.querySelectorAll(".tutor-js-form-select"));n=e.nextElementSibling;u=n&&n.querySelectorAll(".tutor-form-select-option");if(u){u.forEach(function(t){t.onclick=function(n){n.stopPropagation();var t=Array.from(o.options);t.forEach(function(t,e){if(t.value===n.target.dataset.key){i.classList.remove("is-active");l.innerText=n.target.innerText;l.dataset.value=t.value;o.value=t.value;var r=document.getElementById("save_tutor_option");if(r){r.disabled=false}}});var e=new Event("change",{bubbles:true});o.dispatchEvent(e)}})}var d=function t(e){var r=0;e.forEach(function(t){if(t.style.display!=="none"){r+=1}});return r};r.oninput=function(t){var e,r=false;a=t.target.value.toUpperCase();u.forEach(function(t){c=t.querySelector("[tutor-dropdown-item]");e=c.textContent||c.innerText;if(e.toUpperCase().indexOf(a)>-1){t.style.display="";r="false"}else{r="true";t.style.display="none"}});var n='\n <div class="tutor-form-select-option noItem">\n No item found\n </div>\n ';var o=s.querySelector(".tutor-form-select-options");if(0==d(u)){var i=false;o.querySelectorAll(".tutor-form-select-option").forEach(function(t){if(t.classList.contains("noItem")==true){i=true}});if(false==i){o.insertAdjacentHTML("beforeend",n);i=true}}else{if(null!==s.querySelector(".noItem")){s.querySelector(".noItem").remove()}}}}});var t=document.querySelectorAll(".tutor-js-form-select");t.forEach(function(t){if(t.nextElementSibling){if(t.nextElementSibling.classList.contains("tutor-js-form-select")){t.nextElementSibling.remove()}}});var e=document.querySelectorAll(".tutor-js-form-select");document.onclick=function(t){f(e)}})();function f(t){if(t){t.forEach(function(t){t.classList.remove("is-active")})}}function p(t){var e="";Array.from(t).forEach(function(t){e+='\n <div class="tutor-form-select-option">\n\t\t\t\t<span tutor-dropdown-item data-key="'.concat(tutor_esc_attr(t.value),'" class="tutor-nowrap-ellipsis" title="').concat(tutor_esc_attr(t.text),'">').concat(tutor_esc_html(t.text),"</span>\n </div>\n ")});var r='\n <div class="tutor-form-control tutor-form-select tutor-js-form-select">\n\t\t\t<span class="tutor-form-select-label" tutor-dropdown-label>'.concat(window.wp.i18n.__("Select","tutor"),'</span>\n <div class="tutor-form-select-dropdown">\n\t\t\t\t<div class="tutor-form-select-search tutor-pt-8 tutor-px-8">\n\t\t\t\t\t<div class="tutor-form-wrap">\n\t\t\t\t\t\t<span class="tutor-form-icon"><i class="tutor-icon-search" area-hidden="true"></i></span>\n\t\t\t\t\t\t<input type="search" class="tutor-form-control" placeholder="Search ..." />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n <div class="tutor-form-select-options">\n ').concat(e,"\n </div>\n </div>\n </div>\n ");return r}};selectSearchField(".tutor-form-select")},1103:()=>{window.jQuery(document).ready(function(a){a("div.tutor-lesson-wrapper [data-mce-style]").each(function(){a(this).attr("style",a(this).attr("data-mce-style"));a(this).removeAttr("data-mce-style")});a(document).on("click",'.tutor-single-course-lesson-comments button[type="submit"]',function(t){t.preventDefault();var e=wp.i18n.__;var r=a(this);var o=r.closest("form");var n=o.serialize();var i=o.find('textarea[name="comment"]').val();if(i.trim().length===0){tutor_toast(e("Warning","tutor"),e("Blank comment is not allowed.","tutor"),"error");return}a.ajax({url:_tutorobject.ajaxurl,type:"POST",data:n,beforeSend:function t(){r.addClass("is-loading").prop("disabled",true)},complete:function t(){r.removeClass("is-loading");r.removeAttr("disabled")},success:function t(e){var r=o.attr("tutor-comment-reply");if(typeof r!=="undefined"&&r!==false){o.before(e.data.html)}else{var n=document.querySelector(".tutor-course-spotlight-comments");n.innerHTML=e.data.html}a(".tutor-comment-line").css("height","calc(100% - 308px)");a("textarea").val("")},error:function t(e){r.removeClass("is-loading").prop("disabled",false)}})})})},818:()=>{window.jQuery(document).ready(function(t){if(t.fn.ShareLink){var e=t(".tutor-social-share-wrap");if(e.length){var r=JSON.parse(e.attr("data-social-share-config"));e.find(".tutor_share").ShareLink({title:r.title,text:r.text,image:r.image,class_prefix:"s_",width:640,height:480})}}})},6470:()=>{window.jQuery(document).ready(function(f){var p=window.wp.i18n.__;if(f(".tutor-quiz-wrap").length){if(!f(".tutor-table-quiz-attempts").length&&!f(".tutor-quiz-attempt-details").length){f(".tutor-course-topic-single-footer").remove()}}var h=f("#tutor-quiz-time-update");if(h.length){var t=JSON.parse(h.attr("data-attempt-settings"));var v=JSON.parse(h.attr("data-attempt-meta"));if(v.time_limit.time_limit_seconds>0){var e,r;var m=new Date((e=t.attempt_started_at)===null||e===void 0?void 0:e.replaceAll("-","/")).getTime()+v.time_limit.time_limit_seconds*1e3;var y=new Date((r=v.date_time_now)===null||r===void 0?void 0:r.replaceAll("-","/")).getTime();var g=setInterval(function(){var t=m-y;var e=Math.floor(t/(1e3*60*60*24));var r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));var n=Math.floor(t%(1e3*60*60)/(1e3*60));var o=Math.floor(t%(1e3*60)/1e3);var i="";e?i+=e+"d ":0;i+=(r||0)+"h ";i+=(n||0)+"m ";i+=(o||0)+"s ";if(t<0){clearInterval(g);h.toggleClass("tutor-quiz-time-expired");i="EXPIRED";if(_tutorobject.quiz_options.quiz_when_time_expires==="auto_submit"){f("form#tutor-answering-quiz").submit()}else{f(".tutor-quiz-answer-next-btn, .tutor-quiz-submit-btn, .tutor-quiz-answer-previous-btn").prop("disabled",true);f("button[name='quiz_answer_submit_btn']").prop("disabled",true);f(".time-remaining span").css("color","#F44337");f.ajax({url:_tutorobject.ajaxurl,type:"POST",data:{quiz_id:f("#tutor_quiz_id").val(),action:"tutor_quiz_timeout"},success:function t(e){var r=f("#tutor-quiz-time-expire-wrapper").data("attempt-allowed");var n=f("#tutor-quiz-time-expire-wrapper").data("attempt-remaining");var o="#tutor-quiz-time-expire-wrapper";f(o).addClass("tutor-alert-show");if(n>0){f("".concat(o," .tutor-quiz-alert-text")).html(p("Your time limit for this quiz has expired, please reattempt the quiz. Attempts remaining:","tutor")+" "+n+"/"+r)}else{if(f(o).hasClass("time-remaining-warning")){f(o).removeClass("time-remaining-warning");f(o).addClass("time-over")}if(f("".concat(o," .flash-info span:first-child")).hasClass("tutor-icon-circle-info")){f("".concat(o," .flash-info span:first-child")).removeClass("tutor-icon-circle-info");f("".concat(o," .flash-info span:first-child")).addClass("tutor-icon-circle-times-line")}h.toggleClass("tutor-quiz-time-expired");f("#tutor-start-quiz").hide();f("".concat(o," .tutor-quiz-alert-text")).html("".concat(p("Unfortunately, you are out of time and quiz attempts. ","tutor")))}},complete:function t(){}})}}y=y+1e3;h.html(i);if(i=="EXPIRED"){h.addClass("color-text-error")}if(t){var a=t/1e3;var u=v.time_limit.time_limit_seconds;var c=Math.ceil(a*100/u);var s=document.querySelector(".quiz-time-remaining-progress-circle");var l=document.querySelector(".quiz-time-remaining-progress-circle svg");if(l&&s){var d=44-44*(c/100);if(c<=0){c=0;s.innerHTML='<svg viewBox="0 0 50 50" width="50" height="50">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<circle cx="0" cy="0" r="11"></circle>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</svg>';s.setAttribute("class","quiz-time-remaining-expired-circle")}l.setAttribute("style","stroke-dashoffset: ".concat(d,";"))}}},1e3)}else{h.html(p("No Limit","tutor"))}}var n=f("form#tutor-start-quiz");if(n.length){if(_tutorobject.quiz_options.quiz_auto_start==1){n.submit()}}})},3419:()=>{window.jQuery(document).ready(function(l){var d=window.wp.i18n.__;var t=_tutorobject.quiz_options;var f=new Map;l(".tutor-sortable-list").on("sortchange",e);function e(t,e){var r=parseInt(l(this).closest(".quiz-attempt-single-question").attr("id").match(/\d+/)[0],10);if(!f.get(r)){f.set(r,true)}}function p(){return Number(_tutorobject.quiz_answer_display_time)||2e3}function h(){return"reveal"===t.feedback_mode}function u(){return _tutorobject.quiz_options.question_layout_view}function c(t){return'<span class="tutor-quiz-answer-single-info tutor-color-success tutor-mt-8">\n <i class="tutor-icon-mark tutor-color-success" area-hidden="true"></i>\n '.concat(t,"\n </span>")}function v(t){var o=false;var i=JSON.parse(window.tutor_quiz_context.split("").reverse().join(""));!Array.isArray(i)?i=[]:0;if(u()!=="question_below_each_other"){l(".tutor-quiz-answer-single-info").remove()}l(".tutor-quiz-answer-single").removeClass("tutor-quiz-answer-single-correct tutor-quiz-answer-single-incorrect");var a=true;var e=t.find("input");var r=t.find('input[type="radio"]:checked, input[type="checkbox"]:checked');if(h()){r.each(function(){var t=l(this);var e=i.indexOf(t.val())>-1;if(!e){a=false}});e.each(function(){var t=l(this);var e=t.attr("type");if(e==="radio"||e==="checkbox"){var r=i.indexOf(t.val())>-1;var n=t.is(":checked");if(r){t.closest(".tutor-quiz-answer-single").addClass("tutor-quiz-answer-single-correct").append(c(d("Correct Answer","tutor"))).find(".tutor-quiz-answer-single-info:eq(1)").remove()}else{if(t.prop("checked")){t.closest(".tutor-quiz-answer-single").addClass("tutor-quiz-answer-single-incorrect")}}if(r&&!n){t.attr("disabled","disabled");a=false;o=true}}})}if(a){o=true}return o}function m(t){var e=true;var r=t[0];var n=l(r).find(".tutor-dropzone");if(n.length>0){Object.values(n).forEach(function(t){if(t instanceof Element&&t.classList.contains("tutor-dropzone")){if(l(t).has("input").length===0){e=false}}})}return e}function y(r,n){var t=r.find(".quiz-answer-required");if(t.length){var e=parseInt(r.attr("id").match(/\d+/)[0],10);var o=f.get(e);var i=r.find(".tutor-draggable");var a=r.find(".ui-sortable");var u=t.find("input");if(u.length){var c=u.attr("type");if(c==="radio"){if(t.find('input[type="radio"]:checked').length==0){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("Please select an option to answer","tutor"),"</p>"));n=false}}else if(c==="checkbox"){if(t.find('input[type="checkbox"]:checked').length==0){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("Please select at least one option to answer.","tutor"),"</p>"));n=false}}else if(c==="text"){u.each(function(t,e){if(!l(e).val().trim().length){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("The answer for this question is required","tutor"),"</p>"));n=false}})}}if(t.find("textarea").length){if(t.find("textarea").val().trim().length<1){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("The answer for this question is required","tutor"),"</p>"));n=false}}if(i.length){var s=m(t);if(!s){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("The answer for this question is required","tutor"),"</p>"));n=false}}if(o===undefined&&a.length){r.find(".answer-help-block").html('<p style="color: #dc3545">'.concat(d("The answer for this question is required","tutor"),"</p>"));n=false}}return n}l(".tutor-quiz-next-btn-all").prop("disabled",false);l(".quiz-attempt-single-question input").filter('[type="radio"], [type="checkbox"]').change(function(){l(".tutor-quiz-next-btn-all").prop("disabled",false)});l(document).on("click",".tutor-quiz-answer-next-btn, .tutor-quiz-answer-previous-btn",function(t){t.preventDefault();var e=l(".tutor-quiz-question-counter>span:first-child");var r=parseInt(l(this).closest("[data-question_index]").data("question_index"));if(l(this).hasClass("tutor-quiz-answer-previous-btn")){l(this).closest(".quiz-attempt-single-question").hide().prev().show();e.text(r-1);return}var n=l(this);var o=n.closest(".quiz-attempt-single-question");var i=parseInt(n.closest(".quiz-attempt-single-question").attr("id").match(/\d+/)[0],10);var a=n.closest(".quiz-attempt-single-question").attr("data-next-question-id");var u=true;u=y(o,u);if(!u){return}var c=v(o);if(!h()){if(!c){return}}if(a){var s=l(a);if(s&&s.length){if(h()){setTimeout(function(){l(".quiz-attempt-single-question").hide();s.show()},p())}else{l(".quiz-attempt-single-question").hide();s.show()}if(l(".tutor-quiz-questions-pagination").length){l(".tutor-quiz-question-paginate-item").removeClass("active");l('.tutor-quiz-questions-pagination a[href="'+a+'"]').addClass("active")}e.text(r+1)}}});l(document).on("click",".tutor-quiz-question-paginate-item",function(t){t.preventDefault();var e=l(this);var r=l(e.attr("href"));l(".quiz-attempt-single-question").hide();r.show();l(".tutor-quiz-question-paginate-item").removeClass("active");e.addClass("active")});l(document).on("keyup","textarea.question_type_short_answer, textarea.question_type_open_ended",function(t){var e=l(this);var r=e.val();var n=e.hasClass("question_type_short_answer")?_tutorobject.quiz_options.short_answer_characters_limit:_tutorobject.quiz_options.open_ended_answer_characters_limit;var o=n-r.length;if(o<1){e.val(r.substr(0,n));o=0}e.closest(".quiz-attempt-single-question").find(".characters_remaining").html(o)});l(document).on("submit","#tutor-answering-quiz",function(t){t.preventDefault();var e=l(".quiz-attempt-single-question");var r=document.querySelector(".tutor-quiz-submit-btn");var n=l(t.target);var o=true;var i=true;if(e.length){e.each(function(t,e){o=y(l(e),o);i=v(l(e))})}if(_tutorobject.quiz_options.quiz_when_time_expires==="auto_submit"&&l("#tutor-quiz-time-update").hasClass("tutor-quiz-time-expired")){o=true;i=true}if(o&&i){var a=500;if(h()&&u()==="question_below_each_other"){a=p();n.find(":submit").addClass("is-loading").attr("disabled","disabled")}setTimeout(function(){t.target.submit()},a)}else{if(r){r.classList.remove("is-loading");r.disabled=false}}});l(".tutor-quiz-submit-btn").click(function(t){var e=this;t.preventDefault();if(h()){var r=l(".quiz-attempt-single-question");var n=true;if(r.length){r.each(function(t,e){n=y(l(e));n=v(l(e))})}l(this).attr("disabled","disabled");setTimeout(function(){l(e).addClass("is-loading");l("#tutor-answering-quiz").submit()},p())}else{l(this).attr("disabled","disabled").addClass("is-loading");l("#tutor-answering-quiz").submit()}});var o=l("#tutor-quiz-time-update");l(document).on("click","a",function(t){var r=l(this).attr("href");if(t.target.classList.contains("sidebar-ask-new-qna-btn")||t.target.classList.contains("tutor-quiz-question-paginate-item")){return}if(o.length>0&&o.text()!="EXPIRED"){t.preventDefault();t.stopImmediatePropagation();var n;var e={title:d("Abandon Quiz?","tutor"),description:d("Do you want to abandon this quiz? The quiz will be submitted partially up to this question if you leave this page.","tutor"),buttons:{keep:{title:d("Yes, leave quiz","tutor"),id:"leave",class:"tutor-btn tutor-btn-outline-primary",callback:function t(){var e=l("form#tutor-answering-quiz").serialize()+"&action="+"tutor_quiz_abandon";l.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:e,beforeSend:function t(){document.querySelector("#tutor-popup-leave").innerHTML=d("Leaving...","tutor")},success:function t(e){if(e.success){location.href=r}else{alert(d("Something went wrong","tutor"))}},error:function t(){alert(d("Something went wrong","tutor"));n.find("[data-tutor-modal-close]").click()}})}},reset:{title:d("Stay here","tutor"),id:"reset",class:"tutor-btn tutor-btn-primary tutor-ml-20",callback:function t(){n.find("[data-tutor-modal-close]").click()}}}};n=new window.tutor_popup(l,"").popup(e)}});l("body").on("submit","form#tutor-start-quiz",function(){l(this).find("button").prop("disabled",true)})})},7942:()=>{window.jQuery(document).ready(function(n){var t=wp.i18n.__;n(document).on("click",".tutor-course-wishlist-btn",function(t){t.preventDefault();var r=n(this);var e=r.attr("data-course-id");n.ajax({url:_tutorobject.ajaxurl,type:"POST",data:{course_id:e,action:"tutor_course_add_to_wishlist"},beforeSend:function t(){r.attr("disabled","disabled").addClass("is-loading")},success:function t(e){if(e.success){if(e.data.status==="added"){r.find("i").addClass("tutor-icon-bookmark-bold").removeClass("tutor-icon-bookmark-line")}else{r.find("i").addClass("tutor-icon-bookmark-line").removeClass("tutor-icon-bookmark-bold")}}else{n(".tutor-login-modal").addClass("tutor-is-active")}},complete:function t(){r.removeAttr("disabled").removeClass("is-loading")}})})})},7723:()=>{window.jQuery(document).ready(function(t){t(document).on("added_to_cart",function(t,e,r,n){n.removeClass("is-loading");n.siblings("a.added_to_cart").addClass("tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-btn-block").prepend('<span class="tutor-icon-cart-line tutor-mr-8"></span>')});t(document).on("adding_to_cart",function(t,e){e.addClass("is-loading");setTimeout(function(){e.removeClass("is-loading")},4e3)})})},1626:()=>{function l(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var o=function t(){};return{s:o,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function t(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=true,a=false,u;return{s:function t(){r=r.call(e)},n:function t(){var e=r.next();i=e.done;return e},e:function t(e){a=true;u=e},f:function t(){try{if(!i&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}}}function c(t,e){if(!t)return;if(typeof t==="string")return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}function n(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}document.addEventListener("DOMContentLoaded",function(){var t=wp.i18n,e=t.__,r=t._x,n=t._n,o=t._nx;var i=document.querySelectorAll(".tutor-export-purchase-history");var a=l(i),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(c){c.onclick=function(t){var e=t.currentTarget;var r="order-".concat(e.dataset.order,"-purchase-history.csv");var n=[{"Order ID ":e.dataset.order,"Course Name":e.dataset.courseName,Price:e.dataset.price,Date:e.dataset.date,Status:e.dataset.status}];s(n,r)}}}}catch(t){a.e(t)}finally{a.f()}function s(t,e){var r=Object.keys(t[0]);var n=[r.join(","),t.map(function(e){return r.map(function(t){return e[t]}).join(",")}).join("\n")].join("\n");var o=new Blob([n],{type:"text/csv;charset=utf-8"});var i=URL.createObjectURL(o);var a=document.createElement("a");a.setAttribute("href",i);a.setAttribute("download",e);a.style.visibility="hidden";document.body.appendChild(a);a.click();document.body.removeChild(a)}})},6966:()=>{document.addEventListener("DOMContentLoaded",function(){var e=window.jQuery;e(".tutor-dashboard .tutor-dashboard-menu-toggler").click(function(){var t=e(".tutor-dashboard-left-menu");t.closest(".tutor-dashboard").toggleClass("is-sidebar-expanded");if(t.css("display")!=="none"){t.get(0).scrollIntoView({block:"start"})}})})},6344:(t,e,r)=>{var n=r(3632),i=n.get_response_message;window.jQuery(document).ready(function(o){o('.tutor-settings-pass-field [name="confirm_new_password"]').on("input",function(){var t=o('[name="new_password"]');var e=(t.val()||"").trim();var r=e&&o(this).val()===e;o(this).parent().find(".tutor-validation-icon")[r?"show":"hide"]()});o(".tutor-profile-password-reset").click(function(t){t.preventDefault();var e=o(this);var r=e.closest("form");var n=r.serializeObject();n.action="tutor_profile_password_reset";o.ajax({url:_tutorobject.ajaxurl,type:"POST",data:n,beforeSend:function t(){e.addClass("is-loading")},success:function t(e){var t=e.success;if(t){window.tutor_toast("Success",i(e),"success");window.location.reload()}else{window.tutor_toast("Error",i(e),"error")}},complete:function t(){e.removeClass("is-loading")}})})})},1974:(t,e,r)=>{var n=r(3632),c=n.get_response_message;var o=function t(e){var r=new RegExp("^(https?:\\/\\/)?"+"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|"+"((\\d{1,3}\\.){3}\\d{1,3}))"+"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*"+"(\\?[;&a-z\\d%_.~+=-]*)?"+"(\\#[-a-z\\d_]*)?$","i");return!!r.test(e)};var i=function t(d,f,p){var e=new FileReader;e.addEventListener("load",function(){var l=new Image;l.addEventListener("load",function(){var t=l.width,e=l.height;var r=0;var n=0;var o=t;var i=e;if(f.width==f.height){r=t>e?(t-e)/2:0;n=e>t?(e-t)/2:0;o=t>e?e:t;i=e>t?t:e}f.height=f.height||e/t*f.width;var a=f.width>t?t:f.width;var u=f.width>t?e:f.height;var c=document.createElement("canvas");c.width=a;c.height=u;var s=c.getContext("2d");s.drawImage(l,r,n,o,i,0,0,c.width,c.height);c.toBlob(function(t){t.name=d.name;t.lastModified=d.lastModified;var e=new FileReader;e.addEventListener("load",function(){p(t,e.result)});e.readAsDataURL(t)},"image/jpeg")});l.src=e.result});e.readAsDataURL(d)};window.jQuery(document).ready(function(a){var u=wp.i18n.__;var t=function t(o){this.dialogue_box=o.find("#tutor_photo_dialogue_box");this.open_dialogue_box=function(t){this.dialogue_box.attr("name",t);this.dialogue_box.trigger("click")};this.upload_selected_image=function(o,t){var e=tutor_get_nonce_data(true);var r=this;r.toggle_loader(o,true);var n=new FormData;n.append("action","tutor_user_photo_upload");n.append("photo_type",o);n.append("photo_file",t,t.name);n.append(e.key,e.value);var i=this;a.ajax({url:window._tutorobject.ajaxurl,data:n,type:"POST",processData:false,contentType:false,error:r.error_alert,success:function t(){var e=i.title_capitalize(o.replace("_"," "));var r=u("Success","tutor");var n=e+" Changed Successfully!";if("Profile Photo"===e){n=u("Profile Photo Changed Successfully!","tutor")}if("Cover Photo"===e){n=u("Cover Photo Changed Successfully!","tutor")}tutor_toast(r,n,"success")},complete:function t(){r.toggle_loader(o,false)}})};this.title_capitalize=function(t){var e=t.split(" ");for(var r=0;r<e.length;r++){e[r]=e[r].charAt(0).toUpperCase()+e[r].slice(1)}return e.join(" ")};this.accept_upload_image=function(e,r){var t=r.currentTarget.files[0]||null;e.update_preview(r.currentTarget.name,t);i(t,{width:1200},function(t){e.upload_selected_image(r.currentTarget.name,t)});a(r.currentTarget).val("")};this.delete_image=function(e){var r=this;r.toggle_loader(e,true);a.ajax({url:window._tutorobject.ajaxurl,data:{action:"tutor_user_photo_remove",photo_type:e},type:"POST",error:r.error_alert,complete:function t(){r.toggle_loader(e,false)}})};this.update_preview=function(t,e){var r=o.find(t=="cover_photo"?"#tutor_cover_area":"#tutor_profile_area");if(!e){r.css("background-image","url("+r.data("fallback")+")");this.delete_image(t);return}var n=new FileReader;n.onload=function(t){r.css("background-image","url("+t.target.result+")")};n.readAsDataURL(e)};this.toggle_profile_pic_action=function(t){var e=t===undefined?"toggleClass":t?"addClass":"removeClass";o[e]("pop-up-opened")};this.error_alert=function(){tutor_toast("Error","Maximum file size exceeded!","error")};this.toggle_loader=function(t,e){o.find("#tutor_photo_meta_area .loader-area").css("display",e?"block":"none")};this.initialize=function(){var e=this;this.dialogue_box.change(function(t){e.accept_upload_image(e,t)});o.find("#tutor_profile_area .tutor_overlay, #tutor_pp_option>div:last-child").click(function(){e.toggle_profile_pic_action()});o.find(".tutor_cover_uploader").click(function(){e.open_dialogue_box("cover_photo")});o.find(".tutor_pp_uploader").click(function(){e.open_dialogue_box("profile_photo")});o.find(".tutor_cover_deleter").click(function(){e.update_preview("cover_photo",null)});o.find(".tutor_pp_deleter").click(function(){e.update_preview("profile_photo",null)})}};var e=a("#tutor_profile_cover_photo_editor");e.length>0?new t(e).initialize():0;a(".tutor-profile-settings-save").click(function(t){t.preventDefault();var e=a(this);var r=e.closest("form");var n=r.serializeObject();var o=document.querySelector("[name=phone_number]");if(window.tinyMCE!==undefined){var i=tinyMCE.get("tutor_profile_bio");n.tutor_profile_bio=i.getContent({format:"html"})}if(n.phone_number&&!n.phone_number.match(/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im)){o.classList.add("invalid");tutor_toast("Invalid","Invalid phone number","error");o.focus();return false}else{o.classList.remove("invalid")}n.action="tutor_update_profile";a.ajax({url:_tutorobject.ajaxurl,type:"POST",data:n,beforeSend:function t(){e.addClass("is-loading")},success:function t(e){var t=e.success;if(t){window.tutor_toast("Success",c(e),"success")}else{window.tutor_toast("Error",c(e),"error")}},complete:function t(){e.removeClass("is-loading")}})})})},787:()=>{document.addEventListener("DOMContentLoaded",function(){var n=window.jQuery;n('.tutor-dashboard-setting-withdraw input[name="tutor_selected_withdraw_method"]').on("change",function(t){var e=n(this);var r=e.closest("form");r.find(".withdraw-method-form").hide();r.find(".withdraw-method-form").hide().filter('[data-withdraw-form="'+e.val()+'"]').show()})})},9834:()=>{window.jQuery(document).ready(function(o){var i=window.wp.i18n.__;o(".tutor-course-retake-button").prop("disabled",false).click(function(t){t.preventDefault();var e=o(this).attr("href");var r=o(this).data("course_id");var n={title:i("Override Previous Progress","tutor"),description:i("Before continue, please decide whether to keep progress or reset.","tutor"),buttons:{reset:{title:i("Reset Data","tutor"),class:"tutor-btn tutor-btn-primary",callback:function t(e){o.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:{action:"tutor_reset_course_progress",course_id:r},beforeSend:function t(){e.prop("disabled",true).addClass("is-loading")},success:function t(e){if(e.success){window.location.assign(e.data.redirect_to)}else{alert((e.data||{}).message||i("Something went wrong","tutor"))}},complete:function t(){e.prop("disabled",false).removeClass("is-loading")}})}},keep:{title:i("Keep Data","tutor"),class:"tutor-btn tutor-btn-outline-primary tutor-ml-20",attr:"data-tutor-modal-close",callback:function t(){window.location.assign(e)}}}};new window.tutor_popup(o,"icon-gear").popup(n)})});readyState_complete(function(){var t=document.querySelector(".tutor-video-player .loading-spinner");if(null!==t){t.remove()}})},1033:()=>{function d(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var o=function t(){};return{s:o,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function t(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=true,a=false,u;return{s:function t(){r=r.call(e)},n:function t(){var e=r.next();i=e.done;return e},e:function t(e){a=true;u=e},f:function t(){try{if(!i&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}}}function c(t,e){if(!t)return;if(typeof t==="string")return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}function n(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}jQuery(document).ready(function(c){var t=wp.i18n,u=t.__,e=t._x,r=t._n,n=t._nx;c("[tutor-instructors]").each(function(){var a=c(this);var u={};var e;var t=document.querySelector(".tutor-ratings-stars i.is-active");var r=0;if(t){r=t.dataset.value}function i(t,e,r){var n=a.find("[tutor-instructors-content]");var o=n.html();var i=a.data();i.current_page=r||1;t?u[t]=e:u={};u.attributes=i;u.action="load_filtered_instructor";n.html('<div class="tutor-spinner-wrap"><span class="tutor-spinner" area-hidden="true"></span></div>');c.ajax({url:window._tutorobject.ajaxurl,data:u,type:"POST",success:function t(e){n.html((e.data||{}).html)},error:function t(){n.html(o);tutor_toast("Failed","Request Error","error")}})}a.on("change",'[tutor-instructors-filter-category] [type="checkbox"]',function(){var t={};c(this).closest("[tutor-instructors-filter-category]").find("input:checked").each(function(){t[c(this).val()]=c(this).parent().text()});var e=Object.keys(t);i(c(this).attr("name"),e)}).on("click","[tutor-instructors-filter-rating]",function(t){var e=t.target.dataset.value;if(e!=r){i("rating_filter",e)}r=e}).on("change","[tutor-instructors-filter-sort]",function(t){var e=t.target.value;i("short_by",e)}).on("input","[tutor-instructors-filter-search]",function(){var t=c(this).val();e?window.clearTimeout(e):0;e=window.setTimeout(function(){i("keyword",t);e=null},500)}).on("click","[data-page_number]",function(t){t.preventDefault();i(null,null,c(this).data("page_number"))}).on("click","[tutor-instructors-filter-clear]",function(){var t=c(this).closest("[tutor-instructors-filters]");t.find('input[type="checkbox"]').prop("checked",false);t.find("[tutor-instructors-filter-search]").val("");var e=document.querySelectorAll("[tutor-instructors-filter-rating]");var r=d(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.classList.contains("active")){o.classList.remove("active")}if(o.classList.contains("tutor-icon-star-bold")){o.classList.remove("tutor-icon-star-bold");o.classList.add("tutor-icon-star-line")}}}catch(t){r.e(t)}finally{r.f()}l.innerHTML="";i()})});var s=document.querySelectorAll("[tutor-instructors-filter-rating]");var l=document.querySelector("[tutor-instructors-filter-rating-count]");var o=d(s),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.onclick=function(t){var e=t.currentTarget;var r=d(s),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.classList.contains("is-active")){o.classList.remove("is-active")}if(o.classList.contains("tutor-icon-star-bold")){o.classList.remove("tutor-icon-star-bold");o.classList.add("tutor-icon-star-line")}}}catch(t){r.e(t)}finally{r.f()}var i=Number(t.target.dataset.value);var a=u("star","tutor");if(i>1){a=u("stars","tutor")}if(!e.classList.contains("is-active")){e.classList.add("is-active")}if(!e.classList.contains("tutor-icon-star-bold")){e.classList.remove("tutor-icon-star-line");e.classList.add("tutor-icon-star-bold")}l.innerHTML="".concat(i," ").concat(a)}}}catch(t){o.e(t)}finally{o.f()}})},3632:(t,e,r)=>{"use strict";r.r(e);r.d(e,{get_response_message:()=>n});var n=function t(e,r){var n=wp.i18n.__;var o=e||{},i=o.data,a=i===void 0?{}:i;var u=a.message,c=u===void 0?r||n("Something Went Wrong!","tutor"):u;return c}}};var o={};function Ot(t){var e=o[t];if(e!==undefined){return e.exports}var r=o[t]={exports:{}};n[t](r,r.exports,Ot);return r.exports}(()=>{Ot.d=(t,e)=>{for(var r in e){if(Ot.o(e,r)&&!Ot.o(t,r)){Object.defineProperty(t,r,{enumerable:true,get:e[r]})}}}})();(()=>{Ot.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();(()=>{Ot.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();var t={};(()=>{"use strict";var S=Ot(3676);function q(t){"@babel/helpers - typeof";return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q(t)}function O(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */O=function t(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,d=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function t(e,r,n){return e[r]=n}}function u(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,i=Object.create(o.prototype),a=new S(n||[]);return d(i,"_invoke",{value:w(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var s={};function c(){}function p(){}function h(){}var v={};i(v,o,function(){return this});var m=Object.getPrototypeOf,y=m&&m(m(L([])));y&&y!==t&&l.call(y,o)&&(v=y);var g=h.prototype=c.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(u,c){function s(t,e,r,n){var o=f(u[t],u,e);if("throw"!==o.type){var i=o.arg,a=i.value;return a&&"object"==q(a)&&l.call(a,"__await")?c.resolve(a.__await).then(function(t){s("next",t,r,n)},function(t){s("throw",t,r,n)}):c.resolve(a).then(function(t){i.value=t,r(i)},function(t){return s("throw",t,r,n)})}n(o.arg)}var o;d(this,"_invoke",{value:function t(r,n){function e(){return new c(function(t,e){s(r,n,t,e)})}return o=o?o.then(e,e):e()}})}function w(i,a,u){var c="suspendedStart";return function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){var n=x(r,u);if(n){if(n===s)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(undefined===n)return e.delegate=null,"throw"===r&&t.iterator["return"]&&(e.method="return",e.arg=undefined,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:E}}function E(){return{value:undefined,done:!0}}return p.prototype=h,d(g,"constructor",{value:h,configurable:!0}),d(h,"constructor",{value:p,configurable:!0}),p.displayName=i(h,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,i(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new _(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=L,S.prototype={constructor:S,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&l.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=undefined)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(r){if(this.done)throw r;var n=this;function e(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=undefined),!!e}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var u=l.call(i,"catchLoc"),c=l.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function t(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&l.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),s},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),s}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=undefined),s}},a}function c(t,e,r,n,o,i,a){try{var u=t[i](a);var c=u.value}catch(t){r(t);return}if(u.done){e(c)}else{Promise.resolve(c).then(n,o)}}function b(u){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=u.apply(t,a);function o(t){c(n,e,r,o,i,"next",t)}function i(t){c(n,e,r,o,i,"throw",t)}o(undefined)})}}function _(e,t){var r=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=s(e))||t&&e&&typeof e.length==="number"){if(r)e=r;var n=0;var o=function t(){};return{s:o,n:function t(){if(n>=e.length)return{done:true};return{done:false,value:e[n++]}},e:function t(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=true,a=false,u;return{s:function t(){r=r.call(e)},n:function t(){var e=r.next();i=e.done;return e},e:function t(e){a=true;u=e},f:function t(){try{if(!i&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}}}function s(t,e){if(!t)return;if(typeof t==="string")return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}function n(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var t=wp.i18n,w=t.__,L=t._x,M=t._n,F=t._nx;document.addEventListener("DOMContentLoaded",function(){var u=document.getElementById("tutor-common-confirmation-modal");var c=document.getElementById("tutor-common-confirmation-form");var t=document.getElementById("tutor-backend-filter-course");if(t){t.addEventListener("change",function(t){window.location=l("course-id",t.target.value)},{once:true})}var e=document.getElementById("tutor-backend-filter-category");if(e){e.addEventListener("change",function(t){window.location=l("category",t.target.value)},{once:true})}var r=document.getElementById("tutor-backend-filter-order");if(r){r.addEventListener("change",function(t){window.location=l("order",t.target.value)},{once:true})}var n=document.getElementById("tutor-admin-search-filter-form");var o=document.getElementById("tutor-backend-filter-search");if(n){o.addEventListener("search",function(t){var e=t.currentTarget||{},r=e.value;if(/\S+/.test(r)==false){window.location=l("search","")}});n.onsubmit=function(t){t.preventDefault();var e=o.value;window.location=l("search",e)}}var i=document.getElementById("tutor-admin-bulk-action-btn");var a=document.querySelector(".tutor-bulk-modal-disabled");if(i){i.onclick=function(){var t=[];var e=document.querySelectorAll(".tutor-bulk-checkbox");var r=_(e),n;try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.checked){t.push(o.value)}}}catch(t){r.e(t)}finally{r.f()}if(t.length){a.setAttribute("id","tutor-bulk-confirm-popup")}else{tutor_toast(w("Warning","tutor"),w("Nothing was selected for bulk action.","tutor"),"error");if(a.hasAttribute("id")){a.removeAttribute("id")}}}}var v=document.getElementById("tutor-admin-bulk-action-form");if(v){v.onsubmit=function(){var e=b(O().mark(function t(r){var n,o,i,a,u,c,s,l,d,f,p,h;return O().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:r.preventDefault();r.stopPropagation();n=new FormData(v);o=[];i=document.querySelectorAll(".tutor-bulk-checkbox");a=_(i);try{for(a.s();!(u=a.n()).done;){c=u.value;if(c.checked){o.push(c.value)}}}catch(t){a.e(t)}finally{a.f()}if(o.length){e.next=10;break}alert(w("Select checkbox for action","tutor"));return e.abrupt("return");case 10:n.set("bulk-ids",o);n.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);e.prev=12;s=document.querySelector("#tutor-confirm-bulk-action[data-tutor-modal-submit]");s.classList.add("is-loading");e.next=17;return fetch(window._tutorobject.ajaxurl,{method:"POST",body:n});case 17:l=e.sent;s.classList.remove("is-loading");if(!l.ok){e.next=24;break}e.next=22;return l.json();case 22:d=e.sent;if(d.success){location.reload()}else{f=d.data||{},p=f.message,h=p===void 0?w("Something went wrong, please try again ","tutor"):p;tutor_toast(w("Failed","tutor"),h,"error")}case 24:e.next=29;break;case 26:e.prev=26;e.t0=e["catch"](12);console.log(e.t0);case 29:case"end":return e.stop()}},t,null,[[12,26]])}));return function(t){return e.apply(this,arguments)}}()}var s=document.getElementById("tutor-confirm-bulk-action");if(s){s.onclick=function(){var t=document.createElement("input");t.type="submit";v.appendChild(t);t.click();t.remove()}}function l(t,e){var r=new URL(window.location.href);var n=r.searchParams;n.set(t,e);n.set("paged",1);return r}var d=document.querySelector("#tutor-bulk-checkbox-all");if(d){d.addEventListener("click",function(){var t=document.querySelectorAll(".tutor-bulk-checkbox");t.forEach(function(t){if(d.checked){t.checked=true}else{t.checked=false}})})}var f=document.querySelectorAll(".tutor-admin-course-delete");var p=_(f),h;try{for(p.s();!(h=p.n()).done;){var m=h.value;m.onclick=function(t){var e=t.currentTarget.dataset.id;if(c){console.log(c);c.elements.action.value="tutor_course_delete";c.elements.id.value=e}}}}catch(t){p.e(t)}finally{p.f()}if(c){c.onsubmit=function(){var e=b(O().mark(function t(r){var n,o,i,a;return O().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:r.preventDefault();n=new FormData(c);o=c.querySelector("[data-tutor-modal-submit]");o.classList.add("is-loading");e.next=6;return y(n);case 6:i=e.sent;if(u.classList.contains("tutor-is-active")){u.classList.remove("tutor-is-active")}if(!i.ok){e.next=14;break}e.next=11;return i.json();case 11:a=e.sent;o.classList.remove("is-loading");if(a){if(q(a)==="object"&&a.success){tutor_toast(w("Delete","tutor"),a.data,"success");location.reload()}else if(q(a)==="object"&&a.success===false){tutor_toast(w("Failed","tutor"),a.data,"error")}else{tutor_toast(w("Delete","tutor"),w("Succefully deleted ","tutor"),"success");location.reload()}}else{tutor_toast(w("Failed","tutor"),w("Delete failed ","tutor"),"error")}case 14:case"end":return e.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()}function y(t){return g.apply(this,arguments)}function g(){g=b(O().mark(function t(r){var n;return O().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:e.prev=0;e.next=3;return fetch(window._tutorobject.ajaxurl,{method:"POST",body:r});case 3:n=e.sent;return e.abrupt("return",n);case 7:e.prev=7;e.t0=e["catch"](0);tutor_toast(w("Operation failed","tutor"),e.t0,"error");case 10:case"end":return e.stop()}},t,null,[[0,7]])}));return g.apply(this,arguments)}});function E(t){return e.apply(this,arguments)}function e(){e=b(O().mark(function t(r){var n;return O().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:e.prev=0;e.next=3;return fetch(window._tutorobject.ajaxurl,{method:"POST",body:r});case 3:n=e.sent;return e.abrupt("return",n);case 7:e.prev=7;e.t0=e["catch"](0);tutor_toast(w("Operation failed","tutor"),e.t0,"error");case 10:case"end":return e.stop()}},t,null,[[0,7]])}));return e.apply(this,arguments)}function C(t){"@babel/helpers - typeof";return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function z(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */z=function t(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,d=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function t(e,r,n){return e[r]=n}}function u(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,i=Object.create(o.prototype),a=new S(n||[]);return d(i,"_invoke",{value:w(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var s={};function c(){}function p(){}function h(){}var v={};i(v,o,function(){return this});var m=Object.getPrototypeOf,y=m&&m(m(L([])));y&&y!==t&&l.call(y,o)&&(v=y);var g=h.prototype=c.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(u,c){function s(t,e,r,n){var o=f(u[t],u,e);if("throw"!==o.type){var i=o.arg,a=i.value;return a&&"object"==C(a)&&l.call(a,"__await")?c.resolve(a.__await).then(function(t){s("next",t,r,n)},function(t){s("throw",t,r,n)}):c.resolve(a).then(function(t){i.value=t,r(i)},function(t){return s("throw",t,r,n)})}n(o.arg)}var o;d(this,"_invoke",{value:function t(r,n){function e(){return new c(function(t,e){s(r,n,t,e)})}return o=o?o.then(e,e):e()}})}function w(i,a,u){var c="suspendedStart";return function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){var n=x(r,u);if(n){if(n===s)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(undefined===n)return e.delegate=null,"throw"===r&&t.iterator["return"]&&(e.method="return",e.arg=undefined,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:E}}function E(){return{value:undefined,done:!0}}return p.prototype=h,d(g,"constructor",{value:h,configurable:!0}),d(h,"constructor",{value:p,configurable:!0}),p.displayName=i(h,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,i(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new _(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=L,S.prototype={constructor:S,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&l.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=undefined)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(r){if(this.done)throw r;var n=this;function e(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=undefined),!!e}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var u=l.call(i,"catchLoc"),c=l.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function t(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&l.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),s},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),s}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=undefined),s}},a}function l(t,e,r,n,o,i,a){try{var u=t[i](a);var c=u.value}catch(t){r(t);return}if(u.done){e(c)}else{Promise.resolve(c).then(n,o)}}function A(u){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=u.apply(t,a);function o(t){l(n,e,r,o,i,"next",t)}function i(t){l(n,e,r,o,i,"throw",t)}o(undefined)})}}function T(t){return Q(t)||i(t)||o(t)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){if(!t)return;if(typeof t==="string")return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}function i(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Q(t){if(Array.isArray(t))return a(t)}function a(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}jQuery(document).ready(function(t){t(".tutor-sortable-list").sortable()});document.addEventListener("DOMContentLoaded",function(t){var e=wp.i18n,p=e.__,r=e._x,n=e._n,o=e._nx;var i=document.querySelector(".tutor-lesson-sidebar.tutor-desktop-sidebar");var a=document.querySelector(".tutor-sidebar-toggle-anchor");if(i&&a){a.addEventListener("click",function(){if(getComputedStyle(i).flex==="0 0 400px"){i.style.flex="0 0 0px";i.style.display="none"}else{i.style.display="block";i.style.flex="0 0 400px"}})}var u=document.querySelector(".tutor-sidebar-tabs-content");if(u){var c=u.getBoundingClientRect().top;u.style.height="calc(100vh - ".concat(c,"px)")}var s=function t(i){var e=document.querySelector(".tutor-desktop-sidebar-area");if(null!==e&&e.children.length<2){return}i.forEach(function(t){t.addEventListener("click",function(t){var e=t.currentTarget.parentNode.nextElementSibling;a(e);t.currentTarget.classList.add("active");var r=t.currentTarget.getAttribute("data-sidebar-tab");var n=e.querySelector("#"+r);n.classList.add("active");var o=document.querySelector(".tutor-lessons-tab-area");var i=o.offsetHeight;if(r=="sidebar-qna-tab-content"){n.style.height="calc(100% - ".concat(i,"px)")}})});var a=function t(e){for(var r=0;r<i.length;r++){i[r].classList.remove("active")}var n=e.querySelectorAll(".tutor-lesson-sidebar-tab-item");for(var o=0;o<n.length;o++){n[o].classList.remove("active")}}};var l=document.querySelectorAll(".tutor-desktop-sidebar-area .tutor-sidebar-tab-item");var d=document.querySelectorAll(".tutor-mobile-sidebar-area .tutor-sidebar-tab-item");if(l){s(l)}if(d){s(d)}var f=document.querySelectorAll(".tutor-comment-textarea textarea");if(f){f.forEach(function(t){t.addEventListener("focus",function(){t.parentElement.classList.add("is-focused")});t.addEventListener("blur",function(){t.parentElement.classList.remove("is-focused")})})}function h(){var t=document.querySelectorAll(".tutor-comments-list.tutor-parent-comment");var a=document.querySelector(".tutor-comment-box.tutor-reply-box");if(t){T(t).forEach(function(t){var e=t.querySelectorAll(".tutor-comments-list.tutor-child-comment");var r=t.querySelector(".tutor-comment-line");var n=e.length;if(e[n-1]){var o=e[n-1].clientHeight;var i=o+a.clientHeight+20-25+50;r.style.setProperty("height","calc(100% - ".concat(i,"px)"))}})}}h();window.addEventListener(_tutorobject.content_change_event,h);var v=document.querySelectorAll(".tutor-draggable > div");var m=document.querySelectorAll(".tutor-dropzone");v.forEach(function(t){t.addEventListener("dragstart",g);t.addEventListener("dragend",b)});v.forEach(function(e){["touchstart","touchmove","touchend"].forEach(function(t){e.addEventListener(t,y)})});m.forEach(function(t){t.addEventListener("dragover",_);t.addEventListener("dragenter",w);t.addEventListener("dragleave",x);t.addEventListener("drop",j)});function y(t){t.preventDefault();var e=t.type;if(e==="touchstart"){this.classList.add("tutor-dragging")}else if(e==="touchmove"){var r=document.querySelector(".tutor-drag-copy");if(t.target.classList.contains("tutor-dragging")){var n=t.target.getBoundingClientRect();if(!r){r=t.target.cloneNode(true);r.classList.add("tutor-drag-copy");t.target.parentNode.appendChild(r)}r.style.position="fixed";r.style.left=t.touches[0].clientX-r.clientWidth/2+"px";r.style.top=t.touches[0].clientY-r.clientHeight/2+"px";r.style.zIndex="9999";r.style.opacity="0.5";r.style.width=n.width+"px";r.style.height=n.height+"px"}}else if(e==="touchend"){var o=document.querySelector(".tutor-drag-copy");if(o){o.remove();var i=typeof t.originalEvent==="undefined"?t:t.originalEvent;var a=i.touches[0]||i.changedTouches[0];var u=[a.clientX,a.clientY],c=u[0],s=u[1];var l=document.elementFromPoint(c,s);if(l.classList.contains("tutor-dropzone")||l.closest(".tutor-dropzone")){if(!l.classList.contains("tutor-dropzone")){l=l.closest(".tutor-dropzone")}var d=o.querySelector("input");var f=d.dataset.name;var p=document.createElement("input");p.type="text";p.setAttribute("value",d.value);p.setAttribute("name",f);l.appendChild(p);var h=o.querySelector(".tutor-dragging-text-conent").textContent;l.querySelector(".tutor-dragging-text-conent").textContent=h;this.classList.remove("tutor-dragging")}}}}function g(){this.classList.add("tutor-dragging")}function b(){this.classList.remove("tutor-dragging")}function _(t){this.classList.add("tutor-drop-over");t.preventDefault()}function w(){}function x(){this.classList.remove("tutor-drop-over")}function j(){var t=document.querySelector(".tutor-quiz-border-box.tutor-dragging");if(this.querySelector("input")){this.querySelector("input").remove()}var e=t.querySelector("input");var r=e.dataset.name;var n=document.createElement("input");n.type="text";n.setAttribute("value",e.value);n.setAttribute("name",r);this.appendChild(n);var o=t.querySelector(".tutor-dragging-text-conent").textContent;this.querySelector(".tutor-dragging-text-conent").textContent=o;this.classList.remove("tutor-drop-over")}var k=document.getElementById("tutor-assignment-file-upload");if(k){k.addEventListener("change",S)}function S(){var t;var e=T(k.files).reduce(function(t,e){return t+e.size},0);var r=parseInt((t=document.querySelector('input[name="tutor_assignment_upload_limit"]'))===null||t===void 0?void 0:t.value)||0;var n="";var o=window._tutorobject.assignment_max_file_allowed;var i=document.querySelectorAll("#tutor-student-assignment-edit-file-preview .tutor-instructor-card").length;var a=o-i;if(k.files.length>a){k.value=null;tutor_toast(p("Warning","tutor"),p("Max ".concat(o," file allowed to upload"),"tutor"),"error");return}if(e>r){k.value=null;tutor_toast(p("Warning","tutor"),p("File size exceeds maximum limit ".concat(Math.floor(r/1e6)," MB."),"tutor"),"error");return}if("files"in k){if(k&&k.files.length==0){n="Select one or more files."}else{if(k.files.length>a){tutor_toast(p("Warning","tutor"),p("Max ".concat(o," file allowed to upload"),"tutor"),"error")}var u="";var c=document.querySelector(".tutor-asisgnment-upload-file-preview");var s=document.getElementById("tutor-student-assignment-edit-file-preview");for(var l=0;l<a;l++){var d=k.files[l];if(!d){continue}var f=s?"tutor-col-sm-5 tutor-py-16 tutor-mr-16":"";u+='<div class="tutor-instructor-card '.concat(f,'">\n <div class="tutor-icard-content">\n <div class="tutor-fs-6 tutor-color-secondary">\n ').concat(d.name,'\n </div>\n <div class="tutor-fs-7">Size: ').concat(d.size,'</div>\n </div>\n <div onclick="(() => {\n\t\t\t\t\t\t\t\t\t\tthis.closest(\'.tutor-instructor-card\').remove();\n\t\t\t\t\t\t\t\t\t})()" class="tutor-attachment-file-close tutor-iconic-btn tutor-iconic-btn-outline flex-center">\n <span class="tutor-icon-times"></span>\n </div>\n </div>')}if(c){c.innerHTML=u}if(s){s.insertAdjacentHTML("beforeend",u)}}}}var L=document.querySelectorAll(".tutor-attachment-file-close a");L.forEach(function(t){t.onclick=function(){var e=A(z().mark(function t(r){var n,o,i,a,u,c,s;return z().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:r.preventDefault();n=r.currentTarget;o=n.dataset.name;i=n.dataset.id;a=new FormData;a.set("action","tutor_remove_assignment_attachment");a.set("assignment_comment_id",i);a.set("file_name",o);a.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);u=n.querySelector("span");r.target.classList.add("is-loading");e.next=13;return E(a);case 13:c=e.sent;if(!c.ok){e.next=21;break}e.next=17;return c.json();case 17:s=e.sent;if(!s){tutor_toast(p("Warning","tutor"),p("Attachment remove failed","tutor"),"error")}else{n.closest(".tutor-instructor-card").remove()}e.next=23;break;case 21:alert(c.statusText);r.target.classList.remove("is-loading");case 23:case"end":return e.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()})});var B=Ot(7942);var G=Ot(818);var R=Ot(3419);var U=Ot(6470);var Y=Ot(1103);var H=Ot(7723);function u(t){"@babel/helpers - typeof";return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function W(t,e){return V(t)||X(t,e)||J(t,e)||$()}function $(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(t,e){if(!t)return;if(typeof t==="string")return d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,e)}function d(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function X(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r["return"]&&(a=r["return"](),Object(a)!==a))return}finally{if(s)throw o}}return u}}function V(t){if(Array.isArray(t))return t}function K(t,e,r){e=Z(e);if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function Z(t){var e=tt(t,"string");return u(e)==="symbol"?e:String(e)}function tt(t,e){if(u(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==undefined){var n=r.call(t,e||"default");if(u(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}if(!window.tutor_get_nonce_data){window.tutor_get_nonce_data=function(t){var e=window._tutorobject||{};var r=e.nonce_key||"";var n=e[r]||"";if(t){return{key:r,value:n}}return K({},r,n)}}function et(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var a=new FormData;t.forEach(function(t){for(var e=0,r=Object.entries(t);e<r.length;e++){var n=W(r[e],2),o=n[0],i=n[1];a.set(o,i)}});a.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);return a}const rt=et;function P(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */P=function t(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,d=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function t(e,r,n){return e[r]=n}}function u(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,i=Object.create(o.prototype),a=new S(n||[]);return d(i,"_invoke",{value:w(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var s={};function c(){}function p(){}function h(){}var v={};i(v,o,function(){return this});var m=Object.getPrototypeOf,y=m&&m(m(L([])));y&&y!==t&&l.call(y,o)&&(v=y);var g=h.prototype=c.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(u,c){function s(t,e,r,n){var o=f(u[t],u,e);if("throw"!==o.type){var i=o.arg,a=i.value;return a&&"object"==D(a)&&l.call(a,"__await")?c.resolve(a.__await).then(function(t){s("next",t,r,n)},function(t){s("throw",t,r,n)}):c.resolve(a).then(function(t){i.value=t,r(i)},function(t){return s("throw",t,r,n)})}n(o.arg)}var o;d(this,"_invoke",{value:function t(r,n){function e(){return new c(function(t,e){s(r,n,t,e)})}return o=o?o.then(e,e):e()}})}function w(i,a,u){var c="suspendedStart";return function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){var n=x(r,u);if(n){if(n===s)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(undefined===n)return e.delegate=null,"throw"===r&&t.iterator["return"]&&(e.method="return",e.arg=undefined,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:E}}function E(){return{value:undefined,done:!0}}return p.prototype=h,d(g,"constructor",{value:h,configurable:!0}),d(h,"constructor",{value:p,configurable:!0}),p.displayName=i(h,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,i(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new _(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=L,S.prototype={constructor:S,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&l.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=undefined)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(r){if(this.done)throw r;var n=this;function e(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=undefined),!!e}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var u=l.call(i,"catchLoc"),c=l.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function t(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&l.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),s},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),s}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=undefined),s}},a}function f(t,e,r,n,o,i,a){try{var u=t[i](a);var c=u.value}catch(t){r(t);return}if(u.done){e(c)}else{Promise.resolve(c).then(n,o)}}function nt(u){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=u.apply(t,a);function o(t){f(n,e,r,o,i,"next",t)}function i(t){f(n,e,r,o,i,"throw",t)}o(undefined)})}}function x(t){return ut(t)||at(t)||it(t)||ot()}function ot(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function it(t,e){if(!t)return;if(typeof t==="string")return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p(t,e)}function at(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ut(t){if(Array.isArray(t))return p(t)}function p(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function D(t){"@babel/helpers - typeof";return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}var ct=wp.i18n.__;var st=["keyword","course_order","tutor-course-filter-level","tutor-course-filter-tag","tutor-course-filter-category","tutor-course-filter-price","course_filter","supported_filters","current_page","action"];var lt=function t(o){var i=new URL(window.location.origin+window.location.pathname);var e=j();for(var r in e){if(st.indexOf(r)==-1){i.searchParams.append(r,e[r])}}var n=function t(){var e=Array.isArray(o[a]);var r=e?a+"[]":a;var n=e?o[a]:[o[a]];n.forEach(function(t){if(D(t)!="object"){i.searchParams.append(r,t)}})};for(var a in o){n()}window.history.pushState({},"",i)};var j=function t(){var n={};new URL(window.location).searchParams.forEach(function(t,e){if(e.slice(-2)=="[]"){var r=e.slice(0,-2);!n[r]?n[r]=[]:0;!Array.isArray(n[r])?n[r]=[n[r]]:0;n[r].push(t)}else{n[e]=t}});return n};var k=function t(o){var i=j();o.find('[type="checkbox"]').prop("checked",false);o.find('[type="text"], select').val("");var e=function t(){var e=i[a];var r=o.find('[name="'+a+'"]');if(r.eq(0).attr("type")=="checkbox"){var n=!Array.isArray(e)?[e]:e;r.each(function(){var t=n.indexOf(window.jQuery(this).attr("value"))>-1;window.jQuery(this).prop("checked",t)})}else{r.val(e)}};for(var a in i){e()}};window.jQuery(document).ready(function(h){var v=window.wp.i18n.__;var m=h("[tutor-course-filter] form");if(!m.length){return}var y=h("[tutor-course-list-container]");var g=h(".tutor-courses-wrap").data("tutor_courses_meta")||{};var b={};m.on("submit",function(t){t.preventDefault()}).find("input,select").on("change",function(t){e()});k(m);window.addEventListener("popstate",function(){k(m);e(false,true)});var e=function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var n=j();var o=Object.assign(m.serializeObject(),b,g);o.current_page=r&&n.current_page?n.current_page:1;o.action="tutor_course_filter_ajax";if(e){lt(o)}y.html('<div class="tutor-spinner-wrap"><span class="tutor-spinner" area-hidden="true"></span></div>');m.find("[action-tutor-clear-filter]").closest(".tutor-widget-course-filter").removeClass("tutor-d-none");if(!("category"in o.supported_filters)){var i="tutor-course-filter-category";var a=Object.keys(n).filter(function(t){return t.includes(i)});if(a.length>0){var u=[];a.forEach(function(t){u.push(n[t])});o["tutor-course-filter-category"]=x(new Set(u))}else{o["tutor-course-filter-category"]=JSON.parse(h("#course_filter_categories").val())}}var c="tutor-course-filter-exclude-ids";var s=Object.keys(n).filter(function(t){return t.includes(c)});var l=[];if(s.length>0){s.forEach(function(t){l.push(n[t])});o["tutor-course-filter-exclude-ids"]=x(new Set(l))}else{if(h("#course_filter_exclude_ids").length){o["tutor-course-filter-exclude-ids"]=JSON.parse(h("#course_filter_exclude_ids").val())}}var d="tutor-course-filter-post-ids";var f=Object.keys(n).filter(function(t){return t.includes(d)});var p=[];if(f.length>0){f.forEach(function(t){p.push(n[t])});o["tutor-course-filter-post-ids"]=x(new Set(p))}else{if(h("#course_filter_post_ids").length){o["tutor-course-filter-post-ids"]=JSON.parse(h("#course_filter_post_ids").val())}}h.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:o,success:function t(e){if(!e.success){y.html(v("Could not load courses","tutor"));return}y.html(e.data.html).find("nav").css("display","flex")}})};h("[tutor-toggle-course-filter]").on("click",function(t){t.preventDefault();h("body").toggleClass("tutor-course-filter-open");if(h(".tutor-course-filter-backdrop").length==0){h("body").append(h('<div class="tutor-course-filter-backdrop" area-hidden="true"></div>').hide().fadeIn(150))}});h("[tutor-hide-course-filter]").on("click",function(t){t.preventDefault();h("body").removeClass("tutor-course-filter-open")});var t=document.querySelectorAll(".tutor-course-list-enroll");t.forEach(function(t){t.onclick=function(){var e=nt(P().mark(function t(r){var n,o,i,a,u,c,s,l;return P().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:r.preventDefault();n=v("Something went wrong, please try again!","tutor");o=r.target;i=[{action:"tutor_course_enrollment"},{course_id:o.dataset.courseId}];a=rt(i);o.classList.add("is-loading");o.setAttribute("disabled",true);e.next=9;return E(a);case 9:u=e.sent;if(!u.ok){e.next=19;break}e.next=13;return u.json();case 13:c=e.sent;console.log(c);s=c.success,l=c.data;if(s){tutor_toast(v("Success","tutor-pro"),l,"success");window.location.href=o.href}else{tutor_toast(v("Failed","tutor-pro"),l?l:n,"error")}e.next=20;break;case 19:tutor_toast(v("Error","tutor-pro"),v(n),"error");case 20:o.classList.remove("is-loading");o.removeAttribute("disabled");case 22:case"end":return e.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()})});window.jQuery(document).ready(function(r){r(document).on("click",".tutor-course-entry-box-login button, .tutor-course-entry-box-login a, .tutor-open-login-modal",function(t){t.preventDefault();var e=r(this).data("login_url")||r(this).closest(".tutor-course-entry-box-login").data("login_url");if(e){window.location.assign(e)}else{r(".tutor-login-modal").addClass("tutor-is-active")}})});var dt=Ot(6966);var ft=Ot(787);var pt=Ot(1974);var ht=Ot(6344);function I(t){"@babel/helpers - typeof";return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function N(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */N=function t(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,d=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function t(e,r,n){return e[r]=n}}function u(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,i=Object.create(o.prototype),a=new S(n||[]);return d(i,"_invoke",{value:w(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var s={};function c(){}function p(){}function h(){}var v={};i(v,o,function(){return this});var m=Object.getPrototypeOf,y=m&&m(m(L([])));y&&y!==t&&l.call(y,o)&&(v=y);var g=h.prototype=c.prototype=Object.create(v);function b(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function _(u,c){function s(t,e,r,n){var o=f(u[t],u,e);if("throw"!==o.type){var i=o.arg,a=i.value;return a&&"object"==I(a)&&l.call(a,"__await")?c.resolve(a.__await).then(function(t){s("next",t,r,n)},function(t){s("throw",t,r,n)}):c.resolve(a).then(function(t){i.value=t,r(i)},function(t){return s("throw",t,r,n)})}n(o.arg)}var o;d(this,"_invoke",{value:function t(r,n){function e(){return new c(function(t,e){s(r,n,t,e)})}return o=o?o.then(e,e):e()}})}function w(i,a,u){var c="suspendedStart";return function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){var n=x(r,u);if(n){if(n===s)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(undefined===n)return e.delegate=null,"throw"===r&&t.iterator["return"]&&(e.method="return",e.arg=undefined,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,s;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=undefined),e.delegate=null,s):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=undefined,t.done=!0,t};return n.next=n}}return{next:E}}function E(){return{value:undefined,done:!0}}return p.prototype=h,d(g,"constructor",{value:h,configurable:!0}),d(h,"constructor",{value:p,configurable:!0}),p.displayName=i(h,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,i(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new _(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},b(g),i(g,n,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=L,S.prototype={constructor:S,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&l.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=undefined)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(r){if(this.done)throw r;var n=this;function e(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=undefined),!!e}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var u=l.call(i,"catchLoc"),c=l.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function t(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&l.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),s},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),s}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=undefined),s}},a}function h(t,e,r,n,o,i,a){try{var u=t[i](a);var c=u.value}catch(t){r(t);return}if(u.done){e(c)}else{Promise.resolve(c).then(n,o)}}function vt(u){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=u.apply(t,a);function o(t){h(n,e,r,o,i,"next",t)}function i(t){h(n,e,r,o,i,"throw",t)}o(undefined)})}}var v=wp.i18n,m=v.__,mt=v._x,yt=v._n,gt=v._nx;document.addEventListener("DOMContentLoaded",function(){var u=document.getElementById("tutor-create-new-course");if(u){u.onclick=function(){var e=vt(N().mark(function t(r){var n,o,i,a;return N().wrap(function t(e){while(1)switch(e.prev=e.next){case 0:r.preventDefault();u.setAttribute("disabled","disabled");u.classList.add("is-loading");n=m("Something went wrong, please try again","tutor");o=new FormData;o.set("action","tutor_create_new_draft_course");o.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);e.next=9;return E(o);case 9:i=e.sent;if(!i.ok){e.next=18;break}u.classList.remove("is-loading");e.next=14;return i.json();case 14:a=e.sent;if(a.success){window.location=a.data.url}else{if(a.data.error_message){tutor_toast(m("Failed","tutor"),a.data.error_message,"error")}else{tutor_toast(m("Failed","tutor"),n,"error")}}e.next=19;break;case 18:tutor_toast(m("Failed","tutor"),n,"error");case 19:case"end":return e.stop()}},t)}));return function(t){return e.apply(this,arguments)}}()}var e=document.getElementById("tutor-course-save-draft");if(e){e.onclick=function(t){t.preventDefault();e.setAttribute("disabled","disabled");e.classList.add("is-loading");document.getElementById("tutor-frontend-course-builder").submit()}}var t=jQuery(".tutor-table-responsive .tutor-table .tutor-dropdown");if(t.length){var r=jQuery(".tutor-table-responsive .tutor-table").height();jQuery(".tutor-table-responsive").css("min-height",r+110)}});var bt=Ot(1626);var _t=Ot(9834);var wt=Ot(1033);var xt=Ot(4367);function jt(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}return t.replace(/%s/g,function(){return r.shift()})}const kt=jt;function y(t){"@babel/helpers - typeof";return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function St(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach(function(t){Lt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Lt(t,e,r){e=Et(e);if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function Et(t){var e=qt(t,"string");return y(e)==="symbol"?e:String(e)}function qt(t,e){if(y(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==undefined){var n=r.call(t,e||"default");if(y(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}readyState_complete(function(){Object.entries(document.getElementsByTagName("a")).forEach(function(t){var e=t[1].getAttribute("href");if(e!==null&&e!==void 0&&e.includes("/logout")||e!==null&&e!==void 0&&e.includes("logout")){t[1].setAttribute("data-no-instant","")}})});jQuery(document).ready(function(l){"use strict";var t=wp.i18n,d=t.__,e=t._x,r=t._n,n=t._nx;if(jQuery().select2){l(".tutor_select2").select2({escapeMarkup:function t(e){return e}})}
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/!function(e){function r(t,e){if(!(t.originalEvent.touches.length>1)){t.preventDefault();var r=t.originalEvent.changedTouches[0],n=document.createEvent("MouseEvents");n.initMouseEvent(e,!0,!0,window,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(n)}}if(e.support.touch="ontouchend"in document,e.support.touch){var n,t=e.ui.mouse.prototype,o=t._mouseInit,i=t._mouseDestroy;t._touchStart=function(t){var e=this;!n&&e._mouseCapture(t.originalEvent.changedTouches[0])&&(n=!0,e._touchMoved=!1,r(t,"mouseover"),r(t,"mousemove"),r(t,"mousedown"))},t._touchMove=function(t){n&&(this._touchMoved=!0,r(t,"mousemove"))},t._touchEnd=function(t){n&&(r(t,"mouseup"),r(t,"mouseout"),this._touchMoved||r(t,"click"),n=!1)},t._mouseInit=function(){var t=this;t.element.bind({touchstart:e.proxy(t,"_touchStart"),touchmove:e.proxy(t,"_touchMove"),touchend:e.proxy(t,"_touchEnd")}),o.call(t)},t._mouseDestroy=function(){var t=this;t.element.unbind({touchstart:e.proxy(t,"_touchStart"),touchmove:e.proxy(t,"_touchMove"),touchend:e.proxy(t,"_touchEnd")}),i.call(t)}}}(jQuery);var o={ajaxurl:window._tutorobject.ajaxurl,nonce_key:window._tutorobject.nonce_key,played_once:false,max_seek_time:0,video_data:function t(){var e=l("#tutor_video_tracking_information").val();return e?JSON.parse(e):{}},track_player:function t(){var u=this;if(typeof Plyr!=="undefined"){var o;var c=u.video_data();var s=new Plyr(this.player_DOM,{keyboard:{focused:u.isRequiredPercentage()?false:true,global:false},listeners:St({},u.isRequiredPercentage()&&{seek:function t(e){var r=u.getTargetTime(s,e);var n=s.currentTime;var o=n>u.max_seek_time?n:u.max_seek_time;if(r>o){e.preventDefault();tutor_toast(d("Warning","tutor"),d("Forward seeking is disabled","tutor"),"error");return false}return true}})});s.on("ready",function(t){var e=t.detail.plyr;var r=c||{},n=r.best_watch_time,o=n===void 0?0:n;if(_tutorobject.tutor_pro_url&&o>0){var i=Math.floor(o);var a=setTimeout(function(){if(s.playing!==true&&s.currentTime!==i){if(e.provider==="youtube"){e.embed.seekTo(o)}else{e.media.currentTime=0}}else{clearTimeout(a)}})}u.sync_time(e)});s.on("play",function(t){u.played_once=true;var e=10;var r=t.detail.plyr;o=setInterval(function(){u.sync_time(r)},e*1e3);if(_tutorobject.tutor_pro_url&&s.provider==="youtube"){l(".plyr--youtube.plyr__poster-enabled .plyr__poster").css("opacity",0)}});s.on("pause",function(t){clearInterval(o);var e=t.detail.plyr;u.sync_time(e)});s.on("ended",function(t){clearInterval(o);var e=u.video_data();var r=t.detail.plyr;var n={is_ended:true};u.sync_time(r,n);if(e.autoload_next_course_content&&u.played_once){u.autoload_content()}if(_tutorobject.tutor_pro_url&&s.provider==="youtube"){l(".plyr--youtube.plyr__poster-enabled .plyr__poster").css("opacity",1)}})}},sync_time:function t(e,r){var n=this.video_data();if(!n){return}if(this.isRequiredPercentage()){this.enable_complete_lesson_btn(e)}var o={action:"sync_video_playback",currentTime:e.currentTime,duration:e.duration,post_id:n.post_id};o[this.nonce_key]=_tutorobject[this.nonce_key];var i=o;if(r){i=Object.assign(o,r)}l.post(this.ajaxurl,i);var a=n.best_watch_time>e.currentTime?n.best_watch_time:e.currentTime;if(a>this.max_seek_time){this.max_seek_time=a}},autoload_content:function t(){console.log("Autoloader called");var e=this.video_data().post_id;var r={action:"autoload_next_course_content",post_id:e};r[this.nonce_key]=_tutorobject[this.nonce_key];l.post(this.ajaxurl,r).done(function(t){console.log(t);if(t.success&&t.data.next_url){location.href=t.data.next_url}})},isRequiredPercentage:function t(){var e=this.video_data();if(!e){return false}var r=e.strict_mode,n=e.control_video_lesson_completion,o=e.lesson_completed,i=e.is_enrolled;if(_tutorobject.tutor_pro_url&&i&&!o&&r&&n){return true}return false},enable_complete_lesson_btn:function t(e){var r=l('button[name="complete_lesson_btn"]');var n=this.video_data();var o=this.getPercentage(Number(e.currentTime),Number(e.duration));if(o>=n.required_percentage){r.attr("disabled",false);r.next().remove()}},disable_complete_lesson_btn:function t(){var e=this.video_data();if(!e){return}var r=e.best_watch_time,n=e.video_duration,o=e.required_percentage;var i=this.getPercentage(Number(r),Number(n));if(i<o){var a=l('button[name="complete_lesson_btn"]');a.attr("disabled",true);a.wrap('<div class="tooltip-wrap"></div>').after('<span class="tooltip-txt tooltip-bottom">'.concat(kt(d("Watch at least %s% to complete the lesson.","tutor"),e.required_percentage),"</span>"))}},getPercentage:function t(e,r){if(e>0&&r>0){return Math.round(e/r*100)}return 0},getTargetTime:function t(e,r){if(y(r)==="object"&&(r.type==="input"||r.type==="change")){return r.target.value/r.target.max*e.media.duration}else{return Number(r)}},init:function t(e){this.player_DOM=e;this.track_player();if(this.isRequiredPercentage()){this.disable_complete_lesson_btn()}}};l(".tutorPlayer").each(function(){o.init(this)});l(document).on("change keyup paste",".tutor_user_name",function(){l(this).val(i(l(this).val()))});function i(t){return t.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}l(document).on("click",".tutor_question_cancel",function(t){t.preventDefault();l(".tutor-add-question-wrap").toggle()});l(".tooltip-btn").on("hover",function(t){l(this).toggleClass("active")});l(".tutor-course-title h4 .toggle-information-icon").on("click",function(t){l(this).closest(".tutor-topics-in-single-lesson").find(".tutor-topics-summery").slideToggle();t.stopPropagation()});l(".tutor-course-topic.tutor-active").find(".tutor-course-lessons").slideDown();l(".tutor-course-title").on("click",function(){var t=l(this).siblings(".tutor-course-lessons");l(this).closest(".tutor-course-topic").toggleClass("tutor-active");t.slideToggle()});l(document).on("click",".tutor-topics-title h3 .toggle-information-icon",function(t){l(this).closest(".tutor-topics-in-single-lesson").find(".tutor-topics-summery").slideToggle();t.stopPropagation()});l(document).on("click","[tutor-course-topics-sidebar-toggler]",function(t){t.preventDefault();l(".tutor-course-single-content-wrapper").toggleClass("tutor-course-single-sidebar-hidden")});l("[tutor-course-topics-sidebar-offcanvas-toggler]").on("click",function(t){t.preventDefault();l(".tutor-course-single-content-wrapper").toggleClass("tutor-course-single-sidebar-open");l("body").toggleClass("tutor-overflow-hidden")});l("[tutor-hide-course-single-sidebar]").on("click",function(t){t.preventDefault();console.log("Hello");l(".tutor-course-single-content-wrapper").removeClass("tutor-course-single-sidebar-open");l("body").removeClass("tutor-overflow-hidden")});l(".tutor-tabs-btn-group a").on("click touchstart",function(t){t.preventDefault();var e=l(this);var r=e.attr("href");l(".tutor-lesson-sidebar-tab-item").hide();l(r).show();l(".tutor-tabs-btn-group a").removeClass("active");e.addClass("active")});var a=l(".quiz-draggable-rand-answers").length;if(a){l(".quiz-draggable-rand-answers").each(function(){var t=l(this);var e=t.height();t.css({height:e})})}if(jQuery.datepicker){l(".tutor_report_datepicker").datepicker({dateFormat:"yy-mm-dd"})}l(document).on("submit","#tutor-withdraw-account-set-form",function(t){if(!t.detail||t.detail==1){t.preventDefault();var e=l(this);var r=e.find(".tutor_set_withdraw_account_btn");var n=e.serializeObject();r.prop("disabled",true);l.ajax({url:_tutorobject.ajaxurl,type:"POST",data:n,beforeSend:function t(){r.addClass("is-loading")},success:function t(e){if(e.success){tutor_toast("Success!",e.data.msg,"success")}},complete:function t(){r.removeClass("is-loading");setTimeout(function(){r.prop("disabled",false)},2e3)}})}});l(document).on("submit","#tutor-earning-withdraw-form",function(t){t.preventDefault();var e=l(this);var r=l("#tutor-earning-withdraw-btn");var n=l(".tutor-withdraw-form-response");var o=e.serializeObject();l.ajax({url:_tutorobject.ajaxurl,type:"POST",data:o,beforeSend:function t(){e.find(".tutor-success-msg").remove();r.attr("disabled","disabled").addClass("is-loading")},success:function t(e){var r;l(".tutor-earning-withdraw-form-wrap").hide();if(e.success){console.log(e.data.available_balance);if(e.data.available_balance!=="undefined"){l(".withdraw-balance-col .available_balance").html(e.data.available_balance)}tutor_toast(d("Request Successful","tutor"),d("Your request has been submitted. Please wait for the administrator's response.","tutor"),"success");setTimeout(function(){location.reload()},500)}else{tutor_toast("Error",e.data.msg,"error");r='<div class="tutor-error-msg inline-image-text is-inline-block"> <img src="'+window._tutorobject.tutor_url+'assets/images/icon-cross.svg"/> <div> <b>Error</b><br/> <span>'+e.data.msg+"</span> </div> </div>";setTimeout(function(){n.html("")},5e3);return false}},complete:function t(){r.removeAttr("disabled").removeClass("is-loading")}})});l(document).on("click",".tutor-dashboard-element-delete-btn",function(t){t.preventDefault();var e=l(this).attr("data-id");l("#tutor-dashboard-delete-element-id").val(e)});l(document).on("submit","#tutor-dashboard-delete-element-form",function(t){t.preventDefault();var r=l("#tutor-dashboard-delete-element-id").val();var e=l(".tutor-modal-element-delete-btn");var n=l(this).serializeObject();l.ajax({url:_tutorobject.ajaxurl,type:"POST",data:n,beforeSend:function t(){e.addClass("is-loading")},success:function t(e){if(e.success){l("#tutor-dashboard-"+e.data.element+"-"+r).remove()}},complete:function t(){e.removeClass("is-loading")}})});l(document).on("submit","#tutor_assignment_start_form",function(t){t.preventDefault();var e=l(this);var r=e.serializeObject();r.action="tutor_start_assignment";l.ajax({url:_tutorobject.ajaxurl,type:"POST",data:r,beforeSend:function t(){l("#tutor_assignment_start_btn").addClass("is-loading")},success:function t(e){if(e.success){location.reload(true)}},error:function t(e,r,n){console.log("assignment start error: "+n)},complete:function t(){l("#tutor_assignment_start_btn").removeClass("is-loading")}})});l(document).on("submit","#tutor_assignment_submit_form",function(t){var e=tinymce.activeEditor.getContent();if(e.trim().length<1){t.preventDefault();tutor_toast(d("Warning","tutor"),d("Assignment answer is required.","tutor"),"error");setTimeout(function(){jQuery("button#tutor_assignment_submit_btn").removeClass("is-loading").removeAttr("disabled")},500)}});l("form").on("change",".tutor-assignment-file-upload",function(){l(this).siblings("label").find("span").html(l(this).val().replace(/.*(\/|\\)/,""))});if(l(".tutor-accordion-item-header.is-active").length===0){l(".tutor-accordion-item-header").first().trigger("click")}l(".tutor-course-builder-section-title").on("click",function(){if(l(this).find("i").hasClass("tutor-icon-angle-up")){l(this).find("i").removeClass("tutor-icon-angle-up").addClass("tutor-icon-angle-down")}else{l(this).find("i").removeClass("tutor-icon-angle-down").addClass("tutor-icon-angle-up")}l(this).next("div").slideToggle()});l(document).on("click","#tutor_profile_photo_button",function(t){t.preventDefault();l("#tutor_profile_photo_file").trigger("click")});l(document).on("change","#tutor_profile_photo_file",function(t){t.preventDefault();var e=this;if(e.files&&e.files[0]){var r=new FileReader;r.onload=function(t){l(".tutor-profile-photo-upload-wrap").find("img").attr("src",t.target.result)};r.readAsDataURL(e.files[0])}});l(document).on("click",".thread-content .subject",function(t){var e=l(this);var r=parseInt(e.closest(".thread-content").attr("data-thread-id"));var n=_tutorobject.nonce_key;var o={thread_id:r,action:"tutor_bp_retrieve_user_records_for_thread"};o[n]=_tutorobject[n];l.ajax({type:"POST",url:window._tutorobject.ajaxurl,data:o,beforeSend:function t(){l("#tutor-bp-thread-wrap").html("")},success:function t(e){if(e.success){l("#tutor-bp-thread-wrap").html(e.data.thread_head_html);u()}}})});function u(){l("ul.tutor-bp-enrolled-course-list").each(function(){var t=l(this);var e=t.find(" > li");var n=3;if(e.length>n){var r=e.length-n;e.each(function(t,e){var r=l(this);if(t>=n){r.hide()}});var o='<a href="javascript:;" class="tutor_bp_plus_courses"><strong>+'+r+" More </strong></a> Courses";t.closest(".tutor-bp-enrolled-courses-wrap").find(".thread-participant-enrolled-info").html(o)}t.show()})}u();l(document).on("click","a.tutor_bp_plus_courses",function(t){t.preventDefault();var e=l(this);e.closest(".tutor-bp-enrolled-courses-wrap").find(".tutor-bp-enrolled-course-list li").show();e.closest(".thread-participant-enrolled-info").html("")});l(".tutor-dropbtn").click(function(){var t=l(this).parent().find(".tutor-dropdown-content");t.slideToggle(100)});l(document).on("click",function(t){var e=l(".tutor-dropdown");var r=e.find(".tutor-dropdown-content");if(!e.is(t.target)&&e.has(t.target).length===0){r.slideUp(100)}});var c=l('.tutor-frontend-builder-course-price [name="tutor_course_price_type"]');if(c.length==0){l("#_tutor_is_course_public_meta_checkbox").show()}else{c.change(function(){if(l(this).prop("checked")){var t=l(this).val()=="paid"?"hide":"show";l("#_tutor_is_course_public_meta_checkbox")[t]()}}).trigger("change")}(function(e){e.fn.tutor_tooltip=function(){this.on("mouseenter click",".tooltip",function(t){t.stopPropagation();e(this).removeClass("isVisible")}).on("mouseenter focus",":has(>.tooltip)",function(t){if(!e(this).prop("disabled")){e(this).find(".tooltip").addClass("isVisible")}}).on("mouseleave blur keydown",":has(>.tooltip)",function(t){if(t.type==="keydown"){if(t.which===27){e(this).find(".tooltip").removeClass("isVisible")}}else{e(this).find(".tooltip").removeClass("isVisible")}});return this}})(jQuery);jQuery(".tutor-tooltip-inside").tutor_tooltip();jQuery(".tutor-static-loader").click(function(){var t=this;setTimeout(function(){jQuery(t).addClass("is-loading").attr("disabled","disabled")},100)});var s=document.getElementById("tutor-reuseable-snackbar");if(s){setTimeout(function(){s.classList.add("tutor-snackbar-show")},1e3)}jQuery('#tutor-registration-form [name="password_confirmation"]').on("input",function(){var t=jQuery('[name="password"]');var e=(t.val()||"").trim();var r=e&&jQuery(this).val()===e;jQuery(this).parent().find(".tutor-validation-icon")[r?"show":"hide"]()})})})()})();