(function(n,t){"use strict";n.bindingHandlers.tooltip={init:function(t,i){var r=n.utils.unwrapObservable(i());$(t).tooltip({title:r})}};t.viewModels.OrderTotalViewModel=function(i,r,u,f){this.lineItems=i;this.cartServices=u||[];this.shippingAmount=n.observable(0);this.discountPercent=n.observable(0);this.handlingAmount=n.observable(0);this.taxAmount=n.observable(0);this.itemsSubTotal=n.observable(0);this.subTotal=n.observable(0);this.total=n.observable(0);this.discountAmount=n.observable(0);this.accessoryOnly=r;this.saved=n.pureComputed(function(){var t=n.unwrap(this.lineItems).reduce(function(t,i){return t+n.unwrap(i.regularTotal)-n.unwrap(i.total)},0)||0,i=n.unwrap(this.cartServices).reduce(function(t,i){return t+n.unwrap(i.regularPrice)-n.unwrap(i.price)},0)||0;return Math.max(0,t)+Math.max(0,i)},this);this.discountAmountDisplay=n.pureComputed(function(){return n.unwrap(this.discountAmount)*-1},this);this.itemsDiscountAmountDisplay=n.pureComputed(function(){return n.unwrap(this.discountPercent)/100*n.unwrap(this.itemsSubTotal)*-1},this);this.itemsTotal=n.pureComputed(function(){return n.unwrap(this.itemsSubTotal)+n.unwrap(this.itemsDiscountAmountDisplay)},this);this.isCheckOrDeposit=n.pureComputed(function(){var t=n.unwrap(this.lineItems);return t.reduce(function(t,i){return t&&n.unwrap(i.isCheckOrDeposit)},!0)&&t.length!=0},this);this.checksCount=n.pureComputed(function(){return n.unwrap(this.lineItems).reduce(function(t,i){return t+(i.isCheckOrDeposit()?n.unwrap(i.quantity):0)},0)},this);this.accessoriesCount=n.pureComputed(function(){return n.unwrap(this.lineItems).reduce(function(t,i){return t+(i.isAccessory()?n.unwrap(i.quantity):0)},0)},this);this.handlingPerBox=n.pureComputed(function(){return!n.unwrap(this.isCheckOrDeposit)&&(n.unwrap(this.isCheckOrDeposit)||n.unwrap(this.accessoryOnly))?(+n.unwrap(this.handlingAmount)||0)/n.unwrap(this.accessoriesCount):(+n.unwrap(this.handlingAmount)||0)/n.unwrap(this.checksCount)},this);this.handlingTooltipText=n.pureComputed(function(){var t="Handling. A required handling fee of $"+n.unwrap(this.handlingPerBox).toFixed(2)+(n.unwrap(this.accessoryOnly)?" per unit":" per box/item")+" is assessed to every order placed with Checks Unlimited.",i="<div class='h4'>Handling<\/div>A required handling fee of $"+n.unwrap(this.handlingPerBox).toFixed(2)+(n.unwrap(this.accessoryOnly)?" per unit":" per box/item")+" is assessed to every order placed with Checks Unlimited.";return $(".info").attr("aria-label",t),t,i},this);this.update=function(n){t.utils.updateViewModel(this,n)};this.update(f)}})(ko,ChecksUnlimitedApp),function(n,t){t.viewModels.OfferViewModel=function(t,i){this.options=$.extend({onApplied:$.noop,onRemoved:$.noop},t);this.offerApplied=n.observable(!1);i||ChecksUnlimitedApp.pageData.userEnteredOffer&&(i=ChecksUnlimitedApp.pageData.userEnteredOffer,this.offerApplied(!0));var u=$('input[name="__RequestVerificationToken"]').val(),r={};r.__RequestVerificationToken=u;this.keycode=n.observable("");this.description=n.observable("");this.userEnteredKeycode=n.observable("");this.userEnteredInvalidKeycode=n.observable("");this.offerBlockVisible=n.observable(!0);this.loading=n.observable(!1);this.userEnteredOffer=n.observable(ChecksUnlimitedApp.pageData.userEnteredOffer||{});this.manageOrderOffer=n.observable(ChecksUnlimitedApp.pageData.manageOrderOffer||{});this.upsellOffer=n.observable(ChecksUnlimitedApp.pageData.upsellOffer);this.upsellOfferAvailable=n.observable(!!this.upsellOffer());this.introAbuseSaveKeyCode=n.observable(ChecksUnlimitedApp.pageData.introAbuseSaveKeyCode);this.upsellOfferApplied=n.observable(ChecksUnlimitedApp.pageData.isUpsellActive);this.toggleOfferBlockVisible=function(){this.offerBlockVisible(!this.offerBlockVisible())}.bind(this);this.introAbuseAvailable=n.pureComputed(function(){return this.manageOrderOffer().introAbuse&&this.userEnteredOffer()},this);this.introAbuseText=n.pureComputed(function(){return this.introAbuseAvailable()?"for return customers only! "+this.manageOrderOffer().introAbuseOffer.description:""},this);this.hasAnyOffer=n.pureComputed(function(){return n.unwrap(this.userEnteredKeycode)||n.unwrap(this.upsellOfferApplied)},this);this.userEnteredKeycode.showError=n.observable(!1);this.applyOffer=function(){var t=n.unwrap(this.userEnteredKeycode)||n.unwrap(this.keycode)||"";if(t.length!==4){this.userEnteredKeycode.showError(!0);this.options.onApplied(!1);return}return $.Deferred($.proxy(function(t){this.loading(!0);var i=n.unwrap(this.userEnteredKeycode)||n.unwrap(this.keycode)||"";$.ajax({url:"/offer/api/applyoffer",type:"POST",data:{offercode:i},dataType:"json",headers:r,context:this}).done(function(n){if(n&&(n.Keycode||n.OrderBlankCode)){this.update(n);this.userEnteredKeycode.showError(!1);n.Keycode===null?this.userEnteredKeycode(n.OrderBlankCode,n):this.userEnteredKeycode(n.Keycode,n);t.resolve(!0);this.options.onApplied(!0,n);this.offerBlockVisible(!1);try{_satellite.track("apply_offer_code",{code:i})}catch(r){console.error("The tracking data for Adobe has been fallen. "+r)}}else{this.userEnteredInvalidKeycode(this.userEnteredKeycode());this.userEnteredKeycode(n.Keycode);this.userEnteredKeycode.showError(!0);t.reject(!1);this.options.onApplied(!1);try{_satellite.track("offer_code_error_message",{message:"Your offer code "+i+" is invalid or is no longer active."})}catch(r){console.error("The tracking data for Adobe has been fallen. "+r)}}}).fail(function(){t.reject(!1,arguments);this.options.onApplied(!1);try{_satellite.track("offer_code_error_message",{message:"Your offer code "+i+" is invalid or is no longer active."})}catch(n){console.error("The tracking data for Adobe has been fallen. "+n)}}).always(function(){this.loading(!1)})},this))};this.applyUpsellOffer=function(){return $.Deferred($.proxy(function(n){this.loading(!0);$.ajax({url:"/offer/api/applyupselloffer",type:"POST",dataType:"json",headers:r,context:this}).done(function(t){if(t){this.update(t);n.resolve(!0);this.options.onApplied(!0,t);this.userEnteredKeycode(null);this.offerBlockVisible(!1);this.upsellOfferAvailable(!1)}else{n.reject(!1);this.options.onApplied(!1)}}).fail(function(){n.reject(!1,arguments);this.options.onApplied(!1)}).always(function(){this.loading(!1)})},this))};this.removeOffer=function(){return $.Deferred($.proxy(function(n){this.loading(!0);$.ajax({url:"/offer/api/removeoffer",type:"POST",dataType:"json",headers:r,context:this,cache:!1}).done(function(n){this.update(n);this.userEnteredKeycode(null);this.offerApplied(!1);this.upsellOfferApplied(!1);this.options.onRemoved(!0,arguments);this.upsellOfferAvailable()&&this.getUpdatedUpsellOffer()}).fail(function(){n.reject(!1,arguments);this.options.onRemoved(!1,arguments)}).always(function(){this.loading(!1)})},this))};this.update=function(t){if(t&&(ChecksUnlimitedApp.utils.updateViewModel(this,t),this.userEnteredOffer(t)),this.userEnteredOffer()){var r=this.userEnteredOffer().keycode||this.userEnteredOffer().Keycode,i=this.userEnteredOffer().orderBlankCode||this.userEnteredOffer().OrderBlankCode;this.userEnteredKeycode.showError()&&(i=this.userEnteredInvalidKeycode());r?(this.userEnteredKeycode(r),this.description(this.description()||r)):i?(this.userEnteredKeycode(i),this.description(this.description()||"Your offer code "+i)):!this.upsellOfferApplied()&&this.keycode()&&this.userEnteredKeycode(this.keycode())}this.offerApplied(!!n.unwrap(this.keycode)||!!n.unwrap(this.userEnteredKeycode))};this.getUpdatedUpsellOffer=function(){return $.Deferred($.proxy(function(){this.loading(!0);$.ajax({url:"/offer/api/getupselloffer",type:"POST",dataType:"json",headers:r,context:this}).done(function(n){this.upsellOffer(n);this.upsellOfferAvailable(!0)}).always(function(){this.loading(!1)})},this))};this.update(i)}}(ko,ChecksUnlimitedApp),function(){ChecksUnlimitedApp.viewModels.CrossSellItem=function(n){this.virtualProductId=ko.observable(0);this.productCode=ko.observable("");this.productSubType=ko.observable("");this.productType=ko.observable("");this.name=ko.observable("");this.price=ko.observable(0);this.regularPrice=ko.observable(0);this.images=ko.observableArray([]);this.altTagText=ko.observable("");this.loading=ko.observable(!1);this.firstImage=ko.pureComputed(function(){return ko.unwrap(this.images)[0]||"missing"},this);this.hasDiscount=ko.pureComputed(function(){return ko.unwrap(this.regularPrice)==ko.unwrap(this.price)},this);this.dataTarget=ko.pureComputed(function(){return"recommend_"+ko.unwrap(this.productCode)},this);this.multipleImage=ko.pureComputed(function(){return ko.unwrap(this.images).length!=1},this);this.isLabel=ko.pureComputed(function(){return ko.unwrap(this.productSubType)=="L"},this);this.update=function(n){ChecksUnlimitedApp.utils.updateViewModel(this,n)};this.update(n)};ChecksUnlimitedApp.viewModels.CrossSellItems=function(n){this.items=ko.observableArray([]);this.oneClickLabels=ko.observableArray([]);this.crossSellProductCodes=ko.pureComputed(function(){return ko.utils.arrayMap(ko.unwrap(this.items),function(n){return ko.unwrap(n.productCode)})},this);this.update=function(n){$.isArray(n)&&this.items(ko.utils.arrayMap(n,function(n){return new ChecksUnlimitedApp.viewModels.CrossSellItem(n)}))};var i=$('input[name="__RequestVerificationToken"]').val(),t={};t.__RequestVerificationToken=i;this.updateCrossSellItems=function(){return $.ajax({traditional:!0,url:"/product/api/getcrosssellpricing",type:"GET",data:{crossSellProductCodes:ko.unwrap(this.crossSellProductCodes)},dataType:"json",context:this,headers:t,cache:!1}).done(function(n){ko.utils.arrayForEach(ko.unwrap(this.items),function(t){var r=ko.unwrap(t.productCode),i=ko.utils.arrayFirst(n,function(n){return n.productCode==r});return i&&t.price(i.price),t})})};this.update(n)}}(),function(n,t){"use strict";t.viewModels.EnhancementViewModel=function(i){this.enhancementId=n.observable(0);this.type=n.observable("");this.name=n.observable("");this.price=n.observable(0);this.regularPrice=n.observable(0);this.monogramLetters=n.observable("");this.internetImage=n.observable("");this.previewSrc=n.observable("");this.customizable=n.observable(!1);this.textLine1=n.observable("");this.textLine2=n.observable("");this.case=n.observable("");this.productCode=n.observable("");this.printSequence=n.pureComputed(function(){return n.utils.arrayIndexOf(this.options.displayEnhancementTypes,n.unwrap(this.type))},this);this.displayed=n.pureComputed(function(){return n.unwrap(this.printSequence)!=-1},this);this.hasSale=n.pureComputed(function(){return n.unwrap(this.regularPrice)!=n.unwrap(this.price)},this);this.textDisplay=n.pureComputed(function(){var t="",i=n.unwrap(this.name);switch(n.unwrap(this.type)){case"F":n.unwrap(this.regularPrice)&&(t="Custom Font: ",i=n.unwrap(this.internetImage));break;case"S":t="Symbol: ";break;case"MS":t="Monogram: ";i=n.unwrap(this.monogramLetters);break;case"M":t=n.unwrap(this.customizable)?"":"MyLines&trade;: "}return t+i},this);this.update=function(n){t.utils.updateViewModel(this,n)};this.update(i)};t.viewModels.EnhancementViewModel.prototype.options={displayEnhancementTypes:["MS","F","S","M"]}}(ko,ChecksUnlimitedApp),function(n,t){"use strict";t.viewModels.WysiwygTemplate=function(i){i=$.extend({checkDetail:{}},i);this.id=n.observable(0);this.bold=n.observable(!1);this.fontSize=n.observable(7);this.imprintPresent=n.observable(!1);this.justification=n.observable("");this.verticalAlignment=n.observable("");this.fontName=n.observable("");this.monogramFontName=n.observable("");this.textCenter=n.pureComputed(function(){return n.unwrap(this.justification)=="C"||n.unwrap(this.justification)=="center"},this);this.textBottom=n.pureComputed(function(){return n.unwrap(this.verticalAlignment)=="B"||n.unwrap(this.verticalAlignment)=="bottom"},this);this.update=function(n){t.utils.updateViewModel(this,n)};this.update(i)}}(ko,ChecksUnlimitedApp),function(n,t){"use strict";t.viewModels.CheckPreviewViewModel=function(i){i=$.extend({checkDetail:{}},i);var f="Optima",r=10.5,u={artisan:-.75,contempo:-.5,windsor:.5};this.type=n.observable("");this.subTtype=n.observable("");this.productPreviewSrc=n.observable("");this.photoProductPreviewSrc=n.observable("");this.checkDetail=$.extend({accountCode:n.observable(""),bankCode:n.observable(""),startingNumber:n.observable("")},i.checkDetail);this.enhancements=n.isObservable(i.enhancements)?i.enhancements:n.observableArray([]);this.textLines=n.isObservable(i.textLines)?i.textLines:n.observableArray([]);this.wysiwygTemplate=new t.viewModels.WysiwygTemplate;this.productCode=n.isObservable(i.productCode)?i.productCode:n.observable("");this.withMonogram=n.isObservable(i.withMonogram)?i.withMobogram:n.observable(!1);this.productType=n.observable(i.productType);this.nameFocused=n.observable(!1);this.secondNameFocused=n.observable(!1);this.optionalLineFocused=n.observable(!1);this.streetAddressFocused=n.observable(!1);this.cityFocused=n.observable(!1);this.stateFocused=n.observable(!1);this.zipCodeFocused=n.observable(!1);this.routingNumberFocused=n.observable(!1);this.accountNumberFocused=n.observable(!1);this.startingNumberFocused=n.observable(!1);this.nameLinesCount=n.observable(1);this.personalInfoFocused=n.pureComputed(function(){return n.unwrap(this.nameFocused)||n.unwrap(this.secondNameFocused)||n.unwrap(this.optionalLineFocused)||n.unwrap(this.streetAddressFocused)||n.unwrap(this.cityFocused)||n.unwrap(this.stateFocused)||n.unwrap(this.zipCodeFocused)},this);this.isCheck=n.pureComputed(function(){return n.unwrap(this.type)=="C"},this);this.startingNumberVisible=n.pureComputed(function(){return(n.unwrap(this.checkDetail.startingNumber)||"").toString().trim().length>2&&n.unwrap(this.productType)!=="D"},this);this.baseLineFontSize=n.pureComputed(function(){var f=r,i=t.utils.sortBy(n.utils.arrayFilter(n.unwrap(this.textLines),function(n){return n.type=="C"&&(n.printSequence==1||n.printSequence==2)}),"printSequence"),e;return i.length>1&&(i[0].bold!==i[1].bold||i[0].size!==i[1].size)&&(i=i.slice(0,1)),i[1]!=undefined&&i[1].text.length>0&&(f=r-2),this.fontEnhancement()!=null&&(e=n.unwrap(this.fontEnhancement).name().split(" ")[0].toLowerCase(),u.hasOwnProperty(e)&&(f+=u[e])),f},this);this.customerLinesFontSize=n.pureComputed(function(){var i=this.baseLineFontSize()-1,r=t.utils.sortBy(n.utils.arrayFilter(n.unwrap(this.textLines).slice(this.nameLinesCount),function(n){return(n.type=="C"||n.type=="P")&&n.text}),"printSequence"),u=r.length;return r.length>2&&(i-=2),i},this);this.nameLines=n.pureComputed(function(){var i=t.utils.sortBy(n.utils.arrayFilter(n.unwrap(this.textLines),function(n){return n.type=="C"&&(n.printSequence==1||n.printSequence==2)}),"printSequence");return i.length>1&&(i[0].bold!==i[1].bold||i[0].size!==i[1].size)&&(i=i.slice(0,1)),this.nameLinesCount=i.length,n.utils.arrayMap(i,function(n){return!n||!n.text?null:n.text}.bind(this))},this);this.fontEnhancement=n.pureComputed(function(){return n.utils.arrayFirst(n.unwrap(this.enhancements),function(t){return n.unwrap(t.type)=="F"})},this);this.symbolEnhancement=n.pureComputed(function(){return n.utils.arrayFirst(n.unwrap(this.enhancements),function(t){return n.unwrap(t.type)=="S"})},this);this.monogramEnhancement=n.pureComputed(function(){return n.utils.arrayFirst(n.unwrap(this.enhancements),function(t){return n.unwrap(t.type)=="MS"})},this);this.myLineEnhancement=n.pureComputed(function(){return n.utils.arrayFirst(n.unwrap(this.enhancements),function(t){return n.unwrap(t.type)=="M"})},this);this.fontName=n.pureComputed(function(){return n.unwrap((n.unwrap(this.fontEnhancement)||{}).internetImage)||"Open Sans"},this);this.fontCase=n.pureComputed(function(){return n.unwrap((n.unwrap(this.fontEnhancement)||{}).case)||"U"},this);this.customerLines=n.pureComputed(function(){var i=t.utils.sortBy(n.utils.arrayFilter(n.unwrap(this.textLines).slice(this.nameLinesCount),function(n){return(n.type=="C"||n.type=="P")&&n.text}),"printSequence"),r=i.length;return n.utils.arrayMap(i,function(n){return!n||!n.text?null:n.text}.bind(this))},this);this.symbolSrc=n.pureComputed(function(){return n.unwrap((n.unwrap(this.symbolEnhancement)||{}).previewSrc)},this);this.monogramSrc=n.pureComputed(function(){var i=n.unwrap((n.unwrap(this.monogramEnhancement)||{}).monogramLetters),r="";return i&&n.unwrap(this.productCode)&&(r=t.utils.getMonogramLetterImageUrl(n.unwrap(this.productCode),i)),r},this);this.nameLinesSrc=n.pureComputed(function(){var i=n.unwrap(this.nameLines).join("\n");return t.utils.makeImageRenderUrl(i,this.fontName,this.baseLineFontSize,this.fontCase,!0)},this);this.personalInfoSrc=n.pureComputed(function(){var i=n.unwrap(this.customerLines).join("\n");return t.utils.makeImageRenderUrl(i,this.fontName,this.customerLinesFontSize,this.fontCase,!1)},this);this.startingNumberSrc=n.pureComputed(function(){return t.utils.makeImageRenderUrl(this.checkDetail.startingNumber,f,10,"N",!0)},this);this.myLineMessageSrc=n.pureComputed(function(){var i=n.unwrap(this.myLineEnhancement)||{},r=n.utils.arrayFirst(n.unwrap(this.textLines),function(n){return n.type=="S"})||{},u=n.unwrap(i.customizable)?n.unwrap(r.text):[n.unwrap(i.textLine1)||"",n.unwrap(i.textLine2)||""].join("\n");return t.utils.makeImageRenderUrl(u,this.fontName,10,this.fontCase()==="U"?"U":"N",!1)},this);this.micrLineBCSrc=n.pureComputed(function(){return t.utils.makeImageRenderUrl("A123456789A","MICR",13,"N",!0)},this);this.micrLineACSrc=n.pureComputed(function(){return t.utils.makeImageRenderUrl("123456C","MICR",13,"N",!0)},this);this.micrLineStartingNumberSrc=n.pureComputed(function(){return t.utils.makeImageRenderUrl("101","MICR",13,"N",!0)},this);this.update=function(i){t.utils.updateViewModel(this,i,{checkDetail:function(i,r,u){t.utils.updateViewModel(this.checkDetail,n.toJS(u))},enhancements:function(i,r,u){n.isWriteableObservable(this.enhancements)&&this.enhancements(n.utils.arrayMap(u,function(n){return new t.viewModels.EnhancementViewModel(n)}))}})};this.update(i)}}(ko,ChecksUnlimitedApp),function(n,t){"use strict";t.viewModels.AccessoryLineViewModel=function(i){this.printSequence=n.observable(0);this.maximumCharacters=n.observable(0);this.required=n.observable(!1);this.text=n.observable("");this.fontName=n.observable("");this.fontSize=n.observable(12);this.bold=n.observable(!1);this.case=n.observable("");this.obsceneTextFound=n.observable(!1);this.isEmptyText=n.pureComputed(function(){var t=n.unwrap(this.text);return t!=null?!t.length>0:!0},this);this.displayLineText=n.pureComputed(function(){return t.utils.makeImageRenderUrl(this.text,this.fontName,this.fontSize,this.case,this.bold)},this);this.isRequired=n.pureComputed(function(){return n.unwrap(this.required)||n.unwrap(this.printSequence)==1},this);this.inputPrintSequenceName=n.pureComputed(function(){return"lines["+(n.unwrap(this.printSequence)-1)+"][printSequence]"},this);this.inputTextAttr=n.pureComputed(function(){var t=n.unwrap(this.isRequired),i=n.unwrap(this.maximumCharacters),r=["The line",n.unwrap(this.printSequence),"is required."].join(" "),u=["The line",n.unwrap(this.printSequence),"is too long."].join(" ");return{name:"lines["+(n.unwrap(this.printSequence)-1)+"][text]",maxlength:i,"data-val":"true","data-val-length-max":i,"data-val-length":u,"data-val-required":t?r:!1,"data-val-regex":r,"data-val-regex-pattern":t?"\\s*(\\S+\\s*)+":!1}},this);this.title=n.pureComputed(function(){var t="Limit "+n.unwrap(this.maximumCharacters)+" characters and/or spaces.",i="<h4>Line "+n.unwrap(this.printSequence)+"<\/h4><p>Limit "+n.unwrap(this.maximumCharacters)+" characters and/or spaces.<\/p>";return $(".info").attr("aria-label",t),t,i},this);var u=$('input[name="__RequestVerificationToken"]').val(),r={};r.__RequestVerificationToken=u;this.isValid=n.pureComputed(function(){var t=n.unwrap(this.text)||"",i=!1,u=$.ajax({method:"GET",url:"/validation/CheckVulgar",async:!1,data:{vulgarText:n.unwrap(this.text)},headers:r,context:this});return u.responseText=="true"?(i=!0,this.obsceneTextFound(!1)):this.obsceneTextFound(!0),(!n.unwrap(this.isRequired)||!!t&&t.length<=n.unwrap(this.maximumCharacters))&&i},this);this.update=function(n){t.utils.updateViewModel(this,n)};this.update(i)}}(ko,ChecksUnlimitedApp),function(n,t){"use strict";t.viewModels.AccessoryPreviewViewModel=function(i){i=$.extend({},i);var u=60,r={"libre baskerville italic":-5};this.type=n.isObservable(i.type)?i.type:n.observable("");this.subType=n.isObservable(i.subType)?i.subType:n.observable("");this.productPreviewSrc=n.isObservable(i.productPreviewSrc)?i.productPreviewSrc:n.observable("");this.photoProductPreviewSrc=n.isObservable(i.photoProductPreviewSrc)?i.photoProductPreviewSrc:n.observable("");this.withMonogram=n.isObservable(i.withMonogram)?i.withMonogram:n.observable(!1);this.monogramLetters=n.isObservable(i.monogramLetters)?i.monogramLetters:n.observable("");this.textLines=n.isObservable(i.textLines)?i.textLines:n.observableArray([]);this.wysiwygTemplate=new t.viewModels.WysiwygTemplate(i.wysiwygTemplate);this.stamperPreviewSrc=n.isObservable(i.stamperPreviewSrc)?i.stamperPreviewSrc:n.observable("");this.stamperSymbolSrc=n.isObservable(i.stamperSymbolSrc)?i.stamperSymbolSrc:n.observable("");this.monogramFontSize=n.pureComputed(function(){var t=u,i=n.unwrap(this.wysiwygTemplate.monogramFontName).toLowerCase();return r.hasOwnProperty(i)&&(t+=r[i]),t},this);this.isSimpleLabel=n.pureComputed(function(){return n.unwrap(this.isLabel)&&!n.unwrap(this.photoProductPreviewSrc)||n.unwrap(this.isStamper)},this);this.isPhotoLabel=n.pureComputed(function(){return n.unwrap(this.isLabel)&&n.unwrap(this.photoProductPreviewSrc)},this);this.isLabel=n.pureComputed(function(){return n.unwrap(this.subType)=="L"||n.unwrap(this.subType)=="N"},this);this.isCover=n.pureComputed(function(){return n.unwrap(this.subType)=="B"},this);this.isStamper=n.pureComputed(function(){return n.unwrap(this.subType)=="S"},this);this.monogramSrc=n.pureComputed(function(){var i=n.unwrap(this.monogramLetters);return i?t.utils.makeImageRenderUrl(i,this.wysiwygTemplate.monogramFontName,n.unwrap(this.monogramFontSize),"N",!0):null},this);this.leftTextPadding=n.pureComputed(function(){return n.unwrap(this.withMonogram)||n.unwrap(this.monogramSrc)||n.unwrap(this.wysiwygTemplate.imprintPresent)},this);this.hideMonogramStampWrapper=n.pureComputed(function(){return!(n.unwrap(this.monogramSrc)||n.unwrap(this.stamperSymbolSrc))},this);this.requiresDescenderAdjustment=n.pureComputed(function(){return n.unwrap(this.isLabel)&&n.unwrap(this.monogramLetters)=="Q"&&n.unwrap(this.wysiwygTemplate.monogramFontName).toLowerCase()=="ledger"},this);this.requiresProportionAdjustment=n.pureComputed(function(){return n.unwrap(this.isLabel)&&n.unwrap(this.monogramLetters)=="W"&&n.unwrap(this.wysiwygTemplate.monogramFontName).toLowerCase()=="ledger"},this);this.isLeftImprintLabel=n.pureComputed(function(){return n.unwrap(this.isLabel)&&n.unwrap(this.wysiwygTemplate.imprintPresent)},this);this.isTopImprintLabel=n.pureComputed(function(){var t=0;return n.unwrap(this.textLines)!=undefined&&n.unwrap(this.textLines)!=null&&(t=n.unwrap(this.textLines).length),n.unwrap(this.isLabel)&&!n.unwrap(this.wysiwygTemplate.imprintPresent)&&t==2},this);this.requiresAdditionalTopSpacing=n.pureComputed(function(){return n.unwrap(this.wysiwygTemplate.monogramFontName)=="Canterbury"&&n.unwrap(this.monogramSrc)},this);this.isCenteredLabelWithoutImprint=n.pureComputed(function(){return n.unwrap(this.isLabel)&&!n.unwrap(this.wysiwygTemplate.imprintPresent)&&!n.unwrap(this.monogramSrc)&&n.unwrap(this.wysiwygTemplate.textCenter)&&!n.unwrap(this.isTopImprintLabel)},this);this.requiresAdditionalMonogramAdjustment=n.pureComputed(function(){var t=0;return n.unwrap(this.textLines)!=undefined&&n.unwrap(this.textLines)!=null&&(t=n.unwrap(this.textLines).length),n.unwrap(this.monogramSrc)&&t==4},this);this.update=function(i){var r=i.wysiwygTemplate;t.utils.updateViewModel(this,n.toJS(i),{textLines:function(i,u,f){n.isWriteableObservable(this.textLines)&&this.textLines(n.utils.arrayMap(f,function(n){return new t.viewModels.AccessoryLineViewModel($.extend(n,r,f.case))}))}})};this.update(i)}}(ko,ChecksUnlimitedApp),function(n,t,i){"use strict";i.viewModels.AccessoryPersonalizationViewModel=function(r){r=n.extend(r,{});var u=this;this.name=t.observable(r.name);this.productPreviewSrc=t.observable(r.productPreviewSrc);this.photoProductPreviewSrc=t.observable(r.photoProductPreviewSrc);this.withBlankLines=t.observable(r.withBlankLines);this.withMonogram=t.observable(r.withMonogram);this.personalizeLines=t.observable(!0);this.selectedMonogram=t.observable(r.monogramLetter);this.notSelectedMonogram=t.observable(!1);this.textLineSpecs=t.observableArray([]);this.isStamper=t.observable(r.isStamper);this.stamperPreviewSrc=t.observable(r.stamperPreviewSrc);this.wysiwygTemplate=r.wysiwygTemplate;this.stamperSymbolSrc=t.observable(r.stamperSymbolSrc);this.gift=t.observable(r.gift);this.initLoading=t.observable(!0);this.textLines=t.pureComputed(function(){return t.unwrap(this.personalizeLines)?t.unwrap(this.textLineSpecs):[]},this);this.accessoryPreview=new i.viewModels.AccessoryPreviewViewModel({productPreviewSrc:this.productPreviewSrc,photoProductPreviewSrc:this.photoProductPreviewSrc,withMonogram:this.withMonogram,monogramLetters:this.selectedMonogram,textLines:this.textLines,wysiwygTemplate:this.wysiwygTemplate,isStamper:this.isStamper,stamperPreviewSrc:this.stamperPreviewSrc,subType:r.subType,stamperSymbolSrc:this.stamperSymbolSrc});this.allLinesValid=t.pureComputed(function(){return t.unwrap(this.textLines).reduce(function(n,i){return n&&t.unwrap(i.isValid)},!0)},this);this.isValid=t.pureComputed(function(){return t.unwrap(this.allLinesValid)&&(!t.unwrap(this.withMonogram)||!!t.unwrap(this.selectedMonogram))},this);this.displayBlankOption=t.pureComputed(function(){return t.unwrap(this.gift)=="Y"?!1:!t.unwrap(this.isStamper)},this);this.chooseMonogram=function(n){this.selectedMonogram(n);this.notSelectedMonogram(!1)}.bind(this);this.accessoryPersonalizeSubmit=function(r){var f=n(r).valid(),u;if(!f)return!1;if(this.notSelectedMonogram(!t.unwrap(this.selectedMonogram)),i.pageData.lines!=undefined)for(u=0;u<this.textLines().length;u++)i.pageData.lines[u].text=this.textLines()[u].text();return i.pageData.textLines=t.toJS(this.textLines),i.pageData.personalizeLines=this.personalizeLines(),i.pageData.selectedMonogram=this.selectedMonogram(),i.pageData.withBlankLines=this.withBlankLines(),typeof history.replaceState!="undefined"&&history.replaceState(JSON.stringify(i.pageData),""),t.unwrap(this.isValid)}.bind(this);this.update=function(r){i.utils.updateViewModel(this,r,{lines:function(u,f,e){this.textLineSpecs(t.utils.arrayMap(e,function(t){return new i.viewModels.AccessoryLineViewModel(n.extend(t,r.wysiwygTemplate))}))}})};this.bindingsCompleted=function(){this.initLoading(!1)}.bind(this);this.update(r);n(document).ready(function(){u.bindingsCompleted()})}}(jQuery,ko,ChecksUnlimitedApp),function(n,t,i){"use strict";i.viewModels.EzShieldViewModel=function(n,i,r,u,f){this.lineItems=n;this.services=i;this.loading=r;this.usePro=u;this.ezshieldCrossoutPricing=t.unwrap(f)||!1;this.lastChance=t.observable("");this.dispayPopUp=t.pureComputed(function(){var n=t.unwrap(this.lineItems).reduce(function(n,i){return n||t.unwrap(i.isCheck)},!1);return n&&!t.unwrap(this.advancedPrice)},this);this.advancedService=t.pureComputed(function(){return t.utils.arrayFirst(t.unwrap(this.services),function(n){var i=t.unwrap(n.type);return i=="P"||i=="X"})},this);this.basicPrice=t.pureComputed(function(){return t.unwrap(this.lineItems).reduce(function(n,i){return n+t.unwrap(i.services).reduce(function(n,i){return n+(t.unwrap(i.type)=="I"?t.unwrap(i.price):0)},0)},0)},this);this.basicRegularPrice=t.pureComputed(function(){return t.unwrap(this.lineItems).reduce(function(n,i){return n+t.unwrap(i.services).reduce(function(n,i){return n+(t.unwrap(i.type)=="I"?t.unwrap(i.regularPrice):0)},0)},0)},this);this.advancedPrice=t.pureComputed(function(){return t.unwrap((t.unwrap(this.advancedService)||{}).price)||0},this);this.advancedRegularPrice=t.pureComputed(function(){return t.unwrap((t.unwrap(this.advancedService)||{}).regularPrice)||0},this);this.totalPrice=t.pureComputed(function(){return t.unwrap(this.basicPrice)+t.unwrap(this.advancedPrice)},this);this.totalRegularPrice=t.pureComputed(function(){return t.unwrap(this.basicRegularPrice)+t.unwrap(this.advancedRegularPrice)},this);this.hasDiscount=t.pureComputed(function(){return t.unwrap(this.totalPrice)<t.unwrap(this.totalRegularPrice)},this);this.basicOnly=t.pureComputed(function(){return!this.advancedPrice()},this);this.isPro=t.pureComputed(function(){return t.unwrap((t.unwrap(this.advancedService)||{}).type)=="X"},this);this.isPlus=t.pureComputed(function(){return t.unwrap((t.unwrap(this.advancedService)||{}).type)=="P"},this);this.resetLastChance=function(){this.lastChance("")}.bind(this)}}(jQuery,ko,ChecksUnlimitedApp),function(n,t,i){"use strict";i.viewModels.LineItemViewModel=function(r,u){this.options=n.extend({onTierChanged:n.noop},u);this.lineItemId=t.observable(0);this.type=t.observable("");this.subType=t.observable("");this.description=t.observable("");this.extendedPrice=t.observable(0);this.quantity=t.observable(0);this.unitPrice=t.observable(0);this.checkDetail={accountCode:t.observable(""),bankCode:t.observable(""),startingNumber:t.observable("")};this.enhancements=t.observableArray([]);this.services=t.observableArray([]);this.textLines=t.observableArray([]);this.pricingTierGroups=t.observableArray([]);this.productCode=t.observable("");this.productId=t.observable(0);this.productPreviewSrc=t.observable("");this.photoProductPreviewSrc=t.observable("");this.productThumbnailSrc=t.observable("");this.quantity=t.observable(0);this.virtualProductId=t.observable(0);this.monogramLetters=t.observable("");this.wysiwygTemplate={};this.isStateCompliance=t.observable(!1);this.complianceNotice=t.observable(!1);this.gift=t.observable(!1);this.stamperPreviewSrc=t.observable("");this.stamperSymbolSrc=t.observable("");this.isPersonalizable=t.observable(!1);this.unpersonalizedFreeGift=t.observable(!1);this.notPersonalized=t.observable(!1);this.servicesTotal=t.pureComputed(function(){return t.unwrap(this.services).reduce(function(n,i){return n+t.unwrap(i.price)},0)},this);this.total=t.pureComputed(function(){var n=t.unwrap(this.enhancements).reduce(function(n,i){return n+t.unwrap(i.price)},0);return t.unwrap(this.selectedTier).price+n+t.unwrap(this.servicesTotal)},this);this.regularTotal=t.pureComputed(function(){var n=t.unwrap(this.enhancements).reduce(function(n,i){return n+t.unwrap(i.regularPrice)},0),i=t.unwrap(this.services).reduce(function(n,i){return n+t.unwrap(i.regularPrice)},0);return t.unwrap(this.selectedTier).regularPrice+n+i},this);this.typeString=t.pureComputed(function(){return t.unwrap(this.isCheckOrDeposit)?"check":"accessory"},this);this.typeToString=t.pureComputed(function(){var n="accessory";return this.isCheck()&&(n="check"),this.isDeposit()&&(n="deposit"),this.isLabel()&&(n="label"),this.isCover()&&(n="cover"),n},this);this.customerLines=t.pureComputed(function(){return t.utils.arrayMap(i.utils.sortBy(t.utils.arrayFilter(t.unwrap(this.textLines),function(n){return n.type=="C"||n.type=="P"}),"printSequence"),function(n){return n.text&&(n.text=n.text.replace("SYSTEM BLANK","")),n.text})},this);this.displayEnhancements=t.pureComputed(function(){return i.utils.sortBy(t.utils.arrayFilter(t.unwrap(this.enhancements),function(n){return t.unwrap(n.displayed)}),"printSequence")},this);this.prop65=t.pureComputed(function(){return t.unwrap(this.isStateCompliance)&&t.unwrap(this.complianceNotice)},this);this.isAccessory=t.pureComputed(function(){return t.unwrap(this.type)=="A"},this);this.acessoryOnlyProp65=t.pureComputed(function(){return t.unwrap(this.complianceNotice)&&t.unwrap(this.isAccessory)},this);this.lineItemHasComplianceWarning=t.pureComputed(function(){return t.unwrap(this.prop65)||t.unwrap(this.acessoryOnlyProp65)},this);this.isLabel=t.pureComputed(function(){return t.unwrap(this.isAccessory)&&(t.unwrap(this.subType)=="L"||t.unwrap(this.subType)=="N")},this);this.isCover=t.pureComputed(function(){return t.unwrap(this.isAccessory)&&t.unwrap(this.subType)=="B"},this);this.isCheck=t.pureComputed(function(){return t.unwrap(this.type)=="C"},this);this.isDeposit=t.pureComputed(function(){return t.unwrap(this.type)=="D"},this);this.isCheckOrDeposit=t.pureComputed(function(){return t.unwrap(this.isCheck)||t.unwrap(this.isDeposit)},this);this.readonly=t.pureComputed(function(){return!t.unwrap(this.isPersonalizable)&&t.unwrap(this.isAccessory)},this);this.selectedTierGroup=t.pureComputed(function(){var n=t.unwrap(this.productCode);return t.utils.arrayFirst(t.unwrap(this.pricingTierGroups),function(i){return t.unwrap(i.productCode)==n})},this);this.selectedTier=t.pureComputed(function(){var n=t.unwrap(this.quantity);return t.utils.arrayFirst((t.unwrap(this.selectedTierGroup)||{}).tiers||[],function(i){return t.unwrap(i.quantity)==n})},this);this.withMonogram=t.pureComputed(function(){return t.utils.arrayFirst(t.unwrap(this.displayEnhancements),function(n){return t.unwrap(n.type)=="MS"})!=null},this);this.update=function(n){i.utils.updateViewModel(this,n,{checkDetail:function(n,t,r){i.utils.updateViewModel(this.checkDetail,r)},enhancements:function(n,r,u){this.enhancements(t.utils.arrayMap(u,function(n){return new i.viewModels.EnhancementViewModel(n)}))}})};this.updateService=function(n){var r=t.utils.arrayFirst(t.unwrap(this.services),function(i){return t.unwrap(i.type)==n.type});r?(i.utils.updateViewModel(r,n),this.services.valueHasMutated()):this.services.push(n)};this.pickTier=function(n,t){this.productCode(n);this.quantity(t);this.options.onTierChanged(this,this.selectedTier,this.selectedTierGroup)}.bind(this);this.update(r)}}(jQuery,ko,ChecksUnlimitedApp),function(n,t,i){"use strict";i.viewModels.RecommendedProducts=function(r,u){var o,f,e;this.options=n.extend({onLabelChosen:n.noop,onCrossSellChosen:n.noop},u);o=n('input[name="__RequestVerificationToken"]').val();f={};f.__RequestVerificationToken=o;e=this;this.crossSell=new i.viewModels.CrossSellItems;this.oneClickLabels=t.observableArray([]);this.oneClickLabelsPricing=[];this.oneClickLabelsPersonalization=new i.viewModels.AccessoryPersonalizationViewModel;this.loading=t.observable(!1);this.selectedLabel=t.observable();this.selectedLabelPricing=t.observableArray([]);this.selectedLabelTier=t.observable();this.initialLoadingCompleted=t.observable(!1);this.selectedLabel.subscribe(function(){e.updateSelectedLabelPricing()});this.refresh=function(){this.getOneClickLabels()}.bind(this);this.getOneClickLabels=function(){this.loading(!0);n.ajax({method:"GET",url:"/cart/api/oneclicklabels",dataType:"json",headers:f,context:this}).done(function(n){this.update(n)})}.bind(this);this.addCrossSellToCart=function(i,r){return this.loading(!0),n.ajax({method:"POST",url:"/cart/api/addcrossselltocart",data:{virtualProductId:t.unwrap(i)},dataType:"json",headers:f,context:r||this}).always(function(){this.loading(!1)}.bind(this))}.bind(this);this.addLabelToCart=function(i){var r=t.unwrap(this.selectedLabel),u=t.unwrap(this.selectedLabelTier);return this.loading(!0),n.ajax({method:"POST",url:"/cart/api/addlabeltocart",data:t.toJS({virtualProductId:r.virtualProductId,productCode:r.productCode,withMonogram:this.oneClickLabelsPersonalization.withMonogram,monogramLetter:this.oneClickLabelsPersonalization.monogramLetter,isEditData:!1,personalizeLines:this.oneClickLabelsPersonalization.personalizeLines,lines:t.utils.arrayMap(t.unwrap(this.oneClickLabelsPersonalization.textLineSpecs),function(n){return{printSequence:n.printSequence,text:n.text}}),quantity:u.quantity}),dataType:"json",headers:f,context:i||this}).always(function(){this.loading(!1)}.bind(this))}.bind(this);this.updateSelectedLabelPricing=function(){this.selectedLabelPricing((t.utils.arrayFirst(e.oneClickLabelsPricing,function(n){return n.productCode==(e.selectedLabel()||{}).productCode})||[]).tiers||[]);this.selectedLabelTier(this.selectedLabelPricing()[0])}.bind(this);this.update=function(n){i.utils.updateViewModel(this,n,{oneClickLabels:function(n,r,u){this.loading(!0);this.oneClickLabels([{name:u[0].name,productCode:u[0].productCode,virtualProductId:u[0].virtualProductId,accessoryPreview:new i.viewModels.AccessoryPreviewViewModel({productPreviewSrc:u[0].productPreviewSrc,textLines:this.oneClickLabelsPersonalization.textLines,wysiwygTemplate:u[0].wysiwygTemplate,subType:u[0].subType})}]);u.splice(0,1);var f=function(n,r){let e=[];for(var u=0;u<50&&u<r.length;u++)e.push({name:r[u].name,productCode:r[u].productCode,virtualProductId:r[u].virtualProductId,accessoryPreview:new i.viewModels.AccessoryPreviewViewModel({productPreviewSrc:r[u].productPreviewSrc,textLines:n.oneClickLabelsPersonalization.textLines,wysiwygTemplate:r[u].wysiwygTemplate,subType:r[u].subType})});if(r=r.slice(50),t.utils.arrayPushAll(n.oneClickLabels,e),r.length===0){n.initialLoadingCompleted(!0);n.loading(!1);return}setTimeout(f,5,n,r)};setTimeout(f,350,this,u)}});this.selectedLabel(this.oneClickLabels()[0])}.bind(this);this.labelPersonalize=function(){t.unwrap(this.initialLoadingCompleted)||this.refresh()}.bind(this);this.chooseLabelTier=function(n){this.selectedLabelTier(n)}.bind(this);this.labelChosen=function(n){if(!this.oneClickLabelsPersonalization.accessoryPersonalizeSubmit(n))return!1;var i=t.unwrap(this.selectedLabel),r=t.unwrap(this.selectedLabelTier);this.options.onLabelChosen(this,i.virtualProductId,i.productCode,r.quantity)}.bind(this);this.crossSellChosen=function(n){this.options.onCrossSellChosen(this,n)}.bind(this)}}(jQuery,ko,ChecksUnlimitedApp),function(n,t,i){"use strict";var r=function(n,i,r){this.max=r;this.checks=!!i;this.lineItems=n;this.items=t.pureComputed(function(){return t.utils.arrayFilter(t.unwrap(this.lineItems),function(n){return t.unwrap(n.isCheckOrDeposit)&&this.checks||t.unwrap(n.isAccessory)&&!this.checks}.bind(this))},this);this.maximumExceeded=t.pureComputed(function(){return t.unwrap(this.items).length>t.unwrap(this.max)},this);this.lastIndex=t.pureComputed(function(){return t.unwrap(this.items).length-1},this)},u=function(u){this.lineItems=t.observableArray([]);this.services=t.observableArray([]);this.maxCartCheckItems=t.observable(1);this.maxCartAccessoryItems=t.observable(5);this.checkPreview=new i.viewModels.CheckPreviewViewModel;this.accessoryPreview=new i.viewModels.AccessoryPreviewViewModel;this.discountPercent=t.observable(0);this.isStateCompliance=t.observable(!1);this.isAbandoned=t.observable(u.isAbandoned);this.historyRetrieved=t.observable(u.HistoryRetrieved);this.enableEZShieldPro=t.observable(u.enableEZShieldPro);this.ezshieldCrossoutPricing=u.ezshieldCrossoutPricing||!1;this.loading=t.observable(!1);this.initLoading=t.observable(!0);this.isCheckPreview=t.observable(!0);this.removeAll=t.observable(!1);this.videoModalVisible=t.observable(!1);this.orderTotal=new i.viewModels.OrderTotalViewModel(this.lineItems,!1,this.services);this.anyError=t.pureComputed(function(){return t.unwrap(this.displayItems).reduce(function(n,i){return n||t.unwrap(i.maximumExceeded)||i.items().reduce(function(n,t){return n||t.unpersonalizedFreeGift()||t.notPersonalized()},!1)},!1)},this);this.validateCart=function(){var i,r;t.unwrap(this.isAbandoned)?(i=t.utils.arrayFirst(t.unwrap(this.lineItems),function(n){return t.unwrap(n.type)=="C"||t.unwrap(n.type)=="D"}),i!=null&&(r=t.unwrap(i.lineItemId),window.location.replace("/pz/check/"+r+"/?dcf="+(dcfParam||"")))):n("form#continueform").submit()}.bind(this);this.itemsServices=t.pureComputed(function(){return t.utils.arrayMap(t.unwrap(this.lineItems),function(n){return t.unwrap(n.services)}).reduce(function(n,t){return n.concat(t)},[])},this);this.inPlantRush=t.pureComputed(function(){return t.utils.arrayFirst(t.unwrap(this.itemsServices),function(n){return t.unwrap(n.type)=="R"})},this);this.displayItems=[new r(this.lineItems,!0,this.maxCartCheckItems),new r(this.lineItems,!1,this.maxCartAccessoryItems)];this.cartItemCount=t.pureComputed(function(){return t.unwrap(this.lineItems).length},this);this.accessoryOnly=t.pureComputed(function(){return!t.utils.arrayFirst(t.unwrap(this.lineItems),function(n){return!t.unwrap(n.isAccessory)})},this);this.update=function(r){var u=r.isStateCompliance;i.utils.updateViewModel(this,r,{lineItems:function(r,f,e){this.lineItems(t.utils.arrayMap(e,function(t){var r=n.extend(t,{isStateCompliance:u});return new i.viewModels.LineItemViewModel(r,{onTierChanged:this.updateItemPrice})}.bind(this)))},crossSell:function(n,t,i){this.recommendedProducts.crossSell.update(i)}})};this.preview=function(n){var i=t.toJS(n);this.isCheckPreview(i.isCheck||i.isDeposit);i.isCheck||i.isDeposit?this.checkPreview.update(i):this.accessoryPreview.update(i)}.bind(this);this.removeAllItems=function(){i.utils.fireGA4Event("remove_from_cart",this.lineItems,this);try{const n=t.toJS(this.lineItems);if(n&&n.length>0){let t=n.map(n=>n.productCode?";"+n.productCode:"").join(",");_satellite.track("remove_product",{product:t})}}catch(n){console.error("The tracking data for Adobe has been fallen. "+n)}return t.unwrap(this.removeAll)}.bind(this);this.upsellUpgrade=function(){return this.loading(!0),n.ajax({method:"POST",url:"/offer/api/applyupselloffer",dataType:"json",headers:f,context:this,cache:!1}).done(function(n){(n||{}).success&&this.offer.update(n)}).always(function(){this.loading(!1)})}.bind(this);this.bindingsCompleted=function(){this.initLoading(!1)}.bind(this);var e=n('input[name="__RequestVerificationToken"]').val(),f={};f.__RequestVerificationToken=e;this.removeItem=function(r){const u=this;this.loading(!0);n.ajax({method:"POST",url:"/cart/api/removeitem",data:{lineItemId:t.unwrap(r.lineItemId)},dataType:"json",headers:f,context:this,cache:!1}).done(function(n){(n||{}).success&&(n.channel!==dcfParam&&window.location.replace("/cart/?dcf="+n.channel),this.update(n),i.pageData=n)}).always(function(){this.loading(!1)});i.utils.fireGA4Event("remove_from_cart",[r],u);try{const n=t.unwrap(r.productCode);let i=n?";"+n:null;_satellite.track("remove_product",{product:i})}catch(e){console.error("The tracking data for Adobe has been fallen. "+e)}}.bind(this);this.updateItemPrice=function(r){this.loading(!0);i.utils.fireGA4Event("add_to_cart",[r],this);try{_satellite.track("change_quantity_cart",{product:t.unwrap(r.productCode)})}catch(u){console.error("The tracking data for Adobe has been fallen. "+u)}return n.ajax({method:"POST",url:"/cart/api/updateitem",data:{lineItemId:t.unwrap(r.lineItemId),productCode:t.unwrap(r.selectedTierGroup).productCode,quantity:t.unwrap(r.selectedTier).quantity},dataType:"json",headers:f,context:this,cache:!1}).done(function(n){(n||{}).success&&this.update(n)}).always(function(){this.loading(!1)})}.bind(this);this.removeRush=function(){const u=this;var r=!1;this.loading(!0);n.ajax({method:"POST",url:"/cart/api/removerush",dataType:"json",headers:f,context:this}).done(function(n){(n||{}).success&&(r=!0,this.orderTotal.update(n.orderTotal))}).always(function(){t.utils.arrayForEach(t.unwrap(this.lineItems),function(n){n.services.remove(function(n){if(t.unwrap(n.type)=="R")return i.utils.fireGA4Event("remove_from_cart",[n],u),r})});this.loading(!1)})}.bind(this);this.addEzShieldPlus=function(){const r=this;this.loading(!0);n.ajax({method:"POST",url:"/cart/api/addezshieldplus",dataType:"json",headers:f,context:this}).done(function(n){(n||{}).service&&(this.services.push(n.service),t.utils.arrayForEach(t.unwrap(this.lineItems),function(i){t.utils.arrayFirst(t.unwrap(i.enhancements),function(i){return t.unwrap(i.type)=="IL"?(i.update(n.enhancement),!0):!1})}),i.utils.fireGA4Event("add_to_cart",[n.enhancement],r),this.orderTotal.update(n.orderTotal),typeof history.replaceState!="undefined"&&history.replaceState(JSON.stringify(i.pageData),""))}).always(function(){this.loading(!1)})}.bind(this);this.removeEzShieldPlus=function(){const r=this;var u=!1;this.loading(!0);n.ajax({method:"POST",url:"/cart/api/removeezshieldplus",dataType:"json",headers:f,context:this}).done(function(n){n&&(u=!0,t.utils.arrayForEach(t.unwrap(this.lineItems),function(i){t.utils.arrayFirst(t.unwrap(i.enhancements),function(i){var r=t.unwrap(i.type);return r=="PL"||r=="PR"?(i.update(n.enhancement),!0):!1})}),this.orderTotal.update(n.orderTotal),typeof history.replaceState!="undefined"&&history.replaceState(JSON.stringify(i.pageData),""))}).always(function(){this.services.remove(function(n){var u=t.unwrap(n.type);if(u=="P"||u=="X")return i.utils.fireGA4Event("remove_from_cart",[n],r),!0});this.loading(!1)})}.bind(this);this.removeEzShield=function(){const u=this;var r=!1;this.loading(!0);n.ajax({method:"POST",url:"/cart/api/removeezshield",dataType:"json",headers:f,context:this}).done(function(n){(n||{}).success&&(r=!0,this.services.remove(function(n){var i=t.unwrap(n.type);return i=="P"||i=="X"}),this.orderTotal.update(n.orderTotal),typeof history.replaceState!="undefined"&&history.replaceState(JSON.stringify(i.pageData),""))}).always(function(){t.utils.arrayForEach(t.unwrap(this.lineItems),function(n){n.services.remove(function(n){if(t.unwrap(n.type)=="I")return i.utils.fireGA4Event("remove_from_cart",[n],u),!0});r&&n.enhancements.remove(function(n){var i=t.unwrap(n.type);return i=="IL"||i=="PL"||i=="PR"})});this.loading(!1)})}.bind(this);this.getCurrentCart=function(){this.loading(!0);n.ajax({method:"GET",url:"/cart/api/currentcart",dataType:"json",headers:f,context:this,cache:!1}).done(function(n){this.update(n)}).always(function(){this.loading(!1)})}.bind(this);this.addCrossSellToCart=function(r,u){const f=this;this.loading(!0);this.recommendedProducts.addCrossSellToCart(u.virtualProductId,this).done(function(r){if(r&&r.item){var u=n.extend(r.item,{isStateCompliance:t.unwrap(this.isStateCompliance)}),f=new i.viewModels.LineItemViewModel(u,{onTierChanged:this.updateItemPrice});this.lineItems.push(f);this.orderTotal.update(r.orderTotal);const e=t.unwrap(this.lineItems);let o=0;e&&(o=e.length);try{_satellite.track("add_to_cart_pdp",{product:";"+r.item.productCode,cartopen:o>1?"False":"True"})}catch(e){console.error("The tracking data for Adobe has been fallen. "+e)}}}).always(function(){this.loading(!1)});i.utils.fireGA4Event("add_to_cart",[u],f)}.bind(this);this.addLabelToCart=function(r,u){const f=this;this.loading(!0);this.recommendedProducts.addLabelToCart(this).done(function(r){if(r&&r.item){var u=n.extend(r.item,{isStateCompliance:t.unwrap(this.isStateCompliance)}),f=new i.viewModels.LineItemViewModel(u,{onTierChanged:this.updateItemPrice});this.lineItems.push(f);this.orderTotal.update(r.orderTotal)}}).always(function(){this.loading(!1)});i.utils.fireGA4Event("add_to_cart",[u],f)}.bind(this);this.editCartItem=function(n){const i=t.unwrap(n.productCode);try{i&&_satellite.track("edit_cart",{product:[i]})}catch(r){console.error("The tracking data for Adobe has been fallen. "+r)}window.location="/pz/"+n.typeString()+"/"+t.unwrap(n.lineItemId)+"/?dcf="+dcfParam+"#BankInfo"}.bind(this);this.recommendedProducts=new i.viewModels.RecommendedProducts(null,{onLabelChosen:this.addLabelToCart,onCrossSellChosen:this.addCrossSellToCart});this.offer=new i.viewModels.OfferViewModel({onApplied:function(n){n&&(this.getCurrentCart(),this.recommendedProducts.refresh())}.bind(this),onRemoved:function(n){n&&(this.getCurrentCart(),this.recommendedProducts.refresh())}.bind(this)});this.ezShield=new i.viewModels.EzShieldViewModel(this.lineItems,this.services,this.loading,this.enableEZShieldPro,this.ezshieldCrossoutPricing);this.update(u)};n(function(){KnockoutElse.init([this.spec={}]);var r;r=new u(i.pageData);i.utils.fireGA4Event("view_cart",r.lineItems,r);i.utils.fireGA4Event("add_to_cart",r.lineItems,r);t.unwrap(r.offer.hasAnyOffer)&&r.offer.toggleOfferBlockVisible();t.applyBindings(r);n(document).ready(function(){n("#offerBlock").delay(1500).slideToggle(1e3)})})}(jQuery,ko,ChecksUnlimitedApp)