").addClass("shipping-title").append($("").addClass("shipping-price-title").text("Shipping:")).append($("").addClass("shipping-loading"));$("#open-estimate-shipping-popup").html(n)}},success:function(){let t=n.getActiveShippingOption();n.selectShippingOption(t);i=!0;n.handlers.success=undefined},error:function(){i||n.selectShippingOption()},selectedOption:function(n){if(n){let t=$("#open-estimate-shipping-popup"),r=$("
").addClass("shipping-title").append($("").addClass("shipping-price-title").text("Shipping:")).append($("").addClass("shipping-price").text(n.price));t.html(r);let i=$("").addClass("estimated-delivery").append($("").addClass("shipping-address").append($("").text(`to ${n.address.countryName}, ${n.address.stateProvinceName?n.address.stateProvinceName+",":""} ${n.address.zipPostalCode} via ${n.provider}`)).append($("").addClass("arrow-down")));n.deliveryDate&&n.deliveryDate!=="-"&&i.append($("").addClass("shipping-date").text(`Estimated Delivery on ${n.deliveryDate}`));t.append(i)}else $("#open-estimate-shipping-popup").html($("").text("Please select the address you want to ship from")).append($("").addClass("arrow-down"))}};n.init("#product-details-form",f,e,{NoShippingOptions:"No shipping options"});let r=function(){let t=n.getShippingAddress();n.addressIsValid(t)?n.getShippingOptions(t):n.selectShippingOption()};r();let u=function(){if(n.selectedShippingOption){let i=n.selectedShippingOption.address,r=n.getShippingAddress();n.addressesAreEqual(i,r)||(t=!0);n.getShippingOptions(i)}else i?t=!0:r()};setTimeout(function(){$(document).on("product_attributes_changed",u)},500);$(document).on("product_quantity_changed",u)})