!function(a,n,t,s){function i(t){const s=t.find(".ld-paypal-standard__current-subscriptions-cell--subscriptions-list"),i=t.find(".ld-paypal-standard__current-subscriptions-cell--paypal-ids-list");if(0===s.length||0===i.length)return;const e=s.find("li"),r=e.length;if(r<=5)return;const p=Math.ceil(r/5),l=a('<div class="ld-paypal-standard__current-subscriptions-subscription-name-pagination"></div>'),o=a('<span class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-info"></span>'),d=a('<nav class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-controls" aria-label="'+n.__("Subscriptions Name Pagination","learndash")+'"></nav>'),c=a('<ul class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-list"></ul>'),u=a('<li class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-prev"></li>'),_=a('<li class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-next"></li>'),g=a('<a href="#" class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-prev-link">'+n.sprintf(
// translators: %s: Previous page arrow.
n.__("%s Previous","learndash"),"&lsaquo;")+"</a>"),h=a('<a href="#" class="ld-paypal-standard__current-subscriptions-subscription-name-pagination-next-link">'+n.sprintf(
// translators: %s: Next page arrow.
n.__("Next %s","learndash"),"&rsaquo;")+"</a>");function f(a){const t=5*(a-1),s=t+5,l=i.find("li");e.hide(),l.hide(),e.slice(t,s).show(),l.slice(t,s).show(),
// translators: %1$d: current page items count, %2$d: total items count.
o.text(n.sprintf(
// translators: %1$d: current page items count, %2$d: total items count.
n.__("%1$d of %2$d","learndash"),Math.min(s,r),r)),1===a?g.addClass("disabled"):g.removeClass("disabled"),a===p?h.addClass("disabled"):h.removeClass("disabled")}u.append(g),_.append(h),c.append(u,_),d.append(c),l.append(o,d),i.after(l),g.on("click",function(n){if(a(this).hasClass("disabled"))return n.preventDefault(),!1;!function(a){a.preventDefault();const n=parseInt(l.data("current-page")||1);n>1&&(f(n-1),l.data("current-page",n-1))}(n)}),h.on("click",function(n){if(a(this).hasClass("disabled"))return n.preventDefault(),!1;!function(a){a.preventDefault();const n=parseInt(l.data("current-page")||1);n<p&&(f(n+1),l.data("current-page",n+1))}(n)}),f(1),l.data("current-page",1)}function e(){const n=a(".sfwd_input_type_html--learndash_settings_paypal_migration_subscriptions_subscriptions_table .tablenav.bottom");0!==n.length&&(n.on("click","a.first-page, a.prev-page, a.next-page, a.last-page",function(n){n.preventDefault();const t=a(this).attr("href"),s=new URLSearchParams(t.split("?")[1]);r(parseInt(s.get("paged"))||1)}),n.on("change","input.current-page",function(){const n=parseInt(a(this).val())||1,t=parseInt(a(".total-pages").text())||1;n>=1&&n<=t&&r(n)}),n.on("keypress","input.current-page",function(n){if(13===n.which){n.preventDefault();const t=parseInt(a(this).val())||1,s=parseInt(a(".total-pages").text())||1;t>=1&&t<=s&&r(t)}}))}function r(r){const p=a(".tablenav.bottom"),l=a(".ld-paypal-standard__current-subscriptions").closest(".learndash-settings-section");l.addClass("loading"),p.find("a, input").prop("disabled",!0);const o=a("#learndash_settings_paypal_migration_subscriptions_include_migrated-on").is(":checked")?"on":"off";a.ajax({url:t,type:"POST",data:{action:"learndash_paypal_migration_table_pagination",page:r,include_migrated:o,nonce:s.nonce},success:n=>{if(!1===n.success)return void window.alert(n.data);const t=a(".sfwd_input_type_html--learndash_settings_paypal_migration_subscriptions_subscriptions_table .sfwd_option_div");a(".ld-paypal-standard__current-subscriptions").remove(),t.find(".tablenav.bottom").remove(),t.append(n);const s=new URL(window.location);s.searchParams.set("paged",r),window.history.pushState({},"",s),a(".ld-paypal-standard__current-subscriptions tbody tr").each(function(){i(a(this))}),e()},error:()=>{alert(n.__("Error loading page. Please try again.","learndash"))},complete:()=>{l.removeClass("loading"),p.find("a, input").prop("disabled",!1)}})}a("#learndash_settings_paypal_migration_settings_settings_paypal_migration_settings .learndash-section-field-password").each(function(){!function(t){if(t.siblings(".learndash-password-toggle-link").length>0)return;const s=a('<a href="#" class="learndash-password-toggle-link">'+n.__("Show","learndash")+"</a>");t.after(s),s.on("click",function(s){s.preventDefault();const i=a(this),e=t;"password"===e.attr("type")?(e.attr("type","text"),i.text(n.__("Hide","learndash"))):(e.attr("type","password"),i.text(n.__("Show","learndash")))})}(a(this))}),a(".ld-paypal-standard__current-subscriptions tbody tr").each(function(){i(a(this))}),e(),function(){const n=a("#learndash_settings_paypal_migration_subscriptions_include_migrated-on");0!==n.length&&n.on("change",function(){r(1)})}()}(jQuery,wp.i18n,ajaxurl,window.learndash.paypal_standard_admin_migration);