jQuery(document).ready(function(e){var t=window.dropPrintProUpgradeData&&"object"==typeof window.dropPrintProUpgradeData?window.dropPrintProUpgradeData:{};function a(a){var r=a&&a.account_state?a.account_state:{};if(!0===r.is_pro||1===r.is_pro||"1"===r.is_pro||!0===r.pro_status||1===r.pro_status||"1"===r.pro_status){var i=e("#drop-print-account-status-value");if(i.length){var o=i.data("pro-label")||"Pro User";i.text(o)}var n=e("#drop-print-default-shipping-method");n.length&&n.prop("disabled",!1);var p=t.labels||{},d=e("#drop-print-default-shipping-method-description");d.length&&d.text(p.settings_shipping_description_pro||'Select your preferred default shipping method for new products. You can also change this per order during "Quote & Pay".');var s=e("#drop_print_auto_production");s.length&&(s.prop("disabled",!1),s.find("option").prop("disabled",!1));var c,l=e("#drop_print_auto_production_description");l.length&&l.text(p.settings_auto_production_description_pro||"Automatically send orders to print upon customer payment. Requires a valid payment card on file at Drop Print."),e(".drop-print-pro-upgrade-launcher").remove(),function(){var a=e(".drop-print-settings-wrap");if(a.length&&!a.find(".dp-pro-activated-notice").length){var r=t.labels&&t.labels.settings_pro_activated?t.labels.settings_pro_activated:"Congratulations! Your Drop Print Pro account has been activated.",i=e('<div class="notice notice-success is-dismissible dp-pro-activated-notice"><p></p></div>');i.find("p").text(r);var o=a.find("h1").first();o.length?o.after(i):a.prepend(i)}}(),c=function(t){t&&(t.available_media&&function(t,a){var r=e("#drop-print-default-media-id");if(r.length&&Array.isArray(t)&&t.length){var i=a||r.val();r.empty(),t.forEach(function(t){if(t&&t.id&&t.name){var a=e("<option></option>").attr("value",t.id).text(t.name);t.id===i&&a.prop("selected",!0),r.append(a)}}),r.prop("disabled",!1)}}(t.available_media,t.default_media_id),t.default_shipping_method&&n.length&&n.val(t.default_shipping_method),void 0!==t.auto_production&&s.length&&s.val(t.auto_production))},t.ajax_url&&t.refresh_data_action&&t.nonce?e.ajax({url:t.ajax_url,type:"POST",dataType:"json",data:{action:t.refresh_data_action,nonce:t.nonce}}).done(function(e){var t=e&&e.data?e.data:null;"function"==typeof c&&c(t)}).fail(function(){"function"==typeof c&&c(null)}):"function"==typeof c&&c(null)}}if(e(".drop-print-replace-packing-slip").on("click",function(){e("#drop-print-current-packing-slip-container").hide(),e("#drop-print-upload-packing-slip-container").show().find('input[type="file"]').trigger("focus")}),e(document).on("dropprint:pro-upgrade-complete",function(e,t){a(t||(e&&e.detail?e.detail:{}))}),window.history.replaceState){var r=new URL(window.location.href);(r.searchParams.has("pro")||r.searchParams.has("refreshed_by_action"))&&(r.searchParams.delete("pro"),r.searchParams.delete("id"),r.searchParams.delete("refreshed"),r.searchParams.delete("refresh_failed"),r.searchParams.delete("message"),r.searchParams.delete("refreshed_by_action"),window.history.replaceState({path:r.href},"",r.href))}});