1/*! woocommerce-name-your-price 3.1.2 */ 2 3function woocommerce_nyp_format_price(t,i,e){void 0===i&&(i=""),void 0===e&&(e=!1);var r=e?woocommerce_nyp_params.currency_format:"%v";return accounting.formatMoney(t,{symbol:i,decimal:woocommerce_nyp_params.currency_format_decimal_sep,thousand:woocommerce_nyp_params.currency_format_thousand_sep,precision:woocommerce_nyp_params.currency_format_num_decimals,format:r}).trim()}function woocommerce_nyp_unformat_price(t){return Math.abs(parseFloat(accounting.unformat(t,woocommerce_nyp_params.currency_format_decimal_sep)))}jQuery.fn.wc_nyp_get_script_object=function(){var t=jQuery(this);return void 0!==t.data("wc_nyp_script_obj")&&t.data("wc_nyp_script_obj")},function(o){var e=function(t){if(nyp_script_object=t.wc_nyp_get_script_object())return nyp_script_object;this.$el=t,this.$add_to_cart=t.find(".single_add_to_cart_button"),this.$addons_totals=this.$el.find("#product-addons-total"),this.show_addons_totals=!1,this.nypProducts=[],this.update_nyp_timer=!1,this.$el.trigger("wc-nyp-initializing",[this]),this.updateForm=this.updateForm.bind(this),this.$el.on("click",".single_add_to_cart_button",{nypForm:this},this.onSubmit),this.$el.on("wc-nyp-initialized",{nypForm:this},this.updateForm),this.$el.on("wc-nyp-updated",{nypForm:this},this.updateForm),this.initIntegrations(),this.$el.data("wc_nyp_script_obj",this),this.$el.trigger("wc-nyp-initialized",[this])};e.prototype.getProducts=function(){var r=this;return this.$el.find(".nyp").each(function(t){var i=o(this),e=i.wc_nyp_get_script_object();e||(e=new n(i)),r.nypProducts[t]=e}),r.nypProducts},e.prototype.initIntegrations=function(){this.$el.hasClass("variations_form")&&new t(this),this.$el.hasClass("grouped_form")&&new i(this),o("#woo_pp_ec_button_product").length&&new r(this)},e.prototype.updateForm=function(t,i){var e=t.data.nypForm;clearTimeout(e.update_nyp_timer),e.update_nyp_timer=setTimeout(function(){e.updateFormTask(i)},10)},e.prototype.updateFormTask=function(t){var i=!1,e=!1,r=this.getProducts();void 0===t&&void 0!==r&&r.length&&(t=r.shift()),void 0!==t&&void 0!==t.$price_input&&(e=t.$price_input.attr("name"),i=t.user_price,this.$add_to_cart.data(e,i),this.$addons_totals.data("price",i),this.$el.trigger("woocommerce-product-addons-update")),this.isValid()?(this.$add_to_cart.removeClass("nyp-disabled"),this.$el.trigger("wc-nyp-valid",[this])):(this.$add_to_cart.addClass("nyp-disabled"),this.$el.trigger("wc-nyp-invalid",[this]))},e.prototype.onSubmit=function(t){if(!t.data.nypForm.isValid("submit"))return t.preventDefault(),t.stopImmediatePropagation(),!1},e.prototype.isValid=function(i){var e=!0;return this.getProducts().forEach(function(t){if("submit"===i&&t.$el.trigger("wc-nyp-update"),!t.isValid())return!(e=!1)}),e},e.prototype.shutdown=function(){this.$el.find("*").off()};var n=function(t){if(nyp_script_object=t.wc_nyp_get_script_object())return nyp_script_object;var i=this;i.$el=t,i.$cart=t.closest(".cart"),i.$form=t.closest(".cart").not(".product, [data-bundled_item_id]"),i.$error=t.find(".woocommerce-nyp-message"),i.$error_content=i.$error.find("ul.woocommerce-error"),i.$label=t.find("label"),i.$screen_reader=t.find(".screen-reader-text"),i.$price_input=t.find(".nyp-input"),i.$period_input=t.find(".nyp-period"),i.$minimum=t.find(".minimum-price"),i.$subscription_terms=t.find(".subscription-details"),i.form=i.$form.wc_nyp_get_script_object(),i.min_price=parseFloat(t.data("min-price")),i.max_price=parseFloat(t.data("max-price")),i.annual_minimum=parseFloat(t.data("annual-minimum")),i.raw_price=i.$price_input.val(),i.user_price=woocommerce_nyp_unformat_price(i.raw_price),i.user_period=i.$period_input.val(),i.error_messages=[],i.optional=!1,i.initialized=!1,i.onUpdate=i.onUpdate.bind(i),i.val
3idate=i.validate.bind(i),this.$el.on("change",".nyp-input, .nyp-period",{nypProduct:this},this.onChange),this.$el.on("keypress",".nyp-input, .nyp-period",{nypProduct:this},this.onKeypress),this.$el.on("woocommerce-nyp-update",{nypProduct:this},this.onUpdate),this.$el.on("wc-nyp-update",{nypProduct:this},this.onUpdate),i.$el.data("wc_nyp_script_obj",i),i.$el.trigger("wc-nyp-update",[i])};function t(o){var a=this,s=o.getProducts().shift(),t=o.$add_to_cart.html();this.integrate=function(){o.$el.on("found_variation",a.onFoundVariation),o.$el.on("reset_image",a.resetVariations),o.$el.on("click",".reset_variations",a.resetVariations)},this.onFoundVariation=function(t,i){if(s.$error.slideUp(),null!=typeof i.is_nyp&&1==i.is_nyp){o.$add_to_cart.html(i.add_to_cart_text);var e=void 0!==i.display_price&&i.display_price?i.display_price:"";if(s.min_price=void 0!==i.minimum_price&&i.minimum_price?parseFloat(i.minimum_price):"",s.max_price=void 0!==i.maximum_price&&i.maximum_price?parseFloat(i.maximum_price):"",""!==e.trim()?s.$price_input.val(woocommerce_nyp_format_price(e)):s.$price_input.val(""),s.$label.length){var r="undefined"!==i.price_label?i.price_label:"";r?s.$label.html(r).show():s.$label.empty().hide()}if(s.$minimum.length){var n="undefined"!==i.minimum_price_html?i.minimum_price_html:"";n?s.$minimum.html(n).show():s.$minimum.empty().hide()}s.$el.slideDown(),s.$el.data("hide-minimum",i.hide_minimum),s.initialized=!1,s.$el.trigger("wc-nyp-update")}else a.resetVariations()},this.resetVariations=function(){o.$add_to_cart.html(t).removeClass("nyp-disabled"),s.$el.slideUp().removeClass("nyp-error"),s.initialized=!1,s.$error_content.empty(),s.$price_input.val("")},this.integrate()}function i(t){var i=this;this.integrate=function(){t.$el.on("change",".qty",i.onStatusChange),t.$el.find(".qty").change()},this.onStatusChange=function(){var t=o(this).closest("tr").find(".nyp");t.length&&(0<o(this).val()?t.data("optional_status",!0):t.data("optional_status",!1),t.trigger("wc-nyp-update",[{force:!0}]))},this.integrate()}function r(t){var i=this;this.integrate=function(){t.$el.on("wc-nyp-valid",i.enable),t.$el.on("wc-nyp-invalid",i.disable),o(document).on("wc_ppec_validate_product_form",i.validate)},this.enable=function(t){o("#woo_pp_ec_button_product").trigger("enable")},this.disable=function(t){o("#woo_pp_ec_button_product").trigger("disable")},this.validate=function(t,i,e){var r=e.wc_nyp_get_script_object();return"object"==typeof r&&(i=r.isValid()),i},this.integrate()}n.prototype.onChange=function(t){t.data.nypProduct.$el.trigger("wc-nyp-update",[t.data.nypProduct])},n.prototype.onKeypress=function(t){"Enter"===t.key&&(t.preventDefault(),t.data.nypProduct.$el.trigger("wc-nyp-update",[t.data.nypProduct]))},n.prototype.onUpdate=function(t,i){var e=this;if(void 0!==i&&i.hasOwnProperty("force")&&!0===i.force&&(this.initialized=!1),this.raw_price=this.$price_input.val().trim()?this.$price_input.val().trim():"",this.user_price=woocommerce_nyp_unformat_price(this.raw_price),this.user_period=this.$period_input.val(),""!==this.raw_price&&this.$price_input.val(woocommerce_nyp_format_price(this.user_price)),this.validate(),this.$el.data("price",this.user_price),this.$el.data("period",this.user_period),this.isValid())this.$el.removeClass("nyp-error"),this.$error.slideUp(),this.$el.trigger("wc-nyp-valid-item",[this]);else{var r=o("<ul/>"),n=this.getErrorMessages();0<n.length&&o.each(n,function(t,i){r.append(o("<li/>").html(i))}),this.$error_content.html(r.html()),this.$el.trigger("wc-nyp-invalid-item",[this])}this.isInitialized()&&!this.isValid()&&(this.$el.addClass("nyp-error"),this.$error.slideDown(function(){e.$price_input.focus().select()})),this.$cart.trigger("woocommerce-nyp-updated-item"),o("body").trigger("woocommerce-nyp-updated"),this.$el.trigger("wc-nyp-updated",[this]),this.initialized=!0},n.prototype.validate=function(){if(!this.priceChanged())return!0;if(this.resetMessages(),this.$el.data("nyp-valid",!0),this.isOptional())return!0;var t=this.$el.data("hide-minimum")?this.$el.data("hide-minimum-error"):this.$el.data("minimum-error"),i="%%MINIMUM%%",e="";
3if(0<this.annual_minimum){if(form_annulualized_price=this.user_price*woocommerce_nyp_params.annual_price_factors[this.user_period],form_annulualized_price<this.annual_minimum){var r=this.annual_minimum/woocommerce_nyp_params.annual_price_factors[this.user_period],n=this.$period_input.find('option[value="'+this.user_period+'"]').text();e=woocommerce_nyp_params.i18n_subscription_string.replace("%price",woocommerce_nyp_format_price(r,woocommerce_nyp_params.currency_format_symbol,!0)).replace("%period",n),this.addErrorMessage(t.replace(i,e))}}else this.min_price&&this.user_price<this.min_price?(e=woocommerce_nyp_format_price(this.min_price,woocommerce_nyp_params.currency_format_symbol,!0),this.addErrorMessage(t.replace(i,e))):this.max_price&&this.user_price>this.max_price?(t=this.$el.data("maximum-error"),i="%%MAXIMUM%%",e=woocommerce_nyp_format_price(this.max_price,woocommerce_nyp_params.currency_format_symbol,!0),this.addErrorMessage(t.replace(i,e))):""===this.raw_price&&(t=this.$el.data("empty-error"),this.addErrorMessage(t.replace(i,e)));this.isValid()||this.$el.data("nyp-valid",!1)},n.prototype.priceChanged=function(){return $changed=!0,this.$el.is(":visible")?this.isInitialized()&&this.raw_price===this.user_price&&this.user_price===this.$el.data("price")&&this.user_period===this.$el.data("period")&&($changed=!1):$changed=!1,$changed},n.prototype.isValid=function(){return!this.$el.is(":visible")||this.isOptional()||!this.error_messages.length},n.prototype.isOptional=function(){return"yes"===this.$el.data("optional")&&!1===this.$el.data("optional_status")},n.prototype.isInitialized=function(){return this.initialized},n.prototype.addErrorMessage=function(t){this.error_messages.push(t.toString())},n.prototype.getErrorMessages=function(t){return this.error_messages},n.prototype.resetMessages=function(){this.error_messages=[]},n.prototype.resetMessages=function(){this.error_messages=[]},n.prototype.getPrice=function(){return this.user_price},n.prototype.getPeriod=function(){return this.user_period},jQuery(document).ready(function(p){p.fn.wc_nyp_form=function(){var t=p(this),i=t.wc_nyp_get_script_object();return!!t.hasClass("cart")&&(i&&t.data("wc_nyp_script_obj").shutdown(),new e(t),this)},p("form.cart").each(function(){p(this).wc_nyp_form()}),new e(p("form.cart")),p("body").on("quick-view-displayed",function(){p("form.cart").each(function(){p(this).wc_nyp_form()})}),p(".wcopc .cart").each(function(){p(this).wc_nyp_form()}),p("body").on("opc_add_remove_product",function(t,i,e,r){if(void 0!==e){var n=p(e.currentTarget),o=n.closest(".cart").find(".nyp").wc_nyp_get_script_object();if(o){o.$el.trigger("wc-nyp-update");var a=parseFloat(i.quantity);if(0<a&&!o.isValid())"number"===n.prop("type")&&n.val(n.data("cart_quantity")),i.invalid=!0;else if(0===a){o.$el.removeClass("nyp-error"),o.$error.slideUp();var s=o.$el.data("initial-price");""!==p.trim(s)?o.$price_input.val(woocommerce_nyp_format_price(s)):o.$price_input.val("")}}}return i}),p("body .component").on("wc-composite-component-loaded",function(){var t=p(this).find(".nyp");if(t.length)new n(t);else p(this).trigger("wc-nyp-updated")})})}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.