!function(){var t={68379:function(t){!function(e,a){const n={allowDownload:!1,title:"",init:function(){ThriveAppFront.certificate?(this.allowDownload=1===Number(ThriveAppFront.certificate.allow_download),this.title=String(ThriveAppFront.certificate.title)):ThriveAppFront.wizard&&(this.allowDownload=!0),tve_frontend_options.is_editor_page||this.frontendInit()},frontendInit:function(t){this.$root=t||a.$document,this.$certificates=this.$root.find('a.tve-dynamic-link[data-shortcode-id="download_certificate"]'),this.allowDownload?this.$certificates.off("click").on("click",{},this.downloadCertificate.bind(this)):this.$certificates.remove()},downloadCertificate:function(t){t&&t.preventDefault();const a=this.title,n=this.$certificates,o=e("body");n.addClass("tar-disabled tve-loading"),e.ajax({url:`${ThriveAppFront.routes.certificate}/download`,type:"POST",cache:!1,data:{course_id:ThriveAppFront.course.ID},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ThriveAppFront.nonce)},xhr:function(){const t=new XMLHttpRequest;return t.onreadystatechange=()=>{2===t.readyState&&(t.responseType=200===t.status?"blob":"text")},t},success:function(t){const s=new Blob([t],{type:"application/octetstream"}),r=window.URL||window.webkitURL,i=e("<a />").attr({href:r.createObjectURL(s),download:`${a}.pdf`});o.append(i),i[0].click(),o.remove(i),n.removeClass("tar-disabled tve-loading")},error:function(t){n.removeClass("tar-disabled tve-loading");const e="object"==typeof t.responseJSON&&t.responseJSON.message?t.responseJSON.message:t.statusText,a=t.status&&401===t.status?"warning":"error";TCB_Front.notificationElement.toggle(e,a)}})}};t.exports=()=>n.init()}(ThriveGlobal.$j,TCB_Front)},52724:function(t){var e;(e=jQuery).fn.extend({tva_collapse:function(t){return this.each((function(){var a=e(this),n=a.parent();a.addClass(t.class_collapsed),a.removeClass(t.class_expanded),!1===a.hasClass("tva_chapter_headline")?(n.find(".tve-chapters-wrapper").slideUp(),0===n.find(".tve-chapters-wrapper").length&&n.find(".tve-lessons-wrapper").slideUp()):a.hasClass("tva_chapter_headline")&&n.find(".tve-lessons-wrapper").slideUp()}))},tva_expand:function(t){return this.each((function(){var a=e(this),n=a.parent();a.removeClass(t.class_collapsed),a.addClass(t.class_expanded),!1===a.hasClass("tva_chapter_headline")?(n.find(".tve-chapters-wrapper").slideDown(),0===n.find(".tve-chapters-wrapper").length&&n.find(".tve-lessons-wrapper").slideDown()):a.hasClass("tva_chapter_headline")&&n.find(".tve-lessons-wrapper").slideDown()}))}}),t.exports=function(t){var a=e.extend({class_expanded:"tva-expanded",class_collapsed:"tva-collapsed",collapse_modules:!1,collapse_chapters:!1},t);return this.each((function(){var t=e(this);t.find(".tva-cm-module .tva-module-header")[a.collapse_modules?"tva_collapse":"tva_expand"](a),t.find("h2.tva_chapter_headline")[a.collapse_chapters?"tva_collapse":"tva_expand"](a),t.find(".tva-cm-module .tva-module-header, h2.tva_chapter_headline").off("click").on("click",(function(t){var n=e(this);"a"!==t.target.tagName.toLowerCase()&&(n.hasClass(a.class_collapsed)?n.tva_expand (a):n.tva_collapse(a))}))}))}},86661:function(t){var e,a;e=ThriveGlobal.$j,a=TCB_Front,t.exports={isCompleted:0,allowMarkComplete:!0,nextLessonUrl:"",init:function(){this.isCompleted=parseInt(ThriveAppFront.is_completed),this.nextLessonUrl=ThriveAppFront.next_lesson_url,this.nextLessonText=ThriveAppFront.next_lesson_text,void 0!==ThriveAppFront.allow_mark_complete&&(this.allowMarkComplete=1===parseInt(ThriveAppFront.allow_mark_complete)),tve_frontend_options.is_editor_page||(this.frontendInit(),this.allowMarkComplete||(e(TCB_Front).on("tqb_shortcode_response",((t,a)=>{this.allowMarkComplete=a&&void 0!==a.tva_allow_mark_as_complete&&1===parseInt(a.tva_allow_mark_as_complete),this.allowMarkComplete&&e(".tva-disabled-mark-as-complete").removeClass("tva-disabled-mark-as-complete")})),TCB_Front.Hooks.addAction("tcb.video.on_end",(t=>{null!==t&&void 0!==t.allowMarkComplete&&0!==parseInt(t.allowMarkComplete)&&(this.allowMarkComplete=!0,e(".tva-disabled-mark-as-complete").removeClass("tva-disabled-mark-as-complete"))})),TCB_Front.Hooks.addAction("tcb.video.after_save_range",(t=>{t.allowMarkComplete&&(this.allowMarkComplete=!0,e(".tva-disabled-mark-as-complete").removeClass("tva-disabled-mark-as-complete"))}))))},frontendInit:function(t){this.$root=t||a.$document,this.$root.on("tve-dash.load",(()=>{TVE_Dash.add_load_item("ta_access_post",{post_id:ThriveAppFront.post_id},null)})),"tva_lesson"===ThriveAppFront.lesson.post_type&&(this.$root.find('span[data-shortcode="tva_dynamic_actions_mark_as_complete_text"][data-attr-go_next_lesson="0"],span[data-shortcode="tva_dynamic_actions_mark_as_complete_next_text"][data-attr-go_next_lesson="0"],a.tve-dynamic-link[data-shortcode-id="mark_as_complete"]').on("click",{},this.markLessonEventCallback.bind(this)),this.$root.find('span[data-shortcode="tva_dynamic_actions_mark_as_complete_next_text"][data-attr-go_next_lesson="1"],span[data-shortcode="tva_dynamic_actions_mark_as_complete_text"][data-attr-go_next_lesson="1"],a.tve-dynamic-link[data-shortcode-id="mark_as_complete_next"]').on("click",{},this.markLessonAndGoNextEventCallback.bind(this)),this.$root.on("unwrapBlockLinks",(()=>{this.$root.find('.thrv_wrapper[data-shortcode-id="mark_as_complete_next"]').on("click",{},this.markLessonAndGoNextEventCallback.bind(this)),this.$root.find('.thrv_wrapper[data-shortcode-id="mark_as_complete"]').on("click",{},this.markLessonEventCallback.bind(this))})))},markLessonEventCallback:function(t){t.preventDefault(),this.allowMarkComplete?this.isCompleted?this.goToNextLesson(t.currentTarget):this.markLesson().then():TCB_Front.notificationElement.toggle(ThriveAppFront.deny_mark_complete_toast,"warning")},markLessonAndGoNextEventCallback:function(t){if(t.preventDefault(),this.allowMarkComplete){const a=e(t.currentTarget).closest(".thrv_wrapper.thrv-button");if(a.length&&0===parseInt(a.attr("data-next")))return this.isCompleted?this.goToNextLesson(t.currentTarget):(a.find("a").attr("href","javascript:void(0)"),this.markLesson().then((()=>{e(t.currentTarget).attr({href:this.nextLessonUrl})})));this.markLessonAndGoToNext(t.currentTarget)}else TCB_Front.notificationElement.toggle(ThriveAppFront.deny_mark_complete_toast,"warning")},markLesson:function(){return new Promise((t=>{if(this.isCompleted)return this.updateMarkLessonCompleteAndNext(),void t();this.isCompleted=!0,wp.apiRequest({type:"POST",data:{lesson_id:parseInt(ThriveAppFront.lesson_page),completed:1},url:ThriveAppFront.routes.frontend+"/mark_lesson/"}).success((e=>{e.message&&TCB_Front.Utils.toast(e.message),e.progress_bar&&this.updateOldProgressBar(e.progress_bar),e.lessons_list&&this.updateOldLessonList(e.lessons_list),e.next_lesson_url&&(this.nextLessonUrl=e.next_lesson_url),e.next_lesson_text&&(this.nextLessonText=e.next_lesson_text),this.updateMarkLessonCompleteAndNext(),t(e)}))}))},updateOldProgressBar:function(t){this.$root.find(".tva-progress-container").html(t)},updateOldLessonList:function(t){this.$root.find(".tva-lessons-container").html(t)},markLessonAndGoToNext:function(t){this.markLesson(t).then((()=>this.goToNextLesson(t)))},updateMarkLessonCompleteAndNext:function(){this.$root.find('[data-shortcode="tva_dynamic_actions_mark_as_complete_next_text"]').each(((t,a)=>{if(1===parseInt(a.getAttribute("data-attr-link"))){const t=a.querySelector("a");t.textContent=this.nextLessonText,t.href=this.nextLessonUrl,e(a).unbind()}else a.textContent=this.nextLessonText})),this.$root.find('[data-shortcode="tva_dynamic_actions_mark_as_complete_text"]').each(((t,e)=>{e.closest(".thrv_text_element")&&(e.style.display="none")}))},goToNextLesson:function(t){"A"===t.tagName&&"_blank"===t.target||"DIV"===t.tagName&&"_blank"===t.getAttribute("data-target")?window.open(this.nextLessonUrl,"_blank","noopener"):top.location.href=this.nextLessonUrl}}},54920:function(t){!function(e,a){const n={init:function(){e(window).on("tcb_after_dom_ready",(()=>{this.afterDomReady()}))},afterDomReady:function(){const t=a.queryString.get("tva-show-message");t&&ThriveAppFront.frontend_warnings[t]&&a.notificationElement.toggle(ThriveAppFront.frontend_warnings[t],"warning")}};t.exports=()=>n.init()}(ThriveGlobal.$j,TCB_Front)},71027:function(t){t.exports={tvaRemoveParam:function(t,e){let a=e.split("?")[0];return this.tvaUrlParamExists("page_id",window.location.href)?(a=a+"?page_id="+this.tvaGetParameterByName("page_id",window.location.href),a):a},tvaUrlParamExists:function(t,e){const a=t+"=";return-1!==e.indexOf("?"+a)||-1!==e.indexOf("&"+a)},tvaGetParameterByName:function(t,e){e||(e=window.location.href),t=t.replace(/[\[\]]/g,"\\$&");const a=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return a?a[2]?decodeURIComponent(a[2].replace(/\+/g," ")):"":null}}},81151:function(t){var e;e=jQuery,t.exports=function(t){var a=e.extend({class_expanded:"tva-expanded",class_collapsed:"tva-collapsed",slide_time:200,module_tag:"h2",chapter_tag:"h3",current_post_id:null},t);function n(t){var e;return function(t){return t.is(a.module_tag)}(t)?(e=".tva-chapter-lessons",e+=0===t.parent().find("> .tva-chapter-lessons").length?", .tva-lessons-wrapper":""):function(t){return t.is(a.chapter_tag)}(t)&&(e=".tva-lessons-wrapper"),e}function o(){var t=e(this),o=n(t);t.parent().find(o).slideDown(a.slide_time),this.classList.remove(a.class_collapsed),this.classList.add(a.class_expanded)}function s(){var t=e(this),o=n(t),s=t.parent();t.addClass(a.class_collapsed),t.removeClass(a.class_expanded),s.find(o).slideUp(a.slide_time)}return this.each((function(){var t=e(this),n=t.parent().find('.tva-lesson-container[data-id="'+a.current_post_id+'"]');try{a.current_post_id===parseInt(t.data("id"))||n.length>0?o.apply(this):s.apply(this)}catch(t){console.log(t)}t.off("click").on("click",(function(t){if("a"!==t.target.tagName.toLowerCase()){var n=e(this);try{n.hasClass(a.class_collapsed)?o.apply(this):s.apply(this)}catch(t){console.log(t)}}}))}))}}},e={};function a(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,a),s.exports}!function(){const t=window.ThriveAppFront||{},e=window.ThriveAppWidgets||{},n=a(71027);!function(o){window.TCB_Front&&(TCB_Front.apprenticeDynamicActions=a(86661),TCB_Front.apprenticeDynamicActions.init(),a(68379)(),tve_frontend_options.is_editor_page||a(54920)());const s=o(document);o.fn.extend({tva_collapsible:a(52724),tva_widget_collapsible:a(81151)}),o(".tva-header .tva-inner-header").children().length>1&&o(".tva-header .tva-inner-header div").last().addClass("tva-dropdownmenu"),o(".tva-header > div > ul li").on("mouseenter",(function(){if(o("ul",this).length){const t=o("ul:first",this);t.offset().left+t.width()<=o(".tva-header").width()||(o(this).parent().addClass("edge"),o(this).find("ul").addClass("edge"))}})),o(".tva-header > div").click((function(){o(this).toggleClass("visible")})),o("#ta-registration-form").on("submit",(function(){o(this).find('input[name="tva_captcha"]').remove()}));const r=function(e){if("tva_lesson"!==t.lesson.post_type||1===parseInt(t.visual_editing_enabled))return;const a={lesson_id:t.lesson_page,completed:!1};e&&(a.completed=!0),o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",data:a,url:t.routes.frontend+"/mark_lesson/"})};if(!t.is_inner_frame&&!t.wizard){let l;t.course.ID&&t.allowed&&!t.is_admin&&o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",data:{course_id:t.course.ID},url:t.routes.frontend+"/process_conversion/"}),t.lesson_page&&t.allowed&&r(),o(".tva-finish-lesson").on("click",(function(t){r(!0)})),o(".tva-filter-checkbox-container").on("click",(function(t){t.preventDefault();const e=o(this).find(".tva-filter-course-clear-filters"),a=o(".tva-filters-wrapper"),s=o(".tva-search-wrapper"),r=o(this).find(".tva-filter").is(":checked");if(o(this).find(".tva-filter").prop("checked",!r),e.length>0&&(a.find(".tva-filter-checkbox-container").each((function(){o(this).children("div:first").removeClass("tva-filter-checkbox-selected")})),a.find(".tva-filter").each((function(){o(this).prop("checked",!1)})),s.find(".tva-search-input").val("")),l=i,o(c=this).find(".tva-filter").is(":checked")?o(c).children("div:first").addClass("tva-filter-checkbox-selected"):o(c).children("div:first").removeClass("tva-filter-checkbox-selected"),"function"==typeof l&&l(),e.length>0){let t="";t=n.tvaUrlParamExists("page_id",window.location.href)?"?page_id="+n.tvaGetParameterByName("page_id",window.location.href):n.tvaRemoveParam("filters",window.location.href),window.history.pushState({},document.title,t)}var c,l}));const d=document.getElementById("tva_front_search");let p=null;function i(e){const a="tva-loading",n=o(".tva-courses-container");if(!0===n.hasClass(a))return;const s=o(".tva-filter-checkbox-container input:checkbox:checked").map((function(){return o(this).val()})).get();l=o(".tva-search-input").val(),n.addClass(a),n.append('<div class="tva-front-loader tva-spinner-css tva-spinner-scope"><div class="tva-spinner-rolling"><div></div></div></div>'),n.find(".tva-course-card").remove(),o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",url:t.routes.frontend+"/filters/",data:{s:l,terms:s,page:e,is_index_page:t.index_page}}).done((function(e){n.removeClass(a),n.empty().append(e),t.index_page&&n.find(".tva-course-description").addClass("scrollbar-macosx").scrollbar(),o("html, body").animate({scrollTop:0},400),o(".ttw-uni-page-numbers").on("click",(function(){i(o(this).attr("data-tva-page-nr"))})),c()}))}function c(){let t="";t=!0===o(".tva-filters-container").find(".tva-filter").is(":checked")?"inline-block":"none",o(".tva-clear-filters").css("display",t)}d&&(d.onkeyup=function(){const t=this;p&&clearTimeout(p),p=setTimeout((function(){l!==t.value&&i()}),300)},s.on("click",".tva-search-submit",(function(){i()}))),s.on("click","a.tva-page-numbers",(function(){i(o(this).attr("data-tva-page-nr"))})),c()}if(1==t.tva_register_page){let m,u;jQuery('input[type="password"]').on("change",(function(){m=jQuery("input[name='user_pass']").val(),u=jQuery("input[name='confirm_pass']").val()})),jQuery("#tva-register-button").on("click",(function(t){var e;!0!==(e=jQuery("input[name=user_email]").val(),/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e))&&(t.preventDefault(),jQuery(".tva-password-mismatch").fadeIn("slow"),jQuery(".tva-invalid-email").fadeIn("slow")),jQuery('input[name="user_pass"], input[name="user_login"]').each((function(){""===jQuery(this).val()&&(t.preventDefault(),setTimeout((function(){jQuery(".tva-required-filed").fadeOut("slow"),jQuery(".tva-invalid-email").fadeOut("slow")}),5e3)),m!==u&&(jQuery(".tva-invalid-password").fadeIn("slow"),t.preventDefault())})),void 0===m&&o('input[name="user_pass"]').parent().next("p").fadeIn("slow"),void 0===u&&(o('input[name="confirm_pass"]').parent().next("p").fadeIn("slow"),o("#tva-register-button").addClass("tva-btn-margin-top"))})),jQuery('input[name="user_pass"], input[name="confirm_pass"]').on("focusin",(function(){jQuery(".tva-invalid-password").fadeOut("slow")})),jQuery('#ta-registration-form input[type=email], input[name="user_pass"], input[name="confirm_pass').on("focusin",(function(){jQuery(".tva-required-filed").fadeOut("slow"),jQuery(".tva-invalid-email").fadeOut("slow")})),jQuery("#ta-registration-form input[type=email]").on("focusout",(function(){const e={email:jQuery(this).val()};jQuery.ajax({type:"POST",url:t.routes.frontend+"/check_email/",data:e}).done((function(t){!0===t&&(jQuery("#tva-email-error-wrapper").fadeIn("slow"),setTimeout((function(){jQuery("#tva-email-error-wrapper").fadeOut("slow")}),5e3)),jQuery("#tva-register-button").prop("disabled",t)}))}))}if(jQuery(".tva-register-url").on("click",(function(){document.cookie="tva_lesson_to_redirect="+window.location.href+"; path=/"})),("open"===t.course.comment_status||"open"===t.lesson.comment_status)&&!0!==t.has_comment_plugin){o(document).ready((function(){h.tvaGetGuestData(o(".tva-comments-form"));const e=Object.keys(t.lesson).length>0?t.lesson.ID:t.course_ref_post_id;o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",url:t.routes.frontend+"/comments/",data:{comment_data:{comment_post_ID:e,comment_term_ID:e===t.course_ref_post_id?t.course.ID:""}}}).done((function(t){h.comment_count=t.comment_count,h.all_comments=t.comments,h.user_can_manage_comments=t.approve,h.renderCommentsList()}))})),o("#tva-comments-list").on("click",".tva-reply-button",(function(e){o(".tva-comment-form").each((function(t,a){o(a).parent().attr("data-comment-id")!==o(e.currentTarget).parent().attr("data-comment-id")&&o(a).slideUp("slow")})),o(this).parent(".tva-single-comment").find(".tva-comment-form").slideToggle(),!1===t.is_user_logged_in&&h.tvaGetGuestData(o(this))})),o(".tva-frontend-template").on("click","#tva-submit-comment",(function(){const e=o(this),a=h.tvaValidateComment(e);!1!==a&&o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",url:t.routes.frontend+"/create_comment/",data:{comment_data:a}}).done((function(t){o("#tva-comments-list").html(""),o(e).parent(".tva-comments-form").find(".tva-comment-content").val(""),h.childs="",h.html="",h.comment_count=t.comment_count,h.renderCommentListHeader(),_.each(t.comments,(function(t){h.html+='<div class="tva-comment-holder">',h.renderComment(t),h.html+="</div>"})),o("#tva-comments-list").html(h.html)})).fail((function(t){o(e).parent().find(".tva-error-message").remove(),h.tvaShowError(t.status,e)}))}));const h={comment_count:0,all_comments:[],childs:"",html:"",user_can_manage_comments:!1,renderComment:function(e){if(this.html+='<div class="tva-single-comment" data-comment-id="'+e.comment_ID+'">',this.html+='<div class="tva-comment-author">'+e.comment_author+"</div>",1!==parseInt(e.comment_approved)){const e=!0===this.user_can_manage_comments?t.t.This:t.t.Your;this.html+='<div class="tva-comment-approval">',this.html+=e+" "+t.t.Moderation,this.html+="</div>"}if(this.html+='<p class="tva-comment">'+e.comment_content.replace(/(?:\r\n|\r|\n)/g,"<br>")+"</p>",this.tvaCommentReplyForm(),this.html+="</div>",null!==e.children&&e.children.length>0){this.childs=e.children,this.html+='<div class="tva-children-list">';const t=this;_.each(this.childs,(function(e){t.renderComment(e)})),this.html+="</div>"}},tvaValidateComment:function(t){t.parent().find(".tva-error-message").remove();const e=this.tvaPrepareCommentData(t);return""===e.comment_content?this.tvaShowError("invalid_comment_content",t):""===e.comment_author?this.tvaShowError("invalid_comment_author",t):""===e.comment_author_email?this.tvaShowError("missing_author_email",t):!1===/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e.comment_author_email)?this.tvaShowError("invalid_author_email",t):""!==e.comment_author_url&&!1===/(http(s)?:\/\/.)(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g.test(e.comment_author_url)?this.tvaShowError("invalid_url",t):e},renderCommentListHeader:function(){this.html+='<div class="tva-comments-number">',1===h.comment_count?this.html+="<p>"+t.t.SingleComment+"</p>":h.comment_count>1&&(this.html+="<p>"+this.comment_count+" "+t.t.MultipleComments+"</p>"),this.html+="</div>"},renderCommentsList:function(){const t=this;this.renderCommentListHeader(),this.html+="</div>",_.each(this.all_comments,(function(e){t.html+='<div class="tva-comment-holder">',t.renderComment(e),t.html+="</div>"})),o("#tva-comments-list").append(this.html)},tvaCommentReplyForm:function(){this.html+='<button class="tva-reply-button">'+t.t.Reply+"</button>",this.html+='<div class="tva-comment-form">',this.html+='<textarea class="tva-comment-content"></textarea>',t.current_user.ID||(this.html+='<div class="tva-guest-fileds">',this.html+='<p class="tva-guest">'+t.t.Guest+"</p>",this.html+="<span>"+t.t.GuestName+"</span>",this.html+='<input type="text" class="tva-comment-input" name="name">',this.html+="<span>"+t.t.GuestEmail+"</span>",this.html+='<input type="text" class="tva-comment-input" name="email">',this.html+="<span>"+t.t.GuestUrl+"</span>",this.html+='<input type="text" class="tva-comment-input" name="url">',this.html+="</div>"),this.html+='<button id="tva-submit-comment" >'+t.t.SubmitComment+"</button>",this.html+="</div>"},tvaPrepareCommentData:function(e){const a=e.parent().parent().attr("data-comment-id"),n=Object.keys(t.lesson).length>0?t.lesson.ID:t.course_ref_post_id,o=1===parseInt(t.is_user_logged_in),s=o?t.current_user.display_name:e.parent().find('input[name="name"]').val(),r=o?t.current_user.user_email:e.parent().find('input[name="email"]').val(),i=o?t.current_user.user_url:e.parent().find('input[name="url"]').val(),c={comment_post_ID:n,comment_content:e.parent().find(".tva-comment-content").val(),comment_parent:void 0!==a?a:0,comment_author:s,comment_author_email:r,comment_author_url:i,user_id:t.current_user.ID?t.current_user.ID:"",comment_type:""};return c.comment_term_ID=0===Object.keys(t.lesson).length?t.course.ID:"",c},tvaShowError:function(e,a){let n="";switch(e){case 409:return n='<div class="tva-error-message">'+t.t.DuplicateComment+"</div>",a.parent().append(n),!1;case 429:return n='<div class="tva-error-message">'+t.t.CommentToFast+"</div>",a.parent().append(n),!1;case"invalid_comment_content":return n='<div class="tva-error-message">'+t.t.EmptyComment+"</div>",a.parent().find(".tva-comment-content").after(n),!1;case"invalid_comment_author":return n='<div class="tva-error-message">'+t.t.EmptyName+"</div>",a.parent().find('input[name="name"]').after(n),!1;case"missing_author_email":return n='<div class="tva-error-message">'+t.t.EmptyEmail+"</div>",a.parent().find('input[name="email"]').after(n),!1;case"invalid_author_email":return n='<div class="tva-error-message">'+t.t.InvalidEmail+"</div>",a.parent().find('input[name="email"]').after(n),!1;case"invalid_url":return n='<div class="tva-error-message">'+t.t.InvalidUrl+"</div>",a.parent().find('input[name="url"]').after(n),!1;default:return!0}},tvaGetGuestData:function(e){if(!0!==t.is_user_logged_in){const t=decodeURIComponent(this.tvaGetCookieData("tva_cookie_user_name")).slice(1,-1),a=decodeURIComponent(this.tvaGetCookieData("tva_cookie_user_email")).slice(1,-1),n=decodeURIComponent(this.tvaGetCookieData("tva_cookie_user_url")).slice(1,-1);e.parent().find('input[name="name"]').val(t),e.parent().find('input[name="email"]').val(a),e.parent().find('input[name="url"]').val(n.replace(/\\\//g,"/"))}},tvaGetCookieData:function(t){const e=t+"=",a=document.cookie.split(";");for(let t=0;t<a.length;t++){let n=a[t];for(;" "===n.charAt(0);)n=n.substring(1);if(0===n.indexOf(e))return n.substring(e.length,n.length)}return""}}}o(".tva-cm-lesson").on("mousedown",(function(){o(this).addClass("tva-lesson-pressed")})),o(".tva-cm-lesson").on("mouseup",(function(){o(this).removeClass("tva-lesson-pressed")})),o(document).ready((function(){if(o(".tva-cm-container").tva_collapsible(t.template),e.config){const l=Object.keys(e.config);o.each(l,(function(a,n){!function(e,a){let n=[];const s="#"+e;(a.modules||a.chapters)&&(a.modules&&n.push("h2"),a.chapters&&n.push("h3.tva-chapter-title"),n=s+" "+n.join(", "+s+" "),o(n).tva_widget_collapsible({current_post_id:parseInt(t.lesson_page)||null}))}(n,e.config[n])}))}const a=o(".tva-course-description");if(t.index_page&&a.addClass("scrollbar-macosx").scrollbar(),"undefined"!=typeof tve_frontend_options&&!tve_frontend_options.is_editor_page){const d=n("pp");if(parseInt(t.is_checkout)&&parseInt(t.is_user_logged_in)&&d&&"sendowl"===d.toLowerCase()&&(n("pid")||n("bid"))){const p=[];p.push({name:"payment_processor",value:n("pp")}),p.push({name:"bid",value:n("bid")}),p.push({name:"pid",value:n("pid")}),p.push({name:"thrv_so_discount",value:n("thrv_so_discount")}),o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",data:p,url:t.routes.user+"/process_redirect/"}).done((function(t){t.message&&TCB_Front.Utils.toast(t.message,!1),t.redirect&&(document.location.href=t.redirect)})).fail((function(t){TCB_Front.Utils.toast(t.responseJSON.message,!0)}))}function n(t){const e=new RegExp("[?&]"+t+"=([^&#]*)").exec(window.location.search);return null!==e&&(e[1]||0)}ThriveGlobal.$j(".thrv-checkout").each((function(){o(this).find('[data-type="password"] input').attr("type","password");const e=["forgot_password","reset_confirmation"],a="tcb-form-error";function s(t,a){t.find(".thrv-button-group").toggleClass("tcb-permanently-hidden",_.contains(e,a))}const r=o(this),i=r.find("form");r.find(".thrv-button-group").off("click.thrv-button-group-item").on("click.thrv-button-group-item",".thrv-button-group-item",(function(t){t.stopPropagation(),t.preventDefault();const e=ThriveGlobal.$j(this),a=e.closest(".thrv-checkout");a.find(".tcb-active-state").removeClass("tcb-active-state"),a.find(".tcb-tva-checkout-form-wrapper").addClass("tcb-permanently-hidden"),e.addClass("tcb-active-state"),a.find('.tcb-tva-checkout-form-wrapper[data-instance="'+e.attr("data-instance")+'"]').removeClass("tcb-permanently-hidden")})),i.off("submit").on("submit",(function(e){e.stopPropagation(),e.preventDefault();const i=r.find('input[name="config"]').val();if(!i)return!1;const c=ThriveGlobal.$j(this),l=c.closest("form"),d=c.serializeArray(),p={};let m="";if(o.map(d,(function(t){p[t.name]=t.value})),_.some(p,(function(t,e){return 0===t.length?(m="empty_fields",!0):"email"!==e||tve_is_email(t)?"confirm_password"===e&&t!==p.password?(m="passwords_not_match",!0):void 0:(m="email",!0)})),m.length>0){const t=TCB_Front.Utils.unserialize(TCB_Front.Base64.decode(i)),e=document.createElement("span");return e.classList.add(a),e.innerText=t.error_messages[m],"empty_fields"===m?l.find('input[type="text"], input[type="email"], input[type="password"]').not("."+a).filter((function(){return!this.value})).addClass(a).after(e):"email"===m?l.find('input[type="email"]').not("."+a).addClass(a).after(e):"passwords_not_match"===m&&l.find('input[type="password"]').not("."+a).addClass(a).after(e),!1}const u=c.closest(".thrv-checkout"),h=c.find("button");h.attr("disabled","disabled"),d.push({name:"payment_processor",value:n("pp")}),d.push({name:"bid",value:n("bid")}),d.push({name:"pid",value:n("pid")}),d.push({name:"thrv_so_discount",value:n("thrv_so_discount")});const f=function(t){let e="";return e="register"===t?"tva_register":t,e}(c.attr("data-route"));o.ajax({headers:{"X-WP-Nonce":t.nonce},type:"POST",data:d,url:t.routes.user+"/"+f+"/"}).fail((function(t){if(_.contains(["existing_user_email","existing_user_login"],t.responseJSON.code)){const t=TCB_Front.Utils.unserialize(TCB_Front.Base64.decode(i)),e=document.createElement("span");e.classList.add(a);let n=t.error_messages.existing_user_email;n=n.replace(/\[a\]/g,'<a href="javascript:void(0)" class="tva-switch-instance-link" data-go_to_instance="login">'),n=n.replace(/\[\/a\]/g,"</a>"),jQuery(e).html(n),l.find('input[type="email"]').not("."+a).addClass(a).after(e)}else TCB_Front.Utils.toast(t.responseJSON.message,!0)})).done((function(t){t.message&&TCB_Front.Utils.toast(t.message,!1),t.state&&(u.find(".tcb-tva-checkout-form-wrapper").addClass("tcb-permanently-hidden"),u.find('.tcb-tva-checkout-form-wrapper[data-instance="'+t.state+'"]').removeClass("tcb-permanently-hidden"),s(u,t.state)),t.redirect&&(document.location.href=t.redirect)})).always((function(){h.removeAttr("disabled")}))})),i.find(['input[type="text"]','input[type="email"]','input[type="password"]'].join(",")).on("input",(function(t){const e=t.currentTarget;e.classList.contains(a)&&(e.nextSibling.remove(),e.classList.remove(a))})).on("focus",(function(){this.placeholder=""})).on("blur",(function(){this.placeholder=this.getAttribute("data-placeholder")})),r.off("click.tva-switch-instance-link").on("click.tva-switch-instance-link",".tva-switch-instance-link",(function(t){t.stopPropagation(),t.preventDefault();const e=ThriveGlobal.$j(this),a=e.closest(".thrv-checkout"),n=e.attr("data-go_to_instance");a.find(".tcb-tva-checkout-form-wrapper").addClass("tcb-permanently-hidden"),a.find('.tcb-tva-checkout-form-wrapper[data-instance="'+n+'"]').removeClass("tcb-permanently-hidden"),"login"===n&&(a.find(".tcb-active-state").removeClass("tcb-active-state"),a.find('.thrv-button-group-item[data-instance="'+n+'"]').addClass("tcb-active-state")),s(a,n)})),r.find('.thrv-button-group-item[data-default="true"]').click()}))}function s(t){return t&&"string"==typeof t?t.replace(/every_two_weeks/gi,"Every two weeks"):t}function r(t){if(!t||"string"!=typeof t)return[];const e=[],a=t.match(/Body:\s*(\{[\s\S]*\})/);if(a)try{const t=JSON.parse(a[1]);t&&Array.isArray(t.errors)&&t.errors.forEach((function(t){t.detail?e.push("Error: "+t.detail):t.code&&e.push("Error: "+t.code.replace(/_/g," ").toLowerCase())}))}catch(t){}const n=t.match(/Expected [^\n]+/i);return n&&e.push("Error: "+n[0]),e}async function i(e){try{const a=await async function(e){return new Promise(((a,n)=>{o.ajax({type:"POST",url:t.routes.square+"/item_info",headers:{"X-WP-Nonce":t.nonce},data:{item_id:e.squareItemId||"",mode:e.squareItemMode||"live"},success:function(t){a(t)},error:function(){n(new Error("Failed to get item information"))}})}))}(e);if(!a.success)throw new Error("Failed to get item information");!function(t,e){var a;const n=t.isSubscription?"Subscribe to":"Purchase",r=t.isSubscription?"&#x1F504;":"&#x1F4B3;",i=(null===(a=e.item)||void 0===a||a.cadence,s(e.item.price.formatted||""));let c=n+" "+e.item.name+" - "+(i||e.item.price.formatted),l=r+" "+n+" "+e.item.name+" - "+(i||e.item.price.formatted);e.item.freeTrial&&e.item.freeTrial.enabled&&(c+=" ("+e.item.freeTrial.description+")",l=r+" Start "+e.item.freeTrial.description+" - Then "+e.item.price.formatted),o("#tva-square-modal-title").text(c),o("#tva-square-payment-btn").html(l);const d=t.squareItemMode||"",p=[d?{live:"Production",test:"Sandbox"}[d]||d:"",t.merchantName||t.merchantId||""].filter(Boolean).join(" | ");if(p){const t=o("#tva-square-modal-meta");t.length?t.text(p):o("#tva-square-modal-title").after('<p id="tva-square-modal-meta" style="margin: 8px 0 0 0; font-size: 13px; opacity: 0.85;">'+p+"</p>")}else o("#tva-square-modal-meta").remove()}(e,a);const n=await async function(t){const e=t.squareItemAppId||"",a=t.squareItemLocationId||"";try{const t=window.Square.payments(e,a),n=await t.card();return await n.attach("#tva-square-card-container"),n}catch(t){if(t.message&&t.message.includes("secure context"))throw new Error("Square live payments require HTTPS. Please use a secure connection or switch to test mode.");throw t}}(e);!function(e,a,n){1===e.prepopulate&&e.prepopulateEmail&&o("#tva-square-email").val(e.prepopulateEmail),o("#tva-square-loading").hide(),o("#tva-square-payment-form").show(),o("#tva-square-payment-btn").off("click").on("click",(async function(r){r.preventDefault(),await async function(e,a,n){try{const s=function(){const t={firstName:o("#tva-square-firstName").val().trim(),lastName:o("#tva-square-lastName").val().trim(),email:o("#tva-square-email").val().trim(),phone:o("#tva-square-phone").val().trim()};return t.phone&&!t.phone.startsWith("+")&&(t.phone="+1"+t.phone.replace(/\D/g,"")),t}();!function(t){if(!(t.firstName&&t.lastName&&t.email&&t.phone))throw new Error("Please fill in all required fields")}(s),function(t,e){const a=o("#tva-square-payment-btn"),n=t.isSubscription?"Processing Subscription...":"Processing Payment...";a.prop("disabled",!0).html(n)}(n);const r=await async function(t,e,a,n){const o=function(t,e,a){const n={billingContact:{givenName:t.firstName,familyName:t.lastName,email:t.email,phone:t.phone,countryCode:a.countryCode||"US"},customerInitiated:!0,sellerKeyedIn:!1};if(a.isSubscription)n.intent="STORE";else{const t=(e.item.price.amount/100).toFixed(2);n.amount=t,n.currencyCode=e.item.price.currency||a.currencyCode||"USD",n.intent="CHARGE"}return n}(e,a,n),s=await t.tokenize(o);if("OK"!==s.status)throw new Error("Tokenization failed: "+s.status);return s}(e,s,a,n);await async function(e,a,n){return new Promise(((s,r)=>{o.ajax({type:"POST",url:t.routes.square+"/payment",headers:{"X-WP-Nonce":t.nonce},data:{sourceId:e,customerData:a,productData:n,idempotencyKey:"tva-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),mode:n.squareItemMode||"live"},success:function(e){e.success?(function(e,a){if(s='<div class="tva-square-success">',(n=e).subscription||n.payment&&n.payment.subscription?s+="<h3>&#x2713; Subscription Created Successfully!</h3>":s+="<h3>&#x2713; Payment Successful!</h3>",o("#tva-square-payment-status").html(s).show(),o("#tva-square-payment-form").hide(),e){const n=function(t,e){const a={product_id:e.productId,onetime:!e.isSubscription,mode:e.squareItemMode||"live"};var n,o,s;return e.isSubscription?a.order_id=null==t||null===(n=t.payment)||void 0===n||null===(o=n.subscription)||void 0===o?void 0:o.id:a.order_id=null==t||null===(s=t.payment)||void 0===s?void 0:s.orderId,a}(e,a);n.order_id&&function(e){o.ajax({type:"GET",url:t.routes.square+"/get-redirect",data:e,success:function(t){t.url&&(window.location.href=t.url)},error:function(){console.error("Redirect endpoint failed, but payment was successful")}})}(n)}var n,s}(e.data,n),s(e)):r(new Error(e.message||"Payment failed"))},error:function(t){r(t||new Error("Payment request failed"))}})}))}(r.token,s,n)}catch(t){!function(t,e,a){console.error("Payment error:",t),c(t);const n=function(t,e){const a=t.isSubscription?"Subscribe to":"Purchase",n=t.isSubscription?"&#x1F504;":"&#x1F4B3;",o=s(e.item.price.formatted||"");let r=n+" "+a+" "+e.item.name+" - "+(o||e.item.price.formatted);return e.item.freeTrial&&e.item.freeTrial.enabled&&(r=n+" Start "+e.item.freeTrial.description+" - Then "+(o||e.item.price.formatted)),r}(e,a);o("#tva-square-payment-btn").prop("disabled",!1).html(n)}(t,n,a)}}(n,a,e)}))}(e,a,n)}catch(t){console.error("Square setup error:",t),c("Failed to initialize payment form. Please try again.")}}function c(t){const e=(a=function(t,e){const a="An unexpected error occurred. Please try again.";if(!t)return a;const n=[],o=[];if("string"==typeof t?(n.push(t),o.push.apply(o,r(t))):(t instanceof Error&&t.message||t.message)&&(n.push(t.message),o.push.apply(o,r(t.message))),t.responseJSON&&(t.responseJSON.message&&(n.push(t.responseJSON.message),o.push.apply(o,r(t.responseJSON.message))),Array.isArray(t.responseJSON.errors)&&t.responseJSON.errors.forEach((function(t){t.detail&&n.push(t.detail),t.field&&n.push(t.field),t.code&&!t.detail&&n.push(t.code),t.detail?o.push("Error: "+t.detail):t.code&&o.push("Error: "+t.code.replace(/_/g," ").toLowerCase())}))),t.responseText&&"string"==typeof t.responseText&&(n.push(t.responseText),o.push.apply(o,r(t.responseText))),t.statusText&&n.push(t.statusText),!n.length)try{n.push(JSON.stringify(t))}catch(t){n.push(a)}const s=n.join("\n").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split("\n").map((function(t){return t.trim()})).filter(Boolean),i=o.length?o:s,c=[];return i.forEach((function(t){t&&-1===c.indexOf(t)&&c.push(t)})),c.length?c[0]:a}(t),a&&"string"==typeof a?a.replace(/[&<>"']/g,(function(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#39;";default:return t}})):"").replace(/\n/g,"<br>");var a;o("#tva-square-payment-status").html(`<div class="tva-square-error"><h3>&#x2717; Payment Failed</h3><p>${e}</p><p style="font-size: 14px; margin-top: 10px;">Please try again or contact support.</p></div>`).show()}o(window).on("tcb_after_dom_ready",(function(){const e=o('a.tcb-button-link.tcb-plain-text.tve-dynamic-link[data-dynamic-link="tva_dynamic_actions_link"]');if(e.length<=0)return;const a=e.attr("href").split("error-stripe=");a&&a[1]&&function(t){const e=o('a.tcb-button-link.tcb-plain-text.tve-dynamic-link[data-dynamic-link="tva_dynamic_actions_link"]');e.addClass("tva-custom-disabled"),e.css("cssText","background-color: #CDD3D8 !important"),e.find(".tcb-button-icon").find(".thrv_icon").css("cssText","background-color: #ffffff !important"),o(".tva-custom-toast").remove();const a=`\n\t\t\t\t<div class="tva-custom-toast" id="tva-stripe-toast">\n\t\t\t\t\t${t}\n\t\t\t\t</div>\n\t\t\t`,n=e.closest(".thrv_wrapper.thrv-columns");o(a).insertAfter(n),o(".tva-custom-toast").fadeIn(300)}(decodeURIComponent(a[1])),e.on("click",(function(e){const a=o(this).attr("href"),n=new URL(a).searchParams;if("1"===n.get("tvasquare")){e.preventDefault();const a=n.get("pid");if(!a)return void console.error("Product ID is required for Square payments");o.ajax({type:"POST",url:t.routes.square+"/product_config",headers:{"X-WP-Nonce":t.nonce},data:{product_id:a,mode:n.get("m")||"test"},success:function(t){t.success?function(t){o("#tva-square-payment-modal").remove();const e=function(t){return'<div id="tva-square-payment-modal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%;background: rgba(0, 0, 0, 0.7); z-index: 999999;display: flex; align-items: center; justify-content: center;opacity: 0; transition: opacity 0.3s ease;"><div id="tva-square-payment-container" style="background: white; border-radius: 12px;box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);max-width: 800px; width: 90%; max-height: 90vh;overflow-y: auto; position: relative;transform: scale(0.9); transition: transform 0.3s ease;">'+function(t){const e=t||{},a=e.squareItemMode||"",n=[a?{live:"Production",test:"Sandbox"}[a]||a:"",e.merchantName||e.merchantId||""].filter(Boolean).join(" | ");return'<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);color: white; padding: 20px 30px; border-radius: 12px 12px 0 0;position: relative;"><h2 id="tva-square-modal-title" style="margin: 0; font-size: 24px; font-weight: 300; color:#ffffff;">Square Web Payments - Loading...</h2>'+(n?'<p id="tva-square-modal-meta" style="margin: 8px 0 0 0; font-size: 13px; color:#ffffff; font-weight: 600;">'+n+"</p>":"")+'<button id="tva-square-close-btn" style="position: absolute; top: 15px; right: 20px;background: none; border: none; color: white;font-size: 24px; cursor: pointer; opacity: 0.8;transition: opacity 0.3s ease;">&times;</button></div>'}(t)+'<div style="padding: 30px;"><div id="tva-square-loading" style="text-align: center; padding: 40px;"><div style="border: 4px solid #f3f3f3; border-top: 4px solid #667eea; border-radius: 50%; width: 40px; height: 40px; animation: spin 2s linear infinite; margin: 0 auto 20px;"></div><p>Loading payment form...</p></div><form id="tva-square-payment-form" style="display: none;"><div style="margin-bottom: 25px;"><h3 style="margin: 0 0 20px 0; color: #333; font-size: 18px; font-weight: 600;">Personal Information</h3><div style="display: flex; gap: 15px; margin-bottom: 15px;"><div style="flex: 1;"><label style="display: block; margin-bottom: 5px; color: #555; font-weight: 500;">First Name <span style="color: #e74c3c;">*</span></label><input type="text" id="tva-square-firstName" style="width: 100%; padding: 12px; border: 2px solid #e1e8ed; border-radius: 8px; font-size: 14px; transition: border-color 0.3s ease;" placeholder="John" required></div><div style="flex: 1;"><label style="display: block; margin-bottom: 5px; color: #555; font-weight: 500;">Last Name <span style="color: #e74c3c;">*</span></label><input type="text" id="tva-square-lastName" style="width: 100%; padding: 12px; border: 2px solid #e1e8ed; border-radius: 8px; font-size: 14px; transition: border-color 0.3s ease;" placeholder="Doe" required></div></div><div style="display: flex; gap: 15px;"><div style="flex: 1;"><label style="display: block; margin-bottom: 5px; color: #555; font-weight: 500;">Email Address <span style="color: #e74c3c;">*</span></label><input type="email" id="tva-square-email" style="width: 100%; padding: 12px; border: 2px solid #e1e8ed; border-radius: 8px; font-size: 14px; transition: border-color 0.3s ease;" placeholder="john.doe@example.com" required></div><div style="flex: 1;"><label style="display: block; margin-bottom: 5px; color: #555; font-weight: 500;">Phone Number <span style="color: #e74c3c;">*</span></label><input type="tel" id="tva-square-phone" style="width: 100%; padding: 12px; border: 2px solid #e1e8ed; border-radius: 8px; font-size: 14px; transition: border-color 0.3s ease;" placeholder="+1 (555) 123-4567" required></div></div></div><div style="margin-bottom: 25px;"><h3 style="margin: 0 0 20px 0; color: #333; font-size: 18px; font-weight: 600;">Payment Information</h3><div style="margin-bottom: 20px;"><label style="display: block; margin-bottom: 10px; color: #555; font-weight: 500;">Card Details <span style="color: #e74c3c;">*</span></label><div id="tva-square-card-container" style="border: 2px solid #e1e8ed; border-radius: 8px; padding: 15px; background: #fff;"></div></div></div><button id="tva-square-payment-btn" type="button" style="width: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; padding: 15px 30px; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);">&#x1F4B3; Complete Payment</button></form><div id="tva-square-payment-status" style="display: none; margin-top: 20px;"></div></div></div></div>'}(t);o("body").append(e),o("#tva-square-spinner-css").length||o('<style id="tva-square-spinner-css">@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); }}#tva-square-payment-form input:focus { border-color: #667eea !important; outline: none; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }#tva-square-payment-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }#tva-square-payment-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }</style>').appendTo("head"),function(t){function e(){o("#tva-square-payment-modal").css("opacity","0"),o("#tva-square-payment-container").css("transform","scale(0.9)"),setTimeout((()=>{o("#tva-square-payment-modal").remove(),window.tvaSquareCurrentProduct&&delete window.tvaSquareCurrentProduct}),300)}setTimeout((()=>{o("#tva-square-payment-modal").css("opacity","1"),o("#tva-square-payment-container").css("transform","scale(1)")}),10),o("#tva-square-close-btn").on("click",e),o("#tva-square-payment-modal").on("click",(function(t){t.target===this&&e()})),o(document).on("keydown.tva-square-modal",(function(t){27===t.keyCode&&(e(),o(document).off("keydown.tva-square-modal"))})),function(t){if("live"!==t.squareItemMode||"https:"===window.location.protocol)if(window.Square)i(t);else{const e=document.createElement("script");e.src="test"===t.squareItemMode?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",e.onload=()=>i(t),e.onerror=()=>c("Failed to load Square payments. Please try again."),document.head.appendChild(e)}else c("Square live payments require HTTPS. Please use a secure connection or switch to test mode.")}(t)}(t)}(t):console.error("Failed to get Square configuration:",t.message)},error:function(){console.error("Failed to fetch Square configuration")}})}}))}))})),t.is_editor_page&&TVE.add_filter("tcb_cloud_template_download",(function(e){return(t.is_checkout||t.is_thankyou||t.is_login)&&(e.action="tva_cloud_templates"),e}))}(jQuery)}()}();