var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),clipartArray=[],CustomBrand=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.GetBrandData=function(){$(".brand-popup").modal("toggle");CustomEndpoint.prototype.GetBrandData(function(n){$("#brand-popup-content").html(n)})},t.prototype.LoadBrandsList=function(){CustomEndpoint.prototype.SearchBrand("",function(n){$("#brandPopUpPage").html(n).promise().then(function(){_BrandList.prototype.PageScripts();t.prototype.GetDefaultBrandLogoOnSearch("#brandPopUpPage")});$("#txtSearchBrandList").off().keyup(function(){t.prototype.SearchBrand(this)})})},t.prototype.SelectBrandFromList=function(n){if($(".sp-brand-options li").removeClass("selected"),$(n).addClass("selected"),$("#isFromPopUp").val()=="False"||$("#isFromPopUp").val()=="false"){var t=void 0;$(".brand-items.selected").attr("selected-brandId")&&(t=parseInt($(".brand-items.selected").attr("selected-brandId")));CustomEndpoint.prototype.SelectBrand(t,function(){location.reload();Checkout.prototype.ScrollTop()})}},t.prototype.GetSelectedBrand=function(){var i,n,t;if($(".brand-items.selected").attr("selected-brandId"))n=parseInt($(".brand-items.selected").attr("selected-brandId")),$(".error-msg-required").hide();else{$(".error-msg-required").show();$("#brand-popup-ipad").scrollTop(700);return}$("#dynamic_pimProductId").val()?$(".brand-items.selected").attr("selected-brand-products")?(i=$(".brand-items.selected").attr("selected-brand-products"),t=!0,$.grep(i.split(","),function(n){return $("#dynamic_pimProductId").val()==n}).length==0&&(t=!1,$(".error-msg").show()),CustomEndpoint.prototype.SelectBrand(n,function(){t?(location.reload(),Checkout.prototype.ScrollTop()):(window.location.href="/home",Checkout.prototype.ScrollTop())})):($(".error-msg").show(),CustomEndpoint.prototype.SelectBrand(n,function(){window.location.href="/home";Checkout.prototype.ScrollTop()})):CustomEndpoint.prototype.SelectBrand(n,function(){location.reload();Checkout.prototype.ScrollTop()})},t.prototype.SearchBrand=function(n){var t=$(n).val().toLowerCase();$("#brand-content ul li").filter(function(){$("#NoRecordFound").show();$(this).toggle($(this).text().toLowerCase().indexOf(t)>-1);$("#brand-content").find("ul li:not([data-no-results-found]):visible").length>0?$("#brand-content").find("ul li#NoRecordFound").hide():$("#brand-content").find("ul li#NoRecordFound").show()})},t.prototype.GetDefaultBrandLogoOnSearch=function(n){var t=[];$.each($(n+" li.brand-items"),function(n,i){var r=$(i).find("img").attr("data-clipartId");r||(r="blank");t.push(r)});t&&CustomEndpoint.prototype.GetArtifiLogoUrl(function(t){t!=undefined&&t!=null&&t.artifiLogoUrl!=""?$.each($(n+" li.brand-items"),function(n,i){var r=$(i).find("img").attr("value"),u;console.log("clipartId:"+r);r?(u=t.artifiLogoUrl+"&clipartcode="+r+"&width="+$("#imageWidth").val()+"&height="+$("#imageHeight").val(),$(i).find("img").attr("src",u)):$(i).find("img").attr("src","/Content/Images/no-image.png")}):$(n+" li.brand-items").find("img").each(function(){$(this).attr("src","/Content/Images/no-image.png")})})},t.prototype.GetClipartCode=function(n,t,i){$.each(n.Data.Cliparts,function(n,r){t={ClipartCode:r.Code,ClipartThumbnailURL:r.ClipartThumbnailURL};i.push(t)})},t.prototype.GetBrandLogoByArtifi=function(n,t){CustomEndpoint.prototype.GetArtifiLogoUrl(function(i){var r=i.artifiLogoUrl;r=="undefined"&&r==""&&(r=$("#artifiLogoUrl").val());r&&n&&$.ajax({url:r+"&ClipartCode="+n,type:"GET",contentType:"application/x-www-form-urlencoded",success:t,error:function(){}})})},t}(ZnodeBase),__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},timer,dataCaptureHtmlElement="",dataCapturePaymentOptionId="",StaplesPayTransactionData=function(){function n(){}return n}(),CustomCheckout=function(n){function t(){var t=n.call(this)||this;return t.messageStaplesPayStatusApproved="Approved",t}return __extends(t,n),t.prototype.Init=function(){t.prototype.EnableDisableKeyEventOnCheckout()},t.prototype.ShippingOptions=function(){var n=$("#hdnIsB2BCheckout").val();n!=="true"&&Checkout.prototype.ShippingOptions($("input[name='PaymentOptions']:checked").attr("id"))},t.prototype.RadioChangeEvent=function(n){if(n!=""&&typeof n!="undefined"&&n!=null){var t=$("#shipping-content").find("#OldAddressId").val();$("#"+n+"").prop("checked")&&n=="DefaultAddress"?($("#shipping-content").show(),$("#SearchAddressContainer").hide(),$("#SearchForLocationAddress").html(""),$("#shipping-content").find("#AddressId").val(t),$("#billing-content").find("#AddressId").val(t),Endpoint.prototype.GetAddressDetails(t,function(){})):($("#shipping-content").hide(),$("#SearchAddressContainer").show())}},t.prototype.OnItemSelect=function(n){var t=n.id,i;Checkout.prototype.ShowLoader();$("#shipping-content").find("#AddressId").val(t);$("#billing-content").find("#AddressId").val(t);i=!1;Endpoint.prototype.GetAddressDetails(t,function(n){var t,r;Checkout.prototype.HideLoader();n.html!=""&&typeof n.html!="undefined"&&n.html!=null&&($("#SearchForLocationAddress").html(""),$("#SearchForLocationAddress").html(n.html));t=n.htmlContent;t!=""&&typeof t!="undefined"&&t!=null?($("#spp-dev-recommended-address-popup #custom-modal").find("#custom-content").empty(),$("#spp-dev-recommended-address-popup #custom-modal").modal("show").find("#custom-content").append(t),$("#user-entered-address").empty(),r="<p class='address-street'><div id='recommended-address1-0'>"+n.model.Address1+"<\/div>",n.model.Address2!=""&&typeof n.model.Address2!="undefined"&&n.model.Address2!=null&&(r+="<div id='recommended-address2-0'>"+n.model.Address2+"<\/div>"),r+="<\/p><p class='address-citystate'><div id='recommended-address-city-0'>"+n.model.CityName+"<\/div><div id='recommended-address-state-0'>"+n.model.StateName+"<\/div>"+n.model.CountryName+"<div id='recommended-address-postalcode-0'>"+n.model.PostalCode+"<\/div><\/p>",$("#user-entered-address").append(r),ZnodeBase.prototype.HideLoader(),i=!1):i=!0})},t.prototype.HideShowAddressPopUp=function(){$("#spp-dev-recommended-address-popup #custom-modal").modal("hide")},t.prototype.SaveChanges=function(n,t){var i={AddressId:$("#shipping-content").find("#AddressId").val(),Address1:$("#recommended-address1-"+t+"").text(),Address2:$("#recommended-address2-"+t+"").text(),CityName:$("#recommended-address-city-"+t+"").text(),PostalCode:$("#recommended-address-postalcode-"+t+"").text().trim(),StateName:$("#recommended-address-state-"+t+"").text()};return Endpoint.prototype.UpdateSearchAddress(i,function(n){$("#SearchForLocationAddress").html("");$("#SearchForLocationAddress").html(n.html)}),$("#spp-dev-recommended-address-popup #custom-modal").modal("hide"),!0},t.prototype.LineAllocation=function(n){if(n!=""&&n!=null&&typeof n!="undefined"){var i=t.prototype.GetLineItemId(n);$("#line-allocation-quantity-error-msg-"+n+"").text("");$("#line-allocation-quantity-error-msg-"+i+"").text("");t.prototype.ClearErrorMessage();t.prototype.ValidateLineAllocation(n)}},t.prototype.ValidateLineAllocation=function(n){var e=t.prototype.GetLineItemId(n),f=parseInt($("div[id^='spp-dev-line-quantity-"+e+"']").find("input[name='Quantity']").val()),i=!0,r=0,u;return $('input[name^="line-allocation-quantity-'+e+'"]').each(function(){var t=$(this).val(),u=$(this).val();r+=isNaN(parseInt(u))?0:parseInt(u);t==null||t==""||typeof t=="undefined"?i=!1:$("#line-allocation-quantity-error-msg-"+n+"").text("")}),$(".spp-dev-allocation-lines-count-"+n+"").each(function(t,r){var o;$("#line-allocation-quantity-error-msg-"+n+"").text("");var f=$(r.children[0].firstElementChild).val(),e=$(r.children[1].firstElementChild).val(),s=$(r.children[2].firstElementChild).val(),u=$(r.children[3].firstElementChild).val();if((f==null||f==""||typeof f=="undefined")&&(i=!1,$("#err_GLBusinessUnit-"+n+"").text("GL Business Unit is required.")),(e==null||e==""||typeof e=="undefined")&&(i=!1,$("#err_DepartmentCostCenter-"+n+"").text("Department Cost Center is required.")),(u==null||u==""||typeof u=="undefined")&&(i=!1,$("#err_line-allocation-quantity-"+n+"").text("Quantity Allocation is required.")),o=u.match(/^-?[\d]+(?:e-?\d+)?$/),o==null)$("#err_line-allocation-quantity-"+n+"").text(ZnodeBase.prototype.getResourceByKeyName("RequiredNumericValue")),i=!1;else{if(parseInt(u)>0)return!0;i=!1;$("#err_line-allocation-quantity-"+n+"").text("Quantity should be greater than zero.")}}),i&&(n=t.prototype.GetLineItemId(n),$("#line-allocation-quantity-success-msg-"+n+"").text(""),$("#line-allocation-quantity-error-msg-"+n+"").text(""),u=f-r,u>0?$("#line-allocation-quantity-success-msg-"+n+"").text("You have allocated "+r+", there are "+u+" left"):u==0?$("#line-allocation-quantity-success-msg-"+n+"").text("You have allocated all "+f+"."):(i=!1,$("#line-allocation-quantity-success-msg-"+n+"").text(""),$("#line-allocation-quantity-error-msg-"+n+"").text("Entered quantity exceeds to actual quantity."))),i&&r<=f?!0:!1},t.prototype.GetEntityAttributeUserDetails=function(){CustomEndpoint.prototype.GetEntityAttributeUserDetails(function(n){n!=null&&n!=""&&typeof n!="undefined"&&$.each(n.model.Attributes,function(i){var u=n.model.Attributes[i].AttributeCode,r;if(n.model!=null&&n.model!=""&&typeof n.model!="undefined")switch(u.toLocaleLowerCase()){case"accsetupglbusinessunits":n.model.Attributes[i].AttributeValue!=null&&n.model.Attributes[i].AttributeValue!=""&&typeof n.model.Attributes[i].AttributeValue!="undefined"&&(r=n.model.Attributes[i].AttributeValue.split(","),t.prototype.BindSelectList(r,".spp-dev-allocation-lines-glbusinessunit"));break;case"accsetupdepartmentcostcenter":n.model.Attributes[i].AttributeValue!=null&&n.model.Attributes[i].AttributeValue!=""&&typeof n.model.Attributes[i].AttributeValue!="undefined"&&(r=n.model.Attributes[i].AttributeValue.split(","),t.prototype.BindSelectList(r,".spp-dev-allocation-lines-departmentcostcenter"));break;case"accsetupproductid":n.model.Attributes[i].AttributeValue!=null&&n.model.Attributes[i].AttributeValue!=""&&typeof n.model.Attributes[i].AttributeValue!="undefined"&&(r=n.model.Attributes[i].AttributeValue.split(","),t.prototype.BindSelectList(r,".spp-dev-allocation-lines-gtr"))}})})},t.prototype.BindSelectList=function(n,t){n.length>1&&$(t).prepend("<option value='' selected='selected'><\/option>");$.each(n,function(i){$(t).append($("<option><\/option>").val(n[i]).html(n[i]))})},t.prototype.SubmitForDraft=function(){if(t.prototype.SubmitOrderDataCaptureValidation()){var n=Checkout.prototype.GetEditQuoteId();CustomEndpoint.prototype.AddDataCapture(DataCapture.prototype.getDataCapture(),n,function(){Checkout.prototype.SubmitForDraft()})}},t.prototype.SubmitForApproval=function(n,i){var r=Checkout.prototype.GetEditQuoteId();r>0?t.prototype.SubmitCustomOrderDataCaptureValidation()&&CustomEndpoint.prototype.AddDataCapture(DataCapture.prototype.customGetDataCapture(),r,function(){Checkout.prototype.SubmitForApproval()}):t.prototype.SubmitOrderDataCaptureValidation()&&CustomEndpoint.prototype.AddDataCapture(DataCapture.prototype.getDataCapture(),r,function(){if($("#hdnGatwayName").val().toLowerCase()=="staplespayaci"||$("#hdnGatwayName").val().toLowerCase()=="staplespay"){Checkout.prototype.SubmitForApprovalValidations();var r=Checkout.prototype.SubmitForApprovalModelCreation();n==null&&(t.prototype.RetryARSubmitOrderForStaplesPay(),n==null&&i==null&&t.prototype.CheckForApprovalRouting()&&t.prototype.setStaplesEventListener());r==null&&(r=Checkout.prototype.SubmitQuoteViewModelCreation(!0));r!=null&&n!=null&&i!=null&&(r=t.prototype.StaplesPayModelCreation(n,i,r),Checkout.prototype.SubmitForApprovalRequest(r))}else Checkout.prototype.SubmitForApproval()})},t.prototype.RetryARSubmitOrderForStaplesPay=function(){var i="false",r="false",u="false",f="false",e="false";$("input[name='PaymentOptions']:checked").length>0&&(i=$("input[name='PaymentOptions']:checked").attr("data-isApprovalRequired").toLowerCase(),r=$("input[name='PaymentOptions']:checked").attr("data-isOABRequired").toLowerCase(),u=r=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",f=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),e=f=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false");var o=$("#EnableApprovalRouting").val().toLowerCase(),s=$("input[name='PaymentOptions'][data-payment-type!='GIFT_CARD']:checked").first().val(),n=ZnodeBase.prototype.GetParameterValues("mode");n==undefined&&(n="");n=n!=""?n.replace("#",""):n;t.prototype.SubmitOrderByCreditCard(s,n,i,u,o)},t.prototype.decodeHtml=function(n){try{var t=(new DOMParser).parseFromString(n,"text/html");return t.documentElement.textContent}catch(i){return null}},t.prototype.parseFromJson=function(n){try{return JSON.parse(n)}catch(t){return null}},t.prototype.mapShipToSearchDataCaptures=function(){var r=document.getElementById("shippingAddressDataCaptures"),n,i;r&&(n=t.prototype.decodeHtml(r.value),n)&&(i=t.prototype.parseFromJson(n),i)&&i.forEach(function(n){var t=document.querySelector("#data-capture-content input[cat-field-id='".concat(n.CatField,"']"));t&&(t.value=n.Value)})},t.prototype.SubmitOrder=function(){var i=$("#Total").val(),n;i&&$("#Total").val(i.replace(",","."));t.prototype.mapShipToSearchDataCaptures();t.prototype.SubmitOrderDataCaptureValidation()?(n=Checkout.prototype.GetEditQuoteId(),CustomEndpoint.prototype.AddDataCapture(n>0?DataCapture.prototype.customGetDataCapture():DataCapture.prototype.getDataCapture(),n,function(){Checkout.prototype.ShowLoader();Checkout.prototype.SaveRecipientNameAddressData("shipping",function(){var f,v,n;if(Checkout.prototype.isPayMentInProcess=!0,Checkout.prototype.HidePaymentLoader(),t.prototype.IsCustomCheckoutDataValid())if(t.prototype.CheckSpecialOfferOrderRestrictions()){if(!t.prototype.ShippingErrorMessage())return Checkout.prototype.HideLoader(),Checkout.prototype.isPayMentInProcess=!1,!1;if($("#dynamic-allowesterritories").length>0)return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AllowedTerritories"),"error",!1,0),Checkout.prototype.isPayMentInProcess=!1,Checkout.prototype.HideLoader(),!1;var i="false",u="false",s="false",p="false",w="false",c=parseInt($("#hdnAnonymousUser").val())>0,l=$("input[name='PaymentOptions'][data-payment-type!='GIFT_CARD']:checked").first().attr("id"),a=$("#ApplyEcertificate").prop("checked");l||a&&(l=$("#hdnGiftCardPaymentSettingId").val());f=Checkout.prototype.GetPaymentType(l);f==null&&a&&(v=$("#giftCardType").val(),f=v?v.toLowerCase():null);$("input[name='PaymentOptions']:checked").length>0&&(i=$("input[name='PaymentOptions']:checked").attr("data-isApprovalRequired").toLowerCase(),s=$("input[name='PaymentOptions']:checked").attr("data-isOABRequired").toLowerCase(),u=s=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",p=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),w=p=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false");var e=$("#EnableApprovalRouting").val().toLowerCase(),y=$("input[name='PaymentOptions'][data-payment-type!='GIFT_CARD']:checked").first().val(),r=ZnodeBase.prototype.GetParameterValues("mode");if(r==undefined&&(r=""),r=r!=""?r.replace("#",""):r,f!=undefined)switch(f.toLowerCase()){case"credit_card":t.prototype.SubmitOrderByCreditCard(y,r,i,u,e);break;case"cod":t.prototype.SubmitOrderByCOD(i,u,e,c);break;case"gift_card":a&&parseFloat($("#Total").val())<=parseFloat($("#hdnEcertAvailableTotal").val())&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()?Checkout.prototype.SubmitForApproval():t.prototype.SubmitCheckOutFormForNotCreditCard();break;case"budget":if(n=$("input[name='PaymentOptions']:checked").attr("id"),$("#chkUseOveragePaymentForBudget_"+n).prop("checked")&&$("#chkUseOveragePaymentForBudget_"+n).prop("checked")!=undefined){var h=$("#budgetOveragePaymentMethods_"+n+" option:selected").attr("data-payment-type"),o=$("#budgetOveragePaymentMethods_"+n),b=o.find("option:selected").val()!=undefined&&o.find("option:selected").val()!=null&&o.find("option:selected").val()!=""?!0:!1;o!=undefined&&o!=null&&b&&i=="false"&&(i=$("#budgetOveragePaymentMethods_"+n+" option:selected").attr("data-isApprovalRequired").toLowerCase(),s=$("#budgetOveragePaymentMethods_"+n+" option:selected").attr("data-isOABRequired").toLowerCase(),u=s=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false");h!=undefined&&h!=null&&h!=""?(y=$("#budgetOveragePaymentMethods_"+n+" option:selected").val(),t.prototype.SubmitOrderUsingOveragePaymentMethod(h,y,r,i,u,e,c)):(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorPleaseSelectOveragePaymentMethod"),"error",!1,0),ZnodeBase.prototype.HideLoader())}else $("#chkUseOveragePaymentForBudget_"+n).is(":visible")?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorPleaseSelectOveragePaymentMethod"),"error",!1,0),ZnodeBase.prototype.HideLoader()):t.prototype.SubmitOrderByCOD(i,u,e,c);break;default:t.prototype.SubmitOrderByPaymentMethodsOtherThanCC(i,u,e)}else t.prototype.SubmitCheckOutFormForNotCreditCard()}else $("#custom-order-restriction-modal").modal("show"),Checkout.prototype.HideLoader();else Checkout.prototype.isPayMentInProcess=!1,ZnodeBase.prototype.HideLoader()})})):$("html, body").animate({scrollTop:$(".input-validation-error").offset().top-100},200)},t.prototype.UpdateOrderPaymentListAmountAfterQuantityUpdate=function(){var r=Checkout.prototype.GetEditQuoteId(),n,u,i,f;r>0&&(t.prototype.UpdateShippingOnEditOrder(),t.prototype.GetAndUpdateECertificateAmountToBeApplied(!1),n=null,u=$("#budgetOveragePaymentMethods_"+$("input[name='PaymentOptions']:checked").attr("id")+" option:selected").length>0&&$("#budgetOveragePaymentMethods_"+$("input[name='PaymentOptions']:checked").attr("id")+" option:selected").attr("data-payment-type").toLowerCase()=="credit_card",($("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="credit_card"||u)&&(n=$("#hdnPaymentCode").val(),(n==null||n==""||typeof n=="undefined")&&(n=$("#hdnGatwayName").val())),i=t.prototype.SubmitOrderSetOrderPaymentModel(null,n,null),f=JSON.stringify(i),CustomEndpoint.prototype.UpdateOrderPaymentListInSession(f,r,function(){ZnodeBase.prototype.HideLoader()}),i.forEach(function(n){(n&&n.PaymentType&&n.PaymentType=="credit_card"||n&&n.PaymentType&&n.PaymentType=="gift_card"||n&&n.PaymentType&&n.PaymentType=="budget")&&($("#shipping-options :input").prop("disabled",!0),$("#SearchShippingAddressContainer").hide())}))},t.prototype.SubmitOrderUsingOveragePaymentMethod=function(n,i,r,u,f,e,o){var s=$("input[name='PaymentOptions']:checked").attr("id");switch(n.toLowerCase()){case"credit_card":$("#Total").val(t.prototype.CalculateOveragePaymentMethodAmount(parseFloat($("#Total").val()),parseFloat($("#hdnBudgetBalance_"+s).val()),parseFloat($("#hdnECertAmount").val().replace(",","."))));t.prototype.SubmitOrderByCreditCard(i,r,u,f,e);break;case"cod":t.prototype.SubmitOrderByCOD(u,f,e,o)}},t.prototype.ConvertQuoteToOrder=function(){var t=$("#Total").val(),i=$("#QuoteOrderTotal").val(),n;t&&$("#Total").val(t.replace(",","."));i&&$("#QuoteOrderTotal").val(i.replace(",","."));Checkout.prototype.ShowLoader();n=Checkout.prototype.GetEditQuoteId();CustomEndpoint.prototype.AddDataCapture(n>0?DataCapture.prototype.customGetDataCapture():DataCapture.prototype.getDataCapture(),n,function(){var t={},n;Checkout.prototype.SetOrderDataFromQuote(t);n=Checkout.prototype.ConvertToOrder(t);n.submit();n.remove()})},t.prototype.SubmitOrderByCreditCard=function(n,i,r,u,f){var o,s,e,w,g,nt,tt;Endpoint.prototype.GetPaymentDetails(n,!0,function(n){n.GatewayCode.toLowerCase()=="highradius"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnHighRadius").val("true")):n.GatewayCode.toLowerCase()=="staplespay"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false")):n.GatewayCode.toLowerCase()=="staplespayaci"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnStaplesPayACI").val("true"),$("#hdnStaplesPay").val("false")):n.GatewayCode.toLowerCase()=="applepay"&&($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnStaplesPayACI").val("false"),$("#hdnStaplesPay").val("false"),$("#hdnApplePay").val("true"))});var b=Checkout.prototype.GetEditQuoteId(),c=$("#hdnHighRadius").val(),it=b>0?"":$("#hdnStaplesPay").val(),rt=b>0?"":$("#hdnStaplesPayACI").val(),l=$("#hdnIsPreviewStaplesPay").val(),a=$("#hdnStorePublishState").val(),ut=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),h=ut=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",v=$("input[name='PaymentOptions']:checked").attr("is-old-iframe-used");if(this.IsPaymentStaplesPay(it))if(this.IsStorePreviewSubmitOrderByCC(l,a))var k=t.prototype.CreateStaplesPayARModelForPreview(r,u,f,h,y,l,a,p),y=k.submitQuoteViewModel,p=k.data;else o=parseInt($("#hdnAnonymousUser").val())>0,t.prototype.SetFlagForApprovalRouting(r,u,f,h)&&o&&$("#singleCheckoutSubmitQuote").show(),s=document.getElementById("authStaplesPayFrame"),s?(e=parseInt($("input[name=noOfAttempts]").val()),e>0?(e=e-1,$("input[name=noOfAttempts]").val(e),t.prototype.SetFlagForApprovalRouting(r,u,f,h)&&o?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonUpdateOrder")):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder")),Checkout.prototype.HideLoader(),$("#StaplesPayOrderIsInProgress").val()==="false"&&(($("#hdnImpersonateOrderNumber").val()==undefined||$("#hdnImpersonateOrderNumber").val()=="")&&v=="false"||($("#hdnImpersonateOrderNumber").val()!=undefined||$("#hdnImpersonateOrderNumber").val()!="")&&v=="false"?s.contentWindow.postMessage("OrderReady","*"):t.prototype.SubmitCheckOutFormForNotCreditCard())):Checkout.prototype.ClearPaymentAndDisplayMessage("We're sorry, your credit-card information was rejected too many times. Please check with your card issuer and try again later.")):Checkout.prototype.ClearPaymentAndDisplayMessage("Staples Pay not available");else if(this.IsPaymentStaplesPayACI(rt))if(this.IsStorePreviewSubmitOrderByCC(l,a))var d=t.prototype.CreateStaplesPayARModelForPreview(r,u,f,h,y,l,a,p),y=d.submitQuoteViewModel,p=d.data;else o=parseInt($("#hdnAnonymousUser").val())>0,t.prototype.SetFlagForApprovalRouting(r,u,f,h)&&o&&$("#singleCheckoutSubmitQuote").show(),s=document.getElementById("resultTarget"),s?(e=parseInt($("input[name=noOfAttempts]").val()),e>0?(e=e-1,$("input[name=noOfAttempts]").val(e),t.prototype.SetFlagForApprovalRouting(r,u,f,h)&&o?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonUpdateOrder")):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder")),($("#hdnImpersonateOrderNumber").val()==undefined||$("#hdnImpersonateOrderNumber").val()=="")&&v=="false"||($("#hdnImpersonateOrderNumber").val()!=undefined||$("#hdnImpersonateOrderNumber").val()!="")&&v=="false"?(w=$("#resultTarget").attr("src").split("/"),g=w[0]+"//"+w[2],$("#StaplesPayACIOrderIsInProgress").val()==="false"&&s.contentWindow.postMessage({type:"placeOrder",merchantTransactionId:$("input[name=orderNumber]").val()},g)):t.prototype.SubmitCheckOutFormForNotCreditCard()):Checkout.prototype.ClearPaymentAndDisplayMessage("We're sorry, your credit-card information was rejected too many times. Please check with your card issuer and try again later.")):Checkout.prototype.ClearPaymentAndDisplayMessage("Staples Pay ACI not available");else typeof c!=undefined&&c!=null&&c!=""&&c=="true"?t.prototype.GetHighRadiusPopup():i!="guest"?(nt=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),tt=nt=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",t.prototype.SetFlagForApprovalRouting(r,u,f,tt)?Checkout.prototype.SubmitForApproval():t.prototype.SubmitCheckOutFormForNotCreditCard()):Checkout.prototype.SubmitPayment()},t.prototype.CreateStaplesPayARModelForPreview=function(n,i,r,u,f,e,o,s){var f,s,h;return t.prototype.SetFlagForApprovalRouting(n,i,r,u)?(f=Checkout.prototype.SubmitQuoteViewModelCreation(u=="true"?!0:!1),e&&e=="true"&&o&&o=="PREVIEW"&&u=="true"&&$("#PermissionCode").val("ARAPAYMENT"),Checkout.prototype.SubmitForApprovalRequest(f)):(s={},t.prototype.SetOrderFormData(s),h="/checkout/submitorder",$.ajax({type:"POST",url:h,async:!0,cache:!1,data:this.cachestampfunctionCustom(s),success:function(n){if(n.error!=null&&n.error!=""&&n.error!="undefined")return Checkout.prototype.ClearPaymentAndDisplayMessage(n.error),Checkout.prototype.HidePaymentProcessDialog(),!1;if(n.receiptHTML!=null&&n.receiptHTML!=""&&n.receiptHTML!="undefined")$(".cartcount").html("0"),$(".cartAmount").html(""),t.prototype.ClearCartSubtotal(),Checkout.prototype.HidePaymentProcessDialog(),window.location.href="/checkout/ordercheckoutreceipt?omsorderid="+n.omsOrderId;else return $("input[name='isBypassStaplesPay']").val("false"),$("input[name='isBypassStaplesPay']").prop("checked",!1),Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrderContactAdmin")),Checkout.prototype.HidePaymentProcessDialog(),!1},error:function(){return $("input[name='isBypassStaplesPay']").val("false"),$("input[name='isBypassStaplesPay']").prop("checked",!1),Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrder")),Checkout.prototype.HidePaymentProcessDialog(),!1}})),{submitQuoteViewModel:f,data:s}},t.prototype.SubmitOrderByCOD=function(n,i,r,u){$("#btnCompleteCheckout").prop("disabled",!1);t.prototype.cleanStaplesPayiFrameInfo();$("#btnCompleteCheckout").show();$("#txtPurchaseOrderNumber").val("");var f=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),e=f=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false";t.prototype.SetFlagForApprovalRouting(n,i,r,e)&&u?Checkout.prototype.SubmitForApproval():t.prototype.SubmitCheckOutFormForNotCreditCard()},t.prototype.SubmitCheckOutFormForNotCreditCard=function(){var i={},n;t.prototype.SetOrderFormData(i);n=Checkout.prototype.CreateForm(i);n.submit();n.remove()},t.prototype.SubmitOrderByPaymentMethodsOtherThanCC=function(n,i,r){$("#btnCompleteCheckout").prop("disabled",!1);t.prototype.cleanStaplesPayiFrameInfo();$("#btnCompleteCheckout").show();var u=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),f=u=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false";if(Checkout.prototype.CheckValidPODocument())t.prototype.SetFlagForApprovalRouting(n,i,r,f)?Checkout.prototype.SubmitForApproval():t.prototype.SubmitCheckOutFormForNotCreditCard();else return Checkout.prototype.HideLoader(),!1},t.prototype.submitForeProSystem=function(){if(t.prototype.SubmitOrderDataCaptureValidation()){var n=Checkout.prototype.GetEditQuoteId();CustomEndpoint.prototype.AddDataCapture(DataCapture.prototype.getDataCapture(),n,function(){t.prototype.validateeProCheckout()&&t.prototype.processeProCheckout()})}},t.prototype.validateeProCheckout=function(){var n=$("input[name='PaymentOptions']:checked").val(),t=$("input[name='ShippingOptions']:checked").val(),i=$("#IsBillingAddressOptional").val();return($("#errorAccountNumber").hide(),$("#errorShippingMethod").hide(),$("#expeditedShippingWarningDiv").removeClass("error"),Checkout.prototype.HidePaymentLoader(),$("#shipping-content .address-name").text().trim()==""&&$("#IsNotShippable").val()!="True")?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredShippingAddress"),"error",!1,0),!1):$("#billing-content .address-name").text().trim()==""&&i!="true"?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredBillingAddress"),"error",!1,0),!1):(t==null||t=="")&&($("#cartFreeShipping").val()!="True"||$("#hdnIsFreeShipping").val()!="True")&&$("#IsNotShippable").val()!="True"?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectShippingOption"),"error",isFadeOut,fadeOutTime),!1):$("#hndShippingclassName").val()!=undefined&&$("#hndShippingclassName").val()==Constant.ZnodeCustomerShipping&&($("#AccountNumber").val()==undefined||$("#AccountNumber").val()=="")?($("#errorAccountNumber").show(),!1):$("#hndShippingclassName").val()!=undefined&&$("#hndShippingclassName").val()==Constant.ZnodeCustomerShipping&&($("#ShippingMethod").val()==undefined||$("#ShippingMethod").val()=="")?($("#errorShippingMethod").show(),!1):$("#expeditedShippingWarningDiv").is(":visible")&&$("#expeditedCheckbox").is(":checked")===!1?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ConfirmShippingMethod"),"error",!1,0),$("#expeditedShippingWarningDiv").addClass("error"),!1):(n==null||n=="")&&$("#Total").val().replace(",",".")>0?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectPaymentOption"),"error",!1,0),!1):!0},t.prototype.processeProCheckout=function(){var n={OmsOrderState:ZnodeBase.prototype.getResourceByKeyName("PendingB2b"),OldOrderStatus:$("#OrderStatus").val(),QuoteId:$("#QuoteId").val(),ShippingId:$("input[name='ShippingOptions']:checked").val(),AdditionalNotes:$("#AdditionalInstruction").val(),PaymentSettingId:$("input[name='PaymentOptions']").length>0?$("input[name='PaymentOptions']:checked").val():null,IsPendingPayment:!0};return(n.ShippingId==null||n.ShippingId=="")&&$("#IsNotShippable").val()!="True"?(Checkout.prototype.DisplaySelectOptionMessage(),!1):(Checkout.prototype.ShowLoader(),t.prototype.CreateB2BQuoteRedirectToReceipt(n))},t.prototype.CreateB2BQuoteRedirectToReceipt=function(n){CustomEndpoint.prototype.CreateB2BQuote(n,function(n){n.status?window.location.href=n.redirectUrl:Checkout.prototype.HideLoader();ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.status?"success":"error",isFadeOut,fadeOutTime)})},t.prototype.GetAllocatedLinesData=function(){var i={},n=[];return $(".spp-dev-allocation-lines").each(function(r,u){n=[];var f=1;$(".spp-dev-allocation-lines-count-"+u.attributes[1].value+"").each(function(i,r){var u=t.prototype.BindAllocationLinesModel($(r.children[0].firstElementChild).val(),$(r.children[1].firstElementChild).val(),$(r.children[2].firstElementChild).val(),parseInt($(r.children[3].firstElementChild).val()),f);f++;n.push(u)});i[u.attributes[1].value]=n}),JSON.stringify(i)},t.prototype.GetAdditionalInformatioData=function(){var n=[];$.each($("#recipientproductlist option:selected"),function(){n.push($(this).val())});var i=$("#productuselist").val(),r=n.join(", "),u=$("#txtapprovermanager").val(),f=$("#txtprojectname").val(),e=$("#eventDate").val(),o=$("#inHandDate").val();return JSON.stringify(t.prototype.BindAdditionInformationModel(i,r,u,f,e,o))},t.prototype.BindAllocationLinesModel=function(n,t,i,r,u){return{GLBusinessUnit:n,DepartmentCostCenter:t,GTR:i,Quantity:r,DisplayOrder:u}},t.prototype.BindAdditionInformationModel=function(n,t,i,r,u,f){return{ApproverManager:i,ProductName:n,ProjectName:r,RecipientName:t,EventDate:u,InHandsDate:f}},t.prototype.SubmitOrderAllocatedLinesValidation=function(){t.prototype.ClearErrorMessage();var n=!0,i=$("#productuselist").val(),r=$("#recipientproductlist").val(),u=$("#txtapprovermanager").val(),f=$("#txtprojectname").val();return(i=="0"||i==""||typeof i=="undefined"||i==null)&&(n=!1,$("#err_productuselist").text("Product is required.")),(r==""||typeof r=="undefined"||r==null)&&(n=!1,$("#err_recipientproductlist").text("Recipient is required.")),(u==""||typeof u=="undefined"||u==null)&&(n=!1,$("#err_txtapprovermanager").text("Approving manage is required.")),(f==""||typeof f=="undefined"||f==null)&&(n=!1,$("#err_txtprojectname").text("Project name is required.")),n&&$(".spp-dev-allocation-lines").each(function(i,r){t.prototype.ValidateLineAllocation(r.attributes[1].value)||(n=!1)}),n},t.prototype.TotalAllocationQuantity=function(n){t.prototype.ClearErrorMessage();var i=0,r=n.substring(0,n.length-2);return $('input[name^="line-allocation-quantity-'+r+'"]').each(function(){var t=$(this).val(),n=$(this).val();i+=isNaN(parseInt(n))?0:parseInt(n)}),i},t.prototype.DisableInHandeDate=function(n){var i="+"+n+"d",t=new Date;t.setDate(t.getDate()+n);var r=t.getDate(),u=t.getMonth()+1,f=t.getFullYear(),e=u+"/"+r+"/"+f;$("#inHandDate").datepicker("setStartDate",i)},t.prototype.DisablePrevioudDate=function(){var n=new Date,t=n.getDate(),i=n.getMonth()+1,r=n.getFullYear(),u=i+"/"+t+"/"+r;$("#eventDate").datepicker("setStartDate",u)},t.prototype.ClearErrorMessage=function(){$("p[id^='err_'][class='error-msg']").each(function(){$(this).text("")})},t.prototype.GetLineItemId=function(n){var t=n.substring(n.length-2,n.length-1);return t=="-"?n.substring(0,n.length-2):n},t.prototype.CountryChange=function(n,t){CustomEndpoint.prototype.GetStateByCountryCode(n.value,function(n){var i;$.each(n.StateList,function(n,t){i=i+"<option value="+t.Value+">"+t.Text+"<\/option>"});$("#"+t).html(i)})},t.prototype.SubmitOrderDataCaptureValidation=function(){return DataCapture.prototype.validateDataCapture(!0)},t.prototype.SubmitCustomOrderDataCaptureValidation=function(){return DataCapture.prototype.customValidateDataCapture(!0)},t.prototype.UpdateExpeditedShipping=function(n,i){$("#expeditedCheckbox").prop("checked",!1);var r=$("#expeditedShippingWarningDiv");n.toString().toLowerCase()=="true"?(t.prototype.AddCustomerServicePhoneNumber(i),r.show()):r.hide()},t.prototype.AddCustomerServicePhoneNumber=function(n){var i=$("#expeditedShippingTextLine"),t=i.text();t!=null&&(t=t.replace("{CustomerServicePhone}",n),i.text(t))},t.prototype.UpdateDeliveryAndExpedited=function(n,i,r,u){var f=$("#deliveryTimeframeLabel");i&&i.length>0?f.text("".concat(n," - ").concat(i)):f.text("");t.prototype.UpdateExpeditedShipping(r,u)},t.prototype.ShippingErrorMessage=function(n){n===void 0&&(n=!0);var i=Checkout.prototype.ShippingErrorMessage();return i&&t.prototype.CustomChangeSubmitOrderButtonText(),t.prototype.CustomDisablePaymentOptions(),i},t.prototype.UpdateShippingOnEditOrder=function(){$("#loaderId").html(" <div class='loader-inner' style='margin:0 auto;text-align:center;padding:20px;'><img src= '../Content/Images/throbber.gif' alt= 'Loading' class='dashboard-loader' /><\/div>");CustomEndpoint.prototype.ShippingOptions($("input[name='PaymentOptions']:checked").attr("id"),!1,function(n){$("#loaderId").html("");CommonHelper.prototype.LoadHtmlByControl($(".shipping-method").eq(0),n);Checkout.prototype.DisableShippingForFreeShippingAndDownloadableProduct()})},t.prototype.DisablePaymentCheckBox=function(){var n=$("#allPaymentOptionsDiv .input-radio .input-radioButton:checked").prop("id");$("input[name='isNewCreditCard']").attr("disabled",!0);$("input[name='isNewCreditCard']").val("false");$("input[name='isNewCreditCard']").prop("checked",!1);$("#hdnisEditCheckboxCompleted").is(":checked")==!1?$("#isNewCreditCard_"+n).attr("disabled",!0):($("input[name='isNewCreditCard']").attr("disabled",!0),$("#isNewCreditCard_"+n).attr("disabled",!1))},t.prototype.getStaplesPayAciIframeOrigin=function(n){if(!n)throw new Error("Staples Pay Aci Iframe object not provided");if(!n.src||n.src.trim().length<1)throw new Error("Staples Pay Aci Iframe does not have a src value");var t=n.src.split("/");return"".concat(t[0].trim(),"//").concat(t[2].trim())},t.prototype.displayStaplesPayAciIframe=function(){var r,n,i;try{if(r=document.querySelector("#div-StaplesPay"),!r)throw new Error("Unable to find Div for Staples Pay iFrame");if(r.style.display="",n=document.querySelector("#resultTarget"),!n)throw new Error("Unable to find iframe with id resultTarget");if(n.style.display="",!n.src||n.src.trim().length<1||n.src===window.location.toString()){if(i=document.querySelector("#hdnStaplesPayAciUrl"),!i||!i.value||i.value.trim().length<1)throw new Error("Unable to get Staples Pay Aci Url");n.src=i.value.trim()}t.prototype.postMessageAddCardToStaplesPayAciIframe()}catch(u){console.error(u)}},t.prototype.postMessageAddCardToStaplesPayAciIframe=function(){var n,u,i;try{if(n=document.querySelector("#resultTarget"),!n)throw new Error("Unable to find iframe with id resultTarget");if(!n.src||n.src.trim().length<1||n.src===window.location.toString())return;var e=t.prototype.getStaplesPayAciIframeOrigin(n),f=document.querySelector("input[name=orderNumber]"),r=f?f.value:"";if(!r||r.trim().length<1)throw new Error("Could not get order number for Staples Pay ACI");if(u=document.querySelector("#hdnStaplesPayAciCheckoutId"),i=u?u.value:"",!i||i.trim().length<1)throw new Error("Unable to get Checkout Id for Staples Pay ACI");if(!n.contentWindow)return;n.contentWindow.postMessage({type:"addCard",merchantTransactionId:r,checkoutId:i},e)}catch(o){console.error(o)}},t.prototype.hideStaplesPayAciIframe=function(){try{var n=document.querySelector("#resultTarget");if(!n)throw new Error("Unable to find iframe with id resultTarget");n.style.display="none"}catch(t){console.error(t)}},t.prototype.ShowPaymentOptions=function(n){var r,u,h,i;if(t.prototype.removeApplePayButton(),t.prototype.HideBudgetOveragePaymentSection(),r=Checkout.prototype.GetEditQuoteId(),u=document.querySelector("input[name='PaymentOptions']:checked"),!u)throw new Error("Unable to get selected payment method radio button");var f=Number(u.id),e=Number(u.getAttribute("data-selectedId")),l=u.getAttribute("data-isShipToSearchEnabled")==="true",p=u.getAttribute("data-isShipToSearchRequired")==="true",a=u.getAttribute("data-gatewayCode"),v=document.getElementById("shipToSearchBox");v&&(v.style.display=l?"block":"none");(r==null||isNaN(parseInt(r))||parseInt(r)<1)&&t.prototype.GetAccountAddress("shipping",0,0,!1);f!=e&&($("input[name='PaymentOptions']").attr("data-iframeloaded","0"),$("input[name='PaymentOptions']").attr("data-selectedId",f));var o=document.querySelector("#hdnEnableStaplesPayAciIframePreload"),w=o&&o.value.trim().length>0?o.value.trim().toLowerCase()==="true":!1,y=document.querySelector("#hdnStorePublishState"),s=y?y.value.trim().toLowerCase():"";if(w&&s!=="preview"&&(f>0&&a==="staplespayaci"?t.prototype.displayStaplesPayAciIframe():t.prototype.hideStaplesPayAciIframe()),f>0&&(Checkout.prototype.ShippingOptions(f),$("#BillingAddressContainer").removeClass("disable_section"),$("#billing-content .address-details").attr("style")!=null&&$("#billing-content .address-details").attr("style")!=undefined&&$("#billing-content .address-details").attr("style").replace(" ","")!="display:none;"?l&&p?t.prototype.DisableShippingMethodsAndCheckout():t.prototype.EnableShippingSection(!0):t.prototype.DisableShippingSection()),$("div[data-test-selector=fileUploaderSelector]").html(""),$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase()=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")&&Endpoint.prototype.getView("/customcheckout/getfileuploader",function(t){CommonHelper.prototype.LoadHtmlByControl($("#FileUploadeDiv_"+n.id),t);$("#FileUploadeDiv_"+n.id).show()}),(isNaN(e)||f==e||a==="staplespayaci")&&s!=="preview"||($("#div-StaplesPay").hide(),(n.type=="radio"||$("#IsStaplesPaySelected").val()==""||$("#IsStaplesPaySelected").val()=="false"||$("#StaplesPayOptionSelectionType").val()=="radio"&&$("#IsStaplesPaySelected").val()=="true")&&($(".creditCardInformationTitle").hide(),t.prototype.cleanStaplesPayiFrameInfo())),$("input[name='isBypassStaplesPay']").attr("disabled",!0),$("#hdnIsPreviewStaplesPay").val("false"),s!=="preview"||$("input[name=PaymentOptions]:checked").attr("data-payment-type")==undefined||$("input[name=PaymentOptions]:checked").attr("data-payment-type").toLowerCase()=="credit_card"||$("#div-PreviewStaplezPay").html(""),$("input[name='isBypassStaplesPay']").val("false"),$("input[name='isBypassStaplesPay']").prop("checked",!1),h=$("#label_"+n.id).find("#isBypassStaplesPay"),h.length>0&&(h.attr("disabled",!1),t.prototype.CheckPreviewStaplesPay(!1)),t.prototype.DisablePaymentCheckBox(),n==null&&(n=$('input[name="PaymentOptions"]:checked')[0]),i=n,$("#IsBillingAddressOptional").length>0?$("#IsBillingAddressOptional").val("false"):$("#BillingAddressContainer").append("<input type='hidden' value='false' id='IsBillingAddressOptional' />"),r==0&&DataCapture.prototype.CreateDataCaptureControl("checkout",i.id),t.prototype.CustomChangeSubmitOrderButtonText(),i!=null&&i!=""&&i!="undefined"){$("#messageBoxContainerId").hide();var c=Checkout.prototype.GetPaymentType(i.id),b=$("#Total").val(),k=$("#hdnECertAmount").val().replace(",",".");if($("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("false"),c=="credit_card"){if(($("#cc-content-message").show(),t.prototype.HideAndResetBudgetOverageCheckboxSection(i),k==0&&!Checkout.prototype.IsOrderTotalGreaterThanZero(b))||!t.prototype.ValidateBudget())return!1;$("#PaymentSettingId").val(i.value);$("#hdnGatwayName").val("");$("#hdnEncryptedTotalAmount").val("");Endpoint.prototype.GetPaymentDetails($("#PaymentSettingId").val(),!1,function(u){if($("#IsBillingAddressOptional").val(u.IsBillingAddressOptional),Checkout.prototype.ToggleBillingAddressBlock(),$("#IsBillingAddressOptional").val()!="true"&&$("#BillingAddressContainer").find(".address-details").attr("style")!=null&&$("#BillingAddressContainer").find(".address-details").attr("style")!=undefined&&$("#BillingAddressContainer").find(".address-details").attr("style").replace(" ","")=="display:none;"&&CommonHelper.prototype.ExecuteAjaxClickEvent($("#BillingAddressContainer").find("#autoClick")),!u.HasError)if(Checkout.prototype.SetPaymentDetails(u),u.GatewayCode.toLowerCase()=="highradius")$("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnHighRadius").val("true"),Checkout.prototype.ToggleSubmitOrderButtonsVisibility(n),t.prototype.AvoidCCPaymentOptionToggleForCheckbox(i),Checkout.prototype.HideLoader();else if(u.GatewayCode.toLowerCase()=="staplespay")$("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),$("#IsStaplesPaySelected").val(n.checked),$("#StaplesPayOptionSelectionType").val(n.type),t.prototype.CheckPreviewStaplesPay(!0),(n.checked||n.selected)&&t.prototype.ShowSelectedPaymentArea(),t.prototype.CheckForApprovalRouting&&r==0&&t.prototype.ShowSelectedPaymentArea(),Checkout.prototype.HideLoader();else if(u.GatewayCode.toLowerCase()=="staplespayaci")$("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("true"),$("#IsStaplesPaySelected").val(n.checked),$("#StaplesPayOptionSelectionType").val(n.type),t.prototype.CheckPreviewStaplesPay(!0),(n.checked||n.selected)&&t.prototype.CheckForApprovalRouting&&r==0&&t.prototype.ShowSelectedPaymentArea(),Checkout.prototype.HideLoader();else if(u.GatewayCode.toLowerCase()=="applepay")$("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnHighRadius").val("false"),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("false"),t.prototype.isRunningOnSafariAndIos()&&$("#btnCompleteCheckout").hide(),t.prototype.GetWalletConfigurationForApplePay();else{var f=$("input[name=PaymentOptions]:checked").attr("data-payment-type");Checkout.prototype.ShowHidePaymentOption(f);Checkout.prototype.CreditCardPayment(f);Checkout.prototype.HideLoader();Checkout.prototype.AvoidPaymentOptionToggleForCheckbox(i)}})}else c=="budget"?(Checkout.prototype.ToggleSubmitOrderButtonsVisibility(n),$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!1),Checkout.prototype.ShowLoader(),Endpoint.prototype.GetPaymentDetails(i.value,!1,function(n){var u,f,r,i;if($("#IsBillingAddressOptional").val(n.IsBillingAddressOptional),Checkout.prototype.ToggleBillingAddressBlock(),u=$("#billing-content").find("#AddressId").val(),$("#IsBillingAddressOptional").val()=="true"&&parseInt(u)==0?(u=$("#shipping-content").find("#AddressId").val(),$("#billing-content").find("#AddressId").val(u)):$("#IsBillingAddressOptional").val()!="true"&&$("#BillingAddressContainer").find(".address-details").attr("style")!=null&&$("#BillingAddressContainer").find(".address-details").attr("style")!=undefined&&$("#BillingAddressContainer").find(".address-details").attr("style").replace(" ","")=="display:none;"&&CommonHelper.prototype.ExecuteAjaxClickEvent($("#BillingAddressContainer").find("#autoClick")),f=$("#BudgetPaymentOptions").val(),f!==undefined&&f!=="")for(r=f.split(","),i=0;i<r.length;i++)r[i].toString()!==""&&$("#div-chkUseOveragePaymentForBudget_"+r[i].toString()+", #overageDropDown_"+r[i].toString()).hide();t.prototype.ShowHideOverageShippingMessage();Checkout.prototype.HideLoader()})):c=="cod"?($("#cc-content-message").hide(),t.prototype.HideAndResetBudgetOverageCheckboxSection(i),Checkout.prototype.ToggleSubmitOrderButtonsVisibility(n),$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!1),Checkout.prototype.ShowLoader(),Endpoint.prototype.GetPaymentDetails(i.value,!1,function(n){$("#IsBillingAddressOptional").val(n.IsBillingAddressOptional);Checkout.prototype.ToggleBillingAddressBlock();var t=$("#billing-content").find("#AddressId").val();$("#IsBillingAddressOptional").val()=="true"&&parseInt(t)==0?(t=$("#shipping-content").find("#AddressId").val(),$("#billing-content").find("#AddressId").val(t)):$("#IsBillingAddressOptional").val()!="true"&&$("#BillingAddressContainer").find(".address-details").attr("style")!=null&&$("#BillingAddressContainer").find(".address-details").attr("style")!=undefined&&$("#BillingAddressContainer").find(".address-details").attr("style").replace(" ","")=="display:none;"&&CommonHelper.prototype.ExecuteAjaxClickEvent($("#BillingAddressContainer").find("#autoClick"));Checkout.prototype.HideLoader()})):($("#cc-content-message").hide(),t.prototype.HideAndResetBudgetOverageCheckboxSection(i),Checkout.prototype.ShowPaymentOptions(i));t.prototype.ValidatePaymentAmountsWithOrderTotal();t.prototype.PaymentSummaryBlockCustomization(null);$("#ShippingAddressContainer").find(".address-details").attr("style")!=null&&$("#ShippingAddressContainer").find(".address-details").attr("style")!=undefined&&$("#ShippingAddressContainer").find(".address-details").attr("style").replace(" ","")=="display:none;"&&_RecommendedAddress.prototype.ClickShippingFields()}return!0},t.prototype.isRunningOnSafariAndIos=function(){var n=navigator.userAgent.toLowerCase(),t=/mac os/.test(n),i=/safari/.test(n)&&!/chrome/.test(n);return t&&i},t.prototype.GetWalletConfigurationForApplePay=function(){var i=String($("#hdnPaymentCode").val()),r=$("#hdnStaplesPay").val()!=null?String($("#hdnStaplesPay").val()).trim().toLowerCase()==="true":!1,n=document.querySelector("#LINCCompany"),u=n&&n.value.trim().length>0?n.value.trim().toUpperCase():"";CustomEndpoint.prototype.GetStaplesPayWalletConfiguration(i,r,u,!0,function(n){if(Endpoint.prototype.GenerateOrderNumber(parseInt(String($("#portalId").val())),function(n){if($("input[name=orderNumber]").val(n.orderNumber),t.prototype.isControlAvailable($("input[name=tranID]"))){var i=t.prototype.getStaplesPayTranId("","","",String($("input[name=orderNumber]").val()));$("input[name=tranID]").val(i)}}),n.LincCompanyCode){var i="ApplePayMerchantId";n.LincCompanyCode.toLowerCase()==="cn"?typeof n.DefaultDivisionCAN!=undefined&&n.DefaultDivisionCAN!=null&&n.DefaultDivisionCAN!=""&&n.DefaultDivisionCAN!="N/A"&&(t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(n.DefaultDivisionCAN))&&$("input[name=div]").val(n.DefaultDivisionCAN.trim()),$("#merchantId").val(n[i+n.DefaultDivisionCAN.trim()])):t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(n.DefaultDivisionUS))&&($("input[name=div]").val(n.DefaultDivisionUS.trim()),$("#merchantId").val(n.ApplePayMerchantIdSPM.trim()))}else t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(n.DefaultDivisionUS))&&($("input[name=div]").val(n.DefaultDivisionUS.trim()),$("#merchantId").val(n[i+n.DefaultDivisionUS.trim()]))})},t.prototype.SplitPaymentForBudget=function(){var n=Checkout.prototype.GetPaymentType($("input[name='PaymentOptions']:checked").attr("id"));n=="budget"&&(Checkout.prototype.ShippingOptions($("input[name='PaymentOptions']:checked").attr("id")),$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!1),Checkout.prototype.ShowLoader(),Endpoint.prototype.GetPaymentDetails($("input[name='PaymentOptions']:checked").prop("value"),!1,function(n){var u,f,r,i;if($("#IsBillingAddressOptional").val(n.IsBillingAddressOptional),Checkout.prototype.ToggleBillingAddressBlock(),u=$("#billing-content").find("#AddressId").val(),$("#IsBillingAddressOptional").val()=="true"&&parseInt(u)==0&&(u=$("#shipping-content").find("#AddressId").val(),$("#billing-content").find("#AddressId").val(u)),f=$("#BudgetPaymentOptions").val(),f!=undefined&&f!=="")for(r=f.split(","),i=0;i<r.length;i++)r[i].toString()!==""&&$("#div-chkUseOveragePaymentForBudget_"+r[i].toString()+", #overageDropDown_"+r[i].toString()).hide();t.prototype.ShowHideOverageShippingMessage();Checkout.prototype.HideLoader()}))},t.prototype.AvoidCCPaymentOptionToggleForCheckbox=function(n){n.type=="radio"?($("#allPaymentOptionsDiv .input-checkbox_container .input-checkbox").prop("checked",!1),$("#div-PaypalExpress").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-InvoiceMe").hide(),$("#gift-card-div").hide(),parseFloat($("#GiftCardAmount").val())>0&&Checkout.prototype.RemoveGiftCard()):n.checked?$("#allPaymentOptionsDiv .input-radio .input-radioButton").prop("checked",!1):$("#div-CreditCard").hide()},t.prototype.HideBudgetOveragePaymentSection=function(){var n=$("input[name='PaymentOptions']:checked").attr("data-payment-type");(n===undefined||n===null)&&(n="");n.toLowerCase()!=="budget"&&t.prototype.BudgetOveragePaymentSection(!0)},t.prototype.BudgetOveragePaymentSection=function(n){var r,i,t;if(n&&(r=$("#BudgetPaymentOptions").val(),r!==undefined&&r!==""))for(i=r.split(","),t=0;t<i.length;t++)i[t].toString()!==""&&($("#div-chkUseOveragePaymentForBudget_"+i[t].toString()+", #overageDropDown_"+i[t].toString()).hide(),$("#PaymentSummary").addClass("hide"),$("#chkUseOveragePaymentForBudget_"+i[t].toString()).prop("checked",!1),$("#budgetOveragePaymentMethods_"+i[t].toString()+" option").length>1&&$("#budgetOveragePaymentMethods_"+i[t].toString()).val(""))},t.prototype.getOveragePaymentMethodAmount=function(){var i=document.querySelector("input[name='PaymentOptions']:checked"),r,u,n;if(i==null)return 0;var e=i.attributes.getNamedItem("id").value,o=0,s=document.querySelector("#chkUseOveragePaymentForBudget_".concat(e)),h=s!=null&&s.checked;if(h&&(r=i.attributes.getNamedItem("data-payment-type"),r!=null&&r.value.trim().toLowerCase()=="budget"&&(u=document.querySelector("#hdnBudgetBalance_".concat(e)),u!=null&&(o=Number(u.value.trim().replace(",","."))))),n=document.querySelector("#hdnTotalOrderAmount"),n==null||n.value.trim().length===0)return console.error("Couldn't find hdnTotalOrderAmount"),0;var c=parseFloat(n.value.replace(",",".")),f=document.querySelector("#hdnECertAmount"),l=f==null&&f.value.trim().length===0?0:parseFloat(f.value.replace(",","."));return t.prototype.CalculateOveragePaymentMethodAmount(c,o,l)},t.prototype.CustomChangeSubmitOrderButtonText=function(){var r,y,p,w,i;$("#singleCheckoutSubmitQuote").show();var f="false",e="false",o="false",c="false",l="false",n="",s=$("#ApplyEcertificate").prop("checked"),a=!1;if($("input[name='PaymentOptions']:checked").length>0)if(f=$("input[name='PaymentOptions']:checked").attr("data-isApprovalRequired").toLowerCase(),c=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),e=$("input[name='PaymentOptions']:checked").attr("data-isOABRequired").toLowerCase(),o=e=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",l=c=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",r=$("input[name='PaymentOptions']:checked").attr("id"),$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"&&$("#chkUseOveragePaymentForBudget_"+r).prop("checked")){var v=$("#budgetOveragePaymentMethods_"+r),u=v.find("option:selected"),b=u.val()!=null&&u.val()!="";v!=null&&b&&(f=="false"&&(f=$("#budgetOveragePaymentMethods_"+r+" option:selected").attr("data-isApprovalRequired").toLowerCase(),e=$("#budgetOveragePaymentMethods_"+r+" option:selected").attr("data-isOABRequired").toLowerCase(),o=e=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false"),n=u.attr("data-payment-type").toLowerCase(),y=t.prototype.getOveragePaymentMethodAmount(),a=u.attr("data-gatewayCode")!=null&&u.attr("data-gatewayCode").trim().toLowerCase()=="applepay"&&y>0);($("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="credit_card"&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"&&parseInt($("#QuoteId").val())==0||n!=""&&n!=undefined&&n=="credit_card"&&parseInt($("#QuoteId").val())==0&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget")&&(i=t.prototype.CheckForApprovalRouting(),i&&t.prototype.ShowSelectedPaymentArea())}else $("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="credit_card"&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"&&parseInt($("#QuoteId").val())==0||n!=""&&n!=undefined&&n=="credit_card"&&parseInt($("#QuoteId").val())==0&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"?(i=t.prototype.CheckForApprovalRouting(),i&&t.prototype.ShowSelectedPaymentArea()):parseInt($("#QuoteId").val())>0&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"||parseInt($("#QuoteId").val())>0&&$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="staplespay"||parseInt($("#QuoteId").val())>0&&$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="credit_card"||parseInt($("#QuoteId").val())>0&&$("input[name='PaymentOptions']:checked").attr("data-payment-type")!=undefined&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"||parseInt($("#QuoteId").val())>0&&s?(p=t.prototype.SubmitOrderSetOrderPaymentModel(null,null,null),p?($("#shipping-options :input").prop("disabled",!0),$("#SearchShippingAddressContainer").hide()):($("#shipping-options :input").prop("disabled",!1),$("#SearchShippingAddressContainer").show()),$("#singleCheckoutSubmitQuote").show(),w=Checkout.prototype.GetEditQuoteId(),w>0?($("input[name='PaymentOptions']").parent("div").addClass("read-only"),$("input[name='ApplyEcert']").closest("div").parent("div").addClass("read-only"),$("input[name='ShippingOptions']").closest("div").parent("div").addClass("read-only")):$("input[name='PaymentOptions']").parent("div").removeClass("read-only")):$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="credit_card"&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"?(i=t.prototype.CheckForApprovalRouting(),i&&t.prototype.ShowSelectedPaymentArea()):s&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()?($(".btnCompleteCheckout").show(),parseInt($("#QuoteId").val())>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval"))):n=$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase();if(!(parseInt($("#QuoteId").val())>0)){var h=document.querySelector("#EnableApprovalRouting"),k=h&&h.value.trim().length>0?h.value.trim().toLowerCase():"",d=parseInt($("#hdnAnonymousUser").val())>0;t.prototype.SetFlagForApprovalRouting(f,o,k,l)&&d?($(".btnCompleteCheckout").show(),n=="credit_card"&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"?(t.prototype.ShowSelectedPaymentArea(),$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval"))):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval"))):n=="credit_card"&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="highradius"&&$("#hdnHighRadius").val()!=undefined&&$("#hdnHighRadius").val().toLowerCase()=="true"?($(".btnCompleteCheckout").show(),$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> Continue to Payment')):s&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()?($(".btnCompleteCheckout").show(),parseInt($("#QuoteId").val())>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval"))):$("input[name='PaymentOptions']:checked").attr("data-payment-type")!=null&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()==="credit_card"&&$("#hdnGatwayName").val()!=null&&$("#hdnGatwayName").val().trim().toLowerCase()==="applepay"&&parseInt($("#QuoteId").val())===0?$(".btnCompleteCheckout").hide():($("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""&&($("#IsROEnabled").val()==undefined||$("#IsROEnabled").val()==""||$("#IsROEnabled").val()=="False")?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonUpdateOrder")):a?$(".btnCompleteCheckout").hide():$(".btnCompleteCheckout").show(),$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder")))}},t.prototype.CheckForApprovalRouting=function(){var n="false",u="false",f="false",e="false",o="false",s,c,l;if($("input[name='PaymentOptions']:checked").length>0){if(n=$("input[name='PaymentOptions']:checked").attr("data-isApprovalRequired").toLowerCase(),s=Checkout.prototype.GetEditQuoteId(),s==0){var a=$("input[name='PaymentOptions']:checked").attr("id"),h=$("#budgetOveragePaymentMethods_"+a),i=h.find("option:selected").val(),r=i!=undefined&&i!=null&&i!=""&&h.find("option:selected").attr("data-isapprovalrequired")=="True"?"true":"false";r!=undefined&&r!=""&&r=="true"&&(n="true")}return e=$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase(),u=$("input[name='PaymentOptions']:checked").attr("data-isOABRequired").toLowerCase(),f=u=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",o=e=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?"true":"false",c=$("#EnableApprovalRouting").val().toLowerCase(),l=parseInt($("#hdnAnonymousUser").val())>0,t.prototype.SetFlagForApprovalRouting(n,f,c,o)&&l}return!1},t.prototype.CheckForApprovalRoutingForEcert=function(){var n="false",i=$("#isAREnabledForGiftCard").val(),r,u;return $("input[name='ApplyEcert']:checked").length>0?(n=i!=null||i!=undefined?String(i.toLowerCase()):n,r=$("#EnableApprovalRouting").val().toLowerCase(),u=parseInt($("#hdnAnonymousUser").val())>0,t.prototype.SetFlagForApprovalRoutingForEcert(n,"false",r,"false")&&u):!1},t.prototype.SetFlagForApprovalRoutingForEcert=function(n,t,i,r){if(i=="true"||n=="true"||t=="true"||r=="true"){if(t=="true"||r=="true")return!0;var f=parseFloat($("#OrderLimit").val()),e=parseFloat($("#SubTotal").val()),o=$("#ApplyEcertificate").prop("checked"),u;return u=o&&$("input[name='PaymentOptions']:checked").length==0?$("#paymentOrderLimtForGiftCard").val():$("input[name='PaymentOptions']:checked").attr("data-paymentOrderLimit"),$(".signle-page-payment").attr("data-approvaltypename").toLowerCase()=="payment"?u&&u!=""&&e>=parseInt(u)?!0:!1:f==0||e>=f?!0:!1}return!1},t.prototype.ShowHideBudgetOveragePaymentMethods=function(){var n=$("input[name='PaymentOptions']:checked").attr("id"),r=parseFloat($("#Total").val().replace(",",".").replace(" ","")),i=parseFloat($("#hdnBudgetBalance_"+n).val());isNaN(i)||(i=parseFloat($("#hdnBudgetBalance_"+n).val().replace(",",".").replace(" ","")));$("#chkUseOveragePaymentForBudget_"+n).prop("checked")&&r>i?($("#overageDropDown_"+n).show(),t.prototype.GetBudgetShippingErrorMessage(),$("#span-paymentOverageMessage, #span-shippingOverageMessage").show(),$("#budgetOveragePaymentMethods_"+n+" option").length==1?($("#span-paymentOverageMessage, #span-shippingOverageMessage").hide(),$("#chkUseOveragePaymentForBudget_"+n).prop("checked",!0),t.prototype.PaymentSummaryBlockCustomization($("#budgetOveragePaymentMethods_"+n+" option")[0])):$("#ApplyEcertificate:checked").length>0&&i+parseFloat($("#hdnEcertAvailableTotal").val())>=r&&$("#span-paymentOverageMessage, #span-shippingOverageMessage").hide()):($("#chkUseOveragePaymentForBudget_"+n).prop("checked",!1),$("#overageDropDown_"+n).hide(),r>i&&($("input[name='PaymentOptions']:checked").attr("data-payment-type")!=undefined&&$("input[name='PaymentOptions']:checked").attr("data-payment-type")!=null&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"&&(t.prototype.GetBudgetShippingErrorMessage(),$("#span-paymentOverageMessage, #span-shippingOverageMessage").show()),t.prototype.BudgetOveragePaymentSection(!1)))},t.prototype.ShowSelectedPaymentArea=function(){var n,h;Checkout.prototype.ShowLoader();var u=t.prototype.GetEcertificateAmount(),i=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),f=parseFloat($("#Total").val().replace(",",".").replace(" ","")),c=$("input[name='PaymentOptions']:checked").attr("id"),e=parseFloat($("#hdnBudgetBalance_"+c).val()),l=$("#isOnlyECertCartItems").val().toLowerCase(),r=$("#PaymentSettingId").val(),o=$("#resultTarget").attr("src")==""||$("#resultTarget").attr("src")==undefined||$("#resultTarget").attr("src")==null;if(typeof r!=undefined&&r!=null&&r!="")if(n=$("#hdnStorePublishState").val(),$("input[name='PaymentOptions']:checked").attr("data-iframeloaded")!="1"){var a=$("#hdnStaplesPay").val(),v=$("#hdnStaplesPayACI").val(),s=$("#hdnIsPreviewStaplesPay").val();this.IsPaymentStaplesPay(a)?($("#authStaplesPayFrame").show(),$("#resultTarget").hide(),this.IsStorePreview(n)&&this.IsByPassStaplesPayActive(s)?CustomEndpoint.prototype.GetCardView(function(n){$("#div-PreviewStaplezPay").html(n);$(".creditCardInformationTitle").fadeIn(500);Checkout.prototype.HideLoader()}):($("#hdnImpersonateOrderNumber").val()==undefined||$("#hdnImpersonateOrderNumber").val()=="")&&($("input[name='ShippingOptions']:checked").length>0||l=="true")&&(t.prototype.GetStaplesPAYiFrame(),$("#div-StaplesPay").fadeIn(700)),t.prototype.CheckForApprovalRouting()&&($("#singleCheckoutSubmitQuote").fadeIn(100),$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")))):this.IsPaymentStaplesPayACI(v)?($("#authStaplesPayFrame").hide(),$("#resultTarget").show(),this.IsStorePreview(n)&&this.IsByPassStaplesPayActive(s)?CustomEndpoint.prototype.GetCardView(function(n){$("#div-PreviewStaplezPay").html(n);Checkout.prototype.HideLoader();$("input[name='PaymentOptions']:checked").attr("data-iframeloaded","1")}):($("#hdnImpersonateOrderNumber").val()==undefined||$("#hdnImpersonateOrderNumber").val()=="")&&(t.prototype.GetStaplesPAYiFrame(),$("#div-StaplesPay").fadeIn(700))):Checkout.prototype.HideLoader()}else h=parseFloat((e+u).toFixed(2)),this.IsStorePreview(n)&&f>h&&i!=undefined&&i.toLowerCase()=="budget"&&o?this.GetPreviewStaplesPAYACIIframe():!this.IsStorePreview(n)&&f>=parseFloat((e+u).toFixed(2))&&i!=undefined&&i.toLowerCase()=="budget"&&o&&(t.prototype.GetStaplesPAYiFrame(),$("#div-StaplesPay").fadeIn(700)),Checkout.prototype.HideLoader();else Checkout.prototype.HideLoader()},t.prototype.SetValueOfPreviewStaplesPay=function(n){var i=$("#label_"+n).find("#isBypassStaplesPay");i.length>0&&($(i).prop("checked")==!0?$("#hdnIsPreviewStaplesPay").val("true"):$("#hdnIsPreviewStaplesPay").val("false"));$('input[name="PaymentOptions"]:checked').length>0&&($("#div-StaplesPay").hide(),$("#hdnStorePublishState").val()==undefined||$("#hdnStorePublishState").val().toLowerCase()!="preview"||$("input[name=PaymentOptions]:checked").attr("data-payment-type")==undefined||$("input[name=PaymentOptions]:checked").attr("data-payment-type").toLowerCase()=="credit_card"||$("#div-PreviewStaplezPay").html(""),t.prototype.ShowSelectedPaymentArea())},t.prototype.SetValueOfStaplesPay=function(n){var i=$("#isNewCreditCard_"+n);i.length>0&&($(i).prop("checked")==!0?$("#BillingAddressContainer .editCheckboxCreateNewAddress").removeClass("disable_section"):$("#BillingAddressContainer .editCheckboxCreateNewAddress").addClass("disable_section"));$('input[name="PaymentOptions"][data-payment-type="CREDIT_CARD"]:checked').length>0&&(t.prototype.GetStaplesPAYiFrame(),$("#div-StaplesPay").fadeIn(700),$('input[name="PaymentOptions"][data-payment-type="CREDIT_CARD"]:checked').attr("is-old-iframe-used","false"),$('input[name="PaymentOptions"]:checked').length>0&&($("#div-StaplesPay").hide(),$(".creditCardInformationTitle").hide()))},t.prototype.calculateCart=function(n){Checkout.prototype.ShowPaymentLoader();CustomEndpoint.prototype.calculateCart(n,function(n){var t=$("#divShoppingCart");t.empty();CommonHelper.prototype.LoadHtmlByControl(t,n);Checkout.prototype.HidePaymentLoader()})},t.prototype.ValidateBudget=function(){var n=!0;return Endpoint.prototype.GetValidateUserBudget(function(t){t.status||(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(t.message,"error",isFadeOut,fadeOutTime),n=!1)}),n},t.prototype.GetHighRadiusPopup=function(){var n=!1,i=$("input[name='PaymentOptions'][id!='GIFT_CARD']:checked").first().val(),r=$("input[name='ShippingOptions']:checked").val(),u=$("input[name='AccountNumber']").val(),f=$("input[name='ShippingMethod']").val();if($("#shipping-content .address-name").text()==" ")ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredShippingAddress"),"error",!1,0),n=!0;else if($("#billing-content .address-name").text()==" ")ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredBillingAddress"),"error",!1,0),n=!0;else if((r==null||r=="")&&$("#IsNotShippable").val()!="True")ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectShippingOption"),"error",!1,0),n=!0;else if(i==null||i=="")ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectPaymentOption"),"error",!1,0),n=!0;else if($("#customerShippingDiv").is(":visible"))(u==null||f==null||u==""||f=="")&&(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("CustomerShippingError"),"error",!0,5e3),n=!0);else{if(!Checkout.prototype.ShippingErrorMessage())return n=!0,!1;if($("#dynamic-allowesterritories").length>0)return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AllowedTerritories"),"error",!1,0),n=!0,!1;t.prototype.ShowHighRadiusCreditCardPopup(i,r)}n&&($("input[name='PaymentOptions']").prop("checked",!1),Checkout.prototype.HideLoader())},t.prototype.GetStaplesPAYiFrame=function(){var n=$("#hdnStaplesPayACI").val(),u=$("#isOnlyECertCartItems").val().toLowerCase(),r=$("input[name='PaymentOptions'][id!='GIFT_CARD']:checked").first().val(),i=$("input[name='ShippingOptions']:checked").val();(i!=undefined&&i!=""||u=="true")&&(typeof n!=undefined&&n!=null&&n!=""&&n=="true"?t.prototype.ShowStaplesPayACICreditCardiFrame(r,i):t.prototype.ShowStaplesPAYCreditCardiFrame(r,i))},t.prototype.ShowHighRadiusCreditCardPopup=function(){var n,u,r,a;t.prototype.ShowHighRadiusProcessDialog();n="highradiusresponse/receivetoken/?callbackurl=";u=window.location.protocol+"//"+window.location.host+"/customcheckout/processhighradiustoken";n+=encodeURI(u);var i=$("#hdnPaymentCode").val(),v=$("#paymentProfileId").val(),w=$("#billing-content").find("#AddressId").val(),y=$("#hdnCurrencySuffix").val(),f="",e="",p="",o="",s="",h="",c="",l="";if($("#billing-content").find("p").each(function(){$(this).attr("data-address-fname")!=undefined&&(f=$(this).attr("data-address-fname"));$(this).attr("data-address-lname")!=undefined&&(e=$(this).attr("data-address-lname"));$(this).attr("data-address-companyname")!=undefined&&(p=$(this).attr("data-address-companyname"));$(this).attr("data-address-address1")!=undefined&&(o=$(this).attr("data-address-address1"));$(this).attr("data-address-countryname")!=undefined&&(s=$(this).attr("data-address-countryname"));$(this).attr("data-address-cityname")!=undefined&&(h=$(this).attr("data-address-cityname"));$(this).attr("data-address-postalcode")!=undefined&&(c=$(this).attr("data-address-postalcode"));$(this).attr("data-address-statecode")!=undefined&&(l=$(this).attr("data-address-statecode"))}),i!=undefined&&i!="")r=$("#Total").val(),$("#ApplyEcertificate:checked").length>0&&$("#hdnECertAmount").val()!=undefined&&(r=parseFloat($("#Total").val())-parseFloat($("#hdnECertAmount").val().replace(",","."))),a={gateway:"highradius",profileId:v,paymentCode:i,customerGUID:$("#hdnCustomerGUID").val()},CustomEndpoint.prototype.GetCreditCardScript(a,function(i){var u,v,a;if(i!=undefined&&i!=null&&i!=""){if(u=$.parseJSON(i.data),u.HasError)return t.prototype.CloseHighRadiusDialog();v=u.STRING_URL;a=c;a=a.indexOf("-")!==-1?a.substr(0,a.indexOf("-")).slice(0,5):a.slice(0,5);u.STRING_URL="";u.BILL_TO_FIRST_NAME=f;u.BILL_TO_LAST_NAME=e;u.BILL_TO_STREET1=o.slice(0,30);u.BILL_TO_STREET2="";u.BILL_TO_COUNTRY=s;u.BILL_TO_CITY=h;u.BILL_TO_STATE=l;u.BILL_TO_POSTAL_CODE=a;u.PAYMENT_AMOUNT=r;u.POST_BACK_URL+="/"+n;u.REFERENCE_NUMBER="";u.CURRENCY_CODE=y;u.CSS_FILE_NAME="STAPLES";var p=600,w=650,b=screen.width/2-p/2,k=screen.height/2-w/2,d="resizable=yes,scrollbars=yes, width="+p+", height="+w+", top="+k+", left="+b;return t.prototype.OpenHighRadiusWindow(v,d,"newfile",u),!1}return t.prototype.CloseHighRadiusDialog()});else return t.prototype.CloseHighRadiusDialog()},t.prototype.ShowStaplesPAYCreditCardiFrame=function(n,i){var f,e,o;if((i==null||i=="")&&($("#cartFreeShipping").val()!="True"||$("#hdnIsFreeShipping").val()!="True")&&$("#IsNotShippable").val()!="True")return!1;var r=$("#hdnPaymentCode").val(),s=$("#paymentProfileId").val();if($(".creditCardInformationTitle").fadeIn(500),r!=undefined&&r!=""){f=$("#Total").val();$("#ApplyEcertificate:checked").length>0&&$("#hdnECertAmount").val()!=undefined&&(f=parseFloat($("#Total").val())-parseFloat($("#hdnECertAmount").val().replace(",",".")));var h=window.location.host,c=btoa(h),u="publishstate_"+c;u=u.replace(/=/g,"");e=this.getCookie(u);o={gateway:"staplespay",profileId:s,paymentCode:r,customerGUID:$("#hdnCustomerGUID").val(),publishState:e};CustomEndpoint.prototype.GetCreditCardScript(o,function(n){var i=$.parseJSON(n.data);t.prototype.setStaplesPayFields(function(){$("#paymentStaplesPay").attr("action",$.parseJSON(i.STRING_URL));t.prototype.showStaplesPayIFrame("",function(){$("input[name='PaymentOptions']:checked").attr("data-iframeloaded","1");Checkout.prototype.HideLoader()})})})}else return Checkout.prototype.HideLoader(),!1},t.prototype.ShowStaplesPayACICreditCardiFrame=function(n,i){var r,u;if((i==null||i=="")&&($("#cartFreeShipping").val()!="True"||$("#hdnIsFreeShipping").val()!="True")&&$("#IsNotShippable").val()!="True")return!1;if(r=$("#hdnPaymentCode").val(),$(".creditCardInformationTitle").fadeIn(500),r!=undefined&&r!="")u=$("#Total").val(),$("#ApplyEcertificate:checked").length>0&&$("#hdnECertAmount").val()!=undefined&&(u=parseFloat($("#Total").val())-parseFloat($("#hdnECertAmount").val().replace(",","."))),t.prototype.setStaplesPayFields(function(){t.prototype.showStaplesPayACIIFrame("",function(){$("input[name='PaymentOptions']:checked").attr("data-iframeloaded","1");Checkout.prototype.HideLoader()})});else return Checkout.prototype.HideLoader(),!1},t.prototype.removeStaplesACIEventListener=function(){try{window.removeEventListener("message",this.OnStaplesPayACISuccess)}catch(n){}},t.prototype.setStaplesACIEventListener=function(){try{t.prototype.removeStaplesACIEventListener();window.addEventListener("message",this.OnStaplesPayACISuccess)}catch(n){}},t.prototype.OnStaplesPayACISuccess=function(n){var i,r;if(n.data.pmtStatus=="Success"){var u=n.data.paymentResponse.pmtCheckoutId,f=n.data.paymentResponse.resourcePath,e=n.data.paymentResponse.merchantTransactionId;n.data!==null&&(i=n.data,r=t.prototype.setStaplesPayACIValues(i),Checkout.prototype.ShowLoader(),i.cvv=$("#hdnStaplesPayACICvv").val(),i.token={value:u},t.prototype.CheckForApprovalRouting()?t.prototype.SubmitForApproval(r,i):$("#isSelfCheckout").val()=="True"?t.prototype.SubmitCheckOutFormForSelfCheckout(r,i):t.prototype.SubmitCheckOutForm(r,i))}else n.data.pmtStatus=="Failed"?(Checkout.prototype.HideLoader(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper("Incorrect card details! Please try again.","error",isFadeOut,fadeOutTime)})):n.data.pmtStatus=="FieldValidationFailed"?Checkout.prototype.HideLoader():n.data.pmtStatus=="cvv"&&$("#hdnStaplesPayACICvv").val(n.data.pmtCvv)},t.prototype.removeStaplesLegacyEventListener=function(){try{var n=window.addEventListener?"addEventListener":"attachEvent",t=n=="attachEvent"?"onmessage":"message";window.removeEventListener(t,this.continueSubmitOrderStaplesPay,!1)}catch(i){}},t.prototype.setStaplesEventListener=function(){try{t.prototype.removeStaplesLegacyEventListener();var n=window.addEventListener?"addEventListener":"attachEvent",i=window[n],r=n=="attachEvent"?"onmessage":"message";i(r,this.continueSubmitOrderStaplesPay,!1)}catch(u){}},t.prototype.showStaplesPayIFrame=function(n,i){var r=$("#hdnStaplesPayACI").val();typeof r!=undefined&&r!=null&&r!=""&&r=="true"?t.prototype.showStaplesPayACIIFrame(n,i):t.prototype.setStaplesPayGUID(n,function(n){$("#authStaplesPayFrame").attr("src",$("#paymentStaplesPay").attr("action"));t.prototype.setStaplesEventListener();$("input[name='PaymentOptions']:checked, input[name='AdvancedCCPaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase()=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):t.prototype.CheckForApprovalRouting()?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonUpdateOrder")):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder"));i(n)})},t.prototype.GetCurrentLocale=function(){var i=window.location.host,r=btoa(i),n="culture_"+r,t;return n=n.replace(/=/g,""),t=this.getCookie(n),t.substr(0,t.indexOf("-"))},t.prototype.showStaplesPayACIIFrame=function(n,i){t.prototype.setStaplesPayGUID(n,function(n){t.prototype.setStaplesACIEventListener();var r={merchantTransactionId:$("input[name=orderNumber]").val(),merchantId:$("#merchantId").val()};CustomEndpoint.prototype.GetStaplesPayACICheckoutId(r,function(r){var u=document.querySelector("#hdnRequireReloadStaplesPayAciIframe"),s=u&&u.value.trim().length>0?u.value.trim().toLowerCase()==="true":!0,f=document.querySelector("#hdnEnableStaplesPayAciIframePreload"),h=f&&f.value.trim().length>0?f.value.trim().toLowerCase()==="true":!1,e;if(!h||s){e=$.validator.format(r.StaplesPayACIIframeUrl);$("#resultTarget").attr("src",e($("#merchantId").val(),$("#viewId").val(),r.CheckoutId,t.prototype.GetCurrentLocale()));var o=$("#resultTarget").attr("src").split("/"),c=o[0]+"//"+o[2],l=document.getElementById("resultTarget");$("#StaplesPayACIOrderIsInProgress").val()==="false"&&l.contentWindow.postMessage({type:"addCard",merchantTransactionId:$("input[name=orderNumber]").val(),checkoutId:r.CheckoutId},c)}$("input[name='PaymentOptions']:checked, input[name='AdvancedCCPaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase()=="true"&&($("#BillingAccountNumber").val()==undefined||$("#BillingAccountNumber").val()=="")?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):t.prototype.CheckForApprovalRouting()?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonUpdateOrder")):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder"));i(n)})})},t.prototype.setStaplesPayGUID=function(n,i){CustomEndpoint.prototype.GetStaplesPayGUID(function(n){var u=$("#DivisionCC").val()!==undefined?$("#DivisionCC").val():"SPP",r,f;t.prototype.isControlAvailable($("input[name=childGUID]"))&&t.prototype.isControlAvailable(JSON.stringify(n.ChildGUID))&&(r=n.ChildGUID.trim(),$("input[name=childGUID]").val(r.replace(u,$("input[name=div]").val())));t.prototype.isControlAvailable($("input[name=authChildGUID]"))&&t.prototype.isControlAvailable(JSON.stringify(n.AuthChildGUID))&&(r=n.AuthChildGUID.trim(),$("input[name=authChildGUID]").val(r.replace(u,$("input[name=div]").val())));t.prototype.isControlAvailable(f==""&&$("input[name=parentGUID]"))&&t.prototype.isControlAvailable(JSON.stringify(n.ParentGUID))&&(f=n.ParentGUID.trim(),$("input[name=parentGUID]").val(f.replace(u,$("input[name=div]").val())));i(n)})},t.prototype.setStaplesPayFields=function(n){var h=String($("#hdnPaymentCode").val()),e=$("#hdnStaplesPay").val()!=null?String($("#hdnStaplesPay").val()).trim().toLowerCase()==="true":!1,i=document.querySelector("#LINCCompany"),c=i&&i.value.trim().length>0?i.value.trim().toUpperCase():"",r=document.querySelector("#hdnEnableStaplesPayAciIframePreload"),o=r&&r.value.trim().length>0?r.value.trim().toLowerCase()==="true":!1,u=document.querySelector("#hdnIframeLoadedForLincCompanyCode"),l=u&&u.value.trim().length>0?u.value.trim().toUpperCase():"OA",s="",f;if(o){if(f=document.querySelector("input[name='PaymentOptions']:checked"),!f)throw new Error("Unable to get selected payment method radio button");s=f.getAttribute("data-gatewayCode")}CustomEndpoint.prototype.GetStaplesPayWalletConfiguration(h,e,c,!1,function(i){var r=s!=="staplespayaci"||i.LincCompanyCode!==l;Endpoint.prototype.GenerateOrderNumber(parseInt(String($("#portalId").val())),function(u){var c,s,h,f;(!o||r)&&$("input[name=orderNumber]").val(u.orderNumber);t.prototype.isControlAvailable($("input[name=itemCost]"))&&t.prototype.isControlAvailable($("div[data-test-selector=divSubTotalValue]"))&&$("input[name=itemCost]").val($("div[data-test-selector=divSubTotalValue]").html().trim());t.prototype.isControlAvailable($("input[name=tax]"))&&t.prototype.isControlAvailable($("div[data-test-selector=divTaxValue]"))&&$("input[name=tax]").val($("div[data-test-selector=divTaxValue]").html().trim());t.prototype.isControlAvailable($("input[name=shippingChg]"))&&t.prototype.isControlAvailable($("div[data-test-selector=divShippingValue]"))&&$("input[name=shippingChg]").val($("div[data-test-selector=divShippingValue]").html().trim());t.prototype.isControlAvailable($("input[name=amount]"))&&t.prototype.isControlAvailable($("div[data-test-selector=divOrderTotalValue]"))&&$("input[name=amount]").val($("div[data-test-selector=divOrderTotalValue]").html().trim());t.prototype.isControlAvailable($("input[name=itemCount]"))&&t.prototype.isControlAvailable($(".cartProducts").find(".item-variant"))&&$("input[name=itemCount]").val($(".cartProducts").find(".item-variant").length);t.prototype.isControlAvailable($("#fname"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-firstlastname"))&&$("#fname").val($("#billing-content").find(".address-firstlastname").attr("data-address-fname"));t.prototype.isControlAvailable($("#lname"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-firstlastname"))&&$("#lname").val($("#billing-content").find(".address-firstlastname").attr("data-address-lname"));t.prototype.isControlAvailable($("#street"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-street"))&&$("#street").val($("#billing-content").find(".address-street").attr("data-address-address1"));t.prototype.isControlAvailable($("#state"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-citystate"))&&$("#state").val($("#billing-content").find(".address-citystate").attr("data-address-statecode"));t.prototype.isControlAvailable($("#zip"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-citystate"))&&$("#zip").val($("#billing-content").find(".address-citystate").attr("data-address-postalcode"));t.prototype.isControlAvailable($("#email"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-emailaddress"))&&$("#email").val($("#billing-content").find(".address-emailaddress").attr("data-address-emailaddress"));t.prototype.isControlAvailable($("#phone"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-emailaddress"))&&$("#phone").val($("#billing-content").find(".address-phonenumber").attr("data-address-phonenumber"));t.prototype.isControlAvailable($("#city"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-citystate"))&&$("#city").val($("#billing-content").find(".address-citystate").attr("data-address-cityname"));t.prototype.isControlAvailable($("#ctry"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-citystate"))&&$("#ctry").val($("#billing-content").find(".address-citystate").attr("data-address-countryname"));t.prototype.isControlAvailable($("input[name=source]"))&&t.prototype.isControlAvailable(JSON.stringify(i.Source))&&$("input[name=source]").val(i.Source.trim());t.prototype.isControlAvailable($("input[name=noOfAttempts]"))&&t.prototype.isControlAvailable(i.NumberOfAttempts)&&$("input[name=noOfAttempts]").val(i.NumberOfAttempts.trim());t.prototype.isControlAvailable($("input[name=bunit]"))&&t.prototype.isControlAvailable(JSON.stringify(i.BusinessUnit))&&$("input[name=bunit]").val(i.BusinessUnit.trim());t.prototype.isControlAvailable($("input[name=tranID]"))&&(c=t.prototype.getStaplesPayTranId("","","",String($("input[name=orderNumber]").val())),$("input[name=tranID]").val(c));s=document.querySelector("#hdnRequireReloadStaplesPayAciIframe");s&&(s.value=String(r));h=!1;t.prototype.isControlAvailable($("input[name=country]"))&&t.prototype.isControlAvailable($("#billing-content").find(".address-citystate"))&&(f=$("#billing-content").find(".address-citystate").attr("data-address-countryname"),(f===undefined||f==="")&&(f=$("#advancedCCBillingCountryCode").val()),f.toLowerCase()==="us"?$("input[name=country]").val("USA"):f.toLowerCase()==="ca"?$("input[name=country]").val("CAN"):$("input[name=country]").val("USA"));i.LincCompanyCode?i.LincCompanyCode.toLowerCase()==="cn"?(typeof i.DefaultDivisionCAN!=undefined&&i.DefaultDivisionCAN!=null&&i.DefaultDivisionCAN!=""&&i.DefaultDivisionCAN!="N/A"&&t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(i.DefaultDivisionCAN))&&$("input[name=div]").val(i.DefaultDivisionCAN.trim()),h=!0):t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(i.DefaultDivisionUS))&&$("input[name=div]").val(i.DefaultDivisionUS.trim()):t.prototype.isControlAvailable($("input[name=div]"))&&t.prototype.isControlAvailable(JSON.stringify(i.DefaultDivisionUS))&&$("input[name=div]").val(i.DefaultDivisionUS.trim());t.prototype.SetIFrameRequiredDetails(e,h,i);n(i)})})},t.prototype.SetIFrameRequiredDetails=function(n,i,r){t.prototype.IsPaymentStaplesPay(n)?$("#processorValue").val("staplespay"):(i?($("#merchantId").val(r.CanadaMerchantId.trim()),$("#viewId").val(r.CanadaViewId.trim())):($("#merchantId").val(r.USAMerchantId.trim()),$("#viewId").val(r.USAViewId.trim())),$("#processorValue").val(r.ProcessorACI.trim()))},t.prototype.GetCurrentDateTime=function(){var n=new Date,t=("0"+(n.getMonth()+1)).slice(-2),i=("0"+n.getDate()).slice(-2),r=n.getFullYear(),u=("0"+n.getHours()).slice(-2),f=("0"+n.getMinutes()).slice(-2),e=("0"+n.getSeconds()).slice(-2);return t+i+r+u+f+e},t.prototype.getStaplesPayTranId=function(n,t,i,r){var f="",u,e;try{while(n.length<5)n="0"+n;while(t.length<3)t="0"+t;while(i.length<5)i="0"+i;return r=r.replace(/[^0-9]/g,""),u=r,r.length>=10&&(u=r.substring(r.length-10)),e="000000000",f=n+t+i+e+u}catch(o){return f}},t.prototype.insertKountScript=function(){var t=$("#hdnKountDataCollectorUrl").val(),i,n;t==null||t.length<=0||(i=$("#kountDataCollectorScript").length>0,i)||(n=document.createElement("script"),n.type="text/javascript",n.src=t,n.id="kountDataCollectorScript",n.onload=function(){var n=new ka.ClientSDK;n.collectData()},document.body.appendChild(n))},t.prototype.getKountSessionId=function(){return $("#hdnKountSessionId").val()},t.prototype.continueSubmitOrderStaplesPay=function(n){var i,r;n.preventDefault();var f=n.origin||n.originalEvent.origin,u=$("form#paymentStaplesPay").attr("action").split("/"),e=u[0]+"//"+u[2];f!==e||n.data!==null&&$("#StaplesPayOrderIsInProgress").val()==="false"&&t.prototype.isJSON(n.data)&&($("#StaplesPayOrderIsInProgress").val("true"),i=JSON.parse(n.data),i&&i.token&&i.token.tokenType==="PAYMENT_REFERENCE"?(r=t.prototype.setStaplesPayValues(i),Checkout.prototype.ShowLoader(),t.prototype.CheckForApprovalRouting()?t.prototype.SubmitForApproval(r,i):$("#isSelfCheckout").val()=="True"?t.prototype.SubmitCheckOutFormForSelfCheckout(r,i):t.prototype.SubmitCheckOutForm(r,i)):ZnodeNotification.prototype.DisplayNotificationMessagesHelper("Error Incorrect Details! Please try again.","error",isFadeOut,fadeOutTime))},t.prototype.OpenHighRadiusWindow=function(n,t,i,r){var u=document.createElement("form"),e,f;u.setAttribute("method","post");u.setAttribute("action",n);u.setAttribute("target",i);for(e in r)r.hasOwnProperty(e)&&(f=document.createElement("input"),f.type="hidden",f.name=e,f.value=r[e],u.appendChild(f));if(document.body.appendChild(u),ccpopup_window=window.open("",i,t),ccpopup_window==null||typeof ccpopup_window=="undefined")return alert("Please disable your pop-up blocker and try again."),$("input[name='PaymentOptions']").prop("checked",!1),$("#HighRadiusPaymentModal").modal("hide"),!1;cookieHandler.setItem("initiateHighRadiusToken","");timer=setInterval(this.checkHighRadiusStatus,100);u.submit();$("#btnCompleteCheckout").hide();$(".singlecheckoutsubmitpayment").hide()},t.prototype.checkHighRadiusStatus=function(){var r,n,i;cookieHandler.getItem("initiateHighRadiusToken")!=null&&cookieHandler.getItem("initiateHighRadiusToken")!=""&&(ccpopup_window.close(),r=cookieHandler.getItem("initiateHighRadiusToken"),n=JSON.parse(r),clearInterval(timer),i=$("input[name='PaymentOptions']:checked").val(),$("#hdnApprovalRouting").val()!=undefined&&$("#hdnApprovalRouting").val().toLowerCase()=="true"?t.prototype.SubmitQuoteWithHighRadiusToken(n,i):t.prototype.SubmitOrderWithHighRadiusToken(n,i),cookieHandler.setItem("initiateHighRadiusToken",""));ccpopup_window.closed&&(clearInterval(timer),$("#btnCompleteCheckout").show(),$(".singlecheckoutsubmitpayment").show(),$("input[name='PaymentOptions']").prop("checked",!1),$("#HighRadiusPaymentModal").modal("hide"),$("body").remove("#HighRadiusPaymentModal"),cookieHandler.setItem("initiateHighRadiusToken",""))},t.prototype.SubmitOrderWithHighRadiusToken=function(n,i){if(Checkout.prototype.ShowPaymentProcessDialog(),$("#btnCompleteCheckout").show(),$(".singlecheckoutsubmitpayment").show(),n.message.toLowerCase()=="success"){var e=$("input[name='ShippingOptions']:checked").val(),o=$("#AdditionalInstruction").val(),s=$("#shipping-content").find("#AddressId").val(),h=$("#billing-content").find("#AddressId").val(),r=$("#hdnPaymentCode").val(),u={ShippingAddressId:s,BillingAddressId:h,PaymentSettingId:i,ShippingOptionId:e,AdditionalInstruction:o,PaymentCode:r,PaymentToken:n.token,CardDetails:n.carddetails,PaymentType:"high_radius"};u.OrderPaymentList=JSON.stringify(t.prototype.SubmitOrderSetOrderPaymentModel(n,r,""));var f=$("[name='__RequestVerificationToken']").val(),f=$("[name='__RequestVerificationToken']").val();if(i!=null&&parseInt(i)>0&&typeof i!="undefined")$.ajax({type:"POST",url:"/checkout/submitorder",async:!0,data:{__RequestVerificationToken:f,submitOrderViewModel:u},success:function(n){if(n.error!=null&&n.error!=""&&n.error!="undefined")return Checkout.prototype.ClearPaymentAndDisplayMessage(n.error),Checkout.prototype.HidePaymentProcessDialog(),!1;if(n.receiptHTML!=null&&n.receiptHTML!=""&&n.receiptHTML!="undefined")CommonHelper.prototype.LoadHtmlByControl(".cartcount","0"),CommonHelper.prototype.LoadHtmlByControl(".cartAmount",""),t.prototype.ClearCartSubtotal(),Checkout.prototype.HidePaymentProcessDialog(),window.location.href="/checkout/ordercheckoutreceipt?omsorderid="+n.omsOrderId;else return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrderContactAdmin")),Checkout.prototype.HidePaymentProcessDialog(),!1},error:function(){return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrder")),Checkout.prototype.HidePaymentProcessDialog(),!1}});else return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrder")),Checkout.prototype.HidePaymentProcessDialog(),!1}},t.prototype.SubmitQuoteWithHighRadiusToken=function(n,i){if(Checkout.prototype.ShowPaymentProcessDialog(),$("#btnCompleteCheckout").show(),$(".singleCheckoutSubmitQuote").show(),n.message.toLowerCase()=="success"){var u=$("input[name='ShippingOptions']:checked").val(),f=$("#AdditionalInstruction").val(),e=$("#shipping-content").find("#AddressId").val(),o=$("#billing-content").find("#AddressId").val(),s=$("#hdnPaymentCode").val(),r={ShippingAddressId:e,BillingAddressId:o,PaymentSettingId:i,ShippingId:u,AdditionalInstruction:f,PaymentCode:s,PaymentToken:n.token,CardDetails:n.carddetails,PaymentType:"high_radius",OmsOrderState:"PENDING APPROVAL",OldOrderStatus:$("#OrderStatus").val(),QuoteId:$("#QuoteId").val(),IsPendingPayment:!1},h=$("[name='__RequestVerificationToken']").val();if(i!=null&&parseInt(i)>0&&typeof i!="undefined")$.ajax({type:"POST",url:"/user/createquote",async:!0,data:{__RequestVerificationToken:h,submitQuoteViewModel:r},success:function(n){if(n.error!=null&&n.error!=""&&n.error!="undefined")return Checkout.prototype.ClearPaymentAndDisplayMessage(n.error),!1;n.status?(t.prototype.ClearCartSubtotal(),Checkout.prototype.HidePaymentProcessDialog(),Checkout.prototype.ShowLoader(),window.location.href=window.location.protocol+"//"+window.location.host+"/checkout/quotereceipt?quoteid="+n.omsQuoteId+"&ispendingpayment="+r.IsPendingPayment,ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.status?"success":"error",isFadeOut,fadeOutTime)):(Checkout.prototype.HidePaymentProcessDialog(),Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessPayment")))},error:function(){return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrder")),Checkout.prototype.HidePaymentProcessDialog(),!1}});else return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorProcessOrder")),Checkout.prototype.HidePaymentProcessDialog(),!1}},t.prototype.ClearCartSubtotal=function(){var n,t,i,r,f,e,u;if($(".headerSubtotal").length>0){for(n=$(".headerSubtotal").html(),CommonHelper.prototype.LoadHtmlByControl(".headerSubtotal",""),t="",i=0;i<n.length;i++)if(r=n.charAt(i),$.isNumeric(r))break;else t+=r;for(t+="0.",f=n.indexOf("."),e=n.substring(f,n.length),u=1;u<e.length;u++)t+="0";CommonHelper.prototype.LoadHtmlByControl(".headerSubtotal",t)}},t.prototype.ShowHighRadiusProcessDialog=function(){$("body").append("<div class='modal fade' id='HighRadiusPaymentModal' role='dialog'><\/div><\/div>");$("#HighRadiusPaymentModal").modal({backdrop:"static",keyboard:!0,show:!0});$("#HighRadiusPaymentModal").on("click",function(){ccpopup_window!=null&&typeof ccpopup_window!="undefined"&&(ccpopup_window.close(),$("input[name='PaymentOptions'][id!='GIFT_CARD']:checked").first().prop("checked",!1),$("#HighRadiusPaymentModal").modal("hide"),$("body").remove("#HighRadiusPaymentModal"))})},t.prototype.CloseHighRadiusDialog=function(){return Checkout.prototype.ClearPaymentAndDisplayMessage(ZnodeBase.prototype.getResourceByKeyName("ErrorPaymentApplication")),$("input[name='PaymentOptions']").prop("checked",!1),$("#HighRadiusPaymentModal").modal("hide"),$("body").remove("#HighRadiusPaymentModal"),!1},t.prototype.OnShippingAddressSelect=function(n){var r=n.id,i=document.querySelector("input[name='PaymentOptions']:checked").id;Checkout.prototype.ShowLoader();CustomEndpoint.prototype.GetAddressByIdFromAddressService(r,i,function(n){var r=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),u;r&&r!=undefined?(r.toLowerCase()=="credit_card"&&t.prototype.GetStaplesPAYiFrame(),n.view==="display"&&Checkout.prototype.PaymentShippingOptions(i),r.toLowerCase()=="credit_card"&&t.prototype.ShowSelectedPaymentArea()):Checkout.prototype.PaymentShippingOptions(0);n.model!=""&&typeof n.model!="undefined"&&n.model!=null&&(CommonHelper.prototype.LoadHtmlByControl("#shipping-content",n.html),$("#billing-content #OtherAddressId").val(n.otherAddressId),$("#isEnableGiftLog").val()=="True"&&$("#SearchShippingAddressContainer").show(),$(".shipping-address-content .address-details").css("display")=="none"&&$(".shipping-address-content .address-details").fadeIn(400),n.view==="edit"&&(t.prototype.EditAddressSuccess(),u=document.querySelector("#savedaddress"),u&&(u.style.display="none")),t.prototype.EnableShippingSection(!0));Checkout.prototype.HideLoader()})},t.prototype.GetAccountAddress=function(n,i,r,u){var o,e,f;u===void 0&&(u=!0);o=parseInt($("#QuoteId").val());e="";u&&(e=n==="shipping"?$("#shippingAddressExternalId").val():"");f=parseInt($("input[name='PaymentOptions']:checked").attr("id"));isNaN(f)&&(f=0);Checkout.prototype.ShowLoader();CustomEndpoint.prototype.GetAccountAddress(n,0,o,i,r,e,f,function(i){if(typeof n!=undefined&&n!=null&&n!="")if(n=="billing"){if(CommonHelper.prototype.LoadHtmlByControl("#billing-content",i.html),$("#billing-content #AddressId").val(i.otherAddressId),$("#shipping-content #OtherAddressId").val(i.otherAddressId),$("#isOnlyECertCartItems").val()=="true"){var r=$(".billing-address-content .address-firstlastname").attr("data-address-fname"),u=$(".billing-address-content .address-firstlastname").attr("data-address-lname");$(".shipping-address-content .address-firstlastname").attr("data-address-fname",r);$(".shipping-address-content .address-firstlastname").attr("data-address-lname",u)}}else CommonHelper.prototype.LoadHtmlByControl("#shipping-content",i.html),$("#billing-content #OtherAddressId").val(i.otherAddressId),$("#isEnableGiftLog").val()=="True"&&$("#SearchShippingAddressContainer").show();CommonHelper.prototype.ResetAjaxActionLink("#address-popup-content");t.prototype.FocusOnInputFields();t.prototype.EnableDisableKeyEventOnCheckout();Checkout.prototype.HideLoader()})},t.prototype.FocusOnInputFields=function(){$("#address_name:visible").length>0?$("#address_name:visible").trigger("focus"):$("#address_firstname:visible").length>0&&$("#address_firstname:visible").trigger("focus")},t.prototype.GetLoginUserAddress=function(){var n=parseInt($("#QuoteId").val());Endpoint.prototype.GetLoginUserAddress(0,n,function(n){$("#address-popup-content").html(n)})},t.prototype.SetAddressErrorNotificationMessage=function(n){var u,f,i,r;n.status?($("#Edit-Address-content_"+n.addressType+" #AddressError").html(n.error),_RecommendedAddress.prototype.ClickFields(),_RecommendedAddress.prototype.FocusInputFields(),Checkout.prototype.HideLoader(),$("#btnSaveAddress").removeAttr("disabled")):typeof n.error==undefined||n.error==null||n.error==""?(t.prototype.GetAccountAddress(n.addressType,0,0),u=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),u!=undefined||u!=""?(t.prototype.EnableCheckoutPageSections(!0),$("#ShippingAddressContainer").hasClass("disable_section")||(f=$("input[name='PaymentOptions']:checked").attr("id"),Checkout.prototype.ShippingOptions(f))):Checkout.prototype.ToggleBillingAddressBlock(),i=$("#hdnStaplesPay").val(),r=$("#hdnStaplesPayACI").val(),(typeof i!=undefined&&i!=null&&i!=""&&i=="true"||typeof r!=undefined&&r!=null&&r!=""&&r=="true")&&t.prototype.ShowSelectedPaymentArea(),Checkout.prototype.HideLoader()):(User.prototype.HideShowAddressPopUP(),$("#Edit-Address-content_"+n.addressType+" #AddressError").html(n.error),_RecommendedAddress.prototype.ClickFields(),_RecommendedAddress.prototype.FocusInputFields(),Checkout.prototype.HideLoader(),$("#btnSaveAddress").removeAttr("disabled"))},t.prototype.EditAddressSuccess=function(){$("#IsBillingAddressOptional").val()=="true"?$("#same-as-billing").hide():$("#same-as-billing").show();$("form").removeData("validator");$("form").removeData("unobtrusiveValidation");$.validator.unobtrusive.parse("form");$("#IsDefaultShipping").length>0&&$("#IsDefaultShipping").rules("remove");$("#IsDefaultBilling").length>0&&$("#IsDefaultBilling").rules("remove");($("#Edit-Address-content_billing")!=undefined&&$("#Edit-Address-content_billing").length>0||$("#Edit-Address-content_shipping")!=undefined&&$("#Edit-Address-content_shipping").length>0)&&t.prototype.DisableCheckoutPageSections();var n=$("#btnCancelAddressId")!=undefined&&$("#btnCancelAddressId").attr("data-addressType")=="shipping";$("#isEnableGiftLog").length>0&&$("#isEnableGiftLog").val().toLowerCase()=="true"&&n&&$("#SearchShippingAddressContainer").hide();t.prototype.EnableDisableKeyEventOnCheckout()},t.prototype.DisableCheckoutPageSections=function(){$("#allPaymentOptionsDiv").hasClass("disable_section")||$("#allPaymentOptionsDiv").addClass("disable_section");$("#Apply-eCertificate").hasClass("disable_section")||$("#Apply-eCertificate").addClass("disable_section");!$("#BillingAddressContainer").hasClass("disable_section")&&$("#Edit-Address-content_shipping").length>0&&!$("#Apply-eCertificate").hasClass("disable_section")&&$("#BillingAddressContainer").addClass("disable_section");$("#AddressError :visible")!=undefined&&$("#AddressError").text()!=""&&$("#BillingAddressContainer").removeClass("disable_section");$("#ShippingAddressContainer").find("#btnSaveAddress").length>0&&!$("#BillingAddressContainer").hasClass("disable_section")&&!$("#Apply-eCertificate").hasClass("disable_section")&&$("#BillingAddressContainer").addClass("disable_section");t.prototype.DisableShippingSection()},t.prototype.EnableCheckoutPageSections=function(n){$("#allPaymentOptionsDiv").hasClass("disable_section")&&$("#allPaymentOptionsDiv").removeClass("disable_section");$("#Apply-eCertificate").hasClass("disable_section")&&$("#Apply-eCertificate").removeClass("disable_section");$("#BillingAddressContainer").hasClass("disable_section")&&$("#BillingAddressContainer").removeClass("disable_section");$("#billing-content .address-details").attr("style")==null||$("#billing-content .address-details").attr("style")==undefined||$("#billing-content .address-details").attr("style").replace(" ","")=="display:none;"?$("#IsBillingAddressOptional").val()=="true"&&t.prototype.EnableShippingSection(n):t.prototype.EnableShippingSection(n);t.prototype.EnableDisableKeyEventOnCheckout()},t.prototype.EnableShippingSection=function(n){$("#ShippingAddressContainer").hasClass("disable_section")&&$("#ShippingAddressContainer").removeClass("disable_section");$("#shipping-content .address-details").length>0&&$("#shipping-content .address-details").attr("style")!=null&&$("#shipping-content .address-details").attr("style")!=undefined&&!($("#shipping-content .address-details").attr("style").replace(" ","")=="display:none;")?($(".shipping-method").hasClass("disable_section")&&$(".shipping-method").removeClass("disable_section"),$("#data-capture-content").hasClass("disable_section")&&$("input[name=ShippingOptions]:checked").length>0&&$("#data-capture-content").removeClass("disable_section"),$(".creditCardInformationTitle").hasClass("disable_section")&&$(".creditCardInformationTitle").removeClass("disable_section"),$("#div-StaplesPay").hasClass("disable_section")&&$("#div-StaplesPay").removeClass("disable_section"),$(".checkoutButton").hasClass("disable_section")&&$(".checkoutButton").removeClass("disable_section")):$("#ShippingAddressContainer").length<1&&($("#billing-content .address-details").attr("style")!=null&&$("#billing-content .address-details").attr("style")!=undefined&&$("#billing-content .address-details").attr("style").replace(" ","")!="display:none;"||$("#IsBillingAddressOptional").val()=="true")&&($("#data-capture-content").removeClass("disable_section"),$("#div-StaplesPay").removeClass("disable_section"),$(".creditCardInformationTitle").removeClass("disable_section"),$(".checkoutButton").removeClass("disable_section"));$("#BillingAddressContainer").find("#Edit-Address-content_billing").length>0&&$("#ShippingAddressContainer").addClass("disable_section");n&&_RecommendedAddress.prototype.ClickOptionFields();t.prototype.EnableDisableKeyEventOnCheckout()},t.prototype.DisableShippingSection=function(){(!$("#ShippingAddressContainer").hasClass("disable_section")&&$("#Edit-Address-content_billing").length>0||$("#billing-content .address-details").attr("style")!=null&&$("#billing-content .address-details").attr("style")!=undefined&&$("#billing-content .address-details").attr("style").replace(" ","")=="display:none;"&&$("#IsBillingAddressOptional").val()=="false")&&$("#ShippingAddressContainer").addClass("disable_section");t.prototype.DisableShippingMethodsAndCheckout()},t.prototype.DisableShippingMethodsAndCheckout=function(){$(".shipping-method").hasClass("disable_section")||$(".shipping-method").addClass("disable_section");$("#data-capture-content").hasClass("disable_section")||$("#data-capture-content").addClass("disable_section");$(".creditCardInformationTitle").hasClass("disable_section")||$(".creditCardInformationTitle").addClass("disable_section");$("#div-StaplesPay").hasClass("disable_section")||$("#div-StaplesPay").addClass("disable_section");$(".checkoutButton").hasClass("disable_section")||$(".checkoutButton").addClass("disable_section");$("#ShippingAddressContainer").hasClass("disable_section")&&$("#Edit-Address-content_shipping").length>0&&!$("#BillingAddressContainer").hasClass("disable_section")&&$("#ShippingAddressContainer").removeClass("disable_section")},t.prototype.GetBillingAddress=function(){var n=parseInt($("#billing-content #AddressId").val()),t;isNaN(n)&&(n=0);t=$("#Edit-Address-content_shipping #IsBothBillingShipping").prop("checked");CustomEndpoint.prototype.GetBillingAddress(n,"shipping",t,function(n){n.status?(CommonHelper.prototype.LoadHtmlById("#Edit-Address-content_shipping",n.html),$("#formChange").val("true")):$("#AddressError").html(n.message)})},t.prototype.isJSON=function(n){try{return JSON.parse(n),!0}catch(t){return!1}},t.prototype.cleanStaplesPayiFrameInfo=function(){$("#paymentStaplesPay").attr("action","");$("#authStaplesPayFrame").attr("src","");$("#resultTarget").attr("src","");$("#div-StaplesPay").fadeOut(700)},t.prototype.setStaplesPayValues=function(n){var i=n.expiry.split("/"),t=new StaplesPayTransactionData;return t.LastFourCreditCardDigits=n.lastFour,t.creditCardType=n.cardBrand,t.PaymentReferenceToken=n.token.value,t.CreditCardExpMonth=i[0],t.CreditCardExpYear=i[1],t},t.prototype.setStaplesPayACIValues=function(n){var t=new StaplesPayTransactionData;return t.LastFourCreditCardDigits=0,t.creditCardType="",t.PaymentReferenceToken=n.paymentResponse.pmtCheckoutId,t.CreditCardExpMonth="00",t.CreditCardExpYear="00",t},t.prototype.isControlAvailable=function(n){var i=t.prototype.isJSON(n);return i?i:$(n).length>0},t.prototype.updateBillingAddressForApplePay=function(n){var r,e,f;if(n!=null&&n.Custom5!=null&&!(n.Custom5.trim().length<1)){r=null;try{r=JSON.parse(n.Custom5)}catch(o){console.error(o);return}if(r!=null&&r.applePay!=null&&r.applePay.billingAddress!=null&&r.applePay.billingAddress.addressLines!=null&&!(r.applePay.billingAddress.addressLines.length<1)){var i=r.applePay.billingAddress,s=i.addressLines.length>1?i.addressLines.map(function(n){return n}).splice(1).join(" "):null,h={FirstName:i.givenName,LastName:i.familyName,Address1:i.addressLines[0],Address2:s,CountryName:i.countryCode,CountryCode:i.countryCode,StateName:i.administrativeArea,CityName:i.locality,PostalCode:i.postalCode,DontAddUpdateAddress:!0,IsBilling:!0},u=null;($.ajax({url:"/SppQuickCheckout/GetCrsfToken",type:"GET",async:!1,success:function(n){u=n},error:function(n){console.error(n)}}),u==null||u.trim().length<1)||(e=__assign(__assign({},h),{__RequestVerificationToken:u,formChange:!1,addressType:"billing"}),f=t.prototype.CreateForm(e),$.ajax({url:"/CustomCheckout/UpdateAddress",type:"POST",data:$(f).serialize(),async:!1,success:function(n){console.log(n)},error:function(n){console.error(n)},complete:function(){f.remove()}}))}}},t.prototype.removeApplePayButton=function(){var n=document.querySelector("#applePayAciScript");n!=null&&document.body.removeChild(n);$("#applePayWrapper").html("")},t.prototype.generateApplePayButton=function(){var i=t.prototype.GetCurrentDateTime(),r=t.prototype.getOveragePaymentMethodAmount(),n;r<=0||(n={merchantId:$("#applePayMerchantId").val(),transId:i,amount:r,currency:$("#GatewayCurrencyCode").val(),paymentType:"PA",merchantTransactionId:i},CustomEndpoint.prototype.GetApplePayCheckoutId(n,function(t){var i,u,f,r;if(t.HasError){console.error("ApplePay GetCheckoutId response has error",n,t);ZnodeNotification.prototype.DisplayNotificationMessagesHelper(t.ErrorMessage,"error",isFadeOut,fadeOutTime);return}if(t.Id==null||t.Id.trim().length===0){console.error("No CheckoutID generated",n,t);ZnodeNotification.prototype.DisplayNotificationMessagesHelper("No ApplePay CheckoutID generated","error",isFadeOut,fadeOutTime);return}$("#applePayCheckoutId").val(t.Id);$("#applePayMerchantTransactionId").val(n.merchantTransactionId);$("#applePayTransId").val(n.transId);$("#processorValue").val("applepay");i=document.createElement("form");i.setAttribute("data-brands","APPLEPAY");i.setAttribute("action","/Checkout/ProcessOrder");i.classList.add("paymentWidgets");u=document.querySelector("#applePayWrapper");u.appendChild(i);f=t.ApplePayButtonScript+t.Id;r=document.createElement("script");r.setAttribute("id","applePayAciScript");r.src=f;document.body.appendChild(r)}))},t.prototype.saveCheckoutInfoForApplePay=function(n){var i,u,f;try{Checkout.prototype.ShowLoader();i={};t.prototype.SetOrderFormData(i);i.OrderNumber=$("input[name=orderNumber]").val();i.TransactionId=$("#applePayCheckoutId").val();u={parentGUID:$("input[name=parentGUID]").val(),childGUID:$("input[name=childGUID]").val(),authChildGUID:$("input[name=authChildGUID]").val(),div:$("#DivisionCC").val()!=null?$("#DivisionCC").val():$("input[name=div]").val(),bunit:$("input[name=bunit]").val(),orderNumber:$("input[name=orderNumber]").val(),tranID:$("input[name=tranID]").val(),source:$("input[name=source]").val(),version:$("input[name=version]").val(),country:$("input[name=country]").val(),noOfAttempts:$("input[name=noOfAttempts]").val(),Processor:$("#processorValue").val(),applePay:{checkoutId:$("#applePayCheckoutId").val(),merchantId:$("#merchantId").val(),transId:$("#applePayTransId").val(),merchantTransactionId:$("#applePayMerchantTransactionId").val(),billingAddress:n!=null&&n.billingContact!=null?n.billingContact:null}};i.Custom5=JSON.stringify(u);i.PaymentCode=$("#hdnGatwayName").val();i.Custom1=$("input[name='PaymentOptions']:checked").attr("is-old-iframe-used");var e=window.location.host,o=btoa(e),r="publishstate_"+o;return r=r.replace(/=/g,""),i.WebstorePublishState=this.getCookie(r),f=JSON.stringify(i),sessionStorage.setItem("SubmitOrderModel",f),{hasError:!1,errorMessage:""}}catch(s){return{hasError:!0,errorMessage:s}}},t.prototype.processSubmitCheckOutFormForApplePayResponse=function(n){if(!n.hasError){window.location.href="/checkout/ordercheckoutreceipt";return}console.error(n.errorMessage);localStorage.setItem("checkoutError",n.errorMessage);window.location.href=document.referrer},t.prototype.submitCheckOutFormForApplePay=function(n){var r=null,u,i;return $.ajax({url:"/SppQuickCheckout/GetCrsfToken",type:"GET",async:!1,success:function(n){r=n},error:function(n){console.error(n)}}),u=__assign(__assign({},n),{__RequestVerificationToken:r}),i=Checkout.prototype.CreateForm(u),$.ajax({url:$(i).attr("action"),type:"POST",data:$(i).serialize(),success:function(n){if(n.error!=null&&n.error!=""&&n.error!="undefined"){var i=Checkout.prototype.GetPaymentErrorMsg(n);t.prototype.processSubmitCheckOutFormForApplePayResponse({hasError:!0,errorMessage:i})}else n.receiptHTML!=null&&n.receiptHTML!=""&&n.receiptHTML!="undefined"?t.prototype.processSubmitCheckOutFormForApplePayResponse({hasError:!1,errorMessage:null}):(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime),t.prototype.processSubmitCheckOutFormForApplePayResponse({hasError:!0,errorMessage:ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay")}))},error:function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime);t.prototype.processSubmitCheckOutFormForApplePayResponse({hasError:!0,errorMessage:ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay")})},complete:function(){i.remove()}})},t.prototype.SubmitCheckOutForm=function(n,i){var r,e,u;Checkout.prototype.ShowLoader();r={};this.IsSolutionDesignCC()?this.SetAdvancedCCOrderFormData(r):t.prototype.SetOrderFormData(r);r.creditCardType=n.creditCardType;r.LastFourCreditCardDigits=n.LastFourCreditCardDigits;r.StaplesPayIsLosNumber=n.StaplesPayIsLosNumber;r.AuthorizationExpirationDate=n.AuthorizationExpirationDate;r.StaplesPayAuthorizationGuid=n.StaplesPayAuthorizationGuid;r.TransactionId=n.PaymentReferenceToken;r.AuthorizationToken=n.AuthorizationToken;r.OrderNumber=$("input[name=orderNumber]").val();r.CardType=n.creditCardType;r.CreditCardExpMonth=n.CreditCardExpMonth;r.CreditCardExpYear=n.CreditCardExpYear;r.CreditCardNumber=n.LastFourCreditCardDigits;e={parentGUID:$("input[name=parentGUID]").val(),childGUID:$("input[name=childGUID]").val(),authChildGUID:$("input[name=authChildGUID]").val(),div:$("#DivisionCC").val()!==undefined?$("#DivisionCC").val():$("input[name=div]").val(),bunit:$("input[name=bunit]").val(),AuthorizationCode:n.AuthorizationToken,AuthExpiryDate:n.AuthorizationExpirationDate,orderNumber:$("input[name=orderNumber]").val(),tranID:$("input[name=tranID]").val(),source:$("input[name=source]").val(),version:$("input[name=version]").val(),country:$("input[name=country]").val(),noOfAttempts:$("input[name=noOfAttempts]").val(),addCardResponse:i,Processor:$("#processorValue").val()};r.Custom5=JSON.stringify(e);r.PaymentCode=$("#hdnGatwayName").val();r.Custom1=$("input[name='PaymentOptions']:checked").attr("is-old-iframe-used");var o=window.location.host,s=btoa(o),f="publishstate_"+s;f=f.replace(/=/g,"");r.WebstorePublishState=this.getCookie(f);u=this.IsSolutionDesignCC()?this.CreateForm(r):Checkout.prototype.CreateForm(r);$("#StaplesPayOrderIsInProgress").val("true");$("#StaplesPayACIOrderIsInProgress").val("true");$.ajax({url:$(u).attr("action"),type:"POST",data:$(u).serialize(),success:function(n){var r,i;if($("#StaplesPayOrderIsInProgress").val("false"),$("#StaplesPayACIOrderIsInProgress").val("false"),Checkout.prototype.isPayMentInProcess=!1,n.error!=null&&n.error!=""&&n.error!="undefined")return r=Checkout.prototype.GetPaymentErrorMsg(n),Checkout.prototype.HideLoader(),i=document.querySelector("#hdnRequireReloadStaplesPayAciIframe"),i&&(i.value="true"),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(r,"error",isFadeOut,fadeOutTime)}),!1;if(n.receiptHTML!=null&&n.receiptHTML!=""&&n.receiptHTML!="undefined")t.prototype.CleanIframeAndLoadReceipt();else if(n.status!=null&&n.status!=""&&n.status!="undefined")window.location.href="/advancedcccheckout/success";else if($("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""&&n!=null&&n!=""&&n!="undefined")t.prototype.CleanIframeAndLoadReceipt();else return Checkout.prototype.HideLoader(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime)}),!1;u.remove();Checkout.prototype.HideLoader()},error:function(){return Checkout.prototype.HideLoader(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime)}),$("#StaplesPayOrderIsInProgress").val("false"),$("#StaplesPayACIOrderIsInProgress").val("false"),!1}})},t.prototype.IsSolutionDesignCC=function(){var n=$("#IsSolutionDesignCC").val();return n!=undefined&&n!=null&&n!=""&&n=="True"},t.prototype.CreateForm=function(n){var t=$("<form/><\/form>");return t.attr("action","/advancedcccheckout/advancedccsubmitOrder"),t.attr("method","POST"),t.attr("style","display:none;"),t.attr("enctype","multipart/form-data"),Checkout.prototype.AddFormFields(t,n),$("body").append(t),t},t.prototype.CleanIframeAndLoadReceipt=function(){t.prototype.cleanStaplesPayiFrameInfo();Checkout.prototype.CanclePayment();$(this).scrollTop(0);$("body, html").animate({scrollTop:0},"fast");$(".cartcount").html("0");$("#messageBoxContainerId").hide();$(".cartAmount").html("");window.location.href="/checkout/ordercheckoutreceipt"},t.prototype.ApplyECertificate=function(){var i=Checkout.prototype.GetEditQuoteId(),n=$("#ApplyEcertificate").prop("checked"),r;Checkout.prototype.ShowLoader();i==0&&DataCapture.prototype.CreateDataCaptureControl("checkout",0);r=t.prototype.CheckIsTaxExempt();CustomEndpoint.prototype.ApplyECertificate(n,t.prototype.GetECertificateAmountToBeApplied(n),r,i,!0,function(r){$("#summary-details").html("");CommonHelper.prototype.LoadHtmlByControl("#summary-details",r.html);t.prototype.PaymentSummaryBlockCustomization(null);t.prototype.UpdateBudgetOverageAmount();CustomEndpoint.prototype.LoadECertOveragePaymentMethods(i,function(i){var r=$('input[name="PaymentOptions"]:checked').attr("id"),o=parseInt($("input[name='PaymentOptions']:checked").attr("data-selectedId")),e=$("input[name='PaymentOptions']:checked").attr("data-iframeloaded"),u=!1,f="";$('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+r).length==1&&(u=$("input#chkUseOveragePaymentForBudget_"+r).prop("checked"),u&&(f=$("select#budgetOveragePaymentMethods_"+r+" option:selected").val()));$("#allPaymentOptionsDiv").html("");CommonHelper.prototype.LoadHtmlByControl("#allPaymentOptionsDiv",i.html);$("#PaymentSummary").addClass("hide");r!=undefined&&r!=null&&r!=""?($('input[name="PaymentOptions"][id="'+r+'"]').attr("checked",!0),$('input[name="PaymentOptions"]').attr("data-selectedId",o),e!=undefined&&$("input[name='PaymentOptions']:checked").attr("data-iframeloaded",e),$('input[name="PaymentOptions"]:checked').length>0?(t.prototype.ShowPaymentOptions($('input[name="PaymentOptions"]:checked')[0]),t.prototype.ShowHideOverageShippingMessage(),t.prototype.ValidatePaymentAmountsWithOrderTotal(),u!=undefined&&u!=null&&f!=undefined&&f!=null&&($("input#chkUseOveragePaymentForBudget_"+r).prop("checked",u),$("select#budgetOveragePaymentMethods_"+r+' option[value="'+f+'"]').prop("selected",!0),t.prototype.ShowHideBudgetOveragePaymentMethods())):Checkout.prototype.ShippingOptions($("#hdnEcertPaymentSettingId").val())):(Checkout.prototype.ShippingOptions($("#hdnEcertPaymentSettingId").val()),t.prototype.ShowHideOverageShippingMessage(),t.prototype.PaymentSummaryBlockCustomization(null));t.prototype.CustomChangeSubmitOrderButtonText();t.prototype.CustomDisablePaymentOptions();Endpoint.prototype.GetPaymentDetails($("#hdnEcertPaymentSettingId").val(),!1,function(t){$("#IsBillingAddressOptional").length==0&&$("#BillingAddressContainer").append("<input type='hidden' value='false' id='IsBillingAddressOptional' />");$("#IsBillingAddressOptional").val(n&&t.IsBillingAddressOptional);Checkout.prototype.ToggleBillingAddressBlock()});Checkout.prototype.HideLoader()});n&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()&&(parseInt($("#QuoteId").val())>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")))})},t.prototype.CustomDisablePaymentOptions=function(){var r=Checkout.prototype.GetEditQuoteId(),n,i;$('input[name="PaymentOptions"]:checked').attr("id")!=undefined&&(dataCapturePaymentOptionId=$('input[name="PaymentOptions"]:checked').attr("id"));Checkout.prototype.DisablePaymentOnZeroOrderTotal();$("#hdnQuoteId").val()>0&&($("input[name='ApplyEcert']").closest("div").parent("div").addClass("read-only"),n=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),n!=undefined&&n!=null&&n!=""&&n.toLowerCase()!="cod"&&$("#editCheckboxShippingOptions").addClass("read-only"));i=$("#ApplyEcertificate").prop("checked");i&&parseFloat($("#Total").val())<=parseFloat($("#hdnEcertAvailableTotal").val())?($("input[name='PaymentOptions']").parent("div").addClass("read-only"),$("#editCheckboxShippingOptions").addClass("read-only"),$("#div-StaplesPay, .creditCardInformationTitle").hide(),i&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()?parseInt($("#QuoteId").val())>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonPlaceOrder")).show(),$("input[name='PaymentOptions']").prop("checked",!1),t.prototype.HideOverageCheckboxSection(),dataCaptureHtmlElement=$("#data-capture-content").html(),$("#PaymentSummary").addClass("hide")):parseFloat($("#Total").val())>parseFloat($("#hdnEcertAvailableTotal").val())&&$("#data-capture-content").html().trim()==""&&dataCaptureHtmlElement!=""&&($("#"+dataCapturePaymentOptionId).prop("checked",!0),dataCaptureHtmlElement="",dataCapturePaymentOptionId="");$('input[name="PaymentOptions"]:checked')&&!$("input[name='ShippingOptions']:checked")&&r==0&&DataCapture.prototype.CreateDataCaptureControl("checkout",0)},t.prototype.SubmitOrderForSelfCheckout=function(){var t,i,r,u,f,e;if($("#postal-errorMsg").html(""),t=$("#BillingPostalCode").val(),t==""||t==null||t==undefined)return i=ZnodeBase.prototype.getResourceByKeyName("ZipCodeError"),$("#postal-errorMsg").html(i),!1;if(!this.ValidatePostalCode(t))return i=ZnodeBase.prototype.getResourceByKeyName("RequiredNumericValue"),$("#postal-errorMsg").html(i),!1;Checkout.prototype.ShowLoader();Checkout.prototype.isPayMentInProcess=!0;var s=$("#PaymentOptionId").val(),h=Checkout.prototype.GetPaymentType(s),l=$("#PaymentSettingId").val(),n=ZnodeBase.prototype.GetParameterValues("mode");if(n==undefined&&(n=""),n=n!=""?n.replace("#",""):n,h!=undefined)if(r=$("#hdnStaplesPay").val(),u=$("#hdnStaplesPayACI").val(),typeof r!=undefined&&r!=null&&r!=""&&r=="true")f=document.getElementById("authStaplesPayFrame"),f?(e=parseInt($("input[name=noOfAttempts]").val()),e>0?(e=e-1,$("input[name=noOfAttempts]").val(e),Checkout.prototype.HideLoader(),f.contentWindow.postMessage("OrderReady","*")):(Checkout.prototype.ClearPaymentAndDisplayMessage("We're sorry, your credit-card information was rejected too many times. Please check with your card issuer and try again later."),this.GetPaymentDetailsForSelfCheckout(),Checkout.prototype.HideLoader())):(Checkout.prototype.ClearPaymentAndDisplayMessage("Staples Pay not available"),this.GetPaymentDetailsForSelfCheckout(),Checkout.prototype.HideLoader());else if(typeof u!=undefined&&u!=null&&u!=""&&u=="true"){var f=document.getElementById("resultTarget"),o=$("#resultTarget").attr("src").split("/"),c=o[0]+"//"+o[2];$("#StaplesPayACIOrderIsInProgress").val()==="false"&&f.contentWindow.postMessage({type:"placeOrder",merchantTransactionId:$("input[name=orderNumber]").val()},c)}},t.prototype.GetPaymentDetailsForSelfCheckout=function(){Checkout.prototype.ShowLoader();CustomEndpoint.prototype.GetPaymentSettings(function(n){if(n!=null){$("#PaymentSettingId").val(n.Value);$("#PaymentOptionId").val(n.Id);var i=$("input[name='ShippingOptions']:checked").val();Endpoint.prototype.GetPaymentDetails($("#PaymentSettingId").val(),!0,function(n){n.GatewayCode.toLowerCase()=="staplespay"?(Checkout.prototype.SetPaymentDetails(n),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),t.prototype.ShowStaplesPAYCreditCardiFrameForSelfCheckout()):n.GatewayCode.toLowerCase()=="staplespayaci"&&(Checkout.prototype.SetPaymentDetails(n),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("true"),t.prototype.ShowStaplesPayACICreditCardiFrame($("#PaymentSettingId").val(),i))})}})},t.prototype.ShowStaplesPAYCreditCardiFrameForSelfCheckout=function(){var n=$("#hdnPaymentCode").val(),f=$("#paymentProfileId").val(),r,u;if(n!=undefined&&n!=""){var s=$("#Total").val(),e=window.location.host,o=btoa(e),i="publishstate_"+o;i=i.replace(/=/g,"");r=this.getCookie(i);u={gateway:"staplespay",profileId:f,paymentCode:n,customerGUID:$("#hdnCustomerGUID").val(),publishState:r};CustomEndpoint.prototype.GetCreditCardScript(u,function(n){var i=$.parseJSON(n.data);t.prototype.setStaplesPayFields(function(){$("#paymentStaplesPay").attr("action",$.parseJSON(i.STRING_URL));t.prototype.showStaplesPayIFrame("",function(){Checkout.prototype.HideLoader();$("#btnCompleteCheckout").removeAttr("disabled")})})})}else return Checkout.prototype.HideLoader(),!1},t.prototype.SubmitCheckOutFormForSelfCheckout=function(n,i){var r,f,u;Checkout.prototype.ShowLoader();r={};t.prototype.SetOrderFormDataForSelfCheckout(r);r.creditCardType=n.creditCardType;r.LastFourCreditCardDigits=n.LastFourCreditCardDigits;r.StaplesPayIsLosNumber=n.StaplesPayIsLosNumber;r.AuthorizationExpirationDate=n.AuthorizationExpirationDate;r.StaplesPayAuthorizationGuid=n.StaplesPayAuthorizationGuid;r.TransactionId=n.PaymentReferenceToken;r.AuthorizationToken=n.AuthorizationToken;r.OrderNumber=$("input[name=orderNumber]").val();r.CardType=n.creditCardType;r.CreditCardExpMonth=n.CreditCardExpMonth;r.CreditCardExpYear=n.CreditCardExpYear;r.CreditCardNumber=n.LastFourCreditCardDigits;f={parentGUID:$("input[name=parentGUID]").val(),childGUID:$("input[name=childGUID]").val(),authChildGUID:$("input[name=authChildGUID]").val(),div:$("#DivisionCC").val()!==undefined?$("#DivisionCC").val():$("input[name=div]").val(),bunit:$("input[name=bunit]").val(),AuthorizationCode:n.AuthorizationToken,AuthExpiryDate:n.AuthorizationExpirationDate,orderNumber:$("input[name=orderNumber]").val(),tranID:$("input[name=tranID]").val(),source:$("input[name=source]").val(),version:$("input[name=version]").val(),country:$("input[name=country]").val(),noOfAttempts:$("input[name=noOfAttempts]").val(),addCardResponse:i,Processor:$("#processorValue").val()};r.Custom5=JSON.stringify(f);r.PaymentCode=$("#hdnGatwayName").val();r.BillingPostalCode=$("#BillingPostalCode").val();u=Checkout.prototype.CreateForm(r);$.ajax({url:$(u).attr("action"),type:"POST",data:$(u).serialize(),success:function(n){if(Checkout.prototype.isPayMentInProcess=!1,n.error!=null&&n.error!=""&&n.error!="undefined"){var i=Checkout.prototype.GetPaymentErrorMsg(n);return t.prototype.GetPaymentDetailsForSelfCheckout(),Checkout.prototype.HideLoader(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(i,"error",isFadeOut,fadeOutTime)}),!1}if(n.receiptHTML!=null&&n.receiptHTML!=""&&n.receiptHTML!="undefined")Checkout.prototype.CanclePayment(),$(this).scrollTop(0),$("body, html").animate({scrollTop:0},"fast"),$(".cartcount").html("0"),$("#messageBoxContainerId").hide(),$(".cartAmount").html(""),window.location.href="/checkout/ordercheckoutreceipt";else return t.prototype.GetPaymentDetailsForSelfCheckout(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime)}),!1;u.remove();Checkout.prototype.HideLoader();window.location.href="/checkout/ordercheckoutreceipt"},error:function(){return t.prototype.GetPaymentDetailsForSelfCheckout(),Checkout.prototype.HideLoader(),t.prototype.showStaplesPayIFrame($("input[name=parentGUID]").val(),function(){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorStaplesPay"),"error",isFadeOut,fadeOutTime)}),!1}})},t.prototype.SetOrderFormDataForSelfCheckout=function(n){n.ShippingOptionId=$("#ShippingOptionId").val();n.PaymentSettingId=$("#PaymentSettingId").val();n.ShippingMethod="P"},t.prototype.SetOrderFormData=function(n){Checkout.prototype.SetOrderFormData(n);n.KountSessionId=t.prototype.getKountSessionId();n.JavascriptIpAddress=$("#hdnJavascriptIpAddress").val();$("#ApplyEcertificate").prop("checked")&&!n.PaymentSettingId&&(n.PaymentSettingId=$("#hdnGiftCardPaymentSettingId").val());($("#hdnImpersonateOrderNumber").val()!=undefined||$("#hdnImpersonateOrderNumber").val()!=""||$("#hdnImpersonateOrderNumber").val()!=null)&&(n.PaymentCode=$("#hdnGatwayName").val(),n.Custom1=$("input[name='PaymentOptions']:checked").attr("is-old-iframe-used"))},t.prototype.SetAdvancedCCOrderFormData=function(n){var t=null,i=$("input[name='AdvancedCCPaymentOptions']:checked");t=i.length>1?$("input[name='AdvancedCCPaymentOptions']:checked").filter(function(){return $(this).attr("data-payment-type").toLowerCase()!="gift_card"}):i;n.__RequestVerificationToken=$("input[name=__RequestVerificationToken]").val();n.PaymentSettingId=t.val();var r=$("#address_firstname").val(),u=$("#address_lastname").val(),f=$("#CompanyName").val(),e=$("#address_street1").val(),o=$("#address_street2").val(),s=$("#billingaddress-countrymodel").val(),h=$("#txtStateCode").val(),c=$("#address_city").val(),l=$("#address_postalcode").val(),a=$("#address_phoneno").val(),v=$("#address_emailaddress").val();n.QuoteId=parseInt($("#QuoteId").val());n.BillingFirstName=r;n.BillingLastName=u;n.BillingCompanyName=f;n.BillingAddress1=e;n.BillingAddress2=o;n.BillingCountry=s;n.BillingState=h;n.BillingCity=c;n.BillingPostalCode=l;n.BillingPhoneNumber=a;n.BillingEmailAddress=v;n.ShippingCost=$("#ShippingCost").val();n.TaxCost=$("#TaxCost").val();n.SubTotal=$("#SubTotal").val();n.Total=$("#Total").val();n.LincCompanyCode=$("#LINCCompany").val();n.DivisionCode=$("#DivisionCC").val()},t.prototype.ValidatePostalCode=function(n){return/^[0-9\s]*$/.test(n)},t.prototype.CheckDiscountCodeValue=function(n){var t,i;if($("#Apply_coupon").removeClass("d-none"),$("#promocode").removeAttr("style"),t="",n=="coupon"){if(t=$("#promocode").val(),t==null||t=="")return $("#promocode").css({border:"1px solid red",background:"rgb(255, 206, 206)"}),$("#giftCard").removeAttr("style"),$("#Apply_coupon").addClass("d-none"),!1}else if(n=="giftcard"){if(t=$("#giftCard").val(),t==null||t=="")return $("#giftCard").addClass("promotion-block"),$("#promocode").removeClass("promotion-block"),$("#RequiredCouponErrorMessage").html(""),$("#RequiredgiftCardErrorMessage").html(ZnodeBase.prototype.getResourceByKeyName("ErrorRequiredVoucher")),Checkout.prototype.HideLoader(),!1;if(parseFloat($("#hdnTotalOrderAmount").val().replace(",","."))<=0)return $("#RequiredgiftCardErrorMessage").html(ZnodeBase.prototype.getResourceByKeyName("ErrorNoVoucherApplied")),Checkout.prototype.HideLoader(),!1;if(typeof vouchers!="undefined"&&vouchers!==null&&vouchers!==null&&(i=vouchers.some(function(n){return n.VoucherNumber===t}),i==!0))return $("#RequiredgiftCardErrorMessage").html(ZnodeBase.prototype.getResourceByKeyName("ErrorVoucherAlreadyApplied")),Checkout.prototype.HideLoader(),!1}},t.prototype.IsCustomCheckoutDataValid=function(){var t=$("#Total").val(),u;t=t.replace(",",".");t!=""&&t!=null&&t!="undefined"&&(t=t.replace(",",""));var n=!0,i=$("input[name='PaymentOptions']:checked").val(),f=$("#hdnECertAmount").val().replace(",",".");(i==""||i==null||i==undefined)&&$("#ApplyEcertificate:checked").length>0&&f!=undefined&&parseFloat(f)>=parseFloat($("#Total").val())&&(i=$("#hdnEcertPaymentSettingId").val());var e=$("input[name='ShippingOptions']:checked").val(),o=$("#IsBillingAddressOptional").val(),r=[];return $("input[name='PaymentOptions']:checked").each(function(){r.push($(this).attr("id"))}),u=$("#isGiftCardApplied").val(),r.indexOf("GIFT_CARD")!==-1&&(u==""||u=="false"?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorEnterGiftCardNumber"),"error",isFadeOut,fadeOutTime),n=!1):$("#Total").val()>0&&r.length==1&&(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorSelectAnotherPaymentMethod"),"error",isFadeOut,fadeOutTime),n=!1)),$("#errorAccountNumber").hide(),$("#errorShippingMethod").hide(),$("#expeditedShippingWarningDiv").removeClass("error"),$("#enableShipToSearch").val()=="True"&&$("#shipToSearchRequired").val()=="False"&&$("#shipping-content .address-name").text().trim()==""&&$("#IsNotShippable").val()!="True"&&(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredShippingAddress"),"error",!1,0),n=!1,Checkout.prototype.HideLoader()),$("#billing-content .address-citystate").attr("data-address-postalcode").trim()==""&&o!="true"?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredBillingAddress"),"error",!1,0),n=!1,Checkout.prototype.HideLoader()):(e==null||e=="")&&$("#IsNotShippable").val()!="True"&&($("#cartFreeShipping").val()!="True"||$("#hdnIsFreeShipping").val()!="True")?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectShippingOption"),"error",isFadeOut,fadeOutTime),n=!1,Checkout.prototype.HideLoader()):$("#hndShippingclassName").val()!=undefined&&$("#hndShippingclassName").val()==Constant.ZnodeCustomerShipping&&($("#AccountNumber").val()==undefined||$("#AccountNumber").val()=="")?($("#errorAccountNumber").show(),n=!1,Checkout.prototype.HideLoader()):$("#hndShippingclassName").val()!=undefined&&$("#hndShippingclassName").val()==Constant.ZnodeCustomerShipping&&($("#ShippingMethod").val()==undefined||$("#ShippingMethod").val()=="")?($("#errorShippingMethod").show(),n=!1,Checkout.prototype.HideLoader()):$("#expeditedShippingWarningDiv").is(":visible")&&$("#expeditedCheckbox").is(":checked")===!1?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ConfirmShippingMethod"),"error",!1,0),$("#expeditedShippingWarningDiv").addClass("error"),n=!1,Checkout.prototype.HideLoader()):!$("#ApplyEcertificate").prop("checked")&&(i==null||i=="")||$("#ApplyEcertificate").prop("checked")&&(i==null||i=="")&&parseFloat($("#hdnEcertAvailableTotal").val())<parseFloat($("#Total").val())?$("#Total").val().replace(",",".")>0&&(n=!1,ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectPaymentOption"),"error",!1,0),Checkout.prototype.HideLoader()):$("#EnableUserOrderAnnualLimit").val()&&$("#EnableUserOrderAnnualLimit").val().toLowerCase()=="true"&&parseInt($("#AnnualOrderLimit").val())>0&&parseInt($("#AnnualBalanceOrderAmount").val())-parseInt(t)<=0?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AnnualOrderLimitFailed")+$("#AnnualOrderLimitWithCurrency").val(),"error",!1,0),n=!1,Checkout.prototype.HideLoader()):$("#EnablePerOrderlimit").val()&&$("#EnablePerOrderlimit").val().toLowerCase()=="true"&&parseInt($("#PerOrderLimit").val())>0&&parseInt($("#PerOrderLimit").val())<=parseInt(t)&&(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("PerOrderLimitFailed")+$("#PerOrderLimitWithCurrency").val(),"error",!1,0),n=!1,Checkout.prototype.HideLoader()),n},t.prototype.RemoveFreeCouponGift=function(n){if(Checkout.prototype.ShowLoader(),n.html=="ReloadCheckoutPage"){var i=$("#divShoppingCart").load(location.href+" #divShoppingCart");$("input[name='ShippingOptions']:checked").val()>0&&t.prototype.CalculateShipping("")}else window.location.reload();Checkout.prototype.HideLoader()},t.prototype.RemoveAlreadyAppliedCoupon=function(){$("#freeProductCouponAlreadyApplied").remove();$("#promocode").val("")},t.prototype.DisplayAppliedDiscountCode=function(n){var h,f,r,i,e,u,o,s;if(Checkout.prototype.ShowLoader(),n.html=="ReloadCartPage")window.location.reload(),$("#promocode").val("");else if(n.html=="ReloadCheckoutPage")h=$("#divShoppingCart").load(location.href+" #divShoppingCart");else if(n.html=="InvalidCouponCode")($("#freeProductCouponAlreadyApplied").length==undefined||$("#freeProductCouponAlreadyApplied").length==0)&&(f="<div class='col-xs-12 nopadding' id='freeProductCouponAlreadyApplied'>",f=f+"<p class='error-msg'><a class='zf-close removeAppliedCoupon' custom-click='CustomCheckout.prototype.RemoveAlreadyAppliedCoupon()' style='cursor:pointer;padding-right:3px;' title='Remove Coupon Code'><\/a>"+ZnodeBase.prototype.getResourceByKeyName("InvalidPromoCodeCoupon")+"<\/p>",f=f+"<\/div>",CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",""),CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",f)),Checkout.prototype.HideLoader();else if(n.html=="FreeProductCouponAlreadyApplied")($("#freeProductCouponAlreadyApplied").length==undefined||$("#freeProductCouponAlreadyApplied").length==0)&&(f="<div class='col-xs-12 nopadding' id='freeProductCouponAlreadyApplied'>",f=f+"<p class='error-msg'><a class='zf-close removeAppliedCoupon' custom-click='CustomCheckout.prototype.RemoveAlreadyAppliedCoupon()' style='cursor:pointer;padding-right:3px;' title='Remove Coupon Code'><\/a>Coupon Already Applied<\/p>",f=f+"<\/div>",CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",""),CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",f)),Checkout.prototype.HideLoader();else if(n.html=="NotAllowedWithOtherCoupons"){for(r="<div class='col-xs-12 nopadding'>",coupons=n.coupons,i=0;i<coupons.length;i++)e=coupons[i].CouponApplied?"success-msg padding-top":"error-msg",u=coupons[i].PromotionMessage,u=="Coupon Successfully Applied."?u=ZnodeBase.prototype.getResourceByKeyName("AcceptedPromoCodeCoupon"):u=="Invalid Coupon Code."&&(u=ZnodeBase.prototype.getResourceByKeyName("InvalidPromoCodeCoupon")),o=coupons[i].Code,Checkout.prototype.RemoveDiscountMessages(),r=$("#hdnisEditCheckboxCompleted").is(":checked")==!1&&$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?r+"<p class='"+e+"'><a class='zf-close removeAppliedCoupon' data-coupon='"+i+"' custom-click='Checkout.prototype.RemoveAppliedCoupon("+i+")' style='cursor:pointer;pointer-events:none;padding-right:3px;' title='Remove Coupon Code'><\/a><b>"+o+"<\/b> - "+u+"<\/p>":r+"<p class='"+e+"'><a class='zf-close removeAppliedCoupon' data-coupon='"+i+"' custom-click='Checkout.prototype.RemoveAppliedCoupon("+i+")' style='cursor:pointer;padding-right:3px;' title='Remove Coupon Code'><\/a><b>"+o+"<\/b> - "+u+"<\/p>";r=r+"<\/div>";CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer","");CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",r);Checkout.prototype.HideLoader()}else{if(CommonHelper.prototype.LoadHtmlByControl("#summary-details",n.html),$("#promocode").val(""),$("#dynamic-order-total")&&$("#dynamic-cart-order-total").html($("#dynamic-order-total")[0].innerText),$("#hdnEncryptedTotalAmount")&&$("#hdnEncryptedTotalAmount").val(n.encryptedTotalAmount),r="",n.isGiftCard)vouchers=n.vouchers,Checkout.prototype.BindVoucherHtml(vouchers);else{for($("#cartFreeShipping").val(n.freeshipping),coupons=n.coupons,i=0;i<coupons.length;i++)e=coupons[i].CouponApplied?"success-msg":"error-msg",u=coupons[i].PromotionMessage,u=="Coupon Successfully Applied."?u=ZnodeBase.prototype.getResourceByKeyName("AcceptedPromoCodeCoupon"):u=="Invalid Coupon Code."&&(u=ZnodeBase.prototype.getResourceByKeyName("InvalidPromoCodeCoupon")),o=coupons[i].Code,s=$("#LabelRemoveCouponCode").val(),Checkout.prototype.RemoveDiscountMessages(),r=$("#hdnisEditCheckboxCompleted").is(":checked")==!1&&$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?r+'<p class="'+e+'"><a class="zf-close removeAppliedCoupon" custom-click="CustomCart.prototype.RemoveAppliedCoupon('+i+')" title="'+s+'"><\/a><strong class="promo-code-code">'+o+'<\/strong> <span class="promo-code-message">'+u+"<\/span><\/p>":r+'<p class="'+e+'"><a class="zf-close removeAppliedCoupon" custom-click="CustomCart.prototype.RemoveAppliedCoupon('+i+')" title="'+s+'"><\/a><strong class="promo-code-code">'+o+'<\/strong> <span class="promo-code-message">'+u+"<\/span><\/p>";r=r+"<\/div>";CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer","");CommonHelper.prototype.LoadHtmlByControl("#couponMessageContainer",r)}t.prototype.CustomDisablePaymentOptions();Checkout.prototype.ToggleFreeShipping();$("#Apply_coupon").addClass("d-none")}_ApplyCoupon.prototype.BindRemoveCoupon();Checkout.prototype.HideLoader()},t.prototype.CalculateShipping=function(n,i){var f;i===void 0&&(i=!0);var r=$("#shipping-options"),u=$("input[name='ShippingOptions']:checked").val(),e=$("#shipping-content").find("#AddressId").val(),o=$("input[name='ShippingOptions']:checked").attr("data-shippingCode"),s=$("#AdditionalInstruction").val(),h=t.prototype.SubmitOrderSetOrderPaymentModel(null,null,null),c=JSON.stringify(h);$("#hndShippingclassName").val(n);$("#messageBoxContainerId").hide();n.toLowerCase()==Constant.ZnodeCustomerShipping.toLowerCase()?$("#customerShippingDiv").show():$("#customerShippingDiv").hide();typeof u!=undefined&&u!=null&&u!=""&&(r.attr("action").match("shippingOptionId")&&(f=r.attr("action").split("?")[0],r.attr("action",""),r.attr("action",f)),r.attr("action",r.attr("action")+"?shippingOptionId="+u+"&shippingAddressId="+e+"&shippingCode="+o+"&additionalInstruction="+s+"&orderPaymentDetails="+c+"&isCalculateCart="+i),CommonHelper.prototype.SubmitForm(r,function(){}))},t.prototype.CustomDisplayAppliedDiscountCode=function(n){var u,f,s,h;if(t.prototype.DisplayAppliedDiscountCode(n),$("input[name='PaymentOptions']:checked").length>0){if(u=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),f=$("input[name='PaymentOptions']:checked").attr("id"),u!=undefined&&u!=null&&u.toLowerCase()=="budget"){var e=$("#chkUseOveragePaymentForBudget_"+f),i=parseFloat($("#Total").val()),r=parseFloat($("#hdnBudgetBalance_"+f).val()),o=isNaN(parseFloat($("#hdnEcertAvailableTotal").val()))?0:parseFloat($("#hdnEcertAvailableTotal").val());t.prototype.ShowHideOverageShippingMessage();i<r?$("#hdnECertAmount").val(o):i>r+o?$("#hdnECertAmount").val(o):$("#hdnECertAmount").val(i-r);(e!=undefined&&e!=null&&e.prop("checked")||u!=null&&u.toLowerCase()=="budget")&&(i>r?t.prototype.PaymentSummaryBlockCustomization(null):$("#span-shippingOverageMessage, #span-paymentOverageMessage").hide());s=$("#ApplyEcertificate:checked").length>0?!0:!1;h=t.prototype.GetEcertificateAmount();i<=r&&s&&parseFloat((r+h).toFixed(2))>=i&&$("#ApplyEcertificate:checked").length>0&&$("#hdnECertAmount").val()!=undefined&&i<r&&t.prototype.PaymentSummaryBlockCustomization(null)}t.prototype.CustomChangeSubmitOrderButtonText();t.prototype.ValidatePaymentAmountsWithOrderTotal()}ZnodeBase.prototype.HideLoader()},t.prototype.ShowHideOverageShippingMessage=function(){var s=Checkout.prototype.GetEditQuoteId(),n=$("input[name='PaymentOptions']:checked").attr("id"),r=parseFloat($("#Total").val().replace(",",".").replace(" ","")),i=parseFloat($("#hdnBudgetBalance_"+n).val()),e;isNaN(i)||(i=parseFloat($("#hdnBudgetBalance_"+n).val().replace(",",".").replace(" ","")));var o=t.prototype.GetEcertificateAmount(),u=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),f=$("#ApplyEcertificate:checked").length>0?!0:!1;r>i&&u!=undefined&&u.toLowerCase()=="budget"&&!f||r>i&&f&&parseFloat((i+o).toFixed(2))<=r&&u!=undefined&&u.toLowerCase()=="budget"?($("#div-chkUseOveragePaymentForBudget_"+n+", #overageDropDown_"+n).show(),$("#chkUseOveragePaymentForBudget_"+n).prop("checked",!0),$("#budgetOveragePaymentMethods_"+n+" option").length==1?($("#span-shippingOverageMessage, #span-paymentOverageMessage").hide(),f||(t.prototype.PaymentSummaryBlockCustomization(null),Endpoint.prototype.GetPaymentDetails($("#budgetOveragePaymentMethods_"+n+" option:selected").val(),!1,function(i){var u=$("#budgetOveragePaymentMethods_"+n+" option:selected"),f,r;$("#IsBillingAddressOptional").val(i.IsBillingAddressOptional);Checkout.prototype.ToggleBillingAddressBlock();r=$("#billing-content").find("#AddressId").val();$("#IsBillingAddressOptional").val()=="true"&&parseInt(r)==0?(r=$("#shipping-content").find("#AddressId").val(),$("#billing-content").find("#AddressId").val(r)):$("#IsBillingAddressOptional").val()!="true"&&$("#BillingAddressContainer").find(".address-details").attr("style")!=null&&$("#BillingAddressContainer").find(".address-details").attr("style")!=undefined&&$("#BillingAddressContainer").find(".address-details").attr("style").replace(" ","")=="display:none;"&&CommonHelper.prototype.ExecuteAjaxClickEvent($("#BillingAddressContainer").find("#autoClick"));$("#budgetOveragePaymentMethods_"+n+" option:selected").attr("data-payment-type").toLowerCase()=="credit_card"?($("#PaymentSettingId").val($("#budgetOveragePaymentMethods_"+n+" option:selected").val()),i.HasError||(Checkout.prototype.SetPaymentDetails(i),i.GatewayCode.toLowerCase()=="highradius"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnHighRadius").val("true"),Checkout.prototype.ToggleSubmitOrderButtonsVisibility(u),t.prototype.AvoidCCPaymentOptionToggleForCheckbox(u),Checkout.prototype.HideLoader()):i.GatewayCode.toLowerCase()=="staplespay"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),$("#IsStaplesPaySelected").val("true"),s==0&&(t.prototype.CheckPreviewStaplesPay(!0),t.prototype.ShowSelectedPaymentArea()),Checkout.prototype.HideLoader()):i.GatewayCode.toLowerCase()=="staplespayaci"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("true"),$("#IsStaplesPaySelected").val("true"),s==0&&(t.prototype.CheckPreviewStaplesPay(!0),t.prototype.ShowSelectedPaymentArea()),Checkout.prototype.HideLoader()):(f=$("input[name=PaymentOptions]:checked").attr("data-payment-type"),Checkout.prototype.ShowHidePaymentOption(f),Checkout.prototype.CreditCardPayment(f),Checkout.prototype.HideLoader(),Checkout.prototype.AvoidPaymentOptionToggleForCheckbox(u)))):(r=$("#billing-content").find("#AddressId").val(),$("#IsBillingAddressOptional").val()=="true"&&parseInt(r)==0&&(r=$("#shipping-content").find("#AddressId").val(),$("#billing-content").find("#AddressId").val(r)))}))):$("input[name='PaymentOptions']").length==1&&u!=undefined&&u.toLowerCase()=="budget"?$("#span-shippingOverageMessage, #span-paymentOverageMessage").hide():$("#budgetOveragePaymentMethods_"+n).val()!=""&&$("#budgetOveragePaymentMethods_"+n).val()!=undefined?$("#span-shippingOverageMessage, #span-paymentOverageMessage").hide():(f||parseFloat((i+o).toFixed(2))<=r)&&$("#budgetOveragePaymentMethods_"+n).val()==undefined?$("#span-shippingOverageMessage, #span-paymentOverageMessage").hide():(t.prototype.GetBudgetShippingErrorMessage(),$("#span-shippingOverageMessage, #span-paymentOverageMessage").show())):$("#span-shippingOverageMessage, #span-paymentOverageMessage").hide();(r<=i||f&&parseFloat((i+o).toFixed(2))>=r)&&($("#span-shippingOverageMessage, #span-paymentOverageMessage").hide(),t.prototype.HideOverageCheckboxSection(),($("#ApplyEcertificate:checked").length==0||$("#hdnECertAmount").val()==undefined)&&$("#PaymentSummary").addClass("hide"));e="";!$(".split-payment-option").is(":visible")&&$(".split-payment-option").css("display")=="none"||(e=$("#budgetOveragePaymentMethods_"+$("input[name='PaymentOptions']:checked").attr("id")+" option:selected").attr("data-payment-type"));r<=parseFloat((i+o).toFixed(2))&&u!=undefined&&u.toLowerCase()=="budget"&&(t.prototype.cleanStaplesPayiFrameInfo(),$(".creditCardInformationTitle").hide(),$("#div-PreviewStaplezPay").html(""));r>i&&u!=undefined&&u.toLowerCase()=="budget"&&r>i&&f&&parseFloat((i+o).toFixed(2))<=r&&e!=undefined&&e!=null&&e!=""&&e.toLowerCase()=="credit_card"&&($("#PaymentSettingId").val($("#budgetOveragePaymentMethods_"+n+" option:selected").val()),Endpoint.prototype.GetPaymentDetails($("#budgetOveragePaymentMethods_"+n+" option:selected").val(),!1,function(n){n.HasError||(Checkout.prototype.SetPaymentDetails(n),n.GatewayCode.toLowerCase()=="staplespay"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),$("#IsStaplesPaySelected").val("true"),s==0&&(t.prototype.CheckPreviewStaplesPay(!0),t.prototype.ShowSelectedPaymentArea()),Checkout.prototype.HideLoader()):n.GatewayCode.toLowerCase()=="staplespayaci"&&($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("true"),$("#IsStaplesPaySelected").val("true"),s==0&&(t.prototype.CheckPreviewStaplesPay(!0),t.prototype.ShowSelectedPaymentArea()),Checkout.prototype.HideLoader()))}))},t.prototype.SetOrderPaymentModel=function(){var n=[],t,i;return $("input[name='PaymentOptions']:checked").each(function(){var t={PaymentSettingId:$(this).val(),PaymentType:$(this).attr("data-payment-type"),PaymentExternalId:$(this).attr("data-paymentexternalid"),IsTaxExempt:$(this).attr("data-istaxexempt")};n.push(t)}),t=$("#ApplyEcertificate").prop("checked"),t&&(i={PaymentSettingId:$("#hdnGiftCardPaymentSettingId").val(),PaymentType:$("#hdnEcertPaymentType").val(),PaymentExternalId:$("#hdnEcertificateAccountNumber").val()},n.push(i)),n},t.prototype.SubmitOrderSetOrderPaymentModel=function(n,i,r){var c,f,l,a,o,s,h;n===void 0&&(n=null);i===void 0&&(i=null);r===void 0&&(r=null);var e=t.prototype.CustomSetOrderPaymentModel(n,i,r),v=$("#ApplyEcertificate").prop("checked"),u=$("input[name='PaymentOptions']:checked").attr("id");return(v&&(c={PaymentSettingId:$("#hdnGiftCardPaymentSettingId").val(),PaymentCode:null,Amount:parseFloat($("#hdnECertAmount").val().replace(",",".")),CardSecurityCode:null,PaymentDisplayName:null,PaymentType:$("#hdnEcertPaymentType").val()},e.push(c)),f=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),f==undefined||f==null||f==""||f.toLowerCase()!=="budget")?e:(l=$("#budgetOveragePaymentMethods_"+u+" option:selected").val(),a=$("#chkUseOveragePaymentForBudget_"+u).prop("checked"),t.prototype.IsOveragePaymentOptionSelected(l,a)&&(o=$("#budgetOveragePaymentMethods_"+u+" option:selected").attr("data-payment-type").toLowerCase(),s=0,$("#hdnBudgetBalance").val()!=="undefined"&&$("#hdnBudgetBalance_"+u).val()!=null&&(s=parseFloat($("#hdnBudgetBalance_"+u).val().replace(",","."))),h={PaymentSettingId:$("#budgetOveragePaymentMethods_"+u+" option:selected").val(),PaymentCode:null,Amount:t.prototype.CalculateOveragePaymentMethodAmount(parseFloat($("#hdnTotalOrderAmount").val().replace(",",".")),s,parseFloat($("#hdnECertAmount").val().replace(",","."))),PaymentDisplayName:null,PaymentType:o},o=="credit_card"&&t.prototype.SetCreditCardResponseForOrder(n,o,r,h),e.push(h)),e)},t.prototype.IsOveragePaymentOptionSelected=function(n,t){return n!=undefined&&n!=null&&n!=""&&t!=undefined&&t!=null&&t},t.prototype.getPaymentAmount=function(n){var i=$("input[name='PaymentOptions']:checked").attr("id"),t;return n!=="budget"?parseFloat($("#Total").val())-parseFloat($("#hdnECertAmount").val().replace(",",".")):!$("#PaymentSummary").hasClass("hide")&&$("div.base-budget-row #hdnBudgetApplicableInputAmount").length==1?parseFloat($("div.base-budget-row #hdnBudgetApplicableInputAmount").val()):(t=$("#label_chkUseOveragePaymentForBudget_"+i),t!=undefined&&t!=null&&t.is(":visible")?parseFloat($("#hdnBudgetBalance_"+i).val()):parseFloat($("#Total").val()))},t.prototype.CustomSetOrderPaymentModel=function(n,i,r){var e,u,f,o;return n===void 0&&(n=null),i===void 0&&(i=null),r===void 0&&(r=null),e=[],u=$("input[name='PaymentOptions']:checked").attr("data-payment-type"),u!=undefined&&u!=null&&u!=""&&(f=u.toLowerCase(),o={PaymentSettingId:$("input[name='PaymentOptions']:checked").val(),PaymentCode:i,Amount:this.getPaymentAmount(f),PaymentDisplayName:null,PaymentType:f,PaymentExternalId:$("input[name='PaymentOptions']:checked").data("paymentexternalid")},f=="credit_card"&&t.prototype.SetCreditCardResponseForOrder(n,f,r,o),e.push(o)),e},t.prototype.SetCreditCardResponseForOrder=function(n,t,i,r){n===void 0&&(n=null);t===void 0&&(t=null);i===void 0&&(i=null);r===void 0&&(r=null);t!="budget"&&typeof n!=undefined&&n!=null&&(typeof n.GatewayResponse!=undefined&&n.GatewayResponse!=null&&(r.CustomerProfileId=n.GatewayResponse.CustomerProfileId,r.CustomerPaymentId=n.GatewayResponse.CustomerPaymentProfileId,r.CustomerShippingAddressId=n.GatewayResponse.CustomerShippingAddressId,r.CustomerGuid=n.GatewayResponse.CustomerGUID),r.CardSecurityCode=i,r.PaymentToken=n.token,r.CardDetails=n.carddetails,r.CreditCardNumber=$("#hdnCreditCardNumber").val(),r.PaymentToken=$("input[name='CCdetails']:checked").val(),r.CreditCardNumber=$("#hdnCreditCardNumber").val())},t.prototype.PaymentSummaryBlockCustomization=function(n){var r=$('input[name="PaymentOptions"]:checked'),u=r.attr("id"),i,e,s,o,f,h;r.parent().find("#budgetBalanceSpan_"+u).length==1?$("input#chkUseOveragePaymentForBudget_"+u+":checked").length>0&&$("select#budgetOveragePaymentMethods_"+u+" option:selected").val()!=""||$("input[type=checkbox][data-method-name]:checked").length>0?($("div.sub-payment-row").remove(),$("div.base-budget-row .payment-method-name").text($("#budgetBalanceSpan_"+u).parents(".input-radioButton-label").children().first().text()),i=$("#ApplyEcertificate:checked").length>0?!0:!1,$("input#chkUseOveragePaymentForBudget_"+u+":checked").length>0&&$("select#budgetOveragePaymentMethods_"+u+" option:selected").val()!=""&&t.prototype.PaymentMethodCustomization(null,!0,i),i&&t.prototype.PaymentMethodCustomization($("#ApplyEcertificate:checked"),!1,i),$("#PaymentSummary").removeClass("hide"),$("#PaymentSummary").show()):($("div.sub-payment-row").remove(),$("#PaymentSummary").addClass("hide"),$("#hdnStorePublishState").val()==undefined||$("#hdnStorePublishState").val().toLowerCase()!="preview"||$("input[name=PaymentOptions]:checked").attr("data-payment-type")==undefined||$("input[name=PaymentOptions]:checked").attr("data-payment-type").toLowerCase()=="credit_card"||$("#div-PreviewStaplezPay").html("")):$("#ApplyEcertificate").prop("checked")&&r.length>0?($("div.base-budget-row .payment-method-name").text(r.attr("data-payment-name")),i=$("#ApplyEcertificate:checked").length>0?!0:!1,i&&t.prototype.PaymentMethodCustomization($("#ApplyEcertificate:checked"),!1,i),$("#PaymentSummary").removeClass("hide"),$("#PaymentSummary").show()):$("#ApplyEcertificate").prop("checked")&&r.length>0?($("div.base-budget-row .payment-method-name").text(r.attr("data-payment-name")),i=$("#ApplyEcertificate:checked").length>0?!0:!1,i&&t.prototype.PaymentMethodCustomization($("#ApplyEcertificate:checked"),!1,i),$("#PaymentSummary").removeClass("hide"),$("#PaymentSummary").show()):($("div.sub-payment-row").remove(),$("#PaymentSummary").addClass("hide"));t.prototype.ValidatePaymentAmountsWithOrderTotal();n!=null&&(n.length>0&&n[0]!="null"||n!=null&&n.text!=null&&n.text!=undefined)&&(e="false",s=$('input[name="PaymentOptions"]:checked').attr("data-payment-type").toLowerCase()==="budget",s&&(e=$('input[name="PaymentOptions"]:checked').attr("data-istaxexempt").toLowerCase()),e=="false"&&(o="false",f=$('input[name="PaymentOptions"]:checked').attr("id"),(f!==undefined||f!=="")&&(h=$("select#budgetOveragePaymentMethods_"+f+" option:selected").attr("data-istaxexempt"),h!==undefined&&(o=$("select#budgetOveragePaymentMethods_"+f+" option:selected").attr("data-istaxexempt").toLowerCase())),o=="false"&&t.prototype.ShowPaymentOptions(n)))},t.prototype.CalculatePaymentSummaryTotal=function(n,i,r){var s=$("input[name='PaymentOptions']:checked").attr("id"),h=parseFloat($("#Total").val().replace(",",".")),c=0,u,a;$("#hdnBudgetBalance").val()!=="undefined"&&$("#hdnBudgetBalance_"+s).val()!=null&&(c=parseFloat($("#hdnBudgetBalance_"+s).val().replace(",",".")));var f=$("#ApplyEcertificate:checked").length>0?t.prototype.GetEcertificateAmount():0,e=t.prototype.GetOtherPaymentAmount(f,h),l=$('input[name="PaymentOptions"]:checked').attr("data-payment-type").toLowerCase()==="budget",o=0;l&&(o=t.prototype.CalculateBudgetPaymentApplicableAmount(h,c,f));l&&t.prototype.DisplayApplicableBudgetPaymentAmountInPaymentSummary(o);u=t.prototype.GetBudgetOveragePaymentAmount(i,r);e>0&&(t.prototype.DisplayApplicableOtherPaymentAmountInPaymentSummary(e),$("div.sub-payment-row").remove());n.find(".payment-value").text(i?this.FormatPriceWithCurrency(u):this.FormatPriceWithCurrency(f));u>0&&i&&n.append('<input type="hidden" id="hdnBudgetSubPaymentAmount" value="'+u+'" />');a=o+f+u+e;$("#TotalPaymentValue").text(this.FormatPriceWithCurrency(a))},t.prototype.FormatPriceWithCurrency=function(n){var t=$("body").attr("data-culture"),i=$("#GatewayCurrencyCode").val();return n.toLocaleString(t,{style:"currency",currency:i,minimumFractionDigits:2}).replace("US","")},t.prototype.GetBudgetOveragePaymentAmount=function(n,i){var u=$("input[name='PaymentOptions']:checked").attr("id"),f=parseFloat($("#Total").val().replace(",",".")),e=0,r,o;return $("#hdnBudgetBalance").val()!=="undefined"&&$("#hdnBudgetBalance_"+u).val()!=null&&(e=parseFloat($("#hdnBudgetBalance_"+u).val().replace(",","."))),r=t.prototype.GetEcertificateAmount(),o=t.prototype.CalculateBudgetPaymentApplicableAmount(f,e,r),t.prototype.CalculateBudgetOveragePaymentMethodAmount(n,i,f,o,r)},t.prototype.CalculateOveragePaymentMethodAmount=function(n,t,i){return parseFloat((n-t-i).toFixed(2))},t.prototype.CalculateBudgetOveragePaymentMethodAmount=function(n,t,i,r,u){var e=Checkout.prototype.GetEditQuoteId(),f;return n&&t&&r>=i?($("#ApplyEcertificate").prop("checked",!1),$("#ApplyEcertificate").trigger("change"),r):!n&&t&&r>=i?($("#ApplyEcertificate").prop("checked",!1),$("#ApplyEcertificate").trigger("change"),r):n&&t?i-r-u:n?i-r:$("#hdnBudgetSubPaymentAmount").length>0?parseFloat($("#hdnBudgetSubPaymentAmount").val()):!n&&t&&u>=i&&e>0&&(r==0||isNaN(r)||r==undefined)?(f=$("input[name='PaymentOptions']:checked"),f&&$("input[name='PaymentOptions']:checked").prop("checked",!1),0):0},t.prototype.GetECertificateAmountToBeApplied=function(n){var i=$("input[name='PaymentOptions']:checked").attr("id"),r,t;return!n||$('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+i).length==0?"0":(r=parseFloat($("#Total").val().replace(",",".").replace(" ","")),t=parseFloat($("#hdnBudgetBalance_"+i).val()),isNaN(t)||(t=parseFloat($("#hdnBudgetBalance_"+i).val().replace(",",".").replace(" ",""))),t<r?parseFloat((r-t).toFixed(2)).toString():"0")},t.prototype.PaymentMethodCustomization=function(n,i,r){var e=$("input[name='PaymentOptions']:checked").attr("id"),u=$("div.base-budget-row").clone(),f;u.find(".payment-method-name").text(i?$("select#budgetOveragePaymentMethods_"+e+" option:checked").text():$(n).attr("data-method-name"));t.prototype.CalculatePaymentSummaryTotal(u,i,r);f=parseFloat(t.prototype.GetBudgetOveragePaymentAmount(i,r).toFixed(2));i&&f>0?(u.removeClass("base-budget-row").addClass("sub-payment-row"),u.find(".payment-value").removeClass("payment-value"),u.insertBefore($("div.total-row"))):!i&&r&&(u.removeClass("base-budget-row").addClass("sub-payment-row"),u.find(".payment-value").removeClass("payment-value"),u.insertBefore($("div.total-row")))},t.prototype.CalculateBudgetPaymentApplicableAmount=function(n,t){return t>=n?n:t},t.prototype.DisplayApplicableBudgetPaymentAmountInPaymentSummary=function(n){$("div.base-budget-row .payment-value").text(this.FormatPriceWithCurrency(n));$("div.base-budget-row #hdnBudgetApplicableInputAmount").length==0?$("div.base-budget-row").append('<input type="hidden" id="hdnBudgetApplicableInputAmount" value="'+n+'" />'):$("div.base-budget-row #hdnBudgetApplicableInputAmount").val(n)},t.prototype.DisplayApplicableOtherPaymentAmountInPaymentSummary=function(n){$("div.base-budget-row .payment-value").text(this.FormatPriceWithCurrency(n))},t.prototype.ValidatePaymentAmountsWithOrderTotal=function(){var n=$("input[name='PaymentOptions']:checked").attr("id"),u=parseFloat($("#Total").val()),f=parseFloat($("#hdnBudgetBalance_"+n).val()),i=parseFloat($("#hdnEcertAvailableTotal").val()),r;t.prototype.IsBudgetAndEcertPaymentMethodsOnlyAmountLessThanOrderTotal()?($("#budgetBalanceSpan_"+n).parent().css("color","red"),$("#ApplyEcertificate:checked").length==1&&i!=undefined&&u>f+i&&$("#eCertAvailableAmount").css("color","red"),r=$("#IsOverageAllowed_"+n).val(),$('input[name="PaymentOptions"]:checked').attr("data-payment-type").toLowerCase()=="budget"&&!r,$("#ApplyEcertificate").prop("checked")&&$('input[name="PaymentOptions"]:checked').length>0?$("#PaymentSummary").removeClass("hide"):$("#PaymentSummary").addClass("hide"),$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!0)):($("#budgetBalanceSpan_"+n).parent().css("color",""),$("#eCertAvailableAmount").css("color",""),$("div.receipt-total.orderTotal div").css("color",""),$('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+n).length==1&&($("input#chkUseOveragePaymentForBudget_"+n+":checked").length>0&&$("select#budgetOveragePaymentMethods_"+n+" option:selected").val()!=""||$("input[type=checkbox][data-method-name]:checked").length>0)&&$("#PaymentSummary").removeClass("hide"),$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!1));t.prototype.IsBudgetAndEcertPaymentAmountLessThanOrderTotal()&&$('[name="singleCheckoutSubmitPayment"], [name="singleCheckoutSubmitQuote"]').prop("disabled",!0)},t.prototype.HideAndResetBudgetOverageCheckboxSection=function(n){(n.type=="radio"||n.tagName!=undefined&&n.tagName.toLowerCase()!="select"&&n.tagName.toLowerCase()!="option")&&(t.prototype.HideOverageCheckboxSection(),$("div.sub-payment-row").remove(),$("#PaymentSummary").addClass("hide"))},t.prototype.HideOverageCheckboxSection=function(){var n=$("input[name='PaymentOptions']:checked").attr("id");$("select#budgetOveragePaymentMethods_"+n+' option[value=""]').prop("selected",!0);$("#overageDropDown_"+n).hide();$("input#chkUseOveragePaymentForBudget_"+n).prop("checked",!1);$("#div-chkUseOveragePaymentForBudget_"+n).hide()},t.prototype.GetEcertificateAmount=function(){return $("#hdnECertAmount").val()==undefined?0:parseFloat($("#hdnECertAmount").val().replace(",","."))},t.prototype.GetOtherPaymentAmount=function(n,t){var i=$('input[name="PaymentOptions"]:checked');return $("#ApplyEcertificate").prop("checked")&&i.length>0&&i.attr("data-payment-type").toLowerCase()!=="budget"?t-n:0},t.prototype.UpdateBudgetOverageAmount=function(){var i=$("input[name='PaymentOptions']:checked").attr("id"),r=parseFloat($("#Total").val().replace(",",".").replace(" ","")),n=parseFloat($("#hdnBudgetBalance_"+i).val()),u,f;isNaN(n)||(n=parseFloat($("#hdnBudgetBalance_"+i).val().replace(",",".").replace(" ","")));u=t.prototype.GetEcertificateAmount();f=$("#ApplyEcertificate:checked").length>0?!0:!1;r>n&&$("#OrderBudgetDifference").text($("#hdnCurrencySuffix").val()+t.prototype.CalculateBudgetOveragePaymentMethodAmount(!0,f,r,n,u).toFixed(2))},t.prototype.IsBudgetAndEcertPaymentMethodsOnlyAmountLessThanOrderTotal=function(){var n=$("input[name='PaymentOptions']:checked").attr("id"),i=parseFloat($("#Total").val()),r=parseFloat($("#hdnBudgetBalance_"+n).val()),f=t.prototype.GetEcertificateAmount(),u=$('input[name="PaymentOptions"]:checked'),e;if($('input[name="PaymentOptions"]').length==1&&$('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+n).length==1||$('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+n).length==1&&$("#budgetOveragePaymentMethods_"+n+" option").length==1&&$("#budgetOveragePaymentMethods_"+n+" option").attr("data-payment-type").toLowerCase()=="gift_card"){if(e=$("input#chkUseOveragePaymentForBudget_"+n+":checked").length>0&&$("select#budgetOveragePaymentMethods_"+n+" option:selected").val()!="",$("#ApplyEcertificate:checked").length==1&&!e&&(i>r+f||i>r))return!0}else if(u!=undefined&&u.length>0&&u.attr("data-payment-type").toLowerCase()=="budget"&&$("#budgetOveragePaymentMethods_"+n).val()==undefined)return $("#ApplyEcertificate:checked").length==0&&i<=r||$("#ApplyEcertificate:checked").length==1&&i<=r+f?!1:!0;return!1},t.prototype.IsBudgetAndEcertPaymentAmountLessThanOrderTotal=function(){var n=$("input[name='PaymentOptions']:checked").attr("id"),i=parseFloat($("#Total").val()),r=parseFloat($("#hdnBudgetBalance_"+n).val()),u=t.prototype.GetEcertificateAmount();return $('input[name="PaymentOptions"]:checked').parent().find("#budgetBalanceSpan_"+n).length==1&&$("input#chkUseOveragePaymentForBudget_"+n).length==0&&($("#ApplyEcertificate:checked").length==1&&i>r+u||$("#ApplyEcertificate:checked").length==0&&i>r)?!0:!1},t.prototype.CheckIsTaxExempt=function(){var t="false",i=$('input[name="PaymentOptions"]:checked').attr("data-payment-type"),n;return i!==undefined&&(n=$('input[name="PaymentOptions"]:checked').attr("data-istaxexempt"),(n!==undefined||n!=="")&&(t=$('input[name="PaymentOptions"]:checked').attr("data-istaxexempt").toLowerCase())),t},t.prototype.GetAndUpdateECertificateAmountToBeApplied=function(n){var r,i,u;n===void 0&&(n=!0);r=Checkout.prototype.GetEditQuoteId();i=$("#ApplyEcertificate").prop("checked");Checkout.prototype.ShowLoader();u=t.prototype.CheckIsTaxExempt();i&&CustomEndpoint.prototype.ApplyECertificate(i,t.prototype.GetECertificateAmountToBeApplied(i),u,r,n,function(n){$("#summary-details").html("");CommonHelper.prototype.LoadHtmlByControl("#summary-details",n.html);t.prototype.UpdateBudgetOverageAmount();t.prototype.PaymentSummaryBlockCustomization(null);t.prototype.ShowHideOverageShippingMessage();var i=$("#ApplyEcertificate").prop("checked");i&&parseFloat($("#Total").val())<=parseFloat($("#hdnEcertAvailableTotal").val())&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()&&(r>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")));Checkout.prototype.HideLoader()})},t.prototype.OnShippingMethodSelection=function(){var o=$("#ApplyEcertificate").prop("checked"),s=Checkout.prototype.GetEditQuoteId(),i,r,u,n,f,e;(parseInt($("#QuoteId").val())>0&&$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"||parseInt($("#QuoteId").val())>0&&$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="staplespay"||parseInt($("#QuoteId").val())>0&&$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="credit_card"||parseInt($("#QuoteId").val())>0&&$("input[name='PaymentOptions']:checked").attr("data-payment-type")!=undefined&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"||parseInt($("#QuoteId").val())>0&&o)&&(i=t.prototype.SubmitOrderSetOrderPaymentModel(null,null,null),i?($("#shipping-options :input").prop("disabled",!0),$("#SearchShippingAddressContainer").hide()):($("#shipping-options :input").prop("disabled",!1),$("#SearchShippingAddressContainer").show()),$("#singleCheckoutSubmitQuote").show(),$("#btnCompleteCheckout").show(),r=Checkout.prototype.GetEditQuoteId(),r>0?($("input[name='PaymentOptions']").parent("div").addClass("read-only"),$("input[name='ApplyEcert']").closest("div").parent("div").addClass("read-only"),$("input[name='ShippingOptions']").closest("div").parent("div").addClass("read-only")):$("input[name='PaymentOptions']").parent("div").removeClass("read-only"));$('input[name="PaymentOptions"][data-payment-type="BUDGET"]:checked').length==1&&$("#ApplyEcertificate:checked").length==1?(s==0&&t.prototype.GetAndUpdateECertificateAmountToBeApplied(),u=$("#ApplyEcertificate").prop("checked"),u&&parseFloat($("#Total").val())<=parseFloat($("#hdnEcertAvailableTotal").val())&&$("input[name='PaymentOptions']:checked").length==0&&t.prototype.CheckForApprovalRoutingForEcert()&&(parseInt($("#QuoteId").val())>0?$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+$("#ecertButtonValue").val()):$(".btnCompleteCheckout").html('<i class="zf-checkout"><\/i> '+ZnodeBase.prototype.getResourceByKeyName("ButtonSubmitForApproval")))):(t.prototype.UpdateBudgetOverageAmount(),$("#billing-content .address-details").attr("style")!=null&&$("#billing-content .address-details").attr("style")!=undefined&&$("#billing-content .address-details").attr("style").replace(" ","")!="display:none;"&&(n=$("#data-capture-content").html(),n!=undefined&&n!=null&&n!=""&&$("#data-capture-content").removeClass("disable_section"),$(".creditCardInformationTitle").removeClass("disable_section"),f=$("input[name='PaymentOptions']:checked").attr("data-isShipToSearchEnabled")==="true",e=$("input[name='PaymentOptions']:checked").attr("data-isShipToSearchRequired")==="true",f&&e||$(".checkoutButton").removeClass("disable_section")),t.prototype.PaymentSummaryBlockCustomization(null))},t.prototype.CheckoutUploadPODocument=function(n,t){var i=new FormData;i.append("file",n[0]);$.ajax({type:"POST",url:"/customcheckout/uploadpodocument?filetype="+n[0].type,contentType:!1,dataType:"json",processData:!1,async:!1,data:this.cachestampfunctionCustom(i),success:function(n){t(n)},error:function(n){var t=JSON.parse(n.responseText)}})},t.prototype.IsEcertPaymentAmountLessThanOrderTotal=function(){var n=parseFloat($("#Total").val()),t=isNaN(parseFloat($("#hdnEcertAvailableTotal").val()))?0:parseFloat($("#hdnEcertAvailableTotal").val());return $("#ApplyEcertificate:checked").length==1&&n>t?!0:!1},t.prototype.GetBudgetShippingErrorMessage=function(){var n=$('input[name="PaymentOptions"]:checked').parent(".payment-method").find(".payment-method-name").html(),t=$('input[name="PaymentOptions"]:checked').parent(".payment-method").find(".payment-method-balance").html();CustomEndpoint.prototype.GetBudgetShippingErrorMessage(n,t,function(n){$("#BudgetShippingOverageErrorMessage").html(n.ShippingOverageErrorMessage);$("#BudgetPaymentOverageErrorMessage").html(n.PaymentOverageErrorMessage)})},t.prototype.cachestampfunctionCustom=function(n){var t=new Date;return n!=null&&(typeof n==Constant.string?n+="&_="+t.getTime():typeof n==Constant.object?n.hasOwnProperty("_")==!1?Object.defineProperty(n,"_",{value:t.getTime(),writable:!0}):n._=t.getTime():n={_:t.getTime()}),n},t.prototype.StaplesPayModelCreation=function(n,t,i){i.creditCardType=n.creditCardType;i.LastFourCreditCardDigits=n.LastFourCreditCardDigits;i.StaplesPayIsLosNumber=n.StaplesPayIsLosNumber;i.AuthorizationExpirationDate=n.AuthorizationExpirationDate;i.StaplesPayAuthorizationGuid=n.StaplesPayAuthorizationGuid;i.TransactionId=n.PaymentReferenceToken;i.AuthorizationToken=n.AuthorizationToken;i.OrderNumber=$("input[name=orderNumber]").val();i.CardType=n.creditCardType;i.CreditCardExpMonth=n.CreditCardExpMonth;i.CreditCardExpYear=n.CreditCardExpYear;i.CreditCardNumber=n.LastFourCreditCardDigits;var r={parentGUID:$("input[name=parentGUID]").val(),childGUID:$("input[name=childGUID]").val(),authChildGUID:$("input[name=authChildGUID]").val(),div:$("#DivisionCC").val()!==undefined?$("#DivisionCC").val():$("input[name=div]").val(),bunit:$("input[name=bunit]").val(),AuthorizationCode:n.AuthorizationToken,AuthExpiryDate:n.AuthorizationExpirationDate,orderNumber:$("input[name=orderNumber]").val(),tranID:$("input[name=tranID]").val(),source:$("input[name=source]").val(),version:$("input[name=version]").val(),country:$("input[name=country]").val(),noOfAttempts:$("input[name=noOfAttempts]").val(),addCardResponse:t,Processor:$("#processorValue").val()};return i.Custom5=JSON.stringify(r),i.PaymentCode=$("#hdnGatwayName").val(),i.BillingPostalCode=$("#BillingPostalCode").val(),i},t.prototype.ValidatePaymentOptionsForOrderProcess=function(n,t){return typeof n!=undefined&&n!=null&&n!=""&&n=="true"&&t!=undefined&&t!=null&&t!=""&&t=="PREVIEW"&&$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt")!=undefined&&($("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase()=="false"||$("input[name='PaymentOptions']:checked").attr("data-isTaxExempt").toLowerCase()=="true"&&$("#BillingAccountNumber").val()!=undefined&&$("#BillingAccountNumber").val()!="")},t.prototype.HideAddressPopup=function(){$(".address-popup").modal("hide")},t.prototype.SetFlagForApprovalRouting=function(n,t,i,r){if(i=="true"||n=="true"||t=="true"||r=="true"){if(t=="true"||r=="true")return!0;var o=parseFloat($("#OrderLimit").val()),s=parseFloat($("#SubTotal").val()),u=$("input[name='PaymentOptions']:checked").attr("data-paymentOrderLimit"),h=$("input[name='PaymentOptions']:checked").attr("id"),e=$("#budgetOveragePaymentMethods_"+h),f=e.find("option:selected").val(),c=f!=undefined&&f!=null&&f!=""?!0:!1,l=f!=undefined&&f!=null&&f!=""&&e.find("option:selected").attr("data-isapprovalrequired")=="True"?!0:!1;return e!=undefined&&e!=null&&c&&l?u=$("#budgetOveragePaymentMethods_"+h+" option:selected").attr("data-paymentOrderLimit"):u&&u!=""&&(u=$("input[name='PaymentOptions']:checked").attr("data-paymentOrderLimit")),$(".signle-page-payment").attr("data-approvaltypename").toLowerCase()=="payment"?u&&u!=""&&s>=parseInt(u)?!0:!1:o==0||s>=o?!0:!1}return!1},t.prototype.CheckSpecialOfferOrderRestrictions=function(){var n=!0;return CustomEndpoint.prototype.IsSpecialOfferOrderRestrictionsDisabled(function(t){n=t.status}),n},t.prototype.IsPaymentStaplesPay=function(n){return typeof n!=undefined&&n!=null&&n!=""&&n=="true"},t.prototype.IsPaymentStaplesPayACI=function(n){return typeof n!=undefined&&n!=null&&n!=""&&n=="true"},t.prototype.IsStorePreview=function(n){return typeof n!=undefined&&n!=null&&n!=""&&n=="PREVIEW"},t.prototype.IsStorePreviewSubmitOrderByCC=function(n,t){return typeof n!=undefined&&n!=null&&n!=""&&n=="true"&&this.IsStorePreview(t)},t.prototype.IsByPassStaplesPayActive=function(n){return typeof n!=undefined&&n!=null&&n=="true"},t.prototype.CheckPreviewStaplesPay=function(n){var u=Checkout.prototype.GetEditQuoteId(),i,r;n==!0?(i=$("input[name='PaymentOptions']:checked").attr("id"),r=$("#budgetOveragePaymentMethods_"+i+" option:selected").attr("data-payment-type"),$("#hdnStorePublishState").val()=="PREVIEW"&&r!=undefined&&r.toLowerCase()=="credit_card"&&($("#hdnGatwayName").val()=="staplespay"||$("#hdnGatwayName").val()=="staplespayaci")&&u==0&&($("#label_"+parseInt($("#hdnBypassStaplesPay").val())).find("#isBypassStaplesPay").prop("checked","true"),t.prototype.SetValueOfPreviewStaplesPay(parseInt($("#budgetOveragePaymentMethods_"+i+" option:selected").val())))):$("#hdnStorePublishState").val()=="PREVIEW"&&($("#hdnGatewayCode").val()=="staplespay"||$("#hdnGatewayCode").val()=="staplespayaci")&&u==0&&($("#label_"+parseInt($("#hdnBypassStaplesPay").val())).find("#isBypassStaplesPay").prop("checked","true"),t.prototype.SetValueOfPreviewStaplesPay(parseInt($("#hdnBypassStaplesPay").val())))},t.prototype.AdvancedCCPaymentOptionSelection=function(n){var i,r,u;return $("#div-StaplesPay").hide(),$("input[name='PaymentOptions']").attr("data-iframeloaded","0"),(n.type=="radio"||$("#IsStaplesPaySelected").val()==""||$("#IsStaplesPaySelected").val()=="false"||$("#StaplesPayOptionSelectionType").val()=="radio"&&$("#IsStaplesPaySelected").val()=="true")&&($(".creditCardInformationTitle").hide(),t.prototype.cleanStaplesPayiFrameInfo()),i=n,i!=null&&i!=""&&i!="undefined"&&(r=Checkout.prototype.GetPaymentType(i.id),u=$("#Total").val(),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("false"),r=="credit_card"&&($("#cc-content-message").show(),$("#PaymentSettingId").val(i.value),$("#hdnGatwayName").val(""),$("#hdnEncryptedTotalAmount").val(""),Endpoint.prototype.GetPaymentDetails(i.id,!0,function(r){r.HasError||(Checkout.prototype.SetPaymentDetails(r),r.GatewayCode.toLowerCase()=="staplespay"?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#authStaplesPayFrame").show(),$("#resultTarget").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),$("#IsStaplesPaySelected").val(n.checked),$("#StaplesPayOptionSelectionType").val(n.type),t.prototype.CheckPreviewStaplesPay(!0),n.checked||n.selected?t.prototype.ShowStaplesPAYCreditCardiFrame(i.id,"0"):t.prototype.cleanStaplesPayiFrameInfo()):r.GatewayCode.toLowerCase()=="staplespayaci"&&($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#div-InvoiceMe").hide(),$("#resultTarget").show(),$("#authStaplesPayFrame").hide(),$("#hdnStaplesPay").val("false"),$("#hdnStaplesPayACI").val("true"),$("#IsStaplesPaySelected").val(n.checked),$("#StaplesPayOptionSelectionType").val(n.type),n.checked||n.selected?t.prototype.ShowStaplesPayACICreditCardiFrame(i.id,"0"):t.prototype.cleanStaplesPayiFrameInfo()),$("#div-StaplesPay").fadeIn(700))}))),!0},t.prototype.AdvancedCCSubmitPayment=function(){var r,u,t,n,i,f;if(!$("#frmEditAddress_billing").valid())return $("#frmEditAddress_billing").submit();Checkout.prototype.ShowLoader();r=$("#hdnStaplesPay").val();u=$("#hdnStaplesPayACI").val();this.IsPaymentStaplesPay(r)?($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnStaplesPay").val("true"),$("#hdnStaplesPayACI").val("false"),t=document.getElementById("authStaplesPayFrame"),t?(n=parseInt($("input[name=noOfAttempts]").val()),n>0?(n=n-1,$("input[name=noOfAttempts]").val(n),Checkout.prototype.HideLoader(),$("#StaplesPayOrderIsInProgress").val()==="false"&&t.contentWindow.postMessage("OrderReady","*")):Checkout.prototype.ClearPaymentAndDisplayMessage("We're sorry, your credit-card information was rejected too many times. Please check with your card issuer and try again later.")):Checkout.prototype.ClearPaymentAndDisplayMessage("Staples Pay not available")):this.IsPaymentStaplesPayACI(u)&&($("#paypal-button").hide(),$("#divpurchase-order").hide(),$("#payWithAmazonDiv").hide(),$("#div-CreditCard").hide(),$("#hdnStaplesPayACI").val("true"),$("#hdnStaplesPay").val("false"),t=document.getElementById("resultTarget"),t?(n=parseInt($("input[name=noOfAttempts]").val()),n>0?(n=n-1,$("input[name=noOfAttempts]").val(n),i=$("#resultTarget").attr("src").split("/"),f=i[0]+"//"+i[2],$("#StaplesPayACIOrderIsInProgress").val()==="false"&&t.contentWindow.postMessage({type:"placeOrder",merchantTransactionId:$("input[name=orderNumber]").val()},f)):Checkout.prototype.ClearPaymentAndDisplayMessage("We're sorry, your credit-card information was rejected too many times. Please check with your card issuer and try again later.")):Checkout.prototype.ClearPaymentAndDisplayMessage("Staples Pay ACI not available"))},t.prototype.DisableEnterEventOnCheckoutPage=function(){var n=$(".checkoutLeft").find(".disable_section");t.prototype.DisableEnterEventOnInputs(n);t.prototype.DisableEnterEventOnAnchors(n);t.prototype.DisableEnterEventOnCheckoutButton(n)},t.prototype.DisableEnterEventOnCheckoutRightSection=function(){var n=$(".checkoutRight").find(".cart-variants-column");n.length==0&&(n=$(".checkoutRight").find(".cartDescription"));t.prototype.DisableEnterEventOnInputs(n);t.prototype.DisableEnterEventOnAnchors(n);t.prototype.DisableEnterEventOnCheckoutButton(n)},t.prototype.DisableEnterEventOnInputs=function(n){var t=$(n).find("input");t.attr("disabled",!0);t.attr("tabindex",999)},t.prototype.DisableEnterEventOnAnchors=function(n){var t=$(n).find("a");CommonHelper.prototype.DisableEnterEvent(t);t.attr("tabindex",999)},t.prototype.DisableEnterEventOnCheckoutButton=function(){$("#btnCompleteCheckout").attr("tabindex",999)},t.prototype.EnableDisableKeyEventOnCheckout=function(){t.prototype.EnableEnterEventOnCheckout();t.prototype.DisableEnterEventOnCheckoutPage()},t.prototype.EnableEnterEventOnCheckout=function(){var n=$(".checkoutLeft").not(".disable_section");t.prototype.EnableEnterEventOnInputs(n);t.prototype.EnableEnterEventOnAnchors(n);t.prototype.EnableEnterEventOnCheckoutButton(n);t.prototype.EnableDataCaptureInputsOnCheckout()},t.prototype.EnableDataCaptureInputsOnCheckout=function(){$("#data-capture-content").find("input").each(function(n,t){$(t).attr("is-editable")!==undefined&&($(t).attr("is-editable").toLowerCase()==="true"?$(t).removeAttr("disabled"):$(t).attr("is-editable").toLowerCase()==="false"&&$(t).attr("disabled",!0))});$(".dataCapture").each(function(){var o=$(this).find("[data-test-attr=dataCapture]").attr("is-dependenton-id"),t=$(this).find("[data-test-attr=dataCapture]").attr("value"),u=$(this).find("[data-test-attr=dataCapture]").attr("cat-field-id"),n=$(this).find("[data-test-attr=dataCapture]").attr("options-selected"),i=$(this).find("[data-test-attr=dataCapture]").attr("spp-datacapture-portal-id"),f=parseInt($(this).find("[data-test-attr=dataCapture]").attr("options-count")),e=".SPPDataCaptureDefaultValue_"+i,r=$(this).find(e);$(this).find("[data-test-attr=dataCapture]").attr("is-editable")=="true"?DataCapture.prototype.IsCheckoutPage()?r!=undefined&&r.find("option selected").length>0&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled"):t!=""&&t!=undefined&&t!="[]"&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled"):$(this).find("[data-test-attr=dataCapture]").attr("is-editable")=="false"&&$(this).find("[data-test-attr=dataCapture]").prop("disabled",!0);f>0&&n!=undefined&&n!=""&&n=="true"?DataCapture.prototype.GetChildDataCaptureValueLocales(""+u,""+i):n!=undefined&&n!=""&&n=="true"&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled")})},t.prototype.EnableEnterEventOnInputs=function(n){var t=n.find("input");t.removeAttr("disabled");t.removeAttr("tabindex");CommonHelper.prototype.EnableEnterEvent(t)},t.prototype.EnableEnterEventOnAnchors=function(n){var t=n.find("a");t.removeAttr("tabindex");CommonHelper.prototype.EnableEnterEvent(t)},t.prototype.EnableEnterEventOnCheckoutButton=function(){$("#btnCompleteCheckout").removeAttr("tabindex")},t.prototype.GetPreviewStaplesPAYACIIframe=function(){var n=$("#hdnStaplesPayACI").val(),t=$("#hdnIsPreviewStaplesPay").val();this.IsPaymentStaplesPayACI(n)&&this.IsByPassStaplesPayActive(t)&&CustomEndpoint.prototype.GetCardView(function(n){$("#div-PreviewStaplezPay").html(n);Checkout.prototype.HideLoader()})},t.prototype.EditAddressBegin=function(n){var t=this.IsUserAuthenticated();t==!1&&(window.location.href="/user/login?returnurl=/checkout/index",n.preventDefault());this.HideAddressPopup()},t.prototype.IsUserAuthenticated=function(){var n=!0;return CustomEndpoint.prototype.IsUserAuthenticated(function(t){n=t.status}),n},t}(ZnodeBase),cookieHandler,CustomCart,selectedClipart,selectedDecoCliparts,dict,InitbLazy,CustomConstant,CustomDelegateApproval;$(document).ready(function(){ArtifiAPI.prototype.Preview();cookieHandler={};cookieHandler.setItem=function(n,t,i){var r=new Date,u;i=i?i:"1";r.setTime(r.getTime()+i*864e5);u="expires="+r.toUTCString();document.cookie=n+"="+t+";"+u+";path=/"};cookieHandler.getItem=function(n){for(var r=n+"=",f=decodeURIComponent(document.cookie),u=f.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return""}});__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();CustomCart=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.ValidateProductQuantity=function(){var n=!1;return $("div.cart-products").each(function(){var i=$(this).find('input[name="Quantity"]');$(i).length>0?(n=!0,$(i).each(function(i,r){var u=parseInt($(r).attr("data-cart-minquantity")),f=parseInt($(r).attr("data-cart-maxquantity")),e=$(r).attr("data-productguid"),o=parseInt($(r).attr("data-instockminqty")),s=$(r).attr("data-ismonogramming");n=n&&t.prototype.ValidateCartItemQuantity(r,parseFloat($(r).val()),u,f,e,s,o)})):n=!1}),n},t.prototype.CheckCartQauntity=function(n,i,r){$("#quantity_error_msg_"+i).text("");var u=!1,f=parseInt($(r).attr("data-cart-minquantity")),o=parseInt($(r).attr("data-cart-maxquantity")),e="";return Cart.prototype.CheckIsNumeric(n.toString(),i,e)&&(Cart.prototype.CheckMinMaxQuantity(parseInt(n.toString()),f,o,i,e)?($("#btnCompleteCheckout").removeClass("disable-anchor"),$("#paypal-express-checkout").removeClass("disable-anchor"),u=!0,CommonHelper.prototype.SubmitForm($(r).closest("form"),function(){},!0)):t.prototype.ShowMinQuantityError(r,i,f)),u},t.prototype.UpdateCartComplete=function(n){console.log(n);window.location.reload()},t.prototype.UpdateCartQauntity=function(n){var f=$(n).attr("data-quantity"),u=$(n).attr("data-productguid"),i=$("input[name=Quantity][data-productguid="+u+"]"),o=parseInt($(i).attr("data-cart-minquantity")),w=parseInt($(i).attr("data-cart-maxquantity")),s=parseInt($(i).attr("data-instockminqty")),p,d;$("#quantity_error_msg_"+u).text("");var it=parseInt($(i).attr("data-inventoryRoundOff")),r=$(i).val(),rt=$(n).attr("data-isGiftNotecard"),y=$(i).attr("data-ismonogramming"),ut=$("#ApplyEcertificate").prop("checked");if(parseInt($("#QuoteId").val())>0)if($("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespay"||$("#hdnGatwayName").val()!=undefined&&$("#hdnGatwayName").val().toLowerCase()=="staplespayaci"||$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="staplespay"||$("#budgetSplittablePaymentCode").val()!=undefined&&$("#budgetSplittablePaymentCode").val().toLowerCase()=="credit_card"){if(parseInt(r)>o&&parseInt(r)>parseInt(f)){t.prototype.ShowQuantityErrorMessage(i,u,"QuantityIncreaseCCError",f);return}}else if(($("input[name='PaymentOptions']:checked").attr("data-payment-type")!=undefined&&$("input[name='PaymentOptions']:checked").attr("data-payment-type").toLowerCase()=="budget"||ut)&&parseInt(r)>o&&parseInt(r)>parseInt(f)){t.prototype.ShowQuantityErrorMessage(i,u,"QuantityIncreaseMultiplePaymentError",f);return}if(p=$("#enableDisplayAsPointValue").val(),p!=undefined&&p.toLowerCase()=="true"){var c=0,ft=parseFloat($("#headerBudgetAmount").text()),b=$("#headerCart").find("span.headerSubtotal").text(),l=parseFloat(b.substring(b.indexOf("$")+1)),k=$('span[data-test-selector="spnUnitPrice"][data-productguid="'+u+'"]')[0].nextSibling.textContent,a=parseFloat(k.substring(k.indexOf("$")+1)),v=parseInt(f),h=parseInt(r);if(h>v?(d=h-v,c=l+d*a):h<v?(l-=v*a,c=l+h*a):c=l+h*a,c>ft){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorExceedsPointBudgetBalance"),"error",!0,1e4);return}}var et=$(n).attr("data-config-sku"),ot=$(n).attr("data-cart-productid"),st=$(n).attr("data-cart-ppid"),g=$(n).attr("data-cart-sku");if(t.prototype.ClearError(i,u),f!=r){var nt=0,tt=0,e=!1;return r.split(".")[1]!=null&&(nt=r.split(".")[1].length,tt=parseInt(r.split(".")[1])),s!=undefined&&s!=0&&(o=s),t.prototype.CheckDecimalValue(nt,tt,it,u)&&(t.prototype.CheckIsNumeric(r,u)&&parseFloat(r)>=0&&t.prototype.ValidateCartItemQuantity(i,r,o,w,u,y,s)?t.prototype.IsSufficientCloseoutQuantityAvailable(st,ot,et,parseInt(r))?rt.toLowerCase()=="true"?$("div.cart-products").each(function(){var h=$(this).find('input[name="Quantity"]'),f=0;$(h).length>0?($(h).each(function(n,t){var i=t.getAttribute("data-isEligibleForNotecard");i.toLowerCase()=="true"&&(f+=parseInt($(t).val()))}),parseInt(r)>f?t.prototype.ShowMinMaxQuantityError(i,u,o,f,g,y,s):parseInt(r)<f?t.prototype.CheckSpecialOfferCartRestrictions(n[0].dataset.productguid)?($("#btnCompleteCheckout").removeClass("disable-anchor"),$("#paypal-express-checkout").removeClass("disable-anchor"),e=!0,CommonHelper.prototype.SubmitForm($(i).closest("form"),function(){},!0)):ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorMaxQuantity")+$("#cartLimit").val()+ZnodeBase.prototype.getResourceByKeyName("ErrorForCartRestriction"),"error",isFadeOut,fadeOutTime):parseInt(r)==f?t.prototype.CheckSpecialOfferCartRestrictions(n[0].dataset.productguid)?($("#btnCompleteCheckout").removeClass("disable-anchor"),$("#paypal-express-checkout").removeClass("disable-anchor"),e=!0,CommonHelper.prototype.SubmitForm($(i).closest("form"),function(){},!0)):ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorMaxQuantity")+$("#cartLimit").val()+ZnodeBase.prototype.getResourceByKeyName("ErrorForCartRestriction"),"error",isFadeOut,fadeOutTime):e=!1):e=!1}):t.prototype.CheckSpecialOfferCartRestrictions(n[0].dataset.productguid)?($("#btnCompleteCheckout").removeClass("disable-anchor"),$("#paypal-express-checkout").removeClass("disable-anchor"),e=!0,CommonHelper.prototype.SubmitForm($(i).closest("form"),function(){},!0)):ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorMaxQuantity")+$("#cartLimit").val()+ZnodeBase.prototype.getResourceByKeyName("ErrorForCartRestriction"),"error",isFadeOut,fadeOutTime):t.prototype.ShowInsufficientQuantityError(i,u):t.prototype.ShowMinMaxQuantityError(i,u,o,w,g,y,s)),e!=!0&&($(i).val(f),$("#checkOut-link").removeClass("disable-anchor")),CustomCheckout.prototype.PaymentSummaryBlockCustomization(null),e}},t.prototype.ShowQuantityErrorMessage=function(n,i,r,u){t.prototype.ShowQuantityIncreaseError(n,i,r);$('input[name="Quantity"][data-productguid="'+i+'"]').val(u)},t.prototype.ChangeCartQauntity=function(n){var o=$(n).closest("Div[class='spinner']").find("input[name=Quantity]"),i=o[0],u=$(i).attr("data-productguid"),e;if(t.prototype.ClearError(i,u),typeof i!="undefined"&&i!=null){var s=$(i).val(),r=parseInt(s),f=parseInt($(i).attr("data-cart-minquantity")),h=parseInt($(i).attr("data-cart-maxquantity")),c=parseInt($(i).attr("data-instockminqty")),l=$(i).attr("data-ismonogramming");return r<0?(t.prototype.ShowMinQuantityError(i,u,f),!1):(e=$(i).val(),$(i).val(r),t.prototype.ValidateCartItemQuantity(i,r,f,h,"",l,c)?t.prototype.UpdateCartQauntity(i):($(i).val(e),$("#checkOut-link").removeClass("disable-anchor"),!1))}return $("#checkOut-link").removeClass("disable-anchor"),!1},t.prototype.RemoveCartItem=function(n,t){if(t===void 0&&(t="FALSE"),t.toUpperCase()==="TRUE")CommonHelper.prototype.SubmitForm($(n).closest("form"),function(){},!0);else{var i=$(n).attr("data-productguid"),r=$("input[name=Quantity][data-productguid="+i+"]"),u=$(r).val();return $(r).val(0),typeof n!="undefined"&&n!=null?($("input[name=Quantity][data-productguid="+i+"]").val(u),CommonHelper.prototype.SubmitForm($(n).closest("form"),function(){},!0),!1):($("input[name=Quantity][data-productguid="+i+"]").val(u),$("#checkOut-link").removeClass("disable-anchor"),!1)}},t.prototype.RemoveCartItems=function(n,t){var r,i;if(t===void 0&&(t="FALSE"),t.toUpperCase()==="TRUE")CommonHelper.prototype.SubmitForm($(n).closest("form"),function(){window.location.reload()},!0);else for(r=$(n).attr("data-cart-externalIds").split(","),i=0;i<r.length;i++){var u=r[i],e=$("input[name=Quantity][data-productguid="+u+"]"),f=$(e).val();return typeof n!="undefined"&&n!=null?($("input[name=Quantity][data-productguid="+u+"]").val(f),CommonHelper.prototype.SubmitForm($(n).closest("form"),function(){window.location.reload()},!0),!1):($("input[name=Quantity][data-productguid="+u+"]").val(f),$("#checkOut-link").removeClass("disable-anchor"),!1)}},t.prototype.IsSufficientCloseoutQuantityAvailable=function(n,t,i,r){var u=!0;return i!=null&&CustomEndpoint.prototype.CheckCloseoutQuantity(n,t,i,r,function(n){u=n}),u},t.prototype.ValidateCartItemQuantity=function(n,i,r,u,f,e,o){var h=$(n).attr("data-cart-sku"),s=0;return $("input[name=Quantity][data-parent-cart-lineItemId="+$(n).attr("data-parent-cart-lineItemId")+"]").each(function(n,t){s+=parseFloat($(t).val())}),t.prototype.CheckIsNumeric(Number(s).toString(),f)?t.prototype.CheckMinMaxQuantity(s,r,u,f)?!0:(t.prototype.ShowMinMaxQuantityError(n,f,r,u,h,e,o),!1):!1},t.prototype.ShowInsufficientQuantityError=function(n,t){$("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("QuantityEnteredExceedsQuantityAvailable"));$(n).addClass("error")},t.prototype.ClearError=function(n,t){$(n).removeClass("error");$("#quantity_error_msg_"+t).text("")},t.prototype.ShowMinQuantityError=function(n,t,i){$("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("MinQuantityError").replace(ZnodeBase.prototype.getResourceByKeyName("MinimumOrderQuantityPlaceholder"),i.toString()));$(n).addClass("error")},t.prototype.ShowQuantityIncreaseError=function(n,t,i){$("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName(i));$(n).addClass("error")},t.prototype.ShowMinMaxQuantityError=function(n,t,i,r,u,f,e){var s=0,h=$(n).closest(".cartItem").find(".personalized-attribute").length>0,o;f!=undefined&&f!=null&&f!=""&&(f=f.toLowerCase());$("input[name=Quantity][data-parent-cart-lineItemId="+$(n).attr("data-parent-cart-lineItemId")+"]").each(function(){var i=$(this).attr("data-cart-sku"),t;i==u?(t=$(this).val(),t!=null&&t!=""&&(s+=parseInt(t))):s=$(n).val()});o=s;e>0&&h?o<e&&(f=="true"?($("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("defaultIndividualizedMinErrorMessage")),$(n).addClass("error")):($("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("defaultCustomizedMinErrorMessage")),$(n).addClass("error"))):o<i?($("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("defaultMinErrorMessage")),$(n).addClass("error")):o>r&&($("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("defaultMaxErrorMessage")),$(n).addClass("error"))},t.prototype.CheckDecimalValue=function(n,t,i,r){return t!=0&&n>i?($("#quantity_error_msg_"+r).text(ZnodeBase.prototype.getResourceByKeyName("EnterQuantityHaving")+i+ZnodeBase.prototype.getResourceByKeyName("XNumbersAfterDecimalPoint")),$("#checkOut-link").addClass("disable-anchor"),!1):!0},t.prototype.CheckIsNumeric=function(n,t){var i=n.match(/^-?[\d.]+(?:[e][+-]?\d+)?$/);return i==null?($("#quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("RequiredNumericValue")),$("#checkOut-link").addClass("disable-anchor"),!1):!0},t.prototype.CheckMinMaxQuantity=function(n,t,i,r){return n<t||n>i?($("#quantity_error_msg_"+r).text(ZnodeBase.prototype.getResourceByKeyName("SelectedQuantityBetween")+t+ZnodeBase.prototype.getResourceByKeyName("To")+i+ZnodeBase.prototype.getResourceByKeyName("FullStop")),$("#checkOut-link").addClass("disable-anchor"),!1):!0},t.prototype.OnSuccessRemoveAllCartItems=function(){window.location.href="/home/index"},t.prototype.CancelOrder=function(){Checkout.prototype.ShowLoader();CustomEndpoint.prototype.CancelOrder(function(){window.location.href="/home/index";Checkout.prototype.HideLoader()})},t.prototype.OnSuccuessForRemoveCartItems=function(){Endpoint.prototype.GetCartCount(function(n){if(parseInt(n)>0)return $("#headerCartCount").text(n);window.location.href="/home/index"})},t.prototype.RemoveAppliedCoupon=function(n){var i=coupons[n].Code;coupons=[];t.prototype.RemoveCoupon(i)},t.prototype.RemoveCoupon=function(n){ZnodeBase.prototype.ShowLoader();CustomCheckout.prototype.ShowHideOverageShippingMessage();$("#Apply_coupon").removeClass("d-none");Endpoint.prototype.RemoveCouponCode(n,function(n){CustomCheckout.prototype.CustomDisplayAppliedDiscountCode(n);$("#promocode").val("");var r=$("input[name='PaymentOptions']:checked").attr("id"),t=parseFloat($("#Total").val()),i=parseFloat($("#hdnBudgetBalance_"+r).val()),u=isNaN(parseFloat($("#hdnEcertAvailableTotal").val()))?0:parseFloat($("#hdnEcertAvailableTotal").val());t>i&&(t>i+u?$("#hdnECertAmount").val():$("#hdnECertAmount").val(t-i));CustomCheckout.prototype.PaymentSummaryBlockCustomization(null);ZnodeBase.prototype.HideLoader()})},t.prototype.ShowCouponsMessages=function(n){var r="",t,u,i,f,e;if(coupons=n,coupons.length>0){for(console.log(coupons),t=0;t<coupons.length;t++)u=coupons[t].CouponApplied?"success-msg":"error-msg",i=coupons[t].PromotionMessage,i=="Coupon Successfully Applied."?i=ZnodeBase.prototype.getResourceByKeyName("AcceptedPromoCodeCoupon"):i=="Invalid Coupon Code."&&(i=ZnodeBase.prototype.getResourceByKeyName("InvalidPromoCodeCoupon")),f=coupons[t].Code,e=$("#LabelRemoveCouponCode").val(),Checkout.prototype.RemoveDiscountMessages(),r=$("#hdnisEditCheckboxCompleted").is(":checked")==!1&&$("#hdnImpersonateOrderNumber").val()!=undefined&&$("#hdnImpersonateOrderNumber").val()!=""?r+'<p class="'+u+'"><a class="zf-close removeAppliedCoupon" custom-click="CustomCart.prototype.RemoveAppliedCoupon('+t+')" title="'+e+'"><\/a><strong class="promo-code-code">'+f+'<\/strong> <span class="promo-code-message">'+i+"<\/span><\/p>":r+'<p class="'+u+'"><a class="zf-close removeAppliedCoupon" custom-click="CustomCart.prototype.RemoveAppliedCoupon('+t+')" title="'+e+'"><\/a><strong class="promo-code-code">'+f+'<\/strong> <span class="promo-code-message">'+i+"<\/span><\/p>";$("#couponMessageContainer").html("");$("#couponMessageContainer").html(r);_ApplyCoupon.prototype.BindRemoveCoupon()}},t.prototype.CheckBrowserLocales=function(){var n=$("#portalLocales").val(),t=$("#browserLocalesCheckFlag").val(),i=navigator.language;return t=="True"&&n&&n.indexOf(i)==-1?($(".cart-page-checkout-button").attr("href",""),$(".cart-page-checkout-button").attr("data-toggle","modal"),$("#cartStaticBackdrop").modal("show"),!1):($(".cart-page-checkout-button").attr("data-toggle",""),$("#cartStaticBackdrop").modal("hide"),$(".cart-page-checkout-button").attr("href","/checkout/index"),!0)},t.prototype.CheckSpecialOfferCartRestrictions=function(n){var u="",i=$("input[name='Quantity']"),t,r;if($("#continue-button").show(),i.length>0)for(t=0;t<i.length;t++)if(i[t].getAttribute("data-productguid")==n){u=i.eq(t).val();break}return r=!0,CustomEndpoint.prototype.IsSpecialOfferCartRestrictionsDisabled(n,u,0,function(n){return n.status?$("#continue-button").show():(r=n.status,$("#continue-button").hide()),r}),r},t.prototype.EnableDisableGiftcardQuantity=function(n){var l=$(n).attr("data-quantity"),i=$(n).attr("data-productguid"),r=$("input[name=NotecardQuantity][data-productguid="+i+"]"),a=parseInt($(r).attr("data-cart-minquantity")),e=parseInt($(r).attr("data-cart-maxquantity")),c,o,h;$("#notecard_quantity_error_msg_"+i).text("");$("#notecard_quantity_error_msg").text("");var f=$(r).val(),s=$(r).attr("data-cart-productid"),u=!1;if(t.prototype.CheckNotecardIsNumeric(f,i)&&t.prototype.CheckNotecardIsDecimal(f,i))if(parseInt(f)<a)$("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.MinNotecardQtyError(r,i);else if(parseInt(f)>e)$("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.MaxNotecardQtyError(r,i);else if(parseInt(f)<e){for(c=$("input[name=NotecardQuantity]").not(":disabled"),o=0,h=0;h<c.length;h++){var v=$(c[h]).attr("data-productguid"),y=$("input[name=NotecardQuantity][data-productguid="+v+"]"),p=$(y).val();o=o+parseInt(p)}o<e?typeof $("input[name=NotecardQuantity]:disabled")[0]!="undefined"?($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.UpdateQuantityOfNotecard(r,i,f,s),u&&$("input[name=NotecardQuantity]:disabled")[0].removeAttribute("disabled")):typeof $("input[name=NotecardQuantity]:disabled")[0]=="undefined"&&o<e?($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.UpdateQuantityOfNotecard(r,i,f,s)):($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.MinNotecardQtyError(r,i)):o==e?($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.UpdateQuantityOfNotecard(r,i,f,s)):($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.MaxNotecardQtyError(r,i))}else parseInt(f)==e?($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.UpdateQuantityOfNotecard(r,i,f,s)):($("#notecard_quantity_error_msg_"+i).text(""),$("#notecard_quantity_error_msg").text(""),u=t.prototype.MaxNotecardQtyError(r,i));return u!=!0&&($(r).val(l),$("#checkOut-link").removeClass("disable-anchor")),u},t.prototype.UpdateQuantityOfNotecard=function(n,t,i,r){return CustomEndpoint.prototype.UpdateNotecardQuantity(t,i,r,function(i){if(!i)return $(n).addClass("error"),$("#notecard_quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("NotecardMaxErrorMessage")),!1}),$(n).removeClass("error"),$("#checkOut-link").removeClass("disable-anchor"),$("#btnCompleteCheckout").removeClass("disable-anchor"),!0},t.prototype.CheckNotecardIsDecimal=function(n,t){return n.indexOf(".")!=-1?($("#notecard_quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("RequiredNumericValue")),$("#checkOut-link").addClass("disable-anchor"),!1):!0},t.prototype.CheckNotecardIsNumeric=function(n,t){var i=n.match(/^-?[\d.]+(?:[e][+-]?\d+)?$/);return i==null?($("#notecard_quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("RequiredNumericValue")),$("#checkOut-link").addClass("disable-anchor"),!1):!0},t.prototype.MinNotecardQtyError=function(n,t){return $("#notecard_quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("NotecardMinErrorMessage")),$(n).addClass("error"),$("#checkOut-link").addClass("disable-anchor"),$("#btnCompleteCheckout").addClass("disable-anchor"),!1},t.prototype.MaxNotecardQtyError=function(n,t){return $("#notecard_quantity_error_msg_"+t).text(ZnodeBase.prototype.getResourceByKeyName("NotecardMaxErrorMessage")),$(n).addClass("error"),$("#checkOut-link").addClass("disable-anchor"),$("#btnCompleteCheckout").addClass("disable-anchor"),!1},t.prototype.ValidateNotecardItemQuantity=function(){var n=!1;return $("div.cart-products").each(function(){var i=$(this).find('input[name="Quantity"]'),r=i.filter("[data-isgiftnotecard = True]"),u=r.val(),f=r.attr("data-productguid"),t=0;$(i).length>0&&$(r).length>0?($(i).each(function(n,i){var r=i.getAttribute("data-isEligibleForNotecard");r.toLowerCase()=="true"&&(t+=parseInt($(i).val()))}),parseInt(u)>t?($("#quantity_error_msg_"+f).text(ZnodeBase.prototype.getResourceByKeyName("defaultMaxErrorMessage")),n=!1):n=parseInt(u)==t?!0:parseInt(u)<t?!0:!1):n=!0}),n},t.prototype.ValidateNotecardProductQuantity=function(){var n=!1;return t.prototype.ValidateNotecardItemQuantity()?$("div.cart-products").each(function(){var i=$(this).find('input[name="NotecardQuantity"]'),r=parseInt(i.first().attr("data-cart-maxquantity")),u=parseInt(i.first().attr("data-cart-minquantity")),t=0;$(i).length>0?($(i).each(function(n,i){t+=parseInt($(i).val())}),t>r?($("#notecard_quantity_error_msg").text(ZnodeBase.prototype.getResourceByKeyName("NotecardMaxErrorMessage")),$("#checkOut-link").addClass("disable-anchor"),n=!1):t<r?($("#notecard_quantity_error_msg").text(ZnodeBase.prototype.getResourceByKeyName("NotecardMinErrorMessage")),$("#checkOut-link").addClass("disable-anchor"),n=!1):t<u?($("#notecard_quantity_error_msg").text(ZnodeBase.prototype.getResourceByKeyName("NotecardMinErrorMessage")),$("#checkOut-link").addClass("disable-anchor"),n=!1):t==r&&(n=!0)):n=!0}):n=!1,n},t.prototype.ValidatePointBudgetBalanceOnCheckoutButton=function(){var n=$("#enableDisplayAsPointValue").val();if(n!=undefined&&n.toLowerCase()=="true"){var t=$("#headerCart").find("span.headerSubtotal").text(),i=parseFloat(t.substring(t.indexOf("$")+1)),r=parseFloat($("#headerBudgetAmount").text());if(i>r)return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorExceedsPointBudgetBalance"),"error",!0,1e4),!1;window.location.href="checkout/index"}else window.location.href="checkout/index"},t}(ZnodeBase);$(document).ready(function(){ArtifiAPI.prototype.Preview();ArtifiAPI.prototype.Edit()});var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),CustomEndpoint=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.GetEntityAttributeUserDetails=function(t){n.prototype.ajaxRequest.call(this,"/customuser/getentityattributeuserdetails","get",{},t,"json",!1)},t.prototype.DeleteUploadedLogo=function(t,i){n.prototype.ajaxRequest.call(this,"/customuser/deleteuploadedlogo","delete",{code:t},i,"json",!1)},t.prototype.LoadUplodedLogoList=function(t,i){n.prototype.ajaxRequest.call(this,"/customuser/getuplodedlogolist","post",{userinfo:t},i,"html",!1)},t.prototype.AddAllocatedLineItems=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/addallocatedlineitems","post",{allocatedLines:t,additionalInformation:i},r,"json",!1)},t.prototype.GetAllocationLineHtml=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/getallocationlinehtml","get",{externalId:t,sequence:i},r,"json",!1)},t.prototype.GetPortalCustomizationSettings=function(t,i){n.prototype.ajaxRequest.call(this,"/artificheckout/getartificredentials","get",{portalId:t},i,"json")},t.prototype.UpdateEventDate=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/customcart/updateeventdate","post",{inHandsDate:t,dayCount:i,eventDate:r},u,"json",!1)},t.prototype.GetStateByCountryCode=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/getstatebycountrycode","get",{countryCode:t},i,"json",!1)},t.prototype.GetProductLeadTime=function(t,i){n.prototype.ajaxRequest.call(this,"/customproduct/getleadtime","get",{productId:t},i,"json",!0)},t.prototype.GetProduct=function(t,i){var u=$('input[name="requestVerification"]').val(),f=u.split(" ")[3].split("=")[1],r=f.replace(/"/g,"");$('input[name="__RequestVerificationToken"]').val(r);n.prototype.ajaxRequest.call(this,"/customproduct/getconfigurableproduct","post",{__RequestVerificationToken:r,model:t},i,"html")},t.prototype.GetDataCaptureFields=function(t,i,r,u){r===void 0&&(r=0);var f=t!=undefined&&t!=null&&t!=""?t.toLowerCase():t;n.prototype.ajaxRequest.call(this,"/customdatacapture/getdatacapturefields","get",{pagename:f,paymentsettingid:i,profileid:r},u,"json",!1)},t.prototype.AddDataCapture=function(t,i,r){var u=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customcheckout/adddatacapture","post",{__RequestVerificationToken:u,dataCapture:t,omsQuoteId:i},r,"json",!1)},t.prototype.ValidateDataCapture=function(t,i){var r=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customdatacapture/validatedatacapture","post",{__RequestVerificationToken:r,dataCapture:t},i,"json",!1)},t.prototype.GetPersonalizeDesignId=function(t,i,r){var u=i!=undefined&&i!=null&&i!=""?i.toLowerCase():i;n.prototype.ajaxRequest.call(this,"/customproduct/getpersonalizedesignid","get",{sku:t,colorcode:u},r,"json",!1)},t.prototype.CheckCloseoutQuantity=function(t,i,r,u,f){n.prototype.ajaxRequest.call(this,"/customproduct/checkcloseoutquantity","get",{parentproductid:t,productid:i,sku:r,quantity:u},f,"json",!1)},t.prototype.GetPublishProductDetails=function(t,i,r){var u=i!=undefined&&i!=null&&i!=""?i.toLowerCase():i;n.prototype.ajaxRequest.call(this,"/customcart/getpublishproductdetails","get",{skus:t,publishproductdetails:u},r,"json",!1)},t.prototype.CheckCloseoutQtyWithSession=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/customproduct/checkcloseoutquantitywithsession","get",{dataSKU:t,dataSKUQty:i,dataSKUInStock:r},u,"json",!1)},t.prototype.CreateB2BQuote=function(t,i){var r=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customuser/createb2bquote",Constant.Post,{__RequestVerificationToken:r,submitQuoteViewModel:t},i,"json")},t.prototype.GetCreditCardScript=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/getcreditcardscript",Constant.Post,{paymentModel:t},i,"json",!0)},t.prototype.GetStaplesPayScript=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/getstaplespayscript",Constant.Post,{paymentModel:t},i,"json",!0)},t.prototype.GetStaplesPayWalletConfiguration=function(t,i,r,u,f){var e=t!=undefined&&t!=null&&t!=""?t.toLowerCase():t,o=r!=undefined&&r!=null&&r!=""?r.toLowerCase():r;n.prototype.ajaxRequestWithoutCache.call(this,"/customcheckout/getstaplespaywalletconfiguration",Constant.GET,{paymentcode:e,isstaplespay:i,linccompanycode:o,isapplepay:u},f,"json",!0)},t.prototype.GetStaplesPayGUID=function(t){n.prototype.ajaxRequestWithoutCache.call(this,"/customcheckout/getstaplespayguid",Constant.GET,null,t,"json",!0)},t.prototype.GetAccountAddress=function(t,i,r,u,f,e,o,s){var h=e!=undefined&&e!=null&&e!=""?e.toLowerCase():e;n.prototype.ajaxRequest.call(this,"/customcheckout/getuseraddress",Constant.GET,{addresstype:t,userid:i,quoteid:r,addressid:u,otheraddressid:f,shippingexternalid:h,selectedpaymentsettingid:o},s,"json",!1)},t.prototype.GetcartReview=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/checkout/getcartdetails",Constant.GET,{shippingOptionId:t,shippingAddressId:i,shippingCode:r},u,"json",!1)},t.prototype.GetLoginUserAddress=function(t,i,r){n.prototype.ajaxRequest.call(this,"/checkout/accountaddress",Constant.GET,{userid:t,quoteId:i},r,"html",!1)},t.prototype.GetBillingAddress=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/customcheckout/getbillingaddress",Constant.GET,{addressId:t,addressType:i,isSameAsBilling:r},u,"json",!1)},t.prototype.ApplyECertificate=function(t,i,r,u,f,e){var o=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customcheckout/applyecertificate",Constant.Post,{__RequestVerificationToken:o,isChecked:t,amountToBeApplied:i,isTaxExempt:r,omsQuoteId:u},e,"json",!0)},t.prototype.calculateCart=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/calculatecart",Constant.GET,{paymentSettingId:t},i,"html",!0)},t.prototype.GetCartSubTotal=function(t){n.prototype.ajaxRequestWithoutCache.call(this,"/customproduct/getcartsubtotal",Constant.GET,{},t,"json",!0)},t.prototype.SelectBrand=function(t,i){n.prototype.ajaxRequest.call(this,"/custombrand/selectbrand",Constant.GET,{brandId:t},i,"json")},t.prototype.SearchBrand=function(t,i){n.prototype.ajaxRequest.call(this,"/custombrand/searchbranddata",Constant.GET,{searchKeyword:t},i,"html")},t.prototype.GetBrandData=function(t){n.prototype.ajaxRequest.call(this,"/custombrand/getbrandlistpopup",Constant.GET,{},t,"html")},t.prototype.SetRecentlyProductDetails=function(t,i){var u=$('input[name="requestVerification"]').val(),f=u.split(" ")[3].split("=")[1],r=f.replace(/"/g,"");$('input[name="__RequestVerificationToken"]').val(r);n.prototype.ajaxRequest.call(this,"/customproduct/setrecentlyviewproduct",Constant.Post,{__RequestVerificationToken:r,productdetails:t},i,"json",!1)},t.prototype.GetRecentlyViewProducts=function(t,i){n.prototype.ajaxRequest.call(this,"/product/getrecentviewproducts",Constant.Post,{recentproductlist:t},i,"html",!1)},t.prototype.GetPendingShopperLoginRequests=function(t,i){n.prototype.ajaxRequest.call(this,"/customuser/getpendingshopperloginrequests",Constant.GET,{ApprovalStatus:t},i,"html",!1)},t.prototype.DeleteUserDataCapture=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customuser/deleteuserdatacapture",Constant.GET,{dataCapturePortalAttributeId:t,userId:i},r,"json")},t.prototype.GetArtifiLogoUrl=function(t){n.prototype.ajaxRequest.call(this,"/custombrand/getartifilogourl",Constant.GET,{},t,"json")},t.prototype.GetProductDetailBySKU=function(t,i){n.prototype.ajaxRequest.call(this,"/customproduct/getproductdetailbysku","get",{searchTerm:t},i,"json",!1)},t.prototype.GetPaymentSettings=function(t){n.prototype.ajaxRequest.call(this,"/customcheckout/getpaymentdetailsforselfcheckout",Constant.GET,{},t,"json")},t.prototype.CancelOrder=function(t){n.prototype.ajaxRequest.call(this,"/customcart/cancelorder",Constant.GET,{},t,"json")},t.prototype.AddAnotherEcert=function(t){n.prototype.ajaxRequest.call(this,"/customproduct/getecertfields",Constant.GET,{},t,"html",!1)},t.prototype.AssortmentRedirect=function(t,i){n.prototype.ajaxRequest.call(this,"/product/assortmentredirect",Constant.GET,{productSKU:t},i,"json")},t.prototype.LoadECertOveragePaymentMethods=function(t,i){var r=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customcheckout/loadecertoveragepaymentmethods",Constant.Post,{__RequestVerificationToken:r,OmsQuoteId:t},i,"json",!0)},t.prototype.UpdateOrderPaymentListInSession=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/updateorderpaymentlistinsession",Constant.Post,{orderPaymentList:t,omsQuoteId:i},r,"json",!1)},t.prototype.ValidateMultipleAccountsDataCaptures=function(t,i){var r=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customdatacapture/validatemultipleaccountsdatacaptures","post",{__RequestVerificationToken:r,dataCaptures:t},i,"json",!1)},t.prototype.GetCardView=function(t){n.prototype.ajaxRequestWithoutCache.call(this,"/customcheckout/staplespreviewcard",Constant.GET,{},t,"html",!0)},t.prototype.GetBudgetShippingErrorMessage=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/getbudgetshippingerrormessage",Constant.GET,{paymentMethodName:t,balance:i},r,"json",!1)},t.prototype.ShippingOptions=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/paymentshippingoptions",Constant.GET,{paymentsettingid:t},r,"html",i)},t.prototype.GetStaplesPayACICheckoutId=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/getstaplespayacicheckoutid",Constant.Post,{staplesPayACICreditCardModel:t},i,"json",!0)},t.prototype.GetApplePayCheckoutId=function(t,i){n.prototype.ajaxRequest.call(this,"/customcheckout/getapplepaycheckoutid",Constant.Post,{applePayModel:t},i,"json",!0)},t.prototype.IsSpecialOfferCartRestrictionsDisabled=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/customcart/isspecialoffercartrestrictionsdisabled",Constant.Post,{guid:t,quantity:i,productId:r},u,"json",!1)},t.prototype.IsSpecialOfferOrderRestrictionsDisabled=function(t){n.prototype.ajaxRequest.call(this,"/customcheckout/isspecialofferorderrestrictionsdisabled",Constant.Post,{},t,"json",!1)},t.prototype.GetUpdatedBudgetBalance=function(t){n.prototype.ajaxRequest.call(this,"/customuser/getupdatedbudgetbalance",Constant.GET,{},t,"json",!1)},t.prototype.UpdateAdditionalNote=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/updateadditionalnotes",Constant.Post,{additionalNotes:t,omsOrderId:i},r,"json",!0)},t.prototype.ClearImpersonationSessionValues=function(t){n.prototype.ajaxRequest.call(this,"/customcart/clearimpersonationsessionvalues",Constant.GET,{},t,"json",!0)},t.prototype.UpdateNotecardQuantity=function(t,i,r,u){n.prototype.ajaxRequest.call(this,"/customcart/updatenotecardquantity",Constant.Post,{productGuid:t,selectedQty:i,productid:r},u,"json")},t.prototype.AddSaveForLaterProduct=function(t,i){var r=$("[name='__RequestVerificationToken']").val();n.prototype.ajaxRequest.call(this,"/customproduct/addsaveforlaterdetails",Constant.Post,{__RequestVerificationToken:r,model:t},i,"json",!0)},t.prototype.DeleteSaveForLaterProduct=function(t,i){n.prototype.ajaxRequest.call(this,"/saveforlater/delete",Constant.GET,{userwishlistid:t},i,"json",!0)},t.prototype.SaveShowAtSiteEntryDataInCookie=function(t,i){n.prototype.ajaxRequest.call(this,"/customdatacapture/saveshowatsiteentrydataincookie",Constant.Post,{dataCaptureJson:t},i,"html",!1)},t.prototype.GetShowAtSiteEntryDataFromCookie=function(t){n.prototype.ajaxRequest.call(this,"/customdatacapture/getshowatsiteentrydatafromcookie",Constant.GET,{},t,"json",!1)},t.prototype.GetShowAtSiteEntryDataInModelFromCookie=function(t){n.prototype.ajaxRequest.call(this,"/customdatacapture/getshowatsiteentrydatainmodelfromcookie",Constant.GET,{},t,"json",!1)},t.prototype.GetIndividualisedAttributesWithMaxChar=function(t,i,r,u,f,e){n.prototype.ajaxRequest.call(this,"/customproduct/getindividualisedattributeswithmaxchar",Constant.GET,{productId:t,personalisedCodeValue:i,isCustomizationRequired:r,requiredOptionalLoc:u,counter:f},e,"html",!0)},t.prototype.SaveShortTermOfferFlagCookie=function(t,i){n.prototype.ajaxRequest.call(this,"/customdatacapture/saveshorttermofferflagdataincookie",Constant.Post,{shortTermOfferFalg:t},i,"html",!1)},t.prototype.GetShowAtSiteEntryDCCountFromCookie=function(t){n.prototype.ajaxRequest.call(this,"/customdatacapture/getshowatsiteentrydccountfromcookie",Constant.GET,{},t,"json",!1)},t.prototype.RemoveShowAtSiteEntryDCCountFromCookie=function(t){n.prototype.ajaxRequest.call(this,"/customdatacapture/removeshowatsiteentrydccountfromcookie",Constant.GET,{},t,"json",!0)},t.prototype.GetPartialDataCaptureView=function(t){n.prototype.ajaxRequest.call(this,"/customdatacapture/datacapture",Constant.GET,{},t,"html",!0)},t.prototype.GetCategoryValidationDetails=function(t,i){n.prototype.ajaxRequest.call(this,"/customcategoryaccessdenied/validatecategory",Constant.GET,{categoryId:t},i,"json",!1)},t.prototype.GetAddressByIdFromAddressService=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/getaddressbyidfromaddressservice",Constant.GET,{addressid:t,selectedpaymentsettingid:i},r,"json",!1)},t.prototype.GetCaptureReferringURLDataFromCookie=function(t){n.prototype.ajaxRequest.call(this,"/CustomDataCapture/GetCaptureReferringURLDataFromCookie",Constant.GET,{},t,"json",!1)},t.prototype.GetMultiLocationIndividualisedAttributes=function(t,i){n.prototype.ajaxRequest.call(this,"/CustomProduct/GetMultiLocationIndividualisedAttributes",Constant.Post,{personalizedDataViewModel:t},i,"html",!0)},t.prototype.IsUserAuthenticated=function(t){n.prototype.ajaxRequest.call(this,"/customcheckout/isuserauthenticated",Constant.GET,{},t,"json",!1)},t.prototype.AddEmptyDataCaptureLogs=function(t,i,r){n.prototype.ajaxRequest.call(this,"/customcheckout/addemptydatacapturelogs",Constant.GET,{exception:t,deviceDetails:i},r,"json",!0)},t.prototype.AddEmptyPersonalisedDataLogs=function(t,i,r,u,f,e,o){n.prototype.ajaxRequest.call(this,"/customProduct/addemptypersonaliseddatalogs",Constant.Post,{artifiProductSku:t,productSku:i,selectedColorCode:r,url:u,personalisedValues:f,errorresponse:e},o,"json",!0)},t}(ZnodeBase),__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),ArtifiAPI=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.Init=function(){},t.prototype.GetArtifiPortalCredentials=function(n,t){var r="ArtifiPortalConfiguration_"+n,i;sessionStorage.getItem(r)==null||sessionStorage.getItem(r)=="undefined"?CustomEndpoint.prototype.GetPortalCustomizationSettings(n,function(n){t(n)}):typeof Artifi?(i=JSON.parse(sessionStorage.getItem(r)),$.getScript(i.JsUrl+artifiIntegrationUrl,function(){t(i)})):(i=JSON.parse(sessionStorage.getItem(r)),t(i))},t.prototype.UpdateUserId=function(n,i,r){if(n&&n!="0")t.prototype.GetArtifiPortalCredentials(r,function(t){var i={websiteId:t.WebsiteCode,webApiclientKey:t.WebApiClientKey,jsUrl:t.JsUrl,newUserId:t.userId,oldUserId:n,isGuest:!0};$.getScript(i.jsUrl+artifiIntegrationUrl,function(){Artifi.UpdateUserId(i)})})},t.prototype.UpdateProductOrderStatus=function(n,i,r){if(n)t.prototype.GetArtifiPortalCredentials(r,function(t){var i={websiteId:t.WebsiteCode,webApiclientKey:t.WebApiClientKey,jsUrl:t.JsUrl,customizedProductIds:n,orderStatus:"Placed"};$.getScript(i.jsUrl+artifiIntegrationUrl,function(){Artifi.UpdateMultipleCustomizedProductOrderStatus(i);$("#isLoggedInUser").val()=="False"&&localStorage.setItem("UserId",Math.floor((1+Math.random())*16777216).toString())})})},t.prototype.Preview=function(){$(document).on("click",".artifi-previewproduct",function(n){n.preventDefault();$("#preview-popup-content").html("");var i=this;t.prototype.GetArtifiPortalCredentials($("#portalId").val(),function(n){var t={websiteId:n.WebsiteCode,webApiclientKey:n.WebApiClientKey,jsUrl:n.JsUrl,userId:n.userId,productCode:$(i).data("sku"),designId:$(i).data("customizeproductid"),height:"100%",width:"100%"};$.getScript(t.jsUrl+artifiIntegrationUrl,function(){var n=Artifi.getPreviewUrl(t);$("#preview-popup-content").html("<iframe src='"+n+"' height='500px' width='100%' frameborder='0' style='position: relative;'><\/iframe>")})})})},t.prototype.Edit=function(){$(".artifi-design-edit").each(function(n,i){t.prototype.GenerateEditProductUrl(i)});$(document).off("click",".artifi-design-edit");$(document).on("click",".artifi-design-edit",function(n){n.preventDefault();t.prototype.GenerateEditProductUrl(this);window.location.href=_url})},t.prototype.GenerateEditProductUrl=function(n){_url=$(n).data("seopagename")?"../"+$(n).data("seopagename")+"?parentomssavedcartlineitemid="+$(n).data("parentomssavedcartlineitem")+"":"product/"+$(n).data("productid")+"/"+$(n).data("parentomssavedcartlineitem")+""},t}(ZnodeBase),__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)};artifiImageIntegrationUrl="/Script/Sasintegration/ArtifiImageGenerator.js";artifiIntegrationUrl="/Script/Sasintegration/ArtifiIntegration.js";selectedDecoCliparts=[];dict=[];omsSavedCartLineItemIds=[];var cartSelectedCliparts=$("#selectedClipartCode").val(),persistedText={},persistedTextDecoLocation=0,persistedMonogramQuantity={},persistedMonogramIndex=0,persistedMonogramForm={},monogramForm,IsValidate=!0,IsLeadTimeCalled=!0,fuzzyObj={ClipartName:[],Code:[]},fuzzyArray=[],uploadedImageClipArts=[],cartItemUploadedImagesJson={UploadedImages:[]},dummyLogoDecoJson={DummyLogos:[]},SelectedElements={SelectedDecoration:[]},ClipArtViewModelList=[],uploadPopulateLogodecorationLocationCliparts=[],ArtifiModel=function(){function n(){}return n}(),CustomProduct=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.CheckConfigurableProductQuantity=function(){var n,t;return $("#QuickViewQuantiyErrorMessage").text(""),n=0,$("#dynamic-product-variations .quantity").each(function(){var i=parseInt($("#scrollReview form").children("#dynamic-productid").val()),t=Product.prototype.BindProductModel(this,!0),r=$("#ShowAddToCart").val();t.Quantity!=null&&t.Quantity!=""&&Product.prototype.CheckIsNumeric(t.Quantity,i,t.QuantityError)&&Product.prototype.CheckDecimalValue(t.DecimalPoint,t.DecimalValue,t.InventoryRoundOff,i,t.QuantityError)&&Product.prototype.CheckQuantityGreaterThanZero(t.MaxQuantity,parseFloat(t.Quantity),parseInt(t.Quantity),i,t.QuantityError)&&(n+=parseFloat(t.Quantity))}),t=parseInt($("#Quantity").val()),t!=null&&(n=t),n<1?!1:!0},t.prototype.BindAddOnProductWithoutDummyLogoSKU=function(n,i){var ht=$("#enableDisplayAsPointValue").val(),w,y,l,a,lt,rt,b,h,s,at,u,ut,d,g,ft,yt,et,v,ot,nt,o,c,tt,st,r;if(ht!=undefined&&ht.toLowerCase()=="true"&&!t.prototype.ValidateAddToCartProductCountWithPointBudgetBalanceLimit())return i.preventDefault(),ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorExceedsPointBudgetBalance"),"error",!0,1e4),!1;var pt=$("#IsEnableLogoUpload").val()!=undefined&&$("#IsEnableLogoUpload").val()!=null&&$("#IsEnableLogoUpload").val().toLowerCase()==="true"?!0:!1,wt=$("#UploadedCliparts").val()!=undefined&&$("#UploadedCliparts").val()!=null?$("#UploadedCliparts").val():"",bt=$("#IsForceToUpload").val()!=undefined?!0:!1;if(pt&&bt&&wt=="")return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorRequiredLogoUpload"),"error",!0,1e4),!1;if(w=!0,y=$("#IsDecorationRequired").val(),y!=undefined&&y!=null&&y!=""&&y.toString()==="true"){var kt=$("#InitialKey").val(),f=$("#decorationOMSCodes").val().split(","),p=!0,ct=!1;for(l=0;l<f.length;l++)if(!$("#decoration-func-"+f[l]).is(":hidden"))if(!$("#required_"+f[l]).is("[disabled=disabled]")||$("#IsDecorationOptional_"+f[l]).val().toLowerCase()==="true"){p=!0;ct=!0;break}else p=!1;if(!ct)for(a=0;a<f.length;a++)$("#frmPersonalised_"+a.toString())!=undefined&&$("#frmPersonalised_"+a.toString()).find("input").each(function(){if(!$("#decoration-func-"+f[a]).is(":hidden")){if($(this).val()!=="")return p=!0,!1;p=!1}});if(p===!1)return $("#mustDecorationError").removeAttr("hidden"),$("html, body").animate({scrollTop:$("#mustDecorationError").offset().top-200},200),w=!1,!1;w=!0}if(w){var kt=$("#InitialKey").val(),f=$("#decorationOMSCodes").val().split(","),dt=$("#UploadedCliparts").val(),it="";for(u=0;u<f.length;u++)lt=f.length-1,rt=$("#IsDecorationOptional_"+f[u].toString()).val(),rt!==undefined&&rt.toString()==="false"&&dt.toString().indexOf(f[u].toString())===-1&&(it+=lt===u?f[u].toString():f[u].toString()+",");if(it!==""){for(b=!1,h=it.split(","),s=0;s<h.length;s++)if(at=h.length-1,$("#decoration-func-"+h[s].toString()).is(":hidden"))continue;else $("#erro_message_"+h[s].toString()).val()!==undefined&&(at===s?($("#erro_message_"+h[s].toString()).show(),b=!0):($("#erro_message_"+h[s].toString()).show(),b=!0));if(b)return i.preventDefault(),!1}}var k=$("#UploadedCliparts").val(),e=JSON.parse($("#ListOfDummyLogo").val()),vt="";if(e.length>0)if(k==="")for(u=0;u<e.length;u++)vt+=e[u].Key+":",r=$("#divDecoration-"+e[u].Key.toString()).attr("data-views"),r!==""&&t.prototype.PopulateUploadedLogos(vt,r,"false",!0);else for(ut=k.split(","),d=0;d<ut.length;d++){for(o=ut[d].split(":"),c=!1,g=0;g<e.length;g++)if(e[g].Key.toString()===o[0].toString()){c=!0;break}c===!1&&(ft="",ft+=o[0].toString()+":",r=$("#divDecoration-"+o[0].toString()).attr("data-views"),r!==""&&t.prototype.PopulateUploadedLogos(ft,r,"false",!0))}if(yt=this.BindAddOnProductSKU(n,i),et="",e.length>0)if(k==="")for(v=0;v<e.length;v++)et+=e[v].Key+":"+e[v].Value,r=$("#divDecoration-"+e[v].Key.toString()).attr("data-views"),r!==""&&t.prototype.PopulateUploadedLogos(et,r,"true",!0);else for(ot=k.split(","),nt=0;nt<ot.length;nt++){for(o=ot[nt].split(":"),c=!1,tt=0;tt<e.length;tt++)if(e[tt].Key.toString()===o[0].toString()){c=!0;break}c===!1&&(st="",st+=o[0].toString()+":"+o[1].toString(),r=$("#divDecoration-"+o[0].toString()).attr("data-views"),r!==""&&t.prototype.PopulateUploadedLogos(st,r,"true",!0))}return yt},t.prototype.BindAddOnProductSKU=function(n,i){function wi(n){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)}var si=$('input[name="requestVerification"]').val(),hi=si.split(" ")[3].split("=")[1],ci=hi.replace(/"/g,""),v,s,c,et,l,it,dt,gt,r,ri,ft,ei,oi;if($('input[name="__RequestVerificationToken"]').val(ci),i.preventDefault(),v=$(n).closest("form").children("#dynamic-producttype").val(),v=="GroupedProduct"){if(isAddToCartGroupProduct==!1)return!1}else if(v=="ConfigurableProduct"){if(isAddToCartGroupProduct==!1)return!1}else if(Product.prototype.OnQuantityChange()==!1)return!1;if(s=$("#isMonogramming").val(),s!=undefined&&s!=null&&s!=""&&(s=s.toLowerCase()),c=s=="true"?JSON.stringify(t.prototype.SetChildProductPersonalizeData()):JSON.stringify(t.prototype.GetCustomizedProductPersonalizeData()),et=$("#counterForAddToCart").val(),$("#OptionalTexts-"+et).val()!==undefined){if($("#OptionalTexts-"+et).is(":hidden")===!0&&(l=!0,$('div[data-test-selector^="divPersonalisedAttribute_"]').each(function(){$(this).is(":hidden")||$(this).children(".personalized-attributes-body").children("form").valid()||(l=!1)}),$(".input-validation-error").length>0&&$("html, body").animate({scrollTop:$(".input-validation-error").offset().top-200},200),!l))return!1}else if(l=!0,$('div[data-test-selector^="divPersonalisedAttribute_"]').each(function(){$(this).is(":hidden")||$(this).children(".personalized-attributes-body").children("form").valid()||(l=!1)}),s&&JSON.parse(c).PersonalizationData.length>0&&(it=[],$("[data-gridquantity]").length>0?$("#dynamic-product-variations").find("[data-gridquantity]").each(function(){var n=$(this).val(),r=$(this).attr("data-sku"),i=[];n!=null&&n!=""&&(i=t.prototype.UpdateOptionalLocation(r,c),it.push(i))}):$("#dynamic-product-variations").find("#Quantity:visible").each(function(){var n=$(this).val(),r=$(this).attr("data-sku"),i=[];n!=null&&n!=""&&(i=t.prototype.UpdateOptionalLocation(r,c),it.push(i))}),t.prototype.ValidateOptionalLocations(it),$(".input-validation-error").length>0&&(l=!1)),$(".input-validation-error").length>0&&$("html, body").animate({scrollTop:$(".input-validation-error").offset().top-200},200),!l)return!1;var ot=[],st=[],ht="",h="",u="",y="",o=[],f=[],yt=[],pt=[],wt=[],ct="",rt=!0,lt=!0;$(".chk-product-addons").each(function(){var e=$(this).data("isoptional"),n=$(this).data("displaytype"),r=$(this).attr("id"),u=$(this).data("addongroupid"),i,t,f;e=="False"?rt=!0:(i=!0,n!=""&&(t="",n=n.toLowerCase(),n=="checkbox"&&($("#"+r+" input[type=checkbox]:checked").length>0&&(i=!1),t="paraCommentCheckBox-"),n=="radiobutton"&&($("#"+r+" input[type=radio]:checked").length>0&&(i=!1),t="paraCommentRadioButton-"),n=="dropdown"&&(f=$("#"+r).find("option:selected").val()=="0"||$("#"+r).find("option:selected").val()==undefined?!1:!0,f&&(i=!1),t="paraCommentDropDown-"),i?($("#"+t+u).removeAttr("style"),rt=!1):($("#"+t+u).css("display","none"),rt=!0),rt==!1&&(lt=!1)))});ot=Product.prototype.GetSelectedAddons();st=Product.prototype.GetSelectedBundelProducts();var bt,p="",d="",g="",kt="input[type=text].quantity,input[type=number].quantity";if(s=="true"&&(kt="input[type=text].quantity:visible,input[type=number].quantity:visible"),$(kt).each(function(){var n=$(this).val(),f=$(this).attr("data-omssavedcartlineitemid"),r,t,i;if($(this).attr("name")!="Quantity"||v=="ConfigurableProduct"){if(n!=null&&n!=""&&(f!=undefined||$("#ecertPublishProductId").length>0)&&(h=h+$(this).attr("data-sku")+",",u+$(this).val()+"_",u=u+$(this).val()+"_",y=y+$(this).attr("data-omssavedcartlineitemid")+","),parseInt($(this).attr("data-maxquantity"))<parseInt(n))return!1;n!=null&&n!=""&&$(this).attr("data-inventory")=="False"&&(ht=ht+$(this).attr("data-sku")+",")}r=$(this).attr("data-sku");t=$("div[data-sku='".concat(r,"'].sp-availability-options"));t.attr("data-original-text")===""&&t.attr("data-original-text",t.html());n!=null&&n!==""&&parseInt(n)>0&&$(this).attr("data-iscloseout")==="true"&&parseInt($(this).attr("data-instock"))<parseInt(n)?(bt=!0,t.html(ZnodeBase.prototype.getResourceByKeyName("QuantityEnteredExceedsQuantityAvailable")),t.addClass("error-msg"),$(this).addClass("input-validation-error")):(t.html(t.attr("data-original-text")),t.removeClass("error-msg"),$(this).removeClass("input-validation-error"));$(this).attr("data-iscloseout")==="true"&&n!=null&&n!==""&&parseInt(n)>0&&(i=window.location.pathname.split("/")[3],(i==undefined||i=="0")&&window.location.href.indexOf("?parentOmsSavedCartLineItemId")==-1&&(p=p+","+$(this).attr("data-sku"),d=d+","+$(this).val(),g=g+","+$(this).attr("data-instock"),p=p.replace(/^,/,""),d=d.replace(/^,/,""),g=g.replace(/^,/,"")))}),bt)return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredProductQuantity"),"error",!0,1e4),!1;if(p.length>0&&(dt=t.prototype.CheckIfIsCloseOutQuantity(p,d,g),dt==!1))return!1;if(u=u.substr(0,u.length-1),h=h.substr(0,h.length-1),y=y.substr(0,h.length-1),v=="GroupedProduct"){if(u==null||u=="")return Product.prototype.CheckQuickViewAndShowErrorMessage(ZnodeBase.prototype.getResourceByKeyName("RequiredProductQuantity"));if(Product.prototype.OnAssociatedProductQuantityChange()){if(gt=parseInt($("#dynamic-parentproductid").val()),!Product.prototype.CheckGroupProductQuantity(gt,h,u,ht))return!1}else return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorProductQuantity"),"error",!0,1e4),!1}else if(v=="ConfigurableProduct"){if(u==null||u=="")return Product.prototype.CheckQuickViewAndShowErrorMessage(ZnodeBase.prototype.getResourceByKeyName("RequiredProductQuantity"));if(t.prototype.CheckConfigurableProductQuantity()){var ki=parseInt($("#dynamic-parentproductid").val()),a="",ut=0,li="",w=0;if(w=$("#PersonalizationDecorationLocationsCount").val()>1?parseInt($(".quantity:visible").val()):parseInt($("#Quantity").val()),r=0,$("#dynamic-product-variations").find("[data-gridquantity]").each(function(){if($(this).is(":visible")){var n=$(this).val();n!=undefined&&n!=null&&n!=""&&(ut+=parseInt(n),li=$(this).attr("data-name"))}}),$("#dynamic-product-variations").find("[data-gridquantity]").each(function(){var u;if($(this).is(":visible")){var i=$(this).val(),f=parseInt($(this).attr("data-minQuantity")),e=parseInt($(this).attr("data-maxQuantity")),o=$(this).attr("data-sku"),n=0;i!=null&&i!=""&&(u=t.prototype.GetInStockMinQty(o,c),n=Math.max.apply(Math,u),r=n>r?n:r,$(this).attr("data-instockminqty",r),r>0?ut<r&&(a=t.prototype.ValidateInStockMinQty(s,r),$(this).addClass("error")):ut<f?($("#totalQty").length&&($("#totalQty").addClass("error"),$("#quantity-error-msg").hide()),a=ZnodeBase.prototype.getResourceByKeyName("defaultMinErrorMessage"),$(this).addClass("error")):ut>e&&(a=ZnodeBase.prototype.getResourceByKeyName("defaultMaxErrorMessage"),$(this).addClass("error")))}}),a!="")return Product.prototype.CheckQuickViewAndShowErrorMessage(a),!1;if(w!=null&&!isNaN(w)){var ai=parseInt($("#configurableMinQty").val()),vi=parseInt($("#configurableMaxQty").val()),yi=$("#Quantity").attr("data-sku"),at=0,pi=t.prototype.GetInStockMinQty(yi,c);if(at=Math.max.apply(Math,pi),r=at>r?at:r,$(this).attr("data-instockminqty",r),r>0){if(w<r)return a=t.prototype.ValidateInStockMinQty(s,r),$("#dynamic-product-variations:visible").find("#Quantity:visible").addClass("error"),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(""),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(a),!1}else{if(w<ai)return $("#dynamic-product-variations:visible").find("#Quantity:visible").addClass("error"),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(""),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(ZnodeBase.prototype.getResourceByKeyName("defaultMinErrorMessage")),!1;if(w>vi)return $("#dynamic-product-variations:visible").find("#Quantity:visible").addClass("error"),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(""),$("#dynamic-product-variations:visible").find("#quantity-error-msg:visible").text(ZnodeBase.prototype.getResourceByKeyName("defaultMaxErrorMessage")),!1}}}else return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("ErrorProductQuantity"),"error",!0,1e4),!1}else{var ni=parseInt($("#Quantity").attr("data-minQuantity")),ti=parseInt($("#Quantity").attr("data-maxQuantity")),ii=parseInt($("#Quantity").val());if(ii>=ni&&ii<=ti)ct=$("#Quantity").val();else return $("#quantity-error-msg").text(""),$("#quantity-error-msg").text(ZnodeBase.prototype.getResourceByKeyName("SelectedQuantityBetween")+ni+ZnodeBase.prototype.getResourceByKeyName("To")+ti+ZnodeBase.prototype.getResourceByKeyName("FullStop")),!1}if(ri=$("#ddlLogo option:selected").val(),ri=="0")return ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredLogoSelection"),"error",!0,1e4),!1;if($("#dynamic-isGiftCertificate")!=undefined&&$("#dynamic-isGiftCertificate").val()==="true"){var ui=[],fi=$(".eCertFieldsContainer"),b=!1;for(ft=0;ft<fi.length;ft++){var e=$(fi[ft]),nt=e.find(".eCertTo"),tt=e.find(".eCertFrom"),k=e.find(".eCertEmail"),bi=e.find(".eCertMessage"),vt=e.find(".eCertQuantity");(tt.removeClass("error"),e.find(".eCertFrom-error-msg").css("display","none"),nt.removeClass("error"),e.find(".eCertTo-error-msg").css("display","none"),k.removeClass("error"),e.find(".eCertEmail-error-msg").css("display","none"),vt.removeClass("error"),e.find(".quantity-error-msg").css("display","none"),tt.val()||(tt.addClass("error"),e.find(".eCertFrom-error-msg").css("display","block"),b=!0),nt.val()||(nt.addClass("error"),e.find(".eCertTo-error-msg").css("display","block"),b=!0),k.val()&&wi(k.val())||(k.addClass("error"),e.find(".eCertEmail-error-msg").css("display","block"),b=!0),vt.val()||(vt.addClass("error"),e.find(".quantity-error-msg").css("display","block"),b=!0),b)||(ei={To:nt.val(),From:tt.val(),Email:k.val(),Message:bi.val(),value:nt.val()+tt.val()+k.val()},ui.push(ei))}if(b)return!1;o.push("eCertificateValues");f.push(JSON.stringify(ui))}return ZnodeBase.prototype.ShowLoader(),oi=$("#UserId").val()>0?$("#UserId").val():localStorage.getItem("UserId"),CustomEndpoint.prototype.GetPersonalizeDesignId($("#productSKU").val(),$("#selectedColorCode").val(),function(i){var p=$("#PersonalizationDecorationLocationsCount").val(),e="",a=0,l,s,v;p>1&&($(".quantity.sp-num").length>0?(l=$(".GetMonogramPersonalisedAttributesWithMaxChar .quantity.sp-num").closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],e=$(l).closest($(".multilocation ")).next("div").attr("id")):(l=$(".GetMonogramPersonalisedAttributesWithMaxChar .product-details-qty").find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],e=$(l).closest($('[data-test-selector="divProductQuantity"]')).next("div").attr("id")),e!=""&&e!=undefined&&e!=null&&(s=$("#"+e).find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],s!=""&&s!=undefined&&s!=null&&(a=parseInt($(s).attr("formindex")))));v={queryString:t.prototype.CreateQueryStringForUpdateImage("",!1,!0,a,e)};try{Artifi.Application.addToCart(ArtifiModel.prototype.sku,oi,ArtifiModel.prototype.designId,function(i){var v,a,s,l,e;if(i)if($('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),i=n.attr("data-attributeCode"),t;o.indexOf(i)<0&&(o.push(n.attr("data-attributeCode")),t={name:n.text().split(ZnodeBase.prototype.getResourceByKeyName("TextUpto"))[0],value:$(this).val()},yt.push(JSON.stringify(t)))}),o.push("ArtifiCustomizedData"),pt.push(i),o.push("SelectedDecorationElements"),wt.push(JSON.stringify(SelectedElements)),f=$.merge(f,yt),f.push(pt),f.push(wt),v={notes:ZnodeBase.prototype.getResourceByKeyName("PersonalizationNote"),customizeallitems:ZnodeBase.prototype.getResourceByKeyName("TextCustomizeAllItems")},o.push("personalizeNotes"),f.push(JSON.stringify(v)),cartItemUploadedImagesJson.UploadedImages.length>0)if($("#CartItemUploadedImagesJson").val()!==""){if(a=$("#CartItemUploadedImagesJson").val(),a!=="")for(s=JSON.parse(a),l=0;l<cartItemUploadedImagesJson.UploadedImages.length;l++)for(e=0;e<s.UploadedImages.length;e++)cartItemUploadedImagesJson.UploadedImages[l].DecorationKey==s.UploadedImages[e].DecorationKey?(cartItemUploadedImagesJson.UploadedImages[l].UploadedFileName=s.UploadedImages[e].UploadedFileName,cartItemUploadedImagesJson.UploadedImages[l].ActualFileName=s.UploadedImages[e].ActualFileName):cartItemUploadedImagesJson.UploadedImages.map(function(n){return n.DecorationKey}).indexOf(s.UploadedImages[e].DecorationKey)==-1&&cartItemUploadedImagesJson.UploadedImages.push(s.UploadedImages[e]);o.push("CartItemUploadedImagesJson");f.push(JSON.stringify(cartItemUploadedImagesJson))}else o.push("CartItemUploadedImagesJson"),f.push(JSON.stringify(cartItemUploadedImagesJson));else $("#CartItemUploadedImagesJson").val()!==""&&$("#CartItemUploadedImagesJson").val()!==undefined&&(o.push("CartItemUploadedImagesJson"),f.push($("#CartItemUploadedImagesJson").val()));return t.prototype.SetCartItemModelValues(ot,st,h,u,y,ct,o.join(","),f.join("`"),c,r,n),CommonHelper.prototype.SubmitForm($("#Form_"+parseInt($("#dynamic-productid").val())+""),function(){}),lt},function(i){CustomEndpoint.prototype.AddEmptyPersonalisedDataLogs(ArtifiModel.prototype.sku,$("#productSKU").val(),$("#selectedColorCode").val(),window.location.href,f,JSON.stringify(i),function(){return ZnodeBase.prototype.HideLoader(),!1});$('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;o.push(n.attr("data-attributeCode"));t={name:n.text().split("(")[0],value:$(this).val()};f.push(JSON.stringify(t))});t.prototype.SetCartItemModelValues(ot,st,h,u,y,ct,o.join(","),f.join("`"),c,r,n);CommonHelper.prototype.SubmitForm($("#Form_"+parseInt($("#dynamic-productid").val())+""),function(){},!0)},i!=undefined&&i!=null?i.personalizeDesignId:null,v,t.prototype.CreateLocationNameKeyValue())}catch(w){ZnodeBase.prototype.HideLoader();ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AddToCartStollUpErrorMessage"),"error",!0,1e4)}}),lt},t.prototype.SetChildProductPersonalizeData=function(){var i=[],r=$("div[data-decokey]"),u=$("#IsMonogramming").val(),n;return u!=undefined&&u.toLowerCase()=="true"&&(n=parseInt($("#PersonalizationDecorationLocationsCount").val()),n>1&&$("#divMultiDecoration").is(":visible")&&(r=$("#divMultiDecoration")),r.each(function(r,u){var f=$(u).attr("data-decokey"),e=$(u).find(".product-size-quantity-group, .product-details-qty");e.each(function(r,u){var v=$(u).find('[data-test-selector="spnSize"]').text(),e=$(u).find("input[type=text].quantity,input[type=number].quantity"),a,o;if($(e)!=undefined&&$(e).val()!=""&&$(e).val()!="0"){var s=[],h=$(e).attr("data-sku"),c=$(e).attr("data-counter"),l=$("#monogramAttributes_"+c);n>1&&(l=$("#multipleMonogramAttributes_"+c));a=$(l).find("form");o=0;a.each(function(t,i){o=o+1;var u=$(i).find('input[ispersonalizable="True"]'),r=0;u.each(function(t,i){var p,w;r=r+1;var e=$(i).attr("id"),c=$(i).attr("omssavedcartlineitemid"),l=$(i).attr("omschildsavedcartlineitemid");n>1&&(f=$(i).attr("decolocation"));var a=$(i).attr("instockminqty"),y=a==""?0:parseInt(a),b=$(i).attr("isrequired"),k=$("label[for='"+e+"']"),d=$(i).attr("placeholder"),u=k.text().split(ZnodeBase.prototype.getResourceByKeyName("TextUpto"))[0];u=u==""?d.split(ZnodeBase.prototype.getResourceByKeyName("TextUpto"))[0]:u;p=JSON.stringify({name:u,value:$(i).val(),displayOrder:r,decoLocation:f,sizeCode:v,productSku:h});w={PersonalizeCode:e,PersonalizeValue:p,DisplayOrder:r,DecoLocation:f,GroupSequence:o,OmsSavedCartLineItemId:c==""?0:parseInt(c),OmsChildSavedCartLineItemId:l==""?0:parseInt(l),InStockMinQty:isNaN(y)?0:y,IsRequiredLoc:b};s.push(w)})});i=t.prototype.UpdateInsertChildProductPersonalizeData(i,h,s)}})})),{PersonalizationData:i}},t.prototype.GetCustomizedProductPersonalizeData=function(){var n=[],r=$("div[data-decokey]"),i=$("#text-customization").find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0];return i!=undefined&&i!=null&&i!=""&&r.each(function(i,r){var u=$(r).attr("data-decokey"),f=$(r).find(".personlised-attribute-block");f.each(function(i,r){var e=[],o="",f=$("#dynamic-product-variations").find("input[type=text].quantity,input[type=number].quantity").toArray().filter(function(n){return n.value!=""})[0],s;f!=undefined&&f!=null&&f!=""&&(o=$(f).attr("data-sku"));s=$(r).find("form");s.each(function(n,t){var i=$(t).find('input[ispersonalizable="True"]');i.each(function(n,t){var r=$(t).attr("id"),f=$(t).attr("instockminqty"),o=f==""?0:parseInt(f),c=$(t).attr("isrequired"),l=$("label[for='"+r+"']"),a=$(t).attr("placeholder"),i=l.text().split(ZnodeBase.prototype.getResourceByKeyName("TextUpto"))[0],s,h;i=i==""?a.split(ZnodeBase.prototype.getResourceByKeyName("TextUpto"))[0]:i;s=JSON.stringify({name:i,value:$(t).val(),decoLocation:u});h={PersonalizeCode:r,PersonalizeValue:s,DecoLocation:u,InStockMinQty:isNaN(o)?0:o,IsRequiredLoc:c};e.push(h)})});n=t.prototype.UpdateInsertChildProductPersonalizeData(n,o,e)})}),{PersonalizationData:n}},t.prototype.UpdateInsertChildProductPersonalizeData=function(n,t,i){var r=!1;return n!=undefined&&n.length>0&&n.map(function(n){if(n.ProductSKU==t){var u=n.PersonalizationData;return Array.prototype.push.apply(u,i),r=!0,__assign(__assign({},n),{PersonalizationData:u})}return n}),r==!1&&n.push({ProductSKU:t,PersonalizationData:i}),n},t.prototype.SetCartItemModelValues=function(n,t,i,r,u,f,e,o,s,h,c){$(c).closest("form").children("#dynamic-addonproductskus").val(n);$(c).closest("form").children("#dynamic-bundleproductskus").val(t);(f!=null||f!="")&&$(c).closest("form").children("#dynamic-quantity").val(f);$(c).closest("form").children("#dynamic-personalisedcodes").val(e);$(c).closest("form").children("#dynamic-personalisedvalues").val(o);$(c).closest("form").children("#dynamic-groupproductskus").val(i);$(c).closest("form").children("#dynamic-groupproductsquantity").val(r);$(c).closest("form").children("#dynamic-childcartlinepersonalizedata").val(s);$(c).closest("form").children("#dynamic-ismonogramming").val($("#IsMonogramming").val());$(c).closest("form").children("#dynamic-instockcustomizequantity").val(h);$(c).closest("form").children("#dynamic-isremoveartworkbackground").val($("#isRemoveArtworkBackground").val());$(c).closest("form").append("<input type='hidden' id='dynamic-isproductedit' name='IsProductEdit' value='"+$("#isProductEdit").val()+"' />");$(c).closest("form").append("<input type='hidden' id='dynamic-isgiftnotecard' name='IsGiftNoteCard' value='"+$("#IsGiftNoteCard").val()+"' />");var l=parseInt($("#ParentOmsSavedCartLineItemId").val());!isNaN(l)&&l>0&&$(c).closest("form").append("<input type='hidden' id='dynamic-parentomssavedcartlineitemid' name='ParentOmsSavedCartLineItemId' value='"+l+"' />");(typeof u!=undefined||u!=null||u!="")&&$(c).closest("form").append("<input type='hidden' id='dynamic-groupproductslineitemid' name='GroupProductsLineItemId' value='"+u+"' />")},t.prototype.ShowMaxQuantityErrorMessage=function(){ZnodeBase.prototype.HideLoader();var n=parseInt($(".quantity").attr("data-minquantity")),t=parseInt($(".quantity").attr("data-maxQuantity"));ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("SelectedQuantityBetween")+n+ZnodeBase.prototype.getResourceByKeyName("To")+t+ZnodeBase.prototype.getResourceByKeyName("FullStop"),"error",isFadeOut,fadeOutTime)},t.prototype.CheckIfIsCloseOutQuantity=function(n,t,i){var r=!1;return CustomEndpoint.prototype.CheckCloseoutQtyWithSession(n,t,i,function(n){var e,f,i,u,t;if(n.failedSkus.indexOf(",")>-1){for(e=n.failedSkus.split(","),f=$(".quantity").length,i=0;i<f;i++)u=$($(".quantity")[i]).data("sku"),$.inArray(u,e)>-1&&(t=$("div[data-sku='".concat(u,"'].sp-availability-options")),t.attr("data-original-text")===""&&t.attr("data-original-text",t.html()),t.html(ZnodeBase.prototype.getResourceByKeyName("QuantityEnteredExceedsQuantityAvailable")),t.addClass("error-msg"),$($(".quantity")[i]).addClass("input-validation-error"));r=!1}else if(n.failedSkus.length>0)for(f=$(".quantity").length,i=0;i<f;i++)u=$($(".quantity")[i]).data("sku"),u==n.failedSkus&&(t=$("div[data-sku='".concat(u,"'].sp-availability-options")),t.attr("data-original-text")===""&&t.attr("data-original-text",t.html()),t.html(ZnodeBase.prototype.getResourceByKeyName("QuantityEnteredExceedsQuantityAvailable")),t.addClass("error-msg"),$($(".quantity")[i]).addClass("input-validation-error"));else r=!0}),r},t.prototype.OnAttributeSelect=function(n){var v,e,u,o,y,f,p,i,w,s;typeof bttUT!="undefined"&&typeof bttUT.start=="function"&&bttUT.start({pageName:"pdp - product config - VT",txnName:"Prod"});IsLeadTimeCalled=!0;var b=$("#scrollReview form").children("#dynamic-parentproductid").val(),h=[],c=[],k=$("#dynamic-configurableproductskus").val(),d=$("#dynamic-sku").val(),g=$(n).attr("code"),nt=$(n).val(),tt=$(n).data("colorcode"),l=$("#UploadedCliparts").val(),a=$("#CartItemUploadedImagesJson").val();$("#isProductEdit").val()=="True"&&(omsSavedCartLineItemId=$("#Quantity").data("omssavedcartlineitemid"),v=$(".sp-num"),typeof v!=undefined&&v!=null&&$(".sp-num").each(function(){var t=$(this).attr("data-sku"),n=$(this).attr("data-omssavedcartlineitemid");omsSavedCartLineItemIds.push(t+"_"+n);$(this).attr("data-omssavedcartlineitemid",n)}));$("#selectedColorCode").val(tt);$("select.ConfigurableAttribute").each(function(){c.push($(this).val());h.push($(this).attr("id"))});$(" input.ConfigurableAttribute:checked").each(function(){c.push($(this).val());h.push($(this).attr("code"))});var it=$("#categoryIds").val(),rt={SelectedCode:g,SelectedValue:nt,SKU:k,Codes:h.join(),Values:c.join(),ParentProductId:b,ParentProductSKU:d,IsQuickView:$("#isQuickView").val(),IsProductEdit:$("#isProductEdit").val(),ParentOmsSavedCartLineItemId:$("#ParentOmsSavedCartLineItemId").val()},r=[];if($("#UploadedCliparts").val()==""||$("#UploadedCliparts").val()==undefined)if(e=$("#CartItemUploadedImagesJson").val(),e==undefined||e=="")r=t.prototype.GetSelectedDecorationLocationCliparts();else if(u=JSON.parse(e),u.UploadedImages.length==0)r=t.prototype.GetSelectedDecorationLocationCliparts();else{for(o=[],i=0;i<u.UploadedImages.length;i++)o.push({key:u.UploadedImages[i].DecorationKey,value:u.UploadedImages[i].UploadedClipArt});r=o;uploadedImageClipArts=o}else if(y=$("#CartItemUploadedImagesJson").val(),y!="")if(f=JSON.parse(y),f.UploadedImages.length>0){for(p=[],i=0;i<f.UploadedImages.length;i++)p.push({key:f.UploadedImages[i].DecorationKey,value:f.UploadedImages[i].UploadedClipArt});uploadedImageClipArts=p;r=uploadedImageClipArts}else r=uploadedImageClipArts;decorationHtml=$("#personalizationLogo").clone();ZnodeBase.prototype.ShowLoader();s="";$("#alt-images").find("div.selected-item").find("a").length>0&&(w=$("#alt-images").find("div.selected-item").find("a").eq(0)[0].dataset.viewCode);$("#breadCrumb")!=undefined&&$("#breadCrumb").length>0&&$("#breadCrumb").html().length>0&&(s=$("#breadCrumb").html());CustomEndpoint.prototype.GetProduct(rt,function(n){var f=$("#dynamic-productcategorycode").val(),i,u;$("#layout-product").replaceWith(n);$("#dynamic-productcategorycode").val(f);(l!=""||l!=undefined)&&(a!=""||a!=undefined)&&($("#UploadedCliparts").val(l),$("#CartItemUploadedImagesJson").val(a));w!=""&&$("#hdnSelectedVariant").val(w);s.length>0?$("#breadCrumb").html(s):($("#categoryIds").val(it),isFromCategoryPage=localStorage.getItem("isFromCategoryPage"),Product.prototype.GetProductBreadCrumb(parseInt(window.localStorage.getItem("lastCategoryId"),10),$("#isQuickView").val()));$("#breadcrumb-productname").html($(".product-name").html());i=$("#IsMonogramming").val();i!=undefined&&i!=null&&i=="true"&&persistedText!=null?persistedTextDecoLocation>0&&persistedMonogramIndex!=undefined&&persistedMonogramQuantity!=undefined&&persistedMonogramQuantity!=""&&($(".GetMonogramPersonalisedAttributesWithMaxChar_"+persistedTextDecoLocation+" .quantity.sp-num").closest("input[type='text']").toArray()[persistedMonogramIndex].value=persistedMonogramQuantity,_PersonalisedDataCustom.prototype.ShowIndividualization($("#ancshowhideindividualized_"+persistedTextDecoLocation)),setTimeout(function(){var n=$(persistedMonogramForm).attr("id"),t=$(".personalized-attributes-body #"+n+" input");t.each(function(){$(this).val(persistedText[$(this).attr("id")])})},500)):$($("#text-customization > form")).each(function(){var i=$(this).attr("id"),t=$(".personalized-attributes-body #"+i+" input"),n,r,u,f;t.each(function(){$(this).val(persistedText[$(this).attr("id")])});n=$(".personalized-attributes-body #"+i+" select");n.each(function(){$(this).val(persistedText[$(this).attr("id")])});f=i.split("_")[1];t&&t.toArray().length>0&&(r=t.toArray().filter(function(n){return n.value!=""}));n&&n.toArray().length>0&&(u=n.toArray().filter(function(n){return n.value!=""}));r&&r.length>0||u&&u.length>0?($("#divAddCustomizationForAllItems_"+f).css("display","none"),$('div[data-test-selector^="divPersonalisedAttribute_'+f+'"]').css("display",""),$(".PriceWithCustomization").addClass("bold").removeClass("disabled"),$(".PriceWithoutCustomization").addClass("disabled").removeClass("bold")):($(".PriceWithoutCustomization").addClass("bold").removeClass("disabled"),$(".PriceWithCustomization").addClass("disabled").removeClass("bold"))});typeof bttUT!="undefined"&&typeof bttUT.end=="function"&&bttUT.end({pageName:"pdp - product config - VT",txnName:"Prod"});typeof bttUT!="undefined"&&typeof bttUT.start=="function"&&bttUT.start({pageName:"pdp - color change - VT",txnName:"Prod"});t.prototype.updateImageOnColorChange();$("#isProductEdit").val()=="True"&&(typeof omsSavedCartLineItemId!=undefined&&omsSavedCartLineItemId!=null&&omsSavedCartLineItemId!=""&&$("#Quantity").attr("data-omssavedcartlineitemid",omsSavedCartLineItemId),u=$(".sp-num"),typeof u!=undefined&&u!=null&&typeof omsSavedCartLineItemIds!=undefined&&omsSavedCartLineItemIds!=null&&$(".sp-num").each(function(n){var i=$(this).attr("data-sku"),r=omsSavedCartLineItemIds[n].split("_")[0],u=t.prototype.GetLineItemIds(i.split("-")[2],r.split("-")[2],n);$(this).attr("data-omssavedcartlineitemid",u)}));$("#cliparts").val().length>0&&(typeof bttUT!="undefined"&&typeof bttUT.start=="function"&&bttUT.start({pageName:"pdp - populate logo - VT",txnName:"Prod"}),t.prototype.PopulateLogoOnLoad($("#cliparts").val(),!1,r,function(){typeof bttUT!="undefined"&&typeof bttUT.end=="function"&&bttUT.end({pageName:"pdp - populate logo - VT",txnName:"Prod"})}));typeof _ConfigurableAttribute!="undefined"&&_ConfigurableAttribute.prototype.PageScripts();typeof _PersonalisedAttribute!="undefined"&&_PersonalisedAttribute.prototype.PageScripts();ZnodeBase.prototype.HideLoader();$("._ProductInfo").length>0&&_ProductInfo.prototype.PageScripts();t.prototype.LeadTime()})},t.prototype.UpdateDecorationArea=function(n,i){var r,e,u,s,g,nt,tt,h,f,ut,p,o,ft,et,ot,w,b,k,l,st,ht,a,v,d,y,ct,lt,c,at,vt,yt;for($("#product-lens-image .deco-loading").addClass("active"),r=n.value,$("#UploadedImageName-"+r).removeClass("active"),$("#beforUploadDiv-"+i.toString()).show(),$("#uploadLoader-"+r.toString()).addClass("active"),e=$("#UploadedCliparts").val(),e!=null&&e!=""&&e!=undefined&&r!=null&&r!=""&&r!=undefined&&$("#required_"+r).removeAttr("disabled"),cartItemUploadedImagesJson.UploadedImages.length>0&&(jQuery.each(cartItemUploadedImagesJson.UploadedImages,function(n,t){t.DecorationKey==i&&(cartItemUploadedImagesJson.UploadedImages[n].DecorationKey=r)}),cartItemUploadedImagesJson.UploadedImages=cartItemUploadedImagesJson.UploadedImages.filter(function(n){return n!==null})),u=$("#decoration-option-"+r+" option").map(function(){return this.value}).get().join().split(","),s=0;s<SelectedElements.SelectedDecoration.length;s++)SelectedElements[s]==i&&(SelectedElements[s]={selectedItem:r});if($("#decoration-opt-"+r.toString()).is(":hidden")){for(e=e.toString().replace(i.toString(),r.toString()),$("#disableCheck-"+i).removeAttr("disabled"),$("#disableCheck-"+r.toString()).attr("disabled","disabled"),g=$("#decoration-option-"+r).val(),$("#decoration-option-"+r+" option[value="+g+"]").attr("selected",null),$("#decoration-option-"+r+" option[value="+r+"]").attr("selected","selected"),nt=$("#decoration-option-"+r).html(),$("#decoration-option-"+r).html(nt),tt=$("#decoration-option-"+r).val(),h=0;h<u.length;h++)r!==u[h].toString()&&$("#decoration-option-"+u[h].toString()+" option[value="+tt+"]").attr("disabled","disabled");for(f=0;f<u.length;f++)if(r.toString()===u[f].toString()){$("#divDecoration-"+r.toString()).show();$("#decorationLocationLabel-"+r.toString()).show();$("#decoration-func-"+r.toString()).show();$("#decoration-opt-"+r.toString()).show();var it=$("#divDecoration-"+i.toString()),rt=$("#divDecoration-"+r.toString()),pt=it.clone(),wt=rt.clone();it.replaceWith(wt);rt.replaceWith(pt);$("#personalizationLogo").html($("#personalizationLogo").html());$("#OptionalText-"+r.toString()).length&&$("#OptionalText-"+r.toString()).show()}else ut=$("#disableCheck-"+u[f].toString()).attr("disabled"),p=!1,p=ut==="disabled"?!0:!1,p||($("#divDecoration-"+u[f].toString()).hide(),$("#decorationLocationLabel-"+u[f].toString()).hide(),$("#decoration-func-"+u[f].toString()).hide(),$("#decoration-opt-"+u[f].toString()).hide(),$("#add-decoration-area-"+u[f].toString()).hide(),$("#OptionalText-"+u[f].toString()).length&&$("#OptionalText-"+u[f].toString()).hide());for(o=0;o<u.length;o++)$("#decoration-func-"+u[o].toString()).is(":hidden")&&($("#delete_DecoLogo_"+u[o].toString()).trigger("click"),$("#remove_"+o.toString()).trigger("click"));ft=u.indexOf(i.toString());$("#delete_DecoLogo_"+i.toString()).trigger("click");$("#remove_"+ft.toString()).trigger("click")}else et=$("#decoration-option-"+i).val(),$("#decoration-option-"+i+" option[value="+et+"]").attr("selected",null),$("#decoration-option-"+i+" option[value="+i+"]").attr("selected","selected"),ot=$("#decoration-option-"+i).html(),$("#decoration-option-"+i).html(ot),$("#decorationValidationMessage-"+i).show(),setTimeout(function(){$("#decorationValidationMessage-"+i).hide()},3e3);for(w=$("#divDecoration-"+r.toString()).attr("data-views"),w!==""&&e!==""&&($("#UploadedCliparts").val(e),t.prototype.PopulateUploadedLogos($("#UploadedCliparts").val(),w,"true")),b=$("#decoration-option-"+r+" option").map(function(){return this.value}).get().join().split(","),k=0,l=0;l<b.length;l++)if($("#decoration-opt-"+b[l].toString()).is(":hidden"))continue;else k++;for(k===1?$("#close-"+r.toString()).hide():(st=$("#divDecoration-"+r.toString()).prev().attr("id").toString(),st!=="fuzzykeydown"?$("#close-"+r.toString()).show():$("#close-"+r.toString()).hide()),ht=$("#decoration-option-"+i).val(),a=0;a<u.length;a++)$("#decoration-option-"+u[a].toString()+" option[value="+ht+"]").removeAttr("disabled");for(v=0;v<u.length;v++)$("#add-decoration-area-"+u[v].toString()).hide();for(d=0,y=0;y<u.length;y++)ct=$("#add-decoration-area-"+u[y].toString()).is(":hidden"),ct&&d++;if(d===u.length){for(lt=$("#personalizationLogo").children().last().attr("id"),c=lt.replace("divDecoration-","").toString();$("#decorationLocationLabel-"+c).is(":hidden");)at=$("#divDecoration-"+c).prev().attr("id"),vt=at.replace("divDecoration-","").toString(),c=vt;$("#add-decoration-area-"+c).show()}$("#mustDecorationError").attr("hidden","");$("#erro_message_"+i.toString()).hide();yt=$("#UploadedImageName-"+i.toString()).html();cartItemUploadedImagesJson.UploadedImages.length>0?$("#product-image").load(function(){$("#UploadedImageName-"+i.toString()).hasClass("active")?($("#beforUploadDiv-"+i.toString()).show(),$("#UploadedImageName-"+i.toString()).removeClass("active"),$("#uploadLoader-"+i.toString()).removeClass("active"),$("#uploadLoader-"+r.toString()+".deco-loading").removeClass("active")):($("#beforUploadDiv-"+r.toString()).hide(),$("#UploadedImageName-"+r.toString()).addClass("active"),$("#UploadedImageName-"+r.toString()).html(yt),$("#UploadedImageName-"+i.toString()).removeClass("active"),$("#beforUploadDiv-"+i.toString()).show(),$("#uploadLoader-"+r.toString()).removeClass("active"),$("#uploadLoader-"+r.toString()+".deco-loading").removeClass("active"),$("#Validation-msg-"+i.toString()).hide())}):($("#uploadLoader-"+r.toString()).removeClass("active"),$("#uploadLoader-"+r.toString()+".deco-loading").removeClass("active"))},t.prototype.CloseDecoration=function(n){var o,t,s,r,e,u,h,c,i,l,a,f,v;if($("#disableCheck-"+n.toString()).removeAttr("disabled"),o=$("#decoration-option-"+n+" option").length<1?!0:!1,t=$("#decoration-option-"+n+" option").map(function(){return this.value}).get().join().split(","),o)t.push($("#decoration-option-"+n).val()),$("#decoration-func-"+n).hide();else{for($("#divDecoration-"+n.toString()).hide(),$("#decorationLocationLabel-"+n.toString()).hide(),$("#decoration-func-"+n.toString()).hide(),$("#decoration-opt-"+n.toString()).hide(),$("#add-decoration-area-"+n.toString()).hide(),$("#OptionalText-"+n.toString()).length&&$("#OptionalText-"+n.toString()).hide(),s=$("#decoration-option-"+n).val(),r=0;r<t.length;r++)$("#decoration-option-"+t[r].toString()+" option[value="+s+"]").removeAttr("disabled");for(e=0,u=0;u<t.length;u++)h=$("#add-decoration-area-"+t[u].toString()).is(":hidden"),h&&e++;if(e===t.length){for(c=$("#personalizationLogo").children().last().attr("id"),i=c.replace("divDecoration-","").toString();$("#decorationLocationLabel-"+i).is(":hidden");)l=$("#divDecoration-"+i).prev().attr("id"),a=l.replace("divDecoration-","").toString(),i=a;$("#add-decoration-area-"+i).show()}for(f=0;f<t.length;f++)$("#add-decoration-area-"+t[f].toString()).children("a").removeAttr("disabled")}v=t.indexOf(n.toString());$("#delete_DecoLogo_"+n.toString()).trigger("click");$("#remove_"+v.toString()).trigger("click");cartItemUploadedImagesJson.UploadedImages.length>0&&(jQuery.each(cartItemUploadedImagesJson.UploadedImages,function(t,i){i.DecorationKey==n&&delete cartItemUploadedImagesJson.UploadedImages[t]}),cartItemUploadedImagesJson.UploadedImages=cartItemUploadedImagesJson.UploadedImages.filter(function(n){return n!==null}));$("#CartItemUploadedImagesJson").val(JSON.stringify(cartItemUploadedImagesJson));$("#product-image").load(function(){$("#beforUploadDiv-"+n.toString()).show();$("#UploadedImageName-"+n.toString()).removeClass("active");$("#required_"+n).attr("disabled","disabled");$("#erro_message_"+n).hide()});$("#uploadLoader-"+n.toString()+".deco-loading").removeClass("active")},t.prototype.AddDecorationArea=function(n){for(var t=$("#decoration-option-"+n+" option").map(function(){return this.value}).get().join().split(","),r=$("#decoration-option-"+n).val(),s=0,c,i,l,a,v,y,u,h,o,p,w,f,b,k,e=0;e<t.length;e++)c=$("#decoration-option-"+t[e]).is(":hidden"),c||s++;if(s!=t.length){for(i=0;i<t.length;i++)if(l=$("#decoration-option-"+t[i]).is(":hidden"),l&&!(t[i].toString()===r.toString())){for(SelectedElements.SelectedDecoration.push({selectedItem:t[i].toString()}),a=$("#decoration-option-"+t[i].toString()).val(),$("#decoration-option-"+t[i].toString()+" option[value="+a+"]").attr("selected",null),$("#decoration-option-"+t[i].toString()+" option[value="+t[i].toString()+"]").attr("selected","selected"),$("#divDecoration-"+t[i].toString()).appendTo("#personalizationLogo"),v=$("#decoration-option-"+t[i].toString()).html(),$("#divDecoration-"+t[i].toString()).show(),$("#decoration-option-"+t[i].toString()).html(v),$("#decorationLocationLabel-"+t[i].toString()).show(),$("#decoration-func-"+t[i].toString()).show(),$("#decoration-opt-"+t[i].toString()).show(),$("#OptionalText-"+t[i].toString()).length&&$("#OptionalText-"+t[i].toString()).show(),$("#disableCheck-"+t[i].toString()).attr("disabled","disabled"),$("#close-"+t[i].toString()).show(),y=$("#decoration-option-"+t[i].toString()).val(),u=0;u<t.length;u++)t[i].toString()!==t[u].toString()&&$("#decoration-option-"+t[u].toString()+" option[value="+y+"]").attr("disabled","disabled"),r!==t[u].toString()&&$("#decoration-option-"+t[u].toString()+" option[value="+r+"]").attr("disabled","disabled");s===t.length-1?$("#add-decoration-area-"+t[i].toString()).hide():$("#add-decoration-area-"+t[i].toString()).show();$("#decorationLocationLabel-"+r).show();$("#decoration-func-"+r).show();$("#decoration-opt-"+r).show();$("#OptionalText-"+r).length&&$("#OptionalText-"+r).show();$("#add-decoration-area-"+r).hide();break}$("#disableCheck-"+r).attr("disabled","disabled")}else $("#add-decoration-area-"+n).hide();for(h=0,o=0;o<t.length;o++)p=$("#add-decoration-area-"+t[o].toString()).is(":hidden"),p&&h++;if(h===t.length){for(w=$("#personalizationLogo").children().last().attr("id"),f=w.replace("divDecoration-","").toString();$("#decorationLocationLabel-"+f).is(":hidden");)b=$("#divDecoration-"+f).prev().attr("id"),k=b.replace("divDecoration-","").toString(),f=k;$("#add-decoration-area-"+f).show();$("#add-decoration-area-"+f).children("a").attr("disabled","disabled")}$("#mustDecorationError").attr("hidden","")},t.prototype.noDecorationError=function(){for(var t=document.querySelectorAll("#personalizationLogo input.input-deco-location"),i=0,r,n=0;n<t.length;n++)r=t[n],r.checked&&i++;i<1?$("#mustDecorationError").removeAttr("hidden"):$("#mustDecorationError").attr("hidden","")},t.prototype.DeleteUploadedLogo=function(n){var o=!1,f,u;if(cartItemUploadedImagesJson.UploadedImages.length>0&&(jQuery.each(cartItemUploadedImagesJson.UploadedImages,function(t,i){i.DecorationKey==n.toString()&&(o=!0,delete cartItemUploadedImagesJson.UploadedImages[t])}),cartItemUploadedImagesJson.UploadedImages=cartItemUploadedImagesJson.UploadedImages.filter(function(n){return n!==null}),$("#CartItemUploadedImagesJson").val(JSON.stringify(cartItemUploadedImagesJson))),o){var s=$("#UploadedCliparts").val(),h=JSON.parse($("#DecoDefaultLogo").val()),c=$("#divDecoration-"+n.toString()).attr("data-views");$("#uploaded-logo-name-"+n.toString()).html("").removeClass().hide();var i=[],r=[],e="";if(s!==""&&(i=s.split(",")),r=h,i.length!==0){for(f=0;f<i.length;f++)if(i[f].indexOf(n.toString()+":")!==-1){if(i.splice(f,1),r.length!==0||r!==undefined||r!==null){for(u=0;u<r.length;u++)if(r[u].Key==n.toString()){i.push(n.toString()+":"+r[u].Value);break}}else i.push(n.toString()+":");e+=i.join();i.splice(i.indexOf(n.toString()+":"),1)}}else{if(r.length!==0||r!==undefined||r!==null){for(u=0;u<r.length;u++)if(r[u].Key==n.toString()){i.push(n.toString()+":"+r[u].Value);break}}else i.push(n.toString()+":");e+=i.join()}$("#UploadedCliparts").val(e);t.prototype.PopulateUploadedLogos(e,c,"false")}},t.prototype.PopulateLogoOnLoad=function(n,i,r,u){var e,s,a,o,w,v,b,h,l,y,k;if(u===void 0&&(u=null),e=[],n||n==""){for(s=[],a=[],a=$("#decorationOMSCodes").val().split(","),s=$("#clipartDetails").val().split(","),o=0;o<a.length;o++){var f="",c="",p="";s[o]&&s[o].length>0&&(f=s[o].split("-")[1],p=s[o].split("-")[0],c=s[o].split("-")[2]);p.split(":").filter(function(n){return n.toString().trim()!="0"}).length>1&&(w="LogoHeader_"+f,$("#"+w+", #decoration-location-heading-"+f+", #decoration-options-heading").addClass("active"));$("#defaultOptionalfuzzy_ddlLogo_"+f).length>0&&$("#defaultOptionalfuzzy_ddlLogo_"+f).val()=="optional"?$("#defaultfuzzy_ddlLogo_"+f+":visible").length==0?e.push({key:f,value:c}):e.push({key:f,value:""}):$("#selectedClipartCode").val()!=undefined&&$("#selectedClipartCode").val()!=null&&$("#selectedClipartCode").val()!=""&&$("#selectedClipartCode").val()!="{}"?(v=JSON.parse($("#selectedClipartCode").val()),e.push({key:f,value:v[f]?v[f]:c})):e.push({key:f,value:c});$("#defaultfuzzy_ddlLogo_"+f).off().click(function(){var n=$(this).attr("data-DecoKey"),i,u,f;if($("#waitLoader_"+n).show(),cartSelectedCliparts=$("#selectedClipartCode").val(),cartSelectedCliparts){i=JSON.parse(cartSelectedCliparts);u=[];for(f in i)u.push({key:f,value:i[f]})}t.prototype.PopulateLogo($("#cliparts").val(),!0,r!=null&&r.length>0?r:u,function(){$("#waitLoader_"+n).hide();$(".fuzzyinputDefault").hide();$(".fuzzyinput[data-hasdefaultcode=1]").show();$("#fuzzy_ddlLogo_"+n).click()})})}if(i&&uploadedImageClipArts.length==0)if($("#IsImageUploaded").val()=="False")t.prototype.UpdateImageForLogo(e);else if($("#IsImageUploaded").val()==undefined)t.prototype.UpdateImageForLogo(e);else if(b=JSON.parse($("#CartItemUploadedImagesJson").val()),b.UploadedImages.length==0)t.prototype.UpdateImageForLogo(e);else for(t.prototype.UpdateImageForLogo(e),h=0;h<r.length;h++)l=r[h].key,l!==""&&r[h].value.indexOf(".")!==-1&&(y=[],y.push({key:l,value:r[h].value}),k=$("#divDecoration-"+l).attr("data-views"),t.prototype.UpdateImageForLogo(y,k,"true"));t.prototype.InitializeLogoUploaderBlocksWithFilesDetails();u!=null&&u()}else i&&t.prototype.UpdateImageForLogo()},t.prototype.PopulateLogo=function(n,i,r,u){u===void 0&&(u=null);var e=$("#selectedbrand-name b").text(),f=[],o=$("#isProductEdit").val()==undefined?"false":$("#isProductEdit").val().toLowerCase();$("#cliparts").val().split(",").length>1||o=="true"?Artifi.Application.getClipartListByCodes(n,function(n){var b=$("#customizationText").val(),lt,pt,o,ut,y,ft,at,p,et,h,ot,st,w,vt,c,yt,v,it,ht,ct;b&&(b="<BaseDecorations>"+b+"<\/BaseDecorations>",lt=new DOMParser,pt=lt.parseFromString(b,"text/xml"));var s,a=[],k=[],d=[],g=[];for(k=$("#decorationOMSCodes").val().split(","),a=$("#clipartDetails").val().split(","),d=$("#clipartRequiredOpt").val().split(","),o=0;o<d.length;o++)g.push({key:d[o].split("-")[0],value:d[o].split("-")[1]});for(o=0;o<k.length;o++){var rt=null,l="",nt="",tt="";if(a[o]&&a[o].length>0&&(l=a[o].split("-")[1],nt=a[o].split("-")[0],tt=a[o].split("-")[2]),nt=nt.replace(":",","),s=n?n.filter(function(n){return nt.indexOf(n.ClipartId)>=0}):s,ut=$("#frmPersonalised_"+o+" .personlised-attribute .customized-txt-remove .control-md"),(s&&s!=null&&s.length>1||ut&&ut.length>0||$("#divDecoration-"+k[o]).length>0)&&$(".LogoHeader_"+k[o]).addClass("active"),y=tt?parseInt(tt):null,y&&s&&s.length>0){for(at=s.length,p=0;p<at;p++)if(s[p].ClipartId==y){ft=s[p];break}!ft||e&&e!=="All Brands"&&$("#selectedClipartCode").val()||(et=s.filter(function(n){return n.ClipartId!=y}),et.unshift(ft),s=et)}if(h=null,n&&s.length>0){if(r&&r!=undefined&&r.length>0)for(w in r)ot=r[w],ot.key==l&&(h=ot.value);st=null;for(w in g)vt=g[w].value,vt.toLowerCase()=="optional"&&$("#IsEnableLogoUpload").val().toLowerCase()=="false"&&(st=g[w].key);h=r&&r!=undefined&&r.length>0&&h?h:null;rt=$("#UploadedCliparts").val()?r&&r!=undefined&&r.length>0&&h&&h!=null?h:null:st!=l?r&&r!=undefined&&r.length>0&&h&&h!=null?h:y>0?tt:s[0].Code:r&&r!=undefined&&r.length>0&&h&&h!=null?h:null;t.prototype.FuzzySortPopulateLogo(s,l,"fuzzy_ddlLogo_"+l);t.prototype.FuzzySortSetSelectedLogo(h,rt,"fuzzy_ddlLogo_"+l)}f.push({key:l,value:rt})}if(i&&uploadedImageClipArts.length==0)if(c=$("#isMonogramming").val(),$("#IsImageUploaded").val()==undefined||$("#IsImageUploaded").val()=="False")c!=undefined&&c!=""&&c!="False"?t.prototype.UpdateImageForMonogramAndLogo(f,""):t.prototype.UpdateImageForLogo(f);else if(yt=JSON.parse($("#CartItemUploadedImagesJson").val()),yt.UploadedImages.length==0)c!=undefined&&c!=""&&c!="False"?t.prototype.UpdateImageForMonogramAndLogo(f,""):t.prototype.UpdateImageForLogo(f);else for(t.prototype.UpdateImageForLogo(f),v=0;v<r.length;v++)it=r[v].key,it!==""&&r[v].value.indexOf(".")!==-1&&(ht=[],ht.push({key:it,value:r[v].value}),ct=$("#divDecoration-"+it).attr("data-views"),c!=undefined&&c!=""&&c!="False"?t.prototype.UpdateImageForMonogramAndLogo(f,ct,"true"):t.prototype.UpdateImageForLogo(ht,ct,"true"));t.prototype.InitializeLogoUploaderBlocksWithFilesDetails();t.prototype.InitializePriceForOptionalLogo();u!=null&&u()}):i&&t.prototype.UpdateImageForLogo()},t.prototype.UpdateImageForMonogramAndLogo=function(n,i,r){var o,f,s,u,e;r===void 0&&(r="false");o=$("#PersonalizationDecorationLocationsCount").val();f=$(".GetMonogramPersonalisedAttributesWithMaxChar_"+persistedTextDecoLocation+" .quantity.sp-num").closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0];o>1&&(f=$(".GetMonogramPersonalisedAttributesWithMaxChar .quantity.sp-num").closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0]);i==undefined&&i==""&&(i=$(f).closest(".group-decoration-area").data("views"));s=parseInt($(f).attr("data-counter"));u=$(f).closest('div[id^="monogramAttributes_"]').attr("id");o>1&&(u=$(f).closest($(".multilocation ")).next("div").attr("id"),u!=""&&u!=undefined&&u!=null&&(e=$("#"+u).find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],e!=""&&e!=undefined&&e!=null&&(s=parseInt($(e).attr("formindex")))));t.prototype.UpdateImageForLogo(n,i,r,!1,s,u)},t.prototype.InitializePriceForOptionalLogo=function(){var n=$(".deco-is-optional > input"),i;n&&n.length>0&&(i=n[0],i.value!=""&&t.prototype.ShowHidePersonalizedPrice())},t.prototype.PopulateUploadedLogos=function(n,i,r,u){var o,h,s;i===void 0&&(i="");r===void 0&&(r="false");u===void 0&&(u=!1);o=[];n.split(",").forEach(function(n){o.push({Key:n.split(":")[0],Value:n.split(":")[1]})});h=$("#decorationOMSCodes").val();s=[];h.split(",").forEach(function(n){s.push({Key:n,Value:n})});uploadPopulateLogodecorationLocationCliparts=[];s.forEach(function(n){uploadPopulateLogodecorationLocationCliparts.push({key:n.Key,value:""})});var e=JSON.parse($("#ListOfDummyLogo").val()),c=$("#UploadedCliparts").val(),f=[];c.split(",").forEach(function(n){f.push({Key:n.split(":")[0],Value:n.split(":")[1]})});uploadPopulateLogodecorationLocationCliparts.forEach(function(n){o.forEach(function(t){var u=t.Key,i=t.Value;r="true";n.key==u?e.length>0&&(u==e[0].Key&&i!=e[0].Value||u!=e[0].Key&&i!=e[0].Value)?f&&f.map(function(n){return n.Key}).indexOf(n.key)>-1?f.forEach(function(t){n.key==t.Key&&t.Value&&(n.value=t.Value)}):(n.value=i,r="false"):n.value=i:f&&f.map(function(n){return n.Key}).indexOf(n.key)>-1?f.forEach(function(t){n.key==t.Key&&t.Value&&(n.value=t.Value)}):n.value=""})});uploadedImageClipArts=uploadPopulateLogodecorationLocationCliparts;t.prototype.UpdateImageForLogo(uploadPopulateLogodecorationLocationCliparts,i,r,u,0,"","true")},t.prototype.CreatePopulateLogo=function(n,i,r){var f=document.getElementById(r),e,u;if(f.childElementCount<=0)if(n.length>1){for(n.sort(function(n,t){return n.ClipartName>t.ClipartName?1:-1}),e="LogoHeader_"+i,$("#"+e).addClass("active"),u=0;u<n.length;u++)f.innerHTML=f.innerHTML+'<option value="'+n[u].Code+'" id="'+n[u].Code+'" title="'+n[u].ClipartName+'" class="logo_'+n[u].Code+'" data-logo="'+n[u].Code+'">'+n[u].ClipartName+"<\/option>";$("#"+r).change(function(){var f=$("#"+i).data("views"),e=$("#"+r+"option:selected").attr("id"),u,n;$("#dynamic-custom1").val(e);u=$("#selectedbrand-name b").text();$("#dynamic-custom3").val(u);n=[];n.push({key:i,value:$("#"+r).val()});t.prototype.UpdateImageForLogo(n,f);$("#"+r+" option[value= '"+$("#"+r).val()+"']").attr("selected","selected")})}else f.innerHTML=""},t.prototype.FuzzySortPopulateLogo=function(n,i,r){function y(){return f.val()!==undefined?f.val().toLowerCase():f.val()}function it(){if(n.length>1){var t=y();t!=""?(l?l.cancel():f.closest("div").find(".fuzzyerror").show(),a=!0,tt==="Ludicrous Mode"&&(v=Date.now(),u[e]&&u[e][t]?(rt(u[e][t]),nt(fuzzysort.go(t,s,{key:e})),h()):(nt(fuzzysort.go(t,s,{key:e})),h()))):(f.closest("div").find(".fuzzysortresult").empty(),f.closest("div").find(".fuzzyerror").hide())}}function h(n){n===void 0&&(n=0);setTimeout(function(){var r,i,t,f;if(!(n>=c.length+d.length)){if(r=y(),n>=c.length?(i=r,t=d[n-c.length]):(i=r+c[n],t=e),f=u[t]&&u[t][i],f)return h(n+1);n===0&&(a=!1);l=fuzzysort.goAsync(i,s,{key:t});l.then(function(r){u[t]===undefined&&(u[t]={});u[t][i]={total:r.total,html:g(r)};a||h(n+1)})}})}function g(n){for(var u="",t,r,f,i=0;i<n.length;i++)t=n[i],r=t.target,r=r.replace("'","&#39;"),f=t.obj.Code,u+='<li class="fuzzy-item">\n              <button class="decolist" id="fuzzybtn'+f+"\" value='".concat(r,"' aria-label=\"").concat(t.target,"\" data-clipartId='").concat(f,'\' aria-pressed="false" role="button">\n                ').concat(fuzzysort.highlight(t),"\n              <\/button>\n            <\/li>");return IsValidate=u!=""?!0:!1,'<ul class="spp-fuzzy-sort">'+u+"<\/ul>"}function nt(n){var i=Date.now()-v,t=g(n);if(u[e]===undefined&&(u[e]={}),u[e][y()]={total:n.total,html:t},IsValidate)f.closest("div").find(".fuzzyerror").hide();else return f.closest("div").find(".fuzzysortresult").empty(),f.closest("div").find(".fuzzyerror").show(),!1;k.html(""+t)}function rt(n){var t=Date.now()-v;k.html(""+n.html)}var p,o,w,b;if(n.length>1){n.sort(function(n,t){return n.ClipartName>t.ClipartName?1:-1});p="LogoHeader_"+i;$("#"+p+", #decoration-location-heading-"+i+", #decoration-options-heading").addClass("active");$("#error_"+r).hide();$("#"+r).attr("shopbylogo",i);$("#"+r).off("click").on("click focusin",function(){var h,f,t,s;for($("#"+r).val()&&$("#"+r).attr("oldValue",$("#"+r).val()),$("#error_"+r).hide(),h=$("#"+r).val(),$("#"+r).val(""),$("#fuzzykeydown").val("0"),$("#results_"+r).css("display","block"),$("#"+r).attr("shopbylogo",i),f='<ul class="spp-fuzzy-sort">',t=0;t<n.length;t++){var u=n[t].ClipartName,e=n[t].ClipartName,o=n[t].ClipartId;e=e.replace("'","&#39;");s="fuzzybtn"+o;f+=h===u?'<li class="decName fuzzy-item active">\n                      <button class="decolist" id="'.concat(s,"\" value='").concat(e,"' data-clipartId='").concat(o,"' aria-label=\"").concat(u,'" aria-pressed="false" role="button">\n                        ').concat(u,"\n                      <\/button>\n                    <\/li>"):'<li class="decName fuzzy-item">\n                      <button class="decolist" id="'.concat(s,"\" value='").concat(e,"'  data-clipartId='").concat(o,"' aria-label=\"").concat(u,'" aria-pressed="false" role="button">\n                        ').concat(u,"\n                      <\/button>\n                    <\/li>")}f+="<\/ul>";$("#results_"+r).html(f)})}else $("#"+r).val("");var s=[];for(o=0;o<n.length;o++)w=n[o].ClipartName,b=n[o].Code,s.push({ClipartName:w,Code:b}),fuzzyObj.ClipartName=n[o].ClipartName,fuzzyObj.Code=n[o].Code,fuzzyArray.indexOf(fuzzyObj)==-1?(fuzzyArray.push(fuzzyObj),fuzzyObj={ClipartName:[],Code:[]}):fuzzyObj={ClipartName:[],Code:[]};var f=$("#"+r),k=$("#results_"+r),d=Object.keys(s),e="ClipartName",tt="Ludicrous Mode",u={},c="abcdefghijklmnopqrstuvwxyz",l,a,v;h();$(".fuzzysort").off().on("keydown",function(n){var t,i,r,u,f;if($(".fuzzysort").focusin()){if(t=$("#fuzzykeydown").val(),i="#fuzzybtn",i=="#fuzzybtn"&&(n.keyCode==40||n.keyCode==39))return t==0||t==""?($(i+t).focus(),t++,$("#fuzzykeydown").val(t),n.preventDefault(),!1):(t++,$("#fuzzykeydown").val(t),r=t-1,$(i+r).focus(),n.preventDefault(),!1);if(i=="#fuzzybtn"&&(n.keyCode==38||n.keyCode==37))return t--,$("#fuzzykeydown").val(t),t<0&&(i="input",t=0,$("#fuzzykeydown").val("0"),u=$("#fuzzybtn"+t).parents("div").eq(1).closest(".fuzzysort").find(".fuzzyinput").attr("id"),$("#"+u).focus()),$(i+t).focus(),n.preventDefault(),!1;if(f="#fuzzybtn0",n.keyCode==40)return $(f).focus(),n.preventDefault(),!1}});$(document).on("mousedown keydown",".deco-is-optional > .fuzzy-sort-list > .spp-fuzzy-sort > .decName > .decolist",function(n){if(n.keyCode==13||n.key=="Enter"||n.type=="mousedown"){var i=$(this).parents().eq(3).find("input").attr("shopbylogo");typeof i!="undefined"&&t.prototype.ShowHidePersonalizedPrice()}});$(document).on("mousedown keydown","#results_"+r+" .decolist",function(n){var f,e,u,s;if(n.keyCode==13||n.key=="Enter"||n.type=="mousedown"){var o=$(this).attr("Id"),i=o.replace("fuzzybtn",""),r=$(this).parents().eq(3).find("input").attr("shopbylogo");typeof r!="undefined"&&(f=$("#"+r).data("views"),$("#dynamic-custom1").val(i),e=$("#selectedbrand-name b").text(),$("#dynamic-custom3").val(e),u=!1,dict.forEach(function(n){n.key==r&&(n.value=i,u=!0)}),u||dict.push({key:r,value:i}),$("#hdnSelectedVariant").val(""),t.prototype.UpdateImageForLogo(dict,f),s=$(this).attr("id"),$("#"+$(this).parents().eq(3).find("input").attr("id")).val($(this).attr("value")),$("#"+$(this).parents().eq(3).find("input").attr("id")).attr("oldValue",$(this).attr("value")),$("#"+$(this).parents().eq(3).find("input").attr("id")).attr("clipartcode",i),$("#"+$(this).parents().eq(3).find("input").attr("id")).closest("div").find(".fuzzyerror").hide(),$(this).parents().eq(2).empty(),$(this).parents().eq(2).css("display","none"))}});$(document).on("click",function(n){var i=$(n.target).attr("class"),t;i!="fuzzyinput"&&($(".fuzzyinput").each(function(){var n=$(this).attr("id"),i;t=fuzzyArray.filter(function(t){return t.ClipartName.toLowerCase()===$("#"+n).val().trim().toLowerCase()});t!=""?(i=fuzzyArray.filter(function(t){return t.ClipartName.toLowerCase()===$("#"+n).val().trim().toLowerCase()})[0].ClipartName,$(this).attr("oldValue",$(this).val()),$(this).val(i.trim()),t=""):$(this).val().trim()===""?$(this).attr("oldValue")!=""&&($(this).val($(this).attr("oldValue")),t=""):$(this).attr("oldValue")!=""&&($(this).val($(this).attr("oldValue")),t="")}),$("#fuzzykeydown").val("0"),$(".fuzzysortresult").empty(),$(".fuzzysortresult").css("display","none"))});f.on("input",it)},t.prototype.FuzzySortSetSelectedLogo=function(n,t,i){n?fuzzyArray.filter(function(t){return t.Code===n})[0]&&$("#"+i).val(fuzzyArray.filter(function(t){return t.Code===n})[0].ClipartName):t&&$("#"+i).val(fuzzyArray.filter(function(n){return n.Code===t})[0].ClipartName)},t.prototype.SetSelectLogo=function(n,t,i){n?$("#ddlLogo_"+i+" option[value= '"+n+"']").attr("selected","selected"):$("#ddlLogo_"+i+" option[value= '"+t+"']").attr("selected","selected")},t.prototype.UpdateImageForLogo=function(n,i,r,u,f,e,o){var b,p,v,a,c;n===void 0&&(n="");i===void 0&&(i="");r===void 0&&(r="false");u===void 0&&(u=!1);f===void 0&&(f=0);e===void 0&&(e="");o===void 0&&(o="false");var s=$("#ViewData").val(),w=JSON.parse(s),l=$("#xmlCompatibleVersionNumber").val(),k=$("#isHighResolutionImage").val(),d=$("#IsAllowIndexing").val(),h=t.prototype.CreateQueryStringForUpdateImage(n,r,u,f,e),y={};if(l!=undefined&&l>=3&&(!i||i==""||i=="undefined"))if(h&&h.length>0&&s&&s!=null&&s!="undefined"&&s!="{}")for(b in w)a=h.filter(function(n){return w[b].match(n.widget_key)}),y[b]=a;else null;else if(l!=undefined&&l>=3&&i&&i!=null&&i!="undefined")if(h&&h.length>0&&s&&s!=null&&s!="undefined"&&s!="{}")for(p=i.split(","),v=0;v<p.length;v++)a=h.filter(function(n){return w[p[v]].match(n.widget_key)}),y[p[v]]=a;else null;else(l==undefined||l==""||l<=2)&&h&&h.length>0?y={queryString:h}:null;c=$("#ArtifiViewData").val();c&&c!=undefined&&c!=null&&c!=""&&(c=JSON.parse(c),Artifi.Application.setAngleData($("#artifiSKU").val(),c));Artifi.Application.getProductImageUrls({sku:$("#artifiSKU").val(),isZoom:k,allowIndexing:d},y,function(n){t.prototype.SetVariantAsDefault(n);t.prototype.SetImages(n,i,o)})},t.prototype.RemoveArtworkBackground=function(n){$(n).is(":checked")?$("#isRemoveArtworkBackground").val("true"):$("#isRemoveArtworkBackground").val("false");$("#product-lens-image .deco-loading").addClass("active");t.prototype.PopulateUploadedLogos($("#UploadedCliparts").val(),$("#alt-images").find(".selected-item").eq(0).find("a").eq(0).attr("data-view-code"),"true");$("#product-image").load(function(){$("#product-lens-image .deco-loading").removeClass("active")})},t.prototype.SetVariantAsDefault=function(n){if($("#hdnSelectedVariant").val()!=""&&$("#hdnSelectedVariant").val()!=undefined)for(var t=0;t<n.length;t++)n[t].IsDefault=!1,n[t].ViewCode.toLowerCase()==$("#hdnSelectedVariant").val().toLowerCase()&&(n[t].IsDefault=!0)},t.prototype.GetLogoWidthFromClipArtCode=function(n,t){for(var i="0",u=$("#LogoWidths").val()?$("#LogoWidths").val().split(","):"",f,r=0;r<u.length;r++)if(u[r].trim().split("#")[0].trim().toString()==n){if(u[r].indexOf(t)>-1){i=u[r].trim().split("#")[1].trim().toString();break}}else u[r].indexOf(t)>-1&&(i=u[r].trim().split("#")[1].trim().toString());return i=="0"&&$("#product-lens-image").attr("data-lens-image")!=undefined&&$("#product-lens-image").attr("data-lens-image").split("parameters=")[1]!=undefined&&$("#product-lens-image").attr("data-lens-image").split("parameters=")[1].split("&width")[0]!=undefined&&(f=JSON.parse(decodeURIComponent($("#product-lens-image").attr("data-lens-image").split("parameters=")[1].split("&width")[0])).find(function(n){return n.type=="image"}),i=f!=null&&f!=undefined?f.width:i),i.length==0&&(i=null),i},t.prototype.updateImageOnColorChange=function(){var n=$("#artifiSKU").val(),i=$("#isHighResolutionImage").val(),r=$("#IsAllowIndexing").val();ArtifiModel.prototype.sku=n;Artifi.Application.getProductImageUrls({sku:n,isZoom:i,allowIndexing:r},null,function(n){t.prototype.SetVariantAsDefault(n);t.prototype.SetImages(n);typeof bttUT!="undefined"&&typeof bttUT.end=="function"&&bttUT.end({pageName:"pdp - color change - VT",txnName:"Prod"})});ZnodeBase.prototype.HideLoader()},t.prototype.SetImages=function(n,i,r){var l,s,f,e,u,h,c,o;if(i===void 0&&(i=null),r===void 0&&(r="false"),$("#isRemoveArtworkBackground").val().toLowerCase()=="true"&&$("#removeArtworkBackground").prop("checked",!0),$("#UploadedCliparts").val()!=undefined&&$("#UploadedCliparts").val()!=""&&$("#removeArtworkBackgroundCheckbox").removeClass("hidden"),l=$("#xmlCompatibleVersionNumber").val(),n.length<1)$("#product-image").attr("src",$("#loaderImage").val()),$("#product-lens-image").addClass("noimageclass"),f=$("#alt-images").find(".owl-item"),$(f).length>0&&(s=$(f).find(".item").eq(0),$.each(f,function(n,t){$(t).find("img").eq(0).attr("src",$("#loaderImage").val());$(t).find("a").eq(0).attr("href","JavaScript:void(0);");$(t).find("a").eq(0).attr("data-lens-image",$("#loaderImage").val());$(t).find("a").eq(0).attr("data-big-image",$("#loaderImage").val());$(t).find("a").eq(0).attr("data-main-src",$("#loaderImage").val());$(t).find("a").eq(0).attr("data-view-code",$("#loaderImage").val());$(t).find("img").eq(0).attr("data-view-code",$("#loaderImage").val())}));else{s=$("#alt-images").find(".item").eq(0);f=$("#alt-images").find(".owl-item");$(f).length>0&&(s=$(f).find(".item").eq(0));e="";l>=2&&i&&(u=r=="true"?n.DisplayOrder!=null&&n.DisplayOrder!=""&&n.DisplayOrder!=undefined?n.filter(function(n){return i.match(n.ViewCode)&&Math.min(n.DisplayOrder)}):n.filter(function(n){return i.match(n.ViewCode)}):n.filter(function(n){return i.match(n.ViewCode)&&Math.min(n.DisplayOrder)}));var v=$("#CustomArtifiViewData").val()!=undefined?$("#CustomArtifiViewData").val():"",a="",y=$(".product-name").html();for(n.forEach(function(r,f){if(l>=2&&i&&i!=""&&u&&u!=""&&u!="undefined"&&u.length>0?(v.indexOf(u[0].ViewCode)!=-1||$("#ArtifiViewData").val()=="")&&(a=u[0].StandardImage,$("#product-image").attr("src",u[0].StandardImage),$("#product-image").attr("data-view-code",u[0].ViewCode),$("#product-lens-image").attr("data-lens-image",u[0].ZoomImage),$("#product-lens-image").attr("data-view-code",u[0].ViewCode)):(r.IsDefault==!0||n&&n.length==1)&&(v.indexOf(r.ViewCode)!=-1||$("#ArtifiViewData").val()=="")&&(a=r.StandardImage,$("#product-image").attr("src",r.StandardImage),$("#product-image").attr("data-view-code",r.ViewCode),$("#product-lens-image").attr("data-lens-image",r.ZoomImage),$("#product-lens-image").attr("data-view-code",r.ViewCode)),$("#alt-images").length>0&&(v.indexOf(r.ViewCode)!=-1||$("#ArtifiViewData").val()=="")){var o=$(s).clone();$(o).find("img").eq(0).attr("src",r.ThumbnailImage);$(o).find("img").eq(0).attr("alt","Alternate view "+(f+1)+" of "+y);$(o).find("a").eq(0).attr("href","JavaScript:void(0);");$(o).find("a").eq(0).attr("data-lens-image",r.ZoomImage);$(o).find("a").eq(0).attr("data-big-image",r.StandardImage);$(o).find("a").eq(0).attr("data-main-src",r.StandardImage);$(o).find("a").eq(0).attr("data-view-code",r.ViewCode);$(o).find("a").eq(0).click(function(){t.prototype.SetMainProductImage($(o).find("a").eq(0))});l>=2&&i&&i!=""&&u&&u!=""&&u!="undefined"&&u.length>0?e=u[0].ViewCode:r.IsDefault==!0?e=r.ViewCode:e==""&&(e=r.ViewCode);$(o).find("img").eq(0).attr("src",r.ThumbnailImage);$(o).find("img").eq(0).attr("data-view-code",r.ViewCode);$("#alt-images").append(o)}}),a==""&&(n.filter(function(n){return n.ViewCode===e})&&e!=""?(h=n.filter(function(n){return n.ViewCode===e}),$("#product-image").attr("src",h[0].StandardImage),$("#product-image").attr("data-view-code",h[0].ViewCode),$("#product-lens-image").attr("data-lens-image",h[0].ZoomImage),$("#product-lens-image").attr("data-view-code",h[0].ViewCode)):(a=n[0].StandardImage,$("#product-image").attr("src",n[0].StandardImage),$("#product-image").attr("data-view-code",n[0].ViewCode),$("#product-lens-image").attr("data-lens-image",n[0].ZoomImage),$("#product-lens-image").attr("data-view-code",n[0].ViewCode))),$(s).remove(),$(f).length>0&&$("#alt-images .owl-wrapper-outer").remove(),t.prototype.InitializeOwlCarousel(".Product_Altimages"),c=$("#alt-images").find("div.owl-item"),o=0;o<c.length;o++)$(c[o]).removeClass("selected-item"),c.find("a")[o].dataset.viewCode.toLowerCase()==e.toLowerCase()&&c.eq(o).addClass("selected-item")}},t.prototype.SetMainProductImage=function(n){var r=$(n).attr("data-main-src"),u=$(n).attr("data-big-image"),i=$(n).attr("data-view-code");$("#product-lens-image").attr("data-lens-image",u);$("#product-lens-image img").attr("src",r);$("#product-lens-image").attr("data-view-code",i);$("#product-lens-image img").attr("data-view-code",i);t.prototype.HighlightProductImageSelection(n)},t.prototype.HighlightProductImageSelection=function(n){for(var i=$(n).parent("div.item").parent("div.owl-item").siblings(),t=0;t<i.length;t++)$(i[t]).removeClass("selected-item");$(n).parent("div.item").parent("div.owl-item").addClass("selected-item")},t.prototype.GetZoomImageUrl=function(n){var r=$("#zoomLevel").val(),t=$("#zoomUnit").val(),u=$(n).attr("data-view-code"),f=$("#product-image").attr("src"),e=new URLSearchParams(f),i={};r=="Pixel"?i={sku:$("#artifiSKU").val(),width:t,height:t}:r=="Percentage"&&(i={sku:$("#artifiSKU").val(),percent:t});Artifi.Application.getViewImage(i,{queryString:JSON.parse(e.get("parameters"))},u,function(n){$("#currentThemePath").attr("value")=="SalmonSalmon"?$("#zoomed-image").attr("src",n.ZoomImage):$("#product-lens-image").attr("data-lens-image",n.ZoomImage)})},t.prototype.GetPortalSettings=function(n,i){ArtifiAPI.prototype.GetArtifiPortalCredentials(n,function(r){var u="ArtifiPortalConfiguration_"+n+i;r!=null||r.JsUrl==null?(sessionStorage.setItem(u,JSON.stringify(r)),t.prototype.CreateArtifiPathUrl(JSON.parse(sessionStorage.getItem(u)),n,i)):console.log("Please check the store artifi settings.")})},t.prototype.InitialiseArtifiSettings=function(n){if(!n.HasError){$("#artifiDomainName").val(n.JsUrl);$("#artifiWebstoreCode").val(n.WebsiteCode);$("#artifiWebApiClientKey").val(n.WebApiClientKey);var t=$("#ArtifiImageCache").val()=="True"?!0:!1,i=$("#IsAllowIndexing").val(),r={websiteId:n.WebsiteCode,webApiClientKey:n.WebApiClientKey,maxMainImgWAndH:"600",maxThumbImgWAndH:"300",ConversionUnit:n.ConversionUnit,isCacheEnabled:t,allowIndexing:i};Artifi.Application.init(r);ArtifiModel.prototype.isInitialized="true";ArtifiModel.prototype.sku=$("#artifiSKU").val();ArtifiModel.prototype.designId=$("#designId").val()}},t.prototype.CreateArtifiPathUrl=function(n){if(n!=null)try{Artifi&&Artifi.Application?t.prototype.InitateArtifiSettingsForClipArtsForLogo(n):t.prototype.CallArtifiInitiateFunction(n)}catch(i){t.prototype.CallArtifiInitiateFunction(n)}},t.prototype.CallArtifiInitiateFunction=function(n){var i=n.JsUrl.lastIndexOf("/"),r="";r=i==n.JsUrl.length?n.JsUrl.substring(0,n.JsUrl.length):i==n.JsUrl.length-1?n.JsUrl.substring(0,n.JsUrl.length-1):n.JsUrl;$.getScript(r+artifiImageIntegrationUrl,function(){t.prototype.InitateArtifiSettingsForClipArtsForLogo(n)})},t.prototype.InitateArtifiSettingsForClipArtsForLogo=function(n){var r,u,i,f,e;if(t.prototype.InitialiseArtifiSettings(n),n.isGuest&&(r=localStorage.getItem("UserId"),r==undefined&&r==null&&localStorage.setItem("UserId",n.userId)),cartSelectedCliparts=$("#selectedClipartCode").val(),cartSelectedCliparts){u=JSON.parse(cartSelectedCliparts);i=[];for(f in u)i.push({key:f,value:u[f]})}e=$("#IsEnableLogoUpload").val()!=undefined&&$("#IsEnableLogoUpload").val()!=""?$("#IsEnableLogoUpload").val().toLowerCase():!1;$("#isProductEdit").val().toLowerCase()=="true"?t.prototype.PopulateLogo($("#cliparts").val(),!0,selectedDecoCliparts!=null&&selectedDecoCliparts.length>0?selectedDecoCliparts:i):$(".fuzzyinputDefault").length>0&&e=="false"||$("#cliparts").val().split(",").length==1?t.prototype.PopulateLogoOnLoad($("#cliparts").val(),!0,selectedDecoCliparts!=null&&selectedDecoCliparts.length>0?selectedDecoCliparts:i):t.prototype.PopulateLogo($("#cliparts").val(),!0,selectedDecoCliparts!=null&&selectedDecoCliparts.length>0?selectedDecoCliparts:i);$(document).trigger("updateOrderStatusOnSuccess",{type:"updateOrderStatusOnSuccess",message:"myTrigger fired.",time:new Date})},t.prototype.DisplayAddToCartModal=function(){var o=$("#product-image").attr("src"),t,r,i,u,n,f,e;if($("#AddedToCartImg").attr("src",o),$("#AddedToCartConfirmation").modal("show"),$("#quantity-error-msg").text(""),t=document.getElementsByClassName("product-size-quantity-group"),r=document.getElementById("Quantity"),document.getElementById("AddedToCartSizesQty").innerHTML="",r&&(n=parseInt(r.value),console.log("quantity "+n),$("#AddedToCartSizesQty").append("<li>"+n+"<\/li>")),t.length>0)for(i=0;i<t.length;i++)u=t[i].getElementsByClassName("quantity")[0],u!=undefined&&(n=parseInt(u.value),n>0&&(f=t[i].getElementsByClassName("product-size-label")[0],e=f.innerText,$("#AddedToCartSizesQty").append("<li>"+e+" "+n+"<\/li>")))},t.prototype.freeShippingDisplay=function(n){var t=document.getElementById("value-free-shipping"),i;t&&(i=250,n>i?(t.classList.add("active"),console.log("You're getting free shipping!")):n>175?(t.classList.remove("active"),console.log("Spend $"+(i-n).toFixed(2)+" more to get free shipping!")):(t.classList.remove("active"),console.log("Not eligible for free shipping.")))},t.prototype.DisplayAddToCartResult=function(n){var i,r;if(n&&n!=""){try{i=JSON.parse(n)}catch(u){i=n}if(i.status==!0){i.IsSpecialOfferCartRestrictionsDisabled==undefined||i.IsSpecialOfferCartRestrictionsDisabled?i.errorMessage?(ZnodeBase.prototype.HideLoader(),ZnodeNotification.prototype.DisplayNotificationMessagesHelper(i.errorMessage,"error",isFadeOut,fadeOutTime)):t.prototype.ShowMaxQuantityErrorMessage():($("#custom-modal").modal("show"),ZnodeBase.prototype.HideLoader());return}if(i.status==!1&&i.isCategoryLimitCountValid==!1){r=ZnodeBase.prototype.getResourceByKeyName("CategoryProductsLimitExceedMessage");ZnodeNotification.prototype.DisplayNotificationMessagesHelper(r.replace("{categoryProductsLimit}",i.categoryLimitNumberOfProductsCount),"error",isFadeOut,fadeOutTime);ZnodeBase.prototype.HideLoader();return}$("#isProductEdit").val().toLowerCase()=="true"?(n.designId!=undefined&&n.designId!=null&&n.designId!=""&&(ArtifiModel.prototype.designId=n.designId),n.parentCartLineItemId>0&&$("#ParentOmsSavedCartLineItemId").val(n.parentCartLineItemId),i.redirectUrl!=undefined&&i.redirectUrl!=""&&(window.location.href=i.redirectUrl),$("#AddedToCartConfirmation").length>0?this.DisplayAddToCartModal():(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("CartUpdateMessage"),"success",isFadeOut,fadeOutTime),$("#quantity-error-msg").text(""))):i==undefined?window.location.reload():(i.redirectUrl!=undefined&&i.redirectUrl!=""&&(window.location.href=i.redirectUrl),$("#AddedToCartConfirmation").length>0?this.DisplayAddToCartModal():(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AddToCartMessage"),"success",isFadeOut,fadeOutTime),$("#quantity-error-msg").text("")))}else n==undefined||n==""?window.location.reload():ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AddToCartErrorMessage"),"error",isFadeOut,fadeOutTime);t.prototype.RetentionScienceAddToCart();ZnodeBase.prototype.HideLoader();CustomEndpoint.prototype.GetCartSubTotal(function(n){var r,u,f,i,e;(!n.showPriceToLoggedInCustomersOnly||n.isLoggedInUser)&&(i=0,$("#enableDisplayAsPointValue").val()!=undefined&&$("#enableDisplayAsPointValue").val().toLowerCase()=="true"?(e=n.total.substring(n.total.indexOf("$")+1).replace(/,/g,""),$(".cart .headerSubtotal").html(parseInt(e)+" point(s)")):($(".cart .headerSubtotal").html(n.total),$(".cart .combinedHeaderQuantity").html((f=(u=(r=$("#hdnConsolidatedItemCount"))===null||r===void 0?void 0:r.val())===null||u===void 0?void 0:u.toString())!==null&&f!==void 0?f:""),$(".cart .headerQuantity").html(n.totalItemsQuantity)),n.totalItemsQuantity>0?(i=Math.round(parseFloat(n.total.replace(/\$|,/g,""))*100)/100,$(".cart > a").addClass("hasItem"),t.prototype.freeShippingDisplay(i),sessionStorage.setItem("cartValue",String(i))):($(".cart > a").removeClass("hasItem"),t.prototype.freeShippingDisplay(0)));n.isDisplayItemPricing||$(".cart .headerSubtotalQuantity").html(n.totalItemsQuantity)})},t.prototype.RetentionScienceAddToCart=function(){var n,r,t,u,i;try{var f=$("#hdnPublishState").val(),e=parseInt($("#hdnPortalId").val()),o=$("#hdnCurrentPage").val();if(e!==138||f!=="PRODUCTION"||o!=="PDP")return;n=window._rsq||[];r="1390";n.push(["_setSiteId",r]);n.push(["_enableOnsite"]);t=parseInt($("#hdnUserId").val());u=$("#hdnUserEmail").val();t>0&&(n.push(["_setUserId",t]),n.push(["_setUserEmail",u]));i=$(".product-quantity-input input[type='text']").filter(function(){return $(this).val()!=""});i.length>0&&$.each(i,function(t,i){var u=$(i).data("sku"),f=$($("h1.product-name")[0]).text().trim(),r=parseFloat($($(".PriceWithoutCustomization")[0]).text().trim().replace("$",""));isNaN(r)&&(r=parseFloat($($(".product-unit-price")[0]).text().trim().replace("$","")));n.push(["_addItem",{id:u,name:f,price:r}])});n.push(["_setAction","shopping_cart"]);n.push(["_track"])}catch(s){}},t.prototype.DisplayAddToCartResultAndClearECertFields=function(n){(t.prototype.DisplayAddToCartResult(n),$("#ExtraEcerts").html(""),$("#isProductEdit").val()!=="True")&&($(".eCertTo").val(""),$(".eCertEmail").val(""),$(".eCertFrom").val(""),$(".eCertMessage").val(""),$(".eCertQuantity").val("1"))},t.prototype.GetCartLineItemId=function(n,t){var i="";return $.each(t,function(t,r){n==t&&(i=r)}),i},t.prototype.GetLineItemIds=function(n,t,i){return n==t?omsSavedCartLineItemIds[i].split("_")[1]:""},t.prototype.InitializeOwlCarousel=function(n){var t=$(n).data("owlCarousel");typeof t=="undefined"?$(n).owlCarousel({autoPlay:!1,navigation:!0,items:4,itemsCustom:[[0,1],[320,2],[480,2],[600,2],[768,3],[992,3],[1200,4]],navigationText:["<i class='icon-left'><\/i>","<i class='icon-right'><\/i>"]}):t&&t.reinit()},t.prototype.MaxCharValidation=function(n,t){$("#"+t).keypress(function(t){this.value.length==parseInt(n)?t.preventDefault():this.value.length>parseInt(n)&&(this.value=this.value.substring(0,parseInt(n)))})},t.prototype.SetRecentlyProductDetails=function(n){var r=15,u=!1,i,t;n!=null&&n!=undefined&&(i=$("#selectedbrand-name b").text(),n.BrandCode=i!=undefined&&i!=null&&i!=""?i:"",u=n.ConfigurableProductId==n.PublishProductId?!0:n.ConfigurableProductId==0&&n.PublishProductId>0?!0:!1,u&&(n.RetailPrice=n.RetailPrice.replace(",","."),n.SalesPrice=n.SalesPrice.replace(",","."),n.PromotionalPrice=n.PromotionalPrice.replace(",","."),t=JSON.parse(localStorage.getItem("recentlyViewedProducts")),t==null||t.length==0?(t=[],t.push(n),localStorage.setItem("recentlyViewedProducts",JSON.stringify(t))):(t.some(function(t){return t.PublishProductId==n.PublishProductId})&&(t=t.filter(function(t){return t.PublishProductId!=n.PublishProductId})),t.unshift(n),t.length>r&&t.splice(r),localStorage.setItem("recentlyViewedProducts",JSON.stringify(t)))))},t.prototype.GetRecentlyViewProducts=function(n){var t=JSON.parse(localStorage.getItem("recentlyViewedProducts")),i;n!=undefined&&n!=null&&n>0&&t!=undefined&&t!=null&&t.length>0&&(t=t.filter(function(t){return t.PublishProductId!=n.toString()}));t!=undefined&&t!=null&&t.length>0&&(i=JSON.stringify(t),CustomEndpoint.prototype.GetRecentlyViewProducts(i,function(n){$(".recent-view-items").html(n);_CustomRecentViewProduct.prototype.PageScripts();ZnodeBase.prototype.onImageError()}))},t.prototype.GetSelectedDecorationLocationCliparts=function(){var t=$("#customizationText").val(),r,n;if(t){if(t="<BaseDecorations>"+t+"<\/BaseDecorations>",r=[],t)var f=new DOMParser,e=f.parseFromString(t,"text/xml"),i=e.getElementsByTagName("DecorationLocationOMSCode");for(n=0;n<i.length;n++){var s=$("#fuzzy_ddlLogo_"+i[n].innerHTML).val(),o=$("#fuzzy_ddlLogo_"+i[n].innerHTML).attr("clipartcode"),u=fuzzyArray.filter(function(n){return n.Code===o});u.length>0&&r.push({key:i[n].innerHTML,value:u[0].Code})}}return r},t.prototype.SetSelectedDecorationLocationCliparts=function(n){var r,t,u,i;if(n===void 0&&(n=""),selectedDecoCliparts.length>0)for(r in selectedDecoCliparts){t=selectedDecoCliparts[r];for(u in n)i=n[u],t.key==i.key&&(t.value=i.value)}else selectedDecoCliparts=n},t.prototype.UpdateCustomizedProductImage=function(n,i,r){i===void 0&&(i=0);r===void 0&&(r="");t.prototype.UpdateImageForLogo(dict,n,"false",!1,i,r)},t.prototype.UpdateCustomizedProductImageForRemove=function(n,i){var r=!1;dict.forEach(function(t){t.key==n&&(t.value=null,r=!0)});r||dict.push({key:n,value:null});t.prototype.UpdateImageForLogo(dict,i)},t.prototype.ShowHidePersonalized=function(n){$("div[data-test-selector='divPersonalisedAttribute_"+n+"']").toggle();$("#divAddCustomizationForAllItems_"+n).hide();var i=$("#isMonogramming").val(),r=$("#inStockMinQty").val();i!=undefined&&i!=null&&i!=""&&(i=i.toLowerCase());i!="true"&&(r==undefined||r==""||r==null)&&t.prototype.ShowHidePersonalizedPrice();$("#frmPersonalised_"+n).valid()},t.prototype.ShowHidePersonalizedPrice=function(){$(".PriceWithCustomization").hasClass("nooptional")||($(".PriceWithCustomization").addClass("bold").removeClass("disabled"),$(".PriceWithoutCustomization").addClass("disabled").removeClass("bold"))},t.prototype.ClearPersonalizedPriceInputs=function(){$(".personlised-attribute-block").is(":visible")==!1&&($(".PriceWithoutCustomization").addClass("bold").removeClass("disabled"),$(".PriceWithCustomization").addClass("disabled").removeClass("bold"))},t.prototype.ClearInputs=function(n,i){var r,u,f;$("#IsCustiomizationRequired").val()=="True"&&($("#divAddCustomizationForAllItems_"+n).show(),$("div[data-test-selector='divPersonalisedAttribute_"+n+"']").hide(),r=$("#isMonogramming").val(),u=$("#inStockMinQty").val(),r!=undefined&&r!=null&&r!=""&&(r=r.toLowerCase()),r!="true"&&(u==undefined||u==""||u==null)&&t.prototype.ClearPersonalizedPriceInputs());$(".personalized-attributes-body #frmPersonalised_"+n+" input").val("");$(".personalized-attributes-body #frmPersonalised_"+n+" textarea").val("");$(".personalized-attributes-body #frmPersonalised_"+n+" select").val("");f=$(i).data("test-selector","linkClearInput").parents(":has(.decoration-heading)").first().find(".decoration-heading").data("views");t.prototype.UpdateCustomizedProductImage(f)},t.prototype.ClearMonogramingInputs=function(n,i){var a=$("#PersonalizationDecorationLocationsCount").val(),r=$(i).closest('div[id^="monogramAttributes_"]').attr("id"),f,s,h,c,u,e,o,l;a>1&&(r=$(i).closest('div[id^="multipleMonogramAttributes_"]').attr("id"),f=$(i).closest(".ind-txt-section").find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],f!=undefined&&f!=null&&f!=""&&(n=parseInt($(f).attr("formindex"))));s=$("#"+r+" .personalized-attributes-body #frmPersonalised_"+n+" input").val();$("#"+r+" .personalized-attributes-body #frmPersonalised_"+n+" input").val("");$("#"+r+" .personalized-attributes-body #frmPersonalised_"+n+" textarea").val("");$("#"+r+" .personalized-attributes-body #frmPersonalised_"+n+" select").val("");h=0;$(".quantity:visible").each(function(){if($(this).attr("data-sku")===$(i).attr("data-sku")){$(this).val((parseInt($(this).val())-1).toString());isNaN($(this).val())||(persistedMonogramQuantity=$(this).val());var n=$(this).attr("data-counter");return n!=undefined&&n!=null&&n!=""&&(h=parseInt(n)),!0}});c=0;a>1&&(u="",e=$(".GetMonogramPersonalisedAttributesWithMaxChar .quantity.sp-num").closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],e!=""&&e!=undefined&&e!=null&&(o=$(e).closest($(".multilocation ")).next("div").attr("id"),o!=undefined&&o!=null&&o!=""&&(u=$("#"+o).find("input[type='text']").toArray().filter(function(n){return n.value!=""})[0],u!=undefined&&u!=null&&u!=""&&(c=parseInt($(u).attr("formindex"))))));l="";s!=undefined&&s!=null&&s!=""&&(l=$(i).data("test-selector","linkClearInput").parents(":has(.decoration-heading)").first().find(".decoration-heading").data("views"));t.prototype.UpdateCustomizedProductImage(l,c,r);$(".GetMonogramPersonalisedAttributesWithMaxChar_"+$(i).closest("div[data-decokey]").attr("data-counter")+" #monogramAttributes_"+h+" ._PersonalisedAttribute_"+n).remove();$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+h+" ._PersonalisedAttribute_"+n).remove()},t.prototype.SelectCustomiseText=function(){$(".customized-txt-remove .select-control").on("change",function(){var n=$(this).parents(":has(.decoration-heading)").first().find(".decoration-heading").data("views");t.prototype.UpdateCustomizedProductImage(n)})},t.prototype.SelectCustomiseDecorationText=function(){$(".customized-txt-remove .select-control").on("change",function(){var n=$(this).closest(".group-decoration-area").data("views");t.prototype.UpdateCustomizedProductImage(n)})},t.prototype.ShowHideMonogrammedPrice=function(){$("#PriceWithoutCustomization").addClass("d-none");$("#PriceWithoutCustomization").removeClass("d-flex");$("#PriceWithCustomization").removeClass("d-none");$("#PriceWithCustomization").addClass("d-flex")},t.prototype.ShowHideStandardPrice=function(){$("#PriceWithoutCustomization").removeClass("d-none");$("#PriceWithoutCustomization").addClass("d-flex");$("#PriceWithCustomization").addClass("d-none");$("#PriceWithCustomization").removeClass("d-flex")},t.prototype.ShowHideCustomizedTab=function(){$("#tab-Standard").removeClass("active");$("#tab-Customized").addClass("active");$("#linkStandard").removeClass("active");$("#linkCustomized").addClass("active");$("#CustomizedPriceStatement").removeClass("hide");$("#StandardPriceStatement").addClass("hide")},t.prototype.ShowHideIndividualizedTab=function(){$("#tab-Standard").removeClass("active");$("#tab-Individualized").addClass("active");$("#linkStandard").removeClass("active");$("#linkIndividualized").addClass("active");$("#IndividualizedPriceStatement").removeClass("hide");$("#StandardPriceStatement").addClass("hide")},t.prototype.ShowHideStandardTab=function(){$("#tab-Standard").addClass("active");$("#tab-Individualized").removeClass("active");$("#tab-Customized").removeClass("active");$("#linkStandard").addClass("active");$("#linkIndividualized").removeClass("active");$("#linkCustomized").removeClass("active");$("#CustomizedPriceStatement").addClass("hide");$("#IndividualizedPriceStatement").addClass("hide");$("#StandardPriceStatement").removeClass("hide")},t.prototype.CreateQueryStringForUpdateImage=function(n,i,r,u,f){var fi,ht,at,vt,oi,it,yt,ci,li,ri,ai,dt,gt,pt,ni,ui,vi,yi,k,e,et,v,y,o,d,g,st,kt,h;if(n===void 0&&(n=""),i===void 0&&(i=!1),r===void 0&&(r=!1),u===void 0&&(u=0),f===void 0&&(f=""),fi=$("#EnableRemoveLogoWhiteBackground").val()=="True",ht=!1,fi&&$("#isRemoveArtworkBackground").val().toLowerCase()=="true"&&(ht=!0),n&&n!=undefined?$("#UploadedCliparts").val()||t.prototype.SetSelectedDecorationLocationCliparts(n):$("#UploadedCliparts").val()?(n=[],i=!0,uploadPopulateLogodecorationLocationCliparts.forEach(function(t){n.push({key:t.key,value:t.value})})):n=t.prototype.GetSelectedDecorationLocationCliparts(),at=[],vt=$("#customizationText").val(),vt){vt="<BaseDecorations>"+vt+"<\/BaseDecorations>";var pi=new DOMParser,ot=pi.parseFromString(vt,"text/xml"),s=ot.getElementsByTagName("BaseDecoration"),l=ot.getElementsByTagName("BaseDecorationAlternative"),rt=ot.getElementsByTagName("BaseDecorationTextLines"),tt=ot.getElementsByTagName("BaseDecorationTextAlternatives"),ei=ot.getElementsByTagName("XMLCompatibleVersionNumber"),c=ot.getElementsByTagName("DecorationLocationOMSCode"),ct={Type:"",Color:"",Opacity:""},ti,ii=[];for(oi in n){var ct={Type:"",Color:"",Opacity:""},ii=[],si=n[oi],a=si.key,nt=si.value,hi=[];for(o=0;o<c.length;o++)if($(c[o]).text()==a){var wi=$(s[o]).find("PositionCode").length>0?$(s[o]).find("PositionCode").eq(0).text():"",lt=$(s[o]).find("OrientationRotationAngle").length>0?$(s[o]).find("OrientationRotationAngle").eq(0).text():"",ut=s[o].getElementsByTagName("BaseDecorationAlternative");if(ut.length>0)for(it=0;it<ut.length;it++)yt=ut[it].getElementsByTagName("ClipArtId")[0].innerHTML,yt==nt&&(ci={ClipArtId:yt,Height:ut[it].getElementsByTagName("Height")[0].innerHTML,Width:ut[it].getElementsByTagName("Width")[0].innerHTML,DecorationId:ut[it].getElementsByTagName("DecorationId")[0]==null?"":ut[it].getElementsByTagName("DecorationId")[0].innerHTML},ClipArtViewModelList.push(ci),li=r?{ClipArtId:yt,IsPlaceholder:ut[it].getElementsByTagName("IsPlaceholder")[0].innerHTML=="true"}:{ClipArtId:yt,IsPlaceholder:ut[it].getElementsByTagName("IsPlaceholder")[0].innerHTML=="false"},hi.push(li))}for(o=0;o<l.length;o++)ri=$(l[o]).find("ClipArtId").length>0&&$(l[o]).find("ClipArtId").eq(0)!=undefined&&$(l[o]).find("ClipArtId").eq(0).text().trim()!=""?$(l[o]).find("ClipArtId").eq(0).text().trim():"",ai=$(l).find("SingleColorHexValue").length,ai>0&&ri!=""&&$(l[o]).find("SingleColorHexValue").eq(0)!=undefined&&$(l[o]).find("SingleColorHexValue").eq(0).text().trim()!=""&&ri==nt&&(ct.Type="Tint",ct.Color=$(l[o]).find("SingleColorHexValue").length>0&&$(l[o]).find("SingleColorHexValue").eq(0)!=undefined&&$(l[o]).find("SingleColorHexValue").eq(0).text().trim()!=""?"#"+$(l[o]).find("SingleColorHexValue").eq(0).text().trim():"",ct.Opacity="1",ii.push(ct)),ti||(ti=$(l[o]).find("DecorationMethodOMSCode").length>0?$(l[o]).find("DecorationMethodOMSCode").eq(0).text():"");a&&(nt=nt==null?"":nt,dt=!1,gt=!1,(nt!=""&&$("#fuzzy_ddlLogo_"+a).attr("clipartcode")!=undefined&&($("#fuzzy_ddlLogo_"+a).attr("clipartcode")==""||$("#fuzzy_ddlLogo_"+a).attr("clipartcode")!=""&&!r)||$("#LogoHeader_"+a).hasClass("active")||$("#IsGiftNoteCard").val()=="True")&&($("#fuzzy_ddlLogo_"+a).attr("clipartcode",nt),gt=!0),nt==""&&$("#fuzzy_ddlLogo_"+a).attr("clipartcode")!=null&&$("#fuzzy_ddlLogo_"+a).attr("clipartcode")!=undefined&&(nt=$("#fuzzy_ddlLogo_"+a).attr("clipartcode")),pt=hi.filter(function(n){return n.ClipArtId==nt&&n.IsPlaceholder==!0}),!r&&$("#defaultfuzzy_ddlLogo_"+a).attr("style")=="display:none;"&&pt.length>0&&pt[0].IsPlaceholder==!0&&(gt=!0),ni=$("#UploadedCliparts").val(),ui=[],ni!=undefined&&ni.length>0&&ni.split(",").forEach(function(n){a==n.split(":")[0]&&ui.push({Key:n.split(":")[0],Value:n.split(":")[1]})}),ui.length>0?dt=!0:pt.length>0&&!gt&&(dt=pt[0].IsPlaceholder),vi=t.prototype.GetLogoWidthFromClipArtCode(nt,a).toString(),yi={type:"image",widget_key:a,customFilters:ct.Color!=""?ii:[],src:nt,width:vi,groupAlignment:wi,angle:lt,dm_code:ti,is_external_img:dt,isRemoveBackground:ht},at.push(yi),ct={Type:"",Color:"",Opacity:""})}if(ei&&ei.length>0){if(tt&&tt.length>0&&c&&c.length>0)for(e=0;e<c.length;e++)if(tt[e].childNodes&&tt[e].childNodes.length>0){var p=s[e].getElementsByTagName("HexValue")[0],w=s[e].getElementsByTagName("FontTypeface")[0],b=s[e].getElementsByTagName("FontStyle")[0],wt=$(s[e]).find("PositionCode").length>0?$(s[e]).find("PositionCode").eq(0).text():"",lt=$(s[e]).find("OrientationRotationAngle").length>0?$(s[e]).find("OrientationRotationAngle").eq(0).text():"",ft="",bt=$("#IsGiftNoteCard").length>0&&$("#IsGiftNoteCard").val()=="True"?"wrap":"";$(s[e]).find("BaseDecorationTextAlternative DecorationMethodOMSCode").length>0?ft=$(s[e]).find("BaseDecorationTextAlternative DecorationMethodOMSCode").text():(et=s[e].getElementsByTagName("DecorationMethodOMSCode")[0],ft=et&&et.firstChild?et.firstChild.nodeValue:"");var v=s[e].getElementsByTagName("FontSize")[0],y=s[e].getElementsByTagName("TextAlignmentCode")[0],bi=c[e].firstChild.textContent;if(tt[e]&&tt[e].childNodes.length>0)for(o=0;o<tt[e].childNodes[0].lastChild.childNodes.length;o++)k=tt[e].childNodes[0],d=void 0,d=f!=undefined&&f!=null&&f!=""?tt.length>1&&c.length>1?$("#"+f+" #frmPersonalised_"+u+" .location_"+bi+" .personlised-attribute .customized-txt-remove .control-md")[o]:$("#"+f+" #frmPersonalised_"+u+" .personlised-attribute .customized-txt-remove .control-md")[o]:$("#frmPersonalised_"+e+" .personlised-attribute .customized-txt-remove .control-md")[o],g=d?d.childNodes[0].value:"",d&&(persistedText[d.childNodes[0].id]=g,persistedTextDecoLocation=e,persistedMonogramForm=$("#frmPersonalised_"+u),monogramForm=$(".GetMonogramPersonalisedAttributesWithMaxChar_"+persistedTextDecoLocation+" .quantity.sp-num"),tt.length>1&&c.length>1&&(monogramForm=$(".GetMonogramPersonalisedAttributesWithMaxChar .quantity.sp-num")),st=monogramForm.val(),st!=null&&st!=undefined&&st!=""&&(kt=monogramForm.closest("input[type='text']").toArray().filter(function(n){return n.value!=""}),persistedMonogramIndex=monogramForm.closest("input[type='text']").toArray().indexOf(kt[0]),persistedMonogramQuantity=monogramForm.closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0].value)),h=null,typeof g!=undefined&&g!=null&&g!=""?h={type:"textbox",widget_key:c[e].firstChild.nodeValue,text:g,fill:p&&p.firstChild?"#"+p.firstChild.nodeValue:"",fontFamily:w&&w.firstChild?w.firstChild.nodeValue:"Arial",rowNumber:k&&k.lastChild?k.lastChild.childNodes[o].childNodes[0].firstChild.nodeValue:"",maxCharacters:k&&k.lastChild?k.lastChild.childNodes[o].childNodes[1].firstChild.nodeValue:"",fontSize:v&&v.firstChild?v.firstChild.nodeValue:"",textAlign:y&&y.firstChild?y.firstChild.nodeValue:"",vAlign:"middle",groupAlignment:wt,angle:lt,dm_code:ft,isRemoveBackground:ht}:ot.getElementsByTagName("RuleCode")[0]!=undefined&&(h={type:"textbox",widget_key:c[e].firstChild.nodeValue,text:"",fill:p&&p.firstChild?"#"+p.firstChild.nodeValue:"",fontFamily:w&&w.firstChild?w.firstChild.nodeValue:"Arial",rowNumber:k&&k.lastChild?k.lastChild.childNodes[o].childNodes[0].firstChild.nodeValue:"",maxCharacters:k&&k.lastChild?k.lastChild.childNodes[o].childNodes[1].firstChild.nodeValue:"",fontSize:v&&v.firstChild?v.firstChild.nodeValue:"",textAlign:y&&y.firstChild?y.firstChild.nodeValue:"",vAlign:"middle",groupAlignment:wt,angle:lt,dm_code:ft,isRemoveBackground:ht}),h&&h!=undefined&&h!=null&&(b&&b.firstChild&&(b.firstChild.nodeValue.toLowerCase()=="bold"||b.firstChild.nodeValue.toLowerCase()=="bolditalic"?h.fontWeight=b.firstChild.nodeValue:h.fontStyle=b.firstChild.nodeValue),bt!=""&&(h.styling=bt),at.push(h))}}else if(rt&&rt.length>0&&c&&c.length>0)for(e=0;e<c.length;e++)if(rt[e].childNodes&&rt[e].childNodes.length>0){var p=s[e].getElementsByTagName("HexValue")[0],w=s[e].getElementsByTagName("FontTypeface")[0],b=s[e].getElementsByTagName("FontStyle")[0],wt=$(s[e]).find("PositionCode").length>0?$(s[e]).find("PositionCode").eq(0).text():"",lt=$(s[e]).find("OrientationRotationAngle").length>0?$(s[e]).find("OrientationRotationAngle").eq(0).text():"",ft="",bt=$("#IsGiftNoteCard").length>0&&$("#IsGiftNoteCard").val()=="True"?"wrap":"";for($(s[e]).find("BaseDecorationTextAlternative DecorationMethodOMSCode").length>0?ft=$(s[e]).find("BaseDecorationTextAlternative DecorationMethodOMSCode").text():(et=s[e].getElementsByTagName("DecorationMethodOMSCode")[0],ft=et&&et.firstChild?et.firstChild.nodeValue:""),v=s[e].getElementsByTagName("FontSize")[0],y=s[e].getElementsByTagName("TextAlignmentCode")[0],o=0;o<rt[e].childNodes.length;o++)d=void 0,d=f!=undefined&&f!=null&&f!=""?$("#"+f+" #frmPersonalised_"+u+" .personlised-attribute .customized-txt-remove .control-md")[o]:$("#frmPersonalised_"+u+" .personlised-attribute .customized-txt-remove .control-md")[o],g=d?d.childNodes[0].value:"",d&&(persistedText[d.childNodes[0].id]=g,persistedTextDecoLocation=e,persistedMonogramForm=$("#frmPersonalised_"+u),monogramForm=$(".GetMonogramPersonalisedAttributesWithMaxChar_"+persistedTextDecoLocation+" .quantity.sp-num"),tt.length>1&&c.length>1&&(monogramForm=$(".GetMonogramPersonalisedAttributesWithMaxChar .quantity.sp-num")),st=monogramForm.val(),st!=null&&st!=undefined&&(kt=monogramForm.closest("input[type='text']").toArray().filter(function(n){return n.value!=""}),persistedMonogramIndex=monogramForm.closest("input[type='text']").toArray().indexOf(kt[0]),persistedMonogramQuantity=monogramForm.closest("input[type='text']").toArray().filter(function(n){return n.value!=""})[0].value)),h=null,typeof g!=undefined&&g!=null&&g!=""?h={type:"textbox",widget_key:c[e].firstChild.nodeValue,text:g,fill:p&&p.firstChild?"#"+p.firstChild.nodeValue:"",fontFamily:w&&w.firstChild?w.firstChild.nodeValue:"Arial",rowNumber:rt[e].childNodes[o].childNodes[0].firstChild.nodeValue,maxCharacters:rt[e].childNodes[o].childNodes[1].firstChild.nodeValue,fontSize:v&&v.firstChild?v.firstChild.nodeValue:"",textAlign:y&&y.firstChild?y.firstChild.nodeValue:"",vAlign:"middle",groupAlignment:wt,angle:lt,dm_code:ft,isRemoveBackground:ht}:ot.getElementsByTagName("RuleCode")[0]!=undefined&&(h={type:"textbox",widget_key:c[e].firstChild.nodeValue,text:"",fill:p&&p.firstChild?"#"+p.firstChild.nodeValue:"",fontFamily:w&&w.firstChild?w.firstChild.nodeValue:"Arial",rowNumber:rt[e].childNodes[o].childNodes[0].firstChild.nodeValue,maxCharacters:rt[e].childNodes[o].childNodes[1].firstChild.nodeValue,fontSize:v&&v.firstChild?v.firstChild.nodeValue:"",textAlign:y&&y.firstChild?y.firstChild.nodeValue:"",vAlign:"middle",groupAlignment:wt,angle:lt,dm_code:ft,isRemoveBackground:ht}),h&&h!=undefined&&h!=null&&(b&&b.firstChild&&(b.firstChild.nodeValue.toLowerCase()=="bold"||b.firstChild.nodeValue.toLowerCase()=="bolditalic"?h.fontWeight=b.firstChild.nodeValue:h.fontStyle=b.firstChild.nodeValue),bt!=""&&(h.styling=bt),at.push(h))}return at}},t.prototype.CreateLocationNameKeyValue=function(){var w=[],f=$("#customizationText").val(),h,i,u,y,k,d,p,r;if(f&&f!=undefined&&f!=null){f="<BaseDecorations>"+f+"<\/BaseDecorations>";var g=new DOMParser,nt=g.parseFromString(f,"text/xml"),b=nt.childNodes[0].childNodes;for(h=0;h<b.length;h++){var n=b[h].childNodes,e=null,c=null,l=null,a=null,o=null,s=null,v=null;for(i=0;i<n.length;i++)if(u={},n[i].nodeName=="DecorationLocationName"&&(a=n[i].textContent),n[i].nodeName=="DecorationLocationOMSCode"&&(l=n[i].textContent),a!=undefined&&a!=null&&(u.DecorationLocationName=a),l!=undefined&&l!=null&&(u.DecorationLocationOMSCode=l),n[0].nodeName=="DecorationId"&&(v=n[0].textContent),v!=undefined&&v!=null)u.BaseDecorationId=n[0].textContent;else{if(n[i].nodeName=="BaseDecorationAlternatives"){e=n[i].firstChild?n[i].firstChild.firstChild.textContent:"";y=t.prototype.GetSelectedDecorationLocationCliparts();for(k in y)for(d=y[k],p=d.value,r=0;r<ClipArtViewModelList.length;r++)ClipArtViewModelList[r].DecorationId!=""&&ClipArtViewModelList[r].ClipArtId!=""?ClipArtViewModelList[r].DecorationId==e&&ClipArtViewModelList[r].ClipArtId==p&&(o=ClipArtViewModelList[r].Width,s=ClipArtViewModelList[r].Height):(ClipArtViewModelList[r].DecorationId==e||ClipArtViewModelList[r].ClipArtId==p)&&(o=ClipArtViewModelList[r].Width,s=ClipArtViewModelList[r].Height);u.Width=o;u.Height=s}n[i].nodeName=="BaseDecorationTextAlternatives"&&(c=n[i].firstChild?n[i].firstChild.firstChild.textContent:"");e!=undefined&&e!=null&&(u.ClipartDecorationId=e);c!=undefined&&c!=null&&(u.TextDecorationId=c);o!=undefined&&o!=null&&(u.Width=o);s!=undefined&&s!=null&&(u.Height=s)}w.push(u)}return JSON.stringify(w)}return""},t.prototype.BindAddOnProductSKUFromPLP=function(n,i){var y;i.preventDefault();ZnodeBase.prototype.ShowLoader();var s=[],h=[],r="",u="",f="",o=[],e=[],c=[],l=[],a="",v=!0,p=$(n).closest("form").children("#dynamic-producttype").val();return $(n).closest("form").find("input[type=text].quantity,input[type=number].quantity").each(function(){var n=$(this).val();($(this).attr("name")!="Quantity"||p=="ConfigurableProduct")&&n!=null&&n!=""&&(r=r+$(this).attr("data-sku")+",",u+$(this).val()+"_",u=u+$(this).val()+"_",f=f+$(this).attr("data-omssavedcartlineitemid")+",")}),u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),f=f.substr(0,r.length-1),y=localStorage.getItem("UserId"),CustomEndpoint.prototype.GetPersonalizeDesignId($(n).closest("form").children("#productSKU").val(),$(n).closest("form").children("#selectedColorCode").val(),function(i){var p={queryString:t.prototype.CreateQueryStringForUpdateImage()};Artifi.Application.addToCart($(n).closest("form").children("#ArtifiSku").val(),y,"",function(i){return i&&($('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;o.push(n.attr("data-attributeCode"));t={name:n.text().split("(up to")[0],value:$(this).val()};c.push(JSON.stringify(t))}),o.push("ArtifiCustomizedData"),l.push(i),e=$.merge(e,c),e.push(l)),t.prototype.SetCartItemModelValues(s,h,r,u,f,a,o.join(","),e.join("`"),"",0,n),CommonHelper.prototype.SubmitForm($("#Form_"+parseInt($(n).closest("form").children("#dynamic-productid").val())+""),function(){},!0),v},function(){$('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;o.push(n.attr("data-attributeCode"));t={name:n.text().split("(")[0],value:$(this).val()};e.push(JSON.stringify(t))});t.prototype.SetCartItemModelValues(s,h,r,u,f,a,o.join(","),e.join("`"),"",0,n);CommonHelper.prototype.SubmitForm($("#Form_"+parseInt($("#dynamic-productid").val())+""),function(){},!0)},i!=undefined&&i!=null?i.personalizeDesignId:null,p,t.prototype.CreateLocationNameKeyValue())}),v},t.prototype.BindProductDetailAndAddToCart=function(n,i,r){if(ZnodeBase.prototype.ShowLoader(),i.preventDefault(),$("#Searchtext").prop("disabled",!0),r=="")window.location.href="/search?searchterm="+r;else{var u="",f="",e="";CustomEndpoint.prototype.GetProductDetailBySKU(r,function(i){var y;if(i.status){if(i.ProductCount>1)window.location.href="/search?searchterm="+r;else if(i.ProductCount==1)if(i.showAddToCart){u=i.ArtifiSku;$("#SKU").val(i.SKU);$("#ArtifiSku").val(i.ArtifiSku);$("#dynamic-parentproductid").val(i.ParentProductId);$("#dynamic-productid").val(i.ProductId);$("#dynamic-configurableproductskus").val(i.ConfigurableProductSKUs);$("#dynamic-producttype").val(i.ProductType);$("#groupproductskus").val(i.Groupproductskus);$("#selectedColorCode").val(i.omsColorCode);$("#productSKU").val(i.ProductSku);$(n).closest("form").attr("id","Form_"+i.ProductId);f=i.groupproductskus;e=i.ProductType;var l=[],h=[],v=[],a=[],p=!0,s="",o="",c="";$("input[id=dynamic-quantity].quantity").each(function(){var n=$(this).val();($(this).attr("name")!="Quantity"||e=="ConfigurableProduct")&&n!=null&&n!=""&&(s=s+f+",",o+n+"_",o=o+n+"_",c=c+$(this).attr("data-omssavedcartlineitemid")+",")});o=o.substr(0,o.length-1);s=s.substr(0,s.length-1);c=c.substr(0,s.length-1);y=localStorage.getItem("UserId");CustomEndpoint.prototype.GetPersonalizeDesignId($("#productSKU").val(),$("#selectedColorCode").val(),function(n){var i={queryString:t.prototype.CreateQueryStringForUpdateImage()};Artifi.Application.addToCart(u,y,"",function(n){return n&&($('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;l.push(n.attr("data-attributeCode"));t={name:n.text().split("(up to")[0],value:$(this).val()};v.push(JSON.stringify(t))}),a.push("ArtifiCustomizedData"),a.push(n),h=$.merge(h,v),h.push(a)),$("#dynamic-personalisedcodes").val(l),$("#dynamic-personalisedvalues").val(h),$("#dynamic-groupproductsquantity").val(o),$("#dynamic-groupproductslineitemid").val(c),CommonHelper.prototype.SubmitForm($("#Form_"+$("#dynamic-productid").val()+""),function(){}),p},function(){$('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;l.push(n.attr("data-attributeCode"));t={name:n.text().split("(")[0],value:$(this).val()};h.push(JSON.stringify(t))});$("#dynamic-personalisedcodes").val(l);$("#dynamic-personalisedvalues").val(h);$("#dynamic-groupproductskus").val(s);$("#dynamic-groupproductsquantity").val(o);$("#dynamic-groupproductslineitemid").val(c);CommonHelper.prototype.SubmitForm($("#Form_"+$("#dynamic-productid").val()+""),function(){},!0)},n!=undefined&&n!=null?n.personalizeDesignId:null,i,t.prototype.CreateLocationNameKeyValue())})}else window.location.href="/search?searchterm="+r}else $("#Searchtext").prop("disabled",!1),$("#Searchtext").focus(),$("#Searchtext").val(""),ZnodeNotification.prototype.DisplayNotificationMessagesHelper(i.message,"error",isFadeOut,fadeOutTime),ZnodeBase.prototype.HideLoader()})}},t.prototype.DisplayAddToCartResultAndRedirectToCart=function(n){n&&n!=""?(window.location.href="/cart",ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AddToCartMessage"),"success",isFadeOut,fadeOutTime)):ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("AddToCartErrorMessage"),"error",isFadeOut,fadeOutTime);ZnodeBase.prototype.HideLoader()},t.prototype.LoadBarcodeScanner=function(n){n===void 0&&(n=!1);var r="",u="div-video-container",f=0,i="",e,o=!1;$("#quick-view-content").html("<span style='position:absolute;top:0;bottom:0;left:0;right:0;text-align:center;transform:translate(0px, 45%);font-weight:600;'>Loading...<\/span>");$(".quick-view-popup").first().modal("show");$(".quick-view-popup .modal-content").css("min-height","auto");$(".quick-view-popup .modal-content").css("max-width","85vw");$(".quick-view-popup .modal-content").css("margin","0 auto");Endpoint.prototype.GetBarcodeScanner(function(s){s!=null&&s!=""?($("#quick-view-content").html(s),r=$("#quick-view-content").find("#LicenseKey").val(),e=$("#quick-view-content").find("#BarcodeFormates").val().split(","),BarcodeReader.prototype.InitiateBarcodeScanner(r,e,u,function(n){ScannerObject=n;BarcodeReader.prototype.StartScannerOnElement(u,function(){},function(n){$("#quick-view-content").html("");$("#quick-view-content").html("<span style='position:absolute;top:0;bottom:0;left:0;right:0;text-align:center;transform:translate(0px, 45%);font-weight:600;'>"+n+"<\/span>")})},function(r){$("#lblScannerCode").html("Result: "+r);BarcodeReader.prototype.PauseScanner();o=$("#quick-view-content").find("#EnableSpecificSearch").val().toLocaleLowerCase();Endpoint.prototype.GetProductDetail(r,o,function(u){var e;if(u!=null&&u!="")try{if(e=JSON.parse(u),e.Type=="success")if(n){var o="",s="",h="";CustomEndpoint.prototype.GetProductDetailBySKU(r,function(n){var v;if(n.status){if(n.ProductCount>1)window.location.href="/search?searchterm="+r;else if(n.ProductCount==1)if(n.showAddToCart){o=n.ArtifiSku;$("form").children("#SKU").val(n.SKU);$("form").children("#ArtifiSku").val(n.ArtifiSku);$("form").children("#dynamic-parentproductid").val(n.ParentProductId);$("form").children("#dynamic-productid").val(n.ProductId);$("form").children("#dynamic-configurableproductskus").val(n.ConfigurableProductSKUs);$("form").children("#dynamic-producttype").val(n.ProductType);$("form").children("#groupproductskus").val(n.Groupproductskus);$("form").children("#selectedColorCode").val(n.omsColorCode);$("form").children("#productSKU").val(n.ProductSku);$("#FormAddToCart").attr("id","Form_"+n.ProductId);s=n.groupproductskus;h=n.ProductType;var c=[],f=[],a=[],l=[],y=!0,u="",i="",e="";$("form").children("input[id=dynamic-quantity].quantity").each(function(){var n=$(this).val(),t=$(this).attr("data-omssavedcartlineitemid");($(this).attr("name")!="Quantity"||h=="ConfigurableProduct")&&n!=null&&n!=""&&(u=u+s+",",i+n+"_",i=i+n+"_",e=e+$(this).attr("data-omssavedcartlineitemid")+",")});i=i.substr(0,i.length-1);u=u.substr(0,u.length-1);e=e.substr(0,u.length-1);v=localStorage.getItem("UserId");CustomEndpoint.prototype.GetPersonalizeDesignId($("form").children("#productSKU").val(),$("form").children("#selectedColorCode").val(),function(n){var r={queryString:t.prototype.CreateQueryStringForUpdateImage()};Artifi.Application.addToCart(o,v,"",function(n){return n&&($('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;c.push(n.attr("data-attributeCode"));t={name:n.text().split("(up to")[0],value:$(this).val()};a.push(JSON.stringify(t))}),l.push("ArtifiCustomizedData"),l.push(n),f=$.merge(f,a),f.push(l)),$("form").children("#dynamic-personalisedcodes").val(c),$("form").children("#dynamic-personalisedvalues").val(f),$("form").children("#dynamic-groupproductsquantity").val(i),$("form").children("#dynamic-groupproductslineitemid").val(e),CommonHelper.prototype.SubmitForm($("#Form_"+$("#dynamic-productid").val()+""),function(){},!0),y},function(){$('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;c.push(n.attr("data-attributeCode"));t={name:n.text().split("(")[0],value:$(this).val()};f.push(JSON.stringify(t))});$("form").children("#dynamic-personalisedcodes").val(c);$("form").children("#dynamic-personalisedvalues").val(f);$("form").children("#dynamic-groupproductskus").val(u);$("form").children("#dynamic-groupproductsquantity").val(i);$("form").children("#dynamic-groupproductslineitemid").val(e);CommonHelper.prototype.SubmitForm($("#Form_"+$("#dynamic-productid").val()+""),function(){},!0)},n!=undefined&&n!=null?n.personalizeDesignId:null,r,t.prototype.CreateLocationNameKeyValue())})}else window.location.href="/search?searchterm="+r}else ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,"error",isFadeOut,fadeOutTime)})}else f=e.Data.PublishProductId,i=e.Data.SEOUrl,$(".quick-view-popup").first().modal("hide"),BarcodeReader.prototype.StopScanner(),window.location.href=i!=null&&i.length>0?i:"/product/"+f;else $("#lblScannerCode").html("Result: "+e.Message)}catch(c){$("#lblScannerCode").html("Result: "+ZnodeBase.prototype.getResourceByKeyName("BarcodeInvalidMessage"))}else $("#lblScannerCode").html("Result: "+ZnodeBase.prototype.getResourceByKeyName("BarcodeInvalidMessage"))})})):$("#quick-view-content").html(ZnodeBase.prototype.getResourceByKeyName("BarcodeLoadErrorMessage"))});$(".quick-view-popup").on("hidden.bs.modal",function(){$(".quick-view-popup .modal-content").removeAttr("style");BarcodeReader.prototype.StopScanner()})},t.prototype.RescanUsingQRCodeScanner=function(){$(".quick-view-popup").first().modal("show");t.prototype.LoadBarcodeScanner(!0)},t.prototype.AddAnotherECert=function(){CustomEndpoint.prototype.AddAnotherEcert(function(n){$("#ExtraEcerts").append(n);_eCertFields.prototype.PageScripts()})},t.prototype.AssortmentRedirect=function(n){var t=$(n).attr("data-sku");CustomEndpoint.prototype.AssortmentRedirect(t,function(n){document.location.href=n.Url})},t.prototype.stringFormat=function(n,t){var i=n,r;for(r in t)i=i.replace("{"+r+"}",t[r]);return i},t.prototype.GetErrorMsgFromResources=function(n){switch(n){case 200:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode200");case 206:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode206");case 201:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode201");case 413:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode413");case 415:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode415");case 404:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode404");case 444:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode444");case 500:return ZnodeBase.prototype.getResourceByKeyName("ArtifiErrorCode500");default:return"error occured at artifi end"}},t.prototype.GetASPNETSessionId=function(){var n=this.getCookie("ASP.NET_SessionId");$("#ASPNETSessionId").val(n)},t.prototype.OpenLogoLockerModal=function(n){var t=$("#UserName").val(),i=$("#StoreCode").val(),r="";r=t==""||i==""||t==undefined&&i==undefined?this.getCookie("ASP.NET_SessionId"):t+"|"+i;CustomEndpoint.prototype.LoadUplodedLogoList(r,function(t){t!==undefined&&t!==""&&($("#art-library-modal-"+n+" .artwork-list").html(t),$("#art-library-modal-"+n+" .artwork-image").data("decokey",n),$("#art-library-modal-"+n).modal("show"))})},t.prototype.PopulateLogoLockerList=function(){var n=$("#UserName").val(),t=$("#StoreCode").val(),i="";i=n==""||t==""||n==undefined&&t==undefined?this.getCookie("ASP.NET_SessionId"):n+"|"+t;CustomEndpoint.prototype.LoadUplodedLogoList(i,function(n){n!==undefined&&n!==""&&($(".art-library .artwork-list").html(n),$(".art-library .artwork-image").each(function(){$(this).data("decokey",$(this).closest(".artwork-list").attr("data-deco-key"))}))})},t.prototype.CheckLogoCount=function(){var n=$("#UserName").val(),t=$("#StoreCode").val(),u=$("#IsEnableLogoUpload").val().toLowerCase(),f=$("#IsEnableLogoLockerOnWebStore").val().toLowerCase(),i="",r=0;return u=="true"&&f=="true"&&(i=n==""||t==""||n==undefined&&t==undefined?this.getCookie("ASP.NET_SessionId"):n+"|"+t,CustomEndpoint.prototype.LoadUplodedLogoList(i,function(n){n!==undefined&&n!==""&&(r=$(n).find("[data-logovalue]").length)})),r},t.prototype.UploadUserImage=function(n,i){var r=n[0],s=new FormData,h=20,c,u,l,a,v;n[0].name.length>h&&(c=n[0].name.length-h,u=n[0].name.substring(0,c),u=u+"."+n[0].name.split(".").reverse()[0],l=new File([n[0]],u,{type:n[0].type,lastModified:n[0].lastModified}),r=l);console.log(r);s.append("file",r);var y=$("#UploadUserImgDomain").val(),e=$("#UserName").val(),o=$("#StoreCode").val(),f="";f=e==""||o==""||e==undefined&&o==undefined?this.getCookie("ASP.NET_SessionId"):e+"|"+o;f=encodeURIComponent(f);a=$("#WebsiteCode").val();v=$("#WebApiClientKey").val();$.ajax({type:"POST",url:y+"/api/2.0/UploadPhoto/UploadUserPhotos?frontAppUserId="+f+"&websiteId="+a+"&webApiClientKey="+v,contentType:!1,dataType:"json",processData:!1,async:!1,data:CustomCheckout.prototype.cachestampfunctionCustom(s),success:function(n){t.prototype.UploadUserSuccess(n,i,r);t.prototype.PopulateLogoLockerList()},error:function(n){console.log(n)}})},t.prototype.UpdateImageLogoFromList=function(n){var s=$(n).data("logovalue"),u=s.split("."),h=u[0],c=u[1],i=$(n).closest(".artwork-list").attr("data-deco-key"),f=$(n).data("imagename"),e={Data:{}},r={ImageName:"",UniqueImageName:"",Extension:""},o={name:""};$("#uploader-input-"+i).removeClass("active");$("#beforUploadDiv-"+i).hide();$("#UploadedImageName-"+i).removeClass("active");$("#upload-container-"+i).addClass("active");$("#uploadLoader-"+i).addClass("active");$("#product-lens-image .deco-loading").addClass("active");r.ImageName=f;r.UniqueImageName=h;r.Extension="."+c;o.name=f;e.Data=r;t.prototype.UploadUserSuccess(e,i,o);$("#art-library-modal-"+i).modal("hide");$("#product-image").load(function(){$("#upload-container-"+i+" .deco-loading").removeClass("active");$("#product-lens-image .deco-loading").removeClass("active");$("#uploadLoader-"+i).removeClass("active");$("#beforUploadDiv-"+i).hide();$("#UploadedImageName-"+i).addClass("active")})},t.prototype.UploadUserSuccess=function(n,i,r){var u=i,a=r.name,v,e,h,c,o,w,b,l,s;if($("#required_"+u).removeAttr("disabled"),$("#mustDecorationError").attr("hidden",""),$("#erro_message_"+u).hide(),v=$("#divDecoration-"+i).attr("data-views"),$("#UploadedCliparts").val()=="")$("#UploadedCliparts").val(u+":"+n.Data.UniqueImageName+n.Data.Extension);else{var y=$("#UploadedCliparts").val(),f=y.split(","),p=!1;for(e=0;e<f.length;e++)if(f[e].indexOf(u)!==-1){p=!0;h=f[e].split(":");h[1]=n.Data.UniqueImageName+n.Data.Extension;f[e]=h[0]+":"+h[1];break}for(c="",o=0;o<f.length;o++)w=f.length-1,c+=o!==w?f[o]+",":f[o];c!==""&&$("#UploadedCliparts").val(c);p||$("#UploadedCliparts").val(y+","+u+":"+n.Data.UniqueImageName+n.Data.Extension)}t.prototype.PopulateUploadedLogos($("#UploadedCliparts").val(),v,"true");b=$("#CartItemUploadedImagesJson").val();b?(l=!1,cartItemUploadedImagesJson.UploadedImages.length>0&&(jQuery.each(cartItemUploadedImagesJson.UploadedImages,function(t,i){i.DecorationKey==u&&(l=!0,cartItemUploadedImagesJson.UploadedImages[t].UploadedFileName=n.Data.ImageName,cartItemUploadedImagesJson.UploadedImages[t].ActualFileName=r.name,cartItemUploadedImagesJson.UploadedImages[t].UploadedClipArt=n.Data.UniqueImageName+n.Data.Extension)}),cartItemUploadedImagesJson.UploadedImages=cartItemUploadedImagesJson.UploadedImages.filter(function(n){return n!==null})),l||(s={DecorationKey:u,UploadedFileName:n.Data.ImageName,IsUploaded:"true",UploadedClipArt:n.Data.UniqueImageName+n.Data.Extension,ActualFileName:r.name},cartItemUploadedImagesJson.UploadedImages.push(s),console.log("cartItemUploaded",cartItemUploadedImagesJson)),$("#CartItemUploadedImagesJson").val(JSON.stringify(cartItemUploadedImagesJson))):(s={DecorationKey:u,UploadedFileName:n.Data.ImageName,IsUploaded:"true",UploadedClipArt:n.Data.UniqueImageName+n.Data.Extension,ActualFileName:r.name},cartItemUploadedImagesJson.UploadedImages.push(s),console.log("cartItemUploaded",cartItemUploadedImagesJson),$("#CartItemUploadedImagesJson").val(JSON.stringify(cartItemUploadedImagesJson)));$("#product-image").load(function(){$("#uploaded-logo-name-"+u).html("").removeClass().show();$("#uploaded-logo-name-"+u).html("<span>"+a+"<\/span>");$("#UploadedImageName-"+u).find(".upload-file-name").text(a);$("#UploadedImageName-"+u).addClass("active");$("#beforUploadDiv-"+u).hide()});$("#Validation-msg-"+i).html("").removeClass().show()},t.prototype.UploadLogoPersonalised=function(n,i){var r;if($(".deco-loading").addClass("active"),$("#product-lens-image .deco-loading").addClass("active"),$("#UploadedImageName-"+i).removeClass("active"),r=n.files,r.length>0){$("#uploadLoader-"+i).addClass("active");var u=!0,f="internal server error occured.",e=r[0].name.split(".").pop().toLowerCase();e!=""&&(["png","jpg","jpeg","ai","eps","tiff","gif"].indexOf(e)==-1?(u=!1,f=t.prototype.GetErrorMsgFromResources(415),n.value=""):r[0].size>5242880?(u=!1,f=t.prototype.GetErrorMsgFromResources(413),n.value=""):$("#UploadUserImgDomain").val()||(u=!1,f=t.prototype.GetErrorMsgFromResources(500),n.value=""),u?(t.prototype.UploadUserImage(r,i),enableSavedLogoAccess(),$("#product-image").load(function(){$(".deco-loading").removeClass("active");$("#uploadLoader-"+i).removeClass("active");$("#beforUploadDiv-"+i).hide();$("#UploadedImageName-"+i).addClass("active");n.value=""})):($("#uploadLoader-"+i).removeClass("active"),$("#Validation-msg-"+i).find(".msg-upload-content").html(t.prototype.stringFormat(ZnodeBase.prototype.getResourceByKeyName("LogoUploadErrorMessage"),{artifiError:f.toLowerCase(),supportContact:$("#hdnCustomerCareNumber").val()})),$("#Validation-msg-"+i).removeClass("success").addClass("error").show(),setTimeout(function(){$("#Validation-msg-"+i).hide().find(".msg-upload-content").html("")},5e3),$(".deco-loading").removeClass("active")))}},t.prototype.UploadLogoValidationFailed=function(n,i){$("#uploadLoader-"+n).removeClass("active");$("#Validation-msg-"+n).html("").removeClass().show();$("#Validation-msg-"+n).html(t.prototype.stringFormat(ZnodeBase.prototype.getResourceByKeyName("LogoUploadErrorMessage"),{artifiError:i.toLowerCase(),supportContact:$("#hdnCustomerCareNumber").val()})+"<span onclick=$(this).parent('div').hide() class='close pull-right right zf-close'><\/span>").addClass("alert-danger col-xs-12 text-center");setTimeout(function(){$("#Validation-msg-"+n).html("").removeClass().hide()},5e3);$("#upload-container-"+n+" .deco-loading").removeClass("active");$("#product-lens-image .deco-loading").removeClass("active");$("#upload-container-"+n+" .upload-file-name").text().trim()==""?$("#upload-container-"+n+" #uploader-input-"+n).addClass("active"):$("#UploadedImageName-"+n).addClass("active")},t.prototype.InitializeLogoUploaderBlocksWithFilesDetails=function(){var n=$("#CartItemUploadedImagesJson").val(),t;n!=null&&n!=undefined&&n.trim()!=""&&(t=JSON.parse(n),t.UploadedImages!=undefined&&t.UploadedImages.length>0&&t.UploadedImages.forEach(function(n){n.IsUploaded=="true"&&n.UploadedFileName!=""&&$("#UploadedImageName-"+n.DecorationKey+"span.upload-file-name").text()==""&&($("#beforUploadDiv-"+n.DecorationKey).hide(),$("#uploader-input-"+n.DecorationKey).removeClass("active"),$("#uploadLoader-"+n.DecorationKey).removeClass("active"),$("#UploadedImageName-"+n.DecorationKey).addClass("active"),$("#UploadedImageName-"+n.DecorationKey+" span.upload-file-name").text(n.ActualFileName),$("#erro_message_"+n.DecorationKey).hide())}))},t.prototype.SaveForLaterProduct=function(n){var d,o,u,f,y,p;$("#isRemoveArtworkBackground").val().toLowerCase()=="true"&&$("#removeArtworkBackground").prop("checked",!0);var w=$('input[name="requestVerification"]').val(),b=w.split(" ")[3].split("=")[1],k=b.replace(/"/g,"");if($('input[name="__RequestVerificationToken"]').val(k),d=$(n).closest("form").children("#dynamic-producttype").val(),o=$("#counterForAddToCart").val(),$("#OptionalTexts-"+o).val()!==undefined){if($("#OptionalTexts-"+o).is(":hidden")===!0&&(u=$("#counterForAddToCart").val(),f=!0,$('div[data-test-selector^="divPersonalisedAttribute_'+u+'"]').each(function(){$(this).is(":hidden")||$(this).children(".personalized-attributes-body").children("form").valid()||(f=!1);u++}),$(".input-validation-error").length>0&&$("html, body").animate({scrollTop:$(".input-validation-error").offset().top-200},200),!f))return!1}else if(u=$("#counterForAddToCart").val(),f=!0,$('div[data-test-selector^="divPersonalisedAttribute_'+u+'"]').each(function(){$(this).is(":hidden")||$(this).children(".personalized-attributes-body").children("form").valid()||(f=!1);u++}),$(".input-validation-error").length>0&&$("html, body").animate({scrollTop:$(".input-validation-error").offset().top-200},200),!f)return!1;var g=[],nt=[],e="",s="",h="",r=[],i=[],c=[],l=[],a=[],v=!0;return(g=Product.prototype.GetSelectedAddons(),nt=Product.prototype.GetSelectedBundelProducts(),s=s.substr(0,s.length-1),e=e.substr(0,e.length-1),h=h.substr(0,e.length-1),y=$("#ddlLogo option:selected").val(),y=="0")?(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RequiredLogoSelection"),"error",!0,1e4),!1):(ZnodeBase.prototype.ShowLoader(),p=$("#UserId").val()>0?$("#UserId").val():localStorage.getItem("UserId"),CustomEndpoint.prototype.GetPersonalizeDesignId($("#productSKU").val(),$("#selectedColorCode").val(),function(u){var f={queryString:t.prototype.CreateQueryStringForUpdateImage()};Artifi.Application.saveDesign(ArtifiModel.prototype.sku,p,"",function(t){var o,f,e,u,s;if(t)if($('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;r.push(n.attr("data-attributeCode"));t={name:n.text().split("(up to")[0],value:$(this).val()};c.push(JSON.stringify(t))}),r.push("ArtifiCustomizedData"),l.push(t),r.push("SelectedDecorationElements"),a.push(JSON.stringify(SelectedElements)),i=$.merge(i,c),i.push(l),i.push(a),cartItemUploadedImagesJson.UploadedImages.length>0)if($("#CartItemUploadedImagesJson").val()!==""){if(o=$("#CartItemUploadedImagesJson").val(),o!=="")for(f=JSON.parse(o),e=0;e<cartItemUploadedImagesJson.UploadedImages.length;e++)for(u=0;u<f.UploadedImages.length;u++)cartItemUploadedImagesJson.UploadedImages[e].DecorationKey==f.UploadedImages[u].DecorationKey?(cartItemUploadedImagesJson.UploadedImages[e].UploadedFileName=f.UploadedImages[u].UploadedFileName,cartItemUploadedImagesJson.UploadedImages[e].ActualFileName=f.UploadedImages[u].ActualFileName):cartItemUploadedImagesJson.UploadedImages.map(function(n){return n.DecorationKey}).indexOf(f.UploadedImages[u].DecorationKey)==-1&&cartItemUploadedImagesJson.UploadedImages.push(f.UploadedImages[u]);r.push("CartItemUploadedImagesJson");i.push(JSON.stringify(cartItemUploadedImagesJson))}else r.push("CartItemUploadedImagesJson"),i.push(JSON.stringify(cartItemUploadedImagesJson));else $("#CartItemUploadedImagesJson").val()!==""&&$("#CartItemUploadedImagesJson").val()!==undefined&&(r.push("CartItemUploadedImagesJson"),i.push($("#CartItemUploadedImagesJson").val()));return s={ProductId:$("#dynamic-productid").val(),SKU:$("#dynamic-sku").val(),ProductType:$("#dynamic-producttype").val(),ParentProductId:$("#dynamic-parentproductid").val(),ConfigurableProductSKUs:$("#dynamic-configurableproductskus").val(),AddOnProductSKUs:$("#dynamic-addonproductskus").val(),PersonalisedCodes:r.join(","),PersonalisedValues:i.join("`"),GroupProductSKUs:$("#dynamic-groupproductskus").val(),ColorCodeValue:$("#Selected-Color").attr("val"),isRemoveArtworkBackground:$("#isRemoveArtworkBackground").val()},CustomEndpoint.prototype.AddSaveForLaterProduct(s,function(t){ZnodeBase.prototype.HideLoader();t.status?($("#accountWishList").attr("href",t.link),$("#accountWishList").attr("class",t.style),$("#accountWishList").html(t.message),$("#accountWishList_"+n.dataset.id).attr("href",t.link),$("#accountWishList_"+n.dataset.id).attr("class",t.style),$("#accountWishList_"+n.dataset.id).text(t.message)):t.isRedirectToLogin&&(document.location.href=t.link)}),v},function(){$('div[data-test-selector="divPersonalisedAttribute"]').is(":hidden")||$("[IsPersonalizable = True]").each(function(){var n=$("label[for='"+this.id+"']"),t;r.push(n.attr("data-attributeCode"));t={name:n.text().split("(")[0],value:$(this).val()};i.push(JSON.stringify(t))})},u!=undefined&&u!=null?u.personalizeDesignId:null,f,t.prototype.CreateLocationNameKeyValue())}),v)},t.prototype.GetMonogramAttributes=function(n){var f=parseInt($("#dynamic-productid").val()),e=$("#isCustomizationRequired").val(),u=parseFloat($(n).val());persistedMonogramQuantity=u;var i=$(n).attr("data-counter"),o=$(n).attr("data-sku"),s=$("#personlisecodevalue_"+$("#locationcounter").val()).val(),r=$(n).closest("div[data-decokey]").attr("data-counter"),h=$("#RequiredOptionalLoc").val();u>0?CustomEndpoint.prototype.GetIndividualisedAttributesWithMaxChar(f,s,e,h,0,function(n){for(var s,h,c,e,f=0;f<=u;f++)for(f<u&&$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i).html().search("frmPersonalised_"+f)==-1&&(s=n.replaceAll("_0","_"+f),h=s.replaceAll('data-counter="0"','data-counter="'+f+'"'),$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i).append(h),$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i+" #ancClearIndividualisedProductImage_"+f).attr("data-sku",o)),c=$("form[data-test-selector='frmPersonalisedDetails']").length,e=u;e<c;e++)$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i).html().search("frmPersonalised_"+e)>-1&&$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i+" ._PersonalisedAttribute_"+e).remove();t.prototype.ValidateMonogramAttributes();$("#individualized-text").removeClass("hide")}):$(".GetMonogramPersonalisedAttributesWithMaxChar_"+r+" #monogramAttributes_"+i).html("");$(n).removeClass("error")},t.prototype.GetMonogramAttributeOnKeyPress=function(n,i){n.keyCode===13&&t.prototype.GetMonogramAttributes(i)},t.prototype.GetMultipleMonogramAttributeOnKeyPress=function(n,i){n.keyCode===13&&t.prototype.GetMultipleMonogramAttributes(i)},t.prototype.ValidateMonogramAttributes=function(){var t="data-val-required",n=$("#isMonogramming").val();$(":input[IsRequired]").each(function(){var i;i=n!=undefined&&n!=null&&n!=""&&n.toLowerCase()=="true"?ZnodeBase.prototype.getResourceByKeyName("CustomizationRestrictMessageForMonogramming"):ZnodeBase.prototype.getResourceByKeyName("CustomizationRestrictMessage");$(this).attr(t,i);$('label[for="'+this.name+'"]').addClass("required")});$.validator.unobtrusive.parse("form")},t.prototype.ValidateInStockMinQty=function(n,t){return t>0?n=="true"?ZnodeBase.prototype.getResourceByKeyName("defaultIndividualizedMinErrorMessage"):ZnodeBase.prototype.getResourceByKeyName("defaultCustomizedMinErrorMessage"):ZnodeBase.prototype.getResourceByKeyName("defaultMinErrorMessage")},t.prototype.ValidateAddToCartProductCountWithPointBudgetBalanceLimit=function(){var e=!1,n=0,t=0,i=0,h=parseFloat($("#headerBudgetAmount").text()),r=parseFloat($("#hdnRetailPrice").val()),f=$("#headerCart").find("span.headerSubtotal").text(),u=f!=undefined?parseFloat(f.substring(f.indexOf("$")+1)):0,o,s;return $("input[type=text].quantity,input[type=number].quantity").each(function(){var r=$(this).attr("data-selected-quantity"),i;r.trim()!=""&&(t+=parseInt(r));i=$(this).val();i.trim()!=""&&(n+=parseInt(i),$(this).attr("data-selected-quantity",parseInt(i)))}),o=parseInt($("#ParentOmsSavedCartLineItemId").val()),o==0?i=u+n*r:n>t?(s=n-t,i=u+s*r):n<t?(u-=t*r,i=u+n*r):i=u+n*r,i<=h&&(e=!0),e},t.prototype.GetMultipleMonogramAttributes=function(n){var i=parseInt($("#dynamic-productid").val())!=parseInt($("#dynamic-parentproductid").val())?parseInt($("#dynamic-parentproductid").val()):parseInt($("#dynamic-productid").val()),r={ProductId:i,IsCustomizationRequired:$("#isCustomizationRequired").val(),PersonalisedCodeValue:$("#multilocpersonlisecodevalue").val(),Counter:0,RequiredOptionalLoc:$("#RequiredOptionalLoc").val()};$(n).each(function(){var u=parseFloat($(this).val()),i,f;persistedMonogramQuantity=u;i=$(this).attr("data-counter");f=$(this).attr("data-sku");u>0?CustomEndpoint.prototype.GetMultiLocationIndividualisedAttributes(r,function(n){for(var s,o,h,e,r=0;r<=u;r++)for(r<u&&$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i).html().search("frmPersonalised_"+r)==-1&&(s=n.replaceAll("_0","_"+r),o=s.replaceAll('data-counter="0"','data-counter="'+r+'"'),o=o.replaceAll("formIndex ='0'","formIndex='"+r+"'"),$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i).append(o),$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i+" #ancClearIndividualisedProductImage_"+r).attr("data-sku",f)),h=$("form[data-test-selector='frmPersonalisedDetails']").length,e=u;e<h;e++)$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i).html().search("frmPersonalised_"+e)>-1&&$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i+" ._PersonalisedAttribute_"+e).remove();t.prototype.ValidateMonogramAttributes();$("#individualized-text").removeClass("hide");$(".multiple_monogram_product-variation").find(":input[type=text]").removeClass("input-validation-error");$(".multiple_monogram_product-variation").find($(".error-msg")).html("")}):$(".GetMonogramPersonalisedAttributesWithMaxChar #multipleMonogramAttributes_"+i).html("");$(n).removeClass("error")})},t.prototype.GetInStockMinQty=function(n,t){var r=JSON.parse(t),i=[];return r.PersonalizationData.forEach(function(t){t.ProductSKU==n&&t.PersonalizationData.forEach(function(n){n.hasOwnProperty("InStockMinQty")&&(n.hasOwnProperty("IsRequiredLoc")&&n.IsRequiredLoc.toLowerCase()=="true"?i.push(n.InStockMinQty):JSON.parse(n.PersonalizeValue).value!=""&&i.push(n.InStockMinQty))})}),i},t.prototype.UpdateOptionalLocation=function(n,t){var u=JSON.parse(t),i=[],r="";return u.PersonalizationData.forEach(function(t){t.ProductSKU==n&&t.PersonalizationData.forEach(function(n){if(JSON.parse(n.PersonalizeValue).value!=""&&i.filter(function(t){return t.key==n.DecoLocation}).length<=0){var t=$(".multiple_monogram_product-variation").find(":input[decolocation=".concat(n.DecoLocation,"]"))[0];r=$(t).attr("id");i.push({key:n.DecoLocation,value:r})}})}),i},t.prototype.ValidateOptionalLocations=function(n){$.each(n,function(n,t){$.each(t,function(n,t){var i=$(".multiple_monogram_product-variation").find(":input[decolocation=".concat(t.key,"]:input[id=").concat(t.value,"]"));$(i).each(function(){var n=ZnodeBase.prototype.getResourceByKeyName("CustomizationRestrictMessageForMonogramming");$(this).val()==""&&($(this).removeClass("valid"),$(this).addClass("input-validation-error"),$(this).closest($(".customized-txt-remove")).find($(".error-msg")).html(n))})})});$.validator.unobtrusive.parse("form")},t.prototype.LeadTime=function(){var t=$(".leadTimeParentProductId").val(),n=$(".leadTimeDateFormat").val();n!=undefined&&n!=null&&n!=""&&IsLeadTimeCalled&&(CustomEndpoint.prototype.GetProductLeadTime(t,function(t){var r=$.grep(t,function(n){return n.CssClass==="date-delivery"})[0],i,f,e,s;if(r){$("#delivery-date").text($.datepicker.formatDate(n,new Date(r.Date)));$("#waitLoader_").hide();i=$.grep(t,function(n){return n.CssClass==="date-today"})[0];i||(i={Date:new Date,Label:"Today",CssClass:"date-today"});f=1;f=new Date(r.Date).getFullYear()>new Date(i.Date).getFullYear()?12-new Date(i.Date).getMonth()+new Date(r.Date).getMonth()+1:new Date(r.Date).getMonth()-new Date(i.Date).getMonth()+1;$("#calendar-popup").datepicker({numberOfMonths:f,hideIfNoPrevNext:!0,minDate:i.Date,maxDate:r.Date,beforeShowDay:function(n){var i=$.grep(t,function(t){var i=new Date(t.Date);return i.getFullYear()===n.getFullYear()&&i.getDate()===n.getDate()&&i.getMonth()===n.getMonth()})[0];return i?[!0,i.CssClass,i.Label]:[$.datepicker.noWeekends(n),"",""]}});var u={},o=[],h=document.getElementById("delivery-legend");t.forEach(function(n){var t=u[n.CssClass]=u[n.CssClass]||{};t[n.Label]=!0});for(e in u)for(s in u[e])o.push({CssClass:e,Label:s});$(jQuery.parseJSON(JSON.stringify(o))).each(function(){var n=this.CssClass,t=this.Label;n!=="date-weekend"&&h.insertAdjacentHTML("beforeend",'<li><span class="'+n+'"><a> <\/a> <\/span> '+t+"<\/li>")});$("#calendar-button").off().click(function(){$(".deliverySlideIn, #calendar-button").toggleClass("active")});$(".ui-datepicker-group").parent("div").addClass("calendarContainer")}}),IsLeadTimeCalled=!1)},t}(ZnodeBase);$(".msg-upload-container .msg-upload-container-close").bind("click keypress",function(){$(this).parent("div").hide()});$(document).on("keypress","#product-details-quantity input[name='Quantity']",function(n){$(this).attr("data-change","true");$("#Quantity").removeClass("error");$("#quantity-error-msg").text("");var t=n.keyCode||n.which;return 47<t&&t<58||t===8?!0:!1});$(document).on("keypress","#dynamic-product-variations input[data-gridquantity]",function(n){$(this).attr("data-change","true");$("#quantity-error-msg").text("");$("#dynamic-product-variations").find("[data-gridquantity]").each(function(){$(this).removeClass("error")});var t=n.keyCode||n.which;return 47<t&&t<58||t===8?!0:!1});var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),CustomGlobalAttribute=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.SaveEntityAttribute=function(n){if(ZnodeBase.prototype.ShowLoader(),$("#globalAttributeAsidePannel li.active-tab-validation").each(function(){$(this).removeClass("active-tab-validation")}),FormBuilder.prototype.ValidateFileTypeControl(),$("#frmGlobalAttribute").valid())if(t.prototype.IsAttributeValueUnique()){if(FormBuilder.prototype.ValidateFileTypeControl()){ZnodeBase.prototype.HideLoader();return}var i=decodeURIComponent(window.location.href),r=i.split(/[?#]/)[0];typeof n!="undefined"&&ZnodeBase.prototype.setCookie("_backURL",n,null,0);CommonHelper.prototype.SubmitForm($("#frmGlobalAttribute"),function(){})}else return ZnodeBase.prototype.HideLoader(),!1;else ZnodeBase.prototype.HideLoader()},t.prototype.IsAttributeValueUnique=function(){var t=FormBuilder.prototype.Validate(),n="",i,r;return $("input[type='text']").each(function(){$(this).attr("data-unique")!=undefined&&$(this).attr("data-unique")!=""&&$(this).attr("data-unique")!="false"&&(n=n+$(this).attr("id").split("_")[0]+"#"+$(this).val()+"~")}),i=parseInt($("#EntityId").val()),r=$("#EntityType").val(),n=n.substr(0,n.length-1),Endpoint.prototype.IsGlobalValueUnique(n,i,r,function(n){n.data!=null&&n.data!=""&&(ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.data,"error",isFadeOut,fadeOutTime),t=!1)}),t},t}(ZnodeBase),__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),CustomUser=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.CustomOnClickEvent=function(){t.prototype.CustomBindInlineOnclickEvent();t.prototype.RemoveIconSaveForLaterList()},t.prototype.CustomBindInlineOnclickEvent=function(){$("#idUpdateProfile").on("click",function(){return t.prototype.validateDataCapture()});$("#idBtnCreateAccount").on("click",function(){return t.prototype.ValidateAccountDetails()});$("#user-register").on("click",function(){return t.prototype.validateDataCapture()});$("#registerBtnCancel").on("click",function(){location.href="/user/login"});$(".wishlist-item button").on("click",function(){var n=$("#wishlistProductUrl_"+$(this).attr("id")+"_"+$(this).attr("data-id")).val();location.href=n});$("#valPassword").on("blur",function(){User.prototype.DefaultSpanMsgHideShow(this)});$("#NewPassword").on("blur",function(){User.prototype.DefaultSpanMsgHideShow(this)});$(document).ready(function(){User.prototype.setRegexValueToSpan()});$("[data-test-selector=linkLogIn]").off().on("click",function(){localStorage.removeItem("recentlyViewedProducts")});$("[data-test-selector=linkLogOff]").off().on("click",function(){localStorage.removeItem("recentlyViewedProducts")})},t.prototype.SetCustomManageQuoteUrl=function(n){$("#"+n+" #grid tbody tr td").find(".zf-view").each(function(){var i=$(this).attr("data-parameter").split("&")[1].split("=")[1],n=$(this).attr("href"),t;n=n!=undefined&&n!=null&&n!=""?n.toLowerCase():n;n.length>0&&(i.toLowerCase()=="ordered"?(t=$(this).attr("data-parameter").split("&")[0].split("=")[1],n=window.location.protocol+"//"+window.location.host+"/user/orderreceipt?omsorderid="+t):n=window.location.protocol+"//"+window.location.host+n);$(this).attr("href",n)})},t.prototype.ValidateAccountDetails=function(){var u=$("#valFirstName").val(),n=!0,i,f,t,r;return u.length<1?($("#valFirstNameError").html(ZnodeBase.prototype.getResourceByKeyName("RequiredFirstName")),$("#valFirstNameError").addClass("error-msg"),$("#valFirstNameError").show(),n=!1):u.length>100?($("#valFirstNameError").html(ZnodeBase.prototype.getResourceByKeyName("FirstNameLengthErrorMessage")),$("#valFirstNameError").addClass("error-msg"),$("#valFirstNameError").show(),n=!1):$("#valFirstNameError").html(""),i=$("#valLastName").val(),i.length<1?($("#valLastNameError").html(ZnodeBase.prototype.getResourceByKeyName("RequiredLastName")),$("#valLastNameError").addClass("error-msg"),$("#valLastNameError").show(),n=!1):i.length>100?($("#valLastNameError").html(ZnodeBase.prototype.getResourceByKeyName("LastNameLengthErrorMessage")),$("#valLastNameError").addClass("error-msg"),$("#valLastNameError").show(),n=!1):$("#valLastNameError").html(""),f=$("#valUserName").val(),f.length<1?($("#valUserNameError").html(ZnodeBase.prototype.getResourceByKeyName("RequiredUserName")),$("#valUserNameError").addClass("error-msg"),$("#valUserNameError").show(),n=!1):$("#valUserNameError").html(""),t=$("#valPassword").val(),r=$("#valReTypePassword").val(),t&&(t==null||t==""?($("#valPasswordError").html(ZnodeBase.prototype.getResourceByKeyName("RequiredPassword")),$("#valPasswordError").addClass("error-msg"),$("#valPasswordError").show(),n=!1):$("#valPasswordError").removeClass("field-validation-error").html(""),r==null||r==""?($("#valReTypePasswordError").html(ZnodeBase.prototype.getResourceByKeyName("RequiredConfirmPassword")),$("#valReTypePasswordError").addClass("error-msg"),$("#valReTypePasswordError").show(),n=!1):$("#valReTypePasswordError").removeClass("field-validation-error").html("")),this.validateDataCapture()||(n=!1),n},t.prototype.validateDataCapture=function(){return DataCapture.prototype.validateMultipleAccountsDataCaptures(!0)?($("#custom1").val(DataCapture.prototype.getDataCapture()),!0):!1},t.prototype.SaveChanges=function(n,t){var i,r;return n?n.preventDefault():"",t!=""&&typeof t!="undefined"&&t!=null&&($("input[name=Address1]").val($("#recommended-address1-"+t+"").text().trim().substring(0,30)),$("input[name=Address2]").val($("#recommended-address2-"+t+"").text().trim().substring(0,30)),$("input[name=CityName]").val($("#recommended-address-city-"+t+"").text()),$("input[name=PostalCode]").val($("#recommended-address-postalcode-"+t+"").text()),$("select[name=StateName] option:selected").removeAttr("selected"),$("select[name=StateName] option[value='"+$("#recommended-address-state-"+t+"").text().trim()+"']").prop("selected","selected"),$("select[name=StateName]").val($("#recommended-address-state-"+t+"").text().trim()),i=$("#Edit-Address-content_shipping #IsBothBillingShipping").prop("checked"),i&&(r=$("#billing-content #AddressId").val(),$("#shipping-content").find("input[name=AddressId]").val(r))),$("#formChange").val("true"),$("#custom-modal").modal("hide"),CommonHelper.prototype.SubmitForm($("#btnSaveAddress").closest("form"),function(){}),!0},t.prototype.BindAddressModel=function(){var n=User.prototype.BindAddressModel();return n.StateName=$("select[name=StateName] option:selected").val(),n},t.prototype.BindAddressModelByAddressType=function(n){var i=$("#Edit-Address-content_"+n+" #txtStateCode[disabled]").length>0?$("#Edit-Address-content_"+n+" #SelectStateName option:selected").val():$("#Edit-Address-content_"+n+" #txtStateCode").val(),t={Address1:$("#Edit-Address-content_"+n+" input[name=Address1]").val(),Address2:$("#Edit-Address-content_"+n+" input[name=Address2]").val(),AddressId:parseInt($("#Edit-Address-content_"+n+" #AddressId").val()),CityName:$("#Edit-Address-content_"+n+" input[name=CityName]").val(),FirstName:$("#Edit-Address-content_"+n+" input[name=FirstName]").val(),LastName:$("#Edit-Address-content_"+n+" input[name=LastName]").val(),PostalCode:$("#Edit-Address-content_"+n+" input[name=PostalCode]").val(),StateName:i,CountryName:$("#Edit-Address-content_"+n+' select[name="CountryName"]').val()};return t.StateName=$("#Edit-Address-content_"+n+" select[name=StateName] option:selected").val(),t},t.prototype.CustomRecommendedAddress=function(n){t.prototype.checkRecommendedAddress(n)},t.prototype.ShippingFormValidate=function(n){return n=="shipping"&&$("#ShippingAddressContainer").find("#address_postalcode").val()==""?!1:$("#ShippingAddressContainer").find("#address_postalcode").val()==""?!0:!1},t.prototype.checkRecommendedAddress=function(n,i){var f,r,u;return(i===void 0&&(i=""),$("input:hidden[name=DisplayName]").length>0&&$("input:hidden[name=DisplayName]").rules("remove","required"),f=t.prototype.ShippingFormValidate(n),!f&&!$("#frmEditAddress_"+n+"").valid())?($("#btnSaveAddress").removeAttr("disabled"),!1):(ZnodeBase.prototype.ShowLoader(),r=t.prototype.BindAddressModel(),u=!1,Endpoint.prototype.GetRecommendedAddress(r,function(n){var i=n.html,f;i!=""&&typeof i!="undefined"&&i!=null?($("#custom-modal").find("#custom-content").empty(),CommonHelper.prototype.LoadHtmlByControl($("#custom-modal").find("#custom-content").eq(0),i),$("#user-entered-address").empty(),f="<div class='address-street'><div id='enteredAddress1'>"+r.Address1+"<\/div>",r.Address2!=""&&typeof r.Address2!="undefined"&&r.Address2!=null&&(f+="<div id='enteredAddress2'>"+r.Address2+"<\/div> "),f+="<div class='address-citystate'><span id='enteredCity'>"+r.CityName+"<\/span> <span id='enteredState'>"+r.StateName+"<\/span> <span id='enteredPostalCode'>"+r.PostalCode+"<\/span> <div id='enteredCountry'>"+r.CountryName+"<\/div><\/div>",CommonHelper.prototype.LoadHtmlById("#user-entered-address",f),t.prototype.ShowHideRecommendedPopUp(),ZnodeBase.prototype.HideLoader(),u=!1,$(".address-popup").modal("hide")):(u=!0,CommonHelper.prototype.SubmitForm($("#btnSaveAddress").closest("form"),function(){}))}),ZnodeBase.prototype.HideLoader(),u)},t.prototype.ShowHideRecommendedPopUp=function(){var n=!0;if(n=User.prototype.MatchAddress(),n)return t.prototype.SaveChanges(null,null);$("#custom-modal").modal("show");$("#BillingAddressContainer").show()},t.prototype.CustomFormTemplateOnSuccess=function(n){if(n.text=="ShopperRegistration"||n.text=="NorthwellSPOForm"){ZnodeBase.prototype.HideLoader();var t=n.message,i=n.hasError;return $("#frmFormBuilder").trigger("reset"),n.text=="NorthwellSPOForm"&&($(".fb_PreviousNorthwellPO").find("input").hide(),$(".fb_PreviousNorthwellPO").find("input").attr("disabled","disabled"),$(".fb_PreviousNorthwellPO").find("input").attr("isrequired","False"),$(".fb_NorthwellHowManyResidentialAddresses").find("input").hide(),$(".fb_NorthwellHowManyResidentialAddresses").find("input").attr("disabled","disabled"),$(".fb_NorthwellHowManyResidentialAddresses").find("input").attr("isrequired","False"),$(".fb_NorthwellAddressLine1").hide(),$(".fb_NorthwellAddressLine1").find("input").hide(),$(".fb_NorthwellAddressLine1").find("input").attr("disabled","disabled"),$(".fb_NorthwellAddressLine1").find("input").attr("isrequired","False"),$(".fb_NorthwellAddressLine2").hide(),$(".fb_NorthwellAddressLine2").find("input").hide(),$(".fb_NorthwellAddressLine2").find("input").attr("disabled","disabled"),$(".fb_NorthwellAddressLine2").find("input").attr("isrequired","False"),$(".fb_NorthwellCity").hide(),$(".fb_NorthwellCity").find("input").hide(),$(".fb_NorthwellCity").find("input").attr("disabled","disabled"),$(".fb_NorthwellCity").find("input").attr("isrequired","False"),$(".fb_NorthwellState").hide(),$(".fb_NorthwellState").find("select").hide(),$(".fb_NorthwellState").find("select").attr("disabled","disabled"),$(".fb_NorthwellState").find("select").attr("isrequired","False"),$(".fb_NorthwellZipCode").hide(),$(".fb_NorthwellZipCode").find("input").hide(),$(".fb_NorthwellZipCode").find("input").attr("disabled","disabled"),$(".fb_NorthwellZipCode").find("input").attr("isrequired","False"),$(".fb_Sizes").find("input").hide(),$(".fb_Sizes").find("input").attr("disabled","disabled"),$(".fb_Sizes").find("input").attr("isrequired","False"),$(".fb_EmailAdditionalDesignText .nopadding").find("div:first-child").addClass("control-label"),$(".fb_EmailAdditionalDesignText .abc").html(""),$(".fb_EmailAdditionalDesignText .abc").html(emailLabelTextGlobal)),t==undefined||t==""?ZnodeNotification.prototype.DisplayNotificationMessagesHelper(ZnodeBase.prototype.getResourceByKeyName("RecordCreationSuccessMessage"),"success",isFadeOut,fadeOutTime):ZnodeNotification.prototype.DisplayNotificationMessagesHelper(t,i?"error":"success",isFadeOut,fadeOutTime),!0}if($("#FormCode").val().toLowerCase()=="pncspecialorderform")$("#frmFormBuilder").trigger("reset"),$(".fb_AddressLine1").show(),$(".fb_AddressLine1").find("input").show(),$(".fb_AddressLine1").find("input").removeAttr("disabled"),$(".fb_AddressLine1").find("input").attr("isrequired","True"),$(".fb_AddressLine1").find(".error-msg").hasClass("field-validation-error")&&$(".fb_AddressLine1").find(".error-msg").html()!=""&&$(".fb_AddressLine1").find(".error-msg.field-validation-error").show(),$(".fb_AddressLine2").show(),$(".fb_AddressLine2").find("input").show(),$(".fb_AddressLine2").find("input").removeAttr("disabled"),$(".fb_AddressLine2").find("input").attr("isrequired","False"),$(".fb_AddressLine2").find(".error-msg").hasClass("field-validation-error")&&$(".fb_AddressLine2").find(".error-msg").html()!=""&&$(".fb_AddressLine2").find(".error-msg.field-validation-error").show(),$(".fb_PNCCity2").show(),$(".fb_PNCCity2").find("input").show(),$(".fb_PNCCity2").find("input").removeAttr("disabled"),$(".fb_PNCCity2").find("input").attr("isrequired","True"),$(".fb_PNCCity2").find(".error-msg").hasClass("field-validation-error")&&$(".fb_PNCCity2").find(".error-msg").html()!=""&&$(".fb_PNCCity2").find(".error-msg.field-validation-error").show(),$(".fb_PNCState").show(),$(".fb_PNCState").find("select").show(),$(".fb_PNCState").find("select").removeAttr("disabled"),$(".fb_PNCState").find("select").attr("isrequired","True"),$(".fb_PNCState").find(".error-msg").hasClass("field-validation-error")&&$(".fb_PNCState").find(".error-msg").html()!=""&&$(".fb_PNCState").find(".error-msg.field-validation-error").show(),$(".fb_PNCZipCode").show(),$(".fb_PNCZipCode").find("input").show(),$(".fb_PNCZipCode").find("input").removeAttr("disabled"),$(".fb_PNCZipCode").find("input").attr("isrequired","True"),$(".fb_PNCZipCode").find(".error-msg").hasClass("field-validation-error")&&$(".fb_PNCZipCode").find(".error-msg").html()!=""&&$(".fb_PNCZipCode").find(".error-msg.field-validation-error").show(),ZnodeBase.prototype.HideLoader(),ZnodeNotification.prototype.DisplayNotificationMessagesHelper($("#TextMessage").val(),"success",isFadeOut,fadeOutTime);else if($("#FormCode").val().toLowerCase()=="michelinsporequestform"||$("#FormCode").val().toLowerCase()=="michelindealersporequestform")$("#frmFormBuilder").trigger("reset"),ZnodeBase.prototype.HideLoader(),ZnodeNotification.prototype.DisplayNotificationMessagesHelper($("#TextMessage").val(),"success",isFadeOut,fadeOutTime);else return FormBuilder.prototype.FormTemplateOnSuccess(n),!0},t.prototype.clearECertificateKey=function(){$("#NotificationType").val()==="success"&&$("#CertificateKey").val("")},t.prototype.RemoveIconSaveForLaterList=function(){$("#layout-account-wishlist .wishlist-item-remove a").on("click",function(n){n.preventDefault();t.prototype.DeleteSaveForLaterProduct(this);_SaveForLaterList.prototype.EnableOrDisableShareSelectedButton()})},t.prototype.DeleteSaveForLaterProduct=function(n){var t=$(n),i=t.data("id");ZnodeBase.prototype.ShowLoader();$("#chkShareProductCheckbox_"+i).prop("checked",!1);CustomEndpoint.prototype.DeleteSaveForLaterProduct(i,function(n){return ZnodeBase.prototype.HideLoader(),ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.data.style,!0,1e4),n.success?(t.closest(".wishlist-item").remove(),$("#wishlistcount").html(n.data.total)):n.isRedirectToLogin&&(document.location.href=n.link),!0})},t}(User);$(document).ready(function(){CustomUser.prototype.CustomOnClickEvent()});var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),DataCapture=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.getDataCapture=function(n){var r,i,c;try{r=void 0;r=$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content"):$("#data-capture-content");var l=r.find("label[cat-field-id]"),f=r.find("input[cat-field-id],select[cat-field-id]"),u=[];for(i=0;i<f.length;i++){var e=l[i],t=f[i],o=t.nodeName,a=t.getAttribute("cat-field-id"),s=o.toUpperCase()=="SELECT"?$("#dataCaptureField_".concat(t.getAttribute("spp-datacapture-portal-id")," option:selected")).text():"",h=o.toUpperCase()=="SELECT"?$("#dataCaptureField_".concat(t.getAttribute("spp-datacapture-portal-id")," option:selected")).attr("linc-value"):"",v=$(".signle-page-payment").find('[name="PaymentOptions"]:checked').val();u.push({Label:e.textContent.trim(),CATFieldId:a,Value:t.value!=null&&t.value!=undefined?t.value.trim():"",DisplayValue:s!==""?s:t.value!=null&&t.value!=undefined?t.value.trim():"",LINCValue:h!==""?h:t.value!=null&&t.value!=undefined?t.value.trim():"",DisplayOrder:t.getAttribute("display-order"),IsValidated:t.getAttribute("is-validated")==null?!1:t.getAttribute("is-validated"),ValidationErrorMessage:t.getAttribute("val-msg"),MaxLength:t.getAttribute("maxlength"),SPPDataCapturePortalAttributeId:t.getAttribute("spp-datacapture-portal-id"),PaymentSettingId:v,AttributeType:e.innerHTML,IsRequired:t.getAttribute("required")==null?!1:t.getAttribute("required"),RequiredErrorMessage:t.getAttribute("required-msg"),RegExErrorMessage:t.getAttribute("regex-msg"),IsEditable:t.getAttribute("is-editable")==null?!1:t.getAttribute("is-editable"),HelpDescription:t.getAttribute("help-description"),IsDependentOnId:t.getAttribute("is-dependenton-id"),IsCascadingEnabled:t.getAttribute("is-cascading-enabled"),AccountNumber:t.getAttribute("account-number")=="null"?null:t.getAttribute("account-number"),IsShowOnRegistration:t.getAttribute("is-show-on-registration"),IsShowOnCheckout:t.getAttribute("is-show-on-checkout"),IsShowAtSiteEntry:t.getAttribute("is-show-at-siteEntry"),PaymentExternalId:t.getAttribute("payment-external-id")=="null"?null:t.getAttribute("payment-external-id"),UseGiftToolApi:t.getAttribute("data-use-gift-tool-api"),IsVisible:t.getAttribute("is-visible")==null||t.getAttribute("is-visible")==undefined||t.getAttribute("is-visible")==""?!0:t.getAttribute("is-visible")})}return JSON.stringify(n?u.filter(n):u)}catch(y){c=navigator.userAgent;CustomEndpoint.prototype.AddEmptyDataCaptureLogs(y,c,function(){return null})}},t.prototype.validateDataCapture=function(n){var l=this,i=!0,o,r,e,c;for(r=$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content"):$("#data-capture-content"),o=typeof n=="string"?r.find("input[cat-field-id='".concat(n,"'],select[cat-field-id='").concat(n,"']")):r.find("input[cat-field-id],select[cat-field-id]"),e=0;e<o.length;e++){var t=o[e],a=t.getAttribute("cat-field-id"),v=t.getAttribute("spp-datacapture-portal-id"),s=t.getAttribute("required"),y=t.getAttribute("required-msg"),u=t.getAttribute("regex-pattern"),p=t.getAttribute("regex-msg"),h=r.find("span[cat-field-id='".concat(a,"'][spp-datacapture-portal-id='").concat(v,"']")),f=t.value;s!=undefined&&s!=null&&s.toLowerCase()=="true"&&f.length<1?(this.showErrorMessage(t,h,y),i=!1):f!=null&&f!=""&&f!=undefined&&u!=null&&u!=undefined&&u!="undefined"&&u.length>0&&(c=new RegExp(u),c.test(f)||(this.showErrorMessage(t,h,p),i=!1));i&&(h.html(""),t.classList.remove("input-validation-error"))}return i&&typeof n=="boolean"&&n&&CustomEndpoint.prototype.ValidateDataCapture(this.getDataCapture(function(n){return n.IsValidated}),function(n){n.forEach(function(n){var u=r.find("span[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']")),t=r.find("input[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']"))[0];n.HasValidationError&&n.Value!=""?(l.showErrorMessage(t,u,t.getAttribute("val-msg")),i=!1):t.classList.remove("input-validation-error")})}),i},t.prototype.customValidateDataCapture=function(n){var c=this,r=!0,e,i,f,h;for(i=$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content"):$("#data-capture-content"),e=typeof n=="string"?i.find("input[data-cat-field-id='".concat(n,"'],select[data-cat-field-id='").concat(n,"']")):i.find("input[data-cat-field-id],select[data-cat-field-id]"),f=0;f<e.length;f++){var t=e[f],l=t.getAttribute("data-cat-field-id"),a=t.getAttribute("data-required"),v=t.getAttribute("data-required-msg"),o=t.getAttribute("data-regex-pattern"),y=t.getAttribute("data-regex-msg"),s=i.find("span[data-cat-field-id='".concat(l,"']")),u=t.value;a=="True"&&u.length<1?(this.showErrorMessage(t,s,v),r=!1):u!=null&&u!=""&&u!=undefined&&o!="undefined"&&o.length>0&&(h=new RegExp(o),h.test(u)||(this.showErrorMessage(t,s,y),r=!1));r&&(s.html(""),t.classList.remove("input-validation-error"))}return r&&typeof n=="boolean"&&n&&CustomEndpoint.prototype.ValidateDataCapture(this.customGetDataCapture(function(n){return n.IsValidated}),function(n){n.forEach(function(n){var f=i.find("span[data-cat-field-id='"+n.CATFieldId+"']"),t=i.find("input[data-cat-field-id='"+n.CATFieldId+"']")[0],u=i.find("select[data-cat-field-id='"+n.CATFieldId+"']")[0];n.HasValidationError?(c.showErrorMessage(t,f,t.getAttribute("data-val-msg")),r=!1):typeof t!=undefined&&t!=null?t.classList.remove("input-validation-error"):typeof u!=undefined&&u!=null&&u.classList.remove("input-validation-error")})}),r},t.prototype.customGetDataCapture=function(n){var r,i;r=$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content"):$("#data-capture-content");var c=r.find("label[data-cat-field-id]"),f=r.find("input[data-cat-field-id],select[data-cat-field-id]"),u=[];for(i=0;i<f.length;i++){var e=c[i],t=f[i],o=t.nodeName,l=t.getAttribute("data-cat-field-id"),s=o.toUpperCase()=="SELECT"?$("#dataCaptureField_".concat(t.getAttribute("data-spp-datacapture-portal-id")," option:selected")).text():"",h=o.toUpperCase()=="SELECT"?t.getAttribute("data-value"):"",a=$(".signle-page-payment").find('[name="PaymentOptions"]:checked').val();u.push({Label:e.textContent.trim(),CATFieldId:l,Value:t.value!=null&&t.value!=undefined?t.value.trim():"",DisplayValue:s!==""?s:t.value!=null&&t.value!=undefined?t.value.trim():"",LINCValue:h!==""?h:t.value!=null&&t.value!=undefined?t.value.trim():"",DisplayOrder:t.getAttribute("data-display-order"),IsValidated:t.getAttribute("data-is-validated")==null?!1:t.getAttribute("data-is-validated"),ValidationErrorMessage:t.getAttribute("data-val-msg"),MaxLength:t.getAttribute("data-maxlength"),SPPDataCapturePortalAttributeId:t.getAttribute("data-spp-datacapture-portal-id"),PaymentSettingId:a,AttributeType:e.innerHTML,IsRequired:t.getAttribute("data-required")==null?!1:t.getAttribute("data-required"),RequiredErrorMessage:t.getAttribute("data-required-msg"),RegExErrorMessage:t.getAttribute("data-regex-msg"),IsEditable:t.getAttribute("data-is-editable")==null?!1:t.getAttribute("data-is-editable"),HelpDescription:t.getAttribute("data-help-description"),IsDependentOnId:t.getAttribute("data-is-dependenton-id"),IsCascadingEnabled:t.getAttribute("data-is-cascading-enabled"),AccountNumber:t.getAttribute("data-account-number")=="null"?null:t.getAttribute("data-account-number"),IsShowOnRegistration:t.getAttribute("data-is-show-on-registration"),IsShowOnCheckout:t.getAttribute("data-is-show-on-checkout"),IsShowAtSiteEntry:t.getAttribute("data-is-show-at-siteEntry"),PaymentExternalId:t.getAttribute("data-payment-external-id")=="null"?null:t.getAttribute("data-payment-external-id"),UseGiftToolApi:t.getAttribute("data-use-gift-tool-api"),IsVisible:t.getAttribute("data-is-visible")==null||t.getAttribute("data-is-visible")==undefined||t.getAttribute("data-is-visible")==""?!0:t.getAttribute("data-is-visible")})}return JSON.stringify(n?u.filter(n):u)},t.prototype.showErrorMessage=function(n,t,i){n.classList.add("input-validation-error");t.addClass("error-msg");t.html(i);t.show()},t.prototype.showSuccessMessage=function(n,t,i){t.addClass("success-msg");t.html(i);t.show()},t.prototype.BindDataCaptureDeleteClick=function(n){$("#hdnDeleteDiv").val($(n).attr("portal-attr-id"))},t.prototype.DeleteUserDataCapture=function(n){var t=$("#UserId").val();n&&t&&CustomEndpoint.prototype.DeleteUserDataCapture(n,t,function(n){ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.status?"success":"error",isFadeOut,fadeOutTime);n.status?window.location.href="/user/editprofile":ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.status?"success":"error",isFadeOut,fadeOutTime)})},t.prototype.IsCheckoutPage=function(){var n=window.location.href;return n.indexOf("checkout")!=-1?!0:!1},t.prototype.CreateDataCaptureControl=function(n,i,r){var u,f;r===void 0&&(r=0);$("#ApplyEcertificate").prop("checked")&&$("#dynamic-order-total").val()<$("#hdnEcertAvailableTotal").val()?(u=$('input[name="PaymentOptions"]:checked'),u&&u.length>0?u.attr("data-payment-type").toLowerCase()!="budget"&&(i=parseFloat($('input[name="PaymentOptions"]:checked').attr("id"))):i=$("#ApplyEcertificate").prop("checked")?parseFloat($("#hdnEcertPaymentSettingId").val()):parseFloat(u.attr("id"))):n=="checkout"?i=parseFloat($('input[name="PaymentOptions"]:checked').attr("id")):$("#data-capture-content").html("");(n==="checkout"&&i>0||n==="registration"||n==="editprofile"||n==="showatsiteentry")&&CustomEndpoint.prototype.GetDataCaptureFields(n,i,r,function(i){var r=$("#ShortTermOfferEnabledFalg").val(),u=r!=null&&r!=undefined?r.toLowerCase():"false";u=="true"&&CustomEndpoint.prototype.GetShowAtSiteEntryDataFromCookie(function(n){var t=i.filter(function(n){return n.IsShowAtSiteEntry}).length,r=n.data;t>0&&r===null?($("#showAtSiteEntryDataCapture").removeClass("d-none"),$("#topLevelCategoryMenu").css("visibility","hidden"),$("button").removeClass("maincta"),$("#loginMenu").hide(),$("#topLinks").hide(),$("[data-test-selector=divMiniCart]").hide(),$("#orderNow").hide()):($("#showAtSiteEntryDataCapture").addClass("d-none"),$(".main-cta-wrapper").css("display","contents"),$("#bnr-home-wrapper").css("flex-direction","column").css("max-width","var(--main-wrapper-width)"),$(".default-bnr-content").css("margin-right","0").css("width","100%"),$("#topLevelCategoryMenu").css("visibility","visible"),$("#loginMenu").show(),$("#topLinks").show(),$("[data-test-selector=divMiniCart]").show(),$("#orderNow").show())});dataCaptureResponse=i;t.prototype.buildDataCaptureControls(i,n)});n=="category"&&(f=$("#layout-category").attr("data-categoryid"),CustomEndpoint.prototype.GetCategoryValidationDetails(f,function(i){t.prototype.buildDataCaptureControls(i,n)}));$(".dataCapture").each(function(){var h=$(this).find("[data-test-attr=dataCapture]").attr("is-dependenton-id"),i=$(this).find("[data-test-attr=dataCapture]").attr("value"),e=$(this).find("[data-test-attr=dataCapture]").attr("cat-field-id"),r=$(this).find("[data-test-attr=dataCapture]").attr("options-selected"),f=$(this).find("[data-test-attr=dataCapture]").attr("spp-datacapture-portal-id"),o=parseInt($(this).find("[data-test-attr=dataCapture]").attr("options-count")),s=".SPPDataCaptureDefaultValue_"+f,u=$(this).find(s);$(this).find("[data-test-attr=dataCapture]").attr("is-editable")=="true"?t.prototype.IsCheckoutPage()?u!=undefined&&u.find("option selected").length>0&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled"):i!=""&&i!=undefined&&i!="[]"&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled"):$(this).find("[data-test-attr=dataCapture]").attr("is-editable")=="false"&&$(this).find("[data-test-attr=dataCapture]").prop("disabled",!0);o>0&&(n=="registration"||n=="editprofile")&&(u!=undefined&&u.find("option selected").length>0||i!=""&&i!=undefined&&i!="[]")?t.prototype.GetChildDataCaptureValueLocales("".concat(e),"".concat(f)):o>0&&n=="checkout"&&r!=undefined&&r!=""&&r=="true"?t.prototype.GetChildDataCaptureValueLocales(""+e,""+f):r!=undefined&&r!=""&&r=="true"&&n=="checkout"&&$(this).find("[data-test-attr=dataCapture]").removeAttr("disabled")})},t.prototype.htmlEncode=function(n){return!n||n.length<1?n:n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},t.prototype.buildDataCaptureControls=function(n,i){var u="",r="",e=null,o=$("#ShortTermOfferEnabledFalg").val(),h=o!=null&&o!=undefined?o.toLowerCase():"false",f="",s=$("#CaptureReferringUrl").val(),c=s!=null&&s!=undefined?s.toLowerCase():"false";i!="editprofile"&&h=="true"&&CustomEndpoint.prototype.GetShowAtSiteEntryDataInModelFromCookie(function(n){e=n.data});n.forEach(function(o){var y=o.IsRequired?"required":"",l=n.find(function(n){return n.SPPDataCapturePortalAttributeId==o.IsDependentOnId}),tt,a,h,v,b,it,rt;l=l!=undefined?l.Value:"";var ut=o.IsDependentOnId!=0&&o.IsCascadingEnabled&&(l==null||l==undefined||l=="")?'disabled="disabled"':"",s=o.HelpDescription?o.HelpDescription:"",k=o.ValidationErrorMessage?o.ValidationErrorMessage:"",d=o.RegExErrorMessage?o.RegExErrorMessage:"",g=o.RegEx?o.RegEx:"",p=o.RequiredErrorMessage?o.RequiredErrorMessage:"",nt=o.MaxLength?"maxlength="+o.MaxLength:"",w="";e!=null&&(tt=e.filter(function(n){return n.SPPDataCapturePortalAttributeId==o.SPPDataCapturePortalAttributeId}),a=null,tt.length>0&&(a=tt[0].Value));h=a!=null&&a!=undefined?"value='"+a+"'":o.Value?"value='"+t.prototype.htmlEncode(o.Value.toString())+"'":"";o.AttributeTypeId==9&&o.Options.length>0?(v=o.IsRequired==!0?"<option value=''><\/option>":"<option value=' '><\/option>",o.Options.forEach(function(n){var t=$('input[name="PaymentOptions"]:checked').attr("data-paymentExternalId"),i;t==""&&(t=undefined);o.IsShowOnRegistration&&o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t==undefined?t=o.AccountNumber:o.IsShowOnRegistration&&o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t!=undefined?t=t:(o.IsShowOnRegistration||o.IsShowAtSiteEntry)&&!o.IsShowOnCheckout&&t==undefined?t=o.AccountNumber:!o.IsShowOnRegistration&&o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t!=undefined?t=t:!o.IsShowOnRegistration&&o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t==undefined?t=o.AccountNumber:o.IsShowOnRegistration&&!o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t==undefined?t=o.AccountNumber:o.IsShowOnRegistration&&!o.IsShowAtSiteEntry&&o.IsShowOnCheckout&&t!=undefined&&(t=t);i="";a==n.Value?i="selected = 'selected'":o.Value==n.Value&&n.AccountNumber!=null&&n.AccountNumber==t?i="selected = 'selected'":o.Value==n.Value&&n.AccountNumber==null&&(i="selected = 'selected'");w==""&&(w=i!=""?"true":"false");n.AccountNumber!=null?n.AccountNumber==t&&(v=v+"<option class=SPPDataCaptureDefaultValue_".concat(o.SPPDataCapturePortalAttributeId," spp-datacapture-defaultvalue-id ='").concat(n.SPPDataCaptureAttributeDefaultValueId,"' value='").concat(n.Value,"' linc-value='").concat(n.LINCValue,"' ").concat(i,">").concat(n.Text,"<\/option>")):v=v+"<option class=SPPDataCaptureDefaultValue_".concat(o.SPPDataCapturePortalAttributeId," spp-datacapture-defaultvalue-id ='").concat(n.SPPDataCaptureAttributeDefaultValueId,"' value='").concat(n.Value,"' linc-value='").concat(n.LINCValue,"' ").concat(i,">").concat(n.Text,"<\/option>");t=""}),r="<div>\n                                            <label class='control-label ".concat(y,"' required=").concat(o.IsRequired," cat-field-id=").concat(o.CATFieldId," data-test-selector='lblDataCaptureLabel'>").concat(o.Label,'<\/label>\n                                          <\/div>\n                                       <div class="control-md dataCapture">\n                                            <div class="left-inner-icon">\n                                                <div class="select-container" data-test-selector="divDataCaptureSelect">\n                                                        <select ').concat(ut,' class="input-select" id="dataCaptureField_').concat(o.SPPDataCapturePortalAttributeId,'"\n                                                            data-test-attr="dataCapture" cat-field-id= ').concat(o.CATFieldId," display-order= ").concat(o.DisplayOrder,"\n                                                            required= ").concat(o.IsRequired," required-msg= '").concat(p,"'\n                                                            is-editable= ").concat(o.IsEditable," is-cascading-enabled= ").concat(o.IsCascadingEnabled,"\n                                                            is-dependenton-id = ").concat(o.IsDependentOnId," help-description= '").concat(s,"'\n                                                            account-number = ").concat(o.AccountNumber,"\n                                                            comma-seperated-ccount-number = ").concat(o.PaymentSettingId,"\n                                                            spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,"\n                                                            is-show-on-registration = ").concat(o.IsShowOnRegistration,"\n                                                            is-show-on-checkout = ").concat(o.IsShowOnCheckout,"\n                                                            is-show-at-siteEntry = ").concat(o.IsShowAtSiteEntry," ").concat(h,"\n                                                            payment-external-id = ").concat(o.PaymentExternalId,"\n                                                            data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'\n                                                            options-count = ").concat(o.Options.length,"\n                                                            options-selected = '").concat(w,"'\n                                                            is-visible ='").concat(o.IsVisible,"'\n                                                            onchange='DataCapture.prototype.GetChildDataCaptureValueLocales(\"").concat(o.CATFieldId,'","').concat(o.SPPDataCapturePortalAttributeId,'")\'">\n\t\t\t\t\t\t                                ').concat(v,"\n\t\t\t\t\t\t                                <\/select>\n                                                <\/div>\n                                                <span cat-field-id= ").concat(o.CATFieldId," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,' data-test-selector="spnDataCaptureField"><\/span>\n                                                <div id="Help-Description">').concat(s,"<\/div>\n                                            <\/div>\n                                         <\/div>")):o.AttributeTypeId==5&&(b="",it=o.IsVisible?"":"hidden",c!="true"||o.CATFieldId!=$("#LincCatField").val()||o.IsVisible||CustomEndpoint.prototype.GetCaptureReferringURLDataFromCookie(function(n){h=n.data?n.data:""}),h=o.IsVisible?h:"value = '"+h+"'",rt=o.IsCascadingEnabled?"":"onblur='return DataCapture.prototype.validateMultipleAccountsDataCaptures(\"".concat(o.CATFieldId,'","').concat(o.SPPDataCapturePortalAttributeId,"\");'"),b=o.IsRequired==!0?'<input type="text" id="textDataCapture_'.concat(o.SPPDataCapturePortalAttributeId,'"\n                                                cat-field-id= ').concat(o.CATFieldId," display-order= ").concat(o.DisplayOrder,"  ").concat(nt,'\n                                                required="true" required-msg= \'').concat(p,"' regex-pattern = '").concat(g,"'\n                                                is-cascading-enabled= ").concat(o.IsCascadingEnabled," account-number = ").concat(o.AccountNumber,"\n                                                comma-seperated-ccount-number = ").concat(o.PaymentSettingId,"\n                                                regex-msg = '").concat(d,"' is-validated= ").concat(o.IsValidated," is-editable= ").concat(o.IsEditable,"\n                                                val-msg= '").concat(k,"' help-description= '").concat(s,"'\n                                                data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'\n                                                ").concat(h," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,"\n                                                is-dependenton-id = ").concat(o.IsDependentOnId,"\n                                                is-show-on-registration = ").concat(o.IsShowOnRegistration,"\n                                                is-show-on-checkout = ").concat(o.IsShowOnCheckout,"\n                                                is-show-at-siteEntry = ").concat(o.IsShowAtSiteEntry,"\n                                                payment-external-id = ").concat(o.PaymentExternalId,"\n                                                ").concat(rt,'  data-test-selector="divDataCaptureInput"\n                                                data-test-attr="dataCapture" />'):'<input type="text" id="textDataCapture_'.concat(o.SPPDataCapturePortalAttributeId,'"\n                                                cat-field-id= ').concat(o.CATFieldId," display-order= ").concat(o.DisplayOrder,"\n                                                ").concat(nt," required-msg= '").concat(p,"'\n                                                is-cascading-enabled= ").concat(o.IsCascadingEnabled," is-dependenton-id = ").concat(o.IsDependentOnId,"\n                                                account-number = ").concat(o.AccountNumber,"\n                                                comma-seperated-ccount-number = ").concat(o.PaymentSettingId,"\n                                                regex-pattern = '").concat(g,"' regex-msg = '").concat(d,"'\n                                                is-validated= ").concat(o.IsValidated," is-editable= ").concat(o.IsEditable," val-msg= '").concat(k,"' is-visible = '").concat(o.IsVisible,"'\n                                                is-show-on-registration = ").concat(o.IsShowOnRegistration,"\n                                                data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'\n                                                is-show-on-checkout = ").concat(o.IsShowOnCheckout,"\n                                                is-show-at-siteEntry = ").concat(o.IsShowAtSiteEntry,"\n                                                payment-external-id = ").concat(o.PaymentExternalId,"\n                                                help-description= '").concat(s,"'  ").concat(h," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,"\n                                                ").concat(rt,' data-test-selector="divDataCaptureInput"\n                                                data-test-attr="dataCapture" />'),r=o.IsCascadingEnabled?'<div class="form-group-split">\n                                                <div class="datacapture_field">\n                                                    <label class=\'control-label '.concat(y,"' required=").concat(o.IsRequired,"\n                                                    cat-field-id=").concat(o.CATFieldId," data-test-selector='lblDataCaptureLabel'\n                                                    is-cascading-enabled= ").concat(o.IsCascadingEnabled," is-dependenton-id = ").concat(o.IsDependentOnId,"\n                                                    account-number = ").concat(o.AccountNumber," is-show-on-registration = ").concat(o.IsShowOnRegistration,"\n                                                    is-show-on-checkout = ").concat(o.IsShowOnCheckout,"\n                                                    is-show-at-siteEntry = ").concat(o.IsShowAtSiteEntry,"\n                                                    payment-external-id = ").concat(o.PaymentExternalId," data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'\n                                                    comma-seperated-ccount-number = ").concat(o.PaymentSettingId," is-visible = ").concat(o.IsVisible,">").concat(o.Label,"  <\/label>\n                                                        ").concat(b,'\n                                                <\/div>\n                                                <div class="datacapture_btn" >\n                                                    <label class="control-label"> Employee ID <\/label>\n                                                    <button type="button" class="nopadding btn-primary" onclick=\'DataCapture.prototype.GetChildDataCaptureValueLocales("').concat(o.CATFieldId,'","').concat(o.SPPDataCapturePortalAttributeId,"\")'>\n                                                        <p>").concat(ZnodeBase.prototype.getResourceByKeyName("DataCaptureValidationButtonText"),"<\/p>\n                                                    <\/button>\n                                                 <\/div>\n                                          <\/div>\n                                            <span cat-field-id= ").concat(o.CATFieldId," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,' data-test-selector="spnDataCaptureField"><\/span>\n                                           <div id="Help-Description">').concat(s,"<\/div>"):"<div ".concat(it,">\n                                                <label class='control-label ").concat(y,"'\n                                                required=").concat(o.IsRequired," cat-field-id=").concat(o.CATFieldId,"\n                                                data-test-selector='lblDataCaptureLabel'\n                                                is-cascading-enabled= ").concat(o.IsCascadingEnabled," is-dependenton-id = ").concat(o.IsDependentOnId,"\n                                                account-number = ").concat(o.AccountNumber," data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'\n                                                comma-seperated-ccount-number = ").concat(o.PaymentSettingId,">").concat(o.Label,'<\/label>\n                                            <\/div>\n                                    <div class="control-md dataCapture"  ').concat(it,'>\n                                        <div class="left-inner-icon">\n                                            <div> ').concat(b," <\/div>\n                                            <span cat-field-id= ").concat(o.CATFieldId," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,' data-test-selector="spnDataCaptureField"><\/span>\n                                            <div id="Help-Description">').concat(s,"<\/div>\n                                        <\/div>\n                                     <\/div>"));i=="category"&&(f=f==""?o.Display:f+" & "+o.Display,$("#category-validation").html(ZnodeBase.prototype.getResourceByKeyName("CategoryDCValidationLabel1")+" <b>"+f+"<\/b> "+ZnodeBase.prototype.getResourceByKeyName("CategoryDCValidationLabel2")),r="<div>\n                                            <label class='control-label ".concat(y,"' required=").concat(o.IsRequired," cat-field-id=").concat(o.CATFieldId," data-test-selector='lblDataCaptureLabel'>").concat(o.Display,'<\/label>\n                                          <\/div>\n                                    <div class="control-md dataCapture">\n                                        <div class="left-inner-icon">\n                                          <div>\n                                            <input type="text" id="textDataCapture_').concat(o.SPPDataCapturePortalAttributeId,'"\n                                                cat-field-id= ').concat(o.CATFieldId," display-order= ").concat(o.DisplayOrder,"  ").concat(nt,'\n                                                required="true" required-msg= \'').concat(p,"' regex-pattern = '").concat(g,"'\n                                                is-cascading-enabled= ").concat(o.IsCascadingEnabled," account-number = ").concat(o.AccountNumber,"\n                                                comma-seperated-ccount-number = ").concat(o.PaymentSettingId,"\n                                                regex-msg = '").concat(d,"' is-validated= ").concat(o.IsValidated," is-editable= ").concat(o.IsEditable,"\n                                                val-msg= '").concat(k,"' help-description= '").concat(s,"'\n                                                /*data-use-gift-tool-api='").concat(o.UseGiftToolApi,"'*/\n                                                spp-datacapture-portal-id = ").concat(o.SPPDataCapturePortalAttributeId,"\n                                                is-dependenton-id = ").concat(o.IsDependentOnId,"\n                                                is-show-on-registration = ").concat(o.ShowOnRegistration,"\n                                                is-show-on-checkout = ").concat(o.ShowOnCheckout,"\n                                                /*is-show-at-siteEntry = ").concat(o.IsShowAtSiteEntry,"*/\n                                                payment-external-id = ").concat(o.PaymentExternalId,'\n                                                data-test-attr="dataCapture"\n                                                onblur=\'return DataCapture.prototype.DataCaptureValidation("').concat(o.CATFieldId,'","').concat(o.SPPDataCapturePortalAttributeId,"\")'/>\n                                         <\/div>\n                                            <span cat-field-id= ").concat(o.CATFieldId," spp-datacapture-portal-id= ").concat(o.SPPDataCapturePortalAttributeId,' data-test-selector="spnDataCaptureField"><\/span>\n                                            <div id="Help-Description">').concat(s,"<\/div>\n                                        <\/div>\n                                     <\/div>"));u=u+r;r=""});$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content").html(u):$("#data-capture-content").html(u)},t.prototype.validateMultipleAccountsDataCaptures=function(n,t){var v=this,r=!0,h,u,s,a,o;for(u=$("#ajaxRegisterForm #data-capture-content").length>0?$("#ajaxRegisterForm #data-capture-content"):$("#data-capture-content"),h=typeof n=="string"&&typeof t=="string"?u.find("input[cat-field-id='".concat(n,"'],select[cat-field-id='").concat(n,"']")):u.find("input[cat-field-id],select[cat-field-id]"),s=0;s<h.length;s++){var i=h[s],y=i.getAttribute("cat-field-id"),p=i.getAttribute("spp-datacapture-portal-id"),c=i.getAttribute("required"),w=i.getAttribute("required-msg"),f=i.getAttribute("regex-pattern"),b=i.getAttribute("regex-msg"),l=u.find("span[cat-field-id='".concat(y,"'][spp-datacapture-portal-id='").concat(p,"']")),e=i.value;c!=undefined&&c!=null&&c.toLowerCase()=="true"&&e.length<1?(this.showErrorMessage(i,l,w),r=!1):e!=null&&e!=""&&e!=undefined&&f!=null&&f!=undefined&&f!="undefined"&&f.length>0&&(a=new RegExp(f),a.test(e)||(this.showErrorMessage(i,l,b),r=!1));r&&(l.html(""),i.classList.remove("input-validation-error"))}return r&&typeof n=="boolean"&&n&&(o=this.getDataCapture(function(n){return n.IsValidated=="true"&&n.Value!=""}),o!=undefined&&o!=null&&o.length>2&&CustomEndpoint.prototype.ValidateMultipleAccountsDataCaptures(o,function(n){n.forEach(function(n){var f=u.find("span[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']")),t=u.find("input[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']"))[0],i;n.HasValidationError&&n.Value!=""?(i="",i=n.ValidationErrorMessage?n.ValidationErrorMessage:t.getAttribute("val-msg"),v.showErrorMessage(t,f,i),r=!1):t.classList.remove("input-validation-error")})})),r},t.prototype.GetChildDataCaptureValueLocales=function(n,i){var v=this,h,e,o,u,r,c,l,a,f,s;$("#QuoteId").val()>0&&(h=$("#hdnARDataCaptureValues").val(),dataCaptureResponse=JSON.parse(h));e=$("#textDataCapture_".concat(i)).attr("type");o=t.prototype.validateMultipleAccountsDataCaptures(n,i);e=="text"&&$("#textDataCapture_".concat(i)).attr("is-validated")=="true"&&(u=this.getDataCapture(function(n){return n.IsValidated=="true"&&n.Value!=""&&n.SPPDataCapturePortalAttributeId==i}),u!=undefined&&u!=null&&u.length>2&&CustomEndpoint.prototype.ValidateMultipleAccountsDataCaptures(u,function(n){n.forEach(function(n){var r=$("#data-capture-content").find("span[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']")),t=$("#data-capture-content").find("input[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']"))[0],i;n.HasValidationError&&n.Value!=""?(i="",i=n.ValidationErrorMessage?n.ValidationErrorMessage:t.getAttribute("val-msg"),v.showErrorMessage(t,r,i),o=!1):t.classList.remove("input-validation-error")})}));r=dataCaptureResponse.find(function(n){return n.IsDependentOnId==i});o?(c=$("#dataCaptureField_".concat(i," option:selected")).attr("spp-datacapture-defaultvalue-id"),r!=undefined&&r!=null&&(l=r.Options.filter(function(n){return n.ParentSPPDataCaptureAttributeDefaultValueId==c}),e!="text"&&(a=$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId," option:selected")).val(),f=$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId)).prop("required")==!0?"<option value=''><\/option>":"<option value=' '><\/option>",$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId)).empty(),l.forEach(function(n){var t=a==n.Value?"selected = 'selected'":"";f=f+"<option spp-datacapture-defaultvalue-localeid ='".concat(n.SPPDataCaptureAttributeDefaultValueId,"' value='").concat(n.Value,"' linc-value='").concat(n.LINCValue,"' ").concat(t,">").concat(n.Text,"<\/option>")}),$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId)).append(f)),$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId)).attr("disabled",!1))):(s=i,dataCaptureResponse.forEach(function(){var n=dataCaptureResponse.find(function(n){return n.IsDependentOnId==s});$("#dataCaptureField_".concat(r.SPPDataCapturePortalAttributeId)).prop("selectedIndex",0);$("#dataCaptureField_".concat(n.SPPDataCapturePortalAttributeId)).attr("disabled",!0);s=n.SPPDataCapturePortalAttributeId}))},t.prototype.DataCaptureValidation=function(n,i){var f=this,e=$("#textDataCapture_".concat(i)).attr("type"),u=t.prototype.validateMultipleAccountsDataCaptures(n,i),r;return e=="text"&&$("#textDataCapture_".concat(i)).attr("is-validated")=="true"&&(r=this.getDataCapture(function(n){return n.IsValidated=="true"&&n.Value!=""&&n.SPPDataCapturePortalAttributeId==i}),r!=undefined&&r!=null&&r.length>2&&CustomEndpoint.prototype.ValidateMultipleAccountsDataCaptures(r,function(n){n.forEach(function(n){var r=$("#data-capture-content").find("span[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']")),t=$("#data-capture-content").find("input[cat-field-id='".concat(n.CATFieldId,"'][spp-datacapture-portal-id='").concat(n.SPPDataCapturePortalAttributeId,"']"))[0],i;n.HasValidationError||(t.classList.remove("input-validation-error"),f.showSuccessMessage(t,r,"SUCCESSFUL."),u=!0,setTimeout(function(){var n=window.location.href+"?isDataCaptureValidate=true";location.href=n},500));n.HasValidationError&&n.Value!=""&&(i="",i=n.ValidationErrorMessage?n.ValidationErrorMessage:t.getAttribute("val-msg"),f.showErrorMessage(t,r,i),u=!1)})})),u},t}(ZnodeBase),dateFormat=function(){var t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,n=function(n,t){for(n=String(n),t=t||2;n.length<t;)n="0"+n;return n};return function(u,f,e){var h=dateFormat;if(arguments.length!=1||Object.prototype.toString.call(u)!="[object String]"||/\d/.test(u)||(f=u,u=undefined),u=u?new Date(u):new Date,isNaN(u))throw SyntaxError("invalid date");f=String(h.masks[f]||f||h.masks["default"]);f.slice(0,4)=="UTC:"&&(f=f.slice(4),e=!0);var o=e?"getUTC":"get",c=u[o+"Date"](),y=u[o+"Day"](),l=u[o+"Month"](),p=u[o+"FullYear"](),s=u[o+"Hours"](),w=u[o+"Minutes"](),b=u[o+"Seconds"](),a=u[o+"Milliseconds"](),v=e?0:u.getTimezoneOffset(),k={d:c,dd:n(c),ddd:h.i18n.dayNames[y],dddd:h.i18n.dayNames[y+7],m:l+1,mm:n(l+1),mmm:h.i18n.monthNames[l],mmmm:h.i18n.monthNames[l+12],yy:String(p).slice(2),yyyy:p,h:s%12||12,hh:n(s%12||12),H:s,HH:n(s),M:w,MM:n(w),s:b,ss:n(b),l:n(a,3),L:n(a>99?Math.round(a/10):a),t:s<12?"a":"p",tt:s<12?"am":"pm",T:s<12?"A":"P",TT:s<12?"AM":"PM",Z:e?"UTC":(String(u).match(i)||[""]).pop().replace(r,""),o:(v>0?"-":"+")+n(Math.floor(Math.abs(v)/60)*100+Math.abs(v)%60,4),S:["th","st","nd","rd"][c%10>3?0:(c%100-c%10!=10)*c%10]};return f.replace(t,function(n){return n in k?k[n]:n.slice(1,n.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(n,t){return dateFormat(this,n,t)},function(){(function(n){var r=this||eval("this"),t=r.document,f=r.navigator,i=r.jQuery,u=r.JSON;(function(n){"function"==typeof define&&define.amd?define(["exports","require"],n):"object"==typeof exports&&"object"==typeof module?n(module.exports||exports):n(r.ko={})})(function(e,o){function b(n,t){return null===n||typeof n in nt?n===t:!1}function tt(t,i){var r;return function(){r||(r=s.a.setTimeout(function(){r=n;t()},i))}}function it(n,t){var i;return function(){clearTimeout(i);i=s.a.setTimeout(n,t)}}function rt(n,t){t&&t!==v?"beforeChange"===t?this.Ob(n):this.Ja(n,t):this.Pb(n)}function ut(n,t){null!==t&&t.k&&t.k()}function ft(n,t){var i=this.Mc,r=i[h];r.T||(this.ob&&this.Oa[t]?(i.Sb(t,n,this.Oa[t]),this.Oa[t]=null,--this.ob):r.s[t]||i.Sb(t,n,r.t?{$:n}:i.yc(n)),n.Ha&&n.Hc())}function k(n,t,i,r){s.d[n]={init:function(n,u,f,e,o){var c,h;return s.m(function(){var l=u(),f=s.a.c(l),f=!i!=!f,e=!h;(e||t||f!==c)&&(e&&s.xa.Ca()&&(h=s.a.wa(s.f.childNodes(n),!0)),f?(e||s.f.fa(n,s.a.wa(h)),s.hb(r?r(o,l):o,n)):s.f.za(n),c=f)},null,{i:n}),{controlsDescendantBindings:!0}}};s.h.va[n]=!1;s.f.aa[n]=!0}var s="undefined"!=typeof e?e:{},nt,v,l,y,a,p,h,d,g,w;s.b=function(n,t){for(var i=n.split("."),r=s,u=0;u<i.length-1;u++)r=r[i[u]];r[i[i.length-1]]=t};s.H=function(n,t,i){n[t]=i};s.version="";s.b("version",s.version);s.options={deferUpdates:!1,useOnlyNativeEvents:!1};s.a=function(){function o(n,t){for(var i in n)n.hasOwnProperty(i)&&t(i,n[i])}function l(n,t){if(t)for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}function a(n,t){return n.__proto__=t,n}function v(n,t,i,r){var u=n[t].match(c)||[];s.a.r(i.match(c),function(n){s.a.ra(u,n,r)});n[t]=u.join(" ")}var y={__proto__:[]}instanceof Array,w="function"==typeof Symbol,h={},p={};h[f&&/Firefox\/2/i.test(f.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];h.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");o(h,function(n,t){if(t.length)for(var i=0,r=t.length;i<r;i++)p[t[i]]=n});var b={propertychange:!0},e=t&&function(){for(var i=3,r=t.createElement("div"),u=r.getElementsByTagName("i");r.innerHTML="<!--[if gt IE "+ ++i+"]><i><\/i><![endif]-->",u[0];);return 4<i?i:n}(),c=/\S+/g;return{gc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],r:function(n,t){for(var i=0,r=n.length;i<r;i++)t(n[i],i)},o:function(n,t){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(n,t);for(var i=0,r=n.length;i<r;i++)if(n[i]===t)return i;return-1},Vb:function(n,t,i){for(var r=0,u=n.length;r<u;r++)if(t.call(i,n[r],r))return n[r];return null},Na:function(n,t){var i=s.a.o(n,t);0<i?n.splice(i,1):0===i&&n.shift()},Wb:function(n){n=n||[];for(var i=[],t=0,r=n.length;t<r;t++)0>s.a.o(i,n[t])&&i.push(n[t]);return i},ib:function(n,t){n=n||[];for(var r=[],i=0,u=n.length;i<u;i++)r.push(t(n[i],i));return r},Ma:function(n,t){n=n||[];for(var r=[],i=0,u=n.length;i<u;i++)t(n[i],i)&&r.push(n[i]);return r},ta:function(n,t){if(t instanceof Array)n.push.apply(n,t);else for(var i=0,r=t.length;i<r;i++)n.push(t[i]);return n},ra:function(n,t,i){var r=s.a.o(s.a.Bb(n),t);0>r?i&&n.push(t):i||n.splice(r,1)},la:y,extend:l,$a:a,ab:y?a:l,D:o,Ea:function(n,t){if(!n)return n;var r={},i;for(i in n)n.hasOwnProperty(i)&&(r[i]=t(n[i],i,n));return r},rb:function(n){for(;n.firstChild;)s.removeNode(n.firstChild)},nc:function(n){n=s.a.W(n);for(var r=(n[0]&&n[0].ownerDocument||t).createElement("div"),i=0,u=n.length;i<u;i++)r.appendChild(s.ba(n[i]));return r},wa:function(n,t){for(var r,i=0,f=n.length,u=[];i<f;i++)r=n[i].cloneNode(!0),u.push(t?s.ba(r):r);return u},fa:function(n,t){if(s.a.rb(n),t)for(var i=0,r=t.length;i<r;i++)n.appendChild(t[i])},uc:function(n,t){var r=n.nodeType?[n]:n;if(0<r.length){for(var f=r[0],e=f.parentNode,i=0,u=t.length;i<u;i++)e.insertBefore(t[i],f);for(i=0,u=r.length;i<u;i++)s.removeNode(r[i])}},Ba:function(n,t){if(n.length){for(t=8===t.nodeType&&t.parentNode||t;n.length&&n[0].parentNode!==t;)n.splice(0,1);for(;1<n.length&&n[n.length-1].parentNode!==t;)n.length--;if(1<n.length){var i=n[0],r=n[n.length-1];for(n.length=0;i!==r;)n.push(i),i=i.nextSibling;n.push(r)}}return n},wc:function(n,t){7>e?n.setAttribute("selected",t):n.selected=t},cb:function(t){return null===t||t===n?"":t.trim?t.trim():t.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},sd:function(n,t){return n=n||"",t.length>n.length?!1:n.substring(0,t.length)===t},Rc:function(n,t){if(n===t)return!0;if(11===n.nodeType)return!1;if(t.contains)return t.contains(3===n.nodeType?n.parentNode:n);if(t.compareDocumentPosition)return 16==(t.compareDocumentPosition(n)&16);for(;n&&n!=t;)n=n.parentNode;return!!n},qb:function(n){return s.a.Rc(n,n.ownerDocument.documentElement)},Tb:function(n){return!!s.a.Vb(n,s.a.qb)},A:function(n){return n&&n.tagName&&n.tagName.toLowerCase()},Zb:function(n){return s.onError?function(){try{return n.apply(this,arguments)}catch(t){throw s.onError&&s.onError(t),t;}}:n},setTimeout:function(n,t){return setTimeout(s.a.Zb(n),t)},dc:function(n){setTimeout(function(){s.onError&&s.onError(n);throw n;},0)},q:function(n,t,r){var u=s.a.Zb(r),f,o;if(r=e&&b[t],s.options.useOnlyNativeEvents||r||!i)if(r||"function"!=typeof n.addEventListener)if("undefined"!=typeof n.attachEvent)f=function(t){u.call(n,t)},o="on"+t,n.attachEvent(o,f),s.a.G.qa(n,function(){n.detachEvent(o,f)});else throw Error("Browser doesn't support addEventListener or attachEvent");else n.addEventListener(t,u,!1);else i(n).bind(t,u)},Fa:function(n,u){if(!n||!n.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var f;if("input"===s.a.A(n)&&n.type&&"click"==u.toLowerCase()?(f=n.type,f="checkbox"==f||"radio"==f):f=!1,s.options.useOnlyNativeEvents||!i||f)if("function"==typeof t.createEvent)if("function"==typeof n.dispatchEvent)f=t.createEvent(p[u]||"HTMLEvents"),f.initEvent(u,!0,!0,r,0,0,0,0,0,!1,!1,!1,!1,0,n),n.dispatchEvent(f);else throw Error("The supplied element doesn't support dispatchEvent");else if(f&&n.click)n.click();else if("undefined"!=typeof n.fireEvent)n.fireEvent("on"+u);else throw Error("Browser doesn't support triggering events");else i(n).trigger(u)},c:function(n){return s.I(n)?n():n},Bb:function(n){return s.I(n)?n.p():n},fb:function(n,t,i){var r;t&&("object"==typeof n.classList?(r=n.classList[i?"add":"remove"],s.a.r(t.match(c),function(t){r.call(n.classList,t)})):"string"==typeof n.className.baseVal?v(n.className,"baseVal",t,i):v(n,"className",t,i))},bb:function(t,i){var r=s.a.c(i),u;(null===r||r===n)&&(r="");u=s.f.firstChild(t);!u||3!=u.nodeType||s.f.nextSibling(u)?s.f.fa(t,[t.ownerDocument.createTextNode(r)]):u.data=r;s.a.Wc(t)},vc:function(n,i){if(n.name=i,7>=e)try{n.mergeAttributes(t.createElement("<input name='"+n.name+"'/>"),!1)}catch(r){}},Wc:function(n){9<=e&&(n=1==n.nodeType?n:n.parentNode,n.style&&(n.style.zoom=n.style.zoom))},Sc:function(n){if(e){var t=n.style.width;n.style.width=0;n.style.width=t}},nd:function(n,t){n=s.a.c(n);t=s.a.c(t);for(var r=[],i=n;i<=t;i++)r.push(i);return r},W:function(n){for(var i=[],t=0,r=n.length;t<r;t++)i.push(n[t]);return i},bc:function(n){return w?Symbol(n):n},xd:6===e,yd:7===e,C:e,ic:function(n,t){for(var r=s.a.W(n.getElementsByTagName("input")).concat(s.a.W(n.getElementsByTagName("textarea"))),f="string"==typeof t?function(n){return n.name===t}:function(n){return t.test(n.name)},u=[],i=r.length-1;0<=i;i--)f(r[i])&&u.push(r[i]);return u},kd:function(n){return"string"==typeof n&&(n=s.a.cb(n))?u&&u.parse?u.parse(n):new Function("return "+n)():null},Gb:function(n,t,i){if(!u||!u.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return u.stringify(s.a.c(n),t,i)},ld:function(n,i,r){var c,e,h,f,u,l;r=r||{};var a=r.params||{},v=r.includeFields||this.gc,c=n;if("object"==typeof n&&"form"===s.a.A(n))for(c=n.action,e=v.length-1;0<=e;e--)for(h=s.a.ic(n,v[e]),f=h.length-1;0<=f;f--)a[h[f].name]=h[f].value;i=s.a.c(i);u=t.createElement("form");u.style.display="none";u.action=c;u.method="post";for(l in i)n=t.createElement("input"),n.type="hidden",n.name=l,n.value=s.a.Gb(s.a.c(i[l])),u.appendChild(n);o(a,function(n,i){var r=t.createElement("input");r.type="hidden";r.name=n;r.value=i;u.appendChild(r)});t.body.appendChild(u);r.submitter?r.submitter(u):u.submit();setTimeout(function(){u.parentNode.removeChild(u)},0)}}}();s.b("utils",s.a);s.b("utils.arrayForEach",s.a.r);s.b("utils.arrayFirst",s.a.Vb);s.b("utils.arrayFilter",s.a.Ma);s.b("utils.arrayGetDistinctValues",s.a.Wb);s.b("utils.arrayIndexOf",s.a.o);s.b("utils.arrayMap",s.a.ib);s.b("utils.arrayPushAll",s.a.ta);s.b("utils.arrayRemoveItem",s.a.Na);s.b("utils.extend",s.a.extend);s.b("utils.fieldsIncludedWithJsonPost",s.a.gc);s.b("utils.getFormFields",s.a.ic);s.b("utils.peekObservable",s.a.Bb);s.b("utils.postJson",s.a.ld);s.b("utils.parseJson",s.a.kd);s.b("utils.registerEventHandler",s.a.q);s.b("utils.stringifyJson",s.a.Gb);s.b("utils.range",s.a.nd);s.b("utils.toggleDomNodeCssClass",s.a.fb);s.b("utils.triggerEvent",s.a.Fa);s.b("utils.unwrapObservable",s.a.c);s.b("utils.objectForEach",s.a.D);s.b("utils.addOrRemoveItem",s.a.ra);s.b("utils.setTextContent",s.a.bb);s.b("unwrap",s.a.c);Function.prototype.bind||(Function.prototype.bind=function(n){var t=this,i;return 1===arguments.length?function(){return t.apply(n,arguments)}:(i=Array.prototype.slice.call(arguments,1),function(){var r=i.slice(0);return r.push.apply(r,arguments),t.apply(n,r)})});s.a.e=new function(){function r(r,f){var e=r[t];if(!e||"null"===e||!i[e]){if(!f)return n;e=r[t]="ko"+u++;i[e]={}}return i[e]}var u=0,t="__ko__"+(new Date).getTime(),i={};return{get:function(t,i){var u=r(t,!1);return u===n?n:u[i]},set:function(t,i,u){(u!==n||r(t,!1)!==n)&&(r(t,!0)[i]=u)},clear:function(n){var r=n[t];return r?(delete i[r],n[t]=null,!0):!1},J:function(){return u+++t}}};s.b("utils.domData",s.a.e);s.b("utils.domData.clear",s.a.e.clear);s.a.G=new function(){function t(t,i){var r=s.a.e.get(t,u);return r===n&&i&&(r=[],s.a.e.set(t,u,r)),r}function r(n){var i=t(n,!1),u;if(i)for(i=i.slice(0),u=0;u<i.length;u++)i[u](n);if(s.a.e.clear(n),s.a.G.cleanExternalData(n),f[n.nodeType])for(i=n.firstChild;n=i;)i=n.nextSibling,8===n.nodeType&&r(n)}var u=s.a.e.J(),e={1:!0,8:!0,9:!0},f={1:!0,9:!0};return{qa:function(n,i){if("function"!=typeof i)throw Error("Callback must be a function");t(n,!0).push(i)},tc:function(i,r){var f=t(i,!1);f&&(s.a.Na(f,r),0==f.length&&s.a.e.set(i,u,n))},ba:function(n){var t,i,u;if(e[n.nodeType]&&(r(n),f[n.nodeType]))for(t=[],s.a.ta(t,n.getElementsByTagName("*")),i=0,u=t.length;i<u;i++)r(t[i]);return n},removeNode:function(n){s.ba(n);n.parentNode&&n.parentNode.removeChild(n)},cleanExternalData:function(n){i&&"function"==typeof i.cleanData&&i.cleanData([n])}}};s.ba=s.a.G.ba;s.removeNode=s.a.G.removeNode;s.b("cleanNode",s.ba);s.b("removeNode",s.removeNode);s.b("utils.domNodeDisposal",s.a.G);s.b("utils.domNodeDisposal.addDisposeCallback",s.a.G.qa);s.b("utils.domNodeDisposal.removeDisposeCallback",s.a.G.tc),function(){var h=[0,"",""],u=[1,"<table>","<\/table>"],f=[3,"<table><tbody><tr>","<\/tr><\/tbody><\/table>"],e=[1,"<select multiple='multiple'>","<\/select>"],c={thead:u,tbody:u,tfoot:u,tr:[2,"<table><tbody>","<\/tbody><\/table>"],td:f,th:f,option:e,optgroup:e},o=8>=s.a.C;s.a.na=function(n,u){var f,e;if(i){if(i.parseHTML)f=i.parseHTML(n,u)||[];else if((f=i.clean([n],u))&&f[0]){for(e=f[0];e.parentNode&&11!==e.parentNode.nodeType;)e=e.parentNode;e.parentNode&&e.parentNode.removeChild(e)}}else{(f=u)||(f=t);var e=f.parentWindow||f.defaultView||r,v=s.a.cb(n).toLowerCase(),l=f.createElement("div"),a;for(a=(v=v.match(/^<([a-z]+)[ >]/))&&c[v[1]]||h,v=a[0],a="ignored<div>"+a[1]+n+a[2]+"<\/div>","function"==typeof e.innerShiv?l.appendChild(e.innerShiv(a)):(o&&f.appendChild(l),l.innerHTML=a,o&&l.parentNode.removeChild(l));v--;)l=l.lastChild;f=s.a.W(l.lastChild.childNodes)}return f};s.a.Eb=function(t,r){if(s.a.rb(t),r=s.a.c(r),null!==r&&r!==n)if("string"!=typeof r&&(r=r.toString()),i)i(t).html(r);else for(var f=s.a.na(r,t.ownerDocument),u=0;u<f.length;u++)t.appendChild(f[u])}}();s.b("utils.parseHtmlFragment",s.a.na);s.b("utils.setHtml",s.a.Eb);s.N=function(){function i(n,t){var r;if(n)if(8==n.nodeType)r=s.N.pc(n.nodeValue),null!=r&&t.push({Qc:n,hd:r});else if(1==n.nodeType)for(var r=0,u=n.childNodes,f=u.length;r<f;r++)i(u[r],t)}var t={};return{yb:function(n){if("function"!=typeof n)throw Error("You can only pass a function to ko.memoization.memoize()");var i=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return t[i]=n,"<!--[ko_memo:"+i+"]-->"},Bc:function(i,r){var u=t[i];if(u===n)throw Error("Couldn't find any memo with ID "+i+". Perhaps it's already been unmemoized.");try{return u.apply(null,r||[]),!0}finally{delete t[i]}},Cc:function(n,t){var f=[],u,o,r,e;for(i(n,f),u=0,o=f.length;u<o;u++)r=f[u].Qc,e=[r],t&&s.a.ta(e,t),s.N.Bc(f[u].hd,e),r.nodeValue="",r.parentNode&&r.parentNode.removeChild(r)},pc:function(n){return(n=n.match(/^\[ko_memo\:(.*?)\]$/))?n[1]:null}}}();s.b("memoization",s.N);s.b("memoization.memoize",s.N.yb);s.b("memoization.unmemoize",s.N.Bc);s.b("memoization.parseMemoText",s.N.pc);s.b("memoization.unmemoizeDomNodeAndDescendants",s.N.Cc);s.Z=function(){function f(){if(n)for(var t=n,r=0,f;i<n;)if(f=u[i++]){if(i>t){if(5e3<=++r){i=n;s.a.dc(Error("'Too much recursion' after processing "+r+" task groups."));break}t=n}try{f()}catch(e){s.a.dc(e)}}}function e(){f();i=n=u.length=0}var u=[],n=0,o=1,i=0;return{scheduler:r.MutationObserver?function(n){var i=t.createElement("div");return new MutationObserver(n).observe(i,{attributes:!0}),function(){i.classList.toggle("foo")}}(e):t&&"onreadystatechange"in t.createElement("script")?function(n){var i=t.createElement("script");i.onreadystatechange=function(){i.onreadystatechange=null;t.documentElement.removeChild(i);i=null;n()};t.documentElement.appendChild(i)}:function(n){setTimeout(n,0)},Za:function(t){return n||s.Z.scheduler(e),u[n++]=t,o++},cancel:function(t){t-=o-n;t>=i&&t<n&&(u[t]=null)},resetForTesting:function(){var t=n-i;return i=n=u.length=0,t},rd:f}}();s.b("tasks",s.Z);s.b("tasks.schedule",s.Z.Za);s.b("tasks.runEarly",s.Z.rd);s.Aa={throttle:function(n,t){n.throttleEvaluation=t;var i=null;return s.B({read:n,write:function(r){clearTimeout(i);i=s.a.setTimeout(function(){n(r)},t)}})},rateLimit:function(n,t){var i,r,u;"number"==typeof t?i=t:(i=t.timeout,r=t.method);n.gb=!1;u="notifyWhenChangesStop"==r?it:tt;n.Wa(function(n){return u(n,i)})},deferred:function(t,i){if(!0!==i)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");t.gb||(t.gb=!0,t.Wa(function(i){var u,r=!1;return function(){if(!r){s.Z.cancel(u);u=s.Z.Za(i);try{r=!0;t.notifySubscribers(n,"dirty")}finally{r=!1}}}}))},notify:function(n,t){n.equalityComparer="always"==t?null:b}};nt={undefined:1,boolean:1,number:1,string:1};s.b("extenders",s.Aa);s.zc=function(n,t,i){this.$=n;this.jb=t;this.Pc=i;this.T=!1;s.H(this,"dispose",this.k)};s.zc.prototype.k=function(){this.T=!0;this.Pc()};s.K=function(){s.a.ab(this,l);l.ub(this)};v="change";l={ub:function(n){n.F={change:[]};n.Qb=1},Y:function(n,t,i){var r=this,u;return i=i||v,u=new s.zc(r,t?n.bind(t):n,function(){s.a.Na(r.F[i],u);r.Ka&&r.Ka(i)}),r.ua&&r.ua(i),r.F[i]||(r.F[i]=[]),r.F[i].push(u),u},notifySubscribers:function(n,t){var u,i,r;if(t=t||v,t===v&&this.Kb(),this.Ra(t)){u=t===v&&this.Fc||this.F[t].slice(0);try{for(s.l.Xb(),i=0;r=u[i];++i)r.T||r.jb(n)}finally{s.l.end()}}},Pa:function(){return this.Qb},Zc:function(n){return this.Pa()!==n},Kb:function(){++this.Qb},Wa:function(n){var t=this,o=s.I(t),u,f,r,i,e;t.Ja||(t.Ja=t.notifySubscribers,t.notifySubscribers=rt);e=n(function(){t.Ha=!1;o&&i===t&&(i=t.Mb?t.Mb():t());var n=f||t.Ua(r,i);f=u=!1;n&&t.Ja(r=i)});t.Pb=function(n){t.Fc=t.F[v].slice(0);t.Ha=u=!0;i=n;e()};t.Ob=function(n){u||(r=n,t.Ja(n,"beforeChange"))};t.Hc=function(){t.Ua(r,t.p(!0))&&(f=!0)}},Ra:function(n){return this.F[n]&&this.F[n].length},Xc:function(n){if(n)return this.F[n]&&this.F[n].length||0;var t=0;return s.a.D(this.F,function(n,i){"dirty"!==n&&(t+=i.length)}),t},Ua:function(n,t){return!this.equalityComparer||!this.equalityComparer(n,t)},extend:function(n){var t=this;return n&&s.a.D(n,function(n,i){var r=s.Aa[n];"function"==typeof r&&(t=r(t,i)||t)}),t}};s.H(l,"subscribe",l.Y);s.H(l,"extend",l.extend);s.H(l,"getSubscriptionsCount",l.Xc);s.a.la&&s.a.$a(l,Function.prototype);s.K.fn=l;s.lc=function(n){return null!=n&&"function"==typeof n.Y&&"function"==typeof n.notifySubscribers};s.b("subscribable",s.K);s.b("isSubscribable",s.lc);s.xa=s.l=function(){function t(t){r.push(n);n=t}function i(){n=r.pop()}var r=[],n,u=0;return{Xb:t,end:i,sc:function(t){if(n){if(!s.lc(t))throw Error("Only subscribable things can act as dependencies");n.jb.call(n.Lc,t,t.Gc||(t.Gc=++u))}},w:function(n,r,u){try{return t(),n.apply(r,u||[])}finally{i()}},Ca:function(){if(n)return n.m.Ca()},Va:function(){if(n)return n.Va}}}();s.b("computedContext",s.xa);s.b("computedContext.getDependenciesCount",s.xa.Ca);s.b("computedContext.isInitial",s.xa.Va);s.b("ignoreDependencies",s.wd=s.l.w);y=s.a.bc("_latestValue");s.O=function(n){function t(){return 0<arguments.length?(t.Ua(t[y],arguments[0])&&(t.ia(),t[y]=arguments[0],t.ha()),this):(s.l.sc(t),t[y])}return t[y]=n,s.a.la||s.a.extend(t,s.K.fn),s.K.fn.ub(t),s.a.ab(t,a),s.options.deferUpdates&&s.Aa.deferred(t,!0),t};a={equalityComparer:b,p:function(){return this[y]},ha:function(){this.notifySubscribers(this[y])},ia:function(){this.notifySubscribers(this[y],"beforeChange")}};s.a.la&&s.a.$a(a,s.K.fn);p=s.O.md="__ko_proto__";a[p]=s.O;s.Qa=function(t,i){return null===t||t===n||t[p]===n?!1:t[p]===i?!0:s.Qa(t[p],i)};s.I=function(n){return s.Qa(n,s.O)};s.Da=function(n){return"function"==typeof n&&n[p]===s.O||"function"==typeof n&&n[p]===s.B&&n.$c?!0:!1};s.b("observable",s.O);s.b("isObservable",s.I);s.b("isWriteableObservable",s.Da);s.b("isWritableObservable",s.Da);s.b("observable.fn",a);s.H(a,"peek",a.p);s.H(a,"valueHasMutated",a.ha);s.H(a,"valueWillMutate",a.ia);s.ma=function(n){if(n=n||[],"object"!=typeof n||!("length"in n))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return n=s.O(n),s.a.ab(n,s.ma.fn),n.extend({trackArrayChanges:!0})};s.ma.fn={remove:function(n){for(var u,r=this.p(),i=[],f="function"!=typeof n||s.I(n)?function(t){return t===n}:n,t=0;t<r.length;t++)u=r[t],f(u)&&(0===i.length&&this.ia(),i.push(u),r.splice(t,1),t--);return i.length&&this.ha(),i},removeAll:function(t){if(t===n){var i=this.p(),r=i.slice(0);return this.ia(),i.splice(0,i.length),this.ha(),r}return t?this.remove(function(n){return 0<=s.a.o(t,n)}):[]},destroy:function(n){var i=this.p(),r="function"!=typeof n||s.I(n)?function(t){return t===n}:n,t;for(this.ia(),t=i.length-1;0<=t;t--)r(i[t])&&(i[t]._destroy=!0);this.ha()},destroyAll:function(t){return t===n?this.destroy(function(){return!0}):t?this.destroy(function(n){return 0<=s.a.o(t,n)}):[]},indexOf:function(n){var t=this();return s.a.o(t,n)},replace:function(n,t){var i=this.indexOf(n);0<=i&&(this.ia(),this.p()[i]=t,this.ha())}};s.a.la&&s.a.$a(s.ma.fn,s.O.fn);s.a.r("pop push reverse shift sort splice unshift".split(" "),function(n){s.ma.fn[n]=function(){var t=this.p(),i;return this.ia(),this.Yb(t,n,arguments),i=t[n].apply(t,arguments),this.ha(),i===t?this:i}});s.a.r(["slice"],function(n){s.ma.fn[n]=function(){var t=this();return t[n].apply(t,arguments)}});s.b("observableArray",s.ma);s.Aa.trackArrayChanges=function(t,i){function l(){if(!f){f=!0;u=t.notifySubscribers;t.notifySubscribers=function(n,t){return t&&t!==v||++e,u.apply(this,arguments)};var n=[].concat(t.p()||[]);r=null;o=t.Y(function(i){if(i=[].concat(i||[]),t.Ra("arrayChange")){var u;(!r||1<e)&&(r=s.a.lb(n,i,t.kb));u=r}n=i;r=null;e=0;u&&u.length&&t.notifySubscribers(u,"arrayChange")})}}if(t.kb={},i&&"object"==typeof i&&s.a.extend(t.kb,i),t.kb.sparse=!0,!t.Yb){var f=!1,r=null,o,e=0,u,h=t.ua,c=t.Ka;t.ua=function(n){h&&h.call(t,n);"arrayChange"===n&&l()};t.Ka=function(i){c&&c.call(t,i);"arrayChange"!==i||t.Ra("arrayChange")||(u&&(t.notifySubscribers=u,u=n),o.k(),f=!1)};t.Yb=function(n,t,i){function c(n,t,i){return l[l.length]={status:n,value:t,index:i}}if(f&&!e){var l=[],u=n.length,h=i.length,o=0;switch(t){case"push":o=u;case"unshift":for(t=0;t<h;t++)c("added",i[t],o+t);break;case"pop":o=u-1;case"shift":u&&c("deleted",n[o],o);break;case"splice":t=Math.min(Math.max(0,0>i[0]?u+i[0]:i[0]),u);for(var u=1===h?u:Math.min(t+(i[1]||0),u),h=t+h-2,o=Math.max(u,h),a=[],v=[],y=2;t<o;++t,++y)t<u&&v.push(c("deleted",n[t],t)),t<h&&a.push(c("added",i[y],t));s.a.hc(v,a);break;default:return}r=l}}}};h=s.a.bc("_state");s.m=s.B=function(t,i,r){function u(){if(0<arguments.length){if("function"==typeof e)e.apply(f.sb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return s.l.sc(u),(f.V||f.t&&u.Sa())&&u.U(),f.M}if("object"==typeof t?r=t:(r=r||{},t&&(r.read=t)),"function"!=typeof r.read)throw Error("Pass a function that returns the value of the ko.computed");var e=r.write,f={M:n,da:!0,V:!0,Ta:!1,Hb:!1,T:!1,Ya:!1,t:!1,od:r.read,sb:i||r.owner,i:r.disposeWhenNodeIsRemoved||r.i||null,ya:r.disposeWhen||r.ya,pb:null,s:{},L:0,fc:null};return u[h]=f,u.$c="function"==typeof e,s.a.la||s.a.extend(u,s.K.fn),s.K.fn.ub(u),s.a.ab(u,c),r.pure?(f.Ya=!0,f.t=!0,s.a.extend(u,et)):r.deferEvaluation&&s.a.extend(u,ot),s.options.deferUpdates&&s.Aa.deferred(u,!0),f.i&&(f.Hb=!0,f.i.nodeType||(f.i=null)),f.t||r.deferEvaluation||u.U(),f.i&&u.ca()&&s.a.G.qa(f.i,f.pb=function(){u.k()}),u};var c={equalityComparer:b,Ca:function(){return this[h].L},Sb:function(n,t,i){if(this[h].Ya&&t===this)throw Error("A 'pure' computed must not be called recursively");this[h].s[n]=i;i.Ia=this[h].L++;i.pa=t.Pa()},Sa:function(){var t,n,i=this[h].s;for(t in i)if(i.hasOwnProperty(t)&&(n=i[t],this.oa&&n.$.Ha||n.$.Zc(n.pa)))return!0},gd:function(){this.oa&&!this[h].Ta&&this.oa(!1)},ca:function(){var n=this[h];return n.V||0<n.L},qd:function(){this.Ha?this[h].V&&(this[h].da=!0):this.ec()},yc:function(n){if(n.gb&&!this[h].i){var t=n.Y(this.gd,this,"dirty"),i=n.Y(this.qd,this);return{$:n,k:function(){t.k();i.k()}}}return n.Y(this.ec,this)},ec:function(){var n=this,t=n.throttleEvaluation;t&&0<=t?(clearTimeout(this[h].fc),this[h].fc=s.a.setTimeout(function(){n.U(!0)},t)):n.oa?n.oa(!0):n.U(!0)},U:function(n){var t=this[h],i=t.ya,r=!1;if(!t.Ta&&!t.T){if(t.i&&!s.a.qb(t.i)||i&&i()){if(!t.Hb){this.k();return}}else t.Hb=!1;t.Ta=!0;try{r=this.Vc(n)}finally{t.Ta=!1}return t.L||this.k(),r}},Vc:function(t){var i=this[h],u=!1,f=i.Ya?n:!i.L,r={Mc:this,Oa:i.s,ob:i.L};return s.l.Xb({Lc:r,jb:ft,m:this,Va:f}),i.s={},i.L=0,r=this.Uc(i,r),this.Ua(i.M,r)&&(i.t||this.notifySubscribers(i.M,"beforeChange"),i.M=r,i.t?this.Kb():t&&this.notifySubscribers(i.M),u=!0),f&&this.notifySubscribers(i.M,"awake"),u},Uc:function(n,t){try{var i=n.od;return n.sb?i.call(n.sb):i()}finally{s.l.end();t.ob&&!n.t&&s.a.D(t.Oa,ut);n.da=n.V=!1}},p:function(n){var t=this[h];return(t.V&&(n||!t.L)||t.t&&this.Sa())&&this.U(),t.M},Wa:function(n){s.K.fn.Wa.call(this,n);this.Mb=function(){return this[h].da?this.U():this[h].V=!1,this[h].M};this.oa=function(n){this.Ob(this[h].M);this[h].V=!0;n&&(this[h].da=!0);this.Pb(this)}},k:function(){var n=this[h];!n.t&&n.s&&s.a.D(n.s,function(n,t){t.k&&t.k()});n.i&&n.pb&&s.a.G.tc(n.i,n.pb);n.s=null;n.L=0;n.T=!0;n.da=!1;n.V=!1;n.t=!1;n.i=null}},et={ua:function(n){var i=this,t=i[h],r;!t.T&&t.t&&"change"==n&&(t.t=!1,t.da||i.Sa()?(t.s=null,t.L=0,i.U()&&i.Kb()):(r=[],s.a.D(t.s,function(n,t){r[t.Ia]=n}),s.a.r(r,function(n,r){var f=t.s[n],u=i.yc(f.$);u.Ia=r;u.pa=f.pa;t.s[n]=u})),t.T||i.notifySubscribers(t.M,"awake"))},Ka:function(t){var i=this[h];i.T||"change"!=t||this.Ra("change")||(s.a.D(i.s,function(n,t){t.k&&(i.s[n]={$:t.$,Ia:t.Ia,pa:t.pa},t.k())}),i.t=!0,this.notifySubscribers(n,"asleep"))},Pa:function(){var n=this[h];return n.t&&(n.da||this.Sa())&&this.U(),s.K.fn.Pa.call(this)}},ot={ua:function(n){"change"!=n&&"beforeChange"!=n||this.p()}};s.a.la&&s.a.$a(c,s.K.fn);d=s.O.md;s.m[d]=s.O;c[d]=s.m;s.bd=function(n){return s.Qa(n,s.m)};s.cd=function(n){return s.Qa(n,s.m)&&n[h]&&n[h].Ya};s.b("computed",s.m);s.b("dependentObservable",s.m);s.b("isComputed",s.bd);s.b("isPureComputed",s.cd);s.b("computed.fn",c);s.H(c,"peek",c.p);s.H(c,"dispose",c.k);s.H(c,"isActive",c.ca);s.H(c,"getDependenciesCount",c.Ca);s.rc=function(n,t){return"function"==typeof n?s.m(n,t,{pure:!0}):(n=s.a.extend({},n),n.pure=!0,s.m(n,t))};s.b("pureComputed",s.rc),function(){function t(u,f,e){if(e=e||new i,u=f(u),"object"!=typeof u||null===u||u===n||u instanceof RegExp||u instanceof Date||u instanceof String||u instanceof Number||u instanceof Boolean)return u;var o=u instanceof Array?[]:{};return e.save(u,o),r(u,function(i){var r=f(u[i]),s;switch(typeof r){case"boolean":case"number":case"string":case"function":o[i]=r;break;case"object":case"undefined":s=e.get(r);o[i]=s!==n?s:t(r,f,e)}}),o}function r(n,t){if(n instanceof Array){for(var i=0;i<n.length;i++)t(i);"function"==typeof n.toJSON&&t("toJSON")}else for(i in n)t(i)}function i(){this.keys=[];this.Lb=[]}s.Ac=function(n){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return t(n,function(n){for(var t=0;s.I(n)&&10>t;t++)n=n();return n})};s.toJSON=function(n,t,i){return n=s.Ac(n),s.a.Gb(n,t,i)};i.prototype={save:function(n,t){var i=s.a.o(this.keys,n);0<=i?this.Lb[i]=t:(this.keys.push(n),this.Lb.push(t))},get:function(t){return t=s.a.o(this.keys,t),0<=t?this.Lb[t]:n}}}();s.b("toJS",s.Ac);s.b("toJSON",s.toJSON),function(){s.j={u:function(t){switch(s.a.A(t)){case"option":return!0===t.__ko__hasDomDataOptionValue__?s.a.e.get(t,s.d.options.zb):7>=s.a.C?t.getAttributeNode("value")&&t.getAttributeNode("value").specified?t.value:t.text:t.value;case"select":return 0<=t.selectedIndex?s.j.u(t.options[t.selectedIndex]):n;default:return t.value}},ja:function(t,i,r){switch(s.a.A(t)){case"option":switch(typeof i){case"string":s.a.e.set(t,s.d.options.zb,n);"__ko__hasDomDataOptionValue__"in t&&delete t.__ko__hasDomDataOptionValue__;t.value=i;break;default:s.a.e.set(t,s.d.options.zb,i);t.__ko__hasDomDataOptionValue__=!0;t.value="number"==typeof i?i:""}break;case"select":(""===i||null===i)&&(i=n);for(var f=-1,u=0,o=t.options.length,e;u<o;++u)if(e=s.j.u(t.options[u]),e==i||""==e&&i===n){f=u;break}(r||0<=f||i===n&&1<t.size)&&(t.selectedIndex=f);break;default:(null===i||i===n)&&(i="");t.value=i}}}}();s.b("selectExtensions",s.j);s.b("selectExtensions.readValue",s.j.u);s.b("selectExtensions.writeValue",s.j.ja);s.h=function(){function n(n){var c,u,i;n=s.a.cb(n);123===n.charCodeAt(0)&&(n=n.slice(1,-1));var a=[],h=n.match(t),o,r=[],l=0;if(h)for(h.push(","),c=0;u=h[c];++c){if(i=u.charCodeAt(0),44===i){if(0>=l){a.push(o&&r.length?{key:o,value:r.join("")}:{unknown:o||r.join("")});o=l=0;r=[];continue}}else if(58===i){if(!l&&!o&&1===r.length){o=r.pop();continue}}else 47===i&&c&&1<u.length?(i=h[c-1].match(f))&&!e[i[0]]&&(n=n.substr(n.indexOf(u)+1),h=n.match(t),h.push(","),c=-1,u="/"):40===i||123===i||91===i?++l:41===i||125===i||93===i?--l:o||r.length||34!==i&&39!==i||(u=u.slice(1,-1));r.push(u)}return a}var r=["true","false","null","undefined"],u=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,t=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,e={"in":1,"return":1,"typeof":1},i={};return{va:[],ga:i,Ab:n,Xa:function(t,f){function e(n,t){var a,f;if(!l){if(f=s.getBindingHandler(n),f&&f.preprocess&&!(t=f.preprocess(t,n,e)))return;(f=i[n])&&(a=t,0<=s.a.o(r,a)?a=!1:(f=a.match(u),a=null===f?!1:f[1]?"Object("+f[1]+")"+f[2]:a),f=a);f&&o.push("'"+n+"':function(_z){"+a+"=_z}")}c&&(t="function(){return "+t+" }");h.push("'"+n+"':"+t)}f=f||{};var h=[],o=[],c=f.valueAccessors,l=f.bindingParams,a="string"==typeof t?n(t):t;return s.a.r(a,function(n){e(n.key||n.unknown,n.value)}),o.length&&e("_ko_property_writers","{"+o.join(",")+" }"),h.join(",")},fd:function(n,t){for(var i=0;i<n.length;i++)if(n[i].key==t)return!0;return!1},Ga:function(n,t,i,r,u){n&&s.I(n)?!s.Da(n)||u&&n.p()===r||n(r):(n=t.get("_ko_property_writers"))&&n[i]&&n[i](r)}}}();s.b("expressionRewriting",s.h);s.b("expressionRewriting.bindingRewriteValidators",s.h.va);s.b("expressionRewriting.parseObjectLiteral",s.h.Ab);s.b("expressionRewriting.preProcessBindings",s.h.Xa);s.b("expressionRewriting._twoWayBindings",s.h.ga);s.b("jsonExpressionRewriting",s.h);s.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",s.h.Xa),function(){function n(n){return 8==n.nodeType&&e.test(i?n.text:n.nodeValue)}function r(n){return 8==n.nodeType&&o.test(i?n.text:n.nodeValue)}function u(t,i){for(var u=t,f=1,e=[];u=u.nextSibling;){if(r(u)&&(f--,0===f))return e;e.push(u);n(u)&&f++}if(!i)throw Error("Cannot find closing comment tag to match: "+t.nodeValue);return null}function f(n,t){var i=u(n,t);return i?0<i.length?i[i.length-1].nextSibling:n.nextSibling:null}var i=t&&"<!--test-->"===t.createComment("test").text,e=i?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,o=i?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,h={ul:!0,ol:!0};s.f={aa:{},childNodes:function(t){return n(t)?u(t):t.childNodes},za:function(t){if(n(t)){t=s.f.childNodes(t);for(var i=0,r=t.length;i<r;i++)s.removeNode(t[i])}else s.a.rb(t)},fa:function(t,i){if(n(t)){s.f.za(t);for(var u=t.nextSibling,r=0,f=i.length;r<f;r++)u.parentNode.insertBefore(i[r],u)}else s.a.fa(t,i)},qc:function(t,i){n(t)?t.parentNode.insertBefore(i,t.nextSibling):t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i)},kc:function(t,i,r){r?n(t)?t.parentNode.insertBefore(i,r.nextSibling):r.nextSibling?t.insertBefore(i,r.nextSibling):t.appendChild(i):s.f.qc(t,i)},firstChild:function(t){return n(t)?!t.nextSibling||r(t.nextSibling)?null:t.nextSibling:t.firstChild},nextSibling:function(t){return n(t)&&(t=f(t)),t.nextSibling&&r(t.nextSibling)?null:t.nextSibling},Yc:n,vd:function(n){return(n=(i?n.text:n.nodeValue).match(e))?n[1]:null},oc:function(t){var o,i,u,e;if(h[s.a.A(t)]&&(o=t.firstChild,o))do if(1===o.nodeType){if(i=o.firstChild,u=null,i)do u?u.push(i):n(i)?(e=f(i,!0),e?i=e:u=[i]):r(i)&&(u=[i]);while(i=i.nextSibling);if(i=u)for(u=o.nextSibling,e=0;e<i.length;e++)u?t.insertBefore(i[e],u):t.appendChild(i[e])}while(o=o.nextSibling)}}}();s.b("virtualElements",s.f);s.b("virtualElements.allowedBindings",s.f.aa);s.b("virtualElements.emptyNode",s.f.za);s.b("virtualElements.insertAfter",s.f.kc);s.b("virtualElements.prepend",s.f.qc);s.b("virtualElements.setDomNodeChildren",s.f.fa),function(){s.S=function(){this.Kc={}};s.a.extend(s.S.prototype,{nodeHasBindings:function(n){switch(n.nodeType){case 1:return null!=n.getAttribute("data-bind")||s.g.getComponentNameForNode(n);case 8:return s.f.Yc(n);default:return!1}},getBindings:function(n,t){var i=this.getBindingsString(n,t),i=i?this.parseBindingsString(i,t,n):null;return s.g.Rb(i,n,t,!1)},getBindingAccessors:function(n,t){var i=this.getBindingsString(n,t),i=i?this.parseBindingsString(i,t,n,{valueAccessors:!0}):null;return s.g.Rb(i,n,t,!0)},getBindingsString:function(n){switch(n.nodeType){case 1:return n.getAttribute("data-bind");case 8:return s.f.vd(n);default:return null}},parseBindingsString:function(n,t,i,r){var u,f,e,h,c;try{return u=this.Kc,f=n+(r&&r.valueAccessors||""),(e=u[f])||(c="with($context){with($data||{}){return{"+s.h.Xa(n,r)+"}}}",h=new Function("$context","$element",c),e=u[f]=h),e(t,i)}catch(o){throw o.message="Unable to parse bindings.\nBindings value: "+n+"\nMessage: "+o.message,o;}}});s.S.instance=new s.S}();s.b("bindingProvider",s.S),function(){function v(n){return function(){return n}}function u(n){return n()}function o(n){return s.a.Ea(s.l.w(n),function(t,i){return function(){return n()[i]}})}function y(n,t,i){return"function"==typeof n?o(n.bind(null,t,i)):s.a.Ea(n,v)}function p(n,t){return o(this.getBindings.bind(this,n,t))}function h(n,t,i){var r,u=s.f.firstChild(t),f=s.S.instance,e=f.preprocessNode;if(e){for(;r=u;)u=s.f.nextSibling(r),e.call(f,r);u=s.f.firstChild(t)}for(;r=u;)u=s.f.nextSibling(r),c(n,r,i)}function c(n,t,i){var u=!0,r=1===t.nodeType;r&&s.f.oc(t);(r&&i||s.S.instance.nodeHasBindings(t))&&(u=l(t,null,n,i).shouldBindDescendants);u&&!a[s.a.A(t)]&&h(n,t,!r)}function w(n){var i=[],r={},t=[];return s.a.D(n,function u(f){if(!r[f]){var e=s.getBindingHandler(f);e&&(e.after&&(t.push(f),s.a.r(e.after,function(i){if(n[i]){if(-1!==s.a.o(t,i))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+t.join(", "));u(i)}}),t.length--),i.push({key:f,jc:e}));r[f]=!0}}),i}function l(t,i,r,e){var v=s.a.e.get(t,f),o,l,a,c;if(!i){if(v)throw Error("You cannot apply bindings multiple times to the same element.");s.a.e.set(t,f,!0)}if(!v&&e&&s.xc(t,r),i&&"function"!=typeof i)o=i;else{var y=s.S.instance,b=y.getBindingAccessors||p,h=s.B(function(){return(o=i?i(r,t):b.call(y,t,r))&&r.Q&&r.Q(),o},null,{i:t});o&&h.ca()||(h=null)}return o&&(a=h?function(n){return function(){return u(h()[n])}}:function(n){return o[n]},c=function(){return s.a.Ea(h?h():o,u)},c.get=function(n){return o[n]&&u(a(n))},c.has=function(n){return n in o},e=w(o),s.a.r(e,function(i){var e=i.jc.init,h=i.jc.update,u=i.key;if(8===t.nodeType&&!s.f.aa[u])throw Error("The binding '"+u+"' cannot be used with virtual elements");try{"function"==typeof e&&s.l.w(function(){var i=e(t,a(u),c,r.$data,r);if(i&&i.controlsDescendantBindings){if(l!==n)throw Error("Multiple bindings ("+l+" and "+u+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");l=u}});"function"==typeof h&&s.B(function(){h(t,a(u),c,r.$data,r)},null,{i:t})}catch(f){throw f.message='Unable to process binding "'+u+": "+o[u]+'"\nMessage: '+f.message,f;}})),{shouldBindDescendants:l===n}}function t(n){return n&&n instanceof s.R?n:new s.R(n)}var a,f,e;s.d={};a={script:!0,textarea:!0,template:!0};s.getBindingHandler=function(n){return s.d[n]};s.R=function(t,i,r,u,f){function c(){var f=a?t():t,n=s.a.c(f);return i?(i.Q&&i.Q(),s.a.extend(e,i),e.Q=o):(e.$parents=[],e.$root=n,e.ko=s),e.$rawData=f,e.$data=n,r&&(e[r]=n),u&&u(e,i,n),e.$data}function l(){return h&&!s.a.Tb(h)}var e=this,a="function"==typeof t&&!s.I(t),h,o;f&&f.exportDependencies?c():(o=s.B(c,null,{ya:l,i:!0}),o.ca()&&(e.Q=o,o.equalityComparer=null,h=[],o.Dc=function(t){h.push(t);s.a.G.qa(t,function(t){s.a.Na(h,t);h.length||(o.k(),e.Q=o=n)})}))};s.R.prototype.createChildContext=function(n,t,i,r){return new s.R(n,this,t,function(n,t){n.$parentContext=t;n.$parent=t.$data;n.$parents=(t.$parents||[]).slice(0);n.$parents.unshift(n.$parent);i&&i(n)},r)};s.R.prototype.extend=function(n){return new s.R(this.Q||this.$data,this,null,function(t,i){t.$rawData=i.$rawData;s.a.extend(t,"function"==typeof n?n():n)})};s.R.prototype.ac=function(n,t){return this.createChildContext(n,t,null,{exportDependencies:!0})};f=s.a.e.J();e=s.a.e.J();s.xc=function(n,t){if(2==arguments.length)s.a.e.set(n,e,t),t.Q&&t.Q.Dc(n);else return s.a.e.get(n,e)};s.La=function(n,i,r){return 1===n.nodeType&&s.f.oc(n),l(n,i,t(r),!0)};s.Ic=function(n,i,r){return r=t(r),s.La(n,y(i,r,n),r)};s.hb=function(n,i){1!==i.nodeType&&8!==i.nodeType||h(t(n),i,!0)};s.Ub=function(n,u){if(!i&&r.jQuery&&(i=r.jQuery),u&&1!==u.nodeType&&8!==u.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");u=u||r.document.body;c(t(n),u,!0)};s.nb=function(t){switch(t.nodeType){case 1:case 8:var i=s.xc(t);if(i)return i;if(t.parentNode)return s.nb(t.parentNode)}return n};s.Oc=function(t){return(t=s.nb(t))?t.$data:n};s.b("bindingHandlers",s.d);s.b("applyBindings",s.Ub);s.b("applyBindingsToDescendants",s.hb);s.b("applyBindingAccessorsToNode",s.La);s.b("applyBindingsToNode",s.Ic);s.b("contextFor",s.nb);s.b("dataFor",s.Oc)}(),function(n){function u(t,u){var e=i.hasOwnProperty(t)?i[t]:n,o;e?e.Y(u):(e=i[t]=new s.K,e.Y(u),f(t,function(n,u){var f=!(!u||!u.synchronous);r[t]={definition:n,dd:f};delete i[t];o||f?e.notifySubscribers(n):s.Z.Za(function(){e.notifySubscribers(n)})}),o=!0)}function f(n,i){t("getConfig",[n],function(r){r?t("loadComponent",[n,r],function(n){i(n,r)}):i(null,null)})}function t(i,r,u,f){var e,o,h;if(f||(f=s.g.loaders.slice(0)),e=f.shift(),e)if(o=e[i],o){if(h=!1,o.apply(e,r.concat(function(n){h?u(null):null!==n?u(n):t(i,r,u,f)}))!==n&&(h=!0,!e.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else t(i,r,u,f);else u(null)}var i={},r={};s.g={get:function(t,i){var f=r.hasOwnProperty(t)?r[t]:n;f?f.dd?s.l.w(function(){i(f.definition)}):s.Z.Za(function(){i(f.definition)}):u(t,i)},$b:function(n){delete r[n]},Nb:t};s.g.loaders=[];s.b("components",s.g);s.b("components.get",s.g.get);s.b("components.clearCachedDefinition",s.g.$b)}(),function(){function l(n,t,r,f){function e(){0==--c&&f(o)}var o={},c=2,h=r.template;r=r.viewModel;h?u(t,h,function(t){s.g.Nb("loadTemplate",[n,t],function(n){o.template=n;e()})}):e();r?u(t,r,function(t){s.g.Nb("loadViewModel",[n,t],function(n){o[i]=n;e()})}):e()}function e(n,t,r){if("function"==typeof t)r(function(n){return new t(n)});else if("function"==typeof t[i])r(t[i]);else if("instance"in t){var u=t.instance;r(function(){return u})}else"viewModel"in t?e(n,t.viewModel,r):n("Unknown viewModel value: "+t)}function h(n){switch(s.a.A(n)){case"script":return s.a.na(n.text);case"textarea":return s.a.na(n.value);case"template":if(c(n.content))return s.a.wa(n.content.childNodes)}return s.a.wa(n.childNodes)}function c(n){return r.DocumentFragment?n instanceof DocumentFragment:n&&11===n.nodeType}function u(n,t,i){"string"==typeof t.require?o||r.require?(o||r.require)([t.require],i):n("Uses require, but no AMD loader is present"):i(t)}function f(n){return function(t){throw Error("Component '"+n+"': "+t);}}var n={},i;s.g.register=function(t,i){if(!i)throw Error("Invalid configuration for "+t);if(s.g.wb(t))throw Error("Component "+t+" is already registered");n[t]=i};s.g.wb=function(t){return n.hasOwnProperty(t)};s.g.ud=function(t){delete n[t];s.g.$b(t)};s.g.cc={getConfig:function(t,i){i(n.hasOwnProperty(t)?n[t]:null)},loadComponent:function(n,t,i){var r=f(n);u(r,t,function(t){l(n,r,t,i)})},loadTemplate:function(n,i,u){if(n=f(n),"string"==typeof i)u(s.a.na(i));else if(i instanceof Array)u(i);else if(c(i))u(s.a.W(i.childNodes));else if(i.element)if(i=i.element,r.HTMLElement?i instanceof HTMLElement:i&&i.tagName&&1===i.nodeType)u(h(i));else if("string"==typeof i){var e=t.getElementById(i);e?u(h(e)):n("Cannot find element with ID "+i)}else n("Unknown element type: "+i);else n("Unknown template value: "+i)},loadViewModel:function(n,t,i){e(f(n),t,i)}};i="createViewModel";s.b("components.register",s.g.register);s.b("components.isRegistered",s.g.wb);s.b("components.unregister",s.g.ud);s.b("components.defaultLoader",s.g.cc);s.g.loaders.push(s.g.cc);s.g.Ec=n}(),function(){function n(n,t){var r=n.getAttribute("params");if(r){var r=i.parseBindingsString(r,t,n,{valueAccessors:!0,bindingParams:!0}),r=s.a.Ea(r,function(t){return s.m(t,null,{i:n})}),u=s.a.Ea(r,function(t){var i=t.p();return t.ca()?s.m({read:function(){return s.a.c(t())},write:s.Da(i)&&function(n){t()(n)},i:n}):i});return u.hasOwnProperty("$raw")||(u.$raw=r),u}return{$raw:{}}}s.g.getComponentNameForNode=function(n){var t=s.a.A(n);if(s.g.wb(t)&&(-1!=t.indexOf("-")||"[object HTMLUnknownElement]"==""+n||8>=s.a.C&&n.tagName===t))return t};s.g.Rb=function(t,i,r,u){var f,e;if(1===i.nodeType&&(f=s.g.getComponentNameForNode(i),f)){if(t=t||{},t.component)throw Error('Cannot use the "component" binding on a custom element matching a component');e={name:f,params:n(i,r)};t.component=u?function(){return e}:e}return t};var i=new s.S;9>s.a.C&&(s.g.register=function(n){return function(i){return t.createElement(i),n.apply(this,arguments)}}(s.g.register),t.createDocumentFragment=function(n){return function(){var i=n(),r=s.g.Ec,t;for(t in r)r.hasOwnProperty(t)&&i.createElement(t);return i}}(t.createDocumentFragment))}(),function(n){function t(n,t,i){if(t=t.template,!t)throw Error("Component '"+n+"' has no template");n=s.a.wa(t);s.f.fa(i,n)}function i(n,t,i,r){var u=n.createViewModel;return u?u.call(n,r,{element:t,templateNodes:i}):r}var r=0;s.d.component={init:function(u,f,e,o,h){function a(){var n=c&&c.dispose;"function"==typeof n&&n.call(c);l=c=null}var c,l,v=s.a.W(s.f.childNodes(u));return s.a.G.qa(u,a),s.m(function(){var o=s.a.c(f()),e,y,p;if("string"==typeof o?e=o:(e=s.a.c(o.name),y=s.a.c(o.params)),!e)throw Error("No component name specified");p=l=++r;s.g.get(e,function(r){if(l===p){if(a(),!r)throw Error("Unknown component '"+e+"'");t(e,r,u);var f=i(r,u,v,y);r=h.createChildContext(f,n,function(n){n.$component=f;n.$componentTemplateNodes=v});c=f;s.hb(r,u)}})},null,{i:u}),{controlsDescendantBindings:!0}}};s.f.aa.component=!0}();g={"class":"className","for":"htmlFor"};s.d.attr={update:function(t,i){var r=s.a.c(i())||{};s.a.D(r,function(i,r){r=s.a.c(r);var u=!1===r||null===r||r===n;u&&t.removeAttribute(i);8>=s.a.C&&i in g?(i=g[i],u?t.removeAttribute(i):t[i]=r):u||t.setAttribute(i,r.toString());"name"===i&&s.a.vc(t,u?"":r.toString())})}},function(){s.d.checked={after:["value","attr"],init:function(t,i,r){function l(){var l=t.checked,o=y?f():l,n,h;s.xa.Va()||e&&!l||(n=s.l.w(i),u?(h=a?n.p():n,c!==o?(l&&(s.a.ra(h,o,!0),s.a.ra(h,c,!1)),c=o):s.a.ra(h,o,l),a&&s.Da(n)&&n(h)):s.h.Ga(n,r,"checked",o,!0))}function v(){var n=s.a.c(i());t.checked=u?0<=s.a.o(n,f()):h?n:f()===n}var f=s.rc(function(){return r.has("checkedValue")?s.a.c(r.get("checkedValue")):r.has("value")?s.a.c(r.get("value")):t.value}),h="checkbox"==t.type,e="radio"==t.type;if(h||e){var o=i(),u=h&&s.a.c(o)instanceof Array,a=!(u&&o.push&&o.splice),c=u?f():n,y=e||u;e&&!t.name&&s.d.uniqueName.init(t,function(){return!0});s.m(l,null,{i:t});s.a.q(t,"click",l);s.m(v,null,{i:t});o=n}}};s.h.ga.checked=!0;s.d.checkedValue={update:function(n,t){n.value=s.a.c(t())}}}();s.d.css={update:function(n,t){var i=s.a.c(t());null!==i&&"object"==typeof i?s.a.D(i,function(t,i){i=s.a.c(i);s.a.fb(n,t,i)}):(i=s.a.cb(String(i||"")),s.a.fb(n,n.__ko__cssValue,!1),n.__ko__cssValue=i,s.a.fb(n,i,!0))}};s.d.enable={update:function(n,t){var i=s.a.c(t());i&&n.disabled?n.removeAttribute("disabled"):i||n.disabled||(n.disabled=!0)}};s.d.disable={update:function(n,t){s.d.enable.update(n,function(){return!s.a.c(t())})}};s.d.event={init:function(n,t,i,r,u){var f=t()||{};s.a.D(f,function(f){"string"==typeof f&&s.a.q(n,f,function(n){var o,h=t()[f],e;if(h){try{e=s.a.W(arguments);r=u.$data;e.unshift(r);o=h.apply(r,e)}finally{!0!==o&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}!1===i.get(f+"Bubble")&&(n.cancelBubble=!0,n.stopPropagation&&n.stopPropagation())}})})}};s.d.foreach={mc:function(n){return function(){var i=n(),t=s.a.Bb(i);return!t||"number"==typeof t.length?{foreach:i,templateEngine:s.X.vb}:(s.a.c(i),{foreach:t.data,as:t.as,includeDestroyed:t.includeDestroyed,afterAdd:t.afterAdd,beforeRemove:t.beforeRemove,afterRender:t.afterRender,beforeMove:t.beforeMove,afterMove:t.afterMove,templateEngine:s.X.vb})}},init:function(n,t){return s.d.template.init(n,s.d.foreach.mc(t))},update:function(n,t,i,r,u){return s.d.template.update(n,s.d.foreach.mc(t),i,r,u)}};s.h.va.foreach=!1;s.f.aa.foreach=!0;s.d.hasfocus={init:function(n,t,i){function r(r){var u,f;if(n.__ko_hasfocusUpdating=!0,u=n.ownerDocument,"activeElement"in u){try{f=u.activeElement}catch(e){f=u.body}r=f===n}u=t();s.h.Ga(u,i,"hasfocus",r,!0);n.__ko_hasfocusLastValue=r;n.__ko_hasfocusUpdating=!1}var u=r.bind(null,!0),f=r.bind(null,!1);s.a.q(n,"focus",u);s.a.q(n,"focusin",u);s.a.q(n,"blur",f);s.a.q(n,"focusout",f)},update:function(n,t){var i=!!s.a.c(t());n.__ko_hasfocusUpdating||n.__ko_hasfocusLastValue===i||(i?n.focus():n.blur(),!i&&n.__ko_hasfocusLastValue&&n.ownerDocument.body.focus(),s.l.w(s.a.Fa,null,[n,i?"focusin":"focusout"]))}};s.h.ga.hasfocus=!0;s.d.hasFocus=s.d.hasfocus;s.h.ga.hasFocus=!0;s.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(n,t){s.a.Eb(n,t())}};k("if");k("ifnot",!1,!0);k("with",!0,!1,function(n,t){return n.ac(t)});w={};s.d.options={init:function(n){if("select"!==s.a.A(n))throw Error("options binding applies only to SELECT elements");for(;0<n.length;)n.remove(0);return{controlsDescendantBindings:!0}},update:function(t,i,r){function a(){return s.a.Ma(t.options,function(n){return n.selected})}function v(n,t,i){var r=typeof t;return"function"==r?t(n):"string"==r?n[t]:i}function y(n,i){if(o&&e)s.j.ja(t,s.a.c(r.get("value")),!0);else if(f.length){var u=0<=s.a.o(f,s.j.u(i[0]));s.a.wc(i[0],u);o&&!u&&s.l.w(s.a.Fa,null,[t,"change"])}}var h=t.multiple,c=0!=t.length&&h?t.scrollTop:null,u=s.a.c(i()),e=r.get("valueAllowUnset")&&r.has("value"),p=r.get("optionsIncludeDestroyed"),l,f,o;i={};f=[];e||(h?f=s.a.ib(a(),s.j.u):0<=t.selectedIndex&&f.push(s.j.u(t.options[t.selectedIndex])));u&&("undefined"==typeof u.length&&(u=[u]),l=s.a.Ma(u,function(t){return p||t===n||null===t||!s.a.c(t._destroy)}),r.has("optionsCaption")&&(u=s.a.c(r.get("optionsCaption")),null!==u&&u!==n&&l.unshift(w)));o=!1;i.beforeRemove=function(n){t.removeChild(n)};u=y;r.has("optionsAfterRender")&&"function"==typeof r.get("optionsAfterRender")&&(u=function(t,i){y(0,i);s.l.w(r.get("optionsAfterRender"),null,[i[0],t!==w?t:n])});s.a.Db(t,l,function(i,u,h){return h.length&&(f=!e&&h[0].selected?[s.j.u(h[0])]:[],o=!0),u=t.ownerDocument.createElement("option"),i===w?(s.a.bb(u,r.get("optionsCaption")),s.j.ja(u,n)):(h=v(i,r.get("optionsValue"),i),s.j.ja(u,s.a.c(h)),i=v(i,r.get("optionsText"),h),s.a.bb(u,i)),[u]},i,u);s.l.w(function(){e?s.j.ja(t,s.a.c(r.get("value")),!0):(h?f.length&&a().length<f.length:f.length&&0<=t.selectedIndex?s.j.u(t.options[t.selectedIndex])!==f[0]:f.length||0<=t.selectedIndex)&&s.a.Fa(t,"change")});s.a.Sc(t);c&&20<Math.abs(c-t.scrollTop)&&(t.scrollTop=c)}};s.d.options.zb=s.a.e.J();s.d.selectedOptions={after:["options","foreach"],init:function(n,t,i){s.a.q(n,"change",function(){var u=t(),r=[];s.a.r(n.getElementsByTagName("option"),function(n){n.selected&&r.push(s.j.u(n))});s.h.Ga(u,i,"selectedOptions",r)})},update:function(n,t){if("select"!=s.a.A(n))throw Error("values binding applies only to SELECT elements");var i=s.a.c(t()),r=n.scrollTop;i&&"number"==typeof i.length&&s.a.r(n.getElementsByTagName("option"),function(n){var t=0<=s.a.o(i,s.j.u(n));n.selected!=t&&s.a.wc(n,t)});n.scrollTop=r}};s.h.ga.selectedOptions=!0;s.d.style={update:function(t,i){var r=s.a.c(i()||{});s.a.D(r,function(i,r){r=s.a.c(r);(null===r||r===n||!1===r)&&(r="");t.style[i]=r})}};s.d.submit={init:function(n,t,i,r,u){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");s.a.q(n,"submit",function(i){var r,f=t();try{r=f.call(u.$data,n)}finally{!0!==r&&(i.preventDefault?i.preventDefault():i.returnValue=!1)}})}};s.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(n,t){s.a.bb(n,t())}};s.f.aa.text=!0,function(){if(r&&r.navigator)var t=function(n){if(n)return parseFloat(n[1])},e=r.opera&&r.opera.version&&parseInt(r.opera.version()),i=r.navigator.userAgent,o=t(i.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),h=t(i.match(/Firefox\/([^ ]*)/));if(10>s.a.C)var u=s.a.e.J(),f=s.a.e.J(),c=function(n){var t=this.activeElement;(t=t&&s.a.e.get(t,f))&&t(n)},l=function(n,t){var i=n.ownerDocument;s.a.e.get(i,u)||(s.a.e.set(i,u,!0),s.a.q(i,"selectionchange",c));s.a.e.set(n,f,t)};s.d.textInput={init:function(t,i,r){function u(n,i){s.a.q(t,n,i)}function p(){var r=s.a.c(i());(null===r||r===n)&&(r="");v!==n&&r===v?s.a.setTimeout(p,4):t.value!==r&&(y=r,t.value=r)}function c(){a||(v=t.value,a=s.a.setTimeout(f,4))}function f(){clearTimeout(a);v=a=n;var u=t.value;y!==u&&(y=u,s.h.Ga(i(),r,"textInput",u))}var y=t.value,a,v,w=9==s.a.C?c:f;10>s.a.C?(u("propertychange",function(n){"value"===n.propertyName&&w(n)}),8==s.a.C&&(u("keyup",f),u("keydown",f)),8<=s.a.C&&(l(t,w),u("dragend",c))):(u("input",f),5>o&&"textarea"===s.a.A(t)?(u("keydown",c),u("paste",c),u("cut",c)):11>e?u("keydown",c):4>h&&(u("DOMAutoComplete",f),u("dragdrop",f),u("drop",f)));u("change",f);s.m(p,null,{i:t})}};s.h.ga.textInput=!0;s.d.textinput={preprocess:function(n,t,i){i("textInput",n)}}}();s.d.uniqueName={init:function(n,t){if(t()){var i="ko_unique_"+ ++s.d.uniqueName.Nc;s.a.vc(n,i)}}};s.d.uniqueName.Nc=0;s.d.value={after:["options","foreach"],init:function(n,t,i){var o,h;if("input"!=n.tagName.toLowerCase()||"checkbox"!=n.type&&"radio"!=n.type){var r=["change"],u=i.get("valueUpdate"),f=!1,e=null;u&&("string"==typeof u&&(u=[u]),s.a.ta(r,u),r=s.a.Wb(r));o=function(){e=null;f=!1;var r=t(),u=s.j.u(n);s.h.Ga(r,i,"value",u)};!s.a.C||"input"!=n.tagName.toLowerCase()||"text"!=n.type||"off"==n.autocomplete||n.form&&"off"==n.form.autocomplete||-1!=s.a.o(r,"propertychange")||(s.a.q(n,"propertychange",function(){f=!0}),s.a.q(n,"focus",function(){f=!1}),s.a.q(n,"blur",function(){f&&o()}));s.a.r(r,function(t){var i=o;s.a.sd(t,"after")&&(i=function(){e=s.j.u(n);s.a.setTimeout(o,0)},t=t.substring(5));s.a.q(n,t,i)});h=function(){var r=s.a.c(t()),u=s.j.u(n),f;null!==e&&r===e?s.a.setTimeout(h,0):r!==u&&("select"===s.a.A(n)?(f=i.get("valueAllowUnset"),u=function(){s.j.ja(n,r,f)},u(),f||r===s.j.u(n)?s.a.setTimeout(u,0):s.l.w(s.a.Fa,null,[n,"change"])):s.j.ja(n,r))};s.m(h,null,{i:n})}else s.La(n,{checkedValue:t})},update:function(){}};s.h.ga.value=!0;s.d.visible={update:function(n,t){var i=s.a.c(t()),r="none"!=n.style.display;i&&!r?n.style.display="":!i&&r&&(n.style.display="none")}},function(n){s.d[n]={init:function(t,i,r,u,f){return s.d.event.init.call(this,t,function(){var t={};return t[n]=i(),t},r,u,f)}}}("click");s.P=function(){};s.P.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};s.P.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};s.P.prototype.makeTemplateSource=function(n,i){if("string"==typeof n){i=i||t;var r=i.getElementById(n);if(!r)throw Error("Cannot find template with ID "+n);return new s.v.n(r)}if(1==n.nodeType||8==n.nodeType)return new s.v.sa(n);throw Error("Unknown template type: "+n);};s.P.prototype.renderTemplate=function(n,t,i,r){return n=this.makeTemplateSource(n,r),this.renderTemplateSource(n,t,i,r)};s.P.prototype.isTemplateRewritten=function(n,t){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(n,t).data("isRewritten")};s.P.prototype.rewriteTemplate=function(n,t,i){n=this.makeTemplateSource(n,i);t=t(n.text());n.text(t);n.data("isRewritten",!0)};s.b("templateEngine",s.P);s.Ib=function(){function n(n,t,i,r){var o,f,u,e;for(n=s.h.Ab(n),o=s.h.va,f=0;f<n.length;f++)if(u=n[f].key,o.hasOwnProperty(u))if(e=o[u],"function"==typeof e){if(u=e(n[f].value))throw Error(u);}else if(!e)throw Error("This template engine does not support the '"+u+"' binding within its templates");return i="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+s.h.Xa(n,{valueAccessors:!0})+" } })()},'"+i.toLowerCase()+"')",r.createJavaScriptEvaluatorBlock(i)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,i=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Tc:function(n,t,i){t.isTemplateRewritten(n,i)||t.rewriteTemplate(n,function(n){return s.Ib.jd(n,t)},i)},jd:function(r,u){return r.replace(t,function(t,i,r,f,e){return n(e,i,r,u)}).replace(i,function(t,i){return n(i,"<!-- ko -->","#comment",u)})},Jc:function(n,t){return s.N.yb(function(i,r){var u=i.nextSibling;u&&u.nodeName.toLowerCase()===t&&s.La(u,n,r)})}}}();s.b("__tr_ambtns",s.Ib.Jc),function(){var i,t;s.v={};s.v.n=function(n){if(this.n=n){var t=s.a.A(n);this.eb="script"===t?1:"textarea"===t?2:"template"==t&&n.content&&11===n.content.nodeType?3:4}};s.v.n.prototype.text=function(){var n=1===this.eb?"text":2===this.eb?"value":"innerHTML",t;if(0==arguments.length)return this.n[n];t=arguments[0];"innerHTML"===n?s.a.Eb(this.n,t):this.n[n]=t};i=s.a.e.J()+"_";s.v.n.prototype.data=function(n){if(1===arguments.length)return s.a.e.get(this.n,i+n);s.a.e.set(this.n,i+n,arguments[1])};t=s.a.e.J();s.v.n.prototype.nodes=function(){var i=this.n;if(0==arguments.length)return(s.a.e.get(i,t)||{}).mb||(3===this.eb?i.content:4===this.eb?i:n);s.a.e.set(i,t,{mb:arguments[0]})};s.v.sa=function(n){this.n=n};s.v.sa.prototype=new s.v.n;s.v.sa.prototype.text=function(){if(0==arguments.length){var i=s.a.e.get(this.n,t)||{};return i.Jb===n&&i.mb&&(i.Jb=i.mb.innerHTML),i.Jb}s.a.e.set(this.n,t,{Jb:arguments[0]})};s.b("templateSources",s.v);s.b("templateSources.domElement",s.v.n);s.b("templateSources.anonymousTemplate",s.v.sa)}(),function(){function t(n,t,i){var r;for(t=s.f.nextSibling(t);n&&(r=n)!==t;)n=s.f.nextSibling(r),i(r,n)}function f(n,i){if(n.length){var r=n[0],u=n[n.length-1],f=r.parentNode,e=s.S.instance,o=e.preprocessNode;if(o){if(t(r,u,function(n,t){var f=n.previousSibling,i=o.call(e,n);i&&(n===r&&(r=i[0]||t),n===u&&(u=i[i.length-1]||f))}),n.length=0,!r)return;r===u?n.push(r):(n.push(r,u),s.a.Ba(n,f))}t(r,u,function(n){1!==n.nodeType&&8!==n.nodeType||s.Ub(i,n)});t(r,u,function(n){1!==n.nodeType&&8!==n.nodeType||s.N.Cc(n,[i])});s.a.Ba(n,f)}}function i(n){return n.nodeType?n:0<n.length?n[0]:null}function e(n,t,u,e,o){o=o||{};var h=(n&&i(n)||u||{}).ownerDocument,c=o.templateEngine||r;if(s.Ib.Tc(u,c,h),u=c.renderTemplate(u,e,o,h),"number"!=typeof u.length||0<u.length&&"number"!=typeof u[0].nodeType)throw Error("Template engine must return an array of DOM nodes");h=!1;switch(t){case"replaceChildren":s.f.fa(n,u);h=!0;break;case"replaceNode":s.a.uc(n,u);h=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t);}return h&&(f(u,e),o.afterRender&&s.l.w(o.afterRender,null,[u,e.$data])),u}function o(n,t,i){return s.I(n)?n():"function"==typeof n?n(t,i):n}var r,u;s.Fb=function(t){if(t!=n&&!(t instanceof s.P))throw Error("templateEngine must inherit from ko.templateEngine");r=t};s.Cb=function(t,u,f,h,c){if(f=f||{},(f.templateEngine||r)==n)throw Error("Set a template engine before calling renderTemplate");if(c=c||"replaceChildren",h){var l=i(h);return s.B(function(){var n=u&&u instanceof s.R?u:new s.R(u,null,null,null,{exportDependencies:!0}),r=o(t,n.$data,n),n=e(h,c,r,n,f);"replaceNode"==c&&(h=n,l=i(h))},null,{ya:function(){return!l||!s.a.qb(l)},i:l&&"replaceNode"==c?l.parentNode:l})}return s.N.yb(function(n){s.Cb(t,u,f,n,"replaceNode")})};s.pd=function(t,i,r,u,h){function l(n,t){f(t,c);r.afterRender&&r.afterRender(t,n);c=null}function a(n,i){c=h.createChildContext(n,r.as,function(n){n.$index=i});var u=o(t,n,c);return e(null,"ignoreTargetNode",u,c,r)}var c;return s.B(function(){var t=s.a.c(i)||[];"undefined"==typeof t.length&&(t=[t]);t=s.a.Ma(t,function(t){return r.includeDestroyed||t===n||null===t||!s.a.c(t._destroy)});s.l.w(s.a.Db,null,[u,t,a,r,l])},null,{i:u})};u=s.a.e.J();s.d.template={init:function(n,t){var i=s.a.c(t());if("string"==typeof i||i.name)s.f.za(n);else{if("nodes"in i){if(i=i.nodes||[],s.I(i))throw Error('The "nodes" option must be a plain, non-observable array.');}else i=s.f.childNodes(n);i=s.a.nc(i);new s.v.sa(n).nodes(i)}return{controlsDescendantBindings:!0}},update:function(t,i,r,f,e){var o=i();i=s.a.c(o);r=!0;f=null;"string"==typeof i?i={}:(o=i.name,"if"in i&&(r=s.a.c(i["if"])),r&&"ifnot"in i&&(r=!s.a.c(i.ifnot)));"foreach"in i?f=s.pd(o||t,r&&i.foreach||[],i,t,e):r?(e="data"in i?e.ac(i.data,i.as):e,f=s.Cb(o||t,e,i,t)):s.f.za(t);e=f;(i=s.a.e.get(t,u))&&"function"==typeof i.k&&i.k();s.a.e.set(t,u,e&&e.ca()?e:n)}};s.h.va.template=function(n){return n=s.h.Ab(n),1==n.length&&n[0].unknown||s.h.fd(n,"name")?null:"This template engine does not support anonymous templates nested within its templates"};s.f.aa.template=!0}();s.b("setTemplateEngine",s.Fb);s.b("renderTemplate",s.Cb);s.a.hc=function(n,t,i){if(n.length&&t.length)for(var o,r,f,e,u=o=0;(!i||u<i)&&(f=n[o]);++o){for(r=0;e=t[r];++r)if(f.value===e.value){f.moved=e.index;e.moved=f.index;t.splice(r,1);u=r=0;break}u+=r}};s.a.lb=function(){function n(n,t,i,r,u){for(var o=Math.min,l=Math.max,a=[],c=n.length,f,h=t.length,v=h-c||1,w=c+h+1,y,p,b,e=0;e<=c;e++)for(p=y,a.push(y=[]),b=o(h,e+v),f=l(0,e-1);f<=b;f++)y[f]=f?e?n[e-1]===t[f-1]?p[f-1]:o(p[f]||w,y[f-1]||w)+1:f+1:e+1;for(o=[],l=[],v=[],e=c,f=h;e||f;)h=a[e][f]-1,f&&h===a[e][f-1]?l.push(o[o.length]={status:i,value:t[--f],index:f}):e&&h===a[e-1][f]?v.push(o[o.length]={status:r,value:n[--e],index:e}):(--f,--e,u.sparse||o.push({status:"retained",value:t[f]}));return s.a.hc(v,l,!u.dontLimitMoves&&10*c),o.reverse()}return function(t,i,r){return r="boolean"==typeof r?{dontLimitMoves:r}:r||{},t=t||[],i=i||[],t.length<i.length?n(t,i,"added","deleted",r):n(i,t,"deleted","added",r)}}();s.b("utils.compareArrays",s.a.lb),function(){function r(t,i,r,u,f){var e=[],o=s.B(function(){var n=i(r,f,s.a.Ba(e,t))||[];0<e.length&&(s.a.uc(e,n),u&&s.l.w(u,null,[r,n,f]));e.length=0;s.a.ta(e,n)},null,{i:t,ya:function(){return!s.a.Tb(e)}});return{ea:e,B:o.ca()?o:n}}var t=s.a.e.J(),i=s.a.e.J();s.a.Db=function(u,f,e,o,h){function ut(n,t){c=nt[t];tt!==t&&(rt[n]=c);c.tb(tt++);s.a.Ba(c.ea,u);b.push(c);k.push(c)}function p(n,t){if(n)for(var i=0,r=t.length;i<r;i++)t[i]&&s.a.r(t[i].ea,function(r){n(r,i,t[i].ka)})}var l,y,ft;f=f||[];o=o||{};var y=s.a.e.get(u,t)===n,nt=s.a.e.get(u,t)||[],w=s.a.ib(nt,function(n){return n.ka}),a=s.a.lb(w,f,o.dontLimitMoves),b=[],v=0,tt=0,it=[],k=[];f=[];for(var rt=[],w=[],c,l=0,d,g;d=a[l];l++)switch(g=d.moved,d.status){case"deleted":g===n&&(c=nt[v],c.B&&(c.B.k(),c.B=n),s.a.Ba(c.ea,u).length&&(o.beforeRemove&&(b.push(c),k.push(c),c.ka===i?c=null:f[l]=c),c&&it.push.apply(it,c.ea)));v++;break;case"retained":ut(l,v++);break;case"added":g!==n?ut(l,g):(c={ka:d.value,tb:s.O(tt++)},b.push(c),k.push(c),y||(w[l]=c))}for(s.a.e.set(u,t,b),p(o.beforeMove,rt),s.a.r(it,o.beforeRemove?s.ba:s.removeNode),l=0,y=s.f.firstChild(u);c=k[l];l++){for(c.ea||s.a.extend(c,r(u,e,c.ka,h,c.tb)),v=0;a=c.ea[v];y=a.nextSibling,ft=a,v++)a!==y&&s.f.kc(u,a,ft);!c.ad&&h&&(h(c.ka,c.ea,c.tb),c.ad=!0)}for(p(o.beforeRemove,f),l=0;l<f.length;++l)f[l]&&(f[l].ka=i);p(o.afterMove,rt);p(o.afterAdd,w)}}();s.b("utils.setDomNodeChildrenFromArrayMapping",s.a.Db);s.X=function(){this.allowTemplateRewriting=!1};s.X.prototype=new s.P;s.X.prototype.renderTemplateSource=function(n,t,i,r){return(t=(9>s.a.C?0:n.nodes)?n.nodes():null)?s.a.W(t.cloneNode(!0).childNodes):(n=n.text(),s.a.na(n,r))};s.X.vb=new s.X;s.Fb(s.X.vb);s.b("nativeTemplateEngine",s.X),function(){s.xb=function(){var n=this.ed=function(){if(!i||!i.tmpl)return 0;try{if(0<=i.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(n){}return 1}();this.renderTemplateSource=function(r,u,f,e){if(e=e||t,f=f||{},2>n)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var o=r.data("precompiled");return o||(o=r.text()||"",o=i.template(null,"{{ko_with $item.koBindingContext}}"+o+"{{/ko_with}}"),r.data("precompiled",o)),r=[u.$data],u=i.extend({koBindingContext:u},f.templateOptions),u=i.tmpl(o,r,u),u.appendTo(e.createElement("div")),i.fragments={},u};this.createJavaScriptEvaluatorBlock=function(n){return"{{ko_code ((function() { return "+n+" })()) }}"};this.addTemplate=function(n,i){t.write("<script type='text/html' id='"+n+"'>"+i+"<\/script>")};0<n&&(i.tmpl.tag.ko_code={open:"__.push($1 || '');"},i.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};s.xb.prototype=new s.P;var n=new s.xb;0<n.ed&&s.Fb(n);s.b("jqueryTmplTemplateEngine",s.xb)}()})})()}(),function(n,t){typeof define=="function"&&define.amd?define(t):typeof exports=="object"?module.exports=t():n.Blazy=t()}(this,function(){"use strict";function p(n){var t=n._util;t.elements=ut(n.options);t.count=t.elements.length;t.destroyed&&(t.destroyed=!1,n.options.container&&i(n.options.container,function(n){r(n,"scroll",t.validateT)}),r(window,"resize",t.saveViewportOffsetT),r(window,"resize",t.validateT),r(window,"scroll",t.validateT));w(n)}function w(n){for(var i=n._util,r,t=0;t<i.count;t++)r=i.elements[t],(rt(r,n.options)||c(r,n.options.successClass))&&(n.load(r),i.elements.splice(t,1),i.count--,t--);i.count===0&&n.destroy()}function rt(t,i){var f=t.getBoundingClientRect(),u,r;if(i.container&&v&&(u=t.closest(i.containerClass),u)){if(r=u.getBoundingClientRect(),o(r,n)){var e=r.top-i.offset,s=r.right+i.offset,h=r.bottom+i.offset,c=r.left-i.offset,l={top:e>n.top?e:n.top,right:s<n.right?s:n.right,bottom:h<n.bottom?h:n.bottom,left:c>n.left?c:n.left};return o(f,l)}return!1}return o(f,n)}function o(n,t){return n.right>=t.left&&n.bottom>=t.top&&n.left<=t.right&&n.top<=t.bottom}function b(n,f,o){var w;if(!c(n,o.successClass)&&(f||o.loadInvisible||n.offsetWidth>0&&n.offsetHeight>0))if(w=u(n,e)||u(n,o.src),w){var tt=w.split(o.separator),p=tt[a&&tt.length>1?1:0],rt=u(n,o.srcset),ut=h(n,"img"),b=n.parentNode,ft=b&&h(b,"picture");if(ut||n.src===undefined){var v=new Image,g=function(){o.error&&o.error(n,"invalid");l(n,o.errorClass);t(v,"error",g);t(v,"load",nt)},nt=function(){ut?ft||d(n,p,rt):n.style.backgroundImage='url("'+p+'")';s(n,o);t(v,"load",nt);t(v,"error",g)};ft&&(v=n,i(b.getElementsByTagName("source"),function(n){k(n,y,o.srcset)}));r(v,"error",g);r(v,"load",nt);d(v,p,rt)}else n.src=p,s(n,o)}else h(n,"video")?(i(n.getElementsByTagName("source"),function(n){k(n,it,o.src)}),n.load(),s(n,o)):(o.error&&o.error(n,"missing"),l(n,o.errorClass))}function s(n,t){l(n,t.successClass);t.success&&t.success(n);f(n,t.src);f(n,t.srcset);i(t.breakpoints,function(t){f(n,t.src)})}function k(n,t,i){var r=u(n,i);r&&(g(n,t,r),f(n,i))}function d(n,t,i){i&&g(n,y,i);n.src=t}function g(n,t,i){n.setAttribute(t,i)}function u(n,t){return n.getAttribute(t)}function f(n,t){n.removeAttribute(t)}function h(n,t){return n.nodeName.toLowerCase()===t}function c(n,t){return(" "+n.className+" ").indexOf(" "+t+" ")!==-1}function l(n,t){c(n,t)||(n.className+=" "+t)}function ut(n){for(var i=[],r=n.root.querySelectorAll(n.selector),t=r.length;t--;i.unshift(r[t]));return i}function nt(t){n.bottom=(window.innerHeight||document.documentElement.clientHeight)+t;n.right=(window.innerWidth||document.documentElement.clientWidth)+t}function r(n,t,i){n.attachEvent?n.attachEvent&&n.attachEvent("on"+t,i):n.addEventListener(t,i,{capture:!1,passive:!0})}function t(n,t,i){n.detachEvent?n.detachEvent&&n.detachEvent("on"+t,i):n.removeEventListener(t,i,{capture:!1,passive:!0})}function i(n,t){var r,i;if(n&&t)for(r=n.length,i=0;i<r&&t(n[i],i)!==!1;i++);}function tt(n,t,i){var r=0;return function(){var u=+new Date;u-r<t||(r=u,n.apply(i,arguments))}}var e,n,a,v,it="src",y="srcset";return function(r){var o,u,f;document.querySelectorAll||(o=document.createStyleSheet(),document.querySelectorAll=function(n,t,i,r,u){for(u=document.all,t=[],n=n.replace(/\[for\b/gi,"[htmlFor").split(","),i=n.length;i--;){for(o.addRule(n[i],"k:v"),r=u.length;r--;)u[r].currentStyle.k&&t.push(u[r]);o.removeRule(0)}return t});u=this;f=u._util={};f.elements=[];f.destroyed=!0;u.options=r||{};u.options.error=u.options.error||!1;u.options.offset=u.options.offset||100;u.options.root=u.options.root||document;u.options.success=u.options.success||!1;u.options.selector=u.options.selector||".b-lazy";u.options.separator=u.options.separator||"|";u.options.containerClass=u.options.container;u.options.container=u.options.containerClass?document.querySelectorAll(u.options.containerClass):!1;u.options.errorClass=u.options.errorClass||"b-error";u.options.breakpoints=u.options.breakpoints||!1;u.options.loadInvisible=u.options.loadInvisible||!1;u.options.successClass=u.options.successClass||"b-loaded";u.options.validateDelay=u.options.validateDelay||25;u.options.saveViewportOffsetDelay=u.options.saveViewportOffsetDelay||50;u.options.srcset=u.options.srcset||"data-srcset";u.options.src=e=u.options.src||"data-src";v=Element.prototype.closest;a=window.devicePixelRatio>1;n={};n.top=0-u.options.offset;n.left=0-u.options.offset;u.revalidate=function(){p(u)};u.load=function(n,t){var r=this.options;n&&n.length===undefined?b(n,t,r):i(n,function(n){b(n,t,r)})};u.destroy=function(){var n=u._util;u.options.container&&i(u.options.container,function(i){t(i,"scroll",n.validateT)});t(window,"scroll",n.validateT);t(window,"resize",n.validateT);t(window,"resize",n.saveViewportOffsetT);n.count=0;n.elements.length=0;n.destroyed=!0};f.validateT=tt(function(){w(u)},u.options.validateDelay,u);f.saveViewportOffsetT=tt(function(){nt(u.options.offset)},u.options.saveViewportOffsetDelay,u);nt(u.options.offset);i(u.options.breakpoints,function(n){if(n.width>=window.screen.width)return e=n.src,!1});setTimeout(function(){p(u)})}});$(document).ready(function(){InitbLazy()});InitbLazy=function(){window.bLazy=new Blazy({success:function(n){n!=undefined&&console.log("Element loaded: ",n.nodeName)},error:function(n){$(n).attr("src",window.location.protocol+"//"+window.location.host+"/Content/Images/no-image.png")}});setTimeout(window.bLazy.revalidate,100)},function(n,t){typeof define=="function"&&define.amd?define([],t):typeof module=="object"&&module.exports?module.exports=t():n.fuzzysort=t()}(this,function(){function c(v){var y={single:function(n,t,i){if(!n||(r(n)||(n=y.getPreparedSearch(n)),!t))return null;r(t)||(t=y.getPrepared(t));var u=i&&i.allowTypo!==undefined?i.allowTypo:v&&v.allowTypo!==undefined?v.allowTypo:!0,f=u?y.algorithm:y.algorithmNoTypo;return f(n,t,n[0])},go:function(n,i,f){var a,w,k,b,p,o,h,g,s;if(!n)return u;n=y.prepareSearch(n);var nt=n[0],tt=f&&f.threshold||v&&v.threshold||-2e3,it=f&&f.limit||v&&v.limit||9007199254740991,ot=f&&f.allowTypo!==undefined?f.allowTypo:v&&v.allowTypo!==undefined?v.allowTypo:!0,rt=ot?y.algorithm:y.algorithmNoTypo,c=0,d=0,ut=i.length;if(f&&f.keys){var st=f.scoreFn||l,ft=f.keys,et=ft.length;for(s=ut-1;s>=0;--s){for(p=i[s],a=new Array(et),w=et-1;w>=0;--w){if(b=ft[w],o=e(p,b),!o){a[w]=null;continue}r(o)||(o=y.getPrepared(o));a[w]=rt(n,o,nt)}(a.obj=p,k=st(a),k!==null)&&(k<tt||(a.score=k,c<it?(t.add(a),++c):(++d,k>t.peek().score&&t.replaceTop(a))))}}else if(f&&f.key)for(b=f.key,s=ut-1;s>=0;--s)(p=i[s],o=e(p,b),o)&&(r(o)||(o=y.getPrepared(o)),h=rt(n,o,nt),h!==null)&&(h.score<tt||(h={target:h.target,_targetLowerCodes:null,_nextBeginningIndexes:null,score:h.score,indexes:h.indexes,obj:p},c<it?(t.add(h),++c):(++d,h.score>t.peek().score&&t.replaceTop(h))));else for(s=ut-1;s>=0;--s)(o=i[s],o)&&(r(o)||(o=y.getPrepared(o)),h=rt(n,o,nt),h!==null)&&(h.score<tt||(c<it?(t.add(h),++c):(++d,h.score>t.peek().score&&t.replaceTop(h))));if(c===0)return u;for(g=new Array(c),s=c-1;s>=0;--s)g[s]=t.poll();return g.total=c+d,g},goAsync:function(n,t,i){var o=!1,s=new Promise(function(s,c){function b(){var ot,it,ut,et,ft,rt,h,v,st,ht;if(o)return c("canceled");if(ot=Date.now(),i&&i.keys)for(var at=i.scoreFn||l,ct=i.keys,lt=ct.length;a>=0;--a){for(rt=t[a],it=new Array(lt),ut=lt-1;ut>=0;--ut){if(ft=ct[ut],h=e(rt,ft),!h){it[ut]=null;continue}r(h)||(h=y.getPrepared(h));it[ut]=tt(n,h,d)}if((it.obj=rt,et=at(it),et!==null)&&!(et<g)&&(it.score=et,w<nt?(p.add(it),++w):(++k,et>p.peek().score&&p.replaceTop(it)),a%1e3==0&&Date.now()-ot>=10)){f?setImmediate(b):setTimeout(b);return}}else if(i&&i.key){for(ft=i.key;a>=0;--a)if((rt=t[a],h=e(rt,ft),h)&&(r(h)||(h=y.getPrepared(h)),v=tt(n,h,d),v!==null)&&!(v.score<g)&&(v={target:v.target,_targetLowerCodes:null,_nextBeginningIndexes:null,score:v.score,indexes:v.indexes,obj:rt},w<nt?(p.add(v),++w):(++k,v.score>p.peek().score&&p.replaceTop(v)),a%1e3==0&&Date.now()-ot>=10)){f?setImmediate(b):setTimeout(b);return}}else for(;a>=0;--a)if((h=t[a],h)&&(r(h)||(h=y.getPrepared(h)),v=tt(n,h,d),v!==null)&&!(v.score<g)&&(w<nt?(p.add(v),++w):(++k,v.score>p.peek().score&&p.replaceTop(v)),a%1e3==0&&Date.now()-ot>=10)){f?setImmediate(b):setTimeout(b);return}if(w===0)return s(u);for(st=new Array(w),ht=w-1;ht>=0;--ht)st[ht]=p.poll();st.total=w+k;s(st)}if(!n)return s(u);n=y.prepareSearch(n);var d=n[0],p=h(),a=t.length-1,g=i&&i.threshold||v&&v.threshold||-2e3,nt=i&&i.limit||v&&v.limit||9007199254740991,it=i&&i.allowTypo!==undefined?i.allowTypo:v&&v.allowTypo!==undefined?v.allowTypo:!0,tt=it?y.algorithm:y.algorithmNoTypo,w=0,k=0;f?setImmediate(b):b()});return s.cancel=function(){o=!0},s},highlight:function(n,t,i){var r,s;if(n===null)return null;t===undefined&&(t="<b>");i===undefined&&(i="<\/b>");var u="",e=0,f=!1,o=n.target,c=o.length,h=n.indexes;for(r=0;r<c;++r){if(s=o[r],h[e]===r){if(++e,f||(f=!0,u+=t),e===h.length){u+=s+i+o.substr(r+1);break}}else f&&(f=!1,u+=i);u+=s}return u},prepare:function(n){if(n)return{target:n,_targetLowerCodes:y.prepareLowerCodes(n),_nextBeginningIndexes:null,score:null,indexes:null,obj:null}},prepareSlow:function(n){if(n)return{target:n,_targetLowerCodes:y.prepareLowerCodes(n),_nextBeginningIndexes:y.prepareNextBeginningIndexes(n),score:null,indexes:null,obj:null}},prepareSearch:function(n){if(n)return y.prepareLowerCodes(n)},getPrepared:function(n){if(n.length>999)return y.prepare(n);var t=o.get(n);return t!==undefined?t:(t=y.prepare(n),o.set(n,t),t)},getPreparedSearch:function(n){if(n.length>999)return y.prepareSearch(n);var t=s.get(n);return t!==undefined?t:(t=y.prepareSearch(n),s.set(n,t),t)},algorithm:function(t,r,u){for(var g=r._targetLowerCodes,l=t.length,k=g.length,f=0,e=0,s=0,d=0,v,rt,ut,a,w,b,c,it,o;;){if(a=u===g[e],a){if(n[d++]=e,++f,f===l)break;u=t[s===0?f:s===f?f+1:s===f-1?f-1:f]}if(++e,e>=k)for(;;){if(f<=1)return null;if(s===0){if(--f,v=t[f],u===v)continue;s=f}else{if(s===1)return null;if(--s,f=s,u=t[f+1],v=t[f],u===v)continue}d=f;e=n[d-1]+1;break}}var f=0,h=0,nt=!1,tt=0,p=r._nextBeginningIndexes;if(p===null&&(p=r._nextBeginningIndexes=y.prepareNextBeginningIndexes(r.target)),rt=e=n[0]===0?0:p[n[0]-1],e!==k)for(;;)if(e>=k){if(f<=0){if(++h,h>l-2)break;if(t[h]===t[h+1])continue;e=rt;continue}--f;ut=i[--tt];e=p[ut]}else if(a=t[h===0?f:h===f?f+1:h===f-1?f-1:f]===g[e],a){if(i[tt++]=e,++f,f===l){nt=!0;break}++e}else e=p[e];for(nt?(w=i,b=tt):(w=n,b=d),c=0,it=-1,o=0;o<l;++o)e=w[o],it!==e-1&&(c-=e),it=e;for(nt?h!==0&&(c+=-20):(c*=1e3,s!==0&&(c+=-20)),c-=k-l,r.score=c,r.indexes=new Array(b),o=b-1;o>=0;--o)r.indexes[o]=w[o];return r},algorithmNoTypo:function(t,r,u){for(var w=r._targetLowerCodes,v=t.length,p=w.length,o=0,f=0,g=0,tt,nt,s,c,l,a,d,e;;){if(s=u===w[f],s){if(n[g++]=f,++o,o===v)break;u=t[o]}if(++f,f>=p)return null}var o=0,b=!1,k=0,h=r._nextBeginningIndexes;if(h===null&&(h=r._nextBeginningIndexes=y.prepareNextBeginningIndexes(r.target)),tt=f=n[0]===0?0:h[n[0]-1],f!==p)for(;;)if(f>=p){if(o<=0)break;--o;nt=i[--k];f=h[nt]}else if(s=t[o]===w[f],s){if(i[k++]=f,++o,o===v){b=!0;break}++f}else f=h[f];for(b?(c=i,l=k):(c=n,l=g),a=0,d=-1,e=0;e<v;++e)f=c[e],d!==f-1&&(a-=f),d=f;for(b||(a*=1e3),a-=p-v,r.score=a,r.indexes=new Array(l),e=l-1;e>=0;--e)r.indexes[e]=c[e];return r},prepareLowerCodes:function(n){for(var r=n.length,i=[],u=n.toLowerCase(),t=0;t<r;++t)i[t]=u.charCodeAt(t);return i},prepareBeginningIndexes:function(n){for(var s=n.length,u=[],h=0,f=!1,e=!1,i=0;i<s;++i){var t=n.charCodeAt(i),r=t>=65&&t<=90,o=r||t>=97&&t<=122||t>=48&&t<=57,c=r&&!f||!e||!o;f=r;e=o;c&&(u[h++]=i)}return u},prepareNextBeginningIndexes:function(n){for(var u=n.length,f=y.prepareBeginningIndexes(n),r=[],i=f[0],e=0,t=0;t<u;++t)i>t?r[t]=i:(i=f[++e],r[t]=i===undefined?u:i);return r},cleanup:a,"new":c};return y}function a(){o.clear();s.clear();n=[];i=[]}function l(n){for(var t=-2e3,r,u,i=n.length-1;i>=0;--i)(r=n[i],r!==null)&&(u=r.score,u>t&&(t=u));return t===-2e3?null:t}function e(n,t){var u=n[t],i,f,r;if(u!==undefined)return u;for(i=t,Array.isArray(t)||(i=t.split(".")),f=i.length,r=-1;n&&++r<f;)n=n[i[r]];return n}function r(n){return typeof n=="object"}var f=typeof require!="undefined"&&typeof window=="undefined",o=new Map,s=new Map,u=[],n,i,h,t;return u.total=0,n=[],i=[],h=function(){function r(){for(var f,u,i=0,e=n[i],r=1;r<t;)f=r+1,i=r,f<t&&n[f].score<n[r].score&&(i=f),n[i-1>>1]=n[i],r=1+(i<<1);for(u=i-1>>1;i>0&&e.score<n[u].score;u=(i=u)-1>>1)n[i]=n[u];n[i]=e}var n=[],t=0,i={};return i.add=function(i){var r=t,u;for(n[t++]=i,u=r-1>>1;r>0&&i.score<n[u].score;u=(r=u)-1>>1)n[r]=n[u];n[r]=i},i.poll=function(){if(0!==t){var i=n[0];return n[0]=n[--t],r(),i}},i.peek=function(){if(0!==t)return n[0]},i.replaceTop=function(t){n[0]=t;r()},i},t=h(),c()}),function(n){n.LogoUploaderAllowedImageExtensions=["png","jpg","jpeg","ai","eps","tiff","gif"]}(CustomConstant||(CustomConstant={})),function(n,t){typeof exports=="object"&&typeof module!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()}(this,function(){"use strict";function f(n){var t=this.constructor;return this.then(function(i){return t.resolve(n()).then(function(){return i})},function(i){return t.resolve(n()).then(function(){return t.reject(i)})})}function e(n){var t=this;return new t(function(t,i){function e(n,i){if(i&&(typeof i=="object"||typeof i=="function")){var u=i.then;if(typeof u=="function"){u.call(i,function(t){e(n,t)},function(i){r[n]={status:"rejected",reason:i};--f==0&&t(r)});return}}r[n]={status:"fulfilled",value:i};--f==0&&t(r)}var r,f,u;if(!(n&&typeof n.length!="undefined"))return i(new TypeError(typeof n+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));if(r=Array.prototype.slice.call(n),r.length===0)return t([]);for(f=r.length,u=0;u<r.length;u++)e(u,r[u])})}function o(n){return Boolean(n&&typeof n.length!="undefined")}function l(){}function a(n,t){return function(){n.apply(t,arguments)}}function n(t){if(!(this instanceof n))throw new TypeError("Promises must be constructed via new");if(typeof t!="function")throw new TypeError("not a function");this._state=0;this._handled=!1;this._value=undefined;this._deferreds=[];h(t,this)}function s(t,u){while(t._state===3)t=t._value;if(t._state===0){t._deferreds.push(u);return}t._handled=!0;n._immediateFn(function(){var n=t._state===1?u.onFulfilled:u.onRejected,f;if(n===null){(t._state===1?r:i)(u.promise,t._value);return}try{f=n(t._value)}catch(e){i(u.promise,e);return}r(u.promise,f)})}function r(t,r){try{if(r===t)throw new TypeError("A promise cannot be resolved with itself.");if(r&&(typeof r=="object"||typeof r=="function")){var f=r.then;if(r instanceof n){t._state=3;t._value=r;u(t);return}if(typeof f=="function"){h(a(f,r),t);return}}t._state=1;t._value=r;u(t)}catch(e){i(t,e)}}function i(n,t){n._state=2;n._value=t;u(n)}function u(t){t._state===2&&t._deferreds.length===0&&n._immediateFn(function(){t._handled||n._unhandledRejectionFn(t._value)});for(var i=0,r=t._deferreds.length;i<r;i++)s(t,t._deferreds[i]);t._deferreds=null}function v(n,t,i){this.onFulfilled=typeof n=="function"?n:null;this.onRejected=typeof t=="function"?t:null;this.promise=i}function h(n,t){var u=!1;try{n(function(n){u||(u=!0,r(t,n))},function(n){u||(u=!0,i(t,n))})}catch(f){if(u)return;u=!0;i(t,f)}}var c=setTimeout,t;n.prototype["catch"]=function(n){return this.then(null,n)};n.prototype.then=function(n,t){var i=new this.constructor(l);return s(this,new v(n,t,i)),i};n.prototype["finally"]=f;n.all=function(t){return new n(function(n,i){function e(t,u){try{if(u&&(typeof u=="object"||typeof u=="function")){var o=u.then;if(typeof o=="function"){o.call(u,function(n){e(t,n)},i);return}}r[t]=u;--f==0&&n(r)}catch(s){i(s)}}var r,f,u;if(!o(t))return i(new TypeError("Promise.all accepts an array"));if(r=Array.prototype.slice.call(t),r.length===0)return n([]);for(f=r.length,u=0;u<r.length;u++)e(u,r[u])})};n.allSettled=e;n.resolve=function(t){return t&&typeof t=="object"&&t.constructor===n?t:new n(function(n){n(t)})};n.reject=function(t){return new n(function(n,i){i(t)})};n.race=function(t){return new n(function(i,r){if(!o(t))return r(new TypeError("Promise.race accepts an array"));for(var u=0,f=t.length;u<f;u++)n.resolve(t[u]).then(i,r)})};n._immediateFn=typeof setImmediate=="function"&&function(n){setImmediate(n)}||function(n){c(n,0)};n._unhandledRejectionFn=function(n){typeof console!="undefined"&&console&&console.warn("Possible Unhandled Promise Rejection:",n)};t=function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("unable to locate global object");}();typeof t.Promise!="function"?t.Promise=n:(t.Promise.prototype["finally"]||(t.Promise.prototype["finally"]=f),t.Promise.allSettled||(t.Promise.allSettled=e))});CustomDelegateApproval=function(){function n(){}return n.prototype.PageScripts=function(){n.prototype.OnLoadScripts()},n.prototype.OnLoadScripts=function(){$("#frmDelegate").removeData("validator");$("#frmDelegate").removeData("unobtrusiveValidation");$.validator.unobtrusive.parse("#frmDelegate");$("#frmDelegate").validate();var t=new Date,i=$("#valFromDate").datepicker({dateFormat:"mm/dd/yy",minDate:t,onSelect:function(n,t){var r=$.datepicker.parseDate(t.settings.dateFormat,n,t.settings);i.not(this).datepicker("option","minDate",r)}}),r=$("#valToDate").datepicker({dateFormat:"mm/dd/yy",minDate:t,onSelect:function(n,t){var i=$.datepicker.parseDate(t.settings.dateFormat,n,t.settings);r.not(this).datepicker("option","maxDate",i)}});n.prototype.DisableFieldsforUpdatecall();$("#frmDelegate").submit(function(){$("#frmDelegate").valid()&&$("#btnUpdateDelegate").prop("disabled",!0).addClass("disabled")})},n.prototype.DisableFieldsforUpdatecall=function(){var n=$("#UserApproverId").val();n!=""&&n!=null&&($("#valSchwabId").prop("readonly",!0).addClass("readonly"),$("#valSchwabEmail").prop("readonly",!0).addClass("readonly"))},n.prototype.UpdateDelegateSuccess=function(n){n.status?($("#custom-modal").find("#custom-content").empty(),$("#custom-modal").modal("hide"),window.location.href="/user/quoteapprovalhistory"):($("#customErrorMessage").html(n.message),$("#btnUpdateDelegate").prop("disabled",!1).removeClass("disabled"));ZnodeNotification.prototype.DisplayNotificationMessagesHelper(n.message,n.status?"success":"error",isFadeOut,fadeOutTime)},n}();$(document).ready(function(){CustomDelegateApproval.prototype.PageScripts();var n=new ZnodeNotification;n.DisplayNotificationMessages()})