(function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("DetailPageInstallmentCalculatorAssets",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){});
/* ******** */
(function(t){var g=window.AmazonUIPageJS||window.P,u=g._namespace||g.attributeErrors,e=u?u("ABPricingFreeFormQuantityPickerAssets",""):g;e.guardFatal?e.guardFatal(t)(e,window):e.execute(function(){t(e,window)})})(function(t,g,u){t.when("jQuery","A","abPricingFfqp_constants","abPricingFfqp_metrics","abPricingFfqp_amazonAPIPriceFormatter").register("abPricingFfqp_amazonAPIClient",function(e,g,f,a,d){return g.createClass({inclusions:function(){return{priceV1:"buyingOptions[].price(product.price/v1)",
quantityPricingTableV1:"buyingOptions[].quantityPricingTable(product.quantity-pricing-table/v1)",availabilityV2:"buyingOptions[].availability(product.availability/v2)"}},init:function(a){this._baseEndpoint="https://"+a.endpoint;this._baseUrl=this._baseEndpoint+"/api/marketplaces/"+a.marketplaceId+"/";this._defaultHeaders={"Accept-Language":a.language,"x-api-csrf-token":a.csrfToken,"x-cc-currency-of-preference":a.currencyOfPreference,"x-amzn-encrypted-slate-token":this._getSlateToken()};"object"===
typeof a.priceFormatConfig&&(this._aapiPriceFormatter=new d(a.priceFormatConfig));a=this._getValidatedClientId(a.clientId);this._metricScopeName=f.METRIC_SCOPE_NAME.AAPI_CLIENT.replace(f.AAPI_CLIENT_ID_PLACEHOLDER,a);this._statusMetricNameTpl=f.COUNTER_METRIC.AAPI_REQUEST_STATUS.replace(f.AAPI_CLIENT_ID_PLACEHOLDER,a)},_constructHeader:function(a,d){return"application/vnd.com.amazon.api+json; "+(""===a?"":'type\x3d"'+a+'"; ')+(""===d?"":'expand\x3d"'+d+'"; ')+'experiments\x3d"enableQuantityPricingTablePaginationField_dn2f4w34"'},
productV2:function(a){var d=["products",a.asin],f={Accept:this._constructHeader("product/v2",a.subresources.join(","))};d=this._constructUrl(d,a.parameters);this._get(a.success,a.error,d,f)},productQPT:function(a){var d={Accept:this._constructHeader("product.quantity-pricing-table/v1","")};this._get(a.success,a.error,this._baseEndpoint+a.url,d)},_getValidatedClientId:function(a){return"string"===typeof a&&0<a.length?a:f.UNSPECIFIED_CLIENT_ID},_get:function(d,l,g,k){var h=this;a.registerWidgetBodyBegin(this._metricScopeName);
k=e.extend(this._defaultHeaders,k);e.ajax({url:g,type:"GET",headers:k,xhrFields:{withCredentials:!0},timeout:f.AAPI_CLIENT_TIMEOUT}).done(function(a,c){h._handleAjaxSuccess(a,c,d)}).fail(function(a,c,m){h._handleAjaxError(c,m,l,a.status)}).always(function(a,c){h._handleAjaxComplete(c)})},_constructUrl:function(a,d){d=d||{};d=e.map(d,function(a,d){return d.toString()+"\x3d"+a.toString()}).join("\x26");return this._baseUrl+a.join("/")+(0<d.length?"?"+d:"")},_getSlateToken:function(){var a=document.querySelector('meta[name\x3d"encrypted-slate-token"]');
if(a)return a.content},_handleAjaxSuccess:function(d,f,e){this._aapiPriceFormatter&&this._aapiPriceFormatter.formatPrices(d);a.registerWidgetCriticalFeature(this._metricScopeName);a.registerWidgetLoaded(this._metricScopeName);e&&e(d,f)},_handleAjaxError:function(d,f,e,g){a.registerWidgetLoaded(this._metricScopeName);e&&e(d,f,g);d=["Error during ajax request:",g||"",d||"",f||""].join(" ");a.logError("ERROR",d)},_handleAjaxComplete:function(d){"string"!==typeof d&&(d=f.UNSPECIFIED_REQUEST_STATUS);d=
this._statusMetricNameTpl.replace(f.AAPI_REQUEST_STATUS_PLACEHOLDER,d);a.registerCounter(d)}})});"use strict";t.when("A","abPricingFfqp_constants","abPricingFfqp_metrics","abPricingFfqp_priceFormatter").register("abPricingFfqp_amazonAPIPriceFormatter",function(e,g,f,a){return e.createClass({init:function(d){this._priceFormatter=new a(d)},formatPrices:function(a){f.registerWidgetBodyBegin(g.METRIC_SCOPE_NAME.AAPI_PRICE_FORMATTER);try{this._formatPricesRec(a),f.registerWidgetCriticalFeature(g.METRIC_SCOPE_NAME.AAPI_PRICE_FORMATTER)}catch(n){throw n;
}finally{f.registerWidgetLoaded(g.METRIC_SCOPE_NAME.AAPI_PRICE_FORMATTER)}},_formatPricesRec:function(a){if(this._isPriceObject(a))a.displayString=this._formatPrice(a.amount,a.currencyCode,a.displayString);else if("object"===typeof a)for(var d in a)a.hasOwnProperty(d)&&this._formatPricesRec(a[d])},_isPriceObject:function(a){return"object"===typeof a&&this._priceFormatter.isValidPrice(a.amount,a.currencyCode)},_formatPrice:function(a,f,e){return"string"===typeof e&&0<e.length?e:this._priceFormatter.format(a,
f)}})});"use strict";t.when("A","abPricingFfqp_constants","abPricingFfqp_metrics").register("abPricingFfqp_priceFormatter",function(e,g,f){return e.createClass({init:function(a){a=a||{};this._priceFormat=a.priceFormat;this._decimalSeparator=a.decimalSeparator;this._fractionDigits=parseInt(a.fractionDigits);this._groupingSeparator=a.groupingSeparator;this._groupingDigits=parseInt(a.groupingDigits);this._secondaryGroupingDigits=parseInt(a.secondaryGroupingDigits);this._minGroupingDigits=parseInt(a.minGroupingDigits);
this._currencyCode=a.currencyOfPreference;this._validateInput();0===this._secondaryGroupingDigits&&(this._secondaryGroupingDigits=this._groupingDigits)},format:function(a,d){a=parseFloat(a);isNaN(a)&&this._throwValidationError("amount");if(0>a)return"-"+this.format(-a,d);a=this._formatAmount(a);return this._currencyFormat(d).replace("{}",a)},isValidPrice:function(a,d){a=parseFloat(a);return!isNaN(a)&&0<=a&&this._isValidCurrencyCode(d)},_validateInput:function(){this._validatePriceFormat();this._validateSeparator("decimalSeparator",
this._decimalSeparator);this._validateSeparator("groupingSeparator",this._groupingSeparator);this._validateDigitsCount("fractionDigits",this._fractionDigits,0);this._validateDigitsCount("groupingDigits",this._groupingDigits,0);this._validateDigitsCount("secondaryGroupingDigits",this._secondaryGroupingDigits,0);this._validateDigitsCount("minGroupingDigits",this._minGroupingDigits,1);this._validateCurrencyCode()},_validatePriceFormat:function(){"string"===typeof this._priceFormat&&-1!==this._priceFormat.indexOf("{}")||
this._throwValidationError("priceFormat")},_validateSeparator:function(a,d){"string"===typeof d&&0!==d.length||this._throwValidationError(a)},_validateDigitsCount:function(a,d,f){("number"!==typeof d||isNaN(d)||d<f)&&this._throwValidationError(a)},_validateCurrencyCode:function(){this._isValidCurrencyCode(this._currencyCode)||this._throwValidationError("currencyOfPreference")},_isValidCurrencyCode:function(a){return"string"===typeof a&&/^[A-Z]{3}$/.test(a)},_throwValidationError:function(a){throw Error("[abPricingFfqp_priceFormatter] Invalid value for "+
a);},_formatAmount:function(a){var d=this._halfEvenRound(a,this._fractionDigits).toString().split(".");a=this._formatIntegerPart(d[0]);if(0===this._fractionDigits)return a;d=this._formatDecimalPart(2===d.length?d[1]:"");return[a,d].join(this._decimalSeparator)},_halfEvenRound:function(a,d){a*=Math.pow(10,d);var f=a%1;a=.500001<=f||1E-6>Math.abs(f-.5)&&1===Math.floor(a)%2?Math.ceil(a):Math.floor(a);return a/Math.pow(10,d)},_formatIntegerPart:function(a){if(0===this._groupingDigits||a.length<this._groupingDigits+
this._minGroupingDigits)return a;for(var d=a.length,f=!0,e=[];0<d;){var g=this._secondaryGroupingDigits;f&&(f=!1,g=this._groupingDigits);d<g?e.push(a.substr(0,d)):e.push(a.substr(d-g,g));d-=g}return e.reverse().join(this._groupingSeparator)},_formatDecimalPart:function(a){for(;a.length<this._fractionDigits;)a+="0";return a.substr(0,this._fractionDigits)},_currencyFormat:function(a){if(a===this._currencyCode)return this._priceFormat;this._isValidCurrencyCode(a)||this._throwValidationError("currencyCode");
f.registerCounter(g.COUNTER_METRIC.FALLBACK_PRICE_FORMAT_USED);return a+" {}"}})});"use strict";t.register("abPricingFfqp_constants",function(){return{PACKAGE_PREFIX:"ABPricingFreeFormQuantityPicker",METRIC_SCOPE_NAME:{AAPI_PRICE_FORMATTER:"b2b-ffqp-aapi-price-formatter",AAPI_CLIENT:"b2b-ffqp-aapi-client-{clientId}",AAPI_QPT:"b2b-ffqp-aapi-qpt",AAPI_PACK_ASIN:"b2b-ffqp-aapi-pack-asin",AAPI_SINGLE_QUANTITY:"b2b-ffqp-aapi-single-quantity",AUI_STATE_PARSING:"b2b-ffqp-aui-state-parsing",GET_QPT_REQUEST:"b2b-ffqp-get-qpt-request"},
COUNTER_METRIC:{FALLBACK_PRICE_FORMAT_USED:"ABPricingFreeFormQuantityPicker.FallbackPriceFormatUsed",AAPI_REQUEST_STATUS:"ABPricingFreeFormQuantityPicker.AAPIClient.{clientId}.status.{status}",AAPI_SINGLE_QUANTITY_BO_NOT_FOUND:"ABPricingFreeFormQuantityPicker.AAPISingleQuantityBONotFound",AAPI_SINGLE_QUANTITY_EXTRACTION_FAILED:"ABPricingFreeFormQuantityPicker.AAPISingleQuantityBONotFoundExtractionFailed",AAPI_PACK_ASIN_EXTRACTION_FAILED:"ABPricingFreeFormQuantityPicker.AAPIPackAsinExtractionFailed",
AAPI_PACK_ASIN_BO_NOT_FOUND:"ABPricingFreeFormQuantityPicker.AAPIPackAsinBONotFound",AAPI_PACK_ASIN_MISSING:"ABPricingFreeFormQuantityPicker.AAPIPackAsinMissing",AAPI_PACK_ASIN_MISSING_BO:"ABPricingFreeFormQuantityPicker.AAPIPackAsinMissing.{bo}",AAPI_PACK_ASIN_ERROR:"ABPricingFreeFormQuantityPicker.AAPIPackAsinError",AAPI_PACK_ASIN_ERROR_CODE:"ABPricingFreeFormQuantityPicker.AAPIPackAsinError.{code}",AAPI_PACK_ASIN_PRESENT:"ABPricingFreeFormQuantityPicker.AAPIPackAsinPresent",AAPI_QPT_BO_NOT_FOUND:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableBONotFound",
AAPI_QPT_MISSING:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableMissing",AAPI_QPT_MISSING_BO:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableMissing.{bo}",AAPI_QPT_ERROR:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableError",AAPI_QPT_ERROR_CODE:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableError.{code}",AAPI_QPT_PRESENT:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePresent",AAPI_QPT_PAGINATES:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginates",
AAPI_QPT_FETCH_PAGE:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableFetchPage",AAPI_QPT_PAGE_FETCHED:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePageFetched",AAPI_QPT_PAGINATION_COMPLETE:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginationComplete",AAPI_QPT_NEXT_PAGE_ONLY:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableNextPageOnly",AAPI_QPT_PAGE_MISSING:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginationPageMissing",AAPI_QPT_EXTRACTION_FAILED:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableExtractionFailed",
AAPI_QPT_CONVERSION_ERROR:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTableConversionFailed",AAPI_QPT_PAGINATION_PAGE_ERROR:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginationPageError",AAPI_QPT_PAGINATION_ERROR:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginationError",AAPI_QPT_PAGINATION_404_ERROR:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePagination404Error",AAPI_QPT_PAGINATION_404_EXCEPTION:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePagination404Exception",
AAPI_QPT_MAX_PAGINATION_DEPTH_REACHED:"ABPricingFreeFormQuantityPicker.AAPIQuantityPricingTablePaginationDepthReached",AAPI_QPT_WEBLABS_TRIGGERING_EXCEPTION:"ABPricingFreeFormQuantityPicker.WeblabTriggeringException",AAPI_SUBRESOURCE_WEBLABS_TRIGGERING_EXCEPTION:"ABPricingFreeFormQuantityPicker.SubresourceWeblabTriggeringException",AAPI_DATA_MGR_INIT_FAILED:"ABPricingFreeFormQuantityPicker.AAPIDataManagerInitializationFailed",PACK_ASIN_RECOMMENDATION_ERROR:"ABPricingFreeFormQuantityPicker.PackAsinRecommendationError",
QUANTITY_REFRESH_CHECK_ERROR:"ABPricingFreeFormQuantityPicker.QuantityRefreshCheckError",PAGE_WILL_REFRESH:"ABPricingFreeFormQuantityPicker.PageWillRefresh",NO_PAGE_REFRESH_QTY_AVAILABLE:"ABPricingFreeFormQuantityPicker.NoPageRefreshQtyAvailable",NO_PAGE_REFRESH_QTY_NOT_AVAILABLE:"ABPricingFreeFormQuantityPicker.NoPageRefreshQtyNotAvailable",AVAILABILITY_CHECK_QTY_AVAILABLE_SHOULD_REFRESH:"ABPricingFreeFormQuantityPicker.AvailabilityCheckQtyAvailableShouldRefresh",AVAILABILITY_CHECK_PAGE_WILL_REFRESH:"ABPricingFreeFormQuantityPicker.AvailabilityCheckPageWillRefresh",
AVAILABILITY_CHECK_QTY_AVAILABLE_NO_REFRESH:"ABPricingFreeFormQuantityPicker.AvailabilityCheckQtyAvailableNoRefresh",AVAILABILITY_CHECK_QTY_AVAILABLE:"ABPricingFreeFormQuantityPicker.AvailabilityCheckQtyAvailable",OPTIMIZER_POPOVER_DISPLAYED:"ABPricingFreeFormQuantityPicker.OptimizerPopoverDisplayed",OPTIMIZER_BOTTOM_SHEET_DISPLAYED:"ABPricingFreeFormQuantityPicker.OptimizerBottomSheetDisplayed",AVAILABILITY_CHECK_QTY_NOT_AVAILABLE:"ABPricingFreeFormQuantityPicker.AvailabilityCheckQtyNotAvailable",
AVAILABILITY_CHECK_ERROR:"ABPricingFreeFormQuantityPicker.AvailabilityCheckError",MISSING_AJAX_PARAMS:"ABPricingFreeFormQuantityPicker.MissingAjaxParams",SPLIT_OFFER_LINK_DISPLAYED:"SplitOfferLinkDisplayed"},ERROR:{AAPI_DATA_MGR_INIT_FAILED:"AAPIDataManager initialization failed",MISSING_AJAX_PARAMS:"AAPIDataManager could not find the AJAX parameters"},AAPI_CLIENT_ID_PLACEHOLDER:"{clientId}",AAPI_METADATA_EXPERIMENTS:"x-api-exp-data",AAPI_REQUEST_STATUS_PLACEHOLDER:"{status}",AAPI_ERROR_CODE_PLACEHOLDER:"{code}",
AAPI_BO_PLACEHOLDER:"{bo}",UNSPECIFIED_CLIENT_ID:"unspecified",UNSPECIFIED_REQUEST_STATUS:"unspecified",AAPI_CLIENT_TIMEOUT:6E3,AJAX_PARAMS_STATE_KEY:"quantityPickerAjaxParams",MAX_SUPPORTED_QTY:999,MAX_PAGINATION_DEPTH:10,ADD_TO_CART_QUANTITY_CHANGE_EVENT:"addToCartQuantityChange",URL_PARAM_ID__BUYING_IN_BULK_QUANTITY:"quantity",URL_PARAM_ID__BUYING_IN_BULK_REFTAG:"ref_",URL_PARAM_ID__BUYING_IN_BULK_ASIN:"asin",URL_PARAM_VALUE__LIMITED_AVAILABILITY_REFTAG:"bbt_limit_order",WEBLAB_AUTOTRIGGER_ALLOWLIST:["AB_SAVINGS_STANDARDIZATION_EXPERIMENT_868536",
"B2BHAWKS_QPT_PAGE_LIMIT_DATAPATH_1033347","AB_DPX_OPTIMIZER_EXPERIMENT_1056062"]}});"use strict";t.when("jQuery","abPricingFfqp_constants","ready").register("abPricingFfqp_metrics",function(e,p){function f(d){a.isEnabled&&g.ue&&g.ue.count&&g.ue.count(d,(g.ue.count(d)||0)+1)}var a={isEnabled:!0};return{logError:function(a,f,e){g.ueLogError&&(a={logLevel:a,attribution:p.PACKAGE_PREFIX},e?a.message=f+" ":e={message:f},g.ueLogError(e,a))},register:function(a){a.counter&&f(a.counter)},registerCounter:f,
registerWidgetBodyBegin:function(d){a.isEnabled&&g.uet&&g.uet("bb",d,{wb:1})},registerWidgetCriticalFeature:function(d){a.isEnabled&&g.uet&&g.uet("cf",d,{wb:1})},registerWidgetLoaded:function(d){a.isEnabled&&g.uex&&g.uex("ld",d,{wb:1})},triggerWeblabIfAllowlisted:function(a,f){p.WEBLAB_AUTOTRIGGER_ALLOWLIST.includes(a)&&g.ue&&g.ue.trigger&&g.ue.trigger(a,f)}}});"use strict";t.when("jQuery","A","abPricingFfqp_utils","abPricingFfqp_constants","abPricingFfqp_metrics","abPricingFfqp_quantityPickerDataManager").register("abPricingFfqp_quantityManager",
function(e,p,f,a,d,n){function l(c,a){return(c=(new RegExp("(?:^|\\?|\x26)"+a+"\x3d(?:([^\x26#]*)|\x26|#|$)")).exec(c))?c[1]?decodeURIComponent(c[1].replace(/\+/g," ")):"":u}function q(c,a,b){var m=c.split("#");c=m[0];c="?"===c[0]?c.substr(1):c;m=m[1];"undefined"!==typeof b&&null!==b?(b=a+"\x3d"+b,a=new RegExp("(^|\x26)("+a+"\x3d[^\x26]*)"),c=a.test(c)?c.replace(a,"$1"+b):c+((0!==c.length?"\x26":"")+b)):(a=new RegExp("(^|\x26)("+a+"\x3d[^\x26]*)"),a.test(c)&&(c=c.replace(a,""),"\x26"===c[0]&&(c=c.substr(1))));
return"?"+c+("undefined"!==typeof m?"#"+m:"")}function k(c,a){for(var b in a)a.hasOwnProperty(b)&&(c=q(c,encodeURIComponent(b),encodeURIComponent(a[b])));return c}function h(c){return g.location.protocol+"//"+g.location.host+g.location.pathname+k(g.location.search,c)}function b(){var c=parseInt(l(g.location.search,"qty"));c=isNaN(c)||1>c||c>a.MAX_SUPPORTED_QTY?1:c;this._initialQuantity=this.currentQuantity=c;this.wireUpSelectorBasedEvents()}p.on("ready",function(){g.location.search.includes("\x26bmsmSlotRedirect\x3d1")&&
document.getElementById("qtyUpdatedTooltip").click()});b.prototype.getCurrentQuantity=function(){return this.currentQuantity};b.prototype.wireUpSelectorBasedEvents=function(){var c=this;t.when("A","jQuery","quanityChangePriceUpdate").execute(function(a,b,h){c.quantityChangePriceUpdater=h;a.on("a:pageUpdate",function(){c.handleTwisterPageRefresh()})})};b.prototype.update3PPriceBlock=function(){if(!(this.leastMinimumOrderQuantity===u||1>=this.leastMinimumOrderQuantity)){var c=e(".price3P");c.hasClass("updatedPrice3P")||
(c.addClass("updatedPrice3P"),this.quantityChangePriceUpdater.ajaxCall({qt:this.leastMinimumOrderQuantity,quantityPriceField:"quantity_price"}))}};b.prototype.handleTwisterPageRefresh=function(){this.update3PPriceBlock()};b.prototype.reloadPageForQuantity=function(c,a){var b={},m="";b.qty=c;b.psc=1;c="";"undefined"!==typeof a&&("undefined"!==typeof a.refTag&&(b.ref_=a.refTag),"string"===typeof a.selectedBuyingOption&&0<a.selectedBuyingOption.length&&(b.sbo=a.selectedBuyingOption),"undefined"!==typeof a.merchantId&&
(b.smid=a.merchantId),"undefined"!==typeof a.anchorToDiv&&(c=a.anchorToDiv),"undefined"!==typeof a.asinDetailPageUrl&&(m=g.location.protocol+"//"+g.location.host+a.asinDetailPageUrl+k("",b)+"\x26bmsmSlotRedirect\x3d1"+c));0===m.length&&(m=h(b)+c);g.location.href=m};b.prototype.notifyQuantityTyped=function(c,b){this.quantityRefreshCheck({newQuantity:c,currentBuyBoxId:b.currentBuyBoxId,qdsForLockedMerchantEnabled:b.qdsForLockedMerchantEnabled,success:function(c,m){d.registerCounter(c?a.COUNTER_METRIC.AVAILABILITY_CHECK_QTY_AVAILABLE:
a.COUNTER_METRIC.AVAILABILITY_CHECK_QTY_NOT_AVAILABLE);b.callback({hasAvailability:c})},error:function(){d.registerCounter(a.COUNTER_METRIC.AVAILABILITY_CHECK_ERROR);b.callback({hasAvailability:!0})}})};b.prototype.buyboxRefreshCheck=function(c){var b=this;this.quantityRefreshCheck({newQuantity:c.newQuantity,currentBuyBoxId:c.currentBuyBoxId,qdsForLockedMerchantEnabled:c.qdsForLockedMerchantEnabled,startEvent:"quantityRefreshCheckStarted",success:function(m,h){c.newQuantity===b.currentQuantity&&(m&&
h?(d.registerCounter(a.COUNTER_METRIC.PAGE_WILL_REFRESH),b.reloadPageForQuantity(c.newQuantity,{activeBuyBoxId:c.activeBuyBoxId,selectedBuyingOption:c.selectedBuyingOption})):(d.registerCounter(m?a.COUNTER_METRIC.NO_PAGE_REFRESH_QTY_AVAILABLE:a.COUNTER_METRIC.NO_PAGE_REFRESH_QTY_NOT_AVAILABLE),c.callback({hasAvailability:m})),p.trigger("quantityRefreshCheckFinished"))},error:function(){d.registerCounter(a.COUNTER_METRIC.QUANTITY_REFRESH_CHECK_ERROR);c.newQuantity===b.currentQuantity&&b.reloadPageForQuantity(c.newQuantity,
{activeBuyBoxId:c.activeBuyBoxId,selectedBuyingOption:c.selectedBuyingOption})}})};b.prototype.notifyQuantityChanged=function(c,a){c=parseInt(c);if(this.currentQuantity!==c){this.currentQuantity=c;if(g.history!==u&&g.history.pushState!==u){var b={};b.qty=c;g.history.pushState({},"",h(b))}p.trigger("buyBoxQuantityChanged",a.senderId,c,{newQuantity:c,activeBuyBoxId:a.activeBuyBoxId,selectedBuyingOption:a.selectedBuyingOption});p.trigger("notifyBuyingInBulkOptionClicked",c)}};b.prototype.quantityRefreshCheck=
function(c){if(!0!==c.preventRefreshCheck){var a={asin:f.getPageState().asin,initialQuantity:this._initialQuantity,quantity:c.newQuantity,currentBuyBoxId:c.currentBuyBoxId,success:c.success,error:c.error};if(c.qdsForLockedMerchantEnabled){var b=l(g.location.search,"smid");"undefined"!==typeof b&&(a.merchantId=b)}"string"===typeof c.startEvent&&p.trigger(c.startEvent);n.getInstance().refreshCheck(a)}};b.prototype.fetchAllTiersForQuantityDiscountTable=function(c){var a=this.isQPTBuyBoxAwareEnabled(c),
b={asin:f.getPageState().asin,enableQPTPagination:"true"};a&&(b.currentBuyBoxId=c.activeBuyBoxId);if(c.qdsForLockedMerchantEnabled){var h=l(g.location.search,"smid");"undefined"!==typeof h&&(b.merchantId=h)}h=c.enableQuantityPricingTablePagination;"undefined"!==h&&(b.enableQPTPagination=!1===h?"false":"true");var d=this;this.triggerBuyBoxAwareEvent("fetchQuantityDiscountTableStarted",c);b.success=function(b){a?p.trigger("fetchQuantityDiscountTableCompleted",b,c.senderId):p.trigger("fetchQuantityDiscountTableCompleted",
b)};b.error=function(){d.triggerBuyBoxAwareEvent("fetchQuantityDiscountTableError",c)};n.getInstance().getQuantityPricingTable(b)};b.prototype.isQPTBuyBoxAwareEnabled=function(c){return c&&c.senderId&&c.activeBuyBoxId};b.prototype.triggerBuyBoxAwareEvent=function(c,a){this.isQPTBuyBoxAwareEnabled(a)?p.trigger(c,a.senderId):p.trigger(c)};b.prototype.notifyBuyingInBulkOptionClicked=function(c){p.trigger("notifyBuyingInBulkOptionClicked",c)};b.prototype.getLimitedAvailabilityUrl=function(c){var b={};
b[a.URL_PARAM_ID__BUYING_IN_BULK_QUANTITY]=c;b[a.URL_PARAM_ID__BUYING_IN_BULK_ASIN]=f.getPageState().asin;b[a.URL_PARAM_ID__BUYING_IN_BULK_REFTAG]=a.URL_PARAM_VALUE__LIMITED_AVAILABILITY_REFTAG;return"/ab/bulk-order/bebx/api/v2/fastForwardBasket"+k("?",b)};b.prototype.notifyQuantityUnavailableOptionClicked=function(c){c=g.location.protocol+"//"+g.location.host+this.getLimitedAvailabilityUrl(c);g.location.href=c};return{EVENT__BUY_BOX_QUANTITY_CHANGED:"buyBoxQuantityChanged",EVENT__QUANTITY_REFRESH_CHECK_STARTED:"quantityRefreshCheckStarted",
EVENT__QUANTITY_REFRESH_CHECK_FINISHED:"quantityRefreshCheckFinished",EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_STARTED:"fetchQuantityDiscountTableStarted",EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_COMPLETED:"fetchQuantityDiscountTableCompleted",EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_ERROR:"fetchQuantityDiscountTableError",EVENT__NOTIFY_BUYING_IN_BULK_OPTION_CLICKED:"notifyBuyingInBulkOptionClicked",getUrlParameter:l,replaceUrlParameter:q,replaceUrlQueryParameters:function(c,a){var b="?";c=c.split(b);2===c.length&&
(b+=c[1]);a=k(b,a);"?"!==a&&(c[0]+=a);return c[0]},singleton:new b}});"use strict";t.when("A","jQuery","abPricingFfqp_constants","abPricingFfqp_metrics","abPricingFfqp_amazonAPIClient","abPricingFfqp_helpers","ready").register("abPricingFfqp_quantityPickerDataManager",function(e,g,f,a,d,n){var l=e.createClass({_buyboxIdToBOTypes:{customOffer:["CUSTOM_OFFER"],b2bRd:["B2B_RD"],default:["NEW","B2B_NEW"]},_buyboxIdToFallbackBOTypes:{customOffer:["NEW","B2B_NEW"]},init:function(a){this._aapiClient=new d(a);
this._qptCache=this._getQPTCacheInstance();this._quantityDataCache=this._getQuantityDataCacheInstance()},getQuantityPricingTable:function(h){a.registerWidgetBodyBegin(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST);var b=this;this._qptCache.get(h,function(c){try{var m=b._extractQPT(c,h),d=b._extractPricingTiers(m);if(b._hasNextPage(m)){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATES);a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_FETCH_PAGE);var e=b._extractNextPage(m);b._aapiQPTRequest({asin:h.asin,nextPageUrl:e,
pricingTiersPages:[d],onSuccess:h.success,onError:h.error})}else{var g=b._convertToLegacyFormat(d);h.success(g)}}catch(v){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_EXTRACTION_FAILED),a.logError("ERROR","Exception during requesting quantity pricing table:",v),h.error(v)}},h.error)},refreshCheck:function(a){function b(c){d||(d=!0,a.error(c))}var c=this,h={},d=!1;g.each([a.quantity,a.initialQuantity],function(d,m){c._getSingleQuantityData({asin:a.asin,merchantId:a.merchantId,quantity:m,currentBuyBoxId:a.currentBuyBoxId,
success:function(c){h[m]=c;if(h[a.initialQuantity]&&h[a.quantity]){c=h[a.initialQuantity];var b=h[a.quantity];a.success(b.isAvailable,c.price!==b.price||c.buyingOptionId!==b.buyingOptionId)}},error:b})})},_aapiRequest:function(h){a.registerWidgetBodyBegin(h.metricScopeName);this._aapiClient.productV2({asin:h.asin,subresources:h.subresources,parameters:h.parameters,success:function(b){a.registerWidgetCriticalFeature(h.metricScopeName);a.registerWidgetLoaded(h.metricScopeName);h.onSuccess(b)},error:function(b,
c){a.registerWidgetLoaded(h.metricScopeName);h.onError(b,c)}})},_triggerQPTWeblabsIfAllowlisted:function(h){if(h.metadata&&h.metadata[f.AAPI_METADATA_EXPERIMENTS])try{h.metadata[f.AAPI_METADATA_EXPERIMENTS].split(",").forEach(function(b){b=b.split(":",2);a.triggerWeblabIfAllowlisted(b[0],b[1])})}catch(b){a.logError("ERROR","Could not trigger weblabs",b),a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_WEBLABS_TRIGGERING_EXCEPTION)}},_aapiQPTRequest:function(h){var b=this;this._aapiClient.productQPT({asin:h.asin,
url:h.nextPageUrl,success:function(c){try{var d=b._processQPTPage(c);h.pricingTiersPages.push(b._extractPricingTiers(d));a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGE_FETCHED);b._maxPaginationDepthGuardrail(h.pricingTiersPages.length);if(b._hasNextPage(d)){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_FETCH_PAGE);var e=b._extractNextPage(d);b._aapiQPTRequest({asin:h.asin,nextPageUrl:e,pricingTiersPages:h.pricingTiersPages,onSuccess:h.onSuccess,onError:h.onError})}else{var g=b._constructTiers(h.pricingTiersPages),
n=b._convertToLegacyFormat(g);a.registerWidgetCriticalFeature(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST);a.registerWidgetLoaded(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST);a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATION_COMPLETE);h.onSuccess(n)}}catch(v){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATION_PAGE_ERROR),a.logError("ERROR","Exception when processing next page",v),h.onError(v)}},error:function(c,d,e){if(404===e){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATION_404_ERROR);try{var m=
b._constructTiers(h.pricingTiersPages),g=b._convertToLegacyFormat(m);a.registerWidgetCriticalFeature(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST);a.registerWidgetLoaded(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST);h.onSuccess(g)}catch(v){a.registerWidgetLoaded(f.METRIC_SCOPE_NAME.GET_QPT_REQUEST),a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATION_404_EXCEPTION),a.logError("ERROR","Exception when processing empty page",v),h.onError(v)}}else a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGINATION_ERROR),h.onError(c,
d)}})},_maxPaginationDepthGuardrail:function(h){if(h>=this.getMaxPaginationDepth())throw a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_MAX_PAGINATION_DEPTH_REACHED),Error("Max pagination depth reached");},getMaxPaginationDepth:function(){return f.MAX_PAGINATION_DEPTH},_getQPTCacheInstance:function(){var a=this,b=[a._aapiClient.inclusions().quantityPricingTableV1];return new n.AsyncCache({loader:function(c,h,d){var m={};"string"===typeof c.merchantId&&(m.merchantId=c.merchantId);m.enableQuantityPricingTablePagination=
c.enableQPTPagination;a._aapiRequest({asin:c.asin,subresources:b,parameters:m,onSuccess:h,onError:d,metricScopeName:f.METRIC_SCOPE_NAME.AAPI_QPT})},keyGenerator:function(a){var c=a.asin;"string"===typeof a.merchantId&&(c+=a.merchantId);return c}})},_getQuantityDataCacheInstance:function(){var a=this,b=[a._aapiClient.inclusions().priceV1,a._aapiClient.inclusions().availabilityV2];return new n.AsyncCache({loader:function(c,h,d){var m={itemQuantity:c.quantity};"string"===typeof c.merchantId&&(m.merchantId=
c.merchantId);a._aapiRequest({asin:c.asin,subresources:b,parameters:m,onSuccess:h,onError:d,metricScopeName:f.METRIC_SCOPE_NAME.AAPI_SINGLE_QUANTITY})},keyGenerator:function(a){var c=a.asin+a.quantity.toString();"string"===typeof a.merchantId&&(c+=a.merchantId);return c}})},_firstBuyingOption:function(a){return a.entity.buyingOptions[0]},_firstBuyingOptionByType:function(a,b){a=a.entity.buyingOptions;for(var c=0;c<a.length;c++){var d=a[c];if(-1!==b.indexOf(d.type))return d}},_firstBuyingOptionByBuyboxId:function(a,
b){a=this._firstBuyingOptionByType(a,this._buyboxIdToBOTypes[b]||this._buyboxIdToBOTypes.default);if("undefined"===typeof a)throw Error("Could not find an eligible buying option");return a},_firstBuyingOptionByBuyboxIdWithFallback:function(a,b){var c=this._buyboxIdToFallbackBOTypes[b];b=this._firstBuyingOptionByType(a,this._buyboxIdToBOTypes[b]||this._buyboxIdToBOTypes.default);"undefined"===typeof b&&"undefined"!==typeof c&&(b=this._firstBuyingOptionByType(a,c));if("undefined"===typeof b)throw Error("Could not find an eligible or fallback buying option");
return b},_extractQPT:function(d,b){try{var c=this._firstBuyingOptionByBuyboxId(d,b.currentBuyBoxId)}catch(m){a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_BO_NOT_FOUND);a.logError("ERROR","Exception when getting first BO",m);return}d=c.quantityPricingTable;if("undefined"===typeof d||"undefined"===typeof d.entity)a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_MISSING),"string"===typeof c.type&&a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_MISSING_BO.replace(f.AAPI_BO_PLACEHOLDER,c.type));else return this._triggerQPTWeblabsIfAllowlisted(d),
d},_processQPTPage:function(d){if("undefined"===d.entity)a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PAGE_MISSING);else return d},_extractPricingTiers:function(d){if("undefined"===typeof d)return[];var b=d.entity.pricingTiers;if("undefined"===typeof b&&this._hasNextPage(d))return a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_NEXT_PAGE_ONLY),[];if("undefined"===typeof b)throw a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_ERROR),d=d.entity.code,"string"===typeof d&&a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_ERROR_CODE.replace(f.AAPI_ERROR_CODE_PLACEHOLDER,
d)),Error("Error in the QPT sub-resource");a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_PRESENT);return b},_hasNextPage:function(a){return"undefined"!==typeof a&&"undefined"!==typeof a.entity.nextPage},_extractNextPage:function(a){return a.entity.nextPage.resource.url},_constructTiers:function(a){for(var b=0,c=[],d=0;d<a.length;d++)for(var f=0;f<a[d].length;f++){var e=a[d][f],h=e.minimumQuantity;h!==b&&(b=h,c.push(e))}return c},_convertToLegacyFormat:function(d){var b=[];try{for(var c=0;c<d.length;c++){var e=
d[c],h={quantity:e.minimumQuantity,quantityPickerPriceText:n.richContentHelper.toText(e.priceMessage),isUncompetitive:e.hidden,isLowestAvailablePrice:e.lowestAvailablePrice};e.savingsMessage&&(h.savingsMessage=n.richContentHelper.toText(e.savingsMessage));e.availabilityMessage&&(h.availabilityMessage=n.richContentHelper.toText(e.availabilityMessage));e.program&&(h.program=e.program);e.buyingInBulk&&"undefined"!==typeof e.buyingInBulk.fragments&&1<=e.buyingInBulk.fragments.length&&(h.buyingInBulkLink=
n.richContentHelper.toText(e.buyingInBulk.fragments[0]),h.buyingInBulkMessage=n.richContentHelper.toText({fragments:e.buyingInBulk.fragments.slice(1)}));b.push(h)}}catch(w){throw a.registerCounter(f.COUNTER_METRIC.AAPI_QPT_CONVERSION_ERROR),w;}return b},_extractSingleQuantityData:function(d,b){var c={isAvailable:!1,buyingOptionId:"",price:""};try{var e=this._firstBuyingOptionByBuyboxIdWithFallback(d,b)}catch(x){return a.registerCounter(f.COUNTER_METRIC.AAPI_SINGLE_QUANTITY_BO_NOT_FOUND),a.logError("ERROR",
"Exception during extracting single quantity data:",x),c}try{return{isAvailable:"OUT_OF_STOCK"!==e.availability.entity.type,buyingOptionId:e.availability.resource.url,price:e.price.entity.priceToPay.moneyValueOrRange.value.displayString}}catch(x){return a.registerCounter(f.COUNTER_METRIC.AAPI_SINGLE_QUANTITY_EXTRACTION_FAILED),c}},_getSingleQuantityData:function(a){var b=this;b._quantityDataCache.get({asin:a.asin,merchantId:a.merchantId,quantity:a.quantity},function(c){a.success(b._extractSingleQuantityData(c,
a.currentBuyBoxId))},a.error)}}),p=e.createClass({init:function(a){this._errorMessage=a},getQuantityPricingTable:function(a){a.error&&a.error(this._errorMessage)},refreshCheck:function(a){a.error&&a.error(this._errorMessage)}}),k;return{getInstance:function(){if("undefined"!==typeof k)return k;var d=e.state(f.AJAX_PARAMS_STATE_KEY);"undefined"===typeof d&&(a.registerWidgetBodyBegin(f.METRIC_SCOPE_NAME.AUI_STATE_PARSING),e.state.parse(),a.registerWidgetLoaded(f.METRIC_SCOPE_NAME.AUI_STATE_PARSING),
d=e.state(f.AJAX_PARAMS_STATE_KEY));if("undefined"!==typeof d){d.priceFormatConfig=d;d.clientId="dpx";try{k=new l(d)}catch(b){a.registerCounter(f.COUNTER_METRIC.AAPI_DATA_MGR_INIT_FAILED),k=new p(f.ERROR.AAPI_DATA_MGR_INIT_FAILED)}}else return a.registerCounter(f.COUNTER_METRIC.MISSING_AJAX_PARAMS),new p(f.ERROR.MISSING_AJAX_PARAMS);return k}}});"use strict";t.when("A").register("abPricingFfqp_helpers",function(e){var g=e.createClass({_listeners:{},addListeners:function(e,a,d){this._listeners.hasOwnProperty(e)||
(this._listeners[e]=[]);this._listeners[e].push({success:a,error:d})},triggerSuccess:function(e,a){this._triggerListeners(e,"success",a)},triggerError:function(e,a){this._triggerListeners(e,"error",a)},_triggerListeners:function(e,a,d){if(this._listeners.hasOwnProperty(e))for(e=this._listeners[e];0<e.length;){var f=e.pop();if(f[a])f[a](d)}}});return{AsyncCache:e.createClass({_requestStatus:{IN_PROGRESS:1,READY:2,ERROR:3},_status:{},_cache:{},init:function(e){this._eventHandler=new g;this._loader=
e.loader;this._keyGenerator=e.keyGenerator},_getKey:function(e){return this._keyGenerator?this._keyGenerator(e):e},get:function(e,a,d){var f=this._getKey(e);this._status[f]===this._requestStatus.READY?a(this._cache[f]):(this._eventHandler.addListeners(f,a,d),this._load(e,f))},_load:function(e,a){var d=this;d._status[a]!==d._requestStatus.IN_PROGRESS&&(d._status[a]=d._requestStatus.IN_PROGRESS,d._loader(e,function(e){d._cache[a]=e;d._status[a]=d._requestStatus.READY;d._eventHandler.triggerSuccess(a,
e)},function(e){d._status[a]=d._requestStatus.ERROR;d._eventHandler.triggerError(a,e)}))}}),richContentHelper:{toText:function d(a){if(a.money)return a.money.displayString;if(a.text)return a.text;if(a.link)return d(a.link.content);if(a.fragments){for(var e=[],g=0;g<a.fragments.length;g++)e.push(d(a.fragments[g]));return e.join("")}return a.semanticContent?d(a.semanticContent.content):""}}}});"use strict";t.when("jQuery","A","a-dropdown","a-button","abPricingFfqp_utils","abPricingFfqp_quantityManager",
"abPricingFfqp_metrics","abPricingFfqp_constants").register("abPricingFfqp_quantityPickerLogic",function(e,g,f,a,d,n,l,q){function k(a){return a.prop("selectedIndex")+1===a.prop("length")}function h(a,b){if(!d.dropdownContainsQuantity(a,b)){var c=document.createElement("option");c.value=b;c.text=b.toString();a.append(c)}}function b(a){this.id=a.id;this.buyBoxId=a.buyBoxId;this.buyingOptionStereotype=a.buyingOptionStereotype?a.buyingOptionStereotype:"";this.quantityHiddenFieldSelector=a.quantityHiddenFieldSelector;
this.leastMinimumOrderQuantity=a.leastMinimumOrderQuantity;this.predefinedQuantitiesDropdownSelector=a.predefinedQuantitiesDropdownSelector;this.predefinedQuantitiesDropdownContainerSelector=a.predefinedQuantitiesDropdownContainerSelector;this.freeQuantityTextInputSelector=a.freeQuantityTextInputSelector;this.freeQuantityTextInputOuterSelector=a.freeQuantityTextInputOuterSelector;this.updateButtonSelector=a.updateButtonSelector;this.addToCartButtonSelector=a.addToCartButtonSelector;this.buyingOptionPosition=
a.buyingOptionPosition;this.limitedAvailabilityMessageSelector=a.limitedAvailabilityMessageSelector;this.splitOfferLinkSelector=a.splitOfferLinkSelector;this.splitOfferSectionSelector=a.splitOfferSectionSelector;this.amazonDevicesLinkEnabled=a.amazonDevicesLinkEnabled;this.buyingInBulkBaseUrl=a.buyingInBulkBaseUrl;this.initializeQuantityHiddenField();this.wireUpSelectorBasedEvents()}b.prototype.wireUpSelectorBasedEvents=function(){var a=this,b=e(this.predefinedQuantitiesDropdownSelector);g.on("a:dropdown:"+
b[0].id+":select",function(c){a.handleDropdownOptionClicked(c.value)});g.on(n.EVENT__BUY_BOX_QUANTITY_CHANGED,function(c,b,d){a.handleQuantityChangedOnOtherBuyBox(c,b,d)});g.on(n.EVENT__QUANTITY_REFRESH_CHECK_STARTED,function(){a.handleQuantityRefreshCheckStarted()});g.on(n.EVENT__QUANTITY_REFRESH_CHECK_FINISHED,function(){a.handleQuantityRefreshCheckFinished()})};b.prototype.wireUpReferenceBasedEvents=function(){var a=this,b=e(this.freeQuantityTextInputSelector),d=e(this.updateButtonSelector);b.keydown(function(c){a.handleTextInputKeyDown(c)});
b.keyup(function(c){a.handleTextInputKeyUp(c)});b.focus(function(){a.handleTextInputFocused()});d.click(function(){a.handleButtonClick()})};b.prototype.attachToDOM=function(){this.wireUpReferenceBasedEvents();k(e(this.predefinedQuantitiesDropdownSelector))?this.switchToFreeQuantityUI():this.switchToPredefinedQuantitiesUI();this.enableUI();this.lastSelectedQuantity=this.getCurrentQuantity();n.singleton.leastMinimumOrderQuantity=this.leastMinimumOrderQuantity};b.prototype.getCurrentQuantity=function(){if(this.isTextInputVisible()){var a=
e(this.freeQuantityTextInputSelector);return parseInt(a.val())}return this.isDropdownVisible()?(a=e(this.predefinedQuantitiesDropdownSelector),parseInt(a.find(":selected").val())):u};b.prototype.handleQuantityRefreshCheckStarted=function(){this.doesDOMExist()&&this.disableUI()};b.prototype.handleQuantityRefreshCheckFinished=function(){this.doesDOMExist()&&this.enableUI()};b.prototype.handleDropdownOptionClicked=function(a){var c=e(this.predefinedQuantitiesDropdownSelector);k(c)?(a=e(this.freeQuantityTextInputSelector),
a.val(this.lastSelectedQuantity.toString()),this.switchToFreeQuantityUI(),a.focus(),d.incrementMetricByOne("freeFormQtyPickerMaxQtySelected")):(this.lastSelectedQuantity=a=parseInt(a),this.updateQuantityHiddenField(a),n.singleton.notifyQuantityChanged(a,{senderId:this.id,activeBuyBoxId:this.buyBoxId,selectedBuyingOption:this.buyingOptionStereotype}))};b.prototype.handleTextInputFocused=function(){e(this.freeQuantityTextInputSelector).select()};b.prototype.handleTextInputKeyUp=function(c){13!==c.keyCode&&
a(this.updateButtonSelector).show()};b.prototype.handleTextInputKeyDown=function(a){13===a.keyCode&&(a.preventDefault(),e(this.updateButtonSelector).click(),this._findWithinPickerAccordionRow(this.addToCartButtonSelector).focus())};b.prototype.clampQuantity=function(a){999<a&&(a=999);this.leastMinimumOrderQuantity!==u&&a<this.leastMinimumOrderQuantity&&(a=this.leastMinimumOrderQuantity);return a};b.prototype.handleButtonClick=function(){var b=e(this.predefinedQuantitiesDropdownSelector),h=f.getSelect(b[0]),
g=e(this.freeQuantityTextInputSelector),k=g.val(),l=parseInt,p=k.match(/[1-9][0-9]*/);l=l(null===p?"1":p[0]);l=this.clampQuantity(l);d.dropdownContainsQuantity(b,l)?(this.switchToPredefinedQuantitiesUI(),h.setValue(l.toString()),this.handleDropdownOptionClicked(l)):(b=l.toString(),b!==k&&g.val(b),a(this.updateButtonSelector).hide(),this.updateQuantityHiddenField(l),n.singleton.notifyQuantityChanged(l,{senderId:this.id,activeBuyBoxId:this.buyBoxId,selectedBuyingOption:this.buyingOptionStereotype}))};
b.prototype.doesDOMExist=function(){return 0<e(this.predefinedQuantitiesDropdownSelector).length&&0<e(this.freeQuantityTextInputSelector).length&&0<e(this.updateButtonSelector).length};b.prototype.handleQuantityChangedOnOtherBuyBox=function(a,b,d){if(this.doesDOMExist()){a!==this.id&&this.getCurrentQuantity()!==b&&this._updateSelectedQuantity(b);var c=this;n.singleton.buyboxRefreshCheck({newQuantity:b,activeBuyBoxId:d.activeBuyBoxId,selectedBuyingOption:d.selectedBuyingOption,currentBuyBoxId:this.buyBoxId,
callback:function(a){c.updateLimitedAvailabilityMessageVisibility(a.hasAvailability)}})}};b.prototype._updateSelectedQuantity=function(a){var b=e(this.predefinedQuantitiesDropdownSelector),c=f.getSelect(b[0]);d.dropdownContainsQuantity(b,a)?(c.setValue(a.toString()),this.lastSelectedQuantity=a,this.switchToPredefinedQuantitiesUI()):(e(this.freeQuantityTextInputSelector).val(a.toString()),this.switchToFreeQuantityUI());this.updateQuantityHiddenField(a)};b.prototype.showDropdown=function(){e(this.predefinedQuantitiesDropdownContainerSelector).removeClass("aok-hidden")};
b.prototype.hideDropdown=function(){e(this.predefinedQuantitiesDropdownContainerSelector).addClass("aok-hidden")};b.prototype.isDropdownVisible=function(){return!e(this.predefinedQuantitiesDropdownContainerSelector).hasClass("aok-hidden")};b.prototype.showTextInput=function(){"mobile"===d.getPageState().platform?e(this.freeQuantityTextInputOuterSelector).removeClass("aok-hidden"):e(this.freeQuantityTextInputSelector).removeClass("aok-hidden")};b.prototype.hideTextInput=function(){"mobile"===d.getPageState().platform?
e(this.freeQuantityTextInputOuterSelector).addClass("aok-hidden"):e(this.freeQuantityTextInputSelector).addClass("aok-hidden")};b.prototype.isTextInputVisible=function(){return"mobile"===d.getPageState().platform?!e(this.freeQuantityTextInputOuterSelector).hasClass("aok-hidden"):!e(this.freeQuantityTextInputSelector).hasClass("aok-hidden")};b.prototype.disableTextInput=function(){if("mobile"===d.getPageState().platform){var a=e(this.freeQuantityTextInputSelector),b=e(this.freeQuantityTextInputOuterSelector);
a.prop("disabled","disabled");b.addClass("a-form-disabled")}else a=e(this.freeQuantityTextInputSelector),a.prop("disabled","disabled"),a.addClass("a-form-disabled")};b.prototype.enableTextInput=function(){if("mobile"===d.getPageState().platform){var a=e(this.freeQuantityTextInputSelector),b=e(this.freeQuantityTextInputOuterSelector);a.removeProp("disabled");b.removeClass("a-form-disabled")}else a=e(this.freeQuantityTextInputSelector),a.removeProp("disabled"),a.removeClass("a-form-disabled")};b.prototype.switchToFreeQuantityUI=
function(){this.hideDropdown();this.showTextInput();a(this.updateButtonSelector).hide()};b.prototype.switchToPredefinedQuantitiesUI=function(){this.showDropdown();this.hideTextInput();a(this.updateButtonSelector).hide()};b.prototype.disableUI=function(){var b=f.getSelect(this.predefinedQuantitiesDropdownSelector),d=a(this.updateButtonSelector);b.update({status:"disabled"});this.disableTextInput();d.disable()};b.prototype.enableUI=function(){var b=f.getSelect(this.predefinedQuantitiesDropdownSelector),
d=a(this.updateButtonSelector);b.update({status:"normal"});this.enableTextInput();d.enable()};b.prototype._isMobileQuantityHiddenFieldSelector=function(){return"string"===typeof this.quantityHiddenFieldSelector&&-1<this.quantityHiddenFieldSelector.indexOf("select#mobileQuantityDropDown")};b.prototype._mobileQuantityHiddenFieldSelector=function(){return this.quantityHiddenFieldSelector.replace("input#quantity","select#mobileQuantityDropDown")};b.prototype.updateQuantityHiddenField=function(a){var b=
this._findWithinPickerAccordionRow(this.quantityHiddenFieldSelector).first();b.is("select")?(h(b,a),f.getSelect(b).val(a)):b.val(a.toString());g.trigger(q.ADD_TO_CART_QUANTITY_CHANGE_EVENT,{nativeItemNode:b[0],value:a.toString()});"mobile"!==d.getPageState().platform||this._isMobileQuantityHiddenFieldSelector()||(b=this._findWithinPickerAccordionRow(this._mobileQuantityHiddenFieldSelector()))&&b.is("select")&&(h(b,a),f.getSelect(b).val(a),b.val(a.toString()))};b.prototype.updateLimitedAvailabilityMessageVisibility=
function(b){var c=this._findWithinPickerAccordionRow(this.addToCartButtonSelector).closest(".a-button"),d=a(c);c=this._findWithinPickerAccordionRow(this.splitOfferSectionSelector);b?(e(this.limitedAvailabilityMessageSelector).addClass("aok-hidden"),d.enable(),c.addClass("aok-hidden")):(e(this.limitedAvailabilityMessageSelector).removeClass("aok-hidden"),d.disable(),b=this.getCurrentQuantity(),d=this.amazonDevicesLinkEnabled?this.buyingInBulkBaseUrl:n.singleton.getLimitedAvailabilityUrl(b),this._findWithinPickerAccordionRow(this.splitOfferLinkSelector).attr("href",
d),1<b?(l.registerCounter(q.COUNTER_METRIC.SPLIT_OFFER_LINK_DISPLAYED),c.removeClass("aok-hidden")):c.addClass("aok-hidden"))};b.prototype._findWithinPickerAccordionRow=function(a){return d.findWithinPickerAccordionRow(this.id,a)};b.prototype.initializeQuantityHiddenField=function(){var a=n.singleton.currentQuantity,b=parseInt(this.leastMinimumOrderQuantity);b&&b>a&&(a=b);this.updateQuantityHiddenField(a)};return{QuantityPickerLogic:b}});"use strict";t.when("jQuery","A","a-dropdown","a-modal","a-button",
"abPricingFfqp_utils","abPricingFfqp_quantityManager","abPricingFfqp_metrics","abPricingFfqp_constants").register("abPricingFfqpV2_quantityPickerLogic",function(e,p,f,a,d,n,l,q,k){function h(a,b){if(!n.dropdownContainsQuantity(a,b)){var r=document.createElement("option");r.value=b;r.text=b.toString();a.append(r)}}function b(a){this.id=a.id;this.buyBoxId=a.buyBoxId;this.buyingOptionStereotype=a.buyingOptionStereotype?a.buyingOptionStereotype:"";this.quantityHiddenFieldSelector=a.quantityHiddenFieldSelector;
this.leastMinimumOrderQuantity=a.leastMinimumOrderQuantity;this.quantityPickerSelector=a.quantityPickerSelector;this.quantityDiscountTableSelector=this.quantityPickerSelector+" .quantity-discount-table";this.quantityTextInputLabelSelector=this.quantityPickerSelector+" .quantity-text-input-label";this.buyboxAccordionContainerSelector=a.buyboxAccordionContainerSelector;this.loadMoreMessage=a.loadMoreMessage;this.fetchTheBestPricesMessage=a.fetchTheBestPricesMessage;this.qdtErrorMessage=a.qdtErrorMessage;
this.includeRfqdLinkInNewPicker=a.includeRfqdLinkInNewPicker;this.requestForQuantityDiscountModalSelector=a.requestForQuantityDiscountModalSelector;this.requestForQuantityDiscountMessage=a.requestForQuantityDiscountMessage;this.requestForQuoteLinkEnabled=a.requestForQuoteLinkEnabled;this.bbtLinkSelector=a.bbtLinkSelector;this.addToCartButtonSelector=a.addToCartButtonSelector;this.limitedAvailabilityMessageSelector=a.limitedAvailabilityMessageSelector;this.fetchQuantityDiscountTableCompleted=this.fetchQuantityDiscountTableStarted=
this.isLoadMoreButtonClicked=!1;this.quantityTextInputSelector=this.quantityPickerSelector;this.quantityTextInputSelector+=" .quantity-text-input-with-label";this.loadMoreButtonForUncompetitiveTiersPresence=this.hasError=!1;this.quantityPricingTableSummaryEnabled=a.quantityPricingTableSummaryEnabled;this.qdsForLockedMerchantEnabled=a.qdsForLockedMerchantEnabled;this.isAODLinkEnabled=!0===a.isAODLinkEnabled;this.quantityPickerUnavailabilityMessage=a.quantityPickerUnavailabilityMessage;this.quantityPickerUnavailabilityLink=
a.quantityPickerUnavailabilityLink;this.splitOfferLinkSelector=a.splitOfferLinkSelector;this.splitOfferSectionSelector=a.splitOfferSectionSelector;this.amazonDevicesLinkEnabled=a.amazonDevicesLinkEnabled;this.buyingInBulkBaseUrl=a.buyingInBulkBaseUrl;this.initializeQuantityAvailabilityVariables();this.wireUpSelectorBasedEvents();this.initializeQuantityHiddenField()}var c=k.PACKAGE_PREFIX+".PriceTableLoadError",m=k.PACKAGE_PREFIX+".QuantityPriceTableRender",t=k.PACKAGE_PREFIX+".QuantityPriceTableView",
w=k.PACKAGE_PREFIX+".QuantityPriceTableRenderWithLockedMerchant",y=k.PACKAGE_PREFIX+".QuantityPriceTableViewWithLockedMerchant",v=k.PACKAGE_PREFIX+".QuantityPriceTableRenderWithUncompetitiveTiers",z=k.PACKAGE_PREFIX+".QuantityPriceTableViewWithUncompetitiveTiers",B=k.PACKAGE_PREFIX+".QuantityPriceTableLoadMoreButtonClicked",C=k.PACKAGE_PREFIX+".QuantityPriceTableLoadMoreButtonClickedWithUncompetitiveTiers",D=k.PACKAGE_PREFIX+".QuantityPriceTableBBTLinkRender",E=k.PACKAGE_PREFIX+".QuantityPriceTableBBTLinkClick",
F=k.PACKAGE_PREFIX+".QuantityPriceTableQuantityUnavailableLinkRender",G=k.PACKAGE_PREFIX+".QuantityPriceTableQuantityUnavailableLinkClick",H=k.PACKAGE_PREFIX+".QuantityPriceTableRFQDBBTLinkClick",I=k.PACKAGE_PREFIX+".QuantityPriceTableAvailabilityMessageRender",J=k.PACKAGE_PREFIX+".QuantityPriceTableAvailabilityMessageView",K=k.PACKAGE_PREFIX+".QuantityPriceTablePerceivedError";b.prototype.initializeQuantityAvailabilityVariables=function(){this.hasAvailability=!0};b.prototype.wireUpSelectorBasedEvents=
function(){var a=this;p.on(l.EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_STARTED,function(b){b&&b!==a.id||a.handleFetchQuantityDiscountTableStarted()});p.on(l.EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_COMPLETED,function(b,c){c&&c!==a.id||a.handleFetchQuantityDiscountTableCompleted(b)});p.on(l.EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_ERROR,function(b){b&&b!==a.id||a.handleFetchQuantityDiscountTableError()});p.on(l.EVENT__BUY_BOX_QUANTITY_CHANGED,function(b,c,r){a.handleQuantityChangedOnOtherBuyBox(b,c,r)});p.on(l.EVENT__QUANTITY_REFRESH_CHECK_STARTED,
function(){a.handleQuantityRefreshCheckStarted()});p.on(l.EVENT__QUANTITY_REFRESH_CHECK_FINISHED,function(){a.handleQuantityRefreshCheckFinished()})};b.prototype.initializeQuantityHiddenField=function(){var a=l.singleton.currentQuantity,b=parseInt(this.leastMinimumOrderQuantity);b&&b>a&&(a=b);this.updateQuantityHiddenField(a)};b.prototype.handleFetchQuantityDiscountTableCompleted=function(a){this.wireUpQuantityDiscountTableData(a);this.generateQuantityDiscountTable();this.fetchQuantityDiscountTableCompleted=
!0};b.prototype.handleFetchQuantityDiscountTableStarted=function(){this.fetchQuantityDiscountTableStarted=!0};b.prototype.wireUpQuantityDiscountTableData=function(a){this.priceTiers=a;this.buildQptRenderMetrics();this.buildQptForLockedMerchantMetrics(w);this.buildQptUncompetitiveTiersMetrics(v);this.buildAvailabilityMessageMetrics(I)};b.prototype.handleFetchQuantityDiscountTableError=function(){n.incrementMetricByOne(c);this.fetchQuantityDiscountTableStarted=!1;this.hasError=!0;this.generateQuantityDiscountTable()};
b.prototype.wireUpReferenceBasedEvents=function(){var a=this,b=e(this.quantityTextInputSelector),c=e(this.quantityTextInputLabelSelector);c.click(function(){b.focus();b.click()});b.focus(function(){c.hide();"1"===this.value&&(this.value="");a.showQuantityDiscountTable()});b.blur(function(){""===this.value&&(this.value=l.singleton.currentQuantity);a.updateQuantityAndHideQuantityDiscountTable();c.show()});b.live("keypress input",function(b){a.isValidQuantityTextInputKeyCode(b);this.value=this.value.replace(/[^0-9]/g,
"")});b.live("input",p.throttle(function(b){a.quantityAvailabilityCheckStart()},500));b.live("keydown",function(b){a.isValidQuantityTextPressKeyCode(b)});b.live("click change paste keyup",function(){a.clampQuantity(b.val());a.generateQuantityDiscountTable()})};b.prototype.quantityAvailabilityCheckStart=function(){this.initializeQuantityAvailabilityVariables();var a=this.getCurrentQuantity(),b=this;l.singleton.notifyQuantityTyped(a,{currentBuyBoxId:this.buyBoxId,activeBuyBoxId:this.buyBoxId,selectedBuyingOption:this.buyingOptionStereotype,
qdsForLockedMerchantEnabled:this.qdsForLockedMerchantEnabled,callback:function(c){a===b.getCurrentQuantity()&&b.updateLimitedAvailabilityMessageVisibility(c.hasAvailability)}})};b.prototype.attachToDOM=function(){this.wireUpReferenceBasedEvents();this.enableUI();l.singleton.leastMinimumOrderQuantity=this.leastMinimumOrderQuantity};b.prototype.isValidQuantityTextPressKeyCode=function(a){var b={left:37,up:38,right:39,down:40},c=g.event?a.keyCode:a.which,r;for(r in b)b[r]===c&&a.preventDefault()};b.prototype.isValidQuantityTextInputKeyCode=
function(a){var b=g.event?a.keyCode:a.which;8!==b&&46!==b&&(13===b?(this.updateQuantityAndHideQuantityDiscountTable(),a.preventDefault()):(b=String.fromCharCode(b),/\d/.test(b)||a.preventDefault()))};b.prototype.getCurrentQuantity=function(){var a=e(this.quantityTextInputSelector);return this.clampQuantity(a.val())};b.prototype.handleQuantityRefreshCheckStarted=function(){this.doesDOMExist()&&this.disableUI()};b.prototype.handleQuantityRefreshCheckFinished=function(){this.doesDOMExist()&&this.enableUI()};
b.prototype.clampQuantity=function(a){var b=a;999<a&&(b=999);this.leastMinimumOrderQuantity!==u&&a<this.leastMinimumOrderQuantity&&(b=this.leastMinimumOrderQuantity);return b};b.prototype.doesDOMExist=function(){return 0<e(this.quantityTextInputSelector).length};b.prototype.handleQuantityChangedOnOtherBuyBox=function(a,b,c){if(this.doesDOMExist()){a!==this.id&&parseInt(this.getCurrentQuantity())!==b&&(e(this.quantityTextInputSelector).val(b),this.updateQuantityHiddenField(b));var d=this;l.singleton.buyboxRefreshCheck({newQuantity:b,
activeBuyBoxId:c.activeBuyBoxId,selectedBuyingOption:c.selectedBuyingOption,currentBuyBoxId:this.buyBoxId,qdsForLockedMerchantEnabled:this.qdsForLockedMerchantEnabled,callback:function(a){d.updateLimitedAvailabilityMessageVisibility(a.hasAvailability)}})}};b.prototype.showQuantityDiscountTable=function(){this.buildQptViewMetrics();this.hasError&&q.registerCounter(K);this.fetchQuantityDiscountTableCompleted&&(this.buildQptForLockedMerchantMetrics(y),this.buildQptUncompetitiveTiersMetrics(z,this.getStartIndexOfQuantityDiscountTierTable(),
3),this.buildAvailabilityMessageMetrics(J));var a=n.findAccordionRow(this.id);0<a.length&&(a.get(0).setAttribute("style","overflow:visible"),a=a.find(".a-accordion-inner.accordion-row-content"),0<a.length&&a.get(0).setAttribute("style","overflow:visible"));a=e(this.buyboxAccordionContainerSelector);0<a.length&&(a.get(0).setAttribute("style","overflow:visible"),a=a.find(".a-accordion-inner"),0<a.length&&a.get(0).setAttribute("style","overflow:visible"));e(this.quantityPickerSelector).addClass("open")};
b.prototype.hideQuantityDiscountTable=function(){e(this.quantityPickerSelector).removeClass("open")};b.prototype.updateQuantityAndHideQuantityDiscountTable=function(){var a=e(this.quantityDiscountTableSelector),b=e(this.quantityTextInputSelector),c=this.clampQuantity(b.val());b.val(c);this.updateQuantityHiddenField(c);l.singleton.notifyQuantityChanged(c,{senderId:this.id,activeBuyBoxId:this.buyBoxId,selectedBuyingOption:this.buyingOptionStereotype,qdsForLockedMerchantEnabled:this.qdsForLockedMerchantEnabled});
this.isLoadMoreButtonClicked=!1;this.hideQuantityDiscountTable();a.empty()};b.prototype.disableUI=function(){var a=e(this.quantityTextInputSelector),b=e(this.quantityDiscountTableSelector);a.attr("disabled",!0);a.addClass("quantity-text-input-disabled");b.attr("disabled",!0)};b.prototype.enableUI=function(){var a=e(this.quantityTextInputSelector),b=e(this.quantityDiscountTableSelector);a.attr("disabled",!1);a.removeClass("quantity-text-input-disabled");b.attr("disabled",!1);this.hideQuantityDiscountTable()};
b.prototype._isMobileQuantityHiddenFieldSelector=function(){return"string"===typeof this.quantityHiddenFieldSelector&&-1<this.quantityHiddenFieldSelector.indexOf("select#mobileQuantityDropDown")};b.prototype._mobileQuantityHiddenFieldSelector=function(){return this.quantityHiddenFieldSelector.replace("input#quantity","select#mobileQuantityDropDown")};b.prototype.updateQuantityHiddenField=function(a){var b=this._findWithinPickerAccordionRow(this.quantityHiddenFieldSelector).first();b.is("select")&&
(h(b,a),f.getSelect(b).val(a));b.val(a.toString());p.trigger(k.ADD_TO_CART_QUANTITY_CHANGE_EVENT,{nativeItemNode:b[0],value:a.toString()});"mobile"!==n.getPageState().platform||this._isMobileQuantityHiddenFieldSelector()||(b=this._findWithinPickerAccordionRow(this._mobileQuantityHiddenFieldSelector()))&&b.is("select")&&(h(b,a),f.getSelect(b).val(a),b.val(a.toString()))};b.prototype.generateVisibleTiersList=function(a,b){for(var c=[],d=0,e=!1;b<this.priceTiers.length&&(this.isLoadMoreButtonClicked||
3>d);){var r=this.priceTiers[b],f=!this.shouldHideFirstTier()&&0===d,A=r.isLowestAvailablePrice||e||2!==d;if(this.isLoadMoreButtonClicked||f||!r.isUncompetitive&&A)c.push({quantity:Math.max(a,r.quantity),savingsMessage:r.savingsMessage,availabilityMessage:r.availabilityMessage,quantityPickerPriceText:r.quantityPickerPriceText,isDiscountUnlocked:0===d?0===b&&"BUSINESS_VOLUME_AWARE_PRICING"===r.program:!1,isFirstTier:f}),e=e||r.isLowestAvailablePrice,d++;b++}return c};b.prototype.findStartIndexOfQuantityDiscountTierTable=
function(a){for(var b=0,c=this.priceTiers.length-1;b<=c;){var d=parseInt((b+c)/2);var e=this.priceTiers[d].quantity;e=0===e.length?0:parseInt(e);if(e===a)return d;e>a?c=d-1:b=d+1}return Math.max(0,c)};b.prototype.getStartIndexOfQuantityDiscountTierTable=function(){var a=this.getCurrentQuantity();a=this.findStartIndexOfQuantityDiscountTierTable(a);return this.shouldHideFirstTier()&&1<this.priceTiers.length?a+1:a};b.prototype.shouldHideFirstTier=function(){var a=l.singleton.currentQuantity,b=e(this.quantityTextInputSelector);
return!this.isAvailabilityMessagePresent()&&1===a&&""===b.val()};b.prototype.generateQuantityDiscountTable=function(){this.cleanOutQuantityDiscountTable();var a=e(this.quantityDiscountTableSelector);this.hasError?a.append(this.generateSingleTierDiscountTableUnorderedList(this.generateQdtErrorMessage())):this.hasAvailability?this.priceTiers===u?a.append(this.generateFetchInProcessTableUnorderedList()):0===this.priceTiers.length?a.append(this.generateSingleTierDiscountTableUnorderedList()):a.append(this.generateQuantityDiscountTableUnorderedList()):
a.append(this.generateQuantityUnavailableTableUnorderedList())};b.prototype.cleanOutQuantityDiscountTable=function(){e(this.quantityDiscountTableSelector).empty()};b.prototype.areUncompetitiveTiersPresent=function(a,b){var c=!1;if("undefined"!==typeof this.priceTiers)for("undefined"===typeof a&&(a=0),b="undefined"===typeof b?this.priceTiers.length:Math.min(a+b,this.priceTiers.length),a+=1;a<b;a++)if(this.priceTiers[a].isUncompetitive){c=!0;break}return c};b.prototype.isAvailabilityMessagePresent=
function(){return"undefined"!==typeof this.priceTiers&&0<this.priceTiers.length&&"undefined"!==typeof this.priceTiers[0].availabilityMessage};b.prototype.showLoadMoreButton=function(a){this.loadMoreButtonForUncompetitiveTiersPresence=this.areUncompetitiveTiersPresent(a);return!this.isLoadMoreButtonClicked&&(3<this.priceTiers.length-a||this.loadMoreButtonForUncompetitiveTiersPresence)};b.prototype.showBuyingInBulkLink=function(a){return"undefined"!==typeof this.priceTiers[a].buyingInBulkLink};b.prototype.generateQuantityDiscountTableUnorderedList=
function(){var a=this.getCurrentQuantity(),b=this.getStartIndexOfQuantityDiscountTierTable();a=this.generateVisibleTiersList(a,b);var c=document.createElement("ul");c.setAttribute("class","qdt-ul");for(var d=e(c),f=0;f<a.length;f++)d.append(this.generateQuantityDiscountTierOption(a[f]));this.showLoadMoreButton(b)?d.append(this.generateLoadMoreOption()):!this.showBuyingInBulkLink(b)||!0!==this.includeRfqdLinkInNewPicker&&"true"!==this.includeRfqdLinkInNewPicker?!0!==this.includeRfqdLinkInNewPicker&&
"true"!==this.includeRfqdLinkInNewPicker||d.append(this.generateRequestForQuantityDiscountOption()):d.append(this.generateBuyingInBulkOption(b));return c};b.prototype.generateSingleTierDiscountTableUnorderedList=function(a){var b=this.getCurrentQuantity();b=this.generateSingleTierQuantityList(b);var c=document.createElement("ul");c.setAttribute("class","qdt-ul");for(var d=e(c),r=0;r<b.length;r++)d.append(this.generateQuantityDiscountTierOption(b[r]));a&&d.append(a);return c};b.prototype.generateQuantityUnavailableTableUnorderedList=
function(){var a=document.createElement("ul");a.setAttribute("class","qdt-ul");e(a).append(this.generateQuantityUnavailableOption());return a};b.prototype.generateSingleTierQuantityList=function(a){var b=[];b.push({quantity:Math.max(a,1),savingsMessage:null,availabilityMessage:null,quantityPickerPriceText:"",isDiscountUnlocked:!1,isFirstTier:!0});return b};b.prototype.generateFetchInProcessTableUnorderedList=function(){var a=document.createElement("ul");a.setAttribute("class","qdt-ul");e(a).append(this.generateFetchInProcessOption());
return a};b.prototype._removeINRSymbol=function(a){a=a.split("\x3e");return a[a.length-1]};b.prototype._populateOptionPriceContent=function(a,b){if("string"===typeof a.quantityPickerPriceText&&-1!==a.quantityPickerPriceText.search("currencyINR")){var c=document.createElement("span");c.setAttribute("class","currencyINR");c.textContent="  ";b.appendChild(c);a=this._removeINRSymbol(a.quantityPickerPriceText);b.appendChild(document.createTextNode(a))}else b.textContent=a.quantityPickerPriceText};b.prototype.generateQuantityDiscountTierOption=
function(a){var b=this,c=document.createElement("li"),d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div");a.isFirstTier?(e.textContent=a.quantity,c.setAttribute("class","qdt-dropdown-item qdt-active")):(e.textContent=a.quantity+"+",c.setAttribute("class","qdt-dropdown-item"));b._populateOptionPriceContent(a,f);e.setAttribute("class","option-tier");f.setAttribute("class","option-price");a.availabilityMessage!==u?this.generateTierWithAvailabilityMessageContent(d,
e,f,a.availabilityMessage):a.savingsMessage!==u?this.generateTierWithSavingsMessageContent(d,e,f,a):(d.setAttribute("class","qdt-dropdown-option-no-saving-message"),d.appendChild(e),d.appendChild(f));c.appendChild(d);c.addEventListener("mousedown",function(){b.handleQuantityDiscountTableOptionClicked(a.quantity)});return c};b.prototype.generateTierWithAvailabilityMessageContent=function(a,b,c,d){var e=document.createElement("div");e.textContent=d;e.setAttribute("class","option-availability-message");
this.generateTierWithMessageContent(a,b,c,e)};b.prototype.generateTierWithSavingsMessageContent=function(a,b,c,d){var f=document.createElement("div");f.textContent=d.savingsMessage;d.isDiscountUnlocked?(d=document.createElement("div"),d.setAttribute("class","option-unlocked-saving-message-icon"),e(f).prepend(d),f.setAttribute("class","option-unlocked-saving-message")):f.setAttribute("class","a-color-tertiary option-saving-message");this.generateTierWithMessageContent(a,b,c,f)};b.prototype.generateTierWithMessageContent=
function(a,b,c,d){var e=document.createElement("div");a.setAttribute("class","qdt-dropdown-option-regular");e.setAttribute("class","option-price-and-message");e.appendChild(c);e.appendChild(d);a.appendChild(b);a.appendChild(e)};b.prototype.generateLoadMoreOption=function(){var a=this,b=document.createElement("li"),c=document.createElement("div");c.textContent=this.loadMoreMessage;b.setAttribute("class","qdt-dropdown-item");c.setAttribute("class","qdt-dropdown-option-load-more");b.setAttribute("id",
"qdt-dropdown-load-more");b.appendChild(c);b.addEventListener("mousedown",function(b){a.handleLoadMoreOptionClicked(b)});return b};b.prototype.generateRequestForQuantityDiscountOption=function(){var a=this,b=document.createElement("a");b.textContent=this.requestForQuantityDiscountMessage;b.setAttribute("class","a-link-normal qdt-dropdown-request-for-quantity-discount");b.addEventListener("mousedown",function(b){a.handleRequestForQuantityDiscountOptionClicked(b)});return this.generateLinkOption(b)};
b.prototype.generateBuyingInBulkOption=function(a){var b=this;a={container:{element:document.createElement("div"),class:"qdt-dropdown-buying-in-bulk"},link:{element:document.createElement("a"),class:"a-link-normal qdt-dropdown-buying-in-bulk-link",text:b.priceTiers[a].buyingInBulkLink},message:{element:document.createElement("div"),class:"qdt-dropdown-buying-in-bulk-message",text:b.priceTiers[a].buyingInBulkMessage}};for(var c in a)a.hasOwnProperty(c)&&(a[c].element.setAttribute("class",a[c].class),
"undefined"!==typeof a[c].text&&(a[c].element.textContent=a[c].text));a.container.element.appendChild(a.link.element);a.container.element.appendChild(a.message.element);a.link.element.addEventListener("mousedown",function(a){b.handleBuyingInBulkOptionClicked(b.bbtLinkSelector,E,a)});q.registerCounter(D);return this.generateLinkOption(a.container.element)};b.prototype.generateQuantityUnavailableOption=function(){var a=this,b=document.createElement("div"),c=document.createElement("div");c.innerHTML=
this.quantityPickerUnavailabilityMessage;b.setAttribute("class","a-link-normal qdt-dropdown-quantity-unavailable");c.setAttribute("class","qdt-dropdown-quantity-unavailable-message");b.appendChild(c);0<this._findWithinPickerAccordionRow(this.splitOfferSectionSelector).length&&(c=document.createElement("a"),c.textContent=this.quantityPickerUnavailabilityLink,c.setAttribute("class","a-link-normal qdt-dropdown-quantity-unavailable-link"),b.appendChild(c),c.addEventListener("mousedown",function(b){a.handleQuantityUnavailableOptionClicked(b)}));
q.registerCounter(F);return this.generateLinkOption(b)};b.prototype.generateLinkOption=function(a){var b=document.createElement("li"),c=document.createElement("div");b.setAttribute("class","qdt-dropdown-item qdt-inactive");c.setAttribute("class","qdt-dropdown-option-link");c.appendChild(a);b.appendChild(c);return b};b.prototype.generateFetchInProcessOption=function(){var a=document.createElement("li"),b=document.createElement("div"),c=document.createElement("div"),d=document.createElement("div"),
e=document.createElement("img");e.src="https://m.media-amazon.com/images/G/01/AmazonBusiness/vapLoading3._CB1556651073_.gif";c.textContent=this.fetchTheBestPricesMessage;e.setAttribute("class","fetching-in-progress-img");a.setAttribute("class","qdt-dropdown-item qdt-inactive");b.setAttribute("class","qdt-dropdown-option-fetch-in-progress");d.appendChild(e);b.appendChild(d);b.appendChild(c);a.setAttribute("id","qdt-dropdown-fetch-in-progress");a.appendChild(b);return a};b.prototype.generateQdtErrorMessage=
function(){var a=document.createElement("li"),b=document.createElement("div");if(this.isAODLinkEnabled){var c=document.createElement("span");c.setAttribute("class","a-declarative");c.setAttribute("data-action","show-all-offers-display");c.setAttribute("data-show-all-offers-display","{}");c.innerHTML=this.qdtErrorMessage;b.appendChild(c)}else b.innerHTML=this.qdtErrorMessage;a.setAttribute("class","qdt-dropdown-item qdt-inactive");b.setAttribute("class","qdt-dropdown-option-request-for-olp");a.setAttribute("id",
"qdt-dropdown-error-message");a.appendChild(b);var d=b.getElementsByTagName("a")[0];d.addEventListener("mousedown",function(a){d.click()});return a};b.prototype.handleLoadMoreOptionClicked=function(a){this.isLoadMoreButtonClicked=!0;this.buildLoadMoreButtonMetrics();this.generateQuantityDiscountTable();a.preventDefault()};b.prototype.handleQuantityDiscountTableOptionClicked=function(a){e(this.quantityTextInputSelector).val(a);this.updateQuantityAndHideQuantityDiscountTable();e(this.quantityTextInputLabelSelector).show()};
b.prototype.handleRequestForQuantityDiscountOptionClicked=function(b){var c=e(this.requestForQuantityDiscountModalSelector).find(".a-declarative");(c=a.get(c))&&c.show();this.handleBuyingInBulkOptionClicked(this.requestForQuantityDiscountModalSelector,H,b)};b.prototype.handleBuyingInBulkOptionClicked=function(a,b,c){var d=this.getCurrentQuantity();if(this.amazonDevicesLinkEnabled&&!this.requestForQuoteLinkEnabled)q.registerCounter(b),l.singleton.notifyBuyingInBulkOptionClicked(d),g.location.href=
this.buyingInBulkBaseUrl;else if(a=document.querySelector(a+" .a-link-normal"))q.registerCounter(b),l.singleton.notifyBuyingInBulkOptionClicked(d),a.click();c.preventDefault()};b.prototype.handleQuantityUnavailableOptionClicked=function(a){q.registerCounter(G);var b=this.getCurrentQuantity();this.quantityUnavailableOptionClicked(b);a.preventDefault()};b.prototype.quantityUnavailableOptionClicked=function(a){a=this.amazonDevicesLinkEnabled?this.buyingInBulkBaseUrl:g.location.protocol+"//"+g.location.host+
l.singleton.getLimitedAvailabilityUrl(a);g.location.href=a};b.prototype.updateLimitedAvailabilityMessageVisibility=function(a){this.hasAvailability=a;this.generateQuantityDiscountTable();this.updateBuyboxLimitedAvailabilityMessageVisibility()};b.prototype.updateBuyboxLimitedAvailabilityMessageVisibility=function(){var a=this._findWithinPickerAccordionRow(this.addToCartButtonSelector).closest(".a-button"),b=d(a);a=this._findWithinPickerAccordionRow(this.splitOfferSectionSelector);if(this.hasAvailability)e(this.limitedAvailabilityMessageSelector).addClass("aok-hidden"),
b.enable(),a.addClass("aok-hidden");else{e(this.limitedAvailabilityMessageSelector).removeClass("aok-hidden");b.disable();b=this.getCurrentQuantity();var c=this.amazonDevicesLinkEnabled?this.buyingInBulkBaseUrl:l.singleton.getLimitedAvailabilityUrl(b);this._findWithinPickerAccordionRow(this.splitOfferLinkSelector).attr("href",c);1<b?(q.registerCounter(k.COUNTER_METRIC.SPLIT_OFFER_LINK_DISPLAYED),a.removeClass("aok-hidden")):a.addClass("aok-hidden")}};b.prototype.buildQptRenderMetrics=function(){var a=
{};a.counter=m+(this.quantityPricingTableSummaryEnabled?".QPTS":"");q.register(a)};b.prototype.buildQptViewMetrics=function(){var a={};a.counter=t+(this.quantityPricingTableSummaryEnabled?".QPTS":"");q.register(a)};b.prototype.buildQptForLockedMerchantMetrics=function(a){this.qdsForLockedMerchantEnabled&&q.registerCounter(a)};b.prototype.buildQptUncompetitiveTiersMetrics=function(a,b,c){this.areUncompetitiveTiersPresent(b,c)&&q.registerCounter(a)};b.prototype.buildLoadMoreButtonMetrics=function(){this.loadMoreButtonForUncompetitiveTiersPresence?
q.registerCounter(C):q.registerCounter(B)};b.prototype.buildAvailabilityMessageMetrics=function(a){this.isAvailabilityMessagePresent()&&q.registerCounter(a)};b.prototype._findWithinPickerAccordionRow=function(a){return n.findWithinPickerAccordionRow(this.id,a)};return{QuantityPickerLogicV2:b}});"use strict";t.when("jQuery","A","abPricingFfqp_constants","ready").execute(function(e,p,f){function a(a){g.ue!==u&&g.ue.count!==u&&g.ue.count(a,(g.ue.count(a)||0)+1)}function d(a,b,d){null===d&&(d="");var c=
new RegExp("\\b("+b+"\x3d).*?(\x26|#|$)");if(0<=a.search(c))return a.replace(c,"$1"+d+"$2");a=a.replace(/[?#]$/,"");return a+(0<a.indexOf("?")?"\x26":"?")+b+"\x3d"+d}function n(){return p.state(f.PACKAGE_PREFIX)}function l(a,b){return 0!==a.find('option[value\x3d"'+b.toString()+'"]').length}function q(a){return e("[id^\x3d"+a+"]").closest("[data-a-accordion-row-name]")}function k(a,b){a=q(a);return 0<a.length?a.find(b):e(b)}function h(){b||n()===u||(b=!0,t.register("abPricingFfqp_utils",function(){return{getPageState:n,
incrementMetricByOne:a,replaceUrlParam:d,dropdownContainsQuantity:l,findAccordionRow:q,findWithinPickerAccordionRow:k}}))}var b=!1;h();t.register("abPricingFfqp_lazyInitializer",function(){return{tryInitialize:h}})})});
/* ******** */
(function(c){var d=window.AmazonUIPageJS||window.P,f=d._namespace||d.attributeErrors,a=f?f("ABPricingQuantityPricingTableSummaryAssets",""):d;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,d,f){c.when("A","jQuery","abPricingFfqp_utils","abPricingFfqp_quantityManager","abPricingFfqp_metrics").execute(function(a,c,d,f,g){a.declarative("b2bhawks-quantity-pricing-table-summary-click","click",function(b){var a=b.data.selectedQuantity,e="",c=b.data.deviceType,d=b.data.bestTier,
k=b.data.recommendedTier,h=b.data.asinDetailPageUrl;if(!b.data.tierSelected){d&&k?g.registerCounter("AB_QR_QPTS_RECOMMENDED_AND_BEST_TIER"):k?g.registerCounter("AB_QR_QPTS_RECOMMENDED_TIER"):d?g.registerCounter("AB_QR_QPTS_BEST_TIER"):g.registerCounter("AB_QR_QPTS_DEFAULT_TIER");if("mobile"===c||"mobileApp"===c)e+="#b2bhawks-quantity-pricing-table-summary";e={anchorToDiv:e};e.selectedBuyingOption="undefined"!==typeof b.data.selectedBuyingOption&&0<b.data.selectedBuyingOption.length?b.data.selectedBuyingOption:
"RZvfv//HxDF+O5021pAnSA\x3d\x3d";h&&0!=h.length&&(e.asinDetailPageUrl=h,e.refTag="bmsm_slot_redirect");f.singleton.reloadPageForQuantity(a,e)}})})});
/* ******** */
